@milaboratories/pl-client 2.4.10

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 (64) hide show
  1. package/README.md +52 -0
  2. package/dist/index.cjs +14527 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +14426 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +49 -0
  7. package/src/core/auth.ts +27 -0
  8. package/src/core/client.test.ts +47 -0
  9. package/src/core/client.ts +302 -0
  10. package/src/core/config.test.ts +19 -0
  11. package/src/core/config.ts +197 -0
  12. package/src/core/default_client.ts +161 -0
  13. package/src/core/driver.ts +30 -0
  14. package/src/core/error.test.ts +14 -0
  15. package/src/core/errors.ts +84 -0
  16. package/src/core/http.ts +178 -0
  17. package/src/core/ll_client.test.ts +111 -0
  18. package/src/core/ll_client.ts +228 -0
  19. package/src/core/ll_transaction.test.ts +152 -0
  20. package/src/core/ll_transaction.ts +333 -0
  21. package/src/core/transaction.test.ts +173 -0
  22. package/src/core/transaction.ts +730 -0
  23. package/src/core/type_conversion.ts +121 -0
  24. package/src/core/types.test.ts +22 -0
  25. package/src/core/types.ts +223 -0
  26. package/src/core/unauth_client.test.ts +21 -0
  27. package/src/core/unauth_client.ts +48 -0
  28. package/src/helpers/pl.ts +141 -0
  29. package/src/helpers/poll.ts +178 -0
  30. package/src/helpers/rich_resource_types.test.ts +22 -0
  31. package/src/helpers/rich_resource_types.ts +84 -0
  32. package/src/helpers/smart_accessors.ts +146 -0
  33. package/src/helpers/state_helpers.ts +5 -0
  34. package/src/helpers/tx_helpers.ts +24 -0
  35. package/src/index.ts +14 -0
  36. package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +125 -0
  37. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +45 -0
  38. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +271 -0
  39. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +51 -0
  40. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +380 -0
  41. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +59 -0
  42. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +450 -0
  43. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +148 -0
  44. package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +706 -0
  45. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +406 -0
  46. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +12636 -0
  47. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +1384 -0
  48. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +181 -0
  49. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +251 -0
  50. package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +693 -0
  51. package/src/proto/google/api/http.ts +687 -0
  52. package/src/proto/google/protobuf/any.ts +326 -0
  53. package/src/proto/google/protobuf/descriptor.ts +4502 -0
  54. package/src/proto/google/protobuf/duration.ts +230 -0
  55. package/src/proto/google/protobuf/empty.ts +81 -0
  56. package/src/proto/google/protobuf/struct.ts +482 -0
  57. package/src/proto/google/protobuf/timestamp.ts +287 -0
  58. package/src/proto/google/protobuf/wrappers.ts +751 -0
  59. package/src/test/test_config.test.ts +6 -0
  60. package/src/test/test_config.ts +166 -0
  61. package/src/util/branding.ts +4 -0
  62. package/src/util/pl.ts +11 -0
  63. package/src/util/util.test.ts +10 -0
  64. package/src/util/util.ts +9 -0
@@ -0,0 +1,271 @@
1
+ // @generated by protobuf-ts 2.9.4 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
+ // @generated from protobuf file "github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.proto" (package "MiLaboratories.Controller.Shared", syntax proto3)
3
+ // tslint:disable
4
+ import { ServiceType } from "@protobuf-ts/runtime-rpc";
5
+ import { WireType } from "@protobuf-ts/runtime";
6
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
7
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
8
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
9
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
10
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
11
+ import type { PartialMessage } from "@protobuf-ts/runtime";
12
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
13
+ import { MessageType } from "@protobuf-ts/runtime";
14
+ /**
15
+ * @generated from protobuf message MiLaboratories.Controller.Shared.DownloadAPI
16
+ */
17
+ export interface DownloadAPI {
18
+ }
19
+ /**
20
+ * @generated from protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL
21
+ */
22
+ export interface DownloadAPI_GetDownloadURL {
23
+ }
24
+ /**
25
+ * @generated from protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request
26
+ */
27
+ export interface DownloadAPI_GetDownloadURL_Request {
28
+ /**
29
+ * @generated from protobuf field: uint64 resource_id = 1;
30
+ */
31
+ resourceId: bigint;
32
+ }
33
+ /**
34
+ * @generated from protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader
35
+ */
36
+ export interface DownloadAPI_GetDownloadURL_HTTPHeader {
37
+ /**
38
+ * @generated from protobuf field: string Name = 1 [json_name = "Name"];
39
+ */
40
+ name: string;
41
+ /**
42
+ * @generated from protobuf field: string Value = 2 [json_name = "Value"];
43
+ */
44
+ value: string;
45
+ }
46
+ /**
47
+ * @generated from protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response
48
+ */
49
+ export interface DownloadAPI_GetDownloadURL_Response {
50
+ /**
51
+ * @generated from protobuf field: string download_url = 1;
52
+ */
53
+ downloadUrl: string;
54
+ /**
55
+ * @generated from protobuf field: repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers = 2;
56
+ */
57
+ headers: DownloadAPI_GetDownloadURL_HTTPHeader[];
58
+ }
59
+ // @generated message type with reflection information, may provide speed optimized methods
60
+ class DownloadAPI$Type extends MessageType<DownloadAPI> {
61
+ constructor() {
62
+ super("MiLaboratories.Controller.Shared.DownloadAPI", []);
63
+ }
64
+ create(value?: PartialMessage<DownloadAPI>): DownloadAPI {
65
+ const message = globalThis.Object.create((this.messagePrototype!));
66
+ if (value !== undefined)
67
+ reflectionMergePartial<DownloadAPI>(this, message, value);
68
+ return message;
69
+ }
70
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAPI): DownloadAPI {
71
+ return target ?? this.create();
72
+ }
73
+ internalBinaryWrite(message: DownloadAPI, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
74
+ let u = options.writeUnknownFields;
75
+ if (u !== false)
76
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
77
+ return writer;
78
+ }
79
+ }
80
+ /**
81
+ * @generated MessageType for protobuf message MiLaboratories.Controller.Shared.DownloadAPI
82
+ */
83
+ export const DownloadAPI = new DownloadAPI$Type();
84
+ // @generated message type with reflection information, may provide speed optimized methods
85
+ class DownloadAPI_GetDownloadURL$Type extends MessageType<DownloadAPI_GetDownloadURL> {
86
+ constructor() {
87
+ super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
88
+ }
89
+ create(value?: PartialMessage<DownloadAPI_GetDownloadURL>): DownloadAPI_GetDownloadURL {
90
+ const message = globalThis.Object.create((this.messagePrototype!));
91
+ if (value !== undefined)
92
+ reflectionMergePartial<DownloadAPI_GetDownloadURL>(this, message, value);
93
+ return message;
94
+ }
95
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAPI_GetDownloadURL): DownloadAPI_GetDownloadURL {
96
+ return target ?? this.create();
97
+ }
98
+ internalBinaryWrite(message: DownloadAPI_GetDownloadURL, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
99
+ let u = options.writeUnknownFields;
100
+ if (u !== false)
101
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
102
+ return writer;
103
+ }
104
+ }
105
+ /**
106
+ * @generated MessageType for protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL
107
+ */
108
+ export const DownloadAPI_GetDownloadURL = new DownloadAPI_GetDownloadURL$Type();
109
+ // @generated message type with reflection information, may provide speed optimized methods
110
+ class DownloadAPI_GetDownloadURL_Request$Type extends MessageType<DownloadAPI_GetDownloadURL_Request> {
111
+ constructor() {
112
+ super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request", [
113
+ { no: 1, name: "resource_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
114
+ ]);
115
+ }
116
+ create(value?: PartialMessage<DownloadAPI_GetDownloadURL_Request>): DownloadAPI_GetDownloadURL_Request {
117
+ const message = globalThis.Object.create((this.messagePrototype!));
118
+ message.resourceId = 0n;
119
+ if (value !== undefined)
120
+ reflectionMergePartial<DownloadAPI_GetDownloadURL_Request>(this, message, value);
121
+ return message;
122
+ }
123
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAPI_GetDownloadURL_Request): DownloadAPI_GetDownloadURL_Request {
124
+ let message = target ?? this.create(), end = reader.pos + length;
125
+ while (reader.pos < end) {
126
+ let [fieldNo, wireType] = reader.tag();
127
+ switch (fieldNo) {
128
+ case /* uint64 resource_id */ 1:
129
+ message.resourceId = reader.uint64().toBigInt();
130
+ break;
131
+ default:
132
+ let u = options.readUnknownField;
133
+ if (u === "throw")
134
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
135
+ let d = reader.skip(wireType);
136
+ if (u !== false)
137
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
138
+ }
139
+ }
140
+ return message;
141
+ }
142
+ internalBinaryWrite(message: DownloadAPI_GetDownloadURL_Request, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
143
+ /* uint64 resource_id = 1; */
144
+ if (message.resourceId !== 0n)
145
+ writer.tag(1, WireType.Varint).uint64(message.resourceId);
146
+ let u = options.writeUnknownFields;
147
+ if (u !== false)
148
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
149
+ return writer;
150
+ }
151
+ }
152
+ /**
153
+ * @generated MessageType for protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request
154
+ */
155
+ export const DownloadAPI_GetDownloadURL_Request = new DownloadAPI_GetDownloadURL_Request$Type();
156
+ // @generated message type with reflection information, may provide speed optimized methods
157
+ class DownloadAPI_GetDownloadURL_HTTPHeader$Type extends MessageType<DownloadAPI_GetDownloadURL_HTTPHeader> {
158
+ constructor() {
159
+ super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader", [
160
+ { no: 1, name: "Name", kind: "scalar", jsonName: "Name", T: 9 /*ScalarType.STRING*/ },
161
+ { no: 2, name: "Value", kind: "scalar", jsonName: "Value", T: 9 /*ScalarType.STRING*/ }
162
+ ]);
163
+ }
164
+ create(value?: PartialMessage<DownloadAPI_GetDownloadURL_HTTPHeader>): DownloadAPI_GetDownloadURL_HTTPHeader {
165
+ const message = globalThis.Object.create((this.messagePrototype!));
166
+ message.name = "";
167
+ message.value = "";
168
+ if (value !== undefined)
169
+ reflectionMergePartial<DownloadAPI_GetDownloadURL_HTTPHeader>(this, message, value);
170
+ return message;
171
+ }
172
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAPI_GetDownloadURL_HTTPHeader): DownloadAPI_GetDownloadURL_HTTPHeader {
173
+ let message = target ?? this.create(), end = reader.pos + length;
174
+ while (reader.pos < end) {
175
+ let [fieldNo, wireType] = reader.tag();
176
+ switch (fieldNo) {
177
+ case /* string Name = 1 [json_name = "Name"];*/ 1:
178
+ message.name = reader.string();
179
+ break;
180
+ case /* string Value = 2 [json_name = "Value"];*/ 2:
181
+ message.value = reader.string();
182
+ break;
183
+ default:
184
+ let u = options.readUnknownField;
185
+ if (u === "throw")
186
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
187
+ let d = reader.skip(wireType);
188
+ if (u !== false)
189
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
190
+ }
191
+ }
192
+ return message;
193
+ }
194
+ internalBinaryWrite(message: DownloadAPI_GetDownloadURL_HTTPHeader, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
195
+ /* string Name = 1 [json_name = "Name"]; */
196
+ if (message.name !== "")
197
+ writer.tag(1, WireType.LengthDelimited).string(message.name);
198
+ /* string Value = 2 [json_name = "Value"]; */
199
+ if (message.value !== "")
200
+ writer.tag(2, WireType.LengthDelimited).string(message.value);
201
+ let u = options.writeUnknownFields;
202
+ if (u !== false)
203
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
204
+ return writer;
205
+ }
206
+ }
207
+ /**
208
+ * @generated MessageType for protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader
209
+ */
210
+ export const DownloadAPI_GetDownloadURL_HTTPHeader = new DownloadAPI_GetDownloadURL_HTTPHeader$Type();
211
+ // @generated message type with reflection information, may provide speed optimized methods
212
+ class DownloadAPI_GetDownloadURL_Response$Type extends MessageType<DownloadAPI_GetDownloadURL_Response> {
213
+ constructor() {
214
+ super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response", [
215
+ { no: 1, name: "download_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
216
+ { no: 2, name: "headers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DownloadAPI_GetDownloadURL_HTTPHeader }
217
+ ]);
218
+ }
219
+ create(value?: PartialMessage<DownloadAPI_GetDownloadURL_Response>): DownloadAPI_GetDownloadURL_Response {
220
+ const message = globalThis.Object.create((this.messagePrototype!));
221
+ message.downloadUrl = "";
222
+ message.headers = [];
223
+ if (value !== undefined)
224
+ reflectionMergePartial<DownloadAPI_GetDownloadURL_Response>(this, message, value);
225
+ return message;
226
+ }
227
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DownloadAPI_GetDownloadURL_Response): DownloadAPI_GetDownloadURL_Response {
228
+ let message = target ?? this.create(), end = reader.pos + length;
229
+ while (reader.pos < end) {
230
+ let [fieldNo, wireType] = reader.tag();
231
+ switch (fieldNo) {
232
+ case /* string download_url */ 1:
233
+ message.downloadUrl = reader.string();
234
+ break;
235
+ case /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers */ 2:
236
+ message.headers.push(DownloadAPI_GetDownloadURL_HTTPHeader.internalBinaryRead(reader, reader.uint32(), options));
237
+ break;
238
+ default:
239
+ let u = options.readUnknownField;
240
+ if (u === "throw")
241
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
242
+ let d = reader.skip(wireType);
243
+ if (u !== false)
244
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
245
+ }
246
+ }
247
+ return message;
248
+ }
249
+ internalBinaryWrite(message: DownloadAPI_GetDownloadURL_Response, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
250
+ /* string download_url = 1; */
251
+ if (message.downloadUrl !== "")
252
+ writer.tag(1, WireType.LengthDelimited).string(message.downloadUrl);
253
+ /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers = 2; */
254
+ for (let i = 0; i < message.headers.length; i++)
255
+ DownloadAPI_GetDownloadURL_HTTPHeader.internalBinaryWrite(message.headers[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
256
+ let u = options.writeUnknownFields;
257
+ if (u !== false)
258
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
259
+ return writer;
260
+ }
261
+ }
262
+ /**
263
+ * @generated MessageType for protobuf message MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response
264
+ */
265
+ export const DownloadAPI_GetDownloadURL_Response = new DownloadAPI_GetDownloadURL_Response$Type();
266
+ /**
267
+ * @generated ServiceType for protobuf service MiLaboratories.Controller.Shared.Download
268
+ */
269
+ export const Download = new ServiceType("MiLaboratories.Controller.Shared.Download", [
270
+ { name: "GetDownloadURL", options: { "google.api.http": { get: "/resources/{resource_id}/get-download-url" } }, I: DownloadAPI_GetDownloadURL_Request, O: DownloadAPI_GetDownloadURL_Response }
271
+ ]);
@@ -0,0 +1,51 @@
1
+ // @generated by protobuf-ts 2.9.4 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
2
+ // @generated from protobuf file "github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.proto" (package "MiLaboratories.Controller.Shared", syntax proto3)
3
+ // tslint:disable
4
+ import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
5
+ import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
6
+ import { LS } from "./protocol";
7
+ import { stackIntercept } from "@protobuf-ts/runtime-rpc";
8
+ import type { LsAPI_List_Response } from "./protocol";
9
+ import type { LsAPI_List_Request } from "./protocol";
10
+ import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
11
+ import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
12
+ /**
13
+ *
14
+ * LS provides access to lists of blobs (files, S3 objects and so on) is some storage.
15
+ * This API allows clients to know, whan items are available in storages, that
16
+ * the contorllers can access, providing clients with the ability to start indexation
17
+ * on, say, existing sequence files from the corporate storage.
18
+ *
19
+ *
20
+ * @generated from protobuf service MiLaboratories.Controller.Shared.LS
21
+ */
22
+ export interface ILSClient {
23
+ /**
24
+ * @generated from protobuf rpc: List(MiLaboratories.Controller.Shared.LsAPI.List.Request) returns (MiLaboratories.Controller.Shared.LsAPI.List.Response);
25
+ */
26
+ list(input: LsAPI_List_Request, options?: RpcOptions): UnaryCall<LsAPI_List_Request, LsAPI_List_Response>;
27
+ }
28
+ /**
29
+ *
30
+ * LS provides access to lists of blobs (files, S3 objects and so on) is some storage.
31
+ * This API allows clients to know, whan items are available in storages, that
32
+ * the contorllers can access, providing clients with the ability to start indexation
33
+ * on, say, existing sequence files from the corporate storage.
34
+ *
35
+ *
36
+ * @generated from protobuf service MiLaboratories.Controller.Shared.LS
37
+ */
38
+ export class LSClient implements ILSClient, ServiceInfo {
39
+ typeName = LS.typeName;
40
+ methods = LS.methods;
41
+ options = LS.options;
42
+ constructor(private readonly _transport: RpcTransport) {
43
+ }
44
+ /**
45
+ * @generated from protobuf rpc: List(MiLaboratories.Controller.Shared.LsAPI.List.Request) returns (MiLaboratories.Controller.Shared.LsAPI.List.Response);
46
+ */
47
+ list(input: LsAPI_List_Request, options?: RpcOptions): UnaryCall<LsAPI_List_Request, LsAPI_List_Response> {
48
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
49
+ return stackIntercept<LsAPI_List_Request, LsAPI_List_Response>("unary", this._transport, method, opt, input);
50
+ }
51
+ }