typia 5.0.0-dev.20230814 → 5.0.0-dev.20230818
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 +33 -0
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/StatementFactory.d.ts +2 -0
- package/lib/factories/StatementFactory.js +11 -0
- package/lib/factories/StatementFactory.js.map +1 -1
- package/lib/functional/$ProtobufReader.d.ts +33 -0
- package/lib/functional/$ProtobufReader.js +155 -0
- package/lib/functional/$ProtobufReader.js.map +1 -0
- package/lib/functional/$ProtobufSizer.d.ts +36 -0
- package/lib/functional/$ProtobufSizer.js +105 -0
- package/lib/functional/$ProtobufSizer.js.map +1 -0
- package/lib/functional/$ProtobufWriter.d.ts +45 -0
- package/lib/functional/$ProtobufWriter.js +107 -0
- package/lib/functional/$ProtobufWriter.js.map +1 -0
- package/lib/functional/IProtobufWriter.d.ts +15 -0
- package/lib/functional/IProtobufWriter.js +3 -0
- package/lib/functional/IProtobufWriter.js.map +1 -0
- package/lib/functional/Namespace.js +13 -6
- package/lib/functional/Namespace.js.map +1 -1
- package/lib/programmers/FeatureProgrammer.js +2 -2
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/helpers/CloneJoiner.js +1 -7
- package/lib/programmers/helpers/CloneJoiner.js.map +1 -1
- package/lib/programmers/helpers/ProtobufWire.d.ts +16 -12
- package/lib/programmers/helpers/RandomRanger.js +1 -1
- package/lib/programmers/helpers/RandomRanger.js.map +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.js +3 -0
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +269 -127
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +8 -2
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
- package/lib/protobuf.js +23 -9
- package/lib/protobuf.js.map +1 -1
- package/lib/schemas/metadata/MetadataObject.js +4 -0
- package/lib/schemas/metadata/MetadataObject.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.js +0 -4
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/json/JsonApplicationTransformer.js +6 -3
- package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
- package/package.json +1 -1
- package/src/factories/ExpressionFactory.ts +20 -0
- package/src/factories/StatementFactory.ts +32 -0
- package/src/functional/$ProtobufReader.ts +189 -0
- package/src/functional/$ProtobufSizer.ts +144 -0
- package/src/functional/$ProtobufWriter.ts +152 -0
- package/src/functional/IProtobufWriter.ts +18 -0
- package/src/functional/Namespace.ts +14 -7
- package/src/programmers/FeatureProgrammer.ts +2 -2
- package/src/programmers/helpers/CloneJoiner.ts +1 -25
- package/src/programmers/helpers/ProtobufWire.ts +18 -12
- package/src/programmers/helpers/RandomRanger.ts +1 -1
- package/src/programmers/json/JsonStringifyProgrammer.ts +8 -0
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +544 -201
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +4 -1
- package/src/protobuf.ts +23 -29
- package/src/schemas/metadata/MetadataObject.ts +10 -0
- package/src/transformers/CallExpressionTransformer.ts +0 -4
- package/src/transformers/features/json/JsonApplicationTransformer.ts +12 -3
- package/lib/programmers/protobuf/ProtobufSizeProgrammer.d.ts +0 -5
- package/lib/programmers/protobuf/ProtobufSizeProgrammer.js +0 -409
- package/lib/programmers/protobuf/ProtobufSizeProgrammer.js.map +0 -1
- package/lib/transformers/features/protobuf/CreateProtobufSizeTransformer.d.ts +0 -3
- package/lib/transformers/features/protobuf/CreateProtobufSizeTransformer.js +0 -10
- package/lib/transformers/features/protobuf/CreateProtobufSizeTransformer.js.map +0 -1
- package/lib/transformers/features/protobuf/ProtobufSizeTransformer.d.ts +0 -3
- package/lib/transformers/features/protobuf/ProtobufSizeTransformer.js +0 -10
- package/lib/transformers/features/protobuf/ProtobufSizeTransformer.js.map +0 -1
- package/src/programmers/protobuf/ProtobufSizeProgrammer.ts +0 -716
- package/src/transformers/features/protobuf/CreateProtobufSizeTransformer.ts +0 -9
- package/src/transformers/features/protobuf/ProtobufSizeTransformer.ts +0 -9
|
@@ -8,4 +8,5 @@ export declare namespace ExpressionFactory {
|
|
|
8
8
|
}) => (input: ts.Expression) => ts.Expression;
|
|
9
9
|
const isInstanceOf: (type: string) => (input: ts.Expression) => ts.Expression;
|
|
10
10
|
const coalesce: (x: ts.Expression) => (y: ts.Expression) => ts.Expression;
|
|
11
|
+
const currying: (target: ts.Expression) => (parameters: ts.Expression[]) => ts.CallExpression;
|
|
11
12
|
}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -39,5 +50,27 @@ var ExpressionFactory;
|
|
|
39
50
|
return typescript_1.default.factory.createBinaryExpression(x, typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.QuestionQuestionToken), y);
|
|
40
51
|
};
|
|
41
52
|
};
|
|
53
|
+
ExpressionFactory.currying = function (target) { return function (parameters) {
|
|
54
|
+
var e_1, _a;
|
|
55
|
+
if (parameters.length === 0)
|
|
56
|
+
return typescript_1.default.factory.createCallExpression(target, undefined, undefined);
|
|
57
|
+
var prev = typescript_1.default.factory.createCallExpression(target, undefined, [parameters[0]]);
|
|
58
|
+
try {
|
|
59
|
+
for (var _b = __values(parameters.slice(1)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
60
|
+
var param = _c.value;
|
|
61
|
+
prev = typescript_1.default.factory.createCallExpression(prev, undefined, [
|
|
62
|
+
param,
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
67
|
+
finally {
|
|
68
|
+
try {
|
|
69
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
70
|
+
}
|
|
71
|
+
finally { if (e_1) throw e_1.error; }
|
|
72
|
+
}
|
|
73
|
+
return prev;
|
|
74
|
+
}; };
|
|
42
75
|
})(ExpressionFactory || (exports.ExpressionFactory = ExpressionFactory = {}));
|
|
43
76
|
//# sourceMappingURL=ExpressionFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpressionFactory.js","sourceRoot":"","sources":["../../src/factories/ExpressionFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,IAAiB,iBAAiB,CAuFjC;AAvFD,WAAiB,iBAAiB;IACjB,4BAAU,GAAG,UAAC,KAAoB;QAC3C,OAAA,oBAAE,CAAC,OAAO,CAAC,sBAAsB,CAC7B,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,EACxC,KAAK,CACR;IAHD,CAGC,CAAC;IAEO,yBAAO,GAAG,UAAC,KAAoB;QACxC,OAAA,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAC3B,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,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AAE,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EACvD,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CACpC,CAAC;QACN,CAAC;IAND,CAMC,CAAC;IAEO,0BAAQ,GACjB,UAAC,CAAgB;QACjB,OAAA,UAAC,CAAgB;YACb,OAAA,oBAAE,CAAC,OAAO,CAAC,sBAAsB,CAC7B,CAAC,EACD,oBAAE,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAC3D,CAAC,CACJ;QAJD,CAIC;IALL,CAKK,CAAC;IAEG,0BAAQ,GACjB,UAAC,MAAqB,IAAK,OAAA,UAAC,UAA2B;;QACnD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YACvB,OAAO,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAClC,MAAM,EACN,SAAS,EACT,SAAS,CACZ,CAAC;QACN,IAAI,IAAI,GAAsB,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CACzD,MAAM,EACN,SAAS,EACT,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,CACnB,CAAC;;YACF,KAAoB,IAAA,KAAA,SAAA,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,gBAAA;gBAAlC,IAAM,KAAK,WAAA;gBACZ,IAAI,GAAG,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE;oBACpD,KAAK;iBACR,CAAC,CAAC;aAAA;;;;;;;;;QACP,OAAO,IAAI,CAAC;IAChB,CAAC,EAjB0B,CAiB1B,CAAC;AACV,CAAC,EAvFgB,iBAAiB,iCAAjB,iBAAiB,QAuFjC"}
|
|
@@ -2,5 +2,7 @@ import ts from "typescript";
|
|
|
2
2
|
export declare namespace StatementFactory {
|
|
3
3
|
const mut: (name: string, initializer?: ts.Expression) => ts.VariableStatement;
|
|
4
4
|
const constant: (name: string, initializer?: ts.Expression) => ts.VariableStatement;
|
|
5
|
+
const entry: (key: string) => (value: string) => ts.VariableDeclarationList;
|
|
5
6
|
const transpile: (script: string) => ts.ExpressionStatement;
|
|
7
|
+
const block: (expression: ts.Expression) => ts.Block;
|
|
6
8
|
}
|
|
@@ -17,8 +17,19 @@ var StatementFactory;
|
|
|
17
17
|
typescript_1.default.factory.createVariableDeclaration(name, undefined, undefined, initializer),
|
|
18
18
|
], typescript_1.default.NodeFlags.Const));
|
|
19
19
|
};
|
|
20
|
+
StatementFactory.entry = function (key) { return function (value) {
|
|
21
|
+
return typescript_1.default.factory.createVariableDeclarationList([
|
|
22
|
+
typescript_1.default.factory.createVariableDeclaration(typescript_1.default.factory.createArrayBindingPattern([
|
|
23
|
+
typescript_1.default.factory.createBindingElement(undefined, undefined, typescript_1.default.factory.createIdentifier(key), undefined),
|
|
24
|
+
typescript_1.default.factory.createBindingElement(undefined, undefined, typescript_1.default.factory.createIdentifier(value), undefined),
|
|
25
|
+
]), undefined, undefined, undefined),
|
|
26
|
+
], typescript_1.default.NodeFlags.Const);
|
|
27
|
+
}; };
|
|
20
28
|
StatementFactory.transpile = function (script) {
|
|
21
29
|
return typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createIdentifier(typescript_1.default.transpile(script)));
|
|
22
30
|
};
|
|
31
|
+
StatementFactory.block = function (expression) {
|
|
32
|
+
return typescript_1.default.factory.createBlock([typescript_1.default.factory.createExpressionStatement(expression)], true);
|
|
33
|
+
};
|
|
23
34
|
})(StatementFactory || (exports.StatementFactory = StatementFactory = {}));
|
|
24
35
|
//# sourceMappingURL=StatementFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatementFactory.js","sourceRoot":"","sources":["../../src/factories/StatementFactory.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,IAAiB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"StatementFactory.js","sourceRoot":"","sources":["../../src/factories/Statement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Z;SACJ,EACD,oBAAE,CAAC,SAAS,CAAC,KAAK,CACrB;IAvBD,CAuBC,EAxBiC,CAwBjC,CAAC;IAEO,0BAAS,GAAG,UAAC,MAAc;QACpC,OAAA,oBAAE,CAAC,OAAO,CAAC,yBAAyB,CAChC,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,oBAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CACpD;IAFD,CAEC,CAAC;IAEO,sBAAK,GAAG,UAAC,UAAyB;QAC3C,OAAA,oBAAE,CAAC,OAAO,CAAC,WAAW,CAClB,CAAC,oBAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,EAClD,IAAI,CACP;IAHD,CAGC,CAAC;AACV,CAAC,EArEgB,gBAAgB,gCAAhB,gBAAgB,QAqEhC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ProtobufWire } from "../programmers/helpers/ProtobufWire";
|
|
2
|
+
export declare class $ProtobufReader {
|
|
3
|
+
/**
|
|
4
|
+
* Read buffer
|
|
5
|
+
*/
|
|
6
|
+
private buf;
|
|
7
|
+
/**
|
|
8
|
+
* Read buffer pointer.
|
|
9
|
+
*/
|
|
10
|
+
private ptr;
|
|
11
|
+
/**
|
|
12
|
+
* DataView for buffer.
|
|
13
|
+
*/
|
|
14
|
+
private view;
|
|
15
|
+
constructor(buf: Uint8Array);
|
|
16
|
+
uint32(): number;
|
|
17
|
+
int32(): number;
|
|
18
|
+
sint32(): number;
|
|
19
|
+
uint64(): bigint;
|
|
20
|
+
int64(): bigint;
|
|
21
|
+
sint64(): bigint;
|
|
22
|
+
bool(): boolean;
|
|
23
|
+
float(): number;
|
|
24
|
+
double(): number;
|
|
25
|
+
bytes(): Uint8Array;
|
|
26
|
+
string(): string;
|
|
27
|
+
skip(length: number): void;
|
|
28
|
+
skipType(wireType: ProtobufWire): void;
|
|
29
|
+
private varint32;
|
|
30
|
+
private varint64;
|
|
31
|
+
private u8;
|
|
32
|
+
private u8n;
|
|
33
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$ProtobufReader = void 0;
|
|
4
|
+
var $ProtobufReader = (function () {
|
|
5
|
+
function $ProtobufReader(buf) {
|
|
6
|
+
this.buf = buf;
|
|
7
|
+
this.ptr = 0;
|
|
8
|
+
this.view = new DataView(buf.buffer);
|
|
9
|
+
}
|
|
10
|
+
$ProtobufReader.prototype.uint32 = function () {
|
|
11
|
+
return this.varint32();
|
|
12
|
+
};
|
|
13
|
+
$ProtobufReader.prototype.int32 = function () {
|
|
14
|
+
return this.varint32();
|
|
15
|
+
};
|
|
16
|
+
$ProtobufReader.prototype.sint32 = function () {
|
|
17
|
+
var value = this.varint32();
|
|
18
|
+
return (value >>> 1) ^ -(value & 1);
|
|
19
|
+
};
|
|
20
|
+
$ProtobufReader.prototype.uint64 = function () {
|
|
21
|
+
return this.varint64();
|
|
22
|
+
};
|
|
23
|
+
$ProtobufReader.prototype.int64 = function () {
|
|
24
|
+
return this.varint64();
|
|
25
|
+
};
|
|
26
|
+
$ProtobufReader.prototype.sint64 = function () {
|
|
27
|
+
var value = this.varint64();
|
|
28
|
+
return (value >> N01) ^ -(value & N01);
|
|
29
|
+
};
|
|
30
|
+
$ProtobufReader.prototype.bool = function () {
|
|
31
|
+
return this.varint32() !== 0;
|
|
32
|
+
};
|
|
33
|
+
$ProtobufReader.prototype.float = function () {
|
|
34
|
+
var value = this.view.getFloat32(this.ptr, true);
|
|
35
|
+
this.ptr += 4;
|
|
36
|
+
return value;
|
|
37
|
+
};
|
|
38
|
+
$ProtobufReader.prototype.double = function () {
|
|
39
|
+
var value = this.view.getFloat64(this.ptr, true);
|
|
40
|
+
this.ptr += 8;
|
|
41
|
+
return value;
|
|
42
|
+
};
|
|
43
|
+
$ProtobufReader.prototype.bytes = function () {
|
|
44
|
+
var length = this.uint32();
|
|
45
|
+
return this.buf.subarray(this.ptr, (this.ptr += length));
|
|
46
|
+
};
|
|
47
|
+
$ProtobufReader.prototype.string = function () {
|
|
48
|
+
return utf8.decode(this.bytes());
|
|
49
|
+
};
|
|
50
|
+
$ProtobufReader.prototype.skip = function (length) {
|
|
51
|
+
if (length === 0)
|
|
52
|
+
while (this.u8() & 0x80)
|
|
53
|
+
;
|
|
54
|
+
else
|
|
55
|
+
this.ptr += length;
|
|
56
|
+
};
|
|
57
|
+
$ProtobufReader.prototype.skipType = function (wireType) {
|
|
58
|
+
switch (wireType) {
|
|
59
|
+
case 0:
|
|
60
|
+
this.skip(0);
|
|
61
|
+
break;
|
|
62
|
+
case 1:
|
|
63
|
+
this.skip(8);
|
|
64
|
+
break;
|
|
65
|
+
case 2:
|
|
66
|
+
this.skip(this.uint32());
|
|
67
|
+
break;
|
|
68
|
+
case 3:
|
|
69
|
+
while ((wireType = this.uint32() & 0x07) !== 4)
|
|
70
|
+
this.skipType(wireType);
|
|
71
|
+
break;
|
|
72
|
+
case 5:
|
|
73
|
+
this.skip(4);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
throw new Error("Invalid wire type " + wireType.toString());
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
$ProtobufReader.prototype.varint32 = function () {
|
|
80
|
+
var loaded;
|
|
81
|
+
var value;
|
|
82
|
+
value = (loaded = this.u8()) & 0x7f;
|
|
83
|
+
if (loaded < 0x80)
|
|
84
|
+
return value;
|
|
85
|
+
value |= ((loaded = this.u8()) & 0x7f) << 7;
|
|
86
|
+
if (loaded < 0x80)
|
|
87
|
+
return value;
|
|
88
|
+
value |= ((loaded = this.u8()) & 0x7f) << 14;
|
|
89
|
+
if (loaded < 0x80)
|
|
90
|
+
return value;
|
|
91
|
+
value |= ((loaded = this.u8()) & 0x7f) << 21;
|
|
92
|
+
if (loaded < 0x80)
|
|
93
|
+
return value;
|
|
94
|
+
value |= ((loaded = this.u8()) & 0xf) << 28;
|
|
95
|
+
if (loaded < 0x80)
|
|
96
|
+
return value;
|
|
97
|
+
if (this.u8() < 0x80)
|
|
98
|
+
return value;
|
|
99
|
+
if (this.u8() < 0x80)
|
|
100
|
+
return value;
|
|
101
|
+
if (this.u8() < 0x80)
|
|
102
|
+
return value;
|
|
103
|
+
if (this.u8() < 0x80)
|
|
104
|
+
return value;
|
|
105
|
+
if (this.u8() < 0x80)
|
|
106
|
+
return value;
|
|
107
|
+
return value;
|
|
108
|
+
};
|
|
109
|
+
$ProtobufReader.prototype.varint64 = function () {
|
|
110
|
+
var loaded;
|
|
111
|
+
var value;
|
|
112
|
+
value = (loaded = this.u8n()) & N7F;
|
|
113
|
+
if (loaded < N80)
|
|
114
|
+
return value;
|
|
115
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(7);
|
|
116
|
+
if (loaded < N80)
|
|
117
|
+
return value;
|
|
118
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(14);
|
|
119
|
+
if (loaded < N80)
|
|
120
|
+
return value;
|
|
121
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(21);
|
|
122
|
+
if (loaded < N80)
|
|
123
|
+
return value;
|
|
124
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(28);
|
|
125
|
+
if (loaded < N80)
|
|
126
|
+
return value;
|
|
127
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(35);
|
|
128
|
+
if (loaded < N80)
|
|
129
|
+
return value;
|
|
130
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(42);
|
|
131
|
+
if (loaded < N80)
|
|
132
|
+
return value;
|
|
133
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(49);
|
|
134
|
+
if (loaded < N80)
|
|
135
|
+
return value;
|
|
136
|
+
value |= ((loaded = this.u8n()) & N7F) << BigInt(56);
|
|
137
|
+
if (loaded < N80)
|
|
138
|
+
return value;
|
|
139
|
+
value |= (this.u8n() & N01) << BigInt(63);
|
|
140
|
+
return value;
|
|
141
|
+
};
|
|
142
|
+
$ProtobufReader.prototype.u8 = function () {
|
|
143
|
+
return this.view.getUint8(this.ptr++);
|
|
144
|
+
};
|
|
145
|
+
$ProtobufReader.prototype.u8n = function () {
|
|
146
|
+
return BigInt(this.u8());
|
|
147
|
+
};
|
|
148
|
+
return $ProtobufReader;
|
|
149
|
+
}());
|
|
150
|
+
exports.$ProtobufReader = $ProtobufReader;
|
|
151
|
+
var utf8 = new TextDecoder();
|
|
152
|
+
var N01 = BigInt(0x01);
|
|
153
|
+
var N7F = BigInt(0x7f);
|
|
154
|
+
var N80 = BigInt(0x80);
|
|
155
|
+
//# sourceMappingURL=$ProtobufReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"$ProtobufReader.js","sourceRoot":"","sources":["../../src/functional/$ProtobufReader.ts"],"names":[],"mappings":";;;AAEA;IAgBI,yBAAmB,GAAe;QAC9B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAQM,gCAAM,GAAb;QACI,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,+BAAK,GAAZ;QACI,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,gCAAM,GAAb;QACI,IAAM,KAAK,GAAW,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtC,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACxC,CAAC;IAEM,gCAAM,GAAb;QACI,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,+BAAK,GAAZ;QACI,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,gCAAM,GAAb;QACI,IAAM,KAAK,GAAG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AAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;IACL,sBAAC;AAAD,CAAC,AArLD,IAqLC;AArLY,0CAAe;AAuL5B,IAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAC/B,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,IAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IProtobufWriter } from "./IProtobufWriter";
|
|
2
|
+
export declare class $ProtobufSizer implements IProtobufWriter {
|
|
3
|
+
/**
|
|
4
|
+
* Total length.
|
|
5
|
+
*/
|
|
6
|
+
len: number;
|
|
7
|
+
/**
|
|
8
|
+
* Position stack.
|
|
9
|
+
*/
|
|
10
|
+
readonly pos: Array<number>;
|
|
11
|
+
/**
|
|
12
|
+
* Variable length list.
|
|
13
|
+
*/
|
|
14
|
+
readonly varlen: Array<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Variable length index stack.
|
|
17
|
+
*/
|
|
18
|
+
readonly varlenidx: Array<number>;
|
|
19
|
+
constructor(length?: number);
|
|
20
|
+
bool(): void;
|
|
21
|
+
int32(value: number): void;
|
|
22
|
+
sint32(value: number): void;
|
|
23
|
+
uint32(value: number): void;
|
|
24
|
+
int64(value: bigint | number): void;
|
|
25
|
+
sint64(value: bigint | number): void;
|
|
26
|
+
uint64(value: bigint | number): void;
|
|
27
|
+
float(_value: number): void;
|
|
28
|
+
double(_value: number): void;
|
|
29
|
+
bytes(value: Uint8Array): void;
|
|
30
|
+
string(value: string): void;
|
|
31
|
+
fork(): void;
|
|
32
|
+
ldelim(): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
private varint32;
|
|
35
|
+
private varint64;
|
|
36
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$ProtobufSizer = void 0;
|
|
4
|
+
var _strlen_1 = require("./$strlen");
|
|
5
|
+
var $ProtobufSizer = (function () {
|
|
6
|
+
function $ProtobufSizer(length) {
|
|
7
|
+
if (length === void 0) { length = 0; }
|
|
8
|
+
this.len = length;
|
|
9
|
+
this.pos = [];
|
|
10
|
+
this.varlen = [];
|
|
11
|
+
this.varlenidx = [];
|
|
12
|
+
}
|
|
13
|
+
$ProtobufSizer.prototype.bool = function () {
|
|
14
|
+
this.len += 1;
|
|
15
|
+
};
|
|
16
|
+
$ProtobufSizer.prototype.int32 = function (value) {
|
|
17
|
+
if (value < 0) {
|
|
18
|
+
this.len += 10;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.varint32(value);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
$ProtobufSizer.prototype.sint32 = function (value) {
|
|
25
|
+
this.varint32((value << 1) ^ (value >> 31));
|
|
26
|
+
};
|
|
27
|
+
$ProtobufSizer.prototype.uint32 = function (value) {
|
|
28
|
+
this.varint32(value);
|
|
29
|
+
};
|
|
30
|
+
$ProtobufSizer.prototype.int64 = function (value) {
|
|
31
|
+
this.varint64(typeof value === "number" ? BigInt(value) : value);
|
|
32
|
+
};
|
|
33
|
+
$ProtobufSizer.prototype.sint64 = function (value) {
|
|
34
|
+
if (typeof value === "number")
|
|
35
|
+
value = BigInt(value);
|
|
36
|
+
this.varint64((value << BigInt(1)) ^ (value >> BigInt(63)));
|
|
37
|
+
};
|
|
38
|
+
$ProtobufSizer.prototype.uint64 = function (value) {
|
|
39
|
+
this.varint64(typeof value === "number" ? BigInt(value) : value);
|
|
40
|
+
};
|
|
41
|
+
$ProtobufSizer.prototype.float = function (_value) {
|
|
42
|
+
this.len += 4;
|
|
43
|
+
};
|
|
44
|
+
$ProtobufSizer.prototype.double = function (_value) {
|
|
45
|
+
this.len += 8;
|
|
46
|
+
};
|
|
47
|
+
$ProtobufSizer.prototype.bytes = function (value) {
|
|
48
|
+
this.uint32(value.byteLength);
|
|
49
|
+
this.len += value.byteLength;
|
|
50
|
+
};
|
|
51
|
+
$ProtobufSizer.prototype.string = function (value) {
|
|
52
|
+
var len = (0, _strlen_1.$strlen)(value);
|
|
53
|
+
this.varlen.push(len);
|
|
54
|
+
this.uint32(len);
|
|
55
|
+
this.len += len;
|
|
56
|
+
};
|
|
57
|
+
$ProtobufSizer.prototype.fork = function () {
|
|
58
|
+
this.pos.push(this.len);
|
|
59
|
+
this.varlenidx.push(this.varlen.length);
|
|
60
|
+
this.varlen.push(0);
|
|
61
|
+
};
|
|
62
|
+
$ProtobufSizer.prototype.ldelim = function () {
|
|
63
|
+
if (!(this.pos.length && this.varlenidx.length))
|
|
64
|
+
throw new Error("Missing fork() before ldelim() call.");
|
|
65
|
+
var endPos = this.len;
|
|
66
|
+
var startPos = this.pos.pop();
|
|
67
|
+
var idx = this.varlenidx.pop();
|
|
68
|
+
var len = endPos - startPos;
|
|
69
|
+
this.varlen[idx] = len;
|
|
70
|
+
this.uint32(len);
|
|
71
|
+
};
|
|
72
|
+
$ProtobufSizer.prototype.reset = function () {
|
|
73
|
+
this.len = 0;
|
|
74
|
+
this.pos.length = 0;
|
|
75
|
+
this.varlen.length = 0;
|
|
76
|
+
this.varlenidx.length = 0;
|
|
77
|
+
};
|
|
78
|
+
$ProtobufSizer.prototype.varint32 = function (value) {
|
|
79
|
+
this.len +=
|
|
80
|
+
value < 0
|
|
81
|
+
? 10
|
|
82
|
+
: value < 0x80
|
|
83
|
+
? 1
|
|
84
|
+
: value < 0x4000
|
|
85
|
+
? 2
|
|
86
|
+
: value < 0x200000
|
|
87
|
+
? 3
|
|
88
|
+
: value < 0x10000000
|
|
89
|
+
? 4
|
|
90
|
+
: 5;
|
|
91
|
+
};
|
|
92
|
+
$ProtobufSizer.prototype.varint64 = function (val) {
|
|
93
|
+
val = BigInt.asUintN(64, val);
|
|
94
|
+
while (val > NX7F) {
|
|
95
|
+
++this.len;
|
|
96
|
+
val = val >> ND07;
|
|
97
|
+
}
|
|
98
|
+
++this.len;
|
|
99
|
+
};
|
|
100
|
+
return $ProtobufSizer;
|
|
101
|
+
}());
|
|
102
|
+
exports.$ProtobufSizer = $ProtobufSizer;
|
|
103
|
+
var ND07 = BigInt(7);
|
|
104
|
+
var NX7F = BigInt(0x7f);
|
|
105
|
+
//# sourceMappingURL=$ProtobufSizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"$ProtobufSizer.js","sourceRoot":"","sources":["../../src/functional/$ProtobufSizer.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAGpC;IAqBI,wBAAmB,MAAkB;QAAlB,uBAAA,EAAA,UAAkB;QACjC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;QAClB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;IAEM,6BAAI,GAAX;QACI,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAClB,CAAC;IACM,8BAAK,GAAZ,UAAa,KAAa;QACtB,IAAI,KAAK,GAAG,CAAC,EAAE;YAEX,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;SAClB;aAAM;YACH,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;IACL,CAAC;IACM,+BAAM,GAAb,UAAc,KAAa;QACvB,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IACM,+BAAM,GAAb,UAAc,KAAa;QACvB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAEM,8BAAK,GAAZ,UAAa,KAAsB;QAC/B,IAAI,CAAC,QAAQ,CAAC,OAAO,KAAK,K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AAG,UAAU;gCACpB,CAAC,CAAC,CAAC;gCACH,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;IAEO,iCAAQ,GAAhB,UAAiB,GAAW;QACxB,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAC9B,OAAO,GAAG,GAAG,IAAI,EAAE;YACf,EAAE,IAAI,CAAC,GAAG,CAAC;YACX,GAAG,GAAG,GAAG,IAAI,IAAI,CAAC;SACrB;QACD,EAAE,IAAI,CAAC,GAAG,CAAC;IACf,CAAC;IACL,qBAAC;AAAD,CAAC,AAzID,IAyIC;AAzIY,wCAAc;AA2I3B,IAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { $ProtobufSizer } from "./$ProtobufSizer";
|
|
2
|
+
import { IProtobufWriter } from "./IProtobufWriter";
|
|
3
|
+
export declare class $ProtobufWriter implements IProtobufWriter {
|
|
4
|
+
/**
|
|
5
|
+
* Related sizer
|
|
6
|
+
*/
|
|
7
|
+
private readonly sizer;
|
|
8
|
+
/**
|
|
9
|
+
* Current pointer.
|
|
10
|
+
*/
|
|
11
|
+
private ptr;
|
|
12
|
+
/**
|
|
13
|
+
* Protobuf buffer.
|
|
14
|
+
*/
|
|
15
|
+
private buf;
|
|
16
|
+
/**
|
|
17
|
+
* DataView for buffer.
|
|
18
|
+
*/
|
|
19
|
+
private view;
|
|
20
|
+
/**
|
|
21
|
+
* Index in varlen array from sizer.
|
|
22
|
+
*/
|
|
23
|
+
private varlenidx;
|
|
24
|
+
constructor(sizer: $ProtobufSizer);
|
|
25
|
+
buffer(): Uint8Array;
|
|
26
|
+
bool(value: boolean): void;
|
|
27
|
+
byte(value: number): void;
|
|
28
|
+
int32(value: number): void;
|
|
29
|
+
sint32(value: number): void;
|
|
30
|
+
uint32(value: number): void;
|
|
31
|
+
sint64(value: number | bigint): void;
|
|
32
|
+
int64(value: number | bigint): void;
|
|
33
|
+
uint64(value: number | bigint): void;
|
|
34
|
+
float(val: number): void;
|
|
35
|
+
double(val: number): void;
|
|
36
|
+
bytes(value: Uint8Array): void;
|
|
37
|
+
string(value: string): void;
|
|
38
|
+
fork(): void;
|
|
39
|
+
ldelim(): void;
|
|
40
|
+
finish(): Uint8Array;
|
|
41
|
+
reset(): void;
|
|
42
|
+
private variant32;
|
|
43
|
+
private variant64;
|
|
44
|
+
private varlen;
|
|
45
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$ProtobufWriter = void 0;
|
|
4
|
+
var $ProtobufWriter = (function () {
|
|
5
|
+
function $ProtobufWriter(sizer) {
|
|
6
|
+
this.sizer = sizer;
|
|
7
|
+
this.buf = new Uint8Array(sizer.len);
|
|
8
|
+
this.view = new DataView(this.buf.buffer);
|
|
9
|
+
this.ptr = 0;
|
|
10
|
+
this.varlenidx = 0;
|
|
11
|
+
}
|
|
12
|
+
$ProtobufWriter.prototype.buffer = function () {
|
|
13
|
+
return this.buf;
|
|
14
|
+
};
|
|
15
|
+
$ProtobufWriter.prototype.bool = function (value) {
|
|
16
|
+
this.byte(value ? 1 : 0);
|
|
17
|
+
};
|
|
18
|
+
$ProtobufWriter.prototype.byte = function (value) {
|
|
19
|
+
this.buf[this.ptr++] = value & 255;
|
|
20
|
+
};
|
|
21
|
+
$ProtobufWriter.prototype.int32 = function (value) {
|
|
22
|
+
if (value < 0)
|
|
23
|
+
this.int64(value);
|
|
24
|
+
else
|
|
25
|
+
this.variant32(value >>> 0);
|
|
26
|
+
};
|
|
27
|
+
$ProtobufWriter.prototype.sint32 = function (value) {
|
|
28
|
+
this.variant32((value << 1) ^ (value >> 31));
|
|
29
|
+
};
|
|
30
|
+
$ProtobufWriter.prototype.uint32 = function (value) {
|
|
31
|
+
this.variant32(value);
|
|
32
|
+
};
|
|
33
|
+
$ProtobufWriter.prototype.sint64 = function (value) {
|
|
34
|
+
value = BigInt(value);
|
|
35
|
+
this.variant64((value << ND01) ^ (value >> ND63));
|
|
36
|
+
};
|
|
37
|
+
$ProtobufWriter.prototype.int64 = function (value) {
|
|
38
|
+
this.variant64(BigInt(value));
|
|
39
|
+
};
|
|
40
|
+
$ProtobufWriter.prototype.uint64 = function (value) {
|
|
41
|
+
this.variant64(BigInt(value));
|
|
42
|
+
};
|
|
43
|
+
$ProtobufWriter.prototype.float = function (val) {
|
|
44
|
+
this.view.setFloat32(this.ptr, val, true);
|
|
45
|
+
this.ptr += 4;
|
|
46
|
+
};
|
|
47
|
+
$ProtobufWriter.prototype.double = function (val) {
|
|
48
|
+
this.view.setFloat64(this.ptr, val, true);
|
|
49
|
+
this.ptr += 8;
|
|
50
|
+
};
|
|
51
|
+
$ProtobufWriter.prototype.bytes = function (value) {
|
|
52
|
+
this.fork();
|
|
53
|
+
this.uint32(value.byteLength);
|
|
54
|
+
for (var i = 0; i < value.byteLength; i++)
|
|
55
|
+
this.buf[this.ptr++] = value[i];
|
|
56
|
+
};
|
|
57
|
+
$ProtobufWriter.prototype.string = function (value) {
|
|
58
|
+
var len = this.varlen();
|
|
59
|
+
this.uint32(len);
|
|
60
|
+
var binary = utf8.encode(value);
|
|
61
|
+
for (var i = 0; i < binary.byteLength; i++)
|
|
62
|
+
this.buf[this.ptr++] = binary[i];
|
|
63
|
+
};
|
|
64
|
+
$ProtobufWriter.prototype.fork = function () {
|
|
65
|
+
this.uint32(this.varlen());
|
|
66
|
+
};
|
|
67
|
+
$ProtobufWriter.prototype.ldelim = function () {
|
|
68
|
+
};
|
|
69
|
+
$ProtobufWriter.prototype.finish = function () {
|
|
70
|
+
return this.buf;
|
|
71
|
+
};
|
|
72
|
+
$ProtobufWriter.prototype.reset = function () {
|
|
73
|
+
this.buf = new Uint8Array(this.sizer.len);
|
|
74
|
+
this.view = new DataView(this.buf.buffer);
|
|
75
|
+
this.ptr = 0;
|
|
76
|
+
this.varlenidx = 0;
|
|
77
|
+
};
|
|
78
|
+
$ProtobufWriter.prototype.variant32 = function (val) {
|
|
79
|
+
while (val > 0x7f) {
|
|
80
|
+
this.buf[this.ptr++] = (val & 0x7f) | 0x80;
|
|
81
|
+
val = val >>> 7;
|
|
82
|
+
}
|
|
83
|
+
this.buf[this.ptr++] = val;
|
|
84
|
+
};
|
|
85
|
+
$ProtobufWriter.prototype.variant64 = function (val) {
|
|
86
|
+
val = BigInt.asUintN(64, val);
|
|
87
|
+
while (val > NX7F) {
|
|
88
|
+
this.buf[this.ptr++] = Number((val & NX7F) | NX80);
|
|
89
|
+
val = val >> ND07;
|
|
90
|
+
}
|
|
91
|
+
this.buf[this.ptr++] = Number(val);
|
|
92
|
+
};
|
|
93
|
+
$ProtobufWriter.prototype.varlen = function () {
|
|
94
|
+
return this.varlenidx >= this.sizer.varlen.length
|
|
95
|
+
? 0
|
|
96
|
+
: this.sizer.varlen[this.varlenidx++];
|
|
97
|
+
};
|
|
98
|
+
return $ProtobufWriter;
|
|
99
|
+
}());
|
|
100
|
+
exports.$ProtobufWriter = $ProtobufWriter;
|
|
101
|
+
var utf8 = new TextEncoder();
|
|
102
|
+
var ND01 = BigInt(1);
|
|
103
|
+
var ND07 = BigInt(7);
|
|
104
|
+
var ND63 = BigInt(63);
|
|
105
|
+
var NX7F = BigInt(0x7f);
|
|
106
|
+
var NX80 = BigInt(0x80);
|
|
107
|
+
//# sourceMappingURL=$ProtobufWriter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"$ProtobufWriter.js","sourceRoot":"","sources":["../../src/functional/$ProtobufWriter.ts"],"names":[],"mappings":";;;AAGA;IA0BI,yBAAY,KAAqB;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC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,gCAAM,GAAd;QACI,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;YAC7C,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAE,CAAC;IAC/C,CAAC;IACL,sBAAC;AAAD,CAAC,AA5ID,IA4IC;AA5IY,0CAAe;AA8I5B,IAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAE/B,IAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,IAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,IAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACxB,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
int64(value: bigint | number): void;
|
|
7
|
+
sint64(value: bigint | number): void;
|
|
8
|
+
uint64(value: bigint | number): void;
|
|
9
|
+
float(value: number): void;
|
|
10
|
+
double(value: number): void;
|
|
11
|
+
bytes(value: Uint8Array): void;
|
|
12
|
+
string(value: string): void;
|
|
13
|
+
fork(): void;
|
|
14
|
+
ldelim(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProtobufWriter.js","sourceRoot":"","sources":["../../src/functional/IProtobufWriter.ts"],"names":[],"mappings":""}
|