( url: string | undefined, )
| 119 | * emulator with zero code substitution. |
| 120 | */ |
| 121 | export const workosApiUrlOptions = ( |
| 122 | url: string | undefined, |
| 123 | ): { apiHostname?: string; port?: number; https?: boolean } => { |
| 124 | if (!url) return {}; |
| 125 | const parsed = new URL(url); |
| 126 | return { |
| 127 | apiHostname: parsed.hostname, |
| 128 | ...(parsed.port ? { port: Number(parsed.port) } : {}), |
| 129 | https: parsed.protocol === "https:", |
| 130 | }; |
| 131 | }; |
| 132 | |
| 133 | // --------------------------------------------------------------------------- |
| 134 | // Service |