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

@protobuf-ts/runtime

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@protobuf-ts/runtime - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

25

build/commonjs/binary-format-contract.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WireType = exports.mergeBinaryOptions = exports.binaryReadOptions = exports.binaryWriteOptions = exports.UnknownFieldHandler = void 0;
const binary_reader_1 = require("./binary-reader");
const binary_writer_1 = require("./binary-writer");
exports.WireType = exports.mergeBinaryOptions = exports.UnknownFieldHandler = void 0;
/**

@@ -54,23 +52,2 @@ * This handler implements the default behaviour for unknown fields.

/**
* Make options for writing binary data form partial options.
*/
function binaryWriteOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
}
exports.binaryWriteOptions = binaryWriteOptions;
/**
* Make options for reading binary data form partial options.
*/
function binaryReadOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
}
exports.binaryReadOptions = binaryReadOptions;
const defaultsRead = {
readUnknownField: true,
readerFactory: bytes => new binary_reader_1.BinaryReader(bytes),
}, defaultsWrite = {
writeUnknownFields: true,
writerFactory: () => new binary_writer_1.BinaryWriter(),
};
/**
* Merges binary write or read options. Later values override earlier values.

@@ -77,0 +54,0 @@ */

13

build/commonjs/binary-reader.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BinaryReader = void 0;
exports.BinaryReader = exports.binaryReadOptions = void 0;
const binary_format_contract_1 = require("./binary-format-contract");
const pb_long_1 = require("./pb-long");
const goog_varint_1 = require("./goog-varint");
const defaultsRead = {
readUnknownField: true,
readerFactory: bytes => new BinaryReader(bytes),
};
/**
* Make options for reading binary data form partial options.
*/
function binaryReadOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
}
exports.binaryReadOptions = binaryReadOptions;
class BinaryReader {

@@ -8,0 +19,0 @@ constructor(buf, textDecoder) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BinaryWriter = void 0;
exports.BinaryWriter = exports.binaryWriteOptions = void 0;
const pb_long_1 = require("./pb-long");
const goog_varint_1 = require("./goog-varint");
const assert_1 = require("./assert");
const defaultsWrite = {
writeUnknownFields: true,
writerFactory: () => new BinaryWriter(),
};
/**
* Make options for writing binary data form partial options.
*/
function binaryWriteOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
}
exports.binaryWriteOptions = binaryWriteOptions;
class BinaryWriter {

@@ -8,0 +19,0 @@ constructor(textEncoder) {

@@ -20,4 +20,2 @@ "use strict";

Object.defineProperty(exports, "WireType", { enumerable: true, get: function () { return binary_format_contract_1.WireType; } });
Object.defineProperty(exports, "binaryWriteOptions", { enumerable: true, get: function () { return binary_format_contract_1.binaryWriteOptions; } });
Object.defineProperty(exports, "binaryReadOptions", { enumerable: true, get: function () { return binary_format_contract_1.binaryReadOptions; } });
Object.defineProperty(exports, "mergeBinaryOptions", { enumerable: true, get: function () { return binary_format_contract_1.mergeBinaryOptions; } });

@@ -28,5 +26,7 @@ Object.defineProperty(exports, "UnknownFieldHandler", { enumerable: true, get: function () { return binary_format_contract_1.UnknownFieldHandler; } });

Object.defineProperty(exports, "BinaryReader", { enumerable: true, get: function () { return binary_reader_1.BinaryReader; } });
Object.defineProperty(exports, "binaryReadOptions", { enumerable: true, get: function () { return binary_reader_1.binaryReadOptions; } });
// Standard IBinaryWriter implementation
var binary_writer_1 = require("./binary-writer");
Object.defineProperty(exports, "BinaryWriter", { enumerable: true, get: function () { return binary_writer_1.BinaryWriter; } });
Object.defineProperty(exports, "binaryWriteOptions", { enumerable: true, get: function () { return binary_writer_1.binaryWriteOptions; } });
// Int64 and UInt64 implementations required for the binary format

@@ -33,0 +33,0 @@ var pb_long_1 = require("./pb-long");

@@ -14,4 +14,5 @@ "use strict";

const json_format_contract_1 = require("./json-format-contract");
const binary_format_contract_1 = require("./binary-format-contract");
const reflection_equals_1 = require("./reflection-equals");
const binary_writer_1 = require("./binary-writer");
const binary_reader_1 = require("./binary-reader");
/**

@@ -85,3 +86,3 @@ * This standard message type provides reflection-based

fromBinary(data, options) {
let opt = binary_format_contract_1.binaryReadOptions(options);
let opt = binary_reader_1.binaryReadOptions(options);
return this.internalBinaryRead(opt.readerFactory(data), data.byteLength, opt);

@@ -122,3 +123,3 @@ }

toBinary(message, options) {
let opt = binary_format_contract_1.binaryWriteOptions(options);
let opt = binary_writer_1.binaryWriteOptions(options);
return this.internalBinaryWrite(message, opt.writerFactory(), opt).finish();

@@ -125,0 +126,0 @@ }

@@ -1,3 +0,1 @@

import { BinaryReader } from "./binary-reader";
import { BinaryWriter } from "./binary-writer";
/**

@@ -51,21 +49,2 @@ * This handler implements the default behaviour for unknown fields.

/**
* Make options for writing binary data form partial options.
*/
export function binaryWriteOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
}
/**
* Make options for reading binary data form partial options.
*/
export function binaryReadOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
}
const defaultsRead = {
readUnknownField: true,
readerFactory: bytes => new BinaryReader(bytes),
}, defaultsWrite = {
writeUnknownFields: true,
writerFactory: () => new BinaryWriter(),
};
/**
* Merges binary write or read options. Later values override earlier values.

@@ -72,0 +51,0 @@ */

import { WireType } from "./binary-format-contract";
import { PbLong, PbULong } from "./pb-long";
import { varint32read, varint64read } from "./goog-varint";
const defaultsRead = {
readUnknownField: true,
readerFactory: bytes => new BinaryReader(bytes),
};
/**
* Make options for reading binary data form partial options.
*/
export function binaryReadOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
}
export class BinaryReader {

@@ -5,0 +15,0 @@ constructor(buf, textDecoder) {

import { PbLong, PbULong } from "./pb-long";
import { varint32write, varint64write } from "./goog-varint";
import { assertFloat32, assertInt32, assertUInt32 } from "./assert";
const defaultsWrite = {
writeUnknownFields: true,
writerFactory: () => new BinaryWriter(),
};
/**
* Make options for writing binary data form partial options.
*/
export function binaryWriteOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
}
export class BinaryWriter {

@@ -5,0 +15,0 @@ constructor(textEncoder) {

@@ -11,7 +11,7 @@ // Public API of the protobuf-ts runtime.

// Binary format contracts, options for reading and writing, for example
export { WireType, binaryWriteOptions, binaryReadOptions, mergeBinaryOptions, UnknownFieldHandler, } from './binary-format-contract';
export { WireType, mergeBinaryOptions, UnknownFieldHandler, } from './binary-format-contract';
// Standard IBinaryReader implementation
export { BinaryReader } from './binary-reader';
export { BinaryReader, binaryReadOptions } from './binary-reader';
// Standard IBinaryWriter implementation
export { BinaryWriter } from './binary-writer';
export { BinaryWriter, binaryWriteOptions } from './binary-writer';
// Int64 and UInt64 implementations required for the binary format

@@ -18,0 +18,0 @@ export { PbLong, PbULong } from './pb-long';

@@ -11,4 +11,5 @@ import { normalizeFieldInfo } from "./reflection-info";

import { jsonReadOptions, jsonWriteOptions, } from "./json-format-contract";
import { binaryReadOptions, binaryWriteOptions } from "./binary-format-contract";
import { reflectionEquals } from "./reflection-equals";
import { binaryWriteOptions } from "./binary-writer";
import { binaryReadOptions } from "./binary-reader";
/**

@@ -15,0 +16,0 @@ * This standard message type provides reflection-based

@@ -94,10 +94,2 @@ import type { PbLong, PbULong } from "./pb-long";

/**
* Make options for writing binary data form partial options.
*/
export declare function binaryWriteOptions(options?: Partial<BinaryWriteOptions>): Readonly<BinaryWriteOptions>;
/**
* Make options for reading binary data form partial options.
*/
export declare function binaryReadOptions(options?: Partial<BinaryReadOptions>): Readonly<BinaryReadOptions>;
/**
* Merges binary write or read options. Later values override earlier values.

@@ -104,0 +96,0 @@ */

@@ -1,5 +0,9 @@

import type { IBinaryReader } from "./binary-format-contract";
import type { BinaryReadOptions, IBinaryReader } from "./binary-format-contract";
import { WireType } from "./binary-format-contract";
import { PbLong, PbULong } from "./pb-long";
/**
* Make options for reading binary data form partial options.
*/
export declare function binaryReadOptions(options?: Partial<BinaryReadOptions>): Readonly<BinaryReadOptions>;
/**
* TextDecoderLike is the subset of the TextDecoder API required by protobuf-ts.

@@ -6,0 +10,0 @@ */

@@ -1,4 +0,7 @@

import type { IBinaryWriter } from "./binary-format-contract";
import type { WireType } from "./binary-format-contract";
import type { BinaryWriteOptions, IBinaryWriter, WireType } from "./binary-format-contract";
/**
* Make options for writing binary data form partial options.
*/
export declare function binaryWriteOptions(options?: Partial<BinaryWriteOptions>): Readonly<BinaryWriteOptions>;
/**
* TextEncoderLike is the subset of the TextEncoder API required by protobuf-ts.

@@ -5,0 +8,0 @@ */

export { JsonValue, JsonObject, typeofJsonValue, isJsonObject } from './json-typings';
export { base64decode, base64encode } from './base64';
export { utf8read } from './protobufjs-utf8';
export { WireType, BinaryReadOptions, BinaryWriteOptions, binaryWriteOptions, binaryReadOptions, mergeBinaryOptions, IBinaryWriter, IBinaryReader, UnknownFieldHandler, } from './binary-format-contract';
export { BinaryReader } from './binary-reader';
export { BinaryWriter } from './binary-writer';
export { WireType, BinaryReadOptions, BinaryWriteOptions, mergeBinaryOptions, IBinaryWriter, IBinaryReader, UnknownFieldHandler, } from './binary-format-contract';
export { BinaryReader, binaryReadOptions } from './binary-reader';
export { BinaryWriter, binaryWriteOptions } from './binary-writer';
export { PbLong, PbULong } from './pb-long';

@@ -8,0 +8,0 @@ export { JsonReadOptions, JsonWriteOptions, JsonWriteStringOptions, jsonReadOptions, jsonWriteOptions, mergeJsonOptions } from './json-format-contract';

{
"name": "@protobuf-ts/runtime",
"version": "2.4.0",
"version": "2.5.0",
"description": "Runtime library for code generated by the protoc plugin \"protobuf-ts\"",

@@ -40,3 +40,3 @@ "license": "(Apache-2.0 AND BSD-3-Clause)",

},
"gitHead": "81bc5ca3ad023541bc9ed1f2b7308793ffc6d6ee"
"gitHead": "63ea42785d879a32021268b1b318803df3ab391d"
}
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