@nxtedition/lib 19.0.39 → 19.0.40
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 +5 -5
- package/s3.js +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.40",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"/__tests__"
|
|
76
76
|
],
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@aws-sdk/client-s3": "^3.
|
|
79
|
-
"@elastic/elasticsearch": "^8.13.
|
|
78
|
+
"@aws-sdk/client-s3": "^3.552.0",
|
|
79
|
+
"@elastic/elasticsearch": "^8.13.1",
|
|
80
80
|
"@elastic/transport": "^8.5.0",
|
|
81
81
|
"@nxtedition/nxt-undici": "^2.0.45",
|
|
82
82
|
"date-fns": "^3.6.0",
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@nxtedition/deepstream.io-client-js": ">=24.1.20",
|
|
108
108
|
"@types/lodash": "^4.17.0",
|
|
109
|
-
"@types/node": "^20.12.
|
|
110
|
-
"eslint": "^
|
|
109
|
+
"@types/node": "^20.12.7",
|
|
110
|
+
"eslint": "^8.0.0",
|
|
111
111
|
"eslint-config-prettier": "^9.1.0",
|
|
112
112
|
"eslint-config-standard": "^17.0.0",
|
|
113
113
|
"eslint-plugin-import": "^2.29.1",
|
package/s3.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import crypto from 'node:crypto'
|
|
2
2
|
import stream from 'node:stream'
|
|
3
|
+
import assert from 'node:assert'
|
|
3
4
|
import AWS from '@aws-sdk/client-s3'
|
|
4
5
|
import PQueue from 'p-queue'
|
|
5
6
|
|
|
@@ -22,7 +23,7 @@ export async function upload({
|
|
|
22
23
|
throw new Error('Invalid partSize')
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
if (!Number.isFinite(queueSize) || queueSize <= 0) {
|
|
26
|
+
if (!Number.isFinite(queueSize) || queueSize <= 0 || queueSize > 32) {
|
|
26
27
|
throw new Error('Invalid queueSize')
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -43,6 +44,8 @@ export async function upload({
|
|
|
43
44
|
const queue = new PQueue({ concurrency: queueSize })
|
|
44
45
|
const promises = []
|
|
45
46
|
|
|
47
|
+
assert(queue.concurrency > 0 && queue.concurrency <= 32)
|
|
48
|
+
|
|
46
49
|
let uploadId
|
|
47
50
|
try {
|
|
48
51
|
const multipartUploadOutput = await s3.send(
|
|
@@ -126,7 +129,7 @@ export async function upload({
|
|
|
126
129
|
.catch((err) => ({ error: err })),
|
|
127
130
|
)
|
|
128
131
|
|
|
129
|
-
return queue.onEmpty()
|
|
132
|
+
return queue.size > 0 ? queue.onEmpty() : null
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
for await (const chunk of Body) {
|