@mastra/server 0.14.0-alpha.5 → 0.14.0-alpha.6
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/{chunk-Z2HSKJPF.js → chunk-ICCXVZ6L.js} +3 -3
- package/dist/{chunk-Z2HSKJPF.js.map → chunk-ICCXVZ6L.js.map} +1 -1
- package/dist/{chunk-MARALOVU.cjs → chunk-IPYICGKH.cjs} +7 -7
- package/dist/{chunk-MARALOVU.cjs.map → chunk-IPYICGKH.cjs.map} +1 -1
- package/dist/{chunk-ID4HDWQJ.js → chunk-JTI4PULF.js} +3 -3
- package/dist/{chunk-ID4HDWQJ.js.map → chunk-JTI4PULF.js.map} +1 -1
- package/dist/{chunk-LRUH33B4.cjs → chunk-LCODOYFR.cjs} +1804 -1804
- package/dist/chunk-LCODOYFR.cjs.map +1 -0
- package/dist/{chunk-HA6FNLRP.cjs → chunk-MEZ5K4AI.cjs} +19 -19
- package/dist/{chunk-HA6FNLRP.cjs.map → chunk-MEZ5K4AI.cjs.map} +1 -1
- package/dist/chunk-PREC2QAP.js +16972 -0
- package/dist/chunk-PREC2QAP.js.map +1 -0
- package/dist/{chunk-7FHF55WA.js → chunk-RGY4HZFK.js} +1804 -1804
- package/dist/chunk-RGY4HZFK.js.map +1 -0
- package/dist/{chunk-2M2NTLZE.js → chunk-SFBU4MIU.js} +3 -3
- package/dist/{chunk-2M2NTLZE.js.map → chunk-SFBU4MIU.js.map} +1 -1
- package/dist/{chunk-LHZNQ6RL.cjs → chunk-X7NUY6QT.cjs} +9 -9
- package/dist/{chunk-LHZNQ6RL.cjs.map → chunk-X7NUY6QT.cjs.map} +1 -1
- package/dist/chunk-ZROTEYUT.cjs +16989 -0
- package/dist/chunk-ZROTEYUT.cjs.map +1 -0
- package/dist/server/handlers/agents.cjs +12 -12
- package/dist/server/handlers/agents.d.ts +2 -2
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +11 -11
- package/dist/server/handlers/legacyWorkflows.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +5 -5
- package/dist/server/handlers/vNextNetwork.js +1 -1
- package/dist/server/handlers/workflows.cjs +16 -16
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +8 -8
- package/dist/server/handlers.js +4 -4
- package/package.json +7 -2
- package/dist/chunk-6LHEW5YZ.js +0 -7889
- package/dist/chunk-6LHEW5YZ.js.map +0 -1
- package/dist/chunk-7FHF55WA.js.map +0 -1
- package/dist/chunk-BQYMGHOD.cjs +0 -7902
- package/dist/chunk-BQYMGHOD.cjs.map +0 -1
- package/dist/chunk-LRUH33B4.cjs.map +0 -1
|
@@ -2,899 +2,866 @@
|
|
|
2
2
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
|
|
5
|
-
// ../../node_modules/.pnpm/
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
6
|
+
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
7
|
+
var defaultOptions = {
|
|
8
|
+
name: void 0,
|
|
9
|
+
$refStrategy: "root",
|
|
10
|
+
basePath: ["#"],
|
|
11
|
+
effectStrategy: "input",
|
|
12
|
+
pipeStrategy: "all",
|
|
13
|
+
dateStrategy: "format:date-time",
|
|
14
|
+
mapStrategy: "entries",
|
|
15
|
+
removeAdditionalStrategy: "passthrough",
|
|
16
|
+
allowedAdditionalProperties: true,
|
|
17
|
+
rejectedAdditionalProperties: false,
|
|
18
|
+
definitionPath: "definitions",
|
|
19
|
+
target: "jsonSchema7",
|
|
20
|
+
strictUnions: false,
|
|
21
|
+
definitions: {},
|
|
22
|
+
errorMessages: false,
|
|
23
|
+
markdownDescription: false,
|
|
24
|
+
patternStrategy: "escape",
|
|
25
|
+
applyRegexFlags: false,
|
|
26
|
+
emailStrategy: "format:email",
|
|
27
|
+
base64Strategy: "contentEncoding:base64",
|
|
28
|
+
nameStrategy: "ref",
|
|
29
|
+
openAiAnyTypeName: "OpenAiAnyType"
|
|
30
|
+
};
|
|
31
|
+
var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
32
|
+
...defaultOptions,
|
|
33
|
+
name: options
|
|
34
|
+
} : {
|
|
35
|
+
...defaultOptions,
|
|
36
|
+
...options
|
|
25
37
|
};
|
|
26
38
|
|
|
27
|
-
// ../../node_modules/.pnpm/
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
40
|
+
var getRefs = (options) => {
|
|
41
|
+
const _options = getDefaultOptions(options);
|
|
42
|
+
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
43
|
+
return {
|
|
44
|
+
..._options,
|
|
45
|
+
flags: { hasReferencedOpenAiAnyType: false },
|
|
46
|
+
currentPath,
|
|
47
|
+
propertyPath: void 0,
|
|
48
|
+
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
49
|
+
def._def,
|
|
50
|
+
{
|
|
51
|
+
def: def._def,
|
|
52
|
+
path: [..._options.basePath, _options.definitionPath, name],
|
|
53
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
54
|
+
jsonSchema: void 0
|
|
55
|
+
}
|
|
56
|
+
]))
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
61
|
+
function addErrorMessage(res, key, errorMessage, refs) {
|
|
62
|
+
if (!refs?.errorMessages)
|
|
63
|
+
return;
|
|
64
|
+
if (errorMessage) {
|
|
65
|
+
res.errorMessage = {
|
|
66
|
+
...res.errorMessage,
|
|
67
|
+
[key]: errorMessage
|
|
68
|
+
};
|
|
47
69
|
}
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
}
|
|
71
|
+
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
72
|
+
res[key] = value;
|
|
73
|
+
addErrorMessage(res, key, errorMessage, refs);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
77
|
+
var getRelativePath = (pathA, pathB) => {
|
|
78
|
+
let i = 0;
|
|
79
|
+
for (; i < pathA.length && i < pathB.length; i++) {
|
|
80
|
+
if (pathA[i] !== pathB[i])
|
|
81
|
+
break;
|
|
50
82
|
}
|
|
83
|
+
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
51
84
|
};
|
|
52
85
|
|
|
53
|
-
// ../../node_modules/.pnpm/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
86
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
87
|
+
function parseAnyDef(refs) {
|
|
88
|
+
if (refs.target !== "openAi") {
|
|
89
|
+
return {};
|
|
58
90
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
const anyDefinitionPath = [
|
|
92
|
+
...refs.basePath,
|
|
93
|
+
refs.definitionPath,
|
|
94
|
+
refs.openAiAnyTypeName
|
|
95
|
+
];
|
|
96
|
+
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
97
|
+
return {
|
|
98
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function parseArrayDef(def, refs) {
|
|
102
|
+
const res = {
|
|
103
|
+
type: "array"
|
|
104
|
+
};
|
|
105
|
+
if (def.type?._def && def.type?._def?.typeName !== zod.ZodFirstPartyTypeKind.ZodAny) {
|
|
106
|
+
res.items = parseDef(def.type._def, {
|
|
107
|
+
...refs,
|
|
108
|
+
currentPath: [...refs.currentPath, "items"]
|
|
109
|
+
});
|
|
68
110
|
}
|
|
69
|
-
|
|
70
|
-
|
|
111
|
+
if (def.minLength) {
|
|
112
|
+
setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
71
113
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
|
|
75
|
-
function valuesOfObj(record) {
|
|
76
|
-
if ("values" in Object) {
|
|
77
|
-
return Object.values(record);
|
|
114
|
+
if (def.maxLength) {
|
|
115
|
+
setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
78
116
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
values.push(record[key]);
|
|
83
|
-
}
|
|
117
|
+
if (def.exactLength) {
|
|
118
|
+
setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
119
|
+
setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
84
120
|
}
|
|
85
|
-
return
|
|
121
|
+
return res;
|
|
86
122
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
123
|
+
|
|
124
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
125
|
+
function parseBigintDef(def, refs) {
|
|
126
|
+
const res = {
|
|
127
|
+
type: "integer",
|
|
128
|
+
format: "int64"
|
|
129
|
+
};
|
|
130
|
+
if (!def.checks)
|
|
131
|
+
return res;
|
|
132
|
+
for (const check of def.checks) {
|
|
133
|
+
switch (check.kind) {
|
|
134
|
+
case "min":
|
|
135
|
+
if (refs.target === "jsonSchema7") {
|
|
136
|
+
if (check.inclusive) {
|
|
137
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
138
|
+
} else {
|
|
139
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
if (!check.inclusive) {
|
|
143
|
+
res.exclusiveMinimum = true;
|
|
144
|
+
}
|
|
145
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case "max":
|
|
149
|
+
if (refs.target === "jsonSchema7") {
|
|
150
|
+
if (check.inclusive) {
|
|
151
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
152
|
+
} else {
|
|
153
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
if (!check.inclusive) {
|
|
157
|
+
res.exclusiveMaximum = true;
|
|
158
|
+
}
|
|
159
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case "multipleOf":
|
|
163
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
164
|
+
break;
|
|
97
165
|
}
|
|
98
166
|
}
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
function forEach(record, run) {
|
|
102
|
-
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
167
|
+
return res;
|
|
103
168
|
}
|
|
104
|
-
|
|
105
|
-
|
|
169
|
+
|
|
170
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
171
|
+
function parseBooleanDef() {
|
|
172
|
+
return {
|
|
173
|
+
type: "boolean"
|
|
174
|
+
};
|
|
106
175
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return value;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return void 0;
|
|
176
|
+
|
|
177
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
178
|
+
function parseBrandedDef(_def, refs) {
|
|
179
|
+
return parseDef(_def.type._def, refs);
|
|
115
180
|
}
|
|
116
181
|
|
|
117
|
-
// ../../node_modules/.pnpm/
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
182
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
183
|
+
var parseCatchDef = (def, refs) => {
|
|
184
|
+
return parseDef(def.innerType._def, refs);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
188
|
+
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
189
|
+
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
190
|
+
if (Array.isArray(strategy)) {
|
|
191
|
+
return {
|
|
192
|
+
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
|
|
193
|
+
};
|
|
121
194
|
}
|
|
122
|
-
|
|
123
|
-
|
|
195
|
+
switch (strategy) {
|
|
196
|
+
case "string":
|
|
197
|
+
case "format:date-time":
|
|
198
|
+
return {
|
|
199
|
+
type: "string",
|
|
200
|
+
format: "date-time"
|
|
201
|
+
};
|
|
202
|
+
case "format:date":
|
|
203
|
+
return {
|
|
204
|
+
type: "string",
|
|
205
|
+
format: "date"
|
|
206
|
+
};
|
|
207
|
+
case "integer":
|
|
208
|
+
return integerDateParser(def, refs);
|
|
124
209
|
}
|
|
125
|
-
|
|
126
|
-
|
|
210
|
+
}
|
|
211
|
+
var integerDateParser = (def, refs) => {
|
|
212
|
+
const res = {
|
|
213
|
+
type: "integer",
|
|
214
|
+
format: "unix-time"
|
|
215
|
+
};
|
|
216
|
+
if (refs.target === "openApi3") {
|
|
217
|
+
return res;
|
|
127
218
|
}
|
|
128
|
-
|
|
129
|
-
|
|
219
|
+
for (const check of def.checks) {
|
|
220
|
+
switch (check.kind) {
|
|
221
|
+
case "min":
|
|
222
|
+
setResponseValueAndErrors(
|
|
223
|
+
res,
|
|
224
|
+
"minimum",
|
|
225
|
+
check.value,
|
|
226
|
+
// This is in milliseconds
|
|
227
|
+
check.message,
|
|
228
|
+
refs
|
|
229
|
+
);
|
|
230
|
+
break;
|
|
231
|
+
case "max":
|
|
232
|
+
setResponseValueAndErrors(
|
|
233
|
+
res,
|
|
234
|
+
"maximum",
|
|
235
|
+
check.value,
|
|
236
|
+
// This is in milliseconds
|
|
237
|
+
check.message,
|
|
238
|
+
refs
|
|
239
|
+
);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
130
242
|
}
|
|
243
|
+
return res;
|
|
131
244
|
};
|
|
132
245
|
|
|
133
|
-
// ../../node_modules/.pnpm/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (payload === Object.prototype)
|
|
141
|
-
return false;
|
|
142
|
-
if (Object.getPrototypeOf(payload) === null)
|
|
143
|
-
return true;
|
|
144
|
-
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
145
|
-
};
|
|
146
|
-
var isEmptyObject = (payload) => isPlainObject(payload) && Object.keys(payload).length === 0;
|
|
147
|
-
var isArray = (payload) => Array.isArray(payload);
|
|
148
|
-
var isString = (payload) => typeof payload === "string";
|
|
149
|
-
var isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
|
|
150
|
-
var isBoolean = (payload) => typeof payload === "boolean";
|
|
151
|
-
var isRegExp = (payload) => payload instanceof RegExp;
|
|
152
|
-
var isMap = (payload) => payload instanceof Map;
|
|
153
|
-
var isSet = (payload) => payload instanceof Set;
|
|
154
|
-
var isSymbol = (payload) => getType(payload) === "Symbol";
|
|
155
|
-
var isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
|
|
156
|
-
var isError = (payload) => payload instanceof Error;
|
|
157
|
-
var isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
|
|
158
|
-
var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
|
|
159
|
-
var isBigint = (payload) => typeof payload === "bigint";
|
|
160
|
-
var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
|
|
161
|
-
var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
|
|
162
|
-
var isURL = (payload) => payload instanceof URL;
|
|
246
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
247
|
+
function parseDefaultDef(_def, refs) {
|
|
248
|
+
return {
|
|
249
|
+
...parseDef(_def.innerType._def, refs),
|
|
250
|
+
default: _def.defaultValue()
|
|
251
|
+
};
|
|
252
|
+
}
|
|
163
253
|
|
|
164
|
-
// ../../node_modules/.pnpm/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const result = [];
|
|
169
|
-
let segment = "";
|
|
170
|
-
for (let i = 0; i < string.length; i++) {
|
|
171
|
-
let char = string.charAt(i);
|
|
172
|
-
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
173
|
-
if (isEscapedDot) {
|
|
174
|
-
segment += ".";
|
|
175
|
-
i++;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
const isEndOfSegment = char === ".";
|
|
179
|
-
if (isEndOfSegment) {
|
|
180
|
-
result.push(segment);
|
|
181
|
-
segment = "";
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
segment += char;
|
|
185
|
-
}
|
|
186
|
-
const lastSegment = segment;
|
|
187
|
-
result.push(lastSegment);
|
|
188
|
-
return result;
|
|
189
|
-
};
|
|
254
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
255
|
+
function parseEffectsDef(_def, refs) {
|
|
256
|
+
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
257
|
+
}
|
|
190
258
|
|
|
191
|
-
// ../../node_modules/.pnpm/
|
|
192
|
-
function
|
|
259
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
260
|
+
function parseEnumDef(def) {
|
|
193
261
|
return {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
transform,
|
|
197
|
-
untransform
|
|
262
|
+
type: "string",
|
|
263
|
+
enum: Array.from(def.values)
|
|
198
264
|
};
|
|
199
265
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return e;
|
|
227
|
-
}),
|
|
228
|
-
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
229
|
-
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
230
|
-
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
231
|
-
return new RegExp(body, flags);
|
|
232
|
-
}),
|
|
233
|
-
simpleTransformation(
|
|
234
|
-
isSet,
|
|
235
|
-
"set",
|
|
236
|
-
// (sets only exist in es6+)
|
|
237
|
-
// eslint-disable-next-line es5/no-es6-methods
|
|
238
|
-
(v) => [...v.values()],
|
|
239
|
-
(v) => new Set(v)
|
|
240
|
-
),
|
|
241
|
-
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
242
|
-
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
243
|
-
if (isNaNValue(v)) {
|
|
244
|
-
return "NaN";
|
|
245
|
-
}
|
|
246
|
-
if (v > 0) {
|
|
247
|
-
return "Infinity";
|
|
266
|
+
|
|
267
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
268
|
+
var isJsonSchema7AllOfType = (type) => {
|
|
269
|
+
if ("type" in type && type.type === "string")
|
|
270
|
+
return false;
|
|
271
|
+
return "allOf" in type;
|
|
272
|
+
};
|
|
273
|
+
function parseIntersectionDef(def, refs) {
|
|
274
|
+
const allOf = [
|
|
275
|
+
parseDef(def.left._def, {
|
|
276
|
+
...refs,
|
|
277
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
278
|
+
}),
|
|
279
|
+
parseDef(def.right._def, {
|
|
280
|
+
...refs,
|
|
281
|
+
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
282
|
+
})
|
|
283
|
+
].filter((x) => !!x);
|
|
284
|
+
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
285
|
+
const mergedAllOf = [];
|
|
286
|
+
allOf.forEach((schema) => {
|
|
287
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
288
|
+
mergedAllOf.push(...schema.allOf);
|
|
289
|
+
if (schema.unevaluatedProperties === void 0) {
|
|
290
|
+
unevaluatedProperties = void 0;
|
|
291
|
+
}
|
|
248
292
|
} else {
|
|
249
|
-
|
|
293
|
+
let nestedSchema = schema;
|
|
294
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
295
|
+
const { additionalProperties, ...rest } = schema;
|
|
296
|
+
nestedSchema = rest;
|
|
297
|
+
} else {
|
|
298
|
+
unevaluatedProperties = void 0;
|
|
299
|
+
}
|
|
300
|
+
mergedAllOf.push(nestedSchema);
|
|
250
301
|
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
];
|
|
257
|
-
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
258
|
-
return {
|
|
259
|
-
isApplicable,
|
|
260
|
-
annotation,
|
|
261
|
-
transform,
|
|
262
|
-
untransform
|
|
263
|
-
};
|
|
302
|
+
});
|
|
303
|
+
return mergedAllOf.length ? {
|
|
304
|
+
allOf: mergedAllOf,
|
|
305
|
+
...unevaluatedProperties
|
|
306
|
+
} : void 0;
|
|
264
307
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
308
|
+
|
|
309
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
310
|
+
function parseLiteralDef(def, refs) {
|
|
311
|
+
const parsedType = typeof def.value;
|
|
312
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
313
|
+
return {
|
|
314
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
315
|
+
};
|
|
269
316
|
}
|
|
270
|
-
|
|
271
|
-
}, (s, superJson) => {
|
|
272
|
-
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
273
|
-
return ["symbol", identifier];
|
|
274
|
-
}, (v) => v.description, (_, a, superJson) => {
|
|
275
|
-
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
276
|
-
if (!value) {
|
|
277
|
-
throw new Error("Trying to deserialize unknown symbol");
|
|
278
|
-
}
|
|
279
|
-
return value;
|
|
280
|
-
});
|
|
281
|
-
var constructorToName = [
|
|
282
|
-
Int8Array,
|
|
283
|
-
Uint8Array,
|
|
284
|
-
Int16Array,
|
|
285
|
-
Uint16Array,
|
|
286
|
-
Int32Array,
|
|
287
|
-
Uint32Array,
|
|
288
|
-
Float32Array,
|
|
289
|
-
Float64Array,
|
|
290
|
-
Uint8ClampedArray
|
|
291
|
-
].reduce((obj, ctor) => {
|
|
292
|
-
obj[ctor.name] = ctor;
|
|
293
|
-
return obj;
|
|
294
|
-
}, {});
|
|
295
|
-
var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
296
|
-
const ctor = constructorToName[a[1]];
|
|
297
|
-
if (!ctor) {
|
|
298
|
-
throw new Error("Trying to deserialize unknown typed array");
|
|
299
|
-
}
|
|
300
|
-
return new ctor(v);
|
|
301
|
-
});
|
|
302
|
-
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
303
|
-
if (potentialClass?.constructor) {
|
|
304
|
-
const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
305
|
-
return isRegistered;
|
|
306
|
-
}
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
310
|
-
const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
|
|
311
|
-
return ["class", identifier];
|
|
312
|
-
}, (clazz, superJson) => {
|
|
313
|
-
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
314
|
-
if (!allowedProps) {
|
|
315
|
-
return { ...clazz };
|
|
316
|
-
}
|
|
317
|
-
const result = {};
|
|
318
|
-
allowedProps.forEach((prop) => {
|
|
319
|
-
result[prop] = clazz[prop];
|
|
320
|
-
});
|
|
321
|
-
return result;
|
|
322
|
-
}, (v, a, superJson) => {
|
|
323
|
-
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
324
|
-
if (!clazz) {
|
|
325
|
-
throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
326
|
-
}
|
|
327
|
-
return Object.assign(Object.create(clazz.prototype), v);
|
|
328
|
-
});
|
|
329
|
-
var customRule = compositeTransformation((value, superJson) => {
|
|
330
|
-
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
331
|
-
}, (value, superJson) => {
|
|
332
|
-
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
333
|
-
return ["custom", transformer.name];
|
|
334
|
-
}, (value, superJson) => {
|
|
335
|
-
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
336
|
-
return transformer.serialize(value);
|
|
337
|
-
}, (v, a, superJson) => {
|
|
338
|
-
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
339
|
-
if (!transformer) {
|
|
340
|
-
throw new Error("Trying to deserialize unknown custom value");
|
|
341
|
-
}
|
|
342
|
-
return transformer.deserialize(v);
|
|
343
|
-
});
|
|
344
|
-
var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
|
|
345
|
-
var transformValue = (value, superJson) => {
|
|
346
|
-
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
347
|
-
if (applicableCompositeRule) {
|
|
348
|
-
return {
|
|
349
|
-
value: applicableCompositeRule.transform(value, superJson),
|
|
350
|
-
type: applicableCompositeRule.annotation(value, superJson)
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
|
|
354
|
-
if (applicableSimpleRule) {
|
|
317
|
+
if (refs.target === "openApi3") {
|
|
355
318
|
return {
|
|
356
|
-
|
|
357
|
-
|
|
319
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
320
|
+
enum: [def.value]
|
|
358
321
|
};
|
|
359
322
|
}
|
|
360
|
-
return
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
});
|
|
366
|
-
var untransformValue = (json, type, superJson) => {
|
|
367
|
-
if (isArray(type)) {
|
|
368
|
-
switch (type[0]) {
|
|
369
|
-
case "symbol":
|
|
370
|
-
return symbolRule.untransform(json, type, superJson);
|
|
371
|
-
case "class":
|
|
372
|
-
return classRule.untransform(json, type, superJson);
|
|
373
|
-
case "custom":
|
|
374
|
-
return customRule.untransform(json, type, superJson);
|
|
375
|
-
case "typed-array":
|
|
376
|
-
return typedArrayRule.untransform(json, type, superJson);
|
|
377
|
-
default:
|
|
378
|
-
throw new Error("Unknown transformation: " + type);
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
const transformation = simpleRulesByAnnotation[type];
|
|
382
|
-
if (!transformation) {
|
|
383
|
-
throw new Error("Unknown transformation: " + type);
|
|
384
|
-
}
|
|
385
|
-
return transformation.untransform(json, superJson);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
323
|
+
return {
|
|
324
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
325
|
+
const: def.value
|
|
326
|
+
};
|
|
327
|
+
}
|
|
388
328
|
|
|
389
|
-
// ../../node_modules/.pnpm/
|
|
390
|
-
var
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
329
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
330
|
+
var emojiRegex = void 0;
|
|
331
|
+
var zodPatterns = {
|
|
332
|
+
/**
|
|
333
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
334
|
+
*/
|
|
335
|
+
cuid: /^[cC][^\s-]{8,}$/,
|
|
336
|
+
cuid2: /^[0-9a-z]+$/,
|
|
337
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
338
|
+
/**
|
|
339
|
+
* `a-z` was added to replicate /i flag
|
|
340
|
+
*/
|
|
341
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
342
|
+
/**
|
|
343
|
+
* Constructed a valid Unicode RegExp
|
|
344
|
+
*
|
|
345
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
346
|
+
* in all envs (e.g. React Native).
|
|
347
|
+
*
|
|
348
|
+
* See:
|
|
349
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
350
|
+
* Fix in Zod:
|
|
351
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
352
|
+
*/
|
|
353
|
+
emoji: () => {
|
|
354
|
+
if (emojiRegex === void 0) {
|
|
355
|
+
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
356
|
+
}
|
|
357
|
+
return emojiRegex;
|
|
358
|
+
},
|
|
359
|
+
/**
|
|
360
|
+
* Unused
|
|
361
|
+
*/
|
|
362
|
+
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
363
|
+
/**
|
|
364
|
+
* Unused
|
|
365
|
+
*/
|
|
366
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
367
|
+
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
368
|
+
/**
|
|
369
|
+
* Unused
|
|
370
|
+
*/
|
|
371
|
+
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
372
|
+
ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
373
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
374
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
375
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
376
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
399
377
|
};
|
|
400
|
-
function
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
if (
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
378
|
+
function parseStringDef(def, refs) {
|
|
379
|
+
const res = {
|
|
380
|
+
type: "string"
|
|
381
|
+
};
|
|
382
|
+
if (def.checks) {
|
|
383
|
+
for (const check of def.checks) {
|
|
384
|
+
switch (check.kind) {
|
|
385
|
+
case "min":
|
|
386
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
387
|
+
break;
|
|
388
|
+
case "max":
|
|
389
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
390
|
+
break;
|
|
391
|
+
case "email":
|
|
392
|
+
switch (refs.emailStrategy) {
|
|
393
|
+
case "format:email":
|
|
394
|
+
addFormat(res, "email", check.message, refs);
|
|
395
|
+
break;
|
|
396
|
+
case "format:idn-email":
|
|
397
|
+
addFormat(res, "idn-email", check.message, refs);
|
|
398
|
+
break;
|
|
399
|
+
case "pattern:zod":
|
|
400
|
+
addPattern(res, zodPatterns.email, check.message, refs);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
break;
|
|
404
|
+
case "url":
|
|
405
|
+
addFormat(res, "uri", check.message, refs);
|
|
406
|
+
break;
|
|
407
|
+
case "uuid":
|
|
408
|
+
addFormat(res, "uuid", check.message, refs);
|
|
409
|
+
break;
|
|
410
|
+
case "regex":
|
|
411
|
+
addPattern(res, check.regex, check.message, refs);
|
|
412
|
+
break;
|
|
413
|
+
case "cuid":
|
|
414
|
+
addPattern(res, zodPatterns.cuid, check.message, refs);
|
|
415
|
+
break;
|
|
416
|
+
case "cuid2":
|
|
417
|
+
addPattern(res, zodPatterns.cuid2, check.message, refs);
|
|
418
|
+
break;
|
|
419
|
+
case "startsWith":
|
|
420
|
+
addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
|
|
421
|
+
break;
|
|
422
|
+
case "endsWith":
|
|
423
|
+
addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
|
|
424
|
+
break;
|
|
425
|
+
case "datetime":
|
|
426
|
+
addFormat(res, "date-time", check.message, refs);
|
|
427
|
+
break;
|
|
428
|
+
case "date":
|
|
429
|
+
addFormat(res, "date", check.message, refs);
|
|
430
|
+
break;
|
|
431
|
+
case "time":
|
|
432
|
+
addFormat(res, "time", check.message, refs);
|
|
433
|
+
break;
|
|
434
|
+
case "duration":
|
|
435
|
+
addFormat(res, "duration", check.message, refs);
|
|
436
|
+
break;
|
|
437
|
+
case "length":
|
|
438
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
439
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
440
|
+
break;
|
|
441
|
+
case "includes": {
|
|
442
|
+
addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
case "ip": {
|
|
446
|
+
if (check.version !== "v6") {
|
|
447
|
+
addFormat(res, "ipv4", check.message, refs);
|
|
448
|
+
}
|
|
449
|
+
if (check.version !== "v4") {
|
|
450
|
+
addFormat(res, "ipv6", check.message, refs);
|
|
451
|
+
}
|
|
424
452
|
break;
|
|
425
|
-
|
|
426
|
-
|
|
453
|
+
}
|
|
454
|
+
case "base64url":
|
|
455
|
+
addPattern(res, zodPatterns.base64url, check.message, refs);
|
|
427
456
|
break;
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
object = object[key];
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
return object;
|
|
434
|
-
};
|
|
435
|
-
var setDeep = (object, path, mapper) => {
|
|
436
|
-
validatePath(path);
|
|
437
|
-
if (path.length === 0) {
|
|
438
|
-
return mapper(object);
|
|
439
|
-
}
|
|
440
|
-
let parent = object;
|
|
441
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
442
|
-
const key = path[i];
|
|
443
|
-
if (isArray(parent)) {
|
|
444
|
-
const index = +key;
|
|
445
|
-
parent = parent[index];
|
|
446
|
-
} else if (isPlainObject(parent)) {
|
|
447
|
-
parent = parent[key];
|
|
448
|
-
} else if (isSet(parent)) {
|
|
449
|
-
const row = +key;
|
|
450
|
-
parent = getNthKey(parent, row);
|
|
451
|
-
} else if (isMap(parent)) {
|
|
452
|
-
const isEnd = i === path.length - 2;
|
|
453
|
-
if (isEnd) {
|
|
454
|
-
break;
|
|
455
|
-
}
|
|
456
|
-
const row = +key;
|
|
457
|
-
const type = +path[++i] === 0 ? "key" : "value";
|
|
458
|
-
const keyOfRow = getNthKey(parent, row);
|
|
459
|
-
switch (type) {
|
|
460
|
-
case "key":
|
|
461
|
-
parent = keyOfRow;
|
|
457
|
+
case "jwt":
|
|
458
|
+
addPattern(res, zodPatterns.jwt, check.message, refs);
|
|
462
459
|
break;
|
|
463
|
-
case "
|
|
464
|
-
|
|
460
|
+
case "cidr": {
|
|
461
|
+
if (check.version !== "v6") {
|
|
462
|
+
addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
463
|
+
}
|
|
464
|
+
if (check.version !== "v4") {
|
|
465
|
+
addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
466
|
+
}
|
|
465
467
|
break;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
const lastKey = path[path.length - 1];
|
|
470
|
-
if (isArray(parent)) {
|
|
471
|
-
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
472
|
-
} else if (isPlainObject(parent)) {
|
|
473
|
-
parent[lastKey] = mapper(parent[lastKey]);
|
|
474
|
-
}
|
|
475
|
-
if (isSet(parent)) {
|
|
476
|
-
const oldValue = getNthKey(parent, +lastKey);
|
|
477
|
-
const newValue = mapper(oldValue);
|
|
478
|
-
if (oldValue !== newValue) {
|
|
479
|
-
parent.delete(oldValue);
|
|
480
|
-
parent.add(newValue);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
if (isMap(parent)) {
|
|
484
|
-
const row = +path[path.length - 2];
|
|
485
|
-
const keyToRow = getNthKey(parent, row);
|
|
486
|
-
const type = +lastKey === 0 ? "key" : "value";
|
|
487
|
-
switch (type) {
|
|
488
|
-
case "key": {
|
|
489
|
-
const newKey = mapper(keyToRow);
|
|
490
|
-
parent.set(newKey, parent.get(keyToRow));
|
|
491
|
-
if (newKey !== keyToRow) {
|
|
492
|
-
parent.delete(keyToRow);
|
|
493
468
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
469
|
+
case "emoji":
|
|
470
|
+
addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
471
|
+
break;
|
|
472
|
+
case "ulid": {
|
|
473
|
+
addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
case "base64": {
|
|
477
|
+
switch (refs.base64Strategy) {
|
|
478
|
+
case "format:binary": {
|
|
479
|
+
addFormat(res, "binary", check.message, refs);
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
case "contentEncoding:base64": {
|
|
483
|
+
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
case "pattern:zod": {
|
|
487
|
+
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
case "nanoid": {
|
|
494
|
+
addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
495
|
+
}
|
|
499
496
|
}
|
|
500
497
|
}
|
|
501
498
|
}
|
|
502
|
-
return
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
|
|
506
|
-
function traverse(tree, walker2, origin = []) {
|
|
507
|
-
if (!tree) {
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
if (!isArray(tree)) {
|
|
511
|
-
forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
const [nodeValue, children] = tree;
|
|
515
|
-
if (children) {
|
|
516
|
-
forEach(children, (child, key) => {
|
|
517
|
-
traverse(child, walker2, [...origin, ...parsePath(key)]);
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
walker2(nodeValue, origin);
|
|
521
|
-
}
|
|
522
|
-
function applyValueAnnotations(plain, annotations, superJson) {
|
|
523
|
-
traverse(annotations, (type, path) => {
|
|
524
|
-
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
525
|
-
});
|
|
526
|
-
return plain;
|
|
527
|
-
}
|
|
528
|
-
function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
529
|
-
function apply(identicalPaths, path) {
|
|
530
|
-
const object = getDeep(plain, parsePath(path));
|
|
531
|
-
identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
|
|
532
|
-
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
if (isArray(annotations)) {
|
|
536
|
-
const [root, other] = annotations;
|
|
537
|
-
root.forEach((identicalPath) => {
|
|
538
|
-
plain = setDeep(plain, parsePath(identicalPath), () => plain);
|
|
539
|
-
});
|
|
540
|
-
if (other) {
|
|
541
|
-
forEach(other, apply);
|
|
542
|
-
}
|
|
543
|
-
} else {
|
|
544
|
-
forEach(annotations, apply);
|
|
545
|
-
}
|
|
546
|
-
return plain;
|
|
547
|
-
}
|
|
548
|
-
var isDeep = (object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
|
|
549
|
-
function addIdentity(object, path, identities) {
|
|
550
|
-
const existingSet = identities.get(object);
|
|
551
|
-
if (existingSet) {
|
|
552
|
-
existingSet.push(path);
|
|
553
|
-
} else {
|
|
554
|
-
identities.set(object, [path]);
|
|
555
|
-
}
|
|
499
|
+
return res;
|
|
556
500
|
}
|
|
557
|
-
function
|
|
558
|
-
|
|
559
|
-
let rootEqualityPaths = void 0;
|
|
560
|
-
identitites.forEach((paths) => {
|
|
561
|
-
if (paths.length <= 1) {
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
if (!dedupe) {
|
|
565
|
-
paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
566
|
-
}
|
|
567
|
-
const [representativePath, ...identicalPaths] = paths;
|
|
568
|
-
if (representativePath.length === 0) {
|
|
569
|
-
rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
570
|
-
} else {
|
|
571
|
-
result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
if (rootEqualityPaths) {
|
|
575
|
-
if (isEmptyObject(result)) {
|
|
576
|
-
return [rootEqualityPaths];
|
|
577
|
-
} else {
|
|
578
|
-
return [rootEqualityPaths, result];
|
|
579
|
-
}
|
|
580
|
-
} else {
|
|
581
|
-
return isEmptyObject(result) ? void 0 : result;
|
|
582
|
-
}
|
|
501
|
+
function escapeLiteralCheckValue(literal, refs) {
|
|
502
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
|
|
583
503
|
}
|
|
584
|
-
var
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
return dedupe ? {
|
|
591
|
-
transformedValue: null
|
|
592
|
-
} : seen;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
if (!isDeep(object, superJson)) {
|
|
596
|
-
const transformed2 = transformValue(object, superJson);
|
|
597
|
-
const result2 = transformed2 ? {
|
|
598
|
-
transformedValue: transformed2.value,
|
|
599
|
-
annotations: [transformed2.type]
|
|
600
|
-
} : {
|
|
601
|
-
transformedValue: object
|
|
602
|
-
};
|
|
603
|
-
if (!primitive) {
|
|
604
|
-
seenObjects.set(object, result2);
|
|
605
|
-
}
|
|
606
|
-
return result2;
|
|
607
|
-
}
|
|
608
|
-
if (includes(objectsInThisPath, object)) {
|
|
609
|
-
return {
|
|
610
|
-
transformedValue: null
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
const transformationResult = transformValue(object, superJson);
|
|
614
|
-
const transformed = transformationResult?.value ?? object;
|
|
615
|
-
const transformedValue = isArray(transformed) ? [] : {};
|
|
616
|
-
const innerAnnotations = {};
|
|
617
|
-
forEach(transformed, (value, index) => {
|
|
618
|
-
if (index === "__proto__" || index === "constructor" || index === "prototype") {
|
|
619
|
-
throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
|
|
620
|
-
}
|
|
621
|
-
const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
|
|
622
|
-
transformedValue[index] = recursiveResult.transformedValue;
|
|
623
|
-
if (isArray(recursiveResult.annotations)) {
|
|
624
|
-
innerAnnotations[index] = recursiveResult.annotations;
|
|
625
|
-
} else if (isPlainObject(recursiveResult.annotations)) {
|
|
626
|
-
forEach(recursiveResult.annotations, (tree, key) => {
|
|
627
|
-
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
628
|
-
});
|
|
504
|
+
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
505
|
+
function escapeNonAlphaNumeric(source) {
|
|
506
|
+
let result = "";
|
|
507
|
+
for (let i = 0; i < source.length; i++) {
|
|
508
|
+
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
509
|
+
result += "\\";
|
|
629
510
|
}
|
|
630
|
-
|
|
631
|
-
const result = isEmptyObject(innerAnnotations) ? {
|
|
632
|
-
transformedValue,
|
|
633
|
-
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
634
|
-
} : {
|
|
635
|
-
transformedValue,
|
|
636
|
-
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
637
|
-
};
|
|
638
|
-
if (!primitive) {
|
|
639
|
-
seenObjects.set(object, result);
|
|
511
|
+
result += source[i];
|
|
640
512
|
}
|
|
641
513
|
return result;
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
// ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
645
|
-
function getType2(payload) {
|
|
646
|
-
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
647
|
-
}
|
|
648
|
-
function isArray2(payload) {
|
|
649
|
-
return getType2(payload) === "Array";
|
|
650
514
|
}
|
|
651
|
-
function
|
|
652
|
-
if (
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
515
|
+
function addFormat(schema, value, message, refs) {
|
|
516
|
+
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
517
|
+
if (!schema.anyOf) {
|
|
518
|
+
schema.anyOf = [];
|
|
519
|
+
}
|
|
520
|
+
if (schema.format) {
|
|
521
|
+
schema.anyOf.push({
|
|
522
|
+
format: schema.format,
|
|
523
|
+
...schema.errorMessage && refs.errorMessages && {
|
|
524
|
+
errorMessage: { format: schema.errorMessage.format }
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
delete schema.format;
|
|
528
|
+
if (schema.errorMessage) {
|
|
529
|
+
delete schema.errorMessage.format;
|
|
530
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
531
|
+
delete schema.errorMessage;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
schema.anyOf.push({
|
|
536
|
+
format: value,
|
|
537
|
+
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
669
538
|
});
|
|
539
|
+
} else {
|
|
540
|
+
setResponseValueAndErrors(schema, "format", value, message, refs);
|
|
670
541
|
}
|
|
671
542
|
}
|
|
672
|
-
function
|
|
673
|
-
if (
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
if (!isPlainObject2(target)) {
|
|
677
|
-
return target;
|
|
678
|
-
}
|
|
679
|
-
const props = Object.getOwnPropertyNames(target);
|
|
680
|
-
const symbols = Object.getOwnPropertySymbols(target);
|
|
681
|
-
return [...props, ...symbols].reduce((carry, key) => {
|
|
682
|
-
if (isArray2(options.props) && !options.props.includes(key)) {
|
|
683
|
-
return carry;
|
|
543
|
+
function addPattern(schema, regex, message, refs) {
|
|
544
|
+
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
545
|
+
if (!schema.allOf) {
|
|
546
|
+
schema.allOf = [];
|
|
684
547
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
548
|
+
if (schema.pattern) {
|
|
549
|
+
schema.allOf.push({
|
|
550
|
+
pattern: schema.pattern,
|
|
551
|
+
...schema.errorMessage && refs.errorMessages && {
|
|
552
|
+
errorMessage: { pattern: schema.errorMessage.pattern }
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
delete schema.pattern;
|
|
556
|
+
if (schema.errorMessage) {
|
|
557
|
+
delete schema.errorMessage.pattern;
|
|
558
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
559
|
+
delete schema.errorMessage;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
schema.allOf.push({
|
|
564
|
+
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
565
|
+
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
566
|
+
});
|
|
567
|
+
} else {
|
|
568
|
+
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
569
|
+
}
|
|
690
570
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
696
|
-
*/
|
|
697
|
-
constructor({ dedupe = false } = {}) {
|
|
698
|
-
this.classRegistry = new ClassRegistry();
|
|
699
|
-
this.symbolRegistry = new Registry((s) => s.description ?? "");
|
|
700
|
-
this.customTransformerRegistry = new CustomTransformerRegistry();
|
|
701
|
-
this.allowedErrorProps = [];
|
|
702
|
-
this.dedupe = dedupe;
|
|
571
|
+
function stringifyRegExpWithFlags(regex, refs) {
|
|
572
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
573
|
+
return regex.source;
|
|
703
574
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
575
|
+
const flags = {
|
|
576
|
+
i: regex.flags.includes("i"),
|
|
577
|
+
m: regex.flags.includes("m"),
|
|
578
|
+
s: regex.flags.includes("s")
|
|
579
|
+
// `.` matches newlines
|
|
580
|
+
};
|
|
581
|
+
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
582
|
+
let pattern = "";
|
|
583
|
+
let isEscaped = false;
|
|
584
|
+
let inCharGroup = false;
|
|
585
|
+
let inCharRange = false;
|
|
586
|
+
for (let i = 0; i < source.length; i++) {
|
|
587
|
+
if (isEscaped) {
|
|
588
|
+
pattern += source[i];
|
|
589
|
+
isEscaped = false;
|
|
590
|
+
continue;
|
|
715
591
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
592
|
+
if (flags.i) {
|
|
593
|
+
if (inCharGroup) {
|
|
594
|
+
if (source[i].match(/[a-z]/)) {
|
|
595
|
+
if (inCharRange) {
|
|
596
|
+
pattern += source[i];
|
|
597
|
+
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
598
|
+
inCharRange = false;
|
|
599
|
+
} else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
|
600
|
+
pattern += source[i];
|
|
601
|
+
inCharRange = true;
|
|
602
|
+
} else {
|
|
603
|
+
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
604
|
+
}
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
608
|
+
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
722
611
|
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
612
|
+
if (flags.m) {
|
|
613
|
+
if (source[i] === "^") {
|
|
614
|
+
pattern += `(^|(?<=[\r
|
|
615
|
+
]))`;
|
|
616
|
+
continue;
|
|
617
|
+
} else if (source[i] === "$") {
|
|
618
|
+
pattern += `($|(?=[\r
|
|
619
|
+
]))`;
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
730
622
|
}
|
|
731
|
-
if (
|
|
732
|
-
|
|
623
|
+
if (flags.s && source[i] === ".") {
|
|
624
|
+
pattern += inCharGroup ? `${source[i]}\r
|
|
625
|
+
` : `[${source[i]}\r
|
|
626
|
+
]`;
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
pattern += source[i];
|
|
630
|
+
if (source[i] === "\\") {
|
|
631
|
+
isEscaped = true;
|
|
632
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
633
|
+
inCharGroup = false;
|
|
634
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
635
|
+
inCharGroup = true;
|
|
733
636
|
}
|
|
734
|
-
return result;
|
|
735
|
-
}
|
|
736
|
-
stringify(object) {
|
|
737
|
-
return JSON.stringify(this.serialize(object));
|
|
738
|
-
}
|
|
739
|
-
parse(string) {
|
|
740
|
-
return this.deserialize(JSON.parse(string));
|
|
741
637
|
}
|
|
742
|
-
|
|
743
|
-
|
|
638
|
+
return pattern;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
642
|
+
function parseRecordDef(def, refs) {
|
|
643
|
+
if (refs.target === "openAi") {
|
|
644
|
+
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
744
645
|
}
|
|
745
|
-
|
|
746
|
-
|
|
646
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
|
|
647
|
+
return {
|
|
648
|
+
type: "object",
|
|
649
|
+
required: def.keyType._def.values,
|
|
650
|
+
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
651
|
+
...acc,
|
|
652
|
+
[key]: parseDef(def.valueType._def, {
|
|
653
|
+
...refs,
|
|
654
|
+
currentPath: [...refs.currentPath, "properties", key]
|
|
655
|
+
}) ?? parseAnyDef(refs)
|
|
656
|
+
}), {}),
|
|
657
|
+
additionalProperties: refs.rejectedAdditionalProperties
|
|
658
|
+
};
|
|
747
659
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
...
|
|
752
|
-
|
|
660
|
+
const schema = {
|
|
661
|
+
type: "object",
|
|
662
|
+
additionalProperties: parseDef(def.valueType._def, {
|
|
663
|
+
...refs,
|
|
664
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
665
|
+
}) ?? refs.allowedAdditionalProperties
|
|
666
|
+
};
|
|
667
|
+
if (refs.target === "openApi3") {
|
|
668
|
+
return schema;
|
|
753
669
|
}
|
|
754
|
-
|
|
755
|
-
|
|
670
|
+
if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
671
|
+
const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
672
|
+
return {
|
|
673
|
+
...schema,
|
|
674
|
+
propertyNames: keyType
|
|
675
|
+
};
|
|
676
|
+
} else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
|
|
677
|
+
return {
|
|
678
|
+
...schema,
|
|
679
|
+
propertyNames: {
|
|
680
|
+
enum: def.keyType._def.values
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
} else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
684
|
+
const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
|
|
685
|
+
return {
|
|
686
|
+
...schema,
|
|
687
|
+
propertyNames: keyType
|
|
688
|
+
};
|
|
756
689
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
760
|
-
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
761
|
-
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
762
|
-
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
763
|
-
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
764
|
-
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
765
|
-
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
766
|
-
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
767
|
-
var stringify = SuperJSON.stringify;
|
|
690
|
+
return schema;
|
|
691
|
+
}
|
|
768
692
|
|
|
769
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
openAiAnyTypeName: "OpenAiAnyType"
|
|
794
|
-
};
|
|
795
|
-
var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
796
|
-
...defaultOptions,
|
|
797
|
-
name: options
|
|
798
|
-
} : {
|
|
799
|
-
...defaultOptions,
|
|
800
|
-
...options
|
|
801
|
-
};
|
|
693
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
694
|
+
function parseMapDef(def, refs) {
|
|
695
|
+
if (refs.mapStrategy === "record") {
|
|
696
|
+
return parseRecordDef(def, refs);
|
|
697
|
+
}
|
|
698
|
+
const keys = parseDef(def.keyType._def, {
|
|
699
|
+
...refs,
|
|
700
|
+
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
701
|
+
}) || parseAnyDef(refs);
|
|
702
|
+
const values = parseDef(def.valueType._def, {
|
|
703
|
+
...refs,
|
|
704
|
+
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
705
|
+
}) || parseAnyDef(refs);
|
|
706
|
+
return {
|
|
707
|
+
type: "array",
|
|
708
|
+
maxItems: 125,
|
|
709
|
+
items: {
|
|
710
|
+
type: "array",
|
|
711
|
+
items: [keys, values],
|
|
712
|
+
minItems: 2,
|
|
713
|
+
maxItems: 2
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
}
|
|
802
717
|
|
|
803
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
const
|
|
718
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
719
|
+
function parseNativeEnumDef(def) {
|
|
720
|
+
const object = def.values;
|
|
721
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
722
|
+
return typeof object[object[key]] !== "number";
|
|
723
|
+
});
|
|
724
|
+
const actualValues = actualKeys.map((key) => object[key]);
|
|
725
|
+
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
807
726
|
return {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
currentPath,
|
|
811
|
-
propertyPath: void 0,
|
|
812
|
-
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
813
|
-
def._def,
|
|
814
|
-
{
|
|
815
|
-
def: def._def,
|
|
816
|
-
path: [..._options.basePath, _options.definitionPath, name],
|
|
817
|
-
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
818
|
-
jsonSchema: void 0
|
|
819
|
-
}
|
|
820
|
-
]))
|
|
727
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
728
|
+
enum: actualValues
|
|
821
729
|
};
|
|
822
|
-
}
|
|
730
|
+
}
|
|
823
731
|
|
|
824
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/
|
|
825
|
-
function
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
};
|
|
833
|
-
}
|
|
732
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
733
|
+
function parseNeverDef(refs) {
|
|
734
|
+
return refs.target === "openAi" ? void 0 : {
|
|
735
|
+
not: parseAnyDef({
|
|
736
|
+
...refs,
|
|
737
|
+
currentPath: [...refs.currentPath, "not"]
|
|
738
|
+
})
|
|
739
|
+
};
|
|
834
740
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
741
|
+
|
|
742
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
743
|
+
function parseNullDef(refs) {
|
|
744
|
+
return refs.target === "openApi3" ? {
|
|
745
|
+
enum: ["null"],
|
|
746
|
+
nullable: true
|
|
747
|
+
} : {
|
|
748
|
+
type: "null"
|
|
749
|
+
};
|
|
838
750
|
}
|
|
839
751
|
|
|
840
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/
|
|
841
|
-
var
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
752
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
753
|
+
var primitiveMappings = {
|
|
754
|
+
ZodString: "string",
|
|
755
|
+
ZodNumber: "number",
|
|
756
|
+
ZodBigInt: "integer",
|
|
757
|
+
ZodBoolean: "boolean",
|
|
758
|
+
ZodNull: "null"
|
|
759
|
+
};
|
|
760
|
+
function parseUnionDef(def, refs) {
|
|
761
|
+
if (refs.target === "openApi3")
|
|
762
|
+
return asAnyOf(def, refs);
|
|
763
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
764
|
+
if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
|
|
765
|
+
const types = options.reduce((types2, x) => {
|
|
766
|
+
const type = primitiveMappings[x._def.typeName];
|
|
767
|
+
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
768
|
+
}, []);
|
|
769
|
+
return {
|
|
770
|
+
type: types.length > 1 ? types : types[0]
|
|
771
|
+
};
|
|
772
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
773
|
+
const types = options.reduce((acc, x) => {
|
|
774
|
+
const type = typeof x._def.value;
|
|
775
|
+
switch (type) {
|
|
776
|
+
case "string":
|
|
777
|
+
case "number":
|
|
778
|
+
case "boolean":
|
|
779
|
+
return [...acc, type];
|
|
780
|
+
case "bigint":
|
|
781
|
+
return [...acc, "integer"];
|
|
782
|
+
case "object":
|
|
783
|
+
if (x._def.value === null)
|
|
784
|
+
return [...acc, "null"];
|
|
785
|
+
case "symbol":
|
|
786
|
+
case "undefined":
|
|
787
|
+
case "function":
|
|
788
|
+
default:
|
|
789
|
+
return acc;
|
|
790
|
+
}
|
|
791
|
+
}, []);
|
|
792
|
+
if (types.length === options.length) {
|
|
793
|
+
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
794
|
+
return {
|
|
795
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
796
|
+
enum: options.reduce((acc, x) => {
|
|
797
|
+
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
798
|
+
}, [])
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
802
|
+
return {
|
|
803
|
+
type: "string",
|
|
804
|
+
enum: options.reduce((acc, x) => [
|
|
805
|
+
...acc,
|
|
806
|
+
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
807
|
+
], [])
|
|
808
|
+
};
|
|
846
809
|
}
|
|
847
|
-
return
|
|
810
|
+
return asAnyOf(def, refs);
|
|
811
|
+
}
|
|
812
|
+
var asAnyOf = (def, refs) => {
|
|
813
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
|
|
814
|
+
...refs,
|
|
815
|
+
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
816
|
+
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
817
|
+
return anyOf.length ? { anyOf } : void 0;
|
|
848
818
|
};
|
|
849
819
|
|
|
850
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
851
|
-
function
|
|
852
|
-
if (
|
|
853
|
-
|
|
820
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
821
|
+
function parseNullableDef(def, refs) {
|
|
822
|
+
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
823
|
+
if (refs.target === "openApi3") {
|
|
824
|
+
return {
|
|
825
|
+
type: primitiveMappings[def.innerType._def.typeName],
|
|
826
|
+
nullable: true
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
return {
|
|
830
|
+
type: [
|
|
831
|
+
primitiveMappings[def.innerType._def.typeName],
|
|
832
|
+
"null"
|
|
833
|
+
]
|
|
834
|
+
};
|
|
854
835
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
refs.definitionPath,
|
|
858
|
-
refs.openAiAnyTypeName
|
|
859
|
-
];
|
|
860
|
-
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
861
|
-
return {
|
|
862
|
-
$ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
function parseArrayDef(def, refs) {
|
|
866
|
-
const res = {
|
|
867
|
-
type: "array"
|
|
868
|
-
};
|
|
869
|
-
if (def.type?._def && def.type?._def?.typeName !== zod.ZodFirstPartyTypeKind.ZodAny) {
|
|
870
|
-
res.items = parseDef(def.type._def, {
|
|
836
|
+
if (refs.target === "openApi3") {
|
|
837
|
+
const base2 = parseDef(def.innerType._def, {
|
|
871
838
|
...refs,
|
|
872
|
-
currentPath: [...refs.currentPath
|
|
839
|
+
currentPath: [...refs.currentPath]
|
|
873
840
|
});
|
|
841
|
+
if (base2 && "$ref" in base2)
|
|
842
|
+
return { allOf: [base2], nullable: true };
|
|
843
|
+
return base2 && { ...base2, nullable: true };
|
|
874
844
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
881
|
-
if (def.exactLength) {
|
|
882
|
-
setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
883
|
-
setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
884
|
-
}
|
|
885
|
-
return res;
|
|
845
|
+
const base = parseDef(def.innerType._def, {
|
|
846
|
+
...refs,
|
|
847
|
+
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
848
|
+
});
|
|
849
|
+
return base && { anyOf: [base, { type: "null" }] };
|
|
886
850
|
}
|
|
887
851
|
|
|
888
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
889
|
-
function
|
|
852
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
853
|
+
function parseNumberDef(def, refs) {
|
|
890
854
|
const res = {
|
|
891
|
-
type: "
|
|
892
|
-
format: "int64"
|
|
855
|
+
type: "number"
|
|
893
856
|
};
|
|
894
857
|
if (!def.checks)
|
|
895
858
|
return res;
|
|
896
859
|
for (const check of def.checks) {
|
|
897
860
|
switch (check.kind) {
|
|
861
|
+
case "int":
|
|
862
|
+
res.type = "integer";
|
|
863
|
+
addErrorMessage(res, "type", check.message, refs);
|
|
864
|
+
break;
|
|
898
865
|
case "min":
|
|
899
866
|
if (refs.target === "jsonSchema7") {
|
|
900
867
|
if (check.inclusive) {
|
|
@@ -931,1114 +898,1147 @@ function parseBigintDef(def, refs) {
|
|
|
931
898
|
return res;
|
|
932
899
|
}
|
|
933
900
|
|
|
934
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
935
|
-
function
|
|
936
|
-
|
|
937
|
-
|
|
901
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
902
|
+
function parseObjectDef(def, refs) {
|
|
903
|
+
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
904
|
+
const result = {
|
|
905
|
+
type: "object",
|
|
906
|
+
properties: {}
|
|
938
907
|
};
|
|
908
|
+
const required = [];
|
|
909
|
+
const shape = def.shape();
|
|
910
|
+
for (const propName in shape) {
|
|
911
|
+
let propDef = shape[propName];
|
|
912
|
+
if (propDef === void 0 || propDef._def === void 0) {
|
|
913
|
+
continue;
|
|
914
|
+
}
|
|
915
|
+
let propOptional = safeIsOptional(propDef);
|
|
916
|
+
if (propOptional && forceOptionalIntoNullable) {
|
|
917
|
+
if (propDef._def.typeName === "ZodOptional") {
|
|
918
|
+
propDef = propDef._def.innerType;
|
|
919
|
+
}
|
|
920
|
+
if (!propDef.isNullable()) {
|
|
921
|
+
propDef = propDef.nullable();
|
|
922
|
+
}
|
|
923
|
+
propOptional = false;
|
|
924
|
+
}
|
|
925
|
+
const parsedDef = parseDef(propDef._def, {
|
|
926
|
+
...refs,
|
|
927
|
+
currentPath: [...refs.currentPath, "properties", propName],
|
|
928
|
+
propertyPath: [...refs.currentPath, "properties", propName]
|
|
929
|
+
});
|
|
930
|
+
if (parsedDef === void 0) {
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
result.properties[propName] = parsedDef;
|
|
934
|
+
if (!propOptional) {
|
|
935
|
+
required.push(propName);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
if (required.length) {
|
|
939
|
+
result.required = required;
|
|
940
|
+
}
|
|
941
|
+
const additionalProperties = decideAdditionalProperties(def, refs);
|
|
942
|
+
if (additionalProperties !== void 0) {
|
|
943
|
+
result.additionalProperties = additionalProperties;
|
|
944
|
+
}
|
|
945
|
+
return result;
|
|
939
946
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
947
|
-
var parseCatchDef = (def, refs) => {
|
|
948
|
-
return parseDef(def.innerType._def, refs);
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
952
|
-
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
953
|
-
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
954
|
-
if (Array.isArray(strategy)) {
|
|
955
|
-
return {
|
|
956
|
-
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
|
|
957
|
-
};
|
|
947
|
+
function decideAdditionalProperties(def, refs) {
|
|
948
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
949
|
+
return parseDef(def.catchall._def, {
|
|
950
|
+
...refs,
|
|
951
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
952
|
+
});
|
|
958
953
|
}
|
|
959
|
-
switch (
|
|
960
|
-
case "
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
case "format:date":
|
|
967
|
-
return {
|
|
968
|
-
type: "string",
|
|
969
|
-
format: "date"
|
|
970
|
-
};
|
|
971
|
-
case "integer":
|
|
972
|
-
return integerDateParser(def, refs);
|
|
954
|
+
switch (def.unknownKeys) {
|
|
955
|
+
case "passthrough":
|
|
956
|
+
return refs.allowedAdditionalProperties;
|
|
957
|
+
case "strict":
|
|
958
|
+
return refs.rejectedAdditionalProperties;
|
|
959
|
+
case "strip":
|
|
960
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
973
961
|
}
|
|
974
962
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
if (refs.target === "openApi3") {
|
|
981
|
-
return res;
|
|
963
|
+
function safeIsOptional(schema) {
|
|
964
|
+
try {
|
|
965
|
+
return schema.isOptional();
|
|
966
|
+
} catch {
|
|
967
|
+
return true;
|
|
982
968
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
check.value,
|
|
990
|
-
// This is in milliseconds
|
|
991
|
-
check.message,
|
|
992
|
-
refs
|
|
993
|
-
);
|
|
994
|
-
break;
|
|
995
|
-
case "max":
|
|
996
|
-
setResponseValueAndErrors(
|
|
997
|
-
res,
|
|
998
|
-
"maximum",
|
|
999
|
-
check.value,
|
|
1000
|
-
// This is in milliseconds
|
|
1001
|
-
check.message,
|
|
1002
|
-
refs
|
|
1003
|
-
);
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
972
|
+
var parseOptionalDef = (def, refs) => {
|
|
973
|
+
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
974
|
+
return parseDef(def.innerType._def, refs);
|
|
1006
975
|
}
|
|
1007
|
-
|
|
976
|
+
const innerSchema = parseDef(def.innerType._def, {
|
|
977
|
+
...refs,
|
|
978
|
+
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
979
|
+
});
|
|
980
|
+
return innerSchema ? {
|
|
981
|
+
anyOf: [
|
|
982
|
+
{
|
|
983
|
+
not: parseAnyDef(refs)
|
|
984
|
+
},
|
|
985
|
+
innerSchema
|
|
986
|
+
]
|
|
987
|
+
} : parseAnyDef(refs);
|
|
1008
988
|
};
|
|
1009
989
|
|
|
1010
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
1011
|
-
|
|
990
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
991
|
+
var parsePipelineDef = (def, refs) => {
|
|
992
|
+
if (refs.pipeStrategy === "input") {
|
|
993
|
+
return parseDef(def.in._def, refs);
|
|
994
|
+
} else if (refs.pipeStrategy === "output") {
|
|
995
|
+
return parseDef(def.out._def, refs);
|
|
996
|
+
}
|
|
997
|
+
const a = parseDef(def.in._def, {
|
|
998
|
+
...refs,
|
|
999
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
1000
|
+
});
|
|
1001
|
+
const b = parseDef(def.out._def, {
|
|
1002
|
+
...refs,
|
|
1003
|
+
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
1004
|
+
});
|
|
1012
1005
|
return {
|
|
1013
|
-
|
|
1014
|
-
default: _def.defaultValue()
|
|
1006
|
+
allOf: [a, b].filter((x) => x !== void 0)
|
|
1015
1007
|
};
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
1019
|
-
function parseEffectsDef(_def, refs) {
|
|
1020
|
-
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
1021
|
-
}
|
|
1008
|
+
};
|
|
1022
1009
|
|
|
1023
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
1024
|
-
function
|
|
1025
|
-
return
|
|
1026
|
-
type: "string",
|
|
1027
|
-
enum: Array.from(def.values)
|
|
1028
|
-
};
|
|
1010
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1011
|
+
function parsePromiseDef(def, refs) {
|
|
1012
|
+
return parseDef(def.type._def, refs);
|
|
1029
1013
|
}
|
|
1030
1014
|
|
|
1031
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
};
|
|
1037
|
-
function parseIntersectionDef(def, refs) {
|
|
1038
|
-
const allOf = [
|
|
1039
|
-
parseDef(def.left._def, {
|
|
1040
|
-
...refs,
|
|
1041
|
-
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
1042
|
-
}),
|
|
1043
|
-
parseDef(def.right._def, {
|
|
1044
|
-
...refs,
|
|
1045
|
-
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
1046
|
-
})
|
|
1047
|
-
].filter((x) => !!x);
|
|
1048
|
-
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
1049
|
-
const mergedAllOf = [];
|
|
1050
|
-
allOf.forEach((schema) => {
|
|
1051
|
-
if (isJsonSchema7AllOfType(schema)) {
|
|
1052
|
-
mergedAllOf.push(...schema.allOf);
|
|
1053
|
-
if (schema.unevaluatedProperties === void 0) {
|
|
1054
|
-
unevaluatedProperties = void 0;
|
|
1055
|
-
}
|
|
1056
|
-
} else {
|
|
1057
|
-
let nestedSchema = schema;
|
|
1058
|
-
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
1059
|
-
const { additionalProperties, ...rest } = schema;
|
|
1060
|
-
nestedSchema = rest;
|
|
1061
|
-
} else {
|
|
1062
|
-
unevaluatedProperties = void 0;
|
|
1063
|
-
}
|
|
1064
|
-
mergedAllOf.push(nestedSchema);
|
|
1065
|
-
}
|
|
1015
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1016
|
+
function parseSetDef(def, refs) {
|
|
1017
|
+
const items = parseDef(def.valueType._def, {
|
|
1018
|
+
...refs,
|
|
1019
|
+
currentPath: [...refs.currentPath, "items"]
|
|
1066
1020
|
});
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1021
|
+
const schema = {
|
|
1022
|
+
type: "array",
|
|
1023
|
+
uniqueItems: true,
|
|
1024
|
+
items
|
|
1025
|
+
};
|
|
1026
|
+
if (def.minSize) {
|
|
1027
|
+
setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
1028
|
+
}
|
|
1029
|
+
if (def.maxSize) {
|
|
1030
|
+
setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
1031
|
+
}
|
|
1032
|
+
return schema;
|
|
1071
1033
|
}
|
|
1072
1034
|
|
|
1073
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
1074
|
-
function
|
|
1075
|
-
|
|
1076
|
-
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
1035
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1036
|
+
function parseTupleDef(def, refs) {
|
|
1037
|
+
if (def.rest) {
|
|
1077
1038
|
return {
|
|
1078
|
-
type:
|
|
1039
|
+
type: "array",
|
|
1040
|
+
minItems: def.items.length,
|
|
1041
|
+
items: def.items.map((x, i) => parseDef(x._def, {
|
|
1042
|
+
...refs,
|
|
1043
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1044
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
1045
|
+
additionalItems: parseDef(def.rest._def, {
|
|
1046
|
+
...refs,
|
|
1047
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
1048
|
+
})
|
|
1079
1049
|
};
|
|
1080
|
-
}
|
|
1081
|
-
if (refs.target === "openApi3") {
|
|
1050
|
+
} else {
|
|
1082
1051
|
return {
|
|
1083
|
-
type:
|
|
1084
|
-
|
|
1052
|
+
type: "array",
|
|
1053
|
+
minItems: def.items.length,
|
|
1054
|
+
maxItems: def.items.length,
|
|
1055
|
+
items: def.items.map((x, i) => parseDef(x._def, {
|
|
1056
|
+
...refs,
|
|
1057
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1058
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
1085
1059
|
};
|
|
1086
1060
|
}
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1064
|
+
function parseUndefinedDef(refs) {
|
|
1087
1065
|
return {
|
|
1088
|
-
|
|
1089
|
-
const: def.value
|
|
1066
|
+
not: parseAnyDef(refs)
|
|
1090
1067
|
};
|
|
1091
1068
|
}
|
|
1092
1069
|
|
|
1093
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
1102
|
-
/**
|
|
1103
|
-
* `a-z` was added to replicate /i flag
|
|
1104
|
-
*/
|
|
1105
|
-
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
1106
|
-
/**
|
|
1107
|
-
* Constructed a valid Unicode RegExp
|
|
1108
|
-
*
|
|
1109
|
-
* Lazily instantiate since this type of regex isn't supported
|
|
1110
|
-
* in all envs (e.g. React Native).
|
|
1111
|
-
*
|
|
1112
|
-
* See:
|
|
1113
|
-
* https://github.com/colinhacks/zod/issues/2433
|
|
1114
|
-
* Fix in Zod:
|
|
1115
|
-
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
1116
|
-
*/
|
|
1117
|
-
emoji: () => {
|
|
1118
|
-
if (emojiRegex === void 0) {
|
|
1119
|
-
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
1120
|
-
}
|
|
1121
|
-
return emojiRegex;
|
|
1122
|
-
},
|
|
1123
|
-
/**
|
|
1124
|
-
* Unused
|
|
1125
|
-
*/
|
|
1126
|
-
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
1127
|
-
/**
|
|
1128
|
-
* Unused
|
|
1129
|
-
*/
|
|
1130
|
-
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
1131
|
-
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
1132
|
-
/**
|
|
1133
|
-
* Unused
|
|
1134
|
-
*/
|
|
1135
|
-
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
1136
|
-
ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
1137
|
-
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
1138
|
-
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
1139
|
-
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
1140
|
-
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
1070
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1071
|
+
function parseUnknownDef(refs) {
|
|
1072
|
+
return parseAnyDef(refs);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1076
|
+
var parseReadonlyDef = (def, refs) => {
|
|
1077
|
+
return parseDef(def.innerType._def, refs);
|
|
1141
1078
|
};
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
1227
|
-
}
|
|
1228
|
-
if (check.version !== "v4") {
|
|
1229
|
-
addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
1230
|
-
}
|
|
1231
|
-
break;
|
|
1232
|
-
}
|
|
1233
|
-
case "emoji":
|
|
1234
|
-
addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
1235
|
-
break;
|
|
1236
|
-
case "ulid": {
|
|
1237
|
-
addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
1238
|
-
break;
|
|
1239
|
-
}
|
|
1240
|
-
case "base64": {
|
|
1241
|
-
switch (refs.base64Strategy) {
|
|
1242
|
-
case "format:binary": {
|
|
1243
|
-
addFormat(res, "binary", check.message, refs);
|
|
1244
|
-
break;
|
|
1245
|
-
}
|
|
1246
|
-
case "contentEncoding:base64": {
|
|
1247
|
-
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
1248
|
-
break;
|
|
1249
|
-
}
|
|
1250
|
-
case "pattern:zod": {
|
|
1251
|
-
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
1252
|
-
break;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
break;
|
|
1256
|
-
}
|
|
1257
|
-
case "nanoid": {
|
|
1258
|
-
addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1079
|
+
|
|
1080
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1081
|
+
var selectParser = (def, typeName, refs) => {
|
|
1082
|
+
switch (typeName) {
|
|
1083
|
+
case zod.ZodFirstPartyTypeKind.ZodString:
|
|
1084
|
+
return parseStringDef(def, refs);
|
|
1085
|
+
case zod.ZodFirstPartyTypeKind.ZodNumber:
|
|
1086
|
+
return parseNumberDef(def, refs);
|
|
1087
|
+
case zod.ZodFirstPartyTypeKind.ZodObject:
|
|
1088
|
+
return parseObjectDef(def, refs);
|
|
1089
|
+
case zod.ZodFirstPartyTypeKind.ZodBigInt:
|
|
1090
|
+
return parseBigintDef(def, refs);
|
|
1091
|
+
case zod.ZodFirstPartyTypeKind.ZodBoolean:
|
|
1092
|
+
return parseBooleanDef();
|
|
1093
|
+
case zod.ZodFirstPartyTypeKind.ZodDate:
|
|
1094
|
+
return parseDateDef(def, refs);
|
|
1095
|
+
case zod.ZodFirstPartyTypeKind.ZodUndefined:
|
|
1096
|
+
return parseUndefinedDef(refs);
|
|
1097
|
+
case zod.ZodFirstPartyTypeKind.ZodNull:
|
|
1098
|
+
return parseNullDef(refs);
|
|
1099
|
+
case zod.ZodFirstPartyTypeKind.ZodArray:
|
|
1100
|
+
return parseArrayDef(def, refs);
|
|
1101
|
+
case zod.ZodFirstPartyTypeKind.ZodUnion:
|
|
1102
|
+
case zod.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
1103
|
+
return parseUnionDef(def, refs);
|
|
1104
|
+
case zod.ZodFirstPartyTypeKind.ZodIntersection:
|
|
1105
|
+
return parseIntersectionDef(def, refs);
|
|
1106
|
+
case zod.ZodFirstPartyTypeKind.ZodTuple:
|
|
1107
|
+
return parseTupleDef(def, refs);
|
|
1108
|
+
case zod.ZodFirstPartyTypeKind.ZodRecord:
|
|
1109
|
+
return parseRecordDef(def, refs);
|
|
1110
|
+
case zod.ZodFirstPartyTypeKind.ZodLiteral:
|
|
1111
|
+
return parseLiteralDef(def, refs);
|
|
1112
|
+
case zod.ZodFirstPartyTypeKind.ZodEnum:
|
|
1113
|
+
return parseEnumDef(def);
|
|
1114
|
+
case zod.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
1115
|
+
return parseNativeEnumDef(def);
|
|
1116
|
+
case zod.ZodFirstPartyTypeKind.ZodNullable:
|
|
1117
|
+
return parseNullableDef(def, refs);
|
|
1118
|
+
case zod.ZodFirstPartyTypeKind.ZodOptional:
|
|
1119
|
+
return parseOptionalDef(def, refs);
|
|
1120
|
+
case zod.ZodFirstPartyTypeKind.ZodMap:
|
|
1121
|
+
return parseMapDef(def, refs);
|
|
1122
|
+
case zod.ZodFirstPartyTypeKind.ZodSet:
|
|
1123
|
+
return parseSetDef(def, refs);
|
|
1124
|
+
case zod.ZodFirstPartyTypeKind.ZodLazy:
|
|
1125
|
+
return () => def.getter()._def;
|
|
1126
|
+
case zod.ZodFirstPartyTypeKind.ZodPromise:
|
|
1127
|
+
return parsePromiseDef(def, refs);
|
|
1128
|
+
case zod.ZodFirstPartyTypeKind.ZodNaN:
|
|
1129
|
+
case zod.ZodFirstPartyTypeKind.ZodNever:
|
|
1130
|
+
return parseNeverDef(refs);
|
|
1131
|
+
case zod.ZodFirstPartyTypeKind.ZodEffects:
|
|
1132
|
+
return parseEffectsDef(def, refs);
|
|
1133
|
+
case zod.ZodFirstPartyTypeKind.ZodAny:
|
|
1134
|
+
return parseAnyDef(refs);
|
|
1135
|
+
case zod.ZodFirstPartyTypeKind.ZodUnknown:
|
|
1136
|
+
return parseUnknownDef(refs);
|
|
1137
|
+
case zod.ZodFirstPartyTypeKind.ZodDefault:
|
|
1138
|
+
return parseDefaultDef(def, refs);
|
|
1139
|
+
case zod.ZodFirstPartyTypeKind.ZodBranded:
|
|
1140
|
+
return parseBrandedDef(def, refs);
|
|
1141
|
+
case zod.ZodFirstPartyTypeKind.ZodReadonly:
|
|
1142
|
+
return parseReadonlyDef(def, refs);
|
|
1143
|
+
case zod.ZodFirstPartyTypeKind.ZodCatch:
|
|
1144
|
+
return parseCatchDef(def, refs);
|
|
1145
|
+
case zod.ZodFirstPartyTypeKind.ZodPipeline:
|
|
1146
|
+
return parsePipelineDef(def, refs);
|
|
1147
|
+
case zod.ZodFirstPartyTypeKind.ZodFunction:
|
|
1148
|
+
case zod.ZodFirstPartyTypeKind.ZodVoid:
|
|
1149
|
+
case zod.ZodFirstPartyTypeKind.ZodSymbol:
|
|
1150
|
+
return void 0;
|
|
1151
|
+
default:
|
|
1152
|
+
return /* @__PURE__ */ ((_) => void 0)();
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1157
|
+
function parseDef(def, refs, forceResolution = false) {
|
|
1158
|
+
const seenItem = refs.seen.get(def);
|
|
1159
|
+
if (refs.override) {
|
|
1160
|
+
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
1161
|
+
if (overrideResult !== ignoreOverride) {
|
|
1162
|
+
return overrideResult;
|
|
1261
1163
|
}
|
|
1262
1164
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
1269
|
-
function escapeNonAlphaNumeric(source) {
|
|
1270
|
-
let result = "";
|
|
1271
|
-
for (let i = 0; i < source.length; i++) {
|
|
1272
|
-
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
1273
|
-
result += "\\";
|
|
1165
|
+
if (seenItem && !forceResolution) {
|
|
1166
|
+
const seenSchema = get$ref(seenItem, refs);
|
|
1167
|
+
if (seenSchema !== void 0) {
|
|
1168
|
+
return seenSchema;
|
|
1274
1169
|
}
|
|
1275
|
-
result += source[i];
|
|
1276
1170
|
}
|
|
1277
|
-
|
|
1171
|
+
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
1172
|
+
refs.seen.set(def, newItem);
|
|
1173
|
+
const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
1174
|
+
const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
1175
|
+
if (jsonSchema) {
|
|
1176
|
+
addMeta(def, refs, jsonSchema);
|
|
1177
|
+
}
|
|
1178
|
+
if (refs.postProcess) {
|
|
1179
|
+
const postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
1180
|
+
newItem.jsonSchema = jsonSchema;
|
|
1181
|
+
return postProcessResult;
|
|
1182
|
+
}
|
|
1183
|
+
newItem.jsonSchema = jsonSchema;
|
|
1184
|
+
return jsonSchema;
|
|
1278
1185
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1186
|
+
var get$ref = (item, refs) => {
|
|
1187
|
+
switch (refs.$refStrategy) {
|
|
1188
|
+
case "root":
|
|
1189
|
+
return { $ref: item.path.join("/") };
|
|
1190
|
+
case "relative":
|
|
1191
|
+
return { $ref: getRelativePath(refs.currentPath, item.path) };
|
|
1192
|
+
case "none":
|
|
1193
|
+
case "seen": {
|
|
1194
|
+
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
1195
|
+
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
1196
|
+
return parseAnyDef(refs);
|
|
1197
|
+
}
|
|
1198
|
+
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : void 0;
|
|
1283
1199
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
var addMeta = (def, refs, jsonSchema) => {
|
|
1203
|
+
if (def.description) {
|
|
1204
|
+
jsonSchema.description = def.description;
|
|
1205
|
+
if (refs.markdownDescription) {
|
|
1206
|
+
jsonSchema.markdownDescription = def.description;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
return jsonSchema;
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1213
|
+
var zodToJsonSchema = (schema, options) => {
|
|
1214
|
+
const refs = getRefs(options);
|
|
1215
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
1216
|
+
...acc,
|
|
1217
|
+
[name2]: parseDef(schema2._def, {
|
|
1218
|
+
...refs,
|
|
1219
|
+
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
1220
|
+
}, true) ?? parseAnyDef(refs)
|
|
1221
|
+
}), {}) : void 0;
|
|
1222
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
1223
|
+
const main = parseDef(schema._def, name === void 0 ? refs : {
|
|
1224
|
+
...refs,
|
|
1225
|
+
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
1226
|
+
}, false) ?? parseAnyDef(refs);
|
|
1227
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1228
|
+
if (title !== void 0) {
|
|
1229
|
+
main.title = title;
|
|
1230
|
+
}
|
|
1231
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
1232
|
+
if (!definitions) {
|
|
1233
|
+
definitions = {};
|
|
1234
|
+
}
|
|
1235
|
+
if (!definitions[refs.openAiAnyTypeName]) {
|
|
1236
|
+
definitions[refs.openAiAnyTypeName] = {
|
|
1237
|
+
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
1238
|
+
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
1239
|
+
items: {
|
|
1240
|
+
$ref: refs.$refStrategy === "relative" ? "1" : [
|
|
1241
|
+
...refs.basePath,
|
|
1242
|
+
refs.definitionPath,
|
|
1243
|
+
refs.openAiAnyTypeName
|
|
1244
|
+
].join("/")
|
|
1296
1245
|
}
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
const combined = name === void 0 ? definitions ? {
|
|
1250
|
+
...main,
|
|
1251
|
+
[refs.definitionPath]: definitions
|
|
1252
|
+
} : main : {
|
|
1253
|
+
$ref: [
|
|
1254
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
1255
|
+
refs.definitionPath,
|
|
1256
|
+
name
|
|
1257
|
+
].join("/"),
|
|
1258
|
+
[refs.definitionPath]: {
|
|
1259
|
+
...definitions,
|
|
1260
|
+
[name]: main
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
if (refs.target === "jsonSchema7") {
|
|
1264
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
1265
|
+
} else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
1266
|
+
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
1267
|
+
}
|
|
1268
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
|
|
1269
|
+
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
1270
|
+
}
|
|
1271
|
+
return combined;
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
1275
|
+
var esm_default = zodToJsonSchema;
|
|
1276
|
+
|
|
1277
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
|
|
1278
|
+
var DoubleIndexedKV = class {
|
|
1279
|
+
constructor() {
|
|
1280
|
+
this.keyToValue = /* @__PURE__ */ new Map();
|
|
1281
|
+
this.valueToKey = /* @__PURE__ */ new Map();
|
|
1282
|
+
}
|
|
1283
|
+
set(key, value) {
|
|
1284
|
+
this.keyToValue.set(key, value);
|
|
1285
|
+
this.valueToKey.set(value, key);
|
|
1286
|
+
}
|
|
1287
|
+
getByKey(key) {
|
|
1288
|
+
return this.keyToValue.get(key);
|
|
1289
|
+
}
|
|
1290
|
+
getByValue(value) {
|
|
1291
|
+
return this.valueToKey.get(value);
|
|
1292
|
+
}
|
|
1293
|
+
clear() {
|
|
1294
|
+
this.keyToValue.clear();
|
|
1295
|
+
this.valueToKey.clear();
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
|
|
1300
|
+
var Registry = class {
|
|
1301
|
+
constructor(generateIdentifier) {
|
|
1302
|
+
this.generateIdentifier = generateIdentifier;
|
|
1303
|
+
this.kv = new DoubleIndexedKV();
|
|
1304
|
+
}
|
|
1305
|
+
register(value, identifier) {
|
|
1306
|
+
if (this.kv.getByValue(value)) {
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
if (!identifier) {
|
|
1310
|
+
identifier = this.generateIdentifier(value);
|
|
1311
|
+
}
|
|
1312
|
+
this.kv.set(identifier, value);
|
|
1313
|
+
}
|
|
1314
|
+
clear() {
|
|
1315
|
+
this.kv.clear();
|
|
1316
|
+
}
|
|
1317
|
+
getIdentifier(value) {
|
|
1318
|
+
return this.kv.getByValue(value);
|
|
1319
|
+
}
|
|
1320
|
+
getValue(identifier) {
|
|
1321
|
+
return this.kv.getByKey(identifier);
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
|
|
1326
|
+
var ClassRegistry = class extends Registry {
|
|
1327
|
+
constructor() {
|
|
1328
|
+
super((c) => c.name);
|
|
1329
|
+
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
1330
|
+
}
|
|
1331
|
+
register(value, options) {
|
|
1332
|
+
if (typeof options === "object") {
|
|
1333
|
+
if (options.allowProps) {
|
|
1334
|
+
this.classToAllowedProps.set(value, options.allowProps);
|
|
1297
1335
|
}
|
|
1336
|
+
super.register(value, options.identifier);
|
|
1337
|
+
} else {
|
|
1338
|
+
super.register(value, options);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
getAllowedProps(value) {
|
|
1342
|
+
return this.classToAllowedProps.get(value);
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
|
|
1346
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.js
|
|
1347
|
+
function valuesOfObj(record) {
|
|
1348
|
+
if ("values" in Object) {
|
|
1349
|
+
return Object.values(record);
|
|
1350
|
+
}
|
|
1351
|
+
const values = [];
|
|
1352
|
+
for (const key in record) {
|
|
1353
|
+
if (record.hasOwnProperty(key)) {
|
|
1354
|
+
values.push(record[key]);
|
|
1298
1355
|
}
|
|
1299
|
-
schema.anyOf.push({
|
|
1300
|
-
format: value,
|
|
1301
|
-
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
1302
|
-
});
|
|
1303
|
-
} else {
|
|
1304
|
-
setResponseValueAndErrors(schema, "format", value, message, refs);
|
|
1305
1356
|
}
|
|
1357
|
+
return values;
|
|
1306
1358
|
}
|
|
1307
|
-
function
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1359
|
+
function find(record, predicate) {
|
|
1360
|
+
const values = valuesOfObj(record);
|
|
1361
|
+
if ("find" in values) {
|
|
1362
|
+
return values.find(predicate);
|
|
1363
|
+
}
|
|
1364
|
+
const valuesNotNever = values;
|
|
1365
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
1366
|
+
const value = valuesNotNever[i];
|
|
1367
|
+
if (predicate(value)) {
|
|
1368
|
+
return value;
|
|
1311
1369
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1370
|
+
}
|
|
1371
|
+
return void 0;
|
|
1372
|
+
}
|
|
1373
|
+
function forEach(record, run) {
|
|
1374
|
+
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
1375
|
+
}
|
|
1376
|
+
function includes(arr, value) {
|
|
1377
|
+
return arr.indexOf(value) !== -1;
|
|
1378
|
+
}
|
|
1379
|
+
function findArr(record, predicate) {
|
|
1380
|
+
for (let i = 0; i < record.length; i++) {
|
|
1381
|
+
const value = record[i];
|
|
1382
|
+
if (predicate(value)) {
|
|
1383
|
+
return value;
|
|
1326
1384
|
}
|
|
1327
|
-
schema.allOf.push({
|
|
1328
|
-
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
1329
|
-
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
1330
|
-
});
|
|
1331
|
-
} else {
|
|
1332
|
-
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
1333
1385
|
}
|
|
1386
|
+
return void 0;
|
|
1334
1387
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1388
|
+
|
|
1389
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
|
|
1390
|
+
var CustomTransformerRegistry = class {
|
|
1391
|
+
constructor() {
|
|
1392
|
+
this.transfomers = {};
|
|
1338
1393
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1394
|
+
register(transformer) {
|
|
1395
|
+
this.transfomers[transformer.name] = transformer;
|
|
1396
|
+
}
|
|
1397
|
+
findApplicable(v) {
|
|
1398
|
+
return find(this.transfomers, (transformer) => transformer.isApplicable(v));
|
|
1399
|
+
}
|
|
1400
|
+
findByName(name) {
|
|
1401
|
+
return this.transfomers[name];
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
|
|
1406
|
+
var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
|
|
1407
|
+
var isUndefined = (payload) => typeof payload === "undefined";
|
|
1408
|
+
var isNull = (payload) => payload === null;
|
|
1409
|
+
var isPlainObject = (payload) => {
|
|
1410
|
+
if (typeof payload !== "object" || payload === null)
|
|
1411
|
+
return false;
|
|
1412
|
+
if (payload === Object.prototype)
|
|
1413
|
+
return false;
|
|
1414
|
+
if (Object.getPrototypeOf(payload) === null)
|
|
1415
|
+
return true;
|
|
1416
|
+
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
1417
|
+
};
|
|
1418
|
+
var isEmptyObject = (payload) => isPlainObject(payload) && Object.keys(payload).length === 0;
|
|
1419
|
+
var isArray = (payload) => Array.isArray(payload);
|
|
1420
|
+
var isString = (payload) => typeof payload === "string";
|
|
1421
|
+
var isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
|
|
1422
|
+
var isBoolean = (payload) => typeof payload === "boolean";
|
|
1423
|
+
var isRegExp = (payload) => payload instanceof RegExp;
|
|
1424
|
+
var isMap = (payload) => payload instanceof Map;
|
|
1425
|
+
var isSet = (payload) => payload instanceof Set;
|
|
1426
|
+
var isSymbol = (payload) => getType(payload) === "Symbol";
|
|
1427
|
+
var isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
|
|
1428
|
+
var isError = (payload) => payload instanceof Error;
|
|
1429
|
+
var isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
|
|
1430
|
+
var isPrimitive = (payload) => isBoolean(payload) || isNull(payload) || isUndefined(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
|
|
1431
|
+
var isBigint = (payload) => typeof payload === "bigint";
|
|
1432
|
+
var isInfinite = (payload) => payload === Infinity || payload === -Infinity;
|
|
1433
|
+
var isTypedArray = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
|
|
1434
|
+
var isURL = (payload) => payload instanceof URL;
|
|
1435
|
+
|
|
1436
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
|
|
1437
|
+
var escapeKey = (key) => key.replace(/\./g, "\\.");
|
|
1438
|
+
var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
|
|
1439
|
+
var parsePath = (string) => {
|
|
1440
|
+
const result = [];
|
|
1441
|
+
let segment = "";
|
|
1442
|
+
for (let i = 0; i < string.length; i++) {
|
|
1443
|
+
let char = string.charAt(i);
|
|
1444
|
+
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
1445
|
+
if (isEscapedDot) {
|
|
1446
|
+
segment += ".";
|
|
1447
|
+
i++;
|
|
1354
1448
|
continue;
|
|
1355
1449
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
1362
|
-
inCharRange = false;
|
|
1363
|
-
} else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
|
1364
|
-
pattern += source[i];
|
|
1365
|
-
inCharRange = true;
|
|
1366
|
-
} else {
|
|
1367
|
-
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
1368
|
-
}
|
|
1369
|
-
continue;
|
|
1370
|
-
}
|
|
1371
|
-
} else if (source[i].match(/[a-z]/)) {
|
|
1372
|
-
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
1373
|
-
continue;
|
|
1374
|
-
}
|
|
1450
|
+
const isEndOfSegment = char === ".";
|
|
1451
|
+
if (isEndOfSegment) {
|
|
1452
|
+
result.push(segment);
|
|
1453
|
+
segment = "";
|
|
1454
|
+
continue;
|
|
1375
1455
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1456
|
+
segment += char;
|
|
1457
|
+
}
|
|
1458
|
+
const lastSegment = segment;
|
|
1459
|
+
result.push(lastSegment);
|
|
1460
|
+
return result;
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
|
|
1464
|
+
function simpleTransformation(isApplicable, annotation, transform, untransform) {
|
|
1465
|
+
return {
|
|
1466
|
+
isApplicable,
|
|
1467
|
+
annotation,
|
|
1468
|
+
transform,
|
|
1469
|
+
untransform
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
var simpleRules = [
|
|
1473
|
+
simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
|
|
1474
|
+
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
1475
|
+
if (typeof BigInt !== "undefined") {
|
|
1476
|
+
return BigInt(v);
|
|
1386
1477
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1478
|
+
console.error("Please add a BigInt polyfill.");
|
|
1479
|
+
return v;
|
|
1480
|
+
}),
|
|
1481
|
+
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
1482
|
+
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
1483
|
+
const baseError = {
|
|
1484
|
+
name: v.name,
|
|
1485
|
+
message: v.message
|
|
1486
|
+
};
|
|
1487
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
1488
|
+
baseError[prop] = v[prop];
|
|
1489
|
+
});
|
|
1490
|
+
return baseError;
|
|
1491
|
+
}, (v, superJson) => {
|
|
1492
|
+
const e = new Error(v.message);
|
|
1493
|
+
e.name = v.name;
|
|
1494
|
+
e.stack = v.stack;
|
|
1495
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
1496
|
+
e[prop] = v[prop];
|
|
1497
|
+
});
|
|
1498
|
+
return e;
|
|
1499
|
+
}),
|
|
1500
|
+
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
1501
|
+
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
1502
|
+
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
1503
|
+
return new RegExp(body, flags);
|
|
1504
|
+
}),
|
|
1505
|
+
simpleTransformation(
|
|
1506
|
+
isSet,
|
|
1507
|
+
"set",
|
|
1508
|
+
// (sets only exist in es6+)
|
|
1509
|
+
// eslint-disable-next-line es5/no-es6-methods
|
|
1510
|
+
(v) => [...v.values()],
|
|
1511
|
+
(v) => new Set(v)
|
|
1512
|
+
),
|
|
1513
|
+
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
1514
|
+
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
1515
|
+
if (isNaNValue(v)) {
|
|
1516
|
+
return "NaN";
|
|
1392
1517
|
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
inCharGroup = false;
|
|
1398
|
-
} else if (!inCharGroup && source[i] === "[") {
|
|
1399
|
-
inCharGroup = true;
|
|
1518
|
+
if (v > 0) {
|
|
1519
|
+
return "Infinity";
|
|
1520
|
+
} else {
|
|
1521
|
+
return "-Infinity";
|
|
1400
1522
|
}
|
|
1523
|
+
}, Number),
|
|
1524
|
+
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
1525
|
+
return "-0";
|
|
1526
|
+
}, Number),
|
|
1527
|
+
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
1528
|
+
];
|
|
1529
|
+
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
1530
|
+
return {
|
|
1531
|
+
isApplicable,
|
|
1532
|
+
annotation,
|
|
1533
|
+
transform,
|
|
1534
|
+
untransform
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
var symbolRule = compositeTransformation((s, superJson) => {
|
|
1538
|
+
if (isSymbol(s)) {
|
|
1539
|
+
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
1540
|
+
return isRegistered;
|
|
1401
1541
|
}
|
|
1402
|
-
return
|
|
1542
|
+
return false;
|
|
1543
|
+
}, (s, superJson) => {
|
|
1544
|
+
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
1545
|
+
return ["symbol", identifier];
|
|
1546
|
+
}, (v) => v.description, (_, a, superJson) => {
|
|
1547
|
+
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
1548
|
+
if (!value) {
|
|
1549
|
+
throw new Error("Trying to deserialize unknown symbol");
|
|
1550
|
+
}
|
|
1551
|
+
return value;
|
|
1552
|
+
});
|
|
1553
|
+
var constructorToName = [
|
|
1554
|
+
Int8Array,
|
|
1555
|
+
Uint8Array,
|
|
1556
|
+
Int16Array,
|
|
1557
|
+
Uint16Array,
|
|
1558
|
+
Int32Array,
|
|
1559
|
+
Uint32Array,
|
|
1560
|
+
Float32Array,
|
|
1561
|
+
Float64Array,
|
|
1562
|
+
Uint8ClampedArray
|
|
1563
|
+
].reduce((obj, ctor) => {
|
|
1564
|
+
obj[ctor.name] = ctor;
|
|
1565
|
+
return obj;
|
|
1566
|
+
}, {});
|
|
1567
|
+
var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
1568
|
+
const ctor = constructorToName[a[1]];
|
|
1569
|
+
if (!ctor) {
|
|
1570
|
+
throw new Error("Trying to deserialize unknown typed array");
|
|
1571
|
+
}
|
|
1572
|
+
return new ctor(v);
|
|
1573
|
+
});
|
|
1574
|
+
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
1575
|
+
if (potentialClass?.constructor) {
|
|
1576
|
+
const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
1577
|
+
return isRegistered;
|
|
1578
|
+
}
|
|
1579
|
+
return false;
|
|
1403
1580
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1581
|
+
var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
1582
|
+
const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
|
|
1583
|
+
return ["class", identifier];
|
|
1584
|
+
}, (clazz, superJson) => {
|
|
1585
|
+
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
1586
|
+
if (!allowedProps) {
|
|
1587
|
+
return { ...clazz };
|
|
1409
1588
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
}) ?? parseAnyDef(refs)
|
|
1420
|
-
}), {}),
|
|
1421
|
-
additionalProperties: refs.rejectedAdditionalProperties
|
|
1422
|
-
};
|
|
1589
|
+
const result = {};
|
|
1590
|
+
allowedProps.forEach((prop) => {
|
|
1591
|
+
result[prop] = clazz[prop];
|
|
1592
|
+
});
|
|
1593
|
+
return result;
|
|
1594
|
+
}, (v, a, superJson) => {
|
|
1595
|
+
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
1596
|
+
if (!clazz) {
|
|
1597
|
+
throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
1423
1598
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1599
|
+
return Object.assign(Object.create(clazz.prototype), v);
|
|
1600
|
+
});
|
|
1601
|
+
var customRule = compositeTransformation((value, superJson) => {
|
|
1602
|
+
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
1603
|
+
}, (value, superJson) => {
|
|
1604
|
+
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
1605
|
+
return ["custom", transformer.name];
|
|
1606
|
+
}, (value, superJson) => {
|
|
1607
|
+
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
1608
|
+
return transformer.serialize(value);
|
|
1609
|
+
}, (v, a, superJson) => {
|
|
1610
|
+
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
1611
|
+
if (!transformer) {
|
|
1612
|
+
throw new Error("Trying to deserialize unknown custom value");
|
|
1433
1613
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
} else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) {
|
|
1614
|
+
return transformer.deserialize(v);
|
|
1615
|
+
});
|
|
1616
|
+
var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
|
|
1617
|
+
var transformValue = (value, superJson) => {
|
|
1618
|
+
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
1619
|
+
if (applicableCompositeRule) {
|
|
1441
1620
|
return {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
enum: def.keyType._def.values
|
|
1445
|
-
}
|
|
1621
|
+
value: applicableCompositeRule.transform(value, superJson),
|
|
1622
|
+
type: applicableCompositeRule.annotation(value, superJson)
|
|
1446
1623
|
};
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1624
|
+
}
|
|
1625
|
+
const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
|
|
1626
|
+
if (applicableSimpleRule) {
|
|
1449
1627
|
return {
|
|
1450
|
-
|
|
1451
|
-
|
|
1628
|
+
value: applicableSimpleRule.transform(value, superJson),
|
|
1629
|
+
type: applicableSimpleRule.annotation
|
|
1452
1630
|
};
|
|
1453
1631
|
}
|
|
1454
|
-
return
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
1458
|
-
function parseMapDef(def, refs) {
|
|
1459
|
-
if (refs.mapStrategy === "record") {
|
|
1460
|
-
return parseRecordDef(def, refs);
|
|
1461
|
-
}
|
|
1462
|
-
const keys = parseDef(def.keyType._def, {
|
|
1463
|
-
...refs,
|
|
1464
|
-
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
1465
|
-
}) || parseAnyDef(refs);
|
|
1466
|
-
const values = parseDef(def.valueType._def, {
|
|
1467
|
-
...refs,
|
|
1468
|
-
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
1469
|
-
}) || parseAnyDef(refs);
|
|
1470
|
-
return {
|
|
1471
|
-
type: "array",
|
|
1472
|
-
maxItems: 125,
|
|
1473
|
-
items: {
|
|
1474
|
-
type: "array",
|
|
1475
|
-
items: [keys, values],
|
|
1476
|
-
minItems: 2,
|
|
1477
|
-
maxItems: 2
|
|
1478
|
-
}
|
|
1479
|
-
};
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
1483
|
-
function parseNativeEnumDef(def) {
|
|
1484
|
-
const object = def.values;
|
|
1485
|
-
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
1486
|
-
return typeof object[object[key]] !== "number";
|
|
1487
|
-
});
|
|
1488
|
-
const actualValues = actualKeys.map((key) => object[key]);
|
|
1489
|
-
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
1490
|
-
return {
|
|
1491
|
-
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
1492
|
-
enum: actualValues
|
|
1493
|
-
};
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
1497
|
-
function parseNeverDef(refs) {
|
|
1498
|
-
return refs.target === "openAi" ? void 0 : {
|
|
1499
|
-
not: parseAnyDef({
|
|
1500
|
-
...refs,
|
|
1501
|
-
currentPath: [...refs.currentPath, "not"]
|
|
1502
|
-
})
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
1507
|
-
function parseNullDef(refs) {
|
|
1508
|
-
return refs.target === "openApi3" ? {
|
|
1509
|
-
enum: ["null"],
|
|
1510
|
-
nullable: true
|
|
1511
|
-
} : {
|
|
1512
|
-
type: "null"
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
1517
|
-
var primitiveMappings = {
|
|
1518
|
-
ZodString: "string",
|
|
1519
|
-
ZodNumber: "number",
|
|
1520
|
-
ZodBigInt: "integer",
|
|
1521
|
-
ZodBoolean: "boolean",
|
|
1522
|
-
ZodNull: "null"
|
|
1632
|
+
return void 0;
|
|
1523
1633
|
};
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
case "object":
|
|
1547
|
-
if (x._def.value === null)
|
|
1548
|
-
return [...acc, "null"];
|
|
1549
|
-
case "symbol":
|
|
1550
|
-
case "undefined":
|
|
1551
|
-
case "function":
|
|
1552
|
-
default:
|
|
1553
|
-
return acc;
|
|
1554
|
-
}
|
|
1555
|
-
}, []);
|
|
1556
|
-
if (types.length === options.length) {
|
|
1557
|
-
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
1558
|
-
return {
|
|
1559
|
-
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
1560
|
-
enum: options.reduce((acc, x) => {
|
|
1561
|
-
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
1562
|
-
}, [])
|
|
1563
|
-
};
|
|
1634
|
+
var simpleRulesByAnnotation = {};
|
|
1635
|
+
simpleRules.forEach((rule) => {
|
|
1636
|
+
simpleRulesByAnnotation[rule.annotation] = rule;
|
|
1637
|
+
});
|
|
1638
|
+
var untransformValue = (json, type, superJson) => {
|
|
1639
|
+
if (isArray(type)) {
|
|
1640
|
+
switch (type[0]) {
|
|
1641
|
+
case "symbol":
|
|
1642
|
+
return symbolRule.untransform(json, type, superJson);
|
|
1643
|
+
case "class":
|
|
1644
|
+
return classRule.untransform(json, type, superJson);
|
|
1645
|
+
case "custom":
|
|
1646
|
+
return customRule.untransform(json, type, superJson);
|
|
1647
|
+
case "typed-array":
|
|
1648
|
+
return typedArrayRule.untransform(json, type, superJson);
|
|
1649
|
+
default:
|
|
1650
|
+
throw new Error("Unknown transformation: " + type);
|
|
1651
|
+
}
|
|
1652
|
+
} else {
|
|
1653
|
+
const transformation = simpleRulesByAnnotation[type];
|
|
1654
|
+
if (!transformation) {
|
|
1655
|
+
throw new Error("Unknown transformation: " + type);
|
|
1564
1656
|
}
|
|
1565
|
-
|
|
1566
|
-
return {
|
|
1567
|
-
type: "string",
|
|
1568
|
-
enum: options.reduce((acc, x) => [
|
|
1569
|
-
...acc,
|
|
1570
|
-
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
1571
|
-
], [])
|
|
1572
|
-
};
|
|
1657
|
+
return transformation.untransform(json, superJson);
|
|
1573
1658
|
}
|
|
1574
|
-
return asAnyOf(def, refs);
|
|
1575
|
-
}
|
|
1576
|
-
var asAnyOf = (def, refs) => {
|
|
1577
|
-
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
|
|
1578
|
-
...refs,
|
|
1579
|
-
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
1580
|
-
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
1581
|
-
return anyOf.length ? { anyOf } : void 0;
|
|
1582
1659
|
};
|
|
1583
1660
|
|
|
1584
|
-
// ../../node_modules/.pnpm/
|
|
1585
|
-
|
|
1586
|
-
if (
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
}
|
|
1593
|
-
return {
|
|
1594
|
-
type: [
|
|
1595
|
-
primitiveMappings[def.innerType._def.typeName],
|
|
1596
|
-
"null"
|
|
1597
|
-
]
|
|
1598
|
-
};
|
|
1661
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
|
|
1662
|
+
var getNthKey = (value, n) => {
|
|
1663
|
+
if (n > value.size)
|
|
1664
|
+
throw new Error("index out of bounds");
|
|
1665
|
+
const keys = value.keys();
|
|
1666
|
+
while (n > 0) {
|
|
1667
|
+
keys.next();
|
|
1668
|
+
n--;
|
|
1599
1669
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
if (base2 && "$ref" in base2)
|
|
1606
|
-
return { allOf: [base2], nullable: true };
|
|
1607
|
-
return base2 && { ...base2, nullable: true };
|
|
1670
|
+
return keys.next().value;
|
|
1671
|
+
};
|
|
1672
|
+
function validatePath(path) {
|
|
1673
|
+
if (includes(path, "__proto__")) {
|
|
1674
|
+
throw new Error("__proto__ is not allowed as a property");
|
|
1608
1675
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
1617
|
-
function parseNumberDef(def, refs) {
|
|
1618
|
-
const res = {
|
|
1619
|
-
type: "number"
|
|
1620
|
-
};
|
|
1621
|
-
if (!def.checks)
|
|
1622
|
-
return res;
|
|
1623
|
-
for (const check of def.checks) {
|
|
1624
|
-
switch (check.kind) {
|
|
1625
|
-
case "int":
|
|
1626
|
-
res.type = "integer";
|
|
1627
|
-
addErrorMessage(res, "type", check.message, refs);
|
|
1628
|
-
break;
|
|
1629
|
-
case "min":
|
|
1630
|
-
if (refs.target === "jsonSchema7") {
|
|
1631
|
-
if (check.inclusive) {
|
|
1632
|
-
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1633
|
-
} else {
|
|
1634
|
-
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
1635
|
-
}
|
|
1636
|
-
} else {
|
|
1637
|
-
if (!check.inclusive) {
|
|
1638
|
-
res.exclusiveMinimum = true;
|
|
1639
|
-
}
|
|
1640
|
-
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1641
|
-
}
|
|
1642
|
-
break;
|
|
1643
|
-
case "max":
|
|
1644
|
-
if (refs.target === "jsonSchema7") {
|
|
1645
|
-
if (check.inclusive) {
|
|
1646
|
-
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1647
|
-
} else {
|
|
1648
|
-
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
1649
|
-
}
|
|
1650
|
-
} else {
|
|
1651
|
-
if (!check.inclusive) {
|
|
1652
|
-
res.exclusiveMaximum = true;
|
|
1653
|
-
}
|
|
1654
|
-
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1655
|
-
}
|
|
1656
|
-
break;
|
|
1657
|
-
case "multipleOf":
|
|
1658
|
-
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1659
|
-
break;
|
|
1660
|
-
}
|
|
1676
|
+
if (includes(path, "prototype")) {
|
|
1677
|
+
throw new Error("prototype is not allowed as a property");
|
|
1678
|
+
}
|
|
1679
|
+
if (includes(path, "constructor")) {
|
|
1680
|
+
throw new Error("constructor is not allowed as a property");
|
|
1661
1681
|
}
|
|
1662
|
-
return res;
|
|
1663
1682
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
if (propDef._def.typeName === "ZodOptional") {
|
|
1682
|
-
propDef = propDef._def.innerType;
|
|
1683
|
-
}
|
|
1684
|
-
if (!propDef.isNullable()) {
|
|
1685
|
-
propDef = propDef.nullable();
|
|
1683
|
+
var getDeep = (object, path) => {
|
|
1684
|
+
validatePath(path);
|
|
1685
|
+
for (let i = 0; i < path.length; i++) {
|
|
1686
|
+
const key = path[i];
|
|
1687
|
+
if (isSet(object)) {
|
|
1688
|
+
object = getNthKey(object, +key);
|
|
1689
|
+
} else if (isMap(object)) {
|
|
1690
|
+
const row = +key;
|
|
1691
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
1692
|
+
const keyOfRow = getNthKey(object, row);
|
|
1693
|
+
switch (type) {
|
|
1694
|
+
case "key":
|
|
1695
|
+
object = keyOfRow;
|
|
1696
|
+
break;
|
|
1697
|
+
case "value":
|
|
1698
|
+
object = object.get(keyOfRow);
|
|
1699
|
+
break;
|
|
1686
1700
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
const parsedDef = parseDef(propDef._def, {
|
|
1690
|
-
...refs,
|
|
1691
|
-
currentPath: [...refs.currentPath, "properties", propName],
|
|
1692
|
-
propertyPath: [...refs.currentPath, "properties", propName]
|
|
1693
|
-
});
|
|
1694
|
-
if (parsedDef === void 0) {
|
|
1695
|
-
continue;
|
|
1696
|
-
}
|
|
1697
|
-
result.properties[propName] = parsedDef;
|
|
1698
|
-
if (!propOptional) {
|
|
1699
|
-
required.push(propName);
|
|
1701
|
+
} else {
|
|
1702
|
+
object = object[key];
|
|
1700
1703
|
}
|
|
1701
1704
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
if (
|
|
1707
|
-
|
|
1705
|
+
return object;
|
|
1706
|
+
};
|
|
1707
|
+
var setDeep = (object, path, mapper) => {
|
|
1708
|
+
validatePath(path);
|
|
1709
|
+
if (path.length === 0) {
|
|
1710
|
+
return mapper(object);
|
|
1708
1711
|
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1712
|
+
let parent = object;
|
|
1713
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
1714
|
+
const key = path[i];
|
|
1715
|
+
if (isArray(parent)) {
|
|
1716
|
+
const index = +key;
|
|
1717
|
+
parent = parent[index];
|
|
1718
|
+
} else if (isPlainObject(parent)) {
|
|
1719
|
+
parent = parent[key];
|
|
1720
|
+
} else if (isSet(parent)) {
|
|
1721
|
+
const row = +key;
|
|
1722
|
+
parent = getNthKey(parent, row);
|
|
1723
|
+
} else if (isMap(parent)) {
|
|
1724
|
+
const isEnd = i === path.length - 2;
|
|
1725
|
+
if (isEnd) {
|
|
1726
|
+
break;
|
|
1727
|
+
}
|
|
1728
|
+
const row = +key;
|
|
1729
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
1730
|
+
const keyOfRow = getNthKey(parent, row);
|
|
1731
|
+
switch (type) {
|
|
1732
|
+
case "key":
|
|
1733
|
+
parent = keyOfRow;
|
|
1734
|
+
break;
|
|
1735
|
+
case "value":
|
|
1736
|
+
parent = parent.get(keyOfRow);
|
|
1737
|
+
break;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1717
1740
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
case "strip":
|
|
1724
|
-
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
1741
|
+
const lastKey = path[path.length - 1];
|
|
1742
|
+
if (isArray(parent)) {
|
|
1743
|
+
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
1744
|
+
} else if (isPlainObject(parent)) {
|
|
1745
|
+
parent[lastKey] = mapper(parent[lastKey]);
|
|
1725
1746
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1747
|
+
if (isSet(parent)) {
|
|
1748
|
+
const oldValue = getNthKey(parent, +lastKey);
|
|
1749
|
+
const newValue = mapper(oldValue);
|
|
1750
|
+
if (oldValue !== newValue) {
|
|
1751
|
+
parent.delete(oldValue);
|
|
1752
|
+
parent.add(newValue);
|
|
1753
|
+
}
|
|
1732
1754
|
}
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1755
|
+
if (isMap(parent)) {
|
|
1756
|
+
const row = +path[path.length - 2];
|
|
1757
|
+
const keyToRow = getNthKey(parent, row);
|
|
1758
|
+
const type = +lastKey === 0 ? "key" : "value";
|
|
1759
|
+
switch (type) {
|
|
1760
|
+
case "key": {
|
|
1761
|
+
const newKey = mapper(keyToRow);
|
|
1762
|
+
parent.set(newKey, parent.get(keyToRow));
|
|
1763
|
+
if (newKey !== keyToRow) {
|
|
1764
|
+
parent.delete(keyToRow);
|
|
1765
|
+
}
|
|
1766
|
+
break;
|
|
1767
|
+
}
|
|
1768
|
+
case "value": {
|
|
1769
|
+
parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
1770
|
+
break;
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1739
1773
|
}
|
|
1740
|
-
|
|
1741
|
-
...refs,
|
|
1742
|
-
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
1743
|
-
});
|
|
1744
|
-
return innerSchema ? {
|
|
1745
|
-
anyOf: [
|
|
1746
|
-
{
|
|
1747
|
-
not: parseAnyDef(refs)
|
|
1748
|
-
},
|
|
1749
|
-
innerSchema
|
|
1750
|
-
]
|
|
1751
|
-
} : parseAnyDef(refs);
|
|
1774
|
+
return object;
|
|
1752
1775
|
};
|
|
1753
1776
|
|
|
1754
|
-
// ../../node_modules/.pnpm/
|
|
1755
|
-
|
|
1756
|
-
if (
|
|
1757
|
-
return
|
|
1758
|
-
} else if (refs.pipeStrategy === "output") {
|
|
1759
|
-
return parseDef(def.out._def, refs);
|
|
1777
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.js
|
|
1778
|
+
function traverse(tree, walker2, origin = []) {
|
|
1779
|
+
if (!tree) {
|
|
1780
|
+
return;
|
|
1760
1781
|
}
|
|
1761
|
-
|
|
1762
|
-
...
|
|
1763
|
-
|
|
1764
|
-
}
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
};
|
|
1773
|
-
|
|
1774
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1775
|
-
function parsePromiseDef(def, refs) {
|
|
1776
|
-
return parseDef(def.type._def, refs);
|
|
1782
|
+
if (!isArray(tree)) {
|
|
1783
|
+
forEach(tree, (subtree, key) => traverse(subtree, walker2, [...origin, ...parsePath(key)]));
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
const [nodeValue, children] = tree;
|
|
1787
|
+
if (children) {
|
|
1788
|
+
forEach(children, (child, key) => {
|
|
1789
|
+
traverse(child, walker2, [...origin, ...parsePath(key)]);
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
walker2(nodeValue, origin);
|
|
1777
1793
|
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
const items = parseDef(def.valueType._def, {
|
|
1782
|
-
...refs,
|
|
1783
|
-
currentPath: [...refs.currentPath, "items"]
|
|
1794
|
+
function applyValueAnnotations(plain, annotations, superJson) {
|
|
1795
|
+
traverse(annotations, (type, path) => {
|
|
1796
|
+
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
1784
1797
|
});
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1798
|
+
return plain;
|
|
1799
|
+
}
|
|
1800
|
+
function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
1801
|
+
function apply(identicalPaths, path) {
|
|
1802
|
+
const object = getDeep(plain, parsePath(path));
|
|
1803
|
+
identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
|
|
1804
|
+
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
1805
|
+
});
|
|
1792
1806
|
}
|
|
1793
|
-
if (
|
|
1794
|
-
|
|
1807
|
+
if (isArray(annotations)) {
|
|
1808
|
+
const [root, other] = annotations;
|
|
1809
|
+
root.forEach((identicalPath) => {
|
|
1810
|
+
plain = setDeep(plain, parsePath(identicalPath), () => plain);
|
|
1811
|
+
});
|
|
1812
|
+
if (other) {
|
|
1813
|
+
forEach(other, apply);
|
|
1814
|
+
}
|
|
1815
|
+
} else {
|
|
1816
|
+
forEach(annotations, apply);
|
|
1795
1817
|
}
|
|
1796
|
-
return
|
|
1818
|
+
return plain;
|
|
1797
1819
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
if (
|
|
1802
|
-
|
|
1803
|
-
type: "array",
|
|
1804
|
-
minItems: def.items.length,
|
|
1805
|
-
items: def.items.map((x, i) => parseDef(x._def, {
|
|
1806
|
-
...refs,
|
|
1807
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1808
|
-
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
1809
|
-
additionalItems: parseDef(def.rest._def, {
|
|
1810
|
-
...refs,
|
|
1811
|
-
currentPath: [...refs.currentPath, "additionalItems"]
|
|
1812
|
-
})
|
|
1813
|
-
};
|
|
1820
|
+
var isDeep = (object, superJson) => isPlainObject(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson);
|
|
1821
|
+
function addIdentity(object, path, identities) {
|
|
1822
|
+
const existingSet = identities.get(object);
|
|
1823
|
+
if (existingSet) {
|
|
1824
|
+
existingSet.push(path);
|
|
1814
1825
|
} else {
|
|
1815
|
-
|
|
1816
|
-
type: "array",
|
|
1817
|
-
minItems: def.items.length,
|
|
1818
|
-
maxItems: def.items.length,
|
|
1819
|
-
items: def.items.map((x, i) => parseDef(x._def, {
|
|
1820
|
-
...refs,
|
|
1821
|
-
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1822
|
-
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
1823
|
-
};
|
|
1826
|
+
identities.set(object, [path]);
|
|
1824
1827
|
}
|
|
1825
1828
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
};
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
case zod.ZodFirstPartyTypeKind.ZodObject:
|
|
1852
|
-
return parseObjectDef(def, refs);
|
|
1853
|
-
case zod.ZodFirstPartyTypeKind.ZodBigInt:
|
|
1854
|
-
return parseBigintDef(def, refs);
|
|
1855
|
-
case zod.ZodFirstPartyTypeKind.ZodBoolean:
|
|
1856
|
-
return parseBooleanDef();
|
|
1857
|
-
case zod.ZodFirstPartyTypeKind.ZodDate:
|
|
1858
|
-
return parseDateDef(def, refs);
|
|
1859
|
-
case zod.ZodFirstPartyTypeKind.ZodUndefined:
|
|
1860
|
-
return parseUndefinedDef(refs);
|
|
1861
|
-
case zod.ZodFirstPartyTypeKind.ZodNull:
|
|
1862
|
-
return parseNullDef(refs);
|
|
1863
|
-
case zod.ZodFirstPartyTypeKind.ZodArray:
|
|
1864
|
-
return parseArrayDef(def, refs);
|
|
1865
|
-
case zod.ZodFirstPartyTypeKind.ZodUnion:
|
|
1866
|
-
case zod.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
1867
|
-
return parseUnionDef(def, refs);
|
|
1868
|
-
case zod.ZodFirstPartyTypeKind.ZodIntersection:
|
|
1869
|
-
return parseIntersectionDef(def, refs);
|
|
1870
|
-
case zod.ZodFirstPartyTypeKind.ZodTuple:
|
|
1871
|
-
return parseTupleDef(def, refs);
|
|
1872
|
-
case zod.ZodFirstPartyTypeKind.ZodRecord:
|
|
1873
|
-
return parseRecordDef(def, refs);
|
|
1874
|
-
case zod.ZodFirstPartyTypeKind.ZodLiteral:
|
|
1875
|
-
return parseLiteralDef(def, refs);
|
|
1876
|
-
case zod.ZodFirstPartyTypeKind.ZodEnum:
|
|
1877
|
-
return parseEnumDef(def);
|
|
1878
|
-
case zod.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
1879
|
-
return parseNativeEnumDef(def);
|
|
1880
|
-
case zod.ZodFirstPartyTypeKind.ZodNullable:
|
|
1881
|
-
return parseNullableDef(def, refs);
|
|
1882
|
-
case zod.ZodFirstPartyTypeKind.ZodOptional:
|
|
1883
|
-
return parseOptionalDef(def, refs);
|
|
1884
|
-
case zod.ZodFirstPartyTypeKind.ZodMap:
|
|
1885
|
-
return parseMapDef(def, refs);
|
|
1886
|
-
case zod.ZodFirstPartyTypeKind.ZodSet:
|
|
1887
|
-
return parseSetDef(def, refs);
|
|
1888
|
-
case zod.ZodFirstPartyTypeKind.ZodLazy:
|
|
1889
|
-
return () => def.getter()._def;
|
|
1890
|
-
case zod.ZodFirstPartyTypeKind.ZodPromise:
|
|
1891
|
-
return parsePromiseDef(def, refs);
|
|
1892
|
-
case zod.ZodFirstPartyTypeKind.ZodNaN:
|
|
1893
|
-
case zod.ZodFirstPartyTypeKind.ZodNever:
|
|
1894
|
-
return parseNeverDef(refs);
|
|
1895
|
-
case zod.ZodFirstPartyTypeKind.ZodEffects:
|
|
1896
|
-
return parseEffectsDef(def, refs);
|
|
1897
|
-
case zod.ZodFirstPartyTypeKind.ZodAny:
|
|
1898
|
-
return parseAnyDef(refs);
|
|
1899
|
-
case zod.ZodFirstPartyTypeKind.ZodUnknown:
|
|
1900
|
-
return parseUnknownDef(refs);
|
|
1901
|
-
case zod.ZodFirstPartyTypeKind.ZodDefault:
|
|
1902
|
-
return parseDefaultDef(def, refs);
|
|
1903
|
-
case zod.ZodFirstPartyTypeKind.ZodBranded:
|
|
1904
|
-
return parseBrandedDef(def, refs);
|
|
1905
|
-
case zod.ZodFirstPartyTypeKind.ZodReadonly:
|
|
1906
|
-
return parseReadonlyDef(def, refs);
|
|
1907
|
-
case zod.ZodFirstPartyTypeKind.ZodCatch:
|
|
1908
|
-
return parseCatchDef(def, refs);
|
|
1909
|
-
case zod.ZodFirstPartyTypeKind.ZodPipeline:
|
|
1910
|
-
return parsePipelineDef(def, refs);
|
|
1911
|
-
case zod.ZodFirstPartyTypeKind.ZodFunction:
|
|
1912
|
-
case zod.ZodFirstPartyTypeKind.ZodVoid:
|
|
1913
|
-
case zod.ZodFirstPartyTypeKind.ZodSymbol:
|
|
1914
|
-
return void 0;
|
|
1915
|
-
default:
|
|
1916
|
-
return /* @__PURE__ */ ((_) => void 0)();
|
|
1829
|
+
function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
1830
|
+
const result = {};
|
|
1831
|
+
let rootEqualityPaths = void 0;
|
|
1832
|
+
identitites.forEach((paths) => {
|
|
1833
|
+
if (paths.length <= 1) {
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1836
|
+
if (!dedupe) {
|
|
1837
|
+
paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
1838
|
+
}
|
|
1839
|
+
const [representativePath, ...identicalPaths] = paths;
|
|
1840
|
+
if (representativePath.length === 0) {
|
|
1841
|
+
rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
1842
|
+
} else {
|
|
1843
|
+
result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
if (rootEqualityPaths) {
|
|
1847
|
+
if (isEmptyObject(result)) {
|
|
1848
|
+
return [rootEqualityPaths];
|
|
1849
|
+
} else {
|
|
1850
|
+
return [rootEqualityPaths, result];
|
|
1851
|
+
}
|
|
1852
|
+
} else {
|
|
1853
|
+
return isEmptyObject(result) ? void 0 : result;
|
|
1917
1854
|
}
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1855
|
+
}
|
|
1856
|
+
var walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
|
|
1857
|
+
const primitive = isPrimitive(object);
|
|
1858
|
+
if (!primitive) {
|
|
1859
|
+
addIdentity(object, path, identities);
|
|
1860
|
+
const seen = seenObjects.get(object);
|
|
1861
|
+
if (seen) {
|
|
1862
|
+
return dedupe ? {
|
|
1863
|
+
transformedValue: null
|
|
1864
|
+
} : seen;
|
|
1927
1865
|
}
|
|
1928
1866
|
}
|
|
1929
|
-
if (
|
|
1930
|
-
const
|
|
1931
|
-
|
|
1932
|
-
|
|
1867
|
+
if (!isDeep(object, superJson)) {
|
|
1868
|
+
const transformed2 = transformValue(object, superJson);
|
|
1869
|
+
const result2 = transformed2 ? {
|
|
1870
|
+
transformedValue: transformed2.value,
|
|
1871
|
+
annotations: [transformed2.type]
|
|
1872
|
+
} : {
|
|
1873
|
+
transformedValue: object
|
|
1874
|
+
};
|
|
1875
|
+
if (!primitive) {
|
|
1876
|
+
seenObjects.set(object, result2);
|
|
1933
1877
|
}
|
|
1878
|
+
return result2;
|
|
1934
1879
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
if (jsonSchema) {
|
|
1940
|
-
addMeta(def, refs, jsonSchema);
|
|
1941
|
-
}
|
|
1942
|
-
if (refs.postProcess) {
|
|
1943
|
-
const postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
1944
|
-
newItem.jsonSchema = jsonSchema;
|
|
1945
|
-
return postProcessResult;
|
|
1880
|
+
if (includes(objectsInThisPath, object)) {
|
|
1881
|
+
return {
|
|
1882
|
+
transformedValue: null
|
|
1883
|
+
};
|
|
1946
1884
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
case "relative":
|
|
1955
|
-
return { $ref: getRelativePath(refs.currentPath, item.path) };
|
|
1956
|
-
case "none":
|
|
1957
|
-
case "seen": {
|
|
1958
|
-
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
1959
|
-
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
1960
|
-
return parseAnyDef(refs);
|
|
1961
|
-
}
|
|
1962
|
-
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : void 0;
|
|
1885
|
+
const transformationResult = transformValue(object, superJson);
|
|
1886
|
+
const transformed = transformationResult?.value ?? object;
|
|
1887
|
+
const transformedValue = isArray(transformed) ? [] : {};
|
|
1888
|
+
const innerAnnotations = {};
|
|
1889
|
+
forEach(transformed, (value, index) => {
|
|
1890
|
+
if (index === "__proto__" || index === "constructor" || index === "prototype") {
|
|
1891
|
+
throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
|
|
1963
1892
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1893
|
+
const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
|
|
1894
|
+
transformedValue[index] = recursiveResult.transformedValue;
|
|
1895
|
+
if (isArray(recursiveResult.annotations)) {
|
|
1896
|
+
innerAnnotations[index] = recursiveResult.annotations;
|
|
1897
|
+
} else if (isPlainObject(recursiveResult.annotations)) {
|
|
1898
|
+
forEach(recursiveResult.annotations, (tree, key) => {
|
|
1899
|
+
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
1900
|
+
});
|
|
1971
1901
|
}
|
|
1902
|
+
});
|
|
1903
|
+
const result = isEmptyObject(innerAnnotations) ? {
|
|
1904
|
+
transformedValue,
|
|
1905
|
+
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
1906
|
+
} : {
|
|
1907
|
+
transformedValue,
|
|
1908
|
+
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
1909
|
+
};
|
|
1910
|
+
if (!primitive) {
|
|
1911
|
+
seenObjects.set(object, result);
|
|
1972
1912
|
}
|
|
1973
|
-
return
|
|
1913
|
+
return result;
|
|
1974
1914
|
};
|
|
1975
1915
|
|
|
1976
|
-
// ../../node_modules/.pnpm/
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1916
|
+
// ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
1917
|
+
function getType2(payload) {
|
|
1918
|
+
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
1919
|
+
}
|
|
1920
|
+
function isArray2(payload) {
|
|
1921
|
+
return getType2(payload) === "Array";
|
|
1922
|
+
}
|
|
1923
|
+
function isPlainObject2(payload) {
|
|
1924
|
+
if (getType2(payload) !== "Object")
|
|
1925
|
+
return false;
|
|
1926
|
+
const prototype = Object.getPrototypeOf(payload);
|
|
1927
|
+
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
1931
|
+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
1932
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
1933
|
+
if (propType === "enumerable")
|
|
1934
|
+
carry[key] = newVal;
|
|
1935
|
+
if (includeNonenumerable && propType === "nonenumerable") {
|
|
1936
|
+
Object.defineProperty(carry, key, {
|
|
1937
|
+
value: newVal,
|
|
1938
|
+
enumerable: false,
|
|
1939
|
+
writable: true,
|
|
1940
|
+
configurable: true
|
|
1941
|
+
});
|
|
1994
1942
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1943
|
+
}
|
|
1944
|
+
function copy(target, options = {}) {
|
|
1945
|
+
if (isArray2(target)) {
|
|
1946
|
+
return target.map((item) => copy(item, options));
|
|
1947
|
+
}
|
|
1948
|
+
if (!isPlainObject2(target)) {
|
|
1949
|
+
return target;
|
|
1950
|
+
}
|
|
1951
|
+
const props = Object.getOwnPropertyNames(target);
|
|
1952
|
+
const symbols = Object.getOwnPropertySymbols(target);
|
|
1953
|
+
return [...props, ...symbols].reduce((carry, key) => {
|
|
1954
|
+
if (isArray2(options.props) && !options.props.includes(key)) {
|
|
1955
|
+
return carry;
|
|
1998
1956
|
}
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
1957
|
+
const val = target[key];
|
|
1958
|
+
const newVal = copy(val, options);
|
|
1959
|
+
assignProp(carry, key, newVal, target, options.nonenumerable);
|
|
1960
|
+
return carry;
|
|
1961
|
+
}, {});
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
|
|
1965
|
+
var SuperJSON = class {
|
|
1966
|
+
/**
|
|
1967
|
+
* @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
|
|
1968
|
+
*/
|
|
1969
|
+
constructor({ dedupe = false } = {}) {
|
|
1970
|
+
this.classRegistry = new ClassRegistry();
|
|
1971
|
+
this.symbolRegistry = new Registry((s) => s.description ?? "");
|
|
1972
|
+
this.customTransformerRegistry = new CustomTransformerRegistry();
|
|
1973
|
+
this.allowedErrorProps = [];
|
|
1974
|
+
this.dedupe = dedupe;
|
|
1975
|
+
}
|
|
1976
|
+
serialize(object) {
|
|
1977
|
+
const identities = /* @__PURE__ */ new Map();
|
|
1978
|
+
const output = walker(object, identities, this, this.dedupe);
|
|
1979
|
+
const res = {
|
|
1980
|
+
json: output.transformedValue
|
|
1981
|
+
};
|
|
1982
|
+
if (output.annotations) {
|
|
1983
|
+
res.meta = {
|
|
1984
|
+
...res.meta,
|
|
1985
|
+
values: output.annotations
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
1989
|
+
if (equalityAnnotations) {
|
|
1990
|
+
res.meta = {
|
|
1991
|
+
...res.meta,
|
|
1992
|
+
referentialEqualities: equalityAnnotations
|
|
2010
1993
|
};
|
|
2011
1994
|
}
|
|
1995
|
+
return res;
|
|
2012
1996
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
2019
|
-
refs.definitionPath,
|
|
2020
|
-
name
|
|
2021
|
-
].join("/"),
|
|
2022
|
-
[refs.definitionPath]: {
|
|
2023
|
-
...definitions,
|
|
2024
|
-
[name]: main
|
|
1997
|
+
deserialize(payload) {
|
|
1998
|
+
const { json, meta } = payload;
|
|
1999
|
+
let result = copy(json);
|
|
2000
|
+
if (meta?.values) {
|
|
2001
|
+
result = applyValueAnnotations(result, meta.values, this);
|
|
2025
2002
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
2003
|
+
if (meta?.referentialEqualities) {
|
|
2004
|
+
result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
|
|
2005
|
+
}
|
|
2006
|
+
return result;
|
|
2031
2007
|
}
|
|
2032
|
-
|
|
2033
|
-
|
|
2008
|
+
stringify(object) {
|
|
2009
|
+
return JSON.stringify(this.serialize(object));
|
|
2010
|
+
}
|
|
2011
|
+
parse(string) {
|
|
2012
|
+
return this.deserialize(JSON.parse(string));
|
|
2013
|
+
}
|
|
2014
|
+
registerClass(v, options) {
|
|
2015
|
+
this.classRegistry.register(v, options);
|
|
2016
|
+
}
|
|
2017
|
+
registerSymbol(v, identifier) {
|
|
2018
|
+
this.symbolRegistry.register(v, identifier);
|
|
2019
|
+
}
|
|
2020
|
+
registerCustom(transformer, name) {
|
|
2021
|
+
this.customTransformerRegistry.register({
|
|
2022
|
+
name,
|
|
2023
|
+
...transformer
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
allowErrorProps(...props) {
|
|
2027
|
+
this.allowedErrorProps.push(...props);
|
|
2034
2028
|
}
|
|
2035
|
-
return combined;
|
|
2036
2029
|
};
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2030
|
+
SuperJSON.defaultInstance = new SuperJSON();
|
|
2031
|
+
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
2032
|
+
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
2033
|
+
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
2034
|
+
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
2035
|
+
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
2036
|
+
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
2037
|
+
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
2038
|
+
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
2039
|
+
var stringify = SuperJSON.stringify;
|
|
2040
2040
|
|
|
2041
2041
|
exports.esm_default = esm_default;
|
|
2042
2042
|
exports.stringify = stringify;
|
|
2043
|
-
//# sourceMappingURL=chunk-
|
|
2044
|
-
//# sourceMappingURL=chunk-
|
|
2043
|
+
//# sourceMappingURL=chunk-LCODOYFR.cjs.map
|
|
2044
|
+
//# sourceMappingURL=chunk-LCODOYFR.cjs.map
|