@bufbuild/protobuf 2.2.4 → 2.2.5
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/extensions.js
CHANGED
|
@@ -47,7 +47,7 @@ function getExtension(message, extension) {
|
|
|
47
47
|
const [container, field, get] = createExtensionContainer(extension);
|
|
48
48
|
for (const uf of ufs) {
|
|
49
49
|
(0, from_binary_js_1.readField)(container, new binary_encoding_js_1.BinaryReader(uf.data), field, uf.wireType, {
|
|
50
|
-
readUnknownFields:
|
|
50
|
+
readUnknownFields: true,
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
return get();
|
|
@@ -64,7 +64,7 @@ function setExtension(message, extension, value) {
|
|
|
64
64
|
const ufs = ((_a = message.$unknown) !== null && _a !== void 0 ? _a : []).filter((uf) => uf.no !== extension.number);
|
|
65
65
|
const [container, field] = createExtensionContainer(extension, value);
|
|
66
66
|
const writer = new binary_encoding_js_1.BinaryWriter();
|
|
67
|
-
(0, to_binary_js_1.writeField)(writer, { writeUnknownFields:
|
|
67
|
+
(0, to_binary_js_1.writeField)(writer, { writeUnknownFields: true }, container, field);
|
|
68
68
|
const reader = new binary_encoding_js_1.BinaryReader(writer.finish());
|
|
69
69
|
while (reader.pos < reader.len) {
|
|
70
70
|
const [no, wireType] = reader.tag();
|
|
@@ -43,9 +43,10 @@ function timestampDate(timestamp) {
|
|
|
43
43
|
* Create a google.protobuf.Timestamp message from a Unix timestamp in milliseconds.
|
|
44
44
|
*/
|
|
45
45
|
function timestampFromMs(timestampMs) {
|
|
46
|
+
const seconds = Math.floor(timestampMs / 1000);
|
|
46
47
|
return (0, create_js_1.create)(timestamp_pb_js_1.TimestampSchema, {
|
|
47
|
-
seconds: proto_int64_js_1.protoInt64.parse(
|
|
48
|
-
nanos: (timestampMs
|
|
48
|
+
seconds: proto_int64_js_1.protoInt64.parse(seconds),
|
|
49
|
+
nanos: (timestampMs - seconds * 1000) * 1000000,
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
/**
|
package/dist/esm/extensions.js
CHANGED
|
@@ -38,7 +38,7 @@ export function getExtension(message, extension) {
|
|
|
38
38
|
const [container, field, get] = createExtensionContainer(extension);
|
|
39
39
|
for (const uf of ufs) {
|
|
40
40
|
readField(container, new BinaryReader(uf.data), field, uf.wireType, {
|
|
41
|
-
readUnknownFields:
|
|
41
|
+
readUnknownFields: true,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
return get();
|
|
@@ -55,7 +55,7 @@ export function setExtension(message, extension, value) {
|
|
|
55
55
|
const ufs = ((_a = message.$unknown) !== null && _a !== void 0 ? _a : []).filter((uf) => uf.no !== extension.number);
|
|
56
56
|
const [container, field] = createExtensionContainer(extension, value);
|
|
57
57
|
const writer = new BinaryWriter();
|
|
58
|
-
writeField(writer, { writeUnknownFields:
|
|
58
|
+
writeField(writer, { writeUnknownFields: true }, container, field);
|
|
59
59
|
const reader = new BinaryReader(writer.finish());
|
|
60
60
|
while (reader.pos < reader.len) {
|
|
61
61
|
const [no, wireType] = reader.tag();
|
|
@@ -36,9 +36,10 @@ export function timestampDate(timestamp) {
|
|
|
36
36
|
* Create a google.protobuf.Timestamp message from a Unix timestamp in milliseconds.
|
|
37
37
|
*/
|
|
38
38
|
export function timestampFromMs(timestampMs) {
|
|
39
|
+
const seconds = Math.floor(timestampMs / 1000);
|
|
39
40
|
return create(TimestampSchema, {
|
|
40
|
-
seconds: protoInt64.parse(
|
|
41
|
-
nanos: (timestampMs
|
|
41
|
+
seconds: protoInt64.parse(seconds),
|
|
42
|
+
nanos: (timestampMs - seconds * 1000) * 1000000,
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
/**
|
package/package.json
CHANGED