{"version":3,"sources":["../src/server/handlers/observability-storage-schemas.ts"],"names":["coreStorage","z"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAM,EAAA,GAAKA,sBAAA;AACX,IAAM,mBAAA,GAAsBC,IAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAIvC,IAAM,kBAAA,GAAqBA,KAAE,MAAA,CAAO;AAAA,EAClC,OAAA,EAASA,KAAE,OAAA,EAAQ;AAAA,EACnB,MAAA,EAAQA,KAAE,OAAA,EAAQ;AAAA,EAClB,KAAA,EAAOA,KAAE,OAAA;AACX,CAAC,CAAA;AACD,IAAM,cAAA,GAAiBA,KAAE,OAAA,EAAQ;AAE1B,IAAM,oBAAA,GAA4B,GAAG,oBAAA,IAAwB;AAC7D,IAAM,qBAAA,GAA6B,GAAG,qBAAA,IAAyB;AAC/D,IAAM,mBAAA,GAA2B,GAAG,mBAAA,IAAuB;AAC3D,IAAM,0BAAA,GAAkC,GAAG,0BAAA,IAA8B;AACzE,IAAM,uBAAA,GAA+B,GAAG,uBAAA,IAA2B;AACnE,IAAM,6BAAA,GAAqC,GAAG,6BAAA,IAAiC","file":"chunk-42NUNMRC.cjs","sourcesContent":["/**\n * Safe re-export of branches-related Zod schemas from `@mastra/core/storage`.\n *\n * Why this shim exists:\n * The `branches*` and `getBranch*` / `listBranches*` schemas (used to define\n * `/observability/branches` and `/observability/traces/:traceId/branches/:spanId`\n * routes) were introduced in `@mastra/core@1.32.0`. Earlier versions of\n * `@mastra/core` ship `@mastra/core/storage` but do not export these names.\n *\n * A direct named import (`import { branchesFilterSchema } from\n * '@mastra/core/storage'`) fails at ESM link time when this version of\n * `@mastra/server` is paired with `@mastra/core < 1.32.0`, taking the entire\n * user bundle down before any code runs.\n *\n * A namespace import tolerates missing names (`ns.MissingExport` is just\n * `undefined`, no link-time error). We then fall back to a permissive empty\n * `z.object({})` so the route definitions can still evaluate at module load\n * time. On old core the branches routes will register but their handlers\n * will fail at request time when the storage backend doesn't implement\n * `listBranches` / `getBranch` — which is the correct degradation, since\n * those storage methods don't exist on old core either.\n *\n * Once the consuming `@mastra/core` is on `1.32.0+` the schemas are real\n * and behaviour is identical to a direct named import.\n */\n\nimport * as coreStorage from '@mastra/core/storage';\nimport { z } from 'zod/v4';\n\n// Each export is typed as `any` on purpose: consumers of `@mastra/server` may\n// run their typecheck against a `@mastra/core` that doesn't export these names\n// (anything < 1.32.0). Pinning to the real types would push those names into\n// the emitted `.d.ts` and break downstream typecheck. `any` lets the schema\n// chains (`.extend(...)`, `.pick(...)`, `.partial()`) flow through cleanly on\n// every supported core.\n//\n// Runtime behaviour:\n// - On `@mastra/core >= 1.32.0` the real Zod schemas are re-exported.\n// - On older cores, fallbacks are used: `z.object({})` for object schemas\n// (still supports `.extend`, `.pick`, `.partial`) and `z.unknown()` for\n// response schemas. The branches/getBranch routes will register but their\n// handlers will fail at request time when the storage backend doesn't\n// implement `listBranches` / `getBranch` — the correct degradation, since\n// those methods don't exist on old core either.\nconst ns = coreStorage as Record;\nconst fallbackEmptyObject = z.object({});\n// `getBranchArgsSchema` is `.pick()`ed at module-eval time; the empty fallback\n// would crash because the picked keys aren't declared. Pre-declare them as\n// permissive `z.unknown()` so the route definitions evaluate cleanly.\nconst fallbackBranchArgs = z.object({\n traceId: z.unknown(),\n spanId: z.unknown(),\n depth: z.unknown(),\n});\nconst fallbackSchema = z.unknown();\n\nexport const branchesFilterSchema: any = ns.branchesFilterSchema ?? fallbackEmptyObject;\nexport const branchesOrderBySchema: any = ns.branchesOrderBySchema ?? fallbackEmptyObject;\nexport const getBranchArgsSchema: any = ns.getBranchArgsSchema ?? fallbackBranchArgs;\nexport const listBranchesResponseSchema: any = ns.listBranchesResponseSchema ?? fallbackSchema;\nexport const getBranchResponseSchema: any = ns.getBranchResponseSchema ?? fallbackSchema;\nexport const listTracesLightResponseSchema: any = ns.listTracesLightResponseSchema ?? fallbackSchema;\n"]}