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