@hpcc-js/comms 3.5.1 → 3.6.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/dist/browser/index.js +74 -20
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.umd.cjs +2 -2
- package/dist/browser/index.umd.cjs.map +1 -1
- package/dist/node/index.cjs +10 -10
- package/dist/node/index.cjs.map +4 -4
- package/dist/node/index.js +9 -9
- package/dist/node/index.js.map +4 -4
- package/package.json +7 -6
- package/src/__package__.ts +2 -2
- package/src/clienttools/eclcc.ts +12 -4
- package/src/ecl/workunit.ts +13 -3
- package/src/services/wsCloud.ts +58 -5
- package/src/services/wsLogaccess.ts +1 -1
- package/src/services/wsWorkunits.ts +1 -1
- package/src/services/wsdl/WsCloud/v1.02/WsCloud.ts +77 -0
- package/src/services/wsdl/WsWorkunits/v2.02/WsWorkunits.ts +3157 -0
- package/src/services/wsdl/ws_logaccess/v1.08/ws_logaccess.ts +267 -0
- package/types/__package__.d.ts +2 -2
- package/types/services/wsCloud.d.ts +2 -2
- package/types/services/wsLogaccess.d.ts +1 -1
- package/types/services/wsWorkunits.d.ts +1 -1
- package/types/services/wsdl/WsCloud/v1.02/WsCloud.d.ts +46 -0
- package/types/services/wsdl/WsWorkunits/{v2 → v2.02}/WsWorkunits.d.ts +5 -1
- package/types/services/wsdl/ws_logaccess/{v1.05 → v1.08}/ws_logaccess.d.ts +71 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/comms",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "hpcc-js - Communications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.cjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"./dist/*": "./dist/*",
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
|
-
"types": "./types/index.
|
|
28
|
+
"types": "./types/index.node.d.ts",
|
|
29
29
|
"files": [
|
|
30
30
|
"dist/*",
|
|
31
31
|
"src/*",
|
|
@@ -73,17 +73,18 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@hpcc-js/util": "^3.3.1",
|
|
76
|
-
"@xmldom/xmldom": "0.9.
|
|
76
|
+
"@xmldom/xmldom": "0.9.8",
|
|
77
77
|
"abort-controller": "3.0.0",
|
|
78
78
|
"data-uri-to-buffer": "6.0.2",
|
|
79
79
|
"node-fetch": "3.3.2",
|
|
80
80
|
"safe-buffer": "5.2.1",
|
|
81
81
|
"tmp": "0.2.3",
|
|
82
|
-
"undici": "6.21.
|
|
82
|
+
"undici": "6.21.2"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@hpcc-js/ddl-shim": "^3.0.0",
|
|
86
86
|
"@hpcc-js/esbuild-plugins": "^1.4.1",
|
|
87
|
+
"@kubernetes/client-node": "1.0.0",
|
|
87
88
|
"@types/d3-request": "1.0.9",
|
|
88
89
|
"@types/d3-time-format": "2.3.4",
|
|
89
90
|
"@types/node": "^18",
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
"d3-array": "^1",
|
|
92
93
|
"d3-format": "^1",
|
|
93
94
|
"d3-time-format": "^2",
|
|
94
|
-
"soap": "1.1.
|
|
95
|
+
"soap": "1.1.10",
|
|
95
96
|
"typescript-formatter": "^7.2.2"
|
|
96
97
|
},
|
|
97
98
|
"repository": {
|
|
@@ -111,5 +112,5 @@
|
|
|
111
112
|
"esp",
|
|
112
113
|
"HPCC-Platform"
|
|
113
114
|
],
|
|
114
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "7066231f1f28911463b450df2afb7f256a8c8a16"
|
|
115
116
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/comms";
|
|
2
|
-
export const PKG_VERSION = "3.
|
|
3
|
-
export const BUILD_VERSION = "3.
|
|
2
|
+
export const PKG_VERSION = "3.6.0";
|
|
3
|
+
export const BUILD_VERSION = "3.7.0";
|
package/src/clienttools/eclcc.ts
CHANGED
|
@@ -390,8 +390,12 @@ export class ClientTools {
|
|
|
390
390
|
attachWorkspace(this.cwd),
|
|
391
391
|
this.execFile(this.eclccPath, this.cwd, this.args(["-M", filePath]), "eclcc", `Cannot find ${this.eclccPath}`)
|
|
392
392
|
]).then(([metaWorkspace, execFileResponse]: [Workspace, IExecFile]) => {
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
try {
|
|
394
|
+
if (execFileResponse && execFileResponse.stdout && execFileResponse.stdout.length) {
|
|
395
|
+
metaWorkspace.parseMetaXML(execFileResponse.stdout);
|
|
396
|
+
}
|
|
397
|
+
} catch (e: any) {
|
|
398
|
+
logger.error(`fetchMeta: Error parsing XML - ${e?.message ?? "unknown"}`);
|
|
395
399
|
}
|
|
396
400
|
return metaWorkspace;
|
|
397
401
|
});
|
|
@@ -403,8 +407,12 @@ export class ClientTools {
|
|
|
403
407
|
this.execFile(this.eclccPath, this.cwd, this.args([...args, "-M", filePath]), "eclcc", `Cannot find ${this.eclccPath}`)
|
|
404
408
|
]).then(([metaWorkspace, execFileResponse]: [Workspace, IExecFile]) => {
|
|
405
409
|
let checked: string[] = [];
|
|
406
|
-
|
|
407
|
-
|
|
410
|
+
try {
|
|
411
|
+
if (execFileResponse && execFileResponse.stdout && execFileResponse.stdout.length) {
|
|
412
|
+
checked = metaWorkspace.parseMetaXML(execFileResponse.stdout);
|
|
413
|
+
}
|
|
414
|
+
} catch (e: any) {
|
|
415
|
+
logger.error(`syntaxCheck: Error parsing XML - ${e?.message ?? "unknown"}`);
|
|
408
416
|
}
|
|
409
417
|
return new EclccErrors(execFileResponse ? execFileResponse.stderr : "", checked);
|
|
410
418
|
});
|
package/src/ecl/workunit.ts
CHANGED
|
@@ -714,9 +714,13 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
|
|
|
714
714
|
case "cost":
|
|
715
715
|
props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000;
|
|
716
716
|
break;
|
|
717
|
-
case "cpu":
|
|
718
|
-
case "skw":
|
|
719
717
|
case "node":
|
|
718
|
+
props[scopeProperty.Name] = +scopeProperty.RawValue;
|
|
719
|
+
break;
|
|
720
|
+
case "skw":
|
|
721
|
+
props[scopeProperty.Name] = +scopeProperty.RawValue;
|
|
722
|
+
break;
|
|
723
|
+
case "cpu":
|
|
720
724
|
case "ppm":
|
|
721
725
|
case "ip":
|
|
722
726
|
case "cy":
|
|
@@ -999,7 +1003,13 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
|
|
|
999
1003
|
// WsWorkunits passthroughs ---
|
|
1000
1004
|
protected WUQuery(_request: Partial<WsWorkunits.WUQuery> = {}): Promise<WsWorkunits.WUQueryResponse> {
|
|
1001
1005
|
return this.connection.WUQuery({ ..._request, Wuid: this.Wuid }).then((response) => {
|
|
1002
|
-
|
|
1006
|
+
if (response.Workunits.ECLWorkunit.length === 0) {
|
|
1007
|
+
// deleted ---
|
|
1008
|
+
this.clearState(this.Wuid);
|
|
1009
|
+
this.set("StateID", WUStateID.NotFound);
|
|
1010
|
+
} else {
|
|
1011
|
+
this.set(response.Workunits.ECLWorkunit[0]);
|
|
1012
|
+
}
|
|
1003
1013
|
return response;
|
|
1004
1014
|
}).catch((e: ESPExceptions) => {
|
|
1005
1015
|
// deleted ---
|
package/src/services/wsCloud.ts
CHANGED
|
@@ -1,18 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { scopedLogger } from "@hpcc-js/util";
|
|
2
|
+
import type { V1Pod } from "@kubernetes/client-node";
|
|
3
|
+
import type { WsCloud as WsCloudV1 } from "./wsdl/WsCloud/v1/WsCloud.ts";
|
|
4
|
+
import { CloudServiceBase, WsCloud } from "./wsdl/WsCloud/v1.02/WsCloud.ts";
|
|
5
|
+
|
|
6
|
+
const logger = scopedLogger("@hpcc-js/comms/services/wsCloud.ts");
|
|
2
7
|
|
|
3
8
|
export {
|
|
4
9
|
type WsCloud
|
|
5
10
|
};
|
|
6
11
|
|
|
12
|
+
function isGetPODsResponse_v1_02(response: any): response is WsCloud.GetPODsResponse {
|
|
13
|
+
return response?.Pods !== undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function mapPorts(pod: V1Pod): WsCloud.Port[] {
|
|
17
|
+
return pod.spec?.containers?.reduce((prev, curr) => {
|
|
18
|
+
curr.ports?.forEach(p => {
|
|
19
|
+
prev.push({
|
|
20
|
+
ContainerPort: p.containerPort,
|
|
21
|
+
Name: p.name,
|
|
22
|
+
Protocol: p.protocol
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return prev;
|
|
26
|
+
}, [] as WsCloud.Port[]) ?? [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mapPods(pods: V1Pod[]): WsCloud.Pod[] {
|
|
30
|
+
return pods
|
|
31
|
+
.filter(pod => {
|
|
32
|
+
const labels = pod?.metadata?.labels ?? {};
|
|
33
|
+
return labels.hasOwnProperty("app.kubernetes.io/part-of") && labels["app.kubernetes.io/part-of"] === "HPCC-Platform";
|
|
34
|
+
})
|
|
35
|
+
.map((pod: V1Pod): WsCloud.Pod => {
|
|
36
|
+
const started = new Date(pod.metadata?.creationTimestamp);
|
|
37
|
+
return {
|
|
38
|
+
Name: pod.metadata.name,
|
|
39
|
+
Status: pod.status?.phase,
|
|
40
|
+
CreationTimestamp: started.toISOString(),
|
|
41
|
+
ContainerName: pod.status?.containerStatuses?.reduce((prev, curr) => {
|
|
42
|
+
if (curr.name) {
|
|
43
|
+
prev.push(curr.name);
|
|
44
|
+
} return prev;
|
|
45
|
+
}, [] as string[]).join(", ") ?? "",
|
|
46
|
+
ContainerCount: pod.spec?.containers?.length ?? 0,
|
|
47
|
+
ContainerReadyCount: pod.status?.containerStatuses?.reduce((prev, curr) => prev + (curr.ready ? 1 : 0), 0),
|
|
48
|
+
ContainerRestartCount: pod.status?.containerStatuses?.reduce((prev, curr) => prev + curr.restartCount, 0),
|
|
49
|
+
Ports: {
|
|
50
|
+
Port: mapPorts(pod)
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
;
|
|
55
|
+
}
|
|
56
|
+
|
|
7
57
|
export class CloudService extends CloudServiceBase {
|
|
8
58
|
|
|
9
|
-
getPODs(): Promise<
|
|
10
|
-
return super.GetPODs({}).then((response) => {
|
|
59
|
+
getPODs(): Promise<WsCloud.Pod[]> {
|
|
60
|
+
return super.GetPODs({}).then((response: WsCloud.GetPODsResponse | WsCloudV1.GetPODsResponse) => {
|
|
61
|
+
if (isGetPODsResponse_v1_02(response)) {
|
|
62
|
+
return response.Pods?.Pod ?? [];
|
|
63
|
+
}
|
|
11
64
|
try {
|
|
12
65
|
const obj = typeof response.Result === "string" ? JSON.parse(response.Result) : response.Result;
|
|
13
|
-
return obj?.items ?? [];
|
|
14
|
-
|
|
66
|
+
return mapPods(obj?.items ?? []);
|
|
15
67
|
} catch (error) {
|
|
68
|
+
logger.error(`Error parsing V1Pods json '${(error instanceof Error ? error.message : String(error))}'`);
|
|
16
69
|
return [];
|
|
17
70
|
}
|
|
18
71
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { scopedLogger } from "@hpcc-js/util";
|
|
2
|
-
import { LogaccessServiceBase, WsLogaccess } from "./wsdl/ws_logaccess/v1.
|
|
2
|
+
import { LogaccessServiceBase, WsLogaccess } from "./wsdl/ws_logaccess/v1.08/ws_logaccess.ts";
|
|
3
3
|
|
|
4
4
|
const logger = scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { deepMixin, xml2json, XMLNode } from "@hpcc-js/util";
|
|
2
|
-
import { WsWorkunits, WorkunitsServiceBase } from "./wsdl/WsWorkunits/v2/WsWorkunits.ts";
|
|
2
|
+
import { WsWorkunits, WorkunitsServiceBase } from "./wsdl/WsWorkunits/v2.02/WsWorkunits.ts";
|
|
3
3
|
import { IConnection, IOptions } from "../connection.ts";
|
|
4
4
|
import { ESPConnection } from "../espConnection.ts";
|
|
5
5
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { IConnection, IOptions } from "../../../../connection.ts";
|
|
2
|
+
import { Service } from "../../../../espConnection.ts";
|
|
3
|
+
|
|
4
|
+
export namespace WsCloud {
|
|
5
|
+
|
|
6
|
+
export type int = number;
|
|
7
|
+
|
|
8
|
+
export interface GetPODsRequest {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface Port {
|
|
13
|
+
ContainerPort: int;
|
|
14
|
+
Name: string;
|
|
15
|
+
Protocol: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Ports {
|
|
19
|
+
Port: Port[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Pod {
|
|
23
|
+
Name: string;
|
|
24
|
+
Status: string;
|
|
25
|
+
CreationTimestamp: string;
|
|
26
|
+
ContainerName: string;
|
|
27
|
+
ContainerCount: int;
|
|
28
|
+
ContainerReadyCount: int;
|
|
29
|
+
ContainerRestartCount: int;
|
|
30
|
+
Ports: Ports;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Pods {
|
|
34
|
+
Pod: Pod[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface GetPODsResponse {
|
|
38
|
+
Pods: Pods;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface GetServicesRequest {
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GetServicesResponse {
|
|
46
|
+
Result: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface WsCloudPingRequest {
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface WsCloudPingResponse {
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class CloudServiceBase extends Service {
|
|
60
|
+
|
|
61
|
+
constructor(optsConnection: IOptions | IConnection) {
|
|
62
|
+
super(optsConnection, "WsCloud", "1.02");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
GetPODs(request: Partial<WsCloud.GetPODsRequest>): Promise<WsCloud.GetPODsResponse> {
|
|
66
|
+
return this._connection.send("GetPODs", request, "json", false, undefined, "GetPODsResponse");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
GetServices(request: Partial<WsCloud.GetServicesRequest>): Promise<WsCloud.GetServicesResponse> {
|
|
70
|
+
return this._connection.send("GetServices", request, "json", false, undefined, "GetServicesResponse");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Ping(request: Partial<WsCloud.WsCloudPingRequest>): Promise<WsCloud.WsCloudPingResponse> {
|
|
74
|
+
return this._connection.send("Ping", request, "json", false, undefined, "WsCloudPingResponse");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|