@hpcc-js/comms 3.13.0 → 3.14.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/comms",
3
- "version": "3.13.0",
3
+ "version": "3.14.1",
4
4
  "description": "hpcc-js - Communications",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.cjs",
@@ -74,15 +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.4",
77
+ "@hpcc-js/util": "^3.4.5",
78
78
  "@xmldom/xmldom": "0.9.8",
79
- "abort-controller": "3.0.0",
80
- "node-fetch": "3.3.2",
81
- "undici": "7.16.0"
79
+ "undici": "7.19.1"
82
80
  },
83
81
  "devDependencies": {
84
- "@hpcc-js/ddl-shim": "^3.2.3",
85
- "@hpcc-js/esbuild-plugins": "^1.8.0",
82
+ "@hpcc-js/ddl-shim": "^3.2.4",
83
+ "@hpcc-js/esbuild-plugins": "^1.8.1",
86
84
  "@kubernetes/client-node": "1.4.0",
87
85
  "@types/d3-request": "1.0.9",
88
86
  "@types/d3-time-format": "2.3.4",
@@ -92,7 +90,7 @@
92
90
  "d3-format": "^1",
93
91
  "d3-time-format": "^2",
94
92
  "data-uri-to-buffer": "6.0.2",
95
- "soap": "1.6.0",
93
+ "soap": "1.6.3",
96
94
  "typescript-formatter": "^7.2.2"
97
95
  },
98
96
  "repository": {
@@ -112,5 +110,5 @@
112
110
  "esp",
113
111
  "HPCC-Platform"
114
112
  ],
115
- "gitHead": "70194f16ed27ea1167af126b35cbf4af5f181be9"
113
+ "gitHead": "cdd52de0cb8b157acefb4cea23895268d8127570"
116
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 && fetch["__rejectUnauthorizedAgent"]) {
164
- if (fetch["__setGlobalDispatcher"]) {
165
- fetch["__setGlobalDispatcher"](fetch["__rejectUnauthorizedAgent"]);
166
- } else {
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
- return promiseTimeout(opts.timeoutSecs! * 1000, fetch(join(opts.baseUrl, action), requestInit)
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 fetch(join(opts.baseUrl, action), requestInit)
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 ---
@@ -326,6 +326,7 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
326
326
  get FileAccessCost(): number { return this.get("FileAccessCost"); }
327
327
  get NoAccess(): boolean { return this.get("NoAccess"); }
328
328
  get ECLWUProcessList(): WsWorkunits.ECLWUProcessList { return this.get("ECLWUProcessList"); }
329
+ get CostSavingPotential(): number { return this.get("CostSavingPotential"); }
329
330
 
330
331
  // Factories ---
331
332
  static create(optsConnection: IOptions | IConnection): Promise<Workunit> {
package/src/index.node.ts CHANGED
@@ -3,38 +3,21 @@ import { root } from "@hpcc-js/util";
3
3
  import { DOMParser } from "@xmldom/xmldom";
4
4
  root.DOMParser = DOMParser;
5
5
 
6
- // fetch polyfill ---
7
- import fetch, { Headers, Request, Response, } from "node-fetch";
8
-
6
+ // fetch setup for Node.js ---
9
7
  import * as https from "node:https";
10
8
  import { Buffer } from "node:buffer";
11
- import { Agent, setGlobalDispatcher } from "undici";
12
-
13
- if (typeof root.fetch === "undefined") {
14
- // NodeJS < v18 ---
15
- root.fetch = fetch;
16
- root.Headers = Headers;
17
- root.Request = Request;
18
- root.Response = Response;
19
- root.fetch.__rejectUnauthorizedAgent = new https.Agent({
20
- rejectUnauthorized: false
21
- });
22
- } else {
23
- // NodeJS >= v18 ---
24
- root.fetch.__defaultAgent = new Agent();
25
- root.fetch.__rejectUnauthorizedAgent = new Agent({
26
- connect: {
27
- rejectUnauthorized: false
28
- }
29
- });
30
- root.fetch.__setGlobalDispatcher = setGlobalDispatcher;
31
- }
9
+ import { fetch, Agent } from "undici";
32
10
 
33
- // AbortController polyfill ---
34
- import AbortController from "abort-controller";
35
- if (typeof root.AbortController === "undefined") {
36
- root.AbortController = AbortController;
11
+ // NodeJS >= v18 has native fetch ---
12
+ if (root.fetch === undefined) {
13
+ throw new Error("@hpcc-js/comms requires Node.js >= 18.0.0 for native fetch support");
37
14
  }
15
+ root.__hpcc_undiciFetch = fetch;
16
+ root.__hpcc_rejectUnauthorizedAgent = new Agent({
17
+ connect: {
18
+ rejectUnauthorized: false
19
+ }
20
+ });
38
21
 
39
22
  import { trustwave } from "./pem/trustwave.ts";
40
23
 
@@ -54,7 +37,7 @@ if (https.globalAgent.options.ca !== undefined) {
54
37
  globalCA += "\n";
55
38
  }
56
39
 
57
- root.fetch.__trustwaveAgent = new https.Agent({
40
+ root.__hpcc_trustwaveAgent = new https.Agent({
58
41
  ca: globalCA + trustwave
59
42
  });
60
43
 
@@ -1,5 +1,5 @@
1
1
  import { timeParse } from "d3-time-format";
2
- import { SMCServiceBase, WsSMC } from "./wsdl/WsSMC/v1.28/WsSMC.ts";
2
+ import { SMCServiceBase, WsSMC } from "./wsdl/WsSMC/v1.29/WsSMC.ts";
3
3
  import { IOptions } from "../connection.ts";
4
4
 
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import { deepMixin, xml2json, XMLNode } from "@hpcc-js/util";
2
- import { WsWorkunits, WorkunitsServiceBase } from "./wsdl/WsWorkunits/v2.02/WsWorkunits.ts";
2
+ import { WsWorkunits, WorkunitsServiceBase } from "./wsdl/WsWorkunits/v2.03/WsWorkunits.ts";
3
3
  import { IConnection, IOptions } from "../connection.ts";
4
4
 
5
5
  export {