@hpcc-js/comms 2.82.3 → 2.83.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.
Files changed (37) hide show
  1. package/dist/index.es6.js +431 -44
  2. package/dist/index.es6.js.map +1 -1
  3. package/dist/index.js +430 -43
  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 +430 -43
  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 +58 -1
  13. package/lib-es6/ecl/dfuWorkunit.js.map +1 -1
  14. package/lib-es6/ecl/workunit.js +9 -1
  15. package/lib-es6/ecl/workunit.js.map +1 -1
  16. package/lib-es6/services/fileSpray.js +5 -1
  17. package/lib-es6/services/fileSpray.js.map +1 -1
  18. package/lib-es6/services/wsdl/FileSpray/v1.25/FileSpray.js +116 -0
  19. package/lib-es6/services/wsdl/FileSpray/v1.25/FileSpray.js.map +1 -0
  20. package/package.json +2 -2
  21. package/src/__package__.ts +2 -2
  22. package/src/ecl/dfuWorkunit.ts +56 -3
  23. package/src/ecl/workunit.ts +10 -1
  24. package/src/services/fileSpray.ts +11 -96
  25. package/src/services/wsdl/FileSpray/v1.25/FileSpray.ts +1040 -0
  26. package/types/__package__.d.ts +2 -2
  27. package/types/ecl/dfuWorkunit.d.ts +11 -3
  28. package/types/ecl/dfuWorkunit.d.ts.map +1 -1
  29. package/types/ecl/workunit.d.ts.map +1 -1
  30. package/types/services/fileSpray.d.ts +9 -95
  31. package/types/services/fileSpray.d.ts.map +1 -1
  32. package/types/services/wsdl/FileSpray/v1.25/FileSpray.d.ts +856 -0
  33. package/types/services/wsdl/FileSpray/v1.25/FileSpray.d.ts.map +1 -0
  34. package/types-3.4/__package__.d.ts +2 -2
  35. package/types-3.4/ecl/dfuWorkunit.d.ts +11 -3
  36. package/types-3.4/services/fileSpray.d.ts +9 -95
  37. package/types-3.4/services/wsdl/FileSpray/v1.25/FileSpray.d.ts +856 -0
@@ -2,7 +2,7 @@ import { Cache, IEvent, scopedLogger, StateCallback, StateEvents, StateObject, S
2
2
  import { IConnection, IOptions } from "../connection";
3
3
  import { ESPExceptions } from "../espConnection";
4
4
  import { WsSMC } from "../services/wsSMC";
5
- import { FileSpray, SprayFixedEx, FileSprayService, SprayVariableEx } from "../services/fileSpray";
5
+ import { FileSpray, FileSprayService, UpdateDFUWorkunitEx } from "../services/fileSpray";
6
6
  import * as WsTopology from "../services/wsTopology";
7
7
 
8
8
  const logger = scopedLogger("@hpcc-js/comms/dfuWorkunit.ts");
@@ -95,6 +95,8 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
95
95
  get expireDays(): number { return this.get("expireDays"); }
96
96
  get PreserveFileParts(): boolean { return this.get("PreserveFileParts"); }
97
97
  get FileAccessCost(): number { return this.get("FileAccessCost"); }
98
+ get KbPerSecAve(): number { return this.get("KbPerSecAve"); }
99
+ get KbPerSec(): number { return this.get("KbPerSec"); }
98
100
 
99
101
  // Factories ---
100
102
  static create(optsConnection: IOptions | IConnection, dfuServerQueue: string): Promise<DFUWorkunit> {
@@ -116,7 +118,7 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
116
118
  return retVal;
117
119
  }
118
120
 
119
- static sprayFixed(server: IOptions | IConnection, request: Partial<SprayFixedEx>): Promise<DFUWorkunit> {
121
+ static sprayFixed(server: IOptions | IConnection, request: Partial<FileSpray.SprayFixed>): Promise<DFUWorkunit> {
120
122
  const service = new FileSprayService(server);
121
123
  return service.SprayFixedEx({
122
124
  ...request
@@ -128,7 +130,7 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
128
130
  });
129
131
  }
130
132
 
131
- static sprayVariable(server: IOptions | IConnection, request: Partial<SprayVariableEx>): Promise<DFUWorkunit> {
133
+ static sprayVariable(server: IOptions | IConnection, request: Partial<FileSpray.SprayVariable>): Promise<DFUWorkunit> {
132
134
  const service = new FileSprayService(server);
133
135
  return service.SprayVariableEx({
134
136
  ...request
@@ -152,6 +154,21 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
152
154
  });
153
155
  }
154
156
 
157
+ update(request: Partial<UpdateDFUWorkunitEx>): Promise<FileSpray.UpdateDFUWorkunitResponse> {
158
+ return this.connection.UpdateDFUWorkunitEx({
159
+ wu: {
160
+ JobName: request?.wu?.JobName ?? this.JobName,
161
+ isProtected: request?.wu?.isProtected ?? this.isProtected,
162
+ ID: this.ID,
163
+ State: this.State
164
+ },
165
+ ClusterOrig: this.ClusterName,
166
+ JobNameOrig: this.JobName,
167
+ isProtectedOrig: this.isProtected,
168
+ StateOrig: this.State
169
+ });
170
+ }
171
+
155
172
  isComplete(): boolean {
156
173
  switch (this.State) {
157
174
  case States.Finished:
@@ -184,11 +201,23 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
184
201
  return !this.isComplete();
185
202
  }
186
203
 
204
+ abort(): Promise<FileSpray.AbortDFUWorkunitResponse> {
205
+ return this.connection.AbortDFUWorkunit({ wuid: this.ID });
206
+ }
207
+
208
+ delete() {
209
+ return this.DFUWUAction(FileSpray.DFUWUActions.Delete);
210
+ }
211
+
187
212
  async refresh(full: boolean = false): Promise<this> {
188
213
  await this.GetDFUWorkunit();
189
214
  return this;
190
215
  }
191
216
 
217
+ fetchXML(callback?: void): Promise<FileSpray.DFUWUFileResponse> {
218
+ return this.DFUWUFile();
219
+ }
220
+
192
221
  // Monitoring ---
193
222
  protected _monitor(): void {
194
223
  if (this.isComplete()) {
@@ -210,6 +239,30 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
210
239
  return retVal;
211
240
  }
212
241
 
242
+ protected DFUWUFile(_request: Partial<FileSpray.DFUWUFileRequest> = {}): Promise<FileSpray.DFUWUFileResponse> {
243
+ return this.connection.DFUWUFile({
244
+ ..._request, Wuid: this.ID
245
+ }).then(response => {
246
+ //TODO: additional processing?
247
+ return response;
248
+ }).catch((e: ESPExceptions) => {
249
+ return {} as FileSpray.DFUWUFileResponse;
250
+ });
251
+ }
252
+
253
+ protected DFUWUAction(actionType: FileSpray.DFUWUActions): Promise<FileSpray.DFUWorkunitsActionResponse> {
254
+ return this.connection.DFUWorkunitsAction({
255
+ wuids: { Item: [this.ID] },
256
+ Type: actionType
257
+ }).then((response) => {
258
+ if (actionType === FileSpray.DFUWUActions.Delete) return response;
259
+ return this.refresh().then(() => {
260
+ this._monitor();
261
+ return response;
262
+ });
263
+ });
264
+ }
265
+
213
266
  // Events ---
214
267
  on(eventID: DFUWorkunitEvents, propIDorCallback: StateCallback | keyof UDFUWorkunitState, callback?: StatePropCallback): this {
215
268
  if (this.isCallback(propIDorCallback)) {
@@ -1,4 +1,5 @@
1
1
  import { Cache, deepMixinT, IEvent, scopedLogger, StateCallback, StateEvents, StateObject, StatePropCallback, StringAnyMap, XMLNode } from "@hpcc-js/util";
2
+ import { format as d3Format } from "d3-format";
2
3
  import { utcFormat, utcParse } from "d3-time-format";
3
4
  import { IConnection, IOptions } from "../connection";
4
5
  import { ESPExceptions } from "../espConnection";
@@ -14,6 +15,14 @@ import { Timer } from "./timer";
14
15
 
15
16
  const formatter = utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");
16
17
  const parser = utcParse("%Y-%m-%dT%H:%M:%S.%LZ");
18
+ const d3FormatNum = d3Format(",");
19
+ function formatNum(num: number | string): string {
20
+ if (num && !isNaN(+num)) {
21
+ return d3FormatNum(+num);
22
+ }
23
+ return num as string;
24
+ }
25
+
17
26
  const logger = scopedLogger("workunit.ts");
18
27
 
19
28
  const WUStateID = WsWorkunits.WUStateID;
@@ -567,7 +576,7 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
567
576
  default:
568
577
  props[scopeProperty.Name] = scopeProperty.RawValue;
569
578
  }
570
- formattedProps[scopeProperty.Name] = scopeProperty.Formatted ?? props[scopeProperty.Name];
579
+ formattedProps[scopeProperty.Name] = formatNum(scopeProperty.Formatted ?? props[scopeProperty.Name]);
571
580
 
572
581
  }
573
582
  }
@@ -1,116 +1,31 @@
1
- import { FileSprayServiceBase, FileSpray } from "./wsdl/FileSpray/v1.23/FileSpray";
1
+ import { FileSprayServiceBase, FileSpray } from "./wsdl/FileSpray/v1.25/FileSpray";
2
2
 
3
3
  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
- }
7
+ type UpdateDFUWorkunitMinusWU = Omit<FileSpray.UpdateDFUWorkunit, "wu">;
8
+ type UpdateDFUWorkunitWU = FileSpray.UpdateDFUWorkunit["wu"];
79
9
 
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;
10
+ export interface UpdateDFUWorkunitEx extends UpdateDFUWorkunitMinusWU {
11
+ wu?: Partial<UpdateDFUWorkunitWU>
100
12
  }
101
13
 
102
14
  export class FileSprayService extends FileSprayServiceBase {
103
15
 
104
- SprayFixedEx(request: SprayFixedEx): Promise<FileSpray.SprayFixedResponse> {
16
+ SprayFixedEx(request: Partial<FileSpray.SprayFixed>): Promise<FileSpray.SprayFixedResponse> {
105
17
  return this._connection.send("SprayFixed", request);
106
18
  }
107
19
 
108
- SprayVariableEx(request: SprayVariableEx): Promise<FileSpray.SprayResponse> {
20
+ SprayVariableEx(request: Partial<FileSpray.SprayVariable>): Promise<FileSpray.SprayResponse> {
109
21
  return this._connection.send("SprayVariable", request, "json", false, null, "SprayResponse");
110
22
  }
111
23
 
112
- DesprayEx(request: DesprayEx): Promise<FileSpray.DesprayResponse> {
24
+ DesprayEx(request: Partial<FileSpray.Despray>): Promise<FileSpray.DesprayResponse> {
113
25
  return this._connection.send("Despray", request);
114
26
  }
115
27
 
28
+ UpdateDFUWorkunitEx(request: Partial<UpdateDFUWorkunitEx>): Promise<FileSpray.UpdateDFUWorkunitResponse> {
29
+ return this._connection.send("UpdateDFUWorkunit", request, "json", false, undefined, "UpdateDFUWorkunitResponse");
30
+ }
116
31
  }