@hpcc-js/comms 3.14.0 → 3.14.2
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/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.umd.cjs +1 -1
- package/dist/browser/index.umd.cjs.map +1 -1
- package/dist/node/index.cjs +9 -9
- package/dist/node/index.cjs.map +3 -3
- package/dist/node/index.js +10 -10
- package/dist/node/index.js.map +3 -3
- package/package.json +7 -7
- package/src/connection.ts +8 -15
- package/src/index.node.ts +4 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/comms",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.2",
|
|
4
4
|
"description": "hpcc-js - Communications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.cjs",
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
"wsdl-all": "npm-run-all --aggregate-output -c --serial build --parallel wsdl-*"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@hpcc-js/util": "^3.4.
|
|
77
|
+
"@hpcc-js/util": "^3.4.6",
|
|
78
78
|
"@xmldom/xmldom": "0.9.8",
|
|
79
|
-
"undici": "7.
|
|
79
|
+
"undici": "7.19.1"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@hpcc-js/ddl-shim": "^3.2.
|
|
83
|
-
"@hpcc-js/esbuild-plugins": "^1.8.
|
|
82
|
+
"@hpcc-js/ddl-shim": "^3.2.5",
|
|
83
|
+
"@hpcc-js/esbuild-plugins": "^1.8.2",
|
|
84
84
|
"@kubernetes/client-node": "1.4.0",
|
|
85
85
|
"@types/d3-request": "1.0.9",
|
|
86
86
|
"@types/d3-time-format": "2.3.4",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"d3-format": "^1",
|
|
91
91
|
"d3-time-format": "^2",
|
|
92
92
|
"data-uri-to-buffer": "6.0.2",
|
|
93
|
-
"soap": "1.6.
|
|
93
|
+
"soap": "1.6.3",
|
|
94
94
|
"typescript-formatter": "^7.2.2"
|
|
95
95
|
},
|
|
96
96
|
"repository": {
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"esp",
|
|
111
111
|
"HPCC-Platform"
|
|
112
112
|
],
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "99595523fbe7b16b75fc22b03666b9f249257a50"
|
|
114
114
|
}
|
package/src/connection.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { join, promiseTimeout, scopedLogger, utf8ToBase64 } from "@hpcc-js/util";
|
|
1
|
+
import { join, promiseTimeout, root, scopedLogger, utf8ToBase64 } from "@hpcc-js/util";
|
|
2
2
|
|
|
3
3
|
const logger = scopedLogger("comms/connection.ts");
|
|
4
4
|
|
|
@@ -154,20 +154,12 @@ function doFetch(opts: IOptions, action: string, requestInit: RequestInit, heade
|
|
|
154
154
|
headers: headersInit
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
-
if (fetch["__setGlobalDispatcher"]) {
|
|
158
|
-
fetch["__setGlobalDispatcher"](fetch["__defaultAgent"]);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
157
|
if (opts.baseUrl.indexOf("https:") === 0) {
|
|
162
158
|
// NodeJS / node-fetch only ---
|
|
163
|
-
if (opts.rejectUnauthorized === false &&
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
requestInit["agent"] = fetch["__rejectUnauthorizedAgent"];
|
|
168
|
-
}
|
|
169
|
-
} else if (fetch["__trustwaveAgent"]) {
|
|
170
|
-
requestInit["agent"] = fetch["__trustwaveAgent"];
|
|
159
|
+
if (opts.rejectUnauthorized === false && root.__hpcc_rejectUnauthorizedAgent) {
|
|
160
|
+
requestInit["dispatcher"] = root.__hpcc_rejectUnauthorizedAgent;
|
|
161
|
+
} else if (root.__hpcc_trustwaveAgent) {
|
|
162
|
+
requestInit["agent"] = root.__hpcc_trustwaveAgent;
|
|
171
163
|
}
|
|
172
164
|
}
|
|
173
165
|
|
|
@@ -178,12 +170,13 @@ function doFetch(opts: IOptions, action: string, requestInit: RequestInit, heade
|
|
|
178
170
|
throw new Error(response.statusText);
|
|
179
171
|
}
|
|
180
172
|
|
|
181
|
-
|
|
173
|
+
const fetchOverride = root.__hpcc_undiciFetch ?? fetch;
|
|
174
|
+
return promiseTimeout(opts.timeoutSecs! * 1000, fetchOverride(join(opts.baseUrl, action), requestInit)
|
|
182
175
|
.then(handleResponse)
|
|
183
176
|
.catch(e => {
|
|
184
177
|
// Try again with the opposite credentials mode ---
|
|
185
178
|
requestInit.credentials = !_omitMap[opts.baseUrl] ? "omit" : "include";
|
|
186
|
-
return
|
|
179
|
+
return fetchOverride(join(opts.baseUrl, action), requestInit)
|
|
187
180
|
.then(handleResponse)
|
|
188
181
|
.then(responseBody => {
|
|
189
182
|
_omitMap[opts.baseUrl] = !_omitMap[opts.baseUrl]; // The "opposite" credentials mode is known to work ---
|
package/src/index.node.ts
CHANGED
|
@@ -6,19 +6,18 @@ root.DOMParser = DOMParser;
|
|
|
6
6
|
// fetch setup for Node.js ---
|
|
7
7
|
import * as https from "node:https";
|
|
8
8
|
import { Buffer } from "node:buffer";
|
|
9
|
-
import {
|
|
9
|
+
import { fetch, Agent } from "undici";
|
|
10
10
|
|
|
11
11
|
// NodeJS >= v18 has native fetch ---
|
|
12
12
|
if (root.fetch === undefined) {
|
|
13
13
|
throw new Error("@hpcc-js/comms requires Node.js >= 18.0.0 for native fetch support");
|
|
14
14
|
}
|
|
15
|
-
root.
|
|
16
|
-
root.
|
|
15
|
+
root.__hpcc_undiciFetch = fetch;
|
|
16
|
+
root.__hpcc_rejectUnauthorizedAgent = new Agent({
|
|
17
17
|
connect: {
|
|
18
18
|
rejectUnauthorized: false
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
root.fetch.__setGlobalDispatcher = setGlobalDispatcher;
|
|
22
21
|
|
|
23
22
|
import { trustwave } from "./pem/trustwave.ts";
|
|
24
23
|
|
|
@@ -38,7 +37,7 @@ if (https.globalAgent.options.ca !== undefined) {
|
|
|
38
37
|
globalCA += "\n";
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
root.
|
|
40
|
+
root.__hpcc_trustwaveAgent = new https.Agent({
|
|
42
41
|
ca: globalCA + trustwave
|
|
43
42
|
});
|
|
44
43
|
|