@bufbuild/protobuf 0.0.2-alpha.2 → 0.0.4

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 (63) hide show
  1. package/README.md +5 -2
  2. package/dist/cjs/descriptor-registry.js +13 -0
  3. package/dist/cjs/google/protobuf/any_pb.js +19 -39
  4. package/dist/cjs/google/protobuf/api_pb.js +28 -48
  5. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +32 -67
  6. package/dist/cjs/google/protobuf/descriptor_pb.js +161 -187
  7. package/dist/cjs/google/protobuf/duration_pb.js +21 -41
  8. package/dist/cjs/google/protobuf/empty_pb.js +16 -36
  9. package/dist/cjs/google/protobuf/field_mask_pb.js +17 -37
  10. package/dist/cjs/google/protobuf/source_context_pb.js +16 -36
  11. package/dist/cjs/google/protobuf/struct_pb.js +31 -51
  12. package/dist/cjs/google/protobuf/timestamp_pb.js +20 -40
  13. package/dist/cjs/google/protobuf/type_pb.js +43 -63
  14. package/dist/cjs/google/protobuf/wrappers_pb.js +76 -105
  15. package/dist/cjs/index-runtime.js +42 -0
  16. package/dist/cjs/index-wkt.js +42 -0
  17. package/dist/cjs/index.js +4 -38
  18. package/dist/cjs/private/json-format-common.js +3 -3
  19. package/dist/cjs/private/util-common.js +1 -1
  20. package/dist/cjs/proto-base64.js +138 -0
  21. package/dist/esm/descriptor-registry.js +13 -0
  22. package/dist/esm/google/protobuf/any_pb.js +14 -34
  23. package/dist/esm/google/protobuf/api_pb.js +11 -31
  24. package/dist/esm/google/protobuf/compiler/plugin_pb.js +11 -46
  25. package/dist/esm/google/protobuf/descriptor_pb.js +14 -40
  26. package/dist/esm/google/protobuf/duration_pb.js +11 -31
  27. package/dist/esm/google/protobuf/empty_pb.js +11 -31
  28. package/dist/esm/google/protobuf/field_mask_pb.js +11 -31
  29. package/dist/esm/google/protobuf/source_context_pb.js +11 -31
  30. package/dist/esm/google/protobuf/struct_pb.js +11 -31
  31. package/dist/esm/google/protobuf/timestamp_pb.js +11 -31
  32. package/dist/esm/google/protobuf/type_pb.js +11 -31
  33. package/dist/esm/google/protobuf/wrappers_pb.js +11 -40
  34. package/dist/esm/index-runtime.js +25 -0
  35. package/dist/esm/index-wkt.js +26 -0
  36. package/dist/esm/index.js +4 -24
  37. package/dist/esm/private/json-format-common.js +3 -3
  38. package/dist/esm/private/util-common.js +1 -1
  39. package/dist/esm/proto-base64.js +135 -0
  40. package/dist/types/descriptor-registry.d.ts +7 -0
  41. package/dist/types/google/protobuf/any_pb.d.ts +5 -5
  42. package/dist/types/google/protobuf/api_pb.d.ts +2 -2
  43. package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +2 -2
  44. package/dist/types/google/protobuf/descriptor_pb.d.ts +18 -5
  45. package/dist/types/google/protobuf/duration_pb.d.ts +2 -2
  46. package/dist/types/google/protobuf/empty_pb.d.ts +2 -2
  47. package/dist/types/google/protobuf/field_mask_pb.d.ts +2 -2
  48. package/dist/types/google/protobuf/source_context_pb.d.ts +2 -2
  49. package/dist/types/google/protobuf/struct_pb.d.ts +2 -2
  50. package/dist/types/google/protobuf/timestamp_pb.d.ts +2 -2
  51. package/dist/types/google/protobuf/type_pb.d.ts +2 -2
  52. package/dist/types/google/protobuf/wrappers_pb.d.ts +2 -2
  53. package/dist/types/index-runtime.d.ts +19 -0
  54. package/dist/types/index-wkt.d.ts +12 -0
  55. package/dist/types/index.d.ts +2 -30
  56. package/dist/types/message-type.d.ts +2 -1
  57. package/dist/types/message.d.ts +4 -6
  58. package/dist/types/private/util.d.ts +2 -2
  59. package/dist/types/proto-base64.d.ts +26 -0
  60. package/package.json +3 -2
  61. package/dist/cjs/private/base64.js +0 -132
  62. package/dist/esm/private/base64.js +0 -127
  63. package/dist/types/private/base64.d.ts +0 -18
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # @bufbuild/protobuf
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@bufbuild/protobuf?style=flat-square)](https://www.npmjs.com/package/@bufbuild/protobuf)
4
+
3
5
  A complete implementation of protocol buffers in TypeScript,
4
- suitable for web browsers and Node.js.
6
+ suitable for web browsers and Node.js.
7
+ Learn more at [github.com/bufbuild/protobuf-es](https://github.com/bufbuild/protobuf-es).
5
8
 
6
- Learn more at [github.com/bufbuild/protobuf-es](github.com/bufbuild/protobuf-es).
9
+ This is the runtime library for the code generator plugin [`protoc-gen-es`](../protoc-gen-es).
@@ -29,6 +29,7 @@ const field_mask_pb_js_1 = require("./google/protobuf/field_mask_pb.js");
29
29
  const struct_pb_js_1 = require("./google/protobuf/struct_pb.js");
30
30
  const enum_js_1 = require("./private/enum.js");
31
31
  const wrappers_pb_js_1 = require("./google/protobuf/wrappers_pb.js");
32
+ const descriptor_pb_js_1 = require("./google/protobuf/descriptor_pb.js");
32
33
  // well-known message types with specialized JSON representation
33
34
  const wkMessages = [
34
35
  any_pb_js_1.Any,
@@ -74,6 +75,18 @@ class DescriptorRegistry {
74
75
  }
75
76
  }
76
77
  }
78
+ /**
79
+ * Conveniently create a DescriptorRegistry from a FileDescriptorSet
80
+ * instance or a FileDescriptorSet in binary format.
81
+ */
82
+ static fromFileDescriptorSet(bytesOrSet) {
83
+ const set = bytesOrSet instanceof Uint8Array
84
+ ? descriptor_pb_js_1.FileDescriptorSet.fromBinary(bytesOrSet)
85
+ : new descriptor_pb_js_1.FileDescriptorSet(bytesOrSet);
86
+ const dr = new DescriptorRegistry();
87
+ dr.add(...set.file);
88
+ return dr;
89
+ }
77
90
  /**
78
91
  * May raise an error on invalid descriptors.
79
92
  */
@@ -1,40 +1,20 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
- // @generated from file google/protobuf/any.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.Any = void 0;
37
- const index_js_1 = require("../../index.js");
17
+ const index_runtime_js_1 = require("../../index-runtime.js");
38
18
  /**
39
19
  * `Any` contains an arbitrary serialized protocol buffer message along with a
40
20
  * URL that describes the type of the serialized message.
@@ -61,7 +41,7 @@ const index_js_1 = require("../../index.js");
61
41
  * foo = any.unpack(Foo.class);
62
42
  * }
63
43
  *
64
- * Example 3: Pack and unpack a message in Python.
44
+ * Example 3: Pack and unpack a message in Python.
65
45
  *
66
46
  * foo = Foo(...)
67
47
  * any = Any()
@@ -71,7 +51,7 @@ const index_js_1 = require("../../index.js");
71
51
  * any.Unpack(foo)
72
52
  * ...
73
53
  *
74
- * Example 4: Pack and unpack a message in Go
54
+ * Example 4: Pack and unpack a message in Go
75
55
  *
76
56
  * foo := &pb.Foo{...}
77
57
  * any, err := anypb.New(foo)
@@ -92,7 +72,7 @@ const index_js_1 = require("../../index.js");
92
72
  *
93
73
  *
94
74
  * JSON
95
- * ====
75
+ *
96
76
  * The JSON representation of an `Any` value uses the regular
97
77
  * representation of the deserialized, embedded message, with an
98
78
  * additional field `@type` which contains the type URL. Example:
@@ -122,7 +102,7 @@ const index_js_1 = require("../../index.js");
122
102
  *
123
103
  * @generated from message google.protobuf.Any
124
104
  */
125
- class Any extends index_js_1.Message {
105
+ class Any extends index_runtime_js_1.Message {
126
106
  constructor(data) {
127
107
  super();
128
108
  /**
@@ -164,7 +144,7 @@ class Any extends index_js_1.Message {
164
144
  * @generated from field: bytes value = 2;
165
145
  */
166
146
  this.value = new Uint8Array(0);
167
- index_js_1.proto3.util.initPartial(data, this);
147
+ index_runtime_js_1.proto3.util.initPartial(data, this);
168
148
  }
169
149
  toJson(options) {
170
150
  if (this.typeUrl === "") {
@@ -250,13 +230,13 @@ class Any extends index_js_1.Message {
250
230
  return new Any().fromJsonString(jsonString, options);
251
231
  }
252
232
  static equals(a, b) {
253
- return index_js_1.proto3.util.equals(Any, a, b);
233
+ return index_runtime_js_1.proto3.util.equals(Any, a, b);
254
234
  }
255
235
  }
256
236
  exports.Any = Any;
257
- Any.runtime = index_js_1.proto3;
237
+ Any.runtime = index_runtime_js_1.proto3;
258
238
  Any.typeName = "google.protobuf.Any";
259
- Any.fields = index_js_1.proto3.util.newFieldList(() => [
239
+ Any.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
260
240
  { no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
261
241
  { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
262
242
  ]);
@@ -1,40 +1,20 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
- // @generated from file google/protobuf/api.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.Mixin = exports.Method = exports.Api = void 0;
37
- const index_js_1 = require("../../index.js");
17
+ const index_runtime_js_1 = require("../../index-runtime.js");
38
18
  const type_pb_js_1 = require("./type_pb.js");
39
19
  const source_context_pb_js_1 = require("./source_context_pb.js");
40
20
  /**
@@ -50,7 +30,7 @@ const source_context_pb_js_1 = require("./source_context_pb.js");
50
30
  *
51
31
  * @generated from message google.protobuf.Api
52
32
  */
53
- class Api extends index_js_1.Message {
33
+ class Api extends index_runtime_js_1.Message {
54
34
  constructor(data) {
55
35
  super();
56
36
  /**
@@ -110,7 +90,7 @@ class Api extends index_js_1.Message {
110
90
  * @generated from field: google.protobuf.Syntax syntax = 7;
111
91
  */
112
92
  this.syntax = type_pb_js_1.Syntax.PROTO2;
113
- index_js_1.proto3.util.initPartial(data, this);
93
+ index_runtime_js_1.proto3.util.initPartial(data, this);
114
94
  }
115
95
  static fromBinary(bytes, options) {
116
96
  return new Api().fromBinary(bytes, options);
@@ -122,27 +102,27 @@ class Api extends index_js_1.Message {
122
102
  return new Api().fromJsonString(jsonString, options);
123
103
  }
124
104
  static equals(a, b) {
125
- return index_js_1.proto3.util.equals(Api, a, b);
105
+ return index_runtime_js_1.proto3.util.equals(Api, a, b);
126
106
  }
127
107
  }
128
108
  exports.Api = Api;
129
- Api.runtime = index_js_1.proto3;
109
+ Api.runtime = index_runtime_js_1.proto3;
130
110
  Api.typeName = "google.protobuf.Api";
131
- Api.fields = index_js_1.proto3.util.newFieldList(() => [
111
+ Api.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
132
112
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
133
113
  { no: 2, name: "methods", kind: "message", T: Method, repeated: true },
134
114
  { no: 3, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
135
115
  { no: 4, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
136
116
  { no: 5, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
137
117
  { no: 6, name: "mixins", kind: "message", T: Mixin, repeated: true },
138
- { no: 7, name: "syntax", kind: "enum", T: index_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
118
+ { no: 7, name: "syntax", kind: "enum", T: index_runtime_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
139
119
  ]);
140
120
  /**
141
121
  * Method represents a method of an API interface.
142
122
  *
143
123
  * @generated from message google.protobuf.Method
144
124
  */
145
- class Method extends index_js_1.Message {
125
+ class Method extends index_runtime_js_1.Message {
146
126
  constructor(data) {
147
127
  super();
148
128
  /**
@@ -187,7 +167,7 @@ class Method extends index_js_1.Message {
187
167
  * @generated from field: google.protobuf.Syntax syntax = 7;
188
168
  */
189
169
  this.syntax = type_pb_js_1.Syntax.PROTO2;
190
- index_js_1.proto3.util.initPartial(data, this);
170
+ index_runtime_js_1.proto3.util.initPartial(data, this);
191
171
  }
192
172
  static fromBinary(bytes, options) {
193
173
  return new Method().fromBinary(bytes, options);
@@ -199,20 +179,20 @@ class Method extends index_js_1.Message {
199
179
  return new Method().fromJsonString(jsonString, options);
200
180
  }
201
181
  static equals(a, b) {
202
- return index_js_1.proto3.util.equals(Method, a, b);
182
+ return index_runtime_js_1.proto3.util.equals(Method, a, b);
203
183
  }
204
184
  }
205
185
  exports.Method = Method;
206
- Method.runtime = index_js_1.proto3;
186
+ Method.runtime = index_runtime_js_1.proto3;
207
187
  Method.typeName = "google.protobuf.Method";
208
- Method.fields = index_js_1.proto3.util.newFieldList(() => [
188
+ Method.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
209
189
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
210
190
  { no: 2, name: "request_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
211
191
  { no: 3, name: "request_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
212
192
  { no: 4, name: "response_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
213
193
  { no: 5, name: "response_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
214
194
  { no: 6, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
215
- { no: 7, name: "syntax", kind: "enum", T: index_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
195
+ { no: 7, name: "syntax", kind: "enum", T: index_runtime_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
216
196
  ]);
217
197
  /**
218
198
  * Declares an API Interface to be included in this interface. The including
@@ -296,7 +276,7 @@ Method.fields = index_js_1.proto3.util.newFieldList(() => [
296
276
  *
297
277
  * @generated from message google.protobuf.Mixin
298
278
  */
299
- class Mixin extends index_js_1.Message {
279
+ class Mixin extends index_runtime_js_1.Message {
300
280
  constructor(data) {
301
281
  super();
302
282
  /**
@@ -312,7 +292,7 @@ class Mixin extends index_js_1.Message {
312
292
  * @generated from field: string root = 2;
313
293
  */
314
294
  this.root = "";
315
- index_js_1.proto3.util.initPartial(data, this);
295
+ index_runtime_js_1.proto3.util.initPartial(data, this);
316
296
  }
317
297
  static fromBinary(bytes, options) {
318
298
  return new Mixin().fromBinary(bytes, options);
@@ -324,13 +304,13 @@ class Mixin extends index_js_1.Message {
324
304
  return new Mixin().fromJsonString(jsonString, options);
325
305
  }
326
306
  static equals(a, b) {
327
- return index_js_1.proto3.util.equals(Mixin, a, b);
307
+ return index_runtime_js_1.proto3.util.equals(Mixin, a, b);
328
308
  }
329
309
  }
330
310
  exports.Mixin = Mixin;
331
- Mixin.runtime = index_js_1.proto3;
311
+ Mixin.runtime = index_runtime_js_1.proto3;
332
312
  Mixin.typeName = "google.protobuf.Mixin";
333
- Mixin.fields = index_js_1.proto3.util.newFieldList(() => [
313
+ Mixin.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
334
314
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
335
315
  { no: 2, name: "root", kind: "scalar", T: 9 /* ScalarType.STRING */ },
336
316
  ]);
@@ -1,65 +1,30 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
4
- // @generated from file google/protobuf/compiler/plugin.proto (package google.protobuf.compiler, syntax proto2)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
- // Author: kenton@google.com (Kenton Varda)
36
- //
37
- // WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
38
- // change.
39
- //
40
- // protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
41
- // just a program that reads a CodeGeneratorRequest from stdin and writes a
42
- // CodeGeneratorResponse to stdout.
43
- //
44
- // Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
45
- // of dealing with the raw protocol defined here.
46
- //
47
- // A plugin executable needs only to be placed somewhere in the path. The
48
- // plugin should be named "protoc-gen-$NAME", and will then be used when the
49
- // flag "--${NAME}_out" is passed to protoc.
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.
50
15
  Object.defineProperty(exports, "__esModule", { value: true });
51
16
  exports.CodeGeneratorResponse_File = exports.CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse = exports.CodeGeneratorRequest = exports.Version = void 0;
52
- const index_js_1 = require("../../../index.js");
17
+ const index_runtime_js_1 = require("../../../index-runtime.js");
53
18
  const descriptor_pb_js_1 = require("../descriptor_pb.js");
54
19
  /**
55
20
  * The version number of protocol compiler.
56
21
  *
57
22
  * @generated from message google.protobuf.compiler.Version
58
23
  */
59
- class Version extends index_js_1.Message {
24
+ class Version extends index_runtime_js_1.Message {
60
25
  constructor(data) {
61
26
  super();
62
- index_js_1.proto2.util.initPartial(data, this);
27
+ index_runtime_js_1.proto2.util.initPartial(data, this);
63
28
  }
64
29
  static fromBinary(bytes, options) {
65
30
  return new Version().fromBinary(bytes, options);
@@ -71,13 +36,13 @@ class Version extends index_js_1.Message {
71
36
  return new Version().fromJsonString(jsonString, options);
72
37
  }
73
38
  static equals(a, b) {
74
- return index_js_1.proto2.util.equals(Version, a, b);
39
+ return index_runtime_js_1.proto2.util.equals(Version, a, b);
75
40
  }
76
41
  }
77
42
  exports.Version = Version;
78
- Version.runtime = index_js_1.proto2;
43
+ Version.runtime = index_runtime_js_1.proto2;
79
44
  Version.typeName = "google.protobuf.compiler.Version";
80
- Version.fields = index_js_1.proto2.util.newFieldList(() => [
45
+ Version.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
81
46
  { no: 1, name: "major", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
82
47
  { no: 2, name: "minor", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
83
48
  { no: 3, name: "patch", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
@@ -88,7 +53,7 @@ Version.fields = index_js_1.proto2.util.newFieldList(() => [
88
53
  *
89
54
  * @generated from message google.protobuf.compiler.CodeGeneratorRequest
90
55
  */
91
- class CodeGeneratorRequest extends index_js_1.Message {
56
+ class CodeGeneratorRequest extends index_runtime_js_1.Message {
92
57
  constructor(data) {
93
58
  super();
94
59
  /**
@@ -118,7 +83,7 @@ class CodeGeneratorRequest extends index_js_1.Message {
118
83
  * @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
119
84
  */
120
85
  this.protoFile = [];
121
- index_js_1.proto2.util.initPartial(data, this);
86
+ index_runtime_js_1.proto2.util.initPartial(data, this);
122
87
  }
123
88
  static fromBinary(bytes, options) {
124
89
  return new CodeGeneratorRequest().fromBinary(bytes, options);
@@ -130,13 +95,13 @@ class CodeGeneratorRequest extends index_js_1.Message {
130
95
  return new CodeGeneratorRequest().fromJsonString(jsonString, options);
131
96
  }
132
97
  static equals(a, b) {
133
- return index_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
98
+ return index_runtime_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
134
99
  }
135
100
  }
136
101
  exports.CodeGeneratorRequest = CodeGeneratorRequest;
137
- CodeGeneratorRequest.runtime = index_js_1.proto2;
102
+ CodeGeneratorRequest.runtime = index_runtime_js_1.proto2;
138
103
  CodeGeneratorRequest.typeName = "google.protobuf.compiler.CodeGeneratorRequest";
139
- CodeGeneratorRequest.fields = index_js_1.proto2.util.newFieldList(() => [
104
+ CodeGeneratorRequest.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
140
105
  { no: 1, name: "file_to_generate", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
141
106
  { no: 2, name: "parameter", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
142
107
  { no: 15, name: "proto_file", kind: "message", T: descriptor_pb_js_1.FileDescriptorProto, repeated: true },
@@ -147,14 +112,14 @@ CodeGeneratorRequest.fields = index_js_1.proto2.util.newFieldList(() => [
147
112
  *
148
113
  * @generated from message google.protobuf.compiler.CodeGeneratorResponse
149
114
  */
150
- class CodeGeneratorResponse extends index_js_1.Message {
115
+ class CodeGeneratorResponse extends index_runtime_js_1.Message {
151
116
  constructor(data) {
152
117
  super();
153
118
  /**
154
119
  * @generated from field: repeated google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
155
120
  */
156
121
  this.file = [];
157
- index_js_1.proto2.util.initPartial(data, this);
122
+ index_runtime_js_1.proto2.util.initPartial(data, this);
158
123
  }
159
124
  static fromBinary(bytes, options) {
160
125
  return new CodeGeneratorResponse().fromBinary(bytes, options);
@@ -166,13 +131,13 @@ class CodeGeneratorResponse extends index_js_1.Message {
166
131
  return new CodeGeneratorResponse().fromJsonString(jsonString, options);
167
132
  }
168
133
  static equals(a, b) {
169
- return index_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
134
+ return index_runtime_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
170
135
  }
171
136
  }
172
137
  exports.CodeGeneratorResponse = CodeGeneratorResponse;
173
- CodeGeneratorResponse.runtime = index_js_1.proto2;
138
+ CodeGeneratorResponse.runtime = index_runtime_js_1.proto2;
174
139
  CodeGeneratorResponse.typeName = "google.protobuf.compiler.CodeGeneratorResponse";
175
- CodeGeneratorResponse.fields = index_js_1.proto2.util.newFieldList(() => [
140
+ CodeGeneratorResponse.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
176
141
  { no: 1, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
177
142
  { no: 2, name: "supported_features", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },
178
143
  { no: 15, name: "file", kind: "message", T: CodeGeneratorResponse_File, repeated: true },
@@ -194,7 +159,7 @@ var CodeGeneratorResponse_Feature;
194
159
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["PROTO3_OPTIONAL"] = 1] = "PROTO3_OPTIONAL";
195
160
  })(CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse_Feature || (exports.CodeGeneratorResponse_Feature = {}));
196
161
  // Retrieve enum metadata with: proto2.getEnumType(CodeGeneratorResponse_Feature)
197
- index_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protobuf.compiler.CodeGeneratorResponse.Feature", [
162
+ index_runtime_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protobuf.compiler.CodeGeneratorResponse.Feature", [
198
163
  { no: 0, name: "FEATURE_NONE" },
199
164
  { no: 1, name: "FEATURE_PROTO3_OPTIONAL" },
200
165
  ]);
@@ -203,10 +168,10 @@ index_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protob
203
168
  *
204
169
  * @generated from message google.protobuf.compiler.CodeGeneratorResponse.File
205
170
  */
206
- class CodeGeneratorResponse_File extends index_js_1.Message {
171
+ class CodeGeneratorResponse_File extends index_runtime_js_1.Message {
207
172
  constructor(data) {
208
173
  super();
209
- index_js_1.proto2.util.initPartial(data, this);
174
+ index_runtime_js_1.proto2.util.initPartial(data, this);
210
175
  }
211
176
  static fromBinary(bytes, options) {
212
177
  return new CodeGeneratorResponse_File().fromBinary(bytes, options);
@@ -218,13 +183,13 @@ class CodeGeneratorResponse_File extends index_js_1.Message {
218
183
  return new CodeGeneratorResponse_File().fromJsonString(jsonString, options);
219
184
  }
220
185
  static equals(a, b) {
221
- return index_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
186
+ return index_runtime_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
222
187
  }
223
188
  }
224
189
  exports.CodeGeneratorResponse_File = CodeGeneratorResponse_File;
225
- CodeGeneratorResponse_File.runtime = index_js_1.proto2;
190
+ CodeGeneratorResponse_File.runtime = index_runtime_js_1.proto2;
226
191
  CodeGeneratorResponse_File.typeName = "google.protobuf.compiler.CodeGeneratorResponse.File";
227
- CodeGeneratorResponse_File.fields = index_js_1.proto2.util.newFieldList(() => [
192
+ CodeGeneratorResponse_File.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
228
193
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
229
194
  { no: 2, name: "insertion_point", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
230
195
  { no: 15, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },