@weapp-core/schematics 6.0.3 → 6.1.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/index.cjs +546 -4131
- package/dist/index.d.cts +237 -16
- package/dist/index.d.ts +237 -16
- package/dist/index.js +543 -4129
- package/package.json +9 -3
- package/schemas/app.json +63 -11
- package/schemas/component.json +8 -1
- package/schemas/page.json +58 -14
- package/schemas/plugin.json +5 -1
- package/schemas/sitemap.json +3 -1
- package/schemas/theme.json +4 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
+
import * as z from "zod";
|
|
2
3
|
//#region src/constants.ts
|
|
3
4
|
const SCHEMA_BASE = (process.env.WEAPP_SCHEMA_BASE ?? "https://vite.icebreaker.top").replace(/\/$/, "");
|
|
4
5
|
function schemaUrl(filename) {
|
|
@@ -115,4213 +116,626 @@ ${filepath ? `<view>from ${filepath}</view>` : ""}`;
|
|
|
115
116
|
function generateWxss$1() {
|
|
116
117
|
return "";
|
|
117
118
|
}
|
|
118
|
-
Object.freeze({ status: "aborted" });
|
|
119
|
-
function $constructor(name, initializer, params) {
|
|
120
|
-
function init(inst, def) {
|
|
121
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
122
|
-
value: {
|
|
123
|
-
def,
|
|
124
|
-
constr: _,
|
|
125
|
-
traits: /* @__PURE__ */ new Set()
|
|
126
|
-
},
|
|
127
|
-
enumerable: false
|
|
128
|
-
});
|
|
129
|
-
if (inst._zod.traits.has(name)) return;
|
|
130
|
-
inst._zod.traits.add(name);
|
|
131
|
-
initializer(inst, def);
|
|
132
|
-
const proto = _.prototype;
|
|
133
|
-
const keys = Object.keys(proto);
|
|
134
|
-
for (let i = 0; i < keys.length; i++) {
|
|
135
|
-
const k = keys[i];
|
|
136
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const Parent = params?.Parent ?? Object;
|
|
140
|
-
class Definition extends Parent {}
|
|
141
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
142
|
-
function _(def) {
|
|
143
|
-
var _a;
|
|
144
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
145
|
-
init(inst, def);
|
|
146
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
147
|
-
for (const fn of inst._zod.deferred) fn();
|
|
148
|
-
return inst;
|
|
149
|
-
}
|
|
150
|
-
Object.defineProperty(_, "init", { value: init });
|
|
151
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
152
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
153
|
-
return inst?._zod?.traits?.has(name);
|
|
154
|
-
} });
|
|
155
|
-
Object.defineProperty(_, "name", { value: name });
|
|
156
|
-
return _;
|
|
157
|
-
}
|
|
158
|
-
var $ZodAsyncError = class extends Error {
|
|
159
|
-
constructor() {
|
|
160
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
var $ZodEncodeError = class extends Error {
|
|
164
|
-
constructor(name) {
|
|
165
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
166
|
-
this.name = "ZodEncodeError";
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const globalConfig = {};
|
|
170
|
-
function config(newConfig) {
|
|
171
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
172
|
-
return globalConfig;
|
|
173
|
-
}
|
|
174
119
|
//#endregion
|
|
175
|
-
//#region
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return value;
|
|
183
|
-
}
|
|
184
|
-
function cached(getter) {
|
|
185
|
-
return { get value() {
|
|
186
|
-
{
|
|
187
|
-
const value = getter();
|
|
188
|
-
Object.defineProperty(this, "value", { value });
|
|
189
|
-
return value;
|
|
190
|
-
}
|
|
191
|
-
throw new Error("cached value already set");
|
|
192
|
-
} };
|
|
193
|
-
}
|
|
194
|
-
function nullish(input) {
|
|
195
|
-
return input === null || input === void 0;
|
|
196
|
-
}
|
|
197
|
-
function cleanRegex(source) {
|
|
198
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
199
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
200
|
-
return source.slice(start, end);
|
|
201
|
-
}
|
|
202
|
-
function floatSafeRemainder(val, step) {
|
|
203
|
-
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
204
|
-
const stepString = step.toString();
|
|
205
|
-
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
206
|
-
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
207
|
-
const match = stepString.match(/\d?e-(\d?)/);
|
|
208
|
-
if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
|
|
209
|
-
}
|
|
210
|
-
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
211
|
-
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
212
|
-
}
|
|
213
|
-
const EVALUATING = Symbol("evaluating");
|
|
214
|
-
function defineLazy(object, key, getter) {
|
|
215
|
-
let value = void 0;
|
|
216
|
-
Object.defineProperty(object, key, {
|
|
217
|
-
get() {
|
|
218
|
-
if (value === EVALUATING) return;
|
|
219
|
-
if (value === void 0) {
|
|
220
|
-
value = EVALUATING;
|
|
221
|
-
value = getter();
|
|
222
|
-
}
|
|
223
|
-
return value;
|
|
120
|
+
//#region scripts/config/app.json
|
|
121
|
+
var app_default = {
|
|
122
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html",
|
|
123
|
+
fields: {
|
|
124
|
+
"entryPagePath": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "小程序默认启动首页。"
|
|
224
127
|
},
|
|
225
|
-
|
|
226
|
-
|
|
128
|
+
"pages": {
|
|
129
|
+
"type": "string[]",
|
|
130
|
+
"required": true,
|
|
131
|
+
"description": "页面路径列表。"
|
|
227
132
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
function assignProp(target, prop, value) {
|
|
232
|
-
Object.defineProperty(target, prop, {
|
|
233
|
-
value,
|
|
234
|
-
writable: true,
|
|
235
|
-
enumerable: true,
|
|
236
|
-
configurable: true
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
function mergeDefs(...defs) {
|
|
240
|
-
const mergedDescriptors = {};
|
|
241
|
-
for (const def of defs) {
|
|
242
|
-
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
243
|
-
Object.assign(mergedDescriptors, descriptors);
|
|
244
|
-
}
|
|
245
|
-
return Object.defineProperties({}, mergedDescriptors);
|
|
246
|
-
}
|
|
247
|
-
function esc(str) {
|
|
248
|
-
return JSON.stringify(str);
|
|
249
|
-
}
|
|
250
|
-
function slugify(input) {
|
|
251
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
252
|
-
}
|
|
253
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
254
|
-
function isObject(data) {
|
|
255
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
256
|
-
}
|
|
257
|
-
const allowsEval = cached(() => {
|
|
258
|
-
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
259
|
-
try {
|
|
260
|
-
new Function("");
|
|
261
|
-
return true;
|
|
262
|
-
} catch (_) {
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
function isPlainObject(o) {
|
|
267
|
-
if (isObject(o) === false) return false;
|
|
268
|
-
const ctor = o.constructor;
|
|
269
|
-
if (ctor === void 0) return true;
|
|
270
|
-
if (typeof ctor !== "function") return true;
|
|
271
|
-
const prot = ctor.prototype;
|
|
272
|
-
if (isObject(prot) === false) return false;
|
|
273
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
function shallowClone(o) {
|
|
277
|
-
if (isPlainObject(o)) return { ...o };
|
|
278
|
-
if (Array.isArray(o)) return [...o];
|
|
279
|
-
return o;
|
|
280
|
-
}
|
|
281
|
-
const propertyKeyTypes = new Set([
|
|
282
|
-
"string",
|
|
283
|
-
"number",
|
|
284
|
-
"symbol"
|
|
285
|
-
]);
|
|
286
|
-
function escapeRegex(str) {
|
|
287
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
288
|
-
}
|
|
289
|
-
function clone(inst, def, params) {
|
|
290
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
291
|
-
if (!def || params?.parent) cl._zod.parent = inst;
|
|
292
|
-
return cl;
|
|
293
|
-
}
|
|
294
|
-
function normalizeParams(_params) {
|
|
295
|
-
const params = _params;
|
|
296
|
-
if (!params) return {};
|
|
297
|
-
if (typeof params === "string") return { error: () => params };
|
|
298
|
-
if (params?.message !== void 0) {
|
|
299
|
-
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
300
|
-
params.error = params.message;
|
|
301
|
-
}
|
|
302
|
-
delete params.message;
|
|
303
|
-
if (typeof params.error === "string") return {
|
|
304
|
-
...params,
|
|
305
|
-
error: () => params.error
|
|
306
|
-
};
|
|
307
|
-
return params;
|
|
308
|
-
}
|
|
309
|
-
function optionalKeys(shape) {
|
|
310
|
-
return Object.keys(shape).filter((k) => {
|
|
311
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
const NUMBER_FORMAT_RANGES = {
|
|
315
|
-
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
316
|
-
int32: [-2147483648, 2147483647],
|
|
317
|
-
uint32: [0, 4294967295],
|
|
318
|
-
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
319
|
-
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
320
|
-
};
|
|
321
|
-
function pick(schema, mask) {
|
|
322
|
-
const currDef = schema._zod.def;
|
|
323
|
-
const checks = currDef.checks;
|
|
324
|
-
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
325
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
326
|
-
get shape() {
|
|
327
|
-
const newShape = {};
|
|
328
|
-
for (const key in mask) {
|
|
329
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
330
|
-
if (!mask[key]) continue;
|
|
331
|
-
newShape[key] = currDef.shape[key];
|
|
332
|
-
}
|
|
333
|
-
assignProp(this, "shape", newShape);
|
|
334
|
-
return newShape;
|
|
133
|
+
"window": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"description": "全局的默认窗口表现。"
|
|
335
136
|
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
function omit(schema, mask) {
|
|
340
|
-
const currDef = schema._zod.def;
|
|
341
|
-
const checks = currDef.checks;
|
|
342
|
-
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
343
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
344
|
-
get shape() {
|
|
345
|
-
const newShape = { ...schema._zod.def.shape };
|
|
346
|
-
for (const key in mask) {
|
|
347
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
348
|
-
if (!mask[key]) continue;
|
|
349
|
-
delete newShape[key];
|
|
350
|
-
}
|
|
351
|
-
assignProp(this, "shape", newShape);
|
|
352
|
-
return newShape;
|
|
137
|
+
"tabBar": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"description": "底部 tab 栏的表现。"
|
|
353
140
|
},
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
function extend(schema, shape) {
|
|
358
|
-
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
359
|
-
const checks = schema._zod.def.checks;
|
|
360
|
-
if (checks && checks.length > 0) {
|
|
361
|
-
const existingShape = schema._zod.def.shape;
|
|
362
|
-
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
363
|
-
}
|
|
364
|
-
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
365
|
-
const _shape = {
|
|
366
|
-
...schema._zod.def.shape,
|
|
367
|
-
...shape
|
|
368
|
-
};
|
|
369
|
-
assignProp(this, "shape", _shape);
|
|
370
|
-
return _shape;
|
|
371
|
-
} }));
|
|
372
|
-
}
|
|
373
|
-
function safeExtend(schema, shape) {
|
|
374
|
-
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
375
|
-
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
376
|
-
const _shape = {
|
|
377
|
-
...schema._zod.def.shape,
|
|
378
|
-
...shape
|
|
379
|
-
};
|
|
380
|
-
assignProp(this, "shape", _shape);
|
|
381
|
-
return _shape;
|
|
382
|
-
} }));
|
|
383
|
-
}
|
|
384
|
-
function merge(a, b) {
|
|
385
|
-
return clone(a, mergeDefs(a._zod.def, {
|
|
386
|
-
get shape() {
|
|
387
|
-
const _shape = {
|
|
388
|
-
...a._zod.def.shape,
|
|
389
|
-
...b._zod.def.shape
|
|
390
|
-
};
|
|
391
|
-
assignProp(this, "shape", _shape);
|
|
392
|
-
return _shape;
|
|
141
|
+
"networkTimeout": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"description": "网络超时时间。"
|
|
393
144
|
},
|
|
394
|
-
|
|
395
|
-
|
|
145
|
+
"debug": {
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"description": "是否开启 debug 模式。"
|
|
396
148
|
},
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
const checks = schema._zod.def.checks;
|
|
402
|
-
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
403
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
404
|
-
get shape() {
|
|
405
|
-
const oldShape = schema._zod.def.shape;
|
|
406
|
-
const shape = { ...oldShape };
|
|
407
|
-
if (mask) for (const key in mask) {
|
|
408
|
-
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
409
|
-
if (!mask[key]) continue;
|
|
410
|
-
shape[key] = Class ? new Class({
|
|
411
|
-
type: "optional",
|
|
412
|
-
innerType: oldShape[key]
|
|
413
|
-
}) : oldShape[key];
|
|
414
|
-
}
|
|
415
|
-
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
416
|
-
type: "optional",
|
|
417
|
-
innerType: oldShape[key]
|
|
418
|
-
}) : oldShape[key];
|
|
419
|
-
assignProp(this, "shape", shape);
|
|
420
|
-
return shape;
|
|
149
|
+
"functionalPages": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"description": "是否启用插件功能页。",
|
|
152
|
+
"x-wechat-min-version": "2.1.0"
|
|
421
153
|
},
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
427
|
-
const oldShape = schema._zod.def.shape;
|
|
428
|
-
const shape = { ...oldShape };
|
|
429
|
-
if (mask) for (const key in mask) {
|
|
430
|
-
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
431
|
-
if (!mask[key]) continue;
|
|
432
|
-
shape[key] = new Class({
|
|
433
|
-
type: "nonoptional",
|
|
434
|
-
innerType: oldShape[key]
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
else for (const key in oldShape) shape[key] = new Class({
|
|
438
|
-
type: "nonoptional",
|
|
439
|
-
innerType: oldShape[key]
|
|
440
|
-
});
|
|
441
|
-
assignProp(this, "shape", shape);
|
|
442
|
-
return shape;
|
|
443
|
-
} }));
|
|
444
|
-
}
|
|
445
|
-
function aborted(x, startIndex = 0) {
|
|
446
|
-
if (x.aborted === true) return true;
|
|
447
|
-
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
function prefixIssues(path, issues) {
|
|
451
|
-
return issues.map((iss) => {
|
|
452
|
-
var _a;
|
|
453
|
-
(_a = iss).path ?? (_a.path = []);
|
|
454
|
-
iss.path.unshift(path);
|
|
455
|
-
return iss;
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
function unwrapMessage(message) {
|
|
459
|
-
return typeof message === "string" ? message : message?.message;
|
|
460
|
-
}
|
|
461
|
-
function finalizeIssue(iss, ctx, config) {
|
|
462
|
-
const full = {
|
|
463
|
-
...iss,
|
|
464
|
-
path: iss.path ?? []
|
|
465
|
-
};
|
|
466
|
-
if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
467
|
-
delete full.inst;
|
|
468
|
-
delete full.continue;
|
|
469
|
-
if (!ctx?.reportInput) delete full.input;
|
|
470
|
-
return full;
|
|
471
|
-
}
|
|
472
|
-
function getLengthableOrigin(input) {
|
|
473
|
-
if (Array.isArray(input)) return "array";
|
|
474
|
-
if (typeof input === "string") return "string";
|
|
475
|
-
return "unknown";
|
|
476
|
-
}
|
|
477
|
-
function issue(...args) {
|
|
478
|
-
const [iss, input, inst] = args;
|
|
479
|
-
if (typeof iss === "string") return {
|
|
480
|
-
message: iss,
|
|
481
|
-
code: "custom",
|
|
482
|
-
input,
|
|
483
|
-
inst
|
|
484
|
-
};
|
|
485
|
-
return { ...iss };
|
|
486
|
-
}
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
489
|
-
const initializer$1 = (inst, def) => {
|
|
490
|
-
inst.name = "$ZodError";
|
|
491
|
-
Object.defineProperty(inst, "_zod", {
|
|
492
|
-
value: inst._zod,
|
|
493
|
-
enumerable: false
|
|
494
|
-
});
|
|
495
|
-
Object.defineProperty(inst, "issues", {
|
|
496
|
-
value: def,
|
|
497
|
-
enumerable: false
|
|
498
|
-
});
|
|
499
|
-
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
500
|
-
Object.defineProperty(inst, "toString", {
|
|
501
|
-
value: () => inst.message,
|
|
502
|
-
enumerable: false
|
|
503
|
-
});
|
|
504
|
-
};
|
|
505
|
-
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
506
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
507
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
508
|
-
const fieldErrors = {};
|
|
509
|
-
const formErrors = [];
|
|
510
|
-
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
511
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
512
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
513
|
-
} else formErrors.push(mapper(sub));
|
|
514
|
-
return {
|
|
515
|
-
formErrors,
|
|
516
|
-
fieldErrors
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
520
|
-
const fieldErrors = { _errors: [] };
|
|
521
|
-
const processError = (error) => {
|
|
522
|
-
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
|
|
523
|
-
else if (issue.code === "invalid_key") processError({ issues: issue.issues });
|
|
524
|
-
else if (issue.code === "invalid_element") processError({ issues: issue.issues });
|
|
525
|
-
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
526
|
-
else {
|
|
527
|
-
let curr = fieldErrors;
|
|
528
|
-
let i = 0;
|
|
529
|
-
while (i < issue.path.length) {
|
|
530
|
-
const el = issue.path[i];
|
|
531
|
-
if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
532
|
-
else {
|
|
533
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
534
|
-
curr[el]._errors.push(mapper(issue));
|
|
535
|
-
}
|
|
536
|
-
curr = curr[el];
|
|
537
|
-
i++;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
processError(error);
|
|
542
|
-
return fieldErrors;
|
|
543
|
-
}
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
546
|
-
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
547
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
548
|
-
const result = schema._zod.run({
|
|
549
|
-
value,
|
|
550
|
-
issues: []
|
|
551
|
-
}, ctx);
|
|
552
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
553
|
-
if (result.issues.length) {
|
|
554
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
555
|
-
captureStackTrace(e, _params?.callee);
|
|
556
|
-
throw e;
|
|
557
|
-
}
|
|
558
|
-
return result.value;
|
|
559
|
-
};
|
|
560
|
-
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
561
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
562
|
-
let result = schema._zod.run({
|
|
563
|
-
value,
|
|
564
|
-
issues: []
|
|
565
|
-
}, ctx);
|
|
566
|
-
if (result instanceof Promise) result = await result;
|
|
567
|
-
if (result.issues.length) {
|
|
568
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
569
|
-
captureStackTrace(e, params?.callee);
|
|
570
|
-
throw e;
|
|
571
|
-
}
|
|
572
|
-
return result.value;
|
|
573
|
-
};
|
|
574
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
575
|
-
const ctx = _ctx ? {
|
|
576
|
-
..._ctx,
|
|
577
|
-
async: false
|
|
578
|
-
} : { async: false };
|
|
579
|
-
const result = schema._zod.run({
|
|
580
|
-
value,
|
|
581
|
-
issues: []
|
|
582
|
-
}, ctx);
|
|
583
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
584
|
-
return result.issues.length ? {
|
|
585
|
-
success: false,
|
|
586
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
587
|
-
} : {
|
|
588
|
-
success: true,
|
|
589
|
-
data: result.value
|
|
590
|
-
};
|
|
591
|
-
};
|
|
592
|
-
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
593
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
594
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
595
|
-
let result = schema._zod.run({
|
|
596
|
-
value,
|
|
597
|
-
issues: []
|
|
598
|
-
}, ctx);
|
|
599
|
-
if (result instanceof Promise) result = await result;
|
|
600
|
-
return result.issues.length ? {
|
|
601
|
-
success: false,
|
|
602
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
603
|
-
} : {
|
|
604
|
-
success: true,
|
|
605
|
-
data: result.value
|
|
606
|
-
};
|
|
607
|
-
};
|
|
608
|
-
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
609
|
-
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
610
|
-
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
611
|
-
return _parse(_Err)(schema, value, ctx);
|
|
612
|
-
};
|
|
613
|
-
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
614
|
-
return _parse(_Err)(schema, value, _ctx);
|
|
615
|
-
};
|
|
616
|
-
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
617
|
-
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
618
|
-
return _parseAsync(_Err)(schema, value, ctx);
|
|
619
|
-
};
|
|
620
|
-
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
621
|
-
return _parseAsync(_Err)(schema, value, _ctx);
|
|
622
|
-
};
|
|
623
|
-
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
624
|
-
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
625
|
-
return _safeParse(_Err)(schema, value, ctx);
|
|
626
|
-
};
|
|
627
|
-
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
628
|
-
return _safeParse(_Err)(schema, value, _ctx);
|
|
629
|
-
};
|
|
630
|
-
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
631
|
-
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
632
|
-
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
633
|
-
};
|
|
634
|
-
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
635
|
-
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
636
|
-
};
|
|
637
|
-
//#endregion
|
|
638
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
639
|
-
const cuid = /^[cC][^\s-]{8,}$/;
|
|
640
|
-
const cuid2 = /^[0-9a-z]+$/;
|
|
641
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
642
|
-
const xid = /^[0-9a-vA-V]{20}$/;
|
|
643
|
-
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
644
|
-
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
645
|
-
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
646
|
-
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
647
|
-
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
648
|
-
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
649
|
-
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
650
|
-
*
|
|
651
|
-
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
652
|
-
const uuid = (version) => {
|
|
653
|
-
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
654
|
-
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
655
|
-
};
|
|
656
|
-
/** Practical email validation */
|
|
657
|
-
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
658
|
-
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
659
|
-
function emoji() {
|
|
660
|
-
return new RegExp(_emoji$1, "u");
|
|
661
|
-
}
|
|
662
|
-
const 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])$/;
|
|
663
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/;
|
|
664
|
-
const cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
665
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
666
|
-
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
667
|
-
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
668
|
-
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
669
|
-
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
670
|
-
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
671
|
-
function timeSource(args) {
|
|
672
|
-
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
673
|
-
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
674
|
-
}
|
|
675
|
-
function time$1(args) {
|
|
676
|
-
return new RegExp(`^${timeSource(args)}$`);
|
|
677
|
-
}
|
|
678
|
-
function datetime$1(args) {
|
|
679
|
-
const time = timeSource({ precision: args.precision });
|
|
680
|
-
const opts = ["Z"];
|
|
681
|
-
if (args.local) opts.push("");
|
|
682
|
-
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
683
|
-
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
684
|
-
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
685
|
-
}
|
|
686
|
-
const string$1 = (params) => {
|
|
687
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
688
|
-
return new RegExp(`^${regex}$`);
|
|
689
|
-
};
|
|
690
|
-
const integer = /^-?\d+$/;
|
|
691
|
-
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
692
|
-
const boolean$1 = /^(?:true|false)$/i;
|
|
693
|
-
const lowercase = /^[^A-Z]*$/;
|
|
694
|
-
const uppercase = /^[^a-z]*$/;
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
697
|
-
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
698
|
-
var _a;
|
|
699
|
-
inst._zod ?? (inst._zod = {});
|
|
700
|
-
inst._zod.def = def;
|
|
701
|
-
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
702
|
-
});
|
|
703
|
-
const numericOriginMap = {
|
|
704
|
-
number: "number",
|
|
705
|
-
bigint: "bigint",
|
|
706
|
-
object: "date"
|
|
707
|
-
};
|
|
708
|
-
const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
709
|
-
$ZodCheck.init(inst, def);
|
|
710
|
-
const origin = numericOriginMap[typeof def.value];
|
|
711
|
-
inst._zod.onattach.push((inst) => {
|
|
712
|
-
const bag = inst._zod.bag;
|
|
713
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
714
|
-
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
715
|
-
else bag.exclusiveMaximum = def.value;
|
|
716
|
-
});
|
|
717
|
-
inst._zod.check = (payload) => {
|
|
718
|
-
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
719
|
-
payload.issues.push({
|
|
720
|
-
origin,
|
|
721
|
-
code: "too_big",
|
|
722
|
-
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
723
|
-
input: payload.value,
|
|
724
|
-
inclusive: def.inclusive,
|
|
725
|
-
inst,
|
|
726
|
-
continue: !def.abort
|
|
727
|
-
});
|
|
728
|
-
};
|
|
729
|
-
});
|
|
730
|
-
const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
731
|
-
$ZodCheck.init(inst, def);
|
|
732
|
-
const origin = numericOriginMap[typeof def.value];
|
|
733
|
-
inst._zod.onattach.push((inst) => {
|
|
734
|
-
const bag = inst._zod.bag;
|
|
735
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
736
|
-
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
737
|
-
else bag.exclusiveMinimum = def.value;
|
|
738
|
-
});
|
|
739
|
-
inst._zod.check = (payload) => {
|
|
740
|
-
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
741
|
-
payload.issues.push({
|
|
742
|
-
origin,
|
|
743
|
-
code: "too_small",
|
|
744
|
-
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
745
|
-
input: payload.value,
|
|
746
|
-
inclusive: def.inclusive,
|
|
747
|
-
inst,
|
|
748
|
-
continue: !def.abort
|
|
749
|
-
});
|
|
750
|
-
};
|
|
751
|
-
});
|
|
752
|
-
const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
753
|
-
$ZodCheck.init(inst, def);
|
|
754
|
-
inst._zod.onattach.push((inst) => {
|
|
755
|
-
var _a;
|
|
756
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
757
|
-
});
|
|
758
|
-
inst._zod.check = (payload) => {
|
|
759
|
-
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
760
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
761
|
-
payload.issues.push({
|
|
762
|
-
origin: typeof payload.value,
|
|
763
|
-
code: "not_multiple_of",
|
|
764
|
-
divisor: def.value,
|
|
765
|
-
input: payload.value,
|
|
766
|
-
inst,
|
|
767
|
-
continue: !def.abort
|
|
768
|
-
});
|
|
769
|
-
};
|
|
770
|
-
});
|
|
771
|
-
const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
772
|
-
$ZodCheck.init(inst, def);
|
|
773
|
-
def.format = def.format || "float64";
|
|
774
|
-
const isInt = def.format?.includes("int");
|
|
775
|
-
const origin = isInt ? "int" : "number";
|
|
776
|
-
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
777
|
-
inst._zod.onattach.push((inst) => {
|
|
778
|
-
const bag = inst._zod.bag;
|
|
779
|
-
bag.format = def.format;
|
|
780
|
-
bag.minimum = minimum;
|
|
781
|
-
bag.maximum = maximum;
|
|
782
|
-
if (isInt) bag.pattern = integer;
|
|
783
|
-
});
|
|
784
|
-
inst._zod.check = (payload) => {
|
|
785
|
-
const input = payload.value;
|
|
786
|
-
if (isInt) {
|
|
787
|
-
if (!Number.isInteger(input)) {
|
|
788
|
-
payload.issues.push({
|
|
789
|
-
expected: origin,
|
|
790
|
-
format: def.format,
|
|
791
|
-
code: "invalid_type",
|
|
792
|
-
continue: false,
|
|
793
|
-
input,
|
|
794
|
-
inst
|
|
795
|
-
});
|
|
796
|
-
return;
|
|
797
|
-
}
|
|
798
|
-
if (!Number.isSafeInteger(input)) {
|
|
799
|
-
if (input > 0) payload.issues.push({
|
|
800
|
-
input,
|
|
801
|
-
code: "too_big",
|
|
802
|
-
maximum: Number.MAX_SAFE_INTEGER,
|
|
803
|
-
note: "Integers must be within the safe integer range.",
|
|
804
|
-
inst,
|
|
805
|
-
origin,
|
|
806
|
-
inclusive: true,
|
|
807
|
-
continue: !def.abort
|
|
808
|
-
});
|
|
809
|
-
else payload.issues.push({
|
|
810
|
-
input,
|
|
811
|
-
code: "too_small",
|
|
812
|
-
minimum: Number.MIN_SAFE_INTEGER,
|
|
813
|
-
note: "Integers must be within the safe integer range.",
|
|
814
|
-
inst,
|
|
815
|
-
origin,
|
|
816
|
-
inclusive: true,
|
|
817
|
-
continue: !def.abort
|
|
818
|
-
});
|
|
819
|
-
return;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
if (input < minimum) payload.issues.push({
|
|
823
|
-
origin: "number",
|
|
824
|
-
input,
|
|
825
|
-
code: "too_small",
|
|
826
|
-
minimum,
|
|
827
|
-
inclusive: true,
|
|
828
|
-
inst,
|
|
829
|
-
continue: !def.abort
|
|
830
|
-
});
|
|
831
|
-
if (input > maximum) payload.issues.push({
|
|
832
|
-
origin: "number",
|
|
833
|
-
input,
|
|
834
|
-
code: "too_big",
|
|
835
|
-
maximum,
|
|
836
|
-
inclusive: true,
|
|
837
|
-
inst,
|
|
838
|
-
continue: !def.abort
|
|
839
|
-
});
|
|
840
|
-
};
|
|
841
|
-
});
|
|
842
|
-
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
843
|
-
var _a;
|
|
844
|
-
$ZodCheck.init(inst, def);
|
|
845
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
846
|
-
const val = payload.value;
|
|
847
|
-
return !nullish(val) && val.length !== void 0;
|
|
848
|
-
});
|
|
849
|
-
inst._zod.onattach.push((inst) => {
|
|
850
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
851
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
852
|
-
});
|
|
853
|
-
inst._zod.check = (payload) => {
|
|
854
|
-
const input = payload.value;
|
|
855
|
-
if (input.length <= def.maximum) return;
|
|
856
|
-
const origin = getLengthableOrigin(input);
|
|
857
|
-
payload.issues.push({
|
|
858
|
-
origin,
|
|
859
|
-
code: "too_big",
|
|
860
|
-
maximum: def.maximum,
|
|
861
|
-
inclusive: true,
|
|
862
|
-
input,
|
|
863
|
-
inst,
|
|
864
|
-
continue: !def.abort
|
|
865
|
-
});
|
|
866
|
-
};
|
|
867
|
-
});
|
|
868
|
-
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
869
|
-
var _a;
|
|
870
|
-
$ZodCheck.init(inst, def);
|
|
871
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
872
|
-
const val = payload.value;
|
|
873
|
-
return !nullish(val) && val.length !== void 0;
|
|
874
|
-
});
|
|
875
|
-
inst._zod.onattach.push((inst) => {
|
|
876
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
877
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
878
|
-
});
|
|
879
|
-
inst._zod.check = (payload) => {
|
|
880
|
-
const input = payload.value;
|
|
881
|
-
if (input.length >= def.minimum) return;
|
|
882
|
-
const origin = getLengthableOrigin(input);
|
|
883
|
-
payload.issues.push({
|
|
884
|
-
origin,
|
|
885
|
-
code: "too_small",
|
|
886
|
-
minimum: def.minimum,
|
|
887
|
-
inclusive: true,
|
|
888
|
-
input,
|
|
889
|
-
inst,
|
|
890
|
-
continue: !def.abort
|
|
891
|
-
});
|
|
892
|
-
};
|
|
893
|
-
});
|
|
894
|
-
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
895
|
-
var _a;
|
|
896
|
-
$ZodCheck.init(inst, def);
|
|
897
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
898
|
-
const val = payload.value;
|
|
899
|
-
return !nullish(val) && val.length !== void 0;
|
|
900
|
-
});
|
|
901
|
-
inst._zod.onattach.push((inst) => {
|
|
902
|
-
const bag = inst._zod.bag;
|
|
903
|
-
bag.minimum = def.length;
|
|
904
|
-
bag.maximum = def.length;
|
|
905
|
-
bag.length = def.length;
|
|
906
|
-
});
|
|
907
|
-
inst._zod.check = (payload) => {
|
|
908
|
-
const input = payload.value;
|
|
909
|
-
const length = input.length;
|
|
910
|
-
if (length === def.length) return;
|
|
911
|
-
const origin = getLengthableOrigin(input);
|
|
912
|
-
const tooBig = length > def.length;
|
|
913
|
-
payload.issues.push({
|
|
914
|
-
origin,
|
|
915
|
-
...tooBig ? {
|
|
916
|
-
code: "too_big",
|
|
917
|
-
maximum: def.length
|
|
918
|
-
} : {
|
|
919
|
-
code: "too_small",
|
|
920
|
-
minimum: def.length
|
|
921
|
-
},
|
|
922
|
-
inclusive: true,
|
|
923
|
-
exact: true,
|
|
924
|
-
input: payload.value,
|
|
925
|
-
inst,
|
|
926
|
-
continue: !def.abort
|
|
927
|
-
});
|
|
928
|
-
};
|
|
929
|
-
});
|
|
930
|
-
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
931
|
-
var _a, _b;
|
|
932
|
-
$ZodCheck.init(inst, def);
|
|
933
|
-
inst._zod.onattach.push((inst) => {
|
|
934
|
-
const bag = inst._zod.bag;
|
|
935
|
-
bag.format = def.format;
|
|
936
|
-
if (def.pattern) {
|
|
937
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
938
|
-
bag.patterns.add(def.pattern);
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
942
|
-
def.pattern.lastIndex = 0;
|
|
943
|
-
if (def.pattern.test(payload.value)) return;
|
|
944
|
-
payload.issues.push({
|
|
945
|
-
origin: "string",
|
|
946
|
-
code: "invalid_format",
|
|
947
|
-
format: def.format,
|
|
948
|
-
input: payload.value,
|
|
949
|
-
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
950
|
-
inst,
|
|
951
|
-
continue: !def.abort
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
955
|
-
});
|
|
956
|
-
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
957
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
958
|
-
inst._zod.check = (payload) => {
|
|
959
|
-
def.pattern.lastIndex = 0;
|
|
960
|
-
if (def.pattern.test(payload.value)) return;
|
|
961
|
-
payload.issues.push({
|
|
962
|
-
origin: "string",
|
|
963
|
-
code: "invalid_format",
|
|
964
|
-
format: "regex",
|
|
965
|
-
input: payload.value,
|
|
966
|
-
pattern: def.pattern.toString(),
|
|
967
|
-
inst,
|
|
968
|
-
continue: !def.abort
|
|
969
|
-
});
|
|
970
|
-
};
|
|
971
|
-
});
|
|
972
|
-
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
973
|
-
def.pattern ?? (def.pattern = lowercase);
|
|
974
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
975
|
-
});
|
|
976
|
-
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
977
|
-
def.pattern ?? (def.pattern = uppercase);
|
|
978
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
979
|
-
});
|
|
980
|
-
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
981
|
-
$ZodCheck.init(inst, def);
|
|
982
|
-
const escapedRegex = escapeRegex(def.includes);
|
|
983
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
984
|
-
def.pattern = pattern;
|
|
985
|
-
inst._zod.onattach.push((inst) => {
|
|
986
|
-
const bag = inst._zod.bag;
|
|
987
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
988
|
-
bag.patterns.add(pattern);
|
|
989
|
-
});
|
|
990
|
-
inst._zod.check = (payload) => {
|
|
991
|
-
if (payload.value.includes(def.includes, def.position)) return;
|
|
992
|
-
payload.issues.push({
|
|
993
|
-
origin: "string",
|
|
994
|
-
code: "invalid_format",
|
|
995
|
-
format: "includes",
|
|
996
|
-
includes: def.includes,
|
|
997
|
-
input: payload.value,
|
|
998
|
-
inst,
|
|
999
|
-
continue: !def.abort
|
|
1000
|
-
});
|
|
1001
|
-
};
|
|
1002
|
-
});
|
|
1003
|
-
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
1004
|
-
$ZodCheck.init(inst, def);
|
|
1005
|
-
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1006
|
-
def.pattern ?? (def.pattern = pattern);
|
|
1007
|
-
inst._zod.onattach.push((inst) => {
|
|
1008
|
-
const bag = inst._zod.bag;
|
|
1009
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1010
|
-
bag.patterns.add(pattern);
|
|
1011
|
-
});
|
|
1012
|
-
inst._zod.check = (payload) => {
|
|
1013
|
-
if (payload.value.startsWith(def.prefix)) return;
|
|
1014
|
-
payload.issues.push({
|
|
1015
|
-
origin: "string",
|
|
1016
|
-
code: "invalid_format",
|
|
1017
|
-
format: "starts_with",
|
|
1018
|
-
prefix: def.prefix,
|
|
1019
|
-
input: payload.value,
|
|
1020
|
-
inst,
|
|
1021
|
-
continue: !def.abort
|
|
1022
|
-
});
|
|
1023
|
-
};
|
|
1024
|
-
});
|
|
1025
|
-
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
1026
|
-
$ZodCheck.init(inst, def);
|
|
1027
|
-
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1028
|
-
def.pattern ?? (def.pattern = pattern);
|
|
1029
|
-
inst._zod.onattach.push((inst) => {
|
|
1030
|
-
const bag = inst._zod.bag;
|
|
1031
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1032
|
-
bag.patterns.add(pattern);
|
|
1033
|
-
});
|
|
1034
|
-
inst._zod.check = (payload) => {
|
|
1035
|
-
if (payload.value.endsWith(def.suffix)) return;
|
|
1036
|
-
payload.issues.push({
|
|
1037
|
-
origin: "string",
|
|
1038
|
-
code: "invalid_format",
|
|
1039
|
-
format: "ends_with",
|
|
1040
|
-
suffix: def.suffix,
|
|
1041
|
-
input: payload.value,
|
|
1042
|
-
inst,
|
|
1043
|
-
continue: !def.abort
|
|
1044
|
-
});
|
|
1045
|
-
};
|
|
1046
|
-
});
|
|
1047
|
-
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1048
|
-
$ZodCheck.init(inst, def);
|
|
1049
|
-
inst._zod.check = (payload) => {
|
|
1050
|
-
payload.value = def.tx(payload.value);
|
|
1051
|
-
};
|
|
1052
|
-
});
|
|
1053
|
-
//#endregion
|
|
1054
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
1055
|
-
var Doc = class {
|
|
1056
|
-
constructor(args = []) {
|
|
1057
|
-
this.content = [];
|
|
1058
|
-
this.indent = 0;
|
|
1059
|
-
if (this) this.args = args;
|
|
1060
|
-
}
|
|
1061
|
-
indented(fn) {
|
|
1062
|
-
this.indent += 1;
|
|
1063
|
-
fn(this);
|
|
1064
|
-
this.indent -= 1;
|
|
1065
|
-
}
|
|
1066
|
-
write(arg) {
|
|
1067
|
-
if (typeof arg === "function") {
|
|
1068
|
-
arg(this, { execution: "sync" });
|
|
1069
|
-
arg(this, { execution: "async" });
|
|
1070
|
-
return;
|
|
1071
|
-
}
|
|
1072
|
-
const lines = arg.split("\n").filter((x) => x);
|
|
1073
|
-
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
1074
|
-
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
1075
|
-
for (const line of dedented) this.content.push(line);
|
|
1076
|
-
}
|
|
1077
|
-
compile() {
|
|
1078
|
-
const F = Function;
|
|
1079
|
-
const args = this?.args;
|
|
1080
|
-
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
1081
|
-
return new F(...args, lines.join("\n"));
|
|
1082
|
-
}
|
|
1083
|
-
};
|
|
1084
|
-
//#endregion
|
|
1085
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
1086
|
-
const version = {
|
|
1087
|
-
major: 4,
|
|
1088
|
-
minor: 3,
|
|
1089
|
-
patch: 6
|
|
1090
|
-
};
|
|
1091
|
-
//#endregion
|
|
1092
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
1093
|
-
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
1094
|
-
var _a;
|
|
1095
|
-
inst ?? (inst = {});
|
|
1096
|
-
inst._zod.def = def;
|
|
1097
|
-
inst._zod.bag = inst._zod.bag || {};
|
|
1098
|
-
inst._zod.version = version;
|
|
1099
|
-
const checks = [...inst._zod.def.checks ?? []];
|
|
1100
|
-
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
1101
|
-
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
1102
|
-
if (checks.length === 0) {
|
|
1103
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1104
|
-
inst._zod.deferred?.push(() => {
|
|
1105
|
-
inst._zod.run = inst._zod.parse;
|
|
1106
|
-
});
|
|
1107
|
-
} else {
|
|
1108
|
-
const runChecks = (payload, checks, ctx) => {
|
|
1109
|
-
let isAborted = aborted(payload);
|
|
1110
|
-
let asyncResult;
|
|
1111
|
-
for (const ch of checks) {
|
|
1112
|
-
if (ch._zod.def.when) {
|
|
1113
|
-
if (!ch._zod.def.when(payload)) continue;
|
|
1114
|
-
} else if (isAborted) continue;
|
|
1115
|
-
const currLen = payload.issues.length;
|
|
1116
|
-
const _ = ch._zod.check(payload);
|
|
1117
|
-
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
1118
|
-
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1119
|
-
await _;
|
|
1120
|
-
if (payload.issues.length === currLen) return;
|
|
1121
|
-
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1122
|
-
});
|
|
1123
|
-
else {
|
|
1124
|
-
if (payload.issues.length === currLen) continue;
|
|
1125
|
-
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
if (asyncResult) return asyncResult.then(() => {
|
|
1129
|
-
return payload;
|
|
1130
|
-
});
|
|
1131
|
-
return payload;
|
|
1132
|
-
};
|
|
1133
|
-
const handleCanaryResult = (canary, payload, ctx) => {
|
|
1134
|
-
if (aborted(canary)) {
|
|
1135
|
-
canary.aborted = true;
|
|
1136
|
-
return canary;
|
|
1137
|
-
}
|
|
1138
|
-
const checkResult = runChecks(payload, checks, ctx);
|
|
1139
|
-
if (checkResult instanceof Promise) {
|
|
1140
|
-
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1141
|
-
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
1142
|
-
}
|
|
1143
|
-
return inst._zod.parse(checkResult, ctx);
|
|
1144
|
-
};
|
|
1145
|
-
inst._zod.run = (payload, ctx) => {
|
|
1146
|
-
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
1147
|
-
if (ctx.direction === "backward") {
|
|
1148
|
-
const canary = inst._zod.parse({
|
|
1149
|
-
value: payload.value,
|
|
1150
|
-
issues: []
|
|
1151
|
-
}, {
|
|
1152
|
-
...ctx,
|
|
1153
|
-
skipChecks: true
|
|
1154
|
-
});
|
|
1155
|
-
if (canary instanceof Promise) return canary.then((canary) => {
|
|
1156
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
1157
|
-
});
|
|
1158
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
1159
|
-
}
|
|
1160
|
-
const result = inst._zod.parse(payload, ctx);
|
|
1161
|
-
if (result instanceof Promise) {
|
|
1162
|
-
if (ctx.async === false) throw new $ZodAsyncError();
|
|
1163
|
-
return result.then((result) => runChecks(result, checks, ctx));
|
|
1164
|
-
}
|
|
1165
|
-
return runChecks(result, checks, ctx);
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
defineLazy(inst, "~standard", () => ({
|
|
1169
|
-
validate: (value) => {
|
|
1170
|
-
try {
|
|
1171
|
-
const r = safeParse$1(inst, value);
|
|
1172
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1173
|
-
} catch (_) {
|
|
1174
|
-
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
1175
|
-
}
|
|
154
|
+
"subpackages": {
|
|
155
|
+
"type": "object[]",
|
|
156
|
+
"description": "分包结构配置。",
|
|
157
|
+
"x-wechat-min-version": "1.7.3"
|
|
1176
158
|
},
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
});
|
|
1311
|
-
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
1312
|
-
def.pattern ?? (def.pattern = duration$1);
|
|
1313
|
-
$ZodStringFormat.init(inst, def);
|
|
1314
|
-
});
|
|
1315
|
-
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
1316
|
-
def.pattern ?? (def.pattern = ipv4);
|
|
1317
|
-
$ZodStringFormat.init(inst, def);
|
|
1318
|
-
inst._zod.bag.format = `ipv4`;
|
|
1319
|
-
});
|
|
1320
|
-
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
1321
|
-
def.pattern ?? (def.pattern = ipv6);
|
|
1322
|
-
$ZodStringFormat.init(inst, def);
|
|
1323
|
-
inst._zod.bag.format = `ipv6`;
|
|
1324
|
-
inst._zod.check = (payload) => {
|
|
1325
|
-
try {
|
|
1326
|
-
new URL(`http://[${payload.value}]`);
|
|
1327
|
-
} catch {
|
|
1328
|
-
payload.issues.push({
|
|
1329
|
-
code: "invalid_format",
|
|
1330
|
-
format: "ipv6",
|
|
1331
|
-
input: payload.value,
|
|
1332
|
-
inst,
|
|
1333
|
-
continue: !def.abort
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
});
|
|
1338
|
-
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1339
|
-
def.pattern ?? (def.pattern = cidrv4);
|
|
1340
|
-
$ZodStringFormat.init(inst, def);
|
|
1341
|
-
});
|
|
1342
|
-
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1343
|
-
def.pattern ?? (def.pattern = cidrv6);
|
|
1344
|
-
$ZodStringFormat.init(inst, def);
|
|
1345
|
-
inst._zod.check = (payload) => {
|
|
1346
|
-
const parts = payload.value.split("/");
|
|
1347
|
-
try {
|
|
1348
|
-
if (parts.length !== 2) throw new Error();
|
|
1349
|
-
const [address, prefix] = parts;
|
|
1350
|
-
if (!prefix) throw new Error();
|
|
1351
|
-
const prefixNum = Number(prefix);
|
|
1352
|
-
if (`${prefixNum}` !== prefix) throw new Error();
|
|
1353
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1354
|
-
new URL(`http://[${address}]`);
|
|
1355
|
-
} catch {
|
|
1356
|
-
payload.issues.push({
|
|
1357
|
-
code: "invalid_format",
|
|
1358
|
-
format: "cidrv6",
|
|
1359
|
-
input: payload.value,
|
|
1360
|
-
inst,
|
|
1361
|
-
continue: !def.abort
|
|
1362
|
-
});
|
|
1363
|
-
}
|
|
1364
|
-
};
|
|
1365
|
-
});
|
|
1366
|
-
function isValidBase64(data) {
|
|
1367
|
-
if (data === "") return true;
|
|
1368
|
-
if (data.length % 4 !== 0) return false;
|
|
1369
|
-
try {
|
|
1370
|
-
atob(data);
|
|
1371
|
-
return true;
|
|
1372
|
-
} catch {
|
|
1373
|
-
return false;
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
1377
|
-
def.pattern ?? (def.pattern = base64);
|
|
1378
|
-
$ZodStringFormat.init(inst, def);
|
|
1379
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1380
|
-
inst._zod.check = (payload) => {
|
|
1381
|
-
if (isValidBase64(payload.value)) return;
|
|
1382
|
-
payload.issues.push({
|
|
1383
|
-
code: "invalid_format",
|
|
1384
|
-
format: "base64",
|
|
1385
|
-
input: payload.value,
|
|
1386
|
-
inst,
|
|
1387
|
-
continue: !def.abort
|
|
1388
|
-
});
|
|
1389
|
-
};
|
|
1390
|
-
});
|
|
1391
|
-
function isValidBase64URL(data) {
|
|
1392
|
-
if (!base64url.test(data)) return false;
|
|
1393
|
-
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1394
|
-
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1395
|
-
}
|
|
1396
|
-
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1397
|
-
def.pattern ?? (def.pattern = base64url);
|
|
1398
|
-
$ZodStringFormat.init(inst, def);
|
|
1399
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1400
|
-
inst._zod.check = (payload) => {
|
|
1401
|
-
if (isValidBase64URL(payload.value)) return;
|
|
1402
|
-
payload.issues.push({
|
|
1403
|
-
code: "invalid_format",
|
|
1404
|
-
format: "base64url",
|
|
1405
|
-
input: payload.value,
|
|
1406
|
-
inst,
|
|
1407
|
-
continue: !def.abort
|
|
1408
|
-
});
|
|
1409
|
-
};
|
|
1410
|
-
});
|
|
1411
|
-
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
1412
|
-
def.pattern ?? (def.pattern = e164);
|
|
1413
|
-
$ZodStringFormat.init(inst, def);
|
|
1414
|
-
});
|
|
1415
|
-
function isValidJWT(token, algorithm = null) {
|
|
1416
|
-
try {
|
|
1417
|
-
const tokensParts = token.split(".");
|
|
1418
|
-
if (tokensParts.length !== 3) return false;
|
|
1419
|
-
const [header] = tokensParts;
|
|
1420
|
-
if (!header) return false;
|
|
1421
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
1422
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
1423
|
-
if (!parsedHeader.alg) return false;
|
|
1424
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
1425
|
-
return true;
|
|
1426
|
-
} catch {
|
|
1427
|
-
return false;
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
1431
|
-
$ZodStringFormat.init(inst, def);
|
|
1432
|
-
inst._zod.check = (payload) => {
|
|
1433
|
-
if (isValidJWT(payload.value, def.alg)) return;
|
|
1434
|
-
payload.issues.push({
|
|
1435
|
-
code: "invalid_format",
|
|
1436
|
-
format: "jwt",
|
|
1437
|
-
input: payload.value,
|
|
1438
|
-
inst,
|
|
1439
|
-
continue: !def.abort
|
|
1440
|
-
});
|
|
1441
|
-
};
|
|
1442
|
-
});
|
|
1443
|
-
const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1444
|
-
$ZodType.init(inst, def);
|
|
1445
|
-
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
1446
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1447
|
-
if (def.coerce) try {
|
|
1448
|
-
payload.value = Number(payload.value);
|
|
1449
|
-
} catch (_) {}
|
|
1450
|
-
const input = payload.value;
|
|
1451
|
-
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
1452
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
1453
|
-
payload.issues.push({
|
|
1454
|
-
expected: "number",
|
|
1455
|
-
code: "invalid_type",
|
|
1456
|
-
input,
|
|
1457
|
-
inst,
|
|
1458
|
-
...received ? { received } : {}
|
|
1459
|
-
});
|
|
1460
|
-
return payload;
|
|
1461
|
-
};
|
|
1462
|
-
});
|
|
1463
|
-
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
1464
|
-
$ZodCheckNumberFormat.init(inst, def);
|
|
1465
|
-
$ZodNumber.init(inst, def);
|
|
1466
|
-
});
|
|
1467
|
-
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
1468
|
-
$ZodType.init(inst, def);
|
|
1469
|
-
inst._zod.pattern = boolean$1;
|
|
1470
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1471
|
-
if (def.coerce) try {
|
|
1472
|
-
payload.value = Boolean(payload.value);
|
|
1473
|
-
} catch (_) {}
|
|
1474
|
-
const input = payload.value;
|
|
1475
|
-
if (typeof input === "boolean") return payload;
|
|
1476
|
-
payload.issues.push({
|
|
1477
|
-
expected: "boolean",
|
|
1478
|
-
code: "invalid_type",
|
|
1479
|
-
input,
|
|
1480
|
-
inst
|
|
1481
|
-
});
|
|
1482
|
-
return payload;
|
|
1483
|
-
};
|
|
1484
|
-
});
|
|
1485
|
-
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
1486
|
-
$ZodType.init(inst, def);
|
|
1487
|
-
inst._zod.parse = (payload) => payload;
|
|
1488
|
-
});
|
|
1489
|
-
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
1490
|
-
$ZodType.init(inst, def);
|
|
1491
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1492
|
-
payload.issues.push({
|
|
1493
|
-
expected: "never",
|
|
1494
|
-
code: "invalid_type",
|
|
1495
|
-
input: payload.value,
|
|
1496
|
-
inst
|
|
1497
|
-
});
|
|
1498
|
-
return payload;
|
|
1499
|
-
};
|
|
1500
|
-
});
|
|
1501
|
-
function handleArrayResult(result, final, index) {
|
|
1502
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1503
|
-
final.value[index] = result.value;
|
|
1504
|
-
}
|
|
1505
|
-
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1506
|
-
$ZodType.init(inst, def);
|
|
1507
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1508
|
-
const input = payload.value;
|
|
1509
|
-
if (!Array.isArray(input)) {
|
|
1510
|
-
payload.issues.push({
|
|
1511
|
-
expected: "array",
|
|
1512
|
-
code: "invalid_type",
|
|
1513
|
-
input,
|
|
1514
|
-
inst
|
|
1515
|
-
});
|
|
1516
|
-
return payload;
|
|
1517
|
-
}
|
|
1518
|
-
payload.value = Array(input.length);
|
|
1519
|
-
const proms = [];
|
|
1520
|
-
for (let i = 0; i < input.length; i++) {
|
|
1521
|
-
const item = input[i];
|
|
1522
|
-
const result = def.element._zod.run({
|
|
1523
|
-
value: item,
|
|
1524
|
-
issues: []
|
|
1525
|
-
}, ctx);
|
|
1526
|
-
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
1527
|
-
else handleArrayResult(result, payload, i);
|
|
1528
|
-
}
|
|
1529
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1530
|
-
return payload;
|
|
1531
|
-
};
|
|
1532
|
-
});
|
|
1533
|
-
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
1534
|
-
if (result.issues.length) {
|
|
1535
|
-
if (isOptionalOut && !(key in input)) return;
|
|
1536
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
1537
|
-
}
|
|
1538
|
-
if (result.value === void 0) {
|
|
1539
|
-
if (key in input) final.value[key] = void 0;
|
|
1540
|
-
} else final.value[key] = result.value;
|
|
1541
|
-
}
|
|
1542
|
-
function normalizeDef(def) {
|
|
1543
|
-
const keys = Object.keys(def.shape);
|
|
1544
|
-
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
1545
|
-
const okeys = optionalKeys(def.shape);
|
|
1546
|
-
return {
|
|
1547
|
-
...def,
|
|
1548
|
-
keys,
|
|
1549
|
-
keySet: new Set(keys),
|
|
1550
|
-
numKeys: keys.length,
|
|
1551
|
-
optionalKeys: new Set(okeys)
|
|
1552
|
-
};
|
|
1553
|
-
}
|
|
1554
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1555
|
-
const unrecognized = [];
|
|
1556
|
-
const keySet = def.keySet;
|
|
1557
|
-
const _catchall = def.catchall._zod;
|
|
1558
|
-
const t = _catchall.def.type;
|
|
1559
|
-
const isOptionalOut = _catchall.optout === "optional";
|
|
1560
|
-
for (const key in input) {
|
|
1561
|
-
if (keySet.has(key)) continue;
|
|
1562
|
-
if (t === "never") {
|
|
1563
|
-
unrecognized.push(key);
|
|
1564
|
-
continue;
|
|
1565
|
-
}
|
|
1566
|
-
const r = _catchall.run({
|
|
1567
|
-
value: input[key],
|
|
1568
|
-
issues: []
|
|
1569
|
-
}, ctx);
|
|
1570
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
1571
|
-
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1572
|
-
}
|
|
1573
|
-
if (unrecognized.length) payload.issues.push({
|
|
1574
|
-
code: "unrecognized_keys",
|
|
1575
|
-
keys: unrecognized,
|
|
1576
|
-
input,
|
|
1577
|
-
inst
|
|
1578
|
-
});
|
|
1579
|
-
if (!proms.length) return payload;
|
|
1580
|
-
return Promise.all(proms).then(() => {
|
|
1581
|
-
return payload;
|
|
1582
|
-
});
|
|
1583
|
-
}
|
|
1584
|
-
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
1585
|
-
$ZodType.init(inst, def);
|
|
1586
|
-
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
1587
|
-
const sh = def.shape;
|
|
1588
|
-
Object.defineProperty(def, "shape", { get: () => {
|
|
1589
|
-
const newSh = { ...sh };
|
|
1590
|
-
Object.defineProperty(def, "shape", { value: newSh });
|
|
1591
|
-
return newSh;
|
|
1592
|
-
} });
|
|
1593
|
-
}
|
|
1594
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
1595
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
1596
|
-
const shape = def.shape;
|
|
1597
|
-
const propValues = {};
|
|
1598
|
-
for (const key in shape) {
|
|
1599
|
-
const field = shape[key]._zod;
|
|
1600
|
-
if (field.values) {
|
|
1601
|
-
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
1602
|
-
for (const v of field.values) propValues[key].add(v);
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
return propValues;
|
|
1606
|
-
});
|
|
1607
|
-
const isObject$2 = isObject;
|
|
1608
|
-
const catchall = def.catchall;
|
|
1609
|
-
let value;
|
|
1610
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1611
|
-
value ?? (value = _normalized.value);
|
|
1612
|
-
const input = payload.value;
|
|
1613
|
-
if (!isObject$2(input)) {
|
|
1614
|
-
payload.issues.push({
|
|
1615
|
-
expected: "object",
|
|
1616
|
-
code: "invalid_type",
|
|
1617
|
-
input,
|
|
1618
|
-
inst
|
|
1619
|
-
});
|
|
1620
|
-
return payload;
|
|
1621
|
-
}
|
|
1622
|
-
payload.value = {};
|
|
1623
|
-
const proms = [];
|
|
1624
|
-
const shape = value.shape;
|
|
1625
|
-
for (const key of value.keys) {
|
|
1626
|
-
const el = shape[key];
|
|
1627
|
-
const isOptionalOut = el._zod.optout === "optional";
|
|
1628
|
-
const r = el._zod.run({
|
|
1629
|
-
value: input[key],
|
|
1630
|
-
issues: []
|
|
1631
|
-
}, ctx);
|
|
1632
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
1633
|
-
else handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1634
|
-
}
|
|
1635
|
-
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1636
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1637
|
-
};
|
|
1638
|
-
});
|
|
1639
|
-
const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1640
|
-
$ZodObject.init(inst, def);
|
|
1641
|
-
const superParse = inst._zod.parse;
|
|
1642
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
1643
|
-
const generateFastpass = (shape) => {
|
|
1644
|
-
const doc = new Doc([
|
|
1645
|
-
"shape",
|
|
1646
|
-
"payload",
|
|
1647
|
-
"ctx"
|
|
1648
|
-
]);
|
|
1649
|
-
const normalized = _normalized.value;
|
|
1650
|
-
const parseStr = (key) => {
|
|
1651
|
-
const k = esc(key);
|
|
1652
|
-
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1653
|
-
};
|
|
1654
|
-
doc.write(`const input = payload.value;`);
|
|
1655
|
-
const ids = Object.create(null);
|
|
1656
|
-
let counter = 0;
|
|
1657
|
-
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
1658
|
-
doc.write(`const newResult = {};`);
|
|
1659
|
-
for (const key of normalized.keys) {
|
|
1660
|
-
const id = ids[key];
|
|
1661
|
-
const k = esc(key);
|
|
1662
|
-
const isOptionalOut = shape[key]?._zod?.optout === "optional";
|
|
1663
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1664
|
-
if (isOptionalOut) doc.write(`
|
|
1665
|
-
if (${id}.issues.length) {
|
|
1666
|
-
if (${k} in input) {
|
|
1667
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1668
|
-
...iss,
|
|
1669
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1670
|
-
})));
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
if (${id}.value === undefined) {
|
|
1675
|
-
if (${k} in input) {
|
|
1676
|
-
newResult[${k}] = undefined;
|
|
1677
|
-
}
|
|
1678
|
-
} else {
|
|
1679
|
-
newResult[${k}] = ${id}.value;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
`);
|
|
1683
|
-
else doc.write(`
|
|
1684
|
-
if (${id}.issues.length) {
|
|
1685
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1686
|
-
...iss,
|
|
1687
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1688
|
-
})));
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
if (${id}.value === undefined) {
|
|
1692
|
-
if (${k} in input) {
|
|
1693
|
-
newResult[${k}] = undefined;
|
|
1694
|
-
}
|
|
1695
|
-
} else {
|
|
1696
|
-
newResult[${k}] = ${id}.value;
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
`);
|
|
1700
|
-
}
|
|
1701
|
-
doc.write(`payload.value = newResult;`);
|
|
1702
|
-
doc.write(`return payload;`);
|
|
1703
|
-
const fn = doc.compile();
|
|
1704
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
1705
|
-
};
|
|
1706
|
-
let fastpass;
|
|
1707
|
-
const isObject$1 = isObject;
|
|
1708
|
-
const jit = !globalConfig.jitless;
|
|
1709
|
-
const fastEnabled = jit && allowsEval.value;
|
|
1710
|
-
const catchall = def.catchall;
|
|
1711
|
-
let value;
|
|
1712
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1713
|
-
value ?? (value = _normalized.value);
|
|
1714
|
-
const input = payload.value;
|
|
1715
|
-
if (!isObject$1(input)) {
|
|
1716
|
-
payload.issues.push({
|
|
1717
|
-
expected: "object",
|
|
1718
|
-
code: "invalid_type",
|
|
1719
|
-
input,
|
|
1720
|
-
inst
|
|
1721
|
-
});
|
|
1722
|
-
return payload;
|
|
1723
|
-
}
|
|
1724
|
-
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
1725
|
-
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
1726
|
-
payload = fastpass(payload, ctx);
|
|
1727
|
-
if (!catchall) return payload;
|
|
1728
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1729
|
-
}
|
|
1730
|
-
return superParse(payload, ctx);
|
|
1731
|
-
};
|
|
1732
|
-
});
|
|
1733
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
1734
|
-
for (const result of results) if (result.issues.length === 0) {
|
|
1735
|
-
final.value = result.value;
|
|
1736
|
-
return final;
|
|
1737
|
-
}
|
|
1738
|
-
const nonaborted = results.filter((r) => !aborted(r));
|
|
1739
|
-
if (nonaborted.length === 1) {
|
|
1740
|
-
final.value = nonaborted[0].value;
|
|
1741
|
-
return nonaborted[0];
|
|
1742
|
-
}
|
|
1743
|
-
final.issues.push({
|
|
1744
|
-
code: "invalid_union",
|
|
1745
|
-
input: final.value,
|
|
1746
|
-
inst,
|
|
1747
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1748
|
-
});
|
|
1749
|
-
return final;
|
|
1750
|
-
}
|
|
1751
|
-
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
1752
|
-
$ZodType.init(inst, def);
|
|
1753
|
-
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1754
|
-
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1755
|
-
defineLazy(inst._zod, "values", () => {
|
|
1756
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1757
|
-
});
|
|
1758
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
1759
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1760
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1761
|
-
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1762
|
-
}
|
|
1763
|
-
});
|
|
1764
|
-
const single = def.options.length === 1;
|
|
1765
|
-
const first = def.options[0]._zod.run;
|
|
1766
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1767
|
-
if (single) return first(payload, ctx);
|
|
1768
|
-
let async = false;
|
|
1769
|
-
const results = [];
|
|
1770
|
-
for (const option of def.options) {
|
|
1771
|
-
const result = option._zod.run({
|
|
1772
|
-
value: payload.value,
|
|
1773
|
-
issues: []
|
|
1774
|
-
}, ctx);
|
|
1775
|
-
if (result instanceof Promise) {
|
|
1776
|
-
results.push(result);
|
|
1777
|
-
async = true;
|
|
1778
|
-
} else {
|
|
1779
|
-
if (result.issues.length === 0) return result;
|
|
1780
|
-
results.push(result);
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
1784
|
-
return Promise.all(results).then((results) => {
|
|
1785
|
-
return handleUnionResults(results, payload, inst, ctx);
|
|
1786
|
-
});
|
|
1787
|
-
};
|
|
1788
|
-
});
|
|
1789
|
-
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
1790
|
-
$ZodType.init(inst, def);
|
|
1791
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1792
|
-
const input = payload.value;
|
|
1793
|
-
const left = def.left._zod.run({
|
|
1794
|
-
value: input,
|
|
1795
|
-
issues: []
|
|
1796
|
-
}, ctx);
|
|
1797
|
-
const right = def.right._zod.run({
|
|
1798
|
-
value: input,
|
|
1799
|
-
issues: []
|
|
1800
|
-
}, ctx);
|
|
1801
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
1802
|
-
return handleIntersectionResults(payload, left, right);
|
|
1803
|
-
});
|
|
1804
|
-
return handleIntersectionResults(payload, left, right);
|
|
1805
|
-
};
|
|
1806
|
-
});
|
|
1807
|
-
function mergeValues(a, b) {
|
|
1808
|
-
if (a === b) return {
|
|
1809
|
-
valid: true,
|
|
1810
|
-
data: a
|
|
1811
|
-
};
|
|
1812
|
-
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
1813
|
-
valid: true,
|
|
1814
|
-
data: a
|
|
1815
|
-
};
|
|
1816
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1817
|
-
const bKeys = Object.keys(b);
|
|
1818
|
-
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1819
|
-
const newObj = {
|
|
1820
|
-
...a,
|
|
1821
|
-
...b
|
|
1822
|
-
};
|
|
1823
|
-
for (const key of sharedKeys) {
|
|
1824
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
|
1825
|
-
if (!sharedValue.valid) return {
|
|
1826
|
-
valid: false,
|
|
1827
|
-
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
1828
|
-
};
|
|
1829
|
-
newObj[key] = sharedValue.data;
|
|
1830
|
-
}
|
|
1831
|
-
return {
|
|
1832
|
-
valid: true,
|
|
1833
|
-
data: newObj
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1837
|
-
if (a.length !== b.length) return {
|
|
1838
|
-
valid: false,
|
|
1839
|
-
mergeErrorPath: []
|
|
1840
|
-
};
|
|
1841
|
-
const newArray = [];
|
|
1842
|
-
for (let index = 0; index < a.length; index++) {
|
|
1843
|
-
const itemA = a[index];
|
|
1844
|
-
const itemB = b[index];
|
|
1845
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
1846
|
-
if (!sharedValue.valid) return {
|
|
1847
|
-
valid: false,
|
|
1848
|
-
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
1849
|
-
};
|
|
1850
|
-
newArray.push(sharedValue.data);
|
|
1851
|
-
}
|
|
1852
|
-
return {
|
|
1853
|
-
valid: true,
|
|
1854
|
-
data: newArray
|
|
1855
|
-
};
|
|
1856
|
-
}
|
|
1857
|
-
return {
|
|
1858
|
-
valid: false,
|
|
1859
|
-
mergeErrorPath: []
|
|
1860
|
-
};
|
|
1861
|
-
}
|
|
1862
|
-
function handleIntersectionResults(result, left, right) {
|
|
1863
|
-
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1864
|
-
let unrecIssue;
|
|
1865
|
-
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
1866
|
-
unrecIssue ?? (unrecIssue = iss);
|
|
1867
|
-
for (const k of iss.keys) {
|
|
1868
|
-
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1869
|
-
unrecKeys.get(k).l = true;
|
|
1870
|
-
}
|
|
1871
|
-
} else result.issues.push(iss);
|
|
1872
|
-
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
1873
|
-
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
1874
|
-
unrecKeys.get(k).r = true;
|
|
1875
|
-
}
|
|
1876
|
-
else result.issues.push(iss);
|
|
1877
|
-
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1878
|
-
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
1879
|
-
...unrecIssue,
|
|
1880
|
-
keys: bothKeys
|
|
1881
|
-
});
|
|
1882
|
-
if (aborted(result)) return result;
|
|
1883
|
-
const merged = mergeValues(left.value, right.value);
|
|
1884
|
-
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1885
|
-
result.value = merged.data;
|
|
1886
|
-
return result;
|
|
1887
|
-
}
|
|
1888
|
-
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
1889
|
-
$ZodType.init(inst, def);
|
|
1890
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1891
|
-
const input = payload.value;
|
|
1892
|
-
if (!isPlainObject(input)) {
|
|
1893
|
-
payload.issues.push({
|
|
1894
|
-
expected: "record",
|
|
1895
|
-
code: "invalid_type",
|
|
1896
|
-
input,
|
|
1897
|
-
inst
|
|
1898
|
-
});
|
|
1899
|
-
return payload;
|
|
1900
|
-
}
|
|
1901
|
-
const proms = [];
|
|
1902
|
-
const values = def.keyType._zod.values;
|
|
1903
|
-
if (values) {
|
|
1904
|
-
payload.value = {};
|
|
1905
|
-
const recordKeys = /* @__PURE__ */ new Set();
|
|
1906
|
-
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1907
|
-
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1908
|
-
const result = def.valueType._zod.run({
|
|
1909
|
-
value: input[key],
|
|
1910
|
-
issues: []
|
|
1911
|
-
}, ctx);
|
|
1912
|
-
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
1913
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1914
|
-
payload.value[key] = result.value;
|
|
1915
|
-
}));
|
|
1916
|
-
else {
|
|
1917
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1918
|
-
payload.value[key] = result.value;
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
let unrecognized;
|
|
1922
|
-
for (const key in input) if (!recordKeys.has(key)) {
|
|
1923
|
-
unrecognized = unrecognized ?? [];
|
|
1924
|
-
unrecognized.push(key);
|
|
1925
|
-
}
|
|
1926
|
-
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
1927
|
-
code: "unrecognized_keys",
|
|
1928
|
-
input,
|
|
1929
|
-
inst,
|
|
1930
|
-
keys: unrecognized
|
|
1931
|
-
});
|
|
1932
|
-
} else {
|
|
1933
|
-
payload.value = {};
|
|
1934
|
-
for (const key of Reflect.ownKeys(input)) {
|
|
1935
|
-
if (key === "__proto__") continue;
|
|
1936
|
-
let keyResult = def.keyType._zod.run({
|
|
1937
|
-
value: key,
|
|
1938
|
-
issues: []
|
|
1939
|
-
}, ctx);
|
|
1940
|
-
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
1941
|
-
if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
|
|
1942
|
-
const retryResult = def.keyType._zod.run({
|
|
1943
|
-
value: Number(key),
|
|
1944
|
-
issues: []
|
|
1945
|
-
}, ctx);
|
|
1946
|
-
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
1947
|
-
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
1948
|
-
}
|
|
1949
|
-
if (keyResult.issues.length) {
|
|
1950
|
-
if (def.mode === "loose") payload.value[key] = input[key];
|
|
1951
|
-
else payload.issues.push({
|
|
1952
|
-
code: "invalid_key",
|
|
1953
|
-
origin: "record",
|
|
1954
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1955
|
-
input: key,
|
|
1956
|
-
path: [key],
|
|
1957
|
-
inst
|
|
1958
|
-
});
|
|
1959
|
-
continue;
|
|
1960
|
-
}
|
|
1961
|
-
const result = def.valueType._zod.run({
|
|
1962
|
-
value: input[key],
|
|
1963
|
-
issues: []
|
|
1964
|
-
}, ctx);
|
|
1965
|
-
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
1966
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1967
|
-
payload.value[keyResult.value] = result.value;
|
|
1968
|
-
}));
|
|
1969
|
-
else {
|
|
1970
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
1971
|
-
payload.value[keyResult.value] = result.value;
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
1976
|
-
return payload;
|
|
1977
|
-
};
|
|
1978
|
-
});
|
|
1979
|
-
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
1980
|
-
$ZodType.init(inst, def);
|
|
1981
|
-
const values = getEnumValues(def.entries);
|
|
1982
|
-
const valuesSet = new Set(values);
|
|
1983
|
-
inst._zod.values = valuesSet;
|
|
1984
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1985
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1986
|
-
const input = payload.value;
|
|
1987
|
-
if (valuesSet.has(input)) return payload;
|
|
1988
|
-
payload.issues.push({
|
|
1989
|
-
code: "invalid_value",
|
|
1990
|
-
values,
|
|
1991
|
-
input,
|
|
1992
|
-
inst
|
|
1993
|
-
});
|
|
1994
|
-
return payload;
|
|
1995
|
-
};
|
|
1996
|
-
});
|
|
1997
|
-
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
1998
|
-
$ZodType.init(inst, def);
|
|
1999
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2000
|
-
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
2001
|
-
const _out = def.transform(payload.value, payload);
|
|
2002
|
-
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
2003
|
-
payload.value = output;
|
|
2004
|
-
return payload;
|
|
2005
|
-
});
|
|
2006
|
-
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
2007
|
-
payload.value = _out;
|
|
2008
|
-
return payload;
|
|
2009
|
-
};
|
|
2010
|
-
});
|
|
2011
|
-
function handleOptionalResult(result, input) {
|
|
2012
|
-
if (result.issues.length && input === void 0) return {
|
|
2013
|
-
issues: [],
|
|
2014
|
-
value: void 0
|
|
2015
|
-
};
|
|
2016
|
-
return result;
|
|
2017
|
-
}
|
|
2018
|
-
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
2019
|
-
$ZodType.init(inst, def);
|
|
2020
|
-
inst._zod.optin = "optional";
|
|
2021
|
-
inst._zod.optout = "optional";
|
|
2022
|
-
defineLazy(inst._zod, "values", () => {
|
|
2023
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2024
|
-
});
|
|
2025
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
2026
|
-
const pattern = def.innerType._zod.pattern;
|
|
2027
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2028
|
-
});
|
|
2029
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2030
|
-
if (def.innerType._zod.optin === "optional") {
|
|
2031
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2032
|
-
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
|
|
2033
|
-
return handleOptionalResult(result, payload.value);
|
|
2034
|
-
}
|
|
2035
|
-
if (payload.value === void 0) return payload;
|
|
2036
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2037
|
-
};
|
|
2038
|
-
});
|
|
2039
|
-
const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2040
|
-
$ZodOptional.init(inst, def);
|
|
2041
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2042
|
-
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
2043
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2044
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2045
|
-
};
|
|
2046
|
-
});
|
|
2047
|
-
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
2048
|
-
$ZodType.init(inst, def);
|
|
2049
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2050
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2051
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
2052
|
-
const pattern = def.innerType._zod.pattern;
|
|
2053
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2054
|
-
});
|
|
2055
|
-
defineLazy(inst._zod, "values", () => {
|
|
2056
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2057
|
-
});
|
|
2058
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2059
|
-
if (payload.value === null) return payload;
|
|
2060
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2061
|
-
};
|
|
2062
|
-
});
|
|
2063
|
-
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
2064
|
-
$ZodType.init(inst, def);
|
|
2065
|
-
inst._zod.optin = "optional";
|
|
2066
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2067
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2068
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2069
|
-
if (payload.value === void 0) {
|
|
2070
|
-
payload.value = def.defaultValue;
|
|
2071
|
-
/**
|
|
2072
|
-
* $ZodDefault returns the default value immediately in forward direction.
|
|
2073
|
-
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
2074
|
-
return payload;
|
|
2075
|
-
}
|
|
2076
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2077
|
-
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
2078
|
-
return handleDefaultResult(result, def);
|
|
2079
|
-
};
|
|
2080
|
-
});
|
|
2081
|
-
function handleDefaultResult(payload, def) {
|
|
2082
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2083
|
-
return payload;
|
|
2084
|
-
}
|
|
2085
|
-
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
2086
|
-
$ZodType.init(inst, def);
|
|
2087
|
-
inst._zod.optin = "optional";
|
|
2088
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2089
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2090
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2091
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2092
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2093
|
-
};
|
|
2094
|
-
});
|
|
2095
|
-
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2096
|
-
$ZodType.init(inst, def);
|
|
2097
|
-
defineLazy(inst._zod, "values", () => {
|
|
2098
|
-
const v = def.innerType._zod.values;
|
|
2099
|
-
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2100
|
-
});
|
|
2101
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2102
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2103
|
-
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
2104
|
-
return handleNonOptionalResult(result, inst);
|
|
2105
|
-
};
|
|
2106
|
-
});
|
|
2107
|
-
function handleNonOptionalResult(payload, inst) {
|
|
2108
|
-
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
2109
|
-
code: "invalid_type",
|
|
2110
|
-
expected: "nonoptional",
|
|
2111
|
-
input: payload.value,
|
|
2112
|
-
inst
|
|
2113
|
-
});
|
|
2114
|
-
return payload;
|
|
2115
|
-
}
|
|
2116
|
-
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
2117
|
-
$ZodType.init(inst, def);
|
|
2118
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2119
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2120
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2121
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2122
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2123
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2124
|
-
if (result instanceof Promise) return result.then((result) => {
|
|
2125
|
-
payload.value = result.value;
|
|
2126
|
-
if (result.issues.length) {
|
|
2127
|
-
payload.value = def.catchValue({
|
|
2128
|
-
...payload,
|
|
2129
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2130
|
-
input: payload.value
|
|
2131
|
-
});
|
|
2132
|
-
payload.issues = [];
|
|
2133
|
-
}
|
|
2134
|
-
return payload;
|
|
2135
|
-
});
|
|
2136
|
-
payload.value = result.value;
|
|
2137
|
-
if (result.issues.length) {
|
|
2138
|
-
payload.value = def.catchValue({
|
|
2139
|
-
...payload,
|
|
2140
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
2141
|
-
input: payload.value
|
|
2142
|
-
});
|
|
2143
|
-
payload.issues = [];
|
|
2144
|
-
}
|
|
2145
|
-
return payload;
|
|
2146
|
-
};
|
|
2147
|
-
});
|
|
2148
|
-
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
2149
|
-
$ZodType.init(inst, def);
|
|
2150
|
-
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
2151
|
-
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
2152
|
-
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
2153
|
-
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
2154
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2155
|
-
if (ctx.direction === "backward") {
|
|
2156
|
-
const right = def.out._zod.run(payload, ctx);
|
|
2157
|
-
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
2158
|
-
return handlePipeResult(right, def.in, ctx);
|
|
2159
|
-
}
|
|
2160
|
-
const left = def.in._zod.run(payload, ctx);
|
|
2161
|
-
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
2162
|
-
return handlePipeResult(left, def.out, ctx);
|
|
2163
|
-
};
|
|
2164
|
-
});
|
|
2165
|
-
function handlePipeResult(left, next, ctx) {
|
|
2166
|
-
if (left.issues.length) {
|
|
2167
|
-
left.aborted = true;
|
|
2168
|
-
return left;
|
|
2169
|
-
}
|
|
2170
|
-
return next._zod.run({
|
|
2171
|
-
value: left.value,
|
|
2172
|
-
issues: left.issues
|
|
2173
|
-
}, ctx);
|
|
2174
|
-
}
|
|
2175
|
-
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
2176
|
-
$ZodType.init(inst, def);
|
|
2177
|
-
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2178
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2179
|
-
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
2180
|
-
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
2181
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2182
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
2183
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2184
|
-
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
2185
|
-
return handleReadonlyResult(result);
|
|
2186
|
-
};
|
|
2187
|
-
});
|
|
2188
|
-
function handleReadonlyResult(payload) {
|
|
2189
|
-
payload.value = Object.freeze(payload.value);
|
|
2190
|
-
return payload;
|
|
2191
|
-
}
|
|
2192
|
-
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
2193
|
-
$ZodCheck.init(inst, def);
|
|
2194
|
-
$ZodType.init(inst, def);
|
|
2195
|
-
inst._zod.parse = (payload, _) => {
|
|
2196
|
-
return payload;
|
|
2197
|
-
};
|
|
2198
|
-
inst._zod.check = (payload) => {
|
|
2199
|
-
const input = payload.value;
|
|
2200
|
-
const r = def.fn(input);
|
|
2201
|
-
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
2202
|
-
handleRefineResult(r, payload, input, inst);
|
|
2203
|
-
};
|
|
2204
|
-
});
|
|
2205
|
-
function handleRefineResult(result, payload, input, inst) {
|
|
2206
|
-
if (!result) {
|
|
2207
|
-
const _iss = {
|
|
2208
|
-
code: "custom",
|
|
2209
|
-
input,
|
|
2210
|
-
inst,
|
|
2211
|
-
path: [...inst._zod.def.path ?? []],
|
|
2212
|
-
continue: !inst._zod.def.abort
|
|
2213
|
-
};
|
|
2214
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
2215
|
-
payload.issues.push(issue(_iss));
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
//#endregion
|
|
2219
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
2220
|
-
var _a;
|
|
2221
|
-
var $ZodRegistry = class {
|
|
2222
|
-
constructor() {
|
|
2223
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
2224
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
2225
|
-
}
|
|
2226
|
-
add(schema, ..._meta) {
|
|
2227
|
-
const meta = _meta[0];
|
|
2228
|
-
this._map.set(schema, meta);
|
|
2229
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
2230
|
-
return this;
|
|
2231
|
-
}
|
|
2232
|
-
clear() {
|
|
2233
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
2234
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
2235
|
-
return this;
|
|
2236
|
-
}
|
|
2237
|
-
remove(schema) {
|
|
2238
|
-
const meta = this._map.get(schema);
|
|
2239
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
2240
|
-
this._map.delete(schema);
|
|
2241
|
-
return this;
|
|
2242
|
-
}
|
|
2243
|
-
get(schema) {
|
|
2244
|
-
const p = schema._zod.parent;
|
|
2245
|
-
if (p) {
|
|
2246
|
-
const pm = { ...this.get(p) ?? {} };
|
|
2247
|
-
delete pm.id;
|
|
2248
|
-
const f = {
|
|
2249
|
-
...pm,
|
|
2250
|
-
...this._map.get(schema)
|
|
2251
|
-
};
|
|
2252
|
-
return Object.keys(f).length ? f : void 0;
|
|
2253
|
-
}
|
|
2254
|
-
return this._map.get(schema);
|
|
2255
|
-
}
|
|
2256
|
-
has(schema) {
|
|
2257
|
-
return this._map.has(schema);
|
|
2258
|
-
}
|
|
2259
|
-
};
|
|
2260
|
-
function registry() {
|
|
2261
|
-
return new $ZodRegistry();
|
|
2262
|
-
}
|
|
2263
|
-
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2264
|
-
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2265
|
-
//#endregion
|
|
2266
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
2267
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2268
|
-
function _string(Class, params) {
|
|
2269
|
-
return new Class({
|
|
2270
|
-
type: "string",
|
|
2271
|
-
...normalizeParams(params)
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2275
|
-
function _email(Class, params) {
|
|
2276
|
-
return new Class({
|
|
2277
|
-
type: "string",
|
|
2278
|
-
format: "email",
|
|
2279
|
-
check: "string_format",
|
|
2280
|
-
abort: false,
|
|
2281
|
-
...normalizeParams(params)
|
|
2282
|
-
});
|
|
2283
|
-
}
|
|
2284
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2285
|
-
function _guid(Class, params) {
|
|
2286
|
-
return new Class({
|
|
2287
|
-
type: "string",
|
|
2288
|
-
format: "guid",
|
|
2289
|
-
check: "string_format",
|
|
2290
|
-
abort: false,
|
|
2291
|
-
...normalizeParams(params)
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2295
|
-
function _uuid(Class, params) {
|
|
2296
|
-
return new Class({
|
|
2297
|
-
type: "string",
|
|
2298
|
-
format: "uuid",
|
|
2299
|
-
check: "string_format",
|
|
2300
|
-
abort: false,
|
|
2301
|
-
...normalizeParams(params)
|
|
2302
|
-
});
|
|
2303
|
-
}
|
|
2304
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2305
|
-
function _uuidv4(Class, params) {
|
|
2306
|
-
return new Class({
|
|
2307
|
-
type: "string",
|
|
2308
|
-
format: "uuid",
|
|
2309
|
-
check: "string_format",
|
|
2310
|
-
abort: false,
|
|
2311
|
-
version: "v4",
|
|
2312
|
-
...normalizeParams(params)
|
|
2313
|
-
});
|
|
2314
|
-
}
|
|
2315
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2316
|
-
function _uuidv6(Class, params) {
|
|
2317
|
-
return new Class({
|
|
2318
|
-
type: "string",
|
|
2319
|
-
format: "uuid",
|
|
2320
|
-
check: "string_format",
|
|
2321
|
-
abort: false,
|
|
2322
|
-
version: "v6",
|
|
2323
|
-
...normalizeParams(params)
|
|
2324
|
-
});
|
|
2325
|
-
}
|
|
2326
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2327
|
-
function _uuidv7(Class, params) {
|
|
2328
|
-
return new Class({
|
|
2329
|
-
type: "string",
|
|
2330
|
-
format: "uuid",
|
|
2331
|
-
check: "string_format",
|
|
2332
|
-
abort: false,
|
|
2333
|
-
version: "v7",
|
|
2334
|
-
...normalizeParams(params)
|
|
2335
|
-
});
|
|
2336
|
-
}
|
|
2337
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2338
|
-
function _url(Class, params) {
|
|
2339
|
-
return new Class({
|
|
2340
|
-
type: "string",
|
|
2341
|
-
format: "url",
|
|
2342
|
-
check: "string_format",
|
|
2343
|
-
abort: false,
|
|
2344
|
-
...normalizeParams(params)
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2348
|
-
function _emoji(Class, params) {
|
|
2349
|
-
return new Class({
|
|
2350
|
-
type: "string",
|
|
2351
|
-
format: "emoji",
|
|
2352
|
-
check: "string_format",
|
|
2353
|
-
abort: false,
|
|
2354
|
-
...normalizeParams(params)
|
|
2355
|
-
});
|
|
2356
|
-
}
|
|
2357
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2358
|
-
function _nanoid(Class, params) {
|
|
2359
|
-
return new Class({
|
|
2360
|
-
type: "string",
|
|
2361
|
-
format: "nanoid",
|
|
2362
|
-
check: "string_format",
|
|
2363
|
-
abort: false,
|
|
2364
|
-
...normalizeParams(params)
|
|
2365
|
-
});
|
|
2366
|
-
}
|
|
2367
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2368
|
-
function _cuid(Class, params) {
|
|
2369
|
-
return new Class({
|
|
2370
|
-
type: "string",
|
|
2371
|
-
format: "cuid",
|
|
2372
|
-
check: "string_format",
|
|
2373
|
-
abort: false,
|
|
2374
|
-
...normalizeParams(params)
|
|
2375
|
-
});
|
|
2376
|
-
}
|
|
2377
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2378
|
-
function _cuid2(Class, params) {
|
|
2379
|
-
return new Class({
|
|
2380
|
-
type: "string",
|
|
2381
|
-
format: "cuid2",
|
|
2382
|
-
check: "string_format",
|
|
2383
|
-
abort: false,
|
|
2384
|
-
...normalizeParams(params)
|
|
2385
|
-
});
|
|
2386
|
-
}
|
|
2387
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2388
|
-
function _ulid(Class, params) {
|
|
2389
|
-
return new Class({
|
|
2390
|
-
type: "string",
|
|
2391
|
-
format: "ulid",
|
|
2392
|
-
check: "string_format",
|
|
2393
|
-
abort: false,
|
|
2394
|
-
...normalizeParams(params)
|
|
2395
|
-
});
|
|
2396
|
-
}
|
|
2397
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2398
|
-
function _xid(Class, params) {
|
|
2399
|
-
return new Class({
|
|
2400
|
-
type: "string",
|
|
2401
|
-
format: "xid",
|
|
2402
|
-
check: "string_format",
|
|
2403
|
-
abort: false,
|
|
2404
|
-
...normalizeParams(params)
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2408
|
-
function _ksuid(Class, params) {
|
|
2409
|
-
return new Class({
|
|
2410
|
-
type: "string",
|
|
2411
|
-
format: "ksuid",
|
|
2412
|
-
check: "string_format",
|
|
2413
|
-
abort: false,
|
|
2414
|
-
...normalizeParams(params)
|
|
2415
|
-
});
|
|
2416
|
-
}
|
|
2417
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2418
|
-
function _ipv4(Class, params) {
|
|
2419
|
-
return new Class({
|
|
2420
|
-
type: "string",
|
|
2421
|
-
format: "ipv4",
|
|
2422
|
-
check: "string_format",
|
|
2423
|
-
abort: false,
|
|
2424
|
-
...normalizeParams(params)
|
|
2425
|
-
});
|
|
2426
|
-
}
|
|
2427
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2428
|
-
function _ipv6(Class, params) {
|
|
2429
|
-
return new Class({
|
|
2430
|
-
type: "string",
|
|
2431
|
-
format: "ipv6",
|
|
2432
|
-
check: "string_format",
|
|
2433
|
-
abort: false,
|
|
2434
|
-
...normalizeParams(params)
|
|
2435
|
-
});
|
|
2436
|
-
}
|
|
2437
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2438
|
-
function _cidrv4(Class, params) {
|
|
2439
|
-
return new Class({
|
|
2440
|
-
type: "string",
|
|
2441
|
-
format: "cidrv4",
|
|
2442
|
-
check: "string_format",
|
|
2443
|
-
abort: false,
|
|
2444
|
-
...normalizeParams(params)
|
|
2445
|
-
});
|
|
2446
|
-
}
|
|
2447
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2448
|
-
function _cidrv6(Class, params) {
|
|
2449
|
-
return new Class({
|
|
2450
|
-
type: "string",
|
|
2451
|
-
format: "cidrv6",
|
|
2452
|
-
check: "string_format",
|
|
2453
|
-
abort: false,
|
|
2454
|
-
...normalizeParams(params)
|
|
2455
|
-
});
|
|
2456
|
-
}
|
|
2457
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2458
|
-
function _base64(Class, params) {
|
|
2459
|
-
return new Class({
|
|
2460
|
-
type: "string",
|
|
2461
|
-
format: "base64",
|
|
2462
|
-
check: "string_format",
|
|
2463
|
-
abort: false,
|
|
2464
|
-
...normalizeParams(params)
|
|
2465
|
-
});
|
|
2466
|
-
}
|
|
2467
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2468
|
-
function _base64url(Class, params) {
|
|
2469
|
-
return new Class({
|
|
2470
|
-
type: "string",
|
|
2471
|
-
format: "base64url",
|
|
2472
|
-
check: "string_format",
|
|
2473
|
-
abort: false,
|
|
2474
|
-
...normalizeParams(params)
|
|
2475
|
-
});
|
|
2476
|
-
}
|
|
2477
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2478
|
-
function _e164(Class, params) {
|
|
2479
|
-
return new Class({
|
|
2480
|
-
type: "string",
|
|
2481
|
-
format: "e164",
|
|
2482
|
-
check: "string_format",
|
|
2483
|
-
abort: false,
|
|
2484
|
-
...normalizeParams(params)
|
|
2485
|
-
});
|
|
2486
|
-
}
|
|
2487
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2488
|
-
function _jwt(Class, params) {
|
|
2489
|
-
return new Class({
|
|
2490
|
-
type: "string",
|
|
2491
|
-
format: "jwt",
|
|
2492
|
-
check: "string_format",
|
|
2493
|
-
abort: false,
|
|
2494
|
-
...normalizeParams(params)
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2498
|
-
function _isoDateTime(Class, params) {
|
|
2499
|
-
return new Class({
|
|
2500
|
-
type: "string",
|
|
2501
|
-
format: "datetime",
|
|
2502
|
-
check: "string_format",
|
|
2503
|
-
offset: false,
|
|
2504
|
-
local: false,
|
|
2505
|
-
precision: null,
|
|
2506
|
-
...normalizeParams(params)
|
|
2507
|
-
});
|
|
2508
|
-
}
|
|
2509
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2510
|
-
function _isoDate(Class, params) {
|
|
2511
|
-
return new Class({
|
|
2512
|
-
type: "string",
|
|
2513
|
-
format: "date",
|
|
2514
|
-
check: "string_format",
|
|
2515
|
-
...normalizeParams(params)
|
|
2516
|
-
});
|
|
2517
|
-
}
|
|
2518
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2519
|
-
function _isoTime(Class, params) {
|
|
2520
|
-
return new Class({
|
|
2521
|
-
type: "string",
|
|
2522
|
-
format: "time",
|
|
2523
|
-
check: "string_format",
|
|
2524
|
-
precision: null,
|
|
2525
|
-
...normalizeParams(params)
|
|
2526
|
-
});
|
|
2527
|
-
}
|
|
2528
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2529
|
-
function _isoDuration(Class, params) {
|
|
2530
|
-
return new Class({
|
|
2531
|
-
type: "string",
|
|
2532
|
-
format: "duration",
|
|
2533
|
-
check: "string_format",
|
|
2534
|
-
...normalizeParams(params)
|
|
2535
|
-
});
|
|
2536
|
-
}
|
|
2537
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2538
|
-
function _number(Class, params) {
|
|
2539
|
-
return new Class({
|
|
2540
|
-
type: "number",
|
|
2541
|
-
checks: [],
|
|
2542
|
-
...normalizeParams(params)
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2546
|
-
function _int(Class, params) {
|
|
2547
|
-
return new Class({
|
|
2548
|
-
type: "number",
|
|
2549
|
-
check: "number_format",
|
|
2550
|
-
abort: false,
|
|
2551
|
-
format: "safeint",
|
|
2552
|
-
...normalizeParams(params)
|
|
2553
|
-
});
|
|
2554
|
-
}
|
|
2555
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2556
|
-
function _boolean(Class, params) {
|
|
2557
|
-
return new Class({
|
|
2558
|
-
type: "boolean",
|
|
2559
|
-
...normalizeParams(params)
|
|
2560
|
-
});
|
|
2561
|
-
}
|
|
2562
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2563
|
-
function _unknown(Class) {
|
|
2564
|
-
return new Class({ type: "unknown" });
|
|
2565
|
-
}
|
|
2566
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2567
|
-
function _never(Class, params) {
|
|
2568
|
-
return new Class({
|
|
2569
|
-
type: "never",
|
|
2570
|
-
...normalizeParams(params)
|
|
2571
|
-
});
|
|
2572
|
-
}
|
|
2573
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2574
|
-
function _lt(value, params) {
|
|
2575
|
-
return new $ZodCheckLessThan({
|
|
2576
|
-
check: "less_than",
|
|
2577
|
-
...normalizeParams(params),
|
|
2578
|
-
value,
|
|
2579
|
-
inclusive: false
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2583
|
-
function _lte(value, params) {
|
|
2584
|
-
return new $ZodCheckLessThan({
|
|
2585
|
-
check: "less_than",
|
|
2586
|
-
...normalizeParams(params),
|
|
2587
|
-
value,
|
|
2588
|
-
inclusive: true
|
|
2589
|
-
});
|
|
2590
|
-
}
|
|
2591
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2592
|
-
function _gt(value, params) {
|
|
2593
|
-
return new $ZodCheckGreaterThan({
|
|
2594
|
-
check: "greater_than",
|
|
2595
|
-
...normalizeParams(params),
|
|
2596
|
-
value,
|
|
2597
|
-
inclusive: false
|
|
2598
|
-
});
|
|
2599
|
-
}
|
|
2600
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2601
|
-
function _gte(value, params) {
|
|
2602
|
-
return new $ZodCheckGreaterThan({
|
|
2603
|
-
check: "greater_than",
|
|
2604
|
-
...normalizeParams(params),
|
|
2605
|
-
value,
|
|
2606
|
-
inclusive: true
|
|
2607
|
-
});
|
|
2608
|
-
}
|
|
2609
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2610
|
-
function _multipleOf(value, params) {
|
|
2611
|
-
return new $ZodCheckMultipleOf({
|
|
2612
|
-
check: "multiple_of",
|
|
2613
|
-
...normalizeParams(params),
|
|
2614
|
-
value
|
|
2615
|
-
});
|
|
2616
|
-
}
|
|
2617
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2618
|
-
function _maxLength(maximum, params) {
|
|
2619
|
-
return new $ZodCheckMaxLength({
|
|
2620
|
-
check: "max_length",
|
|
2621
|
-
...normalizeParams(params),
|
|
2622
|
-
maximum
|
|
2623
|
-
});
|
|
2624
|
-
}
|
|
2625
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2626
|
-
function _minLength(minimum, params) {
|
|
2627
|
-
return new $ZodCheckMinLength({
|
|
2628
|
-
check: "min_length",
|
|
2629
|
-
...normalizeParams(params),
|
|
2630
|
-
minimum
|
|
2631
|
-
});
|
|
2632
|
-
}
|
|
2633
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2634
|
-
function _length(length, params) {
|
|
2635
|
-
return new $ZodCheckLengthEquals({
|
|
2636
|
-
check: "length_equals",
|
|
2637
|
-
...normalizeParams(params),
|
|
2638
|
-
length
|
|
2639
|
-
});
|
|
2640
|
-
}
|
|
2641
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2642
|
-
function _regex(pattern, params) {
|
|
2643
|
-
return new $ZodCheckRegex({
|
|
2644
|
-
check: "string_format",
|
|
2645
|
-
format: "regex",
|
|
2646
|
-
...normalizeParams(params),
|
|
2647
|
-
pattern
|
|
2648
|
-
});
|
|
2649
|
-
}
|
|
2650
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2651
|
-
function _lowercase(params) {
|
|
2652
|
-
return new $ZodCheckLowerCase({
|
|
2653
|
-
check: "string_format",
|
|
2654
|
-
format: "lowercase",
|
|
2655
|
-
...normalizeParams(params)
|
|
2656
|
-
});
|
|
2657
|
-
}
|
|
2658
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2659
|
-
function _uppercase(params) {
|
|
2660
|
-
return new $ZodCheckUpperCase({
|
|
2661
|
-
check: "string_format",
|
|
2662
|
-
format: "uppercase",
|
|
2663
|
-
...normalizeParams(params)
|
|
2664
|
-
});
|
|
2665
|
-
}
|
|
2666
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2667
|
-
function _includes(includes, params) {
|
|
2668
|
-
return new $ZodCheckIncludes({
|
|
2669
|
-
check: "string_format",
|
|
2670
|
-
format: "includes",
|
|
2671
|
-
...normalizeParams(params),
|
|
2672
|
-
includes
|
|
2673
|
-
});
|
|
2674
|
-
}
|
|
2675
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2676
|
-
function _startsWith(prefix, params) {
|
|
2677
|
-
return new $ZodCheckStartsWith({
|
|
2678
|
-
check: "string_format",
|
|
2679
|
-
format: "starts_with",
|
|
2680
|
-
...normalizeParams(params),
|
|
2681
|
-
prefix
|
|
2682
|
-
});
|
|
2683
|
-
}
|
|
2684
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2685
|
-
function _endsWith(suffix, params) {
|
|
2686
|
-
return new $ZodCheckEndsWith({
|
|
2687
|
-
check: "string_format",
|
|
2688
|
-
format: "ends_with",
|
|
2689
|
-
...normalizeParams(params),
|
|
2690
|
-
suffix
|
|
2691
|
-
});
|
|
2692
|
-
}
|
|
2693
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2694
|
-
function _overwrite(tx) {
|
|
2695
|
-
return new $ZodCheckOverwrite({
|
|
2696
|
-
check: "overwrite",
|
|
2697
|
-
tx
|
|
2698
|
-
});
|
|
2699
|
-
}
|
|
2700
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2701
|
-
function _normalize(form) {
|
|
2702
|
-
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
2703
|
-
}
|
|
2704
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2705
|
-
function _trim() {
|
|
2706
|
-
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
2707
|
-
}
|
|
2708
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2709
|
-
function _toLowerCase() {
|
|
2710
|
-
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
2711
|
-
}
|
|
2712
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2713
|
-
function _toUpperCase() {
|
|
2714
|
-
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
2715
|
-
}
|
|
2716
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2717
|
-
function _slugify() {
|
|
2718
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
2719
|
-
}
|
|
2720
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2721
|
-
function _array(Class, element, params) {
|
|
2722
|
-
return new Class({
|
|
2723
|
-
type: "array",
|
|
2724
|
-
element,
|
|
2725
|
-
...normalizeParams(params)
|
|
2726
|
-
});
|
|
2727
|
-
}
|
|
2728
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2729
|
-
function _refine(Class, fn, _params) {
|
|
2730
|
-
return new Class({
|
|
2731
|
-
type: "custom",
|
|
2732
|
-
check: "custom",
|
|
2733
|
-
fn,
|
|
2734
|
-
...normalizeParams(_params)
|
|
2735
|
-
});
|
|
2736
|
-
}
|
|
2737
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2738
|
-
function _superRefine(fn) {
|
|
2739
|
-
const ch = /* @__PURE__ */ _check((payload) => {
|
|
2740
|
-
payload.addIssue = (issue$2) => {
|
|
2741
|
-
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
2742
|
-
else {
|
|
2743
|
-
const _issue = issue$2;
|
|
2744
|
-
if (_issue.fatal) _issue.continue = false;
|
|
2745
|
-
_issue.code ?? (_issue.code = "custom");
|
|
2746
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
2747
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
2748
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2749
|
-
payload.issues.push(issue(_issue));
|
|
2750
|
-
}
|
|
2751
|
-
};
|
|
2752
|
-
return fn(payload.value, payload);
|
|
2753
|
-
});
|
|
2754
|
-
return ch;
|
|
2755
|
-
}
|
|
2756
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2757
|
-
function _check(fn, params) {
|
|
2758
|
-
const ch = new $ZodCheck({
|
|
2759
|
-
check: "custom",
|
|
2760
|
-
...normalizeParams(params)
|
|
2761
|
-
});
|
|
2762
|
-
ch._zod.check = fn;
|
|
2763
|
-
return ch;
|
|
2764
|
-
}
|
|
2765
|
-
//#endregion
|
|
2766
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
2767
|
-
function initializeContext(params) {
|
|
2768
|
-
let target = params?.target ?? "draft-2020-12";
|
|
2769
|
-
if (target === "draft-4") target = "draft-04";
|
|
2770
|
-
if (target === "draft-7") target = "draft-07";
|
|
2771
|
-
return {
|
|
2772
|
-
processors: params.processors ?? {},
|
|
2773
|
-
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
2774
|
-
target,
|
|
2775
|
-
unrepresentable: params?.unrepresentable ?? "throw",
|
|
2776
|
-
override: params?.override ?? (() => {}),
|
|
2777
|
-
io: params?.io ?? "output",
|
|
2778
|
-
counter: 0,
|
|
2779
|
-
seen: /* @__PURE__ */ new Map(),
|
|
2780
|
-
cycles: params?.cycles ?? "ref",
|
|
2781
|
-
reused: params?.reused ?? "inline",
|
|
2782
|
-
external: params?.external ?? void 0
|
|
2783
|
-
};
|
|
2784
|
-
}
|
|
2785
|
-
function process$1(schema, ctx, _params = {
|
|
2786
|
-
path: [],
|
|
2787
|
-
schemaPath: []
|
|
2788
|
-
}) {
|
|
2789
|
-
var _a;
|
|
2790
|
-
const def = schema._zod.def;
|
|
2791
|
-
const seen = ctx.seen.get(schema);
|
|
2792
|
-
if (seen) {
|
|
2793
|
-
seen.count++;
|
|
2794
|
-
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
2795
|
-
return seen.schema;
|
|
2796
|
-
}
|
|
2797
|
-
const result = {
|
|
2798
|
-
schema: {},
|
|
2799
|
-
count: 1,
|
|
2800
|
-
cycle: void 0,
|
|
2801
|
-
path: _params.path
|
|
2802
|
-
};
|
|
2803
|
-
ctx.seen.set(schema, result);
|
|
2804
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2805
|
-
if (overrideSchema) result.schema = overrideSchema;
|
|
2806
|
-
else {
|
|
2807
|
-
const params = {
|
|
2808
|
-
..._params,
|
|
2809
|
-
schemaPath: [..._params.schemaPath, schema],
|
|
2810
|
-
path: _params.path
|
|
2811
|
-
};
|
|
2812
|
-
if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
2813
|
-
else {
|
|
2814
|
-
const _json = result.schema;
|
|
2815
|
-
const processor = ctx.processors[def.type];
|
|
2816
|
-
if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
2817
|
-
processor(schema, ctx, _json, params);
|
|
2818
|
-
}
|
|
2819
|
-
const parent = schema._zod.parent;
|
|
2820
|
-
if (parent) {
|
|
2821
|
-
if (!result.ref) result.ref = parent;
|
|
2822
|
-
process$1(parent, ctx, params);
|
|
2823
|
-
ctx.seen.get(parent).isParent = true;
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
const meta = ctx.metadataRegistry.get(schema);
|
|
2827
|
-
if (meta) Object.assign(result.schema, meta);
|
|
2828
|
-
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2829
|
-
delete result.schema.examples;
|
|
2830
|
-
delete result.schema.default;
|
|
2831
|
-
}
|
|
2832
|
-
if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
2833
|
-
delete result.schema._prefault;
|
|
2834
|
-
return ctx.seen.get(schema).schema;
|
|
2835
|
-
}
|
|
2836
|
-
function extractDefs(ctx, schema) {
|
|
2837
|
-
const root = ctx.seen.get(schema);
|
|
2838
|
-
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2839
|
-
const idToSchema = /* @__PURE__ */ new Map();
|
|
2840
|
-
for (const entry of ctx.seen.entries()) {
|
|
2841
|
-
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
2842
|
-
if (id) {
|
|
2843
|
-
const existing = idToSchema.get(id);
|
|
2844
|
-
if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
2845
|
-
idToSchema.set(id, entry[0]);
|
|
2846
|
-
}
|
|
2847
|
-
}
|
|
2848
|
-
const makeURI = (entry) => {
|
|
2849
|
-
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2850
|
-
if (ctx.external) {
|
|
2851
|
-
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
2852
|
-
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
2853
|
-
if (externalId) return { ref: uriGenerator(externalId) };
|
|
2854
|
-
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
2855
|
-
entry[1].defId = id;
|
|
2856
|
-
return {
|
|
2857
|
-
defId: id,
|
|
2858
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
2859
|
-
};
|
|
2860
|
-
}
|
|
2861
|
-
if (entry[1] === root) return { ref: "#" };
|
|
2862
|
-
const defUriPrefix = `#/${defsSegment}/`;
|
|
2863
|
-
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2864
|
-
return {
|
|
2865
|
-
defId,
|
|
2866
|
-
ref: defUriPrefix + defId
|
|
2867
|
-
};
|
|
2868
|
-
};
|
|
2869
|
-
const extractToDef = (entry) => {
|
|
2870
|
-
if (entry[1].schema.$ref) return;
|
|
2871
|
-
const seen = entry[1];
|
|
2872
|
-
const { ref, defId } = makeURI(entry);
|
|
2873
|
-
seen.def = { ...seen.schema };
|
|
2874
|
-
if (defId) seen.defId = defId;
|
|
2875
|
-
const schema = seen.schema;
|
|
2876
|
-
for (const key in schema) delete schema[key];
|
|
2877
|
-
schema.$ref = ref;
|
|
2878
|
-
};
|
|
2879
|
-
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
2880
|
-
const seen = entry[1];
|
|
2881
|
-
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
2882
|
-
|
|
2883
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
2884
|
-
}
|
|
2885
|
-
for (const entry of ctx.seen.entries()) {
|
|
2886
|
-
const seen = entry[1];
|
|
2887
|
-
if (schema === entry[0]) {
|
|
2888
|
-
extractToDef(entry);
|
|
2889
|
-
continue;
|
|
2890
|
-
}
|
|
2891
|
-
if (ctx.external) {
|
|
2892
|
-
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
2893
|
-
if (schema !== entry[0] && ext) {
|
|
2894
|
-
extractToDef(entry);
|
|
2895
|
-
continue;
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
if (ctx.metadataRegistry.get(entry[0])?.id) {
|
|
2899
|
-
extractToDef(entry);
|
|
2900
|
-
continue;
|
|
2901
|
-
}
|
|
2902
|
-
if (seen.cycle) {
|
|
2903
|
-
extractToDef(entry);
|
|
2904
|
-
continue;
|
|
2905
|
-
}
|
|
2906
|
-
if (seen.count > 1) {
|
|
2907
|
-
if (ctx.reused === "ref") {
|
|
2908
|
-
extractToDef(entry);
|
|
2909
|
-
continue;
|
|
2910
|
-
}
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
}
|
|
2914
|
-
function finalize(ctx, schema) {
|
|
2915
|
-
const root = ctx.seen.get(schema);
|
|
2916
|
-
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2917
|
-
const flattenRef = (zodSchema) => {
|
|
2918
|
-
const seen = ctx.seen.get(zodSchema);
|
|
2919
|
-
if (seen.ref === null) return;
|
|
2920
|
-
const schema = seen.def ?? seen.schema;
|
|
2921
|
-
const _cached = { ...schema };
|
|
2922
|
-
const ref = seen.ref;
|
|
2923
|
-
seen.ref = null;
|
|
2924
|
-
if (ref) {
|
|
2925
|
-
flattenRef(ref);
|
|
2926
|
-
const refSeen = ctx.seen.get(ref);
|
|
2927
|
-
const refSchema = refSeen.schema;
|
|
2928
|
-
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2929
|
-
schema.allOf = schema.allOf ?? [];
|
|
2930
|
-
schema.allOf.push(refSchema);
|
|
2931
|
-
} else Object.assign(schema, refSchema);
|
|
2932
|
-
Object.assign(schema, _cached);
|
|
2933
|
-
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
2934
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
2935
|
-
if (!(key in _cached)) delete schema[key];
|
|
2936
|
-
}
|
|
2937
|
-
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
2938
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
2939
|
-
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
const parent = zodSchema._zod.parent;
|
|
2943
|
-
if (parent && parent !== ref) {
|
|
2944
|
-
flattenRef(parent);
|
|
2945
|
-
const parentSeen = ctx.seen.get(parent);
|
|
2946
|
-
if (parentSeen?.schema.$ref) {
|
|
2947
|
-
schema.$ref = parentSeen.schema.$ref;
|
|
2948
|
-
if (parentSeen.def) for (const key in schema) {
|
|
2949
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
2950
|
-
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
159
|
+
"workers": {
|
|
160
|
+
"type": "string | object",
|
|
161
|
+
"description": "Worker 代码放置的目录。"
|
|
162
|
+
},
|
|
163
|
+
"requiredBackgroundModes": {
|
|
164
|
+
"type": "string[]",
|
|
165
|
+
"description": "需要在后台使用的能力。"
|
|
166
|
+
},
|
|
167
|
+
"requiredPrivateInfos": {
|
|
168
|
+
"type": "string[]",
|
|
169
|
+
"description": "调用的地理位置相关隐私接口。"
|
|
170
|
+
},
|
|
171
|
+
"plugins": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"description": "使用到的插件。"
|
|
174
|
+
},
|
|
175
|
+
"preloadRule": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"description": "分包预下载规则。"
|
|
178
|
+
},
|
|
179
|
+
"resizable": {
|
|
180
|
+
"type": "boolean",
|
|
181
|
+
"description": "PC 小程序是否支持用户任意改变窗口大小(包括最大化窗口);iPad 小程序是否支持屏幕旋转。默认关闭",
|
|
182
|
+
"x-wechat-min-version": "2.3.0"
|
|
183
|
+
},
|
|
184
|
+
"usingComponents": {
|
|
185
|
+
"type": "object",
|
|
186
|
+
"description": "全局自定义组件配置。"
|
|
187
|
+
},
|
|
188
|
+
"permission": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"description": "小程序接口权限相关设置。"
|
|
191
|
+
},
|
|
192
|
+
"sitemapLocation": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "指明 sitemap.json 的位置。"
|
|
195
|
+
},
|
|
196
|
+
"style": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"description": "指定使用升级后的weui样式",
|
|
199
|
+
"x-wechat-min-version": "2.8.0"
|
|
200
|
+
},
|
|
201
|
+
"useExtendedLib": {
|
|
202
|
+
"type": "object",
|
|
203
|
+
"description": "指定需要引用的扩展库。"
|
|
204
|
+
},
|
|
205
|
+
"entranceDeclare": {
|
|
206
|
+
"type": "object",
|
|
207
|
+
"description": "微信消息用小程序打开。"
|
|
208
|
+
},
|
|
209
|
+
"darkmode": {
|
|
210
|
+
"type": "boolean",
|
|
211
|
+
"description": "小程序支持 DarkMode。"
|
|
212
|
+
},
|
|
213
|
+
"themeLocation": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"description": "指明 theme.json 的位置。"
|
|
216
|
+
},
|
|
217
|
+
"lazyCodeLoading": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"description": "配置自定义组件代码按需注入。"
|
|
220
|
+
},
|
|
221
|
+
"singlePage": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"description": "单页模式相关配置",
|
|
224
|
+
"x-wechat-min-version": "2.12.0"
|
|
225
|
+
},
|
|
226
|
+
"supportedMaterials": {
|
|
227
|
+
"type": "object",
|
|
228
|
+
"description": "聊天素材小程序打开相关配置。"
|
|
229
|
+
},
|
|
230
|
+
"serviceProviderTicket": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"description": "定制化型服务商票据"
|
|
233
|
+
},
|
|
234
|
+
"embeddedAppIdList": {
|
|
235
|
+
"type": "string[]",
|
|
236
|
+
"description": "半屏小程序 appId 列表。"
|
|
237
|
+
},
|
|
238
|
+
"halfPage": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"description": "视频号直播半屏场景设置。"
|
|
241
|
+
},
|
|
242
|
+
"debugOptions": {
|
|
243
|
+
"type": "object",
|
|
244
|
+
"description": "调试相关配置。"
|
|
245
|
+
},
|
|
246
|
+
"enablePassiveEvent": {
|
|
247
|
+
"type": "object | boolean",
|
|
248
|
+
"description": "touch 事件监听是否为 passive",
|
|
249
|
+
"x-wechat-min-version": "2.24.1"
|
|
250
|
+
},
|
|
251
|
+
"resolveAlias": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"description": "自定义模块映射规则。"
|
|
254
|
+
},
|
|
255
|
+
"renderer": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"description": "全局默认的渲染后端。",
|
|
258
|
+
"enum": ["webview", "skyline"]
|
|
259
|
+
},
|
|
260
|
+
"rendererOptions": {
|
|
261
|
+
"type": "object",
|
|
262
|
+
"description": "渲染后端选项。"
|
|
263
|
+
},
|
|
264
|
+
"componentFramework": {
|
|
265
|
+
"type": "string",
|
|
266
|
+
"description": "组件框架。"
|
|
267
|
+
},
|
|
268
|
+
"miniApp": {
|
|
269
|
+
"type": "object",
|
|
270
|
+
"description": "多端模式场景接入身份管理服务时开启小程序授权页相关配置,详见相关文档"
|
|
271
|
+
},
|
|
272
|
+
"static": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"description": "正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景) 相关文档"
|
|
275
|
+
},
|
|
276
|
+
"convertRpxToVw": {
|
|
277
|
+
"type": "boolean",
|
|
278
|
+
"description": "是否将 rpx 单位转换为 vw 单位。"
|
|
279
|
+
},
|
|
280
|
+
"chatTools": {
|
|
281
|
+
"type": "object",
|
|
282
|
+
"description": "聊天工具分包配置",
|
|
283
|
+
"x-wechat-min-version": "3.7.8"
|
|
284
|
+
},
|
|
285
|
+
"subPackages": {
|
|
286
|
+
"type": "object[]",
|
|
287
|
+
"description": "分包结构配置(兼容别名)。"
|
|
288
|
+
},
|
|
289
|
+
"appBar": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"description": "AppBar 配置。"
|
|
2953
292
|
}
|
|
2954
|
-
ctx.override({
|
|
2955
|
-
zodSchema,
|
|
2956
|
-
jsonSchema: schema,
|
|
2957
|
-
path: seen.path ?? []
|
|
2958
|
-
});
|
|
2959
|
-
};
|
|
2960
|
-
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
2961
|
-
const result = {};
|
|
2962
|
-
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
2963
|
-
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
2964
|
-
else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
2965
|
-
else if (ctx.target === "openapi-3.0") {}
|
|
2966
|
-
if (ctx.external?.uri) {
|
|
2967
|
-
const id = ctx.external.registry.get(schema)?.id;
|
|
2968
|
-
if (!id) throw new Error("Schema is missing an `id` property");
|
|
2969
|
-
result.$id = ctx.external.uri(id);
|
|
2970
|
-
}
|
|
2971
|
-
Object.assign(result, root.def ?? root.schema);
|
|
2972
|
-
const defs = ctx.external?.defs ?? {};
|
|
2973
|
-
for (const entry of ctx.seen.entries()) {
|
|
2974
|
-
const seen = entry[1];
|
|
2975
|
-
if (seen.def && seen.defId) defs[seen.defId] = seen.def;
|
|
2976
|
-
}
|
|
2977
|
-
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
2978
|
-
else result.definitions = defs;
|
|
2979
|
-
try {
|
|
2980
|
-
const finalized = JSON.parse(JSON.stringify(result));
|
|
2981
|
-
Object.defineProperty(finalized, "~standard", {
|
|
2982
|
-
value: {
|
|
2983
|
-
...schema["~standard"],
|
|
2984
|
-
jsonSchema: {
|
|
2985
|
-
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
2986
|
-
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
2987
|
-
}
|
|
2988
|
-
},
|
|
2989
|
-
enumerable: false,
|
|
2990
|
-
writable: false
|
|
2991
|
-
});
|
|
2992
|
-
return finalized;
|
|
2993
|
-
} catch (_err) {
|
|
2994
|
-
throw new Error("Error converting schema to JSON.");
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
function isTransforming(_schema, _ctx) {
|
|
2998
|
-
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
2999
|
-
if (ctx.seen.has(_schema)) return false;
|
|
3000
|
-
ctx.seen.add(_schema);
|
|
3001
|
-
const def = _schema._zod.def;
|
|
3002
|
-
if (def.type === "transform") return true;
|
|
3003
|
-
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
3004
|
-
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
3005
|
-
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
3006
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
3007
|
-
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3008
|
-
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3009
|
-
if (def.type === "pipe") return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
3010
|
-
if (def.type === "object") {
|
|
3011
|
-
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
3012
|
-
return false;
|
|
3013
|
-
}
|
|
3014
|
-
if (def.type === "union") {
|
|
3015
|
-
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
3016
|
-
return false;
|
|
3017
293
|
}
|
|
3018
|
-
if (def.type === "tuple") {
|
|
3019
|
-
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
3020
|
-
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
3021
|
-
return false;
|
|
3022
|
-
}
|
|
3023
|
-
return false;
|
|
3024
|
-
}
|
|
3025
|
-
/**
|
|
3026
|
-
* Creates a toJSONSchema method for a schema instance.
|
|
3027
|
-
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
3028
|
-
*/
|
|
3029
|
-
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
3030
|
-
const ctx = initializeContext({
|
|
3031
|
-
...params,
|
|
3032
|
-
processors
|
|
3033
|
-
});
|
|
3034
|
-
process$1(schema, ctx);
|
|
3035
|
-
extractDefs(ctx, schema);
|
|
3036
|
-
return finalize(ctx, schema);
|
|
3037
|
-
};
|
|
3038
|
-
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
3039
|
-
const { libraryOptions, target } = params ?? {};
|
|
3040
|
-
const ctx = initializeContext({
|
|
3041
|
-
...libraryOptions ?? {},
|
|
3042
|
-
target,
|
|
3043
|
-
io,
|
|
3044
|
-
processors
|
|
3045
|
-
});
|
|
3046
|
-
process$1(schema, ctx);
|
|
3047
|
-
extractDefs(ctx, schema);
|
|
3048
|
-
return finalize(ctx, schema);
|
|
3049
294
|
};
|
|
3050
295
|
//#endregion
|
|
3051
|
-
//#region
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
}
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
json.minimum = exclusiveMinimum;
|
|
3087
|
-
json.exclusiveMinimum = true;
|
|
3088
|
-
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
3089
|
-
if (typeof minimum === "number") {
|
|
3090
|
-
json.minimum = minimum;
|
|
3091
|
-
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
|
|
3092
|
-
else delete json.exclusiveMinimum;
|
|
3093
|
-
}
|
|
3094
|
-
if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
3095
|
-
json.maximum = exclusiveMaximum;
|
|
3096
|
-
json.exclusiveMaximum = true;
|
|
3097
|
-
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3098
|
-
if (typeof maximum === "number") {
|
|
3099
|
-
json.maximum = maximum;
|
|
3100
|
-
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
|
|
3101
|
-
else delete json.exclusiveMaximum;
|
|
3102
|
-
}
|
|
3103
|
-
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
3104
|
-
};
|
|
3105
|
-
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3106
|
-
json.type = "boolean";
|
|
3107
|
-
};
|
|
3108
|
-
const bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
3109
|
-
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
3110
|
-
};
|
|
3111
|
-
const symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
3112
|
-
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
3113
|
-
};
|
|
3114
|
-
const nullProcessor = (_schema, ctx, json, _params) => {
|
|
3115
|
-
if (ctx.target === "openapi-3.0") {
|
|
3116
|
-
json.type = "string";
|
|
3117
|
-
json.nullable = true;
|
|
3118
|
-
json.enum = [null];
|
|
3119
|
-
} else json.type = "null";
|
|
3120
|
-
};
|
|
3121
|
-
const undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
3122
|
-
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
3123
|
-
};
|
|
3124
|
-
const voidProcessor = (_schema, ctx, _json, _params) => {
|
|
3125
|
-
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
3126
|
-
};
|
|
3127
|
-
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3128
|
-
json.not = {};
|
|
3129
|
-
};
|
|
3130
|
-
const anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
3131
|
-
const unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
3132
|
-
const dateProcessor = (_schema, ctx, _json, _params) => {
|
|
3133
|
-
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
3134
|
-
};
|
|
3135
|
-
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3136
|
-
const def = schema._zod.def;
|
|
3137
|
-
const values = getEnumValues(def.entries);
|
|
3138
|
-
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
3139
|
-
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3140
|
-
json.enum = values;
|
|
3141
|
-
};
|
|
3142
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3143
|
-
const def = schema._zod.def;
|
|
3144
|
-
const vals = [];
|
|
3145
|
-
for (const val of def.values) if (val === void 0) {
|
|
3146
|
-
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3147
|
-
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3148
|
-
else vals.push(Number(val));
|
|
3149
|
-
else vals.push(val);
|
|
3150
|
-
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3151
|
-
const val = vals[0];
|
|
3152
|
-
json.type = val === null ? "null" : typeof val;
|
|
3153
|
-
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
3154
|
-
else json.const = val;
|
|
3155
|
-
} else {
|
|
3156
|
-
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
3157
|
-
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
3158
|
-
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
3159
|
-
if (vals.every((v) => v === null)) json.type = "null";
|
|
3160
|
-
json.enum = vals;
|
|
3161
|
-
}
|
|
3162
|
-
};
|
|
3163
|
-
const nanProcessor = (_schema, ctx, _json, _params) => {
|
|
3164
|
-
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
3165
|
-
};
|
|
3166
|
-
const templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
3167
|
-
const _json = json;
|
|
3168
|
-
const pattern = schema._zod.pattern;
|
|
3169
|
-
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
3170
|
-
_json.type = "string";
|
|
3171
|
-
_json.pattern = pattern.source;
|
|
3172
|
-
};
|
|
3173
|
-
const fileProcessor = (schema, _ctx, json, _params) => {
|
|
3174
|
-
const _json = json;
|
|
3175
|
-
const file = {
|
|
3176
|
-
type: "string",
|
|
3177
|
-
format: "binary",
|
|
3178
|
-
contentEncoding: "binary"
|
|
3179
|
-
};
|
|
3180
|
-
const { minimum, maximum, mime } = schema._zod.bag;
|
|
3181
|
-
if (minimum !== void 0) file.minLength = minimum;
|
|
3182
|
-
if (maximum !== void 0) file.maxLength = maximum;
|
|
3183
|
-
if (mime) if (mime.length === 1) {
|
|
3184
|
-
file.contentMediaType = mime[0];
|
|
3185
|
-
Object.assign(_json, file);
|
|
3186
|
-
} else {
|
|
3187
|
-
Object.assign(_json, file);
|
|
3188
|
-
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
3189
|
-
}
|
|
3190
|
-
else Object.assign(_json, file);
|
|
3191
|
-
};
|
|
3192
|
-
const successProcessor = (_schema, _ctx, json, _params) => {
|
|
3193
|
-
json.type = "boolean";
|
|
3194
|
-
};
|
|
3195
|
-
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3196
|
-
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3197
|
-
};
|
|
3198
|
-
const functionProcessor = (_schema, ctx, _json, _params) => {
|
|
3199
|
-
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
3200
|
-
};
|
|
3201
|
-
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
3202
|
-
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3203
|
-
};
|
|
3204
|
-
const mapProcessor = (_schema, ctx, _json, _params) => {
|
|
3205
|
-
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
3206
|
-
};
|
|
3207
|
-
const setProcessor = (_schema, ctx, _json, _params) => {
|
|
3208
|
-
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
3209
|
-
};
|
|
3210
|
-
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
3211
|
-
const json = _json;
|
|
3212
|
-
const def = schema._zod.def;
|
|
3213
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
3214
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
3215
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3216
|
-
json.type = "array";
|
|
3217
|
-
json.items = process$1(def.element, ctx, {
|
|
3218
|
-
...params,
|
|
3219
|
-
path: [...params.path, "items"]
|
|
3220
|
-
});
|
|
3221
|
-
};
|
|
3222
|
-
const objectProcessor = (schema, ctx, _json, params) => {
|
|
3223
|
-
const json = _json;
|
|
3224
|
-
const def = schema._zod.def;
|
|
3225
|
-
json.type = "object";
|
|
3226
|
-
json.properties = {};
|
|
3227
|
-
const shape = def.shape;
|
|
3228
|
-
for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
|
|
3229
|
-
...params,
|
|
3230
|
-
path: [
|
|
3231
|
-
...params.path,
|
|
3232
|
-
"properties",
|
|
3233
|
-
key
|
|
3234
|
-
]
|
|
3235
|
-
});
|
|
3236
|
-
const allKeys = new Set(Object.keys(shape));
|
|
3237
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3238
|
-
const v = def.shape[key]._zod;
|
|
3239
|
-
if (ctx.io === "input") return v.optin === void 0;
|
|
3240
|
-
else return v.optout === void 0;
|
|
3241
|
-
}));
|
|
3242
|
-
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
3243
|
-
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
3244
|
-
else if (!def.catchall) {
|
|
3245
|
-
if (ctx.io === "output") json.additionalProperties = false;
|
|
3246
|
-
} else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, {
|
|
3247
|
-
...params,
|
|
3248
|
-
path: [...params.path, "additionalProperties"]
|
|
3249
|
-
});
|
|
3250
|
-
};
|
|
3251
|
-
const unionProcessor = (schema, ctx, json, params) => {
|
|
3252
|
-
const def = schema._zod.def;
|
|
3253
|
-
const isExclusive = def.inclusive === false;
|
|
3254
|
-
const options = def.options.map((x, i) => process$1(x, ctx, {
|
|
3255
|
-
...params,
|
|
3256
|
-
path: [
|
|
3257
|
-
...params.path,
|
|
3258
|
-
isExclusive ? "oneOf" : "anyOf",
|
|
3259
|
-
i
|
|
3260
|
-
]
|
|
3261
|
-
}));
|
|
3262
|
-
if (isExclusive) json.oneOf = options;
|
|
3263
|
-
else json.anyOf = options;
|
|
3264
|
-
};
|
|
3265
|
-
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
3266
|
-
const def = schema._zod.def;
|
|
3267
|
-
const a = process$1(def.left, ctx, {
|
|
3268
|
-
...params,
|
|
3269
|
-
path: [
|
|
3270
|
-
...params.path,
|
|
3271
|
-
"allOf",
|
|
3272
|
-
0
|
|
3273
|
-
]
|
|
3274
|
-
});
|
|
3275
|
-
const b = process$1(def.right, ctx, {
|
|
3276
|
-
...params,
|
|
3277
|
-
path: [
|
|
3278
|
-
...params.path,
|
|
3279
|
-
"allOf",
|
|
3280
|
-
1
|
|
3281
|
-
]
|
|
3282
|
-
});
|
|
3283
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3284
|
-
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3285
|
-
};
|
|
3286
|
-
const tupleProcessor = (schema, ctx, _json, params) => {
|
|
3287
|
-
const json = _json;
|
|
3288
|
-
const def = schema._zod.def;
|
|
3289
|
-
json.type = "array";
|
|
3290
|
-
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
3291
|
-
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
3292
|
-
const prefixItems = def.items.map((x, i) => process$1(x, ctx, {
|
|
3293
|
-
...params,
|
|
3294
|
-
path: [
|
|
3295
|
-
...params.path,
|
|
3296
|
-
prefixPath,
|
|
3297
|
-
i
|
|
3298
|
-
]
|
|
3299
|
-
}));
|
|
3300
|
-
const rest = def.rest ? process$1(def.rest, ctx, {
|
|
3301
|
-
...params,
|
|
3302
|
-
path: [
|
|
3303
|
-
...params.path,
|
|
3304
|
-
restPath,
|
|
3305
|
-
...ctx.target === "openapi-3.0" ? [def.items.length] : []
|
|
3306
|
-
]
|
|
3307
|
-
}) : null;
|
|
3308
|
-
if (ctx.target === "draft-2020-12") {
|
|
3309
|
-
json.prefixItems = prefixItems;
|
|
3310
|
-
if (rest) json.items = rest;
|
|
3311
|
-
} else if (ctx.target === "openapi-3.0") {
|
|
3312
|
-
json.items = { anyOf: prefixItems };
|
|
3313
|
-
if (rest) json.items.anyOf.push(rest);
|
|
3314
|
-
json.minItems = prefixItems.length;
|
|
3315
|
-
if (!rest) json.maxItems = prefixItems.length;
|
|
3316
|
-
} else {
|
|
3317
|
-
json.items = prefixItems;
|
|
3318
|
-
if (rest) json.additionalItems = rest;
|
|
3319
|
-
}
|
|
3320
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
3321
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
3322
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
3323
|
-
};
|
|
3324
|
-
const recordProcessor = (schema, ctx, _json, params) => {
|
|
3325
|
-
const json = _json;
|
|
3326
|
-
const def = schema._zod.def;
|
|
3327
|
-
json.type = "object";
|
|
3328
|
-
const keyType = def.keyType;
|
|
3329
|
-
const patterns = keyType._zod.bag?.patterns;
|
|
3330
|
-
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
3331
|
-
const valueSchema = process$1(def.valueType, ctx, {
|
|
3332
|
-
...params,
|
|
3333
|
-
path: [
|
|
3334
|
-
...params.path,
|
|
3335
|
-
"patternProperties",
|
|
3336
|
-
"*"
|
|
3337
|
-
]
|
|
3338
|
-
});
|
|
3339
|
-
json.patternProperties = {};
|
|
3340
|
-
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
3341
|
-
} else {
|
|
3342
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$1(def.keyType, ctx, {
|
|
3343
|
-
...params,
|
|
3344
|
-
path: [...params.path, "propertyNames"]
|
|
3345
|
-
});
|
|
3346
|
-
json.additionalProperties = process$1(def.valueType, ctx, {
|
|
3347
|
-
...params,
|
|
3348
|
-
path: [...params.path, "additionalProperties"]
|
|
3349
|
-
});
|
|
3350
|
-
}
|
|
3351
|
-
const keyValues = keyType._zod.values;
|
|
3352
|
-
if (keyValues) {
|
|
3353
|
-
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
3354
|
-
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
296
|
+
//#region scripts/config/component.json
|
|
297
|
+
var component_default = {
|
|
298
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/",
|
|
299
|
+
fields: {
|
|
300
|
+
"component": {
|
|
301
|
+
"type": "boolean",
|
|
302
|
+
"default": true,
|
|
303
|
+
"description": "声明当前配置对应自定义组件。"
|
|
304
|
+
},
|
|
305
|
+
"styleIsolation": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"enum": [
|
|
308
|
+
"isolated",
|
|
309
|
+
"apply-shared",
|
|
310
|
+
"shared"
|
|
311
|
+
],
|
|
312
|
+
"default": "isolated",
|
|
313
|
+
"description": "组件样式隔离策略。"
|
|
314
|
+
},
|
|
315
|
+
"componentGenerics": {
|
|
316
|
+
"type": "object",
|
|
317
|
+
"description": "组件泛型配置。"
|
|
318
|
+
},
|
|
319
|
+
"componentPlaceholder": {
|
|
320
|
+
"type": "object",
|
|
321
|
+
"description": "组件占位配置。"
|
|
322
|
+
},
|
|
323
|
+
"componentFramework": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"description": "组件框架。"
|
|
326
|
+
},
|
|
327
|
+
"usingComponents": {
|
|
328
|
+
"type": "object",
|
|
329
|
+
"description": "组件依赖的自定义组件配置。"
|
|
330
|
+
}
|
|
3355
331
|
}
|
|
3356
332
|
};
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
}
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region scripts/config/page.json
|
|
335
|
+
var page_default = {
|
|
336
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/page.html",
|
|
337
|
+
fields: {
|
|
338
|
+
"navigationBarBackgroundColor": {
|
|
339
|
+
"type": "HexColor",
|
|
340
|
+
"default": "#000000",
|
|
341
|
+
"description": "导航栏背景颜色,如 #000000"
|
|
342
|
+
},
|
|
343
|
+
"navigationBarTextStyle": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"default": "white",
|
|
346
|
+
"description": "导航栏标题、状态栏颜色,仅支持 black / white"
|
|
347
|
+
},
|
|
348
|
+
"navigationBarTitleText": {
|
|
349
|
+
"type": "string",
|
|
350
|
+
"description": "导航栏标题文字内容"
|
|
351
|
+
},
|
|
352
|
+
"navigationStyle": {
|
|
353
|
+
"type": "string",
|
|
354
|
+
"default": "default",
|
|
355
|
+
"description": "导航栏样式,仅支持以下值:default 默认样式 custom 自定义导航栏,只保留右上角胶囊按钮。",
|
|
356
|
+
"x-wechat-min-version": "7.0.0"
|
|
357
|
+
},
|
|
358
|
+
"homeButton": {
|
|
359
|
+
"type": "boolean",
|
|
360
|
+
"default": "false",
|
|
361
|
+
"description": "在非首页、非页面栈最底层页面或非tabbar内页面中的导航栏展示home键",
|
|
362
|
+
"x-wechat-min-version": "8.0.24"
|
|
363
|
+
},
|
|
364
|
+
"backgroundColor": {
|
|
365
|
+
"type": "HexColor",
|
|
366
|
+
"default": "#ffffff",
|
|
367
|
+
"description": "窗口的背景色"
|
|
368
|
+
},
|
|
369
|
+
"backgroundColorContent": {
|
|
370
|
+
"type": "HexColor",
|
|
371
|
+
"default": "#RRGGBBAA",
|
|
372
|
+
"description": "页面容器背景色。"
|
|
373
|
+
},
|
|
374
|
+
"backgroundTextStyle": {
|
|
375
|
+
"type": "string",
|
|
376
|
+
"default": "dark",
|
|
377
|
+
"description": "下拉 loading 的样式,仅支持 dark / light"
|
|
378
|
+
},
|
|
379
|
+
"backgroundColorTop": {
|
|
380
|
+
"type": "string",
|
|
381
|
+
"default": "#ffffff",
|
|
382
|
+
"description": "顶部窗口的背景色,仅 iOS 支持",
|
|
383
|
+
"x-wechat-min-version": "6.5.16"
|
|
384
|
+
},
|
|
385
|
+
"backgroundColorBottom": {
|
|
386
|
+
"type": "string",
|
|
387
|
+
"default": "#ffffff",
|
|
388
|
+
"description": "底部窗口的背景色,仅 iOS 支持",
|
|
389
|
+
"x-wechat-min-version": "6.5.16"
|
|
390
|
+
},
|
|
391
|
+
"enablePullDownRefresh": {
|
|
392
|
+
"type": "boolean",
|
|
393
|
+
"default": "false",
|
|
394
|
+
"description": "是否开启当前页面下拉刷新。详见 Page.onPullDownRefresh"
|
|
395
|
+
},
|
|
396
|
+
"onReachBottomDistance": {
|
|
397
|
+
"type": "number",
|
|
398
|
+
"default": "50",
|
|
399
|
+
"description": "页面上拉触底事件触发时距页面底部距离,单位为px。详见 Page.onReachBottom"
|
|
400
|
+
},
|
|
401
|
+
"pageOrientation": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"default": "portrait",
|
|
404
|
+
"description": "屏幕旋转设置,支持 auto / portrait / landscape 详见 响应显示区域变化",
|
|
405
|
+
"x-wechat-min-version": "2.4.0"
|
|
406
|
+
},
|
|
407
|
+
"disableScroll": {
|
|
408
|
+
"type": "boolean",
|
|
409
|
+
"default": false,
|
|
410
|
+
"description": "设置为 true 时页面整体不能上下滚动。"
|
|
411
|
+
},
|
|
412
|
+
"usingComponents": {
|
|
413
|
+
"type": "object",
|
|
414
|
+
"description": "页面自定义组件配置。"
|
|
415
|
+
},
|
|
416
|
+
"initialRenderingCache": {
|
|
417
|
+
"type": "string",
|
|
418
|
+
"enum": [
|
|
419
|
+
"static",
|
|
420
|
+
"dynamic",
|
|
421
|
+
"capture"
|
|
422
|
+
],
|
|
423
|
+
"description": "页面初始渲染缓存配置。"
|
|
424
|
+
},
|
|
425
|
+
"style": {
|
|
426
|
+
"type": "string",
|
|
427
|
+
"default": "default",
|
|
428
|
+
"description": "启用新版的组件样式",
|
|
429
|
+
"x-wechat-min-version": "2.10.2"
|
|
430
|
+
},
|
|
431
|
+
"singlePage": {
|
|
432
|
+
"type": "object",
|
|
433
|
+
"default": "否",
|
|
434
|
+
"description": "单页模式相关配置",
|
|
435
|
+
"x-wechat-min-version": "2.12.0"
|
|
436
|
+
},
|
|
437
|
+
"restartStrategy": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"default": "homePage",
|
|
440
|
+
"description": "重新启动策略配置",
|
|
441
|
+
"x-wechat-min-version": "2.8.0"
|
|
442
|
+
},
|
|
443
|
+
"handleWebviewPreload": {
|
|
444
|
+
"type": "string",
|
|
445
|
+
"default": "static",
|
|
446
|
+
"description": "控制预加载下个页面的时机。支持 static / manual / auto",
|
|
447
|
+
"x-wechat-min-version": "2.15.0"
|
|
448
|
+
},
|
|
449
|
+
"visualEffectInBackground": {
|
|
450
|
+
"type": "string",
|
|
451
|
+
"default": "否",
|
|
452
|
+
"description": "切入系统后台时,隐藏页面内容,保护用户隐私。支持 hidden / none,若对页面单独设置则会覆盖全局的配置,详见 全局配置",
|
|
453
|
+
"x-wechat-min-version": "2.15.0"
|
|
454
|
+
},
|
|
455
|
+
"enablePassiveEvent": {
|
|
456
|
+
"type": "object | boolean",
|
|
457
|
+
"default": "否",
|
|
458
|
+
"description": "事件监听是否为 passive,若对页面单独设置则会覆盖全局的配置,详见 全局配置",
|
|
459
|
+
"x-wechat-min-version": "2.24.1"
|
|
460
|
+
},
|
|
461
|
+
"renderer": {
|
|
462
|
+
"type": "string",
|
|
463
|
+
"enum": ["webview", "skyline"],
|
|
464
|
+
"description": "页面渲染后端。"
|
|
465
|
+
},
|
|
466
|
+
"rendererOptions": {
|
|
467
|
+
"type": "object",
|
|
468
|
+
"default": "否",
|
|
469
|
+
"description": "渲染后端选项,详情相关文档",
|
|
470
|
+
"x-wechat-min-version": "3.1.0"
|
|
471
|
+
},
|
|
472
|
+
"componentFramework": {
|
|
473
|
+
"type": "string",
|
|
474
|
+
"description": "组件框架。"
|
|
475
|
+
},
|
|
476
|
+
"styleIsolation": {
|
|
477
|
+
"type": "string",
|
|
478
|
+
"enum": [
|
|
479
|
+
"page-isolated",
|
|
480
|
+
"page-apply-shared",
|
|
481
|
+
"page-shared"
|
|
482
|
+
],
|
|
483
|
+
"description": "页面样式隔离策略。"
|
|
484
|
+
}
|
|
3396
485
|
}
|
|
3397
|
-
json.default = catchValue;
|
|
3398
|
-
};
|
|
3399
|
-
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
3400
|
-
const def = schema._zod.def;
|
|
3401
|
-
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
3402
|
-
process$1(innerType, ctx, params);
|
|
3403
|
-
const seen = ctx.seen.get(schema);
|
|
3404
|
-
seen.ref = innerType;
|
|
3405
486
|
};
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
}
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
const seen = ctx.seen.get(schema);
|
|
3423
|
-
seen.ref = def.innerType;
|
|
3424
|
-
};
|
|
3425
|
-
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
3426
|
-
const innerType = schema._zod.innerType;
|
|
3427
|
-
process$1(innerType, ctx, params);
|
|
3428
|
-
const seen = ctx.seen.get(schema);
|
|
3429
|
-
seen.ref = innerType;
|
|
3430
|
-
};
|
|
3431
|
-
const allProcessors = {
|
|
3432
|
-
string: stringProcessor,
|
|
3433
|
-
number: numberProcessor,
|
|
3434
|
-
boolean: booleanProcessor,
|
|
3435
|
-
bigint: bigintProcessor,
|
|
3436
|
-
symbol: symbolProcessor,
|
|
3437
|
-
null: nullProcessor,
|
|
3438
|
-
undefined: undefinedProcessor,
|
|
3439
|
-
void: voidProcessor,
|
|
3440
|
-
never: neverProcessor,
|
|
3441
|
-
any: anyProcessor,
|
|
3442
|
-
unknown: unknownProcessor,
|
|
3443
|
-
date: dateProcessor,
|
|
3444
|
-
enum: enumProcessor,
|
|
3445
|
-
literal: literalProcessor,
|
|
3446
|
-
nan: nanProcessor,
|
|
3447
|
-
template_literal: templateLiteralProcessor,
|
|
3448
|
-
file: fileProcessor,
|
|
3449
|
-
success: successProcessor,
|
|
3450
|
-
custom: customProcessor,
|
|
3451
|
-
function: functionProcessor,
|
|
3452
|
-
transform: transformProcessor,
|
|
3453
|
-
map: mapProcessor,
|
|
3454
|
-
set: setProcessor,
|
|
3455
|
-
array: arrayProcessor,
|
|
3456
|
-
object: objectProcessor,
|
|
3457
|
-
union: unionProcessor,
|
|
3458
|
-
intersection: intersectionProcessor,
|
|
3459
|
-
tuple: tupleProcessor,
|
|
3460
|
-
record: recordProcessor,
|
|
3461
|
-
nullable: nullableProcessor,
|
|
3462
|
-
nonoptional: nonoptionalProcessor,
|
|
3463
|
-
default: defaultProcessor,
|
|
3464
|
-
prefault: prefaultProcessor,
|
|
3465
|
-
catch: catchProcessor,
|
|
3466
|
-
pipe: pipeProcessor,
|
|
3467
|
-
readonly: readonlyProcessor,
|
|
3468
|
-
promise: promiseProcessor,
|
|
3469
|
-
optional: optionalProcessor,
|
|
3470
|
-
lazy: lazyProcessor
|
|
3471
|
-
};
|
|
3472
|
-
function toJSONSchema(input, params) {
|
|
3473
|
-
if ("_idmap" in input) {
|
|
3474
|
-
const registry = input;
|
|
3475
|
-
const ctx = initializeContext({
|
|
3476
|
-
...params,
|
|
3477
|
-
processors: allProcessors
|
|
3478
|
-
});
|
|
3479
|
-
const defs = {};
|
|
3480
|
-
for (const entry of registry._idmap.entries()) {
|
|
3481
|
-
const [_, schema] = entry;
|
|
3482
|
-
process$1(schema, ctx);
|
|
3483
|
-
}
|
|
3484
|
-
const schemas = {};
|
|
3485
|
-
ctx.external = {
|
|
3486
|
-
registry,
|
|
3487
|
-
uri: params?.uri,
|
|
3488
|
-
defs
|
|
3489
|
-
};
|
|
3490
|
-
for (const entry of registry._idmap.entries()) {
|
|
3491
|
-
const [key, schema] = entry;
|
|
3492
|
-
extractDefs(ctx, schema);
|
|
3493
|
-
schemas[key] = finalize(ctx, schema);
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region scripts/config/plugin.json
|
|
489
|
+
var plugin_default = {
|
|
490
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html",
|
|
491
|
+
fields: {
|
|
492
|
+
"publicComponents": {
|
|
493
|
+
"type": "object",
|
|
494
|
+
"description": "插件对外提供的自定义组件。"
|
|
495
|
+
},
|
|
496
|
+
"pages": {
|
|
497
|
+
"type": "object",
|
|
498
|
+
"description": "插件页面映射。"
|
|
499
|
+
},
|
|
500
|
+
"main": {
|
|
501
|
+
"type": "string",
|
|
502
|
+
"description": "插件主入口文件。"
|
|
3494
503
|
}
|
|
3495
|
-
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
3496
|
-
return { schemas };
|
|
3497
504
|
}
|
|
3498
|
-
const ctx = initializeContext({
|
|
3499
|
-
...params,
|
|
3500
|
-
processors: allProcessors
|
|
3501
|
-
});
|
|
3502
|
-
process$1(input, ctx);
|
|
3503
|
-
extractDefs(ctx, input);
|
|
3504
|
-
return finalize(ctx, input);
|
|
3505
|
-
}
|
|
3506
|
-
//#endregion
|
|
3507
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
3508
|
-
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
3509
|
-
$ZodISODateTime.init(inst, def);
|
|
3510
|
-
ZodStringFormat.init(inst, def);
|
|
3511
|
-
});
|
|
3512
|
-
function datetime(params) {
|
|
3513
|
-
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
3514
|
-
}
|
|
3515
|
-
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
3516
|
-
$ZodISODate.init(inst, def);
|
|
3517
|
-
ZodStringFormat.init(inst, def);
|
|
3518
|
-
});
|
|
3519
|
-
function date(params) {
|
|
3520
|
-
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
3521
|
-
}
|
|
3522
|
-
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
3523
|
-
$ZodISOTime.init(inst, def);
|
|
3524
|
-
ZodStringFormat.init(inst, def);
|
|
3525
|
-
});
|
|
3526
|
-
function time(params) {
|
|
3527
|
-
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
3528
|
-
}
|
|
3529
|
-
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
3530
|
-
$ZodISODuration.init(inst, def);
|
|
3531
|
-
ZodStringFormat.init(inst, def);
|
|
3532
|
-
});
|
|
3533
|
-
function duration(params) {
|
|
3534
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
3535
|
-
}
|
|
3536
|
-
//#endregion
|
|
3537
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
3538
|
-
const initializer = (inst, issues) => {
|
|
3539
|
-
$ZodError.init(inst, issues);
|
|
3540
|
-
inst.name = "ZodError";
|
|
3541
|
-
Object.defineProperties(inst, {
|
|
3542
|
-
format: { value: (mapper) => formatError(inst, mapper) },
|
|
3543
|
-
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
3544
|
-
addIssue: { value: (issue) => {
|
|
3545
|
-
inst.issues.push(issue);
|
|
3546
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3547
|
-
} },
|
|
3548
|
-
addIssues: { value: (issues) => {
|
|
3549
|
-
inst.issues.push(...issues);
|
|
3550
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3551
|
-
} },
|
|
3552
|
-
isEmpty: { get() {
|
|
3553
|
-
return inst.issues.length === 0;
|
|
3554
|
-
} }
|
|
3555
|
-
});
|
|
3556
505
|
};
|
|
3557
|
-
$constructor("ZodError", initializer);
|
|
3558
|
-
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
3559
506
|
//#endregion
|
|
3560
|
-
//#region
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
3570
|
-
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3571
|
-
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3572
|
-
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
507
|
+
//#region scripts/config/sitemap.json
|
|
508
|
+
var sitemap_default = {
|
|
509
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
|
510
|
+
fields: { "rules": {
|
|
511
|
+
"type": "object[]",
|
|
512
|
+
"required": true,
|
|
513
|
+
"description": "sitemap 匹配规则列表。"
|
|
514
|
+
} }
|
|
515
|
+
};
|
|
3573
516
|
//#endregion
|
|
3574
|
-
//#region
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
inst.def = def;
|
|
3583
|
-
inst.type = def.type;
|
|
3584
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3585
|
-
inst.check = (...checks) => {
|
|
3586
|
-
return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
3587
|
-
check: ch,
|
|
3588
|
-
def: { check: "custom" },
|
|
3589
|
-
onattach: []
|
|
3590
|
-
} } : ch)] }), { parent: true });
|
|
3591
|
-
};
|
|
3592
|
-
inst.with = inst.check;
|
|
3593
|
-
inst.clone = (def, params) => clone(inst, def, params);
|
|
3594
|
-
inst.brand = () => inst;
|
|
3595
|
-
inst.register = ((reg, meta) => {
|
|
3596
|
-
reg.add(inst, meta);
|
|
3597
|
-
return inst;
|
|
3598
|
-
});
|
|
3599
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
3600
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
3601
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3602
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3603
|
-
inst.spa = inst.safeParseAsync;
|
|
3604
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3605
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3606
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3607
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3608
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3609
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3610
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3611
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3612
|
-
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
3613
|
-
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
3614
|
-
inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite(fn));
|
|
3615
|
-
inst.optional = () => optional(inst);
|
|
3616
|
-
inst.exactOptional = () => exactOptional(inst);
|
|
3617
|
-
inst.nullable = () => nullable(inst);
|
|
3618
|
-
inst.nullish = () => optional(nullable(inst));
|
|
3619
|
-
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
3620
|
-
inst.array = () => array(inst);
|
|
3621
|
-
inst.or = (arg) => union([inst, arg]);
|
|
3622
|
-
inst.and = (arg) => intersection(inst, arg);
|
|
3623
|
-
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
3624
|
-
inst.default = (def) => _default(inst, def);
|
|
3625
|
-
inst.prefault = (def) => prefault(inst, def);
|
|
3626
|
-
inst.catch = (params) => _catch(inst, params);
|
|
3627
|
-
inst.pipe = (target) => pipe(inst, target);
|
|
3628
|
-
inst.readonly = () => readonly(inst);
|
|
3629
|
-
inst.describe = (description) => {
|
|
3630
|
-
const cl = inst.clone();
|
|
3631
|
-
globalRegistry.add(cl, { description });
|
|
3632
|
-
return cl;
|
|
3633
|
-
};
|
|
3634
|
-
Object.defineProperty(inst, "description", {
|
|
3635
|
-
get() {
|
|
3636
|
-
return globalRegistry.get(inst)?.description;
|
|
517
|
+
//#region scripts/config/theme.json
|
|
518
|
+
var theme_default = {
|
|
519
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/view/theme.html",
|
|
520
|
+
fields: {
|
|
521
|
+
"light": {
|
|
522
|
+
"type": "object",
|
|
523
|
+
"required": true,
|
|
524
|
+
"description": "浅色主题配置。"
|
|
3637
525
|
},
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
const cl = inst.clone();
|
|
3643
|
-
globalRegistry.add(cl, args[0]);
|
|
3644
|
-
return cl;
|
|
3645
|
-
};
|
|
3646
|
-
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
3647
|
-
inst.isNullable = () => inst.safeParse(null).success;
|
|
3648
|
-
inst.apply = (fn) => fn(inst);
|
|
3649
|
-
return inst;
|
|
3650
|
-
});
|
|
3651
|
-
/** @internal */
|
|
3652
|
-
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
3653
|
-
$ZodString.init(inst, def);
|
|
3654
|
-
ZodType.init(inst, def);
|
|
3655
|
-
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3656
|
-
const bag = inst._zod.bag;
|
|
3657
|
-
inst.format = bag.format ?? null;
|
|
3658
|
-
inst.minLength = bag.minimum ?? null;
|
|
3659
|
-
inst.maxLength = bag.maximum ?? null;
|
|
3660
|
-
inst.regex = (...args) => inst.check(/* @__PURE__ */ _regex(...args));
|
|
3661
|
-
inst.includes = (...args) => inst.check(/* @__PURE__ */ _includes(...args));
|
|
3662
|
-
inst.startsWith = (...args) => inst.check(/* @__PURE__ */ _startsWith(...args));
|
|
3663
|
-
inst.endsWith = (...args) => inst.check(/* @__PURE__ */ _endsWith(...args));
|
|
3664
|
-
inst.min = (...args) => inst.check(/* @__PURE__ */ _minLength(...args));
|
|
3665
|
-
inst.max = (...args) => inst.check(/* @__PURE__ */ _maxLength(...args));
|
|
3666
|
-
inst.length = (...args) => inst.check(/* @__PURE__ */ _length(...args));
|
|
3667
|
-
inst.nonempty = (...args) => inst.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
3668
|
-
inst.lowercase = (params) => inst.check(/* @__PURE__ */ _lowercase(params));
|
|
3669
|
-
inst.uppercase = (params) => inst.check(/* @__PURE__ */ _uppercase(params));
|
|
3670
|
-
inst.trim = () => inst.check(/* @__PURE__ */ _trim());
|
|
3671
|
-
inst.normalize = (...args) => inst.check(/* @__PURE__ */ _normalize(...args));
|
|
3672
|
-
inst.toLowerCase = () => inst.check(/* @__PURE__ */ _toLowerCase());
|
|
3673
|
-
inst.toUpperCase = () => inst.check(/* @__PURE__ */ _toUpperCase());
|
|
3674
|
-
inst.slugify = () => inst.check(/* @__PURE__ */ _slugify());
|
|
3675
|
-
});
|
|
3676
|
-
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
3677
|
-
$ZodString.init(inst, def);
|
|
3678
|
-
_ZodString.init(inst, def);
|
|
3679
|
-
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
3680
|
-
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
3681
|
-
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
3682
|
-
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
3683
|
-
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3684
|
-
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
3685
|
-
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
3686
|
-
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
3687
|
-
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
3688
|
-
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
3689
|
-
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3690
|
-
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
3691
|
-
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
3692
|
-
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
3693
|
-
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
3694
|
-
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
3695
|
-
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
3696
|
-
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
3697
|
-
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
3698
|
-
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
3699
|
-
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
3700
|
-
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
3701
|
-
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
3702
|
-
inst.datetime = (params) => inst.check(datetime(params));
|
|
3703
|
-
inst.date = (params) => inst.check(date(params));
|
|
3704
|
-
inst.time = (params) => inst.check(time(params));
|
|
3705
|
-
inst.duration = (params) => inst.check(duration(params));
|
|
3706
|
-
});
|
|
3707
|
-
function string(params) {
|
|
3708
|
-
return /* @__PURE__ */ _string(ZodString, params);
|
|
3709
|
-
}
|
|
3710
|
-
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
3711
|
-
$ZodStringFormat.init(inst, def);
|
|
3712
|
-
_ZodString.init(inst, def);
|
|
3713
|
-
});
|
|
3714
|
-
const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
3715
|
-
$ZodEmail.init(inst, def);
|
|
3716
|
-
ZodStringFormat.init(inst, def);
|
|
3717
|
-
});
|
|
3718
|
-
const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
3719
|
-
$ZodGUID.init(inst, def);
|
|
3720
|
-
ZodStringFormat.init(inst, def);
|
|
3721
|
-
});
|
|
3722
|
-
const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
3723
|
-
$ZodUUID.init(inst, def);
|
|
3724
|
-
ZodStringFormat.init(inst, def);
|
|
3725
|
-
});
|
|
3726
|
-
const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
3727
|
-
$ZodURL.init(inst, def);
|
|
3728
|
-
ZodStringFormat.init(inst, def);
|
|
3729
|
-
});
|
|
3730
|
-
const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
3731
|
-
$ZodEmoji.init(inst, def);
|
|
3732
|
-
ZodStringFormat.init(inst, def);
|
|
3733
|
-
});
|
|
3734
|
-
const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
3735
|
-
$ZodNanoID.init(inst, def);
|
|
3736
|
-
ZodStringFormat.init(inst, def);
|
|
3737
|
-
});
|
|
3738
|
-
const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
3739
|
-
$ZodCUID.init(inst, def);
|
|
3740
|
-
ZodStringFormat.init(inst, def);
|
|
3741
|
-
});
|
|
3742
|
-
const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
3743
|
-
$ZodCUID2.init(inst, def);
|
|
3744
|
-
ZodStringFormat.init(inst, def);
|
|
3745
|
-
});
|
|
3746
|
-
const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
3747
|
-
$ZodULID.init(inst, def);
|
|
3748
|
-
ZodStringFormat.init(inst, def);
|
|
3749
|
-
});
|
|
3750
|
-
const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
3751
|
-
$ZodXID.init(inst, def);
|
|
3752
|
-
ZodStringFormat.init(inst, def);
|
|
3753
|
-
});
|
|
3754
|
-
const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
3755
|
-
$ZodKSUID.init(inst, def);
|
|
3756
|
-
ZodStringFormat.init(inst, def);
|
|
3757
|
-
});
|
|
3758
|
-
const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
3759
|
-
$ZodIPv4.init(inst, def);
|
|
3760
|
-
ZodStringFormat.init(inst, def);
|
|
3761
|
-
});
|
|
3762
|
-
const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
3763
|
-
$ZodIPv6.init(inst, def);
|
|
3764
|
-
ZodStringFormat.init(inst, def);
|
|
3765
|
-
});
|
|
3766
|
-
const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
3767
|
-
$ZodCIDRv4.init(inst, def);
|
|
3768
|
-
ZodStringFormat.init(inst, def);
|
|
3769
|
-
});
|
|
3770
|
-
const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
3771
|
-
$ZodCIDRv6.init(inst, def);
|
|
3772
|
-
ZodStringFormat.init(inst, def);
|
|
3773
|
-
});
|
|
3774
|
-
const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
3775
|
-
$ZodBase64.init(inst, def);
|
|
3776
|
-
ZodStringFormat.init(inst, def);
|
|
3777
|
-
});
|
|
3778
|
-
const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
3779
|
-
$ZodBase64URL.init(inst, def);
|
|
3780
|
-
ZodStringFormat.init(inst, def);
|
|
3781
|
-
});
|
|
3782
|
-
const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
3783
|
-
$ZodE164.init(inst, def);
|
|
3784
|
-
ZodStringFormat.init(inst, def);
|
|
3785
|
-
});
|
|
3786
|
-
const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
3787
|
-
$ZodJWT.init(inst, def);
|
|
3788
|
-
ZodStringFormat.init(inst, def);
|
|
3789
|
-
});
|
|
3790
|
-
const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
3791
|
-
$ZodNumber.init(inst, def);
|
|
3792
|
-
ZodType.init(inst, def);
|
|
3793
|
-
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3794
|
-
inst.gt = (value, params) => inst.check(/* @__PURE__ */ _gt(value, params));
|
|
3795
|
-
inst.gte = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
|
|
3796
|
-
inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
|
|
3797
|
-
inst.lt = (value, params) => inst.check(/* @__PURE__ */ _lt(value, params));
|
|
3798
|
-
inst.lte = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
|
|
3799
|
-
inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
|
|
3800
|
-
inst.int = (params) => inst.check(int(params));
|
|
3801
|
-
inst.safe = (params) => inst.check(int(params));
|
|
3802
|
-
inst.positive = (params) => inst.check(/* @__PURE__ */ _gt(0, params));
|
|
3803
|
-
inst.nonnegative = (params) => inst.check(/* @__PURE__ */ _gte(0, params));
|
|
3804
|
-
inst.negative = (params) => inst.check(/* @__PURE__ */ _lt(0, params));
|
|
3805
|
-
inst.nonpositive = (params) => inst.check(/* @__PURE__ */ _lte(0, params));
|
|
3806
|
-
inst.multipleOf = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3807
|
-
inst.step = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3808
|
-
inst.finite = () => inst;
|
|
3809
|
-
const bag = inst._zod.bag;
|
|
3810
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3811
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3812
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3813
|
-
inst.isFinite = true;
|
|
3814
|
-
inst.format = bag.format ?? null;
|
|
3815
|
-
});
|
|
3816
|
-
function number(params) {
|
|
3817
|
-
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
3818
|
-
}
|
|
3819
|
-
const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
|
|
3820
|
-
$ZodNumberFormat.init(inst, def);
|
|
3821
|
-
ZodNumber.init(inst, def);
|
|
3822
|
-
});
|
|
3823
|
-
function int(params) {
|
|
3824
|
-
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
3825
|
-
}
|
|
3826
|
-
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
3827
|
-
$ZodBoolean.init(inst, def);
|
|
3828
|
-
ZodType.init(inst, def);
|
|
3829
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
3830
|
-
});
|
|
3831
|
-
function boolean(params) {
|
|
3832
|
-
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
3833
|
-
}
|
|
3834
|
-
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
3835
|
-
$ZodUnknown.init(inst, def);
|
|
3836
|
-
ZodType.init(inst, def);
|
|
3837
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
3838
|
-
});
|
|
3839
|
-
function unknown() {
|
|
3840
|
-
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
3841
|
-
}
|
|
3842
|
-
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
3843
|
-
$ZodNever.init(inst, def);
|
|
3844
|
-
ZodType.init(inst, def);
|
|
3845
|
-
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
3846
|
-
});
|
|
3847
|
-
function never(params) {
|
|
3848
|
-
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3849
|
-
}
|
|
3850
|
-
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
3851
|
-
$ZodArray.init(inst, def);
|
|
3852
|
-
ZodType.init(inst, def);
|
|
3853
|
-
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3854
|
-
inst.element = def.element;
|
|
3855
|
-
inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength(minLength, params));
|
|
3856
|
-
inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength(1, params));
|
|
3857
|
-
inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength(maxLength, params));
|
|
3858
|
-
inst.length = (len, params) => inst.check(/* @__PURE__ */ _length(len, params));
|
|
3859
|
-
inst.unwrap = () => inst.element;
|
|
3860
|
-
});
|
|
3861
|
-
function array(element, params) {
|
|
3862
|
-
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3863
|
-
}
|
|
3864
|
-
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
3865
|
-
$ZodObjectJIT.init(inst, def);
|
|
3866
|
-
ZodType.init(inst, def);
|
|
3867
|
-
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
3868
|
-
defineLazy(inst, "shape", () => {
|
|
3869
|
-
return def.shape;
|
|
3870
|
-
});
|
|
3871
|
-
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
3872
|
-
inst.catchall = (catchall) => inst.clone({
|
|
3873
|
-
...inst._zod.def,
|
|
3874
|
-
catchall
|
|
3875
|
-
});
|
|
3876
|
-
inst.passthrough = () => inst.clone({
|
|
3877
|
-
...inst._zod.def,
|
|
3878
|
-
catchall: unknown()
|
|
3879
|
-
});
|
|
3880
|
-
inst.loose = () => inst.clone({
|
|
3881
|
-
...inst._zod.def,
|
|
3882
|
-
catchall: unknown()
|
|
3883
|
-
});
|
|
3884
|
-
inst.strict = () => inst.clone({
|
|
3885
|
-
...inst._zod.def,
|
|
3886
|
-
catchall: never()
|
|
3887
|
-
});
|
|
3888
|
-
inst.strip = () => inst.clone({
|
|
3889
|
-
...inst._zod.def,
|
|
3890
|
-
catchall: void 0
|
|
3891
|
-
});
|
|
3892
|
-
inst.extend = (incoming) => {
|
|
3893
|
-
return extend(inst, incoming);
|
|
3894
|
-
};
|
|
3895
|
-
inst.safeExtend = (incoming) => {
|
|
3896
|
-
return safeExtend(inst, incoming);
|
|
3897
|
-
};
|
|
3898
|
-
inst.merge = (other) => merge(inst, other);
|
|
3899
|
-
inst.pick = (mask) => pick(inst, mask);
|
|
3900
|
-
inst.omit = (mask) => omit(inst, mask);
|
|
3901
|
-
inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
|
|
3902
|
-
inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
|
|
3903
|
-
});
|
|
3904
|
-
function object(shape, params) {
|
|
3905
|
-
return new ZodObject({
|
|
3906
|
-
type: "object",
|
|
3907
|
-
shape: shape ?? {},
|
|
3908
|
-
...normalizeParams(params)
|
|
3909
|
-
});
|
|
3910
|
-
}
|
|
3911
|
-
function looseObject(shape, params) {
|
|
3912
|
-
return new ZodObject({
|
|
3913
|
-
type: "object",
|
|
3914
|
-
shape,
|
|
3915
|
-
catchall: unknown(),
|
|
3916
|
-
...normalizeParams(params)
|
|
3917
|
-
});
|
|
3918
|
-
}
|
|
3919
|
-
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
3920
|
-
$ZodUnion.init(inst, def);
|
|
3921
|
-
ZodType.init(inst, def);
|
|
3922
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
3923
|
-
inst.options = def.options;
|
|
3924
|
-
});
|
|
3925
|
-
function union(options, params) {
|
|
3926
|
-
return new ZodUnion({
|
|
3927
|
-
type: "union",
|
|
3928
|
-
options,
|
|
3929
|
-
...normalizeParams(params)
|
|
3930
|
-
});
|
|
3931
|
-
}
|
|
3932
|
-
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
3933
|
-
$ZodIntersection.init(inst, def);
|
|
3934
|
-
ZodType.init(inst, def);
|
|
3935
|
-
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
3936
|
-
});
|
|
3937
|
-
function intersection(left, right) {
|
|
3938
|
-
return new ZodIntersection({
|
|
3939
|
-
type: "intersection",
|
|
3940
|
-
left,
|
|
3941
|
-
right
|
|
3942
|
-
});
|
|
3943
|
-
}
|
|
3944
|
-
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
3945
|
-
$ZodRecord.init(inst, def);
|
|
3946
|
-
ZodType.init(inst, def);
|
|
3947
|
-
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
3948
|
-
inst.keyType = def.keyType;
|
|
3949
|
-
inst.valueType = def.valueType;
|
|
3950
|
-
});
|
|
3951
|
-
function record(keyType, valueType, params) {
|
|
3952
|
-
return new ZodRecord({
|
|
3953
|
-
type: "record",
|
|
3954
|
-
keyType,
|
|
3955
|
-
valueType,
|
|
3956
|
-
...normalizeParams(params)
|
|
3957
|
-
});
|
|
3958
|
-
}
|
|
3959
|
-
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
3960
|
-
$ZodEnum.init(inst, def);
|
|
3961
|
-
ZodType.init(inst, def);
|
|
3962
|
-
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
3963
|
-
inst.enum = def.entries;
|
|
3964
|
-
inst.options = Object.values(def.entries);
|
|
3965
|
-
const keys = new Set(Object.keys(def.entries));
|
|
3966
|
-
inst.extract = (values, params) => {
|
|
3967
|
-
const newEntries = {};
|
|
3968
|
-
for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
|
|
3969
|
-
else throw new Error(`Key ${value} not found in enum`);
|
|
3970
|
-
return new ZodEnum({
|
|
3971
|
-
...def,
|
|
3972
|
-
checks: [],
|
|
3973
|
-
...normalizeParams(params),
|
|
3974
|
-
entries: newEntries
|
|
3975
|
-
});
|
|
3976
|
-
};
|
|
3977
|
-
inst.exclude = (values, params) => {
|
|
3978
|
-
const newEntries = { ...def.entries };
|
|
3979
|
-
for (const value of values) if (keys.has(value)) delete newEntries[value];
|
|
3980
|
-
else throw new Error(`Key ${value} not found in enum`);
|
|
3981
|
-
return new ZodEnum({
|
|
3982
|
-
...def,
|
|
3983
|
-
checks: [],
|
|
3984
|
-
...normalizeParams(params),
|
|
3985
|
-
entries: newEntries
|
|
3986
|
-
});
|
|
3987
|
-
};
|
|
3988
|
-
});
|
|
3989
|
-
function _enum(values, params) {
|
|
3990
|
-
return new ZodEnum({
|
|
3991
|
-
type: "enum",
|
|
3992
|
-
entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
|
|
3993
|
-
...normalizeParams(params)
|
|
3994
|
-
});
|
|
3995
|
-
}
|
|
3996
|
-
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
3997
|
-
$ZodTransform.init(inst, def);
|
|
3998
|
-
ZodType.init(inst, def);
|
|
3999
|
-
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
4000
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
4001
|
-
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
4002
|
-
payload.addIssue = (issue$1) => {
|
|
4003
|
-
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
4004
|
-
else {
|
|
4005
|
-
const _issue = issue$1;
|
|
4006
|
-
if (_issue.fatal) _issue.continue = false;
|
|
4007
|
-
_issue.code ?? (_issue.code = "custom");
|
|
4008
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
4009
|
-
_issue.inst ?? (_issue.inst = inst);
|
|
4010
|
-
payload.issues.push(issue(_issue));
|
|
4011
|
-
}
|
|
4012
|
-
};
|
|
4013
|
-
const output = def.transform(payload.value, payload);
|
|
4014
|
-
if (output instanceof Promise) return output.then((output) => {
|
|
4015
|
-
payload.value = output;
|
|
4016
|
-
return payload;
|
|
4017
|
-
});
|
|
4018
|
-
payload.value = output;
|
|
4019
|
-
return payload;
|
|
4020
|
-
};
|
|
4021
|
-
});
|
|
4022
|
-
function transform(fn) {
|
|
4023
|
-
return new ZodTransform({
|
|
4024
|
-
type: "transform",
|
|
4025
|
-
transform: fn
|
|
4026
|
-
});
|
|
4027
|
-
}
|
|
4028
|
-
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
4029
|
-
$ZodOptional.init(inst, def);
|
|
4030
|
-
ZodType.init(inst, def);
|
|
4031
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4032
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4033
|
-
});
|
|
4034
|
-
function optional(innerType) {
|
|
4035
|
-
return new ZodOptional({
|
|
4036
|
-
type: "optional",
|
|
4037
|
-
innerType
|
|
4038
|
-
});
|
|
4039
|
-
}
|
|
4040
|
-
const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
4041
|
-
$ZodExactOptional.init(inst, def);
|
|
4042
|
-
ZodType.init(inst, def);
|
|
4043
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4044
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4045
|
-
});
|
|
4046
|
-
function exactOptional(innerType) {
|
|
4047
|
-
return new ZodExactOptional({
|
|
4048
|
-
type: "optional",
|
|
4049
|
-
innerType
|
|
4050
|
-
});
|
|
4051
|
-
}
|
|
4052
|
-
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
4053
|
-
$ZodNullable.init(inst, def);
|
|
4054
|
-
ZodType.init(inst, def);
|
|
4055
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
4056
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4057
|
-
});
|
|
4058
|
-
function nullable(innerType) {
|
|
4059
|
-
return new ZodNullable({
|
|
4060
|
-
type: "nullable",
|
|
4061
|
-
innerType
|
|
4062
|
-
});
|
|
4063
|
-
}
|
|
4064
|
-
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
4065
|
-
$ZodDefault.init(inst, def);
|
|
4066
|
-
ZodType.init(inst, def);
|
|
4067
|
-
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
4068
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4069
|
-
inst.removeDefault = inst.unwrap;
|
|
4070
|
-
});
|
|
4071
|
-
function _default(innerType, defaultValue) {
|
|
4072
|
-
return new ZodDefault({
|
|
4073
|
-
type: "default",
|
|
4074
|
-
innerType,
|
|
4075
|
-
get defaultValue() {
|
|
4076
|
-
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4077
|
-
}
|
|
4078
|
-
});
|
|
4079
|
-
}
|
|
4080
|
-
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
4081
|
-
$ZodPrefault.init(inst, def);
|
|
4082
|
-
ZodType.init(inst, def);
|
|
4083
|
-
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
4084
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4085
|
-
});
|
|
4086
|
-
function prefault(innerType, defaultValue) {
|
|
4087
|
-
return new ZodPrefault({
|
|
4088
|
-
type: "prefault",
|
|
4089
|
-
innerType,
|
|
4090
|
-
get defaultValue() {
|
|
4091
|
-
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
526
|
+
"dark": {
|
|
527
|
+
"type": "object",
|
|
528
|
+
"required": true,
|
|
529
|
+
"description": "深色主题配置。"
|
|
4092
530
|
}
|
|
4093
|
-
}
|
|
4094
|
-
}
|
|
4095
|
-
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
4096
|
-
$ZodNonOptional.init(inst, def);
|
|
4097
|
-
ZodType.init(inst, def);
|
|
4098
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
4099
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4100
|
-
});
|
|
4101
|
-
function nonoptional(innerType, params) {
|
|
4102
|
-
return new ZodNonOptional({
|
|
4103
|
-
type: "nonoptional",
|
|
4104
|
-
innerType,
|
|
4105
|
-
...normalizeParams(params)
|
|
4106
|
-
});
|
|
4107
|
-
}
|
|
4108
|
-
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
4109
|
-
$ZodCatch.init(inst, def);
|
|
4110
|
-
ZodType.init(inst, def);
|
|
4111
|
-
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
4112
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4113
|
-
inst.removeCatch = inst.unwrap;
|
|
4114
|
-
});
|
|
4115
|
-
function _catch(innerType, catchValue) {
|
|
4116
|
-
return new ZodCatch({
|
|
4117
|
-
type: "catch",
|
|
4118
|
-
innerType,
|
|
4119
|
-
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
4120
|
-
});
|
|
4121
|
-
}
|
|
4122
|
-
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
4123
|
-
$ZodPipe.init(inst, def);
|
|
4124
|
-
ZodType.init(inst, def);
|
|
4125
|
-
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
4126
|
-
inst.in = def.in;
|
|
4127
|
-
inst.out = def.out;
|
|
4128
|
-
});
|
|
4129
|
-
function pipe(in_, out) {
|
|
4130
|
-
return new ZodPipe({
|
|
4131
|
-
type: "pipe",
|
|
4132
|
-
in: in_,
|
|
4133
|
-
out
|
|
4134
|
-
});
|
|
4135
|
-
}
|
|
4136
|
-
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
4137
|
-
$ZodReadonly.init(inst, def);
|
|
4138
|
-
ZodType.init(inst, def);
|
|
4139
|
-
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
4140
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4141
|
-
});
|
|
4142
|
-
function readonly(innerType) {
|
|
4143
|
-
return new ZodReadonly({
|
|
4144
|
-
type: "readonly",
|
|
4145
|
-
innerType
|
|
4146
|
-
});
|
|
4147
|
-
}
|
|
4148
|
-
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
4149
|
-
$ZodCustom.init(inst, def);
|
|
4150
|
-
ZodType.init(inst, def);
|
|
4151
|
-
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
4152
|
-
});
|
|
4153
|
-
function refine(fn, _params = {}) {
|
|
4154
|
-
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
4155
|
-
}
|
|
4156
|
-
function superRefine(fn) {
|
|
4157
|
-
return /* @__PURE__ */ _superRefine(fn);
|
|
4158
|
-
}
|
|
531
|
+
}
|
|
532
|
+
};
|
|
4159
533
|
//#endregion
|
|
4160
534
|
//#region scripts/json.ts
|
|
4161
|
-
|
|
4162
|
-
const
|
|
4163
|
-
|
|
4164
|
-
|
|
535
|
+
function metadataProperty(type) {
|
|
536
|
+
const normalized = type.toLowerCase().replace(/\s+/g, "");
|
|
537
|
+
if (normalized.includes("|")) return { anyOf: normalized.split("|").map(metadataProperty) };
|
|
538
|
+
if (normalized.endsWith("[]")) return {
|
|
539
|
+
type: "array",
|
|
540
|
+
items: metadataProperty(normalized.slice(0, -2))
|
|
541
|
+
};
|
|
542
|
+
if (normalized === "boolean") return { type: "boolean" };
|
|
543
|
+
if (normalized === "number") return { type: "number" };
|
|
544
|
+
if (normalized === "hexcolor" || normalized === "string") return { type: "string" };
|
|
545
|
+
return {
|
|
546
|
+
type: "object",
|
|
547
|
+
additionalProperties: true
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function enrichJsonSchema(schema, metadata) {
|
|
551
|
+
const properties = schema.properties ?? {};
|
|
552
|
+
for (const [name, field] of Object.entries(metadata.fields)) {
|
|
553
|
+
if (name.includes(".")) continue;
|
|
554
|
+
const property = properties[name] ?? metadataProperty(field.type);
|
|
555
|
+
if (field.description) property.description = field.description;
|
|
556
|
+
if (field.default !== void 0 && property.default === void 0) property.default = field.default;
|
|
557
|
+
if (field.enum?.length) property.enum = field.enum;
|
|
558
|
+
if (field["x-wechat-min-version"]) property["x-wechat-min-version"] = field["x-wechat-min-version"];
|
|
559
|
+
properties[name] = property;
|
|
560
|
+
if (field.required && !schema.required?.includes(name)) schema.required = [...schema.required ?? [], name];
|
|
561
|
+
}
|
|
562
|
+
schema.properties = properties;
|
|
563
|
+
schema["x-wechat-doc"] = metadata.source;
|
|
564
|
+
return schema;
|
|
565
|
+
}
|
|
566
|
+
function createJsonSchema(schema, metadata) {
|
|
567
|
+
return enrichJsonSchema(z.toJSONSchema(schema), metadata);
|
|
568
|
+
}
|
|
569
|
+
const metaSchema = z.object({ $schema: z.string() }).partial();
|
|
570
|
+
const sharedSchema = z.object({
|
|
571
|
+
usingComponents: z.record(z.string(), z.string()),
|
|
572
|
+
componentFramework: z.string()
|
|
4165
573
|
}).partial().extend(metaSchema.shape);
|
|
4166
|
-
const pageAndComponentSharedSchema = looseObject({ componentPlaceholder: looseObject({}) }).partial().extend(sharedSchema.shape);
|
|
4167
|
-
const appAndPageSharedSchema = looseObject({
|
|
4168
|
-
style: string(),
|
|
4169
|
-
singlePage: looseObject({}),
|
|
4170
|
-
enablePassiveEvent: looseObject({}).or(boolean()),
|
|
4171
|
-
renderer:
|
|
4172
|
-
rendererOptions: looseObject({ skyline: looseObject({
|
|
4173
|
-
defaultDisplayBlock: boolean().default(false),
|
|
4174
|
-
defaultContentBox: boolean().default(false),
|
|
4175
|
-
disableABTest: boolean().default(false)
|
|
574
|
+
const pageAndComponentSharedSchema = z.looseObject({ componentPlaceholder: z.looseObject({}) }).partial().extend(sharedSchema.shape);
|
|
575
|
+
const appAndPageSharedSchema = z.looseObject({
|
|
576
|
+
style: z.string(),
|
|
577
|
+
singlePage: z.looseObject({}),
|
|
578
|
+
enablePassiveEvent: z.looseObject({}).or(z.boolean()),
|
|
579
|
+
renderer: z.enum(["webview", "skyline"]).default("webview"),
|
|
580
|
+
rendererOptions: z.looseObject({ skyline: z.looseObject({
|
|
581
|
+
defaultDisplayBlock: z.boolean().default(false),
|
|
582
|
+
defaultContentBox: z.boolean().default(false),
|
|
583
|
+
disableABTest: z.boolean().default(false)
|
|
4176
584
|
}).partial() }).partial()
|
|
4177
585
|
}).partial().extend(sharedSchema.shape);
|
|
4178
|
-
const windowSchema = looseObject({
|
|
4179
|
-
navigationBarBackgroundColor: string().default("#000000"),
|
|
4180
|
-
navigationBarTextStyle: string().default("white"),
|
|
4181
|
-
navigationBarTitleText: string(),
|
|
4182
|
-
navigationStyle:
|
|
4183
|
-
homeButton: boolean().default(false),
|
|
4184
|
-
backgroundColor: string().default("#ffffff"),
|
|
4185
|
-
backgroundTextStyle:
|
|
4186
|
-
backgroundColorTop: string().default("#ffffff"),
|
|
4187
|
-
backgroundColorBottom: string().default("#ffffff"),
|
|
4188
|
-
enablePullDownRefresh: boolean().default(false),
|
|
4189
|
-
onReachBottomDistance: number().default(50),
|
|
4190
|
-
pageOrientation:
|
|
586
|
+
const windowSchema = z.looseObject({
|
|
587
|
+
navigationBarBackgroundColor: z.string().default("#000000"),
|
|
588
|
+
navigationBarTextStyle: z.string().default("white"),
|
|
589
|
+
navigationBarTitleText: z.string(),
|
|
590
|
+
navigationStyle: z.enum(["default", "custom"]).default("default"),
|
|
591
|
+
homeButton: z.boolean().default(false),
|
|
592
|
+
backgroundColor: z.string().default("#ffffff"),
|
|
593
|
+
backgroundTextStyle: z.enum(["dark", "light"]).default("dark"),
|
|
594
|
+
backgroundColorTop: z.string().default("#ffffff"),
|
|
595
|
+
backgroundColorBottom: z.string().default("#ffffff"),
|
|
596
|
+
enablePullDownRefresh: z.boolean().default(false),
|
|
597
|
+
onReachBottomDistance: z.number().default(50),
|
|
598
|
+
pageOrientation: z.enum([
|
|
4191
599
|
"portrait",
|
|
4192
600
|
"auto",
|
|
4193
601
|
"landscape"
|
|
4194
602
|
]).default("portrait"),
|
|
4195
|
-
restartStrategy:
|
|
4196
|
-
initialRenderingCache:
|
|
4197
|
-
|
|
4198
|
-
|
|
603
|
+
restartStrategy: z.enum(["homePage", "homePageAndLatestPage"]).default("homePage"),
|
|
604
|
+
initialRenderingCache: z.enum([
|
|
605
|
+
"static",
|
|
606
|
+
"dynamic",
|
|
607
|
+
"capture"
|
|
608
|
+
]),
|
|
609
|
+
visualEffectInBackground: z.enum(["none", "hidden"]).default("none"),
|
|
610
|
+
handleWebviewPreload: z.enum([
|
|
4199
611
|
"static",
|
|
4200
612
|
"manual",
|
|
4201
613
|
"auto"
|
|
4202
614
|
]).default("static")
|
|
4203
615
|
}).partial();
|
|
4204
|
-
const tabBarSchema = looseObject({
|
|
4205
|
-
color: string(),
|
|
4206
|
-
selectedColor: string(),
|
|
4207
|
-
backgroundColor: string(),
|
|
4208
|
-
borderStyle:
|
|
4209
|
-
list: array(looseObject({
|
|
4210
|
-
pagePath: string(),
|
|
4211
|
-
text: string(),
|
|
4212
|
-
iconPath: string(),
|
|
4213
|
-
selectedIconPath: string()
|
|
616
|
+
const tabBarSchema = z.looseObject({
|
|
617
|
+
color: z.string(),
|
|
618
|
+
selectedColor: z.string(),
|
|
619
|
+
backgroundColor: z.string(),
|
|
620
|
+
borderStyle: z.enum(["black", "white"]).default("black"),
|
|
621
|
+
list: z.array(z.looseObject({
|
|
622
|
+
pagePath: z.string(),
|
|
623
|
+
text: z.string(),
|
|
624
|
+
iconPath: z.string(),
|
|
625
|
+
selectedIconPath: z.string()
|
|
4214
626
|
}).partial().required({
|
|
4215
627
|
pagePath: true,
|
|
4216
628
|
text: true
|
|
4217
629
|
})).min(2).max(5),
|
|
4218
|
-
position:
|
|
4219
|
-
custom: boolean()
|
|
630
|
+
position: z.enum(["bottom", "top"]).default("bottom"),
|
|
631
|
+
custom: z.boolean()
|
|
4220
632
|
}).partial().required({
|
|
4221
633
|
color: true,
|
|
4222
634
|
selectedColor: true,
|
|
4223
635
|
list: true,
|
|
4224
636
|
backgroundColor: true
|
|
4225
637
|
});
|
|
4226
|
-
const networkTimeoutSchema = looseObject({
|
|
4227
|
-
request: number().default(6e4),
|
|
4228
|
-
connectSocket: number().default(6e4),
|
|
4229
|
-
uploadFile: number().default(6e4),
|
|
4230
|
-
downloadFile: number().default(6e4)
|
|
638
|
+
const networkTimeoutSchema = z.looseObject({
|
|
639
|
+
request: z.number().default(6e4),
|
|
640
|
+
connectSocket: z.number().default(6e4),
|
|
641
|
+
uploadFile: z.number().default(6e4),
|
|
642
|
+
downloadFile: z.number().default(6e4)
|
|
643
|
+
}).partial();
|
|
644
|
+
const subpackageSchema = z.looseObject({
|
|
645
|
+
root: z.string(),
|
|
646
|
+
name: z.string(),
|
|
647
|
+
pages: z.string().array(),
|
|
648
|
+
independent: z.boolean(),
|
|
649
|
+
entry: z.string()
|
|
4231
650
|
}).partial();
|
|
4232
|
-
const subpackageSchemaArray = array(
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
pages: string().
|
|
4236
|
-
independent: boolean(),
|
|
4237
|
-
entry: string()
|
|
4238
|
-
}).partial());
|
|
4239
|
-
const AppSchema = looseObject({
|
|
4240
|
-
entryPagePath: string().describe("指定小程序的默认启动路径(首页),常见情景是从微信聊天列表页下拉启动、小程序列表启动等。如果不填,将默认为 pages 列表的第一项。不支持带页面路径参数。"),
|
|
4241
|
-
pages: array(string()).describe("用于指定小程序由哪些页面组成,每一项都对应一个页面的 路径(含文件名) 信息。文件名不需要写文件后缀,框架会自动去寻找对应位置的 .json, .js, .wxml, .wxss 四个文件进行处理。"),
|
|
651
|
+
const subpackageSchemaArray = z.array(subpackageSchema);
|
|
652
|
+
const AppSchema = z.looseObject({
|
|
653
|
+
entryPagePath: z.string().describe("指定小程序的默认启动路径(首页),常见情景是从微信聊天列表页下拉启动、小程序列表启动等。如果不填,将默认为 pages 列表的第一项。不支持带页面路径参数。"),
|
|
654
|
+
pages: z.array(z.string()).describe("用于指定小程序由哪些页面组成,每一项都对应一个页面的 路径(含文件名) 信息。文件名不需要写文件后缀,框架会自动去寻找对应位置的 .json, .js, .wxml, .wxss 四个文件进行处理。"),
|
|
4242
655
|
window: windowSchema,
|
|
4243
656
|
tabBar: tabBarSchema,
|
|
4244
657
|
networkTimeout: networkTimeoutSchema,
|
|
4245
|
-
debug: boolean(),
|
|
4246
|
-
functionalPages: boolean(),
|
|
658
|
+
debug: z.boolean(),
|
|
659
|
+
functionalPages: z.boolean(),
|
|
4247
660
|
subpackages: subpackageSchemaArray,
|
|
4248
661
|
subPackages: subpackageSchemaArray,
|
|
4249
|
-
workers: union([string(), looseObject({
|
|
4250
|
-
path: string(),
|
|
4251
|
-
isSubpackage: boolean()
|
|
662
|
+
workers: z.union([z.string(), z.looseObject({
|
|
663
|
+
path: z.string(),
|
|
664
|
+
isSubpackage: z.boolean()
|
|
4252
665
|
}).partial()]),
|
|
4253
|
-
requiredBackgroundModes: array(string()),
|
|
4254
|
-
requiredPrivateInfos: array(string()),
|
|
4255
|
-
plugins: looseObject({}),
|
|
4256
|
-
preloadRule: looseObject({}),
|
|
4257
|
-
resizable: boolean(),
|
|
4258
|
-
permission: looseObject({}),
|
|
4259
|
-
sitemapLocation: string(),
|
|
4260
|
-
useExtendedLib: looseObject({}),
|
|
4261
|
-
entranceDeclare: looseObject({}),
|
|
4262
|
-
darkmode: boolean(),
|
|
4263
|
-
themeLocation: string(),
|
|
4264
|
-
lazyCodeLoading: string(),
|
|
4265
|
-
supportedMaterials: looseObject({}),
|
|
4266
|
-
serviceProviderTicket: string(),
|
|
4267
|
-
embeddedAppIdList: array(string()),
|
|
4268
|
-
halfPage: looseObject({}),
|
|
4269
|
-
debugOptions: looseObject({}),
|
|
4270
|
-
resolveAlias: looseObject({}),
|
|
4271
|
-
miniApp: looseObject({}),
|
|
4272
|
-
static: looseObject({}),
|
|
4273
|
-
convertRpxToVw: boolean(),
|
|
4274
|
-
appBar: looseObject({})
|
|
666
|
+
requiredBackgroundModes: z.array(z.string()),
|
|
667
|
+
requiredPrivateInfos: z.array(z.string()),
|
|
668
|
+
plugins: z.looseObject({}),
|
|
669
|
+
preloadRule: z.looseObject({}),
|
|
670
|
+
resizable: z.boolean(),
|
|
671
|
+
permission: z.looseObject({}),
|
|
672
|
+
sitemapLocation: z.string(),
|
|
673
|
+
useExtendedLib: z.looseObject({}),
|
|
674
|
+
entranceDeclare: z.looseObject({}),
|
|
675
|
+
darkmode: z.boolean(),
|
|
676
|
+
themeLocation: z.string(),
|
|
677
|
+
lazyCodeLoading: z.string(),
|
|
678
|
+
supportedMaterials: z.looseObject({}),
|
|
679
|
+
serviceProviderTicket: z.string(),
|
|
680
|
+
embeddedAppIdList: z.array(z.string()),
|
|
681
|
+
halfPage: z.looseObject({}),
|
|
682
|
+
debugOptions: z.looseObject({}),
|
|
683
|
+
resolveAlias: z.looseObject({}),
|
|
684
|
+
miniApp: z.looseObject({}),
|
|
685
|
+
static: z.looseObject({}),
|
|
686
|
+
convertRpxToVw: z.boolean(),
|
|
687
|
+
appBar: z.looseObject({}),
|
|
688
|
+
chatTools: z.looseObject({})
|
|
4275
689
|
}).partial().required({ pages: true }).extend(appAndPageSharedSchema.shape).describe("全局配置, 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。");
|
|
4276
|
-
const PageSchema = looseObject({
|
|
4277
|
-
backgroundColorContent: string().default("#RRGGBBAA"),
|
|
4278
|
-
disableScroll: boolean().default(false),
|
|
4279
|
-
styleIsolation:
|
|
690
|
+
const PageSchema = z.looseObject({
|
|
691
|
+
backgroundColorContent: z.string().default("#RRGGBBAA"),
|
|
692
|
+
disableScroll: z.boolean().default(false),
|
|
693
|
+
styleIsolation: z.enum([
|
|
4280
694
|
"page-isolated",
|
|
4281
695
|
"page-apply-shared",
|
|
4282
696
|
"page-shared"
|
|
4283
697
|
])
|
|
4284
698
|
}).partial().extend(appAndPageSharedSchema.shape).extend(pageAndComponentSharedSchema.shape).extend(windowSchema.shape).describe("页面配置, 支持对单个页面进行配置,可以在页面对应的 .json 文件来对本页面的表现进行配置");
|
|
4285
|
-
const ComponentSchema = looseObject({
|
|
4286
|
-
component: boolean().default(true),
|
|
4287
|
-
styleIsolation:
|
|
699
|
+
const ComponentSchema = z.looseObject({
|
|
700
|
+
component: z.boolean().default(true),
|
|
701
|
+
styleIsolation: z.enum([
|
|
4288
702
|
"isolated",
|
|
4289
703
|
"apply-shared",
|
|
4290
704
|
"shared"
|
|
4291
705
|
]).default("isolated"),
|
|
4292
|
-
componentGenerics: looseObject({})
|
|
706
|
+
componentGenerics: z.looseObject({})
|
|
4293
707
|
}).partial().extend(pageAndComponentSharedSchema.shape).describe("自定义组件配置");
|
|
4294
|
-
const AppJsonSchema =
|
|
4295
|
-
const PageJsonSchema =
|
|
4296
|
-
const ComponentJsonSchema =
|
|
4297
|
-
const ThemeSchema = looseObject({
|
|
4298
|
-
light: looseObject({}),
|
|
4299
|
-
dark: looseObject({})
|
|
708
|
+
const AppJsonSchema = createJsonSchema(AppSchema, app_default);
|
|
709
|
+
const PageJsonSchema = createJsonSchema(PageSchema, page_default);
|
|
710
|
+
const ComponentJsonSchema = createJsonSchema(ComponentSchema, component_default);
|
|
711
|
+
const ThemeSchema = z.looseObject({
|
|
712
|
+
light: z.looseObject({}),
|
|
713
|
+
dark: z.looseObject({})
|
|
4300
714
|
}).extend(metaSchema.shape);
|
|
4301
|
-
const SitemapSchema = looseObject({ rules: object({
|
|
4302
|
-
action:
|
|
4303
|
-
page: string(),
|
|
4304
|
-
params: string().array(),
|
|
4305
|
-
matching:
|
|
715
|
+
const SitemapSchema = z.looseObject({ rules: z.object({
|
|
716
|
+
action: z.enum(["allow", "disallow"]).default("allow"),
|
|
717
|
+
page: z.string(),
|
|
718
|
+
params: z.string().array(),
|
|
719
|
+
matching: z.enum([
|
|
4306
720
|
"exact",
|
|
4307
721
|
"inclusive",
|
|
4308
722
|
"exclusive",
|
|
4309
723
|
"partial"
|
|
4310
724
|
]).default("inclusive"),
|
|
4311
|
-
priority: number()
|
|
725
|
+
priority: z.number()
|
|
4312
726
|
}).partial({
|
|
4313
727
|
action: true,
|
|
4314
728
|
params: true,
|
|
4315
729
|
matching: true,
|
|
4316
730
|
priority: true
|
|
4317
731
|
}).array() }).extend(metaSchema.shape).describe("https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html");
|
|
4318
|
-
const ThemeJsonSchema =
|
|
4319
|
-
const SitemapJsonSchema =
|
|
4320
|
-
const PluginJsonSchema =
|
|
4321
|
-
publicComponents: record(string(), string()),
|
|
4322
|
-
pages: record(string(), string()),
|
|
4323
|
-
main: string()
|
|
4324
|
-
}).partial().describe("https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"));
|
|
732
|
+
const ThemeJsonSchema = createJsonSchema(ThemeSchema, theme_default);
|
|
733
|
+
const SitemapJsonSchema = createJsonSchema(SitemapSchema, sitemap_default);
|
|
734
|
+
const PluginJsonSchema = createJsonSchema(z.looseObject({
|
|
735
|
+
publicComponents: z.record(z.string(), z.string()),
|
|
736
|
+
pages: z.record(z.string(), z.string()),
|
|
737
|
+
main: z.string()
|
|
738
|
+
}).partial().describe("https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"), plugin_default);
|
|
4325
739
|
//#endregion
|
|
4326
740
|
//#region src/json.ts
|
|
4327
741
|
/**
|