@hpcc-js/comms 2.82.3 → 2.83.1

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 (43) hide show
  1. package/dist/index.es6.js +1093 -639
  2. package/dist/index.es6.js.map +1 -1
  3. package/dist/index.js +1091 -637
  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 +1092 -638
  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/query.js +102 -34
  15. package/lib-es6/ecl/query.js.map +1 -1
  16. package/lib-es6/ecl/workunit.js +9 -1
  17. package/lib-es6/ecl/workunit.js.map +1 -1
  18. package/lib-es6/services/fileSpray.js +5 -1
  19. package/lib-es6/services/fileSpray.js.map +1 -1
  20. package/lib-es6/services/wsdl/FileSpray/v1.25/FileSpray.js +116 -0
  21. package/lib-es6/services/wsdl/FileSpray/v1.25/FileSpray.js.map +1 -0
  22. package/package.json +2 -2
  23. package/src/__package__.ts +2 -2
  24. package/src/ecl/dfuWorkunit.ts +56 -3
  25. package/src/ecl/query.ts +65 -42
  26. package/src/ecl/workunit.ts +10 -1
  27. package/src/services/fileSpray.ts +11 -96
  28. package/src/services/wsdl/FileSpray/v1.25/FileSpray.ts +1040 -0
  29. package/types/__package__.d.ts +2 -2
  30. package/types/ecl/dfuWorkunit.d.ts +11 -3
  31. package/types/ecl/dfuWorkunit.d.ts.map +1 -1
  32. package/types/ecl/query.d.ts +5 -2
  33. package/types/ecl/query.d.ts.map +1 -1
  34. package/types/ecl/workunit.d.ts.map +1 -1
  35. package/types/services/fileSpray.d.ts +9 -95
  36. package/types/services/fileSpray.d.ts.map +1 -1
  37. package/types/services/wsdl/FileSpray/v1.25/FileSpray.d.ts +856 -0
  38. package/types/services/wsdl/FileSpray/v1.25/FileSpray.d.ts.map +1 -0
  39. package/types-3.4/__package__.d.ts +2 -2
  40. package/types-3.4/ecl/dfuWorkunit.d.ts +11 -3
  41. package/types-3.4/ecl/query.d.ts +5 -2
  42. package/types-3.4/services/fileSpray.d.ts +9 -95
  43. package/types-3.4/services/wsdl/FileSpray/v1.25/FileSpray.d.ts +856 -0
package/dist/index.js CHANGED
@@ -611,8 +611,8 @@
611
611
  }
612
612
 
613
613
  var PKG_NAME = "@hpcc-js/comms";
614
- var PKG_VERSION = "2.82.3";
615
- var BUILD_VERSION = "2.104.21";
614
+ var PKG_VERSION = "2.83.1";
615
+ var BUILD_VERSION = "2.104.23";
616
616
 
617
617
  /******************************************************************************
618
618
  Copyright (c) Microsoft Corporation.
@@ -704,7 +704,7 @@
704
704
  return to.concat(ar || Array.prototype.slice.call(from));
705
705
  }
706
706
 
707
- var logger$3 = util.scopedLogger("comms/connection.ts");
707
+ var logger$4 = util.scopedLogger("comms/connection.ts");
708
708
  function instanceOfIOptions(object) {
709
709
  return "baseUrl" in object;
710
710
  }
@@ -806,12 +806,12 @@
806
806
  respondedTimeout -= respondedTick;
807
807
  if (respondedTimeout <= 0) {
808
808
  clearInterval(progress);
809
- logger$3.error("Request timeout: " + script.src);
809
+ logger$4.error("Request timeout: " + script.src);
810
810
  doCallback();
811
811
  reject(Error("Request timeout: " + script.src));
812
812
  }
813
813
  else {
814
- logger$3.debug("Request pending (" + respondedTimeout / 1000 + " sec): " + script.src);
814
+ logger$4.debug("Request pending (" + respondedTimeout / 1000 + " sec): " + script.src);
815
815
  }
816
816
  }
817
817
  }, respondedTick);
@@ -1089,109 +1089,114 @@
1089
1089
  return Service;
1090
1090
  }());
1091
1091
 
1092
- var DFUWUActions;
1093
- (function (DFUWUActions) {
1094
- DFUWUActions["Delete"] = "Delete";
1095
- DFUWUActions["Protect"] = "Protect";
1096
- DFUWUActions["Unprotect"] = "Unprotect";
1097
- DFUWUActions["Restore"] = "Restore";
1098
- DFUWUActions["SetToFailed"] = "SetToFailed";
1099
- DFUWUActions["Archive"] = "Archive";
1100
- })(DFUWUActions || (DFUWUActions = {}));
1092
+ exports.FileSpray = void 0;
1093
+ (function (FileSpray) {
1094
+ (function (DFUWUActions) {
1095
+ DFUWUActions["Delete"] = "Delete";
1096
+ DFUWUActions["Protect"] = "Protect";
1097
+ DFUWUActions["Unprotect"] = "Unprotect";
1098
+ DFUWUActions["Restore"] = "Restore";
1099
+ DFUWUActions["SetToFailed"] = "SetToFailed";
1100
+ DFUWUActions["Archive"] = "Archive";
1101
+ })(FileSpray.DFUWUActions || (FileSpray.DFUWUActions = {}));
1102
+ })(exports.FileSpray || (exports.FileSpray = {}));
1101
1103
  var FileSprayServiceBase = /** @class */ (function (_super) {
1102
1104
  __extends(FileSprayServiceBase, _super);
1103
1105
  function FileSprayServiceBase(optsConnection) {
1104
- return _super.call(this, optsConnection, "FileSpray", "1.23") || this;
1106
+ return _super.call(this, optsConnection, "FileSpray", "1.25") || this;
1105
1107
  }
1106
1108
  FileSprayServiceBase.prototype.AbortDFUWorkunit = function (request) {
1107
- return this._connection.send("AbortDFUWorkunit", request);
1109
+ return this._connection.send("AbortDFUWorkunit", request, "json", false, undefined, "AbortDFUWorkunitResponse");
1108
1110
  };
1109
1111
  FileSprayServiceBase.prototype.Copy = function (request) {
1110
- return this._connection.send("Copy", request);
1112
+ return this._connection.send("Copy", request, "json", false, undefined, "CopyResponse");
1113
+ };
1114
+ FileSprayServiceBase.prototype.CreateDFUPublisherWorkunit = function (request) {
1115
+ return this._connection.send("CreateDFUPublisherWorkunit", request, "json", false, undefined, "CreateDFUPublisherWorkunitResponse");
1111
1116
  };
1112
1117
  FileSprayServiceBase.prototype.CreateDFUWorkunit = function (request) {
1113
- return this._connection.send("CreateDFUWorkunit", request);
1118
+ return this._connection.send("CreateDFUWorkunit", request, "json", false, undefined, "CreateDFUWorkunitResponse");
1114
1119
  };
1115
1120
  FileSprayServiceBase.prototype.DFUWUFile = function (request) {
1116
- return this._connection.send("DFUWUFile", request);
1121
+ return this._connection.send("DFUWUFile", request, "json", false, undefined, "DFUWUFileResponse");
1117
1122
  };
1118
1123
  FileSprayServiceBase.prototype.DFUWUSearch = function (request) {
1119
- return this._connection.send("DFUWUSearch", request);
1124
+ return this._connection.send("DFUWUSearch", request, "json", false, undefined, "DFUWUSearchResponse");
1120
1125
  };
1121
1126
  FileSprayServiceBase.prototype.DFUWorkunitsAction = function (request) {
1122
- return this._connection.send("DFUWorkunitsAction", request);
1127
+ return this._connection.send("DFUWorkunitsAction", request, "json", false, undefined, "DFUWorkunitsActionResponse");
1123
1128
  };
1124
1129
  FileSprayServiceBase.prototype.DeleteDFUWorkunit = function (request) {
1125
- return this._connection.send("DeleteDFUWorkunit", request);
1130
+ return this._connection.send("DeleteDFUWorkunit", request, "json", false, undefined, "DeleteDFUWorkunitResponse");
1126
1131
  };
1127
1132
  FileSprayServiceBase.prototype.DeleteDFUWorkunits = function (request) {
1128
- return this._connection.send("DeleteDFUWorkunits", request);
1133
+ return this._connection.send("DeleteDFUWorkunits", request, "json", false, undefined, "DeleteDFUWorkunitsResponse");
1129
1134
  };
1130
1135
  FileSprayServiceBase.prototype.DeleteDropZoneFiles = function (request) {
1131
- return this._connection.send("DeleteDropZoneFiles", request);
1136
+ return this._connection.send("DeleteDropZoneFiles", request, "json", false, undefined, "DFUWorkunitsActionResponse");
1132
1137
  };
1133
1138
  FileSprayServiceBase.prototype.Despray = function (request) {
1134
- return this._connection.send("Despray", request);
1139
+ return this._connection.send("Despray", request, "json", false, undefined, "DesprayResponse");
1135
1140
  };
1136
1141
  FileSprayServiceBase.prototype.DfuMonitor = function (request) {
1137
- return this._connection.send("DfuMonitor", request);
1142
+ return this._connection.send("DfuMonitor", request, "json", false, undefined, "DfuMonitorResponse");
1138
1143
  };
1139
1144
  FileSprayServiceBase.prototype.DropZoneFileSearch = function (request) {
1140
- return this._connection.send("DropZoneFileSearch", request);
1145
+ return this._connection.send("DropZoneFileSearch", request, "json", false, undefined, "DropZoneFileSearchResponse");
1141
1146
  };
1142
1147
  FileSprayServiceBase.prototype.DropZoneFiles = function (request) {
1143
- return this._connection.send("DropZoneFiles", request);
1148
+ return this._connection.send("DropZoneFiles", request, "json", false, undefined, "DropZoneFilesResponse");
1144
1149
  };
1145
1150
  FileSprayServiceBase.prototype.EchoDateTime = function (request) {
1146
- return this._connection.send("EchoDateTime", request);
1151
+ return this._connection.send("EchoDateTime", request, "json", false, undefined, "EchoDateTimeResponse");
1147
1152
  };
1148
1153
  FileSprayServiceBase.prototype.FileList = function (request) {
1149
- return this._connection.send("FileList", request);
1154
+ return this._connection.send("FileList", request, "json", false, undefined, "FileListResponse");
1150
1155
  };
1151
1156
  FileSprayServiceBase.prototype.GetDFUExceptions = function (request) {
1152
- return this._connection.send("GetDFUExceptions", request);
1157
+ return this._connection.send("GetDFUExceptions", request, "json", false, undefined, "GetDFUExceptionsResponse");
1153
1158
  };
1154
1159
  FileSprayServiceBase.prototype.GetDFUProgress = function (request) {
1155
- return this._connection.send("GetDFUProgress", request);
1160
+ return this._connection.send("GetDFUProgress", request, "json", false, undefined, "ProgressResponse");
1156
1161
  };
1157
1162
  FileSprayServiceBase.prototype.GetDFUServerQueues = function (request) {
1158
- return this._connection.send("GetDFUServerQueues", request);
1163
+ return this._connection.send("GetDFUServerQueues", request, "json", false, undefined, "GetDFUServerQueuesResponse");
1159
1164
  };
1160
1165
  FileSprayServiceBase.prototype.GetDFUWorkunit = function (request) {
1161
- return this._connection.send("GetDFUWorkunit", request);
1166
+ return this._connection.send("GetDFUWorkunit", request, "json", false, undefined, "GetDFUWorkunitResponse");
1162
1167
  };
1163
1168
  FileSprayServiceBase.prototype.GetDFUWorkunits = function (request) {
1164
- return this._connection.send("GetDFUWorkunits", request);
1169
+ return this._connection.send("GetDFUWorkunits", request, "json", false, undefined, "GetDFUWorkunitsResponse");
1165
1170
  };
1166
1171
  FileSprayServiceBase.prototype.GetSprayTargets = function (request) {
1167
- return this._connection.send("GetSprayTargets", request);
1172
+ return this._connection.send("GetSprayTargets", request, "json", false, undefined, "GetSprayTargetsResponse");
1168
1173
  };
1169
1174
  FileSprayServiceBase.prototype.OpenSave = function (request) {
1170
- return this._connection.send("OpenSave", request);
1175
+ return this._connection.send("OpenSave", request, "json", false, undefined, "OpenSaveResponse");
1171
1176
  };
1172
1177
  FileSprayServiceBase.prototype.Ping = function (request) {
1173
- return this._connection.send("Ping", request);
1178
+ return this._connection.send("Ping", request, "json", false, undefined, "FileSprayPingResponse");
1174
1179
  };
1175
1180
  FileSprayServiceBase.prototype.Rename = function (request) {
1176
- return this._connection.send("Rename", request);
1181
+ return this._connection.send("Rename", request, "json", false, undefined, "RenameResponse");
1177
1182
  };
1178
1183
  FileSprayServiceBase.prototype.Replicate = function (request) {
1179
- return this._connection.send("Replicate", request);
1184
+ return this._connection.send("Replicate", request, "json", false, undefined, "ReplicateResponse");
1180
1185
  };
1181
1186
  FileSprayServiceBase.prototype.ShowResult = function (request) {
1182
- return this._connection.send("ShowResult", request);
1187
+ return this._connection.send("ShowResult", request, "json", false, undefined, "ShowResultResponse");
1183
1188
  };
1184
1189
  FileSprayServiceBase.prototype.SprayFixed = function (request) {
1185
- return this._connection.send("SprayFixed", request);
1190
+ return this._connection.send("SprayFixed", request, "json", false, undefined, "SprayFixedResponse");
1186
1191
  };
1187
1192
  FileSprayServiceBase.prototype.SprayVariable = function (request) {
1188
- return this._connection.send("SprayVariable", request);
1193
+ return this._connection.send("SprayVariable", request, "json", false, undefined, "SprayResponse");
1189
1194
  };
1190
1195
  FileSprayServiceBase.prototype.SubmitDFUWorkunit = function (request) {
1191
- return this._connection.send("SubmitDFUWorkunit", request);
1196
+ return this._connection.send("SubmitDFUWorkunit", request, "json", false, undefined, "SubmitDFUWorkunitResponse");
1192
1197
  };
1193
1198
  FileSprayServiceBase.prototype.UpdateDFUWorkunit = function (request) {
1194
- return this._connection.send("UpdateDFUWorkunit", request);
1199
+ return this._connection.send("UpdateDFUWorkunit", request, "json", false, undefined, "UpdateDFUWorkunitResponse");
1195
1200
  };
1196
1201
  return FileSprayServiceBase;
1197
1202
  }(Service));
@@ -1210,6 +1215,9 @@
1210
1215
  FileSprayService.prototype.DesprayEx = function (request) {
1211
1216
  return this._connection.send("Despray", request);
1212
1217
  };
1218
+ FileSprayService.prototype.UpdateDFUWorkunitEx = function (request) {
1219
+ return this._connection.send("UpdateDFUWorkunit", request, "json", false, undefined, "UpdateDFUWorkunitResponse");
1220
+ };
1213
1221
  return FileSprayService;
1214
1222
  }(FileSprayServiceBase));
1215
1223
 
@@ -1983,7 +1991,7 @@
1983
1991
  return LogaccessServiceBase;
1984
1992
  }(Service));
1985
1993
 
1986
- var logger$2 = util.scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
1994
+ var logger$3 = util.scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
1987
1995
  var ElasticKnownColumns;
1988
1996
  (function (ElasticKnownColumns) {
1989
1997
  ElasticKnownColumns["audience"] = "hpcc.log.audience";
@@ -2185,7 +2193,7 @@
2185
2193
  lines = (_d = (_c = logLines.lines) === null || _c === void 0 ? void 0 : _c.map(elasticToLogLine)) !== null && _d !== void 0 ? _d : [];
2186
2194
  break;
2187
2195
  default:
2188
- logger$2.warning("Unknown RemoteLogManagerType: ".concat(logInfo.RemoteLogManagerType));
2196
+ logger$3.warning("Unknown RemoteLogManagerType: ".concat(logInfo.RemoteLogManagerType));
2189
2197
  lines = [];
2190
2198
  }
2191
2199
  return {
@@ -2194,7 +2202,7 @@
2194
2202
  };
2195
2203
  }
2196
2204
  catch (e) {
2197
- logger$2.error(e);
2205
+ logger$3.error(e);
2198
2206
  }
2199
2207
  return {
2200
2208
  lines: [],
@@ -3164,6 +3172,321 @@
3164
3172
  return WorkunitsServiceEx;
3165
3173
  }(WorkunitsServiceBase));
3166
3174
 
3175
+ function formatDecimal(x) {
3176
+ return Math.abs(x = Math.round(x)) >= 1e21
3177
+ ? x.toLocaleString("en").replace(/,/g, "")
3178
+ : x.toString(10);
3179
+ }
3180
+
3181
+ // Computes the decimal coefficient and exponent of the specified number x with
3182
+ // significant digits p, where x is positive and p is in [1, 21] or undefined.
3183
+ // For example, formatDecimalParts(1.23) returns ["123", 0].
3184
+ function formatDecimalParts(x, p) {
3185
+ if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
3186
+ var i, coefficient = x.slice(0, i);
3187
+
3188
+ // The string returned by toExponential either has the form \d\.\d+e[-+]\d+
3189
+ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
3190
+ return [
3191
+ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
3192
+ +x.slice(i + 1)
3193
+ ];
3194
+ }
3195
+
3196
+ function exponent(x) {
3197
+ return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
3198
+ }
3199
+
3200
+ function formatGroup(grouping, thousands) {
3201
+ return function(value, width) {
3202
+ var i = value.length,
3203
+ t = [],
3204
+ j = 0,
3205
+ g = grouping[0],
3206
+ length = 0;
3207
+
3208
+ while (i > 0 && g > 0) {
3209
+ if (length + g + 1 > width) g = Math.max(1, width - length);
3210
+ t.push(value.substring(i -= g, i + g));
3211
+ if ((length += g + 1) > width) break;
3212
+ g = grouping[j = (j + 1) % grouping.length];
3213
+ }
3214
+
3215
+ return t.reverse().join(thousands);
3216
+ };
3217
+ }
3218
+
3219
+ function formatNumerals(numerals) {
3220
+ return function(value) {
3221
+ return value.replace(/[0-9]/g, function(i) {
3222
+ return numerals[+i];
3223
+ });
3224
+ };
3225
+ }
3226
+
3227
+ // [[fill]align][sign][symbol][0][width][,][.precision][~][type]
3228
+ var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
3229
+
3230
+ function formatSpecifier(specifier) {
3231
+ if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
3232
+ var match;
3233
+ return new FormatSpecifier({
3234
+ fill: match[1],
3235
+ align: match[2],
3236
+ sign: match[3],
3237
+ symbol: match[4],
3238
+ zero: match[5],
3239
+ width: match[6],
3240
+ comma: match[7],
3241
+ precision: match[8] && match[8].slice(1),
3242
+ trim: match[9],
3243
+ type: match[10]
3244
+ });
3245
+ }
3246
+
3247
+ formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
3248
+
3249
+ function FormatSpecifier(specifier) {
3250
+ this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
3251
+ this.align = specifier.align === undefined ? ">" : specifier.align + "";
3252
+ this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
3253
+ this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
3254
+ this.zero = !!specifier.zero;
3255
+ this.width = specifier.width === undefined ? undefined : +specifier.width;
3256
+ this.comma = !!specifier.comma;
3257
+ this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
3258
+ this.trim = !!specifier.trim;
3259
+ this.type = specifier.type === undefined ? "" : specifier.type + "";
3260
+ }
3261
+
3262
+ FormatSpecifier.prototype.toString = function() {
3263
+ return this.fill
3264
+ + this.align
3265
+ + this.sign
3266
+ + this.symbol
3267
+ + (this.zero ? "0" : "")
3268
+ + (this.width === undefined ? "" : Math.max(1, this.width | 0))
3269
+ + (this.comma ? "," : "")
3270
+ + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
3271
+ + (this.trim ? "~" : "")
3272
+ + this.type;
3273
+ };
3274
+
3275
+ // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
3276
+ function formatTrim(s) {
3277
+ out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
3278
+ switch (s[i]) {
3279
+ case ".": i0 = i1 = i; break;
3280
+ case "0": if (i0 === 0) i0 = i; i1 = i; break;
3281
+ default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
3282
+ }
3283
+ }
3284
+ return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
3285
+ }
3286
+
3287
+ var prefixExponent;
3288
+
3289
+ function formatPrefixAuto(x, p) {
3290
+ var d = formatDecimalParts(x, p);
3291
+ if (!d) return x + "";
3292
+ var coefficient = d[0],
3293
+ exponent = d[1],
3294
+ i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
3295
+ n = coefficient.length;
3296
+ return i === n ? coefficient
3297
+ : i > n ? coefficient + new Array(i - n + 1).join("0")
3298
+ : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
3299
+ : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
3300
+ }
3301
+
3302
+ function formatRounded(x, p) {
3303
+ var d = formatDecimalParts(x, p);
3304
+ if (!d) return x + "";
3305
+ var coefficient = d[0],
3306
+ exponent = d[1];
3307
+ return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
3308
+ : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
3309
+ : coefficient + new Array(exponent - coefficient.length + 2).join("0");
3310
+ }
3311
+
3312
+ var formatTypes = {
3313
+ "%": function(x, p) { return (x * 100).toFixed(p); },
3314
+ "b": function(x) { return Math.round(x).toString(2); },
3315
+ "c": function(x) { return x + ""; },
3316
+ "d": formatDecimal,
3317
+ "e": function(x, p) { return x.toExponential(p); },
3318
+ "f": function(x, p) { return x.toFixed(p); },
3319
+ "g": function(x, p) { return x.toPrecision(p); },
3320
+ "o": function(x) { return Math.round(x).toString(8); },
3321
+ "p": function(x, p) { return formatRounded(x * 100, p); },
3322
+ "r": formatRounded,
3323
+ "s": formatPrefixAuto,
3324
+ "X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
3325
+ "x": function(x) { return Math.round(x).toString(16); }
3326
+ };
3327
+
3328
+ function identity(x) {
3329
+ return x;
3330
+ }
3331
+
3332
+ var map = Array.prototype.map,
3333
+ prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
3334
+
3335
+ function formatLocale$1(locale) {
3336
+ var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
3337
+ currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
3338
+ currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
3339
+ decimal = locale.decimal === undefined ? "." : locale.decimal + "",
3340
+ numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),
3341
+ percent = locale.percent === undefined ? "%" : locale.percent + "",
3342
+ minus = locale.minus === undefined ? "-" : locale.minus + "",
3343
+ nan = locale.nan === undefined ? "NaN" : locale.nan + "";
3344
+
3345
+ function newFormat(specifier) {
3346
+ specifier = formatSpecifier(specifier);
3347
+
3348
+ var fill = specifier.fill,
3349
+ align = specifier.align,
3350
+ sign = specifier.sign,
3351
+ symbol = specifier.symbol,
3352
+ zero = specifier.zero,
3353
+ width = specifier.width,
3354
+ comma = specifier.comma,
3355
+ precision = specifier.precision,
3356
+ trim = specifier.trim,
3357
+ type = specifier.type;
3358
+
3359
+ // The "n" type is an alias for ",g".
3360
+ if (type === "n") comma = true, type = "g";
3361
+
3362
+ // The "" type, and any invalid type, is an alias for ".12~g".
3363
+ else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
3364
+
3365
+ // If zero fill is specified, padding goes after sign and before digits.
3366
+ if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
3367
+
3368
+ // Compute the prefix and suffix.
3369
+ // For SI-prefix, the suffix is lazily computed.
3370
+ var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
3371
+ suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
3372
+
3373
+ // What format function should we use?
3374
+ // Is this an integer type?
3375
+ // Can this type generate exponential notation?
3376
+ var formatType = formatTypes[type],
3377
+ maybeSuffix = /[defgprs%]/.test(type);
3378
+
3379
+ // Set the default precision if not specified,
3380
+ // or clamp the specified precision to the supported range.
3381
+ // For significant precision, it must be in [1, 21].
3382
+ // For fixed precision, it must be in [0, 20].
3383
+ precision = precision === undefined ? 6
3384
+ : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
3385
+ : Math.max(0, Math.min(20, precision));
3386
+
3387
+ function format(value) {
3388
+ var valuePrefix = prefix,
3389
+ valueSuffix = suffix,
3390
+ i, n, c;
3391
+
3392
+ if (type === "c") {
3393
+ valueSuffix = formatType(value) + valueSuffix;
3394
+ value = "";
3395
+ } else {
3396
+ value = +value;
3397
+
3398
+ // Determine the sign. -0 is not less than 0, but 1 / -0 is!
3399
+ var valueNegative = value < 0 || 1 / value < 0;
3400
+
3401
+ // Perform the initial formatting.
3402
+ value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
3403
+
3404
+ // Trim insignificant zeros.
3405
+ if (trim) value = formatTrim(value);
3406
+
3407
+ // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
3408
+ if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
3409
+
3410
+ // Compute the prefix and suffix.
3411
+ valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
3412
+ valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
3413
+
3414
+ // Break the formatted value into the integer “value” part that can be
3415
+ // grouped, and fractional or exponential “suffix” part that is not.
3416
+ if (maybeSuffix) {
3417
+ i = -1, n = value.length;
3418
+ while (++i < n) {
3419
+ if (c = value.charCodeAt(i), 48 > c || c > 57) {
3420
+ valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
3421
+ value = value.slice(0, i);
3422
+ break;
3423
+ }
3424
+ }
3425
+ }
3426
+ }
3427
+
3428
+ // If the fill character is not "0", grouping is applied before padding.
3429
+ if (comma && !zero) value = group(value, Infinity);
3430
+
3431
+ // Compute the padding.
3432
+ var length = valuePrefix.length + value.length + valueSuffix.length,
3433
+ padding = length < width ? new Array(width - length + 1).join(fill) : "";
3434
+
3435
+ // If the fill character is "0", grouping is applied after padding.
3436
+ if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
3437
+
3438
+ // Reconstruct the final output based on the desired alignment.
3439
+ switch (align) {
3440
+ case "<": value = valuePrefix + value + valueSuffix + padding; break;
3441
+ case "=": value = valuePrefix + padding + value + valueSuffix; break;
3442
+ case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
3443
+ default: value = padding + valuePrefix + value + valueSuffix; break;
3444
+ }
3445
+
3446
+ return numerals(value);
3447
+ }
3448
+
3449
+ format.toString = function() {
3450
+ return specifier + "";
3451
+ };
3452
+
3453
+ return format;
3454
+ }
3455
+
3456
+ function formatPrefix(specifier, value) {
3457
+ var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
3458
+ e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
3459
+ k = Math.pow(10, -e),
3460
+ prefix = prefixes[8 + e / 3];
3461
+ return function(value) {
3462
+ return f(k * value) + prefix;
3463
+ };
3464
+ }
3465
+
3466
+ return {
3467
+ format: newFormat,
3468
+ formatPrefix: formatPrefix
3469
+ };
3470
+ }
3471
+
3472
+ var locale$1;
3473
+ var format;
3474
+
3475
+ defaultLocale$1({
3476
+ decimal: ".",
3477
+ thousands: ",",
3478
+ grouping: [3],
3479
+ currency: ["$", ""],
3480
+ minus: "-"
3481
+ });
3482
+
3483
+ function defaultLocale$1(definition) {
3484
+ locale$1 = formatLocale$1(definition);
3485
+ format = locale$1.format;
3486
+ locale$1.formatPrefix;
3487
+ return locale$1;
3488
+ }
3489
+
3167
3490
  var t0 = new Date,
3168
3491
  t1 = new Date;
3169
3492
 
@@ -5260,7 +5583,14 @@
5260
5583
 
5261
5584
  var formatter = utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");
5262
5585
  var parser = utcParse("%Y-%m-%dT%H:%M:%S.%LZ");
5263
- var logger$1 = util.scopedLogger("workunit.ts");
5586
+ var d3FormatNum = format(",");
5587
+ function formatNum(num) {
5588
+ if (num && !isNaN(+num)) {
5589
+ return d3FormatNum(+num);
5590
+ }
5591
+ return num;
5592
+ }
5593
+ var logger$2 = util.scopedLogger("workunit.ts");
5264
5594
  var WUStateID = exports.WUStateID;
5265
5595
  var WorkunitCache = /** @class */ (function (_super) {
5266
5596
  __extends(WorkunitCache, _super);
@@ -6135,7 +6465,7 @@
6135
6465
  default:
6136
6466
  props[scopeProperty.Name] = scopeProperty.RawValue;
6137
6467
  }
6138
- formattedProps[scopeProperty.Name] = (_a = scopeProperty.Formatted) !== null && _a !== void 0 ? _a : props[scopeProperty.Name];
6468
+ formattedProps[scopeProperty.Name] = formatNum((_a = scopeProperty.Formatted) !== null && _a !== void 0 ? _a : props[scopeProperty.Name]);
6139
6469
  }
6140
6470
  }
6141
6471
  data.push(__assign({ id: scope.Id, name: scope.ScopeName, type: scope.ScopeType, __formattedProps: formattedProps }, props));
@@ -6376,7 +6706,7 @@
6376
6706
  return false;
6377
6707
  });
6378
6708
  if (!wuMissing) {
6379
- logger$1.warning("Unexpected exception: ");
6709
+ logger$2.warning("Unexpected exception: ");
6380
6710
  throw e;
6381
6711
  }
6382
6712
  return {};
@@ -6413,7 +6743,7 @@
6413
6743
  return false;
6414
6744
  });
6415
6745
  if (!wuMissing) {
6416
- logger$1.warning("Unexpected exception: ");
6746
+ logger$2.warning("Unexpected exception: ");
6417
6747
  throw e;
6418
6748
  }
6419
6749
  return {};
@@ -6502,7 +6832,7 @@
6502
6832
  }
6503
6833
  return new util.XMLNode(command);
6504
6834
  }).catch(function (_) {
6505
- logger$1.error(_);
6835
+ logger$2.error(_);
6506
6836
  return Promise.resolve(new util.XMLNode(command));
6507
6837
  });
6508
6838
  };
@@ -7321,776 +7651,843 @@
7321
7651
  return Machine;
7322
7652
  }(util.StateObject));
7323
7653
 
7324
- var QueryCache = /** @class */ (function (_super) {
7325
- __extends(QueryCache, _super);
7326
- function QueryCache() {
7654
+ var TargetClusterCache = /** @class */ (function (_super) {
7655
+ __extends(TargetClusterCache, _super);
7656
+ function TargetClusterCache() {
7327
7657
  return _super.call(this, function (obj) {
7328
- return util.Cache.hash([obj.QueryId, obj.QuerySet]);
7658
+ return "".concat(obj.BaseUrl, "-").concat(obj.Name);
7329
7659
  }) || this;
7330
7660
  }
7331
- return QueryCache;
7661
+ return TargetClusterCache;
7332
7662
  }(util.Cache));
7333
- var _queries = new QueryCache();
7334
- var Query = /** @class */ (function (_super) {
7335
- __extends(Query, _super);
7336
- function Query(optsConnection, querySet, queryID, queryDetails) {
7663
+ var _targetCluster = new TargetClusterCache();
7664
+ var TargetCluster = /** @class */ (function (_super) {
7665
+ __extends(TargetCluster, _super);
7666
+ function TargetCluster(optsConnection, name) {
7337
7667
  var _this = _super.call(this) || this;
7338
- if (optsConnection instanceof EclService) {
7668
+ if (optsConnection instanceof TopologyService) {
7339
7669
  _this.connection = optsConnection;
7340
- // this._topology = new Topology(this.connection.opts());
7670
+ _this.machineConnection = new MachineService(optsConnection.connectionOptions());
7341
7671
  }
7342
7672
  else {
7343
- _this.connection = new EclService(optsConnection);
7344
- // this._topology = new Topology(optsConnection);
7673
+ _this.connection = new TopologyService(optsConnection);
7674
+ _this.machineConnection = new MachineService(optsConnection);
7345
7675
  }
7346
- _this._wsWorkunits = new WorkunitsService(optsConnection);
7347
- _this.set(__assign({ QuerySet: querySet, QueryId: queryID }, queryDetails));
7676
+ _this.clear({
7677
+ Name: name
7678
+ });
7348
7679
  return _this;
7349
7680
  }
7350
- Object.defineProperty(Query.prototype, "BaseUrl", {
7681
+ Object.defineProperty(TargetCluster.prototype, "BaseUrl", {
7351
7682
  get: function () { return this.connection.baseUrl; },
7352
7683
  enumerable: false,
7353
7684
  configurable: true
7354
7685
  });
7355
- Object.defineProperty(Query.prototype, "properties", {
7356
- get: function () { return this.get(); },
7357
- enumerable: false,
7358
- configurable: true
7359
- });
7360
- Object.defineProperty(Query.prototype, "Exceptions", {
7361
- get: function () { return this.get("Exceptions"); },
7362
- enumerable: false,
7363
- configurable: true
7364
- });
7365
- Object.defineProperty(Query.prototype, "QueryId", {
7366
- get: function () { return this.get("QueryId"); },
7367
- enumerable: false,
7368
- configurable: true
7369
- });
7370
- Object.defineProperty(Query.prototype, "QuerySet", {
7371
- get: function () { return this.get("QuerySet"); },
7372
- enumerable: false,
7373
- configurable: true
7374
- });
7375
- Object.defineProperty(Query.prototype, "QueryName", {
7376
- get: function () { return this.get("QueryName"); },
7377
- enumerable: false,
7378
- configurable: true
7379
- });
7380
- Object.defineProperty(Query.prototype, "Wuid", {
7381
- get: function () { return this.get("Wuid"); },
7382
- enumerable: false,
7383
- configurable: true
7384
- });
7385
- Object.defineProperty(Query.prototype, "Dll", {
7386
- get: function () { return this.get("Dll"); },
7387
- enumerable: false,
7388
- configurable: true
7389
- });
7390
- Object.defineProperty(Query.prototype, "Suspended", {
7391
- get: function () { return this.get("Suspended"); },
7392
- enumerable: false,
7393
- configurable: true
7394
- });
7395
- Object.defineProperty(Query.prototype, "Activated", {
7396
- get: function () { return this.get("Activated"); },
7397
- enumerable: false,
7398
- configurable: true
7399
- });
7400
- Object.defineProperty(Query.prototype, "SuspendedBy", {
7401
- get: function () { return this.get("SuspendedBy"); },
7402
- enumerable: false,
7403
- configurable: true
7404
- });
7405
- Object.defineProperty(Query.prototype, "Clusters", {
7406
- get: function () { return this.get("Clusters"); },
7407
- enumerable: false,
7408
- configurable: true
7409
- });
7410
- Object.defineProperty(Query.prototype, "PublishedBy", {
7411
- get: function () { return this.get("PublishedBy"); },
7412
- enumerable: false,
7413
- configurable: true
7414
- });
7415
- Object.defineProperty(Query.prototype, "Comment", {
7416
- get: function () { return this.get("Comment"); },
7417
- enumerable: false,
7418
- configurable: true
7419
- });
7420
- Object.defineProperty(Query.prototype, "LogicalFiles", {
7421
- get: function () { return this.get("LogicalFiles"); },
7422
- enumerable: false,
7423
- configurable: true
7424
- });
7425
- Object.defineProperty(Query.prototype, "SuperFiles", {
7426
- get: function () { return this.get("SuperFiles"); },
7686
+ Object.defineProperty(TargetCluster.prototype, "Name", {
7687
+ get: function () { return this.get("Name"); },
7427
7688
  enumerable: false,
7428
7689
  configurable: true
7429
7690
  });
7430
- Object.defineProperty(Query.prototype, "IsLibrary", {
7431
- get: function () { return this.get("IsLibrary"); },
7691
+ Object.defineProperty(TargetCluster.prototype, "Prefix", {
7692
+ get: function () { return this.get("Prefix"); },
7432
7693
  enumerable: false,
7433
7694
  configurable: true
7434
7695
  });
7435
- Object.defineProperty(Query.prototype, "Priority", {
7436
- get: function () { return this.get("Priority"); },
7696
+ Object.defineProperty(TargetCluster.prototype, "Type", {
7697
+ get: function () { return this.get("Type"); },
7437
7698
  enumerable: false,
7438
7699
  configurable: true
7439
7700
  });
7440
- Object.defineProperty(Query.prototype, "WUSnapShot", {
7441
- get: function () { return this.get("WUSnapShot"); },
7701
+ Object.defineProperty(TargetCluster.prototype, "IsDefault", {
7702
+ get: function () { return this.get("IsDefault"); },
7442
7703
  enumerable: false,
7443
7704
  configurable: true
7444
7705
  });
7445
- Object.defineProperty(Query.prototype, "CompileTime", {
7446
- get: function () { return this.get("CompileTime"); },
7706
+ Object.defineProperty(TargetCluster.prototype, "TpClusters", {
7707
+ get: function () { return this.get("TpClusters"); },
7447
7708
  enumerable: false,
7448
7709
  configurable: true
7449
7710
  });
7450
- Object.defineProperty(Query.prototype, "LibrariesUsed", {
7451
- get: function () { return this.get("LibrariesUsed"); },
7711
+ Object.defineProperty(TargetCluster.prototype, "TpEclCCServers", {
7712
+ get: function () { return this.get("TpEclCCServers"); },
7452
7713
  enumerable: false,
7453
7714
  configurable: true
7454
7715
  });
7455
- Object.defineProperty(Query.prototype, "CountGraphs", {
7456
- get: function () { return this.get("CountGraphs"); },
7716
+ Object.defineProperty(TargetCluster.prototype, "TpEclServers", {
7717
+ get: function () { return this.get("TpEclServers"); },
7457
7718
  enumerable: false,
7458
7719
  configurable: true
7459
7720
  });
7460
- Object.defineProperty(Query.prototype, "ResourceURLCount", {
7461
- get: function () { return this.get("ResourceURLCount"); },
7721
+ Object.defineProperty(TargetCluster.prototype, "TpEclAgents", {
7722
+ get: function () { return this.get("TpEclAgents"); },
7462
7723
  enumerable: false,
7463
7724
  configurable: true
7464
7725
  });
7465
- Object.defineProperty(Query.prototype, "WsEclAddresses", {
7466
- get: function () { return this.get("WsEclAddresses"); },
7726
+ Object.defineProperty(TargetCluster.prototype, "TpEclSchedulers", {
7727
+ get: function () { return this.get("TpEclSchedulers"); },
7467
7728
  enumerable: false,
7468
7729
  configurable: true
7469
7730
  });
7470
- Object.defineProperty(Query.prototype, "WUGraphs", {
7471
- get: function () { return this.get("WUGraphs"); },
7731
+ Object.defineProperty(TargetCluster.prototype, "MachineInfoEx", {
7732
+ get: function () { return this.get("MachineInfoEx", []); },
7472
7733
  enumerable: false,
7473
7734
  configurable: true
7474
7735
  });
7475
- Object.defineProperty(Query.prototype, "WUTimers", {
7476
- get: function () { return this.get("WUTimers"); },
7736
+ Object.defineProperty(TargetCluster.prototype, "CMachineInfoEx", {
7737
+ get: function () {
7738
+ var _this = this;
7739
+ return this.MachineInfoEx.map(function (machineInfoEx) { return Machine.attach(_this.machineConnection, machineInfoEx.Address, machineInfoEx); });
7740
+ },
7477
7741
  enumerable: false,
7478
7742
  configurable: true
7479
7743
  });
7480
- Query.attach = function (optsConnection, querySet, queryId) {
7481
- var retVal = _queries.get({ BaseUrl: optsConnection.baseUrl, QuerySet: querySet, QueryId: queryId }, function () {
7482
- return new Query(optsConnection, querySet, queryId);
7744
+ TargetCluster.attach = function (optsConnection, name, state) {
7745
+ var retVal = _targetCluster.get({ BaseUrl: optsConnection.baseUrl, Name: name }, function () {
7746
+ return new TargetCluster(optsConnection, name);
7483
7747
  });
7748
+ if (state) {
7749
+ retVal.set(__assign({}, state));
7750
+ }
7484
7751
  return retVal;
7485
7752
  };
7486
- Query.prototype.fetchDetails = function () {
7487
- return __awaiter(this, void 0, void 0, function () {
7488
- var queryDetails;
7489
- return __generator(this, function (_a) {
7490
- switch (_a.label) {
7491
- case 0: return [4 /*yield*/, this._wsWorkunits.WUQueryDetails({
7492
- QuerySet: this.QuerySet,
7493
- QueryId: this.QueryId,
7494
- IncludeStateOnClusters: false,
7495
- IncludeSuperFiles: false,
7496
- IncludeWsEclAddresses: false,
7497
- CheckAllNodes: false
7498
- })];
7499
- case 1:
7500
- queryDetails = _a.sent();
7501
- this.set(__assign({}, queryDetails));
7502
- return [2 /*return*/];
7753
+ TargetCluster.prototype.fetchMachines = function (request) {
7754
+ var _this = this;
7755
+ if (request === void 0) { request = {}; }
7756
+ return this.machineConnection.GetTargetClusterInfo(__assign({ TargetClusters: {
7757
+ Item: ["".concat(this.Type, ":").concat(this.Name)]
7758
+ } }, request)).then(function (response) {
7759
+ var retVal = [];
7760
+ for (var _i = 0, _a = response.TargetClusterInfoList.TargetClusterInfo; _i < _a.length; _i++) {
7761
+ var machineInfo = _a[_i];
7762
+ for (var _b = 0, _c = machineInfo.Processes.MachineInfoEx; _b < _c.length; _b++) {
7763
+ var machineInfoEx = _c[_b];
7764
+ retVal.push(machineInfoEx);
7503
7765
  }
7504
- });
7766
+ }
7767
+ _this.set("MachineInfoEx", retVal);
7768
+ return _this.CMachineInfoEx;
7505
7769
  });
7506
7770
  };
7507
- Query.prototype.fetchRequestSchema = function () {
7508
- return __awaiter(this, void 0, void 0, function () {
7509
- var _a;
7510
- return __generator(this, function (_b) {
7511
- switch (_b.label) {
7512
- case 0:
7513
- _a = this;
7514
- return [4 /*yield*/, this.connection.requestJson(this.QuerySet, this.QueryId)];
7515
- case 1:
7516
- _a._requestSchema = _b.sent();
7517
- return [2 /*return*/];
7771
+ TargetCluster.prototype.machineStats = function () {
7772
+ var maxDisk = 0;
7773
+ var totalFree = 0;
7774
+ var total = 0;
7775
+ for (var _i = 0, _a = this.CMachineInfoEx; _i < _a.length; _i++) {
7776
+ var machine = _a[_i];
7777
+ for (var _b = 0, _c = machine.Storage.StorageInfo; _b < _c.length; _b++) {
7778
+ var storageInfo = _c[_b];
7779
+ totalFree += storageInfo.Available;
7780
+ total += storageInfo.Total;
7781
+ var usage = 1 - storageInfo.Available / storageInfo.Total;
7782
+ if (usage > maxDisk) {
7783
+ maxDisk = usage;
7518
7784
  }
7519
- });
7520
- });
7785
+ }
7786
+ }
7787
+ return {
7788
+ maxDisk: maxDisk,
7789
+ meanDisk: 1 - (total ? totalFree / total : 1)
7790
+ };
7521
7791
  };
7522
- Query.prototype.fetchResponseSchema = function () {
7523
- return __awaiter(this, void 0, void 0, function () {
7524
- var _a;
7525
- return __generator(this, function (_b) {
7526
- switch (_b.label) {
7527
- case 0:
7528
- _a = this;
7529
- return [4 /*yield*/, this.connection.responseJson(this.QuerySet, this.QueryId)];
7530
- case 1:
7531
- _a._responseSchema = _b.sent();
7532
- return [2 /*return*/];
7533
- }
7534
- });
7535
- });
7792
+ TargetCluster.prototype.fetchUsage = function () {
7793
+ return this.machineConnection.GetTargetClusterUsageEx([this.Name]);
7536
7794
  };
7537
- Query.prototype.fetchSchema = function () {
7538
- return __awaiter(this, void 0, void 0, function () {
7539
- return __generator(this, function (_a) {
7540
- switch (_a.label) {
7541
- case 0: return [4 /*yield*/, Promise.all([this.fetchRequestSchema(), this.fetchResponseSchema()])];
7542
- case 1:
7543
- _a.sent();
7544
- return [2 /*return*/];
7795
+ return TargetCluster;
7796
+ }(util.StateObject));
7797
+ function targetClusters(optsConnection) {
7798
+ var connection;
7799
+ if (optsConnection instanceof TopologyService) {
7800
+ connection = optsConnection;
7801
+ }
7802
+ else {
7803
+ connection = new TopologyService(optsConnection);
7804
+ }
7805
+ return connection.TpListTargetClusters({}).then(function (response) {
7806
+ return response.TargetClusters.TpClusterNameType.map(function (item) { return TargetCluster.attach(optsConnection, item.Name, item); });
7807
+ });
7808
+ }
7809
+ var _defaultTargetCluster = {};
7810
+ function defaultTargetCluster(optsConnection) {
7811
+ if (!_defaultTargetCluster[optsConnection.baseUrl]) {
7812
+ var connection = void 0;
7813
+ if (optsConnection instanceof TopologyService) {
7814
+ connection = optsConnection;
7815
+ }
7816
+ else {
7817
+ connection = new TopologyService(optsConnection);
7818
+ }
7819
+ _defaultTargetCluster[optsConnection.baseUrl] = connection.TpListTargetClusters({}).then(function (response) {
7820
+ var firstItem;
7821
+ var defaultItem;
7822
+ var hthorItem;
7823
+ response.TargetClusters.TpClusterNameType.forEach(function (item) {
7824
+ if (!firstItem) {
7825
+ firstItem = item;
7545
7826
  }
7546
- });
7547
- });
7548
- };
7549
- Query.prototype.fetchSummaryStats = function () {
7550
- return this._wsWorkunits.WUQueryGetSummaryStats({ Target: this.QuerySet, QueryId: this.QueryId });
7551
- };
7552
- Query.prototype.submit = function (request) {
7553
- return this.connection.submit(this.QuerySet, this.QueryId, request).then(function (results) {
7554
- for (var key in results) {
7555
- results[key] = results[key].Row;
7556
- }
7557
- return results;
7558
- });
7559
- };
7560
- Query.prototype.refresh = function () {
7561
- return __awaiter(this, void 0, void 0, function () {
7562
- return __generator(this, function (_a) {
7563
- switch (_a.label) {
7564
- case 0: return [4 /*yield*/, Promise.all([
7565
- this.fetchDetails(),
7566
- this.fetchSchema()
7567
- ])];
7568
- case 1:
7569
- _a.sent();
7570
- return [2 /*return*/, this];
7827
+ if (!defaultItem && item.IsDefault === true) {
7828
+ defaultItem = item;
7829
+ }
7830
+ if (!hthorItem && item.Type === "hthor") {
7831
+ hthorItem = item;
7571
7832
  }
7572
7833
  });
7834
+ var defItem = defaultItem || hthorItem || firstItem;
7835
+ return TargetCluster.attach(optsConnection, defItem.Name, defItem);
7573
7836
  });
7574
- };
7575
- Query.prototype.requestFields = function () {
7576
- if (!this._requestSchema)
7577
- return [];
7578
- return this._requestSchema;
7579
- };
7580
- Query.prototype.responseFields = function () {
7581
- if (!this._responseSchema)
7582
- return {};
7583
- return this._responseSchema;
7584
- };
7585
- Query.prototype.resultNames = function () {
7586
- var retVal = [];
7587
- for (var key in this.responseFields()) {
7588
- retVal.push(key);
7589
- }
7590
- return retVal;
7591
- };
7592
- Query.prototype.resultFields = function (resultName) {
7593
- if (!this._responseSchema[resultName])
7594
- return [];
7595
- return this._responseSchema[resultName];
7596
- };
7597
- return Query;
7598
- }(util.StateObject));
7837
+ }
7838
+ return _defaultTargetCluster[optsConnection.baseUrl];
7839
+ }
7599
7840
 
7600
- var StoreCache = /** @class */ (function (_super) {
7601
- __extends(StoreCache, _super);
7602
- function StoreCache() {
7841
+ var TopologyCache = /** @class */ (function (_super) {
7842
+ __extends(TopologyCache, _super);
7843
+ function TopologyCache() {
7603
7844
  return _super.call(this, function (obj) {
7604
- return "".concat(obj.BaseUrl, "-").concat(obj.Name, ":").concat(obj.UserSpecific, "-").concat(obj.Namespace);
7845
+ return obj.BaseUrl;
7605
7846
  }) || this;
7606
7847
  }
7607
- return StoreCache;
7848
+ return TopologyCache;
7608
7849
  }(util.Cache));
7609
- var _store = new StoreCache();
7610
- var ValueChangedMessage = /** @class */ (function (_super) {
7611
- __extends(ValueChangedMessage, _super);
7612
- function ValueChangedMessage(key, value, oldValue) {
7850
+ var _topology = new TopologyCache();
7851
+ var Topology = /** @class */ (function (_super) {
7852
+ __extends(Topology, _super);
7853
+ function Topology(optsConnection) {
7613
7854
  var _this = _super.call(this) || this;
7614
- _this.key = key;
7615
- _this.value = value;
7616
- _this.oldValue = oldValue;
7617
- return _this;
7618
- }
7619
- Object.defineProperty(ValueChangedMessage.prototype, "canConflate", {
7620
- get: function () { return true; },
7621
- enumerable: false,
7622
- configurable: true
7623
- });
7624
- ValueChangedMessage.prototype.conflate = function (other) {
7625
- if (this.key === other.key) {
7626
- this.value = other.value;
7627
- return true;
7628
- }
7629
- return false;
7630
- };
7631
- ValueChangedMessage.prototype.void = function () {
7632
- return this.value === this.oldValue;
7633
- };
7634
- return ValueChangedMessage;
7635
- }(util.Message));
7636
- var Store = /** @class */ (function () {
7637
- function Store(optsConnection, Name, Namespace, UserSpecific) {
7638
- this._dispatch = new util.Dispatch();
7639
- this._knownValues = {};
7640
- if (optsConnection instanceof StoreService) {
7641
- this.connection = optsConnection;
7855
+ if (optsConnection instanceof TopologyService) {
7856
+ _this.connection = optsConnection;
7642
7857
  }
7643
7858
  else {
7644
- this.connection = new StoreService(optsConnection);
7859
+ _this.connection = new TopologyService(optsConnection);
7645
7860
  }
7646
- this.Name = Name;
7647
- this.UserSpecific = UserSpecific;
7648
- this.Namespace = Namespace;
7861
+ return _this;
7649
7862
  }
7650
- Object.defineProperty(Store.prototype, "BaseUrl", {
7863
+ Object.defineProperty(Topology.prototype, "BaseUrl", {
7651
7864
  get: function () { return this.connection.baseUrl; },
7652
7865
  enumerable: false,
7653
7866
  configurable: true
7654
7867
  });
7655
- Store.attach = function (optsConnection, Name, Namespace, UserSpecific) {
7656
- if (Name === void 0) { Name = "HPCCApps"; }
7657
- if (UserSpecific === void 0) { UserSpecific = true; }
7658
- var retVal = _store.get({ BaseUrl: optsConnection.baseUrl, Name: Name, UserSpecific: UserSpecific, Namespace: Namespace }, function () {
7659
- return new Store(optsConnection, Name, Namespace, UserSpecific);
7868
+ Object.defineProperty(Topology.prototype, "properties", {
7869
+ // Accessors ---
7870
+ get: function () { return this.get(); },
7871
+ enumerable: false,
7872
+ configurable: true
7873
+ });
7874
+ Object.defineProperty(Topology.prototype, "TargetClusters", {
7875
+ get: function () { return this.get("TargetClusters"); },
7876
+ enumerable: false,
7877
+ configurable: true
7878
+ });
7879
+ Object.defineProperty(Topology.prototype, "CTargetClusters", {
7880
+ get: function () {
7881
+ var _this = this;
7882
+ return this.TargetClusters.map(function (tc) { return TargetCluster.attach(_this.connection, tc.Name, tc); });
7883
+ },
7884
+ enumerable: false,
7885
+ configurable: true
7886
+ });
7887
+ Object.defineProperty(Topology.prototype, "LogicalClusters", {
7888
+ get: function () { return this.get("LogicalClusters"); },
7889
+ enumerable: false,
7890
+ configurable: true
7891
+ });
7892
+ Object.defineProperty(Topology.prototype, "Services", {
7893
+ get: function () { return this.get("Services"); },
7894
+ enumerable: false,
7895
+ configurable: true
7896
+ });
7897
+ Topology.attach = function (optsConnection) {
7898
+ var retVal = _topology.get({ BaseUrl: optsConnection.baseUrl }, function () {
7899
+ return new Topology(optsConnection);
7660
7900
  });
7661
7901
  return retVal;
7662
7902
  };
7663
- Store.prototype.create = function () {
7664
- this.connection.CreateStore({ Name: this.Name, UserSpecific: this.UserSpecific, Type: "", Description: "" });
7665
- };
7666
- Store.prototype.set = function (key, value, broadcast) {
7903
+ Topology.prototype.GetESPServiceBaseURL = function (type) {
7667
7904
  var _this = this;
7668
- if (broadcast === void 0) { broadcast = true; }
7669
- return this.connection.Set({
7670
- StoreName: this.Name,
7671
- UserSpecific: this.UserSpecific,
7672
- Namespace: this.Namespace,
7673
- Key: key,
7674
- Value: value
7675
- }).then(function (response) {
7676
- var oldValue = _this._knownValues[key];
7677
- _this._knownValues[key] = value;
7678
- if (broadcast) {
7679
- _this._dispatch.post(new ValueChangedMessage(key, value, oldValue));
7905
+ if (type === void 0) { type = ""; }
7906
+ return this.connection.TpServiceQuery({}).then(function (response) {
7907
+ var rootProtocol = _this.connection.protocol();
7908
+ var ip = _this.connection.ip();
7909
+ var port = rootProtocol === "https:" ? "18002" : "8002";
7910
+ if (util.exists("ServiceList.TpEspServers.TpEspServer", response)) {
7911
+ for (var _i = 0, _a = response.ServiceList.TpEspServers.TpEspServer; _i < _a.length; _i++) {
7912
+ var item = _a[_i];
7913
+ if (util.exists("TpBindings.TpBinding", item)) {
7914
+ for (var _b = 0, _c = item.TpBindings.TpBinding; _b < _c.length; _b++) {
7915
+ var binding = _c[_b];
7916
+ if (binding.Service === type && binding.Protocol + ":" === rootProtocol) {
7917
+ port = binding.Port;
7918
+ }
7919
+ }
7920
+ }
7921
+ }
7680
7922
  }
7681
- }).catch(function (e) {
7682
- console.error("Store.set(\"".concat(key, "\", \"").concat(value, "\") failed:"), e);
7923
+ return "".concat(rootProtocol, "//").concat(ip, ":").concat(port, "/");
7683
7924
  });
7684
7925
  };
7685
- Store.prototype.get = function (key, broadcast) {
7926
+ Topology.prototype.fetchTargetClusters = function () {
7686
7927
  var _this = this;
7687
- if (broadcast === void 0) { broadcast = true; }
7688
- return this.connection.Fetch({
7689
- StoreName: this.Name,
7690
- UserSpecific: this.UserSpecific,
7691
- Namespace: this.Namespace,
7692
- Key: key
7693
- }).then(function (response) {
7694
- var oldValue = _this._knownValues[key];
7695
- _this._knownValues[key] = response.Value;
7696
- if (broadcast) {
7697
- _this._dispatch.post(new ValueChangedMessage(key, response.Value, oldValue));
7698
- }
7699
- return response.Value;
7700
- }).catch(function (e) {
7701
- console.error("Store.get(".concat(key, ") failed:"), e);
7702
- return undefined;
7928
+ return this.connection.TpTargetClusterQuery({ Type: "ROOT" }).then(function (response) {
7929
+ var _a, _b;
7930
+ _this.set({
7931
+ TargetClusters: (_b = (_a = response.TpTargetClusters) === null || _a === void 0 ? void 0 : _a.TpTargetCluster) !== null && _b !== void 0 ? _b : []
7932
+ });
7933
+ return _this.CTargetClusters;
7703
7934
  });
7704
7935
  };
7705
- Store.prototype.getAll = function (broadcast) {
7936
+ Topology.prototype.fetchLogicalClusters = function (request) {
7706
7937
  var _this = this;
7707
- if (broadcast === void 0) { broadcast = true; }
7708
- return this.connection.FetchAll({
7709
- StoreName: this.Name,
7710
- UserSpecific: this.UserSpecific,
7711
- Namespace: this.Namespace
7712
- }).then(function (response) {
7713
- var retVal = {};
7714
- var deletedValues = _this._knownValues;
7715
- _this._knownValues = {};
7716
- response.Pairs.Pair.forEach(function (pair) {
7717
- var oldValue = _this._knownValues[pair.Key];
7718
- _this._knownValues[pair.Key] = pair.Value;
7719
- delete deletedValues[pair.Key];
7720
- retVal[pair.Key] = pair.Value;
7721
- if (broadcast) {
7722
- _this._dispatch.post(new ValueChangedMessage(pair.Key, pair.Value, oldValue));
7723
- }
7938
+ if (request === void 0) { request = {}; }
7939
+ return this.connection.TpLogicalClusterQuery(request).then(function (response) {
7940
+ _this.set({
7941
+ LogicalClusters: response.TpLogicalClusters.TpLogicalCluster
7724
7942
  });
7725
- if (broadcast) {
7726
- for (var key in deletedValues) {
7727
- _this._dispatch.post(new ValueChangedMessage(key, undefined, deletedValues[key]));
7728
- }
7729
- }
7730
- return retVal;
7731
- }).catch(function (e) {
7732
- console.error("Store.getAll failed:", e);
7733
- return {};
7943
+ return _this.LogicalClusters;
7734
7944
  });
7735
7945
  };
7736
- Store.prototype.delete = function (key, broadcast) {
7946
+ Topology.prototype.fetchServices = function (request) {
7737
7947
  var _this = this;
7738
- if (broadcast === void 0) { broadcast = true; }
7739
- return this.connection.Delete({
7740
- StoreName: this.Name,
7741
- UserSpecific: this.UserSpecific,
7742
- Namespace: this.Namespace,
7743
- Key: key
7744
- }).then(function (response) {
7745
- var oldValue = _this._knownValues[key];
7746
- delete _this._knownValues[key];
7747
- if (broadcast) {
7748
- _this._dispatch.post(new ValueChangedMessage(key, undefined, oldValue));
7749
- }
7750
- }).catch(function (e) {
7751
- console.error("Store.delete(".concat(key, ") failed:"), e);
7948
+ if (request === void 0) { request = {}; }
7949
+ return this.connection.TpServiceQuery(request).then(function (response) {
7950
+ _this.set({
7951
+ Services: response.ServiceList
7952
+ });
7953
+ return _this.Services;
7752
7954
  });
7753
7955
  };
7754
- Store.prototype.monitor = function (callback) {
7755
- return this._dispatch.attach(callback);
7956
+ Topology.prototype.refresh = function (force) {
7957
+ var _this = this;
7958
+ if (force === void 0) { force = false; }
7959
+ if (!this._prevRefresh || force) {
7960
+ this._prevRefresh = Promise.all([this.fetchTargetClusters(), this.fetchLogicalClusters(), this.fetchServices()]).then(function () {
7961
+ return _this;
7962
+ });
7963
+ }
7964
+ return this._prevRefresh;
7756
7965
  };
7757
- return Store;
7758
- }());
7966
+ // Monitoring ---
7967
+ // Events ---
7968
+ Topology.prototype.on = function (eventID, propIDorCallback, callback) {
7969
+ if (this.isCallback(propIDorCallback)) {
7970
+ switch (eventID) {
7971
+ case "changed":
7972
+ _super.prototype.on.call(this, eventID, propIDorCallback);
7973
+ break;
7974
+ }
7975
+ }
7976
+ else {
7977
+ switch (eventID) {
7978
+ case "changed":
7979
+ _super.prototype.on.call(this, eventID, propIDorCallback, callback);
7980
+ break;
7981
+ }
7982
+ }
7983
+ this._monitor();
7984
+ return this;
7985
+ };
7986
+ return Topology;
7987
+ }(util.StateObject));
7759
7988
 
7760
- var TargetClusterCache = /** @class */ (function (_super) {
7761
- __extends(TargetClusterCache, _super);
7762
- function TargetClusterCache() {
7989
+ var logger$1 = util.scopedLogger("@hpcc-js/comms/ecl/query.ts");
7990
+ var QueryCache = /** @class */ (function (_super) {
7991
+ __extends(QueryCache, _super);
7992
+ function QueryCache() {
7763
7993
  return _super.call(this, function (obj) {
7764
- return "".concat(obj.BaseUrl, "-").concat(obj.Name);
7994
+ return util.Cache.hash([obj.QueryId, obj.QuerySet]);
7765
7995
  }) || this;
7766
7996
  }
7767
- return TargetClusterCache;
7997
+ return QueryCache;
7768
7998
  }(util.Cache));
7769
- var _targetCluster = new TargetClusterCache();
7770
- var TargetCluster = /** @class */ (function (_super) {
7771
- __extends(TargetCluster, _super);
7772
- function TargetCluster(optsConnection, name) {
7999
+ var _queries = new QueryCache();
8000
+ var Query = /** @class */ (function (_super) {
8001
+ __extends(Query, _super);
8002
+ function Query(optsConnection, querySet, queryID, queryDetails) {
7773
8003
  var _this = _super.call(this) || this;
7774
- if (optsConnection instanceof TopologyService) {
7775
- _this.connection = optsConnection;
7776
- _this.machineConnection = new MachineService(optsConnection.connectionOptions());
8004
+ if (optsConnection instanceof WorkunitsService) {
8005
+ _this.wsWorkunitsService = optsConnection;
7777
8006
  }
7778
8007
  else {
7779
- _this.connection = new TopologyService(optsConnection);
7780
- _this.machineConnection = new MachineService(optsConnection);
8008
+ _this.wsWorkunitsService = new WorkunitsService(optsConnection);
7781
8009
  }
7782
- _this.clear({
7783
- Name: name
7784
- });
8010
+ _this.topology = Topology.attach(_this.wsWorkunitsService.opts());
8011
+ _this.set(__assign({ QuerySet: querySet, QueryId: queryID }, queryDetails));
7785
8012
  return _this;
7786
8013
  }
7787
- Object.defineProperty(TargetCluster.prototype, "BaseUrl", {
7788
- get: function () { return this.connection.baseUrl; },
8014
+ Object.defineProperty(Query.prototype, "BaseUrl", {
8015
+ get: function () { return this.wsWorkunitsService.baseUrl; },
8016
+ enumerable: false,
8017
+ configurable: true
8018
+ });
8019
+ Object.defineProperty(Query.prototype, "properties", {
8020
+ get: function () { return this.get(); },
8021
+ enumerable: false,
8022
+ configurable: true
8023
+ });
8024
+ Object.defineProperty(Query.prototype, "Exceptions", {
8025
+ get: function () { return this.get("Exceptions"); },
8026
+ enumerable: false,
8027
+ configurable: true
8028
+ });
8029
+ Object.defineProperty(Query.prototype, "QueryId", {
8030
+ get: function () { return this.get("QueryId"); },
8031
+ enumerable: false,
8032
+ configurable: true
8033
+ });
8034
+ Object.defineProperty(Query.prototype, "QuerySet", {
8035
+ get: function () { return this.get("QuerySet"); },
8036
+ enumerable: false,
8037
+ configurable: true
8038
+ });
8039
+ Object.defineProperty(Query.prototype, "QueryName", {
8040
+ get: function () { return this.get("QueryName"); },
8041
+ enumerable: false,
8042
+ configurable: true
8043
+ });
8044
+ Object.defineProperty(Query.prototype, "Wuid", {
8045
+ get: function () { return this.get("Wuid"); },
8046
+ enumerable: false,
8047
+ configurable: true
8048
+ });
8049
+ Object.defineProperty(Query.prototype, "Dll", {
8050
+ get: function () { return this.get("Dll"); },
8051
+ enumerable: false,
8052
+ configurable: true
8053
+ });
8054
+ Object.defineProperty(Query.prototype, "Suspended", {
8055
+ get: function () { return this.get("Suspended"); },
8056
+ enumerable: false,
8057
+ configurable: true
8058
+ });
8059
+ Object.defineProperty(Query.prototype, "Activated", {
8060
+ get: function () { return this.get("Activated"); },
8061
+ enumerable: false,
8062
+ configurable: true
8063
+ });
8064
+ Object.defineProperty(Query.prototype, "SuspendedBy", {
8065
+ get: function () { return this.get("SuspendedBy"); },
8066
+ enumerable: false,
8067
+ configurable: true
8068
+ });
8069
+ Object.defineProperty(Query.prototype, "Clusters", {
8070
+ get: function () { return this.get("Clusters"); },
8071
+ enumerable: false,
8072
+ configurable: true
8073
+ });
8074
+ Object.defineProperty(Query.prototype, "PublishedBy", {
8075
+ get: function () { return this.get("PublishedBy"); },
8076
+ enumerable: false,
8077
+ configurable: true
8078
+ });
8079
+ Object.defineProperty(Query.prototype, "Comment", {
8080
+ get: function () { return this.get("Comment"); },
7789
8081
  enumerable: false,
7790
8082
  configurable: true
7791
8083
  });
7792
- Object.defineProperty(TargetCluster.prototype, "Name", {
7793
- get: function () { return this.get("Name"); },
8084
+ Object.defineProperty(Query.prototype, "LogicalFiles", {
8085
+ get: function () { return this.get("LogicalFiles"); },
7794
8086
  enumerable: false,
7795
8087
  configurable: true
7796
8088
  });
7797
- Object.defineProperty(TargetCluster.prototype, "Prefix", {
7798
- get: function () { return this.get("Prefix"); },
8089
+ Object.defineProperty(Query.prototype, "SuperFiles", {
8090
+ get: function () { return this.get("SuperFiles"); },
7799
8091
  enumerable: false,
7800
8092
  configurable: true
7801
8093
  });
7802
- Object.defineProperty(TargetCluster.prototype, "Type", {
7803
- get: function () { return this.get("Type"); },
8094
+ Object.defineProperty(Query.prototype, "IsLibrary", {
8095
+ get: function () { return this.get("IsLibrary"); },
7804
8096
  enumerable: false,
7805
8097
  configurable: true
7806
8098
  });
7807
- Object.defineProperty(TargetCluster.prototype, "IsDefault", {
7808
- get: function () { return this.get("IsDefault"); },
8099
+ Object.defineProperty(Query.prototype, "Priority", {
8100
+ get: function () { return this.get("Priority"); },
7809
8101
  enumerable: false,
7810
8102
  configurable: true
7811
8103
  });
7812
- Object.defineProperty(TargetCluster.prototype, "TpClusters", {
7813
- get: function () { return this.get("TpClusters"); },
8104
+ Object.defineProperty(Query.prototype, "WUSnapShot", {
8105
+ get: function () { return this.get("WUSnapShot"); },
7814
8106
  enumerable: false,
7815
8107
  configurable: true
7816
8108
  });
7817
- Object.defineProperty(TargetCluster.prototype, "TpEclCCServers", {
7818
- get: function () { return this.get("TpEclCCServers"); },
8109
+ Object.defineProperty(Query.prototype, "CompileTime", {
8110
+ get: function () { return this.get("CompileTime"); },
7819
8111
  enumerable: false,
7820
8112
  configurable: true
7821
8113
  });
7822
- Object.defineProperty(TargetCluster.prototype, "TpEclServers", {
7823
- get: function () { return this.get("TpEclServers"); },
8114
+ Object.defineProperty(Query.prototype, "LibrariesUsed", {
8115
+ get: function () { return this.get("LibrariesUsed"); },
7824
8116
  enumerable: false,
7825
8117
  configurable: true
7826
8118
  });
7827
- Object.defineProperty(TargetCluster.prototype, "TpEclAgents", {
7828
- get: function () { return this.get("TpEclAgents"); },
8119
+ Object.defineProperty(Query.prototype, "CountGraphs", {
8120
+ get: function () { return this.get("CountGraphs"); },
7829
8121
  enumerable: false,
7830
8122
  configurable: true
7831
8123
  });
7832
- Object.defineProperty(TargetCluster.prototype, "TpEclSchedulers", {
7833
- get: function () { return this.get("TpEclSchedulers"); },
8124
+ Object.defineProperty(Query.prototype, "ResourceURLCount", {
8125
+ get: function () { return this.get("ResourceURLCount"); },
7834
8126
  enumerable: false,
7835
8127
  configurable: true
7836
8128
  });
7837
- Object.defineProperty(TargetCluster.prototype, "MachineInfoEx", {
7838
- get: function () { return this.get("MachineInfoEx", []); },
8129
+ Object.defineProperty(Query.prototype, "WsEclAddresses", {
8130
+ get: function () { return this.get("WsEclAddresses"); },
7839
8131
  enumerable: false,
7840
8132
  configurable: true
7841
8133
  });
7842
- Object.defineProperty(TargetCluster.prototype, "CMachineInfoEx", {
7843
- get: function () {
7844
- var _this = this;
7845
- return this.MachineInfoEx.map(function (machineInfoEx) { return Machine.attach(_this.machineConnection, machineInfoEx.Address, machineInfoEx); });
7846
- },
8134
+ Object.defineProperty(Query.prototype, "WUGraphs", {
8135
+ get: function () { return this.get("WUGraphs"); },
7847
8136
  enumerable: false,
7848
8137
  configurable: true
7849
8138
  });
7850
- TargetCluster.attach = function (optsConnection, name, state) {
7851
- var retVal = _targetCluster.get({ BaseUrl: optsConnection.baseUrl, Name: name }, function () {
7852
- return new TargetCluster(optsConnection, name);
8139
+ Object.defineProperty(Query.prototype, "WUTimers", {
8140
+ get: function () { return this.get("WUTimers"); },
8141
+ enumerable: false,
8142
+ configurable: true
8143
+ });
8144
+ Query.attach = function (optsConnection, querySet, queryId) {
8145
+ var retVal = _queries.get({ BaseUrl: optsConnection.baseUrl, QuerySet: querySet, QueryId: queryId }, function () {
8146
+ return new Query(optsConnection, querySet, queryId);
7853
8147
  });
7854
- if (state) {
7855
- retVal.set(__assign({}, state));
7856
- }
7857
8148
  return retVal;
7858
8149
  };
7859
- TargetCluster.prototype.fetchMachines = function (request) {
7860
- var _this = this;
7861
- if (request === void 0) { request = {}; }
7862
- return this.machineConnection.GetTargetClusterInfo(__assign({ TargetClusters: {
7863
- Item: ["".concat(this.Type, ":").concat(this.Name)]
7864
- } }, request)).then(function (response) {
7865
- var retVal = [];
7866
- for (var _i = 0, _a = response.TargetClusterInfoList.TargetClusterInfo; _i < _a.length; _i++) {
7867
- var machineInfo = _a[_i];
7868
- for (var _b = 0, _c = machineInfo.Processes.MachineInfoEx; _b < _c.length; _b++) {
7869
- var machineInfoEx = _c[_b];
7870
- retVal.push(machineInfoEx);
8150
+ Query.prototype.wsEclService = function () {
8151
+ return __awaiter(this, void 0, void 0, function () {
8152
+ return __generator(this, function (_a) {
8153
+ if (!this._eclService) {
8154
+ this._eclService = this.topology.fetchServices({}).then(function (services) {
8155
+ var _a, _b, _c, _d;
8156
+ for (var _i = 0, _e = (_b = (_a = services === null || services === void 0 ? void 0 : services.TpEspServers) === null || _a === void 0 ? void 0 : _a.TpEspServer) !== null && _b !== void 0 ? _b : []; _i < _e.length; _i++) {
8157
+ var espServer = _e[_i];
8158
+ for (var _f = 0, _g = (_d = (_c = espServer === null || espServer === void 0 ? void 0 : espServer.TpBindings) === null || _c === void 0 ? void 0 : _c.TpBinding) !== null && _d !== void 0 ? _d : []; _f < _g.length; _f++) {
8159
+ var binding = _g[_f];
8160
+ if ((binding === null || binding === void 0 ? void 0 : binding.Service) === "ws_ecl") {
8161
+ var baseUrl = "".concat(binding.Protocol, "://").concat(globalThis.location.hostname, ":").concat(binding.Port);
8162
+ return new EclService({ baseUrl: baseUrl });
8163
+ }
8164
+ }
8165
+ }
8166
+ return undefined;
8167
+ });
7871
8168
  }
7872
- }
7873
- _this.set("MachineInfoEx", retVal);
7874
- return _this.CMachineInfoEx;
8169
+ return [2 /*return*/, this._eclService];
8170
+ });
7875
8171
  });
7876
8172
  };
7877
- TargetCluster.prototype.machineStats = function () {
7878
- var maxDisk = 0;
7879
- var totalFree = 0;
7880
- var total = 0;
7881
- for (var _i = 0, _a = this.CMachineInfoEx; _i < _a.length; _i++) {
7882
- var machine = _a[_i];
7883
- for (var _b = 0, _c = machine.Storage.StorageInfo; _b < _c.length; _b++) {
7884
- var storageInfo = _c[_b];
7885
- totalFree += storageInfo.Available;
7886
- total += storageInfo.Total;
7887
- var usage = 1 - storageInfo.Available / storageInfo.Total;
7888
- if (usage > maxDisk) {
7889
- maxDisk = usage;
8173
+ Query.prototype.fetchDetails = function () {
8174
+ return __awaiter(this, void 0, void 0, function () {
8175
+ var queryDetails;
8176
+ return __generator(this, function (_a) {
8177
+ switch (_a.label) {
8178
+ case 0: return [4 /*yield*/, this.wsWorkunitsService.WUQueryDetails({
8179
+ QuerySet: this.QuerySet,
8180
+ QueryId: this.QueryId,
8181
+ IncludeStateOnClusters: true,
8182
+ IncludeSuperFiles: true,
8183
+ IncludeWsEclAddresses: true,
8184
+ CheckAllNodes: false
8185
+ })];
8186
+ case 1:
8187
+ queryDetails = _a.sent();
8188
+ this.set(__assign({}, queryDetails));
8189
+ return [2 /*return*/];
7890
8190
  }
7891
- }
7892
- }
7893
- return {
7894
- maxDisk: maxDisk,
7895
- meanDisk: 1 - (total ? totalFree / total : 1)
7896
- };
8191
+ });
8192
+ });
7897
8193
  };
7898
- TargetCluster.prototype.fetchUsage = function () {
7899
- return this.machineConnection.GetTargetClusterUsageEx([this.Name]);
8194
+ Query.prototype.fetchRequestSchema = function () {
8195
+ var _a;
8196
+ return __awaiter(this, void 0, void 0, function () {
8197
+ var wsEclService, _b, e_1;
8198
+ return __generator(this, function (_c) {
8199
+ switch (_c.label) {
8200
+ case 0: return [4 /*yield*/, this.wsEclService()];
8201
+ case 1:
8202
+ wsEclService = _c.sent();
8203
+ _c.label = 2;
8204
+ case 2:
8205
+ _c.trys.push([2, 4, , 5]);
8206
+ _b = this;
8207
+ return [4 /*yield*/, (wsEclService === null || wsEclService === void 0 ? void 0 : wsEclService.requestJson(this.QuerySet, this.QueryId))];
8208
+ case 3:
8209
+ _b._requestSchema = (_a = _c.sent()) !== null && _a !== void 0 ? _a : [];
8210
+ return [3 /*break*/, 5];
8211
+ case 4:
8212
+ e_1 = _c.sent();
8213
+ // See: https://track.hpccsystems.com/browse/HPCC-29827
8214
+ logger$1.debug(e_1);
8215
+ this._requestSchema = [];
8216
+ return [3 /*break*/, 5];
8217
+ case 5: return [2 /*return*/];
8218
+ }
8219
+ });
8220
+ });
7900
8221
  };
7901
- return TargetCluster;
7902
- }(util.StateObject));
7903
- function targetClusters(optsConnection) {
7904
- var connection;
7905
- if (optsConnection instanceof TopologyService) {
7906
- connection = optsConnection;
7907
- }
7908
- else {
7909
- connection = new TopologyService(optsConnection);
7910
- }
7911
- return connection.TpListTargetClusters({}).then(function (response) {
7912
- return response.TargetClusters.TpClusterNameType.map(function (item) { return TargetCluster.attach(optsConnection, item.Name, item); });
7913
- });
7914
- }
7915
- var _defaultTargetCluster = {};
7916
- function defaultTargetCluster(optsConnection) {
7917
- if (!_defaultTargetCluster[optsConnection.baseUrl]) {
7918
- var connection = void 0;
7919
- if (optsConnection instanceof TopologyService) {
7920
- connection = optsConnection;
7921
- }
7922
- else {
7923
- connection = new TopologyService(optsConnection);
7924
- }
7925
- _defaultTargetCluster[optsConnection.baseUrl] = connection.TpListTargetClusters({}).then(function (response) {
7926
- var firstItem;
7927
- var defaultItem;
7928
- var hthorItem;
7929
- response.TargetClusters.TpClusterNameType.forEach(function (item) {
7930
- if (!firstItem) {
7931
- firstItem = item;
8222
+ Query.prototype.fetchResponseSchema = function () {
8223
+ var _a;
8224
+ return __awaiter(this, void 0, void 0, function () {
8225
+ var wsEclService, _b, e_2;
8226
+ return __generator(this, function (_c) {
8227
+ switch (_c.label) {
8228
+ case 0: return [4 /*yield*/, this.wsEclService()];
8229
+ case 1:
8230
+ wsEclService = _c.sent();
8231
+ _c.label = 2;
8232
+ case 2:
8233
+ _c.trys.push([2, 4, , 5]);
8234
+ _b = this;
8235
+ return [4 /*yield*/, (wsEclService === null || wsEclService === void 0 ? void 0 : wsEclService.responseJson(this.QuerySet, this.QueryId))];
8236
+ case 3:
8237
+ _b._responseSchema = (_a = _c.sent()) !== null && _a !== void 0 ? _a : {};
8238
+ return [3 /*break*/, 5];
8239
+ case 4:
8240
+ e_2 = _c.sent();
8241
+ // See: https://track.hpccsystems.com/browse/HPCC-29827
8242
+ logger$1.debug(e_2);
8243
+ this._responseSchema = {};
8244
+ return [3 /*break*/, 5];
8245
+ case 5: return [2 /*return*/];
7932
8246
  }
7933
- if (!defaultItem && item.IsDefault === true) {
7934
- defaultItem = item;
8247
+ });
8248
+ });
8249
+ };
8250
+ Query.prototype.fetchSchema = function () {
8251
+ return __awaiter(this, void 0, void 0, function () {
8252
+ return __generator(this, function (_a) {
8253
+ switch (_a.label) {
8254
+ case 0: return [4 /*yield*/, Promise.all([this.fetchRequestSchema(), this.fetchResponseSchema()])];
8255
+ case 1:
8256
+ _a.sent();
8257
+ return [2 /*return*/];
7935
8258
  }
7936
- if (!hthorItem && item.Type === "hthor") {
7937
- hthorItem = item;
8259
+ });
8260
+ });
8261
+ };
8262
+ Query.prototype.fetchSummaryStats = function () {
8263
+ return this.wsWorkunitsService.WUQueryGetSummaryStats({ Target: this.QuerySet, QueryId: this.QueryId });
8264
+ };
8265
+ Query.prototype.submit = function (request) {
8266
+ var _a;
8267
+ return __awaiter(this, void 0, void 0, function () {
8268
+ var wsEclService;
8269
+ return __generator(this, function (_b) {
8270
+ switch (_b.label) {
8271
+ case 0: return [4 /*yield*/, this.wsEclService()];
8272
+ case 1:
8273
+ wsEclService = _b.sent();
8274
+ try {
8275
+ return [2 /*return*/, (_a = wsEclService === null || wsEclService === void 0 ? void 0 : wsEclService.submit(this.QuerySet, this.QueryId, request).then(function (results) {
8276
+ for (var key in results) {
8277
+ results[key] = results[key].Row;
8278
+ }
8279
+ return results;
8280
+ })) !== null && _a !== void 0 ? _a : []];
8281
+ }
8282
+ catch (e) {
8283
+ // See: https://track.hpccsystems.com/browse/HPCC-29827
8284
+ logger$1.debug(e);
8285
+ return [2 /*return*/, []];
8286
+ }
8287
+ return [2 /*return*/];
7938
8288
  }
7939
8289
  });
7940
- var defItem = defaultItem || hthorItem || firstItem;
7941
- return TargetCluster.attach(optsConnection, defItem.Name, defItem);
7942
8290
  });
7943
- }
7944
- return _defaultTargetCluster[optsConnection.baseUrl];
7945
- }
8291
+ };
8292
+ Query.prototype.refresh = function () {
8293
+ return __awaiter(this, void 0, void 0, function () {
8294
+ return __generator(this, function (_a) {
8295
+ switch (_a.label) {
8296
+ case 0: return [4 /*yield*/, Promise.all([
8297
+ this.fetchDetails(),
8298
+ this.fetchSchema()
8299
+ ])];
8300
+ case 1:
8301
+ _a.sent();
8302
+ return [2 /*return*/, this];
8303
+ }
8304
+ });
8305
+ });
8306
+ };
8307
+ Query.prototype.requestFields = function () {
8308
+ if (!this._requestSchema)
8309
+ return [];
8310
+ return this._requestSchema;
8311
+ };
8312
+ Query.prototype.responseFields = function () {
8313
+ if (!this._responseSchema)
8314
+ return {};
8315
+ return this._responseSchema;
8316
+ };
8317
+ Query.prototype.resultNames = function () {
8318
+ var retVal = [];
8319
+ for (var key in this.responseFields()) {
8320
+ retVal.push(key);
8321
+ }
8322
+ return retVal;
8323
+ };
8324
+ Query.prototype.resultFields = function (resultName) {
8325
+ if (!this._responseSchema[resultName])
8326
+ return [];
8327
+ return this._responseSchema[resultName];
8328
+ };
8329
+ return Query;
8330
+ }(util.StateObject));
7946
8331
 
7947
- var TopologyCache = /** @class */ (function (_super) {
7948
- __extends(TopologyCache, _super);
7949
- function TopologyCache() {
8332
+ var StoreCache = /** @class */ (function (_super) {
8333
+ __extends(StoreCache, _super);
8334
+ function StoreCache() {
7950
8335
  return _super.call(this, function (obj) {
7951
- return obj.BaseUrl;
8336
+ return "".concat(obj.BaseUrl, "-").concat(obj.Name, ":").concat(obj.UserSpecific, "-").concat(obj.Namespace);
7952
8337
  }) || this;
7953
8338
  }
7954
- return TopologyCache;
8339
+ return StoreCache;
7955
8340
  }(util.Cache));
7956
- var _topology = new TopologyCache();
7957
- var Topology = /** @class */ (function (_super) {
7958
- __extends(Topology, _super);
7959
- function Topology(optsConnection) {
8341
+ var _store = new StoreCache();
8342
+ var ValueChangedMessage = /** @class */ (function (_super) {
8343
+ __extends(ValueChangedMessage, _super);
8344
+ function ValueChangedMessage(key, value, oldValue) {
7960
8345
  var _this = _super.call(this) || this;
7961
- if (optsConnection instanceof TopologyService) {
7962
- _this.connection = optsConnection;
7963
- }
7964
- else {
7965
- _this.connection = new TopologyService(optsConnection);
7966
- }
8346
+ _this.key = key;
8347
+ _this.value = value;
8348
+ _this.oldValue = oldValue;
7967
8349
  return _this;
7968
8350
  }
7969
- Object.defineProperty(Topology.prototype, "BaseUrl", {
7970
- get: function () { return this.connection.baseUrl; },
7971
- enumerable: false,
7972
- configurable: true
7973
- });
7974
- Object.defineProperty(Topology.prototype, "properties", {
7975
- // Accessors ---
7976
- get: function () { return this.get(); },
7977
- enumerable: false,
7978
- configurable: true
7979
- });
7980
- Object.defineProperty(Topology.prototype, "TargetClusters", {
7981
- get: function () { return this.get("TargetClusters"); },
7982
- enumerable: false,
7983
- configurable: true
7984
- });
7985
- Object.defineProperty(Topology.prototype, "CTargetClusters", {
7986
- get: function () {
7987
- var _this = this;
7988
- return this.TargetClusters.map(function (tc) { return TargetCluster.attach(_this.connection, tc.Name, tc); });
7989
- },
7990
- enumerable: false,
7991
- configurable: true
7992
- });
7993
- Object.defineProperty(Topology.prototype, "LogicalClusters", {
7994
- get: function () { return this.get("LogicalClusters"); },
8351
+ Object.defineProperty(ValueChangedMessage.prototype, "canConflate", {
8352
+ get: function () { return true; },
7995
8353
  enumerable: false,
7996
8354
  configurable: true
7997
8355
  });
7998
- Object.defineProperty(Topology.prototype, "Services", {
7999
- get: function () { return this.get("Services"); },
8356
+ ValueChangedMessage.prototype.conflate = function (other) {
8357
+ if (this.key === other.key) {
8358
+ this.value = other.value;
8359
+ return true;
8360
+ }
8361
+ return false;
8362
+ };
8363
+ ValueChangedMessage.prototype.void = function () {
8364
+ return this.value === this.oldValue;
8365
+ };
8366
+ return ValueChangedMessage;
8367
+ }(util.Message));
8368
+ var Store = /** @class */ (function () {
8369
+ function Store(optsConnection, Name, Namespace, UserSpecific) {
8370
+ this._dispatch = new util.Dispatch();
8371
+ this._knownValues = {};
8372
+ if (optsConnection instanceof StoreService) {
8373
+ this.connection = optsConnection;
8374
+ }
8375
+ else {
8376
+ this.connection = new StoreService(optsConnection);
8377
+ }
8378
+ this.Name = Name;
8379
+ this.UserSpecific = UserSpecific;
8380
+ this.Namespace = Namespace;
8381
+ }
8382
+ Object.defineProperty(Store.prototype, "BaseUrl", {
8383
+ get: function () { return this.connection.baseUrl; },
8000
8384
  enumerable: false,
8001
8385
  configurable: true
8002
8386
  });
8003
- Topology.attach = function (optsConnection) {
8004
- var retVal = _topology.get({ BaseUrl: optsConnection.baseUrl }, function () {
8005
- return new Topology(optsConnection);
8387
+ Store.attach = function (optsConnection, Name, Namespace, UserSpecific) {
8388
+ if (Name === void 0) { Name = "HPCCApps"; }
8389
+ if (UserSpecific === void 0) { UserSpecific = true; }
8390
+ var retVal = _store.get({ BaseUrl: optsConnection.baseUrl, Name: Name, UserSpecific: UserSpecific, Namespace: Namespace }, function () {
8391
+ return new Store(optsConnection, Name, Namespace, UserSpecific);
8006
8392
  });
8007
8393
  return retVal;
8008
8394
  };
8009
- Topology.prototype.GetESPServiceBaseURL = function (type) {
8395
+ Store.prototype.create = function () {
8396
+ this.connection.CreateStore({ Name: this.Name, UserSpecific: this.UserSpecific, Type: "", Description: "" });
8397
+ };
8398
+ Store.prototype.set = function (key, value, broadcast) {
8010
8399
  var _this = this;
8011
- if (type === void 0) { type = ""; }
8012
- return this.connection.TpServiceQuery({}).then(function (response) {
8013
- var rootProtocol = _this.connection.protocol();
8014
- var ip = _this.connection.ip();
8015
- var port = rootProtocol === "https:" ? "18002" : "8002";
8016
- if (util.exists("ServiceList.TpEspServers.TpEspServer", response)) {
8017
- for (var _i = 0, _a = response.ServiceList.TpEspServers.TpEspServer; _i < _a.length; _i++) {
8018
- var item = _a[_i];
8019
- if (util.exists("TpBindings.TpBinding", item)) {
8020
- for (var _b = 0, _c = item.TpBindings.TpBinding; _b < _c.length; _b++) {
8021
- var binding = _c[_b];
8022
- if (binding.Service === type && binding.Protocol + ":" === rootProtocol) {
8023
- port = binding.Port;
8024
- }
8025
- }
8026
- }
8027
- }
8400
+ if (broadcast === void 0) { broadcast = true; }
8401
+ return this.connection.Set({
8402
+ StoreName: this.Name,
8403
+ UserSpecific: this.UserSpecific,
8404
+ Namespace: this.Namespace,
8405
+ Key: key,
8406
+ Value: value
8407
+ }).then(function (response) {
8408
+ var oldValue = _this._knownValues[key];
8409
+ _this._knownValues[key] = value;
8410
+ if (broadcast) {
8411
+ _this._dispatch.post(new ValueChangedMessage(key, value, oldValue));
8028
8412
  }
8029
- return "".concat(rootProtocol, "//").concat(ip, ":").concat(port, "/");
8413
+ }).catch(function (e) {
8414
+ console.error("Store.set(\"".concat(key, "\", \"").concat(value, "\") failed:"), e);
8030
8415
  });
8031
8416
  };
8032
- Topology.prototype.fetchTargetClusters = function () {
8417
+ Store.prototype.get = function (key, broadcast) {
8033
8418
  var _this = this;
8034
- return this.connection.TpTargetClusterQuery({ Type: "ROOT" }).then(function (response) {
8035
- var _a, _b;
8036
- _this.set({
8037
- TargetClusters: (_b = (_a = response.TpTargetClusters) === null || _a === void 0 ? void 0 : _a.TpTargetCluster) !== null && _b !== void 0 ? _b : []
8038
- });
8039
- return _this.CTargetClusters;
8419
+ if (broadcast === void 0) { broadcast = true; }
8420
+ return this.connection.Fetch({
8421
+ StoreName: this.Name,
8422
+ UserSpecific: this.UserSpecific,
8423
+ Namespace: this.Namespace,
8424
+ Key: key
8425
+ }).then(function (response) {
8426
+ var oldValue = _this._knownValues[key];
8427
+ _this._knownValues[key] = response.Value;
8428
+ if (broadcast) {
8429
+ _this._dispatch.post(new ValueChangedMessage(key, response.Value, oldValue));
8430
+ }
8431
+ return response.Value;
8432
+ }).catch(function (e) {
8433
+ console.error("Store.get(".concat(key, ") failed:"), e);
8434
+ return undefined;
8040
8435
  });
8041
8436
  };
8042
- Topology.prototype.fetchLogicalClusters = function (request) {
8437
+ Store.prototype.getAll = function (broadcast) {
8043
8438
  var _this = this;
8044
- if (request === void 0) { request = {}; }
8045
- return this.connection.TpLogicalClusterQuery(request).then(function (response) {
8046
- _this.set({
8047
- LogicalClusters: response.TpLogicalClusters.TpLogicalCluster
8439
+ if (broadcast === void 0) { broadcast = true; }
8440
+ return this.connection.FetchAll({
8441
+ StoreName: this.Name,
8442
+ UserSpecific: this.UserSpecific,
8443
+ Namespace: this.Namespace
8444
+ }).then(function (response) {
8445
+ var retVal = {};
8446
+ var deletedValues = _this._knownValues;
8447
+ _this._knownValues = {};
8448
+ response.Pairs.Pair.forEach(function (pair) {
8449
+ var oldValue = _this._knownValues[pair.Key];
8450
+ _this._knownValues[pair.Key] = pair.Value;
8451
+ delete deletedValues[pair.Key];
8452
+ retVal[pair.Key] = pair.Value;
8453
+ if (broadcast) {
8454
+ _this._dispatch.post(new ValueChangedMessage(pair.Key, pair.Value, oldValue));
8455
+ }
8048
8456
  });
8049
- return _this.LogicalClusters;
8457
+ if (broadcast) {
8458
+ for (var key in deletedValues) {
8459
+ _this._dispatch.post(new ValueChangedMessage(key, undefined, deletedValues[key]));
8460
+ }
8461
+ }
8462
+ return retVal;
8463
+ }).catch(function (e) {
8464
+ console.error("Store.getAll failed:", e);
8465
+ return {};
8050
8466
  });
8051
8467
  };
8052
- Topology.prototype.fetchServices = function (request) {
8468
+ Store.prototype.delete = function (key, broadcast) {
8053
8469
  var _this = this;
8054
- if (request === void 0) { request = {}; }
8055
- return this.connection.TpServiceQuery(request).then(function (response) {
8056
- _this.set({
8057
- Services: response.ServiceList
8058
- });
8059
- return _this.Services;
8470
+ if (broadcast === void 0) { broadcast = true; }
8471
+ return this.connection.Delete({
8472
+ StoreName: this.Name,
8473
+ UserSpecific: this.UserSpecific,
8474
+ Namespace: this.Namespace,
8475
+ Key: key
8476
+ }).then(function (response) {
8477
+ var oldValue = _this._knownValues[key];
8478
+ delete _this._knownValues[key];
8479
+ if (broadcast) {
8480
+ _this._dispatch.post(new ValueChangedMessage(key, undefined, oldValue));
8481
+ }
8482
+ }).catch(function (e) {
8483
+ console.error("Store.delete(".concat(key, ") failed:"), e);
8060
8484
  });
8061
8485
  };
8062
- Topology.prototype.refresh = function (force) {
8063
- var _this = this;
8064
- if (force === void 0) { force = false; }
8065
- if (!this._prevRefresh || force) {
8066
- this._prevRefresh = Promise.all([this.fetchTargetClusters(), this.fetchLogicalClusters(), this.fetchServices()]).then(function () {
8067
- return _this;
8068
- });
8069
- }
8070
- return this._prevRefresh;
8071
- };
8072
- // Monitoring ---
8073
- // Events ---
8074
- Topology.prototype.on = function (eventID, propIDorCallback, callback) {
8075
- if (this.isCallback(propIDorCallback)) {
8076
- switch (eventID) {
8077
- case "changed":
8078
- _super.prototype.on.call(this, eventID, propIDorCallback);
8079
- break;
8080
- }
8081
- }
8082
- else {
8083
- switch (eventID) {
8084
- case "changed":
8085
- _super.prototype.on.call(this, eventID, propIDorCallback, callback);
8086
- break;
8087
- }
8088
- }
8089
- this._monitor();
8090
- return this;
8486
+ Store.prototype.monitor = function (callback) {
8487
+ return this._dispatch.attach(callback);
8091
8488
  };
8092
- return Topology;
8093
- }(util.StateObject));
8489
+ return Store;
8490
+ }());
8094
8491
 
8095
8492
  var logger = util.scopedLogger("@hpcc-js/comms/dfuWorkunit.ts");
8096
8493
  var States;
@@ -8417,6 +8814,16 @@
8417
8814
  enumerable: false,
8418
8815
  configurable: true
8419
8816
  });
8817
+ Object.defineProperty(DFUWorkunit.prototype, "KbPerSecAve", {
8818
+ get: function () { return this.get("KbPerSecAve"); },
8819
+ enumerable: false,
8820
+ configurable: true
8821
+ });
8822
+ Object.defineProperty(DFUWorkunit.prototype, "KbPerSec", {
8823
+ get: function () { return this.get("KbPerSec"); },
8824
+ enumerable: false,
8825
+ configurable: true
8826
+ });
8420
8827
  // Factories ---
8421
8828
  DFUWorkunit.create = function (optsConnection, dfuServerQueue) {
8422
8829
  var retVal = new DFUWorkunit(optsConnection);
@@ -8462,6 +8869,21 @@
8462
8869
  });
8463
8870
  });
8464
8871
  };
8872
+ DFUWorkunit.prototype.update = function (request) {
8873
+ var _a, _b, _c, _d;
8874
+ return this.connection.UpdateDFUWorkunitEx({
8875
+ wu: {
8876
+ JobName: (_b = (_a = request === null || request === void 0 ? void 0 : request.wu) === null || _a === void 0 ? void 0 : _a.JobName) !== null && _b !== void 0 ? _b : this.JobName,
8877
+ isProtected: (_d = (_c = request === null || request === void 0 ? void 0 : request.wu) === null || _c === void 0 ? void 0 : _c.isProtected) !== null && _d !== void 0 ? _d : this.isProtected,
8878
+ ID: this.ID,
8879
+ State: this.State
8880
+ },
8881
+ ClusterOrig: this.ClusterName,
8882
+ JobNameOrig: this.JobName,
8883
+ isProtectedOrig: this.isProtected,
8884
+ StateOrig: this.State
8885
+ });
8886
+ };
8465
8887
  DFUWorkunit.prototype.isComplete = function () {
8466
8888
  switch (this.State) {
8467
8889
  case States.Finished:
@@ -8488,6 +8910,12 @@
8488
8910
  DFUWorkunit.prototype.isRunning = function () {
8489
8911
  return !this.isComplete();
8490
8912
  };
8913
+ DFUWorkunit.prototype.abort = function () {
8914
+ return this.connection.AbortDFUWorkunit({ wuid: this.ID });
8915
+ };
8916
+ DFUWorkunit.prototype.delete = function () {
8917
+ return this.DFUWUAction(exports.FileSpray.DFUWUActions.Delete);
8918
+ };
8491
8919
  DFUWorkunit.prototype.refresh = function (full) {
8492
8920
  return __awaiter(this, void 0, void 0, function () {
8493
8921
  return __generator(this, function (_a) {
@@ -8500,6 +8928,9 @@
8500
8928
  });
8501
8929
  });
8502
8930
  };
8931
+ DFUWorkunit.prototype.fetchXML = function (callback) {
8932
+ return this.DFUWUFile();
8933
+ };
8503
8934
  // Monitoring ---
8504
8935
  DFUWorkunit.prototype._monitor = function () {
8505
8936
  if (this.isComplete()) {
@@ -8521,6 +8952,29 @@
8521
8952
  }
8522
8953
  return retVal;
8523
8954
  };
8955
+ DFUWorkunit.prototype.DFUWUFile = function (_request) {
8956
+ if (_request === void 0) { _request = {}; }
8957
+ return this.connection.DFUWUFile(__assign(__assign({}, _request), { Wuid: this.ID })).then(function (response) {
8958
+ //TODO: additional processing?
8959
+ return response;
8960
+ }).catch(function (e) {
8961
+ return {};
8962
+ });
8963
+ };
8964
+ DFUWorkunit.prototype.DFUWUAction = function (actionType) {
8965
+ var _this = this;
8966
+ return this.connection.DFUWorkunitsAction({
8967
+ wuids: { Item: [this.ID] },
8968
+ Type: actionType
8969
+ }).then(function (response) {
8970
+ if (actionType === exports.FileSpray.DFUWUActions.Delete)
8971
+ return response;
8972
+ return _this.refresh().then(function () {
8973
+ _this._monitor();
8974
+ return response;
8975
+ });
8976
+ });
8977
+ };
8524
8978
  // Events ---
8525
8979
  DFUWorkunit.prototype.on = function (eventID, propIDorCallback, callback) {
8526
8980
  var _this = this;