golar 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/builtin-rules.d.ts +2 -3
  2. package/dist/builtin-rules.generated.d.ts +3 -3
  3. package/dist/internal/linter/rule-creator.d.ts +3 -2
  4. package/dist/internal/linter/rule-creator.js +10 -10
  5. package/dist/internal/linter/rules/explicit-anys/config.js +3 -3
  6. package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.d.ts +1430 -0
  7. package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js +658 -0
  8. package/dist/packages/golar/package.js +1 -1
  9. package/dist/workspace.js +2 -2
  10. package/package.json +9 -9
  11. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.d.ts +0 -22
  12. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js +0 -29
  13. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js +0 -37
  14. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.d.ts +0 -16
  15. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js +0 -19
  16. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.d.ts +0 -208
  17. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js +0 -578
  18. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.d.ts +0 -32
  19. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js +0 -470
  20. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts +0 -64
  21. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js +0 -225
  22. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts +0 -47
  23. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +0 -61
  24. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js +0 -33
  25. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts +0 -127
  26. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +0 -62
  27. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js +0 -214
  28. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts +0 -69
  29. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +0 -109
  30. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js +0 -58
  31. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts +0 -31
  32. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js +0 -49
  33. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts +0 -805
  34. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js +0 -1096
  35. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts +0 -120
  36. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts +0 -96
  37. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js +0 -289
  38. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts +0 -41
  39. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +0 -304
  40. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts +0 -8
  41. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js +0 -9
@@ -1,225 +0,0 @@
1
- import { $constructor } from "./core.js";
2
- import { escapeRegex, getLengthableOrigin, nullish } from "./util.js";
3
- import { lowercase, uppercase } from "./regexes.js";
4
-
5
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
6
- const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
7
- var _a;
8
- inst._zod ?? (inst._zod = {});
9
- inst._zod.def = def;
10
- (_a = inst._zod).onattach ?? (_a.onattach = []);
11
- });
12
- const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
13
- var _a;
14
- $ZodCheck.init(inst, def);
15
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
16
- const val = payload.value;
17
- return !nullish(val) && val.length !== void 0;
18
- });
19
- inst._zod.onattach.push((inst) => {
20
- const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
21
- if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
22
- });
23
- inst._zod.check = (payload) => {
24
- const input = payload.value;
25
- if (input.length <= def.maximum) return;
26
- const origin = getLengthableOrigin(input);
27
- payload.issues.push({
28
- origin,
29
- code: "too_big",
30
- maximum: def.maximum,
31
- inclusive: true,
32
- input,
33
- inst,
34
- continue: !def.abort
35
- });
36
- };
37
- });
38
- const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
39
- var _a;
40
- $ZodCheck.init(inst, def);
41
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
42
- const val = payload.value;
43
- return !nullish(val) && val.length !== void 0;
44
- });
45
- inst._zod.onattach.push((inst) => {
46
- const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
47
- if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
48
- });
49
- inst._zod.check = (payload) => {
50
- const input = payload.value;
51
- if (input.length >= def.minimum) return;
52
- const origin = getLengthableOrigin(input);
53
- payload.issues.push({
54
- origin,
55
- code: "too_small",
56
- minimum: def.minimum,
57
- inclusive: true,
58
- input,
59
- inst,
60
- continue: !def.abort
61
- });
62
- };
63
- });
64
- const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
65
- var _a;
66
- $ZodCheck.init(inst, def);
67
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
68
- const val = payload.value;
69
- return !nullish(val) && val.length !== void 0;
70
- });
71
- inst._zod.onattach.push((inst) => {
72
- const bag = inst._zod.bag;
73
- bag.minimum = def.length;
74
- bag.maximum = def.length;
75
- bag.length = def.length;
76
- });
77
- inst._zod.check = (payload) => {
78
- const input = payload.value;
79
- const length = input.length;
80
- if (length === def.length) return;
81
- const origin = getLengthableOrigin(input);
82
- const tooBig = length > def.length;
83
- payload.issues.push({
84
- origin,
85
- ...tooBig ? {
86
- code: "too_big",
87
- maximum: def.length
88
- } : {
89
- code: "too_small",
90
- minimum: def.length
91
- },
92
- inclusive: true,
93
- exact: true,
94
- input: payload.value,
95
- inst,
96
- continue: !def.abort
97
- });
98
- };
99
- });
100
- const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
101
- var _a, _b;
102
- $ZodCheck.init(inst, def);
103
- inst._zod.onattach.push((inst) => {
104
- const bag = inst._zod.bag;
105
- bag.format = def.format;
106
- if (def.pattern) {
107
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
108
- bag.patterns.add(def.pattern);
109
- }
110
- });
111
- if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
112
- def.pattern.lastIndex = 0;
113
- if (def.pattern.test(payload.value)) return;
114
- payload.issues.push({
115
- origin: "string",
116
- code: "invalid_format",
117
- format: def.format,
118
- input: payload.value,
119
- ...def.pattern ? { pattern: def.pattern.toString() } : {},
120
- inst,
121
- continue: !def.abort
122
- });
123
- });
124
- else (_b = inst._zod).check ?? (_b.check = () => {});
125
- });
126
- const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
127
- $ZodCheckStringFormat.init(inst, def);
128
- inst._zod.check = (payload) => {
129
- def.pattern.lastIndex = 0;
130
- if (def.pattern.test(payload.value)) return;
131
- payload.issues.push({
132
- origin: "string",
133
- code: "invalid_format",
134
- format: "regex",
135
- input: payload.value,
136
- pattern: def.pattern.toString(),
137
- inst,
138
- continue: !def.abort
139
- });
140
- };
141
- });
142
- const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
143
- def.pattern ?? (def.pattern = lowercase);
144
- $ZodCheckStringFormat.init(inst, def);
145
- });
146
- const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
147
- def.pattern ?? (def.pattern = uppercase);
148
- $ZodCheckStringFormat.init(inst, def);
149
- });
150
- const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
151
- $ZodCheck.init(inst, def);
152
- const escapedRegex = escapeRegex(def.includes);
153
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
154
- def.pattern = pattern;
155
- inst._zod.onattach.push((inst) => {
156
- const bag = inst._zod.bag;
157
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
158
- bag.patterns.add(pattern);
159
- });
160
- inst._zod.check = (payload) => {
161
- if (payload.value.includes(def.includes, def.position)) return;
162
- payload.issues.push({
163
- origin: "string",
164
- code: "invalid_format",
165
- format: "includes",
166
- includes: def.includes,
167
- input: payload.value,
168
- inst,
169
- continue: !def.abort
170
- });
171
- };
172
- });
173
- const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
174
- $ZodCheck.init(inst, def);
175
- const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
176
- def.pattern ?? (def.pattern = pattern);
177
- inst._zod.onattach.push((inst) => {
178
- const bag = inst._zod.bag;
179
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
180
- bag.patterns.add(pattern);
181
- });
182
- inst._zod.check = (payload) => {
183
- if (payload.value.startsWith(def.prefix)) return;
184
- payload.issues.push({
185
- origin: "string",
186
- code: "invalid_format",
187
- format: "starts_with",
188
- prefix: def.prefix,
189
- input: payload.value,
190
- inst,
191
- continue: !def.abort
192
- });
193
- };
194
- });
195
- const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
196
- $ZodCheck.init(inst, def);
197
- const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
198
- def.pattern ?? (def.pattern = pattern);
199
- inst._zod.onattach.push((inst) => {
200
- const bag = inst._zod.bag;
201
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
202
- bag.patterns.add(pattern);
203
- });
204
- inst._zod.check = (payload) => {
205
- if (payload.value.endsWith(def.suffix)) return;
206
- payload.issues.push({
207
- origin: "string",
208
- code: "invalid_format",
209
- format: "ends_with",
210
- suffix: def.suffix,
211
- input: payload.value,
212
- inst,
213
- continue: !def.abort
214
- });
215
- };
216
- });
217
- const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
218
- $ZodCheck.init(inst, def);
219
- inst._zod.check = (payload) => {
220
- payload.value = def.tx(payload.value);
221
- };
222
- });
223
-
224
- //#endregion
225
- export { $ZodCheck, $ZodCheckEndsWith, $ZodCheckIncludes, $ZodCheckLengthEquals, $ZodCheckLowerCase, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckOverwrite, $ZodCheckRegex, $ZodCheckStartsWith, $ZodCheckStringFormat, $ZodCheckUpperCase };
@@ -1,47 +0,0 @@
1
- import { Class } from "./util.js";
2
- import { SomeType } from "./schemas.js";
3
-
4
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.cts
5
- type ZodTrait = {
6
- _zod: {
7
- def: any;
8
- [k: string]: any;
9
- };
10
- };
11
- interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
12
- new (def: D): T;
13
- init(inst: T, def: D): asserts inst is T;
14
- }
15
- declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
16
- Parent?: typeof Class;
17
- }): $constructor<T, D>;
18
- declare const $brand: unique symbol;
19
- type $brand<T extends string | number | symbol = string | number | symbol> = {
20
- [$brand]: { [k in T]: true };
21
- };
22
- type $ZodBranded<T extends SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
23
- _zod: {
24
- input: input<T> & $brand<Brand>;
25
- output: output<T> & $brand<Brand>;
26
- };
27
- } : Dir extends "in" ? {
28
- _zod: {
29
- input: input<T> & $brand<Brand>;
30
- };
31
- } : {
32
- _zod: {
33
- output: output<T> & $brand<Brand>;
34
- };
35
- });
36
- type input<T> = T extends {
37
- _zod: {
38
- input: any;
39
- };
40
- } ? T["_zod"]["input"] : unknown;
41
- type output<T> = T extends {
42
- _zod: {
43
- output: any;
44
- };
45
- } ? T["_zod"]["output"] : unknown;
46
- //#endregion
47
- export { $ZodBranded, $constructor, input, output };
@@ -1,61 +0,0 @@
1
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
2
- /** A special constant with type `never` */
3
- const NEVER = Object.freeze({ status: "aborted" });
4
- function $constructor(name, initializer, params) {
5
- function init(inst, def) {
6
- if (!inst._zod) Object.defineProperty(inst, "_zod", {
7
- value: {
8
- def,
9
- constr: _,
10
- traits: /* @__PURE__ */ new Set()
11
- },
12
- enumerable: false
13
- });
14
- if (inst._zod.traits.has(name)) return;
15
- inst._zod.traits.add(name);
16
- initializer(inst, def);
17
- const proto = _.prototype;
18
- const keys = Object.keys(proto);
19
- for (let i = 0; i < keys.length; i++) {
20
- const k = keys[i];
21
- if (!(k in inst)) inst[k] = proto[k].bind(inst);
22
- }
23
- }
24
- const Parent = params?.Parent ?? Object;
25
- class Definition extends Parent {}
26
- Object.defineProperty(Definition, "name", { value: name });
27
- function _(def) {
28
- var _a;
29
- const inst = params?.Parent ? new Definition() : this;
30
- init(inst, def);
31
- (_a = inst._zod).deferred ?? (_a.deferred = []);
32
- for (const fn of inst._zod.deferred) fn();
33
- return inst;
34
- }
35
- Object.defineProperty(_, "init", { value: init });
36
- Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
37
- if (params?.Parent && inst instanceof params.Parent) return true;
38
- return inst?._zod?.traits?.has(name);
39
- } });
40
- Object.defineProperty(_, "name", { value: name });
41
- return _;
42
- }
43
- var $ZodAsyncError = class extends Error {
44
- constructor() {
45
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
46
- }
47
- };
48
- var $ZodEncodeError = class extends Error {
49
- constructor(name) {
50
- super(`Encountered unidirectional transform during encode: ${name}`);
51
- this.name = "ZodEncodeError";
52
- }
53
- };
54
- const globalConfig = {};
55
- function config(newConfig) {
56
- if (newConfig) Object.assign(globalConfig, newConfig);
57
- return globalConfig;
58
- }
59
-
60
- //#endregion
61
- export { $ZodAsyncError, $ZodEncodeError, $constructor, config, globalConfig };
@@ -1,33 +0,0 @@
1
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
2
- var Doc = class {
3
- constructor(args = []) {
4
- this.content = [];
5
- this.indent = 0;
6
- if (this) this.args = args;
7
- }
8
- indented(fn) {
9
- this.indent += 1;
10
- fn(this);
11
- this.indent -= 1;
12
- }
13
- write(arg) {
14
- if (typeof arg === "function") {
15
- arg(this, { execution: "sync" });
16
- arg(this, { execution: "async" });
17
- return;
18
- }
19
- const lines = arg.split("\n").filter((x) => x);
20
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
21
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
22
- for (const line of dedented) this.content.push(line);
23
- }
24
- compile() {
25
- const F = Function;
26
- const args = this?.args;
27
- const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
28
- return new F(...args, lines.join("\n"));
29
- }
30
- };
31
-
32
- //#endregion
33
- export { Doc };
@@ -1,127 +0,0 @@
1
- import { Flatten, MakePartial, Primitive } from "./util.js";
2
- import { $ZodType } from "./schemas.js";
3
- import { $ZodCheck, $ZodStringFormats } from "./checks.js";
4
- import { $constructor } from "./core.js";
5
-
6
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.cts
7
- interface $ZodIssueBase {
8
- readonly code?: string;
9
- readonly input?: unknown;
10
- readonly path: PropertyKey[];
11
- readonly message: string;
12
- }
13
- type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
14
- interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
15
- readonly code: "invalid_type";
16
- readonly expected: $ZodInvalidTypeExpected;
17
- readonly input?: Input;
18
- }
19
- interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
20
- readonly code: "too_big";
21
- readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
22
- readonly maximum: number | bigint;
23
- readonly inclusive?: boolean;
24
- readonly exact?: boolean;
25
- readonly input?: Input;
26
- }
27
- interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
28
- readonly code: "too_small";
29
- readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
30
- readonly minimum: number | bigint;
31
- /** True if the allowable range includes the minimum */
32
- readonly inclusive?: boolean;
33
- /** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
34
- readonly exact?: boolean;
35
- readonly input?: Input;
36
- }
37
- interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
38
- readonly code: "invalid_format";
39
- readonly format: $ZodStringFormats | (string & {});
40
- readonly pattern?: string;
41
- readonly input?: string;
42
- }
43
- interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
44
- readonly code: "not_multiple_of";
45
- readonly divisor: number;
46
- readonly input?: Input;
47
- }
48
- interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
49
- readonly code: "unrecognized_keys";
50
- readonly keys: string[];
51
- readonly input?: Record<string, unknown>;
52
- }
53
- interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
54
- readonly code: "invalid_union";
55
- readonly errors: $ZodIssue[][];
56
- readonly input?: unknown;
57
- readonly discriminator?: string | undefined;
58
- readonly inclusive?: true;
59
- }
60
- interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
61
- readonly code: "invalid_union";
62
- readonly errors: [];
63
- readonly input?: unknown;
64
- readonly discriminator?: string | undefined;
65
- readonly inclusive: false;
66
- }
67
- type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
68
- interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
69
- readonly code: "invalid_key";
70
- readonly origin: "map" | "record";
71
- readonly issues: $ZodIssue[];
72
- readonly input?: Input;
73
- }
74
- interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
75
- readonly code: "invalid_element";
76
- readonly origin: "map" | "set";
77
- readonly key: unknown;
78
- readonly issues: $ZodIssue[];
79
- readonly input?: Input;
80
- }
81
- interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
82
- readonly code: "invalid_value";
83
- readonly values: Primitive[];
84
- readonly input?: Input;
85
- }
86
- interface $ZodIssueCustom extends $ZodIssueBase {
87
- readonly code: "custom";
88
- readonly params?: Record<string, any> | undefined;
89
- readonly input?: unknown;
90
- }
91
- type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
92
- type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
93
- type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
94
- /** The input data */readonly input: unknown; /** The schema or check that originated this issue. */
95
- readonly inst?: $ZodType | $ZodCheck; /** If `true`, Zod will continue executing checks/refinements after this issue. */
96
- readonly continue?: boolean | undefined;
97
- } & Record<string, unknown>> : never;
98
- type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
99
- interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
100
- (issue: $ZodRawIssue<T>): {
101
- message: string;
102
- } | string | undefined | null;
103
- }
104
- interface $ZodError<T = unknown> extends Error {
105
- type: T;
106
- issues: $ZodIssue[];
107
- _zod: {
108
- output: T;
109
- def: $ZodIssue[];
110
- };
111
- stack?: string;
112
- name: string;
113
- }
114
- declare const $ZodError: $constructor<$ZodError>;
115
- type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
116
- type _FlattenedError<T, U = string> = {
117
- formErrors: U[];
118
- fieldErrors: { [P in keyof T]?: U[] };
119
- };
120
- type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? { [K in keyof T]?: $ZodFormattedError<T[K], U> } : T extends any[] ? {
121
- [k: number]: $ZodFormattedError<T[number], U>;
122
- } : T extends object ? Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U> }> : any;
123
- type $ZodFormattedError<T, U = string> = {
124
- _errors: U[];
125
- } & Flatten<_ZodFormattedError<T, U>>;
126
- //#endregion
127
- export { $ZodError, $ZodErrorMap, $ZodFlattenedError, $ZodFormattedError, $ZodIssue, $ZodIssueBase, $ZodIssueInvalidElement, $ZodIssueInvalidKey, $ZodIssueInvalidType, $ZodIssueInvalidUnion, $ZodIssueInvalidValue, $ZodIssueTooBig, $ZodIssueTooSmall, $ZodIssueUnrecognizedKeys, $ZodRawIssue };
@@ -1,62 +0,0 @@
1
- import { $constructor } from "./core.js";
2
- import { jsonStringifyReplacer } from "./util.js";
3
-
4
- //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
5
- const initializer = (inst, def) => {
6
- inst.name = "$ZodError";
7
- Object.defineProperty(inst, "_zod", {
8
- value: inst._zod,
9
- enumerable: false
10
- });
11
- Object.defineProperty(inst, "issues", {
12
- value: def,
13
- enumerable: false
14
- });
15
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
16
- Object.defineProperty(inst, "toString", {
17
- value: () => inst.message,
18
- enumerable: false
19
- });
20
- };
21
- const $ZodError = $constructor("$ZodError", initializer);
22
- const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
23
- function flattenError(error, mapper = (issue) => issue.message) {
24
- const fieldErrors = {};
25
- const formErrors = [];
26
- for (const sub of error.issues) if (sub.path.length > 0) {
27
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
28
- fieldErrors[sub.path[0]].push(mapper(sub));
29
- } else formErrors.push(mapper(sub));
30
- return {
31
- formErrors,
32
- fieldErrors
33
- };
34
- }
35
- function formatError(error, mapper = (issue) => issue.message) {
36
- const fieldErrors = { _errors: [] };
37
- const processError = (error) => {
38
- for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
39
- else if (issue.code === "invalid_key") processError({ issues: issue.issues });
40
- else if (issue.code === "invalid_element") processError({ issues: issue.issues });
41
- else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
42
- else {
43
- let curr = fieldErrors;
44
- let i = 0;
45
- while (i < issue.path.length) {
46
- const el = issue.path[i];
47
- if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
48
- else {
49
- curr[el] = curr[el] || { _errors: [] };
50
- curr[el]._errors.push(mapper(issue));
51
- }
52
- curr = curr[el];
53
- i++;
54
- }
55
- }
56
- };
57
- processError(error);
58
- return fieldErrors;
59
- }
60
-
61
- //#endregion
62
- export { $ZodError, $ZodRealError, flattenError, formatError };