{"version":3,"file":"aigateway-DsWDjzk4.mjs","names":[],"sources":["../src/runtime/aigateway.ts"],"sourcesContent":["/**\n * AI Gateway utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.aigateway` runtime API.\n * At runtime this delegates to `globalThis.tailor.aigateway`. Use `mockAigateway`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n *\n * `name` is narrowed to the AI Gateway names defined via `defineAIGateway()`\n * once `tailor.d.ts` has been generated (via `tailor deploy`/`generate`).\n * @example\n * import { aigateway } from \"@tailor-platform/sdk/runtime\";\n *\n * const { url } = await aigateway.get(\"my-aigateway\");\n */\n\n// Import from the public entry (not `#/configure/types/aigateway-name`) so this d.ts\n// references `@tailor-platform/sdk` externally instead of inlining the registry — the\n// same generated `declare module \"@tailor-platform/sdk\"` that narrows\n// `authconnection.getConnectionToken` then also narrows this entry.\nimport type { AIGatewayName } from \"@tailor-platform/sdk\";\n\n/** Result of {@link TailorAigatewayAPI.get}. */\nexport interface GetAIGatewayResult {\n  /** The platform-assigned URL of the AI Gateway. */\n  url: string;\n}\n\n/**\n * Platform API surface for `tailor.aigateway`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.aigateway`.\n */\nexport interface TailorAigatewayAPI {\n  /**\n   * Resolves an AI Gateway defined in the caller's own workspace.\n   * @param name - AI Gateway name, as passed to `defineAIGateway()`\n   * @returns The resolved AI Gateway's platform-assigned URL\n   */\n  get(name: AIGatewayName): Promise<GetAIGatewayResult>;\n}\n\nconst api = (): TailorAigatewayAPI =>\n  (globalThis as unknown as { tailor: { aigateway: TailorAigatewayAPI } }).tailor.aigateway;\n\nconst get: TailorAigatewayAPI[\"get\"] = (...args) => api().get(...args);\n\n/** Runtime wrapper namespace for `tailor.aigateway`. */\nexport const aigateway = { get } as const satisfies TailorAigatewayAPI;\n"],"mappings":"AAwCA,MAAM,QACH,WAAwE,OAAO,UAKrE,EAAY,CAAE,KAHa,GAAG,IAAS,IAAI,CAAC,CAAC,IAAI,GAAG,CAAI,CAGtC"}