typia 5.0.0-dev.20230819 → 5.0.0-dev.20230820-2
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 +4 -2
- 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 +11 -5
- 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/ProtobufEncodeProgrammer.js +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.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/IMetadataTag.d.ts +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 +4 -2
- 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 +9 -4
- 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/ProtobufEncodeProgrammer.ts +1 -2
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +6 -1
- package/src/schemas/metadata/IMetadataTag.ts +1 -2
- 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
|
@@ -22,18 +22,32 @@ export const check_number =
|
|
|
22
22
|
const entries: [IMetadataTag, ts.Expression][] = [];
|
|
23
23
|
for (const tag of metaTags)
|
|
24
24
|
if (tag.kind === "type") {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
// MUST BE INTEGER
|
|
26
|
+
if (
|
|
27
|
+
tag.value === "int" ||
|
|
28
|
+
tag.value === "uint" ||
|
|
29
|
+
tag.value === "int32" ||
|
|
30
|
+
tag.value === "uint32" ||
|
|
31
|
+
tag.value === "int64" ||
|
|
32
|
+
tag.value === "uint64"
|
|
33
|
+
)
|
|
34
|
+
entries.push([
|
|
35
|
+
tag,
|
|
36
|
+
ts.factory.createStrictEquality(
|
|
37
|
+
ts.factory.createCallExpression(
|
|
38
|
+
ts.factory.createIdentifier("Math.floor"),
|
|
39
|
+
undefined,
|
|
40
|
+
[input],
|
|
41
|
+
),
|
|
42
|
+
input,
|
|
32
43
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
]);
|
|
45
|
+
// GREATER THAN OR EQUAL TO ZERO
|
|
46
|
+
if (
|
|
47
|
+
tag.value === "uint" ||
|
|
48
|
+
tag.value === "uint32" ||
|
|
49
|
+
tag.value === "uint64"
|
|
50
|
+
)
|
|
37
51
|
entries.push([
|
|
38
52
|
tag,
|
|
39
53
|
ts.factory.createLessThanEquals(
|
|
@@ -41,6 +55,45 @@ export const check_number =
|
|
|
41
55
|
input,
|
|
42
56
|
),
|
|
43
57
|
]);
|
|
58
|
+
// RANGE LIMIT
|
|
59
|
+
if (tag.value === "uint32")
|
|
60
|
+
entries.push([
|
|
61
|
+
tag,
|
|
62
|
+
ts.factory.createLessThanEquals(
|
|
63
|
+
input,
|
|
64
|
+
ts.factory.createNumericLiteral(4294967295),
|
|
65
|
+
),
|
|
66
|
+
]);
|
|
67
|
+
else if (tag.value === "int32")
|
|
68
|
+
entries.push([
|
|
69
|
+
tag,
|
|
70
|
+
ts.factory.createLogicalAnd(
|
|
71
|
+
ts.factory.createLessThanEquals(
|
|
72
|
+
ts.factory.createNumericLiteral(-2147483648),
|
|
73
|
+
input,
|
|
74
|
+
),
|
|
75
|
+
ts.factory.createLessThanEquals(
|
|
76
|
+
input,
|
|
77
|
+
ts.factory.createNumericLiteral(2147483647),
|
|
78
|
+
),
|
|
79
|
+
),
|
|
80
|
+
]);
|
|
81
|
+
else if (tag.value === "float")
|
|
82
|
+
entries.push([
|
|
83
|
+
tag,
|
|
84
|
+
ts.factory.createLogicalAnd(
|
|
85
|
+
ts.factory.createLessThanEquals(
|
|
86
|
+
ts.factory.createNumericLiteral(
|
|
87
|
+
-1.175494351e38,
|
|
88
|
+
),
|
|
89
|
+
input,
|
|
90
|
+
),
|
|
91
|
+
ts.factory.createLessThanEquals(
|
|
92
|
+
input,
|
|
93
|
+
ts.factory.createNumericLiteral(3.4028235e38),
|
|
94
|
+
),
|
|
95
|
+
),
|
|
96
|
+
]);
|
|
44
97
|
} else if (tag.kind === "multipleOf")
|
|
45
98
|
entries.push([
|
|
46
99
|
tag,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
|
|
3
|
+
import { ExpressionFactory } from "../../factories/ExpressionFactory";
|
|
3
4
|
import { MetadataCollection } from "../../factories/MetadataCollection";
|
|
4
5
|
import { MetadataFactory } from "../../factories/MetadataFactory";
|
|
5
6
|
|
|
@@ -47,7 +48,7 @@ export namespace MiscLiteralsProgrammer {
|
|
|
47
48
|
: typeof v === "number"
|
|
48
49
|
? ts.factory.createNumericLiteral(v)
|
|
49
50
|
: typeof v === "bigint"
|
|
50
|
-
?
|
|
51
|
+
? ExpressionFactory.bigint(Number(v))
|
|
51
52
|
: ts.factory.createStringLiteral(v),
|
|
52
53
|
),
|
|
53
54
|
true,
|
|
@@ -597,8 +597,7 @@ export namespace ProtobufEncodeProgrammer {
|
|
|
597
597
|
return out(ProtobufWire.VARIANT)(
|
|
598
598
|
type?.value === "uint64" ? "uint64" : "int64",
|
|
599
599
|
);
|
|
600
|
-
else if (type === undefined
|
|
601
|
-
return out(ProtobufWire.I64)("double");
|
|
600
|
+
else if (type === undefined) return out(ProtobufWire.I64)("double");
|
|
602
601
|
else if (type.value === "float")
|
|
603
602
|
return out(ProtobufWire.I32)("float");
|
|
604
603
|
return out(ProtobufWire.VARIANT)(
|
|
@@ -138,7 +138,12 @@ export namespace ProtobufMessageProgrammer {
|
|
|
138
138
|
(tags: IMetadataTag[]) =>
|
|
139
139
|
(literal: Atomic.Literal): string => {
|
|
140
140
|
if (literal === "boolean") return "bool";
|
|
141
|
-
else if (literal === "bigint")
|
|
141
|
+
else if (literal === "bigint")
|
|
142
|
+
return tags.find(
|
|
143
|
+
(t) => t.kind === "type" && t.value === "uint64",
|
|
144
|
+
)
|
|
145
|
+
? "uint64"
|
|
146
|
+
: "int64";
|
|
142
147
|
else if (literal === "number") {
|
|
143
148
|
const type = tags.find((t) => t.kind === "type") as
|
|
144
149
|
| IMetadataTag.INumberType
|
|
@@ -1,37 +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_bytes_decode = exports.$proto_bytes_encode = void 0;
|
|
20
|
-
var _varint_1 = require("./$varint");
|
|
21
|
-
function $proto_bytes_encode(dst, offset, value) {
|
|
22
|
-
offset = (0, _varint_1.$varint_encode)(dst, offset, value.length);
|
|
23
|
-
dst.set(value, offset);
|
|
24
|
-
offset += value.length;
|
|
25
|
-
return offset;
|
|
26
|
-
}
|
|
27
|
-
exports.$proto_bytes_encode = $proto_bytes_encode;
|
|
28
|
-
function $proto_bytes_decode(src, offset) {
|
|
29
|
-
var _a;
|
|
30
|
-
var length = 0;
|
|
31
|
-
_a = __read((0, _varint_1.$varint_decode_i32)(src, offset), 2), length = _a[0], offset = _a[1];
|
|
32
|
-
var value = src.subarray(offset, offset + length);
|
|
33
|
-
offset += length;
|
|
34
|
-
return [value, offset];
|
|
35
|
-
}
|
|
36
|
-
exports.$proto_bytes_decode = $proto_bytes_decode;
|
|
37
|
-
//# sourceMappingURL=$proto_bytes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_bytes.js","sourceRoot":"","sources":["../../src/functional/$proto_bytes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,qCAA+D;AAE/D,SAAgB,mBAAmB,CAC/B,GAAe,EACf,MAAc,EACd,KAAiB;IAEjB,MAAM,GAAG,IAAA,wBAAc,EAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnD,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,MAAM,CAAC;AAClB,CAAC;AATD,kDASC;AAED,SAAgB,mBAAmB,CAC/B,GAAe,EACf,MAAc;;IAEd,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAA,OAAmB,IAAA,4BAAkB,EAAC,GAAG,EAAE,MAAM,CAAC,IAAA,EAAjD,MAAM,QAAA,EAAE,MAAM,QAAA,CAAoC;IACnD,IAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACpD,MAAM,IAAI,MAAM,CAAC;IAEjB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAXD,kDAWC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare enum $proto_field_wiretype {
|
|
2
|
-
VARINT = 0,
|
|
3
|
-
I64 = 1,
|
|
4
|
-
LEN = 2,
|
|
5
|
-
SGROUP = 3,
|
|
6
|
-
EGROUP = 4,
|
|
7
|
-
I32 = 5
|
|
8
|
-
}
|
|
9
|
-
export declare function $proto_field_encode(dst: Uint8Array, offset: number, fieldNumber: number, wireType: $proto_field_wiretype): number;
|
|
10
|
-
export declare function $proto_field_decode(buf: Uint8Array, offset: number): [fieldNumber: number, wireType: $proto_field_wiretype, offset: number];
|
|
@@ -1,42 +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_field_decode = exports.$proto_field_encode = exports.$proto_field_wiretype = void 0;
|
|
20
|
-
var _varint_1 = require("./$varint");
|
|
21
|
-
var $proto_field_wiretype;
|
|
22
|
-
(function ($proto_field_wiretype) {
|
|
23
|
-
$proto_field_wiretype[$proto_field_wiretype["VARINT"] = 0] = "VARINT";
|
|
24
|
-
$proto_field_wiretype[$proto_field_wiretype["I64"] = 1] = "I64";
|
|
25
|
-
$proto_field_wiretype[$proto_field_wiretype["LEN"] = 2] = "LEN";
|
|
26
|
-
$proto_field_wiretype[$proto_field_wiretype["SGROUP"] = 3] = "SGROUP";
|
|
27
|
-
$proto_field_wiretype[$proto_field_wiretype["EGROUP"] = 4] = "EGROUP";
|
|
28
|
-
$proto_field_wiretype[$proto_field_wiretype["I32"] = 5] = "I32";
|
|
29
|
-
})($proto_field_wiretype || (exports.$proto_field_wiretype = $proto_field_wiretype = {}));
|
|
30
|
-
function $proto_field_encode(dst, offset, fieldNumber, wireType) {
|
|
31
|
-
var tag = (fieldNumber << 3) | Number(wireType);
|
|
32
|
-
return (0, _varint_1.$varint_encode)(dst, offset, tag);
|
|
33
|
-
}
|
|
34
|
-
exports.$proto_field_encode = $proto_field_encode;
|
|
35
|
-
function $proto_field_decode(buf, offset) {
|
|
36
|
-
var _a = __read((0, _varint_1.$varint_decode_i32)(buf, offset), 2), tag = _a[0], o = _a[1];
|
|
37
|
-
var fieldNumber = tag >>> 3;
|
|
38
|
-
var wireType = tag & 7;
|
|
39
|
-
return [fieldNumber, wireType, o];
|
|
40
|
-
}
|
|
41
|
-
exports.$proto_field_decode = $proto_field_decode;
|
|
42
|
-
//# sourceMappingURL=$proto_field.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"$proto_field.js","sourceRoot":"","sources":["../../src/functional/$proto_field.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,qCAA+D;AAE/D,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC7B,qEAAU,CAAA;IACV,+DAAO,CAAA;IACP,+DAAO,CAAA;IACP,qEAAU,CAAA;IACV,qEAAU,CAAA;IACV,+DAAO,CAAA;AACX,CAAC,EAPW,qBAAqB,qCAArB,qBAAqB,QAOhC;AAED,SAAgB,mBAAmB,CAC/B,GAAe,EACf,MAAc,EACd,WAAmB,EACnB,QAA+B;IAE/B,IAAM,GAAG,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,IAAA,wBAAc,EAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC;AARD,kDAQC;AAED,SAAgB,mBAAmB,CAC/B,GAAe,EACf,MAAc;IAER,IAAA,KAAA,OAAW,IAAA,4BAAkB,EAAC,GAAG,EAAE,MAAM,CAAC,IAAA,EAAzC,GAAG,QAAA,EAAE,CAAC,QAAmC,CAAC;IACjD,IAAM,WAAW,GAAG,GAAG,KAAK,CAAC,CAAC;IAC9B,IAAM,QAAQ,GAAG,GAAG,GAAG,CAAK,CAAC;IAC7B,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC;AARD,kDAQC"}
|
|
@@ -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;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,MAAM,IAAI,CAAC,CAAC;IAEZ,OAAO,MAAM,CAAC;AAClB,CAAC;AAlBD,8CAkBC;AAED,SAAgB,iBAAiB,CAC7B,GAAe,EACf,MAAc;IAEd,IAAM,KAAK,GACP,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,MAAM,CAAC,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/$proto_size.ts"],"names":[],"mappings":";;;AAKA,SAAgB,kBAAkB,CAAC,CAAkB;IACjD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,EAAE;YACP,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAClC;QACD,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AATD,gDASC;AAED,SAAgB,iBAAiB,CAC7B,WAAmB,EACnB,QAA+B;IAE/B,IAAM,GAAG,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAND,8CAMC;AAED,SAAgB,iBAAiB,CAAC,GAAW;IACzC,OAAO,kBAAkB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACzC,CAAC;AAFD,8CAEC;AAED,IAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC,SAAgB,kBAAkB,CAAC,KAAa;IAE5C,IAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC;AAJD,gDAIC;AAED,SAAS,YAAY,CAAC,KAAa;IAC/B,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAI1B,IAAI,KAAK,IAAI,GAAG,EAAE;QACd,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,KAAK,EAAE;QACvB,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,OAAO,EAAE;QACzB,OAAO,CAAC,CAAC;KACZ;SAAM,IAAI,KAAK,IAAI,SAAS,EAAE;QAC3B,OAAO,CAAC,CAAC;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
|
-
}
|