@hpcc-js/comms 2.89.0 → 2.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -648,8 +648,8 @@
648
648
  }
649
649
 
650
650
  var PKG_NAME = "@hpcc-js/comms";
651
- var PKG_VERSION = "2.89.0";
652
- var BUILD_VERSION = "2.104.39";
651
+ var PKG_VERSION = "2.90.0";
652
+ var BUILD_VERSION = "2.104.40";
653
653
 
654
654
  /******************************************************************************
655
655
  Copyright (c) Microsoft Corporation.
@@ -5727,6 +5727,13 @@
5727
5727
  }
5728
5728
  return num;
5729
5729
  }
5730
+ function safeDelete(obj, key, prop) {
5731
+ if (obj[key] === undefined || obj[key][prop] === undefined)
5732
+ return;
5733
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
5734
+ return;
5735
+ delete obj[key][prop];
5736
+ }
5730
5737
  var DEFINITION_LIST = "DefinitionList";
5731
5738
  var definitionRegex = /([a-zA-Z]:)?(.*[\\\/])(.*)(\((\d+),(\d+)\))/;
5732
5739
  var PropertyType = ["Avg", "Min", "Max", "Delta", "StdDev"];
@@ -6617,115 +6624,117 @@
6617
6624
  if (request === void 0) { request = {}; }
6618
6625
  return this.WUDetails(request).then(function (response) { return response.Scopes.Scope; });
6619
6626
  };
6620
- Workunit.prototype.fetchDetailsNormalized = function (request) {
6621
- if (request === void 0) { request = {}; }
6622
- return Promise.all([this.fetchDetailsMeta(), this.fetchDetailsRaw(request)]).then(function (promises) {
6623
- var _a;
6624
- var meta = promises[0];
6625
- var scopes = promises[1];
6626
- var columns = {
6627
- id: {
6628
- Measure: "label"
6629
- },
6630
- name: {
6631
- Measure: "label"
6632
- },
6633
- type: {
6634
- Measure: "label"
6635
- }
6636
- };
6637
- var data = [];
6638
- var _loop_1 = function (scope) {
6639
- var props = {};
6640
- var formattedProps = {};
6641
- if (scope && scope.Id && scope.Properties && scope.Properties.Property) {
6642
- for (var key in scope.Properties.Property) {
6643
- var scopeProperty = scope.Properties.Property[key];
6644
- if (scopeProperty.Measure === "ns") {
6645
- scopeProperty.Measure = "s";
6646
- }
6647
- columns[scopeProperty.Name] = __assign({}, scopeProperty);
6648
- delete columns[scopeProperty.Name].RawValue;
6649
- delete columns[scopeProperty.Name].Formatted;
6650
- switch (scopeProperty.Measure) {
6651
- case "bool":
6652
- props[scopeProperty.Name] = !!+scopeProperty.RawValue;
6653
- break;
6654
- case "sz":
6655
- props[scopeProperty.Name] = +scopeProperty.RawValue;
6656
- break;
6657
- case "s":
6658
- props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000000;
6659
- break;
6660
- case "ns":
6661
- props[scopeProperty.Name] = +scopeProperty.RawValue;
6662
- break;
6663
- case "ts":
6664
- props[scopeProperty.Name] = new Date(+scopeProperty.RawValue / 1000).toISOString();
6665
- break;
6666
- case "cnt":
6667
- props[scopeProperty.Name] = +scopeProperty.RawValue;
6668
- break;
6669
- case "cost":
6670
- props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000;
6671
- break;
6672
- case "cpu":
6673
- case "skw":
6674
- case "node":
6675
- case "ppm":
6676
- case "ip":
6677
- case "cy":
6678
- case "en":
6679
- case "txt":
6680
- case "id":
6681
- case "fname":
6682
- default:
6683
- props[scopeProperty.Name] = scopeProperty.RawValue;
6684
- }
6685
- formattedProps[scopeProperty.Name] = formatNum((_a = scopeProperty.Formatted) !== null && _a !== void 0 ? _a : props[scopeProperty.Name]);
6686
- }
6687
- // Other properties ---
6688
- }
6689
- var normalizedScope = __assign({ id: scope.Id, name: scope.ScopeName, type: scope.ScopeType, Kind: scope["Kind"], Label: scope["Label"], __formattedProps: formattedProps, __groupedProps: {} }, props);
6690
- if (normalizedScope[DEFINITION_LIST]) {
6691
- try {
6692
- var definitionList = JSON.parse(normalizedScope[DEFINITION_LIST].split("\\").join("\\\\"));
6693
- normalizedScope[DEFINITION_LIST] = [];
6694
- definitionList.forEach(function (definition, idx) {
6695
- var _a;
6696
- var matches = definition.match(definitionRegex);
6697
- if (matches) {
6698
- var filePath = ((_a = matches[1]) !== null && _a !== void 0 ? _a : "") + matches[2] + matches[3];
6699
- var line = parseInt(matches[5]);
6700
- var col = parseInt(matches[6]);
6701
- normalizedScope[DEFINITION_LIST].push({ filePath: filePath, line: line, col: col });
6702
- }
6703
- });
6627
+ Workunit.prototype.normalizeDetails = function (meta, scopes) {
6628
+ var _a;
6629
+ var columns = {
6630
+ id: {
6631
+ Measure: "label"
6632
+ },
6633
+ name: {
6634
+ Measure: "label"
6635
+ },
6636
+ type: {
6637
+ Measure: "label"
6638
+ }
6639
+ };
6640
+ var data = [];
6641
+ var _loop_1 = function (scope) {
6642
+ var props = {};
6643
+ var formattedProps = {};
6644
+ if (scope && scope.Id && scope.Properties && scope.Properties.Property) {
6645
+ for (var key in scope.Properties.Property) {
6646
+ var scopeProperty = scope.Properties.Property[key];
6647
+ if (scopeProperty.Measure === "ns") {
6648
+ scopeProperty.Measure = "s";
6704
6649
  }
6705
- catch (e) {
6706
- logger$2.error("Unexpected \"DefinitionList\": ".concat(normalizedScope[DEFINITION_LIST]));
6650
+ columns[scopeProperty.Name] = __assign({}, scopeProperty);
6651
+ safeDelete(columns, scopeProperty.Name, "RawValue");
6652
+ safeDelete(columns, scopeProperty.Name, "Formatted");
6653
+ switch (scopeProperty.Measure) {
6654
+ case "bool":
6655
+ props[scopeProperty.Name] = !!+scopeProperty.RawValue;
6656
+ break;
6657
+ case "sz":
6658
+ props[scopeProperty.Name] = +scopeProperty.RawValue;
6659
+ break;
6660
+ case "s":
6661
+ props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000000;
6662
+ break;
6663
+ case "ns":
6664
+ props[scopeProperty.Name] = +scopeProperty.RawValue;
6665
+ break;
6666
+ case "ts":
6667
+ props[scopeProperty.Name] = new Date(+scopeProperty.RawValue / 1000).toISOString();
6668
+ break;
6669
+ case "cnt":
6670
+ props[scopeProperty.Name] = +scopeProperty.RawValue;
6671
+ break;
6672
+ case "cost":
6673
+ props[scopeProperty.Name] = +scopeProperty.RawValue / 1000000;
6674
+ break;
6675
+ case "cpu":
6676
+ case "skw":
6677
+ case "node":
6678
+ case "ppm":
6679
+ case "ip":
6680
+ case "cy":
6681
+ case "en":
6682
+ case "txt":
6683
+ case "id":
6684
+ case "fname":
6685
+ default:
6686
+ props[scopeProperty.Name] = scopeProperty.RawValue;
6707
6687
  }
6688
+ formattedProps[scopeProperty.Name] = formatNum((_a = scopeProperty.Formatted) !== null && _a !== void 0 ? _a : props[scopeProperty.Name]);
6708
6689
  }
6709
- var dedup = {};
6710
- for (var key in normalizedScope) {
6711
- if (key.indexOf("__") !== 0) {
6712
- var row = formatValues(normalizedScope, key, dedup);
6713
- if (row) {
6714
- normalizedScope.__groupedProps[row.Key] = row;
6690
+ // Other properties ---
6691
+ }
6692
+ var normalizedScope = __assign({ id: scope.Id, name: scope.ScopeName, type: scope.ScopeType, Kind: scope["Kind"], Label: scope["Label"], __formattedProps: formattedProps, __groupedProps: {} }, props);
6693
+ if (normalizedScope[DEFINITION_LIST]) {
6694
+ try {
6695
+ var definitionList = JSON.parse(normalizedScope[DEFINITION_LIST].split("\\").join("\\\\"));
6696
+ normalizedScope[DEFINITION_LIST] = [];
6697
+ definitionList.forEach(function (definition, idx) {
6698
+ var _a;
6699
+ var matches = definition.match(definitionRegex);
6700
+ if (matches) {
6701
+ var filePath = ((_a = matches[1]) !== null && _a !== void 0 ? _a : "") + matches[2] + matches[3];
6702
+ var line = parseInt(matches[5]);
6703
+ var col = parseInt(matches[6]);
6704
+ normalizedScope[DEFINITION_LIST].push({ filePath: filePath, line: line, col: col });
6715
6705
  }
6706
+ });
6707
+ }
6708
+ catch (e) {
6709
+ logger$2.error("Unexpected \"DefinitionList\": ".concat(normalizedScope[DEFINITION_LIST]));
6710
+ }
6711
+ }
6712
+ var dedup = {};
6713
+ for (var key in normalizedScope) {
6714
+ if (key.indexOf("__") !== 0) {
6715
+ var row = formatValues(normalizedScope, key, dedup);
6716
+ if (row) {
6717
+ normalizedScope.__groupedProps[row.Key] = row;
6716
6718
  }
6717
6719
  }
6718
- data.push(normalizedScope);
6719
- };
6720
- for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) {
6721
- var scope = scopes_1[_i];
6722
- _loop_1(scope);
6723
6720
  }
6724
- return {
6725
- meta: meta,
6726
- columns: columns,
6727
- data: data
6728
- };
6721
+ data.push(normalizedScope);
6722
+ };
6723
+ for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) {
6724
+ var scope = scopes_1[_i];
6725
+ _loop_1(scope);
6726
+ }
6727
+ return {
6728
+ meta: meta,
6729
+ columns: columns,
6730
+ data: data
6731
+ };
6732
+ };
6733
+ Workunit.prototype.fetchDetailsNormalized = function (request) {
6734
+ var _this = this;
6735
+ if (request === void 0) { request = {}; }
6736
+ return Promise.all([this.fetchDetailsMeta(), this.fetchDetailsRaw(request)]).then(function (promises) {
6737
+ return _this.normalizeDetails(promises[0], promises[1]);
6729
6738
  });
6730
6739
  };
6731
6740
  Workunit.prototype.fetchInfo = function (request) {
@@ -8237,7 +8246,750 @@
8237
8246
  return Topology;
8238
8247
  }(util.StateObject));
8239
8248
 
8249
+ // Ported from: https://github.com/hpcc-systems/HPCC-Platform/blob/f0ed9dbeca49c39fb55aa28fec295c89407ac663/esp/src/src/ESPGraph.ts
8250
+ function safeAssign(obj, key, value) {
8251
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
8252
+ return;
8253
+ obj[key] = value;
8254
+ }
8255
+ function xmlEncode(str) {
8256
+ str = "" + str;
8257
+ return str.replace(/&/g, "&amp;")
8258
+ .replace(/"/g, "&quot;")
8259
+ .replace(/'/g, "&apos;")
8260
+ .replace(/</g, "&lt;")
8261
+ .replace(/>/g, "&gt;")
8262
+ .replace(/\n/g, "&#10;")
8263
+ .replace(/\r/g, "&#13;");
8264
+ }
8265
+ function espTime2Seconds(duration) {
8266
+ if (!duration) {
8267
+ return 0;
8268
+ }
8269
+ else if (!isNaN(+duration)) {
8270
+ return parseFloat(duration);
8271
+ }
8272
+ var re = /(?:(?:(\d+).days.)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+\.\d+|\d+)s))|(?:(\d+\.\d+|\d+)ms|(\d+\.\d+|\d+)us|(\d+\.\d+|\d+)ns)/;
8273
+ var match = re.exec(duration);
8274
+ if (!match)
8275
+ return 0;
8276
+ var days = +match[1] || 0;
8277
+ var hours = +match[2] || 0;
8278
+ var mins = +match[3] || 0;
8279
+ var secs = +match[4] || 0;
8280
+ var ms = +match[5] || 0;
8281
+ var us = +match[6] || 0;
8282
+ var ns = +match[7] || 0;
8283
+ return (days * 24 * 60 * 60) + (hours * 60 * 60) + (mins * 60) + secs + ms / 1000 + us / 1000000 + ns / 1000000000;
8284
+ }
8285
+ function unitTest(size, unit) {
8286
+ var nsIndex = size.indexOf(unit);
8287
+ if (nsIndex !== -1) {
8288
+ return parseFloat(size.substring(0, nsIndex));
8289
+ }
8290
+ return -1;
8291
+ }
8292
+ function espSize2Bytes(size) {
8293
+ if (!size) {
8294
+ return 0;
8295
+ }
8296
+ else if (!isNaN(+size)) {
8297
+ return parseFloat(size);
8298
+ }
8299
+ var retVal = unitTest(size, "Kb");
8300
+ if (retVal >= 0) {
8301
+ return retVal * 1024;
8302
+ }
8303
+ retVal = unitTest(size, "Mb");
8304
+ if (retVal >= 0) {
8305
+ return retVal * Math.pow(1024, 2);
8306
+ }
8307
+ retVal = unitTest(size, "Gb");
8308
+ if (retVal >= 0) {
8309
+ return retVal * Math.pow(1024, 3);
8310
+ }
8311
+ retVal = unitTest(size, "Tb");
8312
+ if (retVal >= 0) {
8313
+ return retVal * Math.pow(1024, 4);
8314
+ }
8315
+ retVal = unitTest(size, "Pb");
8316
+ if (retVal >= 0) {
8317
+ return retVal * Math.pow(1024, 5);
8318
+ }
8319
+ retVal = unitTest(size, "Eb");
8320
+ if (retVal >= 0) {
8321
+ return retVal * Math.pow(1024, 6);
8322
+ }
8323
+ retVal = unitTest(size, "Zb");
8324
+ if (retVal >= 0) {
8325
+ return retVal * Math.pow(1024, 7);
8326
+ }
8327
+ retVal = unitTest(size, "b");
8328
+ if (retVal >= 0) {
8329
+ return retVal;
8330
+ }
8331
+ return 0;
8332
+ }
8333
+ function espSkew2Number(skew) {
8334
+ if (!skew) {
8335
+ return 0;
8336
+ }
8337
+ return parseFloat(skew);
8338
+ }
8339
+ var GRAPH_TYPE;
8340
+ (function (GRAPH_TYPE) {
8341
+ GRAPH_TYPE[GRAPH_TYPE["UNKNOWN"] = 0] = "UNKNOWN";
8342
+ GRAPH_TYPE[GRAPH_TYPE["GRAPH"] = 1] = "GRAPH";
8343
+ GRAPH_TYPE[GRAPH_TYPE["SUBGRAPH"] = 2] = "SUBGRAPH";
8344
+ GRAPH_TYPE[GRAPH_TYPE["VERTEX"] = 3] = "VERTEX";
8345
+ GRAPH_TYPE[GRAPH_TYPE["EDGE"] = 4] = "EDGE";
8346
+ GRAPH_TYPE[GRAPH_TYPE["LAST"] = 5] = "LAST";
8347
+ })(GRAPH_TYPE || (GRAPH_TYPE = {}));
8348
+ var GRAPH_TYPE_STRING;
8349
+ (function (GRAPH_TYPE_STRING) {
8350
+ GRAPH_TYPE_STRING["UNKNOWN"] = "Unknown";
8351
+ GRAPH_TYPE_STRING["GRAPH"] = "Graph";
8352
+ GRAPH_TYPE_STRING["SUBGRAPH"] = "Cluster";
8353
+ GRAPH_TYPE_STRING["VERTEX"] = "Vertex";
8354
+ GRAPH_TYPE_STRING["EDGE"] = "Edge";
8355
+ GRAPH_TYPE_STRING["LAST"] = "Last";
8356
+ })(GRAPH_TYPE_STRING || (GRAPH_TYPE_STRING = {}));
8357
+ var LocalisedXGMMLWriter = /** @class */ (function () {
8358
+ function LocalisedXGMMLWriter(graph) {
8359
+ this.graph = graph;
8360
+ this.m_xgmml = "";
8361
+ this.m_visibleSubgraphs = {};
8362
+ this.m_visibleVertices = {};
8363
+ this.m_semiVisibleVertices = {};
8364
+ this.m_visibleEdges = {};
8365
+ }
8366
+ LocalisedXGMMLWriter.prototype.calcVisibility = function (items, localisationDepth, localisationDistance, noSpills) {
8367
+ var _this = this;
8368
+ this.noSpills = noSpills;
8369
+ items.forEach(function (item) {
8370
+ if (_this.graph.isVertex(item)) {
8371
+ _this.calcInVertexVisibility(item, localisationDistance);
8372
+ _this.calcOutVertexVisibility(item, localisationDistance);
8373
+ }
8374
+ else if (_this.graph.isEdge(item)) {
8375
+ _this.calcInVertexVisibility(item.getSource(), localisationDistance - 1);
8376
+ _this.calcOutVertexVisibility(item.getTarget(), localisationDistance - 1);
8377
+ }
8378
+ else if (_this.graph.isSubgraph(item)) {
8379
+ _this.m_visibleSubgraphs[item.__hpcc_id] = item;
8380
+ _this.calcSubgraphVisibility(item, localisationDepth - 1);
8381
+ }
8382
+ });
8383
+ this.calcVisibility2();
8384
+ };
8385
+ LocalisedXGMMLWriter.prototype.calcInVertexVisibility = function (vertex, localisationDistance) {
8386
+ var _this = this;
8387
+ if (this.noSpills && vertex.isSpill()) {
8388
+ localisationDistance++;
8389
+ }
8390
+ this.m_visibleVertices[vertex.__hpcc_id] = vertex;
8391
+ if (localisationDistance > 0) {
8392
+ vertex.getInEdges().forEach(function (edge) {
8393
+ _this.calcInVertexVisibility(edge.getSource(), localisationDistance - 1);
8394
+ });
8395
+ }
8396
+ };
8397
+ LocalisedXGMMLWriter.prototype.calcOutVertexVisibility = function (vertex, localisationDistance) {
8398
+ var _this = this;
8399
+ if (this.noSpills && vertex.isSpill()) {
8400
+ localisationDistance++;
8401
+ }
8402
+ this.m_visibleVertices[vertex.__hpcc_id] = vertex;
8403
+ if (localisationDistance > 0) {
8404
+ vertex.getOutEdges().forEach(function (edge) {
8405
+ _this.calcOutVertexVisibility(edge.getTarget(), localisationDistance - 1);
8406
+ });
8407
+ }
8408
+ };
8409
+ LocalisedXGMMLWriter.prototype.calcSubgraphVisibility = function (subgraph, localisationDepth) {
8410
+ var _this = this;
8411
+ if (localisationDepth < 0) {
8412
+ return;
8413
+ }
8414
+ if (localisationDepth > 0) {
8415
+ subgraph.__hpcc_subgraphs.forEach(function (subgraph, idx) {
8416
+ _this.calcSubgraphVisibility(subgraph, localisationDepth - 1);
8417
+ });
8418
+ }
8419
+ subgraph.__hpcc_subgraphs.forEach(function (subgraph, idx) {
8420
+ _this.m_visibleSubgraphs[subgraph.__hpcc_id] = subgraph;
8421
+ });
8422
+ subgraph.__hpcc_vertices.forEach(function (vertex, idx) {
8423
+ _this.m_visibleVertices[vertex.__hpcc_id] = vertex;
8424
+ });
8425
+ // Calculate edges that pass through the subgraph ---
8426
+ var dedupEdges = {};
8427
+ this.graph.edges.forEach(function (edge, idx) {
8428
+ if (edge.getSource().__hpcc_parent !== edge.getTarget().__hpcc_parent && subgraph === _this.getCommonAncestor(edge)) {
8429
+ // Only include one unique edge between subgraphs ---
8430
+ if (!dedupEdges[edge.getSource().__hpcc_parent.__hpcc_id + "::" + edge.getTarget().__hpcc_parent.__hpcc_id]) {
8431
+ dedupEdges[edge.getSource().__hpcc_parent.__hpcc_id + "::" + edge.getTarget().__hpcc_parent.__hpcc_id] = true;
8432
+ _this.m_visibleEdges[edge.__hpcc_id] = edge;
8433
+ }
8434
+ }
8435
+ });
8436
+ };
8437
+ LocalisedXGMMLWriter.prototype.buildVertexString = function (vertex, isPoint) {
8438
+ var attrStr = "";
8439
+ var propsStr = "";
8440
+ var props = vertex.getProperties();
8441
+ for (var key in props) {
8442
+ if (isPoint && key.indexOf("_kind") >= 0) {
8443
+ propsStr += "<att name=\"_kind\" value=\"point\"/>";
8444
+ }
8445
+ else if (key === "id" || key === "label") {
8446
+ attrStr += " " + key + "=\"" + xmlEncode(props[key]) + "\"";
8447
+ }
8448
+ else {
8449
+ propsStr += "<att name=\"" + key + "\" value=\"" + xmlEncode(props[key]) + "\"/>";
8450
+ }
8451
+ }
8452
+ return "<node" + attrStr + ">" + propsStr + "</node>";
8453
+ };
8454
+ LocalisedXGMMLWriter.prototype.buildEdgeString = function (edge) {
8455
+ var attrStr = "";
8456
+ var propsStr = "";
8457
+ var props = edge.getProperties();
8458
+ for (var key in props) {
8459
+ if (key.toLowerCase() === "id" ||
8460
+ key.toLowerCase() === "label" ||
8461
+ key.toLowerCase() === "source" ||
8462
+ key.toLowerCase() === "target") {
8463
+ attrStr += " " + key + "=\"" + xmlEncode(props[key]) + "\"";
8464
+ }
8465
+ else {
8466
+ propsStr += "<att name=\"" + key + "\" value=\"" + xmlEncode(props[key]) + "\"/>";
8467
+ }
8468
+ }
8469
+ return "<edge" + attrStr + ">" + propsStr + "</edge>";
8470
+ };
8471
+ LocalisedXGMMLWriter.prototype.getAncestors = function (v, ancestors) {
8472
+ var parent = v.__hpcc_parent;
8473
+ while (parent) {
8474
+ ancestors.push(parent);
8475
+ parent = parent.__hpcc_parent;
8476
+ }
8477
+ };
8478
+ LocalisedXGMMLWriter.prototype.getCommonAncestorV = function (v1, v2) {
8479
+ var v1_ancestors = [];
8480
+ var v2_ancestors = [];
8481
+ this.getAncestors(v1, v1_ancestors);
8482
+ this.getAncestors(v2, v2_ancestors);
8483
+ var finger1 = v1_ancestors.length - 1;
8484
+ var finger2 = v2_ancestors.length - 1;
8485
+ var retVal = null;
8486
+ while (finger1 >= 0 && finger2 >= 0 && v1_ancestors[finger1] === v2_ancestors[finger2]) {
8487
+ retVal = v1_ancestors[finger1];
8488
+ --finger1;
8489
+ --finger2;
8490
+ }
8491
+ return retVal;
8492
+ };
8493
+ LocalisedXGMMLWriter.prototype.getCommonAncestor = function (e) {
8494
+ return this.getCommonAncestorV(e.getSource(), e.getTarget());
8495
+ };
8496
+ LocalisedXGMMLWriter.prototype.calcAncestorVisibility = function (vertex) {
8497
+ var _this = this;
8498
+ var ancestors = [];
8499
+ this.getAncestors(vertex, ancestors);
8500
+ ancestors.forEach(function (item, idx) {
8501
+ _this.m_visibleSubgraphs[item.__hpcc_id] = item;
8502
+ });
8503
+ };
8504
+ LocalisedXGMMLWriter.prototype.calcVisibility2 = function () {
8505
+ var _this = this;
8506
+ for (var key in this.m_visibleVertices) {
8507
+ var vertex = this.m_visibleVertices[key];
8508
+ vertex.getInEdges().forEach(function (edge, idx) {
8509
+ _this.m_visibleEdges[edge.__hpcc_id] = edge;
8510
+ });
8511
+ vertex.getOutEdges().forEach(function (edge, idx) {
8512
+ _this.m_visibleEdges[edge.__hpcc_id] = edge;
8513
+ });
8514
+ this.calcAncestorVisibility(vertex);
8515
+ }
8516
+ this.calcSemiVisibleVertices();
8517
+ };
8518
+ LocalisedXGMMLWriter.prototype.addSemiVisibleEdge = function (edge) {
8519
+ if (edge && !this.m_visibleEdges[edge.__hpcc_id]) {
8520
+ this.m_visibleEdges[edge.__hpcc_id] = edge;
8521
+ }
8522
+ };
8523
+ LocalisedXGMMLWriter.prototype.addSemiVisibleVertex = function (vertex) {
8524
+ if (!this.m_visibleVertices[vertex.__hpcc_id]) {
8525
+ this.m_semiVisibleVertices[vertex.__hpcc_id] = vertex;
8526
+ this.calcAncestorVisibility(vertex);
8527
+ }
8528
+ };
8529
+ LocalisedXGMMLWriter.prototype.calcSemiVisibleVertices = function () {
8530
+ for (var key in this.m_visibleEdges) {
8531
+ var edge = this.m_visibleEdges[key];
8532
+ var source = edge.getSource();
8533
+ this.addSemiVisibleVertex(source);
8534
+ while (this.noSpills && source.isSpill()) {
8535
+ var inEdges = source.getInEdges();
8536
+ if (inEdges.length) {
8537
+ this.addSemiVisibleEdge(inEdges[0]);
8538
+ source = inEdges[0].getSource();
8539
+ this.addSemiVisibleVertex(source);
8540
+ }
8541
+ else {
8542
+ break;
8543
+ }
8544
+ }
8545
+ var target = edge.getTarget();
8546
+ this.addSemiVisibleVertex(target);
8547
+ while (this.noSpills && target.isSpill()) {
8548
+ var outEdges = target.getOutEdges();
8549
+ if (outEdges.length) {
8550
+ this.addSemiVisibleEdge(outEdges[0]);
8551
+ target = outEdges[0].getTarget();
8552
+ this.addSemiVisibleVertex(target);
8553
+ }
8554
+ else {
8555
+ break;
8556
+ }
8557
+ }
8558
+ }
8559
+ };
8560
+ LocalisedXGMMLWriter.prototype.writeXgmml = function () {
8561
+ var _this = this;
8562
+ this.subgraphVisited(this.graph.subgraphs[0], true);
8563
+ this.graph.edges.forEach(function (edge, idx) {
8564
+ _this.edgeVisited(edge);
8565
+ });
8566
+ };
8567
+ LocalisedXGMMLWriter.prototype.subgraphVisited = function (subgraph, root) {
8568
+ if (root === void 0) { root = false; }
8569
+ if (this.m_visibleSubgraphs[subgraph.__hpcc_id]) {
8570
+ var propsStr = "";
8571
+ this.m_xgmml += root ? "" : "<node id=\"" + subgraph.__hpcc_id + "\"><att><graph>";
8572
+ var xgmmlLen = this.m_xgmml.length;
8573
+ subgraph.walkSubgraphs(this);
8574
+ subgraph.walkVertices(this);
8575
+ if (xgmmlLen === this.m_xgmml.length) {
8576
+ // Add at least one child otherwise subgraphs will render as a vertex ---
8577
+ var vertex = subgraph.__hpcc_vertices[0];
8578
+ if (vertex) {
8579
+ this.m_xgmml += this.buildVertexString(vertex, true);
8580
+ }
8581
+ }
8582
+ var props = subgraph.getProperties();
8583
+ for (var key in props) {
8584
+ propsStr += "<att name=\"" + key + "\" value=\"" + xmlEncode(props[key]) + "\"/>";
8585
+ }
8586
+ this.m_xgmml += root ? "" : "</graph></att>" + propsStr + "</node>";
8587
+ }
8588
+ return false;
8589
+ };
8590
+ LocalisedXGMMLWriter.prototype.vertexVisited = function (vertex) {
8591
+ if (this.m_visibleVertices[vertex.__hpcc_id]) {
8592
+ this.m_xgmml += this.buildVertexString(vertex, false);
8593
+ }
8594
+ else if (this.m_semiVisibleVertices[vertex.__hpcc_id]) {
8595
+ this.m_xgmml += this.buildVertexString(vertex, true);
8596
+ }
8597
+ };
8598
+ LocalisedXGMMLWriter.prototype.edgeVisited = function (edge) {
8599
+ if (this.m_visibleEdges[edge.__hpcc_id]) {
8600
+ this.m_xgmml += this.buildEdgeString(edge);
8601
+ }
8602
+ };
8603
+ return LocalisedXGMMLWriter;
8604
+ }());
8605
+ var GraphItem = /** @class */ (function () {
8606
+ function GraphItem(graph, id) {
8607
+ this.__hpcc_graph = graph;
8608
+ this.__hpcc_id = id;
8609
+ this._globalID = id;
8610
+ }
8611
+ GraphItem.prototype.getProperties = function () {
8612
+ var retVal = {};
8613
+ for (var key in this) {
8614
+ if (key.indexOf("__") !== 0 && this.hasOwnProperty(key)) {
8615
+ retVal[key] = this[key];
8616
+ }
8617
+ }
8618
+ return retVal;
8619
+ };
8620
+ return GraphItem;
8621
+ }());
8622
+ var Subgraph = /** @class */ (function (_super) {
8623
+ __extends(Subgraph, _super);
8624
+ function Subgraph(graph, id) {
8625
+ var _this = _super.call(this, graph, id) || this;
8626
+ _this._globalType = id === "0" ? "Graph" : "Cluster";
8627
+ _this.__hpcc_subgraphs = [];
8628
+ _this.__hpcc_vertices = [];
8629
+ _this.__hpcc_edges = [];
8630
+ _this.id = id;
8631
+ return _this;
8632
+ }
8633
+ Subgraph.prototype.addSubgraph = function (subgraph) {
8634
+ subgraph.__hpcc_parent = this;
8635
+ if (!this.__hpcc_subgraphs.some(function (subgraph2) { return subgraph === subgraph2; })) {
8636
+ this.__hpcc_subgraphs.push(subgraph);
8637
+ }
8638
+ };
8639
+ Subgraph.prototype.addVertex = function (vertex) {
8640
+ vertex.__hpcc_parent = this;
8641
+ if (!this.__hpcc_vertices.some(function (vertex2) { return vertex === vertex2; })) {
8642
+ this.__hpcc_vertices.push(vertex);
8643
+ }
8644
+ };
8645
+ Subgraph.prototype.removeVertex = function (vertex) {
8646
+ this.__hpcc_vertices = this.__hpcc_vertices.filter(function (vertex2) { return vertex !== vertex2; });
8647
+ };
8648
+ Subgraph.prototype.addEdge = function (edge) {
8649
+ edge.__hpcc_parent = this;
8650
+ if (!this.__hpcc_edges.some(function (edge2) { return edge === edge2; })) {
8651
+ this.__hpcc_edges.push(edge);
8652
+ }
8653
+ };
8654
+ Subgraph.prototype.removeEdge = function (edge) {
8655
+ this.__hpcc_edges = this.__hpcc_edges.filter(function (edge2) { return edge !== edge2; });
8656
+ };
8657
+ Subgraph.prototype.remove = function () {
8658
+ var _this = this;
8659
+ this.__hpcc_subgraphs.forEach(function (subgraph) { return subgraph.__hpcc_parent = _this.__hpcc_parent; });
8660
+ this.__hpcc_vertices.forEach(function (vertex) { return vertex.__hpcc_parent = _this.__hpcc_parent; });
8661
+ this.__hpcc_edges.forEach(function (edge) { return edge.__hpcc_parent = _this.__hpcc_parent; });
8662
+ delete this.__hpcc_parent;
8663
+ this.__hpcc_graph.removeItem(this);
8664
+ };
8665
+ Subgraph.prototype.walkSubgraphs = function (visitor) {
8666
+ this.__hpcc_subgraphs.forEach(function (subgraph, idx) {
8667
+ if (visitor.subgraphVisited(subgraph)) {
8668
+ subgraph.walkSubgraphs(visitor);
8669
+ }
8670
+ });
8671
+ };
8672
+ Subgraph.prototype.walkVertices = function (visitor) {
8673
+ this.__hpcc_vertices.forEach(function (vertex, idx) {
8674
+ visitor.vertexVisited(vertex);
8675
+ });
8676
+ };
8677
+ return Subgraph;
8678
+ }(GraphItem));
8679
+ var Vertex = /** @class */ (function (_super) {
8680
+ __extends(Vertex, _super);
8681
+ function Vertex(graph, id) {
8682
+ var _this = _super.call(this, graph, id) || this;
8683
+ _this._globalType = "Vertex";
8684
+ return _this;
8685
+ }
8686
+ Vertex.prototype.isSpill = function () {
8687
+ return this._isSpill;
8688
+ };
8689
+ Vertex.prototype.remove = function () {
8690
+ var _a;
8691
+ var inVertices = this.getInVertices();
8692
+ if (inVertices.length <= 1) {
8693
+ console.warn(this.__hpcc_id + ": remove only supports single or zero inputs activities...");
8694
+ }
8695
+ this.getInEdges().forEach(function (edge) {
8696
+ edge.remove();
8697
+ });
8698
+ this.getOutEdges().forEach(function (edge) {
8699
+ edge.setSource(inVertices[0]);
8700
+ });
8701
+ (_a = this.__hpcc_parent) === null || _a === void 0 ? void 0 : _a.removeVertex(this);
8702
+ this.__hpcc_graph.removeItem(this);
8703
+ };
8704
+ Vertex.prototype.getInVertices = function () {
8705
+ return this.getInEdges().map(function (edge) {
8706
+ return edge.getSource();
8707
+ });
8708
+ };
8709
+ Vertex.prototype.getInEdges = function () {
8710
+ var _this = this;
8711
+ return this.__hpcc_graph.edges.filter(function (edge) {
8712
+ return edge.getTarget() === _this;
8713
+ });
8714
+ };
8715
+ Vertex.prototype.getOutVertices = function () {
8716
+ return this.getOutEdges().map(function (edge) {
8717
+ return edge.getTarget();
8718
+ });
8719
+ };
8720
+ Vertex.prototype.getOutEdges = function () {
8721
+ var _this = this;
8722
+ return this.__hpcc_graph.edges.filter(function (edge) {
8723
+ return edge.getSource() === _this;
8724
+ });
8725
+ };
8726
+ return Vertex;
8727
+ }(GraphItem));
8728
+ var Edge = /** @class */ (function (_super) {
8729
+ __extends(Edge, _super);
8730
+ function Edge(graph, id) {
8731
+ var _this = _super.call(this, graph, id) || this;
8732
+ _this._globalType = "Edge";
8733
+ _this._globalType = "Edge";
8734
+ return _this;
8735
+ }
8736
+ Edge.prototype.remove = function () {
8737
+ var _this = this;
8738
+ this.__hpcc_graph.subgraphs.forEach(function (subgraph) {
8739
+ subgraph.removeEdge(_this);
8740
+ });
8741
+ this.__hpcc_graph.removeItem(this);
8742
+ };
8743
+ Edge.prototype.getSource = function () {
8744
+ return this.__hpcc_graph.idx[this._sourceActivity || this.source];
8745
+ };
8746
+ Edge.prototype.setSource = function (source) {
8747
+ if (this._sourceActivity) {
8748
+ this._sourceActivity = source.__hpcc_id;
8749
+ }
8750
+ else if (this.source) {
8751
+ this.source = source.__hpcc_id;
8752
+ }
8753
+ if (this.__widget) {
8754
+ this.__widget.setSource(this.getSource().__widget);
8755
+ }
8756
+ };
8757
+ Edge.prototype.getTarget = function () {
8758
+ return this.__hpcc_graph.idx[this._targetActivity || this.target];
8759
+ };
8760
+ return Edge;
8761
+ }(GraphItem));
8762
+ var QueryGraph = /** @class */ (function () {
8763
+ function QueryGraph() {
8764
+ this.idx = {};
8765
+ this.subgraphs = [];
8766
+ this.vertices = [];
8767
+ this.edges = [];
8768
+ this.xgmml = "";
8769
+ this.clear();
8770
+ }
8771
+ QueryGraph.prototype.clear = function () {
8772
+ this.xgmml = "";
8773
+ this.idx = {};
8774
+ this.subgraphs = [];
8775
+ this.vertices = [];
8776
+ this.edges = [];
8777
+ };
8778
+ QueryGraph.prototype.load = function (xgmml) {
8779
+ this.clear();
8780
+ this.merge(xgmml);
8781
+ };
8782
+ QueryGraph.prototype.merge = function (xgmml) {
8783
+ this.xgmml = xgmml;
8784
+ var parser = new DOMParser();
8785
+ var dom = parser.parseFromString(xgmml, "text/xml");
8786
+ this.walkDocument(dom.documentElement, "0");
8787
+ };
8788
+ QueryGraph.prototype.isSubgraph = function (item) {
8789
+ return item instanceof Subgraph;
8790
+ };
8791
+ QueryGraph.prototype.isVertex = function (item) {
8792
+ return item instanceof Vertex;
8793
+ };
8794
+ QueryGraph.prototype.isEdge = function (item) {
8795
+ return item instanceof Edge;
8796
+ };
8797
+ QueryGraph.prototype.getGlobalType = function (item) {
8798
+ if (item instanceof Vertex) {
8799
+ return GRAPH_TYPE.VERTEX;
8800
+ }
8801
+ else if (item instanceof Edge) {
8802
+ return GRAPH_TYPE.EDGE;
8803
+ }
8804
+ else if (item instanceof Subgraph) {
8805
+ return GRAPH_TYPE.SUBGRAPH;
8806
+ }
8807
+ else if (item instanceof QueryGraph) {
8808
+ return GRAPH_TYPE.GRAPH;
8809
+ }
8810
+ return GRAPH_TYPE.UNKNOWN;
8811
+ };
8812
+ QueryGraph.prototype.getGlobalTypeString = function (item) {
8813
+ if (item instanceof Vertex) {
8814
+ return GRAPH_TYPE_STRING.VERTEX;
8815
+ }
8816
+ else if (item instanceof Edge) {
8817
+ return GRAPH_TYPE_STRING.EDGE;
8818
+ }
8819
+ else if (item instanceof Subgraph) {
8820
+ return GRAPH_TYPE_STRING.SUBGRAPH;
8821
+ }
8822
+ else if (item instanceof QueryGraph) {
8823
+ return GRAPH_TYPE_STRING.GRAPH;
8824
+ }
8825
+ return GRAPH_TYPE_STRING.UNKNOWN;
8826
+ };
8827
+ QueryGraph.prototype.getItem = function (docNode, id) {
8828
+ if (!this.idx[id]) {
8829
+ switch (docNode.tagName) {
8830
+ case "graph":
8831
+ var subgraph = new Subgraph(this, id);
8832
+ this.subgraphs.push(subgraph);
8833
+ this.idx[id] = subgraph;
8834
+ break;
8835
+ case "node":
8836
+ var vertex = new Vertex(this, id);
8837
+ this.vertices.push(vertex);
8838
+ this.idx[id] = vertex;
8839
+ break;
8840
+ case "edge":
8841
+ var edge = new Edge(this, id);
8842
+ this.edges.push(edge);
8843
+ this.idx[id] = edge;
8844
+ break;
8845
+ default:
8846
+ console.warn("Graph.getItem - Unknown Node Type!");
8847
+ break;
8848
+ }
8849
+ }
8850
+ var retVal = this.idx[id];
8851
+ Array.from(docNode.attributes).forEach(function (attr) {
8852
+ safeAssign(retVal, attr.name, attr.value);
8853
+ });
8854
+ return retVal;
8855
+ };
8856
+ QueryGraph.prototype.removeItem = function (item) {
8857
+ delete this.idx[item.__hpcc_id];
8858
+ if (item instanceof Subgraph) {
8859
+ this.subgraphs = this.subgraphs.filter(function (subgraph) {
8860
+ return item !== subgraph;
8861
+ });
8862
+ }
8863
+ else if (item instanceof Vertex) {
8864
+ this.vertices = this.vertices.filter(function (vertex) {
8865
+ return item !== vertex;
8866
+ });
8867
+ }
8868
+ else if (item instanceof Edge) {
8869
+ this.edges = this.edges.filter(function (edge) {
8870
+ return item !== edge;
8871
+ });
8872
+ }
8873
+ };
8874
+ QueryGraph.prototype.getChildByTagName = function (docNode, tagName) {
8875
+ var retVal = null;
8876
+ Array.from(docNode.childNodes).some(function (childNode, idx) {
8877
+ if (childNode.tagName === tagName) {
8878
+ retVal = childNode;
8879
+ return true;
8880
+ }
8881
+ });
8882
+ return retVal;
8883
+ };
8884
+ QueryGraph.prototype.walkDocument = function (docNode, id) {
8885
+ var _this = this;
8886
+ var retVal = this.getItem(docNode, id);
8887
+ docNode.childNodes.forEach(function (childNode, idx) {
8888
+ switch (childNode.nodeType) {
8889
+ case 1: // ELEMENT_NODE
8890
+ switch (childNode.tagName) {
8891
+ case "graph":
8892
+ break;
8893
+ case "node":
8894
+ var isSubgraph = false;
8895
+ var attNode = _this.getChildByTagName(childNode, "att");
8896
+ if (attNode) {
8897
+ var graphNode = _this.getChildByTagName(attNode, "graph");
8898
+ if (graphNode) {
8899
+ isSubgraph = true;
8900
+ var subgraph = _this.walkDocument(graphNode, childNode.getAttribute("id"));
8901
+ retVal.addSubgraph(subgraph);
8902
+ }
8903
+ }
8904
+ if (!isSubgraph) {
8905
+ var vertex = _this.walkDocument(childNode, childNode.getAttribute("id"));
8906
+ retVal.addVertex(vertex);
8907
+ }
8908
+ break;
8909
+ case "att":
8910
+ var name_1 = childNode.getAttribute("name");
8911
+ var uname = "_" + name_1;
8912
+ var value = childNode.getAttribute("value");
8913
+ if (name_1.indexOf("Time") === 0) {
8914
+ safeAssign(retVal, uname, value);
8915
+ safeAssign(retVal, name_1, "" + espTime2Seconds(value));
8916
+ }
8917
+ else if (name_1.indexOf("Size") === 0) {
8918
+ safeAssign(retVal, uname, value);
8919
+ safeAssign(retVal, name_1, "" + espSize2Bytes(value));
8920
+ }
8921
+ else if (name_1.indexOf("Skew") === 0) {
8922
+ safeAssign(retVal, uname, value);
8923
+ safeAssign(retVal, name_1, "" + espSkew2Number(value));
8924
+ }
8925
+ else {
8926
+ safeAssign(retVal, name_1, value);
8927
+ }
8928
+ break;
8929
+ case "edge":
8930
+ var edge = _this.walkDocument(childNode, childNode.getAttribute("id"));
8931
+ if (edge.NumRowsProcessed !== undefined) {
8932
+ edge._eclwatchCount = edge.NumRowsProcessed.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
8933
+ }
8934
+ else if (edge.Count !== undefined) {
8935
+ edge._eclwatchCount = edge.Count.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
8936
+ }
8937
+ else if (edge.count !== undefined) {
8938
+ edge._eclwatchCount = edge.count.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
8939
+ }
8940
+ if (edge.inputProgress) {
8941
+ edge._eclwatchInputProgress = "[" + edge.inputProgress.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "]";
8942
+ }
8943
+ if (edge.SkewMaxRowsProcessed && edge.SkewMinRowsProcessed) {
8944
+ edge._eclwatchSkew = "+" + edge.SkewMaxRowsProcessed + ", " + edge.SkewMinRowsProcessed;
8945
+ }
8946
+ if (edge._dependsOn) ;
8947
+ else if (edge._childGraph) ;
8948
+ else if (edge._sourceActivity || edge._targetActivity) {
8949
+ edge._isSpill = true;
8950
+ var source = edge.getSource();
8951
+ source._isSpill = true;
8952
+ var target = edge.getTarget();
8953
+ target._isSpill = true;
8954
+ }
8955
+ retVal.addEdge(edge);
8956
+ break;
8957
+ }
8958
+ break;
8959
+ }
8960
+ });
8961
+ return retVal;
8962
+ };
8963
+ QueryGraph.prototype.removeSubgraphs = function () {
8964
+ var subgraphs = __spreadArray([], this.subgraphs, true);
8965
+ subgraphs.forEach(function (subgraph) {
8966
+ if (subgraph.__hpcc_parent instanceof Subgraph) {
8967
+ subgraph.remove();
8968
+ }
8969
+ });
8970
+ };
8971
+ QueryGraph.prototype.removeSpillVertices = function () {
8972
+ var vertices = __spreadArray([], this.vertices, true);
8973
+ vertices.forEach(function (vertex) {
8974
+ if (vertex.isSpill()) {
8975
+ vertex.remove();
8976
+ }
8977
+ });
8978
+ };
8979
+ QueryGraph.prototype.getLocalisedXGMML = function (items, localisationDepth, localisationDistance, noSpills) {
8980
+ var xgmmlWriter = new LocalisedXGMMLWriter(this);
8981
+ xgmmlWriter.calcVisibility(items, localisationDepth, localisationDistance, noSpills);
8982
+ xgmmlWriter.writeXgmml();
8983
+ return "<graph>" + xgmmlWriter.m_xgmml + "</graph>";
8984
+ };
8985
+ return QueryGraph;
8986
+ }());
8987
+
8240
8988
  var logger$1 = util.scopedLogger("@hpcc-js/comms/ecl/query.ts");
8989
+ var siFormatter = format("~s");
8990
+ function isNumber(n) {
8991
+ return !isNaN(parseFloat(n)) && !isNaN(n - 0);
8992
+ }
8241
8993
  var QueryCache = /** @class */ (function (_super) {
8242
8994
  __extends(QueryCache, _super);
8243
8995
  function QueryCache() {
@@ -8513,6 +9265,66 @@
8513
9265
  Query.prototype.fetchSummaryStats = function () {
8514
9266
  return this.wsWorkunitsService.WUQueryGetSummaryStats({ Target: this.QuerySet, QueryId: this.QueryId });
8515
9267
  };
9268
+ Query.prototype.fetchGraph = function (GraphName, SubGraphId) {
9269
+ if (GraphName === void 0) { GraphName = ""; }
9270
+ if (SubGraphId === void 0) { SubGraphId = ""; }
9271
+ return this.wsWorkunitsService.WUQueryGetGraph({ Target: this.QuerySet, QueryId: this.QueryId, GraphName: GraphName, SubGraphId: SubGraphId }).then(function (response) {
9272
+ var _a;
9273
+ var graph = new QueryGraph();
9274
+ var first = true;
9275
+ for (var _i = 0, _b = ((_a = response === null || response === void 0 ? void 0 : response.Graphs) === null || _a === void 0 ? void 0 : _a.ECLGraphEx) || []; _i < _b.length; _i++) {
9276
+ var graphItem = _b[_i];
9277
+ if (first) {
9278
+ graph.load(graphItem.Graph);
9279
+ first = false;
9280
+ }
9281
+ else {
9282
+ graph.merge(graphItem.Graph);
9283
+ }
9284
+ }
9285
+ return graph;
9286
+ });
9287
+ };
9288
+ Query.prototype.fetchDetailsNormalized = function (request) {
9289
+ if (request === void 0) { request = {}; }
9290
+ var wu = Workunit.attach(this.wsWorkunitsService, this.Wuid);
9291
+ if (wu) {
9292
+ return Promise.all([this.fetchGraph(), wu.fetchDetailsMeta(), wu.fetchDetailsRaw(request)]).then(function (promises) {
9293
+ var graph = promises[0];
9294
+ var meta = promises[1];
9295
+ var metrics = promises[2];
9296
+ var data = metrics.map(function (metric) {
9297
+ if (metric.Id[0] === "a" || metric.Id[0] === "e") {
9298
+ var item = graph.idx[metric.Id.substring(1)];
9299
+ var _loop_1 = function (key) {
9300
+ if (key.charAt(0) !== "_" && key.charAt(0) === key.charAt(0).toUpperCase() && (typeof item[key] === "string" || typeof item[key] === "number" || typeof item[key] === "boolean")) {
9301
+ if (!metric.Properties.Property.some(function (row) { return row.Name === key; })) {
9302
+ var isNum = isNumber(item[key]);
9303
+ var rawValue = isNum ? parseFloat(item[key]) : item[key];
9304
+ var formatted = item[key];
9305
+ if (key.indexOf("Time") >= 0) {
9306
+ rawValue = rawValue / 1000000000;
9307
+ formatted = siFormatter(rawValue) + "s";
9308
+ }
9309
+ metric.Properties.Property.push({
9310
+ Name: key,
9311
+ RawValue: rawValue,
9312
+ Formatted: formatted
9313
+ });
9314
+ }
9315
+ }
9316
+ };
9317
+ for (var key in item) {
9318
+ _loop_1(key);
9319
+ }
9320
+ }
9321
+ return metric;
9322
+ });
9323
+ return wu.normalizeDetails(meta, data);
9324
+ });
9325
+ }
9326
+ return Promise.resolve({ meta: undefined, columns: undefined, data: undefined });
9327
+ };
8516
9328
  Query.prototype.submit = function (request) {
8517
9329
  var _a;
8518
9330
  return __awaiter(this, void 0, void 0, function () {
@@ -9351,6 +10163,7 @@
9351
10163
  exports.PackageProcessService = PackageProcessService;
9352
10164
  exports.PropertyType = PropertyType;
9353
10165
  exports.Query = Query;
10166
+ exports.QueryGraph = QueryGraph;
9354
10167
  exports.RelatedProperty = RelatedProperty;
9355
10168
  exports.Resource = Resource;
9356
10169
  exports.ResourcesService = ResourcesService;