@regle/core 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-core.d.ts +2 -59
- package/package.json +1 -1
package/dist/regle-core.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as vue0 from "vue";
|
|
2
2
|
import { MaybeRef, MaybeRefOrGetter, Raw, Ref, UnwrapNestedRefs, UnwrapRef } from "vue";
|
|
3
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
4
|
|
|
4
5
|
//#region src/types/utils/misc.types.d.ts
|
|
5
6
|
type Prettify<T> = T extends infer R ? { [K in keyof R]: R[K] } & {} : never;
|
|
@@ -1453,7 +1454,7 @@ type NarrowVariant<TRoot extends {
|
|
|
1453
1454
|
} ? V : unknown)> = Extract<TRoot, { [K in TKey]: RegleFieldStatus<TValue, any, any> | RegleFieldStatus<MaybeInput<TValue>, any, any> }> & {
|
|
1454
1455
|
$fields: Extract<TRoot['$fields'], { [K in TKey]: RegleFieldStatus<TValue, any, any> | RegleFieldStatus<MaybeInput<TValue>, any, any> }>;
|
|
1455
1456
|
};
|
|
1456
|
-
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'
|
|
1457
|
+
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'> & {
|
|
1457
1458
|
$fields: ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>];
|
|
1458
1459
|
} & (HasNamedKeys<TState> extends true ? ProcessChildrenFields<TState, TRules, TShortcuts>[keyof ProcessChildrenFields<TState, TRules, TShortcuts>] : {}) : RegleStatus<TState, TRules, TShortcuts>;
|
|
1459
1460
|
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 : EmptyObject> 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 : EmptyObject, 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 : EmptyObject> 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 : EmptyObject, NonNullable<UnionToTuple<TState>[TIndexInt]>, TKey, TShortcuts> } : {} };
|
|
@@ -1539,64 +1540,6 @@ declare function useRootStorage({
|
|
|
1539
1540
|
regle: $InternalRegleStatusType | undefined;
|
|
1540
1541
|
};
|
|
1541
1542
|
//#endregion
|
|
1542
|
-
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
1543
|
-
/** The Standard Schema interface. */
|
|
1544
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
1545
|
-
/** The Standard Schema properties. */
|
|
1546
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
1547
|
-
}
|
|
1548
|
-
declare namespace StandardSchemaV1 {
|
|
1549
|
-
/** The Standard Schema properties interface. */
|
|
1550
|
-
export interface Props<Input = unknown, Output = Input> {
|
|
1551
|
-
/** The version number of the standard. */
|
|
1552
|
-
readonly version: 1;
|
|
1553
|
-
/** The vendor name of the schema library. */
|
|
1554
|
-
readonly vendor: string;
|
|
1555
|
-
/** Validates unknown input values. */
|
|
1556
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
1557
|
-
/** Inferred types associated with the schema. */
|
|
1558
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
1559
|
-
}
|
|
1560
|
-
/** The result interface of the validate function. */
|
|
1561
|
-
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
1562
|
-
/** The result interface if validation succeeds. */
|
|
1563
|
-
export interface SuccessResult<Output> {
|
|
1564
|
-
/** The typed output value. */
|
|
1565
|
-
readonly value: Output;
|
|
1566
|
-
/** The non-existent issues. */
|
|
1567
|
-
readonly issues?: undefined;
|
|
1568
|
-
}
|
|
1569
|
-
/** The result interface if validation fails. */
|
|
1570
|
-
export interface FailureResult {
|
|
1571
|
-
/** The issues of failed validation. */
|
|
1572
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
1573
|
-
}
|
|
1574
|
-
/** The issue interface of the failure output. */
|
|
1575
|
-
export interface Issue {
|
|
1576
|
-
/** The error message of the issue. */
|
|
1577
|
-
readonly message: string;
|
|
1578
|
-
/** The path of the issue, if any. */
|
|
1579
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
1580
|
-
}
|
|
1581
|
-
/** The path segment interface of the issue. */
|
|
1582
|
-
export interface PathSegment {
|
|
1583
|
-
/** The key representing a path segment. */
|
|
1584
|
-
readonly key: PropertyKey;
|
|
1585
|
-
}
|
|
1586
|
-
/** The Standard Schema types interface. */
|
|
1587
|
-
export interface Types<Input = unknown, Output = Input> {
|
|
1588
|
-
/** The input type of the schema. */
|
|
1589
|
-
readonly input: Input;
|
|
1590
|
-
/** The output type of the schema. */
|
|
1591
|
-
readonly output: Output;
|
|
1592
|
-
}
|
|
1593
|
-
/** Infers the input type of a Standard Schema. */
|
|
1594
|
-
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
1595
|
-
/** Infers the output type of a Standard Schema. */
|
|
1596
|
-
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
1597
|
-
export {};
|
|
1598
|
-
}
|
|
1599
|
-
//#endregion
|
|
1600
1543
|
//#region src/core/useRegle/useErrors.d.ts
|
|
1601
1544
|
/**
|
|
1602
1545
|
* Converts a nested $errors object to a flat array of string errors
|