@milaboratories/pl-drivers 1.5.10 → 1.5.12
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/clients/constructors.d.ts.map +1 -1
- package/dist/clients/download.d.ts.map +1 -1
- package/dist/clients/logs.d.ts.map +1 -1
- package/dist/clients/ls_api.d.ts.map +1 -1
- package/dist/clients/progress.d.ts.map +1 -1
- package/dist/clients/upload.d.ts.map +1 -1
- package/dist/drivers/download_blob.d.ts +2 -2
- package/dist/drivers/download_blob.d.ts.map +1 -1
- package/dist/drivers/download_blob_task.d.ts +2 -2
- package/dist/drivers/download_blob_task.d.ts.map +1 -1
- package/dist/drivers/download_blob_url/driver.d.ts +46 -0
- package/dist/drivers/download_blob_url/driver.d.ts.map +1 -0
- package/dist/drivers/download_blob_url/driver_id.d.ts +6 -0
- package/dist/drivers/download_blob_url/driver_id.d.ts.map +1 -0
- package/dist/drivers/download_blob_url/snapshot.d.ts +7 -0
- package/dist/drivers/download_blob_url/snapshot.d.ts.map +1 -0
- package/dist/drivers/download_blob_url/task.d.ts +64 -0
- package/dist/drivers/download_blob_url/task.d.ts.map +1 -0
- package/dist/drivers/download_blob_url/url.d.ts +6 -0
- package/dist/drivers/download_blob_url/url.d.ts.map +1 -0
- package/dist/drivers/download_url.d.ts +2 -2
- package/dist/drivers/download_url.d.ts.map +1 -1
- package/dist/drivers/helpers/download_local_handle.d.ts.map +1 -1
- package/dist/drivers/helpers/download_remote_handle.d.ts.map +1 -1
- package/dist/drivers/helpers/files_cache.d.ts.map +1 -1
- package/dist/drivers/helpers/logs_handle.d.ts +1 -1
- package/dist/drivers/helpers/logs_handle.d.ts.map +1 -1
- package/dist/drivers/helpers/ls_remote_import_handle.d.ts +1 -1
- package/dist/drivers/helpers/ls_remote_import_handle.d.ts.map +1 -1
- package/dist/drivers/helpers/ls_storage_entry.d.ts +1 -1
- package/dist/drivers/helpers/ls_storage_entry.d.ts.map +1 -1
- package/dist/drivers/logs.d.ts +2 -2
- package/dist/drivers/logs.d.ts.map +1 -1
- package/dist/drivers/logs_stream.d.ts +2 -2
- package/dist/drivers/logs_stream.d.ts.map +1 -1
- package/dist/drivers/ls.d.ts +1 -1
- package/dist/drivers/ls.d.ts.map +1 -1
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/upload.d.ts +1 -1
- package/dist/drivers/upload.d.ts.map +1 -1
- package/dist/drivers/upload_task.d.ts +1 -1
- package/dist/drivers/upload_task.d.ts.map +1 -1
- package/dist/drivers/virtual_storages.d.ts.map +1 -1
- package/dist/helpers/download.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2312 -2067
- package/dist/index.mjs.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +1 -1
- package/dist/proto/google/api/http.d.ts +28 -28
- package/dist/proto/google/api/http.d.ts.map +1 -1
- package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -1
- package/dist/proto/google/protobuf/duration.d.ts.map +1 -1
- package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
- package/package.json +9 -4
- package/src/clients/constructors.ts +11 -11
- package/src/clients/download.test.ts +11 -10
- package/src/clients/download.ts +15 -14
- package/src/clients/logs.ts +13 -12
- package/src/clients/ls_api.ts +7 -7
- package/src/clients/progress.ts +15 -13
- package/src/clients/upload.test.ts +6 -5
- package/src/clients/upload.ts +28 -26
- package/src/drivers/download_blob.test.ts +21 -20
- package/src/drivers/download_blob.ts +47 -42
- package/src/drivers/download_blob_task.ts +25 -21
- package/src/drivers/download_blob_url/driver.ts +225 -0
- package/src/drivers/download_blob_url/driver_id.ts +11 -0
- package/src/drivers/download_blob_url/snapshot.ts +20 -0
- package/src/drivers/download_blob_url/task.ts +230 -0
- package/src/drivers/download_blob_url/url.test.ts +39 -0
- package/src/drivers/download_blob_url/url.ts +43 -0
- package/src/drivers/download_url.test.ts +3 -3
- package/src/drivers/download_url.ts +21 -20
- package/src/drivers/helpers/download_local_handle.ts +2 -2
- package/src/drivers/helpers/download_remote_handle.ts +8 -8
- package/src/drivers/helpers/files_cache.test.ts +7 -6
- package/src/drivers/helpers/files_cache.ts +2 -1
- package/src/drivers/helpers/helpers.ts +1 -1
- package/src/drivers/helpers/logs_handle.ts +7 -7
- package/src/drivers/helpers/ls_remote_import_handle.ts +7 -7
- package/src/drivers/helpers/ls_storage_entry.ts +6 -5
- package/src/drivers/logs.test.ts +23 -22
- package/src/drivers/logs.ts +13 -12
- package/src/drivers/logs_stream.ts +42 -37
- package/src/drivers/ls.test.ts +2 -2
- package/src/drivers/ls.ts +38 -35
- package/src/drivers/types.ts +12 -11
- package/src/drivers/upload.test.ts +19 -17
- package/src/drivers/upload.ts +30 -25
- package/src/drivers/upload_task.ts +23 -19
- package/src/drivers/virtual_storages.ts +6 -6
- package/src/helpers/download.ts +8 -8
- package/src/index.ts +2 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +4 -4
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +88 -73
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +2 -2
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +71 -56
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +6 -5
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +130 -106
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +14 -10
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +142 -121
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.ts +11 -8
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.ts +216 -174
- package/src/proto/google/api/http.ts +95 -86
- package/src/proto/google/protobuf/descriptor.ts +674 -593
- package/src/proto/google/protobuf/duration.ts +31 -26
- package/src/proto/google/protobuf/timestamp.ts +52 -44
|
@@ -139,17 +139,18 @@ class Duration$Type extends MessageType<Duration> {
|
|
|
139
139
|
no: 1,
|
|
140
140
|
name: 'seconds',
|
|
141
141
|
kind: 'scalar',
|
|
142
|
-
T: 3 /*ScalarType.INT64*/,
|
|
143
|
-
L: 0 /*LongType.BIGINT*/
|
|
142
|
+
T: 3 /* ScalarType.INT64 */,
|
|
143
|
+
L: 0, /* LongType.BIGINT */
|
|
144
144
|
},
|
|
145
|
-
{ no: 2, name: 'nanos', kind: 'scalar', T: 5 /*ScalarType.INT32*/ }
|
|
145
|
+
{ no: 2, name: 'nanos', kind: 'scalar', T: 5 /* ScalarType.INT32 */ },
|
|
146
146
|
]);
|
|
147
147
|
}
|
|
148
|
+
|
|
148
149
|
/**
|
|
149
150
|
* Encode `Duration` to JSON string like "3.000001s".
|
|
150
151
|
*/
|
|
151
152
|
internalJsonWrite(message: Duration, options: JsonWriteOptions): JsonValue {
|
|
152
|
-
|
|
153
|
+
const s = PbLong.from(message.seconds).toNumber();
|
|
153
154
|
if (s > 315576000000 || s < -315576000000)
|
|
154
155
|
throw new Error('Duration value out of range.');
|
|
155
156
|
let text = message.seconds.toString();
|
|
@@ -165,42 +166,44 @@ class Duration$Type extends MessageType<Duration> {
|
|
|
165
166
|
}
|
|
166
167
|
return text + 's';
|
|
167
168
|
}
|
|
169
|
+
|
|
168
170
|
/**
|
|
169
171
|
* Decode `Duration` from JSON string like "3.000001s"
|
|
170
172
|
*/
|
|
171
173
|
internalJsonRead(
|
|
172
174
|
json: JsonValue,
|
|
173
175
|
options: JsonReadOptions,
|
|
174
|
-
target?: Duration
|
|
176
|
+
target?: Duration,
|
|
175
177
|
): Duration {
|
|
176
178
|
if (typeof json !== 'string')
|
|
177
179
|
throw new Error(
|
|
178
|
-
'Unable to parse Duration from JSON '
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
'Unable to parse Duration from JSON '
|
|
181
|
+
+ typeofJsonValue(json)
|
|
182
|
+
+ '. Expected string.',
|
|
181
183
|
);
|
|
182
|
-
|
|
184
|
+
const match = json.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
|
|
183
185
|
if (match === null)
|
|
184
186
|
throw new Error(
|
|
185
|
-
'Unable to parse Duration from JSON string. Invalid format.'
|
|
187
|
+
'Unable to parse Duration from JSON string. Invalid format.',
|
|
186
188
|
);
|
|
187
189
|
if (!target) target = this.create();
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
const [, sign, secs, nanos] = match;
|
|
191
|
+
const longSeconds = PbLong.from(sign + secs);
|
|
190
192
|
if (
|
|
191
|
-
longSeconds.toNumber() > 315576000000
|
|
192
|
-
longSeconds.toNumber() < -315576000000
|
|
193
|
+
longSeconds.toNumber() > 315576000000
|
|
194
|
+
|| longSeconds.toNumber() < -315576000000
|
|
193
195
|
)
|
|
194
196
|
throw new Error(
|
|
195
|
-
'Unable to parse Duration from JSON string. Value out of range.'
|
|
197
|
+
'Unable to parse Duration from JSON string. Value out of range.',
|
|
196
198
|
);
|
|
197
199
|
target.seconds = longSeconds.toBigInt();
|
|
198
200
|
if (typeof nanos == 'string') {
|
|
199
|
-
|
|
201
|
+
const nanosStr = sign + nanos + '0'.repeat(9 - nanos.length);
|
|
200
202
|
target.nanos = parseInt(nanosStr);
|
|
201
203
|
}
|
|
202
204
|
return target;
|
|
203
205
|
}
|
|
206
|
+
|
|
204
207
|
create(value?: PartialMessage<Duration>): Duration {
|
|
205
208
|
const message = globalThis.Object.create(this.messagePrototype!);
|
|
206
209
|
message.seconds = 0n;
|
|
@@ -209,16 +212,17 @@ class Duration$Type extends MessageType<Duration> {
|
|
|
209
212
|
reflectionMergePartial<Duration>(this, message, value);
|
|
210
213
|
return message;
|
|
211
214
|
}
|
|
215
|
+
|
|
212
216
|
internalBinaryRead(
|
|
213
217
|
reader: IBinaryReader,
|
|
214
218
|
length: number,
|
|
215
219
|
options: BinaryReadOptions,
|
|
216
|
-
target?: Duration
|
|
220
|
+
target?: Duration,
|
|
217
221
|
): Duration {
|
|
218
|
-
|
|
222
|
+
const message = target ?? this.create(),
|
|
219
223
|
end = reader.pos + length;
|
|
220
224
|
while (reader.pos < end) {
|
|
221
|
-
|
|
225
|
+
const [fieldNo, wireType] = reader.tag();
|
|
222
226
|
switch (fieldNo) {
|
|
223
227
|
case /* int64 seconds */ 1:
|
|
224
228
|
message.seconds = reader.int64().toBigInt();
|
|
@@ -227,28 +231,29 @@ class Duration$Type extends MessageType<Duration> {
|
|
|
227
231
|
message.nanos = reader.int32();
|
|
228
232
|
break;
|
|
229
233
|
default:
|
|
230
|
-
|
|
234
|
+
const u = options.readUnknownField;
|
|
231
235
|
if (u === 'throw')
|
|
232
236
|
throw new globalThis.Error(
|
|
233
|
-
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}
|
|
237
|
+
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`,
|
|
234
238
|
);
|
|
235
|
-
|
|
239
|
+
const d = reader.skip(wireType);
|
|
236
240
|
if (u !== false)
|
|
237
241
|
(u === true ? UnknownFieldHandler.onRead : u)(
|
|
238
242
|
this.typeName,
|
|
239
243
|
message,
|
|
240
244
|
fieldNo,
|
|
241
245
|
wireType,
|
|
242
|
-
d
|
|
246
|
+
d,
|
|
243
247
|
);
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
return message;
|
|
247
251
|
}
|
|
252
|
+
|
|
248
253
|
internalBinaryWrite(
|
|
249
254
|
message: Duration,
|
|
250
255
|
writer: IBinaryWriter,
|
|
251
|
-
options: BinaryWriteOptions
|
|
256
|
+
options: BinaryWriteOptions,
|
|
252
257
|
): IBinaryWriter {
|
|
253
258
|
/* int64 seconds = 1; */
|
|
254
259
|
if (message.seconds !== 0n)
|
|
@@ -256,12 +261,12 @@ class Duration$Type extends MessageType<Duration> {
|
|
|
256
261
|
/* int32 nanos = 2; */
|
|
257
262
|
if (message.nanos !== 0)
|
|
258
263
|
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
259
|
-
|
|
264
|
+
const u = options.writeUnknownFields;
|
|
260
265
|
if (u !== false)
|
|
261
266
|
(u == true ? UnknownFieldHandler.onWrite : u)(
|
|
262
267
|
this.typeName,
|
|
263
268
|
message,
|
|
264
|
-
writer
|
|
269
|
+
writer,
|
|
265
270
|
);
|
|
266
271
|
return writer;
|
|
267
272
|
}
|
|
@@ -170,12 +170,13 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
170
170
|
no: 1,
|
|
171
171
|
name: 'seconds',
|
|
172
172
|
kind: 'scalar',
|
|
173
|
-
T: 3 /*ScalarType.INT64*/,
|
|
174
|
-
L: 0 /*LongType.BIGINT*/
|
|
173
|
+
T: 3 /* ScalarType.INT64 */,
|
|
174
|
+
L: 0, /* LongType.BIGINT */
|
|
175
175
|
},
|
|
176
|
-
{ no: 2, name: 'nanos', kind: 'scalar', T: 5 /*ScalarType.INT32*/ }
|
|
176
|
+
{ no: 2, name: 'nanos', kind: 'scalar', T: 5 /* ScalarType.INT32 */ },
|
|
177
177
|
]);
|
|
178
178
|
}
|
|
179
|
+
|
|
179
180
|
/**
|
|
180
181
|
* Creates a new `Timestamp` for the current time.
|
|
181
182
|
*/
|
|
@@ -186,15 +187,17 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
186
187
|
msg.nanos = (ms % 1000) * 1000000;
|
|
187
188
|
return msg;
|
|
188
189
|
}
|
|
190
|
+
|
|
189
191
|
/**
|
|
190
192
|
* Converts a `Timestamp` to a JavaScript Date.
|
|
191
193
|
*/
|
|
192
194
|
toDate(message: Timestamp): Date {
|
|
193
195
|
return new Date(
|
|
194
|
-
PbLong.from(message.seconds).toNumber() * 1000
|
|
195
|
-
|
|
196
|
+
PbLong.from(message.seconds).toNumber() * 1000
|
|
197
|
+
+ Math.ceil(message.nanos / 1000000),
|
|
196
198
|
);
|
|
197
199
|
}
|
|
200
|
+
|
|
198
201
|
/**
|
|
199
202
|
* Converts a JavaScript Date to a `Timestamp`.
|
|
200
203
|
*/
|
|
@@ -205,26 +208,27 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
205
208
|
msg.nanos = (ms % 1000) * 1000000;
|
|
206
209
|
return msg;
|
|
207
210
|
}
|
|
211
|
+
|
|
208
212
|
/**
|
|
209
213
|
* In JSON format, the `Timestamp` type is encoded as a string
|
|
210
214
|
* in the RFC 3339 format.
|
|
211
215
|
*/
|
|
212
216
|
internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {
|
|
213
|
-
|
|
217
|
+
const ms = PbLong.from(message.seconds).toNumber() * 1000;
|
|
214
218
|
if (
|
|
215
|
-
ms < Date.parse('0001-01-01T00:00:00Z')
|
|
216
|
-
ms > Date.parse('9999-12-31T23:59:59Z')
|
|
219
|
+
ms < Date.parse('0001-01-01T00:00:00Z')
|
|
220
|
+
|| ms > Date.parse('9999-12-31T23:59:59Z')
|
|
217
221
|
)
|
|
218
222
|
throw new Error(
|
|
219
|
-
'Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.'
|
|
223
|
+
'Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.',
|
|
220
224
|
);
|
|
221
225
|
if (message.nanos < 0)
|
|
222
226
|
throw new Error(
|
|
223
|
-
'Unable to encode invalid Timestamp to JSON. Nanos must not be negative.'
|
|
227
|
+
'Unable to encode invalid Timestamp to JSON. Nanos must not be negative.',
|
|
224
228
|
);
|
|
225
229
|
let z = 'Z';
|
|
226
230
|
if (message.nanos > 0) {
|
|
227
|
-
|
|
231
|
+
const nanosStr = (message.nanos + 1000000000).toString().substring(1);
|
|
228
232
|
if (nanosStr.substring(3) === '000000')
|
|
229
233
|
z = '.' + nanosStr.substring(0, 3) + 'Z';
|
|
230
234
|
else if (nanosStr.substring(6) === '000')
|
|
@@ -233,6 +237,7 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
233
237
|
}
|
|
234
238
|
return new Date(ms).toISOString().replace('.000Z', z);
|
|
235
239
|
}
|
|
240
|
+
|
|
236
241
|
/**
|
|
237
242
|
* In JSON format, the `Timestamp` type is encoded as a string
|
|
238
243
|
* in the RFC 3339 format.
|
|
@@ -240,49 +245,50 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
240
245
|
internalJsonRead(
|
|
241
246
|
json: JsonValue,
|
|
242
247
|
options: JsonReadOptions,
|
|
243
|
-
target?: Timestamp
|
|
248
|
+
target?: Timestamp,
|
|
244
249
|
): Timestamp {
|
|
245
250
|
if (typeof json !== 'string')
|
|
246
251
|
throw new Error(
|
|
247
|
-
'Unable to parse Timestamp from JSON ' + typeofJsonValue(json) + '.'
|
|
252
|
+
'Unable to parse Timestamp from JSON ' + typeofJsonValue(json) + '.',
|
|
248
253
|
);
|
|
249
|
-
|
|
250
|
-
/^([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]))
|
|
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]))$/,
|
|
251
256
|
);
|
|
252
257
|
if (!matches)
|
|
253
258
|
throw new Error('Unable to parse Timestamp from JSON. Invalid format.');
|
|
254
|
-
|
|
255
|
-
matches[1]
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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'),
|
|
267
272
|
);
|
|
268
273
|
if (Number.isNaN(ms))
|
|
269
274
|
throw new Error('Unable to parse Timestamp from JSON. Invalid value.');
|
|
270
275
|
if (
|
|
271
|
-
ms < Date.parse('0001-01-01T00:00:00Z')
|
|
272
|
-
ms > Date.parse('9999-12-31T23:59:59Z')
|
|
276
|
+
ms < Date.parse('0001-01-01T00:00:00Z')
|
|
277
|
+
|| ms > Date.parse('9999-12-31T23:59:59Z')
|
|
273
278
|
)
|
|
274
279
|
throw new globalThis.Error(
|
|
275
|
-
'Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.'
|
|
280
|
+
'Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.',
|
|
276
281
|
);
|
|
277
282
|
if (!target) target = this.create();
|
|
278
283
|
target.seconds = PbLong.from(ms / 1000).toBigInt();
|
|
279
284
|
target.nanos = 0;
|
|
280
285
|
if (matches[7])
|
|
281
|
-
target.nanos
|
|
282
|
-
parseInt('1' + matches[7] + '0'.repeat(9 - matches[7].length))
|
|
283
|
-
1000000000;
|
|
286
|
+
target.nanos
|
|
287
|
+
= parseInt('1' + matches[7] + '0'.repeat(9 - matches[7].length))
|
|
288
|
+
- 1000000000;
|
|
284
289
|
return target;
|
|
285
290
|
}
|
|
291
|
+
|
|
286
292
|
create(value?: PartialMessage<Timestamp>): Timestamp {
|
|
287
293
|
const message = globalThis.Object.create(this.messagePrototype!);
|
|
288
294
|
message.seconds = 0n;
|
|
@@ -291,16 +297,17 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
291
297
|
reflectionMergePartial<Timestamp>(this, message, value);
|
|
292
298
|
return message;
|
|
293
299
|
}
|
|
300
|
+
|
|
294
301
|
internalBinaryRead(
|
|
295
302
|
reader: IBinaryReader,
|
|
296
303
|
length: number,
|
|
297
304
|
options: BinaryReadOptions,
|
|
298
|
-
target?: Timestamp
|
|
305
|
+
target?: Timestamp,
|
|
299
306
|
): Timestamp {
|
|
300
|
-
|
|
307
|
+
const message = target ?? this.create(),
|
|
301
308
|
end = reader.pos + length;
|
|
302
309
|
while (reader.pos < end) {
|
|
303
|
-
|
|
310
|
+
const [fieldNo, wireType] = reader.tag();
|
|
304
311
|
switch (fieldNo) {
|
|
305
312
|
case /* int64 seconds */ 1:
|
|
306
313
|
message.seconds = reader.int64().toBigInt();
|
|
@@ -309,28 +316,29 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
309
316
|
message.nanos = reader.int32();
|
|
310
317
|
break;
|
|
311
318
|
default:
|
|
312
|
-
|
|
319
|
+
const u = options.readUnknownField;
|
|
313
320
|
if (u === 'throw')
|
|
314
321
|
throw new globalThis.Error(
|
|
315
|
-
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}
|
|
322
|
+
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`,
|
|
316
323
|
);
|
|
317
|
-
|
|
324
|
+
const d = reader.skip(wireType);
|
|
318
325
|
if (u !== false)
|
|
319
326
|
(u === true ? UnknownFieldHandler.onRead : u)(
|
|
320
327
|
this.typeName,
|
|
321
328
|
message,
|
|
322
329
|
fieldNo,
|
|
323
330
|
wireType,
|
|
324
|
-
d
|
|
331
|
+
d,
|
|
325
332
|
);
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
return message;
|
|
329
336
|
}
|
|
337
|
+
|
|
330
338
|
internalBinaryWrite(
|
|
331
339
|
message: Timestamp,
|
|
332
340
|
writer: IBinaryWriter,
|
|
333
|
-
options: BinaryWriteOptions
|
|
341
|
+
options: BinaryWriteOptions,
|
|
334
342
|
): IBinaryWriter {
|
|
335
343
|
/* int64 seconds = 1; */
|
|
336
344
|
if (message.seconds !== 0n)
|
|
@@ -338,12 +346,12 @@ class Timestamp$Type extends MessageType<Timestamp> {
|
|
|
338
346
|
/* int32 nanos = 2; */
|
|
339
347
|
if (message.nanos !== 0)
|
|
340
348
|
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
341
|
-
|
|
349
|
+
const u = options.writeUnknownFields;
|
|
342
350
|
if (u !== false)
|
|
343
351
|
(u == true ? UnknownFieldHandler.onWrite : u)(
|
|
344
352
|
this.typeName,
|
|
345
353
|
message,
|
|
346
|
-
writer
|
|
354
|
+
writer,
|
|
347
355
|
);
|
|
348
356
|
return writer;
|
|
349
357
|
}
|