agent-relay 6.0.3 → 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/dist/index.cjs +1395 -674
- 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 +9 -9
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as checks from "./checks.js";
|
|
2
|
+
import { globalConfig } from "./core.js";
|
|
2
3
|
import type { $ZodConfig } from "./core.js";
|
|
3
4
|
import type * as errors from "./errors.js";
|
|
4
5
|
import type * as schemas from "./schemas.js";
|
|
@@ -245,23 +246,15 @@ export function cleanRegex(source: string): string {
|
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
export function floatSafeRemainder(val: number, step: number): number {
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
stepDecCount = Number.parseInt(match[1]);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
259
|
-
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
260
|
-
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
261
|
-
return (valInt % stepInt) / 10 ** decCount;
|
|
249
|
+
const ratio = val / step;
|
|
250
|
+
const roundedRatio = Math.round(ratio);
|
|
251
|
+
// Use a relative epsilon scaled to the magnitude of the result
|
|
252
|
+
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
253
|
+
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
254
|
+
return ratio - roundedRatio;
|
|
262
255
|
}
|
|
263
256
|
|
|
264
|
-
const EVALUATING = Symbol("evaluating");
|
|
257
|
+
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
265
258
|
|
|
266
259
|
export function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void {
|
|
267
260
|
let value: T[K] | typeof EVALUATING | undefined = undefined;
|
|
@@ -368,7 +361,13 @@ export function isObject(data: any): data is Record<PropertyKey, unknown> {
|
|
|
368
361
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
369
362
|
}
|
|
370
363
|
|
|
371
|
-
export const allowsEval: { value: boolean } = cached(() => {
|
|
364
|
+
export const allowsEval: { value: boolean } = /* @__PURE__*/ cached(() => {
|
|
365
|
+
// Skip the probe under `jitless`: strict CSPs report the caught `new Function`
|
|
366
|
+
// as a `securitypolicyviolation` even though the throw is swallowed.
|
|
367
|
+
if (globalConfig.jitless) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
|
|
372
371
|
// @ts-ignore
|
|
373
372
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
374
373
|
return false;
|
|
@@ -407,6 +406,8 @@ export function isPlainObject(o: any): o is Record<PropertyKey, unknown> {
|
|
|
407
406
|
export function shallowClone(o: any): any {
|
|
408
407
|
if (isPlainObject(o)) return { ...o };
|
|
409
408
|
if (Array.isArray(o)) return [...o];
|
|
409
|
+
if (o instanceof Map) return new Map(o);
|
|
410
|
+
if (o instanceof Set) return new Set(o);
|
|
410
411
|
return o;
|
|
411
412
|
}
|
|
412
413
|
|
|
@@ -475,8 +476,15 @@ export const getParsedType = (data: any): ParsedTypes => {
|
|
|
475
476
|
}
|
|
476
477
|
};
|
|
477
478
|
|
|
478
|
-
export const propertyKeyTypes: Set<string> = new Set(["string", "number", "symbol"]);
|
|
479
|
-
export const primitiveTypes: Set<string> = new Set([
|
|
479
|
+
export const propertyKeyTypes: Set<string> = /* @__PURE__*/ new Set(["string", "number", "symbol"]);
|
|
480
|
+
export const primitiveTypes: Set<string> = /* @__PURE__*/ new Set([
|
|
481
|
+
"string",
|
|
482
|
+
"number",
|
|
483
|
+
"bigint",
|
|
484
|
+
"boolean",
|
|
485
|
+
"symbol",
|
|
486
|
+
"undefined",
|
|
487
|
+
]);
|
|
480
488
|
export function escapeRegex(str: string): string {
|
|
481
489
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
482
490
|
}
|
|
@@ -691,6 +699,9 @@ export function safeExtend(schema: schemas.$ZodObject, shape: schemas.$ZodShape)
|
|
|
691
699
|
}
|
|
692
700
|
|
|
693
701
|
export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any {
|
|
702
|
+
if (a._zod.def.checks?.length) {
|
|
703
|
+
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
704
|
+
}
|
|
694
705
|
const def = mergeDefs(a._zod.def, {
|
|
695
706
|
get shape() {
|
|
696
707
|
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
@@ -700,7 +711,7 @@ export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any {
|
|
|
700
711
|
get catchall() {
|
|
701
712
|
return b._zod.def.catchall;
|
|
702
713
|
},
|
|
703
|
-
checks: [],
|
|
714
|
+
checks: b._zod.def.checks ?? [],
|
|
704
715
|
});
|
|
705
716
|
|
|
706
717
|
return clone(a, def) as any;
|
|
@@ -811,6 +822,18 @@ export function aborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
|
|
811
822
|
return false;
|
|
812
823
|
}
|
|
813
824
|
|
|
825
|
+
// Checks for explicit abort (continue === false), as opposed to implicit abort (continue === undefined).
|
|
826
|
+
// Used to respect `abort: true` in .refine() even for checks that have a `when` function.
|
|
827
|
+
export function explicitlyAborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
|
828
|
+
if (x.aborted === true) return true;
|
|
829
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
830
|
+
if (x.issues[i]?.continue === false) {
|
|
831
|
+
return true;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
|
|
814
837
|
export function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[] {
|
|
815
838
|
return issues.map((iss) => {
|
|
816
839
|
(iss as any).path ??= [];
|
|
@@ -828,27 +851,21 @@ export function finalizeIssue(
|
|
|
828
851
|
ctx: schemas.ParseContextInternal | undefined,
|
|
829
852
|
config: $ZodConfig
|
|
830
853
|
): errors.$ZodIssue {
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
if (!iss.message) {
|
|
835
|
-
const message =
|
|
836
|
-
unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ??
|
|
854
|
+
const message = iss.message
|
|
855
|
+
? iss.message
|
|
856
|
+
: (unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ??
|
|
837
857
|
unwrapMessage(ctx?.error?.(iss as never)) ??
|
|
838
858
|
unwrapMessage(config.customError?.(iss)) ??
|
|
839
859
|
unwrapMessage(config.localeError?.(iss)) ??
|
|
840
|
-
"Invalid input";
|
|
841
|
-
(full as any).message = message;
|
|
842
|
-
}
|
|
860
|
+
"Invalid input");
|
|
843
861
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (
|
|
848
|
-
|
|
862
|
+
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss as any;
|
|
863
|
+
rest.path ??= [];
|
|
864
|
+
rest.message = message;
|
|
865
|
+
if (ctx?.reportInput) {
|
|
866
|
+
rest.input = _input;
|
|
849
867
|
}
|
|
850
|
-
|
|
851
|
-
return full;
|
|
868
|
+
return rest;
|
|
852
869
|
}
|
|
853
870
|
|
|
854
871
|
export function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown" {
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { $ZodStringFormats } from "../core/checks.js";
|
|
2
|
+
import type * as errors from "../core/errors.js";
|
|
3
|
+
import * as util from "../core/util.js";
|
|
4
|
+
|
|
5
|
+
const error: () => errors.$ZodErrorMap = () => {
|
|
6
|
+
const Sizable: Record<string, { unit: string; verb: string }> = {
|
|
7
|
+
string: { unit: "χαρακτήρες", verb: "να έχει" },
|
|
8
|
+
file: { unit: "bytes", verb: "να έχει" },
|
|
9
|
+
array: { unit: "στοιχεία", verb: "να έχει" },
|
|
10
|
+
set: { unit: "στοιχεία", verb: "να έχει" },
|
|
11
|
+
map: { unit: "καταχωρήσεις", verb: "να έχει" },
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
|
15
|
+
return Sizable[origin] ?? null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const FormatDictionary: {
|
|
19
|
+
[k in $ZodStringFormats | (string & {})]?: string;
|
|
20
|
+
} = {
|
|
21
|
+
regex: "είσοδος",
|
|
22
|
+
email: "διεύθυνση email",
|
|
23
|
+
url: "URL",
|
|
24
|
+
emoji: "emoji",
|
|
25
|
+
uuid: "UUID",
|
|
26
|
+
uuidv4: "UUIDv4",
|
|
27
|
+
uuidv6: "UUIDv6",
|
|
28
|
+
nanoid: "nanoid",
|
|
29
|
+
guid: "GUID",
|
|
30
|
+
cuid: "cuid",
|
|
31
|
+
cuid2: "cuid2",
|
|
32
|
+
ulid: "ULID",
|
|
33
|
+
xid: "XID",
|
|
34
|
+
ksuid: "KSUID",
|
|
35
|
+
datetime: "ISO ημερομηνία και ώρα",
|
|
36
|
+
date: "ISO ημερομηνία",
|
|
37
|
+
time: "ISO ώρα",
|
|
38
|
+
duration: "ISO διάρκεια",
|
|
39
|
+
ipv4: "διεύθυνση IPv4",
|
|
40
|
+
ipv6: "διεύθυνση IPv6",
|
|
41
|
+
mac: "διεύθυνση MAC",
|
|
42
|
+
cidrv4: "εύρος IPv4",
|
|
43
|
+
cidrv6: "εύρος IPv6",
|
|
44
|
+
base64: "συμβολοσειρά κωδικοποιημένη σε base64",
|
|
45
|
+
base64url: "συμβολοσειρά κωδικοποιημένη σε base64url",
|
|
46
|
+
json_string: "συμβολοσειρά JSON",
|
|
47
|
+
e164: "αριθμός E.164",
|
|
48
|
+
jwt: "JWT",
|
|
49
|
+
template_literal: "είσοδος",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const TypeDictionary: {
|
|
53
|
+
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
|
|
54
|
+
} = {
|
|
55
|
+
nan: "NaN",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (issue) => {
|
|
59
|
+
switch (issue.code) {
|
|
60
|
+
case "invalid_type": {
|
|
61
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
62
|
+
const receivedType = util.parsedType(issue.input);
|
|
63
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
64
|
+
if (typeof issue.expected === "string" && /^[A-Z]/.test(issue.expected)) {
|
|
65
|
+
return `Μη έγκυρη είσοδος: αναμενόταν instanceof ${issue.expected}, λήφθηκε ${received}`;
|
|
66
|
+
}
|
|
67
|
+
return `Μη έγκυρη είσοδος: αναμενόταν ${expected}, λήφθηκε ${received}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
case "invalid_value":
|
|
71
|
+
if (issue.values.length === 1)
|
|
72
|
+
return `Μη έγκυρη είσοδος: αναμενόταν ${util.stringifyPrimitive(issue.values[0])}`;
|
|
73
|
+
return `Μη έγκυρη επιλογή: αναμενόταν ένα από ${util.joinValues(issue.values, "|")}`;
|
|
74
|
+
case "too_big": {
|
|
75
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
76
|
+
const sizing = getSizing(issue.origin);
|
|
77
|
+
if (sizing)
|
|
78
|
+
return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να έχει ${adj}${issue.maximum.toString()} ${sizing.unit ?? "στοιχεία"}`;
|
|
79
|
+
return `Πολύ μεγάλο: αναμενόταν ${issue.origin ?? "τιμή"} να είναι ${adj}${issue.maximum.toString()}`;
|
|
80
|
+
}
|
|
81
|
+
case "too_small": {
|
|
82
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
83
|
+
const sizing = getSizing(issue.origin);
|
|
84
|
+
if (sizing) {
|
|
85
|
+
return `Πολύ μικρό: αναμενόταν ${issue.origin} να έχει ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return `Πολύ μικρό: αναμενόταν ${issue.origin} να είναι ${adj}${issue.minimum.toString()}`;
|
|
89
|
+
}
|
|
90
|
+
case "invalid_format": {
|
|
91
|
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
|
92
|
+
if (_issue.format === "starts_with") {
|
|
93
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${_issue.prefix}"`;
|
|
94
|
+
}
|
|
95
|
+
if (_issue.format === "ends_with") return `Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${_issue.suffix}"`;
|
|
96
|
+
if (_issue.format === "includes") return `Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${_issue.includes}"`;
|
|
97
|
+
if (_issue.format === "regex")
|
|
98
|
+
return `Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${_issue.pattern}`;
|
|
99
|
+
return `Μη έγκυρο: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
100
|
+
}
|
|
101
|
+
case "not_multiple_of":
|
|
102
|
+
return `Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${issue.divisor}`;
|
|
103
|
+
case "unrecognized_keys":
|
|
104
|
+
return `Άγνωστ${issue.keys.length > 1 ? "α" : "ο"} κλειδ${issue.keys.length > 1 ? "ιά" : "ί"}: ${util.joinValues(issue.keys, ", ")}`;
|
|
105
|
+
case "invalid_key":
|
|
106
|
+
return `Μη έγκυρο κλειδί στο ${issue.origin}`;
|
|
107
|
+
case "invalid_union":
|
|
108
|
+
return "Μη έγκυρη είσοδος";
|
|
109
|
+
case "invalid_element":
|
|
110
|
+
return `Μη έγκυρη τιμή στο ${issue.origin}`;
|
|
111
|
+
default:
|
|
112
|
+
return `Μη έγκυρη είσοδος`;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
|
118
|
+
return {
|
|
119
|
+
localeError: error(),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -103,6 +103,10 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
103
103
|
case "invalid_key":
|
|
104
104
|
return `Invalid key in ${issue.origin}`;
|
|
105
105
|
case "invalid_union":
|
|
106
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
107
|
+
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
108
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
109
|
+
}
|
|
106
110
|
return "Invalid input";
|
|
107
111
|
case "invalid_element":
|
|
108
112
|
return `Invalid value in ${issue.origin}`;
|
|
@@ -50,9 +50,27 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
50
50
|
const TypeDictionary: {
|
|
51
51
|
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
|
|
52
52
|
} = {
|
|
53
|
-
|
|
53
|
+
string: "chaîne",
|
|
54
54
|
number: "nombre",
|
|
55
|
+
int: "entier",
|
|
56
|
+
boolean: "booléen",
|
|
57
|
+
bigint: "grand entier",
|
|
58
|
+
symbol: "symbole",
|
|
59
|
+
undefined: "indéfini",
|
|
60
|
+
null: "null",
|
|
61
|
+
never: "jamais",
|
|
62
|
+
void: "vide",
|
|
63
|
+
date: "date",
|
|
55
64
|
array: "tableau",
|
|
65
|
+
object: "objet",
|
|
66
|
+
tuple: "tuple",
|
|
67
|
+
record: "enregistrement",
|
|
68
|
+
map: "carte",
|
|
69
|
+
set: "ensemble",
|
|
70
|
+
file: "fichier",
|
|
71
|
+
nonoptional: "non-optionnel",
|
|
72
|
+
nan: "NaN",
|
|
73
|
+
function: "fonction",
|
|
56
74
|
};
|
|
57
75
|
|
|
58
76
|
return (issue) => {
|
|
@@ -73,17 +91,15 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
73
91
|
const adj = issue.inclusive ? "<=" : "<";
|
|
74
92
|
const sizing = getSizing(issue.origin);
|
|
75
93
|
if (sizing)
|
|
76
|
-
return `Trop grand : ${issue.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
|
77
|
-
return `Trop grand : ${issue.origin ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
|
94
|
+
return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
|
95
|
+
return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
|
78
96
|
}
|
|
79
97
|
case "too_small": {
|
|
80
98
|
const adj = issue.inclusive ? ">=" : ">";
|
|
81
99
|
const sizing = getSizing(issue.origin);
|
|
82
|
-
if (sizing)
|
|
83
|
-
return `Trop petit : ${issue.origin} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return `Trop petit : ${issue.origin} doit être ${adj}${issue.minimum.toString()}`;
|
|
100
|
+
if (sizing)
|
|
101
|
+
return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
102
|
+
return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.minimum.toString()}`;
|
|
87
103
|
}
|
|
88
104
|
case "invalid_format": {
|
|
89
105
|
const _issue = issue as errors.$ZodStringFormatIssues;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { $ZodStringFormats } from "../core/checks.js";
|
|
2
|
+
import type * as errors from "../core/errors.js";
|
|
3
|
+
import * as util from "../core/util.js";
|
|
4
|
+
|
|
5
|
+
const error: () => errors.$ZodErrorMap = () => {
|
|
6
|
+
const Sizable: Record<string, { unit: string; verb: string }> = {
|
|
7
|
+
string: { unit: "znakova", verb: "imati" },
|
|
8
|
+
file: { unit: "bajtova", verb: "imati" },
|
|
9
|
+
array: { unit: "stavki", verb: "imati" },
|
|
10
|
+
set: { unit: "stavki", verb: "imati" },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
|
14
|
+
return Sizable[origin] ?? null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const FormatDictionary: {
|
|
18
|
+
[k in $ZodStringFormats | (string & {})]?: string;
|
|
19
|
+
} = {
|
|
20
|
+
regex: "unos",
|
|
21
|
+
email: "email adresa",
|
|
22
|
+
url: "URL",
|
|
23
|
+
emoji: "emoji",
|
|
24
|
+
uuid: "UUID",
|
|
25
|
+
uuidv4: "UUIDv4",
|
|
26
|
+
uuidv6: "UUIDv6",
|
|
27
|
+
nanoid: "nanoid",
|
|
28
|
+
guid: "GUID",
|
|
29
|
+
cuid: "cuid",
|
|
30
|
+
cuid2: "cuid2",
|
|
31
|
+
ulid: "ULID",
|
|
32
|
+
xid: "XID",
|
|
33
|
+
ksuid: "KSUID",
|
|
34
|
+
datetime: "ISO datum i vrijeme",
|
|
35
|
+
date: "ISO datum",
|
|
36
|
+
time: "ISO vrijeme",
|
|
37
|
+
duration: "ISO trajanje",
|
|
38
|
+
ipv4: "IPv4 adresa",
|
|
39
|
+
ipv6: "IPv6 adresa",
|
|
40
|
+
cidrv4: "IPv4 raspon",
|
|
41
|
+
cidrv6: "IPv6 raspon",
|
|
42
|
+
base64: "base64 kodirani tekst",
|
|
43
|
+
base64url: "base64url kodirani tekst",
|
|
44
|
+
json_string: "JSON tekst",
|
|
45
|
+
e164: "E.164 broj",
|
|
46
|
+
jwt: "JWT",
|
|
47
|
+
template_literal: "unos",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const TypeDictionary: {
|
|
51
|
+
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
|
|
52
|
+
} = {
|
|
53
|
+
nan: "NaN",
|
|
54
|
+
string: "tekst",
|
|
55
|
+
number: "broj",
|
|
56
|
+
boolean: "boolean",
|
|
57
|
+
array: "niz",
|
|
58
|
+
object: "objekt",
|
|
59
|
+
set: "skup",
|
|
60
|
+
file: "datoteka",
|
|
61
|
+
date: "datum",
|
|
62
|
+
bigint: "bigint",
|
|
63
|
+
symbol: "simbol",
|
|
64
|
+
undefined: "undefined",
|
|
65
|
+
null: "null",
|
|
66
|
+
function: "funkcija",
|
|
67
|
+
map: "mapa",
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return (issue) => {
|
|
71
|
+
switch (issue.code) {
|
|
72
|
+
case "invalid_type": {
|
|
73
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
74
|
+
const receivedType = util.parsedType(issue.input);
|
|
75
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
76
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
77
|
+
return `Neispravan unos: očekuje se instanceof ${issue.expected}, a primljeno je ${received}`;
|
|
78
|
+
}
|
|
79
|
+
return `Neispravan unos: očekuje se ${expected}, a primljeno je ${received}`;
|
|
80
|
+
}
|
|
81
|
+
case "invalid_value":
|
|
82
|
+
if (issue.values.length === 1)
|
|
83
|
+
return `Neispravna vrijednost: očekivano ${util.stringifyPrimitive(issue.values[0])}`;
|
|
84
|
+
return `Neispravna opcija: očekivano jedno od ${util.joinValues(issue.values, "|")}`;
|
|
85
|
+
case "too_big": {
|
|
86
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
87
|
+
const sizing = getSizing(issue.origin);
|
|
88
|
+
const origin = TypeDictionary[issue.origin] ?? issue.origin;
|
|
89
|
+
if (sizing)
|
|
90
|
+
return `Preveliko: očekivano da ${origin ?? "vrijednost"} ima ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemenata"}`;
|
|
91
|
+
return `Preveliko: očekivano da ${origin ?? "vrijednost"} bude ${adj}${issue.maximum.toString()}`;
|
|
92
|
+
}
|
|
93
|
+
case "too_small": {
|
|
94
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
95
|
+
const sizing = getSizing(issue.origin);
|
|
96
|
+
const origin = TypeDictionary[issue.origin] ?? issue.origin;
|
|
97
|
+
if (sizing) {
|
|
98
|
+
return `Premalo: očekivano da ${origin} ima ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return `Premalo: očekivano da ${origin} bude ${adj}${issue.minimum.toString()}`;
|
|
102
|
+
}
|
|
103
|
+
case "invalid_format": {
|
|
104
|
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
|
105
|
+
if (_issue.format === "starts_with") return `Neispravan tekst: mora započinjati s "${_issue.prefix}"`;
|
|
106
|
+
if (_issue.format === "ends_with") return `Neispravan tekst: mora završavati s "${_issue.suffix}"`;
|
|
107
|
+
if (_issue.format === "includes") return `Neispravan tekst: mora sadržavati "${_issue.includes}"`;
|
|
108
|
+
if (_issue.format === "regex") return `Neispravan tekst: mora odgovarati uzorku ${_issue.pattern}`;
|
|
109
|
+
return `Neispravna ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
110
|
+
}
|
|
111
|
+
case "not_multiple_of":
|
|
112
|
+
return `Neispravan broj: mora biti višekratnik od ${issue.divisor}`;
|
|
113
|
+
case "unrecognized_keys":
|
|
114
|
+
return `Neprepoznat${issue.keys.length > 1 ? "i ključevi" : " ključ"}: ${util.joinValues(issue.keys, ", ")}`;
|
|
115
|
+
case "invalid_key":
|
|
116
|
+
return `Neispravan ključ u ${TypeDictionary[issue.origin] ?? issue.origin}`;
|
|
117
|
+
case "invalid_union":
|
|
118
|
+
return "Neispravan unos";
|
|
119
|
+
case "invalid_element":
|
|
120
|
+
return `Neispravna vrijednost u ${TypeDictionary[issue.origin] ?? issue.origin}`;
|
|
121
|
+
default:
|
|
122
|
+
return `Neispravan unos`;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
|
128
|
+
return {
|
|
129
|
+
localeError: error(),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -6,6 +6,7 @@ export { default as ca } from "./ca.js";
|
|
|
6
6
|
export { default as cs } from "./cs.js";
|
|
7
7
|
export { default as da } from "./da.js";
|
|
8
8
|
export { default as de } from "./de.js";
|
|
9
|
+
export { default as el } from "./el.js";
|
|
9
10
|
export { default as en } from "./en.js";
|
|
10
11
|
export { default as eo } from "./eo.js";
|
|
11
12
|
export { default as es } from "./es.js";
|
|
@@ -14,6 +15,7 @@ export { default as fi } from "./fi.js";
|
|
|
14
15
|
export { default as fr } from "./fr.js";
|
|
15
16
|
export { default as frCA } from "./fr-CA.js";
|
|
16
17
|
export { default as he } from "./he.js";
|
|
18
|
+
export { default as hr } from "./hr.js";
|
|
17
19
|
export { default as hu } from "./hu.js";
|
|
18
20
|
export { default as hy } from "./hy.js";
|
|
19
21
|
export { default as id } from "./id.js";
|
|
@@ -33,6 +35,7 @@ export { default as ota } from "./ota.js";
|
|
|
33
35
|
export { default as ps } from "./ps.js";
|
|
34
36
|
export { default as pl } from "./pl.js";
|
|
35
37
|
export { default as pt } from "./pt.js";
|
|
38
|
+
export { default as ro } from "./ro.js";
|
|
36
39
|
export { default as ru } from "./ru.js";
|
|
37
40
|
export { default as sl } from "./sl.js";
|
|
38
41
|
export { default as sv } from "./sv.js";
|
|
@@ -91,7 +91,7 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
91
91
|
if (_issue.format === "ends_with") return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
|
|
92
92
|
if (_issue.format === "includes") return `Stringa non valida: deve includere "${_issue.includes}"`;
|
|
93
93
|
if (_issue.format === "regex") return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
|
|
94
|
-
return `
|
|
94
|
+
return `Input non valido: ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
95
95
|
}
|
|
96
96
|
case "not_multiple_of":
|
|
97
97
|
return `Numero non valido: deve essere un multiplo di ${issue.divisor}`;
|
|
@@ -39,9 +39,9 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
39
39
|
ipv6: "IPv6 მისამართი",
|
|
40
40
|
cidrv4: "IPv4 დიაპაზონი",
|
|
41
41
|
cidrv6: "IPv6 დიაპაზონი",
|
|
42
|
-
base64: "base64-კოდირებული
|
|
43
|
-
base64url: "base64url-კოდირებული
|
|
44
|
-
json_string: "JSON
|
|
42
|
+
base64: "base64-კოდირებული ველი",
|
|
43
|
+
base64url: "base64url-კოდირებული ველი",
|
|
44
|
+
json_string: "JSON ველი",
|
|
45
45
|
e164: "E.164 ნომერი",
|
|
46
46
|
jwt: "JWT",
|
|
47
47
|
template_literal: "შეყვანა",
|
|
@@ -52,7 +52,7 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
52
52
|
} = {
|
|
53
53
|
nan: "NaN",
|
|
54
54
|
number: "რიცხვი",
|
|
55
|
-
string: "
|
|
55
|
+
string: "ველი",
|
|
56
56
|
boolean: "ბულეანი",
|
|
57
57
|
function: "ფუნქცია",
|
|
58
58
|
array: "მასივი",
|
|
@@ -93,11 +93,11 @@ const error: () => errors.$ZodErrorMap = () => {
|
|
|
93
93
|
case "invalid_format": {
|
|
94
94
|
const _issue = issue as errors.$ZodStringFormatIssues;
|
|
95
95
|
if (_issue.format === "starts_with") {
|
|
96
|
-
return `არასწორი
|
|
96
|
+
return `არასწორი ველი: უნდა იწყებოდეს "${_issue.prefix}"-ით`;
|
|
97
97
|
}
|
|
98
|
-
if (_issue.format === "ends_with") return `არასწორი
|
|
99
|
-
if (_issue.format === "includes") return `არასწორი
|
|
100
|
-
if (_issue.format === "regex") return `არასწორი
|
|
98
|
+
if (_issue.format === "ends_with") return `არასწორი ველი: უნდა მთავრდებოდეს "${_issue.suffix}"-ით`;
|
|
99
|
+
if (_issue.format === "includes") return `არასწორი ველი: უნდა შეიცავდეს "${_issue.includes}"-ს`;
|
|
100
|
+
if (_issue.format === "regex") return `არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${_issue.pattern}`;
|
|
101
101
|
return `არასწორი ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
102
102
|
}
|
|
103
103
|
case "not_multiple_of":
|