@strictly/define 0.0.13 → 0.0.14
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/.out/tsconfig.tsbuildinfo +1 -1
- package/.out/types/builders.d.ts +21 -20
- package/.out/types/builders.js +8 -5
- package/.out/types/flattened_types_of_validating_type.d.ts +4 -4
- package/.out/types/flattened_validators_of_validating_type.d.ts +7 -6
- package/.out/types/specs/flattened_validators_of_validating_type.tests.js +2 -2
- package/.out/types/validating_definitions.d.ts +14 -12
- package/.out/types/validating_type_def_with_error.d.ts +13 -13
- package/.out/validation/validator.d.ts +1 -0
- package/.out/validation/validator.js +4 -0
- package/.out/validation/validators/composite_validator.d.ts +7 -0
- package/.out/validation/validators/composite_validator.js +32 -0
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-check-types.log +1 -1
- package/.turbo/turbo-release$colon$exports.log +1 -1
- package/dist/index.cjs +45 -5
- package/dist/index.d.cts +79 -76
- package/dist/index.d.ts +79 -76
- package/dist/index.js +44 -5
- package/package.json +1 -1
- package/types/builders.ts +46 -26
- package/types/flattened_types_of_validating_type.ts +5 -2
- package/types/flattened_validators_of_validating_type.ts +7 -9
- package/types/specs/builder.tests.ts +31 -31
- package/types/specs/flattened_validators_of_validating_type.tests.ts +7 -7
- package/types/validating_definitions.ts +27 -15
- package/types/validating_type_def_with_error.ts +23 -23
- package/validation/validator.ts +21 -0
- package/validation/validators/composite_validator.ts +42 -0
package/dist/index.d.cts
CHANGED
|
@@ -198,50 +198,75 @@ declare function flattenJsonValueToTypePathsOf<T extends Type, R extends Record<
|
|
|
198
198
|
|
|
199
199
|
declare function flattenTypesOfType<T extends StrictType>(t: T): Record<string, Type>;
|
|
200
200
|
|
|
201
|
+
type Annotations = {
|
|
202
|
+
readonly required: boolean;
|
|
203
|
+
readonly readonly: boolean;
|
|
204
|
+
};
|
|
205
|
+
type FunctionalValidator<V = any, E = any, ValuePath extends string = any, Context = any> = (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
206
|
+
type AnnotatedValidator<V = any, E = any, ValuePath extends string = any, Context = any> = {
|
|
207
|
+
readonly validate: (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
208
|
+
readonly annotations: (valuePath: ValuePath, context: Context) => Annotations;
|
|
209
|
+
};
|
|
210
|
+
type Validator<V = any, E = any, ValuePath extends string = any, Context = any> = FunctionalValidator<V, E, ValuePath, Context> | AnnotatedValidator<V, E, ValuePath, Context>;
|
|
211
|
+
type ErrorOfValidator<V extends Validator> = V extends Validator<infer _V, infer E> ? E : never;
|
|
212
|
+
type ValidationError<Type extends string, Data = {}> = Simplify<{
|
|
213
|
+
type: Type;
|
|
214
|
+
} & Data>;
|
|
215
|
+
declare function isFunctionalValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is FunctionalValidator<V, E, ValuePath, Context>;
|
|
216
|
+
declare function isAnnotatedValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is AnnotatedValidator<V, E, ValuePath, Context>;
|
|
217
|
+
declare function validate<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, v: V, valuePath: ValuePath, context: Context): E | null;
|
|
218
|
+
declare function mergeValidators<V = any, E1 = any, E2 = any, ValuePath extends string = any, C1 = any, C2 = any>(v1: Validator<V, E1, ValuePath, C1>, v2: Validator<V, E2, ValuePath, C2>): Validator<V, E1 | E2, ValuePath, C1 & C2>;
|
|
219
|
+
declare function annotations<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, valuePath: ValuePath, context: Context): Annotations;
|
|
220
|
+
declare function mergeAnnotations(a1: Annotations, a2: Annotations): {
|
|
221
|
+
readonly: boolean;
|
|
222
|
+
required: boolean;
|
|
223
|
+
};
|
|
224
|
+
|
|
201
225
|
type ValidatingType<T extends ValidatingTypeDef = ValidatingTypeDef> = {
|
|
202
226
|
readonly definition: T;
|
|
203
227
|
};
|
|
204
|
-
type Rule<E = any, V = any> = (v: V) => E | null;
|
|
205
228
|
type ErrorOfValidatingTypeDef<T extends ValidatingTypeDef> = T extends ValidatingTypeDef<infer E> ? E : never;
|
|
206
|
-
type
|
|
229
|
+
type ContextOfValidatingTypeDef<T extends ValidatingTypeDef> = T extends ValidatingTypeDef<infer _E, infer C> ? C : never;
|
|
230
|
+
type Rule<E, C, V = any> = FunctionalValidator<V, E, string, C>;
|
|
231
|
+
type ValidatingTypeDef<E = any, C = any> = ValidatingLiteralTypeDef<E, C> | ValidatingListTypeDef<E, C> | ValidatingRecordTypeDef<E, C> | ValidatingObjectTypeDef<E, C> | ValidatingUnionTypeDef<E, C>;
|
|
207
232
|
type AnyTypeDef = any;
|
|
208
|
-
type ValidatingLiteralTypeDef<E = any, V = any> = {
|
|
233
|
+
type ValidatingLiteralTypeDef<E = any, C = any, V = any> = {
|
|
209
234
|
readonly type: TypeDefType.Literal;
|
|
210
235
|
readonly valuePrototype: [V];
|
|
211
|
-
readonly rule: Rule<E>;
|
|
236
|
+
readonly rule: Rule<E, C>;
|
|
212
237
|
readonly required: boolean;
|
|
213
238
|
readonly readonly: boolean;
|
|
214
239
|
};
|
|
215
|
-
type ValidatingListTypeDef<E = any, Ele extends ValidatingTypeDef = AnyTypeDef> = {
|
|
240
|
+
type ValidatingListTypeDef<E = any, C = any, Ele extends ValidatingTypeDef = AnyTypeDef> = {
|
|
216
241
|
readonly type: TypeDefType.List;
|
|
217
242
|
readonly elements: Ele;
|
|
218
|
-
readonly rule: Rule<E>;
|
|
243
|
+
readonly rule: Rule<E, C>;
|
|
219
244
|
readonly required: boolean;
|
|
220
245
|
readonly readonly: boolean;
|
|
221
246
|
};
|
|
222
|
-
type ValidatingRecordTypeDef<E = any, K extends RecordKeyType = RecordKeyType, V extends ValidatingTypeDef | undefined = AnyTypeDef> = {
|
|
247
|
+
type ValidatingRecordTypeDef<E = any, C = any, K extends RecordKeyType = RecordKeyType, V extends ValidatingTypeDef | undefined = AnyTypeDef> = {
|
|
223
248
|
readonly type: TypeDefType.Record;
|
|
224
249
|
readonly keyPrototype: K;
|
|
225
250
|
readonly valueTypeDef: V;
|
|
226
|
-
readonly rule: Rule<E>;
|
|
251
|
+
readonly rule: Rule<E, C>;
|
|
227
252
|
readonly required: boolean;
|
|
228
253
|
readonly readonly: boolean;
|
|
229
254
|
};
|
|
230
255
|
type ValidatingObjectTypeDefFields = {
|
|
231
256
|
[Key: ObjectFieldKey]: AnyTypeDef;
|
|
232
257
|
};
|
|
233
|
-
type ValidatingObjectTypeDef<E = any, Fields extends ValidatingObjectTypeDefFields = ValidatingObjectTypeDefFields> = {
|
|
258
|
+
type ValidatingObjectTypeDef<E = any, C = any, Fields extends ValidatingObjectTypeDefFields = ValidatingObjectTypeDefFields> = {
|
|
234
259
|
readonly type: TypeDefType.Object;
|
|
235
260
|
readonly fields: Fields;
|
|
236
|
-
readonly rule: Rule<E>;
|
|
261
|
+
readonly rule: Rule<E, C>;
|
|
237
262
|
readonly required: boolean;
|
|
238
263
|
readonly readonly: boolean;
|
|
239
264
|
};
|
|
240
|
-
type ValidatingUnionTypeDef<E = any, D extends string | null = string | null, U extends Readonly<Record<UnionKey, AnyTypeDef>> = Readonly<Record<UnionKey, AnyTypeDef>>> = {
|
|
265
|
+
type ValidatingUnionTypeDef<E = any, C = any, D extends string | null = string | null, U extends Readonly<Record<UnionKey, AnyTypeDef>> = Readonly<Record<UnionKey, AnyTypeDef>>> = {
|
|
241
266
|
readonly discriminator: D;
|
|
242
267
|
readonly type: TypeDefType.Union;
|
|
243
268
|
readonly unions: U;
|
|
244
|
-
readonly rule: Rule<E>;
|
|
269
|
+
readonly rule: Rule<E, C>;
|
|
245
270
|
readonly required: boolean;
|
|
246
271
|
readonly readonly: boolean;
|
|
247
272
|
};
|
|
@@ -254,45 +279,22 @@ type InternalFlattenedTypeDefsOfChildren<T extends TypeDef, SegmentOverride exte
|
|
|
254
279
|
type InternalFlattenedTypeDefsOfLiteralChildren = {};
|
|
255
280
|
type InternalFlattenedTypeDefsOfListChildren<T extends ValidatingListTypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = InternalFlattenedTypeDefsOf<T['elements'], SegmentOverride, PathOf<Path, number, SegmentOverride>, '', Depth>;
|
|
256
281
|
type InternalFlattenedTypeDefsOfRecordChildren<T extends ValidatingRecordTypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = InternalFlattenedTypeDefsOf<T['valueTypeDef'], SegmentOverride, PathOf<Path, T['keyPrototype'], SegmentOverride>, '', Depth>;
|
|
257
|
-
type InternalFlattenedTypeDefsOfObjectChildren<T extends ValidatingObjectTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingObjectTypeDef<infer _E, infer Fields> ? keyof Fields extends string ? UnionToIntersection<{
|
|
258
|
-
readonly [K in keyof Fields]-?: undefined extends Fields[K] ? InternalFlattenedTypeDefsOf<ValidatingUnionTypeDef<ErrorOfValidatingTypeDef<Exclude<Fields[K], undefined>>, null, {
|
|
282
|
+
type InternalFlattenedTypeDefsOfObjectChildren<T extends ValidatingObjectTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingObjectTypeDef<infer _E, infer _C, infer Fields> ? keyof Fields extends string ? UnionToIntersection<{
|
|
283
|
+
readonly [K in keyof Fields]-?: undefined extends Fields[K] ? InternalFlattenedTypeDefsOf<ValidatingUnionTypeDef<ErrorOfValidatingTypeDef<Exclude<Fields[K], undefined>>, ContextOfValidatingTypeDef<Exclude<Fields[K], undefined>>, null, {
|
|
259
284
|
readonly '0': Exclude<Fields[K], undefined>;
|
|
260
285
|
readonly '1': ValidatingLiteralTypeDef<undefined>;
|
|
261
286
|
}>, SegmentOverride, PathOf<Path, `${Qualifier}${K}`, null>, '', Depth> : InternalFlattenedTypeDefsOf<Exclude<Fields[K], undefined>, SegmentOverride, PathOf<Path, `${Qualifier}${K}`, null>, '', Depth>;
|
|
262
287
|
}[keyof Fields]> : never : never;
|
|
263
|
-
type InternalFlattenedTypeDefsOfUnionChildren<T extends ValidatingUnionTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingUnionTypeDef<infer _E, infer D, infer Unions> ? keyof Unions extends string ? D extends null ? UnionToIntersection<{
|
|
288
|
+
type InternalFlattenedTypeDefsOfUnionChildren<T extends ValidatingUnionTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingUnionTypeDef<infer _E, infer _C, infer D, infer Unions> ? keyof Unions extends string ? D extends null ? UnionToIntersection<{
|
|
264
289
|
readonly [K in keyof Unions]: InternalFlattenedTypeDefsOfChildren<Unions[K], SegmentOverride, Path, '', Depth>;
|
|
265
290
|
}[keyof Unions]> : UnionToIntersection<{
|
|
266
291
|
readonly [K in keyof Unions]: InternalFlattenedTypeDefsOfChildren<Unions[K], SegmentOverride, Path, `${Qualifier}${K}:`, Depth>;
|
|
267
292
|
}[keyof Unions]> : never : never;
|
|
268
293
|
|
|
269
|
-
type
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
type FunctionalValidator<V = any, E = any, ValuePath extends string = any, Context = any> = (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
274
|
-
type AnnotatedValidator<V = any, E = any, ValuePath extends string = any, Context = any> = {
|
|
275
|
-
readonly validate: (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
276
|
-
readonly annotations: (valuePath: ValuePath, context: Context) => Annotations;
|
|
277
|
-
};
|
|
278
|
-
type Validator<V = any, E = any, ValuePath extends string = any, Context = any> = FunctionalValidator<V, E, ValuePath, Context> | AnnotatedValidator<V, E, ValuePath, Context>;
|
|
279
|
-
type ErrorOfValidator<V extends Validator> = V extends Validator<infer _V, infer E> ? E : never;
|
|
280
|
-
type ValidationError<Type extends string, Data = {}> = Simplify<{
|
|
281
|
-
type: Type;
|
|
282
|
-
} & Data>;
|
|
283
|
-
declare function isFunctionalValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is FunctionalValidator<V, E, ValuePath, Context>;
|
|
284
|
-
declare function isAnnotatedValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is AnnotatedValidator<V, E, ValuePath, Context>;
|
|
285
|
-
declare function validate<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, v: V, valuePath: ValuePath, context: Context): E | null;
|
|
286
|
-
declare function annotations<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, valuePath: ValuePath, context: Context): Annotations;
|
|
287
|
-
declare function mergeAnnotations(a1: Annotations, a2: Annotations): {
|
|
288
|
-
readonly: boolean;
|
|
289
|
-
required: boolean;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string, Context> = T extends ValidatingTypeDef<infer E> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, Context> : never;
|
|
293
|
-
type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>, Context = ValueOfType<ReadonlyTypeOfType<T>>> = {
|
|
294
|
-
[K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K], Context>;
|
|
295
|
-
};
|
|
294
|
+
type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string> = T extends ValidatingTypeDef<infer E, infer C> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, C> : never;
|
|
295
|
+
type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>> = Simplify<{
|
|
296
|
+
[K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K]>;
|
|
297
|
+
}>;
|
|
296
298
|
|
|
297
299
|
declare function flattenValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfValidatingType<T, '*'>>(type: T): FlattenedValidatorsOfValidatingType<T, TypePathsToValuePaths, FlattenedTypes>;
|
|
298
300
|
|
|
@@ -352,54 +354,54 @@ type TypeDefOfUnionTypeDef<T extends UnionTypeDef> = T extends UnionTypeDef<infe
|
|
|
352
354
|
};
|
|
353
355
|
} : never;
|
|
354
356
|
|
|
355
|
-
type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E> : never;
|
|
356
|
-
type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2> = T extends ValidatingLiteralTypeDef<infer E1, infer V> ? {
|
|
357
|
+
type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E, C> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E, C> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E, C> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E, C> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E, C> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E, C> : never;
|
|
358
|
+
type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2, C2> = T extends ValidatingLiteralTypeDef<infer E1, infer C1, infer V> ? {
|
|
357
359
|
readonly type: TypeDefType.Literal;
|
|
358
360
|
readonly valuePrototype: [V];
|
|
359
|
-
readonly rule: Rule<E1 | E2>;
|
|
361
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
360
362
|
readonly required: boolean;
|
|
361
363
|
readonly readonly: boolean;
|
|
362
364
|
} : never;
|
|
363
|
-
type ValidatingListTypeDefWithError<T extends ValidatingListTypeDef, E2> = T extends ValidatingListTypeDef<infer E1, infer E> ? IsFieldReadonly<T, 'elements'> extends true ? {
|
|
365
|
+
type ValidatingListTypeDefWithError<T extends ValidatingListTypeDef, E2, C2> = T extends ValidatingListTypeDef<infer E1, infer C1, infer E> ? IsFieldReadonly<T, 'elements'> extends true ? {
|
|
364
366
|
readonly type: TypeDefType.List;
|
|
365
367
|
readonly elements: E;
|
|
366
|
-
readonly rule: Rule<E1 | E2>;
|
|
368
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
367
369
|
readonly required: boolean;
|
|
368
370
|
readonly readonly: boolean;
|
|
369
371
|
} : {
|
|
370
372
|
readonly type: TypeDefType.List;
|
|
371
373
|
elements: E;
|
|
372
|
-
readonly rule: Rule<E1 | E2>;
|
|
374
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
373
375
|
readonly required: boolean;
|
|
374
376
|
readonly readonly: boolean;
|
|
375
377
|
} : never;
|
|
376
|
-
type ValidatingRecordTypeDefWithError<T extends ValidatingRecordTypeDef, E2> = T extends ValidatingRecordTypeDef<infer E1, infer K, infer V> ? IsFieldReadonly<T, 'valueTypeDef'> extends true ? {
|
|
378
|
+
type ValidatingRecordTypeDefWithError<T extends ValidatingRecordTypeDef, E2, C2> = T extends ValidatingRecordTypeDef<infer E1, infer C1, infer K, infer V> ? IsFieldReadonly<T, 'valueTypeDef'> extends true ? {
|
|
377
379
|
readonly type: TypeDefType.Record;
|
|
378
380
|
readonly keyPrototype: K;
|
|
379
381
|
readonly valueTypeDef: V;
|
|
380
|
-
readonly rule: Rule<E1 | E2>;
|
|
382
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
381
383
|
readonly required: boolean;
|
|
382
384
|
readonly readonly: boolean;
|
|
383
385
|
} : {
|
|
384
386
|
readonly type: TypeDefType.Record;
|
|
385
387
|
readonly keyPrototype: K;
|
|
386
388
|
valueTypeDef: V;
|
|
387
|
-
readonly rule: Rule<E1 | E2>;
|
|
389
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
388
390
|
readonly required: boolean;
|
|
389
391
|
readonly readonly: boolean;
|
|
390
392
|
} : never;
|
|
391
|
-
type ValidatingObjectTypeDefWithError<T extends ValidatingObjectTypeDef, E2> = T extends ValidatingObjectTypeDef<infer E1, infer Fields> ? {
|
|
393
|
+
type ValidatingObjectTypeDefWithError<T extends ValidatingObjectTypeDef, E2, C2> = T extends ValidatingObjectTypeDef<infer E1, infer C1, infer Fields> ? {
|
|
392
394
|
readonly type: TypeDefType.Object;
|
|
393
395
|
readonly fields: Fields;
|
|
394
|
-
readonly rule: Rule<E1 | E2>;
|
|
396
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
395
397
|
readonly required: boolean;
|
|
396
398
|
readonly readonly: boolean;
|
|
397
399
|
} : never;
|
|
398
|
-
type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2> = T extends ValidatingUnionTypeDef<infer E1, infer D, infer U> ? {
|
|
400
|
+
type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2, C2> = T extends ValidatingUnionTypeDef<infer E1, infer C1, infer D, infer U> ? {
|
|
399
401
|
readonly type: TypeDefType.Union;
|
|
400
402
|
readonly discriminator: D;
|
|
401
403
|
readonly unions: U;
|
|
402
|
-
readonly rule: Rule<E1 | E2>;
|
|
404
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
403
405
|
readonly required: boolean;
|
|
404
406
|
readonly readonly: boolean;
|
|
405
407
|
} : never;
|
|
@@ -407,7 +409,8 @@ type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2> = T e
|
|
|
407
409
|
declare class TypeDefBuilder<T extends ValidatingTypeDef> implements ValidatingType<T> {
|
|
408
410
|
readonly definition: T;
|
|
409
411
|
constructor(definition: T);
|
|
410
|
-
enforce<E2
|
|
412
|
+
enforce<E2, C2>(): TypeDefBuilder<ValidatingTypeDefWithError<T, E2, C2>>;
|
|
413
|
+
enforce<E2, C2>(rule: Validator<ValueOfType<Type<T>>, E2, string, C2>): TypeDefBuilder<ValidatingTypeDefWithError<T, E2, C2>>;
|
|
411
414
|
required(): TypeDefBuilder<T>;
|
|
412
415
|
readonly(): TypeDefBuilder<T>;
|
|
413
416
|
get _type(): TypeOfType<Type<T>>;
|
|
@@ -447,29 +450,29 @@ declare class RecordTypeDefBuilder<T extends ValidatingRecordTypeDef> extends Ty
|
|
|
447
450
|
readonly readonly: boolean;
|
|
448
451
|
}>;
|
|
449
452
|
}
|
|
450
|
-
declare class ObjectTypeDefBuilder<E, Fields extends Readonly<Record<ObjectFieldKey, ValidatingTypeDef>> = {}> extends TypeDefBuilder<ValidatingObjectTypeDef<E, Fields>> {
|
|
451
|
-
field<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Record<Name, T>>;
|
|
452
|
-
field<Name extends string, T extends ValidatingTypeDef, RequiredError>(name: Name, { definition }: Type<T>, rule: Rule<RequiredError, ValueOfTypeDef<T>>): ObjectTypeDefBuilder<E, Fields & Record<Name, ValidatingTypeDefWithError<T, RequiredError>>>;
|
|
453
|
-
readonlyField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Readonly<Record<Name, T>>>;
|
|
454
|
-
optionalField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Partial<Record<Name, T>>>;
|
|
455
|
-
readonlyOptionalField<Name extends string, T extends TypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Partial<Readonly<Record<Name, T>>>>;
|
|
453
|
+
declare class ObjectTypeDefBuilder<E, C, Fields extends Readonly<Record<ObjectFieldKey, ValidatingTypeDef>> = {}> extends TypeDefBuilder<ValidatingObjectTypeDef<E, C, Fields>> {
|
|
454
|
+
field<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Record<Name, T>>;
|
|
455
|
+
field<Name extends string, T extends ValidatingTypeDef, RequiredError, C2>(name: Name, { definition }: Type<T>, rule: Rule<RequiredError, ValueOfTypeDef<T>>): ObjectTypeDefBuilder<E, C & C2, Fields & Record<Name, ValidatingTypeDefWithError<T, RequiredError, C & C2>>>;
|
|
456
|
+
readonlyField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Readonly<Record<Name, T>>>;
|
|
457
|
+
optionalField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Partial<Record<Name, T>>>;
|
|
458
|
+
readonlyOptionalField<Name extends string, T extends TypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Partial<Readonly<Record<Name, T>>>>;
|
|
456
459
|
}
|
|
457
|
-
declare class UnionTypeDefBuilder<E, D extends string | null, U extends Record<UnionKey, TypeDef>> extends TypeDefBuilder<ValidatingUnionTypeDef<E, D, U>> {
|
|
458
|
-
or<K extends Exclude<UnionKey, keyof U>, T extends TypeDef>(k: K, { definition: typeDef, }: Type<T>): UnionTypeDefBuilder<E, D, Readonly<Record<K, T>> & U>;
|
|
460
|
+
declare class UnionTypeDefBuilder<E, C, D extends string | null, U extends Record<UnionKey, TypeDef>> extends TypeDefBuilder<ValidatingUnionTypeDef<E, C, D, U>> {
|
|
461
|
+
or<K extends Exclude<UnionKey, keyof U>, T extends TypeDef>(k: K, { definition: typeDef, }: Type<T>): UnionTypeDefBuilder<E, C, D, Readonly<Record<K, T>> & U>;
|
|
459
462
|
}
|
|
460
|
-
declare function literal<T>(value?: [T]): TypeDefBuilder<ValidatingLiteralTypeDef<never, T>>;
|
|
461
|
-
declare const stringType: TypeDefBuilder<ValidatingLiteralTypeDef<never, string>>;
|
|
462
|
-
declare const numberType: TypeDefBuilder<ValidatingLiteralTypeDef<never, number>>;
|
|
463
|
-
declare const booleanType: TypeDefBuilder<ValidatingLiteralTypeDef<never, boolean>>;
|
|
464
|
-
declare const nullType: TypeDefBuilder<ValidatingLiteralTypeDef<never, null>>;
|
|
465
|
-
declare function nullable<T extends ValidatingTypeDef>(nonNullable: ValidatingType<T>): UnionTypeDefBuilder<never, null, {
|
|
463
|
+
declare function literal<T>(value?: [T]): TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, T>>;
|
|
464
|
+
declare const stringType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, string>>;
|
|
465
|
+
declare const numberType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, number>>;
|
|
466
|
+
declare const booleanType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, boolean>>;
|
|
467
|
+
declare const nullType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, null>>;
|
|
468
|
+
declare function nullable<T extends ValidatingTypeDef>(nonNullable: ValidatingType<T>): UnionTypeDefBuilder<never, {}, null, {
|
|
466
469
|
readonly ['0']: T;
|
|
467
|
-
readonly ['1']: ValidatingLiteralTypeDef<never, null>;
|
|
470
|
+
readonly ['1']: ValidatingLiteralTypeDef<never, {}, null>;
|
|
468
471
|
}>;
|
|
469
472
|
declare function list<T extends ValidatingTypeDef>(elements: ValidatingType<T>): ListTypeDefBuilder<{
|
|
470
473
|
readonly type: TypeDefType.List;
|
|
471
474
|
elements: T;
|
|
472
|
-
readonly rule: Rule<never>;
|
|
475
|
+
readonly rule: Rule<never, {}>;
|
|
473
476
|
readonly readonly: boolean;
|
|
474
477
|
readonly required: boolean;
|
|
475
478
|
}>;
|
|
@@ -477,13 +480,13 @@ declare function record<V extends ValidatingType, K extends RecordKeyType>({ def
|
|
|
477
480
|
readonly type: TypeDefType.Record;
|
|
478
481
|
readonly keyPrototype: K;
|
|
479
482
|
valueTypeDef: V["definition"];
|
|
480
|
-
readonly rule: Rule<never>;
|
|
483
|
+
readonly rule: Rule<never, {}>;
|
|
481
484
|
readonly readonly: boolean;
|
|
482
485
|
readonly required: boolean;
|
|
483
486
|
}>;
|
|
484
487
|
declare function object(): ObjectTypeDefBuilder<never, {}>;
|
|
485
|
-
declare function union<D extends null>(): UnionTypeDefBuilder<never, D, {}>;
|
|
486
|
-
declare function union<D extends string>(discriminator: D): UnionTypeDefBuilder<never, D, {}>;
|
|
488
|
+
declare function union<D extends null>(): UnionTypeDefBuilder<never, {}, D, {}>;
|
|
489
|
+
declare function union<D extends string>(discriminator: D): UnionTypeDefBuilder<never, {}, D, {}>;
|
|
487
490
|
|
|
488
491
|
type PathsOfType<T extends Type, SegmentOverride extends string | null = null, Prefix extends string = '$'> = InternalJsonPathsOf<T['definition'], Prefix, SegmentOverride, StartingDepth>;
|
|
489
492
|
type InternalJsonPathsOf<F extends TypeDef, Prefix extends string, SegmentOverride extends string | null, Depth extends number, NextDepth extends number = Depths[Depth]> = InternalJsonPathsOfChildren<F, Prefix, SegmentOverride, '', NextDepth> | Prefix;
|
|
@@ -595,4 +598,4 @@ type ValidatorsOfValues<FlattenedValues extends Readonly<Record<string, any>>, T
|
|
|
595
598
|
readonly [K in keyof FlattenedValues]: Validator<FlattenedValues[K], any, TypePathsToValuePaths[K], Context>;
|
|
596
599
|
};
|
|
597
600
|
|
|
598
|
-
export { type Accessor, type AnnotatedValidator, type Annotations, type AnyValueType, DefinedValidator, type ErrorOfValidator, type FlattenedAccessorsOfType, type FlattenedTypesOfType, type FlattenedValuesOfType, type FunctionalValidator, type InternalJsonPathsOf, type IsStrictUnion, type ListTypeDef, type LiteralTypeDef, type Mapper, type MinimumStringLengthValidationError, MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, type MobxObservable, type MobxValueOfType, type NonMobxObservable, type ObjectFieldKey, type ObjectTypeDef, type ObjectTypeDefFields, OptionalValidatorProxy, type PathsOfType, type ReadonlyOfTypeDef, type ReadonlyTypeOfType, type RecordKeyType, type RecordTypeDef, type RegexpValidationError, RegexpValidationErrorType, RegexpValidator, type Setter, type StrictListTypeDef, type StrictLiteralTypeDef, type StrictObjectTypeDef, type StrictObjectTypeDefFields, type StrictRecordTypeDef, type StrictType, type StrictTypeDef, type StrictUnionTypeDef, type Type, type TypeDef, TypeDefType, type UnionKey, type UnionTypeDef, type ValidationError, type Validator, type ValidatorsOfValues, type ValueOfType, type ValueOfTypeDef, type ValueToTypePathsOfType, type ValueTypesOfDiscriminatedUnion, annotations, booleanType, copy, flattenAccessorsOfType, flattenJsonValueToTypePathsOf, flattenTypesOfType, flattenValidatorsOfValidatingType, flattenValueTo, flattenValuesOfType, getUnionTypeDef, isAnnotatedValidator, isFunctionalValidator, jsonPath, jsonPathPop, jsonPathPrefix, jsonPathUnprefix, list, literal, mergeAnnotations, mobxCopy, nullType, nullable, numberType, object, record, stringType, union, validate, valuePathToTypePath };
|
|
601
|
+
export { type Accessor, type AnnotatedValidator, type Annotations, type AnyValueType, DefinedValidator, type ErrorOfValidator, type FlattenedAccessorsOfType, type FlattenedTypesOfType, type FlattenedValuesOfType, type FunctionalValidator, type InternalJsonPathsOf, type IsStrictUnion, type ListTypeDef, type LiteralTypeDef, type Mapper, type MinimumStringLengthValidationError, MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, type MobxObservable, type MobxValueOfType, type NonMobxObservable, type ObjectFieldKey, type ObjectTypeDef, type ObjectTypeDefFields, OptionalValidatorProxy, type PathsOfType, type ReadonlyOfTypeDef, type ReadonlyTypeOfType, type RecordKeyType, type RecordTypeDef, type RegexpValidationError, RegexpValidationErrorType, RegexpValidator, type Setter, type StrictListTypeDef, type StrictLiteralTypeDef, type StrictObjectTypeDef, type StrictObjectTypeDefFields, type StrictRecordTypeDef, type StrictType, type StrictTypeDef, type StrictUnionTypeDef, type Type, type TypeDef, TypeDefType, type UnionKey, type UnionTypeDef, type ValidationError, type Validator, type ValidatorsOfValues, type ValueOfType, type ValueOfTypeDef, type ValueToTypePathsOfType, type ValueTypesOfDiscriminatedUnion, annotations, booleanType, copy, flattenAccessorsOfType, flattenJsonValueToTypePathsOf, flattenTypesOfType, flattenValidatorsOfValidatingType, flattenValueTo, flattenValuesOfType, getUnionTypeDef, isAnnotatedValidator, isFunctionalValidator, jsonPath, jsonPathPop, jsonPathPrefix, jsonPathUnprefix, list, literal, mergeAnnotations, mergeValidators, mobxCopy, nullType, nullable, numberType, object, record, stringType, union, validate, valuePathToTypePath };
|
package/dist/index.d.ts
CHANGED
|
@@ -198,50 +198,75 @@ declare function flattenJsonValueToTypePathsOf<T extends Type, R extends Record<
|
|
|
198
198
|
|
|
199
199
|
declare function flattenTypesOfType<T extends StrictType>(t: T): Record<string, Type>;
|
|
200
200
|
|
|
201
|
+
type Annotations = {
|
|
202
|
+
readonly required: boolean;
|
|
203
|
+
readonly readonly: boolean;
|
|
204
|
+
};
|
|
205
|
+
type FunctionalValidator<V = any, E = any, ValuePath extends string = any, Context = any> = (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
206
|
+
type AnnotatedValidator<V = any, E = any, ValuePath extends string = any, Context = any> = {
|
|
207
|
+
readonly validate: (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
208
|
+
readonly annotations: (valuePath: ValuePath, context: Context) => Annotations;
|
|
209
|
+
};
|
|
210
|
+
type Validator<V = any, E = any, ValuePath extends string = any, Context = any> = FunctionalValidator<V, E, ValuePath, Context> | AnnotatedValidator<V, E, ValuePath, Context>;
|
|
211
|
+
type ErrorOfValidator<V extends Validator> = V extends Validator<infer _V, infer E> ? E : never;
|
|
212
|
+
type ValidationError<Type extends string, Data = {}> = Simplify<{
|
|
213
|
+
type: Type;
|
|
214
|
+
} & Data>;
|
|
215
|
+
declare function isFunctionalValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is FunctionalValidator<V, E, ValuePath, Context>;
|
|
216
|
+
declare function isAnnotatedValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is AnnotatedValidator<V, E, ValuePath, Context>;
|
|
217
|
+
declare function validate<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, v: V, valuePath: ValuePath, context: Context): E | null;
|
|
218
|
+
declare function mergeValidators<V = any, E1 = any, E2 = any, ValuePath extends string = any, C1 = any, C2 = any>(v1: Validator<V, E1, ValuePath, C1>, v2: Validator<V, E2, ValuePath, C2>): Validator<V, E1 | E2, ValuePath, C1 & C2>;
|
|
219
|
+
declare function annotations<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, valuePath: ValuePath, context: Context): Annotations;
|
|
220
|
+
declare function mergeAnnotations(a1: Annotations, a2: Annotations): {
|
|
221
|
+
readonly: boolean;
|
|
222
|
+
required: boolean;
|
|
223
|
+
};
|
|
224
|
+
|
|
201
225
|
type ValidatingType<T extends ValidatingTypeDef = ValidatingTypeDef> = {
|
|
202
226
|
readonly definition: T;
|
|
203
227
|
};
|
|
204
|
-
type Rule<E = any, V = any> = (v: V) => E | null;
|
|
205
228
|
type ErrorOfValidatingTypeDef<T extends ValidatingTypeDef> = T extends ValidatingTypeDef<infer E> ? E : never;
|
|
206
|
-
type
|
|
229
|
+
type ContextOfValidatingTypeDef<T extends ValidatingTypeDef> = T extends ValidatingTypeDef<infer _E, infer C> ? C : never;
|
|
230
|
+
type Rule<E, C, V = any> = FunctionalValidator<V, E, string, C>;
|
|
231
|
+
type ValidatingTypeDef<E = any, C = any> = ValidatingLiteralTypeDef<E, C> | ValidatingListTypeDef<E, C> | ValidatingRecordTypeDef<E, C> | ValidatingObjectTypeDef<E, C> | ValidatingUnionTypeDef<E, C>;
|
|
207
232
|
type AnyTypeDef = any;
|
|
208
|
-
type ValidatingLiteralTypeDef<E = any, V = any> = {
|
|
233
|
+
type ValidatingLiteralTypeDef<E = any, C = any, V = any> = {
|
|
209
234
|
readonly type: TypeDefType.Literal;
|
|
210
235
|
readonly valuePrototype: [V];
|
|
211
|
-
readonly rule: Rule<E>;
|
|
236
|
+
readonly rule: Rule<E, C>;
|
|
212
237
|
readonly required: boolean;
|
|
213
238
|
readonly readonly: boolean;
|
|
214
239
|
};
|
|
215
|
-
type ValidatingListTypeDef<E = any, Ele extends ValidatingTypeDef = AnyTypeDef> = {
|
|
240
|
+
type ValidatingListTypeDef<E = any, C = any, Ele extends ValidatingTypeDef = AnyTypeDef> = {
|
|
216
241
|
readonly type: TypeDefType.List;
|
|
217
242
|
readonly elements: Ele;
|
|
218
|
-
readonly rule: Rule<E>;
|
|
243
|
+
readonly rule: Rule<E, C>;
|
|
219
244
|
readonly required: boolean;
|
|
220
245
|
readonly readonly: boolean;
|
|
221
246
|
};
|
|
222
|
-
type ValidatingRecordTypeDef<E = any, K extends RecordKeyType = RecordKeyType, V extends ValidatingTypeDef | undefined = AnyTypeDef> = {
|
|
247
|
+
type ValidatingRecordTypeDef<E = any, C = any, K extends RecordKeyType = RecordKeyType, V extends ValidatingTypeDef | undefined = AnyTypeDef> = {
|
|
223
248
|
readonly type: TypeDefType.Record;
|
|
224
249
|
readonly keyPrototype: K;
|
|
225
250
|
readonly valueTypeDef: V;
|
|
226
|
-
readonly rule: Rule<E>;
|
|
251
|
+
readonly rule: Rule<E, C>;
|
|
227
252
|
readonly required: boolean;
|
|
228
253
|
readonly readonly: boolean;
|
|
229
254
|
};
|
|
230
255
|
type ValidatingObjectTypeDefFields = {
|
|
231
256
|
[Key: ObjectFieldKey]: AnyTypeDef;
|
|
232
257
|
};
|
|
233
|
-
type ValidatingObjectTypeDef<E = any, Fields extends ValidatingObjectTypeDefFields = ValidatingObjectTypeDefFields> = {
|
|
258
|
+
type ValidatingObjectTypeDef<E = any, C = any, Fields extends ValidatingObjectTypeDefFields = ValidatingObjectTypeDefFields> = {
|
|
234
259
|
readonly type: TypeDefType.Object;
|
|
235
260
|
readonly fields: Fields;
|
|
236
|
-
readonly rule: Rule<E>;
|
|
261
|
+
readonly rule: Rule<E, C>;
|
|
237
262
|
readonly required: boolean;
|
|
238
263
|
readonly readonly: boolean;
|
|
239
264
|
};
|
|
240
|
-
type ValidatingUnionTypeDef<E = any, D extends string | null = string | null, U extends Readonly<Record<UnionKey, AnyTypeDef>> = Readonly<Record<UnionKey, AnyTypeDef>>> = {
|
|
265
|
+
type ValidatingUnionTypeDef<E = any, C = any, D extends string | null = string | null, U extends Readonly<Record<UnionKey, AnyTypeDef>> = Readonly<Record<UnionKey, AnyTypeDef>>> = {
|
|
241
266
|
readonly discriminator: D;
|
|
242
267
|
readonly type: TypeDefType.Union;
|
|
243
268
|
readonly unions: U;
|
|
244
|
-
readonly rule: Rule<E>;
|
|
269
|
+
readonly rule: Rule<E, C>;
|
|
245
270
|
readonly required: boolean;
|
|
246
271
|
readonly readonly: boolean;
|
|
247
272
|
};
|
|
@@ -254,45 +279,22 @@ type InternalFlattenedTypeDefsOfChildren<T extends TypeDef, SegmentOverride exte
|
|
|
254
279
|
type InternalFlattenedTypeDefsOfLiteralChildren = {};
|
|
255
280
|
type InternalFlattenedTypeDefsOfListChildren<T extends ValidatingListTypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = InternalFlattenedTypeDefsOf<T['elements'], SegmentOverride, PathOf<Path, number, SegmentOverride>, '', Depth>;
|
|
256
281
|
type InternalFlattenedTypeDefsOfRecordChildren<T extends ValidatingRecordTypeDef, SegmentOverride extends string | null, Path extends string, Depth extends number> = InternalFlattenedTypeDefsOf<T['valueTypeDef'], SegmentOverride, PathOf<Path, T['keyPrototype'], SegmentOverride>, '', Depth>;
|
|
257
|
-
type InternalFlattenedTypeDefsOfObjectChildren<T extends ValidatingObjectTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingObjectTypeDef<infer _E, infer Fields> ? keyof Fields extends string ? UnionToIntersection<{
|
|
258
|
-
readonly [K in keyof Fields]-?: undefined extends Fields[K] ? InternalFlattenedTypeDefsOf<ValidatingUnionTypeDef<ErrorOfValidatingTypeDef<Exclude<Fields[K], undefined>>, null, {
|
|
282
|
+
type InternalFlattenedTypeDefsOfObjectChildren<T extends ValidatingObjectTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingObjectTypeDef<infer _E, infer _C, infer Fields> ? keyof Fields extends string ? UnionToIntersection<{
|
|
283
|
+
readonly [K in keyof Fields]-?: undefined extends Fields[K] ? InternalFlattenedTypeDefsOf<ValidatingUnionTypeDef<ErrorOfValidatingTypeDef<Exclude<Fields[K], undefined>>, ContextOfValidatingTypeDef<Exclude<Fields[K], undefined>>, null, {
|
|
259
284
|
readonly '0': Exclude<Fields[K], undefined>;
|
|
260
285
|
readonly '1': ValidatingLiteralTypeDef<undefined>;
|
|
261
286
|
}>, SegmentOverride, PathOf<Path, `${Qualifier}${K}`, null>, '', Depth> : InternalFlattenedTypeDefsOf<Exclude<Fields[K], undefined>, SegmentOverride, PathOf<Path, `${Qualifier}${K}`, null>, '', Depth>;
|
|
262
287
|
}[keyof Fields]> : never : never;
|
|
263
|
-
type InternalFlattenedTypeDefsOfUnionChildren<T extends ValidatingUnionTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingUnionTypeDef<infer _E, infer D, infer Unions> ? keyof Unions extends string ? D extends null ? UnionToIntersection<{
|
|
288
|
+
type InternalFlattenedTypeDefsOfUnionChildren<T extends ValidatingUnionTypeDef, SegmentOverride extends string | null, Path extends string, Qualifier extends string, Depth extends number> = T extends ValidatingUnionTypeDef<infer _E, infer _C, infer D, infer Unions> ? keyof Unions extends string ? D extends null ? UnionToIntersection<{
|
|
264
289
|
readonly [K in keyof Unions]: InternalFlattenedTypeDefsOfChildren<Unions[K], SegmentOverride, Path, '', Depth>;
|
|
265
290
|
}[keyof Unions]> : UnionToIntersection<{
|
|
266
291
|
readonly [K in keyof Unions]: InternalFlattenedTypeDefsOfChildren<Unions[K], SegmentOverride, Path, `${Qualifier}${K}:`, Depth>;
|
|
267
292
|
}[keyof Unions]> : never : never;
|
|
268
293
|
|
|
269
|
-
type
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
type FunctionalValidator<V = any, E = any, ValuePath extends string = any, Context = any> = (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
274
|
-
type AnnotatedValidator<V = any, E = any, ValuePath extends string = any, Context = any> = {
|
|
275
|
-
readonly validate: (v: V, valuePath: ValuePath, context: Context) => E | null;
|
|
276
|
-
readonly annotations: (valuePath: ValuePath, context: Context) => Annotations;
|
|
277
|
-
};
|
|
278
|
-
type Validator<V = any, E = any, ValuePath extends string = any, Context = any> = FunctionalValidator<V, E, ValuePath, Context> | AnnotatedValidator<V, E, ValuePath, Context>;
|
|
279
|
-
type ErrorOfValidator<V extends Validator> = V extends Validator<infer _V, infer E> ? E : never;
|
|
280
|
-
type ValidationError<Type extends string, Data = {}> = Simplify<{
|
|
281
|
-
type: Type;
|
|
282
|
-
} & Data>;
|
|
283
|
-
declare function isFunctionalValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is FunctionalValidator<V, E, ValuePath, Context>;
|
|
284
|
-
declare function isAnnotatedValidator<V, E, ValuePath extends string, Context>(v: Validator<V, E, ValuePath, Context>): v is AnnotatedValidator<V, E, ValuePath, Context>;
|
|
285
|
-
declare function validate<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, v: V, valuePath: ValuePath, context: Context): E | null;
|
|
286
|
-
declare function annotations<V = any, E = any, ValuePath extends string = any, Context = any>(validator: Validator<V, E, ValuePath, Context>, valuePath: ValuePath, context: Context): Annotations;
|
|
287
|
-
declare function mergeAnnotations(a1: Annotations, a2: Annotations): {
|
|
288
|
-
readonly: boolean;
|
|
289
|
-
required: boolean;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string, Context> = T extends ValidatingTypeDef<infer E> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, Context> : never;
|
|
293
|
-
type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>, Context = ValueOfType<ReadonlyTypeOfType<T>>> = {
|
|
294
|
-
[K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K], Context>;
|
|
295
|
-
};
|
|
294
|
+
type ValidatorOfValidatingType<T extends ValidatingTypeDef, ValuePath extends string> = T extends ValidatingTypeDef<infer E, infer C> ? Validator<ValueOfTypeDef<ReadonlyOfTypeDef<T>>, E, ValuePath, C> : never;
|
|
295
|
+
type FlattenedValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfType<T, '*'>> = Simplify<{
|
|
296
|
+
[K in keyof FlattenedTypes as ErrorOfValidatingTypeDef<FlattenedTypes[K]['definition']> extends never ? never : K]: ValidatorOfValidatingType<FlattenedTypes[K]['definition'], TypePathsToValuePaths[K]>;
|
|
297
|
+
}>;
|
|
296
298
|
|
|
297
299
|
declare function flattenValidatorsOfValidatingType<T extends ValidatingType, TypePathsToValuePaths extends Readonly<Record<keyof FlattenedTypes, string>>, FlattenedTypes extends Readonly<Record<string, ValidatingType>> = FlattenedTypesOfValidatingType<T, '*'>>(type: T): FlattenedValidatorsOfValidatingType<T, TypePathsToValuePaths, FlattenedTypes>;
|
|
298
300
|
|
|
@@ -352,54 +354,54 @@ type TypeDefOfUnionTypeDef<T extends UnionTypeDef> = T extends UnionTypeDef<infe
|
|
|
352
354
|
};
|
|
353
355
|
} : never;
|
|
354
356
|
|
|
355
|
-
type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E> : never;
|
|
356
|
-
type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2> = T extends ValidatingLiteralTypeDef<infer E1, infer V> ? {
|
|
357
|
+
type ValidatingTypeDefWithError<T extends ValidatingTypeDef, E, C> = T extends ValidatingLiteralTypeDef ? ValidatingLiteralTypeDefWithError<T, E, C> : T extends ValidatingListTypeDef ? ValidatingListTypeDefWithError<T, E, C> : T extends ValidatingRecordTypeDef ? ValidatingRecordTypeDefWithError<T, E, C> : T extends ValidatingObjectTypeDef ? ValidatingObjectTypeDefWithError<T, E, C> : T extends ValidatingUnionTypeDef ? ValidatingUnionTypeDefWithError<T, E, C> : never;
|
|
358
|
+
type ValidatingLiteralTypeDefWithError<T extends ValidatingLiteralTypeDef, E2, C2> = T extends ValidatingLiteralTypeDef<infer E1, infer C1, infer V> ? {
|
|
357
359
|
readonly type: TypeDefType.Literal;
|
|
358
360
|
readonly valuePrototype: [V];
|
|
359
|
-
readonly rule: Rule<E1 | E2>;
|
|
361
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
360
362
|
readonly required: boolean;
|
|
361
363
|
readonly readonly: boolean;
|
|
362
364
|
} : never;
|
|
363
|
-
type ValidatingListTypeDefWithError<T extends ValidatingListTypeDef, E2> = T extends ValidatingListTypeDef<infer E1, infer E> ? IsFieldReadonly<T, 'elements'> extends true ? {
|
|
365
|
+
type ValidatingListTypeDefWithError<T extends ValidatingListTypeDef, E2, C2> = T extends ValidatingListTypeDef<infer E1, infer C1, infer E> ? IsFieldReadonly<T, 'elements'> extends true ? {
|
|
364
366
|
readonly type: TypeDefType.List;
|
|
365
367
|
readonly elements: E;
|
|
366
|
-
readonly rule: Rule<E1 | E2>;
|
|
368
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
367
369
|
readonly required: boolean;
|
|
368
370
|
readonly readonly: boolean;
|
|
369
371
|
} : {
|
|
370
372
|
readonly type: TypeDefType.List;
|
|
371
373
|
elements: E;
|
|
372
|
-
readonly rule: Rule<E1 | E2>;
|
|
374
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
373
375
|
readonly required: boolean;
|
|
374
376
|
readonly readonly: boolean;
|
|
375
377
|
} : never;
|
|
376
|
-
type ValidatingRecordTypeDefWithError<T extends ValidatingRecordTypeDef, E2> = T extends ValidatingRecordTypeDef<infer E1, infer K, infer V> ? IsFieldReadonly<T, 'valueTypeDef'> extends true ? {
|
|
378
|
+
type ValidatingRecordTypeDefWithError<T extends ValidatingRecordTypeDef, E2, C2> = T extends ValidatingRecordTypeDef<infer E1, infer C1, infer K, infer V> ? IsFieldReadonly<T, 'valueTypeDef'> extends true ? {
|
|
377
379
|
readonly type: TypeDefType.Record;
|
|
378
380
|
readonly keyPrototype: K;
|
|
379
381
|
readonly valueTypeDef: V;
|
|
380
|
-
readonly rule: Rule<E1 | E2>;
|
|
382
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
381
383
|
readonly required: boolean;
|
|
382
384
|
readonly readonly: boolean;
|
|
383
385
|
} : {
|
|
384
386
|
readonly type: TypeDefType.Record;
|
|
385
387
|
readonly keyPrototype: K;
|
|
386
388
|
valueTypeDef: V;
|
|
387
|
-
readonly rule: Rule<E1 | E2>;
|
|
389
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
388
390
|
readonly required: boolean;
|
|
389
391
|
readonly readonly: boolean;
|
|
390
392
|
} : never;
|
|
391
|
-
type ValidatingObjectTypeDefWithError<T extends ValidatingObjectTypeDef, E2> = T extends ValidatingObjectTypeDef<infer E1, infer Fields> ? {
|
|
393
|
+
type ValidatingObjectTypeDefWithError<T extends ValidatingObjectTypeDef, E2, C2> = T extends ValidatingObjectTypeDef<infer E1, infer C1, infer Fields> ? {
|
|
392
394
|
readonly type: TypeDefType.Object;
|
|
393
395
|
readonly fields: Fields;
|
|
394
|
-
readonly rule: Rule<E1 | E2>;
|
|
396
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
395
397
|
readonly required: boolean;
|
|
396
398
|
readonly readonly: boolean;
|
|
397
399
|
} : never;
|
|
398
|
-
type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2> = T extends ValidatingUnionTypeDef<infer E1, infer D, infer U> ? {
|
|
400
|
+
type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2, C2> = T extends ValidatingUnionTypeDef<infer E1, infer C1, infer D, infer U> ? {
|
|
399
401
|
readonly type: TypeDefType.Union;
|
|
400
402
|
readonly discriminator: D;
|
|
401
403
|
readonly unions: U;
|
|
402
|
-
readonly rule: Rule<E1 | E2>;
|
|
404
|
+
readonly rule: Rule<E1 | E2, C1 & C2>;
|
|
403
405
|
readonly required: boolean;
|
|
404
406
|
readonly readonly: boolean;
|
|
405
407
|
} : never;
|
|
@@ -407,7 +409,8 @@ type ValidatingUnionTypeDefWithError<T extends ValidatingUnionTypeDef, E2> = T e
|
|
|
407
409
|
declare class TypeDefBuilder<T extends ValidatingTypeDef> implements ValidatingType<T> {
|
|
408
410
|
readonly definition: T;
|
|
409
411
|
constructor(definition: T);
|
|
410
|
-
enforce<E2
|
|
412
|
+
enforce<E2, C2>(): TypeDefBuilder<ValidatingTypeDefWithError<T, E2, C2>>;
|
|
413
|
+
enforce<E2, C2>(rule: Validator<ValueOfType<Type<T>>, E2, string, C2>): TypeDefBuilder<ValidatingTypeDefWithError<T, E2, C2>>;
|
|
411
414
|
required(): TypeDefBuilder<T>;
|
|
412
415
|
readonly(): TypeDefBuilder<T>;
|
|
413
416
|
get _type(): TypeOfType<Type<T>>;
|
|
@@ -447,29 +450,29 @@ declare class RecordTypeDefBuilder<T extends ValidatingRecordTypeDef> extends Ty
|
|
|
447
450
|
readonly readonly: boolean;
|
|
448
451
|
}>;
|
|
449
452
|
}
|
|
450
|
-
declare class ObjectTypeDefBuilder<E, Fields extends Readonly<Record<ObjectFieldKey, ValidatingTypeDef>> = {}> extends TypeDefBuilder<ValidatingObjectTypeDef<E, Fields>> {
|
|
451
|
-
field<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Record<Name, T>>;
|
|
452
|
-
field<Name extends string, T extends ValidatingTypeDef, RequiredError>(name: Name, { definition }: Type<T>, rule: Rule<RequiredError, ValueOfTypeDef<T>>): ObjectTypeDefBuilder<E, Fields & Record<Name, ValidatingTypeDefWithError<T, RequiredError>>>;
|
|
453
|
-
readonlyField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Readonly<Record<Name, T>>>;
|
|
454
|
-
optionalField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Partial<Record<Name, T>>>;
|
|
455
|
-
readonlyOptionalField<Name extends string, T extends TypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, Fields & Partial<Readonly<Record<Name, T>>>>;
|
|
453
|
+
declare class ObjectTypeDefBuilder<E, C, Fields extends Readonly<Record<ObjectFieldKey, ValidatingTypeDef>> = {}> extends TypeDefBuilder<ValidatingObjectTypeDef<E, C, Fields>> {
|
|
454
|
+
field<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Record<Name, T>>;
|
|
455
|
+
field<Name extends string, T extends ValidatingTypeDef, RequiredError, C2>(name: Name, { definition }: Type<T>, rule: Rule<RequiredError, ValueOfTypeDef<T>>): ObjectTypeDefBuilder<E, C & C2, Fields & Record<Name, ValidatingTypeDefWithError<T, RequiredError, C & C2>>>;
|
|
456
|
+
readonlyField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Readonly<Record<Name, T>>>;
|
|
457
|
+
optionalField<Name extends string, T extends ValidatingTypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Partial<Record<Name, T>>>;
|
|
458
|
+
readonlyOptionalField<Name extends string, T extends TypeDef>(name: Name, { definition }: Type<T>): ObjectTypeDefBuilder<E, C, Fields & Partial<Readonly<Record<Name, T>>>>;
|
|
456
459
|
}
|
|
457
|
-
declare class UnionTypeDefBuilder<E, D extends string | null, U extends Record<UnionKey, TypeDef>> extends TypeDefBuilder<ValidatingUnionTypeDef<E, D, U>> {
|
|
458
|
-
or<K extends Exclude<UnionKey, keyof U>, T extends TypeDef>(k: K, { definition: typeDef, }: Type<T>): UnionTypeDefBuilder<E, D, Readonly<Record<K, T>> & U>;
|
|
460
|
+
declare class UnionTypeDefBuilder<E, C, D extends string | null, U extends Record<UnionKey, TypeDef>> extends TypeDefBuilder<ValidatingUnionTypeDef<E, C, D, U>> {
|
|
461
|
+
or<K extends Exclude<UnionKey, keyof U>, T extends TypeDef>(k: K, { definition: typeDef, }: Type<T>): UnionTypeDefBuilder<E, C, D, Readonly<Record<K, T>> & U>;
|
|
459
462
|
}
|
|
460
|
-
declare function literal<T>(value?: [T]): TypeDefBuilder<ValidatingLiteralTypeDef<never, T>>;
|
|
461
|
-
declare const stringType: TypeDefBuilder<ValidatingLiteralTypeDef<never, string>>;
|
|
462
|
-
declare const numberType: TypeDefBuilder<ValidatingLiteralTypeDef<never, number>>;
|
|
463
|
-
declare const booleanType: TypeDefBuilder<ValidatingLiteralTypeDef<never, boolean>>;
|
|
464
|
-
declare const nullType: TypeDefBuilder<ValidatingLiteralTypeDef<never, null>>;
|
|
465
|
-
declare function nullable<T extends ValidatingTypeDef>(nonNullable: ValidatingType<T>): UnionTypeDefBuilder<never, null, {
|
|
463
|
+
declare function literal<T>(value?: [T]): TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, T>>;
|
|
464
|
+
declare const stringType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, string>>;
|
|
465
|
+
declare const numberType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, number>>;
|
|
466
|
+
declare const booleanType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, boolean>>;
|
|
467
|
+
declare const nullType: TypeDefBuilder<ValidatingLiteralTypeDef<never, {}, null>>;
|
|
468
|
+
declare function nullable<T extends ValidatingTypeDef>(nonNullable: ValidatingType<T>): UnionTypeDefBuilder<never, {}, null, {
|
|
466
469
|
readonly ['0']: T;
|
|
467
|
-
readonly ['1']: ValidatingLiteralTypeDef<never, null>;
|
|
470
|
+
readonly ['1']: ValidatingLiteralTypeDef<never, {}, null>;
|
|
468
471
|
}>;
|
|
469
472
|
declare function list<T extends ValidatingTypeDef>(elements: ValidatingType<T>): ListTypeDefBuilder<{
|
|
470
473
|
readonly type: TypeDefType.List;
|
|
471
474
|
elements: T;
|
|
472
|
-
readonly rule: Rule<never>;
|
|
475
|
+
readonly rule: Rule<never, {}>;
|
|
473
476
|
readonly readonly: boolean;
|
|
474
477
|
readonly required: boolean;
|
|
475
478
|
}>;
|
|
@@ -477,13 +480,13 @@ declare function record<V extends ValidatingType, K extends RecordKeyType>({ def
|
|
|
477
480
|
readonly type: TypeDefType.Record;
|
|
478
481
|
readonly keyPrototype: K;
|
|
479
482
|
valueTypeDef: V["definition"];
|
|
480
|
-
readonly rule: Rule<never>;
|
|
483
|
+
readonly rule: Rule<never, {}>;
|
|
481
484
|
readonly readonly: boolean;
|
|
482
485
|
readonly required: boolean;
|
|
483
486
|
}>;
|
|
484
487
|
declare function object(): ObjectTypeDefBuilder<never, {}>;
|
|
485
|
-
declare function union<D extends null>(): UnionTypeDefBuilder<never, D, {}>;
|
|
486
|
-
declare function union<D extends string>(discriminator: D): UnionTypeDefBuilder<never, D, {}>;
|
|
488
|
+
declare function union<D extends null>(): UnionTypeDefBuilder<never, {}, D, {}>;
|
|
489
|
+
declare function union<D extends string>(discriminator: D): UnionTypeDefBuilder<never, {}, D, {}>;
|
|
487
490
|
|
|
488
491
|
type PathsOfType<T extends Type, SegmentOverride extends string | null = null, Prefix extends string = '$'> = InternalJsonPathsOf<T['definition'], Prefix, SegmentOverride, StartingDepth>;
|
|
489
492
|
type InternalJsonPathsOf<F extends TypeDef, Prefix extends string, SegmentOverride extends string | null, Depth extends number, NextDepth extends number = Depths[Depth]> = InternalJsonPathsOfChildren<F, Prefix, SegmentOverride, '', NextDepth> | Prefix;
|
|
@@ -595,4 +598,4 @@ type ValidatorsOfValues<FlattenedValues extends Readonly<Record<string, any>>, T
|
|
|
595
598
|
readonly [K in keyof FlattenedValues]: Validator<FlattenedValues[K], any, TypePathsToValuePaths[K], Context>;
|
|
596
599
|
};
|
|
597
600
|
|
|
598
|
-
export { type Accessor, type AnnotatedValidator, type Annotations, type AnyValueType, DefinedValidator, type ErrorOfValidator, type FlattenedAccessorsOfType, type FlattenedTypesOfType, type FlattenedValuesOfType, type FunctionalValidator, type InternalJsonPathsOf, type IsStrictUnion, type ListTypeDef, type LiteralTypeDef, type Mapper, type MinimumStringLengthValidationError, MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, type MobxObservable, type MobxValueOfType, type NonMobxObservable, type ObjectFieldKey, type ObjectTypeDef, type ObjectTypeDefFields, OptionalValidatorProxy, type PathsOfType, type ReadonlyOfTypeDef, type ReadonlyTypeOfType, type RecordKeyType, type RecordTypeDef, type RegexpValidationError, RegexpValidationErrorType, RegexpValidator, type Setter, type StrictListTypeDef, type StrictLiteralTypeDef, type StrictObjectTypeDef, type StrictObjectTypeDefFields, type StrictRecordTypeDef, type StrictType, type StrictTypeDef, type StrictUnionTypeDef, type Type, type TypeDef, TypeDefType, type UnionKey, type UnionTypeDef, type ValidationError, type Validator, type ValidatorsOfValues, type ValueOfType, type ValueOfTypeDef, type ValueToTypePathsOfType, type ValueTypesOfDiscriminatedUnion, annotations, booleanType, copy, flattenAccessorsOfType, flattenJsonValueToTypePathsOf, flattenTypesOfType, flattenValidatorsOfValidatingType, flattenValueTo, flattenValuesOfType, getUnionTypeDef, isAnnotatedValidator, isFunctionalValidator, jsonPath, jsonPathPop, jsonPathPrefix, jsonPathUnprefix, list, literal, mergeAnnotations, mobxCopy, nullType, nullable, numberType, object, record, stringType, union, validate, valuePathToTypePath };
|
|
601
|
+
export { type Accessor, type AnnotatedValidator, type Annotations, type AnyValueType, DefinedValidator, type ErrorOfValidator, type FlattenedAccessorsOfType, type FlattenedTypesOfType, type FlattenedValuesOfType, type FunctionalValidator, type InternalJsonPathsOf, type IsStrictUnion, type ListTypeDef, type LiteralTypeDef, type Mapper, type MinimumStringLengthValidationError, MinimumStringLengthValidationErrorType, MinimumStringLengthValidator, type MobxObservable, type MobxValueOfType, type NonMobxObservable, type ObjectFieldKey, type ObjectTypeDef, type ObjectTypeDefFields, OptionalValidatorProxy, type PathsOfType, type ReadonlyOfTypeDef, type ReadonlyTypeOfType, type RecordKeyType, type RecordTypeDef, type RegexpValidationError, RegexpValidationErrorType, RegexpValidator, type Setter, type StrictListTypeDef, type StrictLiteralTypeDef, type StrictObjectTypeDef, type StrictObjectTypeDefFields, type StrictRecordTypeDef, type StrictType, type StrictTypeDef, type StrictUnionTypeDef, type Type, type TypeDef, TypeDefType, type UnionKey, type UnionTypeDef, type ValidationError, type Validator, type ValidatorsOfValues, type ValueOfType, type ValueOfTypeDef, type ValueToTypePathsOfType, type ValueTypesOfDiscriminatedUnion, annotations, booleanType, copy, flattenAccessorsOfType, flattenJsonValueToTypePathsOf, flattenTypesOfType, flattenValidatorsOfValidatingType, flattenValueTo, flattenValuesOfType, getUnionTypeDef, isAnnotatedValidator, isFunctionalValidator, jsonPath, jsonPathPop, jsonPathPrefix, jsonPathUnprefix, list, literal, mergeAnnotations, mergeValidators, mobxCopy, nullType, nullable, numberType, object, record, stringType, union, validate, valuePathToTypePath };
|