@bufbuild/protobuf 0.0.1-alpha.1 → 0.0.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.
- package/README.md +21 -1
- package/dist/cjs/binary-encoding.js +402 -410
- package/dist/cjs/descriptor-registry.js +407 -449
- package/dist/cjs/descriptor-set.js +416 -513
- package/dist/cjs/field.js +30 -30
- package/dist/cjs/google/protobuf/any_pb.js +122 -140
- package/dist/cjs/google/protobuf/api_pb.js +177 -224
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +125 -227
- package/dist/cjs/google/protobuf/descriptor_pb.js +1029 -1888
- package/dist/cjs/google/protobuf/duration_pb.js +72 -88
- package/dist/cjs/google/protobuf/empty_pb.js +17 -17
- package/dist/cjs/google/protobuf/field_mask_pb.js +77 -94
- package/dist/cjs/google/protobuf/source_context_pb.js +25 -25
- package/dist/cjs/google/protobuf/struct_pb.js +144 -181
- package/dist/cjs/google/protobuf/timestamp_pb.js +86 -123
- package/dist/cjs/google/protobuf/type_pb.js +406 -462
- package/dist/cjs/google/protobuf/wrappers_pb.js +407 -470
- package/dist/cjs/index.js +24 -122
- package/dist/cjs/message.js +81 -89
- package/dist/cjs/private/assert.js +20 -26
- package/dist/cjs/private/base64.js +79 -78
- package/dist/cjs/private/binary-format-common.js +195 -208
- package/dist/cjs/private/binary-format-proto2.js +75 -109
- package/dist/cjs/private/binary-format-proto3.js +57 -90
- package/dist/cjs/private/enum.js +38 -43
- package/dist/cjs/private/field-list.js +51 -50
- package/dist/cjs/private/field-wrapper.js +8 -10
- package/dist/cjs/private/field.js +22 -25
- package/dist/cjs/private/goog-varint.js +275 -0
- package/dist/cjs/private/json-format-common.js +414 -440
- package/dist/cjs/private/json-format-proto2.js +78 -89
- package/dist/cjs/private/json-format-proto3.js +69 -93
- package/dist/cjs/private/message-type.js +26 -27
- package/dist/cjs/private/names.js +58 -62
- package/dist/cjs/private/proto-runtime.js +11 -16
- package/dist/cjs/private/scalars.js +100 -103
- package/dist/cjs/private/util-common.js +180 -210
- package/dist/cjs/proto-int64.js +111 -112
- package/dist/cjs/proto2.js +50 -63
- package/dist/cjs/proto3.js +61 -74
- package/dist/cjs/service-type.js +14 -17
- package/dist/cjs/type-registry.js +33 -31
- package/dist/esm/binary-encoding.js +401 -414
- package/dist/esm/descriptor-registry.js +409 -458
- package/dist/esm/descriptor-set.js +417 -478
- package/dist/esm/field.js +29 -29
- package/dist/esm/google/protobuf/any_pb.js +122 -140
- package/dist/esm/google/protobuf/api_pb.js +177 -197
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +123 -216
- package/dist/esm/google/protobuf/descriptor_pb.js +1013 -1804
- package/dist/esm/google/protobuf/duration_pb.js +72 -88
- package/dist/esm/google/protobuf/empty_pb.js +17 -17
- package/dist/esm/google/protobuf/field_mask_pb.js +77 -94
- package/dist/esm/google/protobuf/source_context_pb.js +25 -25
- package/dist/esm/google/protobuf/struct_pb.js +143 -180
- package/dist/esm/google/protobuf/timestamp_pb.js +86 -123
- package/dist/esm/google/protobuf/type_pb.js +401 -421
- package/dist/esm/google/protobuf/wrappers_pb.js +406 -397
- package/dist/esm/index.js +1 -1
- package/dist/esm/message.js +81 -89
- package/dist/esm/private/assert.js +19 -21
- package/dist/esm/private/base64.js +79 -78
- package/dist/esm/private/binary-format-common.js +196 -207
- package/dist/esm/private/binary-format-proto2.js +76 -81
- package/dist/esm/private/binary-format-proto3.js +58 -67
- package/dist/esm/private/enum.js +38 -43
- package/dist/esm/private/field-list.js +51 -50
- package/dist/esm/private/field-wrapper.js +8 -10
- package/dist/esm/private/field.js +22 -22
- package/dist/esm/private/goog-varint.js +266 -0
- package/dist/esm/private/json-format-common.js +414 -435
- package/dist/esm/private/json-format-proto2.js +76 -81
- package/dist/esm/private/json-format-proto3.js +66 -80
- package/dist/esm/private/message-type.js +27 -28
- package/dist/esm/private/names.js +57 -57
- package/dist/esm/private/proto-runtime.js +11 -11
- package/dist/esm/private/scalars.js +99 -99
- package/dist/esm/private/util-common.js +180 -192
- package/dist/esm/proto-int64.js +111 -112
- package/dist/esm/proto2.js +50 -57
- package/dist/esm/proto3.js +61 -68
- package/dist/esm/service-type.js +12 -12
- package/dist/esm/type-registry.js +33 -31
- package/dist/types/binary-encoding.d.ts +398 -398
- package/dist/types/binary-format.d.ts +69 -91
- package/dist/types/descriptor-registry.d.ts +23 -29
- package/dist/types/descriptor-set.d.ts +107 -128
- package/dist/types/enum.d.ts +21 -21
- package/dist/types/field-list.d.ts +21 -21
- package/dist/types/field.d.ts +191 -231
- package/dist/types/google/protobuf/any_pb.d.ts +56 -77
- package/dist/types/google/protobuf/api_pb.d.ts +144 -187
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +195 -257
- package/dist/types/google/protobuf/descriptor_pb.d.ts +1360 -1737
- package/dist/types/google/protobuf/duration_pb.d.ts +30 -50
- package/dist/types/google/protobuf/empty_pb.d.ts +9 -28
- package/dist/types/google/protobuf/field_mask_pb.d.ts +17 -37
- package/dist/types/google/protobuf/source_context_pb.d.ts +16 -35
- package/dist/types/google/protobuf/struct_pb.d.ts +64 -115
- package/dist/types/google/protobuf/timestamp_pb.d.ts +31 -51
- package/dist/types/google/protobuf/type_pb.d.ts +355 -422
- package/dist/types/google/protobuf/wrappers_pb.d.ts +181 -297
- package/dist/types/index.d.ts +4 -27
- package/dist/types/json-format.d.ts +70 -89
- package/dist/types/message-type.d.ts +38 -46
- package/dist/types/message.d.ts +73 -99
- package/dist/types/private/assert.d.ts +1 -4
- package/dist/types/private/binary-format-common.d.ts +6 -32
- package/dist/types/private/enum.d.ts +4 -11
- package/dist/types/private/field-list.d.ts +14 -21
- package/dist/types/private/field-wrapper.d.ts +5 -11
- package/dist/types/private/field.d.ts +12 -12
- package/dist/types/{google/varint.d.ts → private/goog-varint.d.ts} +6 -13
- package/dist/types/private/json-format-common.d.ts +5 -27
- package/dist/types/private/message-type.d.ts +3 -8
- package/dist/types/private/names.d.ts +1 -4
- package/dist/types/private/options-map.d.ts +1 -1
- package/dist/types/private/proto-runtime.d.ts +29 -42
- package/dist/types/private/scalars.d.ts +5 -12
- package/dist/types/private/util-common.d.ts +1 -4
- package/dist/types/private/util.d.ts +29 -41
- package/dist/types/proto-int64.d.ts +42 -42
- package/dist/types/service-type.d.ts +37 -57
- package/dist/types/type-registry.d.ts +13 -15
- package/package.json +2 -2
- package/dist/cjs/google/varint.js +0 -280
- package/dist/esm/google/varint.js +0 -265
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// @generated by protoc-gen-es v0.0.1
|
|
2
|
+
// @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
|
|
3
3
|
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
|
|
4
4
|
//
|
|
5
5
|
// Protocol Buffers - Google's data interchange format
|
|
@@ -42,16 +42,16 @@ import { Message, proto3 } from "../../index.js";
|
|
|
42
42
|
*/
|
|
43
43
|
export var NullValue;
|
|
44
44
|
(function (NullValue) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Null value.
|
|
47
|
+
*
|
|
48
|
+
* @generated from enum value: NULL_VALUE = 0;
|
|
49
|
+
*/
|
|
50
|
+
NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
|
|
51
51
|
})(NullValue || (NullValue = {}));
|
|
52
52
|
// Retrieve enum metadata with: proto3.getEnumType(NullValue)
|
|
53
53
|
proto3.util.setEnumType(NullValue, "google.protobuf.NullValue", [
|
|
54
|
-
|
|
54
|
+
{ no: 0, name: "NULL_VALUE" },
|
|
55
55
|
]);
|
|
56
56
|
/**
|
|
57
57
|
* `Struct` represents a structured data value, consisting of fields
|
|
@@ -66,58 +66,49 @@ proto3.util.setEnumType(NullValue, "google.protobuf.NullValue", [
|
|
|
66
66
|
* @generated from message google.protobuf.Struct
|
|
67
67
|
*/
|
|
68
68
|
export class Struct extends Message {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
constructor(data) {
|
|
70
|
+
super();
|
|
71
|
+
/**
|
|
72
|
+
* Unordered map of dynamically typed values.
|
|
73
|
+
*
|
|
74
|
+
* @generated from field: map<string, google.protobuf.Value> fields = 1;
|
|
75
|
+
*/
|
|
76
|
+
this.fields = {};
|
|
77
|
+
proto3.util.initPartial(data, this);
|
|
78
|
+
}
|
|
79
|
+
toJson(options) {
|
|
80
|
+
const json = {};
|
|
81
|
+
for (const [k, v] of Object.entries(this.fields)) {
|
|
82
|
+
json[k] = v.toJson(options);
|
|
83
|
+
}
|
|
84
|
+
return json;
|
|
83
85
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
fromJson(json, options) {
|
|
87
|
+
if (typeof json != "object" || json == null || Array.isArray(json)) {
|
|
88
|
+
throw new Error("cannot decode google.protobuf.Struct from JSON " + proto3.json.debug(json));
|
|
89
|
+
}
|
|
90
|
+
for (const [k, v] of Object.entries(json)) {
|
|
91
|
+
this.fields[k] = Value.fromJson(v);
|
|
92
|
+
}
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
static fromBinary(bytes, options) {
|
|
96
|
+
return new Struct().fromBinary(bytes, options);
|
|
97
|
+
}
|
|
98
|
+
static fromJson(jsonValue, options) {
|
|
99
|
+
return new Struct().fromJson(jsonValue, options);
|
|
92
100
|
}
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
static fromJsonString(jsonString, options) {
|
|
102
|
+
return new Struct().fromJsonString(jsonString, options);
|
|
103
|
+
}
|
|
104
|
+
static equals(a, b) {
|
|
105
|
+
return proto3.util.equals(Struct, a, b);
|
|
95
106
|
}
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
static fromBinary(bytes, options) {
|
|
99
|
-
return new Struct().fromBinary(bytes, options);
|
|
100
|
-
}
|
|
101
|
-
static fromJson(jsonValue, options) {
|
|
102
|
-
return new Struct().fromJson(jsonValue, options);
|
|
103
|
-
}
|
|
104
|
-
static fromJsonString(jsonString, options) {
|
|
105
|
-
return new Struct().fromJsonString(jsonString, options);
|
|
106
|
-
}
|
|
107
|
-
static equals(a, b) {
|
|
108
|
-
return proto3.util.equals(Struct, a, b);
|
|
109
|
-
}
|
|
110
107
|
}
|
|
111
108
|
Struct.runtime = proto3;
|
|
112
109
|
Struct.typeName = "google.protobuf.Struct";
|
|
113
110
|
Struct.fields = proto3.util.newFieldList(() => [
|
|
114
|
-
|
|
115
|
-
no: 1,
|
|
116
|
-
name: "fields",
|
|
117
|
-
kind: "map",
|
|
118
|
-
K: 9 /* ScalarType.STRING */,
|
|
119
|
-
V: { kind: "message", T: Value },
|
|
120
|
-
},
|
|
111
|
+
{ no: 1, name: "fields", kind: "map", K: 9 /* ScalarType.STRING */, V: { kind: "message", T: Value } },
|
|
121
112
|
]);
|
|
122
113
|
/**
|
|
123
114
|
* `Value` represents a dynamically typed value which can be either
|
|
@@ -130,104 +121,79 @@ Struct.fields = proto3.util.newFieldList(() => [
|
|
|
130
121
|
* @generated from message google.protobuf.Value
|
|
131
122
|
*/
|
|
132
123
|
export class Value extends Message {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
toJson(options) {
|
|
144
|
-
switch (this.kind.case) {
|
|
145
|
-
case "nullValue":
|
|
146
|
-
return null;
|
|
147
|
-
case "boolValue":
|
|
148
|
-
case "numberValue":
|
|
149
|
-
case "stringValue":
|
|
150
|
-
return this.kind.value;
|
|
151
|
-
case "structValue":
|
|
152
|
-
case "listValue":
|
|
153
|
-
return this.kind.value.toJson({ ...options, emitDefaultValues: true });
|
|
124
|
+
constructor(data) {
|
|
125
|
+
super();
|
|
126
|
+
/**
|
|
127
|
+
* The kind of value.
|
|
128
|
+
*
|
|
129
|
+
* @generated from oneof google.protobuf.Value.kind
|
|
130
|
+
*/
|
|
131
|
+
this.kind = { case: undefined };
|
|
132
|
+
proto3.util.initPartial(data, this);
|
|
154
133
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
this.kind = { case: "boolValue", value: json };
|
|
167
|
-
break;
|
|
168
|
-
case "object":
|
|
169
|
-
if (json === null) {
|
|
170
|
-
this.kind = { case: "nullValue", value: NullValue.NULL_VALUE };
|
|
171
|
-
} else if (Array.isArray(json)) {
|
|
172
|
-
this.kind = { case: "listValue", value: ListValue.fromJson(json) };
|
|
173
|
-
} else {
|
|
174
|
-
this.kind = { case: "structValue", value: Struct.fromJson(json) };
|
|
134
|
+
toJson(options) {
|
|
135
|
+
switch (this.kind.case) {
|
|
136
|
+
case "nullValue":
|
|
137
|
+
return null;
|
|
138
|
+
case "boolValue":
|
|
139
|
+
case "numberValue":
|
|
140
|
+
case "stringValue":
|
|
141
|
+
return this.kind.value;
|
|
142
|
+
case "structValue":
|
|
143
|
+
case "listValue":
|
|
144
|
+
return this.kind.value.toJson({ ...options, emitDefaultValues: true });
|
|
175
145
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
146
|
+
throw new Error("google.protobuf.Value must have a value");
|
|
147
|
+
}
|
|
148
|
+
fromJson(json, options) {
|
|
149
|
+
switch (typeof json) {
|
|
150
|
+
case "number":
|
|
151
|
+
this.kind = { case: "numberValue", value: json };
|
|
152
|
+
break;
|
|
153
|
+
case "string":
|
|
154
|
+
this.kind = { case: "stringValue", value: json };
|
|
155
|
+
break;
|
|
156
|
+
case "boolean":
|
|
157
|
+
this.kind = { case: "boolValue", value: json };
|
|
158
|
+
break;
|
|
159
|
+
case "object":
|
|
160
|
+
if (json === null) {
|
|
161
|
+
this.kind = { case: "nullValue", value: NullValue.NULL_VALUE };
|
|
162
|
+
}
|
|
163
|
+
else if (Array.isArray(json)) {
|
|
164
|
+
this.kind = { case: "listValue", value: ListValue.fromJson(json) };
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
this.kind = { case: "structValue", value: Struct.fromJson(json) };
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
throw new Error("cannot decode google.protobuf.Value from JSON " + proto3.json.debug(json));
|
|
172
|
+
}
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
static fromBinary(bytes, options) {
|
|
176
|
+
return new Value().fromBinary(bytes, options);
|
|
177
|
+
}
|
|
178
|
+
static fromJson(jsonValue, options) {
|
|
179
|
+
return new Value().fromJson(jsonValue, options);
|
|
180
|
+
}
|
|
181
|
+
static fromJsonString(jsonString, options) {
|
|
182
|
+
return new Value().fromJsonString(jsonString, options);
|
|
183
|
+
}
|
|
184
|
+
static equals(a, b) {
|
|
185
|
+
return proto3.util.equals(Value, a, b);
|
|
182
186
|
}
|
|
183
|
-
return this;
|
|
184
|
-
}
|
|
185
|
-
static fromBinary(bytes, options) {
|
|
186
|
-
return new Value().fromBinary(bytes, options);
|
|
187
|
-
}
|
|
188
|
-
static fromJson(jsonValue, options) {
|
|
189
|
-
return new Value().fromJson(jsonValue, options);
|
|
190
|
-
}
|
|
191
|
-
static fromJsonString(jsonString, options) {
|
|
192
|
-
return new Value().fromJsonString(jsonString, options);
|
|
193
|
-
}
|
|
194
|
-
static equals(a, b) {
|
|
195
|
-
return proto3.util.equals(Value, a, b);
|
|
196
|
-
}
|
|
197
187
|
}
|
|
198
188
|
Value.runtime = proto3;
|
|
199
189
|
Value.typeName = "google.protobuf.Value";
|
|
200
190
|
Value.fields = proto3.util.newFieldList(() => [
|
|
201
|
-
|
|
202
|
-
no: 1,
|
|
203
|
-
name: "
|
|
204
|
-
kind: "
|
|
205
|
-
T:
|
|
206
|
-
oneof: "kind",
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
no: 2,
|
|
210
|
-
name: "number_value",
|
|
211
|
-
kind: "scalar",
|
|
212
|
-
T: 1 /* ScalarType.DOUBLE */,
|
|
213
|
-
oneof: "kind",
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
no: 3,
|
|
217
|
-
name: "string_value",
|
|
218
|
-
kind: "scalar",
|
|
219
|
-
T: 9 /* ScalarType.STRING */,
|
|
220
|
-
oneof: "kind",
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
no: 4,
|
|
224
|
-
name: "bool_value",
|
|
225
|
-
kind: "scalar",
|
|
226
|
-
T: 8 /* ScalarType.BOOL */,
|
|
227
|
-
oneof: "kind",
|
|
228
|
-
},
|
|
229
|
-
{ no: 5, name: "struct_value", kind: "message", T: Struct, oneof: "kind" },
|
|
230
|
-
{ no: 6, name: "list_value", kind: "message", T: ListValue, oneof: "kind" },
|
|
191
|
+
{ no: 1, name: "null_value", kind: "enum", T: proto3.getEnumType(NullValue), oneof: "kind" },
|
|
192
|
+
{ no: 2, name: "number_value", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, oneof: "kind" },
|
|
193
|
+
{ no: 3, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "kind" },
|
|
194
|
+
{ no: 4, name: "bool_value", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "kind" },
|
|
195
|
+
{ no: 5, name: "struct_value", kind: "message", T: Struct, oneof: "kind" },
|
|
196
|
+
{ no: 6, name: "list_value", kind: "message", T: ListValue, oneof: "kind" },
|
|
231
197
|
]);
|
|
232
198
|
/**
|
|
233
199
|
* `ListValue` is a wrapper around a repeated field of values.
|
|
@@ -237,46 +203,43 @@ Value.fields = proto3.util.newFieldList(() => [
|
|
|
237
203
|
* @generated from message google.protobuf.ListValue
|
|
238
204
|
*/
|
|
239
205
|
export class ListValue extends Message {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
206
|
+
constructor(data) {
|
|
207
|
+
super();
|
|
208
|
+
/**
|
|
209
|
+
* Repeated field of dynamically typed values.
|
|
210
|
+
*
|
|
211
|
+
* @generated from field: repeated google.protobuf.Value values = 1;
|
|
212
|
+
*/
|
|
213
|
+
this.values = [];
|
|
214
|
+
proto3.util.initPartial(data, this);
|
|
215
|
+
}
|
|
216
|
+
toJson(options) {
|
|
217
|
+
return this.values.map(v => v.toJson());
|
|
218
|
+
}
|
|
219
|
+
fromJson(json, options) {
|
|
220
|
+
if (!Array.isArray(json)) {
|
|
221
|
+
throw new Error("cannot decode google.protobuf.ListValue from JSON " + proto3.json.debug(json));
|
|
222
|
+
}
|
|
223
|
+
for (let e of json) {
|
|
224
|
+
this.values.push(Value.fromJson(e));
|
|
225
|
+
}
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
static fromBinary(bytes, options) {
|
|
229
|
+
return new ListValue().fromBinary(bytes, options);
|
|
230
|
+
}
|
|
231
|
+
static fromJson(jsonValue, options) {
|
|
232
|
+
return new ListValue().fromJson(jsonValue, options);
|
|
233
|
+
}
|
|
234
|
+
static fromJsonString(jsonString, options) {
|
|
235
|
+
return new ListValue().fromJsonString(jsonString, options);
|
|
259
236
|
}
|
|
260
|
-
|
|
261
|
-
|
|
237
|
+
static equals(a, b) {
|
|
238
|
+
return proto3.util.equals(ListValue, a, b);
|
|
262
239
|
}
|
|
263
|
-
return this;
|
|
264
|
-
}
|
|
265
|
-
static fromBinary(bytes, options) {
|
|
266
|
-
return new ListValue().fromBinary(bytes, options);
|
|
267
|
-
}
|
|
268
|
-
static fromJson(jsonValue, options) {
|
|
269
|
-
return new ListValue().fromJson(jsonValue, options);
|
|
270
|
-
}
|
|
271
|
-
static fromJsonString(jsonString, options) {
|
|
272
|
-
return new ListValue().fromJsonString(jsonString, options);
|
|
273
|
-
}
|
|
274
|
-
static equals(a, b) {
|
|
275
|
-
return proto3.util.equals(ListValue, a, b);
|
|
276
|
-
}
|
|
277
240
|
}
|
|
278
241
|
ListValue.runtime = proto3;
|
|
279
242
|
ListValue.typeName = "google.protobuf.ListValue";
|
|
280
243
|
ListValue.fields = proto3.util.newFieldList(() => [
|
|
281
|
-
|
|
244
|
+
{ no: 1, name: "values", kind: "message", T: Value, repeated: true },
|
|
282
245
|
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// @generated by protoc-gen-es v0.0.1
|
|
2
|
+
// @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
|
|
3
3
|
// @generated from file google/protobuf/timestamp.proto (package google.protobuf, syntax proto3)
|
|
4
4
|
//
|
|
5
5
|
// Protocol Buffers - Google's data interchange format
|
|
@@ -130,138 +130,101 @@ import { Message, proto3, protoInt64 } from "../../index.js";
|
|
|
130
130
|
* @generated from message google.protobuf.Timestamp
|
|
131
131
|
*/
|
|
132
132
|
export class Timestamp extends Message {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
fromJson(json, options) {
|
|
155
|
-
if (typeof json !== "string") {
|
|
156
|
-
throw new Error(
|
|
157
|
-
`cannot decode google.protobuf.Timestamp from JSON: ${proto3.json.debug(
|
|
158
|
-
json
|
|
159
|
-
)}`
|
|
160
|
-
);
|
|
133
|
+
constructor(data) {
|
|
134
|
+
super();
|
|
135
|
+
/**
|
|
136
|
+
* Represents seconds of UTC time since Unix epoch
|
|
137
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
138
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
139
|
+
*
|
|
140
|
+
* @generated from field: int64 seconds = 1;
|
|
141
|
+
*/
|
|
142
|
+
this.seconds = protoInt64.zero;
|
|
143
|
+
/**
|
|
144
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
145
|
+
* second values with fractions must still have non-negative nanos values
|
|
146
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
147
|
+
* inclusive.
|
|
148
|
+
*
|
|
149
|
+
* @generated from field: int32 nanos = 2;
|
|
150
|
+
*/
|
|
151
|
+
this.nanos = 0;
|
|
152
|
+
proto3.util.initPartial(data, this);
|
|
161
153
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
154
|
+
fromJson(json, options) {
|
|
155
|
+
if (typeof json !== "string") {
|
|
156
|
+
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: ${proto3.json.debug(json)}`);
|
|
157
|
+
}
|
|
158
|
+
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]))$/);
|
|
159
|
+
if (!matches) {
|
|
160
|
+
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);
|
|
161
|
+
}
|
|
162
|
+
const ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
|
|
163
|
+
if (Number.isNaN(ms)) {
|
|
164
|
+
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);
|
|
165
|
+
}
|
|
166
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
|
|
167
|
+
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`);
|
|
168
|
+
}
|
|
169
|
+
this.seconds = protoInt64.parse(ms / 1000);
|
|
170
|
+
this.nanos = 0;
|
|
171
|
+
if (matches[7]) {
|
|
172
|
+
this.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
|
|
173
|
+
}
|
|
174
|
+
return this;
|
|
169
175
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"-"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
176
|
+
toJson(options) {
|
|
177
|
+
const ms = Number(this.seconds) * 1000;
|
|
178
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
|
|
179
|
+
throw new Error(`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
|
|
180
|
+
}
|
|
181
|
+
if (this.nanos < 0) {
|
|
182
|
+
throw new Error(`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`);
|
|
183
|
+
}
|
|
184
|
+
let z = "Z";
|
|
185
|
+
if (this.nanos > 0) {
|
|
186
|
+
const nanosStr = (this.nanos + 1000000000).toString().substring(1);
|
|
187
|
+
if (nanosStr.substring(3) === "000000") {
|
|
188
|
+
z = "." + nanosStr.substring(0, 3) + "Z";
|
|
189
|
+
}
|
|
190
|
+
else if (nanosStr.substring(6) === "000") {
|
|
191
|
+
z = "." + nanosStr.substring(0, 6) + "Z";
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
z = "." + nanosStr + "Z";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return new Date(ms).toISOString().replace(".000Z", z);
|
|
188
198
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
ms > Date.parse("9999-12-31T23:59:59Z")
|
|
192
|
-
) {
|
|
193
|
-
throw new Error(
|
|
194
|
-
`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`
|
|
195
|
-
);
|
|
199
|
+
toDate() {
|
|
200
|
+
return new Date(Number(this.seconds) * 1000 + Math.ceil(this.nanos / 1000000));
|
|
196
201
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (matches[7]) {
|
|
200
|
-
this.nanos =
|
|
201
|
-
parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) -
|
|
202
|
-
1000000000;
|
|
202
|
+
static now() {
|
|
203
|
+
return Timestamp.fromDate(new Date());
|
|
203
204
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
ms > Date.parse("9999-12-31T23:59:59Z")
|
|
211
|
-
) {
|
|
212
|
-
throw new Error(
|
|
213
|
-
`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`
|
|
214
|
-
);
|
|
205
|
+
static fromDate(date) {
|
|
206
|
+
const ms = date.getTime();
|
|
207
|
+
return new Timestamp({
|
|
208
|
+
seconds: protoInt64.parse(Math.floor(ms / 1000)),
|
|
209
|
+
nanos: (ms % 1000) * 1000000,
|
|
210
|
+
});
|
|
215
211
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`
|
|
219
|
-
);
|
|
212
|
+
static fromBinary(bytes, options) {
|
|
213
|
+
return new Timestamp().fromBinary(bytes, options);
|
|
220
214
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
z = "." + nanosStr + "Z";
|
|
230
|
-
}
|
|
215
|
+
static fromJson(jsonValue, options) {
|
|
216
|
+
return new Timestamp().fromJson(jsonValue, options);
|
|
217
|
+
}
|
|
218
|
+
static fromJsonString(jsonString, options) {
|
|
219
|
+
return new Timestamp().fromJsonString(jsonString, options);
|
|
220
|
+
}
|
|
221
|
+
static equals(a, b) {
|
|
222
|
+
return proto3.util.equals(Timestamp, a, b);
|
|
231
223
|
}
|
|
232
|
-
return new Date(ms).toISOString().replace(".000Z", z);
|
|
233
|
-
}
|
|
234
|
-
toDate() {
|
|
235
|
-
return new Date(
|
|
236
|
-
Number(this.seconds) * 1000 + Math.ceil(this.nanos / 1000000)
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
static now() {
|
|
240
|
-
return Timestamp.fromDate(new Date());
|
|
241
|
-
}
|
|
242
|
-
static fromDate(date) {
|
|
243
|
-
const ms = date.getTime();
|
|
244
|
-
return new Timestamp({
|
|
245
|
-
seconds: protoInt64.parse(Math.floor(ms / 1000)),
|
|
246
|
-
nanos: (ms % 1000) * 1000000,
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
static fromBinary(bytes, options) {
|
|
250
|
-
return new Timestamp().fromBinary(bytes, options);
|
|
251
|
-
}
|
|
252
|
-
static fromJson(jsonValue, options) {
|
|
253
|
-
return new Timestamp().fromJson(jsonValue, options);
|
|
254
|
-
}
|
|
255
|
-
static fromJsonString(jsonString, options) {
|
|
256
|
-
return new Timestamp().fromJsonString(jsonString, options);
|
|
257
|
-
}
|
|
258
|
-
static equals(a, b) {
|
|
259
|
-
return proto3.util.equals(Timestamp, a, b);
|
|
260
|
-
}
|
|
261
224
|
}
|
|
262
225
|
Timestamp.runtime = proto3;
|
|
263
226
|
Timestamp.typeName = "google.protobuf.Timestamp";
|
|
264
227
|
Timestamp.fields = proto3.util.newFieldList(() => [
|
|
265
|
-
|
|
266
|
-
|
|
228
|
+
{ no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
|
|
229
|
+
{ no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
|
|
267
230
|
]);
|