@frontmcp/lazy-zod 1.10.8 → 1.10.9-rc.2
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/esm/index.mjs +1 -328
- package/esm/package.json +1 -1
- package/index.js +1 -360
- package/package.json +1 -1
package/esm/index.mjs
CHANGED
|
@@ -1,328 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { toJSONSchema as zodToJSONSchema } from "zod";
|
|
3
|
-
|
|
4
|
-
// libs/lazy-zod/src/factories.ts
|
|
5
|
-
var HEAVY_FACTORIES = /* @__PURE__ */ new Set([
|
|
6
|
-
"object",
|
|
7
|
-
"strictObject",
|
|
8
|
-
"looseObject",
|
|
9
|
-
"union",
|
|
10
|
-
"discriminatedUnion",
|
|
11
|
-
"intersection",
|
|
12
|
-
"record",
|
|
13
|
-
"tuple"
|
|
14
|
-
]);
|
|
15
|
-
var CHAIN_METHODS = /* @__PURE__ */ new Set([
|
|
16
|
-
// ZodType generic
|
|
17
|
-
"optional",
|
|
18
|
-
"nullable",
|
|
19
|
-
"nullish",
|
|
20
|
-
"default",
|
|
21
|
-
"prefault",
|
|
22
|
-
"describe",
|
|
23
|
-
"refine",
|
|
24
|
-
"superRefine",
|
|
25
|
-
"transform",
|
|
26
|
-
"pipe",
|
|
27
|
-
"or",
|
|
28
|
-
"and",
|
|
29
|
-
"readonly",
|
|
30
|
-
"brand",
|
|
31
|
-
"catch",
|
|
32
|
-
"array",
|
|
33
|
-
"promise",
|
|
34
|
-
// ZodString
|
|
35
|
-
"email",
|
|
36
|
-
"url",
|
|
37
|
-
"uuid",
|
|
38
|
-
"cuid",
|
|
39
|
-
"cuid2",
|
|
40
|
-
"ulid",
|
|
41
|
-
"regex",
|
|
42
|
-
"startsWith",
|
|
43
|
-
"endsWith",
|
|
44
|
-
"trim",
|
|
45
|
-
"toLowerCase",
|
|
46
|
-
"toUpperCase",
|
|
47
|
-
"datetime",
|
|
48
|
-
"date",
|
|
49
|
-
"time",
|
|
50
|
-
"ip",
|
|
51
|
-
"cidr",
|
|
52
|
-
"base64",
|
|
53
|
-
"base64url",
|
|
54
|
-
"jwt",
|
|
55
|
-
"nanoid",
|
|
56
|
-
"emoji",
|
|
57
|
-
"includes",
|
|
58
|
-
"normalize",
|
|
59
|
-
// ZodString / ZodNumber / ZodArray — shared (`Set` dedupes)
|
|
60
|
-
"min",
|
|
61
|
-
"max",
|
|
62
|
-
"length",
|
|
63
|
-
"gt",
|
|
64
|
-
"gte",
|
|
65
|
-
"lt",
|
|
66
|
-
"lte",
|
|
67
|
-
// ZodNumber
|
|
68
|
-
"int",
|
|
69
|
-
"positive",
|
|
70
|
-
"negative",
|
|
71
|
-
"nonnegative",
|
|
72
|
-
"nonpositive",
|
|
73
|
-
"finite",
|
|
74
|
-
"safe",
|
|
75
|
-
"multipleOf",
|
|
76
|
-
"step",
|
|
77
|
-
// ZodObject
|
|
78
|
-
"extend",
|
|
79
|
-
"merge",
|
|
80
|
-
"pick",
|
|
81
|
-
"omit",
|
|
82
|
-
"partial",
|
|
83
|
-
"deepPartial",
|
|
84
|
-
"required",
|
|
85
|
-
"passthrough",
|
|
86
|
-
"strict",
|
|
87
|
-
"strip",
|
|
88
|
-
"catchall",
|
|
89
|
-
"keyof",
|
|
90
|
-
// ZodArray
|
|
91
|
-
"nonempty",
|
|
92
|
-
"element",
|
|
93
|
-
// ZodEnum
|
|
94
|
-
"extract",
|
|
95
|
-
"exclude"
|
|
96
|
-
]);
|
|
97
|
-
|
|
98
|
-
// libs/lazy-zod/src/lazy-schema.ts
|
|
99
|
-
var LAZY_BRAND = /* @__PURE__ */ Symbol.for("@frontmcp/lazy-zod.LazyZodSchema");
|
|
100
|
-
var LAZY_TARGET = /* @__PURE__ */ Symbol.for("@frontmcp/lazy-zod.LazyZodSchema.target");
|
|
101
|
-
var HOT_PATH_METHODS = /* @__PURE__ */ new Set(["parse", "safeParse", "parseAsync", "safeParseAsync"]);
|
|
102
|
-
var LazyZodSchema = class {
|
|
103
|
-
constructor(_materialize) {
|
|
104
|
-
this._materialize = _materialize;
|
|
105
|
-
Object.defineProperty(this, LAZY_BRAND, {
|
|
106
|
-
value: true,
|
|
107
|
-
enumerable: false,
|
|
108
|
-
writable: false,
|
|
109
|
-
configurable: false
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
_materialize;
|
|
113
|
-
_resolved;
|
|
114
|
-
/** Materialize (and memoize) the underlying real zod schema. */
|
|
115
|
-
materialize() {
|
|
116
|
-
return this._resolved ?? (this._resolved = this._materialize());
|
|
117
|
-
}
|
|
118
|
-
/** True once the underlying schema has been constructed. */
|
|
119
|
-
get isMaterialized() {
|
|
120
|
-
return this._resolved !== void 0;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
function wrapLazy(schema) {
|
|
124
|
-
const proxy = new Proxy(schema, {
|
|
125
|
-
get(target, key, _receiver) {
|
|
126
|
-
if (key === LAZY_BRAND) return true;
|
|
127
|
-
if (key === LAZY_TARGET) return target;
|
|
128
|
-
if (typeof key !== "symbol" && Object.prototype.hasOwnProperty.call(target, key)) {
|
|
129
|
-
return target[key];
|
|
130
|
-
}
|
|
131
|
-
if (typeof key === "string" && HOT_PATH_METHODS.has(key)) {
|
|
132
|
-
return (...args) => {
|
|
133
|
-
const real2 = target.materialize();
|
|
134
|
-
const bound = real2[key].bind(real2);
|
|
135
|
-
Object.defineProperty(target, key, {
|
|
136
|
-
value: bound,
|
|
137
|
-
writable: true,
|
|
138
|
-
configurable: true,
|
|
139
|
-
enumerable: false
|
|
140
|
-
});
|
|
141
|
-
return bound(...args);
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
if (typeof key === "string" && CHAIN_METHODS.has(key)) {
|
|
145
|
-
return (...args) => wrapLazy(
|
|
146
|
-
new LazyZodSchema(() => {
|
|
147
|
-
const real2 = target.materialize();
|
|
148
|
-
return real2[key](...args);
|
|
149
|
-
})
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
const real = target.materialize();
|
|
153
|
-
const val = real[key];
|
|
154
|
-
if (typeof val === "function") {
|
|
155
|
-
if (key === "constructor") return val;
|
|
156
|
-
const maybeCtor = val;
|
|
157
|
-
if (typeof maybeCtor.prototype === "object" && maybeCtor.prototype !== null && Object.getOwnPropertyNames(maybeCtor.prototype).length > 1) {
|
|
158
|
-
return val;
|
|
159
|
-
}
|
|
160
|
-
return val.bind(real);
|
|
161
|
-
}
|
|
162
|
-
return val;
|
|
163
|
-
},
|
|
164
|
-
has(target, key) {
|
|
165
|
-
if (key === LAZY_BRAND) return true;
|
|
166
|
-
if (typeof key === "string" && (HOT_PATH_METHODS.has(key) || CHAIN_METHODS.has(key))) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
return Reflect.has(target.materialize(), key);
|
|
170
|
-
},
|
|
171
|
-
getPrototypeOf(target) {
|
|
172
|
-
return Object.getPrototypeOf(target.materialize());
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
return proxy;
|
|
176
|
-
}
|
|
177
|
-
function lazyZ(factory) {
|
|
178
|
-
return wrapLazy(new LazyZodSchema(factory));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// libs/lazy-zod/src/utils.ts
|
|
182
|
-
function isLazy(value) {
|
|
183
|
-
if (value === null || typeof value !== "object" && typeof value !== "function") return false;
|
|
184
|
-
return value[LAZY_BRAND] === true;
|
|
185
|
-
}
|
|
186
|
-
function forceMaterialize(schema) {
|
|
187
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
188
|
-
return deepMaterialize(schema, seen);
|
|
189
|
-
}
|
|
190
|
-
function deepMaterialize(value, seen) {
|
|
191
|
-
if (value === null || typeof value !== "object" && typeof value !== "function") return value;
|
|
192
|
-
let resolved = value;
|
|
193
|
-
if (value[LAZY_BRAND] === true) {
|
|
194
|
-
const target = value[LAZY_TARGET];
|
|
195
|
-
resolved = target.materialize();
|
|
196
|
-
}
|
|
197
|
-
if (typeof resolved !== "object" && typeof resolved !== "function") return resolved;
|
|
198
|
-
if (resolved === null) return resolved;
|
|
199
|
-
if (seen.has(resolved)) return resolved;
|
|
200
|
-
seen.add(resolved);
|
|
201
|
-
const def = resolved._def;
|
|
202
|
-
if (def && typeof def === "object") {
|
|
203
|
-
const rawShape = def["shape"];
|
|
204
|
-
const shape = typeof rawShape === "function" ? rawShape.call(def) : rawShape;
|
|
205
|
-
if (shape && typeof shape === "object") {
|
|
206
|
-
for (const k of Object.keys(shape)) {
|
|
207
|
-
shape[k] = deepMaterialize(shape[k], seen);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
const options = def["options"];
|
|
211
|
-
if (Array.isArray(options)) {
|
|
212
|
-
for (let i = 0; i < options.length; i++) options[i] = deepMaterialize(options[i], seen);
|
|
213
|
-
}
|
|
214
|
-
if ("innerType" in def) def["innerType"] = deepMaterialize(def["innerType"], seen);
|
|
215
|
-
if ("element" in def) def["element"] = deepMaterialize(def["element"], seen);
|
|
216
|
-
if ("valueType" in def) def["valueType"] = deepMaterialize(def["valueType"], seen);
|
|
217
|
-
if ("keyType" in def) def["keyType"] = deepMaterialize(def["keyType"], seen);
|
|
218
|
-
if ("left" in def) def["left"] = deepMaterialize(def["left"], seen);
|
|
219
|
-
if ("right" in def) def["right"] = deepMaterialize(def["right"], seen);
|
|
220
|
-
const items = def["items"];
|
|
221
|
-
if (Array.isArray(items)) {
|
|
222
|
-
for (let i = 0; i < items.length; i++) items[i] = deepMaterialize(items[i], seen);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return resolved;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// libs/lazy-zod/src/lazy-z.ts
|
|
229
|
-
import { z as realZ } from "zod";
|
|
230
|
-
function createLazyZ(namespace) {
|
|
231
|
-
return new Proxy({}, {
|
|
232
|
-
get(_target, key, receiver) {
|
|
233
|
-
if (typeof key === "string" && HEAVY_FACTORIES.has(key)) {
|
|
234
|
-
const realFactory = namespace[key];
|
|
235
|
-
return (...args) => wrapLazy(
|
|
236
|
-
new LazyZodSchema(() => realFactory.call(namespace, ...args))
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
return Reflect.get(namespace, key, receiver);
|
|
240
|
-
},
|
|
241
|
-
set: (_target, key, value) => Reflect.set(namespace, key, value),
|
|
242
|
-
has: (_target, key) => Reflect.has(namespace, key),
|
|
243
|
-
ownKeys: () => Reflect.ownKeys(namespace),
|
|
244
|
-
getOwnPropertyDescriptor(_target, key) {
|
|
245
|
-
const desc = Reflect.getOwnPropertyDescriptor(namespace, key);
|
|
246
|
-
return desc ? { ...desc, configurable: true } : void 0;
|
|
247
|
-
},
|
|
248
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(namespace)
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
var z = createLazyZ(realZ);
|
|
252
|
-
|
|
253
|
-
// libs/lazy-zod/src/eager-z.ts
|
|
254
|
-
import { z as z2 } from "zod";
|
|
255
|
-
|
|
256
|
-
// libs/lazy-zod/src/index.ts
|
|
257
|
-
import {
|
|
258
|
-
NEVER,
|
|
259
|
-
ZodAny,
|
|
260
|
-
ZodArray,
|
|
261
|
-
ZodBigInt,
|
|
262
|
-
ZodBoolean,
|
|
263
|
-
ZodDate,
|
|
264
|
-
ZodDefault,
|
|
265
|
-
ZodDiscriminatedUnion,
|
|
266
|
-
ZodEnum,
|
|
267
|
-
ZodError,
|
|
268
|
-
ZodIntersection,
|
|
269
|
-
ZodLiteral,
|
|
270
|
-
ZodNever,
|
|
271
|
-
ZodNull,
|
|
272
|
-
ZodNullable,
|
|
273
|
-
ZodNumber,
|
|
274
|
-
ZodObject,
|
|
275
|
-
ZodOptional,
|
|
276
|
-
ZodRecord,
|
|
277
|
-
ZodString,
|
|
278
|
-
ZodSymbol,
|
|
279
|
-
ZodTuple,
|
|
280
|
-
ZodType,
|
|
281
|
-
ZodUndefined,
|
|
282
|
-
ZodUnion,
|
|
283
|
-
ZodUnknown,
|
|
284
|
-
ZodVoid
|
|
285
|
-
} from "zod";
|
|
286
|
-
var toJSONSchema = ((schema, params) => zodToJSONSchema(
|
|
287
|
-
forceMaterialize(schema),
|
|
288
|
-
params
|
|
289
|
-
));
|
|
290
|
-
export {
|
|
291
|
-
LAZY_BRAND,
|
|
292
|
-
LAZY_TARGET,
|
|
293
|
-
LazyZodSchema,
|
|
294
|
-
NEVER,
|
|
295
|
-
ZodAny,
|
|
296
|
-
ZodArray,
|
|
297
|
-
ZodBigInt,
|
|
298
|
-
ZodBoolean,
|
|
299
|
-
ZodDate,
|
|
300
|
-
ZodDefault,
|
|
301
|
-
ZodDiscriminatedUnion,
|
|
302
|
-
ZodEnum,
|
|
303
|
-
ZodError,
|
|
304
|
-
ZodIntersection,
|
|
305
|
-
ZodLiteral,
|
|
306
|
-
ZodNever,
|
|
307
|
-
ZodNull,
|
|
308
|
-
ZodNullable,
|
|
309
|
-
ZodNumber,
|
|
310
|
-
ZodObject,
|
|
311
|
-
ZodOptional,
|
|
312
|
-
ZodRecord,
|
|
313
|
-
ZodString,
|
|
314
|
-
ZodSymbol,
|
|
315
|
-
ZodTuple,
|
|
316
|
-
ZodType,
|
|
317
|
-
ZodUndefined,
|
|
318
|
-
ZodUnion,
|
|
319
|
-
ZodUnknown,
|
|
320
|
-
ZodVoid,
|
|
321
|
-
z as default,
|
|
322
|
-
z2 as eagerZ,
|
|
323
|
-
forceMaterialize,
|
|
324
|
-
isLazy,
|
|
325
|
-
lazyZ,
|
|
326
|
-
toJSONSchema,
|
|
327
|
-
z
|
|
328
|
-
};
|
|
1
|
+
import{toJSONSchema as zodToJSONSchema}from"zod";var HEAVY_FACTORIES=new Set(["object","strictObject","looseObject","union","discriminatedUnion","intersection","record","tuple"]);var CHAIN_METHODS=new Set(["optional","nullable","nullish","default","prefault","describe","refine","superRefine","transform","pipe","or","and","readonly","brand","catch","array","promise","email","url","uuid","cuid","cuid2","ulid","regex","startsWith","endsWith","trim","toLowerCase","toUpperCase","datetime","date","time","ip","cidr","base64","base64url","jwt","nanoid","emoji","includes","normalize","min","max","length","gt","gte","lt","lte","int","positive","negative","nonnegative","nonpositive","finite","safe","multipleOf","step","extend","merge","pick","omit","partial","deepPartial","required","passthrough","strict","strip","catchall","keyof","nonempty","element","extract","exclude"]);var LAZY_BRAND=Symbol.for("@frontmcp/lazy-zod.LazyZodSchema");var LAZY_TARGET=Symbol.for("@frontmcp/lazy-zod.LazyZodSchema.target");var HOT_PATH_METHODS=new Set(["parse","safeParse","parseAsync","safeParseAsync"]);var LazyZodSchema=class{constructor(_materialize){this._materialize=_materialize;Object.defineProperty(this,LAZY_BRAND,{value:true,enumerable:false,writable:false,configurable:false})}_materialize;_resolved;materialize(){return this._resolved??(this._resolved=this._materialize())}get isMaterialized(){return this._resolved!==void 0}};function wrapLazy(schema){const proxy=new Proxy(schema,{get(target,key,_receiver){if(key===LAZY_BRAND)return true;if(key===LAZY_TARGET)return target;if(typeof key!=="symbol"&&Object.prototype.hasOwnProperty.call(target,key)){return target[key]}if(typeof key==="string"&&HOT_PATH_METHODS.has(key)){return(...args)=>{const real2=target.materialize();const bound=real2[key].bind(real2);Object.defineProperty(target,key,{value:bound,writable:true,configurable:true,enumerable:false});return bound(...args)}}if(typeof key==="string"&&CHAIN_METHODS.has(key)){return(...args)=>wrapLazy(new LazyZodSchema(()=>{const real2=target.materialize();return real2[key](...args)}))}const real=target.materialize();const val=real[key];if(typeof val==="function"){if(key==="constructor")return val;const maybeCtor=val;if(typeof maybeCtor.prototype==="object"&&maybeCtor.prototype!==null&&Object.getOwnPropertyNames(maybeCtor.prototype).length>1){return val}return val.bind(real)}return val},has(target,key){if(key===LAZY_BRAND)return true;if(typeof key==="string"&&(HOT_PATH_METHODS.has(key)||CHAIN_METHODS.has(key))){return true}return Reflect.has(target.materialize(),key)},getPrototypeOf(target){return Object.getPrototypeOf(target.materialize())}});return proxy}function lazyZ(factory){return wrapLazy(new LazyZodSchema(factory))}function isLazy(value){if(value===null||typeof value!=="object"&&typeof value!=="function")return false;return value[LAZY_BRAND]===true}function forceMaterialize(schema){const seen=new WeakSet;return deepMaterialize(schema,seen)}function deepMaterialize(value,seen){if(value===null||typeof value!=="object"&&typeof value!=="function")return value;let resolved=value;if(value[LAZY_BRAND]===true){const target=value[LAZY_TARGET];resolved=target.materialize()}if(typeof resolved!=="object"&&typeof resolved!=="function")return resolved;if(resolved===null)return resolved;if(seen.has(resolved))return resolved;seen.add(resolved);const def=resolved._def;if(def&&typeof def==="object"){const rawShape=def["shape"];const shape=typeof rawShape==="function"?rawShape.call(def):rawShape;if(shape&&typeof shape==="object"){for(const k of Object.keys(shape)){shape[k]=deepMaterialize(shape[k],seen)}}const options=def["options"];if(Array.isArray(options)){for(let i=0;i<options.length;i++)options[i]=deepMaterialize(options[i],seen)}if("innerType"in def)def["innerType"]=deepMaterialize(def["innerType"],seen);if("element"in def)def["element"]=deepMaterialize(def["element"],seen);if("valueType"in def)def["valueType"]=deepMaterialize(def["valueType"],seen);if("keyType"in def)def["keyType"]=deepMaterialize(def["keyType"],seen);if("left"in def)def["left"]=deepMaterialize(def["left"],seen);if("right"in def)def["right"]=deepMaterialize(def["right"],seen);const items=def["items"];if(Array.isArray(items)){for(let i=0;i<items.length;i++)items[i]=deepMaterialize(items[i],seen)}}return resolved}import{z as realZ}from"zod";function createLazyZ(namespace){return new Proxy({},{get(_target,key,receiver){if(typeof key==="string"&&HEAVY_FACTORIES.has(key)){const realFactory=namespace[key];return(...args)=>wrapLazy(new LazyZodSchema(()=>realFactory.call(namespace,...args)))}return Reflect.get(namespace,key,receiver)},set:(_target,key,value)=>Reflect.set(namespace,key,value),has:(_target,key)=>Reflect.has(namespace,key),ownKeys:()=>Reflect.ownKeys(namespace),getOwnPropertyDescriptor(_target,key){const desc=Reflect.getOwnPropertyDescriptor(namespace,key);return desc?{...desc,configurable:true}:void 0},getPrototypeOf:()=>Reflect.getPrototypeOf(namespace)})}var z=createLazyZ(realZ);import{z as z2}from"zod";import{NEVER,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEnum,ZodError,ZodIntersection,ZodLiteral,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodRecord,ZodString,ZodSymbol,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid}from"zod";var toJSONSchema=((schema,params)=>zodToJSONSchema(forceMaterialize(schema),params));export{LAZY_BRAND,LAZY_TARGET,LazyZodSchema,NEVER,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEnum,ZodError,ZodIntersection,ZodLiteral,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodRecord,ZodString,ZodSymbol,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,z as default,z2 as eagerZ,forceMaterialize,isLazy,lazyZ,toJSONSchema,z};
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/lazy-zod",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9-rc.2",
|
|
4
4
|
"description": "Zod 4's z with compound schemas built on first use, for faster start-up. Exports z (lazy), eagerZ (Zod's own) and lazyZ",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
package/index.js
CHANGED
|
@@ -1,360 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// libs/lazy-zod/src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
LAZY_BRAND: () => LAZY_BRAND,
|
|
24
|
-
LAZY_TARGET: () => LAZY_TARGET,
|
|
25
|
-
LazyZodSchema: () => LazyZodSchema,
|
|
26
|
-
NEVER: () => import_zod4.NEVER,
|
|
27
|
-
ZodAny: () => import_zod4.ZodAny,
|
|
28
|
-
ZodArray: () => import_zod4.ZodArray,
|
|
29
|
-
ZodBigInt: () => import_zod4.ZodBigInt,
|
|
30
|
-
ZodBoolean: () => import_zod4.ZodBoolean,
|
|
31
|
-
ZodDate: () => import_zod4.ZodDate,
|
|
32
|
-
ZodDefault: () => import_zod4.ZodDefault,
|
|
33
|
-
ZodDiscriminatedUnion: () => import_zod4.ZodDiscriminatedUnion,
|
|
34
|
-
ZodEnum: () => import_zod4.ZodEnum,
|
|
35
|
-
ZodError: () => import_zod4.ZodError,
|
|
36
|
-
ZodIntersection: () => import_zod4.ZodIntersection,
|
|
37
|
-
ZodLiteral: () => import_zod4.ZodLiteral,
|
|
38
|
-
ZodNever: () => import_zod4.ZodNever,
|
|
39
|
-
ZodNull: () => import_zod4.ZodNull,
|
|
40
|
-
ZodNullable: () => import_zod4.ZodNullable,
|
|
41
|
-
ZodNumber: () => import_zod4.ZodNumber,
|
|
42
|
-
ZodObject: () => import_zod4.ZodObject,
|
|
43
|
-
ZodOptional: () => import_zod4.ZodOptional,
|
|
44
|
-
ZodRecord: () => import_zod4.ZodRecord,
|
|
45
|
-
ZodString: () => import_zod4.ZodString,
|
|
46
|
-
ZodSymbol: () => import_zod4.ZodSymbol,
|
|
47
|
-
ZodTuple: () => import_zod4.ZodTuple,
|
|
48
|
-
ZodType: () => import_zod4.ZodType,
|
|
49
|
-
ZodUndefined: () => import_zod4.ZodUndefined,
|
|
50
|
-
ZodUnion: () => import_zod4.ZodUnion,
|
|
51
|
-
ZodUnknown: () => import_zod4.ZodUnknown,
|
|
52
|
-
ZodVoid: () => import_zod4.ZodVoid,
|
|
53
|
-
default: () => z,
|
|
54
|
-
eagerZ: () => import_zod2.z,
|
|
55
|
-
forceMaterialize: () => forceMaterialize,
|
|
56
|
-
isLazy: () => isLazy,
|
|
57
|
-
lazyZ: () => lazyZ,
|
|
58
|
-
toJSONSchema: () => toJSONSchema,
|
|
59
|
-
z: () => z
|
|
60
|
-
});
|
|
61
|
-
module.exports = __toCommonJS(index_exports);
|
|
62
|
-
var import_zod3 = require("zod");
|
|
63
|
-
|
|
64
|
-
// libs/lazy-zod/src/factories.ts
|
|
65
|
-
var HEAVY_FACTORIES = /* @__PURE__ */ new Set([
|
|
66
|
-
"object",
|
|
67
|
-
"strictObject",
|
|
68
|
-
"looseObject",
|
|
69
|
-
"union",
|
|
70
|
-
"discriminatedUnion",
|
|
71
|
-
"intersection",
|
|
72
|
-
"record",
|
|
73
|
-
"tuple"
|
|
74
|
-
]);
|
|
75
|
-
var CHAIN_METHODS = /* @__PURE__ */ new Set([
|
|
76
|
-
// ZodType generic
|
|
77
|
-
"optional",
|
|
78
|
-
"nullable",
|
|
79
|
-
"nullish",
|
|
80
|
-
"default",
|
|
81
|
-
"prefault",
|
|
82
|
-
"describe",
|
|
83
|
-
"refine",
|
|
84
|
-
"superRefine",
|
|
85
|
-
"transform",
|
|
86
|
-
"pipe",
|
|
87
|
-
"or",
|
|
88
|
-
"and",
|
|
89
|
-
"readonly",
|
|
90
|
-
"brand",
|
|
91
|
-
"catch",
|
|
92
|
-
"array",
|
|
93
|
-
"promise",
|
|
94
|
-
// ZodString
|
|
95
|
-
"email",
|
|
96
|
-
"url",
|
|
97
|
-
"uuid",
|
|
98
|
-
"cuid",
|
|
99
|
-
"cuid2",
|
|
100
|
-
"ulid",
|
|
101
|
-
"regex",
|
|
102
|
-
"startsWith",
|
|
103
|
-
"endsWith",
|
|
104
|
-
"trim",
|
|
105
|
-
"toLowerCase",
|
|
106
|
-
"toUpperCase",
|
|
107
|
-
"datetime",
|
|
108
|
-
"date",
|
|
109
|
-
"time",
|
|
110
|
-
"ip",
|
|
111
|
-
"cidr",
|
|
112
|
-
"base64",
|
|
113
|
-
"base64url",
|
|
114
|
-
"jwt",
|
|
115
|
-
"nanoid",
|
|
116
|
-
"emoji",
|
|
117
|
-
"includes",
|
|
118
|
-
"normalize",
|
|
119
|
-
// ZodString / ZodNumber / ZodArray — shared (`Set` dedupes)
|
|
120
|
-
"min",
|
|
121
|
-
"max",
|
|
122
|
-
"length",
|
|
123
|
-
"gt",
|
|
124
|
-
"gte",
|
|
125
|
-
"lt",
|
|
126
|
-
"lte",
|
|
127
|
-
// ZodNumber
|
|
128
|
-
"int",
|
|
129
|
-
"positive",
|
|
130
|
-
"negative",
|
|
131
|
-
"nonnegative",
|
|
132
|
-
"nonpositive",
|
|
133
|
-
"finite",
|
|
134
|
-
"safe",
|
|
135
|
-
"multipleOf",
|
|
136
|
-
"step",
|
|
137
|
-
// ZodObject
|
|
138
|
-
"extend",
|
|
139
|
-
"merge",
|
|
140
|
-
"pick",
|
|
141
|
-
"omit",
|
|
142
|
-
"partial",
|
|
143
|
-
"deepPartial",
|
|
144
|
-
"required",
|
|
145
|
-
"passthrough",
|
|
146
|
-
"strict",
|
|
147
|
-
"strip",
|
|
148
|
-
"catchall",
|
|
149
|
-
"keyof",
|
|
150
|
-
// ZodArray
|
|
151
|
-
"nonempty",
|
|
152
|
-
"element",
|
|
153
|
-
// ZodEnum
|
|
154
|
-
"extract",
|
|
155
|
-
"exclude"
|
|
156
|
-
]);
|
|
157
|
-
|
|
158
|
-
// libs/lazy-zod/src/lazy-schema.ts
|
|
159
|
-
var LAZY_BRAND = /* @__PURE__ */ Symbol.for("@frontmcp/lazy-zod.LazyZodSchema");
|
|
160
|
-
var LAZY_TARGET = /* @__PURE__ */ Symbol.for("@frontmcp/lazy-zod.LazyZodSchema.target");
|
|
161
|
-
var HOT_PATH_METHODS = /* @__PURE__ */ new Set(["parse", "safeParse", "parseAsync", "safeParseAsync"]);
|
|
162
|
-
var LazyZodSchema = class {
|
|
163
|
-
constructor(_materialize) {
|
|
164
|
-
this._materialize = _materialize;
|
|
165
|
-
Object.defineProperty(this, LAZY_BRAND, {
|
|
166
|
-
value: true,
|
|
167
|
-
enumerable: false,
|
|
168
|
-
writable: false,
|
|
169
|
-
configurable: false
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
_materialize;
|
|
173
|
-
_resolved;
|
|
174
|
-
/** Materialize (and memoize) the underlying real zod schema. */
|
|
175
|
-
materialize() {
|
|
176
|
-
return this._resolved ?? (this._resolved = this._materialize());
|
|
177
|
-
}
|
|
178
|
-
/** True once the underlying schema has been constructed. */
|
|
179
|
-
get isMaterialized() {
|
|
180
|
-
return this._resolved !== void 0;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
function wrapLazy(schema) {
|
|
184
|
-
const proxy = new Proxy(schema, {
|
|
185
|
-
get(target, key, _receiver) {
|
|
186
|
-
if (key === LAZY_BRAND) return true;
|
|
187
|
-
if (key === LAZY_TARGET) return target;
|
|
188
|
-
if (typeof key !== "symbol" && Object.prototype.hasOwnProperty.call(target, key)) {
|
|
189
|
-
return target[key];
|
|
190
|
-
}
|
|
191
|
-
if (typeof key === "string" && HOT_PATH_METHODS.has(key)) {
|
|
192
|
-
return (...args) => {
|
|
193
|
-
const real2 = target.materialize();
|
|
194
|
-
const bound = real2[key].bind(real2);
|
|
195
|
-
Object.defineProperty(target, key, {
|
|
196
|
-
value: bound,
|
|
197
|
-
writable: true,
|
|
198
|
-
configurable: true,
|
|
199
|
-
enumerable: false
|
|
200
|
-
});
|
|
201
|
-
return bound(...args);
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
if (typeof key === "string" && CHAIN_METHODS.has(key)) {
|
|
205
|
-
return (...args) => wrapLazy(
|
|
206
|
-
new LazyZodSchema(() => {
|
|
207
|
-
const real2 = target.materialize();
|
|
208
|
-
return real2[key](...args);
|
|
209
|
-
})
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
const real = target.materialize();
|
|
213
|
-
const val = real[key];
|
|
214
|
-
if (typeof val === "function") {
|
|
215
|
-
if (key === "constructor") return val;
|
|
216
|
-
const maybeCtor = val;
|
|
217
|
-
if (typeof maybeCtor.prototype === "object" && maybeCtor.prototype !== null && Object.getOwnPropertyNames(maybeCtor.prototype).length > 1) {
|
|
218
|
-
return val;
|
|
219
|
-
}
|
|
220
|
-
return val.bind(real);
|
|
221
|
-
}
|
|
222
|
-
return val;
|
|
223
|
-
},
|
|
224
|
-
has(target, key) {
|
|
225
|
-
if (key === LAZY_BRAND) return true;
|
|
226
|
-
if (typeof key === "string" && (HOT_PATH_METHODS.has(key) || CHAIN_METHODS.has(key))) {
|
|
227
|
-
return true;
|
|
228
|
-
}
|
|
229
|
-
return Reflect.has(target.materialize(), key);
|
|
230
|
-
},
|
|
231
|
-
getPrototypeOf(target) {
|
|
232
|
-
return Object.getPrototypeOf(target.materialize());
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
return proxy;
|
|
236
|
-
}
|
|
237
|
-
function lazyZ(factory) {
|
|
238
|
-
return wrapLazy(new LazyZodSchema(factory));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// libs/lazy-zod/src/utils.ts
|
|
242
|
-
function isLazy(value) {
|
|
243
|
-
if (value === null || typeof value !== "object" && typeof value !== "function") return false;
|
|
244
|
-
return value[LAZY_BRAND] === true;
|
|
245
|
-
}
|
|
246
|
-
function forceMaterialize(schema) {
|
|
247
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
248
|
-
return deepMaterialize(schema, seen);
|
|
249
|
-
}
|
|
250
|
-
function deepMaterialize(value, seen) {
|
|
251
|
-
if (value === null || typeof value !== "object" && typeof value !== "function") return value;
|
|
252
|
-
let resolved = value;
|
|
253
|
-
if (value[LAZY_BRAND] === true) {
|
|
254
|
-
const target = value[LAZY_TARGET];
|
|
255
|
-
resolved = target.materialize();
|
|
256
|
-
}
|
|
257
|
-
if (typeof resolved !== "object" && typeof resolved !== "function") return resolved;
|
|
258
|
-
if (resolved === null) return resolved;
|
|
259
|
-
if (seen.has(resolved)) return resolved;
|
|
260
|
-
seen.add(resolved);
|
|
261
|
-
const def = resolved._def;
|
|
262
|
-
if (def && typeof def === "object") {
|
|
263
|
-
const rawShape = def["shape"];
|
|
264
|
-
const shape = typeof rawShape === "function" ? rawShape.call(def) : rawShape;
|
|
265
|
-
if (shape && typeof shape === "object") {
|
|
266
|
-
for (const k of Object.keys(shape)) {
|
|
267
|
-
shape[k] = deepMaterialize(shape[k], seen);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const options = def["options"];
|
|
271
|
-
if (Array.isArray(options)) {
|
|
272
|
-
for (let i = 0; i < options.length; i++) options[i] = deepMaterialize(options[i], seen);
|
|
273
|
-
}
|
|
274
|
-
if ("innerType" in def) def["innerType"] = deepMaterialize(def["innerType"], seen);
|
|
275
|
-
if ("element" in def) def["element"] = deepMaterialize(def["element"], seen);
|
|
276
|
-
if ("valueType" in def) def["valueType"] = deepMaterialize(def["valueType"], seen);
|
|
277
|
-
if ("keyType" in def) def["keyType"] = deepMaterialize(def["keyType"], seen);
|
|
278
|
-
if ("left" in def) def["left"] = deepMaterialize(def["left"], seen);
|
|
279
|
-
if ("right" in def) def["right"] = deepMaterialize(def["right"], seen);
|
|
280
|
-
const items = def["items"];
|
|
281
|
-
if (Array.isArray(items)) {
|
|
282
|
-
for (let i = 0; i < items.length; i++) items[i] = deepMaterialize(items[i], seen);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return resolved;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// libs/lazy-zod/src/lazy-z.ts
|
|
289
|
-
var import_zod = require("zod");
|
|
290
|
-
function createLazyZ(namespace) {
|
|
291
|
-
return new Proxy({}, {
|
|
292
|
-
get(_target, key, receiver) {
|
|
293
|
-
if (typeof key === "string" && HEAVY_FACTORIES.has(key)) {
|
|
294
|
-
const realFactory = namespace[key];
|
|
295
|
-
return (...args) => wrapLazy(
|
|
296
|
-
new LazyZodSchema(() => realFactory.call(namespace, ...args))
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
return Reflect.get(namespace, key, receiver);
|
|
300
|
-
},
|
|
301
|
-
set: (_target, key, value) => Reflect.set(namespace, key, value),
|
|
302
|
-
has: (_target, key) => Reflect.has(namespace, key),
|
|
303
|
-
ownKeys: () => Reflect.ownKeys(namespace),
|
|
304
|
-
getOwnPropertyDescriptor(_target, key) {
|
|
305
|
-
const desc = Reflect.getOwnPropertyDescriptor(namespace, key);
|
|
306
|
-
return desc ? { ...desc, configurable: true } : void 0;
|
|
307
|
-
},
|
|
308
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(namespace)
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
var z = createLazyZ(import_zod.z);
|
|
312
|
-
|
|
313
|
-
// libs/lazy-zod/src/eager-z.ts
|
|
314
|
-
var import_zod2 = require("zod");
|
|
315
|
-
|
|
316
|
-
// libs/lazy-zod/src/index.ts
|
|
317
|
-
var import_zod4 = require("zod");
|
|
318
|
-
var toJSONSchema = ((schema, params) => (0, import_zod3.toJSONSchema)(
|
|
319
|
-
forceMaterialize(schema),
|
|
320
|
-
params
|
|
321
|
-
));
|
|
322
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
323
|
-
0 && (module.exports = {
|
|
324
|
-
LAZY_BRAND,
|
|
325
|
-
LAZY_TARGET,
|
|
326
|
-
LazyZodSchema,
|
|
327
|
-
NEVER,
|
|
328
|
-
ZodAny,
|
|
329
|
-
ZodArray,
|
|
330
|
-
ZodBigInt,
|
|
331
|
-
ZodBoolean,
|
|
332
|
-
ZodDate,
|
|
333
|
-
ZodDefault,
|
|
334
|
-
ZodDiscriminatedUnion,
|
|
335
|
-
ZodEnum,
|
|
336
|
-
ZodError,
|
|
337
|
-
ZodIntersection,
|
|
338
|
-
ZodLiteral,
|
|
339
|
-
ZodNever,
|
|
340
|
-
ZodNull,
|
|
341
|
-
ZodNullable,
|
|
342
|
-
ZodNumber,
|
|
343
|
-
ZodObject,
|
|
344
|
-
ZodOptional,
|
|
345
|
-
ZodRecord,
|
|
346
|
-
ZodString,
|
|
347
|
-
ZodSymbol,
|
|
348
|
-
ZodTuple,
|
|
349
|
-
ZodType,
|
|
350
|
-
ZodUndefined,
|
|
351
|
-
ZodUnion,
|
|
352
|
-
ZodUnknown,
|
|
353
|
-
ZodVoid,
|
|
354
|
-
eagerZ,
|
|
355
|
-
forceMaterialize,
|
|
356
|
-
isLazy,
|
|
357
|
-
lazyZ,
|
|
358
|
-
toJSONSchema,
|
|
359
|
-
z
|
|
360
|
-
});
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var index_exports={};__export(index_exports,{LAZY_BRAND:()=>LAZY_BRAND,LAZY_TARGET:()=>LAZY_TARGET,LazyZodSchema:()=>LazyZodSchema,NEVER:()=>import_zod4.NEVER,ZodAny:()=>import_zod4.ZodAny,ZodArray:()=>import_zod4.ZodArray,ZodBigInt:()=>import_zod4.ZodBigInt,ZodBoolean:()=>import_zod4.ZodBoolean,ZodDate:()=>import_zod4.ZodDate,ZodDefault:()=>import_zod4.ZodDefault,ZodDiscriminatedUnion:()=>import_zod4.ZodDiscriminatedUnion,ZodEnum:()=>import_zod4.ZodEnum,ZodError:()=>import_zod4.ZodError,ZodIntersection:()=>import_zod4.ZodIntersection,ZodLiteral:()=>import_zod4.ZodLiteral,ZodNever:()=>import_zod4.ZodNever,ZodNull:()=>import_zod4.ZodNull,ZodNullable:()=>import_zod4.ZodNullable,ZodNumber:()=>import_zod4.ZodNumber,ZodObject:()=>import_zod4.ZodObject,ZodOptional:()=>import_zod4.ZodOptional,ZodRecord:()=>import_zod4.ZodRecord,ZodString:()=>import_zod4.ZodString,ZodSymbol:()=>import_zod4.ZodSymbol,ZodTuple:()=>import_zod4.ZodTuple,ZodType:()=>import_zod4.ZodType,ZodUndefined:()=>import_zod4.ZodUndefined,ZodUnion:()=>import_zod4.ZodUnion,ZodUnknown:()=>import_zod4.ZodUnknown,ZodVoid:()=>import_zod4.ZodVoid,default:()=>z,eagerZ:()=>import_zod2.z,forceMaterialize:()=>forceMaterialize,isLazy:()=>isLazy,lazyZ:()=>lazyZ,toJSONSchema:()=>toJSONSchema,z:()=>z});module.exports=__toCommonJS(index_exports);var import_zod3=require("zod");var HEAVY_FACTORIES=new Set(["object","strictObject","looseObject","union","discriminatedUnion","intersection","record","tuple"]);var CHAIN_METHODS=new Set(["optional","nullable","nullish","default","prefault","describe","refine","superRefine","transform","pipe","or","and","readonly","brand","catch","array","promise","email","url","uuid","cuid","cuid2","ulid","regex","startsWith","endsWith","trim","toLowerCase","toUpperCase","datetime","date","time","ip","cidr","base64","base64url","jwt","nanoid","emoji","includes","normalize","min","max","length","gt","gte","lt","lte","int","positive","negative","nonnegative","nonpositive","finite","safe","multipleOf","step","extend","merge","pick","omit","partial","deepPartial","required","passthrough","strict","strip","catchall","keyof","nonempty","element","extract","exclude"]);var LAZY_BRAND=Symbol.for("@frontmcp/lazy-zod.LazyZodSchema");var LAZY_TARGET=Symbol.for("@frontmcp/lazy-zod.LazyZodSchema.target");var HOT_PATH_METHODS=new Set(["parse","safeParse","parseAsync","safeParseAsync"]);var LazyZodSchema=class{constructor(_materialize){this._materialize=_materialize;Object.defineProperty(this,LAZY_BRAND,{value:true,enumerable:false,writable:false,configurable:false})}_materialize;_resolved;materialize(){return this._resolved??(this._resolved=this._materialize())}get isMaterialized(){return this._resolved!==void 0}};function wrapLazy(schema){const proxy=new Proxy(schema,{get(target,key,_receiver){if(key===LAZY_BRAND)return true;if(key===LAZY_TARGET)return target;if(typeof key!=="symbol"&&Object.prototype.hasOwnProperty.call(target,key)){return target[key]}if(typeof key==="string"&&HOT_PATH_METHODS.has(key)){return(...args)=>{const real2=target.materialize();const bound=real2[key].bind(real2);Object.defineProperty(target,key,{value:bound,writable:true,configurable:true,enumerable:false});return bound(...args)}}if(typeof key==="string"&&CHAIN_METHODS.has(key)){return(...args)=>wrapLazy(new LazyZodSchema(()=>{const real2=target.materialize();return real2[key](...args)}))}const real=target.materialize();const val=real[key];if(typeof val==="function"){if(key==="constructor")return val;const maybeCtor=val;if(typeof maybeCtor.prototype==="object"&&maybeCtor.prototype!==null&&Object.getOwnPropertyNames(maybeCtor.prototype).length>1){return val}return val.bind(real)}return val},has(target,key){if(key===LAZY_BRAND)return true;if(typeof key==="string"&&(HOT_PATH_METHODS.has(key)||CHAIN_METHODS.has(key))){return true}return Reflect.has(target.materialize(),key)},getPrototypeOf(target){return Object.getPrototypeOf(target.materialize())}});return proxy}function lazyZ(factory){return wrapLazy(new LazyZodSchema(factory))}function isLazy(value){if(value===null||typeof value!=="object"&&typeof value!=="function")return false;return value[LAZY_BRAND]===true}function forceMaterialize(schema){const seen=new WeakSet;return deepMaterialize(schema,seen)}function deepMaterialize(value,seen){if(value===null||typeof value!=="object"&&typeof value!=="function")return value;let resolved=value;if(value[LAZY_BRAND]===true){const target=value[LAZY_TARGET];resolved=target.materialize()}if(typeof resolved!=="object"&&typeof resolved!=="function")return resolved;if(resolved===null)return resolved;if(seen.has(resolved))return resolved;seen.add(resolved);const def=resolved._def;if(def&&typeof def==="object"){const rawShape=def["shape"];const shape=typeof rawShape==="function"?rawShape.call(def):rawShape;if(shape&&typeof shape==="object"){for(const k of Object.keys(shape)){shape[k]=deepMaterialize(shape[k],seen)}}const options=def["options"];if(Array.isArray(options)){for(let i=0;i<options.length;i++)options[i]=deepMaterialize(options[i],seen)}if("innerType"in def)def["innerType"]=deepMaterialize(def["innerType"],seen);if("element"in def)def["element"]=deepMaterialize(def["element"],seen);if("valueType"in def)def["valueType"]=deepMaterialize(def["valueType"],seen);if("keyType"in def)def["keyType"]=deepMaterialize(def["keyType"],seen);if("left"in def)def["left"]=deepMaterialize(def["left"],seen);if("right"in def)def["right"]=deepMaterialize(def["right"],seen);const items=def["items"];if(Array.isArray(items)){for(let i=0;i<items.length;i++)items[i]=deepMaterialize(items[i],seen)}}return resolved}var import_zod=require("zod");function createLazyZ(namespace){return new Proxy({},{get(_target,key,receiver){if(typeof key==="string"&&HEAVY_FACTORIES.has(key)){const realFactory=namespace[key];return(...args)=>wrapLazy(new LazyZodSchema(()=>realFactory.call(namespace,...args)))}return Reflect.get(namespace,key,receiver)},set:(_target,key,value)=>Reflect.set(namespace,key,value),has:(_target,key)=>Reflect.has(namespace,key),ownKeys:()=>Reflect.ownKeys(namespace),getOwnPropertyDescriptor(_target,key){const desc=Reflect.getOwnPropertyDescriptor(namespace,key);return desc?{...desc,configurable:true}:void 0},getPrototypeOf:()=>Reflect.getPrototypeOf(namespace)})}var z=createLazyZ(import_zod.z);var import_zod2=require("zod");var import_zod4=require("zod");var toJSONSchema=((schema,params)=>(0,import_zod3.toJSONSchema)(forceMaterialize(schema),params));0&&(module.exports={LAZY_BRAND,LAZY_TARGET,LazyZodSchema,NEVER,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEnum,ZodError,ZodIntersection,ZodLiteral,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodRecord,ZodString,ZodSymbol,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,eagerZ,forceMaterialize,isLazy,lazyZ,toJSONSchema,z});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/lazy-zod",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9-rc.2",
|
|
4
4
|
"description": "Zod 4's z with compound schemas built on first use, for faster start-up. Exports z (lazy), eagerZ (Zod's own) and lazyZ",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|