@nxtedition/lib 15.0.58 → 15.1.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/package.json +6 -5
- package/serializers.js +8 -0
- package/util/template/javascript.js +21 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "15.0
|
|
3
|
+
"version": "15.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"files": [
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"/__tests__"
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
|
+
"@nxtedition/nxt-undici": "^1.4.3",
|
|
75
76
|
"date-fns": "^2.29.3",
|
|
76
77
|
"fast-querystring": "^1.1.1",
|
|
77
78
|
"hasha": "^5.2.2",
|
|
@@ -90,16 +91,16 @@
|
|
|
90
91
|
"smpte-timecode": "^1.3.3",
|
|
91
92
|
"split-string": "^6.0.0",
|
|
92
93
|
"toobusy-js": "^0.5.1",
|
|
93
|
-
"undici": "^5.27.
|
|
94
|
+
"undici": "^5.27.2",
|
|
94
95
|
"url-join": "^4.0.0"
|
|
95
96
|
},
|
|
96
97
|
"devDependencies": {
|
|
97
98
|
"@types/node": "^20.8.10",
|
|
98
|
-
"eslint": "^8.
|
|
99
|
+
"eslint": "^8.53.0",
|
|
99
100
|
"eslint-config-prettier": "^9.0.0",
|
|
100
101
|
"eslint-config-standard": "^17.0.0",
|
|
101
102
|
"eslint-plugin-import": "^2.29.0",
|
|
102
|
-
"eslint-plugin-n": "^16.
|
|
103
|
+
"eslint-plugin-n": "^16.3.0",
|
|
103
104
|
"eslint-plugin-node": "^11.1.0",
|
|
104
105
|
"eslint-plugin-promise": "^6.0.0",
|
|
105
106
|
"husky": "^8.0.3",
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"prettier": "^3.0.3",
|
|
109
110
|
"rxjs": "^7.5.6",
|
|
110
111
|
"send": "^0.18.0",
|
|
111
|
-
"tap": "^18.5.
|
|
112
|
+
"tap": "^18.5.7"
|
|
112
113
|
},
|
|
113
114
|
"peerDependencies": {
|
|
114
115
|
"@elastic/elasticsearch": "^8.6.0",
|
package/serializers.js
CHANGED
|
@@ -40,8 +40,16 @@ module.exports = {
|
|
|
40
40
|
err = err.length === 1 ? err[0] : new AggregateError(err)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
if (err == null) {
|
|
44
|
+
return undefined
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
const ret = serializers.err(err)
|
|
44
48
|
|
|
49
|
+
if (ret == null) {
|
|
50
|
+
return undefined
|
|
51
|
+
}
|
|
52
|
+
|
|
45
53
|
if (ret.data !== null && typeof ret.data === 'object') {
|
|
46
54
|
ret.data = JSON.stringify(ret.data)
|
|
47
55
|
}
|
|
@@ -5,6 +5,7 @@ const vm = require('node:vm')
|
|
|
5
5
|
const objectHash = require('object-hash')
|
|
6
6
|
const datefns = require('date-fns')
|
|
7
7
|
const JSON5 = require('json5')
|
|
8
|
+
const { request } = require('@nxtedition/nxt-undici')
|
|
8
9
|
const undici = require('undici')
|
|
9
10
|
|
|
10
11
|
const kSuspend = Symbol('kSuspend')
|
|
@@ -26,6 +27,11 @@ class TimerEntry {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
const fetchClient = new undici.Agent({
|
|
31
|
+
connections: 128,
|
|
32
|
+
pipelining: 8,
|
|
33
|
+
})
|
|
34
|
+
|
|
29
35
|
class FetchEntry {
|
|
30
36
|
constructor(key, refresh, { resource, options }) {
|
|
31
37
|
this.key = key
|
|
@@ -38,26 +44,25 @@ class FetchEntry {
|
|
|
38
44
|
this.status = null
|
|
39
45
|
this.error = null
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.fetch(resource, { ...options, signal: this.signal })
|
|
47
|
+
request(resource, {
|
|
48
|
+
...options,
|
|
49
|
+
signal: this.signal,
|
|
50
|
+
dispatcher: fetchClient,
|
|
51
|
+
})
|
|
47
52
|
.then(async (res) => {
|
|
48
|
-
|
|
53
|
+
try {
|
|
49
54
|
// TODO (fix): max size...
|
|
50
|
-
this.body = Buffer.from(await res.arrayBuffer())
|
|
51
55
|
this.status = res.status
|
|
52
56
|
this.headers = res.headers
|
|
53
|
-
this.
|
|
57
|
+
this.body = await res.text()
|
|
58
|
+
} catch (err) {
|
|
59
|
+
this.error = err
|
|
54
60
|
}
|
|
61
|
+
this.refresh()
|
|
55
62
|
})
|
|
56
63
|
.catch((err) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.refresh()
|
|
60
|
-
}
|
|
64
|
+
this.error = err
|
|
65
|
+
this.refresh()
|
|
61
66
|
})
|
|
62
67
|
}
|
|
63
68
|
|
|
@@ -143,7 +148,7 @@ class PromiseEntry {
|
|
|
143
148
|
this.error = err
|
|
144
149
|
this.refresh()
|
|
145
150
|
}
|
|
146
|
-
}
|
|
151
|
+
},
|
|
147
152
|
)
|
|
148
153
|
}
|
|
149
154
|
|
|
@@ -342,7 +347,7 @@ module.exports = ({ ds, proxify, compiler }) => {
|
|
|
342
347
|
Object.assign(new Error('expression failed'), {
|
|
343
348
|
cause: err,
|
|
344
349
|
data: self._expression,
|
|
345
|
-
})
|
|
350
|
+
}),
|
|
346
351
|
)
|
|
347
352
|
} finally {
|
|
348
353
|
compiler.current = previous
|
|
@@ -518,7 +523,7 @@ module.exports = ({ ds, proxify, compiler }) => {
|
|
|
518
523
|
const data = this._getRecord(
|
|
519
524
|
id + ':asset.rawTypes?',
|
|
520
525
|
state ?? ds.record.PROVIDER,
|
|
521
|
-
suspend ?? true
|
|
526
|
+
suspend ?? true,
|
|
522
527
|
)
|
|
523
528
|
return data && Array.isArray(data.value) && data.value.includes(type) ? id : null
|
|
524
529
|
}
|