@sinclair/typebox 0.32.32 → 0.32.34
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/build/cjs/errors/errors.js +2 -2
- package/build/cjs/errors/function.js +3 -4
- package/build/cjs/type/any/any.js +1 -2
- package/build/cjs/type/array/array.js +1 -2
- package/build/cjs/type/async-iterator/async-iterator.js +1 -2
- package/build/cjs/type/awaited/awaited.js +1 -2
- package/build/cjs/type/bigint/bigint.js +1 -2
- package/build/cjs/type/boolean/boolean.js +1 -2
- package/build/cjs/type/clone/type.js +2 -3
- package/build/cjs/type/clone/value.js +1 -2
- package/build/cjs/type/composite/composite.js +1 -2
- package/build/cjs/type/const/const.js +1 -2
- package/build/cjs/type/constructor/constructor.js +1 -2
- package/build/cjs/type/constructor-parameters/constructor-parameters.js +1 -2
- package/build/cjs/type/date/date.js +1 -2
- package/build/cjs/type/deref/deref.js +1 -2
- package/build/cjs/type/discard/discard.js +1 -2
- package/build/cjs/type/enum/enum.js +1 -2
- package/build/cjs/type/exclude/exclude-from-mapped-result.js +1 -2
- package/build/cjs/type/exclude/exclude-from-template-literal.js +1 -2
- package/build/cjs/type/exclude/exclude.js +1 -2
- package/build/cjs/type/extends/extends-check.js +2 -2
- package/build/cjs/type/extends/extends-from-mapped-key.js +1 -2
- package/build/cjs/type/extends/extends-from-mapped-result.js +1 -2
- package/build/cjs/type/extends/extends-undefined.js +1 -2
- package/build/cjs/type/extends/extends.js +1 -2
- package/build/cjs/type/extract/extract-from-mapped-result.js +1 -2
- package/build/cjs/type/extract/extract-from-template-literal.js +1 -2
- package/build/cjs/type/extract/extract.js +1 -2
- package/build/cjs/type/function/function.js +1 -2
- package/build/cjs/type/guard/kind.js +45 -46
- package/build/cjs/type/guard/type.js +48 -48
- package/build/cjs/type/guard/value.js +15 -16
- package/build/cjs/type/helpers/helpers.js +1 -2
- package/build/cjs/type/indexed/indexed-from-mapped-key.js +1 -2
- package/build/cjs/type/indexed/indexed-from-mapped-result.js +1 -2
- package/build/cjs/type/indexed/indexed-property-keys.js +1 -2
- package/build/cjs/type/indexed/indexed.js +3 -4
- package/build/cjs/type/instance-type/instance-type.js +1 -2
- package/build/cjs/type/integer/integer.js +1 -2
- package/build/cjs/type/intersect/intersect-create.js +1 -2
- package/build/cjs/type/intersect/intersect-evaluated.js +1 -2
- package/build/cjs/type/intersect/intersect.js +1 -2
- package/build/cjs/type/intrinsic/capitalize.js +1 -2
- package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js +1 -2
- package/build/cjs/type/intrinsic/intrinsic.js +1 -2
- package/build/cjs/type/intrinsic/lowercase.js +1 -2
- package/build/cjs/type/intrinsic/uncapitalize.js +1 -2
- package/build/cjs/type/intrinsic/uppercase.js +1 -2
- package/build/cjs/type/iterator/iterator.js +1 -2
- package/build/cjs/type/keyof/keyof-from-mapped-result.js +1 -2
- package/build/cjs/type/keyof/keyof-property-entries.js +1 -2
- package/build/cjs/type/keyof/keyof-property-keys.js +2 -3
- package/build/cjs/type/keyof/keyof.js +2 -3
- package/build/cjs/type/literal/literal.js +1 -2
- package/build/cjs/type/mapped/mapped-key.js +1 -2
- package/build/cjs/type/mapped/mapped-result.js +1 -2
- package/build/cjs/type/mapped/mapped.js +2 -3
- package/build/cjs/type/never/never.js +1 -2
- package/build/cjs/type/not/not.js +1 -2
- package/build/cjs/type/null/null.js +1 -2
- package/build/cjs/type/number/number.js +1 -2
- package/build/cjs/type/omit/omit-from-mapped-key.js +1 -2
- package/build/cjs/type/omit/omit-from-mapped-result.js +1 -2
- package/build/cjs/type/omit/omit.js +1 -2
- package/build/cjs/type/optional/optional-from-mapped-result.js +1 -2
- package/build/cjs/type/optional/optional.js +1 -2
- package/build/cjs/type/parameters/parameters.js +1 -2
- package/build/cjs/type/partial/partial-from-mapped-result.js +1 -2
- package/build/cjs/type/partial/partial.js +1 -2
- package/build/cjs/type/pick/pick-from-mapped-key.js +1 -2
- package/build/cjs/type/pick/pick-from-mapped-result.js +1 -2
- package/build/cjs/type/pick/pick.d.ts +2 -2
- package/build/cjs/type/pick/pick.js +1 -2
- package/build/cjs/type/promise/promise.js +1 -2
- package/build/cjs/type/readonly/readonly-from-mapped-result.js +1 -2
- package/build/cjs/type/readonly/readonly.js +1 -2
- package/build/cjs/type/readonly-optional/readonly-optional.js +1 -2
- package/build/cjs/type/record/record.js +1 -2
- package/build/cjs/type/recursive/recursive.js +1 -2
- package/build/cjs/type/ref/ref.js +1 -2
- package/build/cjs/type/regexp/regexp.js +1 -2
- package/build/cjs/type/registry/format.js +6 -7
- package/build/cjs/type/registry/type.js +6 -7
- package/build/cjs/type/required/required-from-mapped-result.js +1 -2
- package/build/cjs/type/required/required.js +1 -2
- package/build/cjs/type/rest/rest.js +1 -2
- package/build/cjs/type/return-type/return-type.js +1 -2
- package/build/cjs/type/sets/set.js +8 -9
- package/build/cjs/type/strict/strict.js +1 -2
- package/build/cjs/type/string/string.js +1 -2
- package/build/cjs/type/symbol/symbol.js +1 -2
- package/build/cjs/type/template-literal/finite.js +3 -3
- package/build/cjs/type/template-literal/generate.d.ts +1 -1
- package/build/cjs/type/template-literal/generate.js +3 -3
- package/build/cjs/type/template-literal/parse.js +3 -3
- package/build/cjs/type/template-literal/pattern.js +2 -2
- package/build/cjs/type/template-literal/syntax.js +1 -2
- package/build/cjs/type/template-literal/template-literal.js +1 -2
- package/build/cjs/type/template-literal/union.js +1 -2
- package/build/cjs/type/transform/transform.js +2 -2
- package/build/cjs/type/tuple/tuple.js +1 -2
- package/build/cjs/type/type/index.d.ts +1 -1
- package/build/cjs/type/uint8array/uint8array.js +1 -2
- package/build/cjs/type/undefined/undefined.js +1 -2
- package/build/cjs/type/union/union-create.js +1 -2
- package/build/cjs/type/union/union-evaluated.js +1 -2
- package/build/cjs/type/union/union.js +1 -2
- package/build/cjs/type/unknown/unknown.js +1 -2
- package/build/cjs/type/unsafe/unsafe.js +1 -2
- package/build/cjs/type/void/void.js +1 -2
- package/build/cjs/value/cast/cast.js +2 -2
- package/build/cjs/value/check/check.js +2 -2
- package/build/cjs/value/clean/clean.js +1 -2
- package/build/cjs/value/clone/clone.js +1 -2
- package/build/cjs/value/convert/convert.js +1 -2
- package/build/cjs/value/create/create.js +2 -2
- package/build/cjs/value/default/default.js +1 -2
- package/build/cjs/value/delta/delta.js +3 -3
- package/build/cjs/value/deref/deref.js +2 -2
- package/build/cjs/value/equal/equal.js +1 -2
- package/build/cjs/value/guard/guard.js +34 -35
- package/build/cjs/value/hash/hash.js +2 -2
- package/build/cjs/value/mutate/mutate.js +2 -2
- package/build/cjs/value/pointer/pointer.js +6 -6
- package/build/cjs/value/transform/decode.js +2 -2
- package/build/cjs/value/transform/encode.js +2 -2
- package/build/cjs/value/transform/has.js +1 -2
- package/build/cjs/value/value/value.js +15 -16
- package/build/esm/compiler/compiler.mjs +0 -7
- package/build/esm/errors/errors.mjs +0 -2
- package/build/esm/type/pick/pick.d.mts +2 -2
- package/build/esm/type/template-literal/generate.d.mts +1 -1
- package/build/esm/type/transform/transform.mjs +0 -3
- package/build/esm/type/type/index.d.mts +1 -1
- package/build/esm/value/cast/cast.mjs +0 -1
- package/build/esm/value/check/check.mjs +0 -1
- package/build/esm/value/create/create.mjs +0 -1
- package/build/esm/value/delta/delta.mjs +0 -2
- package/build/esm/value/deref/deref.mjs +0 -1
- package/build/esm/value/hash/hash.mjs +0 -1
- package/build/esm/value/pointer/pointer.mjs +0 -5
- package/build/esm/value/transform/decode.mjs +0 -7
- package/build/esm/value/transform/encode.mjs +0 -7
- package/package.json +1 -1
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.Cast = Cast;
|
|
5
|
+
exports.Create = Create;
|
|
6
|
+
exports.Check = Check;
|
|
7
|
+
exports.Clean = Clean;
|
|
8
|
+
exports.Convert = Convert;
|
|
9
|
+
exports.Clone = Clone;
|
|
10
|
+
exports.Decode = Decode;
|
|
11
|
+
exports.Default = Default;
|
|
12
|
+
exports.Encode = Encode;
|
|
13
|
+
exports.Errors = Errors;
|
|
14
|
+
exports.Equal = Equal;
|
|
15
|
+
exports.Diff = Diff;
|
|
16
|
+
exports.Hash = Hash;
|
|
17
|
+
exports.Patch = Patch;
|
|
18
|
+
exports.Mutate = Mutate;
|
|
5
19
|
const index_1 = require("../transform/index");
|
|
6
20
|
const index_2 = require("../mutate/index");
|
|
7
21
|
const index_3 = require("../hash/index");
|
|
@@ -19,32 +33,26 @@ const index_13 = require("../../errors/index");
|
|
|
19
33
|
function Cast(...args) {
|
|
20
34
|
return index_5.Cast.apply(index_5.Cast, args);
|
|
21
35
|
}
|
|
22
|
-
exports.Cast = Cast;
|
|
23
36
|
/** Creates a value from the given type */
|
|
24
37
|
function Create(...args) {
|
|
25
38
|
return index_8.Create.apply(index_8.Create, args);
|
|
26
39
|
}
|
|
27
|
-
exports.Create = Create;
|
|
28
40
|
/** Returns true if the value matches the given type */
|
|
29
41
|
function Check(...args) {
|
|
30
42
|
return index_10.Check.apply(index_10.Check, args);
|
|
31
43
|
}
|
|
32
|
-
exports.Check = Check;
|
|
33
44
|
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
|
|
34
45
|
function Clean(...args) {
|
|
35
46
|
return index_9.Clean.apply(index_9.Clean, args);
|
|
36
47
|
}
|
|
37
|
-
exports.Clean = Clean;
|
|
38
48
|
/** Converts any type mismatched values to their target type if a reasonable conversion is possible. */
|
|
39
49
|
function Convert(...args) {
|
|
40
50
|
return index_7.Convert.apply(index_7.Convert, args);
|
|
41
51
|
}
|
|
42
|
-
exports.Convert = Convert;
|
|
43
52
|
/** Returns a structural clone of the given value */
|
|
44
53
|
function Clone(value) {
|
|
45
54
|
return (0, index_6.Clone)(value);
|
|
46
55
|
}
|
|
47
|
-
exports.Clone = Clone;
|
|
48
56
|
/** Decodes a value or throws if error */
|
|
49
57
|
function Decode(...args) {
|
|
50
58
|
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
@@ -52,12 +60,10 @@ function Decode(...args) {
|
|
|
52
60
|
throw new index_1.TransformDecodeCheckError(schema, value, Errors(schema, references, value).First());
|
|
53
61
|
return (0, index_1.HasTransform)(schema, references) ? (0, index_1.TransformDecode)(schema, references, value) : value;
|
|
54
62
|
}
|
|
55
|
-
exports.Decode = Decode;
|
|
56
63
|
/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */
|
|
57
64
|
function Default(...args) {
|
|
58
65
|
return index_11.Default.apply(index_11.Default, args);
|
|
59
66
|
}
|
|
60
|
-
exports.Default = Default;
|
|
61
67
|
/** Encodes a value or throws if error */
|
|
62
68
|
function Encode(...args) {
|
|
63
69
|
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
@@ -66,34 +72,27 @@ function Encode(...args) {
|
|
|
66
72
|
throw new index_1.TransformEncodeCheckError(schema, encoded, Errors(schema, references, encoded).First());
|
|
67
73
|
return encoded;
|
|
68
74
|
}
|
|
69
|
-
exports.Encode = Encode;
|
|
70
75
|
/** Returns an iterator for each error in this value. */
|
|
71
76
|
function Errors(...args) {
|
|
72
77
|
return index_13.Errors.apply(index_13.Errors, args);
|
|
73
78
|
}
|
|
74
|
-
exports.Errors = Errors;
|
|
75
79
|
/** Returns true if left and right values are structurally equal */
|
|
76
80
|
function Equal(left, right) {
|
|
77
81
|
return (0, index_4.Equal)(left, right);
|
|
78
82
|
}
|
|
79
|
-
exports.Equal = Equal;
|
|
80
83
|
/** Returns edits to transform the current value into the next value */
|
|
81
84
|
function Diff(current, next) {
|
|
82
85
|
return (0, index_12.Diff)(current, next);
|
|
83
86
|
}
|
|
84
|
-
exports.Diff = Diff;
|
|
85
87
|
/** Returns a FNV1A-64 non cryptographic hash of the given value */
|
|
86
88
|
function Hash(value) {
|
|
87
89
|
return (0, index_3.Hash)(value);
|
|
88
90
|
}
|
|
89
|
-
exports.Hash = Hash;
|
|
90
91
|
/** Returns a new value with edits applied to the given value */
|
|
91
92
|
function Patch(current, edits) {
|
|
92
93
|
return (0, index_12.Patch)(current, edits);
|
|
93
94
|
}
|
|
94
|
-
exports.Patch = Patch;
|
|
95
95
|
/** `[Mutable]` Performs a deep mutable value assignment while retaining internal references. */
|
|
96
96
|
function Mutate(current, next) {
|
|
97
97
|
(0, index_2.Mutate)(current, next);
|
|
98
98
|
}
|
|
99
|
-
exports.Mutate = Mutate;
|
|
@@ -21,11 +21,6 @@ import { IsSchema } from '../type/guard/type.mjs';
|
|
|
21
21
|
// TypeCheck
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
23
|
export class TypeCheck {
|
|
24
|
-
schema;
|
|
25
|
-
references;
|
|
26
|
-
checkFunc;
|
|
27
|
-
code;
|
|
28
|
-
hasTransform;
|
|
29
24
|
constructor(schema, references, checkFunc, code) {
|
|
30
25
|
this.schema = schema;
|
|
31
26
|
this.references = references;
|
|
@@ -144,14 +139,12 @@ var LiteralString;
|
|
|
144
139
|
// Errors
|
|
145
140
|
// ------------------------------------------------------------------
|
|
146
141
|
export class TypeCompilerUnknownTypeError extends TypeBoxError {
|
|
147
|
-
schema;
|
|
148
142
|
constructor(schema) {
|
|
149
143
|
super('Unknown type');
|
|
150
144
|
this.schema = schema;
|
|
151
145
|
}
|
|
152
146
|
}
|
|
153
147
|
export class TypeCompilerTypeGuardError extends TypeBoxError {
|
|
154
|
-
schema;
|
|
155
148
|
constructor(schema) {
|
|
156
149
|
super('Preflight validation check failed to guard for the given schema');
|
|
157
150
|
this.schema = schema;
|
|
@@ -87,7 +87,6 @@ export var ValueErrorType;
|
|
|
87
87
|
// ValueErrors
|
|
88
88
|
// ------------------------------------------------------------------
|
|
89
89
|
export class ValueErrorsUnknownTypeError extends TypeBoxError {
|
|
90
|
-
schema;
|
|
91
90
|
constructor(schema) {
|
|
92
91
|
super('Unknown type');
|
|
93
92
|
this.schema = schema;
|
|
@@ -109,7 +108,6 @@ function IsDefined(value) {
|
|
|
109
108
|
// ValueErrorIterator
|
|
110
109
|
// ------------------------------------------------------------------
|
|
111
110
|
export class ValueErrorIterator {
|
|
112
|
-
iterator;
|
|
113
111
|
constructor(iterator) {
|
|
114
112
|
this.iterator = iterator;
|
|
115
113
|
}
|
|
@@ -9,9 +9,9 @@ import { type TIndexPropertyKeys } from '../indexed/index.mjs';
|
|
|
9
9
|
import { type TPickFromMappedKey } from './pick-from-mapped-key.mjs';
|
|
10
10
|
import { type TPickFromMappedResult } from './pick-from-mapped-result.mjs';
|
|
11
11
|
type FromIntersect<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? FromIntersect<R, K, [...Acc, TPick<L, K>]> : Acc;
|
|
12
|
-
declare function FromIntersect<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromIntersect<T, K
|
|
12
|
+
declare function FromIntersect<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromIntersect<T, K>;
|
|
13
13
|
type FromUnion<T extends TSchema[], K extends PropertyKey[], Acc extends TSchema[] = []> = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? FromUnion<R, K, [...Acc, TPick<L, K>]> : Acc;
|
|
14
|
-
declare function FromUnion<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromUnion<T, K
|
|
14
|
+
declare function FromUnion<T extends TSchema[], K extends PropertyKey[]>(T: T, K: K): FromUnion<T, K>;
|
|
15
15
|
type FromProperties<T extends TProperties, K extends PropertyKey[], I extends PropertyKey = TupleToUnion<K>> = Evaluate<Pick<T, I & keyof T>>;
|
|
16
16
|
declare function FromProperties<T extends TProperties, K extends PropertyKey[]>(T: T, K: K): never;
|
|
17
17
|
export type TPick<T extends TProperties, K extends PropertyKey[]> = T extends TRecursive<infer S> ? TRecursive<TPick<S, K>> : T extends TIntersect<infer S> ? TIntersect<FromIntersect<S, K>> : T extends TUnion<infer S> ? TUnion<FromUnion<S, K>> : T extends TObject<infer S> ? TObject<FromProperties<S, K>> : TObject<{}>;
|
|
@@ -13,7 +13,7 @@ type TStringReduceBinary<L extends string[], R extends string[], Acc extends str
|
|
|
13
13
|
type TStringReduceMany<T extends string[][]> = T extends [infer L extends string[], infer R extends string[], ...infer Rest extends string[][]] ? TStringReduceMany<[TStringReduceBinary<L, R>, ...Rest]> : T;
|
|
14
14
|
type TStringReduce<T extends string[][], O = TStringReduceMany<T>> = 0 extends keyof O ? Assert<O[0], string[]> : [];
|
|
15
15
|
type TFromTemplateLiteralUnionKinds<T extends TTemplateLiteralKind[]> = T extends [infer L extends TLiteral, ...infer R extends TLiteral[]] ? [`${L['const']}`, ...TFromTemplateLiteralUnionKinds<R>] : [];
|
|
16
|
-
type TFromTemplateLiteralKinds<T extends TTemplateLiteralKind[], Acc extends TLiteralValue[][] = []> = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? (L extends TLiteral<infer S extends TLiteralValue> ? TFromTemplateLiteralKinds<R, [...Acc, [S]]> : L extends TUnion<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<R, [...Acc, TFromTemplateLiteralUnionKinds<S>]> : L extends TBoolean ? TFromTemplateLiteralKinds<R, [...Acc, ['true', 'false']]> : Acc) : Acc;
|
|
16
|
+
type TFromTemplateLiteralKinds<T extends TTemplateLiteralKind[], Acc extends TLiteralValue[][] = []> = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? (L extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<[...S, ...R], Acc> : L extends TLiteral<infer S extends TLiteralValue> ? TFromTemplateLiteralKinds<R, [...Acc, [S]]> : L extends TUnion<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<R, [...Acc, TFromTemplateLiteralUnionKinds<S>]> : L extends TBoolean ? TFromTemplateLiteralKinds<R, [...Acc, ['true', 'false']]> : Acc) : Acc;
|
|
17
17
|
export declare function TemplateLiteralExpressionGenerate(expression: Expression): IterableIterator<string>;
|
|
18
18
|
export type TTemplateLiteralGenerate<T extends TTemplateLiteral, F = TIsTemplateLiteralFinite<T>> = F extends true ? (T extends TTemplateLiteral<infer S extends TTemplateLiteralKind[]> ? TFromTemplateLiteralKinds<S> extends infer R extends string[][] ? TStringReduce<R> : [] : []) : [];
|
|
19
19
|
/** Generates a tuple of strings from the given TemplateLiteral. Returns an empty tuple if infinite. */
|
|
@@ -8,7 +8,6 @@ import { IsTransform } from '../guard/kind.mjs';
|
|
|
8
8
|
// TransformBuilders
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
export class TransformDecodeBuilder {
|
|
11
|
-
schema;
|
|
12
11
|
constructor(schema) {
|
|
13
12
|
this.schema = schema;
|
|
14
13
|
}
|
|
@@ -18,8 +17,6 @@ export class TransformDecodeBuilder {
|
|
|
18
17
|
}
|
|
19
18
|
// prettier-ignore
|
|
20
19
|
export class TransformEncodeBuilder {
|
|
21
|
-
schema;
|
|
22
|
-
decode;
|
|
23
20
|
constructor(schema, decode) {
|
|
24
21
|
this.schema = schema;
|
|
25
22
|
this.decode = decode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { JsonTypeBuilder } from './json.mjs';
|
|
2
2
|
import { JavaScriptTypeBuilder } from './javascript.mjs';
|
|
3
3
|
/** JavaScript Type Builder with Static Resolution for TypeScript */
|
|
4
|
-
declare const Type: JavaScriptTypeBuilder
|
|
4
|
+
declare const Type: InstanceType<typeof JavaScriptTypeBuilder>;
|
|
5
5
|
export { JavaScriptTypeBuilder };
|
|
6
6
|
export { Type };
|
|
@@ -9,7 +9,6 @@ import { Deref } from '../deref/index.mjs';
|
|
|
9
9
|
// Errors
|
|
10
10
|
// ------------------------------------------------------------------
|
|
11
11
|
export class ValueCastError extends TypeBoxError {
|
|
12
|
-
schema;
|
|
13
12
|
constructor(schema, message) {
|
|
14
13
|
super(message);
|
|
15
14
|
this.schema = schema;
|
|
@@ -19,7 +19,6 @@ import { IsSchema } from '../../type/guard/type.mjs';
|
|
|
19
19
|
// Errors
|
|
20
20
|
// ------------------------------------------------------------------
|
|
21
21
|
export class ValueCheckUnknownTypeError extends TypeBoxError {
|
|
22
|
-
schema;
|
|
23
22
|
constructor(schema) {
|
|
24
23
|
super(`Unknown type`);
|
|
25
24
|
this.schema = schema;
|
|
@@ -11,7 +11,6 @@ import { TypeBoxError } from '../../type/error/index.mjs';
|
|
|
11
11
|
// Errors
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
export class ValueCreateError extends TypeBoxError {
|
|
14
|
-
schema;
|
|
15
14
|
constructor(schema, message) {
|
|
16
15
|
super(message);
|
|
17
16
|
this.schema = schema;
|
|
@@ -26,14 +26,12 @@ export const Edit = Union([Insert, Update, Delete]);
|
|
|
26
26
|
// Errors
|
|
27
27
|
// ------------------------------------------------------------------
|
|
28
28
|
export class ValueDeltaError extends TypeBoxError {
|
|
29
|
-
value;
|
|
30
29
|
constructor(value, message) {
|
|
31
30
|
super(message);
|
|
32
31
|
this.value = value;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
export class ValueDeltaSymbolError extends ValueDeltaError {
|
|
36
|
-
value;
|
|
37
35
|
constructor(value) {
|
|
38
36
|
super(value, 'Cannot diff objects with symbol keys');
|
|
39
37
|
this.value = value;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TypeBoxError } from '../../type/error/index.mjs';
|
|
2
2
|
import { Kind } from '../../type/symbols/index.mjs';
|
|
3
3
|
export class TypeDereferenceError extends TypeBoxError {
|
|
4
|
-
schema;
|
|
5
4
|
constructor(schema) {
|
|
6
5
|
super(`Unable to dereference schema with $id '${schema.$id}'`);
|
|
7
6
|
this.schema = schema;
|
|
@@ -4,7 +4,6 @@ import { TypeBoxError } from '../../type/error/index.mjs';
|
|
|
4
4
|
// Errors
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
export class ValueHashError extends TypeBoxError {
|
|
7
|
-
value;
|
|
8
7
|
constructor(value) {
|
|
9
8
|
super(`Unable to hash value`);
|
|
10
9
|
this.value = value;
|
|
@@ -3,9 +3,6 @@ import { TypeBoxError } from '../../type/error/index.mjs';
|
|
|
3
3
|
// Errors
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
export class ValuePointerRootSetError extends TypeBoxError {
|
|
6
|
-
value;
|
|
7
|
-
path;
|
|
8
|
-
update;
|
|
9
6
|
constructor(value, path, update) {
|
|
10
7
|
super('Cannot set root value');
|
|
11
8
|
this.value = value;
|
|
@@ -14,8 +11,6 @@ export class ValuePointerRootSetError extends TypeBoxError {
|
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
13
|
export class ValuePointerRootDeleteError extends TypeBoxError {
|
|
17
|
-
value;
|
|
18
|
-
path;
|
|
19
14
|
constructor(value, path) {
|
|
20
15
|
super('Cannot delete root value');
|
|
21
16
|
this.value = value;
|
|
@@ -17,9 +17,6 @@ import { IsTransform, IsSchema } from '../../type/guard/type.mjs';
|
|
|
17
17
|
// thrown externally
|
|
18
18
|
// prettier-ignore
|
|
19
19
|
export class TransformDecodeCheckError extends TypeBoxError {
|
|
20
|
-
schema;
|
|
21
|
-
value;
|
|
22
|
-
error;
|
|
23
20
|
constructor(schema, value, error) {
|
|
24
21
|
super(`Unable to decode value as it does not match the expected schema`);
|
|
25
22
|
this.schema = schema;
|
|
@@ -29,10 +26,6 @@ export class TransformDecodeCheckError extends TypeBoxError {
|
|
|
29
26
|
}
|
|
30
27
|
// prettier-ignore
|
|
31
28
|
export class TransformDecodeError extends TypeBoxError {
|
|
32
|
-
schema;
|
|
33
|
-
path;
|
|
34
|
-
value;
|
|
35
|
-
error;
|
|
36
29
|
constructor(schema, path, value, error) {
|
|
37
30
|
super(error instanceof Error ? error.message : 'Unknown error');
|
|
38
31
|
this.schema = schema;
|
|
@@ -16,9 +16,6 @@ import { IsTransform, IsSchema } from '../../type/guard/type.mjs';
|
|
|
16
16
|
// ------------------------------------------------------------------
|
|
17
17
|
// prettier-ignore
|
|
18
18
|
export class TransformEncodeCheckError extends TypeBoxError {
|
|
19
|
-
schema;
|
|
20
|
-
value;
|
|
21
|
-
error;
|
|
22
19
|
constructor(schema, value, error) {
|
|
23
20
|
super(`The encoded value does not match the expected schema`);
|
|
24
21
|
this.schema = schema;
|
|
@@ -28,10 +25,6 @@ export class TransformEncodeCheckError extends TypeBoxError {
|
|
|
28
25
|
}
|
|
29
26
|
// prettier-ignore
|
|
30
27
|
export class TransformEncodeError extends TypeBoxError {
|
|
31
|
-
schema;
|
|
32
|
-
path;
|
|
33
|
-
value;
|
|
34
|
-
error;
|
|
35
28
|
constructor(schema, path, value, error) {
|
|
36
29
|
super(`${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
37
30
|
this.schema = schema;
|