@regle/schemas 1.3.0 → 1.4.0-beta.1

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.
@@ -18,22 +18,19 @@ type ExcludeByType<T, U> = { [K in keyof T as T[K] extends U ? never : K]: T[K]
18
18
  type PrimitiveTypes = string | number | boolean | bigint | Date | File;
19
19
  type isRecordLiteral<T extends unknown> = NonNullable<T> extends Date | File ? false : NonNullable<T> extends Record<string, any> ? true : false;
20
20
  type NoInferLegacy<A extends any> = [A][A extends any ? 0 : never];
21
-
22
21
  //#endregion
23
22
  //#region src/types/utils/Array.types.d.ts
24
23
  type ArrayElement$1<T> = T extends Array<infer U> ? U : never;
25
-
26
24
  //#endregion
27
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/primitive.d.ts
25
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
28
26
  /**
29
27
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
30
28
 
31
29
  @category Type
32
30
  */
33
31
  type Primitive$1 = null | undefined | string | number | boolean | symbol | bigint;
34
-
35
32
  //#endregion
36
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/observable-like.d.ts
33
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
37
34
  declare global {
38
35
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
39
36
  interface SymbolConstructor {
@@ -41,8 +38,6 @@ declare global {
41
38
  }
42
39
  }
43
40
 
44
- //#endregion
45
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/union-to-intersection.d.ts
46
41
  /**
47
42
  @remarks
48
43
  The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
@@ -54,6 +49,8 @@ As well, some guidance on making an `Observable` to not include `closed` propert
54
49
  @category Observable
55
50
  */
56
51
 
52
+ //#endregion
53
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/union-to-intersection.d.ts
57
54
  /**
58
55
  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
56
 
@@ -99,7 +96,7 @@ type Intersection = UnionToIntersection<Union>;
99
96
 
100
97
  @category Type
101
98
  */
102
- type UnionToIntersection$1<Union> = (
99
+ type UnionToIntersection<Union> = (
103
100
  // `extends unknown` is always going to be the case and is used to convert the
104
101
  // `Union` into a [distributive conditional
105
102
  // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
@@ -114,9 +111,8 @@ Union extends unknown
114
111
  ) extends ((mergedIntersection: infer Intersection) => void)
115
112
  // The `& Union` is to allow indexing by the resulting type
116
113
  ? Intersection & Union : never;
117
-
118
114
  //#endregion
119
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/empty-object.d.ts
115
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/empty-object.d.ts
120
116
  declare const emptyObjectSymbol$1: unique symbol;
121
117
 
122
118
  /**
@@ -164,10 +160,9 @@ type Fail = IsEmptyObject<null>; //=> false
164
160
  @see EmptyObject
165
161
  @category Object
166
162
  */
167
- type IsEmptyObject<T> = T extends EmptyObject$1 ? true : false;
168
-
163
+ type IsEmptyObject$1<T> = T extends EmptyObject$1 ? true : false;
169
164
  //#endregion
170
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/optional-keys-of.d.ts
165
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
171
166
  /**
172
167
  Extract all optional keys from the given type.
173
168
 
@@ -203,11 +198,9 @@ const update2: UpdateOperation<User> = {
203
198
  */
204
199
  type OptionalKeysOf$1<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
205
200
  ? (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
-
201
+ : never; // Should never happen
208
202
  //#endregion
209
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/required-keys-of.d.ts
210
- // Should never happen
203
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
211
204
  /**
212
205
  Extract all required keys from the given type.
213
206
 
@@ -233,12 +226,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
233
226
  @category Utilities
234
227
  */
235
228
  type RequiredKeysOf$1<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
236
- ? Exclude<keyof BaseType, OptionalKeysOf$1<BaseType>> : never;
229
+ ? Exclude<keyof BaseType, OptionalKeysOf$1<BaseType>> : never; // Should never happen
237
230
 
238
231
  //#endregion
239
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-never.d.ts
240
- // Should never happen
241
-
232
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
242
233
  /**
243
234
  Returns a boolean for whether the given type is `never`.
244
235
 
@@ -281,9 +272,8 @@ endIfEqual('abc', '123');
281
272
  @category Utilities
282
273
  */
283
274
  type IsNever$1<T> = [T] extends [never] ? true : false;
284
-
285
275
  //#endregion
286
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/if-never.d.ts
276
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
287
277
  /**
288
278
  An if-else-like type that resolves depending on whether the given type is `never`.
289
279
 
@@ -303,10 +293,9 @@ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
303
293
  @category Type Guard
304
294
  @category Utilities
305
295
  */
306
- type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever);
307
-
296
+ type IfNever$1$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever);
308
297
  //#endregion
309
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-any.d.ts
298
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
310
299
  // Can eventually be replaced with the built-in once this library supports
311
300
  // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
312
301
  type NoInfer$1<T> = T extends infer U ? U : never;
@@ -340,19 +329,18 @@ const anyA = get(anyObject, 'a');
340
329
  @category Utilities
341
330
  */
342
331
  type IsAny$1<T> = 0 extends 1 & NoInfer$1<T> ? true : false;
343
-
344
332
  //#endregion
345
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/keys.d.ts
333
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/keys.d.ts
346
334
  /**
347
335
  Disallows any of the given keys.
348
336
  */
349
337
  type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;
350
338
 
351
- //#endregion
352
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/simplify.d.ts
353
339
  /**
354
340
  Utility type to retrieve only literal keys from type.
355
341
  */
342
+ //#endregion
343
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
356
344
  /**
357
345
  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
346
 
@@ -411,9 +399,8 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
411
399
  @category Object
412
400
  */
413
401
  type Simplify$1<T> = { [KeyType in keyof T]: T[KeyType] } & {};
414
-
415
402
  //#endregion
416
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/omit-index-signature.d.ts
403
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
417
404
  /**
418
405
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
419
406
 
@@ -505,9 +492,8 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
505
492
  @category Object
506
493
  */
507
494
  type OmitIndexSignature$1<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
508
-
509
495
  //#endregion
510
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/pick-index-signature.d.ts
496
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
511
497
  /**
512
498
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
513
499
 
@@ -554,9 +540,8 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
554
540
  @category Object
555
541
  */
556
542
  type PickIndexSignature$1<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
557
-
558
543
  //#endregion
559
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/merge.d.ts
544
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
560
545
  // Merges two objects without worrying about index signatures.
561
546
  type SimpleMerge$1<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
562
547
 
@@ -595,9 +580,8 @@ export type FooBar = Merge<Foo, Bar>;
595
580
  @category Object
596
581
  */
597
582
  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
583
  //#endregion
600
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/if-any.d.ts
584
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
601
585
  /**
602
586
  An if-else-like type that resolves depending on whether the given type is `any`.
603
587
 
@@ -617,10 +601,9 @@ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
617
601
  @category Type Guard
618
602
  @category Utilities
619
603
  */
620
- type IfAny$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny$1<T> extends true ? TypeIfAny : TypeIfNotAny);
621
-
604
+ type IfAny$1$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny$1<T> extends true ? TypeIfAny : TypeIfNotAny);
622
605
  //#endregion
623
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/type.d.ts
606
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
624
607
  /**
625
608
  Matches any primitive, `void`, `Date`, or `RegExp` value.
626
609
  */
@@ -639,10 +622,29 @@ Multiple call signatures cannot currently be supported due to a TypeScript limit
639
622
  @see https://github.com/microsoft/TypeScript/issues/29732
640
623
  */
641
624
 
642
- //#endregion
643
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/object.d.ts
644
625
  // Should never happen
645
626
 
627
+ /**
628
+ An if-else-like type that resolves depending on whether the given type is `any` or `never`.
629
+
630
+ @example
631
+ ```
632
+ // When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch
633
+ type A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;
634
+ //=> 'VALID'
635
+
636
+ // When `T` is `any` => Returns `IfAny` branch
637
+ type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
638
+ //=> 'IS_ANY'
639
+
640
+ // When `T` is `never` => Returns `IfNever` branch
641
+ type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
642
+ //=> 'IS_NEVER'
643
+ ```
644
+ */
645
+ type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = IsAny$1<T> extends true ? IfAny : IsNever$1<T> extends true ? IfNever : IfNotAnyOrNever;
646
+ //#endregion
647
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
646
648
  /**
647
649
  Merges user specified options with default options.
648
650
 
@@ -695,11 +697,10 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
695
697
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
696
698
  ```
697
699
  */
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>`
700
+ 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
701
  >>;
700
-
701
702
  //#endregion
702
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/require-exactly-one.d.ts
703
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/require-exactly-one.d.ts
703
704
  /**
704
705
  Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
705
706
 
@@ -729,10 +730,10 @@ const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
729
730
 
730
731
  @category Object
731
732
  */
732
- type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = { [Key in KeysType]: (Required<Pick<ObjectType, Key>> & Partial<Record<Exclude<KeysType, Key>, never>>) }[KeysType] & Omit<ObjectType, KeysType>;
733
-
733
+ 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>>>>;
734
+ 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
735
  //#endregion
735
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/require-one-or-none.d.ts
736
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/require-one-or-none.d.ts
736
737
  /**
737
738
  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
739
 
@@ -763,11 +764,10 @@ const responder3: Responder = {
763
764
 
764
765
  @category Object
765
766
  */
766
- type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = (RequireExactlyOne<ObjectType, KeysType> | RequireNone<KeysType>) & Omit<ObjectType, KeysType>;
767
-
767
+ 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>>>>;
768
+ type _RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType> = (RequireExactlyOne<ObjectType, KeysType> | RequireNone<KeysType>) & Omit<ObjectType, KeysType>; // Ignore unspecified keys.
768
769
  //#endregion
769
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/partial-deep.d.ts
770
- // Ignore unspecified keys.
770
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
771
771
  /**
772
772
  @see {@link PartialDeep}
773
773
  */
@@ -884,12 +884,11 @@ type PartialReadonlySetDeep$1<T, Options extends Required<PartialDeepOptions$1>>
884
884
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
885
885
  */
886
886
  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
887
  //#endregion
889
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/required-deep.d.ts
888
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-deep.d.ts
890
889
 
891
890
  //#endregion
892
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/union-to-tuple.d.ts
891
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/union-to-tuple.d.ts
893
892
  /**
894
893
  Returns the last element of a union type.
895
894
 
@@ -899,7 +898,7 @@ type Last = LastOfUnion<1 | 2 | 3>;
899
898
  //=> 3
900
899
  ```
901
900
  */
902
- type LastOfUnion<T> = UnionToIntersection$1<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
901
+ type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
903
902
 
904
903
  /**
905
904
  Convert a union type into an unordered tuple type of its elements.
@@ -936,10 +935,9 @@ const petList = Object.keys(pets) as UnionToTuple<Pet>;
936
935
 
937
936
  @category Array
938
937
  */
939
- type UnionToTuple$1<T, L = LastOfUnion<T>> = IsNever$1<T> extends false ? [...UnionToTuple$1<Exclude<T, L>>, L] : [];
940
-
938
+ type UnionToTuple<T, L = LastOfUnion<T>> = IsNever$1<T> extends false ? [...UnionToTuple<Exclude<T, L>>, L] : [];
941
939
  //#endregion
942
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-null.d.ts
940
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-null.d.ts
943
941
  /**
944
942
  Returns a boolean for whether the given type is `null`.
945
943
 
@@ -960,9 +958,8 @@ type Example2 = NonNullFallback<number, string>;
960
958
  @category Utilities
961
959
  */
962
960
  type IsNull<T> = [T] extends [null] ? true : false;
963
-
964
961
  //#endregion
965
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-unknown.d.ts
962
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-unknown.d.ts
966
963
  /**
967
964
  Returns a boolean for whether the given type is `unknown`.
968
965
 
@@ -1006,10 +1003,9 @@ store.execute((state, payload) => ({value: state.value + payload}), someExternal
1006
1003
 
1007
1004
  @category Utilities
1008
1005
  */
1009
- type IsUnknown$1<T> = (unknown extends T // `T` can be `unknown` or `any`
1006
+ type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
1010
1007
  ? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
1011
1008
  ? true : false : false);
1012
-
1013
1009
  //#endregion
1014
1010
  //#region src/types/core/modifiers.types.d.ts
1015
1011
  interface RegleBehaviourOptions {
@@ -1096,7 +1092,6 @@ type RegleShortcutDefinition<TCustomRules extends Record<string, any> = {}> = {
1096
1092
  collections?: ShortcutCommonFn<RegleCollectionStatus<any[], Partial<TCustomRules> & Partial<DefaultValidators>>>;
1097
1093
  };
1098
1094
  type AddDollarToOptions<T extends Record<string, any>> = { [K in keyof T as `$${string & K}`]: T[K] };
1099
-
1100
1095
  //#endregion
1101
1096
  //#region src/types/core/useRegle.types.d.ts
1102
1097
  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 +1112,6 @@ type RegleSingleField<TState extends Maybe<PrimitiveTypes> = any, TRules extends
1117
1112
  } & TAdditionalReturnProperties;
1118
1113
  type DeepReactiveState<T extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T> extends true ? { [K in keyof T]: InferDeepReactiveState<T[K]> } : never;
1119
1114
  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
1115
  //#endregion
1122
1116
  //#region src/types/core/reset.types.d.ts
1123
1117
  type ResetOptions<TState extends unknown> = RequireOneOrNone<{
@@ -1137,23 +1131,21 @@ type ResetOptions<TState extends unknown> = RequireOneOrNone<{
1137
1131
  */
1138
1132
  clearExternalErrors?: boolean;
1139
1133
  }, 'toInitialState' | 'toState'>;
1140
-
1141
1134
  //#endregion
1142
1135
  //#region src/types/core/scopedRegle.types.d.ts
1143
1136
  type ScopedInstancesRecord = Record<string, Record<string, SuperCompatibleRegleRoot>> & {
1144
1137
  '~~global': Record<string, SuperCompatibleRegleRoot>;
1145
1138
  };
1146
1139
  type ScopedInstancesRecordLike = Partial<ScopedInstancesRecord>;
1147
-
1148
1140
  //#endregion
1149
1141
  //#region src/types/core/results.types.d.ts
1150
1142
  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
1143
  type RegleResult<Data extends Record<string, any> | any[] | unknown, TRules extends ReglePartialRuleTree<any>> = {
1152
1144
  valid: false;
1153
- data: IsUnknown$1<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>;
1145
+ 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
1146
  } | {
1155
1147
  valid: true;
1156
- data: IsUnknown$1<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>;
1148
+ 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
1149
  };
1158
1150
  /**
1159
1151
  * Infer safe output from any `r$` instance
@@ -1174,7 +1166,6 @@ type ArrayHaveAtLeastOneRequiredField<TState extends Maybe<any[]>, TRule extends
1174
1166
  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
1167
  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
1168
  type SafeFieldProperty<TState, TRule extends RegleFormPropertyType<any, any> | undefined = never> = FieldHaveRequiredRule<TRule> extends true ? NonNullable<TState> : MaybeOutput<TState>;
1177
-
1178
1169
  //#endregion
1179
1170
  //#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.d.ts
1180
1171
  /**
@@ -1215,7 +1206,7 @@ type IsAny$2<T> = [T] extends [Secret] ? Not<IsNever$2<T>> : false;
1215
1206
  /**
1216
1207
  * Determines if the given type is `unknown`.
1217
1208
  */
1218
- type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny$2<T>> : false;
1209
+ type IsUnknown$1<T> = [unknown] extends [T] ? Not<IsAny$2<T>> : false;
1219
1210
  /**
1220
1211
  * Determines if a type is either `never` or `any`.
1221
1212
  */
@@ -1285,13 +1276,13 @@ type MutuallyExtends<Left, Right> = And<[Extends<Left, Right>, Extends<Right, Le
1285
1276
  * Convert a union to an intersection.
1286
1277
  * `A | B | C` -\> `A & B & C`
1287
1278
  */
1288
- type UnionToIntersection<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection : never;
1279
+ type UnionToIntersection$1<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection : never;
1289
1280
  /**
1290
1281
  * Get the last element of a union.
1291
1282
  * First, converts to a union of `() => T` functions,
1292
1283
  * then uses {@linkcode UnionToIntersection} to get the last one.
1293
1284
  */
1294
- type LastOf<Union> = UnionToIntersection<Union extends any ? () => Union : never> extends (() => infer R) ? R : never;
1285
+ type LastOf<Union> = UnionToIntersection$1<Union extends any ? () => Union : never> extends (() => infer R) ? R : never;
1295
1286
  /**
1296
1287
  * Intermediate type for {@linkcode UnionToTuple} which pushes the
1297
1288
  * "last" union member to the end of a tuple, and recursively prepends
@@ -1301,11 +1292,8 @@ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever$2<Union> extends
1301
1292
  /**
1302
1293
  * Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
1303
1294
  */
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
1295
+ type UnionToTuple$1<Union> = TuplifyUnion<Union>;
1296
+ type IsUnion<T> = Not<Extends<UnionToTuple$1<T>['length'], 1>>;
1309
1297
  /**
1310
1298
  * A recursive version of `Pick` that selects properties from the left type that are present in the right type.
1311
1299
  * The "leaf" types from `Left` are used - only the keys of `Right` are considered.
@@ -1317,6 +1305,8 @@ type IsUnion<T> = Not<Extends<UnionToTuple<T>['length'], 1>>;
1317
1305
  * type Result = DeepPickMatchingProps<typeof user, {name: unknown; address: {city: unknown}}> // {name: string, address: {city: string}}
1318
1306
  * ```
1319
1307
  */
1308
+ //#endregion
1309
+ //#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.d.ts
1320
1310
  /**
1321
1311
  * The simple(ish) way to get overload info from a function
1322
1312
  * {@linkcode FunctionType}. Recent versions of TypeScript will match any
@@ -1581,8 +1571,7 @@ type ConstructorOverloadParameters<ConstructorType> = ConstructorOverloadsUnion<
1581
1571
  /**
1582
1572
  * Calculates the number of overloads for a given function type.
1583
1573
  */
1584
- type NumOverloads<FunctionType> = UnionToTuple<OverloadsInfoUnion<FunctionType>>['length'];
1585
-
1574
+ type NumOverloads<FunctionType> = UnionToTuple$1<OverloadsInfoUnion<FunctionType>>['length'];
1586
1575
  //#endregion
1587
1576
  //#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.d.ts
1588
1577
  /**
@@ -1605,7 +1594,7 @@ type DeepBrand<T> = IsNever$2<T> extends true ? {
1605
1594
  type: 'never';
1606
1595
  } : IsAny$2<T> extends true ? {
1607
1596
  type: 'any';
1608
- } : IsUnknown<T> extends true ? {
1597
+ } : IsUnknown$1<T> extends true ? {
1609
1598
  type: 'unknown';
1610
1599
  } : T extends string | number | boolean | symbol | bigint | null | undefined | void ? {
1611
1600
  type: 'primitive';
@@ -1620,7 +1609,7 @@ type DeepBrand<T> = IsNever$2<T> extends true ? {
1620
1609
  return: DeepBrand<R>;
1621
1610
  this: DeepBrand<ThisParameterType<T>>;
1622
1611
  props: DeepBrand<Omit<T, keyof Function>>;
1623
- } : UnionToTuple<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? {
1612
+ } : UnionToTuple$1<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? {
1624
1613
  type: 'overloads';
1625
1614
  overloads: { [K in keyof OverloadsTuple]: DeepBrand<OverloadsTuple[K]> };
1626
1615
  } : never : T extends any[] ? {
@@ -1638,13 +1627,12 @@ type DeepBrand<T> = IsNever$2<T> extends true ? {
1638
1627
  * Checks if two types are strictly equal using branding.
1639
1628
  */
1640
1629
  type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>;
1641
-
1642
1630
  //#endregion
1643
1631
  //#region ../../node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.d.ts
1644
1632
  /**
1645
1633
  * Determines the printable type representation for a given type.
1646
1634
  */
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' : '...';
1635
+ 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
1636
  /**
1649
1637
  * Helper for showing end-user a hint why their type assertion is failing.
1650
1638
  * This swaps "leaf" types with a literal message about what the actual and
@@ -1652,17 +1640,16 @@ type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever$2<T> extends
1652
1640
  * otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔
1653
1641
  */
1654
1642
  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
1643
  /**
1659
1644
  * @internal
1660
1645
  */
1646
+ //#endregion
1647
+ //#region src/types/core/variants.types.d.ts
1661
1648
 
1662
1649
  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
1650
  $fields: ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>];
1664
1651
  } : 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$1<TState>>]: TIndex extends `${infer TIndexInt extends number}` ? { [TKey in keyof UnionToTuple$1<TState>[TIndexInt] as IsEmptyObject<FindCorrespondingVariant<UnionToTuple$1<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple$1<TState>[TIndexInt] : never, UnionToTuple$1<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$1<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple$1<TState>[TIndexInt] : never, UnionToTuple$1<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts> } & { [TKey in keyof UnionToTuple$1<TState>[TIndexInt] as IsEmptyObject<FindCorrespondingVariant<UnionToTuple$1<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple$1<TState>[TIndexInt] : never, UnionToTuple$1<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$1<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple$1<TState>[TIndexInt] : never, UnionToTuple$1<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts> } : {} };
1652
+ 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
1653
  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
1654
  //#endregion
1668
1655
  //#region src/core/useRegle/useRegle.d.ts
@@ -1722,23 +1709,21 @@ type RetrieveUnionUnknownKeysOf<T extends readonly any[]> = T extends [infer F,
1722
1709
  /**
1723
1710
  * Transforms a union and apply undefined values to non-present keys to support intersection
1724
1711
  */
1725
- type NormalizeUnion<TUnion> = RetrieveUnionUnknownValues<NonNullable<UnionToTuple$1<TUnion>>, RetrieveUnionUnknownKeysOf<NonNullable<UnionToTuple$1<TUnion>>>[number]>[number];
1712
+ type NormalizeUnion<TUnion> = RetrieveUnionUnknownValues<NonNullable<UnionToTuple<TUnion>>, RetrieveUnionUnknownKeysOf<NonNullable<UnionToTuple<TUnion>>>[number]>[number];
1726
1713
  /**
1727
1714
  * Combine all members of a union type, merging types for each key, and keeping loose types
1728
1715
  */
1729
- type JoinDiscriminatedUnions<TUnion extends unknown> = isRecordLiteral<TUnion> extends true ? Prettify<Partial<UnionToIntersection$1<RemoveCommonKey<UnionToTuple$1<NonNullable<TUnion>>, keyof NormalizeUnion<NonNullable<TUnion>>>[number]>> & Pick<NormalizeUnion<NonNullable<TUnion>>, keyof NormalizeUnion<NonNullable<TUnion>>>> : TUnion;
1716
+ 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
1717
  type EnumLike = {
1731
1718
  [k: string]: string | number;
1732
1719
  [nu: number]: string;
1733
1720
  };
1734
1721
  type UnwrapMaybeRef<T extends MaybeRef<any> | DeepReactiveState<any>> = T extends Ref<any> ? UnwrapRef<T> : UnwrapNestedRefs<T>;
1735
1722
  type TupleToPlainObj<T> = { [I in keyof T & `${number}`]: T[I] };
1736
-
1737
1723
  //#endregion
1738
1724
  //#region src/types/utils/mismatch.types.d.ts
1739
1725
  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
1726
  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
1727
  //#endregion
1743
1728
  //#region src/types/utils/infer.types.d.ts
1744
1729
 
@@ -1752,7 +1737,6 @@ type CreateFn<T extends any[]> = (...args: T) => any;
1752
1737
  */
1753
1738
  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
1739
  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
1740
  //#endregion
1757
1741
  //#region src/types/rules/rule.internal.types.d.ts
1758
1742
  /**
@@ -1853,7 +1837,6 @@ type RegleCollectionRuleDefinition<TValue = any[], TCustomRules extends Partial<
1853
1837
  }) | ({
1854
1838
  $each: MaybeGetter<RegleFormPropertyType<ArrayElement$1<NonNullable<TValue>>, TCustomRules>, ArrayElement$1<TValue>>;
1855
1839
  } & CollectionRegleBehaviourOptions);
1856
-
1857
1840
  //#endregion
1858
1841
  //#region src/types/rules/rule.init.types.d.ts
1859
1842
  type RegleInitPropertyGetter<TValue, TReturn, TParams extends [...any[]], TMetadata extends RegleRuleMetadataDefinition> = TReturn | ((metadata: RegleRuleMetadataConsumer<TValue, TParams, TMetadata>) => TReturn);
@@ -1936,14 +1919,13 @@ type DefaultValidators = {
1936
1919
  numeric: RegleRuleDefinition<string | number, [], false, boolean, string | number>;
1937
1920
  oneOf: RegleRuleDefinition<string | number, [options: (string | number)[]], false, boolean, string | number>;
1938
1921
  regex: RegleRuleWithParamsDefinition<string, [regexp: RegExp], false, boolean>;
1939
- required: RegleRuleDefinition<unknown, []>;
1922
+ required: RegleRuleDefinition<unknown, [], false, boolean, unknown>;
1940
1923
  sameAs: RegleRuleWithParamsDefinition<unknown, [target: unknown, otherName?: string], false, boolean>;
1941
1924
  string: RegleRuleDefinition<unknown, [], false, boolean, any, unknown>;
1942
1925
  type: RegleRuleDefinition<unknown, [], false, boolean, unknown, unknown>;
1943
1926
  startsWith: RegleRuleWithParamsDefinition<string, [part: Maybe<string>], false, boolean>;
1944
1927
  url: RegleRuleDefinition<string, [], false, boolean, string>;
1945
1928
  };
1946
-
1947
1929
  //#endregion
1948
1930
  //#region src/types/rules/rule.custom.types.d.ts
1949
1931
  type CustomRulesDeclarationTree = {
@@ -1951,7 +1933,6 @@ type CustomRulesDeclarationTree = {
1951
1933
  };
1952
1934
  type DefaultValidatorsTree = { [K in keyof DefaultValidators]: RegleRuleRawInput<any, any[], boolean, any> | undefined };
1953
1935
  type AllRulesDeclarations = CustomRulesDeclarationTree & DefaultValidatorsTree;
1954
-
1955
1936
  //#endregion
1956
1937
  //#region src/types/rules/rule.declaration.types.d.ts
1957
1938
  /**
@@ -2019,22 +2000,6 @@ type InlineRuleDeclaration<TValue extends any = any, TParams extends any[] = any
2019
2000
  * Regroup inline and registered rules
2020
2001
  * */
2021
2002
  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
- //#endregion
2024
- //#region src/types/rules/rule.errors.types.d.ts
2025
- type RegleErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], false> };
2026
- type RegleExternalErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]?: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], true> };
2027
- type RegleValidationErrors<TState extends Record<string, any> | any[] | unknown = never, TExternal extends boolean = false> = NonNullable<TState> extends Array<infer U extends Record<string, any>> ? ExtendOnlyRealRecord<U> extends true ? TExternal extends false ? RegleCollectionErrors<U> : RegleExternalCollectionErrors<U> : string[] : NonNullable<TState> extends Date | File ? string[] : NonNullable<TState> extends Record<string, any> ? TExternal extends false ? RegleErrorTree<TState> : RegleExternalErrorTree<TState> : string[];
2028
- type RegleCollectionErrors<TState extends Record<string, any>> = {
2029
- readonly $self: string[];
2030
- readonly $each: RegleValidationErrors<TState, false>[];
2031
- };
2032
- type RegleExternalCollectionErrors<TState extends Record<string, any>> = {
2033
- readonly $self?: string[];
2034
- readonly $each?: RegleValidationErrors<TState, true>[];
2035
- };
2036
- /** @internal */
2037
-
2038
2003
  //#endregion
2039
2004
  //#region src/types/rules/rule.status.types.d.ts
2040
2005
  /**
@@ -2051,7 +2016,7 @@ type RegleRoot<TState extends Record<string, any> = {}, TRules extends ReglePart
2051
2016
  */
2052
2017
  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
2018
  /** 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> };
2019
+ 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
2020
  /**
2056
2021
  * Collection of all the error messages, collected for all children properties and nested forms.
2057
2022
  *
@@ -2078,6 +2043,13 @@ type InferRegleStatusType<TRule extends RegleCollectionRuleDecl | RegleRuleDecl
2078
2043
  * @reference {@link InferRegleStatusType}
2079
2044
  */
2080
2045
 
2046
+ interface RegleFieldIssue {
2047
+ $property: string;
2048
+ $rule: string;
2049
+ $type?: string;
2050
+ $message: string;
2051
+ [x: string]: unknown;
2052
+ }
2081
2053
  /**
2082
2054
  * @public
2083
2055
  */
@@ -2092,6 +2064,10 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
2092
2064
  readonly $errors: string[];
2093
2065
  /** Collection of all the error messages, collected for all children properties and nested forms. */
2094
2066
  readonly $silentErrors: string[];
2067
+ /**
2068
+ * Collect all metadata of validators, including the error message
2069
+ */
2070
+ readonly $issues: RegleFieldIssue[];
2095
2071
  /** Stores external errors of the current field */
2096
2072
  readonly $externalErrors: string[];
2097
2073
  /** Stores active tooltips messages of the current field */
@@ -2103,9 +2079,9 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
2103
2079
  /** 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
2080
  $validate: () => Promise<RegleResult<TState, TRules>>;
2105
2081
  /** 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 ? {
2082
+ readonly $rules: IsEmptyObject$1<TRules> extends true ? {
2107
2083
  readonly [x: string]: RegleRuleStatus<TState, any[], any>;
2108
- } : { 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> };
2084
+ } : { 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 : boolean> };
2109
2085
  } & ([TShortcuts['fields']] extends [never] ? {} : { [K in keyof TShortcuts['fields']]: ReturnType<NonNullable<TShortcuts['fields']>[K]> });
2110
2086
  /**
2111
2087
  * @internal
@@ -2189,7 +2165,7 @@ type RegleRuleStatus<TValue = any, TParams extends any[] = any[], TMetadata exte
2189
2165
  /** Reset the $valid, $metadata and $pending states */
2190
2166
  $reset(): void;
2191
2167
  /** Returns the original rule validator function. */
2192
- $validator: ((value: IsUnknown$1<TValue> extends true ? any : MaybeInput<TValue>, ...args: any[]) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>) & ((value: IsUnknown$1<TValue> extends true ? any : TValue, ...args: [TParams] extends [never[]] ? [] : [unknown[]] extends [TParams] ? any[] : TParams) => RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition>);
2168
+ $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
2169
  } & ([TParams] extends [never[]] ? {} : [unknown[]] extends [TParams] ? {
2194
2170
  readonly $params?: any[];
2195
2171
  } : {
@@ -2200,7 +2176,7 @@ type RegleRuleStatus<TValue = any, TParams extends any[] = any[], TMetadata exte
2200
2176
  * @reference {@link RegleRuleStatus}
2201
2177
  */
2202
2178
  interface $InternalRegleRuleStatus {
2203
- $type: string;
2179
+ $type?: string;
2204
2180
  $message: string | string[];
2205
2181
  $tooltip: string | string[];
2206
2182
  $active: boolean;
@@ -2252,6 +2228,21 @@ type RegleCollectionStatus<TState extends any[] = any[], TRules extends ReglePar
2252
2228
  * @reference {@link RegleCollectionStatus}
2253
2229
  */
2254
2230
 
2231
+ //#endregion
2232
+ //#region src/types/rules/rule.errors.types.d.ts
2233
+ type RegleErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], false> };
2234
+ type RegleExternalErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]?: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], true> };
2235
+ type RegleValidationErrors<TState extends Record<string, any> | any[] | unknown = never, TExternal extends boolean = false, TIssue extends boolean = false> = NonNullable<TState> extends Array<infer U extends Record<string, any>> ? ExtendOnlyRealRecord<U> extends true ? TExternal extends false ? RegleCollectionErrors<U> : RegleExternalCollectionErrors<U> : TIssue extends true ? RegleFieldIssue[] : string[] : NonNullable<TState> extends Date | File ? TIssue extends true ? RegleFieldIssue[] : string[] : NonNullable<TState> extends Record<string, any> ? TExternal extends false ? RegleErrorTree<TState> : RegleExternalErrorTree<TState> : TIssue extends true ? RegleFieldIssue[] : string[];
2236
+ type RegleCollectionErrors<TState extends Record<string, any>, TIssue extends boolean = false> = {
2237
+ readonly $self: string[];
2238
+ readonly $each: RegleValidationErrors<TState, false, TIssue>[];
2239
+ };
2240
+ type RegleExternalCollectionErrors<TState extends Record<string, any>, TIssue extends boolean = false> = {
2241
+ readonly $self?: string[];
2242
+ readonly $each?: RegleValidationErrors<TState, true, TIssue>[];
2243
+ };
2244
+ /** @internal */
2245
+
2255
2246
  /** Supports both core Regle and schemas Regle for Zod/Valibot */
2256
2247
  type SuperCompatibleRegleRoot = SuperCompatibleRegleStatus & {
2257
2248
  $groups?: {
@@ -2325,7 +2316,6 @@ type useCollectScopeFn<TNamedScoped extends boolean = false> = TNamedScoped exte
2325
2316
  } : <TValue extends Record<string, unknown>[] = Record<string, unknown>[]>(namespace?: MaybeRefOrGetter<string>) => {
2326
2317
  r$: MergedScopedRegles<TValue>;
2327
2318
  };
2328
-
2329
2319
  //#endregion
2330
2320
  //#region src/core/createScopedUseRegle/useScopedRegle.d.ts
2331
2321
  type UseScopedRegleOptions<TAsRecord extends boolean> = {
@@ -2333,7 +2323,6 @@ type UseScopedRegleOptions<TAsRecord extends boolean> = {
2333
2323
  } & (TAsRecord extends true ? {
2334
2324
  scopeKey: string;
2335
2325
  } : {});
2336
-
2337
2326
  //#endregion
2338
2327
  //#region src/core/createScopedUseRegle/createScopedUseRegle.d.ts
2339
2328
  type CreateScopedUseRegleOptions<TCustomRegle extends useRegleFn<any, any>, TAsRecord extends boolean> = {
@@ -2350,18 +2339,16 @@ type CreateScopedUseRegleOptions<TCustomRegle extends useRegleFn<any, any>, TAsR
2350
2339
  */
2351
2340
  asRecord?: TAsRecord;
2352
2341
  };
2353
-
2354
2342
  //#endregion
2355
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/primitive.d.ts
2343
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
2356
2344
  /**
2357
2345
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
2358
2346
 
2359
2347
  @category Type
2360
2348
  */
2361
2349
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
2362
-
2363
2350
  //#endregion
2364
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/observable-like.d.ts
2351
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
2365
2352
  declare global {
2366
2353
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2367
2354
  interface SymbolConstructor {
@@ -2369,8 +2356,6 @@ declare global {
2369
2356
  }
2370
2357
  }
2371
2358
 
2372
- //#endregion
2373
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/empty-object.d.ts
2374
2359
  /**
2375
2360
  @remarks
2376
2361
  The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
@@ -2381,6 +2366,8 @@ As well, some guidance on making an `Observable` to not include `closed` propert
2381
2366
 
2382
2367
  @category Observable
2383
2368
  */
2369
+ //#endregion
2370
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/empty-object.d.ts
2384
2371
  declare const emptyObjectSymbol: unique symbol;
2385
2372
 
2386
2373
  /**
@@ -2413,8 +2400,6 @@ type EmptyObject = {
2413
2400
  [emptyObjectSymbol]?: never;
2414
2401
  };
2415
2402
 
2416
- //#endregion
2417
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/optional-keys-of.d.ts
2418
2403
  /**
2419
2404
  Returns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value.
2420
2405
 
@@ -2430,6 +2415,8 @@ type Fail = IsEmptyObject<null>; //=> false
2430
2415
  @see EmptyObject
2431
2416
  @category Object
2432
2417
  */
2418
+ //#endregion
2419
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
2433
2420
  /**
2434
2421
  Extract all optional keys from the given type.
2435
2422
 
@@ -2465,11 +2452,9 @@ const update2: UpdateOperation<User> = {
2465
2452
  */
2466
2453
  type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
2467
2454
  ? (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
-
2455
+ : never; // Should never happen
2470
2456
  //#endregion
2471
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/required-keys-of.d.ts
2472
- // Should never happen
2457
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
2473
2458
  /**
2474
2459
  Extract all required keys from the given type.
2475
2460
 
@@ -2495,12 +2480,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
2495
2480
  @category Utilities
2496
2481
  */
2497
2482
  type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
2498
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never;
2483
+ ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never; // Should never happen
2499
2484
 
2500
2485
  //#endregion
2501
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-never.d.ts
2502
- // Should never happen
2503
-
2486
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
2504
2487
  /**
2505
2488
  Returns a boolean for whether the given type is `never`.
2506
2489
 
@@ -2543,9 +2526,8 @@ endIfEqual('abc', '123');
2543
2526
  @category Utilities
2544
2527
  */
2545
2528
  type IsNever<T> = [T] extends [never] ? true : false;
2546
-
2547
2529
  //#endregion
2548
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/if-never.d.ts
2530
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
2549
2531
  /**
2550
2532
  An if-else-like type that resolves depending on whether the given type is `never`.
2551
2533
 
@@ -2565,10 +2547,9 @@ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
2565
2547
  @category Type Guard
2566
2548
  @category Utilities
2567
2549
  */
2568
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
2569
-
2550
+ type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
2570
2551
  //#endregion
2571
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/array.d.ts
2552
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/array.d.ts
2572
2553
  /**
2573
2554
  Extract the element of an array that also works for array union.
2574
2555
 
@@ -2578,8 +2559,6 @@ It creates a type-safe way to access the element type of `unknown` type.
2578
2559
  */
2579
2560
  type ArrayElement<T> = T extends readonly unknown[] ? T[0] : never;
2580
2561
 
2581
- //#endregion
2582
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/is-any.d.ts
2583
2562
  /**
2584
2563
  Returns the static, fixed-length portion of the given array, excluding variable-length parts.
2585
2564
 
@@ -2590,6 +2569,8 @@ type B = StaticPartOfArray<A>;
2590
2569
  //=> [string, number, boolean]
2591
2570
  ```
2592
2571
  */
2572
+ //#endregion
2573
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
2593
2574
  // Can eventually be replaced with the built-in once this library supports
2594
2575
  // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
2595
2576
  type NoInfer<T> = T extends infer U ? U : never;
@@ -2623,9 +2604,8 @@ const anyA = get(anyObject, 'a');
2623
2604
  @category Utilities
2624
2605
  */
2625
2606
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
2626
-
2627
2607
  //#endregion
2628
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/simplify.d.ts
2608
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
2629
2609
  /**
2630
2610
  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
2611
 
@@ -2684,9 +2664,8 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
2684
2664
  @category Object
2685
2665
  */
2686
2666
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
2687
-
2688
2667
  //#endregion
2689
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/omit-index-signature.d.ts
2668
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
2690
2669
  /**
2691
2670
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
2692
2671
 
@@ -2778,9 +2757,8 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
2778
2757
  @category Object
2779
2758
  */
2780
2759
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
2781
-
2782
2760
  //#endregion
2783
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/pick-index-signature.d.ts
2761
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
2784
2762
  /**
2785
2763
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
2786
2764
 
@@ -2827,9 +2805,8 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
2827
2805
  @category Object
2828
2806
  */
2829
2807
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
2830
-
2831
2808
  //#endregion
2832
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/merge.d.ts
2809
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
2833
2810
  // Merges two objects without worrying about index signatures.
2834
2811
  type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
2835
2812
 
@@ -2868,9 +2845,8 @@ export type FooBar = Merge<Foo, Bar>;
2868
2845
  @category Object
2869
2846
  */
2870
2847
  type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
2871
-
2872
2848
  //#endregion
2873
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/if-any.d.ts
2849
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
2874
2850
  /**
2875
2851
  An if-else-like type that resolves depending on whether the given type is `any`.
2876
2852
 
@@ -2890,21 +2866,20 @@ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
2890
2866
  @category Type Guard
2891
2867
  @category Utilities
2892
2868
  */
2893
- type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
2894
-
2869
+ type IfAny$1<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
2895
2870
  //#endregion
2896
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/type.d.ts
2871
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
2897
2872
  /**
2898
2873
  Matches any primitive, `void`, `Date`, or `RegExp` value.
2899
2874
  */
2900
2875
  type BuiltIns = Primitive | void | Date | RegExp;
2901
2876
 
2902
- //#endregion
2903
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/internal/object.d.ts
2904
2877
  /**
2905
2878
  Matches non-recursive types.
2906
2879
  */
2907
2880
 
2881
+ //#endregion
2882
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
2908
2883
  /**
2909
2884
  Merges user specified options with default options.
2910
2885
 
@@ -2957,11 +2932,10 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
2957
2932
  // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
2958
2933
  ```
2959
2934
  */
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>`
2935
+ 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
2936
  >>;
2962
-
2963
2937
  //#endregion
2964
- //#region ../../node_modules/.pnpm/type-fest@4.40.1/node_modules/type-fest/source/partial-deep.d.ts
2938
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
2965
2939
  /**
2966
2940
  @see {@link PartialDeep}
2967
2941
  */
@@ -3078,7 +3052,6 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
3078
3052
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
3079
3053
  */
3080
3054
  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
3055
  //#endregion
3083
3056
  //#region src/types/core.types.d.ts
3084
3057
  type RegleSchema<TState extends Record<string, any>, TSchema extends Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}, TAdditionalReturnProperties extends Record<string, any> = {}> = {
@@ -3167,7 +3140,6 @@ type RegleSchemaCollectionStatus<TSchema extends Record<string, any>, TState ext
3167
3140
  /** 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
3141
  $extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
3169
3142
  } & ([TShortcuts['collections']] extends [never] ? {} : { [K in keyof TShortcuts['collections']]: ReturnType<NonNullable<TShortcuts['collections']>[K]> });
3170
-
3171
3143
  //#endregion
3172
3144
  //#region src/types/options.types.d.ts
3173
3145
  type RegleSchemaBehaviourOptions = {
@@ -3185,7 +3157,6 @@ type RegleSchemaBehaviourOptions = {
3185
3157
  onValidate?: boolean;
3186
3158
  };
3187
3159
  };
3188
-
3189
3160
  //#endregion
3190
3161
  //#region src/core/useRegleSchema.d.ts
3191
3162
  type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy' | 'rewardEarly' | 'silent'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
@@ -3216,7 +3187,6 @@ interface useRegleSchemaFn<TShortcuts extends RegleShortcutDefinition<any> = nev
3216
3187
  * Docs: {@link https://reglejs.dev/integrations/valibot#usage}
3217
3188
  */
3218
3189
  declare const useRegleSchema: useRegleSchemaFn<RegleShortcutDefinition<any>, {}, {}>;
3219
-
3220
3190
  //#endregion
3221
3191
  //#region src/core/withDeps.d.ts
3222
3192
  /**
@@ -3236,7 +3206,6 @@ declare const useRegleSchema: useRegleSchemaFn<RegleShortcutDefinition<any>, {},
3236
3206
  * ```
3237
3207
  */
3238
3208
  declare function withDeps<TSchema extends StandardSchemaV1, TParams extends unknown[] = []>(schema: TSchema, depsArray: [...TParams]): TSchema;
3239
-
3240
3209
  //#endregion
3241
3210
  //#region src/core/inferSchema.d.ts
3242
3211
  interface inferSchemaFn {
@@ -3254,7 +3223,6 @@ interface inferSchemaFn {
3254
3223
  * @param schema - Your schema
3255
3224
  */
3256
3225
  declare const inferSchema: inferSchemaFn;
3257
-
3258
3226
  //#endregion
3259
3227
  //#region src/core/defineRegleSchemaConfig.d.ts
3260
3228
  /**
@@ -3277,7 +3245,6 @@ declare function defineRegleSchemaConfig<TShortcuts extends RegleShortcutDefinit
3277
3245
  useRegleSchema: useRegleSchemaFn<TShortcuts>;
3278
3246
  inferSchema: inferSchemaFn;
3279
3247
  };
3280
-
3281
3248
  //#endregion
3282
3249
  //#region src/core/createScopedUseRegleSchema.d.ts
3283
3250
  type CreateScopedUseRegleSchemaOptions<TCustomRegle extends useRegleSchemaFn<any, any>, TAsRecord extends boolean> = Omit<CreateScopedUseRegleOptions<any, TAsRecord>, 'customUseRegle'> & {
@@ -3299,6 +3266,5 @@ declare const createScopedUseRegleSchema: <TCustomRegle extends useRegleSchemaFn
3299
3266
  useScopedRegle: TReturnedRegle;
3300
3267
  useCollectScope: useCollectScopeFn<TAsRecord>;
3301
3268
  };
3302
-
3303
3269
  //#endregion
3304
3270
  export { InferRegleSchemaStatusType, RegleSchema, RegleSchemaBehaviourOptions, RegleSchemaCollectionStatus, RegleSchemaFieldStatus, RegleSchemaResult, RegleSchemaStatus, RegleSingleFieldSchema, createScopedUseRegleSchema, defineRegleSchemaConfig, inferSchema, useCollectSchemaScope, useRegleSchema, useScopedRegleSchema, withDeps };
@@ -131,20 +131,23 @@ function createUseRegleSchemaComposable(options, shortcuts) {
131
131
  function issuesToRegleErrors(result) {
132
132
  const output = {};
133
133
  if (result.issues) {
134
- const errors = result.issues.map((issue) => {
134
+ const issues = result.issues.map((issue) => {
135
135
  let path = issue.path?.map((item) => typeof item === "object" ? item.key : item.toString()).join(".") ?? "";
136
136
  const lastItem = issue.path?.[issue.path.length - 1];
137
137
  const isArray = (typeof lastItem === "object" && "value" in lastItem ? Array.isArray(lastItem.value) : false) || ("type" in issue ? issue.type === "array" : false) || Array.isArray(getDotPath(processedState.value, path));
138
138
  const isPrimitivesArray = !isArray && typeof (typeof lastItem === "object" ? lastItem.key : lastItem) === "number";
139
139
  if (isPrimitivesArray) path = issue.path?.slice(0, issue.path.length - 1)?.map((item) => typeof item === "object" ? item.key : item.toString()).join(".") ?? "";
140
140
  return {
141
+ ...issue,
141
142
  path,
142
- message: issue.message,
143
- isArray
143
+ isArray,
144
+ $property: lastItem,
145
+ $rule: "schema",
146
+ $message: issue.message
144
147
  };
145
148
  });
146
- errors.forEach((error) => {
147
- setObjectError(output, error.path, [error.message], error.isArray);
149
+ issues.forEach(({ isArray, path,...issue }) => {
150
+ setObjectError(output, path, [issue], isArray);
148
151
  });
149
152
  }
150
153
  return output;
@@ -152,7 +155,12 @@ function createUseRegleSchemaComposable(options, shortcuts) {
152
155
  async function computeErrors(isValidate = false) {
153
156
  let result = computedSchema.value["~standard"].validate(processedState.value);
154
157
  if (result instanceof Promise) result = await result;
155
- if (isSingleField.value) customErrors.value = result.issues?.map((issue) => issue.message) ?? [];
158
+ if (isSingleField.value) customErrors.value = result.issues?.map((issue) => ({
159
+ $message: issue.message,
160
+ $property: issue.path?.[issue.path.length - 1]?.toString() ?? "-",
161
+ $rule: "schema",
162
+ ...issue
163
+ })) ?? [];
156
164
  else customErrors.value = issuesToRegleErrors(result);
157
165
  if (!result.issues) {
158
166
  if (isValidate && syncOnValidate || !isValidate && syncOnUpdate) {
@@ -1 +1 @@
1
- import{createScopedUseRegle as e,useRootStorage as t}from"@regle/core";import{computed as n,isRef as r,ref as i,unref as a,watch as o}from"vue";const s=Symbol(`regle-rule`);function c(e){if(typeof e.source.flags==`string`)return e.source.flags;{let t=[];return e.global&&t.push(`g`),e.ignoreCase&&t.push(`i`),e.multiline&&t.push(`m`),e.sticky&&t.push(`y`),e.unicode&&t.push(`u`),t.join(``)}}function l(e){let t=e,n={}.toString.call(e).slice(8,-1);if(n==`Set`&&(t=new Set([...e].map(e=>l(e)))),n==`Map`&&(t=new Map([...e].map(e=>[l(e[0]),l(e[1])]))),n==`Date`&&(t=new Date(e.getTime())),n==`RegExp`&&(t=RegExp(e.source,c(e))),n==`Array`||n==`Object`)for(let n in t=Array.isArray(e)?[]:{},e)t[n]=l(e[n]);return t}function u(e){return e&&(e instanceof Date||e.constructor.name==`File`||e.constructor.name==`FileList`)?!1:typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e,t,n,r){var i,a;if(Array.isArray(t)&&(i=t.slice(0)),typeof t==`string`&&(i=t.split(`.`)),typeof t==`symbol`&&(i=[t]),!Array.isArray(i))throw Error(`props arg must be an array, a string or a symbol`);if(a=i.pop(),!a)return!1;p(a);for(var o;o=i.shift();)if(p(o),isNaN(parseInt(o))?(e[o]===void 0&&(e[o]={}),e=e[o]):((e.$each??=[])[o]={},e=e.$each[o]),!e||typeof e!=`object`)return!1;return r?e[a]?e[a].$self=(e[a].$self??=[]).concat(n):e[a]={...e[a],$self:n}:Array.isArray(e[a])?e[a]=e[a].concat(n):e[a]=n,!0}function f(e,t,n){if(!e)return n;var r,i;if(Array.isArray(t)&&(r=t.slice(0)),typeof t==`string`&&(r=t.split(`.`)),typeof t==`symbol`&&(r=[t]),!Array.isArray(r))throw Error(`props arg must be an array, a string or a symbol`);for(;r.length;)if(i=r.shift(),!e||!i||(e=e[i],e===void 0))return n;return e}function p(e){if(e==`__proto__`||e==`constructor`||e==`prototype`)throw Error(`setting of prototype values not supported`)}function m(e,...t){for(var n=[].slice.call(arguments),r,i=n.length;r=n[i-1],i--;)if(!r||typeof r!=`object`&&typeof r!=`function`)throw Error(`expected object, got `+r);for(var a=n[0],o=n.slice(1),s=o.length,i=0;i<s;i++){var c=o[i];for(var l in c)a[l]=c[l]}return a}function h(e,s){let c={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function p(e,p,h){let g=n(()=>a(p)),{syncState:_={onUpdate:!1,onValidate:!1},...v}=h??{},{onUpdate:y=!1,onValidate:b=!1}=_,x={...c,...v},S=n(()=>!u(C.value)),C=r(e)?e:i(e),w=i(u(C.value)?{...l(C.value)}:l(C.value)),T=i({}),E;if(!g.value?.[`~standard`])throw Error(`Only "standard-schema" compatible libraries are supported`);function D(e){let t={};if(e.issues){let n=e.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``,n=e.path?.[e.path.length-1],r=(typeof n==`object`&&`value`in n?Array.isArray(n.value):!1)||(`type`in e?e.type===`array`:!1)||Array.isArray(f(C.value,t)),i=!r&&typeof(typeof n==`object`?n.key:n)==`number`;return i&&(t=e.path?.slice(0,e.path.length-1)?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``),{path:t,message:e.message,isArray:r}});n.forEach(e=>{d(t,e.path,[e.message],e.isArray)})}return t}async function O(e=!1){let t=g.value[`~standard`].validate(C.value);return t instanceof Promise&&(t=await t),S.value?T.value=t.issues?.map(e=>e.message)??[]:T.value=D(t),t.issues||(e&&b||!e&&y)&&(k?.(),u(C.value)?C.value=m(C.value,t.value):C.value=t.value,A()),t}let k;function A(){k=o([C,g],()=>O(),{deep:!0})}A(),O(),E=async()=>{try{let e=await O(!0);return{valid:!e.issues?.length,data:C.value}}catch(e){return Promise.reject(e)}};let j=t({scopeRules:n(()=>({})),state:C,options:x,schemaErrors:T,initialState:w,shortcuts:s,schemaMode:!0,onValidate:E});return{r$:j.regle}}return p}const g=h();function _(e,t){return e}function v(){function e(e,t){return t}return e}const y=v();function b({modifiers:e,shortcuts:t}){let n=h(e,t),r=v();return{useRegleSchema:n,inferSchema:r}}const{useCollectScope:x,useScopedRegle:S}=e({customUseRegle:g}),C=t=>{let{customStore:n,customUseRegle:r=g,asRecord:i=!1}=t??{};return e({customStore:n,customUseRegle:r,asRecord:i})};export{C as createScopedUseRegleSchema,b as defineRegleSchemaConfig,y as inferSchema,x as useCollectSchemaScope,g as useRegleSchema,S as useScopedRegleSchema,_ as withDeps};
1
+ import{createScopedUseRegle as e,useRootStorage as t}from"@regle/core";import{computed as n,isRef as r,ref as i,unref as a,watch as o}from"vue";const s=Symbol(`regle-rule`);function c(e){if(typeof e.source.flags==`string`)return e.source.flags;{let t=[];return e.global&&t.push(`g`),e.ignoreCase&&t.push(`i`),e.multiline&&t.push(`m`),e.sticky&&t.push(`y`),e.unicode&&t.push(`u`),t.join(``)}}function l(e){let t=e,n={}.toString.call(e).slice(8,-1);if(n==`Set`&&(t=new Set([...e].map(e=>l(e)))),n==`Map`&&(t=new Map([...e].map(e=>[l(e[0]),l(e[1])]))),n==`Date`&&(t=new Date(e.getTime())),n==`RegExp`&&(t=RegExp(e.source,c(e))),n==`Array`||n==`Object`)for(let n in t=Array.isArray(e)?[]:{},e)t[n]=l(e[n]);return t}function u(e){return e&&(e instanceof Date||e.constructor.name==`File`||e.constructor.name==`FileList`)?!1:typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e,t,n,r){var i,a;if(Array.isArray(t)&&(i=t.slice(0)),typeof t==`string`&&(i=t.split(`.`)),typeof t==`symbol`&&(i=[t]),!Array.isArray(i))throw Error(`props arg must be an array, a string or a symbol`);if(a=i.pop(),!a)return!1;p(a);for(var o;o=i.shift();)if(p(o),isNaN(parseInt(o))?(e[o]===void 0&&(e[o]={}),e=e[o]):((e.$each??=[])[o]={},e=e.$each[o]),!e||typeof e!=`object`)return!1;return r?e[a]?e[a].$self=(e[a].$self??=[]).concat(n):e[a]={...e[a],$self:n}:Array.isArray(e[a])?e[a]=e[a].concat(n):e[a]=n,!0}function f(e,t,n){if(!e)return n;var r,i;if(Array.isArray(t)&&(r=t.slice(0)),typeof t==`string`&&(r=t.split(`.`)),typeof t==`symbol`&&(r=[t]),!Array.isArray(r))throw Error(`props arg must be an array, a string or a symbol`);for(;r.length;)if(i=r.shift(),!e||!i||(e=e[i],e===void 0))return n;return e}function p(e){if(e==`__proto__`||e==`constructor`||e==`prototype`)throw Error(`setting of prototype values not supported`)}function m(e,...t){for(var n=[].slice.call(arguments),r,i=n.length;r=n[i-1],i--;)if(!r||typeof r!=`object`&&typeof r!=`function`)throw Error(`expected object, got `+r);for(var a=n[0],o=n.slice(1),s=o.length,i=0;i<s;i++){var c=o[i];for(var l in c)a[l]=c[l]}return a}function h(e,s){let c={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function p(e,p,h){let g=n(()=>a(p)),{syncState:_={onUpdate:!1,onValidate:!1},...v}=h??{},{onUpdate:y=!1,onValidate:b=!1}=_,x={...c,...v},S=n(()=>!u(C.value)),C=r(e)?e:i(e),w=i(u(C.value)?{...l(C.value)}:l(C.value)),T=i({}),E;if(!g.value?.[`~standard`])throw Error(`Only "standard-schema" compatible libraries are supported`);function D(e){let t={};if(e.issues){let n=e.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``,n=e.path?.[e.path.length-1],r=(typeof n==`object`&&`value`in n?Array.isArray(n.value):!1)||(`type`in e?e.type===`array`:!1)||Array.isArray(f(C.value,t)),i=!r&&typeof(typeof n==`object`?n.key:n)==`number`;return i&&(t=e.path?.slice(0,e.path.length-1)?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``),{...e,path:t,isArray:r,$property:n,$rule:`schema`,$message:e.message}});n.forEach(({isArray:e,path:n,...r})=>{d(t,n,[r],e)})}return t}async function O(e=!1){let t=g.value[`~standard`].validate(C.value);return t instanceof Promise&&(t=await t),S.value?T.value=t.issues?.map(e=>({$message:e.message,$property:e.path?.[e.path.length-1]?.toString()??`-`,$rule:`schema`,...e}))??[]:T.value=D(t),t.issues||(e&&b||!e&&y)&&(k?.(),u(C.value)?C.value=m(C.value,t.value):C.value=t.value,A()),t}let k;function A(){k=o([C,g],()=>O(),{deep:!0})}A(),O(),E=async()=>{try{let e=await O(!0);return{valid:!e.issues?.length,data:C.value}}catch(e){return Promise.reject(e)}};let j=t({scopeRules:n(()=>({})),state:C,options:x,schemaErrors:T,initialState:w,shortcuts:s,schemaMode:!0,onValidate:E});return{r$:j.regle}}return p}const g=h();function _(e,t){return e}function v(){function e(e,t){return t}return e}const y=v();function b({modifiers:e,shortcuts:t}){let n=h(e,t),r=v();return{useRegleSchema:n,inferSchema:r}}const{useCollectScope:x,useScopedRegle:S}=e({customUseRegle:g}),C=t=>{let{customStore:n,customUseRegle:r=g,asRecord:i=!1}=t??{};return e({customStore:n,customUseRegle:r,asRecord:i})};export{C as createScopedUseRegleSchema,b as defineRegleSchemaConfig,y as inferSchema,x as useCollectSchemaScope,g as useRegleSchema,S as useScopedRegleSchema,_ as withDeps};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@regle/schemas",
3
- "version": "1.3.0",
3
+ "version": "1.4.0-beta.1",
4
4
  "description": "Schemas adapter for Regle",
5
5
  "dependencies": {
6
6
  "@standard-schema/spec": "1.0.0",
7
- "@regle/core": "1.3.0",
8
- "@regle/rules": "1.3.0"
7
+ "@regle/core": "1.4.0-beta.1",
8
+ "@regle/rules": "1.4.0-beta.1"
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.3",
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.25.1",
33
- "eslint-config-prettier": "9.1.0",
34
- "eslint-plugin-vue": "9.33.0",
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.3",
37
- "type-fest": "4.40.1",
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.1.2",
41
- "vue": "3.5.13",
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.30"
44
+ "zod": "3.25.51"
45
45
  },
46
46
  "type": "module",
47
47
  "exports": {