@bufbuild/protobuf 2.0.0 → 2.2.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 (33) hide show
  1. package/dist/cjs/registry.js +1 -1
  2. package/dist/cjs/types.d.ts +38 -4
  3. package/dist/cjs/wire/binary-encoding.js +4 -1
  4. package/dist/cjs/wkt/gen/google/protobuf/any_pb.d.ts +88 -1
  5. package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +148 -3
  6. package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +128 -5
  7. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +721 -55
  8. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
  9. package/dist/cjs/wkt/gen/google/protobuf/duration_pb.d.ts +61 -1
  10. package/dist/cjs/wkt/gen/google/protobuf/empty_pb.d.ts +10 -1
  11. package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +201 -1
  12. package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.d.ts +7 -1
  13. package/dist/cjs/wkt/gen/google/protobuf/struct_pb.d.ts +29 -4
  14. package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +92 -1
  15. package/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +89 -8
  16. package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +45 -9
  17. package/dist/esm/registry.js +1 -1
  18. package/dist/esm/types.d.ts +38 -4
  19. package/dist/esm/wire/binary-encoding.js +4 -1
  20. package/dist/esm/wkt/gen/google/protobuf/any_pb.d.ts +88 -1
  21. package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +148 -3
  22. package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +128 -5
  23. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +721 -55
  24. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
  25. package/dist/esm/wkt/gen/google/protobuf/duration_pb.d.ts +61 -1
  26. package/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +10 -1
  27. package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +201 -1
  28. package/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +7 -1
  29. package/dist/esm/wkt/gen/google/protobuf/struct_pb.d.ts +29 -4
  30. package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +92 -1
  31. package/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +89 -8
  32. package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +45 -9
  33. package/package.json +1 -1
@@ -230,7 +230,7 @@ const DELIMITED = 2;
230
230
  const OPEN = 1;
231
231
  // prettier-ignore
232
232
  // bootstrap-inject defaults: EDITION_PROTO2 to EDITION_2023: export const minimumEdition: SupportedEdition = $minimumEdition, maximumEdition: SupportedEdition = $maximumEdition;
233
- // generated from protoc v27.0
233
+ // generated from protoc v28.0
234
234
  exports.minimumEdition = 998, exports.maximumEdition = 1000;
235
235
  const featureDefaults = {
236
236
  // EDITION_PROTO2
@@ -1,5 +1,5 @@
1
1
  import type { GenEnum, GenExtension, GenMessage } from "./codegenv1/types.js";
2
- import type { DescEnum, DescExtension, DescMessage } from "./descriptors.js";
2
+ import type { DescEnum, DescExtension, DescMessage, DescMethod } from "./descriptors.js";
3
3
  import type { OneofADT } from "./reflect/guard.js";
4
4
  import type { WireType } from "./wire/index.js";
5
5
  import type { JsonValue } from "./json-value.js";
@@ -28,7 +28,7 @@ export type MessageJsonType<Desc extends DescMessage> = Desc extends GenMessage<
28
28
  * Extract the init type from a message descriptor.
29
29
  * The init type is accepted by the function create().
30
30
  */
31
- export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? RuntimeShape | MessageInit<RuntimeShape> : Record<string, unknown>;
31
+ export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? MessageInit<RuntimeShape> : Record<string, unknown>;
32
32
  /**
33
33
  * Extract the enum type of from an enum descriptor.
34
34
  */
@@ -54,12 +54,32 @@ export type UnknownField = {
54
54
  readonly wireType: WireType;
55
55
  readonly data: Uint8Array;
56
56
  };
57
+ /**
58
+ * Describes a streaming RPC declaration.
59
+ */
60
+ export type DescMethodStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodClientStreaming<I, O> | DescMethodServerStreaming<I, O> | DescMethodBiDiStreaming<I, O>;
61
+ /**
62
+ * Describes a unary RPC declaration.
63
+ */
64
+ export type DescMethodUnary<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"unary", I, O>;
65
+ /**
66
+ * Describes a server streaming RPC declaration.
67
+ */
68
+ export type DescMethodServerStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"server_streaming", I, O>;
69
+ /**
70
+ * Describes a client streaming RPC declaration.
71
+ */
72
+ export type DescMethodClientStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"client_streaming", I, O>;
73
+ /**
74
+ * Describes a bidi streaming RPC declaration.
75
+ */
76
+ export type DescMethodBiDiStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"bidi_streaming", I, O>;
57
77
  /**
58
78
  * The init type for a message, which makes all fields optional.
59
79
  * The init type is accepted by the function create().
60
80
  */
61
- type MessageInit<T extends Message> = {
62
- [P in keyof T as P extends "$typeName" | "$unknown" ? never : P]?: FieldInit<T[P]>;
81
+ type MessageInit<T extends Message> = T | {
82
+ [P in keyof T as P extends "$unknown" ? never : P]?: P extends "$typeName" ? never : FieldInit<T[P]>;
63
83
  };
64
84
  type FieldInit<F> = F extends (Date | Uint8Array | bigint | boolean | string | number) ? F : F extends Array<infer U> ? Array<FieldInit<U>> : F extends ReadonlyArray<infer U> ? ReadonlyArray<FieldInit<U>> : F extends Message ? MessageInit<F> : F extends OneofSelectedMessage<infer C, infer V> ? {
65
85
  case: C;
@@ -74,4 +94,18 @@ type OneofSelectedMessage<K extends string, M extends Message> = {
74
94
  case: K;
75
95
  value: M;
76
96
  };
97
+ type DescMethodTyped<K extends DescMethod["methodKind"], I extends DescMessage, O extends DescMessage> = Omit<DescMethod, "methodKind" | "input" | "output"> & {
98
+ /**
99
+ * One of the four available method types.
100
+ */
101
+ readonly methodKind: K;
102
+ /**
103
+ * The message type for requests.
104
+ */
105
+ readonly input: I;
106
+ /**
107
+ * The message type for responses.
108
+ */
109
+ readonly output: O;
110
+ };
77
111
  export {};
@@ -94,7 +94,10 @@ class BinaryWriter {
94
94
  * Return all bytes written and reset this writer.
95
95
  */
96
96
  finish() {
97
- this.chunks.push(new Uint8Array(this.buf)); // flush the buffer
97
+ if (this.buf.length) {
98
+ this.chunks.push(new Uint8Array(this.buf)); // flush the buffer
99
+ this.buf = [];
100
+ }
98
101
  let len = 0;
99
102
  for (let i = 0; i < this.chunks.length; i++)
100
103
  len += this.chunks[i].length;
@@ -137,7 +137,94 @@ export type Any = Message<"google.protobuf.Any"> & {
137
137
  value: Uint8Array;
138
138
  };
139
139
  /**
140
- * JSON type for the message google.protobuf.Any.
140
+ * `Any` contains an arbitrary serialized protocol buffer message along with a
141
+ * URL that describes the type of the serialized message.
142
+ *
143
+ * Protobuf library provides support to pack/unpack Any values in the form
144
+ * of utility functions or additional generated methods of the Any type.
145
+ *
146
+ * Example 1: Pack and unpack a message in C++.
147
+ *
148
+ * Foo foo = ...;
149
+ * Any any;
150
+ * any.PackFrom(foo);
151
+ * ...
152
+ * if (any.UnpackTo(&foo)) {
153
+ * ...
154
+ * }
155
+ *
156
+ * Example 2: Pack and unpack a message in Java.
157
+ *
158
+ * Foo foo = ...;
159
+ * Any any = Any.pack(foo);
160
+ * ...
161
+ * if (any.is(Foo.class)) {
162
+ * foo = any.unpack(Foo.class);
163
+ * }
164
+ * // or ...
165
+ * if (any.isSameTypeAs(Foo.getDefaultInstance())) {
166
+ * foo = any.unpack(Foo.getDefaultInstance());
167
+ * }
168
+ *
169
+ * Example 3: Pack and unpack a message in Python.
170
+ *
171
+ * foo = Foo(...)
172
+ * any = Any()
173
+ * any.Pack(foo)
174
+ * ...
175
+ * if any.Is(Foo.DESCRIPTOR):
176
+ * any.Unpack(foo)
177
+ * ...
178
+ *
179
+ * Example 4: Pack and unpack a message in Go
180
+ *
181
+ * foo := &pb.Foo{...}
182
+ * any, err := anypb.New(foo)
183
+ * if err != nil {
184
+ * ...
185
+ * }
186
+ * ...
187
+ * foo := &pb.Foo{}
188
+ * if err := any.UnmarshalTo(foo); err != nil {
189
+ * ...
190
+ * }
191
+ *
192
+ * The pack methods provided by protobuf library will by default use
193
+ * 'type.googleapis.com/full.type.name' as the type URL and the unpack
194
+ * methods only use the fully qualified type name after the last '/'
195
+ * in the type URL, for example "foo.bar.com/x/y.z" will yield type
196
+ * name "y.z".
197
+ *
198
+ * JSON
199
+ * ====
200
+ * The JSON representation of an `Any` value uses the regular
201
+ * representation of the deserialized, embedded message, with an
202
+ * additional field `@type` which contains the type URL. Example:
203
+ *
204
+ * package google.profile;
205
+ * message Person {
206
+ * string first_name = 1;
207
+ * string last_name = 2;
208
+ * }
209
+ *
210
+ * {
211
+ * "@type": "type.googleapis.com/google.profile.Person",
212
+ * "firstName": <string>,
213
+ * "lastName": <string>
214
+ * }
215
+ *
216
+ * If the embedded message type is well-known and has a custom JSON
217
+ * representation, that representation will be embedded adding a field
218
+ * `value` which holds the custom JSON in addition to the `@type`
219
+ * field. Example (for message [google.protobuf.Duration][]):
220
+ *
221
+ * {
222
+ * "@type": "type.googleapis.com/google.protobuf.Duration",
223
+ * "value": "1.212s"
224
+ * }
225
+ *
226
+ *
227
+ * @generated from message google.protobuf.Any
141
228
  */
142
229
  export type AnyJson = {
143
230
  "@type"?: string;
@@ -85,34 +85,79 @@ export type Api = Message<"google.protobuf.Api"> & {
85
85
  syntax: Syntax;
86
86
  };
87
87
  /**
88
- * JSON type for the message google.protobuf.Api.
88
+ * Api is a light-weight descriptor for an API Interface.
89
+ *
90
+ * Interfaces are also described as "protocol buffer services" in some contexts,
91
+ * such as by the "service" keyword in a .proto file, but they are different
92
+ * from API Services, which represent a concrete implementation of an interface
93
+ * as opposed to simply a description of methods and bindings. They are also
94
+ * sometimes simply referred to as "APIs" in other contexts, such as the name of
95
+ * this message itself. See https://cloud.google.com/apis/design/glossary for
96
+ * detailed terminology.
97
+ *
98
+ * @generated from message google.protobuf.Api
89
99
  */
90
100
  export type ApiJson = {
91
101
  /**
102
+ * The fully qualified name of this interface, including package name
103
+ * followed by the interface's simple name.
104
+ *
92
105
  * @generated from field: string name = 1;
93
106
  */
94
107
  name?: string;
95
108
  /**
109
+ * The methods of this interface, in unspecified order.
110
+ *
96
111
  * @generated from field: repeated google.protobuf.Method methods = 2;
97
112
  */
98
113
  methods?: MethodJson[];
99
114
  /**
115
+ * Any metadata attached to the interface.
116
+ *
100
117
  * @generated from field: repeated google.protobuf.Option options = 3;
101
118
  */
102
119
  options?: OptionJson[];
103
120
  /**
121
+ * A version string for this interface. If specified, must have the form
122
+ * `major-version.minor-version`, as in `1.10`. If the minor version is
123
+ * omitted, it defaults to zero. If the entire version field is empty, the
124
+ * major version is derived from the package name, as outlined below. If the
125
+ * field is not empty, the version in the package name will be verified to be
126
+ * consistent with what is provided here.
127
+ *
128
+ * The versioning schema uses [semantic
129
+ * versioning](http://semver.org) where the major version number
130
+ * indicates a breaking change and the minor version an additive,
131
+ * non-breaking change. Both version numbers are signals to users
132
+ * what to expect from different versions, and should be carefully
133
+ * chosen based on the product plan.
134
+ *
135
+ * The major version is also reflected in the package name of the
136
+ * interface, which must end in `v<major-version>`, as in
137
+ * `google.feature.v1`. For major versions 0 and 1, the suffix can
138
+ * be omitted. Zero major versions must only be used for
139
+ * experimental, non-GA interfaces.
140
+ *
141
+ *
104
142
  * @generated from field: string version = 4;
105
143
  */
106
144
  version?: string;
107
145
  /**
146
+ * Source context for the protocol buffer service represented by this
147
+ * message.
148
+ *
108
149
  * @generated from field: google.protobuf.SourceContext source_context = 5;
109
150
  */
110
151
  sourceContext?: SourceContextJson;
111
152
  /**
153
+ * Included interfaces. See [Mixin][].
154
+ *
112
155
  * @generated from field: repeated google.protobuf.Mixin mixins = 6;
113
156
  */
114
157
  mixins?: MixinJson[];
115
158
  /**
159
+ * The source syntax of the service.
160
+ *
116
161
  * @generated from field: google.protobuf.Syntax syntax = 7;
117
162
  */
118
163
  syntax?: SyntaxJson;
@@ -172,34 +217,50 @@ export type Method = Message<"google.protobuf.Method"> & {
172
217
  syntax: Syntax;
173
218
  };
174
219
  /**
175
- * JSON type for the message google.protobuf.Method.
220
+ * Method represents a method of an API interface.
221
+ *
222
+ * @generated from message google.protobuf.Method
176
223
  */
177
224
  export type MethodJson = {
178
225
  /**
226
+ * The simple name of this method.
227
+ *
179
228
  * @generated from field: string name = 1;
180
229
  */
181
230
  name?: string;
182
231
  /**
232
+ * A URL of the input message type.
233
+ *
183
234
  * @generated from field: string request_type_url = 2;
184
235
  */
185
236
  requestTypeUrl?: string;
186
237
  /**
238
+ * If true, the request is streamed.
239
+ *
187
240
  * @generated from field: bool request_streaming = 3;
188
241
  */
189
242
  requestStreaming?: boolean;
190
243
  /**
244
+ * The URL of the output message type.
245
+ *
191
246
  * @generated from field: string response_type_url = 4;
192
247
  */
193
248
  responseTypeUrl?: string;
194
249
  /**
250
+ * If true, the response is streamed.
251
+ *
195
252
  * @generated from field: bool response_streaming = 5;
196
253
  */
197
254
  responseStreaming?: boolean;
198
255
  /**
256
+ * Any metadata attached to the method.
257
+ *
199
258
  * @generated from field: repeated google.protobuf.Option options = 6;
200
259
  */
201
260
  options?: OptionJson[];
202
261
  /**
262
+ * The source syntax of this method.
263
+ *
203
264
  * @generated from field: google.protobuf.Syntax syntax = 7;
204
265
  */
205
266
  syntax?: SyntaxJson;
@@ -307,14 +368,98 @@ export type Mixin = Message<"google.protobuf.Mixin"> & {
307
368
  root: string;
308
369
  };
309
370
  /**
310
- * JSON type for the message google.protobuf.Mixin.
371
+ * Declares an API Interface to be included in this interface. The including
372
+ * interface must redeclare all the methods from the included interface, but
373
+ * documentation and options are inherited as follows:
374
+ *
375
+ * - If after comment and whitespace stripping, the documentation
376
+ * string of the redeclared method is empty, it will be inherited
377
+ * from the original method.
378
+ *
379
+ * - Each annotation belonging to the service config (http,
380
+ * visibility) which is not set in the redeclared method will be
381
+ * inherited.
382
+ *
383
+ * - If an http annotation is inherited, the path pattern will be
384
+ * modified as follows. Any version prefix will be replaced by the
385
+ * version of the including interface plus the [root][] path if
386
+ * specified.
387
+ *
388
+ * Example of a simple mixin:
389
+ *
390
+ * package google.acl.v1;
391
+ * service AccessControl {
392
+ * // Get the underlying ACL object.
393
+ * rpc GetAcl(GetAclRequest) returns (Acl) {
394
+ * option (google.api.http).get = "/v1/{resource=**}:getAcl";
395
+ * }
396
+ * }
397
+ *
398
+ * package google.storage.v2;
399
+ * service Storage {
400
+ * rpc GetAcl(GetAclRequest) returns (Acl);
401
+ *
402
+ * // Get a data record.
403
+ * rpc GetData(GetDataRequest) returns (Data) {
404
+ * option (google.api.http).get = "/v2/{resource=**}";
405
+ * }
406
+ * }
407
+ *
408
+ * Example of a mixin configuration:
409
+ *
410
+ * apis:
411
+ * - name: google.storage.v2.Storage
412
+ * mixins:
413
+ * - name: google.acl.v1.AccessControl
414
+ *
415
+ * The mixin construct implies that all methods in `AccessControl` are
416
+ * also declared with same name and request/response types in
417
+ * `Storage`. A documentation generator or annotation processor will
418
+ * see the effective `Storage.GetAcl` method after inherting
419
+ * documentation and annotations as follows:
420
+ *
421
+ * service Storage {
422
+ * // Get the underlying ACL object.
423
+ * rpc GetAcl(GetAclRequest) returns (Acl) {
424
+ * option (google.api.http).get = "/v2/{resource=**}:getAcl";
425
+ * }
426
+ * ...
427
+ * }
428
+ *
429
+ * Note how the version in the path pattern changed from `v1` to `v2`.
430
+ *
431
+ * If the `root` field in the mixin is specified, it should be a
432
+ * relative path under which inherited HTTP paths are placed. Example:
433
+ *
434
+ * apis:
435
+ * - name: google.storage.v2.Storage
436
+ * mixins:
437
+ * - name: google.acl.v1.AccessControl
438
+ * root: acls
439
+ *
440
+ * This implies the following inherited HTTP annotation:
441
+ *
442
+ * service Storage {
443
+ * // Get the underlying ACL object.
444
+ * rpc GetAcl(GetAclRequest) returns (Acl) {
445
+ * option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
446
+ * }
447
+ * ...
448
+ * }
449
+ *
450
+ * @generated from message google.protobuf.Mixin
311
451
  */
312
452
  export type MixinJson = {
313
453
  /**
454
+ * The fully qualified name of the interface which is included.
455
+ *
314
456
  * @generated from field: string name = 1;
315
457
  */
316
458
  name?: string;
317
459
  /**
460
+ * If non-empty specifies a path under which inherited HTTP paths
461
+ * are rooted.
462
+ *
318
463
  * @generated from field: string root = 2;
319
464
  */
320
465
  root?: string;
@@ -32,7 +32,9 @@ export type Version = Message<"google.protobuf.compiler.Version"> & {
32
32
  suffix: string;
33
33
  };
34
34
  /**
35
- * JSON type for the message google.protobuf.compiler.Version.
35
+ * The version number of protocol compiler.
36
+ *
37
+ * @generated from message google.protobuf.compiler.Version
36
38
  */
37
39
  export type VersionJson = {
38
40
  /**
@@ -48,6 +50,9 @@ export type VersionJson = {
48
50
  */
49
51
  patch?: number;
50
52
  /**
53
+ * A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
54
+ * be empty for mainline stable releases.
55
+ *
51
56
  * @generated from field: optional string suffix = 4;
52
57
  */
53
58
  suffix?: string;
@@ -117,26 +122,60 @@ export type CodeGeneratorRequest = Message<"google.protobuf.compiler.CodeGenerat
117
122
  compilerVersion?: Version;
118
123
  };
119
124
  /**
120
- * JSON type for the message google.protobuf.compiler.CodeGeneratorRequest.
125
+ * An encoded CodeGeneratorRequest is written to the plugin's stdin.
126
+ *
127
+ * @generated from message google.protobuf.compiler.CodeGeneratorRequest
121
128
  */
122
129
  export type CodeGeneratorRequestJson = {
123
130
  /**
131
+ * The .proto files that were explicitly listed on the command-line. The
132
+ * code generator should generate code only for these files. Each file's
133
+ * descriptor will be included in proto_file, below.
134
+ *
124
135
  * @generated from field: repeated string file_to_generate = 1;
125
136
  */
126
137
  fileToGenerate?: string[];
127
138
  /**
139
+ * The generator parameter passed on the command-line.
140
+ *
128
141
  * @generated from field: optional string parameter = 2;
129
142
  */
130
143
  parameter?: string;
131
144
  /**
145
+ * FileDescriptorProtos for all files in files_to_generate and everything
146
+ * they import. The files will appear in topological order, so each file
147
+ * appears before any file that imports it.
148
+ *
149
+ * Note: the files listed in files_to_generate will include runtime-retention
150
+ * options only, but all other files will include source-retention options.
151
+ * The source_file_descriptors field below is available in case you need
152
+ * source-retention options for files_to_generate.
153
+ *
154
+ * protoc guarantees that all proto_files will be written after
155
+ * the fields above, even though this is not technically guaranteed by the
156
+ * protobuf wire format. This theoretically could allow a plugin to stream
157
+ * in the FileDescriptorProtos and handle them one by one rather than read
158
+ * the entire set into memory at once. However, as of this writing, this
159
+ * is not similarly optimized on protoc's end -- it will store all fields in
160
+ * memory at once before sending them to the plugin.
161
+ *
162
+ * Type names of fields and extensions in the FileDescriptorProto are always
163
+ * fully qualified.
164
+ *
132
165
  * @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
133
166
  */
134
167
  protoFile?: FileDescriptorProtoJson[];
135
168
  /**
169
+ * File descriptors with all options, including source-retention options.
170
+ * These descriptors are only provided for the files listed in
171
+ * files_to_generate.
172
+ *
136
173
  * @generated from field: repeated google.protobuf.FileDescriptorProto source_file_descriptors = 17;
137
174
  */
138
175
  sourceFileDescriptors?: FileDescriptorProtoJson[];
139
176
  /**
177
+ * The version number of protocol compiler.
178
+ *
140
179
  * @generated from field: optional google.protobuf.compiler.Version compiler_version = 3;
141
180
  */
142
181
  compilerVersion?: VersionJson;
@@ -196,22 +235,46 @@ export type CodeGeneratorResponse = Message<"google.protobuf.compiler.CodeGenera
196
235
  file: CodeGeneratorResponse_File[];
197
236
  };
198
237
  /**
199
- * JSON type for the message google.protobuf.compiler.CodeGeneratorResponse.
238
+ * The plugin writes an encoded CodeGeneratorResponse to stdout.
239
+ *
240
+ * @generated from message google.protobuf.compiler.CodeGeneratorResponse
200
241
  */
201
242
  export type CodeGeneratorResponseJson = {
202
243
  /**
244
+ * Error message. If non-empty, code generation failed. The plugin process
245
+ * should exit with status code zero even if it reports an error in this way.
246
+ *
247
+ * This should be used to indicate errors in .proto files which prevent the
248
+ * code generator from generating correct code. Errors which indicate a
249
+ * problem in protoc itself -- such as the input CodeGeneratorRequest being
250
+ * unparseable -- should be reported by writing a message to stderr and
251
+ * exiting with a non-zero status code.
252
+ *
203
253
  * @generated from field: optional string error = 1;
204
254
  */
205
255
  error?: string;
206
256
  /**
257
+ * A bitmask of supported features that the code generator supports.
258
+ * This is a bitwise "or" of values from the Feature enum.
259
+ *
207
260
  * @generated from field: optional uint64 supported_features = 2;
208
261
  */
209
262
  supportedFeatures?: string;
210
263
  /**
264
+ * The minimum edition this plugin supports. This will be treated as an
265
+ * Edition enum, but we want to allow unknown values. It should be specified
266
+ * according the edition enum value, *not* the edition number. Only takes
267
+ * effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
268
+ *
211
269
  * @generated from field: optional int32 minimum_edition = 3;
212
270
  */
213
271
  minimumEdition?: number;
214
272
  /**
273
+ * The maximum edition this plugin supports. This will be treated as an
274
+ * Edition enum, but we want to allow unknown values. It should be specified
275
+ * according the edition enum value, *not* the edition number. Only takes
276
+ * effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
277
+ *
215
278
  * @generated from field: optional int32 maximum_edition = 4;
216
279
  */
217
280
  maximumEdition?: number;
@@ -305,22 +368,80 @@ export type CodeGeneratorResponse_File = Message<"google.protobuf.compiler.CodeG
305
368
  generatedCodeInfo?: GeneratedCodeInfo;
306
369
  };
307
370
  /**
308
- * JSON type for the message google.protobuf.compiler.CodeGeneratorResponse.File.
371
+ * Represents a single generated file.
372
+ *
373
+ * @generated from message google.protobuf.compiler.CodeGeneratorResponse.File
309
374
  */
310
375
  export type CodeGeneratorResponse_FileJson = {
311
376
  /**
377
+ * The file name, relative to the output directory. The name must not
378
+ * contain "." or ".." components and must be relative, not be absolute (so,
379
+ * the file cannot lie outside the output directory). "/" must be used as
380
+ * the path separator, not "\".
381
+ *
382
+ * If the name is omitted, the content will be appended to the previous
383
+ * file. This allows the generator to break large files into small chunks,
384
+ * and allows the generated text to be streamed back to protoc so that large
385
+ * files need not reside completely in memory at one time. Note that as of
386
+ * this writing protoc does not optimize for this -- it will read the entire
387
+ * CodeGeneratorResponse before writing files to disk.
388
+ *
312
389
  * @generated from field: optional string name = 1;
313
390
  */
314
391
  name?: string;
315
392
  /**
393
+ * If non-empty, indicates that the named file should already exist, and the
394
+ * content here is to be inserted into that file at a defined insertion
395
+ * point. This feature allows a code generator to extend the output
396
+ * produced by another code generator. The original generator may provide
397
+ * insertion points by placing special annotations in the file that look
398
+ * like:
399
+ * @@protoc_insertion_point(NAME)
400
+ * The annotation can have arbitrary text before and after it on the line,
401
+ * which allows it to be placed in a comment. NAME should be replaced with
402
+ * an identifier naming the point -- this is what other generators will use
403
+ * as the insertion_point. Code inserted at this point will be placed
404
+ * immediately above the line containing the insertion point (thus multiple
405
+ * insertions to the same point will come out in the order they were added).
406
+ * The double-@ is intended to make it unlikely that the generated code
407
+ * could contain things that look like insertion points by accident.
408
+ *
409
+ * For example, the C++ code generator places the following line in the
410
+ * .pb.h files that it generates:
411
+ * // @@protoc_insertion_point(namespace_scope)
412
+ * This line appears within the scope of the file's package namespace, but
413
+ * outside of any particular class. Another plugin can then specify the
414
+ * insertion_point "namespace_scope" to generate additional classes or
415
+ * other declarations that should be placed in this scope.
416
+ *
417
+ * Note that if the line containing the insertion point begins with
418
+ * whitespace, the same whitespace will be added to every line of the
419
+ * inserted text. This is useful for languages like Python, where
420
+ * indentation matters. In these languages, the insertion point comment
421
+ * should be indented the same amount as any inserted code will need to be
422
+ * in order to work correctly in that context.
423
+ *
424
+ * The code generator that generates the initial file and the one which
425
+ * inserts into it must both run as part of a single invocation of protoc.
426
+ * Code generators are executed in the order in which they appear on the
427
+ * command line.
428
+ *
429
+ * If |insertion_point| is present, |name| must also be present.
430
+ *
316
431
  * @generated from field: optional string insertion_point = 2;
317
432
  */
318
433
  insertionPoint?: string;
319
434
  /**
435
+ * The file contents.
436
+ *
320
437
  * @generated from field: optional string content = 15;
321
438
  */
322
439
  content?: string;
323
440
  /**
441
+ * Information describing the file content being inserted. If an insertion
442
+ * point is used, this information will be appropriately offset and inserted
443
+ * into the code generation metadata for the generated files.
444
+ *
324
445
  * @generated from field: optional google.protobuf.GeneratedCodeInfo generated_code_info = 16;
325
446
  */
326
447
  generatedCodeInfo?: GeneratedCodeInfoJson;
@@ -350,7 +471,9 @@ export declare enum CodeGeneratorResponse_Feature {
350
471
  SUPPORTS_EDITIONS = 2
351
472
  }
352
473
  /**
353
- * JSON type for the enum google.protobuf.compiler.CodeGeneratorResponse.Feature.
474
+ * Sync with code_generator.h.
475
+ *
476
+ * @generated from enum google.protobuf.compiler.CodeGeneratorResponse.Feature
354
477
  */
355
478
  export type CodeGeneratorResponse_FeatureJson = "FEATURE_NONE" | "FEATURE_PROTO3_OPTIONAL" | "FEATURE_SUPPORTS_EDITIONS";
356
479
  /**