typia 5.0.0-dev.20230823-2 → 5.0.0-dev.2023084

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/lib/factories/MetadataTagFactory.js +4 -2
  2. package/lib/factories/MetadataTagFactory.js.map +1 -1
  3. package/lib/factories/ProtobufFactory.js +2 -1
  4. package/lib/factories/ProtobufFactory.js.map +1 -1
  5. package/lib/factories/internal/metadata/emend_metadata_atomics.js +6 -6
  6. package/lib/factories/internal/metadata/emend_metadata_atomics.js.map +1 -1
  7. package/lib/factories/internal/metadata/iterate_metadata_atomic.js +1 -1
  8. package/lib/factories/internal/metadata/iterate_metadata_atomic.js.map +1 -1
  9. package/lib/programmers/CheckerProgrammer.js +6 -6
  10. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  11. package/lib/programmers/RandomProgrammer.js +5 -5
  12. package/lib/programmers/RandomProgrammer.js.map +1 -1
  13. package/lib/programmers/helpers/AtomicPredicator.js +2 -2
  14. package/lib/programmers/helpers/AtomicPredicator.js.map +1 -1
  15. package/lib/programmers/helpers/ProtobufUtil.js +2 -2
  16. package/lib/programmers/helpers/ProtobufUtil.js.map +1 -1
  17. package/lib/programmers/internal/application_default_string.js +2 -2
  18. package/lib/programmers/internal/application_default_string.js.map +1 -1
  19. package/lib/programmers/internal/application_schema.js +5 -5
  20. package/lib/programmers/internal/application_schema.js.map +1 -1
  21. package/lib/programmers/internal/metadata_to_pattern.js +4 -4
  22. package/lib/programmers/internal/metadata_to_pattern.js.map +1 -1
  23. package/lib/programmers/internal/stringify_dynamic_properties.js +2 -1
  24. package/lib/programmers/internal/stringify_dynamic_properties.js.map +1 -1
  25. package/lib/programmers/json/JsonStringifyProgrammer.js +16 -10
  26. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  27. package/lib/programmers/misc/MiscLiteralsProgrammer.js +2 -2
  28. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  29. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +1 -1
  30. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  31. package/lib/schemas/metadata/IMetadata.d.ts +2 -2
  32. package/lib/schemas/metadata/IMetadataAtomic.d.ts +12 -0
  33. package/lib/schemas/metadata/IMetadataAtomic.js +3 -0
  34. package/lib/schemas/metadata/IMetadataAtomic.js.map +1 -0
  35. package/lib/schemas/metadata/Metadata.d.ts +2 -2
  36. package/lib/schemas/metadata/Metadata.js +49 -44
  37. package/lib/schemas/metadata/Metadata.js.map +1 -1
  38. package/lib/tags/ExclusiveMaximum.d.ts +8 -0
  39. package/lib/tags/ExclusiveMaximum.js +3 -0
  40. package/lib/tags/ExclusiveMaximum.js.map +1 -0
  41. package/lib/tags/ExclusiveMinimum.d.ts +8 -0
  42. package/lib/tags/ExclusiveMinimum.js +3 -0
  43. package/lib/tags/ExclusiveMinimum.js.map +1 -0
  44. package/lib/tags/Format.d.ts +8 -0
  45. package/lib/tags/Format.js +3 -0
  46. package/lib/tags/Format.js.map +1 -0
  47. package/lib/tags/MaxItems.d.ts +8 -0
  48. package/lib/tags/MaxItems.js +3 -0
  49. package/lib/tags/MaxItems.js.map +1 -0
  50. package/lib/tags/MaxLength.d.ts +8 -0
  51. package/lib/tags/MaxLength.js +3 -0
  52. package/lib/tags/MaxLength.js.map +1 -0
  53. package/lib/tags/Maximum.d.ts +8 -0
  54. package/lib/tags/Maximum.js +3 -0
  55. package/lib/tags/Maximum.js.map +1 -0
  56. package/lib/tags/MinItems.d.ts +8 -0
  57. package/lib/tags/MinItems.js +3 -0
  58. package/lib/tags/MinItems.js.map +1 -0
  59. package/lib/tags/MinLength.d.ts +8 -0
  60. package/lib/tags/MinLength.js +3 -0
  61. package/lib/tags/MinLength.js.map +1 -0
  62. package/lib/tags/Minimum.d.ts +8 -0
  63. package/lib/tags/Minimum.js +3 -0
  64. package/lib/tags/Minimum.js.map +1 -0
  65. package/lib/tags/MultipleOf.d.ts +8 -0
  66. package/lib/tags/MultipleOf.js +3 -0
  67. package/lib/tags/MultipleOf.js.map +1 -0
  68. package/lib/tags/Pattern.d.ts +8 -0
  69. package/lib/tags/Pattern.js +3 -0
  70. package/lib/tags/Pattern.js.map +1 -0
  71. package/lib/tags/TagBase.d.ts +10 -0
  72. package/lib/tags/TagBase.js +3 -0
  73. package/lib/tags/TagBase.js.map +1 -0
  74. package/lib/tags/Type.d.ts +13 -0
  75. package/lib/tags/Type.js +3 -0
  76. package/lib/tags/Type.js.map +1 -0
  77. package/lib/tags/index.d.ts +12 -0
  78. package/lib/tags/index.js +29 -0
  79. package/lib/tags/index.js.map +1 -0
  80. package/lib/transformers/features/json/JsonApplicationTransformer.js +1 -1
  81. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  82. package/package.json +1 -1
  83. package/src/Primitive.ts +135 -135
  84. package/src/Resolved.ts +116 -116
  85. package/src/factories/MetadataFactory.ts +46 -46
  86. package/src/factories/MetadataTagFactory.ts +366 -364
  87. package/src/factories/ProtobufFactory.ts +268 -266
  88. package/src/factories/internal/metadata/emend_metadata_atomics.ts +35 -33
  89. package/src/factories/internal/metadata/explore_metadata.ts +38 -38
  90. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +63 -59
  91. package/src/factories/internal/metadata/iterate_metadata_collection.ts +133 -133
  92. package/src/factories/internal/metadata/iterate_metadata_native.ts +210 -210
  93. package/src/factories/internal/metadata/iterate_metadata_resolve.ts +49 -49
  94. package/src/factories/internal/metadata/iterate_metadata_sort.ts +69 -69
  95. package/src/functional/$ProtobufWriter.ts +151 -151
  96. package/src/json.ts +648 -648
  97. package/src/misc.ts +651 -651
  98. package/src/module.ts +709 -709
  99. package/src/programmers/AssertProgrammer.ts +281 -281
  100. package/src/programmers/CheckerProgrammer.ts +1174 -1173
  101. package/src/programmers/IsProgrammer.ts +241 -241
  102. package/src/programmers/RandomProgrammer.ts +874 -874
  103. package/src/programmers/ValidateProgrammer.ts +307 -307
  104. package/src/programmers/helpers/AtomicPredicator.ts +31 -31
  105. package/src/programmers/helpers/FunctionImporeter.ts +91 -91
  106. package/src/programmers/helpers/ProtobufUtil.ts +29 -29
  107. package/src/programmers/helpers/StringifyPredicator.ts +12 -12
  108. package/src/programmers/helpers/disable_function_importer_declare.ts +32 -32
  109. package/src/programmers/internal/application_default_string.ts +37 -33
  110. package/src/programmers/internal/application_resolved.ts +55 -55
  111. package/src/programmers/internal/application_schema.ts +157 -157
  112. package/src/programmers/internal/metadata_to_pattern.ts +34 -34
  113. package/src/programmers/internal/stringify_dynamic_properties.ts +171 -171
  114. package/src/programmers/json/JsonStringifyProgrammer.ts +995 -989
  115. package/src/programmers/misc/MiscAssertCloneProgrammer.ts +71 -71
  116. package/src/programmers/misc/MiscCloneProgrammer.ts +775 -775
  117. package/src/programmers/misc/MiscIsCloneProgrammer.ts +78 -78
  118. package/src/programmers/misc/MiscLiteralsProgrammer.ts +64 -64
  119. package/src/programmers/misc/MiscPruneProgrammer.ts +544 -544
  120. package/src/programmers/misc/MiscValidateCloneProgrammer.ts +85 -85
  121. package/src/programmers/protobuf/ProtobufAssertDecodeProgrammer.ts +75 -75
  122. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +673 -673
  123. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +814 -814
  124. package/src/programmers/protobuf/ProtobufIsDecodeProgrammer.ts +85 -85
  125. package/src/programmers/protobuf/ProtobufValidateDecodeProgrammer.ts +75 -75
  126. package/src/protobuf.ts +881 -881
  127. package/src/schemas/metadata/IMetadata.ts +27 -28
  128. package/src/schemas/metadata/IMetadataAtomic.ts +13 -0
  129. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  130. package/src/schemas/metadata/Metadata.ts +643 -634
  131. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  132. package/src/tags/ExclusiveMaximum.ts +8 -0
  133. package/src/tags/ExclusiveMinimum.ts +8 -0
  134. package/src/tags/Format.ts +29 -0
  135. package/src/tags/MaxItems.ts +8 -0
  136. package/src/tags/MaxLength.ts +8 -0
  137. package/src/tags/Maximum.ts +8 -0
  138. package/src/tags/MinItems.ts +8 -0
  139. package/src/tags/MinLength.ts +8 -0
  140. package/src/tags/Minimum.ts +8 -0
  141. package/src/tags/MultipleOf.ts +10 -0
  142. package/src/tags/Pattern.ts +8 -0
  143. package/src/tags/TagBase.ts +17 -0
  144. package/src/tags/Type.ts +30 -0
  145. package/src/tags/index.ts +12 -0
  146. package/src/transformers/features/json/JsonApplicationTransformer.ts +111 -111
  147. package/src/transformers/features/misc/MetadataTransformer.ts +53 -53
  148. package/src/utils/RandomGenerator.ts +83 -83
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ExclusiveMaximum"), exports);
18
+ __exportStar(require("./ExclusiveMinimum"), exports);
19
+ __exportStar(require("./Format"), exports);
20
+ __exportStar(require("./Maximum"), exports);
21
+ __exportStar(require("./MaxItems"), exports);
22
+ __exportStar(require("./MaxLength"), exports);
23
+ __exportStar(require("./Minimum"), exports);
24
+ __exportStar(require("./MinItems"), exports);
25
+ __exportStar(require("./MinLength"), exports);
26
+ __exportStar(require("./Pattern"), exports);
27
+ __exportStar(require("./TagBase"), exports);
28
+ __exportStar(require("./Type"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tags/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,qDAAmC;AACnC,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,yCAAuB"}
@@ -35,7 +35,7 @@ var JsonApplicationTransformer;
35
35
  constant: true,
36
36
  absorb: false,
37
37
  validate: function (meta) {
38
- if (meta.atomics.find(function (str) { return str === "bigint"; }))
38
+ if (meta.atomics.find(function (atom) { return atom.type === "bigint"; }))
39
39
  throw new Error(NO_BIGIT);
40
40
  else if (meta.arrays.some(function (array) { return array.value.isRequired() === false; }))
41
41
  throw new Error(NO_UNDEFINED_IN_ARRAY);
@@ -1 +1 @@
1
- {"version":3,"file":"JsonApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/json/JsonApplicationTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,oEAAmE;AACnE,4EAA2E;AAC3E,sEAAqE;AAKrE,iGAAgG;AAIhG,IAAiB,0BAA0B,CAwF1C;AAxFD,WAAiB,0BAA0B;IAC1B,oCAAS,GAClB,UAAC,EAAqB;YAAnB,OAAO,aAAA;QACV,OAAA,UAAC,UAA6B;;YAC1B,IAAI,CAAC,CAAA,MAAA,UAAU,CAAC,aAAa,0CAAE,MAAM,CAAA;gBACjC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAMzC,IAAM,GAAG,GAAY,UAAU,CAAC,aAAa,CAAC,CAAC,CAAE,CAAC;YAClD,IAAI,CAAC,oBAAE,CAAC,eAAe,CAAC,GAAG,CAAC;gBAAE,OAAO,UAAU,CAAC;iBAC3C,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,C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CAAkC,CAChD;4BAED,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC/C,CAAC;iBACJ,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;YAdpB,CAcoB,CACvB,CAAC;YAGF,IAAM,GAAG,GAAqB,qDAAyB,CAAC,KAAK,CAAC;gBAC1D,OAAO,SAAA;aACV,CAAC,CAAC,SAAS,CAAC,CAAC;YAGd,OAAO,+BAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC;IA3DD,CA2DC,CAAC;IAEN,IAAM,aAAa,GAAG,UAClB,OAAuB,EACvB,IAAY,EACZ,IAA6B,EAC7B,UAAsC,EACtC,SAAkB;QAElB,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,EAAE,CAAC;QAG9B,IAAM,IAAI,GAAY,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,KAAK,CACX,2DAAmD,IAAI,yBAAqB,CAC/E,CAAC;QAGN,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,KAAK;YACxD,MAAM,IAAI,KAAK,CACX,4EAAoE,IAAI,QAAI,CAC/E,CAAC;QACN,OAAO,KAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,EAxFgB,0BAA0B,0CAA1B,0BAA0B,QAwF1C;AAED,IAAM,mBAAmB,GACrB,yDAAyD,CAAC;AAC9D,IAAM,gBAAgB,GAClB,uEAAuE,CAAC;AAC5E,IAAM,QAAQ,GACV,gEAAgE,CAAC;AACrE,IAAM,qBAAqB,GACvB,4EAA4E,CAAC"}
1
+ {"version":3,"file":"JsonApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/json/JsonApplicationTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0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C,KAAK,CAAC;QACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,KAAK;YACxD,MAAM,IAAI,KAAK,CACX,4EAAoE,IAAI,QAAI,CAC/E,CAAC;QACN,OAAO,KAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,EAxFgB,0BAA0B,0CAA1B,0BAA0B,QAwF1C;AAED,IAAM,mBAAmB,GACrB,yDAAyD,CAAC;AAC9D,IAAM,gBAAgB,GAClB,uEAAuE,CAAC;AAC5E,IAAM,QAAQ,GACV,gEAAgE,CAAC;AACrE,IAAM,qBAAqB,GACvB,4EAA4E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "5.0.0-dev.20230823-2",
3
+ "version": "5.0.0-dev.2023084",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
package/src/Primitive.ts CHANGED
@@ -1,135 +1,135 @@
1
- /**
2
- * Primitive type of JSON.
3
- *
4
- * `Primitive<T>` is a TMP (Type Meta Programming) type which converts
5
- * its argument as a primitive type within framework JSON.
6
- *
7
- * If the target argument is a built-in class which returns its origin primitive type
8
- * through the `valueOf()` method like the `String` or `Number`, its return type would
9
- * be the `string` or `number`. Otherwise, the built-in class does not have the
10
- * `valueOf()` method, the return type would be an empty object (`{}`).
11
- *
12
- * Otherwise, the target argument is a type of custom class, all of its custom method
13
- * would be erased and its prototype would be changed to the primitive `object`.
14
- * Therefore, return type of the TMP type finally be the primitive object.
15
- *
16
- * In addition, if the target argument is a type of custom class and it has a special
17
- * method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
18
- * but `Primitive<ReturnType<Instance.toJSON>>`.
19
- *
20
- * Before | After
21
- * ------------------------|----------------------------------------
22
- * `Boolean` | `boolean`
23
- * `Number` | `number`
24
- * `String` | `string`
25
- * `Class` | `object`
26
- * `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
27
- * Native Class | `{}`
28
- * Others | No change
29
- *
30
- * @template Instance Target argument type.
31
- * @author Jenogho Nam - https://github.com/samchon
32
- * @author Kyungsu Kang - https://github.com/kakasoo
33
- * @author Michael - https://github.com/8471919
34
- */
35
- export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true
36
- ? T
37
- : PrimitiveMain<T>;
38
-
39
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
40
-
41
- type PrimitiveMain<Instance> = Instance extends [never]
42
- ? never // (special trick for jsonable | null) type
43
- : ValueOf<Instance> extends bigint
44
- ? never
45
- : ValueOf<Instance> extends boolean | number | string
46
- ? ValueOf<Instance>
47
- : Instance extends Function
48
- ? never
49
- : ValueOf<Instance> extends object
50
- ? Instance extends object
51
- ? Instance extends NativeClass
52
- ? {}
53
- : Instance extends IJsonable<infer Raw>
54
- ? ValueOf<Raw> extends object
55
- ? Raw extends object
56
- ? PrimitiveObject<Raw> // object would be primitified
57
- : never // cannot be
58
- : ValueOf<Raw> // atomic value
59
- : PrimitiveObject<Instance> // object would be primitified
60
- : never // cannot be
61
- : ValueOf<Instance>;
62
-
63
- type PrimitiveObject<Instance extends object> = Instance extends Array<infer T>
64
- ? IsTuple<Instance> extends true
65
- ? PrimitiveTuple<Instance>
66
- : PrimitiveMain<T>[]
67
- : {
68
- [P in keyof Instance]: PrimitiveMain<Instance[P]>;
69
- };
70
-
71
- type PrimitiveTuple<T extends readonly any[]> = T extends []
72
- ? []
73
- : T extends [infer F]
74
- ? [PrimitiveMain<F>]
75
- : T extends [infer F, ...infer Rest extends readonly any[]]
76
- ? [PrimitiveMain<F>, ...PrimitiveTuple<Rest>]
77
- : T extends [(infer F)?]
78
- ? [PrimitiveMain<F>?]
79
- : T extends [(infer F)?, ...infer Rest extends readonly any[]]
80
- ? [PrimitiveMain<F>?, ...PrimitiveTuple<Rest>]
81
- : [];
82
-
83
- type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true
84
- ? boolean
85
- : IsValueOf<Instance, Number> extends true
86
- ? number
87
- : IsValueOf<Instance, String> extends true
88
- ? string
89
- : Instance;
90
-
91
- type NativeClass =
92
- | Set<any>
93
- | Map<any, any>
94
- | WeakSet<any>
95
- | WeakMap<any, any>
96
- | Uint8Array
97
- | Uint8ClampedArray
98
- | Uint16Array
99
- | Uint32Array
100
- | BigUint64Array
101
- | Int8Array
102
- | Int16Array
103
- | Int32Array
104
- | BigInt64Array
105
- | Float32Array
106
- | Float64Array
107
- | ArrayBuffer
108
- | SharedArrayBuffer
109
- | DataView;
110
-
111
- type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
112
- never,
113
- ]
114
- ? false
115
- : T extends readonly any[]
116
- ? number extends T["length"]
117
- ? false
118
- : true
119
- : false;
120
-
121
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
122
- ? Object extends IValueOf<infer U>
123
- ? Instance extends U
124
- ? false
125
- : true // not Primitive, but Object
126
- : false // cannot be
127
- : false;
128
-
129
- interface IValueOf<T> {
130
- valueOf(): T;
131
- }
132
-
133
- interface IJsonable<T> {
134
- toJSON(): T;
135
- }
1
+ /**
2
+ * Primitive type of JSON.
3
+ *
4
+ * `Primitive<T>` is a TMP (Type Meta Programming) type which converts
5
+ * its argument as a primitive type within framework JSON.
6
+ *
7
+ * If the target argument is a built-in class which returns its origin primitive type
8
+ * through the `valueOf()` method like the `String` or `Number`, its return type would
9
+ * be the `string` or `number`. Otherwise, the built-in class does not have the
10
+ * `valueOf()` method, the return type would be an empty object (`{}`).
11
+ *
12
+ * Otherwise, the target argument is a type of custom class, all of its custom method
13
+ * would be erased and its prototype would be changed to the primitive `object`.
14
+ * Therefore, return type of the TMP type finally be the primitive object.
15
+ *
16
+ * In addition, if the target argument is a type of custom class and it has a special
17
+ * method `toJSON()`, return type of this `Primitive` would be not `Primitive<Instance>`
18
+ * but `Primitive<ReturnType<Instance.toJSON>>`.
19
+ *
20
+ * Before | After
21
+ * ------------------------|----------------------------------------
22
+ * `Boolean` | `boolean`
23
+ * `Number` | `number`
24
+ * `String` | `string`
25
+ * `Class` | `object`
26
+ * `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
27
+ * Native Class | `{}`
28
+ * Others | No change
29
+ *
30
+ * @template Instance Target argument type.
31
+ * @author Jenogho Nam - https://github.com/samchon
32
+ * @author Kyungsu Kang - https://github.com/kakasoo
33
+ * @author Michael - https://github.com/8471919
34
+ */
35
+ export type Primitive<T> = Equal<T, PrimitiveMain<T>> extends true
36
+ ? T
37
+ : PrimitiveMain<T>;
38
+
39
+ type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
40
+
41
+ type PrimitiveMain<Instance> = Instance extends [never]
42
+ ? never // (special trick for jsonable | null) type
43
+ : ValueOf<Instance> extends bigint
44
+ ? never
45
+ : ValueOf<Instance> extends boolean | number | string
46
+ ? ValueOf<Instance>
47
+ : Instance extends Function
48
+ ? never
49
+ : ValueOf<Instance> extends object
50
+ ? Instance extends object
51
+ ? Instance extends NativeClass
52
+ ? {}
53
+ : Instance extends IJsonable<infer Raw>
54
+ ? ValueOf<Raw> extends object
55
+ ? Raw extends object
56
+ ? PrimitiveObject<Raw> // object would be primitified
57
+ : never // cannot be
58
+ : ValueOf<Raw> // atomic value
59
+ : PrimitiveObject<Instance> // object would be primitified
60
+ : never // cannot be
61
+ : ValueOf<Instance>;
62
+
63
+ type PrimitiveObject<Instance extends object> = Instance extends Array<infer T>
64
+ ? IsTuple<Instance> extends true
65
+ ? PrimitiveTuple<Instance>
66
+ : PrimitiveMain<T>[]
67
+ : {
68
+ [P in keyof Instance]: PrimitiveMain<Instance[P]>;
69
+ };
70
+
71
+ type PrimitiveTuple<T extends readonly any[]> = T extends []
72
+ ? []
73
+ : T extends [infer F]
74
+ ? [PrimitiveMain<F>]
75
+ : T extends [infer F, ...infer Rest extends readonly any[]]
76
+ ? [PrimitiveMain<F>, ...PrimitiveTuple<Rest>]
77
+ : T extends [(infer F)?]
78
+ ? [PrimitiveMain<F>?]
79
+ : T extends [(infer F)?, ...infer Rest extends readonly any[]]
80
+ ? [PrimitiveMain<F>?, ...PrimitiveTuple<Rest>]
81
+ : [];
82
+
83
+ type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true
84
+ ? boolean
85
+ : IsValueOf<Instance, Number> extends true
86
+ ? number
87
+ : IsValueOf<Instance, String> extends true
88
+ ? string
89
+ : Instance;
90
+
91
+ type NativeClass =
92
+ | Set<any>
93
+ | Map<any, any>
94
+ | WeakSet<any>
95
+ | WeakMap<any, any>
96
+ | Uint8Array
97
+ | Uint8ClampedArray
98
+ | Uint16Array
99
+ | Uint32Array
100
+ | BigUint64Array
101
+ | Int8Array
102
+ | Int16Array
103
+ | Int32Array
104
+ | BigInt64Array
105
+ | Float32Array
106
+ | Float64Array
107
+ | ArrayBuffer
108
+ | SharedArrayBuffer
109
+ | DataView;
110
+
111
+ type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
112
+ never,
113
+ ]
114
+ ? false
115
+ : T extends readonly any[]
116
+ ? number extends T["length"]
117
+ ? false
118
+ : true
119
+ : false;
120
+
121
+ type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
122
+ ? Object extends IValueOf<infer U>
123
+ ? Instance extends U
124
+ ? false
125
+ : true // not Primitive, but Object
126
+ : false // cannot be
127
+ : false;
128
+
129
+ interface IValueOf<T> {
130
+ valueOf(): T;
131
+ }
132
+
133
+ interface IJsonable<T> {
134
+ toJSON(): T;
135
+ }
package/src/Resolved.ts CHANGED
@@ -1,116 +1,116 @@
1
- /**
2
- * Resolved type erased every methods.
3
- *
4
- * `Resolved` is a type of TMP (Type Meta Programming) type which converts
5
- * its argument as a resolved type that erased every method properties.
6
- *
7
- * If the target argument is a built-in class which returns its origin primitive type
8
- * through the `valueOf()` method like the `String` or `Number`, its return type would
9
- * be the `string` or `number`. Otherwise, the built-in class does not have the
10
- * `valueOf()` method, the return type would be same with the target argument.
11
- *
12
- * Otherwise, the target argument is a type of custom class, all of its custom methods
13
- * would be erased and its prototype would be changed to the primitive `object`.
14
- * Therefore, return type of the TMP type finally be the resolved object.
15
- *
16
- * Before | After
17
- * ------------------------|----------------------------------------
18
- * `Boolean` | `boolean`
19
- * `Number` | `number`
20
- * `BigInt` | `bigint`
21
- * `String` | `string`
22
- * `Class` | `interface`
23
- * Native Claas or Others | No change
24
- *
25
- * @template Instance Target argument type.
26
- * @author Jenogho Nam - https://github.com/samchon
27
- * @author Kyungsu Kang - https://github.com/kakasoo
28
- */
29
- export type Resolved<T> = Equal<T, ResolvedMain<T>> extends true
30
- ? T
31
- : ResolvedMain<T>;
32
-
33
- type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
34
-
35
- type ResolvedMain<Instance> = Instance extends [never]
36
- ? never // (special trick for jsonable | null) type
37
- : ValueOf<Instance> extends boolean | number | bigint | string
38
- ? ValueOf<Instance>
39
- : Instance extends Function
40
- ? never
41
- : Instance extends object
42
- ? ResolvedObject<Instance>
43
- : ValueOf<Instance>;
44
-
45
- type ResolvedObject<Instance extends object> = Instance extends Array<infer T>
46
- ? IsTuple<Instance> extends true
47
- ? ResolvedTuple<Instance>
48
- : ResolvedMain<T>[]
49
- : Instance extends Set<infer U>
50
- ? Set<ResolvedMain<U>>
51
- : Instance extends Map<infer K, infer V>
52
- ? Map<ResolvedMain<K>, ResolvedMain<V>>
53
- : Instance extends WeakSet<any> | WeakMap<any, any>
54
- ? never
55
- : Instance extends
56
- | Date
57
- | Uint8Array
58
- | Uint8ClampedArray
59
- | Uint16Array
60
- | Uint32Array
61
- | BigUint64Array
62
- | Int8Array
63
- | Int16Array
64
- | Int32Array
65
- | BigInt64Array
66
- | Float32Array
67
- | Float64Array
68
- | ArrayBuffer
69
- | SharedArrayBuffer
70
- | DataView
71
- ? Instance
72
- : {
73
- [P in keyof Instance]: ResolvedMain<Instance[P]>;
74
- };
75
-
76
- type ResolvedTuple<T extends readonly any[]> = T extends []
77
- ? []
78
- : T extends [infer F]
79
- ? [ResolvedMain<F>]
80
- : T extends [infer F, ...infer Rest extends readonly any[]]
81
- ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]
82
- : T extends [(infer F)?]
83
- ? [ResolvedMain<F>?]
84
- : T extends [(infer F)?, ...infer Rest extends readonly any[]]
85
- ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]
86
- : [];
87
-
88
- type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true
89
- ? boolean
90
- : IsValueOf<Instance, Number> extends true
91
- ? number
92
- : IsValueOf<Instance, String> extends true
93
- ? string
94
- : Instance;
95
-
96
- type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
97
- never,
98
- ]
99
- ? false
100
- : T extends readonly any[]
101
- ? number extends T["length"]
102
- ? false
103
- : true
104
- : false;
105
-
106
- type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
107
- ? Object extends IValueOf<infer Primitive>
108
- ? Instance extends Primitive
109
- ? false
110
- : true // not Primitive, but Object
111
- : false // cannot be
112
- : false;
113
-
114
- interface IValueOf<T> {
115
- valueOf(): T;
116
- }
1
+ /**
2
+ * Resolved type erased every methods.
3
+ *
4
+ * `Resolved` is a type of TMP (Type Meta Programming) type which converts
5
+ * its argument as a resolved type that erased every method properties.
6
+ *
7
+ * If the target argument is a built-in class which returns its origin primitive type
8
+ * through the `valueOf()` method like the `String` or `Number`, its return type would
9
+ * be the `string` or `number`. Otherwise, the built-in class does not have the
10
+ * `valueOf()` method, the return type would be same with the target argument.
11
+ *
12
+ * Otherwise, the target argument is a type of custom class, all of its custom methods
13
+ * would be erased and its prototype would be changed to the primitive `object`.
14
+ * Therefore, return type of the TMP type finally be the resolved object.
15
+ *
16
+ * Before | After
17
+ * ------------------------|----------------------------------------
18
+ * `Boolean` | `boolean`
19
+ * `Number` | `number`
20
+ * `BigInt` | `bigint`
21
+ * `String` | `string`
22
+ * `Class` | `interface`
23
+ * Native Claas or Others | No change
24
+ *
25
+ * @template Instance Target argument type.
26
+ * @author Jenogho Nam - https://github.com/samchon
27
+ * @author Kyungsu Kang - https://github.com/kakasoo
28
+ */
29
+ export type Resolved<T> = Equal<T, ResolvedMain<T>> extends true
30
+ ? T
31
+ : ResolvedMain<T>;
32
+
33
+ type Equal<X, Y> = X extends Y ? (Y extends X ? true : false) : false;
34
+
35
+ type ResolvedMain<Instance> = Instance extends [never]
36
+ ? never // (special trick for jsonable | null) type
37
+ : ValueOf<Instance> extends boolean | number | bigint | string
38
+ ? ValueOf<Instance>
39
+ : Instance extends Function
40
+ ? never
41
+ : Instance extends object
42
+ ? ResolvedObject<Instance>
43
+ : ValueOf<Instance>;
44
+
45
+ type ResolvedObject<Instance extends object> = Instance extends Array<infer T>
46
+ ? IsTuple<Instance> extends true
47
+ ? ResolvedTuple<Instance>
48
+ : ResolvedMain<T>[]
49
+ : Instance extends Set<infer U>
50
+ ? Set<ResolvedMain<U>>
51
+ : Instance extends Map<infer K, infer V>
52
+ ? Map<ResolvedMain<K>, ResolvedMain<V>>
53
+ : Instance extends WeakSet<any> | WeakMap<any, any>
54
+ ? never
55
+ : Instance extends
56
+ | Date
57
+ | Uint8Array
58
+ | Uint8ClampedArray
59
+ | Uint16Array
60
+ | Uint32Array
61
+ | BigUint64Array
62
+ | Int8Array
63
+ | Int16Array
64
+ | Int32Array
65
+ | BigInt64Array
66
+ | Float32Array
67
+ | Float64Array
68
+ | ArrayBuffer
69
+ | SharedArrayBuffer
70
+ | DataView
71
+ ? Instance
72
+ : {
73
+ [P in keyof Instance]: ResolvedMain<Instance[P]>;
74
+ };
75
+
76
+ type ResolvedTuple<T extends readonly any[]> = T extends []
77
+ ? []
78
+ : T extends [infer F]
79
+ ? [ResolvedMain<F>]
80
+ : T extends [infer F, ...infer Rest extends readonly any[]]
81
+ ? [ResolvedMain<F>, ...ResolvedTuple<Rest>]
82
+ : T extends [(infer F)?]
83
+ ? [ResolvedMain<F>?]
84
+ : T extends [(infer F)?, ...infer Rest extends readonly any[]]
85
+ ? [ResolvedMain<F>?, ...ResolvedTuple<Rest>]
86
+ : [];
87
+
88
+ type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true
89
+ ? boolean
90
+ : IsValueOf<Instance, Number> extends true
91
+ ? number
92
+ : IsValueOf<Instance, String> extends true
93
+ ? string
94
+ : Instance;
95
+
96
+ type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
97
+ never,
98
+ ]
99
+ ? false
100
+ : T extends readonly any[]
101
+ ? number extends T["length"]
102
+ ? false
103
+ : true
104
+ : false;
105
+
106
+ type IsValueOf<Instance, Object extends IValueOf<any>> = Instance extends Object
107
+ ? Object extends IValueOf<infer Primitive>
108
+ ? Instance extends Primitive
109
+ ? false
110
+ : true // not Primitive, but Object
111
+ : false // cannot be
112
+ : false;
113
+
114
+ interface IValueOf<T> {
115
+ valueOf(): T;
116
+ }
@@ -1,46 +1,46 @@
1
- import ts from "typescript";
2
-
3
- import { Metadata } from "../schemas/metadata/Metadata";
4
- import { explore_metadata } from "./internal/metadata/explore_metadata";
5
- import { iterate_metadata_collection } from "./internal/metadata/iterate_metadata_collection";
6
- import { iterate_metadata_sort } from "./internal/metadata/iterate_metadata_sort";
7
-
8
- import { MetadataCollection } from "./MetadataCollection";
9
-
10
- export namespace MetadataFactory {
11
- export interface IOptions {
12
- escape: boolean;
13
- constant: boolean;
14
- absorb: boolean;
15
- validate?: (meta: Metadata) => void;
16
- }
17
-
18
- export const analyze =
19
- (checker: ts.TypeChecker) =>
20
- (options: IOptions) =>
21
- (collection: MetadataCollection) =>
22
- (type: ts.Type | null): Metadata => {
23
- const meta: Metadata = explore_metadata(checker)(options)(
24
- collection,
25
- )(type, false);
26
- iterate_metadata_collection(collection);
27
- iterate_metadata_sort(collection)(meta);
28
-
29
- if (options.validate)
30
- for (const elem of collection.entire_) options.validate(elem);
31
- collection.entire_.clear();
32
- return meta;
33
- };
34
-
35
- /**
36
- * @internal
37
- */
38
- export const soleLiteral = (value: string): Metadata => {
39
- const meta: Metadata = Metadata.initialize();
40
- meta.constants.push({
41
- values: [value],
42
- type: "string",
43
- });
44
- return meta;
45
- };
46
- }
1
+ import ts from "typescript";
2
+
3
+ import { Metadata } from "../schemas/metadata/Metadata";
4
+ import { explore_metadata } from "./internal/metadata/explore_metadata";
5
+ import { iterate_metadata_collection } from "./internal/metadata/iterate_metadata_collection";
6
+ import { iterate_metadata_sort } from "./internal/metadata/iterate_metadata_sort";
7
+
8
+ import { MetadataCollection } from "./MetadataCollection";
9
+
10
+ export namespace MetadataFactory {
11
+ export interface IOptions {
12
+ escape: boolean;
13
+ constant: boolean;
14
+ absorb: boolean;
15
+ validate?: (meta: Metadata) => void;
16
+ }
17
+
18
+ export const analyze =
19
+ (checker: ts.TypeChecker) =>
20
+ (options: IOptions) =>
21
+ (collection: MetadataCollection) =>
22
+ (type: ts.Type | null): Metadata => {
23
+ const meta: Metadata = explore_metadata(checker)(options)(
24
+ collection,
25
+ )(type, false);
26
+ iterate_metadata_collection(collection);
27
+ iterate_metadata_sort(collection)(meta);
28
+
29
+ if (options.validate)
30
+ for (const elem of collection.entire_) options.validate(elem);
31
+ collection.entire_.clear();
32
+ return meta;
33
+ };
34
+
35
+ /**
36
+ * @internal
37
+ */
38
+ export const soleLiteral = (value: string): Metadata => {
39
+ const meta: Metadata = Metadata.initialize();
40
+ meta.constants.push({
41
+ values: [value],
42
+ type: "string",
43
+ });
44
+ return meta;
45
+ };
46
+ }