agent-relay 6.0.2 → 6.0.4
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 +10 -3
- package/dist/index.cjs +2024 -962
- package/dist/src/cli/commands/cloud.d.ts.map +1 -1
- package/dist/src/cli/commands/cloud.js +17 -144
- package/dist/src/cli/commands/cloud.js.map +1 -1
- package/dist/src/cli/commands/setup.d.ts +2 -39
- package/dist/src/cli/commands/setup.d.ts.map +1 -1
- package/dist/src/cli/commands/setup.js +4 -333
- package/dist/src/cli/commands/setup.js.map +1 -1
- package/dist/src/cli/lib/auth-ssh.d.ts +2 -33
- package/dist/src/cli/lib/auth-ssh.d.ts.map +1 -1
- package/dist/src/cli/lib/auth-ssh.js +3 -39
- package/dist/src/cli/lib/auth-ssh.js.map +1 -1
- package/dist/src/cli/lib/ssh-interactive.d.ts +4 -66
- package/dist/src/cli/lib/ssh-interactive.d.ts.map +1 -1
- package/dist/src/cli/lib/ssh-interactive.js +4 -436
- package/dist/src/cli/lib/ssh-interactive.js.map +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/README.md +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/locales/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/mini/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/package.json +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v3/tests/all-errors.test.ts +3 -3
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v3/tests/object.test.ts +5 -5
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v3/tests/partials.test.ts +3 -3
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/errors.ts +2 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/external.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/from-json-schema.ts +39 -23
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/parse.ts +6 -6
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/schemas.ts +389 -148
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/catch.test.ts +4 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/codec.test.ts +142 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/continuability.test.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/datetime.test.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/default.test.ts +44 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +31 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +214 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +161 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/function.test.ts +6 -6
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/index.test.ts +2 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/number.test.ts +55 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/object.test.ts +83 -6
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/optional.test.ts +114 -4
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/partial.test.ts +28 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/prefault.test.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/record.test.ts +85 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +49 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/refine.test.ts +63 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/string.test.ts +50 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +4 -4
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +128 -14
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/transform.test.ts +17 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/tuple.test.ts +315 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/classic/tests/union.test.ts +54 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/api.ts +25 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/checks.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/core.ts +17 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/errors.ts +31 -24
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/json-schema-processors.ts +15 -17
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/parse.ts +7 -7
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/regexes.ts +8 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/schemas.ts +218 -66
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +22 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +58 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/to-json-schema.ts +9 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/util.ts +52 -35
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/en.ts +4 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/fr.ts +24 -8
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/index.ts +3 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/it.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/ka.ts +8 -8
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/external.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/schemas.ts +55 -24
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/tests/codec.test.ts +19 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/tests/index.test.ts +27 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/tests/object.test.ts +9 -9
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +51 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/src/v4/mini/tests/string.test.ts +5 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v3/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/errors.js +2 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/external.d.cts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/external.d.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/from-json-schema.cjs +31 -16
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/from-json-schema.js +31 -16
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/schemas.cjs +346 -117
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/schemas.d.cts +34 -12
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/schemas.d.ts +34 -12
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/classic/schemas.js +345 -117
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/api.cjs +7 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/api.d.cts +20 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/api.d.ts +20 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/api.js +7 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/checks.d.cts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/checks.d.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/core.cjs +3 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/core.js +4 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/errors.cjs +26 -23
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/errors.d.cts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/errors.d.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/errors.js +26 -23
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/json-schema-processors.cjs +14 -19
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/json-schema-processors.js +14 -19
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/parse.cjs +7 -7
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/parse.js +7 -7
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/regexes.cjs +9 -3
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/regexes.d.cts +6 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/regexes.d.ts +6 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/regexes.js +7 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/schemas.cjs +196 -59
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/schemas.d.cts +21 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/schemas.d.ts +21 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/schemas.js +196 -59
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/to-json-schema.cjs +10 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/to-json-schema.js +10 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/util.cjs +54 -30
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/util.d.cts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/util.d.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/util.js +55 -32
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/en.cjs +4 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/en.js +4 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/fr.cjs +24 -7
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/fr.js +24 -7
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/index.cjs +8 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/index.d.cts +3 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/index.d.ts +3 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/index.js +3 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/it.cjs +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/it.js +1 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/ka.js +8 -8
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/external.d.cts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/external.d.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/schemas.cjs +41 -4
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/schemas.d.cts +27 -9
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/schemas.d.ts +27 -9
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/mini/schemas.js +40 -4
- package/node_modules/@relaycast/sdk/node_modules/zod/v4/package.json +2 -1
- package/node_modules/@relaycast/sdk/node_modules/zod/v4-mini/package.json +2 -1
- package/package.json +10 -10
|
@@ -177,6 +177,7 @@ export declare function partial(Class: SchemaClass<schemas.$ZodOptional> | null,
|
|
|
177
177
|
export declare function required(Class: SchemaClass<schemas.$ZodNonOptional>, schema: schemas.$ZodObject, mask: object | undefined): any;
|
|
178
178
|
export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
|
|
179
179
|
export declare function aborted(x: schemas.ParsePayload, startIndex?: number): boolean;
|
|
180
|
+
export declare function explicitlyAborted(x: schemas.ParsePayload, startIndex?: number): boolean;
|
|
180
181
|
export declare function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[];
|
|
181
182
|
export declare function unwrapMessage(message: string | {
|
|
182
183
|
message: string;
|
|
@@ -177,6 +177,7 @@ export declare function partial(Class: SchemaClass<schemas.$ZodOptional> | null,
|
|
|
177
177
|
export declare function required(Class: SchemaClass<schemas.$ZodNonOptional>, schema: schemas.$ZodObject, mask: object | undefined): any;
|
|
178
178
|
export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
|
|
179
179
|
export declare function aborted(x: schemas.ParsePayload, startIndex?: number): boolean;
|
|
180
|
+
export declare function explicitlyAborted(x: schemas.ParsePayload, startIndex?: number): boolean;
|
|
180
181
|
export declare function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[];
|
|
181
182
|
export declare function unwrapMessage(message: string | {
|
|
182
183
|
message: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { globalConfig } from "./core.js";
|
|
1
2
|
// functions
|
|
2
3
|
export function assertEqual(val) {
|
|
3
4
|
return val;
|
|
@@ -47,21 +48,15 @@ export function cleanRegex(source) {
|
|
|
47
48
|
return source.slice(start, end);
|
|
48
49
|
}
|
|
49
50
|
export function floatSafeRemainder(val, step) {
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
60
|
-
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
61
|
-
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
62
|
-
return (valInt % stepInt) / 10 ** decCount;
|
|
63
|
-
}
|
|
64
|
-
const EVALUATING = Symbol("evaluating");
|
|
51
|
+
const ratio = val / step;
|
|
52
|
+
const roundedRatio = Math.round(ratio);
|
|
53
|
+
// Use a relative epsilon scaled to the magnitude of the result
|
|
54
|
+
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
55
|
+
if (Math.abs(ratio - roundedRatio) < tolerance)
|
|
56
|
+
return 0;
|
|
57
|
+
return ratio - roundedRatio;
|
|
58
|
+
}
|
|
59
|
+
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
65
60
|
export function defineLazy(object, key, getter) {
|
|
66
61
|
let value = undefined;
|
|
67
62
|
Object.defineProperty(object, key, {
|
|
@@ -147,7 +142,12 @@ export const captureStackTrace = ("captureStackTrace" in Error ? Error.captureSt
|
|
|
147
142
|
export function isObject(data) {
|
|
148
143
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
149
144
|
}
|
|
150
|
-
export const allowsEval = cached(() => {
|
|
145
|
+
export const allowsEval = /* @__PURE__*/ cached(() => {
|
|
146
|
+
// Skip the probe under `jitless`: strict CSPs report the caught `new Function`
|
|
147
|
+
// as a `securitypolicyviolation` even though the throw is swallowed.
|
|
148
|
+
if (globalConfig.jitless) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
151
|
// @ts-ignore
|
|
152
152
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
153
153
|
return false;
|
|
@@ -185,6 +185,10 @@ export function shallowClone(o) {
|
|
|
185
185
|
return { ...o };
|
|
186
186
|
if (Array.isArray(o))
|
|
187
187
|
return [...o];
|
|
188
|
+
if (o instanceof Map)
|
|
189
|
+
return new Map(o);
|
|
190
|
+
if (o instanceof Set)
|
|
191
|
+
return new Set(o);
|
|
188
192
|
return o;
|
|
189
193
|
}
|
|
190
194
|
export function numKeys(data) {
|
|
@@ -241,8 +245,15 @@ export const getParsedType = (data) => {
|
|
|
241
245
|
throw new Error(`Unknown data type: ${t}`);
|
|
242
246
|
}
|
|
243
247
|
};
|
|
244
|
-
export const propertyKeyTypes = new Set(["string", "number", "symbol"]);
|
|
245
|
-
export const primitiveTypes = new Set([
|
|
248
|
+
export const propertyKeyTypes = /* @__PURE__*/ new Set(["string", "number", "symbol"]);
|
|
249
|
+
export const primitiveTypes = /* @__PURE__*/ new Set([
|
|
250
|
+
"string",
|
|
251
|
+
"number",
|
|
252
|
+
"bigint",
|
|
253
|
+
"boolean",
|
|
254
|
+
"symbol",
|
|
255
|
+
"undefined",
|
|
256
|
+
]);
|
|
246
257
|
export function escapeRegex(str) {
|
|
247
258
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
248
259
|
}
|
|
@@ -414,6 +425,9 @@ export function safeExtend(schema, shape) {
|
|
|
414
425
|
return clone(schema, def);
|
|
415
426
|
}
|
|
416
427
|
export function merge(a, b) {
|
|
428
|
+
if (a._zod.def.checks?.length) {
|
|
429
|
+
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
430
|
+
}
|
|
417
431
|
const def = mergeDefs(a._zod.def, {
|
|
418
432
|
get shape() {
|
|
419
433
|
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
@@ -423,7 +437,7 @@ export function merge(a, b) {
|
|
|
423
437
|
get catchall() {
|
|
424
438
|
return b._zod.def.catchall;
|
|
425
439
|
},
|
|
426
|
-
checks: [],
|
|
440
|
+
checks: b._zod.def.checks ?? [],
|
|
427
441
|
});
|
|
428
442
|
return clone(a, def);
|
|
429
443
|
}
|
|
@@ -517,6 +531,18 @@ export function aborted(x, startIndex = 0) {
|
|
|
517
531
|
}
|
|
518
532
|
return false;
|
|
519
533
|
}
|
|
534
|
+
// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined).
|
|
535
|
+
// Used to respect `abort: true` in .refine() even for checks that have a `when` function.
|
|
536
|
+
export function explicitlyAborted(x, startIndex = 0) {
|
|
537
|
+
if (x.aborted === true)
|
|
538
|
+
return true;
|
|
539
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
540
|
+
if (x.issues[i]?.continue === false) {
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
520
546
|
export function prefixIssues(path, issues) {
|
|
521
547
|
return issues.map((iss) => {
|
|
522
548
|
var _a;
|
|
@@ -529,23 +555,20 @@ export function unwrapMessage(message) {
|
|
|
529
555
|
return typeof message === "string" ? message : message?.message;
|
|
530
556
|
}
|
|
531
557
|
export function finalizeIssue(iss, ctx, config) {
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??
|
|
558
|
+
const message = iss.message
|
|
559
|
+
? iss.message
|
|
560
|
+
: (unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??
|
|
536
561
|
unwrapMessage(ctx?.error?.(iss)) ??
|
|
537
562
|
unwrapMessage(config.customError?.(iss)) ??
|
|
538
563
|
unwrapMessage(config.localeError?.(iss)) ??
|
|
539
|
-
"Invalid input";
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
if (!ctx?.reportInput) {
|
|
546
|
-
delete full.input;
|
|
564
|
+
"Invalid input");
|
|
565
|
+
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
566
|
+
rest.path ?? (rest.path = []);
|
|
567
|
+
rest.message = message;
|
|
568
|
+
if (ctx?.reportInput) {
|
|
569
|
+
rest.input = _input;
|
|
547
570
|
}
|
|
548
|
-
return
|
|
571
|
+
return rest;
|
|
549
572
|
}
|
|
550
573
|
export function getSizableOrigin(input) {
|
|
551
574
|
if (input instanceof Set)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.default = default_1;
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
|
+
const error = () => {
|
|
29
|
+
const Sizable = {
|
|
30
|
+
string: { unit: "χαρακτήρες", verb: "να έχει" },
|
|
31
|
+
file: { unit: "bytes", verb: "να έχει" },
|
|
32
|
+
array: { unit: "στοιχεία", verb: "να έχει" },
|
|
33
|
+
set: { unit: "στοιχεία", verb: "να έχει" },
|
|
34
|
+
map: { unit: "καταχωρήσεις", verb: "να έχει" },
|
|
35
|
+
};
|
|
36
|
+
function getSizing(origin) {
|
|
37
|
+
return Sizable[origin] ?? null;
|
|
38
|
+
}
|
|
39
|
+
const FormatDictionary = {
|
|
40
|
+
regex: "είσοδος",
|
|
41
|
+
email: "διεύθυνση email",
|
|
42
|
+
url: "URL",
|
|
43
|
+
emoji: "emoji",
|
|
44
|
+
uuid: "UUID",
|
|
45
|
+
uuidv4: "UUIDv4",
|
|
46
|
+
uuidv6: "UUIDv6",
|
|
47
|
+
nanoid: "nanoid",
|
|
48
|
+
guid: "GUID",
|
|
49
|
+
cuid: "cuid",
|
|
50
|
+
cuid2: "cuid2",
|
|
51
|
+
ulid: "ULID",
|
|
52
|
+
xid: "XID",
|
|
53
|
+
ksuid: "KSUID",
|
|
54
|
+
datetime: "ISO ημερομηνία και ώρα",
|
|
55
|
+
date: "ISO ημερομηνία",
|
|
56
|
+
time: "ISO ώρα",
|
|
57
|
+
duration: "ISO διάρκεια",
|
|
58
|
+
ipv4: "διεύθυνση IPv4",
|
|
59
|
+
ipv6: "διεύθυνση IPv6",
|
|
60
|
+
mac: "διεύθυνση MAC",
|
|
61
|
+
cidrv4: "εύρος IPv4",
|
|
62
|
+
cidrv6: "εύρος IPv6",
|
|
63
|
+
base64: "συμβολοσειρά κωδικοποιημένη σε base64",
|
|
64
|
+
base64url: "συμβολοσειρά κωδικοποιημένη σε base64url",
|
|
65
|
+
json_string: "συμβολοσειρά JSON",
|
|
66
|
+
e164: "αριθμός E.164",
|
|
67
|
+
jwt: "JWT",
|
|
68
|
+
template_literal: "είσοδος",
|
|
69
|
+
};
|
|
70
|
+
const TypeDictionary = {
|
|
71
|
+
nan: "NaN",
|
|
72
|
+
};
|
|
73
|
+
return (issue) => {
|
|
74
|
+
switch (issue.code) {
|
|
75
|
+
case "invalid_type": {
|
|
76
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
77
|
+
const receivedType = util.parsedType(issue.input);
|
|
78
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
79
|
+
if (typeof issue.expected === "string" && /^[A-Z]/.test(issue.expected)) {
|
|
80
|
+
return `Μη έγκυρη είσοδος: αναμενόταν instanceof ${issue.expected}, λήφθηκε ${received}`;
|
|
81
|
+
}
|
|
82
|
+
return `Μη έγκυρη είσοδος: αναμενόταν ${expected}, λήφθηκε ${received}`;
|
|
83
|
+
}
|
|
84
|
+
case "invalid_value":
|
|
85
|
+
if (issue.values.length === 1)
|
|
86
|
+
return `Μη έγκυρη είσοδος: αναμενόταν ${util.stringifyPrimitive(issue.values[0])}`;
|
|
87
|
+
return `Μη έγκυρη επιλογή: αναμενόταν ένα από ${util.joinValues(issue.values, "|")}`;
|
|
88
|
+
case "too_big": {
|
|
89
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
90
|
+
const sizing = getSizing(issue.origin);
|
|
91
|
+
if (sizing)
|
|
92
|
+
return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να έχει ${adj}${issue.maximum.toString()} ${sizing.unit ?? "στοιχεία"}`;
|
|
93
|
+
return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να είναι ${adj}${issue.maximum.toString()}`;
|
|
94
|
+
}
|
|
95
|
+
case "too_small": {
|
|
96
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
97
|
+
const sizing = getSizing(issue.origin);
|
|
98
|
+
if (sizing) {
|
|
99
|
+
return `Πολύ μικρό: αναμενόταν ${issue.origin} να έχει ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
100
|
+
}
|
|
101
|
+
return `Πολύ μικρό: αναμενόταν ${issue.origin} να είναι ${adj}${issue.minimum.toString()}`;
|
|
102
|
+
}
|
|
103
|
+
case "invalid_format": {
|
|
104
|
+
const _issue = issue;
|
|
105
|
+
if (_issue.format === "starts_with") {
|
|
106
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${_issue.prefix}"`;
|
|
107
|
+
}
|
|
108
|
+
if (_issue.format === "ends_with")
|
|
109
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${_issue.suffix}"`;
|
|
110
|
+
if (_issue.format === "includes")
|
|
111
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${_issue.includes}"`;
|
|
112
|
+
if (_issue.format === "regex")
|
|
113
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${_issue.pattern}`;
|
|
114
|
+
return `Μη έγκυρο: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
115
|
+
}
|
|
116
|
+
case "not_multiple_of":
|
|
117
|
+
return `Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${issue.divisor}`;
|
|
118
|
+
case "unrecognized_keys":
|
|
119
|
+
return `Άγνωστ${issue.keys.length > 1 ? "α" : "ο"} κλειδ${issue.keys.length > 1 ? "ιά" : "ί"}: ${util.joinValues(issue.keys, ", ")}`;
|
|
120
|
+
case "invalid_key":
|
|
121
|
+
return `Μη έγκυρο κλειδί στο ${issue.origin}`;
|
|
122
|
+
case "invalid_union":
|
|
123
|
+
return "Μη έγκυρη είσοδος";
|
|
124
|
+
case "invalid_element":
|
|
125
|
+
return `Μη έγκυρη τιμή στο ${issue.origin}`;
|
|
126
|
+
default:
|
|
127
|
+
return `Μη έγκυρη είσοδος`;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
function default_1() {
|
|
132
|
+
return {
|
|
133
|
+
localeError: error(),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "χαρακτήρες", verb: "να έχει" },
|
|
5
|
+
file: { unit: "bytes", verb: "να έχει" },
|
|
6
|
+
array: { unit: "στοιχεία", verb: "να έχει" },
|
|
7
|
+
set: { unit: "στοιχεία", verb: "να έχει" },
|
|
8
|
+
map: { unit: "καταχωρήσεις", verb: "να έχει" },
|
|
9
|
+
};
|
|
10
|
+
function getSizing(origin) {
|
|
11
|
+
return Sizable[origin] ?? null;
|
|
12
|
+
}
|
|
13
|
+
const FormatDictionary = {
|
|
14
|
+
regex: "είσοδος",
|
|
15
|
+
email: "διεύθυνση email",
|
|
16
|
+
url: "URL",
|
|
17
|
+
emoji: "emoji",
|
|
18
|
+
uuid: "UUID",
|
|
19
|
+
uuidv4: "UUIDv4",
|
|
20
|
+
uuidv6: "UUIDv6",
|
|
21
|
+
nanoid: "nanoid",
|
|
22
|
+
guid: "GUID",
|
|
23
|
+
cuid: "cuid",
|
|
24
|
+
cuid2: "cuid2",
|
|
25
|
+
ulid: "ULID",
|
|
26
|
+
xid: "XID",
|
|
27
|
+
ksuid: "KSUID",
|
|
28
|
+
datetime: "ISO ημερομηνία και ώρα",
|
|
29
|
+
date: "ISO ημερομηνία",
|
|
30
|
+
time: "ISO ώρα",
|
|
31
|
+
duration: "ISO διάρκεια",
|
|
32
|
+
ipv4: "διεύθυνση IPv4",
|
|
33
|
+
ipv6: "διεύθυνση IPv6",
|
|
34
|
+
mac: "διεύθυνση MAC",
|
|
35
|
+
cidrv4: "εύρος IPv4",
|
|
36
|
+
cidrv6: "εύρος IPv6",
|
|
37
|
+
base64: "συμβολοσειρά κωδικοποιημένη σε base64",
|
|
38
|
+
base64url: "συμβολοσειρά κωδικοποιημένη σε base64url",
|
|
39
|
+
json_string: "συμβολοσειρά JSON",
|
|
40
|
+
e164: "αριθμός E.164",
|
|
41
|
+
jwt: "JWT",
|
|
42
|
+
template_literal: "είσοδος",
|
|
43
|
+
};
|
|
44
|
+
const TypeDictionary = {
|
|
45
|
+
nan: "NaN",
|
|
46
|
+
};
|
|
47
|
+
return (issue) => {
|
|
48
|
+
switch (issue.code) {
|
|
49
|
+
case "invalid_type": {
|
|
50
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
51
|
+
const receivedType = util.parsedType(issue.input);
|
|
52
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
53
|
+
if (typeof issue.expected === "string" && /^[A-Z]/.test(issue.expected)) {
|
|
54
|
+
return `Μη έγκυρη είσοδος: αναμενόταν instanceof ${issue.expected}, λήφθηκε ${received}`;
|
|
55
|
+
}
|
|
56
|
+
return `Μη έγκυρη είσοδος: αναμενόταν ${expected}, λήφθηκε ${received}`;
|
|
57
|
+
}
|
|
58
|
+
case "invalid_value":
|
|
59
|
+
if (issue.values.length === 1)
|
|
60
|
+
return `Μη έγκυρη είσοδος: αναμενόταν ${util.stringifyPrimitive(issue.values[0])}`;
|
|
61
|
+
return `Μη έγκυρη επιλογή: αναμενόταν ένα από ${util.joinValues(issue.values, "|")}`;
|
|
62
|
+
case "too_big": {
|
|
63
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
64
|
+
const sizing = getSizing(issue.origin);
|
|
65
|
+
if (sizing)
|
|
66
|
+
return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να έχει ${adj}${issue.maximum.toString()} ${sizing.unit ?? "στοιχεία"}`;
|
|
67
|
+
return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να είναι ${adj}${issue.maximum.toString()}`;
|
|
68
|
+
}
|
|
69
|
+
case "too_small": {
|
|
70
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
71
|
+
const sizing = getSizing(issue.origin);
|
|
72
|
+
if (sizing) {
|
|
73
|
+
return `Πολύ μικρό: αναμενόταν ${issue.origin} να έχει ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
74
|
+
}
|
|
75
|
+
return `Πολύ μικρό: αναμενόταν ${issue.origin} να είναι ${adj}${issue.minimum.toString()}`;
|
|
76
|
+
}
|
|
77
|
+
case "invalid_format": {
|
|
78
|
+
const _issue = issue;
|
|
79
|
+
if (_issue.format === "starts_with") {
|
|
80
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${_issue.prefix}"`;
|
|
81
|
+
}
|
|
82
|
+
if (_issue.format === "ends_with")
|
|
83
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${_issue.suffix}"`;
|
|
84
|
+
if (_issue.format === "includes")
|
|
85
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${_issue.includes}"`;
|
|
86
|
+
if (_issue.format === "regex")
|
|
87
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${_issue.pattern}`;
|
|
88
|
+
return `Μη έγκυρο: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
89
|
+
}
|
|
90
|
+
case "not_multiple_of":
|
|
91
|
+
return `Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${issue.divisor}`;
|
|
92
|
+
case "unrecognized_keys":
|
|
93
|
+
return `Άγνωστ${issue.keys.length > 1 ? "α" : "ο"} κλειδ${issue.keys.length > 1 ? "ιά" : "ί"}: ${util.joinValues(issue.keys, ", ")}`;
|
|
94
|
+
case "invalid_key":
|
|
95
|
+
return `Μη έγκυρο κλειδί στο ${issue.origin}`;
|
|
96
|
+
case "invalid_union":
|
|
97
|
+
return "Μη έγκυρη είσοδος";
|
|
98
|
+
case "invalid_element":
|
|
99
|
+
return `Μη έγκυρη τιμή στο ${issue.origin}`;
|
|
100
|
+
default:
|
|
101
|
+
return `Μη έγκυρη είσοδος`;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export default function () {
|
|
106
|
+
return {
|
|
107
|
+
localeError: error(),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -120,6 +120,10 @@ const error = () => {
|
|
|
120
120
|
case "invalid_key":
|
|
121
121
|
return `Invalid key in ${issue.origin}`;
|
|
122
122
|
case "invalid_union":
|
|
123
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
124
|
+
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
125
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
126
|
+
}
|
|
123
127
|
return "Invalid input";
|
|
124
128
|
case "invalid_element":
|
|
125
129
|
return `Invalid value in ${issue.origin}`;
|
|
@@ -94,6 +94,10 @@ const error = () => {
|
|
|
94
94
|
case "invalid_key":
|
|
95
95
|
return `Invalid key in ${issue.origin}`;
|
|
96
96
|
case "invalid_union":
|
|
97
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
98
|
+
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
99
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
100
|
+
}
|
|
97
101
|
return "Invalid input";
|
|
98
102
|
case "invalid_element":
|
|
99
103
|
return `Invalid value in ${issue.origin}`;
|
|
@@ -66,9 +66,27 @@ const error = () => {
|
|
|
66
66
|
template_literal: "entrée",
|
|
67
67
|
};
|
|
68
68
|
const TypeDictionary = {
|
|
69
|
-
|
|
69
|
+
string: "chaîne",
|
|
70
70
|
number: "nombre",
|
|
71
|
+
int: "entier",
|
|
72
|
+
boolean: "booléen",
|
|
73
|
+
bigint: "grand entier",
|
|
74
|
+
symbol: "symbole",
|
|
75
|
+
undefined: "indéfini",
|
|
76
|
+
null: "null",
|
|
77
|
+
never: "jamais",
|
|
78
|
+
void: "vide",
|
|
79
|
+
date: "date",
|
|
71
80
|
array: "tableau",
|
|
81
|
+
object: "objet",
|
|
82
|
+
tuple: "tuple",
|
|
83
|
+
record: "enregistrement",
|
|
84
|
+
map: "carte",
|
|
85
|
+
set: "ensemble",
|
|
86
|
+
file: "fichier",
|
|
87
|
+
nonoptional: "non-optionnel",
|
|
88
|
+
nan: "NaN",
|
|
89
|
+
function: "fonction",
|
|
72
90
|
};
|
|
73
91
|
return (issue) => {
|
|
74
92
|
switch (issue.code) {
|
|
@@ -89,16 +107,15 @@ const error = () => {
|
|
|
89
107
|
const adj = issue.inclusive ? "<=" : "<";
|
|
90
108
|
const sizing = getSizing(issue.origin);
|
|
91
109
|
if (sizing)
|
|
92
|
-
return `Trop grand : ${issue.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
|
93
|
-
return `Trop grand : ${issue.origin ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
|
110
|
+
return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
|
111
|
+
return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
|
94
112
|
}
|
|
95
113
|
case "too_small": {
|
|
96
114
|
const adj = issue.inclusive ? ">=" : ">";
|
|
97
115
|
const sizing = getSizing(issue.origin);
|
|
98
|
-
if (sizing)
|
|
99
|
-
return `Trop petit : ${issue.origin} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
100
|
-
}
|
|
101
|
-
return `Trop petit : ${issue.origin} doit être ${adj}${issue.minimum.toString()}`;
|
|
116
|
+
if (sizing)
|
|
117
|
+
return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
118
|
+
return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.minimum.toString()}`;
|
|
102
119
|
}
|
|
103
120
|
case "invalid_format": {
|
|
104
121
|
const _issue = issue;
|
|
@@ -40,9 +40,27 @@ const error = () => {
|
|
|
40
40
|
template_literal: "entrée",
|
|
41
41
|
};
|
|
42
42
|
const TypeDictionary = {
|
|
43
|
-
|
|
43
|
+
string: "chaîne",
|
|
44
44
|
number: "nombre",
|
|
45
|
+
int: "entier",
|
|
46
|
+
boolean: "booléen",
|
|
47
|
+
bigint: "grand entier",
|
|
48
|
+
symbol: "symbole",
|
|
49
|
+
undefined: "indéfini",
|
|
50
|
+
null: "null",
|
|
51
|
+
never: "jamais",
|
|
52
|
+
void: "vide",
|
|
53
|
+
date: "date",
|
|
45
54
|
array: "tableau",
|
|
55
|
+
object: "objet",
|
|
56
|
+
tuple: "tuple",
|
|
57
|
+
record: "enregistrement",
|
|
58
|
+
map: "carte",
|
|
59
|
+
set: "ensemble",
|
|
60
|
+
file: "fichier",
|
|
61
|
+
nonoptional: "non-optionnel",
|
|
62
|
+
nan: "NaN",
|
|
63
|
+
function: "fonction",
|
|
46
64
|
};
|
|
47
65
|
return (issue) => {
|
|
48
66
|
switch (issue.code) {
|
|
@@ -63,16 +81,15 @@ const error = () => {
|
|
|
63
81
|
const adj = issue.inclusive ? "<=" : "<";
|
|
64
82
|
const sizing = getSizing(issue.origin);
|
|
65
83
|
if (sizing)
|
|
66
|
-
return `Trop grand : ${issue.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
|
67
|
-
return `Trop grand : ${issue.origin ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
|
84
|
+
return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
|
85
|
+
return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
|
68
86
|
}
|
|
69
87
|
case "too_small": {
|
|
70
88
|
const adj = issue.inclusive ? ">=" : ">";
|
|
71
89
|
const sizing = getSizing(issue.origin);
|
|
72
|
-
if (sizing)
|
|
73
|
-
return `Trop petit : ${issue.origin} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
74
|
-
}
|
|
75
|
-
return `Trop petit : ${issue.origin} doit être ${adj}${issue.minimum.toString()}`;
|
|
90
|
+
if (sizing)
|
|
91
|
+
return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
92
|
+
return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.minimum.toString()}`;
|
|
76
93
|
}
|
|
77
94
|
case "invalid_format": {
|
|
78
95
|
const _issue = issue;
|