@whatsaaaa/form-builder-schema 0.1.0 → 0.3.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 +113 -6
- package/dist/index.d.ts +519 -29
- package/dist/index.js +840 -80
- package/dist/index.js.map +1 -1
- package/package.json +13 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,83 +1,573 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
type AnySchema = v.GenericSchema;
|
|
3
3
|
type AnyAction = v.GenericPipeAction;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A `v.object()` schema. The builder reads its `entries` to find unknown keys.
|
|
6
|
+
*/
|
|
7
|
+
type AnyObjectSchema = v.ObjectSchema<v.ObjectEntries, v.ErrorMessage<v.ObjectIssue> | undefined>;
|
|
8
|
+
interface KindDef {
|
|
9
|
+
/** True when the input means "no value". */
|
|
10
|
+
isEmpty(input: unknown): boolean;
|
|
11
|
+
/** Extra check for required fieldsd after normalize rules ran. Omit it when isEmpty is enough. */
|
|
12
|
+
required?(message: string): AnyAction | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The built-in kinds, plus any string so consumers can register their own.
|
|
16
|
+
*/
|
|
17
|
+
type ValueKind = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'file' | 'object' | 'none' | (string & {});
|
|
18
|
+
interface JsonForm {
|
|
19
|
+
version: '1';
|
|
20
|
+
fields: readonly JsonField[];
|
|
21
|
+
}
|
|
6
22
|
interface JsonField {
|
|
7
|
-
name
|
|
8
|
-
type:
|
|
23
|
+
name?: string;
|
|
24
|
+
type: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
default?: unknown;
|
|
9
29
|
required?: boolean | {
|
|
10
30
|
message?: string;
|
|
11
31
|
};
|
|
12
32
|
rules?: readonly JsonRule[];
|
|
33
|
+
/** For renderers. This package never reads or checks it. */
|
|
34
|
+
ui?: Record<string, unknown>;
|
|
35
|
+
/** Validated by the field type's props schema, */
|
|
36
|
+
[prop: string]: unknown;
|
|
13
37
|
}
|
|
14
38
|
interface JsonRule {
|
|
15
39
|
rule: string;
|
|
16
40
|
message?: string;
|
|
17
41
|
[param: string]: unknown;
|
|
18
42
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
43
|
+
/** Where something is in a definition, e.g. `['fields', 0, 'rules', 1]`. */
|
|
44
|
+
type DefinitionPath = readonly (string | number)[];
|
|
45
|
+
/** Public API: adding a code is a minor change, renaming one is breaking, */
|
|
46
|
+
type DefinitionIssueCode = 'invalid_shape' | 'unsupported_version' | 'unknown_key' | 'unknown_type' | 'missing_name' | 'duplicate_name' | 'invalid_props' | 'unknown_rule' | 'unknown_param' | 'invalid_params' | 'kind_mismatch';
|
|
47
|
+
interface DefinitionIssue {
|
|
48
|
+
code: DefinitionIssueCode;
|
|
49
|
+
path: DefinitionPath;
|
|
50
|
+
message: string;
|
|
22
51
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
type ValidateResult = {
|
|
53
|
+
success: true;
|
|
54
|
+
issues: [];
|
|
55
|
+
} | {
|
|
56
|
+
success: false;
|
|
57
|
+
issues: DefinitionIssue[];
|
|
58
|
+
};
|
|
59
|
+
export declare function formatPath(path: DefinitionPath): string;
|
|
60
|
+
/** Thrown by `build()` when the definition has issues. Lists all of them. */
|
|
61
|
+
export declare class DefinitionError extends Error {
|
|
62
|
+
readonly issues: readonly DefinitionIssue[];
|
|
63
|
+
constructor(issues: readonly DefinitionIssue[]);
|
|
27
64
|
}
|
|
28
|
-
interface FieldTypeDef {
|
|
65
|
+
interface FieldTypeDef<TProps extends AnyObjectSchema = AnyObjectSchema> {
|
|
29
66
|
kind: ValueKind;
|
|
30
|
-
|
|
67
|
+
/** Extra keys this type accepts on a field, e.g. `options` on a select. */
|
|
68
|
+
props?: TProps;
|
|
69
|
+
/**
|
|
70
|
+
* The base schema for the field's value. Required unless `kind` is `'none'`.
|
|
71
|
+
* Method syntax keeps it bivariant, so typed field types fit in a `Record<string, FieldTypeDef>`.
|
|
72
|
+
*/
|
|
73
|
+
schema?(field: FieldWithProps<TProps>, ctx: BuildContext): AnySchema;
|
|
74
|
+
/** Rules every field of this type gets. A field rule with the same name replaces one. */
|
|
31
75
|
defaultRules?: readonly JsonRule[];
|
|
32
76
|
}
|
|
77
|
+
/** A field with its type's props parsed and typed. */
|
|
78
|
+
type FieldWithProps<TProps extends AnyObjectSchema = AnyObjectSchema> = JsonField & v.InferOutput<TProps>;
|
|
79
|
+
interface BuildContext {
|
|
80
|
+
/** Where the field is in the definition, e.g. `['fields', 2]`. */
|
|
81
|
+
readonly path: DefinitionPath;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* `normalize` rules (trim, change case) run before the required check, so `' '` with `trim` counts
|
|
85
|
+
* as empty. `validate` rules run after it.
|
|
86
|
+
*/
|
|
87
|
+
type RuleStage = 'normalize' | 'validate';
|
|
88
|
+
/** Groups rules in the builder app. One per rule family. */
|
|
89
|
+
type RuleCategory = 'length' | 'text' | 'content' | 'format' | 'date' | 'comparison' | 'number' | 'file' | 'normalize';
|
|
90
|
+
/** Describes a rule to people, e.g. in the builder app's rule picker. */
|
|
91
|
+
interface RuleMeta {
|
|
92
|
+
label: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
category: RuleCategory;
|
|
95
|
+
}
|
|
96
|
+
interface RuleDef<TParams extends AnyObjectSchema = AnyObjectSchema> {
|
|
97
|
+
kinds: readonly ValueKind[];
|
|
98
|
+
/** Defaults to `'validate'`. */
|
|
99
|
+
stage?: RuleStage;
|
|
100
|
+
/**
|
|
101
|
+
* The params the rule takes. Omit it for rules without params. Unknown params are rejected.
|
|
102
|
+
* A function gets the field's kind, for params that depend on it (`minValue` takes a number
|
|
103
|
+
* on a number field, and an ISO string on a date field). It is called once per kind.
|
|
104
|
+
*/
|
|
105
|
+
params?: TParams | ((kind: ValueKind) => TParams);
|
|
106
|
+
meta?: RuleMeta;
|
|
107
|
+
/** Method syntax keeps `create` bivariant, so specific rules fit in a `Record<string, RuleDef>`. */
|
|
108
|
+
create(params: v.InferOutput<TParams>, message?: string): AnyAction;
|
|
109
|
+
}
|
|
110
|
+
interface MessageContext {
|
|
111
|
+
field: JsonField;
|
|
112
|
+
rule?: string;
|
|
113
|
+
path: DefinitionPath;
|
|
114
|
+
}
|
|
33
115
|
interface SchemaBuilderOptions {
|
|
116
|
+
kinds?: Record<string, KindDef>;
|
|
34
117
|
fieldTypes?: Record<string, FieldTypeDef>;
|
|
35
118
|
rules?: Record<string, RuleDef>;
|
|
119
|
+
includeDefaultRules?: boolean;
|
|
120
|
+
messages?: {
|
|
121
|
+
required?: string;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Called with every message from the definition and with `messages.required`, e.g. to treat
|
|
125
|
+
* them as i18n keys. Return undefined to use the text as written.
|
|
126
|
+
*/
|
|
127
|
+
resolveMessage?(key: string, ctx: MessageContext): string | undefined;
|
|
36
128
|
}
|
|
37
|
-
export declare function createSchemaBuilder(
|
|
129
|
+
export declare function createSchemaBuilder(options?: SchemaBuilderOptions): {
|
|
130
|
+
build: (json: JsonForm) => v.ObjectSchema<v.ObjectEntries, undefined>;
|
|
131
|
+
validate: (json: unknown) => ValidateResult;
|
|
132
|
+
rulesForKind: (kind: ValueKind) => [name: string, def: RuleDef][];
|
|
133
|
+
kinds: Readonly<Record<string, KindDef>>;
|
|
134
|
+
fieldTypes: Readonly<Record<string, FieldTypeDef<AnyObjectSchema>>>;
|
|
135
|
+
rules: Readonly<Record<string, RuleDef<AnyObjectSchema>>>;
|
|
136
|
+
};
|
|
38
137
|
export declare const defaultFieldTypes: {
|
|
39
138
|
text: {
|
|
40
139
|
kind: "string";
|
|
41
|
-
|
|
140
|
+
schema: () => v.StringSchema<undefined>;
|
|
42
141
|
};
|
|
43
142
|
password: {
|
|
44
143
|
kind: "string";
|
|
45
|
-
|
|
144
|
+
schema: () => v.StringSchema<undefined>;
|
|
46
145
|
};
|
|
47
146
|
email: {
|
|
48
147
|
kind: "string";
|
|
49
|
-
|
|
148
|
+
schema: () => v.StringSchema<undefined>;
|
|
50
149
|
defaultRules: {
|
|
51
150
|
rule: string;
|
|
52
|
-
message: string;
|
|
53
151
|
}[];
|
|
54
152
|
};
|
|
55
153
|
number: {
|
|
56
154
|
kind: "number";
|
|
57
|
-
|
|
155
|
+
schema: () => v.NumberSchema<undefined>;
|
|
58
156
|
};
|
|
59
157
|
};
|
|
60
|
-
export declare const
|
|
158
|
+
export declare const defineFieldType: <T extends AnyObjectSchema>(def: FieldTypeDef<T>) => FieldTypeDef<T>;
|
|
159
|
+
export declare const defaultKinds: {
|
|
160
|
+
string: {
|
|
161
|
+
isEmpty: (input: unknown) => input is "" | null | undefined;
|
|
162
|
+
required: (message: string) => v.NonEmptyAction<any, string>;
|
|
163
|
+
};
|
|
164
|
+
number: {
|
|
165
|
+
isEmpty: (input: unknown) => boolean;
|
|
166
|
+
};
|
|
167
|
+
boolean: {
|
|
168
|
+
isEmpty: (input: unknown) => input is null | undefined;
|
|
169
|
+
required: (message: string) => v.ValueAction<any, true, string>;
|
|
170
|
+
};
|
|
171
|
+
date: {
|
|
172
|
+
isEmpty: (input: unknown) => input is "" | null | undefined;
|
|
173
|
+
required: (message: string) => v.NonEmptyAction<any, string>;
|
|
174
|
+
};
|
|
175
|
+
array: {
|
|
176
|
+
isEmpty: (input: unknown) => boolean;
|
|
177
|
+
required: (message: string) => v.MinLengthAction<any, 1, string>;
|
|
178
|
+
};
|
|
179
|
+
file: {
|
|
180
|
+
isEmpty: (input: unknown) => input is null | undefined;
|
|
181
|
+
};
|
|
182
|
+
object: {
|
|
183
|
+
isEmpty: (input: unknown) => input is null | undefined;
|
|
184
|
+
};
|
|
185
|
+
none: {
|
|
186
|
+
isEmpty: () => true;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
/** Compares the value with a param of the same type. */
|
|
190
|
+
export declare const comparisonRules: {
|
|
191
|
+
minValue: RuleDef<v.ObjectSchema<{
|
|
192
|
+
readonly value: v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>;
|
|
193
|
+
}, undefined>>;
|
|
194
|
+
maxValue: RuleDef<v.ObjectSchema<{
|
|
195
|
+
readonly value: v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>;
|
|
196
|
+
}, undefined>>;
|
|
197
|
+
gtValue: RuleDef<v.ObjectSchema<{
|
|
198
|
+
readonly value: v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>;
|
|
199
|
+
}, undefined>>;
|
|
200
|
+
ltValue: RuleDef<v.ObjectSchema<{
|
|
201
|
+
readonly value: v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>;
|
|
202
|
+
}, undefined>>;
|
|
203
|
+
value: RuleDef<v.ObjectSchema<{
|
|
204
|
+
readonly value: v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>;
|
|
205
|
+
}, undefined>>;
|
|
206
|
+
notValue: RuleDef<v.ObjectSchema<{
|
|
207
|
+
readonly value: v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>;
|
|
208
|
+
}, undefined>>;
|
|
209
|
+
values: RuleDef<v.ObjectSchema<{
|
|
210
|
+
readonly values: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>, undefined>, v.MinLengthAction<(string | number | boolean)[], 1, "Give at least one value">]>;
|
|
211
|
+
}, undefined>>;
|
|
212
|
+
notValues: RuleDef<v.ObjectSchema<{
|
|
213
|
+
readonly values: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined> | v.NumberSchema<undefined> | v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | v.BooleanSchema<undefined>, undefined>, v.MinLengthAction<(string | number | boolean)[], 1, "Give at least one value">]>;
|
|
214
|
+
}, undefined>>;
|
|
215
|
+
};
|
|
216
|
+
export declare const contentRules: {
|
|
217
|
+
regex: RuleDef<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
218
|
+
readonly pattern: v.StringSchema<undefined>;
|
|
219
|
+
readonly flags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Flags can be d, g, i, m, s, u, v and y">]>, undefined>;
|
|
220
|
+
}, undefined>, v.BaseValidation<{
|
|
221
|
+
pattern: string;
|
|
222
|
+
flags?: string | undefined;
|
|
223
|
+
}, {
|
|
224
|
+
pattern: string;
|
|
225
|
+
flags?: string | undefined;
|
|
226
|
+
}, v.CheckIssue<{
|
|
227
|
+
pattern: string;
|
|
228
|
+
flags?: string | undefined;
|
|
229
|
+
}>>]>>;
|
|
230
|
+
startsWith: RuleDef<v.ObjectSchema<{
|
|
231
|
+
readonly value: v.StringSchema<undefined>;
|
|
232
|
+
}, undefined>>;
|
|
233
|
+
endsWith: RuleDef<v.ObjectSchema<{
|
|
234
|
+
readonly value: v.StringSchema<undefined>;
|
|
235
|
+
}, undefined>>;
|
|
236
|
+
includes: RuleDef<v.ObjectSchema<{
|
|
237
|
+
readonly value: v.StringSchema<undefined> | v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
238
|
+
}, undefined>>;
|
|
239
|
+
excludes: RuleDef<v.ObjectSchema<{
|
|
240
|
+
readonly value: v.StringSchema<undefined> | v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
241
|
+
}, undefined>>;
|
|
242
|
+
};
|
|
243
|
+
export declare const dateRules: {
|
|
244
|
+
isoDate: RuleDef<AnyObjectSchema>;
|
|
245
|
+
isoDateTime: RuleDef<AnyObjectSchema>;
|
|
246
|
+
isoTime: RuleDef<AnyObjectSchema>;
|
|
247
|
+
isoTimeSecond: RuleDef<AnyObjectSchema>;
|
|
248
|
+
isoTimestamp: RuleDef<AnyObjectSchema>;
|
|
249
|
+
isoWeek: RuleDef<AnyObjectSchema>;
|
|
250
|
+
};
|
|
251
|
+
/** Every built-in rule. Register single families with `includeDefaultRules: false`. */
|
|
61
252
|
export declare const defaultRules: {
|
|
253
|
+
trim: RuleDef<AnyObjectSchema>;
|
|
254
|
+
trimStart: RuleDef<AnyObjectSchema>;
|
|
255
|
+
trimEnd: RuleDef<AnyObjectSchema>;
|
|
256
|
+
toLowerCase: RuleDef<AnyObjectSchema>;
|
|
257
|
+
toUpperCase: RuleDef<AnyObjectSchema>;
|
|
258
|
+
normalize: RuleDef<import("valibot").ObjectSchema<{
|
|
259
|
+
readonly form: import("valibot").OptionalSchema<import("valibot").PicklistSchema<["NFC", "NFD", "NFKC", "NFKD"], undefined>, undefined>;
|
|
260
|
+
}, undefined>>;
|
|
261
|
+
toMinValue: RuleDef<import("valibot").ObjectSchema<{
|
|
262
|
+
readonly value: import("valibot").NumberSchema<undefined>;
|
|
263
|
+
}, undefined>>;
|
|
264
|
+
toMaxValue: RuleDef<import("valibot").ObjectSchema<{
|
|
265
|
+
readonly value: import("valibot").NumberSchema<undefined>;
|
|
266
|
+
}, undefined>>;
|
|
267
|
+
minSize: RuleDef<import("valibot").ObjectSchema<{
|
|
268
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
269
|
+
}, undefined>>;
|
|
270
|
+
maxSize: RuleDef<import("valibot").ObjectSchema<{
|
|
271
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
272
|
+
}, undefined>>;
|
|
273
|
+
size: RuleDef<import("valibot").ObjectSchema<{
|
|
274
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
275
|
+
}, undefined>>;
|
|
276
|
+
notSize: RuleDef<import("valibot").ObjectSchema<{
|
|
277
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
278
|
+
}, undefined>>;
|
|
279
|
+
mimeType: RuleDef<import("valibot").ObjectSchema<{
|
|
280
|
+
readonly types: import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, "Use a MIME type, such as image/png">]>, undefined>, import("valibot").MinLengthAction<string[], 1, "Give at least one MIME type">]>;
|
|
281
|
+
}, undefined>>;
|
|
282
|
+
integer: RuleDef<AnyObjectSchema>;
|
|
283
|
+
safeInteger: RuleDef<AnyObjectSchema>;
|
|
284
|
+
finite: RuleDef<AnyObjectSchema>;
|
|
285
|
+
multipleOf: RuleDef<import("valibot").ObjectSchema<{
|
|
286
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").FiniteAction<number, undefined>, import("valibot").NotValueAction<number, 0, "Can't be 0">]>;
|
|
287
|
+
}, undefined>>;
|
|
288
|
+
minValue: RuleDef<import("valibot").ObjectSchema<{
|
|
289
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>;
|
|
290
|
+
}, undefined>>;
|
|
291
|
+
maxValue: RuleDef<import("valibot").ObjectSchema<{
|
|
292
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>;
|
|
293
|
+
}, undefined>>;
|
|
294
|
+
gtValue: RuleDef<import("valibot").ObjectSchema<{
|
|
295
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>;
|
|
296
|
+
}, undefined>>;
|
|
297
|
+
ltValue: RuleDef<import("valibot").ObjectSchema<{
|
|
298
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>;
|
|
299
|
+
}, undefined>>;
|
|
300
|
+
value: RuleDef<import("valibot").ObjectSchema<{
|
|
301
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>;
|
|
302
|
+
}, undefined>>;
|
|
303
|
+
notValue: RuleDef<import("valibot").ObjectSchema<{
|
|
304
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>;
|
|
305
|
+
}, undefined>>;
|
|
306
|
+
values: RuleDef<import("valibot").ObjectSchema<{
|
|
307
|
+
readonly values: import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>, undefined>, import("valibot").MinLengthAction<(string | number | boolean)[], 1, "Give at least one value">]>;
|
|
308
|
+
}, undefined>>;
|
|
309
|
+
notValues: RuleDef<import("valibot").ObjectSchema<{
|
|
310
|
+
readonly values: import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").StringSchema<undefined> | import("valibot").NumberSchema<undefined> | import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use an ISO date, date-time or time, such as 2026-01-01">]> | import("valibot").BooleanSchema<undefined>, undefined>, import("valibot").MinLengthAction<(string | number | boolean)[], 1, "Give at least one value">]>;
|
|
311
|
+
}, undefined>>;
|
|
312
|
+
isoDate: RuleDef<AnyObjectSchema>;
|
|
313
|
+
isoDateTime: RuleDef<AnyObjectSchema>;
|
|
314
|
+
isoTime: RuleDef<AnyObjectSchema>;
|
|
315
|
+
isoTimeSecond: RuleDef<AnyObjectSchema>;
|
|
316
|
+
isoTimestamp: RuleDef<AnyObjectSchema>;
|
|
317
|
+
isoWeek: RuleDef<AnyObjectSchema>;
|
|
318
|
+
email: RuleDef<AnyObjectSchema>;
|
|
319
|
+
rfcEmail: RuleDef<AnyObjectSchema>;
|
|
320
|
+
url: RuleDef<AnyObjectSchema>;
|
|
321
|
+
domain: RuleDef<AnyObjectSchema>;
|
|
322
|
+
slug: RuleDef<AnyObjectSchema>;
|
|
323
|
+
uuid: RuleDef<AnyObjectSchema>;
|
|
324
|
+
ulid: RuleDef<AnyObjectSchema>;
|
|
325
|
+
cuid2: RuleDef<AnyObjectSchema>;
|
|
326
|
+
nanoid: RuleDef<AnyObjectSchema>;
|
|
327
|
+
ip: RuleDef<AnyObjectSchema>;
|
|
328
|
+
ipv4: RuleDef<AnyObjectSchema>;
|
|
329
|
+
ipv6: RuleDef<AnyObjectSchema>;
|
|
330
|
+
mac: RuleDef<AnyObjectSchema>;
|
|
331
|
+
mac48: RuleDef<AnyObjectSchema>;
|
|
332
|
+
mac64: RuleDef<AnyObjectSchema>;
|
|
333
|
+
hexColor: RuleDef<AnyObjectSchema>;
|
|
334
|
+
hexadecimal: RuleDef<AnyObjectSchema>;
|
|
335
|
+
octal: RuleDef<AnyObjectSchema>;
|
|
336
|
+
decimal: RuleDef<AnyObjectSchema>;
|
|
337
|
+
digits: RuleDef<AnyObjectSchema>;
|
|
338
|
+
base64: RuleDef<AnyObjectSchema>;
|
|
339
|
+
bic: RuleDef<AnyObjectSchema>;
|
|
340
|
+
creditCard: RuleDef<AnyObjectSchema>;
|
|
341
|
+
imei: RuleDef<AnyObjectSchema>;
|
|
342
|
+
isbn: RuleDef<AnyObjectSchema>;
|
|
343
|
+
isrc: RuleDef<AnyObjectSchema>;
|
|
344
|
+
emoji: RuleDef<AnyObjectSchema>;
|
|
345
|
+
hash: RuleDef<import("valibot").ObjectSchema<{
|
|
346
|
+
readonly types: import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").PicklistSchema<readonly ["md4", "md5", "sha1", "sha256", "sha384", "sha512", "ripemd128", "ripemd160", "tiger128", "tiger160", "tiger192", "crc32", "crc32b", "adler32"], undefined>, undefined>, import("valibot").MinLengthAction<("md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b" | "adler32")[], 1, "Pick at least one hash type">]>;
|
|
347
|
+
}, undefined>>;
|
|
348
|
+
regex: RuleDef<import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectSchema<{
|
|
349
|
+
readonly pattern: import("valibot").StringSchema<undefined>;
|
|
350
|
+
readonly flags: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, "Flags can be d, g, i, m, s, u, v and y">]>, undefined>;
|
|
351
|
+
}, undefined>, import("valibot").BaseValidation<{
|
|
352
|
+
pattern: string;
|
|
353
|
+
flags?: string | undefined;
|
|
354
|
+
}, {
|
|
355
|
+
pattern: string;
|
|
356
|
+
flags?: string | undefined;
|
|
357
|
+
}, import("valibot").CheckIssue<{
|
|
358
|
+
pattern: string;
|
|
359
|
+
flags?: string | undefined;
|
|
360
|
+
}>>]>>;
|
|
361
|
+
startsWith: RuleDef<import("valibot").ObjectSchema<{
|
|
362
|
+
readonly value: import("valibot").StringSchema<undefined>;
|
|
363
|
+
}, undefined>>;
|
|
364
|
+
endsWith: RuleDef<import("valibot").ObjectSchema<{
|
|
365
|
+
readonly value: import("valibot").StringSchema<undefined>;
|
|
366
|
+
}, undefined>>;
|
|
367
|
+
includes: RuleDef<import("valibot").ObjectSchema<{
|
|
368
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>, import("valibot").BooleanSchema<undefined>], undefined>;
|
|
369
|
+
}, undefined>>;
|
|
370
|
+
excludes: RuleDef<import("valibot").ObjectSchema<{
|
|
371
|
+
readonly value: import("valibot").StringSchema<undefined> | import("valibot").UnionSchema<[import("valibot").StringSchema<undefined>, import("valibot").NumberSchema<undefined>, import("valibot").BooleanSchema<undefined>], undefined>;
|
|
372
|
+
}, undefined>>;
|
|
373
|
+
graphemes: RuleDef<import("valibot").ObjectSchema<{
|
|
374
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
375
|
+
}, undefined>>;
|
|
376
|
+
minGraphemes: RuleDef<import("valibot").ObjectSchema<{
|
|
377
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
378
|
+
}, undefined>>;
|
|
379
|
+
maxGraphemes: RuleDef<import("valibot").ObjectSchema<{
|
|
380
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
381
|
+
}, undefined>>;
|
|
382
|
+
notGraphemes: RuleDef<import("valibot").ObjectSchema<{
|
|
383
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
384
|
+
}, undefined>>;
|
|
385
|
+
words: RuleDef<import("valibot").ObjectSchema<{
|
|
386
|
+
readonly locale: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
387
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
388
|
+
}, undefined>>;
|
|
389
|
+
minWords: RuleDef<import("valibot").ObjectSchema<{
|
|
390
|
+
readonly locale: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
391
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
392
|
+
}, undefined>>;
|
|
393
|
+
maxWords: RuleDef<import("valibot").ObjectSchema<{
|
|
394
|
+
readonly locale: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
395
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
396
|
+
}, undefined>>;
|
|
397
|
+
notWords: RuleDef<import("valibot").ObjectSchema<{
|
|
398
|
+
readonly locale: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
399
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
400
|
+
}, undefined>>;
|
|
401
|
+
bytes: RuleDef<import("valibot").ObjectSchema<{
|
|
402
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
403
|
+
}, undefined>>;
|
|
404
|
+
minBytes: RuleDef<import("valibot").ObjectSchema<{
|
|
405
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
406
|
+
}, undefined>>;
|
|
407
|
+
maxBytes: RuleDef<import("valibot").ObjectSchema<{
|
|
408
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
409
|
+
}, undefined>>;
|
|
410
|
+
notBytes: RuleDef<import("valibot").ObjectSchema<{
|
|
411
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
412
|
+
}, undefined>>;
|
|
413
|
+
length: RuleDef<import("valibot").ObjectSchema<{
|
|
414
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
415
|
+
}, undefined>>;
|
|
416
|
+
minLength: RuleDef<import("valibot").ObjectSchema<{
|
|
417
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
418
|
+
}, undefined>>;
|
|
419
|
+
maxLength: RuleDef<import("valibot").ObjectSchema<{
|
|
420
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
421
|
+
}, undefined>>;
|
|
422
|
+
notLength: RuleDef<import("valibot").ObjectSchema<{
|
|
423
|
+
readonly value: import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 0, undefined>]>;
|
|
424
|
+
}, undefined>>;
|
|
425
|
+
};
|
|
426
|
+
export declare const defineRule: <T extends AnyObjectSchema>(def: RuleDef<T>) => RuleDef<T>;
|
|
427
|
+
/** Size and type of a File or Blob. */
|
|
428
|
+
export declare const fileRules: {
|
|
429
|
+
minSize: RuleDef<v.ObjectSchema<{
|
|
430
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
431
|
+
}, undefined>>;
|
|
432
|
+
maxSize: RuleDef<v.ObjectSchema<{
|
|
433
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
434
|
+
}, undefined>>;
|
|
435
|
+
size: RuleDef<v.ObjectSchema<{
|
|
436
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
437
|
+
}, undefined>>;
|
|
438
|
+
notSize: RuleDef<v.ObjectSchema<{
|
|
439
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
440
|
+
}, undefined>>;
|
|
441
|
+
mimeType: RuleDef<v.ObjectSchema<{
|
|
442
|
+
readonly types: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Use a MIME type, such as image/png">]>, undefined>, v.MinLengthAction<string[], 1, "Give at least one MIME type">]>;
|
|
443
|
+
}, undefined>>;
|
|
444
|
+
};
|
|
445
|
+
/** Formats Valibot can check on a string. */
|
|
446
|
+
export declare const formatRules: {
|
|
447
|
+
email: RuleDef<AnyObjectSchema>;
|
|
448
|
+
rfcEmail: RuleDef<AnyObjectSchema>;
|
|
449
|
+
url: RuleDef<AnyObjectSchema>;
|
|
450
|
+
domain: RuleDef<AnyObjectSchema>;
|
|
451
|
+
slug: RuleDef<AnyObjectSchema>;
|
|
452
|
+
uuid: RuleDef<AnyObjectSchema>;
|
|
453
|
+
ulid: RuleDef<AnyObjectSchema>;
|
|
454
|
+
cuid2: RuleDef<AnyObjectSchema>;
|
|
455
|
+
nanoid: RuleDef<AnyObjectSchema>;
|
|
456
|
+
ip: RuleDef<AnyObjectSchema>;
|
|
457
|
+
ipv4: RuleDef<AnyObjectSchema>;
|
|
458
|
+
ipv6: RuleDef<AnyObjectSchema>;
|
|
459
|
+
mac: RuleDef<AnyObjectSchema>;
|
|
460
|
+
mac48: RuleDef<AnyObjectSchema>;
|
|
461
|
+
mac64: RuleDef<AnyObjectSchema>;
|
|
462
|
+
hexColor: RuleDef<AnyObjectSchema>;
|
|
463
|
+
hexadecimal: RuleDef<AnyObjectSchema>;
|
|
464
|
+
octal: RuleDef<AnyObjectSchema>;
|
|
465
|
+
decimal: RuleDef<AnyObjectSchema>;
|
|
466
|
+
digits: RuleDef<AnyObjectSchema>;
|
|
467
|
+
base64: RuleDef<AnyObjectSchema>;
|
|
468
|
+
bic: RuleDef<AnyObjectSchema>;
|
|
469
|
+
creditCard: RuleDef<AnyObjectSchema>;
|
|
470
|
+
imei: RuleDef<AnyObjectSchema>;
|
|
471
|
+
isbn: RuleDef<AnyObjectSchema>;
|
|
472
|
+
isrc: RuleDef<AnyObjectSchema>;
|
|
473
|
+
emoji: RuleDef<AnyObjectSchema>;
|
|
474
|
+
hash: RuleDef<v.ObjectSchema<{
|
|
475
|
+
readonly types: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["md4", "md5", "sha1", "sha256", "sha384", "sha512", "ripemd128", "ripemd160", "tiger128", "tiger160", "tiger192", "crc32", "crc32b", "adler32"], undefined>, undefined>, v.MinLengthAction<("md4" | "md5" | "sha1" | "sha256" | "sha384" | "sha512" | "ripemd128" | "ripemd160" | "tiger128" | "tiger160" | "tiger192" | "crc32" | "crc32b" | "adler32")[], 1, "Pick at least one hash type">]>;
|
|
476
|
+
}, undefined>>;
|
|
477
|
+
};
|
|
478
|
+
/** Characters of a string, or items of an array */
|
|
479
|
+
export declare const lengthRules: {
|
|
480
|
+
length: RuleDef<v.ObjectSchema<{
|
|
481
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
482
|
+
}, undefined>>;
|
|
62
483
|
minLength: RuleDef<v.ObjectSchema<{
|
|
63
484
|
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
64
485
|
}, undefined>>;
|
|
65
486
|
maxLength: RuleDef<v.ObjectSchema<{
|
|
66
487
|
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
67
488
|
}, undefined>>;
|
|
68
|
-
|
|
69
|
-
readonly
|
|
70
|
-
readonly flags: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
489
|
+
notLength: RuleDef<v.ObjectSchema<{
|
|
490
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
71
491
|
}, undefined>>;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Rules that change the value instead of checking it. They run before the required check, so
|
|
495
|
+
* `' '` with `trim` is empty. Their `message` is never shown.
|
|
496
|
+
*/
|
|
497
|
+
export declare const normalizeRules: {
|
|
498
|
+
trim: RuleDef<AnyObjectSchema>;
|
|
499
|
+
trimStart: RuleDef<AnyObjectSchema>;
|
|
500
|
+
trimEnd: RuleDef<AnyObjectSchema>;
|
|
501
|
+
toLowerCase: RuleDef<AnyObjectSchema>;
|
|
502
|
+
toUpperCase: RuleDef<AnyObjectSchema>;
|
|
503
|
+
normalize: RuleDef<v.ObjectSchema<{
|
|
504
|
+
readonly form: v.OptionalSchema<v.PicklistSchema<["NFC", "NFD", "NFKC", "NFKD"], undefined>, undefined>;
|
|
505
|
+
}, undefined>>;
|
|
506
|
+
toMinValue: RuleDef<v.ObjectSchema<{
|
|
75
507
|
readonly value: v.NumberSchema<undefined>;
|
|
76
508
|
}, undefined>>;
|
|
77
|
-
|
|
509
|
+
toMaxValue: RuleDef<v.ObjectSchema<{
|
|
78
510
|
readonly value: v.NumberSchema<undefined>;
|
|
79
511
|
}, undefined>>;
|
|
80
|
-
integer: RuleDef<v.ObjectSchema<{}, undefined>>;
|
|
81
512
|
};
|
|
82
|
-
|
|
513
|
+
/** Checks only numbers have. */
|
|
514
|
+
export declare const numberRules: {
|
|
515
|
+
integer: RuleDef<AnyObjectSchema>;
|
|
516
|
+
safeInteger: RuleDef<AnyObjectSchema>;
|
|
517
|
+
finite: RuleDef<AnyObjectSchema>;
|
|
518
|
+
multipleOf: RuleDef<v.ObjectSchema<{
|
|
519
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.NotValueAction<number, 0, "Can't be 0">]>;
|
|
520
|
+
}, undefined>>;
|
|
521
|
+
};
|
|
522
|
+
export declare const textUnitRules: {
|
|
523
|
+
graphemes: RuleDef<v.ObjectSchema<{
|
|
524
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
525
|
+
}, undefined>>;
|
|
526
|
+
minGraphemes: RuleDef<v.ObjectSchema<{
|
|
527
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
528
|
+
}, undefined>>;
|
|
529
|
+
maxGraphemes: RuleDef<v.ObjectSchema<{
|
|
530
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
531
|
+
}, undefined>>;
|
|
532
|
+
notGraphemes: RuleDef<v.ObjectSchema<{
|
|
533
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
534
|
+
}, undefined>>;
|
|
535
|
+
words: RuleDef<v.ObjectSchema<{
|
|
536
|
+
readonly locale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
537
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
538
|
+
}, undefined>>;
|
|
539
|
+
minWords: RuleDef<v.ObjectSchema<{
|
|
540
|
+
readonly locale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
541
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
542
|
+
}, undefined>>;
|
|
543
|
+
maxWords: RuleDef<v.ObjectSchema<{
|
|
544
|
+
readonly locale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
545
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
546
|
+
}, undefined>>;
|
|
547
|
+
notWords: RuleDef<v.ObjectSchema<{
|
|
548
|
+
readonly locale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Use a language tag, such as en or sr-Latn">]>, undefined>;
|
|
549
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
550
|
+
}, undefined>>;
|
|
551
|
+
bytes: RuleDef<v.ObjectSchema<{
|
|
552
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
553
|
+
}, undefined>>;
|
|
554
|
+
minBytes: RuleDef<v.ObjectSchema<{
|
|
555
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
556
|
+
}, undefined>>;
|
|
557
|
+
maxBytes: RuleDef<v.ObjectSchema<{
|
|
558
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
559
|
+
}, undefined>>;
|
|
560
|
+
notBytes: RuleDef<v.ObjectSchema<{
|
|
561
|
+
readonly value: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
562
|
+
}, undefined>>;
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Field keys this package owns. A field type's props can't use them.
|
|
566
|
+
*/
|
|
567
|
+
export declare const RESERVED_FIELD_KEYS: readonly ["name", "type", "label", "description", "placeholder", "default", "required", "rules", "ui"];
|
|
568
|
+
/**
|
|
569
|
+
* Rule keys this package own. A rule's params can't use them.
|
|
570
|
+
*/
|
|
571
|
+
export declare const RESERVED_RULE_KEYS: readonly ["rule", "message"];
|
|
572
|
+
export type { AnyAction, AnyObjectSchema, AnySchema, BuildContext, DefinitionIssue, DefinitionIssueCode, DefinitionPath, FieldTypeDef, FieldWithProps, JsonField, JsonForm, JsonRule, KindDef, MessageContext, RuleCategory, RuleDef, RuleMeta, RuleStage, SchemaBuilderOptions, ValidateResult, ValueKind };
|
|
83
573
|
//# sourceMappingURL=index.d.ts.map
|