@milaboratories/pl-drivers 1.5.79 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1359 -1359
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/drivers/download_blob/download_blob.ts +5 -5
- package/src/drivers/download_blob/download_blob_task.ts +3 -3
- package/src/drivers/download_blob_url/driver.ts +2 -2
- package/src/drivers/download_blob_url/task.ts +3 -3
- package/src/drivers/download_url.ts +3 -3
- package/src/drivers/logs_stream.ts +2 -3
- package/src/drivers/upload_task.ts +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-drivers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"zod": "~3.23.8",
|
|
33
33
|
"upath": "^2.0.1",
|
|
34
34
|
"@milaboratories/ts-helpers": "^1.4.1",
|
|
35
|
-
"@milaboratories/
|
|
36
|
-
"@milaboratories/pl-tree": "^1.6.12",
|
|
35
|
+
"@milaboratories/computable": "^2.6.0",
|
|
37
36
|
"@milaboratories/helpers": "^1.6.17",
|
|
38
|
-
"@milaboratories/
|
|
39
|
-
"@milaboratories/pl-
|
|
37
|
+
"@milaboratories/pl-model-common": "^1.16.0",
|
|
38
|
+
"@milaboratories/pl-client": "^2.11.2",
|
|
39
|
+
"@milaboratories/pl-tree": "^1.7.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"eslint": "^9.25.1",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"vitest": "^2.1.9",
|
|
48
48
|
"@vitest/coverage-v8": "^2.1.9",
|
|
49
49
|
"@types/tar-fs": "^2.0.4",
|
|
50
|
-
"@milaboratories/
|
|
51
|
-
"@milaboratories/
|
|
50
|
+
"@milaboratories/build-configs": "1.0.4",
|
|
51
|
+
"@milaboratories/eslint-config": "^1.0.4"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"type-check": "tsc --noEmit --composite false",
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Computable,
|
|
9
9
|
} from '@milaboratories/computable';
|
|
10
10
|
import type { ResourceId, ResourceType } from '@milaboratories/pl-client';
|
|
11
|
-
import { stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
11
|
+
import { resourceIdToString, stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
12
12
|
import type {
|
|
13
13
|
AnyLogHandle,
|
|
14
14
|
BlobDriver,
|
|
@@ -563,7 +563,7 @@ export class DownloadDriver implements BlobDriver {
|
|
|
563
563
|
|
|
564
564
|
private removeTask(task: DownloadBlobTask, reason: string) {
|
|
565
565
|
task.abort(reason);
|
|
566
|
-
task.change.markChanged();
|
|
566
|
+
task.change.markChanged(`download task for ${task.path} removed: ${reason}`);
|
|
567
567
|
this.keyToDownload.delete(pathToKey(task.path));
|
|
568
568
|
this.idToLastLines.delete(blobKey(task.rInfo.id));
|
|
569
569
|
this.idToProgressLog.delete(blobKey(task.rInfo.id));
|
|
@@ -580,7 +580,7 @@ export class DownloadDriver implements BlobDriver {
|
|
|
580
580
|
|
|
581
581
|
this.keyToDownload.forEach((task, key) => {
|
|
582
582
|
this.keyToDownload.delete(key);
|
|
583
|
-
task.change.markChanged();
|
|
583
|
+
task.change.markChanged(`task ${resourceIdToString(task.rInfo.id)} released`);
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
}
|
|
@@ -639,14 +639,14 @@ class LastLinesGetter {
|
|
|
639
639
|
try {
|
|
640
640
|
const newLogs = await getLastLines(this.path, this.lines, this.patternToSearch);
|
|
641
641
|
|
|
642
|
-
if (this.log != newLogs) this.change.markChanged();
|
|
642
|
+
if (this.log != newLogs) this.change.markChanged(`logs for ${this.path} updated`);
|
|
643
643
|
this.log = newLogs;
|
|
644
644
|
} catch (e: any) {
|
|
645
645
|
if (e.name == 'RpcError' && e.code == 'NOT_FOUND') {
|
|
646
646
|
// No resource
|
|
647
647
|
this.log = '';
|
|
648
648
|
this.error = e;
|
|
649
|
-
this.change.markChanged();
|
|
649
|
+
this.change.markChanged(`log update for ${this.path} failed, resource not found`);
|
|
650
650
|
return;
|
|
651
651
|
}
|
|
652
652
|
|
|
@@ -19,7 +19,7 @@ import { Writable } from 'node:stream';
|
|
|
19
19
|
import type { ClientDownload } from '../../clients/download';
|
|
20
20
|
import { UnknownStorageError, WrongLocalFileUrl } from '../../clients/download';
|
|
21
21
|
import { NetworkError400 } from '../../helpers/download';
|
|
22
|
-
import { stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
22
|
+
import { resourceIdToString, stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
23
23
|
|
|
24
24
|
/** Downloads a blob and holds callers and watchers for the blob. */
|
|
25
25
|
export class DownloadBlobTask {
|
|
@@ -59,12 +59,12 @@ export class DownloadBlobTask {
|
|
|
59
59
|
try {
|
|
60
60
|
const size = await this.ensureDownloaded();
|
|
61
61
|
this.setDone(size);
|
|
62
|
-
this.change.markChanged();
|
|
62
|
+
this.change.markChanged(`blob download for ${resourceIdToString(this.rInfo.id)} finished`);
|
|
63
63
|
} catch (e: any) {
|
|
64
64
|
this.logger.error(`download blob ${stringifyWithResourceId(this.rInfo)} failed: ${e}, state: ${JSON.stringify(this.state)}`);
|
|
65
65
|
if (nonRecoverableError(e)) {
|
|
66
66
|
this.setError(e);
|
|
67
|
-
this.change.markChanged();
|
|
67
|
+
this.change.markChanged(`blob download for ${resourceIdToString(this.rInfo.id)} failed`);
|
|
68
68
|
// Just in case we were half-way extracting an archive.
|
|
69
69
|
await fsp.rm(this.path, { force: true });
|
|
70
70
|
}
|
|
@@ -10,7 +10,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
10
10
|
import * as path from 'node:path';
|
|
11
11
|
import { FilesCache } from '../helpers/files_cache';
|
|
12
12
|
import type { ResourceId } from '@milaboratories/pl-client';
|
|
13
|
-
import { stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
13
|
+
import { resourceIdToString, stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
14
14
|
import type { ArchiveFormat, BlobToURLDriver, FolderURL } from '@milaboratories/pl-model-common';
|
|
15
15
|
import type { DownloadableBlobSnapshot } from './snapshot';
|
|
16
16
|
import { makeDownloadableBlobSnapshot } from './snapshot';
|
|
@@ -215,7 +215,7 @@ export class DownloadBlobToURLDriver implements BlobToURLDriver {
|
|
|
215
215
|
|
|
216
216
|
private removeTask(task: DownloadAndUnarchiveTask, reason: string) {
|
|
217
217
|
task.abort(reason);
|
|
218
|
-
task.change.markChanged();
|
|
218
|
+
task.change.markChanged(`task for ${resourceIdToString(task.rInfo.id)} removed: ${reason}`);
|
|
219
219
|
this.idToDownload.delete(newId(task.rInfo.id, task.format));
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -15,7 +15,7 @@ import type { ArchiveFormat, FolderURL } from '@milaboratories/pl-model-common';
|
|
|
15
15
|
import { newFolderURL } from './url';
|
|
16
16
|
import decompress from 'decompress';
|
|
17
17
|
import { assertNever } from '@protobuf-ts/runtime';
|
|
18
|
-
import { stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
18
|
+
import { resourceIdToString, stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
19
19
|
|
|
20
20
|
export type URLResult = {
|
|
21
21
|
url?: FolderURL;
|
|
@@ -65,7 +65,7 @@ export class DownloadAndUnarchiveTask {
|
|
|
65
65
|
try {
|
|
66
66
|
const size = await this.downloadAndDecompress(this.signalCtl.signal);
|
|
67
67
|
this.setDone(size);
|
|
68
|
-
this.change.markChanged();
|
|
68
|
+
this.change.markChanged(`download and decompress for ${resourceIdToString(this.rInfo.id)} finished`);
|
|
69
69
|
|
|
70
70
|
this.logger.info(`blob to URL task is done: ${stringifyWithResourceId(this.info())}`);
|
|
71
71
|
} catch (e: any) {
|
|
@@ -73,7 +73,7 @@ export class DownloadAndUnarchiveTask {
|
|
|
73
73
|
|
|
74
74
|
if (nonRecoverableError(e)) {
|
|
75
75
|
this.setError(e);
|
|
76
|
-
this.change.markChanged();
|
|
76
|
+
this.change.markChanged(`download and decompress for ${resourceIdToString(this.rInfo.id)} failed`);
|
|
77
77
|
// Just in case we were half-way extracting an archive.
|
|
78
78
|
await rmRFDir(this.path);
|
|
79
79
|
return;
|
|
@@ -180,7 +180,7 @@ export class DownloadUrlDriver implements DownloadUrlSyncReader {
|
|
|
180
180
|
|
|
181
181
|
private removeTask(task: DownloadByUrlTask, reason: string) {
|
|
182
182
|
task.abort(reason);
|
|
183
|
-
task.change.markChanged();
|
|
183
|
+
task.change.markChanged(`task for url ${task.url} removed: ${reason}`);
|
|
184
184
|
this.urlToDownload.delete(task.url.toString());
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -224,11 +224,11 @@ class DownloadByUrlTask {
|
|
|
224
224
|
try {
|
|
225
225
|
const size = await this.downloadAndUntar(clientDownload, withGunzip, this.signalCtl.signal);
|
|
226
226
|
this.setDone(size);
|
|
227
|
-
this.change.markChanged();
|
|
227
|
+
this.change.markChanged(`download of ${this.url} finished`);
|
|
228
228
|
} catch (e: any) {
|
|
229
229
|
if (e instanceof URLAborted || e instanceof NetworkError400) {
|
|
230
230
|
this.setError(e);
|
|
231
|
-
this.change.markChanged();
|
|
231
|
+
this.change.markChanged(`download of ${this.url} failed`);
|
|
232
232
|
// Just in case we were half-way extracting an archive.
|
|
233
233
|
await rmRFDir(this.path);
|
|
234
234
|
return;
|
|
@@ -358,9 +358,8 @@ class LogGetter {
|
|
|
358
358
|
this.patternToSearch,
|
|
359
359
|
);
|
|
360
360
|
|
|
361
|
-
const newLogs = resp.data
|
|
362
|
-
|
|
363
|
-
if (this.logs != newLogs) this.change.markChanged();
|
|
361
|
+
const newLogs = new TextDecoder().decode(resp.data);
|
|
362
|
+
if (this.logs != newLogs) this.change.markChanged(`logs for ${resourceIdToString(this.rInfo.id)} updated`);
|
|
364
363
|
this.logs = newLogs;
|
|
365
364
|
this.error = undefined;
|
|
366
365
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Watcher } from '@milaboratories/computable';
|
|
2
2
|
import { ChangeSource } from '@milaboratories/computable';
|
|
3
|
-
import { stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
3
|
+
import { resourceIdToString, stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
4
4
|
import type * as sdk from '@milaboratories/pl-model-common';
|
|
5
5
|
import type { AsyncPoolController, MiLogger, Signer } from '@milaboratories/ts-helpers';
|
|
6
6
|
import { asyncPool, CallersCounter } from '@milaboratories/ts-helpers';
|
|
@@ -78,20 +78,20 @@ export class UploadTask {
|
|
|
78
78
|
maxSpeed: this.maxNConcurrentPartsUpload,
|
|
79
79
|
},
|
|
80
80
|
);
|
|
81
|
-
this.change.markChanged();
|
|
81
|
+
this.change.markChanged(`blob upload for ${resourceIdToString(this.res.id)} finished`);
|
|
82
82
|
} catch (e: any) {
|
|
83
83
|
this.setRetriableError(e);
|
|
84
84
|
|
|
85
85
|
if (isResourceWasDeletedError(e)) {
|
|
86
86
|
this.logger.warn(`resource was deleted while uploading a blob: ${e}`);
|
|
87
|
-
this.change.markChanged();
|
|
87
|
+
this.change.markChanged(`blob upload for ${resourceIdToString(this.res.id)} aborted, resource was deleted`);
|
|
88
88
|
this.setDone(true);
|
|
89
89
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
this.logger.error(`error while uploading a blob: ${e}`);
|
|
94
|
-
this.change.markChanged();
|
|
94
|
+
this.change.markChanged(`blob upload for ${resourceIdToString(this.res.id)} failed`);
|
|
95
95
|
|
|
96
96
|
if (nonRecoverableError(e)) {
|
|
97
97
|
this.setTerminalError(e);
|
|
@@ -118,7 +118,7 @@ export class UploadTask {
|
|
|
118
118
|
this.setDone(status.done);
|
|
119
119
|
|
|
120
120
|
if (status.done || this.progress.status.progress != oldStatus?.progress) {
|
|
121
|
-
this.change.markChanged();
|
|
121
|
+
this.change.markChanged(`upload status for ${resourceIdToString(this.res.id)} changed`);
|
|
122
122
|
}
|
|
123
123
|
} catch (e: any) {
|
|
124
124
|
this.setRetriableError(e);
|
|
@@ -132,7 +132,7 @@ export class UploadTask {
|
|
|
132
132
|
this.logger.warn(
|
|
133
133
|
`resource was not found while updating a status of BlobImport: ${e}, ${stringifyWithResourceId(this.res)}`,
|
|
134
134
|
);
|
|
135
|
-
this.change.markChanged();
|
|
135
|
+
this.change.markChanged(`upload status for ${resourceIdToString(this.res.id)} changed, resource not found`);
|
|
136
136
|
this.setDone(true);
|
|
137
137
|
return;
|
|
138
138
|
}
|