@milaboratories/pl-drivers 1.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/clients/download.d.ts +30 -0
- package/dist/clients/download.d.ts.map +1 -0
- package/dist/clients/helpers.d.ts +14 -0
- package/dist/clients/helpers.d.ts.map +1 -0
- package/dist/clients/logs.d.ts +26 -0
- package/dist/clients/logs.d.ts.map +1 -0
- package/dist/clients/ls_api.d.ts +13 -0
- package/dist/clients/ls_api.d.ts.map +1 -0
- package/dist/clients/progress.d.ts +25 -0
- package/dist/clients/progress.d.ts.map +1 -0
- package/dist/clients/upload.d.ts +38 -0
- package/dist/clients/upload.d.ts.map +1 -0
- package/dist/drivers/download_and_logs_blob.d.ts +106 -0
- package/dist/drivers/download_and_logs_blob.d.ts.map +1 -0
- package/dist/drivers/download_url.d.ts +70 -0
- package/dist/drivers/download_url.d.ts.map +1 -0
- package/dist/drivers/helpers/files_cache.d.ts +28 -0
- package/dist/drivers/helpers/files_cache.d.ts.map +1 -0
- package/dist/drivers/helpers/helpers.d.ts +34 -0
- package/dist/drivers/helpers/helpers.d.ts.map +1 -0
- package/dist/drivers/helpers/ls_list_entry.d.ts +49 -0
- package/dist/drivers/helpers/ls_list_entry.d.ts.map +1 -0
- package/dist/drivers/helpers/ls_storage_entry.d.ts +25 -0
- package/dist/drivers/helpers/ls_storage_entry.d.ts.map +1 -0
- package/dist/drivers/helpers/polling_ops.d.ts +8 -0
- package/dist/drivers/helpers/polling_ops.d.ts.map +1 -0
- package/dist/drivers/helpers/test_helpers.d.ts +2 -0
- package/dist/drivers/helpers/test_helpers.d.ts.map +1 -0
- package/dist/drivers/logs.d.ts +29 -0
- package/dist/drivers/logs.d.ts.map +1 -0
- package/dist/drivers/logs_stream.d.ts +50 -0
- package/dist/drivers/logs_stream.d.ts.map +1 -0
- package/dist/drivers/ls.d.ts +30 -0
- package/dist/drivers/ls.d.ts.map +1 -0
- package/dist/drivers/upload.d.ts +87 -0
- package/dist/drivers/upload.d.ts.map +1 -0
- package/dist/helpers/download.d.ts +15 -0
- package/dist/helpers/download.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4627 -0
- package/dist/index.js.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +36 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +103 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +42 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +165 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +44 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +171 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +122 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +315 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts +98 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts.map +1 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts +337 -0
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +1 -0
- package/dist/proto/google/api/http.d.ts +451 -0
- package/dist/proto/google/api/http.d.ts.map +1 -0
- package/dist/proto/google/protobuf/descriptor.d.ts +1646 -0
- package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -0
- package/dist/proto/google/protobuf/duration.d.ts +106 -0
- package/dist/proto/google/protobuf/duration.d.ts.map +1 -0
- package/dist/proto/google/protobuf/timestamp.d.ts +151 -0
- package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -0
- package/package.json +47 -0
- package/src/clients/download.test.ts +45 -0
- package/src/clients/download.ts +106 -0
- package/src/clients/helpers.ts +84 -0
- package/src/clients/logs.ts +68 -0
- package/src/clients/ls_api.ts +34 -0
- package/src/clients/progress.ts +86 -0
- package/src/clients/upload.test.ts +30 -0
- package/src/clients/upload.ts +199 -0
- package/src/drivers/download_and_logs_blob.ts +801 -0
- package/src/drivers/download_blob.test.ts +223 -0
- package/src/drivers/download_url.test.ts +90 -0
- package/src/drivers/download_url.ts +314 -0
- package/src/drivers/helpers/files_cache.test.ts +79 -0
- package/src/drivers/helpers/files_cache.ts +74 -0
- package/src/drivers/helpers/helpers.ts +136 -0
- package/src/drivers/helpers/ls_list_entry.test.ts +57 -0
- package/src/drivers/helpers/ls_list_entry.ts +152 -0
- package/src/drivers/helpers/ls_storage_entry.ts +135 -0
- package/src/drivers/helpers/polling_ops.ts +7 -0
- package/src/drivers/helpers/test_helpers.ts +5 -0
- package/src/drivers/logs.test.ts +337 -0
- package/src/drivers/logs.ts +214 -0
- package/src/drivers/logs_stream.ts +399 -0
- package/src/drivers/ls.test.ts +90 -0
- package/src/drivers/ls.ts +147 -0
- package/src/drivers/upload.test.ts +454 -0
- package/src/drivers/upload.ts +499 -0
- package/src/helpers/download.ts +43 -0
- package/src/index.ts +15 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +60 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +442 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +63 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +503 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +84 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +697 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +212 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +1036 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.ts +170 -0
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.ts +1201 -0
- package/src/proto/google/api/http.ts +838 -0
- package/src/proto/google/protobuf/descriptor.ts +5173 -0
- package/src/proto/google/protobuf/duration.ts +272 -0
- package/src/proto/google/protobuf/timestamp.ts +354 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# PL TS Upload Driver
|
|
2
|
+
|
|
3
|
+
# How to pull and build proto files
|
|
4
|
+
|
|
5
|
+
Dependencies:
|
|
6
|
+
|
|
7
|
+
- `protoc`
|
|
8
|
+
- `brew install protobuf`
|
|
9
|
+
- you don't need `protoc-gen-js`, just run `npm install`
|
|
10
|
+
- `protodep`
|
|
11
|
+
- `go install github.com/milaboratory/protodep@v0.1.7-milab`
|
|
12
|
+
|
|
13
|
+
check that you have `${HOME}/go/bin` in `PATH`
|
|
14
|
+
- `rsync`
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
./sync-proto.sh
|
|
18
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DownloadClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client';
|
|
2
|
+
import { GrpcTransport } from '@protobuf-ts/grpc-transport';
|
|
3
|
+
import { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
4
|
+
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
5
|
+
import { Dispatcher } from 'undici';
|
|
6
|
+
import { DownloadAPI_GetDownloadURL_HTTPHeader, DownloadAPI_GetDownloadURL_Response } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol';
|
|
7
|
+
import { ResourceInfo } from '@milaboratories/pl-tree';
|
|
8
|
+
import { DownloadResponse } from '../helpers/download';
|
|
9
|
+
export declare class UnknownStorageError extends Error {
|
|
10
|
+
}
|
|
11
|
+
export declare class WrongLocalFileUrl extends Error {
|
|
12
|
+
}
|
|
13
|
+
/** Gets URLs for downloading from pl-core, parses them and reads or downloads
|
|
14
|
+
* files locally and from the web. */
|
|
15
|
+
export declare class ClientDownload {
|
|
16
|
+
readonly grpcTransport: GrpcTransport;
|
|
17
|
+
readonly httpClient: Dispatcher;
|
|
18
|
+
readonly logger: MiLogger;
|
|
19
|
+
private readonly localStorageIdsToRoot;
|
|
20
|
+
readonly grpcClient: DownloadClient;
|
|
21
|
+
private readonly downloadHelper;
|
|
22
|
+
constructor(grpcTransport: GrpcTransport, httpClient: Dispatcher, logger: MiLogger, localStorageIdsToRoot: Record<string, string>);
|
|
23
|
+
close(): void;
|
|
24
|
+
getUrl({ id, type }: ResourceInfo, options?: RpcOptions, signal?: AbortSignal): Promise<DownloadAPI_GetDownloadURL_Response>;
|
|
25
|
+
downloadBlob(info: ResourceInfo, options?: RpcOptions, signal?: AbortSignal): Promise<DownloadResponse>;
|
|
26
|
+
private isLocal;
|
|
27
|
+
readLocalFile(url: string): Promise<DownloadResponse>;
|
|
28
|
+
}
|
|
29
|
+
export declare function headersFromProto(headers: DownloadAPI_GetDownloadURL_HTTPHeader[]): Record<string, string>;
|
|
30
|
+
//# sourceMappingURL=download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/clients/download.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,yFAAyF,CAAC;AACzH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,qCAAqC,EACrC,mCAAmC,EACpC,MAAM,kFAAkF,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAkB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvE,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AACjD,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C;qCACqC;AACrC,qBAAa,cAAc;aAKP,aAAa,EAAE,aAAa;aAC5B,UAAU,EAAE,UAAU;aACtB,MAAM,EAAE,QAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAPxC,SAAgB,UAAU,EAAE,cAAc,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAG9B,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,EACf,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMhE,KAAK;IAEC,MAAM,CACV,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,mCAAmC,CAAC;IAUzC,YAAY,CAChB,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,gBAAgB,CAAC;IAc5B,OAAO,CAAC,OAAO,CAAoD;IAE7D,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAwB5D;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,qCAAqC,EAAE,GAC/C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PlClient } from '@milaboratories/pl-client';
|
|
2
|
+
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
3
|
+
import { ClientDownload } from './download';
|
|
4
|
+
import { ClientLogs } from './logs';
|
|
5
|
+
import { ClientProgress } from './progress';
|
|
6
|
+
import { ClientUpload } from './upload';
|
|
7
|
+
import { ClientLs } from './ls_api';
|
|
8
|
+
export declare const PL_STORAGE_TO_PATH: any;
|
|
9
|
+
export declare function createDownloadClient(logger: MiLogger, client: PlClient, localStorageIdsToRoot?: Record<string, string>): ClientDownload;
|
|
10
|
+
export declare function createLogsClient(client: PlClient, logger: MiLogger): ClientLogs;
|
|
11
|
+
export declare function createUploadProgressClient(client: PlClient, logger: MiLogger): ClientProgress;
|
|
12
|
+
export declare function createUploadBlobClient(client: PlClient, logger: MiLogger): ClientUpload;
|
|
13
|
+
export declare function createLsFilesClient(client: PlClient, logger: MiLogger): ClientLs;
|
|
14
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/clients/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,kBAAkB,KAIzB,CAAC;AAEP,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,QAAQ,EAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBAoB/C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,cASlE;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,kBAS5E;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,gBASxE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,YASrE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StreamingClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client';
|
|
2
|
+
import { GrpcTransport } from '@protobuf-ts/grpc-transport';
|
|
3
|
+
import { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
4
|
+
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
5
|
+
import { Dispatcher } from 'undici';
|
|
6
|
+
import { StreamingAPI_Response } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol';
|
|
7
|
+
import { ResourceInfo } from '@milaboratories/pl-tree';
|
|
8
|
+
export declare class ClientLogs {
|
|
9
|
+
readonly grpcTransport: GrpcTransport;
|
|
10
|
+
readonly httpClient: Dispatcher;
|
|
11
|
+
readonly logger: MiLogger;
|
|
12
|
+
readonly grpcClient: StreamingClient;
|
|
13
|
+
constructor(grpcTransport: GrpcTransport, httpClient: Dispatcher, logger: MiLogger);
|
|
14
|
+
close(): void;
|
|
15
|
+
/** Reads text back and returns the text,
|
|
16
|
+
* the new offset
|
|
17
|
+
* and the total size of the (currently existing) file. */
|
|
18
|
+
lastLines({ id: rId, type: rType }: ResourceInfo, lineCount: number, offsetBytes?: bigint, // if 0n, then start from the end.
|
|
19
|
+
searchStr?: string, options?: RpcOptions): Promise<StreamingAPI_Response>;
|
|
20
|
+
/** Reads the file forward and returns the text,
|
|
21
|
+
* the new offset
|
|
22
|
+
* and the total size of the (currently existing) file. */
|
|
23
|
+
readText({ id: rId, type: rType }: ResourceInfo, lineCount: number, offsetBytes?: bigint, // if 0n, then start from the beginning.
|
|
24
|
+
searchStr?: string, options?: RpcOptions): Promise<StreamingAPI_Response>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/clients/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0FAA0F,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mFAAmF,CAAC;AAC1H,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,UAAU;aAIH,aAAa,EAAE,aAAa;aAC5B,UAAU,EAAE,UAAU;aACtB,MAAM,EAAE,QAAQ;IALlC,SAAgB,UAAU,EAAE,eAAe,CAAC;gBAG1B,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ;IAKlC,KAAK;IAEL;;8DAE0D;IAC7C,SAAS,CACpB,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,YAAY,EACtC,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,MAAW,EAAE,kCAAkC;IAC5D,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,qBAAqB,CAAC;IAcjC;;8DAE0D;IAC7C,QAAQ,CACnB,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,YAAY,EACtC,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,MAAW,EAAE,wCAAwC;IAClE,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,qBAAqB,CAAC;CAalC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
2
|
+
import { LsAPI_List_Response } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol';
|
|
3
|
+
import { GrpcTransport } from '@protobuf-ts/grpc-transport';
|
|
4
|
+
import { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
5
|
+
import { ResourceInfo } from '@milaboratories/pl-tree';
|
|
6
|
+
export declare class ClientLs {
|
|
7
|
+
private readonly logger;
|
|
8
|
+
private readonly grpcClient;
|
|
9
|
+
constructor(grpcTransport: GrpcTransport, logger: MiLogger);
|
|
10
|
+
close(): void;
|
|
11
|
+
list(rInfo: ResourceInfo, path: string, options?: RpcOptions): Promise<LsAPI_List_Response>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ls_api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls_api.d.ts","sourceRoot":"","sources":["../../src/clients/ls_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4EAA4E,CAAC;AAEtH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,QAAQ;IAKjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;gBAGpC,aAAa,EAAE,aAAa,EACX,MAAM,EAAE,QAAQ;IAKnC,KAAK;IAEQ,IAAI,CACf,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,mBAAmB,CAAC;CAShC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ProgressClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client';
|
|
2
|
+
import { GrpcTransport } from '@protobuf-ts/grpc-transport';
|
|
3
|
+
import { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
4
|
+
import { PlClient } from '@milaboratories/pl-client';
|
|
5
|
+
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
6
|
+
import { Dispatcher } from 'undici';
|
|
7
|
+
import { ResourceInfo } from '@milaboratories/pl-tree';
|
|
8
|
+
export type ProgressStatus = {
|
|
9
|
+
done: boolean;
|
|
10
|
+
progress: number;
|
|
11
|
+
bytesProcessed?: string;
|
|
12
|
+
bytesTotal?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class ClientProgress {
|
|
15
|
+
readonly grpcTransport: GrpcTransport;
|
|
16
|
+
readonly client: PlClient;
|
|
17
|
+
readonly logger: MiLogger;
|
|
18
|
+
readonly grpcClient: ProgressClient;
|
|
19
|
+
constructor(grpcTransport: GrpcTransport, _: Dispatcher, client: PlClient, logger: MiLogger);
|
|
20
|
+
close(): void;
|
|
21
|
+
/** getStatus gets a progress status by given rId and rType. */
|
|
22
|
+
getStatus({ id, type }: ResourceInfo, options?: RpcOptions): Promise<ProgressStatus>;
|
|
23
|
+
realtimeStatus({ id, type }: ResourceInfo, updateIntervalMs?: number, options?: RpcOptions): AsyncGenerator<import('../proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol').ProgressAPI_RealtimeStatus_Response, void, any>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/clients/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yFAAyF,CAAC;AACzH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAsB,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAY,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAMF,qBAAa,cAAc;aAIP,aAAa,EAAE,aAAa;aAE5B,MAAM,EAAE,QAAQ;aAChB,MAAM,EAAE,QAAQ;IANlC,SAAgB,UAAU,EAAE,cAAc,CAAC;gBAGzB,aAAa,EAAE,aAAa,EAC5C,CAAC,EAAE,UAAU,EACG,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,QAAQ;IAKlC,KAAK;IAEL,+DAA+D;IACzD,SAAS,CACb,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,cAAc,CAAC;IAkBnB,cAAc,CACnB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAC1B,gBAAgB,GAAE,MAAY,EAC9B,OAAO,CAAC,EAAE,UAAU;CA0BvB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GrpcTransport } from '@protobuf-ts/grpc-transport';
|
|
2
|
+
import { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
3
|
+
import { PlClient } from '@milaboratories/pl-client';
|
|
4
|
+
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
5
|
+
import { Dispatcher } from 'undici';
|
|
6
|
+
import { ResourceInfo } from '@milaboratories/pl-tree';
|
|
7
|
+
import * as fs from 'node:fs/promises';
|
|
8
|
+
export declare class MTimeError extends Error {
|
|
9
|
+
}
|
|
10
|
+
export declare class UnexpectedEOF extends Error {
|
|
11
|
+
}
|
|
12
|
+
export declare class NetworkError extends Error {
|
|
13
|
+
}
|
|
14
|
+
export declare class NoFileForUploading extends Error {
|
|
15
|
+
}
|
|
16
|
+
/** Low-level client for grpc uploadapi.
|
|
17
|
+
* The user should pass here a concrete BlobUpload/<storageId> resource,
|
|
18
|
+
* it can be got from handle field of BlobUpload. */
|
|
19
|
+
export declare class ClientUpload {
|
|
20
|
+
readonly grpcTransport: GrpcTransport;
|
|
21
|
+
readonly httpClient: Dispatcher;
|
|
22
|
+
readonly logger: MiLogger;
|
|
23
|
+
private readonly grpcClient;
|
|
24
|
+
constructor(grpcTransport: GrpcTransport, httpClient: Dispatcher, _: PlClient, logger: MiLogger);
|
|
25
|
+
close(): void;
|
|
26
|
+
initUpload({ id, type }: ResourceInfo, options?: RpcOptions): Promise<bigint[]>;
|
|
27
|
+
partUpload({ id, type }: ResourceInfo, path: string, partNumber: bigint, partsOverall: number, expectedMTimeUnix: bigint, options?: RpcOptions): Promise<void>;
|
|
28
|
+
finalizeUpload({ id, type }: ResourceInfo, options?: RpcOptions): Promise<import('@protobuf-ts/runtime-rpc').FinishedUnaryCall<import('../proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol').uploadapi_Finalize_Request, import('../proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol').uploadapi_Finalize_Response>>;
|
|
29
|
+
private readChunk;
|
|
30
|
+
/** Read len bytes from a given position. The reason the method exists
|
|
31
|
+
is that FileHandle.read can read less bytes than it's needed. */
|
|
32
|
+
readBytesFromPosition(f: fs.FileHandle, b: Buffer, len: number, position: number): Promise<number>;
|
|
33
|
+
/** Calculates parts that need to be uploaded from the parts that were
|
|
34
|
+
* already uploaded. */
|
|
35
|
+
private partsToUpload;
|
|
36
|
+
private prepareUploadOpts;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/clients/upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAsB,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAW,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,UAAW,SAAQ,KAAK;CAAG;AAExC,qBAAa,aAAc,SAAQ,KAAK;CAAG;AAE3C,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C,qBAAa,kBAAmB,SAAQ,KAAK;CAAG;AAEhD;;oDAEoD;AACpD,qBAAa,YAAY;aAIL,aAAa,EAAE,aAAa;aAC5B,UAAU,EAAE,UAAU;aAEtB,MAAM,EAAE,QAAQ;IANlC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;gBAGxB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtC,CAAC,EAAE,QAAQ,EACK,MAAM,EAAE,QAAQ;IAKlC,KAAK;IAEQ,UAAU,CACrB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,MAAM,EAAE,CAAC;IAQP,UAAU,CACrB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,UAAU;IAsDT,cAAc,CACzB,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,UAAU;YAQR,SAAS;IA4BvB;wEACoE;IAC9D,qBAAqB,CACzB,CAAC,EAAE,EAAE,CAAC,UAAU,EAChB,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM;IAmBlB;2BACuB;IACvB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,iBAAiB;CAa1B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ChangeSource, Computable, ComputableCtx, ComputableStableDefined, Watcher } from '@milaboratories/computable';
|
|
2
|
+
import { CallersCounter, MiLogger, Signer, ValueOrError } from '@milaboratories/ts-helpers';
|
|
3
|
+
import { ClientDownload } from '../clients/download';
|
|
4
|
+
import { ClientLogs } from '../clients/logs';
|
|
5
|
+
import { InferSnapshot, ResourceInfo, PlTreeEntry, ResourceSnapshot } from '@milaboratories/pl-tree';
|
|
6
|
+
import { AnyLogHandle, BlobDriver, LocalBlobHandle, LocalBlobHandleAndSize, ReadyLogHandle, RemoteBlobHandle, RemoteBlobHandleAndSize, StreamingApiResponse } from '@milaboratories/pl-model-common';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/** ResourceSnapshot that can be passed to OnDemandBlob */
|
|
9
|
+
export declare const OnDemandBlobResourceSnapshot: import('@milaboratories/pl-tree').ResourceSnapshotSchema<undefined, undefined, {
|
|
10
|
+
readonly 'ctl/file/blobInfo': z.ZodObject<{
|
|
11
|
+
sizeBytes: z.ZodNumber;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
sizeBytes: number;
|
|
14
|
+
}, {
|
|
15
|
+
sizeBytes: number;
|
|
16
|
+
}>;
|
|
17
|
+
}>;
|
|
18
|
+
export type OnDemandBlobResourceSnapshot = InferSnapshot<typeof OnDemandBlobResourceSnapshot>;
|
|
19
|
+
export type DownloadDriverOps = {
|
|
20
|
+
/**
|
|
21
|
+
* A soft limit of the amount of blob storage, in bytes.
|
|
22
|
+
* Once exceeded, the download driver will start deleting blobs one by one
|
|
23
|
+
* when they become unneeded.
|
|
24
|
+
* */
|
|
25
|
+
cacheSoftSizeBytes: number;
|
|
26
|
+
/**
|
|
27
|
+
* Max number of concurrent downloads while calculating computable states
|
|
28
|
+
* derived from this driver
|
|
29
|
+
* */
|
|
30
|
+
nConcurrentDownloads: number;
|
|
31
|
+
};
|
|
32
|
+
/** DownloadDriver holds a queue of downloading tasks,
|
|
33
|
+
* and notifies every watcher when a file were downloaded. */
|
|
34
|
+
export declare class DownloadDriver implements BlobDriver {
|
|
35
|
+
private readonly logger;
|
|
36
|
+
private readonly clientDownload;
|
|
37
|
+
private readonly clientLogs;
|
|
38
|
+
private readonly signer;
|
|
39
|
+
/** Represents a Resource Id to the path of a blob as a map. */
|
|
40
|
+
private idToDownload;
|
|
41
|
+
/** Writes and removes files to a hard drive and holds a counter for every
|
|
42
|
+
* file that should be kept. */
|
|
43
|
+
private cache;
|
|
44
|
+
/** Downloads files and writes them to the local dir. */
|
|
45
|
+
private downloadQueue;
|
|
46
|
+
private idToOnDemand;
|
|
47
|
+
private idToLastLines;
|
|
48
|
+
private idToProgressLog;
|
|
49
|
+
private readonly saveDir;
|
|
50
|
+
constructor(logger: MiLogger, clientDownload: ClientDownload, clientLogs: ClientLogs, saveDir: string, signer: Signer, ops: DownloadDriverOps);
|
|
51
|
+
/** Gets a blob by its resource id or downloads a blob and sets it in a cache.*/
|
|
52
|
+
getDownloadedBlob(res: ResourceInfo | PlTreeEntry, ctx: ComputableCtx): LocalBlobHandleAndSize | undefined;
|
|
53
|
+
getDownloadedBlob(res: ResourceInfo | PlTreeEntry): ComputableStableDefined<LocalBlobHandleAndSize>;
|
|
54
|
+
getOnDemandBlob(res: OnDemandBlobResourceSnapshot | PlTreeEntry): Computable<RemoteBlobHandleAndSize>;
|
|
55
|
+
getOnDemandBlob(res: OnDemandBlobResourceSnapshot | PlTreeEntry, ctx: ComputableCtx): RemoteBlobHandleAndSize;
|
|
56
|
+
getLocalPath(handle: LocalBlobHandle): string;
|
|
57
|
+
getContent(handle: LocalBlobHandle | RemoteBlobHandle): Promise<Uint8Array>;
|
|
58
|
+
private getDownloadedBlobNoCtx;
|
|
59
|
+
private setNewDownloadTask;
|
|
60
|
+
private downloadBlob;
|
|
61
|
+
private getOnDemandBlobNoCtx;
|
|
62
|
+
/** Returns all logs and schedules a job that reads remain logs.
|
|
63
|
+
* Notifies when a new portion of the log appeared. */
|
|
64
|
+
getLastLogs(res: ResourceInfo | PlTreeEntry, lines: number): Computable<string | undefined>;
|
|
65
|
+
getLastLogs(res: ResourceInfo | PlTreeEntry, lines: number, ctx: ComputableCtx): Computable<string | undefined>;
|
|
66
|
+
private getLastLogsNoCtx;
|
|
67
|
+
/** Returns a last line that has patternToSearch.
|
|
68
|
+
* Notifies when a new line appeared or EOF reached. */
|
|
69
|
+
getProgressLog(res: ResourceInfo | PlTreeEntry, patternToSearch: string): Computable<string | undefined>;
|
|
70
|
+
getProgressLog(res: ResourceInfo | PlTreeEntry, patternToSearch: string, ctx: ComputableCtx): string | undefined;
|
|
71
|
+
private getProgressLogNoCtx;
|
|
72
|
+
/** Returns an Id of a smart object, that can read logs directly from
|
|
73
|
+
* the platform. */
|
|
74
|
+
getLogHandle(res: ResourceInfo | PlTreeEntry): Computable<AnyLogHandle>;
|
|
75
|
+
getLogHandle(res: ResourceInfo | PlTreeEntry, ctx: ComputableCtx): AnyLogHandle;
|
|
76
|
+
private getLogHandleNoCtx;
|
|
77
|
+
lastLines(handle: ReadyLogHandle, lineCount: number, offsetBytes?: number, // if 0n, then start from the end.
|
|
78
|
+
searchStr?: string): Promise<StreamingApiResponse>;
|
|
79
|
+
readText(handle: ReadyLogHandle, lineCount: number, offsetBytes?: number, searchStr?: string): Promise<StreamingApiResponse>;
|
|
80
|
+
private releaseBlob;
|
|
81
|
+
private removeTask;
|
|
82
|
+
private releaseOnDemandBlob;
|
|
83
|
+
/** Removes all files from a hard drive. */
|
|
84
|
+
releaseAll(): Promise<void>;
|
|
85
|
+
private getFilePath;
|
|
86
|
+
}
|
|
87
|
+
export declare class Download {
|
|
88
|
+
readonly clientDownload: ClientDownload;
|
|
89
|
+
readonly rInfo: ResourceSnapshot;
|
|
90
|
+
readonly path: string;
|
|
91
|
+
readonly handle: LocalBlobHandle;
|
|
92
|
+
readonly counter: CallersCounter;
|
|
93
|
+
readonly change: ChangeSource;
|
|
94
|
+
readonly signalCtl: AbortController;
|
|
95
|
+
error: any | undefined;
|
|
96
|
+
done: boolean;
|
|
97
|
+
sizeBytes: number;
|
|
98
|
+
constructor(clientDownload: ClientDownload, rInfo: ResourceSnapshot, path: string, handle: LocalBlobHandle);
|
|
99
|
+
attach(w: Watcher, callerId: string): void;
|
|
100
|
+
download(): Promise<void>;
|
|
101
|
+
getBlob(): ValueOrError<LocalBlobHandleAndSize> | undefined;
|
|
102
|
+
private setDone;
|
|
103
|
+
abort(reason: string): void;
|
|
104
|
+
private setError;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=download_and_logs_blob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download_and_logs_blob.d.ts","sourceRoot":"","sources":["../../src/drivers/download_and_logs_blob.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,OAAO,EACR,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,QAAQ,EAER,MAAM,EACN,YAAY,EACb,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EACL,cAAc,EAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EAKX,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,0DAA0D;AAC1D,eAAO,MAAM,4BAA4B;;;;;;;;EAMvC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,aAAa,CACtD,OAAO,4BAA4B,CACpC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;SAIK;IACL,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;SAGK;IACL,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;6DAC6D;AAC7D,qBAAa,cAAe,YAAW,UAAU;IAmB7C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OA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B;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,eAAe;IAXlC,QAAQ,CAAC,OAAO,iBAAwB;IACxC,QAAQ,CAAC,MAAM,eAAsB;IACrC,QAAQ,CAAC,SAAS,kBAAyB;IAC3C,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;IACvB,IAAI,UAAS;IACb,SAAS,SAAK;gBAGH,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,eAAe;IAGlC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;IAK7B,QAAQ;IAqCd,OAAO,IAAI,YAAY,CAAC,sBAAsB,CAAC,GAAG,SAAS;IAmB3D,OAAO,CAAC,OAAO;IAMf,KAAK,CAAC,MAAM,EAAE,MAAM;IAIpB,OAAO,CAAC,QAAQ;CAIjB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CallersCounter, MiLogger } from '@milaboratories/ts-helpers';
|
|
2
|
+
import { ChangeSource, Computable, ComputableCtx, Watcher } from '@milaboratories/computable';
|
|
3
|
+
import { Dispatcher } from 'undici';
|
|
4
|
+
import { DownloadHelper } from '../helpers/download';
|
|
5
|
+
export interface DownloadUrlSyncReader {
|
|
6
|
+
/** Returns a Computable that (when the time will come)
|
|
7
|
+
* downloads an archive from an URL,
|
|
8
|
+
* extracts it to the local dir and returns a path to that dir. */
|
|
9
|
+
getPath(url: URL): Computable<PathResult | undefined>;
|
|
10
|
+
}
|
|
11
|
+
export interface PathResult {
|
|
12
|
+
/** Path to the downloadable blob, might be undefined when the error happened. */
|
|
13
|
+
path?: string;
|
|
14
|
+
/** Error that happened when the archive were downloaded. */
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export type DownloadUrlDriverOps = {
|
|
18
|
+
cacheSoftSizeBytes: number;
|
|
19
|
+
withGunzip: boolean;
|
|
20
|
+
nConcurrentDownloads: number;
|
|
21
|
+
};
|
|
22
|
+
/** Downloads .tar or .tar.gz archives by given URLs
|
|
23
|
+
* and extracts them into saveDir. */
|
|
24
|
+
export declare class DownloadUrlDriver implements DownloadUrlSyncReader {
|
|
25
|
+
private readonly logger;
|
|
26
|
+
private readonly saveDir;
|
|
27
|
+
private readonly opts;
|
|
28
|
+
private readonly downloadHelper;
|
|
29
|
+
private urlToDownload;
|
|
30
|
+
private downloadQueue;
|
|
31
|
+
/** Writes and removes files to a hard drive and holds a counter for every
|
|
32
|
+
* file that should be kept. */
|
|
33
|
+
private cache;
|
|
34
|
+
constructor(logger: MiLogger, httpClient: Dispatcher, saveDir: string, opts?: DownloadUrlDriverOps);
|
|
35
|
+
/** Use to get a path result inside a computable context */
|
|
36
|
+
getPath(url: URL, ctx: ComputableCtx): PathResult | undefined;
|
|
37
|
+
/** Returns a Computable that do the work */
|
|
38
|
+
getPath(url: URL): Computable<PathResult | undefined>;
|
|
39
|
+
getPathNoCtx(url: URL, w: Watcher, callerId: string): PathResult | undefined;
|
|
40
|
+
/** Downloads and extracts a tar archive if it wasn't downloaded yet. */
|
|
41
|
+
downloadUrl(task: Download, callerId: string): Promise<void>;
|
|
42
|
+
/** Removes a directory and aborts a downloading task when all callers
|
|
43
|
+
* are not interested in it. */
|
|
44
|
+
releasePath(url: URL, callerId: string): Promise<void>;
|
|
45
|
+
/** Removes all files from a hard drive. */
|
|
46
|
+
releaseAll(): Promise<void>;
|
|
47
|
+
private setNewTask;
|
|
48
|
+
private removeTask;
|
|
49
|
+
private getFilePath;
|
|
50
|
+
}
|
|
51
|
+
declare class Download {
|
|
52
|
+
readonly path: string;
|
|
53
|
+
readonly url: URL;
|
|
54
|
+
readonly counter: CallersCounter;
|
|
55
|
+
readonly change: ChangeSource;
|
|
56
|
+
readonly signalCtl: AbortController;
|
|
57
|
+
error: string | undefined;
|
|
58
|
+
done: boolean;
|
|
59
|
+
sizeBytes: number;
|
|
60
|
+
constructor(path: string, url: URL);
|
|
61
|
+
attach(w: Watcher, callerId: string): void;
|
|
62
|
+
download(clientDownload: DownloadHelper, withGunzip: boolean): Promise<void>;
|
|
63
|
+
private downloadAndUntar;
|
|
64
|
+
getPath(): PathResult | undefined;
|
|
65
|
+
private setDone;
|
|
66
|
+
abort(reason: string): void;
|
|
67
|
+
private setError;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=download_url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download_url.d.ts","sourceRoot":"","sources":["../../src/drivers/download_url.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EAGT,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,aAAa,EACb,OAAO,EACR,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC;;sEAEkE;IAClE,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,UAAU;IACzB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;qCACqC;AACrC,qBAAa,iBAAkB,YAAW,qBAAqB;IAW3D,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAbvB,OAAO,CAAC,QAAQ,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EAAE,UAAU,EAAE,OAAO;YAoBpD,gBAAgB;IA0B9B,OAAO,IAAI,UAAU,GAAG,SAAS;IAQjC,OAAO,CAAC,OAAO;IAMf,KAAK,CAAC,MAAM,EAAE,MAAM;IAIpB,OAAO,CAAC,QAAQ;CAIjB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CallersCounter } from '@milaboratories/ts-helpers';
|
|
2
|
+
type PathLike = string;
|
|
3
|
+
export interface CachedFile {
|
|
4
|
+
sizeBytes: number;
|
|
5
|
+
path: PathLike;
|
|
6
|
+
counter: CallersCounter;
|
|
7
|
+
}
|
|
8
|
+
/** Holds counters of how many callers need the file.
|
|
9
|
+
* If some counters become zero and a cache size exceeds a soft limit,
|
|
10
|
+
* remove not needed blobs one by one.
|
|
11
|
+
* If all the files are needed, do nothing. */
|
|
12
|
+
export declare class FilesCache<T extends CachedFile> {
|
|
13
|
+
private readonly softSizeBytes;
|
|
14
|
+
private cache;
|
|
15
|
+
private totalSizeBytes;
|
|
16
|
+
constructor(softSizeBytes: number);
|
|
17
|
+
existsFile(path: PathLike): boolean;
|
|
18
|
+
getFile(path: PathLike, callerId: string): T | undefined;
|
|
19
|
+
/** Decrements a counter in a cache and if we exceeds
|
|
20
|
+
* a soft limit, removes files with zero counters. */
|
|
21
|
+
removeFile(path: PathLike, callerId: string): T[];
|
|
22
|
+
/** Returns what results should be deleted to comply with the soft limit. */
|
|
23
|
+
toDelete(): T[];
|
|
24
|
+
addCache(file: T, callerId: string): void;
|
|
25
|
+
removeCache(file: T): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=files_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files_cache.d.ts","sourceRoot":"","sources":["../../../src/drivers/helpers/files_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,MAAM,4BAA4B,CAAC;AAEhF,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;8CAG8C;AAC9C,qBAAa,UAAU,CAAC,CAAC,SAAS,UAAU;IAI9B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAH1C,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,cAAc,CAAa;gBAEN,aAAa,EAAE,MAAM;IAElD,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAInC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IASxD;yDACqD;IACrD,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,EAAE;IAKjD,4EAA4E;IAC5E,QAAQ,IAAI,CAAC,EAAE;IAkBf,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM;IAUlC,WAAW,CAAC,IAAI,EAAE,CAAC;CAIpB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
2
|
+
import { ClientLogs } from '../../clients/logs';
|
|
3
|
+
import { PlClient, ResourceId, BasicResourceData } from '@milaboratories/pl-client';
|
|
4
|
+
import { ResourceInfo } from '@milaboratories/pl-tree';
|
|
5
|
+
/** It's an Updater but for tasks that happens in a while loop with sleeping between. */
|
|
6
|
+
export declare class LongUpdater {
|
|
7
|
+
private readonly onUpdate;
|
|
8
|
+
private readonly sleepMs;
|
|
9
|
+
private updater;
|
|
10
|
+
constructor(onUpdate: () => Promise<boolean>, sleepMs: number);
|
|
11
|
+
schedule: () => void;
|
|
12
|
+
}
|
|
13
|
+
/** Updater incorporates a pattern when someone wants to run a callback
|
|
14
|
+
* that updates something only when it's not already running. */
|
|
15
|
+
export declare class Updater {
|
|
16
|
+
private readonly onUpdate;
|
|
17
|
+
private updating;
|
|
18
|
+
constructor(onUpdate: () => Promise<void>);
|
|
19
|
+
schedule(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function getStream(client: PlClient, streamManagerId: ResourceId): Promise<BasicResourceData | undefined>;
|
|
22
|
+
export type MixcrProgressResponse = {
|
|
23
|
+
found: false;
|
|
24
|
+
} | ({
|
|
25
|
+
found: true;
|
|
26
|
+
} & MixcrProgressLine);
|
|
27
|
+
export type MixcrProgressLine = {
|
|
28
|
+
stage: string;
|
|
29
|
+
progress: string;
|
|
30
|
+
eta: string;
|
|
31
|
+
};
|
|
32
|
+
export declare function lineToProgress(line: string): MixcrProgressLine | undefined;
|
|
33
|
+
export declare function mixcrProgressFromLogs(rInfo: ResourceInfo, client: ClientLogs, options?: RpcOptions): Promise<MixcrProgressResponse>;
|
|
34
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/drivers/helpers/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,EAIlB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,wFAAwF;AACxF,qBAAa,WAAW;IAIpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,OAAO,CAAU;gBAGN,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAChC,OAAO,EAAE,MAAM;IAWlC,QAAQ,aAAiC;CAC1C;AAED;gEACgE;AAChE,qBAAa,OAAO;IAGN,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,QAAQ,CAA4B;gBAEf,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAE1D,QAAQ;CAaT;AAID,wBAAsB,SAAS,CAC7B,MAAM,EAAE,QAAQ,EAChB,eAAe,EAAE,UAAU,GAC1B,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAWxC;AAED,MAAM,MAAM,qBAAqB,GAC7B;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,GAChB,CAAC;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG,iBAAiB,CAAC,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAQF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAe1E;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAuBhC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MiLogger, Signer } from '@milaboratories/ts-helpers';
|
|
2
|
+
import { Timestamp } from '../../proto/google/protobuf/timestamp';
|
|
3
|
+
import { Dirent, Stats } from 'node:fs';
|
|
4
|
+
import * as sdk from '@milaboratories/pl-model-common';
|
|
5
|
+
/** A duck-typing interface for grpc results. */
|
|
6
|
+
export interface ListResponse {
|
|
7
|
+
items: ListItem[];
|
|
8
|
+
delimiter: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ListItem {
|
|
11
|
+
isDir: boolean;
|
|
12
|
+
name: string;
|
|
13
|
+
fullName: string;
|
|
14
|
+
lastModified?: Timestamp;
|
|
15
|
+
size: bigint;
|
|
16
|
+
directory: string;
|
|
17
|
+
}
|
|
18
|
+
/** */
|
|
19
|
+
export declare function toLsEntries(info: {
|
|
20
|
+
storageName: string;
|
|
21
|
+
list: ListResponse;
|
|
22
|
+
signer: Signer;
|
|
23
|
+
remote: boolean;
|
|
24
|
+
}): sdk.ListFilesResult;
|
|
25
|
+
export declare function toFileHandle(info: {
|
|
26
|
+
storageName: string;
|
|
27
|
+
item: ListItem;
|
|
28
|
+
signer: Signer;
|
|
29
|
+
remote: boolean;
|
|
30
|
+
}): sdk.ImportFileHandle;
|
|
31
|
+
export type UploadHandleData = {
|
|
32
|
+
/** Local file path, to take data for upload */
|
|
33
|
+
localPath: string;
|
|
34
|
+
/** Path signature, to check this data was generated by us */
|
|
35
|
+
pathSignature: string;
|
|
36
|
+
/** File size in bytes */
|
|
37
|
+
sizeBytes: string;
|
|
38
|
+
/** Modification time unix timestamp in seconds */
|
|
39
|
+
modificationTime: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function createUploadHandle(localPath: string, signer: Signer, sizeBytes: bigint, modificationTimeSeconds: bigint): sdk.ImportFileHandleUpload;
|
|
42
|
+
export declare function fromFileHandle(handle: sdk.ImportFileHandle): any;
|
|
43
|
+
export declare function toListItem(logger: MiLogger, info: {
|
|
44
|
+
directory: string;
|
|
45
|
+
fullName: string;
|
|
46
|
+
dirent: Dirent;
|
|
47
|
+
stat: Stats;
|
|
48
|
+
}): ListItem | undefined;
|
|
49
|
+
//# sourceMappingURL=ls_list_entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls_list_entry.d.ts","sourceRoot":"","sources":["../../../src/drivers/helpers/ls_list_entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAExC,gDA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;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,GACA,QAAQ,GAAG,SAAS,CAmBtB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ResourceId, ResourceType } from '@milaboratories/pl-client';
|
|
2
|
+
import * as sdk from '@milaboratories/pl-model-common';
|
|
3
|
+
/**
|
|
4
|
+
* Converts local and remote storages to StorageEntries.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toStorageEntry(locals: Record<string, string>, remotes: Record<string, ResourceId>): sdk.StorageEntry[];
|
|
7
|
+
export type StorageHandleData = RemoteStorageHandleData | LocalStorageHandleData;
|
|
8
|
+
/**
|
|
9
|
+
* Gets a storage handle and gives an underlying data from it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function fromStorageHandle(handle: sdk.StorageHandle): StorageHandleData;
|
|
12
|
+
export type LocalStorageHandleData = {
|
|
13
|
+
remote: false;
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function isLocalStorageHandle(handle: sdk.StorageHandle): handle is sdk.StorageHandleLocal;
|
|
18
|
+
export type RemoteStorageHandleData = {
|
|
19
|
+
remote: true;
|
|
20
|
+
name: string;
|
|
21
|
+
id: ResourceId;
|
|
22
|
+
type: ResourceType;
|
|
23
|
+
};
|
|
24
|
+
export declare function isRemoteStorageHandle(handle: sdk.StorageHandle): handle is sdk.StorageHandleRemote;
|
|
25
|
+
//# sourceMappingURL=ls_storage_entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls_storage_entry.d.ts","sourceRoot":"","sources":["../../../src/drivers/helpers/ls_storage_entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAEL,UAAU,EACV,YAAY,EACb,MAAM,2BAA2B,CAAC;AAGnC;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAClC,GAAG,CAAC,YAAY,EAAE,CAKpB;AAED,MAAM,MAAM,iBAAiB,GACzB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,GAAG,CAAC,aAAa,GACxB,iBAAiB,CAQnB;AAMD,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAYF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,GAAG,CAAC,aAAa,GACxB,MAAM,IAAI,GAAG,CAAC,kBAAkB,CAElC;AAwBD,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,UAAU,CAAC;IACf,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAYF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,GAAG,CAAC,aAAa,GACxB,MAAM,IAAI,GAAG,CAAC,mBAAmB,CAEnC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Generic settings for drivers that perform polling */
|
|
2
|
+
export type PollingOps = {
|
|
3
|
+
/** How frequent the driver should update exposed states from the backend. */
|
|
4
|
+
pollingInterval: number;
|
|
5
|
+
/** For how long to continue polling after the last derived computable value access. */
|
|
6
|
+
stopPollingDelay: number;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=polling_ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling_ops.d.ts","sourceRoot":"","sources":["../../../src/drivers/helpers/polling_ops.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG;IACvB,6EAA6E;IAC7E,eAAe,EAAE,MAAM,CAAC;IACxB,uFAAuF;IACvF,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_helpers.d.ts","sourceRoot":"","sources":["../../../src/drivers/helpers/test_helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,KAIzB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Computable, ComputableCtx } from '@milaboratories/computable';
|
|
2
|
+
import { PlTreeEntry, ResourceInfo } from '@milaboratories/pl-tree';
|
|
3
|
+
import { LogsStreamDriver } from './logs_stream';
|
|
4
|
+
import { DownloadDriver } from './download_and_logs_blob';
|
|
5
|
+
import * as sdk from '@milaboratories/pl-model-common';
|
|
6
|
+
export declare class LogsDriver implements sdk.LogsDriver {
|
|
7
|
+
private readonly logsStreamDriver;
|
|
8
|
+
private readonly downloadDriver;
|
|
9
|
+
constructor(logsStreamDriver: LogsStreamDriver, downloadDriver: DownloadDriver);
|
|
10
|
+
/** Returns all logs and schedules a job that reads remain logs.
|
|
11
|
+
* Notifies when a new portion of the log appeared. */
|
|
12
|
+
getLastLogs(res: PlTreeEntry, lines: number): Computable<string | undefined>;
|
|
13
|
+
getLastLogs(res: PlTreeEntry, lines: number, ctx: ComputableCtx): Computable<string | undefined>;
|
|
14
|
+
/** Returns a last line that has patternToSearch.
|
|
15
|
+
* Notifies when a new line appeared or EOF reached. */
|
|
16
|
+
getProgressLog(res: PlTreeEntry, patternToSearch: string): Computable<string | undefined>;
|
|
17
|
+
getProgressLog(res: PlTreeEntry, patternToSearch: string, ctx: ComputableCtx): string | undefined;
|
|
18
|
+
/** Returns an Id of a smart object, that can read logs directly from
|
|
19
|
+
* the platform. */
|
|
20
|
+
getLogHandle(res: ResourceInfo | PlTreeEntry): Computable<sdk.AnyLogHandle | undefined>;
|
|
21
|
+
getLogHandle(res: PlTreeEntry, ctx: ComputableCtx): sdk.AnyLogHandle | undefined;
|
|
22
|
+
lastLines(handle: sdk.AnyLogHandle, lineCount: number, offsetBytes?: number, searchStr?: string): Promise<sdk.StreamingApiResponse>;
|
|
23
|
+
readText(handle: sdk.AnyLogHandle, lineCount: number, offsetBytes?: number, searchStr?: string): Promise<sdk.StreamingApiResponse>;
|
|
24
|
+
}
|
|
25
|
+
export declare function handleToData(handle: sdk.AnyLogHandle): ResourceInfo;
|
|
26
|
+
export declare function dataToHandle(live: boolean, rInfo: ResourceInfo): sdk.AnyLogHandle;
|
|
27
|
+
export declare function isLiveLogHandle(handle: string): handle is sdk.LiveLogHandle;
|
|
28
|
+
export declare function isReadyLogHandle(handle: string): handle is sdk.ReadyLogHandle;
|
|
29
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/drivers/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AAEvD,qBAAa,UAAW,YAAW,GAAG,CAAC,UAAU;IAE7C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,cAAc;gBADd,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc;IAGjD;0DACsD;IACtD,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC;IAC5E,WAAW,CACT,GAAG,EAAE,W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