@zlink-systems/framework-codec-protobuf 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/framework.cjs +12 -0
- package/package.json +4 -4
|
@@ -63,6 +63,12 @@ function encodeDynamicValue(value) {
|
|
|
63
63
|
encodeBytesField(4, Buffer.from(value))
|
|
64
64
|
]);
|
|
65
65
|
}
|
|
66
|
+
if (value instanceof Uint8Array) {
|
|
67
|
+
return encodeFields([
|
|
68
|
+
encodeVarintField(1, 6 /* Bytes */),
|
|
69
|
+
encodeBytesField(7, Buffer.from(value.buffer, value.byteOffset, value.byteLength))
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
66
72
|
if (Array.isArray(value)) {
|
|
67
73
|
return encodeFields([
|
|
68
74
|
encodeVarintField(1, 5 /* Array */),
|
|
@@ -82,6 +88,7 @@ function decodeDynamicValue(bytes) {
|
|
|
82
88
|
let boolValue = false;
|
|
83
89
|
let numberValue = 0;
|
|
84
90
|
let stringValue = "";
|
|
91
|
+
let bytesValue = Buffer.alloc(0);
|
|
85
92
|
const objectValue = {};
|
|
86
93
|
const arrayValue = [];
|
|
87
94
|
for (const field of readFields(bytes)) {
|
|
@@ -106,6 +113,9 @@ function decodeDynamicValue(bytes) {
|
|
|
106
113
|
case 6:
|
|
107
114
|
arrayValue.push(decodeDynamicValue(readBytesPayload(field)));
|
|
108
115
|
break;
|
|
116
|
+
case 7:
|
|
117
|
+
bytesValue = Buffer.from(readBytesPayload(field));
|
|
118
|
+
break;
|
|
109
119
|
default:
|
|
110
120
|
break;
|
|
111
121
|
}
|
|
@@ -123,6 +133,8 @@ function decodeDynamicValue(bytes) {
|
|
|
123
133
|
return objectValue;
|
|
124
134
|
case 5 /* Array */:
|
|
125
135
|
return arrayValue;
|
|
136
|
+
case 6 /* Bytes */:
|
|
137
|
+
return bytesValue;
|
|
126
138
|
default:
|
|
127
139
|
throw new Error(`Protobuf serializer cannot decode value kind '${kind}'.`);
|
|
128
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zlink-systems/framework-codec-protobuf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@zlink-systems/stream-wire": "0.
|
|
30
|
+
"@zlink-systems/stream-wire": "0.13.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@zlink-systems/framework": "0.
|
|
34
|
-
"@zlink-systems/stream-connector": "0.
|
|
33
|
+
"@zlink-systems/framework": "0.13.0",
|
|
34
|
+
"@zlink-systems/stream-connector": "0.13.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@zlink-systems/framework": {
|