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.7.0 to 2.8.0

3

build/commonjs/binary-reader.js

@@ -30,3 +30,4 @@ "use strict";

this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder("utf-8", {
fatal: true
fatal: true,
ignoreBOM: true,
});

@@ -33,0 +34,0 @@ }

@@ -7,12 +7,20 @@ "use strict";

*
* Replaces fields in the target with the fields from the
* (partial) source.
* If a singular scalar or enum field is present in the source, it
* replaces the field in the target.
*
* Omitted fields are not replaced.
* Copies all values.
* A default value in the source will replace a value in the target.
* If a singular message field is present in the source, it is merged
* with the target field by calling mergePartial() of the responsible
* message type.
*
* Message fields are recursively merged (by calling `mergePartial()`
* of the responsible message handler). Map and repeated fields
* are simply overwritten, not appended or merged.
* If a repeated field is present in the source, its values replace
* all values in the target array, removing extraneous values.
* Repeated message fields are copied, not merged.
*
* If a map field is present in the source, entries are added to the
* target map, replacing entries with the same key. Entries that only
* exist in the target remain. Entries with message values are copied,
* not merged.
*
* Note that this function differs from protobuf merge semantics,
* which appends repeated fields.
*/

@@ -44,2 +52,4 @@ function reflectionMergePartial(info, target, source) {

}
if (field.repeat)
output[name].length = fieldValue.length; // resize target array to match source array
// now we just work with `fieldValue` and `output` to merge the value

@@ -50,3 +60,4 @@ switch (field.kind) {

if (field.repeat)
output[name] = fieldValue.concat(); // elements are not reference types
for (let i = 0; i < fieldValue.length; i++)
output[name][i] = fieldValue[i]; // not a reference type
else

@@ -53,0 +64,0 @@ output[name] = fieldValue; // not a reference type

@@ -26,3 +26,4 @@ import { WireType } from "./binary-format-contract";

this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder("utf-8", {
fatal: true
fatal: true,
ignoreBOM: true,
});

@@ -29,0 +30,0 @@ }

/**
* Copy partial data into the target message.
*
* Replaces fields in the target with the fields from the
* (partial) source.
* If a singular scalar or enum field is present in the source, it
* replaces the field in the target.
*
* Omitted fields are not replaced.
* Copies all values.
* A default value in the source will replace a value in the target.
* If a singular message field is present in the source, it is merged
* with the target field by calling mergePartial() of the responsible
* message type.
*
* Message fields are recursively merged (by calling `mergePartial()`
* of the responsible message handler). Map and repeated fields
* are simply overwritten, not appended or merged.
* If a repeated field is present in the source, its values replace
* all values in the target array, removing extraneous values.
* Repeated message fields are copied, not merged.
*
* If a map field is present in the source, entries are added to the
* target map, replacing entries with the same key. Entries that only
* exist in the target remain. Entries with message values are copied,
* not merged.
*
* Note that this function differs from protobuf merge semantics,
* which appends repeated fields.
*/

@@ -40,2 +48,4 @@ export function reflectionMergePartial(info, target, source) {

}
if (field.repeat)
output[name].length = fieldValue.length; // resize target array to match source array
// now we just work with `fieldValue` and `output` to merge the value

@@ -46,3 +56,4 @@ switch (field.kind) {

if (field.repeat)
output[name] = fieldValue.concat(); // elements are not reference types
for (let i = 0; i < fieldValue.length; i++)
output[name][i] = fieldValue[i]; // not a reference type
else

@@ -49,0 +60,0 @@ output[name] = fieldValue; // not a reference type

@@ -101,2 +101,21 @@ import type { FieldInfo, MessageInfo } from "./reflection-info";

* Copy partial data into the target message.
*
* If a singular scalar or enum field is present in the source, it
* replaces the field in the target.
*
* If a singular message field is present in the source, it is merged
* with the target field by calling mergePartial() of the responsible
* message type.
*
* If a repeated field is present in the source, its values replace
* all values in the target array, removing extraneous values.
* Repeated message fields are copied, not merged.
*
* If a map field is present in the source, entries are added to the
* target map, replacing entries with the same key. Entries that only
* exist in the target remain. Entries with message values are copied,
* not merged.
*
* Note that this function differs from protobuf merge semantics,
* which appends repeated fields.
*/

@@ -103,0 +122,0 @@ mergePartial(target: T, source: PartialMessage<T>): void;

@@ -6,13 +6,21 @@ import type { MessageInfo } from "./reflection-info";

*
* Replaces fields in the target with the fields from the
* (partial) source.
* If a singular scalar or enum field is present in the source, it
* replaces the field in the target.
*
* Omitted fields are not replaced.
* Copies all values.
* A default value in the source will replace a value in the target.
* If a singular message field is present in the source, it is merged
* with the target field by calling mergePartial() of the responsible
* message type.
*
* Message fields are recursively merged (by calling `mergePartial()`
* of the responsible message handler). Map and repeated fields
* are simply overwritten, not appended or merged.
* If a repeated field is present in the source, its values replace
* all values in the target array, removing extraneous values.
* Repeated message fields are copied, not merged.
*
* If a map field is present in the source, entries are added to the
* target map, replacing entries with the same key. Entries that only
* exist in the target remain. Entries with message values are copied,
* not merged.
*
* Note that this function differs from protobuf merge semantics,
* which appends repeated fields.
*/
export declare function reflectionMergePartial<T extends object>(info: MessageInfo, target: T, source: PartialMessage<T>): void;
{
"name": "@protobuf-ts/runtime",
"version": "2.7.0",
"version": "2.8.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": "bf5131e1d9e839eeed9c845cea0f05d1e5fee041"
"gitHead": "fe98fb558e2428b948638a2cccb001adb70c23d0"
}
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