( url: string | undefined, )
| 301 | * emulator with zero code substitution. |
| 302 | */ |
| 303 | export const workosApiUrlOptions = ( |
| 304 | url: string | undefined, |
| 305 | ): { apiHostname?: string; port?: number; https?: boolean } => { |
| 306 | if (!url) return {}; |
| 307 | const parsed = new URL(url); |
| 308 | return { |
| 309 | apiHostname: parsed.hostname, |
| 310 | ...(parsed.port ? { port: Number(parsed.port) } : {}), |
| 311 | https: parsed.protocol === "https:", |
| 312 | }; |
| 313 | }; |
| 314 | |
| 315 | // --------------------------------------------------------------------------- |
| 316 | // Service |