@milaboratories/pl-drivers 1.5.15 → 1.5.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/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-drivers",
3
- "version": "1.5.15",
3
+ "version": "1.5.16",
4
+ "engines": {
5
+ "node": ">=20"
6
+ },
4
7
  "description": "Drivers and a low-level clients for log streaming, downloading and uploading files from and to pl",
5
8
  "types": "./dist/index.d.ts",
6
9
  "main": "./dist/index.js",
@@ -28,10 +31,10 @@
28
31
  "undici": "^7.2.3",
29
32
  "zod": "~3.23.8",
30
33
  "@milaboratories/ts-helpers": "^1.1.3",
31
- "@milaboratories/pl-client": "^2.7.4",
32
34
  "@milaboratories/pl-tree": "^1.4.23",
35
+ "@milaboratories/computable": "^2.3.4",
33
36
  "@milaboratories/pl-model-common": "^1.10.5",
34
- "@milaboratories/computable": "^2.3.4"
37
+ "@milaboratories/pl-client": "^2.7.4"
35
38
  },
36
39
  "devDependencies": {
37
40
  "eslint": "^9.16.0",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable n/no-unsupported-features/node-builtins */
1
2
  import { addRTypeToMetadata } from '@milaboratories/pl-client';
2
3
  import type { ResourceInfo } from '@milaboratories/pl-tree';
3
4
  import type { MiLogger } from '@milaboratories/ts-helpers';
@@ -78,7 +78,7 @@ export class ClientProgress {
78
78
 
79
79
  yield * responses;
80
80
  } catch (e) {
81
- this.logger.warn('Failed to get realtime status' + e);
81
+ this.logger.warn('Failed to get realtime status' + String(e));
82
82
  throw e;
83
83
  }
84
84
  }
@@ -155,11 +155,11 @@ async function readFileChunk(path: string, chunkStart: bigint, chunkEnd: bigint)
155
155
  const bytesRead = await readBytesFromPosition(f, b, len, pos);
156
156
 
157
157
  return b.subarray(0, bytesRead);
158
- } catch (e: any) {
159
- if (e.code == 'ENOENT') throw new NoFileForUploading(`there is no file ${path} for uploading`);
158
+ } catch (e: unknown) {
159
+ if (e && typeof e === 'object' && ('code' in e) && e.code == 'ENOENT') throw new NoFileForUploading(`there is no file ${path} for uploading`);
160
160
  throw e;
161
161
  } finally {
162
- f?.close();
162
+ await f?.close();
163
163
  }
164
164
  }
165
165
 
@@ -199,7 +199,7 @@ function checkStatusCodeOk(
199
199
  if (statusCode != 200) {
200
200
  throw new NetworkError(
201
201
  `response is not ok, status code: ${statusCode},`
202
- + ` body: ${body}, headers: ${headers}, url: ${info.uploadUrl}`,
202
+ + ` body: ${body}, headers: ${JSON.stringify(headers)}, url: ${info.uploadUrl}`,
203
203
  );
204
204
  }
205
205
  }
@@ -1,3 +1,5 @@
1
+ // @TODO Gleb Zakharov
2
+ /* eslint-disable n/no-unsupported-features/node-builtins */
1
3
  import type { Dispatcher } from 'undici';
2
4
  import { request } from 'undici';
3
5
  import { Readable } from 'node:stream';
@@ -36,7 +38,7 @@ export class RemoteFileDownloader {
36
38
  }
37
39
  }
38
40
 
39
- async function checkStatusCodeOk(statusCode: number, webBody: ReadableStream<any>, url: string) {
41
+ async function checkStatusCodeOk(statusCode: number, webBody: ReadableStream, url: string) {
40
42
  if (statusCode != 200) {
41
43
  const beginning = (await text(webBody)).substring(0, 1000);
42
44