27 lines · 935 B · Text
RawDownload
{/_This file is generated by scripts/generate-doc-snippets.ts.Edit examples/docs-sdk-quickstart/src/main.ts between the docs:start/docs:end markers instead._/} ```ts// A connection stores its value in a writable credential provider. This tiny// in-memory store is enough for a script; production hosts swap in a durable// provider (keychain, 1Password, an encrypted DB store, …). Providers are// Effect-native, so `get`/`set` return `Effect`s.const memory = new Map<string, string>();const memoryProvider: CredentialProvider = {  key: ProviderKey.make("memory"),  writable: true,  get: (id: ProviderItemId) => Effect.sync(() => memory.get(String(id)) ?? null),  set: (id: ProviderItemId, value: string) =>    Effect.sync(() => {      memory.set(String(id), value);    }),}; const executor = await createExecutor({  plugins: [openApiPlugin()],  providers: [memoryProvider],  onElicitation: "accept-all",});```