@mastra/server 0.23.1 → 0.23.2-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.
@@ -2005,15 +2005,64 @@ var zodToJsonSchema = (schema, options) => {
2005
2005
  // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
2006
2006
  var esm_default = zodToJsonSchema;
2007
2007
 
2008
- // ../schema-compat/dist/chunk-GWTUXMDD.js
2008
+ // ../schema-compat/dist/chunk-U2HXWNAF.js
2009
+ var PATCHED = Symbol("__mastra_patched__");
2010
+ function patchRecordSchemas(schema) {
2011
+ if (!schema || typeof schema !== "object") return schema;
2012
+ if (schema[PATCHED]) return schema;
2013
+ schema[PATCHED] = true;
2014
+ const def = schema._zod?.def;
2015
+ if (def?.type === "record" && def.keyType && !def.valueType) {
2016
+ def.valueType = def.keyType;
2017
+ def.keyType = z.string();
2018
+ }
2019
+ if (!def) return schema;
2020
+ if (def.type === "object" && def.shape) {
2021
+ const shape = typeof def.shape === "function" ? def.shape() : def.shape;
2022
+ for (const key of Object.keys(shape)) {
2023
+ patchRecordSchemas(shape[key]);
2024
+ }
2025
+ }
2026
+ if (def.type === "array" && def.element) {
2027
+ patchRecordSchemas(def.element);
2028
+ }
2029
+ if (def.type === "union" && def.options) {
2030
+ def.options.forEach(patchRecordSchemas);
2031
+ }
2032
+ if (def.type === "record") {
2033
+ if (def.keyType) patchRecordSchemas(def.keyType);
2034
+ if (def.valueType) patchRecordSchemas(def.valueType);
2035
+ }
2036
+ if (def.type === "intersection") {
2037
+ if (def.left) patchRecordSchemas(def.left);
2038
+ if (def.right) patchRecordSchemas(def.right);
2039
+ }
2040
+ if (def.type === "lazy") {
2041
+ if (def.getter && typeof def.getter === "function") {
2042
+ const originalGetter = def.getter;
2043
+ def.getter = function() {
2044
+ const innerSchema = originalGetter();
2045
+ if (innerSchema) {
2046
+ patchRecordSchemas(innerSchema);
2047
+ }
2048
+ return innerSchema;
2049
+ };
2050
+ }
2051
+ }
2052
+ if (def.innerType) {
2053
+ patchRecordSchemas(def.innerType);
2054
+ }
2055
+ return schema;
2056
+ }
2009
2057
  function zodToJsonSchema2(zodSchema4, target = "jsonSchema7", strategy = "relative") {
2010
2058
  const fn = "toJSONSchema";
2011
2059
  if (fn in z) {
2060
+ patchRecordSchemas(zodSchema4);
2012
2061
  return z[fn](zodSchema4, {
2013
2062
  unrepresentable: "any",
2014
2063
  override: (ctx) => {
2015
- const def = ctx.zodSchema?._zod?.def;
2016
- if (def && def.type === "date") {
2064
+ const def = ctx.zodSchema?._def || ctx.zodSchema?._zod?.def;
2065
+ if (def && (def.typeName === "ZodDate" || def.type === "date")) {
2017
2066
  ctx.jsonSchema.type = "string";
2018
2067
  ctx.jsonSchema.format = "date-time";
2019
2068
  }
@@ -19476,5 +19525,5 @@ var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
19476
19525
  );
19477
19526
 
19478
19527
  export { agent_builder_exports, cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler };
19479
- //# sourceMappingURL=chunk-CVOGYUL7.js.map
19480
- //# sourceMappingURL=chunk-CVOGYUL7.js.map
19528
+ //# sourceMappingURL=chunk-XYQZ3T3K.js.map
19529
+ //# sourceMappingURL=chunk-XYQZ3T3K.js.map