pema 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/private/ArrayType.d.ts +1 -1
- package/lib/private/ArrayType.js +11 -4
- package/lib/private/BuiltinType.d.ts +1 -1
- package/lib/private/BuiltinType.js +6 -2
- package/lib/private/ConstructorType.d.ts +1 -1
- package/lib/private/ConstructorType.js +3 -1
- package/lib/private/DefaultType.d.ts +1 -1
- package/lib/private/DefaultType.js +6 -5
- package/lib/private/EnumType.d.ts +1 -1
- package/lib/private/EnumType.js +5 -2
- package/lib/private/FunctionType.d.ts +1 -1
- package/lib/private/FunctionType.js +6 -3
- package/lib/private/IntType.d.ts +1 -1
- package/lib/private/IntType.js +2 -2
- package/lib/private/IsType.d.ts +1 -1
- package/lib/private/IsType.js +3 -1
- package/lib/private/JSONType.d.ts +3 -2
- package/lib/private/JSONType.js +3 -1
- package/lib/private/LiteralType.d.ts +1 -2
- package/lib/private/LiteralType.js +3 -4
- package/lib/private/Loose.d.ts +4 -0
- package/lib/private/Loose.js +3 -0
- package/lib/private/NormalizeSchema.d.ts +3 -3
- package/lib/private/NullType.d.ts +1 -1
- package/lib/private/NullType.js +5 -2
- package/lib/private/NumericType.d.ts +2 -1
- package/lib/private/ObjectType.d.ts +1 -1
- package/lib/private/ObjectType.js +18 -5
- package/lib/private/OmitType.d.ts +1 -1
- package/lib/private/OmitType.js +3 -1
- package/lib/private/OptionalType.d.ts +1 -1
- package/lib/private/OptionalType.js +6 -5
- package/lib/private/ParseError.d.ts +1 -1
- package/lib/private/ParseError.js +9 -8
- package/lib/private/ParseOptions.d.ts +2 -1
- package/lib/private/Parsed.d.ts +4 -3
- package/lib/private/Parsed.js +2 -3
- package/lib/private/PartialType.d.ts +1 -1
- package/lib/private/PartialType.js +3 -1
- package/lib/private/PrimitiveType.d.ts +1 -1
- package/lib/private/PrimitiveType.js +7 -4
- package/lib/private/PureType.d.ts +1 -1
- package/lib/private/PureType.js +2 -2
- package/lib/private/RecordType.d.ts +1 -1
- package/lib/private/RecordType.js +3 -1
- package/lib/private/Storable.d.ts +1 -0
- package/lib/private/Storable.js +4 -0
- package/lib/private/StoreType.d.ts +1 -1
- package/lib/private/StoreType.js +4 -2
- package/lib/private/TupleType.d.ts +1 -1
- package/lib/private/TupleType.js +11 -4
- package/lib/private/UUIDType.d.ts +1 -1
- package/lib/private/UUIDType.js +3 -1
- package/lib/private/UUIDV4Type.d.ts +1 -1
- package/lib/private/UUIDV4Type.js +3 -1
- package/lib/private/UUIDV7Type.d.ts +1 -1
- package/lib/private/UUIDV7Type.js +3 -1
- package/lib/private/UintType.d.ts +1 -1
- package/lib/private/UintType.js +2 -2
- package/lib/private/UnionType.d.ts +1 -1
- package/lib/private/UnionType.js +6 -4
- package/lib/private/VirtualType.js +2 -2
- package/lib/private/array.d.ts +6 -4
- package/lib/private/array.js +15 -2
- package/lib/private/blob.d.ts +6 -2
- package/lib/private/blob.js +8 -1
- package/lib/private/boolean.d.ts +6 -5
- package/lib/private/boolean.js +8 -4
- package/lib/private/coerce/date.js +3 -5
- package/lib/private/coerce/int.js +1 -1
- package/lib/private/constructor.d.ts +6 -5
- package/lib/private/constructor.js +16 -1
- package/lib/private/date.d.ts +6 -2
- package/lib/private/date.js +8 -1
- package/lib/private/dict.d.ts +12 -2
- package/lib/private/dict.js +10 -2
- package/lib/private/enum.d.ts +9 -1
- package/lib/private/enum.js +14 -1
- package/lib/private/errors.js +5 -6
- package/lib/private/f32.d.ts +6 -2
- package/lib/private/f32.js +8 -1
- package/lib/private/f64.d.ts +6 -2
- package/lib/private/f64.js +8 -1
- package/lib/private/file.d.ts +6 -2
- package/lib/private/file.js +8 -1
- package/lib/private/function.d.ts +6 -5
- package/lib/private/function.js +8 -1
- package/lib/private/i128.d.ts +6 -2
- package/lib/private/i128.js +8 -1
- package/lib/private/i16.d.ts +6 -2
- package/lib/private/i16.js +8 -1
- package/lib/private/i32.d.ts +6 -2
- package/lib/private/i32.js +8 -1
- package/lib/private/i64.d.ts +6 -2
- package/lib/private/i64.js +8 -1
- package/lib/private/i8.d.ts +6 -2
- package/lib/private/i8.js +8 -1
- package/lib/private/index.d.ts +33 -15
- package/lib/private/index.js +148 -41
- package/lib/private/is-parsed.d.ts +3 -0
- package/lib/private/is-parsed.js +7 -0
- package/lib/private/is.d.ts +6 -2
- package/lib/private/is.js +14 -1
- package/lib/private/json.d.ts +12 -2
- package/lib/private/json.js +14 -1
- package/lib/private/literal.d.ts +10 -2
- package/lib/private/literal.js +16 -1
- package/lib/private/normalize.js +4 -11
- package/lib/private/null.d.ts +6 -2
- package/lib/private/null.js +8 -1
- package/lib/private/object.d.ts +11 -4
- package/lib/private/object.js +22 -1
- package/lib/private/omit.d.ts +9 -1
- package/lib/private/omit.js +14 -1
- package/lib/private/partial.d.ts +9 -2
- package/lib/private/partial.js +16 -2
- package/lib/private/path/next.d.ts +1 -7
- package/lib/private/pure.d.ts +9 -1
- package/lib/private/pure.js +14 -1
- package/lib/private/record.d.ts +6 -5
- package/lib/private/record.js +14 -1
- package/lib/private/resolve.d.ts +2 -0
- package/lib/private/resolve.js +7 -0
- package/lib/private/spec/bigint.d.ts +4 -1
- package/lib/private/spec/bigint.js +27 -26
- package/lib/private/spec/biguint.d.ts +4 -1
- package/lib/private/spec/biguint.js +23 -22
- package/lib/private/spec/int.d.ts +4 -1
- package/lib/private/spec/int.js +24 -23
- package/lib/private/spec/uint.d.ts +4 -1
- package/lib/private/spec/uint.js +22 -21
- package/lib/private/string.d.ts +6 -5
- package/lib/private/string.js +8 -4
- package/lib/private/symbol.d.ts +6 -2
- package/lib/private/symbol.js +8 -1
- package/lib/private/test.d.ts +4 -21
- package/lib/private/test.js +0 -44
- package/lib/private/tuple.d.ts +9 -2
- package/lib/private/tuple.js +16 -1
- package/lib/private/u128.d.ts +6 -2
- package/lib/private/u128.js +8 -1
- package/lib/private/u16.d.ts +6 -2
- package/lib/private/u16.js +8 -1
- package/lib/private/u32.d.ts +6 -5
- package/lib/private/u32.js +8 -1
- package/lib/private/u64.d.ts +6 -2
- package/lib/private/u64.js +8 -1
- package/lib/private/u8.d.ts +6 -2
- package/lib/private/u8.js +8 -1
- package/lib/private/undefined.d.ts +6 -2
- package/lib/private/undefined.js +8 -1
- package/lib/private/union.d.ts +12 -3
- package/lib/private/union.js +14 -1
- package/lib/private/unknown.d.ts +6 -5
- package/lib/private/unknown.js +8 -1
- package/lib/private/url.d.ts +6 -2
- package/lib/private/url.js +8 -1
- package/lib/private/uuid.d.ts +6 -2
- package/lib/private/uuid.js +8 -1
- package/package.json +7 -6
- package/lib/private/is-parsed-type.d.ts +0 -3
- package/lib/private/is-parsed-type.js +0 -6
package/lib/private/index.js
CHANGED
|
@@ -6,11 +6,11 @@ import boolean from "#boolean";
|
|
|
6
6
|
import constructor from "#constructor";
|
|
7
7
|
import date from "#date";
|
|
8
8
|
import dict from "#dict";
|
|
9
|
-
import
|
|
9
|
+
import enum$ from "#enum";
|
|
10
10
|
import f32 from "#f32";
|
|
11
11
|
import f64 from "#f64";
|
|
12
12
|
import file from "#file";
|
|
13
|
-
import
|
|
13
|
+
import function$ from "#function";
|
|
14
14
|
import i128 from "#i128";
|
|
15
15
|
import i16 from "#i16";
|
|
16
16
|
import i32 from "#i32";
|
|
@@ -19,10 +19,14 @@ import i8 from "#i8";
|
|
|
19
19
|
import int from "#int";
|
|
20
20
|
import is from "#is";
|
|
21
21
|
import json from "#json";
|
|
22
|
+
import literal from "#literal";
|
|
23
|
+
import Loose from "#Loose";
|
|
22
24
|
import normalize from "#normalize";
|
|
25
|
+
import null$ from "#null";
|
|
23
26
|
import number from "#number";
|
|
24
27
|
import object from "#object";
|
|
25
28
|
import omit from "#omit";
|
|
29
|
+
import partial from "#partial";
|
|
26
30
|
import pure from "#pure";
|
|
27
31
|
import record from "#record";
|
|
28
32
|
import string from "#string";
|
|
@@ -34,6 +38,7 @@ import u32 from "#u32";
|
|
|
34
38
|
import u64 from "#u64";
|
|
35
39
|
import u8 from "#u8";
|
|
36
40
|
import uint from "#uint";
|
|
41
|
+
import undefined$ from "#undefined";
|
|
37
42
|
import union from "#union";
|
|
38
43
|
import unknown from "#unknown";
|
|
39
44
|
import url from "#url";
|
|
@@ -44,44 +49,146 @@ import uuid from "#uuid";
|
|
|
44
49
|
function schema(s) {
|
|
45
50
|
return normalize(s);
|
|
46
51
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
schema.
|
|
58
|
-
schema.
|
|
59
|
-
schema.
|
|
60
|
-
schema.
|
|
61
|
-
schema.
|
|
62
|
-
schema.
|
|
63
|
-
schema.
|
|
64
|
-
schema.
|
|
65
|
-
schema.
|
|
66
|
-
schema.
|
|
67
|
-
schema.
|
|
68
|
-
schema.
|
|
69
|
-
schema.
|
|
70
|
-
schema.
|
|
71
|
-
schema.
|
|
72
|
-
schema.
|
|
73
|
-
schema.
|
|
74
|
-
schema.
|
|
75
|
-
schema.
|
|
76
|
-
schema.
|
|
77
|
-
schema.
|
|
78
|
-
schema.
|
|
79
|
-
schema.
|
|
80
|
-
schema.
|
|
81
|
-
schema.
|
|
82
|
-
schema.
|
|
83
|
-
schema.
|
|
84
|
-
schema.
|
|
85
|
-
schema.
|
|
52
|
+
function loose(s) {
|
|
53
|
+
const i = normalize(s);
|
|
54
|
+
i[Loose] = true;
|
|
55
|
+
return i;
|
|
56
|
+
}
|
|
57
|
+
function strict(s) {
|
|
58
|
+
const i = normalize(s);
|
|
59
|
+
i[Loose] = false;
|
|
60
|
+
return i;
|
|
61
|
+
}
|
|
62
|
+
schema.array = array.vanilla;
|
|
63
|
+
schema.bigint = bigint.vanilla;
|
|
64
|
+
schema.biguint = biguint.vanilla;
|
|
65
|
+
schema.blob = blob.vanilla;
|
|
66
|
+
schema.boolean = boolean.vanilla;
|
|
67
|
+
schema.constructor = constructor.vanilla;
|
|
68
|
+
schema.date = date.vanilla;
|
|
69
|
+
schema.dict = dict.vanilla;
|
|
70
|
+
schema.enum = enum$.vanilla;
|
|
71
|
+
schema.f32 = f32.vanilla;
|
|
72
|
+
schema.f64 = f64.vanilla;
|
|
73
|
+
schema.file = file.vanilla;
|
|
74
|
+
schema.function = function$.vanilla;
|
|
75
|
+
schema.i128 = i128.vanilla;
|
|
76
|
+
schema.i16 = i16.vanilla;
|
|
77
|
+
schema.i32 = i32.vanilla;
|
|
78
|
+
schema.i64 = i64.vanilla;
|
|
79
|
+
schema.i8 = i8.vanilla;
|
|
80
|
+
schema.int = int.vanilla;
|
|
81
|
+
schema.is = is.vanilla;
|
|
82
|
+
schema.json = json.vanilla;
|
|
83
|
+
schema.literal = literal.vanilla;
|
|
84
|
+
schema.null = null$.vanilla;
|
|
85
|
+
schema.number = number.vanilla;
|
|
86
|
+
schema.object = object.vanilla;
|
|
87
|
+
schema.omit = omit.vanilla;
|
|
88
|
+
schema.record = record.vanilla;
|
|
89
|
+
schema.partial = partial.vanilla;
|
|
90
|
+
schema.pure = pure.vanilla;
|
|
91
|
+
schema.string = string.vanilla;
|
|
92
|
+
schema.symbol = symbol.vanilla;
|
|
93
|
+
schema.tuple = tuple.vanilla;
|
|
94
|
+
schema.u128 = u128.vanilla;
|
|
95
|
+
schema.u16 = u16.vanilla;
|
|
96
|
+
schema.u32 = u32.vanilla;
|
|
97
|
+
schema.u64 = u64.vanilla;
|
|
98
|
+
schema.u8 = u8.vanilla;
|
|
99
|
+
schema.uint = uint.vanilla;
|
|
100
|
+
schema.undefined = undefined$.vanilla;
|
|
101
|
+
schema.union = union.vanilla;
|
|
102
|
+
schema.unknown = unknown.vanilla;
|
|
103
|
+
schema.url = url.vanilla;
|
|
104
|
+
schema.uuid = uuid.vanilla;
|
|
105
|
+
loose.array = array.loose;
|
|
106
|
+
loose.bigint = bigint.loose;
|
|
107
|
+
loose.biguint = biguint.loose;
|
|
108
|
+
loose.blob = blob.loose;
|
|
109
|
+
loose.boolean = boolean.loose;
|
|
110
|
+
loose.constructor = constructor.loose;
|
|
111
|
+
loose.date = date.loose;
|
|
112
|
+
loose.dict = dict.loose;
|
|
113
|
+
loose.enum = enum$.loose;
|
|
114
|
+
loose.f32 = f32.loose;
|
|
115
|
+
loose.f64 = f64.loose;
|
|
116
|
+
loose.file = file.loose;
|
|
117
|
+
loose.function = function$.loose;
|
|
118
|
+
loose.i128 = i128.loose;
|
|
119
|
+
loose.i16 = i16.loose;
|
|
120
|
+
loose.i32 = i32.loose;
|
|
121
|
+
loose.i64 = i64.loose;
|
|
122
|
+
loose.i8 = i8.loose;
|
|
123
|
+
loose.int = int.loose;
|
|
124
|
+
loose.is = is.loose;
|
|
125
|
+
loose.json = json.loose;
|
|
126
|
+
loose.literal = literal.loose;
|
|
127
|
+
loose.null = null$.loose;
|
|
128
|
+
loose.number = number.loose;
|
|
129
|
+
loose.object = object.loose;
|
|
130
|
+
loose.omit = omit.loose;
|
|
131
|
+
loose.record = record.loose;
|
|
132
|
+
loose.partial = partial.loose;
|
|
133
|
+
loose.pure = pure.loose;
|
|
134
|
+
loose.string = string.loose;
|
|
135
|
+
loose.symbol = symbol.loose;
|
|
136
|
+
loose.tuple = tuple.loose;
|
|
137
|
+
loose.u128 = u128.loose;
|
|
138
|
+
loose.u16 = u16.loose;
|
|
139
|
+
loose.u32 = u32.loose;
|
|
140
|
+
loose.u64 = u64.loose;
|
|
141
|
+
loose.u8 = u8.loose;
|
|
142
|
+
loose.uint = uint.loose;
|
|
143
|
+
loose.undefined = undefined$.loose;
|
|
144
|
+
loose.union = union.loose;
|
|
145
|
+
loose.unknown = unknown.loose;
|
|
146
|
+
loose.url = url.loose;
|
|
147
|
+
loose.uuid = uuid.loose;
|
|
148
|
+
strict.array = array.strict;
|
|
149
|
+
strict.bigint = bigint.strict;
|
|
150
|
+
strict.biguint = biguint.strict;
|
|
151
|
+
strict.blob = blob.strict;
|
|
152
|
+
strict.boolean = boolean.strict;
|
|
153
|
+
strict.constructor = constructor.strict;
|
|
154
|
+
strict.date = date.strict;
|
|
155
|
+
strict.dict = dict.strict;
|
|
156
|
+
strict.enum = enum$.strict;
|
|
157
|
+
strict.f32 = f32.strict;
|
|
158
|
+
strict.f64 = f64.strict;
|
|
159
|
+
strict.file = file.strict;
|
|
160
|
+
strict.function = function$.strict;
|
|
161
|
+
strict.i128 = i128.strict;
|
|
162
|
+
strict.i16 = i16.strict;
|
|
163
|
+
strict.i32 = i32.strict;
|
|
164
|
+
strict.i64 = i64.strict;
|
|
165
|
+
strict.i8 = i8.strict;
|
|
166
|
+
strict.int = int.strict;
|
|
167
|
+
strict.is = is.strict;
|
|
168
|
+
strict.json = json.strict;
|
|
169
|
+
strict.literal = literal.strict;
|
|
170
|
+
strict.null = null$.strict;
|
|
171
|
+
strict.number = number.strict;
|
|
172
|
+
strict.object = object.strict;
|
|
173
|
+
strict.omit = omit.strict;
|
|
174
|
+
strict.record = record.strict;
|
|
175
|
+
strict.partial = partial.strict;
|
|
176
|
+
strict.pure = pure.strict;
|
|
177
|
+
strict.string = string.strict;
|
|
178
|
+
strict.symbol = symbol.strict;
|
|
179
|
+
strict.tuple = tuple.strict;
|
|
180
|
+
strict.u128 = u128.strict;
|
|
181
|
+
strict.u16 = u16.strict;
|
|
182
|
+
strict.u32 = u32.strict;
|
|
183
|
+
strict.u64 = u64.strict;
|
|
184
|
+
strict.u8 = u8.strict;
|
|
185
|
+
strict.uint = uint.strict;
|
|
186
|
+
strict.undefined = undefined$.strict;
|
|
187
|
+
strict.union = union.strict;
|
|
188
|
+
strict.unknown = unknown.strict;
|
|
189
|
+
strict.url = url.strict;
|
|
190
|
+
strict.uuid = uuid.strict;
|
|
191
|
+
schema.loose = loose;
|
|
192
|
+
schema.strict = strict;
|
|
86
193
|
export default schema;
|
|
87
194
|
//# sourceMappingURL=index.js.map
|
package/lib/private/is.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import IsType from "#IsType";
|
|
2
|
-
declare const
|
|
3
|
-
|
|
2
|
+
declare const is: {
|
|
3
|
+
vanilla: <T>(predicate: (x: unknown) => x is T) => IsType<T>;
|
|
4
|
+
loose: <T>(predicate: (x: unknown) => x is T) => IsType<T>;
|
|
5
|
+
strict: <T>(predicate: (x: unknown) => x is T) => IsType<T>;
|
|
6
|
+
};
|
|
7
|
+
export default is;
|
|
4
8
|
//# sourceMappingURL=is.d.ts.map
|
package/lib/private/is.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import IsType from "#IsType";
|
|
2
|
-
|
|
2
|
+
import Loose from "#Loose";
|
|
3
|
+
const vanilla = (predicate) => new IsType(predicate);
|
|
4
|
+
const loose = (predicate) => {
|
|
5
|
+
const i = new IsType(predicate);
|
|
6
|
+
i[Loose] = true;
|
|
7
|
+
return i;
|
|
8
|
+
};
|
|
9
|
+
const strict = (predicate) => {
|
|
10
|
+
const i = new IsType(predicate);
|
|
11
|
+
i[Loose] = false;
|
|
12
|
+
return i;
|
|
13
|
+
};
|
|
14
|
+
const is = { vanilla, loose, strict };
|
|
15
|
+
export default is;
|
|
3
16
|
//# sourceMappingURL=is.js.map
|
package/lib/private/json.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ParsedJSON } from "#JSONType";
|
|
2
2
|
import JSONType from "#JSONType";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
declare function vanilla(): JSONType<undefined>;
|
|
4
|
+
declare function vanilla<S extends ParsedJSON>(inner: S): JSONType<S>;
|
|
5
|
+
declare function loose(): JSONType<undefined>;
|
|
6
|
+
declare function loose<S extends ParsedJSON>(inner: S): JSONType<S>;
|
|
7
|
+
declare function strict(): JSONType<undefined>;
|
|
8
|
+
declare function strict<S extends ParsedJSON>(inner: S): JSONType<S>;
|
|
9
|
+
declare const json: {
|
|
10
|
+
vanilla: typeof vanilla;
|
|
11
|
+
loose: typeof loose;
|
|
12
|
+
strict: typeof strict;
|
|
13
|
+
};
|
|
14
|
+
export default json;
|
|
5
15
|
//# sourceMappingURL=json.d.ts.map
|
package/lib/private/json.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import JSONType from "#JSONType";
|
|
2
|
-
|
|
2
|
+
import Loose from "#Loose";
|
|
3
|
+
function vanilla(inner) {
|
|
3
4
|
return new JSONType(inner);
|
|
4
5
|
}
|
|
6
|
+
function loose(inner) {
|
|
7
|
+
const i = new JSONType(inner);
|
|
8
|
+
i[Loose] = true;
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function strict(inner) {
|
|
12
|
+
const i = new JSONType(inner);
|
|
13
|
+
i[Loose] = false;
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
const json = { vanilla, loose, strict };
|
|
17
|
+
export default json;
|
|
5
18
|
//# sourceMappingURL=json.js.map
|
package/lib/private/literal.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import LiteralType from "#LiteralType";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Literal = string | boolean | number;
|
|
3
|
+
declare function vanilla<T extends Literal>(literal: T): LiteralType<T>;
|
|
4
|
+
declare function loose<T extends Literal>(literal: T): LiteralType<T>;
|
|
5
|
+
declare function strict<T extends Literal>(literal: T): LiteralType<T>;
|
|
6
|
+
declare const literal: {
|
|
7
|
+
vanilla: typeof vanilla;
|
|
8
|
+
loose: typeof loose;
|
|
9
|
+
strict: typeof strict;
|
|
10
|
+
};
|
|
11
|
+
export default literal;
|
|
4
12
|
//# sourceMappingURL=literal.d.ts.map
|
package/lib/private/literal.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import LiteralType from "#LiteralType";
|
|
2
|
-
|
|
2
|
+
import Loose from "#Loose";
|
|
3
|
+
function vanilla(literal) {
|
|
4
|
+
return new LiteralType(literal);
|
|
5
|
+
}
|
|
6
|
+
function loose(literal) {
|
|
7
|
+
const i = new LiteralType(literal);
|
|
8
|
+
i[Loose] = true;
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function strict(literal) {
|
|
12
|
+
const i = new LiteralType(literal);
|
|
13
|
+
i[Loose] = false;
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
const literal = { vanilla, loose, strict };
|
|
17
|
+
export default literal;
|
|
3
18
|
//# sourceMappingURL=literal.js.map
|
package/lib/private/normalize.js
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import ArrayType from "#ArrayType";
|
|
2
2
|
import ConstructorType from "#ConstructorType";
|
|
3
|
+
import is_parsed from "#is-parsed";
|
|
3
4
|
import LiteralType from "#LiteralType";
|
|
4
5
|
import NullType from "#NullType";
|
|
5
6
|
import ObjectType from "#ObjectType";
|
|
6
|
-
import ParsedKey from "#ParsedKey";
|
|
7
7
|
import TupleType from "#TupleType";
|
|
8
8
|
import UndefinedType from "#UndefinedType";
|
|
9
9
|
import is from "@rcompat/is";
|
|
10
|
-
function isParsed(x) {
|
|
11
|
-
return !!x && typeof x === "object" && ParsedKey in x;
|
|
12
|
-
}
|
|
13
|
-
function isPlain(x) {
|
|
14
|
-
return !!x && typeof x === "object" &&
|
|
15
|
-
Object.getPrototypeOf(x) === Object.prototype;
|
|
16
|
-
}
|
|
17
10
|
export default function normalize(x) {
|
|
18
|
-
if (
|
|
11
|
+
if (is_parsed(x))
|
|
19
12
|
return x;
|
|
20
13
|
if (x === null)
|
|
21
14
|
return new NullType();
|
|
22
15
|
if (x === undefined)
|
|
23
16
|
return new UndefinedType();
|
|
24
|
-
if (
|
|
17
|
+
if (is.string(x) || is.number(x) || is.boolean(x))
|
|
25
18
|
return new LiteralType(x);
|
|
26
19
|
if (is.newable(x))
|
|
27
20
|
return new ConstructorType(x);
|
|
@@ -30,7 +23,7 @@ export default function normalize(x) {
|
|
|
30
23
|
? new ArrayType(normalize(x[0]))
|
|
31
24
|
: new TupleType(x.map(normalize));
|
|
32
25
|
}
|
|
33
|
-
if (
|
|
26
|
+
if (is.dict(x)) {
|
|
34
27
|
const props = {};
|
|
35
28
|
for (const [k, v] of Object.entries(x))
|
|
36
29
|
props[k] = normalize(v);
|
package/lib/private/null.d.ts
CHANGED
package/lib/private/null.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import Loose from "#Loose";
|
|
1
2
|
import NullType from "#NullType";
|
|
2
|
-
|
|
3
|
+
const vanilla = new NullType();
|
|
4
|
+
const loose = new NullType();
|
|
5
|
+
loose[Loose] = true;
|
|
6
|
+
const strict = new NullType();
|
|
7
|
+
strict[Loose] = false;
|
|
8
|
+
const null_ = { vanilla, loose, strict };
|
|
9
|
+
export default null_;
|
|
3
10
|
//# sourceMappingURL=null.js.map
|
package/lib/private/object.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type NormalizeSchema from "#NormalizeSchema";
|
|
2
2
|
import ObjectType from "#ObjectType";
|
|
3
3
|
import type Schema from "#Schema";
|
|
4
|
-
import type { Dict,
|
|
5
|
-
type NormalizeProps<S extends Dict<Schema>> = keyof S extends never ?
|
|
4
|
+
import type { Dict, EmptyDict } from "@rcompat/type";
|
|
5
|
+
type NormalizeProps<S extends Dict<Schema>> = keyof S extends never ? EmptyDict : {
|
|
6
6
|
[K in keyof S]: NormalizeSchema<S[K]>;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
declare function vanilla<P extends Dict<Schema> = Dict<Schema>>(properties: P): ObjectType<NormalizeProps<P>>;
|
|
9
|
+
declare function loose<P extends Dict<Schema> = Dict<Schema>>(properties: P): ObjectType<NormalizeProps<P>>;
|
|
10
|
+
declare function strict<P extends Dict<Schema> = Dict<Schema>>(properties: P): ObjectType<NormalizeProps<P>>;
|
|
11
|
+
declare const object: {
|
|
12
|
+
vanilla: typeof vanilla;
|
|
13
|
+
loose: typeof loose;
|
|
14
|
+
strict: typeof strict;
|
|
15
|
+
};
|
|
16
|
+
export default object;
|
|
10
17
|
//# sourceMappingURL=object.d.ts.map
|
package/lib/private/object.js
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
|
+
import Loose from "#Loose";
|
|
1
2
|
import normalize from "#normalize";
|
|
2
3
|
import ObjectType from "#ObjectType";
|
|
3
|
-
|
|
4
|
+
function vanilla(properties) {
|
|
4
5
|
const props = {};
|
|
5
6
|
for (const [k, v] of Object.entries(properties)) {
|
|
6
7
|
props[k] = normalize(v);
|
|
7
8
|
}
|
|
8
9
|
return new ObjectType(props);
|
|
9
10
|
}
|
|
11
|
+
function loose(properties) {
|
|
12
|
+
const props = {};
|
|
13
|
+
for (const [k, v] of Object.entries(properties)) {
|
|
14
|
+
props[k] = normalize(v);
|
|
15
|
+
}
|
|
16
|
+
const i = new ObjectType(props);
|
|
17
|
+
i[Loose] = true;
|
|
18
|
+
return i;
|
|
19
|
+
}
|
|
20
|
+
function strict(properties) {
|
|
21
|
+
const props = {};
|
|
22
|
+
for (const [k, v] of Object.entries(properties)) {
|
|
23
|
+
props[k] = normalize(v);
|
|
24
|
+
}
|
|
25
|
+
const i = new ObjectType(props);
|
|
26
|
+
i[Loose] = false;
|
|
27
|
+
return i;
|
|
28
|
+
}
|
|
29
|
+
const object = { vanilla, loose, strict };
|
|
30
|
+
export default object;
|
|
10
31
|
//# sourceMappingURL=object.js.map
|
package/lib/private/omit.d.ts
CHANGED
|
@@ -2,5 +2,13 @@ import type ObjectType from "#ObjectType";
|
|
|
2
2
|
import OmitType from "#OmitType";
|
|
3
3
|
import type Parsed from "#Parsed";
|
|
4
4
|
import type { Dict } from "@rcompat/type";
|
|
5
|
-
|
|
5
|
+
declare function vanilla<P extends Dict<Parsed<unknown>>, K extends keyof P>(type: ObjectType<P>, ...keys: K[]): OmitType<P, K>;
|
|
6
|
+
declare function loose<P extends Dict<Parsed<unknown>>, K extends keyof P>(type: ObjectType<P>, ...keys: K[]): OmitType<P, K>;
|
|
7
|
+
declare function strict<P extends Dict<Parsed<unknown>>, K extends keyof P>(type: ObjectType<P>, ...keys: K[]): OmitType<P, K>;
|
|
8
|
+
declare const omit: {
|
|
9
|
+
vanilla: typeof vanilla;
|
|
10
|
+
loose: typeof loose;
|
|
11
|
+
strict: typeof strict;
|
|
12
|
+
};
|
|
13
|
+
export default omit;
|
|
6
14
|
//# sourceMappingURL=omit.d.ts.map
|
package/lib/private/omit.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import Loose from "#Loose";
|
|
1
2
|
import OmitType from "#OmitType";
|
|
2
|
-
|
|
3
|
+
function vanilla(type, ...keys) {
|
|
3
4
|
return new OmitType(type, keys);
|
|
4
5
|
}
|
|
6
|
+
function loose(type, ...keys) {
|
|
7
|
+
const i = new OmitType(type, keys);
|
|
8
|
+
i[Loose] = true;
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function strict(type, ...keys) {
|
|
12
|
+
const i = new OmitType(type, keys);
|
|
13
|
+
i[Loose] = false;
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
const omit = { vanilla, loose, strict };
|
|
17
|
+
export default omit;
|
|
5
18
|
//# sourceMappingURL=omit.js.map
|
package/lib/private/partial.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ import PartialType from "#PartialType";
|
|
|
4
4
|
type StripReadonly<T> = {
|
|
5
5
|
-readonly [K in keyof T]: T[K];
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
declare function vanilla<const D extends Partialable>(input: D | ObjectType<D>): PartialType<StripReadonly<D>>;
|
|
8
|
+
declare function loose<const D extends Partialable>(input: D | ObjectType<D>): PartialType<StripReadonly<D>>;
|
|
9
|
+
declare function strict<const D extends Partialable>(input: D | ObjectType<D>): PartialType<StripReadonly<D>>;
|
|
10
|
+
declare const partial: {
|
|
11
|
+
vanilla: typeof vanilla;
|
|
12
|
+
loose: typeof loose;
|
|
13
|
+
strict: typeof strict;
|
|
14
|
+
};
|
|
15
|
+
export default partial;
|
|
9
16
|
//# sourceMappingURL=partial.d.ts.map
|
package/lib/private/partial.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import Loose from "#Loose";
|
|
2
2
|
import ObjectType from "#ObjectType";
|
|
3
3
|
import PartialType from "#PartialType";
|
|
4
|
-
|
|
4
|
+
function vanilla(input) {
|
|
5
5
|
const dict = input instanceof ObjectType ? input.properties : input;
|
|
6
6
|
return new PartialType(dict);
|
|
7
7
|
}
|
|
8
|
+
function loose(input) {
|
|
9
|
+
const dict = input instanceof ObjectType ? input.properties : input;
|
|
10
|
+
const i = new PartialType(dict);
|
|
11
|
+
i[Loose] = true;
|
|
12
|
+
return i;
|
|
13
|
+
}
|
|
14
|
+
function strict(input) {
|
|
15
|
+
const dict = input instanceof ObjectType ? input.properties : input;
|
|
16
|
+
const i = new PartialType(dict);
|
|
17
|
+
i[Loose] = false;
|
|
18
|
+
return i;
|
|
19
|
+
}
|
|
20
|
+
const partial = { vanilla, loose, strict };
|
|
21
|
+
export default partial;
|
|
8
22
|
//# sourceMappingURL=partial.js.map
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import ParsedKey from "#ParsedKey";
|
|
2
1
|
import type ParseOptions from "#ParseOptions";
|
|
3
|
-
export default function next(s: number | string, options?: ParseOptions):
|
|
4
|
-
[ParsedKey]: import("@rcompat/type").JSONPointer;
|
|
5
|
-
coerce?: boolean;
|
|
6
|
-
partial?: boolean;
|
|
7
|
-
validators?: import("../Validator.js").default<unknown>[] | undefined;
|
|
8
|
-
};
|
|
2
|
+
export default function next(s: number | string, options?: ParseOptions): ParseOptions;
|
|
9
3
|
//# sourceMappingURL=next.d.ts.map
|
package/lib/private/pure.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import PureType from "#PureType";
|
|
2
|
-
|
|
2
|
+
declare function vanilla<T>(): PureType<T, "PureType">;
|
|
3
|
+
declare function loose<T>(): PureType<T, "PureType">;
|
|
4
|
+
declare function strict<T>(): PureType<T, "PureType">;
|
|
5
|
+
declare const pure: {
|
|
6
|
+
vanilla: typeof vanilla;
|
|
7
|
+
loose: typeof loose;
|
|
8
|
+
strict: typeof strict;
|
|
9
|
+
};
|
|
10
|
+
export default pure;
|
|
3
11
|
//# sourceMappingURL=pure.d.ts.map
|
package/lib/private/pure.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import Loose from "#Loose";
|
|
1
2
|
import PureType from "#PureType";
|
|
2
|
-
|
|
3
|
+
function vanilla() {
|
|
3
4
|
return new PureType();
|
|
4
5
|
}
|
|
6
|
+
function loose() {
|
|
7
|
+
const i = new PureType();
|
|
8
|
+
i[Loose] = true;
|
|
9
|
+
return i;
|
|
10
|
+
}
|
|
11
|
+
function strict() {
|
|
12
|
+
const i = new PureType();
|
|
13
|
+
i[Loose] = false;
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
const pure = { vanilla, loose, strict };
|
|
17
|
+
export default pure;
|
|
5
18
|
//# sourceMappingURL=pure.js.map
|
package/lib/private/record.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type Parsed from "#Parsed";
|
|
2
2
|
import RecordType from "#RecordType";
|
|
3
3
|
import type RecordTypeKey from "#RecordTypeKey";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
declare const record: {
|
|
5
|
+
vanilla: <const Key extends RecordTypeKey, const Value extends Parsed<unknown>>(k: Key, v: Value) => RecordType<Key, Value>;
|
|
6
|
+
loose: <const Key extends RecordTypeKey, const Value extends Parsed<unknown>>(k: Key, v: Value) => RecordType<Key, Value>;
|
|
7
|
+
strict: <const Key extends RecordTypeKey, const Value extends Parsed<unknown>>(k: Key, v: Value) => RecordType<Key, Value>;
|
|
8
|
+
};
|
|
9
|
+
export default record;
|
|
9
10
|
//# sourceMappingURL=record.d.ts.map
|
package/lib/private/record.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
import Loose from "#Loose";
|
|
1
2
|
import RecordType from "#RecordType";
|
|
2
3
|
/**
|
|
3
4
|
* Value is a record of the given key and value types.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
const vanilla = (k, v) => new RecordType(k, v);
|
|
7
|
+
const loose = (k, v) => {
|
|
8
|
+
const i = new RecordType(k, v);
|
|
9
|
+
i[Loose] = true;
|
|
10
|
+
return i;
|
|
11
|
+
};
|
|
12
|
+
const strict = (k, v) => {
|
|
13
|
+
const i = new RecordType(k, v);
|
|
14
|
+
i[Loose] = false;
|
|
15
|
+
return i;
|
|
16
|
+
};
|
|
17
|
+
const record = { vanilla, loose, strict };
|
|
18
|
+
export default record;
|
|
6
19
|
//# sourceMappingURL=record.js.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type BigIntDataType from "#BigIntDataType";
|
|
2
2
|
import type BigIntType from "#BigIntType";
|
|
3
|
-
declare const _default: <T extends BigIntDataType>(t:
|
|
3
|
+
declare const _default: <T extends BigIntDataType>(t: {
|
|
4
|
+
loose: BigIntType<T>;
|
|
5
|
+
strict: BigIntType<T>;
|
|
6
|
+
}, min: bigint, max: bigint) => void;
|
|
4
7
|
export default _default;
|
|
5
8
|
//# sourceMappingURL=bigint.d.ts.map
|