justus 0.1.6 → 0.2.1

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.
Files changed (117) hide show
  1. package/dist/{dts-generator.js → dts-generator.cjs} +6 -15
  2. package/dist/dts-generator.cjs.map +6 -0
  3. package/{dts-generator.d.ts → dist/dts-generator.d.ts} +1 -1
  4. package/dist/dts-generator.mjs +5 -23
  5. package/dist/dts-generator.mjs.map +2 -2
  6. package/dist/errors.cjs +113 -0
  7. package/dist/errors.cjs.map +6 -0
  8. package/dist/errors.d.ts +55 -0
  9. package/dist/errors.mjs +85 -0
  10. package/dist/errors.mjs.map +6 -0
  11. package/dist/index.cjs +133 -0
  12. package/dist/index.cjs.map +6 -0
  13. package/dist/index.d.ts +47 -0
  14. package/dist/index.mjs +23 -817
  15. package/dist/index.mjs.map +3 -3
  16. package/dist/schema.cjs +43 -0
  17. package/dist/schema.cjs.map +6 -0
  18. package/dist/schema.d.ts +16 -0
  19. package/dist/schema.mjs +17 -0
  20. package/dist/schema.mjs.map +6 -0
  21. package/dist/types.cjs +60 -0
  22. package/dist/types.cjs.map +6 -0
  23. package/dist/types.d.ts +138 -0
  24. package/dist/types.mjs +33 -0
  25. package/dist/types.mjs.map +6 -0
  26. package/dist/utilities.cjs +52 -0
  27. package/dist/utilities.cjs.map +6 -0
  28. package/dist/utilities.d.ts +7 -0
  29. package/dist/utilities.mjs +27 -0
  30. package/dist/utilities.mjs.map +6 -0
  31. package/dist/validators/any.cjs +39 -0
  32. package/dist/validators/any.cjs.map +6 -0
  33. package/dist/validators/any.d.ts +7 -0
  34. package/dist/validators/any.mjs +13 -0
  35. package/dist/validators/any.mjs.map +6 -0
  36. package/dist/validators/array.cjs +104 -0
  37. package/dist/validators/array.cjs.map +6 -0
  38. package/dist/validators/array.d.ts +32 -0
  39. package/dist/validators/array.mjs +76 -0
  40. package/dist/validators/array.mjs.map +6 -0
  41. package/dist/validators/boolean.cjs +56 -0
  42. package/dist/validators/boolean.cjs.map +6 -0
  43. package/dist/validators/boolean.d.ts +21 -0
  44. package/dist/validators/boolean.mjs +30 -0
  45. package/dist/validators/boolean.mjs.map +6 -0
  46. package/dist/validators/constant.cjs +51 -0
  47. package/dist/validators/constant.cjs.map +6 -0
  48. package/dist/validators/constant.d.ts +12 -0
  49. package/dist/validators/constant.mjs +24 -0
  50. package/dist/validators/constant.mjs.map +6 -0
  51. package/dist/validators/date.cjs +80 -0
  52. package/dist/validators/date.cjs.map +6 -0
  53. package/dist/validators/date.d.ts +22 -0
  54. package/dist/validators/date.mjs +54 -0
  55. package/dist/validators/date.mjs.map +6 -0
  56. package/dist/validators/never.cjs +44 -0
  57. package/dist/validators/never.cjs.map +6 -0
  58. package/dist/validators/never.d.ts +9 -0
  59. package/dist/validators/never.mjs +18 -0
  60. package/dist/validators/never.mjs.map +6 -0
  61. package/dist/validators/number.cjs +153 -0
  62. package/dist/validators/number.cjs.map +6 -0
  63. package/dist/validators/number.d.ts +48 -0
  64. package/dist/validators/number.mjs +126 -0
  65. package/dist/validators/number.mjs.map +6 -0
  66. package/dist/validators/object.cjs +129 -0
  67. package/dist/validators/object.cjs.map +6 -0
  68. package/dist/validators/object.d.ts +22 -0
  69. package/dist/validators/object.mjs +105 -0
  70. package/dist/validators/object.mjs.map +6 -0
  71. package/dist/validators/optional.cjs +61 -0
  72. package/dist/validators/optional.cjs.map +6 -0
  73. package/dist/validators/optional.d.ts +21 -0
  74. package/dist/validators/optional.mjs +35 -0
  75. package/dist/validators/optional.mjs.map +6 -0
  76. package/dist/validators/string.cjs +84 -0
  77. package/dist/validators/string.cjs.map +6 -0
  78. package/dist/validators/string.d.ts +35 -0
  79. package/dist/validators/string.mjs +57 -0
  80. package/dist/validators/string.mjs.map +6 -0
  81. package/dist/validators/tuple.cjs +95 -0
  82. package/dist/validators/tuple.cjs.map +6 -0
  83. package/dist/validators/tuple.d.ts +15 -0
  84. package/dist/validators/tuple.mjs +69 -0
  85. package/dist/validators/tuple.mjs.map +6 -0
  86. package/dist/validators/union.cjs +78 -0
  87. package/dist/validators/union.cjs.map +6 -0
  88. package/dist/validators/union.d.ts +22 -0
  89. package/dist/validators/union.mjs +50 -0
  90. package/dist/validators/union.mjs.map +6 -0
  91. package/dist/validators/url.cjs +117 -0
  92. package/dist/validators/url.cjs.map +6 -0
  93. package/dist/validators/url.d.ts +57 -0
  94. package/dist/validators/url.mjs +91 -0
  95. package/dist/validators/url.mjs.map +6 -0
  96. package/package.json +33 -23
  97. package/src/dts-generator.ts +6 -21
  98. package/src/index.ts +23 -23
  99. package/src/schema.ts +11 -9
  100. package/src/types.ts +42 -26
  101. package/src/utilities.ts +9 -6
  102. package/src/validators/array.ts +6 -5
  103. package/src/validators/boolean.ts +2 -2
  104. package/src/validators/constant.ts +3 -1
  105. package/src/validators/date.ts +1 -1
  106. package/src/validators/never.ts +4 -2
  107. package/src/validators/number.ts +8 -7
  108. package/src/validators/object.ts +15 -18
  109. package/src/validators/optional.ts +5 -7
  110. package/src/validators/string.ts +8 -6
  111. package/src/validators/tuple.ts +7 -5
  112. package/src/validators/union.ts +7 -5
  113. package/src/validators/url.ts +8 -7
  114. package/dist/dts-generator.js.map +0 -6
  115. package/dist/index.js +0 -948
  116. package/dist/index.js.map +0 -6
  117. package/index.d.ts +0 -618
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // validators/array.ts
21
+ var array_exports = {};
22
+ __export(array_exports, {
23
+ AnyArrayValidator: () => AnyArrayValidator,
24
+ ArrayValidator: () => ArrayValidator,
25
+ array: () => array,
26
+ arrayOf: () => arrayOf
27
+ });
28
+ module.exports = __toCommonJS(array_exports);
29
+ var import_errors = require("../errors.cjs");
30
+ var import_types = require("../types.cjs");
31
+ var import_utilities = require("../utilities.cjs");
32
+ var import_any = require("./any.cjs");
33
+ var AnyArrayValidator = class extends import_types.AbstractValidator {
34
+ validate(value) {
35
+ (0, import_errors.assertValidation)(Array.isArray(value), 'Value is not an "array"');
36
+ return [...value];
37
+ }
38
+ };
39
+ var ArrayValidator = class extends import_types.AbstractValidator {
40
+ maxItems;
41
+ minItems;
42
+ uniqueItems;
43
+ items;
44
+ constructor(options = {}) {
45
+ super();
46
+ const {
47
+ items = import_any.any,
48
+ maxItems = Number.POSITIVE_INFINITY,
49
+ minItems = 0,
50
+ uniqueItems = false
51
+ } = options;
52
+ (0, import_errors.assertSchema)(minItems >= 0, `Constraint "minItems" (${minItems}) must be non-negative`);
53
+ (0, import_errors.assertSchema)(maxItems >= 0, `Constraint "maxItems" (${maxItems}) must be non-negative`);
54
+ (0, import_errors.assertSchema)(minItems <= maxItems, `Constraint "minItems" (${minItems}) is greater than "maxItems" (${maxItems})`);
55
+ this.items = items;
56
+ this.maxItems = maxItems;
57
+ this.minItems = minItems;
58
+ this.uniqueItems = uniqueItems;
59
+ }
60
+ validate(value, options) {
61
+ (0, import_errors.assertValidation)(Array.isArray(value), 'Value is not an "array"');
62
+ (0, import_errors.assertValidation)(
63
+ value.length >= this.minItems,
64
+ `Array must have a minimum length of ${this.minItems}`
65
+ );
66
+ (0, import_errors.assertValidation)(
67
+ value.length <= this.maxItems,
68
+ `Array must have a maximum length of ${this.maxItems}`
69
+ );
70
+ const builder = new import_errors.ValidationErrorBuilder();
71
+ const clone = new Array(value.length);
72
+ value.forEach((item, i) => {
73
+ try {
74
+ const position = value.indexOf(value[i]);
75
+ if (position === i) {
76
+ clone[i] = this.items.validate(item, options);
77
+ } else if (this.uniqueItems) {
78
+ builder.record(`Duplicate of item at index ${position}`, i);
79
+ } else {
80
+ clone[i] = clone[position];
81
+ }
82
+ } catch (error) {
83
+ builder.record(error, i);
84
+ }
85
+ });
86
+ return builder.assert(clone);
87
+ }
88
+ };
89
+ function _array(constraints) {
90
+ const items = constraints.items ? (0, import_utilities.getValidator)(constraints.items) : import_any.any;
91
+ return new ArrayValidator({ ...constraints, items });
92
+ }
93
+ var array = (0, import_types.makeValidatorFactory)(new AnyArrayValidator(), _array);
94
+ function arrayOf(validation) {
95
+ return new ArrayValidator({ items: (0, import_utilities.getValidator)(validation) });
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ AnyArrayValidator,
100
+ ArrayValidator,
101
+ array,
102
+ arrayOf
103
+ });
104
+ //# sourceMappingURL=array.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/array.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuE;AACvE,mBAAwD;AACxD,uBAA6B;AAC7B,iBAAoB;AAqBb,IAAM,oBAAN,cAAyC,+BAAuB;AAAA,EACrE,SAAS,OAAqB;AAC5B,wCAAiB,MAAM,QAAQ,KAAK,GAAG,yBAAyB;AAChE,WAAO,CAAE,GAAG,KAAM;AAAA,EACpB;AACF;AAGO,IAAM,iBAAN,cAAgC,+BAAuB;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,UAA0C,CAAC,GAAG;AACxD,UAAM;AAEN,UAAM;AAAA,MACJ,QAAQ;AAAA,MACR,WAAW,OAAO;AAAA,MAClB,W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AS,QAA8B,YAAgD;AAC5F,SAAO,IAAI,eAAe,EAAE,WAAO,+BAAa,UAAU,EAAE,CAAC;AAC/D;",
5
+ "names": []
6
+ }
@@ -0,0 +1,32 @@
1
+ import { AbstractValidator } from '../types';
2
+ import type { InferValidation, Validation, ValidationOptions, Validator } from '../types';
3
+ /** Constraints to validate an `Array` with. */
4
+ export interface ArrayConstraints<V extends Validation> {
5
+ /** The _maximum_ number of elements a valid `Array`: `value.length <= maxItems` */
6
+ maxItems?: number;
7
+ /** The _minimum_ number of elements a valid `Array`: `value.length >= minItems` */
8
+ minItems?: number;
9
+ /** A flag indicating whether an `Array`'s elements must be unique */
10
+ uniqueItems?: boolean;
11
+ /** A `Validator` validating each individual item in an `Array` */
12
+ items?: V;
13
+ }
14
+ /** Basic validator for `Array` instances. */
15
+ export declare class AnyArrayValidator<T = any> extends AbstractValidator<T[]> {
16
+ validate(value: unknown): T[];
17
+ }
18
+ /** A validator for `Array` instances with constraints. */
19
+ export declare class ArrayValidator<T> extends AbstractValidator<T[]> {
20
+ readonly maxItems: number;
21
+ readonly minItems: number;
22
+ readonly uniqueItems: boolean;
23
+ readonly items: Validator<T>;
24
+ constructor(options?: ArrayConstraints<Validator<T>>);
25
+ validate(value: unknown, options?: ValidationOptions): T[];
26
+ }
27
+ declare function _array<V extends Validation>(constraints: ArrayConstraints<V>): ArrayValidator<InferValidation<V>>;
28
+ /** Validate `Array`s. */
29
+ export declare const array: typeof _array & AnyArrayValidator<any>;
30
+ /** Validate `Array`s containing only the specified elements. */
31
+ export declare function arrayOf<V extends Validation>(validation: V): Validator<InferValidation<V>[]>;
32
+ export {};
@@ -0,0 +1,76 @@
1
+ // validators/array.ts
2
+ import { assertSchema, assertValidation, ValidationErrorBuilder } from "../errors.mjs";
3
+ import { AbstractValidator, makeValidatorFactory } from "../types.mjs";
4
+ import { getValidator } from "../utilities.mjs";
5
+ import { any } from "./any.mjs";
6
+ var AnyArrayValidator = class extends AbstractValidator {
7
+ validate(value) {
8
+ assertValidation(Array.isArray(value), 'Value is not an "array"');
9
+ return [...value];
10
+ }
11
+ };
12
+ var ArrayValidator = class extends AbstractValidator {
13
+ maxItems;
14
+ minItems;
15
+ uniqueItems;
16
+ items;
17
+ constructor(options = {}) {
18
+ super();
19
+ const {
20
+ items = any,
21
+ maxItems = Number.POSITIVE_INFINITY,
22
+ minItems = 0,
23
+ uniqueItems = false
24
+ } = options;
25
+ assertSchema(minItems >= 0, `Constraint "minItems" (${minItems}) must be non-negative`);
26
+ assertSchema(maxItems >= 0, `Constraint "maxItems" (${maxItems}) must be non-negative`);
27
+ assertSchema(minItems <= maxItems, `Constraint "minItems" (${minItems}) is greater than "maxItems" (${maxItems})`);
28
+ this.items = items;
29
+ this.maxItems = maxItems;
30
+ this.minItems = minItems;
31
+ this.uniqueItems = uniqueItems;
32
+ }
33
+ validate(value, options) {
34
+ assertValidation(Array.isArray(value), 'Value is not an "array"');
35
+ assertValidation(
36
+ value.length >= this.minItems,
37
+ `Array must have a minimum length of ${this.minItems}`
38
+ );
39
+ assertValidation(
40
+ value.length <= this.maxItems,
41
+ `Array must have a maximum length of ${this.maxItems}`
42
+ );
43
+ const builder = new ValidationErrorBuilder();
44
+ const clone = new Array(value.length);
45
+ value.forEach((item, i) => {
46
+ try {
47
+ const position = value.indexOf(value[i]);
48
+ if (position === i) {
49
+ clone[i] = this.items.validate(item, options);
50
+ } else if (this.uniqueItems) {
51
+ builder.record(`Duplicate of item at index ${position}`, i);
52
+ } else {
53
+ clone[i] = clone[position];
54
+ }
55
+ } catch (error) {
56
+ builder.record(error, i);
57
+ }
58
+ });
59
+ return builder.assert(clone);
60
+ }
61
+ };
62
+ function _array(constraints) {
63
+ const items = constraints.items ? getValidator(constraints.items) : any;
64
+ return new ArrayValidator({ ...constraints, items });
65
+ }
66
+ var array = makeValidatorFactory(new AnyArrayValidator(), _array);
67
+ function arrayOf(validation) {
68
+ return new ArrayValidator({ items: getValidator(validation) });
69
+ }
70
+ export {
71
+ AnyArray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AI;AACF,cAAM,WAAW,MAAM,QAAQ,MAAM,CAAC,CAAC;AACvC,YAAI,aAAa,GAAG;AAClB,gBAAM,CAAC,IAAI,KAAK,MAAM,SAAS,MAAM,OAAO;AAAA,QAC9C,WAAW,KAAK,aAAa;AAC3B,kBAAQ,OAAO,8BAA8B,YAAY,CAAC;AAAA,QAC5D,OAAO;AACL,gBAAM,CAAC,IAAI,MAAM,QAAQ;AAAA,QAC3B;AAAA,MACF,SAAS,OAAP;AACA,gBAAQ,OAAO,OAAO,CAAC;AAAA,MACzB;AAAA,IACF,CAAC;AAED,WAAO,QAAQ,OAAO,KAAK;AAAA,EAC7B;AACF;AAIA,SAAS,OAA6B,aAAsE;AAC1G,QAAM,QAAQ,YAAY,QAAQ,aAAa,YAAY,KAAK,IAAI;AACpE,SAAO,IAAI,eAAe,EAAE,GAAG,aAAa,MAAM,CAAC;AACrD;AAGO,IAAM,QAAQ,qBAAqB,IAAI,kBAAkB,GAAG,MAAM;AAGlE,SAAS,QAA8B,YAAgD;AAC5F,SAAO,IAAI,eAAe,EAAE,OAAO,aAAa,UAAU,EAAE,CAAC;AAC/D;",
5
+ "names": []
6
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // validators/boolean.ts
21
+ var boolean_exports = {};
22
+ __export(boolean_exports, {
23
+ BooleanValidator: () => BooleanValidator,
24
+ boolean: () => boolean
25
+ });
26
+ module.exports = __toCommonJS(boolean_exports);
27
+ var import_errors = require("../errors.cjs");
28
+ var import_types = require("../types.cjs");
29
+ var BooleanValidator = class extends import_types.AbstractValidator {
30
+ fromString;
31
+ constructor(constraints = {}) {
32
+ super();
33
+ const { fromString = false } = constraints;
34
+ this.fromString = fromString;
35
+ }
36
+ validate(value) {
37
+ if (typeof value == "string" && this.fromString) {
38
+ const string = value.toLowerCase();
39
+ const parsed = string === "true" ? true : string === "false" ? false : void 0;
40
+ (0, import_errors.assertValidation)(parsed !== void 0, "Boolean can not be parsed from string");
41
+ value = parsed;
42
+ }
43
+ (0, import_errors.assertValidation)(typeof value === "boolean", 'Value is not a "boolean"');
44
+ return value;
45
+ }
46
+ };
47
+ function _boolean(constraints) {
48
+ return new BooleanValidator(constraints);
49
+ }
50
+ var boolean = (0, import_types.makeValidatorFactory)(new BooleanValidator(), _boolean);
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ BooleanValidator,
54
+ boolean
55
+ });
56
+ //# sourceMappingURL=boolean.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/boolean.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,mBAAwD;AAejD,IAAM,mBAAN,cAA+B,+BAA2B;AAAA,EACtD;AAAA,EAET,YAAY,cAAkC,CAAC,GAAG;AAChD,UAAM;AACN,UAAM,EAAE,aAAa,MAAM,IAAI;AAC/B,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA,SAAS,OAAyB;AAEhC,QAAK,OAAO,SAAS,YAAc,KAAK,YAAa;AACnD,YAAM,SAAS,MAAM,YAAY;AACjC,YAAM,SAAS,WAAW,SAAS,OAAO,WAAW,UAAU,QAAQ;AACvE,0CAAiB,WAAW,QAAW,uCAAuC;AAC9E,cAAQ;AAAA,IACV;AAEA,wCAAiB,OAAO,UAAU,WAAW,0BAA0B;AACvE,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SAAS,aAAmD;AACnE,SAAO,IAAI,iBAAiB,WAAW;AACzC;AAGO,IAAM,cAAU,mCAAqB,IAAI,iBAAiB,GAAG,QAAQ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,21 @@
1
+ import { AbstractValidator } from '../types';
2
+ /** Constraints to validate a `boolean` with. */
3
+ export interface BooleanConstraints {
4
+ /**
5
+ * Allow booleans to be parsed from strings (default: `false`).
6
+ *
7
+ * The string in question _MUST_ be either `true` or `false`, and will be
8
+ * compared regardless of case.
9
+ */
10
+ fromString?: boolean;
11
+ }
12
+ /** A `Validator` validating `boolean`s. */
13
+ export declare class BooleanValidator extends AbstractValidator<boolean> {
14
+ readonly fromString: boolean;
15
+ constructor(constraints?: BooleanConstraints);
16
+ validate(value: unknown): boolean;
17
+ }
18
+ declare function _boolean(constraints: BooleanConstraints): BooleanValidator;
19
+ /** The `Validator` for `boolean`s. */
20
+ export declare const boolean: typeof _boolean & BooleanValidator;
21
+ export {};
@@ -0,0 +1,30 @@
1
+ // validators/boolean.ts
2
+ import { assertValidation } from "../errors.mjs";
3
+ import { AbstractValidator, makeValidatorFactory } from "../types.mjs";
4
+ var BooleanValidator = class extends AbstractValidator {
5
+ fromString;
6
+ constructor(constraints = {}) {
7
+ super();
8
+ const { fromString = false } = constraints;
9
+ this.fromString = fromString;
10
+ }
11
+ validate(value) {
12
+ if (typeof value == "string" && this.fromString) {
13
+ const string = value.toLowerCase();
14
+ const parsed = string === "true" ? true : string === "false" ? false : void 0;
15
+ assertValidation(parsed !== void 0, "Boolean can not be parsed from string");
16
+ value = parsed;
17
+ }
18
+ assertValidation(typeof value === "boolean", 'Value is not a "boolean"');
19
+ return value;
20
+ }
21
+ };
22
+ function _boolean(constraints) {
23
+ return new BooleanValidator(constraints);
24
+ }
25
+ var boolean = makeValidatorFactory(new BooleanValidator(), _boolean);
26
+ export {
27
+ BooleanValidator,
28
+ boolean
29
+ };
30
+ //# sourceMappingURL=boolean.mjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/boolean.ts"],
4
+ "mappings": ";AAAA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB,4BAA4B;AAejD,IAAM,mBAAN,cAA+B,kBAA2B;AAAA,EACtD;AAAA,EAET,YAAY,cAAkC,CAAC,GAAG;AAChD,UAAM;AACN,UAAM,EAAE,aAAa,MAAM,IAAI;AAC/B,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA,SAAS,OAAyB;AAEhC,QAAK,OAAO,SAAS,YAAc,KAAK,YAAa;AACnD,YAAM,SAAS,MAAM,YAAY;AACjC,YAAM,SAAS,WAAW,SAAS,OAAO,WAAW,UAAU,QAAQ;AACvE,uBAAiB,WAAW,QAAW,uCAAuC;AAC9E,cAAQ;AAAA,IACV;AAEA,qBAAiB,OAAO,UAAU,WAAW,0BAA0B;AACvE,WAAO;AAAA,EACT;AACF;AAEA,SAAS,SAAS,aAAmD;AACnE,SAAO,IAAI,iBAAiB,WAAW;AACzC;AAGO,IAAM,UAAU,qBAAqB,IAAI,iBAAiB,GAAG,QAAQ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // validators/constant.ts
21
+ var constant_exports = {};
22
+ __export(constant_exports, {
23
+ ConstantValidator: () => ConstantValidator,
24
+ constant: () => constant,
25
+ nullValidator: () => nullValidator
26
+ });
27
+ module.exports = __toCommonJS(constant_exports);
28
+ var import_errors = require("../errors.cjs");
29
+ var import_types = require("../types.cjs");
30
+ var ConstantValidator = class extends import_types.AbstractValidator {
31
+ constant;
32
+ constructor(constant2) {
33
+ super();
34
+ this.constant = constant2;
35
+ }
36
+ validate(value) {
37
+ (0, import_errors.assertValidation)(value === this.constant, `Value does not match constant "${this.constant}"`);
38
+ return value;
39
+ }
40
+ };
41
+ function constant(constant2) {
42
+ return new ConstantValidator(constant2);
43
+ }
44
+ var nullValidator = new ConstantValidator(null);
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ ConstantValidator,
48
+ constant,
49
+ nullValidator
50
+ });
51
+ //# sourceMappingURL=constant.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/constant.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,mBAAkC;AAK3B,IAAM,oBAAN,cAA4E,+BAAqB;AAAA,EAC7F;AAAA,EAET,YAAYA,WAAa;AACvB,UAAM;AACN,SAAK,WAAWA;AAAA,EAClB;AAAA,EAEA,SAAS,OAAmB;AAC1B,wCAAiB,UAAU,KAAK,UAAU,kCAAkC,KAAK,WAAW;AAC5F,WAAO;AAAA,EACT;AACF;AAGO,SAAS,SAAqDA,WAA2B;AAC9F,SAAO,IAAI,kBAAkBA,SAAQ;AACvC;AAGO,IAAM,gBAAgB,IAAI,kBAAkB,IAAI;",
5
+ "names": ["constant"]
6
+ }
@@ -0,0 +1,12 @@
1
+ import { AbstractValidator } from '../types';
2
+ import type { Validator } from '../types';
3
+ /** A `Validator` for _constants_. */
4
+ export declare class ConstantValidator<T extends string | number | boolean | null> extends AbstractValidator<T> {
5
+ readonly constant: T;
6
+ constructor(constant: T);
7
+ validate(value: unknown): T;
8
+ }
9
+ /** Validate _constants_. */
10
+ export declare function constant<T extends string | number | boolean | null>(constant: T): Validator<T>;
11
+ /** The `Validator` for the `null` constant. */
12
+ export declare const nullValidator: ConstantValidator<null>;
@@ -0,0 +1,24 @@
1
+ // validators/constant.ts
2
+ import { assertValidation } from "../errors.mjs";
3
+ import { AbstractValidator } from "../types.mjs";
4
+ var ConstantValidator = class extends AbstractValidator {
5
+ constant;
6
+ constructor(constant2) {
7
+ super();
8
+ this.constant = constant2;
9
+ }
10
+ validate(value) {
11
+ assertValidation(value === this.constant, `Value does not match constant "${this.constant}"`);
12
+ return value;
13
+ }
14
+ };
15
+ function constant(constant2) {
16
+ return new ConstantValidator(constant2);
17
+ }
18
+ var nullValidator = new ConstantValidator(null);
19
+ export {
20
+ ConstantValidator,
21
+ constant,
22
+ nullValidator
23
+ };
24
+ //# sourceMappingURL=constant.mjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/constant.ts"],
4
+ "mappings": ";AAAA,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAK3B,IAAM,oBAAN,cAA4E,kBAAqB;AAAA,EAC7F;AAAA,EAET,YAAYA,WAAa;AACvB,UAAM;AACN,SAAK,WAAWA;AAAA,EAClB;AAAA,EAEA,SAAS,OAAmB;AAC1B,qBAAiB,UAAU,KAAK,UAAU,kCAAkC,KAAK,WAAW;AAC5F,WAAO;AAAA,EACT;AACF;AAGO,SAAS,SAAqDA,WAA2B;AAC9F,SAAO,IAAI,kBAAkBA,SAAQ;AACvC;AAGO,IAAM,gBAAgB,IAAI,kBAAkB,IAAI;",
5
+ "names": ["constant"]
6
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // validators/date.ts
21
+ var date_exports = {};
22
+ __export(date_exports, {
23
+ DateValidator: () => DateValidator,
24
+ date: () => date
25
+ });
26
+ module.exports = __toCommonJS(date_exports);
27
+ var import_errors = require("../errors.cjs");
28
+ var import_types = require("../types.cjs");
29
+ var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
30
+ var DateValidator = class extends import_types.AbstractValidator {
31
+ format;
32
+ from;
33
+ until;
34
+ constructor(constraints = {}) {
35
+ super();
36
+ const { format, from, until } = constraints;
37
+ if (from != void 0 && until !== void 0) {
38
+ (0, import_errors.assertSchema)(
39
+ until.getTime() >= from.getTime(),
40
+ `Constraint "until" (${until.toISOString()}) must not be before "from" (${from.toISOString()})`
41
+ );
42
+ }
43
+ this.format = format;
44
+ this.from = from;
45
+ this.until = until;
46
+ }
47
+ validate(value) {
48
+ let date2;
49
+ try {
50
+ date2 = new Date(value);
51
+ } catch (error) {
52
+ throw new import_errors.ValidationError('Value could not be converted to a "Date"');
53
+ }
54
+ if (isNaN(date2.getTime()))
55
+ throw new import_errors.ValidationError("Invalid date");
56
+ if (this.format === "iso") {
57
+ (0, import_errors.assertValidation)(typeof value === "string", 'ISO Date is not a "string"');
58
+ (0, import_errors.assertValidation)(ISO_8601_REGEX.test(value), "Invalid format for ISO Date");
59
+ } else if (this.format === "timestamp") {
60
+ (0, import_errors.assertValidation)(typeof value === "number", 'Timestamp is not a "number"');
61
+ }
62
+ if (this.from) {
63
+ (0, import_errors.assertValidation)(this.from.getTime() <= date2.getTime(), `Date is before ${this.from.toISOString()}`);
64
+ }
65
+ if (this.until) {
66
+ (0, import_errors.assertValidation)(this.until.getTime() >= date2.getTime(), `Date is after ${this.until.toISOString()}`);
67
+ }
68
+ return date2;
69
+ }
70
+ };
71
+ function _date(constraints) {
72
+ return new DateValidator(constraints);
73
+ }
74
+ var date = (0, import_types.makeValidatorFactory)(new DateValidator(), _date);
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ DateValidator,
78
+ date
79
+ });
80
+ //# sourceMappingURL=date.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/date.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgE;AAChE,mBAAwD;AAGxD,IAAM,iBAAiB;AAahB,IAAM,gBAAN,cAA4B,+BAAwB;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,cAA+B,CAAC,GAAG;AAC7C,UAAM;AAEN,UAAM,EAAE,QAAQ,MAAM,MAAM,IAAI;AAEhC,QAAK,QAAQ,UAAe,UAAU,QAAY;AAChD;AAAA,QAAa,MAAM,QAAQ,KAAK,KAAK,QAAQ;AAAA,QACzC,uBAAuB,MAAM,YAAY,iCAAiC,KAAK,YAAY;AAAA,MAAI;AAAA,IACrG;AAEA,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,SAAS,OAAsB;AAC7B,QAAIA;AACJ,QAAI;AACF,MAAAA,QAAO,IAAI,KAAK,KAAY;AAAA,IAC9B,SAAS,OAAP;AACA,YAAM,IAAI,8BAAgB,0CAA0C;AAAA,IACtE;AAEA,QAAI,MAAMA,MAAK,QAAQ,CAAC;AAAG,YAAM,IAAI,8BAAgB,cAAc;AAEnE,QAAI,KAAK,WAAW,OAAO;AACzB,0CAAiB,OAAO,UAAU,UAAU,4BAA4B;AACxE,0CAAiB,eAAe,KAAK,KAAK,GAAG,6BAA6B;AAAA,IAC5E,WAAW,KAAK,WAAW,aAAa;AACtC,0CAAiB,OAAO,UAAU,UAAU,6BAA6B;AAAA,IAC3E;AAEA,QAAI,KAAK,MAAM;AACb,0CAAiB,KAAK,KAAK,QAAQ,KAAKA,MAAK,QAAQ,GAAG,kBAAkB,KAAK,KAAK,YAAY,GAAG;AAAA,IACrG;AAEA,QAAI,KAAK,OAAO;AACd,0CAAiB,KAAK,MAAM,QAAQ,KAAKA,MAAK,QAAQ,GAAG,iBAAiB,KAAK,MAAM,YAAY,GAAG;AAAA,IACtG;AAEA,WAAOA;AAAA,EACT;AACF;AAEA,SAAS,MAAM,aAA6C;AAC1D,SAAO,IAAI,cAAc,WAAW;AACtC;AAGO,IAAM,WAAO,mCAAqB,IAAI,cAAc,GAAG,KAAK;",
5
+ "names": ["date"]
6
+ }
@@ -0,0 +1,22 @@
1
+ import { AbstractValidator } from '../types';
2
+ /** Constraints to validate a `Date` with. */
3
+ export interface DateConstraints {
4
+ /** The format for dates, an _ISO date_ (RFC 3339) or a numeric timestamp */
5
+ format?: 'iso' | 'timestamp';
6
+ /** The earliest value a date can have */
7
+ from?: Date;
8
+ /** The latest value a date can have */
9
+ until?: Date;
10
+ }
11
+ /** A `Validator` validating dates and converting them to `Date` instances. */
12
+ export declare class DateValidator extends AbstractValidator<Date> {
13
+ readonly format?: 'iso' | 'timestamp';
14
+ readonly from?: Date;
15
+ readonly until?: Date;
16
+ constructor(constraints?: DateConstraints);
17
+ validate(value: unknown): Date;
18
+ }
19
+ declare function _date(constraints: DateConstraints): DateValidator;
20
+ /** Validate dates and convert them to `Date` instances. */
21
+ export declare const date: typeof _date & DateValidator;
22
+ export {};
@@ -0,0 +1,54 @@
1
+ // validators/date.ts
2
+ import { assertSchema, assertValidation, ValidationError } from "../errors.mjs";
3
+ import { AbstractValidator, makeValidatorFactory } from "../types.mjs";
4
+ var ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
5
+ var DateValidator = class extends AbstractValidator {
6
+ format;
7
+ from;
8
+ until;
9
+ constructor(constraints = {}) {
10
+ super();
11
+ const { format, from, until } = constraints;
12
+ if (from != void 0 && until !== void 0) {
13
+ assertSchema(
14
+ until.getTime() >= from.getTime(),
15
+ `Constraint "until" (${until.toISOString()}) must not be before "from" (${from.toISOString()})`
16
+ );
17
+ }
18
+ this.format = format;
19
+ this.from = from;
20
+ this.until = until;
21
+ }
22
+ validate(value) {
23
+ let date2;
24
+ try {
25
+ date2 = new Date(value);
26
+ } catch (error) {
27
+ throw new ValidationError('Value could not be converted to a "Date"');
28
+ }
29
+ if (isNaN(date2.getTime()))
30
+ throw new ValidationError("Invalid date");
31
+ if (this.format === "iso") {
32
+ assertValidation(typeof value === "string", 'ISO Date is not a "string"');
33
+ assertValidation(ISO_8601_REGEX.test(value), "Invalid format for ISO Date");
34
+ } else if (this.format === "timestamp") {
35
+ assertValidation(typeof value === "number", 'Timestamp is not a "number"');
36
+ }
37
+ if (this.from) {
38
+ assertValidation(this.from.getTime() <= date2.getTime(), `Date is before ${this.from.toISOString()}`);
39
+ }
40
+ if (this.until) {
41
+ assertValidation(this.until.getTime() >= date2.getTime(), `Date is after ${this.until.toISOString()}`);
42
+ }
43
+ return date2;
44
+ }
45
+ };
46
+ function _date(constraints) {
47
+ return new DateValidator(constraints);
48
+ }
49
+ var date = makeValidatorFactory(new DateValidator(), _date);
50
+ export {
51
+ DateValidator,
52
+ date
53
+ };
54
+ //# sourceMappingURL=date.mjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/validators/date.ts"],
4
+ "mappings": ";AAAA,SAAS,cAAc,kBAAkB,uBAAuB;AAChE,SAAS,mBAAmB,4BAA4B;AAGxD,IAAM,iBAAiB;AAahB,IAAM,gBAAN,cAA4B,kBAAwB;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,cAA+B,CAAC,GAAG;AAC7C,UAAM;AAEN,UAAM,EAAE,QAAQ,MAAM,MAAM,IAAI;AAEhC,QAAK,QAAQ,UAAe,UAAU,QAAY;AAChD;AAAA,QAAa,MAAM,QAAQ,KAAK,KAAK,QAAQ;AAAA,QACzC,uBAAuB,MAAM,YAAY,iCAAiC,KAAK,YAAY;AAAA,MAAI;AAAA,IACrG;AAEA,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,SAAS,OAAsB;AAC7B,QAAIA;AACJ,QAAI;AACF,MAAAA,QAAO,IAAI,KAAK,KAAY;AAAA,IAC9B,SAAS,OAAP;AACA,YAAM,IAAI,gBAAgB,0CAA0C;AAAA,IACtE;AAEA,QAAI,MAAMA,MAAK,QAAQ,CAAC;AAAG,YAAM,IAAI,gBAAgB,cAAc;AAEnE,QAAI,KAAK,WAAW,OAAO;AACzB,uBAAiB,OAAO,UAAU,UAAU,4BAA4B;AACxE,uBAAiB,eAAe,KAAK,KAAK,GAAG,6BAA6B;AAAA,IAC5E,WAAW,KAAK,WAAW,aAAa;AACtC,uBAAiB,OAAO,UAAU,UAAU,6BAA6B;AAAA,IAC3E;AAEA,QAAI,KAAK,MAAM;AACb,uBAAiB,KAAK,KAAK,QAAQ,KAAKA,MAAK,QAAQ,GAAG,k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