@mastra/schema-compat 1.3.15 → 1.3.16
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.
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +206 -873
- package/dist/_types/@internal_ai-v6/dist/index.d.ts +851 -1176
- package/dist/{esm-CWlHuVIx.js → esm-DA8owk0L.js} +60 -70
- package/dist/{esm-CWlHuVIx.js.map → esm-DA8owk0L.js.map} +1 -1
- package/dist/{esm-CkNCkZSB.cjs → esm-zrVJTTxY.cjs} +60 -70
- package/dist/{esm-CkNCkZSB.cjs.map → esm-zrVJTTxY.cjs.map} +1 -1
- package/dist/index.cjs +146 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +146 -153
- package/dist/index.js.map +1 -1
- package/dist/{json-schema-R8yfooPa.js → json-schema-DcMkkbbI.js} +55 -46
- package/dist/{json-schema-R8yfooPa.js.map → json-schema-DcMkkbbI.js.map} +1 -1
- package/dist/{json-schema-VSnKq6-P.cjs → json-schema-Dh7B27IP.cjs} +55 -46
- package/dist/{json-schema-VSnKq6-P.cjs.map → json-schema-Dh7B27IP.cjs.map} +1 -1
- package/dist/{json-schema-traverse-DbuWNYgg.cjs → json-schema-traverse-CKLDTw5l.cjs} +3 -3
- package/dist/{json-schema-traverse-DbuWNYgg.cjs.map → json-schema-traverse-CKLDTw5l.cjs.map} +1 -1
- package/dist/{json-schema-traverse-B35mHRM8.js → json-schema-traverse-Jrimn_T_.js} +3 -3
- package/dist/{json-schema-traverse-B35mHRM8.js.map → json-schema-traverse-Jrimn_T_.js.map} +1 -1
- package/dist/json-to-zod.cjs +84 -72
- package/dist/json-to-zod.cjs.map +1 -1
- package/dist/json-to-zod.js +84 -72
- package/dist/json-to-zod.js.map +1 -1
- package/dist/{schema-IhrnbMI3.cjs → schema-BXSe2bgB.cjs} +3 -3
- package/dist/schema-BXSe2bgB.cjs.map +1 -0
- package/dist/{schema-e0VHpMt0.js → schema-CzbEIyhE.js} +2 -2
- package/dist/{schema-e0VHpMt0.js.map → schema-CzbEIyhE.js.map} +1 -1
- package/dist/schema.cjs +1 -1
- package/dist/schema.js +1 -2
- package/dist/standard-schema/adapters/ai-sdk.cjs +1 -5
- package/dist/standard-schema/adapters/ai-sdk.cjs.map +1 -1
- package/dist/standard-schema/adapters/ai-sdk.js +1 -5
- package/dist/standard-schema/adapters/ai-sdk.js.map +1 -1
- package/dist/standard-schema/adapters/json-schema.cjs +1 -1
- package/dist/standard-schema/adapters/json-schema.js +1 -2
- package/dist/standard-schema/adapters/zod-v3.cjs +2 -2
- package/dist/standard-schema/adapters/zod-v3.js +2 -2
- package/dist/zod-to-json.cjs +5 -3
- package/dist/zod-to-json.cjs.map +1 -1
- package/dist/zod-to-json.js +5 -3
- package/dist/zod-to-json.js.map +1 -1
- package/package.json +14 -15
- package/dist/schema-IhrnbMI3.cjs.map +0 -1
|
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
10
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
11
|
key = keys[i];
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
@@ -115,4 +115,4 @@ Object.defineProperty(exports, "require_json_schema_traverse", {
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
//# sourceMappingURL=json-schema-traverse-
|
|
118
|
+
//# sourceMappingURL=json-schema-traverse-CKLDTw5l.cjs.map
|
package/dist/{json-schema-traverse-DbuWNYgg.cjs.map → json-schema-traverse-CKLDTw5l.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-traverse-
|
|
1
|
+
{"version":3,"file":"json-schema-traverse-CKLDTw5l.cjs","names":[],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/json-schema-traverse/1.0.0/57629b43e2af2bb885dfbbc8334b79bda8a7cd4a9b7fff008a3a0a2e53fb18be/node_modules/json-schema-traverse/index.js"],"sourcesContent":["'use strict';\n\nvar traverse = module.exports = function (schema, opts, cb) {\n // Legacy support for v0.3.1 and earlier.\n if (typeof opts == 'function') {\n cb = opts;\n opts = {};\n }\n\n cb = opts.cb || cb;\n var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};\n var post = cb.post || function() {};\n\n _traverse(opts, pre, post, schema, '', schema);\n};\n\n\ntraverse.keywords = {\n additionalItems: true,\n items: true,\n contains: true,\n additionalProperties: true,\n propertyNames: true,\n not: true,\n if: true,\n then: true,\n else: true\n};\n\ntraverse.arrayKeywords = {\n items: true,\n allOf: true,\n anyOf: true,\n oneOf: true\n};\n\ntraverse.propsKeywords = {\n $defs: true,\n definitions: true,\n properties: true,\n patternProperties: true,\n dependencies: true\n};\n\ntraverse.skipKeywords = {\n default: true,\n enum: true,\n const: true,\n required: true,\n maximum: true,\n minimum: true,\n exclusiveMaximum: true,\n exclusiveMinimum: true,\n multipleOf: true,\n maxLength: true,\n minLength: true,\n pattern: true,\n format: true,\n maxItems: true,\n minItems: true,\n uniqueItems: true,\n maxProperties: true,\n minProperties: true\n};\n\n\nfunction _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {\n if (schema && typeof schema == 'object' && !Array.isArray(schema)) {\n pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n for (var key in schema) {\n var sch = schema[key];\n if (Array.isArray(sch)) {\n if (key in traverse.arrayKeywords) {\n for (var i=0; i<sch.length; i++)\n _traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);\n }\n } else if (key in traverse.propsKeywords) {\n if (sch && typeof sch == 'object') {\n for (var prop in sch)\n _traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);\n }\n } else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {\n _traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);\n }\n }\n post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n }\n}\n\n\nfunction escapeJsonPtr(str) {\n return str.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAEA,IAAI,WAAW,OAAO,UAAU,SAAU,QAAQ,MAAM,IAAI;EAE1D,IAAI,OAAO,QAAQ,YAAY;GAC7B,KAAK;GACL,OAAO,CAAC;EACV;EAEA,KAAK,KAAK,MAAM;EAChB,IAAI,MAAO,OAAO,MAAM,aAAc,KAAK,GAAG,OAAO,WAAW,CAAC;EACjE,IAAI,OAAO,GAAG,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Y,SAAS,KAAK,QAAQ,IAAI;IAAA,OAE5H,IAAI,OAAO,SAAS,YAAa,KAAK,WAAW,EAAE,OAAO,SAAS,eACxE,UAAU,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,KAAK,YAAY,SAAS,KAAK,MAAM;GAEzF;GACA,KAAK,QAAQ,SAAS,YAAY,eAAe,eAAe,cAAc,QAAQ;EACxF;CACF;CAGA,SAAS,cAAc,KAAK;EAC1B,OAAO,IAAI,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,OAAO,IAAI;CACpD"}
|
|
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
10
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
11
|
key = keys[i];
|
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
@@ -98,4 +98,4 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin(((exports, modu
|
|
|
98
98
|
//#endregion
|
|
99
99
|
export { __commonJSMin as n, __toESM as r, require_json_schema_traverse as t };
|
|
100
100
|
|
|
101
|
-
//# sourceMappingURL=json-schema-traverse-
|
|
101
|
+
//# sourceMappingURL=json-schema-traverse-Jrimn_T_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-traverse-
|
|
1
|
+
{"version":3,"file":"json-schema-traverse-Jrimn_T_.js","names":[],"sources":["../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/json-schema-traverse/1.0.0/57629b43e2af2bb885dfbbc8334b79bda8a7cd4a9b7fff008a3a0a2e53fb18be/node_modules/json-schema-traverse/index.js"],"sourcesContent":["'use strict';\n\nvar traverse = module.exports = function (schema, opts, cb) {\n // Legacy support for v0.3.1 and earlier.\n if (typeof opts == 'function') {\n cb = opts;\n opts = {};\n }\n\n cb = opts.cb || cb;\n var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};\n var post = cb.post || function() {};\n\n _traverse(opts, pre, post, schema, '', schema);\n};\n\n\ntraverse.keywords = {\n additionalItems: true,\n items: true,\n contains: true,\n additionalProperties: true,\n propertyNames: true,\n not: true,\n if: true,\n then: true,\n else: true\n};\n\ntraverse.arrayKeywords = {\n items: true,\n allOf: true,\n anyOf: true,\n oneOf: true\n};\n\ntraverse.propsKeywords = {\n $defs: true,\n definitions: true,\n properties: true,\n patternProperties: true,\n dependencies: true\n};\n\ntraverse.skipKeywords = {\n default: true,\n enum: true,\n const: true,\n required: true,\n maximum: true,\n minimum: true,\n exclusiveMaximum: true,\n exclusiveMinimum: true,\n multipleOf: true,\n maxLength: true,\n minLength: true,\n pattern: true,\n format: true,\n maxItems: true,\n minItems: true,\n uniqueItems: true,\n maxProperties: true,\n minProperties: true\n};\n\n\nfunction _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {\n if (schema && typeof schema == 'object' && !Array.isArray(schema)) {\n pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n for (var key in schema) {\n var sch = schema[key];\n if (Array.isArray(sch)) {\n if (key in traverse.arrayKeywords) {\n for (var i=0; i<sch.length; i++)\n _traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);\n }\n } else if (key in traverse.propsKeywords) {\n if (sch && typeof sch == 'object') {\n for (var prop in sch)\n _traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);\n }\n } else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {\n _traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);\n }\n }\n post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n }\n}\n\n\nfunction escapeJsonPtr(str) {\n return str.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;CAEA,IAAI,WAAW,OAAO,UAAU,SAAU,QAAQ,MAAM,IAAI;EAE1D,IAAI,OAAO,QAAQ,YAAY;GAC7B,KAAK;GACL,OAAO,CAAC;EACV;EAEA,KAAK,KAAK,MAAM;EAChB,IAAI,MAAO,OAAO,MAAM,aAAc,KAAK,GAAG,OAAO,WAAW,CAAC;EACjE,IAAI,OAAO,GAAG,QAAQ,WAAW,CAAC;EAElC,UAAU,MAAM,KAAK,MAAM,QAAQ,IAAI,MAAM;CAC/C;CAGA,SAAS,WAAW;EAClB,iBAAiB;EACjB,OAAO;EACP,UAAU;EACV,sBAAsB;EACtB,eAAe;EACf,KAAK;EACL,IAAI;EACJ,MAAM;EACN,MAAM;CACR;CAEA,SAAS,gBAAgB;EACvB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AQ;EACxF;CACF;CAGA,SAAS,cAAc,KAAK;EAC1B,OAAO,IAAI,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,OAAO,IAAI;CACpD"}
|
package/dist/json-to-zod.cjs
CHANGED
|
@@ -201,32 +201,34 @@ const parseNumber = (schema) => {
|
|
|
201
201
|
")"
|
|
202
202
|
];
|
|
203
203
|
});
|
|
204
|
-
if (typeof schema.minimum === "number")
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
if (typeof schema.minimum === "number") {
|
|
205
|
+
if (schema.exclusiveMinimum === true) r += withMessage(schema, "minimum", ({ json }) => [
|
|
206
|
+
`.gt(${json}`,
|
|
207
|
+
", ",
|
|
208
|
+
")"
|
|
209
|
+
]);
|
|
210
|
+
else r += withMessage(schema, "minimum", ({ json }) => [
|
|
211
|
+
`.gte(${json}`,
|
|
212
|
+
", ",
|
|
213
|
+
")"
|
|
214
|
+
]);
|
|
215
|
+
} else if (typeof schema.exclusiveMinimum === "number") r += withMessage(schema, "exclusiveMinimum", ({ json }) => [
|
|
215
216
|
`.gt(${json}`,
|
|
216
217
|
", ",
|
|
217
218
|
")"
|
|
218
219
|
]);
|
|
219
|
-
if (typeof schema.maximum === "number")
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
220
|
+
if (typeof schema.maximum === "number") {
|
|
221
|
+
if (schema.exclusiveMaximum === true) r += withMessage(schema, "maximum", ({ json }) => [
|
|
222
|
+
`.lt(${json}`,
|
|
223
|
+
", ",
|
|
224
|
+
")"
|
|
225
|
+
]);
|
|
226
|
+
else r += withMessage(schema, "maximum", ({ json }) => [
|
|
227
|
+
`.lte(${json}`,
|
|
228
|
+
", ",
|
|
229
|
+
")"
|
|
230
|
+
]);
|
|
231
|
+
} else if (typeof schema.exclusiveMaximum === "number") r += withMessage(schema, "exclusiveMaximum", ({ json }) => [
|
|
230
232
|
`.lt(${json}`,
|
|
231
233
|
", ",
|
|
232
234
|
")"
|
|
@@ -285,25 +287,27 @@ const addJsdocs = (schema, parsed) => {
|
|
|
285
287
|
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/json-schema-to-zod/2.7.0/a13e04d716ba0ad807c80424b9ecc2fa744903d957ce250899a6422d8d845e4a/node_modules/json-schema-to-zod/dist/esm/parsers/parseObject.js
|
|
286
288
|
function parseObject(objectSchema, refs) {
|
|
287
289
|
let properties = void 0;
|
|
288
|
-
if (objectSchema.properties)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
290
|
+
if (objectSchema.properties) {
|
|
291
|
+
if (!Object.keys(objectSchema.properties).length) properties = "z.object({})";
|
|
292
|
+
else {
|
|
293
|
+
properties = "z.object({ ";
|
|
294
|
+
properties += Object.keys(objectSchema.properties).map((key) => {
|
|
295
|
+
const propSchema = objectSchema.properties[key];
|
|
296
|
+
let result = `${JSON.stringify(key)}: ${parseSchema(propSchema, {
|
|
297
|
+
...refs,
|
|
298
|
+
path: [
|
|
299
|
+
...refs.path,
|
|
300
|
+
"properties",
|
|
301
|
+
key
|
|
302
|
+
]
|
|
303
|
+
})}`;
|
|
304
|
+
if (refs.withJsdocs && typeof propSchema === "object") result = addJsdocs(propSchema, result);
|
|
305
|
+
const hasDefault = typeof propSchema === "object" && propSchema.default !== void 0;
|
|
306
|
+
const required = Array.isArray(objectSchema.required) ? objectSchema.required.includes(key) : typeof propSchema === "object" && propSchema.required === true;
|
|
307
|
+
return !hasDefault && !required ? `${result}.optional()` : result;
|
|
308
|
+
}).join(", ");
|
|
309
|
+
properties += " })";
|
|
310
|
+
}
|
|
307
311
|
}
|
|
308
312
|
const additionalProperties = objectSchema.additionalProperties !== void 0 ? parseSchema(objectSchema.additionalProperties, {
|
|
309
313
|
...refs,
|
|
@@ -322,16 +326,19 @@ function parseObject(objectSchema, refs) {
|
|
|
322
326
|
})];
|
|
323
327
|
}, {}));
|
|
324
328
|
patternProperties = "";
|
|
325
|
-
if (properties)
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
+
if (properties) {
|
|
330
|
+
if (additionalProperties) patternProperties += `.catchall(z.union([${[...Object.values(parsedPatternProperties), additionalProperties].join(", ")}]))`;
|
|
331
|
+
else if (Object.keys(parsedPatternProperties).length > 1) patternProperties += `.catchall(z.union([${Object.values(parsedPatternProperties).join(", ")}]))`;
|
|
332
|
+
else patternProperties += `.catchall(${Object.values(parsedPatternProperties)})`;
|
|
333
|
+
} else if (additionalProperties) patternProperties += `z.record(z.union([${[...Object.values(parsedPatternProperties), additionalProperties].join(", ")}]))`;
|
|
329
334
|
else if (Object.keys(parsedPatternProperties).length > 1) patternProperties += `z.record(z.union([${Object.values(parsedPatternProperties).join(", ")}]))`;
|
|
330
335
|
else patternProperties += `z.record(${Object.values(parsedPatternProperties)})`;
|
|
331
336
|
patternProperties += ".superRefine((value, ctx) => {\n";
|
|
332
337
|
patternProperties += "for (const key in value) {\n";
|
|
333
|
-
if (additionalProperties)
|
|
334
|
-
|
|
338
|
+
if (additionalProperties) {
|
|
339
|
+
if (objectSchema.properties) patternProperties += `let evaluated = [${Object.keys(objectSchema.properties).map((key) => JSON.stringify(key)).join(", ")}].includes(key)\n`;
|
|
340
|
+
else patternProperties += `let evaluated = false\n`;
|
|
341
|
+
}
|
|
335
342
|
for (const key in objectSchema.patternProperties) {
|
|
336
343
|
patternProperties += "if (key.match(new RegExp(" + JSON.stringify(key) + "))) {\n";
|
|
337
344
|
if (additionalProperties) patternProperties += "evaluated = true\n";
|
|
@@ -620,25 +627,27 @@ var esm_default = jsonSchemaToZod$1;
|
|
|
620
627
|
//#region src/json-to-zod.ts
|
|
621
628
|
function parseObject$1(objectSchema, refs) {
|
|
622
629
|
let properties = void 0;
|
|
623
|
-
if (objectSchema.properties)
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
630
|
+
if (objectSchema.properties) {
|
|
631
|
+
if (!Object.keys(objectSchema.properties).length) properties = "z.object({})";
|
|
632
|
+
else {
|
|
633
|
+
properties = "z.object({ ";
|
|
634
|
+
properties += Object.keys(objectSchema.properties).map((key) => {
|
|
635
|
+
const propSchema = objectSchema.properties[key];
|
|
636
|
+
let result = `${JSON.stringify(key)}: ${parseSchema(propSchema, {
|
|
637
|
+
...refs,
|
|
638
|
+
path: [
|
|
639
|
+
...refs.path,
|
|
640
|
+
"properties",
|
|
641
|
+
key
|
|
642
|
+
]
|
|
643
|
+
})}`;
|
|
644
|
+
if (refs.withJsdocs && typeof propSchema === "object") result = addJsdocs(propSchema, result);
|
|
645
|
+
const hasDefault = typeof propSchema === "object" && propSchema.default !== void 0;
|
|
646
|
+
const required = Array.isArray(objectSchema.required) ? objectSchema.required.includes(key) : typeof propSchema === "object" && propSchema.required === true;
|
|
647
|
+
return !hasDefault && !required ? `${result}.optional()` : result;
|
|
648
|
+
}).join(", ");
|
|
649
|
+
properties += " })";
|
|
650
|
+
}
|
|
642
651
|
}
|
|
643
652
|
const additionalProperties = objectSchema.additionalProperties !== void 0 && objectSchema.additionalProperties !== false ? parseSchema(objectSchema.additionalProperties, {
|
|
644
653
|
...refs,
|
|
@@ -657,16 +666,19 @@ function parseObject$1(objectSchema, refs) {
|
|
|
657
666
|
})];
|
|
658
667
|
}, {}));
|
|
659
668
|
patternProperties = "";
|
|
660
|
-
if (properties)
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
669
|
+
if (properties) {
|
|
670
|
+
if (additionalProperties) patternProperties += `.catchall(z.union([${[...Object.values(parsedPatternProperties), additionalProperties].join(", ")}]))`;
|
|
671
|
+
else if (Object.keys(parsedPatternProperties).length > 1) patternProperties += `.catchall(z.union([${Object.values(parsedPatternProperties).join(", ")}]))`;
|
|
672
|
+
else patternProperties += `.catchall(${Object.values(parsedPatternProperties)})`;
|
|
673
|
+
} else if (additionalProperties) patternProperties += `z.record(z.string(), z.union([${[...Object.values(parsedPatternProperties), additionalProperties].join(", ")}]))`;
|
|
664
674
|
else if (Object.keys(parsedPatternProperties).length > 1) patternProperties += `z.record(z.string(), z.union([${Object.values(parsedPatternProperties).join(", ")}]))`;
|
|
665
675
|
else patternProperties += `z.record(z.string(), ${Object.values(parsedPatternProperties)})`;
|
|
666
676
|
patternProperties += ".superRefine((value, ctx) => {\n";
|
|
667
677
|
patternProperties += "for (const key in value) {\n";
|
|
668
|
-
if (additionalProperties)
|
|
669
|
-
|
|
678
|
+
if (additionalProperties) {
|
|
679
|
+
if (objectSchema.properties) patternProperties += `let evaluated = [${Object.keys(objectSchema.properties).map((key) => JSON.stringify(key)).join(", ")}].includes(key)\n`;
|
|
680
|
+
else patternProperties += `let evaluated = false\n`;
|
|
681
|
+
}
|
|
670
682
|
for (const key in objectSchema.patternProperties) {
|
|
671
683
|
patternProperties += "if (key.match(new RegExp(" + JSON.stringify(key) + "))) {\n";
|
|
672
684
|
if (additionalProperties) patternProperties += "evaluated = true\n";
|