signal-desktop/patches/protobufjs+7.2.4.patch
dependabot[bot] 5c4d93e103
Bump protobufjs from 6.11.3 to 7.2.4
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Fedor Indutnyy <indutny@signal.org>
2023-07-12 19:54:37 +02:00

1113 lines
36 KiB
Diff

diff --git a/node_modules/protobufjs/dist/light/protobuf.js b/node_modules/protobufjs/dist/light/protobuf.js
index 62a9c6a..1d598c5 100644
--- a/node_modules/protobufjs/dist/light/protobuf.js
+++ b/node_modules/protobufjs/dist/light/protobuf.js
@@ -1,6 +1,6 @@
/*!
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
- * compiled fri, 09 sep 2022 03:02:57 utc
+ * protobuf.js v7.2.4 (c) 2016, daniel wirtz
+ * compiled wed, 12 jul 2023 00:03:48 utc
* licensed under the bsd-3-clause license
* see: https://github.com/dcodeio/protobuf.js for details
*/
@@ -1129,18 +1129,20 @@ var Enum = require(14),
* @ignore
*/
function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
+ var defaultAlreadyEmitted = false;
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
if (field.resolvedType) {
if (field.resolvedType instanceof Enum) { gen
("switch(d%s){", prop);
for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
// enum unknown values passthrough
- if (values[keys[i]] === field.typeDefault) { gen
+ if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen
("default:")
("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);
if (!field.repeated) gen // fallback to default value only for
// arrays, to avoid leaving holes.
("break"); // for non-repeated fields, just ignore
+ defaultAlreadyEmitted = true;
}
gen
("case%j:", keys[i])
@@ -1433,6 +1435,7 @@ function decoder(mtype) {
("r=Reader.create(r)")
("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : ""))
("while(r.pos<c){")
+ ("var unknownStartPos = r.pos")
("var t=r.uint32()");
if (mtype.group) gen
("if((t&7)===4)")
@@ -1440,6 +1443,8 @@ function decoder(mtype) {
gen
("switch(t>>>3){");
+ var unknownRef = "m" + util.safeProp("$unknownFields");
+
var i = 0;
for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {
var field = mtype._fieldsArray[i].resolve(),
@@ -1522,6 +1527,11 @@ function decoder(mtype) {
} gen
("default:")
("r.skipType(t&7)")
+ ("if (!(%s)) {", unknownRef)
+ ("%s = []", unknownRef)
+ ("}")
+
+ ("%s.push(r.buf.slice(unknownStartPos, r.pos))", unknownRef)
("break")
("}")
@@ -1579,6 +1589,21 @@ function encoder(mtype) {
// "when a message is serialized its known fields should be written sequentially by field number"
var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);
+ var unknownRef = "m" + util.safeProp("$unknownFields");
+
+ // Redecode unknown fields and apply them to the message before encoding
+ gen
+ ("var fullyUnknown=[]")
+ ("if(%s) {", unknownRef)
+ ("for(var i=0;i<%s.length;++i) {", unknownRef)
+ ("try {")
+ ("var known=this.ctor.decode(%s[i])", unknownRef)
+ ("fullyUnknown=fullyUnknown.concat(known.$unknownFields||[])")
+ ("m=Object.assign(known,m)")
+ ("}catch(_){}")
+ ("}")
+ ("}")
+
for (var i = 0; i < fields.length; ++i) {
var field = fields[i].resolve(),
index = mtype._fieldsArray.indexOf(field),
@@ -1637,6 +1662,11 @@ function encoder(mtype) {
}
}
+ gen
+ ("for(var i=0;i<fullyUnknown.length;++i) {")
+ ("w._unknownField(fullyUnknown[i])")
+ ("}")
+
return gen
("return w");
/* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */
@@ -2941,9 +2971,8 @@ Object.defineProperty(Namespace.prototype, "nestedArray", {
/**
* Any nested object descriptor.
* @typedef AnyNestedObject
- * @type {IEnum|IType|IService|AnyExtensionField|INamespace}
+ * @type {IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf}
*/
-// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)
/**
* Converts this namespace to a namespace descriptor.
@@ -4295,6 +4324,7 @@ Root.prototype.load = function load(filename, options, callback) {
// Fetches a single file
function fetch(filename, weak) {
+ filename = getBundledFileName(filename) || filename;
// Skip if already loaded / attempted
if (self.files.indexOf(filename) > -1)
@@ -4423,6 +4453,10 @@ function tryHandleExtension(root, field) {
var extendedType = field.parent.lookup(field.extend);
if (extendedType) {
var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);
+ //do not allow to extend same field twice to prevent the error
+ if (extendedType.get(sisterField.name)) {
+ return true;
+ }
sisterField.declaringField = field;
field.extensionField = sisterField;
extendedType.add(sisterField);
@@ -5851,7 +5885,7 @@ util.decorateEnum = function decorateEnum(object) {
util.setProperty = function setProperty(dst, path, value) {
function setProp(dst, path, value) {
var part = path.shift();
- if (part === "__proto__") {
+ if (part === "__proto__" || part === "prototype") {
return dst;
}
if (path.length > 0) {
@@ -6379,7 +6413,7 @@ function newError(name) {
configurable: true,
},
name: {
- get() { return name; },
+ get: function get() { return name; },
set: undefined,
enumerable: false,
// configurable: false would accurately preserve the behavior of
@@ -6389,7 +6423,7 @@ function newError(name) {
configurable: true,
},
toString: {
- value() { return this.name + ": " + this.message; },
+ value: function value() { return this.name + ": " + this.message; },
writable: true,
enumerable: false,
configurable: true,
@@ -7196,6 +7230,11 @@ Writer.prototype.bytes = function write_bytes(value) {
return this.uint32(len)._push(writeBytes, len, value);
};
+
+Writer.prototype._unknownField = function __unknownField(field) {
+ return this._push(writeBytes, field.length, field);
+};
+
/**
* Writes a string.
* @param {string} value Value to write
diff --git a/node_modules/protobufjs/dist/minimal/protobuf.js b/node_modules/protobufjs/dist/minimal/protobuf.js
index 0f4af1d..a3dd165 100644
--- a/node_modules/protobufjs/dist/minimal/protobuf.js
+++ b/node_modules/protobufjs/dist/minimal/protobuf.js
@@ -1,6 +1,6 @@
/*!
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
- * compiled fri, 09 sep 2022 03:02:57 utc
+ * protobuf.js v7.2.4 (c) 2016, daniel wirtz
+ * compiled wed, 12 jul 2023 00:03:48 utc
* licensed under the bsd-3-clause license
* see: https://github.com/dcodeio/protobuf.js for details
*/
@@ -2022,7 +2022,7 @@ function newError(name) {
configurable: true,
},
name: {
- get() { return name; },
+ get: function get() { return name; },
set: undefined,
enumerable: false,
// configurable: false would accurately preserve the behavior of
@@ -2032,7 +2032,7 @@ function newError(name) {
configurable: true,
},
toString: {
- value() { return this.name + ": " + this.message; },
+ value: function value() { return this.name + ": " + this.message; },
writable: true,
enumerable: false,
configurable: true,
@@ -2557,6 +2557,11 @@ Writer.prototype.bytes = function write_bytes(value) {
return this.uint32(len)._push(writeBytes, len, value);
};
+
+Writer.prototype._unknownField = function __unknownField(field) {
+ return this._push(writeBytes, field.length, field);
+};
+
/**
* Writes a string.
* @param {string} value Value to write
diff --git a/node_modules/protobufjs/dist/protobuf.js b/node_modules/protobufjs/dist/protobuf.js
index eccc464..28a6fb8 100644
--- a/node_modules/protobufjs/dist/protobuf.js
+++ b/node_modules/protobufjs/dist/protobuf.js
@@ -1,6 +1,6 @@
/*!
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
- * compiled fri, 09 sep 2022 03:02:57 utc
+ * protobuf.js v7.2.4 (c) 2016, daniel wirtz
+ * compiled wed, 12 jul 2023 00:03:48 utc
* licensed under the bsd-3-clause license
* see: https://github.com/dcodeio/protobuf.js for details
*/
@@ -1530,18 +1530,20 @@ var Enum = require(15),
* @ignore
*/
function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
+ var defaultAlreadyEmitted = false;
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
if (field.resolvedType) {
if (field.resolvedType instanceof Enum) { gen
("switch(d%s){", prop);
for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
// enum unknown values passthrough
- if (values[keys[i]] === field.typeDefault) { gen
+ if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen
("default:")
("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);
if (!field.repeated) gen // fallback to default value only for
// arrays, to avoid leaving holes.
("break"); // for non-repeated fields, just ignore
+ defaultAlreadyEmitted = true;
}
gen
("case%j:", keys[i])
@@ -1834,6 +1836,7 @@ function decoder(mtype) {
("r=Reader.create(r)")
("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : ""))
("while(r.pos<c){")
+ ("var unknownStartPos = r.pos")
("var t=r.uint32()");
if (mtype.group) gen
("if((t&7)===4)")
@@ -1841,6 +1844,8 @@ function decoder(mtype) {
gen
("switch(t>>>3){");
+ var unknownRef = "m" + util.safeProp("$unknownFields");
+
var i = 0;
for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {
var field = mtype._fieldsArray[i].resolve(),
@@ -1923,6 +1928,11 @@ function decoder(mtype) {
} gen
("default:")
("r.skipType(t&7)")
+ ("if (!(%s)) {", unknownRef)
+ ("%s = []", unknownRef)
+ ("}")
+
+ ("%s.push(r.buf.slice(unknownStartPos, r.pos))", unknownRef)
("break")
("}")
@@ -1980,6 +1990,21 @@ function encoder(mtype) {
// "when a message is serialized its known fields should be written sequentially by field number"
var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);
+ var unknownRef = "m" + util.safeProp("$unknownFields");
+
+ // Redecode unknown fields and apply them to the message before encoding
+ gen
+ ("var fullyUnknown=[]")
+ ("if(%s) {", unknownRef)
+ ("for(var i=0;i<%s.length;++i) {", unknownRef)
+ ("try {")
+ ("var known=this.ctor.decode(%s[i])", unknownRef)
+ ("fullyUnknown=fullyUnknown.concat(known.$unknownFields||[])")
+ ("m=Object.assign(known,m)")
+ ("}catch(_){}")
+ ("}")
+ ("}")
+
for (var i = 0; i < fields.length; ++i) {
var field = fields[i].resolve(),
index = mtype._fieldsArray.indexOf(field),
@@ -2038,6 +2063,11 @@ function encoder(mtype) {
}
}
+ gen
+ ("for(var i=0;i<fullyUnknown.length;++i) {")
+ ("w._unknownField(fullyUnknown[i])")
+ ("}")
+
return gen
("return w");
/* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */
@@ -3356,9 +3386,8 @@ Object.defineProperty(Namespace.prototype, "nestedArray", {
/**
* Any nested object descriptor.
* @typedef AnyNestedObject
- * @type {IEnum|IType|IService|AnyExtensionField|INamespace}
+ * @type {IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf}
*/
-// ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)
/**
* Converts this namespace to a namespace descriptor.
@@ -4459,6 +4488,16 @@ function parse(source, root, options) {
parseGroup(parent, rule);
return;
}
+ // Type names can consume multiple tokens, in multiple variants:
+ // package.subpackage field tokens: "package.subpackage" [TYPE NAME ENDS HERE] "field"
+ // package . subpackage field tokens: "package" "." "subpackage" [TYPE NAME ENDS HERE] "field"
+ // package. subpackage field tokens: "package." "subpackage" [TYPE NAME ENDS HERE] "field"
+ // package .subpackage field tokens: "package" ".subpackage" [TYPE NAME ENDS HERE] "field"
+ // Keep reading tokens until we get a type name with no period at the end,
+ // and the next token does not start with a period.
+ while (type.endsWith(".") || peek().startsWith(".")) {
+ type += next();
+ }
/* istanbul ignore if */
if (!typeRefRe.test(type))
@@ -5571,6 +5610,7 @@ Root.prototype.load = function load(filename, options, callback) {
// Fetches a single file
function fetch(filename, weak) {
+ filename = getBundledFileName(filename) || filename;
// Skip if already loaded / attempted
if (self.files.indexOf(filename) > -1)
@@ -5699,6 +5739,10 @@ function tryHandleExtension(root, field) {
var extendedType = field.parent.lookup(field.extend);
if (extendedType) {
var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);
+ //do not allow to extend same field twice to prevent the error
+ if (extendedType.get(sisterField.name)) {
+ return true;
+ }
sisterField.declaringField = field;
field.extensionField = sisterField;
extendedType.add(sisterField);
@@ -7547,7 +7591,7 @@ util.decorateEnum = function decorateEnum(object) {
util.setProperty = function setProperty(dst, path, value) {
function setProp(dst, path, value) {
var part = path.shift();
- if (part === "__proto__") {
+ if (part === "__proto__" || part === "prototype") {
return dst;
}
if (path.length > 0) {
@@ -8075,7 +8119,7 @@ function newError(name) {
configurable: true,
},
name: {
- get() { return name; },
+ get: function get() { return name; },
set: undefined,
enumerable: false,
// configurable: false would accurately preserve the behavior of
@@ -8085,7 +8129,7 @@ function newError(name) {
configurable: true,
},
toString: {
- value() { return this.name + ": " + this.message; },
+ value: function value() { return this.name + ": " + this.message; },
writable: true,
enumerable: false,
configurable: true,
@@ -8892,6 +8936,11 @@ Writer.prototype.bytes = function write_bytes(value) {
return this.uint32(len)._push(writeBytes, len, value);
};
+
+Writer.prototype._unknownField = function __unknownField(field) {
+ return this._push(writeBytes, field.length, field);
+};
+
/**
* Writes a string.
* @param {string} value Value to write
diff --git a/node_modules/protobufjs/ext/descriptor/index.d.ts b/node_modules/protobufjs/ext/descriptor/index.d.ts
index 1df2efc..da2a2c0 100644
--- a/node_modules/protobufjs/ext/descriptor/index.d.ts
+++ b/node_modules/protobufjs/ext/descriptor/index.d.ts
@@ -1,4 +1,5 @@
import * as $protobuf from "../..";
+import Long = require("long");
export const FileDescriptorSet: $protobuf.Type;
export const FileDescriptorProto: $protobuf.Type;
@@ -58,6 +59,8 @@ export const GeneratedCodeInfo: $protobuf.Type & {
export interface IFileDescriptorSet {
file: IFileDescriptorProto[];
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IFileDescriptorProto {
@@ -73,6 +76,8 @@ export interface IFileDescriptorProto {
options?: IFileOptions;
sourceCodeInfo?: any;
syntax?: string;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IFileOptions {
@@ -90,6 +95,8 @@ export interface IFileOptions {
ccEnableArenas?: boolean;
objcClassPrefix?: string;
csharpNamespace?: string;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
type IFileOptionsOptimizeMode = number;
@@ -105,20 +112,28 @@ export interface IDescriptorProto {
options?: IMessageOptions;
reservedRange?: IDescriptorProtoReservedRange[];
reservedName?: string[];
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IMessageOptions {
mapEntry?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IDescriptorProtoExtensionRange {
start?: number;
end?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IDescriptorProtoReservedRange {
start?: number;
end?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IFieldDescriptorProto {
@@ -132,6 +147,8 @@ export interface IFieldDescriptorProto {
oneofIndex?: number;
jsonName?: any;
options?: IFieldOptions;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
type IFieldDescriptorProtoLabel = number;
@@ -141,6 +158,8 @@ type IFieldDescriptorProtoType = number;
export interface IFieldOptions {
packed?: boolean;
jstype?: IFieldOptionsJSType;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
type IFieldOptionsJSType = number;
@@ -149,32 +168,44 @@ export interface IEnumDescriptorProto {
name?: string;
value?: IEnumValueDescriptorProto[];
options?: IEnumOptions;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IEnumValueDescriptorProto {
name?: string;
number?: number;
options?: any;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IEnumOptions {
allowAlias?: boolean;
deprecated?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IOneofDescriptorProto {
name?: string;
options?: any;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IServiceDescriptorProto {
name?: string;
method?: IMethodDescriptorProto[];
options?: IServiceOptions;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IServiceOptions {
deprecated?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IMethodDescriptorProto {
@@ -184,8 +215,12 @@ export interface IMethodDescriptorProto {
options?: IMethodOptions;
clientStreaming?: boolean;
serverStreaming?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
export interface IMethodOptions {
deprecated?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
diff --git a/node_modules/protobufjs/index.d.ts b/node_modules/protobufjs/index.d.ts
index 750ad2f..ffcbdbe 100644
--- a/node_modules/protobufjs/index.d.ts
+++ b/node_modules/protobufjs/index.d.ts
@@ -16,27 +16,37 @@ export namespace common {
interface IAny {
typeUrl?: string;
bytes?: Uint8Array;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Duration message. */
interface IDuration {
seconds?: (number|Long);
nanos?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Timestamp message. */
interface ITimestamp {
seconds?: (number|Long);
nanos?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Empty message. */
interface IEmpty {
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Struct message. */
interface IStruct {
fields?: { [k: string]: IValue };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Value message. */
@@ -48,56 +58,78 @@ export namespace common {
boolValue?: boolean;
structValue?: IStruct;
listValue?: IListValue;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.ListValue message. */
interface IListValue {
values?: IValue[];
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.DoubleValue message. */
interface IDoubleValue {
value?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.FloatValue message. */
interface IFloatValue {
value?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Int64Value message. */
interface IInt64Value {
value?: (number|Long);
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.UInt64Value message. */
interface IUInt64Value {
value?: (number|Long);
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.Int32Value message. */
interface IInt32Value {
value?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.UInt32Value message. */
interface IUInt32Value {
value?: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.BoolValue message. */
interface IBoolValue {
value?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.StringValue message. */
interface IStringValue {
value?: string;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties of a google.protobuf.BytesValue message. */
interface IBytesValue {
value?: Uint8Array;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -232,6 +264,8 @@ export class Enum extends ReflectionObject {
* @returns `true` if reserved, otherwise `false`
*/
public isReservedName(name: string): boolean;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Enum descriptor. */
@@ -242,6 +276,8 @@ export interface IEnum {
/** Enum options */
options?: { [k: string]: any };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Reflected message field. */
@@ -288,6 +324,8 @@ export class Field extends FieldBase {
* @returns Decorator function
*/
public static d<T extends Message<T>>(fieldId: number, fieldType: (Constructor<T>|string), fieldRule?: ("optional"|"required"|"repeated")): FieldDecorator;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. */
@@ -369,6 +407,8 @@ export class FieldBase extends ReflectionObject {
* @throws {Error} If any reference cannot be resolved
*/
public resolve(): Field;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Field descriptor. */
@@ -385,6 +425,8 @@ export interface IField {
/** Field options */
options?: { [k: string]: any };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Extension field descriptor. */
@@ -392,6 +434,8 @@ export interface IExtensionField extends IField {
/** Extended type */
extend: string;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -494,6 +538,8 @@ export class MapField extends FieldBase {
* @returns Decorator function
*/
public static d<T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> }>(fieldId: number, fieldKeyType: ("int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"), fieldValueType: ("double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|object|Constructor<{}>)): FieldDecorator;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Map field descriptor. */
@@ -501,6 +547,8 @@ export interface IMapField extends IField {
/** Key type */
keyType: string;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Extension map field descriptor. */
@@ -508,6 +556,8 @@ export interface IExtensionMapField extends IMapField {
/** Extended type */
extend: string;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Abstract runtime message. */
@@ -589,6 +639,8 @@ export class Message<T extends object = object> {
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Reflected service method. */
@@ -650,6 +702,8 @@ export class Method extends ReflectionObject {
* @returns Method descriptor
*/
public toJSON(toJSONOptions?: IToJSONOptions): IMethod;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Method descriptor. */
@@ -678,6 +732,8 @@ export interface IMethod {
/** Method options properly parsed into an object */
parsedOptions?: { [k: string]: any };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Reflected namespace. */
@@ -722,6 +778,8 @@ export class Namespace extends NamespaceBase {
* @returns `true` if reserved, otherwise `false`
*/
public static isReservedName(reserved: ((number[]|string)[]|undefined), name: string): boolean;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. */
@@ -847,6 +905,8 @@ export abstract class NamespaceBase extends ReflectionObject {
* @throws {Error} If `path` does not point to a service
*/
public lookupService(path: (string|string[])): Service;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Namespace descriptor. */
@@ -857,6 +917,8 @@ export interface INamespace {
/** Nested object descriptors */
nested?: { [k: string]: AnyNestedObject };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Any extension field descriptor. */
@@ -957,6 +1019,8 @@ export abstract class ReflectionObject {
* @returns Class name[, space, full name]
*/
public toString(): string;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Reflected oneof. */
@@ -1016,6 +1080,8 @@ export class OneOf extends ReflectionObject {
* @returns Decorator function
*/
public static d<T extends string>(...fieldNames: string[]): OneOfDecorator;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Oneof descriptor. */
@@ -1026,6 +1092,8 @@ export interface IOneOf {
/** Oneof options */
options?: { [k: string]: any };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1060,6 +1128,8 @@ export interface IParserResult {
/** Populated root instance */
root: Root;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Options modifying the behavior of {@link parse}. */
@@ -1073,6 +1143,8 @@ export interface IParseOptions {
/** Use trailing comment when both leading comment and trailing comment exist. */
preferTrailingComment?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Options modifying the behavior of JSON serialization. */
@@ -1080,6 +1152,8 @@ export interface IToJSONOptions {
/** Serializes comments. */
keepComments?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1220,6 +1294,8 @@ export class Reader {
* @returns `this`
*/
public skipType(wireType: number): Reader;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Wire format reader using node buffers. */
@@ -1236,6 +1312,8 @@ export class BufferReader extends Reader {
* @returns Value read
*/
public bytes(): Buffer;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. */
@@ -1309,6 +1387,8 @@ export class Root extends NamespaceBase {
* @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid
*/
public loadSync(filename: (string|string[]), options?: IParseOptions): Root;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1374,6 +1454,8 @@ export namespace rpc {
* @returns `this`
*/
public end(endedByRPC?: boolean): rpc.Service;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
}
@@ -1433,6 +1515,8 @@ export class Service extends NamespaceBase {
* @returns RPC service. Useful where requests and/or responses are streamed.
*/
public create(rpcImpl: RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): rpc.Service;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Service descriptor. */
@@ -1440,6 +1524,8 @@ export interface IService extends INamespace {
/** Method descriptors */
methods: { [k: string]: IMethod };
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1496,6 +1582,8 @@ export interface ITokenizerHandle {
/** Current line number */
line: number;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1683,6 +1771,8 @@ export class Type extends NamespaceBase {
* @returns Decorator function
*/
public static d<T extends Message<T>>(typeName?: string): TypeDecorator<T>;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Message type descriptor. */
@@ -1702,6 +1792,8 @@ export interface IType extends INamespace {
/** Whether a legacy group or not */
group?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. */
@@ -1742,6 +1834,8 @@ export interface IConversionOptions {
/** Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings */
json?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1838,6 +1932,8 @@ export namespace types {
/** Constructor type. */
export interface Constructor<T> extends Function {
new(...params: any[]): T; prototype: T;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Properties type. */
@@ -1848,6 +1944,8 @@ type Properties<T> = { [P in keyof T]?: T[P] };
* This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
*/
export interface Buffer extends Uint8Array {
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1864,6 +1962,8 @@ export interface Long {
/** Whether unsigned or not */
unsigned: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -1961,6 +2061,8 @@ export namespace util {
* @returns Length
*/
public length(): number;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Whether running within node or not. */
@@ -2088,6 +2190,8 @@ export namespace util {
/** So far decoded message instance. */
public instance: Message<T>;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -2298,6 +2402,8 @@ export namespace util {
* @returns `this`
*/
public emit(evt: string, ...args: any[]): this;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Reads / writes floats / doubles from / to buffers. */
@@ -2497,6 +2603,8 @@ export interface IWrapper {
/** To object converter */
toObject?: WrapperToObjectConverter;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Wire format writer using `Uint8Array` if available, otherwise `Array`. */
@@ -2664,6 +2772,8 @@ export class Writer {
* @returns Finished buffer
*/
public finish(): Uint8Array;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/** Wire format writer using node buffers. */
@@ -2684,6 +2794,8 @@ export class BufferWriter extends Writer {
* @returns Finished buffer
*/
public finish(): Buffer;
+
+ public $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
@@ -2723,6 +2835,8 @@ export interface IFetchOptions {
/** If `true`, forces the use of XMLHttpRequest */
xhr?: boolean;
+
+ $unknownFields?: ReadonlyArray<Uint8Array>;
}
/**
diff --git a/node_modules/protobufjs/src/decoder.js b/node_modules/protobufjs/src/decoder.js
index f55451f..31aa011 100644
--- a/node_modules/protobufjs/src/decoder.js
+++ b/node_modules/protobufjs/src/decoder.js
@@ -21,6 +21,7 @@ function decoder(mtype) {
("r=Reader.create(r)")
("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : ""))
("while(r.pos<c){")
+ ("var unknownStartPos = r.pos")
("var t=r.uint32()");
if (mtype.group) gen
("if((t&7)===4)")
@@ -28,6 +29,8 @@ function decoder(mtype) {
gen
("switch(t>>>3){");
+ var unknownRef = "m" + util.safeProp("$unknownFields");
+
var i = 0;
for (; i < /* initializes */ mtype.fieldsArray.length; ++i) {
var field = mtype._fieldsArray[i].resolve(),
@@ -110,6 +113,11 @@ function decoder(mtype) {
} gen
("default:")
("r.skipType(t&7)")
+ ("if (!(%s)) {", unknownRef)
+ ("%s = []", unknownRef)
+ ("}")
+
+ ("%s.push(r.buf.slice(unknownStartPos, r.pos))", unknownRef)
("break")
("}")
diff --git a/node_modules/protobufjs/src/encoder.js b/node_modules/protobufjs/src/encoder.js
index c803e99..c44439e 100644
--- a/node_modules/protobufjs/src/encoder.js
+++ b/node_modules/protobufjs/src/encoder.js
@@ -36,6 +36,21 @@ function encoder(mtype) {
// "when a message is serialized its known fields should be written sequentially by field number"
var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById);
+ var unknownRef = "m" + util.safeProp("$unknownFields");
+
+ // Redecode unknown fields and apply them to the message before encoding
+ gen
+ ("var fullyUnknown=[]")
+ ("if(%s) {", unknownRef)
+ ("for(var i=0;i<%s.length;++i) {", unknownRef)
+ ("try {")
+ ("var known=this.ctor.decode(%s[i])", unknownRef)
+ ("fullyUnknown=fullyUnknown.concat(known.$unknownFields||[])")
+ ("m=Object.assign(known,m)")
+ ("}catch(_){}")
+ ("}")
+ ("}")
+
for (var i = 0; i < fields.length; ++i) {
var field = fields[i].resolve(),
index = mtype._fieldsArray.indexOf(field),
@@ -94,6 +109,11 @@ function encoder(mtype) {
}
}
+ gen
+ ("for(var i=0;i<fullyUnknown.length;++i) {")
+ ("w._unknownField(fullyUnknown[i])")
+ ("}")
+
return gen
("return w");
/* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */
diff --git a/node_modules/protobufjs/src/writer.js b/node_modules/protobufjs/src/writer.js
index cc84a00..8422f89 100644
--- a/node_modules/protobufjs/src/writer.js
+++ b/node_modules/protobufjs/src/writer.js
@@ -383,6 +383,11 @@ Writer.prototype.bytes = function write_bytes(value) {
return this.uint32(len)._push(writeBytes, len, value);
};
+
+Writer.prototype._unknownField = function __unknownField(field) {
+ return this._push(writeBytes, field.length, field);
+};
+
/**
* Writes a string.
* @param {string} value Value to write