typebox 1.2.2 → 1.2.4
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/type/action/_add_immutable.d.mts +11 -0
- package/build/type/action/_add_immutable.mjs +11 -0
- package/build/type/action/_add_optional.d.mts +11 -0
- package/build/type/action/_add_optional.mjs +11 -0
- package/build/type/action/_add_readonly.d.mts +11 -0
- package/build/type/action/_add_readonly.mjs +11 -0
- package/build/type/action/_remove_immutable.d.mts +11 -0
- package/build/type/action/_remove_immutable.mjs +11 -0
- package/build/type/action/_remove_optional.d.mts +11 -0
- package/build/type/action/_remove_optional.mjs +11 -0
- package/build/type/action/_remove_readonly.d.mts +11 -0
- package/build/type/action/_remove_readonly.mjs +11 -0
- package/build/type/action/conditional.d.mts +2 -3
- package/build/type/action/conditional.mjs +2 -1
- package/build/type/action/index.d.mts +6 -2
- package/build/type/action/index.mjs +6 -2
- package/build/type/action/mapped.d.mts +2 -3
- package/build/type/action/mapped.mjs +2 -1
- package/build/type/engine/call/instantiate.d.mts +1 -3
- package/build/type/engine/call/instantiate.mjs +3 -2
- package/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
- package/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
- package/build/type/engine/cyclic/instantiate.d.mts +2 -5
- package/build/type/engine/cyclic/instantiate.mjs +3 -2
- package/build/type/engine/evaluate/composite.d.mts +10 -6
- package/build/type/engine/evaluate/composite.mjs +10 -6
- package/build/type/engine/immutable/instantiate_add.d.mts +10 -0
- package/build/type/engine/immutable/instantiate_add.mjs +14 -0
- package/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
- package/build/type/engine/immutable/instantiate_remove.mjs +14 -0
- package/build/type/engine/instantiate.d.mts +37 -20
- package/build/type/engine/instantiate.mjs +65 -62
- package/build/type/engine/interface/instantiate.d.mts +3 -6
- package/build/type/engine/module/instantiate.d.mts +1 -3
- package/build/type/engine/module/instantiate.mjs +2 -1
- package/build/type/engine/optional/instantiate_add.d.mts +10 -0
- package/build/type/engine/optional/instantiate_add.mjs +14 -0
- package/build/type/engine/optional/instantiate_remove.d.mts +10 -0
- package/build/type/engine/optional/instantiate_remove.mjs +14 -0
- package/build/type/engine/parameters/instantiate.d.mts +3 -4
- package/build/type/engine/parameters/instantiate.mjs +2 -1
- package/build/type/engine/partial/from_object.d.mts +2 -2
- package/build/type/engine/partial/from_object.mjs +2 -2
- package/build/type/engine/readonly/instantiate_add.d.mts +10 -0
- package/build/type/engine/readonly/instantiate_add.mjs +14 -0
- package/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
- package/build/type/engine/readonly/instantiate_remove.mjs +14 -0
- package/build/type/engine/readonly_object/from_array.d.mts +2 -2
- package/build/type/engine/readonly_object/from_array.mjs +2 -2
- package/build/type/engine/readonly_object/from_object.d.mts +2 -2
- package/build/type/engine/readonly_object/from_object.mjs +2 -2
- package/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
- package/build/type/engine/readonly_object/from_tuple.mjs +2 -2
- package/build/type/engine/ref/instantiate.d.mts +3 -3
- package/build/type/engine/ref/instantiate.mjs +6 -6
- package/build/type/engine/required/from_object.d.mts +2 -2
- package/build/type/engine/required/from_object.mjs +2 -2
- package/build/type/engine/template_literal/is_pattern.mjs +1 -0
- package/build/type/extends/tuple.d.mts +3 -6
- package/build/type/extends/tuple.mjs +3 -2
- package/build/type/script/mapping.d.mts +42 -42
- package/build/type/script/mapping.mjs +46 -46
- package/build/type/script/script.d.mts +3 -4
- package/build/type/script/script.mjs +3 -2
- package/build/type/types/_immutable.d.mts +2 -9
- package/build/type/types/_immutable.mjs +2 -10
- package/build/type/types/_optional.d.mts +2 -9
- package/build/type/types/_optional.mjs +2 -11
- package/build/type/types/_readonly.d.mts +2 -9
- package/build/type/types/_readonly.mjs +2 -10
- package/build/type/types/call.d.mts +3 -3
- package/build/type/types/call.mjs +3 -2
- package/build/type/types/deferred.d.mts +1 -0
- package/build/type/types/deferred.mjs +1 -1
- package/package.json +1 -1
- package/build/type/action/_optional.d.mts +0 -19
- package/build/type/action/_optional.mjs +0 -40
- package/build/type/action/_readonly.d.mts +0 -19
- package/build/type/action/_readonly.mjs +0 -40
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Memory } from '../../system/memory/index.mjs';
|
|
2
|
-
import * as C from '../action/index.mjs';
|
|
3
2
|
import * as T from '../types/index.mjs';
|
|
3
|
+
import * as S from '../action/index.mjs';
|
|
4
4
|
type TIntrinsicOrCall<Target extends string, Parameters extends T.TSchema[]> = ([
|
|
5
5
|
Target,
|
|
6
6
|
Parameters
|
|
@@ -16,67 +16,67 @@ type TIntrinsicOrCall<Target extends string, Parameters extends T.TSchema[]> = (
|
|
|
16
16
|
] extends ['Iterator', [infer Type extends T.TSchema]] ? T.TIterator<Type> : [
|
|
17
17
|
Target,
|
|
18
18
|
Parameters
|
|
19
|
-
] extends ['Awaited', [infer Type extends T.TSchema]] ?
|
|
19
|
+
] extends ['Awaited', [infer Type extends T.TSchema]] ? S.TAwaitedDeferred<Type> : [
|
|
20
20
|
Target,
|
|
21
21
|
Parameters
|
|
22
|
-
] extends ['Capitalize', [infer Type extends T.TSchema]] ?
|
|
22
|
+
] extends ['Capitalize', [infer Type extends T.TSchema]] ? S.TCapitalizeDeferred<Type> : [
|
|
23
23
|
Target,
|
|
24
24
|
Parameters
|
|
25
|
-
] extends ['ConstructorParameters', [infer Type extends T.TSchema]] ?
|
|
25
|
+
] extends ['ConstructorParameters', [infer Type extends T.TSchema]] ? S.TConstructorParametersDeferred<Type> : [
|
|
26
26
|
Target,
|
|
27
27
|
Parameters
|
|
28
|
-
] extends ['Evaluate', [infer Type extends T.TSchema]] ?
|
|
28
|
+
] extends ['Evaluate', [infer Type extends T.TSchema]] ? S.TEvaluateDeferred<Type> : [
|
|
29
29
|
Target,
|
|
30
30
|
Parameters
|
|
31
|
-
] extends ['Exclude', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ?
|
|
31
|
+
] extends ['Exclude', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ? S.TExcludeDeferred<Left, Right> : [
|
|
32
32
|
Target,
|
|
33
33
|
Parameters
|
|
34
|
-
] extends ['Extract', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ?
|
|
34
|
+
] extends ['Extract', [infer Left extends T.TSchema, infer Right extends T.TSchema]] ? S.TExtractDeferred<Left, Right> : [
|
|
35
35
|
Target,
|
|
36
36
|
Parameters
|
|
37
|
-
] extends ['Index', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ?
|
|
37
|
+
] extends ['Index', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? S.TIndexDeferred<Type, Indexer> : [
|
|
38
38
|
Target,
|
|
39
39
|
Parameters
|
|
40
|
-
] extends ['InstanceType', [infer Type extends T.TSchema]] ?
|
|
40
|
+
] extends ['InstanceType', [infer Type extends T.TSchema]] ? S.TInstanceTypeDeferred<Type> : [
|
|
41
41
|
Target,
|
|
42
42
|
Parameters
|
|
43
|
-
] extends ['KeyOf', [infer Type extends T.TSchema]] ?
|
|
43
|
+
] extends ['KeyOf', [infer Type extends T.TSchema]] ? S.TKeyOfDeferred<Type> : [
|
|
44
44
|
Target,
|
|
45
45
|
Parameters
|
|
46
|
-
] extends ['Lowercase', [infer Type extends T.TSchema]] ?
|
|
46
|
+
] extends ['Lowercase', [infer Type extends T.TSchema]] ? S.TLowercaseDeferred<Type> : [
|
|
47
47
|
Target,
|
|
48
48
|
Parameters
|
|
49
|
-
] extends ['NonNullable', [infer Type extends T.TSchema]] ?
|
|
49
|
+
] extends ['NonNullable', [infer Type extends T.TSchema]] ? S.TNonNullableDeferred<Type> : [
|
|
50
50
|
Target,
|
|
51
51
|
Parameters
|
|
52
|
-
] extends ['Omit', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ?
|
|
52
|
+
] extends ['Omit', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? S.TOmitDeferred<Type, Indexer> : [
|
|
53
53
|
Target,
|
|
54
54
|
Parameters
|
|
55
|
-
] extends ['Parameters', [infer Type extends T.TSchema]] ?
|
|
55
|
+
] extends ['Parameters', [infer Type extends T.TSchema]] ? S.TParametersDeferred<Type> : [
|
|
56
56
|
Target,
|
|
57
57
|
Parameters
|
|
58
|
-
] extends ['Partial', [infer Type extends T.TSchema]] ?
|
|
58
|
+
] extends ['Partial', [infer Type extends T.TSchema]] ? S.TPartialDeferred<Type> : [
|
|
59
59
|
Target,
|
|
60
60
|
Parameters
|
|
61
|
-
] extends ['Pick', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ?
|
|
61
|
+
] extends ['Pick', [infer Type extends T.TSchema, infer Indexer extends T.TSchema]] ? S.TPickDeferred<Type, Indexer> : [
|
|
62
62
|
Target,
|
|
63
63
|
Parameters
|
|
64
|
-
] extends ['Readonly', [infer Type extends T.TSchema]] ?
|
|
64
|
+
] extends ['Readonly', [infer Type extends T.TSchema]] ? S.TReadonlyObjectDeferred<Type> : [
|
|
65
65
|
Target,
|
|
66
66
|
Parameters
|
|
67
67
|
] extends ['Record', [infer Key extends T.TSchema, infer Value extends T.TSchema]] ? T.TRecordDeferred<Key, Value> : [
|
|
68
68
|
Target,
|
|
69
69
|
Parameters
|
|
70
|
-
] extends ['Required', [infer Type extends T.TSchema]] ?
|
|
70
|
+
] extends ['Required', [infer Type extends T.TSchema]] ? S.TRequiredDeferred<Type> : [
|
|
71
71
|
Target,
|
|
72
72
|
Parameters
|
|
73
|
-
] extends ['ReturnType', [infer Type extends T.TSchema]] ?
|
|
73
|
+
] extends ['ReturnType', [infer Type extends T.TSchema]] ? S.TReturnTypeDeferred<Type> : [
|
|
74
74
|
Target,
|
|
75
75
|
Parameters
|
|
76
|
-
] extends ['Uncapitalize', [infer Type extends T.TSchema]] ?
|
|
76
|
+
] extends ['Uncapitalize', [infer Type extends T.TSchema]] ? S.TUncapitalizeDeferred<Type> : [
|
|
77
77
|
Target,
|
|
78
78
|
Parameters
|
|
79
|
-
] extends ['Uppercase', [infer Type extends T.TSchema]] ?
|
|
79
|
+
] extends ['Uppercase', [infer Type extends T.TSchema]] ? S.TUppercaseDeferred<Type> : T.TCallConstruct<T.TRef<Target>, Parameters>);
|
|
80
80
|
type TDelimitedDecode<Input extends ([unknown, unknown] | unknown)[], Result extends unknown[] = []> = (Input extends [infer Left, ...infer Right] ? Left extends [infer Item, infer _] ? TDelimitedDecode<Right, [...Result, Item]> : TDelimitedDecode<Right, [...Result, Left]> : Result);
|
|
81
81
|
type TDelimited<Input extends [unknown, unknown]> = Input extends [infer Left extends unknown[], infer Right extends unknown[]] ? TDelimitedDecode<[...Left, ...Right]> : [];
|
|
82
82
|
export type TGenericParameterExtendsEqualsMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [infer Name extends string, 'extends', infer Extends extends T.TSchema, '=', infer Equals extends T.TSchema] ? T.TParameter<Name, Extends, Equals> : never);
|
|
@@ -161,10 +161,10 @@ export type TBaseMapping<Input extends [unknown, unknown, unknown] | unknown> =
|
|
|
161
161
|
export declare function BaseMapping(input: [unknown, unknown, unknown] | unknown): unknown;
|
|
162
162
|
export type TWithMapping<Input extends [unknown, unknown] | []> = (Input extends ['with', infer JsonObject extends Record<PropertyKey, unknown>] ? JsonObject : []);
|
|
163
163
|
export declare function WithMapping(input: [unknown, unknown] | []): unknown;
|
|
164
|
-
type TFactorIndexArray<Type extends T.TSchema, IndexArray extends unknown[]> = (IndexArray extends [infer Left extends T.TSchema[], ...infer Right extends unknown[]] ? (Left extends [infer Indexer extends T.TSchema] ? TFactorIndexArray<
|
|
165
|
-
type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ?
|
|
166
|
-
type TFactorWith<Type extends T.TSchema, With extends unknown> = (With extends Record<PropertyKey, unknown> ?
|
|
167
|
-
export type TFactorMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extend extends unknown[], infer WithClause extends unknown] ? TFactorWith<KeyOf extends true ? TFactorExtends<
|
|
164
|
+
type TFactorIndexArray<Type extends T.TSchema, IndexArray extends unknown[]> = (IndexArray extends [infer Left extends T.TSchema[], ...infer Right extends unknown[]] ? (Left extends [infer Indexer extends T.TSchema] ? TFactorIndexArray<S.TIndexDeferred<Type, Indexer>, Right> : Left extends [] ? TFactorIndexArray<T.TArray<Type>, Right> : T.TNever) : Type);
|
|
165
|
+
type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? S.TConditionalDeferred<Type, Right, True, False> : Type);
|
|
166
|
+
type TFactorWith<Type extends T.TSchema, With extends unknown> = (With extends Record<PropertyKey, unknown> ? S.TWithDeferred<Type, With> : Type);
|
|
167
|
+
export type TFactorMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extend extends unknown[], infer WithClause extends unknown] ? TFactorWith<KeyOf extends true ? TFactorExtends<S.TKeyOfDeferred<TFactorIndexArray<Type, IndexArray>>, Extend> : TFactorExtends<TFactorIndexArray<Type, IndexArray>, Extend>, WithClause> : never);
|
|
168
168
|
export declare function FactorMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
169
169
|
type TExprBinaryMapping<Left extends T.TSchema, Rest extends unknown[]> = (Rest extends [infer Operator extends unknown, infer Right extends T.TSchema, infer Next extends unknown[]] ? (TExprBinaryMapping<Right, Next> extends infer Schema extends T.TSchema ? (Operator extends '&' ? (Schema extends T.TIntersect<infer Types extends T.TSchema[]> ? T.TIntersect<[Left, ...Types]> : T.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends T.TUnion<infer Types extends T.TSchema[]> ? T.TUnion<[Left, ...Types]> : T.TUnion<[Left, Schema]>) : never) : never) : Left);
|
|
170
170
|
export type TExprTermTailMapping<Input extends [unknown, unknown, unknown] | []> = (Input);
|
|
@@ -175,7 +175,7 @@ export type TExprTailMapping<Input extends [unknown, unknown, unknown] | []> = (
|
|
|
175
175
|
export declare function ExprTailMapping(input: [unknown, unknown, unknown] | []): unknown;
|
|
176
176
|
export type TExprMapping<Input extends [unknown, unknown]> = (Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping<Left, Rest> : []);
|
|
177
177
|
export declare function ExprMapping(input: [unknown, unknown]): unknown;
|
|
178
|
-
export type TExprReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ?
|
|
178
|
+
export type TExprReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ? S.TAddImmutableDeferred<Type> : never);
|
|
179
179
|
export declare function ExprReadonlyMapping(input: [unknown, unknown]): unknown;
|
|
180
180
|
export type TExprPipeMapping<Input extends [unknown, unknown]> = (Input extends ['|', infer Type extends T.TSchema] ? Type : never);
|
|
181
181
|
export declare function ExprPipeMapping(input: [unknown, unknown]): unknown;
|
|
@@ -203,13 +203,13 @@ export type TPropertyMapping<Input extends [unknown, unknown, unknown, unknown,
|
|
|
203
203
|
[_ in Key]: ([
|
|
204
204
|
IsReadonly,
|
|
205
205
|
IsOptional
|
|
206
|
-
] extends [true, true] ?
|
|
206
|
+
] extends [true, true] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : [
|
|
207
207
|
IsReadonly,
|
|
208
208
|
IsOptional
|
|
209
|
-
] extends [true, false] ?
|
|
209
|
+
] extends [true, false] ? S.TAddReadonlyDeferred<Type> : [
|
|
210
210
|
IsReadonly,
|
|
211
211
|
IsOptional
|
|
212
|
-
] extends [false, true] ?
|
|
212
|
+
] extends [false, true] ? S.TAddOptionalDeferred<Type> : Type);
|
|
213
213
|
} : never);
|
|
214
214
|
export declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
215
215
|
export type TPropertyDelimiterMapping<Input extends [unknown, unknown] | [unknown]> = (Input);
|
|
@@ -229,13 +229,13 @@ export type TPropertiesMapping<Input extends [unknown, unknown, unknown], Result
|
|
|
229
229
|
export declare function PropertiesMapping(input: [unknown, unknown, unknown]): unknown;
|
|
230
230
|
export type T_Object_Mapping<Input extends unknown> = (Input extends [infer Properties extends T.TProperties, infer _PatternProperties extends T.TProperties] ? T.TObject<Properties> : never);
|
|
231
231
|
export declare function _Object_Mapping(input: unknown): unknown;
|
|
232
|
-
export type TElementNamedMapping<Input extends [unknown, unknown, unknown, unknown, unknown] | [unknown, unknown, unknown, unknown] | [unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ?
|
|
232
|
+
export type TElementNamedMapping<Input extends [unknown, unknown, unknown, unknown, unknown] | [unknown, unknown, unknown, unknown] | [unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : Input extends [string, /**/ ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<Type> : Input extends [string, '?', ':', /* */ infer Type extends T.TSchema] ? S.TAddOptionalDeferred<Type> : Input extends [string, /**/ ':', /* */ infer Type extends T.TSchema] ? Type : never);
|
|
233
233
|
export declare function ElementNamedMapping(input: [unknown, unknown, unknown, unknown, unknown] | [unknown, unknown, unknown, unknown] | [unknown, unknown, unknown]): unknown;
|
|
234
|
-
export type TElementReadonlyOptionalMapping<Input extends [unknown, unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema, '?'] ?
|
|
234
|
+
export type TElementReadonlyOptionalMapping<Input extends [unknown, unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema, '?'] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : never);
|
|
235
235
|
export declare function ElementReadonlyOptionalMapping(input: [unknown, unknown, unknown]): unknown;
|
|
236
|
-
export type TElementReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ?
|
|
236
|
+
export type TElementReadonlyMapping<Input extends [unknown, unknown]> = (Input extends ['readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<Type> : never);
|
|
237
237
|
export declare function ElementReadonlyMapping(input: [unknown, unknown]): unknown;
|
|
238
|
-
export type TElementOptionalMapping<Input extends [unknown, unknown]> = (Input extends [infer Type extends T.TSchema, '?'] ?
|
|
238
|
+
export type TElementOptionalMapping<Input extends [unknown, unknown]> = (Input extends [infer Type extends T.TSchema, '?'] ? S.TAddOptionalDeferred<Type> : never);
|
|
239
239
|
export declare function ElementOptionalMapping(input: [unknown, unknown]): unknown;
|
|
240
240
|
export type TElementBaseMapping<Input extends unknown> = (Input);
|
|
241
241
|
export declare function ElementBaseMapping(input: unknown): unknown;
|
|
@@ -245,11 +245,11 @@ export type TElementListMapping<Input extends [unknown, unknown]> = (TDelimited<
|
|
|
245
245
|
export declare function ElementListMapping(input: [unknown, unknown]): unknown;
|
|
246
246
|
export type T_Tuple_Mapping<Input extends [unknown, unknown, unknown]> = (Input extends ['[', infer Types extends T.TSchema[], ']'] ? T.TTuple<Types> : never);
|
|
247
247
|
export declare function _Tuple_Mapping(input: [unknown, unknown, unknown]): unknown;
|
|
248
|
-
export type TParameterReadonlyOptionalMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ?
|
|
248
|
+
export type TParameterReadonlyOptionalMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<S.TAddOptionalDeferred<Type>> : never);
|
|
249
249
|
export declare function ParameterReadonlyOptionalMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
250
|
-
export type TParameterReadonlyMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, ':', 'readonly', infer Type extends T.TSchema] ?
|
|
250
|
+
export type TParameterReadonlyMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, ':', 'readonly', infer Type extends T.TSchema] ? S.TAddReadonlyDeferred<Type> : never);
|
|
251
251
|
export declare function ParameterReadonlyMapping(input: [unknown, unknown, unknown, unknown]): unknown;
|
|
252
|
-
export type TParameterOptionalMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', infer Type extends T.TSchema] ?
|
|
252
|
+
export type TParameterOptionalMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends [string, '?', ':', infer Type extends T.TSchema] ? S.TAddOptionalDeferred<Type> : never);
|
|
253
253
|
export declare function ParameterOptionalMapping(input: [unknown, unknown, unknown, unknown]): unknown;
|
|
254
254
|
export type TParameterTypeMapping<Input extends [unknown, unknown, unknown]> = (Input extends [string, ':', infer Type extends T.TSchema] ? Type : never);
|
|
255
255
|
export declare function ParameterTypeMapping(input: [unknown, unknown, unknown]): unknown;
|
|
@@ -264,15 +264,15 @@ export declare function _Function_Mapping(input: [unknown, unknown, unknown, unk
|
|
|
264
264
|
export type T_Constructor_Mapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown]> = (Input extends ['new', '(', infer ParameterList extends T.TSchema[], ')', '=>', infer InstanceType extends T.TSchema] ? T.TConstructor<ParameterList, InstanceType> : never);
|
|
265
265
|
export declare function _Constructor_Mapping(input: [unknown, unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
266
266
|
type TModifierOperation = 'add' | 'remove' | 'none';
|
|
267
|
-
type TApplyReadonly<Readonly extends TModifierOperation, Type extends T.TSchema> = (Readonly extends 'remove' ?
|
|
267
|
+
type TApplyReadonly<Readonly extends TModifierOperation, Type extends T.TSchema> = (Readonly extends 'remove' ? S.TRemoveReadonlyDeferred<Type> : Readonly extends 'add' ? S.TAddReadonlyDeferred<Type> : Type);
|
|
268
268
|
export type TMappedReadonlyMapping<Input extends [unknown, unknown] | [unknown] | []> = (Input extends ['-', 'readonly'] ? 'remove' : Input extends ['+', 'readonly'] ? 'add' : Input extends ['readonly'] ? 'add' : 'none');
|
|
269
269
|
export declare function MappedReadonlyMapping(input: [unknown, unknown] | [unknown] | []): unknown;
|
|
270
|
-
type TApplyOptional<Optional extends TModifierOperation, Type extends T.TSchema> = (Optional extends 'remove' ?
|
|
270
|
+
type TApplyOptional<Optional extends TModifierOperation, Type extends T.TSchema> = (Optional extends 'remove' ? S.TRemoveOptionalDeferred<Type> : Optional extends 'add' ? S.TAddOptionalDeferred<Type> : Type);
|
|
271
271
|
export type TMappedOptionalMapping<Input extends [unknown, unknown] | [unknown] | []> = (Input extends ['-', '?'] ? 'remove' : Input extends ['+', '?'] ? 'add' : Input extends ['?'] ? 'add' : 'none');
|
|
272
272
|
export declare function MappedOptionalMapping(input: [unknown, unknown] | [unknown] | []): unknown;
|
|
273
273
|
export type TMappedAsMapping<Input extends [unknown, unknown] | []> = (Input extends ['as', infer Type extends T.TSchema] ? [Type] : []);
|
|
274
274
|
export declare function MappedAsMapping(input: [unknown, unknown] | []): unknown;
|
|
275
|
-
export type T_Mapped_Mapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown]> = (Input extends ['{', infer Readonly extends TModifierOperation, '[', infer Key extends string, 'in', infer Type extends T.TSchema, infer As extends T.TSchema[], ']', infer Optional extends TModifierOperation, ':', infer Property extends T.TSchema, null, '}'] ? (As extends [infer As extends T.TSchema] ?
|
|
275
|
+
export type T_Mapped_Mapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown]> = (Input extends ['{', infer Readonly extends TModifierOperation, '[', infer Key extends string, 'in', infer Type extends T.TSchema, infer As extends T.TSchema[], ']', infer Optional extends TModifierOperation, ':', infer Property extends T.TSchema, null, '}'] ? (As extends [infer As extends T.TSchema] ? S.TMappedDeferred<T.TIdentifier<Key>, Type, As, TApplyReadonly<Readonly, TApplyOptional<Optional, Property>>> : S.TMappedDeferred<T.TIdentifier<Key>, Type, T.TRef<Key>, TApplyReadonly<Readonly, TApplyOptional<Optional, Property>>>) : never);
|
|
276
276
|
export declare function _Mapped_Mapping(input: [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
277
277
|
export type TReferenceMapping<Input extends string, Result extends T.TSchema = T.TRef<Input>> = Result;
|
|
278
278
|
export declare function ReferenceMapping(input: string): unknown;
|
|
@@ -331,11 +331,11 @@ export declare function InterfaceDeclarationHeritageListMapping(input: [unknown,
|
|
|
331
331
|
export type TInterfaceDeclarationHeritageMapping<Input extends [unknown, unknown] | []> = (Input extends ['extends', infer Heritage extends T.TSchema[]] ? Heritage : []);
|
|
332
332
|
export declare function InterfaceDeclarationHeritageMapping(input: [unknown, unknown] | []): unknown;
|
|
333
333
|
export type TInterfaceDeclarationGenericMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends ['interface', infer Name extends string, infer Parameters extends T.TParameter[], infer Heritage extends T.TSchema[], infer Properties extends [T.TProperties, T.TProperties]] ? {
|
|
334
|
-
[_ in Name]: T.TGeneric<Parameters,
|
|
334
|
+
[_ in Name]: T.TGeneric<Parameters, S.TInterfaceDeferred<Heritage, Properties[0]>>;
|
|
335
335
|
} : never);
|
|
336
336
|
export declare function InterfaceDeclarationGenericMapping(input: [unknown, unknown, unknown, unknown, unknown]): unknown;
|
|
337
337
|
export type TInterfaceDeclarationMapping<Input extends [unknown, unknown, unknown, unknown]> = (Input extends ['interface', infer Name extends string, infer Heritage extends T.TSchema[], infer Properties extends [T.TProperties, T.TProperties]] ? {
|
|
338
|
-
[_ in Name]:
|
|
338
|
+
[_ in Name]: S.TInterfaceDeferred<Heritage, Properties[0]>;
|
|
339
339
|
} : never);
|
|
340
340
|
export declare function InterfaceDeclarationMapping(input: [unknown, unknown, unknown, unknown]): unknown;
|
|
341
341
|
export type TTypeAliasDeclarationGenericMapping<Input extends [unknown, unknown, unknown, unknown, unknown]> = (Input extends ['type', infer Name extends string, infer Parameters extends T.TParameter[], '=', infer Type extends T.TSchema] ? {
|
|
@@ -354,7 +354,7 @@ export type TModuleDeclarationListMapping<Input extends [unknown, unknown]> = (T
|
|
|
354
354
|
export declare function ModuleDeclarationListMapping(input: [unknown, unknown]): unknown;
|
|
355
355
|
export type TModuleDeclarationMapping<Input extends [unknown, unknown, unknown]> = (Input extends [null, infer ModuleDeclaration extends T.TProperties, null] ? ModuleDeclaration : never);
|
|
356
356
|
export declare function ModuleDeclarationMapping(input: [unknown, unknown, unknown]): unknown;
|
|
357
|
-
export type TModuleMapping<Input extends [unknown, unknown]> = (Input extends [infer ModuleDeclaration extends T.TProperties, infer ModuleDeclarationList extends [T.TProperties, T.TProperties]] ?
|
|
357
|
+
export type TModuleMapping<Input extends [unknown, unknown]> = (Input extends [infer ModuleDeclaration extends T.TProperties, infer ModuleDeclarationList extends [T.TProperties, T.TProperties]] ? S.TModuleDeferred<Memory.TAssign<ModuleDeclaration, ModuleDeclarationList[0]>> : never);
|
|
358
358
|
export declare function ModuleMapping(input: [unknown, unknown]): unknown;
|
|
359
359
|
export type TScriptMapping<Input extends unknown> = (Input);
|
|
360
360
|
export declare function ScriptMapping(input: unknown): unknown;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// deno-lint-ignore-file
|
|
3
3
|
import { Memory } from '../../system/memory/index.mjs';
|
|
4
4
|
import { Guard } from '../../guard/index.mjs';
|
|
5
|
-
import * as C from '../action/index.mjs';
|
|
6
5
|
import * as T from '../types/index.mjs';
|
|
6
|
+
import * as S from '../action/index.mjs';
|
|
7
7
|
function IntrinsicOrCall(ref, parameters) {
|
|
8
8
|
// deno-coverage-ignore-start
|
|
9
9
|
//
|
|
@@ -12,27 +12,27 @@ function IntrinsicOrCall(ref, parameters) {
|
|
|
12
12
|
Guard.IsEqual(ref, 'AsyncIterator') ? T.AsyncIterator(parameters[0]) :
|
|
13
13
|
Guard.IsEqual(ref, 'Iterator') ? T.Iterator(parameters[0]) :
|
|
14
14
|
Guard.IsEqual(ref, 'Promise') ? T.Promise(parameters[0]) :
|
|
15
|
-
Guard.IsEqual(ref, 'Awaited') ?
|
|
16
|
-
Guard.IsEqual(ref, 'Capitalize') ?
|
|
17
|
-
Guard.IsEqual(ref, 'ConstructorParameters') ?
|
|
18
|
-
Guard.IsEqual(ref, 'Evaluate') ?
|
|
19
|
-
Guard.IsEqual(ref, 'Exclude') ?
|
|
20
|
-
Guard.IsEqual(ref, 'Extract') ?
|
|
21
|
-
Guard.IsEqual(ref, 'Index') ?
|
|
22
|
-
Guard.IsEqual(ref, 'InstanceType') ?
|
|
23
|
-
Guard.IsEqual(ref, 'Lowercase') ?
|
|
24
|
-
Guard.IsEqual(ref, 'NonNullable') ?
|
|
25
|
-
Guard.IsEqual(ref, 'Omit') ?
|
|
26
|
-
Guard.IsEqual(ref, 'Parameters') ?
|
|
27
|
-
Guard.IsEqual(ref, 'Partial') ?
|
|
28
|
-
Guard.IsEqual(ref, 'Pick') ?
|
|
29
|
-
Guard.IsEqual(ref, 'Readonly') ?
|
|
30
|
-
Guard.IsEqual(ref, 'KeyOf') ?
|
|
15
|
+
Guard.IsEqual(ref, 'Awaited') ? S.AwaitedDeferred(parameters[0]) :
|
|
16
|
+
Guard.IsEqual(ref, 'Capitalize') ? S.CapitalizeDeferred(parameters[0]) :
|
|
17
|
+
Guard.IsEqual(ref, 'ConstructorParameters') ? S.ConstructorParametersDeferred(parameters[0]) :
|
|
18
|
+
Guard.IsEqual(ref, 'Evaluate') ? S.EvaluateDeferred(parameters[0]) :
|
|
19
|
+
Guard.IsEqual(ref, 'Exclude') ? S.ExcludeDeferred(parameters[0], parameters[1]) :
|
|
20
|
+
Guard.IsEqual(ref, 'Extract') ? S.ExtractDeferred(parameters[0], parameters[1]) :
|
|
21
|
+
Guard.IsEqual(ref, 'Index') ? S.IndexDeferred(parameters[0], parameters[1]) :
|
|
22
|
+
Guard.IsEqual(ref, 'InstanceType') ? S.InstanceTypeDeferred(parameters[0]) :
|
|
23
|
+
Guard.IsEqual(ref, 'Lowercase') ? S.LowercaseDeferred(parameters[0]) :
|
|
24
|
+
Guard.IsEqual(ref, 'NonNullable') ? S.NonNullableDeferred(parameters[0]) :
|
|
25
|
+
Guard.IsEqual(ref, 'Omit') ? S.OmitDeferred(parameters[0], parameters[1]) :
|
|
26
|
+
Guard.IsEqual(ref, 'Parameters') ? S.ParametersDeferred(parameters[0]) :
|
|
27
|
+
Guard.IsEqual(ref, 'Partial') ? S.PartialDeferred(parameters[0]) :
|
|
28
|
+
Guard.IsEqual(ref, 'Pick') ? S.PickDeferred(parameters[0], parameters[1]) :
|
|
29
|
+
Guard.IsEqual(ref, 'Readonly') ? S.ReadonlyObjectDeferred(parameters[0]) :
|
|
30
|
+
Guard.IsEqual(ref, 'KeyOf') ? S.KeyOfDeferred(parameters[0]) :
|
|
31
31
|
Guard.IsEqual(ref, 'Record') ? T.RecordDeferred(parameters[0], parameters[1]) :
|
|
32
|
-
Guard.IsEqual(ref, 'Required') ?
|
|
33
|
-
Guard.IsEqual(ref, 'ReturnType') ?
|
|
34
|
-
Guard.IsEqual(ref, 'Uncapitalize') ?
|
|
35
|
-
Guard.IsEqual(ref, 'Uppercase') ?
|
|
32
|
+
Guard.IsEqual(ref, 'Required') ? S.RequiredDeferred(parameters[0]) :
|
|
33
|
+
Guard.IsEqual(ref, 'ReturnType') ? S.ReturnTypeDeferred(parameters[0]) :
|
|
34
|
+
Guard.IsEqual(ref, 'Uncapitalize') ? S.UncapitalizeDeferred(parameters[0]) :
|
|
35
|
+
Guard.IsEqual(ref, 'Uppercase') ? S.UppercaseDeferred(parameters[0]) :
|
|
36
36
|
T.CallConstruct(T.Ref(ref), parameters));
|
|
37
37
|
// deno-coverage-ignore-stop
|
|
38
38
|
}
|
|
@@ -189,7 +189,7 @@ export function WithMapping(input) {
|
|
|
189
189
|
function FactorIndexArray(Type, indexArray) {
|
|
190
190
|
return indexArray.reduce((result, left) => {
|
|
191
191
|
const _left = left;
|
|
192
|
-
return (Guard.IsEqual(_left.length, 1) ?
|
|
192
|
+
return (Guard.IsEqual(_left.length, 1) ? S.IndexDeferred(result, _left[0]) :
|
|
193
193
|
Guard.IsEqual(_left.length, 0) ? T.Array(result) :
|
|
194
194
|
Unreachable());
|
|
195
195
|
}, Type);
|
|
@@ -197,18 +197,18 @@ function FactorIndexArray(Type, indexArray) {
|
|
|
197
197
|
// deno-coverage-ignore-stop
|
|
198
198
|
function FactorExtends(type, extend) {
|
|
199
199
|
return Guard.IsEqual(extend.length, 3)
|
|
200
|
-
?
|
|
200
|
+
? S.ConditionalDeferred(type, extend[0], extend[1], extend[2])
|
|
201
201
|
: type;
|
|
202
202
|
}
|
|
203
203
|
function FactorWith(type, withClause) {
|
|
204
204
|
return Guard.IsArray(withClause) && Guard.IsEqual(withClause.length, 0)
|
|
205
205
|
? type
|
|
206
|
-
:
|
|
206
|
+
: S.WithDeferred(type, withClause);
|
|
207
207
|
}
|
|
208
208
|
export function FactorMapping(input) {
|
|
209
209
|
const [keyOf, type, indexArray, extend, withClause] = input;
|
|
210
210
|
return FactorWith(keyOf
|
|
211
|
-
? FactorExtends(
|
|
211
|
+
? FactorExtends(S.KeyOfDeferred(FactorIndexArray(type, indexArray)), extend)
|
|
212
212
|
: FactorExtends(FactorIndexArray(type, indexArray), extend), withClause);
|
|
213
213
|
}
|
|
214
214
|
// deno-coverage-ignore-start
|
|
@@ -244,7 +244,7 @@ export function ExprMapping(input) {
|
|
|
244
244
|
return ExprBinaryMapping(left, rest);
|
|
245
245
|
}
|
|
246
246
|
export function ExprReadonlyMapping(input) {
|
|
247
|
-
return
|
|
247
|
+
return S.AddImmutableDeferred(input[1]);
|
|
248
248
|
}
|
|
249
249
|
export function ExprPipeMapping(input) {
|
|
250
250
|
return input[1];
|
|
@@ -290,9 +290,9 @@ export function OptionalMapping(input) {
|
|
|
290
290
|
export function PropertyMapping(input) {
|
|
291
291
|
const [isReadonly, key, isOptional, _colon, type] = input;
|
|
292
292
|
return {
|
|
293
|
-
[key]: (isReadonly && isOptional ?
|
|
294
|
-
isReadonly && !isOptional ?
|
|
295
|
-
!isReadonly && isOptional ?
|
|
293
|
+
[key]: (isReadonly && isOptional ? S.AddReadonlyDeferred(S.AddOptionalDeferred(type)) :
|
|
294
|
+
isReadonly && !isOptional ? S.AddReadonlyDeferred(type) :
|
|
295
|
+
!isReadonly && isOptional ? S.AddOptionalDeferred(type) :
|
|
296
296
|
type)
|
|
297
297
|
};
|
|
298
298
|
}
|
|
@@ -321,19 +321,19 @@ export function _Object_Mapping(input) {
|
|
|
321
321
|
}
|
|
322
322
|
// deno-coverage-ignore-start
|
|
323
323
|
export function ElementNamedMapping(input) {
|
|
324
|
-
return (Guard.IsEqual(input.length, 5) ?
|
|
324
|
+
return (Guard.IsEqual(input.length, 5) ? S.AddReadonlyDeferred(S.AddOptionalDeferred(input[4])) :
|
|
325
325
|
Guard.IsEqual(input.length, 3) ? input[2] :
|
|
326
|
-
Guard.IsEqual(input.length, 4) ? (Guard.IsEqual(input[2], 'readonly') ?
|
|
326
|
+
Guard.IsEqual(input.length, 4) ? (Guard.IsEqual(input[2], 'readonly') ? S.AddReadonlyDeferred(input[3]) : S.AddOptionalDeferred(input[3])) :
|
|
327
327
|
Unreachable());
|
|
328
328
|
}
|
|
329
329
|
export function ElementReadonlyOptionalMapping(input) {
|
|
330
|
-
return
|
|
330
|
+
return S.AddReadonlyDeferred(S.AddOptionalDeferred(input[1]));
|
|
331
331
|
}
|
|
332
332
|
export function ElementReadonlyMapping(input) {
|
|
333
|
-
return
|
|
333
|
+
return S.AddReadonlyDeferred(input[1]);
|
|
334
334
|
}
|
|
335
335
|
export function ElementOptionalMapping(input) {
|
|
336
|
-
return
|
|
336
|
+
return S.AddOptionalDeferred(input[0]);
|
|
337
337
|
}
|
|
338
338
|
export function ElementBaseMapping(input) {
|
|
339
339
|
return input;
|
|
@@ -351,13 +351,13 @@ export function _Tuple_Mapping(input) {
|
|
|
351
351
|
return T.Tuple(input[1]);
|
|
352
352
|
}
|
|
353
353
|
export function ParameterReadonlyOptionalMapping(input) {
|
|
354
|
-
return
|
|
354
|
+
return S.AddReadonlyDeferred(S.AddOptionalDeferred(input[4]));
|
|
355
355
|
}
|
|
356
356
|
export function ParameterReadonlyMapping(input) {
|
|
357
|
-
return
|
|
357
|
+
return S.AddReadonlyDeferred(input[3]);
|
|
358
358
|
}
|
|
359
359
|
export function ParameterOptionalMapping(input) {
|
|
360
|
-
return
|
|
360
|
+
return S.AddOptionalDeferred(input[3]);
|
|
361
361
|
}
|
|
362
362
|
export function ParameterTypeMapping(input) {
|
|
363
363
|
return input[2];
|
|
@@ -381,8 +381,8 @@ export function _Constructor_Mapping(input) {
|
|
|
381
381
|
return T.Constructor(input[2], input[5]);
|
|
382
382
|
}
|
|
383
383
|
function ApplyReadonly(state, type) {
|
|
384
|
-
return (Guard.IsEqual(state, 'remove') ?
|
|
385
|
-
Guard.IsEqual(state, 'add') ?
|
|
384
|
+
return (Guard.IsEqual(state, 'remove') ? S.RemoveReadonlyDeferred(type) :
|
|
385
|
+
Guard.IsEqual(state, 'add') ? S.AddReadonlyDeferred(type) :
|
|
386
386
|
type);
|
|
387
387
|
}
|
|
388
388
|
export function MappedReadonlyMapping(input) {
|
|
@@ -392,8 +392,8 @@ export function MappedReadonlyMapping(input) {
|
|
|
392
392
|
'none');
|
|
393
393
|
}
|
|
394
394
|
function ApplyOptional(state, type) {
|
|
395
|
-
return (Guard.IsEqual(state, 'remove') ?
|
|
396
|
-
Guard.IsEqual(state, 'add') ?
|
|
395
|
+
return (Guard.IsEqual(state, 'remove') ? S.RemoveOptionalDeferred(type) :
|
|
396
|
+
Guard.IsEqual(state, 'add') ? S.AddOptionalDeferred(type) :
|
|
397
397
|
type);
|
|
398
398
|
}
|
|
399
399
|
export function MappedOptionalMapping(input) {
|
|
@@ -407,8 +407,8 @@ export function MappedAsMapping(input) {
|
|
|
407
407
|
}
|
|
408
408
|
export function _Mapped_Mapping(input) {
|
|
409
409
|
return (Guard.IsArray(input[6]) && Guard.IsEqual(input[6].length, 1)
|
|
410
|
-
?
|
|
411
|
-
:
|
|
410
|
+
? S.MappedDeferred(T.Identifier(input[3]), input[5], input[6][0], ApplyReadonly(input[1], ApplyOptional(input[8], input[10])))
|
|
411
|
+
: S.MappedDeferred(T.Identifier(input[3]), input[5], T.Ref(input[3]), ApplyReadonly(input[1], ApplyOptional(input[8], input[10]))));
|
|
412
412
|
}
|
|
413
413
|
export function ReferenceMapping(input) {
|
|
414
414
|
return T.Ref(input);
|
|
@@ -497,13 +497,13 @@ export function InterfaceDeclarationGenericMapping(input) {
|
|
|
497
497
|
const heritage = input[3];
|
|
498
498
|
const [properties, patternProperties] = input[4];
|
|
499
499
|
const options = Guard.IsEqual(Guard.Keys(patternProperties).length, 0) ? {} : { patternProperties };
|
|
500
|
-
return { [input[1]]: T.Generic(parameters,
|
|
500
|
+
return { [input[1]]: T.Generic(parameters, S.InterfaceDeferred(heritage, properties, options)) };
|
|
501
501
|
}
|
|
502
502
|
export function InterfaceDeclarationMapping(input) {
|
|
503
503
|
const heritage = input[2];
|
|
504
504
|
const [properties, patternProperties] = input[3];
|
|
505
505
|
const options = Guard.IsEqual(Guard.Keys(patternProperties).length, 0) ? {} : { patternProperties };
|
|
506
|
-
return { [input[1]]:
|
|
506
|
+
return { [input[1]]: S.InterfaceDeferred(heritage, properties, options) };
|
|
507
507
|
}
|
|
508
508
|
export function TypeAliasDeclarationGenericMapping(input) {
|
|
509
509
|
return { [input[1]]: T.Generic(input[2], input[4]) };
|
|
@@ -526,7 +526,7 @@ export function ModuleDeclarationMapping(input) {
|
|
|
526
526
|
export function ModuleMapping(input) {
|
|
527
527
|
const moduleDeclaration = input[0];
|
|
528
528
|
const moduleDeclarationList = input[1];
|
|
529
|
-
return
|
|
529
|
+
return S.ModuleDeferred(Memory.Assign(moduleDeclaration, moduleDeclarationList[0]));
|
|
530
530
|
}
|
|
531
531
|
export function ScriptMapping(input) {
|
|
532
532
|
return input;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { TArrayOptions, TIntersectOptions, TNumberOptions, TObjectOptions, TStringOptions, TTupleOptions } from '../../type/index.mjs';
|
|
2
|
-
import { type TInstantiateType } from '../engine/instantiate.mjs';
|
|
3
2
|
import { type TNever, type TSchema, type TProperties } from '../types/index.mjs';
|
|
3
|
+
import { type TInstantiateType } from '../engine/instantiate.mjs';
|
|
4
|
+
import { type TState } from '../engine/instantiate.mjs';
|
|
4
5
|
import * as Parser from './parser.mjs';
|
|
5
6
|
export type TScriptOptions = TArrayOptions | TIntersectOptions | TNumberOptions | TObjectOptions | TStringOptions | TTupleOptions;
|
|
6
7
|
/** Parses a string-based TypeScript type expression into a TypeBox type. */
|
|
7
|
-
export type TScript<Context extends TProperties, Input extends string> = (Parser.TScript<Input> extends [infer Type extends TSchema, string] ? TInstantiateType<Context,
|
|
8
|
-
callstack: [];
|
|
9
|
-
}, Type> : TNever);
|
|
8
|
+
export type TScript<Context extends TProperties, Input extends string> = (Parser.TScript<Input> extends [infer Type extends TSchema, string] ? TInstantiateType<Context, TState<[], []>, Type> : TNever);
|
|
10
9
|
/** Parses a type from a TypeScript type expression */
|
|
11
10
|
export declare function Script<Script extends string>(input: Script): TScript<{}, Script>;
|
|
12
11
|
/** Parses a type from a TypeScript type expression */
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import { Arguments } from '../../system/arguments/index.mjs';
|
|
4
4
|
import { Memory } from '../../system/memory/index.mjs';
|
|
5
5
|
import { Guard } from '../../guard/index.mjs';
|
|
6
|
-
import { InstantiateType } from '../engine/instantiate.mjs';
|
|
7
6
|
import { Never } from '../types/index.mjs';
|
|
7
|
+
import { InstantiateType } from '../engine/instantiate.mjs';
|
|
8
|
+
import { State } from '../engine/instantiate.mjs';
|
|
8
9
|
import * as Parser from './parser.mjs';
|
|
9
10
|
/** Parses a type from a TypeScript type expression */
|
|
10
11
|
export function Script(...args) {
|
|
@@ -15,7 +16,7 @@ export function Script(...args) {
|
|
|
15
16
|
});
|
|
16
17
|
const result = Parser.Script(input);
|
|
17
18
|
const parsed = Guard.IsArray(result) && Guard.IsEqual(result.length, 2)
|
|
18
|
-
? InstantiateType(context,
|
|
19
|
+
? InstantiateType(context, State([], []), result[0])
|
|
19
20
|
: Never();
|
|
20
21
|
return Memory.Update(parsed, {}, options);
|
|
21
22
|
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type TSchema } from './schema.mjs';
|
|
2
|
-
|
|
3
|
-
export type TImmutableRemove<Type extends TSchema, Result extends TSchema = Type extends TImmutable<infer Type extends TSchema> ? Type : Type> = Result;
|
|
4
|
-
/** Removes Immutable from the given type. */
|
|
5
|
-
export declare function ImmutableRemove<Type extends TSchema>(type: Type): TImmutableRemove<Type>;
|
|
6
|
-
/** Adds Immutable to the given type. */
|
|
7
|
-
export type TImmutableAdd<Type extends TSchema = TSchema> = ('~immutable' extends keyof Type ? Type : TImmutable<Type>);
|
|
8
|
-
/** Adds Immutable to the given type. */
|
|
9
|
-
export declare function ImmutableAdd<Type extends TSchema>(type: Type): TImmutableAdd<Type>;
|
|
2
|
+
import { type TAddImmutable } from '../action/_add_immutable.mjs';
|
|
10
3
|
export type TImmutable<Type extends TSchema = TSchema> = (Type & {
|
|
11
4
|
'~immutable': true;
|
|
12
5
|
});
|
|
13
6
|
/** Applies an Immutable modifier to the given type. */
|
|
14
|
-
export declare function Immutable<Type extends TSchema>(type: Type):
|
|
7
|
+
export declare function Immutable<Type extends TSchema>(type: Type): TAddImmutable<Type>;
|
|
15
8
|
/** Returns true if the given value is a TImmutable */
|
|
16
9
|
export declare function IsImmutable(value: unknown): value is TImmutable<TSchema>;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Memory } from '../../system/memory/index.mjs';
|
|
3
2
|
import { Guard } from '../../guard/index.mjs';
|
|
4
3
|
import { IsSchema } from './schema.mjs';
|
|
5
|
-
|
|
6
|
-
export function ImmutableRemove(type) {
|
|
7
|
-
return Memory.Discard(type, ['~immutable']);
|
|
8
|
-
}
|
|
9
|
-
/** Adds Immutable to the given type. */
|
|
10
|
-
export function ImmutableAdd(type) {
|
|
11
|
-
return Memory.Update(type, { '~immutable': true }, {});
|
|
12
|
-
}
|
|
4
|
+
import { AddImmutable } from '../action/_add_immutable.mjs';
|
|
13
5
|
// ------------------------------------------------------------------
|
|
14
6
|
// Factory
|
|
15
7
|
// ------------------------------------------------------------------
|
|
16
8
|
/** Applies an Immutable modifier to the given type. */
|
|
17
9
|
export function Immutable(type) {
|
|
18
|
-
return
|
|
10
|
+
return AddImmutable(type);
|
|
19
11
|
}
|
|
20
12
|
// ------------------------------------------------------------------
|
|
21
13
|
// Guard
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type TSchema } from './schema.mjs';
|
|
2
|
-
|
|
3
|
-
export type TOptionalRemove<Type extends TSchema, Result extends TSchema = Type extends TOptional<infer Type extends TSchema> ? Type : Type> = Result;
|
|
4
|
-
/** Removes Optional from the given type. */
|
|
5
|
-
export declare function OptionalRemove<Type extends TSchema>(type: Type): TOptionalRemove<Type>;
|
|
6
|
-
/** Adds Optional to the given type. */
|
|
7
|
-
export type TOptionalAdd<Type extends TSchema = TSchema, Result extends TSchema = '~optional' extends keyof Type ? Type : TOptional<Type>> = Result;
|
|
8
|
-
/** Adds Optional to the given type. */
|
|
9
|
-
export declare function OptionalAdd<Type extends TSchema>(type: Type): TOptionalAdd<Type>;
|
|
2
|
+
import { type TAddOptional } from '../action/_add_optional.mjs';
|
|
10
3
|
export type TOptional<Type extends TSchema = TSchema> = (Type & {
|
|
11
4
|
'~optional': true;
|
|
12
5
|
});
|
|
13
6
|
/** Applies an Optional modifier to the given type. */
|
|
14
|
-
export declare function Optional<Type extends TSchema>(type: Type):
|
|
7
|
+
export declare function Optional<Type extends TSchema>(type: Type): TAddOptional<Type>;
|
|
15
8
|
/** Returns true if the given value is TOptional */
|
|
16
9
|
export declare function IsOptional(value: unknown): value is TOptional<TSchema>;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import { Guard } from '../../guard/index.mjs';
|
|
3
|
-
import { Memory } from '../../system/memory/index.mjs';
|
|
4
3
|
import { IsSchema } from './schema.mjs';
|
|
5
|
-
|
|
6
|
-
export function OptionalRemove(type) {
|
|
7
|
-
const result = Memory.Discard(type, ['~optional']);
|
|
8
|
-
return result;
|
|
9
|
-
}
|
|
10
|
-
/** Adds Optional to the given type. */
|
|
11
|
-
export function OptionalAdd(type) {
|
|
12
|
-
return Memory.Update(type, { '~optional': true }, {});
|
|
13
|
-
}
|
|
4
|
+
import { AddOptional } from '../action/_add_optional.mjs';
|
|
14
5
|
// ------------------------------------------------------------------
|
|
15
6
|
// Factory
|
|
16
7
|
// ------------------------------------------------------------------
|
|
17
8
|
/** Applies an Optional modifier to the given type. */
|
|
18
9
|
export function Optional(type) {
|
|
19
|
-
return
|
|
10
|
+
return AddOptional(type);
|
|
20
11
|
}
|
|
21
12
|
// ------------------------------------------------------------------
|
|
22
13
|
// Guard
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { type TSchema } from './schema.mjs';
|
|
2
|
-
|
|
3
|
-
export type TReadonlyRemove<Type extends TSchema, Result extends TSchema = Type extends TReadonly<infer Type extends TSchema> ? Type : Type> = Result;
|
|
4
|
-
/** Removes a Readonly property modifier from the given type. */
|
|
5
|
-
export declare function ReadonlyRemove<Type extends TSchema>(type: Type): TReadonlyRemove<Type>;
|
|
6
|
-
/** Adds a Readonly property modifier to the given type. */
|
|
7
|
-
export type TReadonlyAdd<Type extends TSchema = TSchema> = ('~readonly' extends keyof Type ? Type : TReadonly<Type>);
|
|
8
|
-
/** Adds a Readonly property modifier to the given type. */
|
|
9
|
-
export declare function ReadonlyAdd<Type extends TSchema>(type: Type): TReadonlyAdd<Type>;
|
|
2
|
+
import { type TAddReadonly } from '../action/_add_readonly.mjs';
|
|
10
3
|
export type TReadonly<Type extends TSchema = TSchema> = (Type & {
|
|
11
4
|
'~readonly': true;
|
|
12
5
|
});
|
|
13
6
|
/** Applies an Readonly property modifier to the given type. */
|
|
14
|
-
export declare function Readonly<Type extends TSchema>(type: Type):
|
|
7
|
+
export declare function Readonly<Type extends TSchema>(type: Type): TAddReadonly<Type>;
|
|
15
8
|
/** Returns true if the given value is a TReadonly */
|
|
16
9
|
export declare function IsReadonly(value: unknown): value is TReadonly<TSchema>;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Memory } from '../../system/memory/index.mjs';
|
|
3
2
|
import { Guard } from '../../guard/index.mjs';
|
|
4
3
|
import { IsSchema } from './schema.mjs';
|
|
5
|
-
|
|
6
|
-
export function ReadonlyRemove(type) {
|
|
7
|
-
return Memory.Discard(type, ['~readonly']);
|
|
8
|
-
}
|
|
9
|
-
/** Adds a Readonly property modifier to the given type. */
|
|
10
|
-
export function ReadonlyAdd(type) {
|
|
11
|
-
return Memory.Update(type, { '~readonly': true }, {});
|
|
12
|
-
}
|
|
4
|
+
import { AddReadonly } from '../action/_add_readonly.mjs';
|
|
13
5
|
// ------------------------------------------------------------------
|
|
14
6
|
// Factory
|
|
15
7
|
// ------------------------------------------------------------------
|
|
16
8
|
/** Applies an Readonly property modifier to the given type. */
|
|
17
9
|
export function Readonly(type) {
|
|
18
|
-
return
|
|
10
|
+
return AddReadonly(type);
|
|
19
11
|
}
|
|
20
12
|
// ------------------------------------------------------------------
|
|
21
13
|
// Guard
|