@jfdevelops/multi-step-form-core 1.0.0-alpha.15 → 1.0.0-alpha.17
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/package.json +1 -1
- package/dist/_internals.cjs +0 -14
- package/dist/_internals.d.cts +0 -4
- package/dist/_internals.d.mts +0 -4
- package/dist/_internals.mjs +0 -5
- package/dist/index.cjs +0 -49
- package/dist/index.d.cts +0 -14
- package/dist/index.d.mts +0 -14
- package/dist/index.mjs +0 -16
- package/dist/internals/step-schema.cjs +0 -385
- package/dist/internals/step-schema.cjs.map +0 -1
- package/dist/internals/step-schema.d.cts +0 -41
- package/dist/internals/step-schema.d.cts.map +0 -1
- package/dist/internals/step-schema.d.mts +0 -41
- package/dist/internals/step-schema.d.mts.map +0 -1
- package/dist/internals/step-schema.mjs +0 -385
- package/dist/internals/step-schema.mjs.map +0 -1
- package/dist/internals/utils.cjs +0 -94
- package/dist/internals/utils.cjs.map +0 -1
- package/dist/internals/utils.d.cts +0 -27
- package/dist/internals/utils.d.cts.map +0 -1
- package/dist/internals/utils.d.mts +0 -27
- package/dist/internals/utils.d.mts.map +0 -1
- package/dist/internals/utils.mjs +0 -91
- package/dist/internals/utils.mjs.map +0 -1
- package/dist/observable.cjs +0 -44
- package/dist/observable.cjs.map +0 -1
- package/dist/observable.d.cts +0 -26
- package/dist/observable.d.cts.map +0 -1
- package/dist/observable.d.mts +0 -26
- package/dist/observable.d.mts.map +0 -1
- package/dist/observable.mjs +0 -44
- package/dist/observable.mjs.map +0 -1
- package/dist/schema.cjs +0 -68
- package/dist/schema.cjs.map +0 -1
- package/dist/schema.d.cts +0 -28
- package/dist/schema.d.cts.map +0 -1
- package/dist/schema.d.mts +0 -28
- package/dist/schema.d.mts.map +0 -1
- package/dist/schema.mjs +0 -67
- package/dist/schema.mjs.map +0 -1
- package/dist/steps/fields.cjs +0 -23
- package/dist/steps/fields.cjs.map +0 -1
- package/dist/steps/fields.d.cts +0 -18
- package/dist/steps/fields.d.cts.map +0 -1
- package/dist/steps/fields.d.mts +0 -18
- package/dist/steps/fields.d.mts.map +0 -1
- package/dist/steps/fields.mjs +0 -18
- package/dist/steps/fields.mjs.map +0 -1
- package/dist/steps/index.cjs +0 -4
- package/dist/steps/index.mjs +0 -6
- package/dist/steps/schema.cjs +0 -194
- package/dist/steps/schema.cjs.map +0 -1
- package/dist/steps/schema.d.cts +0 -124
- package/dist/steps/schema.d.cts.map +0 -1
- package/dist/steps/schema.d.mts +0 -124
- package/dist/steps/schema.d.mts.map +0 -1
- package/dist/steps/schema.mjs +0 -194
- package/dist/steps/schema.mjs.map +0 -1
- package/dist/steps/types.cjs +0 -33
- package/dist/steps/types.cjs.map +0 -1
- package/dist/steps/types.d.cts +0 -322
- package/dist/steps/types.d.cts.map +0 -1
- package/dist/steps/types.d.mts +0 -322
- package/dist/steps/types.d.mts.map +0 -1
- package/dist/steps/types.mjs +0 -27
- package/dist/steps/types.mjs.map +0 -1
- package/dist/steps/utils.cjs +0 -96
- package/dist/steps/utils.cjs.map +0 -1
- package/dist/steps/utils.d.cts +0 -10
- package/dist/steps/utils.d.cts.map +0 -1
- package/dist/steps/utils.d.mts +0 -10
- package/dist/steps/utils.d.mts.map +0 -1
- package/dist/steps/utils.mjs +0 -94
- package/dist/steps/utils.mjs.map +0 -1
- package/dist/storage.cjs +0 -72
- package/dist/storage.cjs.map +0 -1
- package/dist/storage.d.cts +0 -33
- package/dist/storage.d.cts.map +0 -1
- package/dist/storage.d.mts +0 -33
- package/dist/storage.d.mts.map +0 -1
- package/dist/storage.mjs +0 -71
- package/dist/storage.mjs.map +0 -1
- package/dist/subscribable.cjs +0 -25
- package/dist/subscribable.cjs.map +0 -1
- package/dist/subscribable.d.cts +0 -14
- package/dist/subscribable.d.cts.map +0 -1
- package/dist/subscribable.d.mts +0 -14
- package/dist/subscribable.d.mts.map +0 -1
- package/dist/subscribable.mjs +0 -24
- package/dist/subscribable.mjs.map +0 -1
- package/dist/utils/casing.cjs +0 -63
- package/dist/utils/casing.cjs.map +0 -1
- package/dist/utils/casing.d.cts +0 -40
- package/dist/utils/casing.d.cts.map +0 -1
- package/dist/utils/casing.d.mts +0 -40
- package/dist/utils/casing.d.mts.map +0 -1
- package/dist/utils/casing.mjs +0 -57
- package/dist/utils/casing.mjs.map +0 -1
- package/dist/utils/field-types.cjs +0 -23
- package/dist/utils/field-types.cjs.map +0 -1
- package/dist/utils/field-types.d.cts +0 -11
- package/dist/utils/field-types.d.cts.map +0 -1
- package/dist/utils/field-types.d.mts +0 -11
- package/dist/utils/field-types.d.mts.map +0 -1
- package/dist/utils/field-types.mjs +0 -20
- package/dist/utils/field-types.mjs.map +0 -1
- package/dist/utils/helpers.cjs +0 -30
- package/dist/utils/helpers.cjs.map +0 -1
- package/dist/utils/helpers.mjs +0 -27
- package/dist/utils/helpers.mjs.map +0 -1
- package/dist/utils/invariant.cjs +0 -18
- package/dist/utils/invariant.cjs.map +0 -1
- package/dist/utils/invariant.d.cts +0 -5
- package/dist/utils/invariant.d.cts.map +0 -1
- package/dist/utils/invariant.d.mts +0 -5
- package/dist/utils/invariant.d.mts.map +0 -1
- package/dist/utils/invariant.mjs +0 -17
- package/dist/utils/invariant.mjs.map +0 -1
- package/dist/utils/logger.cjs +0 -58
- package/dist/utils/logger.cjs.map +0 -1
- package/dist/utils/logger.d.cts +0 -53
- package/dist/utils/logger.d.cts.map +0 -1
- package/dist/utils/logger.d.mts +0 -53
- package/dist/utils/logger.d.mts.map +0 -1
- package/dist/utils/logger.mjs +0 -56
- package/dist/utils/logger.mjs.map +0 -1
- package/dist/utils/path.cjs +0 -331
- package/dist/utils/path.cjs.map +0 -1
- package/dist/utils/path.d.cts +0 -139
- package/dist/utils/path.d.cts.map +0 -1
- package/dist/utils/path.d.mts +0 -139
- package/dist/utils/path.d.mts.map +0 -1
- package/dist/utils/path.mjs +0 -325
- package/dist/utils/path.mjs.map +0 -1
- package/dist/utils/types.d.cts +0 -25
- package/dist/utils/types.d.cts.map +0 -1
- package/dist/utils/types.d.mts +0 -25
- package/dist/utils/types.d.mts.map +0 -1
- package/dist/utils/validator.cjs +0 -12
- package/dist/utils/validator.cjs.map +0 -1
- package/dist/utils/validator.d.cts +0 -77
- package/dist/utils/validator.d.cts.map +0 -1
- package/dist/utils/validator.d.mts +0 -77
- package/dist/utils/validator.d.mts.map +0 -1
- package/dist/utils/validator.mjs +0 -11
- package/dist/utils/validator.mjs.map +0 -1
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
//#region src/utils/validator.d.ts
|
|
2
|
-
interface StandardSchemaValidator<Input = unknown, Output = Input> {
|
|
3
|
-
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
4
|
-
}
|
|
5
|
-
declare namespace StandardSchemaV1 {
|
|
6
|
-
/** The Standard Schema properties interface. */
|
|
7
|
-
interface Props<Input = unknown, Output = Input> {
|
|
8
|
-
/** The version number of the standard. */
|
|
9
|
-
readonly version: 1;
|
|
10
|
-
/** The vendor name of the schema library. */
|
|
11
|
-
readonly vendor: string;
|
|
12
|
-
/** Validates unknown input values. */
|
|
13
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
14
|
-
/** Inferred types associated with the schema. */
|
|
15
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
-
}
|
|
17
|
-
/** The result interface of the validate function. */
|
|
18
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
19
|
-
/** The result interface if validation succeeds. */
|
|
20
|
-
interface SuccessResult<Output> {
|
|
21
|
-
/** The typed output value. */
|
|
22
|
-
readonly value: Output;
|
|
23
|
-
/** The non-existent issues. */
|
|
24
|
-
readonly issues?: undefined;
|
|
25
|
-
}
|
|
26
|
-
/** The result interface if validation fails. */
|
|
27
|
-
interface FailureResult {
|
|
28
|
-
/** The issues of failed validation. */
|
|
29
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
30
|
-
}
|
|
31
|
-
/** The issue interface of the failure output. */
|
|
32
|
-
interface Issue {
|
|
33
|
-
/** The error message of the issue. */
|
|
34
|
-
readonly message: string;
|
|
35
|
-
/** The path of the issue, if any. */
|
|
36
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
37
|
-
}
|
|
38
|
-
/** The path segment interface of the issue. */
|
|
39
|
-
interface PathSegment {
|
|
40
|
-
/** The key representing a path segment. */
|
|
41
|
-
readonly key: PropertyKey;
|
|
42
|
-
}
|
|
43
|
-
/** The Standard Schema types interface. */
|
|
44
|
-
interface Types<Input = unknown, Output = Input> {
|
|
45
|
-
/** The input type of the schema. */
|
|
46
|
-
readonly input: Input;
|
|
47
|
-
/** The output type of the schema. */
|
|
48
|
-
readonly output: Output;
|
|
49
|
-
}
|
|
50
|
-
/** Infers the input type of a Standard Schema. */
|
|
51
|
-
type InferInput<Schema extends StandardSchemaValidator> = NonNullable<Schema['~standard']['types']>['input'];
|
|
52
|
-
/** Infers the output type of a Standard Schema. */
|
|
53
|
-
type InferOutput<Schema extends StandardSchemaValidator> = NonNullable<Schema['~standard']['types']>['output'];
|
|
54
|
-
}
|
|
55
|
-
interface ValidatorAdapter<TInput, TOutput> {
|
|
56
|
-
types: {
|
|
57
|
-
input: TInput;
|
|
58
|
-
output: TOutput;
|
|
59
|
-
};
|
|
60
|
-
parse: (input: unknown) => TOutput;
|
|
61
|
-
}
|
|
62
|
-
interface ValidatorObj<TInput, TOutput> {
|
|
63
|
-
parse: ValidatorFn<TInput, TOutput>;
|
|
64
|
-
}
|
|
65
|
-
type ValidatorFn<Input, Output> = (input: Input) => Output;
|
|
66
|
-
type Validator<Input, Output> = ValidatorFn<Input, Output> | StandardSchemaValidator<Input, Output>;
|
|
67
|
-
type AnySchema = {};
|
|
68
|
-
type DefaultValidator = Validator<Record<string, unknown>, AnySchema>;
|
|
69
|
-
type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>;
|
|
70
|
-
type AnyValidator = Validator<any, any>;
|
|
71
|
-
type AnyValidatorObj = ValidatorObj<any, any>;
|
|
72
|
-
type AnyValidatorAdapter = ValidatorAdapter<any, any>;
|
|
73
|
-
type ResolveValidatorOutputFn<TValidator> = TValidator extends ((...args: any) => infer TSchema) ? TSchema : AnySchema;
|
|
74
|
-
type ResolveValidatorOutput<TValidator> = unknown extends TValidator ? TValidator : TValidator extends AnyStandardSchemaValidator ? NonNullable<TValidator['~standard']['types']>['output'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['output'] : TValidator extends AnyValidatorObj ? ResolveValidatorOutputFn<TValidator['parse']> : ResolveValidatorOutputFn<TValidator>;
|
|
75
|
-
//#endregion
|
|
76
|
-
export { AnyValidator, DefaultValidator, ResolveValidatorOutput };
|
|
77
|
-
//# sourceMappingURL=validator.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.cts","names":[],"sources":["../../src/utils/validator.ts"],"sourcesContent":[],"mappings":";UAAiB,kDAAkD;EAAlD,SAAA,WAAA,EACO,gBAAA,CAAiB,KADD,CACO,KADP,EACc,MADd,CAAA;;AACO,kBAGtB,gBAAA,CAHsB;EAAO;EAA9B,UAAA,KAAiB,CAAA,QAAA,OAAA,EAAA,SAKU,KALV,CAAA,CAAA;IAAK;IAGrB,SAAA,OAAgB,EAAA,CAAA;IAEU;IAQnC,SAAA,MAAA,EAAA,MAAA;IAAP;IAAgC,SAAA,QAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAhC,MAAgC,CAAzB,MAAyB,CAAA,GAAf,OAAe,CAAP,MAAO,CAAA,MAAA,CAAA,CAAA;IAAP;IAAR,SAAA,KAAA,CAAA,EAEL,KAFK,CAEC,KAFD,EAEQ,MAFR,CAAA,GAAA,SAAA;EAEC;EAAO;EAAb,KAAA,MAAA,CAAA,MAAA,CAAA,GAIU,aAJV,CAIwB,MAJxB,CAAA,GAIkC,aAJlC;EAIwB;EAAd,UAAA,aAAA,CAAA,MAAA,CAAA,CAAA;IAAwB;IAKnC,SAAA,KAAA,EAAA,M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CAAS,KAAA,EAPa,KAOb,EAAA,GAPuB,MAOvB;AACxB,KAPA,SAOA,CAAe,KAAA,EAAA,MAAG,CAAA,GAN1B,WAMsC,CAN1B,KAM0B,EANnB,MAMmB,CAAA,GALtC,uBAKsC,CALd,KAKc,EALP,MAKO,CAAA;AAC9B,KALA,SAAA,GAKA,CAAA,CAAmB;AACnB,KALA,gBAAA,GAAmB,SAKK,CALK,MAKL,CAAA,MAAe,EAAA,OAAA,CAAA,EALe,SAS9D,CAAS;AACD,KATA,0BAAA,GAA6B,uBASP,CAAA,GAAA,EAAA,GAAA,CAAA;AAA+B,KARrD,YAAA,GAAe,SAQsC,CAAA,GAAA,EAAA,GAAA,CAAA;AAC7D,KARQ,eAAA,GAAkB,YAQ1B,CAAA,GAAA,EAAA,GAAA,CAAA;AACA,KARQ,mBAAA,GAAsB,gBAQ9B,CAAA,GAAA,EAAA,GAAA,CAAA;AAAmB,KAPX,wBAOW,CAAA,UAAA,CAAA,GAP4B,UAO5B,UAAA,CAAA,GAAA,IAAA,EAAA,GAAA,EAAA,GAAA,KAAA,QAAA,IAAA,OAAA,GAHnB,SAGmB;AACP,KAHJ,sBAGI,CAAA,UAAA,CAAA,GAAA,OAAA,SAHiD,UAGjD,GAFZ,UAEY,GADZ,UACY,SADO,0BACP,GAAZ,WAAY,CAAA,UAAA,CAAA,WAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GACZ,UADY,SACO,mBADP,GAEZ,UAFY,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA,GAGZ,UAHY,SAGO,eAHP,GAIZ,wBAJY,CAIa,UAJb,CAAA,OAAA,CAAA,CAAA,GAKZ,wBALY,CAKa,UALb,CAAA"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
//#region src/utils/validator.d.ts
|
|
2
|
-
interface StandardSchemaValidator<Input = unknown, Output = Input> {
|
|
3
|
-
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
4
|
-
}
|
|
5
|
-
declare namespace StandardSchemaV1 {
|
|
6
|
-
/** The Standard Schema properties interface. */
|
|
7
|
-
interface Props<Input = unknown, Output = Input> {
|
|
8
|
-
/** The version number of the standard. */
|
|
9
|
-
readonly version: 1;
|
|
10
|
-
/** The vendor name of the schema library. */
|
|
11
|
-
readonly vendor: string;
|
|
12
|
-
/** Validates unknown input values. */
|
|
13
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
14
|
-
/** Inferred types associated with the schema. */
|
|
15
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
-
}
|
|
17
|
-
/** The result interface of the validate function. */
|
|
18
|
-
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
19
|
-
/** The result interface if validation succeeds. */
|
|
20
|
-
interface SuccessResult<Output> {
|
|
21
|
-
/** The typed output value. */
|
|
22
|
-
readonly value: Output;
|
|
23
|
-
/** The non-existent issues. */
|
|
24
|
-
readonly issues?: undefined;
|
|
25
|
-
}
|
|
26
|
-
/** The result interface if validation fails. */
|
|
27
|
-
interface FailureResult {
|
|
28
|
-
/** The issues of failed validation. */
|
|
29
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
30
|
-
}
|
|
31
|
-
/** The issue interface of the failure output. */
|
|
32
|
-
interface Issue {
|
|
33
|
-
/** The error message of the issue. */
|
|
34
|
-
readonly message: string;
|
|
35
|
-
/** The path of the issue, if any. */
|
|
36
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
37
|
-
}
|
|
38
|
-
/** The path segment interface of the issue. */
|
|
39
|
-
interface PathSegment {
|
|
40
|
-
/** The key representing a path segment. */
|
|
41
|
-
readonly key: PropertyKey;
|
|
42
|
-
}
|
|
43
|
-
/** The Standard Schema types interface. */
|
|
44
|
-
interface Types<Input = unknown, Output = Input> {
|
|
45
|
-
/** The input type of the schema. */
|
|
46
|
-
readonly input: Input;
|
|
47
|
-
/** The output type of the schema. */
|
|
48
|
-
readonly output: Output;
|
|
49
|
-
}
|
|
50
|
-
/** Infers the input type of a Standard Schema. */
|
|
51
|
-
type InferInput<Schema extends StandardSchemaValidator> = NonNullable<Schema['~standard']['types']>['input'];
|
|
52
|
-
/** Infers the output type of a Standard Schema. */
|
|
53
|
-
type InferOutput<Schema extends StandardSchemaValidator> = NonNullable<Schema['~standard']['types']>['output'];
|
|
54
|
-
}
|
|
55
|
-
interface ValidatorAdapter<TInput, TOutput> {
|
|
56
|
-
types: {
|
|
57
|
-
input: TInput;
|
|
58
|
-
output: TOutput;
|
|
59
|
-
};
|
|
60
|
-
parse: (input: unknown) => TOutput;
|
|
61
|
-
}
|
|
62
|
-
interface ValidatorObj<TInput, TOutput> {
|
|
63
|
-
parse: ValidatorFn<TInput, TOutput>;
|
|
64
|
-
}
|
|
65
|
-
type ValidatorFn<Input, Output> = (input: Input) => Output;
|
|
66
|
-
type Validator<Input, Output> = ValidatorFn<Input, Output> | StandardSchemaValidator<Input, Output>;
|
|
67
|
-
type AnySchema = {};
|
|
68
|
-
type DefaultValidator = Validator<Record<string, unknown>, AnySchema>;
|
|
69
|
-
type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>;
|
|
70
|
-
type AnyValidator = Validator<any, any>;
|
|
71
|
-
type AnyValidatorObj = ValidatorObj<any, any>;
|
|
72
|
-
type AnyValidatorAdapter = ValidatorAdapter<any, any>;
|
|
73
|
-
type ResolveValidatorOutputFn<TValidator> = TValidator extends ((...args: any) => infer TSchema) ? TSchema : AnySchema;
|
|
74
|
-
type ResolveValidatorOutput<TValidator> = unknown extends TValidator ? TValidator : TValidator extends AnyStandardSchemaValidator ? NonNullable<TValidator['~standard']['types']>['output'] : TValidator extends AnyValidatorAdapter ? TValidator['types']['output'] : TValidator extends AnyValidatorObj ? ResolveValidatorOutputFn<TValidator['parse']> : ResolveValidatorOutputFn<TValidator>;
|
|
75
|
-
//#endregion
|
|
76
|
-
export { AnyValidator, DefaultValidator, ResolveValidatorOutput };
|
|
77
|
-
//# sourceMappingURL=validator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AA,GAAkB,YAQ1B,CAAA,GAAA,EAAA,GAAA,CAAA;AACA,KARQ,mBAAA,GAAsB,gBAQ9B,CAAA,GAAA,EAAA,GAAA,CAAA;AAAmB,KAPX,wBAOW,CAAA,UAAA,CAAA,GAP4B,UAO5B,UAAA,CAAA,GAAA,IAAA,EAAA,GAAA,EAAA,GAAA,KAAA,QAAA,IAAA,OAAA,GAHnB,SAGmB;AACP,KAHJ,sBAGI,CAAA,UAAA,CAAA,GAAA,OAAA,SAHiD,UAGjD,GAFZ,UAEY,GADZ,UACY,SADO,0BACP,GAAZ,WAAY,CAAA,UAAA,CAAA,WAAA,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,QAAA,CAAA,GACZ,UADY,SACO,mBADP,GAEZ,UAFY,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA,GAGZ,UAHY,SAGO,eAHP,GAIZ,wBAJY,CAIa,UAJb,CAAA,OAAA,CAAA,CAAA,GAKZ,wBALY,CAKa,UALb,CAAA"}
|
package/dist/utils/validator.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/utils/validator.ts
|
|
2
|
-
function runStandardValidation(schema, input) {
|
|
3
|
-
const result = schema["~standard"].validate(input);
|
|
4
|
-
if (result instanceof Promise) throw new TypeError("Schema validation must be synchronous", { cause: schema });
|
|
5
|
-
if (result.issues) throw new Error(JSON.stringify(result.issues, null, 2));
|
|
6
|
-
return result.value;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { runStandardValidation };
|
|
11
|
-
//# sourceMappingURL=validator.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.mjs","names":[],"sources":["../../src/utils/validator.ts"],"sourcesContent":["export interface StandardSchemaValidator<Input = unknown, Output = Input> {\n readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n export interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (\n value: unknown\n ) => Result<Output> | Promise<Result<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n\n /** The result interface of the validate function. */\n export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n /** The result interface if validation succeeds. */\n export interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The non-existent issues. */\n readonly issues?: undefined;\n }\n\n /** The result interface if validation fails. */\n export interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n\n /** The issue interface of the failure output. */\n export interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n\n /** The path segment interface of the issue. */\n export interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n\n /** The Standard Schema types interface. */\n export interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n\n /** Infers the input type of a Standard Schema. */\n export type InferInput<Schema extends StandardSchemaValidator> = NonNullable<\n Schema['~standard']['types']\n >['input'];\n\n /** Infers the output type of a Standard Schema. */\n export type InferOutput<Schema extends StandardSchemaValidator> = NonNullable<\n Schema['~standard']['types']\n >['output'];\n}\n\n// Types taken from Tanstack Router\nexport interface ValidatorAdapter<TInput, TOutput> {\n types: {\n input: TInput;\n output: TOutput;\n };\n parse: (input: unknown) => TOutput;\n}\nexport interface ValidatorObj<TInput, TOutput> {\n parse: ValidatorFn<TInput, TOutput>;\n}\nexport type ValidatorFn<Input, Output> = (input: Input) => Output;\nexport type Validator<Input, Output> =\n | ValidatorFn<Input, Output>\n | StandardSchemaValidator<Input, Output>;\nexport type AnySchema = {};\nexport type DefaultValidator = Validator<Record<string, unknown>, AnySchema>;\nexport type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>;\nexport type AnyValidator = Validator<any, any>;\nexport type AnyValidatorObj = ValidatorObj<any, any>;\nexport type AnyValidatorAdapter = ValidatorAdapter<any, any>;\nexport type ResolveValidatorOutputFn<TValidator> = TValidator extends (\n ...args: any\n) => infer TSchema\n ? TSchema\n : AnySchema;\nexport type ResolveValidatorOutput<TValidator> = unknown extends TValidator\n ? TValidator\n : TValidator extends AnyStandardSchemaValidator\n ? NonNullable<TValidator['~standard']['types']>['output']\n : TValidator extends AnyValidatorAdapter\n ? TValidator['types']['output']\n : TValidator extends AnyValidatorObj\n ? ResolveValidatorOutputFn<TValidator['parse']>\n : ResolveValidatorOutputFn<TValidator>;\n\nexport function runStandardValidation<Schema extends StandardSchemaValidator>(\n schema: Schema,\n input: StandardSchemaV1.InferInput<Schema>\n): StandardSchemaV1.InferOutput<Schema> {\n const result = schema['~standard'].validate(input);\n\n if (result instanceof Promise) {\n throw new TypeError('Schema validation must be synchronous', {\n cause: schema,\n });\n }\n\n // if the `issues` field exists, the validation failed\n if (result.issues) {\n throw new Error(JSON.stringify(result.issues, null, 2));\n }\n\n return result.value;\n}"],"mappings":";AAyGA,SAAgB,sBACd,QACA,OACsC;CACtC,MAAM,SAAS,OAAO,aAAa,SAAS,MAAM;AAElD,KAAI,kBAAkB,QACpB,OAAM,IAAI,UAAU,yCAAyC,EAC3D,OAAO,QACR,CAAC;AAIJ,KAAI,OAAO,OACT,OAAM,IAAI,MAAM,KAAK,UAAU,OAAO,QAAQ,MAAM,EAAE,CAAC;AAGzD,QAAO,OAAO"}
|