MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / requestInstance

Function requestInstance

e2e/src/emulator-instance.ts:21–39  ·  view source on GitHub ↗
(service: string, label: string)

Source from the content-addressed store, hash-verified

19const RETRIES = 3;
20
21const 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

Callers 1

createEmulatorInstanceFunction · 0.85

Calls 2

jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected