typia 12.1.1 → 12.2.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.
Files changed (136) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/executable/setup/PluginConfigurator.js +3 -3
  4. package/lib/executable/setup/PluginConfigurator.mjs +3 -3
  5. package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
  6. package/lib/executable/typia.js +15 -15
  7. package/lib/executable/typia.mjs +15 -15
  8. package/package.json +5 -5
  9. package/src/TypeGuardError.ts +145 -145
  10. package/src/executable/TypiaGenerateWizard.ts +82 -82
  11. package/src/executable/TypiaPatchWizard.ts +45 -45
  12. package/src/executable/TypiaSetupWizard.ts +171 -171
  13. package/src/executable/setup/ArgumentParser.ts +42 -42
  14. package/src/executable/setup/CommandExecutor.ts +8 -8
  15. package/src/executable/setup/FileRetriever.ts +19 -19
  16. package/src/executable/setup/PackageManager.ts +87 -87
  17. package/src/executable/setup/PluginConfigurator.ts +74 -74
  18. package/src/executable/typia.ts +55 -55
  19. package/src/functional.ts +600 -600
  20. package/src/http.ts +843 -843
  21. package/src/index.ts +4 -4
  22. package/src/internal/_IProtobufWriter.ts +18 -18
  23. package/src/internal/_ProtobufReader.ts +187 -187
  24. package/src/internal/_ProtobufSizer.ts +137 -137
  25. package/src/internal/_ProtobufWriter.ts +135 -135
  26. package/src/internal/_accessExpressionAsString.ts +46 -46
  27. package/src/internal/_assertGuard.ts +13 -13
  28. package/src/internal/_coerceLlmArguments.ts +7 -7
  29. package/src/internal/_createStandardSchema.ts +133 -133
  30. package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
  31. package/src/internal/_httpFormDataReadArray.ts +4 -4
  32. package/src/internal/_httpFormDataReadBigint.ts +18 -18
  33. package/src/internal/_httpFormDataReadBlob.ts +10 -10
  34. package/src/internal/_httpFormDataReadBoolean.ts +16 -16
  35. package/src/internal/_httpFormDataReadFile.ts +10 -10
  36. package/src/internal/_httpFormDataReadNumber.ts +15 -15
  37. package/src/internal/_httpFormDataReadString.ts +10 -10
  38. package/src/internal/_httpHeaderReadBigint.ts +10 -10
  39. package/src/internal/_httpHeaderReadBoolean.ts +8 -8
  40. package/src/internal/_httpHeaderReadNumber.ts +7 -7
  41. package/src/internal/_httpParameterReadBigint.ts +10 -10
  42. package/src/internal/_httpParameterReadBoolean.ts +8 -8
  43. package/src/internal/_httpParameterReadNumber.ts +7 -7
  44. package/src/internal/_httpParameterReadString.ts +2 -2
  45. package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
  46. package/src/internal/_httpQueryReadArray.ts +4 -4
  47. package/src/internal/_httpQueryReadBigint.ts +12 -12
  48. package/src/internal/_httpQueryReadBoolean.ts +14 -14
  49. package/src/internal/_httpQueryReadNumber.ts +9 -9
  50. package/src/internal/_httpQueryReadString.ts +4 -4
  51. package/src/internal/_isBetween.ts +2 -2
  52. package/src/internal/_isBigintString.ts +8 -8
  53. package/src/internal/_isFormatByte.ts +7 -7
  54. package/src/internal/_isFormatDate.ts +3 -3
  55. package/src/internal/_isFormatDateTime.ts +4 -4
  56. package/src/internal/_isFormatDuration.ts +4 -4
  57. package/src/internal/_isFormatEmail.ts +4 -4
  58. package/src/internal/_isFormatHostname.ts +4 -4
  59. package/src/internal/_isFormatIdnEmail.ts +4 -4
  60. package/src/internal/_isFormatIdnHostname.ts +4 -4
  61. package/src/internal/_isFormatIpv4.ts +4 -4
  62. package/src/internal/_isFormatIpv6.ts +4 -4
  63. package/src/internal/_isFormatIri.ts +3 -3
  64. package/src/internal/_isFormatIriReference.ts +4 -4
  65. package/src/internal/_isFormatJsonPointer.ts +3 -3
  66. package/src/internal/_isFormatPassword.ts +1 -1
  67. package/src/internal/_isFormatRegex.ts +8 -8
  68. package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
  69. package/src/internal/_isFormatTime.ts +4 -4
  70. package/src/internal/_isFormatUri.ts +6 -6
  71. package/src/internal/_isFormatUriReference.ts +5 -5
  72. package/src/internal/_isFormatUriTemplate.ts +4 -4
  73. package/src/internal/_isFormatUrl.ts +4 -4
  74. package/src/internal/_isFormatUuid.ts +3 -3
  75. package/src/internal/_isTypeFloat.ts +5 -5
  76. package/src/internal/_isTypeInt32.ts +5 -5
  77. package/src/internal/_isTypeInt64.ts +5 -5
  78. package/src/internal/_isTypeUint32.ts +5 -5
  79. package/src/internal/_isTypeUint64.ts +5 -5
  80. package/src/internal/_isUniqueItems.ts +159 -159
  81. package/src/internal/_jsonStringifyNumber.ts +2 -2
  82. package/src/internal/_jsonStringifyRest.ts +3 -3
  83. package/src/internal/_jsonStringifyString.ts +42 -42
  84. package/src/internal/_jsonStringifyTail.ts +2 -2
  85. package/src/internal/_llmApplicationFinalize.ts +20 -20
  86. package/src/internal/_miscCloneAny.ts +46 -46
  87. package/src/internal/_notationAny.ts +37 -37
  88. package/src/internal/_notationCamel.ts +13 -13
  89. package/src/internal/_notationPascal.ts +8 -8
  90. package/src/internal/_notationSnake.ts +43 -43
  91. package/src/internal/_parseLlmArguments.ts +7 -7
  92. package/src/internal/_randomArray.ts +21 -21
  93. package/src/internal/_randomBigint.ts +6 -6
  94. package/src/internal/_randomBoolean.ts +1 -1
  95. package/src/internal/_randomFormatByte.ts +3 -3
  96. package/src/internal/_randomFormatDate.ts +18 -18
  97. package/src/internal/_randomFormatDatetime.ts +16 -16
  98. package/src/internal/_randomFormatDuration.ts +27 -27
  99. package/src/internal/_randomFormatEmail.ts +11 -11
  100. package/src/internal/_randomFormatHostname.ts +6 -6
  101. package/src/internal/_randomFormatIdnEmail.ts +3 -3
  102. package/src/internal/_randomFormatIdnHostname.ts +3 -3
  103. package/src/internal/_randomFormatIpv4.ts +11 -11
  104. package/src/internal/_randomFormatIpv6.ts +11 -11
  105. package/src/internal/_randomFormatIri.ts +3 -3
  106. package/src/internal/_randomFormatIriReference.ts +3 -3
  107. package/src/internal/_randomFormatJsonPointer.ts +7 -7
  108. package/src/internal/_randomFormatPassword.ts +8 -8
  109. package/src/internal/_randomFormatRegex.ts +4 -4
  110. package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
  111. package/src/internal/_randomFormatTime.ts +14 -14
  112. package/src/internal/_randomFormatUri.ts +3 -3
  113. package/src/internal/_randomFormatUriReference.ts +3 -3
  114. package/src/internal/_randomFormatUriTemplate.ts +3 -3
  115. package/src/internal/_randomFormatUrl.ts +11 -11
  116. package/src/internal/_randomFormatUuid.ts +6 -6
  117. package/src/internal/_randomInteger.ts +53 -53
  118. package/src/internal/_randomNumber.ts +80 -80
  119. package/src/internal/_randomPattern.ts +10 -10
  120. package/src/internal/_randomPick.ts +9 -9
  121. package/src/internal/_randomString.ts +24 -24
  122. package/src/internal/_throwTypeGuardError.ts +5 -5
  123. package/src/internal/_validateReport.ts +21 -21
  124. package/src/internal/private/__notationCapitalize.ts +2 -2
  125. package/src/internal/private/__notationUnsnake.ts +24 -24
  126. package/src/json.ts +553 -553
  127. package/src/llm.ts +480 -480
  128. package/src/misc.ts +448 -448
  129. package/src/module.ts +811 -811
  130. package/src/notations.ts +624 -624
  131. package/src/programmers/TypiaProgrammer.ts +8 -8
  132. package/src/protobuf.ts +499 -499
  133. package/src/re-exports.ts +34 -34
  134. package/src/reflect.ts +75 -75
  135. package/src/transform.ts +6 -6
  136. package/src/transformers/NoTransformConfigurationError.ts +16 -16
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as typia from "./module";
2
-
3
- export default typia;
4
- export * from "./module";
1
+ import * as typia from "./module";
2
+
3
+ export default typia;
4
+ export * from "./module";
@@ -1,18 +1,18 @@
1
- export interface _IProtobufWriter {
2
- bool(value: boolean): void;
3
- int32(value: number): void;
4
- sint32(value: number): void;
5
- uint32(value: number): void;
6
-
7
- int64(value: bigint | number): void;
8
- sint64(value: bigint | number): void;
9
- uint64(value: bigint | number): void;
10
-
11
- float(value: number): void;
12
- double(value: number): void;
13
- bytes(value: Uint8Array): void;
14
- string(value: string): void;
15
-
16
- fork(): void;
17
- ldelim(): void;
18
- }
1
+ export interface _IProtobufWriter {
2
+ bool(value: boolean): void;
3
+ int32(value: number): void;
4
+ sint32(value: number): void;
5
+ uint32(value: number): void;
6
+
7
+ int64(value: bigint | number): void;
8
+ sint64(value: bigint | number): void;
9
+ uint64(value: bigint | number): void;
10
+
11
+ float(value: number): void;
12
+ double(value: number): void;
13
+ bytes(value: Uint8Array): void;
14
+ string(value: string): void;
15
+
16
+ fork(): void;
17
+ ldelim(): void;
18
+ }
@@ -1,187 +1,187 @@
1
- import { ProtobufWire } from "@typia/interface";
2
- import { Singleton } from "@typia/utils";
3
-
4
- /// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedReader.ts
5
- export class _ProtobufReader {
6
- /** Read buffer */
7
- private buf: Uint8Array;
8
-
9
- /** Read buffer pointer. */
10
- private ptr: number;
11
-
12
- /** DataView for buffer. */
13
- private view: DataView;
14
-
15
- public constructor(buf: Uint8Array) {
16
- this.buf = buf;
17
- this.ptr = 0;
18
- this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
19
- }
20
-
21
- public index(): number {
22
- return this.ptr;
23
- }
24
-
25
- public size(): number {
26
- return this.buf.length;
27
- }
28
-
29
- public uint32(): number {
30
- return this.varint32();
31
- }
32
-
33
- public int32(): number {
34
- return this.varint32();
35
- }
36
-
37
- public sint32(): number {
38
- const value: number = this.varint32();
39
- return (value >>> 1) ^ -(value & 1);
40
- }
41
-
42
- public uint64(): bigint {
43
- return this.varint64();
44
- }
45
-
46
- public int64(): bigint {
47
- return this.varint64();
48
- }
49
-
50
- public sint64(): bigint {
51
- const value = this.varint64();
52
- return (value >> BigInt(0x01)) ^ -(value & BigInt(0x01));
53
- }
54
-
55
- public bool(): boolean {
56
- return this.varint32() !== 0;
57
- }
58
-
59
- public float(): number {
60
- const value: number = this.view.getFloat32(this.ptr, true);
61
- this.ptr += 4;
62
- return value;
63
- }
64
-
65
- public double(): number {
66
- const value: number = this.view.getFloat64(this.ptr, true);
67
- this.ptr += 8;
68
- return value;
69
- }
70
-
71
- public bytes(): Uint8Array {
72
- const length: number = this.uint32();
73
- const from: number = this.ptr;
74
- this.ptr += length;
75
- return this.buf.subarray(from, from + length);
76
- }
77
-
78
- public string(): string {
79
- return utf8.get().decode(this.bytes());
80
- }
81
-
82
- public skip(length: number): void {
83
- if (length === 0) while (this.u8() & 0x80);
84
- else {
85
- if (this.index() + length > this.size())
86
- throw new Error("Error on typia.protobuf.decode(): buffer overflow.");
87
- this.ptr += length;
88
- }
89
- }
90
-
91
- public skipType(wireType: ProtobufWire): void {
92
- switch (wireType) {
93
- case ProtobufWire.VARIANT:
94
- this.skip(0);
95
- break;
96
- case ProtobufWire.I64:
97
- this.skip(8);
98
- break;
99
- case ProtobufWire.LEN:
100
- this.skip(this.uint32());
101
- break;
102
- case ProtobufWire.START_GROUP:
103
- while ((wireType = this.uint32() & 0x07) !== ProtobufWire.END_GROUP)
104
- this.skipType(wireType);
105
- break;
106
- case ProtobufWire.I32:
107
- this.skip(4);
108
- break;
109
- default:
110
- throw new Error(`Invalid wire type ${wireType} at offset ${this.ptr}.`);
111
- }
112
- }
113
-
114
- private varint32(): number {
115
- let loaded: number;
116
- let value: number;
117
-
118
- value = (loaded = this.u8()) & 0x7f;
119
- if (loaded < 0x80) return value;
120
-
121
- value |= ((loaded = this.u8()) & 0x7f) << 7;
122
- if (loaded < 0x80) return value;
123
-
124
- value |= ((loaded = this.u8()) & 0x7f) << 14;
125
- if (loaded < 0x80) return value;
126
-
127
- value |= ((loaded = this.u8()) & 0x7f) << 21;
128
- if (loaded < 0x80) return value;
129
-
130
- value |= ((loaded = this.u8()) & 0xf) << 28;
131
- if (loaded < 0x80) return value;
132
-
133
- // increment position until there is no continuation bit or until we read 10 bytes
134
- if (this.u8() < 0x80) return value;
135
- if (this.u8() < 0x80) return value;
136
- if (this.u8() < 0x80) return value;
137
- if (this.u8() < 0x80) return value;
138
- if (this.u8() < 0x80) return value;
139
-
140
- return value;
141
- }
142
-
143
- private varint64(): bigint {
144
- let loaded: bigint;
145
- let value: bigint;
146
-
147
- value = (loaded = this.u8n()) & BigInt(0x7f);
148
- if (loaded < BigInt(0x80)) return value;
149
-
150
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(7);
151
- if (loaded < BigInt(0x80)) return value;
152
-
153
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(14);
154
- if (loaded < BigInt(0x80)) return value;
155
-
156
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(21);
157
- if (loaded < BigInt(0x80)) return value;
158
-
159
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(28);
160
- if (loaded < BigInt(0x80)) return value;
161
-
162
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(35);
163
- if (loaded < BigInt(0x80)) return value;
164
-
165
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(42);
166
- if (loaded < BigInt(0x80)) return value;
167
-
168
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(49);
169
- if (loaded < BigInt(0x80)) return value;
170
-
171
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(56);
172
- if (loaded < BigInt(0x80)) return value;
173
-
174
- value |= (this.u8n() & BigInt(0x01)) << BigInt(63);
175
- return BigInt.asIntN(64, value);
176
- }
177
-
178
- private u8(): number {
179
- return this.view.getUint8(this.ptr++);
180
- }
181
-
182
- private u8n(): bigint {
183
- return BigInt(this.u8());
184
- }
185
- }
186
-
187
- const utf8 = new Singleton(() => new TextDecoder("utf-8"));
1
+ import { ProtobufWire } from "@typia/interface";
2
+ import { Singleton } from "@typia/utils";
3
+
4
+ /// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedReader.ts
5
+ export class _ProtobufReader {
6
+ /** Read buffer */
7
+ private buf: Uint8Array;
8
+
9
+ /** Read buffer pointer. */
10
+ private ptr: number;
11
+
12
+ /** DataView for buffer. */
13
+ private view: DataView;
14
+
15
+ public constructor(buf: Uint8Array) {
16
+ this.buf = buf;
17
+ this.ptr = 0;
18
+ this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
19
+ }
20
+
21
+ public index(): number {
22
+ return this.ptr;
23
+ }
24
+
25
+ public size(): number {
26
+ return this.buf.length;
27
+ }
28
+
29
+ public uint32(): number {
30
+ return this.varint32();
31
+ }
32
+
33
+ public int32(): number {
34
+ return this.varint32();
35
+ }
36
+
37
+ public sint32(): number {
38
+ const value: number = this.varint32();
39
+ return (value >>> 1) ^ -(value & 1);
40
+ }
41
+
42
+ public uint64(): bigint {
43
+ return this.varint64();
44
+ }
45
+
46
+ public int64(): bigint {
47
+ return this.varint64();
48
+ }
49
+
50
+ public sint64(): bigint {
51
+ const value = this.varint64();
52
+ return (value >> BigInt(0x01)) ^ -(value & BigInt(0x01));
53
+ }
54
+
55
+ public bool(): boolean {
56
+ return this.varint32() !== 0;
57
+ }
58
+
59
+ public float(): number {
60
+ const value: number = this.view.getFloat32(this.ptr, true);
61
+ this.ptr += 4;
62
+ return value;
63
+ }
64
+
65
+ public double(): number {
66
+ const value: number = this.view.getFloat64(this.ptr, true);
67
+ this.ptr += 8;
68
+ return value;
69
+ }
70
+
71
+ public bytes(): Uint8Array {
72
+ const length: number = this.uint32();
73
+ const from: number = this.ptr;
74
+ this.ptr += length;
75
+ return this.buf.subarray(from, from + length);
76
+ }
77
+
78
+ public string(): string {
79
+ return utf8.get().decode(this.bytes());
80
+ }
81
+
82
+ public skip(length: number): void {
83
+ if (length === 0) while (this.u8() & 0x80);
84
+ else {
85
+ if (this.index() + length > this.size())
86
+ throw new Error("Error on typia.protobuf.decode(): buffer overflow.");
87
+ this.ptr += length;
88
+ }
89
+ }
90
+
91
+ public skipType(wireType: ProtobufWire): void {
92
+ switch (wireType) {
93
+ case ProtobufWire.VARIANT:
94
+ this.skip(0);
95
+ break;
96
+ case ProtobufWire.I64:
97
+ this.skip(8);
98
+ break;
99
+ case ProtobufWire.LEN:
100
+ this.skip(this.uint32());
101
+ break;
102
+ case ProtobufWire.START_GROUP:
103
+ while ((wireType = this.uint32() & 0x07) !== ProtobufWire.END_GROUP)
104
+ this.skipType(wireType);
105
+ break;
106
+ case ProtobufWire.I32:
107
+ this.skip(4);
108
+ break;
109
+ default:
110
+ throw new Error(`Invalid wire type ${wireType} at offset ${this.ptr}.`);
111
+ }
112
+ }
113
+
114
+ private varint32(): number {
115
+ let loaded: number;
116
+ let value: number;
117
+
118
+ value = (loaded = this.u8()) & 0x7f;
119
+ if (loaded < 0x80) return value;
120
+
121
+ value |= ((loaded = this.u8()) & 0x7f) << 7;
122
+ if (loaded < 0x80) return value;
123
+
124
+ value |= ((loaded = this.u8()) & 0x7f) << 14;
125
+ if (loaded < 0x80) return value;
126
+
127
+ value |= ((loaded = this.u8()) & 0x7f) << 21;
128
+ if (loaded < 0x80) return value;
129
+
130
+ value |= ((loaded = this.u8()) & 0xf) << 28;
131
+ if (loaded < 0x80) return value;
132
+
133
+ // increment position until there is no continuation bit or until we read 10 bytes
134
+ if (this.u8() < 0x80) return value;
135
+ if (this.u8() < 0x80) return value;
136
+ if (this.u8() < 0x80) return value;
137
+ if (this.u8() < 0x80) return value;
138
+ if (this.u8() < 0x80) return value;
139
+
140
+ return value;
141
+ }
142
+
143
+ private varint64(): bigint {
144
+ let loaded: bigint;
145
+ let value: bigint;
146
+
147
+ value = (loaded = this.u8n()) & BigInt(0x7f);
148
+ if (loaded < BigInt(0x80)) return value;
149
+
150
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(7);
151
+ if (loaded < BigInt(0x80)) return value;
152
+
153
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(14);
154
+ if (loaded < BigInt(0x80)) return value;
155
+
156
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(21);
157
+ if (loaded < BigInt(0x80)) return value;
158
+
159
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(28);
160
+ if (loaded < BigInt(0x80)) return value;
161
+
162
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(35);
163
+ if (loaded < BigInt(0x80)) return value;
164
+
165
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(42);
166
+ if (loaded < BigInt(0x80)) return value;
167
+
168
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(49);
169
+ if (loaded < BigInt(0x80)) return value;
170
+
171
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(56);
172
+ if (loaded < BigInt(0x80)) return value;
173
+
174
+ value |= (this.u8n() & BigInt(0x01)) << BigInt(63);
175
+ return BigInt.asIntN(64, value);
176
+ }
177
+
178
+ private u8(): number {
179
+ return this.view.getUint8(this.ptr++);
180
+ }
181
+
182
+ private u8n(): bigint {
183
+ return BigInt(this.u8());
184
+ }
185
+ }
186
+
187
+ const utf8 = new Singleton(() => new TextDecoder("utf-8"));