ts-proto 2.8.2 → 2.9.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.
@@ -29,6 +29,11 @@ export interface CodeGeneratorRequest {
29
29
  * they import. The files will appear in topological order, so each file
30
30
  * appears before any file that imports it.
31
31
  *
32
+ * Note: the files listed in files_to_generate will include runtime-retention
33
+ * options only, but all other files will include source-retention options.
34
+ * The source_file_descriptors field below is available in case you need
35
+ * source-retention options for files_to_generate.
36
+ *
32
37
  * protoc guarantees that all proto_files will be written after
33
38
  * the fields above, even though this is not technically guaranteed by the
34
39
  * protobuf wire format. This theoretically could allow a plugin to stream
@@ -41,6 +46,12 @@ export interface CodeGeneratorRequest {
41
46
  * fully qualified.
42
47
  */
43
48
  protoFile: FileDescriptorProto[];
49
+ /**
50
+ * File descriptors with all options, including source-retention options.
51
+ * These descriptors are only provided for the files listed in
52
+ * files_to_generate.
53
+ */
54
+ sourceFileDescriptors: FileDescriptorProto[];
44
55
  /** The version number of protocol compiler. */
45
56
  compilerVersion: Version | undefined;
46
57
  _unknownFields?: {
@@ -65,6 +76,20 @@ export interface CodeGeneratorResponse {
65
76
  * This is a bitwise "or" of values from the Feature enum.
66
77
  */
67
78
  supportedFeatures: number;
79
+ /**
80
+ * The minimum edition this plugin supports. This will be treated as an
81
+ * Edition enum, but we want to allow unknown values. It should be specified
82
+ * according the edition enum value, *not* the edition number. Only takes
83
+ * effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
84
+ */
85
+ minimumEdition: number;
86
+ /**
87
+ * The maximum edition this plugin supports. This will be treated as an
88
+ * Edition enum, but we want to allow unknown values. It should be specified
89
+ * according the edition enum value, *not* the edition number. Only takes
90
+ * effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
91
+ */
92
+ maximumEdition: number;
68
93
  file: CodeGeneratorResponse_File[];
69
94
  _unknownFields?: {
70
95
  [key: number]: Uint8Array[];
@@ -74,6 +99,7 @@ export interface CodeGeneratorResponse {
74
99
  export declare enum CodeGeneratorResponse_Feature {
75
100
  FEATURE_NONE = 0,
76
101
  FEATURE_PROTO3_OPTIONAL = 1,
102
+ FEATURE_SUPPORTS_EDITIONS = 2,
77
103
  UNRECOGNIZED = -1
78
104
  }
79
105
  export declare function codeGeneratorResponse_FeatureFromJSON(object: any): CodeGeneratorResponse_Feature;
@@ -2,7 +2,7 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.0.3
5
- // protoc v3.21.12
5
+ // protoc v6.33.1
6
6
  // source: google/protobuf/compiler/plugin.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.CodeGeneratorResponse_File = exports.CodeGeneratorResponse = exports.CodeGeneratorRequest = exports.Version = exports.CodeGeneratorResponse_Feature = void 0;
@@ -16,6 +16,7 @@ var CodeGeneratorResponse_Feature;
16
16
  (function (CodeGeneratorResponse_Feature) {
17
17
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["FEATURE_NONE"] = 0] = "FEATURE_NONE";
18
18
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["FEATURE_PROTO3_OPTIONAL"] = 1] = "FEATURE_PROTO3_OPTIONAL";
19
+ CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["FEATURE_SUPPORTS_EDITIONS"] = 2] = "FEATURE_SUPPORTS_EDITIONS";
19
20
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
20
21
  })(CodeGeneratorResponse_Feature || (exports.CodeGeneratorResponse_Feature = CodeGeneratorResponse_Feature = {}));
21
22
  function codeGeneratorResponse_FeatureFromJSON(object) {
@@ -26,6 +27,9 @@ function codeGeneratorResponse_FeatureFromJSON(object) {
26
27
  case 1:
27
28
  case "FEATURE_PROTO3_OPTIONAL":
28
29
  return CodeGeneratorResponse_Feature.FEATURE_PROTO3_OPTIONAL;
30
+ case 2:
31
+ case "FEATURE_SUPPORTS_EDITIONS":
32
+ return CodeGeneratorResponse_Feature.FEATURE_SUPPORTS_EDITIONS;
29
33
  case -1:
30
34
  case "UNRECOGNIZED":
31
35
  default:
@@ -38,6 +42,8 @@ function codeGeneratorResponse_FeatureToJSON(object) {
38
42
  return "FEATURE_NONE";
39
43
  case CodeGeneratorResponse_Feature.FEATURE_PROTO3_OPTIONAL:
40
44
  return "FEATURE_PROTO3_OPTIONAL";
45
+ case CodeGeneratorResponse_Feature.FEATURE_SUPPORTS_EDITIONS:
46
+ return "FEATURE_SUPPORTS_EDITIONS";
41
47
  case CodeGeneratorResponse_Feature.UNRECOGNIZED:
42
48
  default:
43
49
  return "UNRECOGNIZED";
@@ -72,7 +78,7 @@ exports.Version = {
72
78
  },
73
79
  decode(input, length) {
74
80
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
75
- const end = length === undefined ? reader.len : reader.pos + length;
81
+ let end = length === undefined ? reader.len : reader.pos + length;
76
82
  const message = Object.create(createBaseVersion());
77
83
  while (reader.pos < end) {
78
84
  const tag = reader.uint32();
@@ -156,7 +162,7 @@ exports.Version = {
156
162
  },
157
163
  };
158
164
  function createBaseCodeGeneratorRequest() {
159
- return { fileToGenerate: [], parameter: "", protoFile: [], compilerVersion: undefined };
165
+ return { fileToGenerate: [], parameter: "", protoFile: [], sourceFileDescriptors: [], compilerVersion: undefined };
160
166
  }
161
167
  exports.CodeGeneratorRequest = {
162
168
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -169,6 +175,9 @@ exports.CodeGeneratorRequest = {
169
175
  for (const v of message.protoFile) {
170
176
  descriptor_1.FileDescriptorProto.encode(v, writer.uint32(122).fork()).join();
171
177
  }
178
+ for (const v of message.sourceFileDescriptors) {
179
+ descriptor_1.FileDescriptorProto.encode(v, writer.uint32(138).fork()).join();
180
+ }
172
181
  if (message.compilerVersion !== undefined) {
173
182
  exports.Version.encode(message.compilerVersion, writer.uint32(26).fork()).join();
174
183
  }
@@ -184,7 +193,7 @@ exports.CodeGeneratorRequest = {
184
193
  },
185
194
  decode(input, length) {
186
195
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
187
- const end = length === undefined ? reader.len : reader.pos + length;
196
+ let end = length === undefined ? reader.len : reader.pos + length;
188
197
  const message = Object.create(createBaseCodeGeneratorRequest());
189
198
  while (reader.pos < end) {
190
199
  const tag = reader.uint32();
@@ -207,6 +216,12 @@ exports.CodeGeneratorRequest = {
207
216
  }
208
217
  message.protoFile.push(descriptor_1.FileDescriptorProto.decode(reader, reader.uint32()));
209
218
  continue;
219
+ case 17:
220
+ if (tag !== 138) {
221
+ break;
222
+ }
223
+ message.sourceFileDescriptors.push(descriptor_1.FileDescriptorProto.decode(reader, reader.uint32()));
224
+ continue;
210
225
  case 3:
211
226
  if (tag !== 26) {
212
227
  break;
@@ -240,6 +255,9 @@ exports.CodeGeneratorRequest = {
240
255
  protoFile: globalThis.Array.isArray(object?.protoFile)
241
256
  ? object.protoFile.map((e) => descriptor_1.FileDescriptorProto.fromJSON(e))
242
257
  : [],
258
+ sourceFileDescriptors: globalThis.Array.isArray(object?.sourceFileDescriptors)
259
+ ? object.sourceFileDescriptors.map((e) => descriptor_1.FileDescriptorProto.fromJSON(e))
260
+ : [],
243
261
  compilerVersion: isSet(object.compilerVersion) ? exports.Version.fromJSON(object.compilerVersion) : undefined,
244
262
  };
245
263
  },
@@ -254,6 +272,9 @@ exports.CodeGeneratorRequest = {
254
272
  if (message.protoFile?.length) {
255
273
  obj.protoFile = message.protoFile.map((e) => descriptor_1.FileDescriptorProto.toJSON(e));
256
274
  }
275
+ if (message.sourceFileDescriptors?.length) {
276
+ obj.sourceFileDescriptors = message.sourceFileDescriptors.map((e) => descriptor_1.FileDescriptorProto.toJSON(e));
277
+ }
257
278
  if (message.compilerVersion !== undefined) {
258
279
  obj.compilerVersion = exports.Version.toJSON(message.compilerVersion);
259
280
  }
@@ -267,6 +288,7 @@ exports.CodeGeneratorRequest = {
267
288
  message.fileToGenerate = object.fileToGenerate?.map((e) => e) || [];
268
289
  message.parameter = object.parameter ?? "";
269
290
  message.protoFile = object.protoFile?.map((e) => descriptor_1.FileDescriptorProto.fromPartial(e)) || [];
291
+ message.sourceFileDescriptors = object.sourceFileDescriptors?.map((e) => descriptor_1.FileDescriptorProto.fromPartial(e)) || [];
270
292
  message.compilerVersion = (object.compilerVersion !== undefined && object.compilerVersion !== null)
271
293
  ? exports.Version.fromPartial(object.compilerVersion)
272
294
  : undefined;
@@ -274,7 +296,7 @@ exports.CodeGeneratorRequest = {
274
296
  },
275
297
  };
276
298
  function createBaseCodeGeneratorResponse() {
277
- return { error: "", supportedFeatures: 0, file: [] };
299
+ return { error: "", supportedFeatures: 0, minimumEdition: 0, maximumEdition: 0, file: [] };
278
300
  }
279
301
  exports.CodeGeneratorResponse = {
280
302
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -284,6 +306,12 @@ exports.CodeGeneratorResponse = {
284
306
  if (message.supportedFeatures !== 0) {
285
307
  writer.uint32(16).uint64(message.supportedFeatures);
286
308
  }
309
+ if (message.minimumEdition !== 0) {
310
+ writer.uint32(24).int32(message.minimumEdition);
311
+ }
312
+ if (message.maximumEdition !== 0) {
313
+ writer.uint32(32).int32(message.maximumEdition);
314
+ }
287
315
  for (const v of message.file) {
288
316
  exports.CodeGeneratorResponse_File.encode(v, writer.uint32(122).fork()).join();
289
317
  }
@@ -299,7 +327,7 @@ exports.CodeGeneratorResponse = {
299
327
  },
300
328
  decode(input, length) {
301
329
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
302
- const end = length === undefined ? reader.len : reader.pos + length;
330
+ let end = length === undefined ? reader.len : reader.pos + length;
303
331
  const message = Object.create(createBaseCodeGeneratorResponse());
304
332
  while (reader.pos < end) {
305
333
  const tag = reader.uint32();
@@ -316,6 +344,18 @@ exports.CodeGeneratorResponse = {
316
344
  }
317
345
  message.supportedFeatures = longToNumber(reader.uint64());
318
346
  continue;
347
+ case 3:
348
+ if (tag !== 24) {
349
+ break;
350
+ }
351
+ message.minimumEdition = reader.int32();
352
+ continue;
353
+ case 4:
354
+ if (tag !== 32) {
355
+ break;
356
+ }
357
+ message.maximumEdition = reader.int32();
358
+ continue;
319
359
  case 15:
320
360
  if (tag !== 122) {
321
361
  break;
@@ -344,6 +384,8 @@ exports.CodeGeneratorResponse = {
344
384
  return {
345
385
  error: isSet(object.error) ? globalThis.String(object.error) : "",
346
386
  supportedFeatures: isSet(object.supportedFeatures) ? globalThis.Number(object.supportedFeatures) : 0,
387
+ minimumEdition: isSet(object.minimumEdition) ? globalThis.Number(object.minimumEdition) : 0,
388
+ maximumEdition: isSet(object.maximumEdition) ? globalThis.Number(object.maximumEdition) : 0,
347
389
  file: globalThis.Array.isArray(object?.file)
348
390
  ? object.file.map((e) => exports.CodeGeneratorResponse_File.fromJSON(e))
349
391
  : [],
@@ -357,6 +399,12 @@ exports.CodeGeneratorResponse = {
357
399
  if (message.supportedFeatures !== 0) {
358
400
  obj.supportedFeatures = Math.round(message.supportedFeatures);
359
401
  }
402
+ if (message.minimumEdition !== 0) {
403
+ obj.minimumEdition = Math.round(message.minimumEdition);
404
+ }
405
+ if (message.maximumEdition !== 0) {
406
+ obj.maximumEdition = Math.round(message.maximumEdition);
407
+ }
360
408
  if (message.file?.length) {
361
409
  obj.file = message.file.map((e) => exports.CodeGeneratorResponse_File.toJSON(e));
362
410
  }
@@ -369,6 +417,8 @@ exports.CodeGeneratorResponse = {
369
417
  const message = Object.create(createBaseCodeGeneratorResponse());
370
418
  message.error = object.error ?? "";
371
419
  message.supportedFeatures = object.supportedFeatures ?? 0;
420
+ message.minimumEdition = object.minimumEdition ?? 0;
421
+ message.maximumEdition = object.maximumEdition ?? 0;
372
422
  message.file = object.file?.map((e) => exports.CodeGeneratorResponse_File.fromPartial(e)) || [];
373
423
  return message;
374
424
  },
@@ -402,7 +452,7 @@ exports.CodeGeneratorResponse_File = {
402
452
  },
403
453
  decode(input, length) {
404
454
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
405
- const end = length === undefined ? reader.len : reader.pos + length;
455
+ let end = length === undefined ? reader.len : reader.pos + length;
406
456
  const message = Object.create(createBaseCodeGeneratorResponse_File());
407
457
  while (reader.pos < end) {
408
458
  const tag = reader.uint32();