typia 7.0.0-dev.20241009-3 → 7.0.0-dev.20241010

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 (140) hide show
  1. package/lib/factories/JsonMetadataFactory.d.ts +5 -1
  2. package/lib/factories/JsonMetadataFactory.js +4 -1
  3. package/lib/factories/JsonMetadataFactory.js.map +1 -1
  4. package/lib/internal/{$httpFormDataReadArray.js → $httpFormdataReadArray.js} +1 -1
  5. package/lib/internal/$httpFormdataReadArray.js.map +1 -0
  6. package/lib/programmers/CheckerProgrammer.js +4 -1
  7. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  8. package/lib/programmers/FeatureProgrammer.d.ts +4 -1
  9. package/lib/programmers/FeatureProgrammer.js +2 -2
  10. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  11. package/lib/programmers/TypiaProgrammer.js +4 -1
  12. package/lib/programmers/TypiaProgrammer.js.map +1 -1
  13. package/lib/programmers/misc/MiscCloneProgrammer.js +4 -1
  14. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  15. package/lib/programmers/misc/MiscPruneProgrammer.js +4 -1
  16. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  17. package/lib/programmers/notations/NotationGeneralProgrammer.js +4 -1
  18. package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
  19. package/lib/transformers/FileTransformer.js +0 -6
  20. package/lib/transformers/FileTransformer.js.map +1 -1
  21. package/lib/transformers/ImportTransformer.d.ts +4 -1
  22. package/lib/transformers/ImportTransformer.js +34 -30
  23. package/lib/transformers/ImportTransformer.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/IRandomGenerator.ts +49 -49
  26. package/src/factories/ExpressionFactory.ts +164 -164
  27. package/src/factories/JsonMetadataFactory.ts +25 -15
  28. package/src/factories/LiteralFactory.ts +50 -50
  29. package/src/factories/MetadataCommentTagFactory.ts +650 -650
  30. package/src/functional.ts +750 -750
  31. package/src/http.ts +1042 -1042
  32. package/src/internal/$IProtobufWriter.ts +18 -18
  33. package/src/internal/$ProtobufReader.ts +194 -194
  34. package/src/internal/$ProtobufSizer.ts +151 -151
  35. package/src/internal/$ProtobufWriter.ts +145 -145
  36. package/src/internal/$accessExpressionAsString.ts +46 -46
  37. package/src/internal/$assertGuard.ts +13 -13
  38. package/src/internal/$functionalTypeGuardErrorFactory.ts +4 -4
  39. package/src/internal/$httpFormDataReadBigint.ts +18 -18
  40. package/src/internal/$httpFormDataReadBlob.ts +10 -10
  41. package/src/internal/$httpFormDataReadBoolean.ts +16 -16
  42. package/src/internal/$httpFormDataReadFile.ts +10 -10
  43. package/src/internal/$httpFormDataReadNumber.ts +15 -15
  44. package/src/internal/$httpFormDataReadString.ts +10 -10
  45. package/src/internal/{$httpFormDataReadArray.ts → $httpFormdataReadArray.ts} +4 -4
  46. package/src/internal/$httpHeaderReadBigint.ts +10 -10
  47. package/src/internal/$httpHeaderReadBoolean.ts +8 -8
  48. package/src/internal/$httpHeaderReadNumber.ts +7 -7
  49. package/src/internal/$httpParameterBigint.ts +10 -10
  50. package/src/internal/$httpParameterBoolean.ts +8 -8
  51. package/src/internal/$httpParameterNumber.ts +7 -7
  52. package/src/internal/$httpParameterString.ts +2 -2
  53. package/src/internal/$httpQueryParseURLSearchParams.ts +10 -10
  54. package/src/internal/$httpQueryReadArray.ts +4 -4
  55. package/src/internal/$httpQueryReadBigint.ts +12 -12
  56. package/src/internal/$httpQueryReadBoolean.ts +14 -14
  57. package/src/internal/$httpQueryReadNumber.ts +9 -9
  58. package/src/internal/$httpQueryReadString.ts +4 -4
  59. package/src/internal/$isBetween.ts +2 -2
  60. package/src/internal/$isBigintString.ts +8 -8
  61. package/src/internal/$jsonStringifyNumber.ts +12 -12
  62. package/src/internal/$jsonStringifyRest.ts +3 -3
  63. package/src/internal/$jsonStringifyString.ts +42 -42
  64. package/src/internal/$jsonStringifyTail.ts +2 -2
  65. package/src/internal/$llmApplicationFinalize.ts +18 -18
  66. package/src/internal/$miscCloneAny.ts +48 -48
  67. package/src/internal/$notationAny.ts +37 -37
  68. package/src/internal/$notationCamel.ts +13 -13
  69. package/src/internal/$notationPascal.ts +8 -8
  70. package/src/internal/$notationSnake.ts +43 -43
  71. package/src/internal/$randomArray.ts +21 -21
  72. package/src/internal/$randomBigint.ts +6 -6
  73. package/src/internal/$randomBoolean.ts +1 -1
  74. package/src/internal/$randomFormatByte.ts +3 -3
  75. package/src/internal/$randomFormatDate.ts +18 -18
  76. package/src/internal/$randomFormatDatetime.ts +16 -16
  77. package/src/internal/$randomFormatDuration.ts +27 -27
  78. package/src/internal/$randomFormatEmail.ts +11 -11
  79. package/src/internal/$randomFormatHostname.ts +6 -6
  80. package/src/internal/$randomFormatIdnEmail.ts +3 -3
  81. package/src/internal/$randomFormatIdnHostname.ts +3 -3
  82. package/src/internal/$randomFormatIpv4.ts +11 -11
  83. package/src/internal/$randomFormatIpv6.ts +11 -11
  84. package/src/internal/$randomFormatIri.ts +3 -3
  85. package/src/internal/$randomFormatIriReference.ts +3 -3
  86. package/src/internal/$randomFormatJsonPointer.ts +7 -7
  87. package/src/internal/$randomFormatPassword.ts +8 -8
  88. package/src/internal/$randomFormatRegex.ts +4 -4
  89. package/src/internal/$randomFormatRelativeJsonPointer.ts +8 -8
  90. package/src/internal/$randomFormatTime.ts +14 -14
  91. package/src/internal/$randomFormatUri.ts +3 -3
  92. package/src/internal/$randomFormatUriReference.ts +3 -3
  93. package/src/internal/$randomFormatUriTemplate.ts +3 -3
  94. package/src/internal/$randomFormatUrl.ts +11 -11
  95. package/src/internal/$randomFormatUuid.ts +6 -6
  96. package/src/internal/$randomInteger.ts +47 -47
  97. package/src/internal/$randomNumber.ts +74 -74
  98. package/src/internal/$randomPattern.ts +10 -10
  99. package/src/internal/$randomPick.ts +9 -9
  100. package/src/internal/$randomString.ts +24 -24
  101. package/src/internal/$throwTypeGuardError.ts +5 -5
  102. package/src/internal/$validateReport.ts +13 -13
  103. package/src/internal/private/$__notationCapitalize.ts +2 -2
  104. package/src/internal/private/$__notationUnsnake.ts +24 -24
  105. package/src/json.ts +651 -651
  106. package/src/llm.ts +178 -178
  107. package/src/misc.ts +658 -658
  108. package/src/module.ts +933 -933
  109. package/src/notations.ts +827 -827
  110. package/src/programmers/CheckerProgrammer.ts +4 -1
  111. package/src/programmers/FeatureProgrammer.ts +619 -616
  112. package/src/programmers/TypiaProgrammer.ts +4 -1
  113. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +153 -153
  114. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +125 -125
  115. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +115 -115
  116. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +119 -119
  117. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +274 -274
  118. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +135 -135
  119. package/src/programmers/helpers/FunctionProgrammer.ts +67 -67
  120. package/src/programmers/helpers/RandomJoiner.ts +168 -168
  121. package/src/programmers/helpers/StringifyJoinder.ts +115 -115
  122. package/src/programmers/helpers/disable_function_programmer_declare.ts +32 -32
  123. package/src/programmers/internal/check_dynamic_key.ts +201 -201
  124. package/src/programmers/internal/check_dynamic_properties.ts +208 -208
  125. package/src/programmers/internal/check_object.ts +75 -75
  126. package/src/programmers/internal/feature_object_entries.ts +61 -61
  127. package/src/programmers/internal/prune_object_properties.ts +71 -71
  128. package/src/programmers/llm/LlmApplicationProgrammer.ts +235 -235
  129. package/src/programmers/llm/LlmSchemaProgrammer.ts +51 -51
  130. package/src/programmers/misc/MiscCloneProgrammer.ts +4 -1
  131. package/src/programmers/misc/MiscPruneProgrammer.ts +4 -1
  132. package/src/programmers/notations/NotationGeneralProgrammer.ts +4 -1
  133. package/src/protobuf.ts +868 -868
  134. package/src/reflect.ts +57 -57
  135. package/src/transformers/FileTransformer.ts +0 -6
  136. package/src/transformers/ImportTransformer.ts +59 -44
  137. package/src/utils/NamingConvention.ts +94 -94
  138. package/src/utils/StringUtil.ts +16 -16
  139. package/lib/internal/$httpFormDataReadArray.js.map +0 -1
  140. /package/lib/internal/{$httpFormDataReadArray.d.ts → $httpFormdataReadArray.d.ts} +0 -0
@@ -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,194 +1,194 @@
1
- import { ProtobufWire } from "../programmers/helpers/ProtobufWire";
2
-
3
- import { Singleton } from "../utils/Singleton";
4
-
5
- /// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedReader.ts
6
- export class $ProtobufReader {
7
- /**
8
- * Read buffer
9
- */
10
- private buf: Uint8Array;
11
-
12
- /**
13
- * Read buffer pointer.
14
- */
15
- private ptr: number;
16
-
17
- /**
18
- * DataView for buffer.
19
- */
20
- private view: DataView;
21
-
22
- public constructor(buf: Uint8Array) {
23
- this.buf = buf;
24
- this.ptr = 0;
25
- this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
26
- }
27
-
28
- public index(): number {
29
- return this.ptr;
30
- }
31
-
32
- public size(): number {
33
- return this.buf.length;
34
- }
35
-
36
- public uint32(): number {
37
- return this.varint32();
38
- }
39
-
40
- public int32(): number {
41
- return this.varint32();
42
- }
43
-
44
- public sint32(): number {
45
- const value: number = this.varint32();
46
- return (value >>> 1) ^ -(value & 1);
47
- }
48
-
49
- public uint64(): bigint {
50
- return this.varint64();
51
- }
52
-
53
- public int64(): bigint {
54
- return this.varint64();
55
- }
56
-
57
- public sint64(): bigint {
58
- const value = this.varint64();
59
- return (value >> BigInt(0x01)) ^ -(value & BigInt(0x01));
60
- }
61
-
62
- public bool(): boolean {
63
- return this.varint32() !== 0;
64
- }
65
-
66
- public float(): number {
67
- const value: number = this.view.getFloat32(this.ptr, true);
68
- this.ptr += 4;
69
- return value;
70
- }
71
-
72
- public double(): number {
73
- const value: number = this.view.getFloat64(this.ptr, true);
74
- this.ptr += 8;
75
- return value;
76
- }
77
-
78
- public bytes(): Uint8Array {
79
- const length: number = this.uint32();
80
- const from: number = this.ptr;
81
- this.ptr += length;
82
- return this.buf.subarray(from, from + length);
83
- }
84
-
85
- public string(): string {
86
- return utf8.get().decode(this.bytes());
87
- }
88
-
89
- public skip(length: number): void {
90
- if (length === 0) while (this.u8() & 0x80);
91
- else {
92
- if (this.index() + length > this.size())
93
- throw new Error("Error on typia.protobuf.decode(): buffer overflow.");
94
- this.ptr += length;
95
- }
96
- }
97
-
98
- public skipType(wireType: ProtobufWire): void {
99
- switch (wireType) {
100
- case ProtobufWire.VARIANT:
101
- this.skip(0);
102
- break;
103
- case ProtobufWire.I64:
104
- this.skip(8);
105
- break;
106
- case ProtobufWire.LEN:
107
- this.skip(this.uint32());
108
- break;
109
- case ProtobufWire.START_GROUP:
110
- while ((wireType = this.uint32() & 0x07) !== ProtobufWire.END_GROUP)
111
- this.skipType(wireType);
112
- break;
113
- case ProtobufWire.I32:
114
- this.skip(4);
115
- break;
116
- default:
117
- throw new Error(`Invalid wire type ${wireType} at offset ${this.ptr}.`);
118
- }
119
- }
120
-
121
- private varint32(): number {
122
- let loaded: number;
123
- let value: number;
124
-
125
- value = (loaded = this.u8()) & 0x7f;
126
- if (loaded < 0x80) return value;
127
-
128
- value |= ((loaded = this.u8()) & 0x7f) << 7;
129
- if (loaded < 0x80) return value;
130
-
131
- value |= ((loaded = this.u8()) & 0x7f) << 14;
132
- if (loaded < 0x80) return value;
133
-
134
- value |= ((loaded = this.u8()) & 0x7f) << 21;
135
- if (loaded < 0x80) return value;
136
-
137
- value |= ((loaded = this.u8()) & 0xf) << 28;
138
- if (loaded < 0x80) return value;
139
-
140
- // increment position until there is no continuation bit or until we read 10 bytes
141
- if (this.u8() < 0x80) return value;
142
- if (this.u8() < 0x80) return value;
143
- if (this.u8() < 0x80) return value;
144
- if (this.u8() < 0x80) return value;
145
- if (this.u8() < 0x80) return value;
146
-
147
- return value;
148
- }
149
-
150
- private varint64(): bigint {
151
- let loaded: bigint;
152
- let value: bigint;
153
-
154
- value = (loaded = this.u8n()) & BigInt(0x7f);
155
- if (loaded < BigInt(0x80)) return value;
156
-
157
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(7);
158
- if (loaded < BigInt(0x80)) return value;
159
-
160
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(14);
161
- if (loaded < BigInt(0x80)) return value;
162
-
163
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(21);
164
- if (loaded < BigInt(0x80)) return value;
165
-
166
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(28);
167
- if (loaded < BigInt(0x80)) return value;
168
-
169
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(35);
170
- if (loaded < BigInt(0x80)) return value;
171
-
172
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(42);
173
- if (loaded < BigInt(0x80)) return value;
174
-
175
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(49);
176
- if (loaded < BigInt(0x80)) return value;
177
-
178
- value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(56);
179
- if (loaded < BigInt(0x80)) return value;
180
-
181
- value |= (this.u8n() & BigInt(0x01)) << BigInt(63);
182
- return BigInt.asIntN(64, value);
183
- }
184
-
185
- private u8(): number {
186
- return this.view.getUint8(this.ptr++);
187
- }
188
-
189
- private u8n(): bigint {
190
- return BigInt(this.u8());
191
- }
192
- }
193
-
194
- const utf8 = /** @__PURE__ */ new Singleton(() => new TextDecoder("utf-8"));
1
+ import { ProtobufWire } from "../programmers/helpers/ProtobufWire";
2
+
3
+ import { Singleton } from "../utils/Singleton";
4
+
5
+ /// @reference https://github.com/piotr-oles/as-proto/blob/main/packages/as-proto/assembly/internal/FixedReader.ts
6
+ export class $ProtobufReader {
7
+ /**
8
+ * Read buffer
9
+ */
10
+ private buf: Uint8Array;
11
+
12
+ /**
13
+ * Read buffer pointer.
14
+ */
15
+ private ptr: number;
16
+
17
+ /**
18
+ * DataView for buffer.
19
+ */
20
+ private view: DataView;
21
+
22
+ public constructor(buf: Uint8Array) {
23
+ this.buf = buf;
24
+ this.ptr = 0;
25
+ this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
26
+ }
27
+
28
+ public index(): number {
29
+ return this.ptr;
30
+ }
31
+
32
+ public size(): number {
33
+ return this.buf.length;
34
+ }
35
+
36
+ public uint32(): number {
37
+ return this.varint32();
38
+ }
39
+
40
+ public int32(): number {
41
+ return this.varint32();
42
+ }
43
+
44
+ public sint32(): number {
45
+ const value: number = this.varint32();
46
+ return (value >>> 1) ^ -(value & 1);
47
+ }
48
+
49
+ public uint64(): bigint {
50
+ return this.varint64();
51
+ }
52
+
53
+ public int64(): bigint {
54
+ return this.varint64();
55
+ }
56
+
57
+ public sint64(): bigint {
58
+ const value = this.varint64();
59
+ return (value >> BigInt(0x01)) ^ -(value & BigInt(0x01));
60
+ }
61
+
62
+ public bool(): boolean {
63
+ return this.varint32() !== 0;
64
+ }
65
+
66
+ public float(): number {
67
+ const value: number = this.view.getFloat32(this.ptr, true);
68
+ this.ptr += 4;
69
+ return value;
70
+ }
71
+
72
+ public double(): number {
73
+ const value: number = this.view.getFloat64(this.ptr, true);
74
+ this.ptr += 8;
75
+ return value;
76
+ }
77
+
78
+ public bytes(): Uint8Array {
79
+ const length: number = this.uint32();
80
+ const from: number = this.ptr;
81
+ this.ptr += length;
82
+ return this.buf.subarray(from, from + length);
83
+ }
84
+
85
+ public string(): string {
86
+ return utf8.get().decode(this.bytes());
87
+ }
88
+
89
+ public skip(length: number): void {
90
+ if (length === 0) while (this.u8() & 0x80);
91
+ else {
92
+ if (this.index() + length > this.size())
93
+ throw new Error("Error on typia.protobuf.decode(): buffer overflow.");
94
+ this.ptr += length;
95
+ }
96
+ }
97
+
98
+ public skipType(wireType: ProtobufWire): void {
99
+ switch (wireType) {
100
+ case ProtobufWire.VARIANT:
101
+ this.skip(0);
102
+ break;
103
+ case ProtobufWire.I64:
104
+ this.skip(8);
105
+ break;
106
+ case ProtobufWire.LEN:
107
+ this.skip(this.uint32());
108
+ break;
109
+ case ProtobufWire.START_GROUP:
110
+ while ((wireType = this.uint32() & 0x07) !== ProtobufWire.END_GROUP)
111
+ this.skipType(wireType);
112
+ break;
113
+ case ProtobufWire.I32:
114
+ this.skip(4);
115
+ break;
116
+ default:
117
+ throw new Error(`Invalid wire type ${wireType} at offset ${this.ptr}.`);
118
+ }
119
+ }
120
+
121
+ private varint32(): number {
122
+ let loaded: number;
123
+ let value: number;
124
+
125
+ value = (loaded = this.u8()) & 0x7f;
126
+ if (loaded < 0x80) return value;
127
+
128
+ value |= ((loaded = this.u8()) & 0x7f) << 7;
129
+ if (loaded < 0x80) return value;
130
+
131
+ value |= ((loaded = this.u8()) & 0x7f) << 14;
132
+ if (loaded < 0x80) return value;
133
+
134
+ value |= ((loaded = this.u8()) & 0x7f) << 21;
135
+ if (loaded < 0x80) return value;
136
+
137
+ value |= ((loaded = this.u8()) & 0xf) << 28;
138
+ if (loaded < 0x80) return value;
139
+
140
+ // increment position until there is no continuation bit or until we read 10 bytes
141
+ if (this.u8() < 0x80) return value;
142
+ if (this.u8() < 0x80) return value;
143
+ if (this.u8() < 0x80) return value;
144
+ if (this.u8() < 0x80) return value;
145
+ if (this.u8() < 0x80) return value;
146
+
147
+ return value;
148
+ }
149
+
150
+ private varint64(): bigint {
151
+ let loaded: bigint;
152
+ let value: bigint;
153
+
154
+ value = (loaded = this.u8n()) & BigInt(0x7f);
155
+ if (loaded < BigInt(0x80)) return value;
156
+
157
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(7);
158
+ if (loaded < BigInt(0x80)) return value;
159
+
160
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(14);
161
+ if (loaded < BigInt(0x80)) return value;
162
+
163
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(21);
164
+ if (loaded < BigInt(0x80)) return value;
165
+
166
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(28);
167
+ if (loaded < BigInt(0x80)) return value;
168
+
169
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(35);
170
+ if (loaded < BigInt(0x80)) return value;
171
+
172
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(42);
173
+ if (loaded < BigInt(0x80)) return value;
174
+
175
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(49);
176
+ if (loaded < BigInt(0x80)) return value;
177
+
178
+ value |= ((loaded = this.u8n()) & BigInt(0x7f)) << BigInt(56);
179
+ if (loaded < BigInt(0x80)) return value;
180
+
181
+ value |= (this.u8n() & BigInt(0x01)) << BigInt(63);
182
+ return BigInt.asIntN(64, value);
183
+ }
184
+
185
+ private u8(): number {
186
+ return this.view.getUint8(this.ptr++);
187
+ }
188
+
189
+ private u8n(): bigint {
190
+ return BigInt(this.u8());
191
+ }
192
+ }
193
+
194
+ const utf8 = /** @__PURE__ */ new Singleton(() => new TextDecoder("utf-8"));