@regle/core 1.9.3 → 1.9.5
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 +3 -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;
|
|
@@ -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
|
|
@@ -2340,7 +2283,8 @@ type RegleErrorTree<TState = MaybeRef<Record<string, any> | any[]>, TIssue exten
|
|
|
2340
2283
|
type RegleIssuesTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], false, true> };
|
|
2341
2284
|
type RegleExternalErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]?: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], true> };
|
|
2342
2285
|
type RegleExternalSchemaErrorTree<TState = MaybeRef<Record<string, any> | any[]>> = { readonly [K in keyof JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>]?: RegleValidationErrors<JoinDiscriminatedUnions<UnwrapMaybeRef<TState>>[K], true, true> };
|
|
2343
|
-
type
|
|
2286
|
+
type ErrorMessageOrIssue<TIssue extends boolean> = TIssue extends true ? RegleFieldIssue[] : string[];
|
|
2287
|
+
type RegleValidationErrors<TState extends Record<string, any> | any[] | unknown = never, TExternal extends boolean = false, TIssue extends boolean = false> = HasNamedKeys<TState> extends true ? IsAny<TState> extends true ? any : NonNullable<TState> extends Array<infer U> ? U extends Record<string, any> ? TExternal extends false ? ExtendOnlyRealRecord<U> extends true ? RegleCollectionErrors<U, TIssue> : ErrorMessageOrIssue<TIssue> : RegleExternalCollectionErrors<U, TIssue> : ErrorMessageOrIssue<TIssue> : NonNullable<TState> extends Date | File ? ErrorMessageOrIssue<TIssue> : NonNullable<TState> extends Record<string, any> ? TExternal extends false ? RegleErrorTree<TState, TIssue> : RegleExternalErrorTree<TState> : ErrorMessageOrIssue<TIssue> : any;
|
|
2344
2288
|
type RegleCollectionErrors<TState extends Record<string, any>, TIssue extends boolean = false> = {
|
|
2345
2289
|
readonly $self: TIssue extends true ? RegleFieldIssue[] : string[];
|
|
2346
2290
|
readonly $each: RegleValidationErrors<TState, false, TIssue>[];
|