@hpcc-js/comms 3.12.1 → 3.13.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 +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 +10 -10
- package/dist/node/index.cjs.map +4 -4
- package/dist/node/index.js +10 -10
- package/dist/node/index.js.map +4 -4
- package/package.json +5 -5
- package/src/services/wsSMC.ts +56 -0
- package/types/services/wsSMC.d.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/comms",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "hpcc-js - Communications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.cjs",
|
|
@@ -74,15 +74,15 @@
|
|
|
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.4",
|
|
78
78
|
"@xmldom/xmldom": "0.9.8",
|
|
79
79
|
"abort-controller": "3.0.0",
|
|
80
80
|
"node-fetch": "3.3.2",
|
|
81
81
|
"undici": "7.16.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@hpcc-js/ddl-shim": "^3.2.
|
|
85
|
-
"@hpcc-js/esbuild-plugins": "^1.
|
|
84
|
+
"@hpcc-js/ddl-shim": "^3.2.3",
|
|
85
|
+
"@hpcc-js/esbuild-plugins": "^1.8.0",
|
|
86
86
|
"@kubernetes/client-node": "1.4.0",
|
|
87
87
|
"@types/d3-request": "1.0.9",
|
|
88
88
|
"@types/d3-time-format": "2.3.4",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"esp",
|
|
113
113
|
"HPCC-Platform"
|
|
114
114
|
],
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "70194f16ed27ea1167af126b35cbf4af5f181be9"
|
|
116
116
|
}
|
package/src/services/wsSMC.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { timeParse } from "d3-time-format";
|
|
1
2
|
import { SMCServiceBase, WsSMC } from "./wsdl/WsSMC/v1.28/WsSMC.ts";
|
|
2
3
|
import { IOptions } from "../connection.ts";
|
|
3
4
|
|
|
@@ -5,6 +6,20 @@ export {
|
|
|
5
6
|
WsSMC
|
|
6
7
|
};
|
|
7
8
|
|
|
9
|
+
const dateParser = timeParse("%Y%m%d%H");
|
|
10
|
+
|
|
11
|
+
function isNumeric(value: any): boolean {
|
|
12
|
+
return typeof value === "number" || (typeof value === "string" && value.trim() !== "" && !isNaN(+value));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface NormalisedGlobalMetric {
|
|
16
|
+
Category: string;
|
|
17
|
+
Start: Date;
|
|
18
|
+
End: Date;
|
|
19
|
+
dimensions: { [key: string]: any };
|
|
20
|
+
stats: { [key: string]: any };
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
export class SMCService extends SMCServiceBase {
|
|
9
24
|
|
|
10
25
|
connectionOptions(): IOptions {
|
|
@@ -21,4 +36,45 @@ export class SMCService extends SMCServiceBase {
|
|
|
21
36
|
};
|
|
22
37
|
});
|
|
23
38
|
}
|
|
39
|
+
|
|
40
|
+
protected parseGlobalMetric(name: string, value: any): any {
|
|
41
|
+
// Known Prefixes: Cost, Critical, Definition, Disk, Distribute, Ecl, Enum, Id, Interface, Is, Library, Load, Match, Meta, Num, Original, Output, Patch, Per, Persist, Predicted, Record, Section, Service, Signed, Size, Source, Spill, Target, Time, Updated, When
|
|
42
|
+
if (name.startsWith("Cost")) {
|
|
43
|
+
return +value / 1000000;
|
|
44
|
+
} else if (name.startsWith("Date")) {
|
|
45
|
+
return dateParser(value);
|
|
46
|
+
} else if (name.startsWith("Num")) {
|
|
47
|
+
return +value;
|
|
48
|
+
} else if (name.startsWith("Time")) {
|
|
49
|
+
return +value / 1000000000;
|
|
50
|
+
} else if (name.startsWith("When")) {
|
|
51
|
+
return new Date(+value / 1000).toISOString();
|
|
52
|
+
} else if (isNumeric(value)) {
|
|
53
|
+
return +value;
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
GetNormalisedGlobalMetrics(request: Partial<WsSMC.GetGlobalMetrics>): Promise<NormalisedGlobalMetric[]> {
|
|
59
|
+
return super.GetGlobalMetrics(request).then(response => {
|
|
60
|
+
const retVal: NormalisedGlobalMetric[] = [];
|
|
61
|
+
for (const metric of response?.GlobalMetrics?.GlobalMetric || []) {
|
|
62
|
+
const row: NormalisedGlobalMetric = {
|
|
63
|
+
Category: metric.Category,
|
|
64
|
+
Start: this.parseGlobalMetric("Date", metric.DateTimeRange?.Start),
|
|
65
|
+
End: this.parseGlobalMetric("Date", metric.DateTimeRange?.End),
|
|
66
|
+
dimensions: {},
|
|
67
|
+
stats: {}
|
|
68
|
+
};
|
|
69
|
+
for (const dimension of metric.Dimensions?.Dimension || []) {
|
|
70
|
+
row.dimensions[dimension.Name] = dimension.Value;
|
|
71
|
+
}
|
|
72
|
+
for (const stat of metric.Stats?.Stat || []) {
|
|
73
|
+
row.stats[stat.Name] = this.parseGlobalMetric(stat.Name, stat.Value);
|
|
74
|
+
}
|
|
75
|
+
retVal.push(row);
|
|
76
|
+
}
|
|
77
|
+
return retVal;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
24
80
|
}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import { SMCServiceBase, WsSMC } from "./wsdl/WsSMC/v1.28/WsSMC.ts";
|
|
2
2
|
import { IOptions } from "../connection.ts";
|
|
3
3
|
export { WsSMC };
|
|
4
|
+
export interface NormalisedGlobalMetric {
|
|
5
|
+
Category: string;
|
|
6
|
+
Start: Date;
|
|
7
|
+
End: Date;
|
|
8
|
+
dimensions: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
stats: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
4
15
|
export declare class SMCService extends SMCServiceBase {
|
|
5
16
|
connectionOptions(): IOptions;
|
|
6
17
|
Activity(request: WsSMC.Activity): Promise<WsSMC.ActivityResponse>;
|
|
18
|
+
protected parseGlobalMetric(name: string, value: any): any;
|
|
19
|
+
GetNormalisedGlobalMetrics(request: Partial<WsSMC.GetGlobalMetrics>): Promise<NormalisedGlobalMetric[]>;
|
|
7
20
|
}
|