@bufbuild/protobuf 1.2.1 → 1.3.0

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 (44) hide show
  1. package/dist/cjs/binary-encoding.js +1 -1
  2. package/dist/cjs/codegen-info.js +1 -0
  3. package/dist/cjs/field.js +1 -1
  4. package/dist/cjs/google/protobuf/any_pb.js +1 -1
  5. package/dist/cjs/google/protobuf/api_pb.js +3 -3
  6. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +5 -5
  7. package/dist/cjs/google/protobuf/descriptor_pb.js +38 -38
  8. package/dist/cjs/google/protobuf/duration_pb.js +1 -1
  9. package/dist/cjs/google/protobuf/empty_pb.js +1 -1
  10. package/dist/cjs/google/protobuf/field_mask_pb.js +1 -1
  11. package/dist/cjs/google/protobuf/source_context_pb.js +1 -1
  12. package/dist/cjs/google/protobuf/struct_pb.js +5 -5
  13. package/dist/cjs/google/protobuf/timestamp_pb.js +1 -1
  14. package/dist/cjs/google/protobuf/type_pb.js +9 -9
  15. package/dist/cjs/google/protobuf/wrappers_pb.js +9 -9
  16. package/dist/cjs/index.js +5 -1
  17. package/dist/cjs/proto-delimited.js +14 -19
  18. package/dist/cjs/proto-double.js +29 -0
  19. package/dist/cjs/proto-int64.js +1 -1
  20. package/dist/cjs/service-type.js +2 -2
  21. package/dist/cjs/to-plain-message.js +67 -0
  22. package/dist/esm/codegen-info.js +1 -0
  23. package/dist/esm/google/protobuf/any_pb.js +1 -2
  24. package/dist/esm/google/protobuf/api_pb.js +3 -6
  25. package/dist/esm/google/protobuf/compiler/plugin_pb.js +4 -8
  26. package/dist/esm/google/protobuf/descriptor_pb.js +28 -56
  27. package/dist/esm/google/protobuf/duration_pb.js +1 -2
  28. package/dist/esm/google/protobuf/empty_pb.js +1 -2
  29. package/dist/esm/google/protobuf/field_mask_pb.js +1 -2
  30. package/dist/esm/google/protobuf/source_context_pb.js +1 -2
  31. package/dist/esm/google/protobuf/struct_pb.js +4 -7
  32. package/dist/esm/google/protobuf/timestamp_pb.js +1 -2
  33. package/dist/esm/google/protobuf/type_pb.js +6 -11
  34. package/dist/esm/google/protobuf/wrappers_pb.js +9 -18
  35. package/dist/esm/index.js +2 -0
  36. package/dist/esm/proto-delimited.js +14 -19
  37. package/dist/esm/proto-double.js +26 -0
  38. package/dist/esm/proto-int64.js +1 -1
  39. package/dist/esm/to-plain-message.js +63 -0
  40. package/dist/types/codegen-info.d.ts +1 -1
  41. package/dist/types/index.d.ts +2 -0
  42. package/dist/types/proto-double.d.ts +5 -0
  43. package/dist/types/to-plain-message.d.ts +9 -0
  44. package/package.json +1 -1
@@ -160,10 +160,10 @@ class Duration extends message_js_1.Message {
160
160
  return proto3_js_1.proto3.util.equals(Duration, a, b);
161
161
  }
162
162
  }
163
+ exports.Duration = Duration;
163
164
  Duration.runtime = proto3_js_1.proto3;
164
165
  Duration.typeName = "google.protobuf.Duration";
165
166
  Duration.fields = proto3_js_1.proto3.util.newFieldList(() => [
166
167
  { no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
167
168
  { no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
168
169
  ]);
169
- exports.Duration = Duration;
@@ -46,7 +46,7 @@ class Empty extends message_js_1.Message {
46
46
  return proto3_js_1.proto3.util.equals(Empty, a, b);
47
47
  }
48
48
  }
49
+ exports.Empty = Empty;
49
50
  Empty.runtime = proto3_js_1.proto3;
50
51
  Empty.typeName = "google.protobuf.Empty";
51
52
  Empty.fields = proto3_js_1.proto3.util.newFieldList(() => []);
52
- exports.Empty = Empty;
@@ -303,9 +303,9 @@ class FieldMask extends message_js_1.Message {
303
303
  return proto3_js_1.proto3.util.equals(FieldMask, a, b);
304
304
  }
305
305
  }
306
+ exports.FieldMask = FieldMask;
306
307
  FieldMask.runtime = proto3_js_1.proto3;
307
308
  FieldMask.typeName = "google.protobuf.FieldMask";
308
309
  FieldMask.fields = proto3_js_1.proto3.util.newFieldList(() => [
309
310
  { no: 1, name: "paths", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
310
311
  ]);
311
- exports.FieldMask = FieldMask;
@@ -47,9 +47,9 @@ class SourceContext extends message_js_1.Message {
47
47
  return proto3_js_1.proto3.util.equals(SourceContext, a, b);
48
48
  }
49
49
  }
50
+ exports.SourceContext = SourceContext;
50
51
  SourceContext.runtime = proto3_js_1.proto3;
51
52
  SourceContext.typeName = "google.protobuf.SourceContext";
52
53
  SourceContext.fields = proto3_js_1.proto3.util.newFieldList(() => [
53
54
  { no: 1, name: "file_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
54
55
  ]);
55
- exports.SourceContext = SourceContext;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
17
- // @generated by protoc-gen-es v1.2.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.3.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -35,7 +35,7 @@ var NullValue;
35
35
  * @generated from enum value: NULL_VALUE = 0;
36
36
  */
37
37
  NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
38
- })(NullValue = exports.NullValue || (exports.NullValue = {}));
38
+ })(NullValue || (exports.NullValue = NullValue = {}));
39
39
  // Retrieve enum metadata with: proto3.getEnumType(NullValue)
40
40
  proto3_js_1.proto3.util.setEnumType(NullValue, "google.protobuf.NullValue", [
41
41
  { no: 0, name: "NULL_VALUE" },
@@ -92,12 +92,12 @@ class Struct extends message_js_1.Message {
92
92
  return proto3_js_1.proto3.util.equals(Struct, a, b);
93
93
  }
94
94
  }
95
+ exports.Struct = Struct;
95
96
  Struct.runtime = proto3_js_1.proto3;
96
97
  Struct.typeName = "google.protobuf.Struct";
97
98
  Struct.fields = proto3_js_1.proto3.util.newFieldList(() => [
98
99
  { no: 1, name: "fields", kind: "map", K: 9 /* ScalarType.STRING */, V: { kind: "message", T: Value } },
99
100
  ]);
100
- exports.Struct = Struct;
101
101
  /**
102
102
  * `Value` represents a dynamically typed value which can be either
103
103
  * null, a number, a string, a boolean, a recursive struct value, or a
@@ -178,6 +178,7 @@ class Value extends message_js_1.Message {
178
178
  return proto3_js_1.proto3.util.equals(Value, a, b);
179
179
  }
180
180
  }
181
+ exports.Value = Value;
181
182
  Value.runtime = proto3_js_1.proto3;
182
183
  Value.typeName = "google.protobuf.Value";
183
184
  Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -188,7 +189,6 @@ Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
188
189
  { no: 5, name: "struct_value", kind: "message", T: Struct, oneof: "kind" },
189
190
  { no: 6, name: "list_value", kind: "message", T: ListValue, oneof: "kind" },
190
191
  ]);
191
- exports.Value = Value;
192
192
  /**
193
193
  * `ListValue` is a wrapper around a repeated field of values.
194
194
  *
@@ -232,9 +232,9 @@ class ListValue extends message_js_1.Message {
232
232
  return proto3_js_1.proto3.util.equals(ListValue, a, b);
233
233
  }
234
234
  }
235
+ exports.ListValue = ListValue;
235
236
  ListValue.runtime = proto3_js_1.proto3;
236
237
  ListValue.typeName = "google.protobuf.ListValue";
237
238
  ListValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
238
239
  { no: 1, name: "values", kind: "message", T: Value, repeated: true },
239
240
  ]);
240
- exports.ListValue = ListValue;
@@ -204,10 +204,10 @@ class Timestamp extends message_js_1.Message {
204
204
  return proto3_js_1.proto3.util.equals(Timestamp, a, b);
205
205
  }
206
206
  }
207
+ exports.Timestamp = Timestamp;
207
208
  Timestamp.runtime = proto3_js_1.proto3;
208
209
  Timestamp.typeName = "google.protobuf.Timestamp";
209
210
  Timestamp.fields = proto3_js_1.proto3.util.newFieldList(() => [
210
211
  { no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
211
212
  { no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
212
213
  ]);
213
- exports.Timestamp = Timestamp;
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
17
- // @generated by protoc-gen-es v1.2.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
17
+ // @generated by protoc-gen-es v1.3.0 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
18
18
  // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
19
19
  /* eslint-disable */
20
20
  const proto3_js_1 = require("../../proto3.js");
@@ -46,7 +46,7 @@ var Syntax;
46
46
  * @generated from enum value: SYNTAX_EDITIONS = 2;
47
47
  */
48
48
  Syntax[Syntax["EDITIONS"] = 2] = "EDITIONS";
49
- })(Syntax = exports.Syntax || (exports.Syntax = {}));
49
+ })(Syntax || (exports.Syntax = Syntax = {}));
50
50
  // Retrieve enum metadata with: proto3.getEnumType(Syntax)
51
51
  proto3_js_1.proto3.util.setEnumType(Syntax, "google.protobuf.Syntax", [
52
52
  { no: 0, name: "SYNTAX_PROTO2" },
@@ -112,6 +112,7 @@ class Type extends message_js_1.Message {
112
112
  return proto3_js_1.proto3.util.equals(Type, a, b);
113
113
  }
114
114
  }
115
+ exports.Type = Type;
115
116
  Type.runtime = proto3_js_1.proto3;
116
117
  Type.typeName = "google.protobuf.Type";
117
118
  Type.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -123,7 +124,6 @@ Type.fields = proto3_js_1.proto3.util.newFieldList(() => [
123
124
  { no: 6, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(Syntax) },
124
125
  { no: 7, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
125
126
  ]);
126
- exports.Type = Type;
127
127
  /**
128
128
  * A single field of a message type.
129
129
  *
@@ -209,6 +209,7 @@ class Field extends message_js_1.Message {
209
209
  return proto3_js_1.proto3.util.equals(Field, a, b);
210
210
  }
211
211
  }
212
+ exports.Field = Field;
212
213
  Field.runtime = proto3_js_1.proto3;
213
214
  Field.typeName = "google.protobuf.Field";
214
215
  Field.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -223,7 +224,6 @@ Field.fields = proto3_js_1.proto3.util.newFieldList(() => [
223
224
  { no: 10, name: "json_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
224
225
  { no: 11, name: "default_value", kind: "scalar", T: 9 /* ScalarType.STRING */ },
225
226
  ]);
226
- exports.Field = Field;
227
227
  /**
228
228
  * Basic field types.
229
229
  *
@@ -345,7 +345,7 @@ var Field_Kind;
345
345
  * @generated from enum value: TYPE_SINT64 = 18;
346
346
  */
347
347
  Field_Kind[Field_Kind["TYPE_SINT64"] = 18] = "TYPE_SINT64";
348
- })(Field_Kind = exports.Field_Kind || (exports.Field_Kind = {}));
348
+ })(Field_Kind || (exports.Field_Kind = Field_Kind = {}));
349
349
  // Retrieve enum metadata with: proto3.getEnumType(Field_Kind)
350
350
  proto3_js_1.proto3.util.setEnumType(Field_Kind, "google.protobuf.Field.Kind", [
351
351
  { no: 0, name: "TYPE_UNKNOWN" },
@@ -399,7 +399,7 @@ var Field_Cardinality;
399
399
  * @generated from enum value: CARDINALITY_REPEATED = 3;
400
400
  */
401
401
  Field_Cardinality[Field_Cardinality["REPEATED"] = 3] = "REPEATED";
402
- })(Field_Cardinality = exports.Field_Cardinality || (exports.Field_Cardinality = {}));
402
+ })(Field_Cardinality || (exports.Field_Cardinality = Field_Cardinality = {}));
403
403
  // Retrieve enum metadata with: proto3.getEnumType(Field_Cardinality)
404
404
  proto3_js_1.proto3.util.setEnumType(Field_Cardinality, "google.protobuf.Field.Cardinality", [
405
405
  { no: 0, name: "CARDINALITY_UNKNOWN" },
@@ -460,6 +460,7 @@ class Enum extends message_js_1.Message {
460
460
  return proto3_js_1.proto3.util.equals(Enum, a, b);
461
461
  }
462
462
  }
463
+ exports.Enum = Enum;
463
464
  Enum.runtime = proto3_js_1.proto3;
464
465
  Enum.typeName = "google.protobuf.Enum";
465
466
  Enum.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -470,7 +471,6 @@ Enum.fields = proto3_js_1.proto3.util.newFieldList(() => [
470
471
  { no: 5, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(Syntax) },
471
472
  { no: 6, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
472
473
  ]);
473
- exports.Enum = Enum;
474
474
  /**
475
475
  * Enum value definition.
476
476
  *
@@ -512,6 +512,7 @@ class EnumValue extends message_js_1.Message {
512
512
  return proto3_js_1.proto3.util.equals(EnumValue, a, b);
513
513
  }
514
514
  }
515
+ exports.EnumValue = EnumValue;
515
516
  EnumValue.runtime = proto3_js_1.proto3;
516
517
  EnumValue.typeName = "google.protobuf.EnumValue";
517
518
  EnumValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -519,7 +520,6 @@ EnumValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
519
520
  { no: 2, name: "number", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
520
521
  { no: 3, name: "options", kind: "message", T: Option, repeated: true },
521
522
  ]);
522
- exports.EnumValue = EnumValue;
523
523
  /**
524
524
  * A protocol buffer option, which can be attached to a message, field,
525
525
  * enumeration, etc.
@@ -553,10 +553,10 @@ class Option extends message_js_1.Message {
553
553
  return proto3_js_1.proto3.util.equals(Option, a, b);
554
554
  }
555
555
  }
556
+ exports.Option = Option;
556
557
  Option.runtime = proto3_js_1.proto3;
557
558
  Option.typeName = "google.protobuf.Option";
558
559
  Option.fields = proto3_js_1.proto3.util.newFieldList(() => [
559
560
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
560
561
  { no: 2, name: "value", kind: "message", T: any_pb_js_1.Any },
561
562
  ]);
562
- exports.Option = Option;
@@ -65,6 +65,7 @@ class DoubleValue extends message_js_1.Message {
65
65
  return proto3_js_1.proto3.util.equals(DoubleValue, a, b);
66
66
  }
67
67
  }
68
+ exports.DoubleValue = DoubleValue;
68
69
  DoubleValue.runtime = proto3_js_1.proto3;
69
70
  DoubleValue.typeName = "google.protobuf.DoubleValue";
70
71
  DoubleValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -78,7 +79,6 @@ DoubleValue.fieldWrapper = {
78
79
  return value.value;
79
80
  }
80
81
  };
81
- exports.DoubleValue = DoubleValue;
82
82
  /**
83
83
  * Wrapper message for `float`.
84
84
  *
@@ -126,6 +126,7 @@ class FloatValue extends message_js_1.Message {
126
126
  return proto3_js_1.proto3.util.equals(FloatValue, a, b);
127
127
  }
128
128
  }
129
+ exports.FloatValue = FloatValue;
129
130
  FloatValue.runtime = proto3_js_1.proto3;
130
131
  FloatValue.typeName = "google.protobuf.FloatValue";
131
132
  FloatValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -139,7 +140,6 @@ FloatValue.fieldWrapper = {
139
140
  return value.value;
140
141
  }
141
142
  };
142
- exports.FloatValue = FloatValue;
143
143
  /**
144
144
  * Wrapper message for `int64`.
145
145
  *
@@ -187,6 +187,7 @@ class Int64Value extends message_js_1.Message {
187
187
  return proto3_js_1.proto3.util.equals(Int64Value, a, b);
188
188
  }
189
189
  }
190
+ exports.Int64Value = Int64Value;
190
191
  Int64Value.runtime = proto3_js_1.proto3;
191
192
  Int64Value.typeName = "google.protobuf.Int64Value";
192
193
  Int64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -200,7 +201,6 @@ Int64Value.fieldWrapper = {
200
201
  return value.value;
201
202
  }
202
203
  };
203
- exports.Int64Value = Int64Value;
204
204
  /**
205
205
  * Wrapper message for `uint64`.
206
206
  *
@@ -248,6 +248,7 @@ class UInt64Value extends message_js_1.Message {
248
248
  return proto3_js_1.proto3.util.equals(UInt64Value, a, b);
249
249
  }
250
250
  }
251
+ exports.UInt64Value = UInt64Value;
251
252
  UInt64Value.runtime = proto3_js_1.proto3;
252
253
  UInt64Value.typeName = "google.protobuf.UInt64Value";
253
254
  UInt64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -261,7 +262,6 @@ UInt64Value.fieldWrapper = {
261
262
  return value.value;
262
263
  }
263
264
  };
264
- exports.UInt64Value = UInt64Value;
265
265
  /**
266
266
  * Wrapper message for `int32`.
267
267
  *
@@ -309,6 +309,7 @@ class Int32Value extends message_js_1.Message {
309
309
  return proto3_js_1.proto3.util.equals(Int32Value, a, b);
310
310
  }
311
311
  }
312
+ exports.Int32Value = Int32Value;
312
313
  Int32Value.runtime = proto3_js_1.proto3;
313
314
  Int32Value.typeName = "google.protobuf.Int32Value";
314
315
  Int32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -322,7 +323,6 @@ Int32Value.fieldWrapper = {
322
323
  return value.value;
323
324
  }
324
325
  };
325
- exports.Int32Value = Int32Value;
326
326
  /**
327
327
  * Wrapper message for `uint32`.
328
328
  *
@@ -370,6 +370,7 @@ class UInt32Value extends message_js_1.Message {
370
370
  return proto3_js_1.proto3.util.equals(UInt32Value, a, b);
371
371
  }
372
372
  }
373
+ exports.UInt32Value = UInt32Value;
373
374
  UInt32Value.runtime = proto3_js_1.proto3;
374
375
  UInt32Value.typeName = "google.protobuf.UInt32Value";
375
376
  UInt32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -383,7 +384,6 @@ UInt32Value.fieldWrapper = {
383
384
  return value.value;
384
385
  }
385
386
  };
386
- exports.UInt32Value = UInt32Value;
387
387
  /**
388
388
  * Wrapper message for `bool`.
389
389
  *
@@ -431,6 +431,7 @@ class BoolValue extends message_js_1.Message {
431
431
  return proto3_js_1.proto3.util.equals(BoolValue, a, b);
432
432
  }
433
433
  }
434
+ exports.BoolValue = BoolValue;
434
435
  BoolValue.runtime = proto3_js_1.proto3;
435
436
  BoolValue.typeName = "google.protobuf.BoolValue";
436
437
  BoolValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -444,7 +445,6 @@ BoolValue.fieldWrapper = {
444
445
  return value.value;
445
446
  }
446
447
  };
447
- exports.BoolValue = BoolValue;
448
448
  /**
449
449
  * Wrapper message for `string`.
450
450
  *
@@ -492,6 +492,7 @@ class StringValue extends message_js_1.Message {
492
492
  return proto3_js_1.proto3.util.equals(StringValue, a, b);
493
493
  }
494
494
  }
495
+ exports.StringValue = StringValue;
495
496
  StringValue.runtime = proto3_js_1.proto3;
496
497
  StringValue.typeName = "google.protobuf.StringValue";
497
498
  StringValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -505,7 +506,6 @@ StringValue.fieldWrapper = {
505
506
  return value.value;
506
507
  }
507
508
  };
508
- exports.StringValue = StringValue;
509
509
  /**
510
510
  * Wrapper message for `bytes`.
511
511
  *
@@ -553,6 +553,7 @@ class BytesValue extends message_js_1.Message {
553
553
  return proto3_js_1.proto3.util.equals(BytesValue, a, b);
554
554
  }
555
555
  }
556
+ exports.BytesValue = BytesValue;
556
557
  BytesValue.runtime = proto3_js_1.proto3;
557
558
  BytesValue.typeName = "google.protobuf.BytesValue";
558
559
  BytesValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
@@ -566,4 +567,3 @@ BytesValue.fieldWrapper = {
566
567
  return value.value;
567
568
  }
568
569
  };
569
- exports.BytesValue = BytesValue;
package/dist/cjs/index.js CHANGED
@@ -27,11 +27,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
27
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.createRegistryFromDescriptors = exports.createRegistry = exports.createDescriptorSet = exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.MethodIdempotency = exports.MethodKind = exports.ScalarType = exports.Message = exports.codegenInfo = exports.protoDelimited = exports.protoBase64 = exports.protoInt64 = exports.proto2 = exports.proto3 = void 0;
30
+ exports.toPlainMessage = exports.createRegistryFromDescriptors = exports.createRegistry = exports.createDescriptorSet = exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.MethodIdempotency = exports.MethodKind = exports.ScalarType = exports.Message = exports.codegenInfo = exports.protoDelimited = exports.protoBase64 = exports.protoInt64 = exports.protoDouble = exports.proto2 = exports.proto3 = void 0;
31
31
  var proto3_js_1 = require("./proto3.js");
32
32
  Object.defineProperty(exports, "proto3", { enumerable: true, get: function () { return proto3_js_1.proto3; } });
33
33
  var proto2_js_1 = require("./proto2.js");
34
34
  Object.defineProperty(exports, "proto2", { enumerable: true, get: function () { return proto2_js_1.proto2; } });
35
+ var proto_double_js_1 = require("./proto-double.js");
36
+ Object.defineProperty(exports, "protoDouble", { enumerable: true, get: function () { return proto_double_js_1.protoDouble; } });
35
37
  var proto_int64_js_1 = require("./proto-int64.js");
36
38
  Object.defineProperty(exports, "protoInt64", { enumerable: true, get: function () { return proto_int64_js_1.protoInt64; } });
37
39
  var proto_base64_js_1 = require("./proto-base64.js");
@@ -57,6 +59,8 @@ var create_registry_js_1 = require("./create-registry.js");
57
59
  Object.defineProperty(exports, "createRegistry", { enumerable: true, get: function () { return create_registry_js_1.createRegistry; } });
58
60
  var create_registry_from_desc_js_1 = require("./create-registry-from-desc.js");
59
61
  Object.defineProperty(exports, "createRegistryFromDescriptors", { enumerable: true, get: function () { return create_registry_from_desc_js_1.createRegistryFromDescriptors; } });
62
+ var to_plain_message_js_1 = require("./to-plain-message.js");
63
+ Object.defineProperty(exports, "toPlainMessage", { enumerable: true, get: function () { return to_plain_message_js_1.toPlainMessage; } });
60
64
  // ideally, we would export these types with sub-path exports:
61
65
  __exportStar(require("./google/protobuf/compiler/plugin_pb.js"), exports);
62
66
  __exportStar(require("./google/protobuf/api_pb.js"), exports);
@@ -75,28 +75,23 @@ exports.protoDelimited = {
75
75
  }
76
76
  let buffer = new Uint8Array(0);
77
77
  try {
78
- for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), _a = iterable_1_1.done, !_a;) {
78
+ for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), _a = iterable_1_1.done, !_a; _d = true) {
79
79
  _c = iterable_1_1.value;
80
80
  _d = false;
81
- try {
82
- const chunk = _c;
83
- buffer = append(buffer, chunk);
84
- for (;;) {
85
- const size = exports.protoDelimited.peekSize(buffer);
86
- if (size.eof) {
87
- // size is incomplete, buffer more data
88
- break;
89
- }
90
- if (size.offset + size.size > buffer.byteLength) {
91
- // message is incomplete, buffer more data
92
- break;
93
- }
94
- yield yield __await(exports.protoDelimited.dec(type, buffer));
95
- buffer = buffer.subarray(size.offset + size.size);
81
+ const chunk = _c;
82
+ buffer = append(buffer, chunk);
83
+ for (;;) {
84
+ const size = exports.protoDelimited.peekSize(buffer);
85
+ if (size.eof) {
86
+ // size is incomplete, buffer more data
87
+ break;
96
88
  }
97
- }
98
- finally {
99
- _d = true;
89
+ if (size.offset + size.size > buffer.byteLength) {
90
+ // message is incomplete, buffer more data
91
+ break;
92
+ }
93
+ yield yield __await(exports.protoDelimited.dec(type, buffer));
94
+ buffer = buffer.subarray(size.offset + size.size);
100
95
  }
101
96
  }
102
97
  }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ // Copyright 2021-2023 Buf Technologies, Inc.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.protoDouble = void 0;
17
+ // Export global Number constants. This is done so that we can safely use
18
+ // these global constants when generating code and be assured we're using
19
+ // the correct values. We cannot rely on globalThis since we support ES2017
20
+ // and globalThis was introduced in ES2020. We also don't want to explicitly
21
+ // generate code using, for example, Number.NaN, since this could clash with
22
+ // a message name of Number. Instead we can export them here since this will
23
+ // be in a different scope as the generated code and we are guaranteed to use
24
+ // the intended global values.
25
+ exports.protoDouble = {
26
+ NaN: Number.NaN,
27
+ POSITIVE_INFINITY: Number.POSITIVE_INFINITY,
28
+ NEGATIVE_INFINITY: Number.NEGATIVE_INFINITY,
29
+ };
@@ -19,7 +19,7 @@ const varint_js_1 = require("./google/varint.js");
19
19
  function makeInt64Support() {
20
20
  const dv = new DataView(new ArrayBuffer(8));
21
21
  // note that Safari 14 implements BigInt, but not the DataView methods
22
- const ok = globalThis.BigInt !== undefined &&
22
+ const ok = typeof BigInt === "function" &&
23
23
  typeof dv.getBigInt64 === "function" &&
24
24
  typeof dv.getBigUint64 === "function" &&
25
25
  typeof dv.setBigInt64 === "function" &&
@@ -29,7 +29,7 @@ var MethodKind;
29
29
  MethodKind[MethodKind["ServerStreaming"] = 1] = "ServerStreaming";
30
30
  MethodKind[MethodKind["ClientStreaming"] = 2] = "ClientStreaming";
31
31
  MethodKind[MethodKind["BiDiStreaming"] = 3] = "BiDiStreaming";
32
- })(MethodKind = exports.MethodKind || (exports.MethodKind = {}));
32
+ })(MethodKind || (exports.MethodKind = MethodKind = {}));
33
33
  /**
34
34
  * Is this method side-effect-free (or safe in HTTP parlance), or just
35
35
  * idempotent, or neither? HTTP based RPC implementation may choose GET verb
@@ -50,4 +50,4 @@ var MethodIdempotency;
50
50
  * Idempotent, but may have side effects.
51
51
  */
52
52
  MethodIdempotency[MethodIdempotency["Idempotent"] = 2] = "Idempotent";
53
- })(MethodIdempotency = exports.MethodIdempotency || (exports.MethodIdempotency = {}));
53
+ })(MethodIdempotency || (exports.MethodIdempotency = MethodIdempotency = {}));
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ // Copyright 2021-2023 Buf Technologies, Inc.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.toPlainMessage = void 0;
17
+ /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
18
+ const message_js_1 = require("./message.js");
19
+ /**
20
+ * toPlainMessage returns a new object by striping
21
+ * all methods from a message, leaving only fields and
22
+ * oneof groups. It is recursive, meaning it applies this
23
+ * same logic to all nested message fields as well.
24
+ */
25
+ function toPlainMessage(message) {
26
+ const type = message.getType();
27
+ const target = {};
28
+ for (const member of type.fields.byMember()) {
29
+ const source = message[member.localName];
30
+ let copy;
31
+ if (member.repeated) {
32
+ copy = source.map((e) => toPlainValue(e));
33
+ }
34
+ else if (member.kind == "map") {
35
+ copy = {};
36
+ for (const [key, v] of Object.entries(source)) {
37
+ copy[key] = toPlainValue(v);
38
+ }
39
+ }
40
+ else if (member.kind == "oneof") {
41
+ const f = member.findField(source.case);
42
+ copy = f
43
+ ? { case: source.case, value: toPlainValue(source.value) }
44
+ : { case: undefined };
45
+ }
46
+ else {
47
+ copy = toPlainValue(source);
48
+ }
49
+ target[member.localName] = copy;
50
+ }
51
+ return target;
52
+ }
53
+ exports.toPlainMessage = toPlainMessage;
54
+ function toPlainValue(value) {
55
+ if (value === undefined) {
56
+ return value;
57
+ }
58
+ if (value instanceof message_js_1.Message) {
59
+ return toPlainMessage(value);
60
+ }
61
+ if (value instanceof Uint8Array) {
62
+ const c = new Uint8Array(value.byteLength);
63
+ c.set(value);
64
+ return c;
65
+ }
66
+ return value;
67
+ }
@@ -39,6 +39,7 @@ export const codegenInfo = {
39
39
  JsonWriteOptions: { typeOnly: true, privateImportPath: "./json-format.js", publicImportPath: packageName },
40
40
  JsonValue: { typeOnly: true, privateImportPath: "./json-format.js", publicImportPath: packageName },
41
41
  JsonObject: { typeOnly: true, privateImportPath: "./json-format.js", publicImportPath: packageName },
42
+ protoDouble: { typeOnly: false, privateImportPath: "./proto-double.js", publicImportPath: packageName },
42
43
  protoInt64: { typeOnly: false, privateImportPath: "./proto-int64.js", publicImportPath: packageName },
43
44
  ScalarType: { typeOnly: false, privateImportPath: "./field.js", publicImportPath: packageName },
44
45
  MethodKind: { typeOnly: false, privateImportPath: "./service-type.js", publicImportPath: packageName },
@@ -103,7 +103,7 @@ import { proto3 } from "../../proto3.js";
103
103
  *
104
104
  * @generated from message google.protobuf.Any
105
105
  */
106
- class Any extends Message {
106
+ export class Any extends Message {
107
107
  constructor(data) {
108
108
  super();
109
109
  /**
@@ -266,4 +266,3 @@ Any.fields = proto3.util.newFieldList(() => [
266
266
  { no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
267
267
  { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
268
268
  ]);
269
- export { Any };
@@ -28,7 +28,7 @@ import { proto3 } from "../../proto3.js";
28
28
  *
29
29
  * @generated from message google.protobuf.Api
30
30
  */
31
- class Api extends Message {
31
+ export class Api extends Message {
32
32
  constructor(data) {
33
33
  super();
34
34
  /**
@@ -113,13 +113,12 @@ Api.fields = proto3.util.newFieldList(() => [
113
113
  { no: 6, name: "mixins", kind: "message", T: Mixin, repeated: true },
114
114
  { no: 7, name: "syntax", kind: "enum", T: proto3.getEnumType(Syntax) },
115
115
  ]);
116
- export { Api };
117
116
  /**
118
117
  * Method represents a method of an API interface.
119
118
  *
120
119
  * @generated from message google.protobuf.Method
121
120
  */
122
- class Method extends Message {
121
+ export class Method extends Message {
123
122
  constructor(data) {
124
123
  super();
125
124
  /**
@@ -190,7 +189,6 @@ Method.fields = proto3.util.newFieldList(() => [
190
189
  { no: 6, name: "options", kind: "message", T: Option, repeated: true },
191
190
  { no: 7, name: "syntax", kind: "enum", T: proto3.getEnumType(Syntax) },
192
191
  ]);
193
- export { Method };
194
192
  /**
195
193
  * Declares an API Interface to be included in this interface. The including
196
194
  * interface must redeclare all the methods from the included interface, but
@@ -273,7 +271,7 @@ export { Method };
273
271
  *
274
272
  * @generated from message google.protobuf.Mixin
275
273
  */
276
- class Mixin extends Message {
274
+ export class Mixin extends Message {
277
275
  constructor(data) {
278
276
  super();
279
277
  /**
@@ -310,4 +308,3 @@ Mixin.fields = proto3.util.newFieldList(() => [
310
308
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
311
309
  { no: 2, name: "root", kind: "scalar", T: 9 /* ScalarType.STRING */ },
312
310
  ]);
313
- export { Mixin };