@regle/schemas 1.3.0 → 1.3.2
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/dist/regle-schemas.d.ts +111 -155
- package/package.json +12 -12
package/dist/regle-schemas.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ type Prettify<T> = T extends infer R ? { [K in keyof R]: R[K] } & {} : never;
|
|
|
7
7
|
type Maybe<T = any> = T | null | undefined;
|
|
8
8
|
type MaybeInput<T = any> = T | null | undefined;
|
|
9
9
|
type MaybeOutput<T = any> = T | undefined;
|
|
10
|
+
type NonUndefined<T> = Exclude<T, undefined>;
|
|
10
11
|
type PromiseReturn<T> = T extends Promise<infer U> ? U : T;
|
|
11
12
|
type MaybeGetter<T, V = any, TAdd extends Record<string, any> = {}> = T | ((value: Ref<V>, index: number) => T & TAdd);
|
|
12
13
|
type Unwrap<T extends MaybeRef<Record<string, any>>> = T extends Ref ? UnwrapRef<T> : UnwrapNestedRefs<T>;
|
|
@@ -18,22 +19,19 @@ type ExcludeByType<T, U> = { [K in keyof T as T[K] extends U ? never : K]: T[K]
|
|
|
18
19
|
type PrimitiveTypes = string | number | boolean | bigint | Date | File;
|
|
19
20
|
type isRecordLiteral<T extends unknown> = NonNullable<T> extends Date | File ? false : NonNullable<T> extends Record<string, any> ? true : false;
|
|
20
21
|
type NoInferLegacy<A extends any> = [A][A extends any ? 0 : never];
|
|
21
|
-
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/types/utils/Array.types.d.ts
|
|
24
24
|
type ArrayElement$1<T> = T extends Array<infer U> ? U : never;
|
|
25
|
-
|
|
26
25
|
//#endregion
|
|
27
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
26
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
|
|
28
27
|
/**
|
|
29
28
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
30
29
|
|
|
31
30
|
@category Type
|
|
32
31
|
*/
|
|
33
32
|
type Primitive$1 = null | undefined | string | number | boolean | symbol | bigint;
|
|
34
|
-
|
|
35
33
|
//#endregion
|
|
36
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
34
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
|
|
37
35
|
declare global {
|
|
38
36
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
39
37
|
interface SymbolConstructor {
|
|
@@ -41,8 +39,6 @@ declare global {
|
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/union-to-intersection.d.ts
|
|
46
42
|
/**
|
|
47
43
|
@remarks
|
|
48
44
|
The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
|
|
@@ -54,6 +50,8 @@ As well, some guidance on making an `Observable` to not include `closed` propert
|
|
|
54
50
|
@category Observable
|
|
55
51
|
*/
|
|
56
52
|
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/union-to-intersection.d.ts
|
|
57
55
|
/**
|
|
58
56
|
Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
59
57
|
|
|
@@ -99,7 +97,7 @@ type Intersection = UnionToIntersection<Union>;
|
|
|
99
97
|
|
|
100
98
|
@category Type
|
|
101
99
|
*/
|
|
102
|
-
type UnionToIntersection
|
|
100
|
+
type UnionToIntersection<Union> = (
|
|
103
101
|
// `extends unknown` is always going to be the case and is used to convert the
|
|
104
102
|
// `Union` into a [distributive conditional
|
|
105
103
|
// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
@@ -114,9 +112,8 @@ Union extends unknown
|
|
|
114
112
|
) extends ((mergedIntersection: infer Intersection) => void)
|
|
115
113
|
// The `& Union` is to allow indexing by the resulting type
|
|
116
114
|
? Intersection & Union : never;
|
|
117
|
-
|
|
118
115
|
//#endregion
|
|
119
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
116
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/empty-object.d.ts
|
|
120
117
|
declare const emptyObjectSymbol$1: unique symbol;
|
|
121
118
|
|
|
122
119
|
/**
|
|
@@ -164,10 +161,9 @@ type Fail = IsEmptyObject<null>; //=> false
|
|
|
164
161
|
@see EmptyObject
|
|
165
162
|
@category Object
|
|
166
163
|
*/
|
|
167
|
-
type IsEmptyObject<T> = T extends EmptyObject$1 ? true : false;
|
|
168
|
-
|
|
164
|
+
type IsEmptyObject$1<T> = T extends EmptyObject$1 ? true : false;
|
|
169
165
|
//#endregion
|
|
170
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
166
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
171
167
|
/**
|
|
172
168
|
Extract all optional keys from the given type.
|
|
173
169
|
|
|
@@ -203,11 +199,9 @@ const update2: UpdateOperation<User> = {
|
|
|
203
199
|
*/
|
|
204
200
|
type OptionalKeysOf$1<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
|
|
205
201
|
? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
|
|
206
|
-
: never;
|
|
207
|
-
|
|
202
|
+
: never; // Should never happen
|
|
208
203
|
//#endregion
|
|
209
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
210
|
-
// Should never happen
|
|
204
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
211
205
|
/**
|
|
212
206
|
Extract all required keys from the given type.
|
|
213
207
|
|
|
@@ -233,12 +227,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
233
227
|
@category Utilities
|
|
234
228
|
*/
|
|
235
229
|
type RequiredKeysOf$1<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
|
|
236
|
-
? Exclude<keyof BaseType, OptionalKeysOf$1<BaseType>> : never;
|
|
230
|
+
? Exclude<keyof BaseType, OptionalKeysOf$1<BaseType>> : never; // Should never happen
|
|
237
231
|
|
|
238
232
|
//#endregion
|
|
239
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
240
|
-
// Should never happen
|
|
241
|
-
|
|
233
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
|
|
242
234
|
/**
|
|
243
235
|
Returns a boolean for whether the given type is `never`.
|
|
244
236
|
|
|
@@ -281,9 +273,8 @@ endIfEqual('abc', '123');
|
|
|
281
273
|
@category Utilities
|
|
282
274
|
*/
|
|
283
275
|
type IsNever$1<T> = [T] extends [never] ? true : false;
|
|
284
|
-
|
|
285
276
|
//#endregion
|
|
286
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
277
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
|
|
287
278
|
/**
|
|
288
279
|
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
289
280
|
|
|
@@ -303,10 +294,9 @@ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
|
303
294
|
@category Type Guard
|
|
304
295
|
@category Utilities
|
|
305
296
|
*/
|
|
306
|
-
type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever);
|
|
307
|
-
|
|
297
|
+
type IfNever$1$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever);
|
|
308
298
|
//#endregion
|
|
309
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
299
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
|
|
310
300
|
// Can eventually be replaced with the built-in once this library supports
|
|
311
301
|
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
312
302
|
type NoInfer$1<T> = T extends infer U ? U : never;
|
|
@@ -340,19 +330,18 @@ const anyA = get(anyObject, 'a');
|
|
|
340
330
|
@category Utilities
|
|
341
331
|
*/
|
|
342
332
|
type IsAny$1<T> = 0 extends 1 & NoInfer$1<T> ? true : false;
|
|
343
|
-
|
|
344
333
|
//#endregion
|
|
345
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
334
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/keys.d.ts
|
|
346
335
|
/**
|
|
347
336
|
Disallows any of the given keys.
|
|
348
337
|
*/
|
|
349
338
|
type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;
|
|
350
339
|
|
|
351
|
-
//#endregion
|
|
352
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/simplify.d.ts
|
|
353
340
|
/**
|
|
354
341
|
Utility type to retrieve only literal keys from type.
|
|
355
342
|
*/
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
|
|
356
345
|
/**
|
|
357
346
|
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
358
347
|
|
|
@@ -411,9 +400,8 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
411
400
|
@category Object
|
|
412
401
|
*/
|
|
413
402
|
type Simplify$1<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
414
|
-
|
|
415
403
|
//#endregion
|
|
416
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
404
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
417
405
|
/**
|
|
418
406
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
419
407
|
|
|
@@ -505,9 +493,8 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
505
493
|
@category Object
|
|
506
494
|
*/
|
|
507
495
|
type OmitIndexSignature$1<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
508
|
-
|
|
509
496
|
//#endregion
|
|
510
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
497
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
511
498
|
/**
|
|
512
499
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
513
500
|
|
|
@@ -554,9 +541,8 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
554
541
|
@category Object
|
|
555
542
|
*/
|
|
556
543
|
type PickIndexSignature$1<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
557
|
-
|
|
558
544
|
//#endregion
|
|
559
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
545
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
|
|
560
546
|
// Merges two objects without worrying about index signatures.
|
|
561
547
|
type SimpleMerge$1<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
|
|
562
548
|
|
|
@@ -595,9 +581,8 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
595
581
|
@category Object
|
|
596
582
|
*/
|
|
597
583
|
type Merge$1<Destination, Source> = Simplify$1<SimpleMerge$1<PickIndexSignature$1<Destination>, PickIndexSignature$1<Source>> & SimpleMerge$1<OmitIndexSignature$1<Destination>, OmitIndexSignature$1<Source>>>;
|
|
598
|
-
|
|
599
584
|
//#endregion
|
|
600
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
585
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
|
|
601
586
|
/**
|
|
602
587
|
An if-else-like type that resolves depending on whether the given type is `any`.
|
|
603
588
|
|
|
@@ -617,10 +602,9 @@ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
|
|
|
617
602
|
@category Type Guard
|
|
618
603
|
@category Utilities
|
|
619
604
|
*/
|
|
620
|
-
type IfAny$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny$1<T> extends true ? TypeIfAny : TypeIfNotAny);
|
|
621
|
-
|
|
605
|
+
type IfAny$1$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny$1<T> extends true ? TypeIfAny : TypeIfNotAny);
|
|
622
606
|
//#endregion
|
|
623
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
607
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
|
|
624
608
|
/**
|
|
625
609
|
Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
626
610
|
*/
|
|
@@ -639,10 +623,29 @@ Multiple call signatures cannot currently be supported due to a TypeScript limit
|
|
|
639
623
|
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
640
624
|
*/
|
|
641
625
|
|
|
642
|
-
//#endregion
|
|
643
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/object.d.ts
|
|
644
626
|
// Should never happen
|
|
645
627
|
|
|
628
|
+
/**
|
|
629
|
+
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
630
|
+
|
|
631
|
+
@example
|
|
632
|
+
```
|
|
633
|
+
// When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch
|
|
634
|
+
type A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
635
|
+
//=> 'VALID'
|
|
636
|
+
|
|
637
|
+
// When `T` is `any` => Returns `IfAny` branch
|
|
638
|
+
type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
639
|
+
//=> 'IS_ANY'
|
|
640
|
+
|
|
641
|
+
// When `T` is `never` => Returns `IfNever` branch
|
|
642
|
+
type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
643
|
+
//=> 'IS_NEVER'
|
|
644
|
+
```
|
|
645
|
+
*/
|
|
646
|
+
type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = IsAny$1<T> extends true ? IfAny : IsNever$1<T> extends true ? IfNever : IfNotAnyOrNever;
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
|
|
646
649
|
/**
|
|
647
650
|
Merges user specified options with default options.
|
|
648
651
|
|
|
@@ -695,11 +698,10 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
695
698
|
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
696
699
|
```
|
|
697
700
|
*/
|
|
698
|
-
type ApplyDefaultOptions$1<Options extends object, Defaults extends Simplify$1<Omit<Required<Options>, RequiredKeysOf$1<Options>> & Partial<Record<RequiredKeysOf$1<Options>, never>>>, SpecifiedOptions extends Options> = IfAny$1<SpecifiedOptions, Defaults, IfNever$1<SpecifiedOptions, Defaults, Simplify$1<Merge$1<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf$1<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
701
|
+
type ApplyDefaultOptions$1<Options extends object, Defaults extends Simplify$1<Omit<Required<Options>, RequiredKeysOf$1<Options>> & Partial<Record<RequiredKeysOf$1<Options>, never>>>, SpecifiedOptions extends Options> = IfAny$1$1<SpecifiedOptions, Defaults, IfNever$1$1<SpecifiedOptions, Defaults, Simplify$1<Merge$1<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf$1<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
699
702
|
>>;
|
|
700
|
-
|
|
701
703
|
//#endregion
|
|
702
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
704
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/require-exactly-one.d.ts
|
|
703
705
|
/**
|
|
704
706
|
Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
|
|
705
707
|
|
|
@@ -729,10 +731,10 @@ const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
|
|
|
729
731
|
|
|
730
732
|
@category Object
|
|
731
733
|
*/
|
|
732
|
-
type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
|
733
|
-
|
|
734
|
+
type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, IfNever$1$1<KeysType, never, _RequireExactlyOne<ObjectType, IfAny$1$1<KeysType, keyof ObjectType, KeysType>>>>;
|
|
735
|
+
type _RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType> = { [Key in KeysType]: (Required<Pick<ObjectType, Key>> & Partial<Record<Exclude<KeysType, Key>, never>>) }[KeysType] & Omit<ObjectType, KeysType>;
|
|
734
736
|
//#endregion
|
|
735
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
737
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/require-one-or-none.d.ts
|
|
736
738
|
/**
|
|
737
739
|
Create a type that requires exactly one of the given keys and disallows more, or none of the given keys. The remaining keys are kept as is.
|
|
738
740
|
|
|
@@ -763,11 +765,10 @@ const responder3: Responder = {
|
|
|
763
765
|
|
|
764
766
|
@category Object
|
|
765
767
|
*/
|
|
766
|
-
type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
|
767
|
-
|
|
768
|
+
type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, IfNever$1$1<KeysType, ObjectType, _RequireOneOrNone<ObjectType, IfAny$1$1<KeysType, keyof ObjectType, KeysType>>>>;
|
|
769
|
+
type _RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType> = (RequireExactlyOne<ObjectType, KeysType> | RequireNone<KeysType>) & Omit<ObjectType, KeysType>; // Ignore unspecified keys.
|
|
768
770
|
//#endregion
|
|
769
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
770
|
-
// Ignore unspecified keys.
|
|
771
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
|
|
771
772
|
/**
|
|
772
773
|
@see {@link PartialDeep}
|
|
773
774
|
*/
|
|
@@ -884,12 +885,11 @@ type PartialReadonlySetDeep$1<T, Options extends Required<PartialDeepOptions$1>>
|
|
|
884
885
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
885
886
|
*/
|
|
886
887
|
type PartialObjectDeep$1<ObjectType extends object, Options extends Required<PartialDeepOptions$1>> = (ObjectType extends ((...arguments_: any) => unknown) ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({ [KeyType in keyof ObjectType]?: _PartialDeep$1<ObjectType[KeyType], Options> });
|
|
887
|
-
|
|
888
888
|
//#endregion
|
|
889
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
889
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-deep.d.ts
|
|
890
890
|
|
|
891
891
|
//#endregion
|
|
892
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
892
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/union-to-tuple.d.ts
|
|
893
893
|
/**
|
|
894
894
|
Returns the last element of a union type.
|
|
895
895
|
|
|
@@ -899,7 +899,7 @@ type Last = LastOfUnion<1 | 2 | 3>;
|
|
|
899
899
|
//=> 3
|
|
900
900
|
```
|
|
901
901
|
*/
|
|
902
|
-
type LastOfUnion<T> = UnionToIntersection
|
|
902
|
+
type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
|
|
903
903
|
|
|
904
904
|
/**
|
|
905
905
|
Convert a union type into an unordered tuple type of its elements.
|
|
@@ -936,10 +936,9 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
|
936
936
|
|
|
937
937
|
@category Array
|
|
938
938
|
*/
|
|
939
|
-
type UnionToTuple
|
|
940
|
-
|
|
939
|
+
type UnionToTuple<T, L = LastOfUnion<T>> = IsNever$1<T> extends false ? [...UnionToTuple<Exclude<T, L>>, L] : [];
|
|
941
940
|
//#endregion
|
|
942
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
941
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-null.d.ts
|
|
943
942
|
/**
|
|
944
943
|
Returns a boolean for whether the given type is `null`.
|
|
945
944
|
|
|
@@ -960,9 +959,8 @@ type Example2 = NonNullFallback<number, string>;
|
|
|
960
959
|
@category Utilities
|
|
961
960
|
*/
|
|
962
961
|
type IsNull<T> = [T] extends [null] ? true : false;
|
|
963
|
-
|
|
964
962
|
//#endregion
|
|
965
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
963
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-unknown.d.ts
|
|
966
964
|
/**
|
|
967
965
|
Returns a boolean for whether the given type is `unknown`.
|
|
968
966
|
|
|
@@ -1006,10 +1004,9 @@ store.execute((state, payload) => ({value: state.value + payload}), someExternal
|
|
|
1006
1004
|
|
|
1007
1005
|
@category Utilities
|
|
1008
1006
|
*/
|
|
1009
|
-
type IsUnknown
|
|
1007
|
+
type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
|
|
1010
1008
|
? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
|
|
1011
1009
|
? true : false : false);
|
|
1012
|
-
|
|
1013
1010
|
//#endregion
|
|
1014
1011
|
//#region src/types/core/modifiers.types.d.ts
|
|
1015
1012
|
interface RegleBehaviourOptions {
|
|
@@ -1096,7 +1093,6 @@ type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
|
|
|
1096
1093
|
collections?: ShortcutCommonFn<RegleCollectionStatus<any[], Partial<TCustomRules> & Partial<DefaultValidators>>>;
|
|
1097
1094
|
};
|
|
1098
1095
|
type AddDollarToOptions<T extends Record<string, any>> = { [K in keyof T as `$${string & K}`]: T[K] };
|
|
1099
|
-
|
|
1100
1096
|
//#endregion
|
|
1101
1097
|
//#region src/types/core/useRegle.types.d.ts
|
|
1102
1098
|
type Regle<TState extends Record<string, any> = EmptyObject$1, TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> = EmptyObject$1, TValidationGroups extends Record<string, RegleValidationGroupEntry[]> = {}, TShortcuts extends RegleShortcutDefinition = {}, TAdditionalReturnProperties extends Record<string, any> = {}> = {
|
|
@@ -1117,7 +1113,6 @@ type RegleSingleField<TState extends Maybe<PrimitiveTypes> = any, TRules extends
|
|
|
1117
1113
|
} & TAdditionalReturnProperties;
|
|
1118
1114
|
type DeepReactiveState<T extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T> extends true ? { [K in keyof T]: InferDeepReactiveState<T[K]> } : never;
|
|
1119
1115
|
type InferDeepReactiveState<TState> = NonNullable<TState> extends Array<infer U extends Record<string, any>> ? DeepReactiveState<U[]> : NonNullable<TState> extends Date | File ? MaybeRef<TState> : NonNullable<TState> extends Record<string, any> ? DeepReactiveState<TState> : MaybeRef<TState>;
|
|
1120
|
-
|
|
1121
1116
|
//#endregion
|
|
1122
1117
|
//#region src/types/core/reset.types.d.ts
|
|
1123
1118
|
type ResetOptions<TState extends unknown> = RequireOneOrNone<{
|
|
@@ -1137,23 +1132,21 @@ type ResetOptions<TState extends unknown> = RequireOneOrNone<{
|
|
|
1137
1132
|
*/
|
|
1138
1133
|
clearExternalErrors?: boolean;
|
|
1139
1134
|
}, 'toInitialState' | 'toState'>;
|
|
1140
|
-
|
|
1141
1135
|
//#endregion
|
|
1142
1136
|
//#region src/types/core/scopedRegle.types.d.ts
|
|
1143
1137
|
type ScopedInstancesRecord = Record<string, Record<string, SuperCompatibleRegleRoot>> & {
|
|
1144
1138
|
'~~global': Record<string, SuperCompatibleRegleRoot>;
|
|
1145
1139
|
};
|
|
1146
1140
|
type ScopedInstancesRecordLike = Partial<ScopedInstancesRecord>;
|
|
1147
|
-
|
|
1148
1141
|
//#endregion
|
|
1149
1142
|
//#region src/types/core/results.types.d.ts
|
|
1150
1143
|
type PartialFormState<TState extends Record<string, any>> = [unknown] extends [TState] ? {} : Prettify<{ [K in keyof TState as ExtendOnlyRealRecord<TState[K]> extends true ? never : TState[K] extends Array<any> ? never : K]?: MaybeOutput<TState[K]> } & { [K in keyof TState as ExtendOnlyRealRecord<TState[K]> extends true ? K : TState[K] extends Array<any> ? K : never]: NonNullable<TState[K]> extends Array<infer U extends Record<string, any>> ? PartialFormState<U>[] : PartialFormState<TState[K]> }>;
|
|
1151
1144
|
type RegleResult<Data extends Record<string, any> | any[] | unknown, TRules extends ReglePartialRuleTree<any>> = {
|
|
1152
1145
|
valid: false;
|
|
1153
|
-
data: IsUnknown
|
|
1146
|
+
data: IsUnknown<Data> extends true ? unknown : NonNullable<Data> extends Date | File ? MaybeOutput<Data> : NonNullable<Data> extends Array<infer U extends Record<string, any>> ? PartialFormState<U>[] : NonNullable<Data> extends Record<string, any> ? PartialFormState<NonNullable<Data>> : MaybeOutput<Data>;
|
|
1154
1147
|
} | {
|
|
1155
1148
|
valid: true;
|
|
1156
|
-
data: IsUnknown
|
|
1149
|
+
data: IsUnknown<Data> extends true ? unknown : Data extends Array<infer U extends Record<string, any>> ? DeepSafeFormState<U, TRules>[] : Data extends Date | File ? SafeFieldProperty<Data, TRules> : Data extends Record<string, any> ? DeepSafeFormState<Data, TRules> : SafeFieldProperty<Data, TRules>;
|
|
1157
1150
|
};
|
|
1158
1151
|
/**
|
|
1159
1152
|
* Infer safe output from any `r$` instance
|
|
@@ -1174,7 +1167,6 @@ type ArrayHaveAtLeastOneRequiredField<TState extends Maybe<any[]>, TRule extends
|
|
|
1174
1167
|
type SafeProperty<TState, TRule extends RegleFormPropertyType<any, any> | undefined> = unknown extends TState ? unknown : TRule extends RegleCollectionRuleDecl<any, any> ? TState extends Array<infer U extends Record<string, any>> ? DeepSafeFormState<U, ExtractFromGetter<TRule['$each']>>[] : TState : TRule extends ReglePartialRuleTree<any, any> ? ExtendOnlyRealRecord<TState> extends true ? DeepSafeFormState<NonNullable<TState> extends Record<string, any> ? JoinDiscriminatedUnions<NonNullable<TState>> : {}, TRule> : TRule extends RegleRuleDecl<any, any> ? FieldHaveRequiredRule<TRule> extends true ? TState : MaybeOutput<TState> : TState : TState;
|
|
1175
1168
|
type IsPropertyOutputRequired<TState, TRule extends RegleFormPropertyType<any, any> | undefined> = [unknown] extends [TState] ? unknown : NonNullable<TState> extends Array<any> ? TRule extends RegleCollectionRuleDecl<any, any> ? ArrayHaveAtLeastOneRequiredField<NonNullable<TState>, TRule> extends false ? false : true : false : TRule extends ReglePartialRuleTree<any, any> ? ExtendOnlyRealRecord<TState> extends true ? ObjectHaveAtLeastOneRequiredField<NonNullable<TState> extends Record<string, any> ? NonNullable<TState> : {}, TRule> extends false ? false : true : TRule extends RegleRuleDecl<any, any> ? FieldHaveRequiredRule<TRule> extends false ? false : true : false : false;
|
|
1176
1169
|
type SafeFieldProperty<TState, TRule extends RegleFormPropertyType<any, any> | undefined = never> = FieldHaveRequiredRule<TRule> extends true ? NonNullable<TState> : MaybeOutput<TState>;
|
|
1177
|
-
|
|
1178
1170
|
//#endregion
|
|
1179
1171
|
//#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.d.ts
|
|
1180
1172
|
/**
|
|
@@ -1215,7 +1207,7 @@ type IsAny$2<T> = [T] extends [Secret] ? Not<IsNever$2<T>> : false;
|
|
|
1215
1207
|
/**
|
|
1216
1208
|
* Determines if the given type is `unknown`.
|
|
1217
1209
|
*/
|
|
1218
|
-
type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny$2<T>> : false;
|
|
1210
|
+
type IsUnknown$1<T> = [unknown] extends [T] ? Not<IsAny$2<T>> : false;
|
|
1219
1211
|
/**
|
|
1220
1212
|
* Determines if a type is either `never` or `any`.
|
|
1221
1213
|
*/
|
|
@@ -1285,13 +1277,13 @@ type MutuallyExtends<Left, Right> = And<[Extends<Left, Right>, Extends<Right, Le
|
|
|
1285
1277
|
* Convert a union to an intersection.
|
|
1286
1278
|
* `A | B | C` -\> `A & B & C`
|
|
1287
1279
|
*/
|
|
1288
|
-
type UnionToIntersection<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection : never;
|
|
1280
|
+
type UnionToIntersection$1<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection : never;
|
|
1289
1281
|
/**
|
|
1290
1282
|
* Get the last element of a union.
|
|
1291
1283
|
* First, converts to a union of `() => T` functions,
|
|
1292
1284
|
* then uses {@linkcode UnionToIntersection} to get the last one.
|
|
1293
1285
|
*/
|
|
1294
|
-
type LastOf<Union> = UnionToIntersection<Union extends any ? () => Union : never> extends (() => infer R) ? R : never;
|
|
1286
|
+
type LastOf<Union> = UnionToIntersection$1<Union extends any ? () => Union : never> extends (() => infer R) ? R : never;
|
|
1295
1287
|
/**
|
|
1296
1288
|
* Intermediate type for {@linkcode UnionToTuple} which pushes the
|
|
1297
1289
|
* "last" union member to the end of a tuple, and recursively prepends
|
|
@@ -1301,11 +1293,8 @@ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever$2<Union> extends
|
|
|
1301
1293
|
/**
|
|
1302
1294
|
* Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
|
|
1303
1295
|
*/
|
|
1304
|
-
type UnionToTuple<Union> = TuplifyUnion<Union>;
|
|
1305
|
-
type IsUnion<T> = Not<Extends<UnionToTuple<T>['length'], 1>>;
|
|
1306
|
-
|
|
1307
|
-
//#endregion
|
|
1308
|
-
//#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.d.ts
|
|
1296
|
+
type UnionToTuple$1<Union> = TuplifyUnion<Union>;
|
|
1297
|
+
type IsUnion<T> = Not<Extends<UnionToTuple$1<T>['length'], 1>>;
|
|
1309
1298
|
/**
|
|
1310
1299
|
* A recursive version of `Pick` that selects properties from the left type that are present in the right type.
|
|
1311
1300
|
* The "leaf" types from `Left` are used - only the keys of `Right` are considered.
|
|
@@ -1317,6 +1306,8 @@ type IsUnion<T> = Not<Extends<UnionToTuple<T>['length'], 1>>;
|
|
|
1317
1306
|
* type Result = DeepPickMatchingProps<typeof user, {name: unknown; address: {city: unknown}}> // {name: string, address: {city: string}}
|
|
1318
1307
|
* ```
|
|
1319
1308
|
*/
|
|
1309
|
+
//#endregion
|
|
1310
|
+
//#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.d.ts
|
|
1320
1311
|
/**
|
|
1321
1312
|
* The simple(ish) way to get overload info from a function
|
|
1322
1313
|
* {@linkcode FunctionType}. Recent versions of TypeScript will match any
|
|
@@ -1581,8 +1572,7 @@ type ConstructorOverloadParameters<ConstructorType> = ConstructorOverloadsUnion<
|
|
|
1581
1572
|
/**
|
|
1582
1573
|
* Calculates the number of overloads for a given function type.
|
|
1583
1574
|
*/
|
|
1584
|
-
type NumOverloads<FunctionType> = UnionToTuple<OverloadsInfoUnion<FunctionType>>['length'];
|
|
1585
|
-
|
|
1575
|
+
type NumOverloads<FunctionType> = UnionToTuple$1<OverloadsInfoUnion<FunctionType>>['length'];
|
|
1586
1576
|
//#endregion
|
|
1587
1577
|
//#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.d.ts
|
|
1588
1578
|
/**
|
|
@@ -1605,7 +1595,7 @@ type DeepBrand<T> = IsNever$2<T> extends true ? {
|
|
|
1605
1595
|
type: 'never';
|
|
1606
1596
|
} : IsAny$2<T> extends true ? {
|
|
1607
1597
|
type: 'any';
|
|
1608
|
-
} : IsUnknown<T> extends true ? {
|
|
1598
|
+
} : IsUnknown$1<T> extends true ? {
|
|
1609
1599
|
type: 'unknown';
|
|
1610
1600
|
} : T extends string | number | boolean | symbol | bigint | null | undefined | void ? {
|
|
1611
1601
|
type: 'primitive';
|
|
@@ -1620,7 +1610,7 @@ type DeepBrand<T> = IsNever$2<T> extends true ? {
|
|
|
1620
1610
|
return: DeepBrand<R>;
|
|
1621
1611
|
this: DeepBrand<ThisParameterType<T>>;
|
|
1622
1612
|
props: DeepBrand<Omit<T, keyof Function>>;
|
|
1623
|
-
} : UnionToTuple<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? {
|
|
1613
|
+
} : UnionToTuple$1<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? {
|
|
1624
1614
|
type: 'overloads';
|
|
1625
1615
|
overloads: { [K in keyof OverloadsTuple]: DeepBrand<OverloadsTuple[K]> };
|
|
1626
1616
|
} : never : T extends any[] ? {
|
|
@@ -1638,13 +1628,12 @@ type DeepBrand<T> = IsNever$2<T> extends true ? {
|
|
|
1638
1628
|
* Checks if two types are strictly equal using branding.
|
|
1639
1629
|
*/
|
|
1640
1630
|
type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>;
|
|
1641
|
-
|
|
1642
1631
|
//#endregion
|
|
1643
1632
|
//#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.d.ts
|
|
1644
1633
|
/**
|
|
1645
1634
|
* Determines the printable type representation for a given type.
|
|
1646
1635
|
*/
|
|
1647
|
-
type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever$2<T> extends true ? 'never' : IsAny$2<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends ((...args: any[]) => any) ? 'function' : '...';
|
|
1636
|
+
type PrintType<T> = IsUnknown$1<T> extends true ? 'unknown' : IsNever$2<T> extends true ? 'never' : IsAny$2<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends ((...args: any[]) => any) ? 'function' : '...';
|
|
1648
1637
|
/**
|
|
1649
1638
|
* Helper for showing end-user a hint why their type assertion is failing.
|
|
1650
1639
|
* This swaps "leaf" types with a literal message about what the actual and
|
|
@@ -1652,17 +1641,16 @@ type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever$2<T> extends
|
|
|
1652
1641
|
* otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔
|
|
1653
1642
|
*/
|
|
1654
1643
|
type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny$2<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : { [K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never> } : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
|
|
1655
|
-
|
|
1656
|
-
//#endregion
|
|
1657
|
-
//#region src/types/core/variants.types.d.ts
|
|
1658
1644
|
/**
|
|
1659
1645
|
* @internal
|
|
1660
1646
|
*/
|
|
1647
|
+
//#endregion
|
|
1648
|
+
//#region src/types/core/variants.types.d.ts
|
|
1661
1649
|
|
|
1662
1650
|
type MaybeVariantStatus<TState extends Record<string, any> | undefined = Record<string, any>, TRules extends ReglePartialRuleTree<NonNullable<TState>> = Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}> = IsUnion<NonNullable<TState>> extends true ? Omit<RegleStatus<TState, TRules, TShortcuts>, '$fields'> & {
|
|
1663
1651
|
$fields: ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>];
|
|
1664
1652
|
} : RegleStatus<TState, TRules, TShortcuts>;
|
|
1665
|
-
type ProcessChildrenFields<TState extends Record<string, any> | undefined, TRules extends ReglePartialRuleTree<NonNullable<TState>>, TShortcuts extends RegleShortcutDefinition = {}> = { [TIndex in keyof TupleToPlainObj<UnionToTuple
|
|
1653
|
+
type ProcessChildrenFields<TState extends Record<string, any> | undefined, TRules extends ReglePartialRuleTree<NonNullable<TState>>, TShortcuts extends RegleShortcutDefinition = {}> = { [TIndex in keyof TupleToPlainObj<UnionToTuple<TState>>]: TIndex extends `${infer TIndexInt extends number}` ? { [TKey in keyof UnionToTuple<TState>[TIndexInt] as IsEmptyObject$1<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1> extends true ? TKey extends keyof TState ? TState[TKey] extends NonNullable<TState[TKey]> ? TKey : never : never : TKey]-?: InferRegleStatusType<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1, NonNullable<UnionToTuple<TState>[TIndexInt]>, TKey, TShortcuts> } & { [TKey in keyof UnionToTuple<TState>[TIndexInt] as IsEmptyObject$1<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1> extends true ? TKey extends keyof TState ? TState[TKey] extends NonNullable<TState[TKey]> ? never : TKey : TKey : never]?: InferRegleStatusType<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1, NonNullable<UnionToTuple<TState>[TIndexInt]>, TKey, TShortcuts> } : {} };
|
|
1666
1654
|
type FindCorrespondingVariant<TState extends Record<string, any>, TRules extends any[]> = TRules extends [infer F, ...infer R] ? F extends ReglePartialRuleTree<TState> ? [F] : FindCorrespondingVariant<TState, R> : [];
|
|
1667
1655
|
//#endregion
|
|
1668
1656
|
//#region src/core/useRegle/useRegle.d.ts
|
|
@@ -1714,7 +1702,7 @@ type GetMaybeObjectValue<O extends Record<string, any>, K extends string> = K ex
|
|
|
1714
1702
|
/**
|
|
1715
1703
|
* Combine all union values to be able to get even the normally "never" values, act as an intersection type
|
|
1716
1704
|
*/
|
|
1717
|
-
type RetrieveUnionUnknownValues<T extends readonly any[], TKeys extends string> = T extends [infer F extends Record<string, any>, ...infer R] ? [{ [K in TKeys as GetMaybeObjectValue<F, K> extends
|
|
1705
|
+
type RetrieveUnionUnknownValues<T extends readonly any[], TKeys extends string> = T extends [infer F extends Record<string, any>, ...infer R] ? [{ [K in TKeys as GetMaybeObjectValue<F, K> extends NonUndefined<GetMaybeObjectValue<F, K>> ? never : K]?: GetMaybeObjectValue<F, K> } & { [K in TKeys as GetMaybeObjectValue<F, K> extends NonUndefined<GetMaybeObjectValue<F, K>> ? K : never]: GetMaybeObjectValue<F, K> }, ...RetrieveUnionUnknownValues<R, TKeys>] : [];
|
|
1718
1706
|
/**
|
|
1719
1707
|
* Get all possible keys from a union, even the ones present only on one union
|
|
1720
1708
|
*/
|
|
@@ -1722,23 +1710,21 @@ type RetrieveUnionUnknownKeysOf<T extends readonly any[]> = T extends [infer F,
|
|
|
1722
1710
|
/**
|
|
1723
1711
|
* Transforms a union and apply undefined values to non-present keys to support intersection
|
|
1724
1712
|
*/
|
|
1725
|
-
type NormalizeUnion<TUnion> = RetrieveUnionUnknownValues<NonNullable<UnionToTuple
|
|
1713
|
+
type NormalizeUnion<TUnion> = RetrieveUnionUnknownValues<NonNullable<UnionToTuple<TUnion>>, RetrieveUnionUnknownKeysOf<NonNullable<UnionToTuple<TUnion>>>[number]>[number];
|
|
1726
1714
|
/**
|
|
1727
1715
|
* Combine all members of a union type, merging types for each key, and keeping loose types
|
|
1728
1716
|
*/
|
|
1729
|
-
type JoinDiscriminatedUnions<TUnion extends unknown> = isRecordLiteral<TUnion> extends true ? Prettify<Partial<UnionToIntersection
|
|
1717
|
+
type JoinDiscriminatedUnions<TUnion extends unknown> = isRecordLiteral<TUnion> extends true ? Prettify<Partial<UnionToIntersection<RemoveCommonKey<UnionToTuple<NonNullable<TUnion>>, keyof NormalizeUnion<NonNullable<TUnion>>>[number]>> & Pick<NormalizeUnion<NonNullable<TUnion>>, keyof NormalizeUnion<NonNullable<TUnion>>>> : TUnion;
|
|
1730
1718
|
type EnumLike = {
|
|
1731
1719
|
[k: string]: string | number;
|
|
1732
1720
|
[nu: number]: string;
|
|
1733
1721
|
};
|
|
1734
1722
|
type UnwrapMaybeRef<T extends MaybeRef<any> | DeepReactiveState<any>> = T extends Ref<any> ? UnwrapRef<T> : UnwrapNestedRefs<T>;
|
|
1735
1723
|
type TupleToPlainObj<T> = { [I in keyof T & `${number}`]: T[I] };
|
|
1736
|
-
|
|
1737
1724
|
//#endregion
|
|
1738
1725
|
//#region src/types/utils/mismatch.types.d.ts
|
|
1739
1726
|
type isDeepExact<TRules, TTree> = { [K in keyof TRules]-?: CheckDeepExact<NonNullable<TRules[K]>, K extends keyof JoinDiscriminatedUnions<TTree> ? NonNullable<JoinDiscriminatedUnions<TTree>[K]> : never> }[keyof TRules] extends true ? true : false;
|
|
1740
1727
|
type CheckDeepExact<TRules, TTree> = [TTree] extends [never] ? false : TRules extends RegleCollectionRuleDecl ? TTree extends Array<any> ? isDeepExact<NonNullable<TRules['$each']>, JoinDiscriminatedUnions<NonNullable<ArrayElement$1<TTree>>>> : TRules extends RegleRuleDecl ? true : TRules extends ReglePartialRuleTree<any> ? isDeepExact<TRules, TTree> : false : TRules extends RegleRuleDecl ? true : TRules extends ReglePartialRuleTree<any> ? isDeepExact<TRules, TTree> : false;
|
|
1741
|
-
|
|
1742
1728
|
//#endregion
|
|
1743
1729
|
//#region src/types/utils/infer.types.d.ts
|
|
1744
1730
|
|
|
@@ -1752,7 +1738,6 @@ type CreateFn<T extends any[]> = (...args: T) => any;
|
|
|
1752
1738
|
*/
|
|
1753
1739
|
type RegleUniversalParams<T extends any[] = [], F = CreateFn<T>> = [T] extends [[]] ? [] : Parameters<F extends ((...args: infer Args) => any) ? (...args: { [K in keyof Args]: MaybeRefOrGetter<Maybe<Args[K]>> }) => any : never>;
|
|
1754
1740
|
type UnwrapRegleUniversalParams<T extends MaybeRefOrGetter[] = [], F = CreateFn<T>> = [T] extends [[]] ? [] : Parameters<F extends ((...args: infer Args) => any) ? (...args: { [K in keyof Args]: Args[K] extends MaybeRefOrGetter<Maybe<infer U>> ? U : Args[K] }) => any : never>;
|
|
1755
|
-
|
|
1756
1741
|
//#endregion
|
|
1757
1742
|
//#region src/types/rules/rule.internal.types.d.ts
|
|
1758
1743
|
/**
|
|
@@ -1853,7 +1838,6 @@ type RegleCollectionRuleDefinition<TValue = any[], TCustomRules extends Partial<
|
|
|
1853
1838
|
}) | ({
|
|
1854
1839
|
$each: MaybeGetter<RegleFormPropertyType<ArrayElement$1<NonNullable<TValue>>, TCustomRules>, ArrayElement$1<TValue>>;
|
|
1855
1840
|
} & CollectionRegleBehaviourOptions);
|
|
1856
|
-
|
|
1857
1841
|
//#endregion
|
|
1858
1842
|
//#region src/types/rules/rule.init.types.d.ts
|
|
1859
1843
|
type RegleInitPropertyGetter<TValue, TReturn, TParams extends [...any[]], TMetadata extends RegleRuleMetadataDefinition> = TReturn | ((metadata: RegleRuleMetadataConsumer<TValue, TParams, TMetadata>) => TReturn);
|
|
@@ -1943,7 +1927,6 @@ type DefaultValidators = {
|
|
|
1943
1927
|
startsWith: RegleRuleWithParamsDefinition<string, [part: Maybe<string>], false, boolean>;
|
|
1944
1928
|
url: RegleRuleDefinition<string, [], false, boolean, string>;
|
|
1945
1929
|
};
|
|
1946
|
-
|
|
1947
1930
|
//#endregion
|
|
1948
1931
|
//#region src/types/rules/rule.custom.types.d.ts
|
|
1949
1932
|
type CustomRulesDeclarationTree = {
|
|
@@ -1951,7 +1934,6 @@ type CustomRulesDeclarationTree = {
|
|
|
1951
1934
|
};
|
|
1952
1935
|
type DefaultValidatorsTree = { [K in keyof DefaultValidators]: RegleRuleRawInput<any, any[], boolean, any> | undefined };
|
|
1953
1936
|
type AllRulesDeclarations = CustomRulesDeclarationTree & DefaultValidatorsTree;
|
|
1954
|
-
|
|
1955
1937
|
//#endregion
|
|
1956
1938
|
//#region src/types/rules/rule.declaration.types.d.ts
|
|
1957
1939
|
/**
|
|
@@ -2019,7 +2001,6 @@ type InlineRuleDeclaration<TValue extends any = any, TParams extends any[] = any
|
|
|
2019
2001
|
* Regroup inline and registered rules
|
|
2020
2002
|
* */
|
|
2021
2003
|
type FormRuleDeclaration<TValue extends any = unknown, TParams extends any[] = any[], TReturn extends RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition> = RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>, TMetadata extends RegleRuleMetadataDefinition = (TReturn extends Promise<infer M> ? M : TReturn), TAsync extends boolean = boolean> = InlineRuleDeclaration<TValue, TParams, TReturn> | RegleRuleDefinition<TValue, TParams, TAsync, TMetadata> | RegleRuleWithParamsDefinitionInput<TValue, [param?: any], TAsync, TMetadata> | RegleRuleWithParamsDefinitionInput<TValue, [param?: any, ...any[]], TAsync, TMetadata>;
|
|
2022
|
-
|
|
2023
2004
|
//#endregion
|
|
2024
2005
|
//#region src/types/rules/rule.errors.types.d.ts
|
|
2025
2006
|
type RegleErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], false> };
|
|
@@ -2051,7 +2032,7 @@ type RegleRoot<TState extends Record<string, any> = {}, TRules extends ReglePart
|
|
|
2051
2032
|
*/
|
|
2052
2033
|
type RegleStatus<TState extends Record<string, any> | undefined = Record<string, any>, TRules extends ReglePartialRuleTree<NonNullable<TState>> = Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}> = RegleCommonStatus<TState> & {
|
|
2053
2034
|
/** Represents all the children of your object. You can access any nested child at any depth to get the relevant data you need for your form. */
|
|
2054
|
-
readonly $fields: { readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? IsEmptyObject<TRules[TKey]> extends true ? TKey : never : never : TKey]: IsUnion<NonNullable<TRules[TKey]>> extends true ? ExtendOnlyRealRecord<TState[TKey]> extends true ? MaybeVariantStatus<NonNullable<TState>[TKey], NonNullable<TRules[TKey]>, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> } & { readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? IsEmptyObject<TRules[TKey]> extends true ? never : TKey : TKey : never]-?: IsUnion<NonNullable<TRules[TKey]>> extends true ? ExtendOnlyRealRecord<TState[TKey]> extends true ? MaybeVariantStatus<NonNullable<TState>[TKey], NonNullable<TRules[TKey]>, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> };
|
|
2035
|
+
readonly $fields: { readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? IsEmptyObject$1<TRules[TKey]> extends true ? TKey : never : never : TKey]: IsUnion<NonNullable<TRules[TKey]>> extends true ? ExtendOnlyRealRecord<TState[TKey]> extends true ? MaybeVariantStatus<NonNullable<TState>[TKey], NonNullable<TRules[TKey]>, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> } & { readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? IsEmptyObject$1<TRules[TKey]> extends true ? never : TKey : TKey : never]-?: IsUnion<NonNullable<TRules[TKey]>> extends true ? ExtendOnlyRealRecord<TState[TKey]> extends true ? MaybeVariantStatus<NonNullable<TState>[TKey], NonNullable<TRules[TKey]>, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> : InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts> };
|
|
2055
2036
|
/**
|
|
2056
2037
|
* Collection of all the error messages, collected for all children properties and nested forms.
|
|
2057
2038
|
*
|
|
@@ -2103,7 +2084,7 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
|
|
|
2103
2084
|
/** Sets all properties as dirty, triggering all rules. It returns a promise that will either resolve to false or a type safe copy of your form state. Values that had the required rule will be transformed into a non-nullable value (type only). */
|
|
2104
2085
|
$validate: () => Promise<RegleResult<TState, TRules>>;
|
|
2105
2086
|
/** This is reactive tree containing all the declared rules of your field. To know more about the rule properties check the rules properties section */
|
|
2106
|
-
readonly $rules: IsEmptyObject<TRules> extends true ? {
|
|
2087
|
+
readonly $rules: IsEmptyObject$1<TRules> extends true ? {
|
|
2107
2088
|
readonly [x: string]: RegleRuleStatus<TState, any[], any>;
|
|
2108
2089
|
} : { readonly [TRuleKey in keyof Omit<TRules, '$each' | keyof FieldRegleBehaviourOptions>]: RegleRuleStatus<TState, TRules[TRuleKey] extends RegleRuleDefinition<any, infer TParams, any> ? TParams : [], TRules[TRuleKey] extends RegleRuleDefinition<any, any, any, infer TMetadata> ? TMetadata : TRules[TRuleKey] extends InlineRuleDeclaration<any, any[], infer TMetadata> ? TMetadata extends Promise<infer P> ? P : TMetadata : any> };
|
|
2109
2090
|
} & ([TShortcuts['fields']] extends [never] ? {} : { [K in keyof TShortcuts['fields']]: ReturnType<NonNullable<TShortcuts['fields']>[K]> });
|
|
@@ -2189,7 +2170,7 @@ type RegleRuleStatus<TValue = any, TParams extends any[] = any[], TMetadata exte
|
|
|
2189
2170
|
/** Reset the $valid, $metadata and $pending states */
|
|
2190
2171
|
$reset(): void;
|
|
2191
2172
|
/** Returns the original rule validator function. */
|
|
2192
|
-
$validator: ((value: IsUnknown
|
|
2173
|
+
$validator: ((value: IsUnknown<TValue> extends true ? any : MaybeInput<TValue>, ...args: any[]) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>) & ((value: IsUnknown<TValue> extends true ? any : TValue, ...args: [TParams] extends [never[]] ? [] : [unknown[]] extends [TParams] ? any[] : TParams) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>);
|
|
2193
2174
|
} & ([TParams] extends [never[]] ? {} : [unknown[]] extends [TParams] ? {
|
|
2194
2175
|
readonly $params?: any[];
|
|
2195
2176
|
} : {
|
|
@@ -2325,7 +2306,6 @@ type useCollectScopeFn<TNamedScoped extends boolean = false> = TNamedScoped exte
|
|
|
2325
2306
|
} : <TValue extends Record<string, unknown>[] = Record<string, unknown>[]>(namespace?: MaybeRefOrGetter<string>) => {
|
|
2326
2307
|
r$: MergedScopedRegles<TValue>;
|
|
2327
2308
|
};
|
|
2328
|
-
|
|
2329
2309
|
//#endregion
|
|
2330
2310
|
//#region src/core/createScopedUseRegle/useScopedRegle.d.ts
|
|
2331
2311
|
type UseScopedRegleOptions<TAsRecord extends boolean> = {
|
|
@@ -2333,7 +2313,6 @@ type UseScopedRegleOptions<TAsRecord extends boolean> = {
|
|
|
2333
2313
|
} & (TAsRecord extends true ? {
|
|
2334
2314
|
scopeKey: string;
|
|
2335
2315
|
} : {});
|
|
2336
|
-
|
|
2337
2316
|
//#endregion
|
|
2338
2317
|
//#region src/core/createScopedUseRegle/createScopedUseRegle.d.ts
|
|
2339
2318
|
type CreateScopedUseRegleOptions<TCustomRegle extends useRegleFn<any, any>, TAsRecord extends boolean> = {
|
|
@@ -2350,18 +2329,16 @@ type CreateScopedUseRegleOptions<TCustomRegle extends useRegleFn<any, any>, TAsR
|
|
|
2350
2329
|
*/
|
|
2351
2330
|
asRecord?: TAsRecord;
|
|
2352
2331
|
};
|
|
2353
|
-
|
|
2354
2332
|
//#endregion
|
|
2355
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2333
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
|
|
2356
2334
|
/**
|
|
2357
2335
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
2358
2336
|
|
|
2359
2337
|
@category Type
|
|
2360
2338
|
*/
|
|
2361
2339
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
2362
|
-
|
|
2363
2340
|
//#endregion
|
|
2364
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2341
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
|
|
2365
2342
|
declare global {
|
|
2366
2343
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
2367
2344
|
interface SymbolConstructor {
|
|
@@ -2369,8 +2346,6 @@ declare global {
|
|
|
2369
2346
|
}
|
|
2370
2347
|
}
|
|
2371
2348
|
|
|
2372
|
-
//#endregion
|
|
2373
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/empty-object.d.ts
|
|
2374
2349
|
/**
|
|
2375
2350
|
@remarks
|
|
2376
2351
|
The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
|
|
@@ -2381,6 +2356,8 @@ As well, some guidance on making an `Observable` to not include `closed` propert
|
|
|
2381
2356
|
|
|
2382
2357
|
@category Observable
|
|
2383
2358
|
*/
|
|
2359
|
+
//#endregion
|
|
2360
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/empty-object.d.ts
|
|
2384
2361
|
declare const emptyObjectSymbol: unique symbol;
|
|
2385
2362
|
|
|
2386
2363
|
/**
|
|
@@ -2413,8 +2390,6 @@ type EmptyObject = {
|
|
|
2413
2390
|
[emptyObjectSymbol]?: never;
|
|
2414
2391
|
};
|
|
2415
2392
|
|
|
2416
|
-
//#endregion
|
|
2417
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
2418
2393
|
/**
|
|
2419
2394
|
Returns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value.
|
|
2420
2395
|
|
|
@@ -2430,6 +2405,8 @@ type Fail = IsEmptyObject<null>; //=> false
|
|
|
2430
2405
|
@see EmptyObject
|
|
2431
2406
|
@category Object
|
|
2432
2407
|
*/
|
|
2408
|
+
//#endregion
|
|
2409
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
2433
2410
|
/**
|
|
2434
2411
|
Extract all optional keys from the given type.
|
|
2435
2412
|
|
|
@@ -2465,11 +2442,9 @@ const update2: UpdateOperation<User> = {
|
|
|
2465
2442
|
*/
|
|
2466
2443
|
type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
|
|
2467
2444
|
? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
|
|
2468
|
-
: never;
|
|
2469
|
-
|
|
2445
|
+
: never; // Should never happen
|
|
2470
2446
|
//#endregion
|
|
2471
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2472
|
-
// Should never happen
|
|
2447
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
2473
2448
|
/**
|
|
2474
2449
|
Extract all required keys from the given type.
|
|
2475
2450
|
|
|
@@ -2495,12 +2470,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
2495
2470
|
@category Utilities
|
|
2496
2471
|
*/
|
|
2497
2472
|
type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
|
|
2498
|
-
? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never;
|
|
2473
|
+
? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never; // Should never happen
|
|
2499
2474
|
|
|
2500
2475
|
//#endregion
|
|
2501
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2502
|
-
// Should never happen
|
|
2503
|
-
|
|
2476
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
|
|
2504
2477
|
/**
|
|
2505
2478
|
Returns a boolean for whether the given type is `never`.
|
|
2506
2479
|
|
|
@@ -2543,9 +2516,8 @@ endIfEqual('abc', '123');
|
|
|
2543
2516
|
@category Utilities
|
|
2544
2517
|
*/
|
|
2545
2518
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
2546
|
-
|
|
2547
2519
|
//#endregion
|
|
2548
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2520
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
|
|
2549
2521
|
/**
|
|
2550
2522
|
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
2551
2523
|
|
|
@@ -2565,10 +2537,9 @@ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
|
2565
2537
|
@category Type Guard
|
|
2566
2538
|
@category Utilities
|
|
2567
2539
|
*/
|
|
2568
|
-
type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
|
|
2569
|
-
|
|
2540
|
+
type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
|
|
2570
2541
|
//#endregion
|
|
2571
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2542
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/array.d.ts
|
|
2572
2543
|
/**
|
|
2573
2544
|
Extract the element of an array that also works for array union.
|
|
2574
2545
|
|
|
@@ -2578,8 +2549,6 @@ It creates a type-safe way to access the element type of `unknown` type.
|
|
|
2578
2549
|
*/
|
|
2579
2550
|
type ArrayElement<T> = T extends readonly unknown[] ? T[0] : never;
|
|
2580
2551
|
|
|
2581
|
-
//#endregion
|
|
2582
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-any.d.ts
|
|
2583
2552
|
/**
|
|
2584
2553
|
Returns the static, fixed-length portion of the given array, excluding variable-length parts.
|
|
2585
2554
|
|
|
@@ -2590,6 +2559,8 @@ type B = StaticPartOfArray<A>;
|
|
|
2590
2559
|
//=> [string, number, boolean]
|
|
2591
2560
|
```
|
|
2592
2561
|
*/
|
|
2562
|
+
//#endregion
|
|
2563
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
|
|
2593
2564
|
// Can eventually be replaced with the built-in once this library supports
|
|
2594
2565
|
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
2595
2566
|
type NoInfer<T> = T extends infer U ? U : never;
|
|
@@ -2623,9 +2594,8 @@ const anyA = get(anyObject, 'a');
|
|
|
2623
2594
|
@category Utilities
|
|
2624
2595
|
*/
|
|
2625
2596
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
2626
|
-
|
|
2627
2597
|
//#endregion
|
|
2628
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2598
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
|
|
2629
2599
|
/**
|
|
2630
2600
|
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
2631
2601
|
|
|
@@ -2684,9 +2654,8 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
2684
2654
|
@category Object
|
|
2685
2655
|
*/
|
|
2686
2656
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
2687
|
-
|
|
2688
2657
|
//#endregion
|
|
2689
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2658
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
2690
2659
|
/**
|
|
2691
2660
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
2692
2661
|
|
|
@@ -2778,9 +2747,8 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
2778
2747
|
@category Object
|
|
2779
2748
|
*/
|
|
2780
2749
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
2781
|
-
|
|
2782
2750
|
//#endregion
|
|
2783
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2751
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
2784
2752
|
/**
|
|
2785
2753
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
2786
2754
|
|
|
@@ -2827,9 +2795,8 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
2827
2795
|
@category Object
|
|
2828
2796
|
*/
|
|
2829
2797
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
2830
|
-
|
|
2831
2798
|
//#endregion
|
|
2832
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2799
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
|
|
2833
2800
|
// Merges two objects without worrying about index signatures.
|
|
2834
2801
|
type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
|
|
2835
2802
|
|
|
@@ -2868,9 +2835,8 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
2868
2835
|
@category Object
|
|
2869
2836
|
*/
|
|
2870
2837
|
type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
2871
|
-
|
|
2872
2838
|
//#endregion
|
|
2873
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2839
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
|
|
2874
2840
|
/**
|
|
2875
2841
|
An if-else-like type that resolves depending on whether the given type is `any`.
|
|
2876
2842
|
|
|
@@ -2890,21 +2856,20 @@ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
|
|
|
2890
2856
|
@category Type Guard
|
|
2891
2857
|
@category Utilities
|
|
2892
2858
|
*/
|
|
2893
|
-
type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
|
|
2894
|
-
|
|
2859
|
+
type IfAny$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
|
|
2895
2860
|
//#endregion
|
|
2896
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2861
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
|
|
2897
2862
|
/**
|
|
2898
2863
|
Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
2899
2864
|
*/
|
|
2900
2865
|
type BuiltIns = Primitive | void | Date | RegExp;
|
|
2901
2866
|
|
|
2902
|
-
//#endregion
|
|
2903
|
-
//#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/object.d.ts
|
|
2904
2867
|
/**
|
|
2905
2868
|
Matches non-recursive types.
|
|
2906
2869
|
*/
|
|
2907
2870
|
|
|
2871
|
+
//#endregion
|
|
2872
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
|
|
2908
2873
|
/**
|
|
2909
2874
|
Merges user specified options with default options.
|
|
2910
2875
|
|
|
@@ -2957,11 +2922,10 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
2957
2922
|
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
2958
2923
|
```
|
|
2959
2924
|
*/
|
|
2960
|
-
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
2925
|
+
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny$1<SpecifiedOptions, Defaults, IfNever$1<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
2961
2926
|
>>;
|
|
2962
|
-
|
|
2963
2927
|
//#endregion
|
|
2964
|
-
//#region ../../node_modules/.pnpm/type-fest@4.
|
|
2928
|
+
//#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
|
|
2965
2929
|
/**
|
|
2966
2930
|
@see {@link PartialDeep}
|
|
2967
2931
|
*/
|
|
@@ -3078,7 +3042,6 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
|
|
|
3078
3042
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
3079
3043
|
*/
|
|
3080
3044
|
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = (ObjectType extends ((...arguments_: any) => unknown) ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> });
|
|
3081
|
-
|
|
3082
3045
|
//#endregion
|
|
3083
3046
|
//#region src/types/core.types.d.ts
|
|
3084
3047
|
type RegleSchema<TState extends Record<string, any>, TSchema extends Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}, TAdditionalReturnProperties extends Record<string, any> = {}> = {
|
|
@@ -3167,7 +3130,6 @@ type RegleSchemaCollectionStatus<TSchema extends Record<string, any>, TState ext
|
|
|
3167
3130
|
/** Will return a copy of your state with only the fields that are dirty. By default, it will filter out nullish values or objects, but you can override it with the first parameter $extractDirtyFields(false). */
|
|
3168
3131
|
$extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
|
|
3169
3132
|
} & ([TShortcuts['collections']] extends [never] ? {} : { [K in keyof TShortcuts['collections']]: ReturnType<NonNullable<TShortcuts['collections']>[K]> });
|
|
3170
|
-
|
|
3171
3133
|
//#endregion
|
|
3172
3134
|
//#region src/types/options.types.d.ts
|
|
3173
3135
|
type RegleSchemaBehaviourOptions = {
|
|
@@ -3185,14 +3147,13 @@ type RegleSchemaBehaviourOptions = {
|
|
|
3185
3147
|
onValidate?: boolean;
|
|
3186
3148
|
};
|
|
3187
3149
|
};
|
|
3188
|
-
|
|
3189
3150
|
//#endregion
|
|
3190
3151
|
//#region src/core/useRegleSchema.d.ts
|
|
3191
3152
|
type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy' | 'rewardEarly' | 'silent'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
|
|
3192
3153
|
interface useRegleSchemaFn<TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
|
|
3193
|
-
<TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(...params: [state: MaybeRef<PartialDeep<TState
|
|
3154
|
+
<TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(...params: [state: MaybeRef<PartialDeep<NoInferLegacy<TState>, {
|
|
3194
3155
|
recurseIntoArrays: true;
|
|
3195
|
-
}>> | DeepReactiveState<PartialDeep<TState
|
|
3156
|
+
}>> | DeepReactiveState<PartialDeep<NoInferLegacy<TState>, {
|
|
3196
3157
|
recurseIntoArrays: true;
|
|
3197
3158
|
}>>, rulesFactory: MaybeRef<TSchema>, ...(HaveAnyRequiredProps<useRegleSchemaFnOptions<TAdditionalOptions>> extends true ? [options: useRegleSchemaFnOptions<TAdditionalOptions>] : [options?: useRegleSchemaFnOptions<TAdditionalOptions>])]): NonNullable<TState> extends PrimitiveTypes ? RegleSingleFieldSchema<NonNullable<TState>, StandardSchemaV1.InferInput<TSchema>, TShortcuts, TAdditionalReturnProperties> : RegleSchema<UnwrapNestedRefs<NonNullable<TState>>, UnwrapNestedRefs<NonNullable<StandardSchemaV1.InferInput<TSchema>>>, TShortcuts, TAdditionalReturnProperties>;
|
|
3198
3159
|
}
|
|
@@ -3216,7 +3177,6 @@ interface useRegleSchemaFn<TShortcuts extends RegleShortcutDefinition<any> = nev
|
|
|
3216
3177
|
* Docs: {@link https://reglejs.dev/integrations/valibot#usage}
|
|
3217
3178
|
*/
|
|
3218
3179
|
declare const useRegleSchema: useRegleSchemaFn<RegleShortcutDefinition<any>, {}, {}>;
|
|
3219
|
-
|
|
3220
3180
|
//#endregion
|
|
3221
3181
|
//#region src/core/withDeps.d.ts
|
|
3222
3182
|
/**
|
|
@@ -3236,7 +3196,6 @@ declare const useRegleSchema: useRegleSchemaFn<RegleShortcutDefinition<any>, {},
|
|
|
3236
3196
|
* ```
|
|
3237
3197
|
*/
|
|
3238
3198
|
declare function withDeps<TSchema extends StandardSchemaV1, TParams extends unknown[] = []>(schema: TSchema, depsArray: [...TParams]): TSchema;
|
|
3239
|
-
|
|
3240
3199
|
//#endregion
|
|
3241
3200
|
//#region src/core/inferSchema.d.ts
|
|
3242
3201
|
interface inferSchemaFn {
|
|
@@ -3254,7 +3213,6 @@ interface inferSchemaFn {
|
|
|
3254
3213
|
* @param schema - Your schema
|
|
3255
3214
|
*/
|
|
3256
3215
|
declare const inferSchema: inferSchemaFn;
|
|
3257
|
-
|
|
3258
3216
|
//#endregion
|
|
3259
3217
|
//#region src/core/defineRegleSchemaConfig.d.ts
|
|
3260
3218
|
/**
|
|
@@ -3277,7 +3235,6 @@ declare function defineRegleSchemaConfig<TShortcuts extends RegleShortcutDefinit
|
|
|
3277
3235
|
useRegleSchema: useRegleSchemaFn<TShortcuts>;
|
|
3278
3236
|
inferSchema: inferSchemaFn;
|
|
3279
3237
|
};
|
|
3280
|
-
|
|
3281
3238
|
//#endregion
|
|
3282
3239
|
//#region src/core/createScopedUseRegleSchema.d.ts
|
|
3283
3240
|
type CreateScopedUseRegleSchemaOptions<TCustomRegle extends useRegleSchemaFn<any, any>, TAsRecord extends boolean> = Omit<CreateScopedUseRegleOptions<any, TAsRecord>, 'customUseRegle'> & {
|
|
@@ -3299,6 +3256,5 @@ declare const createScopedUseRegleSchema: <TCustomRegle extends useRegleSchemaFn
|
|
|
3299
3256
|
useScopedRegle: TReturnedRegle;
|
|
3300
3257
|
useCollectScope: useCollectScopeFn<TAsRecord>;
|
|
3301
3258
|
};
|
|
3302
|
-
|
|
3303
3259
|
//#endregion
|
|
3304
3260
|
export { InferRegleSchemaStatusType, RegleSchema, RegleSchemaBehaviourOptions, RegleSchemaCollectionStatus, RegleSchemaFieldStatus, RegleSchemaResult, RegleSchemaStatus, RegleSingleFieldSchema, createScopedUseRegleSchema, defineRegleSchemaConfig, inferSchema, useCollectSchemaScope, useRegleSchema, useScopedRegleSchema, withDeps };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regle/schemas",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Schemas adapter for Regle",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@standard-schema/spec": "1.0.0",
|
|
7
|
-
"@regle/core": "1.3.
|
|
8
|
-
"@regle/rules": "1.3.
|
|
7
|
+
"@regle/core": "1.3.2",
|
|
8
|
+
"@regle/rules": "1.3.2"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"valibot": "^1.0.0",
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@total-typescript/ts-reset": "0.6.1",
|
|
28
|
-
"@types/node": "22.15.
|
|
28
|
+
"@types/node": "22.15.29",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "8.28.0",
|
|
30
30
|
"@typescript-eslint/parser": "8.28.0",
|
|
31
31
|
"@vue/test-utils": "2.4.6",
|
|
32
|
-
"eslint": "9.
|
|
33
|
-
"eslint-config-prettier": "
|
|
34
|
-
"eslint-plugin-vue": "
|
|
32
|
+
"eslint": "9.28.0",
|
|
33
|
+
"eslint-config-prettier": "10.1.5",
|
|
34
|
+
"eslint-plugin-vue": "10.1.0",
|
|
35
35
|
"prettier": "3.5.3",
|
|
36
|
-
"tsdown": "0.12.
|
|
37
|
-
"type-fest": "4.
|
|
36
|
+
"tsdown": "0.12.7",
|
|
37
|
+
"type-fest": "4.41.0",
|
|
38
38
|
"typescript": "5.8.3",
|
|
39
39
|
"valibot": "1.1.0",
|
|
40
|
-
"vitest": "3.
|
|
41
|
-
"vue": "3.5.
|
|
40
|
+
"vitest": "3.2.2",
|
|
41
|
+
"vue": "3.5.16",
|
|
42
42
|
"vue-eslint-parser": "10.1.3",
|
|
43
43
|
"vue-tsc": "2.2.10",
|
|
44
|
-
"zod": "3.25.
|
|
44
|
+
"zod": "3.25.51"
|
|
45
45
|
},
|
|
46
46
|
"type": "module",
|
|
47
47
|
"exports": {
|