@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
|
@@ -5,54 +5,6 @@ import { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from "../cor
|
|
|
5
5
|
import * as checks from "./checks.js";
|
|
6
6
|
import * as iso from "./iso.js";
|
|
7
7
|
import * as parse from "./parse.js";
|
|
8
|
-
// Lazy-bind builder methods.
|
|
9
|
-
//
|
|
10
|
-
// Builder methods (`.optional`, `.array`, `.refine`, ...) live as
|
|
11
|
-
// non-enumerable getters on each concrete schema constructor's
|
|
12
|
-
// prototype. On first access from an instance the getter allocates
|
|
13
|
-
// `fn.bind(this)` and caches it as an own property on that instance,
|
|
14
|
-
// so detached usage (`const m = schema.optional; m()`) still works
|
|
15
|
-
// and the per-instance allocation only happens for methods actually
|
|
16
|
-
// touched.
|
|
17
|
-
//
|
|
18
|
-
// One install per (prototype, group), memoized by `_installedGroups`.
|
|
19
|
-
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
20
|
-
function _installLazyMethods(inst, group, methods) {
|
|
21
|
-
const proto = Object.getPrototypeOf(inst);
|
|
22
|
-
let installed = _installedGroups.get(proto);
|
|
23
|
-
if (!installed) {
|
|
24
|
-
installed = new Set();
|
|
25
|
-
_installedGroups.set(proto, installed);
|
|
26
|
-
}
|
|
27
|
-
if (installed.has(group))
|
|
28
|
-
return;
|
|
29
|
-
installed.add(group);
|
|
30
|
-
for (const key in methods) {
|
|
31
|
-
const fn = methods[key];
|
|
32
|
-
Object.defineProperty(proto, key, {
|
|
33
|
-
configurable: true,
|
|
34
|
-
enumerable: false,
|
|
35
|
-
get() {
|
|
36
|
-
const bound = fn.bind(this);
|
|
37
|
-
Object.defineProperty(this, key, {
|
|
38
|
-
configurable: true,
|
|
39
|
-
writable: true,
|
|
40
|
-
enumerable: true,
|
|
41
|
-
value: bound,
|
|
42
|
-
});
|
|
43
|
-
return bound;
|
|
44
|
-
},
|
|
45
|
-
set(v) {
|
|
46
|
-
Object.defineProperty(this, key, {
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
enumerable: true,
|
|
50
|
-
value: v,
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
8
|
export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) => {
|
|
57
9
|
core.$ZodType.init(inst, def);
|
|
58
10
|
Object.assign(inst["~standard"], {
|
|
@@ -65,16 +17,31 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
|
|
|
65
17
|
inst.def = def;
|
|
66
18
|
inst.type = def.type;
|
|
67
19
|
Object.defineProperty(inst, "_def", { value: def });
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
20
|
+
// base methods
|
|
21
|
+
inst.check = (...checks) => {
|
|
22
|
+
return inst.clone(util.mergeDefs(def, {
|
|
23
|
+
checks: [
|
|
24
|
+
...(def.checks ?? []),
|
|
25
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
26
|
+
],
|
|
27
|
+
}), {
|
|
28
|
+
parent: true,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
inst.with = inst.check;
|
|
32
|
+
inst.clone = (def, params) => core.clone(inst, def, params);
|
|
33
|
+
inst.brand = () => inst;
|
|
34
|
+
inst.register = ((reg, meta) => {
|
|
35
|
+
reg.add(inst, meta);
|
|
36
|
+
return inst;
|
|
37
|
+
});
|
|
38
|
+
// parsing
|
|
73
39
|
inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
|
|
74
40
|
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
|
|
75
41
|
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
76
42
|
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
|
77
43
|
inst.spa = inst.safeParseAsync;
|
|
44
|
+
// encoding/decoding
|
|
78
45
|
inst.encode = (data, params) => parse.encode(inst, data, params);
|
|
79
46
|
inst.decode = (data, params) => parse.decode(inst, data, params);
|
|
80
47
|
inst.encodeAsync = async (data, params) => parse.encodeAsync(inst, data, params);
|
|
@@ -83,118 +50,50 @@ export const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) =>
|
|
|
83
50
|
inst.safeDecode = (data, params) => parse.safeDecode(inst, data, params);
|
|
84
51
|
inst.safeEncodeAsync = async (data, params) => parse.safeEncodeAsync(inst, data, params);
|
|
85
52
|
inst.safeDecodeAsync = async (data, params) => parse.safeDecodeAsync(inst, data, params);
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
reg.add(this, meta);
|
|
113
|
-
return this;
|
|
114
|
-
},
|
|
115
|
-
refine(check, params) {
|
|
116
|
-
return this.check(refine(check, params));
|
|
117
|
-
},
|
|
118
|
-
superRefine(refinement, params) {
|
|
119
|
-
return this.check(superRefine(refinement, params));
|
|
120
|
-
},
|
|
121
|
-
overwrite(fn) {
|
|
122
|
-
return this.check(checks.overwrite(fn));
|
|
123
|
-
},
|
|
124
|
-
optional() {
|
|
125
|
-
return optional(this);
|
|
126
|
-
},
|
|
127
|
-
exactOptional() {
|
|
128
|
-
return exactOptional(this);
|
|
129
|
-
},
|
|
130
|
-
nullable() {
|
|
131
|
-
return nullable(this);
|
|
132
|
-
},
|
|
133
|
-
nullish() {
|
|
134
|
-
return optional(nullable(this));
|
|
135
|
-
},
|
|
136
|
-
nonoptional(params) {
|
|
137
|
-
return nonoptional(this, params);
|
|
138
|
-
},
|
|
139
|
-
array() {
|
|
140
|
-
return array(this);
|
|
141
|
-
},
|
|
142
|
-
or(arg) {
|
|
143
|
-
return union([this, arg]);
|
|
144
|
-
},
|
|
145
|
-
and(arg) {
|
|
146
|
-
return intersection(this, arg);
|
|
147
|
-
},
|
|
148
|
-
transform(tx) {
|
|
149
|
-
return pipe(this, transform(tx));
|
|
150
|
-
},
|
|
151
|
-
default(d) {
|
|
152
|
-
return _default(this, d);
|
|
153
|
-
},
|
|
154
|
-
prefault(d) {
|
|
155
|
-
return prefault(this, d);
|
|
156
|
-
},
|
|
157
|
-
catch(params) {
|
|
158
|
-
return _catch(this, params);
|
|
159
|
-
},
|
|
160
|
-
pipe(target) {
|
|
161
|
-
return pipe(this, target);
|
|
162
|
-
},
|
|
163
|
-
readonly() {
|
|
164
|
-
return readonly(this);
|
|
165
|
-
},
|
|
166
|
-
describe(description) {
|
|
167
|
-
const cl = this.clone();
|
|
168
|
-
core.globalRegistry.add(cl, { description });
|
|
169
|
-
return cl;
|
|
170
|
-
},
|
|
171
|
-
meta(...args) {
|
|
172
|
-
// overloaded: meta() returns the registered metadata, meta(data)
|
|
173
|
-
// returns a clone with `data` registered. The mapped type picks
|
|
174
|
-
// up the second overload, so we accept variadic any-args and
|
|
175
|
-
// return `any` to satisfy both at runtime.
|
|
176
|
-
if (args.length === 0)
|
|
177
|
-
return core.globalRegistry.get(this);
|
|
178
|
-
const cl = this.clone();
|
|
179
|
-
core.globalRegistry.add(cl, args[0]);
|
|
180
|
-
return cl;
|
|
181
|
-
},
|
|
182
|
-
isOptional() {
|
|
183
|
-
return this.safeParse(undefined).success;
|
|
184
|
-
},
|
|
185
|
-
isNullable() {
|
|
186
|
-
return this.safeParse(null).success;
|
|
187
|
-
},
|
|
188
|
-
apply(fn) {
|
|
189
|
-
return fn(this);
|
|
190
|
-
},
|
|
191
|
-
});
|
|
53
|
+
// refinements
|
|
54
|
+
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
55
|
+
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
56
|
+
inst.overwrite = (fn) => inst.check(checks.overwrite(fn));
|
|
57
|
+
// wrappers
|
|
58
|
+
inst.optional = () => optional(inst);
|
|
59
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
60
|
+
inst.nullable = () => nullable(inst);
|
|
61
|
+
inst.nullish = () => optional(nullable(inst));
|
|
62
|
+
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
63
|
+
inst.array = () => array(inst);
|
|
64
|
+
inst.or = (arg) => union([inst, arg]);
|
|
65
|
+
inst.and = (arg) => intersection(inst, arg);
|
|
66
|
+
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
67
|
+
inst.default = (def) => _default(inst, def);
|
|
68
|
+
inst.prefault = (def) => prefault(inst, def);
|
|
69
|
+
// inst.coalesce = (def, params) => coalesce(inst, def, params);
|
|
70
|
+
inst.catch = (params) => _catch(inst, params);
|
|
71
|
+
inst.pipe = (target) => pipe(inst, target);
|
|
72
|
+
inst.readonly = () => readonly(inst);
|
|
73
|
+
// meta
|
|
74
|
+
inst.describe = (description) => {
|
|
75
|
+
const cl = inst.clone();
|
|
76
|
+
core.globalRegistry.add(cl, { description });
|
|
77
|
+
return cl;
|
|
78
|
+
};
|
|
192
79
|
Object.defineProperty(inst, "description", {
|
|
193
80
|
get() {
|
|
194
81
|
return core.globalRegistry.get(inst)?.description;
|
|
195
82
|
},
|
|
196
83
|
configurable: true,
|
|
197
84
|
});
|
|
85
|
+
inst.meta = (...args) => {
|
|
86
|
+
if (args.length === 0) {
|
|
87
|
+
return core.globalRegistry.get(inst);
|
|
88
|
+
}
|
|
89
|
+
const cl = inst.clone();
|
|
90
|
+
core.globalRegistry.add(cl, args[0]);
|
|
91
|
+
return cl;
|
|
92
|
+
};
|
|
93
|
+
// helpers
|
|
94
|
+
inst.isOptional = () => inst.safeParse(undefined).success;
|
|
95
|
+
inst.isNullable = () => inst.safeParse(null).success;
|
|
96
|
+
inst.apply = (fn) => fn(inst);
|
|
198
97
|
return inst;
|
|
199
98
|
});
|
|
200
99
|
/** @internal */
|
|
@@ -206,53 +105,23 @@ export const _ZodString = /*@__PURE__*/ core.$constructor("_ZodString", (inst, d
|
|
|
206
105
|
inst.format = bag.format ?? null;
|
|
207
106
|
inst.minLength = bag.minimum ?? null;
|
|
208
107
|
inst.maxLength = bag.maximum ?? null;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return this.check(checks.maxLength(...args));
|
|
227
|
-
},
|
|
228
|
-
length(...args) {
|
|
229
|
-
return this.check(checks.length(...args));
|
|
230
|
-
},
|
|
231
|
-
nonempty(...args) {
|
|
232
|
-
return this.check(checks.minLength(1, ...args));
|
|
233
|
-
},
|
|
234
|
-
lowercase(params) {
|
|
235
|
-
return this.check(checks.lowercase(params));
|
|
236
|
-
},
|
|
237
|
-
uppercase(params) {
|
|
238
|
-
return this.check(checks.uppercase(params));
|
|
239
|
-
},
|
|
240
|
-
trim() {
|
|
241
|
-
return this.check(checks.trim());
|
|
242
|
-
},
|
|
243
|
-
normalize(...args) {
|
|
244
|
-
return this.check(checks.normalize(...args));
|
|
245
|
-
},
|
|
246
|
-
toLowerCase() {
|
|
247
|
-
return this.check(checks.toLowerCase());
|
|
248
|
-
},
|
|
249
|
-
toUpperCase() {
|
|
250
|
-
return this.check(checks.toUpperCase());
|
|
251
|
-
},
|
|
252
|
-
slugify() {
|
|
253
|
-
return this.check(checks.slugify());
|
|
254
|
-
},
|
|
255
|
-
});
|
|
108
|
+
// validations
|
|
109
|
+
inst.regex = (...args) => inst.check(checks.regex(...args));
|
|
110
|
+
inst.includes = (...args) => inst.check(checks.includes(...args));
|
|
111
|
+
inst.startsWith = (...args) => inst.check(checks.startsWith(...args));
|
|
112
|
+
inst.endsWith = (...args) => inst.check(checks.endsWith(...args));
|
|
113
|
+
inst.min = (...args) => inst.check(checks.minLength(...args));
|
|
114
|
+
inst.max = (...args) => inst.check(checks.maxLength(...args));
|
|
115
|
+
inst.length = (...args) => inst.check(checks.length(...args));
|
|
116
|
+
inst.nonempty = (...args) => inst.check(checks.minLength(1, ...args));
|
|
117
|
+
inst.lowercase = (params) => inst.check(checks.lowercase(params));
|
|
118
|
+
inst.uppercase = (params) => inst.check(checks.uppercase(params));
|
|
119
|
+
// transforms
|
|
120
|
+
inst.trim = () => inst.check(checks.trim());
|
|
121
|
+
inst.normalize = (...args) => inst.check(checks.normalize(...args));
|
|
122
|
+
inst.toLowerCase = () => inst.check(checks.toLowerCase());
|
|
123
|
+
inst.toUpperCase = () => inst.check(checks.toUpperCase());
|
|
124
|
+
inst.slugify = () => inst.check(checks.slugify());
|
|
256
125
|
});
|
|
257
126
|
export const ZodString = /*@__PURE__*/ core.$constructor("ZodString", (inst, def) => {
|
|
258
127
|
core.$ZodString.init(inst, def);
|
|
@@ -338,7 +207,7 @@ export function url(params) {
|
|
|
338
207
|
}
|
|
339
208
|
export function httpUrl(params) {
|
|
340
209
|
return core._url(ZodURL, {
|
|
341
|
-
protocol:
|
|
210
|
+
protocol: /^https?$/,
|
|
342
211
|
hostname: core.regexes.domain,
|
|
343
212
|
...util.normalizeParams(params),
|
|
344
213
|
});
|
|
@@ -359,23 +228,11 @@ export const ZodNanoID = /*@__PURE__*/ core.$constructor("ZodNanoID", (inst, def
|
|
|
359
228
|
export function nanoid(params) {
|
|
360
229
|
return core._nanoid(ZodNanoID, params);
|
|
361
230
|
}
|
|
362
|
-
/**
|
|
363
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
364
|
-
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
365
|
-
* See https://github.com/paralleldrive/cuid.
|
|
366
|
-
*/
|
|
367
231
|
export const ZodCUID = /*@__PURE__*/ core.$constructor("ZodCUID", (inst, def) => {
|
|
368
232
|
// ZodStringFormat.init(inst, def);
|
|
369
233
|
core.$ZodCUID.init(inst, def);
|
|
370
234
|
ZodStringFormat.init(inst, def);
|
|
371
235
|
});
|
|
372
|
-
/**
|
|
373
|
-
* Validates a CUID v1 string.
|
|
374
|
-
*
|
|
375
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
376
|
-
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
377
|
-
* See https://github.com/paralleldrive/cuid.
|
|
378
|
-
*/
|
|
379
236
|
export function cuid(params) {
|
|
380
237
|
return core._cuid(ZodCUID, params);
|
|
381
238
|
}
|
|
@@ -507,53 +364,22 @@ export const ZodNumber = /*@__PURE__*/ core.$constructor("ZodNumber", (inst, def
|
|
|
507
364
|
core.$ZodNumber.init(inst, def);
|
|
508
365
|
ZodType.init(inst, def);
|
|
509
366
|
inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
max(value, params) {
|
|
527
|
-
return this.check(checks.lte(value, params));
|
|
528
|
-
},
|
|
529
|
-
int(params) {
|
|
530
|
-
return this.check(int(params));
|
|
531
|
-
},
|
|
532
|
-
safe(params) {
|
|
533
|
-
return this.check(int(params));
|
|
534
|
-
},
|
|
535
|
-
positive(params) {
|
|
536
|
-
return this.check(checks.gt(0, params));
|
|
537
|
-
},
|
|
538
|
-
nonnegative(params) {
|
|
539
|
-
return this.check(checks.gte(0, params));
|
|
540
|
-
},
|
|
541
|
-
negative(params) {
|
|
542
|
-
return this.check(checks.lt(0, params));
|
|
543
|
-
},
|
|
544
|
-
nonpositive(params) {
|
|
545
|
-
return this.check(checks.lte(0, params));
|
|
546
|
-
},
|
|
547
|
-
multipleOf(value, params) {
|
|
548
|
-
return this.check(checks.multipleOf(value, params));
|
|
549
|
-
},
|
|
550
|
-
step(value, params) {
|
|
551
|
-
return this.check(checks.multipleOf(value, params));
|
|
552
|
-
},
|
|
553
|
-
finite() {
|
|
554
|
-
return this;
|
|
555
|
-
},
|
|
556
|
-
});
|
|
367
|
+
inst.gt = (value, params) => inst.check(checks.gt(value, params));
|
|
368
|
+
inst.gte = (value, params) => inst.check(checks.gte(value, params));
|
|
369
|
+
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
370
|
+
inst.lt = (value, params) => inst.check(checks.lt(value, params));
|
|
371
|
+
inst.lte = (value, params) => inst.check(checks.lte(value, params));
|
|
372
|
+
inst.max = (value, params) => inst.check(checks.lte(value, params));
|
|
373
|
+
inst.int = (params) => inst.check(int(params));
|
|
374
|
+
inst.safe = (params) => inst.check(int(params));
|
|
375
|
+
inst.positive = (params) => inst.check(checks.gt(0, params));
|
|
376
|
+
inst.nonnegative = (params) => inst.check(checks.gte(0, params));
|
|
377
|
+
inst.negative = (params) => inst.check(checks.lt(0, params));
|
|
378
|
+
inst.nonpositive = (params) => inst.check(checks.lte(0, params));
|
|
379
|
+
inst.multipleOf = (value, params) => inst.check(checks.multipleOf(value, params));
|
|
380
|
+
inst.step = (value, params) => inst.check(checks.multipleOf(value, params));
|
|
381
|
+
// inst.finite = (params) => inst.check(core.finite(params));
|
|
382
|
+
inst.finite = () => inst;
|
|
557
383
|
const bag = inst._zod.bag;
|
|
558
384
|
inst.minValue =
|
|
559
385
|
Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
@@ -707,23 +533,11 @@ export const ZodArray = /*@__PURE__*/ core.$constructor("ZodArray", (inst, def)
|
|
|
707
533
|
ZodType.init(inst, def);
|
|
708
534
|
inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);
|
|
709
535
|
inst.element = def.element;
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
return this.check(checks.minLength(1, params));
|
|
716
|
-
},
|
|
717
|
-
max(n, params) {
|
|
718
|
-
return this.check(checks.maxLength(n, params));
|
|
719
|
-
},
|
|
720
|
-
length(n, params) {
|
|
721
|
-
return this.check(checks.length(n, params));
|
|
722
|
-
},
|
|
723
|
-
unwrap() {
|
|
724
|
-
return this.element;
|
|
725
|
-
},
|
|
726
|
-
});
|
|
536
|
+
inst.min = (minLength, params) => inst.check(checks.minLength(minLength, params));
|
|
537
|
+
inst.nonempty = (params) => inst.check(checks.minLength(1, params));
|
|
538
|
+
inst.max = (maxLength, params) => inst.check(checks.maxLength(maxLength, params));
|
|
539
|
+
inst.length = (len, params) => inst.check(checks.length(len, params));
|
|
540
|
+
inst.unwrap = () => inst.element;
|
|
727
541
|
});
|
|
728
542
|
export function array(element, params) {
|
|
729
543
|
return core._array(ZodArray, element, params);
|
|
@@ -740,47 +554,23 @@ export const ZodObject = /*@__PURE__*/ core.$constructor("ZodObject", (inst, def
|
|
|
740
554
|
util.defineLazy(inst, "shape", () => {
|
|
741
555
|
return def.shape;
|
|
742
556
|
});
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
return this.clone({ ...this._zod.def, catchall: undefined });
|
|
761
|
-
},
|
|
762
|
-
extend(incoming) {
|
|
763
|
-
return util.extend(this, incoming);
|
|
764
|
-
},
|
|
765
|
-
safeExtend(incoming) {
|
|
766
|
-
return util.safeExtend(this, incoming);
|
|
767
|
-
},
|
|
768
|
-
merge(other) {
|
|
769
|
-
return util.merge(this, other);
|
|
770
|
-
},
|
|
771
|
-
pick(mask) {
|
|
772
|
-
return util.pick(this, mask);
|
|
773
|
-
},
|
|
774
|
-
omit(mask) {
|
|
775
|
-
return util.omit(this, mask);
|
|
776
|
-
},
|
|
777
|
-
partial(...args) {
|
|
778
|
-
return util.partial(ZodOptional, this, args[0]);
|
|
779
|
-
},
|
|
780
|
-
required(...args) {
|
|
781
|
-
return util.required(ZodNonOptional, this, args[0]);
|
|
782
|
-
},
|
|
783
|
-
});
|
|
557
|
+
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
558
|
+
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
|
|
559
|
+
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
560
|
+
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
561
|
+
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
562
|
+
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
|
|
563
|
+
inst.extend = (incoming) => {
|
|
564
|
+
return util.extend(inst, incoming);
|
|
565
|
+
};
|
|
566
|
+
inst.safeExtend = (incoming) => {
|
|
567
|
+
return util.safeExtend(inst, incoming);
|
|
568
|
+
};
|
|
569
|
+
inst.merge = (other) => util.merge(inst, other);
|
|
570
|
+
inst.pick = (mask) => util.pick(inst, mask);
|
|
571
|
+
inst.omit = (mask) => util.omit(inst, mask);
|
|
572
|
+
inst.partial = (...args) => util.partial(ZodOptional, inst, args[0]);
|
|
573
|
+
inst.required = (...args) => util.required(ZodNonOptional, inst, args[0]);
|
|
784
574
|
});
|
|
785
575
|
export function object(shape, params) {
|
|
786
576
|
const def = {
|
|
@@ -891,15 +681,6 @@ export const ZodRecord = /*@__PURE__*/ core.$constructor("ZodRecord", (inst, def
|
|
|
891
681
|
inst.valueType = def.valueType;
|
|
892
682
|
});
|
|
893
683
|
export function record(keyType, valueType, params) {
|
|
894
|
-
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
|
|
895
|
-
if (!valueType || !valueType._zod) {
|
|
896
|
-
return new ZodRecord({
|
|
897
|
-
type: "record",
|
|
898
|
-
keyType: string(),
|
|
899
|
-
valueType: keyType,
|
|
900
|
-
...util.normalizeParams(valueType),
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
684
|
return new ZodRecord({
|
|
904
685
|
type: "record",
|
|
905
686
|
keyType,
|
|
@@ -1085,12 +866,10 @@ export const ZodTransform = /*@__PURE__*/ core.$constructor("ZodTransform", (ins
|
|
|
1085
866
|
if (output instanceof Promise) {
|
|
1086
867
|
return output.then((output) => {
|
|
1087
868
|
payload.value = output;
|
|
1088
|
-
payload.fallback = true;
|
|
1089
869
|
return payload;
|
|
1090
870
|
});
|
|
1091
871
|
}
|
|
1092
872
|
payload.value = output;
|
|
1093
|
-
payload.fallback = true;
|
|
1094
873
|
return payload;
|
|
1095
874
|
};
|
|
1096
875
|
});
|
|
@@ -1247,20 +1026,6 @@ export function codec(in_, out, params) {
|
|
|
1247
1026
|
reverseTransform: params.encode,
|
|
1248
1027
|
});
|
|
1249
1028
|
}
|
|
1250
|
-
export function invertCodec(codec) {
|
|
1251
|
-
const def = codec._zod.def;
|
|
1252
|
-
return new ZodCodec({
|
|
1253
|
-
type: "pipe",
|
|
1254
|
-
in: def.out,
|
|
1255
|
-
out: def.in,
|
|
1256
|
-
transform: def.reverseTransform,
|
|
1257
|
-
reverseTransform: def.transform,
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
export const ZodPreprocess = /*@__PURE__*/ core.$constructor("ZodPreprocess", (inst, def) => {
|
|
1261
|
-
ZodPipe.init(inst, def);
|
|
1262
|
-
core.$ZodPreprocess.init(inst, def);
|
|
1263
|
-
});
|
|
1264
1029
|
export const ZodReadonly = /*@__PURE__*/ core.$constructor("ZodReadonly", (inst, def) => {
|
|
1265
1030
|
core.$ZodReadonly.init(inst, def);
|
|
1266
1031
|
ZodType.init(inst, def);
|
|
@@ -1343,8 +1108,8 @@ export function refine(fn, _params = {}) {
|
|
|
1343
1108
|
return core._refine(ZodCustom, fn, _params);
|
|
1344
1109
|
}
|
|
1345
1110
|
// superRefine
|
|
1346
|
-
export function superRefine(fn
|
|
1347
|
-
return core._superRefine(fn
|
|
1111
|
+
export function superRefine(fn) {
|
|
1112
|
+
return core._superRefine(fn);
|
|
1348
1113
|
}
|
|
1349
1114
|
// Re-export describe and meta from core
|
|
1350
1115
|
export const describe = core.describe;
|
|
@@ -1386,10 +1151,7 @@ export function json(params) {
|
|
|
1386
1151
|
return jsonSchema;
|
|
1387
1152
|
}
|
|
1388
1153
|
// preprocess
|
|
1154
|
+
// /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
|
|
1389
1155
|
export function preprocess(fn, schema) {
|
|
1390
|
-
return
|
|
1391
|
-
type: "pipe",
|
|
1392
|
-
in: transform(fn),
|
|
1393
|
-
out: schema,
|
|
1394
|
-
});
|
|
1156
|
+
return pipe(transform(fn), schema);
|
|
1395
1157
|
}
|
|
@@ -256,11 +256,6 @@ function _nanoid(Class, params) {
|
|
|
256
256
|
...util.normalizeParams(params),
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
-
/**
|
|
260
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
261
|
-
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
262
|
-
* See https://github.com/paralleldrive/cuid.
|
|
263
|
-
*/
|
|
264
259
|
// @__NO_SIDE_EFFECTS__
|
|
265
260
|
function _cuid(Class, params) {
|
|
266
261
|
return new Class({
|
|
@@ -1099,7 +1094,7 @@ function _refine(Class, fn, _params) {
|
|
|
1099
1094
|
return schema;
|
|
1100
1095
|
}
|
|
1101
1096
|
// @__NO_SIDE_EFFECTS__
|
|
1102
|
-
function _superRefine(fn
|
|
1097
|
+
function _superRefine(fn) {
|
|
1103
1098
|
const ch = _check((payload) => {
|
|
1104
1099
|
payload.addIssue = (issue) => {
|
|
1105
1100
|
if (typeof issue === "string") {
|
|
@@ -1118,7 +1113,7 @@ function _superRefine(fn, params) {
|
|
|
1118
1113
|
}
|
|
1119
1114
|
};
|
|
1120
1115
|
return fn(payload.value, payload);
|
|
1121
|
-
}
|
|
1116
|
+
});
|
|
1122
1117
|
return ch;
|
|
1123
1118
|
}
|
|
1124
1119
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -110,11 +110,6 @@ export function _nanoid(Class, params) {
|
|
|
110
110
|
...util.normalizeParams(params),
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
115
|
-
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
116
|
-
* See https://github.com/paralleldrive/cuid.
|
|
117
|
-
*/
|
|
118
113
|
// @__NO_SIDE_EFFECTS__
|
|
119
114
|
export function _cuid(Class, params) {
|
|
120
115
|
return new Class({
|
|
@@ -959,7 +954,7 @@ export function _refine(Class, fn, _params) {
|
|
|
959
954
|
return schema;
|
|
960
955
|
}
|
|
961
956
|
// @__NO_SIDE_EFFECTS__
|
|
962
|
-
export function _superRefine(fn
|
|
957
|
+
export function _superRefine(fn) {
|
|
963
958
|
const ch = _check((payload) => {
|
|
964
959
|
payload.addIssue = (issue) => {
|
|
965
960
|
if (typeof issue === "string") {
|
|
@@ -978,7 +973,7 @@ export function _superRefine(fn, params) {
|
|
|
978
973
|
}
|
|
979
974
|
};
|
|
980
975
|
return fn(payload.value, payload);
|
|
981
|
-
}
|
|
976
|
+
});
|
|
982
977
|
return ch;
|
|
983
978
|
}
|
|
984
979
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.globalConfig = exports.$ZodEncodeError = exports.$ZodAsyncError = exports.$brand = exports.NEVER = void 0;
|
|
5
4
|
exports.$constructor = $constructor;
|
|
@@ -76,8 +75,7 @@ class $ZodEncodeError extends Error {
|
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
exports.$ZodEncodeError = $ZodEncodeError;
|
|
79
|
-
|
|
80
|
-
exports.globalConfig = globalThis.__zod_globalConfig;
|
|
78
|
+
exports.globalConfig = {};
|
|
81
79
|
function config(newConfig) {
|
|
82
80
|
if (newConfig)
|
|
83
81
|
Object.assign(exports.globalConfig, newConfig);
|