@bufbuild/protobuf 0.0.1-alpha.1

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 (146) hide show
  1. package/README.md +6 -0
  2. package/dist/cjs/binary-encoding.js +434 -0
  3. package/dist/cjs/binary-format.js +2 -0
  4. package/dist/cjs/descriptor-registry.js +518 -0
  5. package/dist/cjs/descriptor-set.js +557 -0
  6. package/dist/cjs/enum.js +2 -0
  7. package/dist/cjs/field-list.js +2 -0
  8. package/dist/cjs/field.js +40 -0
  9. package/dist/cjs/google/protobuf/any_pb.js +280 -0
  10. package/dist/cjs/google/protobuf/api_pb.js +383 -0
  11. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +334 -0
  12. package/dist/cjs/google/protobuf/descriptor_pb.js +2311 -0
  13. package/dist/cjs/google/protobuf/duration_pb.js +201 -0
  14. package/dist/cjs/google/protobuf/empty_pb.js +72 -0
  15. package/dist/cjs/google/protobuf/field_mask_pb.js +347 -0
  16. package/dist/cjs/google/protobuf/source_context_pb.js +74 -0
  17. package/dist/cjs/google/protobuf/struct_pb.js +288 -0
  18. package/dist/cjs/google/protobuf/timestamp_pb.js +271 -0
  19. package/dist/cjs/google/protobuf/type_pb.js +613 -0
  20. package/dist/cjs/google/protobuf/wrappers_pb.js +658 -0
  21. package/dist/cjs/google/varint.js +280 -0
  22. package/dist/cjs/index.js +148 -0
  23. package/dist/cjs/json-format.js +2 -0
  24. package/dist/cjs/message-type.js +2 -0
  25. package/dist/cjs/message.js +98 -0
  26. package/dist/cjs/private/assert.js +52 -0
  27. package/dist/cjs/private/base64.js +118 -0
  28. package/dist/cjs/private/binary-format-common.js +253 -0
  29. package/dist/cjs/private/binary-format-proto2.js +120 -0
  30. package/dist/cjs/private/binary-format-proto3.js +102 -0
  31. package/dist/cjs/private/enum.js +70 -0
  32. package/dist/cjs/private/field-list.js +62 -0
  33. package/dist/cjs/private/field-wrapper.js +25 -0
  34. package/dist/cjs/private/field.js +34 -0
  35. package/dist/cjs/private/json-format-common.js +482 -0
  36. package/dist/cjs/private/json-format-proto2.js +100 -0
  37. package/dist/cjs/private/json-format-proto3.js +103 -0
  38. package/dist/cjs/private/message-type.js +37 -0
  39. package/dist/cjs/private/names.js +101 -0
  40. package/dist/cjs/private/options-map.js +2 -0
  41. package/dist/cjs/private/proto-runtime.js +24 -0
  42. package/dist/cjs/private/scalars.js +138 -0
  43. package/dist/cjs/private/util-common.js +229 -0
  44. package/dist/cjs/private/util.js +2 -0
  45. package/dist/cjs/proto-int64.js +121 -0
  46. package/dist/cjs/proto2.js +86 -0
  47. package/dist/cjs/proto3.js +99 -0
  48. package/dist/cjs/service-type.js +43 -0
  49. package/dist/cjs/type-registry.js +42 -0
  50. package/dist/esm/binary-encoding.js +434 -0
  51. package/dist/esm/binary-format.js +1 -0
  52. package/dist/esm/descriptor-registry.js +521 -0
  53. package/dist/esm/descriptor-set.js +517 -0
  54. package/dist/esm/enum.js +1 -0
  55. package/dist/esm/field-list.js +1 -0
  56. package/dist/esm/field.js +37 -0
  57. package/dist/esm/google/protobuf/any_pb.js +276 -0
  58. package/dist/esm/google/protobuf/api_pb.js +350 -0
  59. package/dist/esm/google/protobuf/compiler/plugin_pb.js +318 -0
  60. package/dist/esm/google/protobuf/descriptor_pb.js +2213 -0
  61. package/dist/esm/google/protobuf/duration_pb.js +197 -0
  62. package/dist/esm/google/protobuf/empty_pb.js +68 -0
  63. package/dist/esm/google/protobuf/field_mask_pb.js +343 -0
  64. package/dist/esm/google/protobuf/source_context_pb.js +70 -0
  65. package/dist/esm/google/protobuf/struct_pb.js +282 -0
  66. package/dist/esm/google/protobuf/timestamp_pb.js +267 -0
  67. package/dist/esm/google/protobuf/type_pb.js +569 -0
  68. package/dist/esm/google/protobuf/wrappers_pb.js +574 -0
  69. package/dist/esm/google/varint.js +265 -0
  70. package/dist/esm/index.js +24 -0
  71. package/dist/esm/json-format.js +1 -0
  72. package/dist/esm/message-type.js +1 -0
  73. package/dist/esm/message.js +94 -0
  74. package/dist/esm/private/assert.js +41 -0
  75. package/dist/esm/private/base64.js +113 -0
  76. package/dist/esm/private/binary-format-common.js +243 -0
  77. package/dist/esm/private/binary-format-proto2.js +87 -0
  78. package/dist/esm/private/binary-format-proto3.js +74 -0
  79. package/dist/esm/private/enum.js +64 -0
  80. package/dist/esm/private/field-list.js +58 -0
  81. package/dist/esm/private/field-wrapper.js +20 -0
  82. package/dist/esm/private/field.js +27 -0
  83. package/dist/esm/private/json-format-common.js +473 -0
  84. package/dist/esm/private/json-format-proto2.js +90 -0
  85. package/dist/esm/private/json-format-proto3.js +89 -0
  86. package/dist/esm/private/message-type.js +33 -0
  87. package/dist/esm/private/names.js +90 -0
  88. package/dist/esm/private/options-map.js +1 -0
  89. package/dist/esm/private/proto-runtime.js +15 -0
  90. package/dist/esm/private/scalars.js +129 -0
  91. package/dist/esm/private/util-common.js +207 -0
  92. package/dist/esm/private/util.js +1 -0
  93. package/dist/esm/proto-int64.js +118 -0
  94. package/dist/esm/proto2.js +77 -0
  95. package/dist/esm/proto3.js +90 -0
  96. package/dist/esm/service-type.js +37 -0
  97. package/dist/esm/type-registry.js +38 -0
  98. package/dist/types/binary-encoding.d.ts +421 -0
  99. package/dist/types/binary-format.d.ts +109 -0
  100. package/dist/types/descriptor-registry.d.ts +42 -0
  101. package/dist/types/descriptor-set.d.ts +171 -0
  102. package/dist/types/enum.d.ts +31 -0
  103. package/dist/types/field-list.d.ts +27 -0
  104. package/dist/types/field.d.ts +295 -0
  105. package/dist/types/google/protobuf/any_pb.d.ts +167 -0
  106. package/dist/types/google/protobuf/api_pb.d.ts +296 -0
  107. package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +294 -0
  108. package/dist/types/google/protobuf/descriptor_pb.d.ts +1959 -0
  109. package/dist/types/google/protobuf/duration_pb.d.ts +117 -0
  110. package/dist/types/google/protobuf/empty_pb.d.ts +44 -0
  111. package/dist/types/google/protobuf/field_mask_pb.d.ts +243 -0
  112. package/dist/types/google/protobuf/source_context_pb.d.ts +44 -0
  113. package/dist/types/google/protobuf/struct_pb.d.ts +205 -0
  114. package/dist/types/google/protobuf/timestamp_pb.d.ts +151 -0
  115. package/dist/types/google/protobuf/type_pb.d.ts +482 -0
  116. package/dist/types/google/protobuf/wrappers_pb.d.ts +379 -0
  117. package/dist/types/google/varint.d.ts +65 -0
  118. package/dist/types/index.d.ts +53 -0
  119. package/dist/types/json-format.d.ts +129 -0
  120. package/dist/types/message-type.d.ts +58 -0
  121. package/dist/types/message.d.ts +124 -0
  122. package/dist/types/private/assert.d.ts +19 -0
  123. package/dist/types/private/base64.d.ts +18 -0
  124. package/dist/types/private/binary-format-common.d.ts +38 -0
  125. package/dist/types/private/binary-format-proto2.d.ts +2 -0
  126. package/dist/types/private/binary-format-proto3.d.ts +2 -0
  127. package/dist/types/private/enum.d.ts +29 -0
  128. package/dist/types/private/field-list.d.ts +25 -0
  129. package/dist/types/private/field-wrapper.d.ts +27 -0
  130. package/dist/types/private/field.d.ts +15 -0
  131. package/dist/types/private/json-format-common.d.ts +30 -0
  132. package/dist/types/private/json-format-proto2.d.ts +2 -0
  133. package/dist/types/private/json-format-proto3.d.ts +2 -0
  134. package/dist/types/private/message-type.d.ts +15 -0
  135. package/dist/types/private/names.d.ts +19 -0
  136. package/dist/types/private/options-map.d.ts +7 -0
  137. package/dist/types/private/proto-runtime.d.ts +55 -0
  138. package/dist/types/private/scalars.d.ts +33 -0
  139. package/dist/types/private/util-common.d.ts +5 -0
  140. package/dist/types/private/util.d.ts +55 -0
  141. package/dist/types/proto-int64.d.ts +94 -0
  142. package/dist/types/proto2.d.ts +4 -0
  143. package/dist/types/proto3.d.ts +4 -0
  144. package/dist/types/service-type.d.ts +118 -0
  145. package/dist/types/type-registry.d.ts +37 -0
  146. package/package.json +31 -0
@@ -0,0 +1,276 @@
1
+ /* eslint-disable */
2
+ // @generated by protoc-gen-es v0.0.1-alpha.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
3
+ // @generated from file google/protobuf/any.proto (package google.protobuf, syntax proto3)
4
+ //
5
+ // Protocol Buffers - Google's data interchange format
6
+ // Copyright 2008 Google Inc. All rights reserved.
7
+ // https://developers.google.com/protocol-buffers/
8
+ //
9
+ // Redistribution and use in source and binary forms, with or without
10
+ // modification, are permitted provided that the following conditions are
11
+ // met:
12
+ //
13
+ // * Redistributions of source code must retain the above copyright
14
+ // notice, this list of conditions and the following disclaimer.
15
+ // * Redistributions in binary form must reproduce the above
16
+ // copyright notice, this list of conditions and the following disclaimer
17
+ // in the documentation and/or other materials provided with the
18
+ // distribution.
19
+ // * Neither the name of Google Inc. nor the names of its
20
+ // contributors may be used to endorse or promote products derived from
21
+ // this software without specific prior written permission.
22
+ //
23
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ import { Message, proto3 } from "../../index.js";
35
+ /**
36
+ * `Any` contains an arbitrary serialized protocol buffer message along with a
37
+ * URL that describes the type of the serialized message.
38
+ *
39
+ * Protobuf library provides support to pack/unpack Any values in the form
40
+ * of utility functions or additional generated methods of the Any type.
41
+ *
42
+ * Example 1: Pack and unpack a message in C++.
43
+ *
44
+ * Foo foo = ...;
45
+ * Any any;
46
+ * any.PackFrom(foo);
47
+ * ...
48
+ * if (any.UnpackTo(&foo)) {
49
+ * ...
50
+ * }
51
+ *
52
+ * Example 2: Pack and unpack a message in Java.
53
+ *
54
+ * Foo foo = ...;
55
+ * Any any = Any.pack(foo);
56
+ * ...
57
+ * if (any.is(Foo.class)) {
58
+ * foo = any.unpack(Foo.class);
59
+ * }
60
+ *
61
+ * Example 3: Pack and unpack a message in Python.
62
+ *
63
+ * foo = Foo(...)
64
+ * any = Any()
65
+ * any.Pack(foo)
66
+ * ...
67
+ * if any.Is(Foo.DESCRIPTOR):
68
+ * any.Unpack(foo)
69
+ * ...
70
+ *
71
+ * Example 4: Pack and unpack a message in Go
72
+ *
73
+ * foo := &pb.Foo{...}
74
+ * any, err := anypb.New(foo)
75
+ * if err != nil {
76
+ * ...
77
+ * }
78
+ * ...
79
+ * foo := &pb.Foo{}
80
+ * if err := any.UnmarshalTo(foo); err != nil {
81
+ * ...
82
+ * }
83
+ *
84
+ * The pack methods provided by protobuf library will by default use
85
+ * 'type.googleapis.com/full.type.name' as the type URL and the unpack
86
+ * methods only use the fully qualified type name after the last '/'
87
+ * in the type URL, for example "foo.bar.com/x/y.z" will yield type
88
+ * name "y.z".
89
+ *
90
+ *
91
+ * JSON
92
+ * ====
93
+ * The JSON representation of an `Any` value uses the regular
94
+ * representation of the deserialized, embedded message, with an
95
+ * additional field `@type` which contains the type URL. Example:
96
+ *
97
+ * package google.profile;
98
+ * message Person {
99
+ * string first_name = 1;
100
+ * string last_name = 2;
101
+ * }
102
+ *
103
+ * {
104
+ * "@type": "type.googleapis.com/google.profile.Person",
105
+ * "firstName": <string>,
106
+ * "lastName": <string>
107
+ * }
108
+ *
109
+ * If the embedded message type is well-known and has a custom JSON
110
+ * representation, that representation will be embedded adding a field
111
+ * `value` which holds the custom JSON in addition to the `@type`
112
+ * field. Example (for message [google.protobuf.Duration][]):
113
+ *
114
+ * {
115
+ * "@type": "type.googleapis.com/google.protobuf.Duration",
116
+ * "value": "1.212s"
117
+ * }
118
+ *
119
+ *
120
+ * @generated from message google.protobuf.Any
121
+ */
122
+ export class Any extends Message {
123
+ constructor(data) {
124
+ super();
125
+ /**
126
+ * A URL/resource name that uniquely identifies the type of the serialized
127
+ * protocol buffer message. This string must contain at least
128
+ * one "/" character. The last segment of the URL's path must represent
129
+ * the fully qualified name of the type (as in
130
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
131
+ * (e.g., leading "." is not accepted).
132
+ *
133
+ * In practice, teams usually precompile into the binary all types that they
134
+ * expect it to use in the context of Any. However, for URLs which use the
135
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
136
+ * server that maps type URLs to message definitions as follows:
137
+ *
138
+ * * If no scheme is provided, `https` is assumed.
139
+ * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
140
+ * value in binary format, or produce an error.
141
+ * * Applications are allowed to cache lookup results based on the
142
+ * URL, or have them precompiled into a binary to avoid any
143
+ * lookup. Therefore, binary compatibility needs to be preserved
144
+ * on changes to types. (Use versioned type names to manage
145
+ * breaking changes.)
146
+ *
147
+ * Note: this functionality is not currently available in the official
148
+ * protobuf release, and it is not used for type URLs beginning with
149
+ * type.googleapis.com.
150
+ *
151
+ * Schemes other than `http`, `https` (or the empty scheme) might be
152
+ * used with implementation specific semantics.
153
+ *
154
+ *
155
+ * @generated from field: string type_url = 1;
156
+ */
157
+ this.typeUrl = "";
158
+ /**
159
+ * Must be a valid serialized protocol buffer of the above specified type.
160
+ *
161
+ * @generated from field: bytes value = 2;
162
+ */
163
+ this.value = new Uint8Array(0);
164
+ proto3.util.initPartial(data, this);
165
+ }
166
+ toJson(options) {
167
+ if (this.typeUrl === "") {
168
+ return {};
169
+ }
170
+ const typeName = this.typeUrlToName(this.typeUrl);
171
+ const messageType = options?.typeRegistry?.findMessage(typeName);
172
+ if (!messageType) {
173
+ throw new Error(
174
+ `cannot encode message google.protobuf.Any to JSON: "${this.typeUrl}" is not in the type registry`
175
+ );
176
+ }
177
+ const message = messageType.fromBinary(this.value);
178
+ let json = message.toJson(options);
179
+ if (
180
+ typeName.startsWith("google.protobuf.") ||
181
+ json === null ||
182
+ Array.isArray(json) ||
183
+ typeof json !== "object"
184
+ ) {
185
+ json = { value: json };
186
+ }
187
+ json["@type"] = this.typeUrl;
188
+ return json;
189
+ }
190
+ fromJson(json, options) {
191
+ if (json === null || Array.isArray(json) || typeof json != "object") {
192
+ throw new Error(
193
+ `cannot decode message google.protobuf.Any from JSON: expected object but got ${
194
+ json === null ? "null" : Array.isArray(json) ? "array" : typeof json
195
+ }`
196
+ );
197
+ }
198
+ const typeUrl = json["@type"];
199
+ if (typeof typeUrl != "string" || typeUrl == "") {
200
+ throw new Error(
201
+ `cannot decode message google.protobuf.Any from JSON: "@type" is empty`
202
+ );
203
+ }
204
+ const typeName = this.typeUrlToName(typeUrl),
205
+ messageType = options?.typeRegistry?.findMessage(typeName);
206
+ if (!messageType) {
207
+ throw new Error(
208
+ `cannot decode message google.protobuf.Any from JSON: ${typeUrl} is not in the type registry`
209
+ );
210
+ }
211
+ let message;
212
+ if (
213
+ typeName.startsWith("google.protobuf.") &&
214
+ Object.prototype.hasOwnProperty.call(json, "value")
215
+ ) {
216
+ message = messageType.fromJson(json["value"], options);
217
+ } else {
218
+ const copy = Object.assign({}, json);
219
+ delete copy["@type"];
220
+ message = messageType.fromJson(copy, options);
221
+ }
222
+ this.packFrom(message);
223
+ return this;
224
+ }
225
+ packFrom(message) {
226
+ this.value = message.toBinary();
227
+ this.typeUrl = this.typeNameToUrl(message.getType().typeName);
228
+ }
229
+ unpackTo(target) {
230
+ if (!this.is(target.getType())) {
231
+ return false;
232
+ }
233
+ target.fromBinary(this.value);
234
+ return true;
235
+ }
236
+ is(type) {
237
+ return this.typeUrl === this.typeNameToUrl(type.typeName);
238
+ }
239
+ typeNameToUrl(name) {
240
+ return `type.googleapis.com/${name}`;
241
+ }
242
+ typeUrlToName(url) {
243
+ if (!url.length) {
244
+ throw new Error(`invalid type url: ${url}`);
245
+ }
246
+ const slash = url.lastIndexOf("/");
247
+ const name = slash > 0 ? url.substring(slash + 1) : url;
248
+ if (!name.length) {
249
+ throw new Error(`invalid type url: ${url}`);
250
+ }
251
+ return name;
252
+ }
253
+ static pack(message) {
254
+ const any = new Any();
255
+ any.packFrom(message);
256
+ return any;
257
+ }
258
+ static fromBinary(bytes, options) {
259
+ return new Any().fromBinary(bytes, options);
260
+ }
261
+ static fromJson(jsonValue, options) {
262
+ return new Any().fromJson(jsonValue, options);
263
+ }
264
+ static fromJsonString(jsonString, options) {
265
+ return new Any().fromJsonString(jsonString, options);
266
+ }
267
+ static equals(a, b) {
268
+ return proto3.util.equals(Any, a, b);
269
+ }
270
+ }
271
+ Any.runtime = proto3;
272
+ Any.typeName = "google.protobuf.Any";
273
+ Any.fields = proto3.util.newFieldList(() => [
274
+ { no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
275
+ { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
276
+ ]);
@@ -0,0 +1,350 @@
1
+ /* eslint-disable */
2
+ // @generated by protoc-gen-es v0.0.1-alpha.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
3
+ // @generated from file google/protobuf/api.proto (package google.protobuf, syntax proto3)
4
+ //
5
+ // Protocol Buffers - Google's data interchange format
6
+ // Copyright 2008 Google Inc. All rights reserved.
7
+ // https://developers.google.com/protocol-buffers/
8
+ //
9
+ // Redistribution and use in source and binary forms, with or without
10
+ // modification, are permitted provided that the following conditions are
11
+ // met:
12
+ //
13
+ // * Redistributions of source code must retain the above copyright
14
+ // notice, this list of conditions and the following disclaimer.
15
+ // * Redistributions in binary form must reproduce the above
16
+ // copyright notice, this list of conditions and the following disclaimer
17
+ // in the documentation and/or other materials provided with the
18
+ // distribution.
19
+ // * Neither the name of Google Inc. nor the names of its
20
+ // contributors may be used to endorse or promote products derived from
21
+ // this software without specific prior written permission.
22
+ //
23
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ import { Message, proto3 } from "../../index.js";
35
+ import { Option, Syntax } from "./type_pb.js";
36
+ import { SourceContext } from "./source_context_pb.js";
37
+ /**
38
+ * Api is a light-weight descriptor for an API Interface.
39
+ *
40
+ * Interfaces are also described as "protocol buffer services" in some contexts,
41
+ * such as by the "service" keyword in a .proto file, but they are different
42
+ * from API Services, which represent a concrete implementation of an interface
43
+ * as opposed to simply a description of methods and bindings. They are also
44
+ * sometimes simply referred to as "APIs" in other contexts, such as the name of
45
+ * this message itself. See https://cloud.google.com/apis/design/glossary for
46
+ * detailed terminology.
47
+ *
48
+ * @generated from message google.protobuf.Api
49
+ */
50
+ export class Api extends Message {
51
+ constructor(data) {
52
+ super();
53
+ /**
54
+ * The fully qualified name of this interface, including package name
55
+ * followed by the interface's simple name.
56
+ *
57
+ * @generated from field: string name = 1;
58
+ */
59
+ this.name = "";
60
+ /**
61
+ * The methods of this interface, in unspecified order.
62
+ *
63
+ * @generated from field: repeated google.protobuf.Method methods = 2;
64
+ */
65
+ this.methods = [];
66
+ /**
67
+ * Any metadata attached to the interface.
68
+ *
69
+ * @generated from field: repeated google.protobuf.Option options = 3;
70
+ */
71
+ this.options = [];
72
+ /**
73
+ * A version string for this interface. If specified, must have the form
74
+ * `major-version.minor-version`, as in `1.10`. If the minor version is
75
+ * omitted, it defaults to zero. If the entire version field is empty, the
76
+ * major version is derived from the package name, as outlined below. If the
77
+ * field is not empty, the version in the package name will be verified to be
78
+ * consistent with what is provided here.
79
+ *
80
+ * The versioning schema uses [semantic
81
+ * versioning](http://semver.org) where the major version number
82
+ * indicates a breaking change and the minor version an additive,
83
+ * non-breaking change. Both version numbers are signals to users
84
+ * what to expect from different versions, and should be carefully
85
+ * chosen based on the product plan.
86
+ *
87
+ * The major version is also reflected in the package name of the
88
+ * interface, which must end in `v<major-version>`, as in
89
+ * `google.feature.v1`. For major versions 0 and 1, the suffix can
90
+ * be omitted. Zero major versions must only be used for
91
+ * experimental, non-GA interfaces.
92
+ *
93
+ *
94
+ *
95
+ * @generated from field: string version = 4;
96
+ */
97
+ this.version = "";
98
+ /**
99
+ * Included interfaces. See [Mixin][].
100
+ *
101
+ * @generated from field: repeated google.protobuf.Mixin mixins = 6;
102
+ */
103
+ this.mixins = [];
104
+ /**
105
+ * The source syntax of the service.
106
+ *
107
+ * @generated from field: google.protobuf.Syntax syntax = 7;
108
+ */
109
+ this.syntax = Syntax.PROTO2;
110
+ proto3.util.initPartial(data, this);
111
+ }
112
+ static fromBinary(bytes, options) {
113
+ return new Api().fromBinary(bytes, options);
114
+ }
115
+ static fromJson(jsonValue, options) {
116
+ return new Api().fromJson(jsonValue, options);
117
+ }
118
+ static fromJsonString(jsonString, options) {
119
+ return new Api().fromJsonString(jsonString, options);
120
+ }
121
+ static equals(a, b) {
122
+ return proto3.util.equals(Api, a, b);
123
+ }
124
+ }
125
+ Api.runtime = proto3;
126
+ Api.typeName = "google.protobuf.Api";
127
+ Api.fields = proto3.util.newFieldList(() => [
128
+ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
129
+ { no: 2, name: "methods", kind: "message", T: Method, repeated: true },
130
+ { no: 3, name: "options", kind: "message", T: Option, repeated: true },
131
+ { no: 4, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
132
+ { no: 5, name: "source_context", kind: "message", T: SourceContext },
133
+ { no: 6, name: "mixins", kind: "message", T: Mixin, repeated: true },
134
+ { no: 7, name: "syntax", kind: "enum", T: proto3.getEnumType(Syntax) },
135
+ ]);
136
+ /**
137
+ * Method represents a method of an API interface.
138
+ *
139
+ * @generated from message google.protobuf.Method
140
+ */
141
+ export class Method extends Message {
142
+ constructor(data) {
143
+ super();
144
+ /**
145
+ * The simple name of this method.
146
+ *
147
+ * @generated from field: string name = 1;
148
+ */
149
+ this.name = "";
150
+ /**
151
+ * A URL of the input message type.
152
+ *
153
+ * @generated from field: string request_type_url = 2;
154
+ */
155
+ this.requestTypeUrl = "";
156
+ /**
157
+ * If true, the request is streamed.
158
+ *
159
+ * @generated from field: bool request_streaming = 3;
160
+ */
161
+ this.requestStreaming = false;
162
+ /**
163
+ * The URL of the output message type.
164
+ *
165
+ * @generated from field: string response_type_url = 4;
166
+ */
167
+ this.responseTypeUrl = "";
168
+ /**
169
+ * If true, the response is streamed.
170
+ *
171
+ * @generated from field: bool response_streaming = 5;
172
+ */
173
+ this.responseStreaming = false;
174
+ /**
175
+ * Any metadata attached to the method.
176
+ *
177
+ * @generated from field: repeated google.protobuf.Option options = 6;
178
+ */
179
+ this.options = [];
180
+ /**
181
+ * The source syntax of this method.
182
+ *
183
+ * @generated from field: google.protobuf.Syntax syntax = 7;
184
+ */
185
+ this.syntax = Syntax.PROTO2;
186
+ proto3.util.initPartial(data, this);
187
+ }
188
+ static fromBinary(bytes, options) {
189
+ return new Method().fromBinary(bytes, options);
190
+ }
191
+ static fromJson(jsonValue, options) {
192
+ return new Method().fromJson(jsonValue, options);
193
+ }
194
+ static fromJsonString(jsonString, options) {
195
+ return new Method().fromJsonString(jsonString, options);
196
+ }
197
+ static equals(a, b) {
198
+ return proto3.util.equals(Method, a, b);
199
+ }
200
+ }
201
+ Method.runtime = proto3;
202
+ Method.typeName = "google.protobuf.Method";
203
+ Method.fields = proto3.util.newFieldList(() => [
204
+ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
205
+ {
206
+ no: 2,
207
+ name: "request_type_url",
208
+ kind: "scalar",
209
+ T: 9 /* ScalarType.STRING */,
210
+ },
211
+ {
212
+ no: 3,
213
+ name: "request_streaming",
214
+ kind: "scalar",
215
+ T: 8 /* ScalarType.BOOL */,
216
+ },
217
+ {
218
+ no: 4,
219
+ name: "response_type_url",
220
+ kind: "scalar",
221
+ T: 9 /* ScalarType.STRING */,
222
+ },
223
+ {
224
+ no: 5,
225
+ name: "response_streaming",
226
+ kind: "scalar",
227
+ T: 8 /* ScalarType.BOOL */,
228
+ },
229
+ { no: 6, name: "options", kind: "message", T: Option, repeated: true },
230
+ { no: 7, name: "syntax", kind: "enum", T: proto3.getEnumType(Syntax) },
231
+ ]);
232
+ /**
233
+ * Declares an API Interface to be included in this interface. The including
234
+ * interface must redeclare all the methods from the included interface, but
235
+ * documentation and options are inherited as follows:
236
+ *
237
+ * - If after comment and whitespace stripping, the documentation
238
+ * string of the redeclared method is empty, it will be inherited
239
+ * from the original method.
240
+ *
241
+ * - Each annotation belonging to the service config (http,
242
+ * visibility) which is not set in the redeclared method will be
243
+ * inherited.
244
+ *
245
+ * - If an http annotation is inherited, the path pattern will be
246
+ * modified as follows. Any version prefix will be replaced by the
247
+ * version of the including interface plus the [root][] path if
248
+ * specified.
249
+ *
250
+ * Example of a simple mixin:
251
+ *
252
+ * package google.acl.v1;
253
+ * service AccessControl {
254
+ * // Get the underlying ACL object.
255
+ * rpc GetAcl(GetAclRequest) returns (Acl) {
256
+ * option (google.api.http).get = "/v1/{resource=**}:getAcl";
257
+ * }
258
+ * }
259
+ *
260
+ * package google.storage.v2;
261
+ * service Storage {
262
+ * rpc GetAcl(GetAclRequest) returns (Acl);
263
+ *
264
+ * // Get a data record.
265
+ * rpc GetData(GetDataRequest) returns (Data) {
266
+ * option (google.api.http).get = "/v2/{resource=**}";
267
+ * }
268
+ * }
269
+ *
270
+ * Example of a mixin configuration:
271
+ *
272
+ * apis:
273
+ * - name: google.storage.v2.Storage
274
+ * mixins:
275
+ * - name: google.acl.v1.AccessControl
276
+ *
277
+ * The mixin construct implies that all methods in `AccessControl` are
278
+ * also declared with same name and request/response types in
279
+ * `Storage`. A documentation generator or annotation processor will
280
+ * see the effective `Storage.GetAcl` method after inheriting
281
+ * documentation and annotations as follows:
282
+ *
283
+ * service Storage {
284
+ * // Get the underlying ACL object.
285
+ * rpc GetAcl(GetAclRequest) returns (Acl) {
286
+ * option (google.api.http).get = "/v2/{resource=**}:getAcl";
287
+ * }
288
+ * ...
289
+ * }
290
+ *
291
+ * Note how the version in the path pattern changed from `v1` to `v2`.
292
+ *
293
+ * If the `root` field in the mixin is specified, it should be a
294
+ * relative path under which inherited HTTP paths are placed. Example:
295
+ *
296
+ * apis:
297
+ * - name: google.storage.v2.Storage
298
+ * mixins:
299
+ * - name: google.acl.v1.AccessControl
300
+ * root: acls
301
+ *
302
+ * This implies the following inherited HTTP annotation:
303
+ *
304
+ * service Storage {
305
+ * // Get the underlying ACL object.
306
+ * rpc GetAcl(GetAclRequest) returns (Acl) {
307
+ * option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
308
+ * }
309
+ * ...
310
+ * }
311
+ *
312
+ * @generated from message google.protobuf.Mixin
313
+ */
314
+ export class Mixin extends Message {
315
+ constructor(data) {
316
+ super();
317
+ /**
318
+ * The fully qualified name of the interface which is included.
319
+ *
320
+ * @generated from field: string name = 1;
321
+ */
322
+ this.name = "";
323
+ /**
324
+ * If non-empty specifies a path under which inherited HTTP paths
325
+ * are rooted.
326
+ *
327
+ * @generated from field: string root = 2;
328
+ */
329
+ this.root = "";
330
+ proto3.util.initPartial(data, this);
331
+ }
332
+ static fromBinary(bytes, options) {
333
+ return new Mixin().fromBinary(bytes, options);
334
+ }
335
+ static fromJson(jsonValue, options) {
336
+ return new Mixin().fromJson(jsonValue, options);
337
+ }
338
+ static fromJsonString(jsonString, options) {
339
+ return new Mixin().fromJsonString(jsonString, options);
340
+ }
341
+ static equals(a, b) {
342
+ return proto3.util.equals(Mixin, a, b);
343
+ }
344
+ }
345
+ Mixin.runtime = proto3;
346
+ Mixin.typeName = "google.protobuf.Mixin";
347
+ Mixin.fields = proto3.util.newFieldList(() => [
348
+ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
349
+ { no: 2, name: "root", kind: "scalar", T: 9 /* ScalarType.STRING */ },
350
+ ]);