@hpcc-js/comms 2.83.0 → 2.83.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/index.es6.js +611 -544
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +610 -543
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.node.js +610 -543
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.min.js +1 -1
- package/dist/index.node.min.js.map +1 -1
- package/lib-es6/__package__.js +2 -2
- package/lib-es6/ecl/query.js +102 -34
- package/lib-es6/ecl/query.js.map +1 -1
- package/lib-es6/services/wsAccess.js +2 -1
- package/lib-es6/services/wsAccess.js.map +1 -1
- package/lib-es6/services/wsdl/ws_access/v1.17/ws_access.js +209 -0
- package/lib-es6/services/wsdl/ws_access/v1.17/ws_access.js.map +1 -0
- package/package.json +2 -2
- package/src/__package__.ts +2 -2
- package/src/ecl/query.ts +65 -42
- package/src/services/wsAccess.ts +1 -1
- package/src/services/wsdl/ws_access/v1.17/ws_access.ts +1103 -0
- package/types/__package__.d.ts +2 -2
- package/types/ecl/query.d.ts +5 -2
- package/types/ecl/query.d.ts.map +1 -1
- package/types/services/wsAccess.d.ts +1 -1
- package/types/services/wsdl/ws_access/v1.17/ws_access.d.ts +789 -0
- package/types/services/wsdl/ws_access/v1.17/ws_access.d.ts.map +1 -0
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/ecl/query.d.ts +5 -2
- package/types-3.4/services/wsAccess.d.ts +1 -1
- package/types-3.4/services/wsdl/ws_access/v1.17/ws_access.d.ts +789 -0
package/src/ecl/query.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { Cache, StateObject } from "@hpcc-js/util";
|
|
1
|
+
import { Cache, StateObject, scopedLogger } from "@hpcc-js/util";
|
|
2
2
|
import { IConnection, IOptions } from "../connection";
|
|
3
3
|
import { EclService, IWsEclRequest, IWsEclResponse, IWsEclResult } from "../services/wsEcl";
|
|
4
4
|
import { WorkunitsService, WUQueryDetails } from "../services/wsWorkunits";
|
|
5
|
+
import { Topology } from "./topology";
|
|
6
|
+
|
|
7
|
+
const logger = scopedLogger("@hpcc-js/comms/ecl/query.ts");
|
|
5
8
|
|
|
6
9
|
export interface QueryEx extends WUQueryDetails.Response {
|
|
7
10
|
BaseUrl: string;
|
|
@@ -17,11 +20,9 @@ class QueryCache extends Cache<QueryEx, Query> {
|
|
|
17
20
|
const _queries = new QueryCache();
|
|
18
21
|
|
|
19
22
|
export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
|
|
20
|
-
protected
|
|
21
|
-
get BaseUrl() { return this.
|
|
22
|
-
|
|
23
|
-
protected _wsWorkunits: WorkunitsService;
|
|
24
|
-
// protected _wu: Workunit;
|
|
23
|
+
protected wsWorkunitsService: WorkunitsService;
|
|
24
|
+
get BaseUrl() { return this.wsWorkunitsService.baseUrl; }
|
|
25
|
+
protected topology: Topology;
|
|
25
26
|
protected _requestSchema: IWsEclRequest;
|
|
26
27
|
protected _responseSchema: IWsEclResponse;
|
|
27
28
|
|
|
@@ -51,17 +52,14 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
|
|
|
51
52
|
get WUGraphs(): WUQueryDetails.WUGraphs { return this.get("WUGraphs"); }
|
|
52
53
|
get WUTimers(): WUQueryDetails.WUTimers { return this.get("WUTimers"); }
|
|
53
54
|
|
|
54
|
-
private constructor(optsConnection: IOptions | IConnection |
|
|
55
|
+
private constructor(optsConnection: IOptions | IConnection | WorkunitsService, querySet: string, queryID: string, queryDetails?: WUQueryDetails.Response) {
|
|
55
56
|
super();
|
|
56
|
-
if (optsConnection instanceof
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
// this._topology = new Topology(this.connection.opts());
|
|
57
|
+
if (optsConnection instanceof WorkunitsService) {
|
|
58
|
+
this.wsWorkunitsService = optsConnection;
|
|
60
59
|
} else {
|
|
61
|
-
this.
|
|
62
|
-
// this._topology = new Topology(optsConnection);
|
|
60
|
+
this.wsWorkunitsService = new WorkunitsService(optsConnection);
|
|
63
61
|
}
|
|
64
|
-
this.
|
|
62
|
+
this.topology = Topology.attach(this.wsWorkunitsService.opts());
|
|
65
63
|
this.set({
|
|
66
64
|
QuerySet: querySet,
|
|
67
65
|
QueryId: queryID,
|
|
@@ -76,24 +74,56 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
|
|
|
76
74
|
return retVal;
|
|
77
75
|
}
|
|
78
76
|
|
|
77
|
+
private _eclService: Promise<EclService>;
|
|
78
|
+
protected async wsEclService(): Promise<EclService | undefined> {
|
|
79
|
+
if (!this._eclService) {
|
|
80
|
+
this._eclService = this.topology.fetchServices({}).then(services => {
|
|
81
|
+
for (const espServer of services?.TpEspServers?.TpEspServer ?? []) {
|
|
82
|
+
for (const binding of espServer?.TpBindings?.TpBinding ?? []) {
|
|
83
|
+
if (binding?.Service === "ws_ecl") {
|
|
84
|
+
const baseUrl = `${binding.Protocol}://${globalThis.location.hostname}:${binding.Port}`;
|
|
85
|
+
return new EclService({ baseUrl });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return this._eclService;
|
|
93
|
+
}
|
|
94
|
+
|
|
79
95
|
private async fetchDetails(): Promise<void> {
|
|
80
|
-
const queryDetails = await this.
|
|
96
|
+
const queryDetails = await this.wsWorkunitsService.WUQueryDetails({
|
|
81
97
|
QuerySet: this.QuerySet,
|
|
82
98
|
QueryId: this.QueryId,
|
|
83
|
-
IncludeStateOnClusters:
|
|
84
|
-
IncludeSuperFiles:
|
|
85
|
-
IncludeWsEclAddresses:
|
|
99
|
+
IncludeStateOnClusters: true,
|
|
100
|
+
IncludeSuperFiles: true,
|
|
101
|
+
IncludeWsEclAddresses: true,
|
|
86
102
|
CheckAllNodes: false
|
|
87
103
|
});
|
|
88
104
|
this.set({ ...queryDetails } as QueryEx);
|
|
89
105
|
}
|
|
90
106
|
|
|
91
107
|
private async fetchRequestSchema(): Promise<void> {
|
|
92
|
-
|
|
108
|
+
const wsEclService = await this.wsEclService();
|
|
109
|
+
try {
|
|
110
|
+
this._requestSchema = await wsEclService?.requestJson(this.QuerySet, this.QueryId) ?? [];
|
|
111
|
+
} catch (e) {
|
|
112
|
+
// See: https://track.hpccsystems.com/browse/HPCC-29827
|
|
113
|
+
logger.debug(e);
|
|
114
|
+
this._requestSchema = [];
|
|
115
|
+
}
|
|
93
116
|
}
|
|
94
117
|
|
|
95
118
|
private async fetchResponseSchema(): Promise<void> {
|
|
96
|
-
|
|
119
|
+
const wsEclService = await this.wsEclService();
|
|
120
|
+
try {
|
|
121
|
+
this._responseSchema = await wsEclService?.responseJson(this.QuerySet, this.QueryId) ?? {};
|
|
122
|
+
} catch (e) {
|
|
123
|
+
// See: https://track.hpccsystems.com/browse/HPCC-29827
|
|
124
|
+
logger.debug(e);
|
|
125
|
+
this._responseSchema = {};
|
|
126
|
+
}
|
|
97
127
|
}
|
|
98
128
|
|
|
99
129
|
private async fetchSchema(): Promise<void> {
|
|
@@ -101,16 +131,23 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
|
|
|
101
131
|
}
|
|
102
132
|
|
|
103
133
|
fetchSummaryStats() {
|
|
104
|
-
return this.
|
|
134
|
+
return this.wsWorkunitsService.WUQueryGetSummaryStats({ Target: this.QuerySet, QueryId: this.QueryId });
|
|
105
135
|
}
|
|
106
136
|
|
|
107
|
-
submit(request: object): Promise<Array<{ [key: string]: object[] }>> {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
async submit(request: object): Promise<Array<{ [key: string]: object[] }>> {
|
|
138
|
+
const wsEclService = await this.wsEclService();
|
|
139
|
+
try {
|
|
140
|
+
return wsEclService?.submit(this.QuerySet, this.QueryId, request).then(results => {
|
|
141
|
+
for (const key in results) {
|
|
142
|
+
results[key] = results[key].Row;
|
|
143
|
+
}
|
|
144
|
+
return results;
|
|
145
|
+
}) ?? [];
|
|
146
|
+
} catch (e) {
|
|
147
|
+
// See: https://track.hpccsystems.com/browse/HPCC-29827
|
|
148
|
+
logger.debug(e);
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
114
151
|
}
|
|
115
152
|
|
|
116
153
|
async refresh(): Promise<this> {
|
|
@@ -143,18 +180,4 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
|
|
|
143
180
|
if (!this._responseSchema[resultName]) return [];
|
|
144
181
|
return this._responseSchema[resultName];
|
|
145
182
|
}
|
|
146
|
-
|
|
147
|
-
/*
|
|
148
|
-
protected WUQueryDetails(): Promise<WUQueryDetails.Response> {
|
|
149
|
-
const request: WUQueryDetails.Request = {} as WUQueryDetails.Request;
|
|
150
|
-
request.QueryId = this.QueryId;
|
|
151
|
-
request.QuerySet = this.QuerySet;
|
|
152
|
-
request.IncludeSuperFiles = true;
|
|
153
|
-
request.IncludeStateOnClusters = true;
|
|
154
|
-
return this.connection.WUQueryDetails(request).then((response) => {
|
|
155
|
-
this.set(response);
|
|
156
|
-
return response;
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
*/
|
|
160
183
|
}
|
package/src/services/wsAccess.ts
CHANGED