odoro 0.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/LICENSE +12 -0
- package/client.d.ts +84 -0
- package/dist/build-SNTGJH2J.js +4 -0
- package/dist/chunk-2YDI5NKV.js +55 -0
- package/dist/chunk-G2WW7N4C.js +1872 -0
- package/dist/chunk-G5QXVBYT.js +1139 -0
- package/dist/chunk-JMEHF3KN.js +35 -0
- package/dist/chunk-PEMYUK2D.js +64 -0
- package/dist/chunk-T42X2NJN.js +98 -0
- package/dist/chunk-T6RLHSCW.js +123 -0
- package/dist/chunk-UGRSODHU.js +154 -0
- package/dist/cli.d.ts +40 -0
- package/dist/cli.js +236 -0
- package/dist/commands-FVAHVVVN.js +793 -0
- package/dist/commands-V44Y5G4F.js +245 -0
- package/dist/create-SH2M722Y.js +288 -0
- package/dist/index.d.ts +354 -0
- package/dist/index.js +7 -0
- package/dist/package-AUINPBEX.js +62 -0
- package/dist/preview-LOAO5Y6V.js +3 -0
- package/dist/registry/index.d.ts +316 -0
- package/dist/registry/index.js +2 -0
- package/dist/server-MZ76LPAG.js +3 -0
- package/package.json +57 -0
- package/templates/react-ts/README.md +52 -0
- package/templates/react-ts/_gitignore +8 -0
- package/templates/react-ts/index.html +13 -0
- package/templates/react-ts/odoro.config.ts +10 -0
- package/templates/react-ts/package.json +23 -0
- package/templates/react-ts/public/favicon.svg +4 -0
- package/templates/react-ts/src/App.tsx +66 -0
- package/templates/react-ts/src/main.tsx +18 -0
- package/templates/react-ts/src/odoro-env.d.ts +1 -0
- package/templates/react-ts/src/routes/About.tsx +19 -0
- package/templates/react-ts/src/routes/Home.tsx +80 -0
- package/templates/react-ts/src/routes/NotFound.tsx +14 -0
- package/templates/react-ts/src/styles.css +13 -0
- package/templates/react-ts/tsconfig.json +25 -0
- package/templates/react-ts-server/Dockerfile +51 -0
- package/templates/react-ts-server/README.md +87 -0
- package/templates/react-ts-server/_dockerignore +8 -0
- package/templates/react-ts-server/_env.example +78 -0
- package/templates/react-ts-server/_gitignore +8 -0
- package/templates/react-ts-server/client/index.html +13 -0
- package/templates/react-ts-server/client/public/favicon.svg +4 -0
- package/templates/react-ts-server/client/src/App.tsx +66 -0
- package/templates/react-ts-server/client/src/main.tsx +18 -0
- package/templates/react-ts-server/client/src/odoro-env.d.ts +1 -0
- package/templates/react-ts-server/client/src/routes/About.tsx +19 -0
- package/templates/react-ts-server/client/src/routes/Home.tsx +148 -0
- package/templates/react-ts-server/client/src/routes/NotFound.tsx +14 -0
- package/templates/react-ts-server/client/src/styles.css +13 -0
- package/templates/react-ts-server/odoro.config.ts +21 -0
- package/templates/react-ts-server/package.json +33 -0
- package/templates/react-ts-server/scripts/dev.mjs +74 -0
- package/templates/react-ts-server/server/src/main.ts +131 -0
- package/templates/react-ts-server/server/src/modules/health/index.ts +144 -0
- package/templates/react-ts-server/server/tsconfig.json +23 -0
- package/templates/react-ts-server/tsconfig.json +27 -0
|
@@ -0,0 +1,1872 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/util.js
|
|
3
|
+
function getEnumValues(entries) {
|
|
4
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
5
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
6
|
+
return values;
|
|
7
|
+
}
|
|
8
|
+
function jsonStringifyReplacer(_, value) {
|
|
9
|
+
if (typeof value === "bigint")
|
|
10
|
+
return value.toString();
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function cached(getter) {
|
|
14
|
+
return {
|
|
15
|
+
get value() {
|
|
16
|
+
{
|
|
17
|
+
const value = getter();
|
|
18
|
+
Object.defineProperty(this, "value", { value });
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function nullish(input) {
|
|
25
|
+
return input === null || input === void 0;
|
|
26
|
+
}
|
|
27
|
+
function cleanRegex(source) {
|
|
28
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
29
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
30
|
+
return source.slice(start, end);
|
|
31
|
+
}
|
|
32
|
+
function assignProp(target, prop, value) {
|
|
33
|
+
Object.defineProperty(target, prop, {
|
|
34
|
+
value,
|
|
35
|
+
writable: true,
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
41
|
+
};
|
|
42
|
+
function isObject(data) {
|
|
43
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
44
|
+
}
|
|
45
|
+
function isPlainObject(o) {
|
|
46
|
+
if (isObject(o) === false)
|
|
47
|
+
return false;
|
|
48
|
+
const ctor = o.constructor;
|
|
49
|
+
if (ctor === void 0)
|
|
50
|
+
return true;
|
|
51
|
+
if (typeof ctor !== "function")
|
|
52
|
+
return true;
|
|
53
|
+
const prot = ctor.prototype;
|
|
54
|
+
if (isObject(prot) === false)
|
|
55
|
+
return false;
|
|
56
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
function shallowClone(o) {
|
|
62
|
+
if (isPlainObject(o))
|
|
63
|
+
return { ...o };
|
|
64
|
+
if (Array.isArray(o))
|
|
65
|
+
return [...o];
|
|
66
|
+
if (o instanceof Map)
|
|
67
|
+
return new Map(o);
|
|
68
|
+
if (o instanceof Set)
|
|
69
|
+
return new Set(o);
|
|
70
|
+
return o;
|
|
71
|
+
}
|
|
72
|
+
var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
73
|
+
function escapeRegex(str) {
|
|
74
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
75
|
+
}
|
|
76
|
+
function clone(inst, def, params) {
|
|
77
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
78
|
+
if (!def || params?.parent)
|
|
79
|
+
cl._zod.parent = inst;
|
|
80
|
+
return cl;
|
|
81
|
+
}
|
|
82
|
+
function normalizeParams(_params) {
|
|
83
|
+
const params = _params;
|
|
84
|
+
if (!params)
|
|
85
|
+
return {};
|
|
86
|
+
if (typeof params === "string")
|
|
87
|
+
return { error: () => params };
|
|
88
|
+
if (params?.message !== void 0) {
|
|
89
|
+
if (params?.error !== void 0)
|
|
90
|
+
throw new Error("Cannot specify both `message` and `error` params");
|
|
91
|
+
params.error = params.message;
|
|
92
|
+
}
|
|
93
|
+
delete params.message;
|
|
94
|
+
if (typeof params.error === "string")
|
|
95
|
+
return { ...params, error: () => params.error };
|
|
96
|
+
return params;
|
|
97
|
+
}
|
|
98
|
+
function optionalKeys(shape) {
|
|
99
|
+
return Object.keys(shape).filter((k) => {
|
|
100
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function aborted(x, startIndex = 0) {
|
|
104
|
+
if (x.aborted === true)
|
|
105
|
+
return true;
|
|
106
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
107
|
+
if (x.issues[i]?.continue !== true) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
function explicitlyAborted(x, startIndex = 0) {
|
|
114
|
+
if (x.aborted === true)
|
|
115
|
+
return true;
|
|
116
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
117
|
+
if (x.issues[i]?.continue === false) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
function prefixIssues(path, issues) {
|
|
124
|
+
return issues.map((iss) => {
|
|
125
|
+
var _a2;
|
|
126
|
+
(_a2 = iss).path ?? (_a2.path = []);
|
|
127
|
+
iss.path.unshift(path);
|
|
128
|
+
return iss;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function unwrapMessage(message) {
|
|
132
|
+
return typeof message === "string" ? message : message?.message;
|
|
133
|
+
}
|
|
134
|
+
function attachSchema(issues, start, inst) {
|
|
135
|
+
var _a2;
|
|
136
|
+
for (let i = start; i < issues.length; i++) {
|
|
137
|
+
(_a2 = issues[i]).schema ?? (_a2.schema = inst);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function finalizeIssue(iss, ctx, config2) {
|
|
141
|
+
var _a2;
|
|
142
|
+
const traits = iss.inst?._zod?.traits;
|
|
143
|
+
if (traits?.has("$ZodType")) {
|
|
144
|
+
if (traits.has("$ZodCheck"))
|
|
145
|
+
(_a2 = iss).schema ?? (_a2.schema = iss.inst);
|
|
146
|
+
else
|
|
147
|
+
iss.schema = iss.inst;
|
|
148
|
+
}
|
|
149
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
150
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
151
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
|
|
152
|
+
rest.path ?? (rest.path = []);
|
|
153
|
+
rest.message = message;
|
|
154
|
+
if (ctx?.reportInput) {
|
|
155
|
+
rest.input = _input;
|
|
156
|
+
}
|
|
157
|
+
return rest;
|
|
158
|
+
}
|
|
159
|
+
var highSurrogate = /[\uD800-\uDBFF]/;
|
|
160
|
+
function codePointLength(str) {
|
|
161
|
+
const units = str.length;
|
|
162
|
+
if (!highSurrogate.test(str))
|
|
163
|
+
return units;
|
|
164
|
+
let count = units;
|
|
165
|
+
for (let i = 0; i < units - 1; i++) {
|
|
166
|
+
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
167
|
+
count--;
|
|
168
|
+
i++;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return count;
|
|
172
|
+
}
|
|
173
|
+
function getLengthableOrigin(input) {
|
|
174
|
+
if (Array.isArray(input))
|
|
175
|
+
return "array";
|
|
176
|
+
if (typeof input === "string")
|
|
177
|
+
return "string";
|
|
178
|
+
return "unknown";
|
|
179
|
+
}
|
|
180
|
+
function issue(...args) {
|
|
181
|
+
const [iss, input, inst] = args;
|
|
182
|
+
if (typeof iss === "string") {
|
|
183
|
+
return {
|
|
184
|
+
message: iss,
|
|
185
|
+
code: "custom",
|
|
186
|
+
input,
|
|
187
|
+
inst
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return { ...iss };
|
|
191
|
+
}
|
|
192
|
+
function members(proto, table) {
|
|
193
|
+
for (const key in table) {
|
|
194
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
195
|
+
if (desc.get)
|
|
196
|
+
Object.defineProperty(proto, key, { ...desc, enumerable: false });
|
|
197
|
+
else
|
|
198
|
+
defineBound(proto, key, desc.value);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function own(inst, key, value, enumerable = true) {
|
|
202
|
+
Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
|
|
203
|
+
return value;
|
|
204
|
+
}
|
|
205
|
+
function hide(inst, key, value) {
|
|
206
|
+
return own(inst, key, value, false);
|
|
207
|
+
}
|
|
208
|
+
function defineBound(proto, key, fn) {
|
|
209
|
+
Object.defineProperty(proto, key, {
|
|
210
|
+
configurable: true,
|
|
211
|
+
get() {
|
|
212
|
+
return own(this, key, fn.bind(this));
|
|
213
|
+
},
|
|
214
|
+
set(value) {
|
|
215
|
+
own(this, key, value);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function claim(inst, sentinel) {
|
|
220
|
+
const proto = Object.getPrototypeOf(inst);
|
|
221
|
+
return sentinel in proto ? void 0 : proto;
|
|
222
|
+
}
|
|
223
|
+
var installing;
|
|
224
|
+
var broke = false;
|
|
225
|
+
var breaker = {
|
|
226
|
+
configurable: true,
|
|
227
|
+
get() {
|
|
228
|
+
broke = true;
|
|
229
|
+
return void 0;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
function defineLazyInternal(inst, key, compute) {
|
|
233
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
234
|
+
if (key in proto && installing !== inst._zod) {
|
|
235
|
+
installing = void 0;
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
installing = inst._zod;
|
|
239
|
+
Object.defineProperty(proto, key, {
|
|
240
|
+
configurable: true,
|
|
241
|
+
get() {
|
|
242
|
+
Object.defineProperty(this, key, breaker);
|
|
243
|
+
const outer = broke;
|
|
244
|
+
broke = false;
|
|
245
|
+
try {
|
|
246
|
+
const value = compute(this);
|
|
247
|
+
if (broke)
|
|
248
|
+
delete this[key];
|
|
249
|
+
else
|
|
250
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
251
|
+
broke = broke || outer;
|
|
252
|
+
return value;
|
|
253
|
+
} catch (err) {
|
|
254
|
+
delete this[key];
|
|
255
|
+
broke = broke || outer;
|
|
256
|
+
throw err;
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
set(value) {
|
|
260
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
265
|
+
const proto = claim(inst, key);
|
|
266
|
+
if (!proto)
|
|
267
|
+
return;
|
|
268
|
+
Object.defineProperty(proto, key, {
|
|
269
|
+
configurable: true,
|
|
270
|
+
get() {
|
|
271
|
+
const desc = { configurable: true, writable: true, enumerable, value: void 0 };
|
|
272
|
+
Object.defineProperty(this, key, desc);
|
|
273
|
+
desc.value = make(this);
|
|
274
|
+
Object.defineProperty(this, key, desc);
|
|
275
|
+
return desc.value;
|
|
276
|
+
},
|
|
277
|
+
set(value) {
|
|
278
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/core.js
|
|
284
|
+
var _a;
|
|
285
|
+
var _zodDesc = { value: void 0, enumerable: false };
|
|
286
|
+
var _E = "captureStackTrace" in Error ? Error : null;
|
|
287
|
+
function newError(Definition) {
|
|
288
|
+
const E = _E;
|
|
289
|
+
if (E) {
|
|
290
|
+
const saved = E.stackTraceLimit;
|
|
291
|
+
if (typeof saved === "number") {
|
|
292
|
+
try {
|
|
293
|
+
E.stackTraceLimit = 0;
|
|
294
|
+
} catch {
|
|
295
|
+
_E = null;
|
|
296
|
+
return new Definition();
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
return new Definition();
|
|
300
|
+
} finally {
|
|
301
|
+
E.stackTraceLimit = saved;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return new Definition();
|
|
306
|
+
}
|
|
307
|
+
// @__NO_SIDE_EFFECTS__
|
|
308
|
+
function $constructor(name, initializer2, proto, params) {
|
|
309
|
+
const zodProto = {};
|
|
310
|
+
function Internals(def) {
|
|
311
|
+
this.def = def;
|
|
312
|
+
this.constr = _;
|
|
313
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
314
|
+
}
|
|
315
|
+
Internals.prototype = zodProto;
|
|
316
|
+
const protoMembers = proto;
|
|
317
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
318
|
+
function init(inst, def) {
|
|
319
|
+
if (!inst._zod) {
|
|
320
|
+
_zodDesc.value = new Internals(def);
|
|
321
|
+
try {
|
|
322
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
323
|
+
} finally {
|
|
324
|
+
_zodDesc.value = void 0;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (inst._zod.traits.has(name)) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
inst._zod.traits.add(name);
|
|
331
|
+
initializer2(inst, def);
|
|
332
|
+
if (initialized) {
|
|
333
|
+
const own2 = Object.getPrototypeOf(inst);
|
|
334
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
335
|
+
let up = own2;
|
|
336
|
+
while (up && up !== ctorProto)
|
|
337
|
+
up = Object.getPrototypeOf(up);
|
|
338
|
+
const target = up ?? own2;
|
|
339
|
+
if (!initialized.has(target)) {
|
|
340
|
+
initialized.add(target);
|
|
341
|
+
members(target, protoMembers);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const proto2 = _.prototype;
|
|
345
|
+
for (const k in proto2) {
|
|
346
|
+
if (!Object.prototype.hasOwnProperty.call(proto2, k))
|
|
347
|
+
continue;
|
|
348
|
+
if (!(k in inst)) {
|
|
349
|
+
inst[k] = proto2[k].bind(inst);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const Parent = params?.Parent ?? Object;
|
|
354
|
+
class Definition extends Parent {
|
|
355
|
+
}
|
|
356
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
357
|
+
function _(def) {
|
|
358
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
359
|
+
init(inst, def);
|
|
360
|
+
const deferred = inst._zod.deferred;
|
|
361
|
+
if (deferred) {
|
|
362
|
+
for (const fn of deferred) {
|
|
363
|
+
fn();
|
|
364
|
+
}
|
|
365
|
+
inst._zod.deferred = void 0;
|
|
366
|
+
}
|
|
367
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
368
|
+
if (pp)
|
|
369
|
+
pp(inst);
|
|
370
|
+
return inst;
|
|
371
|
+
}
|
|
372
|
+
Object.defineProperty(_, "init", { value: init });
|
|
373
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
374
|
+
value: (inst) => {
|
|
375
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
376
|
+
return true;
|
|
377
|
+
return inst?._zod?.traits?.has(name);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
Object.defineProperty(_, "name", { value: name });
|
|
381
|
+
return _;
|
|
382
|
+
}
|
|
383
|
+
var $ZodAsyncError = class extends Error {
|
|
384
|
+
constructor() {
|
|
385
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
389
|
+
var globalConfig = globalThis.__zod_globalConfig;
|
|
390
|
+
function config(newConfig) {
|
|
391
|
+
return globalConfig;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/errors.js
|
|
395
|
+
function _getMessage() {
|
|
396
|
+
const internals = this._zod;
|
|
397
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
398
|
+
return internals.message;
|
|
399
|
+
}
|
|
400
|
+
function _setMessage(value) {
|
|
401
|
+
this._zod.message = value;
|
|
402
|
+
}
|
|
403
|
+
var _messageDesc = {
|
|
404
|
+
get: _getMessage,
|
|
405
|
+
set: _setMessage,
|
|
406
|
+
enumerable: true,
|
|
407
|
+
configurable: true
|
|
408
|
+
};
|
|
409
|
+
var _zodDesc2 = { value: void 0, enumerable: false };
|
|
410
|
+
var _issuesDesc = { value: void 0, enumerable: false };
|
|
411
|
+
var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
412
|
+
var initializer = (inst, def) => {
|
|
413
|
+
inst.name = "$ZodError";
|
|
414
|
+
_zodDesc2.value = inst._zod;
|
|
415
|
+
Object.defineProperty(inst, "_zod", _zodDesc2);
|
|
416
|
+
_issuesDesc.value = def;
|
|
417
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
418
|
+
_zodDesc2.value = void 0;
|
|
419
|
+
_issuesDesc.value = void 0;
|
|
420
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
421
|
+
const proto = Object.getPrototypeOf(inst);
|
|
422
|
+
if (!_installedToString.has(proto)) {
|
|
423
|
+
_installedToString.add(proto);
|
|
424
|
+
Object.defineProperty(proto, "toString", {
|
|
425
|
+
configurable: true,
|
|
426
|
+
enumerable: false,
|
|
427
|
+
get() {
|
|
428
|
+
const value = () => this.message;
|
|
429
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
430
|
+
return value;
|
|
431
|
+
},
|
|
432
|
+
set(value) {
|
|
433
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
var $ZodError = $constructor("$ZodError", initializer);
|
|
439
|
+
var $ZodRealError = $constructor("$ZodError", initializer, void 0, {
|
|
440
|
+
Parent: Error
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/parse.js
|
|
444
|
+
var _parse = (_Err) => {
|
|
445
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
446
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
447
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
448
|
+
if (result instanceof Promise) {
|
|
449
|
+
throw new $ZodAsyncError();
|
|
450
|
+
}
|
|
451
|
+
if (result.issues.length) {
|
|
452
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
453
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
454
|
+
throw e;
|
|
455
|
+
}
|
|
456
|
+
return result.value;
|
|
457
|
+
};
|
|
458
|
+
return fn;
|
|
459
|
+
};
|
|
460
|
+
var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
461
|
+
var _parseAsync = (_Err) => {
|
|
462
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
463
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
464
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
465
|
+
if (result instanceof Promise)
|
|
466
|
+
result = await result;
|
|
467
|
+
if (result.issues.length) {
|
|
468
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
469
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
470
|
+
throw e;
|
|
471
|
+
}
|
|
472
|
+
return result.value;
|
|
473
|
+
};
|
|
474
|
+
return fn;
|
|
475
|
+
};
|
|
476
|
+
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
477
|
+
var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
478
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
479
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
480
|
+
if (result instanceof Promise) {
|
|
481
|
+
throw new $ZodAsyncError();
|
|
482
|
+
}
|
|
483
|
+
return result.issues.length ? {
|
|
484
|
+
success: false,
|
|
485
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
486
|
+
} : { success: true, data: result.value };
|
|
487
|
+
};
|
|
488
|
+
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
489
|
+
var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
490
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
491
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
492
|
+
if (result instanceof Promise)
|
|
493
|
+
result = await result;
|
|
494
|
+
return result.issues.length ? {
|
|
495
|
+
success: false,
|
|
496
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
497
|
+
} : { success: true, data: result.value };
|
|
498
|
+
};
|
|
499
|
+
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
500
|
+
|
|
501
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/regexes.js
|
|
502
|
+
var string = (params) => {
|
|
503
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
504
|
+
return new RegExp(`^${regex}$`);
|
|
505
|
+
};
|
|
506
|
+
var number = /^-?\d+(?:\.\d+)?$/;
|
|
507
|
+
var boolean = /^(?:true|false)$/i;
|
|
508
|
+
|
|
509
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/checks.js
|
|
510
|
+
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
511
|
+
var _a2;
|
|
512
|
+
inst._zod ?? (inst._zod = {});
|
|
513
|
+
inst._zod.def = def;
|
|
514
|
+
(_a2 = inst._zod).onattach ?? (_a2.onattach = []);
|
|
515
|
+
});
|
|
516
|
+
var _whenHasLength = (payload) => {
|
|
517
|
+
const val = payload.value;
|
|
518
|
+
return !nullish(val) && val.length !== void 0;
|
|
519
|
+
};
|
|
520
|
+
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
521
|
+
var _a2;
|
|
522
|
+
$ZodCheck.init(inst, def);
|
|
523
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = _whenHasLength);
|
|
524
|
+
inst._zod.onattach.push((inst2) => {
|
|
525
|
+
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
526
|
+
if (def.minimum > curr)
|
|
527
|
+
inst2._zod.bag.minimum = def.minimum;
|
|
528
|
+
});
|
|
529
|
+
inst._zod.check = (payload) => {
|
|
530
|
+
const input = payload.value;
|
|
531
|
+
const units = input.length;
|
|
532
|
+
const length = typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units;
|
|
533
|
+
if (length >= def.minimum)
|
|
534
|
+
return;
|
|
535
|
+
const origin = getLengthableOrigin(input);
|
|
536
|
+
payload.issues.push({
|
|
537
|
+
origin,
|
|
538
|
+
code: "too_small",
|
|
539
|
+
minimum: def.minimum,
|
|
540
|
+
inclusive: true,
|
|
541
|
+
input,
|
|
542
|
+
inst,
|
|
543
|
+
continue: !def.abort
|
|
544
|
+
});
|
|
545
|
+
};
|
|
546
|
+
});
|
|
547
|
+
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
548
|
+
var _a2, _b;
|
|
549
|
+
$ZodCheck.init(inst, def);
|
|
550
|
+
inst._zod.onattach.push((inst2) => {
|
|
551
|
+
const bag = inst2._zod.bag;
|
|
552
|
+
bag.format = def.format;
|
|
553
|
+
if (def.pattern) {
|
|
554
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
555
|
+
bag.patterns.add(def.pattern);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
if (def.pattern)
|
|
559
|
+
(_a2 = inst._zod).check ?? (_a2.check = (payload) => {
|
|
560
|
+
def.pattern.lastIndex = 0;
|
|
561
|
+
if (def.pattern.test(payload.value))
|
|
562
|
+
return;
|
|
563
|
+
payload.issues.push({
|
|
564
|
+
origin: "string",
|
|
565
|
+
code: "invalid_format",
|
|
566
|
+
format: def.format,
|
|
567
|
+
input: payload.value,
|
|
568
|
+
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
569
|
+
inst,
|
|
570
|
+
continue: !def.abort
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
else
|
|
574
|
+
(_b = inst._zod).check ?? (_b.check = () => {
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
578
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
579
|
+
inst._zod.check = (payload) => {
|
|
580
|
+
def.pattern.lastIndex = 0;
|
|
581
|
+
if (def.pattern.test(payload.value))
|
|
582
|
+
return;
|
|
583
|
+
payload.issues.push({
|
|
584
|
+
origin: "string",
|
|
585
|
+
code: "invalid_format",
|
|
586
|
+
format: "regex",
|
|
587
|
+
input: payload.value,
|
|
588
|
+
pattern: def.pattern.toString(),
|
|
589
|
+
inst,
|
|
590
|
+
continue: !def.abort
|
|
591
|
+
});
|
|
592
|
+
};
|
|
593
|
+
});
|
|
594
|
+
var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
595
|
+
$ZodCheck.init(inst, def);
|
|
596
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
597
|
+
def.pattern ?? (def.pattern = pattern);
|
|
598
|
+
inst._zod.onattach.push((inst2) => {
|
|
599
|
+
const bag = inst2._zod.bag;
|
|
600
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
601
|
+
bag.patterns.add(pattern);
|
|
602
|
+
});
|
|
603
|
+
inst._zod.check = (payload) => {
|
|
604
|
+
if (payload.value.startsWith(def.prefix))
|
|
605
|
+
return;
|
|
606
|
+
payload.issues.push({
|
|
607
|
+
origin: "string",
|
|
608
|
+
code: "invalid_format",
|
|
609
|
+
format: "starts_with",
|
|
610
|
+
prefix: def.prefix,
|
|
611
|
+
input: payload.value,
|
|
612
|
+
inst,
|
|
613
|
+
continue: !def.abort
|
|
614
|
+
});
|
|
615
|
+
};
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/versions.js
|
|
619
|
+
var version = {
|
|
620
|
+
major: 4,
|
|
621
|
+
minor: 5,
|
|
622
|
+
patch: 1
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/schemas.js
|
|
626
|
+
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
627
|
+
var _a2;
|
|
628
|
+
inst ?? (inst = {});
|
|
629
|
+
inst._zod.def = def;
|
|
630
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
631
|
+
inst._zod.version = version;
|
|
632
|
+
const defChecks = inst._zod.def.checks;
|
|
633
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
634
|
+
for (const ch of checks) {
|
|
635
|
+
for (const fn of ch._zod.onattach) {
|
|
636
|
+
fn(inst);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (checks.length === 0) {
|
|
640
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
641
|
+
inst._zod.deferred?.push(() => {
|
|
642
|
+
inst._zod.run = inst._zod.parse;
|
|
643
|
+
});
|
|
644
|
+
} else {
|
|
645
|
+
const runChecks = (payload, checks2, ctx) => {
|
|
646
|
+
if (payload.memo)
|
|
647
|
+
return payload;
|
|
648
|
+
let isAborted = aborted(payload);
|
|
649
|
+
let asyncResult;
|
|
650
|
+
for (const ch of checks2) {
|
|
651
|
+
if (ch._zod.def.when) {
|
|
652
|
+
if (explicitlyAborted(payload))
|
|
653
|
+
continue;
|
|
654
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
655
|
+
if (!shouldRun)
|
|
656
|
+
continue;
|
|
657
|
+
} else if (isAborted) {
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
const currLen = payload.issues.length;
|
|
661
|
+
const _ = ch._zod.check(payload);
|
|
662
|
+
if (_ instanceof Promise && ctx?.async === false) {
|
|
663
|
+
throw new $ZodAsyncError();
|
|
664
|
+
}
|
|
665
|
+
if (asyncResult || _ instanceof Promise) {
|
|
666
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
667
|
+
await _;
|
|
668
|
+
const nextLen = payload.issues.length;
|
|
669
|
+
if (nextLen === currLen)
|
|
670
|
+
return;
|
|
671
|
+
attachSchema(payload.issues, currLen, inst);
|
|
672
|
+
if (!isAborted)
|
|
673
|
+
isAborted = aborted(payload, currLen);
|
|
674
|
+
});
|
|
675
|
+
} else {
|
|
676
|
+
const nextLen = payload.issues.length;
|
|
677
|
+
if (nextLen === currLen)
|
|
678
|
+
continue;
|
|
679
|
+
attachSchema(payload.issues, currLen, inst);
|
|
680
|
+
if (!isAborted)
|
|
681
|
+
isAborted = aborted(payload, currLen);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (asyncResult) {
|
|
685
|
+
return asyncResult.then(() => {
|
|
686
|
+
return payload;
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
return payload;
|
|
690
|
+
};
|
|
691
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
692
|
+
if (aborted(canary)) {
|
|
693
|
+
canary.aborted = true;
|
|
694
|
+
return canary;
|
|
695
|
+
}
|
|
696
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
697
|
+
if (checkResult instanceof Promise) {
|
|
698
|
+
if (ctx.async === false)
|
|
699
|
+
throw new $ZodAsyncError();
|
|
700
|
+
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
701
|
+
}
|
|
702
|
+
return inst._zod.parse(checkResult, ctx);
|
|
703
|
+
};
|
|
704
|
+
inst._zod.run = (payload, ctx) => {
|
|
705
|
+
if (ctx.skipChecks) {
|
|
706
|
+
return inst._zod.parse(payload, ctx);
|
|
707
|
+
}
|
|
708
|
+
if (ctx.direction === "backward") {
|
|
709
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
710
|
+
if (canary instanceof Promise) {
|
|
711
|
+
return canary.then((canary2) => {
|
|
712
|
+
return handleCanaryResult(canary2, payload, ctx);
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
716
|
+
}
|
|
717
|
+
const result = inst._zod.parse(payload, ctx);
|
|
718
|
+
if (result instanceof Promise) {
|
|
719
|
+
if (ctx.async === false)
|
|
720
|
+
throw new $ZodAsyncError();
|
|
721
|
+
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
722
|
+
}
|
|
723
|
+
return runChecks(result, checks, ctx);
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
}, {
|
|
727
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
728
|
+
get "~standard"() {
|
|
729
|
+
return hide(this, "~standard", standardProps(this));
|
|
730
|
+
},
|
|
731
|
+
set "~standard"(value) {
|
|
732
|
+
own(this, "~standard", value);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
736
|
+
function standardProps(inst) {
|
|
737
|
+
return {
|
|
738
|
+
validate: (value) => {
|
|
739
|
+
try {
|
|
740
|
+
return toStandardResult(safeParse(inst, value));
|
|
741
|
+
} catch (_) {
|
|
742
|
+
return safeParseAsync(inst, value).then(toStandardResult);
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
vendor: "zod",
|
|
746
|
+
version: 1
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
750
|
+
$ZodType.init(inst, def);
|
|
751
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
752
|
+
inst._zod.parse = (payload, _) => {
|
|
753
|
+
if (def.coerce)
|
|
754
|
+
try {
|
|
755
|
+
payload.value = String(payload.value);
|
|
756
|
+
} catch (_2) {
|
|
757
|
+
}
|
|
758
|
+
if (typeof payload.value === "string")
|
|
759
|
+
return payload;
|
|
760
|
+
payload.issues.push({
|
|
761
|
+
expected: "string",
|
|
762
|
+
code: "invalid_type",
|
|
763
|
+
input: payload.value,
|
|
764
|
+
inst
|
|
765
|
+
});
|
|
766
|
+
return payload;
|
|
767
|
+
};
|
|
768
|
+
});
|
|
769
|
+
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
770
|
+
$ZodType.init(inst, def);
|
|
771
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
772
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
773
|
+
if (def.coerce)
|
|
774
|
+
try {
|
|
775
|
+
payload.value = Number(payload.value);
|
|
776
|
+
} catch (_) {
|
|
777
|
+
}
|
|
778
|
+
const input = payload.value;
|
|
779
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
780
|
+
return payload;
|
|
781
|
+
}
|
|
782
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
783
|
+
payload.issues.push({
|
|
784
|
+
expected: "number",
|
|
785
|
+
code: "invalid_type",
|
|
786
|
+
input,
|
|
787
|
+
inst,
|
|
788
|
+
...received ? { received } : {}
|
|
789
|
+
});
|
|
790
|
+
return payload;
|
|
791
|
+
};
|
|
792
|
+
});
|
|
793
|
+
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
794
|
+
$ZodType.init(inst, def);
|
|
795
|
+
inst._zod.pattern = boolean;
|
|
796
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
797
|
+
if (def.coerce)
|
|
798
|
+
try {
|
|
799
|
+
payload.value = Boolean(payload.value);
|
|
800
|
+
} catch (_) {
|
|
801
|
+
}
|
|
802
|
+
const input = payload.value;
|
|
803
|
+
if (typeof input === "boolean")
|
|
804
|
+
return payload;
|
|
805
|
+
payload.issues.push({
|
|
806
|
+
expected: "boolean",
|
|
807
|
+
code: "invalid_type",
|
|
808
|
+
input,
|
|
809
|
+
inst
|
|
810
|
+
});
|
|
811
|
+
return payload;
|
|
812
|
+
};
|
|
813
|
+
});
|
|
814
|
+
function handleArrayResult(result, final, index) {
|
|
815
|
+
if (result.issues.length) {
|
|
816
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
817
|
+
}
|
|
818
|
+
final.value[index] = result.value;
|
|
819
|
+
}
|
|
820
|
+
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
821
|
+
$ZodType.init(inst, def);
|
|
822
|
+
const memo = globalConfig.memoizer;
|
|
823
|
+
memo?.attach(inst);
|
|
824
|
+
inst._zod.parse = (payload, ctx) => {
|
|
825
|
+
const input = payload.value;
|
|
826
|
+
if (!Array.isArray(input)) {
|
|
827
|
+
payload.issues.push({
|
|
828
|
+
expected: "array",
|
|
829
|
+
code: "invalid_type",
|
|
830
|
+
input,
|
|
831
|
+
inst
|
|
832
|
+
});
|
|
833
|
+
return payload;
|
|
834
|
+
}
|
|
835
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
836
|
+
const proms = [];
|
|
837
|
+
for (let i = 0; i < input.length; i++) {
|
|
838
|
+
const item = input[i];
|
|
839
|
+
const result = def.element._zod.run({
|
|
840
|
+
value: item,
|
|
841
|
+
issues: []
|
|
842
|
+
}, ctx);
|
|
843
|
+
if (result instanceof Promise) {
|
|
844
|
+
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
845
|
+
} else {
|
|
846
|
+
handleArrayResult(result, payload, i);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (proms.length) {
|
|
850
|
+
return Promise.all(proms).then(() => payload);
|
|
851
|
+
}
|
|
852
|
+
return payload;
|
|
853
|
+
};
|
|
854
|
+
});
|
|
855
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
856
|
+
const isPresent = key in input;
|
|
857
|
+
const isOptionalOut = optout === "optional";
|
|
858
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
if (result.issues.length) {
|
|
862
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) {
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
866
|
+
}
|
|
867
|
+
if (!isPresent && optin === void 0) {
|
|
868
|
+
if (!result.issues.length) {
|
|
869
|
+
final.issues.push({
|
|
870
|
+
code: "invalid_type",
|
|
871
|
+
expected: "nonoptional",
|
|
872
|
+
input: void 0,
|
|
873
|
+
path: [key]
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
if (result.value === void 0) {
|
|
879
|
+
if (isPresent) {
|
|
880
|
+
final.value[key] = void 0;
|
|
881
|
+
}
|
|
882
|
+
} else {
|
|
883
|
+
final.value[key] = result.value;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
var NO_SYMBOL_KEYS = [];
|
|
887
|
+
function normalizeDef(def) {
|
|
888
|
+
const keys = Object.keys(def.shape);
|
|
889
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
890
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
891
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
892
|
+
for (const k of allKeys) {
|
|
893
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
894
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
const okeys = optionalKeys(def.shape);
|
|
898
|
+
return {
|
|
899
|
+
...def,
|
|
900
|
+
allKeys,
|
|
901
|
+
symbolKeys,
|
|
902
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
903
|
+
keySet: new Set(keys),
|
|
904
|
+
numKeys: keys.length,
|
|
905
|
+
optionalKeys: new Set(okeys)
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
909
|
+
const unrecognized = [];
|
|
910
|
+
const keySet = def.keySet;
|
|
911
|
+
const _catchall = def.catchall._zod;
|
|
912
|
+
const t = _catchall.def.type;
|
|
913
|
+
const optin = _catchall.optin;
|
|
914
|
+
const optout = _catchall.optout;
|
|
915
|
+
for (const key in input) {
|
|
916
|
+
if (keySet.has(key))
|
|
917
|
+
continue;
|
|
918
|
+
if (key === "__proto__") {
|
|
919
|
+
if (t === "never")
|
|
920
|
+
unrecognized.push(key);
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
if (t === "never") {
|
|
924
|
+
unrecognized.push(key);
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
927
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
928
|
+
if (r instanceof Promise) {
|
|
929
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, optin, optout)));
|
|
930
|
+
} else {
|
|
931
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
if (unrecognized.length) {
|
|
935
|
+
payload.issues.push({
|
|
936
|
+
code: "unrecognized_keys",
|
|
937
|
+
keys: unrecognized,
|
|
938
|
+
input,
|
|
939
|
+
inst,
|
|
940
|
+
// Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
|
|
941
|
+
continue: true
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
if (!proms.length)
|
|
945
|
+
return payload;
|
|
946
|
+
return Promise.all(proms).then(() => {
|
|
947
|
+
return payload;
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
var propShapes = /* @__PURE__ */ new WeakMap();
|
|
951
|
+
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
952
|
+
$ZodType.init(inst, def);
|
|
953
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
954
|
+
if (!desc?.get) {
|
|
955
|
+
const sh = def.shape;
|
|
956
|
+
propShapes.set(def, sh);
|
|
957
|
+
Object.defineProperty(def, "shape", {
|
|
958
|
+
get: () => {
|
|
959
|
+
const newSh = { ...sh };
|
|
960
|
+
Object.defineProperty(def, "shape", {
|
|
961
|
+
value: newSh
|
|
962
|
+
});
|
|
963
|
+
propShapes.set(def, newSh);
|
|
964
|
+
return newSh;
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
969
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
970
|
+
const shape = zod.def.shape;
|
|
971
|
+
const propValues = {};
|
|
972
|
+
for (const key in shape) {
|
|
973
|
+
const field = shape[key]._zod;
|
|
974
|
+
if (field.values) {
|
|
975
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
976
|
+
assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
977
|
+
}
|
|
978
|
+
for (const v of field.values)
|
|
979
|
+
propValues[key].add(v);
|
|
980
|
+
if (field.optin !== void 0)
|
|
981
|
+
propValues[key].add(void 0);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return propValues;
|
|
985
|
+
});
|
|
986
|
+
const isObject2 = isObject;
|
|
987
|
+
const catchall = def.catchall;
|
|
988
|
+
let value;
|
|
989
|
+
const memo = globalConfig.memoizer;
|
|
990
|
+
memo?.attach(inst);
|
|
991
|
+
inst._zod.parse = (payload, ctx) => {
|
|
992
|
+
value ?? (value = _normalized.value);
|
|
993
|
+
const input = payload.value;
|
|
994
|
+
if (!isObject2(input)) {
|
|
995
|
+
payload.issues.push({
|
|
996
|
+
expected: "object",
|
|
997
|
+
code: "invalid_type",
|
|
998
|
+
input,
|
|
999
|
+
inst
|
|
1000
|
+
});
|
|
1001
|
+
return payload;
|
|
1002
|
+
}
|
|
1003
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1004
|
+
const proms = [];
|
|
1005
|
+
const shape = value.shape;
|
|
1006
|
+
for (const key of value.allKeys) {
|
|
1007
|
+
if (key === "__proto__")
|
|
1008
|
+
continue;
|
|
1009
|
+
const el = shape[key];
|
|
1010
|
+
const optin = el._zod.optin;
|
|
1011
|
+
const optout = el._zod.optout;
|
|
1012
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1013
|
+
if (r instanceof Promise) {
|
|
1014
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, optin, optout)));
|
|
1015
|
+
} else {
|
|
1016
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
if (!catchall) {
|
|
1020
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1021
|
+
}
|
|
1022
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1023
|
+
};
|
|
1024
|
+
});
|
|
1025
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
1026
|
+
for (const result of results) {
|
|
1027
|
+
if (result.issues.length === 0) {
|
|
1028
|
+
final.value = result.value;
|
|
1029
|
+
return final;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
1033
|
+
if (nonaborted.length === 1) {
|
|
1034
|
+
final.value = nonaborted[0].value;
|
|
1035
|
+
return nonaborted[0];
|
|
1036
|
+
}
|
|
1037
|
+
final.issues.push({
|
|
1038
|
+
code: "invalid_union",
|
|
1039
|
+
input: final.value,
|
|
1040
|
+
inst,
|
|
1041
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1042
|
+
});
|
|
1043
|
+
return final;
|
|
1044
|
+
}
|
|
1045
|
+
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
1046
|
+
$ZodType.init(inst, def);
|
|
1047
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
|
|
1048
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1049
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
1050
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
1051
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1052
|
+
}
|
|
1053
|
+
return void 0;
|
|
1054
|
+
});
|
|
1055
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
1056
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
1057
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1058
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1059
|
+
}
|
|
1060
|
+
return void 0;
|
|
1061
|
+
});
|
|
1062
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1063
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1064
|
+
if (first) {
|
|
1065
|
+
return first(payload, ctx);
|
|
1066
|
+
}
|
|
1067
|
+
let async = false;
|
|
1068
|
+
const results = [];
|
|
1069
|
+
for (const option of def.options) {
|
|
1070
|
+
const result = option._zod.run({
|
|
1071
|
+
value: payload.value,
|
|
1072
|
+
issues: []
|
|
1073
|
+
}, ctx);
|
|
1074
|
+
if (result instanceof Promise) {
|
|
1075
|
+
results.push(result);
|
|
1076
|
+
async = true;
|
|
1077
|
+
} else {
|
|
1078
|
+
if (result.issues.length === 0)
|
|
1079
|
+
return result;
|
|
1080
|
+
results.push(result);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
if (!async)
|
|
1084
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
1085
|
+
return Promise.all(results).then((results2) => {
|
|
1086
|
+
return handleUnionResults(results2, payload, inst, ctx);
|
|
1087
|
+
});
|
|
1088
|
+
};
|
|
1089
|
+
});
|
|
1090
|
+
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
1091
|
+
$ZodType.init(inst, def);
|
|
1092
|
+
const memo = globalConfig.memoizer;
|
|
1093
|
+
memo?.attach(inst);
|
|
1094
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1095
|
+
const input = payload.value;
|
|
1096
|
+
if (!isPlainObject(input)) {
|
|
1097
|
+
payload.issues.push({
|
|
1098
|
+
expected: "record",
|
|
1099
|
+
code: "invalid_type",
|
|
1100
|
+
input,
|
|
1101
|
+
inst
|
|
1102
|
+
});
|
|
1103
|
+
return payload;
|
|
1104
|
+
}
|
|
1105
|
+
const proms = [];
|
|
1106
|
+
const values = def.keyType._zod.values;
|
|
1107
|
+
if (values && !def.partial) {
|
|
1108
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1109
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
1110
|
+
for (const key of values) {
|
|
1111
|
+
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1112
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1113
|
+
if (key === "__proto__")
|
|
1114
|
+
continue;
|
|
1115
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1116
|
+
if (keyResult instanceof Promise) {
|
|
1117
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
1118
|
+
}
|
|
1119
|
+
if (keyResult.issues.length) {
|
|
1120
|
+
payload.issues.push({
|
|
1121
|
+
code: "invalid_key",
|
|
1122
|
+
origin: "record",
|
|
1123
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1124
|
+
input: key,
|
|
1125
|
+
path: [key],
|
|
1126
|
+
inst
|
|
1127
|
+
});
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
const outKey = keyResult.value;
|
|
1131
|
+
if (outKey === "__proto__")
|
|
1132
|
+
continue;
|
|
1133
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1134
|
+
if (result instanceof Promise) {
|
|
1135
|
+
proms.push(result.then((result2) => {
|
|
1136
|
+
if (result2.issues.length) {
|
|
1137
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
1138
|
+
}
|
|
1139
|
+
payload.value[outKey] = result2.value;
|
|
1140
|
+
}));
|
|
1141
|
+
} else {
|
|
1142
|
+
if (result.issues.length) {
|
|
1143
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
1144
|
+
}
|
|
1145
|
+
payload.value[outKey] = result.value;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
let unrecognized;
|
|
1150
|
+
for (const key in input) {
|
|
1151
|
+
if (!recordKeys.has(key)) {
|
|
1152
|
+
if (def.mode === "loose") {
|
|
1153
|
+
if (key === "__proto__")
|
|
1154
|
+
continue;
|
|
1155
|
+
payload.value[key] = input[key];
|
|
1156
|
+
} else {
|
|
1157
|
+
unrecognized = unrecognized ?? [];
|
|
1158
|
+
unrecognized.push(key);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1163
|
+
payload.issues.push({
|
|
1164
|
+
code: "unrecognized_keys",
|
|
1165
|
+
input,
|
|
1166
|
+
inst,
|
|
1167
|
+
keys: unrecognized,
|
|
1168
|
+
continue: true
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
} else {
|
|
1172
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1173
|
+
let unrecognized;
|
|
1174
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
1175
|
+
if (key === "__proto__")
|
|
1176
|
+
continue;
|
|
1177
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key))
|
|
1178
|
+
continue;
|
|
1179
|
+
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1180
|
+
if (keyResult instanceof Promise) {
|
|
1181
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
1182
|
+
}
|
|
1183
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
1184
|
+
if (checkNumericKey) {
|
|
1185
|
+
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
1186
|
+
if (retryResult instanceof Promise) {
|
|
1187
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
1188
|
+
}
|
|
1189
|
+
if (retryResult.issues.length === 0) {
|
|
1190
|
+
keyResult = retryResult;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
if (keyResult.issues.length) {
|
|
1194
|
+
if (def.mode === "loose") {
|
|
1195
|
+
payload.value[key] = input[key];
|
|
1196
|
+
} else if (values) {
|
|
1197
|
+
unrecognized = unrecognized ?? [];
|
|
1198
|
+
unrecognized.push(key);
|
|
1199
|
+
} else {
|
|
1200
|
+
payload.issues.push({
|
|
1201
|
+
code: "invalid_key",
|
|
1202
|
+
origin: "record",
|
|
1203
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1204
|
+
input: key,
|
|
1205
|
+
path: [key],
|
|
1206
|
+
inst
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
const outKey = keyResult.value;
|
|
1212
|
+
if (outKey === "__proto__")
|
|
1213
|
+
continue;
|
|
1214
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1215
|
+
if (result instanceof Promise) {
|
|
1216
|
+
proms.push(result.then((result2) => {
|
|
1217
|
+
if (result2.issues.length) {
|
|
1218
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
1219
|
+
}
|
|
1220
|
+
payload.value[outKey] = result2.value;
|
|
1221
|
+
}));
|
|
1222
|
+
} else {
|
|
1223
|
+
if (result.issues.length) {
|
|
1224
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
1225
|
+
}
|
|
1226
|
+
payload.value[outKey] = result.value;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1230
|
+
payload.issues.push({
|
|
1231
|
+
code: "unrecognized_keys",
|
|
1232
|
+
input,
|
|
1233
|
+
inst,
|
|
1234
|
+
keys: unrecognized,
|
|
1235
|
+
continue: true
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (proms.length) {
|
|
1240
|
+
return Promise.all(proms).then(() => payload);
|
|
1241
|
+
}
|
|
1242
|
+
return payload;
|
|
1243
|
+
};
|
|
1244
|
+
});
|
|
1245
|
+
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
1246
|
+
$ZodType.init(inst, def);
|
|
1247
|
+
const values = getEnumValues(def.entries);
|
|
1248
|
+
const valuesSet = new Set(values);
|
|
1249
|
+
inst._zod.values = valuesSet;
|
|
1250
|
+
const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
|
|
1251
|
+
inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
1252
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1253
|
+
const input = payload.value;
|
|
1254
|
+
if (valuesSet.has(input)) {
|
|
1255
|
+
return payload;
|
|
1256
|
+
}
|
|
1257
|
+
payload.issues.push({
|
|
1258
|
+
code: "invalid_value",
|
|
1259
|
+
values,
|
|
1260
|
+
input,
|
|
1261
|
+
inst
|
|
1262
|
+
});
|
|
1263
|
+
return payload;
|
|
1264
|
+
};
|
|
1265
|
+
});
|
|
1266
|
+
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
1267
|
+
$ZodType.init(inst, def);
|
|
1268
|
+
const values = new Set(def.values);
|
|
1269
|
+
inst._zod.values = values;
|
|
1270
|
+
inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
1271
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1272
|
+
const input = payload.value;
|
|
1273
|
+
if (values.has(input)) {
|
|
1274
|
+
return payload;
|
|
1275
|
+
}
|
|
1276
|
+
payload.issues.push({
|
|
1277
|
+
code: "invalid_value",
|
|
1278
|
+
values: def.values,
|
|
1279
|
+
input,
|
|
1280
|
+
inst
|
|
1281
|
+
});
|
|
1282
|
+
return payload;
|
|
1283
|
+
};
|
|
1284
|
+
});
|
|
1285
|
+
function handleOptionalResult(payload, result) {
|
|
1286
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
1287
|
+
return payload;
|
|
1288
|
+
}
|
|
1289
|
+
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
1290
|
+
$ZodType.init(inst, def);
|
|
1291
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1292
|
+
inst._zod.optout = "optional";
|
|
1293
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
1294
|
+
const values = zod.def.innerType._zod.values;
|
|
1295
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
1296
|
+
});
|
|
1297
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
1298
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1299
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
1300
|
+
});
|
|
1301
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1302
|
+
if (payload.value === void 0) {
|
|
1303
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
1304
|
+
return payload;
|
|
1305
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
1306
|
+
if (result instanceof Promise)
|
|
1307
|
+
return result.then((result2) => handleOptionalResult(payload, result2));
|
|
1308
|
+
return handleOptionalResult(payload, result);
|
|
1309
|
+
}
|
|
1310
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1311
|
+
};
|
|
1312
|
+
});
|
|
1313
|
+
var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
1314
|
+
$ZodType.init(inst, def);
|
|
1315
|
+
inst._zod.optin = "defaulted";
|
|
1316
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1317
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1318
|
+
if (ctx.direction === "backward") {
|
|
1319
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1320
|
+
}
|
|
1321
|
+
if (payload.value === void 0) {
|
|
1322
|
+
payload.value = def.defaultValue;
|
|
1323
|
+
return payload;
|
|
1324
|
+
}
|
|
1325
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1326
|
+
if (result instanceof Promise) {
|
|
1327
|
+
return result.then((result2) => handleDefaultResult(result2, def));
|
|
1328
|
+
}
|
|
1329
|
+
return handleDefaultResult(result, def);
|
|
1330
|
+
};
|
|
1331
|
+
});
|
|
1332
|
+
function handleDefaultResult(payload, def) {
|
|
1333
|
+
if (payload.value === void 0) {
|
|
1334
|
+
payload.value = def.defaultValue;
|
|
1335
|
+
}
|
|
1336
|
+
return payload;
|
|
1337
|
+
}
|
|
1338
|
+
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
1339
|
+
$ZodCheck.init(inst, def);
|
|
1340
|
+
$ZodType.init(inst, def);
|
|
1341
|
+
inst._zod.parse = (payload, _) => {
|
|
1342
|
+
return payload;
|
|
1343
|
+
};
|
|
1344
|
+
inst._zod.check = (payload) => {
|
|
1345
|
+
const input = payload.value;
|
|
1346
|
+
const r = def.fn(input);
|
|
1347
|
+
if (r instanceof Promise) {
|
|
1348
|
+
return r.then((r2) => handleRefineResult(r2, payload, input, inst));
|
|
1349
|
+
}
|
|
1350
|
+
handleRefineResult(r, payload, input, inst);
|
|
1351
|
+
return;
|
|
1352
|
+
};
|
|
1353
|
+
});
|
|
1354
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
1355
|
+
if (!result) {
|
|
1356
|
+
const _iss = {
|
|
1357
|
+
code: "custom",
|
|
1358
|
+
input,
|
|
1359
|
+
inst,
|
|
1360
|
+
// incorporates params.error into issue reporting
|
|
1361
|
+
path: [...inst._zod.def.path ?? []],
|
|
1362
|
+
// incorporates params.error into issue reporting
|
|
1363
|
+
continue: !inst._zod.def.abort
|
|
1364
|
+
// params: inst._zod.def.params,
|
|
1365
|
+
};
|
|
1366
|
+
if (inst._zod.def.params)
|
|
1367
|
+
_iss.params = inst._zod.def.params;
|
|
1368
|
+
payload.issues.push(issue(_iss));
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/core/api.js
|
|
1373
|
+
// @__NO_SIDE_EFFECTS__
|
|
1374
|
+
function _string(Class, params) {
|
|
1375
|
+
return new Class({
|
|
1376
|
+
type: "string",
|
|
1377
|
+
...normalizeParams(params)
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
// @__NO_SIDE_EFFECTS__
|
|
1381
|
+
function _number(Class, params) {
|
|
1382
|
+
return new Class({
|
|
1383
|
+
type: "number",
|
|
1384
|
+
checks: [],
|
|
1385
|
+
...normalizeParams(params)
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
// @__NO_SIDE_EFFECTS__
|
|
1389
|
+
function _boolean(Class, params) {
|
|
1390
|
+
return new Class({
|
|
1391
|
+
type: "boolean",
|
|
1392
|
+
...normalizeParams(params)
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
// @__NO_SIDE_EFFECTS__
|
|
1396
|
+
function _minLength(minimum, params) {
|
|
1397
|
+
return new $ZodCheckMinLength({
|
|
1398
|
+
check: "min_length",
|
|
1399
|
+
...normalizeParams(params),
|
|
1400
|
+
minimum
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
// @__NO_SIDE_EFFECTS__
|
|
1404
|
+
function _regex(pattern, params) {
|
|
1405
|
+
return new $ZodCheckRegex({
|
|
1406
|
+
check: "string_format",
|
|
1407
|
+
format: "regex",
|
|
1408
|
+
...normalizeParams(params),
|
|
1409
|
+
pattern
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
// @__NO_SIDE_EFFECTS__
|
|
1413
|
+
function _startsWith(prefix, params) {
|
|
1414
|
+
return new $ZodCheckStartsWith({
|
|
1415
|
+
check: "string_format",
|
|
1416
|
+
format: "starts_with",
|
|
1417
|
+
...normalizeParams(params),
|
|
1418
|
+
prefix
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
// @__NO_SIDE_EFFECTS__
|
|
1422
|
+
function _refine(Class, fn, _params) {
|
|
1423
|
+
const schema = new Class({
|
|
1424
|
+
type: "custom",
|
|
1425
|
+
check: "custom",
|
|
1426
|
+
fn,
|
|
1427
|
+
...normalizeParams(_params)
|
|
1428
|
+
});
|
|
1429
|
+
return schema;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
// ../../node_modules/.pnpm/zod@4.5.1/node_modules/zod/v4/mini/schemas.js
|
|
1433
|
+
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
1434
|
+
if (!inst._zod)
|
|
1435
|
+
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
1436
|
+
$ZodType.init(inst, def);
|
|
1437
|
+
inst.def = def;
|
|
1438
|
+
inst.type = def.type;
|
|
1439
|
+
}, {
|
|
1440
|
+
// `with` is an alias for `check`: the same function object, not a wrapper.
|
|
1441
|
+
get with() {
|
|
1442
|
+
return this.check;
|
|
1443
|
+
},
|
|
1444
|
+
set with(value) {
|
|
1445
|
+
own(this, "with", value);
|
|
1446
|
+
},
|
|
1447
|
+
parse(data, params) {
|
|
1448
|
+
return parse(this, data, params, { callee: this.parse });
|
|
1449
|
+
},
|
|
1450
|
+
parseAsync(data, params) {
|
|
1451
|
+
return parseAsync(this, data, params, { callee: this.parseAsync });
|
|
1452
|
+
},
|
|
1453
|
+
safeParse(data, params) {
|
|
1454
|
+
return safeParse(this, data, params);
|
|
1455
|
+
},
|
|
1456
|
+
safeParseAsync(data, params) {
|
|
1457
|
+
return safeParseAsync(this, data, params);
|
|
1458
|
+
},
|
|
1459
|
+
check(...checks) {
|
|
1460
|
+
const def = this.def;
|
|
1461
|
+
return this.clone({
|
|
1462
|
+
...def,
|
|
1463
|
+
checks: [
|
|
1464
|
+
...def.checks ?? [],
|
|
1465
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
1466
|
+
]
|
|
1467
|
+
}, { parent: true });
|
|
1468
|
+
},
|
|
1469
|
+
clone(_def, params) {
|
|
1470
|
+
return clone(this, _def, params);
|
|
1471
|
+
},
|
|
1472
|
+
brand() {
|
|
1473
|
+
return this;
|
|
1474
|
+
},
|
|
1475
|
+
register(reg, meta2) {
|
|
1476
|
+
reg.add(this, meta2);
|
|
1477
|
+
return this;
|
|
1478
|
+
},
|
|
1479
|
+
apply(fn, ...args) {
|
|
1480
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
|
|
1484
|
+
$ZodString.init(inst, def);
|
|
1485
|
+
ZodMiniType.init(inst, def);
|
|
1486
|
+
});
|
|
1487
|
+
// @__NO_SIDE_EFFECTS__
|
|
1488
|
+
function string2(params) {
|
|
1489
|
+
return _string(ZodMiniString, params);
|
|
1490
|
+
}
|
|
1491
|
+
var ZodMiniNumber = /* @__PURE__ */ $constructor("ZodMiniNumber", (inst, def) => {
|
|
1492
|
+
$ZodNumber.init(inst, def);
|
|
1493
|
+
ZodMiniType.init(inst, def);
|
|
1494
|
+
});
|
|
1495
|
+
// @__NO_SIDE_EFFECTS__
|
|
1496
|
+
function number2(params) {
|
|
1497
|
+
return _number(ZodMiniNumber, params);
|
|
1498
|
+
}
|
|
1499
|
+
var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
|
|
1500
|
+
$ZodBoolean.init(inst, def);
|
|
1501
|
+
ZodMiniType.init(inst, def);
|
|
1502
|
+
});
|
|
1503
|
+
// @__NO_SIDE_EFFECTS__
|
|
1504
|
+
function boolean2(params) {
|
|
1505
|
+
return _boolean(ZodMiniBoolean, params);
|
|
1506
|
+
}
|
|
1507
|
+
var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
|
|
1508
|
+
$ZodArray.init(inst, def);
|
|
1509
|
+
ZodMiniType.init(inst, def);
|
|
1510
|
+
});
|
|
1511
|
+
// @__NO_SIDE_EFFECTS__
|
|
1512
|
+
function array(element, params) {
|
|
1513
|
+
return new ZodMiniArray({
|
|
1514
|
+
type: "array",
|
|
1515
|
+
element,
|
|
1516
|
+
...normalizeParams(params)
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
|
|
1520
|
+
$ZodObject.init(inst, def);
|
|
1521
|
+
ZodMiniType.init(inst, def);
|
|
1522
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
1523
|
+
});
|
|
1524
|
+
// @__NO_SIDE_EFFECTS__
|
|
1525
|
+
function object(shape, params) {
|
|
1526
|
+
const def = {
|
|
1527
|
+
type: "object",
|
|
1528
|
+
shape: shape ?? {},
|
|
1529
|
+
...normalizeParams(params)
|
|
1530
|
+
};
|
|
1531
|
+
return new ZodMiniObject(def);
|
|
1532
|
+
}
|
|
1533
|
+
var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
|
|
1534
|
+
$ZodUnion.init(inst, def);
|
|
1535
|
+
ZodMiniType.init(inst, def);
|
|
1536
|
+
});
|
|
1537
|
+
// @__NO_SIDE_EFFECTS__
|
|
1538
|
+
function union(options, params) {
|
|
1539
|
+
return new ZodMiniUnion({
|
|
1540
|
+
type: "union",
|
|
1541
|
+
options,
|
|
1542
|
+
...normalizeParams(params)
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
var ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
|
|
1546
|
+
$ZodRecord.init(inst, def);
|
|
1547
|
+
ZodMiniType.init(inst, def);
|
|
1548
|
+
});
|
|
1549
|
+
// @__NO_SIDE_EFFECTS__
|
|
1550
|
+
function record(keyType, valueType, params) {
|
|
1551
|
+
if (!valueType || !valueType._zod) {
|
|
1552
|
+
return new ZodMiniRecord({
|
|
1553
|
+
type: "record",
|
|
1554
|
+
keyType: /* @__PURE__ */ string2(),
|
|
1555
|
+
valueType: keyType,
|
|
1556
|
+
...normalizeParams(valueType)
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
return new ZodMiniRecord({
|
|
1560
|
+
type: "record",
|
|
1561
|
+
keyType,
|
|
1562
|
+
valueType,
|
|
1563
|
+
...normalizeParams(params)
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
var ZodMiniEnum = /* @__PURE__ */ $constructor("ZodMiniEnum", (inst, def) => {
|
|
1567
|
+
$ZodEnum.init(inst, def);
|
|
1568
|
+
ZodMiniType.init(inst, def);
|
|
1569
|
+
inst.options = Object.values(def.entries);
|
|
1570
|
+
});
|
|
1571
|
+
// @__NO_SIDE_EFFECTS__
|
|
1572
|
+
function _enum(values, params) {
|
|
1573
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
1574
|
+
return new ZodMiniEnum({
|
|
1575
|
+
type: "enum",
|
|
1576
|
+
entries,
|
|
1577
|
+
...normalizeParams(params)
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
|
|
1581
|
+
$ZodLiteral.init(inst, def);
|
|
1582
|
+
ZodMiniType.init(inst, def);
|
|
1583
|
+
});
|
|
1584
|
+
// @__NO_SIDE_EFFECTS__
|
|
1585
|
+
function literal(value, params) {
|
|
1586
|
+
return new ZodMiniLiteral({
|
|
1587
|
+
type: "literal",
|
|
1588
|
+
values: Array.isArray(value) ? value : [value],
|
|
1589
|
+
...normalizeParams(params)
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
|
|
1593
|
+
$ZodOptional.init(inst, def);
|
|
1594
|
+
ZodMiniType.init(inst, def);
|
|
1595
|
+
});
|
|
1596
|
+
// @__NO_SIDE_EFFECTS__
|
|
1597
|
+
function optional(innerType) {
|
|
1598
|
+
return new ZodMiniOptional({
|
|
1599
|
+
type: "optional",
|
|
1600
|
+
innerType
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
var ZodMiniDefault = /* @__PURE__ */ $constructor("ZodMiniDefault", (inst, def) => {
|
|
1604
|
+
$ZodDefault.init(inst, def);
|
|
1605
|
+
ZodMiniType.init(inst, def);
|
|
1606
|
+
});
|
|
1607
|
+
// @__NO_SIDE_EFFECTS__
|
|
1608
|
+
function _default(innerType, defaultValue) {
|
|
1609
|
+
return new ZodMiniDefault({
|
|
1610
|
+
type: "default",
|
|
1611
|
+
innerType,
|
|
1612
|
+
get defaultValue() {
|
|
1613
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
|
|
1618
|
+
$ZodCustom.init(inst, def);
|
|
1619
|
+
ZodMiniType.init(inst, def);
|
|
1620
|
+
});
|
|
1621
|
+
// @__NO_SIDE_EFFECTS__
|
|
1622
|
+
function check(fn, params) {
|
|
1623
|
+
const ch = new $ZodCheck({
|
|
1624
|
+
check: "custom",
|
|
1625
|
+
...normalizeParams(params)
|
|
1626
|
+
});
|
|
1627
|
+
ch._zod.check = fn;
|
|
1628
|
+
return ch;
|
|
1629
|
+
}
|
|
1630
|
+
// @__NO_SIDE_EFFECTS__
|
|
1631
|
+
function refine(fn, _params = {}) {
|
|
1632
|
+
return _refine(ZodMiniCustom, fn, _params);
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
// src/registry/schema.ts
|
|
1636
|
+
var CATEGORIES = [
|
|
1637
|
+
"text",
|
|
1638
|
+
"background",
|
|
1639
|
+
"effect",
|
|
1640
|
+
"hero",
|
|
1641
|
+
"image",
|
|
1642
|
+
"ui",
|
|
1643
|
+
"section",
|
|
1644
|
+
"hooks"
|
|
1645
|
+
];
|
|
1646
|
+
var PERF_TIERS = ["light", "medium", "heavy"];
|
|
1647
|
+
var GL_BACKENDS = ["ogl", "three"];
|
|
1648
|
+
var FALLBACKS = ["poster", "gradient", "static", "none"];
|
|
1649
|
+
var fileSchema = object({
|
|
1650
|
+
/** Chemin dans le dossier du composant. */
|
|
1651
|
+
path: string2().check(_minLength(1)),
|
|
1652
|
+
/**
|
|
1653
|
+
* Destination dans le projet, relative a l'alias de composants. Les chemins
|
|
1654
|
+
* absolus et les remontees sont refuses : la CLI ecrit chez l'utilisateur,
|
|
1655
|
+
* et un chemin non borne y serait une porte ouverte.
|
|
1656
|
+
*/
|
|
1657
|
+
target: string2().check(
|
|
1658
|
+
_minLength(1),
|
|
1659
|
+
refine((value) => !value.startsWith("/") && !value.includes(".."), {
|
|
1660
|
+
error: "La destination doit rester relative et ne pas remonter dans l arborescence."
|
|
1661
|
+
})
|
|
1662
|
+
)
|
|
1663
|
+
});
|
|
1664
|
+
var engineSchema = object({
|
|
1665
|
+
/**
|
|
1666
|
+
* Plugins d'orchestration requis. `core` designe la bibliotheque de base,
|
|
1667
|
+
* toujours presente avec le moteur.
|
|
1668
|
+
*/
|
|
1669
|
+
gsap: _default(array(string2().check(_minLength(1))), []),
|
|
1670
|
+
/** Backend graphique requis, ou `false` si le composant n'en demande aucun. */
|
|
1671
|
+
gl: _default(union([literal(false), _enum(GL_BACKENDS)]), false)
|
|
1672
|
+
});
|
|
1673
|
+
var propSchema = object({
|
|
1674
|
+
/** Nom de la propriete. */
|
|
1675
|
+
name: string2().check(_minLength(1)),
|
|
1676
|
+
/** Type TypeScript, tel qu'il sera affiche dans la documentation. */
|
|
1677
|
+
type: string2().check(_minLength(1)),
|
|
1678
|
+
/** Obligatoire ou non. @defaultValue false */
|
|
1679
|
+
required: _default(boolean2(), false),
|
|
1680
|
+
/** Valeur par defaut, en representation source. */
|
|
1681
|
+
default: optional(union([string2(), number2(), boolean2()])),
|
|
1682
|
+
/**
|
|
1683
|
+
* Unite de la valeur. Les durees sont **toujours** en millisecondes : c'est
|
|
1684
|
+
* une regle du registre, pas une convention locale.
|
|
1685
|
+
*/
|
|
1686
|
+
unit: optional(string2()),
|
|
1687
|
+
/** Explication affichee dans la table des proprietes. */
|
|
1688
|
+
description: optional(string2()),
|
|
1689
|
+
/**
|
|
1690
|
+
* Bornes d'un reglage numerique.
|
|
1691
|
+
*
|
|
1692
|
+
* Elles servent a la documentation, qui en fabrique un curseur. Sans elles,
|
|
1693
|
+
* la page devrait redeclarer ce que le meta sait deja — et les deux
|
|
1694
|
+
* divergeraient au premier changement de valeur par defaut.
|
|
1695
|
+
*/
|
|
1696
|
+
min: optional(number2()),
|
|
1697
|
+
max: optional(number2()),
|
|
1698
|
+
step: optional(number2()),
|
|
1699
|
+
/** Valeurs possibles d'un reglage a choix. */
|
|
1700
|
+
options: optional(array(string2()))
|
|
1701
|
+
});
|
|
1702
|
+
var perfSchema = object({
|
|
1703
|
+
/** Niveau de cout. */
|
|
1704
|
+
tier: _enum(PERF_TIERS),
|
|
1705
|
+
/** Backend graphique employe, s'il y en a un. */
|
|
1706
|
+
backend: _default(union([literal(false), _enum(GL_BACKENDS)]), false),
|
|
1707
|
+
/** Remarques affichees dans la documentation. */
|
|
1708
|
+
notes: optional(string2()),
|
|
1709
|
+
/**
|
|
1710
|
+
* Nature du repli visuel. Obligatoire pour un composant couteux : le repli
|
|
1711
|
+
* fait partie du composant, pas de sa documentation.
|
|
1712
|
+
*/
|
|
1713
|
+
fallback: optional(_enum(FALLBACKS))
|
|
1714
|
+
});
|
|
1715
|
+
var baseSchema = object({
|
|
1716
|
+
/** Identifiant, unique dans sa categorie. */
|
|
1717
|
+
name: string2().check(
|
|
1718
|
+
_regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, {
|
|
1719
|
+
error: "Le nom doit etre en minuscules, avec des tirets pour separateurs."
|
|
1720
|
+
})
|
|
1721
|
+
),
|
|
1722
|
+
/** Categorie. */
|
|
1723
|
+
category: _enum(CATEGORIES),
|
|
1724
|
+
/** Titre affiche. */
|
|
1725
|
+
title: string2().check(_minLength(1)),
|
|
1726
|
+
/** Description affichee, en une phrase. */
|
|
1727
|
+
description: string2().check(_minLength(1)),
|
|
1728
|
+
/** Ce que le composant demande au moteur. */
|
|
1729
|
+
engine: _default(engineSchema, { gsap: [], gl: false }),
|
|
1730
|
+
/** Fichiers copies chez l'utilisateur. Au moins un. */
|
|
1731
|
+
files: array(fileSchema).check(_minLength(1)),
|
|
1732
|
+
/** Paquets npm a installer. */
|
|
1733
|
+
dependencies: _default(array(string2().check(_minLength(1))), []),
|
|
1734
|
+
/**
|
|
1735
|
+
* Autres entrees du registre dont celle-ci depend, sous la forme
|
|
1736
|
+
* `categorie/nom`.
|
|
1737
|
+
*/
|
|
1738
|
+
registryDependencies: _default(
|
|
1739
|
+
array(
|
|
1740
|
+
string2().check(
|
|
1741
|
+
_regex(/^[a-z]+\/[a-z0-9]+(-[a-z0-9]+)*$/, {
|
|
1742
|
+
error: 'Une dependance de registre s ecrit "categorie/nom".'
|
|
1743
|
+
})
|
|
1744
|
+
)
|
|
1745
|
+
),
|
|
1746
|
+
[]
|
|
1747
|
+
),
|
|
1748
|
+
/** Variables CSS que le composant consomme. */
|
|
1749
|
+
tokens: _default(array(string2().check(_startsWith("--o-"))), []),
|
|
1750
|
+
/** Proprietes exposees. */
|
|
1751
|
+
props: _default(array(propSchema), []),
|
|
1752
|
+
/** Cout du composant. */
|
|
1753
|
+
perf: perfSchema
|
|
1754
|
+
});
|
|
1755
|
+
var metaSchema = baseSchema.check(
|
|
1756
|
+
check((payload) => {
|
|
1757
|
+
const meta2 = payload.value;
|
|
1758
|
+
if (meta2.perf.tier === "heavy" && (meta2.perf.fallback ?? "none") === "none") {
|
|
1759
|
+
payload.issues.push({
|
|
1760
|
+
code: "custom",
|
|
1761
|
+
input: meta2,
|
|
1762
|
+
path: ["perf", "fallback"],
|
|
1763
|
+
message: "Un composant de cout eleve doit declarer un repli visuel : il est affiche pendant le chargement, sans WebGL, et en mouvement reduit."
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
if (meta2.perf.backend !== false && meta2.engine.gl !== meta2.perf.backend) {
|
|
1767
|
+
payload.issues.push({
|
|
1768
|
+
code: "custom",
|
|
1769
|
+
input: meta2,
|
|
1770
|
+
path: ["perf", "backend"],
|
|
1771
|
+
message: `Le backend declare dans "perf" (${String(meta2.perf.backend)}) ne correspond pas a celui de "engine" (${String(meta2.engine.gl)}).`
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
if (meta2.engine.gl === "three" && meta2.perf.tier !== "heavy") {
|
|
1775
|
+
payload.issues.push({
|
|
1776
|
+
code: "custom",
|
|
1777
|
+
input: meta2,
|
|
1778
|
+
path: ["perf", "tier"],
|
|
1779
|
+
message: "Un composant employant une scene 3D est necessairement de cout eleve."
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
const targets = meta2.files.map((file) => file.target);
|
|
1783
|
+
const duplicates = targets.filter(
|
|
1784
|
+
(target, index) => targets.indexOf(target) !== index
|
|
1785
|
+
);
|
|
1786
|
+
if (duplicates.length > 0) {
|
|
1787
|
+
payload.issues.push({
|
|
1788
|
+
code: "custom",
|
|
1789
|
+
input: meta2,
|
|
1790
|
+
path: ["files"],
|
|
1791
|
+
message: `Plusieurs fichiers visent la meme destination : ${[...new Set(duplicates)].join(", ")}.`
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
})
|
|
1795
|
+
);
|
|
1796
|
+
function entryId(meta2) {
|
|
1797
|
+
return `${meta2.category}/${meta2.name}`;
|
|
1798
|
+
}
|
|
1799
|
+
function parseMeta(value, origin) {
|
|
1800
|
+
const result = safeParse(metaSchema, value);
|
|
1801
|
+
if (result.success) return { ok: true, meta: result.data };
|
|
1802
|
+
return {
|
|
1803
|
+
ok: false,
|
|
1804
|
+
problems: result.error.issues.map((issue2) => {
|
|
1805
|
+
const path = issue2.path.length === 0 ? origin : `${origin} \u2192 ${issue2.path.join(".")}`;
|
|
1806
|
+
return `${path} : ${issue2.message}`;
|
|
1807
|
+
})
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// src/registry/resolve.ts
|
|
1812
|
+
function describeProblem(problem) {
|
|
1813
|
+
if (problem.kind === "cycle") {
|
|
1814
|
+
return `Cycle de dependances : ${problem.path.join(" \u2192 ")}`;
|
|
1815
|
+
}
|
|
1816
|
+
return problem.requiredBy === null ? `Entree introuvable : ${problem.id}` : `Entree introuvable : ${problem.id}, reclamee par ${problem.requiredBy}`;
|
|
1817
|
+
}
|
|
1818
|
+
function resolveGraph(requested, available) {
|
|
1819
|
+
const problems = [];
|
|
1820
|
+
const order = [];
|
|
1821
|
+
const done = /* @__PURE__ */ new Set();
|
|
1822
|
+
const path = [];
|
|
1823
|
+
const onPath = /* @__PURE__ */ new Set();
|
|
1824
|
+
const visit = (id, requiredBy) => {
|
|
1825
|
+
if (done.has(id)) return;
|
|
1826
|
+
if (onPath.has(id)) {
|
|
1827
|
+
const start = path.indexOf(id);
|
|
1828
|
+
problems.push({ kind: "cycle", path: [...path.slice(start), id] });
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
const entry = available.get(id);
|
|
1832
|
+
if (entry === void 0) {
|
|
1833
|
+
problems.push({ kind: "introuvable", id, requiredBy });
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1836
|
+
path.push(id);
|
|
1837
|
+
onPath.add(id);
|
|
1838
|
+
for (const dependency of entry.registryDependencies) {
|
|
1839
|
+
visit(dependency, id);
|
|
1840
|
+
}
|
|
1841
|
+
onPath.delete(id);
|
|
1842
|
+
path.pop();
|
|
1843
|
+
done.add(id);
|
|
1844
|
+
order.push(id);
|
|
1845
|
+
};
|
|
1846
|
+
for (const id of requested) visit(id, null);
|
|
1847
|
+
if (problems.length > 0) return { ok: false, problems };
|
|
1848
|
+
const asked = new Set(requested);
|
|
1849
|
+
return {
|
|
1850
|
+
ok: true,
|
|
1851
|
+
graph: {
|
|
1852
|
+
order,
|
|
1853
|
+
implied: order.filter((id) => !asked.has(id))
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
function validateCatalogue(available) {
|
|
1858
|
+
const result = resolveGraph([...available.keys()], available);
|
|
1859
|
+
return result.ok ? [] : result.problems;
|
|
1860
|
+
}
|
|
1861
|
+
function toCatalogue(entries) {
|
|
1862
|
+
const catalogue = /* @__PURE__ */ new Map();
|
|
1863
|
+
for (const entry of entries) {
|
|
1864
|
+
catalogue.set(entry.id, {
|
|
1865
|
+
id: entry.id,
|
|
1866
|
+
registryDependencies: entry.registryDependencies
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
return catalogue;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
export { CATEGORIES, FALLBACKS, GL_BACKENDS, PERF_TIERS, _default, _minLength, array, describeProblem, entryId, literal, metaSchema, object, parseMeta, record, resolveGraph, safeParse, string2 as string, toCatalogue, validateCatalogue };
|