{"version":3,"file":"secretmanager-vHQoXdQz.mjs","names":[],"sources":["../src/runtime/secretmanager.ts"],"sourcesContent":["/**\n * Secret manager utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.secretmanager` runtime API.\n * At runtime this delegates to `globalThis.tailor.secretmanager`. Use\n * `mockSecretmanager` from `@tailor-platform/sdk/vitest` to mock these calls\n * in unit tests.\n * @example\n * import { secretmanager } from \"@tailor-platform/sdk/runtime\";\n *\n * const apiKey = await secretmanager.getSecret(\"my-vault\", \"API_KEY\");\n * const all = await secretmanager.getSecrets(\"my-vault\", [\"A\", \"B\"] as const);\n */\n\n/**\n * Platform API surface for `tailor.secretmanager`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.secretmanager`.\n */\nexport interface TailorSecretmanagerAPI {\n  /**\n   * Returns multiple secrets from a vault. Missing names are omitted from the result.\n   * @param vault - Vault name\n   * @param names - Secret names to fetch (use `as const` to narrow the result key)\n   * @returns Partial record keyed by the requested names\n   */\n  getSecrets<const T extends readonly string[]>(\n    vault: string,\n    names: T,\n  ): Promise<Partial<Record<T[number], string>>>;\n\n  /**\n   * Returns a single secret from a vault, or `undefined` when missing.\n   * @param vault - Vault name\n   * @param name - Secret name\n   * @returns The secret value, or `undefined` if not present\n   */\n  getSecret(vault: string, name: string): Promise<string | undefined>;\n}\n\nconst api = (): TailorSecretmanagerAPI =>\n  (globalThis as unknown as { tailor: { secretmanager: TailorSecretmanagerAPI } }).tailor\n    .secretmanager;\n\nconst getSecrets: TailorSecretmanagerAPI[\"getSecrets\"] = (...args) => api().getSecrets(...args);\n\nconst getSecret: TailorSecretmanagerAPI[\"getSecret\"] = (...args) => api().getSecret(...args);\n\n/** Runtime wrapper namespace for `tailor.secretmanager`. */\nexport const secretmanager = {\n  getSecrets,\n  getSecret,\n} as const satisfies TailorSecretmanagerAPI;\n"],"mappings":"AAuCA,MAAM,QACH,WAAgF,OAC9E,cAOQ,EAAgB,CAC3B,YANwD,GAAG,IAAS,IAAI,CAAC,CAAC,WAAW,GAAG,CAAI,EAO5F,WALsD,GAAG,IAAS,IAAI,CAAC,CAAC,UAAU,GAAG,CAAI,CAM3F"}