@dxos/codec-protobuf 2.33.9-dev.a78b0c94 → 2.33.9-dev.cf61eddc

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 CHANGED
@@ -1,5 +1,44 @@
1
1
  # codec-protobuf
2
2
 
3
+ There's an associated @dxos/protobuf-compiler package that does codegen based on protobuf schema.
4
+
5
+ ## Handling of scalar fields with default values
6
+
7
+ Based on:
8
+ - https://github.com/protocolbuffers/protobuf/blob/main/docs/field_presence.md
9
+ - https://github.com/protocolbuffers/protobuf/blob/main/docs/implementing_proto3_presence.md
10
+
11
+
12
+ In protobuf scalar fields (numbers, booleans, strings, bytes, enums) may have an implicit default value:
13
+
14
+ - 0 for number types
15
+ - false for booleans
16
+ - '' (empty string) for strings
17
+ - [] for bytes
18
+ - First enum value for enums
19
+
20
+ ### Non-optional fields
21
+
22
+ Example:
23
+
24
+ ```protobuf
25
+ int32 number = 1;
26
+ ```
27
+
28
+ If the field is set to it's default value (0 in this example) it MAY be missing in the wire encoding (Go implementation) or present with the value set to 0 (JS implementation).
29
+
30
+ When decoding, the missing fields MUST be treated as having the default implicit value (0 in this case).
31
+
32
+ ### Optional fields
33
+
34
+ ```protobuf
35
+ optional int32 number = 1;
36
+ ```
37
+
38
+ If the field is set to it's default value (0 in this example) it MUST be present in the wire encoding with the value set to 0.
39
+
40
+ When decoding, the missing fields it MUST be set as undefined. If the field is present in the wire format, it must be set to its numeric value.
41
+
3
42
  ## Toolchain
4
43
 
5
44
  This package must NOT use `toolchain` to avoid cyclic dependencies.
package/dist/browser.js CHANGED
@@ -5244,7 +5244,7 @@ var require_field = __commonJS({
5244
5244
  module2.exports = Field;
5245
5245
  var ReflectionObject = require_object();
5246
5246
  ((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field";
5247
- var Enum2 = require_enum();
5247
+ var Enum3 = require_enum();
5248
5248
  var types = require_types2();
5249
5249
  var util = require_util2();
5250
5250
  var Type3;
@@ -5335,11 +5335,11 @@ var require_field = __commonJS({
5335
5335
  }
5336
5336
  if (this.options && this.options["default"] != null) {
5337
5337
  this.typeDefault = this.options["default"];
5338
- if (this.resolvedType instanceof Enum2 && typeof this.typeDefault === "string")
5338
+ if (this.resolvedType instanceof Enum3 && typeof this.typeDefault === "string")
5339
5339
  this.typeDefault = this.resolvedType.values[this.typeDefault];
5340
5340
  }
5341
5341
  if (this.options) {
5342
- if (this.options.packed === true || this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof Enum2))
5342
+ if (this.options.packed === true || this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof Enum3))
5343
5343
  delete this.options.packed;
5344
5344
  if (!Object.keys(this.options).length)
5345
5345
  this.options = void 0;
@@ -5492,7 +5492,7 @@ var require_namespace = __commonJS({
5492
5492
  var util = require_util2();
5493
5493
  var Type3;
5494
5494
  var Service2;
5495
- var Enum2;
5495
+ var Enum3;
5496
5496
  Namespace.fromJSON = function fromJSON(name, json) {
5497
5497
  return new Namespace(name, json.options).addJSON(json.nested);
5498
5498
  };
@@ -5548,7 +5548,7 @@ var require_namespace = __commonJS({
5548
5548
  if (nestedJson) {
5549
5549
  for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) {
5550
5550
  nested = nestedJson[names[i]];
5551
- ns.add((nested.fields !== void 0 ? Type3.fromJSON : nested.values !== void 0 ? Enum2.fromJSON : nested.methods !== void 0 ? Service2.fromJSON : nested.id !== void 0 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested));
5551
+ ns.add((nested.fields !== void 0 ? Type3.fromJSON : nested.values !== void 0 ? Enum3.fromJSON : nested.methods !== void 0 ? Service2.fromJSON : nested.id !== void 0 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested));
5552
5552
  }
5553
5553
  }
5554
5554
  return this;
@@ -5557,12 +5557,12 @@ var require_namespace = __commonJS({
5557
5557
  return this.nested && this.nested[name] || null;
5558
5558
  };
5559
5559
  Namespace.prototype.getEnum = function getEnum(name) {
5560
- if (this.nested && this.nested[name] instanceof Enum2)
5560
+ if (this.nested && this.nested[name] instanceof Enum3)
5561
5561
  return this.nested[name].values;
5562
5562
  throw Error("no such enum: " + name);
5563
5563
  };
5564
5564
  Namespace.prototype.add = function add(object) {
5565
- if (!(object instanceof Field && object.extend !== void 0 || object instanceof Type3 || object instanceof Enum2 || object instanceof Service2 || object instanceof Namespace || object instanceof OneOf))
5565
+ if (!(object instanceof Field && object.extend !== void 0 || object instanceof Type3 || object instanceof Enum3 || object instanceof Service2 || object instanceof Namespace || object instanceof OneOf))
5566
5566
  throw TypeError("object must be a valid nested object");
5567
5567
  if (!this.nested)
5568
5568
  this.nested = {};
@@ -5662,13 +5662,13 @@ var require_namespace = __commonJS({
5662
5662
  return found;
5663
5663
  };
5664
5664
  Namespace.prototype.lookupEnum = function lookupEnum(path) {
5665
- var found = this.lookup(path, [Enum2]);
5665
+ var found = this.lookup(path, [Enum3]);
5666
5666
  if (!found)
5667
5667
  throw Error("no such Enum '" + path + "' in " + this);
5668
5668
  return found;
5669
5669
  };
5670
5670
  Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) {
5671
- var found = this.lookup(path, [Type3, Enum2]);
5671
+ var found = this.lookup(path, [Type3, Enum3]);
5672
5672
  if (!found)
5673
5673
  throw Error("no such Type or Enum '" + path + "' in " + this);
5674
5674
  return found;
@@ -5682,7 +5682,7 @@ var require_namespace = __commonJS({
5682
5682
  Namespace._configure = function(Type_, Service_, Enum_) {
5683
5683
  Type3 = Type_;
5684
5684
  Service2 = Service_;
5685
- Enum2 = Enum_;
5685
+ Enum3 = Enum_;
5686
5686
  };
5687
5687
  }
5688
5688
  });
@@ -5948,7 +5948,7 @@ var require_decoder = __commonJS({
5948
5948
  "../../../common/temp/node_modules/.pnpm/protobufjs@6.11.2/node_modules/protobufjs/src/decoder.js"(exports2, module2) {
5949
5949
  "use strict";
5950
5950
  module2.exports = decoder;
5951
- var Enum2 = require_enum();
5951
+ var Enum3 = require_enum();
5952
5952
  var types = require_types2();
5953
5953
  var util = require_util2();
5954
5954
  function missing(field) {
@@ -5963,7 +5963,7 @@ var require_decoder = __commonJS({
5963
5963
  gen("switch(t>>>3){");
5964
5964
  var i = 0;
5965
5965
  for (; i < mtype.fieldsArray.length; ++i) {
5966
- var field = mtype._fieldsArray[i].resolve(), type = field.resolvedType instanceof Enum2 ? "int32" : field.type, ref2 = "m" + util.safeProp(field.name);
5966
+ var field = mtype._fieldsArray[i].resolve(), type = field.resolvedType instanceof Enum3 ? "int32" : field.type, ref2 = "m" + util.safeProp(field.name);
5967
5967
  gen("case %i:", field.id);
5968
5968
  if (field.map) {
5969
5969
  gen("if(%s===util.emptyObject)", ref2)("%s={}", ref2)("var c2 = r.uint32()+r.pos");
@@ -6015,14 +6015,14 @@ var require_verifier = __commonJS({
6015
6015
  "../../../common/temp/node_modules/.pnpm/protobufjs@6.11.2/node_modules/protobufjs/src/verifier.js"(exports2, module2) {
6016
6016
  "use strict";
6017
6017
  module2.exports = verifier;
6018
- var Enum2 = require_enum();
6018
+ var Enum3 = require_enum();
6019
6019
  var util = require_util2();
6020
6020
  function invalid(field, expected) {
6021
6021
  return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:" + field.keyType + "}" : "") + " expected";
6022
6022
  }
6023
6023
  function genVerifyValue(gen, field, fieldIndex, ref2) {
6024
6024
  if (field.resolvedType) {
6025
- if (field.resolvedType instanceof Enum2) {
6025
+ if (field.resolvedType instanceof Enum3) {
6026
6026
  gen("switch(%s){", ref2)("default:")("return%j", invalid(field, "enum value"));
6027
6027
  for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j)
6028
6028
  gen("case %i:", field.resolvedType.values[keys[j]]);
@@ -6124,11 +6124,11 @@ var require_converter = __commonJS({
6124
6124
  "../../../common/temp/node_modules/.pnpm/protobufjs@6.11.2/node_modules/protobufjs/src/converter.js"(exports2) {
6125
6125
  "use strict";
6126
6126
  var converter = exports2;
6127
- var Enum2 = require_enum();
6127
+ var Enum3 = require_enum();
6128
6128
  var util = require_util2();
6129
6129
  function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
6130
6130
  if (field.resolvedType) {
6131
- if (field.resolvedType instanceof Enum2) {
6131
+ if (field.resolvedType instanceof Enum3) {
6132
6132
  gen("switch(d%s){", prop);
6133
6133
  for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
6134
6134
  if (field.repeated && values[keys[i]] === field.typeDefault)
@@ -6190,10 +6190,10 @@ var require_converter = __commonJS({
6190
6190
  gen("if(d%s){", prop)("if(!Array.isArray(d%s))", prop)("throw TypeError(%j)", field.fullName + ": array expected")("m%s=[]", prop)("for(var i=0;i<d%s.length;++i){", prop);
6191
6191
  genValuePartial_fromObject(gen, field, i, prop + "[i]")("}")("}");
6192
6192
  } else {
6193
- if (!(field.resolvedType instanceof Enum2))
6193
+ if (!(field.resolvedType instanceof Enum3))
6194
6194
  gen("if(d%s!=null){", prop);
6195
6195
  genValuePartial_fromObject(gen, field, i, prop);
6196
- if (!(field.resolvedType instanceof Enum2))
6196
+ if (!(field.resolvedType instanceof Enum3))
6197
6197
  gen("}");
6198
6198
  }
6199
6199
  }
@@ -6201,7 +6201,7 @@ var require_converter = __commonJS({
6201
6201
  };
6202
6202
  function genValuePartial_toObject(gen, field, fieldIndex, prop) {
6203
6203
  if (field.resolvedType) {
6204
- if (field.resolvedType instanceof Enum2)
6204
+ if (field.resolvedType instanceof Enum3)
6205
6205
  gen("d%s=o.enums===String?types[%i].values[m%s]:m%s", prop, fieldIndex, prop, prop);
6206
6206
  else
6207
6207
  gen("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);
@@ -6255,7 +6255,7 @@ var require_converter = __commonJS({
6255
6255
  gen("if(o.defaults){");
6256
6256
  for (i = 0; i < normalFields.length; ++i) {
6257
6257
  var field = normalFields[i], prop = util.safeProp(field.name);
6258
- if (field.resolvedType instanceof Enum2)
6258
+ if (field.resolvedType instanceof Enum3)
6259
6259
  gen("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault);
6260
6260
  else if (field.long)
6261
6261
  gen("if(util.Long){")("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)("}else")("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber());
@@ -6351,7 +6351,7 @@ var require_type = __commonJS({
6351
6351
  module2.exports = Type3;
6352
6352
  var Namespace = require_namespace();
6353
6353
  ((Type3.prototype = Object.create(Namespace.prototype)).constructor = Type3).className = "Type";
6354
- var Enum2 = require_enum();
6354
+ var Enum3 = require_enum();
6355
6355
  var OneOf = require_oneof();
6356
6356
  var Field = require_field();
6357
6357
  var MapField2 = require_mapfield();
@@ -6458,7 +6458,7 @@ var require_type = __commonJS({
6458
6458
  if (json.nested)
6459
6459
  for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) {
6460
6460
  var nested = json.nested[names[i]];
6461
- type.add((nested.id !== void 0 ? Field.fromJSON : nested.fields !== void 0 ? Type3.fromJSON : nested.values !== void 0 ? Enum2.fromJSON : nested.methods !== void 0 ? Service2.fromJSON : Namespace.fromJSON)(names[i], nested));
6461
+ type.add((nested.id !== void 0 ? Field.fromJSON : nested.fields !== void 0 ? Type3.fromJSON : nested.values !== void 0 ? Enum3.fromJSON : nested.methods !== void 0 ? Service2.fromJSON : Namespace.fromJSON)(names[i], nested));
6462
6462
  }
6463
6463
  if (json.extensions && json.extensions.length)
6464
6464
  type.extensions = json.extensions;
@@ -6636,7 +6636,7 @@ var require_root = __commonJS({
6636
6636
  var Namespace = require_namespace();
6637
6637
  ((Root3.prototype = Object.create(Namespace.prototype)).constructor = Root3).className = "Root";
6638
6638
  var Field = require_field();
6639
- var Enum2 = require_enum();
6639
+ var Enum3 = require_enum();
6640
6640
  var OneOf = require_oneof();
6641
6641
  var util = require_util2();
6642
6642
  var Type3;
@@ -6796,7 +6796,7 @@ var require_root = __commonJS({
6796
6796
  if (!tryHandleExtension(this, object))
6797
6797
  this.deferred.push(object);
6798
6798
  }
6799
- } else if (object instanceof Enum2) {
6799
+ } else if (object instanceof Enum3) {
6800
6800
  if (exposeRe.test(object.name))
6801
6801
  object.parent[object.name] = object.values;
6802
6802
  } else if (!(object instanceof OneOf)) {
@@ -6824,7 +6824,7 @@ var require_root = __commonJS({
6824
6824
  this.deferred.splice(index, 1);
6825
6825
  }
6826
6826
  }
6827
- } else if (object instanceof Enum2) {
6827
+ } else if (object instanceof Enum3) {
6828
6828
  if (exposeRe.test(object.name))
6829
6829
  delete object.parent[object.name];
6830
6830
  } else if (object instanceof Namespace) {
@@ -6849,7 +6849,7 @@ var require_util2 = __commonJS({
6849
6849
  var util = module2.exports = require_minimal();
6850
6850
  var roots = require_roots();
6851
6851
  var Type3;
6852
- var Enum2;
6852
+ var Enum3;
6853
6853
  util.codegen = require_codegen();
6854
6854
  util.fetch = require_fetch();
6855
6855
  util.path = require_path();
@@ -6916,9 +6916,9 @@ var require_util2 = __commonJS({
6916
6916
  util.decorateEnum = function decorateEnum(object) {
6917
6917
  if (object.$type)
6918
6918
  return object.$type;
6919
- if (!Enum2)
6920
- Enum2 = require_enum();
6921
- var enm = new Enum2("Enum" + decorateEnumIndex++, object);
6919
+ if (!Enum3)
6920
+ Enum3 = require_enum();
6921
+ var enm = new Enum3("Enum" + decorateEnumIndex++, object);
6922
6922
  util.decorateRoot.add(enm);
6923
6923
  Object.defineProperty(object, "$type", { value: enm, enumerable: false });
6924
6924
  return enm;
@@ -7074,12 +7074,12 @@ var require_object = __commonJS({
7074
7074
  var require_enum = __commonJS({
7075
7075
  "../../../common/temp/node_modules/.pnpm/protobufjs@6.11.2/node_modules/protobufjs/src/enum.js"(exports2, module2) {
7076
7076
  "use strict";
7077
- module2.exports = Enum2;
7077
+ module2.exports = Enum3;
7078
7078
  var ReflectionObject = require_object();
7079
- ((Enum2.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum2).className = "Enum";
7079
+ ((Enum3.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum3).className = "Enum";
7080
7080
  var Namespace = require_namespace();
7081
7081
  var util = require_util2();
7082
- function Enum2(name, values, options, comment, comments) {
7082
+ function Enum3(name, values, options, comment, comments) {
7083
7083
  ReflectionObject.call(this, name, options);
7084
7084
  if (values && typeof values !== "object")
7085
7085
  throw TypeError("values must be an object");
@@ -7094,12 +7094,12 @@ var require_enum = __commonJS({
7094
7094
  this.valuesById[this.values[keys[i]] = values[keys[i]]] = keys[i];
7095
7095
  }
7096
7096
  }
7097
- Enum2.fromJSON = function fromJSON(name, json) {
7098
- var enm = new Enum2(name, json.values, json.options, json.comment, json.comments);
7097
+ Enum3.fromJSON = function fromJSON(name, json) {
7098
+ var enm = new Enum3(name, json.values, json.options, json.comment, json.comments);
7099
7099
  enm.reserved = json.reserved;
7100
7100
  return enm;
7101
7101
  };
7102
- Enum2.prototype.toJSON = function toJSON(toJSONOptions) {
7102
+ Enum3.prototype.toJSON = function toJSON(toJSONOptions) {
7103
7103
  var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
7104
7104
  return util.toObject([
7105
7105
  "options",
@@ -7114,7 +7114,7 @@ var require_enum = __commonJS({
7114
7114
  keepComments ? this.comments : void 0
7115
7115
  ]);
7116
7116
  };
7117
- Enum2.prototype.add = function add(name, id, comment) {
7117
+ Enum3.prototype.add = function add(name, id, comment) {
7118
7118
  if (!util.isString(name))
7119
7119
  throw TypeError("name must be a string");
7120
7120
  if (!util.isInteger(id))
@@ -7134,7 +7134,7 @@ var require_enum = __commonJS({
7134
7134
  this.comments[name] = comment || null;
7135
7135
  return this;
7136
7136
  };
7137
- Enum2.prototype.remove = function remove(name) {
7137
+ Enum3.prototype.remove = function remove(name) {
7138
7138
  if (!util.isString(name))
7139
7139
  throw TypeError("name must be a string");
7140
7140
  var val = this.values[name];
@@ -7145,10 +7145,10 @@ var require_enum = __commonJS({
7145
7145
  delete this.comments[name];
7146
7146
  return this;
7147
7147
  };
7148
- Enum2.prototype.isReservedId = function isReservedId(id) {
7148
+ Enum3.prototype.isReservedId = function isReservedId(id) {
7149
7149
  return Namespace.isReservedId(this.reserved, id);
7150
7150
  };
7151
- Enum2.prototype.isReservedName = function isReservedName(name) {
7151
+ Enum3.prototype.isReservedName = function isReservedName(name) {
7152
7152
  return Namespace.isReservedName(this.reserved, name);
7153
7153
  };
7154
7154
  }
@@ -7159,7 +7159,7 @@ var require_encoder = __commonJS({
7159
7159
  "../../../common/temp/node_modules/.pnpm/protobufjs@6.11.2/node_modules/protobufjs/src/encoder.js"(exports2, module2) {
7160
7160
  "use strict";
7161
7161
  module2.exports = encoder;
7162
- var Enum2 = require_enum();
7162
+ var Enum3 = require_enum();
7163
7163
  var types = require_types2();
7164
7164
  var util = require_util2();
7165
7165
  function genTypePartial(gen, field, fieldIndex, ref2) {
@@ -7170,7 +7170,7 @@ var require_encoder = __commonJS({
7170
7170
  var i, ref2;
7171
7171
  var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById);
7172
7172
  for (var i = 0; i < fields.length; ++i) {
7173
- var field = fields[i].resolve(), index = mtype._fieldsArray.indexOf(field), type = field.resolvedType instanceof Enum2 ? "int32" : field.type, wireType = types.basic[type];
7173
+ var field = fields[i].resolve(), index = mtype._fieldsArray.indexOf(field), type = field.resolvedType instanceof Enum3 ? "int32" : field.type, wireType = types.basic[type];
7174
7174
  ref2 = "m" + util.safeProp(field.name);
7175
7175
  if (field.map) {
7176
7176
  gen("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref2, field.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", ref2)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (field.id << 3 | 2) >>> 0, 8 | types.mapKey[field.keyType], field.keyType);
@@ -7497,7 +7497,7 @@ var require_parse = __commonJS({
7497
7497
  var Field = require_field();
7498
7498
  var MapField2 = require_mapfield();
7499
7499
  var OneOf = require_oneof();
7500
- var Enum2 = require_enum();
7500
+ var Enum3 = require_enum();
7501
7501
  var Service2 = require_service2();
7502
7502
  var Method = require_method();
7503
7503
  var types = require_types2();
@@ -7855,7 +7855,7 @@ var require_parse = __commonJS({
7855
7855
  function parseEnum(parent, token2) {
7856
7856
  if (!nameRe.test(token2 = next()))
7857
7857
  throw illegal(token2, "name");
7858
- var enm = new Enum2(token2);
7858
+ var enm = new Enum3(token2);
7859
7859
  ifBlock(enm, function parseEnum_block(token3) {
7860
7860
  switch (token3) {
7861
7861
  case "option":
@@ -8367,10 +8367,10 @@ var createMessageMapperCached = (type, substitutions, cache) => {
8367
8367
  cache[type.fullName].map = codegen(`${type.name}$map`, ["obj", "extraArgs"], (c) => {
8368
8368
  c`const res = {};`;
8369
8369
  for (const field of type.fieldsArray) {
8370
+ field.resolve();
8370
8371
  c`if(obj.${field.name} !== undefined && obj.${field.name} !== null) {`;
8371
8372
  {
8372
8373
  const genMapScalar = (value) => {
8373
- field.resolve();
8374
8374
  const substitution = field.resolvedType && substitutions[field.resolvedType.fullName.slice(1)];
8375
8375
  if (substitution) {
8376
8376
  c`${ref(substitution)}(${value}, ...extraArgs)`;
@@ -8402,12 +8402,52 @@ var createMessageMapperCached = (type, substitutions, cache) => {
8402
8402
  }
8403
8403
  }
8404
8404
  c`}`;
8405
+ if (!field.getOption("proto3_optional") && !field.repeated && !field.map && !field.partOf) {
8406
+ c`else {`;
8407
+ {
8408
+ if (field.resolvedType instanceof pb.Type) {
8409
+ const mapper = createMessageMapperCached(field.resolvedType, substitutions, cache);
8410
+ c`res.${field.name} = ${ref(mapper)}.map({}, extraArgs);`;
8411
+ } else if (field.resolvedType instanceof pb.Enum) {
8412
+ `res.${field.name} = 0;`;
8413
+ } else {
8414
+ c`res.${field.name} = ${getDefaultValue(field.type)};`;
8415
+ }
8416
+ }
8417
+ c`}`;
8418
+ }
8405
8419
  }
8406
8420
  c`return res;`;
8407
8421
  });
8408
8422
  }
8409
8423
  return cache[type.fullName];
8410
8424
  };
8425
+ var getDefaultValue = (type) => {
8426
+ switch (type) {
8427
+ case "double":
8428
+ case "float":
8429
+ case "int32":
8430
+ case "sfixed32":
8431
+ case "uint32":
8432
+ case "sint32":
8433
+ case "fixed32":
8434
+ return "0";
8435
+ case "sint64":
8436
+ case "int64":
8437
+ case "uint64":
8438
+ case "fixed64":
8439
+ case "sfixed64":
8440
+ return '"0"';
8441
+ case "bool":
8442
+ return "false";
8443
+ case "string":
8444
+ return '""';
8445
+ case "bytes":
8446
+ return "new Uint8Array()";
8447
+ default:
8448
+ throw new Error(`Unknown type: ${type}`);
8449
+ }
8450
+ };
8411
8451
 
8412
8452
  // src/codec.ts
8413
8453
  var OBJECT_CONVERSION_OPTIONS = {
@@ -8567,13 +8607,21 @@ var log = (0, import_debug.default)("dxos:codec-protobuf:stream");
8567
8607
  var Stream = class {
8568
8608
  constructor(producer) {
8569
8609
  this._isClosed = false;
8610
+ this._isReady = false;
8570
8611
  this._buffer = [];
8612
+ this._readyPromise = new Promise((resolve) => {
8613
+ this._resolveReadyPromise = resolve;
8614
+ });
8571
8615
  const disposeCallback = producer({
8616
+ ready: () => {
8617
+ this._markAsReady();
8618
+ },
8572
8619
  next: (msg) => {
8573
8620
  if (this._isClosed) {
8574
8621
  log("Stream is closed, dropping message.");
8575
8622
  return;
8576
8623
  }
8624
+ this._markAsReady();
8577
8625
  if (this._messageHandler) {
8578
8626
  try {
8579
8627
  this._messageHandler(msg);
@@ -8607,6 +8655,9 @@ var Stream = class {
8607
8655
  static consume(stream) {
8608
8656
  return new Promise((resolve) => {
8609
8657
  const items = [];
8658
+ stream.onReady(() => {
8659
+ items.push({ ready: true });
8660
+ });
8610
8661
  stream.subscribe((data) => {
8611
8662
  items.push({ data });
8612
8663
  }, (error) => {
@@ -8619,6 +8670,21 @@ var Stream = class {
8619
8670
  });
8620
8671
  });
8621
8672
  }
8673
+ static map(source, map) {
8674
+ return new Stream(({ ready, next, close }) => {
8675
+ source.onReady(ready);
8676
+ source.subscribe((data) => next(map(data)), close);
8677
+ return () => source.close();
8678
+ });
8679
+ }
8680
+ _markAsReady() {
8681
+ var _a;
8682
+ if (!this._isReady) {
8683
+ this._isReady = true;
8684
+ (_a = this._readyHandler) == null ? void 0 : _a.call(this);
8685
+ this._resolveReadyPromise();
8686
+ }
8687
+ }
8622
8688
  subscribe(onMessage, onClose) {
8623
8689
  (0, import_node_assert3.default)(!this._messageHandler, "Stream is already subscribed to.");
8624
8690
  (0, import_node_assert3.default)(!this._closeHandler, "Stream is already subscribed to.");
@@ -8638,6 +8704,16 @@ var Stream = class {
8638
8704
  this._messageHandler = onMessage;
8639
8705
  this._closeHandler = onClose;
8640
8706
  }
8707
+ waitUntilReady() {
8708
+ return this._readyPromise;
8709
+ }
8710
+ onReady(onReady) {
8711
+ (0, import_node_assert3.default)(!this._readyHandler, "Stream already has a handler for the ready event.");
8712
+ this._readyHandler = onReady;
8713
+ if (this._isReady) {
8714
+ onReady();
8715
+ }
8716
+ }
8641
8717
  close() {
8642
8718
  var _a, _b;
8643
8719
  if (this._isClosed) {
@@ -8695,14 +8771,11 @@ var Service = class {
8695
8771
  } else {
8696
8772
  this[methodName] = (request) => {
8697
8773
  const encoded = requestCodec.encode(request);
8698
- return new Stream(({ next, close }) => {
8699
- const stream = backend.callStream(method.name, {
8700
- value: encoded,
8701
- type_url: method.resolvedRequestType.fullName
8702
- });
8703
- stream.subscribe((data) => next(responseCodec.decode(data.value)), close);
8704
- return () => stream.close();
8774
+ const stream = backend.callStream(method.name, {
8775
+ value: encoded,
8776
+ type_url: method.resolvedRequestType.fullName
8705
8777
  });
8778
+ return Stream.map(stream, (data) => responseCodec.decode(data.value));
8706
8779
  };
8707
8780
  }
8708
8781
  Object.defineProperty(this[methodName], "name", { value: methodName });
@@ -8739,13 +8812,10 @@ var ServiceHandler = class {
8739
8812
  (0, import_node_assert4.default)(handler, `Handler is missing: ${mappedMethodName}`);
8740
8813
  const requestDecoded = requestCodec.decode(request.value);
8741
8814
  const responseStream = handler.bind(this._handlers)(requestDecoded);
8742
- return new Stream(({ next, close }) => {
8743
- responseStream.subscribe((data) => next({
8744
- value: responseCodec.encode(data),
8745
- type_url: method.resolvedResponseType.fullName
8746
- }), close);
8747
- return () => responseStream.close();
8748
- });
8815
+ return Stream.map(responseStream, (data) => ({
8816
+ value: responseCodec.encode(data),
8817
+ type_url: method.resolvedResponseType.fullName
8818
+ }));
8749
8819
  }
8750
8820
  _getMethodInfo(methodName) {
8751
8821
  const method = this._service.methods[methodName];
@@ -42,10 +42,10 @@ const createMessageMapperCached = (type, substitutions, cache) => {
42
42
  cache[type.fullName].map = (0, codegen_1.codegen)(`${type.name}$map`, ['obj', 'extraArgs'], c => {
43
43
  c `const res = {};`;
44
44
  for (const field of type.fieldsArray) {
45
+ field.resolve();
45
46
  c `if(obj.${field.name} !== undefined && obj.${field.name} !== null) {`;
46
47
  {
47
48
  const genMapScalar = (value) => {
48
- field.resolve();
49
49
  const substitution = field.resolvedType && substitutions[field.resolvedType.fullName.slice(1)];
50
50
  if (substitution) {
51
51
  c `${(0, codegen_1.ref)(substitution)}(${value}, ...extraArgs)`;
@@ -58,7 +58,6 @@ const createMessageMapperCached = (type, substitutions, cache) => {
58
58
  c `${value}`;
59
59
  }
60
60
  };
61
- // TODO(dmaretskyi): Support maps.
62
61
  if (field.repeated) {
63
62
  c `res.${field.name} = obj.${field.name}.map(item => `;
64
63
  genMapScalar('item');
@@ -82,10 +81,52 @@ const createMessageMapperCached = (type, substitutions, cache) => {
82
81
  }
83
82
  }
84
83
  c `}`;
84
+ if (!field.getOption('proto3_optional') && !field.repeated && !field.map && !field.partOf) {
85
+ c `else {`;
86
+ {
87
+ if (field.resolvedType instanceof pb.Type) {
88
+ const mapper = createMessageMapperCached(field.resolvedType, substitutions, cache);
89
+ c `res.${field.name} = ${(0, codegen_1.ref)(mapper)}.map({}, extraArgs);`;
90
+ }
91
+ else if (field.resolvedType instanceof pb.Enum) {
92
+ `res.${field.name} = 0;`;
93
+ }
94
+ else {
95
+ c `res.${field.name} = ${getDefaultValue(field.type)};`;
96
+ }
97
+ }
98
+ c `}`;
99
+ }
85
100
  }
86
101
  c `return res;`;
87
102
  });
88
103
  }
89
104
  return cache[type.fullName];
90
105
  };
106
+ const getDefaultValue = (type) => {
107
+ switch (type) {
108
+ case 'double':
109
+ case 'float':
110
+ case 'int32':
111
+ case 'sfixed32':
112
+ case 'uint32':
113
+ case 'sint32':
114
+ case 'fixed32':
115
+ return '0';
116
+ case 'sint64':
117
+ case 'int64':
118
+ case 'uint64':
119
+ case 'fixed64':
120
+ case 'sfixed64':
121
+ return '"0"';
122
+ case 'bool':
123
+ return 'false';
124
+ case 'string':
125
+ return '""';
126
+ case 'bytes':
127
+ return 'new Uint8Array()';
128
+ default:
129
+ throw new Error(`Unknown type: ${type}`);
130
+ }
131
+ };
91
132
  //# sourceMappingURL=create-message-mapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-message-mapper.js","sourceRoot":"","sources":["../../../src/precompiled-mapping/create-message-mapper.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,8DAAiC;AACjC,+CAAiC;AAGjC,uCAAyC;AAIlC,MAAM,mBAAmB,GAAG,CAAC,IAAa,EAAE,aAAgC,EAAU,EAAE,CAAC,yBAAyB,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;AAA1I,QAAA,mBAAmB,uBAAuH;AAEvJ,MAAM,yBAAyB,GAAG,CAAC,IAAa,EAAE,aAAgC,EAAE,KAAsC,EAAE,EAAE;IAC5H,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QACzB,oDAAoD;QACpD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAS,CAAC;QACjC,KAAK,CAAC,IAAI,CA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,CAAC,IAAI,OAAO,CAAC;yBAC1B;6BAAM;4BACL,CAAC,CAAA,OAAO,KAAK,CAAC,IAAI,MAAM,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;yBACxD;qBACF;oBAAC,CAAC,CAAA,GAAG,CAAC;iBACR;aACF;YACD,CAAC,CAAA,aAAa,CAAC;QACjB,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,IAAY,EAAU,EAAE;IAC/C,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,UAAU;YACb,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,OAAO,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,kBAAkB,CAAC;QAC5B;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;KAC5C;AACH,CAAC,CAAC"}
@@ -2,8 +2,8 @@ import pb from 'protobufjs';
2
2
  import type { Schema } from './schema';
3
3
  import { Stream } from './stream';
4
4
  export interface Any {
5
- 'type_url'?: string;
6
- value?: Uint8Array;
5
+ 'type_url': string;
6
+ value: Uint8Array;
7
7
  }
8
8
  export interface ServiceBackend {
9
9
  call(method: string, request: Any): Promise<Any>;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":"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