@bufbuild/protobuf 0.0.2-alpha.3 → 0.0.3

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 (50) hide show
  1. package/README.md +5 -2
  2. package/dist/cjs/google/protobuf/any_pb.js +6 -6
  3. package/dist/cjs/google/protobuf/api_pb.js +18 -18
  4. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +22 -22
  5. package/dist/cjs/google/protobuf/descriptor_pb.js +148 -148
  6. package/dist/cjs/google/protobuf/duration_pb.js +11 -11
  7. package/dist/cjs/google/protobuf/empty_pb.js +6 -6
  8. package/dist/cjs/google/protobuf/field_mask_pb.js +7 -7
  9. package/dist/cjs/google/protobuf/source_context_pb.js +6 -6
  10. package/dist/cjs/google/protobuf/struct_pb.js +21 -21
  11. package/dist/cjs/google/protobuf/timestamp_pb.js +10 -10
  12. package/dist/cjs/google/protobuf/type_pb.js +33 -33
  13. package/dist/cjs/google/protobuf/wrappers_pb.js +66 -66
  14. package/dist/cjs/index-runtime.js +42 -0
  15. package/dist/cjs/index-wkt.js +42 -0
  16. package/dist/cjs/index.js +4 -40
  17. package/dist/cjs/private/util-common.js +1 -1
  18. package/dist/esm/google/protobuf/any_pb.js +1 -1
  19. package/dist/esm/google/protobuf/api_pb.js +1 -1
  20. package/dist/esm/google/protobuf/compiler/plugin_pb.js +1 -1
  21. package/dist/esm/google/protobuf/descriptor_pb.js +1 -1
  22. package/dist/esm/google/protobuf/duration_pb.js +1 -1
  23. package/dist/esm/google/protobuf/empty_pb.js +1 -1
  24. package/dist/esm/google/protobuf/field_mask_pb.js +1 -1
  25. package/dist/esm/google/protobuf/source_context_pb.js +1 -1
  26. package/dist/esm/google/protobuf/struct_pb.js +1 -1
  27. package/dist/esm/google/protobuf/timestamp_pb.js +1 -1
  28. package/dist/esm/google/protobuf/type_pb.js +1 -1
  29. package/dist/esm/google/protobuf/wrappers_pb.js +1 -1
  30. package/dist/esm/index-runtime.js +25 -0
  31. package/dist/esm/index-wkt.js +26 -0
  32. package/dist/esm/index.js +4 -25
  33. package/dist/esm/private/util-common.js +1 -1
  34. package/dist/types/google/protobuf/any_pb.d.ts +2 -2
  35. package/dist/types/google/protobuf/api_pb.d.ts +2 -2
  36. package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +2 -2
  37. package/dist/types/google/protobuf/descriptor_pb.d.ts +2 -2
  38. package/dist/types/google/protobuf/duration_pb.d.ts +2 -2
  39. package/dist/types/google/protobuf/empty_pb.d.ts +2 -2
  40. package/dist/types/google/protobuf/field_mask_pb.d.ts +2 -2
  41. package/dist/types/google/protobuf/source_context_pb.d.ts +2 -2
  42. package/dist/types/google/protobuf/struct_pb.d.ts +2 -2
  43. package/dist/types/google/protobuf/timestamp_pb.d.ts +2 -2
  44. package/dist/types/google/protobuf/type_pb.d.ts +2 -2
  45. package/dist/types/google/protobuf/wrappers_pb.d.ts +2 -2
  46. package/dist/types/index-runtime.d.ts +19 -0
  47. package/dist/types/index-wkt.d.ts +12 -0
  48. package/dist/types/index.d.ts +2 -31
  49. package/dist/types/message.d.ts +1 -3
  50. package/package.json +2 -2
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).
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Any = void 0;
17
- const index_js_1 = require("../../index.js");
17
+ const index_runtime_js_1 = require("../../index-runtime.js");
18
18
  /**
19
19
  * `Any` contains an arbitrary serialized protocol buffer message along with a
20
20
  * URL that describes the type of the serialized message.
@@ -102,7 +102,7 @@ const index_js_1 = require("../../index.js");
102
102
  *
103
103
  * @generated from message google.protobuf.Any
104
104
  */
105
- class Any extends index_js_1.Message {
105
+ class Any extends index_runtime_js_1.Message {
106
106
  constructor(data) {
107
107
  super();
108
108
  /**
@@ -144,7 +144,7 @@ class Any extends index_js_1.Message {
144
144
  * @generated from field: bytes value = 2;
145
145
  */
146
146
  this.value = new Uint8Array(0);
147
- index_js_1.proto3.util.initPartial(data, this);
147
+ index_runtime_js_1.proto3.util.initPartial(data, this);
148
148
  }
149
149
  toJson(options) {
150
150
  if (this.typeUrl === "") {
@@ -230,13 +230,13 @@ class Any extends index_js_1.Message {
230
230
  return new Any().fromJsonString(jsonString, options);
231
231
  }
232
232
  static equals(a, b) {
233
- return index_js_1.proto3.util.equals(Any, a, b);
233
+ return index_runtime_js_1.proto3.util.equals(Any, a, b);
234
234
  }
235
235
  }
236
236
  exports.Any = Any;
237
- Any.runtime = index_js_1.proto3;
237
+ Any.runtime = index_runtime_js_1.proto3;
238
238
  Any.typeName = "google.protobuf.Any";
239
- Any.fields = index_js_1.proto3.util.newFieldList(() => [
239
+ Any.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
240
240
  { no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
241
241
  { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
242
242
  ]);
@@ -14,7 +14,7 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Mixin = exports.Method = exports.Api = void 0;
17
- const index_js_1 = require("../../index.js");
17
+ const index_runtime_js_1 = require("../../index-runtime.js");
18
18
  const type_pb_js_1 = require("./type_pb.js");
19
19
  const source_context_pb_js_1 = require("./source_context_pb.js");
20
20
  /**
@@ -30,7 +30,7 @@ const source_context_pb_js_1 = require("./source_context_pb.js");
30
30
  *
31
31
  * @generated from message google.protobuf.Api
32
32
  */
33
- class Api extends index_js_1.Message {
33
+ class Api extends index_runtime_js_1.Message {
34
34
  constructor(data) {
35
35
  super();
36
36
  /**
@@ -90,7 +90,7 @@ class Api extends index_js_1.Message {
90
90
  * @generated from field: google.protobuf.Syntax syntax = 7;
91
91
  */
92
92
  this.syntax = type_pb_js_1.Syntax.PROTO2;
93
- index_js_1.proto3.util.initPartial(data, this);
93
+ index_runtime_js_1.proto3.util.initPartial(data, this);
94
94
  }
95
95
  static fromBinary(bytes, options) {
96
96
  return new Api().fromBinary(bytes, options);
@@ -102,27 +102,27 @@ class Api extends index_js_1.Message {
102
102
  return new Api().fromJsonString(jsonString, options);
103
103
  }
104
104
  static equals(a, b) {
105
- return index_js_1.proto3.util.equals(Api, a, b);
105
+ return index_runtime_js_1.proto3.util.equals(Api, a, b);
106
106
  }
107
107
  }
108
108
  exports.Api = Api;
109
- Api.runtime = index_js_1.proto3;
109
+ Api.runtime = index_runtime_js_1.proto3;
110
110
  Api.typeName = "google.protobuf.Api";
111
- Api.fields = index_js_1.proto3.util.newFieldList(() => [
111
+ Api.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
112
112
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
113
113
  { no: 2, name: "methods", kind: "message", T: Method, repeated: true },
114
114
  { no: 3, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
115
115
  { no: 4, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
116
116
  { no: 5, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
117
117
  { no: 6, name: "mixins", kind: "message", T: Mixin, repeated: true },
118
- { 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) },
119
119
  ]);
120
120
  /**
121
121
  * Method represents a method of an API interface.
122
122
  *
123
123
  * @generated from message google.protobuf.Method
124
124
  */
125
- class Method extends index_js_1.Message {
125
+ class Method extends index_runtime_js_1.Message {
126
126
  constructor(data) {
127
127
  super();
128
128
  /**
@@ -167,7 +167,7 @@ class Method extends index_js_1.Message {
167
167
  * @generated from field: google.protobuf.Syntax syntax = 7;
168
168
  */
169
169
  this.syntax = type_pb_js_1.Syntax.PROTO2;
170
- index_js_1.proto3.util.initPartial(data, this);
170
+ index_runtime_js_1.proto3.util.initPartial(data, this);
171
171
  }
172
172
  static fromBinary(bytes, options) {
173
173
  return new Method().fromBinary(bytes, options);
@@ -179,20 +179,20 @@ class Method extends index_js_1.Message {
179
179
  return new Method().fromJsonString(jsonString, options);
180
180
  }
181
181
  static equals(a, b) {
182
- return index_js_1.proto3.util.equals(Method, a, b);
182
+ return index_runtime_js_1.proto3.util.equals(Method, a, b);
183
183
  }
184
184
  }
185
185
  exports.Method = Method;
186
- Method.runtime = index_js_1.proto3;
186
+ Method.runtime = index_runtime_js_1.proto3;
187
187
  Method.typeName = "google.protobuf.Method";
188
- Method.fields = index_js_1.proto3.util.newFieldList(() => [
188
+ Method.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
189
189
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
190
190
  { no: 2, name: "request_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
191
191
  { no: 3, name: "request_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
192
192
  { no: 4, name: "response_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
193
193
  { no: 5, name: "response_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
194
194
  { no: 6, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
195
- { 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) },
196
196
  ]);
197
197
  /**
198
198
  * Declares an API Interface to be included in this interface. The including
@@ -276,7 +276,7 @@ Method.fields = index_js_1.proto3.util.newFieldList(() => [
276
276
  *
277
277
  * @generated from message google.protobuf.Mixin
278
278
  */
279
- class Mixin extends index_js_1.Message {
279
+ class Mixin extends index_runtime_js_1.Message {
280
280
  constructor(data) {
281
281
  super();
282
282
  /**
@@ -292,7 +292,7 @@ class Mixin extends index_js_1.Message {
292
292
  * @generated from field: string root = 2;
293
293
  */
294
294
  this.root = "";
295
- index_js_1.proto3.util.initPartial(data, this);
295
+ index_runtime_js_1.proto3.util.initPartial(data, this);
296
296
  }
297
297
  static fromBinary(bytes, options) {
298
298
  return new Mixin().fromBinary(bytes, options);
@@ -304,13 +304,13 @@ class Mixin extends index_js_1.Message {
304
304
  return new Mixin().fromJsonString(jsonString, options);
305
305
  }
306
306
  static equals(a, b) {
307
- return index_js_1.proto3.util.equals(Mixin, a, b);
307
+ return index_runtime_js_1.proto3.util.equals(Mixin, a, b);
308
308
  }
309
309
  }
310
310
  exports.Mixin = Mixin;
311
- Mixin.runtime = index_js_1.proto3;
311
+ Mixin.runtime = index_runtime_js_1.proto3;
312
312
  Mixin.typeName = "google.protobuf.Mixin";
313
- Mixin.fields = index_js_1.proto3.util.newFieldList(() => [
313
+ Mixin.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
314
314
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
315
315
  { no: 2, name: "root", kind: "scalar", T: 9 /* ScalarType.STRING */ },
316
316
  ]);
@@ -14,17 +14,17 @@
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.CodeGeneratorResponse_File = exports.CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse = exports.CodeGeneratorRequest = exports.Version = void 0;
17
- const index_js_1 = require("../../../index.js");
17
+ const index_runtime_js_1 = require("../../../index-runtime.js");
18
18
  const descriptor_pb_js_1 = require("../descriptor_pb.js");
19
19
  /**
20
20
  * The version number of protocol compiler.
21
21
  *
22
22
  * @generated from message google.protobuf.compiler.Version
23
23
  */
24
- class Version extends index_js_1.Message {
24
+ class Version extends index_runtime_js_1.Message {
25
25
  constructor(data) {
26
26
  super();
27
- index_js_1.proto2.util.initPartial(data, this);
27
+ index_runtime_js_1.proto2.util.initPartial(data, this);
28
28
  }
29
29
  static fromBinary(bytes, options) {
30
30
  return new Version().fromBinary(bytes, options);
@@ -36,13 +36,13 @@ class Version extends index_js_1.Message {
36
36
  return new Version().fromJsonString(jsonString, options);
37
37
  }
38
38
  static equals(a, b) {
39
- return index_js_1.proto2.util.equals(Version, a, b);
39
+ return index_runtime_js_1.proto2.util.equals(Version, a, b);
40
40
  }
41
41
  }
42
42
  exports.Version = Version;
43
- Version.runtime = index_js_1.proto2;
43
+ Version.runtime = index_runtime_js_1.proto2;
44
44
  Version.typeName = "google.protobuf.compiler.Version";
45
- Version.fields = index_js_1.proto2.util.newFieldList(() => [
45
+ Version.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
46
46
  { no: 1, name: "major", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
47
47
  { no: 2, name: "minor", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
48
48
  { no: 3, name: "patch", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
@@ -53,7 +53,7 @@ Version.fields = index_js_1.proto2.util.newFieldList(() => [
53
53
  *
54
54
  * @generated from message google.protobuf.compiler.CodeGeneratorRequest
55
55
  */
56
- class CodeGeneratorRequest extends index_js_1.Message {
56
+ class CodeGeneratorRequest extends index_runtime_js_1.Message {
57
57
  constructor(data) {
58
58
  super();
59
59
  /**
@@ -83,7 +83,7 @@ class CodeGeneratorRequest extends index_js_1.Message {
83
83
  * @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
84
84
  */
85
85
  this.protoFile = [];
86
- index_js_1.proto2.util.initPartial(data, this);
86
+ index_runtime_js_1.proto2.util.initPartial(data, this);
87
87
  }
88
88
  static fromBinary(bytes, options) {
89
89
  return new CodeGeneratorRequest().fromBinary(bytes, options);
@@ -95,13 +95,13 @@ class CodeGeneratorRequest extends index_js_1.Message {
95
95
  return new CodeGeneratorRequest().fromJsonString(jsonString, options);
96
96
  }
97
97
  static equals(a, b) {
98
- return index_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
98
+ return index_runtime_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
99
99
  }
100
100
  }
101
101
  exports.CodeGeneratorRequest = CodeGeneratorRequest;
102
- CodeGeneratorRequest.runtime = index_js_1.proto2;
102
+ CodeGeneratorRequest.runtime = index_runtime_js_1.proto2;
103
103
  CodeGeneratorRequest.typeName = "google.protobuf.compiler.CodeGeneratorRequest";
104
- CodeGeneratorRequest.fields = index_js_1.proto2.util.newFieldList(() => [
104
+ CodeGeneratorRequest.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
105
105
  { no: 1, name: "file_to_generate", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
106
106
  { no: 2, name: "parameter", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
107
107
  { no: 15, name: "proto_file", kind: "message", T: descriptor_pb_js_1.FileDescriptorProto, repeated: true },
@@ -112,14 +112,14 @@ CodeGeneratorRequest.fields = index_js_1.proto2.util.newFieldList(() => [
112
112
  *
113
113
  * @generated from message google.protobuf.compiler.CodeGeneratorResponse
114
114
  */
115
- class CodeGeneratorResponse extends index_js_1.Message {
115
+ class CodeGeneratorResponse extends index_runtime_js_1.Message {
116
116
  constructor(data) {
117
117
  super();
118
118
  /**
119
119
  * @generated from field: repeated google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
120
120
  */
121
121
  this.file = [];
122
- index_js_1.proto2.util.initPartial(data, this);
122
+ index_runtime_js_1.proto2.util.initPartial(data, this);
123
123
  }
124
124
  static fromBinary(bytes, options) {
125
125
  return new CodeGeneratorResponse().fromBinary(bytes, options);
@@ -131,13 +131,13 @@ class CodeGeneratorResponse extends index_js_1.Message {
131
131
  return new CodeGeneratorResponse().fromJsonString(jsonString, options);
132
132
  }
133
133
  static equals(a, b) {
134
- return index_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
134
+ return index_runtime_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
135
135
  }
136
136
  }
137
137
  exports.CodeGeneratorResponse = CodeGeneratorResponse;
138
- CodeGeneratorResponse.runtime = index_js_1.proto2;
138
+ CodeGeneratorResponse.runtime = index_runtime_js_1.proto2;
139
139
  CodeGeneratorResponse.typeName = "google.protobuf.compiler.CodeGeneratorResponse";
140
- CodeGeneratorResponse.fields = index_js_1.proto2.util.newFieldList(() => [
140
+ CodeGeneratorResponse.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
141
141
  { no: 1, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
142
142
  { no: 2, name: "supported_features", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },
143
143
  { no: 15, name: "file", kind: "message", T: CodeGeneratorResponse_File, repeated: true },
@@ -159,7 +159,7 @@ var CodeGeneratorResponse_Feature;
159
159
  CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["PROTO3_OPTIONAL"] = 1] = "PROTO3_OPTIONAL";
160
160
  })(CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse_Feature || (exports.CodeGeneratorResponse_Feature = {}));
161
161
  // Retrieve enum metadata with: proto2.getEnumType(CodeGeneratorResponse_Feature)
162
- 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", [
163
163
  { no: 0, name: "FEATURE_NONE" },
164
164
  { no: 1, name: "FEATURE_PROTO3_OPTIONAL" },
165
165
  ]);
@@ -168,10 +168,10 @@ index_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protob
168
168
  *
169
169
  * @generated from message google.protobuf.compiler.CodeGeneratorResponse.File
170
170
  */
171
- class CodeGeneratorResponse_File extends index_js_1.Message {
171
+ class CodeGeneratorResponse_File extends index_runtime_js_1.Message {
172
172
  constructor(data) {
173
173
  super();
174
- index_js_1.proto2.util.initPartial(data, this);
174
+ index_runtime_js_1.proto2.util.initPartial(data, this);
175
175
  }
176
176
  static fromBinary(bytes, options) {
177
177
  return new CodeGeneratorResponse_File().fromBinary(bytes, options);
@@ -183,13 +183,13 @@ class CodeGeneratorResponse_File extends index_js_1.Message {
183
183
  return new CodeGeneratorResponse_File().fromJsonString(jsonString, options);
184
184
  }
185
185
  static equals(a, b) {
186
- return index_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
186
+ return index_runtime_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
187
187
  }
188
188
  }
189
189
  exports.CodeGeneratorResponse_File = CodeGeneratorResponse_File;
190
- CodeGeneratorResponse_File.runtime = index_js_1.proto2;
190
+ CodeGeneratorResponse_File.runtime = index_runtime_js_1.proto2;
191
191
  CodeGeneratorResponse_File.typeName = "google.protobuf.compiler.CodeGeneratorResponse.File";
192
- CodeGeneratorResponse_File.fields = index_js_1.proto2.util.newFieldList(() => [
192
+ CodeGeneratorResponse_File.fields = index_runtime_js_1.proto2.util.newFieldList(() => [
193
193
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
194
194
  { no: 2, name: "insertion_point", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
195
195
  { no: 15, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },