@nxtedition/lib 26.4.3 → 26.4.5
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 +12 -12
- package/rxjs/auditMap.js +27 -1
- package/rxjs/auditMap.test.js +64 -0
- package/s3.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "26.4.
|
|
3
|
+
"version": "26.4.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -64,18 +64,18 @@
|
|
|
64
64
|
"singleQuote": true
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aws-sdk/client-s3": "3.
|
|
67
|
+
"@aws-sdk/client-s3": "3.901.0",
|
|
68
68
|
"@elastic/elasticsearch": "^8.17.1",
|
|
69
69
|
"@elastic/transport": "^8.9.3",
|
|
70
70
|
"@nxtedition/nxt-undici": "^6.4.0",
|
|
71
71
|
"@nxtedition/sched": "^1.0.2",
|
|
72
|
-
"@smithy/node-http-handler": "^4.
|
|
72
|
+
"@smithy/node-http-handler": "^4.3.0",
|
|
73
73
|
"acorn": "^8.15.0",
|
|
74
74
|
"astring": "^1.9.0",
|
|
75
75
|
"date-fns": "^4.1.0",
|
|
76
76
|
"diff": "5.2.0",
|
|
77
77
|
"fast-querystring": "^1.1.2",
|
|
78
|
-
"hasha": "^
|
|
78
|
+
"hasha": "^7.0.0",
|
|
79
79
|
"http-errors": "^2.0.0",
|
|
80
80
|
"json5": "^2.2.3",
|
|
81
81
|
"lodash": "^4.17.21",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"moment-timezone": "^0.5.48",
|
|
86
86
|
"nconf": "^0.13.0",
|
|
87
87
|
"object-hash": "^3.0.0",
|
|
88
|
-
"p-queue": "^
|
|
89
|
-
"pino": "^
|
|
88
|
+
"p-queue": "^9.0.0",
|
|
89
|
+
"pino": "^10.0.0",
|
|
90
90
|
"qs": "^6.14.0",
|
|
91
91
|
"request-target": "^1.0.2",
|
|
92
92
|
"smpte-timecode": "^1.3.6",
|
|
@@ -96,11 +96,11 @@
|
|
|
96
96
|
"yocto-queue": "^1.2.1"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@nxtedition/deepstream.io-client-js": ">=31.0.
|
|
99
|
+
"@nxtedition/deepstream.io-client-js": ">=31.0.18",
|
|
100
100
|
"@types/lodash": "^4.17.20",
|
|
101
|
-
"@types/node": "^24.
|
|
101
|
+
"@types/node": "^24.7.0",
|
|
102
102
|
"canvas": "^3.1.0",
|
|
103
|
-
"eslint": "^9.
|
|
103
|
+
"eslint": "^9.37.0",
|
|
104
104
|
"eslint-config-prettier": "^10.1.8",
|
|
105
105
|
"eslint-config-standard": "^17.0.0",
|
|
106
106
|
"eslint-plugin-import": "^2.32.0",
|
|
@@ -108,11 +108,11 @@
|
|
|
108
108
|
"eslint-plugin-node": "^11.1.0",
|
|
109
109
|
"eslint-plugin-promise": "^7.2.1",
|
|
110
110
|
"husky": "^9.1.7",
|
|
111
|
-
"lint-staged": "^16.2.
|
|
111
|
+
"lint-staged": "^16.2.3",
|
|
112
112
|
"prettier": "^3.6.2",
|
|
113
113
|
"rxjs": "^7.8.2",
|
|
114
|
-
"typescript": "^5.9.
|
|
115
|
-
"typescript-eslint": "^8.
|
|
114
|
+
"typescript": "^5.9.3",
|
|
115
|
+
"typescript-eslint": "^8.46.0"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"@elastic/elasticsearch": "^8.6.0",
|
package/rxjs/auditMap.js
CHANGED
|
@@ -5,6 +5,7 @@ function auditMapImpl(project) {
|
|
|
5
5
|
let pendingValue = null
|
|
6
6
|
let hasPendingValue = false
|
|
7
7
|
let isComplete = false
|
|
8
|
+
let abortController = null
|
|
8
9
|
|
|
9
10
|
let innerSubscription = null
|
|
10
11
|
let outerSubscription = null
|
|
@@ -15,6 +16,7 @@ function auditMapImpl(project) {
|
|
|
15
16
|
|
|
16
17
|
function _innerComplete() {
|
|
17
18
|
innerSubscription = null
|
|
19
|
+
abortController = null
|
|
18
20
|
|
|
19
21
|
if (hasPendingValue) {
|
|
20
22
|
const value = pendingValue
|
|
@@ -30,9 +32,30 @@ function auditMapImpl(project) {
|
|
|
30
32
|
o.next(val)
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
function _drain() {
|
|
36
|
+
if (!hasPendingValue) {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
const value = pendingValue
|
|
40
|
+
pendingValue = null
|
|
41
|
+
hasPendingValue = false
|
|
42
|
+
return { value }
|
|
43
|
+
}
|
|
44
|
+
|
|
33
45
|
function _tryNext(value) {
|
|
34
46
|
try {
|
|
35
|
-
const result = project(value
|
|
47
|
+
const result = project(value, {
|
|
48
|
+
get signal() {
|
|
49
|
+
if (!abortController) {
|
|
50
|
+
abortController = new AbortController()
|
|
51
|
+
if (hasPendingValue) {
|
|
52
|
+
abortController.abort()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return abortController.signal
|
|
56
|
+
},
|
|
57
|
+
_drain,
|
|
58
|
+
})
|
|
36
59
|
const observable = typeof result.then === 'function' ? from(result) : result
|
|
37
60
|
innerSubscription = observable.subscribe({
|
|
38
61
|
next: _innerNext,
|
|
@@ -51,6 +74,7 @@ function auditMapImpl(project) {
|
|
|
51
74
|
if (innerSubscription) {
|
|
52
75
|
pendingValue = value
|
|
53
76
|
hasPendingValue = true
|
|
77
|
+
abortController?.abort()
|
|
54
78
|
} else {
|
|
55
79
|
_tryNext(value)
|
|
56
80
|
}
|
|
@@ -60,6 +84,8 @@ function auditMapImpl(project) {
|
|
|
60
84
|
isComplete = true
|
|
61
85
|
if (!innerSubscription) {
|
|
62
86
|
o.complete()
|
|
87
|
+
} else {
|
|
88
|
+
abortController?.abort()
|
|
63
89
|
}
|
|
64
90
|
}
|
|
65
91
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { test } from 'node:test'
|
|
2
|
+
import assert from 'node:assert'
|
|
3
|
+
import auditMap from './auditMap.js'
|
|
4
|
+
import * as rxjs from 'rxjs'
|
|
5
|
+
import tp from 'node:timers/promises'
|
|
6
|
+
|
|
7
|
+
test('auditMap sync', (t) => {
|
|
8
|
+
t.plan(1, { wait: true })
|
|
9
|
+
rxjs
|
|
10
|
+
.of(1, 2, 3)
|
|
11
|
+
.pipe(
|
|
12
|
+
auditMap((val) => rxjs.of(val * 2)),
|
|
13
|
+
rxjs.toArray(),
|
|
14
|
+
)
|
|
15
|
+
.subscribe((val) => {
|
|
16
|
+
t.assert.deepStrictEqual(val, [2, 4, 6])
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('auditMap async', (t) => {
|
|
21
|
+
t.plan(1, { wait: true })
|
|
22
|
+
rxjs
|
|
23
|
+
.of(1, 2, 3)
|
|
24
|
+
.pipe(
|
|
25
|
+
auditMap(async (val) => val * 2),
|
|
26
|
+
rxjs.toArray(),
|
|
27
|
+
)
|
|
28
|
+
.subscribe((val) => {
|
|
29
|
+
t.assert.deepStrictEqual(val, [2, 6])
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('auditMap drain', (t) => {
|
|
34
|
+
t.plan(1, { wait: true })
|
|
35
|
+
rxjs
|
|
36
|
+
.of(1, 2, 3)
|
|
37
|
+
.pipe(
|
|
38
|
+
auditMap(async (val, { _drain }) => {
|
|
39
|
+
await tp.setTimeout(1)
|
|
40
|
+
return _drain()?.value ?? val
|
|
41
|
+
}),
|
|
42
|
+
rxjs.toArray(),
|
|
43
|
+
)
|
|
44
|
+
.subscribe((val) => {
|
|
45
|
+
t.assert.deepStrictEqual(val, [3])
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('auditMap signal', (t) => {
|
|
50
|
+
t.plan(1, { wait: true })
|
|
51
|
+
rxjs
|
|
52
|
+
.of(1, 2, 3)
|
|
53
|
+
.pipe(
|
|
54
|
+
auditMap(async (val, { signal }) => {
|
|
55
|
+
await tp.setTimeout(1)
|
|
56
|
+
assert.strictEqual(signal.aborted, val === 1)
|
|
57
|
+
return val
|
|
58
|
+
}),
|
|
59
|
+
rxjs.toArray(),
|
|
60
|
+
)
|
|
61
|
+
.subscribe((val) => {
|
|
62
|
+
t.assert.deepStrictEqual(val, [1, 3])
|
|
63
|
+
})
|
|
64
|
+
})
|
package/s3.js
CHANGED
|
@@ -327,7 +327,16 @@ function getTransformedHeaders(headers) {
|
|
|
327
327
|
*/
|
|
328
328
|
const transformedHeaders = {}
|
|
329
329
|
|
|
330
|
+
const isRangedResponse = headers['content-range'] != null
|
|
331
|
+
|
|
330
332
|
for (const name of Object.keys(headers)) {
|
|
333
|
+
// Google Cloud S3 returns checksums for the full object
|
|
334
|
+
// even with range requests, which causes checksum mismatches.
|
|
335
|
+
// I assume the checksum headers shouldn't be sent with ranged responses.
|
|
336
|
+
if (isRangedResponse && /^x-amz-checksum-/i.test(name)) {
|
|
337
|
+
continue
|
|
338
|
+
}
|
|
339
|
+
|
|
331
340
|
const headerValues = headers[name]
|
|
332
341
|
transformedHeaders[name] = Array.isArray(headerValues)
|
|
333
342
|
? headerValues.join(',')
|