@github/copilot-language-server 1.552.0 → 1.553.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -1
- package/dist/main.js +1021 -1011
- 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
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
/** A special constant with type `never` */
|
|
3
|
-
export const NEVER =
|
|
2
|
+
export const NEVER = Object.freeze({
|
|
4
3
|
status: "aborted",
|
|
5
4
|
});
|
|
6
5
|
export /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, params) {
|
|
@@ -69,8 +68,7 @@ export class $ZodEncodeError extends Error {
|
|
|
69
68
|
this.name = "ZodEncodeError";
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
export const globalConfig = globalThis.__zod_globalConfig;
|
|
71
|
+
export const globalConfig = {};
|
|
74
72
|
export function config(newConfig) {
|
|
75
73
|
if (newConfig)
|
|
76
74
|
Object.assign(globalConfig, newConfig);
|
|
@@ -65,38 +65,35 @@ function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
65
65
|
}
|
|
66
66
|
function formatError(error, mapper = (issue) => issue.message) {
|
|
67
67
|
const fieldErrors = { _errors: [] };
|
|
68
|
-
const processError = (error
|
|
68
|
+
const processError = (error) => {
|
|
69
69
|
for (const issue of error.issues) {
|
|
70
70
|
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
71
|
-
issue.errors.map((issues) => processError({ issues }
|
|
71
|
+
issue.errors.map((issues) => processError({ issues }));
|
|
72
72
|
}
|
|
73
73
|
else if (issue.code === "invalid_key") {
|
|
74
|
-
processError({ issues: issue.issues }
|
|
74
|
+
processError({ issues: issue.issues });
|
|
75
75
|
}
|
|
76
76
|
else if (issue.code === "invalid_element") {
|
|
77
|
-
processError({ issues: issue.issues }
|
|
77
|
+
processError({ issues: issue.issues });
|
|
78
|
+
}
|
|
79
|
+
else if (issue.path.length === 0) {
|
|
80
|
+
fieldErrors._errors.push(mapper(issue));
|
|
78
81
|
}
|
|
79
82
|
else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
95
|
-
curr[el]._errors.push(mapper(issue));
|
|
96
|
-
}
|
|
97
|
-
curr = curr[el];
|
|
98
|
-
i++;
|
|
83
|
+
let curr = fieldErrors;
|
|
84
|
+
let i = 0;
|
|
85
|
+
while (i < issue.path.length) {
|
|
86
|
+
const el = issue.path[i];
|
|
87
|
+
const terminal = i === issue.path.length - 1;
|
|
88
|
+
if (!terminal) {
|
|
89
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
93
|
+
curr[el]._errors.push(mapper(issue));
|
|
99
94
|
}
|
|
95
|
+
curr = curr[el];
|
|
96
|
+
i++;
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
}
|
|
@@ -111,13 +108,13 @@ function treeifyError(error, mapper = (issue) => issue.message) {
|
|
|
111
108
|
for (const issue of error.issues) {
|
|
112
109
|
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
113
110
|
// regular union error
|
|
114
|
-
issue.errors.map((issues) => processError({ issues },
|
|
111
|
+
issue.errors.map((issues) => processError({ issues }, issue.path));
|
|
115
112
|
}
|
|
116
113
|
else if (issue.code === "invalid_key") {
|
|
117
|
-
processError({ issues: issue.issues },
|
|
114
|
+
processError({ issues: issue.issues }, issue.path);
|
|
118
115
|
}
|
|
119
116
|
else if (issue.code === "invalid_element") {
|
|
120
|
-
processError({ issues: issue.issues },
|
|
117
|
+
processError({ issues: issue.issues }, issue.path);
|
|
121
118
|
}
|
|
122
119
|
else {
|
|
123
120
|
const fullpath = [...path, ...issue.path];
|
|
@@ -34,38 +34,35 @@ export function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
34
34
|
}
|
|
35
35
|
export function formatError(error, mapper = (issue) => issue.message) {
|
|
36
36
|
const fieldErrors = { _errors: [] };
|
|
37
|
-
const processError = (error
|
|
37
|
+
const processError = (error) => {
|
|
38
38
|
for (const issue of error.issues) {
|
|
39
39
|
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
40
|
-
issue.errors.map((issues) => processError({ issues }
|
|
40
|
+
issue.errors.map((issues) => processError({ issues }));
|
|
41
41
|
}
|
|
42
42
|
else if (issue.code === "invalid_key") {
|
|
43
|
-
processError({ issues: issue.issues }
|
|
43
|
+
processError({ issues: issue.issues });
|
|
44
44
|
}
|
|
45
45
|
else if (issue.code === "invalid_element") {
|
|
46
|
-
processError({ issues: issue.issues }
|
|
46
|
+
processError({ issues: issue.issues });
|
|
47
|
+
}
|
|
48
|
+
else if (issue.path.length === 0) {
|
|
49
|
+
fieldErrors._errors.push(mapper(issue));
|
|
47
50
|
}
|
|
48
51
|
else {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
64
|
-
curr[el]._errors.push(mapper(issue));
|
|
65
|
-
}
|
|
66
|
-
curr = curr[el];
|
|
67
|
-
i++;
|
|
52
|
+
let curr = fieldErrors;
|
|
53
|
+
let i = 0;
|
|
54
|
+
while (i < issue.path.length) {
|
|
55
|
+
const el = issue.path[i];
|
|
56
|
+
const terminal = i === issue.path.length - 1;
|
|
57
|
+
if (!terminal) {
|
|
58
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
62
|
+
curr[el]._errors.push(mapper(issue));
|
|
68
63
|
}
|
|
64
|
+
curr = curr[el];
|
|
65
|
+
i++;
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
68
|
}
|
|
@@ -80,13 +77,13 @@ export function treeifyError(error, mapper = (issue) => issue.message) {
|
|
|
80
77
|
for (const issue of error.issues) {
|
|
81
78
|
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
82
79
|
// regular union error
|
|
83
|
-
issue.errors.map((issues) => processError({ issues },
|
|
80
|
+
issue.errors.map((issues) => processError({ issues }, issue.path));
|
|
84
81
|
}
|
|
85
82
|
else if (issue.code === "invalid_key") {
|
|
86
|
-
processError({ issues: issue.issues },
|
|
83
|
+
processError({ issues: issue.issues }, issue.path);
|
|
87
84
|
}
|
|
88
85
|
else if (issue.code === "invalid_element") {
|
|
89
|
-
processError({ issues: issue.issues },
|
|
86
|
+
processError({ issues: issue.issues }, issue.path);
|
|
90
87
|
}
|
|
91
88
|
else {
|
|
92
89
|
const fullpath = [...path, ...issue.path];
|
|
@@ -58,12 +58,8 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
58
58
|
json.type = "integer";
|
|
59
59
|
else
|
|
60
60
|
json.type = "number";
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
64
|
-
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
65
|
-
if (exMin) {
|
|
66
|
-
if (legacy) {
|
|
61
|
+
if (typeof exclusiveMinimum === "number") {
|
|
62
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
67
63
|
json.minimum = exclusiveMinimum;
|
|
68
64
|
json.exclusiveMinimum = true;
|
|
69
65
|
}
|
|
@@ -71,11 +67,17 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
71
67
|
json.exclusiveMinimum = exclusiveMinimum;
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
|
-
|
|
70
|
+
if (typeof minimum === "number") {
|
|
75
71
|
json.minimum = minimum;
|
|
72
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
73
|
+
if (exclusiveMinimum >= minimum)
|
|
74
|
+
delete json.minimum;
|
|
75
|
+
else
|
|
76
|
+
delete json.exclusiveMinimum;
|
|
77
|
+
}
|
|
76
78
|
}
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
+
if (typeof exclusiveMaximum === "number") {
|
|
80
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
79
81
|
json.maximum = exclusiveMaximum;
|
|
80
82
|
json.exclusiveMaximum = true;
|
|
81
83
|
}
|
|
@@ -83,8 +85,14 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
83
85
|
json.exclusiveMaximum = exclusiveMaximum;
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
if (typeof maximum === "number") {
|
|
87
89
|
json.maximum = maximum;
|
|
90
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
91
|
+
if (exclusiveMaximum <= maximum)
|
|
92
|
+
delete json.maximum;
|
|
93
|
+
else
|
|
94
|
+
delete json.exclusiveMaximum;
|
|
95
|
+
}
|
|
88
96
|
}
|
|
89
97
|
if (typeof multipleOf === "number")
|
|
90
98
|
json.multipleOf = multipleOf;
|
|
@@ -294,10 +302,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
294
302
|
if (typeof maximum === "number")
|
|
295
303
|
json.maxItems = maximum;
|
|
296
304
|
json.type = "array";
|
|
297
|
-
json.items = (0, to_json_schema_js_1.process)(def.element, ctx, {
|
|
298
|
-
...params,
|
|
299
|
-
path: [...params.path, "items"],
|
|
300
|
-
});
|
|
305
|
+
json.items = (0, to_json_schema_js_1.process)(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
301
306
|
};
|
|
302
307
|
exports.arrayProcessor = arrayProcessor;
|
|
303
308
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
@@ -525,8 +530,7 @@ const catchProcessor = (schema, ctx, json, params) => {
|
|
|
525
530
|
exports.catchProcessor = catchProcessor;
|
|
526
531
|
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
527
532
|
const def = schema._zod.def;
|
|
528
|
-
const
|
|
529
|
-
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
|
|
533
|
+
const innerType = ctx.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
|
|
530
534
|
(0, to_json_schema_js_1.process)(innerType, ctx, params);
|
|
531
535
|
const seen = ctx.seen.get(schema);
|
|
532
536
|
seen.ref = innerType;
|
|
@@ -53,12 +53,8 @@ export const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
53
53
|
json.type = "integer";
|
|
54
54
|
else
|
|
55
55
|
json.type = "number";
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
59
|
-
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
60
|
-
if (exMin) {
|
|
61
|
-
if (legacy) {
|
|
56
|
+
if (typeof exclusiveMinimum === "number") {
|
|
57
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
62
58
|
json.minimum = exclusiveMinimum;
|
|
63
59
|
json.exclusiveMinimum = true;
|
|
64
60
|
}
|
|
@@ -66,11 +62,17 @@ export const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
66
62
|
json.exclusiveMinimum = exclusiveMinimum;
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
|
|
65
|
+
if (typeof minimum === "number") {
|
|
70
66
|
json.minimum = minimum;
|
|
67
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
68
|
+
if (exclusiveMinimum >= minimum)
|
|
69
|
+
delete json.minimum;
|
|
70
|
+
else
|
|
71
|
+
delete json.exclusiveMinimum;
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
|
-
if (
|
|
73
|
-
if (
|
|
74
|
+
if (typeof exclusiveMaximum === "number") {
|
|
75
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
74
76
|
json.maximum = exclusiveMaximum;
|
|
75
77
|
json.exclusiveMaximum = true;
|
|
76
78
|
}
|
|
@@ -78,8 +80,14 @@ export const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
78
80
|
json.exclusiveMaximum = exclusiveMaximum;
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
if (typeof maximum === "number") {
|
|
82
84
|
json.maximum = maximum;
|
|
85
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
86
|
+
if (exclusiveMaximum <= maximum)
|
|
87
|
+
delete json.maximum;
|
|
88
|
+
else
|
|
89
|
+
delete json.exclusiveMaximum;
|
|
90
|
+
}
|
|
83
91
|
}
|
|
84
92
|
if (typeof multipleOf === "number")
|
|
85
93
|
json.multipleOf = multipleOf;
|
|
@@ -267,10 +275,7 @@ export const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
267
275
|
if (typeof maximum === "number")
|
|
268
276
|
json.maxItems = maximum;
|
|
269
277
|
json.type = "array";
|
|
270
|
-
json.items = process(def.element, ctx, {
|
|
271
|
-
...params,
|
|
272
|
-
path: [...params.path, "items"],
|
|
273
|
-
});
|
|
278
|
+
json.items = process(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
274
279
|
};
|
|
275
280
|
export const objectProcessor = (schema, ctx, _json, params) => {
|
|
276
281
|
const json = _json;
|
|
@@ -487,8 +492,7 @@ export const catchProcessor = (schema, ctx, json, params) => {
|
|
|
487
492
|
};
|
|
488
493
|
export const pipeProcessor = (schema, ctx, _json, params) => {
|
|
489
494
|
const def = schema._zod.def;
|
|
490
|
-
const
|
|
491
|
-
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
|
|
495
|
+
const innerType = ctx.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
|
|
492
496
|
process(innerType, ctx, params);
|
|
493
497
|
const seen = ctx.seen.get(schema);
|
|
494
498
|
seen.ref = innerType;
|
|
@@ -28,7 +28,7 @@ const core = __importStar(require("./core.cjs"));
|
|
|
28
28
|
const errors = __importStar(require("./errors.cjs"));
|
|
29
29
|
const util = __importStar(require("./util.cjs"));
|
|
30
30
|
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
31
|
-
const ctx = _ctx ?
|
|
31
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
32
32
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
33
33
|
if (result instanceof Promise) {
|
|
34
34
|
throw new core.$ZodAsyncError();
|
|
@@ -43,7 +43,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
43
43
|
exports._parse = _parse;
|
|
44
44
|
exports.parse = (0, exports._parse)(errors.$ZodRealError);
|
|
45
45
|
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
46
|
-
const ctx = _ctx ?
|
|
46
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
47
47
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
48
48
|
if (result instanceof Promise)
|
|
49
49
|
result = await result;
|
|
@@ -72,7 +72,7 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
72
72
|
exports._safeParse = _safeParse;
|
|
73
73
|
exports.safeParse = (0, exports._safeParse)(errors.$ZodRealError);
|
|
74
74
|
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
75
|
-
const ctx = _ctx ?
|
|
75
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
76
76
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
77
77
|
if (result instanceof Promise)
|
|
78
78
|
result = await result;
|
|
@@ -86,7 +86,7 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
86
86
|
exports._safeParseAsync = _safeParseAsync;
|
|
87
87
|
exports.safeParseAsync = (0, exports._safeParseAsync)(errors.$ZodRealError);
|
|
88
88
|
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
89
|
-
const ctx = _ctx ?
|
|
89
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
90
90
|
return (0, exports._parse)(_Err)(schema, value, ctx);
|
|
91
91
|
};
|
|
92
92
|
exports._encode = _encode;
|
|
@@ -97,7 +97,7 @@ const _decode = (_Err) => (schema, value, _ctx) => {
|
|
|
97
97
|
exports._decode = _decode;
|
|
98
98
|
exports.decode = (0, exports._decode)(errors.$ZodRealError);
|
|
99
99
|
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
100
|
-
const ctx = _ctx ?
|
|
100
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
101
101
|
return (0, exports._parseAsync)(_Err)(schema, value, ctx);
|
|
102
102
|
};
|
|
103
103
|
exports._encodeAsync = _encodeAsync;
|
|
@@ -108,7 +108,7 @@ const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
108
108
|
exports._decodeAsync = _decodeAsync;
|
|
109
109
|
exports.decodeAsync = (0, exports._decodeAsync)(errors.$ZodRealError);
|
|
110
110
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
111
|
-
const ctx = _ctx ?
|
|
111
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
112
112
|
return (0, exports._safeParse)(_Err)(schema, value, ctx);
|
|
113
113
|
};
|
|
114
114
|
exports._safeEncode = _safeEncode;
|
|
@@ -119,7 +119,7 @@ const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
|
119
119
|
exports._safeDecode = _safeDecode;
|
|
120
120
|
exports.safeDecode = (0, exports._safeDecode)(errors.$ZodRealError);
|
|
121
121
|
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
122
|
-
const ctx = _ctx ?
|
|
122
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
123
123
|
return (0, exports._safeParseAsync)(_Err)(schema, value, ctx);
|
|
124
124
|
};
|
|
125
125
|
exports._safeEncodeAsync = _safeEncodeAsync;
|
|
@@ -2,7 +2,7 @@ import * as core from "./core.js";
|
|
|
2
2
|
import * as errors from "./errors.js";
|
|
3
3
|
import * as util from "./util.js";
|
|
4
4
|
export const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
5
|
-
const ctx = _ctx ?
|
|
5
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
6
6
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
7
7
|
if (result instanceof Promise) {
|
|
8
8
|
throw new core.$ZodAsyncError();
|
|
@@ -16,7 +16,7 @@ export const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
16
16
|
};
|
|
17
17
|
export const parse = /* @__PURE__*/ _parse(errors.$ZodRealError);
|
|
18
18
|
export const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
19
|
-
const ctx = _ctx ?
|
|
19
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
20
20
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
21
21
|
if (result instanceof Promise)
|
|
22
22
|
result = await result;
|
|
@@ -43,7 +43,7 @@ export const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
43
43
|
};
|
|
44
44
|
export const safeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);
|
|
45
45
|
export const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
46
|
-
const ctx = _ctx ?
|
|
46
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
47
47
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
48
48
|
if (result instanceof Promise)
|
|
49
49
|
result = await result;
|
|
@@ -56,7 +56,7 @@ export const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
56
56
|
};
|
|
57
57
|
export const safeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);
|
|
58
58
|
export const _encode = (_Err) => (schema, value, _ctx) => {
|
|
59
|
-
const ctx = _ctx ?
|
|
59
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
60
60
|
return _parse(_Err)(schema, value, ctx);
|
|
61
61
|
};
|
|
62
62
|
export const encode = /* @__PURE__*/ _encode(errors.$ZodRealError);
|
|
@@ -65,7 +65,7 @@ export const _decode = (_Err) => (schema, value, _ctx) => {
|
|
|
65
65
|
};
|
|
66
66
|
export const decode = /* @__PURE__*/ _decode(errors.$ZodRealError);
|
|
67
67
|
export const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
68
|
-
const ctx = _ctx ?
|
|
68
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
69
69
|
return _parseAsync(_Err)(schema, value, ctx);
|
|
70
70
|
};
|
|
71
71
|
export const encodeAsync = /* @__PURE__*/ _encodeAsync(errors.$ZodRealError);
|
|
@@ -74,7 +74,7 @@ export const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
74
74
|
};
|
|
75
75
|
export const decodeAsync = /* @__PURE__*/ _decodeAsync(errors.$ZodRealError);
|
|
76
76
|
export const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
77
|
-
const ctx = _ctx ?
|
|
77
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
78
78
|
return _safeParse(_Err)(schema, value, ctx);
|
|
79
79
|
};
|
|
80
80
|
export const safeEncode = /* @__PURE__*/ _safeEncode(errors.$ZodRealError);
|
|
@@ -83,7 +83,7 @@ export const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
|
83
83
|
};
|
|
84
84
|
export const safeDecode = /* @__PURE__*/ _safeDecode(errors.$ZodRealError);
|
|
85
85
|
export const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
86
|
-
const ctx = _ctx ?
|
|
86
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
87
87
|
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
88
88
|
};
|
|
89
89
|
export const safeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync(errors.$ZodRealError);
|
|
@@ -23,18 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.sha256_base64url = exports.sha256_base64 = exports.sha256_hex = exports.sha1_base64url = exports.sha1_base64 = exports.sha1_hex = exports.md5_base64url = exports.md5_base64 = exports.md5_hex = exports.hex = exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.
|
|
27
|
-
exports.sha512_base64url = exports.sha512_base64 = exports.sha512_hex = exports.sha384_base64url = exports.sha384_base64 =
|
|
26
|
+
exports.sha384_hex = exports.sha256_base64url = exports.sha256_base64 = exports.sha256_hex = exports.sha1_base64url = exports.sha1_base64 = exports.sha1_hex = exports.md5_base64url = exports.md5_base64 = exports.md5_hex = exports.hex = exports.uppercase = exports.lowercase = exports.undefined = exports.null = exports.boolean = exports.number = exports.integer = exports.bigint = exports.string = exports.date = exports.e164 = exports.domain = exports.hostname = exports.base64url = exports.base64 = exports.cidrv6 = exports.cidrv4 = exports.mac = exports.ipv6 = exports.ipv4 = exports.browserEmail = exports.idnEmail = exports.unicodeEmail = exports.rfc5322Email = exports.html5Email = exports.email = exports.uuid7 = exports.uuid6 = exports.uuid4 = exports.uuid = exports.guid = exports.extendedDuration = exports.duration = exports.nanoid = exports.ksuid = exports.xid = exports.ulid = exports.cuid2 = exports.cuid = void 0;
|
|
27
|
+
exports.sha512_base64url = exports.sha512_base64 = exports.sha512_hex = exports.sha384_base64url = exports.sha384_base64 = void 0;
|
|
28
28
|
exports.emoji = emoji;
|
|
29
29
|
exports.time = time;
|
|
30
30
|
exports.datetime = datetime;
|
|
31
31
|
const util = __importStar(require("./util.cjs"));
|
|
32
|
-
|
|
33
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
34
|
-
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
35
|
-
* See https://github.com/paralleldrive/cuid.
|
|
36
|
-
*/
|
|
37
|
-
exports.cuid = /^[cC][0-9a-z]{6,}$/;
|
|
32
|
+
exports.cuid = /^[cC][^\s-]{8,}$/;
|
|
38
33
|
exports.cuid2 = /^[0-9a-z]+$/;
|
|
39
34
|
exports.ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
40
35
|
exports.xid = /^[0-9a-vA-V]{20}$/;
|
|
@@ -89,7 +84,6 @@ exports.base64url = /^[A-Za-z0-9_-]*$/;
|
|
|
89
84
|
// export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
90
85
|
exports.hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
91
86
|
exports.domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
92
|
-
exports.httpProtocol = /^https?$/;
|
|
93
87
|
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
94
88
|
// E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
|
|
95
89
|
exports.e164 = /^\+[1-9]\d{6,14}$/;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import * as util from "./util.js";
|
|
2
|
-
|
|
3
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
4
|
-
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
5
|
-
* See https://github.com/paralleldrive/cuid.
|
|
6
|
-
*/
|
|
7
|
-
export const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
2
|
+
export const cuid = /^[cC][^\s-]{8,}$/;
|
|
8
3
|
export const cuid2 = /^[0-9a-z]+$/;
|
|
9
4
|
export const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
10
5
|
export const xid = /^[0-9a-vA-V]{20}$/;
|
|
@@ -57,7 +52,6 @@ export const base64url = /^[A-Za-z0-9_-]*$/;
|
|
|
57
52
|
// export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
58
53
|
export const hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
59
54
|
export const domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
60
|
-
export const httpProtocol = /^https?$/;
|
|
61
55
|
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
62
56
|
// E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
|
|
63
57
|
export const e164 = /^\+[1-9]\d{6,14}$/;
|