@mastra/server 1.60.0-alpha.1 → 1.60.0-alpha.2

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 (43) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +34 -0
  3. package/dist/{api-schema-manifest-B9exfVOY.js → api-schema-manifest-BlxXMFWo.js} +2 -2
  4. package/dist/{api-schema-manifest-B9exfVOY.js.map → api-schema-manifest-BlxXMFWo.js.map} +1 -1
  5. package/dist/{api-schema-manifest-C7J-8Hwe.cjs → api-schema-manifest-iAEVS-Re.cjs} +2 -2
  6. package/dist/{api-schema-manifest-C7J-8Hwe.cjs.map → api-schema-manifest-iAEVS-Re.cjs.map} +1 -1
  7. package/dist/{dist-DKBns4r6.js → dist-ByXtFaHm.js} +2 -2
  8. package/dist/{dist-DKBns4r6.js.map → dist-ByXtFaHm.js.map} +1 -1
  9. package/dist/{dist-DhGJtn6J.cjs → dist-RYanMda7.cjs} +2 -2
  10. package/dist/{dist-DhGJtn6J.cjs.map → dist-RYanMda7.cjs.map} +1 -1
  11. package/dist/docs/SKILL.md +1 -1
  12. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  13. package/dist/{routes-BlSot4At.cjs → routes-BBRC9gg2.cjs} +6 -6
  14. package/dist/{routes-BlSot4At.cjs.map → routes-BBRC9gg2.cjs.map} +1 -1
  15. package/dist/{routes-B4p8XidO.js → routes-BpOjCX2F.js} +6 -6
  16. package/dist/{routes-B4p8XidO.js.map → routes-BpOjCX2F.js.map} +1 -1
  17. package/dist/server/handlers/agent-builder.cjs +1 -1
  18. package/dist/server/handlers/agent-builder.js +1 -1
  19. package/dist/server/handlers/mcp-client-versions.cjs +1 -1
  20. package/dist/server/handlers/mcp-client-versions.js +1 -1
  21. package/dist/server/handlers/prompt-block-versions.cjs +1 -1
  22. package/dist/server/handlers/prompt-block-versions.js +1 -1
  23. package/dist/server/handlers/scorer-versions.cjs +1 -1
  24. package/dist/server/handlers/scorer-versions.js +1 -1
  25. package/dist/server/handlers/stored-agents.cjs +2 -2
  26. package/dist/server/handlers/stored-agents.js +2 -2
  27. package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
  28. package/dist/server/handlers/stored-mcp-clients.js +1 -1
  29. package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
  30. package/dist/server/handlers/stored-prompt-blocks.js +1 -1
  31. package/dist/server/handlers/stored-scorers.cjs +1 -1
  32. package/dist/server/handlers/stored-scorers.js +1 -1
  33. package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
  34. package/dist/server/handlers/stored-skill-favorites.js +1 -1
  35. package/dist/server/handlers/stored-skills.cjs +1 -1
  36. package/dist/server/handlers/stored-skills.js +1 -1
  37. package/dist/server/handlers/system.cjs +1 -1
  38. package/dist/server/handlers/system.js +1 -1
  39. package/dist/server/schemas/index.cjs +1 -1
  40. package/dist/server/schemas/index.js +1 -1
  41. package/dist/server/server-adapter/index.cjs +2 -2
  42. package/dist/server/server-adapter/index.js +2 -2
  43. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.60.0-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`7e096f0`](https://github.com/mastra-ai/mastra/commit/7e096f02f0dddbf09b85d306458351245ed2f886), [`8f0a332`](https://github.com/mastra-ai/mastra/commit/8f0a3321bf180368d76fe7b36aa1a8f60f00b6de), [`b098de9`](https://github.com/mastra-ai/mastra/commit/b098de9d7cb9f672e0883a5c716465a3a689693d), [`ef6e295`](https://github.com/mastra-ai/mastra/commit/ef6e295b59bc25a5b61b633a89c97bcfce9fb465), [`208e1b3`](https://github.com/mastra-ai/mastra/commit/208e1b39f30f4b386e494394e9d71d96f0f90241), [`c938d34`](https://github.com/mastra-ai/mastra/commit/c938d34739936c8ecbabd67ad6a4a4396f41c4c6), [`1d9a0ea`](https://github.com/mastra-ai/mastra/commit/1d9a0ea4a9901baee6cd56737243bd6d1f631ac0), [`3667679`](https://github.com/mastra-ai/mastra/commit/3667679db057edfb086846d13369fdda4902ad65), [`49696e8`](https://github.com/mastra-ai/mastra/commit/49696e8e42f870674a0a58f5abcd22cc54dd2864), [`512100a`](https://github.com/mastra-ai/mastra/commit/512100a7d8b7e9c920f2590c6b3612f5de0d3cff), [`9ef432b`](https://github.com/mastra-ai/mastra/commit/9ef432b6faa534b57b0d182a610e13dd9a7123ff), [`b9cf308`](https://github.com/mastra-ai/mastra/commit/b9cf30846f97f99ac1906ee8a68f4f2d117b0378)]:
8
+ - @mastra/core@1.60.0-alpha.2
9
+
3
10
  ## 1.60.0-alpha.1
4
11
 
5
12
  ### Patch Changes
@@ -60,20 +60,54 @@ declare class RequestContext<Values extends Record<string, any> | unknown = unkn
60
60
  constructor(iterable?: Values extends Record<string, any> ? RecordToTuple<Partial<Values>> : Iterable<readonly [string, unknown]>);
61
61
  /**
62
62
  * set a value with strict typing if `Values` is a Record and the key exists in it.
63
+ *
64
+ * Declared schema keys stay strictly typed. For runtime-only keys that are not part of
65
+ * `Values` (for example reserved middleware keys), use {@link setRaw}.
63
66
  */
64
67
  set<K extends (Values extends Record<string, any> ? keyof Values : string)>(key: K, value: Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown): void;
68
+ /**
69
+ * Set a runtime-only key that is not part of the declared `Values` schema.
70
+ *
71
+ * The runtime store is an open map: schema validation checks declared keys and
72
+ * passes undeclared keys through. Use this when writing infrastructure keys
73
+ * (for example `mastra__resourceId`) or other values that intentionally omit
74
+ * from `requestContextSchema`.
75
+ */
76
+ setRaw(key: string, value: unknown): void;
65
77
  /**
66
78
  * Get a value with its type
79
+ *
80
+ * Declared schema keys stay strictly typed. For runtime-only keys that are not part of
81
+ * `Values` (for example reserved middleware keys), use {@link getRaw}.
67
82
  */
68
83
  get<K extends (Values extends Record<string, any> ? keyof Values : string), R = Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown>(key: K): R;
84
+ /**
85
+ * Get a runtime-only key that is not part of the declared `Values` schema.
86
+ *
87
+ * Returns `unknown` because the schema does not describe these keys — narrow
88
+ * the result at the call site.
89
+ */
90
+ getRaw(key: string): unknown;
69
91
  /**
70
92
  * Check if a key exists in the container
93
+ *
94
+ * Declared schema keys stay strictly typed. For runtime-only keys, use {@link hasRaw}.
71
95
  */
72
96
  has<K extends (Values extends Record<string, any> ? keyof Values : string)>(key: K): boolean;
97
+ /**
98
+ * Check whether a runtime-only key exists in the open map.
99
+ */
100
+ hasRaw(key: string): boolean;
73
101
  /**
74
102
  * Delete a value by key
103
+ *
104
+ * Declared schema keys stay strictly typed. For runtime-only keys, use {@link deleteRaw}.
75
105
  */
76
106
  delete<K extends (Values extends Record<string, any> ? keyof Values : string)>(key: K): boolean;
107
+ /**
108
+ * Delete a runtime-only key from the open map.
109
+ */
110
+ deleteRaw(key: string): boolean;
77
111
  /**
78
112
  * Clear all values from the container
79
113
  */
@@ -1,5 +1,5 @@
1
1
  import { c as schemaToJsonSchema } from "./route-builder-YQ_gLIvW.js";
2
- import { t as SERVER_ROUTES } from "./routes-B4p8XidO.js";
2
+ import { t as SERVER_ROUTES } from "./routes-BpOjCX2F.js";
3
3
  //#region src/server/server-adapter/api-schema-manifest.ts
4
4
  function convertSchema(schema) {
5
5
  return schema ? schemaToJsonSchema(schema) : void 0;
@@ -52,4 +52,4 @@ function buildApiSchemaManifest(routes = SERVER_ROUTES) {
52
52
  //#endregion
53
53
  export { buildApiSchemaManifest };
54
54
 
55
- //# sourceMappingURL=api-schema-manifest-B9exfVOY.js.map
55
+ //# sourceMappingURL=api-schema-manifest-BlxXMFWo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-B9exfVOY.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 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\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,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;AAEA,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-BlxXMFWo.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 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\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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B,cAAc;GAClD;EACF,CAAC;CACH;AACF"}
@@ -1,5 +1,5 @@
1
1
  const require_route_builder = require("./route-builder-BAAedfru.cjs");
2
- const require_routes = require("./routes-BlSot4At.cjs");
2
+ const require_routes = require("./routes-BBRC9gg2.cjs");
3
3
  //#region src/server/server-adapter/api-schema-manifest.ts
4
4
  function convertSchema(schema) {
5
5
  return schema ? require_route_builder.schemaToJsonSchema(schema) : void 0;
@@ -52,4 +52,4 @@ function buildApiSchemaManifest(routes = require_routes.SERVER_ROUTES) {
52
52
  //#endregion
53
53
  exports.buildApiSchemaManifest = buildApiSchemaManifest;
54
54
 
55
- //# sourceMappingURL=api-schema-manifest-C7J-8Hwe.cjs.map
55
+ //# sourceMappingURL=api-schema-manifest-iAEVS-Re.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-schema-manifest-C7J-8Hwe.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 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\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,Q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CAAC;CACH;AACF"}
1
+ {"version":3,"file":"api-schema-manifest-iAEVS-Re.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 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\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,IAAI,IAAI,KAAK,KAAK,OAAO,IAAI;AACpD;AAEA,SAAS,mBAAmB,gBAAiE;CAC3F,IAAI,CAAC,gBAAgB,OAAO,EAAE,MAAM,UAAU;CAE9C,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;AAEA,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"}
@@ -22,8 +22,8 @@ import { coreFeatures } from "@mastra/core/features";
22
22
  import { EntityType, SpanType, createObservabilityContext, getOrCreateSpan } from "@mastra/core/observability";
23
23
  import { MASTRA_THREAD_ID_KEY, RequestContext } from "@mastra/core/request-context";
24
24
  import { MessageHistory } from "@mastra/core/processors";
25
- import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
26
25
  import { createStep, createWorkflow } from "@mastra/core/workflows";
26
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
27
27
  import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "path";
28
28
  import { channel, tracingChannel } from "diagnostics_channel";
29
29
  import { AsyncLocalStorage } from "async_hooks";
@@ -43587,4 +43587,4 @@ const agentBuilderWorkflows = {
43587
43587
  //#endregion
43588
43588
  export { agentBuilderWorkflows };
43589
43589
 
43590
- //# sourceMappingURL=dist-DKBns4r6.js.map
43590
+ //# sourceMappingURL=dist-ByXtFaHm.js.map