Spaces:
Paused
Paused
Upload folder using huggingface_hub (part 10)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4-mini/index.ts +1 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/errors.ts +424 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/function.ts +176 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/index.ts +15 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/json-schema.ts +143 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/parse.ts +94 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/regexes.ts +135 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/registries.ts +96 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/schemas.ts +0 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/util.ts +775 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/versions.ts +5 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/zsf.ts +323 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/index.ts +4 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ar.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/az.ts +121 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/be.ts +184 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ca.ts +127 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/cs.ts +142 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/de.ts +124 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/en.ts +127 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/eo.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/es.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fa.ts +134 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fi.ts +131 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fr.ts +124 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/he.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/hu.ts +126 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/id.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/index.ts +39 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/it.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ja.ts +122 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/kh.ts +126 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ko.ts +131 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/mk.ts +127 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ms.ts +124 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/nl.ts +126 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/no.ts +124 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ota.ts +125 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/pl.ts +126 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ps.ts +133 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/pt.ts +123 -0
- node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ru.ts +184 -0
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4-mini/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export * from "../v4/mini/index.js";
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/errors.ts
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { $ZodCheck, $ZodStringFormats } from "./checks.js";
|
| 2 |
+
import { $constructor } from "./core.js";
|
| 3 |
+
import type { $ZodType } from "./schemas.js";
|
| 4 |
+
import * as util from "./util.js";
|
| 5 |
+
|
| 6 |
+
///////////////////////////
|
| 7 |
+
//// base type ////
|
| 8 |
+
///////////////////////////
|
| 9 |
+
export interface $ZodIssueBase {
|
| 10 |
+
readonly code?: string;
|
| 11 |
+
readonly input?: unknown;
|
| 12 |
+
readonly path: PropertyKey[];
|
| 13 |
+
readonly message: string;
|
| 14 |
+
// [k: string]: unknown;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
////////////////////////////////
|
| 18 |
+
//// issue subtypes ////
|
| 19 |
+
////////////////////////////////
|
| 20 |
+
export interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
|
| 21 |
+
readonly code: "invalid_type";
|
| 22 |
+
readonly expected: $ZodType["_zod"]["def"]["type"];
|
| 23 |
+
readonly input: Input;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
| 27 |
+
readonly code: "too_big";
|
| 28 |
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
| 29 |
+
readonly maximum: number | bigint;
|
| 30 |
+
readonly inclusive?: boolean;
|
| 31 |
+
readonly exact?: boolean;
|
| 32 |
+
readonly input: Input;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
| 36 |
+
readonly code: "too_small";
|
| 37 |
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
| 38 |
+
readonly minimum: number | bigint;
|
| 39 |
+
/** True if the allowable range includes the minimum */
|
| 40 |
+
readonly inclusive?: boolean;
|
| 41 |
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
| 42 |
+
readonly exact?: boolean;
|
| 43 |
+
readonly input: Input;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
export interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
| 47 |
+
readonly code: "invalid_format";
|
| 48 |
+
readonly format: $ZodStringFormats | (string & {});
|
| 49 |
+
readonly pattern?: string;
|
| 50 |
+
readonly input: string;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
export interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
|
| 54 |
+
readonly code: "not_multiple_of";
|
| 55 |
+
readonly divisor: number;
|
| 56 |
+
readonly input: Input;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
export interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
|
| 60 |
+
readonly code: "unrecognized_keys";
|
| 61 |
+
readonly keys: string[];
|
| 62 |
+
readonly input: Record<string, unknown>;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
export interface $ZodIssueInvalidUnion extends $ZodIssueBase {
|
| 66 |
+
readonly code: "invalid_union";
|
| 67 |
+
readonly errors: $ZodIssue[][];
|
| 68 |
+
readonly input: unknown;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
export interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
|
| 72 |
+
readonly code: "invalid_key";
|
| 73 |
+
readonly origin: "map" | "record";
|
| 74 |
+
readonly issues: $ZodIssue[];
|
| 75 |
+
readonly input: Input;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
export interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
|
| 79 |
+
readonly code: "invalid_element";
|
| 80 |
+
readonly origin: "map" | "set";
|
| 81 |
+
readonly key: unknown;
|
| 82 |
+
readonly issues: $ZodIssue[];
|
| 83 |
+
readonly input: Input;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
export interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
|
| 87 |
+
readonly code: "invalid_value";
|
| 88 |
+
readonly values: util.Primitive[];
|
| 89 |
+
readonly input: Input;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
export interface $ZodIssueCustom extends $ZodIssueBase {
|
| 93 |
+
readonly code: "custom";
|
| 94 |
+
readonly params?: Record<string, any> | undefined;
|
| 95 |
+
readonly input: unknown;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
////////////////////////////////////////////
|
| 99 |
+
//// first-party string formats ////
|
| 100 |
+
////////////////////////////////////////////
|
| 101 |
+
|
| 102 |
+
export interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {
|
| 103 |
+
format: Exclude<$ZodStringFormats, "regex" | "jwt" | "starts_with" | "ends_with" | "includes">;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
export interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {
|
| 107 |
+
format: "regex";
|
| 108 |
+
pattern: string;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
export interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {
|
| 112 |
+
format: "jwt";
|
| 113 |
+
algorithm?: string;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
export interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {
|
| 117 |
+
format: "starts_with";
|
| 118 |
+
prefix: string;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
export interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {
|
| 122 |
+
format: "ends_with";
|
| 123 |
+
suffix: string;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
export interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {
|
| 127 |
+
format: "includes";
|
| 128 |
+
includes: string;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
export type $ZodStringFormatIssues =
|
| 132 |
+
| $ZodIssueStringCommonFormats
|
| 133 |
+
| $ZodIssueStringInvalidRegex
|
| 134 |
+
| $ZodIssueStringInvalidJWT
|
| 135 |
+
| $ZodIssueStringStartsWith
|
| 136 |
+
| $ZodIssueStringEndsWith
|
| 137 |
+
| $ZodIssueStringIncludes;
|
| 138 |
+
|
| 139 |
+
////////////////////////
|
| 140 |
+
//// utils /////
|
| 141 |
+
////////////////////////
|
| 142 |
+
|
| 143 |
+
export type $ZodIssue =
|
| 144 |
+
| $ZodIssueInvalidType
|
| 145 |
+
| $ZodIssueTooBig
|
| 146 |
+
| $ZodIssueTooSmall
|
| 147 |
+
| $ZodIssueInvalidStringFormat
|
| 148 |
+
| $ZodIssueNotMultipleOf
|
| 149 |
+
| $ZodIssueUnrecognizedKeys
|
| 150 |
+
| $ZodIssueInvalidUnion
|
| 151 |
+
| $ZodIssueInvalidKey
|
| 152 |
+
| $ZodIssueInvalidElement
|
| 153 |
+
| $ZodIssueInvalidValue
|
| 154 |
+
| $ZodIssueCustom;
|
| 155 |
+
|
| 156 |
+
export type $ZodIssueCode = $ZodIssue["code"];
|
| 157 |
+
|
| 158 |
+
export type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
| 159 |
+
type RawIssue<T extends $ZodIssueBase> = util.Flatten<
|
| 160 |
+
util.MakePartial<T, "message" | "path"> & {
|
| 161 |
+
/** The input data */
|
| 162 |
+
readonly input?: unknown;
|
| 163 |
+
/** The schema or check that originated this issue. */
|
| 164 |
+
readonly inst?: $ZodType | $ZodCheck;
|
| 165 |
+
/** @deprecated Internal use only. If `true`, Zod will continue executing validation despite this issue. */
|
| 166 |
+
readonly continue?: boolean | undefined;
|
| 167 |
+
} & Record<string, any>
|
| 168 |
+
>;
|
| 169 |
+
|
| 170 |
+
export interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
|
| 171 |
+
// biome-ignore lint:
|
| 172 |
+
(issue: $ZodRawIssue<T>): { message: string } | string | undefined | null;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
//////////////////////// ERROR CLASS ////////////////////////
|
| 176 |
+
|
| 177 |
+
// const ZOD_ERROR: symbol = Symbol.for("{{zod.error}}");
|
| 178 |
+
export interface $ZodError<T = unknown> extends Error {
|
| 179 |
+
type: T;
|
| 180 |
+
issues: $ZodIssue[];
|
| 181 |
+
_zod: {
|
| 182 |
+
output: T;
|
| 183 |
+
def: $ZodIssue[];
|
| 184 |
+
};
|
| 185 |
+
stack?: string;
|
| 186 |
+
name: string;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
const initializer = (inst: $ZodError, def: $ZodIssue[]): void => {
|
| 190 |
+
inst.name = "$ZodError";
|
| 191 |
+
Object.defineProperty(inst, "_zod", {
|
| 192 |
+
value: inst._zod,
|
| 193 |
+
enumerable: false,
|
| 194 |
+
});
|
| 195 |
+
Object.defineProperty(inst, "issues", {
|
| 196 |
+
value: def,
|
| 197 |
+
enumerable: false,
|
| 198 |
+
});
|
| 199 |
+
Object.defineProperty(inst, "message", {
|
| 200 |
+
get() {
|
| 201 |
+
return JSON.stringify(def, util.jsonStringifyReplacer, 2);
|
| 202 |
+
},
|
| 203 |
+
enumerable: true,
|
| 204 |
+
// configurable: false,
|
| 205 |
+
});
|
| 206 |
+
Object.defineProperty(inst, "toString", {
|
| 207 |
+
value: () => inst.message,
|
| 208 |
+
enumerable: false,
|
| 209 |
+
});
|
| 210 |
+
};
|
| 211 |
+
|
| 212 |
+
export const $ZodError: $constructor<$ZodError> = $constructor("$ZodError", initializer);
|
| 213 |
+
interface $ZodRealError<T = any> extends $ZodError<T> {}
|
| 214 |
+
export const $ZodRealError: $constructor<$ZodRealError> = $constructor("$ZodError", initializer, { Parent: Error });
|
| 215 |
+
|
| 216 |
+
/////////////////// ERROR UTILITIES ////////////////////////
|
| 217 |
+
|
| 218 |
+
// flatten
|
| 219 |
+
export type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
|
| 220 |
+
type _FlattenedError<T, U = string> = {
|
| 221 |
+
formErrors: U[];
|
| 222 |
+
fieldErrors: {
|
| 223 |
+
[P in keyof T]?: U[];
|
| 224 |
+
};
|
| 225 |
+
};
|
| 226 |
+
|
| 227 |
+
export function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;
|
| 228 |
+
export function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;
|
| 229 |
+
export function flattenError(error: $ZodError, mapper = (issue: $ZodIssue) => issue.message): any {
|
| 230 |
+
const fieldErrors: any = {};
|
| 231 |
+
const formErrors: any[] = [];
|
| 232 |
+
for (const sub of error.issues) {
|
| 233 |
+
if (sub.path.length > 0) {
|
| 234 |
+
fieldErrors[sub.path[0]!] = fieldErrors[sub.path[0]!] || [];
|
| 235 |
+
fieldErrors[sub.path[0]!].push(mapper(sub));
|
| 236 |
+
} else {
|
| 237 |
+
formErrors.push(mapper(sub));
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
return { formErrors, fieldErrors };
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]]
|
| 244 |
+
? { [K in keyof T]?: $ZodFormattedError<T[K], U> }
|
| 245 |
+
: T extends any[]
|
| 246 |
+
? { [k: number]: $ZodFormattedError<T[number], U> }
|
| 247 |
+
: T extends object
|
| 248 |
+
? util.Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U> }>
|
| 249 |
+
: any;
|
| 250 |
+
|
| 251 |
+
export type $ZodFormattedError<T, U = string> = {
|
| 252 |
+
_errors: U[];
|
| 253 |
+
} & util.Flatten<_ZodFormattedError<T, U>>;
|
| 254 |
+
|
| 255 |
+
export function formatError<T>(error: $ZodError<T>): $ZodFormattedError<T>;
|
| 256 |
+
export function formatError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
|
| 257 |
+
export function formatError<T>(error: $ZodError, _mapper?: any) {
|
| 258 |
+
const mapper: (issue: $ZodIssue) => any =
|
| 259 |
+
_mapper ||
|
| 260 |
+
function (issue: $ZodIssue) {
|
| 261 |
+
return issue.message;
|
| 262 |
+
};
|
| 263 |
+
const fieldErrors: $ZodFormattedError<T> = { _errors: [] } as any;
|
| 264 |
+
const processError = (error: { issues: $ZodIssue[] }) => {
|
| 265 |
+
for (const issue of error.issues) {
|
| 266 |
+
if (issue.code === "invalid_union" && issue.errors.length) {
|
| 267 |
+
issue.errors.map((issues) => processError({ issues }));
|
| 268 |
+
} else if (issue.code === "invalid_key") {
|
| 269 |
+
processError({ issues: issue.issues });
|
| 270 |
+
} else if (issue.code === "invalid_element") {
|
| 271 |
+
processError({ issues: issue.issues });
|
| 272 |
+
} else if (issue.path.length === 0) {
|
| 273 |
+
(fieldErrors as any)._errors.push(mapper(issue));
|
| 274 |
+
} else {
|
| 275 |
+
let curr: any = fieldErrors;
|
| 276 |
+
let i = 0;
|
| 277 |
+
while (i < issue.path.length) {
|
| 278 |
+
const el = issue.path[i]!;
|
| 279 |
+
const terminal = i === issue.path.length - 1;
|
| 280 |
+
|
| 281 |
+
if (!terminal) {
|
| 282 |
+
curr[el] = curr[el] || { _errors: [] };
|
| 283 |
+
} else {
|
| 284 |
+
curr[el] = curr[el] || { _errors: [] };
|
| 285 |
+
curr[el]._errors.push(mapper(issue));
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
curr = curr[el];
|
| 289 |
+
i++;
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
};
|
| 294 |
+
processError(error);
|
| 295 |
+
return fieldErrors;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
export type $ZodErrorTree<T, U = string> = T extends [any, ...any[]]
|
| 299 |
+
? { errors: U[]; items?: { [K in keyof T]?: $ZodErrorTree<T[K], U> } }
|
| 300 |
+
: T extends any[]
|
| 301 |
+
? { errors: U[]; items?: Array<$ZodErrorTree<T[number], U>> }
|
| 302 |
+
: T extends object
|
| 303 |
+
? { errors: U[]; properties?: { [K in keyof T]?: $ZodErrorTree<T[K], U> } }
|
| 304 |
+
: { errors: U[] };
|
| 305 |
+
|
| 306 |
+
export function treeifyError<T>(error: $ZodError<T>): $ZodErrorTree<T>;
|
| 307 |
+
export function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodErrorTree<T, U>;
|
| 308 |
+
export function treeifyError<T>(error: $ZodError, _mapper?: any) {
|
| 309 |
+
const mapper: (issue: $ZodIssue) => any =
|
| 310 |
+
_mapper ||
|
| 311 |
+
function (issue: $ZodIssue) {
|
| 312 |
+
return issue.message;
|
| 313 |
+
};
|
| 314 |
+
const result: $ZodErrorTree<T> = { errors: [] } as any;
|
| 315 |
+
const processError = (error: { issues: $ZodIssue[] }, path: PropertyKey[] = []) => {
|
| 316 |
+
for (const issue of error.issues) {
|
| 317 |
+
if (issue.code === "invalid_union" && issue.errors.length) {
|
| 318 |
+
// regular union error
|
| 319 |
+
issue.errors.map((issues) => processError({ issues }, issue.path));
|
| 320 |
+
} else if (issue.code === "invalid_key") {
|
| 321 |
+
processError({ issues: issue.issues }, issue.path);
|
| 322 |
+
} else if (issue.code === "invalid_element") {
|
| 323 |
+
processError({ issues: issue.issues }, issue.path);
|
| 324 |
+
} else {
|
| 325 |
+
const fullpath = [...path, ...issue.path];
|
| 326 |
+
if (fullpath.length === 0) {
|
| 327 |
+
result.errors.push(mapper(issue));
|
| 328 |
+
continue;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
let curr: any = result;
|
| 332 |
+
let i = 0;
|
| 333 |
+
while (i < fullpath.length) {
|
| 334 |
+
const el = fullpath[i]!;
|
| 335 |
+
|
| 336 |
+
const terminal = i === fullpath.length - 1;
|
| 337 |
+
if (typeof el === "string") {
|
| 338 |
+
curr.properties ??= {};
|
| 339 |
+
curr.properties[el] ??= { errors: [] };
|
| 340 |
+
curr = curr.properties[el];
|
| 341 |
+
} else {
|
| 342 |
+
curr.items ??= [];
|
| 343 |
+
curr.items[el] ??= { errors: [] };
|
| 344 |
+
curr = curr.items[el];
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
if (terminal) {
|
| 348 |
+
curr.errors.push(mapper(issue));
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
i++;
|
| 352 |
+
}
|
| 353 |
+
}
|
| 354 |
+
}
|
| 355 |
+
};
|
| 356 |
+
processError(error);
|
| 357 |
+
return result;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
/** Format a ZodError as a human-readable string in the following form.
|
| 361 |
+
*
|
| 362 |
+
* From
|
| 363 |
+
*
|
| 364 |
+
* ```ts
|
| 365 |
+
* ZodError {
|
| 366 |
+
* issues: [
|
| 367 |
+
* {
|
| 368 |
+
* expected: 'string',
|
| 369 |
+
* code: 'invalid_type',
|
| 370 |
+
* path: [ 'username' ],
|
| 371 |
+
* message: 'Invalid input: expected string'
|
| 372 |
+
* },
|
| 373 |
+
* {
|
| 374 |
+
* expected: 'number',
|
| 375 |
+
* code: 'invalid_type',
|
| 376 |
+
* path: [ 'favoriteNumbers', 1 ],
|
| 377 |
+
* message: 'Invalid input: expected number'
|
| 378 |
+
* }
|
| 379 |
+
* ];
|
| 380 |
+
* }
|
| 381 |
+
* ```
|
| 382 |
+
*
|
| 383 |
+
* to
|
| 384 |
+
*
|
| 385 |
+
* ```
|
| 386 |
+
* username
|
| 387 |
+
* ✖ Expected number, received string at "username
|
| 388 |
+
* favoriteNumbers[0]
|
| 389 |
+
* ✖ Invalid input: expected number
|
| 390 |
+
* ```
|
| 391 |
+
*/
|
| 392 |
+
export function toDotPath(path: (string | number | symbol)[]): string {
|
| 393 |
+
const segs: string[] = [];
|
| 394 |
+
for (const seg of path) {
|
| 395 |
+
if (typeof seg === "number") segs.push(`[${seg}]`);
|
| 396 |
+
else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`);
|
| 397 |
+
else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`);
|
| 398 |
+
else {
|
| 399 |
+
if (segs.length) segs.push(".");
|
| 400 |
+
segs.push(seg);
|
| 401 |
+
}
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
return segs.join("");
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
interface BaseError {
|
| 408 |
+
issues: $ZodIssueBase[];
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
export function prettifyError(error: BaseError): string {
|
| 412 |
+
const lines: string[] = [];
|
| 413 |
+
// sort by path length
|
| 414 |
+
const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
|
| 415 |
+
|
| 416 |
+
// Process each issue
|
| 417 |
+
for (const issue of issues) {
|
| 418 |
+
lines.push(`✖ ${issue.message}`);
|
| 419 |
+
if (issue.path?.length) lines.push(` → at ${toDotPath(issue.path)}`);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
// Convert Map to formatted string
|
| 423 |
+
return lines.join("\n");
|
| 424 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/function.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { _array, _tuple, _unknown } from "./api.js";
|
| 2 |
+
import type * as core from "./core.js";
|
| 3 |
+
import { parse, parseAsync } from "./parse.js";
|
| 4 |
+
import * as schemas from "./schemas.js";
|
| 5 |
+
import { $ZodTuple } from "./schemas.js";
|
| 6 |
+
import type * as util from "./util.js";
|
| 7 |
+
|
| 8 |
+
//////////////////////////////////////////
|
| 9 |
+
//////////////////////////////////////////
|
| 10 |
+
////////// //////////
|
| 11 |
+
////////// $ZodFunction //////////
|
| 12 |
+
////////// //////////
|
| 13 |
+
//////////////////////////////////////////
|
| 14 |
+
//////////////////////////////////////////
|
| 15 |
+
export interface $ZodFunctionDef<
|
| 16 |
+
In extends $ZodFunctionIn = $ZodFunctionIn,
|
| 17 |
+
Out extends $ZodFunctionOut = $ZodFunctionOut,
|
| 18 |
+
> {
|
| 19 |
+
type: "function";
|
| 20 |
+
input: In;
|
| 21 |
+
output: Out;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
export type $ZodFunctionArgs = schemas.$ZodType<unknown[], unknown[]>;
|
| 25 |
+
export type $ZodFunctionIn = $ZodFunctionArgs;
|
| 26 |
+
export type $ZodFunctionOut = schemas.$ZodType;
|
| 27 |
+
|
| 28 |
+
export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
|
| 29 |
+
...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
|
| 30 |
+
) => core.input<Returns>;
|
| 31 |
+
|
| 32 |
+
export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
|
| 33 |
+
...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
|
| 34 |
+
) => util.MaybeAsync<core.input<Returns>>;
|
| 35 |
+
|
| 36 |
+
export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
|
| 37 |
+
...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
|
| 38 |
+
) => core.output<Returns>;
|
| 39 |
+
|
| 40 |
+
export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
|
| 41 |
+
...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
|
| 42 |
+
) => util.MaybeAsync<core.output<Returns>>;
|
| 43 |
+
|
| 44 |
+
export class $ZodFunction<
|
| 45 |
+
Args extends $ZodFunctionIn = $ZodFunctionIn,
|
| 46 |
+
Returns extends $ZodFunctionOut = $ZodFunctionOut,
|
| 47 |
+
> {
|
| 48 |
+
def: $ZodFunctionDef<Args, Returns>;
|
| 49 |
+
|
| 50 |
+
/** @deprecated */
|
| 51 |
+
_def!: $ZodFunctionDef<Args, Returns>;
|
| 52 |
+
_input!: $InferInnerFunctionType<Args, Returns>;
|
| 53 |
+
_output!: $InferOuterFunctionType<Args, Returns>;
|
| 54 |
+
|
| 55 |
+
constructor(def: $ZodFunctionDef<Args, Returns>) {
|
| 56 |
+
this._def = def;
|
| 57 |
+
this.def = def;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
implement<F extends $InferInnerFunctionType<Args, Returns>>(
|
| 61 |
+
func: F
|
| 62 |
+
): // allow for return type inference
|
| 63 |
+
(
|
| 64 |
+
...args: Parameters<this["_output"]>
|
| 65 |
+
) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]> {
|
| 66 |
+
if (typeof func !== "function") {
|
| 67 |
+
throw new Error("implement() must be called with a function");
|
| 68 |
+
}
|
| 69 |
+
const impl = ((...args: any[]) => {
|
| 70 |
+
const parsedArgs = this._def.input ? parse(this._def.input, args, undefined, { callee: impl }) : args;
|
| 71 |
+
if (!Array.isArray(parsedArgs)) {
|
| 72 |
+
throw new Error("Invalid arguments schema: not an array or tuple schema.");
|
| 73 |
+
}
|
| 74 |
+
const output = func(...(parsedArgs as any));
|
| 75 |
+
return this._def.output ? parse(this._def.output, output, undefined, { callee: impl }) : output;
|
| 76 |
+
}) as any;
|
| 77 |
+
return impl;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(
|
| 81 |
+
func: F
|
| 82 |
+
): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns> {
|
| 83 |
+
if (typeof func !== "function") {
|
| 84 |
+
throw new Error("implement() must be called with a function");
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
const impl = (async (...args: any[]) => {
|
| 88 |
+
const parsedArgs = this._def.input ? await parseAsync(this._def.input, args, undefined, { callee: impl }) : args;
|
| 89 |
+
if (!Array.isArray(parsedArgs)) {
|
| 90 |
+
throw new Error("Invalid arguments schema: not an array or tuple schema.");
|
| 91 |
+
}
|
| 92 |
+
const output = await func(...(parsedArgs as any));
|
| 93 |
+
return this._def.output ? parseAsync(this._def.output, output, undefined, { callee: impl }) : output;
|
| 94 |
+
}) as any;
|
| 95 |
+
return impl;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
input<const Items extends util.TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(
|
| 99 |
+
args: Items,
|
| 100 |
+
rest?: Rest
|
| 101 |
+
): $ZodFunction<schemas.$ZodTuple<Items, Rest>, Returns>;
|
| 102 |
+
input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
|
| 103 |
+
input(...args: any[]): $ZodFunction<any, Returns> {
|
| 104 |
+
const F: any = this.constructor;
|
| 105 |
+
if (Array.isArray(args[0])) {
|
| 106 |
+
return new F({
|
| 107 |
+
type: "function",
|
| 108 |
+
input: new $ZodTuple({
|
| 109 |
+
type: "tuple",
|
| 110 |
+
items: args[0],
|
| 111 |
+
rest: args[1],
|
| 112 |
+
}),
|
| 113 |
+
output: this._def.output,
|
| 114 |
+
});
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
return new F({
|
| 118 |
+
type: "function",
|
| 119 |
+
input: args[0],
|
| 120 |
+
output: this._def.output,
|
| 121 |
+
});
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
output<NewReturns extends schemas.$ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns> {
|
| 125 |
+
const F: any = this.constructor;
|
| 126 |
+
return new F({
|
| 127 |
+
type: "function",
|
| 128 |
+
input: this._def.input,
|
| 129 |
+
output,
|
| 130 |
+
});
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
export interface $ZodFunctionParams<I extends $ZodFunctionIn, O extends schemas.$ZodType> {
|
| 135 |
+
input?: I;
|
| 136 |
+
output?: O;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
function _function(): $ZodFunction;
|
| 140 |
+
function _function<const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>>(params: {
|
| 141 |
+
input: In;
|
| 142 |
+
}): $ZodFunction<$ZodTuple<In, null>, $ZodFunctionOut>;
|
| 143 |
+
function _function<
|
| 144 |
+
const In extends Array<schemas.$ZodType> = Array<schemas.$ZodType>,
|
| 145 |
+
const Out extends $ZodFunctionOut = $ZodFunctionOut,
|
| 146 |
+
>(params: {
|
| 147 |
+
input: In;
|
| 148 |
+
output: Out;
|
| 149 |
+
}): $ZodFunction<$ZodTuple<In, null>, Out>;
|
| 150 |
+
function _function<const In extends $ZodFunctionIn = $ZodFunctionIn>(params: {
|
| 151 |
+
input: In;
|
| 152 |
+
}): $ZodFunction<In, $ZodFunctionOut>;
|
| 153 |
+
function _function<const Out extends $ZodFunctionOut = $ZodFunctionOut>(params: {
|
| 154 |
+
output: Out;
|
| 155 |
+
}): $ZodFunction<$ZodFunctionIn, Out>;
|
| 156 |
+
function _function<
|
| 157 |
+
In extends $ZodFunctionIn = $ZodFunctionIn,
|
| 158 |
+
Out extends schemas.$ZodType = schemas.$ZodType,
|
| 159 |
+
>(params?: {
|
| 160 |
+
input: In;
|
| 161 |
+
output: Out;
|
| 162 |
+
}): $ZodFunction<In, Out>;
|
| 163 |
+
function _function(params?: {
|
| 164 |
+
output?: schemas.$ZodType;
|
| 165 |
+
input?: $ZodFunctionArgs | Array<schemas.$ZodType>;
|
| 166 |
+
}): any {
|
| 167 |
+
return new $ZodFunction({
|
| 168 |
+
type: "function",
|
| 169 |
+
input: Array.isArray(params?.input)
|
| 170 |
+
? _tuple(schemas.$ZodTuple, params?.input as any)
|
| 171 |
+
: (params?.input ?? _array(schemas.$ZodArray, _unknown(schemas.$ZodUnknown))),
|
| 172 |
+
output: params?.output ?? _unknown(schemas.$ZodUnknown),
|
| 173 |
+
});
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
export { _function as function };
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export * from "./core.js";
|
| 2 |
+
export * from "./parse.js";
|
| 3 |
+
export * from "./errors.js";
|
| 4 |
+
export * from "./schemas.js";
|
| 5 |
+
export * from "./checks.js";
|
| 6 |
+
export * from "./versions.js";
|
| 7 |
+
export * as util from "./util.js";
|
| 8 |
+
export * as regexes from "./regexes.js";
|
| 9 |
+
export * as locales from "../locales/index.js";
|
| 10 |
+
export * from "./registries.js";
|
| 11 |
+
export * from "./doc.js";
|
| 12 |
+
export * from "./function.js";
|
| 13 |
+
export * from "./api.js";
|
| 14 |
+
export * from "./to-json-schema.js";
|
| 15 |
+
export * as JSONSchema from "./json-schema.js";
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/json-schema.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export type Schema =
|
| 2 |
+
| ObjectSchema
|
| 3 |
+
| ArraySchema
|
| 4 |
+
| StringSchema
|
| 5 |
+
| NumberSchema
|
| 6 |
+
| IntegerSchema
|
| 7 |
+
| BooleanSchema
|
| 8 |
+
| NullSchema;
|
| 9 |
+
|
| 10 |
+
// export type JsonType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
| 11 |
+
|
| 12 |
+
// export interface JSONSchema {
|
| 13 |
+
// type?: string ;
|
| 14 |
+
// $id?: string ;
|
| 15 |
+
// id?: string ;
|
| 16 |
+
// $schema?: string ;
|
| 17 |
+
// $ref?: string ;
|
| 18 |
+
// $anchor?: string ;
|
| 19 |
+
// $defs?: { [key: string]: JSONSchema } ;
|
| 20 |
+
// definitions?: { [key: string]: JSONSchema } ;
|
| 21 |
+
// $comment?: string ;
|
| 22 |
+
// title?: string ;
|
| 23 |
+
// description?: string ;
|
| 24 |
+
// default?: unknown ;
|
| 25 |
+
// examples?: unknown[] ;
|
| 26 |
+
// readOnly?: boolean ;
|
| 27 |
+
// writeOnly?: boolean ;
|
| 28 |
+
// deprecated?: boolean ;
|
| 29 |
+
// allOf?: JSONSchema[] ;
|
| 30 |
+
// anyOf?: JSONSchema[] ;
|
| 31 |
+
// oneOf?: JSONSchema[] ;
|
| 32 |
+
// not?: JSONSchema ;
|
| 33 |
+
// if?: JSONSchema ;
|
| 34 |
+
// then?: JSONSchema ;
|
| 35 |
+
// else?: JSONSchema ;
|
| 36 |
+
// enum?: Array<string | number | boolean | null> ;
|
| 37 |
+
// const?: string | number | boolean | null ;
|
| 38 |
+
// [k: string]: unknown;
|
| 39 |
+
|
| 40 |
+
// /** A special key used as an intermediate representation of extends-style relationships. Omitted as a $ref with additional properties. */
|
| 41 |
+
// // _ref?: JSONSchema;
|
| 42 |
+
// _prefault?: unknown ;
|
| 43 |
+
// }
|
| 44 |
+
|
| 45 |
+
export type _JSONSchema = boolean | JSONSchema;
|
| 46 |
+
export type JSONSchema = {
|
| 47 |
+
[k: string]: unknown;
|
| 48 |
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#";
|
| 49 |
+
$id?: string;
|
| 50 |
+
$anchor?: string;
|
| 51 |
+
$ref?: string;
|
| 52 |
+
$dynamicRef?: string;
|
| 53 |
+
$dynamicAnchor?: string;
|
| 54 |
+
$vocabulary?: Record<string, boolean>;
|
| 55 |
+
$comment?: string;
|
| 56 |
+
$defs?: Record<string, JSONSchema>;
|
| 57 |
+
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
| 58 |
+
additionalItems?: _JSONSchema;
|
| 59 |
+
unevaluatedItems?: _JSONSchema;
|
| 60 |
+
prefixItems?: _JSONSchema[];
|
| 61 |
+
items?: _JSONSchema | _JSONSchema[];
|
| 62 |
+
contains?: _JSONSchema;
|
| 63 |
+
additionalProperties?: _JSONSchema;
|
| 64 |
+
unevaluatedProperties?: _JSONSchema;
|
| 65 |
+
properties?: Record<string, _JSONSchema>;
|
| 66 |
+
patternProperties?: Record<string, _JSONSchema>;
|
| 67 |
+
dependentSchemas?: Record<string, _JSONSchema>;
|
| 68 |
+
propertyNames?: _JSONSchema;
|
| 69 |
+
if?: _JSONSchema;
|
| 70 |
+
then?: _JSONSchema;
|
| 71 |
+
else?: _JSONSchema;
|
| 72 |
+
allOf?: JSONSchema[];
|
| 73 |
+
anyOf?: JSONSchema[];
|
| 74 |
+
oneOf?: JSONSchema[];
|
| 75 |
+
not?: _JSONSchema;
|
| 76 |
+
multipleOf?: number;
|
| 77 |
+
maximum?: number;
|
| 78 |
+
exclusiveMaximum?: number;
|
| 79 |
+
minimum?: number;
|
| 80 |
+
exclusiveMinimum?: number;
|
| 81 |
+
maxLength?: number;
|
| 82 |
+
minLength?: number;
|
| 83 |
+
pattern?: string;
|
| 84 |
+
maxItems?: number;
|
| 85 |
+
minItems?: number;
|
| 86 |
+
uniqueItems?: boolean;
|
| 87 |
+
maxContains?: number;
|
| 88 |
+
minContains?: number;
|
| 89 |
+
maxProperties?: number;
|
| 90 |
+
minProperties?: number;
|
| 91 |
+
required?: string[];
|
| 92 |
+
dependentRequired?: Record<string, string[]>;
|
| 93 |
+
enum?: Array<string | number | boolean | null>;
|
| 94 |
+
const?: string | number | boolean | null;
|
| 95 |
+
|
| 96 |
+
// metadata
|
| 97 |
+
id?: string;
|
| 98 |
+
title?: string;
|
| 99 |
+
description?: string;
|
| 100 |
+
default?: unknown;
|
| 101 |
+
deprecated?: boolean;
|
| 102 |
+
readOnly?: boolean;
|
| 103 |
+
writeOnly?: boolean;
|
| 104 |
+
examples?: unknown[];
|
| 105 |
+
format?: string;
|
| 106 |
+
contentMediaType?: string;
|
| 107 |
+
contentEncoding?: string;
|
| 108 |
+
contentSchema?: JSONSchema;
|
| 109 |
+
|
| 110 |
+
// internal
|
| 111 |
+
_prefault?: unknown;
|
| 112 |
+
};
|
| 113 |
+
|
| 114 |
+
// for backwards compatibility
|
| 115 |
+
export type BaseSchema = JSONSchema;
|
| 116 |
+
|
| 117 |
+
export interface ObjectSchema extends JSONSchema {
|
| 118 |
+
type: "object";
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
export interface ArraySchema extends JSONSchema {
|
| 122 |
+
type: "array";
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
export interface StringSchema extends JSONSchema {
|
| 126 |
+
type: "string";
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
export interface NumberSchema extends JSONSchema {
|
| 130 |
+
type: "number";
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
export interface IntegerSchema extends JSONSchema {
|
| 134 |
+
type: "integer";
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
export interface BooleanSchema extends JSONSchema {
|
| 138 |
+
type: "boolean";
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
export interface NullSchema extends JSONSchema {
|
| 142 |
+
type: "null";
|
| 143 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/parse.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as core from "./core.js";
|
| 2 |
+
import * as errors from "./errors.js";
|
| 3 |
+
import type * as schemas from "./schemas.js";
|
| 4 |
+
import * as util from "./util.js";
|
| 5 |
+
|
| 6 |
+
export type $ZodErrorClass = { new (issues: errors.$ZodIssue[]): errors.$ZodError };
|
| 7 |
+
|
| 8 |
+
/////////// METHODS ///////////
|
| 9 |
+
export type $Parse = <T extends schemas.$ZodType>(
|
| 10 |
+
schema: T,
|
| 11 |
+
value: unknown,
|
| 12 |
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
|
| 13 |
+
_params?: { callee?: util.AnyFunc; Err?: $ZodErrorClass }
|
| 14 |
+
) => core.output<T>;
|
| 15 |
+
|
| 16 |
+
export const _parse: (_Err: $ZodErrorClass) => $Parse = (_Err) => (schema, value, _ctx, _params) => {
|
| 17 |
+
const ctx: schemas.ParseContextInternal = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
| 18 |
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
| 19 |
+
if (result instanceof Promise) {
|
| 20 |
+
throw new core.$ZodAsyncError();
|
| 21 |
+
}
|
| 22 |
+
if (result.issues.length) {
|
| 23 |
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
|
| 24 |
+
util.captureStackTrace(e, _params?.callee);
|
| 25 |
+
throw e;
|
| 26 |
+
}
|
| 27 |
+
return result.value as core.output<typeof schema>;
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
export const parse: $Parse = /* @__PURE__*/ _parse(errors.$ZodRealError);
|
| 31 |
+
|
| 32 |
+
export type $ParseAsync = <T extends schemas.$ZodType>(
|
| 33 |
+
schema: T,
|
| 34 |
+
value: unknown,
|
| 35 |
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>,
|
| 36 |
+
_params?: { callee?: util.AnyFunc; Err?: $ZodErrorClass }
|
| 37 |
+
) => Promise<core.output<T>>;
|
| 38 |
+
|
| 39 |
+
export const _parseAsync: (_Err: $ZodErrorClass) => $ParseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
| 40 |
+
const ctx: schemas.ParseContextInternal = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
| 41 |
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
| 42 |
+
if (result instanceof Promise) result = await result;
|
| 43 |
+
if (result.issues.length) {
|
| 44 |
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
|
| 45 |
+
util.captureStackTrace(e, params?.callee);
|
| 46 |
+
throw e;
|
| 47 |
+
}
|
| 48 |
+
return result.value as core.output<typeof schema>;
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
export const parseAsync: $ParseAsync = /* @__PURE__*/ _parseAsync(errors.$ZodRealError);
|
| 52 |
+
|
| 53 |
+
export type $SafeParse = <T extends schemas.$ZodType>(
|
| 54 |
+
schema: T,
|
| 55 |
+
value: unknown,
|
| 56 |
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
| 57 |
+
) => util.SafeParseResult<core.output<T>>;
|
| 58 |
+
|
| 59 |
+
export const _safeParse: (_Err: $ZodErrorClass) => $SafeParse = (_Err) => (schema, value, _ctx) => {
|
| 60 |
+
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };
|
| 61 |
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
| 62 |
+
if (result instanceof Promise) {
|
| 63 |
+
throw new core.$ZodAsyncError();
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
return result.issues.length
|
| 67 |
+
? {
|
| 68 |
+
success: false,
|
| 69 |
+
error: new (_Err ?? errors.$ZodError)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
|
| 70 |
+
}
|
| 71 |
+
: ({ success: true, data: result.value } as any);
|
| 72 |
+
};
|
| 73 |
+
export const safeParse: $SafeParse = /* @__PURE__*/ _safeParse(errors.$ZodRealError);
|
| 74 |
+
|
| 75 |
+
export type $SafeParseAsync = <T extends schemas.$ZodType>(
|
| 76 |
+
schema: T,
|
| 77 |
+
value: unknown,
|
| 78 |
+
_ctx?: schemas.ParseContext<errors.$ZodIssue>
|
| 79 |
+
) => Promise<util.SafeParseResult<core.output<T>>>;
|
| 80 |
+
|
| 81 |
+
export const _safeParseAsync: (_Err: $ZodErrorClass) => $SafeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
| 82 |
+
const ctx: schemas.ParseContextInternal = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
| 83 |
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
| 84 |
+
if (result instanceof Promise) result = await result;
|
| 85 |
+
|
| 86 |
+
return result.issues.length
|
| 87 |
+
? {
|
| 88 |
+
success: false,
|
| 89 |
+
error: new _Err(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
|
| 90 |
+
}
|
| 91 |
+
: ({ success: true, data: result.value } as any);
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
+
export const safeParseAsync: $SafeParseAsync = /* @__PURE__*/ _safeParseAsync(errors.$ZodRealError);
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/regexes.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const cuid: RegExp = /^[cC][^\s-]{8,}$/;
|
| 2 |
+
export const cuid2: RegExp = /^[0-9a-z]+$/;
|
| 3 |
+
export const ulid: RegExp = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
| 4 |
+
export const xid: RegExp = /^[0-9a-vA-V]{20}$/;
|
| 5 |
+
export const ksuid: RegExp = /^[A-Za-z0-9]{27}$/;
|
| 6 |
+
export const nanoid: RegExp = /^[a-zA-Z0-9_-]{21}$/;
|
| 7 |
+
|
| 8 |
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
| 9 |
+
export const duration: RegExp =
|
| 10 |
+
/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
| 11 |
+
|
| 12 |
+
/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */
|
| 13 |
+
export const extendedDuration: RegExp =
|
| 14 |
+
/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
| 15 |
+
|
| 16 |
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
| 17 |
+
export const guid: RegExp = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
| 18 |
+
|
| 19 |
+
/** Returns a regex for validating an RFC 4122 UUID.
|
| 20 |
+
*
|
| 21 |
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
| 22 |
+
export const uuid = (version?: number | undefined): RegExp => {
|
| 23 |
+
if (!version)
|
| 24 |
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
|
| 25 |
+
return new RegExp(
|
| 26 |
+
`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`
|
| 27 |
+
);
|
| 28 |
+
};
|
| 29 |
+
export const uuid4: RegExp = /*@__PURE__*/ uuid(4);
|
| 30 |
+
export const uuid6: RegExp = /*@__PURE__*/ uuid(6);
|
| 31 |
+
export const uuid7: RegExp = /*@__PURE__*/ uuid(7);
|
| 32 |
+
|
| 33 |
+
/** Practical email validation */
|
| 34 |
+
export const email: RegExp =
|
| 35 |
+
/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
| 36 |
+
|
| 37 |
+
/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
|
| 38 |
+
export const html5Email: RegExp =
|
| 39 |
+
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
| 40 |
+
|
| 41 |
+
/** The classic emailregex.com regex for RFC 5322-compliant emails */
|
| 42 |
+
export const rfc5322Email =
|
| 43 |
+
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
| 44 |
+
|
| 45 |
+
/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */
|
| 46 |
+
export const unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
|
| 47 |
+
|
| 48 |
+
export const browserEmail: RegExp =
|
| 49 |
+
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
| 50 |
+
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
| 51 |
+
|
| 52 |
+
export const _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
| 53 |
+
export function emoji(): RegExp {
|
| 54 |
+
return new RegExp(_emoji, "u");
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
export const ipv4: RegExp =
|
| 58 |
+
/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
| 59 |
+
export const ipv6: RegExp =
|
| 60 |
+
/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/;
|
| 61 |
+
|
| 62 |
+
export const cidrv4: RegExp =
|
| 63 |
+
/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
| 64 |
+
export const cidrv6: RegExp =
|
| 65 |
+
/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
| 66 |
+
|
| 67 |
+
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
| 68 |
+
export const base64: RegExp = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
| 69 |
+
export const base64url: RegExp = /^[A-Za-z0-9_-]*$/;
|
| 70 |
+
|
| 71 |
+
// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
| 72 |
+
// export const hostname: RegExp =
|
| 73 |
+
// /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;
|
| 74 |
+
export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
| 75 |
+
export const domain: RegExp = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
| 76 |
+
|
| 77 |
+
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
| 78 |
+
export const e164: RegExp = /^\+(?:[0-9]){6,14}[0-9]$/;
|
| 79 |
+
|
| 80 |
+
// const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
| 81 |
+
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
| 82 |
+
export const date: RegExp = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
| 83 |
+
|
| 84 |
+
function timeSource(args: { precision?: number | null | undefined }) {
|
| 85 |
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
| 86 |
+
const regex =
|
| 87 |
+
typeof args.precision === "number"
|
| 88 |
+
? args.precision === -1
|
| 89 |
+
? `${hhmm}`
|
| 90 |
+
: args.precision === 0
|
| 91 |
+
? `${hhmm}:[0-5]\\d`
|
| 92 |
+
: `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}`
|
| 93 |
+
: `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
| 94 |
+
return regex;
|
| 95 |
+
}
|
| 96 |
+
export function time(args: {
|
| 97 |
+
precision?: number | null;
|
| 98 |
+
// local?: boolean;
|
| 99 |
+
}): RegExp {
|
| 100 |
+
return new RegExp(`^${timeSource(args)}$`);
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
// Adapted from https://stackoverflow.com/a/3143231
|
| 104 |
+
export function datetime(args: {
|
| 105 |
+
precision?: number | null;
|
| 106 |
+
offset?: boolean;
|
| 107 |
+
local?: boolean;
|
| 108 |
+
}): RegExp {
|
| 109 |
+
const time = timeSource({ precision: args.precision });
|
| 110 |
+
const opts = ["Z"];
|
| 111 |
+
if (args.local) opts.push("");
|
| 112 |
+
if (args.offset) opts.push(`([+-]\\d{2}:\\d{2})`);
|
| 113 |
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
| 114 |
+
|
| 115 |
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
export const string = (params?: { minimum?: number | undefined; maximum?: number | undefined }): RegExp => {
|
| 119 |
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
| 120 |
+
return new RegExp(`^${regex}$`);
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
export const bigint: RegExp = /^\d+n?$/;
|
| 124 |
+
export const integer: RegExp = /^\d+$/;
|
| 125 |
+
export const number: RegExp = /^-?\d+(?:\.\d+)?/i;
|
| 126 |
+
export const boolean: RegExp = /true|false/i;
|
| 127 |
+
const _null: RegExp = /null/i;
|
| 128 |
+
export { _null as null };
|
| 129 |
+
const _undefined: RegExp = /undefined/i;
|
| 130 |
+
export { _undefined as undefined };
|
| 131 |
+
|
| 132 |
+
// regex for string with no uppercase letters
|
| 133 |
+
export const lowercase: RegExp = /^[^A-Z]*$/;
|
| 134 |
+
// regex for string with no lowercase letters
|
| 135 |
+
export const uppercase: RegExp = /^[^a-z]*$/;
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/registries.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type * as core from "./core.js";
|
| 2 |
+
import type { $ZodType } from "./schemas.js";
|
| 3 |
+
|
| 4 |
+
export const $output: unique symbol = Symbol("ZodOutput");
|
| 5 |
+
export type $output = typeof $output;
|
| 6 |
+
export const $input: unique symbol = Symbol("ZodInput");
|
| 7 |
+
export type $input = typeof $input;
|
| 8 |
+
|
| 9 |
+
export type $replace<Meta, S extends $ZodType> = Meta extends $output
|
| 10 |
+
? core.output<S>
|
| 11 |
+
: Meta extends $input
|
| 12 |
+
? core.input<S>
|
| 13 |
+
: Meta extends (infer M)[]
|
| 14 |
+
? $replace<M, S>[]
|
| 15 |
+
: Meta extends (...args: infer P) => infer R
|
| 16 |
+
? (
|
| 17 |
+
...args: {
|
| 18 |
+
[K in keyof P]: $replace<P[K], S>; // tuple
|
| 19 |
+
}
|
| 20 |
+
) => $replace<R, S>
|
| 21 |
+
: // handle objects
|
| 22 |
+
Meta extends object
|
| 23 |
+
? { [K in keyof Meta]: $replace<Meta[K], S> }
|
| 24 |
+
: Meta;
|
| 25 |
+
|
| 26 |
+
type MetadataType = Record<string, unknown> | undefined;
|
| 27 |
+
export class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
|
| 28 |
+
_meta!: Meta;
|
| 29 |
+
_schema!: Schema;
|
| 30 |
+
_map: Map<Schema, $replace<Meta, Schema>> = new Map();
|
| 31 |
+
_idmap: Map<string, Schema> = new Map();
|
| 32 |
+
|
| 33 |
+
add<S extends Schema>(
|
| 34 |
+
schema: S,
|
| 35 |
+
..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]
|
| 36 |
+
): this {
|
| 37 |
+
const meta: any = _meta[0];
|
| 38 |
+
this._map.set(schema, meta!);
|
| 39 |
+
if (meta && typeof meta === "object" && "id" in meta) {
|
| 40 |
+
if (this._idmap.has(meta.id!)) {
|
| 41 |
+
throw new Error(`ID ${meta.id} already exists in the registry`);
|
| 42 |
+
}
|
| 43 |
+
this._idmap.set(meta.id!, schema);
|
| 44 |
+
}
|
| 45 |
+
return this as any;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
clear(): this {
|
| 49 |
+
this._map = new Map();
|
| 50 |
+
this._idmap = new Map();
|
| 51 |
+
return this;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
remove(schema: Schema): this {
|
| 55 |
+
const meta: any = this._map.get(schema);
|
| 56 |
+
if (meta && typeof meta === "object" && "id" in meta) {
|
| 57 |
+
this._idmap.delete(meta.id!);
|
| 58 |
+
}
|
| 59 |
+
this._map.delete(schema);
|
| 60 |
+
return this;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
get<S extends Schema>(schema: S): $replace<Meta, S> | undefined {
|
| 64 |
+
// return this._map.get(schema) as any;
|
| 65 |
+
|
| 66 |
+
// inherit metadata
|
| 67 |
+
const p = schema._zod.parent as Schema;
|
| 68 |
+
if (p) {
|
| 69 |
+
const pm: any = { ...(this.get(p) ?? {}) };
|
| 70 |
+
delete pm.id; // do not inherit id
|
| 71 |
+
return { ...pm, ...this._map.get(schema) } as any;
|
| 72 |
+
}
|
| 73 |
+
return this._map.get(schema) as any;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
has(schema: Schema): boolean {
|
| 77 |
+
return this._map.has(schema);
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
export interface JSONSchemaMeta {
|
| 82 |
+
id?: string | undefined;
|
| 83 |
+
title?: string | undefined;
|
| 84 |
+
description?: string | undefined;
|
| 85 |
+
deprecated?: boolean | undefined;
|
| 86 |
+
[k: string]: unknown;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
export interface GlobalMeta extends JSONSchemaMeta {}
|
| 90 |
+
|
| 91 |
+
// registries
|
| 92 |
+
export function registry<T extends MetadataType = MetadataType, S extends $ZodType = $ZodType>(): $ZodRegistry<T, S> {
|
| 93 |
+
return new $ZodRegistry<T, S>();
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
export const globalRegistry: $ZodRegistry<GlobalMeta> = /*@__PURE__*/ registry<GlobalMeta>();
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/schemas.ts
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/standard-schema.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** The Standard Schema interface. */
|
| 2 |
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
| 3 |
+
/** The Standard Schema properties. */
|
| 4 |
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
export declare namespace StandardSchemaV1 {
|
| 8 |
+
/** The Standard Schema properties interface. */
|
| 9 |
+
export interface Props<Input = unknown, Output = Input> {
|
| 10 |
+
/** The version number of the standard. */
|
| 11 |
+
readonly version: 1;
|
| 12 |
+
/** The vendor name of the schema library. */
|
| 13 |
+
readonly vendor: string;
|
| 14 |
+
/** Validates unknown input values. */
|
| 15 |
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
| 16 |
+
/** Inferred types associated with the schema. */
|
| 17 |
+
readonly types?: Types<Input, Output> | undefined;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
/** The result interface of the validate function. */
|
| 21 |
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
| 22 |
+
|
| 23 |
+
/** The result interface if validation succeeds. */
|
| 24 |
+
export interface SuccessResult<Output> {
|
| 25 |
+
/** The typed output value. */
|
| 26 |
+
readonly value: Output;
|
| 27 |
+
/** The non-existent issues. */
|
| 28 |
+
readonly issues?: undefined;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/** The result interface if validation fails. */
|
| 32 |
+
export interface FailureResult {
|
| 33 |
+
/** The issues of failed validation. */
|
| 34 |
+
readonly issues: ReadonlyArray<Issue>;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/** The issue interface of the failure output. */
|
| 38 |
+
export interface Issue {
|
| 39 |
+
/** The error message of the issue. */
|
| 40 |
+
readonly message: string;
|
| 41 |
+
/** The path of the issue, if any. */
|
| 42 |
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/** The path segment interface of the issue. */
|
| 46 |
+
export interface PathSegment {
|
| 47 |
+
/** The key representing a path segment. */
|
| 48 |
+
readonly key: PropertyKey;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/** The Standard Schema types interface. */
|
| 52 |
+
export interface Types<Input = unknown, Output = Input> {
|
| 53 |
+
/** The input type of the schema. */
|
| 54 |
+
readonly input: Input;
|
| 55 |
+
/** The output type of the schema. */
|
| 56 |
+
readonly output: Output;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/** Infers the input type of a Standard Schema. */
|
| 60 |
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
| 61 |
+
|
| 62 |
+
/** Infers the output type of a Standard Schema. */
|
| 63 |
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
| 64 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/index.test.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { expect, expectTypeOf, test } from "vitest";
|
| 2 |
+
import * as z from "zod/v3";
|
| 3 |
+
|
| 4 |
+
test("test", () => {
|
| 5 |
+
expect(true).toBe(true);
|
| 6 |
+
});
|
| 7 |
+
|
| 8 |
+
test("test2", () => {
|
| 9 |
+
expect(() => z.string().parse(234)).toThrowErrorMatchingInlineSnapshot(`
|
| 10 |
+
[ZodError: [
|
| 11 |
+
{
|
| 12 |
+
"code": "invalid_type",
|
| 13 |
+
"expected": "string",
|
| 14 |
+
"received": "number",
|
| 15 |
+
"path": [],
|
| 16 |
+
"message": "Expected string, received number"
|
| 17 |
+
}
|
| 18 |
+
]]
|
| 19 |
+
`);
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
+
test("async validation", async () => {
|
| 23 |
+
const testTuple = z
|
| 24 |
+
.tuple([z.string().refine(async () => true), z.number().refine(async () => true)])
|
| 25 |
+
.refine(async () => true);
|
| 26 |
+
expectTypeOf<typeof testTuple._output>().toEqualTypeOf<[string, number]>();
|
| 27 |
+
|
| 28 |
+
const val = await testTuple.parseAsync(["asdf", 1234]);
|
| 29 |
+
expect(val).toEqual(val);
|
| 30 |
+
|
| 31 |
+
const r1 = await testTuple.safeParseAsync(["asdf", "asdf"]);
|
| 32 |
+
expect(r1.success).toEqual(false);
|
| 33 |
+
expect(r1.error!).toMatchInlineSnapshot(`
|
| 34 |
+
[ZodError: [
|
| 35 |
+
{
|
| 36 |
+
"code": "invalid_type",
|
| 37 |
+
"expected": "number",
|
| 38 |
+
"received": "string",
|
| 39 |
+
"path": [
|
| 40 |
+
1
|
| 41 |
+
],
|
| 42 |
+
"message": "Expected number, received string"
|
| 43 |
+
}
|
| 44 |
+
]]
|
| 45 |
+
`);
|
| 46 |
+
});
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/be.test.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, expect, it } from "vitest";
|
| 2 |
+
import be from "../../../locales/be.js";
|
| 3 |
+
|
| 4 |
+
describe("Belarusian localization", () => {
|
| 5 |
+
const localeError = be().localeError;
|
| 6 |
+
|
| 7 |
+
describe("pluralization rules", () => {
|
| 8 |
+
for (const { type, cases } of TEST_CASES) {
|
| 9 |
+
describe(`${type} pluralization`, () => {
|
| 10 |
+
for (const { count, expected } of cases) {
|
| 11 |
+
it(`correctly pluralizes ${count} ${type}`, () => {
|
| 12 |
+
const error = localeError({
|
| 13 |
+
code: "too_small",
|
| 14 |
+
minimum: count,
|
| 15 |
+
type: "number",
|
| 16 |
+
inclusive: true,
|
| 17 |
+
path: [],
|
| 18 |
+
origin: type,
|
| 19 |
+
input: count - 1,
|
| 20 |
+
});
|
| 21 |
+
expect(error).toContain(expected);
|
| 22 |
+
});
|
| 23 |
+
}
|
| 24 |
+
});
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
it("handles negative numbers correctly", () => {
|
| 28 |
+
const error = localeError({
|
| 29 |
+
code: "too_small",
|
| 30 |
+
minimum: -2,
|
| 31 |
+
type: "number",
|
| 32 |
+
inclusive: true,
|
| 33 |
+
path: [],
|
| 34 |
+
origin: "array",
|
| 35 |
+
input: -3,
|
| 36 |
+
});
|
| 37 |
+
expect(error).toContain("-2 элементы");
|
| 38 |
+
});
|
| 39 |
+
|
| 40 |
+
it("handles zero correctly", () => {
|
| 41 |
+
const error = localeError({
|
| 42 |
+
code: "too_small",
|
| 43 |
+
minimum: 0,
|
| 44 |
+
type: "number",
|
| 45 |
+
inclusive: true,
|
| 46 |
+
path: [],
|
| 47 |
+
origin: "array",
|
| 48 |
+
input: -1,
|
| 49 |
+
});
|
| 50 |
+
expect(error).toContain("0 элементаў");
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
it("handles bigint values correctly", () => {
|
| 54 |
+
const error = localeError({
|
| 55 |
+
code: "too_small",
|
| 56 |
+
minimum: BigInt(21),
|
| 57 |
+
type: "number",
|
| 58 |
+
inclusive: true,
|
| 59 |
+
path: [],
|
| 60 |
+
origin: "array",
|
| 61 |
+
input: BigInt(20),
|
| 62 |
+
});
|
| 63 |
+
expect(error).toContain("21 элемент");
|
| 64 |
+
});
|
| 65 |
+
});
|
| 66 |
+
});
|
| 67 |
+
|
| 68 |
+
const TEST_CASES = [
|
| 69 |
+
{
|
| 70 |
+
type: "array",
|
| 71 |
+
cases: [
|
| 72 |
+
{ count: 1, expected: "1 элемент" },
|
| 73 |
+
{ count: 2, expected: "2 элементы" },
|
| 74 |
+
{ count: 5, expected: "5 элементаў" },
|
| 75 |
+
{ count: 11, expected: "11 элементаў" },
|
| 76 |
+
{ count: 21, expected: "21 элемент" },
|
| 77 |
+
{ count: 22, expected: "22 элементы" },
|
| 78 |
+
{ count: 25, expected: "25 элементаў" },
|
| 79 |
+
{ count: 101, expected: "101 элемент" },
|
| 80 |
+
{ count: 111, expected: "111 элементаў" },
|
| 81 |
+
],
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
type: "set",
|
| 85 |
+
cases: [
|
| 86 |
+
{ count: 1, expected: "1 элемент" },
|
| 87 |
+
{ count: 2, expected: "2 элементы" },
|
| 88 |
+
{ count: 5, expected: "5 элементаў" },
|
| 89 |
+
{ count: 11, expected: "11 элементаў" },
|
| 90 |
+
{ count: 21, expected: "21 элемент" },
|
| 91 |
+
{ count: 22, expected: "22 элементы" },
|
| 92 |
+
{ count: 25, expected: "25 элементаў" },
|
| 93 |
+
{ count: 101, expected: "101 элемент" },
|
| 94 |
+
{ count: 111, expected: "111 элементаў" },
|
| 95 |
+
],
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
type: "string",
|
| 99 |
+
cases: [
|
| 100 |
+
{ count: 1, expected: "1 сімвал" },
|
| 101 |
+
{ count: 2, expected: "2 сімвалы" },
|
| 102 |
+
{ count: 5, expected: "5 сімвалаў" },
|
| 103 |
+
{ count: 11, expected: "11 сімвалаў" },
|
| 104 |
+
{ count: 21, expected: "21 сімвал" },
|
| 105 |
+
{ count: 22, expected: "22 сімвалы" },
|
| 106 |
+
{ count: 25, expected: "25 сімвалаў" },
|
| 107 |
+
],
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
type: "file",
|
| 111 |
+
cases: [
|
| 112 |
+
{ count: 0, expected: "0 байтаў" },
|
| 113 |
+
{ count: 1, expected: "1 байт" },
|
| 114 |
+
{ count: 2, expected: "2 байты" },
|
| 115 |
+
{ count: 5, expected: "5 байтаў" },
|
| 116 |
+
{ count: 11, expected: "11 байтаў" },
|
| 117 |
+
{ count: 21, expected: "21 байт" },
|
| 118 |
+
{ count: 22, expected: "22 байты" },
|
| 119 |
+
{ count: 25, expected: "25 байтаў" },
|
| 120 |
+
{ count: 101, expected: "101 байт" },
|
| 121 |
+
{ count: 110, expected: "110 байтаў" },
|
| 122 |
+
],
|
| 123 |
+
},
|
| 124 |
+
] as const;
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/en.test.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { expect, test } from "vitest";
|
| 2 |
+
import { parsedType } from "../../../locales/en.js";
|
| 3 |
+
|
| 4 |
+
test("parsedType", () => {
|
| 5 |
+
expect(parsedType("string")).toBe("string");
|
| 6 |
+
expect(parsedType(1)).toBe("number");
|
| 7 |
+
expect(parsedType(true)).toBe("boolean");
|
| 8 |
+
expect(parsedType(null)).toBe("null");
|
| 9 |
+
expect(parsedType(undefined)).toBe("undefined");
|
| 10 |
+
expect(parsedType([])).toBe("array");
|
| 11 |
+
expect(parsedType({})).toBe("object");
|
| 12 |
+
expect(parsedType(new Date())).toBe("Date");
|
| 13 |
+
expect(parsedType(new Map())).toBe("Map");
|
| 14 |
+
expect(parsedType(new Set())).toBe("Set");
|
| 15 |
+
expect(parsedType(new Error())).toBe("Error");
|
| 16 |
+
|
| 17 |
+
const nullPrototype = Object.create(null);
|
| 18 |
+
expect(parsedType(nullPrototype)).toBe("object");
|
| 19 |
+
|
| 20 |
+
const doubleNullPrototype = Object.create(Object.create(null));
|
| 21 |
+
expect(parsedType(doubleNullPrototype)).toBe("object");
|
| 22 |
+
});
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/ru.test.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { describe, expect, it } from "vitest";
|
| 2 |
+
import ru from "../../../locales/ru.js";
|
| 3 |
+
|
| 4 |
+
describe("Russian localization", () => {
|
| 5 |
+
const localeError = ru().localeError;
|
| 6 |
+
|
| 7 |
+
describe("pluralization rules", () => {
|
| 8 |
+
for (const { type, cases } of TEST_CASES) {
|
| 9 |
+
describe(`${type} pluralization`, () => {
|
| 10 |
+
for (const { count, expected } of cases) {
|
| 11 |
+
it(`correctly pluralizes ${count} ${type}`, () => {
|
| 12 |
+
const error = localeError({
|
| 13 |
+
code: "too_small",
|
| 14 |
+
minimum: count,
|
| 15 |
+
type: "number",
|
| 16 |
+
inclusive: true,
|
| 17 |
+
path: [],
|
| 18 |
+
origin: type,
|
| 19 |
+
input: count - 1,
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
+
expect(error).toContain(expected);
|
| 23 |
+
});
|
| 24 |
+
}
|
| 25 |
+
});
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
it("handles negative numbers correctly", () => {
|
| 29 |
+
const error = localeError({
|
| 30 |
+
code: "too_small",
|
| 31 |
+
minimum: -2,
|
| 32 |
+
type: "number",
|
| 33 |
+
inclusive: true,
|
| 34 |
+
path: [],
|
| 35 |
+
origin: "array",
|
| 36 |
+
input: -3,
|
| 37 |
+
});
|
| 38 |
+
|
| 39 |
+
expect(error).toContain("-2 элемента");
|
| 40 |
+
});
|
| 41 |
+
|
| 42 |
+
it("handles zero correctly", () => {
|
| 43 |
+
const error = localeError({
|
| 44 |
+
code: "too_small",
|
| 45 |
+
minimum: 0,
|
| 46 |
+
type: "number",
|
| 47 |
+
inclusive: true,
|
| 48 |
+
path: [],
|
| 49 |
+
origin: "array",
|
| 50 |
+
input: -1,
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
expect(error).toContain("0 элементов");
|
| 54 |
+
});
|
| 55 |
+
|
| 56 |
+
it("handles bigint values correctly", () => {
|
| 57 |
+
const error = localeError({
|
| 58 |
+
code: "too_small",
|
| 59 |
+
minimum: BigInt(21),
|
| 60 |
+
type: "number",
|
| 61 |
+
inclusive: true,
|
| 62 |
+
path: [],
|
| 63 |
+
origin: "array",
|
| 64 |
+
input: BigInt(20),
|
| 65 |
+
});
|
| 66 |
+
|
| 67 |
+
expect(error).toContain("21 элемент");
|
| 68 |
+
});
|
| 69 |
+
});
|
| 70 |
+
});
|
| 71 |
+
|
| 72 |
+
const TEST_CASES = [
|
| 73 |
+
{
|
| 74 |
+
type: "array",
|
| 75 |
+
cases: [
|
| 76 |
+
{ count: 1, expected: "1 элемент" },
|
| 77 |
+
{ count: 2, expected: "2 элемента" },
|
| 78 |
+
{ count: 5, expected: "5 элементов" },
|
| 79 |
+
{ count: 11, expected: "11 элементов" },
|
| 80 |
+
{ count: 21, expected: "21 элемент" },
|
| 81 |
+
{ count: 22, expected: "22 элемента" },
|
| 82 |
+
{ count: 25, expected: "25 элементов" },
|
| 83 |
+
{ count: 101, expected: "101 элемент" },
|
| 84 |
+
{ count: 111, expected: "111 элементов" },
|
| 85 |
+
],
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
type: "set",
|
| 89 |
+
cases: [
|
| 90 |
+
{ count: 1, expected: "1 элемент" },
|
| 91 |
+
{ count: 2, expected: "2 элемента" },
|
| 92 |
+
{ count: 5, expected: "5 элементов" },
|
| 93 |
+
{ count: 11, expected: "11 элементов" },
|
| 94 |
+
{ count: 21, expected: "21 элемент" },
|
| 95 |
+
{ count: 22, expected: "22 элемента" },
|
| 96 |
+
{ count: 25, expected: "25 элементов" },
|
| 97 |
+
{ count: 101, expected: "101 элемент" },
|
| 98 |
+
{ count: 111, expected: "111 элементов" },
|
| 99 |
+
],
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
type: "string",
|
| 103 |
+
cases: [
|
| 104 |
+
{ count: 1, expected: "1 символ" },
|
| 105 |
+
{ count: 2, expected: "2 символа" },
|
| 106 |
+
{ count: 5, expected: "5 символов" },
|
| 107 |
+
{ count: 11, expected: "11 символов" },
|
| 108 |
+
{ count: 21, expected: "21 символ" },
|
| 109 |
+
{ count: 22, expected: "22 символа" },
|
| 110 |
+
{ count: 25, expected: "25 символов" },
|
| 111 |
+
],
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
type: "file",
|
| 115 |
+
cases: [
|
| 116 |
+
{ count: 0, expected: "0 байт" },
|
| 117 |
+
{ count: 1, expected: "1 байт" },
|
| 118 |
+
{ count: 2, expected: "2 байта" },
|
| 119 |
+
{ count: 5, expected: "5 байт" },
|
| 120 |
+
{ count: 11, expected: "11 байт" },
|
| 121 |
+
{ count: 21, expected: "21 байт" },
|
| 122 |
+
{ count: 22, expected: "22 байта" },
|
| 123 |
+
{ count: 25, expected: "25 байт" },
|
| 124 |
+
{ count: 101, expected: "101 байт" },
|
| 125 |
+
{ count: 110, expected: "110 байт" },
|
| 126 |
+
],
|
| 127 |
+
},
|
| 128 |
+
] as const;
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/tests/locales/tr.test.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { expect, test } from "vitest";
|
| 2 |
+
import * as z from "zod/v4";
|
| 3 |
+
import { parsedType } from "../../../locales/tr.js";
|
| 4 |
+
|
| 5 |
+
test("parsedType", () => {
|
| 6 |
+
expect(parsedType("string")).toBe("string");
|
| 7 |
+
expect(parsedType(1)).toBe("number");
|
| 8 |
+
expect(parsedType(true)).toBe("boolean");
|
| 9 |
+
expect(parsedType(null)).toBe("null");
|
| 10 |
+
expect(parsedType(undefined)).toBe("undefined");
|
| 11 |
+
expect(parsedType([])).toBe("array");
|
| 12 |
+
expect(parsedType({})).toBe("object");
|
| 13 |
+
expect(parsedType(new Date())).toBe("Date");
|
| 14 |
+
expect(parsedType(new Map())).toBe("Map");
|
| 15 |
+
expect(parsedType(new Set())).toBe("Set");
|
| 16 |
+
expect(parsedType(new Error())).toBe("Error");
|
| 17 |
+
|
| 18 |
+
const nullPrototype = Object.create(null);
|
| 19 |
+
expect(parsedType(nullPrototype)).toBe("object");
|
| 20 |
+
|
| 21 |
+
const doubleNullPrototype = Object.create(Object.create(null));
|
| 22 |
+
expect(parsedType(doubleNullPrototype)).toBe("object");
|
| 23 |
+
|
| 24 |
+
expect(parsedType(Number.NaN)).toBe("NaN");
|
| 25 |
+
});
|
| 26 |
+
|
| 27 |
+
test("locales - tr", () => {
|
| 28 |
+
z.config(z.locales.tr());
|
| 29 |
+
|
| 30 |
+
const invalidType = z.number().safeParse("a");
|
| 31 |
+
expect(invalidType.error!.issues[0].code).toBe("invalid_type");
|
| 32 |
+
expect(invalidType.error!.issues[0].message).toBe("Geçersiz değer: beklenen number, alınan string");
|
| 33 |
+
|
| 34 |
+
const invalidType2 = z.string().safeParse(1);
|
| 35 |
+
expect(invalidType2.error!.issues[0].code).toBe("invalid_type");
|
| 36 |
+
expect(invalidType2.error!.issues[0].message).toBe("Geçersiz değer: beklenen string, alınan number");
|
| 37 |
+
|
| 38 |
+
const invalidValue = z.enum(["a", "b"]).safeParse(1);
|
| 39 |
+
expect(invalidValue.error!.issues[0].code).toBe("invalid_value");
|
| 40 |
+
expect(invalidValue.error!.issues[0].message).toBe('Geçersiz seçenek: aşağıdakilerden biri olmalı: "a"|"b"');
|
| 41 |
+
|
| 42 |
+
const tooBig = z.number().max(10).safeParse(15);
|
| 43 |
+
expect(tooBig.error!.issues[0].code).toBe("too_big");
|
| 44 |
+
expect(tooBig.error!.issues[0].message).toBe("Çok büyük: beklenen number <=10");
|
| 45 |
+
|
| 46 |
+
const tooSmall = z.number().min(10).safeParse(5);
|
| 47 |
+
expect(tooSmall.error!.issues[0].code).toBe("too_small");
|
| 48 |
+
expect(tooSmall.error!.issues[0].message).toBe("Çok küçük: beklenen number >=10");
|
| 49 |
+
|
| 50 |
+
const invalidFormatRegex = z.string().regex(/abcd/).safeParse("invalid-string");
|
| 51 |
+
expect(invalidFormatRegex.error!.issues[0].code).toBe("invalid_format");
|
| 52 |
+
expect(invalidFormatRegex.error!.issues[0].message).toBe("Geçersiz metin: /abcd/ desenine uymalı");
|
| 53 |
+
|
| 54 |
+
const invalidFormatStartsWith = z.string().startsWith("abcd").safeParse("invalid-string");
|
| 55 |
+
expect(invalidFormatStartsWith.error!.issues[0].code).toBe("invalid_format");
|
| 56 |
+
expect(invalidFormatStartsWith.error!.issues[0].message).toBe('Geçersiz metin: "abcd" ile başlamalı');
|
| 57 |
+
|
| 58 |
+
const notMultipleOf = z.number().multipleOf(3).safeParse(10);
|
| 59 |
+
expect(notMultipleOf.error!.issues[0].code).toBe("not_multiple_of");
|
| 60 |
+
expect(notMultipleOf.error!.issues[0].message).toBe("Geçersiz sayı: 3 ile tam bölünebilmeli");
|
| 61 |
+
|
| 62 |
+
const unrecognizedKeys = z.object({ a: z.string(), b: z.number() }).strict().safeParse({ a: "a", b: 1, c: 2 });
|
| 63 |
+
expect(unrecognizedKeys.error!.issues[0].code).toBe("unrecognized_keys");
|
| 64 |
+
expect(unrecognizedKeys.error!.issues[0].message).toBe('Tanınmayan anahtar: "c"');
|
| 65 |
+
|
| 66 |
+
const invalidUnion = z.union([z.string(), z.number()]).safeParse(true);
|
| 67 |
+
expect(invalidUnion.error!.issues[0].code).toBe("invalid_union");
|
| 68 |
+
expect(invalidUnion.error!.issues[0].message).toBe("Geçersiz değer");
|
| 69 |
+
});
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/to-json-schema.ts
ADDED
|
@@ -0,0 +1,977 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type * as checks from "./checks.js";
|
| 2 |
+
import type * as JSONSchema from "./json-schema.js";
|
| 3 |
+
import { $ZodRegistry, globalRegistry } from "./registries.js";
|
| 4 |
+
import type * as schemas from "./schemas.js";
|
| 5 |
+
import { getEnumValues } from "./util.js";
|
| 6 |
+
|
| 7 |
+
interface JSONSchemaGeneratorParams {
|
| 8 |
+
/** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
|
| 9 |
+
* @default globalRegistry */
|
| 10 |
+
metadata?: $ZodRegistry<Record<string, any>>;
|
| 11 |
+
/** The JSON Schema version to target.
|
| 12 |
+
* - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
|
| 13 |
+
* - `"draft-7"` — JSON Schema Draft 7 */
|
| 14 |
+
target?: "draft-7" | "draft-2020-12";
|
| 15 |
+
/** How to handle unrepresentable types.
|
| 16 |
+
* - `"throw"` — Default. Unrepresentable types throw an error
|
| 17 |
+
* - `"any"` — Unrepresentable types become `{}` */
|
| 18 |
+
unrepresentable?: "throw" | "any";
|
| 19 |
+
/** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
|
| 20 |
+
override?: (ctx: {
|
| 21 |
+
zodSchema: schemas.$ZodTypes;
|
| 22 |
+
jsonSchema: JSONSchema.BaseSchema;
|
| 23 |
+
path: (string | number)[];
|
| 24 |
+
}) => void;
|
| 25 |
+
/** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, Error converting schema to JSONz, defaults, coerced primitives, etc.
|
| 26 |
+
* - `"output"` — Default. Convert the output schema.
|
| 27 |
+
* - `"input"` — Convert the input schema. */
|
| 28 |
+
io?: "input" | "output";
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
interface ProcessParams {
|
| 32 |
+
schemaPath: schemas.$ZodType[];
|
| 33 |
+
path: (string | number)[];
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
interface EmitParams {
|
| 37 |
+
/** How to handle cycles.
|
| 38 |
+
* - `"ref"` — Default. Cycles will be broken using $defs
|
| 39 |
+
* - `"throw"` — Cycles will throw an error if encountered */
|
| 40 |
+
cycles?: "ref" | "throw";
|
| 41 |
+
/* How to handle reused schemas.
|
| 42 |
+
* - `"inline"` — Default. Reused schemas will be inlined
|
| 43 |
+
* - `"ref"` — Reused schemas will be extracted as $defs */
|
| 44 |
+
reused?: "ref" | "inline";
|
| 45 |
+
|
| 46 |
+
external?:
|
| 47 |
+
| {
|
| 48 |
+
/** */
|
| 49 |
+
registry: $ZodRegistry<{ id?: string | undefined }>;
|
| 50 |
+
uri?: ((id: string) => string) | undefined;
|
| 51 |
+
defs: Record<string, JSONSchema.BaseSchema>;
|
| 52 |
+
}
|
| 53 |
+
| undefined;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
interface Seen {
|
| 57 |
+
/** JSON Schema result for this Zod schema */
|
| 58 |
+
schema: JSONSchema.BaseSchema;
|
| 59 |
+
/** A cached version of the schema that doesn't get overwritten during ref resolution */
|
| 60 |
+
def?: JSONSchema.BaseSchema;
|
| 61 |
+
defId?: string | undefined;
|
| 62 |
+
/** Number of times this schema was encountered during traversal */
|
| 63 |
+
count: number;
|
| 64 |
+
/** Cycle path */
|
| 65 |
+
cycle?: (string | number)[] | undefined;
|
| 66 |
+
isParent?: boolean | undefined;
|
| 67 |
+
ref?: schemas.$ZodType | undefined | null;
|
| 68 |
+
/** JSON Schema property path for this schema */
|
| 69 |
+
path?: (string | number)[] | undefined;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
export class JSONSchemaGenerator {
|
| 73 |
+
metadataRegistry: $ZodRegistry<Record<string, any>>;
|
| 74 |
+
target: "draft-7" | "draft-2020-12";
|
| 75 |
+
unrepresentable: "throw" | "any";
|
| 76 |
+
override: (ctx: {
|
| 77 |
+
zodSchema: schemas.$ZodTypes;
|
| 78 |
+
jsonSchema: JSONSchema.BaseSchema;
|
| 79 |
+
path: (string | number)[];
|
| 80 |
+
}) => void;
|
| 81 |
+
io: "input" | "output";
|
| 82 |
+
|
| 83 |
+
counter = 0;
|
| 84 |
+
seen: Map<schemas.$ZodType, Seen>;
|
| 85 |
+
|
| 86 |
+
constructor(params?: JSONSchemaGeneratorParams) {
|
| 87 |
+
this.metadataRegistry = params?.metadata ?? globalRegistry;
|
| 88 |
+
this.target = params?.target ?? "draft-2020-12";
|
| 89 |
+
this.unrepresentable = params?.unrepresentable ?? "throw";
|
| 90 |
+
this.override = params?.override ?? (() => {});
|
| 91 |
+
this.io = params?.io ?? "output";
|
| 92 |
+
|
| 93 |
+
this.seen = new Map();
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
process(schema: schemas.$ZodType, _params: ProcessParams = { path: [], schemaPath: [] }): JSONSchema.BaseSchema {
|
| 97 |
+
const def = (schema as schemas.$ZodTypes)._zod.def;
|
| 98 |
+
|
| 99 |
+
const formatMap: Partial<Record<checks.$ZodStringFormats, string | undefined>> = {
|
| 100 |
+
guid: "uuid",
|
| 101 |
+
url: "uri",
|
| 102 |
+
datetime: "date-time",
|
| 103 |
+
json_string: "json-string",
|
| 104 |
+
regex: "", // do not set
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
// check for schema in seens
|
| 108 |
+
const seen = this.seen.get(schema);
|
| 109 |
+
|
| 110 |
+
if (seen) {
|
| 111 |
+
seen.count++;
|
| 112 |
+
|
| 113 |
+
// check if cycle
|
| 114 |
+
const isCycle = _params.schemaPath.includes(schema);
|
| 115 |
+
if (isCycle) {
|
| 116 |
+
seen.cycle = _params.path;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
return seen.schema;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// initialize
|
| 123 |
+
const result: Seen = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
| 124 |
+
this.seen.set(schema, result);
|
| 125 |
+
|
| 126 |
+
// custom method overrides default behavior
|
| 127 |
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
| 128 |
+
if (overrideSchema) {
|
| 129 |
+
result.schema = overrideSchema as any;
|
| 130 |
+
} else {
|
| 131 |
+
const params = {
|
| 132 |
+
..._params,
|
| 133 |
+
schemaPath: [..._params.schemaPath, schema],
|
| 134 |
+
path: _params.path,
|
| 135 |
+
};
|
| 136 |
+
|
| 137 |
+
const parent = schema._zod.parent;
|
| 138 |
+
|
| 139 |
+
if (parent) {
|
| 140 |
+
// schema was cloned from another schema
|
| 141 |
+
result.ref = parent;
|
| 142 |
+
this.process(parent, params);
|
| 143 |
+
this.seen.get(parent)!.isParent = true;
|
| 144 |
+
} else {
|
| 145 |
+
const _json = result.schema;
|
| 146 |
+
switch (def.type) {
|
| 147 |
+
case "string": {
|
| 148 |
+
const json: JSONSchema.StringSchema = _json as any;
|
| 149 |
+
json.type = "string";
|
| 150 |
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod
|
| 151 |
+
.bag as schemas.$ZodStringInternals<unknown>["bag"];
|
| 152 |
+
if (typeof minimum === "number") json.minLength = minimum;
|
| 153 |
+
if (typeof maximum === "number") json.maxLength = maximum;
|
| 154 |
+
// custom pattern overrides format
|
| 155 |
+
if (format) {
|
| 156 |
+
json.format = formatMap[format as checks.$ZodStringFormats] ?? format;
|
| 157 |
+
if (json.format === "") delete json.format; // empty format is not valid
|
| 158 |
+
}
|
| 159 |
+
if (contentEncoding) json.contentEncoding = contentEncoding;
|
| 160 |
+
if (patterns && patterns.size > 0) {
|
| 161 |
+
const regexes = [...patterns];
|
| 162 |
+
if (regexes.length === 1) json.pattern = regexes[0]!.source;
|
| 163 |
+
else if (regexes.length > 1) {
|
| 164 |
+
result.schema.allOf = [
|
| 165 |
+
...regexes.map((regex) => ({
|
| 166 |
+
...(this.target === "draft-7" ? ({ type: "string" } as const) : {}),
|
| 167 |
+
pattern: regex.source,
|
| 168 |
+
})),
|
| 169 |
+
];
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
break;
|
| 174 |
+
}
|
| 175 |
+
case "number": {
|
| 176 |
+
const json: JSONSchema.NumberSchema | JSONSchema.IntegerSchema = _json as any;
|
| 177 |
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
| 178 |
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
| 179 |
+
else json.type = "number";
|
| 180 |
+
|
| 181 |
+
if (typeof exclusiveMinimum === "number") json.exclusiveMinimum = exclusiveMinimum;
|
| 182 |
+
if (typeof minimum === "number") {
|
| 183 |
+
json.minimum = minimum;
|
| 184 |
+
if (typeof exclusiveMinimum === "number") {
|
| 185 |
+
if (exclusiveMinimum >= minimum) delete json.minimum;
|
| 186 |
+
else delete json.exclusiveMinimum;
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if (typeof exclusiveMaximum === "number") json.exclusiveMaximum = exclusiveMaximum;
|
| 191 |
+
if (typeof maximum === "number") {
|
| 192 |
+
json.maximum = maximum;
|
| 193 |
+
if (typeof exclusiveMaximum === "number") {
|
| 194 |
+
if (exclusiveMaximum <= maximum) delete json.maximum;
|
| 195 |
+
else delete json.exclusiveMaximum;
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
| 200 |
+
|
| 201 |
+
break;
|
| 202 |
+
}
|
| 203 |
+
case "boolean": {
|
| 204 |
+
const json = _json as JSONSchema.BooleanSchema;
|
| 205 |
+
json.type = "boolean";
|
| 206 |
+
break;
|
| 207 |
+
}
|
| 208 |
+
case "bigint": {
|
| 209 |
+
if (this.unrepresentable === "throw") {
|
| 210 |
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
| 211 |
+
}
|
| 212 |
+
break;
|
| 213 |
+
}
|
| 214 |
+
case "symbol": {
|
| 215 |
+
if (this.unrepresentable === "throw") {
|
| 216 |
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
| 217 |
+
}
|
| 218 |
+
break;
|
| 219 |
+
}
|
| 220 |
+
case "null": {
|
| 221 |
+
_json.type = "null";
|
| 222 |
+
break;
|
| 223 |
+
}
|
| 224 |
+
case "any": {
|
| 225 |
+
break;
|
| 226 |
+
}
|
| 227 |
+
case "unknown": {
|
| 228 |
+
break;
|
| 229 |
+
}
|
| 230 |
+
case "undefined": {
|
| 231 |
+
if (this.unrepresentable === "throw") {
|
| 232 |
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
| 233 |
+
}
|
| 234 |
+
break;
|
| 235 |
+
}
|
| 236 |
+
case "void": {
|
| 237 |
+
if (this.unrepresentable === "throw") {
|
| 238 |
+
throw new Error("Void cannot be represented in JSON Schema");
|
| 239 |
+
}
|
| 240 |
+
break;
|
| 241 |
+
}
|
| 242 |
+
case "never": {
|
| 243 |
+
_json.not = {};
|
| 244 |
+
break;
|
| 245 |
+
}
|
| 246 |
+
case "date": {
|
| 247 |
+
if (this.unrepresentable === "throw") {
|
| 248 |
+
throw new Error("Date cannot be represented in JSON Schema");
|
| 249 |
+
}
|
| 250 |
+
break;
|
| 251 |
+
}
|
| 252 |
+
case "array": {
|
| 253 |
+
const json: JSONSchema.ArraySchema = _json as any;
|
| 254 |
+
const { minimum, maximum } = schema._zod.bag;
|
| 255 |
+
if (typeof minimum === "number") json.minItems = minimum;
|
| 256 |
+
if (typeof maximum === "number") json.maxItems = maximum;
|
| 257 |
+
|
| 258 |
+
json.type = "array";
|
| 259 |
+
json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
|
| 260 |
+
break;
|
| 261 |
+
}
|
| 262 |
+
case "object": {
|
| 263 |
+
const json: JSONSchema.ObjectSchema = _json as any;
|
| 264 |
+
json.type = "object";
|
| 265 |
+
json.properties = {};
|
| 266 |
+
const shape = def.shape; // params.shapeCache.get(schema)!;
|
| 267 |
+
|
| 268 |
+
for (const key in shape) {
|
| 269 |
+
json.properties[key] = this.process(shape[key]!, {
|
| 270 |
+
...params,
|
| 271 |
+
path: [...params.path, "properties", key],
|
| 272 |
+
});
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
// required keys
|
| 276 |
+
const allKeys = new Set(Object.keys(shape));
|
| 277 |
+
// const optionalKeys = new Set(def.optional);
|
| 278 |
+
const requiredKeys = new Set(
|
| 279 |
+
[...allKeys].filter((key) => {
|
| 280 |
+
const v = def.shape[key]!._zod;
|
| 281 |
+
if (this.io === "input") {
|
| 282 |
+
return v.optin === undefined;
|
| 283 |
+
} else {
|
| 284 |
+
return v.optout === undefined;
|
| 285 |
+
}
|
| 286 |
+
})
|
| 287 |
+
);
|
| 288 |
+
|
| 289 |
+
if (requiredKeys.size > 0) {
|
| 290 |
+
json.required = Array.from(requiredKeys);
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// catchall
|
| 294 |
+
if (def.catchall?._zod.def.type === "never") {
|
| 295 |
+
// strict
|
| 296 |
+
json.additionalProperties = false;
|
| 297 |
+
} else if (!def.catchall) {
|
| 298 |
+
// regular
|
| 299 |
+
if (this.io === "output") json.additionalProperties = false;
|
| 300 |
+
} else if (def.catchall) {
|
| 301 |
+
json.additionalProperties = this.process(def.catchall, {
|
| 302 |
+
...params,
|
| 303 |
+
path: [...params.path, "additionalProperties"],
|
| 304 |
+
});
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
break;
|
| 308 |
+
}
|
| 309 |
+
case "union": {
|
| 310 |
+
const json: JSONSchema.BaseSchema = _json as any;
|
| 311 |
+
json.anyOf = def.options.map((x, i) =>
|
| 312 |
+
this.process(x, {
|
| 313 |
+
...params,
|
| 314 |
+
path: [...params.path, "anyOf", i],
|
| 315 |
+
})
|
| 316 |
+
);
|
| 317 |
+
break;
|
| 318 |
+
}
|
| 319 |
+
case "intersection": {
|
| 320 |
+
const json: JSONSchema.BaseSchema = _json as any;
|
| 321 |
+
const a = this.process(def.left, {
|
| 322 |
+
...params,
|
| 323 |
+
path: [...params.path, "allOf", 0],
|
| 324 |
+
});
|
| 325 |
+
const b = this.process(def.right, {
|
| 326 |
+
...params,
|
| 327 |
+
path: [...params.path, "allOf", 1],
|
| 328 |
+
});
|
| 329 |
+
|
| 330 |
+
const isSimpleIntersection = (val: any) => "allOf" in val && Object.keys(val).length === 1;
|
| 331 |
+
const allOf = [
|
| 332 |
+
...(isSimpleIntersection(a) ? (a.allOf as any[]) : [a]),
|
| 333 |
+
...(isSimpleIntersection(b) ? (b.allOf as any[]) : [b]),
|
| 334 |
+
];
|
| 335 |
+
json.allOf = allOf;
|
| 336 |
+
break;
|
| 337 |
+
}
|
| 338 |
+
case "tuple": {
|
| 339 |
+
const json: JSONSchema.ArraySchema = _json as any;
|
| 340 |
+
json.type = "array";
|
| 341 |
+
const prefixItems = def.items.map((x, i) =>
|
| 342 |
+
this.process(x, { ...params, path: [...params.path, "prefixItems", i] })
|
| 343 |
+
);
|
| 344 |
+
if (this.target === "draft-2020-12") {
|
| 345 |
+
json.prefixItems = prefixItems;
|
| 346 |
+
} else {
|
| 347 |
+
json.items = prefixItems;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
if (def.rest) {
|
| 351 |
+
const rest = this.process(def.rest, {
|
| 352 |
+
...params,
|
| 353 |
+
path: [...params.path, "items"],
|
| 354 |
+
});
|
| 355 |
+
if (this.target === "draft-2020-12") {
|
| 356 |
+
json.items = rest;
|
| 357 |
+
} else {
|
| 358 |
+
json.additionalItems = rest;
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
// additionalItems
|
| 363 |
+
if (def.rest) {
|
| 364 |
+
json.items = this.process(def.rest, {
|
| 365 |
+
...params,
|
| 366 |
+
path: [...params.path, "items"],
|
| 367 |
+
});
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
// length
|
| 371 |
+
const { minimum, maximum } = schema._zod.bag as {
|
| 372 |
+
minimum?: number;
|
| 373 |
+
maximum?: number;
|
| 374 |
+
};
|
| 375 |
+
if (typeof minimum === "number") json.minItems = minimum;
|
| 376 |
+
if (typeof maximum === "number") json.maxItems = maximum;
|
| 377 |
+
break;
|
| 378 |
+
}
|
| 379 |
+
case "record": {
|
| 380 |
+
const json: JSONSchema.ObjectSchema = _json as any;
|
| 381 |
+
json.type = "object";
|
| 382 |
+
json.propertyNames = this.process(def.keyType, { ...params, path: [...params.path, "propertyNames"] });
|
| 383 |
+
json.additionalProperties = this.process(def.valueType, {
|
| 384 |
+
...params,
|
| 385 |
+
path: [...params.path, "additionalProperties"],
|
| 386 |
+
});
|
| 387 |
+
break;
|
| 388 |
+
}
|
| 389 |
+
case "map": {
|
| 390 |
+
if (this.unrepresentable === "throw") {
|
| 391 |
+
throw new Error("Map cannot be represented in JSON Schema");
|
| 392 |
+
}
|
| 393 |
+
break;
|
| 394 |
+
}
|
| 395 |
+
case "set": {
|
| 396 |
+
if (this.unrepresentable === "throw") {
|
| 397 |
+
throw new Error("Set cannot be represented in JSON Schema");
|
| 398 |
+
}
|
| 399 |
+
break;
|
| 400 |
+
}
|
| 401 |
+
case "enum": {
|
| 402 |
+
const json: JSONSchema.BaseSchema = _json as any;
|
| 403 |
+
const values = getEnumValues(def.entries);
|
| 404 |
+
// Number enums can have both string and number values
|
| 405 |
+
if (values.every((v) => typeof v === "number")) json.type = "number";
|
| 406 |
+
if (values.every((v) => typeof v === "string")) json.type = "string";
|
| 407 |
+
json.enum = values;
|
| 408 |
+
break;
|
| 409 |
+
}
|
| 410 |
+
case "literal": {
|
| 411 |
+
const json: JSONSchema.BaseSchema = _json as any;
|
| 412 |
+
const vals: (string | number | boolean | null)[] = [];
|
| 413 |
+
for (const val of def.values) {
|
| 414 |
+
if (val === undefined) {
|
| 415 |
+
if (this.unrepresentable === "throw") {
|
| 416 |
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
| 417 |
+
} else {
|
| 418 |
+
// do not add to vals
|
| 419 |
+
}
|
| 420 |
+
} else if (typeof val === "bigint") {
|
| 421 |
+
if (this.unrepresentable === "throw") {
|
| 422 |
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
| 423 |
+
} else {
|
| 424 |
+
vals.push(Number(val));
|
| 425 |
+
}
|
| 426 |
+
} else {
|
| 427 |
+
vals.push(val);
|
| 428 |
+
}
|
| 429 |
+
}
|
| 430 |
+
if (vals.length === 0) {
|
| 431 |
+
// do nothing (an undefined literal was stripped)
|
| 432 |
+
} else if (vals.length === 1) {
|
| 433 |
+
const val = vals[0]!;
|
| 434 |
+
json.type = val === null ? ("null" as const) : (typeof val as any);
|
| 435 |
+
json.const = val;
|
| 436 |
+
} else {
|
| 437 |
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
| 438 |
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
| 439 |
+
if (vals.every((v) => typeof v === "boolean")) json.type = "string";
|
| 440 |
+
if (vals.every((v) => v === null)) json.type = "null";
|
| 441 |
+
json.enum = vals;
|
| 442 |
+
}
|
| 443 |
+
break;
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
case "file": {
|
| 447 |
+
const json: JSONSchema.StringSchema = _json as any;
|
| 448 |
+
const file: JSONSchema.StringSchema = {
|
| 449 |
+
type: "string",
|
| 450 |
+
format: "binary",
|
| 451 |
+
contentEncoding: "binary",
|
| 452 |
+
};
|
| 453 |
+
|
| 454 |
+
const { minimum, maximum, mime } = schema._zod.bag as schemas.$ZodFileInternals["bag"];
|
| 455 |
+
if (minimum !== undefined) file.minLength = minimum;
|
| 456 |
+
if (maximum !== undefined) file.maxLength = maximum;
|
| 457 |
+
if (mime) {
|
| 458 |
+
if (mime.length === 1) {
|
| 459 |
+
file.contentMediaType = mime[0]!;
|
| 460 |
+
Object.assign(json, file);
|
| 461 |
+
} else {
|
| 462 |
+
json.anyOf = mime.map((m) => {
|
| 463 |
+
const mFile: JSONSchema.StringSchema = { ...file, contentMediaType: m };
|
| 464 |
+
return mFile;
|
| 465 |
+
});
|
| 466 |
+
}
|
| 467 |
+
} else {
|
| 468 |
+
Object.assign(json, file);
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
// if (this.unrepresentable === "throw") {
|
| 472 |
+
// throw new Error("File cannot be represented in JSON Schema");
|
| 473 |
+
// }
|
| 474 |
+
break;
|
| 475 |
+
}
|
| 476 |
+
case "transform": {
|
| 477 |
+
if (this.unrepresentable === "throw") {
|
| 478 |
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
| 479 |
+
}
|
| 480 |
+
break;
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
case "nullable": {
|
| 484 |
+
const inner = this.process(def.innerType, params);
|
| 485 |
+
_json.anyOf = [inner, { type: "null" }];
|
| 486 |
+
break;
|
| 487 |
+
}
|
| 488 |
+
case "nonoptional": {
|
| 489 |
+
this.process(def.innerType, params);
|
| 490 |
+
result.ref = def.innerType;
|
| 491 |
+
break;
|
| 492 |
+
}
|
| 493 |
+
case "success": {
|
| 494 |
+
const json = _json as JSONSchema.BooleanSchema;
|
| 495 |
+
json.type = "boolean";
|
| 496 |
+
break;
|
| 497 |
+
}
|
| 498 |
+
case "default": {
|
| 499 |
+
this.process(def.innerType, params);
|
| 500 |
+
result.ref = def.innerType;
|
| 501 |
+
_json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
| 502 |
+
break;
|
| 503 |
+
}
|
| 504 |
+
case "prefault": {
|
| 505 |
+
this.process(def.innerType, params);
|
| 506 |
+
result.ref = def.innerType;
|
| 507 |
+
if (this.io === "input") _json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
| 508 |
+
|
| 509 |
+
break;
|
| 510 |
+
}
|
| 511 |
+
case "catch": {
|
| 512 |
+
// use conditionals
|
| 513 |
+
this.process(def.innerType, params);
|
| 514 |
+
result.ref = def.innerType;
|
| 515 |
+
let catchValue: any;
|
| 516 |
+
try {
|
| 517 |
+
catchValue = def.catchValue(undefined as any);
|
| 518 |
+
} catch {
|
| 519 |
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
| 520 |
+
}
|
| 521 |
+
_json.default = catchValue;
|
| 522 |
+
break;
|
| 523 |
+
}
|
| 524 |
+
case "nan": {
|
| 525 |
+
if (this.unrepresentable === "throw") {
|
| 526 |
+
throw new Error("NaN cannot be represented in JSON Schema");
|
| 527 |
+
}
|
| 528 |
+
break;
|
| 529 |
+
}
|
| 530 |
+
case "template_literal": {
|
| 531 |
+
const json = _json as JSONSchema.StringSchema;
|
| 532 |
+
const pattern = schema._zod.pattern;
|
| 533 |
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
| 534 |
+
json.type = "string";
|
| 535 |
+
json.pattern = pattern.source;
|
| 536 |
+
break;
|
| 537 |
+
}
|
| 538 |
+
case "pipe": {
|
| 539 |
+
const innerType = this.io === "input" ? (def.in._zod.def.type === "transform" ? def.out : def.in) : def.out;
|
| 540 |
+
this.process(innerType, params);
|
| 541 |
+
result.ref = innerType;
|
| 542 |
+
break;
|
| 543 |
+
}
|
| 544 |
+
case "readonly": {
|
| 545 |
+
this.process(def.innerType, params);
|
| 546 |
+
result.ref = def.innerType;
|
| 547 |
+
_json.readOnly = true;
|
| 548 |
+
break;
|
| 549 |
+
}
|
| 550 |
+
// passthrough types
|
| 551 |
+
case "promise": {
|
| 552 |
+
this.process(def.innerType, params);
|
| 553 |
+
result.ref = def.innerType;
|
| 554 |
+
break;
|
| 555 |
+
}
|
| 556 |
+
case "optional": {
|
| 557 |
+
this.process(def.innerType, params);
|
| 558 |
+
result.ref = def.innerType;
|
| 559 |
+
break;
|
| 560 |
+
}
|
| 561 |
+
case "lazy": {
|
| 562 |
+
const innerType = (schema as schemas.$ZodLazy)._zod.innerType;
|
| 563 |
+
this.process(innerType, params);
|
| 564 |
+
result.ref = innerType;
|
| 565 |
+
break;
|
| 566 |
+
}
|
| 567 |
+
case "custom": {
|
| 568 |
+
if (this.unrepresentable === "throw") {
|
| 569 |
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
| 570 |
+
}
|
| 571 |
+
break;
|
| 572 |
+
}
|
| 573 |
+
default: {
|
| 574 |
+
def satisfies never;
|
| 575 |
+
}
|
| 576 |
+
}
|
| 577 |
+
}
|
| 578 |
+
}
|
| 579 |
+
|
| 580 |
+
// metadata
|
| 581 |
+
const meta = this.metadataRegistry.get(schema);
|
| 582 |
+
if (meta) Object.assign(result.schema, meta);
|
| 583 |
+
|
| 584 |
+
if (this.io === "input" && isTransforming(schema)) {
|
| 585 |
+
// examples/defaults only apply to output type of pipe
|
| 586 |
+
delete result.schema.examples;
|
| 587 |
+
delete result.schema.default;
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
// set prefault as default
|
| 591 |
+
if (this.io === "input" && result.schema._prefault) result.schema.default ??= result.schema._prefault;
|
| 592 |
+
delete result.schema._prefault;
|
| 593 |
+
|
| 594 |
+
// pulling fresh from this.seen in case it was overwritten
|
| 595 |
+
const _result = this.seen.get(schema)!;
|
| 596 |
+
|
| 597 |
+
return _result.schema;
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
emit(schema: schemas.$ZodType, _params?: EmitParams): JSONSchema.BaseSchema {
|
| 601 |
+
const params = {
|
| 602 |
+
cycles: _params?.cycles ?? "ref",
|
| 603 |
+
reused: _params?.reused ?? "inline",
|
| 604 |
+
// unrepresentable: _params?.unrepresentable ?? "throw",
|
| 605 |
+
// uri: _params?.uri ?? ((id) => `${id}`),
|
| 606 |
+
external: _params?.external ?? undefined,
|
| 607 |
+
} satisfies EmitParams;
|
| 608 |
+
|
| 609 |
+
// iterate over seen map;
|
| 610 |
+
const root = this.seen.get(schema);
|
| 611 |
+
|
| 612 |
+
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
| 613 |
+
|
| 614 |
+
// initialize result with root schema fields
|
| 615 |
+
// Object.assign(result, seen.cached);
|
| 616 |
+
|
| 617 |
+
// returns a ref to the schema
|
| 618 |
+
// defId will be empty if the ref points to an external schema (or #)
|
| 619 |
+
const makeURI = (entry: [schemas.$ZodType<unknown, unknown>, Seen]): { ref: string; defId?: string } => {
|
| 620 |
+
// comparing the seen objects because sometimes
|
| 621 |
+
// multiple schemas map to the same seen object.
|
| 622 |
+
// e.g. lazy
|
| 623 |
+
|
| 624 |
+
// external is configured
|
| 625 |
+
const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
| 626 |
+
if (params.external) {
|
| 627 |
+
const externalId = params.external.registry.get(entry[0])?.id; // ?? "__shared";// `__schema${this.counter++}`;
|
| 628 |
+
|
| 629 |
+
// check if schema is in the external registry
|
| 630 |
+
const uriGenerator = params.external.uri ?? ((id) => id);
|
| 631 |
+
if (externalId) {
|
| 632 |
+
return { ref: uriGenerator(externalId) };
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
// otherwise, add to __shared
|
| 636 |
+
const id: string = entry[1].defId ?? (entry[1].schema.id as string) ?? `schema${this.counter++}`;
|
| 637 |
+
entry[1].defId = id; // set defId so it will be reused if needed
|
| 638 |
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
if (entry[1] === root) {
|
| 642 |
+
return { ref: "#" };
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
// self-contained schema
|
| 646 |
+
const uriPrefix = `#`;
|
| 647 |
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
| 648 |
+
const defId = entry[1].schema.id ?? `__schema${this.counter++}`;
|
| 649 |
+
return { defId, ref: defUriPrefix + defId };
|
| 650 |
+
};
|
| 651 |
+
|
| 652 |
+
// stored cached version in `def` property
|
| 653 |
+
// remove all properties, set $ref
|
| 654 |
+
const extractToDef = (entry: [schemas.$ZodType<unknown, unknown>, Seen]): void => {
|
| 655 |
+
// if the schema is already a reference, do not extract it
|
| 656 |
+
if (entry[1].schema.$ref) {
|
| 657 |
+
return;
|
| 658 |
+
}
|
| 659 |
+
const seen = entry[1];
|
| 660 |
+
const { ref, defId } = makeURI(entry);
|
| 661 |
+
|
| 662 |
+
seen.def = { ...seen.schema };
|
| 663 |
+
// defId won't be set if the schema is a reference to an external schema
|
| 664 |
+
if (defId) seen.defId = defId;
|
| 665 |
+
// wipe away all properties except $ref
|
| 666 |
+
const schema = seen.schema;
|
| 667 |
+
for (const key in schema) {
|
| 668 |
+
delete schema[key];
|
| 669 |
+
}
|
| 670 |
+
schema.$ref = ref;
|
| 671 |
+
};
|
| 672 |
+
|
| 673 |
+
// throw on cycles
|
| 674 |
+
|
| 675 |
+
// break cycles
|
| 676 |
+
if (params.cycles === "throw") {
|
| 677 |
+
for (const entry of this.seen.entries()) {
|
| 678 |
+
const seen = entry[1];
|
| 679 |
+
if (seen.cycle) {
|
| 680 |
+
throw new Error(
|
| 681 |
+
"Cycle detected: " +
|
| 682 |
+
`#/${seen.cycle?.join("/")}/<root>` +
|
| 683 |
+
'\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.'
|
| 684 |
+
);
|
| 685 |
+
}
|
| 686 |
+
}
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
// extract schemas into $defs
|
| 690 |
+
for (const entry of this.seen.entries()) {
|
| 691 |
+
const seen = entry[1];
|
| 692 |
+
|
| 693 |
+
// convert root schema to # $ref
|
| 694 |
+
if (schema === entry[0]) {
|
| 695 |
+
extractToDef(entry); // this has special handling for the root schema
|
| 696 |
+
continue;
|
| 697 |
+
}
|
| 698 |
+
|
| 699 |
+
// extract schemas that are in the external registry
|
| 700 |
+
if (params.external) {
|
| 701 |
+
const ext = params.external.registry.get(entry[0])?.id;
|
| 702 |
+
if (schema !== entry[0] && ext) {
|
| 703 |
+
extractToDef(entry);
|
| 704 |
+
continue;
|
| 705 |
+
}
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
// extract schemas with `id` meta
|
| 709 |
+
const id = this.metadataRegistry.get(entry[0])?.id;
|
| 710 |
+
if (id) {
|
| 711 |
+
extractToDef(entry);
|
| 712 |
+
continue;
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
// break cycles
|
| 716 |
+
if (seen.cycle) {
|
| 717 |
+
// any
|
| 718 |
+
extractToDef(entry);
|
| 719 |
+
continue;
|
| 720 |
+
}
|
| 721 |
+
|
| 722 |
+
// extract reused schemas
|
| 723 |
+
if (seen.count > 1) {
|
| 724 |
+
if (params.reused === "ref") {
|
| 725 |
+
extractToDef(entry);
|
| 726 |
+
// biome-ignore lint:
|
| 727 |
+
continue;
|
| 728 |
+
}
|
| 729 |
+
}
|
| 730 |
+
}
|
| 731 |
+
|
| 732 |
+
// flatten _refs
|
| 733 |
+
const flattenRef = (zodSchema: schemas.$ZodType, params: Pick<ToJSONSchemaParams, "target">) => {
|
| 734 |
+
const seen = this.seen.get(zodSchema)!;
|
| 735 |
+
const schema = seen.def ?? seen.schema;
|
| 736 |
+
|
| 737 |
+
const _cached = { ...schema };
|
| 738 |
+
|
| 739 |
+
// already seen
|
| 740 |
+
if (seen.ref === null) {
|
| 741 |
+
return;
|
| 742 |
+
}
|
| 743 |
+
|
| 744 |
+
// flatten ref if defined
|
| 745 |
+
const ref = seen.ref;
|
| 746 |
+
seen.ref = null; // prevent recursion
|
| 747 |
+
if (ref) {
|
| 748 |
+
flattenRef(ref, params);
|
| 749 |
+
|
| 750 |
+
// merge referenced schema into current
|
| 751 |
+
const refSchema = this.seen.get(ref)!.schema;
|
| 752 |
+
if (refSchema.$ref && params.target === "draft-7") {
|
| 753 |
+
schema.allOf = schema.allOf ?? [];
|
| 754 |
+
schema.allOf.push(refSchema);
|
| 755 |
+
} else {
|
| 756 |
+
Object.assign(schema, refSchema);
|
| 757 |
+
Object.assign(schema, _cached); // prevent overwriting any fields in the original schema
|
| 758 |
+
}
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
// execute overrides
|
| 762 |
+
if (!seen.isParent)
|
| 763 |
+
this.override({
|
| 764 |
+
zodSchema: zodSchema as schemas.$ZodTypes,
|
| 765 |
+
jsonSchema: schema,
|
| 766 |
+
path: seen.path ?? [],
|
| 767 |
+
});
|
| 768 |
+
};
|
| 769 |
+
|
| 770 |
+
for (const entry of [...this.seen.entries()].reverse()) {
|
| 771 |
+
flattenRef(entry[0], { target: this.target });
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
const result: JSONSchema.BaseSchema = {};
|
| 775 |
+
if (this.target === "draft-2020-12") {
|
| 776 |
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
| 777 |
+
} else if (this.target === "draft-7") {
|
| 778 |
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
| 779 |
+
} else {
|
| 780 |
+
console.warn(`Invalid target: ${this.target}`);
|
| 781 |
+
}
|
| 782 |
+
|
| 783 |
+
if (params.external?.uri) {
|
| 784 |
+
const id = params.external.registry.get(schema)?.id;
|
| 785 |
+
if (!id) throw new Error("Schema is missing an `id` property");
|
| 786 |
+
result.$id = params.external.uri(id);
|
| 787 |
+
}
|
| 788 |
+
|
| 789 |
+
Object.assign(result, root.def);
|
| 790 |
+
|
| 791 |
+
// build defs object
|
| 792 |
+
const defs: JSONSchema.BaseSchema["$defs"] = params.external?.defs ?? {};
|
| 793 |
+
for (const entry of this.seen.entries()) {
|
| 794 |
+
const seen = entry[1];
|
| 795 |
+
if (seen.def && seen.defId) {
|
| 796 |
+
defs[seen.defId] = seen.def;
|
| 797 |
+
}
|
| 798 |
+
}
|
| 799 |
+
|
| 800 |
+
// set definitions in result
|
| 801 |
+
if (params.external) {
|
| 802 |
+
} else {
|
| 803 |
+
if (Object.keys(defs).length > 0) {
|
| 804 |
+
if (this.target === "draft-2020-12") {
|
| 805 |
+
result.$defs = defs;
|
| 806 |
+
} else {
|
| 807 |
+
result.definitions = defs;
|
| 808 |
+
}
|
| 809 |
+
}
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
+
try {
|
| 813 |
+
// this "finalizes" this schema and ensures all cycles are removed
|
| 814 |
+
// each call to .emit() is functionally independent
|
| 815 |
+
// though the seen map is shared
|
| 816 |
+
return JSON.parse(JSON.stringify(result));
|
| 817 |
+
} catch (_err) {
|
| 818 |
+
throw new Error("Error converting schema to JSON.");
|
| 819 |
+
}
|
| 820 |
+
}
|
| 821 |
+
}
|
| 822 |
+
|
| 823 |
+
interface ToJSONSchemaParams extends Omit<JSONSchemaGeneratorParams & EmitParams, "external"> {}
|
| 824 |
+
interface RegistryToJSONSchemaParams extends Omit<JSONSchemaGeneratorParams & EmitParams, "external"> {
|
| 825 |
+
uri?: (id: string) => string;
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
export function toJSONSchema(schema: schemas.$ZodType, _params?: ToJSONSchemaParams): JSONSchema.BaseSchema;
|
| 829 |
+
export function toJSONSchema(
|
| 830 |
+
registry: $ZodRegistry<{ id?: string | undefined }>,
|
| 831 |
+
_params?: RegistryToJSONSchemaParams
|
| 832 |
+
): { schemas: Record<string, JSONSchema.BaseSchema> };
|
| 833 |
+
export function toJSONSchema(
|
| 834 |
+
input: schemas.$ZodType | $ZodRegistry<{ id?: string | undefined }>,
|
| 835 |
+
_params?: ToJSONSchemaParams
|
| 836 |
+
): any {
|
| 837 |
+
if (input instanceof $ZodRegistry) {
|
| 838 |
+
const gen = new JSONSchemaGenerator(_params);
|
| 839 |
+
const defs: any = {};
|
| 840 |
+
for (const entry of input._idmap.entries()) {
|
| 841 |
+
const [_, schema] = entry;
|
| 842 |
+
gen.process(schema);
|
| 843 |
+
}
|
| 844 |
+
|
| 845 |
+
const schemas: Record<string, JSONSchema.BaseSchema> = {};
|
| 846 |
+
const external = {
|
| 847 |
+
registry: input,
|
| 848 |
+
uri: (_params as RegistryToJSONSchemaParams)?.uri,
|
| 849 |
+
defs,
|
| 850 |
+
};
|
| 851 |
+
for (const entry of input._idmap.entries()) {
|
| 852 |
+
const [key, schema] = entry;
|
| 853 |
+
schemas[key] = gen.emit(schema, {
|
| 854 |
+
..._params,
|
| 855 |
+
external,
|
| 856 |
+
});
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
if (Object.keys(defs).length > 0) {
|
| 860 |
+
const defsSegment = gen.target === "draft-2020-12" ? "$defs" : "definitions";
|
| 861 |
+
schemas.__shared = {
|
| 862 |
+
[defsSegment]: defs,
|
| 863 |
+
};
|
| 864 |
+
}
|
| 865 |
+
|
| 866 |
+
return { schemas };
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
const gen = new JSONSchemaGenerator(_params);
|
| 870 |
+
gen.process(input);
|
| 871 |
+
|
| 872 |
+
return gen.emit(input, _params);
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
function isTransforming(
|
| 876 |
+
_schema: schemas.$ZodType,
|
| 877 |
+
_ctx?: {
|
| 878 |
+
seen: Set<schemas.$ZodType>;
|
| 879 |
+
}
|
| 880 |
+
): boolean {
|
| 881 |
+
const ctx = _ctx ?? { seen: new Set() };
|
| 882 |
+
|
| 883 |
+
if (ctx.seen.has(_schema)) return false;
|
| 884 |
+
ctx.seen.add(_schema);
|
| 885 |
+
|
| 886 |
+
const schema = _schema as schemas.$ZodTypes;
|
| 887 |
+
const def = schema._zod.def;
|
| 888 |
+
switch (def.type) {
|
| 889 |
+
case "string":
|
| 890 |
+
case "number":
|
| 891 |
+
case "bigint":
|
| 892 |
+
case "boolean":
|
| 893 |
+
case "date":
|
| 894 |
+
case "symbol":
|
| 895 |
+
case "undefined":
|
| 896 |
+
case "null":
|
| 897 |
+
case "any":
|
| 898 |
+
case "unknown":
|
| 899 |
+
case "never":
|
| 900 |
+
case "void":
|
| 901 |
+
case "literal":
|
| 902 |
+
case "enum":
|
| 903 |
+
case "nan":
|
| 904 |
+
case "file":
|
| 905 |
+
case "template_literal":
|
| 906 |
+
return false;
|
| 907 |
+
case "array": {
|
| 908 |
+
return isTransforming(def.element, ctx);
|
| 909 |
+
}
|
| 910 |
+
case "object": {
|
| 911 |
+
for (const key in def.shape) {
|
| 912 |
+
if (isTransforming(def.shape[key]!, ctx)) return true;
|
| 913 |
+
}
|
| 914 |
+
return false;
|
| 915 |
+
}
|
| 916 |
+
case "union": {
|
| 917 |
+
for (const option of def.options) {
|
| 918 |
+
if (isTransforming(option, ctx)) return true;
|
| 919 |
+
}
|
| 920 |
+
return false;
|
| 921 |
+
}
|
| 922 |
+
case "intersection": {
|
| 923 |
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
| 924 |
+
}
|
| 925 |
+
case "tuple": {
|
| 926 |
+
for (const item of def.items) {
|
| 927 |
+
if (isTransforming(item, ctx)) return true;
|
| 928 |
+
}
|
| 929 |
+
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
| 930 |
+
return false;
|
| 931 |
+
}
|
| 932 |
+
case "record": {
|
| 933 |
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
| 934 |
+
}
|
| 935 |
+
case "map": {
|
| 936 |
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
| 937 |
+
}
|
| 938 |
+
case "set": {
|
| 939 |
+
return isTransforming(def.valueType, ctx);
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
// inner types
|
| 943 |
+
case "promise":
|
| 944 |
+
case "optional":
|
| 945 |
+
case "nonoptional":
|
| 946 |
+
case "nullable":
|
| 947 |
+
case "readonly":
|
| 948 |
+
return isTransforming(def.innerType, ctx);
|
| 949 |
+
case "lazy":
|
| 950 |
+
return isTransforming(def.getter(), ctx);
|
| 951 |
+
case "default": {
|
| 952 |
+
return isTransforming(def.innerType, ctx);
|
| 953 |
+
}
|
| 954 |
+
case "prefault": {
|
| 955 |
+
return isTransforming(def.innerType, ctx);
|
| 956 |
+
}
|
| 957 |
+
case "custom": {
|
| 958 |
+
return false;
|
| 959 |
+
}
|
| 960 |
+
case "transform": {
|
| 961 |
+
return true;
|
| 962 |
+
}
|
| 963 |
+
case "pipe": {
|
| 964 |
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
| 965 |
+
}
|
| 966 |
+
case "success": {
|
| 967 |
+
return false;
|
| 968 |
+
}
|
| 969 |
+
case "catch": {
|
| 970 |
+
return false;
|
| 971 |
+
}
|
| 972 |
+
|
| 973 |
+
default:
|
| 974 |
+
def satisfies never;
|
| 975 |
+
}
|
| 976 |
+
throw new Error(`Unknown schema type: ${(def as any).type}`);
|
| 977 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/util.ts
ADDED
|
@@ -0,0 +1,775 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type * as checks from "./checks.js";
|
| 2 |
+
import type { $ZodConfig } from "./core.js";
|
| 3 |
+
import type * as errors from "./errors.js";
|
| 4 |
+
import type * as schemas from "./schemas.js";
|
| 5 |
+
|
| 6 |
+
// json
|
| 7 |
+
export type JSONType = string | number | boolean | null | JSONType[] | { [key: string]: JSONType };
|
| 8 |
+
export type JWTAlgorithm =
|
| 9 |
+
| "HS256"
|
| 10 |
+
| "HS384"
|
| 11 |
+
| "HS512"
|
| 12 |
+
| "RS256"
|
| 13 |
+
| "RS384"
|
| 14 |
+
| "RS512"
|
| 15 |
+
| "ES256"
|
| 16 |
+
| "ES384"
|
| 17 |
+
| "ES512"
|
| 18 |
+
| "PS256"
|
| 19 |
+
| "PS384"
|
| 20 |
+
| "PS512"
|
| 21 |
+
| "EdDSA"
|
| 22 |
+
| (string & {});
|
| 23 |
+
export type IPVersion = "v4" | "v6";
|
| 24 |
+
export type MimeTypes =
|
| 25 |
+
| "application/json"
|
| 26 |
+
| "application/xml"
|
| 27 |
+
| "application/x-www-form-urlencoded"
|
| 28 |
+
| "application/javascript"
|
| 29 |
+
| "application/pdf"
|
| 30 |
+
| "application/zip"
|
| 31 |
+
| "application/vnd.ms-excel"
|
| 32 |
+
| "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 33 |
+
| "application/msword"
|
| 34 |
+
| "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
| 35 |
+
| "application/vnd.ms-powerpoint"
|
| 36 |
+
| "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
| 37 |
+
| "application/octet-stream"
|
| 38 |
+
| "application/graphql"
|
| 39 |
+
| "text/html"
|
| 40 |
+
| "text/plain"
|
| 41 |
+
| "text/css"
|
| 42 |
+
| "text/javascript"
|
| 43 |
+
| "text/csv"
|
| 44 |
+
| "image/png"
|
| 45 |
+
| "image/jpeg"
|
| 46 |
+
| "image/gif"
|
| 47 |
+
| "image/svg+xml"
|
| 48 |
+
| "image/webp"
|
| 49 |
+
| "audio/mpeg"
|
| 50 |
+
| "audio/ogg"
|
| 51 |
+
| "audio/wav"
|
| 52 |
+
| "audio/webm"
|
| 53 |
+
| "video/mp4"
|
| 54 |
+
| "video/webm"
|
| 55 |
+
| "video/ogg"
|
| 56 |
+
| "font/woff"
|
| 57 |
+
| "font/woff2"
|
| 58 |
+
| "font/ttf"
|
| 59 |
+
| "font/otf"
|
| 60 |
+
| "multipart/form-data"
|
| 61 |
+
| (string & {});
|
| 62 |
+
export type ParsedTypes =
|
| 63 |
+
| "string"
|
| 64 |
+
| "number"
|
| 65 |
+
| "bigint"
|
| 66 |
+
| "boolean"
|
| 67 |
+
| "symbol"
|
| 68 |
+
| "undefined"
|
| 69 |
+
| "object"
|
| 70 |
+
| "function"
|
| 71 |
+
| "file"
|
| 72 |
+
| "date"
|
| 73 |
+
| "array"
|
| 74 |
+
| "map"
|
| 75 |
+
| "set"
|
| 76 |
+
| "nan"
|
| 77 |
+
| "null"
|
| 78 |
+
| "promise";
|
| 79 |
+
|
| 80 |
+
// utils
|
| 81 |
+
export type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
| 82 |
+
export type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;
|
| 83 |
+
export type AssertExtends<T, U> = T extends U ? T : never;
|
| 84 |
+
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
| 85 |
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
| 86 |
+
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
| 87 |
+
export type MakePartial<T, K extends keyof T> = Omit<T, K> & InexactPartial<Pick<T, K>>;
|
| 88 |
+
export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
| 89 |
+
|
| 90 |
+
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
| 91 |
+
export type NoUndefined<T> = T extends undefined ? never : T;
|
| 92 |
+
export type Whatever = {} | undefined | null;
|
| 93 |
+
export type LoosePartial<T extends object> = InexactPartial<T> & {
|
| 94 |
+
[k: string]: unknown;
|
| 95 |
+
};
|
| 96 |
+
export type Mask<Keys extends PropertyKey> = { [K in Keys]?: true };
|
| 97 |
+
export type Writeable<T> = { -readonly [P in keyof T]: T[P] } & {};
|
| 98 |
+
export type InexactPartial<T> = {
|
| 99 |
+
[P in keyof T]?: T[P] | undefined;
|
| 100 |
+
};
|
| 101 |
+
export type EmptyObject = Record<string, never>;
|
| 102 |
+
export type BuiltIn =
|
| 103 |
+
| (((...args: any[]) => any) | (new (...args: any[]) => any))
|
| 104 |
+
| { readonly [Symbol.toStringTag]: string }
|
| 105 |
+
| Date
|
| 106 |
+
| Error
|
| 107 |
+
| Generator
|
| 108 |
+
| Promise<unknown>
|
| 109 |
+
| RegExp;
|
| 110 |
+
export type MakeReadonly<T> = T extends Map<infer K, infer V>
|
| 111 |
+
? ReadonlyMap<K, V>
|
| 112 |
+
: T extends Set<infer V>
|
| 113 |
+
? ReadonlySet<V>
|
| 114 |
+
: T extends [infer Head, ...infer Tail]
|
| 115 |
+
? readonly [Head, ...Tail]
|
| 116 |
+
: T extends Array<infer V>
|
| 117 |
+
? ReadonlyArray<V>
|
| 118 |
+
: T extends BuiltIn
|
| 119 |
+
? T
|
| 120 |
+
: Readonly<T>;
|
| 121 |
+
export type SomeObject = Record<PropertyKey, any>;
|
| 122 |
+
export type Identity<T> = T;
|
| 123 |
+
export type Flatten<T> = Identity<{ [k in keyof T]: T[k] }>;
|
| 124 |
+
export type Mapped<T> = { [k in keyof T]: T[k] };
|
| 125 |
+
export type Prettify<T> = {
|
| 126 |
+
[K in keyof T]: T[K];
|
| 127 |
+
} & {};
|
| 128 |
+
|
| 129 |
+
export type NoNeverKeys<T> = {
|
| 130 |
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
| 131 |
+
}[keyof T];
|
| 132 |
+
export type NoNever<T> = Identity<{
|
| 133 |
+
[k in NoNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
| 134 |
+
}>;
|
| 135 |
+
export type Extend<A extends SomeObject, B extends SomeObject> = Flatten<
|
| 136 |
+
// fast path when there is no keys overlap
|
| 137 |
+
keyof A & keyof B extends never
|
| 138 |
+
? A & B
|
| 139 |
+
: {
|
| 140 |
+
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
| 141 |
+
} & {
|
| 142 |
+
[K in keyof B]: B[K];
|
| 143 |
+
}
|
| 144 |
+
>;
|
| 145 |
+
|
| 146 |
+
export type TupleItems = ReadonlyArray<schemas.SomeType>;
|
| 147 |
+
export type AnyFunc = (...args: any[]) => any;
|
| 148 |
+
export type IsProp<T, K extends keyof T> = T[K] extends AnyFunc ? never : K;
|
| 149 |
+
export type MaybeAsync<T> = T | Promise<T>;
|
| 150 |
+
export type KeyOf<T> = keyof OmitIndexSignature<T>;
|
| 151 |
+
export type OmitIndexSignature<T> = {
|
| 152 |
+
[K in keyof T as string extends K ? never : K extends string ? K : never]: T[K];
|
| 153 |
+
};
|
| 154 |
+
export type ExtractIndexSignature<T> = {
|
| 155 |
+
[K in keyof T as string extends K ? K : K extends string ? never : K]: T[K];
|
| 156 |
+
};
|
| 157 |
+
export type Keys<T extends object> = keyof OmitIndexSignature<T>;
|
| 158 |
+
|
| 159 |
+
export type SchemaClass<T extends schemas.SomeType> = {
|
| 160 |
+
new (def: T["_zod"]["def"]): T;
|
| 161 |
+
};
|
| 162 |
+
export type EnumValue = string | number; // | bigint | boolean | symbol;
|
| 163 |
+
export type EnumLike = Readonly<Record<string, EnumValue>>;
|
| 164 |
+
export type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k }>;
|
| 165 |
+
export type KeysEnum<T extends object> = ToEnum<Exclude<keyof T, symbol>>;
|
| 166 |
+
export type KeysArray<T extends object> = Flatten<(keyof T & string)[]>;
|
| 167 |
+
export type Literal = string | number | bigint | boolean | null | undefined;
|
| 168 |
+
export type LiteralArray = Array<Literal>;
|
| 169 |
+
export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
| 170 |
+
export type PrimitiveArray = Array<Primitive>;
|
| 171 |
+
export type HasSize = { size: number };
|
| 172 |
+
export type HasLength = { length: number }; // string | Array<unknown> | Set<unknown> | File;
|
| 173 |
+
export type Numeric = number | bigint | Date;
|
| 174 |
+
export type SafeParseResult<T> = SafeParseSuccess<T> | SafeParseError<T>;
|
| 175 |
+
export type SafeParseSuccess<T> = { success: true; data: T; error?: never };
|
| 176 |
+
export type SafeParseError<T> = {
|
| 177 |
+
success: false;
|
| 178 |
+
data?: never;
|
| 179 |
+
error: errors.$ZodError<T>;
|
| 180 |
+
};
|
| 181 |
+
|
| 182 |
+
export type PropValues = Record<string, Set<Primitive>>;
|
| 183 |
+
export type PrimitiveSet = Set<Primitive>;
|
| 184 |
+
|
| 185 |
+
// functions
|
| 186 |
+
export function assertEqual<A, B>(val: AssertEqual<A, B>): AssertEqual<A, B> {
|
| 187 |
+
return val;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
export function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<A, B> {
|
| 191 |
+
return val;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
export function assertIs<T>(_arg: T): void {}
|
| 195 |
+
|
| 196 |
+
export function assertNever(_x: never): never {
|
| 197 |
+
throw new Error();
|
| 198 |
+
}
|
| 199 |
+
export function assert<T>(_: any): asserts _ is T {}
|
| 200 |
+
|
| 201 |
+
export function getEnumValues(entries: EnumLike): EnumValue[] {
|
| 202 |
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
| 203 |
+
const values = Object.entries(entries)
|
| 204 |
+
.filter(([k, _]) => numericValues.indexOf(+k) === -1)
|
| 205 |
+
.map(([_, v]) => v);
|
| 206 |
+
return values;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
export function joinValues<T extends Primitive[]>(array: T, separator = "|"): string {
|
| 210 |
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
export function jsonStringifyReplacer(_: string, value: any): any {
|
| 214 |
+
if (typeof value === "bigint") return value.toString();
|
| 215 |
+
return value;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
export function cached<T>(getter: () => T): { value: T } {
|
| 219 |
+
const set = false;
|
| 220 |
+
return {
|
| 221 |
+
get value() {
|
| 222 |
+
if (!set) {
|
| 223 |
+
const value = getter();
|
| 224 |
+
Object.defineProperty(this, "value", { value });
|
| 225 |
+
return value;
|
| 226 |
+
}
|
| 227 |
+
throw new Error("cached value already set");
|
| 228 |
+
},
|
| 229 |
+
};
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
export function nullish(input: any): boolean {
|
| 233 |
+
return input === null || input === undefined;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
export function cleanRegex(source: string): string {
|
| 237 |
+
const start = source.startsWith("^") ? 1 : 0;
|
| 238 |
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
| 239 |
+
return source.slice(start, end);
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
export function floatSafeRemainder(val: number, step: number): number {
|
| 243 |
+
const valDecCount = (val.toString().split(".")[1] || "").length;
|
| 244 |
+
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
| 245 |
+
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
| 246 |
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
| 247 |
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
| 248 |
+
return (valInt % stepInt) / 10 ** decCount;
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
export function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void {
|
| 252 |
+
const set = false;
|
| 253 |
+
Object.defineProperty(object, key, {
|
| 254 |
+
get() {
|
| 255 |
+
if (!set) {
|
| 256 |
+
const value = getter();
|
| 257 |
+
object[key] = value;
|
| 258 |
+
return value;
|
| 259 |
+
}
|
| 260 |
+
throw new Error("cached value already set");
|
| 261 |
+
},
|
| 262 |
+
set(v) {
|
| 263 |
+
Object.defineProperty(object, key, {
|
| 264 |
+
value: v,
|
| 265 |
+
// configurable: true,
|
| 266 |
+
});
|
| 267 |
+
// object[key] = v;
|
| 268 |
+
},
|
| 269 |
+
configurable: true,
|
| 270 |
+
});
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
export function assignProp<T extends object, K extends PropertyKey>(
|
| 274 |
+
target: T,
|
| 275 |
+
prop: K,
|
| 276 |
+
value: K extends keyof T ? T[K] : any
|
| 277 |
+
): void {
|
| 278 |
+
Object.defineProperty(target, prop, {
|
| 279 |
+
value,
|
| 280 |
+
writable: true,
|
| 281 |
+
enumerable: true,
|
| 282 |
+
configurable: true,
|
| 283 |
+
});
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
export function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any {
|
| 287 |
+
if (!path) return obj;
|
| 288 |
+
return path.reduce((acc, key) => acc?.[key], obj);
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
export function promiseAllObject<T extends object>(promisesObj: T): Promise<{ [k in keyof T]: Awaited<T[k]> }> {
|
| 292 |
+
const keys = Object.keys(promisesObj);
|
| 293 |
+
const promises = keys.map((key) => (promisesObj as any)[key]);
|
| 294 |
+
|
| 295 |
+
return Promise.all(promises).then((results) => {
|
| 296 |
+
const resolvedObj: any = {};
|
| 297 |
+
for (let i = 0; i < keys.length; i++) {
|
| 298 |
+
resolvedObj[keys[i]!] = results[i];
|
| 299 |
+
}
|
| 300 |
+
return resolvedObj;
|
| 301 |
+
});
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
export function randomString(length = 10): string {
|
| 305 |
+
const chars = "abcdefghijklmnopqrstuvwxyz";
|
| 306 |
+
let str = "";
|
| 307 |
+
for (let i = 0; i < length; i++) {
|
| 308 |
+
str += chars[Math.floor(Math.random() * chars.length)];
|
| 309 |
+
}
|
| 310 |
+
return str;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
export function esc(str: string): string {
|
| 314 |
+
return JSON.stringify(str);
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
export const captureStackTrace: (targetObject: object, constructorOpt?: Function) => void = Error.captureStackTrace
|
| 318 |
+
? Error.captureStackTrace
|
| 319 |
+
: (..._args) => {};
|
| 320 |
+
|
| 321 |
+
export function isObject(data: any): data is Record<PropertyKey, unknown> {
|
| 322 |
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
export const allowsEval: { value: boolean } = cached(() => {
|
| 326 |
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
| 327 |
+
return false;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
try {
|
| 331 |
+
const F = Function;
|
| 332 |
+
new F("");
|
| 333 |
+
return true;
|
| 334 |
+
} catch (_) {
|
| 335 |
+
return false;
|
| 336 |
+
}
|
| 337 |
+
});
|
| 338 |
+
|
| 339 |
+
export function isPlainObject(o: any): o is Record<PropertyKey, unknown> {
|
| 340 |
+
if (isObject(o) === false) return false;
|
| 341 |
+
|
| 342 |
+
// modified constructor
|
| 343 |
+
const ctor = o.constructor;
|
| 344 |
+
if (ctor === undefined) return true;
|
| 345 |
+
|
| 346 |
+
// modified prototype
|
| 347 |
+
const prot = ctor.prototype;
|
| 348 |
+
if (isObject(prot) === false) return false;
|
| 349 |
+
|
| 350 |
+
// ctor doesn't have static `isPrototypeOf`
|
| 351 |
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
| 352 |
+
return false;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
return true;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
export function numKeys(data: any): number {
|
| 359 |
+
let keyCount = 0;
|
| 360 |
+
for (const key in data) {
|
| 361 |
+
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
| 362 |
+
keyCount++;
|
| 363 |
+
}
|
| 364 |
+
}
|
| 365 |
+
return keyCount;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
export const getParsedType = (data: any): ParsedTypes => {
|
| 369 |
+
const t = typeof data;
|
| 370 |
+
|
| 371 |
+
switch (t) {
|
| 372 |
+
case "undefined":
|
| 373 |
+
return "undefined";
|
| 374 |
+
|
| 375 |
+
case "string":
|
| 376 |
+
return "string";
|
| 377 |
+
|
| 378 |
+
case "number":
|
| 379 |
+
return Number.isNaN(data) ? "nan" : "number";
|
| 380 |
+
|
| 381 |
+
case "boolean":
|
| 382 |
+
return "boolean";
|
| 383 |
+
|
| 384 |
+
case "function":
|
| 385 |
+
return "function";
|
| 386 |
+
|
| 387 |
+
case "bigint":
|
| 388 |
+
return "bigint";
|
| 389 |
+
|
| 390 |
+
case "symbol":
|
| 391 |
+
return "symbol";
|
| 392 |
+
|
| 393 |
+
case "object":
|
| 394 |
+
if (Array.isArray(data)) {
|
| 395 |
+
return "array";
|
| 396 |
+
}
|
| 397 |
+
if (data === null) {
|
| 398 |
+
return "null";
|
| 399 |
+
}
|
| 400 |
+
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
| 401 |
+
return "promise";
|
| 402 |
+
}
|
| 403 |
+
if (typeof Map !== "undefined" && data instanceof Map) {
|
| 404 |
+
return "map";
|
| 405 |
+
}
|
| 406 |
+
if (typeof Set !== "undefined" && data instanceof Set) {
|
| 407 |
+
return "set";
|
| 408 |
+
}
|
| 409 |
+
if (typeof Date !== "undefined" && data instanceof Date) {
|
| 410 |
+
return "date";
|
| 411 |
+
}
|
| 412 |
+
if (typeof File !== "undefined" && data instanceof File) {
|
| 413 |
+
return "file";
|
| 414 |
+
}
|
| 415 |
+
return "object";
|
| 416 |
+
|
| 417 |
+
default:
|
| 418 |
+
throw new Error(`Unknown data type: ${t}`);
|
| 419 |
+
}
|
| 420 |
+
};
|
| 421 |
+
|
| 422 |
+
export const propertyKeyTypes: Set<string> = new Set(["string", "number", "symbol"]);
|
| 423 |
+
export const primitiveTypes: Set<string> = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
|
| 424 |
+
export function escapeRegex(str: string): string {
|
| 425 |
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
// zod-specific utils
|
| 429 |
+
export function clone<T extends schemas.$ZodType>(inst: T, def?: T["_zod"]["def"], params?: { parent: boolean }): T {
|
| 430 |
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
| 431 |
+
if (!def || params?.parent) cl._zod.parent = inst;
|
| 432 |
+
return cl as any;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
export type EmptyToNever<T> = keyof T extends never ? never : T;
|
| 436 |
+
|
| 437 |
+
export type Normalize<T> = T extends undefined
|
| 438 |
+
? never
|
| 439 |
+
: T extends Record<any, any>
|
| 440 |
+
? Flatten<
|
| 441 |
+
{
|
| 442 |
+
[k in keyof Omit<T, "error" | "message">]: T[k];
|
| 443 |
+
} & ("error" extends keyof T
|
| 444 |
+
? {
|
| 445 |
+
error?: Exclude<T["error"], string>;
|
| 446 |
+
// path?: PropertyKey[] | undefined;
|
| 447 |
+
// message?: string | undefined;
|
| 448 |
+
}
|
| 449 |
+
: unknown)
|
| 450 |
+
>
|
| 451 |
+
: never;
|
| 452 |
+
|
| 453 |
+
export function normalizeParams<T>(_params: T): Normalize<T> {
|
| 454 |
+
const params: any = _params;
|
| 455 |
+
|
| 456 |
+
if (!params) return {} as any;
|
| 457 |
+
if (typeof params === "string") return { error: () => params } as any;
|
| 458 |
+
if (params?.message !== undefined) {
|
| 459 |
+
if (params?.error !== undefined) throw new Error("Cannot specify both `message` and `error` params");
|
| 460 |
+
params.error = params.message;
|
| 461 |
+
}
|
| 462 |
+
delete params.message;
|
| 463 |
+
if (typeof params.error === "string") return { ...params, error: () => params.error } as any;
|
| 464 |
+
return params;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
export function createTransparentProxy<T extends object>(getter: () => T): T {
|
| 468 |
+
let target: T;
|
| 469 |
+
return new Proxy(
|
| 470 |
+
{},
|
| 471 |
+
{
|
| 472 |
+
get(_, prop, receiver) {
|
| 473 |
+
target ??= getter();
|
| 474 |
+
return Reflect.get(target, prop, receiver);
|
| 475 |
+
},
|
| 476 |
+
set(_, prop, value, receiver) {
|
| 477 |
+
target ??= getter();
|
| 478 |
+
return Reflect.set(target, prop, value, receiver);
|
| 479 |
+
},
|
| 480 |
+
has(_, prop) {
|
| 481 |
+
target ??= getter();
|
| 482 |
+
return Reflect.has(target, prop);
|
| 483 |
+
},
|
| 484 |
+
deleteProperty(_, prop) {
|
| 485 |
+
target ??= getter();
|
| 486 |
+
return Reflect.deleteProperty(target, prop);
|
| 487 |
+
},
|
| 488 |
+
ownKeys(_) {
|
| 489 |
+
target ??= getter();
|
| 490 |
+
return Reflect.ownKeys(target);
|
| 491 |
+
},
|
| 492 |
+
getOwnPropertyDescriptor(_, prop) {
|
| 493 |
+
target ??= getter();
|
| 494 |
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
| 495 |
+
},
|
| 496 |
+
defineProperty(_, prop, descriptor) {
|
| 497 |
+
target ??= getter();
|
| 498 |
+
return Reflect.defineProperty(target, prop, descriptor);
|
| 499 |
+
},
|
| 500 |
+
}
|
| 501 |
+
) as T;
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
export function stringifyPrimitive(value: any): string {
|
| 505 |
+
if (typeof value === "bigint") return value.toString() + "n";
|
| 506 |
+
if (typeof value === "string") return `"${value}"`;
|
| 507 |
+
return `${value}`;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
export function optionalKeys(shape: schemas.$ZodShape): string[] {
|
| 511 |
+
return Object.keys(shape).filter((k) => {
|
| 512 |
+
return shape[k]!._zod.optin === "optional" && shape[k]!._zod.optout === "optional";
|
| 513 |
+
});
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
export type CleanKey<T extends PropertyKey> = T extends `?${infer K}` ? K : T extends `${infer K}?` ? K : T;
|
| 517 |
+
export type ToCleanMap<T extends schemas.$ZodLooseShape> = {
|
| 518 |
+
[k in keyof T]: k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k;
|
| 519 |
+
};
|
| 520 |
+
export type FromCleanMap<T extends schemas.$ZodLooseShape> = {
|
| 521 |
+
[k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k;
|
| 522 |
+
};
|
| 523 |
+
|
| 524 |
+
export const NUMBER_FORMAT_RANGES: Record<checks.$ZodNumberFormats, [number, number]> = {
|
| 525 |
+
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
| 526 |
+
int32: [-2147483648, 2147483647],
|
| 527 |
+
uint32: [0, 4294967295],
|
| 528 |
+
float32: [-3.4028234663852886e38, 3.4028234663852886e38],
|
| 529 |
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
|
| 530 |
+
};
|
| 531 |
+
|
| 532 |
+
export const BIGINT_FORMAT_RANGES: Record<checks.$ZodBigIntFormats, [bigint, bigint]> = {
|
| 533 |
+
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
|
| 534 |
+
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
|
| 535 |
+
};
|
| 536 |
+
|
| 537 |
+
export function pick(schema: schemas.$ZodObject, mask: Record<string, unknown>): any {
|
| 538 |
+
const newShape: Writeable<schemas.$ZodShape> = {};
|
| 539 |
+
const currDef = schema._zod.def; //.shape;
|
| 540 |
+
|
| 541 |
+
for (const key in mask) {
|
| 542 |
+
if (!(key in currDef.shape)) {
|
| 543 |
+
throw new Error(`Unrecognized key: "${key}"`);
|
| 544 |
+
}
|
| 545 |
+
if (!mask[key]) continue;
|
| 546 |
+
|
| 547 |
+
// pick key
|
| 548 |
+
newShape[key] = currDef.shape[key]!;
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
return clone(schema, {
|
| 552 |
+
...schema._zod.def,
|
| 553 |
+
shape: newShape,
|
| 554 |
+
checks: [],
|
| 555 |
+
}) as any;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
export function omit(schema: schemas.$ZodObject, mask: object): any {
|
| 559 |
+
const newShape: Writeable<schemas.$ZodShape> = { ...schema._zod.def.shape };
|
| 560 |
+
const currDef = schema._zod.def; //.shape;
|
| 561 |
+
for (const key in mask) {
|
| 562 |
+
if (!(key in currDef.shape)) {
|
| 563 |
+
throw new Error(`Unrecognized key: "${key}"`);
|
| 564 |
+
}
|
| 565 |
+
if (!(mask as any)[key]) continue;
|
| 566 |
+
|
| 567 |
+
delete newShape[key];
|
| 568 |
+
}
|
| 569 |
+
return clone(schema, {
|
| 570 |
+
...schema._zod.def,
|
| 571 |
+
shape: newShape,
|
| 572 |
+
checks: [],
|
| 573 |
+
});
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
export function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any {
|
| 577 |
+
if (!isPlainObject(shape)) {
|
| 578 |
+
throw new Error("Invalid input to extend: expected a plain object");
|
| 579 |
+
}
|
| 580 |
+
const def = {
|
| 581 |
+
...schema._zod.def,
|
| 582 |
+
get shape() {
|
| 583 |
+
const _shape = { ...schema._zod.def.shape, ...shape };
|
| 584 |
+
assignProp(this, "shape", _shape); // self-caching
|
| 585 |
+
return _shape;
|
| 586 |
+
},
|
| 587 |
+
checks: [], // delete existing checks
|
| 588 |
+
} as any;
|
| 589 |
+
return clone(schema, def) as any;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
export function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any {
|
| 593 |
+
return clone(a, {
|
| 594 |
+
...a._zod.def,
|
| 595 |
+
get shape() {
|
| 596 |
+
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
| 597 |
+
assignProp(this, "shape", _shape); // self-caching
|
| 598 |
+
return _shape;
|
| 599 |
+
},
|
| 600 |
+
catchall: b._zod.def.catchall,
|
| 601 |
+
checks: [], // delete existing checks
|
| 602 |
+
}) as any;
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
export function partial(
|
| 606 |
+
Class: SchemaClass<schemas.$ZodOptional> | null,
|
| 607 |
+
schema: schemas.$ZodObject,
|
| 608 |
+
mask: object | undefined
|
| 609 |
+
): any {
|
| 610 |
+
const oldShape = schema._zod.def.shape;
|
| 611 |
+
const shape: Writeable<schemas.$ZodShape> = { ...oldShape };
|
| 612 |
+
|
| 613 |
+
if (mask) {
|
| 614 |
+
for (const key in mask) {
|
| 615 |
+
if (!(key in oldShape)) {
|
| 616 |
+
throw new Error(`Unrecognized key: "${key}"`);
|
| 617 |
+
}
|
| 618 |
+
if (!(mask as any)[key]) continue;
|
| 619 |
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
| 620 |
+
shape[key] = Class
|
| 621 |
+
? new Class({
|
| 622 |
+
type: "optional",
|
| 623 |
+
innerType: oldShape[key]!,
|
| 624 |
+
})
|
| 625 |
+
: oldShape[key]!;
|
| 626 |
+
}
|
| 627 |
+
} else {
|
| 628 |
+
for (const key in oldShape) {
|
| 629 |
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
| 630 |
+
shape[key] = Class
|
| 631 |
+
? new Class({
|
| 632 |
+
type: "optional",
|
| 633 |
+
innerType: oldShape[key]!,
|
| 634 |
+
})
|
| 635 |
+
: oldShape[key]!;
|
| 636 |
+
}
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
return clone(schema, {
|
| 640 |
+
...schema._zod.def,
|
| 641 |
+
shape,
|
| 642 |
+
checks: [],
|
| 643 |
+
}) as any;
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
export function required(
|
| 647 |
+
Class: SchemaClass<schemas.$ZodNonOptional>,
|
| 648 |
+
schema: schemas.$ZodObject,
|
| 649 |
+
mask: object | undefined
|
| 650 |
+
): any {
|
| 651 |
+
const oldShape = schema._zod.def.shape;
|
| 652 |
+
const shape: Writeable<schemas.$ZodShape> = { ...oldShape };
|
| 653 |
+
|
| 654 |
+
if (mask) {
|
| 655 |
+
for (const key in mask) {
|
| 656 |
+
if (!(key in shape)) {
|
| 657 |
+
throw new Error(`Unrecognized key: "${key}"`);
|
| 658 |
+
}
|
| 659 |
+
if (!(mask as any)[key]) continue;
|
| 660 |
+
// overwrite with non-optional
|
| 661 |
+
shape[key] = new Class({
|
| 662 |
+
type: "nonoptional",
|
| 663 |
+
innerType: oldShape[key]!,
|
| 664 |
+
});
|
| 665 |
+
}
|
| 666 |
+
} else {
|
| 667 |
+
for (const key in oldShape) {
|
| 668 |
+
// overwrite with non-optional
|
| 669 |
+
shape[key] = new Class({
|
| 670 |
+
type: "nonoptional",
|
| 671 |
+
innerType: oldShape[key]!,
|
| 672 |
+
});
|
| 673 |
+
}
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
return clone(schema, {
|
| 677 |
+
...schema._zod.def,
|
| 678 |
+
shape,
|
| 679 |
+
// optional: [],
|
| 680 |
+
checks: [],
|
| 681 |
+
}) as any;
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
|
| 685 |
+
|
| 686 |
+
export function aborted(x: schemas.ParsePayload, startIndex = 0): boolean {
|
| 687 |
+
for (let i = startIndex; i < x.issues.length; i++) {
|
| 688 |
+
if (x.issues[i]?.continue !== true) return true;
|
| 689 |
+
}
|
| 690 |
+
return false;
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
export function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[] {
|
| 694 |
+
return issues.map((iss) => {
|
| 695 |
+
(iss as any).path ??= [];
|
| 696 |
+
(iss as any).path.unshift(path);
|
| 697 |
+
return iss;
|
| 698 |
+
});
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
export function unwrapMessage(message: string | { message: string } | undefined | null): string | undefined {
|
| 702 |
+
return typeof message === "string" ? message : message?.message;
|
| 703 |
+
}
|
| 704 |
+
|
| 705 |
+
export function finalizeIssue(
|
| 706 |
+
iss: errors.$ZodRawIssue,
|
| 707 |
+
ctx: schemas.ParseContextInternal | undefined,
|
| 708 |
+
config: $ZodConfig
|
| 709 |
+
): errors.$ZodIssue {
|
| 710 |
+
const full = { ...iss, path: iss.path ?? [] } as errors.$ZodIssue;
|
| 711 |
+
|
| 712 |
+
// for backwards compatibility
|
| 713 |
+
if (!iss.message) {
|
| 714 |
+
const message =
|
| 715 |
+
unwrapMessage(iss.inst?._zod.def?.error?.(iss as never)) ??
|
| 716 |
+
unwrapMessage(ctx?.error?.(iss as never)) ??
|
| 717 |
+
unwrapMessage(config.customError?.(iss)) ??
|
| 718 |
+
unwrapMessage(config.localeError?.(iss)) ??
|
| 719 |
+
"Invalid input";
|
| 720 |
+
(full as any).message = message;
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
// delete (full as any).def;
|
| 724 |
+
delete (full as any).inst;
|
| 725 |
+
delete (full as any).continue;
|
| 726 |
+
if (!ctx?.reportInput) {
|
| 727 |
+
delete (full as any).input;
|
| 728 |
+
}
|
| 729 |
+
|
| 730 |
+
return full;
|
| 731 |
+
}
|
| 732 |
+
|
| 733 |
+
export function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown" {
|
| 734 |
+
if (input instanceof Set) return "set";
|
| 735 |
+
if (input instanceof Map) return "map";
|
| 736 |
+
if (input instanceof File) return "file";
|
| 737 |
+
return "unknown";
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
export function getLengthableOrigin(input: any): "array" | "string" | "unknown" {
|
| 741 |
+
if (Array.isArray(input)) return "array";
|
| 742 |
+
if (typeof input === "string") return "string";
|
| 743 |
+
return "unknown";
|
| 744 |
+
}
|
| 745 |
+
|
| 746 |
+
////////// REFINES //////////
|
| 747 |
+
export function issue(_iss: string, input: any, inst: any): errors.$ZodRawIssue;
|
| 748 |
+
export function issue(_iss: errors.$ZodRawIssue): errors.$ZodRawIssue;
|
| 749 |
+
export function issue(...args: [string | errors.$ZodRawIssue, any?, any?]): errors.$ZodRawIssue {
|
| 750 |
+
const [iss, input, inst] = args;
|
| 751 |
+
if (typeof iss === "string") {
|
| 752 |
+
return {
|
| 753 |
+
message: iss,
|
| 754 |
+
code: "custom",
|
| 755 |
+
input,
|
| 756 |
+
inst,
|
| 757 |
+
};
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
return { ...iss };
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
export function cleanEnum(obj: Record<string, EnumValue>): EnumValue[] {
|
| 764 |
+
return Object.entries(obj)
|
| 765 |
+
.filter(([k, _]) => {
|
| 766 |
+
// return true if NaN, meaning it's not a number, thus a string key
|
| 767 |
+
return Number.isNaN(Number.parseInt(k, 10));
|
| 768 |
+
})
|
| 769 |
+
.map((el) => el[1]);
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
// instanceof
|
| 773 |
+
export abstract class Class {
|
| 774 |
+
constructor(..._args: any[]) {}
|
| 775 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/versions.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const version = {
|
| 2 |
+
major: 4,
|
| 3 |
+
minor: 0,
|
| 4 |
+
patch: 0 as number,
|
| 5 |
+
} as const;
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/core/zsf.ts
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
///////////////////////////////////////////////////
|
| 2 |
+
//////////////// TYPES ///////////////////
|
| 3 |
+
///////////////////////////////////////////////////
|
| 4 |
+
|
| 5 |
+
export interface $ZSF {
|
| 6 |
+
$zsf: { version: number };
|
| 7 |
+
type: string;
|
| 8 |
+
// default value if not defined
|
| 9 |
+
default: unknown;
|
| 10 |
+
// fallback value if validation fails
|
| 11 |
+
fallback: unknown;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
export interface $ZSFString extends $ZSF {
|
| 15 |
+
type: "string";
|
| 16 |
+
min_length?: number;
|
| 17 |
+
max_length?: number;
|
| 18 |
+
pattern?: string;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
export type NumberTypes = "float32" | "int32" | "uint32" | "float64" | "int64" | "uint64" | "bigint" | "bigdecimal";
|
| 22 |
+
|
| 23 |
+
export interface $ZSFNumber extends $ZSF {
|
| 24 |
+
type: "number";
|
| 25 |
+
format?: NumberTypes;
|
| 26 |
+
minimum?: number;
|
| 27 |
+
maximum?: number;
|
| 28 |
+
multiple_of?: number;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
export interface $ZSFBoolean extends $ZSF {
|
| 32 |
+
type: "boolean";
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
export interface $ZSFNull extends $ZSF {
|
| 36 |
+
type: "null";
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
export interface $ZSFUndefined extends $ZSF {
|
| 40 |
+
type: "undefined";
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
export interface $ZSFOptional<T extends $ZSF = $ZSF> extends $ZSF {
|
| 44 |
+
type: "optional";
|
| 45 |
+
inner: T;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
export interface $ZSFNever extends $ZSF {
|
| 49 |
+
type: "never";
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
export interface $ZSFAny extends $ZSF {
|
| 53 |
+
type: "any";
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/** Supports */
|
| 57 |
+
export interface $ZSFEnum<Elements extends { [k: string]: $ZSFLiteral } = { [k: string]: $ZSFLiteral }> extends $ZSF {
|
| 58 |
+
type: "enum";
|
| 59 |
+
elements: Elements;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
export interface $ZSFArray<PrefixItems extends $ZSF[] = $ZSF[], Items extends $ZSF = $ZSF> extends $ZSF {
|
| 63 |
+
type: "array";
|
| 64 |
+
prefixItems: PrefixItems;
|
| 65 |
+
items: Items;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// type $ZSFObjectProperties = { [k: string]: $ZSF };
|
| 69 |
+
type $ZSFObjectProperties = Array<{
|
| 70 |
+
key: string;
|
| 71 |
+
value: $ZSF;
|
| 72 |
+
format?: "literal" | "pattern";
|
| 73 |
+
ordering?: number;
|
| 74 |
+
}>;
|
| 75 |
+
export interface $ZSFObject<Properties extends $ZSFObjectProperties = $ZSFObjectProperties> extends $ZSF {
|
| 76 |
+
type: "object";
|
| 77 |
+
properties: Properties;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// export interface $ZSFTuple<
|
| 81 |
+
// Items extends $ZSF[] = $ZSF[],
|
| 82 |
+
// Rest extends $ZSF = $ZSF,
|
| 83 |
+
// > extends $ZSF {
|
| 84 |
+
// type: "array";
|
| 85 |
+
// items: Items;
|
| 86 |
+
// rest: Rest;
|
| 87 |
+
// }
|
| 88 |
+
|
| 89 |
+
/** Supports arbitrary literal values */
|
| 90 |
+
export interface $ZSFLiteral<T extends $ZSF = $ZSF> extends $ZSF {
|
| 91 |
+
type: "literal";
|
| 92 |
+
schema: T;
|
| 93 |
+
value: unknown;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
export interface $ZSFUnion<Elements extends $ZSF[] = $ZSF[]> extends $ZSF {
|
| 97 |
+
type: "union";
|
| 98 |
+
elements: Elements;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
export interface $ZSFIntersection extends $ZSF {
|
| 102 |
+
type: "intersection";
|
| 103 |
+
elements: $ZSF[];
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
export interface $ZSFMap<K extends $ZSF = $ZSF, V extends $ZSF = $ZSF> extends $ZSF {
|
| 107 |
+
type: "map";
|
| 108 |
+
keys: K;
|
| 109 |
+
values: V;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
export interface $ZSFConditional<If extends $ZSF, Then extends $ZSF, Else extends $ZSF> extends $ZSF {
|
| 113 |
+
type: "conditional";
|
| 114 |
+
if: If;
|
| 115 |
+
then: Then;
|
| 116 |
+
else: Else;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/////////////////////////////////////////////////
|
| 120 |
+
//////////////// CHECKS ////////////////
|
| 121 |
+
/////////////////////////////////////////////////
|
| 122 |
+
|
| 123 |
+
// export interface $ZSFCheckRegex {
|
| 124 |
+
// check: "regex";
|
| 125 |
+
// pattern: string;
|
| 126 |
+
// }
|
| 127 |
+
|
| 128 |
+
// export interface $ZSFCheckEmail {
|
| 129 |
+
// check: "email";
|
| 130 |
+
// }
|
| 131 |
+
|
| 132 |
+
// export interface $ZSFCheckURL {
|
| 133 |
+
// check: "url";
|
| 134 |
+
// }
|
| 135 |
+
|
| 136 |
+
// export interface $ZSFCheckEmoji {
|
| 137 |
+
// check: "emoji";
|
| 138 |
+
// }
|
| 139 |
+
|
| 140 |
+
// export interface $ZSFCheckUUID {
|
| 141 |
+
// check: "uuid";
|
| 142 |
+
// }
|
| 143 |
+
|
| 144 |
+
// export interface $ZSFCheckUUIDv4 {
|
| 145 |
+
// check: "uuidv4";
|
| 146 |
+
// }
|
| 147 |
+
|
| 148 |
+
// export interface $ZSFCheckUUIDv6 {
|
| 149 |
+
// check: "uuidv6";
|
| 150 |
+
// }
|
| 151 |
+
|
| 152 |
+
// export interface $ZSFCheckNanoid {
|
| 153 |
+
// check: "nanoid";
|
| 154 |
+
// }
|
| 155 |
+
|
| 156 |
+
// export interface $ZSFCheckGUID {
|
| 157 |
+
// check: "guid";
|
| 158 |
+
// }
|
| 159 |
+
|
| 160 |
+
// export interface $ZSFCheckCUID {
|
| 161 |
+
// check: "cuid";
|
| 162 |
+
// }
|
| 163 |
+
|
| 164 |
+
// export interface $ZSFCheckCUID2 {
|
| 165 |
+
// check: "cuid2";
|
| 166 |
+
// }
|
| 167 |
+
|
| 168 |
+
// export interface $ZSFCheckULID {
|
| 169 |
+
// check: "ulid";
|
| 170 |
+
// }
|
| 171 |
+
|
| 172 |
+
// export interface $ZSFCheckXID {
|
| 173 |
+
// check: "xid";
|
| 174 |
+
// }
|
| 175 |
+
|
| 176 |
+
// export interface $ZSFCheckKSUID {
|
| 177 |
+
// check: "ksuid";
|
| 178 |
+
// }
|
| 179 |
+
|
| 180 |
+
// export interface $ZSFCheckISODateTime {
|
| 181 |
+
// check: "datetime";
|
| 182 |
+
// precision?: number;
|
| 183 |
+
// local?: boolean;
|
| 184 |
+
// }
|
| 185 |
+
|
| 186 |
+
// export interface $ZSFCheckISODate {
|
| 187 |
+
// check: "date";
|
| 188 |
+
// }
|
| 189 |
+
|
| 190 |
+
// export interface $ZSFCheckISOTime {
|
| 191 |
+
// check: "time";
|
| 192 |
+
// precision?: number;
|
| 193 |
+
// local?: boolean;
|
| 194 |
+
// }
|
| 195 |
+
|
| 196 |
+
// export interface $ZSFCheckDuration {
|
| 197 |
+
// check: "duration";
|
| 198 |
+
// }
|
| 199 |
+
|
| 200 |
+
// export interface $ZSFCheckIP {
|
| 201 |
+
// check: "ip";
|
| 202 |
+
// }
|
| 203 |
+
|
| 204 |
+
// export interface $ZSFCheckIPv4 {
|
| 205 |
+
// check: "ipv4";
|
| 206 |
+
// }
|
| 207 |
+
|
| 208 |
+
// export interface $ZSFCheckIPv6 {
|
| 209 |
+
// check: "ipv6";
|
| 210 |
+
// }
|
| 211 |
+
|
| 212 |
+
// export interface $ZSFCheckBase64 {
|
| 213 |
+
// check: "base64";
|
| 214 |
+
// }
|
| 215 |
+
|
| 216 |
+
// export interface $ZSFCheckJWT {
|
| 217 |
+
// check: "jwt";
|
| 218 |
+
// }
|
| 219 |
+
|
| 220 |
+
// export interface $ZSFCheckJSONString {
|
| 221 |
+
// check: "json_string";
|
| 222 |
+
// }
|
| 223 |
+
|
| 224 |
+
// export interface $ZSFCheckPrefix {
|
| 225 |
+
// check: "prefix";
|
| 226 |
+
// prefix: string;
|
| 227 |
+
// }
|
| 228 |
+
|
| 229 |
+
// export interface $ZSFCheckSuffix {
|
| 230 |
+
// check: "suffix";
|
| 231 |
+
// suffix: string;
|
| 232 |
+
// }
|
| 233 |
+
|
| 234 |
+
// export interface $ZSFCheckIncludes {
|
| 235 |
+
// check: "includes";
|
| 236 |
+
// includes: string;
|
| 237 |
+
// }
|
| 238 |
+
|
| 239 |
+
// export interface $ZSFCheckMinSize {
|
| 240 |
+
// check: "min_size";
|
| 241 |
+
// minimum: number;
|
| 242 |
+
// }
|
| 243 |
+
|
| 244 |
+
// export interface $ZSFCheckMaxSize {
|
| 245 |
+
// check: "max_size";
|
| 246 |
+
// maximum: number;
|
| 247 |
+
// }
|
| 248 |
+
|
| 249 |
+
// export interface $ZSFCheckSizeEquals {
|
| 250 |
+
// check: "size_equals";
|
| 251 |
+
// size: number;
|
| 252 |
+
// }
|
| 253 |
+
|
| 254 |
+
// export interface $ZSFCheckLessThan {
|
| 255 |
+
// check: "less_than";
|
| 256 |
+
// maximum: number | bigint | Date;
|
| 257 |
+
// }
|
| 258 |
+
|
| 259 |
+
// export interface $ZSFCheckLessThanOrEqual {
|
| 260 |
+
// check: "less_than_or_equal";
|
| 261 |
+
// maximum: number | bigint | Date;
|
| 262 |
+
// }
|
| 263 |
+
|
| 264 |
+
// export interface $ZSFCheckGreaterThan {
|
| 265 |
+
// check: "greater_than";
|
| 266 |
+
// minimum: number | bigint | Date;
|
| 267 |
+
// }
|
| 268 |
+
|
| 269 |
+
// export interface $ZSFCheckGreaterThanOrEqual {
|
| 270 |
+
// check: "greater_than_or_equal";
|
| 271 |
+
// minimum: number | bigint | Date;
|
| 272 |
+
// }
|
| 273 |
+
|
| 274 |
+
// export interface $ZSFCheckEquals {
|
| 275 |
+
// check: "equals";
|
| 276 |
+
// value: number | bigint | Date;
|
| 277 |
+
// }
|
| 278 |
+
|
| 279 |
+
// export interface $ZSFCheckMultipleOf {
|
| 280 |
+
// check: "multiple_of";
|
| 281 |
+
// multipleOf: number;
|
| 282 |
+
// }
|
| 283 |
+
|
| 284 |
+
// export type $ZSFStringFormatChecks =
|
| 285 |
+
// | $ZSFCheckRegex
|
| 286 |
+
// | $ZSFCheckEmail
|
| 287 |
+
// | $ZSFCheckURL
|
| 288 |
+
// | $ZSFCheckEmoji
|
| 289 |
+
// | $ZSFCheckUUID
|
| 290 |
+
// | $ZSFCheckUUIDv4
|
| 291 |
+
// | $ZSFCheckUUIDv6
|
| 292 |
+
// | $ZSFCheckNanoid
|
| 293 |
+
// | $ZSFCheckGUID
|
| 294 |
+
// | $ZSFCheckCUID
|
| 295 |
+
// | $ZSFCheckCUID2
|
| 296 |
+
// | $ZSFCheckULID
|
| 297 |
+
// | $ZSFCheckXID
|
| 298 |
+
// | $ZSFCheckKSUID
|
| 299 |
+
// | $ZSFCheckISODateTime
|
| 300 |
+
// | $ZSFCheckISODate
|
| 301 |
+
// | $ZSFCheckISOTime
|
| 302 |
+
// | $ZSFCheckDuration
|
| 303 |
+
// | $ZSFCheckIP
|
| 304 |
+
// | $ZSFCheckIPv4
|
| 305 |
+
// | $ZSFCheckIPv6
|
| 306 |
+
// | $ZSFCheckBase64
|
| 307 |
+
// | $ZSFCheckJWT
|
| 308 |
+
// | $ZSFCheckJSONString
|
| 309 |
+
// | $ZSFCheckPrefix
|
| 310 |
+
// | $ZSFCheckSuffix
|
| 311 |
+
// | $ZSFCheckIncludes;
|
| 312 |
+
|
| 313 |
+
// export type $ZSFCheck =
|
| 314 |
+
// | $ZSFStringFormatChecks
|
| 315 |
+
// | $ZSFCheckMinSize
|
| 316 |
+
// | $ZSFCheckMaxSize
|
| 317 |
+
// | $ZSFCheckSizeEquals
|
| 318 |
+
// | $ZSFCheckLessThan
|
| 319 |
+
// | $ZSFCheckLessThanOrEqual
|
| 320 |
+
// | $ZSFCheckGreaterThan
|
| 321 |
+
// | $ZSFCheckGreaterThanOrEqual
|
| 322 |
+
// | $ZSFCheckEquals
|
| 323 |
+
// | $ZSFCheckMultipleOf;
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/index.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import z4 from "./classic/index.js";
|
| 2 |
+
export * from "./classic/index.js";
|
| 3 |
+
|
| 4 |
+
export default z4;
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ar.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "بايت", verb: "أن يحوي" },
|
| 9 |
+
array: { unit: "عنصر", verb: "أن يحوي" },
|
| 10 |
+
set: { unit: "عنصر", verb: "أن يحوي" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "مدخل",
|
| 44 |
+
email: "بريد إلكتروني",
|
| 45 |
+
url: "رابط",
|
| 46 |
+
emoji: "إيموجي",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "تاريخ ووقت بمعيار ISO",
|
| 58 |
+
date: "تاريخ بمعيار ISO",
|
| 59 |
+
time: "وقت بمعيار ISO",
|
| 60 |
+
duration: "مدة بمعيار ISO",
|
| 61 |
+
ipv4: "عنوان IPv4",
|
| 62 |
+
ipv6: "عنوان IPv6",
|
| 63 |
+
cidrv4: "مدى عناوين بصيغة IPv4",
|
| 64 |
+
cidrv6: "مدى عناوين بصيغة IPv6",
|
| 65 |
+
base64: "نَص بترميز base64-encoded",
|
| 66 |
+
base64url: "نَص بترميز base64url-encoded",
|
| 67 |
+
json_string: "نَص على هيئة JSON",
|
| 68 |
+
e164: "رقم هاتف بمعيار E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "مدخل",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `مدخلات غير مقبولة: يفترض إدخال ${issue.expected}، ولكن تم إدخال ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1)
|
| 79 |
+
return `مدخلات غير مقبولة: يفترض إدخال ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return ` أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "عنصر"}`;
|
| 86 |
+
return `أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `نَص غير مقبول: يجب أن يبدأ بـ "${issue.prefix}"`;
|
| 100 |
+
if (_issue.format === "ends_with") return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`;
|
| 101 |
+
if (_issue.format === "includes") return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`;
|
| 102 |
+
if (_issue.format === "regex") return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`;
|
| 103 |
+
return `${Nouns[_issue.format] ?? issue.format} غير مقبول`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue.divisor}`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `معرف${issue.keys.length > 1 ? "ات" : ""} غريب${issue.keys.length > 1 ? "ة" : ""}: ${util.joinValues(issue.keys, "، ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `معرف غير مقبول في ${issue.origin}`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "مدخل غير مقبول";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `مدخل غير مقبول في ${issue.origin}`;
|
| 115 |
+
default:
|
| 116 |
+
return "مدخل غير مقبول";
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/az.ts
ADDED
|
@@ -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: "simvol", verb: "olmalıdır" },
|
| 8 |
+
file: { unit: "bayt", verb: "olmalıdır" },
|
| 9 |
+
array: { unit: "element", verb: "olmalıdır" },
|
| 10 |
+
set: { unit: "element", verb: "olmalıdır" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "input",
|
| 44 |
+
email: "email address",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO datetime",
|
| 58 |
+
date: "ISO date",
|
| 59 |
+
time: "ISO time",
|
| 60 |
+
duration: "ISO duration",
|
| 61 |
+
ipv4: "IPv4 address",
|
| 62 |
+
ipv6: "IPv6 address",
|
| 63 |
+
cidrv4: "IPv4 range",
|
| 64 |
+
cidrv6: "IPv6 range",
|
| 65 |
+
base64: "base64-encoded string",
|
| 66 |
+
base64url: "base64url-encoded string",
|
| 67 |
+
json_string: "JSON string",
|
| 68 |
+
e164: "E.164 number",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "input",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Yanlış dəyər: gözlənilən ${issue.expected}, daxil olan ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Yanlış dəyər: gözlənilən ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `Yanlış seçim: aşağıdakılardan biri olmalıdır: ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `Çox böyük: gözlənilən ${issue.origin ?? "dəyər"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`;
|
| 85 |
+
return `Çox böyük: gözlənilən ${issue.origin ?? "dəyər"} ${adj}${issue.maximum.toString()}`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) return `Çox kiçik: gözlənilən ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 91 |
+
return `Çox kiçik: gözlənilən ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
| 92 |
+
}
|
| 93 |
+
case "invalid_format": {
|
| 94 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 95 |
+
if (_issue.format === "starts_with") return `Yanlış mətn: "${_issue.prefix}" ilə başlamalıdır`;
|
| 96 |
+
if (_issue.format === "ends_with") return `Yanlış mətn: "${_issue.suffix}" ilə bitməlidir`;
|
| 97 |
+
if (_issue.format === "includes") return `Yanlış mətn: "${_issue.includes}" daxil olmalıdır`;
|
| 98 |
+
if (_issue.format === "regex") return `Yanlış mətn: ${_issue.pattern} şablonuna uyğun olmalıdır`;
|
| 99 |
+
return `Yanlış ${Nouns[_issue.format] ?? issue.format}`;
|
| 100 |
+
}
|
| 101 |
+
case "not_multiple_of":
|
| 102 |
+
return `Yanlış ədəd: ${issue.divisor} ilə bölünə bilən olmalıdır`;
|
| 103 |
+
case "unrecognized_keys":
|
| 104 |
+
return `Tanınmayan açar${issue.keys.length > 1 ? "lar" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 105 |
+
case "invalid_key":
|
| 106 |
+
return `${issue.origin} daxilində yanlış açar`;
|
| 107 |
+
case "invalid_union":
|
| 108 |
+
return "Yanlış dəyər";
|
| 109 |
+
case "invalid_element":
|
| 110 |
+
return `${issue.origin} daxilində yanlış dəyər`;
|
| 111 |
+
default:
|
| 112 |
+
return `Yanlış dəyər`;
|
| 113 |
+
}
|
| 114 |
+
};
|
| 115 |
+
};
|
| 116 |
+
|
| 117 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 118 |
+
return {
|
| 119 |
+
localeError: error(),
|
| 120 |
+
};
|
| 121 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/be.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
function getBelarusianPlural(count: number, one: string, few: string, many: string): string {
|
| 6 |
+
const absCount = Math.abs(count);
|
| 7 |
+
const lastDigit = absCount % 10;
|
| 8 |
+
const lastTwoDigits = absCount % 100;
|
| 9 |
+
|
| 10 |
+
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
| 11 |
+
return many;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if (lastDigit === 1) {
|
| 15 |
+
return one;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
if (lastDigit >= 2 && lastDigit <= 4) {
|
| 19 |
+
return few;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return many;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
interface BelarusianSizable {
|
| 26 |
+
unit: {
|
| 27 |
+
one: string;
|
| 28 |
+
few: string;
|
| 29 |
+
many: string;
|
| 30 |
+
};
|
| 31 |
+
verb: string;
|
| 32 |
+
}
|
| 33 |
+
const error: () => errors.$ZodErrorMap = () => {
|
| 34 |
+
const Sizable: Record<string, BelarusianSizable> = {
|
| 35 |
+
string: {
|
| 36 |
+
unit: {
|
| 37 |
+
one: "сімвал",
|
| 38 |
+
few: "сімвалы",
|
| 39 |
+
many: "сімвалаў",
|
| 40 |
+
},
|
| 41 |
+
verb: "мець",
|
| 42 |
+
},
|
| 43 |
+
array: {
|
| 44 |
+
unit: {
|
| 45 |
+
one: "элемент",
|
| 46 |
+
few: "элементы",
|
| 47 |
+
many: "элементаў",
|
| 48 |
+
},
|
| 49 |
+
verb: "мець",
|
| 50 |
+
},
|
| 51 |
+
set: {
|
| 52 |
+
unit: {
|
| 53 |
+
one: "элемент",
|
| 54 |
+
few: "элементы",
|
| 55 |
+
many: "элементаў",
|
| 56 |
+
},
|
| 57 |
+
verb: "мець",
|
| 58 |
+
},
|
| 59 |
+
file: {
|
| 60 |
+
unit: {
|
| 61 |
+
one: "байт",
|
| 62 |
+
few: "байты",
|
| 63 |
+
many: "байтаў",
|
| 64 |
+
},
|
| 65 |
+
verb: "мець",
|
| 66 |
+
},
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
function getSizing(origin: string): BelarusianSizable | null {
|
| 70 |
+
return Sizable[origin] ?? null;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
const parsedType = (data: any): string => {
|
| 74 |
+
const t = typeof data;
|
| 75 |
+
|
| 76 |
+
switch (t) {
|
| 77 |
+
case "number": {
|
| 78 |
+
return Number.isNaN(data) ? "NaN" : "лік";
|
| 79 |
+
}
|
| 80 |
+
case "object": {
|
| 81 |
+
if (Array.isArray(data)) {
|
| 82 |
+
return "масіў";
|
| 83 |
+
}
|
| 84 |
+
if (data === null) {
|
| 85 |
+
return "null";
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 89 |
+
return data.constructor.name;
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
return t;
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
const Nouns: {
|
| 97 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 98 |
+
} = {
|
| 99 |
+
regex: "увод",
|
| 100 |
+
email: "email адрас",
|
| 101 |
+
url: "URL",
|
| 102 |
+
emoji: "эмодзі",
|
| 103 |
+
uuid: "UUID",
|
| 104 |
+
uuidv4: "UUIDv4",
|
| 105 |
+
uuidv6: "UUIDv6",
|
| 106 |
+
nanoid: "nanoid",
|
| 107 |
+
guid: "GUID",
|
| 108 |
+
cuid: "cuid",
|
| 109 |
+
cuid2: "cuid2",
|
| 110 |
+
ulid: "ULID",
|
| 111 |
+
xid: "XID",
|
| 112 |
+
ksuid: "KSUID",
|
| 113 |
+
datetime: "ISO дата і час",
|
| 114 |
+
date: "ISO дата",
|
| 115 |
+
time: "ISO час",
|
| 116 |
+
duration: "ISO працягласць",
|
| 117 |
+
ipv4: "IPv4 адрас",
|
| 118 |
+
ipv6: "IPv6 адрас",
|
| 119 |
+
cidrv4: "IPv4 дыяпазон",
|
| 120 |
+
cidrv6: "IPv6 дыяпазон",
|
| 121 |
+
base64: "радок у фармаце base64",
|
| 122 |
+
base64url: "радок у фармаце base64url",
|
| 123 |
+
json_string: "JSON радок",
|
| 124 |
+
e164: "нумар E.164",
|
| 125 |
+
jwt: "JWT",
|
| 126 |
+
template_literal: "увод",
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
return (issue) => {
|
| 130 |
+
switch (issue.code) {
|
| 131 |
+
case "invalid_type":
|
| 132 |
+
return `Няправільны ўвод: чакаўся ${issue.expected}, атрымана ${parsedType(issue.input)}`;
|
| 133 |
+
case "invalid_value":
|
| 134 |
+
if (issue.values.length === 1) return `Няправільны ўвод: чакалася ${util.stringifyPrimitive(issue.values[0])}`;
|
| 135 |
+
return `Няправільны варыянт: чакаўся адзін з ${util.joinValues(issue.values, "|")}`;
|
| 136 |
+
case "too_big": {
|
| 137 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 138 |
+
const sizing = getSizing(issue.origin);
|
| 139 |
+
if (sizing) {
|
| 140 |
+
const maxValue = Number(issue.maximum);
|
| 141 |
+
const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
| 142 |
+
return `Занадта вялікі: чакалася, што ${issue.origin ?? "значэнне"} павінна ${sizing.verb} ${adj}${issue.maximum.toString()} ${unit}`;
|
| 143 |
+
}
|
| 144 |
+
return `Занадта вялікі: чакалася, што ${issue.origin ?? "значэнне"} павінна быць ${adj}${issue.maximum.toString()}`;
|
| 145 |
+
}
|
| 146 |
+
case "too_small": {
|
| 147 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 148 |
+
const sizing = getSizing(issue.origin);
|
| 149 |
+
if (sizing) {
|
| 150 |
+
const minValue = Number(issue.minimum);
|
| 151 |
+
const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
| 152 |
+
return `Занадта малы: чакалася, што ${issue.origin} павінна ${sizing.verb} ${adj}${issue.minimum.toString()} ${unit}`;
|
| 153 |
+
}
|
| 154 |
+
return `Занадта малы: чакалася, што ${issue.origin} павінна быць ${adj}${issue.minimum.toString()}`;
|
| 155 |
+
}
|
| 156 |
+
case "invalid_format": {
|
| 157 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 158 |
+
if (_issue.format === "starts_with") return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`;
|
| 159 |
+
if (_issue.format === "ends_with") return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`;
|
| 160 |
+
if (_issue.format === "includes") return `Няправільны радок: павінен змяшчаць "${_issue.includes}"`;
|
| 161 |
+
if (_issue.format === "regex") return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`;
|
| 162 |
+
return `Няправільны ${Nouns[_issue.format] ?? issue.format}`;
|
| 163 |
+
}
|
| 164 |
+
case "not_multiple_of":
|
| 165 |
+
return `Няправільны лік: павінен быць кратным ${issue.divisor}`;
|
| 166 |
+
case "unrecognized_keys":
|
| 167 |
+
return `Нераспазнаны ${issue.keys.length > 1 ? "ключы" : "ключ"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 168 |
+
case "invalid_key":
|
| 169 |
+
return `Няправільны ключ у ${issue.origin}`;
|
| 170 |
+
case "invalid_union":
|
| 171 |
+
return "Няправільны ўвод";
|
| 172 |
+
case "invalid_element":
|
| 173 |
+
return `Няправільнае значэнне ў ${issue.origin}`;
|
| 174 |
+
default:
|
| 175 |
+
return `Няправільны ўвод`;
|
| 176 |
+
}
|
| 177 |
+
};
|
| 178 |
+
};
|
| 179 |
+
|
| 180 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 181 |
+
return {
|
| 182 |
+
localeError: error(),
|
| 183 |
+
};
|
| 184 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ca.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "caràcters", verb: "contenir" },
|
| 8 |
+
file: { unit: "bytes", verb: "contenir" },
|
| 9 |
+
array: { unit: "elements", verb: "contenir" },
|
| 10 |
+
set: { unit: "elements", verb: "contenir" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "entrada",
|
| 44 |
+
email: "adreça electrònica",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "data i hora ISO",
|
| 58 |
+
date: "data ISO",
|
| 59 |
+
time: "hora ISO",
|
| 60 |
+
duration: "durada ISO",
|
| 61 |
+
ipv4: "adreça IPv4",
|
| 62 |
+
ipv6: "adreça IPv6",
|
| 63 |
+
cidrv4: "rang IPv4",
|
| 64 |
+
cidrv6: "rang IPv6",
|
| 65 |
+
base64: "cadena codificada en base64",
|
| 66 |
+
base64url: "cadena codificada en base64url",
|
| 67 |
+
json_string: "cadena JSON",
|
| 68 |
+
e164: "número E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "entrada",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Tipus invàlid: s'esperava ${issue.expected}, s'ha rebut ${parsedType(issue.input)}`;
|
| 77 |
+
// return `Tipus invàlid: s'esperava ${issue.expected}, s'ha rebut ${util.getParsedType(issue.input)}`;
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `Valor invàlid: s'esperava ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Opció invàlida: s'esperava una de ${util.joinValues(issue.values, " o ")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "com a màxim" : "menys de";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Massa gran: s'esperava que ${issue.origin ?? "el valor"} contingués ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
| 86 |
+
return `Massa gran: s'esperava que ${issue.origin ?? "el valor"} fos ${adj} ${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? "com a mínim" : "més de";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Massa petit: s'esperava que ${issue.origin} contingués ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Massa petit: s'esperava que ${issue.origin} fos ${adj} ${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") {
|
| 100 |
+
return `Format invàlid: ha de començar amb "${_issue.prefix}"`;
|
| 101 |
+
}
|
| 102 |
+
if (_issue.format === "ends_with") return `Format invàlid: ha d'acabar amb "${_issue.suffix}"`;
|
| 103 |
+
if (_issue.format === "includes") return `Format invàlid: ha d'incloure "${_issue.includes}"`;
|
| 104 |
+
if (_issue.format === "regex") return `Format invàlid: ha de coincidir amb el patró ${_issue.pattern}`;
|
| 105 |
+
return `Format invàlid per a ${Nouns[_issue.format] ?? issue.format}`;
|
| 106 |
+
}
|
| 107 |
+
case "not_multiple_of":
|
| 108 |
+
return `Número invàlid: ha de ser múltiple de ${issue.divisor}`;
|
| 109 |
+
case "unrecognized_keys":
|
| 110 |
+
return `Clau${issue.keys.length > 1 ? "s" : ""} no reconeguda${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 111 |
+
case "invalid_key":
|
| 112 |
+
return `Clau invàlida a ${issue.origin}`;
|
| 113 |
+
case "invalid_union":
|
| 114 |
+
return "Entrada invàlida"; // Could also be "Tipus d'unió invàlid" but "Entrada invàlida" is more general
|
| 115 |
+
case "invalid_element":
|
| 116 |
+
return `Element invàlid a ${issue.origin}`;
|
| 117 |
+
default:
|
| 118 |
+
return `Entrada invàlida`;
|
| 119 |
+
}
|
| 120 |
+
};
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 124 |
+
return {
|
| 125 |
+
localeError: error(),
|
| 126 |
+
};
|
| 127 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/cs.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "znaků", verb: "mít" },
|
| 8 |
+
file: { unit: "bajtů", verb: "mít" },
|
| 9 |
+
array: { unit: "prvků", verb: "mít" },
|
| 10 |
+
set: { unit: "prvků", verb: "mít" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "číslo";
|
| 23 |
+
}
|
| 24 |
+
case "string": {
|
| 25 |
+
return "řetězec";
|
| 26 |
+
}
|
| 27 |
+
case "boolean": {
|
| 28 |
+
return "boolean";
|
| 29 |
+
}
|
| 30 |
+
case "bigint": {
|
| 31 |
+
return "bigint";
|
| 32 |
+
}
|
| 33 |
+
case "function": {
|
| 34 |
+
return "funkce";
|
| 35 |
+
}
|
| 36 |
+
case "symbol": {
|
| 37 |
+
return "symbol";
|
| 38 |
+
}
|
| 39 |
+
case "undefined": {
|
| 40 |
+
return "undefined";
|
| 41 |
+
}
|
| 42 |
+
case "object": {
|
| 43 |
+
if (Array.isArray(data)) {
|
| 44 |
+
return "pole";
|
| 45 |
+
}
|
| 46 |
+
if (data === null) {
|
| 47 |
+
return "null";
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 51 |
+
return data.constructor.name;
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
return t;
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
const Nouns: {
|
| 59 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 60 |
+
} = {
|
| 61 |
+
regex: "regulární výraz",
|
| 62 |
+
email: "e-mailová adresa",
|
| 63 |
+
url: "URL",
|
| 64 |
+
emoji: "emoji",
|
| 65 |
+
uuid: "UUID",
|
| 66 |
+
uuidv4: "UUIDv4",
|
| 67 |
+
uuidv6: "UUIDv6",
|
| 68 |
+
nanoid: "nanoid",
|
| 69 |
+
guid: "GUID",
|
| 70 |
+
cuid: "cuid",
|
| 71 |
+
cuid2: "cuid2",
|
| 72 |
+
ulid: "ULID",
|
| 73 |
+
xid: "XID",
|
| 74 |
+
ksuid: "KSUID",
|
| 75 |
+
datetime: "datum a čas ve formátu ISO",
|
| 76 |
+
date: "datum ve formátu ISO",
|
| 77 |
+
time: "čas ve formátu ISO",
|
| 78 |
+
duration: "doba trvání ISO",
|
| 79 |
+
ipv4: "IPv4 adresa",
|
| 80 |
+
ipv6: "IPv6 adresa",
|
| 81 |
+
cidrv4: "rozsah IPv4",
|
| 82 |
+
cidrv6: "rozsah IPv6",
|
| 83 |
+
base64: "řetězec zakódovaný ve formátu base64",
|
| 84 |
+
base64url: "řetězec zakódovaný ve formátu base64url",
|
| 85 |
+
json_string: "řetězec ve formátu JSON",
|
| 86 |
+
e164: "číslo E.164",
|
| 87 |
+
jwt: "JWT",
|
| 88 |
+
template_literal: "vstup",
|
| 89 |
+
};
|
| 90 |
+
|
| 91 |
+
return (issue) => {
|
| 92 |
+
switch (issue.code) {
|
| 93 |
+
case "invalid_type":
|
| 94 |
+
return `Neplatný vstup: očekáváno ${issue.expected}, obdrženo ${parsedType(issue.input)}`;
|
| 95 |
+
case "invalid_value":
|
| 96 |
+
if (issue.values.length === 1) return `Neplatný vstup: očekáváno ${util.stringifyPrimitive(issue.values[0])}`;
|
| 97 |
+
return `Neplatná možnost: očekávána jedna z hodnot ${util.joinValues(issue.values, "|")}`;
|
| 98 |
+
case "too_big": {
|
| 99 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 100 |
+
const sizing = getSizing(issue.origin);
|
| 101 |
+
if (sizing) {
|
| 102 |
+
return `Hodnota je příliš velká: ${issue.origin ?? "hodnota"} musí mít ${adj}${issue.maximum.toString()} ${sizing.unit ?? "prvků"}`;
|
| 103 |
+
}
|
| 104 |
+
return `Hodnota je příliš velká: ${issue.origin ?? "hodnota"} musí být ${adj}${issue.maximum.toString()}`;
|
| 105 |
+
}
|
| 106 |
+
case "too_small": {
|
| 107 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 108 |
+
const sizing = getSizing(issue.origin);
|
| 109 |
+
if (sizing) {
|
| 110 |
+
return `Hodnota je příliš malá: ${issue.origin ?? "hodnota"} musí mít ${adj}${issue.minimum.toString()} ${sizing.unit ?? "prvků"}`;
|
| 111 |
+
}
|
| 112 |
+
return `Hodnota je příliš malá: ${issue.origin ?? "hodnota"} musí být ${adj}${issue.minimum.toString()}`;
|
| 113 |
+
}
|
| 114 |
+
case "invalid_format": {
|
| 115 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 116 |
+
if (_issue.format === "starts_with") return `Neplatný řetězec: musí začínat na "${_issue.prefix}"`;
|
| 117 |
+
if (_issue.format === "ends_with") return `Neplatný řetězec: musí končit na "${_issue.suffix}"`;
|
| 118 |
+
if (_issue.format === "includes") return `Neplatný řetězec: musí obsahovat "${_issue.includes}"`;
|
| 119 |
+
if (_issue.format === "regex") return `Neplatný řetězec: musí odpovídat vzoru ${_issue.pattern}`;
|
| 120 |
+
return `Neplatný formát ${Nouns[_issue.format] ?? issue.format}`;
|
| 121 |
+
}
|
| 122 |
+
case "not_multiple_of":
|
| 123 |
+
return `Neplatné číslo: musí být násobkem ${issue.divisor}`;
|
| 124 |
+
case "unrecognized_keys":
|
| 125 |
+
return `Neznámé klíče: ${util.joinValues(issue.keys, ", ")}`;
|
| 126 |
+
case "invalid_key":
|
| 127 |
+
return `Neplatný klíč v ${issue.origin}`;
|
| 128 |
+
case "invalid_union":
|
| 129 |
+
return "Neplatný vstup";
|
| 130 |
+
case "invalid_element":
|
| 131 |
+
return `Neplatná hodnota v ${issue.origin}`;
|
| 132 |
+
default:
|
| 133 |
+
return `Neplatný vstup`;
|
| 134 |
+
}
|
| 135 |
+
};
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 139 |
+
return {
|
| 140 |
+
localeError: error(),
|
| 141 |
+
};
|
| 142 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/de.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "Zeichen", verb: "zu haben" },
|
| 8 |
+
file: { unit: "Bytes", verb: "zu haben" },
|
| 9 |
+
array: { unit: "Elemente", verb: "zu haben" },
|
| 10 |
+
set: { unit: "Elemente", verb: "zu haben" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "Zahl";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "Array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "Eingabe",
|
| 44 |
+
email: "E-Mail-Adresse",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "Emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO-Datum und -Uhrzeit",
|
| 58 |
+
date: "ISO-Datum",
|
| 59 |
+
time: "ISO-Uhrzeit",
|
| 60 |
+
duration: "ISO-Dauer",
|
| 61 |
+
ipv4: "IPv4-Adresse",
|
| 62 |
+
ipv6: "IPv6-Adresse",
|
| 63 |
+
cidrv4: "IPv4-Bereich",
|
| 64 |
+
cidrv6: "IPv6-Bereich",
|
| 65 |
+
base64: "Base64-codierter String",
|
| 66 |
+
base64url: "Base64-URL-codierter String",
|
| 67 |
+
json_string: "JSON-String",
|
| 68 |
+
e164: "E.164-Nummer",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "Eingabe",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Ungültige Eingabe: erwartet ${issue.expected}, erhalten ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Ungültige Eingabe: erwartet ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `Ungültige Option: erwartet eine von ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;
|
| 85 |
+
return `Zu groß: erwartet, dass ${issue.origin ?? "Wert"} ${adj}${issue.maximum.toString()} ist`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} hat`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `Zu klein: erwartet, dass ${issue.origin} ${adj}${issue.minimum.toString()} ist`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`;
|
| 99 |
+
if (_issue.format === "ends_with") return `Ungültiger String: muss mit "${_issue.suffix}" enden`;
|
| 100 |
+
if (_issue.format === "includes") return `Ungültiger String: muss "${_issue.includes}" enthalten`;
|
| 101 |
+
if (_issue.format === "regex") return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`;
|
| 102 |
+
return `Ungültig: ${Nouns[_issue.format] ?? issue.format}`;
|
| 103 |
+
}
|
| 104 |
+
case "not_multiple_of":
|
| 105 |
+
return `Ungültige Zahl: muss ein Vielfaches von ${issue.divisor} sein`;
|
| 106 |
+
case "unrecognized_keys":
|
| 107 |
+
return `${issue.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 108 |
+
case "invalid_key":
|
| 109 |
+
return `Ungültiger Schlüssel in ${issue.origin}`;
|
| 110 |
+
case "invalid_union":
|
| 111 |
+
return "Ungültige Eingabe";
|
| 112 |
+
case "invalid_element":
|
| 113 |
+
return `Ungültiger Wert in ${issue.origin}`;
|
| 114 |
+
default:
|
| 115 |
+
return `Ungültige Eingabe`;
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 121 |
+
return {
|
| 122 |
+
localeError: error(),
|
| 123 |
+
};
|
| 124 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/en.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
export const parsedType = (data: any): string => {
|
| 6 |
+
const t = typeof data;
|
| 7 |
+
|
| 8 |
+
switch (t) {
|
| 9 |
+
case "number": {
|
| 10 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 11 |
+
}
|
| 12 |
+
case "object": {
|
| 13 |
+
if (Array.isArray(data)) {
|
| 14 |
+
return "array";
|
| 15 |
+
}
|
| 16 |
+
if (data === null) {
|
| 17 |
+
return "null";
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 21 |
+
return data.constructor.name;
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
return t;
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
const error: () => errors.$ZodErrorMap = () => {
|
| 29 |
+
const Sizable: Record<string, { unit: string; verb: string }> = {
|
| 30 |
+
string: { unit: "characters", verb: "to have" },
|
| 31 |
+
file: { unit: "bytes", verb: "to have" },
|
| 32 |
+
array: { unit: "items", verb: "to have" },
|
| 33 |
+
set: { unit: "items", verb: "to have" },
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 37 |
+
return Sizable[origin] ?? null;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "input",
|
| 44 |
+
email: "email address",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO datetime",
|
| 58 |
+
date: "ISO date",
|
| 59 |
+
time: "ISO time",
|
| 60 |
+
duration: "ISO duration",
|
| 61 |
+
ipv4: "IPv4 address",
|
| 62 |
+
ipv6: "IPv6 address",
|
| 63 |
+
cidrv4: "IPv4 range",
|
| 64 |
+
cidrv6: "IPv6 range",
|
| 65 |
+
base64: "base64-encoded string",
|
| 66 |
+
base64url: "base64url-encoded string",
|
| 67 |
+
json_string: "JSON string",
|
| 68 |
+
e164: "E.164 number",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "input",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Invalid input: expected ${issue.expected}, received ${parsedType(issue.input)}`;
|
| 77 |
+
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Invalid option: expected one of ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
| 86 |
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") {
|
| 100 |
+
return `Invalid string: must start with "${_issue.prefix}"`;
|
| 101 |
+
}
|
| 102 |
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
| 103 |
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
| 104 |
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
| 105 |
+
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
| 106 |
+
}
|
| 107 |
+
case "not_multiple_of":
|
| 108 |
+
return `Invalid number: must be a multiple of ${issue.divisor}`;
|
| 109 |
+
case "unrecognized_keys":
|
| 110 |
+
return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 111 |
+
case "invalid_key":
|
| 112 |
+
return `Invalid key in ${issue.origin}`;
|
| 113 |
+
case "invalid_union":
|
| 114 |
+
return "Invalid input";
|
| 115 |
+
case "invalid_element":
|
| 116 |
+
return `Invalid value in ${issue.origin}`;
|
| 117 |
+
default:
|
| 118 |
+
return `Invalid input`;
|
| 119 |
+
}
|
| 120 |
+
};
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 124 |
+
return {
|
| 125 |
+
localeError: error(),
|
| 126 |
+
};
|
| 127 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/eo.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
export const parsedType = (data: any): string => {
|
| 6 |
+
const t = typeof data;
|
| 7 |
+
|
| 8 |
+
switch (t) {
|
| 9 |
+
case "number": {
|
| 10 |
+
return Number.isNaN(data) ? "NaN" : "nombro";
|
| 11 |
+
}
|
| 12 |
+
case "object": {
|
| 13 |
+
if (Array.isArray(data)) {
|
| 14 |
+
return "tabelo";
|
| 15 |
+
}
|
| 16 |
+
if (data === null) {
|
| 17 |
+
return "senvalora";
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 21 |
+
return data.constructor.name;
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
return t;
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
const error: () => errors.$ZodErrorMap = () => {
|
| 29 |
+
const Sizable: Record<string, { unit: string; verb: string }> = {
|
| 30 |
+
string: { unit: "karaktrojn", verb: "havi" },
|
| 31 |
+
file: { unit: "bajtojn", verb: "havi" },
|
| 32 |
+
array: { unit: "elementojn", verb: "havi" },
|
| 33 |
+
set: { unit: "elementojn", verb: "havi" },
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 37 |
+
return Sizable[origin] ?? null;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "enigo",
|
| 44 |
+
email: "retadreso",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoĝio",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO-datotempo",
|
| 58 |
+
date: "ISO-dato",
|
| 59 |
+
time: "ISO-tempo",
|
| 60 |
+
duration: "ISO-daŭro",
|
| 61 |
+
ipv4: "IPv4-adreso",
|
| 62 |
+
ipv6: "IPv6-adreso",
|
| 63 |
+
cidrv4: "IPv4-rango",
|
| 64 |
+
cidrv6: "IPv6-rango",
|
| 65 |
+
base64: "64-ume kodita karaktraro",
|
| 66 |
+
base64url: "URL-64-ume kodita karaktraro",
|
| 67 |
+
json_string: "JSON-karaktraro",
|
| 68 |
+
e164: "E.164-nombro",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "enigo",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Nevalida enigo: atendiĝis ${issue.expected}, riceviĝis ${parsedType(issue.input)}`;
|
| 77 |
+
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `Nevalida enigo: atendiĝis ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Nevalida opcio: atendiĝis unu el ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Tro granda: atendiĝis ke ${issue.origin ?? "valoro"} havu ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementojn"}`;
|
| 86 |
+
return `Tro granda: atendiĝis ke ${issue.origin ?? "valoro"} havu ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Tro malgranda: atendiĝis ke ${issue.origin} havu ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Tro malgranda: atendiĝis ke ${issue.origin} estu ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `Nevalida karaktraro: devas komenciĝi per "${_issue.prefix}"`;
|
| 100 |
+
if (_issue.format === "ends_with") return `Nevalida karaktraro: devas finiĝi per "${_issue.suffix}"`;
|
| 101 |
+
if (_issue.format === "includes") return `Nevalida karaktraro: devas inkluzivi "${_issue.includes}"`;
|
| 102 |
+
if (_issue.format === "regex") return `Nevalida karaktraro: devas kongrui kun la modelo ${_issue.pattern}`;
|
| 103 |
+
return `Nevalida ${Nouns[_issue.format] ?? issue.format}`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `Nevalida nombro: devas esti oblo de ${issue.divisor}`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `Nekonata${issue.keys.length > 1 ? "j" : ""} ŝlosilo${issue.keys.length > 1 ? "j" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `Nevalida ŝlosilo en ${issue.origin}`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "Nevalida enigo";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `Nevalida valoro en ${issue.origin}`;
|
| 115 |
+
default:
|
| 116 |
+
return `Nevalida enigo`;
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/es.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "caracteres", verb: "tener" },
|
| 8 |
+
file: { unit: "bytes", verb: "tener" },
|
| 9 |
+
array: { unit: "elementos", verb: "tener" },
|
| 10 |
+
set: { unit: "elementos", verb: "tener" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "número";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "arreglo";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "nulo";
|
| 30 |
+
}
|
| 31 |
+
if (Object.getPrototypeOf(data) !== Object.prototype) {
|
| 32 |
+
return data.constructor.name;
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
return t;
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
const Nouns: {
|
| 40 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 41 |
+
} = {
|
| 42 |
+
regex: "entrada",
|
| 43 |
+
email: "dirección de correo electrónico",
|
| 44 |
+
url: "URL",
|
| 45 |
+
emoji: "emoji",
|
| 46 |
+
uuid: "UUID",
|
| 47 |
+
uuidv4: "UUIDv4",
|
| 48 |
+
uuidv6: "UUIDv6",
|
| 49 |
+
nanoid: "nanoid",
|
| 50 |
+
guid: "GUID",
|
| 51 |
+
cuid: "cuid",
|
| 52 |
+
cuid2: "cuid2",
|
| 53 |
+
ulid: "ULID",
|
| 54 |
+
xid: "XID",
|
| 55 |
+
ksuid: "KSUID",
|
| 56 |
+
datetime: "fecha y hora ISO",
|
| 57 |
+
date: "fecha ISO",
|
| 58 |
+
time: "hora ISO",
|
| 59 |
+
duration: "duración ISO",
|
| 60 |
+
ipv4: "dirección IPv4",
|
| 61 |
+
ipv6: "dirección IPv6",
|
| 62 |
+
cidrv4: "rango IPv4",
|
| 63 |
+
cidrv6: "rango IPv6",
|
| 64 |
+
base64: "cadena codificada en base64",
|
| 65 |
+
base64url: "URL codificada en base64",
|
| 66 |
+
json_string: "cadena JSON",
|
| 67 |
+
e164: "número E.164",
|
| 68 |
+
jwt: "JWT",
|
| 69 |
+
template_literal: "entrada",
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
return (issue) => {
|
| 73 |
+
switch (issue.code) {
|
| 74 |
+
case "invalid_type":
|
| 75 |
+
return `Entrada inválida: se esperaba ${issue.expected}, recibido ${parsedType(issue.input)}`;
|
| 76 |
+
// return `Entrada inválida: se esperaba ${issue.expected}, recibido ${util.getParsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1)
|
| 79 |
+
return `Entrada inválida: se esperaba ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Opción inválida: se esperaba una de ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Demasiado grande: se esperaba que ${issue.origin ?? "valor"} tuviera ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
|
| 86 |
+
return `Demasiado grande: se esperaba que ${issue.origin ?? "valor"} fuera ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Demasiado pequeño: se esperaba que ${issue.origin} tuviera ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Demasiado pequeño: se esperaba que ${issue.origin} fuera ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `Cadena inválida: debe comenzar con "${_issue.prefix}"`;
|
| 100 |
+
if (_issue.format === "ends_with") return `Cadena inválida: debe terminar en "${_issue.suffix}"`;
|
| 101 |
+
if (_issue.format === "includes") return `Cadena inválida: debe incluir "${_issue.includes}"`;
|
| 102 |
+
if (_issue.format === "regex") return `Cadena inválida: debe coincidir con el patrón ${_issue.pattern}`;
|
| 103 |
+
return `Inválido ${Nouns[_issue.format] ?? issue.format}`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `Número inválido: debe ser múltiplo de ${issue.divisor}`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `Llave${issue.keys.length > 1 ? "s" : ""} desconocida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `Llave inválida en ${issue.origin}`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "Entrada inválida";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `Valor inválido en ${issue.origin}`;
|
| 115 |
+
default:
|
| 116 |
+
return `Entrada inválida`;
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fa.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "بایت", verb: "داشته باشد" },
|
| 9 |
+
array: { unit: "آیتم", verb: "داشته باشد" },
|
| 10 |
+
set: { unit: "آیتم", verb: "داشته باشد" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "عدد";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "آرایه";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "ورودی",
|
| 44 |
+
email: "آدرس ایمیل",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "ایموجی",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "تاریخ و زمان ایزو",
|
| 58 |
+
date: "تاریخ ایزو",
|
| 59 |
+
time: "زمان ایزو",
|
| 60 |
+
duration: "مدت زمان ایزو",
|
| 61 |
+
ipv4: "IPv4 آدرس",
|
| 62 |
+
ipv6: "IPv6 آدرس",
|
| 63 |
+
cidrv4: "IPv4 دامنه",
|
| 64 |
+
cidrv6: "IPv6 دامنه",
|
| 65 |
+
base64: "base64-encoded رشته",
|
| 66 |
+
base64url: "base64url-encoded رشته",
|
| 67 |
+
json_string: "JSON رشته",
|
| 68 |
+
e164: "E.164 عدد",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "ورودی",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `ورودی نامعتبر: میبایست ${issue.expected} میبود، ${parsedType(issue.input)} دریافت شد`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) {
|
| 79 |
+
return `ورودی نامعتبر: میبایست ${util.stringifyPrimitive(issue.values[0])} میبود`;
|
| 80 |
+
}
|
| 81 |
+
return `گزینه نامعتبر: میبایست یکی از ${util.joinValues(issue.values, "|")} میبود`;
|
| 82 |
+
case "too_big": {
|
| 83 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 84 |
+
const sizing = getSizing(issue.origin);
|
| 85 |
+
if (sizing) {
|
| 86 |
+
return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
|
| 87 |
+
}
|
| 88 |
+
return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`;
|
| 89 |
+
}
|
| 90 |
+
case "too_small": {
|
| 91 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 92 |
+
const sizing = getSizing(issue.origin);
|
| 93 |
+
if (sizing) {
|
| 94 |
+
return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`;
|
| 95 |
+
}
|
| 96 |
+
return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`;
|
| 97 |
+
}
|
| 98 |
+
case "invalid_format": {
|
| 99 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 100 |
+
if (_issue.format === "starts_with") {
|
| 101 |
+
return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
|
| 102 |
+
}
|
| 103 |
+
if (_issue.format === "ends_with") {
|
| 104 |
+
return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
|
| 105 |
+
}
|
| 106 |
+
if (_issue.format === "includes") {
|
| 107 |
+
return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
|
| 108 |
+
}
|
| 109 |
+
if (_issue.format === "regex") {
|
| 110 |
+
return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
|
| 111 |
+
}
|
| 112 |
+
return `${Nouns[_issue.format] ?? issue.format} نامعتبر`;
|
| 113 |
+
}
|
| 114 |
+
case "not_multiple_of":
|
| 115 |
+
return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`;
|
| 116 |
+
case "unrecognized_keys":
|
| 117 |
+
return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`;
|
| 118 |
+
case "invalid_key":
|
| 119 |
+
return `کلید ناشناس در ${issue.origin}`;
|
| 120 |
+
case "invalid_union":
|
| 121 |
+
return `ورودی نامعتبر`;
|
| 122 |
+
case "invalid_element":
|
| 123 |
+
return `مقدار نامعتبر در ${issue.origin}`;
|
| 124 |
+
default:
|
| 125 |
+
return `ورودی نامعتبر`;
|
| 126 |
+
}
|
| 127 |
+
};
|
| 128 |
+
};
|
| 129 |
+
|
| 130 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 131 |
+
return {
|
| 132 |
+
localeError: error(),
|
| 133 |
+
};
|
| 134 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fi.ts
ADDED
|
@@ -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; subject: string }> = {
|
| 7 |
+
string: { unit: "merkkiä", subject: "merkkijonon" },
|
| 8 |
+
file: { unit: "tavua", subject: "tiedoston" },
|
| 9 |
+
array: { unit: "alkiota", subject: "listan" },
|
| 10 |
+
set: { unit: "alkiota", subject: "joukon" },
|
| 11 |
+
number: { unit: "", subject: "luvun" },
|
| 12 |
+
bigint: { unit: "", subject: "suuren kokonaisluvun" },
|
| 13 |
+
int: { unit: "", subject: "kokonaisluvun" },
|
| 14 |
+
date: { unit: "", subject: "päivämäärän" },
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
function getSizing(origin: string): { unit: string; subject: string } | null {
|
| 18 |
+
return Sizable[origin] ?? null;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
const parsedType = (data: any): string => {
|
| 22 |
+
const t = typeof data;
|
| 23 |
+
|
| 24 |
+
switch (t) {
|
| 25 |
+
case "number": {
|
| 26 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 27 |
+
}
|
| 28 |
+
case "object": {
|
| 29 |
+
if (Array.isArray(data)) {
|
| 30 |
+
return "array";
|
| 31 |
+
}
|
| 32 |
+
if (data === null) {
|
| 33 |
+
return "null";
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 37 |
+
return data.constructor.name;
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
return t;
|
| 42 |
+
};
|
| 43 |
+
|
| 44 |
+
const Nouns: {
|
| 45 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 46 |
+
} = {
|
| 47 |
+
regex: "säännöllinen lauseke",
|
| 48 |
+
email: "sähköpostiosoite",
|
| 49 |
+
url: "URL-osoite",
|
| 50 |
+
emoji: "emoji",
|
| 51 |
+
uuid: "UUID",
|
| 52 |
+
uuidv4: "UUIDv4",
|
| 53 |
+
uuidv6: "UUIDv6",
|
| 54 |
+
nanoid: "nanoid",
|
| 55 |
+
guid: "GUID",
|
| 56 |
+
cuid: "cuid",
|
| 57 |
+
cuid2: "cuid2",
|
| 58 |
+
ulid: "ULID",
|
| 59 |
+
xid: "XID",
|
| 60 |
+
ksuid: "KSUID",
|
| 61 |
+
datetime: "ISO-aikaleima",
|
| 62 |
+
date: "ISO-päivämäärä",
|
| 63 |
+
time: "ISO-aika",
|
| 64 |
+
duration: "ISO-kesto",
|
| 65 |
+
ipv4: "IPv4-osoite",
|
| 66 |
+
ipv6: "IPv6-osoite",
|
| 67 |
+
cidrv4: "IPv4-alue",
|
| 68 |
+
cidrv6: "IPv6-alue",
|
| 69 |
+
base64: "base64-koodattu merkkijono",
|
| 70 |
+
base64url: "base64url-koodattu merkkijono",
|
| 71 |
+
json_string: "JSON-merkkijono",
|
| 72 |
+
e164: "E.164-luku",
|
| 73 |
+
jwt: "JWT",
|
| 74 |
+
template_literal: "templaattimerkkijono",
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
return (issue) => {
|
| 78 |
+
switch (issue.code) {
|
| 79 |
+
case "invalid_type":
|
| 80 |
+
return `Virheellinen tyyppi: odotettiin ${issue.expected}, oli ${parsedType(issue.input)}`;
|
| 81 |
+
case "invalid_value":
|
| 82 |
+
if (issue.values.length === 1)
|
| 83 |
+
return `Virheellinen syöte: täytyy olla ${util.stringifyPrimitive(issue.values[0])}`;
|
| 84 |
+
return `Virheellinen valinta: täytyy olla yksi seuraavista: ${util.joinValues(issue.values, "|")}`;
|
| 85 |
+
case "too_big": {
|
| 86 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 87 |
+
const sizing = getSizing(issue.origin);
|
| 88 |
+
if (sizing) {
|
| 89 |
+
return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue.maximum.toString()} ${sizing.unit}`.trim();
|
| 90 |
+
}
|
| 91 |
+
return `Liian suuri: arvon täytyy olla ${adj}${issue.maximum.toString()}`;
|
| 92 |
+
}
|
| 93 |
+
case "too_small": {
|
| 94 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 95 |
+
const sizing = getSizing(issue.origin);
|
| 96 |
+
if (sizing) {
|
| 97 |
+
return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue.minimum.toString()} ${sizing.unit}`.trim();
|
| 98 |
+
}
|
| 99 |
+
return `Liian pieni: arvon täytyy olla ${adj}${issue.minimum.toString()}`;
|
| 100 |
+
}
|
| 101 |
+
case "invalid_format": {
|
| 102 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 103 |
+
if (_issue.format === "starts_with") return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;
|
| 104 |
+
if (_issue.format === "ends_with") return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;
|
| 105 |
+
if (_issue.format === "includes") return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;
|
| 106 |
+
if (_issue.format === "regex") {
|
| 107 |
+
return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;
|
| 108 |
+
}
|
| 109 |
+
return `Virheellinen ${Nouns[_issue.format] ?? issue.format}`;
|
| 110 |
+
}
|
| 111 |
+
case "not_multiple_of":
|
| 112 |
+
return `Virheellinen luku: täytyy olla luvun ${issue.divisor} monikerta`;
|
| 113 |
+
case "unrecognized_keys":
|
| 114 |
+
return `${issue.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 115 |
+
case "invalid_key":
|
| 116 |
+
return "Virheellinen avain tietueessa";
|
| 117 |
+
case "invalid_union":
|
| 118 |
+
return "Virheellinen unioni";
|
| 119 |
+
case "invalid_element":
|
| 120 |
+
return "Virheellinen arvo joukossa";
|
| 121 |
+
default:
|
| 122 |
+
return `Virheellinen syöte`;
|
| 123 |
+
}
|
| 124 |
+
};
|
| 125 |
+
};
|
| 126 |
+
|
| 127 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 128 |
+
return {
|
| 129 |
+
localeError: error(),
|
| 130 |
+
};
|
| 131 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fr-CA.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "caractères", verb: "avoir" },
|
| 8 |
+
file: { unit: "octets", verb: "avoir" },
|
| 9 |
+
array: { unit: "éléments", verb: "avoir" },
|
| 10 |
+
set: { unit: "éléments", verb: "avoir" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "entrée",
|
| 44 |
+
email: "adresse courriel",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "date-heure ISO",
|
| 58 |
+
date: "date ISO",
|
| 59 |
+
time: "heure ISO",
|
| 60 |
+
duration: "durée ISO",
|
| 61 |
+
ipv4: "adresse IPv4",
|
| 62 |
+
ipv6: "adresse IPv6",
|
| 63 |
+
cidrv4: "plage IPv4",
|
| 64 |
+
cidrv6: "plage IPv6",
|
| 65 |
+
base64: "chaîne encodée en base64",
|
| 66 |
+
base64url: "chaîne encodée en base64url",
|
| 67 |
+
json_string: "chaîne JSON",
|
| 68 |
+
e164: "numéro E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "entrée",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Entrée invalide : attendu ${issue.expected}, reçu ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Entrée invalide : attendu ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `Option invalide : attendu l'une des valeurs suivantes ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "≤" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `Trop grand : attendu que ${issue.origin ?? "la valeur"} ait ${adj}${issue.maximum.toString()} ${sizing.unit}`;
|
| 85 |
+
return `Trop grand : attendu que ${issue.origin ?? "la valeur"} soit ${adj}${issue.maximum.toString()}`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? "≥" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `Trop petit : attendu que ${issue.origin} ait ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `Trop petit : attendu que ${issue.origin} soit ${adj}${issue.minimum.toString()}`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") {
|
| 99 |
+
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
|
| 100 |
+
}
|
| 101 |
+
if (_issue.format === "ends_with") return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
|
| 102 |
+
if (_issue.format === "includes") return `Chaîne invalide : doit inclure "${_issue.includes}"`;
|
| 103 |
+
if (_issue.format === "regex") return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`;
|
| 104 |
+
return `${Nouns[_issue.format] ?? issue.format} invalide`;
|
| 105 |
+
}
|
| 106 |
+
case "not_multiple_of":
|
| 107 |
+
return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
|
| 108 |
+
case "unrecognized_keys":
|
| 109 |
+
return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
|
| 110 |
+
case "invalid_key":
|
| 111 |
+
return `Clé invalide dans ${issue.origin}`;
|
| 112 |
+
case "invalid_union":
|
| 113 |
+
return "Entrée invalide";
|
| 114 |
+
case "invalid_element":
|
| 115 |
+
return `Valeur invalide dans ${issue.origin}`;
|
| 116 |
+
default:
|
| 117 |
+
return `Entrée invalide`;
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 123 |
+
return {
|
| 124 |
+
localeError: error(),
|
| 125 |
+
};
|
| 126 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/fr.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "caractères", verb: "avoir" },
|
| 8 |
+
file: { unit: "octets", verb: "avoir" },
|
| 9 |
+
array: { unit: "éléments", verb: "avoir" },
|
| 10 |
+
set: { unit: "éléments", verb: "avoir" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "nombre";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "tableau";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "entrée",
|
| 44 |
+
email: "adresse e-mail",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "date et heure ISO",
|
| 58 |
+
date: "date ISO",
|
| 59 |
+
time: "heure ISO",
|
| 60 |
+
duration: "durée ISO",
|
| 61 |
+
ipv4: "adresse IPv4",
|
| 62 |
+
ipv6: "adresse IPv6",
|
| 63 |
+
cidrv4: "plage IPv4",
|
| 64 |
+
cidrv6: "plage IPv6",
|
| 65 |
+
base64: "chaîne encodée en base64",
|
| 66 |
+
base64url: "chaîne encodée en base64url",
|
| 67 |
+
json_string: "chaîne JSON",
|
| 68 |
+
e164: "numéro E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "entrée",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Entrée invalide : ${issue.expected} attendu, ${parsedType(issue.input)} reçu`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Entrée invalide : ${util.stringifyPrimitive(issue.values[0])} attendu`;
|
| 79 |
+
return `Option invalide : une valeur parmi ${util.joinValues(issue.values, "|")} attendue`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `Trop grand : ${issue.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
|
| 85 |
+
return `Trop grand : ${issue.origin ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `Trop petit : ${issue.origin} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `Trop petit : ${issue.origin} doit être ${adj}${issue.minimum.toString()}`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
|
| 99 |
+
if (_issue.format === "ends_with") return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
|
| 100 |
+
if (_issue.format === "includes") return `Chaîne invalide : doit inclure "${_issue.includes}"`;
|
| 101 |
+
if (_issue.format === "regex") return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`;
|
| 102 |
+
return `${Nouns[_issue.format] ?? issue.format} invalide`;
|
| 103 |
+
}
|
| 104 |
+
case "not_multiple_of":
|
| 105 |
+
return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
|
| 106 |
+
case "unrecognized_keys":
|
| 107 |
+
return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
|
| 108 |
+
case "invalid_key":
|
| 109 |
+
return `Clé invalide dans ${issue.origin}`;
|
| 110 |
+
case "invalid_union":
|
| 111 |
+
return "Entrée invalide";
|
| 112 |
+
case "invalid_element":
|
| 113 |
+
return `Valeur invalide dans ${issue.origin}`;
|
| 114 |
+
default:
|
| 115 |
+
return `Entrée invalide`;
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 121 |
+
return {
|
| 122 |
+
localeError: error(),
|
| 123 |
+
};
|
| 124 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/he.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "בייטים", verb: "לכלול" },
|
| 9 |
+
array: { unit: "פריטים", verb: "לכלול" },
|
| 10 |
+
set: { unit: "פריטים", verb: "לכלול" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "קלט",
|
| 44 |
+
email: "כתובת אימייל",
|
| 45 |
+
url: "כתובת רשת",
|
| 46 |
+
emoji: "אימוג'י",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "תאריך וזמן ISO",
|
| 58 |
+
date: "תאריך ISO",
|
| 59 |
+
time: "זמן ISO",
|
| 60 |
+
duration: "משך זמן ISO",
|
| 61 |
+
ipv4: "כתובת IPv4",
|
| 62 |
+
ipv6: "כתובת IPv6",
|
| 63 |
+
cidrv4: "טווח IPv4",
|
| 64 |
+
cidrv6: "טווח IPv6",
|
| 65 |
+
base64: "מחרוזת בבסיס 64",
|
| 66 |
+
base64url: "מחרוזת בבסיס 64 לכתובות רשת",
|
| 67 |
+
json_string: "מחרוזת JSON",
|
| 68 |
+
e164: "מספר E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "קלט",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `קלט לא תקין: צריך ${issue.expected}, התקבל ${parsedType(issue.input)}`;
|
| 77 |
+
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `קלט לא תקין: צריך ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `קלט לא תקין: צריך אחת מהאפשרויות ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `גדול מדי: ${issue.origin ?? "value"} צריך להיות ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
| 86 |
+
return `גדול מדי: ${issue.origin ?? "value"} צריך להיות ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `קטן מדי: ${issue.origin} צריך להיות ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `קטן מדי: ${issue.origin} צריך להיות ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `מחרוזת לא תקינה: חייבת להתחיל ב"${_issue.prefix}"`;
|
| 100 |
+
if (_issue.format === "ends_with") return `מחרוזת לא תקינה: חייבת להסתיים ב "${_issue.suffix}"`;
|
| 101 |
+
if (_issue.format === "includes") return `מחרוזת לא תקינה: חייבת לכלול "${_issue.includes}"`;
|
| 102 |
+
if (_issue.format === "regex") return `מחרוזת לא תקינה: חייבת להתאים לתבנית ${_issue.pattern}`;
|
| 103 |
+
return `${Nouns[_issue.format] ?? issue.format} לא תקין`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `מספר לא תקין: חייב להיות מכפלה של ${issue.divisor}`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `מפתח${issue.keys.length > 1 ? "ות" : ""} לא מזוה${issue.keys.length > 1 ? "ים" : "ה"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `מפתח לא תקין ב${issue.origin}`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "קלט לא תקין";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `ערך לא תקין ב${issue.origin}`;
|
| 115 |
+
default:
|
| 116 |
+
return `קלט לא תקין`;
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/hu.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "karakter", verb: "legyen" },
|
| 8 |
+
file: { unit: "byte", verb: "legyen" },
|
| 9 |
+
array: { unit: "elem", verb: "legyen" },
|
| 10 |
+
set: { unit: "elem", verb: "legyen" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "szám";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "tömb";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "bemenet",
|
| 44 |
+
email: "email cím",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO időbélyeg",
|
| 58 |
+
date: "ISO dátum",
|
| 59 |
+
time: "ISO idő",
|
| 60 |
+
duration: "ISO időintervallum",
|
| 61 |
+
ipv4: "IPv4 cím",
|
| 62 |
+
ipv6: "IPv6 cím",
|
| 63 |
+
cidrv4: "IPv4 tartomány",
|
| 64 |
+
cidrv6: "IPv6 tartomány",
|
| 65 |
+
base64: "base64-kódolt string",
|
| 66 |
+
base64url: "base64url-kódolt string",
|
| 67 |
+
json_string: "JSON string",
|
| 68 |
+
e164: "E.164 szám",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "bemenet",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Érvénytelen bemenet: a várt érték ${issue.expected}, a kapott érték ${parsedType(issue.input)}`;
|
| 77 |
+
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1)
|
| 80 |
+
return `Érvénytelen bemenet: a várt érték ${util.stringifyPrimitive(issue.values[0])}`;
|
| 81 |
+
return `Érvénytelen opció: valamelyik érték várt ${util.joinValues(issue.values, "|")}`;
|
| 82 |
+
case "too_big": {
|
| 83 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 84 |
+
const sizing = getSizing(issue.origin);
|
| 85 |
+
if (sizing)
|
| 86 |
+
return `Túl nagy: ${issue.origin ?? "érték"} mérete túl nagy ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elem"}`;
|
| 87 |
+
return `Túl nagy: a bemeneti érték ${issue.origin ?? "érték"} túl nagy: ${adj}${issue.maximum.toString()}`;
|
| 88 |
+
}
|
| 89 |
+
case "too_small": {
|
| 90 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 91 |
+
const sizing = getSizing(issue.origin);
|
| 92 |
+
if (sizing) {
|
| 93 |
+
return `Túl kicsi: a bemeneti érték ${issue.origin} mérete túl kicsi ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
return `Túl kicsi: a bemeneti érték ${issue.origin} túl kicsi ${adj}${issue.minimum.toString()}`;
|
| 97 |
+
}
|
| 98 |
+
case "invalid_format": {
|
| 99 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 100 |
+
if (_issue.format === "starts_with") return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`;
|
| 101 |
+
if (_issue.format === "ends_with") return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`;
|
| 102 |
+
if (_issue.format === "includes") return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`;
|
| 103 |
+
if (_issue.format === "regex") return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`;
|
| 104 |
+
return `Érvénytelen ${Nouns[_issue.format] ?? issue.format}`;
|
| 105 |
+
}
|
| 106 |
+
case "not_multiple_of":
|
| 107 |
+
return `Érvénytelen szám: ${issue.divisor} többszörösének kell lennie`;
|
| 108 |
+
case "unrecognized_keys":
|
| 109 |
+
return `Ismeretlen kulcs${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 110 |
+
case "invalid_key":
|
| 111 |
+
return `Érvénytelen kulcs ${issue.origin}`;
|
| 112 |
+
case "invalid_union":
|
| 113 |
+
return "Érvénytelen bemenet";
|
| 114 |
+
case "invalid_element":
|
| 115 |
+
return `Érvénytelen érték: ${issue.origin}`;
|
| 116 |
+
default:
|
| 117 |
+
return `Érvénytelen bemenet`;
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 123 |
+
return {
|
| 124 |
+
localeError: error(),
|
| 125 |
+
};
|
| 126 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/id.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "karakter", verb: "memiliki" },
|
| 8 |
+
file: { unit: "byte", verb: "memiliki" },
|
| 9 |
+
array: { unit: "item", verb: "memiliki" },
|
| 10 |
+
set: { unit: "item", verb: "memiliki" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "input",
|
| 44 |
+
email: "alamat email",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "tanggal dan waktu format ISO",
|
| 58 |
+
date: "tanggal format ISO",
|
| 59 |
+
time: "jam format ISO",
|
| 60 |
+
duration: "durasi format ISO",
|
| 61 |
+
ipv4: "alamat IPv4",
|
| 62 |
+
ipv6: "alamat IPv6",
|
| 63 |
+
cidrv4: "rentang alamat IPv4",
|
| 64 |
+
cidrv6: "rentang alamat IPv6",
|
| 65 |
+
base64: "string dengan enkode base64",
|
| 66 |
+
base64url: "string dengan enkode base64url",
|
| 67 |
+
json_string: "string JSON",
|
| 68 |
+
e164: "angka E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "input",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Input tidak valid: diharapkan ${issue.expected}, diterima ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1)
|
| 79 |
+
return `Input tidak valid: diharapkan ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Pilihan tidak valid: diharapkan salah satu dari ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Terlalu besar: diharapkan ${issue.origin ?? "value"} memiliki ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`;
|
| 86 |
+
return `Terlalu besar: diharapkan ${issue.origin ?? "value"} menjadi ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Terlalu kecil: diharapkan ${issue.origin} memiliki ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Terlalu kecil: diharapkan ${issue.origin} menjadi ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`;
|
| 100 |
+
if (_issue.format === "ends_with") return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`;
|
| 101 |
+
if (_issue.format === "includes") return `String tidak valid: harus menyertakan "${_issue.includes}"`;
|
| 102 |
+
if (_issue.format === "regex") return `String tidak valid: harus sesuai pola ${_issue.pattern}`;
|
| 103 |
+
return `${Nouns[_issue.format] ?? issue.format} tidak valid`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `Angka tidak valid: harus kelipatan dari ${issue.divisor}`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `Kunci tidak dikenali ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `Kunci tidak valid di ${issue.origin}`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "Input tidak valid";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `Nilai tidak valid di ${issue.origin}`;
|
| 115 |
+
default:
|
| 116 |
+
return `Input tidak valid`;
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export { default as ar } from "./ar.js";
|
| 2 |
+
export { default as az } from "./az.js";
|
| 3 |
+
export { default as be } from "./be.js";
|
| 4 |
+
export { default as ca } from "./ca.js";
|
| 5 |
+
export { default as cs } from "./cs.js";
|
| 6 |
+
export { default as de } from "./de.js";
|
| 7 |
+
export { default as en } from "./en.js";
|
| 8 |
+
export { default as eo } from "./eo.js";
|
| 9 |
+
export { default as es } from "./es.js";
|
| 10 |
+
export { default as fa } from "./fa.js";
|
| 11 |
+
export { default as fi } from "./fi.js";
|
| 12 |
+
export { default as fr } from "./fr.js";
|
| 13 |
+
export { default as frCA } from "./fr-CA.js";
|
| 14 |
+
export { default as he } from "./he.js";
|
| 15 |
+
export { default as hu } from "./hu.js";
|
| 16 |
+
export { default as id } from "./id.js";
|
| 17 |
+
export { default as it } from "./it.js";
|
| 18 |
+
export { default as ja } from "./ja.js";
|
| 19 |
+
export { default as kh } from "./kh.js";
|
| 20 |
+
export { default as ko } from "./ko.js";
|
| 21 |
+
export { default as mk } from "./mk.js";
|
| 22 |
+
export { default as ms } from "./ms.js";
|
| 23 |
+
export { default as nl } from "./nl.js";
|
| 24 |
+
export { default as no } from "./no.js";
|
| 25 |
+
export { default as ota } from "./ota.js";
|
| 26 |
+
export { default as ps } from "./ps.js";
|
| 27 |
+
export { default as pl } from "./pl.js";
|
| 28 |
+
export { default as pt } from "./pt.js";
|
| 29 |
+
export { default as ru } from "./ru.js";
|
| 30 |
+
export { default as sl } from "./sl.js";
|
| 31 |
+
export { default as sv } from "./sv.js";
|
| 32 |
+
export { default as ta } from "./ta.js";
|
| 33 |
+
export { default as th } from "./th.js";
|
| 34 |
+
export { default as tr } from "./tr.js";
|
| 35 |
+
export { default as ua } from "./ua.js";
|
| 36 |
+
export { default as ur } from "./ur.js";
|
| 37 |
+
export { default as vi } from "./vi.js";
|
| 38 |
+
export { default as zhCN } from "./zh-CN.js";
|
| 39 |
+
export { default as zhTW } from "./zh-TW.js";
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/it.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "caratteri", verb: "avere" },
|
| 8 |
+
file: { unit: "byte", verb: "avere" },
|
| 9 |
+
array: { unit: "elementi", verb: "avere" },
|
| 10 |
+
set: { unit: "elementi", verb: "avere" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "numero";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "vettore";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "input",
|
| 44 |
+
email: "indirizzo email",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "data e ora ISO",
|
| 58 |
+
date: "data ISO",
|
| 59 |
+
time: "ora ISO",
|
| 60 |
+
duration: "durata ISO",
|
| 61 |
+
ipv4: "indirizzo IPv4",
|
| 62 |
+
ipv6: "indirizzo IPv6",
|
| 63 |
+
cidrv4: "intervallo IPv4",
|
| 64 |
+
cidrv6: "intervallo IPv6",
|
| 65 |
+
base64: "stringa codificata in base64",
|
| 66 |
+
base64url: "URL codificata in base64",
|
| 67 |
+
json_string: "stringa JSON",
|
| 68 |
+
e164: "numero E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "input",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Input non valido: atteso ${issue.expected}, ricevuto ${parsedType(issue.input)}`;
|
| 77 |
+
// return `Input non valido: atteso ${issue.expected}, ricevuto ${util.getParsedType(issue.input)}`;
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `Input non valido: atteso ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Opzione non valida: atteso uno tra ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Troppo grande: ${issue.origin ?? "valore"} deve avere ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementi"}`;
|
| 86 |
+
return `Troppo grande: ${issue.origin ?? "valore"} deve essere ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Troppo piccolo: ${issue.origin} deve avere ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Troppo piccolo: ${issue.origin} deve essere ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;
|
| 100 |
+
if (_issue.format === "ends_with") return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
|
| 101 |
+
if (_issue.format === "includes") return `Stringa non valida: deve includere "${_issue.includes}"`;
|
| 102 |
+
if (_issue.format === "regex") return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
|
| 103 |
+
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `Numero non valido: deve essere un multiplo di ${issue.divisor}`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `Chiav${issue.keys.length > 1 ? "i" : "e"} non riconosciut${issue.keys.length > 1 ? "e" : "a"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `Chiave non valida in ${issue.origin}`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "Input non valido";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `Valore non valido in ${issue.origin}`;
|
| 115 |
+
default:
|
| 116 |
+
return `Input non valido`;
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ja.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "バイト", verb: "である" },
|
| 9 |
+
array: { unit: "要素", verb: "である" },
|
| 10 |
+
set: { unit: "要素", verb: "である" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "数値";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "配列";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "入力値",
|
| 44 |
+
email: "メールアドレス",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "絵文字",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO日時",
|
| 58 |
+
date: "ISO日付",
|
| 59 |
+
time: "ISO時刻",
|
| 60 |
+
duration: "ISO期間",
|
| 61 |
+
ipv4: "IPv4アドレス",
|
| 62 |
+
ipv6: "IPv6アドレス",
|
| 63 |
+
cidrv4: "IPv4範囲",
|
| 64 |
+
cidrv6: "IPv6範囲",
|
| 65 |
+
base64: "base64エンコード文字列",
|
| 66 |
+
base64url: "base64urlエンコード文字列",
|
| 67 |
+
json_string: "JSON文字列",
|
| 68 |
+
e164: "E.164番号",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "入力値",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `無効な入力: ${issue.expected}が期待されましたが、${parsedType(issue.input)}が入力されました`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `無効な入力: ${util.stringifyPrimitive(issue.values[0])}が期待されました`;
|
| 79 |
+
return `無効な選択: ${util.joinValues(issue.values, "、")}のいずれかである必要があります`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "以下である" : "より小さい";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}必要があります`;
|
| 85 |
+
return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}必要があります`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? "以上である" : "より大きい";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing)
|
| 91 |
+
return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}必要があります`;
|
| 92 |
+
return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}必要があります`;
|
| 93 |
+
}
|
| 94 |
+
case "invalid_format": {
|
| 95 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 96 |
+
if (_issue.format === "starts_with") return `無効な文字列: "${_issue.prefix}"で始まる必要があります`;
|
| 97 |
+
if (_issue.format === "ends_with") return `無効な文字列: "${_issue.suffix}"で終わる必要があります`;
|
| 98 |
+
if (_issue.format === "includes") return `無効な文字列: "${_issue.includes}"を含む必要があります`;
|
| 99 |
+
if (_issue.format === "regex") return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`;
|
| 100 |
+
return `無効な${Nouns[_issue.format] ?? issue.format}`;
|
| 101 |
+
}
|
| 102 |
+
case "not_multiple_of":
|
| 103 |
+
return `無効な数値: ${issue.divisor}の倍数である必要があります`;
|
| 104 |
+
case "unrecognized_keys":
|
| 105 |
+
return `認識されていないキー${issue.keys.length > 1 ? "群" : ""}: ${util.joinValues(issue.keys, "、")}`;
|
| 106 |
+
case "invalid_key":
|
| 107 |
+
return `${issue.origin}内の無効なキー`;
|
| 108 |
+
case "invalid_union":
|
| 109 |
+
return "無効な入力";
|
| 110 |
+
case "invalid_element":
|
| 111 |
+
return `${issue.origin}内の無効な値`;
|
| 112 |
+
default:
|
| 113 |
+
return `無効な入力`;
|
| 114 |
+
}
|
| 115 |
+
};
|
| 116 |
+
};
|
| 117 |
+
|
| 118 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 119 |
+
return {
|
| 120 |
+
localeError: error(),
|
| 121 |
+
};
|
| 122 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/kh.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "បៃ", verb: "គួរមាន" },
|
| 9 |
+
array: { unit: "ធាតុ", verb: "គួរមាន" },
|
| 10 |
+
set: { unit: "ធាតុ", verb: "គួរមាន" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "មិនមែនជាលេខ (NaN)" : "លេខ";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "អារេ (Array)";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "គ្មានតម្លៃ (null)";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "ទិន្នន័យបញ្ចូល",
|
| 44 |
+
email: "អាសយដ្ឋានអ៊ីមែល",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "សញ្ញាអារម្មណ៍",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "កាលបរិច្ឆេទ និងម៉ោង ISO",
|
| 58 |
+
date: "កាលបរិច្ឆេទ ISO",
|
| 59 |
+
time: "ម៉ោង ISO",
|
| 60 |
+
duration: "រយៈពេល ISO",
|
| 61 |
+
ipv4: "អាសយដ្ឋាន IPv4",
|
| 62 |
+
ipv6: "អាសយដ្ឋាន IPv6",
|
| 63 |
+
cidrv4: "ដែនអាសយដ្ឋាន IPv4",
|
| 64 |
+
cidrv6: "ដែនអាសយដ្ឋាន IPv6",
|
| 65 |
+
base64: "ខ្សែអក្សរអ៊ិកូដ base64",
|
| 66 |
+
base64url: "ខ្សែអក្សរអ៊ិកូដ base64url",
|
| 67 |
+
json_string: "ខ្សែអក្សរ JSON",
|
| 68 |
+
e164: "លេខ E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "ទិន្នន័យបញ្ចូល",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${issue.expected} ប៉ុន្តែទទួលបាន ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "ធាតុ"}`;
|
| 85 |
+
return `ធំពេក៖ ត្រូវការ ${issue.origin ?? "តម្លៃ"} ${adj} ${issue.maximum.toString()}`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `តូចពេក៖ ត្រូវការ ${issue.origin} ${adj} ${issue.minimum.toString()}`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") {
|
| 99 |
+
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${_issue.prefix}"`;
|
| 100 |
+
}
|
| 101 |
+
if (_issue.format === "ends_with") return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${_issue.suffix}"`;
|
| 102 |
+
if (_issue.format === "includes") return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${_issue.includes}"`;
|
| 103 |
+
if (_issue.format === "regex") return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${_issue.pattern}`;
|
| 104 |
+
return `មិនត្រឹមត្រូវ៖ ${Nouns[_issue.format] ?? issue.format}`;
|
| 105 |
+
}
|
| 106 |
+
case "not_multiple_of":
|
| 107 |
+
return `លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${issue.divisor}`;
|
| 108 |
+
case "unrecognized_keys":
|
| 109 |
+
return `រកឃើញសោមិនស្គាល់៖ ${util.joinValues(issue.keys, ", ")}`;
|
| 110 |
+
case "invalid_key":
|
| 111 |
+
return `សោមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`;
|
| 112 |
+
case "invalid_union":
|
| 113 |
+
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
|
| 114 |
+
case "invalid_element":
|
| 115 |
+
return `ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${issue.origin}`;
|
| 116 |
+
default:
|
| 117 |
+
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 123 |
+
return {
|
| 124 |
+
localeError: error(),
|
| 125 |
+
};
|
| 126 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ko.ts
ADDED
|
@@ -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: "문자", verb: "to have" },
|
| 8 |
+
file: { unit: "바이트", verb: "to have" },
|
| 9 |
+
array: { unit: "개", verb: "to have" },
|
| 10 |
+
set: { unit: "개", verb: "to have" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "number";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "입력",
|
| 44 |
+
email: "이메일 주소",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "이모지",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO 날짜시간",
|
| 58 |
+
date: "ISO 날짜",
|
| 59 |
+
time: "ISO 시간",
|
| 60 |
+
duration: "ISO 기간",
|
| 61 |
+
ipv4: "IPv4 주소",
|
| 62 |
+
ipv6: "IPv6 주소",
|
| 63 |
+
cidrv4: "IPv4 범위",
|
| 64 |
+
cidrv6: "IPv6 범위",
|
| 65 |
+
base64: "base64 인코딩 문자열",
|
| 66 |
+
base64url: "base64url 인코딩 문자열",
|
| 67 |
+
json_string: "JSON 문자열",
|
| 68 |
+
e164: "E.164 번호",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "입력",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `잘못된 입력: 예상 타입은 ${issue.expected}, 받은 타입은 ${parsedType(issue.input)}입니다`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1)
|
| 79 |
+
return `잘못된 입력: 값은 ${util.stringifyPrimitive(issue.values[0])} 이어야 합니다`;
|
| 80 |
+
return `잘못된 옵션: ${util.joinValues(issue.values, "또는 ")} 중 하나여야 합니다`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "이하" : "미만";
|
| 83 |
+
const suffix = adj === "미만" ? "이어야 합니다" : "여야 합니다";
|
| 84 |
+
const sizing = getSizing(issue.origin);
|
| 85 |
+
const unit = sizing?.unit ?? "요소";
|
| 86 |
+
if (sizing) return `${issue.origin ?? "값"}이 너무 큽니다: ${issue.maximum.toString()}${unit} ${adj}${suffix}`;
|
| 87 |
+
|
| 88 |
+
return `${issue.origin ?? "값"}이 너무 큽니다: ${issue.maximum.toString()} ${adj}${suffix}`;
|
| 89 |
+
}
|
| 90 |
+
case "too_small": {
|
| 91 |
+
const adj = issue.inclusive ? "이상" : "초과";
|
| 92 |
+
const suffix = adj === "이상" ? "이어야 합니다" : "여야 합니다";
|
| 93 |
+
const sizing = getSizing(issue.origin);
|
| 94 |
+
const unit = sizing?.unit ?? "요소";
|
| 95 |
+
if (sizing) {
|
| 96 |
+
return `${issue.origin ?? "값"}이 너무 작습니다: ${issue.minimum.toString()}${unit} ${adj}${suffix}`;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
return `${issue.origin ?? "값"}이 너무 작습니다: ${issue.minimum.toString()} ${adj}${suffix}`;
|
| 100 |
+
}
|
| 101 |
+
case "invalid_format": {
|
| 102 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 103 |
+
if (_issue.format === "starts_with") {
|
| 104 |
+
return `잘못된 문자열: "${_issue.prefix}"(으)로 시작해야 합니다`;
|
| 105 |
+
}
|
| 106 |
+
if (_issue.format === "ends_with") return `잘못된 문자열: "${_issue.suffix}"(으)로 끝나야 합니다`;
|
| 107 |
+
if (_issue.format === "includes") return `잘못된 문자열: "${_issue.includes}"을(를) 포함해야 합니다`;
|
| 108 |
+
if (_issue.format === "regex") return `잘못된 문자열: 정규식 ${_issue.pattern} 패턴과 일치해야 합니다`;
|
| 109 |
+
return `잘못된 ${Nouns[_issue.format] ?? issue.format}`;
|
| 110 |
+
}
|
| 111 |
+
case "not_multiple_of":
|
| 112 |
+
return `잘못된 숫자: ${issue.divisor}의 배수여야 합니다`;
|
| 113 |
+
case "unrecognized_keys":
|
| 114 |
+
return `인식할 수 없는 키: ${util.joinValues(issue.keys, ", ")}`;
|
| 115 |
+
case "invalid_key":
|
| 116 |
+
return `잘못된 키: ${issue.origin}`;
|
| 117 |
+
case "invalid_union":
|
| 118 |
+
return `잘못된 입력`;
|
| 119 |
+
case "invalid_element":
|
| 120 |
+
return `잘못된 값: ${issue.origin}`;
|
| 121 |
+
default:
|
| 122 |
+
return `잘못된 입력`;
|
| 123 |
+
}
|
| 124 |
+
};
|
| 125 |
+
};
|
| 126 |
+
|
| 127 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 128 |
+
return {
|
| 129 |
+
localeError: error(),
|
| 130 |
+
};
|
| 131 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/mk.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "бајти", verb: "да имаат" },
|
| 9 |
+
array: { unit: "ставки", verb: "да имаат" },
|
| 10 |
+
set: { unit: "ставки", verb: "да имаат" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "број";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "низа";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "внес",
|
| 44 |
+
email: "адреса на е-пошта",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "емоџи",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO датум и време",
|
| 58 |
+
date: "ISO датум",
|
| 59 |
+
time: "ISO време",
|
| 60 |
+
duration: "ISO времетраење",
|
| 61 |
+
ipv4: "IPv4 адреса",
|
| 62 |
+
ipv6: "IPv6 адреса",
|
| 63 |
+
cidrv4: "IPv4 опсег",
|
| 64 |
+
cidrv6: "IPv6 опсег",
|
| 65 |
+
base64: "base64-енкодирана низа",
|
| 66 |
+
base64url: "base64url-енкодирана низа",
|
| 67 |
+
json_string: "JSON низа",
|
| 68 |
+
e164: "E.164 број",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "внес",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Грешен внес: се очекува ${issue.expected}, примено ${parsedType(issue.input)}`;
|
| 77 |
+
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Грешана опција: се очекува една ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Премногу голем: се очекува ${issue.origin ?? "вредноста"} да има ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елементи"}`;
|
| 86 |
+
return `Премногу голем: се очекува ${issue.origin ?? "вредноста"} да биде ${adj}${issue.maximum.toString()}`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Премногу мал: се очекува ${issue.origin} да има ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Премногу мал: се очекува ${issue.origin} да биде ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") {
|
| 100 |
+
return `Неважечка низа: мора да започнува со "${_issue.prefix}"`;
|
| 101 |
+
}
|
| 102 |
+
if (_issue.format === "ends_with") return `Неважечка низа: мора да завршува со "${_issue.suffix}"`;
|
| 103 |
+
if (_issue.format === "includes") return `Неважечка низа: мора да вклучува "${_issue.includes}"`;
|
| 104 |
+
if (_issue.format === "regex") return `Неважечка низа: мора да одгоара на патернот ${_issue.pattern}`;
|
| 105 |
+
return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
|
| 106 |
+
}
|
| 107 |
+
case "not_multiple_of":
|
| 108 |
+
return `Грешен број: мора да биде делив со ${issue.divisor}`;
|
| 109 |
+
case "unrecognized_keys":
|
| 110 |
+
return `${issue.keys.length > 1 ? "Непрепознаени клучеви" : "Непрепознаен клуч"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 111 |
+
case "invalid_key":
|
| 112 |
+
return `Грешен клуч во ${issue.origin}`;
|
| 113 |
+
case "invalid_union":
|
| 114 |
+
return "Грешен внес";
|
| 115 |
+
case "invalid_element":
|
| 116 |
+
return `Грешна вредност во ${issue.origin}`;
|
| 117 |
+
default:
|
| 118 |
+
return `Грешен внес`;
|
| 119 |
+
}
|
| 120 |
+
};
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 124 |
+
return {
|
| 125 |
+
localeError: error(),
|
| 126 |
+
};
|
| 127 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ms.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "aksara", verb: "mempunyai" },
|
| 8 |
+
file: { unit: "bait", verb: "mempunyai" },
|
| 9 |
+
array: { unit: "elemen", verb: "mempunyai" },
|
| 10 |
+
set: { unit: "elemen", verb: "mempunyai" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "nombor";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "input",
|
| 44 |
+
email: "alamat e-mel",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "tarikh masa ISO",
|
| 58 |
+
date: "tarikh ISO",
|
| 59 |
+
time: "masa ISO",
|
| 60 |
+
duration: "tempoh ISO",
|
| 61 |
+
ipv4: "alamat IPv4",
|
| 62 |
+
ipv6: "alamat IPv6",
|
| 63 |
+
cidrv4: "julat IPv4",
|
| 64 |
+
cidrv6: "julat IPv6",
|
| 65 |
+
base64: "string dikodkan base64",
|
| 66 |
+
base64url: "string dikodkan base64url",
|
| 67 |
+
json_string: "string JSON",
|
| 68 |
+
e164: "nombor E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "input",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Input tidak sah: dijangka ${issue.expected}, diterima ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Input tidak sah: dijangka ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `Pilihan tidak sah: dijangka salah satu daripada ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `Terlalu besar: dijangka ${issue.origin ?? "nilai"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elemen"}`;
|
| 85 |
+
return `Terlalu besar: dijangka ${issue.origin ?? "nilai"} adalah ${adj}${issue.maximum.toString()}`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `Terlalu kecil: dijangka ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `Terlalu kecil: dijangka ${issue.origin} adalah ${adj}${issue.minimum.toString()}`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`;
|
| 99 |
+
if (_issue.format === "ends_with") return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`;
|
| 100 |
+
if (_issue.format === "includes") return `String tidak sah: mesti mengandungi "${_issue.includes}"`;
|
| 101 |
+
if (_issue.format === "regex") return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`;
|
| 102 |
+
return `${Nouns[_issue.format] ?? issue.format} tidak sah`;
|
| 103 |
+
}
|
| 104 |
+
case "not_multiple_of":
|
| 105 |
+
return `Nombor tidak sah: perlu gandaan ${issue.divisor}`;
|
| 106 |
+
case "unrecognized_keys":
|
| 107 |
+
return `Kunci tidak dikenali: ${util.joinValues(issue.keys, ", ")}`;
|
| 108 |
+
case "invalid_key":
|
| 109 |
+
return `Kunci tidak sah dalam ${issue.origin}`;
|
| 110 |
+
case "invalid_union":
|
| 111 |
+
return "Input tidak sah";
|
| 112 |
+
case "invalid_element":
|
| 113 |
+
return `Nilai tidak sah dalam ${issue.origin}`;
|
| 114 |
+
default:
|
| 115 |
+
return `Input tidak sah`;
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 121 |
+
return {
|
| 122 |
+
localeError: error(),
|
| 123 |
+
};
|
| 124 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/nl.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 }> = {
|
| 7 |
+
string: { unit: "tekens" },
|
| 8 |
+
file: { unit: "bytes" },
|
| 9 |
+
array: { unit: "elementen" },
|
| 10 |
+
set: { unit: "elementen" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "getal";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "invoer",
|
| 44 |
+
email: "emailadres",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO datum en tijd",
|
| 58 |
+
date: "ISO datum",
|
| 59 |
+
time: "ISO tijd",
|
| 60 |
+
duration: "ISO duur",
|
| 61 |
+
ipv4: "IPv4-adres",
|
| 62 |
+
ipv6: "IPv6-adres",
|
| 63 |
+
cidrv4: "IPv4-bereik",
|
| 64 |
+
cidrv6: "IPv6-bereik",
|
| 65 |
+
base64: "base64-gecodeerde tekst",
|
| 66 |
+
base64url: "base64 URL-gecodeerde tekst",
|
| 67 |
+
json_string: "JSON string",
|
| 68 |
+
e164: "E.164-nummer",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "invoer",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Ongeldige invoer: verwacht ${issue.expected}, ontving ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Ongeldige invoer: verwacht ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `Ongeldige optie: verwacht één van ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `Te lang: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"} bevat`;
|
| 85 |
+
return `Te lang: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `Te kort: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} bevat`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `Te kort: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") {
|
| 99 |
+
return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`;
|
| 100 |
+
}
|
| 101 |
+
if (_issue.format === "ends_with") return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`;
|
| 102 |
+
if (_issue.format === "includes") return `Ongeldige tekst: moet "${_issue.includes}" bevatten`;
|
| 103 |
+
if (_issue.format === "regex") return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`;
|
| 104 |
+
return `Ongeldig: ${Nouns[_issue.format] ?? issue.format}`;
|
| 105 |
+
}
|
| 106 |
+
case "not_multiple_of":
|
| 107 |
+
return `Ongeldig getal: moet een veelvoud van ${issue.divisor} zijn`;
|
| 108 |
+
case "unrecognized_keys":
|
| 109 |
+
return `Onbekende key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 110 |
+
case "invalid_key":
|
| 111 |
+
return `Ongeldige key in ${issue.origin}`;
|
| 112 |
+
case "invalid_union":
|
| 113 |
+
return "Ongeldige invoer";
|
| 114 |
+
case "invalid_element":
|
| 115 |
+
return `Ongeldige waarde in ${issue.origin}`;
|
| 116 |
+
default:
|
| 117 |
+
return `Ongeldige invoer`;
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 123 |
+
return {
|
| 124 |
+
localeError: error(),
|
| 125 |
+
};
|
| 126 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/no.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "tegn", verb: "å ha" },
|
| 8 |
+
file: { unit: "bytes", verb: "å ha" },
|
| 9 |
+
array: { unit: "elementer", verb: "å inneholde" },
|
| 10 |
+
set: { unit: "elementer", verb: "å inneholde" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "tall";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "liste";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "input",
|
| 44 |
+
email: "e-postadresse",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO dato- og klokkeslett",
|
| 58 |
+
date: "ISO-dato",
|
| 59 |
+
time: "ISO-klokkeslett",
|
| 60 |
+
duration: "ISO-varighet",
|
| 61 |
+
ipv4: "IPv4-område",
|
| 62 |
+
ipv6: "IPv6-område",
|
| 63 |
+
cidrv4: "IPv4-spekter",
|
| 64 |
+
cidrv6: "IPv6-spekter",
|
| 65 |
+
base64: "base64-enkodet streng",
|
| 66 |
+
base64url: "base64url-enkodet streng",
|
| 67 |
+
json_string: "JSON-streng",
|
| 68 |
+
e164: "E.164-nummer",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "input",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Ugyldig input: forventet ${issue.expected}, fikk ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1) return `Ugyldig verdi: forventet ${util.stringifyPrimitive(issue.values[0])}`;
|
| 79 |
+
return `Ugyldig valg: forventet en av ${util.joinValues(issue.values, "|")}`;
|
| 80 |
+
case "too_big": {
|
| 81 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 82 |
+
const sizing = getSizing(issue.origin);
|
| 83 |
+
if (sizing)
|
| 84 |
+
return `For stor(t): forventet ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`;
|
| 85 |
+
return `For stor(t): forventet ${issue.origin ?? "value"} til å ha ${adj}${issue.maximum.toString()}`;
|
| 86 |
+
}
|
| 87 |
+
case "too_small": {
|
| 88 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 89 |
+
const sizing = getSizing(issue.origin);
|
| 90 |
+
if (sizing) {
|
| 91 |
+
return `For lite(n): forventet ${issue.origin} til å ha ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return `For lite(n): forventet ${issue.origin} til å ha ${adj}${issue.minimum.toString()}`;
|
| 95 |
+
}
|
| 96 |
+
case "invalid_format": {
|
| 97 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 98 |
+
if (_issue.format === "starts_with") return `Ugyldig streng: må starte med "${_issue.prefix}"`;
|
| 99 |
+
if (_issue.format === "ends_with") return `Ugyldig streng: må ende med "${_issue.suffix}"`;
|
| 100 |
+
if (_issue.format === "includes") return `Ugyldig streng: må inneholde "${_issue.includes}"`;
|
| 101 |
+
if (_issue.format === "regex") return `Ugyldig streng: må matche mønsteret ${_issue.pattern}`;
|
| 102 |
+
return `Ugyldig ${Nouns[_issue.format] ?? issue.format}`;
|
| 103 |
+
}
|
| 104 |
+
case "not_multiple_of":
|
| 105 |
+
return `Ugyldig tall: må være et multiplum av ${issue.divisor}`;
|
| 106 |
+
case "unrecognized_keys":
|
| 107 |
+
return `${issue.keys.length > 1 ? "Ukjente nøkler" : "Ukjent nøkkel"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 108 |
+
case "invalid_key":
|
| 109 |
+
return `Ugyldig nøkkel i ${issue.origin}`;
|
| 110 |
+
case "invalid_union":
|
| 111 |
+
return "Ugyldig input";
|
| 112 |
+
case "invalid_element":
|
| 113 |
+
return `Ugyldig verdi i ${issue.origin}`;
|
| 114 |
+
default:
|
| 115 |
+
return `Ugyldig input`;
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 121 |
+
return {
|
| 122 |
+
localeError: error(),
|
| 123 |
+
};
|
| 124 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ota.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "harf", verb: "olmalıdır" },
|
| 8 |
+
file: { unit: "bayt", verb: "olmalıdır" },
|
| 9 |
+
array: { unit: "unsur", verb: "olmalıdır" },
|
| 10 |
+
set: { unit: "unsur", verb: "olmalıdır" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "numara";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "saf";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "gayb";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "giren",
|
| 44 |
+
email: "epostagâh",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "ISO hengâmı",
|
| 58 |
+
date: "ISO tarihi",
|
| 59 |
+
time: "ISO zamanı",
|
| 60 |
+
duration: "ISO müddeti",
|
| 61 |
+
ipv4: "IPv4 nişânı",
|
| 62 |
+
ipv6: "IPv6 nişânı",
|
| 63 |
+
cidrv4: "IPv4 menzili",
|
| 64 |
+
cidrv6: "IPv6 menzili",
|
| 65 |
+
base64: "base64-şifreli metin",
|
| 66 |
+
base64url: "base64url-şifreli metin",
|
| 67 |
+
json_string: "JSON metin",
|
| 68 |
+
e164: "E.164 sayısı",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "giren",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Fâsit giren: umulan ${issue.expected}, alınan ${parsedType(issue.input)}`;
|
| 77 |
+
// return `Fâsit giren: umulan ${issue.expected}, alınan ${util.getParsedType(issue.input)}`;
|
| 78 |
+
case "invalid_value":
|
| 79 |
+
if (issue.values.length === 1) return `Fâsit giren: umulan ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Fâsit tercih: mûteberler ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing)
|
| 85 |
+
return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmalıydı.`;
|
| 86 |
+
return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} olmalıydı.`;
|
| 87 |
+
}
|
| 88 |
+
case "too_small": {
|
| 89 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 90 |
+
const sizing = getSizing(issue.origin);
|
| 91 |
+
if (sizing) {
|
| 92 |
+
return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} ${sizing.unit} sahip olmalıydı.`;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} olmalıydı.`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") return `Fâsit metin: "${_issue.prefix}" ile başlamalı.`;
|
| 100 |
+
if (_issue.format === "ends_with") return `Fâsit metin: "${_issue.suffix}" ile bitmeli.`;
|
| 101 |
+
if (_issue.format === "includes") return `Fâsit metin: "${_issue.includes}" ihtivâ etmeli.`;
|
| 102 |
+
if (_issue.format === "regex") return `Fâsit metin: ${_issue.pattern} nakşına uymalı.`;
|
| 103 |
+
return `Fâsit ${Nouns[_issue.format] ?? issue.format}`;
|
| 104 |
+
}
|
| 105 |
+
case "not_multiple_of":
|
| 106 |
+
return `Fâsit sayı: ${issue.divisor} katı olmalıydı.`;
|
| 107 |
+
case "unrecognized_keys":
|
| 108 |
+
return `Tanınmayan anahtar ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 109 |
+
case "invalid_key":
|
| 110 |
+
return `${issue.origin} için tanınmayan anahtar var.`;
|
| 111 |
+
case "invalid_union":
|
| 112 |
+
return "Giren tanınamadı.";
|
| 113 |
+
case "invalid_element":
|
| 114 |
+
return `${issue.origin} için tanınmayan kıymet var.`;
|
| 115 |
+
default:
|
| 116 |
+
return `Kıymet tanınamadı.`;
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 122 |
+
return {
|
| 123 |
+
localeError: error(),
|
| 124 |
+
};
|
| 125 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/pl.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "znaków", verb: "mieć" },
|
| 8 |
+
file: { unit: "bajtów", verb: "mieć" },
|
| 9 |
+
array: { unit: "elementów", verb: "mieć" },
|
| 10 |
+
set: { unit: "elementów", verb: "mieć" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "liczba";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "tablica";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 33 |
+
return data.constructor.name;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return t;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
const Nouns: {
|
| 41 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 42 |
+
} = {
|
| 43 |
+
regex: "wyrażenie",
|
| 44 |
+
email: "adres email",
|
| 45 |
+
url: "URL",
|
| 46 |
+
emoji: "emoji",
|
| 47 |
+
uuid: "UUID",
|
| 48 |
+
uuidv4: "UUIDv4",
|
| 49 |
+
uuidv6: "UUIDv6",
|
| 50 |
+
nanoid: "nanoid",
|
| 51 |
+
guid: "GUID",
|
| 52 |
+
cuid: "cuid",
|
| 53 |
+
cuid2: "cuid2",
|
| 54 |
+
ulid: "ULID",
|
| 55 |
+
xid: "XID",
|
| 56 |
+
ksuid: "KSUID",
|
| 57 |
+
datetime: "data i godzina w formacie ISO",
|
| 58 |
+
date: "data w formacie ISO",
|
| 59 |
+
time: "godzina w formacie ISO",
|
| 60 |
+
duration: "czas trwania ISO",
|
| 61 |
+
ipv4: "adres IPv4",
|
| 62 |
+
ipv6: "adres IPv6",
|
| 63 |
+
cidrv4: "zakres IPv4",
|
| 64 |
+
cidrv6: "zakres IPv6",
|
| 65 |
+
base64: "ciąg znaków zakodowany w formacie base64",
|
| 66 |
+
base64url: "ciąg znaków zakodowany w formacie base64url",
|
| 67 |
+
json_string: "ciąg znaków w formacie JSON",
|
| 68 |
+
e164: "liczba E.164",
|
| 69 |
+
jwt: "JWT",
|
| 70 |
+
template_literal: "wejście",
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
return (issue) => {
|
| 74 |
+
switch (issue.code) {
|
| 75 |
+
case "invalid_type":
|
| 76 |
+
return `Nieprawidłowe dane wejściowe: oczekiwano ${issue.expected}, otrzymano ${parsedType(issue.input)}`;
|
| 77 |
+
case "invalid_value":
|
| 78 |
+
if (issue.values.length === 1)
|
| 79 |
+
return `Nieprawidłowe dane wejściowe: oczekiwano ${util.stringifyPrimitive(issue.values[0])}`;
|
| 80 |
+
return `Nieprawidłowa opcja: oczekiwano jednej z wartości ${util.joinValues(issue.values, "|")}`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing) {
|
| 85 |
+
return `Za duża wartość: oczekiwano, że ${issue.origin ?? "wartość"} będzie mieć ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementów"}`;
|
| 86 |
+
}
|
| 87 |
+
return `Zbyt duż(y/a/e): oczekiwano, że ${issue.origin ?? "wartość"} będzie wynosić ${adj}${issue.maximum.toString()}`;
|
| 88 |
+
}
|
| 89 |
+
case "too_small": {
|
| 90 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 91 |
+
const sizing = getSizing(issue.origin);
|
| 92 |
+
if (sizing) {
|
| 93 |
+
return `Za mała wartość: oczekiwano, że ${issue.origin ?? "wartość"} będzie mieć ${adj}${issue.minimum.toString()} ${sizing.unit ?? "elementów"}`;
|
| 94 |
+
}
|
| 95 |
+
return `Zbyt mał(y/a/e): oczekiwano, że ${issue.origin ?? "wartość"} będzie wynosić ${adj}${issue.minimum.toString()}`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with")
|
| 100 |
+
return `Nieprawidłowy ciąg znaków: musi zaczynać się od "${_issue.prefix}"`;
|
| 101 |
+
if (_issue.format === "ends_with") return `Nieprawidłowy ciąg znaków: musi kończyć się na "${_issue.suffix}"`;
|
| 102 |
+
if (_issue.format === "includes") return `Nieprawidłowy ciąg znaków: musi zawierać "${_issue.includes}"`;
|
| 103 |
+
if (_issue.format === "regex") return `Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${_issue.pattern}`;
|
| 104 |
+
return `Nieprawidłow(y/a/e) ${Nouns[_issue.format] ?? issue.format}`;
|
| 105 |
+
}
|
| 106 |
+
case "not_multiple_of":
|
| 107 |
+
return `Nieprawidłowa liczba: musi być wielokrotnością ${issue.divisor}`;
|
| 108 |
+
case "unrecognized_keys":
|
| 109 |
+
return `Nierozpoznane klucze${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 110 |
+
case "invalid_key":
|
| 111 |
+
return `Nieprawidłowy klucz w ${issue.origin}`;
|
| 112 |
+
case "invalid_union":
|
| 113 |
+
return "Nieprawidłowe dane wejściowe";
|
| 114 |
+
case "invalid_element":
|
| 115 |
+
return `Nieprawidłowa wartość w ${issue.origin}`;
|
| 116 |
+
default:
|
| 117 |
+
return `Nieprawidłowe dane wejściowe`;
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 123 |
+
return {
|
| 124 |
+
localeError: error(),
|
| 125 |
+
};
|
| 126 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ps.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "بایټس", verb: "ولري" },
|
| 9 |
+
array: { unit: "توکي", verb: "ولري" },
|
| 10 |
+
set: { unit: "توکي", verb: "ولري" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "عدد";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "ارې";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "null";
|
| 30 |
+
}
|
| 31 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 32 |
+
return data.constructor.name;
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
return t;
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
const Nouns: {
|
| 40 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 41 |
+
} = {
|
| 42 |
+
regex: "ورودي",
|
| 43 |
+
email: "بریښنالیک",
|
| 44 |
+
url: "یو آر ال",
|
| 45 |
+
emoji: "ایموجي",
|
| 46 |
+
uuid: "UUID",
|
| 47 |
+
uuidv4: "UUIDv4",
|
| 48 |
+
uuidv6: "UUIDv6",
|
| 49 |
+
nanoid: "nanoid",
|
| 50 |
+
guid: "GUID",
|
| 51 |
+
cuid: "cuid",
|
| 52 |
+
cuid2: "cuid2",
|
| 53 |
+
ulid: "ULID",
|
| 54 |
+
xid: "XID",
|
| 55 |
+
ksuid: "KSUID",
|
| 56 |
+
datetime: "نیټه او وخت",
|
| 57 |
+
date: "نېټه",
|
| 58 |
+
time: "وخت",
|
| 59 |
+
duration: "موده",
|
| 60 |
+
ipv4: "د IPv4 پته",
|
| 61 |
+
ipv6: "د IPv6 پته",
|
| 62 |
+
cidrv4: "د IPv4 ساحه",
|
| 63 |
+
cidrv6: "د IPv6 ساحه",
|
| 64 |
+
base64: "base64-encoded متن",
|
| 65 |
+
base64url: "base64url-encoded متن",
|
| 66 |
+
json_string: "JSON متن",
|
| 67 |
+
e164: "د E.164 شمېره",
|
| 68 |
+
jwt: "JWT",
|
| 69 |
+
template_literal: "ورودي",
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
return (issue) => {
|
| 73 |
+
switch (issue.code) {
|
| 74 |
+
case "invalid_type":
|
| 75 |
+
return `ناسم ورودي: باید ${issue.expected} وای, مګر ${parsedType(issue.input)} ترلاسه شو`;
|
| 76 |
+
case "invalid_value":
|
| 77 |
+
if (issue.values.length === 1) {
|
| 78 |
+
return `ناسم ورودي: باید ${util.stringifyPrimitive(issue.values[0])} وای`;
|
| 79 |
+
}
|
| 80 |
+
return `ناسم انتخاب: باید یو له ${util.joinValues(issue.values, "|")} څخه وای`;
|
| 81 |
+
case "too_big": {
|
| 82 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 83 |
+
const sizing = getSizing(issue.origin);
|
| 84 |
+
if (sizing) {
|
| 85 |
+
return `ډیر لوی: ${issue.origin ?? "ارزښت"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصرونه"} ولري`;
|
| 86 |
+
}
|
| 87 |
+
return `ډیر لوی: ${issue.origin ?? "ارزښت"} باید ${adj}${issue.maximum.toString()} وي`;
|
| 88 |
+
}
|
| 89 |
+
case "too_small": {
|
| 90 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 91 |
+
const sizing = getSizing(issue.origin);
|
| 92 |
+
if (sizing) {
|
| 93 |
+
return `ډیر کوچنی: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} ولري`;
|
| 94 |
+
}
|
| 95 |
+
return `ډیر کوچنی: ${issue.origin} باید ${adj}${issue.minimum.toString()} وي`;
|
| 96 |
+
}
|
| 97 |
+
case "invalid_format": {
|
| 98 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 99 |
+
if (_issue.format === "starts_with") {
|
| 100 |
+
return `ناسم متن: باید د "${_issue.prefix}" سره پیل شي`;
|
| 101 |
+
}
|
| 102 |
+
if (_issue.format === "ends_with") {
|
| 103 |
+
return `ناسم متن: باید د "${_issue.suffix}" سره پای ته ورسيږي`;
|
| 104 |
+
}
|
| 105 |
+
if (_issue.format === "includes") {
|
| 106 |
+
return `ناسم متن: باید "${_issue.includes}" ولري`;
|
| 107 |
+
}
|
| 108 |
+
if (_issue.format === "regex") {
|
| 109 |
+
return `ناسم متن: باید د ${_issue.pattern} سره مطابقت ولري`;
|
| 110 |
+
}
|
| 111 |
+
return `${Nouns[_issue.format] ?? issue.format} ناسم دی`;
|
| 112 |
+
}
|
| 113 |
+
case "not_multiple_of":
|
| 114 |
+
return `ناسم عدد: باید د ${issue.divisor} مضرب وي`;
|
| 115 |
+
case "unrecognized_keys":
|
| 116 |
+
return `ناسم ${issue.keys.length > 1 ? "کلیډونه" : "کلیډ"}: ${util.joinValues(issue.keys, ", ")}`;
|
| 117 |
+
case "invalid_key":
|
| 118 |
+
return `ناسم کلیډ په ${issue.origin} کې`;
|
| 119 |
+
case "invalid_union":
|
| 120 |
+
return `ناسمه ورودي`;
|
| 121 |
+
case "invalid_element":
|
| 122 |
+
return `ناسم عنصر په ${issue.origin} کې`;
|
| 123 |
+
default:
|
| 124 |
+
return `ناسمه ورودي`;
|
| 125 |
+
}
|
| 126 |
+
};
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 130 |
+
return {
|
| 131 |
+
localeError: error(),
|
| 132 |
+
};
|
| 133 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/pt.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: "caracteres", verb: "ter" },
|
| 8 |
+
file: { unit: "bytes", verb: "ter" },
|
| 9 |
+
array: { unit: "itens", verb: "ter" },
|
| 10 |
+
set: { unit: "itens", verb: "ter" },
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
function getSizing(origin: string): { unit: string; verb: string } | null {
|
| 14 |
+
return Sizable[origin] ?? null;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
const parsedType = (data: any): string => {
|
| 18 |
+
const t = typeof data;
|
| 19 |
+
|
| 20 |
+
switch (t) {
|
| 21 |
+
case "number": {
|
| 22 |
+
return Number.isNaN(data) ? "NaN" : "número";
|
| 23 |
+
}
|
| 24 |
+
case "object": {
|
| 25 |
+
if (Array.isArray(data)) {
|
| 26 |
+
return "array";
|
| 27 |
+
}
|
| 28 |
+
if (data === null) {
|
| 29 |
+
return "nulo";
|
| 30 |
+
}
|
| 31 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 32 |
+
return data.constructor.name;
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
return t;
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
const Nouns: {
|
| 40 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 41 |
+
} = {
|
| 42 |
+
regex: "padrão",
|
| 43 |
+
email: "endereço de e-mail",
|
| 44 |
+
url: "URL",
|
| 45 |
+
emoji: "emoji",
|
| 46 |
+
uuid: "UUID",
|
| 47 |
+
uuidv4: "UUIDv4",
|
| 48 |
+
uuidv6: "UUIDv6",
|
| 49 |
+
nanoid: "nanoid",
|
| 50 |
+
guid: "GUID",
|
| 51 |
+
cuid: "cuid",
|
| 52 |
+
cuid2: "cuid2",
|
| 53 |
+
ulid: "ULID",
|
| 54 |
+
xid: "XID",
|
| 55 |
+
ksuid: "KSUID",
|
| 56 |
+
datetime: "data e hora ISO",
|
| 57 |
+
date: "data ISO",
|
| 58 |
+
time: "hora ISO",
|
| 59 |
+
duration: "duração ISO",
|
| 60 |
+
ipv4: "endereço IPv4",
|
| 61 |
+
ipv6: "endereço IPv6",
|
| 62 |
+
cidrv4: "faixa de IPv4",
|
| 63 |
+
cidrv6: "faixa de IPv6",
|
| 64 |
+
base64: "texto codificado em base64",
|
| 65 |
+
base64url: "URL codificada em base64",
|
| 66 |
+
json_string: "texto JSON",
|
| 67 |
+
e164: "número E.164",
|
| 68 |
+
jwt: "JWT",
|
| 69 |
+
template_literal: "entrada",
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
return (issue) => {
|
| 73 |
+
switch (issue.code) {
|
| 74 |
+
case "invalid_type":
|
| 75 |
+
return `Tipo inválido: esperado ${issue.expected}, recebido ${parsedType(issue.input)}`;
|
| 76 |
+
case "invalid_value":
|
| 77 |
+
if (issue.values.length === 1) return `Entrada inválida: esperado ${util.stringifyPrimitive(issue.values[0])}`;
|
| 78 |
+
return `Opção inválida: esperada uma das ${util.joinValues(issue.values, "|")}`;
|
| 79 |
+
case "too_big": {
|
| 80 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 81 |
+
const sizing = getSizing(issue.origin);
|
| 82 |
+
if (sizing)
|
| 83 |
+
return `Muito grande: esperado que ${issue.origin ?? "valor"} tivesse ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
|
| 84 |
+
return `Muito grande: esperado que ${issue.origin ?? "valor"} fosse ${adj}${issue.maximum.toString()}`;
|
| 85 |
+
}
|
| 86 |
+
case "too_small": {
|
| 87 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 88 |
+
const sizing = getSizing(issue.origin);
|
| 89 |
+
if (sizing) {
|
| 90 |
+
return `Muito pequeno: esperado que ${issue.origin} tivesse ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
return `Muito pequeno: esperado que ${issue.origin} fosse ${adj}${issue.minimum.toString()}`;
|
| 94 |
+
}
|
| 95 |
+
case "invalid_format": {
|
| 96 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 97 |
+
if (_issue.format === "starts_with") return `Texto inválido: deve começar com "${_issue.prefix}"`;
|
| 98 |
+
if (_issue.format === "ends_with") return `Texto inválido: deve terminar com "${_issue.suffix}"`;
|
| 99 |
+
if (_issue.format === "includes") return `Texto inválido: deve incluir "${_issue.includes}"`;
|
| 100 |
+
if (_issue.format === "regex") return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`;
|
| 101 |
+
return `${Nouns[_issue.format] ?? issue.format} inválido`;
|
| 102 |
+
}
|
| 103 |
+
case "not_multiple_of":
|
| 104 |
+
return `Número inválido: deve ser múltiplo de ${issue.divisor}`;
|
| 105 |
+
case "unrecognized_keys":
|
| 106 |
+
return `Chave${issue.keys.length > 1 ? "s" : ""} desconhecida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 107 |
+
case "invalid_key":
|
| 108 |
+
return `Chave inválida em ${issue.origin}`;
|
| 109 |
+
case "invalid_union":
|
| 110 |
+
return "Entrada inválida";
|
| 111 |
+
case "invalid_element":
|
| 112 |
+
return `Valor inválido em ${issue.origin}`;
|
| 113 |
+
default:
|
| 114 |
+
return `Campo inválido`;
|
| 115 |
+
}
|
| 116 |
+
};
|
| 117 |
+
};
|
| 118 |
+
|
| 119 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 120 |
+
return {
|
| 121 |
+
localeError: error(),
|
| 122 |
+
};
|
| 123 |
+
}
|
node_modules/@jimp/plugin-circle/node_modules/zod/src/v4/locales/ru.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
function getRussianPlural(count: number, one: string, few: string, many: string): string {
|
| 6 |
+
const absCount = Math.abs(count);
|
| 7 |
+
const lastDigit = absCount % 10;
|
| 8 |
+
const lastTwoDigits = absCount % 100;
|
| 9 |
+
|
| 10 |
+
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
| 11 |
+
return many;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if (lastDigit === 1) {
|
| 15 |
+
return one;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
if (lastDigit >= 2 && lastDigit <= 4) {
|
| 19 |
+
return few;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
return many;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
interface RussianSizable {
|
| 26 |
+
unit: {
|
| 27 |
+
one: string;
|
| 28 |
+
few: string;
|
| 29 |
+
many: string;
|
| 30 |
+
};
|
| 31 |
+
verb: string;
|
| 32 |
+
}
|
| 33 |
+
const error: () => errors.$ZodErrorMap = () => {
|
| 34 |
+
const Sizable: Record<string, RussianSizable> = {
|
| 35 |
+
string: {
|
| 36 |
+
unit: {
|
| 37 |
+
one: "символ",
|
| 38 |
+
few: "символа",
|
| 39 |
+
many: "символов",
|
| 40 |
+
},
|
| 41 |
+
verb: "иметь",
|
| 42 |
+
},
|
| 43 |
+
file: {
|
| 44 |
+
unit: {
|
| 45 |
+
one: "байт",
|
| 46 |
+
few: "байта",
|
| 47 |
+
many: "байт",
|
| 48 |
+
},
|
| 49 |
+
verb: "иметь",
|
| 50 |
+
},
|
| 51 |
+
array: {
|
| 52 |
+
unit: {
|
| 53 |
+
one: "элемент",
|
| 54 |
+
few: "элемента",
|
| 55 |
+
many: "элементов",
|
| 56 |
+
},
|
| 57 |
+
verb: "иметь",
|
| 58 |
+
},
|
| 59 |
+
set: {
|
| 60 |
+
unit: {
|
| 61 |
+
one: "элемент",
|
| 62 |
+
few: "элемента",
|
| 63 |
+
many: "элементов",
|
| 64 |
+
},
|
| 65 |
+
verb: "иметь",
|
| 66 |
+
},
|
| 67 |
+
};
|
| 68 |
+
|
| 69 |
+
function getSizing(origin: string): RussianSizable | null {
|
| 70 |
+
return Sizable[origin] ?? null;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
const parsedType = (data: any): string => {
|
| 74 |
+
const t = typeof data;
|
| 75 |
+
|
| 76 |
+
switch (t) {
|
| 77 |
+
case "number": {
|
| 78 |
+
return Number.isNaN(data) ? "NaN" : "число";
|
| 79 |
+
}
|
| 80 |
+
case "object": {
|
| 81 |
+
if (Array.isArray(data)) {
|
| 82 |
+
return "массив";
|
| 83 |
+
}
|
| 84 |
+
if (data === null) {
|
| 85 |
+
return "null";
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
| 89 |
+
return data.constructor.name;
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
return t;
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
const Nouns: {
|
| 97 |
+
[k in $ZodStringFormats | (string & {})]?: string;
|
| 98 |
+
} = {
|
| 99 |
+
regex: "ввод",
|
| 100 |
+
email: "email адрес",
|
| 101 |
+
url: "URL",
|
| 102 |
+
emoji: "эмодзи",
|
| 103 |
+
uuid: "UUID",
|
| 104 |
+
uuidv4: "UUIDv4",
|
| 105 |
+
uuidv6: "UUIDv6",
|
| 106 |
+
nanoid: "nanoid",
|
| 107 |
+
guid: "GUID",
|
| 108 |
+
cuid: "cuid",
|
| 109 |
+
cuid2: "cuid2",
|
| 110 |
+
ulid: "ULID",
|
| 111 |
+
xid: "XID",
|
| 112 |
+
ksuid: "KSUID",
|
| 113 |
+
datetime: "ISO дата и время",
|
| 114 |
+
date: "ISO дата",
|
| 115 |
+
time: "ISO время",
|
| 116 |
+
duration: "ISO длительность",
|
| 117 |
+
ipv4: "IPv4 адрес",
|
| 118 |
+
ipv6: "IPv6 адрес",
|
| 119 |
+
cidrv4: "IPv4 диапазон",
|
| 120 |
+
cidrv6: "IPv6 диапазон",
|
| 121 |
+
base64: "строка в формате base64",
|
| 122 |
+
base64url: "строка в формате base64url",
|
| 123 |
+
json_string: "JSON строка",
|
| 124 |
+
e164: "номер E.164",
|
| 125 |
+
jwt: "JWT",
|
| 126 |
+
template_literal: "ввод",
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
return (issue) => {
|
| 130 |
+
switch (issue.code) {
|
| 131 |
+
case "invalid_type":
|
| 132 |
+
return `Неверный ввод: ожидалось ${issue.expected}, получено ${parsedType(issue.input)}`;
|
| 133 |
+
case "invalid_value":
|
| 134 |
+
if (issue.values.length === 1) return `Неверный ввод: ожидалось ${util.stringifyPrimitive(issue.values[0])}`;
|
| 135 |
+
return `Неверный вариант: ожидалось одно из ${util.joinValues(issue.values, "|")}`;
|
| 136 |
+
case "too_big": {
|
| 137 |
+
const adj = issue.inclusive ? "<=" : "<";
|
| 138 |
+
const sizing = getSizing(issue.origin);
|
| 139 |
+
if (sizing) {
|
| 140 |
+
const maxValue = Number(issue.maximum);
|
| 141 |
+
const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
| 142 |
+
return `Слишком большое значение: ожидалось, что ${issue.origin ?? "значение"} будет иметь ${adj}${issue.maximum.toString()} ${unit}`;
|
| 143 |
+
}
|
| 144 |
+
return `Слишком большое значение: ожидалось, что ${issue.origin ?? "значение"} будет ${adj}${issue.maximum.toString()}`;
|
| 145 |
+
}
|
| 146 |
+
case "too_small": {
|
| 147 |
+
const adj = issue.inclusive ? ">=" : ">";
|
| 148 |
+
const sizing = getSizing(issue.origin);
|
| 149 |
+
if (sizing) {
|
| 150 |
+
const minValue = Number(issue.minimum);
|
| 151 |
+
const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
| 152 |
+
return `Слишком маленькое значение: ожидалось, что ${issue.origin} будет иметь ${adj}${issue.minimum.toString()} ${unit}`;
|
| 153 |
+
}
|
| 154 |
+
return `Слишком маленькое значение: ожидалось, что ${issue.origin} будет ${adj}${issue.minimum.toString()}`;
|
| 155 |
+
}
|
| 156 |
+
case "invalid_format": {
|
| 157 |
+
const _issue = issue as errors.$ZodStringFormatIssues;
|
| 158 |
+
if (_issue.format === "starts_with") return `Неверная строка: должна начинаться с "${_issue.prefix}"`;
|
| 159 |
+
if (_issue.format === "ends_with") return `Неверная строка: должна заканчиваться на "${_issue.suffix}"`;
|
| 160 |
+
if (_issue.format === "includes") return `Неверная строка: должна содержать "${_issue.includes}"`;
|
| 161 |
+
if (_issue.format === "regex") return `Неверная строка: должна соответствовать шаблону ${_issue.pattern}`;
|
| 162 |
+
return `Неверный ${Nouns[_issue.format] ?? issue.format}`;
|
| 163 |
+
}
|
| 164 |
+
case "not_multiple_of":
|
| 165 |
+
return `Неверное число: должно быть кратным ${issue.divisor}`;
|
| 166 |
+
case "unrecognized_keys":
|
| 167 |
+
return `Нераспознанн${issue.keys.length > 1 ? "ые" : "ый"} ключ${issue.keys.length > 1 ? "и" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
| 168 |
+
case "invalid_key":
|
| 169 |
+
return `Неверный ключ в ${issue.origin}`;
|
| 170 |
+
case "invalid_union":
|
| 171 |
+
return "Неверные входные данные";
|
| 172 |
+
case "invalid_element":
|
| 173 |
+
return `Неверное значение в ${issue.origin}`;
|
| 174 |
+
default:
|
| 175 |
+
return `Неверные входные данные`;
|
| 176 |
+
}
|
| 177 |
+
};
|
| 178 |
+
};
|
| 179 |
+
|
| 180 |
+
export default function (): { localeError: errors.$ZodErrorMap } {
|
| 181 |
+
return {
|
| 182 |
+
localeError: error(),
|
| 183 |
+
};
|
| 184 |
+
}
|