Socket
Socket
Sign inDemoInstall

@dxos/codec-protobuf

Package Overview
Dependencies
Maintainers
22
Versions
2982
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxos/codec-protobuf - npm Package Compare versions

Comparing version 2.12.20 to 2.12.21

9

dist/src/codec.js

@@ -8,2 +8,9 @@ "use strict";

const mapping_1 = require("./mapping");
const OBJECT_CONVERSION_OPTIONS = {
// Represent long integers as strings.
longs: String,
// Will set empty repeated fields to [] instead of undefined.
// TODO(marik-d): Type repeated fields as non-optional arrays.
arrays: true
};
class Codec {

@@ -20,3 +27,3 @@ constructor(_type, _mapping, _schema) {

decode(data) {
const obj = this._type.toObject(this._type.decode(data));
const obj = this._type.toObject(this._type.decode(data), OBJECT_CONVERSION_OPTIONS);
return mapping_1.mapMessage(this._type, this._mapping.decode, obj, [this._schema]);

@@ -23,0 +30,0 @@ }

2

package.json
{
"name": "@dxos/codec-protobuf",
"version": "2.12.20",
"version": "2.12.21",
"license": "AGPL-3.0",

@@ -5,0 +5,0 @@ "author": "DXOS.org",

@@ -5,3 +5,3 @@ //

import protobufjs from 'protobufjs';
import protobufjs, { IConversionOptions } from 'protobufjs';

@@ -11,2 +11,11 @@ import { BidirectionalMapingDescriptors, mapMessage } from './mapping';

const OBJECT_CONVERSION_OPTIONS: IConversionOptions = {
// Represent long integers as strings.
longs: String,
// Will set empty repeated fields to [] instead of undefined.
// TODO(marik-d): Type repeated fields as non-optional arrays.
arrays: true
};
export class Codec<T = any> {

@@ -25,3 +34,3 @@ constructor (

decode (data: Uint8Array): T {
const obj = this._type.toObject(this._type.decode(data));
const obj = this._type.toObject(this._type.decode(data), OBJECT_CONVERSION_OPTIONS);
return mapMessage(this._type, this._mapping.decode, obj, [this._schema]);

@@ -28,0 +37,0 @@ }

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