@regle/schemas 1.9.5 → 1.9.7

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.
@@ -24,7 +24,7 @@ type NoInferLegacy<A extends any> = [A][A extends any ? 0 : never];
24
24
  //#region src/types/utils/Array.types.d.ts
25
25
  type ArrayElement<T> = T extends Array<infer U> ? U : never;
26
26
  //#endregion
27
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/primitive.d.ts
27
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/primitive.d.ts
28
28
  /**
29
29
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
30
30
 
@@ -32,7 +32,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
32
32
  */
33
33
  type Primitive$1 = null | undefined | string | number | boolean | symbol | bigint;
34
34
  //#endregion
35
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/union-to-intersection.d.ts
35
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/union-to-intersection.d.ts
36
36
  /**
37
37
  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).
38
38
 
@@ -91,10 +91,10 @@ Union extends unknown
91
91
  // Infer the `Intersection` type since TypeScript represents the positional
92
92
  // arguments of unions of functions as an intersection of the union.
93
93
  ) extends ((mergedIntersection: infer Intersection) => void)
94
- // The `& Union` is to allow indexing by the resulting type
94
+ // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
95
95
  ? Intersection & Union : never;
96
96
  //#endregion
97
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/empty-object.d.ts
97
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/empty-object.d.ts
98
98
  declare const emptyObjectSymbol$1: unique symbol;
99
99
 
100
100
  /**
@@ -143,7 +143,7 @@ type Fail = IsEmptyObject<null>; //=> false
143
143
  */
144
144
  type IsEmptyObject<T> = T extends EmptyObject$1 ? true : false;
145
145
  //#endregion
146
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-any.d.ts
146
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-any.d.ts
147
147
  /**
148
148
  Returns a boolean for whether the given type is `any`.
149
149
 
@@ -174,7 +174,7 @@ const anyA = get(anyObject, 'a');
174
174
  */
175
175
  type IsAny$1<T> = 0 extends 1 & NoInfer<T> ? true : false;
176
176
  //#endregion
177
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-optional-key-of.d.ts
177
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-optional-key-of.d.ts
178
178
  /**
179
179
  Returns a boolean for whether the given key is an optional key of type.
180
180
 
@@ -217,7 +217,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
217
217
  */
218
218
  type IsOptionalKeyOf$1<Type extends object, Key extends keyof Type> = IsAny$1<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
219
219
  //#endregion
220
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/optional-keys-of.d.ts
220
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/optional-keys-of.d.ts
221
221
  /**
222
222
  Extract all optional keys from the given type.
223
223
 
@@ -255,7 +255,7 @@ type OptionalKeysOf$1<Type extends object> = Type extends unknown // For distrib
255
255
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf$1<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
256
256
  : never;
257
257
  //#endregion
258
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/required-keys-of.d.ts
258
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/required-keys-of.d.ts
259
259
  /**
260
260
  Extract all required keys from the given type.
261
261
 
@@ -283,7 +283,7 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
283
283
  type RequiredKeysOf$1<Type extends object> = Type extends unknown // For distributing `Type`
284
284
  ? Exclude<keyof Type, OptionalKeysOf$1<Type>> : never;
285
285
  //#endregion
286
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-never.d.ts
286
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-never.d.ts
287
287
  /**
288
288
  Returns a boolean for whether the given type is `never`.
289
289
 
@@ -327,7 +327,7 @@ endIfEqual('abc', '123');
327
327
  */
328
328
  type IsNever$1<T> = [T] extends [never] ? true : false;
329
329
  //#endregion
330
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/if.d.ts
330
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/if.d.ts
331
331
  /**
332
332
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
333
333
 
@@ -387,7 +387,7 @@ type B = IfEqual<string, number, 'equal', 'not equal'>;
387
387
  */
388
388
  type If$1<Type extends boolean, IfBranch, ElseBranch> = IsNever$1<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
389
389
  //#endregion
390
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/type.d.ts
390
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/internal/type.d.ts
391
391
  /**
392
392
  Matches any primitive, `void`, `Date`, or `RegExp` value.
393
393
  */
@@ -400,7 +400,10 @@ Needed to handle the case of a single call signature with properties.
400
400
  Multiple call signatures cannot currently be supported due to a TypeScript limitation.
401
401
  @see https://github.com/microsoft/TypeScript/issues/29732
402
402
  */
403
-
403
+ type HasMultipleCallSignatures$1<T extends (...arguments_: any[]) => unknown> = T extends {
404
+ (...arguments_: infer A): unknown;
405
+ (...arguments_: infer B): unknown;
406
+ } ? B extends A ? A extends B ? false : true : true : false;
404
407
  /**
405
408
  An if-else-like type that resolves depending on whether the given type is `any` or `never`.
406
409
 
@@ -421,7 +424,7 @@ type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
421
424
  */
422
425
  type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = If$1<IsAny$1<T>, IfAny, If$1<IsNever$1<T>, IfNever, IfNotAnyOrNever>>;
423
426
  //#endregion
424
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-null.d.ts
427
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-null.d.ts
425
428
  /**
426
429
  Returns a boolean for whether the given type is `null`.
427
430
 
@@ -443,7 +446,7 @@ type Example2 = NonNullFallback<number, string>;
443
446
  */
444
447
  type IsNull<T> = [T] extends [null] ? true : false;
445
448
  //#endregion
446
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-unknown.d.ts
449
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-unknown.d.ts
447
450
  /**
448
451
  Returns a boolean for whether the given type is `unknown`.
449
452
 
@@ -491,7 +494,13 @@ type IsUnknown<T> = (unknown extends T // `T` can be `unknown` or `any`
491
494
  ? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be
492
495
  ? true : false : false);
493
496
  //#endregion
494
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/simplify.d.ts
497
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/internal/keys.d.ts
498
+ /**
499
+ Disallows any of the given keys.
500
+ */
501
+ type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;
502
+ //#endregion
503
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/simplify.d.ts
495
504
  /**
496
505
  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.
497
506
 
@@ -551,7 +560,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
551
560
  */
552
561
  type Simplify$1<T> = { [KeyType in keyof T]: T[KeyType] } & {};
553
562
  //#endregion
554
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/omit-index-signature.d.ts
563
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/omit-index-signature.d.ts
555
564
  /**
556
565
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
557
566
 
@@ -644,7 +653,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
644
653
  */
645
654
  type OmitIndexSignature$1<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
646
655
  //#endregion
647
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/pick-index-signature.d.ts
656
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/pick-index-signature.d.ts
648
657
  /**
649
658
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
650
659
 
@@ -692,7 +701,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
692
701
  */
693
702
  type PickIndexSignature$1<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
694
703
  //#endregion
695
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/merge.d.ts
704
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/merge.d.ts
696
705
  // Merges two objects without worrying about index signatures.
697
706
  type SimpleMerge$1<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
698
707
 
@@ -732,7 +741,7 @@ export type FooBar = Merge<Foo, Bar>;
732
741
  */
733
742
  type Merge$1<Destination, Source> = Simplify$1<SimpleMerge$1<PickIndexSignature$1<Destination>, PickIndexSignature$1<Source>> & SimpleMerge$1<OmitIndexSignature$1<Destination>, OmitIndexSignature$1<Source>>>;
734
743
  //#endregion
735
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/object.d.ts
744
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/internal/object.d.ts
736
745
  /**
737
746
  Merges user specified options with default options.
738
747
 
@@ -787,7 +796,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
787
796
  */
788
797
  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> = If$1<IsAny$1<SpecifiedOptions>, Defaults, If$1<IsNever$1<SpecifiedOptions>, Defaults, Simplify$1<Merge$1<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf$1<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
789
798
  //#endregion
790
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/or.d.ts
799
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/or.d.ts
791
800
  /**
792
801
  Returns a boolean for whether either of two given types are true.
793
802
 
@@ -867,13 +876,7 @@ type Or<A extends boolean, B extends boolean> = _Or<If$1<IsNever$1<A>, false, A>
867
876
 
868
877
  type _Or<A extends boolean, B extends boolean> = A extends true ? true : B extends true ? true : false;
869
878
  //#endregion
870
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/keys.d.ts
871
- /**
872
- Disallows any of the given keys.
873
- */
874
- type RequireNone<KeysType extends PropertyKey> = Partial<Record<KeysType, never>>;
875
- //#endregion
876
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/require-exactly-one.d.ts
879
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/require-exactly-one.d.ts
877
880
  /**
878
881
  Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
879
882
 
@@ -906,7 +909,7 @@ const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
906
909
  type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, If$1<IsNever$1<KeysType>, never, _RequireExactlyOne<ObjectType, If$1<IsAny$1<KeysType>, keyof ObjectType, KeysType>>>>;
907
910
  type _RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType> = { [Key in KeysType]: (Required<Pick<ObjectType, Key>> & Partial<Record<Exclude<KeysType, Key>, never>>) }[KeysType] & Omit<ObjectType, KeysType>;
908
911
  //#endregion
909
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/require-one-or-none.d.ts
912
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/require-one-or-none.d.ts
910
913
  /**
911
914
  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.
912
915
 
@@ -940,7 +943,7 @@ const responder3: Responder = {
940
943
  type RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, If$1<IsNever$1<KeysType>, ObjectType, _RequireOneOrNone<ObjectType, If$1<IsAny$1<KeysType>, keyof ObjectType, KeysType>>>>;
941
944
  type _RequireOneOrNone<ObjectType, KeysType extends keyof ObjectType> = (RequireExactlyOne<ObjectType, KeysType> | RequireNone<KeysType>) & Omit<ObjectType, KeysType>; // Ignore unspecified keys.
942
945
  //#endregion
943
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-union.d.ts
946
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-union.d.ts
944
947
  /**
945
948
  Returns a boolean for whether the given type is a union.
946
949
 
@@ -958,7 +961,7 @@ type B = IsUnion<string>;
958
961
 
959
962
  // Should never happen
960
963
  //#endregion
961
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/partial-deep.d.ts
964
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/partial-deep.d.ts
962
965
  /**
963
966
  @see {@link PartialDeep}
964
967
  */
@@ -1044,8 +1047,8 @@ partialShape.dimensions = [15]; // OK
1044
1047
  @category Map
1045
1048
  */
1046
1049
  type PartialDeep$1<T, Options extends PartialDeepOptions$1 = {}> = _PartialDeep$1<T, ApplyDefaultOptions$1<PartialDeepOptions$1, DefaultPartialDeepOptions$1, Options>>;
1047
- type _PartialDeep$1<T, Options extends Required<PartialDeepOptions$1>> = T extends BuiltIns$1 | ((new (...arguments_: any[]) => unknown)) ? T : IsNever$1<keyof T> extends true // For functions with no properties
1048
- ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep$1<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep$1<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep$1<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep$1<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
1050
+ type _PartialDeep$1<T, Options extends Required<PartialDeepOptions$1>> = T extends BuiltIns$1 | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep$1<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep$1<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep$1<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep$1<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever$1<keyof T> extends true ? T // For functions with no properties
1051
+ : HasMultipleCallSignatures$1<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep$1<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
1049
1052
  ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
1050
1053
  ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
1051
1054
  ? ReadonlyArray<_PartialDeep$1<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep$1<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep$1<T, Options> // Tuples behave properly
@@ -1075,9 +1078,9 @@ type PartialReadonlySetDeep$1<T, Options extends Required<PartialDeepOptions$1>>
1075
1078
  /**
1076
1079
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
1077
1080
  */
1078
- 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> });
1081
+ type PartialObjectDeep$1<ObjectType extends object, Options extends Required<PartialDeepOptions$1>> = { [KeyType in keyof ObjectType]?: _PartialDeep$1<ObjectType[KeyType], Options> };
1079
1082
  //#endregion
1080
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/required-deep.d.ts
1083
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/required-deep.d.ts
1081
1084
  /**
1082
1085
  Create a type from another type with all keys and nested keys set to required.
1083
1086
 
@@ -1121,7 +1124,7 @@ Note that types containing overloaded functions are not made deeply required due
1121
1124
  */
1122
1125
 
1123
1126
  //#endregion
1124
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/union-to-tuple.d.ts
1127
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/union-to-tuple.d.ts
1125
1128
  /**
1126
1129
  Returns the last element of a union type.
1127
1130
 
@@ -2194,7 +2197,7 @@ type CreateScopedUseRegleOptions<TCustomRegle extends useRegleFn<any, any>, TAsR
2194
2197
  asRecord?: TAsRecord;
2195
2198
  };
2196
2199
  //#endregion
2197
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/primitive.d.ts
2200
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/primitive.d.ts
2198
2201
  /**
2199
2202
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
2200
2203
 
@@ -2202,7 +2205,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
2202
2205
  */
2203
2206
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
2204
2207
  //#endregion
2205
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/empty-object.d.ts
2208
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/empty-object.d.ts
2206
2209
  declare const emptyObjectSymbol: unique symbol;
2207
2210
 
2208
2211
  /**
@@ -2235,7 +2238,7 @@ type EmptyObject = {
2235
2238
  [emptyObjectSymbol]?: never;
2236
2239
  };
2237
2240
  //#endregion
2238
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-any.d.ts
2241
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-any.d.ts
2239
2242
  /**
2240
2243
  Returns a boolean for whether the given type is `any`.
2241
2244
 
@@ -2266,7 +2269,7 @@ const anyA = get(anyObject, 'a');
2266
2269
  */
2267
2270
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
2268
2271
  //#endregion
2269
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-optional-key-of.d.ts
2272
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-optional-key-of.d.ts
2270
2273
  /**
2271
2274
  Returns a boolean for whether the given key is an optional key of type.
2272
2275
 
@@ -2309,7 +2312,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
2309
2312
  */
2310
2313
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
2311
2314
  //#endregion
2312
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/optional-keys-of.d.ts
2315
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/optional-keys-of.d.ts
2313
2316
  /**
2314
2317
  Extract all optional keys from the given type.
2315
2318
 
@@ -2347,7 +2350,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
2347
2350
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
2348
2351
  : never;
2349
2352
  //#endregion
2350
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/required-keys-of.d.ts
2353
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/required-keys-of.d.ts
2351
2354
  /**
2352
2355
  Extract all required keys from the given type.
2353
2356
 
@@ -2375,7 +2378,7 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
2375
2378
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
2376
2379
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
2377
2380
  //#endregion
2378
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/is-never.d.ts
2381
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/is-never.d.ts
2379
2382
  /**
2380
2383
  Returns a boolean for whether the given type is `never`.
2381
2384
 
@@ -2419,7 +2422,7 @@ endIfEqual('abc', '123');
2419
2422
  */
2420
2423
  type IsNever<T> = [T] extends [never] ? true : false;
2421
2424
  //#endregion
2422
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/if.d.ts
2425
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/if.d.ts
2423
2426
  /**
2424
2427
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
2425
2428
 
@@ -2479,13 +2482,25 @@ type B = IfEqual<string, number, 'equal', 'not equal'>;
2479
2482
  */
2480
2483
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
2481
2484
  //#endregion
2482
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/type.d.ts
2485
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/internal/type.d.ts
2483
2486
  /**
2484
2487
  Matches any primitive, `void`, `Date`, or `RegExp` value.
2485
2488
  */
2486
2489
  type BuiltIns = Primitive | void | Date | RegExp;
2490
+ /**
2491
+ Test if the given function has multiple call signatures.
2492
+
2493
+ Needed to handle the case of a single call signature with properties.
2494
+
2495
+ Multiple call signatures cannot currently be supported due to a TypeScript limitation.
2496
+ @see https://github.com/microsoft/TypeScript/issues/29732
2497
+ */
2498
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
2499
+ (...arguments_: infer A): unknown;
2500
+ (...arguments_: infer B): unknown;
2501
+ } ? B extends A ? A extends B ? false : true : true : false;
2487
2502
  //#endregion
2488
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/simplify.d.ts
2503
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/simplify.d.ts
2489
2504
  /**
2490
2505
  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.
2491
2506
 
@@ -2545,7 +2560,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
2545
2560
  */
2546
2561
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
2547
2562
  //#endregion
2548
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/omit-index-signature.d.ts
2563
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/omit-index-signature.d.ts
2549
2564
  /**
2550
2565
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
2551
2566
 
@@ -2638,7 +2653,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
2638
2653
  */
2639
2654
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
2640
2655
  //#endregion
2641
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/pick-index-signature.d.ts
2656
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/pick-index-signature.d.ts
2642
2657
  /**
2643
2658
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
2644
2659
 
@@ -2686,7 +2701,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
2686
2701
  */
2687
2702
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
2688
2703
  //#endregion
2689
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/merge.d.ts
2704
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/merge.d.ts
2690
2705
  // Merges two objects without worrying about index signatures.
2691
2706
  type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
2692
2707
 
@@ -2726,7 +2741,7 @@ export type FooBar = Merge<Foo, Bar>;
2726
2741
  */
2727
2742
  type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
2728
2743
  //#endregion
2729
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/internal/object.d.ts
2744
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/internal/object.d.ts
2730
2745
  /**
2731
2746
  Merges user specified options with default options.
2732
2747
 
@@ -2781,7 +2796,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
2781
2796
  */
2782
2797
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
2783
2798
  //#endregion
2784
- //#region ../../node_modules/.pnpm/type-fest@5.0.0/node_modules/type-fest/source/partial-deep.d.ts
2799
+ //#region ../../node_modules/.pnpm/type-fest@5.1.0/node_modules/type-fest/source/partial-deep.d.ts
2785
2800
  /**
2786
2801
  @see {@link PartialDeep}
2787
2802
  */
@@ -2867,8 +2882,8 @@ partialShape.dimensions = [15]; // OK
2867
2882
  @category Map
2868
2883
  */
2869
2884
  type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
2870
- type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : IsNever<keyof T> extends true // For functions with no properties
2871
- ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
2885
+ type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? IsNever<keyof T> extends true ? T // For functions with no properties
2886
+ : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
2872
2887
  ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
2873
2888
  ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
2874
2889
  ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
@@ -2898,7 +2913,7 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
2898
2913
  /**
2899
2914
  Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
2900
2915
  */
2901
- 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> });
2916
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
2902
2917
  //#endregion
2903
2918
  //#region src/types/core.types.d.ts
2904
2919
  type RegleSchema<TState extends Record<string, any>, TSchema extends Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}, TAdditionalReturnProperties extends Record<string, any> = {}> = {
@@ -3029,7 +3044,7 @@ type RegleSchemaBehaviourOptions = {
3029
3044
  };
3030
3045
  //#endregion
3031
3046
  //#region src/core/useRegleSchema.d.ts
3032
- type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy' | 'rewardEarly' | 'silent'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
3047
+ type useRegleSchemaFnOptions<TAdditionalOptions extends Record<string, any>> = Omit<Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<Record<string, any>, {}, never>, 'validationGroups' | 'lazy' | 'rewardEarly'> & RegleSchemaBehaviourOptions & TAdditionalOptions;
3033
3048
  interface useRegleSchemaFn<TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
3034
3049
  <TSchema extends StandardSchemaV1, TState extends StandardSchemaV1.InferInput<TSchema> | undefined>(...params: [state: MaybeRef<PartialDeep<NoInferLegacy<TState>, {
3035
3050
  recurseIntoArrays: true;
@@ -1,5 +1,5 @@
1
1
  import { createScopedUseRegle, useRootStorage } from "@regle/core";
2
- import { computed, isRef, ref, unref, watch } from "vue";
2
+ import { computed, getCurrentScope, isRef, onScopeDispose, ref, unref, watch } from "vue";
3
3
 
4
4
  //#region ../shared/utils/isFile.ts
5
5
  /**
@@ -216,6 +216,9 @@ function createUseRegleSchemaComposable(options, shortcuts) {
216
216
  return Promise.reject(e);
217
217
  }
218
218
  };
219
+ if (getCurrentScope()) onScopeDispose(() => {
220
+ unWatchState();
221
+ });
219
222
  return { r$: useRootStorage({
220
223
  scopeRules: computed(() => ({})),
221
224
  state: processedState,
@@ -303,11 +306,9 @@ const inferSchema = createInferSchemaHelper();
303
306
  * - an `inferSchema` helper that can typecheck your custom rules
304
307
  */
305
308
  function defineRegleSchemaConfig({ modifiers, shortcuts }) {
306
- const useRegleSchema$1 = createUseRegleSchemaComposable(modifiers, shortcuts);
307
- const inferSchema$1 = createInferSchemaHelper();
308
309
  return {
309
- useRegleSchema: useRegleSchema$1,
310
- inferSchema: inferSchema$1
310
+ useRegleSchema: createUseRegleSchemaComposable(modifiers, shortcuts),
311
+ inferSchema: createInferSchemaHelper()
311
312
  };
312
313
  }
313
314
 
@@ -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";function s(e){return e?.constructor.name==`File`||e?.constructor.name==`FileList`}function c(e,t=!0){return e==null?!0:e instanceof Date?isNaN(e.getTime()):s(e)?e.size<=0:Array.isArray(e)?t?e.length===0:!1:typeof e==`object`&&e?Object.keys(e).length===0:!String(e).length}function l(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 u(e){let t=e,n={}.toString.call(e).slice(8,-1);if(n==`Set`&&(t=new Set([...e].map(e=>u(e)))),n==`Map`&&(t=new Map([...e].map(e=>[u(e[0]),u(e[1])]))),n==`Date`&&(t=new Date(e.getTime())),n==`RegExp`&&(t=RegExp(e.source,l(e))),n==`Array`||n==`Object`)for(let n in t=Array.isArray(e)?[]:{},e)t[n]=u(e[n]);return t}function d(e){return e&&(e instanceof Date||e.constructor.name==`File`||e.constructor.name==`FileList`)?!1:typeof e==`object`&&!!e&&!Array.isArray(e)}function f(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;m(a);for(var o;o=i.shift();)if(m(o),isNaN(parseInt(o))?(e[o]===void 0&&(e[o]={}),e=e[o]):(e.$each??=[],c(e.$each[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]={$self:n}:Array.isArray(e[a])?e[a]=e[a].concat(n):e[a]=n,!0}function p(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 m(e){if(e==`__proto__`||e==`constructor`||e==`prototype`)throw Error(`setting of prototype values not supported`)}function h(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 g(e,s){let c={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function l(e,l,m){let g=n(()=>a(l)),{syncState:_={onUpdate:!1,onValidate:!1},...v}=m??{},{onUpdate:y=!1,onValidate:b=!1}=_,x={...c,...v},S=n(()=>!d(C.value)),C=r(e)?e:i(e),w=i(d(C.value)?{...u(C.value)}:u(C.value)),T=d(C.value)?{...u(C.value)}:u(C.value),E=i({}),D;if(!g.value?.[`~standard`])throw Error(`Only "standard-schema" compatible libraries are supported`);function O(e){let t={};return e.issues&&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`?n.key:n,i=(typeof n==`object`&&`value`in n?Array.isArray(n.value):!1)||(`type`in e?e.type===`array`:!1)||Array.isArray(p(C.value,t));return!i&&typeof r==`number`&&(t=e.path?.slice(0,e.path.length-1)?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``),{...e,$path:t,isArray:i,$property:r,$rule:`schema`,$message:e.message}}).forEach(({isArray:e,$path:n,...r})=>{f(t,n,[r],e)}),t}async function k(e=!1){let t=g.value[`~standard`].validate(C.value);return t instanceof Promise&&(t=await t),S.value?E.value=t.issues?.map(e=>({$message:e.message,$property:e.path?.[e.path.length-1]?.toString()??`-`,$rule:`schema`,...e}))??[]:E.value=O(t),t.issues||(e&&b||!e&&y)&&(A?.(),d(C.value)?C.value=h(C.value,t.value):C.value=t.value,j()),t}let A;function j(){A=o([C,g],()=>k(),{deep:!0})}return j(),k(),D=async()=>{try{return{valid:!(await k(!0)).issues?.length,data:C.value,errors:{},issues:{}}}catch(e){return Promise.reject(e)}},{r$:t({scopeRules:n(()=>({})),state:C,options:x,schemaErrors:E,initialState:w,originalState:T,shortcuts:s,schemaMode:!0,onValidate:D}).regle}}return l}const _=g();function v(e,t){return e}function y(){function e(e,t){return t}return e}const b=y();function x({modifiers:e,shortcuts:t}){let n=g(e,t),r=y();return{useRegleSchema:n,inferSchema:r}}const{useCollectScope:S,useScopedRegle:C}=e({customUseRegle:_}),w=t=>{let{customStore:n,customUseRegle:r=_,asRecord:i=!1}=t??{};return e({customStore:n,customUseRegle:r,asRecord:i})};export{w as createScopedUseRegleSchema,x as defineRegleSchemaConfig,b as inferSchema,S as useCollectSchemaScope,_ as useRegleSchema,C as useScopedRegleSchema,v as withDeps};
1
+ import{createScopedUseRegle as e,useRootStorage as t}from"@regle/core";import{computed as n,getCurrentScope as r,isRef as i,onScopeDispose as a,ref as o,unref as s,watch as c}from"vue";function l(e){return e?.constructor.name==`File`||e?.constructor.name==`FileList`}function u(e,t=!0){return e==null?!0:e instanceof Date?isNaN(e.getTime()):l(e)?e.size<=0:Array.isArray(e)?t?e.length===0:!1:typeof e==`object`&&e?Object.keys(e).length===0:!String(e).length}function d(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 f(e){let t=e,n={}.toString.call(e).slice(8,-1);if(n==`Set`&&(t=new Set([...e].map(e=>f(e)))),n==`Map`&&(t=new Map([...e].map(e=>[f(e[0]),f(e[1])]))),n==`Date`&&(t=new Date(e.getTime())),n==`RegExp`&&(t=RegExp(e.source,d(e))),n==`Array`||n==`Object`)for(let n in t=Array.isArray(e)?[]:{},e)t[n]=f(e[n]);return t}function p(e){return e&&(e instanceof Date||e.constructor.name==`File`||e.constructor.name==`FileList`)?!1:typeof e==`object`&&!!e&&!Array.isArray(e)}function m(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;g(a);for(var o;o=i.shift();)if(g(o),isNaN(parseInt(o))?(e[o]===void 0&&(e[o]={}),e=e[o]):(e.$each??=[],u(e.$each[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]={$self:n}:Array.isArray(e[a])?e[a]=e[a].concat(n):e[a]=n,!0}function h(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 g(e){if(e==`__proto__`||e==`constructor`||e==`prototype`)throw Error(`setting of prototype values not supported`)}function _(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 v(e,l){let u={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function d(e,d,g){let v=n(()=>s(d)),{syncState:y={onUpdate:!1,onValidate:!1},...b}=g??{},{onUpdate:x=!1,onValidate:S=!1}=y,C={...u,...b},w=n(()=>!p(T.value)),T=i(e)?e:o(e),E=o(p(T.value)?{...f(T.value)}:f(T.value)),D=p(T.value)?{...f(T.value)}:f(T.value),O=o({}),k;if(!v.value?.[`~standard`])throw Error(`Only "standard-schema" compatible libraries are supported`);function A(e){let t={};return e.issues&&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`?n.key:n,i=(typeof n==`object`&&`value`in n?Array.isArray(n.value):!1)||(`type`in e?e.type===`array`:!1)||Array.isArray(h(T.value,t));return!i&&typeof r==`number`&&(t=e.path?.slice(0,e.path.length-1)?.map(e=>typeof e==`object`?e.key:e.toString()).join(`.`)??``),{...e,$path:t,isArray:i,$property:r,$rule:`schema`,$message:e.message}}).forEach(({isArray:e,$path:n,...r})=>{m(t,n,[r],e)}),t}async function j(e=!1){let t=v.value[`~standard`].validate(T.value);return t instanceof Promise&&(t=await t),w.value?O.value=t.issues?.map(e=>({$message:e.message,$property:e.path?.[e.path.length-1]?.toString()??`-`,$rule:`schema`,...e}))??[]:O.value=A(t),t.issues||(e&&S||!e&&x)&&(M?.(),p(T.value)?T.value=_(T.value,t.value):T.value=t.value,N()),t}let M;function N(){M=c([T,v],()=>j(),{deep:!0})}return N(),j(),k=async()=>{try{return{valid:!(await j(!0)).issues?.length,data:T.value,errors:{},issues:{}}}catch(e){return Promise.reject(e)}},r()&&a(()=>{M()}),{r$:t({scopeRules:n(()=>({})),state:T,options:C,schemaErrors:O,initialState:E,originalState:D,shortcuts:l,schemaMode:!0,onValidate:k}).regle}}return d}const y=v();function b(e,t){return e}function x(){function e(e,t){return t}return e}const S=x();function C({modifiers:e,shortcuts:t}){return{useRegleSchema:v(e,t),inferSchema:x()}}const{useCollectScope:w,useScopedRegle:T}=e({customUseRegle:y}),E=t=>{let{customStore:n,customUseRegle:r=y,asRecord:i=!1}=t??{};return e({customStore:n,customUseRegle:r,asRecord:i})};export{E as createScopedUseRegleSchema,C as defineRegleSchemaConfig,S as inferSchema,w as useCollectSchemaScope,y as useRegleSchema,T as useScopedRegleSchema,b as withDeps};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@regle/schemas",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "description": "Schemas adapter for Regle",
5
5
  "dependencies": {
6
6
  "@standard-schema/spec": "1.0.0",
7
- "@regle/rules": "1.9.5",
8
- "@regle/core": "1.9.5"
7
+ "@regle/core": "1.9.7",
8
+ "@regle/rules": "1.9.7"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "valibot": "^1.0.0",
@@ -25,17 +25,17 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@total-typescript/ts-reset": "0.6.1",
28
- "@types/node": "22.13.14",
28
+ "@types/node": "22.18.10",
29
29
  "@vue/test-utils": "2.4.6",
30
30
  "prettier": "3.6.2",
31
- "tsdown": "0.15.2",
32
- "type-fest": "5.0.0",
33
- "typescript": "5.9.2",
31
+ "tsdown": "0.15.7",
32
+ "type-fest": "5.1.0",
33
+ "typescript": "5.9.3",
34
34
  "valibot": "1.1.0",
35
35
  "vitest": "3.2.4",
36
- "vue": "3.5.21",
37
- "vue-tsc": "3.0.7",
38
- "zod": "4.1.9"
36
+ "vue": "3.5.22",
37
+ "vue-tsc": "3.0.9",
38
+ "zod": "4.1.12"
39
39
  },
40
40
  "type": "module",
41
41
  "exports": {