@bufbuild/protobuf 2.6.1 → 2.6.3
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/cjs/from-binary.js
CHANGED
|
@@ -129,7 +129,11 @@ function readMapEntry(reader, map, options) {
|
|
|
129
129
|
const field = map.field();
|
|
130
130
|
let key;
|
|
131
131
|
let val;
|
|
132
|
-
|
|
132
|
+
// Read the length of the map entry, which is a varint.
|
|
133
|
+
const len = reader.uint32();
|
|
134
|
+
// WARNING: Calculate end AFTER advancing reader.pos (above), so that
|
|
135
|
+
// reader.pos is at the start of the map entry.
|
|
136
|
+
const end = reader.pos + len;
|
|
133
137
|
while (reader.pos < end) {
|
|
134
138
|
const [fieldNo] = reader.tag();
|
|
135
139
|
switch (fieldNo) {
|
|
@@ -53,5 +53,5 @@ function timestampFromMs(timestampMs) {
|
|
|
53
53
|
* Convert a google.protobuf.Timestamp to a Unix timestamp in milliseconds.
|
|
54
54
|
*/
|
|
55
55
|
function timestampMs(timestamp) {
|
|
56
|
-
return (Number(timestamp.seconds) * 1000 + Math.
|
|
56
|
+
return (Number(timestamp.seconds) * 1000 + Math.round(timestamp.nanos / 1000000));
|
|
57
57
|
}
|
package/dist/esm/from-binary.js
CHANGED
|
@@ -124,7 +124,11 @@ function readMapEntry(reader, map, options) {
|
|
|
124
124
|
const field = map.field();
|
|
125
125
|
let key;
|
|
126
126
|
let val;
|
|
127
|
-
|
|
127
|
+
// Read the length of the map entry, which is a varint.
|
|
128
|
+
const len = reader.uint32();
|
|
129
|
+
// WARNING: Calculate end AFTER advancing reader.pos (above), so that
|
|
130
|
+
// reader.pos is at the start of the map entry.
|
|
131
|
+
const end = reader.pos + len;
|
|
128
132
|
while (reader.pos < end) {
|
|
129
133
|
const [fieldNo] = reader.tag();
|
|
130
134
|
switch (fieldNo) {
|
|
@@ -46,5 +46,5 @@ export function timestampFromMs(timestampMs) {
|
|
|
46
46
|
* Convert a google.protobuf.Timestamp to a Unix timestamp in milliseconds.
|
|
47
47
|
*/
|
|
48
48
|
export function timestampMs(timestamp) {
|
|
49
|
-
return (Number(timestamp.seconds) * 1000 + Math.
|
|
49
|
+
return (Number(timestamp.seconds) * 1000 + Math.round(timestamp.nanos / 1000000));
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bufbuild/protobuf",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"license": "(Apache-2.0 AND BSD-3-Clause)",
|
|
5
5
|
"description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.",
|
|
6
6
|
"keywords": ["protobuf", "schema", "typescript", "ecmascript"],
|