protobufjs 8.5.0 → 8.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -57
- package/dist/light/protobuf.js +159 -121
- package/dist/light/protobuf.js.map +1 -1
- package/dist/light/protobuf.min.js +3 -3
- package/dist/light/protobuf.min.js.map +1 -1
- package/dist/minimal/protobuf.js +26 -69
- package/dist/minimal/protobuf.js.map +1 -1
- package/dist/minimal/protobuf.min.js +3 -3
- package/dist/minimal/protobuf.min.js.map +1 -1
- package/dist/protobuf.js +174 -122
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/ext/README.md +38 -49
- package/ext/descriptor.d.ts +8 -7
- package/ext/descriptor.generated.d.ts +16 -8
- package/ext/descriptor.js +170 -104
- package/ext/protojson.LICENSE +201 -0
- package/ext/protojson.d.ts +20 -0
- package/ext/protojson.generated.d.ts +49 -0
- package/ext/protojson.js +925 -0
- package/ext/textformat.d.ts +2 -2
- package/ext/textformat.generated.d.ts +22 -0
- package/ext/textformat.js +40 -19
- package/index.d.ts +35 -17
- package/package.json +2 -6
- package/src/converter.js +3 -3
- package/src/decoder.js +2 -2
- package/src/encoder.js +1 -1
- package/src/field.js +49 -7
- package/src/mapfield.js +16 -7
- package/src/parse.js +15 -1
- package/src/service.js +5 -7
- package/src/type.js +12 -3
- package/src/util/minimal.js +1 -4
- package/src/util.js +23 -0
- package/src/verifier.js +2 -2
- package/scripts/postinstall.js +0 -32
- package/src/util/inquire.d.ts +0 -10
- package/src/util/inquire.js +0 -38
package/dist/protobuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* protobuf.js v8.
|
|
3
|
-
* compiled
|
|
2
|
+
* protobuf.js v8.6.1 (c) 2016, daniel wirtz
|
|
3
|
+
* compiled sun, 07 jun 2026 00:06:12 utc
|
|
4
4
|
* licensed under the bsd-3-clause license
|
|
5
5
|
* see: https://github.com/dcodeio/protobuf.js for details
|
|
6
6
|
*/
|
|
@@ -549,7 +549,7 @@ function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
|
|
|
549
549
|
converter.fromObject = function fromObject(mtype) {
|
|
550
550
|
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
551
551
|
var fields = mtype.fieldsArray;
|
|
552
|
-
var gen = util.codegen(["d", "q"]
|
|
552
|
+
var gen = util.codegen(["d", "q"])
|
|
553
553
|
("if(d instanceof C)")
|
|
554
554
|
("return d")
|
|
555
555
|
("if(!util.isObject(d))")
|
|
@@ -683,7 +683,7 @@ converter.toObject = function toObject(mtype) {
|
|
|
683
683
|
var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
|
|
684
684
|
if (!fields.length)
|
|
685
685
|
return util.codegen()("return {}");
|
|
686
|
-
var gen = util.codegen(["m", "o", "q"]
|
|
686
|
+
var gen = util.codegen(["m", "o", "q"])
|
|
687
687
|
("if(!o)")
|
|
688
688
|
("o={}")
|
|
689
689
|
("if(q===undefined)q=0")
|
|
@@ -772,7 +772,7 @@ converter.toObject = function toObject(mtype) {
|
|
|
772
772
|
genValuePartial_toObject(gen, field, /* sorted */ index, prop + "[j]")
|
|
773
773
|
("}");
|
|
774
774
|
} else { gen
|
|
775
|
-
("if(m%s!=null&&
|
|
775
|
+
("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){", prop, field.name); // !== undefined && !== null
|
|
776
776
|
genValuePartial_toObject(gen, field, /* sorted */ index, prop);
|
|
777
777
|
if (field.partOf && !field.partOf.isProto3Optional) gen
|
|
778
778
|
("if(o.oneofs)")
|
|
@@ -815,7 +815,7 @@ function decoder(mtype) {
|
|
|
815
815
|
if (!pfield.repeated && !pfield.map && !pfield.hasPresence)
|
|
816
816
|
hasImplicitPresenceField = true;
|
|
817
817
|
}
|
|
818
|
-
var gen = util.codegen(["r", "l", "z", "q", "g"]
|
|
818
|
+
var gen = util.codegen(["r", "l", "z", "q", "g"])
|
|
819
819
|
("if(!(r instanceof Reader))")
|
|
820
820
|
("r=Reader.create(r)")
|
|
821
821
|
("if(q===undefined)q=0")
|
|
@@ -987,7 +987,7 @@ function decoder(mtype) {
|
|
|
987
987
|
for (i = 0; i < mtype._fieldsArray.length; ++i) {
|
|
988
988
|
var rfield = mtype._fieldsArray[i];
|
|
989
989
|
if (rfield.required) gen
|
|
990
|
-
("if(!
|
|
990
|
+
("if(!Object.hasOwnProperty.call(m,%j))", rfield.name)
|
|
991
991
|
("throw util.ProtocolError(%j,{instance:m})", missing(rfield));
|
|
992
992
|
}
|
|
993
993
|
|
|
@@ -1026,7 +1026,7 @@ function genTypePartial(gen, field, fieldIndex, ref) {
|
|
|
1026
1026
|
*/
|
|
1027
1027
|
function encoder(mtype) {
|
|
1028
1028
|
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
|
|
1029
|
-
var gen = util.codegen(["m", "w", "q"]
|
|
1029
|
+
var gen = util.codegen(["m", "w", "q"])
|
|
1030
1030
|
("if(!w)")
|
|
1031
1031
|
("w=Writer.create()")
|
|
1032
1032
|
("if(q===undefined)q=0")
|
|
@@ -1383,6 +1383,12 @@ Field.fromJSON = function fromJSON(name, json) {
|
|
|
1383
1383
|
var field = new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment);
|
|
1384
1384
|
if (json.edition)
|
|
1385
1385
|
field._edition = json.edition;
|
|
1386
|
+
if (json.protoName)
|
|
1387
|
+
field.protoName = json.protoName;
|
|
1388
|
+
if (json.jsonName !== undefined)
|
|
1389
|
+
field.jsonName = json.jsonName;
|
|
1390
|
+
else if (json.options && json.options.json_name !== undefined)
|
|
1391
|
+
field.jsonName = json.options.json_name;
|
|
1386
1392
|
field._defaultEdition = "proto3"; // For backwards-compatibility.
|
|
1387
1393
|
return field;
|
|
1388
1394
|
};
|
|
@@ -1522,6 +1528,18 @@ function Field(name, id, type, rule, extend, options, comment) {
|
|
|
1522
1528
|
* @type {string|null}
|
|
1523
1529
|
*/
|
|
1524
1530
|
this.comment = comment;
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Field name as declared in the .proto source, if different from `name`.
|
|
1534
|
+
* @type {string|undefined}
|
|
1535
|
+
*/
|
|
1536
|
+
this.protoName = undefined;
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* JSON name, if different from the derived default.
|
|
1540
|
+
* @type {string|undefined}
|
|
1541
|
+
*/
|
|
1542
|
+
this.jsonName = undefined;
|
|
1525
1543
|
}
|
|
1526
1544
|
|
|
1527
1545
|
/**
|
|
@@ -1591,6 +1609,22 @@ Object.defineProperty(Field.prototype, "hasPresence", {
|
|
|
1591
1609
|
}
|
|
1592
1610
|
});
|
|
1593
1611
|
|
|
1612
|
+
/**
|
|
1613
|
+
* The field name as declared in the .proto source (snake_case). Populated on resolve,
|
|
1614
|
+
* falling back to `name`. Mirrors `FieldDescriptorProto.name`.
|
|
1615
|
+
* @name Field#protoName
|
|
1616
|
+
* @type {string}
|
|
1617
|
+
* @readonly
|
|
1618
|
+
*/
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* The JSON name of this field (lowerCamelCase per protoc's `ToJsonName`, or an
|
|
1622
|
+
* explicit `[json_name]`). Populated on resolve. This is the key used on ProtoJSON output.
|
|
1623
|
+
* @name Field#jsonName
|
|
1624
|
+
* @type {string}
|
|
1625
|
+
* @readonly
|
|
1626
|
+
*/
|
|
1627
|
+
|
|
1594
1628
|
/**
|
|
1595
1629
|
* @override
|
|
1596
1630
|
*/
|
|
@@ -1624,13 +1658,15 @@ Field.prototype.setOption = function setOption(name, value, ifNotSet) {
|
|
|
1624
1658
|
Field.prototype.toJSON = function toJSON(toJSONOptions) {
|
|
1625
1659
|
var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
|
|
1626
1660
|
return util.toObject([
|
|
1627
|
-
"edition"
|
|
1628
|
-
"rule"
|
|
1629
|
-
"type"
|
|
1630
|
-
"id"
|
|
1631
|
-
"extend"
|
|
1632
|
-
"
|
|
1633
|
-
"
|
|
1661
|
+
"edition" , this._editionToJSON(),
|
|
1662
|
+
"rule" , this.rule !== "optional" && this.rule || undefined,
|
|
1663
|
+
"type" , this.type,
|
|
1664
|
+
"id" , this.id,
|
|
1665
|
+
"extend" , this.extend,
|
|
1666
|
+
"protoName" , this.protoName !== this.name ? this.protoName : undefined,
|
|
1667
|
+
"jsonName" , this.jsonName !== util.jsonName(this.protoName || this.name) ? this.jsonName : undefined,
|
|
1668
|
+
"options" , this.options,
|
|
1669
|
+
"comment" , keepComments ? this.comment : undefined
|
|
1634
1670
|
]);
|
|
1635
1671
|
};
|
|
1636
1672
|
|
|
@@ -1699,6 +1735,12 @@ Field.prototype.resolve = function resolve() {
|
|
|
1699
1735
|
if (this.parent instanceof Type && this.parent._ctor)
|
|
1700
1736
|
this.parent._ctor.prototype[this.name] = this.defaultValue;
|
|
1701
1737
|
|
|
1738
|
+
// derive the proto/JSON names
|
|
1739
|
+
if (this.protoName === undefined)
|
|
1740
|
+
this.protoName = this.name;
|
|
1741
|
+
if (this.jsonName === undefined)
|
|
1742
|
+
this.jsonName = util.jsonName(this.protoName);
|
|
1743
|
+
|
|
1702
1744
|
return ReflectionObject.prototype.resolve.call(this);
|
|
1703
1745
|
};
|
|
1704
1746
|
|
|
@@ -1876,7 +1918,7 @@ protobuf.loadSync = loadSync;
|
|
|
1876
1918
|
// Serialization
|
|
1877
1919
|
protobuf.encoder = require(5);
|
|
1878
1920
|
protobuf.decoder = require(4);
|
|
1879
|
-
protobuf.verifier = require(
|
|
1921
|
+
protobuf.verifier = require(42);
|
|
1880
1922
|
protobuf.converter = require(3);
|
|
1881
1923
|
|
|
1882
1924
|
// Reflection
|
|
@@ -1893,7 +1935,7 @@ protobuf.Method = require(13);
|
|
|
1893
1935
|
|
|
1894
1936
|
// Runtime
|
|
1895
1937
|
protobuf.Message = require(12);
|
|
1896
|
-
protobuf.wrappers = require(
|
|
1938
|
+
protobuf.wrappers = require(43);
|
|
1897
1939
|
|
|
1898
1940
|
// Utility
|
|
1899
1941
|
protobuf.types = require(27);
|
|
@@ -1905,7 +1947,7 @@ protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
|
|
|
1905
1947
|
protobuf.Root._configure(protobuf.Type, undefined, {});
|
|
1906
1948
|
protobuf.Field._configure(protobuf.Type);
|
|
1907
1949
|
|
|
1908
|
-
},{"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"20":20,"24":24,"26":26,"27":27,"28":28,"3":3,"4":4,"
|
|
1950
|
+
},{"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"20":20,"24":24,"26":26,"27":27,"28":28,"3":3,"4":4,"42":42,"43":43,"5":5,"6":6,"7":7,"9":9}],9:[function(require,module,exports){
|
|
1909
1951
|
"use strict";
|
|
1910
1952
|
var protobuf = exports;
|
|
1911
1953
|
|
|
@@ -1918,13 +1960,13 @@ var protobuf = exports;
|
|
|
1918
1960
|
protobuf.build = "minimal";
|
|
1919
1961
|
|
|
1920
1962
|
// Serialization
|
|
1921
|
-
protobuf.Writer = require(
|
|
1922
|
-
protobuf.BufferWriter = require(
|
|
1963
|
+
protobuf.Writer = require(44);
|
|
1964
|
+
protobuf.BufferWriter = require(45);
|
|
1923
1965
|
protobuf.Reader = require(18);
|
|
1924
1966
|
protobuf.BufferReader = require(19);
|
|
1925
1967
|
|
|
1926
1968
|
// Utility
|
|
1927
|
-
protobuf.util = require(
|
|
1969
|
+
protobuf.util = require(37);
|
|
1928
1970
|
protobuf.rpc = require(22);
|
|
1929
1971
|
protobuf.roots = require(21);
|
|
1930
1972
|
protobuf.configure = configure;
|
|
@@ -1943,7 +1985,7 @@ function configure() {
|
|
|
1943
1985
|
// Set up buffer utility according to the environment
|
|
1944
1986
|
configure();
|
|
1945
1987
|
|
|
1946
|
-
},{"18":18,"19":19,"21":21,"22":22,"
|
|
1988
|
+
},{"18":18,"19":19,"21":21,"22":22,"37":37,"44":44,"45":45}],10:[function(require,module,exports){
|
|
1947
1989
|
"use strict";
|
|
1948
1990
|
var protobuf = module.exports = require(8);
|
|
1949
1991
|
|
|
@@ -2025,7 +2067,14 @@ function MapField(name, id, keyType, type, options, comment) {
|
|
|
2025
2067
|
* @throws {TypeError} If arguments are invalid
|
|
2026
2068
|
*/
|
|
2027
2069
|
MapField.fromJSON = function fromJSON(name, json) {
|
|
2028
|
-
|
|
2070
|
+
var field = new MapField(name, json.id, json.keyType, json.type, json.options, json.comment);
|
|
2071
|
+
if (json.protoName)
|
|
2072
|
+
field.protoName = json.protoName;
|
|
2073
|
+
if (json.jsonName !== undefined)
|
|
2074
|
+
field.jsonName = json.jsonName;
|
|
2075
|
+
else if (json.options && json.options.json_name !== undefined)
|
|
2076
|
+
field.jsonName = json.options.json_name;
|
|
2077
|
+
return field;
|
|
2029
2078
|
};
|
|
2030
2079
|
|
|
2031
2080
|
/**
|
|
@@ -2036,12 +2085,14 @@ MapField.fromJSON = function fromJSON(name, json) {
|
|
|
2036
2085
|
MapField.prototype.toJSON = function toJSON(toJSONOptions) {
|
|
2037
2086
|
var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
|
|
2038
2087
|
return util.toObject([
|
|
2039
|
-
"keyType"
|
|
2040
|
-
"type"
|
|
2041
|
-
"id"
|
|
2042
|
-
"extend"
|
|
2043
|
-
"
|
|
2044
|
-
"
|
|
2088
|
+
"keyType" , this.keyType,
|
|
2089
|
+
"type" , this.type,
|
|
2090
|
+
"id" , this.id,
|
|
2091
|
+
"extend" , this.extend,
|
|
2092
|
+
"protoName" , this.protoName !== this.name ? this.protoName : undefined,
|
|
2093
|
+
"jsonName" , this.jsonName !== util.jsonName(this.protoName || this.name) ? this.jsonName : undefined,
|
|
2094
|
+
"options" , this.options,
|
|
2095
|
+
"comment" , keepComments ? this.comment : undefined
|
|
2045
2096
|
]);
|
|
2046
2097
|
};
|
|
2047
2098
|
|
|
@@ -2090,7 +2141,7 @@ MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) {
|
|
|
2090
2141
|
"use strict";
|
|
2091
2142
|
module.exports = Message;
|
|
2092
2143
|
|
|
2093
|
-
var util = require(
|
|
2144
|
+
var util = require(37);
|
|
2094
2145
|
|
|
2095
2146
|
/**
|
|
2096
2147
|
* Constructs a new message instance.
|
|
@@ -2225,7 +2276,7 @@ Message.prototype.toJSON = function toJSON() {
|
|
|
2225
2276
|
return this.$type.toObject(this, util.toJSONOptions);
|
|
2226
2277
|
};
|
|
2227
2278
|
|
|
2228
|
-
},{"
|
|
2279
|
+
},{"37":37}],13:[function(require,module,exports){
|
|
2229
2280
|
"use strict";
|
|
2230
2281
|
module.exports = Method;
|
|
2231
2282
|
|
|
@@ -4065,10 +4116,13 @@ function parse(source, root, options) {
|
|
|
4065
4116
|
if (!nameRe.test(name))
|
|
4066
4117
|
throw illegal(name, "name");
|
|
4067
4118
|
|
|
4119
|
+
var protoName = name;
|
|
4068
4120
|
name = applyCase(name);
|
|
4069
4121
|
skip("=");
|
|
4070
4122
|
|
|
4071
4123
|
var field = new Field(name, parseId(next()), type, rule === "proto3_optional" ? "optional" : rule, extend);
|
|
4124
|
+
if (protoName !== name)
|
|
4125
|
+
field.protoName = protoName;
|
|
4072
4126
|
|
|
4073
4127
|
ifBlock(field, function parseField_block(token) {
|
|
4074
4128
|
|
|
@@ -4210,7 +4264,11 @@ function parse(source, root, options) {
|
|
|
4210
4264
|
throw illegal(name, "name");
|
|
4211
4265
|
|
|
4212
4266
|
skip("=");
|
|
4213
|
-
var
|
|
4267
|
+
var protoName = name;
|
|
4268
|
+
name = applyCase(name);
|
|
4269
|
+
var field = new MapField(name, parseId(next()), keyType, valueType);
|
|
4270
|
+
if (protoName !== name)
|
|
4271
|
+
field.protoName = protoName;
|
|
4214
4272
|
ifBlock(field, function parseMapField_block(token) {
|
|
4215
4273
|
|
|
4216
4274
|
/* istanbul ignore else */
|
|
@@ -4422,11 +4480,18 @@ function parse(source, root, options) {
|
|
|
4422
4480
|
topLevelOptions[name] = value;
|
|
4423
4481
|
return;
|
|
4424
4482
|
}
|
|
4483
|
+
// lift json_name onto Field
|
|
4484
|
+
if (name === "json_name" && parent instanceof Field) {
|
|
4485
|
+
parent.jsonName = value;
|
|
4486
|
+
return;
|
|
4487
|
+
}
|
|
4425
4488
|
if (parent.setOption)
|
|
4426
4489
|
parent.setOption(name, value);
|
|
4427
4490
|
}
|
|
4428
4491
|
|
|
4429
4492
|
function setParsedOption(parent, name, value, propName) {
|
|
4493
|
+
if (name === "json_name" && parent instanceof Field)
|
|
4494
|
+
return; // lifted onto Field#jsonName above
|
|
4430
4495
|
if (parent.setParsedOption)
|
|
4431
4496
|
parent.setParsedOption(name, value, propName);
|
|
4432
4497
|
}
|
|
@@ -4640,7 +4705,7 @@ function parse(source, root, options) {
|
|
|
4640
4705
|
"use strict";
|
|
4641
4706
|
module.exports = Reader;
|
|
4642
4707
|
|
|
4643
|
-
var util = require(
|
|
4708
|
+
var util = require(37);
|
|
4644
4709
|
|
|
4645
4710
|
var BufferReader; // cyclic
|
|
4646
4711
|
|
|
@@ -5181,7 +5246,7 @@ Reader._configure = function(BufferReader_) {
|
|
|
5181
5246
|
});
|
|
5182
5247
|
};
|
|
5183
5248
|
|
|
5184
|
-
},{"
|
|
5249
|
+
},{"37":37}],19:[function(require,module,exports){
|
|
5185
5250
|
"use strict";
|
|
5186
5251
|
module.exports = BufferReader;
|
|
5187
5252
|
|
|
@@ -5189,7 +5254,7 @@ module.exports = BufferReader;
|
|
|
5189
5254
|
var Reader = require(18);
|
|
5190
5255
|
(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
|
|
5191
5256
|
|
|
5192
|
-
var util = require(
|
|
5257
|
+
var util = require(37);
|
|
5193
5258
|
|
|
5194
5259
|
/**
|
|
5195
5260
|
* Constructs a new buffer reader instance.
|
|
@@ -5255,7 +5320,7 @@ BufferReader.prototype.string = function read_string_buffer() {
|
|
|
5255
5320
|
|
|
5256
5321
|
BufferReader._configure();
|
|
5257
5322
|
|
|
5258
|
-
},{"18":18,"
|
|
5323
|
+
},{"18":18,"37":37}],20:[function(require,module,exports){
|
|
5259
5324
|
"use strict";
|
|
5260
5325
|
module.exports = Root;
|
|
5261
5326
|
|
|
@@ -5735,7 +5800,7 @@ rpc.Service = require(23);
|
|
|
5735
5800
|
"use strict";
|
|
5736
5801
|
module.exports = Service;
|
|
5737
5802
|
|
|
5738
|
-
var util = require(
|
|
5803
|
+
var util = require(37);
|
|
5739
5804
|
|
|
5740
5805
|
// Extends EventEmitter
|
|
5741
5806
|
(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
|
|
@@ -5881,7 +5946,7 @@ Service.prototype.end = function end(endedByRPC) {
|
|
|
5881
5946
|
return this;
|
|
5882
5947
|
};
|
|
5883
5948
|
|
|
5884
|
-
},{"
|
|
5949
|
+
},{"37":37}],24:[function(require,module,exports){
|
|
5885
5950
|
"use strict";
|
|
5886
5951
|
module.exports = Service;
|
|
5887
5952
|
|
|
@@ -5893,8 +5958,6 @@ var Method = require(13),
|
|
|
5893
5958
|
util = require(28),
|
|
5894
5959
|
rpc = require(22);
|
|
5895
5960
|
|
|
5896
|
-
var reservedRe = util.patterns.reservedRe;
|
|
5897
|
-
|
|
5898
5961
|
/**
|
|
5899
5962
|
* Constructs a new service instance.
|
|
5900
5963
|
* @classdesc Reflected service.
|
|
@@ -6074,11 +6137,11 @@ Service.prototype.create = function create(rpcImpl, requestDelimited, responseDe
|
|
|
6074
6137
|
var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
|
|
6075
6138
|
for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
|
|
6076
6139
|
var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
|
|
6077
|
-
rpcService[methodName] =
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
});
|
|
6140
|
+
rpcService[methodName] = (function(method, requestType, responseType) {
|
|
6141
|
+
return function rpcMethod(request, callback) {
|
|
6142
|
+
return rpc.Service.prototype.rpcCall.call(this, method, requestType, responseType, request, callback);
|
|
6143
|
+
};
|
|
6144
|
+
})(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
|
|
6082
6145
|
}
|
|
6083
6146
|
return rpcService;
|
|
6084
6147
|
};
|
|
@@ -6521,13 +6584,13 @@ var Enum = require(6),
|
|
|
6521
6584
|
Service = require(24),
|
|
6522
6585
|
Message = require(12),
|
|
6523
6586
|
Reader = require(18),
|
|
6524
|
-
Writer = require(
|
|
6587
|
+
Writer = require(44),
|
|
6525
6588
|
util = require(28),
|
|
6526
6589
|
encoder = require(5),
|
|
6527
6590
|
decoder = require(4),
|
|
6528
|
-
verifier = require(
|
|
6591
|
+
verifier = require(42),
|
|
6529
6592
|
converter = require(3),
|
|
6530
|
-
wrappers = require(
|
|
6593
|
+
wrappers = require(43);
|
|
6531
6594
|
|
|
6532
6595
|
/**
|
|
6533
6596
|
* Constructs a new reflected message type instance.
|
|
@@ -6598,6 +6661,13 @@ function Type(name, options) {
|
|
|
6598
6661
|
* @private
|
|
6599
6662
|
*/
|
|
6600
6663
|
this._ctor = null;
|
|
6664
|
+
|
|
6665
|
+
/**
|
|
6666
|
+
* Cached fields by JSON name.
|
|
6667
|
+
* @type {Object.<string,Field>|null}
|
|
6668
|
+
* @private
|
|
6669
|
+
*/
|
|
6670
|
+
this._fieldsByJsonName = null; // used by ext/protojson
|
|
6601
6671
|
}
|
|
6602
6672
|
|
|
6603
6673
|
Object.defineProperties(Type.prototype, {
|
|
@@ -6710,7 +6780,7 @@ Object.defineProperties(Type.prototype, {
|
|
|
6710
6780
|
*/
|
|
6711
6781
|
Type.generateConstructor = function generateConstructor(mtype) {
|
|
6712
6782
|
/* eslint-disable no-unexpected-multiline */
|
|
6713
|
-
var gen = util.codegen(["p"]
|
|
6783
|
+
var gen = util.codegen(["p"]);
|
|
6714
6784
|
// explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype
|
|
6715
6785
|
for (var i = 0, field; i < mtype.fieldsArray.length; ++i)
|
|
6716
6786
|
if ((field = mtype._fieldsArray[i]).map) gen
|
|
@@ -6724,7 +6794,7 @@ Type.generateConstructor = function generateConstructor(mtype) {
|
|
|
6724
6794
|
};
|
|
6725
6795
|
|
|
6726
6796
|
function clearCache(type) {
|
|
6727
|
-
type._fieldsById = type._fieldsArray = type._oneofsArray = null;
|
|
6797
|
+
type._fieldsById = type._fieldsArray = type._oneofsArray = type._fieldsByJsonName = null;
|
|
6728
6798
|
delete type.encode;
|
|
6729
6799
|
delete type.decode;
|
|
6730
6800
|
delete type.verify;
|
|
@@ -6888,7 +6958,7 @@ Type.prototype.add = function add(object) {
|
|
|
6888
6958
|
throw Error("duplicate id " + object.id + " in " + this);
|
|
6889
6959
|
if (this.isReservedId(object.id))
|
|
6890
6960
|
throw Error("id " + object.id + " is reserved in " + this);
|
|
6891
|
-
if (this.isReservedName(object.name))
|
|
6961
|
+
if (this.isReservedName(object.name) || object.name.charAt(0) === "$")
|
|
6892
6962
|
throw Error("name '" + object.name + "' is reserved in " + this);
|
|
6893
6963
|
if (object.name === "__proto__")
|
|
6894
6964
|
return this;
|
|
@@ -6901,6 +6971,8 @@ Type.prototype.add = function add(object) {
|
|
|
6901
6971
|
return clearCache(this);
|
|
6902
6972
|
}
|
|
6903
6973
|
if (object instanceof OneOf) {
|
|
6974
|
+
if (object.name.charAt(0) === "$")
|
|
6975
|
+
throw Error("name '" + object.name + "' is reserved in " + this);
|
|
6904
6976
|
if (object.name === "__proto__")
|
|
6905
6977
|
return this;
|
|
6906
6978
|
if (!this.oneofs)
|
|
@@ -7154,7 +7226,7 @@ Type.d = function decorateType(typeName) {
|
|
|
7154
7226
|
};
|
|
7155
7227
|
};
|
|
7156
7228
|
|
|
7157
|
-
},{"11":11,"12":12,"14":14,"16":16,"18":18,"24":24,"28":28,"3":3,"4":4,"43":43,"44":44,"
|
|
7229
|
+
},{"11":11,"12":12,"14":14,"16":16,"18":18,"24":24,"28":28,"3":3,"4":4,"42":42,"43":43,"44":44,"5":5,"6":6,"7":7}],27:[function(require,module,exports){
|
|
7158
7230
|
"use strict";
|
|
7159
7231
|
|
|
7160
7232
|
/**
|
|
@@ -7359,7 +7431,7 @@ types.packed = bake([
|
|
|
7359
7431
|
* Various utility functions.
|
|
7360
7432
|
* @namespace
|
|
7361
7433
|
*/
|
|
7362
|
-
var util = module.exports = require(
|
|
7434
|
+
var util = module.exports = require(37);
|
|
7363
7435
|
|
|
7364
7436
|
var roots = require(21);
|
|
7365
7437
|
|
|
@@ -7368,8 +7440,8 @@ var Type, // cyclic
|
|
|
7368
7440
|
|
|
7369
7441
|
util.codegen = require(31);
|
|
7370
7442
|
util.fetch = require(33);
|
|
7371
|
-
util.path = require(
|
|
7372
|
-
util.patterns = require(
|
|
7443
|
+
util.path = require(38);
|
|
7444
|
+
util.patterns = require(39);
|
|
7373
7445
|
|
|
7374
7446
|
var reservedRe = util.patterns.reservedRe;
|
|
7375
7447
|
|
|
@@ -7448,6 +7520,7 @@ var camelCaseRe = /_([a-z])/g;
|
|
|
7448
7520
|
* Converts a string to camel case.
|
|
7449
7521
|
* @param {string} str String to convert
|
|
7450
7522
|
* @returns {string} Converted string
|
|
7523
|
+
* @deprecated Use {@link util.jsonName} for protobuf field JSON names.
|
|
7451
7524
|
*/
|
|
7452
7525
|
util.camelCase = function camelCase(str) {
|
|
7453
7526
|
return str.substring(0, 1)
|
|
@@ -7455,6 +7528,28 @@ util.camelCase = function camelCase(str) {
|
|
|
7455
7528
|
.replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); });
|
|
7456
7529
|
};
|
|
7457
7530
|
|
|
7531
|
+
/**
|
|
7532
|
+
* Converts a proto field name to its protoc-compatible JSON name.
|
|
7533
|
+
* @param {string} str Proto field name
|
|
7534
|
+
* @returns {string} JSON name
|
|
7535
|
+
*/
|
|
7536
|
+
util.jsonName = function jsonName(str) {
|
|
7537
|
+
var result = "",
|
|
7538
|
+
upperNext = false,
|
|
7539
|
+
i = 0;
|
|
7540
|
+
for (; i < str.length; ++i) {
|
|
7541
|
+
var ch = str.charAt(i);
|
|
7542
|
+
if (ch === "_")
|
|
7543
|
+
upperNext = true;
|
|
7544
|
+
else if (upperNext) {
|
|
7545
|
+
result += ch.toUpperCase();
|
|
7546
|
+
upperNext = false;
|
|
7547
|
+
} else
|
|
7548
|
+
result += ch;
|
|
7549
|
+
}
|
|
7550
|
+
return result;
|
|
7551
|
+
};
|
|
7552
|
+
|
|
7458
7553
|
/**
|
|
7459
7554
|
* Compares reflected fields by id.
|
|
7460
7555
|
* @param {Field} a First field
|
|
@@ -7573,7 +7668,7 @@ Object.defineProperty(util, "decorateRoot", {
|
|
|
7573
7668
|
}
|
|
7574
7669
|
});
|
|
7575
7670
|
|
|
7576
|
-
},{"20":20,"21":21,"26":26,"31":31,"33":33,"35":35,"38":38,"39":39,"
|
|
7671
|
+
},{"20":20,"21":21,"26":26,"31":31,"33":33,"35":35,"37":37,"38":38,"39":39,"6":6}],29:[function(require,module,exports){
|
|
7577
7672
|
"use strict";
|
|
7578
7673
|
module.exports = asPromise;
|
|
7579
7674
|
|
|
@@ -7779,7 +7874,7 @@ base64.test = function test(string) {
|
|
|
7779
7874
|
"use strict";
|
|
7780
7875
|
module.exports = codegen;
|
|
7781
7876
|
|
|
7782
|
-
var patterns = require(
|
|
7877
|
+
var patterns = require(39);
|
|
7783
7878
|
var reservedRe = patterns.reservedRe;
|
|
7784
7879
|
|
|
7785
7880
|
/**
|
|
@@ -7890,7 +7985,7 @@ function safeFunctionName(name) {
|
|
|
7890
7985
|
return reservedRe.test(name) ? name + "_" : name;
|
|
7891
7986
|
}
|
|
7892
7987
|
|
|
7893
|
-
},{"
|
|
7988
|
+
},{"39":39}],32:[function(require,module,exports){
|
|
7894
7989
|
"use strict";
|
|
7895
7990
|
module.exports = EventEmitter;
|
|
7896
7991
|
|
|
@@ -8444,49 +8539,9 @@ module.exports = fs;
|
|
|
8444
8539
|
|
|
8445
8540
|
},{"1":1}],36:[function(require,module,exports){
|
|
8446
8541
|
"use strict";
|
|
8447
|
-
module.exports = inquire;
|
|
8448
|
-
|
|
8449
|
-
/**
|
|
8450
|
-
* Requires a module only if available.
|
|
8451
|
-
* @memberof util
|
|
8452
|
-
* @param {string} moduleName Module to require
|
|
8453
|
-
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
|
8454
|
-
* @deprecated Legacy optional require helper. Will be removed in a future release.
|
|
8455
|
-
*/
|
|
8456
|
-
function inquire(moduleName) {
|
|
8457
|
-
try {
|
|
8458
|
-
if (typeof require !== "function") {
|
|
8459
|
-
return null;
|
|
8460
|
-
}
|
|
8461
|
-
var mod = require(moduleName);
|
|
8462
|
-
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
|
8463
|
-
return null;
|
|
8464
|
-
} catch (err) {
|
|
8465
|
-
// ignore
|
|
8466
|
-
return null;
|
|
8467
|
-
}
|
|
8468
|
-
}
|
|
8469
|
-
|
|
8470
|
-
/*
|
|
8471
|
-
// maybe worth a shot to prevent renaming issues:
|
|
8472
|
-
// see: https://github.com/webpack/webpack/blob/master/lib/dependencies/CommonJsRequireDependencyParserPlugin.js
|
|
8473
|
-
// triggers on:
|
|
8474
|
-
// - expression require.cache
|
|
8475
|
-
// - expression require (???)
|
|
8476
|
-
// - call require
|
|
8477
|
-
// - call require:commonjs:item
|
|
8478
|
-
// - call require:commonjs:context
|
|
8479
|
-
|
|
8480
|
-
Object.defineProperty(Function.prototype, "__self", { get: function() { return this; } });
|
|
8481
|
-
var r = require.__self;
|
|
8482
|
-
delete Function.prototype.__self;
|
|
8483
|
-
*/
|
|
8484
|
-
|
|
8485
|
-
},{}],37:[function(require,module,exports){
|
|
8486
|
-
"use strict";
|
|
8487
8542
|
module.exports = LongBits;
|
|
8488
8543
|
|
|
8489
|
-
var util = require(
|
|
8544
|
+
var util = require(37);
|
|
8490
8545
|
|
|
8491
8546
|
/**
|
|
8492
8547
|
* Constructs new long bits.
|
|
@@ -8684,7 +8739,7 @@ LongBits.prototype.length = function length() {
|
|
|
8684
8739
|
: part2 < 128 ? 9 : 10;
|
|
8685
8740
|
};
|
|
8686
8741
|
|
|
8687
|
-
},{"
|
|
8742
|
+
},{"37":37}],37:[function(require,module,exports){
|
|
8688
8743
|
"use strict";
|
|
8689
8744
|
var util = exports;
|
|
8690
8745
|
|
|
@@ -8700,17 +8755,14 @@ util.EventEmitter = require(32);
|
|
|
8700
8755
|
// float handling accross browsers
|
|
8701
8756
|
util.float = require(34);
|
|
8702
8757
|
|
|
8703
|
-
// requires modules optionally and hides the call from bundlers
|
|
8704
|
-
util.inquire = require(36);
|
|
8705
|
-
|
|
8706
8758
|
// converts to / from utf8 encoded strings
|
|
8707
|
-
util.utf8 = require(
|
|
8759
|
+
util.utf8 = require(41);
|
|
8708
8760
|
|
|
8709
8761
|
// provides a node-like buffer pool in the browser
|
|
8710
|
-
util.pool = require(
|
|
8762
|
+
util.pool = require(40);
|
|
8711
8763
|
|
|
8712
8764
|
// utility to work with the low and high bits of a 64 bit value
|
|
8713
|
-
util.LongBits = require(
|
|
8765
|
+
util.LongBits = require(36);
|
|
8714
8766
|
|
|
8715
8767
|
/**
|
|
8716
8768
|
* Tests if the specified key can affect object prototypes.
|
|
@@ -8806,7 +8858,7 @@ util.isset =
|
|
|
8806
8858
|
*/
|
|
8807
8859
|
util.isSet = function isSet(obj, prop) {
|
|
8808
8860
|
var value = obj[prop];
|
|
8809
|
-
if (value != null &&
|
|
8861
|
+
if (value != null && Object.hasOwnProperty.call(obj, prop)) // eslint-disable-line eqeqeq
|
|
8810
8862
|
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
|
8811
8863
|
return false;
|
|
8812
8864
|
};
|
|
@@ -9204,7 +9256,7 @@ util._configure = function() {
|
|
|
9204
9256
|
};
|
|
9205
9257
|
};
|
|
9206
9258
|
|
|
9207
|
-
},{"29":29,"30":30,"32":32,"34":34,"36":36,"
|
|
9259
|
+
},{"29":29,"30":30,"32":32,"34":34,"36":36,"40":40,"41":41,"long":"long"}],38:[function(require,module,exports){
|
|
9208
9260
|
"use strict";
|
|
9209
9261
|
|
|
9210
9262
|
/**
|
|
@@ -9278,7 +9330,7 @@ path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
|
|
|
9278
9330
|
return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
|
|
9279
9331
|
};
|
|
9280
9332
|
|
|
9281
|
-
},{}],
|
|
9333
|
+
},{}],39:[function(require,module,exports){
|
|
9282
9334
|
"use strict";
|
|
9283
9335
|
|
|
9284
9336
|
var patterns = exports;
|
|
@@ -9287,7 +9339,7 @@ patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
|
|
|
9287
9339
|
patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
|
|
9288
9340
|
patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
|
|
9289
9341
|
|
|
9290
|
-
},{}],
|
|
9342
|
+
},{}],40:[function(require,module,exports){
|
|
9291
9343
|
"use strict";
|
|
9292
9344
|
module.exports = pool;
|
|
9293
9345
|
|
|
@@ -9337,7 +9389,7 @@ function pool(alloc, slice, size) {
|
|
|
9337
9389
|
};
|
|
9338
9390
|
}
|
|
9339
9391
|
|
|
9340
|
-
},{}],
|
|
9392
|
+
},{}],41:[function(require,module,exports){
|
|
9341
9393
|
"use strict";
|
|
9342
9394
|
|
|
9343
9395
|
/**
|
|
@@ -9469,7 +9521,7 @@ utf8.write = function utf8_write(string, buffer, offset) {
|
|
|
9469
9521
|
return offset - start;
|
|
9470
9522
|
};
|
|
9471
9523
|
|
|
9472
|
-
},{}],
|
|
9524
|
+
},{}],42:[function(require,module,exports){
|
|
9473
9525
|
"use strict";
|
|
9474
9526
|
module.exports = verifier;
|
|
9475
9527
|
|
|
@@ -9594,7 +9646,7 @@ function genVerifyKey(gen, field, ref) {
|
|
|
9594
9646
|
function verifier(mtype) {
|
|
9595
9647
|
/* eslint-disable no-unexpected-multiline */
|
|
9596
9648
|
|
|
9597
|
-
var gen = util.codegen(["m", "q"]
|
|
9649
|
+
var gen = util.codegen(["m", "q"])
|
|
9598
9650
|
("if(typeof m!==\"object\"||m===null)")
|
|
9599
9651
|
("return%j", "object expected")
|
|
9600
9652
|
("if(q===undefined)q=0")
|
|
@@ -9610,7 +9662,7 @@ function verifier(mtype) {
|
|
|
9610
9662
|
ref = "m" + util.safeProp(field.name);
|
|
9611
9663
|
|
|
9612
9664
|
if (field.optional) gen
|
|
9613
|
-
("if(%s!=null&&
|
|
9665
|
+
("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name); // !== undefined && !== null
|
|
9614
9666
|
|
|
9615
9667
|
// map fields
|
|
9616
9668
|
if (field.map) { gen
|
|
@@ -9651,7 +9703,7 @@ function verifier(mtype) {
|
|
|
9651
9703
|
/* eslint-enable no-unexpected-multiline */
|
|
9652
9704
|
}
|
|
9653
9705
|
|
|
9654
|
-
},{"28":28,"6":6}],
|
|
9706
|
+
},{"28":28,"6":6}],43:[function(require,module,exports){
|
|
9655
9707
|
"use strict";
|
|
9656
9708
|
|
|
9657
9709
|
/**
|
|
@@ -9662,7 +9714,7 @@ function verifier(mtype) {
|
|
|
9662
9714
|
var wrappers = exports;
|
|
9663
9715
|
|
|
9664
9716
|
var Message = require(12),
|
|
9665
|
-
util = require(
|
|
9717
|
+
util = require(37);
|
|
9666
9718
|
|
|
9667
9719
|
/**
|
|
9668
9720
|
* From object converter part of an {@link IWrapper}.
|
|
@@ -9759,11 +9811,11 @@ wrappers[".google.protobuf.Any"] = {
|
|
|
9759
9811
|
}
|
|
9760
9812
|
};
|
|
9761
9813
|
|
|
9762
|
-
},{"12":12,"
|
|
9814
|
+
},{"12":12,"37":37}],44:[function(require,module,exports){
|
|
9763
9815
|
"use strict";
|
|
9764
9816
|
module.exports = Writer;
|
|
9765
9817
|
|
|
9766
|
-
var util = require(
|
|
9818
|
+
var util = require(37);
|
|
9767
9819
|
|
|
9768
9820
|
var BufferWriter; // cyclic
|
|
9769
9821
|
|
|
@@ -10256,15 +10308,15 @@ Writer._configure = function(BufferWriter_) {
|
|
|
10256
10308
|
BufferWriter._configure();
|
|
10257
10309
|
};
|
|
10258
10310
|
|
|
10259
|
-
},{"
|
|
10311
|
+
},{"37":37}],45:[function(require,module,exports){
|
|
10260
10312
|
"use strict";
|
|
10261
10313
|
module.exports = BufferWriter;
|
|
10262
10314
|
|
|
10263
10315
|
// extends Writer
|
|
10264
|
-
var Writer = require(
|
|
10316
|
+
var Writer = require(44);
|
|
10265
10317
|
(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
|
|
10266
10318
|
|
|
10267
|
-
var util = require(
|
|
10319
|
+
var util = require(37);
|
|
10268
10320
|
|
|
10269
10321
|
/**
|
|
10270
10322
|
* Constructs a new buffer writer instance.
|
|
@@ -10360,7 +10412,7 @@ BufferWriter.prototype.string = function write_string_buffer(value) {
|
|
|
10360
10412
|
|
|
10361
10413
|
BufferWriter._configure();
|
|
10362
10414
|
|
|
10363
|
-
},{"
|
|
10415
|
+
},{"37":37,"44":44}]},{},[10])
|
|
10364
10416
|
|
|
10365
10417
|
})();
|
|
10366
10418
|
//# sourceMappingURL=protobuf.js.map
|