@sinclair/typebox 0.25.24 → 0.25.25

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 (61) hide show
  1. package/compiler/compiler.d.ts +25 -28
  2. package/compiler/compiler.js +495 -498
  3. package/compiler/index.d.ts +2 -2
  4. package/compiler/index.js +47 -47
  5. package/conditional/conditional.d.ts +17 -17
  6. package/conditional/conditional.js +91 -91
  7. package/conditional/index.d.ts +2 -2
  8. package/conditional/index.js +45 -45
  9. package/conditional/structural.d.ts +11 -11
  10. package/conditional/structural.js +685 -685
  11. package/custom/custom.d.ts +12 -12
  12. package/custom/custom.js +55 -55
  13. package/custom/index.d.ts +1 -1
  14. package/custom/index.js +44 -44
  15. package/errors/errors.d.ts +67 -67
  16. package/errors/errors.js +472 -472
  17. package/errors/index.d.ts +1 -1
  18. package/errors/index.js +44 -44
  19. package/format/format.d.ts +12 -12
  20. package/format/format.js +55 -55
  21. package/format/index.d.ts +1 -1
  22. package/format/index.js +44 -44
  23. package/guard/extends.d.ts +10 -10
  24. package/guard/extends.js +50 -50
  25. package/guard/guard.d.ts +60 -60
  26. package/guard/guard.js +440 -440
  27. package/guard/index.d.ts +2 -2
  28. package/guard/index.js +45 -45
  29. package/hash/hash.d.ts +8 -8
  30. package/hash/hash.js +183 -183
  31. package/hash/index.d.ts +1 -1
  32. package/hash/index.js +44 -44
  33. package/license +22 -22
  34. package/package.json +55 -52
  35. package/readme.md +1237 -1237
  36. package/system/index.d.ts +1 -1
  37. package/system/index.js +44 -44
  38. package/system/system.d.ts +17 -17
  39. package/system/system.js +69 -69
  40. package/typebox.d.ts +422 -422
  41. package/typebox.js +388 -388
  42. package/value/cast.d.ts +26 -26
  43. package/value/cast.js +415 -415
  44. package/value/check.d.ts +8 -8
  45. package/value/check.js +405 -405
  46. package/value/clone.d.ts +3 -3
  47. package/value/clone.js +71 -71
  48. package/value/create.d.ts +14 -14
  49. package/value/create.js +378 -378
  50. package/value/delta.d.ts +43 -43
  51. package/value/delta.js +204 -204
  52. package/value/equal.d.ts +3 -3
  53. package/value/equal.js +80 -80
  54. package/value/index.d.ts +4 -4
  55. package/value/index.js +53 -53
  56. package/value/is.d.ts +11 -11
  57. package/value/is.js +53 -53
  58. package/value/pointer.d.ts +24 -24
  59. package/value/pointer.js +142 -142
  60. package/value/value.d.ts +32 -32
  61. package/value/value.js +87 -87
@@ -1,12 +1,12 @@
1
- export type CustomValidationFunction<TSchema> = (schema: TSchema, value: unknown) => boolean;
2
- /** Provides functions to create user defined types */
3
- export declare namespace Custom {
4
- /** Clears all user defined types */
5
- function Clear(): void;
6
- /** Returns true if this user defined type exists */
7
- function Has(kind: string): boolean;
8
- /** Sets a validation function for a user defined type */
9
- function Set<TSchema = unknown>(kind: string, func: CustomValidationFunction<TSchema>): void;
10
- /** Gets a custom validation function for a user defined type */
11
- function Get(kind: string): CustomValidationFunction<any> | undefined;
12
- }
1
+ export type CustomValidationFunction<TSchema> = (schema: TSchema, value: unknown) => boolean;
2
+ /** Provides functions to create user defined types */
3
+ export declare namespace Custom {
4
+ /** Clears all user defined types */
5
+ function Clear(): void;
6
+ /** Returns true if this user defined type exists */
7
+ function Has(kind: string): boolean;
8
+ /** Sets a validation function for a user defined type */
9
+ function Set<TSchema = unknown>(kind: string, func: CustomValidationFunction<TSchema>): void;
10
+ /** Gets a custom validation function for a user defined type */
11
+ function Get(kind: string): CustomValidationFunction<any> | undefined;
12
+ }
package/custom/custom.js CHANGED
@@ -1,55 +1,55 @@
1
- "use strict";
2
- /*--------------------------------------------------------------------------
3
-
4
- @sinclair/typebox/custom
5
-
6
- The MIT License (MIT)
7
-
8
- Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in
18
- all copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
- THE SOFTWARE.
27
-
28
- ---------------------------------------------------------------------------*/
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.Custom = void 0;
31
- /** Provides functions to create user defined types */
32
- var Custom;
33
- (function (Custom) {
34
- const customs = new Map();
35
- /** Clears all user defined types */
36
- function Clear() {
37
- return customs.clear();
38
- }
39
- Custom.Clear = Clear;
40
- /** Returns true if this user defined type exists */
41
- function Has(kind) {
42
- return customs.has(kind);
43
- }
44
- Custom.Has = Has;
45
- /** Sets a validation function for a user defined type */
46
- function Set(kind, func) {
47
- customs.set(kind, func);
48
- }
49
- Custom.Set = Set;
50
- /** Gets a custom validation function for a user defined type */
51
- function Get(kind) {
52
- return customs.get(kind);
53
- }
54
- Custom.Get = Get;
55
- })(Custom = exports.Custom || (exports.Custom = {}));
1
+ "use strict";
2
+ /*--------------------------------------------------------------------------
3
+
4
+ @sinclair/typebox/custom
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ ---------------------------------------------------------------------------*/
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.Custom = void 0;
31
+ /** Provides functions to create user defined types */
32
+ var Custom;
33
+ (function (Custom) {
34
+ const customs = new Map();
35
+ /** Clears all user defined types */
36
+ function Clear() {
37
+ return customs.clear();
38
+ }
39
+ Custom.Clear = Clear;
40
+ /** Returns true if this user defined type exists */
41
+ function Has(kind) {
42
+ return customs.has(kind);
43
+ }
44
+ Custom.Has = Has;
45
+ /** Sets a validation function for a user defined type */
46
+ function Set(kind, func) {
47
+ customs.set(kind, func);
48
+ }
49
+ Custom.Set = Set;
50
+ /** Gets a custom validation function for a user defined type */
51
+ function Get(kind) {
52
+ return customs.get(kind);
53
+ }
54
+ Custom.Get = Get;
55
+ })(Custom = exports.Custom || (exports.Custom = {}));
package/custom/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './custom';
1
+ export * from './custom';
package/custom/index.js CHANGED
@@ -1,44 +1,44 @@
1
- "use strict";
2
- /*--------------------------------------------------------------------------
3
-
4
- @sinclair/typebox/custom
5
-
6
- The MIT License (MIT)
7
-
8
- Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in
18
- all copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
- THE SOFTWARE.
27
-
28
- ---------------------------------------------------------------------------*/
29
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
30
- if (k2 === undefined) k2 = k;
31
- var desc = Object.getOwnPropertyDescriptor(m, k);
32
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
33
- desc = { enumerable: true, get: function() { return m[k]; } };
34
- }
35
- Object.defineProperty(o, k2, desc);
36
- }) : (function(o, m, k, k2) {
37
- if (k2 === undefined) k2 = k;
38
- o[k2] = m[k];
39
- }));
40
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
41
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- __exportStar(require("./custom"), exports);
1
+ "use strict";
2
+ /*--------------------------------------------------------------------------
3
+
4
+ @sinclair/typebox/custom
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ ---------------------------------------------------------------------------*/
29
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ var desc = Object.getOwnPropertyDescriptor(m, k);
32
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
33
+ desc = { enumerable: true, get: function() { return m[k]; } };
34
+ }
35
+ Object.defineProperty(o, k2, desc);
36
+ }) : (function(o, m, k, k2) {
37
+ if (k2 === undefined) k2 = k;
38
+ o[k2] = m[k];
39
+ }));
40
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
41
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ __exportStar(require("./custom"), exports);
@@ -1,67 +1,67 @@
1
- import * as Types from '../typebox';
2
- export declare enum ValueErrorType {
3
- Array = 0,
4
- ArrayMinItems = 1,
5
- ArrayMaxItems = 2,
6
- ArrayUniqueItems = 3,
7
- Boolean = 4,
8
- Date = 5,
9
- DateExclusiveMinimumTimestamp = 6,
10
- DateExclusiveMaximumTimestamp = 7,
11
- DateMinimumTimestamp = 8,
12
- DateMaximumTimestamp = 9,
13
- Function = 10,
14
- Integer = 11,
15
- IntegerMultipleOf = 12,
16
- IntegerExclusiveMinimum = 13,
17
- IntegerExclusiveMaximum = 14,
18
- IntegerMinimum = 15,
19
- IntegerMaximum = 16,
20
- Literal = 17,
21
- Never = 18,
22
- Null = 19,
23
- Number = 20,
24
- NumberMultipleOf = 21,
25
- NumberExclusiveMinimum = 22,
26
- NumberExclusiveMaximum = 23,
27
- NumberMinumum = 24,
28
- NumberMaximum = 25,
29
- Object = 26,
30
- ObjectMinProperties = 27,
31
- ObjectMaxProperties = 28,
32
- ObjectAdditionalProperties = 29,
33
- ObjectRequiredProperties = 30,
34
- Promise = 31,
35
- RecordKeyNumeric = 32,
36
- RecordKeyString = 33,
37
- String = 34,
38
- StringMinLength = 35,
39
- StringMaxLength = 36,
40
- StringPattern = 37,
41
- StringFormatUnknown = 38,
42
- StringFormat = 39,
43
- TupleZeroLength = 40,
44
- TupleLength = 41,
45
- Undefined = 42,
46
- Union = 43,
47
- Uint8Array = 44,
48
- Uint8ArrayMinByteLength = 45,
49
- Uint8ArrayMaxByteLength = 46,
50
- Void = 47,
51
- Custom = 48
52
- }
53
- export interface ValueError {
54
- type: ValueErrorType;
55
- schema: Types.TSchema;
56
- path: string;
57
- value: unknown;
58
- message: string;
59
- }
60
- export declare class ValueErrorsUnknownTypeError extends Error {
61
- readonly schema: Types.TSchema;
62
- constructor(schema: Types.TSchema);
63
- }
64
- /** Provides functionality to generate a sequence of errors against a TypeBox type. */
65
- export declare namespace ValueErrors {
66
- function Errors<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): IterableIterator<ValueError>;
67
- }
1
+ import * as Types from '../typebox';
2
+ export declare enum ValueErrorType {
3
+ Array = 0,
4
+ ArrayMinItems = 1,
5
+ ArrayMaxItems = 2,
6
+ ArrayUniqueItems = 3,
7
+ Boolean = 4,
8
+ Date = 5,
9
+ DateExclusiveMinimumTimestamp = 6,
10
+ DateExclusiveMaximumTimestamp = 7,
11
+ DateMinimumTimestamp = 8,
12
+ DateMaximumTimestamp = 9,
13
+ Function = 10,
14
+ Integer = 11,
15
+ IntegerMultipleOf = 12,
16
+ IntegerExclusiveMinimum = 13,
17
+ IntegerExclusiveMaximum = 14,
18
+ IntegerMinimum = 15,
19
+ IntegerMaximum = 16,
20
+ Literal = 17,
21
+ Never = 18,
22
+ Null = 19,
23
+ Number = 20,
24
+ NumberMultipleOf = 21,
25
+ NumberExclusiveMinimum = 22,
26
+ NumberExclusiveMaximum = 23,
27
+ NumberMinumum = 24,
28
+ NumberMaximum = 25,
29
+ Object = 26,
30
+ ObjectMinProperties = 27,
31
+ ObjectMaxProperties = 28,
32
+ ObjectAdditionalProperties = 29,
33
+ ObjectRequiredProperties = 30,
34
+ Promise = 31,
35
+ RecordKeyNumeric = 32,
36
+ RecordKeyString = 33,
37
+ String = 34,
38
+ StringMinLength = 35,
39
+ StringMaxLength = 36,
40
+ StringPattern = 37,
41
+ StringFormatUnknown = 38,
42
+ StringFormat = 39,
43
+ TupleZeroLength = 40,
44
+ TupleLength = 41,
45
+ Undefined = 42,
46
+ Union = 43,
47
+ Uint8Array = 44,
48
+ Uint8ArrayMinByteLength = 45,
49
+ Uint8ArrayMaxByteLength = 46,
50
+ Void = 47,
51
+ Custom = 48
52
+ }
53
+ export interface ValueError {
54
+ type: ValueErrorType;
55
+ schema: Types.TSchema;
56
+ path: string;
57
+ value: unknown;
58
+ message: string;
59
+ }
60
+ export declare class ValueErrorsUnknownTypeError extends Error {
61
+ readonly schema: Types.TSchema;
62
+ constructor(schema: Types.TSchema);
63
+ }
64
+ /** Provides functionality to generate a sequence of errors against a TypeBox type. */
65
+ export declare namespace ValueErrors {
66
+ function Errors<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): IterableIterator<ValueError>;
67
+ }