@regle/schemas 1.9.2 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/regle-schemas.d.ts +2 -68
- package/package.json +3 -3
package/dist/regle-schemas.d.ts
CHANGED
|
@@ -1431,7 +1431,7 @@ type IsUnion<T> = Not<Extends<UnionToTuple$1<T>['length'], 1>>;
|
|
|
1431
1431
|
//#endregion
|
|
1432
1432
|
//#region src/types/core/variants.types.d.ts
|
|
1433
1433
|
|
|
1434
|
-
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'
|
|
1434
|
+
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'> & {
|
|
1435
1435
|
$fields: ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>];
|
|
1436
1436
|
} & (HasNamedKeys<TState> extends true ? ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>] : {}) : RegleStatus<TState, TRules, TShortcuts>;
|
|
1437
1437
|
type ProcessChildrenFields<TState extends Record<string, any> | undefined, TRules extends ReglePartialRuleTree<NonNullable<TState>>, TShortcuts extends RegleShortcutDefinition = {}> = { [TIndex in keyof TupleToPlainObj<UnionToTuple<TState>>]: TIndex extends `${infer TIndexInt extends number}` ? { [TKey in keyof UnionToTuple<TState>[TIndexInt] as IsEmptyObject<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1> extends true ? TKey extends keyof TState ? TState[TKey] extends NonNullable<TState[TKey]> ? TKey : never : never : TKey]-?: InferRegleStatusType<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1, NonNullable<UnionToTuple<TState>[TIndexInt]>, TKey, TShortcuts> } & { [TKey in keyof UnionToTuple<TState>[TIndexInt] as IsEmptyObject<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1> extends true ? TKey extends keyof TState ? TState[TKey] extends NonNullable<TState[TKey]> ? never : TKey : TKey : never]?: InferRegleStatusType<FindCorrespondingVariant<UnionToTuple<TState>[TIndexInt] extends Record<string, any> ? UnionToTuple<TState>[TIndexInt] : never, UnionToTuple<TRules>> extends [infer U] ? TKey extends keyof U ? U[TKey] : EmptyObject$1 : EmptyObject$1, NonNullable<UnionToTuple<TState>[TIndexInt]>, TKey, TShortcuts> } : {} };
|
|
@@ -1467,72 +1467,6 @@ interface useRegleFn<TCustomRules extends Partial<AllRulesDeclarations>, TShortc
|
|
|
1467
1467
|
* Docs: {@link https://reglejs.dev/core-concepts/}
|
|
1468
1468
|
*/
|
|
1469
1469
|
|
|
1470
|
-
//#endregion
|
|
1471
|
-
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
1472
|
-
/** The Standard Schema interface. */
|
|
1473
|
-
interface StandardSchemaV1$1<Input = unknown, Output = Input> {
|
|
1474
|
-
/** The Standard Schema properties. */
|
|
1475
|
-
readonly "~standard": StandardSchemaV1$1.Props<Input, Output>;
|
|
1476
|
-
}
|
|
1477
|
-
declare namespace StandardSchemaV1$1 {
|
|
1478
|
-
/** The Standard Schema properties interface. */
|
|
1479
|
-
export interface Props<Input = unknown, Output = Input> {
|
|
1480
|
-
/** The version number of the standard. */
|
|
1481
|
-
readonly version: 1;
|
|
1482
|
-
/** The vendor name of the schema library. */
|
|
1483
|
-
readonly vendor: string;
|
|
1484
|
-
/** Validates unknown input values. */
|
|
1485
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
1486
|
-
/** Inferred types associated with the schema. */
|
|
1487
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
1488
|
-
}
|
|
1489
|
-
/** The result interface of the validate function. */
|
|
1490
|
-
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1491
|
-
/** The result interface if validation succeeds. */
|
|
1492
|
-
export interface SuccessResult<Output> {
|
|
1493
|
-
/** The typed output value. */
|
|
1494
|
-
readonly value: Output;
|
|
1495
|
-
/** The non-existent issues. */
|
|
1496
|
-
readonly issues?: undefined;
|
|
1497
|
-
}
|
|
1498
|
-
/** The result interface if validation fails. */
|
|
1499
|
-
export interface FailureResult {
|
|
1500
|
-
/** The issues of failed validation. */
|
|
1501
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
1502
|
-
}
|
|
1503
|
-
/** The issue interface of the failure output. */
|
|
1504
|
-
export interface Issue {
|
|
1505
|
-
/** The error message of the issue. */
|
|
1506
|
-
readonly message: string;
|
|
1507
|
-
/** The path of the issue, if any. */
|
|
1508
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1509
|
-
}
|
|
1510
|
-
/** The path segment interface of the issue. */
|
|
1511
|
-
export interface PathSegment {
|
|
1512
|
-
/** The key representing a path segment. */
|
|
1513
|
-
readonly key: PropertyKey;
|
|
1514
|
-
}
|
|
1515
|
-
/** The Standard Schema types interface. */
|
|
1516
|
-
export interface Types<Input = unknown, Output = Input> {
|
|
1517
|
-
/** The input type of the schema. */
|
|
1518
|
-
readonly input: Input;
|
|
1519
|
-
/** The output type of the schema. */
|
|
1520
|
-
readonly output: Output;
|
|
1521
|
-
}
|
|
1522
|
-
/** Infers the input type of a Standard Schema. */
|
|
1523
|
-
export type InferInput<Schema extends StandardSchemaV1$1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
1524
|
-
/** Infers the output type of a Standard Schema. */
|
|
1525
|
-
export type InferOutput<Schema extends StandardSchemaV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
1526
|
-
export {};
|
|
1527
|
-
}
|
|
1528
|
-
//#endregion
|
|
1529
|
-
//#region src/core/useRegle/useErrors.d.ts
|
|
1530
|
-
/**
|
|
1531
|
-
* Converts a nested $errors object to a flat array of string errors
|
|
1532
|
-
*
|
|
1533
|
-
* Can also flatten to an array containing the path of each error with the options.includePath
|
|
1534
|
-
*/
|
|
1535
|
-
|
|
1536
1470
|
//#endregion
|
|
1537
1471
|
//#region src/types/utils/mismatch.types.d.ts
|
|
1538
1472
|
/**
|
|
@@ -1959,7 +1893,7 @@ type RegleFieldStatus<TState extends any = any, TRules extends RegleFormProperty
|
|
|
1959
1893
|
/**
|
|
1960
1894
|
* @public
|
|
1961
1895
|
*/
|
|
1962
|
-
interface RegleCommonStatus<TValue = any> extends StandardSchemaV1
|
|
1896
|
+
interface RegleCommonStatus<TValue = any> extends StandardSchemaV1<TValue> {
|
|
1963
1897
|
/** Indicates whether the field is invalid. It becomes true if any associated rules return false. */
|
|
1964
1898
|
readonly $invalid: boolean;
|
|
1965
1899
|
/**
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regle/schemas",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "Schemas adapter for Regle",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@standard-schema/spec": "1.0.0",
|
|
7
|
-
"@regle/core": "1.9.
|
|
8
|
-
"@regle/rules": "1.9.
|
|
7
|
+
"@regle/core": "1.9.4",
|
|
8
|
+
"@regle/rules": "1.9.4"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"valibot": "^1.0.0",
|