typia 5.0.0-dev.20230819 → 5.0.0-dev.20230820
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/factories/ExpressionFactory.d.ts +1 -0
- package/lib/factories/ExpressionFactory.js +3 -0
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/MetadataTagFactory.js +3 -0
- package/lib/factories/MetadataTagFactory.js.map +1 -1
- package/lib/functional/$ProtobufReader.js +1 -1
- package/lib/functional/$ProtobufReader.js.map +1 -1
- package/lib/module.d.ts +0 -53
- package/lib/module.js +1 -11
- package/lib/module.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.js +2 -2
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +1 -1
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/helpers/UnionExplorer.js +11 -7
- package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
- package/lib/programmers/internal/check_bigint.js +7 -1
- package/lib/programmers/internal/check_bigint.js.map +1 -1
- package/lib/programmers/internal/check_number.js +28 -5
- package/lib/programmers/internal/check_number.js.map +1 -1
- package/lib/programmers/misc/MiscLiteralsProgrammer.js +2 -1
- package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +3 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
- package/lib/schemas/metadata/MetadataTuple.js.map +1 -1
- package/package.json +2 -2
- package/src/factories/ExpressionFactory.ts +7 -0
- package/src/factories/MetadataTagFactory.ts +3 -0
- package/src/functional/$ProtobufReader.ts +1 -2
- package/src/module.ts +0 -73
- package/src/programmers/CheckerProgrammer.ts +4 -4
- package/src/programmers/RandomProgrammer.ts +1 -1
- package/src/programmers/helpers/UnionExplorer.ts +11 -7
- package/src/programmers/internal/check_bigint.ts +11 -1
- package/src/programmers/internal/check_number.ts +64 -11
- package/src/programmers/misc/MiscLiteralsProgrammer.ts +2 -1
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +6 -1
- package/src/schemas/metadata/MetadataTuple.ts +5 -0
- package/lib/functional/$proto_bytes.d.ts +0 -2
- package/lib/functional/$proto_bytes.js +0 -37
- package/lib/functional/$proto_bytes.js.map +0 -1
- package/lib/functional/$proto_field.d.ts +0 -10
- package/lib/functional/$proto_field.js +0 -42
- package/lib/functional/$proto_field.js.map +0 -1
- package/lib/functional/$proto_float.d.ts +0 -4
- package/lib/functional/$proto_float.js +0 -28
- package/lib/functional/$proto_float.js.map +0 -1
- package/lib/functional/$proto_i32.d.ts +0 -2
- package/lib/functional/$proto_i32.js +0 -23
- package/lib/functional/$proto_i32.js.map +0 -1
- package/lib/functional/$proto_i64.d.ts +0 -2
- package/lib/functional/$proto_i64.js +0 -31
- package/lib/functional/$proto_i64.js.map +0 -1
- package/lib/functional/$proto_size.d.ts +0 -6
- package/lib/functional/$proto_size.js +0 -76
- package/lib/functional/$proto_size.js.map +0 -1
- package/lib/functional/$proto_string.d.ts +0 -2
- package/lib/functional/$proto_string.js +0 -34
- package/lib/functional/$proto_string.js.map +0 -1
- package/src/functional/$proto_bytes.ts +0 -25
- package/src/functional/$proto_field.ts +0 -30
- package/src/functional/$proto_float.ts +0 -37
- package/src/functional/$proto_i32.ts +0 -29
- package/src/functional/$proto_i64.ts +0 -37
- package/src/functional/$proto_size.ts +0 -82
- package/src/functional/$proto_string.ts +0 -24
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function $proto_float32_encode(dst: Uint8Array, offset: number, value: number): number;
|
|
2
|
-
export declare function $proto_float32_decode(src: Uint8Array, offset: number): [value: number, offset: number];
|
|
3
|
-
export declare function $proto_float64_encode(dst: Uint8Array, offset: number, value: number): number;
|
|
4
|
-
export declare function $proto_float64_decode(src: Uint8Array, offset: number): [value: number, offset: number];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$proto_float64_decode = exports.$proto_float64_encode = exports.$proto_float32_decode = exports.$proto_float32_encode = void 0;
|
|
4
|
-
function $proto_float32_encode(dst, offset, value) {
|
|
5
|
-
new DataView(dst.buffer).setFloat32(offset, value, true);
|
|
6
|
-
offset += 4;
|
|
7
|
-
return offset;
|
|
8
|
-
}
|
|
9
|
-
exports.$proto_float32_encode = $proto_float32_encode;
|
|
10
|
-
function $proto_float32_decode(src, offset) {
|
|
11
|
-
var value = new DataView(src.buffer).getFloat32(offset, true);
|
|
12
|
-
offset += 4;
|
|
13
|
-
return [value, offset];
|
|
14
|
-
}
|
|
15
|
-
exports.$proto_float32_decode = $proto_float32_decode;
|
|
16
|
-
function $proto_float64_encode(dst, offset, value) {
|
|
17
|
-
new DataView(dst.buffer).setFloat64(offset, value, true);
|
|
18
|
-
offset += 8;
|
|
19
|
-
return offset;
|
|
20
|
-
}
|
|
21
|
-
exports.$proto_float64_encode = $proto_float64_encode;
|
|
22
|
-
function $proto_float64_decode(src, offset) {
|
|
23
|
-
var value = new DataView(src.buffer).getFloat64(offset, true);
|
|
24
|
-
offset += 8;
|
|
25
|
-
return [value, offset];
|
|
26
|
-
}
|
|
27
|
-
exports.$proto_float64_decode = $proto_float64_decode;
|
|
28
|
-
//# sourceMappingURL=$proto_float.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_float.js","sourceRoot":"","sources":["../../src/functional/$proto_float.ts"],"names":[],"mappings":";;;AAAA,SAAgB,qBAAqB,CACjC,GAAe,EACf,MAAc,EACd,KAAa;IAEb,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACzD,MAAM,IAAI,CAAC,CAAC;IACZ,OAAO,MAAM,CAAC;AAClB,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CACjC,GAAe,EACf,MAAc;IAEd,IAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,IAAI,CAAC,CAAC;IACZ,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAPD,sDAOC;AAED,SAAgB,qBAAqB,CACjC,GAAe,EACf,MAAc,EACd,KAAa;IAEb,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACzD,MAAM,IAAI,CAAC,CAAC;IACZ,OAAO,MAAM,CAAC;AAClB,CAAC;AARD,sDAQC;AAED,SAAgB,qBAAqB,CACjC,GAAe,EACf,MAAc;IAEd,IAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,IAAI,CAAC,CAAC;IACZ,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAPD,sDAOC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$proto_i32_decode = exports.$proto_i32_encode = void 0;
|
|
4
|
-
function $proto_i32_encode(dst, offset, value) {
|
|
5
|
-
value = (value | 0) >>> 0;
|
|
6
|
-
dst[offset] = value & 0xff;
|
|
7
|
-
dst[offset + 1] = (value >>> 8) & 0xff;
|
|
8
|
-
dst[offset + 2] = (value >>> 16) & 0xff;
|
|
9
|
-
dst[offset + 3] = (value >>> 24) & 0xff;
|
|
10
|
-
offset += 4;
|
|
11
|
-
return offset;
|
|
12
|
-
}
|
|
13
|
-
exports.$proto_i32_encode = $proto_i32_encode;
|
|
14
|
-
function $proto_i32_decode(buf, offset) {
|
|
15
|
-
var value = (buf[offset] << 0) |
|
|
16
|
-
(buf[offset + 1] << 8) |
|
|
17
|
-
(buf[offset + 2] << 16) |
|
|
18
|
-
(buf[offset + 3] << 24);
|
|
19
|
-
offset += 4;
|
|
20
|
-
return [value, offset];
|
|
21
|
-
}
|
|
22
|
-
exports.$proto_i32_decode = $proto_i32_decode;
|
|
23
|
-
//# sourceMappingURL=$proto_i32.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_i32.js","sourceRoot":"","sources":["../../src/functional/$proto_i32.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAC7B,GAAe,EACf,MAAc,EACd,KAAa;IAEb,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAE1B,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;IAC3B,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;IACvC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACxC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACxC,MAAM,IAAI,CAAC,CAAC;IAEZ,OAAO,MAAM,CAAC;AAClB,CAAC;AAdD,8CAcC;AAED,SAAgB,iBAAiB,CAC7B,GAAe,EACf,MAAc;IAEd,IAAM,KAAK,GACP,CAAC,GAAG,CAAC,MAAM,CAAE,IAAI,CAAC,CAAC;QACnB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,IAAI,CAAC,CAAC;QACvB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,IAAI,EAAE,CAAC;QACxB,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,IAAI,EAAE,CAAC,CAAC;IAC7B,MAAM,IAAI,CAAC,CAAC;IAEZ,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAZD,8CAYC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$proto_i64_decode = exports.$proto_i64_encode = void 0;
|
|
4
|
-
function $proto_i64_encode(dst, offset, value) {
|
|
5
|
-
value = BigInt.asUintN(64, value);
|
|
6
|
-
dst[offset] = Number(value & BigInt(0xff));
|
|
7
|
-
dst[offset + 1] = Number((value >> BigInt(8)) & BigInt(0xff));
|
|
8
|
-
dst[offset + 2] = Number((value >> BigInt(16)) & BigInt(0xff));
|
|
9
|
-
dst[offset + 3] = Number((value >> BigInt(24)) & BigInt(0xff));
|
|
10
|
-
dst[offset + 4] = Number((value >> BigInt(32)) & BigInt(0xff));
|
|
11
|
-
dst[offset + 5] = Number((value >> BigInt(40)) & BigInt(0xff));
|
|
12
|
-
dst[offset + 6] = Number((value >> BigInt(48)) & BigInt(0xff));
|
|
13
|
-
dst[offset + 7] = Number((value >> BigInt(56)) & BigInt(0xff));
|
|
14
|
-
offset += 8;
|
|
15
|
-
return offset;
|
|
16
|
-
}
|
|
17
|
-
exports.$proto_i64_encode = $proto_i64_encode;
|
|
18
|
-
function $proto_i64_decode(buf, offset) {
|
|
19
|
-
var value = (BigInt(buf[offset]) << BigInt(0)) |
|
|
20
|
-
(BigInt(buf[offset + 1]) << BigInt(8)) |
|
|
21
|
-
(BigInt(buf[offset + 2]) << BigInt(16)) |
|
|
22
|
-
(BigInt(buf[offset + 3]) << BigInt(24)) |
|
|
23
|
-
(BigInt(buf[offset + 4]) << BigInt(32)) |
|
|
24
|
-
(BigInt(buf[offset + 5]) << BigInt(40)) |
|
|
25
|
-
(BigInt(buf[offset + 6]) << BigInt(48)) |
|
|
26
|
-
(BigInt(buf[offset + 7]) << BigInt(56));
|
|
27
|
-
offset += 8;
|
|
28
|
-
return [BigInt.asIntN(64, value), offset];
|
|
29
|
-
}
|
|
30
|
-
exports.$proto_i64_decode = $proto_i64_decode;
|
|
31
|
-
//# sourceMappingURL=$proto_i64.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_i64.js","sourceRoot":"","sources":["../../src/functional/$proto_i64.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAC7B,GAAe,EACf,MAAc,EACd,KAAa;IAEb,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAElC,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;I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AC,EAAE,CAAC,CAAC,CAAC;IAC7C,MAAM,IAAI,CAAC,CAAC;IAEZ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAhBD,8CAgBC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { $proto_field_wiretype } from "./$proto_field";
|
|
2
|
-
export declare function $proto_size_varint(n: number): number;
|
|
3
|
-
export declare function $proto_size_varint(n: bigint): number;
|
|
4
|
-
export declare function $proto_size_field(fieldNumber: number, wireType: $proto_field_wiretype): number;
|
|
5
|
-
export declare function $proto_size_bytes(len: number): number;
|
|
6
|
-
export declare function $proto_size_string(value: string): number;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$proto_size_string = exports.$proto_size_bytes = exports.$proto_size_field = exports.$proto_size_varint = void 0;
|
|
4
|
-
function $proto_size_varint(n) {
|
|
5
|
-
if (typeof n === "number") {
|
|
6
|
-
if (n < 0) {
|
|
7
|
-
return SizeVarInt64(BigInt(n));
|
|
8
|
-
}
|
|
9
|
-
return SizeVarInt32(n);
|
|
10
|
-
}
|
|
11
|
-
return SizeVarInt64(n);
|
|
12
|
-
}
|
|
13
|
-
exports.$proto_size_varint = $proto_size_varint;
|
|
14
|
-
function $proto_size_field(fieldNumber, wireType) {
|
|
15
|
-
var tag = (fieldNumber << 3) | Number(wireType);
|
|
16
|
-
return $proto_size_varint(tag);
|
|
17
|
-
}
|
|
18
|
-
exports.$proto_size_field = $proto_size_field;
|
|
19
|
-
function $proto_size_bytes(len) {
|
|
20
|
-
return $proto_size_varint(len) + len;
|
|
21
|
-
}
|
|
22
|
-
exports.$proto_size_bytes = $proto_size_bytes;
|
|
23
|
-
var utf8_encoder = new TextEncoder();
|
|
24
|
-
function $proto_size_string(value) {
|
|
25
|
-
var bytes = utf8_encoder.encode(value);
|
|
26
|
-
return $proto_size_bytes(bytes.length);
|
|
27
|
-
}
|
|
28
|
-
exports.$proto_size_string = $proto_size_string;
|
|
29
|
-
function SizeVarInt32(value) {
|
|
30
|
-
value = (value | 0) >>> 0;
|
|
31
|
-
if (value <= 127) {
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
34
|
-
else if (value <= 16383) {
|
|
35
|
-
return 2;
|
|
36
|
-
}
|
|
37
|
-
else if (value <= 2097151) {
|
|
38
|
-
return 3;
|
|
39
|
-
}
|
|
40
|
-
else if (value <= 268435455) {
|
|
41
|
-
return 4;
|
|
42
|
-
}
|
|
43
|
-
return 5;
|
|
44
|
-
}
|
|
45
|
-
function SizeVarInt64(value) {
|
|
46
|
-
value = BigInt.asUintN(64, value);
|
|
47
|
-
if (value <= BigInt("127")) {
|
|
48
|
-
return 1;
|
|
49
|
-
}
|
|
50
|
-
else if (value <= BigInt("16383")) {
|
|
51
|
-
return 2;
|
|
52
|
-
}
|
|
53
|
-
else if (value <= BigInt("2097151")) {
|
|
54
|
-
return 3;
|
|
55
|
-
}
|
|
56
|
-
else if (value <= BigInt("268435455")) {
|
|
57
|
-
return 4;
|
|
58
|
-
}
|
|
59
|
-
else if (value <= BigInt("34359738367")) {
|
|
60
|
-
return 5;
|
|
61
|
-
}
|
|
62
|
-
else if (value <= BigInt("4398046511103")) {
|
|
63
|
-
return 6;
|
|
64
|
-
}
|
|
65
|
-
else if (value <= BigInt("562949953421311")) {
|
|
66
|
-
return 7;
|
|
67
|
-
}
|
|
68
|
-
else if (value <= BigInt("72057594037927935")) {
|
|
69
|
-
return 8;
|
|
70
|
-
}
|
|
71
|
-
else if (value <= BigInt("9223372036854775807")) {
|
|
72
|
-
return 9;
|
|
73
|
-
}
|
|
74
|
-
return 10;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=$proto_size.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_size.js","sourceRoot":"","sources":["../../src/functional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;KACZ;IAGD,OAAO,CAAC,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IAC/B,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAIlC,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;QACjC,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE;QACnC,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;QACrC,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;QACvC,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,eAAe,CAAC,EAAE;QACzC,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,iBAAiB,CAAC,EAAE;QAC3C,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,mBAAmB,CAAC,EAAE;QAC7C,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,MAAM,CAAC,qBAAqB,CAAC,EAAE;QAC/C,OAAO,CAAC,CAAC;KACZ;IAED,OAAO,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.$proto_string_decode = exports.$proto_string_encode = void 0;
|
|
20
|
-
var _proto_bytes_1 = require("./$proto_bytes");
|
|
21
|
-
var utf8_encoder = new TextEncoder();
|
|
22
|
-
function $proto_string_encode(dst, offset, value) {
|
|
23
|
-
var bytes = utf8_encoder.encode(value);
|
|
24
|
-
return (0, _proto_bytes_1.$proto_bytes_encode)(dst, offset, bytes);
|
|
25
|
-
}
|
|
26
|
-
exports.$proto_string_encode = $proto_string_encode;
|
|
27
|
-
function $proto_string_decode(src, offset) {
|
|
28
|
-
var utf8_decoder = new TextDecoder("utf-8");
|
|
29
|
-
var _a = __read((0, _proto_bytes_1.$proto_bytes_decode)(src, offset), 2), bytes = _a[0], o = _a[1];
|
|
30
|
-
var value = utf8_decoder.decode(bytes);
|
|
31
|
-
return [value, o];
|
|
32
|
-
}
|
|
33
|
-
exports.$proto_string_decode = $proto_string_decode;
|
|
34
|
-
//# sourceMappingURL=$proto_string.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_string.js","sourceRoot":"","sources":["../../src/functional/$proto_string.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,+CAA0E;AAE1E,IAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC,SAAgB,oBAAoB,CAChC,GAAe,EACf,MAAc,EACd,KAAa;IAIb,IAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,IAAA,kCAAmB,EAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AATD,oDASC;AAED,SAAgB,oBAAoB,CAChC,GAAe,EACf,MAAc;IAEd,IAAM,YAAY,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACxC,IAAA,KAAA,OAAa,IAAA,kCAAmB,EAAC,GAAG,EAAE,MAAM,CAAC,IAAA,EAA5C,KAAK,QAAA,EAAE,CAAC,QAAoC,CAAC;IACpD,IAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC;AARD,oDAQC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { $varint_decode_i32, $varint_encode } from "./$varint";
|
|
2
|
-
|
|
3
|
-
export function $proto_bytes_encode(
|
|
4
|
-
dst: Uint8Array,
|
|
5
|
-
offset: number,
|
|
6
|
-
value: Uint8Array,
|
|
7
|
-
): number {
|
|
8
|
-
offset = $varint_encode(dst, offset, value.length);
|
|
9
|
-
dst.set(value, offset);
|
|
10
|
-
offset += value.length;
|
|
11
|
-
return offset;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function $proto_bytes_decode(
|
|
15
|
-
src: Uint8Array,
|
|
16
|
-
offset: number,
|
|
17
|
-
): [value: Uint8Array, offset: number] {
|
|
18
|
-
let length = 0;
|
|
19
|
-
|
|
20
|
-
[length, offset] = $varint_decode_i32(src, offset); // Max Length: ~2GB
|
|
21
|
-
const value = src.subarray(offset, offset + length);
|
|
22
|
-
offset += length;
|
|
23
|
-
|
|
24
|
-
return [value, offset];
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { $varint_decode_i32, $varint_encode } from "./$varint";
|
|
2
|
-
|
|
3
|
-
export enum $proto_field_wiretype {
|
|
4
|
-
VARINT = 0,
|
|
5
|
-
I64 = 1,
|
|
6
|
-
LEN = 2,
|
|
7
|
-
SGROUP = 3, // deprecated
|
|
8
|
-
EGROUP = 4, // deprecated
|
|
9
|
-
I32 = 5,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function $proto_field_encode(
|
|
13
|
-
dst: Uint8Array,
|
|
14
|
-
offset: number,
|
|
15
|
-
fieldNumber: number,
|
|
16
|
-
wireType: $proto_field_wiretype,
|
|
17
|
-
): number {
|
|
18
|
-
const tag = (fieldNumber << 3) | Number(wireType);
|
|
19
|
-
return $varint_encode(dst, offset, tag);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function $proto_field_decode(
|
|
23
|
-
buf: Uint8Array,
|
|
24
|
-
offset: number,
|
|
25
|
-
): [fieldNumber: number, wireType: $proto_field_wiretype, offset: number] {
|
|
26
|
-
const [tag, o] = $varint_decode_i32(buf, offset);
|
|
27
|
-
const fieldNumber = tag >>> 3;
|
|
28
|
-
const wireType = tag & 0b111;
|
|
29
|
-
return [fieldNumber, wireType, o];
|
|
30
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export function $proto_float32_encode(
|
|
2
|
-
dst: Uint8Array,
|
|
3
|
-
offset: number,
|
|
4
|
-
value: number,
|
|
5
|
-
): number {
|
|
6
|
-
new DataView(dst.buffer).setFloat32(offset, value, true);
|
|
7
|
-
offset += 4;
|
|
8
|
-
return offset;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function $proto_float32_decode(
|
|
12
|
-
src: Uint8Array,
|
|
13
|
-
offset: number,
|
|
14
|
-
): [value: number, offset: number] {
|
|
15
|
-
const value = new DataView(src.buffer).getFloat32(offset, true);
|
|
16
|
-
offset += 4;
|
|
17
|
-
return [value, offset];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function $proto_float64_encode(
|
|
21
|
-
dst: Uint8Array,
|
|
22
|
-
offset: number,
|
|
23
|
-
value: number,
|
|
24
|
-
): number {
|
|
25
|
-
new DataView(dst.buffer).setFloat64(offset, value, true);
|
|
26
|
-
offset += 8;
|
|
27
|
-
return offset;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function $proto_float64_decode(
|
|
31
|
-
src: Uint8Array,
|
|
32
|
-
offset: number,
|
|
33
|
-
): [value: number, offset: number] {
|
|
34
|
-
const value = new DataView(src.buffer).getFloat64(offset, true);
|
|
35
|
-
offset += 8;
|
|
36
|
-
return [value, offset];
|
|
37
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function $proto_i32_encode(
|
|
2
|
-
dst: Uint8Array,
|
|
3
|
-
offset: number,
|
|
4
|
-
value: number,
|
|
5
|
-
): number {
|
|
6
|
-
value = (value | 0) >>> 0;
|
|
7
|
-
|
|
8
|
-
dst[offset] = value & 0xff;
|
|
9
|
-
dst[offset + 1] = (value >>> 8) & 0xff;
|
|
10
|
-
dst[offset + 2] = (value >>> 16) & 0xff;
|
|
11
|
-
dst[offset + 3] = (value >>> 24) & 0xff;
|
|
12
|
-
offset += 4;
|
|
13
|
-
|
|
14
|
-
return offset;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function $proto_i32_decode(
|
|
18
|
-
buf: Uint8Array,
|
|
19
|
-
offset: number,
|
|
20
|
-
): [value: number, offset: number] {
|
|
21
|
-
const value =
|
|
22
|
-
(buf[offset]! << 0) |
|
|
23
|
-
(buf[offset + 1]! << 8) |
|
|
24
|
-
(buf[offset + 2]! << 16) |
|
|
25
|
-
(buf[offset + 3]! << 24);
|
|
26
|
-
offset += 4;
|
|
27
|
-
|
|
28
|
-
return [value, offset];
|
|
29
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export function $proto_i64_encode(
|
|
2
|
-
dst: Uint8Array,
|
|
3
|
-
offset: number,
|
|
4
|
-
value: bigint,
|
|
5
|
-
): number {
|
|
6
|
-
value = BigInt.asUintN(64, value);
|
|
7
|
-
|
|
8
|
-
dst[offset] = Number(value & BigInt(0xff));
|
|
9
|
-
dst[offset + 1] = Number((value >> BigInt(8)) & BigInt(0xff));
|
|
10
|
-
dst[offset + 2] = Number((value >> BigInt(16)) & BigInt(0xff));
|
|
11
|
-
dst[offset + 3] = Number((value >> BigInt(24)) & BigInt(0xff));
|
|
12
|
-
dst[offset + 4] = Number((value >> BigInt(32)) & BigInt(0xff));
|
|
13
|
-
dst[offset + 5] = Number((value >> BigInt(40)) & BigInt(0xff));
|
|
14
|
-
dst[offset + 6] = Number((value >> BigInt(48)) & BigInt(0xff));
|
|
15
|
-
dst[offset + 7] = Number((value >> BigInt(56)) & BigInt(0xff));
|
|
16
|
-
offset += 8;
|
|
17
|
-
|
|
18
|
-
return offset;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function $proto_i64_decode(
|
|
22
|
-
buf: Uint8Array,
|
|
23
|
-
offset: number,
|
|
24
|
-
): [value: bigint, offset: number] {
|
|
25
|
-
const value =
|
|
26
|
-
(BigInt(buf[offset]!) << BigInt(0)) |
|
|
27
|
-
(BigInt(buf[offset + 1]!) << BigInt(8)) |
|
|
28
|
-
(BigInt(buf[offset + 2]!) << BigInt(16)) |
|
|
29
|
-
(BigInt(buf[offset + 3]!) << BigInt(24)) |
|
|
30
|
-
(BigInt(buf[offset + 4]!) << BigInt(32)) |
|
|
31
|
-
(BigInt(buf[offset + 5]!) << BigInt(40)) |
|
|
32
|
-
(BigInt(buf[offset + 6]!) << BigInt(48)) |
|
|
33
|
-
(BigInt(buf[offset + 7]!) << BigInt(56));
|
|
34
|
-
offset += 8;
|
|
35
|
-
|
|
36
|
-
return [BigInt.asIntN(64, value), offset];
|
|
37
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { $proto_field_wiretype } from "./$proto_field";
|
|
2
|
-
|
|
3
|
-
export function $proto_size_varint(n: number): number;
|
|
4
|
-
export function $proto_size_varint(n: bigint): number;
|
|
5
|
-
|
|
6
|
-
export function $proto_size_varint(n: number | bigint): number {
|
|
7
|
-
if (typeof n === "number") {
|
|
8
|
-
if (n < 0) {
|
|
9
|
-
return SizeVarInt64(BigInt(n));
|
|
10
|
-
}
|
|
11
|
-
return SizeVarInt32(n);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return SizeVarInt64(n);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function $proto_size_field(
|
|
18
|
-
fieldNumber: number,
|
|
19
|
-
wireType: $proto_field_wiretype,
|
|
20
|
-
): number {
|
|
21
|
-
const tag = (fieldNumber << 3) | Number(wireType);
|
|
22
|
-
return $proto_size_varint(tag);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function $proto_size_bytes(len: number): number {
|
|
26
|
-
return $proto_size_varint(len) + len;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const utf8_encoder = new TextEncoder();
|
|
30
|
-
|
|
31
|
-
export function $proto_size_string(value: string): number {
|
|
32
|
-
// TODO: optimize (DON'T ENCODE TEXT TWICE)
|
|
33
|
-
const bytes = utf8_encoder.encode(value);
|
|
34
|
-
return $proto_size_bytes(bytes.length);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function SizeVarInt32(value: number): number {
|
|
38
|
-
value = (value | 0) >>> 0; // 32-bit integer
|
|
39
|
-
// TODO: optimize ( branchless solution exists )
|
|
40
|
-
// TODO: try lookup table based solution
|
|
41
|
-
|
|
42
|
-
if (value <= 127) {
|
|
43
|
-
return 1;
|
|
44
|
-
} else if (value <= 16383) {
|
|
45
|
-
return 2;
|
|
46
|
-
} else if (value <= 2097151) {
|
|
47
|
-
return 3;
|
|
48
|
-
} else if (value <= 268435455) {
|
|
49
|
-
return 4;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// < 34359738367
|
|
53
|
-
return 5;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function SizeVarInt64(value: bigint): number {
|
|
57
|
-
value = BigInt.asUintN(64, value);
|
|
58
|
-
// TODO: optimize ( branchless solution exists )
|
|
59
|
-
// TODO: try lookup table based solution
|
|
60
|
-
|
|
61
|
-
if (value <= BigInt("127")) {
|
|
62
|
-
return 1;
|
|
63
|
-
} else if (value <= BigInt("16383")) {
|
|
64
|
-
return 2;
|
|
65
|
-
} else if (value <= BigInt("2097151")) {
|
|
66
|
-
return 3;
|
|
67
|
-
} else if (value <= BigInt("268435455")) {
|
|
68
|
-
return 4;
|
|
69
|
-
} else if (value <= BigInt("34359738367")) {
|
|
70
|
-
return 5;
|
|
71
|
-
} else if (value <= BigInt("4398046511103")) {
|
|
72
|
-
return 6;
|
|
73
|
-
} else if (value <= BigInt("562949953421311")) {
|
|
74
|
-
return 7;
|
|
75
|
-
} else if (value <= BigInt("72057594037927935")) {
|
|
76
|
-
return 8;
|
|
77
|
-
} else if (value <= BigInt("9223372036854775807")) {
|
|
78
|
-
return 9;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return 10;
|
|
82
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { $proto_bytes_decode, $proto_bytes_encode } from "./$proto_bytes";
|
|
2
|
-
|
|
3
|
-
const utf8_encoder = new TextEncoder();
|
|
4
|
-
|
|
5
|
-
export function $proto_string_encode(
|
|
6
|
-
dst: Uint8Array,
|
|
7
|
-
offset: number,
|
|
8
|
-
value: string,
|
|
9
|
-
): number {
|
|
10
|
-
// TODO: optimize (DON'T ENCODE TEXT TWICE)
|
|
11
|
-
|
|
12
|
-
const bytes = utf8_encoder.encode(value);
|
|
13
|
-
return $proto_bytes_encode(dst, offset, bytes);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function $proto_string_decode(
|
|
17
|
-
src: Uint8Array,
|
|
18
|
-
offset: number,
|
|
19
|
-
): [value: string, offset: number] {
|
|
20
|
-
const utf8_decoder = new TextDecoder("utf-8");
|
|
21
|
-
const [bytes, o] = $proto_bytes_decode(src, offset);
|
|
22
|
-
const value = utf8_decoder.decode(bytes);
|
|
23
|
-
return [value, o];
|
|
24
|
-
}
|