@bufbuild/protobuf 0.0.5 → 0.0.8

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.
Files changed (78) hide show
  1. package/dist/cjs/binary-encoding.js +2 -2
  2. package/dist/cjs/descriptor-registry.js +18 -60
  3. package/dist/cjs/descriptor-set.js +15 -37
  4. package/dist/cjs/google/protobuf/any_pb.js +11 -8
  5. package/dist/cjs/google/protobuf/api_pb.js +19 -18
  6. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +23 -22
  7. package/dist/cjs/google/protobuf/descriptor_pb.js +149 -148
  8. package/dist/cjs/google/protobuf/duration_pb.js +14 -12
  9. package/dist/cjs/google/protobuf/empty_pb.js +7 -6
  10. package/dist/cjs/google/protobuf/field_mask_pb.js +8 -7
  11. package/dist/cjs/google/protobuf/source_context_pb.js +7 -6
  12. package/dist/cjs/google/protobuf/struct_pb.js +26 -22
  13. package/dist/cjs/google/protobuf/timestamp_pb.js +12 -10
  14. package/dist/cjs/google/protobuf/type_pb.js +37 -33
  15. package/dist/cjs/google/protobuf/wrappers_pb.js +69 -66
  16. package/dist/cjs/index.js +40 -4
  17. package/dist/cjs/message.js +2 -1
  18. package/dist/cjs/private/binary-format-common.js +4 -3
  19. package/dist/cjs/private/binary-format-proto2.js +3 -6
  20. package/dist/cjs/private/binary-format-proto3.js +2 -5
  21. package/dist/cjs/private/enum.js +1 -1
  22. package/dist/cjs/private/json-format-common.js +6 -5
  23. package/dist/cjs/private/message-type.js +2 -1
  24. package/dist/cjs/proto-int64.js +1 -1
  25. package/dist/cjs/proto2.js +6 -8
  26. package/dist/cjs/proto3.js +9 -12
  27. package/dist/esm/binary-encoding.js +2 -2
  28. package/dist/esm/descriptor-registry.js +18 -60
  29. package/dist/esm/descriptor-set.js +15 -37
  30. package/dist/esm/google/protobuf/any_pb.js +6 -3
  31. package/dist/esm/google/protobuf/api_pb.js +2 -1
  32. package/dist/esm/google/protobuf/compiler/plugin_pb.js +2 -1
  33. package/dist/esm/google/protobuf/descriptor_pb.js +2 -1
  34. package/dist/esm/google/protobuf/duration_pb.js +4 -2
  35. package/dist/esm/google/protobuf/empty_pb.js +2 -1
  36. package/dist/esm/google/protobuf/field_mask_pb.js +2 -1
  37. package/dist/esm/google/protobuf/source_context_pb.js +2 -1
  38. package/dist/esm/google/protobuf/struct_pb.js +6 -2
  39. package/dist/esm/google/protobuf/timestamp_pb.js +3 -1
  40. package/dist/esm/google/protobuf/type_pb.js +5 -1
  41. package/dist/esm/google/protobuf/wrappers_pb.js +4 -1
  42. package/dist/esm/index.js +25 -4
  43. package/dist/esm/message.js +2 -1
  44. package/dist/esm/private/binary-format-common.js +4 -3
  45. package/dist/esm/private/binary-format-proto2.js +3 -6
  46. package/dist/esm/private/binary-format-proto3.js +2 -5
  47. package/dist/esm/private/enum.js +1 -1
  48. package/dist/esm/private/json-format-common.js +6 -5
  49. package/dist/esm/private/message-type.js +2 -1
  50. package/dist/esm/proto-int64.js +1 -1
  51. package/dist/esm/proto2.js +6 -8
  52. package/dist/esm/proto3.js +9 -12
  53. package/dist/protobuf.cjs +2 -0
  54. package/dist/protobuf.cjs.map +1 -0
  55. package/dist/protobuf.esm.js +2 -0
  56. package/dist/protobuf.esm.js.map +1 -0
  57. package/dist/protobuf.modern.js +2 -0
  58. package/dist/protobuf.modern.js.map +1 -0
  59. package/dist/types/google/protobuf/any_pb.d.ts +6 -2
  60. package/dist/types/google/protobuf/api_pb.d.ts +5 -2
  61. package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +5 -2
  62. package/dist/types/google/protobuf/descriptor_pb.d.ts +5 -2
  63. package/dist/types/google/protobuf/duration_pb.d.ts +5 -2
  64. package/dist/types/google/protobuf/empty_pb.d.ts +5 -2
  65. package/dist/types/google/protobuf/field_mask_pb.d.ts +5 -2
  66. package/dist/types/google/protobuf/source_context_pb.d.ts +5 -2
  67. package/dist/types/google/protobuf/struct_pb.d.ts +5 -2
  68. package/dist/types/google/protobuf/timestamp_pb.d.ts +5 -2
  69. package/dist/types/google/protobuf/type_pb.d.ts +5 -2
  70. package/dist/types/google/protobuf/wrappers_pb.d.ts +5 -2
  71. package/dist/types/index.d.ts +31 -2
  72. package/package.json +3 -2
  73. package/dist/cjs/index-runtime.js +0 -42
  74. package/dist/cjs/index-wkt.js +0 -42
  75. package/dist/esm/index-runtime.js +0 -25
  76. package/dist/esm/index-wkt.js +0 -26
  77. package/dist/types/index-runtime.d.ts +0 -19
  78. package/dist/types/index-wkt.d.ts +0 -12
@@ -67,7 +67,7 @@ class BinaryWriter {
67
67
  * Previous fork states.
68
68
  */
69
69
  this.stack = [];
70
- this.textEncoder = textEncoder ?? new TextEncoder();
70
+ this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();
71
71
  this.chunks = [];
72
72
  this.buf = [];
73
73
  }
@@ -283,7 +283,7 @@ class BinaryReader {
283
283
  this.len = buf.length;
284
284
  this.pos = 0;
285
285
  this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
286
- this.textDecoder = textDecoder ?? new TextDecoder();
286
+ this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder();
287
287
  }
288
288
  /**
289
289
  * Reads a tag - field number and wire type.
@@ -65,7 +65,7 @@ class DescriptorRegistry {
65
65
  this.enums = {};
66
66
  this.messages = {};
67
67
  this.services = {};
68
- this.ds = descriptorSet ?? new descriptor_set_js_1.DescriptorSet();
68
+ this.ds = descriptorSet !== null && descriptorSet !== void 0 ? descriptorSet : new descriptor_set_js_1.DescriptorSet();
69
69
  if (replaceWkt) {
70
70
  for (const mt of wkMessages) {
71
71
  this.messages["." + mt.typeName] = mt;
@@ -177,8 +177,9 @@ class DescriptorRegistry {
177
177
  }
178
178
  exports.DescriptorRegistry = DescriptorRegistry;
179
179
  function makeTypeLocalName(type) {
180
+ var _a;
180
181
  const typeName = type.typeName;
181
- const packagePrefix = (type.file.proto.package ?? "") + ".";
182
+ const packagePrefix = ((_a = type.file.proto.package) !== null && _a !== void 0 ? _a : "") + ".";
182
183
  if (!typeName.startsWith(packagePrefix)) {
183
184
  return type.name;
184
185
  }
@@ -207,32 +208,23 @@ function makeMapFieldInfo(field, resolver) {
207
208
  if (field.map.value.message) {
208
209
  const messageType = resolver.findMessage(field.map.value.message.typeName);
209
210
  (0, assert_js_1.assert)(messageType, `message "${field.map.value.message.typeName}" for ${field.toString()} not found`);
210
- return {
211
- ...base,
212
- V: {
211
+ return Object.assign(Object.assign({}, base), { V: {
213
212
  kind: "message",
214
213
  T: messageType,
215
- },
216
- };
214
+ } });
217
215
  }
218
216
  if (field.map.value.enum) {
219
217
  const enumType = resolver.findEnum(field.map.value.enum.typeName);
220
218
  (0, assert_js_1.assert)(enumType, `enum "${field.map.value.enum.typeName}" for ${field.toString()} not found`);
221
- return {
222
- ...base,
223
- V: {
219
+ return Object.assign(Object.assign({}, base), { V: {
224
220
  kind: "enum",
225
221
  T: enumType,
226
- },
227
- };
222
+ } });
228
223
  }
229
- return {
230
- ...base,
231
- V: {
224
+ return Object.assign(Object.assign({}, base), { V: {
232
225
  kind: "scalar",
233
226
  T: field.map.value.scalarType,
234
- },
235
- };
227
+ } });
236
228
  }
237
229
  function makeScalarFieldInfo(field) {
238
230
  const base = {
@@ -242,25 +234,13 @@ function makeScalarFieldInfo(field) {
242
234
  T: field.scalarType,
243
235
  };
244
236
  if (field.repeated) {
245
- return {
246
- ...base,
247
- repeated: true,
248
- packed: field.packed,
249
- oneof: undefined,
250
- T: field.scalarType,
251
- };
237
+ return Object.assign(Object.assign({}, base), { repeated: true, packed: field.packed, oneof: undefined, T: field.scalarType });
252
238
  }
253
239
  if (field.oneof) {
254
- return {
255
- ...base,
256
- oneof: field.oneof.name,
257
- };
240
+ return Object.assign(Object.assign({}, base), { oneof: field.oneof.name });
258
241
  }
259
242
  if (field.optional) {
260
- return {
261
- ...base,
262
- opt: true,
263
- };
243
+ return Object.assign(Object.assign({}, base), { opt: true });
264
244
  }
265
245
  return base;
266
246
  }
@@ -274,24 +254,13 @@ function makeMessageFieldInfo(field, resolver) {
274
254
  T: messageType,
275
255
  };
276
256
  if (field.repeated) {
277
- return {
278
- ...base,
279
- repeated: true,
280
- packed: field.packed,
281
- oneof: undefined,
282
- };
257
+ return Object.assign(Object.assign({}, base), { repeated: true, packed: field.packed, oneof: undefined });
283
258
  }
284
259
  if (field.oneof) {
285
- return {
286
- ...base,
287
- oneof: field.oneof.name,
288
- };
260
+ return Object.assign(Object.assign({}, base), { oneof: field.oneof.name });
289
261
  }
290
262
  if (field.optional) {
291
- return {
292
- ...base,
293
- opt: true,
294
- };
263
+ return Object.assign(Object.assign({}, base), { opt: true });
295
264
  }
296
265
  return base;
297
266
  }
@@ -305,24 +274,13 @@ function makeEnumFieldInfo(field, resolver) {
305
274
  T: enumType,
306
275
  };
307
276
  if (field.repeated) {
308
- return {
309
- ...base,
310
- repeated: true,
311
- packed: field.packed,
312
- oneof: undefined,
313
- };
277
+ return Object.assign(Object.assign({}, base), { repeated: true, packed: field.packed, oneof: undefined });
314
278
  }
315
279
  if (field.oneof) {
316
- return {
317
- ...base,
318
- oneof: field.oneof.name,
319
- };
280
+ return Object.assign(Object.assign({}, base), { oneof: field.oneof.name });
320
281
  }
321
282
  if (field.optional) {
322
- return {
323
- ...base,
324
- opt: true,
325
- };
283
+ return Object.assign(Object.assign({}, base), { opt: true });
326
284
  }
327
285
  return base;
328
286
  }
@@ -151,6 +151,7 @@ function newEnumValue(proto, parent) {
151
151
  };
152
152
  }
153
153
  function newMessage(proto, parent, file, us) {
154
+ var _a;
154
155
  (0, assert_js_1.assert)(proto.name, `invalid descriptor: missing name`);
155
156
  const nestedMessages = [];
156
157
  const fields = [];
@@ -196,7 +197,7 @@ function newMessage(proto, parent, file, us) {
196
197
  let oneof = undefined;
197
198
  if (field.oneofIndex !== undefined) {
198
199
  oneof = oneofs[field.oneofIndex];
199
- (0, assert_js_1.assert)(oneof, `invalid descriptor: oneof declaration index ${field.oneofIndex} specified by field #${field.number ?? -1} not found`);
200
+ (0, assert_js_1.assert)(oneof, `invalid descriptor: oneof declaration index ${field.oneofIndex} specified by field #${(_a = field.number) !== null && _a !== void 0 ? _a : -1} not found`);
200
201
  }
201
202
  fields.push(newField(field, message, oneof));
202
203
  }
@@ -209,11 +210,12 @@ function newMessage(proto, parent, file, us) {
209
210
  return message;
210
211
  }
211
212
  function newField(proto, parent, oneof) {
213
+ var _a;
212
214
  (0, assert_js_1.assert)(proto.name, `invalid descriptor: missing name`);
213
215
  (0, assert_js_1.assert)(proto.number, `invalid descriptor: missing number`);
214
216
  (0, assert_js_1.assert)(proto.type, `invalid descriptor: missing type`);
215
217
  let optional = false;
216
- let packed = proto.options?.packed === true;
218
+ let packed = ((_a = proto.options) === null || _a === void 0 ? void 0 : _a.packed) === true;
217
219
  switch (parent.file.syntax) {
218
220
  case "proto2":
219
221
  optional =
@@ -276,6 +278,7 @@ function newField(proto, parent, oneof) {
276
278
  return field;
277
279
  }
278
280
  function resolveField(u, us) {
281
+ var _a;
279
282
  const repeated = u.proto.label === descriptor_pb_js_1.FieldDescriptorProto_Label.REPEATED;
280
283
  switch (u.type) {
281
284
  case descriptor_pb_js_1.FieldDescriptorProto_Type.MESSAGE:
@@ -283,54 +286,28 @@ function resolveField(u, us) {
283
286
  (0, assert_js_1.assert)(u.proto.typeName, `invalid descriptor: ${u.toString()} has type ${descriptor_pb_js_1.FieldDescriptorProto_Type[u.type]}, but type_name is unset`);
284
287
  const refMessage = us.messages[u.proto.typeName];
285
288
  (0, assert_js_1.assert)(refMessage, `invalid descriptor: cannot find type_name "${u.proto.typeName}" specified by ${u.toString()}`);
286
- if (refMessage.proto.options?.mapEntry !== undefined) {
287
- return {
288
- ...u,
289
- repeated: false,
290
- scalarType: undefined,
291
- message: undefined,
292
- enum: undefined,
293
- map: resolveMap(refMessage, us),
294
- };
289
+ if (((_a = refMessage.proto.options) === null || _a === void 0 ? void 0 : _a.mapEntry) !== undefined) {
290
+ return Object.assign(Object.assign({}, u), { repeated: false, scalarType: undefined, message: undefined, enum: undefined, map: resolveMap(refMessage, us) });
295
291
  }
296
- return {
297
- ...u,
298
- repeated,
299
- scalarType: undefined,
300
- message: refMessage,
301
- enum: undefined,
302
- map: undefined,
303
- };
292
+ return Object.assign(Object.assign({}, u), { repeated, scalarType: undefined, message: refMessage, enum: undefined, map: undefined });
304
293
  }
305
294
  case descriptor_pb_js_1.FieldDescriptorProto_Type.ENUM: {
306
295
  (0, assert_js_1.assert)(u.proto.typeName, `invalid descriptor: ${u.toString()} has type ${descriptor_pb_js_1.FieldDescriptorProto_Type[u.type]}, but type_name is unset`);
307
296
  const refEnum = us.enums[u.proto.typeName];
308
297
  (0, assert_js_1.assert)(refEnum, `invalid descriptor: cannot find type_name "${u.proto.typeName}" specified by ${u.toString()}`);
309
- return {
310
- ...u,
311
- repeated,
312
- scalarType: undefined,
313
- message: undefined,
314
- enum: refEnum,
315
- map: undefined,
316
- };
298
+ return Object.assign(Object.assign({}, u), { repeated, scalarType: undefined, message: undefined, enum: refEnum, map: undefined });
317
299
  }
318
300
  default: {
319
301
  const scalarType = fieldTypeToScalarType[u.type];
320
302
  (0, assert_js_1.assert)(scalarType, `invalid descriptor: unable to convert google.protobuf.FieldDescriptorProto.Type ${descriptor_pb_js_1.FieldDescriptorProto_Type[u.type]} to ScalarType`);
321
- return {
322
- ...u,
323
- repeated,
324
- scalarType,
325
- message: undefined,
326
- enum: undefined,
327
- map: undefined,
328
- };
303
+ return Object.assign(Object.assign({}, u), { repeated,
304
+ scalarType, message: undefined, enum: undefined, map: undefined });
329
305
  }
330
306
  }
331
307
  }
332
308
  function resolveMap(mapEntry, us) {
333
- (0, assert_js_1.assert)(mapEntry.proto.options?.mapEntry, `invalid descriptor: expected ${mapEntry.toString()} to be a map entry`);
309
+ var _a;
310
+ (0, assert_js_1.assert)((_a = mapEntry.proto.options) === null || _a === void 0 ? void 0 : _a.mapEntry, `invalid descriptor: expected ${mapEntry.toString()} to be a map entry`);
334
311
  (0, assert_js_1.assert)(mapEntry.fields.length === 2, `invalid descriptor: map entry ${mapEntry.toString()} has ${mapEntry.fields.length} fields`);
335
312
  const uKeyField = mapEntry.fields.find((f) => f.proto.number === 1);
336
313
  (0, assert_js_1.assert)(uKeyField, `invalid descriptor: map entry ${mapEntry.toString()} is missing key field`);
@@ -422,6 +399,7 @@ function newService(proto, file, us) {
422
399
  return service;
423
400
  }
424
401
  function newMethod(proto, parent) {
402
+ var _a;
425
403
  (0, assert_js_1.assert)(proto.name, `invalid descriptor: missing method descriptor name`);
426
404
  (0, assert_js_1.assert)(proto.inputType, `invalid descriptor: missing method input type`);
427
405
  (0, assert_js_1.assert)(proto.outputType, `invalid descriptor: missing method output type`);
@@ -439,7 +417,7 @@ function newMethod(proto, parent) {
439
417
  kind = service_type_js_1.MethodKind.Unary;
440
418
  }
441
419
  let idempotency;
442
- switch (proto.options?.idempotencyLevel) {
420
+ switch ((_a = proto.options) === null || _a === void 0 ? void 0 : _a.idempotencyLevel) {
443
421
  case descriptor_pb_js_1.MethodOptions_IdempotencyLevel.IDEMPOTENT:
444
422
  idempotency = service_type_js_1.MethodIdempotency.Idempotent;
445
423
  break;
@@ -14,7 +14,8 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Any = void 0;
17
- const index_runtime_js_1 = require("../../index-runtime.js");
17
+ const message_js_1 = require("../../message.js");
18
+ const proto3_js_1 = require("../../proto3.js");
18
19
  /**
19
20
  * `Any` contains an arbitrary serialized protocol buffer message along with a
20
21
  * URL that describes the type of the serialized message.
@@ -102,7 +103,7 @@ const index_runtime_js_1 = require("../../index-runtime.js");
102
103
  *
103
104
  * @generated from message google.protobuf.Any
104
105
  */
105
- class Any extends index_runtime_js_1.Message {
106
+ class Any extends message_js_1.Message {
106
107
  constructor(data) {
107
108
  super();
108
109
  /**
@@ -144,14 +145,15 @@ class Any extends index_runtime_js_1.Message {
144
145
  * @generated from field: bytes value = 2;
145
146
  */
146
147
  this.value = new Uint8Array(0);
147
- index_runtime_js_1.proto3.util.initPartial(data, this);
148
+ proto3_js_1.proto3.util.initPartial(data, this);
148
149
  }
149
150
  toJson(options) {
151
+ var _a;
150
152
  if (this.typeUrl === "") {
151
153
  return {};
152
154
  }
153
155
  const typeName = this.typeUrlToName(this.typeUrl);
154
- const messageType = options?.typeRegistry?.findMessage(typeName);
156
+ const messageType = (_a = options === null || options === void 0 ? void 0 : options.typeRegistry) === null || _a === void 0 ? void 0 : _a.findMessage(typeName);
155
157
  if (!messageType) {
156
158
  throw new Error(`cannot encode message google.protobuf.Any to JSON: "${this.typeUrl}" is not in the type registry`);
157
159
  }
@@ -164,6 +166,7 @@ class Any extends index_runtime_js_1.Message {
164
166
  return json;
165
167
  }
166
168
  fromJson(json, options) {
169
+ var _a;
167
170
  if (json === null || Array.isArray(json) || typeof json != "object") {
168
171
  throw new Error(`cannot decode message google.protobuf.Any from JSON: expected object but got ${json === null ? "null" : Array.isArray(json) ? "array" : typeof json}`);
169
172
  }
@@ -171,7 +174,7 @@ class Any extends index_runtime_js_1.Message {
171
174
  if (typeof typeUrl != "string" || typeUrl == "") {
172
175
  throw new Error(`cannot decode message google.protobuf.Any from JSON: "@type" is empty`);
173
176
  }
174
- const typeName = this.typeUrlToName(typeUrl), messageType = options?.typeRegistry?.findMessage(typeName);
177
+ const typeName = this.typeUrlToName(typeUrl), messageType = (_a = options === null || options === void 0 ? void 0 : options.typeRegistry) === null || _a === void 0 ? void 0 : _a.findMessage(typeName);
175
178
  if (!messageType) {
176
179
  throw new Error(`cannot decode message google.protobuf.Any from JSON: ${typeUrl} is not in the type registry`);
177
180
  }
@@ -230,13 +233,13 @@ class Any extends index_runtime_js_1.Message {
230
233
  return new Any().fromJsonString(jsonString, options);
231
234
  }
232
235
  static equals(a, b) {
233
- return index_runtime_js_1.proto3.util.equals(Any, a, b);
236
+ return proto3_js_1.proto3.util.equals(Any, a, b);
234
237
  }
235
238
  }
236
239
  exports.Any = Any;
237
- Any.runtime = index_runtime_js_1.proto3;
240
+ Any.runtime = proto3_js_1.proto3;
238
241
  Any.typeName = "google.protobuf.Any";
239
- Any.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
242
+ Any.fields = proto3_js_1.proto3.util.newFieldList(() => [
240
243
  { no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
241
244
  { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
242
245
  ]);
@@ -14,9 +14,10 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Mixin = exports.Method = exports.Api = void 0;
17
- const index_runtime_js_1 = require("../../index-runtime.js");
17
+ const message_js_1 = require("../../message.js");
18
18
  const type_pb_js_1 = require("./type_pb.js");
19
19
  const source_context_pb_js_1 = require("./source_context_pb.js");
20
+ const proto3_js_1 = require("../../proto3.js");
20
21
  /**
21
22
  * Api is a light-weight descriptor for an API Interface.
22
23
  *
@@ -30,7 +31,7 @@ const source_context_pb_js_1 = require("./source_context_pb.js");
30
31
  *
31
32
  * @generated from message google.protobuf.Api
32
33
  */
33
- class Api extends index_runtime_js_1.Message {
34
+ class Api extends message_js_1.Message {
34
35
  constructor(data) {
35
36
  super();
36
37
  /**
@@ -90,7 +91,7 @@ class Api extends index_runtime_js_1.Message {
90
91
  * @generated from field: google.protobuf.Syntax syntax = 7;
91
92
  */
92
93
  this.syntax = type_pb_js_1.Syntax.PROTO2;
93
- index_runtime_js_1.proto3.util.initPartial(data, this);
94
+ proto3_js_1.proto3.util.initPartial(data, this);
94
95
  }
95
96
  static fromBinary(bytes, options) {
96
97
  return new Api().fromBinary(bytes, options);
@@ -102,27 +103,27 @@ class Api extends index_runtime_js_1.Message {
102
103
  return new Api().fromJsonString(jsonString, options);
103
104
  }
104
105
  static equals(a, b) {
105
- return index_runtime_js_1.proto3.util.equals(Api, a, b);
106
+ return proto3_js_1.proto3.util.equals(Api, a, b);
106
107
  }
107
108
  }
108
109
  exports.Api = Api;
109
- Api.runtime = index_runtime_js_1.proto3;
110
+ Api.runtime = proto3_js_1.proto3;
110
111
  Api.typeName = "google.protobuf.Api";
111
- Api.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
112
+ Api.fields = proto3_js_1.proto3.util.newFieldList(() => [
112
113
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
113
114
  { no: 2, name: "methods", kind: "message", T: Method, repeated: true },
114
115
  { no: 3, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
115
116
  { no: 4, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
116
117
  { no: 5, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
117
118
  { no: 6, name: "mixins", kind: "message", T: Mixin, repeated: true },
118
- { no: 7, name: "syntax", kind: "enum", T: index_runtime_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
119
+ { no: 7, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
119
120
  ]);
120
121
  /**
121
122
  * Method represents a method of an API interface.
122
123
  *
123
124
  * @generated from message google.protobuf.Method
124
125
  */
125
- class Method extends index_runtime_js_1.Message {
126
+ class Method extends message_js_1.Message {
126
127
  constructor(data) {
127
128
  super();
128
129
  /**
@@ -167,7 +168,7 @@ class Method extends index_runtime_js_1.Message {
167
168
  * @generated from field: google.protobuf.Syntax syntax = 7;
168
169
  */
169
170
  this.syntax = type_pb_js_1.Syntax.PROTO2;
170
- index_runtime_js_1.proto3.util.initPartial(data, this);
171
+ proto3_js_1.proto3.util.initPartial(data, this);
171
172
  }
172
173
  static fromBinary(bytes, options) {
173
174
  return new Method().fromBinary(bytes, options);
@@ -179,20 +180,20 @@ class Method extends index_runtime_js_1.Message {
179
180
  return new Method().fromJsonString(jsonString, options);
180
181
  }
181
182
  static equals(a, b) {
182
- return index_runtime_js_1.proto3.util.equals(Method, a, b);
183
+ return proto3_js_1.proto3.util.equals(Method, a, b);
183
184
  }
184
185
  }
185
186
  exports.Method = Method;
186
- Method.runtime = index_runtime_js_1.proto3;
187
+ Method.runtime = proto3_js_1.proto3;
187
188
  Method.typeName = "google.protobuf.Method";
188
- Method.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
189
+ Method.fields = proto3_js_1.proto3.util.newFieldList(() => [
189
190
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
190
191
  { no: 2, name: "request_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
191
192
  { no: 3, name: "request_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
192
193
  { no: 4, name: "response_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
193
194
  { no: 5, name: "response_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
194
195
  { no: 6, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
195
- { no: 7, name: "syntax", kind: "enum", T: index_runtime_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
196
+ { no: 7, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
196
197
  ]);
197
198
  /**
198
199
  * Declares an API Interface to be included in this interface. The including
@@ -276,7 +277,7 @@ Method.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
276
277
  *
277
278
  * @generated from message google.protobuf.Mixin
278
279
  */
279
- class Mixin extends index_runtime_js_1.Message {
280
+ class Mixin extends message_js_1.Message {
280
281
  constructor(data) {
281
282
  super();
282
283
  /**
@@ -292,7 +293,7 @@ class Mixin extends index_runtime_js_1.Message {
292
293
  * @generated from field: string root = 2;
293
294
  */
294
295
  this.root = "";
295
- index_runtime_js_1.proto3.util.initPartial(data, this);
296
+ proto3_js_1.proto3.util.initPartial(data, this);
296
297
  }
297
298
  static fromBinary(bytes, options) {
298
299
  return new Mixin().fromBinary(bytes, options);
@@ -304,13 +305,13 @@ class Mixin extends index_runtime_js_1.Message {
304
305
  return new Mixin().fromJsonString(jsonString, options);
305
306
  }
306
307
  static equals(a, b) {
307
- return index_runtime_js_1.proto3.util.equals(Mixin, a, b);
308
+ return proto3_js_1.proto3.util.equals(Mixin, a, b);
308
309
  }
309
310
  }
310
311
  exports.Mixin = Mixin;
311
- Mixin.runtime = index_runtime_js_1.proto3;
312
+ Mixin.runtime = proto3_js_1.proto3;
312
313
  Mixin.typeName = "google.protobuf.Mixin";
313
- Mixin.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
314
+ Mixin.fields = proto3_js_1.proto3.util.newFieldList(() => [
314
315
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
315
316
  { no: 2, name: "root", kind: "scalar", T: 9 /* ScalarType.STRING */ },
316
317
  ]);
@@ -14,17 +14,18 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CodeGeneratorResponse_File = exports.CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse = exports.CodeGeneratorRequest = exports.Version = void 0;
17
- const index_runtime_js_1 = require("../../../index-runtime.js");
17
+ const message_js_1 = require("../../../message.js");
18
+ const proto2_js_1 = require("../../../proto2.js");
18
19
  const descriptor_pb_js_1 = require("../descriptor_pb.js");
19
20
  /**
20
21
  * The version number of protocol compiler.
21
22
  *
22
23
  * @generated from message google.protobuf.compiler.Version
23
24
  */
24
- class Version extends index_runtime_js_1.Message {
25
+ class Version extends message_js_1.Message {
25
26
  constructor(data) {
26
27
  super();
27
- index_runtime_js_1.proto2.util.initPartial(data, this);
28
+ proto2_js_1.proto2.util.initPartial(data, this);
28
29
  }
29
30
  static fromBinary(bytes, options) {
30
31
  return new Version().fromBinary(bytes, options);
@@ -36,13 +37,13 @@ class Version extends index_runtime_js_1.Message {
36
37
  return new Version().fromJsonString(jsonString, options);
37
38
  }
38
39
  static equals(a, b) {
39
- return index_runtime_js_1.proto2.util.equals(Version, a, b);
40
+ return proto2_js_1.proto2.util.equals(Version, a, b);
40
41
  }
41
42
  }
42
43
  exports.Version = Version;
43
- Version.runtime = index_runtime_js_1.proto2;
44
+ Version.runtime = proto2_js_1.proto2;
44
45
  Version.typeName = "google.protobuf.compiler.Version";
45
- Version.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
46
+ Version.fields = proto2_js_1.proto2.util.newFieldList(() => [
46
47
  { no: 1, name: "major", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
47
48
  { no: 2, name: "minor", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
48
49
  { no: 3, name: "patch", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
@@ -53,7 +54,7 @@ Version.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
53
54
  *
54
55
  * @generated from message google.protobuf.compiler.CodeGeneratorRequest
55
56
  */
56
- class CodeGeneratorRequest extends index_runtime_js_1.Message {
57
+ class CodeGeneratorRequest extends message_js_1.Message {
57
58
  constructor(data) {
58
59
  super();
59
60
  /**
@@ -83,7 +84,7 @@ class CodeGeneratorRequest extends index_runtime_js_1.Message {
83
84
  * @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
84
85
  */
85
86
  this.protoFile = [];
86
- index_runtime_js_1.proto2.util.initPartial(data, this);
87
+ proto2_js_1.proto2.util.initPartial(data, this);
87
88
  }
88
89
  static fromBinary(bytes, options) {
89
90
  return new CodeGeneratorRequest().fromBinary(bytes, options);
@@ -95,13 +96,13 @@ class CodeGeneratorRequest extends index_runtime_js_1.Message {
95
96
  return new CodeGeneratorRequest().fromJsonString(jsonString, options);
96
97
  }
97
98
  static equals(a, b) {
98
- return index_runtime_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
99
+ return proto2_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
99
100
  }
100
101
  }
101
102
  exports.CodeGeneratorRequest = CodeGeneratorRequest;
102
- CodeGeneratorRequest.runtime = index_runtime_js_1.proto2;
103
+ CodeGeneratorRequest.runtime = proto2_js_1.proto2;
103
104
  CodeGeneratorRequest.typeName = "google.protobuf.compiler.CodeGeneratorRequest";
104
- CodeGeneratorRequest.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
105
+ CodeGeneratorRequest.fields = proto2_js_1.proto2.util.newFieldList(() => [
105
106
  { no: 1, name: "file_to_generate", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
106
107
  { no: 2, name: "parameter", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
107
108
  { no: 15, name: "proto_file", kind: "message", T: descriptor_pb_js_1.FileDescriptorProto, repeated: true },
@@ -112,14 +113,14 @@ CodeGeneratorRequest.fields = index_runtime_js_1.proto2.util.newFieldList(() =>
112
113
  *
113
114
  * @generated from message google.protobuf.compiler.CodeGeneratorResponse
114
115
  */
115
- class CodeGeneratorResponse extends index_runtime_js_1.Message {
116
+ class CodeGeneratorResponse extends message_js_1.Message {
116
117
  constructor(data) {
117
118
  super();
118
119
  /**
119
120
  * @generated from field: repeated google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
120
121
  */
121
122
  this.file = [];
122
- index_runtime_js_1.proto2.util.initPartial(data, this);
123
+ proto2_js_1.proto2.util.initPartial(data, this);
123
124
  }
124
125
  static fromBinary(bytes, options) {
125
126
  return new CodeGeneratorResponse().fromBinary(bytes, options);
@@ -131,13 +132,13 @@ class CodeGeneratorResponse extends index_runtime_js_1.Message {
131
132
  return new CodeGeneratorResponse().fromJsonString(jsonString, options);
132
133
  }
133
134
  static equals(a, b) {
134
- return index_runtime_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
135
+ return proto2_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
135
136
  }
136
137
  }
137
138
  exports.CodeGeneratorResponse = CodeGeneratorResponse;
138
- CodeGeneratorResponse.runtime = index_runtime_js_1.proto2;
139
+ CodeGeneratorResponse.runtime = proto2_js_1.proto2;
139
140
  CodeGeneratorResponse.typeName = "google.protobuf.compiler.CodeGeneratorResponse";
140
- CodeGeneratorResponse.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
141
+ CodeGeneratorResponse.fields = proto2_js_1.proto2.util.newFieldList(() => [
141
142
  { no: 1, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
142
143
  { no: 2, name: "supported_features", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },
143
144
  { no: 15, name: "file", kind: "message", T: CodeGeneratorResponse_File, repeated: true },
@@ -159,7 +160,7 @@ var CodeGeneratorResponse_Feature;
159
160
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["PROTO3_OPTIONAL"] = 1] = "PROTO3_OPTIONAL";
160
161
  })(CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse_Feature || (exports.CodeGeneratorResponse_Feature = {}));
161
162
  // Retrieve enum metadata with: proto2.getEnumType(CodeGeneratorResponse_Feature)
162
- index_runtime_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protobuf.compiler.CodeGeneratorResponse.Feature", [
163
+ proto2_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protobuf.compiler.CodeGeneratorResponse.Feature", [
163
164
  { no: 0, name: "FEATURE_NONE" },
164
165
  { no: 1, name: "FEATURE_PROTO3_OPTIONAL" },
165
166
  ]);
@@ -168,10 +169,10 @@ index_runtime_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "googl
168
169
  *
169
170
  * @generated from message google.protobuf.compiler.CodeGeneratorResponse.File
170
171
  */
171
- class CodeGeneratorResponse_File extends index_runtime_js_1.Message {
172
+ class CodeGeneratorResponse_File extends message_js_1.Message {
172
173
  constructor(data) {
173
174
  super();
174
- index_runtime_js_1.proto2.util.initPartial(data, this);
175
+ proto2_js_1.proto2.util.initPartial(data, this);
175
176
  }
176
177
  static fromBinary(bytes, options) {
177
178
  return new CodeGeneratorResponse_File().fromBinary(bytes, options);
@@ -183,13 +184,13 @@ class CodeGeneratorResponse_File extends index_runtime_js_1.Message {
183
184
  return new CodeGeneratorResponse_File().fromJsonString(jsonString, options);
184
185
  }
185
186
  static equals(a, b) {
186
- return index_runtime_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
187
+ return proto2_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
187
188
  }
188
189
  }
189
190
  exports.CodeGeneratorResponse_File = CodeGeneratorResponse_File;
190
- CodeGeneratorResponse_File.runtime = index_runtime_js_1.proto2;
191
+ CodeGeneratorResponse_File.runtime = proto2_js_1.proto2;
191
192
  CodeGeneratorResponse_File.typeName = "google.protobuf.compiler.CodeGeneratorResponse.File";
192
- CodeGeneratorResponse_File.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
193
+ CodeGeneratorResponse_File.fields = proto2_js_1.proto2.util.newFieldList(() => [
193
194
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
194
195
  { no: 2, name: "insertion_point", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
195
196
  { no: 15, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },