@hpcc-js/comms 2.83.0 → 2.83.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -611,8 +611,8 @@
611
611
  }
612
612
 
613
613
  var PKG_NAME = "@hpcc-js/comms";
614
- var PKG_VERSION = "2.83.0";
615
- var BUILD_VERSION = "2.104.22";
614
+ var PKG_VERSION = "2.83.2";
615
+ var BUILD_VERSION = "2.104.24";
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);
@@ -1221,202 +1221,202 @@
1221
1221
  return FileSprayService;
1222
1222
  }(FileSprayServiceBase));
1223
1223
 
1224
- var ViewMemberType;
1225
- (function (ViewMemberType) {
1226
- ViewMemberType["User"] = "User";
1227
- ViewMemberType["Group"] = "Group";
1228
- })(ViewMemberType || (ViewMemberType = {}));
1229
- var UserSortBy;
1230
- (function (UserSortBy) {
1231
- UserSortBy["Username"] = "Username";
1232
- UserSortBy["Fullname"] = "Fullname";
1233
- UserSortBy["Passwordexpiration"] = "Passwordexpiration";
1234
- UserSortBy["EmployeeID"] = "EmployeeID";
1235
- UserSortBy["EmployeeNumber"] = "EmployeeNumber";
1236
- })(UserSortBy || (UserSortBy = {}));
1237
- var GroupSortBy;
1238
- (function (GroupSortBy) {
1239
- GroupSortBy["Name"] = "Name";
1240
- GroupSortBy["ManagedBy"] = "ManagedBy";
1241
- })(GroupSortBy || (GroupSortBy = {}));
1242
- var AccountTypeReq;
1243
- (function (AccountTypeReq) {
1244
- AccountTypeReq["Any"] = "Any";
1245
- AccountTypeReq["User"] = "User";
1246
- AccountTypeReq["Group"] = "Group";
1247
- })(AccountTypeReq || (AccountTypeReq = {}));
1248
- var ResourcePermissionSortBy;
1249
- (function (ResourcePermissionSortBy) {
1250
- ResourcePermissionSortBy["Name"] = "Name";
1251
- ResourcePermissionSortBy["Type"] = "Type";
1252
- })(ResourcePermissionSortBy || (ResourcePermissionSortBy = {}));
1253
- var ResourceSortBy;
1254
- (function (ResourceSortBy) {
1255
- ResourceSortBy["Name"] = "Name";
1256
- })(ResourceSortBy || (ResourceSortBy = {}));
1224
+ exports.WsAccess = void 0;
1225
+ (function (WsAccess) {
1226
+ (function (ViewMemberType) {
1227
+ ViewMemberType["User"] = "User";
1228
+ ViewMemberType["Group"] = "Group";
1229
+ })(WsAccess.ViewMemberType || (WsAccess.ViewMemberType = {}));
1230
+ (function (UserSortBy) {
1231
+ UserSortBy["username"] = "username";
1232
+ UserSortBy["fullname"] = "fullname";
1233
+ UserSortBy["passwordexpiration"] = "passwordexpiration";
1234
+ UserSortBy["employeeID"] = "employeeID";
1235
+ UserSortBy["employeeNumber"] = "employeeNumber";
1236
+ })(WsAccess.UserSortBy || (WsAccess.UserSortBy = {}));
1237
+ (function (GroupSortBy) {
1238
+ GroupSortBy["Name"] = "Name";
1239
+ GroupSortBy["ManagedBy"] = "ManagedBy";
1240
+ })(WsAccess.GroupSortBy || (WsAccess.GroupSortBy = {}));
1241
+ (function (AccountTypeReq) {
1242
+ AccountTypeReq["Any"] = "Any";
1243
+ AccountTypeReq["User"] = "User";
1244
+ AccountTypeReq["Group"] = "Group";
1245
+ })(WsAccess.AccountTypeReq || (WsAccess.AccountTypeReq = {}));
1246
+ (function (ResourcePermissionSortBy) {
1247
+ ResourcePermissionSortBy["Name"] = "Name";
1248
+ ResourcePermissionSortBy["Type"] = "Type";
1249
+ })(WsAccess.ResourcePermissionSortBy || (WsAccess.ResourcePermissionSortBy = {}));
1250
+ (function (ResourceSortBy) {
1251
+ ResourceSortBy["Name"] = "Name";
1252
+ })(WsAccess.ResourceSortBy || (WsAccess.ResourceSortBy = {}));
1253
+ })(exports.WsAccess || (exports.WsAccess = {}));
1257
1254
  var AccessServiceBase = /** @class */ (function (_super) {
1258
1255
  __extends(AccessServiceBase, _super);
1259
1256
  function AccessServiceBase(optsConnection) {
1260
- return _super.call(this, optsConnection, "ws_access", "1.16") || this;
1257
+ return _super.call(this, optsConnection, "ws_access", "1.17") || this;
1261
1258
  }
1262
1259
  AccessServiceBase.prototype.AccountPermissions = function (request) {
1263
- return this._connection.send("AccountPermissions", request);
1260
+ return this._connection.send("AccountPermissions", request, "json", false, undefined, "AccountPermissionsResponse");
1261
+ };
1262
+ AccessServiceBase.prototype.AccountPermissionsV2 = function (request) {
1263
+ return this._connection.send("AccountPermissionsV2", request, "json", false, undefined, "AccountPermissionsV2Response");
1264
1264
  };
1265
1265
  AccessServiceBase.prototype.AddUser = function (request) {
1266
- return this._connection.send("AddUser", request);
1266
+ return this._connection.send("AddUser", request, "json", false, undefined, "AddUserResponse");
1267
1267
  };
1268
1268
  AccessServiceBase.prototype.AddView = function (request) {
1269
- return this._connection.send("AddView", request);
1269
+ return this._connection.send("AddView", request, "json", false, undefined, "AddViewResponse");
1270
1270
  };
1271
1271
  AccessServiceBase.prototype.AddViewColumn = function (request) {
1272
- return this._connection.send("AddViewColumn", request);
1272
+ return this._connection.send("AddViewColumn", request, "json", false, undefined, "AddViewColumnResponse");
1273
1273
  };
1274
1274
  AccessServiceBase.prototype.AddViewMember = function (request) {
1275
- return this._connection.send("AddViewMember", request);
1275
+ return this._connection.send("AddViewMember", request, "json", false, undefined, "AddViewMemberResponse");
1276
1276
  };
1277
1277
  AccessServiceBase.prototype.ClearPermissionsCache = function (request) {
1278
- return this._connection.send("ClearPermissionsCache", request);
1278
+ return this._connection.send("ClearPermissionsCache", request, "json", false, undefined, "ClearPermissionsCacheResponse");
1279
1279
  };
1280
1280
  AccessServiceBase.prototype.DeleteView = function (request) {
1281
- return this._connection.send("DeleteView", request);
1281
+ return this._connection.send("DeleteView", request, "json", false, undefined, "DeleteViewResponse");
1282
1282
  };
1283
1283
  AccessServiceBase.prototype.DeleteViewColumn = function (request) {
1284
- return this._connection.send("DeleteViewColumn", request);
1284
+ return this._connection.send("DeleteViewColumn", request, "json", false, undefined, "DeleteViewColumnResponse");
1285
1285
  };
1286
1286
  AccessServiceBase.prototype.DeleteViewMember = function (request) {
1287
- return this._connection.send("DeleteViewMember", request);
1287
+ return this._connection.send("DeleteViewMember", request, "json", false, undefined, "DeleteViewMemberResponse");
1288
1288
  };
1289
1289
  AccessServiceBase.prototype.DisableScopeScans = function (request) {
1290
- return this._connection.send("DisableScopeScans", request);
1290
+ return this._connection.send("DisableScopeScans", request, "json", false, undefined, "DisableScopeScansResponse");
1291
1291
  };
1292
1292
  AccessServiceBase.prototype.EnableScopeScans = function (request) {
1293
- return this._connection.send("EnableScopeScans", request);
1293
+ return this._connection.send("EnableScopeScans", request, "json", false, undefined, "EnableScopeScansResponse");
1294
1294
  };
1295
1295
  AccessServiceBase.prototype.FilePermission = function (request) {
1296
- return this._connection.send("FilePermission", request);
1296
+ return this._connection.send("FilePermission", request, "json", false, undefined, "FilePermissionResponse");
1297
1297
  };
1298
1298
  AccessServiceBase.prototype.GroupAction = function (request) {
1299
- return this._connection.send("GroupAction", request);
1299
+ return this._connection.send("GroupAction", request, "json", false, undefined, "GroupActionResponse");
1300
1300
  };
1301
1301
  AccessServiceBase.prototype.GroupAdd = function (request) {
1302
- return this._connection.send("GroupAdd", request);
1302
+ return this._connection.send("GroupAdd", request, "json", false, undefined, "GroupAddResponse");
1303
1303
  };
1304
1304
  AccessServiceBase.prototype.GroupEdit = function (request) {
1305
- return this._connection.send("GroupEdit", request);
1305
+ return this._connection.send("GroupEdit", request, "json", false, undefined, "GroupEditResponse");
1306
1306
  };
1307
1307
  AccessServiceBase.prototype.GroupMemberEdit = function (request) {
1308
- return this._connection.send("GroupMemberEdit", request);
1308
+ return this._connection.send("GroupMemberEdit", request, "json", false, undefined, "GroupMemberEditResponse");
1309
1309
  };
1310
1310
  AccessServiceBase.prototype.GroupMemberEditInput = function (request) {
1311
- return this._connection.send("GroupMemberEditInput", request);
1311
+ return this._connection.send("GroupMemberEditInput", request, "json", false, undefined, "GroupMemberEditInputResponse");
1312
1312
  };
1313
1313
  AccessServiceBase.prototype.GroupMemberQuery = function (request) {
1314
- return this._connection.send("GroupMemberQuery", request);
1314
+ return this._connection.send("GroupMemberQuery", request, "json", false, undefined, "GroupMemberQueryResponse");
1315
1315
  };
1316
1316
  AccessServiceBase.prototype.GroupQuery = function (request) {
1317
- return this._connection.send("GroupQuery", request);
1317
+ return this._connection.send("GroupQuery", request, "json", false, undefined, "GroupQueryResponse");
1318
1318
  };
1319
1319
  AccessServiceBase.prototype.Groups = function (request) {
1320
- return this._connection.send("Groups", request);
1320
+ return this._connection.send("Groups", request, "json", false, undefined, "GroupResponse");
1321
1321
  };
1322
1322
  AccessServiceBase.prototype.PermissionAction = function (request) {
1323
- return this._connection.send("PermissionAction", request);
1323
+ return this._connection.send("PermissionAction", request, "json", false, undefined, "PermissionActionResponse");
1324
1324
  };
1325
1325
  AccessServiceBase.prototype.PermissionAddInput = function (request) {
1326
- return this._connection.send("PermissionAddInput", request);
1326
+ return this._connection.send("PermissionAddInput", request, "json", false, undefined, "PermissionAddResponse");
1327
1327
  };
1328
1328
  AccessServiceBase.prototype.Permissions = function (request) {
1329
- return this._connection.send("Permissions", request);
1329
+ return this._connection.send("Permissions", request, "json", false, undefined, "BasednsResponse");
1330
1330
  };
1331
1331
  AccessServiceBase.prototype.PermissionsReset = function (request) {
1332
- return this._connection.send("PermissionsReset", request);
1332
+ return this._connection.send("PermissionsReset", request, "json", false, undefined, "PermissionsResetResponse");
1333
1333
  };
1334
1334
  AccessServiceBase.prototype.PermissionsResetInput = function (request) {
1335
- return this._connection.send("PermissionsResetInput", request);
1335
+ return this._connection.send("PermissionsResetInput", request, "json", false, undefined, "PermissionsResetInputResponse");
1336
1336
  };
1337
1337
  AccessServiceBase.prototype.Ping = function (request) {
1338
- return this._connection.send("Ping", request);
1338
+ return this._connection.send("Ping", request, "json", false, undefined, "ws_accessPingResponse");
1339
1339
  };
1340
1340
  AccessServiceBase.prototype.QueryScopeScansEnabled = function (request) {
1341
- return this._connection.send("QueryScopeScansEnabled", request);
1341
+ return this._connection.send("QueryScopeScansEnabled", request, "json", false, undefined, "QueryScopeScansEnabledResponse");
1342
1342
  };
1343
1343
  AccessServiceBase.prototype.QueryUserViewColumns = function (request) {
1344
- return this._connection.send("QueryUserViewColumns", request);
1344
+ return this._connection.send("QueryUserViewColumns", request, "json", false, undefined, "QueryUserViewColumnsResponse");
1345
1345
  };
1346
1346
  AccessServiceBase.prototype.QueryViewColumns = function (request) {
1347
- return this._connection.send("QueryViewColumns", request);
1347
+ return this._connection.send("QueryViewColumns", request, "json", false, undefined, "QueryViewColumnsResponse");
1348
1348
  };
1349
1349
  AccessServiceBase.prototype.QueryViewMembers = function (request) {
1350
- return this._connection.send("QueryViewMembers", request);
1350
+ return this._connection.send("QueryViewMembers", request, "json", false, undefined, "QueryViewMembersResponse");
1351
1351
  };
1352
1352
  AccessServiceBase.prototype.QueryViews = function (request) {
1353
- return this._connection.send("QueryViews", request);
1353
+ return this._connection.send("QueryViews", request, "json", false, undefined, "QueryViewsResponse");
1354
1354
  };
1355
1355
  AccessServiceBase.prototype.ResourceAdd = function (request) {
1356
- return this._connection.send("ResourceAdd", request);
1356
+ return this._connection.send("ResourceAdd", request, "json", false, undefined, "ResourceAddResponse");
1357
1357
  };
1358
1358
  AccessServiceBase.prototype.ResourceAddInput = function (request) {
1359
- return this._connection.send("ResourceAddInput", request);
1359
+ return this._connection.send("ResourceAddInput", request, "json", false, undefined, "ResourceAddInputResponse");
1360
1360
  };
1361
1361
  AccessServiceBase.prototype.ResourceDelete = function (request) {
1362
- return this._connection.send("ResourceDelete", request);
1362
+ return this._connection.send("ResourceDelete", request, "json", false, undefined, "ResourceDeleteResponse");
1363
1363
  };
1364
1364
  AccessServiceBase.prototype.ResourcePermissionQuery = function (request) {
1365
- return this._connection.send("ResourcePermissionQuery", request);
1365
+ return this._connection.send("ResourcePermissionQuery", request, "json", false, undefined, "ResourcePermissionQueryResponse");
1366
1366
  };
1367
1367
  AccessServiceBase.prototype.ResourcePermissions = function (request) {
1368
- return this._connection.send("ResourcePermissions", request);
1368
+ return this._connection.send("ResourcePermissions", request, "json", false, undefined, "ResourcePermissionsResponse");
1369
1369
  };
1370
1370
  AccessServiceBase.prototype.ResourceQuery = function (request) {
1371
- return this._connection.send("ResourceQuery", request);
1371
+ return this._connection.send("ResourceQuery", request, "json", false, undefined, "ResourceQueryResponse");
1372
1372
  };
1373
1373
  AccessServiceBase.prototype.Resources = function (request) {
1374
- return this._connection.send("Resources", request);
1374
+ return this._connection.send("Resources", request, "json", false, undefined, "ResourcesResponse");
1375
1375
  };
1376
1376
  AccessServiceBase.prototype.UserAccountExport = function (request) {
1377
- return this._connection.send("UserAccountExport", request);
1377
+ return this._connection.send("UserAccountExport", request, "json", false, undefined, "UserAccountExportResponse");
1378
1378
  };
1379
1379
  AccessServiceBase.prototype.UserAction = function (request) {
1380
- return this._connection.send("UserAction", request);
1380
+ return this._connection.send("UserAction", request, "json", false, undefined, "UserActionResponse");
1381
1381
  };
1382
1382
  AccessServiceBase.prototype.UserEdit = function (request) {
1383
- return this._connection.send("UserEdit", request);
1383
+ return this._connection.send("UserEdit", request, "json", false, undefined, "UserEditResponse");
1384
1384
  };
1385
1385
  AccessServiceBase.prototype.UserGroupEdit = function (request) {
1386
- return this._connection.send("UserGroupEdit", request);
1386
+ return this._connection.send("UserGroupEdit", request, "json", false, undefined, "UserGroupEditResponse");
1387
1387
  };
1388
1388
  AccessServiceBase.prototype.UserGroupEditInput = function (request) {
1389
- return this._connection.send("UserGroupEditInput", request);
1389
+ return this._connection.send("UserGroupEditInput", request, "json", false, undefined, "UserGroupEditInputResponse");
1390
1390
  };
1391
1391
  AccessServiceBase.prototype.UserInfoEdit = function (request) {
1392
- return this._connection.send("UserInfoEdit", request);
1392
+ return this._connection.send("UserInfoEdit", request, "json", false, undefined, "UserInfoEditResponse");
1393
1393
  };
1394
1394
  AccessServiceBase.prototype.UserInfoEditInput = function (request) {
1395
- return this._connection.send("UserInfoEditInput", request);
1395
+ return this._connection.send("UserInfoEditInput", request, "json", false, undefined, "UserInfoEditInputResponse");
1396
1396
  };
1397
1397
  AccessServiceBase.prototype.UserPosix = function (request) {
1398
- return this._connection.send("UserPosix", request);
1398
+ return this._connection.send("UserPosix", request, "json", false, undefined, "UserPosixResponse");
1399
1399
  };
1400
1400
  AccessServiceBase.prototype.UserPosixInput = function (request) {
1401
- return this._connection.send("UserPosixInput", request);
1401
+ return this._connection.send("UserPosixInput", request, "json", false, undefined, "UserPosixInputResponse");
1402
1402
  };
1403
1403
  AccessServiceBase.prototype.UserQuery = function (request) {
1404
- return this._connection.send("UserQuery", request);
1404
+ return this._connection.send("UserQuery", request, "json", false, undefined, "UserQueryResponse");
1405
1405
  };
1406
1406
  AccessServiceBase.prototype.UserResetPass = function (request) {
1407
- return this._connection.send("UserResetPass", request);
1407
+ return this._connection.send("UserResetPass", request, "json", false, undefined, "UserResetPassResponse");
1408
1408
  };
1409
1409
  AccessServiceBase.prototype.UserResetPassInput = function (request) {
1410
- return this._connection.send("UserResetPassInput", request);
1410
+ return this._connection.send("UserResetPassInput", request, "json", false, undefined, "UserResetPassInputResponse");
1411
1411
  };
1412
1412
  AccessServiceBase.prototype.UserSudoers = function (request) {
1413
- return this._connection.send("UserSudoers", request);
1413
+ return this._connection.send("UserSudoers", request, "json", false, undefined, "UserSudoersResponse");
1414
1414
  };
1415
1415
  AccessServiceBase.prototype.UserSudoersInput = function (request) {
1416
- return this._connection.send("UserSudoersInput", request);
1416
+ return this._connection.send("UserSudoersInput", request, "json", false, undefined, "UserSudoersInputResponse");
1417
1417
  };
1418
1418
  AccessServiceBase.prototype.Users = function (request) {
1419
- return this._connection.send("Users", request);
1419
+ return this._connection.send("Users", request, "json", false, undefined, "UserResponse");
1420
1420
  };
1421
1421
  return AccessServiceBase;
1422
1422
  }(Service));
@@ -1991,7 +1991,7 @@
1991
1991
  return LogaccessServiceBase;
1992
1992
  }(Service));
1993
1993
 
1994
- var logger$2 = util.scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
1994
+ var logger$3 = util.scopedLogger("@hpcc-js/comms/services/wsLogaccess.ts");
1995
1995
  var ElasticKnownColumns;
1996
1996
  (function (ElasticKnownColumns) {
1997
1997
  ElasticKnownColumns["audience"] = "hpcc.log.audience";
@@ -2193,7 +2193,7 @@
2193
2193
  lines = (_d = (_c = logLines.lines) === null || _c === void 0 ? void 0 : _c.map(elasticToLogLine)) !== null && _d !== void 0 ? _d : [];
2194
2194
  break;
2195
2195
  default:
2196
- logger$2.warning("Unknown RemoteLogManagerType: ".concat(logInfo.RemoteLogManagerType));
2196
+ logger$3.warning("Unknown RemoteLogManagerType: ".concat(logInfo.RemoteLogManagerType));
2197
2197
  lines = [];
2198
2198
  }
2199
2199
  return {
@@ -2202,7 +2202,7 @@
2202
2202
  };
2203
2203
  }
2204
2204
  catch (e) {
2205
- logger$2.error(e);
2205
+ logger$3.error(e);
2206
2206
  }
2207
2207
  return {
2208
2208
  lines: [],
@@ -5590,7 +5590,7 @@
5590
5590
  }
5591
5591
  return num;
5592
5592
  }
5593
- var logger$1 = util.scopedLogger("workunit.ts");
5593
+ var logger$2 = util.scopedLogger("workunit.ts");
5594
5594
  var WUStateID = exports.WUStateID;
5595
5595
  var WorkunitCache = /** @class */ (function (_super) {
5596
5596
  __extends(WorkunitCache, _super);
@@ -6706,7 +6706,7 @@
6706
6706
  return false;
6707
6707
  });
6708
6708
  if (!wuMissing) {
6709
- logger$1.warning("Unexpected exception: ");
6709
+ logger$2.warning("Unexpected exception: ");
6710
6710
  throw e;
6711
6711
  }
6712
6712
  return {};
@@ -6743,7 +6743,7 @@
6743
6743
  return false;
6744
6744
  });
6745
6745
  if (!wuMissing) {
6746
- logger$1.warning("Unexpected exception: ");
6746
+ logger$2.warning("Unexpected exception: ");
6747
6747
  throw e;
6748
6748
  }
6749
6749
  return {};
@@ -6832,7 +6832,7 @@
6832
6832
  }
6833
6833
  return new util.XMLNode(command);
6834
6834
  }).catch(function (_) {
6835
- logger$1.error(_);
6835
+ logger$2.error(_);
6836
6836
  return Promise.resolve(new util.XMLNode(command));
6837
6837
  });
6838
6838
  };
@@ -7651,156 +7651,490 @@
7651
7651
  return Machine;
7652
7652
  }(util.StateObject));
7653
7653
 
7654
- var QueryCache = /** @class */ (function (_super) {
7655
- __extends(QueryCache, _super);
7656
- function QueryCache() {
7654
+ var TargetClusterCache = /** @class */ (function (_super) {
7655
+ __extends(TargetClusterCache, _super);
7656
+ function TargetClusterCache() {
7657
7657
  return _super.call(this, function (obj) {
7658
- return util.Cache.hash([obj.QueryId, obj.QuerySet]);
7658
+ return "".concat(obj.BaseUrl, "-").concat(obj.Name);
7659
7659
  }) || this;
7660
7660
  }
7661
- return QueryCache;
7661
+ return TargetClusterCache;
7662
7662
  }(util.Cache));
7663
- var _queries = new QueryCache();
7664
- var Query = /** @class */ (function (_super) {
7665
- __extends(Query, _super);
7666
- 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) {
7667
7667
  var _this = _super.call(this) || this;
7668
- if (optsConnection instanceof EclService) {
7668
+ if (optsConnection instanceof TopologyService) {
7669
7669
  _this.connection = optsConnection;
7670
- // this._topology = new Topology(this.connection.opts());
7670
+ _this.machineConnection = new MachineService(optsConnection.connectionOptions());
7671
7671
  }
7672
7672
  else {
7673
- _this.connection = new EclService(optsConnection);
7674
- // this._topology = new Topology(optsConnection);
7673
+ _this.connection = new TopologyService(optsConnection);
7674
+ _this.machineConnection = new MachineService(optsConnection);
7675
7675
  }
7676
- _this._wsWorkunits = new WorkunitsService(optsConnection);
7677
- _this.set(__assign({ QuerySet: querySet, QueryId: queryID }, queryDetails));
7676
+ _this.clear({
7677
+ Name: name
7678
+ });
7678
7679
  return _this;
7679
7680
  }
7680
- Object.defineProperty(Query.prototype, "BaseUrl", {
7681
+ Object.defineProperty(TargetCluster.prototype, "BaseUrl", {
7681
7682
  get: function () { return this.connection.baseUrl; },
7682
7683
  enumerable: false,
7683
7684
  configurable: true
7684
7685
  });
7685
- Object.defineProperty(Query.prototype, "properties", {
7686
- get: function () { return this.get(); },
7687
- enumerable: false,
7688
- configurable: true
7689
- });
7690
- Object.defineProperty(Query.prototype, "Exceptions", {
7691
- get: function () { return this.get("Exceptions"); },
7692
- enumerable: false,
7693
- configurable: true
7694
- });
7695
- Object.defineProperty(Query.prototype, "QueryId", {
7696
- get: function () { return this.get("QueryId"); },
7697
- enumerable: false,
7698
- configurable: true
7699
- });
7700
- Object.defineProperty(Query.prototype, "QuerySet", {
7701
- get: function () { return this.get("QuerySet"); },
7702
- enumerable: false,
7703
- configurable: true
7704
- });
7705
- Object.defineProperty(Query.prototype, "QueryName", {
7706
- get: function () { return this.get("QueryName"); },
7707
- enumerable: false,
7708
- configurable: true
7709
- });
7710
- Object.defineProperty(Query.prototype, "Wuid", {
7711
- get: function () { return this.get("Wuid"); },
7686
+ Object.defineProperty(TargetCluster.prototype, "Name", {
7687
+ get: function () { return this.get("Name"); },
7712
7688
  enumerable: false,
7713
7689
  configurable: true
7714
7690
  });
7715
- Object.defineProperty(Query.prototype, "Dll", {
7716
- get: function () { return this.get("Dll"); },
7691
+ Object.defineProperty(TargetCluster.prototype, "Prefix", {
7692
+ get: function () { return this.get("Prefix"); },
7717
7693
  enumerable: false,
7718
7694
  configurable: true
7719
7695
  });
7720
- Object.defineProperty(Query.prototype, "Suspended", {
7721
- get: function () { return this.get("Suspended"); },
7696
+ Object.defineProperty(TargetCluster.prototype, "Type", {
7697
+ get: function () { return this.get("Type"); },
7722
7698
  enumerable: false,
7723
7699
  configurable: true
7724
7700
  });
7725
- Object.defineProperty(Query.prototype, "Activated", {
7726
- get: function () { return this.get("Activated"); },
7701
+ Object.defineProperty(TargetCluster.prototype, "IsDefault", {
7702
+ get: function () { return this.get("IsDefault"); },
7727
7703
  enumerable: false,
7728
7704
  configurable: true
7729
7705
  });
7730
- Object.defineProperty(Query.prototype, "SuspendedBy", {
7731
- get: function () { return this.get("SuspendedBy"); },
7706
+ Object.defineProperty(TargetCluster.prototype, "TpClusters", {
7707
+ get: function () { return this.get("TpClusters"); },
7732
7708
  enumerable: false,
7733
7709
  configurable: true
7734
7710
  });
7735
- Object.defineProperty(Query.prototype, "Clusters", {
7736
- get: function () { return this.get("Clusters"); },
7711
+ Object.defineProperty(TargetCluster.prototype, "TpEclCCServers", {
7712
+ get: function () { return this.get("TpEclCCServers"); },
7737
7713
  enumerable: false,
7738
7714
  configurable: true
7739
7715
  });
7740
- Object.defineProperty(Query.prototype, "PublishedBy", {
7741
- get: function () { return this.get("PublishedBy"); },
7716
+ Object.defineProperty(TargetCluster.prototype, "TpEclServers", {
7717
+ get: function () { return this.get("TpEclServers"); },
7742
7718
  enumerable: false,
7743
7719
  configurable: true
7744
7720
  });
7745
- Object.defineProperty(Query.prototype, "Comment", {
7746
- get: function () { return this.get("Comment"); },
7721
+ Object.defineProperty(TargetCluster.prototype, "TpEclAgents", {
7722
+ get: function () { return this.get("TpEclAgents"); },
7747
7723
  enumerable: false,
7748
7724
  configurable: true
7749
7725
  });
7750
- Object.defineProperty(Query.prototype, "LogicalFiles", {
7751
- get: function () { return this.get("LogicalFiles"); },
7726
+ Object.defineProperty(TargetCluster.prototype, "TpEclSchedulers", {
7727
+ get: function () { return this.get("TpEclSchedulers"); },
7752
7728
  enumerable: false,
7753
7729
  configurable: true
7754
7730
  });
7755
- Object.defineProperty(Query.prototype, "SuperFiles", {
7756
- get: function () { return this.get("SuperFiles"); },
7731
+ Object.defineProperty(TargetCluster.prototype, "MachineInfoEx", {
7732
+ get: function () { return this.get("MachineInfoEx", []); },
7757
7733
  enumerable: false,
7758
7734
  configurable: true
7759
7735
  });
7760
- Object.defineProperty(Query.prototype, "IsLibrary", {
7761
- get: function () { return this.get("IsLibrary"); },
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
+ },
7762
7741
  enumerable: false,
7763
7742
  configurable: true
7764
7743
  });
7765
- Object.defineProperty(Query.prototype, "Priority", {
7766
- get: function () { return this.get("Priority"); },
7767
- enumerable: false,
7768
- configurable: true
7744
+ TargetCluster.attach = function (optsConnection, name, state) {
7745
+ var retVal = _targetCluster.get({ BaseUrl: optsConnection.baseUrl, Name: name }, function () {
7746
+ return new TargetCluster(optsConnection, name);
7747
+ });
7748
+ if (state) {
7749
+ retVal.set(__assign({}, state));
7750
+ }
7751
+ return retVal;
7752
+ };
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);
7765
+ }
7766
+ }
7767
+ _this.set("MachineInfoEx", retVal);
7768
+ return _this.CMachineInfoEx;
7769
+ });
7770
+ };
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;
7784
+ }
7785
+ }
7786
+ }
7787
+ return {
7788
+ maxDisk: maxDisk,
7789
+ meanDisk: 1 - (total ? totalFree / total : 1)
7790
+ };
7791
+ };
7792
+ TargetCluster.prototype.fetchUsage = function () {
7793
+ return this.machineConnection.GetTargetClusterUsageEx([this.Name]);
7794
+ };
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); });
7769
7807
  });
7770
- Object.defineProperty(Query.prototype, "WUSnapShot", {
7771
- get: function () { return this.get("WUSnapShot"); },
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;
7826
+ }
7827
+ if (!defaultItem && item.IsDefault === true) {
7828
+ defaultItem = item;
7829
+ }
7830
+ if (!hthorItem && item.Type === "hthor") {
7831
+ hthorItem = item;
7832
+ }
7833
+ });
7834
+ var defItem = defaultItem || hthorItem || firstItem;
7835
+ return TargetCluster.attach(optsConnection, defItem.Name, defItem);
7836
+ });
7837
+ }
7838
+ return _defaultTargetCluster[optsConnection.baseUrl];
7839
+ }
7840
+
7841
+ var TopologyCache = /** @class */ (function (_super) {
7842
+ __extends(TopologyCache, _super);
7843
+ function TopologyCache() {
7844
+ return _super.call(this, function (obj) {
7845
+ return obj.BaseUrl;
7846
+ }) || this;
7847
+ }
7848
+ return TopologyCache;
7849
+ }(util.Cache));
7850
+ var _topology = new TopologyCache();
7851
+ var Topology = /** @class */ (function (_super) {
7852
+ __extends(Topology, _super);
7853
+ function Topology(optsConnection) {
7854
+ var _this = _super.call(this) || this;
7855
+ if (optsConnection instanceof TopologyService) {
7856
+ _this.connection = optsConnection;
7857
+ }
7858
+ else {
7859
+ _this.connection = new TopologyService(optsConnection);
7860
+ }
7861
+ return _this;
7862
+ }
7863
+ Object.defineProperty(Topology.prototype, "BaseUrl", {
7864
+ get: function () { return this.connection.baseUrl; },
7772
7865
  enumerable: false,
7773
7866
  configurable: true
7774
7867
  });
7775
- Object.defineProperty(Query.prototype, "CompileTime", {
7776
- get: function () { return this.get("CompileTime"); },
7868
+ Object.defineProperty(Topology.prototype, "properties", {
7869
+ // Accessors ---
7870
+ get: function () { return this.get(); },
7777
7871
  enumerable: false,
7778
7872
  configurable: true
7779
7873
  });
7780
- Object.defineProperty(Query.prototype, "LibrariesUsed", {
7781
- get: function () { return this.get("LibrariesUsed"); },
7874
+ Object.defineProperty(Topology.prototype, "TargetClusters", {
7875
+ get: function () { return this.get("TargetClusters"); },
7782
7876
  enumerable: false,
7783
7877
  configurable: true
7784
7878
  });
7785
- Object.defineProperty(Query.prototype, "CountGraphs", {
7786
- get: function () { return this.get("CountGraphs"); },
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
+ },
7787
7884
  enumerable: false,
7788
7885
  configurable: true
7789
7886
  });
7790
- Object.defineProperty(Query.prototype, "ResourceURLCount", {
7791
- get: function () { return this.get("ResourceURLCount"); },
7887
+ Object.defineProperty(Topology.prototype, "LogicalClusters", {
7888
+ get: function () { return this.get("LogicalClusters"); },
7792
7889
  enumerable: false,
7793
7890
  configurable: true
7794
7891
  });
7795
- Object.defineProperty(Query.prototype, "WsEclAddresses", {
7796
- get: function () { return this.get("WsEclAddresses"); },
7892
+ Object.defineProperty(Topology.prototype, "Services", {
7893
+ get: function () { return this.get("Services"); },
7797
7894
  enumerable: false,
7798
7895
  configurable: true
7799
7896
  });
7800
- Object.defineProperty(Query.prototype, "WUGraphs", {
7801
- get: function () { return this.get("WUGraphs"); },
7802
- enumerable: false,
7803
- configurable: true
7897
+ Topology.attach = function (optsConnection) {
7898
+ var retVal = _topology.get({ BaseUrl: optsConnection.baseUrl }, function () {
7899
+ return new Topology(optsConnection);
7900
+ });
7901
+ return retVal;
7902
+ };
7903
+ Topology.prototype.GetESPServiceBaseURL = function (type) {
7904
+ var _this = this;
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
+ }
7922
+ }
7923
+ return "".concat(rootProtocol, "//").concat(ip, ":").concat(port, "/");
7924
+ });
7925
+ };
7926
+ Topology.prototype.fetchTargetClusters = function () {
7927
+ var _this = this;
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;
7934
+ });
7935
+ };
7936
+ Topology.prototype.fetchLogicalClusters = function (request) {
7937
+ var _this = this;
7938
+ if (request === void 0) { request = {}; }
7939
+ return this.connection.TpLogicalClusterQuery(request).then(function (response) {
7940
+ _this.set({
7941
+ LogicalClusters: response.TpLogicalClusters.TpLogicalCluster
7942
+ });
7943
+ return _this.LogicalClusters;
7944
+ });
7945
+ };
7946
+ Topology.prototype.fetchServices = function (request) {
7947
+ var _this = this;
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;
7954
+ });
7955
+ };
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;
7965
+ };
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));
7988
+
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() {
7993
+ return _super.call(this, function (obj) {
7994
+ return util.Cache.hash([obj.QueryId, obj.QuerySet]);
7995
+ }) || this;
7996
+ }
7997
+ return QueryCache;
7998
+ }(util.Cache));
7999
+ var _queries = new QueryCache();
8000
+ var Query = /** @class */ (function (_super) {
8001
+ __extends(Query, _super);
8002
+ function Query(optsConnection, querySet, queryID, queryDetails) {
8003
+ var _this = _super.call(this) || this;
8004
+ if (optsConnection instanceof WorkunitsService) {
8005
+ _this.wsWorkunitsService = optsConnection;
8006
+ }
8007
+ else {
8008
+ _this.wsWorkunitsService = new WorkunitsService(optsConnection);
8009
+ }
8010
+ _this.topology = Topology.attach(_this.wsWorkunitsService.opts());
8011
+ _this.set(__assign({ QuerySet: querySet, QueryId: queryID }, queryDetails));
8012
+ return _this;
8013
+ }
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"); },
8081
+ enumerable: false,
8082
+ configurable: true
8083
+ });
8084
+ Object.defineProperty(Query.prototype, "LogicalFiles", {
8085
+ get: function () { return this.get("LogicalFiles"); },
8086
+ enumerable: false,
8087
+ configurable: true
8088
+ });
8089
+ Object.defineProperty(Query.prototype, "SuperFiles", {
8090
+ get: function () { return this.get("SuperFiles"); },
8091
+ enumerable: false,
8092
+ configurable: true
8093
+ });
8094
+ Object.defineProperty(Query.prototype, "IsLibrary", {
8095
+ get: function () { return this.get("IsLibrary"); },
8096
+ enumerable: false,
8097
+ configurable: true
8098
+ });
8099
+ Object.defineProperty(Query.prototype, "Priority", {
8100
+ get: function () { return this.get("Priority"); },
8101
+ enumerable: false,
8102
+ configurable: true
8103
+ });
8104
+ Object.defineProperty(Query.prototype, "WUSnapShot", {
8105
+ get: function () { return this.get("WUSnapShot"); },
8106
+ enumerable: false,
8107
+ configurable: true
8108
+ });
8109
+ Object.defineProperty(Query.prototype, "CompileTime", {
8110
+ get: function () { return this.get("CompileTime"); },
8111
+ enumerable: false,
8112
+ configurable: true
8113
+ });
8114
+ Object.defineProperty(Query.prototype, "LibrariesUsed", {
8115
+ get: function () { return this.get("LibrariesUsed"); },
8116
+ enumerable: false,
8117
+ configurable: true
8118
+ });
8119
+ Object.defineProperty(Query.prototype, "CountGraphs", {
8120
+ get: function () { return this.get("CountGraphs"); },
8121
+ enumerable: false,
8122
+ configurable: true
8123
+ });
8124
+ Object.defineProperty(Query.prototype, "ResourceURLCount", {
8125
+ get: function () { return this.get("ResourceURLCount"); },
8126
+ enumerable: false,
8127
+ configurable: true
8128
+ });
8129
+ Object.defineProperty(Query.prototype, "WsEclAddresses", {
8130
+ get: function () { return this.get("WsEclAddresses"); },
8131
+ enumerable: false,
8132
+ configurable: true
8133
+ });
8134
+ Object.defineProperty(Query.prototype, "WUGraphs", {
8135
+ get: function () { return this.get("WUGraphs"); },
8136
+ enumerable: false,
8137
+ configurable: true
7804
8138
  });
7805
8139
  Object.defineProperty(Query.prototype, "WUTimers", {
7806
8140
  get: function () { return this.get("WUTimers"); },
@@ -7813,17 +8147,40 @@
7813
8147
  });
7814
8148
  return retVal;
7815
8149
  };
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
+ });
8168
+ }
8169
+ return [2 /*return*/, this._eclService];
8170
+ });
8171
+ });
8172
+ };
7816
8173
  Query.prototype.fetchDetails = function () {
7817
8174
  return __awaiter(this, void 0, void 0, function () {
7818
8175
  var queryDetails;
7819
8176
  return __generator(this, function (_a) {
7820
8177
  switch (_a.label) {
7821
- case 0: return [4 /*yield*/, this._wsWorkunits.WUQueryDetails({
8178
+ case 0: return [4 /*yield*/, this.wsWorkunitsService.WUQueryDetails({
7822
8179
  QuerySet: this.QuerySet,
7823
8180
  QueryId: this.QueryId,
7824
- IncludeStateOnClusters: false,
7825
- IncludeSuperFiles: false,
7826
- IncludeWsEclAddresses: false,
8181
+ IncludeStateOnClusters: true,
8182
+ IncludeSuperFiles: true,
8183
+ IncludeWsEclAddresses: true,
7827
8184
  CheckAllNodes: false
7828
8185
  })];
7829
8186
  case 1:
@@ -7835,31 +8192,57 @@
7835
8192
  });
7836
8193
  };
7837
8194
  Query.prototype.fetchRequestSchema = function () {
8195
+ var _a;
7838
8196
  return __awaiter(this, void 0, void 0, function () {
7839
- var _a;
7840
- return __generator(this, function (_b) {
7841
- switch (_b.label) {
7842
- case 0:
7843
- _a = this;
7844
- return [4 /*yield*/, this.connection.requestJson(this.QuerySet, this.QueryId)];
8197
+ var wsEclService, _b, e_1;
8198
+ return __generator(this, function (_c) {
8199
+ switch (_c.label) {
8200
+ case 0: return [4 /*yield*/, this.wsEclService()];
7845
8201
  case 1:
7846
- _a._requestSchema = _b.sent();
7847
- return [2 /*return*/];
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*/];
7848
8218
  }
7849
8219
  });
7850
8220
  });
7851
8221
  };
7852
8222
  Query.prototype.fetchResponseSchema = function () {
8223
+ var _a;
7853
8224
  return __awaiter(this, void 0, void 0, function () {
7854
- var _a;
7855
- return __generator(this, function (_b) {
7856
- switch (_b.label) {
7857
- case 0:
7858
- _a = this;
7859
- return [4 /*yield*/, this.connection.responseJson(this.QuerySet, this.QueryId)];
8225
+ var wsEclService, _b, e_2;
8226
+ return __generator(this, function (_c) {
8227
+ switch (_c.label) {
8228
+ case 0: return [4 /*yield*/, this.wsEclService()];
7860
8229
  case 1:
7861
- _a._responseSchema = _b.sent();
7862
- return [2 /*return*/];
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*/];
7863
8246
  }
7864
8247
  });
7865
8248
  });
@@ -7877,14 +8260,33 @@
7877
8260
  });
7878
8261
  };
7879
8262
  Query.prototype.fetchSummaryStats = function () {
7880
- return this._wsWorkunits.WUQueryGetSummaryStats({ Target: this.QuerySet, QueryId: this.QueryId });
8263
+ return this.wsWorkunitsService.WUQueryGetSummaryStats({ Target: this.QuerySet, QueryId: this.QueryId });
7881
8264
  };
7882
8265
  Query.prototype.submit = function (request) {
7883
- return this.connection.submit(this.QuerySet, this.QueryId, request).then(function (results) {
7884
- for (var key in results) {
7885
- results[key] = results[key].Row;
7886
- }
7887
- return results;
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*/];
8288
+ }
8289
+ });
7888
8290
  });
7889
8291
  };
7890
8292
  Query.prototype.refresh = function () {
@@ -8087,341 +8489,6 @@
8087
8489
  return Store;
8088
8490
  }());
8089
8491
 
8090
- var TargetClusterCache = /** @class */ (function (_super) {
8091
- __extends(TargetClusterCache, _super);
8092
- function TargetClusterCache() {
8093
- return _super.call(this, function (obj) {
8094
- return "".concat(obj.BaseUrl, "-").concat(obj.Name);
8095
- }) || this;
8096
- }
8097
- return TargetClusterCache;
8098
- }(util.Cache));
8099
- var _targetCluster = new TargetClusterCache();
8100
- var TargetCluster = /** @class */ (function (_super) {
8101
- __extends(TargetCluster, _super);
8102
- function TargetCluster(optsConnection, name) {
8103
- var _this = _super.call(this) || this;
8104
- if (optsConnection instanceof TopologyService) {
8105
- _this.connection = optsConnection;
8106
- _this.machineConnection = new MachineService(optsConnection.connectionOptions());
8107
- }
8108
- else {
8109
- _this.connection = new TopologyService(optsConnection);
8110
- _this.machineConnection = new MachineService(optsConnection);
8111
- }
8112
- _this.clear({
8113
- Name: name
8114
- });
8115
- return _this;
8116
- }
8117
- Object.defineProperty(TargetCluster.prototype, "BaseUrl", {
8118
- get: function () { return this.connection.baseUrl; },
8119
- enumerable: false,
8120
- configurable: true
8121
- });
8122
- Object.defineProperty(TargetCluster.prototype, "Name", {
8123
- get: function () { return this.get("Name"); },
8124
- enumerable: false,
8125
- configurable: true
8126
- });
8127
- Object.defineProperty(TargetCluster.prototype, "Prefix", {
8128
- get: function () { return this.get("Prefix"); },
8129
- enumerable: false,
8130
- configurable: true
8131
- });
8132
- Object.defineProperty(TargetCluster.prototype, "Type", {
8133
- get: function () { return this.get("Type"); },
8134
- enumerable: false,
8135
- configurable: true
8136
- });
8137
- Object.defineProperty(TargetCluster.prototype, "IsDefault", {
8138
- get: function () { return this.get("IsDefault"); },
8139
- enumerable: false,
8140
- configurable: true
8141
- });
8142
- Object.defineProperty(TargetCluster.prototype, "TpClusters", {
8143
- get: function () { return this.get("TpClusters"); },
8144
- enumerable: false,
8145
- configurable: true
8146
- });
8147
- Object.defineProperty(TargetCluster.prototype, "TpEclCCServers", {
8148
- get: function () { return this.get("TpEclCCServers"); },
8149
- enumerable: false,
8150
- configurable: true
8151
- });
8152
- Object.defineProperty(TargetCluster.prototype, "TpEclServers", {
8153
- get: function () { return this.get("TpEclServers"); },
8154
- enumerable: false,
8155
- configurable: true
8156
- });
8157
- Object.defineProperty(TargetCluster.prototype, "TpEclAgents", {
8158
- get: function () { return this.get("TpEclAgents"); },
8159
- enumerable: false,
8160
- configurable: true
8161
- });
8162
- Object.defineProperty(TargetCluster.prototype, "TpEclSchedulers", {
8163
- get: function () { return this.get("TpEclSchedulers"); },
8164
- enumerable: false,
8165
- configurable: true
8166
- });
8167
- Object.defineProperty(TargetCluster.prototype, "MachineInfoEx", {
8168
- get: function () { return this.get("MachineInfoEx", []); },
8169
- enumerable: false,
8170
- configurable: true
8171
- });
8172
- Object.defineProperty(TargetCluster.prototype, "CMachineInfoEx", {
8173
- get: function () {
8174
- var _this = this;
8175
- return this.MachineInfoEx.map(function (machineInfoEx) { return Machine.attach(_this.machineConnection, machineInfoEx.Address, machineInfoEx); });
8176
- },
8177
- enumerable: false,
8178
- configurable: true
8179
- });
8180
- TargetCluster.attach = function (optsConnection, name, state) {
8181
- var retVal = _targetCluster.get({ BaseUrl: optsConnection.baseUrl, Name: name }, function () {
8182
- return new TargetCluster(optsConnection, name);
8183
- });
8184
- if (state) {
8185
- retVal.set(__assign({}, state));
8186
- }
8187
- return retVal;
8188
- };
8189
- TargetCluster.prototype.fetchMachines = function (request) {
8190
- var _this = this;
8191
- if (request === void 0) { request = {}; }
8192
- return this.machineConnection.GetTargetClusterInfo(__assign({ TargetClusters: {
8193
- Item: ["".concat(this.Type, ":").concat(this.Name)]
8194
- } }, request)).then(function (response) {
8195
- var retVal = [];
8196
- for (var _i = 0, _a = response.TargetClusterInfoList.TargetClusterInfo; _i < _a.length; _i++) {
8197
- var machineInfo = _a[_i];
8198
- for (var _b = 0, _c = machineInfo.Processes.MachineInfoEx; _b < _c.length; _b++) {
8199
- var machineInfoEx = _c[_b];
8200
- retVal.push(machineInfoEx);
8201
- }
8202
- }
8203
- _this.set("MachineInfoEx", retVal);
8204
- return _this.CMachineInfoEx;
8205
- });
8206
- };
8207
- TargetCluster.prototype.machineStats = function () {
8208
- var maxDisk = 0;
8209
- var totalFree = 0;
8210
- var total = 0;
8211
- for (var _i = 0, _a = this.CMachineInfoEx; _i < _a.length; _i++) {
8212
- var machine = _a[_i];
8213
- for (var _b = 0, _c = machine.Storage.StorageInfo; _b < _c.length; _b++) {
8214
- var storageInfo = _c[_b];
8215
- totalFree += storageInfo.Available;
8216
- total += storageInfo.Total;
8217
- var usage = 1 - storageInfo.Available / storageInfo.Total;
8218
- if (usage > maxDisk) {
8219
- maxDisk = usage;
8220
- }
8221
- }
8222
- }
8223
- return {
8224
- maxDisk: maxDisk,
8225
- meanDisk: 1 - (total ? totalFree / total : 1)
8226
- };
8227
- };
8228
- TargetCluster.prototype.fetchUsage = function () {
8229
- return this.machineConnection.GetTargetClusterUsageEx([this.Name]);
8230
- };
8231
- return TargetCluster;
8232
- }(util.StateObject));
8233
- function targetClusters(optsConnection) {
8234
- var connection;
8235
- if (optsConnection instanceof TopologyService) {
8236
- connection = optsConnection;
8237
- }
8238
- else {
8239
- connection = new TopologyService(optsConnection);
8240
- }
8241
- return connection.TpListTargetClusters({}).then(function (response) {
8242
- return response.TargetClusters.TpClusterNameType.map(function (item) { return TargetCluster.attach(optsConnection, item.Name, item); });
8243
- });
8244
- }
8245
- var _defaultTargetCluster = {};
8246
- function defaultTargetCluster(optsConnection) {
8247
- if (!_defaultTargetCluster[optsConnection.baseUrl]) {
8248
- var connection = void 0;
8249
- if (optsConnection instanceof TopologyService) {
8250
- connection = optsConnection;
8251
- }
8252
- else {
8253
- connection = new TopologyService(optsConnection);
8254
- }
8255
- _defaultTargetCluster[optsConnection.baseUrl] = connection.TpListTargetClusters({}).then(function (response) {
8256
- var firstItem;
8257
- var defaultItem;
8258
- var hthorItem;
8259
- response.TargetClusters.TpClusterNameType.forEach(function (item) {
8260
- if (!firstItem) {
8261
- firstItem = item;
8262
- }
8263
- if (!defaultItem && item.IsDefault === true) {
8264
- defaultItem = item;
8265
- }
8266
- if (!hthorItem && item.Type === "hthor") {
8267
- hthorItem = item;
8268
- }
8269
- });
8270
- var defItem = defaultItem || hthorItem || firstItem;
8271
- return TargetCluster.attach(optsConnection, defItem.Name, defItem);
8272
- });
8273
- }
8274
- return _defaultTargetCluster[optsConnection.baseUrl];
8275
- }
8276
-
8277
- var TopologyCache = /** @class */ (function (_super) {
8278
- __extends(TopologyCache, _super);
8279
- function TopologyCache() {
8280
- return _super.call(this, function (obj) {
8281
- return obj.BaseUrl;
8282
- }) || this;
8283
- }
8284
- return TopologyCache;
8285
- }(util.Cache));
8286
- var _topology = new TopologyCache();
8287
- var Topology = /** @class */ (function (_super) {
8288
- __extends(Topology, _super);
8289
- function Topology(optsConnection) {
8290
- var _this = _super.call(this) || this;
8291
- if (optsConnection instanceof TopologyService) {
8292
- _this.connection = optsConnection;
8293
- }
8294
- else {
8295
- _this.connection = new TopologyService(optsConnection);
8296
- }
8297
- return _this;
8298
- }
8299
- Object.defineProperty(Topology.prototype, "BaseUrl", {
8300
- get: function () { return this.connection.baseUrl; },
8301
- enumerable: false,
8302
- configurable: true
8303
- });
8304
- Object.defineProperty(Topology.prototype, "properties", {
8305
- // Accessors ---
8306
- get: function () { return this.get(); },
8307
- enumerable: false,
8308
- configurable: true
8309
- });
8310
- Object.defineProperty(Topology.prototype, "TargetClusters", {
8311
- get: function () { return this.get("TargetClusters"); },
8312
- enumerable: false,
8313
- configurable: true
8314
- });
8315
- Object.defineProperty(Topology.prototype, "CTargetClusters", {
8316
- get: function () {
8317
- var _this = this;
8318
- return this.TargetClusters.map(function (tc) { return TargetCluster.attach(_this.connection, tc.Name, tc); });
8319
- },
8320
- enumerable: false,
8321
- configurable: true
8322
- });
8323
- Object.defineProperty(Topology.prototype, "LogicalClusters", {
8324
- get: function () { return this.get("LogicalClusters"); },
8325
- enumerable: false,
8326
- configurable: true
8327
- });
8328
- Object.defineProperty(Topology.prototype, "Services", {
8329
- get: function () { return this.get("Services"); },
8330
- enumerable: false,
8331
- configurable: true
8332
- });
8333
- Topology.attach = function (optsConnection) {
8334
- var retVal = _topology.get({ BaseUrl: optsConnection.baseUrl }, function () {
8335
- return new Topology(optsConnection);
8336
- });
8337
- return retVal;
8338
- };
8339
- Topology.prototype.GetESPServiceBaseURL = function (type) {
8340
- var _this = this;
8341
- if (type === void 0) { type = ""; }
8342
- return this.connection.TpServiceQuery({}).then(function (response) {
8343
- var rootProtocol = _this.connection.protocol();
8344
- var ip = _this.connection.ip();
8345
- var port = rootProtocol === "https:" ? "18002" : "8002";
8346
- if (util.exists("ServiceList.TpEspServers.TpEspServer", response)) {
8347
- for (var _i = 0, _a = response.ServiceList.TpEspServers.TpEspServer; _i < _a.length; _i++) {
8348
- var item = _a[_i];
8349
- if (util.exists("TpBindings.TpBinding", item)) {
8350
- for (var _b = 0, _c = item.TpBindings.TpBinding; _b < _c.length; _b++) {
8351
- var binding = _c[_b];
8352
- if (binding.Service === type && binding.Protocol + ":" === rootProtocol) {
8353
- port = binding.Port;
8354
- }
8355
- }
8356
- }
8357
- }
8358
- }
8359
- return "".concat(rootProtocol, "//").concat(ip, ":").concat(port, "/");
8360
- });
8361
- };
8362
- Topology.prototype.fetchTargetClusters = function () {
8363
- var _this = this;
8364
- return this.connection.TpTargetClusterQuery({ Type: "ROOT" }).then(function (response) {
8365
- var _a, _b;
8366
- _this.set({
8367
- TargetClusters: (_b = (_a = response.TpTargetClusters) === null || _a === void 0 ? void 0 : _a.TpTargetCluster) !== null && _b !== void 0 ? _b : []
8368
- });
8369
- return _this.CTargetClusters;
8370
- });
8371
- };
8372
- Topology.prototype.fetchLogicalClusters = function (request) {
8373
- var _this = this;
8374
- if (request === void 0) { request = {}; }
8375
- return this.connection.TpLogicalClusterQuery(request).then(function (response) {
8376
- _this.set({
8377
- LogicalClusters: response.TpLogicalClusters.TpLogicalCluster
8378
- });
8379
- return _this.LogicalClusters;
8380
- });
8381
- };
8382
- Topology.prototype.fetchServices = function (request) {
8383
- var _this = this;
8384
- if (request === void 0) { request = {}; }
8385
- return this.connection.TpServiceQuery(request).then(function (response) {
8386
- _this.set({
8387
- Services: response.ServiceList
8388
- });
8389
- return _this.Services;
8390
- });
8391
- };
8392
- Topology.prototype.refresh = function (force) {
8393
- var _this = this;
8394
- if (force === void 0) { force = false; }
8395
- if (!this._prevRefresh || force) {
8396
- this._prevRefresh = Promise.all([this.fetchTargetClusters(), this.fetchLogicalClusters(), this.fetchServices()]).then(function () {
8397
- return _this;
8398
- });
8399
- }
8400
- return this._prevRefresh;
8401
- };
8402
- // Monitoring ---
8403
- // Events ---
8404
- Topology.prototype.on = function (eventID, propIDorCallback, callback) {
8405
- if (this.isCallback(propIDorCallback)) {
8406
- switch (eventID) {
8407
- case "changed":
8408
- _super.prototype.on.call(this, eventID, propIDorCallback);
8409
- break;
8410
- }
8411
- }
8412
- else {
8413
- switch (eventID) {
8414
- case "changed":
8415
- _super.prototype.on.call(this, eventID, propIDorCallback, callback);
8416
- break;
8417
- }
8418
- }
8419
- this._monitor();
8420
- return this;
8421
- };
8422
- return Topology;
8423
- }(util.StateObject));
8424
-
8425
8492
  var logger = util.scopedLogger("@hpcc-js/comms/dfuWorkunit.ts");
8426
8493
  var States;
8427
8494
  (function (States) {