@github/copilot-language-server 1.551.1 → 1.551.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +748 -748
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/cliVersion.js +1 -1
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/client.js +499 -36
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/copilotRequestHandler.js +156 -20
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/extension.js +11 -9
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/ffiRuntimeHost.js +14 -3
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/generated/rpc.js +1305 -304
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/host.js +67 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/index.js +12 -7
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/installationConfirmation.js +98 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/runtimeArtifacts.js +1 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/schema.js +40 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/session.js +474 -151
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/sessionFsProvider.js +57 -0
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/types.js +5 -2
- package/dist/node_modules/@github/copilot-sdk/dist/cjs/{factory.js → workflow.js} +33 -33
- package/dist/node_modules/@github/copilot-sdk/package.json +27 -16
- package/dist/node_modules/zod/locales/package.json +1 -2
- package/dist/node_modules/zod/mini/package.json +1 -2
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/node_modules/zod/v3/package.json +1 -2
- package/dist/node_modules/zod/v4/classic/errors.js +2 -2
- package/dist/node_modules/zod/v4/classic/from-json-schema.cjs +16 -31
- package/dist/node_modules/zod/v4/classic/from-json-schema.js +16 -31
- package/dist/node_modules/zod/v4/classic/package.json +1 -2
- package/dist/node_modules/zod/v4/classic/schemas.cjs +119 -358
- package/dist/node_modules/zod/v4/classic/schemas.js +118 -356
- package/dist/node_modules/zod/v4/core/api.cjs +2 -7
- package/dist/node_modules/zod/v4/core/api.js +2 -7
- package/dist/node_modules/zod/v4/core/core.cjs +1 -3
- package/dist/node_modules/zod/v4/core/core.js +2 -4
- package/dist/node_modules/zod/v4/core/errors.cjs +23 -26
- package/dist/node_modules/zod/v4/core/errors.js +23 -26
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +20 -16
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +20 -16
- package/dist/node_modules/zod/v4/core/package.json +1 -2
- package/dist/node_modules/zod/v4/core/parse.cjs +7 -7
- package/dist/node_modules/zod/v4/core/parse.js +7 -7
- package/dist/node_modules/zod/v4/core/regexes.cjs +3 -9
- package/dist/node_modules/zod/v4/core/regexes.js +1 -7
- package/dist/node_modules/zod/v4/core/schemas.cjs +65 -211
- package/dist/node_modules/zod/v4/core/schemas.js +64 -210
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs +1 -12
- package/dist/node_modules/zod/v4/core/to-json-schema.js +1 -12
- package/dist/node_modules/zod/v4/core/util.cjs +30 -54
- package/dist/node_modules/zod/v4/core/util.js +32 -55
- package/dist/node_modules/zod/v4/core/versions.cjs +2 -2
- package/dist/node_modules/zod/v4/core/versions.js +2 -2
- package/dist/node_modules/zod/v4/locales/en.cjs +0 -4
- package/dist/node_modules/zod/v4/locales/en.js +0 -4
- package/dist/node_modules/zod/v4/locales/fr.cjs +7 -24
- package/dist/node_modules/zod/v4/locales/fr.js +7 -24
- package/dist/node_modules/zod/v4/locales/index.cjs +1 -8
- package/dist/node_modules/zod/v4/locales/index.js +0 -3
- package/dist/node_modules/zod/v4/locales/it.cjs +1 -1
- package/dist/node_modules/zod/v4/locales/it.js +1 -1
- package/dist/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/dist/node_modules/zod/v4/locales/ka.js +8 -8
- package/dist/node_modules/zod/v4/locales/package.json +1 -2
- package/dist/node_modules/zod/v4/locales/uz.cjs +0 -1
- package/dist/node_modules/zod/v4/locales/uz.js +0 -1
- package/dist/node_modules/zod/v4/mini/package.json +1 -2
- package/dist/node_modules/zod/v4/mini/schemas.cjs +4 -41
- package/dist/node_modules/zod/v4/mini/schemas.js +4 -40
- package/dist/node_modules/zod/v4/package.json +1 -2
- package/dist/node_modules/zod/v4-mini/package.json +1 -2
- package/package.json +20 -20
- package/dist/node_modules/zod/v4/locales/el.cjs +0 -136
- package/dist/node_modules/zod/v4/locales/el.js +0 -109
- package/dist/node_modules/zod/v4/locales/hr.cjs +0 -149
- package/dist/node_modules/zod/v4/locales/hr.js +0 -122
- package/dist/node_modules/zod/v4/locales/ro.cjs +0 -146
- package/dist/node_modules/zod/v4/locales/ro.js +0 -119
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ZodLiteral = exports.ZodEnum = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodXor = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodDate = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodBigIntFormat = exports.ZodBigInt = exports.ZodBoolean = exports.ZodNumberFormat = exports.ZodNumber = exports.ZodCustomStringFormat = exports.ZodJWT = exports.ZodE164 = exports.ZodBase64URL = exports.ZodBase64 = exports.ZodCIDRv6 = exports.ZodCIDRv4 = exports.ZodIPv6 = exports.ZodMAC = exports.ZodIPv4 = exports.ZodKSUID = exports.ZodXID = exports.ZodULID = exports.ZodCUID2 = exports.ZodCUID = exports.ZodNanoID = exports.ZodEmoji = exports.ZodURL = exports.ZodUUID = exports.ZodGUID = exports.ZodEmail = exports.ZodStringFormat = exports.ZodString = exports._ZodString = exports.ZodType = void 0;
|
|
27
|
-
exports.stringbool = exports.meta = exports.describe = exports.ZodCustom = exports.ZodFunction = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.
|
|
27
|
+
exports.stringbool = exports.meta = exports.describe = exports.ZodCustom = exports.ZodFunction = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.ZodCodec = exports.ZodPipe = exports.ZodNaN = exports.ZodCatch = exports.ZodSuccess = exports.ZodNonOptional = exports.ZodPrefault = exports.ZodDefault = exports.ZodNullable = exports.ZodExactOptional = exports.ZodOptional = exports.ZodTransform = exports.ZodFile = void 0;
|
|
28
28
|
exports.string = string;
|
|
29
29
|
exports.email = email;
|
|
30
30
|
exports.guid = guid;
|
|
@@ -104,7 +104,6 @@ exports.catch = _catch;
|
|
|
104
104
|
exports.nan = nan;
|
|
105
105
|
exports.pipe = pipe;
|
|
106
106
|
exports.codec = codec;
|
|
107
|
-
exports.invertCodec = invertCodec;
|
|
108
107
|
exports.readonly = readonly;
|
|
109
108
|
exports.templateLiteral = templateLiteral;
|
|
110
109
|
exports.lazy = lazy;
|
|
@@ -127,54 +126,6 @@ const to_json_schema_js_1 = require("../core/to-json-schema.cjs");
|
|
|
127
126
|
const checks = __importStar(require("./checks.cjs"));
|
|
128
127
|
const iso = __importStar(require("./iso.cjs"));
|
|
129
128
|
const parse = __importStar(require("./parse.cjs"));
|
|
130
|
-
// Lazy-bind builder methods.
|
|
131
|
-
//
|
|
132
|
-
// Builder methods (`.optional`, `.array`, `.refine`, ...) live as
|
|
133
|
-
// non-enumerable getters on each concrete schema constructor's
|
|
134
|
-
// prototype. On first access from an instance the getter allocates
|
|
135
|
-
// `fn.bind(this)` and caches it as an own property on that instance,
|
|
136
|
-
// so detached usage (`const m = schema.optional; m()`) still works
|
|
137
|
-
// and the per-instance allocation only happens for methods actually
|
|
138
|
-
// touched.
|
|
139
|
-
//
|
|
140
|
-
// One install per (prototype, group), memoized by `_installedGroups`.
|
|
141
|
-
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
142
|
-
function _installLazyMethods(inst, group, methods) {
|
|
143
|
-
const proto = Object.getPrototypeOf(inst);
|
|
144
|
-
let installed = _installedGroups.get(proto);
|
|
145
|
-
if (!installed) {
|
|
146
|
-
installed = new Set();
|
|
147
|
-
_installedGroups.set(proto, installed);
|
|
148
|
-
}
|
|
149
|
-
if (installed.has(group))
|
|
150
|
-
return;
|
|
151
|
-
installed.add(group);
|
|
152
|
-
for (const key in methods) {
|
|
153
|
-
const fn = methods[key];
|
|
154
|
-
Object.defineProperty(proto, key, {
|
|
155
|
-
configurable: true,
|
|
156
|
-
enumerable: false,
|
|
157
|
-
get() {
|
|
158
|
-
const bound = fn.bind(this);
|
|
159
|
-
Object.defineProperty(this, key, {
|
|
160
|
-
configurable: true,
|
|
161
|
-
writable: true,
|
|
162
|
-
enumerable: true,
|
|
163
|
-
value: bound,
|
|
164
|
-
});
|
|
165
|
-
return bound;
|
|
166
|
-
},
|
|
167
|
-
set(v) {
|
|
168
|
-
Object.defineProperty(this, key, {
|
|
169
|
-
configurable: true,
|
|
170
|
-
writable: true,
|
|
171
|
-
enumerable: true,
|
|
172
|
-
value: v,
|
|
173
|
-
});
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
129
|
exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
179
130
|
core.$ZodType.init(inst, def);
|
|
180
131
|
Object.assign(inst["~standard"], {
|
|
@@ -187,16 +138,31 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
|
187
138
|
inst.def = def;
|
|
188
139
|
inst.type = def.type;
|
|
189
140
|
Object.defineProperty(inst, "_def", { value: def });
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
141
|
+
// base methods
|
|
142
|
+
inst.check = (...checks) => {
|
|
143
|
+
return inst.clone(index_js_1.util.mergeDefs(def, {
|
|
144
|
+
checks: [
|
|
145
|
+
...(def.checks ?? []),
|
|
146
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
147
|
+
],
|
|
148
|
+
}), {
|
|
149
|
+
parent: true,
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
inst.with = inst.check;
|
|
153
|
+
inst.clone = (def, params) => core.clone(inst, def, params);
|
|
154
|
+
inst.brand = () => inst;
|
|
155
|
+
inst.register = ((reg, meta) => {
|
|
156
|
+
reg.add(inst, meta);
|
|
157
|
+
return inst;
|
|
158
|
+
});
|
|
159
|
+
// parsing
|
|
195
160
|
inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
|
|
196
161
|
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
|
|
197
162
|
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
198
163
|
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
|
199
164
|
inst.spa = inst.safeParseAsync;
|
|
165
|
+
// encoding/decoding
|
|
200
166
|
inst.encode = (data, params) => parse.encode(inst, data, params);
|
|
201
167
|
inst.decode = (data, params) => parse.decode(inst, data, params);
|
|
202
168
|
inst.encodeAsync = async (data, params) => parse.encodeAsync(inst, data, params);
|
|
@@ -205,118 +171,50 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
|
205
171
|
inst.safeDecode = (data, params) => parse.safeDecode(inst, data, params);
|
|
206
172
|
inst.safeEncodeAsync = async (data, params) => parse.safeEncodeAsync(inst, data, params);
|
|
207
173
|
inst.safeDecodeAsync = async (data, params) => parse.safeDecodeAsync(inst, data, params);
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
reg.add(this, meta);
|
|
235
|
-
return this;
|
|
236
|
-
},
|
|
237
|
-
refine(check, params) {
|
|
238
|
-
return this.check(refine(check, params));
|
|
239
|
-
},
|
|
240
|
-
superRefine(refinement, params) {
|
|
241
|
-
return this.check(superRefine(refinement, params));
|
|
242
|
-
},
|
|
243
|
-
overwrite(fn) {
|
|
244
|
-
return this.check(checks.overwrite(fn));
|
|
245
|
-
},
|
|
246
|
-
optional() {
|
|
247
|
-
return optional(this);
|
|
248
|
-
},
|
|
249
|
-
exactOptional() {
|
|
250
|
-
return exactOptional(this);
|
|
251
|
-
},
|
|
252
|
-
nullable() {
|
|
253
|
-
return nullable(this);
|
|
254
|
-
},
|
|
255
|
-
nullish() {
|
|
256
|
-
return optional(nullable(this));
|
|
257
|
-
},
|
|
258
|
-
nonoptional(params) {
|
|
259
|
-
return nonoptional(this, params);
|
|
260
|
-
},
|
|
261
|
-
array() {
|
|
262
|
-
return array(this);
|
|
263
|
-
},
|
|
264
|
-
or(arg) {
|
|
265
|
-
return union([this, arg]);
|
|
266
|
-
},
|
|
267
|
-
and(arg) {
|
|
268
|
-
return intersection(this, arg);
|
|
269
|
-
},
|
|
270
|
-
transform(tx) {
|
|
271
|
-
return pipe(this, transform(tx));
|
|
272
|
-
},
|
|
273
|
-
default(d) {
|
|
274
|
-
return _default(this, d);
|
|
275
|
-
},
|
|
276
|
-
prefault(d) {
|
|
277
|
-
return prefault(this, d);
|
|
278
|
-
},
|
|
279
|
-
catch(params) {
|
|
280
|
-
return _catch(this, params);
|
|
281
|
-
},
|
|
282
|
-
pipe(target) {
|
|
283
|
-
return pipe(this, target);
|
|
284
|
-
},
|
|
285
|
-
readonly() {
|
|
286
|
-
return readonly(this);
|
|
287
|
-
},
|
|
288
|
-
describe(description) {
|
|
289
|
-
const cl = this.clone();
|
|
290
|
-
core.globalRegistry.add(cl, { description });
|
|
291
|
-
return cl;
|
|
292
|
-
},
|
|
293
|
-
meta(...args) {
|
|
294
|
-
// overloaded: meta() returns the registered metadata, meta(data)
|
|
295
|
-
// returns a clone with `data` registered. The mapped type picks
|
|
296
|
-
// up the second overload, so we accept variadic any-args and
|
|
297
|
-
// return `any` to satisfy both at runtime.
|
|
298
|
-
if (args.length === 0)
|
|
299
|
-
return core.globalRegistry.get(this);
|
|
300
|
-
const cl = this.clone();
|
|
301
|
-
core.globalRegistry.add(cl, args[0]);
|
|
302
|
-
return cl;
|
|
303
|
-
},
|
|
304
|
-
isOptional() {
|
|
305
|
-
return this.safeParse(undefined).success;
|
|
306
|
-
},
|
|
307
|
-
isNullable() {
|
|
308
|
-
return this.safeParse(null).success;
|
|
309
|
-
},
|
|
310
|
-
apply(fn) {
|
|
311
|
-
return fn(this);
|
|
312
|
-
},
|
|
313
|
-
});
|
|
174
|
+
// refinements
|
|
175
|
+
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
176
|
+
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
177
|
+
inst.overwrite = (fn) => inst.check(checks.overwrite(fn));
|
|
178
|
+
// wrappers
|
|
179
|
+
inst.optional = () => optional(inst);
|
|
180
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
181
|
+
inst.nullable = () => nullable(inst);
|
|
182
|
+
inst.nullish = () => optional(nullable(inst));
|
|
183
|
+
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
184
|
+
inst.array = () => array(inst);
|
|
185
|
+
inst.or = (arg) => union([inst, arg]);
|
|
186
|
+
inst.and = (arg) => intersection(inst, arg);
|
|
187
|
+
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
188
|
+
inst.default = (def) => _default(inst, def);
|
|
189
|
+
inst.prefault = (def) => prefault(inst, def);
|
|
190
|
+
// inst.coalesce = (def, params) => coalesce(inst, def, params);
|
|
191
|
+
inst.catch = (params) => _catch(inst, params);
|
|
192
|
+
inst.pipe = (target) => pipe(inst, target);
|
|
193
|
+
inst.readonly = () => readonly(inst);
|
|
194
|
+
// meta
|
|
195
|
+
inst.describe = (description) => {
|
|
196
|
+
const cl = inst.clone();
|
|
197
|
+
core.globalRegistry.add(cl, { description });
|
|
198
|
+
return cl;
|
|
199
|
+
};
|
|
314
200
|
Object.defineProperty(inst, "description", {
|
|
315
201
|
get() {
|
|
316
202
|
return core.globalRegistry.get(inst)?.description;
|
|
317
203
|
},
|
|
318
204
|
configurable: true,
|
|
319
205
|
});
|
|
206
|
+
inst.meta = (...args) => {
|
|
207
|
+
if (args.length === 0) {
|
|
208
|
+
return core.globalRegistry.get(inst);
|
|
209
|
+
}
|
|
210
|
+
const cl = inst.clone();
|
|
211
|
+
core.globalRegistry.add(cl, args[0]);
|
|
212
|
+
return cl;
|
|
213
|
+
};
|
|
214
|
+
// helpers
|
|
215
|
+
inst.isOptional = () => inst.safeParse(undefined).success;
|
|
216
|
+
inst.isNullable = () => inst.safeParse(null).success;
|
|
217
|
+
inst.apply = (fn) => fn(inst);
|
|
320
218
|
return inst;
|
|
321
219
|
});
|
|
322
220
|
/** @internal */
|
|
@@ -328,53 +226,23 @@ exports._ZodString = core.$constructor("_ZodString", (inst, def) => {
|
|
|
328
226
|
inst.format = bag.format ?? null;
|
|
329
227
|
inst.minLength = bag.minimum ?? null;
|
|
330
228
|
inst.maxLength = bag.maximum ?? null;
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return this.check(checks.maxLength(...args));
|
|
349
|
-
},
|
|
350
|
-
length(...args) {
|
|
351
|
-
return this.check(checks.length(...args));
|
|
352
|
-
},
|
|
353
|
-
nonempty(...args) {
|
|
354
|
-
return this.check(checks.minLength(1, ...args));
|
|
355
|
-
},
|
|
356
|
-
lowercase(params) {
|
|
357
|
-
return this.check(checks.lowercase(params));
|
|
358
|
-
},
|
|
359
|
-
uppercase(params) {
|
|
360
|
-
return this.check(checks.uppercase(params));
|
|
361
|
-
},
|
|
362
|
-
trim() {
|
|
363
|
-
return this.check(checks.trim());
|
|
364
|
-
},
|
|
365
|
-
normalize(...args) {
|
|
366
|
-
return this.check(checks.normalize(...args));
|
|
367
|
-
},
|
|
368
|
-
toLowerCase() {
|
|
369
|
-
return this.check(checks.toLowerCase());
|
|
370
|
-
},
|
|
371
|
-
toUpperCase() {
|
|
372
|
-
return this.check(checks.toUpperCase());
|
|
373
|
-
},
|
|
374
|
-
slugify() {
|
|
375
|
-
return this.check(checks.slugify());
|
|
376
|
-
},
|
|
377
|
-
});
|
|
229
|
+
// validations
|
|
230
|
+
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
231
|
+
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
232
|
+
inst.startsWith = (...args) => inst.check(checks.startsWith(...args));
|
|
233
|
+
inst.endsWith = (...args) => inst.check(checks.endsWith(...args));
|
|
234
|
+
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
235
|
+
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
236
|
+
inst.length = (...args) => inst.check(checks.length(...args));
|
|
237
|
+
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
238
|
+
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
239
|
+
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
240
|
+
// transforms
|
|
241
|
+
inst.trim = () => inst.check(checks.trim());
|
|
242
|
+
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
243
|
+
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
244
|
+
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
245
|
+
inst.slugify = () => inst.check(checks.slugify());
|
|
378
246
|
});
|
|
379
247
|
exports.ZodString = core.$constructor("ZodString", (inst, def) => {
|
|
380
248
|
core.$ZodString.init(inst, def);
|
|
@@ -460,7 +328,7 @@ function url(params) {
|
|
|
460
328
|
}
|
|
461
329
|
function httpUrl(params) {
|
|
462
330
|
return core._url(exports.ZodURL, {
|
|
463
|
-
protocol:
|
|
331
|
+
protocol: /^https?$/,
|
|
464
332
|
hostname: core.regexes.domain,
|
|
465
333
|
...index_js_1.util.normalizeParams(params),
|
|
466
334
|
});
|
|
@@ -481,23 +349,11 @@ exports.ZodNanoID = core.$constructor("ZodNanoID", (inst, def) => {
|
|
|
481
349
|
function nanoid(params) {
|
|
482
350
|
return core._nanoid(exports.ZodNanoID, params);
|
|
483
351
|
}
|
|
484
|
-
/**
|
|
485
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
486
|
-
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
487
|
-
* See https://github.com/paralleldrive/cuid.
|
|
488
|
-
*/
|
|
489
352
|
exports.ZodCUID = core.$constructor("ZodCUID", (inst, def) => {
|
|
490
353
|
// ZodStringFormat.init(inst, def);
|
|
491
354
|
core.$ZodCUID.init(inst, def);
|
|
492
355
|
exports.ZodStringFormat.init(inst, def);
|
|
493
356
|
});
|
|
494
|
-
/**
|
|
495
|
-
* Validates a CUID v1 string.
|
|
496
|
-
*
|
|
497
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
498
|
-
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
499
|
-
* See https://github.com/paralleldrive/cuid.
|
|
500
|
-
*/
|
|
501
357
|
function cuid(params) {
|
|
502
358
|
return core._cuid(exports.ZodCUID, params);
|
|
503
359
|
}
|
|
@@ -629,53 +485,22 @@ exports.ZodNumber = core.$constructor("ZodNumber", (inst, def) => {
|
|
|
629
485
|
core.$ZodNumber.init(inst, def);
|
|
630
486
|
exports.ZodType.init(inst, def);
|
|
631
487
|
inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
max(value, params) {
|
|
649
|
-
return this.check(checks.lte(value, params));
|
|
650
|
-
},
|
|
651
|
-
int(params) {
|
|
652
|
-
return this.check(int(params));
|
|
653
|
-
},
|
|
654
|
-
safe(params) {
|
|
655
|
-
return this.check(int(params));
|
|
656
|
-
},
|
|
657
|
-
positive(params) {
|
|
658
|
-
return this.check(checks.gt(0, params));
|
|
659
|
-
},
|
|
660
|
-
nonnegative(params) {
|
|
661
|
-
return this.check(checks.gte(0, params));
|
|
662
|
-
},
|
|
663
|
-
negative(params) {
|
|
664
|
-
return this.check(checks.lt(0, params));
|
|
665
|
-
},
|
|
666
|
-
nonpositive(params) {
|
|
667
|
-
return this.check(checks.lte(0, params));
|
|
668
|
-
},
|
|
669
|
-
multipleOf(value, params) {
|
|
670
|
-
return this.check(checks.multipleOf(value, params));
|
|
671
|
-
},
|
|
672
|
-
step(value, params) {
|
|
673
|
-
return this.check(checks.multipleOf(value, params));
|
|
674
|
-
},
|
|
675
|
-
finite() {
|
|
676
|
-
return this;
|
|
677
|
-
},
|
|
678
|
-
});
|
|
488
|
+
inst.gt = (value, params) => inst.check(checks.gt(value, params));
|
|
489
|
+
inst.gte = (value, params) => inst.check(checks.gte(value, params));
|
|
490
|
+
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
491
|
+
inst.lt = (value, params) => inst.check(checks.lt(value, params));
|
|
492
|
+
inst.lte = (value, params) => inst.check(checks.lte(value, params));
|
|
493
|
+
inst.max = (value, params) => inst.check(checks.lte(value, params));
|
|
494
|
+
inst.int = (params) => inst.check(int(params));
|
|
495
|
+
inst.safe = (params) => inst.check(int(params));
|
|
496
|
+
inst.positive = (params) => inst.check(checks.gt(0, params));
|
|
497
|
+
inst.nonnegative = (params) => inst.check(checks.gte(0, params));
|
|
498
|
+
inst.negative = (params) => inst.check(checks.lt(0, params));
|
|
499
|
+
inst.nonpositive = (params) => inst.check(checks.lte(0, params));
|
|
500
|
+
inst.multipleOf = (value, params) => inst.check(checks.multipleOf(value, params));
|
|
501
|
+
inst.step = (value, params) => inst.check(checks.multipleOf(value, params));
|
|
502
|
+
// inst.finite = (params) => inst.check(core.finite(params));
|
|
503
|
+
inst.finite = () => inst;
|
|
679
504
|
const bag = inst._zod.bag;
|
|
680
505
|
inst.minValue =
|
|
681
506
|
Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
@@ -826,23 +651,11 @@ exports.ZodArray = core.$constructor("ZodArray", (inst, def) => {
|
|
|
826
651
|
exports.ZodType.init(inst, def);
|
|
827
652
|
inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);
|
|
828
653
|
inst.element = def.element;
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
return this.check(checks.minLength(1, params));
|
|
835
|
-
},
|
|
836
|
-
max(n, params) {
|
|
837
|
-
return this.check(checks.maxLength(n, params));
|
|
838
|
-
},
|
|
839
|
-
length(n, params) {
|
|
840
|
-
return this.check(checks.length(n, params));
|
|
841
|
-
},
|
|
842
|
-
unwrap() {
|
|
843
|
-
return this.element;
|
|
844
|
-
},
|
|
845
|
-
});
|
|
654
|
+
inst.min = (minLength, params) => inst.check(checks.minLength(minLength, params));
|
|
655
|
+
inst.nonempty = (params) => inst.check(checks.minLength(1, params));
|
|
656
|
+
inst.max = (maxLength, params) => inst.check(checks.maxLength(maxLength, params));
|
|
657
|
+
inst.length = (len, params) => inst.check(checks.length(len, params));
|
|
658
|
+
inst.unwrap = () => inst.element;
|
|
846
659
|
});
|
|
847
660
|
function array(element, params) {
|
|
848
661
|
return core._array(exports.ZodArray, element, params);
|
|
@@ -859,47 +672,23 @@ exports.ZodObject = core.$constructor("ZodObject", (inst, def) => {
|
|
|
859
672
|
index_js_1.util.defineLazy(inst, "shape", () => {
|
|
860
673
|
return def.shape;
|
|
861
674
|
});
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
return this.clone({ ...this._zod.def, catchall: undefined });
|
|
880
|
-
},
|
|
881
|
-
extend(incoming) {
|
|
882
|
-
return index_js_1.util.extend(this, incoming);
|
|
883
|
-
},
|
|
884
|
-
safeExtend(incoming) {
|
|
885
|
-
return index_js_1.util.safeExtend(this, incoming);
|
|
886
|
-
},
|
|
887
|
-
merge(other) {
|
|
888
|
-
return index_js_1.util.merge(this, other);
|
|
889
|
-
},
|
|
890
|
-
pick(mask) {
|
|
891
|
-
return index_js_1.util.pick(this, mask);
|
|
892
|
-
},
|
|
893
|
-
omit(mask) {
|
|
894
|
-
return index_js_1.util.omit(this, mask);
|
|
895
|
-
},
|
|
896
|
-
partial(...args) {
|
|
897
|
-
return index_js_1.util.partial(exports.ZodOptional, this, args[0]);
|
|
898
|
-
},
|
|
899
|
-
required(...args) {
|
|
900
|
-
return index_js_1.util.required(exports.ZodNonOptional, this, args[0]);
|
|
901
|
-
},
|
|
902
|
-
});
|
|
675
|
+
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
676
|
+
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
|
|
677
|
+
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
678
|
+
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
679
|
+
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
680
|
+
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
|
|
681
|
+
inst.extend = (incoming) => {
|
|
682
|
+
return index_js_1.util.extend(inst, incoming);
|
|
683
|
+
};
|
|
684
|
+
inst.safeExtend = (incoming) => {
|
|
685
|
+
return index_js_1.util.safeExtend(inst, incoming);
|
|
686
|
+
};
|
|
687
|
+
inst.merge = (other) => index_js_1.util.merge(inst, other);
|
|
688
|
+
inst.pick = (mask) => index_js_1.util.pick(inst, mask);
|
|
689
|
+
inst.omit = (mask) => index_js_1.util.omit(inst, mask);
|
|
690
|
+
inst.partial = (...args) => index_js_1.util.partial(exports.ZodOptional, inst, args[0]);
|
|
691
|
+
inst.required = (...args) => index_js_1.util.required(exports.ZodNonOptional, inst, args[0]);
|
|
903
692
|
});
|
|
904
693
|
function object(shape, params) {
|
|
905
694
|
const def = {
|
|
@@ -1010,15 +799,6 @@ exports.ZodRecord = core.$constructor("ZodRecord", (inst, def) => {
|
|
|
1010
799
|
inst.valueType = def.valueType;
|
|
1011
800
|
});
|
|
1012
801
|
function record(keyType, valueType, params) {
|
|
1013
|
-
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
|
|
1014
|
-
if (!valueType || !valueType._zod) {
|
|
1015
|
-
return new exports.ZodRecord({
|
|
1016
|
-
type: "record",
|
|
1017
|
-
keyType: string(),
|
|
1018
|
-
valueType: keyType,
|
|
1019
|
-
...index_js_1.util.normalizeParams(valueType),
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
802
|
return new exports.ZodRecord({
|
|
1023
803
|
type: "record",
|
|
1024
804
|
keyType,
|
|
@@ -1203,12 +983,10 @@ exports.ZodTransform = core.$constructor("ZodTransform", (inst, def) => {
|
|
|
1203
983
|
if (output instanceof Promise) {
|
|
1204
984
|
return output.then((output) => {
|
|
1205
985
|
payload.value = output;
|
|
1206
|
-
payload.fallback = true;
|
|
1207
986
|
return payload;
|
|
1208
987
|
});
|
|
1209
988
|
}
|
|
1210
989
|
payload.value = output;
|
|
1211
|
-
payload.fallback = true;
|
|
1212
990
|
return payload;
|
|
1213
991
|
};
|
|
1214
992
|
});
|
|
@@ -1364,20 +1142,6 @@ function codec(in_, out, params) {
|
|
|
1364
1142
|
reverseTransform: params.encode,
|
|
1365
1143
|
});
|
|
1366
1144
|
}
|
|
1367
|
-
function invertCodec(codec) {
|
|
1368
|
-
const def = codec._zod.def;
|
|
1369
|
-
return new exports.ZodCodec({
|
|
1370
|
-
type: "pipe",
|
|
1371
|
-
in: def.out,
|
|
1372
|
-
out: def.in,
|
|
1373
|
-
transform: def.reverseTransform,
|
|
1374
|
-
reverseTransform: def.transform,
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
exports.ZodPreprocess = core.$constructor("ZodPreprocess", (inst, def) => {
|
|
1378
|
-
exports.ZodPipe.init(inst, def);
|
|
1379
|
-
core.$ZodPreprocess.init(inst, def);
|
|
1380
|
-
});
|
|
1381
1145
|
exports.ZodReadonly = core.$constructor("ZodReadonly", (inst, def) => {
|
|
1382
1146
|
core.$ZodReadonly.init(inst, def);
|
|
1383
1147
|
exports.ZodType.init(inst, def);
|
|
@@ -1459,8 +1223,8 @@ function refine(fn, _params = {}) {
|
|
|
1459
1223
|
return core._refine(exports.ZodCustom, fn, _params);
|
|
1460
1224
|
}
|
|
1461
1225
|
// superRefine
|
|
1462
|
-
function superRefine(fn
|
|
1463
|
-
return core._superRefine(fn
|
|
1226
|
+
function superRefine(fn) {
|
|
1227
|
+
return core._superRefine(fn);
|
|
1464
1228
|
}
|
|
1465
1229
|
// Re-export describe and meta from core
|
|
1466
1230
|
exports.describe = core.describe;
|
|
@@ -1502,10 +1266,7 @@ function json(params) {
|
|
|
1502
1266
|
return jsonSchema;
|
|
1503
1267
|
}
|
|
1504
1268
|
// preprocess
|
|
1269
|
+
// /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
|
|
1505
1270
|
function preprocess(fn, schema) {
|
|
1506
|
-
return
|
|
1507
|
-
type: "pipe",
|
|
1508
|
-
in: transform(fn),
|
|
1509
|
-
out: schema,
|
|
1510
|
-
});
|
|
1271
|
+
return pipe(transform(fn), schema);
|
|
1511
1272
|
}
|