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 0.1.8 to 0.1.9

5

build/src/fromproto3json.js

@@ -17,3 +17,2 @@ "use strict";

exports.fromProto3JSON = exports.fromProto3JSONToInternalRepresentation = void 0;
const assert = require("assert");
const any_1 = require("./any");

@@ -142,3 +141,3 @@ const bytes_1 = require("./bytes");

// Message type
assert(resolvedType, `Expected to be able to resolve type for field ${field.name}`);
(0, util_1.assert)(resolvedType !== null, `Expected to be able to resolve type for field ${field.name}`);
const deserializedValue = fromProto3JSONToInternalRepresentation(resolvedType, value);

@@ -157,3 +156,3 @@ result[key] = deserializedValue;

// We only expect a real object here sine all special cases should be already resolved. Everything else is an internal error
assert(typeof internalRepr === 'object' && !Array.isArray(internalRepr), `fromProto3JSON: expected an object, not ${json}`);
(0, util_1.assert)(typeof internalRepr === 'object' && !Array.isArray(internalRepr), `fromProto3JSON: expected an object, not ${json}`);
return type.fromObject(internalRepr);

@@ -160,0 +159,0 @@ }

3

build/src/toproto3json.js

@@ -17,3 +17,2 @@ "use strict";

exports.toProto3JSON = void 0;
const assert = require("assert");
const any_1 = require("./any");

@@ -127,3 +126,3 @@ const bytes_1 = require("./bytes");

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

@@ -130,0 +129,0 @@ continue;

export declare function getFullyQualifiedTypeName(type: protobuf.Type | protobuf.Namespace | protobuf.Enum): string;
export declare const wrapperTypes: Set<string>;
export declare function assert(assertion: boolean, message: string): void;

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapperTypes = exports.getFullyQualifiedTypeName = void 0;
exports.assert = exports.wrapperTypes = exports.getFullyQualifiedTypeName = void 0;
function getFullyQualifiedTypeName(type) {

@@ -39,2 +39,8 @@ // We assume that the protobuf package tree cannot have cycles.

]);
function assert(assertion, message) {
if (!assertion) {
throw new Error(message);
}
}
exports.assert = assert;
//# sourceMappingURL=util.js.map

@@ -17,3 +17,3 @@ "use strict";

exports.googleProtobufValueFromProto3JSON = exports.googleProtobufListValueFromProto3JSON = exports.googleProtobufStructFromProto3JSON = exports.googleProtobufValueToProto3JSON = exports.googleProtobufListValueToProto3JSON = exports.googleProtobufStructToProto3JSON = void 0;
const assert = require("assert");
const util_1 = require("./util");
function googleProtobufStructToProto3JSON(obj) {

@@ -29,3 +29,3 @@ const result = {};

function googleProtobufListValueToProto3JSON(obj) {
assert(Array.isArray(obj.values), 'ListValue internal representation must contain array of values');
(0, util_1.assert)(Array.isArray(obj.values), 'ListValue internal representation must contain array of values');
return obj.values.map(googleProtobufValueToProto3JSON);

@@ -32,0 +32,0 @@ }

@@ -17,4 +17,4 @@ "use strict";

exports.wrapperFromProto3JSON = exports.wrapperToProto3JSON = void 0;
const assert = require("assert");
const bytes_1 = require("./bytes");
const util_1 = require("./util");
function wrapperToProto3JSON(obj) {

@@ -28,3 +28,3 @@ if (!Object.prototype.hasOwnProperty.call(obj, 'value')) {

if (typeof obj.value === 'object') {
assert(obj.value.constructor.name === 'Long', `wrapperToProto3JSON: expected to see a number, a string, a boolean, or a Long, but got ${obj.value}`);
(0, util_1.assert)(obj.value.constructor.name === 'Long', `wrapperToProto3JSON: expected to see a number, a string, a boolean, or a Long, but got ${obj.value}`);
return obj.value.toString();

@@ -31,0 +31,0 @@ }

# Changelog
### [0.1.9](https://github.com/googleapis/proto3-json-serializer-nodejs/compare/v0.1.8...v0.1.9) (2022-05-11)
### Bug Fixes
* do not use Node.js assert ([#37](https://github.com/googleapis/proto3-json-serializer-nodejs/issues/37)) ([dccfeca](https://github.com/googleapis/proto3-json-serializer-nodejs/commit/dccfeca6f3bbeec29d88319f375a734ec48aadf7))
### [0.1.8](https://github.com/googleapis/proto3-json-serializer-nodejs/compare/v0.1.7...v0.1.8) (2022-01-21)

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

{
"name": "proto3-json-serializer",
"version": "0.1.8",
"version": "0.1.9",
"repository": "googleapis/proto3-json-serializer-nodejs",

@@ -5,0 +5,0 @@ "description": "Support for proto3 JSON serialiazation/deserialization for protobuf.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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