@mastra/server 1.80.0 → 1.81.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +51 -12
  2. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +144 -42
  3. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-v6/dist/index.d.ts +53 -14
  4. package/dist/{agent-builder-DXhQCXod.cjs → agent-builder-DIEX-as5.cjs} +2 -2
  5. package/dist/{agent-builder-DXhQCXod.cjs.map → agent-builder-DIEX-as5.cjs.map} +1 -1
  6. package/dist/{agent-builder-CrmZ77IU.js → agent-builder-XhBB0Svr.js} +2 -2
  7. package/dist/{agent-builder-CrmZ77IU.js.map → agent-builder-XhBB0Svr.js.map} +1 -1
  8. package/dist/{api-schema-manifest-JUFooPZG.js → api-schema-manifest-BVPhF1ZS.js} +2 -2
  9. package/dist/{api-schema-manifest-JUFooPZG.js.map → api-schema-manifest-BVPhF1ZS.js.map} +1 -1
  10. package/dist/{api-schema-manifest-CwFjht0V.cjs → api-schema-manifest-BWId44SV.cjs} +2 -2
  11. package/dist/{api-schema-manifest-CwFjht0V.cjs.map → api-schema-manifest-BWId44SV.cjs.map} +1 -1
  12. package/dist/{dist-qgP3izdE.cjs → dist-BK1fCE4z.cjs} +1 -1
  13. package/dist/{dist-DK9HHAgo.js → dist-BLjE21MA.js} +2143 -2025
  14. package/dist/dist-BLjE21MA.js.map +1 -0
  15. package/dist/{dist-DXDt4qI1.cjs → dist-OpNBTIST.cjs} +2191 -2031
  16. package/dist/dist-OpNBTIST.cjs.map +1 -0
  17. package/dist/dist-_M1jEPcL.js +1 -0
  18. package/dist/docs/SKILL.md +1 -1
  19. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  20. package/dist/docs/references/reference-observability-tracing-advanced-queries.md +33 -16
  21. package/dist/{memory-DQXCDswv.js → memory-BTR95ujT.js} +3 -3
  22. package/dist/{memory-DQXCDswv.js.map → memory-BTR95ujT.js.map} +1 -1
  23. package/dist/{memory-DpKQ1Quf.cjs → memory-Buhi6kZ-.cjs} +3 -3
  24. package/dist/{memory-DpKQ1Quf.cjs.map → memory-Buhi6kZ-.cjs.map} +1 -1
  25. package/dist/{observability-65rZOqJk.js → observability-BgIU0otL.js} +2 -2
  26. package/dist/{observability-65rZOqJk.js.map → observability-BgIU0otL.js.map} +1 -1
  27. package/dist/{observability-CFKSxaff.cjs → observability-DHuljMXO.cjs} +2 -2
  28. package/dist/{observability-CFKSxaff.cjs.map → observability-DHuljMXO.cjs.map} +1 -1
  29. package/dist/{observability-new-endpoints-CDeHfFNP.cjs → observability-new-endpoints-CaTskbSh.cjs} +12 -3
  30. package/dist/observability-new-endpoints-CaTskbSh.cjs.map +1 -0
  31. package/dist/{observability-new-endpoints-B6MRJ5Rb.js → observability-new-endpoints-CsUP8y2j.js} +13 -4
  32. package/dist/observability-new-endpoints-CsUP8y2j.js.map +1 -0
  33. package/dist/{probe-image-size-DqKTuApZ.cjs → probe-image-size-BIZUe8Bp.cjs} +50 -678
  34. package/dist/probe-image-size-BIZUe8Bp.cjs.map +1 -0
  35. package/dist/{probe-image-size-BLtXo-AD.js → probe-image-size-BqH96zcz.js} +50 -678
  36. package/dist/probe-image-size-BqH96zcz.js.map +1 -0
  37. package/dist/{routes-CbwRkg8_.cjs → routes-By3cLbPV.cjs} +5 -5
  38. package/dist/{routes-CbwRkg8_.cjs.map → routes-By3cLbPV.cjs.map} +1 -1
  39. package/dist/{routes-M2U8U4Jl.js → routes-CBrxFxzL.js} +5 -5
  40. package/dist/{routes-M2U8U4Jl.js.map → routes-CBrxFxzL.js.map} +1 -1
  41. package/dist/server/handlers/agent-builder.cjs +1 -1
  42. package/dist/server/handlers/agent-builder.js +1 -1
  43. package/dist/server/handlers/memory.cjs +1 -1
  44. package/dist/server/handlers/memory.js +1 -1
  45. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  46. package/dist/server/handlers/observability-new-endpoints.d.ts +36 -4
  47. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  48. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  49. package/dist/server/handlers/observability-shared.cjs +27 -0
  50. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  51. package/dist/server/handlers/observability-shared.d.ts +10 -0
  52. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  53. package/dist/server/handlers/observability-shared.js +24 -1
  54. package/dist/server/handlers/observability-shared.js.map +1 -1
  55. package/dist/server/handlers/observability.cjs +2 -2
  56. package/dist/server/handlers/observability.js +2 -2
  57. package/dist/server/handlers/system.cjs +2 -2
  58. package/dist/server/handlers/system.d.ts +4 -0
  59. package/dist/server/handlers/system.d.ts.map +1 -1
  60. package/dist/server/handlers/system.js +2 -2
  61. package/dist/server/handlers.cjs +3 -3
  62. package/dist/server/handlers.js +3 -3
  63. package/dist/server/schemas/index.cjs +1 -1
  64. package/dist/server/schemas/index.js +1 -1
  65. package/dist/server/schemas/system.d.ts +4 -0
  66. package/dist/server/schemas/system.d.ts.map +1 -1
  67. package/dist/server/server-adapter/index.cjs +1 -1
  68. package/dist/server/server-adapter/index.js +1 -1
  69. package/dist/server/server-adapter/routes/observability.d.ts +18 -2
  70. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  71. package/dist/server/server-adapter/routes/system.d.ts +4 -0
  72. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  73. package/dist/{system-DGfJlOxK.cjs → system-BxHpBJiq.cjs} +3 -1
  74. package/dist/system-BxHpBJiq.cjs.map +1 -0
  75. package/dist/{system-B8L_G4oo.js → system-CxwzIMsy.js} +3 -1
  76. package/dist/system-CxwzIMsy.js.map +1 -0
  77. package/package.json +7 -7
  78. package/dist/dist-C_xVj979.js +0 -1
  79. package/dist/dist-DK9HHAgo.js.map +0 -1
  80. package/dist/dist-DXDt4qI1.cjs.map +0 -1
  81. package/dist/observability-new-endpoints-B6MRJ5Rb.js.map +0 -1
  82. package/dist/observability-new-endpoints-CDeHfFNP.cjs.map +0 -1
  83. package/dist/probe-image-size-BLtXo-AD.js.map +0 -1
  84. package/dist/probe-image-size-DqKTuApZ.cjs.map +0 -1
  85. package/dist/system-B8L_G4oo.js.map +0 -1
  86. package/dist/system-DGfJlOxK.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-JUFooPZG.js","names":[],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;AA2BA,SAAS,cAAc,QAA4D;CACjF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AO,EAAE,MAAM,SAAS;CAC/F,OAAO,EAAE,MAAM,SAAS;AAC1B;AAWA,SAAS,gBAAgB,OAA6B;CACpD,OAAO,MAAM,iBAAiB,UAAU,CAAC,MAAM;AACjD;AAEA,SAAgB,uBAAuB,SAAiC,eAAkC;CACxG,OAAO;EACL,SAAS;EACT,QAAQ,OAAO,OAAO,eAAe,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"api-schema-manifest-BVPhF1ZS.js","names":[],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;AA2BA,SAAS,cAAc,QAA4D;CACjF,OAAO,SAAS,mBAAmB,MAAM,IAAI,KAAA;AAC/C;AAEA,SAAS,aAAa,OAAyC;CAC7D,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAwB,KAAA;AAChG;AAEA,SAAS,WAAW,QAAkE;CACpF,MAAM,OAAO,QAAQ;CACrB,OAAO,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,OAAO,IAAI;AACpD;AAEA,SAAS,mBAAmB,gBAAiE;CAC3F,IAAI,CAAC,gBAAgB,OAAO,EAAE,MAAM,UAAU;CAE9C,MAAM,eAAsC,eAAe,SAAS,eAAe;CACnF,IAAI,cAAc,QAAQ;EACxB,MAAM,SAAS,aAAa,KAAI,WAAU,mBAAmB,aAAa,MAAM,CAAC,CAAC;EAClF,MAAM,QAAQ,OAAO;EACrB,OAAO,OAAO,OACZ,UACE,MAAM,SAAS,MAAM,QACrB,MAAM,iBAAiB,MAAM,gBAC7B,MAAM,uBAAuB,MAAM,kBACvC,IACI,QACA,EAAE,MAAM,SAAS;CACvB;CAEA,MAAM,OAAO,WAAW,cAAc;CACtC,IAAI,SAAS,SAAS,OAAO,EAAE,MAAM,QAAQ;CAC7C,IAAI,SAAS,UAAU,OAAO,EAAE,MAAM,SAAS;CAE/C,MAAM,aACJ,eAAe,cAAc,CAAC,MAAM,QAAQ,eAAe,UAAU,IAAI,eAAe,aAAa,CAAC;CACxG,MAAM,gBAAgB,OAAO,KAAK,UAAU;CAC5C,MAAM,qBAAqB,UAAU,aAAa,SAAS,gBAAgB,aAAa,eAAe,KAAA;CACvG,MAAM,eAAe,OAAO,QAAQ,UAAU,CAAC,CAAC,MAC7C,GAAG,cAAc,WAAW,aAAa,QAAQ,CAAC,MAAM,OAC3D,CAAC,GAAG;CAEJ,IAAI,iBAAiB,sBAAsB,cAAc,UAAU,IACjE,OAAO;EAAE,MAAM;EAAmB;EAAc;CAAmB;CAErE,IAAI,eAAe,wBAAwB,cAAc,WAAW,GAAG,OAAO,EAAE,MAAM,SAAS;CAC/F,OAAO,EAAE,MAAM,SAAS;AAC1B;AAWA,SAAS,gBAAgB,OAA6B;CACpD,OAAO,MAAM,iBAAiB,UAAU,CAAC,MAAM;AACjD;AAEA,SAAgB,uBAAuB,SAAiC,eAAkC;CACxG,OAAO;EACL,SAAS;EACT,QAAQ,OAAO,OAAO,eAAe,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
@@ -1,6 +1,6 @@
1
1
  require("./rolldown-runtime-10nMEhjP.cjs");
2
2
  const require_route_builder = require("./route-builder-CvARmqnA.cjs");
3
- const require_routes = require("./routes-CbwRkg8_.cjs");
3
+ const require_routes = require("./routes-By3cLbPV.cjs");
4
4
  // src/server/server-adapter/api-schema-manifest.ts
5
5
  function convertSchema(schema) {
6
6
  return schema ? require_route_builder.schemaToJsonSchema(schema) : void 0;
@@ -58,4 +58,4 @@ function buildApiSchemaManifest(routes = require_routes.SERVER_ROUTES) {
58
58
  }
59
59
  exports.buildApiSchemaManifest = buildApiSchemaManifest;
60
60
 
61
- //# sourceMappingURL=api-schema-manifest-CwFjht0V.cjs.map
61
+ //# sourceMappingURL=api-schema-manifest-BWId44SV.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-CwFjht0V.cjs","names":["schemaToJsonSchema","SERVER_ROUTES"],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"mappings":";;;;AA2BA,SAAS,cAAc,QAA4D;CACjF,OAAO,SAASA,sBAAAA,mBAAmB,MAAM,IAAI,KAAA;AAC/C;AAEA,SAAS,aAAa,OAAyC;CAC7D,OAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAwB,KAAA;AAChG;AAEA,SAAS,WAAW,QAAkE;CACpF,MAAM,OAAO,QAAQ;CACrB,OAAO,MAAM,QAAQ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,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"api-schema-manifest-BWId44SV.cjs","names":["schemaToJsonSchema","SERVER_ROUTES"],"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const alternatives: unknown[] | undefined = responseSchema.anyOf ?? responseSchema.oneOf;\n if (alternatives?.length) {\n const shapes = alternatives.map(schema => inferResponseShape(asJsonSchema(schema)));\n const first = shapes[0]!;\n return shapes.every(\n shape =>\n shape.kind === first.kind &&\n shape.listProperty === first.listProperty &&\n shape.paginationProperty === first.paginationProperty,\n )\n ? first\n : { kind: 'single' };\n }\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\n/** CLI flags cover all request variants; the endpoint still validates the selected variant. */\nexport function getApiSchemaPropertyNames(schema: JSONSchema7 | undefined): string[] {\n if (!schema) return [];\n const names = Object.keys(schema.properties ?? {});\n for (const branch of schema.anyOf ?? schema.oneOf ?? [])\n names.push(...getApiSchemaPropertyNames(asJsonSchema(branch)));\n return [...new Set(names)].sort();\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"],"m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;CAErE,IAAI,eAAe,wBAAwB,cAAc,WAAW,GAAG,OAAO,EAAE,MAAM,SAAS;CAC/F,OAAO,EAAE,MAAM,SAAS;AAC1B;AAWA,SAAS,gBAAgB,OAA6B;CACpD,OAAO,MAAM,iBAAiB,UAAU,CAAC,MAAM;AACjD;AAEA,SAAgB,uBAAuB,SAAiCC,eAAAA,eAAkC;CACxG,OAAO;EACL,SAAS;EACT,QAAQ,OAAO,OAAO,eAAe,CAAC,CAAC,KAAI,UAAS;GAClD,MAAM,iBAAiB,cAAc,MAAM,cAAc;GACzD,OAAO;IACL,QAAQ,MAAM;IACd,MAAM,MAAM;IACZ,cAAc,MAAM;IACpB,iBAAiB,cAAc,MAAM,eAAe;IACpD,kBAAkB,cAAc,MAAM,gBAAgB;IACtD,YAAY,cAAc,MAAM,UAAU;IAC1C;IACA,eAAe,mBAAmB,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
@@ -1,3 +1,3 @@
1
1
  require("./rolldown-runtime-10nMEhjP.cjs");
2
- const require_dist = require("./dist-DXDt4qI1.cjs");
2
+ const require_dist = require("./dist-OpNBTIST.cjs");
3
3
  exports.openai = require_dist.openai;