@warlock.js/seal 5.31.0 → 5.32.0
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/CHANGELOG.md +8 -0
- package/cjs/index.cjs +20 -16
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-VTtA-k1a.cjs → object-BoVGJ68E.cjs} +30 -13
- package/cjs/object-BoVGJ68E.cjs.map +1 -0
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-chT0TXQS.cjs → required-methods-BJlnLnwa.cjs} +237 -228
- package/cjs/required-methods-BJlnLnwa.cjs.map +1 -0
- package/cjs/{string-edcPIpcU.cjs → string-CM8x0u2w.cjs} +44 -42
- package/cjs/string-CM8x0u2w.cjs.map +1 -0
- package/cjs/string.cjs +2 -2
- package/esm/config.d.mts +7 -8
- package/esm/config.d.mts.map +1 -1
- package/esm/factory/index.d.mts +2 -1
- package/esm/factory/index.mjs +1 -1
- package/esm/factory/validate.d.mts +3 -6
- package/esm/factory/validate.d.mts.map +1 -1
- package/esm/factory/validators.d.mts +9 -6
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/helpers/date-helpers.d.mts +1 -2
- package/esm/helpers/date-helpers.d.mts.map +1 -1
- package/esm/helpers/file.utils.d.mts +2 -4
- package/esm/helpers/file.utils.d.mts.map +1 -1
- package/esm/helpers/get-field-value.d.mts +2 -3
- package/esm/helpers/get-field-value.d.mts.map +1 -1
- package/esm/helpers/get-field-value.mjs +2 -1
- package/esm/helpers/get-field-value.mjs.map +1 -1
- package/esm/helpers/index.d.mts +6 -0
- package/esm/helpers/index.mjs +1 -1
- package/esm/helpers/path-helpers.d.mts +1 -2
- package/esm/helpers/path-helpers.d.mts.map +1 -1
- package/esm/helpers/validation-helpers.d.mts +4 -10
- package/esm/helpers/validation-helpers.d.mts.map +1 -1
- package/esm/index.d.mts +7 -0
- package/esm/mutators/array-mutators.d.mts +6 -7
- package/esm/mutators/array-mutators.d.mts.map +1 -1
- package/esm/mutators/boolean-mutators.d.mts +3 -4
- package/esm/mutators/boolean-mutators.d.mts.map +1 -1
- package/esm/mutators/date-mutators.d.mts +18 -19
- package/esm/mutators/date-mutators.d.mts.map +1 -1
- package/esm/mutators/index.d.mts +8 -0
- package/esm/mutators/index.mjs +1 -1
- package/esm/mutators/number-mutators.d.mts +10 -11
- package/esm/mutators/number-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.d.mts +4 -5
- package/esm/mutators/object-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.mjs +5 -4
- package/esm/mutators/object-mutators.mjs.map +1 -1
- package/esm/mutators/scalar-mutators.d.mts +2 -3
- package/esm/mutators/scalar-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.d.mts +37 -38
- package/esm/mutators/string-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.mjs +3 -1
- package/esm/mutators/string-mutators.mjs.map +1 -1
- package/esm/object.d.mts +3 -3
- package/esm/object.d.mts.map +1 -1
- package/esm/plugins/plugin-system.d.mts +11 -9
- package/esm/plugins/plugin-system.d.mts.map +1 -1
- package/esm/rules/array/array-rules.d.mts +3 -4
- package/esm/rules/array/array-rules.d.mts.map +1 -1
- package/esm/rules/array/index.d.mts +2 -0
- package/esm/rules/array/index.mjs +1 -1
- package/esm/rules/color/color-rules.d.mts +8 -9
- package/esm/rules/color/color-rules.d.mts.map +1 -1
- package/esm/rules/color/index.d.mts +2 -0
- package/esm/rules/color/index.mjs +1 -1
- package/esm/rules/common/enum.d.mts +5 -6
- package/esm/rules/common/enum.d.mts.map +1 -1
- package/esm/rules/common/equals-field-rules.d.mts +3 -4
- package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
- package/esm/rules/common/index.d.mts +7 -0
- package/esm/rules/common/index.mjs +1 -1
- package/esm/rules/common/instanceof.d.mts +2 -3
- package/esm/rules/common/instanceof.d.mts.map +1 -1
- package/esm/rules/common/literal.d.mts +2 -3
- package/esm/rules/common/literal.d.mts.map +1 -1
- package/esm/rules/common/type-rules.d.mts +10 -11
- package/esm/rules/common/type-rules.d.mts.map +1 -1
- package/esm/rules/common/unknown-key.d.mts +2 -3
- package/esm/rules/common/unknown-key.d.mts.map +1 -1
- package/esm/rules/conditional/forbidden-if-rules.d.mts +7 -8
- package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/index.d.mts +11 -0
- package/esm/rules/conditional/index.mjs +1 -1
- package/esm/rules/conditional/present-if-rules.d.mts +6 -7
- package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-with-rules.d.mts +4 -5
- package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-without-rules.d.mts +4 -5
- package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-if-rules.d.mts +10 -11
- package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-when-rule.d.mts +2 -3
- package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
- package/esm/rules/conditional/required-with-rules.d.mts +4 -5
- package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-without-rules.d.mts +4 -5
- package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
- package/esm/rules/core/equal.d.mts +2 -3
- package/esm/rules/core/equal.d.mts.map +1 -1
- package/esm/rules/core/forbidden.d.mts +2 -3
- package/esm/rules/core/forbidden.d.mts.map +1 -1
- package/esm/rules/core/index.d.mts +6 -0
- package/esm/rules/core/index.mjs +1 -1
- package/esm/rules/core/required.d.mts +3 -4
- package/esm/rules/core/required.d.mts.map +1 -1
- package/esm/rules/core/union.d.mts +2 -3
- package/esm/rules/core/union.d.mts.map +1 -1
- package/esm/rules/core/when.d.mts +2 -3
- package/esm/rules/core/when.d.mts.map +1 -1
- package/esm/rules/date/date-comparison-rules.d.mts +6 -7
- package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-day-rules.d.mts +5 -6
- package/esm/rules/date/date-day-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.d.mts +4 -5
- package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.mjs +6 -3
- package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
- package/esm/rules/date/date-period-rules.d.mts +16 -16
- package/esm/rules/date/date-period-rules.d.mts.map +1 -1
- package/esm/rules/date/date-period-rules.mjs +24 -12
- package/esm/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/rules/date/date-relative-rules.d.mts +4 -5
- package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
- package/esm/rules/date/date-relative-rules.mjs +3 -3
- package/esm/rules/date/date-relative-rules.mjs.map +1 -1
- package/esm/rules/date/date-special-rules.d.mts +4 -5
- package/esm/rules/date/date-special-rules.d.mts.map +1 -1
- package/esm/rules/date/date.d.mts +16 -17
- package/esm/rules/date/date.d.mts.map +1 -1
- package/esm/rules/date/date.mjs +4 -2
- package/esm/rules/date/date.mjs.map +1 -1
- package/esm/rules/date/index.d.mts +8 -0
- package/esm/rules/date/index.mjs +1 -1
- package/esm/rules/file/dimensions.d.mts +5 -6
- package/esm/rules/file/dimensions.d.mts.map +1 -1
- package/esm/rules/file/file-size.d.mts +3 -4
- package/esm/rules/file/file-size.d.mts.map +1 -1
- package/esm/rules/file/index.d.mts +3 -0
- package/esm/rules/file/index.mjs +1 -1
- package/esm/rules/index.d.mts +56 -0
- package/esm/rules/index.mjs +1 -1
- package/esm/rules/length/index.d.mts +2 -0
- package/esm/rules/length/index.mjs +1 -1
- package/esm/rules/length/length-rules.d.mts +8 -9
- package/esm/rules/length/length-rules.d.mts.map +1 -1
- package/esm/rules/number/index.d.mts +2 -0
- package/esm/rules/number/index.mjs +1 -1
- package/esm/rules/number/number-rules.d.mts +11 -12
- package/esm/rules/number/number-rules.d.mts.map +1 -1
- package/esm/rules/number/number-rules.mjs +12 -6
- package/esm/rules/number/number-rules.mjs.map +1 -1
- package/esm/rules/scalar/index.mjs +1 -1
- package/esm/rules/string/alpha.d.mts +4 -5
- package/esm/rules/string/alpha.d.mts.map +1 -1
- package/esm/rules/string/credit-card.d.mts +2 -3
- package/esm/rules/string/credit-card.d.mts.map +1 -1
- package/esm/rules/string/email.d.mts +2 -3
- package/esm/rules/string/email.d.mts.map +1 -1
- package/esm/rules/string/id-formats.d.mts +6 -7
- package/esm/rules/string/id-formats.d.mts.map +1 -1
- package/esm/rules/string/index.d.mts +12 -0
- package/esm/rules/string/index.mjs +1 -1
- package/esm/rules/string/ip.d.mts +7 -8
- package/esm/rules/string/ip.d.mts.map +1 -1
- package/esm/rules/string/matches.d.mts +2 -3
- package/esm/rules/string/matches.d.mts.map +1 -1
- package/esm/rules/string/pattern.d.mts +2 -3
- package/esm/rules/string/pattern.d.mts.map +1 -1
- package/esm/rules/string/string-comparison.d.mts +5 -6
- package/esm/rules/string/string-comparison.d.mts.map +1 -1
- package/esm/rules/string/strong-password-rule.d.mts +2 -3
- package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
- package/esm/rules/string/url.d.mts +2 -3
- package/esm/rules/string/url.d.mts.map +1 -1
- package/esm/rules/string/without-whitespace.d.mts +2 -3
- package/esm/rules/string/without-whitespace.d.mts.map +1 -1
- package/esm/standard-schema/index.d.mts +4 -0
- package/esm/standard-schema/json-schema.d.mts +5 -7
- package/esm/standard-schema/json-schema.d.mts.map +1 -1
- package/esm/standard-schema/map-result.d.mts +2 -3
- package/esm/standard-schema/map-result.d.mts.map +1 -1
- package/esm/standard-schema/types.d.mts +4 -5
- package/esm/standard-schema/types.d.mts.map +1 -1
- package/esm/string.d.mts +2 -3
- package/esm/string.d.mts.map +1 -1
- package/esm/types/conditional-types.d.mts +8 -6
- package/esm/types/conditional-types.d.mts.map +1 -1
- package/esm/types/context-types.d.mts +24 -15
- package/esm/types/context-types.d.mts.map +1 -1
- package/esm/types/data-transformer-types.d.mts +3 -5
- package/esm/types/data-transformer-types.d.mts.map +1 -1
- package/esm/types/date-types.d.mts +2 -3
- package/esm/types/date-types.d.mts.map +1 -1
- package/esm/types/file.types.d.mts +1 -2
- package/esm/types/file.types.d.mts.map +1 -1
- package/esm/types/index.d.mts +11 -0
- package/esm/types/inference-types.d.mts +14 -13
- package/esm/types/inference-types.d.mts.map +1 -1
- package/esm/types/mutator-types.d.mts +9 -7
- package/esm/types/mutator-types.d.mts.map +1 -1
- package/esm/types/result-types.d.mts +12 -7
- package/esm/types/result-types.d.mts.map +1 -1
- package/esm/types/rule-types.d.mts +25 -16
- package/esm/types/rule-types.d.mts.map +1 -1
- package/esm/types/schema-types.d.mts +1 -3
- package/esm/types/schema-types.d.mts.map +1 -1
- package/esm/validators/any-validator.d.mts +1 -3
- package/esm/validators/any-validator.d.mts.map +1 -1
- package/esm/validators/array-validator.d.mts +2 -3
- package/esm/validators/array-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.d.mts +2 -3
- package/esm/validators/base-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.mjs +2 -1
- package/esm/validators/base-validator.mjs.map +1 -1
- package/esm/validators/boolean-validator.d.mts +1 -3
- package/esm/validators/boolean-validator.d.mts.map +1 -1
- package/esm/validators/computed-validator.d.mts +3 -4
- package/esm/validators/computed-validator.d.mts.map +1 -1
- package/esm/validators/date-validator.d.mts +2 -3
- package/esm/validators/date-validator.d.mts.map +1 -1
- package/esm/validators/discriminated-union-validator.d.mts +3 -3
- package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
- package/esm/validators/float-validator.d.mts +1 -3
- package/esm/validators/float-validator.d.mts.map +1 -1
- package/esm/validators/index.d.mts +2 -1
- package/esm/validators/index.mjs +1 -1
- package/esm/validators/instanceof-validator.d.mts +1 -3
- package/esm/validators/instanceof-validator.d.mts.map +1 -1
- package/esm/validators/int-validator.d.mts +1 -3
- package/esm/validators/int-validator.d.mts.map +1 -1
- package/esm/validators/lazy-validator.d.mts +2 -3
- package/esm/validators/lazy-validator.d.mts.map +1 -1
- package/esm/validators/literal-validator.d.mts +1 -3
- package/esm/validators/literal-validator.d.mts.map +1 -1
- package/esm/validators/managed-validator.d.mts +3 -4
- package/esm/validators/managed-validator.d.mts.map +1 -1
- package/esm/validators/methods/equality-conditional-methods.d.mts +3 -4
- package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
- package/esm/validators/methods/forbidden-methods.d.mts +2 -3
- package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
- package/esm/validators/methods/present-methods.d.mts +2 -3
- package/esm/validators/methods/present-methods.d.mts.map +1 -1
- package/esm/validators/methods/required-methods.d.mts +3 -4
- package/esm/validators/methods/required-methods.d.mts.map +1 -1
- package/esm/validators/number-validator.d.mts +1 -3
- package/esm/validators/number-validator.d.mts.map +1 -1
- package/esm/validators/number-validator.mjs +12 -8
- package/esm/validators/number-validator.mjs.map +1 -1
- package/esm/validators/numeric-validator.d.mts +1 -3
- package/esm/validators/numeric-validator.d.mts.map +1 -1
- package/esm/validators/object-validator.d.mts +2 -3
- package/esm/validators/object-validator.d.mts.map +1 -1
- package/esm/validators/primitive-validator.d.mts +1 -3
- package/esm/validators/primitive-validator.d.mts.map +1 -1
- package/esm/validators/record-validator.d.mts +2 -3
- package/esm/validators/record-validator.d.mts.map +1 -1
- package/esm/validators/scalar-validator.d.mts +1 -3
- package/esm/validators/scalar-validator.d.mts.map +1 -1
- package/esm/validators/string-validator.d.mts +1 -3
- package/esm/validators/string-validator.d.mts.map +1 -1
- package/esm/validators/tuple-validator.d.mts +2 -3
- package/esm/validators/tuple-validator.d.mts.map +1 -1
- package/esm/validators/union-validator.d.mts +1 -3
- package/esm/validators/union-validator.d.mts.map +1 -1
- package/package.json +1 -1
- package/cjs/object-VTtA-k1a.cjs.map +0 -1
- package/cjs/required-methods-chT0TXQS.cjs.map +0 -1
- package/cjs/string-edcPIpcU.cjs.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Schema } from "./schema-types.mjs";
|
|
2
2
|
import { SchemaRule } from "./rule-types.mjs";
|
|
3
|
-
|
|
4
3
|
//#region ../../packages/seal/src/types/context-types.d.ts
|
|
5
|
-
type RuleTranslation = {
|
|
4
|
+
export type RuleTranslation = {
|
|
6
5
|
rule: SchemaRule;
|
|
7
6
|
context: SchemaContext;
|
|
8
7
|
attributes: {
|
|
@@ -13,7 +12,7 @@ type RuleTranslation = {
|
|
|
13
12
|
[key: string]: any;
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
|
-
type AttributeTranslation = {
|
|
15
|
+
export type AttributeTranslation = {
|
|
17
16
|
attribute: string;
|
|
18
17
|
context: SchemaContext;
|
|
19
18
|
rule: SchemaRule;
|
|
@@ -21,15 +20,24 @@ type AttributeTranslation = {
|
|
|
21
20
|
/**
|
|
22
21
|
* Validation context passed to validators and rules
|
|
23
22
|
*/
|
|
24
|
-
type SchemaContext = {
|
|
25
|
-
/** All input values */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
export type SchemaContext = {
|
|
24
|
+
/** All input values */
|
|
25
|
+
allValues: any;
|
|
26
|
+
/** Parent object if nested */
|
|
27
|
+
parent: any;
|
|
28
|
+
/** Current value being validated */
|
|
29
|
+
value: any;
|
|
30
|
+
/** Current key */
|
|
31
|
+
key: string;
|
|
32
|
+
/** Full path to the current value */
|
|
33
|
+
path: string;
|
|
34
|
+
/** Schema definition if object validator */
|
|
35
|
+
schema?: Schema;
|
|
36
|
+
/** Additional context */
|
|
37
|
+
context?: Record<string, any>;
|
|
38
|
+
/** Root context */
|
|
39
|
+
rootContext?: Record<string, any>;
|
|
40
|
+
/** Translation function for error messages */
|
|
33
41
|
translateRule: (ruleTranslation: RuleTranslation) => string;
|
|
34
42
|
translateAttribute: (attributeTranslation: AttributeTranslation) => string;
|
|
35
43
|
/**
|
|
@@ -37,12 +45,13 @@ type SchemaContext = {
|
|
|
37
45
|
* this field's own `.default()`. The receiving validator reads it once and
|
|
38
46
|
* clears it, so it never leaks into an array/tuple/record's item contexts.
|
|
39
47
|
*/
|
|
40
|
-
valueIsDefault?: boolean;
|
|
48
|
+
valueIsDefault?: boolean;
|
|
49
|
+
/** Validation configurations */
|
|
41
50
|
configurations?: {
|
|
42
|
-
firstErrorOnly?: boolean;
|
|
51
|
+
firstErrorOnly?: boolean;
|
|
52
|
+
/** Rendered as `:value` in error messages instead of the submitted input */
|
|
43
53
|
redactValue?: string;
|
|
44
54
|
};
|
|
45
55
|
};
|
|
46
56
|
//#endregion
|
|
47
|
-
export { AttributeTranslation, RuleTranslation, SchemaContext };
|
|
48
57
|
//# sourceMappingURL=context-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/context-types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/context-types.ts"],"mappings":";;;YAGY;EACV,MAAM;EACN,SAAS;EACT;IACE;IACA;IACA;IACA;KACC;;;YAIO;EACV;EACA,SAAS;EACT,MAAM;;;;;YAMI;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,SAAS;;EAET,UAAU;;EAEV,cAAc;;EAEd,gBAAgB,iBAAiB;EACjC,qBAAqB,sBAAsB;;;;;;EAM3C;;EAEA;IACE;;IAEA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SchemaContext } from "./context-types.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/seal/src/types/data-transformer-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Transformer callback signature
|
|
6
5
|
* First param: the data to transform
|
|
7
6
|
* Second param: object with options and context
|
|
8
7
|
*/
|
|
9
|
-
type TransformerCallback = (data: any, params: {
|
|
8
|
+
export type TransformerCallback = (data: any, params: {
|
|
10
9
|
options: any;
|
|
11
10
|
context: SchemaContext;
|
|
12
11
|
}) => any | Promise<any>;
|
|
@@ -15,15 +14,14 @@ type TransformerCallback = (data: any, params: {
|
|
|
15
14
|
* First param: the data to transform
|
|
16
15
|
* Second param: validation context
|
|
17
16
|
*/
|
|
18
|
-
type SimpleTransformerCallback = (data: any, context: SchemaContext) => any | Promise<any>;
|
|
17
|
+
export type SimpleTransformerCallback = (data: any, context: SchemaContext) => any | Promise<any>;
|
|
19
18
|
/**
|
|
20
19
|
* Contextualized transformer - internal storage
|
|
21
20
|
* Context is NOT stored, it's passed at runtime during validation
|
|
22
21
|
*/
|
|
23
|
-
type ContextualizedTransformer = {
|
|
22
|
+
export type ContextualizedTransformer = {
|
|
24
23
|
transform: TransformerCallback;
|
|
25
24
|
options: any;
|
|
26
25
|
};
|
|
27
26
|
//#endregion
|
|
28
|
-
export { ContextualizedTransformer, SimpleTransformerCallback, TransformerCallback };
|
|
29
27
|
//# sourceMappingURL=data-transformer-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transformer-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/data-transformer-types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-transformer-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/data-transformer-types.ts"],"mappings":";;;;;;;YAOY,uBACV,WACA;EACE;EACA,SAAS;YAEF;;;;;;YAOC,6BAA6B,WAAW,SAAS,wBAAwB;;;;;YAMzE;EACV,WAAW;EACX"}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Week day names for validation
|
|
4
4
|
*/
|
|
5
|
-
type WeekDay = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
|
|
5
|
+
export type WeekDay = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
|
|
6
6
|
/**
|
|
7
7
|
* Week day numbers mapping
|
|
8
8
|
*/
|
|
9
|
-
declare const WEEK_DAYS: Record<WeekDay, number>;
|
|
9
|
+
export declare const WEEK_DAYS: Record<WeekDay, number>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { WEEK_DAYS, WeekDay };
|
|
12
11
|
//# sourceMappingURL=date-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/date-types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/date-types.ts"],"mappings":";;;;YAGY;;;;qBAYC,WAAW,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/file.types.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"file.types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/file.types.ts"],"mappings":";YAAY;EACV;EACA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from "./schema-types.mjs";
|
|
2
|
+
import { ContextualSchemaRule, RuleResult, SchemaRule, SchemaRuleOptions, ValidationAttributesList } from "./rule-types.mjs";
|
|
3
|
+
import { AttributeTranslation, RuleTranslation, SchemaContext } from "./context-types.mjs";
|
|
4
|
+
import { TypedValidationResult, ValidationResult } from "./result-types.mjs";
|
|
5
|
+
import { ContextualizedMutator, Mutator, MutatorContext } from "./mutator-types.mjs";
|
|
6
|
+
import { WhenRuleOptions } from "./conditional-types.mjs";
|
|
7
|
+
import { ContextualizedTransformer, SimpleTransformerCallback, TransformerCallback } from "./data-transformer-types.mjs";
|
|
8
|
+
import { Infer, InferInput, InferInputObjectShape, InferObjectShape, InferOutput, InferOutputObjectShape, IsInputOptionalKey, IsOptionalKey, IsOutputOptionalKey, ValidatedOutput } from "./inference-types.mjs";
|
|
9
|
+
import { WEEK_DAYS, WeekDay } from "./date-types.mjs";
|
|
10
|
+
import { FileSizeOption } from "./file.types.mjs";
|
|
11
|
+
export { AttributeTranslation, ContextualSchemaRule, ContextualizedMutator, ContextualizedTransformer, FileSizeOption, Infer, InferInput, InferInputObjectShape, InferObjectShape, InferOutput, InferOutputObjectShape, IsInputOptionalKey, IsOptionalKey, IsOutputOptionalKey, Mutator, MutatorContext, RuleResult, RuleTranslation, Schema, SchemaContext, SchemaRule, SchemaRuleOptions, SimpleTransformerCallback, TransformerCallback, TypedValidationResult, ValidatedOutput, ValidationAttributesList, ValidationResult, WEEK_DAYS, WeekDay, WhenRuleOptions };
|
|
@@ -16,6 +16,7 @@ import { LiteralValidator } from "../validators/literal-validator.mjs";
|
|
|
16
16
|
import { ManagedValidator } from "../validators/managed-validator.mjs";
|
|
17
17
|
import { ScalarValidator } from "../validators/scalar-validator.mjs";
|
|
18
18
|
import { StringValidator } from "../validators/string-validator.mjs";
|
|
19
|
+
import "../validators/index.mjs";
|
|
19
20
|
//#region ../../packages/seal/src/types/inference-types.d.ts
|
|
20
21
|
/**
|
|
21
22
|
* Two inference shapes describe the two halves of the validation pipeline:
|
|
@@ -91,7 +92,7 @@ type IsGuaranteed<V> = V extends {
|
|
|
91
92
|
* guaranteed by `.default()` or `.catch()` — runtime always has a value
|
|
92
93
|
* for guaranteed fields, so the output type marks them required.
|
|
93
94
|
*/
|
|
94
|
-
type IsOutputOptionalKey<V> = V extends {
|
|
95
|
+
export type IsOutputOptionalKey<V> = V extends {
|
|
95
96
|
isOptional: true;
|
|
96
97
|
} ? IsGuaranteed<V> extends true ? false : true : false;
|
|
97
98
|
/**
|
|
@@ -100,7 +101,7 @@ type IsOutputOptionalKey<V> = V extends {
|
|
|
100
101
|
* is present — any of those means the caller doesn't have to supply a value
|
|
101
102
|
* (it'll be filled, defaulted, or rescued).
|
|
102
103
|
*/
|
|
103
|
-
type IsInputOptionalKey<V> = V extends {
|
|
104
|
+
export type IsInputOptionalKey<V> = V extends {
|
|
104
105
|
isOptional: true;
|
|
105
106
|
} | {
|
|
106
107
|
hasDefault: true;
|
|
@@ -112,7 +113,7 @@ type IsInputOptionalKey<V> = V extends {
|
|
|
112
113
|
* object type, so `Infer<>` reads (and compares) as a single literal instead
|
|
113
114
|
* of an intersection of two mapped types.
|
|
114
115
|
*/
|
|
115
|
-
type Flatten<T> = { [K in keyof T]: T[K] } & {};
|
|
116
|
+
type Flatten<T> = { [K in keyof T]: T[K]; } & {};
|
|
116
117
|
/**
|
|
117
118
|
* Apply `| null` widening when the validator type carries `{ isNullable: true }`.
|
|
118
119
|
*
|
|
@@ -131,20 +132,20 @@ type WithNullable<V, T> = V extends {
|
|
|
131
132
|
* walker on the parent class's type parameter creates a recursive class-base
|
|
132
133
|
* reference when combined with brand-checks.
|
|
133
134
|
*/
|
|
134
|
-
type InferOutputObjectShape<S extends Schema> = Flatten<{ [K in keyof S as IsOutputOptionalKey<S[K]> extends true ? K : never]?: Infer.Output<S[K]
|
|
135
|
+
export type InferOutputObjectShape<S extends Schema> = Flatten<{ [K in keyof S as IsOutputOptionalKey<S[K]> extends true ? K : never]?: Infer.Output<S[K]>; } & { [K in keyof S as IsOutputOptionalKey<S[K]> extends true ? never : K]: Infer.Output<S[K]>; }>;
|
|
135
136
|
/**
|
|
136
137
|
* Compute the inferred *input* object shape for a Schema. Mirror of
|
|
137
138
|
* `InferOutputObjectShape` but uses `IsInputOptionalKey` — fields with
|
|
138
139
|
* `.default()` or `.catch()` (or `.optional()`) are all marked optional in
|
|
139
140
|
* the input shape.
|
|
140
141
|
*/
|
|
141
|
-
type InferInputObjectShape<S extends Schema> = Flatten<{ [K in keyof S as IsInputOptionalKey<S[K]> extends true ? K : never]?: Infer.Input<S[K]
|
|
142
|
+
export type InferInputObjectShape<S extends Schema> = Flatten<{ [K in keyof S as IsInputOptionalKey<S[K]> extends true ? K : never]?: Infer.Input<S[K]>; } & { [K in keyof S as IsInputOptionalKey<S[K]> extends true ? never : K]: Infer.Input<S[K]>; }>;
|
|
142
143
|
/**
|
|
143
144
|
* Bare `Infer<T>` defaults to `Infer.Input<T>`. Use `Infer.Output<T>` when
|
|
144
145
|
* typing validated data (Cascade `Model<>` params, validate() returns).
|
|
145
146
|
*/
|
|
146
|
-
type Infer<T> = Infer.Input<T>;
|
|
147
|
-
declare namespace Infer {
|
|
147
|
+
export type Infer<T> = Infer.Input<T>;
|
|
148
|
+
export declare namespace Infer {
|
|
148
149
|
/**
|
|
149
150
|
* Inferred *input* shape — what callers send before validation. Optional
|
|
150
151
|
* keys whenever `.optional()`, `.default()`, or `.catch()` is present.
|
|
@@ -165,20 +166,20 @@ declare namespace Infer {
|
|
|
165
166
|
* @deprecated Use `Infer.Input<T>` instead. Kept as an alias for one or two
|
|
166
167
|
* minor versions to ease migration; removed thereafter.
|
|
167
168
|
*/
|
|
168
|
-
type InferInput<T> = Infer.Input<T>;
|
|
169
|
+
export type InferInput<T> = Infer.Input<T>;
|
|
169
170
|
/**
|
|
170
171
|
* @deprecated Use `Infer.Output<T>` instead. Kept as an alias for one or two
|
|
171
172
|
* minor versions to ease migration; removed thereafter.
|
|
172
173
|
*/
|
|
173
|
-
type InferOutput<T> = Infer.Output<T>;
|
|
174
|
+
export type InferOutput<T> = Infer.Output<T>;
|
|
174
175
|
/**
|
|
175
176
|
* @deprecated Use `InferOutputObjectShape<S>` instead. Kept for back-compat.
|
|
176
177
|
*/
|
|
177
|
-
type InferObjectShape<S extends Schema> = InferOutputObjectShape<S>;
|
|
178
|
+
export type InferObjectShape<S extends Schema> = InferOutputObjectShape<S>;
|
|
178
179
|
/**
|
|
179
180
|
* @deprecated Use `IsOutputOptionalKey<V>` instead. Kept for back-compat.
|
|
180
181
|
*/
|
|
181
|
-
type IsOptionalKey<V> = IsOutputOptionalKey<V>;
|
|
182
|
+
export type IsOptionalKey<V> = IsOutputOptionalKey<V>;
|
|
182
183
|
/**
|
|
183
184
|
* The `data` type `validate(schema, input)` returns on success.
|
|
184
185
|
*
|
|
@@ -189,7 +190,7 @@ type IsOptionalKey<V> = IsOutputOptionalKey<V>;
|
|
|
189
190
|
* `validate()` was typed, so untyped call sites keep compiling. A
|
|
190
191
|
* `v.record(...)` with a typed value keeps its `Record<string, …>` output.
|
|
191
192
|
*/
|
|
192
|
-
type ValidatedOutput<T> = [Infer.Output<T>] extends [infer O] ? unknown extends O ? any : O extends object ? string extends keyof O ? unknown extends O[keyof O] ? any : O : O : O : never;
|
|
193
|
+
export type ValidatedOutput<T> = [Infer.Output<T>] extends [infer O] ? unknown extends O ? any : O extends object ? string extends keyof O ? unknown extends O[keyof O] ? any : O : O : O : never;
|
|
193
194
|
//#endregion
|
|
194
|
-
export {
|
|
195
|
+
export {};
|
|
195
196
|
//# sourceMappingURL=inference-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/inference-types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"inference-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/inference-types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqFK,aAAa,KAAK;EAAY;WAE/B;EAAY;;;;;;;;YAUJ,oBAAoB,KAAK;EAAY;IAC7C,aAAa;;;;;;;YAWL,mBAAmB,KAAK;EAC9B;;EACA;;EACA;;;;;;;KASD,QAAQ,QAAQ,WAAW,IAAI,EAAE;;;;;;;;KASjC,aAAa,GAAG,KAAK;EAAY;IAAqB,WAAW;;;;;;;;;YAU1D,uBAAuB,UAAU,UAAU,WAElD,WAAW,KAAK,oBAAoB,EAAE,mBAAmB,aAAa,MAAM,OAAO,EAAE,YAErF,WAAW,KAAK,oBAAoB,EAAE,2BAA2B,IAAI,MAAM,OAAO,EAAE;;;;;;;YAU7E,sBAAsB,UAAU,UAAU,WAEjD,WAAW,KAAK,mBAAmB,EAAE,mBAAmB,aAAa,MAAM,MAAM,EAAE,YAEnF,WAAW,KAAK,mBAAmB,EAAE,2BAA2B,IAAI,MAAM,MAAM,EAAE;;;;;YAQ3E,MAAM,KAAK,MAAM,MAAM;yBAGlB;;;;;OAKH,MAAM,KAChB,UAAU,oBAAoB,KAC1B,MAAM,KACN,UAAU,uCAAuC,YAC/C,iBAAiB,oBAAoB,KACnC,UAAU,gBACR,aAAa,GAAG,MAAM,sBAG1B,UAAU,sBAAsB,KAC9B,aAAa,GAAG,sBAAsB,MACtC,UAAU,iBACR;IAAY,iBAAiB,UAAU;MACrC,aAAa,GAAG,MAAM,MAAM,eAE9B,UAAU,uBAAuB,KAC/B,aAAa,GAAG,aAChB,UAAU,0BAA0B,KAClC,aAAa,GAAG,KAChB,UAAU,wBAAwB,KAChC,IACA,UAAU,uBAAuB,KAC/B,IACA,UAAU,uBAAuB,UAC/B,aAAa,GAAG,KAChB,UAAU,kBACR,aAAa,aACb,UAAU,eACR,aAAa,aACb,UAAU,iBACR,aAAa,aACb,UAAU,mBACR,aAAa,cACb,UAAU,gBACR,aAAa,GAAG,QAChB,UAAU,kBACR,aAAa,gCACb,UAAU;;;;;;OAShC,OAAO,KACjB,UAAU,oBAAoB,KAC1B,OAAO,KACP,UAAU,uCAAuC,YAC/C,iBAAiB,oBAAoB,KACnC,UAAU,gBACR,aAAa,GAAG,OAAO,sBAG3B,UAAU,sBAAsB,KAC9B,aAAa,GAAG,uBAAuB,MACvC,UAAU,iBACR;IAAY,iBAAiB,UAAU;MACrC,aAAa,GAAG,MAAM,OAAO,eAE/B,UAAU,uBAAuB,KAC/B,aAAa,GAAG,aAChB,UAAU,0BAA0B,KAClC,aAAa,GAAG,KAChB,UAAU,wBAAwB,KAChC,IACA,UAAU,uBAAuB,KAC/B,IAMA,UAAU,mBACR,aAAa,GAAG,iBAAiB,YAAY,MAC7C,UAAU,kBACR,aAAa,aACb,UAAU,eACR,aAAa,aACb,UAAU,iBACR,aAAa,aACb,UAAU,mBACR,aAAa,cACb,UAAU,gBACR,aAAa,GAAG,QAChB,UAAU,kBACR,aAAa,gCACb,UAAU;;;;;;YASlC,WAAW,KAAK,MAAM,MAAM;;;;;YAM5B,YAAY,KAAK,MAAM,OAAO;;;;YAK9B,iBAAiB,UAAU,UAAU,uBAAuB;;;;YAK5D,cAAc,KAAK,oBAAoB;;;;;;;;;;;YAYvC,gBAAgB,MAAM,MAAM,OAAO,mBAAmB,qBAC9C,UAEd,wCACuB,oBACH,QAAQ,WAEtB,IACF,IACF"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { SchemaContext } from "./context-types.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/seal/src/types/mutator-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Mutator context
|
|
6
5
|
*/
|
|
7
|
-
type MutatorContext<Options = any> = {
|
|
8
|
-
/** Mutator options */
|
|
6
|
+
export type MutatorContext<Options = any> = {
|
|
7
|
+
/** Mutator options */
|
|
8
|
+
options: Options;
|
|
9
|
+
/** Global validation context */
|
|
9
10
|
ctx: SchemaContext;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Mutator function - transforms data before validation
|
|
13
14
|
*/
|
|
14
|
-
type Mutator<Options = any> = (data: any, context?: MutatorContext<Options>) => Promise<any>;
|
|
15
|
+
export type Mutator<Options = any> = (data: any, context?: MutatorContext<Options>) => Promise<any>;
|
|
15
16
|
/**
|
|
16
17
|
* Contextualized mutator - mutator with runtime context
|
|
17
18
|
*/
|
|
18
|
-
type ContextualizedMutator<Options = any> = {
|
|
19
|
-
/** Mutation function */
|
|
19
|
+
export type ContextualizedMutator<Options = any> = {
|
|
20
|
+
/** Mutation function */
|
|
21
|
+
mutate: Mutator<Options>;
|
|
22
|
+
/** Mutator context */
|
|
20
23
|
context: {
|
|
21
24
|
options: Options;
|
|
22
25
|
ctx: SchemaContext;
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
//#endregion
|
|
26
|
-
export { ContextualizedMutator, Mutator, MutatorContext };
|
|
27
29
|
//# sourceMappingURL=mutator-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutator-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/mutator-types.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"mutator-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/mutator-types.ts"],"mappings":";;;;;YAKY,eAAe;;EAEzB,SAAS;;EAET,KAAK;;;;;YAMK,QAAQ,kBAAkB,WAAW,UAAU,eAAe,aAAa;;;;YAK3E,sBAAsB;;EAEhC,QAAQ,QAAQ;;EAEhB;IACE,SAAS;IACT,KAAK"}
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Validation result
|
|
4
4
|
*/
|
|
5
|
-
type ValidationResult = {
|
|
6
|
-
/** Whether validation passed */
|
|
7
|
-
|
|
5
|
+
export type ValidationResult = {
|
|
6
|
+
/** Whether validation passed */
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
/** Validated and potentially mutated data */
|
|
9
|
+
data: any;
|
|
10
|
+
/** List of validation errors */
|
|
8
11
|
errors: {
|
|
9
|
-
/** Rule type that failed */
|
|
10
|
-
|
|
12
|
+
/** Rule type that failed */
|
|
13
|
+
type: string;
|
|
14
|
+
/** Error message */
|
|
15
|
+
error: string;
|
|
16
|
+
/** Input field name */
|
|
11
17
|
input: string;
|
|
12
18
|
}[];
|
|
13
19
|
};
|
|
@@ -26,7 +32,7 @@ type ValidationResult = {
|
|
|
26
32
|
* result.data; // Infer.Output<typeof schema>
|
|
27
33
|
* ```
|
|
28
34
|
*/
|
|
29
|
-
type TypedValidationResult<TData> = {
|
|
35
|
+
export type TypedValidationResult<TData> = {
|
|
30
36
|
isValid: true;
|
|
31
37
|
data: TData;
|
|
32
38
|
errors: ValidationResult["errors"];
|
|
@@ -36,5 +42,4 @@ type TypedValidationResult<TData> = {
|
|
|
36
42
|
errors: ValidationResult["errors"];
|
|
37
43
|
};
|
|
38
44
|
//#endregion
|
|
39
|
-
export { TypedValidationResult, ValidationResult };
|
|
40
45
|
//# sourceMappingURL=result-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/result-types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"result-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/result-types.ts"],"mappings":";;;;YAGY;;EAEV;;EAEA;;EAEA;;IAEE;;IAEA;;IAEA;;;;;;;;;;;;;;;;;;YAmBQ,sBAAsB;EAC5B;EAAe,MAAM;EAAO,QAAQ;;EACpC;EAAgB;EAAiB,QAAQ"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SchemaContext } from "./context-types.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/seal/src/types/rule-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Rule validation result
|
|
6
5
|
*/
|
|
7
|
-
type RuleResult = {
|
|
6
|
+
export type RuleResult = {
|
|
8
7
|
isValid: false;
|
|
9
8
|
error: string;
|
|
10
9
|
input: string;
|
|
@@ -18,31 +17,39 @@ type RuleResult = {
|
|
|
18
17
|
path: string;
|
|
19
18
|
}>;
|
|
20
19
|
} | {
|
|
21
|
-
isValid: true;
|
|
20
|
+
isValid: true;
|
|
21
|
+
/** Replace the validated value, including an explicit undefined output. */
|
|
22
22
|
data?: unknown;
|
|
23
23
|
};
|
|
24
24
|
type AttributeValue = string | number;
|
|
25
|
-
type ValidationAttributesList = Record<string, AttributeValue | Record<string, AttributeValue>>;
|
|
25
|
+
export type ValidationAttributesList = Record<string, AttributeValue | Record<string, AttributeValue>>;
|
|
26
26
|
/**
|
|
27
27
|
* Rule options - generic options passed to rules
|
|
28
28
|
*/
|
|
29
|
-
type SchemaRuleOptions<T = any> = Record<string, T>;
|
|
29
|
+
export type SchemaRuleOptions<T = any> = Record<string, T>;
|
|
30
30
|
/**
|
|
31
31
|
* Schema rule definition
|
|
32
32
|
*/
|
|
33
|
-
type SchemaRule<Options extends SchemaRuleOptions = SchemaRuleOptions> = {
|
|
34
|
-
/** Rule name */
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
export type SchemaRule<Options extends SchemaRuleOptions = SchemaRuleOptions> = {
|
|
34
|
+
/** Rule name */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Rule description */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Whether the rule requires a non-undefined value */
|
|
39
|
+
requiresValue?: boolean;
|
|
40
|
+
/** Validation function */
|
|
41
|
+
validate: (this: ContextualSchemaRule<Options>, value: any, context: SchemaContext) => Promise<RuleResult>;
|
|
42
|
+
/** Default error message */
|
|
43
|
+
defaultErrorMessage?: string;
|
|
44
|
+
/** Error message */
|
|
45
|
+
errorMessage?: string;
|
|
46
|
+
/** Sort order for rule execution */
|
|
40
47
|
sortOrder?: number;
|
|
41
48
|
};
|
|
42
49
|
/**
|
|
43
50
|
* Contextualized schema rule - rule with runtime context
|
|
44
51
|
*/
|
|
45
|
-
type ContextualSchemaRule<Options extends SchemaRuleOptions = SchemaRuleOptions> = SchemaRule & {
|
|
52
|
+
export type ContextualSchemaRule<Options extends SchemaRuleOptions = SchemaRuleOptions> = SchemaRule & {
|
|
46
53
|
/**
|
|
47
54
|
* The context object is used to pass additional information to the rule
|
|
48
55
|
* This will be always overridden when the rule is injected into a validator
|
|
@@ -51,11 +58,13 @@ type ContextualSchemaRule<Options extends SchemaRuleOptions = SchemaRuleOptions>
|
|
|
51
58
|
errorMessage?: string;
|
|
52
59
|
options: Options;
|
|
53
60
|
attributesList: ValidationAttributesList;
|
|
54
|
-
translatedAttributes: Record<string, string>;
|
|
55
|
-
|
|
61
|
+
translatedAttributes: Record<string, string>;
|
|
62
|
+
/** Raw placeholder values — substituted as-is (enums, numbers, computed strings) */
|
|
63
|
+
translationParams: Record<string, any>;
|
|
64
|
+
/** Field-key placeholder values — passed through the attribute translator before substitution */
|
|
56
65
|
translatableParams: Record<string, string>;
|
|
57
66
|
};
|
|
58
67
|
};
|
|
59
68
|
//#endregion
|
|
60
|
-
export {
|
|
69
|
+
export {};
|
|
61
70
|
//# sourceMappingURL=rule-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/rule-types.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"rule-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/rule-types.ts"],"mappings":";;;;;YAKY;EAEN;EACA;EACA;EACA;;;;;EAKA,SAAS;IAAQ;IAAe;;;EAGhC;;EAEA;;KAGD;YAEO,2BAA2B,eAErC,iBAAiB,eAAe;;;;YAMtB,kBAAkB,WAAW,eAAe;;;;YAK5C,WAAW,gBAAgB,oBAAoB;;EAEzD;;EAEA;;EAEA;;EAEA,WACE,MAAM,qBAAqB,UAC3B,YACA,SAAS,kBACN,QAAQ;;EAEb;;EAEA;;EAEA;;;;;YAMU,qBAAqB,gBAAgB,oBAAoB,qBACnE;;;;;EAKE;IACE;IACA,SAAS;IACT,gBAAgB;IAChB,sBAAsB;;IAEtB,mBAAmB;;IAEnB,oBAAoB"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { BaseValidator } from "../validators/base-validator.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/seal/src/types/schema-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Schema definition - a record of validators
|
|
6
5
|
*/
|
|
7
|
-
type Schema = Record<string, BaseValidator>;
|
|
6
|
+
export type Schema = Record<string, BaseValidator>;
|
|
8
7
|
//#endregion
|
|
9
|
-
export { Schema };
|
|
10
8
|
//# sourceMappingURL=schema-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/schema-types.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"schema-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/schema-types.ts"],"mappings":";;;;;YAKY,SAAS,eAAe"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs";
|
|
2
2
|
import { BaseValidator } from "./base-validator.mjs";
|
|
3
|
-
|
|
4
3
|
//#region ../../packages/seal/src/validators/any-validator.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Any validator - accepts any value
|
|
7
6
|
*/
|
|
8
|
-
declare class AnyValidator extends BaseValidator {
|
|
7
|
+
export declare class AnyValidator extends BaseValidator {
|
|
9
8
|
/**
|
|
10
9
|
* Any validator means any value, so we disable the default required requirement.
|
|
11
10
|
*/
|
|
@@ -29,5 +28,4 @@ declare class AnyValidator extends BaseValidator {
|
|
|
29
28
|
toJsonSchema(target?: JsonSchemaTarget): JsonSchemaResult;
|
|
30
29
|
}
|
|
31
30
|
//#endregion
|
|
32
|
-
export { AnyValidator };
|
|
33
31
|
//# sourceMappingURL=any-validator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any-validator.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/validators/any-validator.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"any-validator.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/validators/any-validator.ts"],"mappings":";;;;;;qBAOa,qBAAqB;;;;EAIhB;;;;EAKA;;;;;;;;;;;;;EAcA,aAAa,SAAQ,mBAAqC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs";
|
|
2
2
|
import { SchemaContext } from "../types/context-types.mjs";
|
|
3
3
|
import { ValidationResult } from "../types/result-types.mjs";
|
|
4
|
+
import "../types/index.mjs";
|
|
4
5
|
import { BaseValidator } from "./base-validator.mjs";
|
|
5
|
-
|
|
6
6
|
//#region ../../packages/seal/src/validators/array-validator.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Array validator class
|
|
9
9
|
*/
|
|
10
|
-
declare class ArrayValidator extends BaseValidator {
|
|
10
|
+
export declare class ArrayValidator extends BaseValidator {
|
|
11
11
|
validator: BaseValidator;
|
|
12
12
|
constructor(validator: BaseValidator, errorMessage?: string);
|
|
13
13
|
/**
|
|
@@ -82,5 +82,4 @@ declare class ArrayValidator extends BaseValidator {
|
|
|
82
82
|
toJsonSchema(target?: JsonSchemaTarget): JsonSchemaResult;
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
|
-
export { ArrayValidator };
|
|
86
85
|
//# sourceMappingURL=array-validator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-validator.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/validators/array-validator.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"array-validator.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/validators/array-validator.ts"],"mappings":";;;;;;;;;qBAmBa,uBAAuB;EAEzB,WAAW;EADpB,YACS,WAAW,eAClB;;;;EAUK,YAAY;;;;EAOH;;EAST;;EAKA;;EAKA;;EAKA,KAAK,4BAAmC;;EAKxC,IAAI,aAAa;;EAKjB,UAAU,gBAAgB;;EAK1B,IAAI,aAAa;;EAKjB,UAAU,gBAAgB;;EAK1B,OAAO,gBAAgB;;;;;;;;;;;;;;;EAkBvB,QAAQ,aAAa,aAAa;;;;EAUlC,cAAc,aAAa,aAAa;;EAKxC,OAAO;;EAKP,OAAO,4BAAmC;;EAK1C,OAAO,WAAW,SAAS;;;;;;;EAWrB,SAAS,WAAW,SAAS,gBAAgB,QAAQ;;;;;;;;;;;;EAgElD,aAAa,SAAQ,mBAAqC"}
|
|
@@ -5,12 +5,12 @@ import { SchemaContext } from "../types/context-types.mjs";
|
|
|
5
5
|
import { ValidationResult } from "../types/result-types.mjs";
|
|
6
6
|
import { ContextualizedMutator, Mutator } from "../types/mutator-types.mjs";
|
|
7
7
|
import { ContextualizedTransformer, SimpleTransformerCallback, TransformerCallback } from "../types/data-transformer-types.mjs";
|
|
8
|
-
|
|
8
|
+
import "../types/index.mjs";
|
|
9
9
|
//#region ../../packages/seal/src/validators/base-validator.d.ts
|
|
10
10
|
/**
|
|
11
11
|
* Base validator class - foundation for all validators
|
|
12
12
|
*/
|
|
13
|
-
declare class BaseValidator<TInput = unknown, TOutput = TInput> {
|
|
13
|
+
export declare class BaseValidator<TInput = unknown, TOutput = TInput> {
|
|
14
14
|
rules: ContextualSchemaRule[];
|
|
15
15
|
protected refinements: ContextualSchemaRule[];
|
|
16
16
|
mutators: ContextualizedMutator[];
|
|
@@ -495,5 +495,4 @@ declare class BaseValidator<TInput = unknown, TOutput = TInput> {
|
|
|
495
495
|
toJsonSchema(_target?: JsonSchemaTarget): JsonSchemaResult;
|
|
496
496
|
}
|
|
497
497
|
//#endregion
|
|
498
|
-
export { BaseValidator };
|
|
499
498
|
//# sourceMappingURL=base-validator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-validator.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/validators/base-validator.ts"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"base-validator.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/validators/base-validator.ts"],"mappings":";;;;;;;;;;;;qBAyBa,cAAc,kBAAkB,UAAU;EAC9C,OAAO;YACJ,aAAa;EAChB,UAAU;YACP;YACA;YACA;YACA;YACA;;YAEA;;;;;;;;YASA,oBAEJ,QAAQ,4BAA4B,6BAA6B;YAC7D;;;;;;;;EASH;;;;;;;;EASA,cAAc;;;;YAKX,kBAAkB;;;;;;YAOlB,gBAAgB;;;;YAKhB,sBAAsB;;;;MAKrB;;;;MAQA;;;;;;gBAUG;;;;;EAQP;;;;;;;EAUA;IAAqB;;;;;;;;EAYrB;IAAwB;;;;;;;;;;;;;;;;;;;;EAwBxB,eAAe,WAAW,qBAAqB;;;;;;;;;;;;;;;;;;;EAyB/C,sBAAsB,WAAW,qBAAqB;;;;;;;;;;;;;;;;;;EAwBtD,SAAS,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCnB,OAAO;;;;;EAUD,4BAA4B,WAAW,SAAS,gBAAa;;;;;;;;;;;;;;;;;;EA4BnE,WAAW,YAAY,wBAAwB;;;;EAY/C,gBAAgB,YAAY;;;;EAY5B,SAAS;;;;;;;;;;;;;;;;;;;;;;;EA4BT,YAAY;;;;;;;;;;;;;;;;;;;EAsBZ;;;;;;;EA+BA,iBAAiB;;;;;;;;;;;;;;;;;;EAsBjB;;;;EASA;;;;EAOA;;;;EAOA,QAAQ,UAAU,oBAAoB,mBAC3C,MAAM,WAAW,IACjB,uBACA,UAAS;;;;;;;;;;;;;;;;;;;EAyBJ,gBAAgB,UAAU,oBAAoB,mBACnD,MAAM,WAAW,IACjB,uBACA,UAAS;;;;EAWJ,eAAe,UAAU,oBAAoB,mBAClD,MAAM,WAAW,IACjB,uBACA,UAAS,IACR,qBAAqB;;;;YAWd,WAAW,UAAU,oBAAoB,mBACjD,MAAM,WAAW,IACjB,uBACA,UAAS,IACR,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;EA8CjB,QAAQ,UAAU,oBAAoB,mBAC3C,MAAM,WAAW,IACjB,UAAU;IAAM;;;;;;EAUX,OACL,WACE,OAAO,mDACP,SAAS,kBACN;;YAoBS,aACd,QAAQ,kBACR,SAAS,gBACR,QAAQ;;;;EAkBJ,WAAW,SAAS,SAAS;;;;EAS7B,kBAAkB,SAAS,SAAS;;;;;;;;EAiBpC,QAAQ;IAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoC9B,MACL,kBAEM,QAAQ,4BAA4B,6BAA6B;IAC7D;;;;;EAYC,OAAO,WAAW,SAAS,gBAAa;;;;EAc9C,MAAM;;;;EASA,SAAS,WAAW,SAAS,gBAAgB,QAAQ;;YAclD,cAAc,WAAW,SAAS,gBAAgB,QAAQ;;;;YA8HhE,sBAAsB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAoDjB,qBAAqB,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCjD,aAAa,UAAS,mBAAqC"}
|
|
@@ -672,7 +672,8 @@ var BaseValidator = class {
|
|
|
672
672
|
vendor: "seal",
|
|
673
673
|
types: void 0,
|
|
674
674
|
validate: async (value) => {
|
|
675
|
-
|
|
675
|
+
const result = await validate(this, value);
|
|
676
|
+
return mapToStandardResult(result);
|
|
676
677
|
},
|
|
677
678
|
jsonSchema: {
|
|
678
679
|
input: (options) => this.toJsonSchema(options.target),
|