@bufbuild/protobuf 0.0.4 → 0.0.7
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/dist/cjs/binary-encoding.js +2 -2
- package/dist/cjs/descriptor-registry.js +18 -60
- package/dist/cjs/descriptor-set.js +15 -37
- package/dist/cjs/google/protobuf/any_pb.js +11 -8
- package/dist/cjs/google/protobuf/api_pb.js +19 -18
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +23 -22
- package/dist/cjs/google/protobuf/descriptor_pb.js +149 -148
- package/dist/cjs/google/protobuf/duration_pb.js +14 -12
- package/dist/cjs/google/protobuf/empty_pb.js +7 -6
- package/dist/cjs/google/protobuf/field_mask_pb.js +8 -7
- package/dist/cjs/google/protobuf/source_context_pb.js +7 -6
- package/dist/cjs/google/protobuf/struct_pb.js +26 -22
- package/dist/cjs/google/protobuf/timestamp_pb.js +12 -10
- package/dist/cjs/google/protobuf/type_pb.js +37 -33
- package/dist/cjs/google/protobuf/wrappers_pb.js +69 -66
- package/dist/cjs/index.js +40 -4
- package/dist/cjs/message.js +2 -1
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/private/binary-format-common.js +4 -3
- package/dist/cjs/private/binary-format-proto2.js +3 -6
- package/dist/cjs/private/binary-format-proto3.js +2 -5
- package/dist/cjs/private/enum.js +1 -1
- package/dist/cjs/private/json-format-common.js +6 -5
- package/dist/cjs/private/message-type.js +2 -1
- package/dist/cjs/proto-int64.js +1 -1
- package/dist/cjs/proto2.js +6 -8
- package/dist/cjs/proto3.js +9 -12
- package/dist/cjs/type-registry.js +58 -13
- package/dist/esm/binary-encoding.js +2 -2
- package/dist/esm/descriptor-registry.js +18 -60
- package/dist/esm/descriptor-set.js +15 -37
- package/dist/esm/google/protobuf/any_pb.js +6 -3
- package/dist/esm/google/protobuf/api_pb.js +2 -1
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +2 -1
- package/dist/esm/google/protobuf/descriptor_pb.js +2 -1
- package/dist/esm/google/protobuf/duration_pb.js +4 -2
- package/dist/esm/google/protobuf/empty_pb.js +2 -1
- package/dist/esm/google/protobuf/field_mask_pb.js +2 -1
- package/dist/esm/google/protobuf/source_context_pb.js +2 -1
- package/dist/esm/google/protobuf/struct_pb.js +6 -2
- package/dist/esm/google/protobuf/timestamp_pb.js +3 -1
- package/dist/esm/google/protobuf/type_pb.js +5 -1
- package/dist/esm/google/protobuf/wrappers_pb.js +4 -1
- package/dist/esm/index.js +25 -4
- package/dist/esm/message.js +2 -1
- package/dist/esm/private/binary-format-common.js +4 -3
- package/dist/esm/private/binary-format-proto2.js +3 -6
- package/dist/esm/private/binary-format-proto3.js +2 -5
- package/dist/esm/private/enum.js +1 -1
- package/dist/esm/private/json-format-common.js +6 -5
- package/dist/esm/private/message-type.js +2 -1
- package/dist/esm/proto-int64.js +1 -1
- package/dist/esm/proto2.js +6 -8
- package/dist/esm/proto3.js +9 -12
- package/dist/esm/type-registry.js +58 -13
- package/dist/types/google/protobuf/any_pb.d.ts +6 -2
- package/dist/types/google/protobuf/api_pb.d.ts +5 -2
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +5 -2
- package/dist/types/google/protobuf/descriptor_pb.d.ts +5 -2
- package/dist/types/google/protobuf/duration_pb.d.ts +5 -2
- package/dist/types/google/protobuf/empty_pb.d.ts +5 -2
- package/dist/types/google/protobuf/field_mask_pb.d.ts +5 -2
- package/dist/types/google/protobuf/source_context_pb.d.ts +5 -2
- package/dist/types/google/protobuf/struct_pb.d.ts +5 -2
- package/dist/types/google/protobuf/timestamp_pb.d.ts +5 -2
- package/dist/types/google/protobuf/type_pb.d.ts +5 -2
- package/dist/types/google/protobuf/wrappers_pb.d.ts +5 -2
- package/dist/types/index.d.ts +31 -2
- package/dist/types/type-registry.d.ts +35 -2
- package/package.json +3 -3
- package/dist/cjs/index-runtime.js +0 -42
- package/dist/cjs/index-wkt.js +0 -42
- package/dist/esm/index-runtime.js +0 -25
- package/dist/esm/index-wkt.js +0 -26
- package/dist/types/index-runtime.d.ts +0 -19
- package/dist/types/index-wkt.d.ts +0 -12
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.Duration = void 0;
|
|
17
|
-
const
|
|
17
|
+
const message_js_1 = require("../../message.js");
|
|
18
|
+
const proto_int64_js_1 = require("../../proto-int64.js");
|
|
19
|
+
const proto3_js_1 = require("../../proto3.js");
|
|
18
20
|
/**
|
|
19
21
|
* A Duration represents a signed, fixed-length span of time represented
|
|
20
22
|
* as a count of seconds and fractions of seconds at nanosecond
|
|
@@ -79,7 +81,7 @@ const index_runtime_js_1 = require("../../index-runtime.js");
|
|
|
79
81
|
*
|
|
80
82
|
* @generated from message google.protobuf.Duration
|
|
81
83
|
*/
|
|
82
|
-
class Duration extends
|
|
84
|
+
class Duration extends message_js_1.Message {
|
|
83
85
|
constructor(data) {
|
|
84
86
|
super();
|
|
85
87
|
/**
|
|
@@ -89,7 +91,7 @@ class Duration extends index_runtime_js_1.Message {
|
|
|
89
91
|
*
|
|
90
92
|
* @generated from field: int64 seconds = 1;
|
|
91
93
|
*/
|
|
92
|
-
this.seconds =
|
|
94
|
+
this.seconds = proto_int64_js_1.protoInt64.zero;
|
|
93
95
|
/**
|
|
94
96
|
* Signed fractions of a second at nanosecond resolution of the span
|
|
95
97
|
* of time. Durations less than one second are represented with a 0
|
|
@@ -101,25 +103,25 @@ class Duration extends index_runtime_js_1.Message {
|
|
|
101
103
|
* @generated from field: int32 nanos = 2;
|
|
102
104
|
*/
|
|
103
105
|
this.nanos = 0;
|
|
104
|
-
|
|
106
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
105
107
|
}
|
|
106
108
|
fromJson(json, options) {
|
|
107
109
|
if (typeof json !== "string") {
|
|
108
|
-
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${
|
|
110
|
+
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
|
|
109
111
|
}
|
|
110
112
|
const match = json.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);
|
|
111
113
|
if (match === null) {
|
|
112
|
-
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${
|
|
114
|
+
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
|
|
113
115
|
}
|
|
114
116
|
const longSeconds = Number(match[1]);
|
|
115
117
|
if (longSeconds > 315576000000 || longSeconds < -315576000000) {
|
|
116
|
-
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${
|
|
118
|
+
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
|
|
117
119
|
}
|
|
118
|
-
this.seconds =
|
|
120
|
+
this.seconds = proto_int64_js_1.protoInt64.parse(longSeconds);
|
|
119
121
|
if (typeof match[2] == "string") {
|
|
120
122
|
const nanosStr = match[2] + "0".repeat(9 - match[2].length);
|
|
121
123
|
this.nanos = parseInt(nanosStr);
|
|
122
|
-
if (longSeconds <
|
|
124
|
+
if (longSeconds < proto_int64_js_1.protoInt64.zero) {
|
|
123
125
|
this.nanos = -this.nanos;
|
|
124
126
|
}
|
|
125
127
|
}
|
|
@@ -153,13 +155,13 @@ class Duration extends index_runtime_js_1.Message {
|
|
|
153
155
|
return new Duration().fromJsonString(jsonString, options);
|
|
154
156
|
}
|
|
155
157
|
static equals(a, b) {
|
|
156
|
-
return
|
|
158
|
+
return proto3_js_1.proto3.util.equals(Duration, a, b);
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
exports.Duration = Duration;
|
|
160
|
-
Duration.runtime =
|
|
162
|
+
Duration.runtime = proto3_js_1.proto3;
|
|
161
163
|
Duration.typeName = "google.protobuf.Duration";
|
|
162
|
-
Duration.fields =
|
|
164
|
+
Duration.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
163
165
|
{ no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
|
|
164
166
|
{ no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
165
167
|
]);
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.Empty = void 0;
|
|
17
|
-
const
|
|
17
|
+
const message_js_1 = require("../../message.js");
|
|
18
|
+
const proto3_js_1 = require("../../proto3.js");
|
|
18
19
|
/**
|
|
19
20
|
* A generic empty message that you can re-use to avoid defining duplicated
|
|
20
21
|
* empty messages in your APIs. A typical example is to use it as the request
|
|
@@ -28,10 +29,10 @@ const index_runtime_js_1 = require("../../index-runtime.js");
|
|
|
28
29
|
*
|
|
29
30
|
* @generated from message google.protobuf.Empty
|
|
30
31
|
*/
|
|
31
|
-
class Empty extends
|
|
32
|
+
class Empty extends message_js_1.Message {
|
|
32
33
|
constructor(data) {
|
|
33
34
|
super();
|
|
34
|
-
|
|
35
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
35
36
|
}
|
|
36
37
|
static fromBinary(bytes, options) {
|
|
37
38
|
return new Empty().fromBinary(bytes, options);
|
|
@@ -43,10 +44,10 @@ class Empty extends index_runtime_js_1.Message {
|
|
|
43
44
|
return new Empty().fromJsonString(jsonString, options);
|
|
44
45
|
}
|
|
45
46
|
static equals(a, b) {
|
|
46
|
-
return
|
|
47
|
+
return proto3_js_1.proto3.util.equals(Empty, a, b);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
exports.Empty = Empty;
|
|
50
|
-
Empty.runtime =
|
|
51
|
+
Empty.runtime = proto3_js_1.proto3;
|
|
51
52
|
Empty.typeName = "google.protobuf.Empty";
|
|
52
|
-
Empty.fields =
|
|
53
|
+
Empty.fields = proto3_js_1.proto3.util.newFieldList(() => []);
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.FieldMask = void 0;
|
|
17
|
-
const
|
|
17
|
+
const message_js_1 = require("../../message.js");
|
|
18
|
+
const proto3_js_1 = require("../../proto3.js");
|
|
18
19
|
/**
|
|
19
20
|
* `FieldMask` represents a set of symbolic field paths, for example:
|
|
20
21
|
*
|
|
@@ -218,7 +219,7 @@ const index_runtime_js_1 = require("../../index-runtime.js");
|
|
|
218
219
|
*
|
|
219
220
|
* @generated from message google.protobuf.FieldMask
|
|
220
221
|
*/
|
|
221
|
-
class FieldMask extends
|
|
222
|
+
class FieldMask extends message_js_1.Message {
|
|
222
223
|
constructor(data) {
|
|
223
224
|
super();
|
|
224
225
|
/**
|
|
@@ -227,7 +228,7 @@ class FieldMask extends index_runtime_js_1.Message {
|
|
|
227
228
|
* @generated from field: repeated string paths = 1;
|
|
228
229
|
*/
|
|
229
230
|
this.paths = [];
|
|
230
|
-
|
|
231
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
231
232
|
}
|
|
232
233
|
toJson(options) {
|
|
233
234
|
// Converts snake_case to protoCamelCase according to the convention
|
|
@@ -274,7 +275,7 @@ class FieldMask extends index_runtime_js_1.Message {
|
|
|
274
275
|
}
|
|
275
276
|
fromJson(json, options) {
|
|
276
277
|
if (typeof json !== "string") {
|
|
277
|
-
throw new Error("cannot decode google.protobuf.FieldMask from JSON: " +
|
|
278
|
+
throw new Error("cannot decode google.protobuf.FieldMask from JSON: " + proto3_js_1.proto3.json.debug(json));
|
|
278
279
|
}
|
|
279
280
|
if (json === "") {
|
|
280
281
|
return this;
|
|
@@ -299,12 +300,12 @@ class FieldMask extends index_runtime_js_1.Message {
|
|
|
299
300
|
return new FieldMask().fromJsonString(jsonString, options);
|
|
300
301
|
}
|
|
301
302
|
static equals(a, b) {
|
|
302
|
-
return
|
|
303
|
+
return proto3_js_1.proto3.util.equals(FieldMask, a, b);
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
exports.FieldMask = FieldMask;
|
|
306
|
-
FieldMask.runtime =
|
|
307
|
+
FieldMask.runtime = proto3_js_1.proto3;
|
|
307
308
|
FieldMask.typeName = "google.protobuf.FieldMask";
|
|
308
|
-
FieldMask.fields =
|
|
309
|
+
FieldMask.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
309
310
|
{ no: 1, name: "paths", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
310
311
|
]);
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.SourceContext = void 0;
|
|
17
|
-
const
|
|
17
|
+
const message_js_1 = require("../../message.js");
|
|
18
|
+
const proto3_js_1 = require("../../proto3.js");
|
|
18
19
|
/**
|
|
19
20
|
* `SourceContext` represents information about the source of a
|
|
20
21
|
* protobuf element, like the file in which it is defined.
|
|
21
22
|
*
|
|
22
23
|
* @generated from message google.protobuf.SourceContext
|
|
23
24
|
*/
|
|
24
|
-
class SourceContext extends
|
|
25
|
+
class SourceContext extends message_js_1.Message {
|
|
25
26
|
constructor(data) {
|
|
26
27
|
super();
|
|
27
28
|
/**
|
|
@@ -31,7 +32,7 @@ class SourceContext extends index_runtime_js_1.Message {
|
|
|
31
32
|
* @generated from field: string file_name = 1;
|
|
32
33
|
*/
|
|
33
34
|
this.fileName = "";
|
|
34
|
-
|
|
35
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
35
36
|
}
|
|
36
37
|
static fromBinary(bytes, options) {
|
|
37
38
|
return new SourceContext().fromBinary(bytes, options);
|
|
@@ -43,12 +44,12 @@ class SourceContext extends index_runtime_js_1.Message {
|
|
|
43
44
|
return new SourceContext().fromJsonString(jsonString, options);
|
|
44
45
|
}
|
|
45
46
|
static equals(a, b) {
|
|
46
|
-
return
|
|
47
|
+
return proto3_js_1.proto3.util.equals(SourceContext, a, b);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
exports.SourceContext = SourceContext;
|
|
50
|
-
SourceContext.runtime =
|
|
51
|
+
SourceContext.runtime = proto3_js_1.proto3;
|
|
51
52
|
SourceContext.typeName = "google.protobuf.SourceContext";
|
|
52
|
-
SourceContext.fields =
|
|
53
|
+
SourceContext.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
53
54
|
{ no: 1, name: "file_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
54
55
|
]);
|
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
|
|
17
|
-
|
|
17
|
+
// @generated by protoc-gen-es v0.0.7 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
18
|
+
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
|
|
19
|
+
/* eslint-disable */
|
|
20
|
+
const proto3_js_1 = require("../../proto3.js");
|
|
21
|
+
const message_js_1 = require("../../message.js");
|
|
18
22
|
/**
|
|
19
23
|
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
20
24
|
* `Value` type union.
|
|
@@ -33,7 +37,7 @@ var NullValue;
|
|
|
33
37
|
NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
|
|
34
38
|
})(NullValue = exports.NullValue || (exports.NullValue = {}));
|
|
35
39
|
// Retrieve enum metadata with: proto3.getEnumType(NullValue)
|
|
36
|
-
|
|
40
|
+
proto3_js_1.proto3.util.setEnumType(NullValue, "google.protobuf.NullValue", [
|
|
37
41
|
{ no: 0, name: "NULL_VALUE" },
|
|
38
42
|
]);
|
|
39
43
|
/**
|
|
@@ -48,7 +52,7 @@ index_runtime_js_1.proto3.util.setEnumType(NullValue, "google.protobuf.NullValue
|
|
|
48
52
|
*
|
|
49
53
|
* @generated from message google.protobuf.Struct
|
|
50
54
|
*/
|
|
51
|
-
class Struct extends
|
|
55
|
+
class Struct extends message_js_1.Message {
|
|
52
56
|
constructor(data) {
|
|
53
57
|
super();
|
|
54
58
|
/**
|
|
@@ -57,7 +61,7 @@ class Struct extends index_runtime_js_1.Message {
|
|
|
57
61
|
* @generated from field: map<string, google.protobuf.Value> fields = 1;
|
|
58
62
|
*/
|
|
59
63
|
this.fields = {};
|
|
60
|
-
|
|
64
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
61
65
|
}
|
|
62
66
|
toJson(options) {
|
|
63
67
|
const json = {};
|
|
@@ -68,7 +72,7 @@ class Struct extends index_runtime_js_1.Message {
|
|
|
68
72
|
}
|
|
69
73
|
fromJson(json, options) {
|
|
70
74
|
if (typeof json != "object" || json == null || Array.isArray(json)) {
|
|
71
|
-
throw new Error("cannot decode google.protobuf.Struct from JSON " +
|
|
75
|
+
throw new Error("cannot decode google.protobuf.Struct from JSON " + proto3_js_1.proto3.json.debug(json));
|
|
72
76
|
}
|
|
73
77
|
for (const [k, v] of Object.entries(json)) {
|
|
74
78
|
this.fields[k] = Value.fromJson(v);
|
|
@@ -85,13 +89,13 @@ class Struct extends index_runtime_js_1.Message {
|
|
|
85
89
|
return new Struct().fromJsonString(jsonString, options);
|
|
86
90
|
}
|
|
87
91
|
static equals(a, b) {
|
|
88
|
-
return
|
|
92
|
+
return proto3_js_1.proto3.util.equals(Struct, a, b);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
exports.Struct = Struct;
|
|
92
|
-
Struct.runtime =
|
|
96
|
+
Struct.runtime = proto3_js_1.proto3;
|
|
93
97
|
Struct.typeName = "google.protobuf.Struct";
|
|
94
|
-
Struct.fields =
|
|
98
|
+
Struct.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
95
99
|
{ no: 1, name: "fields", kind: "map", K: 9 /* ScalarType.STRING */, V: { kind: "message", T: Value } },
|
|
96
100
|
]);
|
|
97
101
|
/**
|
|
@@ -104,7 +108,7 @@ Struct.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
|
104
108
|
*
|
|
105
109
|
* @generated from message google.protobuf.Value
|
|
106
110
|
*/
|
|
107
|
-
class Value extends
|
|
111
|
+
class Value extends message_js_1.Message {
|
|
108
112
|
constructor(data) {
|
|
109
113
|
super();
|
|
110
114
|
/**
|
|
@@ -113,7 +117,7 @@ class Value extends index_runtime_js_1.Message {
|
|
|
113
117
|
* @generated from oneof google.protobuf.Value.kind
|
|
114
118
|
*/
|
|
115
119
|
this.kind = { case: undefined };
|
|
116
|
-
|
|
120
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
117
121
|
}
|
|
118
122
|
toJson(options) {
|
|
119
123
|
switch (this.kind.case) {
|
|
@@ -125,7 +129,7 @@ class Value extends index_runtime_js_1.Message {
|
|
|
125
129
|
return this.kind.value;
|
|
126
130
|
case "structValue":
|
|
127
131
|
case "listValue":
|
|
128
|
-
return this.kind.value.toJson({
|
|
132
|
+
return this.kind.value.toJson(Object.assign(Object.assign({}, options), { emitDefaultValues: true }));
|
|
129
133
|
}
|
|
130
134
|
throw new Error("google.protobuf.Value must have a value");
|
|
131
135
|
}
|
|
@@ -152,7 +156,7 @@ class Value extends index_runtime_js_1.Message {
|
|
|
152
156
|
}
|
|
153
157
|
break;
|
|
154
158
|
default:
|
|
155
|
-
throw new Error("cannot decode google.protobuf.Value from JSON " +
|
|
159
|
+
throw new Error("cannot decode google.protobuf.Value from JSON " + proto3_js_1.proto3.json.debug(json));
|
|
156
160
|
}
|
|
157
161
|
return this;
|
|
158
162
|
}
|
|
@@ -166,14 +170,14 @@ class Value extends index_runtime_js_1.Message {
|
|
|
166
170
|
return new Value().fromJsonString(jsonString, options);
|
|
167
171
|
}
|
|
168
172
|
static equals(a, b) {
|
|
169
|
-
return
|
|
173
|
+
return proto3_js_1.proto3.util.equals(Value, a, b);
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
176
|
exports.Value = Value;
|
|
173
|
-
Value.runtime =
|
|
177
|
+
Value.runtime = proto3_js_1.proto3;
|
|
174
178
|
Value.typeName = "google.protobuf.Value";
|
|
175
|
-
Value.fields =
|
|
176
|
-
{ no: 1, name: "null_value", kind: "enum", T:
|
|
179
|
+
Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
180
|
+
{ no: 1, name: "null_value", kind: "enum", T: proto3_js_1.proto3.getEnumType(NullValue), oneof: "kind" },
|
|
177
181
|
{ no: 2, name: "number_value", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, oneof: "kind" },
|
|
178
182
|
{ no: 3, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "kind" },
|
|
179
183
|
{ no: 4, name: "bool_value", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "kind" },
|
|
@@ -187,7 +191,7 @@ Value.fields = index_runtime_js_1.proto3.util.newFieldList(() => [
|
|
|
187
191
|
*
|
|
188
192
|
* @generated from message google.protobuf.ListValue
|
|
189
193
|
*/
|
|
190
|
-
class ListValue extends
|
|
194
|
+
class ListValue extends message_js_1.Message {
|
|
191
195
|
constructor(data) {
|
|
192
196
|
super();
|
|
193
197
|
/**
|
|
@@ -196,14 +200,14 @@ class ListValue extends index_runtime_js_1.Message {
|
|
|
196
200
|
* @generated from field: repeated google.protobuf.Value values = 1;
|
|
197
201
|
*/
|
|
198
202
|
this.values = [];
|
|
199
|
-
|
|
203
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
200
204
|
}
|
|
201
205
|
toJson(options) {
|
|
202
206
|
return this.values.map(v => v.toJson());
|
|
203
207
|
}
|
|
204
208
|
fromJson(json, options) {
|
|
205
209
|
if (!Array.isArray(json)) {
|
|
206
|
-
throw new Error("cannot decode google.protobuf.ListValue from JSON " +
|
|
210
|
+
throw new Error("cannot decode google.protobuf.ListValue from JSON " + proto3_js_1.proto3.json.debug(json));
|
|
207
211
|
}
|
|
208
212
|
for (let e of json) {
|
|
209
213
|
this.values.push(Value.fromJson(e));
|
|
@@ -220,12 +224,12 @@ class ListValue extends index_runtime_js_1.Message {
|
|
|
220
224
|
return new ListValue().fromJsonString(jsonString, options);
|
|
221
225
|
}
|
|
222
226
|
static equals(a, b) {
|
|
223
|
-
return
|
|
227
|
+
return proto3_js_1.proto3.util.equals(ListValue, a, b);
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
230
|
exports.ListValue = ListValue;
|
|
227
|
-
ListValue.runtime =
|
|
231
|
+
ListValue.runtime = proto3_js_1.proto3;
|
|
228
232
|
ListValue.typeName = "google.protobuf.ListValue";
|
|
229
|
-
ListValue.fields =
|
|
233
|
+
ListValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
230
234
|
{ no: 1, name: "values", kind: "message", T: Value, repeated: true },
|
|
231
235
|
]);
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.Timestamp = void 0;
|
|
17
|
-
const
|
|
17
|
+
const message_js_1 = require("../../message.js");
|
|
18
|
+
const proto_int64_js_1 = require("../../proto-int64.js");
|
|
19
|
+
const proto3_js_1 = require("../../proto3.js");
|
|
18
20
|
/**
|
|
19
21
|
* A Timestamp represents a point in time independent of any time zone or local
|
|
20
22
|
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
@@ -112,7 +114,7 @@ const index_runtime_js_1 = require("../../index-runtime.js");
|
|
|
112
114
|
*
|
|
113
115
|
* @generated from message google.protobuf.Timestamp
|
|
114
116
|
*/
|
|
115
|
-
class Timestamp extends
|
|
117
|
+
class Timestamp extends message_js_1.Message {
|
|
116
118
|
constructor(data) {
|
|
117
119
|
super();
|
|
118
120
|
/**
|
|
@@ -122,7 +124,7 @@ class Timestamp extends index_runtime_js_1.Message {
|
|
|
122
124
|
*
|
|
123
125
|
* @generated from field: int64 seconds = 1;
|
|
124
126
|
*/
|
|
125
|
-
this.seconds =
|
|
127
|
+
this.seconds = proto_int64_js_1.protoInt64.zero;
|
|
126
128
|
/**
|
|
127
129
|
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
128
130
|
* second values with fractions must still have non-negative nanos values
|
|
@@ -132,11 +134,11 @@ class Timestamp extends index_runtime_js_1.Message {
|
|
|
132
134
|
* @generated from field: int32 nanos = 2;
|
|
133
135
|
*/
|
|
134
136
|
this.nanos = 0;
|
|
135
|
-
|
|
137
|
+
proto3_js_1.proto3.util.initPartial(data, this);
|
|
136
138
|
}
|
|
137
139
|
fromJson(json, options) {
|
|
138
140
|
if (typeof json !== "string") {
|
|
139
|
-
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: ${
|
|
141
|
+
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
|
|
140
142
|
}
|
|
141
143
|
const matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
|
|
142
144
|
if (!matches) {
|
|
@@ -149,7 +151,7 @@ class Timestamp extends index_runtime_js_1.Message {
|
|
|
149
151
|
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
|
|
150
152
|
throw new Error(`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
|
|
151
153
|
}
|
|
152
|
-
this.seconds =
|
|
154
|
+
this.seconds = proto_int64_js_1.protoInt64.parse(ms / 1000);
|
|
153
155
|
this.nanos = 0;
|
|
154
156
|
if (matches[7]) {
|
|
155
157
|
this.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
|
|
@@ -188,7 +190,7 @@ class Timestamp extends index_runtime_js_1.Message {
|
|
|
188
190
|
static fromDate(date) {
|
|
189
191
|
const ms = date.getTime();
|
|
190
192
|
return new Timestamp({
|
|
191
|
-
seconds:
|
|
193
|
+
seconds: proto_int64_js_1.protoInt64.parse(Math.floor(ms / 1000)),
|
|
192
194
|
nanos: (ms % 1000) * 1000000,
|
|
193
195
|
});
|
|
194
196
|
}
|
|
@@ -202,13 +204,13 @@ class Timestamp extends index_runtime_js_1.Message {
|
|
|
202
204
|
return new Timestamp().fromJsonString(jsonString, options);
|
|
203
205
|
}
|
|
204
206
|
static equals(a, b) {
|
|
205
|
-
return
|
|
207
|
+
return proto3_js_1.proto3.util.equals(Timestamp, a, b);
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
exports.Timestamp = Timestamp;
|
|
209
|
-
Timestamp.runtime =
|
|
211
|
+
Timestamp.runtime = proto3_js_1.proto3;
|
|
210
212
|
Timestamp.typeName = "google.protobuf.Timestamp";
|
|
211
|
-
Timestamp.fields =
|
|
213
|
+
Timestamp.fields = proto3_js_1.proto3.util.newFieldList(() => [
|
|
212
214
|
{ no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
|
|
213
215
|
{ no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
214
216
|
]);
|