( tenantUrl: string, tenant: string, service: WorkdayServiceKey )
| 179 | * @throws Error if tenantUrl is not a trusted Workday-hosted URL (SSRF guard) |
| 180 | */ |
| 181 | export function buildServiceUrl( |
| 182 | tenantUrl: string, |
| 183 | tenant: string, |
| 184 | service: WorkdayServiceKey |
| 185 | ): string { |
| 186 | const validation = validateWorkdayTenantUrl(tenantUrl) |
| 187 | if (!validation.isValid) { |
| 188 | throw new Error(validation.error ?? 'Invalid tenantUrl') |
| 189 | } |
| 190 | const svc = WORKDAY_SERVICES[service] |
| 191 | const baseUrl = (validation.sanitized ?? tenantUrl).replace(/\/$/, '') |
| 192 | return `${baseUrl}/ccx/service/${tenant}/${svc.name}/${svc.version}` |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Builds the WSDL URL for a Workday SOAP service. Retained for backwards compatibility |
no test coverage detected