@hpcc-js/comms 2.82.1 → 2.82.3

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.
Files changed (123) hide show
  1. package/dist/index.es6.js +744 -100
  2. package/dist/index.es6.js.map +1 -1
  3. package/dist/index.js +745 -99
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist/index.node.js +745 -99
  8. package/dist/index.node.js.map +1 -1
  9. package/dist/index.node.min.js +1 -1
  10. package/dist/index.node.min.js.map +1 -1
  11. package/lib-es6/__package__.js +2 -2
  12. package/lib-es6/ecl/dfuWorkunit.js +528 -0
  13. package/lib-es6/ecl/dfuWorkunit.js.map +1 -0
  14. package/lib-es6/ecl/query.js +30 -2
  15. package/lib-es6/ecl/query.js.map +1 -1
  16. package/lib-es6/ecl/workunit.js +2 -2
  17. package/lib-es6/ecl/workunit.js.map +1 -1
  18. package/lib-es6/index-common.js +1 -0
  19. package/lib-es6/index-common.js.map +1 -1
  20. package/lib-es6/services/fileSpray.js +9 -0
  21. package/lib-es6/services/fileSpray.js.map +1 -1
  22. package/lib-es6/services/wsLogaccess.js +151 -81
  23. package/lib-es6/services/wsLogaccess.js.map +1 -1
  24. package/lib-es6/services/wsdl/ws_logaccess/v1.04/ws_logaccess.js +85 -0
  25. package/lib-es6/services/wsdl/ws_logaccess/v1.04/ws_logaccess.js.map +1 -0
  26. package/package.json +6 -6
  27. package/src/__package__.ts +2 -2
  28. package/src/ecl/dfuWorkunit.ts +306 -0
  29. package/src/ecl/query.ts +17 -1
  30. package/src/ecl/workunit.ts +2 -2
  31. package/src/index-common.ts +1 -0
  32. package/src/services/fileSpray.ts +108 -0
  33. package/src/services/wsLogaccess.ts +89 -31
  34. package/src/services/wsdl/ws_logaccess/v1.04/ws_logaccess.ts +215 -0
  35. package/types/__package__.d.ts +2 -2
  36. package/types/connection.d.ts +5 -5
  37. package/types/connection.d.ts.map +1 -1
  38. package/types/ecl/activity.d.ts +3 -3
  39. package/types/ecl/activity.d.ts.map +1 -1
  40. package/types/ecl/dfuWorkunit.d.ts +95 -0
  41. package/types/ecl/dfuWorkunit.d.ts.map +1 -0
  42. package/types/ecl/query.d.ts +1 -0
  43. package/types/ecl/query.d.ts.map +1 -1
  44. package/types/ecl/result.d.ts +3 -3
  45. package/types/ecl/result.d.ts.map +1 -1
  46. package/types/ecl/targetCluster.d.ts +2 -2
  47. package/types/ecl/targetCluster.d.ts.map +1 -1
  48. package/types/ecl/workunit.d.ts +4 -4
  49. package/types/ecl/workunit.d.ts.map +1 -1
  50. package/types/espConnection.d.ts +1 -1
  51. package/types/espConnection.d.ts.map +1 -1
  52. package/types/index-common.d.ts +1 -0
  53. package/types/index-common.d.ts.map +1 -1
  54. package/types/services/fileSpray.d.ts +95 -0
  55. package/types/services/fileSpray.d.ts.map +1 -1
  56. package/types/services/wsDFU.d.ts +1 -1
  57. package/types/services/wsDFU.d.ts.map +1 -1
  58. package/types/services/wsEcl.d.ts +5 -5
  59. package/types/services/wsEcl.d.ts.map +1 -1
  60. package/types/services/wsLogaccess.d.ts +3 -3
  61. package/types/services/wsLogaccess.d.ts.map +1 -1
  62. package/types/services/wsdl/FileSpray/v1.23/FileSpray.d.ts +5 -5
  63. package/types/services/wsdl/FileSpray/v1.23/FileSpray.d.ts.map +1 -1
  64. package/types/services/wsdl/WsDFUXRef/v1.02/WsDFUXRef.d.ts +2 -2
  65. package/types/services/wsdl/WsDFUXRef/v1.02/WsDFUXRef.d.ts.map +1 -1
  66. package/types/services/wsdl/WsDfu/v1.62/WsDfu.d.ts +4 -4
  67. package/types/services/wsdl/WsDfu/v1.62/WsDfu.d.ts.map +1 -1
  68. package/types/services/wsdl/WsFileIO/v1.01/WsFileIO.d.ts +2 -2
  69. package/types/services/wsdl/WsFileIO/v1.01/WsFileIO.d.ts.map +1 -1
  70. package/types/services/wsdl/WsPackageProcess/v1.04/WsPackageProcess.d.ts +1 -1
  71. package/types/services/wsdl/WsPackageProcess/v1.04/WsPackageProcess.d.ts.map +1 -1
  72. package/types/services/wsdl/WsResources/v1.01/WsResources.d.ts +1 -1
  73. package/types/services/wsdl/WsResources/v1.01/WsResources.d.ts.map +1 -1
  74. package/types/services/wsdl/WsSMC/v1.24/WsSMC.d.ts +3 -3
  75. package/types/services/wsdl/WsSMC/v1.24/WsSMC.d.ts.map +1 -1
  76. package/types/services/wsdl/WsTopology/v1.31/WsTopology.d.ts +4 -4
  77. package/types/services/wsdl/WsTopology/v1.31/WsTopology.d.ts.map +1 -1
  78. package/types/services/wsdl/WsWorkunits/v1.88/WsWorkunits.d.ts +8 -8
  79. package/types/services/wsdl/WsWorkunits/v1.88/WsWorkunits.d.ts.map +1 -1
  80. package/types/services/wsdl/ws_access/v1.16/ws_access.d.ts +4 -4
  81. package/types/services/wsdl/ws_access/v1.16/ws_access.d.ts.map +1 -1
  82. package/types/services/wsdl/ws_account/v1.05/ws_account.d.ts +1 -1
  83. package/types/services/wsdl/ws_account/v1.05/ws_account.d.ts.map +1 -1
  84. package/types/services/wsdl/ws_codesign/v1.1/ws_codesign.d.ts +1 -1
  85. package/types/services/wsdl/ws_codesign/v1.1/ws_codesign.d.ts.map +1 -1
  86. package/types/services/wsdl/ws_logaccess/v1/ws_logaccess.d.ts +3 -3
  87. package/types/services/wsdl/ws_logaccess/v1/ws_logaccess.d.ts.map +1 -1
  88. package/types/services/wsdl/ws_logaccess/v1.04/ws_logaccess.d.ts +171 -0
  89. package/types/services/wsdl/ws_logaccess/v1.04/ws_logaccess.d.ts.map +1 -0
  90. package/types/services/wsdl/ws_machine/v1.17/ws_machine.d.ts +3 -3
  91. package/types/services/wsdl/ws_machine/v1.17/ws_machine.d.ts.map +1 -1
  92. package/types/services/wsdl/wsstore/v1.02/wsstore.d.ts +1 -1
  93. package/types/services/wsdl/wsstore/v1.02/wsstore.d.ts.map +1 -1
  94. package/types-3.4/__package__.d.ts +2 -2
  95. package/types-3.4/connection.d.ts +5 -5
  96. package/types-3.4/ecl/activity.d.ts +3 -3
  97. package/types-3.4/ecl/dfuWorkunit.d.ts +95 -0
  98. package/types-3.4/ecl/query.d.ts +1 -0
  99. package/types-3.4/ecl/result.d.ts +3 -3
  100. package/types-3.4/ecl/targetCluster.d.ts +2 -2
  101. package/types-3.4/ecl/workunit.d.ts +4 -4
  102. package/types-3.4/espConnection.d.ts +1 -1
  103. package/types-3.4/index-common.d.ts +1 -0
  104. package/types-3.4/services/fileSpray.d.ts +95 -0
  105. package/types-3.4/services/wsDFU.d.ts +1 -1
  106. package/types-3.4/services/wsEcl.d.ts +5 -5
  107. package/types-3.4/services/wsLogaccess.d.ts +3 -3
  108. package/types-3.4/services/wsdl/FileSpray/v1.23/FileSpray.d.ts +5 -5
  109. package/types-3.4/services/wsdl/WsDFUXRef/v1.02/WsDFUXRef.d.ts +2 -2
  110. package/types-3.4/services/wsdl/WsDfu/v1.62/WsDfu.d.ts +4 -4
  111. package/types-3.4/services/wsdl/WsFileIO/v1.01/WsFileIO.d.ts +2 -2
  112. package/types-3.4/services/wsdl/WsPackageProcess/v1.04/WsPackageProcess.d.ts +1 -1
  113. package/types-3.4/services/wsdl/WsResources/v1.01/WsResources.d.ts +1 -1
  114. package/types-3.4/services/wsdl/WsSMC/v1.24/WsSMC.d.ts +3 -3
  115. package/types-3.4/services/wsdl/WsTopology/v1.31/WsTopology.d.ts +4 -4
  116. package/types-3.4/services/wsdl/WsWorkunits/v1.88/WsWorkunits.d.ts +8 -8
  117. package/types-3.4/services/wsdl/ws_access/v1.16/ws_access.d.ts +4 -4
  118. package/types-3.4/services/wsdl/ws_account/v1.05/ws_account.d.ts +1 -1
  119. package/types-3.4/services/wsdl/ws_codesign/v1.1/ws_codesign.d.ts +1 -1
  120. package/types-3.4/services/wsdl/ws_logaccess/v1/ws_logaccess.d.ts +3 -3
  121. package/types-3.4/services/wsdl/ws_logaccess/v1.04/ws_logaccess.d.ts +171 -0
  122. package/types-3.4/services/wsdl/ws_machine/v1.17/ws_machine.d.ts +3 -3
  123. package/types-3.4/services/wsdl/wsstore/v1.02/wsstore.d.ts +1 -1
@@ -0,0 +1,306 @@
1
+ import { Cache, IEvent, scopedLogger, StateCallback, StateEvents, StateObject, StatePropCallback } from "@hpcc-js/util";
2
+ import { IConnection, IOptions } from "../connection";
3
+ import { ESPExceptions } from "../espConnection";
4
+ import { WsSMC } from "../services/wsSMC";
5
+ import { FileSpray, SprayFixedEx, FileSprayService, SprayVariableEx } from "../services/fileSpray";
6
+ import * as WsTopology from "../services/wsTopology";
7
+
8
+ const logger = scopedLogger("@hpcc-js/comms/dfuWorkunit.ts");
9
+
10
+ enum States {
11
+ Unknown = 0,
12
+ Scheduled,
13
+ Queued,
14
+ Started,
15
+ Aborted,
16
+ Failed,
17
+ Finished,
18
+ Monitoring,
19
+ Aborting,
20
+ NotFound = 999
21
+ }
22
+
23
+ export class DFUWorkunitCache extends Cache<{ BaseUrl: string, ID: string }, DFUWorkunit> {
24
+ constructor() {
25
+ super((obj) => {
26
+ return `${obj.BaseUrl}-${obj.ID}`;
27
+ });
28
+ }
29
+ }
30
+ const _workunits = new DFUWorkunitCache();
31
+
32
+ export type DFUWorkunitEvents = "finished" | StateEvents;
33
+ export type UDFUWorkunitState = FileSpray.DFUWorkunit;
34
+ export type IDFUWorkunitState = FileSpray.DFUWorkunit | WsSMC.ActiveWorkunit;
35
+ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitState> implements FileSpray.DFUWorkunit {
36
+ connection: FileSprayService;
37
+ topologyConnection: WsTopology.TopologyService;
38
+ get BaseUrl() { return this.connection.baseUrl; }
39
+
40
+ // Accessors ---
41
+ get properties(): FileSpray.DFUWorkunit { return this.get(); }
42
+ get ID(): string { return this.get("ID"); }
43
+ get DFUServerName(): string { return this.get("DFUServerName"); }
44
+ get ClusterName(): string { return this.get("ClusterName"); }
45
+ get JobName(): string { return this.get("JobName"); }
46
+ get Queue(): string { return this.get("Queue"); }
47
+ get User(): string { return this.get("User"); }
48
+ get isProtected(): boolean { return this.get("isProtected"); }
49
+ get Command(): number { return this.get("Command"); }
50
+ get CommandMessage(): string { return this.get("CommandMessage"); }
51
+ get PercentDone(): number { return this.get("PercentDone"); }
52
+ get SecsLeft(): number { return this.get("SecsLeft"); }
53
+ get ProgressMessage(): string { return this.get("ProgressMessage"); }
54
+ get SummaryMessage(): string { return this.get("SummaryMessage"); }
55
+ get State(): number { return this.get("State", States.Unknown); }
56
+ get SourceLogicalName(): string { return this.get("SourceLogicalName"); }
57
+ get SourceIP(): string { return this.get("SourceIP"); }
58
+ get SourceFilePath(): string { return this.get("SourceFilePath"); }
59
+ get SourceDali(): string { return this.get("SourceDali"); }
60
+ get SourceRecordSize(): number { return this.get("SourceRecordSize"); }
61
+ get SourceFormat(): number { return this.get("SourceFormat"); }
62
+ get RowTag(): string { return this.get("RowTag"); }
63
+ get SourceNumParts(): number { return this.get("SourceNumParts"); }
64
+ get SourceDirectory(): string { return this.get("SourceDirectory"); }
65
+ get DestLogicalName(): string { return this.get("DestLogicalName"); }
66
+ get DestGroupName(): string { return this.get("DestGroupName"); }
67
+ get DestDirectory(): string { return this.get("DestDirectory"); }
68
+ get DestIP(): string { return this.get("DestIP"); }
69
+ get DestFilePath(): string { return this.get("DestFilePath"); }
70
+ get DestFormat(): number { return this.get("DestFormat"); }
71
+ get DestNumParts(): number { return this.get("DestNumParts"); }
72
+ get DestRecordSize(): number { return this.get("DestRecordSize"); }
73
+ get Replicate(): boolean { return this.get("Replicate"); }
74
+ get Overwrite(): boolean { return this.get("Overwrite"); }
75
+ get Compress(): boolean { return this.get("Compress"); }
76
+ get SourceCsvSeparate(): string { return this.get("SourceCsvSeparate"); }
77
+ get SourceCsvQuote(): string { return this.get("SourceCsvQuote"); }
78
+ get SourceCsvTerminate(): string { return this.get("SourceCsvTerminate"); }
79
+ get SourceCsvEscape(): string { return this.get("SourceCsvEscape"); }
80
+ get TimeStarted(): string { return this.get("TimeStarted"); }
81
+ get TimeStopped(): string { return this.get("TimeStopped"); }
82
+ get StateMessage(): string { return this.get("StateMessage"); }
83
+ get MonitorEventName(): string { return this.get("MonitorEventName"); }
84
+ get MonitorSub(): boolean { return this.get("MonitorSub"); }
85
+ get MonitorShotLimit(): number { return this.get("MonitorShotLimit"); }
86
+ get SourceDiffKeyName(): string { return this.get("SourceDiffKeyName"); }
87
+ get DestDiffKeyName(): string { return this.get("DestDiffKeyName"); }
88
+ get Archived(): boolean { return this.get("Archived"); }
89
+ get encrypt(): string { return this.get("encrypt"); }
90
+ get decrypt(): string { return this.get("decrypt"); }
91
+ get failIfNoSourceFile(): boolean { return this.get("failIfNoSourceFile"); }
92
+ get recordStructurePresent(): boolean { return this.get("recordStructurePresent"); }
93
+ get quotedTerminator(): boolean { return this.get("quotedTerminator"); }
94
+ get preserveCompression(): boolean { return this.get("preserveCompression"); }
95
+ get expireDays(): number { return this.get("expireDays"); }
96
+ get PreserveFileParts(): boolean { return this.get("PreserveFileParts"); }
97
+ get FileAccessCost(): number { return this.get("FileAccessCost"); }
98
+
99
+ // Factories ---
100
+ static create(optsConnection: IOptions | IConnection, dfuServerQueue: string): Promise<DFUWorkunit> {
101
+ const retVal: DFUWorkunit = new DFUWorkunit(optsConnection);
102
+ return retVal.connection.CreateDFUWorkunit({ DFUServerQueue: dfuServerQueue }).then((response) => {
103
+ _workunits.set(retVal);
104
+ retVal.set(response.result);
105
+ return retVal;
106
+ });
107
+ }
108
+
109
+ static attach(optsConnection: IOptions | IConnection, wuid: string, state?: IDFUWorkunitState): DFUWorkunit {
110
+ const retVal: DFUWorkunit = _workunits.get({ BaseUrl: optsConnection.baseUrl, ID: wuid }, () => {
111
+ return new DFUWorkunit(optsConnection, wuid);
112
+ });
113
+ if (state) {
114
+ retVal.set(state);
115
+ }
116
+ return retVal;
117
+ }
118
+
119
+ static sprayFixed(server: IOptions | IConnection, request: Partial<SprayFixedEx>): Promise<DFUWorkunit> {
120
+ const service = new FileSprayService(server);
121
+ return service.SprayFixedEx({
122
+ ...request
123
+ }).then(response => {
124
+ const wuid = response.wuid;
125
+ return service.GetDFUWorkunit({ wuid }).then(response => {
126
+ return DFUWorkunit.attach(server, wuid, response.result);
127
+ });
128
+ });
129
+ }
130
+
131
+ static sprayVariable(server: IOptions | IConnection, request: Partial<SprayVariableEx>): Promise<DFUWorkunit> {
132
+ const service = new FileSprayService(server);
133
+ return service.SprayVariableEx({
134
+ ...request
135
+ }).then(response => {
136
+ const wuid = response.wuid;
137
+ return service.GetDFUWorkunit({ wuid }).then(response => {
138
+ return DFUWorkunit.attach(server, wuid, response.result);
139
+ });
140
+ });
141
+ }
142
+
143
+ static despray(server: IOptions | IConnection, request: Partial<FileSpray.Despray>): Promise<DFUWorkunit> {
144
+ const service = new FileSprayService(server);
145
+ return service.DesprayEx({
146
+ ...request
147
+ }).then(response => {
148
+ const wuid = response.wuid;
149
+ return service.GetDFUWorkunit({ wuid }).then(response => {
150
+ return DFUWorkunit.attach(server, wuid, response.result);
151
+ });
152
+ });
153
+ }
154
+
155
+ isComplete(): boolean {
156
+ switch (this.State) {
157
+ case States.Finished:
158
+ case States.Failed:
159
+ case States.Aborted:
160
+ case States.NotFound:
161
+ return true;
162
+ default:
163
+ }
164
+ return false;
165
+ }
166
+
167
+ isFailed() {
168
+ if (this.isComplete() && this.State !== States.Finished) {
169
+ return true;
170
+ }
171
+ return false;
172
+ }
173
+
174
+ isDeleted() {
175
+ switch (this.State) {
176
+ case States.NotFound:
177
+ return true;
178
+ default:
179
+ }
180
+ return false;
181
+ }
182
+
183
+ isRunning(): boolean {
184
+ return !this.isComplete();
185
+ }
186
+
187
+ async refresh(full: boolean = false): Promise<this> {
188
+ await this.GetDFUWorkunit();
189
+ return this;
190
+ }
191
+
192
+ // Monitoring ---
193
+ protected _monitor(): void {
194
+ if (this.isComplete()) {
195
+ this._monitorTickCount = 0;
196
+ return;
197
+ }
198
+ super._monitor();
199
+ }
200
+
201
+ protected _monitorTimeoutDuration(): number {
202
+ const retVal = super._monitorTimeoutDuration();
203
+ if (this._monitorTickCount <= 1) { // Once
204
+ return 3000;
205
+ } else if (this._monitorTickCount <= 5) { // Twice
206
+ return 6000;
207
+ } else if (this._monitorTickCount <= 7) { // Twice
208
+ return 12000;
209
+ }
210
+ return retVal;
211
+ }
212
+
213
+ // Events ---
214
+ on(eventID: DFUWorkunitEvents, propIDorCallback: StateCallback | keyof UDFUWorkunitState, callback?: StatePropCallback): this {
215
+ if (this.isCallback(propIDorCallback)) {
216
+ switch (eventID) {
217
+ case "finished":
218
+ super.on("propChanged", "State", (changeInfo: IEvent) => {
219
+ if (this.isComplete()) {
220
+ propIDorCallback([changeInfo]);
221
+ }
222
+ });
223
+ break;
224
+ case "changed":
225
+ super.on(eventID, propIDorCallback);
226
+ break;
227
+ default:
228
+ }
229
+ } else {
230
+ switch (eventID) {
231
+ case "changed":
232
+ super.on(eventID, propIDorCallback, callback!);
233
+ break;
234
+ default:
235
+ }
236
+ }
237
+ this._monitor();
238
+ return this;
239
+ }
240
+
241
+ watchUntilComplete(callback?: StateCallback): Promise<this> {
242
+ return new Promise((resolve, _) => {
243
+ const watchHandle = this.watch((changes) => {
244
+ if (callback) {
245
+ callback(changes);
246
+ }
247
+ if (this.isComplete()) {
248
+ watchHandle.release();
249
+ resolve(this);
250
+ }
251
+ });
252
+ });
253
+ }
254
+
255
+ watchUntilRunning(callback?: StateCallback): Promise<this> {
256
+ return new Promise((resolve, _) => {
257
+ const watchHandle = this.watch((changes) => {
258
+ if (callback) {
259
+ callback(changes);
260
+ }
261
+ if (this.isComplete() || this.isRunning()) {
262
+ watchHandle.release();
263
+ resolve(this);
264
+ }
265
+ });
266
+ });
267
+ }
268
+
269
+ // --- --- ---
270
+ protected constructor(optsConnection: IOptions | IConnection, wuid?: string) {
271
+ super();
272
+ this.connection = new FileSprayService(optsConnection);
273
+ this.topologyConnection = new WsTopology.TopologyService(optsConnection);
274
+ this.clearState(wuid);
275
+ }
276
+
277
+ clearState(wuid?: string) {
278
+ this.clear({
279
+ ID: wuid,
280
+ State: States.Unknown
281
+ });
282
+ }
283
+
284
+ // FileSpray passthroughs ---
285
+ protected GetDFUWorkunit(_request: Partial<FileSpray.GetDFUWorkunit> = {}): Promise<FileSpray.GetDFUWorkunitResponse> {
286
+ return this.connection.GetDFUWorkunit({ ..._request, wuid: this.ID }).then((response) => {
287
+ this.set(response.result);
288
+ return response;
289
+ }).catch((e: ESPExceptions) => {
290
+ // deleted ---
291
+ const wuMissing = e.Exception.some((exception) => {
292
+ if (exception.Code === 20081) {
293
+ this.clearState(this.ID);
294
+ this.set("State", States.NotFound);
295
+ return true;
296
+ }
297
+ return false;
298
+ });
299
+ if (!wuMissing) {
300
+ logger.warning("Unexpected exception: ");
301
+ throw e;
302
+ }
303
+ return {} as FileSpray.GetDFUWorkunitResponse;
304
+ });
305
+ }
306
+ }
package/src/ecl/query.ts CHANGED
@@ -76,6 +76,18 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
76
76
  return retVal;
77
77
  }
78
78
 
79
+ private async fetchDetails(): Promise<void> {
80
+ const queryDetails = await this._wsWorkunits.WUQueryDetails({
81
+ QuerySet: this.QuerySet,
82
+ QueryId: this.QueryId,
83
+ IncludeStateOnClusters: false,
84
+ IncludeSuperFiles: false,
85
+ IncludeWsEclAddresses: false,
86
+ CheckAllNodes: false
87
+ });
88
+ this.set({ ...queryDetails } as QueryEx);
89
+ }
90
+
79
91
  private async fetchRequestSchema(): Promise<void> {
80
92
  this._requestSchema = await this.connection.requestJson(this.QuerySet, this.QueryId);
81
93
  }
@@ -102,7 +114,11 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
102
114
  }
103
115
 
104
116
  async refresh(): Promise<this> {
105
- return this.fetchSchema().then(schema => this);
117
+ await Promise.all([
118
+ this.fetchDetails(),
119
+ this.fetchSchema()
120
+ ]);
121
+ return this;
106
122
  }
107
123
 
108
124
  requestFields(): IWsEclRequest {
@@ -724,8 +724,8 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
724
724
  super._monitor();
725
725
  }
726
726
 
727
- protected _monitorTimeoutDuraction(): number {
728
- const retVal = super._monitorTimeoutDuraction();
727
+ protected _monitorTimeoutDuration(): number {
728
+ const retVal = super._monitorTimeoutDuration();
729
729
  if (this._monitorTickCount <= 1) { // Once
730
730
  return 1000;
731
731
  } else if (this._monitorTickCount <= 3) { // Twice
@@ -32,6 +32,7 @@ export * from "./ecl/store";
32
32
  export * from "./ecl/timer";
33
33
  export * from "./ecl/topology";
34
34
  export * from "./ecl/targetCluster";
35
+ export * from "./ecl/dfuWorkunit";
35
36
  export * from "./ecl/workunit";
36
37
  export * from "./ecl/xsdParser";
37
38
 
@@ -4,5 +4,113 @@ export {
4
4
  FileSpray
5
5
  };
6
6
 
7
+ export interface SprayFixedEx {
8
+ sourceIP?: string;
9
+ sourcePlane?: string;
10
+ sourcePath?: string;
11
+ srcxml?: string;
12
+ sourceFormat?: string;
13
+ sourceRecordSize?: number;
14
+ destGroup?: string;
15
+ destLogicalName?: string;
16
+ overwrite?: boolean;
17
+ replicate?: boolean;
18
+ ReplicateOffset?: number;
19
+ maxConnections?: number;
20
+ throttle?: number;
21
+ transferBufferSize?: number;
22
+ prefix?: string;
23
+ nosplit?: boolean;
24
+ norecover?: boolean;
25
+ compress?: boolean;
26
+ push?: boolean;
27
+ pull?: boolean;
28
+ noCommon?: boolean;
29
+ encrypt?: string;
30
+ decrypt?: string;
31
+ wrap?: boolean;
32
+ failIfNoSourceFile?: boolean;
33
+ recordStructurePresent?: boolean;
34
+ quotedTerminator?: boolean;
35
+ expireDays?: number;
36
+ DFUServerQueue?: string;
37
+ }
38
+
39
+ export interface SprayVariableEx {
40
+ sourceIP?: string;
41
+ sourcePlane?: string;
42
+ sourcePath?: string;
43
+ srcxml?: string;
44
+ sourceMaxRecordSize?: number;
45
+ sourceFormat?: number;
46
+ NoSourceCsvSeparator?: boolean;
47
+ sourceCsvSeparate?: string;
48
+ sourceCsvTerminate?: string;
49
+ sourceCsvQuote?: string;
50
+ sourceCsvEscape?: string;
51
+ sourceRowTag?: string;
52
+ destGroup?: string;
53
+ destLogicalName?: string;
54
+ overwrite?: boolean;
55
+ replicate?: boolean;
56
+ ReplicateOffset?: number;
57
+ maxConnections?: number;
58
+ throttle?: number;
59
+ transferBufferSize?: number;
60
+ prefix?: string;
61
+ nosplit?: boolean;
62
+ norecover?: boolean;
63
+ compress?: boolean;
64
+ push?: boolean;
65
+ pull?: boolean;
66
+ noCommon?: boolean;
67
+ encrypt?: string;
68
+ decrypt?: string;
69
+ failIfNoSourceFile?: boolean;
70
+ recordStructurePresent?: boolean;
71
+ quotedTerminator?: boolean;
72
+ sourceRowPath?: string;
73
+ isJSON?: boolean;
74
+ expireDays?: number;
75
+ DFUServerQueue?: string;
76
+ srcUsername?: string;
77
+ srcPassword?: string;
78
+ }
79
+
80
+ export interface DesprayEx {
81
+ destGroup?: string;
82
+ sourceLogicalName?: string;
83
+ destIP?: string;
84
+ destPath?: string;
85
+ destPlane?: string;
86
+ dstxml?: string;
87
+ overwrite?: boolean;
88
+ maxConnections?: number;
89
+ throttle?: number;
90
+ transferBufferSize?: number;
91
+ splitprefix?: string;
92
+ norecover?: boolean;
93
+ wrap?: boolean;
94
+ multiCopy?: boolean;
95
+ SingleConnection?: boolean;
96
+ DFUServerQueue?: string;
97
+ compress?: boolean;
98
+ encrypt?: string;
99
+ decrypt?: string;
100
+ }
101
+
7
102
  export class FileSprayService extends FileSprayServiceBase {
103
+
104
+ SprayFixedEx(request: SprayFixedEx): Promise<FileSpray.SprayFixedResponse> {
105
+ return this._connection.send("SprayFixed", request);
106
+ }
107
+
108
+ SprayVariableEx(request: SprayVariableEx): Promise<FileSpray.SprayResponse> {
109
+ return this._connection.send("SprayVariable", request, "json", false, null, "SprayResponse");
110
+ }
111
+
112
+ DesprayEx(request: DesprayEx): Promise<FileSpray.DesprayResponse> {
113
+ return this._connection.send("Despray", request);
114
+ }
115
+
8
116
  }
@@ -1,5 +1,5 @@
1
1
  import { scopedLogger } from "@hpcc-js/util";
2
- import { LogaccessServiceBase, WsLogaccess } from "./wsdl/ws_logaccess/v1.03/ws_logaccess";
2
+ import { LogaccessServiceBase, WsLogaccess } from "./wsdl/ws_logaccess/v1.04/ws_logaccess";
3
3
 
4
4
  const logger = scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
5
5
 
@@ -9,7 +9,7 @@ export {
9
9
 
10
10
  export interface GetLogsExRequest {
11
11
  audience?: string;
12
- class?: string;
12
+ class?: string[];
13
13
  jobId?: string;
14
14
  message?: string;
15
15
  procId?: string;
@@ -35,7 +35,7 @@ export const enum LogType {
35
35
  export const enum TargetAudience {
36
36
  Operator = "OPR",
37
37
  User = "USR",
38
- Programmer = "PRO",
38
+ Programmer = "PRG",
39
39
  Audit = "ADT"
40
40
  }
41
41
 
@@ -126,14 +126,16 @@ export class LogaccessService extends LogaccessServiceBase {
126
126
  return super.GetLogs(request);
127
127
  }
128
128
 
129
- GetLogsEx(request: GetLogsExRequest): Promise<GetLogsExResponse> {
129
+ async GetLogsEx(request: GetLogsExRequest): Promise<GetLogsExResponse> {
130
+ const logInfo = await this.GetLogAccessInfo();
131
+
130
132
  const getLogsRequest: WsLogaccess.GetLogsRequest = {
131
133
  Filter: {
132
134
  leftBinaryFilter: {
133
135
  BinaryLogFilter: [{
134
136
  leftFilter: {
135
137
  LogCategory: WsLogaccess.LogAccessType.All,
136
- } as WsLogaccess.leftFilter,
138
+ },
137
139
  } as WsLogaccess.BinaryLogFilter]
138
140
  }
139
141
  },
@@ -148,43 +150,99 @@ export class LogaccessService extends LogaccessServiceBase {
148
150
 
149
151
  const filters: WsLogaccess.leftFilter[] = [];
150
152
  for (const key in request) {
151
- if (key in ElasticKnownColumns) {
152
- filters.push({
153
- LogCategory: WsLogaccess.LogAccessType.ByFieldName,
154
- SearchField: ElasticKnownColumns[key],
155
- SearchByValue: request[key]
156
- });
153
+ let searchField;
154
+ switch (logInfo.RemoteLogManagerType) {
155
+ case "azureloganalyticscurl":
156
+ if (key in AzureKnownColumns) {
157
+ searchField = AzureKnownColumns[key];
158
+ }
159
+ break;
160
+ case "elasticstack":
161
+ if (key in ElasticKnownColumns) {
162
+ searchField = ElasticKnownColumns[key];
163
+ }
164
+ break;
165
+ }
166
+ if (searchField) {
167
+ if (Array.isArray(request[key])) {
168
+ request[key].forEach(value => {
169
+ filters.push({
170
+ LogCategory: WsLogaccess.LogAccessType.ByFieldName,
171
+ SearchField: searchField,
172
+ SearchByValue: value
173
+ });
174
+ });
175
+ } else {
176
+ filters.push({
177
+ LogCategory: WsLogaccess.LogAccessType.ByFieldName,
178
+ SearchField: searchField,
179
+ SearchByValue: request[key]
180
+ });
181
+ }
157
182
  }
158
183
  }
159
184
 
160
- let binaryLogFilter = getLogsRequest.Filter.leftBinaryFilter.BinaryLogFilter[0];
161
- filters.forEach((filter, i) => {
162
- if (i === 0) {
163
- binaryLogFilter.leftFilter = filter;
164
- } else if (i === filters.length - 1) {
165
- binaryLogFilter.Operator = WsLogaccess.LogAccessFilterOperator.AND;
166
- binaryLogFilter.rightFilter = filter;
167
- } else {
168
- binaryLogFilter.Operator = WsLogaccess.LogAccessFilterOperator.AND;
169
- binaryLogFilter.rightBinaryFilter = {
170
- BinaryLogFilter: [{
171
- leftFilter: filter
172
- } as WsLogaccess.BinaryLogFilter]
185
+ if (filters.length > 2) {
186
+ let binaryLogFilter = getLogsRequest.Filter.leftBinaryFilter.BinaryLogFilter[0];
187
+ filters.forEach((filter, i) => {
188
+ let operator = WsLogaccess.LogAccessFilterOperator.AND;
189
+ if (i > 0) {
190
+ if (filters[i - 1].SearchField === filter.SearchField) {
191
+ operator = WsLogaccess.LogAccessFilterOperator.OR;
192
+ }
193
+ if (i === filters.length - 1) {
194
+ binaryLogFilter.Operator = operator;
195
+ binaryLogFilter.rightFilter = filter as WsLogaccess.rightFilter;
196
+ } else {
197
+ binaryLogFilter.Operator = operator;
198
+ binaryLogFilter.rightBinaryFilter = {
199
+ BinaryLogFilter: [{
200
+ leftFilter: filter
201
+ } as WsLogaccess.BinaryLogFilter]
202
+ };
203
+ binaryLogFilter = binaryLogFilter.rightBinaryFilter.BinaryLogFilter[0];
204
+ }
205
+ } else {
206
+ binaryLogFilter.leftFilter = filter as WsLogaccess.leftFilter;
207
+ }
208
+ });
209
+ } else {
210
+ delete getLogsRequest.Filter.leftBinaryFilter;
211
+ getLogsRequest.Filter.leftFilter = {
212
+ LogCategory: WsLogaccess.LogAccessType.All
213
+ } as WsLogaccess.leftFilter;
214
+ if (filters[0]?.SearchField) {
215
+ getLogsRequest.Filter.leftFilter = {
216
+ LogCategory: filters[0]?.LogCategory,
217
+ SearchField: filters[0]?.SearchField,
218
+ SearchByValue: filters[0]?.SearchByValue
173
219
  };
174
- binaryLogFilter = binaryLogFilter.rightBinaryFilter.BinaryLogFilter[0];
175
220
  }
176
- });
221
+ if (filters[1]?.SearchField) {
222
+ getLogsRequest.Filter.Operator = WsLogaccess.LogAccessFilterOperator.AND;
223
+ if (filters[0].SearchField === filters[1].SearchField) {
224
+ getLogsRequest.Filter.Operator = WsLogaccess.LogAccessFilterOperator.OR;
225
+ }
226
+ getLogsRequest.Filter.rightFilter = {
227
+ LogCategory: filters[0]?.LogCategory,
228
+ SearchField: filters[1]?.SearchField,
229
+ SearchByValue: filters[1]?.SearchByValue
230
+ };
231
+ }
232
+ }
177
233
 
178
- if (request.StartDate && request.EndDate) {
234
+ if (request.StartDate) {
179
235
  getLogsRequest.Range.StartDate = request.StartDate.toISOString();
236
+ }
237
+ if (request.EndDate) {
180
238
  getLogsRequest.Range.EndDate = request.EndDate.toISOString();
181
239
  }
182
240
 
183
- return Promise.all([this.GetLogAccessInfo(), this.GetLogs(getLogsRequest)]).then(([info, response]) => {
241
+ return this.GetLogs(getLogsRequest).then(response => {
184
242
  try {
185
243
  const logLines = JSON.parse(response.LogLines);
186
244
  let lines = [];
187
- switch (info.RemoteLogManagerType) {
245
+ switch (logInfo.RemoteLogManagerType) {
188
246
  case "azureloganalyticscurl":
189
247
  lines = logLines.lines?.map(azureToLogLine) ?? [];
190
248
  break;
@@ -192,12 +250,12 @@ export class LogaccessService extends LogaccessServiceBase {
192
250
  lines = logLines.lines?.map(elasticToLogLine) ?? [];
193
251
  break;
194
252
  default:
195
- logger.warning(`Unknown RemoteLogManagerType: ${info.RemoteLogManagerType}`);
253
+ logger.warning(`Unknown RemoteLogManagerType: ${logInfo.RemoteLogManagerType}`);
196
254
  lines = [];
197
255
  }
198
256
  return {
199
257
  lines: lines,
200
- total: response.TotalLogLinesAvailable || 10000
258
+ total: response.TotalLogLinesAvailable ?? 10000
201
259
  };
202
260
  } catch (e) {
203
261
  logger.error(e);