@bufbuild/protobuf 0.0.2-alpha.3 → 0.0.5
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.
- package/README.md +5 -2
- package/dist/cjs/descriptor-registry.js +13 -0
- package/dist/cjs/google/protobuf/any_pb.js +6 -6
- package/dist/cjs/google/protobuf/api_pb.js +18 -18
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +22 -22
- package/dist/cjs/google/protobuf/descriptor_pb.js +148 -148
- package/dist/cjs/google/protobuf/duration_pb.js +11 -11
- package/dist/cjs/google/protobuf/empty_pb.js +6 -6
- package/dist/cjs/google/protobuf/field_mask_pb.js +7 -7
- package/dist/cjs/google/protobuf/source_context_pb.js +6 -6
- package/dist/cjs/google/protobuf/struct_pb.js +21 -21
- package/dist/cjs/google/protobuf/timestamp_pb.js +10 -10
- package/dist/cjs/google/protobuf/type_pb.js +33 -33
- package/dist/cjs/google/protobuf/wrappers_pb.js +66 -66
- package/dist/cjs/index-runtime.js +42 -0
- package/dist/cjs/index-wkt.js +42 -0
- package/dist/cjs/index.js +4 -40
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/private/util-common.js +1 -1
- package/dist/cjs/type-registry.js +58 -13
- package/dist/esm/descriptor-registry.js +13 -0
- package/dist/esm/google/protobuf/any_pb.js +1 -1
- package/dist/esm/google/protobuf/api_pb.js +1 -1
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +1 -1
- package/dist/esm/google/protobuf/descriptor_pb.js +1 -1
- package/dist/esm/google/protobuf/duration_pb.js +1 -1
- package/dist/esm/google/protobuf/empty_pb.js +1 -1
- package/dist/esm/google/protobuf/field_mask_pb.js +1 -1
- package/dist/esm/google/protobuf/source_context_pb.js +1 -1
- package/dist/esm/google/protobuf/struct_pb.js +1 -1
- package/dist/esm/google/protobuf/timestamp_pb.js +1 -1
- package/dist/esm/google/protobuf/type_pb.js +1 -1
- package/dist/esm/google/protobuf/wrappers_pb.js +1 -1
- package/dist/esm/index-runtime.js +25 -0
- package/dist/esm/index-wkt.js +26 -0
- package/dist/esm/index.js +4 -25
- package/dist/esm/private/util-common.js +1 -1
- package/dist/esm/type-registry.js +58 -13
- package/dist/types/descriptor-registry.d.ts +7 -0
- package/dist/types/google/protobuf/any_pb.d.ts +2 -2
- package/dist/types/google/protobuf/api_pb.d.ts +2 -2
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/dist/types/google/protobuf/descriptor_pb.d.ts +2 -2
- package/dist/types/google/protobuf/duration_pb.d.ts +2 -2
- package/dist/types/google/protobuf/empty_pb.d.ts +2 -2
- package/dist/types/google/protobuf/field_mask_pb.d.ts +2 -2
- package/dist/types/google/protobuf/source_context_pb.d.ts +2 -2
- package/dist/types/google/protobuf/struct_pb.d.ts +2 -2
- package/dist/types/google/protobuf/timestamp_pb.d.ts +2 -2
- package/dist/types/google/protobuf/type_pb.d.ts +2 -2
- package/dist/types/google/protobuf/wrappers_pb.d.ts +2 -2
- package/dist/types/index-runtime.d.ts +19 -0
- package/dist/types/index-wkt.d.ts +12 -0
- package/dist/types/index.d.ts +2 -31
- package/dist/types/message.d.ts +1 -3
- package/dist/types/type-registry.d.ts +35 -2
- package/package.json +4 -3
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.BytesValue = exports.StringValue = exports.BoolValue = exports.UInt32Value = exports.Int32Value = exports.UInt64Value = exports.Int64Value = exports.FloatValue = exports.DoubleValue = void 0;
|
|
17
|
-
const
|
|
17
|
+
const index_runtime_js_1 = require("../../index-runtime.js");
|
|
18
18
|
/**
|
|
19
19
|
* Wrapper message for `double`.
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ const index_js_1 = require("../../index.js");
|
|
|
22
22
|
*
|
|
23
23
|
* @generated from message google.protobuf.DoubleValue
|
|
24
24
|
*/
|
|
25
|
-
class DoubleValue extends
|
|
25
|
+
class DoubleValue extends index_runtime_js_1.Message {
|
|
26
26
|
constructor(data) {
|
|
27
27
|
super();
|
|
28
28
|
/**
|
|
@@ -31,14 +31,14 @@ class DoubleValue extends index_js_1.Message {
|
|
|
31
31
|
* @generated from field: double value = 1;
|
|
32
32
|
*/
|
|
33
33
|
this.value = 0;
|
|
34
|
-
|
|
34
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
35
35
|
}
|
|
36
36
|
toJson(options) {
|
|
37
|
-
return
|
|
37
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.DOUBLE, this.value, true);
|
|
38
38
|
}
|
|
39
39
|
fromJson(json, options) {
|
|
40
40
|
try {
|
|
41
|
-
this.value =
|
|
41
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.DOUBLE, json);
|
|
42
42
|
}
|
|
43
43
|
catch (e) {
|
|
44
44
|
let m = `cannot decode message google.protobuf.DoubleValue from JSON"`;
|
|
@@ -59,13 +59,13 @@ class DoubleValue extends index_js_1.Message {
|
|
|
59
59
|
return new DoubleValue().fromJsonString(jsonString, options);
|
|
60
60
|
}
|
|
61
61
|
static equals(a, b) {
|
|
62
|
-
return
|
|
62
|
+
return index_runtime_js_1.proto3.util.equals(DoubleValue, a, b);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
exports.DoubleValue = DoubleValue;
|
|
66
|
-
DoubleValue.runtime =
|
|
66
|
+
DoubleValue.runtime = index_runtime_js_1.proto3;
|
|
67
67
|
DoubleValue.typeName = "google.protobuf.DoubleValue";
|
|
68
|
-
DoubleValue.fields =
|
|
68
|
+
DoubleValue.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
69
69
|
{ no: 1, name: "value", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ },
|
|
70
70
|
]);
|
|
71
71
|
DoubleValue.fieldWrapper = {
|
|
@@ -83,7 +83,7 @@ DoubleValue.fieldWrapper = {
|
|
|
83
83
|
*
|
|
84
84
|
* @generated from message google.protobuf.FloatValue
|
|
85
85
|
*/
|
|
86
|
-
class FloatValue extends
|
|
86
|
+
class FloatValue extends index_runtime_js_1.Message {
|
|
87
87
|
constructor(data) {
|
|
88
88
|
super();
|
|
89
89
|
/**
|
|
@@ -92,14 +92,14 @@ class FloatValue extends index_js_1.Message {
|
|
|
92
92
|
* @generated from field: float value = 1;
|
|
93
93
|
*/
|
|
94
94
|
this.value = 0;
|
|
95
|
-
|
|
95
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
96
96
|
}
|
|
97
97
|
toJson(options) {
|
|
98
|
-
return
|
|
98
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.FLOAT, this.value, true);
|
|
99
99
|
}
|
|
100
100
|
fromJson(json, options) {
|
|
101
101
|
try {
|
|
102
|
-
this.value =
|
|
102
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.FLOAT, json);
|
|
103
103
|
}
|
|
104
104
|
catch (e) {
|
|
105
105
|
let m = `cannot decode message google.protobuf.FloatValue from JSON"`;
|
|
@@ -120,13 +120,13 @@ class FloatValue extends index_js_1.Message {
|
|
|
120
120
|
return new FloatValue().fromJsonString(jsonString, options);
|
|
121
121
|
}
|
|
122
122
|
static equals(a, b) {
|
|
123
|
-
return
|
|
123
|
+
return index_runtime_js_1.proto3.util.equals(FloatValue, a, b);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
exports.FloatValue = FloatValue;
|
|
127
|
-
FloatValue.runtime =
|
|
127
|
+
FloatValue.runtime = index_runtime_js_1.proto3;
|
|
128
128
|
FloatValue.typeName = "google.protobuf.FloatValue";
|
|
129
|
-
FloatValue.fields =
|
|
129
|
+
FloatValue.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
130
130
|
{ no: 1, name: "value", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
|
|
131
131
|
]);
|
|
132
132
|
FloatValue.fieldWrapper = {
|
|
@@ -144,7 +144,7 @@ FloatValue.fieldWrapper = {
|
|
|
144
144
|
*
|
|
145
145
|
* @generated from message google.protobuf.Int64Value
|
|
146
146
|
*/
|
|
147
|
-
class Int64Value extends
|
|
147
|
+
class Int64Value extends index_runtime_js_1.Message {
|
|
148
148
|
constructor(data) {
|
|
149
149
|
super();
|
|
150
150
|
/**
|
|
@@ -152,15 +152,15 @@ class Int64Value extends index_js_1.Message {
|
|
|
152
152
|
*
|
|
153
153
|
* @generated from field: int64 value = 1;
|
|
154
154
|
*/
|
|
155
|
-
this.value =
|
|
156
|
-
|
|
155
|
+
this.value = index_runtime_js_1.protoInt64.zero;
|
|
156
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
157
157
|
}
|
|
158
158
|
toJson(options) {
|
|
159
|
-
return
|
|
159
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.INT64, this.value, true);
|
|
160
160
|
}
|
|
161
161
|
fromJson(json, options) {
|
|
162
162
|
try {
|
|
163
|
-
this.value =
|
|
163
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.INT64, json);
|
|
164
164
|
}
|
|
165
165
|
catch (e) {
|
|
166
166
|
let m = `cannot decode message google.protobuf.Int64Value from JSON"`;
|
|
@@ -181,13 +181,13 @@ class Int64Value extends index_js_1.Message {
|
|
|
181
181
|
return new Int64Value().fromJsonString(jsonString, options);
|
|
182
182
|
}
|
|
183
183
|
static equals(a, b) {
|
|
184
|
-
return
|
|
184
|
+
return index_runtime_js_1.proto3.util.equals(Int64Value, a, b);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
exports.Int64Value = Int64Value;
|
|
188
|
-
Int64Value.runtime =
|
|
188
|
+
Int64Value.runtime = index_runtime_js_1.proto3;
|
|
189
189
|
Int64Value.typeName = "google.protobuf.Int64Value";
|
|
190
|
-
Int64Value.fields =
|
|
190
|
+
Int64Value.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
191
191
|
{ no: 1, name: "value", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
|
|
192
192
|
]);
|
|
193
193
|
Int64Value.fieldWrapper = {
|
|
@@ -205,7 +205,7 @@ Int64Value.fieldWrapper = {
|
|
|
205
205
|
*
|
|
206
206
|
* @generated from message google.protobuf.UInt64Value
|
|
207
207
|
*/
|
|
208
|
-
class UInt64Value extends
|
|
208
|
+
class UInt64Value extends index_runtime_js_1.Message {
|
|
209
209
|
constructor(data) {
|
|
210
210
|
super();
|
|
211
211
|
/**
|
|
@@ -213,15 +213,15 @@ class UInt64Value extends index_js_1.Message {
|
|
|
213
213
|
*
|
|
214
214
|
* @generated from field: uint64 value = 1;
|
|
215
215
|
*/
|
|
216
|
-
this.value =
|
|
217
|
-
|
|
216
|
+
this.value = index_runtime_js_1.protoInt64.zero;
|
|
217
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
218
218
|
}
|
|
219
219
|
toJson(options) {
|
|
220
|
-
return
|
|
220
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.UINT64, this.value, true);
|
|
221
221
|
}
|
|
222
222
|
fromJson(json, options) {
|
|
223
223
|
try {
|
|
224
|
-
this.value =
|
|
224
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.UINT64, json);
|
|
225
225
|
}
|
|
226
226
|
catch (e) {
|
|
227
227
|
let m = `cannot decode message google.protobuf.UInt64Value from JSON"`;
|
|
@@ -242,13 +242,13 @@ class UInt64Value extends index_js_1.Message {
|
|
|
242
242
|
return new UInt64Value().fromJsonString(jsonString, options);
|
|
243
243
|
}
|
|
244
244
|
static equals(a, b) {
|
|
245
|
-
return
|
|
245
|
+
return index_runtime_js_1.proto3.util.equals(UInt64Value, a, b);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
exports.UInt64Value = UInt64Value;
|
|
249
|
-
UInt64Value.runtime =
|
|
249
|
+
UInt64Value.runtime = index_runtime_js_1.proto3;
|
|
250
250
|
UInt64Value.typeName = "google.protobuf.UInt64Value";
|
|
251
|
-
UInt64Value.fields =
|
|
251
|
+
UInt64Value.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
252
252
|
{ no: 1, name: "value", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
|
|
253
253
|
]);
|
|
254
254
|
UInt64Value.fieldWrapper = {
|
|
@@ -266,7 +266,7 @@ UInt64Value.fieldWrapper = {
|
|
|
266
266
|
*
|
|
267
267
|
* @generated from message google.protobuf.Int32Value
|
|
268
268
|
*/
|
|
269
|
-
class Int32Value extends
|
|
269
|
+
class Int32Value extends index_runtime_js_1.Message {
|
|
270
270
|
constructor(data) {
|
|
271
271
|
super();
|
|
272
272
|
/**
|
|
@@ -275,14 +275,14 @@ class Int32Value extends index_js_1.Message {
|
|
|
275
275
|
* @generated from field: int32 value = 1;
|
|
276
276
|
*/
|
|
277
277
|
this.value = 0;
|
|
278
|
-
|
|
278
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
279
279
|
}
|
|
280
280
|
toJson(options) {
|
|
281
|
-
return
|
|
281
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.INT32, this.value, true);
|
|
282
282
|
}
|
|
283
283
|
fromJson(json, options) {
|
|
284
284
|
try {
|
|
285
|
-
this.value =
|
|
285
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.INT32, json);
|
|
286
286
|
}
|
|
287
287
|
catch (e) {
|
|
288
288
|
let m = `cannot decode message google.protobuf.Int32Value from JSON"`;
|
|
@@ -303,13 +303,13 @@ class Int32Value extends index_js_1.Message {
|
|
|
303
303
|
return new Int32Value().fromJsonString(jsonString, options);
|
|
304
304
|
}
|
|
305
305
|
static equals(a, b) {
|
|
306
|
-
return
|
|
306
|
+
return index_runtime_js_1.proto3.util.equals(Int32Value, a, b);
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
exports.Int32Value = Int32Value;
|
|
310
|
-
Int32Value.runtime =
|
|
310
|
+
Int32Value.runtime = index_runtime_js_1.proto3;
|
|
311
311
|
Int32Value.typeName = "google.protobuf.Int32Value";
|
|
312
|
-
Int32Value.fields =
|
|
312
|
+
Int32Value.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
313
313
|
{ no: 1, name: "value", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
314
314
|
]);
|
|
315
315
|
Int32Value.fieldWrapper = {
|
|
@@ -327,7 +327,7 @@ Int32Value.fieldWrapper = {
|
|
|
327
327
|
*
|
|
328
328
|
* @generated from message google.protobuf.UInt32Value
|
|
329
329
|
*/
|
|
330
|
-
class UInt32Value extends
|
|
330
|
+
class UInt32Value extends index_runtime_js_1.Message {
|
|
331
331
|
constructor(data) {
|
|
332
332
|
super();
|
|
333
333
|
/**
|
|
@@ -336,14 +336,14 @@ class UInt32Value extends index_js_1.Message {
|
|
|
336
336
|
* @generated from field: uint32 value = 1;
|
|
337
337
|
*/
|
|
338
338
|
this.value = 0;
|
|
339
|
-
|
|
339
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
340
340
|
}
|
|
341
341
|
toJson(options) {
|
|
342
|
-
return
|
|
342
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.UINT32, this.value, true);
|
|
343
343
|
}
|
|
344
344
|
fromJson(json, options) {
|
|
345
345
|
try {
|
|
346
|
-
this.value =
|
|
346
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.UINT32, json);
|
|
347
347
|
}
|
|
348
348
|
catch (e) {
|
|
349
349
|
let m = `cannot decode message google.protobuf.UInt32Value from JSON"`;
|
|
@@ -364,13 +364,13 @@ class UInt32Value extends index_js_1.Message {
|
|
|
364
364
|
return new UInt32Value().fromJsonString(jsonString, options);
|
|
365
365
|
}
|
|
366
366
|
static equals(a, b) {
|
|
367
|
-
return
|
|
367
|
+
return index_runtime_js_1.proto3.util.equals(UInt32Value, a, b);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
exports.UInt32Value = UInt32Value;
|
|
371
|
-
UInt32Value.runtime =
|
|
371
|
+
UInt32Value.runtime = index_runtime_js_1.proto3;
|
|
372
372
|
UInt32Value.typeName = "google.protobuf.UInt32Value";
|
|
373
|
-
UInt32Value.fields =
|
|
373
|
+
UInt32Value.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
374
374
|
{ no: 1, name: "value", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
375
375
|
]);
|
|
376
376
|
UInt32Value.fieldWrapper = {
|
|
@@ -388,7 +388,7 @@ UInt32Value.fieldWrapper = {
|
|
|
388
388
|
*
|
|
389
389
|
* @generated from message google.protobuf.BoolValue
|
|
390
390
|
*/
|
|
391
|
-
class BoolValue extends
|
|
391
|
+
class BoolValue extends index_runtime_js_1.Message {
|
|
392
392
|
constructor(data) {
|
|
393
393
|
super();
|
|
394
394
|
/**
|
|
@@ -397,14 +397,14 @@ class BoolValue extends index_js_1.Message {
|
|
|
397
397
|
* @generated from field: bool value = 1;
|
|
398
398
|
*/
|
|
399
399
|
this.value = false;
|
|
400
|
-
|
|
400
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
401
401
|
}
|
|
402
402
|
toJson(options) {
|
|
403
|
-
return
|
|
403
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.BOOL, this.value, true);
|
|
404
404
|
}
|
|
405
405
|
fromJson(json, options) {
|
|
406
406
|
try {
|
|
407
|
-
this.value =
|
|
407
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.BOOL, json);
|
|
408
408
|
}
|
|
409
409
|
catch (e) {
|
|
410
410
|
let m = `cannot decode message google.protobuf.BoolValue from JSON"`;
|
|
@@ -425,13 +425,13 @@ class BoolValue extends index_js_1.Message {
|
|
|
425
425
|
return new BoolValue().fromJsonString(jsonString, options);
|
|
426
426
|
}
|
|
427
427
|
static equals(a, b) {
|
|
428
|
-
return
|
|
428
|
+
return index_runtime_js_1.proto3.util.equals(BoolValue, a, b);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
exports.BoolValue = BoolValue;
|
|
432
|
-
BoolValue.runtime =
|
|
432
|
+
BoolValue.runtime = index_runtime_js_1.proto3;
|
|
433
433
|
BoolValue.typeName = "google.protobuf.BoolValue";
|
|
434
|
-
BoolValue.fields =
|
|
434
|
+
BoolValue.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
435
435
|
{ no: 1, name: "value", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
436
436
|
]);
|
|
437
437
|
BoolValue.fieldWrapper = {
|
|
@@ -449,7 +449,7 @@ BoolValue.fieldWrapper = {
|
|
|
449
449
|
*
|
|
450
450
|
* @generated from message google.protobuf.StringValue
|
|
451
451
|
*/
|
|
452
|
-
class StringValue extends
|
|
452
|
+
class StringValue extends index_runtime_js_1.Message {
|
|
453
453
|
constructor(data) {
|
|
454
454
|
super();
|
|
455
455
|
/**
|
|
@@ -458,14 +458,14 @@ class StringValue extends index_js_1.Message {
|
|
|
458
458
|
* @generated from field: string value = 1;
|
|
459
459
|
*/
|
|
460
460
|
this.value = "";
|
|
461
|
-
|
|
461
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
462
462
|
}
|
|
463
463
|
toJson(options) {
|
|
464
|
-
return
|
|
464
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.STRING, this.value, true);
|
|
465
465
|
}
|
|
466
466
|
fromJson(json, options) {
|
|
467
467
|
try {
|
|
468
|
-
this.value =
|
|
468
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.STRING, json);
|
|
469
469
|
}
|
|
470
470
|
catch (e) {
|
|
471
471
|
let m = `cannot decode message google.protobuf.StringValue from JSON"`;
|
|
@@ -486,13 +486,13 @@ class StringValue extends index_js_1.Message {
|
|
|
486
486
|
return new StringValue().fromJsonString(jsonString, options);
|
|
487
487
|
}
|
|
488
488
|
static equals(a, b) {
|
|
489
|
-
return
|
|
489
|
+
return index_runtime_js_1.proto3.util.equals(StringValue, a, b);
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
exports.StringValue = StringValue;
|
|
493
|
-
StringValue.runtime =
|
|
493
|
+
StringValue.runtime = index_runtime_js_1.proto3;
|
|
494
494
|
StringValue.typeName = "google.protobuf.StringValue";
|
|
495
|
-
StringValue.fields =
|
|
495
|
+
StringValue.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
496
496
|
{ no: 1, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
497
497
|
]);
|
|
498
498
|
StringValue.fieldWrapper = {
|
|
@@ -510,7 +510,7 @@ StringValue.fieldWrapper = {
|
|
|
510
510
|
*
|
|
511
511
|
* @generated from message google.protobuf.BytesValue
|
|
512
512
|
*/
|
|
513
|
-
class BytesValue extends
|
|
513
|
+
class BytesValue extends index_runtime_js_1.Message {
|
|
514
514
|
constructor(data) {
|
|
515
515
|
super();
|
|
516
516
|
/**
|
|
@@ -519,14 +519,14 @@ class BytesValue extends index_js_1.Message {
|
|
|
519
519
|
* @generated from field: bytes value = 1;
|
|
520
520
|
*/
|
|
521
521
|
this.value = new Uint8Array(0);
|
|
522
|
-
|
|
522
|
+
index_runtime_js_1.proto3.util.initPartial(data, this);
|
|
523
523
|
}
|
|
524
524
|
toJson(options) {
|
|
525
|
-
return
|
|
525
|
+
return index_runtime_js_1.proto3.json.writeScalar(index_runtime_js_1.ScalarType.BYTES, this.value, true);
|
|
526
526
|
}
|
|
527
527
|
fromJson(json, options) {
|
|
528
528
|
try {
|
|
529
|
-
this.value =
|
|
529
|
+
this.value = index_runtime_js_1.proto3.json.readScalar(index_runtime_js_1.ScalarType.BYTES, json);
|
|
530
530
|
}
|
|
531
531
|
catch (e) {
|
|
532
532
|
let m = `cannot decode message google.protobuf.BytesValue from JSON"`;
|
|
@@ -547,13 +547,13 @@ class BytesValue extends index_js_1.Message {
|
|
|
547
547
|
return new BytesValue().fromJsonString(jsonString, options);
|
|
548
548
|
}
|
|
549
549
|
static equals(a, b) {
|
|
550
|
-
return
|
|
550
|
+
return index_runtime_js_1.proto3.util.equals(BytesValue, a, b);
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
exports.BytesValue = BytesValue;
|
|
554
|
-
BytesValue.runtime =
|
|
554
|
+
BytesValue.runtime = index_runtime_js_1.proto3;
|
|
555
555
|
BytesValue.typeName = "google.protobuf.BytesValue";
|
|
556
|
-
BytesValue.fields =
|
|
556
|
+
BytesValue.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
557
557
|
{ no: 1, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
|
558
558
|
]);
|
|
559
559
|
BytesValue.fieldWrapper = {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
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
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
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.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.DescriptorSet = exports.DescriptorRegistry = exports.TypeRegistry = exports.MethodIdempotency = exports.MethodKind = exports.ScalarType = exports.Message = exports.protoBase64 = exports.protoInt64 = exports.proto2 = exports.proto3 = void 0;
|
|
17
|
+
var proto3_js_1 = require("./proto3.js");
|
|
18
|
+
Object.defineProperty(exports, "proto3", { enumerable: true, get: function () { return proto3_js_1.proto3; } });
|
|
19
|
+
var proto2_js_1 = require("./proto2.js");
|
|
20
|
+
Object.defineProperty(exports, "proto2", { enumerable: true, get: function () { return proto2_js_1.proto2; } });
|
|
21
|
+
var proto_int64_js_1 = require("./proto-int64.js");
|
|
22
|
+
Object.defineProperty(exports, "protoInt64", { enumerable: true, get: function () { return proto_int64_js_1.protoInt64; } });
|
|
23
|
+
var proto_base64_js_1 = require("./proto-base64.js");
|
|
24
|
+
Object.defineProperty(exports, "protoBase64", { enumerable: true, get: function () { return proto_base64_js_1.protoBase64; } });
|
|
25
|
+
var message_js_1 = require("./message.js");
|
|
26
|
+
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_js_1.Message; } });
|
|
27
|
+
var field_js_1 = require("./field.js");
|
|
28
|
+
Object.defineProperty(exports, "ScalarType", { enumerable: true, get: function () { return field_js_1.ScalarType; } });
|
|
29
|
+
var service_type_js_1 = require("./service-type.js");
|
|
30
|
+
Object.defineProperty(exports, "MethodKind", { enumerable: true, get: function () { return service_type_js_1.MethodKind; } });
|
|
31
|
+
Object.defineProperty(exports, "MethodIdempotency", { enumerable: true, get: function () { return service_type_js_1.MethodIdempotency; } });
|
|
32
|
+
var type_registry_js_1 = require("./type-registry.js");
|
|
33
|
+
Object.defineProperty(exports, "TypeRegistry", { enumerable: true, get: function () { return type_registry_js_1.TypeRegistry; } });
|
|
34
|
+
var descriptor_registry_js_1 = require("./descriptor-registry.js");
|
|
35
|
+
Object.defineProperty(exports, "DescriptorRegistry", { enumerable: true, get: function () { return descriptor_registry_js_1.DescriptorRegistry; } });
|
|
36
|
+
var descriptor_set_js_1 = require("./descriptor-set.js");
|
|
37
|
+
Object.defineProperty(exports, "DescriptorSet", { enumerable: true, get: function () { return descriptor_set_js_1.DescriptorSet; } });
|
|
38
|
+
var binary_encoding_js_1 = require("./binary-encoding.js");
|
|
39
|
+
Object.defineProperty(exports, "WireType", { enumerable: true, get: function () { return binary_encoding_js_1.WireType; } });
|
|
40
|
+
Object.defineProperty(exports, "BinaryWriter", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryWriter; } });
|
|
41
|
+
Object.defineProperty(exports, "BinaryReader", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryReader; } });
|
|
42
|
+
var json_format_js_1 = require("./json-format.js");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
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
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
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.
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
// ideally, we would export these types with sub-path exports:
|
|
31
|
+
__exportStar(require("./google/protobuf/compiler/plugin_pb.js"), exports);
|
|
32
|
+
__exportStar(require("./google/protobuf/api_pb.js"), exports);
|
|
33
|
+
__exportStar(require("./google/protobuf/any_pb.js"), exports);
|
|
34
|
+
__exportStar(require("./google/protobuf/descriptor_pb.js"), exports);
|
|
35
|
+
__exportStar(require("./google/protobuf/duration_pb.js"), exports);
|
|
36
|
+
__exportStar(require("./google/protobuf/empty_pb.js"), exports);
|
|
37
|
+
__exportStar(require("./google/protobuf/field_mask_pb.js"), exports);
|
|
38
|
+
__exportStar(require("./google/protobuf/source_context_pb.js"), exports);
|
|
39
|
+
__exportStar(require("./google/protobuf/struct_pb.js"), exports);
|
|
40
|
+
__exportStar(require("./google/protobuf/timestamp_pb.js"), exports);
|
|
41
|
+
__exportStar(require("./google/protobuf/type_pb.js"), exports);
|
|
42
|
+
__exportStar(require("./google/protobuf/wrappers_pb.js"), exports);
|
package/dist/cjs/index.js
CHANGED
|
@@ -27,43 +27,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Object.defineProperty(exports, "proto2", { enumerable: true, get: function () { return proto2_js_1.proto2; } });
|
|
35
|
-
var proto_int64_js_1 = require("./proto-int64.js");
|
|
36
|
-
Object.defineProperty(exports, "protoInt64", { enumerable: true, get: function () { return proto_int64_js_1.protoInt64; } });
|
|
37
|
-
var proto_base64_js_1 = require("./proto-base64.js");
|
|
38
|
-
Object.defineProperty(exports, "protoBase64", { enumerable: true, get: function () { return proto_base64_js_1.protoBase64; } });
|
|
39
|
-
var message_js_1 = require("./message.js");
|
|
40
|
-
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_js_1.Message; } });
|
|
41
|
-
var field_js_1 = require("./field.js");
|
|
42
|
-
Object.defineProperty(exports, "ScalarType", { enumerable: true, get: function () { return field_js_1.ScalarType; } });
|
|
43
|
-
var service_type_js_1 = require("./service-type.js");
|
|
44
|
-
Object.defineProperty(exports, "MethodKind", { enumerable: true, get: function () { return service_type_js_1.MethodKind; } });
|
|
45
|
-
Object.defineProperty(exports, "MethodIdempotency", { enumerable: true, get: function () { return service_type_js_1.MethodIdempotency; } });
|
|
46
|
-
var type_registry_js_1 = require("./type-registry.js");
|
|
47
|
-
Object.defineProperty(exports, "TypeRegistry", { enumerable: true, get: function () { return type_registry_js_1.TypeRegistry; } });
|
|
48
|
-
var descriptor_registry_js_1 = require("./descriptor-registry.js");
|
|
49
|
-
Object.defineProperty(exports, "DescriptorRegistry", { enumerable: true, get: function () { return descriptor_registry_js_1.DescriptorRegistry; } });
|
|
50
|
-
var descriptor_set_js_1 = require("./descriptor-set.js");
|
|
51
|
-
Object.defineProperty(exports, "DescriptorSet", { enumerable: true, get: function () { return descriptor_set_js_1.DescriptorSet; } });
|
|
52
|
-
var binary_encoding_js_1 = require("./binary-encoding.js");
|
|
53
|
-
Object.defineProperty(exports, "WireType", { enumerable: true, get: function () { return binary_encoding_js_1.WireType; } });
|
|
54
|
-
Object.defineProperty(exports, "BinaryWriter", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryWriter; } });
|
|
55
|
-
Object.defineProperty(exports, "BinaryReader", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryReader; } });
|
|
56
|
-
var json_format_js_1 = require("./json-format.js");
|
|
57
|
-
// ideally, we would export these types with sub-path exports:
|
|
58
|
-
__exportStar(require("./google/protobuf/compiler/plugin_pb.js"), exports);
|
|
59
|
-
__exportStar(require("./google/protobuf/api_pb.js"), exports);
|
|
60
|
-
__exportStar(require("./google/protobuf/any_pb.js"), exports);
|
|
61
|
-
__exportStar(require("./google/protobuf/descriptor_pb.js"), exports);
|
|
62
|
-
__exportStar(require("./google/protobuf/duration_pb.js"), exports);
|
|
63
|
-
__exportStar(require("./google/protobuf/empty_pb.js"), exports);
|
|
64
|
-
__exportStar(require("./google/protobuf/field_mask_pb.js"), exports);
|
|
65
|
-
__exportStar(require("./google/protobuf/source_context_pb.js"), exports);
|
|
66
|
-
__exportStar(require("./google/protobuf/struct_pb.js"), exports);
|
|
67
|
-
__exportStar(require("./google/protobuf/timestamp_pb.js"), exports);
|
|
68
|
-
__exportStar(require("./google/protobuf/type_pb.js"), exports);
|
|
69
|
-
__exportStar(require("./google/protobuf/wrappers_pb.js"), exports);
|
|
30
|
+
// To avoid circular imports when the wkt import from ./index.js, we
|
|
31
|
+
// use a separate ./index-runtime.js
|
|
32
|
+
__exportStar(require("./index-runtime.js"), exports);
|
|
33
|
+
__exportStar(require("./index-wkt.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.TypeRegistry = void 0;
|
|
17
17
|
/**
|
|
18
|
-
* TypeRegistry is a
|
|
18
|
+
* TypeRegistry is a simple registry for all message, enum, or service types.
|
|
19
19
|
*/
|
|
20
20
|
class TypeRegistry {
|
|
21
21
|
constructor() {
|
|
@@ -23,35 +23,80 @@ class TypeRegistry {
|
|
|
23
23
|
this.enums = {};
|
|
24
24
|
this.services = {};
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Find a message type by its protobuf type name.
|
|
28
|
+
*/
|
|
26
29
|
findMessage(typeName) {
|
|
27
30
|
return this.messages[typeName];
|
|
28
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Find an enum type by its protobuf type name.
|
|
34
|
+
*/
|
|
29
35
|
findEnum(typeName) {
|
|
30
36
|
return this.enums[typeName];
|
|
31
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Find a service type by its protobuf type name.
|
|
40
|
+
*/
|
|
32
41
|
findService(typeName) {
|
|
33
42
|
return this.services[typeName];
|
|
34
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a new TypeRegistry from the given types.
|
|
46
|
+
*/
|
|
47
|
+
static from(...types) {
|
|
48
|
+
const registry = new TypeRegistry();
|
|
49
|
+
for (const type of types) {
|
|
50
|
+
registry.add(type);
|
|
51
|
+
}
|
|
52
|
+
return registry;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated use TypeRegistry.from()
|
|
56
|
+
*/
|
|
57
|
+
static fromIterable(types) {
|
|
58
|
+
return TypeRegistry.from(...types);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated use TypeRegistry.from()
|
|
62
|
+
*/
|
|
63
|
+
static fromTypes(...types) {
|
|
64
|
+
return TypeRegistry.from(...types);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Add a type to the registry. For messages, the types used in message
|
|
68
|
+
* fields are added recursively. For services, the message types used
|
|
69
|
+
* for requests and responses are added recursively.
|
|
70
|
+
*/
|
|
35
71
|
add(type) {
|
|
36
72
|
if ("fields" in type) {
|
|
37
|
-
this.
|
|
73
|
+
if (!this.findMessage(type.typeName)) {
|
|
74
|
+
this.messages[type.typeName] = type;
|
|
75
|
+
for (const field of type.fields.list()) {
|
|
76
|
+
if (field.kind == "message") {
|
|
77
|
+
this.add(field.T);
|
|
78
|
+
}
|
|
79
|
+
else if (field.kind == "map" && field.V.kind == "message") {
|
|
80
|
+
this.add(field.V.T);
|
|
81
|
+
}
|
|
82
|
+
else if (field.kind == "enum") {
|
|
83
|
+
this.add(field.T);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
38
87
|
}
|
|
39
88
|
else if ("methods" in type) {
|
|
40
|
-
this.
|
|
89
|
+
if (!this.findService(type.typeName)) {
|
|
90
|
+
this.services[type.typeName] = type;
|
|
91
|
+
for (const method of Object.values(type.methods)) {
|
|
92
|
+
this.add(method.I);
|
|
93
|
+
this.add(method.O);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
41
96
|
}
|
|
42
97
|
else {
|
|
43
98
|
this.enums[type.typeName] = type;
|
|
44
99
|
}
|
|
45
100
|
}
|
|
46
|
-
static fromIterable(types) {
|
|
47
|
-
const r = new TypeRegistry();
|
|
48
|
-
for (const t of types) {
|
|
49
|
-
r.add(t);
|
|
50
|
-
}
|
|
51
|
-
return r;
|
|
52
|
-
}
|
|
53
|
-
static fromTypes(...types) {
|
|
54
|
-
return TypeRegistry.fromIterable(types);
|
|
55
|
-
}
|
|
56
101
|
}
|
|
57
102
|
exports.TypeRegistry = TypeRegistry;
|