teraslice 0.86.4 → 0.87.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/lib/cluster/services/api.js +14 -8
- package/package.json +2 -1
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { Router } = require('express');
|
|
4
4
|
const bodyParser = require('body-parser');
|
|
5
|
-
const
|
|
6
|
-
const { promisify } = require('util');
|
|
7
|
-
const got = require('got');
|
|
5
|
+
const { pipeline: streamPipeline } = require('node:stream/promises');
|
|
8
6
|
const { RecoveryCleanupType } = require('@terascope/job-components');
|
|
9
7
|
const {
|
|
10
8
|
parseErrorInfo, parseList, logError, TSError, startsWith
|
|
@@ -20,7 +18,14 @@ const {
|
|
|
20
18
|
} = require('../../utils/api_utils');
|
|
21
19
|
const terasliceVersion = require('../../../package.json').version;
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
let gotESMModule;
|
|
22
|
+
|
|
23
|
+
async function getGotESM() {
|
|
24
|
+
if (gotESMModule) return gotESMModule;
|
|
25
|
+
const module = await import('gotESM'); // eslint-disable-line
|
|
26
|
+
gotESMModule = module.default;
|
|
27
|
+
return module.default;
|
|
28
|
+
}
|
|
24
29
|
|
|
25
30
|
module.exports = function apiService(context, { assetsUrl, app }) {
|
|
26
31
|
const clusterConfig = context.sysconfig.teraslice;
|
|
@@ -488,23 +493,24 @@ module.exports = function apiService(context, { assetsUrl, app }) {
|
|
|
488
493
|
}
|
|
489
494
|
|
|
490
495
|
async function _redirect(req, res) {
|
|
496
|
+
const module = await getGotESM();
|
|
491
497
|
const options = {
|
|
492
498
|
prefixUrl: assetsUrl,
|
|
493
499
|
headers: req.headers,
|
|
494
500
|
searchParams: req.query,
|
|
495
501
|
throwHttpErrors: false,
|
|
496
|
-
timeout: clusterConfig.api_response_timeout,
|
|
502
|
+
timeout: { request: clusterConfig.api_response_timeout },
|
|
497
503
|
decompress: false,
|
|
498
|
-
retry: 0
|
|
504
|
+
retry: { limit: 0 }
|
|
499
505
|
};
|
|
500
506
|
|
|
501
507
|
const uri = req.url.replace(/^\//, '');
|
|
502
508
|
const method = req.method.toLowerCase();
|
|
503
509
|
|
|
504
510
|
try {
|
|
505
|
-
await
|
|
511
|
+
await streamPipeline(
|
|
506
512
|
req,
|
|
507
|
-
|
|
513
|
+
module.stream[method](uri, options),
|
|
508
514
|
res,
|
|
509
515
|
);
|
|
510
516
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teraslice",
|
|
3
3
|
"displayName": "Teraslice",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.87.0",
|
|
5
5
|
"description": "Distributed computing platform for processing JSON data",
|
|
6
6
|
"homepage": "https://github.com/terascope/teraslice#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"fs-extra": "^11.1.1",
|
|
57
57
|
"gc-stats": "^1.4.0",
|
|
58
58
|
"got": "^11.8.3",
|
|
59
|
+
"gotESM": "npm:got@^13.0.0",
|
|
59
60
|
"ip": "^1.1.8",
|
|
60
61
|
"kubernetes-client": "^9.0.0",
|
|
61
62
|
"lodash": "^4.17.21",
|