@milaboratories/pl-drivers 1.6.4 → 1.6.6
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/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2026 -2480
- package/dist/index.mjs.map +1 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +48 -0
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +2 -2
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +13 -5
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +2 -2
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +11 -11
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +4 -4
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +10 -10
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +10 -10
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +25 -25
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts +8 -8
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts +24 -16
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +277 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +5344 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +530 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +82 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +91 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +251 -0
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -0
- package/dist/proto/google/api/http.d.ts +46 -42
- package/dist/proto/google/api/http.d.ts.map +1 -1
- package/dist/proto/google/protobuf/any.d.ts +172 -0
- package/dist/proto/google/protobuf/any.d.ts.map +1 -0
- package/dist/proto/google/protobuf/descriptor.d.ts +1003 -170
- package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -1
- package/dist/proto/google/protobuf/duration.d.ts +2 -3
- package/dist/proto/google/protobuf/duration.d.ts.map +1 -1
- package/dist/proto/google/protobuf/empty.d.ts +27 -0
- package/dist/proto/google/protobuf/empty.d.ts.map +1 -0
- package/dist/proto/google/protobuf/struct.d.ts +179 -0
- package/dist/proto/google/protobuf/struct.d.ts.map +1 -0
- package/dist/proto/google/protobuf/timestamp.d.ts +3 -6
- package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
- package/dist/proto/google/protobuf/wrappers.d.ts +327 -0
- package/dist/proto/google/protobuf/wrappers.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/clients/download.ts +1 -1
- package/src/clients/upload.ts +1 -1
- package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +125 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +25 -40
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +252 -396
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +25 -37
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +341 -453
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +39 -65
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +398 -630
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +126 -194
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +626 -964
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.ts +102 -153
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.ts +741 -1082
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +406 -0
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +14986 -0
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1474 -0
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +181 -0
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +251 -0
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +693 -0
- package/src/proto/google/api/http.ts +336 -492
- package/src/proto/google/protobuf/any.ts +326 -0
- package/src/proto/google/protobuf/descriptor.ts +4383 -4772
- package/src/proto/google/protobuf/duration.ts +122 -169
- package/src/proto/google/protobuf/empty.ts +94 -0
- package/src/proto/google/protobuf/struct.ts +484 -0
- package/src/proto/google/protobuf/timestamp.ts +150 -225
- package/src/proto/google/protobuf/wrappers.ts +785 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protobuf-ts 2.
|
|
1
|
+
// @generated by protobuf-ts 2.11.0 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
|
|
2
2
|
// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
|
|
3
3
|
// tslint:disable
|
|
4
4
|
//
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
33
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
34
|
//
|
|
35
|
-
import type { BinaryWriteOptions } from
|
|
36
|
-
import type { IBinaryWriter } from
|
|
37
|
-
import { WireType } from
|
|
38
|
-
import type { BinaryReadOptions } from
|
|
39
|
-
import type { IBinaryReader } from
|
|
40
|
-
import { UnknownFieldHandler } from
|
|
41
|
-
import type { PartialMessage } from
|
|
42
|
-
import { reflectionMergePartial } from
|
|
43
|
-
import { typeofJsonValue } from
|
|
44
|
-
import type { JsonValue } from
|
|
45
|
-
import type { JsonReadOptions } from
|
|
46
|
-
import type { JsonWriteOptions } from
|
|
47
|
-
import { PbLong } from
|
|
48
|
-
import { MessageType } from
|
|
35
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
36
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
37
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
38
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
39
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
40
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
41
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
42
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
43
|
+
import { typeofJsonValue } from "@protobuf-ts/runtime";
|
|
44
|
+
import type { JsonValue } from "@protobuf-ts/runtime";
|
|
45
|
+
import type { JsonReadOptions } from "@protobuf-ts/runtime";
|
|
46
|
+
import type { JsonWriteOptions } from "@protobuf-ts/runtime";
|
|
47
|
+
import { PbLong } from "@protobuf-ts/runtime";
|
|
48
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
49
49
|
/**
|
|
50
50
|
* A Timestamp represents a point in time independent of any time zone or local
|
|
51
51
|
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
@@ -97,7 +97,6 @@ import { MessageType } from '@protobuf-ts/runtime';
|
|
|
97
97
|
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
98
98
|
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
99
99
|
*
|
|
100
|
-
*
|
|
101
100
|
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
102
101
|
*
|
|
103
102
|
* Instant now = Instant.now();
|
|
@@ -106,7 +105,6 @@ import { MessageType } from '@protobuf-ts/runtime';
|
|
|
106
105
|
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
107
106
|
* .setNanos(now.getNano()).build();
|
|
108
107
|
*
|
|
109
|
-
*
|
|
110
108
|
* Example 6: Compute Timestamp from current time in Python.
|
|
111
109
|
*
|
|
112
110
|
* timestamp = Timestamp()
|
|
@@ -136,225 +134,152 @@ import { MessageType } from '@protobuf-ts/runtime';
|
|
|
136
134
|
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
137
135
|
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
138
136
|
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
139
|
-
* http://
|
|
137
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
|
140
138
|
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
141
139
|
*
|
|
142
140
|
*
|
|
143
|
-
*
|
|
144
141
|
* @generated from protobuf message google.protobuf.Timestamp
|
|
145
142
|
*/
|
|
146
143
|
export interface Timestamp {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Represents seconds of UTC time since Unix epoch
|
|
146
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
147
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
148
|
+
*
|
|
149
|
+
* @generated from protobuf field: int64 seconds = 1
|
|
150
|
+
*/
|
|
151
|
+
seconds: bigint;
|
|
152
|
+
/**
|
|
153
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
154
|
+
* second values with fractions must still have non-negative nanos values
|
|
155
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
156
|
+
* inclusive.
|
|
157
|
+
*
|
|
158
|
+
* @generated from protobuf field: int32 nanos = 2
|
|
159
|
+
*/
|
|
160
|
+
nanos: number;
|
|
164
161
|
}
|
|
165
162
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
166
163
|
class Timestamp$Type extends MessageType<Timestamp> {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
164
|
+
constructor() {
|
|
165
|
+
super("google.protobuf.Timestamp", [
|
|
166
|
+
{ no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
167
|
+
{ no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Creates a new `Timestamp` for the current time.
|
|
172
|
+
*/
|
|
173
|
+
now(): Timestamp {
|
|
174
|
+
const msg = this.create();
|
|
175
|
+
const ms = Date.now();
|
|
176
|
+
msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
|
|
177
|
+
msg.nanos = (ms % 1000) * 1000000;
|
|
178
|
+
return msg;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Converts a `Timestamp` to a JavaScript Date.
|
|
182
|
+
*/
|
|
183
|
+
toDate(message: Timestamp): Date {
|
|
184
|
+
return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Converts a JavaScript Date to a `Timestamp`.
|
|
188
|
+
*/
|
|
189
|
+
fromDate(date: Date): Timestamp {
|
|
190
|
+
const msg = this.create();
|
|
191
|
+
const ms = date.getTime();
|
|
192
|
+
msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
|
|
193
|
+
msg.nanos = ((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000;
|
|
194
|
+
return msg;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* In JSON format, the `Timestamp` type is encoded as a string
|
|
198
|
+
* in the RFC 3339 format.
|
|
199
|
+
*/
|
|
200
|
+
internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {
|
|
201
|
+
let ms = PbLong.from(message.seconds).toNumber() * 1000;
|
|
202
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
|
203
|
+
throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
|
204
|
+
if (message.nanos < 0)
|
|
205
|
+
throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
|
|
206
|
+
let z = "Z";
|
|
207
|
+
if (message.nanos > 0) {
|
|
208
|
+
let nanosStr = (message.nanos + 1000000000).toString().substring(1);
|
|
209
|
+
if (nanosStr.substring(3) === "000000")
|
|
210
|
+
z = "." + nanosStr.substring(0, 3) + "Z";
|
|
211
|
+
else if (nanosStr.substring(6) === "000")
|
|
212
|
+
z = "." + nanosStr.substring(0, 6) + "Z";
|
|
213
|
+
else
|
|
214
|
+
z = "." + nanosStr + "Z";
|
|
215
|
+
}
|
|
216
|
+
return new Date(ms).toISOString().replace(".000Z", z);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* In JSON format, the `Timestamp` type is encoded as a string
|
|
220
|
+
* in the RFC 3339 format.
|
|
221
|
+
*/
|
|
222
|
+
internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp {
|
|
223
|
+
if (typeof json !== "string")
|
|
224
|
+
throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
|
|
225
|
+
let 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]))$/);
|
|
226
|
+
if (!matches)
|
|
227
|
+
throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
|
|
228
|
+
let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
|
|
229
|
+
if (Number.isNaN(ms))
|
|
230
|
+
throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
|
|
231
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
|
232
|
+
throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
|
233
|
+
if (!target)
|
|
234
|
+
target = this.create();
|
|
235
|
+
target.seconds = PbLong.from(ms / 1000).toBigInt();
|
|
236
|
+
target.nanos = 0;
|
|
237
|
+
if (matches[7])
|
|
238
|
+
target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
|
|
239
|
+
return target;
|
|
240
|
+
}
|
|
241
|
+
create(value?: PartialMessage<Timestamp>): Timestamp {
|
|
242
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
243
|
+
message.seconds = 0n;
|
|
244
|
+
message.nanos = 0;
|
|
245
|
+
if (value !== undefined)
|
|
246
|
+
reflectionMergePartial<Timestamp>(this, message, value);
|
|
247
|
+
return message;
|
|
248
|
+
}
|
|
249
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp {
|
|
250
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
251
|
+
while (reader.pos < end) {
|
|
252
|
+
let [fieldNo, wireType] = reader.tag();
|
|
253
|
+
switch (fieldNo) {
|
|
254
|
+
case /* int64 seconds */ 1:
|
|
255
|
+
message.seconds = reader.int64().toBigInt();
|
|
256
|
+
break;
|
|
257
|
+
case /* int32 nanos */ 2:
|
|
258
|
+
message.nanos = reader.int32();
|
|
259
|
+
break;
|
|
260
|
+
default:
|
|
261
|
+
let u = options.readUnknownField;
|
|
262
|
+
if (u === "throw")
|
|
263
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
264
|
+
let d = reader.skip(wireType);
|
|
265
|
+
if (u !== false)
|
|
266
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return message;
|
|
237
270
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
): Timestamp {
|
|
250
|
-
if (typeof json !== 'string')
|
|
251
|
-
throw new Error(
|
|
252
|
-
'Unable to parse Timestamp from JSON ' + typeofJsonValue(json) + '.',
|
|
253
|
-
);
|
|
254
|
-
const matches = json.match(
|
|
255
|
-
/^([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]))$/,
|
|
256
|
-
);
|
|
257
|
-
if (!matches)
|
|
258
|
-
throw new Error('Unable to parse Timestamp from JSON. Invalid format.');
|
|
259
|
-
const ms = Date.parse(
|
|
260
|
-
matches[1]
|
|
261
|
-
+ '-'
|
|
262
|
-
+ matches[2]
|
|
263
|
-
+ '-'
|
|
264
|
-
+ matches[3]
|
|
265
|
-
+ 'T'
|
|
266
|
-
+ matches[4]
|
|
267
|
-
+ ':'
|
|
268
|
-
+ matches[5]
|
|
269
|
-
+ ':'
|
|
270
|
-
+ matches[6]
|
|
271
|
-
+ (matches[8] ? matches[8] : 'Z'),
|
|
272
|
-
);
|
|
273
|
-
if (Number.isNaN(ms))
|
|
274
|
-
throw new Error('Unable to parse Timestamp from JSON. Invalid value.');
|
|
275
|
-
if (
|
|
276
|
-
ms < Date.parse('0001-01-01T00:00:00Z')
|
|
277
|
-
|| ms > Date.parse('9999-12-31T23:59:59Z')
|
|
278
|
-
)
|
|
279
|
-
throw new globalThis.Error(
|
|
280
|
-
'Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.',
|
|
281
|
-
);
|
|
282
|
-
if (!target) target = this.create();
|
|
283
|
-
target.seconds = PbLong.from(ms / 1000).toBigInt();
|
|
284
|
-
target.nanos = 0;
|
|
285
|
-
if (matches[7])
|
|
286
|
-
target.nanos
|
|
287
|
-
= parseInt('1' + matches[7] + '0'.repeat(9 - matches[7].length))
|
|
288
|
-
- 1000000000;
|
|
289
|
-
return target;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
create(value?: PartialMessage<Timestamp>): Timestamp {
|
|
293
|
-
const message = globalThis.Object.create(this.messagePrototype!);
|
|
294
|
-
message.seconds = 0n;
|
|
295
|
-
message.nanos = 0;
|
|
296
|
-
if (value !== undefined)
|
|
297
|
-
reflectionMergePartial<Timestamp>(this, message, value);
|
|
298
|
-
return message;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
internalBinaryRead(
|
|
302
|
-
reader: IBinaryReader,
|
|
303
|
-
length: number,
|
|
304
|
-
options: BinaryReadOptions,
|
|
305
|
-
target?: Timestamp,
|
|
306
|
-
): Timestamp {
|
|
307
|
-
const message = target ?? this.create(),
|
|
308
|
-
end = reader.pos + length;
|
|
309
|
-
while (reader.pos < end) {
|
|
310
|
-
const [fieldNo, wireType] = reader.tag();
|
|
311
|
-
switch (fieldNo) {
|
|
312
|
-
case /* int64 seconds */ 1:
|
|
313
|
-
message.seconds = reader.int64().toBigInt();
|
|
314
|
-
break;
|
|
315
|
-
case /* int32 nanos */ 2:
|
|
316
|
-
message.nanos = reader.int32();
|
|
317
|
-
break;
|
|
318
|
-
default:
|
|
319
|
-
const u = options.readUnknownField;
|
|
320
|
-
if (u === 'throw')
|
|
321
|
-
throw new globalThis.Error(
|
|
322
|
-
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`,
|
|
323
|
-
);
|
|
324
|
-
const d = reader.skip(wireType);
|
|
325
|
-
if (u !== false)
|
|
326
|
-
(u === true ? UnknownFieldHandler.onRead : u)(
|
|
327
|
-
this.typeName,
|
|
328
|
-
message,
|
|
329
|
-
fieldNo,
|
|
330
|
-
wireType,
|
|
331
|
-
d,
|
|
332
|
-
);
|
|
333
|
-
}
|
|
271
|
+
internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
272
|
+
/* int64 seconds = 1; */
|
|
273
|
+
if (message.seconds !== 0n)
|
|
274
|
+
writer.tag(1, WireType.Varint).int64(message.seconds);
|
|
275
|
+
/* int32 nanos = 2; */
|
|
276
|
+
if (message.nanos !== 0)
|
|
277
|
+
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
278
|
+
let u = options.writeUnknownFields;
|
|
279
|
+
if (u !== false)
|
|
280
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
281
|
+
return writer;
|
|
334
282
|
}
|
|
335
|
-
return message;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
internalBinaryWrite(
|
|
339
|
-
message: Timestamp,
|
|
340
|
-
writer: IBinaryWriter,
|
|
341
|
-
options: BinaryWriteOptions,
|
|
342
|
-
): IBinaryWriter {
|
|
343
|
-
/* int64 seconds = 1; */
|
|
344
|
-
if (message.seconds !== 0n)
|
|
345
|
-
writer.tag(1, WireType.Varint).int64(message.seconds);
|
|
346
|
-
/* int32 nanos = 2; */
|
|
347
|
-
if (message.nanos !== 0)
|
|
348
|
-
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
349
|
-
const u = options.writeUnknownFields;
|
|
350
|
-
if (u !== false)
|
|
351
|
-
(u == true ? UnknownFieldHandler.onWrite : u)(
|
|
352
|
-
this.typeName,
|
|
353
|
-
message,
|
|
354
|
-
writer,
|
|
355
|
-
);
|
|
356
|
-
return writer;
|
|
357
|
-
}
|
|
358
283
|
}
|
|
359
284
|
/**
|
|
360
285
|
* @generated MessageType for protobuf message google.protobuf.Timestamp
|