( url: string | undefined, )
| 362 | * emulator with zero code substitution. |
| 363 | */ |
| 364 | export const workosApiUrlOptions = ( |
| 365 | url: string | undefined, |
| 366 | ): { apiHostname?: string; port?: number; https?: boolean } => { |
| 367 | if (!url) return {}; |
| 368 | const parsed = new URL(url); |
| 369 | return { |
| 370 | apiHostname: parsed.hostname, |
| 371 | ...(parsed.port ? { port: Number(parsed.port) } : {}), |
| 372 | https: parsed.protocol === "https:", |
| 373 | }; |
| 374 | }; |
| 375 | |
| 376 | // --------------------------------------------------------------------------- |
| 377 | // Service |