( url: string | undefined, )
| 384 | * emulator with zero code substitution. |
| 385 | */ |
| 386 | export const workosApiUrlOptions = ( |
| 387 | url: string | undefined, |
| 388 | ): { apiHostname?: string; port?: number; https?: boolean } => { |
| 389 | if (!url) return {}; |
| 390 | const parsed = new URL(url); |
| 391 | return { |
| 392 | apiHostname: parsed.hostname, |
| 393 | ...(parsed.port ? { port: Number(parsed.port) } : {}), |
| 394 | https: parsed.protocol === "https:", |
| 395 | }; |
| 396 | }; |
| 397 | |
| 398 | // --------------------------------------------------------------------------- |
| 399 | // Service |