@vielzeug/spell 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- package/dist/_dev.cjs +2 -0
- package/dist/_dev.cjs.map +1 -0
- package/dist/_dev.d.ts +2 -0
- package/dist/_dev.d.ts.map +1 -0
- package/dist/_dev.js +2 -0
- package/dist/_dev.js.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.ts +108 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/errors.cjs +3 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +53 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -0
- package/dist/formats.cjs +2 -0
- package/dist/formats.cjs.map +1 -0
- package/dist/formats.d.ts +41 -0
- package/dist/formats.d.ts.map +1 -0
- package/dist/formats.js +2 -0
- package/dist/formats.js.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/json-schema.cjs +2 -0
- package/dist/json-schema.cjs.map +1 -0
- package/dist/json-schema.d.ts +15 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +2 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/messages.cjs +2 -0
- package/dist/messages.cjs.map +1 -0
- package/dist/messages.d.ts +228 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +2 -0
- package/dist/messages.js.map +1 -0
- package/dist/s.cjs +2 -0
- package/dist/s.cjs.map +1 -0
- package/dist/s.d.ts +65 -0
- package/dist/s.d.ts.map +1 -0
- package/dist/s.js +2 -0
- package/dist/s.js.map +1 -0
- package/dist/safe-object.cjs +2 -0
- package/dist/safe-object.cjs.map +1 -0
- package/dist/safe-object.d.ts +6 -0
- package/dist/safe-object.d.ts.map +1 -0
- package/dist/safe-object.js +2 -0
- package/dist/safe-object.js.map +1 -0
- package/dist/schemas/array.cjs +2 -0
- package/dist/schemas/array.cjs.map +1 -0
- package/dist/schemas/array.d.ts +49 -0
- package/dist/schemas/array.d.ts.map +1 -0
- package/dist/schemas/array.js +2 -0
- package/dist/schemas/array.js.map +1 -0
- package/dist/schemas/bigint.cjs +2 -0
- package/dist/schemas/bigint.cjs.map +1 -0
- package/dist/schemas/bigint.d.ts +42 -0
- package/dist/schemas/bigint.d.ts.map +1 -0
- package/dist/schemas/bigint.js +2 -0
- package/dist/schemas/bigint.js.map +1 -0
- package/dist/schemas/boolean.cjs +2 -0
- package/dist/schemas/boolean.cjs.map +1 -0
- package/dist/schemas/boolean.d.ts +18 -0
- package/dist/schemas/boolean.d.ts.map +1 -0
- package/dist/schemas/boolean.js +2 -0
- package/dist/schemas/boolean.js.map +1 -0
- package/dist/schemas/date.cjs +2 -0
- package/dist/schemas/date.cjs.map +1 -0
- package/dist/schemas/date.d.ts +25 -0
- package/dist/schemas/date.d.ts.map +1 -0
- package/dist/schemas/date.js +2 -0
- package/dist/schemas/date.js.map +1 -0
- package/dist/schemas/enum.cjs +2 -0
- package/dist/schemas/enum.cjs.map +1 -0
- package/dist/schemas/enum.d.ts +14 -0
- package/dist/schemas/enum.d.ts.map +1 -0
- package/dist/schemas/enum.js +2 -0
- package/dist/schemas/enum.js.map +1 -0
- package/dist/schemas/instanceof.cjs +2 -0
- package/dist/schemas/instanceof.cjs.map +1 -0
- package/dist/schemas/instanceof.d.ts +11 -0
- package/dist/schemas/instanceof.d.ts.map +1 -0
- package/dist/schemas/instanceof.js +2 -0
- package/dist/schemas/instanceof.js.map +1 -0
- package/dist/schemas/intersect.cjs +2 -0
- package/dist/schemas/intersect.cjs.map +1 -0
- package/dist/schemas/intersect.d.ts +16 -0
- package/dist/schemas/intersect.d.ts.map +1 -0
- package/dist/schemas/intersect.js +2 -0
- package/dist/schemas/intersect.js.map +1 -0
- package/dist/schemas/lazy.cjs +2 -0
- package/dist/schemas/lazy.cjs.map +1 -0
- package/dist/schemas/lazy.d.ts +16 -0
- package/dist/schemas/lazy.d.ts.map +1 -0
- package/dist/schemas/lazy.js +2 -0
- package/dist/schemas/lazy.js.map +1 -0
- package/dist/schemas/literal.cjs +2 -0
- package/dist/schemas/literal.cjs.map +1 -0
- package/dist/schemas/literal.d.ts +11 -0
- package/dist/schemas/literal.d.ts.map +1 -0
- package/dist/schemas/literal.js +2 -0
- package/dist/schemas/literal.js.map +1 -0
- package/dist/schemas/map.cjs +2 -0
- package/dist/schemas/map.cjs.map +1 -0
- package/dist/schemas/map.d.ts +29 -0
- package/dist/schemas/map.d.ts.map +1 -0
- package/dist/schemas/map.js +2 -0
- package/dist/schemas/map.js.map +1 -0
- package/dist/schemas/never.cjs +2 -0
- package/dist/schemas/never.cjs.map +1 -0
- package/dist/schemas/never.d.ts +10 -0
- package/dist/schemas/never.d.ts.map +1 -0
- package/dist/schemas/never.js +2 -0
- package/dist/schemas/never.js.map +1 -0
- package/dist/schemas/number.cjs +2 -0
- package/dist/schemas/number.cjs.map +1 -0
- package/dist/schemas/number.d.ts +50 -0
- package/dist/schemas/number.d.ts.map +1 -0
- package/dist/schemas/number.js +2 -0
- package/dist/schemas/number.js.map +1 -0
- package/dist/schemas/object.cjs +2 -0
- package/dist/schemas/object.cjs.map +1 -0
- package/dist/schemas/object.d.ts +95 -0
- package/dist/schemas/object.d.ts.map +1 -0
- package/dist/schemas/object.js +2 -0
- package/dist/schemas/object.js.map +1 -0
- package/dist/schemas/pipe.d.ts +2 -0
- package/dist/schemas/pipe.d.ts.map +1 -0
- package/dist/schemas/raw-or.cjs +2 -0
- package/dist/schemas/raw-or.cjs.map +1 -0
- package/dist/schemas/raw-or.d.ts +17 -0
- package/dist/schemas/raw-or.d.ts.map +1 -0
- package/dist/schemas/raw-or.js +2 -0
- package/dist/schemas/raw-or.js.map +1 -0
- package/dist/schemas/record.cjs +2 -0
- package/dist/schemas/record.cjs.map +1 -0
- package/dist/schemas/record.d.ts +16 -0
- package/dist/schemas/record.d.ts.map +1 -0
- package/dist/schemas/record.js +2 -0
- package/dist/schemas/record.js.map +1 -0
- package/dist/schemas/set.cjs +2 -0
- package/dist/schemas/set.cjs.map +1 -0
- package/dist/schemas/set.d.ts +28 -0
- package/dist/schemas/set.d.ts.map +1 -0
- package/dist/schemas/set.js +2 -0
- package/dist/schemas/set.js.map +1 -0
- package/dist/schemas/string.cjs +2 -0
- package/dist/schemas/string.cjs.map +1 -0
- package/dist/schemas/string.d.ts +155 -0
- package/dist/schemas/string.d.ts.map +1 -0
- package/dist/schemas/string.js +2 -0
- package/dist/schemas/string.js.map +1 -0
- package/dist/schemas/tuple.cjs +2 -0
- package/dist/schemas/tuple.cjs.map +1 -0
- package/dist/schemas/tuple.d.ts +22 -0
- package/dist/schemas/tuple.d.ts.map +1 -0
- package/dist/schemas/tuple.js +2 -0
- package/dist/schemas/tuple.js.map +1 -0
- package/dist/schemas/union.cjs +2 -0
- package/dist/schemas/union.cjs.map +1 -0
- package/dist/schemas/union.d.ts +13 -0
- package/dist/schemas/union.d.ts.map +1 -0
- package/dist/schemas/union.js +2 -0
- package/dist/schemas/union.js.map +1 -0
- package/dist/schemas/variant.cjs +2 -0
- package/dist/schemas/variant.cjs.map +1 -0
- package/dist/schemas/variant.d.ts +26 -0
- package/dist/schemas/variant.d.ts.map +1 -0
- package/dist/schemas/variant.js +2 -0
- package/dist/schemas/variant.js.map +1 -0
- package/dist/spell.cjs +3 -0
- package/dist/spell.cjs.map +1 -0
- package/dist/spell.iife.js +3 -0
- package/dist/spell.iife.js.map +1 -0
- package/dist/spell.js +3 -0
- package/dist/spell.js.map +1 -0
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts +326 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validators.cjs +2 -0
- package/dist/validators.cjs.map +1 -0
- package/dist/validators.d.ts +20 -0
- package/dist/validators.d.ts.map +1 -0
- package/dist/validators.js +2 -0
- package/dist/validators.js.map +1 -0
- package/package.json +43 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
export declare const ErrorCode: {
|
|
2
|
+
readonly custom: "custom";
|
|
3
|
+
readonly invalid_base64: "invalid_base64";
|
|
4
|
+
readonly invalid_date: "invalid_date";
|
|
5
|
+
readonly invalid_duration: "invalid_duration";
|
|
6
|
+
readonly invalid_enum: "invalid_enum";
|
|
7
|
+
readonly invalid_finite: "invalid_finite";
|
|
8
|
+
readonly invalid_integer: "invalid_integer";
|
|
9
|
+
readonly invalid_keys: "invalid_keys";
|
|
10
|
+
readonly invalid_length: "invalid_length";
|
|
11
|
+
readonly invalid_literal: "invalid_literal";
|
|
12
|
+
readonly invalid_multiple_of: "invalid_multiple_of";
|
|
13
|
+
readonly invalid_safe: "invalid_safe";
|
|
14
|
+
readonly invalid_string: "invalid_string";
|
|
15
|
+
readonly invalid_type: "invalid_type";
|
|
16
|
+
readonly invalid_union: "invalid_union";
|
|
17
|
+
readonly invalid_unique: "invalid_unique";
|
|
18
|
+
readonly invalid_url: "invalid_url";
|
|
19
|
+
readonly invalid_variant: "invalid_variant";
|
|
20
|
+
readonly too_big: "too_big";
|
|
21
|
+
readonly too_small: "too_small";
|
|
22
|
+
};
|
|
23
|
+
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
24
|
+
/**
|
|
25
|
+
* A validation message — either a static string or a function that receives context and returns a string.
|
|
26
|
+
* **Note:** Static string values are used verbatim with no interpolation. Use the function form
|
|
27
|
+
* for context-dependent messages (e.g. `(ctx) => \`Must be at least ${ctx.min}\``).
|
|
28
|
+
*/
|
|
29
|
+
export type MessageFn<Ctx extends Record<string, unknown> = Record<string, unknown>> = string | ((ctx: Ctx) => string);
|
|
30
|
+
/** Plain JSON Schema object (targeting JSON Schema 2020-12). */
|
|
31
|
+
export type JsonSchema = Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* A typed discriminated union of all issues emitted by built-in validators.
|
|
34
|
+
*
|
|
35
|
+
* Narrowing on `code` gives precise access to `params`:
|
|
36
|
+
* ```ts
|
|
37
|
+
* if (error.code === 'too_small') {
|
|
38
|
+
* const min = error.params.min; // number | bigint | Date
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export type Issue = {
|
|
43
|
+
code: 'custom';
|
|
44
|
+
message: string;
|
|
45
|
+
params?: Record<string, unknown>;
|
|
46
|
+
path: (string | number)[];
|
|
47
|
+
} | {
|
|
48
|
+
code: 'invalid_base64';
|
|
49
|
+
message: string;
|
|
50
|
+
params: {
|
|
51
|
+
format: string;
|
|
52
|
+
};
|
|
53
|
+
path: (string | number)[];
|
|
54
|
+
} | {
|
|
55
|
+
code: 'invalid_date';
|
|
56
|
+
message: string;
|
|
57
|
+
params?: undefined;
|
|
58
|
+
path: (string | number)[];
|
|
59
|
+
} | {
|
|
60
|
+
code: 'invalid_duration';
|
|
61
|
+
message: string;
|
|
62
|
+
params: {
|
|
63
|
+
format: string;
|
|
64
|
+
};
|
|
65
|
+
path: (string | number)[];
|
|
66
|
+
} | {
|
|
67
|
+
code: 'invalid_enum';
|
|
68
|
+
message: string;
|
|
69
|
+
params: {
|
|
70
|
+
values: readonly unknown[];
|
|
71
|
+
};
|
|
72
|
+
path: (string | number)[];
|
|
73
|
+
} | {
|
|
74
|
+
code: 'invalid_finite';
|
|
75
|
+
message: string;
|
|
76
|
+
params?: undefined;
|
|
77
|
+
path: (string | number)[];
|
|
78
|
+
} | {
|
|
79
|
+
code: 'invalid_integer';
|
|
80
|
+
message: string;
|
|
81
|
+
params?: undefined;
|
|
82
|
+
path: (string | number)[];
|
|
83
|
+
} | {
|
|
84
|
+
code: 'invalid_keys';
|
|
85
|
+
message: string;
|
|
86
|
+
params: {
|
|
87
|
+
keys: string[];
|
|
88
|
+
};
|
|
89
|
+
path: (string | number)[];
|
|
90
|
+
} | {
|
|
91
|
+
code: 'invalid_length';
|
|
92
|
+
message: string;
|
|
93
|
+
params: {
|
|
94
|
+
exact: number;
|
|
95
|
+
};
|
|
96
|
+
path: (string | number)[];
|
|
97
|
+
} | {
|
|
98
|
+
code: 'invalid_literal';
|
|
99
|
+
message: string;
|
|
100
|
+
params: {
|
|
101
|
+
expected: unknown;
|
|
102
|
+
};
|
|
103
|
+
path: (string | number)[];
|
|
104
|
+
} | {
|
|
105
|
+
code: 'invalid_multiple_of';
|
|
106
|
+
message: string;
|
|
107
|
+
params: {
|
|
108
|
+
step: number | bigint;
|
|
109
|
+
};
|
|
110
|
+
path: (string | number)[];
|
|
111
|
+
} | {
|
|
112
|
+
code: 'invalid_safe';
|
|
113
|
+
message: string;
|
|
114
|
+
params?: undefined;
|
|
115
|
+
path: (string | number)[];
|
|
116
|
+
} | {
|
|
117
|
+
code: 'invalid_string';
|
|
118
|
+
message: string;
|
|
119
|
+
params: {
|
|
120
|
+
format?: string;
|
|
121
|
+
includes?: string;
|
|
122
|
+
pattern?: string;
|
|
123
|
+
prefix?: string;
|
|
124
|
+
suffix?: string;
|
|
125
|
+
};
|
|
126
|
+
path: (string | number)[];
|
|
127
|
+
} | {
|
|
128
|
+
code: 'invalid_type';
|
|
129
|
+
message: string;
|
|
130
|
+
params?: undefined;
|
|
131
|
+
path: (string | number)[];
|
|
132
|
+
} | {
|
|
133
|
+
code: 'invalid_union';
|
|
134
|
+
message: string;
|
|
135
|
+
params: {
|
|
136
|
+
errors: Issue[][];
|
|
137
|
+
};
|
|
138
|
+
path: (string | number)[];
|
|
139
|
+
} | {
|
|
140
|
+
code: 'invalid_unique';
|
|
141
|
+
message: string;
|
|
142
|
+
params: {
|
|
143
|
+
unique: true;
|
|
144
|
+
};
|
|
145
|
+
path: (string | number)[];
|
|
146
|
+
} | {
|
|
147
|
+
code: 'invalid_url';
|
|
148
|
+
message: string;
|
|
149
|
+
params: {
|
|
150
|
+
format: string;
|
|
151
|
+
};
|
|
152
|
+
path: (string | number)[];
|
|
153
|
+
} | {
|
|
154
|
+
code: 'invalid_variant';
|
|
155
|
+
message: string;
|
|
156
|
+
params: {
|
|
157
|
+
discriminator: string;
|
|
158
|
+
expected: string[];
|
|
159
|
+
};
|
|
160
|
+
path: (string | number)[];
|
|
161
|
+
} | {
|
|
162
|
+
code: 'too_big';
|
|
163
|
+
message: string;
|
|
164
|
+
params: {
|
|
165
|
+
exclusive?: boolean;
|
|
166
|
+
max: number | bigint | Date;
|
|
167
|
+
};
|
|
168
|
+
path: (string | number)[];
|
|
169
|
+
} | {
|
|
170
|
+
code: 'too_small';
|
|
171
|
+
message: string;
|
|
172
|
+
params: {
|
|
173
|
+
exclusive?: boolean;
|
|
174
|
+
min: number | bigint | Date;
|
|
175
|
+
};
|
|
176
|
+
path: (string | number)[];
|
|
177
|
+
} | {
|
|
178
|
+
code: string & {};
|
|
179
|
+
message: string;
|
|
180
|
+
params?: Record<string, unknown>;
|
|
181
|
+
path: (string | number)[];
|
|
182
|
+
};
|
|
183
|
+
/** ParseContext carries the active message set through the parse pipeline. */
|
|
184
|
+
export type ParseContext = {
|
|
185
|
+
messages: import('./messages').Messages;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Validator function. Receives the value after type-checking and the active ParseContext.
|
|
189
|
+
* Returns an Issue array on failure, null on success, or a Promise for async validators.
|
|
190
|
+
*/
|
|
191
|
+
export type ValidateFn = (value: unknown, ctx?: ParseContext) => Issue[] | null | Promise<Issue[] | null>;
|
|
192
|
+
export type CheckContext = {
|
|
193
|
+
addIssue: (issue: {
|
|
194
|
+
code: string;
|
|
195
|
+
message: string;
|
|
196
|
+
params?: Record<string, unknown>;
|
|
197
|
+
path?: (string | number)[];
|
|
198
|
+
}) => void;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Return type of a `validate()` callback.
|
|
202
|
+
* - `string` — validation failed; the string becomes the error message.
|
|
203
|
+
* - `false` — validation failed with no message (use `addIssue` for a message).
|
|
204
|
+
* - `true` / `null` / `void` — validation passed.
|
|
205
|
+
*
|
|
206
|
+
* The shorthand `condition || 'message'` works naturally:
|
|
207
|
+
* ```ts
|
|
208
|
+
* s.string().validate(v => v.length > 0 || 'Cannot be empty')
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export type ValidateResult = boolean | null | void | string;
|
|
212
|
+
/** Re-exported from errors for convenience — defined there. */
|
|
213
|
+
export type { FlatError, FlatErrorFirst, FormattedErrors } from './errors';
|
|
214
|
+
/**
|
|
215
|
+
* Visitor map for schema.walk(). Container handlers receive already-walked children (type R).
|
|
216
|
+
* All handlers are optional — unmatched kinds return `null` unless an `unknown` fallback is provided.
|
|
217
|
+
*
|
|
218
|
+
* Each handler receives the concrete schema type for that kind, enabling access to
|
|
219
|
+
* schema-specific properties (e.g. `ArraySchema.itemSchema`) without casting.
|
|
220
|
+
*/
|
|
221
|
+
export type SchemaWalker<R> = {
|
|
222
|
+
array?: (schema: import('./schemas/array').ArraySchema<any>, item: R | null) => R;
|
|
223
|
+
bigint?: (schema: import('./schemas/bigint').BigIntSchema<any>) => R;
|
|
224
|
+
boolean?: (schema: import('./schemas/boolean').BooleanSchema<any>) => R;
|
|
225
|
+
date?: (schema: import('./schemas/date').DateSchema<any>) => R;
|
|
226
|
+
enum?: (schema: import('./schemas/enum').EnumSchema<any>) => R;
|
|
227
|
+
instanceof?: (schema: import('./schemas/instanceof').InstanceOfSchema<any>) => R;
|
|
228
|
+
intersect?: (schema: import('./schemas/intersect').IntersectSchema<any>, branches: (R | null)[]) => R;
|
|
229
|
+
lazy?: (schema: import('./schemas/lazy').LazySchema<any>) => R;
|
|
230
|
+
literal?: (schema: import('./schemas/literal').LiteralSchema<any>) => R;
|
|
231
|
+
map?: (schema: import('./schemas/map').MapSchema<any, any>, key: R | null, value: R | null) => R;
|
|
232
|
+
never?: (schema: import('./schemas/never').NeverSchema) => R;
|
|
233
|
+
number?: (schema: import('./schemas/number').NumberSchema<any>) => R;
|
|
234
|
+
object?: (schema: import('./schemas/object').ObjectSchema<any>, fields: Record<string, R | null>) => R;
|
|
235
|
+
pipe?: (schema: import('./core').PipeSchema<any, any>, from: R | null, to: R | null) => R;
|
|
236
|
+
record?: (schema: import('./schemas/record').RecordSchema<any, any>, key: R | null, value: R | null) => R;
|
|
237
|
+
set?: (schema: import('./schemas/set').SetSchema<any>, item: R | null) => R;
|
|
238
|
+
string?: (schema: import('./schemas/string').StringSchema<any>) => R;
|
|
239
|
+
tuple?: (schema: import('./schemas/tuple').TupleSchema<any, any>, items: (R | null)[], rest: R | null) => R;
|
|
240
|
+
union?: (schema: import('./schemas/union').UnionSchema<any>, branches: (R | null)[]) => R;
|
|
241
|
+
unknown?: (schema: AnySchema) => R;
|
|
242
|
+
variant?: (schema: import('./schemas/variant').VariantSchema<any, any>, branches: Record<string, R | null>) => R;
|
|
243
|
+
};
|
|
244
|
+
type BaseDescriptor = {
|
|
245
|
+
description?: string;
|
|
246
|
+
isNullable?: boolean;
|
|
247
|
+
isOptional?: boolean;
|
|
248
|
+
};
|
|
249
|
+
export type SchemaDescriptor = BaseDescriptor & ({
|
|
250
|
+
kind: 'any' | 'unknown' | 'never' | 'boolean' | 'bigint' | 'date' | 'lazy';
|
|
251
|
+
} | {
|
|
252
|
+
className: string;
|
|
253
|
+
kind: 'instanceof';
|
|
254
|
+
} | {
|
|
255
|
+
contentEncoding?: string;
|
|
256
|
+
format?: string;
|
|
257
|
+
kind: 'string';
|
|
258
|
+
maxLength?: number;
|
|
259
|
+
minLength?: number;
|
|
260
|
+
pattern?: string | null;
|
|
261
|
+
} | {
|
|
262
|
+
exclusiveMaximum?: number;
|
|
263
|
+
exclusiveMinimum?: number;
|
|
264
|
+
kind: 'number';
|
|
265
|
+
maximum?: number;
|
|
266
|
+
minimum?: number;
|
|
267
|
+
multipleOf?: number;
|
|
268
|
+
typeHint?: 'integer';
|
|
269
|
+
} | {
|
|
270
|
+
kind: 'literal';
|
|
271
|
+
value: string | number | boolean | null | undefined;
|
|
272
|
+
} | {
|
|
273
|
+
kind: 'enum';
|
|
274
|
+
values: readonly (string | number)[];
|
|
275
|
+
} | {
|
|
276
|
+
items: SchemaDescriptor;
|
|
277
|
+
kind: 'array';
|
|
278
|
+
maxItems?: number;
|
|
279
|
+
minItems?: number;
|
|
280
|
+
} | {
|
|
281
|
+
items: SchemaDescriptor[];
|
|
282
|
+
kind: 'tuple';
|
|
283
|
+
rest: SchemaDescriptor | null;
|
|
284
|
+
} | {
|
|
285
|
+
fields: Record<string, SchemaDescriptor>;
|
|
286
|
+
kind: 'object';
|
|
287
|
+
strict: boolean;
|
|
288
|
+
} | {
|
|
289
|
+
key: SchemaDescriptor;
|
|
290
|
+
kind: 'record';
|
|
291
|
+
value: SchemaDescriptor;
|
|
292
|
+
} | {
|
|
293
|
+
items: SchemaDescriptor;
|
|
294
|
+
kind: 'set';
|
|
295
|
+
} | {
|
|
296
|
+
key: SchemaDescriptor;
|
|
297
|
+
kind: 'map';
|
|
298
|
+
value: SchemaDescriptor;
|
|
299
|
+
} | {
|
|
300
|
+
branches: SchemaDescriptor[];
|
|
301
|
+
kind: 'union' | 'intersect';
|
|
302
|
+
} | {
|
|
303
|
+
branches: Record<string, SchemaDescriptor>;
|
|
304
|
+
discriminator: string;
|
|
305
|
+
kind: 'variant';
|
|
306
|
+
} | {
|
|
307
|
+
from: SchemaDescriptor;
|
|
308
|
+
kind: 'pipe';
|
|
309
|
+
to: SchemaDescriptor;
|
|
310
|
+
});
|
|
311
|
+
import type { Schema } from './core';
|
|
312
|
+
import type { SpellValidationError } from './errors';
|
|
313
|
+
export type ParseResult<T> = {
|
|
314
|
+
data: T;
|
|
315
|
+
success: true;
|
|
316
|
+
} | {
|
|
317
|
+
error: SpellValidationError;
|
|
318
|
+
success: false;
|
|
319
|
+
};
|
|
320
|
+
export type AnySchema = Schema<unknown, unknown>;
|
|
321
|
+
export type InferOutput<T> = T extends Schema<infer O> ? O : never;
|
|
322
|
+
export type InferInput<T> = T extends Schema<any, infer I> ? I : never;
|
|
323
|
+
export type Infer<T> = InferOutput<T>;
|
|
324
|
+
/** Re-exported for convenience — defined in messages.ts. */
|
|
325
|
+
export type { Messages } from './messages';
|
|
326
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;CAqBZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAInE;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;AAIvH,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIjD;;;;;;;;;GASG;AACH,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAAE,GAChG;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAAE,GAClG;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IA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C,IAAI;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;AAI1G,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACjD,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACnE,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACvE,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAEtC,4DAA4D;AAC5D,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={custom:`custom`,invalid_base64:`invalid_base64`,invalid_date:`invalid_date`,invalid_duration:`invalid_duration`,invalid_enum:`invalid_enum`,invalid_finite:`invalid_finite`,invalid_integer:`invalid_integer`,invalid_keys:`invalid_keys`,invalid_length:`invalid_length`,invalid_literal:`invalid_literal`,invalid_multiple_of:`invalid_multiple_of`,invalid_safe:`invalid_safe`,invalid_string:`invalid_string`,invalid_type:`invalid_type`,invalid_union:`invalid_union`,invalid_unique:`invalid_unique`,invalid_url:`invalid_url`,invalid_variant:`invalid_variant`,too_big:`too_big`,too_small:`too_small`};export{e as ErrorCode};
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/* -------------------- Error Codes -------------------- */\n\nexport const ErrorCode = {\n custom: 'custom',\n invalid_base64: 'invalid_base64',\n invalid_date: 'invalid_date',\n invalid_duration: 'invalid_duration',\n invalid_enum: 'invalid_enum',\n invalid_finite: 'invalid_finite',\n invalid_integer: 'invalid_integer',\n invalid_keys: 'invalid_keys',\n invalid_length: 'invalid_length',\n invalid_literal: 'invalid_literal',\n invalid_multiple_of: 'invalid_multiple_of',\n invalid_safe: 'invalid_safe',\n invalid_string: 'invalid_string',\n invalid_type: 'invalid_type',\n invalid_union: 'invalid_union',\n invalid_unique: 'invalid_unique',\n invalid_url: 'invalid_url',\n invalid_variant: 'invalid_variant',\n too_big: 'too_big',\n too_small: 'too_small',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];\n\n/* -------------------- Messages -------------------- */\n\n/**\n * A validation message — either a static string or a function that receives context and returns a string.\n * **Note:** Static string values are used verbatim with no interpolation. Use the function form\n * for context-dependent messages (e.g. `(ctx) => \\`Must be at least ${ctx.min}\\``).\n */\nexport type MessageFn<Ctx extends Record<string, unknown> = Record<string, unknown>> = string | ((ctx: Ctx) => string);\n\n/* -------------------- JSON Schema -------------------- */\n\n/** Plain JSON Schema object (targeting JSON Schema 2020-12). */\nexport type JsonSchema = Record<string, unknown>;\n\n/* -------------------- Issues -------------------- */\n\n/**\n * A typed discriminated union of all issues emitted by built-in validators.\n *\n * Narrowing on `code` gives precise access to `params`:\n * ```ts\n * if (error.code === 'too_small') {\n * const min = error.params.min; // number | bigint | Date\n * }\n * ```\n */\nexport type Issue =\n | { code: 'custom'; message: string; params?: Record<string, unknown>; path: (string | number)[] }\n | { code: 'invalid_base64'; message: string; params: { format: string }; path: (string | number)[] }\n | { code: 'invalid_date'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_duration'; message: string; params: { format: string }; path: (string | number)[] }\n | { code: 'invalid_enum'; message: string; params: { values: readonly unknown[] }; path: (string | number)[] }\n | { code: 'invalid_finite'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_integer'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_keys'; message: string; params: { keys: string[] }; path: (string | number)[] }\n | { code: 'invalid_length'; message: string; params: { exact: number }; path: (string | number)[] }\n | { code: 'invalid_literal'; message: string; params: { expected: unknown }; path: (string | number)[] }\n | { code: 'invalid_multiple_of'; message: string; params: { step: number | bigint }; path: (string | number)[] }\n | { code: 'invalid_safe'; message: string; params?: undefined; path: (string | number)[] }\n | {\n code: 'invalid_string';\n message: string;\n params: { format?: string; includes?: string; pattern?: string; prefix?: string; suffix?: string };\n path: (string | number)[];\n }\n | { code: 'invalid_type'; message: string; params?: undefined; path: (string | number)[] }\n | { code: 'invalid_union'; message: string; params: { errors: Issue[][] }; path: (string | number)[] }\n | { code: 'invalid_unique'; message: string; params: { unique: true }; path: (string | number)[] }\n | { code: 'invalid_url'; message: string; params: { format: string }; path: (string | number)[] }\n | {\n code: 'invalid_variant';\n message: string;\n params: { discriminator: string; expected: string[] };\n path: (string | number)[];\n }\n | {\n code: 'too_big';\n message: string;\n params: { exclusive?: boolean; max: number | bigint | Date };\n path: (string | number)[];\n }\n | {\n code: 'too_small';\n message: string;\n params: { exclusive?: boolean; min: number | bigint | Date };\n path: (string | number)[];\n }\n | { code: string & {}; message: string; params?: Record<string, unknown>; path: (string | number)[] };\n\n/** ParseContext carries the active message set through the parse pipeline. */\nexport type ParseContext = {\n messages: import('./messages').Messages;\n};\n\n/**\n * Validator function. Receives the value after type-checking and the active ParseContext.\n * Returns an Issue array on failure, null on success, or a Promise for async validators.\n */\nexport type ValidateFn = (value: unknown, ctx?: ParseContext) => Issue[] | null | Promise<Issue[] | null>;\n\nexport type CheckContext = {\n addIssue: (issue: {\n code: string;\n message: string;\n params?: Record<string, unknown>;\n path?: (string | number)[];\n }) => void;\n};\n\n/**\n * Return type of a `validate()` callback.\n * - `string` — validation failed; the string becomes the error message.\n * - `false` — validation failed with no message (use `addIssue` for a message).\n * - `true` / `null` / `void` — validation passed.\n *\n * The shorthand `condition || 'message'` works naturally:\n * ```ts\n * s.string().validate(v => v.length > 0 || 'Cannot be empty')\n * ```\n */\nexport type ValidateResult = boolean | null | void | string;\n\n/** Re-exported from errors for convenience — defined there. */\nexport type { FlatError, FlatErrorFirst, FormattedErrors } from './errors';\n\n/* -------------------- Schema Introspection -------------------- */\n\n/**\n * Visitor map for schema.walk(). Container handlers receive already-walked children (type R).\n * All handlers are optional — unmatched kinds return `null` unless an `unknown` fallback is provided.\n *\n * Each handler receives the concrete schema type for that kind, enabling access to\n * schema-specific properties (e.g. `ArraySchema.itemSchema`) without casting.\n */\nexport type SchemaWalker<R> = {\n array?: (schema: import('./schemas/array').ArraySchema<any>, item: R | null) => R;\n bigint?: (schema: import('./schemas/bigint').BigIntSchema<any>) => R;\n boolean?: (schema: import('./schemas/boolean').BooleanSchema<any>) => R;\n date?: (schema: import('./schemas/date').DateSchema<any>) => R;\n enum?: (schema: import('./schemas/enum').EnumSchema<any>) => R;\n instanceof?: (schema: import('./schemas/instanceof').InstanceOfSchema<any>) => R;\n intersect?: (schema: import('./schemas/intersect').IntersectSchema<any>, branches: (R | null)[]) => R;\n lazy?: (schema: import('./schemas/lazy').LazySchema<any>) => R;\n literal?: (schema: import('./schemas/literal').LiteralSchema<any>) => R;\n map?: (schema: import('./schemas/map').MapSchema<any, any>, key: R | null, value: R | null) => R;\n never?: (schema: import('./schemas/never').NeverSchema) => R;\n number?: (schema: import('./schemas/number').NumberSchema<any>) => R;\n object?: (schema: import('./schemas/object').ObjectSchema<any>, fields: Record<string, R | null>) => R;\n pipe?: (schema: import('./core').PipeSchema<any, any>, from: R | null, to: R | null) => R;\n record?: (schema: import('./schemas/record').RecordSchema<any, any>, key: R | null, value: R | null) => R;\n set?: (schema: import('./schemas/set').SetSchema<any>, item: R | null) => R;\n string?: (schema: import('./schemas/string').StringSchema<any>) => R;\n tuple?: (schema: import('./schemas/tuple').TupleSchema<any, any>, items: (R | null)[], rest: R | null) => R;\n union?: (schema: import('./schemas/union').UnionSchema<any>, branches: (R | null)[]) => R;\n unknown?: (schema: AnySchema) => R;\n variant?: (schema: import('./schemas/variant').VariantSchema<any, any>, branches: Record<string, R | null>) => R;\n};\n\ntype BaseDescriptor = {\n description?: string;\n isNullable?: boolean;\n isOptional?: boolean;\n};\n\nexport type SchemaDescriptor = BaseDescriptor &\n (\n | { kind: 'any' | 'unknown' | 'never' | 'boolean' | 'bigint' | 'date' | 'lazy' }\n | { className: string; kind: 'instanceof' }\n | {\n contentEncoding?: string;\n format?: string;\n kind: 'string';\n maxLength?: number;\n minLength?: number;\n pattern?: string | null;\n }\n | {\n exclusiveMaximum?: number;\n exclusiveMinimum?: number;\n kind: 'number';\n maximum?: number;\n minimum?: number;\n multipleOf?: number;\n typeHint?: 'integer';\n }\n | { kind: 'literal'; value: string | number | boolean | null | undefined }\n | { kind: 'enum'; values: readonly (string | number)[] }\n | { items: SchemaDescriptor; kind: 'array'; maxItems?: number; minItems?: number }\n | { items: SchemaDescriptor[]; kind: 'tuple'; rest: SchemaDescriptor | null }\n | { fields: Record<string, SchemaDescriptor>; kind: 'object'; strict: boolean }\n | { key: SchemaDescriptor; kind: 'record'; value: SchemaDescriptor }\n | { items: SchemaDescriptor; kind: 'set' }\n | { key: SchemaDescriptor; kind: 'map'; value: SchemaDescriptor }\n | { branches: SchemaDescriptor[]; kind: 'union' | 'intersect' }\n | { branches: Record<string, SchemaDescriptor>; discriminator: string; kind: 'variant' }\n | { from: SchemaDescriptor; kind: 'pipe'; to: SchemaDescriptor }\n );\n\n/* -------------------- ParseResult (forward-references SpellValidationError) -------------------- */\n\nimport type { Schema } from './core';\n// Import only the type to avoid circular dependencies\nimport type { SpellValidationError } from './errors';\n\nexport type ParseResult<T> = { data: T; success: true } | { error: SpellValidationError; success: false };\n\n/* -------------------- AnySchema / Infer (forward-references Schema) -------------------- */\n\nexport type AnySchema = Schema<unknown, unknown>;\nexport type InferOutput<T> = T extends Schema<infer O> ? O : never;\nexport type InferInput<T> = T extends Schema<any, infer I> ? I : never;\nexport type Infer<T> = InferOutput<T>;\n\n/** Re-exported for convenience — defined in messages.ts. */\nexport type { Messages } from './messages';\n"],"mappings":"AAEA,IAAa,EAAY,CACvB,OAAQ,SACR,eAAgB,iBAChB,aAAc,eACd,iBAAkB,mBAClB,aAAc,eACd,eAAgB,iBAChB,gBAAiB,kBACjB,aAAc,eACd,eAAgB,iBAChB,gBAAiB,kBACjB,oBAAqB,sBACrB,aAAc,eACd,eAAgB,iBAChB,aAAc,eACd,cAAe,gBACf,eAAgB,iBAChB,YAAa,cACb,gBAAiB,kBACjB,QAAS,UACT,UAAW,WACb"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=(e,t)=>e.length>=t,t=(e,t)=>e.length<=t,n=(e,t,n)=>e>=t&&e<=n,r=e=>Number.isInteger(e),i=e=>e>0,a=e=>e>=0,o=e=>e<0,s=(e,t)=>e%t===0,c=e=>typeof e==`string`,l=e=>typeof e==`number`&&!Number.isNaN(e),u=e=>typeof e==`boolean`,d=e=>e==null,f=e=>e instanceof Date&&!Number.isNaN(e.getTime()),p=e=>Array.isArray(e);exports.hasMaxLength=t,exports.hasMinLength=e,exports.isArray=p,exports.isBoolean=u,exports.isDate=f,exports.isInRange=n,exports.isInteger=r,exports.isMultipleOf=s,exports.isNegative=o,exports.isNonNegative=a,exports.isNullOrUndefined=d,exports.isNumber=l,exports.isPositive=i,exports.isString=c;
|
|
2
|
+
//# sourceMappingURL=validators.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.cjs","names":[],"sources":["../src/validators.ts"],"sourcesContent":["/**\n * Standalone validator functions — zero-dep, tree-shakeable helpers that return\n * a simple `boolean` (or a typed predicate) without constructing a Schema.\n * Useful in non-schema contexts such as conditional rendering, guards, etc.\n */\n\n/* -------------------- Generic range validators -------------------- */\n\nexport const hasMinLength = (value: string | unknown[], min: number): boolean => value.length >= min;\nexport const hasMaxLength = (value: string | unknown[], max: number): boolean => value.length <= max;\nexport const isInRange = (value: number, min: number, max: number): boolean => value >= min && value <= max;\nexport const isInteger = (value: number): boolean => Number.isInteger(value);\nexport const isPositive = (value: number): boolean => value > 0;\nexport const isNonNegative = (value: number): boolean => value >= 0;\nexport const isNegative = (value: number): boolean => value < 0;\nexport const isMultipleOf = (value: number, step: number): boolean => value % step === 0;\n\n/* -------------------- Type guards -------------------- */\n\nexport const isString = (value: unknown): value is string => typeof value === 'string';\nexport const isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\nexport const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';\nexport const isNullOrUndefined = (value: unknown): value is null | undefined => value == null;\nexport const isDate = (value: unknown): value is Date => value instanceof Date && !Number.isNaN(value.getTime());\nexport const isArray = (value: unknown): value is unknown[] => Array.isArray(value);\n"],"mappings":"AAQA,IAAa,GAAgB,EAA2B,IAAyB,EAAM,QAAU,EACpF,GAAgB,EAA2B,IAAyB,EAAM,QAAU,EACpF,GAAa,EAAe,EAAa,IAAyB,GAAS,GAAO,GAAS,EAC3F,EAAa,GAA2B,OAAO,UAAU,CAAK,EAC9D,EAAc,GAA2B,EAAQ,EACjD,EAAiB,GAA2B,GAAS,EACrD,EAAc,GAA2B,EAAQ,EACjD,GAAgB,EAAe,IAA0B,EAAQ,IAAS,EAI1E,EAAY,GAAoC,OAAO,GAAU,SACjE,EAAY,GAAoC,OAAO,GAAU,UAAY,CAAC,OAAO,MAAM,CAAK,EAChG,EAAa,GAAqC,OAAO,GAAU,UACnE,EAAqB,GAA8C,GAAS,KAC5E,EAAU,GAAkC,aAAiB,MAAQ,CAAC,OAAO,MAAM,EAAM,QAAQ,CAAC,EAClG,EAAW,GAAuC,MAAM,QAAQ,CAAK"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone validator functions — zero-dep, tree-shakeable helpers that return
|
|
3
|
+
* a simple `boolean` (or a typed predicate) without constructing a Schema.
|
|
4
|
+
* Useful in non-schema contexts such as conditional rendering, guards, etc.
|
|
5
|
+
*/
|
|
6
|
+
export declare const hasMinLength: (value: string | unknown[], min: number) => boolean;
|
|
7
|
+
export declare const hasMaxLength: (value: string | unknown[], max: number) => boolean;
|
|
8
|
+
export declare const isInRange: (value: number, min: number, max: number) => boolean;
|
|
9
|
+
export declare const isInteger: (value: number) => boolean;
|
|
10
|
+
export declare const isPositive: (value: number) => boolean;
|
|
11
|
+
export declare const isNonNegative: (value: number) => boolean;
|
|
12
|
+
export declare const isNegative: (value: number) => boolean;
|
|
13
|
+
export declare const isMultipleOf: (value: number, step: number) => boolean;
|
|
14
|
+
export declare const isString: (value: unknown) => value is string;
|
|
15
|
+
export declare const isNumber: (value: unknown) => value is number;
|
|
16
|
+
export declare const isBoolean: (value: unknown) => value is boolean;
|
|
17
|
+
export declare const isNullOrUndefined: (value: unknown) => value is null | undefined;
|
|
18
|
+
export declare const isDate: (value: unknown) => value is Date;
|
|
19
|
+
export declare const isArray: (value: unknown) => value is unknown[];
|
|
20
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,GAAG,OAAO,EAAE,EAAE,KAAK,MAAM,KAAG,OAA8B,CAAC;AACrG,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,GAAG,OAAO,EAAE,EAAE,KAAK,MAAM,KAAG,OAA8B,CAAC;AACrG,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,OAAuC,CAAC;AAC5G,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,OAAkC,CAAC;AAC7E,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,OAAoB,CAAC;AAChE,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,OAAqB,CAAC;AACpE,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,OAAoB,CAAC;AAChE,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,KAAG,OAA6B,CAAC;AAIzF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAmC,CAAC;AACvF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAA2D,CAAC;AAC/G,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAqC,CAAC;AAC1F,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,IAAI,GAAG,SAA0B,CAAC;AAC9F,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,IAA+D,CAAC;AACjH,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAO,EAA0B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=(e,t)=>e.length>=t,t=(e,t)=>e.length<=t,n=(e,t,n)=>e>=t&&e<=n,r=e=>Number.isInteger(e),i=e=>e>0,a=e=>e>=0,o=e=>e<0,s=(e,t)=>e%t===0,c=e=>typeof e==`string`,l=e=>typeof e==`number`&&!Number.isNaN(e),u=e=>typeof e==`boolean`,d=e=>e==null,f=e=>e instanceof Date&&!Number.isNaN(e.getTime()),p=e=>Array.isArray(e);export{t as hasMaxLength,e as hasMinLength,p as isArray,u as isBoolean,f as isDate,n as isInRange,r as isInteger,s as isMultipleOf,o as isNegative,a as isNonNegative,d as isNullOrUndefined,l as isNumber,i as isPositive,c as isString};
|
|
2
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","names":[],"sources":["../src/validators.ts"],"sourcesContent":["/**\n * Standalone validator functions — zero-dep, tree-shakeable helpers that return\n * a simple `boolean` (or a typed predicate) without constructing a Schema.\n * Useful in non-schema contexts such as conditional rendering, guards, etc.\n */\n\n/* -------------------- Generic range validators -------------------- */\n\nexport const hasMinLength = (value: string | unknown[], min: number): boolean => value.length >= min;\nexport const hasMaxLength = (value: string | unknown[], max: number): boolean => value.length <= max;\nexport const isInRange = (value: number, min: number, max: number): boolean => value >= min && value <= max;\nexport const isInteger = (value: number): boolean => Number.isInteger(value);\nexport const isPositive = (value: number): boolean => value > 0;\nexport const isNonNegative = (value: number): boolean => value >= 0;\nexport const isNegative = (value: number): boolean => value < 0;\nexport const isMultipleOf = (value: number, step: number): boolean => value % step === 0;\n\n/* -------------------- Type guards -------------------- */\n\nexport const isString = (value: unknown): value is string => typeof value === 'string';\nexport const isNumber = (value: unknown): value is number => typeof value === 'number' && !Number.isNaN(value);\nexport const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';\nexport const isNullOrUndefined = (value: unknown): value is null | undefined => value == null;\nexport const isDate = (value: unknown): value is Date => value instanceof Date && !Number.isNaN(value.getTime());\nexport const isArray = (value: unknown): value is unknown[] => Array.isArray(value);\n"],"mappings":"AAQA,IAAa,GAAgB,EAA2B,IAAyB,EAAM,QAAU,EACpF,GAAgB,EAA2B,IAAyB,EAAM,QAAU,EACpF,GAAa,EAAe,EAAa,IAAyB,GAAS,GAAO,GAAS,EAC3F,EAAa,GAA2B,OAAO,UAAU,CAAK,EAC9D,EAAc,GAA2B,EAAQ,EACjD,EAAiB,GAA2B,GAAS,EACrD,EAAc,GAA2B,EAAQ,EACjD,GAAgB,EAAe,IAA0B,EAAQ,IAAS,EAI1E,EAAY,GAAoC,OAAO,GAAU,SACjE,EAAY,GAAoC,OAAO,GAAU,UAAY,CAAC,OAAO,MAAM,CAAK,EAChG,EAAa,GAAqC,OAAO,GAAU,UACnE,EAAqB,GAA8C,GAAS,KAC5E,EAAU,GAAkC,aAAiB,MAAQ,CAAC,OAAO,MAAM,EAAM,QAAQ,CAAC,EAClG,EAAW,GAAuC,MAAM,QAAQ,CAAK"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vielzeug/spell",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Schema-first validation and parsing — runtime type checking, coercion, and custom refinements",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "vite build && pnpm run build:bundle && pnpm run build:types",
|
|
22
|
+
"build:types": "tsc -p tsconfig.declarations.json",
|
|
23
|
+
"fix": "eslint --fix src",
|
|
24
|
+
"lint": "eslint src",
|
|
25
|
+
"prepublishOnly": "pnpm run build",
|
|
26
|
+
"preview": "vite preview",
|
|
27
|
+
"test": "vitest",
|
|
28
|
+
"build:bundle": "vite build --config vite.bundle.config.ts"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@vielzeug/arsenal": "workspace:*"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^26.1.0",
|
|
39
|
+
"typescript": "~6.0.3",
|
|
40
|
+
"vite": "^8.1.3",
|
|
41
|
+
"vitest": "^4.1.9"
|
|
42
|
+
}
|
|
43
|
+
}
|