Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

proto3-json-serializer

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proto3-json-serializer - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

22

build/src/toproto3json.js

@@ -26,5 +26,13 @@ "use strict";

const fieldmask_1 = require("./fieldmask");
const id = (x) => {
return x;
};
// Convert a single value, which might happen to be an instance of Long, to JSONValue
function convertSingleValue(value) {
var _a;
if (typeof value === 'object') {
if (((_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Long') {
return value.toString();
}
throw new Error(`toProto3JSON: don't know how to convert value ${value}`);
}
return value;
}
function toProto3JSON(obj, options) {

@@ -84,3 +92,3 @@ const objType = obj.$type;

}
: id);
: convertSingleValue);
continue;

@@ -94,3 +102,3 @@ }

? toProto3JSON(mapValue, options)
: mapValue;
: convertSingleValue(mapValue);
}

@@ -132,5 +140,3 @@ result[key] = map;

}
// The remaining case is Long, everything else is an internal error
(0, util_1.assert)(value.constructor.name === 'Long', `toProto3JSON: don't know how to convert field ${key} with value ${value}`);
result[key] = value.toString();
result[key] = convertSingleValue(value);
continue;

@@ -137,0 +143,0 @@ }

# Changelog
## [2.0.2](https://github.com/googleapis/proto3-json-serializer-nodejs/compare/v2.0.1...v2.0.2) (2024-05-22)
### Bug Fixes
* Properly convert repeated int64 and maps of int64 ([#96](https://github.com/googleapis/proto3-json-serializer-nodejs/issues/96)) ([1ec05fb](https://github.com/googleapis/proto3-json-serializer-nodejs/commit/1ec05fb59edfdff7531b9372dcfe14c0fe36562c))
## [2.0.1](https://github.com/googleapis/proto3-json-serializer-nodejs/compare/v2.0.0...v2.0.1) (2024-01-16)

@@ -4,0 +11,0 @@

{
"name": "proto3-json-serializer",
"version": "2.0.1",
"version": "2.0.2",
"repository": "googleapis/proto3-json-serializer-nodejs",

@@ -53,2 +53,3 @@ "description": "Support for proto3 JSON serialiazation/deserialization for protobuf.js",

"pack-n-play": "^2.0.0",
"protobufjs-cli": "^1.1.2",
"typescript": "^4.6.4"

@@ -55,0 +56,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc