@mastra/server 2.0.3 → 2.0.4-alpha.0
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/_tsup-dts-rollup.d.cts +152 -10
- package/dist/_tsup-dts-rollup.d.ts +152 -10
- package/dist/{chunk-2FJURXCL.cjs → chunk-24EGIVT7.cjs} +34 -33
- package/dist/{chunk-3XTEV33Q.js → chunk-2KIW6AJK.js} +4 -3
- package/dist/{chunk-6Q7UXAYJ.cjs → chunk-3HQNCTZ2.cjs} +21 -20
- package/dist/{chunk-M56ECCHK.cjs → chunk-4YZ3U35L.cjs} +18 -17
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/chunk-5SN4U5AC.cjs +508 -0
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
- package/dist/{chunk-3EJZQ6TQ.js → chunk-HWZVAG3H.js} +3 -3
- package/dist/{chunk-4JINXASC.js → chunk-IU5VO2I2.js} +3 -2
- package/dist/chunk-LIVAK2DM.js +2001 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/{chunk-AMVOS7YB.cjs → chunk-MHKNLNAN.cjs} +9 -8
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/{chunk-SKBVVI24.cjs → chunk-OGCNNUHF.cjs} +9 -9
- package/dist/{chunk-M2RXDCPV.cjs → chunk-OHKAN72U.cjs} +76 -57
- package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
- package/dist/chunk-P6SCPDYW.js +500 -0
- package/dist/{chunk-GVBJ5I2S.js → chunk-Q6KMBIAN.js} +5 -4
- package/dist/{chunk-CHFORQ7J.cjs → chunk-RYUN5DF4.cjs} +45 -44
- package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
- package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
- package/dist/{chunk-OWNA6I2H.js → chunk-WVDUW4GI.js} +28 -9
- package/dist/{chunk-RBQASTUP.js → chunk-X3ZDCS52.js} +4 -3
- package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
- package/dist/chunk-YWLUOY3D.cjs +2004 -0
- package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextWorkflows.cjs +11 -11
- package/dist/server/handlers/vNextWorkflows.js +1 -1
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +4 -4
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +11 -11
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +28 -23
- package/dist/server/handlers.d.cts +1 -0
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.js +11 -10
- package/package.json +6 -4
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-OMN3UI6X.js +0 -5576
|
@@ -0,0 +1,2001 @@
|
|
|
1
|
+
import { ZodFirstPartyTypeKind, ZodOptional } from 'zod';
|
|
2
|
+
|
|
3
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
|
|
4
|
+
var DoubleIndexedKV = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.keyToValue = /* @__PURE__ */ new Map();
|
|
7
|
+
this.valueToKey = /* @__PURE__ */ new Map();
|
|
8
|
+
}
|
|
9
|
+
set(key, value) {
|
|
10
|
+
this.keyToValue.set(key, value);
|
|
11
|
+
this.valueToKey.set(value, key);
|
|
12
|
+
}
|
|
13
|
+
getByKey(key) {
|
|
14
|
+
return this.keyToValue.get(key);
|
|
15
|
+
}
|
|
16
|
+
getByValue(value) {
|
|
17
|
+
return this.valueToKey.get(value);
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.keyToValue.clear();
|
|
21
|
+
this.valueToKey.clear();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.js
|
|
26
|
+
var Registry = class {
|
|
27
|
+
constructor(generateIdentifier) {
|
|
28
|
+
this.generateIdentifier = generateIdentifier;
|
|
29
|
+
this.kv = new DoubleIndexedKV();
|
|
30
|
+
}
|
|
31
|
+
register(value, identifier) {
|
|
32
|
+
if (this.kv.getByValue(value)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!identifier) {
|
|
36
|
+
identifier = this.generateIdentifier(value);
|
|
37
|
+
}
|
|
38
|
+
this.kv.set(identifier, value);
|
|
39
|
+
}
|
|
40
|
+
clear() {
|
|
41
|
+
this.kv.clear();
|
|
42
|
+
}
|
|
43
|
+
getIdentifier(value) {
|
|
44
|
+
return this.kv.getByValue(value);
|
|
45
|
+
}
|
|
46
|
+
getValue(identifier) {
|
|
47
|
+
return this.kv.getByKey(identifier);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.js
|
|
52
|
+
var ClassRegistry = class extends Registry {
|
|
53
|
+
constructor() {
|
|
54
|
+
super((c) => c.name);
|
|
55
|
+
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
56
|
+
}
|
|
57
|
+
register(value, options) {
|
|
58
|
+
if (typeof options === "object") {
|
|
59
|
+
if (options.allowProps) {
|
|
60
|
+
this.classToAllowedProps.set(value, options.allowProps);
|
|
61
|
+
}
|
|
62
|
+
super.register(value, options.identifier);
|
|
63
|
+
} else {
|
|
64
|
+
super.register(value, options);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
getAllowedProps(value) {
|
|
68
|
+
return this.classToAllowedProps.get(value);
|
|
69
|
+
}
|
|
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);
|
|
76
|
+
}
|
|
77
|
+
const values = [];
|
|
78
|
+
for (const key in record) {
|
|
79
|
+
if (record.hasOwnProperty(key)) {
|
|
80
|
+
values.push(record[key]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return values;
|
|
84
|
+
}
|
|
85
|
+
function find(record, predicate) {
|
|
86
|
+
const values = valuesOfObj(record);
|
|
87
|
+
if ("find" in values) {
|
|
88
|
+
return values.find(predicate);
|
|
89
|
+
}
|
|
90
|
+
const valuesNotNever = values;
|
|
91
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
92
|
+
const value = valuesNotNever[i];
|
|
93
|
+
if (predicate(value)) {
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
function forEach(record, run) {
|
|
100
|
+
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
101
|
+
}
|
|
102
|
+
function includes(arr, value) {
|
|
103
|
+
return arr.indexOf(value) !== -1;
|
|
104
|
+
}
|
|
105
|
+
function findArr(record, predicate) {
|
|
106
|
+
for (let i = 0; i < record.length; i++) {
|
|
107
|
+
const value = record[i];
|
|
108
|
+
if (predicate(value)) {
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return void 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.js
|
|
116
|
+
var CustomTransformerRegistry = class {
|
|
117
|
+
constructor() {
|
|
118
|
+
this.transfomers = {};
|
|
119
|
+
}
|
|
120
|
+
register(transformer) {
|
|
121
|
+
this.transfomers[transformer.name] = transformer;
|
|
122
|
+
}
|
|
123
|
+
findApplicable(v) {
|
|
124
|
+
return find(this.transfomers, (transformer) => transformer.isApplicable(v));
|
|
125
|
+
}
|
|
126
|
+
findByName(name) {
|
|
127
|
+
return this.transfomers[name];
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
|
|
132
|
+
var getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
|
|
133
|
+
var isUndefined = (payload) => typeof payload === "undefined";
|
|
134
|
+
var isNull = (payload) => payload === null;
|
|
135
|
+
var isPlainObject = (payload) => {
|
|
136
|
+
if (typeof payload !== "object" || payload === null)
|
|
137
|
+
return false;
|
|
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;
|
|
161
|
+
|
|
162
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
|
|
163
|
+
var escapeKey = (key) => key.replace(/\./g, "\\.");
|
|
164
|
+
var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
|
|
165
|
+
var parsePath = (string) => {
|
|
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
|
+
};
|
|
188
|
+
|
|
189
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.js
|
|
190
|
+
function simpleTransformation(isApplicable, annotation, transform, untransform) {
|
|
191
|
+
return {
|
|
192
|
+
isApplicable,
|
|
193
|
+
annotation,
|
|
194
|
+
transform,
|
|
195
|
+
untransform
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
var simpleRules = [
|
|
199
|
+
simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
|
|
200
|
+
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
201
|
+
if (typeof BigInt !== "undefined") {
|
|
202
|
+
return BigInt(v);
|
|
203
|
+
}
|
|
204
|
+
console.error("Please add a BigInt polyfill.");
|
|
205
|
+
return v;
|
|
206
|
+
}),
|
|
207
|
+
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
208
|
+
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
209
|
+
const baseError = {
|
|
210
|
+
name: v.name,
|
|
211
|
+
message: v.message
|
|
212
|
+
};
|
|
213
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
214
|
+
baseError[prop] = v[prop];
|
|
215
|
+
});
|
|
216
|
+
return baseError;
|
|
217
|
+
}, (v, superJson) => {
|
|
218
|
+
const e = new Error(v.message);
|
|
219
|
+
e.name = v.name;
|
|
220
|
+
e.stack = v.stack;
|
|
221
|
+
superJson.allowedErrorProps.forEach((prop) => {
|
|
222
|
+
e[prop] = v[prop];
|
|
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";
|
|
246
|
+
} else {
|
|
247
|
+
return "-Infinity";
|
|
248
|
+
}
|
|
249
|
+
}, Number),
|
|
250
|
+
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
251
|
+
return "-0";
|
|
252
|
+
}, Number),
|
|
253
|
+
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
254
|
+
];
|
|
255
|
+
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
256
|
+
return {
|
|
257
|
+
isApplicable,
|
|
258
|
+
annotation,
|
|
259
|
+
transform,
|
|
260
|
+
untransform
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
var symbolRule = compositeTransformation((s, superJson) => {
|
|
264
|
+
if (isSymbol(s)) {
|
|
265
|
+
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
266
|
+
return isRegistered;
|
|
267
|
+
}
|
|
268
|
+
return false;
|
|
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) {
|
|
353
|
+
return {
|
|
354
|
+
value: applicableSimpleRule.transform(value, superJson),
|
|
355
|
+
type: applicableSimpleRule.annotation
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return void 0;
|
|
359
|
+
};
|
|
360
|
+
var simpleRulesByAnnotation = {};
|
|
361
|
+
simpleRules.forEach((rule) => {
|
|
362
|
+
simpleRulesByAnnotation[rule.annotation] = rule;
|
|
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
|
+
};
|
|
386
|
+
|
|
387
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
|
|
388
|
+
var getNthKey = (value, n) => {
|
|
389
|
+
if (n > value.size)
|
|
390
|
+
throw new Error("index out of bounds");
|
|
391
|
+
const keys = value.keys();
|
|
392
|
+
while (n > 0) {
|
|
393
|
+
keys.next();
|
|
394
|
+
n--;
|
|
395
|
+
}
|
|
396
|
+
return keys.next().value;
|
|
397
|
+
};
|
|
398
|
+
function validatePath(path) {
|
|
399
|
+
if (includes(path, "__proto__")) {
|
|
400
|
+
throw new Error("__proto__ is not allowed as a property");
|
|
401
|
+
}
|
|
402
|
+
if (includes(path, "prototype")) {
|
|
403
|
+
throw new Error("prototype is not allowed as a property");
|
|
404
|
+
}
|
|
405
|
+
if (includes(path, "constructor")) {
|
|
406
|
+
throw new Error("constructor is not allowed as a property");
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
var getDeep = (object, path) => {
|
|
410
|
+
validatePath(path);
|
|
411
|
+
for (let i = 0; i < path.length; i++) {
|
|
412
|
+
const key = path[i];
|
|
413
|
+
if (isSet(object)) {
|
|
414
|
+
object = getNthKey(object, +key);
|
|
415
|
+
} else if (isMap(object)) {
|
|
416
|
+
const row = +key;
|
|
417
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
418
|
+
const keyOfRow = getNthKey(object, row);
|
|
419
|
+
switch (type) {
|
|
420
|
+
case "key":
|
|
421
|
+
object = keyOfRow;
|
|
422
|
+
break;
|
|
423
|
+
case "value":
|
|
424
|
+
object = object.get(keyOfRow);
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
} else {
|
|
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;
|
|
460
|
+
break;
|
|
461
|
+
case "value":
|
|
462
|
+
parent = parent.get(keyOfRow);
|
|
463
|
+
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
|
+
}
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
case "value": {
|
|
495
|
+
parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return object;
|
|
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
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
556
|
+
const result = {};
|
|
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
|
+
}
|
|
581
|
+
}
|
|
582
|
+
var walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
|
|
583
|
+
const primitive = isPrimitive(object);
|
|
584
|
+
if (!primitive) {
|
|
585
|
+
addIdentity(object, path, identities);
|
|
586
|
+
const seen = seenObjects.get(object);
|
|
587
|
+
if (seen) {
|
|
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
|
+
});
|
|
627
|
+
}
|
|
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);
|
|
638
|
+
}
|
|
639
|
+
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
|
+
}
|
|
649
|
+
function isPlainObject2(payload) {
|
|
650
|
+
if (getType2(payload) !== "Object")
|
|
651
|
+
return false;
|
|
652
|
+
const prototype = Object.getPrototypeOf(payload);
|
|
653
|
+
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
657
|
+
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
658
|
+
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
659
|
+
if (propType === "enumerable")
|
|
660
|
+
carry[key] = newVal;
|
|
661
|
+
if (includeNonenumerable && propType === "nonenumerable") {
|
|
662
|
+
Object.defineProperty(carry, key, {
|
|
663
|
+
value: newVal,
|
|
664
|
+
enumerable: false,
|
|
665
|
+
writable: true,
|
|
666
|
+
configurable: true
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
function copy(target, options = {}) {
|
|
671
|
+
if (isArray2(target)) {
|
|
672
|
+
return target.map((item) => copy(item, options));
|
|
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;
|
|
682
|
+
}
|
|
683
|
+
const val = target[key];
|
|
684
|
+
const newVal = copy(val, options);
|
|
685
|
+
assignProp(carry, key, newVal, target, options.nonenumerable);
|
|
686
|
+
return carry;
|
|
687
|
+
}, {});
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.js
|
|
691
|
+
var SuperJSON = class {
|
|
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;
|
|
701
|
+
}
|
|
702
|
+
serialize(object) {
|
|
703
|
+
const identities = /* @__PURE__ */ new Map();
|
|
704
|
+
const output = walker(object, identities, this, this.dedupe);
|
|
705
|
+
const res = {
|
|
706
|
+
json: output.transformedValue
|
|
707
|
+
};
|
|
708
|
+
if (output.annotations) {
|
|
709
|
+
res.meta = {
|
|
710
|
+
...res.meta,
|
|
711
|
+
values: output.annotations
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
715
|
+
if (equalityAnnotations) {
|
|
716
|
+
res.meta = {
|
|
717
|
+
...res.meta,
|
|
718
|
+
referentialEqualities: equalityAnnotations
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
return res;
|
|
722
|
+
}
|
|
723
|
+
deserialize(payload) {
|
|
724
|
+
const { json, meta } = payload;
|
|
725
|
+
let result = copy(json);
|
|
726
|
+
if (meta?.values) {
|
|
727
|
+
result = applyValueAnnotations(result, meta.values, this);
|
|
728
|
+
}
|
|
729
|
+
if (meta?.referentialEqualities) {
|
|
730
|
+
result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
|
|
731
|
+
}
|
|
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
|
+
}
|
|
740
|
+
registerClass(v, options) {
|
|
741
|
+
this.classRegistry.register(v, options);
|
|
742
|
+
}
|
|
743
|
+
registerSymbol(v, identifier) {
|
|
744
|
+
this.symbolRegistry.register(v, identifier);
|
|
745
|
+
}
|
|
746
|
+
registerCustom(transformer, name) {
|
|
747
|
+
this.customTransformerRegistry.register({
|
|
748
|
+
name,
|
|
749
|
+
...transformer
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
allowErrorProps(...props) {
|
|
753
|
+
this.allowedErrorProps.push(...props);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
SuperJSON.defaultInstance = new SuperJSON();
|
|
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;
|
|
766
|
+
|
|
767
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
768
|
+
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
769
|
+
var defaultOptions = {
|
|
770
|
+
name: void 0,
|
|
771
|
+
$refStrategy: "root",
|
|
772
|
+
basePath: ["#"],
|
|
773
|
+
effectStrategy: "input",
|
|
774
|
+
pipeStrategy: "all",
|
|
775
|
+
dateStrategy: "format:date-time",
|
|
776
|
+
mapStrategy: "entries",
|
|
777
|
+
removeAdditionalStrategy: "passthrough",
|
|
778
|
+
allowedAdditionalProperties: true,
|
|
779
|
+
rejectedAdditionalProperties: false,
|
|
780
|
+
definitionPath: "definitions",
|
|
781
|
+
target: "jsonSchema7",
|
|
782
|
+
strictUnions: false,
|
|
783
|
+
definitions: {},
|
|
784
|
+
errorMessages: false,
|
|
785
|
+
markdownDescription: false,
|
|
786
|
+
patternStrategy: "escape",
|
|
787
|
+
applyRegexFlags: false,
|
|
788
|
+
emailStrategy: "format:email",
|
|
789
|
+
base64Strategy: "contentEncoding:base64",
|
|
790
|
+
nameStrategy: "ref"
|
|
791
|
+
};
|
|
792
|
+
var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
793
|
+
...defaultOptions,
|
|
794
|
+
name: options
|
|
795
|
+
} : {
|
|
796
|
+
...defaultOptions,
|
|
797
|
+
...options
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
801
|
+
var getRefs = (options) => {
|
|
802
|
+
const _options = getDefaultOptions(options);
|
|
803
|
+
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
804
|
+
return {
|
|
805
|
+
..._options,
|
|
806
|
+
currentPath,
|
|
807
|
+
propertyPath: void 0,
|
|
808
|
+
seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
|
|
809
|
+
def._def,
|
|
810
|
+
{
|
|
811
|
+
def: def._def,
|
|
812
|
+
path: [..._options.basePath, _options.definitionPath, name],
|
|
813
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
814
|
+
jsonSchema: void 0
|
|
815
|
+
}
|
|
816
|
+
]))
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
821
|
+
function addErrorMessage(res, key, errorMessage, refs) {
|
|
822
|
+
if (!refs?.errorMessages)
|
|
823
|
+
return;
|
|
824
|
+
if (errorMessage) {
|
|
825
|
+
res.errorMessage = {
|
|
826
|
+
...res.errorMessage,
|
|
827
|
+
[key]: errorMessage
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
832
|
+
res[key] = value;
|
|
833
|
+
addErrorMessage(res, key, errorMessage, refs);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
837
|
+
function parseAnyDef() {
|
|
838
|
+
return {};
|
|
839
|
+
}
|
|
840
|
+
function parseArrayDef(def, refs) {
|
|
841
|
+
const res = {
|
|
842
|
+
type: "array"
|
|
843
|
+
};
|
|
844
|
+
if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {
|
|
845
|
+
res.items = parseDef(def.type._def, {
|
|
846
|
+
...refs,
|
|
847
|
+
currentPath: [...refs.currentPath, "items"]
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
if (def.minLength) {
|
|
851
|
+
setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
|
|
852
|
+
}
|
|
853
|
+
if (def.maxLength) {
|
|
854
|
+
setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
|
|
855
|
+
}
|
|
856
|
+
if (def.exactLength) {
|
|
857
|
+
setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
|
|
858
|
+
setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
|
|
859
|
+
}
|
|
860
|
+
return res;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
864
|
+
function parseBigintDef(def, refs) {
|
|
865
|
+
const res = {
|
|
866
|
+
type: "integer",
|
|
867
|
+
format: "int64"
|
|
868
|
+
};
|
|
869
|
+
if (!def.checks)
|
|
870
|
+
return res;
|
|
871
|
+
for (const check of def.checks) {
|
|
872
|
+
switch (check.kind) {
|
|
873
|
+
case "min":
|
|
874
|
+
if (refs.target === "jsonSchema7") {
|
|
875
|
+
if (check.inclusive) {
|
|
876
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
877
|
+
} else {
|
|
878
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
879
|
+
}
|
|
880
|
+
} else {
|
|
881
|
+
if (!check.inclusive) {
|
|
882
|
+
res.exclusiveMinimum = true;
|
|
883
|
+
}
|
|
884
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
885
|
+
}
|
|
886
|
+
break;
|
|
887
|
+
case "max":
|
|
888
|
+
if (refs.target === "jsonSchema7") {
|
|
889
|
+
if (check.inclusive) {
|
|
890
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
891
|
+
} else {
|
|
892
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
893
|
+
}
|
|
894
|
+
} else {
|
|
895
|
+
if (!check.inclusive) {
|
|
896
|
+
res.exclusiveMaximum = true;
|
|
897
|
+
}
|
|
898
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
899
|
+
}
|
|
900
|
+
break;
|
|
901
|
+
case "multipleOf":
|
|
902
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
903
|
+
break;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return res;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
910
|
+
function parseBooleanDef() {
|
|
911
|
+
return {
|
|
912
|
+
type: "boolean"
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
917
|
+
function parseBrandedDef(_def, refs) {
|
|
918
|
+
return parseDef(_def.type._def, refs);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
922
|
+
var parseCatchDef = (def, refs) => {
|
|
923
|
+
return parseDef(def.innerType._def, refs);
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
927
|
+
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
928
|
+
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
929
|
+
if (Array.isArray(strategy)) {
|
|
930
|
+
return {
|
|
931
|
+
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
switch (strategy) {
|
|
935
|
+
case "string":
|
|
936
|
+
case "format:date-time":
|
|
937
|
+
return {
|
|
938
|
+
type: "string",
|
|
939
|
+
format: "date-time"
|
|
940
|
+
};
|
|
941
|
+
case "format:date":
|
|
942
|
+
return {
|
|
943
|
+
type: "string",
|
|
944
|
+
format: "date"
|
|
945
|
+
};
|
|
946
|
+
case "integer":
|
|
947
|
+
return integerDateParser(def, refs);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
var integerDateParser = (def, refs) => {
|
|
951
|
+
const res = {
|
|
952
|
+
type: "integer",
|
|
953
|
+
format: "unix-time"
|
|
954
|
+
};
|
|
955
|
+
if (refs.target === "openApi3") {
|
|
956
|
+
return res;
|
|
957
|
+
}
|
|
958
|
+
for (const check of def.checks) {
|
|
959
|
+
switch (check.kind) {
|
|
960
|
+
case "min":
|
|
961
|
+
setResponseValueAndErrors(
|
|
962
|
+
res,
|
|
963
|
+
"minimum",
|
|
964
|
+
check.value,
|
|
965
|
+
// This is in milliseconds
|
|
966
|
+
check.message,
|
|
967
|
+
refs
|
|
968
|
+
);
|
|
969
|
+
break;
|
|
970
|
+
case "max":
|
|
971
|
+
setResponseValueAndErrors(
|
|
972
|
+
res,
|
|
973
|
+
"maximum",
|
|
974
|
+
check.value,
|
|
975
|
+
// This is in milliseconds
|
|
976
|
+
check.message,
|
|
977
|
+
refs
|
|
978
|
+
);
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return res;
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
986
|
+
function parseDefaultDef(_def, refs) {
|
|
987
|
+
return {
|
|
988
|
+
...parseDef(_def.innerType._def, refs),
|
|
989
|
+
default: _def.defaultValue()
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
994
|
+
function parseEffectsDef(_def, refs) {
|
|
995
|
+
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : {};
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
999
|
+
function parseEnumDef(def) {
|
|
1000
|
+
return {
|
|
1001
|
+
type: "string",
|
|
1002
|
+
enum: Array.from(def.values)
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
1007
|
+
var isJsonSchema7AllOfType = (type) => {
|
|
1008
|
+
if ("type" in type && type.type === "string")
|
|
1009
|
+
return false;
|
|
1010
|
+
return "allOf" in type;
|
|
1011
|
+
};
|
|
1012
|
+
function parseIntersectionDef(def, refs) {
|
|
1013
|
+
const allOf = [
|
|
1014
|
+
parseDef(def.left._def, {
|
|
1015
|
+
...refs,
|
|
1016
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
1017
|
+
}),
|
|
1018
|
+
parseDef(def.right._def, {
|
|
1019
|
+
...refs,
|
|
1020
|
+
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
1021
|
+
})
|
|
1022
|
+
].filter((x) => !!x);
|
|
1023
|
+
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
1024
|
+
const mergedAllOf = [];
|
|
1025
|
+
allOf.forEach((schema) => {
|
|
1026
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
1027
|
+
mergedAllOf.push(...schema.allOf);
|
|
1028
|
+
if (schema.unevaluatedProperties === void 0) {
|
|
1029
|
+
unevaluatedProperties = void 0;
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
let nestedSchema = schema;
|
|
1033
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
1034
|
+
const { additionalProperties, ...rest } = schema;
|
|
1035
|
+
nestedSchema = rest;
|
|
1036
|
+
} else {
|
|
1037
|
+
unevaluatedProperties = void 0;
|
|
1038
|
+
}
|
|
1039
|
+
mergedAllOf.push(nestedSchema);
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
return mergedAllOf.length ? {
|
|
1043
|
+
allOf: mergedAllOf,
|
|
1044
|
+
...unevaluatedProperties
|
|
1045
|
+
} : void 0;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
1049
|
+
function parseLiteralDef(def, refs) {
|
|
1050
|
+
const parsedType = typeof def.value;
|
|
1051
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
1052
|
+
return {
|
|
1053
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
if (refs.target === "openApi3") {
|
|
1057
|
+
return {
|
|
1058
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
1059
|
+
enum: [def.value]
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
return {
|
|
1063
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
1064
|
+
const: def.value
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
1069
|
+
var emojiRegex = void 0;
|
|
1070
|
+
var zodPatterns = {
|
|
1071
|
+
/**
|
|
1072
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
1073
|
+
*/
|
|
1074
|
+
cuid: /^[cC][^\s-]{8,}$/,
|
|
1075
|
+
cuid2: /^[0-9a-z]+$/,
|
|
1076
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
1077
|
+
/**
|
|
1078
|
+
* `a-z` was added to replicate /i flag
|
|
1079
|
+
*/
|
|
1080
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
1081
|
+
/**
|
|
1082
|
+
* Constructed a valid Unicode RegExp
|
|
1083
|
+
*
|
|
1084
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
1085
|
+
* in all envs (e.g. React Native).
|
|
1086
|
+
*
|
|
1087
|
+
* See:
|
|
1088
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
1089
|
+
* Fix in Zod:
|
|
1090
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
1091
|
+
*/
|
|
1092
|
+
emoji: () => {
|
|
1093
|
+
if (emojiRegex === void 0) {
|
|
1094
|
+
emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
|
|
1095
|
+
}
|
|
1096
|
+
return emojiRegex;
|
|
1097
|
+
},
|
|
1098
|
+
/**
|
|
1099
|
+
* Unused
|
|
1100
|
+
*/
|
|
1101
|
+
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}$/,
|
|
1102
|
+
/**
|
|
1103
|
+
* Unused
|
|
1104
|
+
*/
|
|
1105
|
+
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])$/,
|
|
1106
|
+
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])$/,
|
|
1107
|
+
/**
|
|
1108
|
+
* Unused
|
|
1109
|
+
*/
|
|
1110
|
+
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})))$/,
|
|
1111
|
+
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])$/,
|
|
1112
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
1113
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
1114
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
1115
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
1116
|
+
};
|
|
1117
|
+
function parseStringDef(def, refs) {
|
|
1118
|
+
const res = {
|
|
1119
|
+
type: "string"
|
|
1120
|
+
};
|
|
1121
|
+
if (def.checks) {
|
|
1122
|
+
for (const check of def.checks) {
|
|
1123
|
+
switch (check.kind) {
|
|
1124
|
+
case "min":
|
|
1125
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
1126
|
+
break;
|
|
1127
|
+
case "max":
|
|
1128
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
1129
|
+
break;
|
|
1130
|
+
case "email":
|
|
1131
|
+
switch (refs.emailStrategy) {
|
|
1132
|
+
case "format:email":
|
|
1133
|
+
addFormat(res, "email", check.message, refs);
|
|
1134
|
+
break;
|
|
1135
|
+
case "format:idn-email":
|
|
1136
|
+
addFormat(res, "idn-email", check.message, refs);
|
|
1137
|
+
break;
|
|
1138
|
+
case "pattern:zod":
|
|
1139
|
+
addPattern(res, zodPatterns.email, check.message, refs);
|
|
1140
|
+
break;
|
|
1141
|
+
}
|
|
1142
|
+
break;
|
|
1143
|
+
case "url":
|
|
1144
|
+
addFormat(res, "uri", check.message, refs);
|
|
1145
|
+
break;
|
|
1146
|
+
case "uuid":
|
|
1147
|
+
addFormat(res, "uuid", check.message, refs);
|
|
1148
|
+
break;
|
|
1149
|
+
case "regex":
|
|
1150
|
+
addPattern(res, check.regex, check.message, refs);
|
|
1151
|
+
break;
|
|
1152
|
+
case "cuid":
|
|
1153
|
+
addPattern(res, zodPatterns.cuid, check.message, refs);
|
|
1154
|
+
break;
|
|
1155
|
+
case "cuid2":
|
|
1156
|
+
addPattern(res, zodPatterns.cuid2, check.message, refs);
|
|
1157
|
+
break;
|
|
1158
|
+
case "startsWith":
|
|
1159
|
+
addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
|
|
1160
|
+
break;
|
|
1161
|
+
case "endsWith":
|
|
1162
|
+
addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
|
|
1163
|
+
break;
|
|
1164
|
+
case "datetime":
|
|
1165
|
+
addFormat(res, "date-time", check.message, refs);
|
|
1166
|
+
break;
|
|
1167
|
+
case "date":
|
|
1168
|
+
addFormat(res, "date", check.message, refs);
|
|
1169
|
+
break;
|
|
1170
|
+
case "time":
|
|
1171
|
+
addFormat(res, "time", check.message, refs);
|
|
1172
|
+
break;
|
|
1173
|
+
case "duration":
|
|
1174
|
+
addFormat(res, "duration", check.message, refs);
|
|
1175
|
+
break;
|
|
1176
|
+
case "length":
|
|
1177
|
+
setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
|
|
1178
|
+
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
1179
|
+
break;
|
|
1180
|
+
case "includes": {
|
|
1181
|
+
addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
case "ip": {
|
|
1185
|
+
if (check.version !== "v6") {
|
|
1186
|
+
addFormat(res, "ipv4", check.message, refs);
|
|
1187
|
+
}
|
|
1188
|
+
if (check.version !== "v4") {
|
|
1189
|
+
addFormat(res, "ipv6", check.message, refs);
|
|
1190
|
+
}
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
case "base64url":
|
|
1194
|
+
addPattern(res, zodPatterns.base64url, check.message, refs);
|
|
1195
|
+
break;
|
|
1196
|
+
case "jwt":
|
|
1197
|
+
addPattern(res, zodPatterns.jwt, check.message, refs);
|
|
1198
|
+
break;
|
|
1199
|
+
case "cidr": {
|
|
1200
|
+
if (check.version !== "v6") {
|
|
1201
|
+
addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
1202
|
+
}
|
|
1203
|
+
if (check.version !== "v4") {
|
|
1204
|
+
addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
1205
|
+
}
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
case "emoji":
|
|
1209
|
+
addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
1210
|
+
break;
|
|
1211
|
+
case "ulid": {
|
|
1212
|
+
addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
1213
|
+
break;
|
|
1214
|
+
}
|
|
1215
|
+
case "base64": {
|
|
1216
|
+
switch (refs.base64Strategy) {
|
|
1217
|
+
case "format:binary": {
|
|
1218
|
+
addFormat(res, "binary", check.message, refs);
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
case "contentEncoding:base64": {
|
|
1222
|
+
setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
case "pattern:zod": {
|
|
1226
|
+
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
break;
|
|
1231
|
+
}
|
|
1232
|
+
case "nanoid": {
|
|
1233
|
+
addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return res;
|
|
1239
|
+
}
|
|
1240
|
+
function escapeLiteralCheckValue(literal, refs) {
|
|
1241
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
|
|
1242
|
+
}
|
|
1243
|
+
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
1244
|
+
function escapeNonAlphaNumeric(source) {
|
|
1245
|
+
let result = "";
|
|
1246
|
+
for (let i = 0; i < source.length; i++) {
|
|
1247
|
+
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
1248
|
+
result += "\\";
|
|
1249
|
+
}
|
|
1250
|
+
result += source[i];
|
|
1251
|
+
}
|
|
1252
|
+
return result;
|
|
1253
|
+
}
|
|
1254
|
+
function addFormat(schema, value, message, refs) {
|
|
1255
|
+
if (schema.format || schema.anyOf?.some((x) => x.format)) {
|
|
1256
|
+
if (!schema.anyOf) {
|
|
1257
|
+
schema.anyOf = [];
|
|
1258
|
+
}
|
|
1259
|
+
if (schema.format) {
|
|
1260
|
+
schema.anyOf.push({
|
|
1261
|
+
format: schema.format,
|
|
1262
|
+
...schema.errorMessage && refs.errorMessages && {
|
|
1263
|
+
errorMessage: { format: schema.errorMessage.format }
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
delete schema.format;
|
|
1267
|
+
if (schema.errorMessage) {
|
|
1268
|
+
delete schema.errorMessage.format;
|
|
1269
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
1270
|
+
delete schema.errorMessage;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
schema.anyOf.push({
|
|
1275
|
+
format: value,
|
|
1276
|
+
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
1277
|
+
});
|
|
1278
|
+
} else {
|
|
1279
|
+
setResponseValueAndErrors(schema, "format", value, message, refs);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
function addPattern(schema, regex, message, refs) {
|
|
1283
|
+
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
1284
|
+
if (!schema.allOf) {
|
|
1285
|
+
schema.allOf = [];
|
|
1286
|
+
}
|
|
1287
|
+
if (schema.pattern) {
|
|
1288
|
+
schema.allOf.push({
|
|
1289
|
+
pattern: schema.pattern,
|
|
1290
|
+
...schema.errorMessage && refs.errorMessages && {
|
|
1291
|
+
errorMessage: { pattern: schema.errorMessage.pattern }
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
delete schema.pattern;
|
|
1295
|
+
if (schema.errorMessage) {
|
|
1296
|
+
delete schema.errorMessage.pattern;
|
|
1297
|
+
if (Object.keys(schema.errorMessage).length === 0) {
|
|
1298
|
+
delete schema.errorMessage;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
schema.allOf.push({
|
|
1303
|
+
pattern: stringifyRegExpWithFlags(regex, refs),
|
|
1304
|
+
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
1305
|
+
});
|
|
1306
|
+
} else {
|
|
1307
|
+
setResponseValueAndErrors(schema, "pattern", stringifyRegExpWithFlags(regex, refs), message, refs);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
function stringifyRegExpWithFlags(regex, refs) {
|
|
1311
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
1312
|
+
return regex.source;
|
|
1313
|
+
}
|
|
1314
|
+
const flags = {
|
|
1315
|
+
i: regex.flags.includes("i"),
|
|
1316
|
+
m: regex.flags.includes("m"),
|
|
1317
|
+
s: regex.flags.includes("s")
|
|
1318
|
+
// `.` matches newlines
|
|
1319
|
+
};
|
|
1320
|
+
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
1321
|
+
let pattern = "";
|
|
1322
|
+
let isEscaped = false;
|
|
1323
|
+
let inCharGroup = false;
|
|
1324
|
+
let inCharRange = false;
|
|
1325
|
+
for (let i = 0; i < source.length; i++) {
|
|
1326
|
+
if (isEscaped) {
|
|
1327
|
+
pattern += source[i];
|
|
1328
|
+
isEscaped = false;
|
|
1329
|
+
continue;
|
|
1330
|
+
}
|
|
1331
|
+
if (flags.i) {
|
|
1332
|
+
if (inCharGroup) {
|
|
1333
|
+
if (source[i].match(/[a-z]/)) {
|
|
1334
|
+
if (inCharRange) {
|
|
1335
|
+
pattern += source[i];
|
|
1336
|
+
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
1337
|
+
inCharRange = false;
|
|
1338
|
+
} else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
|
1339
|
+
pattern += source[i];
|
|
1340
|
+
inCharRange = true;
|
|
1341
|
+
} else {
|
|
1342
|
+
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
1343
|
+
}
|
|
1344
|
+
continue;
|
|
1345
|
+
}
|
|
1346
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
1347
|
+
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
if (flags.m) {
|
|
1352
|
+
if (source[i] === "^") {
|
|
1353
|
+
pattern += `(^|(?<=[\r
|
|
1354
|
+
]))`;
|
|
1355
|
+
continue;
|
|
1356
|
+
} else if (source[i] === "$") {
|
|
1357
|
+
pattern += `($|(?=[\r
|
|
1358
|
+
]))`;
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
if (flags.s && source[i] === ".") {
|
|
1363
|
+
pattern += inCharGroup ? `${source[i]}\r
|
|
1364
|
+
` : `[${source[i]}\r
|
|
1365
|
+
]`;
|
|
1366
|
+
continue;
|
|
1367
|
+
}
|
|
1368
|
+
pattern += source[i];
|
|
1369
|
+
if (source[i] === "\\") {
|
|
1370
|
+
isEscaped = true;
|
|
1371
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
1372
|
+
inCharGroup = false;
|
|
1373
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
1374
|
+
inCharGroup = true;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
return pattern;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
1381
|
+
function parseRecordDef(def, refs) {
|
|
1382
|
+
if (refs.target === "openAi") {
|
|
1383
|
+
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
1384
|
+
}
|
|
1385
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
1386
|
+
return {
|
|
1387
|
+
type: "object",
|
|
1388
|
+
required: def.keyType._def.values,
|
|
1389
|
+
properties: def.keyType._def.values.reduce((acc, key) => ({
|
|
1390
|
+
...acc,
|
|
1391
|
+
[key]: parseDef(def.valueType._def, {
|
|
1392
|
+
...refs,
|
|
1393
|
+
currentPath: [...refs.currentPath, "properties", key]
|
|
1394
|
+
}) ?? {}
|
|
1395
|
+
}), {}),
|
|
1396
|
+
additionalProperties: refs.rejectedAdditionalProperties
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
const schema = {
|
|
1400
|
+
type: "object",
|
|
1401
|
+
additionalProperties: parseDef(def.valueType._def, {
|
|
1402
|
+
...refs,
|
|
1403
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
1404
|
+
}) ?? refs.allowedAdditionalProperties
|
|
1405
|
+
};
|
|
1406
|
+
if (refs.target === "openApi3") {
|
|
1407
|
+
return schema;
|
|
1408
|
+
}
|
|
1409
|
+
if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
1410
|
+
const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
1411
|
+
return {
|
|
1412
|
+
...schema,
|
|
1413
|
+
propertyNames: keyType
|
|
1414
|
+
};
|
|
1415
|
+
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {
|
|
1416
|
+
return {
|
|
1417
|
+
...schema,
|
|
1418
|
+
propertyNames: {
|
|
1419
|
+
enum: def.keyType._def.values
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
} else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
1423
|
+
const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
|
|
1424
|
+
return {
|
|
1425
|
+
...schema,
|
|
1426
|
+
propertyNames: keyType
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
return schema;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
1433
|
+
function parseMapDef(def, refs) {
|
|
1434
|
+
if (refs.mapStrategy === "record") {
|
|
1435
|
+
return parseRecordDef(def, refs);
|
|
1436
|
+
}
|
|
1437
|
+
const keys = parseDef(def.keyType._def, {
|
|
1438
|
+
...refs,
|
|
1439
|
+
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
1440
|
+
}) || {};
|
|
1441
|
+
const values = parseDef(def.valueType._def, {
|
|
1442
|
+
...refs,
|
|
1443
|
+
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
1444
|
+
}) || {};
|
|
1445
|
+
return {
|
|
1446
|
+
type: "array",
|
|
1447
|
+
maxItems: 125,
|
|
1448
|
+
items: {
|
|
1449
|
+
type: "array",
|
|
1450
|
+
items: [keys, values],
|
|
1451
|
+
minItems: 2,
|
|
1452
|
+
maxItems: 2
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
1458
|
+
function parseNativeEnumDef(def) {
|
|
1459
|
+
const object = def.values;
|
|
1460
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
1461
|
+
return typeof object[object[key]] !== "number";
|
|
1462
|
+
});
|
|
1463
|
+
const actualValues = actualKeys.map((key) => object[key]);
|
|
1464
|
+
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
1465
|
+
return {
|
|
1466
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
1467
|
+
enum: actualValues
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
1472
|
+
function parseNeverDef() {
|
|
1473
|
+
return {
|
|
1474
|
+
not: {}
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
1479
|
+
function parseNullDef(refs) {
|
|
1480
|
+
return refs.target === "openApi3" ? {
|
|
1481
|
+
enum: ["null"],
|
|
1482
|
+
nullable: true
|
|
1483
|
+
} : {
|
|
1484
|
+
type: "null"
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
1489
|
+
var primitiveMappings = {
|
|
1490
|
+
ZodString: "string",
|
|
1491
|
+
ZodNumber: "number",
|
|
1492
|
+
ZodBigInt: "integer",
|
|
1493
|
+
ZodBoolean: "boolean",
|
|
1494
|
+
ZodNull: "null"
|
|
1495
|
+
};
|
|
1496
|
+
function parseUnionDef(def, refs) {
|
|
1497
|
+
if (refs.target === "openApi3")
|
|
1498
|
+
return asAnyOf(def, refs);
|
|
1499
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
1500
|
+
if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
|
|
1501
|
+
const types = options.reduce((types2, x) => {
|
|
1502
|
+
const type = primitiveMappings[x._def.typeName];
|
|
1503
|
+
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
1504
|
+
}, []);
|
|
1505
|
+
return {
|
|
1506
|
+
type: types.length > 1 ? types : types[0]
|
|
1507
|
+
};
|
|
1508
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
1509
|
+
const types = options.reduce((acc, x) => {
|
|
1510
|
+
const type = typeof x._def.value;
|
|
1511
|
+
switch (type) {
|
|
1512
|
+
case "string":
|
|
1513
|
+
case "number":
|
|
1514
|
+
case "boolean":
|
|
1515
|
+
return [...acc, type];
|
|
1516
|
+
case "bigint":
|
|
1517
|
+
return [...acc, "integer"];
|
|
1518
|
+
case "object":
|
|
1519
|
+
if (x._def.value === null)
|
|
1520
|
+
return [...acc, "null"];
|
|
1521
|
+
case "symbol":
|
|
1522
|
+
case "undefined":
|
|
1523
|
+
case "function":
|
|
1524
|
+
default:
|
|
1525
|
+
return acc;
|
|
1526
|
+
}
|
|
1527
|
+
}, []);
|
|
1528
|
+
if (types.length === options.length) {
|
|
1529
|
+
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
1530
|
+
return {
|
|
1531
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
1532
|
+
enum: options.reduce((acc, x) => {
|
|
1533
|
+
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
1534
|
+
}, [])
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
1538
|
+
return {
|
|
1539
|
+
type: "string",
|
|
1540
|
+
enum: options.reduce((acc, x) => [
|
|
1541
|
+
...acc,
|
|
1542
|
+
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
1543
|
+
], [])
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
return asAnyOf(def, refs);
|
|
1547
|
+
}
|
|
1548
|
+
var asAnyOf = (def, refs) => {
|
|
1549
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
|
|
1550
|
+
...refs,
|
|
1551
|
+
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
1552
|
+
})).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
|
|
1553
|
+
return anyOf.length ? { anyOf } : void 0;
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
1557
|
+
function parseNullableDef(def, refs) {
|
|
1558
|
+
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
1559
|
+
if (refs.target === "openApi3") {
|
|
1560
|
+
return {
|
|
1561
|
+
type: primitiveMappings[def.innerType._def.typeName],
|
|
1562
|
+
nullable: true
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
return {
|
|
1566
|
+
type: [
|
|
1567
|
+
primitiveMappings[def.innerType._def.typeName],
|
|
1568
|
+
"null"
|
|
1569
|
+
]
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
if (refs.target === "openApi3") {
|
|
1573
|
+
const base2 = parseDef(def.innerType._def, {
|
|
1574
|
+
...refs,
|
|
1575
|
+
currentPath: [...refs.currentPath]
|
|
1576
|
+
});
|
|
1577
|
+
if (base2 && "$ref" in base2)
|
|
1578
|
+
return { allOf: [base2], nullable: true };
|
|
1579
|
+
return base2 && { ...base2, nullable: true };
|
|
1580
|
+
}
|
|
1581
|
+
const base = parseDef(def.innerType._def, {
|
|
1582
|
+
...refs,
|
|
1583
|
+
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
1584
|
+
});
|
|
1585
|
+
return base && { anyOf: [base, { type: "null" }] };
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
1589
|
+
function parseNumberDef(def, refs) {
|
|
1590
|
+
const res = {
|
|
1591
|
+
type: "number"
|
|
1592
|
+
};
|
|
1593
|
+
if (!def.checks)
|
|
1594
|
+
return res;
|
|
1595
|
+
for (const check of def.checks) {
|
|
1596
|
+
switch (check.kind) {
|
|
1597
|
+
case "int":
|
|
1598
|
+
res.type = "integer";
|
|
1599
|
+
addErrorMessage(res, "type", check.message, refs);
|
|
1600
|
+
break;
|
|
1601
|
+
case "min":
|
|
1602
|
+
if (refs.target === "jsonSchema7") {
|
|
1603
|
+
if (check.inclusive) {
|
|
1604
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1605
|
+
} else {
|
|
1606
|
+
setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
|
|
1607
|
+
}
|
|
1608
|
+
} else {
|
|
1609
|
+
if (!check.inclusive) {
|
|
1610
|
+
res.exclusiveMinimum = true;
|
|
1611
|
+
}
|
|
1612
|
+
setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
|
|
1613
|
+
}
|
|
1614
|
+
break;
|
|
1615
|
+
case "max":
|
|
1616
|
+
if (refs.target === "jsonSchema7") {
|
|
1617
|
+
if (check.inclusive) {
|
|
1618
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1619
|
+
} else {
|
|
1620
|
+
setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
|
|
1621
|
+
}
|
|
1622
|
+
} else {
|
|
1623
|
+
if (!check.inclusive) {
|
|
1624
|
+
res.exclusiveMaximum = true;
|
|
1625
|
+
}
|
|
1626
|
+
setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
|
|
1627
|
+
}
|
|
1628
|
+
break;
|
|
1629
|
+
case "multipleOf":
|
|
1630
|
+
setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
return res;
|
|
1635
|
+
}
|
|
1636
|
+
function parseObjectDef(def, refs) {
|
|
1637
|
+
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
1638
|
+
const result = {
|
|
1639
|
+
type: "object",
|
|
1640
|
+
properties: {}
|
|
1641
|
+
};
|
|
1642
|
+
const required = [];
|
|
1643
|
+
const shape = def.shape();
|
|
1644
|
+
for (const propName in shape) {
|
|
1645
|
+
let propDef = shape[propName];
|
|
1646
|
+
if (propDef === void 0 || propDef._def === void 0) {
|
|
1647
|
+
continue;
|
|
1648
|
+
}
|
|
1649
|
+
let propOptional = safeIsOptional(propDef);
|
|
1650
|
+
if (propOptional && forceOptionalIntoNullable) {
|
|
1651
|
+
if (propDef instanceof ZodOptional) {
|
|
1652
|
+
propDef = propDef._def.innerType;
|
|
1653
|
+
}
|
|
1654
|
+
if (!propDef.isNullable()) {
|
|
1655
|
+
propDef = propDef.nullable();
|
|
1656
|
+
}
|
|
1657
|
+
propOptional = false;
|
|
1658
|
+
}
|
|
1659
|
+
const parsedDef = parseDef(propDef._def, {
|
|
1660
|
+
...refs,
|
|
1661
|
+
currentPath: [...refs.currentPath, "properties", propName],
|
|
1662
|
+
propertyPath: [...refs.currentPath, "properties", propName]
|
|
1663
|
+
});
|
|
1664
|
+
if (parsedDef === void 0) {
|
|
1665
|
+
continue;
|
|
1666
|
+
}
|
|
1667
|
+
result.properties[propName] = parsedDef;
|
|
1668
|
+
if (!propOptional) {
|
|
1669
|
+
required.push(propName);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
if (required.length) {
|
|
1673
|
+
result.required = required;
|
|
1674
|
+
}
|
|
1675
|
+
const additionalProperties = decideAdditionalProperties(def, refs);
|
|
1676
|
+
if (additionalProperties !== void 0) {
|
|
1677
|
+
result.additionalProperties = additionalProperties;
|
|
1678
|
+
}
|
|
1679
|
+
return result;
|
|
1680
|
+
}
|
|
1681
|
+
function decideAdditionalProperties(def, refs) {
|
|
1682
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
1683
|
+
return parseDef(def.catchall._def, {
|
|
1684
|
+
...refs,
|
|
1685
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
switch (def.unknownKeys) {
|
|
1689
|
+
case "passthrough":
|
|
1690
|
+
return refs.allowedAdditionalProperties;
|
|
1691
|
+
case "strict":
|
|
1692
|
+
return refs.rejectedAdditionalProperties;
|
|
1693
|
+
case "strip":
|
|
1694
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
function safeIsOptional(schema) {
|
|
1698
|
+
try {
|
|
1699
|
+
return schema.isOptional();
|
|
1700
|
+
} catch {
|
|
1701
|
+
return true;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
1706
|
+
var parseOptionalDef = (def, refs) => {
|
|
1707
|
+
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
1708
|
+
return parseDef(def.innerType._def, refs);
|
|
1709
|
+
}
|
|
1710
|
+
const innerSchema = parseDef(def.innerType._def, {
|
|
1711
|
+
...refs,
|
|
1712
|
+
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
1713
|
+
});
|
|
1714
|
+
return innerSchema ? {
|
|
1715
|
+
anyOf: [
|
|
1716
|
+
{
|
|
1717
|
+
not: {}
|
|
1718
|
+
},
|
|
1719
|
+
innerSchema
|
|
1720
|
+
]
|
|
1721
|
+
} : {};
|
|
1722
|
+
};
|
|
1723
|
+
|
|
1724
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
1725
|
+
var parsePipelineDef = (def, refs) => {
|
|
1726
|
+
if (refs.pipeStrategy === "input") {
|
|
1727
|
+
return parseDef(def.in._def, refs);
|
|
1728
|
+
} else if (refs.pipeStrategy === "output") {
|
|
1729
|
+
return parseDef(def.out._def, refs);
|
|
1730
|
+
}
|
|
1731
|
+
const a = parseDef(def.in._def, {
|
|
1732
|
+
...refs,
|
|
1733
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
1734
|
+
});
|
|
1735
|
+
const b = parseDef(def.out._def, {
|
|
1736
|
+
...refs,
|
|
1737
|
+
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
1738
|
+
});
|
|
1739
|
+
return {
|
|
1740
|
+
allOf: [a, b].filter((x) => x !== void 0)
|
|
1741
|
+
};
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1744
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1745
|
+
function parsePromiseDef(def, refs) {
|
|
1746
|
+
return parseDef(def.type._def, refs);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1750
|
+
function parseSetDef(def, refs) {
|
|
1751
|
+
const items = parseDef(def.valueType._def, {
|
|
1752
|
+
...refs,
|
|
1753
|
+
currentPath: [...refs.currentPath, "items"]
|
|
1754
|
+
});
|
|
1755
|
+
const schema = {
|
|
1756
|
+
type: "array",
|
|
1757
|
+
uniqueItems: true,
|
|
1758
|
+
items
|
|
1759
|
+
};
|
|
1760
|
+
if (def.minSize) {
|
|
1761
|
+
setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
|
|
1762
|
+
}
|
|
1763
|
+
if (def.maxSize) {
|
|
1764
|
+
setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
|
|
1765
|
+
}
|
|
1766
|
+
return schema;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1770
|
+
function parseTupleDef(def, refs) {
|
|
1771
|
+
if (def.rest) {
|
|
1772
|
+
return {
|
|
1773
|
+
type: "array",
|
|
1774
|
+
minItems: def.items.length,
|
|
1775
|
+
items: def.items.map((x, i) => parseDef(x._def, {
|
|
1776
|
+
...refs,
|
|
1777
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1778
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], []),
|
|
1779
|
+
additionalItems: parseDef(def.rest._def, {
|
|
1780
|
+
...refs,
|
|
1781
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
1782
|
+
})
|
|
1783
|
+
};
|
|
1784
|
+
} else {
|
|
1785
|
+
return {
|
|
1786
|
+
type: "array",
|
|
1787
|
+
minItems: def.items.length,
|
|
1788
|
+
maxItems: def.items.length,
|
|
1789
|
+
items: def.items.map((x, i) => parseDef(x._def, {
|
|
1790
|
+
...refs,
|
|
1791
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1792
|
+
})).reduce((acc, x) => x === void 0 ? acc : [...acc, x], [])
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1798
|
+
function parseUndefinedDef() {
|
|
1799
|
+
return {
|
|
1800
|
+
not: {}
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1805
|
+
function parseUnknownDef() {
|
|
1806
|
+
return {};
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1810
|
+
var parseReadonlyDef = (def, refs) => {
|
|
1811
|
+
return parseDef(def.innerType._def, refs);
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1815
|
+
var selectParser = (def, typeName, refs) => {
|
|
1816
|
+
switch (typeName) {
|
|
1817
|
+
case ZodFirstPartyTypeKind.ZodString:
|
|
1818
|
+
return parseStringDef(def, refs);
|
|
1819
|
+
case ZodFirstPartyTypeKind.ZodNumber:
|
|
1820
|
+
return parseNumberDef(def, refs);
|
|
1821
|
+
case ZodFirstPartyTypeKind.ZodObject:
|
|
1822
|
+
return parseObjectDef(def, refs);
|
|
1823
|
+
case ZodFirstPartyTypeKind.ZodBigInt:
|
|
1824
|
+
return parseBigintDef(def, refs);
|
|
1825
|
+
case ZodFirstPartyTypeKind.ZodBoolean:
|
|
1826
|
+
return parseBooleanDef();
|
|
1827
|
+
case ZodFirstPartyTypeKind.ZodDate:
|
|
1828
|
+
return parseDateDef(def, refs);
|
|
1829
|
+
case ZodFirstPartyTypeKind.ZodUndefined:
|
|
1830
|
+
return parseUndefinedDef();
|
|
1831
|
+
case ZodFirstPartyTypeKind.ZodNull:
|
|
1832
|
+
return parseNullDef(refs);
|
|
1833
|
+
case ZodFirstPartyTypeKind.ZodArray:
|
|
1834
|
+
return parseArrayDef(def, refs);
|
|
1835
|
+
case ZodFirstPartyTypeKind.ZodUnion:
|
|
1836
|
+
case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
1837
|
+
return parseUnionDef(def, refs);
|
|
1838
|
+
case ZodFirstPartyTypeKind.ZodIntersection:
|
|
1839
|
+
return parseIntersectionDef(def, refs);
|
|
1840
|
+
case ZodFirstPartyTypeKind.ZodTuple:
|
|
1841
|
+
return parseTupleDef(def, refs);
|
|
1842
|
+
case ZodFirstPartyTypeKind.ZodRecord:
|
|
1843
|
+
return parseRecordDef(def, refs);
|
|
1844
|
+
case ZodFirstPartyTypeKind.ZodLiteral:
|
|
1845
|
+
return parseLiteralDef(def, refs);
|
|
1846
|
+
case ZodFirstPartyTypeKind.ZodEnum:
|
|
1847
|
+
return parseEnumDef(def);
|
|
1848
|
+
case ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
1849
|
+
return parseNativeEnumDef(def);
|
|
1850
|
+
case ZodFirstPartyTypeKind.ZodNullable:
|
|
1851
|
+
return parseNullableDef(def, refs);
|
|
1852
|
+
case ZodFirstPartyTypeKind.ZodOptional:
|
|
1853
|
+
return parseOptionalDef(def, refs);
|
|
1854
|
+
case ZodFirstPartyTypeKind.ZodMap:
|
|
1855
|
+
return parseMapDef(def, refs);
|
|
1856
|
+
case ZodFirstPartyTypeKind.ZodSet:
|
|
1857
|
+
return parseSetDef(def, refs);
|
|
1858
|
+
case ZodFirstPartyTypeKind.ZodLazy:
|
|
1859
|
+
return () => def.getter()._def;
|
|
1860
|
+
case ZodFirstPartyTypeKind.ZodPromise:
|
|
1861
|
+
return parsePromiseDef(def, refs);
|
|
1862
|
+
case ZodFirstPartyTypeKind.ZodNaN:
|
|
1863
|
+
case ZodFirstPartyTypeKind.ZodNever:
|
|
1864
|
+
return parseNeverDef();
|
|
1865
|
+
case ZodFirstPartyTypeKind.ZodEffects:
|
|
1866
|
+
return parseEffectsDef(def, refs);
|
|
1867
|
+
case ZodFirstPartyTypeKind.ZodAny:
|
|
1868
|
+
return parseAnyDef();
|
|
1869
|
+
case ZodFirstPartyTypeKind.ZodUnknown:
|
|
1870
|
+
return parseUnknownDef();
|
|
1871
|
+
case ZodFirstPartyTypeKind.ZodDefault:
|
|
1872
|
+
return parseDefaultDef(def, refs);
|
|
1873
|
+
case ZodFirstPartyTypeKind.ZodBranded:
|
|
1874
|
+
return parseBrandedDef(def, refs);
|
|
1875
|
+
case ZodFirstPartyTypeKind.ZodReadonly:
|
|
1876
|
+
return parseReadonlyDef(def, refs);
|
|
1877
|
+
case ZodFirstPartyTypeKind.ZodCatch:
|
|
1878
|
+
return parseCatchDef(def, refs);
|
|
1879
|
+
case ZodFirstPartyTypeKind.ZodPipeline:
|
|
1880
|
+
return parsePipelineDef(def, refs);
|
|
1881
|
+
case ZodFirstPartyTypeKind.ZodFunction:
|
|
1882
|
+
case ZodFirstPartyTypeKind.ZodVoid:
|
|
1883
|
+
case ZodFirstPartyTypeKind.ZodSymbol:
|
|
1884
|
+
return void 0;
|
|
1885
|
+
default:
|
|
1886
|
+
return /* @__PURE__ */ ((_) => void 0)();
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1891
|
+
function parseDef(def, refs, forceResolution = false) {
|
|
1892
|
+
const seenItem = refs.seen.get(def);
|
|
1893
|
+
if (refs.override) {
|
|
1894
|
+
const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
|
|
1895
|
+
if (overrideResult !== ignoreOverride) {
|
|
1896
|
+
return overrideResult;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
if (seenItem && !forceResolution) {
|
|
1900
|
+
const seenSchema = get$ref(seenItem, refs);
|
|
1901
|
+
if (seenSchema !== void 0) {
|
|
1902
|
+
return seenSchema;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
1906
|
+
refs.seen.set(def, newItem);
|
|
1907
|
+
const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
1908
|
+
const jsonSchema = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
1909
|
+
if (jsonSchema) {
|
|
1910
|
+
addMeta(def, refs, jsonSchema);
|
|
1911
|
+
}
|
|
1912
|
+
if (refs.postProcess) {
|
|
1913
|
+
const postProcessResult = refs.postProcess(jsonSchema, def, refs);
|
|
1914
|
+
newItem.jsonSchema = jsonSchema;
|
|
1915
|
+
return postProcessResult;
|
|
1916
|
+
}
|
|
1917
|
+
newItem.jsonSchema = jsonSchema;
|
|
1918
|
+
return jsonSchema;
|
|
1919
|
+
}
|
|
1920
|
+
var get$ref = (item, refs) => {
|
|
1921
|
+
switch (refs.$refStrategy) {
|
|
1922
|
+
case "root":
|
|
1923
|
+
return { $ref: item.path.join("/") };
|
|
1924
|
+
case "relative":
|
|
1925
|
+
return { $ref: getRelativePath(refs.currentPath, item.path) };
|
|
1926
|
+
case "none":
|
|
1927
|
+
case "seen": {
|
|
1928
|
+
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
1929
|
+
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
1930
|
+
return {};
|
|
1931
|
+
}
|
|
1932
|
+
return refs.$refStrategy === "seen" ? {} : void 0;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
var getRelativePath = (pathA, pathB) => {
|
|
1937
|
+
let i = 0;
|
|
1938
|
+
for (; i < pathA.length && i < pathB.length; i++) {
|
|
1939
|
+
if (pathA[i] !== pathB[i])
|
|
1940
|
+
break;
|
|
1941
|
+
}
|
|
1942
|
+
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
1943
|
+
};
|
|
1944
|
+
var addMeta = (def, refs, jsonSchema) => {
|
|
1945
|
+
if (def.description) {
|
|
1946
|
+
jsonSchema.description = def.description;
|
|
1947
|
+
if (refs.markdownDescription) {
|
|
1948
|
+
jsonSchema.markdownDescription = def.description;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
return jsonSchema;
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1954
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1955
|
+
var zodToJsonSchema = (schema, options) => {
|
|
1956
|
+
const refs = getRefs(options);
|
|
1957
|
+
const definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
1958
|
+
...acc,
|
|
1959
|
+
[name2]: parseDef(schema2._def, {
|
|
1960
|
+
...refs,
|
|
1961
|
+
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
|
1962
|
+
}, true) ?? {}
|
|
1963
|
+
}), {}) : void 0;
|
|
1964
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
1965
|
+
const main = parseDef(schema._def, name === void 0 ? refs : {
|
|
1966
|
+
...refs,
|
|
1967
|
+
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
1968
|
+
}, false) ?? {};
|
|
1969
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1970
|
+
if (title !== void 0) {
|
|
1971
|
+
main.title = title;
|
|
1972
|
+
}
|
|
1973
|
+
const combined = name === void 0 ? definitions ? {
|
|
1974
|
+
...main,
|
|
1975
|
+
[refs.definitionPath]: definitions
|
|
1976
|
+
} : main : {
|
|
1977
|
+
$ref: [
|
|
1978
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
1979
|
+
refs.definitionPath,
|
|
1980
|
+
name
|
|
1981
|
+
].join("/"),
|
|
1982
|
+
[refs.definitionPath]: {
|
|
1983
|
+
...definitions,
|
|
1984
|
+
[name]: main
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
if (refs.target === "jsonSchema7") {
|
|
1988
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
1989
|
+
} else if (refs.target === "jsonSchema2019-09" || refs.target === "openAi") {
|
|
1990
|
+
combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
|
|
1991
|
+
}
|
|
1992
|
+
if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) {
|
|
1993
|
+
console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
|
|
1994
|
+
}
|
|
1995
|
+
return combined;
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1998
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
1999
|
+
var esm_default = zodToJsonSchema;
|
|
2000
|
+
|
|
2001
|
+
export { esm_default, stringify };
|