@sinclair/typebox 0.25.23 → 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.
- package/compiler/compiler.d.ts +25 -28
- package/compiler/compiler.js +495 -495
- package/compiler/index.d.ts +2 -2
- package/compiler/index.js +47 -47
- package/conditional/conditional.d.ts +17 -17
- package/conditional/conditional.js +91 -91
- package/conditional/index.d.ts +2 -2
- package/conditional/index.js +45 -45
- package/conditional/structural.d.ts +11 -11
- package/conditional/structural.js +685 -685
- package/custom/custom.d.ts +12 -12
- package/custom/custom.js +55 -55
- package/custom/index.d.ts +1 -1
- package/custom/index.js +44 -44
- package/errors/errors.d.ts +67 -67
- package/errors/errors.js +472 -468
- package/errors/index.d.ts +1 -1
- package/errors/index.js +44 -44
- package/format/format.d.ts +12 -12
- package/format/format.js +55 -55
- package/format/index.d.ts +1 -1
- package/format/index.js +44 -44
- package/guard/extends.d.ts +10 -0
- package/guard/extends.js +50 -0
- package/guard/guard.d.ts +60 -60
- package/guard/guard.js +440 -440
- package/guard/index.d.ts +2 -1
- package/guard/index.js +45 -44
- package/hash/hash.d.ts +8 -8
- package/hash/hash.js +183 -183
- package/hash/index.d.ts +1 -1
- package/hash/index.js +44 -44
- package/license +22 -22
- package/package.json +55 -52
- package/readme.md +1237 -1325
- package/system/index.d.ts +1 -1
- package/system/index.js +44 -44
- package/system/system.d.ts +17 -17
- package/system/system.js +69 -69
- package/typebox.d.ts +422 -422
- package/typebox.js +388 -388
- package/value/cast.d.ts +26 -26
- package/value/cast.js +415 -420
- package/value/check.d.ts +8 -8
- package/value/check.js +405 -395
- package/value/clone.d.ts +3 -3
- package/value/clone.js +71 -71
- package/value/create.d.ts +14 -14
- package/value/create.js +378 -388
- package/value/delta.d.ts +43 -43
- package/value/delta.js +204 -204
- package/value/equal.d.ts +3 -3
- package/value/equal.js +80 -80
- package/value/index.d.ts +4 -4
- package/value/index.js +53 -53
- package/value/is.d.ts +11 -11
- package/value/is.js +53 -53
- package/value/pointer.d.ts +24 -24
- package/value/pointer.js +142 -142
- package/value/value.d.ts +32 -32
- package/value/value.js +87 -87
package/system/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './system';
|
|
1
|
+
export * from './system';
|
package/system/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
|
-
|
|
4
|
-
@sinclair/typebox/system
|
|
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("./system"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
@sinclair/typebox/system
|
|
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("./system"), exports);
|
package/system/system.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export declare class TypeSystemDuplicateTypeKind extends Error {
|
|
2
|
-
constructor(kind: string);
|
|
3
|
-
}
|
|
4
|
-
export declare class TypeSystemDuplicateFormat extends Error {
|
|
5
|
-
constructor(kind: string);
|
|
6
|
-
}
|
|
7
|
-
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
|
8
|
-
export declare namespace TypeSystem {
|
|
9
|
-
/** Sets whether arrays should be treated as kinds of objects. The default is `false` */
|
|
10
|
-
let AllowArrayObjects: boolean;
|
|
11
|
-
/** Sets whether numeric checks should consider NaN a valid number type. The default is `false` */
|
|
12
|
-
let AllowNaN: boolean;
|
|
13
|
-
/** Creates a custom type */
|
|
14
|
-
function CreateType<Type, Options = object>(kind: string, callback: (options: Options, value: unknown) => boolean): (options?: Partial<Options>) => import("../typebox").TUnsafe<Type>;
|
|
15
|
-
/** Creates a custom string format */
|
|
16
|
-
function CreateFormat(format: string, callback: (value: string) => boolean): (value: string) => boolean;
|
|
17
|
-
}
|
|
1
|
+
export declare class TypeSystemDuplicateTypeKind extends Error {
|
|
2
|
+
constructor(kind: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class TypeSystemDuplicateFormat extends Error {
|
|
5
|
+
constructor(kind: string);
|
|
6
|
+
}
|
|
7
|
+
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
|
8
|
+
export declare namespace TypeSystem {
|
|
9
|
+
/** Sets whether arrays should be treated as kinds of objects. The default is `false` */
|
|
10
|
+
let AllowArrayObjects: boolean;
|
|
11
|
+
/** Sets whether numeric checks should consider NaN a valid number type. The default is `false` */
|
|
12
|
+
let AllowNaN: boolean;
|
|
13
|
+
/** Creates a custom type */
|
|
14
|
+
function CreateType<Type, Options = object>(kind: string, callback: (options: Options, value: unknown) => boolean): (options?: Partial<Options>) => import("../typebox").TUnsafe<Type>;
|
|
15
|
+
/** Creates a custom string format */
|
|
16
|
+
function CreateFormat(format: string, callback: (value: string) => boolean): (value: string) => boolean;
|
|
17
|
+
}
|
package/system/system.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
|
-
|
|
4
|
-
@sinclair/typebox/system
|
|
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.TypeSystem = exports.TypeSystemDuplicateFormat = exports.TypeSystemDuplicateTypeKind = void 0;
|
|
31
|
-
const typebox_1 = require("../typebox");
|
|
32
|
-
const index_1 = require("../custom/index");
|
|
33
|
-
const index_2 = require("../format/index");
|
|
34
|
-
class TypeSystemDuplicateTypeKind extends Error {
|
|
35
|
-
constructor(kind) {
|
|
36
|
-
super(`Duplicate kind '${kind}' detected`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.TypeSystemDuplicateTypeKind = TypeSystemDuplicateTypeKind;
|
|
40
|
-
class TypeSystemDuplicateFormat extends Error {
|
|
41
|
-
constructor(kind) {
|
|
42
|
-
super(`Duplicate format '${kind}' detected`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.TypeSystemDuplicateFormat = TypeSystemDuplicateFormat;
|
|
46
|
-
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
|
47
|
-
var TypeSystem;
|
|
48
|
-
(function (TypeSystem) {
|
|
49
|
-
/** Sets whether arrays should be treated as kinds of objects. The default is `false` */
|
|
50
|
-
TypeSystem.AllowArrayObjects = false;
|
|
51
|
-
/** Sets whether numeric checks should consider NaN a valid number type. The default is `false` */
|
|
52
|
-
TypeSystem.AllowNaN = false;
|
|
53
|
-
/** Creates a custom type */
|
|
54
|
-
function CreateType(kind, callback) {
|
|
55
|
-
if (index_1.Custom.Has(kind))
|
|
56
|
-
throw new TypeSystemDuplicateTypeKind(kind);
|
|
57
|
-
index_1.Custom.Set(kind, callback);
|
|
58
|
-
return (options = {}) => typebox_1.Type.Unsafe({ ...options, [typebox_1.Kind]: kind });
|
|
59
|
-
}
|
|
60
|
-
TypeSystem.CreateType = CreateType;
|
|
61
|
-
/** Creates a custom string format */
|
|
62
|
-
function CreateFormat(format, callback) {
|
|
63
|
-
if (index_2.Format.Has(format))
|
|
64
|
-
throw new TypeSystemDuplicateFormat(format);
|
|
65
|
-
index_2.Format.Set(format, callback);
|
|
66
|
-
return callback;
|
|
67
|
-
}
|
|
68
|
-
TypeSystem.CreateFormat = CreateFormat;
|
|
69
|
-
})(TypeSystem = exports.TypeSystem || (exports.TypeSystem = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
4
|
+
@sinclair/typebox/system
|
|
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.TypeSystem = exports.TypeSystemDuplicateFormat = exports.TypeSystemDuplicateTypeKind = void 0;
|
|
31
|
+
const typebox_1 = require("../typebox");
|
|
32
|
+
const index_1 = require("../custom/index");
|
|
33
|
+
const index_2 = require("../format/index");
|
|
34
|
+
class TypeSystemDuplicateTypeKind extends Error {
|
|
35
|
+
constructor(kind) {
|
|
36
|
+
super(`Duplicate kind '${kind}' detected`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.TypeSystemDuplicateTypeKind = TypeSystemDuplicateTypeKind;
|
|
40
|
+
class TypeSystemDuplicateFormat extends Error {
|
|
41
|
+
constructor(kind) {
|
|
42
|
+
super(`Duplicate format '${kind}' detected`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.TypeSystemDuplicateFormat = TypeSystemDuplicateFormat;
|
|
46
|
+
/** Creates user defined types and formats and provides overrides for value checking behaviours */
|
|
47
|
+
var TypeSystem;
|
|
48
|
+
(function (TypeSystem) {
|
|
49
|
+
/** Sets whether arrays should be treated as kinds of objects. The default is `false` */
|
|
50
|
+
TypeSystem.AllowArrayObjects = false;
|
|
51
|
+
/** Sets whether numeric checks should consider NaN a valid number type. The default is `false` */
|
|
52
|
+
TypeSystem.AllowNaN = false;
|
|
53
|
+
/** Creates a custom type */
|
|
54
|
+
function CreateType(kind, callback) {
|
|
55
|
+
if (index_1.Custom.Has(kind))
|
|
56
|
+
throw new TypeSystemDuplicateTypeKind(kind);
|
|
57
|
+
index_1.Custom.Set(kind, callback);
|
|
58
|
+
return (options = {}) => typebox_1.Type.Unsafe({ ...options, [typebox_1.Kind]: kind });
|
|
59
|
+
}
|
|
60
|
+
TypeSystem.CreateType = CreateType;
|
|
61
|
+
/** Creates a custom string format */
|
|
62
|
+
function CreateFormat(format, callback) {
|
|
63
|
+
if (index_2.Format.Has(format))
|
|
64
|
+
throw new TypeSystemDuplicateFormat(format);
|
|
65
|
+
index_2.Format.Set(format, callback);
|
|
66
|
+
return callback;
|
|
67
|
+
}
|
|
68
|
+
TypeSystem.CreateFormat = CreateFormat;
|
|
69
|
+
})(TypeSystem = exports.TypeSystem || (exports.TypeSystem = {}));
|