(service: string, label: string)
| 19 | const RETRIES = 3; |
| 20 | |
| 21 | const requestInstance = (service: string, label: string) => |
| 22 | Effect.tryPromise({ |
| 23 | try: async (): Promise<string> => { |
| 24 | const response = await fetch(`https://${service}.emulators.dev/_emulate/instances`, { |
| 25 | method: "POST", |
| 26 | headers: { "content-type": "application/json" }, |
| 27 | body: JSON.stringify({ instance: label }), |
| 28 | }); |
| 29 | if (!response.ok) { |
| 30 | throw new EmulatorInstanceError(service, `HTTP ${response.status}`); |
| 31 | } |
| 32 | const instance = (await response.json()) as { readonly providerBaseUrl: string }; |
| 33 | return instance.providerBaseUrl; |
| 34 | }, |
| 35 | catch: (cause) => |
| 36 | cause instanceof EmulatorInstanceError |
| 37 | ? cause |
| 38 | : new EmulatorInstanceError(service, String(cause)), |
| 39 | }); |
| 40 | |
| 41 | // Hosted service hosts (e.g. resend.emulators.dev) are control plane only — |
| 42 | // there is no shared default instance behind them. Every scenario creates its |
no test coverage detected