@regle/core 1.1.0-beta.2 → 1.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/regle-core.d.ts +203 -145
- package/dist/regle-core.min.mjs +2 -2
- package/dist/regle-core.mjs +59 -14
- package/package.json +8 -19
- package/dist/regle-core.cjs +0 -2710
- package/dist/regle-core.d.cts +0 -2536
- package/dist/regle-core.min.cjs +0 -2
- package/index.cjs +0 -7
- package/index.js +0 -7
package/dist/regle-core.d.ts
CHANGED
|
@@ -1124,22 +1124,7 @@ type RegleSingleField<TState extends Maybe<PrimitiveTypes> = any, TRules extends
|
|
|
1124
1124
|
type DeepReactiveState<T extends Record<string, any> | unknown | undefined> = ExtendOnlyRealRecord<T> extends true ? {
|
|
1125
1125
|
[K in keyof T]: InferDeepReactiveState<T[K]>;
|
|
1126
1126
|
} : never;
|
|
1127
|
-
type InferDeepReactiveState<TState> = NonNullable<TState> extends Array<infer U extends Record<string, any>> ? DeepReactiveState<U[]> : NonNullable<TState> extends Date | File ? MaybeRef<TState> : TState extends Record<string, any>
|
|
1128
|
-
type DeepSafeFormState<TState extends Record<string, any>, TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> | undefined> = [unknown] extends [TState] ? {} : TRules extends undefined ? TState : TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> ? Prettify<{
|
|
1129
|
-
[K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? K : never]?: SafeProperty<TState[K], TRules[K]>;
|
|
1130
|
-
} & {
|
|
1131
|
-
[K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? never : K]-?: NonNullable<SafeProperty<TState[K], TRules[K]>>;
|
|
1132
|
-
}> : TState;
|
|
1133
|
-
type FieldHaveRequiredRule<TRule extends RegleRuleDecl> = unknown extends TRule['required'] ? false : TRule['required'] extends undefined ? false : TRule['required'] extends RegleRuleDefinition<any, infer Params, any, any, any> ? Params extends never[] ? true : false : false;
|
|
1134
|
-
type ObjectHaveAtLeastOneRequiredField<TState extends Record<string, any>, TRule extends ReglePartialRuleTree<TState, any>> = TState extends Maybe<TState> ? {
|
|
1135
|
-
[K in keyof NonNullable<TState>]-?: IsPropertyOutputRequired<NonNullable<TState>[K], TRule[K]>;
|
|
1136
|
-
}[keyof TState] extends false ? false : true : true;
|
|
1137
|
-
type ArrayHaveAtLeastOneRequiredField<TState extends Maybe<any[]>, TRule extends RegleCollectionRuleDecl<TState>> = TState extends Maybe<TState> ? FieldHaveRequiredRule<Omit<TRule, '$each'> extends RegleRuleDecl ? Omit<TRule, '$each'> : {}> | ObjectHaveAtLeastOneRequiredField<ArrayElement<NonNullable<TState>>, ExtractFromGetter<TRule['$each']> extends undefined ? {} : NonNullable<ExtractFromGetter<TRule['$each']>>> extends false ? false : true : true;
|
|
1138
|
-
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> ? NonNullable<TState> : {}, TRule> : TRule extends RegleRuleDecl<any, any> ? FieldHaveRequiredRule<TRule> extends true ? TState : Maybe<TState> : TState : TState;
|
|
1139
|
-
type IsPropertyOutputRequired<TState, TRule extends RegleFormPropertyType<any, any> | undefined> = [
|
|
1140
|
-
unknown
|
|
1141
|
-
] 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;
|
|
1142
|
-
type SafeFieldProperty<TState, TRule extends RegleFormPropertyType<any, any> | undefined = never> = TRule extends RegleRuleDecl<any, any> ? unknown extends TRule['required'] ? MaybeOutput<TState> : TRule['required'] extends undefined ? never : TRule['required'] extends RegleRuleDefinition<any, infer Params, any, any, any> ? Params extends never[] ? NonNullable<TState> : MaybeOutput<TState> : MaybeOutput<TState> : MaybeOutput<TState>;
|
|
1127
|
+
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>;
|
|
1143
1128
|
|
|
1144
1129
|
type ResetOptions<TState extends unknown> = RequireOneOrNone<{
|
|
1145
1130
|
/**
|
|
@@ -1159,6 +1144,44 @@ type ResetOptions<TState extends unknown> = RequireOneOrNone<{
|
|
|
1159
1144
|
clearExternalErrors?: boolean;
|
|
1160
1145
|
}, 'toInitialState' | 'toState'>;
|
|
1161
1146
|
|
|
1147
|
+
type ScopedInstancesRecord = Record<string, Record<string, SuperCompatibleRegleRoot>> & {
|
|
1148
|
+
'~~global': Record<string, SuperCompatibleRegleRoot>;
|
|
1149
|
+
};
|
|
1150
|
+
type ScopedInstancesRecordLike = Partial<ScopedInstancesRecord>;
|
|
1151
|
+
|
|
1152
|
+
type PartialFormState<TState extends Record<string, any>> = [unknown] extends [TState] ? {} : Prettify<{
|
|
1153
|
+
[K in keyof TState as ExtendOnlyRealRecord<TState[K]> extends true ? never : TState[K] extends Array<any> ? never : K]?: MaybeOutput<TState[K]>;
|
|
1154
|
+
} & {
|
|
1155
|
+
[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]>;
|
|
1156
|
+
}>;
|
|
1157
|
+
type RegleResult<Data extends Record<string, any> | any[] | unknown, TRules extends ReglePartialRuleTree<any>> = {
|
|
1158
|
+
valid: false;
|
|
1159
|
+
data: 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>;
|
|
1160
|
+
} | {
|
|
1161
|
+
valid: true;
|
|
1162
|
+
data: 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>;
|
|
1163
|
+
};
|
|
1164
|
+
type InferSafeOutput<TRegle extends MaybeRef<RegleRoot<{}, any, any, any>> | MaybeRef<RegleFieldStatus<any, any, any>>> = UnwrapRef<TRegle> extends Raw<RegleRoot<infer TState extends Record<string, any>, infer TRules, any, any>> ? DeepSafeFormState<JoinDiscriminatedUnions<TState>, TRules> : UnwrapRef<TRegle> extends RegleFieldStatus<infer TState, infer TRules> ? SafeFieldProperty<TState, TRules> : never;
|
|
1165
|
+
type $InternalRegleResult = {
|
|
1166
|
+
valid: boolean;
|
|
1167
|
+
data: any;
|
|
1168
|
+
};
|
|
1169
|
+
type DeepSafeFormState<TState extends Record<string, any>, TRules extends ReglePartialRuleTree<Record<string, any>, CustomRulesDeclarationTree> | undefined> = [unknown] extends [TState] ? {} : TRules extends undefined ? TState : TRules extends ReglePartialRuleTree<TState, CustomRulesDeclarationTree> ? Prettify<{
|
|
1170
|
+
[K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? K : never]?: SafeProperty<TState[K], TRules[K]>;
|
|
1171
|
+
} & {
|
|
1172
|
+
[K in keyof TState as IsPropertyOutputRequired<TState[K], TRules[K]> extends false ? never : K]-?: NonNullable<SafeProperty<TState[K], TRules[K]>>;
|
|
1173
|
+
}> : TState;
|
|
1174
|
+
type FieldHaveRequiredRule<TRule extends RegleFormPropertyType<any, any> | undefined = never> = TRule extends RegleRuleDecl<any, any> ? NonNullable<TRule['required']> extends TRule['required'] ? true : TRule['required'] extends RegleRuleDefinition<any, infer Params, any, any, any> ? Params extends never[] ? true : false : NonNullable<TRule['literal']> extends RegleRuleDefinition<any, any[], any, any, any> ? true : false : false;
|
|
1175
|
+
type ObjectHaveAtLeastOneRequiredField<TState extends Record<string, any>, TRule extends ReglePartialRuleTree<TState, any>> = TState extends Maybe<TState> ? {
|
|
1176
|
+
[K in keyof NonNullable<TState>]-?: IsPropertyOutputRequired<NonNullable<TState>[K], TRule[K]>;
|
|
1177
|
+
}[keyof TState] extends false ? false : true : true;
|
|
1178
|
+
type ArrayHaveAtLeastOneRequiredField<TState extends Maybe<any[]>, TRule extends RegleCollectionRuleDecl<TState>> = TState extends Maybe<TState> ? FieldHaveRequiredRule<Omit<TRule, '$each'> extends RegleRuleDecl ? Omit<TRule, '$each'> : {}> | ObjectHaveAtLeastOneRequiredField<ArrayElement<NonNullable<TState>>, ExtractFromGetter<TRule['$each']> extends undefined ? {} : NonNullable<ExtractFromGetter<TRule['$each']>>> extends false ? false : true : true;
|
|
1179
|
+
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;
|
|
1180
|
+
type IsPropertyOutputRequired<TState, TRule extends RegleFormPropertyType<any, any> | undefined> = [
|
|
1181
|
+
unknown
|
|
1182
|
+
] 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;
|
|
1183
|
+
type SafeFieldProperty<TState, TRule extends RegleFormPropertyType<any, any> | undefined = never> = FieldHaveRequiredRule<TRule> extends true ? NonNullable<TState> : MaybeOutput<TState>;
|
|
1184
|
+
|
|
1162
1185
|
/**
|
|
1163
1186
|
* Negates a boolean type.
|
|
1164
1187
|
*/
|
|
@@ -1594,18 +1617,61 @@ type DeepBrand<T> = IsNever<T> extends true ? {
|
|
|
1594
1617
|
*/
|
|
1595
1618
|
type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>;
|
|
1596
1619
|
|
|
1620
|
+
/**
|
|
1621
|
+
* Determines the printable type representation for a given type.
|
|
1622
|
+
*/
|
|
1623
|
+
type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<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' : '...';
|
|
1624
|
+
/**
|
|
1625
|
+
* Helper for showing end-user a hint why their type assertion is failing.
|
|
1626
|
+
* This swaps "leaf" types with a literal message about what the actual and
|
|
1627
|
+
* expected types are. Needs to check for `Not<IsAny<Actual>>` because
|
|
1628
|
+
* otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔
|
|
1629
|
+
*/
|
|
1630
|
+
type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : {
|
|
1631
|
+
[K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
|
|
1632
|
+
} : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
|
|
1633
|
+
|
|
1634
|
+
type NarrowVariant<TRoot extends {
|
|
1635
|
+
[x: string]: unknown;
|
|
1636
|
+
}, TKey extends keyof TRoot, TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot[TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
|
|
1637
|
+
$value: infer V;
|
|
1638
|
+
} ? V : unknown> = Extract<TRoot, {
|
|
1639
|
+
[K in TKey]: RegleFieldStatus<TValue, any, any>;
|
|
1640
|
+
}>;
|
|
1597
1641
|
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'> & {
|
|
1598
|
-
$fields:
|
|
1599
|
-
[TIndex in keyof TupleToPlainObj<UnionToTuple$1<TState>>]: TIndex extends `${infer TIndexInt extends number}` ? {
|
|
1600
|
-
[TKey in keyof UnionToTuple$1<TState>[TIndexInt] as TKey extends keyof JoinDiscriminatedUnions<TRules> ? TKey : never]-?: InferRegleStatusType<NonNullable<TKey extends keyof JoinDiscriminatedUnions<TRules> ? JoinDiscriminatedUnions<TRules>[TKey] : {}>, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts>;
|
|
1601
|
-
} & {
|
|
1602
|
-
[TKey in keyof UnionToTuple$1<TState>[TIndexInt] as TKey extends keyof JoinDiscriminatedUnions<TRules> ? never : TKey]: InferRegleStatusType<{}, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts>;
|
|
1603
|
-
} : {};
|
|
1604
|
-
}[keyof TupleToPlainObj<UnionToTuple$1<TState>>];
|
|
1642
|
+
$fields: ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>];
|
|
1605
1643
|
} : RegleStatus<TState, TRules, TShortcuts>;
|
|
1644
|
+
type ProcessChildrenFields<TState extends Record<string, any> | undefined, TRules extends ReglePartialRuleTree<NonNullable<TState>>, TShortcuts extends RegleShortcutDefinition = {}> = {
|
|
1645
|
+
[TIndex in keyof TupleToPlainObj<UnionToTuple$1<TState>>]: TIndex extends `${infer TIndexInt extends number}` ? {
|
|
1646
|
+
[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 : EmptyObject> 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 : EmptyObject, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts>;
|
|
1647
|
+
} & {
|
|
1648
|
+
[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 : EmptyObject> 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 : EmptyObject, NonNullable<UnionToTuple$1<TState>[TIndexInt]>, TKey, TShortcuts>;
|
|
1649
|
+
} : {};
|
|
1650
|
+
};
|
|
1651
|
+
type FindCorrespondingVariant<TState extends Record<string, any>, TRules extends any[]> = TRules extends [
|
|
1652
|
+
infer F,
|
|
1653
|
+
...infer R
|
|
1654
|
+
] ? F extends ReglePartialRuleTree<TState> ? [F] : FindCorrespondingVariant<TState, R> : [];
|
|
1655
|
+
type PossibleLiteralTypes<T extends Record<string, any>, TKey extends keyof T> = {
|
|
1656
|
+
[TVal in NonNullable<T[TKey]>]: {
|
|
1657
|
+
[K in TKey]-?: Omit<RegleRuleDecl<TVal, Partial<AllRulesDeclarations>>, 'literal'> & {
|
|
1658
|
+
literal?: RegleRuleDefinition<TVal, [literal: TVal], false, boolean, string | number>;
|
|
1659
|
+
};
|
|
1660
|
+
};
|
|
1661
|
+
};
|
|
1662
|
+
type RequiredForm<T extends Record<string, any>, TKey extends keyof T> = Omit<ReglePartialRuleTree<T>, TKey> & PossibleLiteralTypes<T, TKey>[keyof PossibleLiteralTypes<T, TKey>];
|
|
1663
|
+
type VariantTuple<T extends Record<string, any>, TKey extends keyof T> = [
|
|
1664
|
+
RequiredForm<T, TKey>,
|
|
1665
|
+
...RequiredForm<T, TKey>[]
|
|
1666
|
+
];
|
|
1606
1667
|
|
|
1607
1668
|
interface useRegleFn<TCustomRules extends Partial<AllRulesDeclarations>, TShortcuts extends RegleShortcutDefinition<any> = never, TAdditionalReturnProperties extends Record<string, any> = {}, TAdditionalOptions extends Record<string, any> = {}> {
|
|
1608
|
-
<TState extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules extends ReglePartialRuleTree<Unwrap<TState extends Record<string, any> ? TState : {}>, Partial<AllRulesDeclarations> & TCustomRules
|
|
1669
|
+
<TState extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules extends ReglePartialRuleTree<Unwrap<TState extends Record<string, any> ? TState : {}>, Partial<AllRulesDeclarations> & TCustomRules> & TValid, TDecl extends RegleRuleDecl<NonNullable<TState>, Partial<AllRulesDeclarations> & TCustomRules>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]>, TValid = isDeepExact<NoInferLegacy<TRules>, Unwrap<TState extends Record<string, any> ? TState : {}>> extends true ? {} : MismatchInfo<RegleRuleTree<Unwrap<TState extends Record<string, any> ? TState : {}>, Partial<AllRulesDeclarations> & TCustomRules>, NoInferLegacy<TRules>>>(state: Maybe<MaybeRef<TState> | DeepReactiveState<TState>>, rulesFactory: TState extends MaybeInput<PrimitiveTypes> ? MaybeRefOrGetter<TDecl> : TState extends Record<string, any> ? MaybeRefOrGetter<TRules> : {}, options?: TState extends MaybeInput<PrimitiveTypes> ? Partial<DeepMaybeRef<RegleBehaviourOptions>> & TAdditionalOptions : Partial<DeepMaybeRef<RegleBehaviourOptions>> & LocalRegleBehaviourOptions<JoinDiscriminatedUnions<TState extends Record<string, any> ? Unwrap<TState> : {}>, TState extends Record<string, any> ? TRules : {}, TValidationGroups> & TAdditionalOptions): NonNullable<TState> extends PrimitiveTypes ? RegleSingleField<NonNullable<TState>, TDecl, TShortcuts, TAdditionalReturnProperties> : Regle<TState extends Record<string, any> ? Unwrap<TState> : {}, TRules, TValidationGroups, TShortcuts, TAdditionalReturnProperties>;
|
|
1670
|
+
__config?: {
|
|
1671
|
+
rules?: () => CustomRulesDeclarationTree;
|
|
1672
|
+
modifiers?: RegleBehaviourOptions;
|
|
1673
|
+
shortcuts?: TShortcuts;
|
|
1674
|
+
};
|
|
1609
1675
|
}
|
|
1610
1676
|
/**
|
|
1611
1677
|
* useRegle serves as the foundation for validation logic.
|
|
@@ -1629,7 +1695,7 @@ interface useRegleFn<TCustomRules extends Partial<AllRulesDeclarations>, TShortc
|
|
|
1629
1695
|
declare const useRegle: useRegleFn<Partial<AllRulesDeclarations>, RegleShortcutDefinition<any>, {}, {}>;
|
|
1630
1696
|
|
|
1631
1697
|
interface inferRulesFn<TCustomRules extends Partial<AllRulesDeclarations>> {
|
|
1632
|
-
<TState extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules extends TState extends
|
|
1698
|
+
<TState extends Record<string, any> | MaybeInput<PrimitiveTypes>, TRules extends ReglePartialRuleTree<Unwrap<TState extends Record<string, any> ? TState : {}>, Partial<AllRulesDeclarations> & TCustomRules> & TValid, TDecl extends RegleRuleDecl<NonNullable<TState>, Partial<AllRulesDeclarations> & TCustomRules>, TValid = isDeepExact<NoInferLegacy<TRules>, Unwrap<TState extends Record<string, any> ? TState : {}>> extends true ? {} : MismatchInfo<NoInferLegacy<TRules>, ReglePartialRuleTree<Unwrap<TState extends Record<string, any> ? TState : {}>, Partial<AllRulesDeclarations> & TCustomRules>>>(state: MaybeRef<TState> | DeepReactiveState<TState>, rulesFactory: TState extends MaybeInput<PrimitiveTypes> ? TDecl : TState extends Record<string, any> ? TRules : {}): NonNullable<TState> extends PrimitiveTypes ? TDecl : TRules;
|
|
1633
1699
|
}
|
|
1634
1700
|
/**
|
|
1635
1701
|
* Rule type helper to provide autocomplete and typecheck to your form rules or part of your form rules
|
|
@@ -1672,24 +1738,13 @@ declare function flatErrors(errors: $InternalRegleErrors, options?: {
|
|
|
1672
1738
|
type InferRegleRoot<T extends (...args: any[]) => Regle<any, any, any, any>> = T extends (...args: any[]) => infer U ? U extends Regle<any, any, any, any> ? Prettify<U['r$']> : never : never;
|
|
1673
1739
|
type InferRegleRules<T extends useRegleFn<any, any>> = T extends useRegleFn<infer U, any> ? UnwrapRuleTree<Partial<U> & Partial<DefaultValidators>> : {};
|
|
1674
1740
|
type InferRegleShortcuts<T extends useRegleFn<any, any>> = T extends useRegleFn<any, infer U> ? U : {};
|
|
1675
|
-
type RegleEnforceRequiredRules<TRules extends keyof DefaultValidators> = {
|
|
1741
|
+
type RegleEnforceRequiredRules<TRules extends keyof DefaultValidators> = Omit<Partial<DefaultValidatorsTree>, TRules> & {
|
|
1676
1742
|
[K in TRules]-?: UnwrapRuleWithParams<DefaultValidators[K]>;
|
|
1677
1743
|
};
|
|
1678
|
-
type RegleEnforceCustomRequiredRules<T extends Partial<AllRulesDeclarations> | useRegleFn<any>, TRules extends T extends useRegleFn<any> ? keyof InferRegleRules<T> : keyof T> = {
|
|
1679
|
-
[K in TRules]-?: T extends useRegleFn<any> ? K extends keyof InferRegleRules<T> ? UnwrapRuleWithParams<InferRegleRules<T>[K]
|
|
1744
|
+
type RegleEnforceCustomRequiredRules<T extends Partial<AllRulesDeclarations> | useRegleFn<any, any>, TRules extends T extends useRegleFn<any, any> ? keyof InferRegleRules<T> : keyof T> = Omit<Partial<DefaultValidatorsTree>, TRules> & {
|
|
1745
|
+
[K in TRules]-?: T extends useRegleFn<any, any> ? K extends keyof InferRegleRules<T> ? NonNullable<UnwrapRuleWithParams<InferRegleRules<T>[K]>> : never : K extends keyof T ? NonNullable<T[K]> : never;
|
|
1680
1746
|
};
|
|
1681
1747
|
|
|
1682
|
-
/**
|
|
1683
|
-
* Borrowed from vitest
|
|
1684
|
-
*/
|
|
1685
|
-
type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<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' : '...';
|
|
1686
|
-
/**
|
|
1687
|
-
* Borrowed from vitest
|
|
1688
|
-
*/
|
|
1689
|
-
type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : {
|
|
1690
|
-
[K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
|
|
1691
|
-
} : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `[Regle error] The parent property does not match the form schema`;
|
|
1692
|
-
|
|
1693
1748
|
type RemoveCommonKey<T extends readonly any[], K extends PropertyKey> = T extends [infer F, ...infer R] ? [Prettify<Omit<F, K>>, ...RemoveCommonKey<R, K>] : [];
|
|
1694
1749
|
/**
|
|
1695
1750
|
* Get item value from object, otherwise fallback to undefined. Avoid TS to not be able to infer keys not present on all unions
|
|
@@ -1732,6 +1787,11 @@ type TupleToPlainObj<T> = {
|
|
|
1732
1787
|
[I in keyof T & `${number}`]: T[I];
|
|
1733
1788
|
};
|
|
1734
1789
|
|
|
1790
|
+
type isDeepExact<TRules, TTree> = {
|
|
1791
|
+
[K in keyof TRules]-?: CheckDeepExact<NonNullable<TRules[K]>, K extends keyof JoinDiscriminatedUnions<TTree> ? NonNullable<JoinDiscriminatedUnions<TTree>[K]> : never>;
|
|
1792
|
+
}[keyof TRules] extends true ? true : false;
|
|
1793
|
+
type CheckDeepExact<TRules, TTree> = [TTree] extends [never] ? false : TRules extends RegleCollectionRuleDecl ? TTree extends Array<any> ? isDeepExact<NonNullable<TRules['$each']>, JoinDiscriminatedUnions<NonNullable<ArrayElement<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;
|
|
1794
|
+
|
|
1735
1795
|
type CreateFn<T extends any[]> = (...args: T) => any;
|
|
1736
1796
|
/**
|
|
1737
1797
|
* Transform normal parameters tuple declaration to a rich tuple declaration
|
|
@@ -1766,6 +1826,7 @@ declare const InternalRuleType: {
|
|
|
1766
1826
|
};
|
|
1767
1827
|
type InternalRuleType = enumType<typeof InternalRuleType>;
|
|
1768
1828
|
|
|
1829
|
+
type IsLiteral<T> = string extends T ? false : true;
|
|
1769
1830
|
/**
|
|
1770
1831
|
* Returned typed of rules created with `createRule`
|
|
1771
1832
|
* */
|
|
@@ -1775,24 +1836,30 @@ interface RegleRuleDefinition<TValue extends any = unknown, TParams extends any[
|
|
|
1775
1836
|
active: (metadata: PossibleRegleRuleMetadataConsumer<TFilteredValue>) => boolean;
|
|
1776
1837
|
tooltip: (metadata: PossibleRegleRuleMetadataConsumer<TFilteredValue>) => string | string[];
|
|
1777
1838
|
type?: string;
|
|
1839
|
+
_value?: IsLiteral<TValue> extends true ? TValue : any;
|
|
1778
1840
|
exec: (value: Maybe<TFilteredValue>) => TAsync extends false ? TMetaData : Promise<TMetaData>;
|
|
1779
1841
|
}
|
|
1780
1842
|
/**
|
|
1781
1843
|
* Rules with params created with `createRules` are callable while being customizable
|
|
1782
1844
|
*/
|
|
1783
|
-
|
|
1845
|
+
type RegleRuleWithParamsDefinition<TValue extends any = any, TParams extends any[] = never, TAsync extends boolean = false, TMetadata extends RegleRuleMetadataDefinition = boolean, TFilteredValue extends any = TValue extends Date & File & infer M ? M : TValue> = RegleRuleCore<TFilteredValue, TParams, TAsync, TMetadata> & RegleInternalRuleDefs<TFilteredValue, TParams, TAsync, TMetadata> & {
|
|
1784
1846
|
(...params: RegleUniversalParams<TParams>): RegleRuleDefinition<TFilteredValue, TParams, TAsync, TMetadata>;
|
|
1785
|
-
}
|
|
1847
|
+
} & (TParams extends [param?: any, ...any[]] ? {
|
|
1848
|
+
exec: (value: Maybe<TFilteredValue>) => TAsync extends false ? TMetadata : Promise<TMetadata>;
|
|
1849
|
+
} : {});
|
|
1850
|
+
type RegleRuleWithParamsDefinitionInput<TValue extends any = any, TParams extends any[] = never, TAsync extends boolean = false, TMetadata extends RegleRuleMetadataDefinition = boolean, TFilteredValue extends any = TValue extends Date & File & infer M ? M : TValue> = RegleRuleCore<TFilteredValue, TParams, TAsync, TMetadata> & RegleInternalRuleDefs<TFilteredValue, TParams, TAsync, TMetadata> & (TParams extends [param?: any, ...any[]] ? {
|
|
1851
|
+
exec: (value: Maybe<TFilteredValue>) => TAsync extends false ? TMetadata : Promise<TMetadata>;
|
|
1852
|
+
} : {});
|
|
1786
1853
|
type RegleRuleMetadataExtended = {
|
|
1787
1854
|
$valid: boolean;
|
|
1788
1855
|
[x: string]: any;
|
|
1789
1856
|
};
|
|
1790
1857
|
type UnwrapRuleTree<T extends {
|
|
1791
|
-
[x: string]:
|
|
1858
|
+
[x: string]: RegleRuleRawInput<any, any[], any, any> | undefined;
|
|
1792
1859
|
}> = {
|
|
1793
1860
|
[K in keyof T]: UnwrapRuleWithParams<T[K]>;
|
|
1794
1861
|
};
|
|
1795
|
-
type UnwrapRuleWithParams<T extends
|
|
1862
|
+
type UnwrapRuleWithParams<T extends RegleRuleRawInput<any, any[], any, any> | undefined> = T extends RegleRuleWithParamsDefinition<infer TValue, infer TParams, infer TAsync, infer TMetadata> ? RegleRuleDefinition<TValue, TParams, TAsync, TMetadata> : T;
|
|
1796
1863
|
/**
|
|
1797
1864
|
* Define a rule Metadata definition
|
|
1798
1865
|
*/
|
|
@@ -1804,7 +1871,7 @@ type DefaultMetadataProperties = DefaultMetadataPropertiesCommon & {
|
|
|
1804
1871
|
/**
|
|
1805
1872
|
* Will be used to consumme metadata on related helpers and rule status
|
|
1806
1873
|
*/
|
|
1807
|
-
type RegleRuleMetadataConsumer<TValue extends any, TParams extends any[] = never, TMetadata extends RegleRuleMetadataDefinition = boolean> = {
|
|
1874
|
+
type RegleRuleMetadataConsumer<TValue extends any, TParams extends [...any[]] = never, TMetadata extends RegleRuleMetadataDefinition = boolean> = {
|
|
1808
1875
|
$value: Maybe<TValue>;
|
|
1809
1876
|
} & DefaultMetadataProperties & (TParams extends never ? {} : {
|
|
1810
1877
|
$params: [...TParams];
|
|
@@ -1815,12 +1882,17 @@ type RegleRuleMetadataConsumer<TValue extends any, TParams extends any[] = never
|
|
|
1815
1882
|
type PossibleRegleRuleMetadataConsumer<TValue> = {
|
|
1816
1883
|
$value: Maybe<TValue>;
|
|
1817
1884
|
} & DefaultMetadataProperties & {
|
|
1818
|
-
$params?: any[];
|
|
1885
|
+
$params?: [...any[]];
|
|
1819
1886
|
};
|
|
1820
1887
|
/**
|
|
1821
1888
|
* Generic types for a created RegleRule
|
|
1822
1889
|
*/
|
|
1823
|
-
type RegleRuleRaw<TValue extends any = any, TParams extends any[] = [], TAsync extends boolean = boolean, TMetaData extends RegleRuleMetadataDefinition = boolean> = RegleRuleDefinition<TValue, TParams, TAsync, TMetaData> | RegleRuleWithParamsDefinition<TValue, TParams, TAsync, TMetaData>;
|
|
1890
|
+
type RegleRuleRaw<TValue extends any = any, TParams extends [...any[]] = [...any[]], TAsync extends boolean = boolean, TMetaData extends RegleRuleMetadataDefinition = boolean> = RegleRuleDefinition<TValue, TParams, TAsync, TMetaData> | RegleRuleWithParamsDefinition<TValue, TParams, TAsync, TMetaData>;
|
|
1891
|
+
type RegleRuleRawInput<TValue extends any = any, TParams extends [...any[]] = [...any[]], TAsync extends boolean = boolean, TMetaData extends RegleRuleMetadataDefinition = boolean> = Omit<RegleRuleDefinition<TValue, TParams, TAsync, TMetaData> | RegleRuleWithParamsDefinition<TValue, TParams, TAsync, TMetaData>, 'message' | 'tooltip' | 'active'> & {
|
|
1892
|
+
message: any;
|
|
1893
|
+
active?: any;
|
|
1894
|
+
tooltip?: any;
|
|
1895
|
+
};
|
|
1824
1896
|
/**
|
|
1825
1897
|
* Process the type of a created rule with `createRule`.
|
|
1826
1898
|
* For a rule with params it will return a function
|
|
@@ -1872,8 +1944,8 @@ interface CommonComparationOptions {
|
|
|
1872
1944
|
allowEqual?: boolean;
|
|
1873
1945
|
}
|
|
1874
1946
|
type DefaultValidators = {
|
|
1875
|
-
alpha:
|
|
1876
|
-
alphaNum:
|
|
1947
|
+
alpha: RegleRuleWithParamsDefinition<string, [allowSymbols?: boolean | undefined]>;
|
|
1948
|
+
alphaNum: RegleRuleWithParamsDefinition<string | number, [allowSymbols?: boolean | undefined]>;
|
|
1877
1949
|
between: RegleRuleWithParamsDefinition<number, [min: Maybe<number>, max: Maybe<number>]>;
|
|
1878
1950
|
checked: RegleRuleDefinition<boolean, [], false, boolean, boolean>;
|
|
1879
1951
|
contains: RegleRuleWithParamsDefinition<string, [part: Maybe<string>], false, boolean>;
|
|
@@ -1907,7 +1979,7 @@ type DefaultValidators = {
|
|
|
1907
1979
|
], false, boolean>;
|
|
1908
1980
|
exactValue: RegleRuleWithParamsDefinition<number, [count: number], false, boolean>;
|
|
1909
1981
|
integer: RegleRuleDefinition<string | number, [], false, boolean, string | number>;
|
|
1910
|
-
|
|
1982
|
+
ipv4Address: RegleRuleDefinition<string, [], false, boolean, string>;
|
|
1911
1983
|
literal: RegleRuleDefinition<string | number, [literal: string | number], false, boolean, string | number>;
|
|
1912
1984
|
macAddress: RegleRuleWithParamsDefinition<string, [separator?: string | undefined], false, boolean>;
|
|
1913
1985
|
maxLength: RegleRuleWithParamsDefinition<string | any[] | Record<PropertyKey, any>, [
|
|
@@ -1931,11 +2003,12 @@ type DefaultValidators = {
|
|
|
1931
2003
|
};
|
|
1932
2004
|
|
|
1933
2005
|
type CustomRulesDeclarationTree = {
|
|
1934
|
-
[x: string]:
|
|
2006
|
+
[x: string]: RegleRuleRawInput<any, any[], boolean, any> | undefined;
|
|
1935
2007
|
};
|
|
1936
|
-
type
|
|
1937
|
-
[K in keyof DefaultValidators]:
|
|
2008
|
+
type DefaultValidatorsTree = {
|
|
2009
|
+
[K in keyof DefaultValidators]: RegleRuleRawInput<any, any[], boolean, any> | undefined;
|
|
1938
2010
|
};
|
|
2011
|
+
type AllRulesDeclarations = CustomRulesDeclarationTree & DefaultValidatorsTree;
|
|
1939
2012
|
|
|
1940
2013
|
/**
|
|
1941
2014
|
* @public
|
|
@@ -2007,12 +2080,12 @@ type $InternalRegleCollectionRuleDecl = $InternalRegleRuleDecl & {
|
|
|
2007
2080
|
/**
|
|
2008
2081
|
* @public
|
|
2009
2082
|
*/
|
|
2010
|
-
type InlineRuleDeclaration<TValue extends any = any, TParams extends any[] = any[], TReturn extends RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition> =
|
|
2083
|
+
type InlineRuleDeclaration<TValue extends any = any, TParams extends any[] = any[], TReturn extends RegleRuleMetadataDefinition | Promise<RegleRuleMetadataDefinition> = boolean> = (value: Maybe<TValue>, ...args: UnwrapRegleUniversalParams<TParams>) => TReturn;
|
|
2011
2084
|
/**
|
|
2012
2085
|
* @public
|
|
2013
2086
|
* Regroup inline and registered rules
|
|
2014
2087
|
* */
|
|
2015
|
-
type FormRuleDeclaration<TValue extends any, TParams extends 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>;
|
|
2088
|
+
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>;
|
|
2016
2089
|
|
|
2017
2090
|
type RegleErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = {
|
|
2018
2091
|
readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], false>;
|
|
@@ -2041,27 +2114,11 @@ type $InternalRegleErrorTree = {
|
|
|
2041
2114
|
* @internal
|
|
2042
2115
|
*/
|
|
2043
2116
|
type $InternalRegleErrors = $InternalRegleCollectionErrors | string[] | $InternalRegleErrorTree;
|
|
2044
|
-
type PartialFormState<TState extends Record<string, any>> = [unknown] extends [TState] ? {} : Prettify<{
|
|
2045
|
-
[K in keyof TState as ExtendOnlyRealRecord<TState[K]> extends true ? never : TState[K] extends Array<any> ? never : K]?: MaybeOutput<TState[K]>;
|
|
2046
|
-
} & {
|
|
2047
|
-
[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]>;
|
|
2048
|
-
}>;
|
|
2049
|
-
type RegleResult<Data extends Record<string, any> | any[] | unknown, TRules extends ReglePartialRuleTree<any>> = {
|
|
2050
|
-
valid: false;
|
|
2051
|
-
data: 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>;
|
|
2052
|
-
} | {
|
|
2053
|
-
valid: true;
|
|
2054
|
-
data: 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>;
|
|
2055
|
-
};
|
|
2056
|
-
type $InternalRegleResult = {
|
|
2057
|
-
valid: boolean;
|
|
2058
|
-
data: any;
|
|
2059
|
-
};
|
|
2060
2117
|
|
|
2061
2118
|
/**
|
|
2062
2119
|
* @public
|
|
2063
2120
|
*/
|
|
2064
|
-
type RegleRoot<TState extends Record<string, any> =
|
|
2121
|
+
type RegleRoot<TState extends Record<string, any> = {}, TRules extends ReglePartialRuleTree<TState> = Record<string, any>, TValidationGroups extends Record<string, RegleValidationGroupEntry[]> = never, TShortcuts extends RegleShortcutDefinition = {}> = MaybeVariantStatus<TState, TRules, TShortcuts> & ([TValidationGroups] extends [never] ? {} : {
|
|
2065
2122
|
/**
|
|
2066
2123
|
* Collection of validation groups used declared with the `validationGroups` modifier
|
|
2067
2124
|
*/
|
|
@@ -2069,61 +2126,15 @@ type RegleRoot<TState extends Record<string, any> = Record<string, any>, TRules
|
|
|
2069
2126
|
readonly [TKey in keyof TValidationGroups]: RegleValidationGroupOutput;
|
|
2070
2127
|
};
|
|
2071
2128
|
});
|
|
2072
|
-
/** Supports both core Regle and schemas Regle for Zod/Valibot */
|
|
2073
|
-
type SuperCompatibleRegleRoot = SuperCompatibleRegleStatus & {
|
|
2074
|
-
$groups?: {
|
|
2075
|
-
[x: string]: RegleValidationGroupOutput;
|
|
2076
|
-
};
|
|
2077
|
-
$validate: () => Promise<SuperCompatibleRegleResult>;
|
|
2078
|
-
};
|
|
2079
|
-
type ScopedInstancesRecord = Record<string, Record<string, SuperCompatibleRegleRoot>> & {
|
|
2080
|
-
'~~global': Record<string, SuperCompatibleRegleRoot>;
|
|
2081
|
-
};
|
|
2082
|
-
type ScopedInstancesRecordLike = Partial<ScopedInstancesRecord>;
|
|
2083
|
-
type SuperCompatibleRegleResult = $InternalRegleResult;
|
|
2084
|
-
interface SuperCompatibleRegleStatus extends SuperCompatibleRegleCommonStatus {
|
|
2085
|
-
$fields: {
|
|
2086
|
-
[x: string]: unknown;
|
|
2087
|
-
};
|
|
2088
|
-
readonly $errors: Record<string, RegleValidationErrors<any, false>>;
|
|
2089
|
-
readonly $silentErrors: Record<string, RegleValidationErrors<any, false>>;
|
|
2090
|
-
$extractDirtyFields: (filterNullishValues?: boolean) => Record<string, any>;
|
|
2091
|
-
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2092
|
-
}
|
|
2093
|
-
type SuperCompatibleRegleRuleStatus = Omit<$InternalRegleRuleStatus, '$haveAsync' | '$validating' | '$fieldDirty' | '$fieldInvalid' | '$fieldPending' | '$fieldCorrect' | '$fieldError' | '$unwatch' | '$watch'>;
|
|
2094
|
-
type SuperCompatibleRegleCommonStatus = Omit<RegleCommonStatus, '$pending'> & {
|
|
2095
|
-
$pending?: boolean;
|
|
2096
|
-
};
|
|
2097
|
-
interface SuperCompatibleRegleFieldStatus extends SuperCompatibleRegleCommonStatus {
|
|
2098
|
-
$value: any;
|
|
2099
|
-
$silentValue: any;
|
|
2100
|
-
readonly $rules: Record<string, SuperCompatibleRegleRuleStatus>;
|
|
2101
|
-
readonly $externalErrors?: string[];
|
|
2102
|
-
readonly $errors: string[];
|
|
2103
|
-
readonly $inactive: boolean;
|
|
2104
|
-
readonly $silentErrors: string[];
|
|
2105
|
-
$extractDirtyFields: (filterNullishValues?: boolean) => any;
|
|
2106
|
-
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2107
|
-
}
|
|
2108
|
-
interface SuperCompatibleRegleCollectionStatus extends Omit<SuperCompatibleRegleStatus, '$fields' | '$errors' | '$silentErrors'> {
|
|
2109
|
-
readonly $self: SuperCompatibleRegleFieldStatus;
|
|
2110
|
-
readonly $each: Array<SuperCompatibleRegleStatus | SuperCompatibleRegleFieldStatus>;
|
|
2111
|
-
readonly $errors: SuperCompatibleRegleCollectionErrors;
|
|
2112
|
-
readonly $silentErrors: SuperCompatibleRegleCollectionErrors;
|
|
2113
|
-
readonly $externalErrors?: string[];
|
|
2114
|
-
$extractDirtyFields: (filterNullishValues?: boolean) => any[];
|
|
2115
|
-
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2116
|
-
}
|
|
2117
|
-
type SuperCompatibleRegleCollectionErrors = $InternalRegleCollectionErrors;
|
|
2118
2129
|
/**
|
|
2119
2130
|
* @public
|
|
2120
2131
|
*/
|
|
2121
2132
|
type RegleStatus<TState extends Record<string, any> | undefined = Record<string, any>, TRules extends ReglePartialRuleTree<NonNullable<TState>> = Record<string, any>, TShortcuts extends RegleShortcutDefinition = {}> = RegleCommonStatus<TState> & {
|
|
2122
2133
|
/** 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. */
|
|
2123
2134
|
readonly $fields: {
|
|
2124
|
-
readonly [TKey in keyof TState as IsEmptyObject<TRules[TKey]> extends true ? never : TKey]: InferRegleStatusType<NonNullable<TRules[TKey]>, NonNullable<TState>, TKey, TShortcuts>;
|
|
2135
|
+
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>;
|
|
2125
2136
|
} & {
|
|
2126
|
-
readonly [TKey in keyof TState as TRules[TKey] extends NonNullable<TRules[TKey]> ? NonNullable<TRules[TKey]> extends RegleRuleDecl ? IsEmptyObject<TRules[TKey]> extends true ?
|
|
2137
|
+
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>;
|
|
2127
2138
|
};
|
|
2128
2139
|
/**
|
|
2129
2140
|
* Collection of all the error messages, collected for all children properties and nested forms.
|
|
@@ -2135,7 +2146,7 @@ type RegleStatus<TState extends Record<string, any> | undefined = Record<string,
|
|
|
2135
2146
|
/** 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). */
|
|
2136
2147
|
$extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
|
|
2137
2148
|
/** 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). */
|
|
2138
|
-
$validate: () => Promise<RegleResult<TState
|
|
2149
|
+
$validate: () => Promise<RegleResult<JoinDiscriminatedUnions<TState>, TRules>>;
|
|
2139
2150
|
} & ([TShortcuts['nested']] extends [never] ? {} : {
|
|
2140
2151
|
[K in keyof TShortcuts['nested']]: ReturnType<NonNullable<TShortcuts['nested']>[K]>;
|
|
2141
2152
|
});
|
|
@@ -2155,7 +2166,7 @@ interface $InternalRegleStatus extends $InternalRegleCommonStatus {
|
|
|
2155
2166
|
/**
|
|
2156
2167
|
* @public
|
|
2157
2168
|
*/
|
|
2158
|
-
type InferRegleStatusType<TRule extends RegleCollectionRuleDecl | RegleRuleDecl | ReglePartialRuleTree<any>, TState extends Record<PropertyKey, any> = any, TKey extends PropertyKey = string, TShortcuts extends RegleShortcutDefinition = {}> = NonNullable<TState[TKey]> extends Array<infer U extends Record<string, any>> ? ExtendOnlyRealRecord<U> extends true ? TRule extends RegleCollectionRuleDefinition<any, any> ? ExtractFromGetter<TRule['$each']> extends ReglePartialRuleTree<any> ? RegleCollectionStatus<TState[TKey], ExtractFromGetter<TRule['$each']>, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : RegleCollectionStatus<TState[TKey], {}, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : TRule extends ReglePartialRuleTree<any> ? NonNullable<TState[TKey]> extends Array<any> ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? MaybeVariantStatus<TState[TKey], TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? MaybeVariantStatus<TState[TKey], ReglePartialRuleTree<TState[TKey]>, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts>;
|
|
2169
|
+
type InferRegleStatusType<TRule extends RegleCollectionRuleDecl | RegleRuleDecl | ReglePartialRuleTree<any>, TState extends Record<PropertyKey, any> = any, TKey extends PropertyKey = string, TShortcuts extends RegleShortcutDefinition = {}> = [TState[TKey]] extends [undefined] ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Array<infer U extends Record<string, any>> ? ExtendOnlyRealRecord<U> extends true ? TRule extends RegleCollectionRuleDefinition<any, any> ? ExtractFromGetter<TRule['$each']> extends ReglePartialRuleTree<any> ? RegleCollectionStatus<TState[TKey], ExtractFromGetter<TRule['$each']>, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : RegleCollectionStatus<TState[TKey], {}, TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : TRule extends ReglePartialRuleTree<any> ? NonNullable<TState[TKey]> extends Array<any> ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? MaybeVariantStatus<TState[TKey], TRule, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Date | File ? RegleFieldStatus<TState[TKey], TRule, TShortcuts> : NonNullable<TState[TKey]> extends Record<PropertyKey, any> ? MaybeVariantStatus<TState[TKey], ReglePartialRuleTree<TState[TKey]>, TShortcuts> : RegleFieldStatus<TState[TKey], TRule, TShortcuts>;
|
|
2159
2170
|
/**
|
|
2160
2171
|
* @internal
|
|
2161
2172
|
* @reference {@link InferRegleStatusType}
|
|
@@ -2186,7 +2197,9 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
|
|
|
2186
2197
|
/** 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). */
|
|
2187
2198
|
$validate: () => Promise<RegleResult<TState, TRules>>;
|
|
2188
2199
|
/** This is reactive tree containing all the declared rules of your field. To know more about the rule properties check the rules properties section */
|
|
2189
|
-
readonly $rules: {
|
|
2200
|
+
readonly $rules: IsEmptyObject<TRules> extends true ? {
|
|
2201
|
+
readonly [x: string]: RegleRuleStatus<TState, any[], any>;
|
|
2202
|
+
} : {
|
|
2190
2203
|
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>;
|
|
2191
2204
|
};
|
|
2192
2205
|
} & ([TShortcuts['fields']] extends [never] ? {} : {
|
|
@@ -2261,7 +2274,7 @@ interface $InternalRegleCommonStatus extends Omit<RegleCommonStatus, '$touch' |
|
|
|
2261
2274
|
/**
|
|
2262
2275
|
* @public
|
|
2263
2276
|
*/
|
|
2264
|
-
type RegleRuleStatus<TValue = any, TParams extends any[] = any[], TMetadata extends RegleRuleMetadataDefinition =
|
|
2277
|
+
type RegleRuleStatus<TValue = any, TParams extends any[] = any[], TMetadata extends RegleRuleMetadataDefinition = boolean> = {
|
|
2265
2278
|
/** The name of the rule type. */
|
|
2266
2279
|
readonly $type: string;
|
|
2267
2280
|
/** Returns the computed error message or messages for the current rule. */
|
|
@@ -2338,7 +2351,7 @@ type RegleCollectionStatus<TState extends any[] = any[], TRules extends ReglePar
|
|
|
2338
2351
|
/** 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). */
|
|
2339
2352
|
$extractDirtyFields: (filterNullishValues?: boolean) => PartialDeep<TState>;
|
|
2340
2353
|
/** 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). */
|
|
2341
|
-
$validate: () => Promise<RegleResult<TState
|
|
2354
|
+
$validate: () => Promise<RegleResult<JoinDiscriminatedUnions<TState>, JoinDiscriminatedUnions<TRules>>>;
|
|
2342
2355
|
} & ([TShortcuts['collections']] extends [never] ? {} : {
|
|
2343
2356
|
[K in keyof TShortcuts['collections']]: ReturnType<NonNullable<TShortcuts['collections']>[K]>;
|
|
2344
2357
|
});
|
|
@@ -2356,6 +2369,49 @@ interface $InternalRegleCollectionStatus extends Omit<$InternalRegleStatus, '$fi
|
|
|
2356
2369
|
$validate: () => Promise<$InternalRegleResult>;
|
|
2357
2370
|
}
|
|
2358
2371
|
|
|
2372
|
+
/** Supports both core Regle and schemas Regle for Zod/Valibot */
|
|
2373
|
+
type SuperCompatibleRegleRoot = SuperCompatibleRegleStatus & {
|
|
2374
|
+
$groups?: {
|
|
2375
|
+
[x: string]: RegleValidationGroupOutput;
|
|
2376
|
+
};
|
|
2377
|
+
$validate: () => Promise<SuperCompatibleRegleResult>;
|
|
2378
|
+
};
|
|
2379
|
+
type SuperCompatibleRegleResult = $InternalRegleResult;
|
|
2380
|
+
interface SuperCompatibleRegleStatus extends SuperCompatibleRegleCommonStatus {
|
|
2381
|
+
$fields: {
|
|
2382
|
+
[x: string]: unknown;
|
|
2383
|
+
};
|
|
2384
|
+
readonly $errors: Record<string, RegleValidationErrors<any, false>>;
|
|
2385
|
+
readonly $silentErrors: Record<string, RegleValidationErrors<any, false>>;
|
|
2386
|
+
$extractDirtyFields: (filterNullishValues?: boolean) => Record<string, any>;
|
|
2387
|
+
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2388
|
+
}
|
|
2389
|
+
type SuperCompatibleRegleRuleStatus = Omit<$InternalRegleRuleStatus, '$haveAsync' | '$validating' | '$fieldDirty' | '$fieldInvalid' | '$fieldPending' | '$fieldCorrect' | '$fieldError' | '$unwatch' | '$watch'>;
|
|
2390
|
+
type SuperCompatibleRegleCommonStatus = Omit<RegleCommonStatus, '$pending'> & {
|
|
2391
|
+
$pending?: boolean;
|
|
2392
|
+
};
|
|
2393
|
+
interface SuperCompatibleRegleFieldStatus extends SuperCompatibleRegleCommonStatus {
|
|
2394
|
+
$value: any;
|
|
2395
|
+
$silentValue: any;
|
|
2396
|
+
readonly $rules: Record<string, SuperCompatibleRegleRuleStatus>;
|
|
2397
|
+
readonly $externalErrors?: string[];
|
|
2398
|
+
readonly $errors: string[];
|
|
2399
|
+
readonly $inactive: boolean;
|
|
2400
|
+
readonly $silentErrors: string[];
|
|
2401
|
+
$extractDirtyFields: (filterNullishValues?: boolean) => any;
|
|
2402
|
+
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2403
|
+
}
|
|
2404
|
+
interface SuperCompatibleRegleCollectionStatus extends Omit<SuperCompatibleRegleStatus, '$fields' | '$errors' | '$silentErrors'> {
|
|
2405
|
+
readonly $self: SuperCompatibleRegleFieldStatus;
|
|
2406
|
+
readonly $each: Array<SuperCompatibleRegleStatus | SuperCompatibleRegleFieldStatus>;
|
|
2407
|
+
readonly $errors: SuperCompatibleRegleCollectionErrors;
|
|
2408
|
+
readonly $silentErrors: SuperCompatibleRegleCollectionErrors;
|
|
2409
|
+
readonly $externalErrors?: string[];
|
|
2410
|
+
$extractDirtyFields: (filterNullishValues?: boolean) => any[];
|
|
2411
|
+
$validate?: () => Promise<SuperCompatibleRegleResult>;
|
|
2412
|
+
}
|
|
2413
|
+
type SuperCompatibleRegleCollectionErrors = $InternalRegleCollectionErrors;
|
|
2414
|
+
|
|
2359
2415
|
/**
|
|
2360
2416
|
* Create a typed custom rule that can be used like default rules.
|
|
2361
2417
|
* It can also be declared in the global options
|
|
@@ -2418,6 +2474,22 @@ declare function defineRegleConfig<TShortcuts extends RegleShortcutDefinition<TC
|
|
|
2418
2474
|
useRegle: useRegleFn<TCustomRules, TShortcuts>;
|
|
2419
2475
|
inferRules: inferRulesFn<TCustomRules>;
|
|
2420
2476
|
};
|
|
2477
|
+
/**
|
|
2478
|
+
* Extend an already created custom `useRegle` (as the first parameter)
|
|
2479
|
+
*
|
|
2480
|
+
* It will return:
|
|
2481
|
+
*
|
|
2482
|
+
* - a `useRegle` composable that can typecheck your custom rules
|
|
2483
|
+
* - an `inferRules` helper that can typecheck your custom rules
|
|
2484
|
+
*/
|
|
2485
|
+
declare function extendRegleConfig<TRootCustomRules extends Partial<AllRulesDeclarations>, TRootShortcuts extends RegleShortcutDefinition<{}>, TShortcuts extends RegleShortcutDefinition<Merge<TRootCustomRules, TCustomRules>>, TCustomRules extends Partial<AllRulesDeclarations>>(regle: useRegleFn<TRootCustomRules, TRootShortcuts>, { rules, modifiers, shortcuts, }: {
|
|
2486
|
+
rules?: () => TCustomRules;
|
|
2487
|
+
modifiers?: RegleBehaviourOptions;
|
|
2488
|
+
shortcuts?: TShortcuts;
|
|
2489
|
+
}): {
|
|
2490
|
+
useRegle: useRegleFn<Merge<TRootCustomRules, TCustomRules>, TRootShortcuts & TShortcuts>;
|
|
2491
|
+
inferRules: inferRulesFn<Merge<TRootCustomRules, TCustomRules>>;
|
|
2492
|
+
};
|
|
2421
2493
|
|
|
2422
2494
|
type MergedRegles<TRegles extends Record<string, SuperCompatibleRegleRoot>, TValue = {
|
|
2423
2495
|
[K in keyof TRegles]: TRegles[K]['$value'];
|
|
@@ -2501,36 +2573,22 @@ declare const useScopedRegle: useRegleFn<Partial<AllRulesDeclarations>, never, {
|
|
|
2501
2573
|
namespace?: MaybeRefOrGetter<string>;
|
|
2502
2574
|
}>;
|
|
2503
2575
|
|
|
2504
|
-
type PossibleLiteralTypes<T extends Record<string, any>, TKey extends keyof T> = {
|
|
2505
|
-
[TVal in NonNullable<T[TKey]>]: {
|
|
2506
|
-
[K in TKey]-?: Omit<RegleRuleDecl<TVal, Partial<AllRulesDeclarations>>, 'literal'> & {
|
|
2507
|
-
literal?: RegleRuleDefinition<TVal, [literal: TVal], false, boolean, string | number>;
|
|
2508
|
-
};
|
|
2509
|
-
};
|
|
2510
|
-
};
|
|
2511
|
-
type RequiredForm<T extends Record<string, any>, TKey extends keyof T> = Omit<ReglePartialRuleTree<T>, TKey> & PossibleLiteralTypes<T, TKey>[keyof PossibleLiteralTypes<T, TKey>];
|
|
2512
|
-
type Variant1<T extends Record<string, any>, TKey extends keyof T> = [
|
|
2513
|
-
RequiredForm<T, TKey>,
|
|
2514
|
-
...RequiredForm<T, TKey>[]
|
|
2515
|
-
];
|
|
2516
2576
|
/**
|
|
2517
2577
|
*
|
|
2518
2578
|
* Autocomplete may not work here because of https://github.com/microsoft/TypeScript/issues/49547
|
|
2519
2579
|
*/
|
|
2520
|
-
declare function createVariant<
|
|
2521
|
-
declare function
|
|
2580
|
+
declare function createVariant<TForm extends Record<string, any>, TDiscriminant extends keyof JoinDiscriminatedUnions<TForm>, TVariants extends VariantTuple<JoinDiscriminatedUnions<TForm>, TDiscriminant>>(root: MaybeRefOrGetter<TForm> | DeepReactiveState<TForm>, disciminantKey: TDiscriminant, variants: [...TVariants]): Ref<TVariants[number]>;
|
|
2581
|
+
declare function narrowVariant<TRoot extends {
|
|
2522
2582
|
[x: string]: unknown;
|
|
2523
|
-
}, TKey extends keyof TRoot, const TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot[TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
|
|
2583
|
+
}, const TKey extends keyof TRoot, const TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot[TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
|
|
2524
2584
|
$value: infer V;
|
|
2525
2585
|
} ? V : unknown>(root: TRoot, discriminantKey: TKey, discriminantValue: TValue): root is Extract<TRoot, {
|
|
2526
2586
|
[K in TKey]: RegleFieldStatus<TValue, any, any>;
|
|
2527
2587
|
}>;
|
|
2528
|
-
declare function
|
|
2529
|
-
[x: string]: unknown;
|
|
2530
|
-
}, TKey extends keyof TRoot, const TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot[TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
|
|
2588
|
+
declare function variantToRef<TRoot extends RegleStatus<{}, any, any>, const TKey extends keyof TRoot['$fields'], const TValue extends LazyJoinDiscriminatedUnions<Exclude<TRoot['$fields'][TKey], RegleCollectionStatus<any, any, any> | RegleStatus<any, any, any>>> extends {
|
|
2531
2589
|
$value: infer V;
|
|
2532
|
-
} ? V : unknown>(root: TRoot
|
|
2590
|
+
} ? V : unknown>(root: MaybeRef<TRoot>, discriminantKey: TKey, discriminantValue: TValue): Ref<Extract<TRoot['$fields'], {
|
|
2533
2591
|
[K in TKey]: RegleFieldStatus<TValue, any, any>;
|
|
2534
|
-
}
|
|
2592
|
+
}> | undefined>;
|
|
2535
2593
|
|
|
2536
|
-
export { type $InternalRegleStatus, type AllRulesDeclarations, type CommonComparationOptions, type DeepMaybeRef, type DeepReactiveState, type FormRuleDeclaration, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MaybeVariantStatus, type MergedRegles, type
|
|
2594
|
+
export { type $InternalRegleStatus, type AllRulesDeclarations, type CommonComparationOptions, type DeepMaybeRef, type DeepReactiveState, type DefaultValidatorsTree, type FormRuleDeclaration, type InferRegleRoot, type InferRegleRule, type InferRegleRules, type InferRegleShortcuts, type InferRegleStatusType, type InferSafeOutput, type InlineRuleDeclaration, InternalRuleType, type JoinDiscriminatedUnions, type LocalRegleBehaviourOptions, type Maybe, type MaybeInput, type MaybeOutput, type MaybeVariantStatus, type MergedRegles, type NarrowVariant, type NoInferLegacy, type PrimitiveTypes, type Regle, type RegleBehaviourOptions, type RegleCollectionErrors, type RegleCollectionRuleDecl, type RegleCollectionRuleDefinition, type RegleCollectionStatus, type RegleCommonStatus, type RegleComputedRules, type RegleEnforceCustomRequiredRules, type RegleEnforceRequiredRules, type RegleErrorTree, type RegleExternalCollectionErrors, type RegleExternalErrorTree, type RegleFieldStatus, type RegleFormPropertyType, type RegleInternalRuleDefs, type ReglePartialRuleTree, type RegleResult, type RegleRoot, type RegleRuleCore, type RegleRuleDecl, type RegleRuleDefinition, type RegleRuleDefinitionProcessor, type RegleRuleDefinitionWithMetadataProcessor, type RegleRuleInit, type RegleRuleMetadataConsumer, type RegleRuleMetadataDefinition, type RegleRuleMetadataExtended, type RegleRuleRaw, type RegleRuleStatus, type RegleRuleTypeReturn, type RegleRuleWithParamsDefinition, type RegleShortcutDefinition, type RegleSingleField, type RegleStatus, type RegleUniversalParams, type RegleValidationErrors, type RegleValidationGroupEntry, type RegleValidationGroupOutput, type RegleRuleTree as RegleValidationTree, type ResolvedRegleBehaviourOptions, type ScopedInstancesRecord, type ScopedInstancesRecordLike, type SuperCompatibleRegleCollectionErrors, type SuperCompatibleRegleCollectionStatus, type SuperCompatibleRegleFieldStatus, type SuperCompatibleRegleResult, type SuperCompatibleRegleRoot, type SuperCompatibleRegleRuleStatus, type SuperCompatibleRegleStatus, type Unwrap, type UnwrapRegleUniversalParams, type UnwrapRuleWithParams, createRule, createScopedUseRegle, createVariant, defineRegleConfig, extendRegleConfig, flatErrors, inferRules, mergeRegles, narrowVariant, unwrapRuleParameters, useCollectScope, useRegle, useRootStorage, useScopedRegle, variantToRef };
|