@milaboratories/pl-client 2.7.14 → 2.8.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.
Files changed (61) hide show
  1. package/dist/core/client.d.ts +4 -1
  2. package/dist/core/client.d.ts.map +1 -1
  3. package/dist/core/ll_client.d.ts +12 -2
  4. package/dist/core/ll_client.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +4341 -4316
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +15 -15
  10. package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -1
  11. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +4 -4
  12. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -1
  13. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +59 -59
  14. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -1
  15. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +72 -72
  16. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -1
  17. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +152 -152
  18. package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -1
  19. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +156 -156
  20. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -1
  21. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +790 -773
  22. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -1
  23. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +163 -163
  24. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -1
  25. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +22 -22
  26. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -1
  27. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +32 -32
  28. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -1
  29. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +78 -78
  30. package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -1
  31. package/dist/proto/google/protobuf/any.d.ts +52 -52
  32. package/dist/proto/google/protobuf/any.d.ts.map +1 -1
  33. package/dist/proto/google/protobuf/duration.d.ts +19 -19
  34. package/dist/proto/google/protobuf/duration.d.ts.map +1 -1
  35. package/dist/proto/google/protobuf/empty.d.ts.map +1 -1
  36. package/dist/proto/google/protobuf/struct.d.ts +56 -56
  37. package/dist/proto/google/protobuf/struct.d.ts.map +1 -1
  38. package/dist/proto/google/protobuf/timestamp.d.ts +25 -25
  39. package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
  40. package/dist/proto/google/protobuf/wrappers.d.ts +72 -72
  41. package/dist/proto/google/protobuf/wrappers.d.ts.map +1 -1
  42. package/package.json +3 -3
  43. package/src/core/client.ts +31 -35
  44. package/src/core/ll_client.ts +48 -23
  45. package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +72 -75
  46. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +21 -22
  47. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +276 -291
  48. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +54 -59
  49. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +470 -491
  50. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +238 -263
  51. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +11058 -11752
  52. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1115 -1156
  53. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +126 -132
  54. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +201 -204
  55. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +541 -560
  56. package/src/proto/google/protobuf/any.ts +140 -150
  57. package/src/proto/google/protobuf/duration.ts +103 -108
  58. package/src/proto/google/protobuf/empty.ts +39 -42
  59. package/src/proto/google/protobuf/struct.ts +323 -337
  60. package/src/proto/google/protobuf/timestamp.ts +124 -132
  61. package/src/proto/google/protobuf/wrappers.ts +492 -537
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3)
3
3
  // tslint:disable
4
4
  //
@@ -32,22 +32,22 @@
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 '@protobuf-ts/runtime';
36
- import type { IBinaryWriter } from '@protobuf-ts/runtime';
37
- import { WireType } from '@protobuf-ts/runtime';
38
- import type { IBinaryReader } from '@protobuf-ts/runtime';
39
- import { UnknownFieldHandler } from '@protobuf-ts/runtime';
40
- import type { PartialMessage } from '@protobuf-ts/runtime';
41
- import { reflectionMergePartial } from '@protobuf-ts/runtime';
42
- import { isJsonObject } from '@protobuf-ts/runtime';
43
- import { typeofJsonValue } from '@protobuf-ts/runtime';
44
- import type { JsonValue } from '@protobuf-ts/runtime';
45
- import { jsonWriteOptions } from '@protobuf-ts/runtime';
46
- import type { JsonReadOptions } from '@protobuf-ts/runtime';
47
- import type { JsonWriteOptions } from '@protobuf-ts/runtime';
48
- import type { BinaryReadOptions } from '@protobuf-ts/runtime';
49
- import type { IMessageType } from '@protobuf-ts/runtime';
50
- import { MessageType } from '@protobuf-ts/runtime';
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 { IBinaryReader } from "@protobuf-ts/runtime";
39
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
40
+ import type { PartialMessage } from "@protobuf-ts/runtime";
41
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
42
+ import { isJsonObject } from "@protobuf-ts/runtime";
43
+ import { typeofJsonValue } from "@protobuf-ts/runtime";
44
+ import type { JsonValue } from "@protobuf-ts/runtime";
45
+ import { jsonWriteOptions } from "@protobuf-ts/runtime";
46
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
47
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
48
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
49
+ import type { IMessageType } from "@protobuf-ts/runtime";
50
+ import { MessageType } from "@protobuf-ts/runtime";
51
51
  /**
52
52
  * `Any` contains an arbitrary serialized protocol buffer message along with a
53
53
  * URL that describes the type of the serialized message.
@@ -139,7 +139,7 @@ import { MessageType } from '@protobuf-ts/runtime';
139
139
  * @generated from protobuf message google.protobuf.Any
140
140
  */
141
141
  export interface Any {
142
- /**
142
+ /**
143
143
  * A URL/resource name that uniquely identifies the type of the serialized
144
144
  * protocol buffer message. This string must contain at least
145
145
  * one "/" character. The last segment of the URL's path must represent
@@ -172,55 +172,51 @@ export interface Any {
172
172
  *
173
173
  * @generated from protobuf field: string type_url = 1;
174
174
  */
175
- typeUrl: string;
176
- /**
175
+ typeUrl: string;
176
+ /**
177
177
  * Must be a valid serialized protocol buffer of the above specified type.
178
178
  *
179
179
  * @generated from protobuf field: bytes value = 2;
180
180
  */
181
- value: Uint8Array;
181
+ value: Uint8Array;
182
182
  }
183
183
  // @generated message type with reflection information, may provide speed optimized methods
184
184
  class Any$Type extends MessageType<Any> {
185
- constructor() {
186
- super('google.protobuf.Any', [
187
- { no: 1, name: 'type_url', kind: 'scalar', T: 9 /* ScalarType.STRING */ },
188
- { no: 2, name: 'value', kind: 'scalar', T: 12 /* ScalarType.BYTES */ },
189
- ]);
190
- }
191
-
192
- /**
185
+ constructor() {
186
+ super("google.protobuf.Any", [
187
+ { no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
188
+ { no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
189
+ ]);
190
+ }
191
+ /**
193
192
  * Pack the message into a new `Any`.
194
193
  *
195
194
  * Uses 'type.googleapis.com/full.type.name' as the type URL.
196
195
  */
197
- pack<T extends object>(message: T, type: IMessageType<T>): Any {
198
- return {
199
- typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message),
200
- };
201
- }
202
-
203
- /**
196
+ pack<T extends object>(message: T, type: IMessageType<T>): Any {
197
+ return {
198
+ typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message),
199
+ };
200
+ }
201
+ /**
204
202
  * Unpack the message from the `Any`.
205
203
  */
206
- unpack<T extends object>(any: Any, type: IMessageType<T>, options?: Partial<BinaryReadOptions>): T {
207
- if (!this.contains(any, type))
208
- throw new Error('Cannot unpack google.protobuf.Any with typeUrl \'' + any.typeUrl + '\' as ' + type.typeName + '.');
209
- return type.fromBinary(any.value, options);
210
- }
211
-
212
- /**
204
+ unpack<T extends object>(any: Any, type: IMessageType<T>, options?: Partial<BinaryReadOptions>): T {
205
+ if (!this.contains(any, type))
206
+ throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + ".");
207
+ return type.fromBinary(any.value, options);
208
+ }
209
+ /**
213
210
  * Does the given `Any` contain a packed message of the given type?
214
211
  */
215
- contains(any: Any, type: IMessageType<any> | string): boolean {
216
- if (!any.typeUrl.length)
217
- return false;
218
- const wants = typeof type == 'string' ? type : type.typeName;
219
- const has = this.typeUrlToName(any.typeUrl);
220
- return wants === has;
221
- }
222
-
223
- /**
212
+ contains(any: Any, type: IMessageType<any> | string): boolean {
213
+ if (!any.typeUrl.length)
214
+ return false;
215
+ let wants = typeof type == "string" ? type : type.typeName;
216
+ let has = this.typeUrlToName(any.typeUrl);
217
+ return wants === has;
218
+ }
219
+ /**
224
220
  * Convert the message to canonical JSON value.
225
221
  *
226
222
  * You have to provide the `typeRegistry` option so that the
@@ -229,106 +225,100 @@ class Any$Type extends MessageType<Any> {
229
225
  * The `typeRegistry` option is also required to read
230
226
  * `google.protobuf.Any` from JSON format.
231
227
  */
232
- internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue {
233
- if (any.typeUrl === '')
234
- return {};
235
- const typeName = this.typeUrlToName(any.typeUrl);
236
- const opt = jsonWriteOptions(options);
237
- const type = opt.typeRegistry?.find((t) => t.typeName === typeName);
238
- if (!type)
239
- throw new globalThis.Error('Unable to convert google.protobuf.Any with typeUrl \'' + any.typeUrl + '\' to JSON. The specified type ' + typeName + ' is not available in the type registry.');
240
- const value = type.fromBinary(any.value, { readUnknownField: false });
241
- let json = type.internalJsonWrite(value, opt);
242
- if (typeName.startsWith('google.protobuf.') || !isJsonObject(json))
243
- json = { value: json };
244
- json['@type'] = any.typeUrl;
245
- return json;
246
- }
247
-
248
- internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any {
249
- if (!isJsonObject(json))
250
- throw new globalThis.Error('Unable to parse google.protobuf.Any from JSON ' + typeofJsonValue(json) + '.');
251
- if (typeof json['@type'] != 'string' || json['@type'] == '')
252
- return this.create();
253
- const typeName = this.typeUrlToName(json['@type']);
254
- const type = options?.typeRegistry?.find((t) => t.typeName == typeName);
255
- if (!type)
256
- throw new globalThis.Error('Unable to parse google.protobuf.Any from JSON. The specified type ' + typeName + ' is not available in the type registry.');
257
- let value;
258
- if (typeName.startsWith('google.protobuf.') && json.hasOwnProperty('value'))
259
- value = type.fromJson(json['value'], options);
260
- else {
261
- const copy = Object.assign({}, json);
262
- delete copy['@type'];
263
- value = type.fromJson(copy, options);
228
+ internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue {
229
+ if (any.typeUrl === "")
230
+ return {};
231
+ let typeName = this.typeUrlToName(any.typeUrl);
232
+ let opt = jsonWriteOptions(options);
233
+ let type = opt.typeRegistry?.find(t => t.typeName === typeName);
234
+ if (!type)
235
+ throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry.");
236
+ let value = type.fromBinary(any.value, { readUnknownField: false });
237
+ let json = type.internalJsonWrite(value, opt);
238
+ if (typeName.startsWith("google.protobuf.") || !isJsonObject(json))
239
+ json = { value: json };
240
+ json["@type"] = any.typeUrl;
241
+ return json;
242
+ }
243
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any {
244
+ if (!isJsonObject(json))
245
+ throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + ".");
246
+ if (typeof json["@type"] != "string" || json["@type"] == "")
247
+ return this.create();
248
+ let typeName = this.typeUrlToName(json["@type"]);
249
+ let type = options?.typeRegistry?.find(t => t.typeName == typeName);
250
+ if (!type)
251
+ throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry.");
252
+ let value;
253
+ if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value"))
254
+ value = type.fromJson(json["value"], options);
255
+ else {
256
+ let copy = Object.assign({}, json);
257
+ delete copy["@type"];
258
+ value = type.fromJson(copy, options);
259
+ }
260
+ if (target === undefined)
261
+ target = this.create();
262
+ target.typeUrl = json["@type"];
263
+ target.value = type.toBinary(value);
264
+ return target;
265
+ }
266
+ typeNameToUrl(name: string): string {
267
+ if (!name.length)
268
+ throw new Error("invalid type name: " + name);
269
+ return "type.googleapis.com/" + name;
270
+ }
271
+ typeUrlToName(url: string): string {
272
+ if (!url.length)
273
+ throw new Error("invalid type url: " + url);
274
+ let slash = url.lastIndexOf("/");
275
+ let name = slash > 0 ? url.substring(slash + 1) : url;
276
+ if (!name.length)
277
+ throw new Error("invalid type url: " + url);
278
+ return name;
279
+ }
280
+ create(value?: PartialMessage<Any>): Any {
281
+ const message = globalThis.Object.create((this.messagePrototype!));
282
+ message.typeUrl = "";
283
+ message.value = new Uint8Array(0);
284
+ if (value !== undefined)
285
+ reflectionMergePartial<Any>(this, message, value);
286
+ return message;
287
+ }
288
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any {
289
+ let message = target ?? this.create(), end = reader.pos + length;
290
+ while (reader.pos < end) {
291
+ let [fieldNo, wireType] = reader.tag();
292
+ switch (fieldNo) {
293
+ case /* string type_url */ 1:
294
+ message.typeUrl = reader.string();
295
+ break;
296
+ case /* bytes value */ 2:
297
+ message.value = reader.bytes();
298
+ break;
299
+ default:
300
+ let u = options.readUnknownField;
301
+ if (u === "throw")
302
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
303
+ let d = reader.skip(wireType);
304
+ if (u !== false)
305
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
306
+ }
307
+ }
308
+ return message;
264
309
  }
265
- if (target === undefined)
266
- target = this.create();
267
- target.typeUrl = json['@type'];
268
- target.value = type.toBinary(value);
269
- return target;
270
- }
271
-
272
- typeNameToUrl(name: string): string {
273
- if (!name.length)
274
- throw new Error('invalid type name: ' + name);
275
- return 'type.googleapis.com/' + name;
276
- }
277
-
278
- typeUrlToName(url: string): string {
279
- if (!url.length)
280
- throw new Error('invalid type url: ' + url);
281
- const slash = url.lastIndexOf('/');
282
- const name = slash > 0 ? url.substring(slash + 1) : url;
283
- if (!name.length)
284
- throw new Error('invalid type url: ' + url);
285
- return name;
286
- }
287
-
288
- create(value?: PartialMessage<Any>): Any {
289
- const message = globalThis.Object.create((this.messagePrototype!));
290
- message.typeUrl = '';
291
- message.value = new Uint8Array(0);
292
- if (value !== undefined)
293
- reflectionMergePartial<Any>(this, message, value);
294
- return message;
295
- }
296
-
297
- internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any {
298
- const message = target ?? this.create(), end = reader.pos + length;
299
- while (reader.pos < end) {
300
- const [fieldNo, wireType] = reader.tag();
301
- switch (fieldNo) {
302
- case /* string type_url */ 1:
303
- message.typeUrl = reader.string();
304
- break;
305
- case /* bytes value */ 2:
306
- message.value = reader.bytes();
307
- break;
308
- default:
309
- const u = options.readUnknownField;
310
- if (u === 'throw')
311
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
312
- const d = reader.skip(wireType);
313
- if (u !== false)
314
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
315
- }
310
+ internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
311
+ /* string type_url = 1; */
312
+ if (message.typeUrl !== "")
313
+ writer.tag(1, WireType.LengthDelimited).string(message.typeUrl);
314
+ /* bytes value = 2; */
315
+ if (message.value.length)
316
+ writer.tag(2, WireType.LengthDelimited).bytes(message.value);
317
+ let u = options.writeUnknownFields;
318
+ if (u !== false)
319
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
320
+ return writer;
316
321
  }
317
- return message;
318
- }
319
-
320
- internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
321
- /* string type_url = 1; */
322
- if (message.typeUrl !== '')
323
- writer.tag(1, WireType.LengthDelimited).string(message.typeUrl);
324
- /* bytes value = 2; */
325
- if (message.value.length)
326
- writer.tag(2, WireType.LengthDelimited).bytes(message.value);
327
- const u = options.writeUnknownFields;
328
- if (u !== false)
329
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
330
- return writer;
331
- }
332
322
  }
333
323
  /**
334
324
  * @generated MessageType for protobuf message google.protobuf.Any
@@ -1,4 +1,4 @@
1
- // @generated by protobuf-ts 2.9.5 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
1
+ // @generated by protobuf-ts 2.9.6 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
2
  // @generated from protobuf file "google/protobuf/duration.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 '@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';
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 Duration represents a signed, fixed-length span of time represented
51
51
  * as a count of seconds and fractions of seconds at nanosecond
@@ -110,15 +110,15 @@ import { MessageType } from '@protobuf-ts/runtime';
110
110
  * @generated from protobuf message google.protobuf.Duration
111
111
  */
112
112
  export interface Duration {
113
- /**
113
+ /**
114
114
  * Signed seconds of the span of time. Must be from -315,576,000,000
115
115
  * to +315,576,000,000 inclusive. Note: these bounds are computed from:
116
116
  * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
117
117
  *
118
118
  * @generated from protobuf field: int64 seconds = 1;
119
119
  */
120
- seconds: bigint;
121
- /**
120
+ seconds: bigint;
121
+ /**
122
122
  * Signed fractions of a second at nanosecond resolution of the span
123
123
  * of time. Durations less than one second are represented with a 0
124
124
  * `seconds` field and a positive or negative `nanos` field. For durations
@@ -128,106 +128,101 @@ export interface Duration {
128
128
  *
129
129
  * @generated from protobuf field: int32 nanos = 2;
130
130
  */
131
- nanos: number;
131
+ nanos: number;
132
132
  }
133
133
  // @generated message type with reflection information, may provide speed optimized methods
134
134
  class Duration$Type extends MessageType<Duration> {
135
- constructor() {
136
- super('google.protobuf.Duration', [
137
- { no: 1, name: 'seconds', kind: 'scalar', T: 3 /* ScalarType.INT64 */, L: 0 /* LongType.BIGINT */ },
138
- { no: 2, name: 'nanos', kind: 'scalar', T: 5 /* ScalarType.INT32 */ },
139
- ]);
140
- }
141
-
142
- /**
135
+ constructor() {
136
+ super("google.protobuf.Duration", [
137
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
138
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
139
+ ]);
140
+ }
141
+ /**
143
142
  * Encode `Duration` to JSON string like "3.000001s".
144
143
  */
145
- internalJsonWrite(message: Duration, options: JsonWriteOptions): JsonValue {
146
- const s = PbLong.from(message.seconds).toNumber();
147
- if (s > 315576000000 || s < -315576000000)
148
- throw new Error('Duration value out of range.');
149
- let text = message.seconds.toString();
150
- if (s === 0 && message.nanos < 0)
151
- text = '-' + text;
152
- if (message.nanos !== 0) {
153
- let nanosStr = Math.abs(message.nanos).toString();
154
- nanosStr = '0'.repeat(9 - nanosStr.length) + nanosStr;
155
- if (nanosStr.substring(3) === '000000')
156
- nanosStr = nanosStr.substring(0, 3);
157
- else if (nanosStr.substring(6) === '000')
158
- nanosStr = nanosStr.substring(0, 6);
159
- text += '.' + nanosStr;
144
+ internalJsonWrite(message: Duration, options: JsonWriteOptions): JsonValue {
145
+ let s = PbLong.from(message.seconds).toNumber();
146
+ if (s > 315576000000 || s < -315576000000)
147
+ throw new Error("Duration value out of range.");
148
+ let text = message.seconds.toString();
149
+ if (s === 0 && message.nanos < 0)
150
+ text = "-" + text;
151
+ if (message.nanos !== 0) {
152
+ let nanosStr = Math.abs(message.nanos).toString();
153
+ nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
154
+ if (nanosStr.substring(3) === "000000")
155
+ nanosStr = nanosStr.substring(0, 3);
156
+ else if (nanosStr.substring(6) === "000")
157
+ nanosStr = nanosStr.substring(0, 6);
158
+ text += "." + nanosStr;
159
+ }
160
+ return text + "s";
160
161
  }
161
- return text + 's';
162
- }
163
-
164
- /**
162
+ /**
165
163
  * Decode `Duration` from JSON string like "3.000001s"
166
164
  */
167
- internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Duration): Duration {
168
- if (typeof json !== 'string')
169
- throw new Error('Unable to parse Duration from JSON ' + typeofJsonValue(json) + '. Expected string.');
170
- const match = json.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
171
- if (match === null)
172
- throw new Error('Unable to parse Duration from JSON string. Invalid format.');
173
- if (!target)
174
- target = this.create();
175
- const [, sign, secs, nanos] = match;
176
- const longSeconds = PbLong.from(sign + secs);
177
- if (longSeconds.toNumber() > 315576000000 || longSeconds.toNumber() < -315576000000)
178
- throw new Error('Unable to parse Duration from JSON string. Value out of range.');
179
- target.seconds = longSeconds.toBigInt();
180
- if (typeof nanos == 'string') {
181
- const nanosStr = sign + nanos + '0'.repeat(9 - nanos.length);
182
- target.nanos = parseInt(nanosStr);
165
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Duration): Duration {
166
+ if (typeof json !== "string")
167
+ throw new Error("Unable to parse Duration from JSON " + typeofJsonValue(json) + ". Expected string.");
168
+ let match = json.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
169
+ if (match === null)
170
+ throw new Error("Unable to parse Duration from JSON string. Invalid format.");
171
+ if (!target)
172
+ target = this.create();
173
+ let [, sign, secs, nanos] = match;
174
+ let longSeconds = PbLong.from(sign + secs);
175
+ if (longSeconds.toNumber() > 315576000000 || longSeconds.toNumber() < -315576000000)
176
+ throw new Error("Unable to parse Duration from JSON string. Value out of range.");
177
+ target.seconds = longSeconds.toBigInt();
178
+ if (typeof nanos == "string") {
179
+ let nanosStr = sign + nanos + "0".repeat(9 - nanos.length);
180
+ target.nanos = parseInt(nanosStr);
181
+ }
182
+ return target;
183
+ }
184
+ create(value?: PartialMessage<Duration>): Duration {
185
+ const message = globalThis.Object.create((this.messagePrototype!));
186
+ message.seconds = 0n;
187
+ message.nanos = 0;
188
+ if (value !== undefined)
189
+ reflectionMergePartial<Duration>(this, message, value);
190
+ return message;
191
+ }
192
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Duration): Duration {
193
+ let message = target ?? this.create(), end = reader.pos + length;
194
+ while (reader.pos < end) {
195
+ let [fieldNo, wireType] = reader.tag();
196
+ switch (fieldNo) {
197
+ case /* int64 seconds */ 1:
198
+ message.seconds = reader.int64().toBigInt();
199
+ break;
200
+ case /* int32 nanos */ 2:
201
+ message.nanos = reader.int32();
202
+ break;
203
+ default:
204
+ let u = options.readUnknownField;
205
+ if (u === "throw")
206
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
207
+ let d = reader.skip(wireType);
208
+ if (u !== false)
209
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
210
+ }
211
+ }
212
+ return message;
183
213
  }
184
- return target;
185
- }
186
-
187
- create(value?: PartialMessage<Duration>): Duration {
188
- const message = globalThis.Object.create((this.messagePrototype!));
189
- message.seconds = 0n;
190
- message.nanos = 0;
191
- if (value !== undefined)
192
- reflectionMergePartial<Duration>(this, message, value);
193
- return message;
194
- }
195
-
196
- internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Duration): Duration {
197
- const message = target ?? this.create(), end = reader.pos + length;
198
- while (reader.pos < end) {
199
- const [fieldNo, wireType] = reader.tag();
200
- switch (fieldNo) {
201
- case /* int64 seconds */ 1:
202
- message.seconds = reader.int64().toBigInt();
203
- break;
204
- case /* int32 nanos */ 2:
205
- message.nanos = reader.int32();
206
- break;
207
- default:
208
- const u = options.readUnknownField;
209
- if (u === 'throw')
210
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
211
- const d = reader.skip(wireType);
212
- if (u !== false)
213
- (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
214
- }
214
+ internalBinaryWrite(message: Duration, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
215
+ /* int64 seconds = 1; */
216
+ if (message.seconds !== 0n)
217
+ writer.tag(1, WireType.Varint).int64(message.seconds);
218
+ /* int32 nanos = 2; */
219
+ if (message.nanos !== 0)
220
+ writer.tag(2, WireType.Varint).int32(message.nanos);
221
+ let u = options.writeUnknownFields;
222
+ if (u !== false)
223
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
224
+ return writer;
215
225
  }
216
- return message;
217
- }
218
-
219
- internalBinaryWrite(message: Duration, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
220
- /* int64 seconds = 1; */
221
- if (message.seconds !== 0n)
222
- writer.tag(1, WireType.Varint).int64(message.seconds);
223
- /* int32 nanos = 2; */
224
- if (message.nanos !== 0)
225
- writer.tag(2, WireType.Varint).int32(message.nanos);
226
- const u = options.writeUnknownFields;
227
- if (u !== false)
228
- (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
229
- return writer;
230
- }
231
226
  }
232
227
  /**
233
228
  * @generated MessageType for protobuf message google.protobuf.Duration