@hestia-earth/ui-components 0.3.1 → 0.3.4

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.
@@ -1252,9 +1252,9 @@
1252
1252
  params: filterParams({ dataState: dataState })
1253
1253
  }).toPromise().catch(handleAPIError);
1254
1254
  };
1255
- HeNodeService.prototype.getModelsLog = function (_a) {
1255
+ HeNodeService.prototype.getErrorLog = function (_a) {
1256
1256
  var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
1257
- return this.http.get(this.nodeUrl(node) + "/log/models", {
1257
+ return this.http.get(this.nodeUrl(node) + "/log/error", {
1258
1258
  headers: this.authService.headers,
1259
1259
  params: filterParams({ dataState: dataState })
1260
1260
  }).toPromise().catch(handleAPIError);
@@ -1939,6 +1939,13 @@
1939
1939
  this.baseUrl = baseUrl();
1940
1940
  this.toString = toString;
1941
1941
  }
1942
+ Object.defineProperty(LinkKeyValueComponent.prototype, "isInlineBlock", {
1943
+ get: function () {
1944
+ return this.isArray;
1945
+ },
1946
+ enumerable: false,
1947
+ configurable: true
1948
+ });
1942
1949
  Object.defineProperty(LinkKeyValueComponent.prototype, "type", {
1943
1950
  get: function () {
1944
1951
  return this.node['@type'] || this.node.type;
@@ -1984,7 +1991,7 @@
1984
1991
  return LinkKeyValueComponent;
1985
1992
  }());
1986
1993
  LinkKeyValueComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LinkKeyValueComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1987
- LinkKeyValueComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: { node: "node", nodeType: "nodeType", dataKey: "dataKey", key: "key" }, ngImport: i0__namespace, template: "<ng-container *ngIf=\"!isUndefined\">\n <ng-container *bindOnce=\"node\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n <span class=\"pr-2\">:</span>\n\n <ng-container *ngIf=\"isArray; else singleValue\">\n <div class=\"array-container pl-2\">\n <p *ngFor=\"let v of value\" [innerHtml]=\"toString(v) | precision:3\"></p>\n </div>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #singleValue>\n <div class=\"is-inline-block pr-1\" [innerHtml]=\"valueString | precision:3\"></div>\n\n <he-blank-node-state\n [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"\n ></he-blank-node-state>\n</ng-template>\n", styles: [":host{display:block}.array-container{max-height:100px;overflow-y:auto}\n"], components: [{ type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "precision": PrecisionPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1994
+ LinkKeyValueComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: { node: "node", nodeType: "nodeType", dataKey: "dataKey", key: "key" }, host: { properties: { "class.is-inline-block": "this.isInlineBlock" } }, ngImport: i0__namespace, template: "<ng-container *ngIf=\"!isUndefined\">\n <ng-container *bindOnce=\"node\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n <span class=\"pr-2\">:</span>\n\n <ng-container *ngIf=\"isArray; else singleValue\">\n <div class=\"array-container pl-2\">\n <p *ngFor=\"let v of value\" [innerHtml]=\"toString(v) | precision:3\"></p>\n </div>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #singleValue>\n <div class=\"is-inline-block pr-1\" [innerHtml]=\"valueString | precision:3\"></div>\n\n <he-blank-node-state\n [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"\n ></he-blank-node-state>\n</ng-template>\n", styles: [":host{display:block}.array-container{max-height:100px;overflow-y:auto}\n"], components: [{ type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "precision": PrecisionPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1988
1995
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LinkKeyValueComponent, decorators: [{
1989
1996
  type: i0.Component,
1990
1997
  args: [{
@@ -2001,6 +2008,9 @@
2001
2008
  type: i0.Input
2002
2009
  }], key: [{
2003
2010
  type: i0.Input
2011
+ }], isInlineBlock: [{
2012
+ type: i0.HostBinding,
2013
+ args: ['class.is-inline-block']
2004
2014
  }] } });
2005
2015
 
2006
2016
  var locationQuery = function (bounds, searchField) {
@@ -4123,13 +4133,13 @@
4123
4133
  }]
4124
4134
  }] });
4125
4135
 
4126
- var orderBy$7 = require('lodash.orderby');
4136
+ var orderBy$6 = require('lodash.orderby');
4127
4137
  var SortByPipe = /** @class */ (function () {
4128
4138
  function SortByPipe() {
4129
4139
  }
4130
4140
  SortByPipe.prototype.transform = function (value, keys, orders) {
4131
4141
  if (orders === void 0) { orders = ['asc']; }
4132
- return orderBy$7(value, keys, orders);
4142
+ return orderBy$6(value, keys, orders);
4133
4143
  };
4134
4144
  return SortByPipe;
4135
4145
  }());
@@ -5370,6 +5380,9 @@
5370
5380
  type: i0.Input
5371
5381
  }] } });
5372
5382
 
5383
+ var skipState = [
5384
+ schema.NodeType.Term
5385
+ ];
5373
5386
  var NodeLinkComponent = /** @class */ (function () {
5374
5387
  function NodeLinkComponent() {
5375
5388
  this.showExternalLink = false;
@@ -5388,7 +5401,7 @@
5388
5401
  this.node['@type'].toLowerCase(),
5389
5402
  this.id
5390
5403
  ].filter(Boolean).join('/');
5391
- return url + "?dataState=" + api.DataState.recalculated;
5404
+ return "" + url + (skipState.includes(this.node['@type']) ? '' : "?dataState=" + api.DataState.recalculated);
5392
5405
  },
5393
5406
  enumerable: false,
5394
5407
  configurable: true
@@ -5501,19 +5514,19 @@
5501
5514
 
5502
5515
  var get$3 = require('lodash.get');
5503
5516
  var set$1 = require('lodash.set');
5504
- var orderBy$6 = require('lodash.orderby');
5517
+ var orderBy$5 = require('lodash.orderby');
5505
5518
  var termTypes = Object.values(schema.TermTermType);
5506
5519
  var blankNodeTypes = Object.values(schema.SchemaType).filter(function (t) { return !schema.isTypeNode(t); });
5507
5520
  var schemaTypesLowerCase = Object.values(schema.SchemaType).map(function (v) { return v.toLowerCase(); });
5508
5521
  var blankNodeTypesLowerCase = blankNodeTypes.map(function (v) { return v.toLowerCase(); });
5509
5522
  var missingLookupPrefix = 'Missing lookup';
5510
5523
  var parseFilename = function (filepath) {
5511
- var _c = __read(filepath.split('.'), 1), filename = _c[0];
5524
+ var _b = __read(filepath.split('.'), 1), filename = _b[0];
5512
5525
  var ext = termTypes.includes(filename) ? api.SupportedExtensions.xlsx : api.SupportedExtensions.csv;
5513
5526
  return api.fileToExt(filename, ext);
5514
5527
  };
5515
- var parseLookup = function (_c) {
5516
- var column = _c.column, termid = _c.termid, _d = missingLookupPrefix, missingLookup = _c[_d];
5528
+ var parseLookup = function (_b) {
5529
+ var column = _b.column, termid = _b.termid, _c = missingLookupPrefix, missingLookup = _b[_c];
5517
5530
  return ({
5518
5531
  filename: parseFilename(missingLookup), termId: termid,
5519
5532
  column: column
@@ -5524,10 +5537,10 @@
5524
5537
  try {
5525
5538
  var data = JSON.parse(message);
5526
5539
  return data.message.split(',').reduce(function (prev, parts) {
5527
- var _c;
5528
- var _d = __read(parts.split('='), 2), key = _d[0], value = _d[1];
5540
+ var _b;
5541
+ var _c = __read(parts.split('='), 2), key = _c[0], value = _c[1];
5529
5542
  var val = csvValue(value);
5530
- return Object.assign(Object.assign({}, prev), (key && val ? (_c = {}, _c[key.trim()] = val, _c) : {}));
5543
+ return Object.assign(Object.assign({}, prev), (key && val ? (_b = {}, _b[key.trim()] = val, _b) : {}));
5531
5544
  }, { logger: data.logger });
5532
5545
  }
5533
5546
  catch (err) {
@@ -5535,29 +5548,31 @@
5535
5548
  return {};
5536
5549
  }
5537
5550
  };
5538
- var omitLogKeys = function (log) { return Object.fromEntries(Object.entries(log).filter(function (_c) {
5539
- var _d = __read(_c, 1), key = _d[0];
5551
+ var omitLogKeys = function (log) { return Object.fromEntries(Object.entries(log).filter(function (_b) {
5552
+ var _c = __read(_b, 1), key = _c[0];
5540
5553
  return !schemaTypesLowerCase.includes(key);
5541
5554
  })); };
5542
5555
  var includeBlankNodes = function (logs, log) { return Object
5543
5556
  .keys(log)
5544
5557
  .filter(function (key) { return blankNodeTypesLowerCase.includes(key); })
5545
5558
  .reduce(function (prev, key) {
5546
- var _c;
5547
- return (Object.assign(Object.assign({}, prev), (_c = {}, _c[key] = utils.unique(__spreadArray(__spreadArray([], __read(((typeof prev[key] === 'string' ? [prev[key]] : prev[key]) || []))), [
5559
+ var _b;
5560
+ return (Object.assign(Object.assign({}, prev), (_b = {}, _b[key] = utils.unique(__spreadArray(__spreadArray([], __read(((typeof prev[key] === 'string' ? [prev[key]] : prev[key]) || []))), [
5548
5561
  log[key]
5549
- ])), _c)));
5562
+ ])), _b)));
5550
5563
  }, logs); };
5551
5564
  var groupLog = function (group, _a) {
5552
5565
  var logger = _a.logger, term = _a.term, model = _a.model, key = _a.key, should_run = _a.should_run, run_required = _a.run_required, property = _a.property, log = __rest(_a, ["logger", "term", "model", "key", "should_run", "run_required", "property"]);
5553
5566
  var isOrchestrator = logger.includes('orchestrator');
5554
5567
  var isKey = !isOrchestrator && !!key;
5568
+ var isProperty = !isOrchestrator && !!property;
5555
5569
  var parentLogKey = ["[\"" + term + "\"]", !isOrchestrator && key || property].filter(Boolean).join('.');
5556
5570
  var logModelKey = [parentLogKey, model].filter(Boolean).join('.');
5557
5571
  set$1(group, parentLogKey + ".models", utils.unique(__spreadArray(__spreadArray([], __read(get$3(group, parentLogKey + ".models", []))), [
5558
5572
  model
5559
5573
  ])));
5560
5574
  set$1(group, parentLogKey + ".isKey", isKey);
5575
+ set$1(group, parentLogKey + ".isProperty", isProperty);
5561
5576
  var data = get$3(group, logModelKey, {});
5562
5577
  data = includeBlankNodes(data, log);
5563
5578
  if (typeof should_run !== 'undefined') {
@@ -5591,8 +5606,8 @@
5591
5606
  group[id] = data;
5592
5607
  if (key === 'transformation') {
5593
5608
  // add value to the same term/model on parent group
5594
- Object.entries(group[id]).map(function (_c) {
5595
- var _d = __read(_c, 2), term = _d[0], models = _d[1];
5609
+ Object.entries(group[id]).map(function (_b) {
5610
+ var _c = __read(_b, 2), term = _c[0], models = _c[1];
5596
5611
  return Object.keys(models).map(function (model) {
5597
5612
  var _a;
5598
5613
  if ((_a = group === null || group === void 0 ? void 0 : group[term]) === null || _a === void 0 ? void 0 : _a[model]) {
@@ -5608,7 +5623,7 @@
5608
5623
  var subValueKeys = [
5609
5624
  'transformation'
5610
5625
  ];
5611
- var groupLogsByModel = function (data) { return data.split('\n')
5626
+ var groupLogsByModel = function (data) { return data.trim().split('\n')
5612
5627
  .map(parseMessage)
5613
5628
  .filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && (v === null || v === void 0 ? void 0 : v.term) !== 'None' && !!(v === null || v === void 0 ? void 0 : v.model); })
5614
5629
  .reduce(function (group, log) {
@@ -5619,55 +5634,55 @@
5619
5634
  groupLogSubValue(group, log, subValue) :
5620
5635
  groupLog(groupLogSubValue(group, log, subValue), log)
5621
5636
  : groupLog(group, log);
5622
- }); };
5637
+ }, {}); };
5623
5638
  var computeTerms = function (originalValues, recalculatedValues, terms, filterTermTypes) { return rxjs.from((terms === null || terms === void 0 ? void 0 : terms.length) ?
5624
5639
  terms :
5625
- __spreadArray(__spreadArray([], __read((originalValues || []).map(function (_c) {
5626
- var term = _c.term;
5640
+ __spreadArray(__spreadArray([], __read((originalValues || []).map(function (_b) {
5641
+ var term = _b.term;
5627
5642
  return term;
5628
- }))), __read((recalculatedValues || []).map(function (_c) {
5629
- var term = _c.term;
5643
+ }))), __read((recalculatedValues || []).map(function (_b) {
5644
+ var term = _b.term;
5630
5645
  return term;
5631
- }))).filter(function (node) { return !(filterTermTypes === null || filterTermTypes === void 0 ? void 0 : filterTermTypes.length) || filterTermTypes.includes(node.termType); })).pipe(operators.distinct(function (v) { return v['@id']; }), operators.toArray(), operators.map(function (v) { return orderBy$6(v, ['name'], ['asc']); })).toPromise(); };
5632
- var LogStatus;
5646
+ }))).filter(function (node) { return !(filterTermTypes === null || filterTermTypes === void 0 ? void 0 : filterTermTypes.length) || filterTermTypes.includes(node.termType); })).pipe(operators.distinct(function (v) { return v['@id']; }), operators.toArray(), operators.map(function (v) { return orderBy$5(v, ['name'], ['asc']); })).toPromise(); };
5647
+ exports.LogStatus = void 0;
5633
5648
  (function (LogStatus) {
5634
5649
  LogStatus["success"] = "successful";
5635
5650
  LogStatus["error"] = "failed";
5636
5651
  LogStatus["skipHierarchy"] = "not run (model higher up hierarchy run instead)";
5637
5652
  LogStatus["dataProvided"] = "not run (user provided data retained)";
5638
5653
  LogStatus["notRequired"] = "not relevant";
5639
- })(LogStatus || (LogStatus = {}));
5654
+ })(exports.LogStatus || (exports.LogStatus = {}));
5640
5655
  var hasLogDetails = function (data, logs) {
5641
5656
  var _a;
5642
5657
  return [
5643
- LogStatus.success,
5644
- LogStatus.error
5658
+ exports.LogStatus.success,
5659
+ exports.LogStatus.error
5645
5660
  ].includes(logStatus(data, logs)) && ((logs === null || logs === void 0 ? void 0 : logs.requirements) || (logs === null || logs === void 0 ? void 0 : logs.logs) || ((_a = logs === null || logs === void 0 ? void 0 : logs.missingLookups) === null || _a === void 0 ? void 0 : _a.length));
5646
5661
  };
5647
5662
  var logStatus = function (data, logs) { return hasLog(logs)
5648
5663
  ? (!data.isRequired
5649
- ? LogStatus.notRequired
5664
+ ? exports.LogStatus.notRequired
5650
5665
  : isRunOrchestrator(logs)
5651
5666
  ? ('shouldRun' in logs
5652
5667
  ? logs.shouldRun
5653
5668
  ? data.isRecalculated
5654
- ? LogStatus.success
5655
- : LogStatus.dataProvided
5656
- : LogStatus.error
5657
- : LogStatus.dataProvided)
5669
+ ? exports.LogStatus.success
5670
+ : exports.LogStatus.dataProvided
5671
+ : exports.LogStatus.error
5672
+ : exports.LogStatus.dataProvided)
5658
5673
  : data.isRecalculated
5659
- ? LogStatus.skipHierarchy
5660
- : LogStatus.dataProvided)
5674
+ ? exports.LogStatus.skipHierarchy
5675
+ : exports.LogStatus.dataProvided)
5661
5676
  : ([
5662
5677
  typeof data.originalValue === 'undefined',
5663
5678
  data.isRecalculated // is recalculated
5664
5679
  ].every(Boolean)
5665
- ? LogStatus.skipHierarchy
5666
- : LogStatus.dataProvided); };
5680
+ ? exports.LogStatus.skipHierarchy
5681
+ : exports.LogStatus.dataProvided); };
5667
5682
  var reduceValues = function (values, termId) {
5668
5683
  var propertyValues = values
5669
- .map(function (_c) {
5670
- var value = _c.value;
5684
+ .map(function (_b) {
5685
+ var value = _b.value;
5671
5686
  return term.propertyValue(value, termId);
5672
5687
  })
5673
5688
  // propertyValue may return null if the value is null or undefined, therefore remove them from total
@@ -5696,8 +5711,8 @@
5696
5711
  input: function (values, _k, id) {
5697
5712
  var _a;
5698
5713
  return !!id && (values === null || values === void 0 ? void 0 : values.length)
5699
- ? term.propertyValue((_a = values.find(function (_c) {
5700
- var inputs = _c.inputs;
5714
+ ? term.propertyValue((_a = values.find(function (_b) {
5715
+ var inputs = _b.inputs;
5701
5716
  return (inputs || []).some(function (input) { return input['@id'] === id; });
5702
5717
  })) === null || _a === void 0 ? void 0 : _a.value, id)
5703
5718
  : '';
@@ -5715,33 +5730,48 @@
5715
5730
  var logSubValue = function (logs, key, prop) { return logs[key][prop] ? (Array.isArray(logs[key][prop]) ?
5716
5731
  logs[key][prop].map(function (id) { return ({ key: prop, id: id }); }) :
5717
5732
  { key: prop, id: logs[key][prop] }) : undefined; };
5718
- var logProperties = function (nodes, models) { return nodes.flatMap(function (node) { return (node.properties || []).map(function (_c) {
5719
- var term = _c.term;
5733
+ var logProperties = function (nodes, models) { return nodes.flatMap(function (node) { return (node.properties || []).map(function (_b) {
5734
+ var term = _b.term;
5720
5735
  return term['@id'];
5721
- }); }).map(function (id) { return ({ key: 'property', id: id, configModels: findModels(models, id).map(function (_c) {
5722
- var model = _c.model;
5736
+ }); }).map(function (id) { return ({ key: 'property', id: id, configModels: findModels(models, id).map(function (_b) {
5737
+ var model = _b.model;
5723
5738
  return model;
5724
5739
  }) }); }); };
5725
- var logSubValues = function (allLogs, logs, original, recalculated, models, _c) {
5726
- var nodeType = _c.nodeType, type = _c.type, termId = _c.termId;
5727
- return utils.unique(__spreadArray(__spreadArray(__spreadArray([], __read(Object.keys(logs).flatMap(function (key) { return [
5740
+ var logSubValues = function (allLogs, logs, original, recalculated, models, _b) {
5741
+ var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
5742
+ return utils.unique(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.keys(logs)
5743
+ .filter(function (id) { return logs[id].isProperty; })
5744
+ .map(function (id) { return ({
5745
+ id: id,
5746
+ key: 'property',
5747
+ configModels: (logs[id].models || []).filter(function (v) { return hasLog(logs[id][v]); })
5748
+ }); }))), __read(Object.keys(logs).flatMap(function (key) { return [
5728
5749
  logSubValue(logs, key, 'input'),
5729
5750
  logSubValue(logs, key, 'property')
5730
5751
  ]
5731
5752
  .flat()
5732
5753
  .filter(Boolean)
5733
- .map(function (v) { return (Object.assign(Object.assign({}, v), { configModels: [key] })); }); }))), __read(logProperties(original, models))), __read(logProperties(recalculated, models))))
5734
- .map(function (v) {
5735
- var originalValue = blankNodeValue(original, v.key, v.id);
5736
- var recalculatedValue = blankNodeValue(recalculated, v.key, v.id);
5737
- return Object.assign(Object.assign({}, v), { configModels: v.configModels.map(configModelWithDocs(models, { nodeType: nodeType, type: type, termId: termId }, v)), originalValue: originalValue, recalculatedValue: recalculatedValue, isRecalculated: !utils.isUndefined(recalculatedValue) && recalculatedValue !== originalValue, isRequired: true });
5754
+ .map(function (v) { return (Object.assign(Object.assign({}, v), { configModels: v.configModels || [key] })); }); }))), __read(logProperties(original, models))), __read(logProperties(recalculated, models))))
5755
+ .map(function (_b) {
5756
+ var key = _b.key, id = _b.id, configModels = _b.configModels;
5757
+ var originalValue = blankNodeValue(original, key, id);
5758
+ var recalculatedValue = blankNodeValue(recalculated, key, id);
5759
+ return {
5760
+ key: key,
5761
+ id: id,
5762
+ configModels: configModels.map(configModelWithDocs(models, { nodeType: nodeType, type: type, termId: termId }, { key: key, id: id })),
5763
+ originalValue: originalValue,
5764
+ recalculatedValue: recalculatedValue,
5765
+ isRecalculated: !utils.isUndefined(recalculatedValue) && recalculatedValue !== originalValue,
5766
+ isRequired: true
5767
+ };
5738
5768
  })
5739
5769
  .filter(function (v) { return v.configModels.length > 0; })
5740
- .map(dataWithConfigModelLogs(allLogs));
5770
+ .map(function (v) { return v.key === 'property' ? dataWithConfigModelLogs(logs)(v) : dataWithConfigModelLogs(allLogs)(v); });
5741
5771
  };
5742
5772
  // const hasKey = (blankNodes: blankNode[], key: string) => (blankNodes || []).some(n => key in n);
5743
- var logKeys = function (logs, original, recalculated, models, _c) {
5744
- var nodeType = _c.nodeType, type = _c.type, termId = _c.termId;
5773
+ var logKeys = function (logs, original, recalculated, models, _b) {
5774
+ var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
5745
5775
  return Object.keys(logs)
5746
5776
  .filter(function (key) { return logs[key].isKey; })
5747
5777
  .map(function (key) { return ({
@@ -5782,8 +5812,8 @@
5782
5812
  }).filter(Boolean);
5783
5813
  return indexes.length ? indexes[0] : '';
5784
5814
  };
5785
- var configModelWithDocs = function (models, _c, subValue) {
5786
- var nodeType = _c.nodeType, type = _c.type, termId = _c.termId;
5815
+ var configModelWithDocs = function (models, _b, subValue) {
5816
+ var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
5787
5817
  return function (methodId) {
5788
5818
  var node = {
5789
5819
  '@type': nodeType,
@@ -5820,8 +5850,8 @@
5820
5850
  order: modelConfigOrder(config.models, termId, modelKey, model.methodId)
5821
5851
  }); });
5822
5852
  return modelsWithOrder
5823
- .reduce(function (prev, _c) {
5824
- var model = _c.model, order = _c.order;
5853
+ .reduce(function (prev, _b) {
5854
+ var model = _b.model, order = _b.order;
5825
5855
  var isArray = order.includes('.');
5826
5856
  var arrayIndex = isArray ? order.split('.')[0] : prev.length;
5827
5857
  prev[arrayIndex] = isArray ? __spreadArray(__spreadArray([], __read((prev[arrayIndex] || []))), [model]) : model;
@@ -5850,8 +5880,8 @@
5850
5880
  var recalculated = recalculatedValues.filter(function (v) { return termId === v.term['@id']; });
5851
5881
  var hasData = !!original.length || !!recalculated.length || Object.keys(termLogs).length > 0;
5852
5882
  var configModelsData = { nodeType: nodeType, type: type, termId: termId };
5853
- var configModels = groupParallelModels(config, termId, nodeKey, utils.unique(__spreadArray(__spreadArray([], __read((termLogs.models || []).filter(function (key) { return isModelLog(termLogs[key]); }))), __read(findConfigModels(config, termId, nodeKey, models).map(function (_c) {
5854
- var model = _c.model;
5883
+ var configModels = groupParallelModels(config, termId, nodeKey, utils.unique(__spreadArray(__spreadArray([], __read((termLogs.models || []).filter(function (key) { return isModelLog(termLogs[key]); }))), __read(findConfigModels(config, termId, nodeKey, models).map(function (_b) {
5884
+ var model = _b.model;
5855
5885
  return model;
5856
5886
  })))).map(configModelWithDocs(models, configModelsData)));
5857
5887
  var keys = logKeys(termLogs, original, recalculated, models, configModelsData);
@@ -5889,26 +5919,23 @@
5889
5919
  0
5890
5920
  ], __read(blankNodeLogs.flatMap(function (v) { return __spreadArray(__spreadArray([
5891
5921
  v.configModels.length
5892
- ], __read(v.subValues.map(function (s) { var _a, _b; return (_b = (_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; }))), [
5893
- v.keys.length ? 1 : 0
5894
- ]); })))); };
5922
+ ], __read((v.subValues.map(function (s) { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; })))), __read((v.keys.map(function (s) { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; })))); })))); };
5895
5923
 
5896
5924
  var _b, _c$1;
5897
- var orderBy$5 = require('lodash.orderby');
5898
5925
  var nodeTypesLowerCase = Object.values(schema.NodeType).map(function (v) { return v.toLowerCase(); });
5899
5926
  var logIcon = (_b = {},
5900
- _b[LogStatus.success] = 'check',
5901
- _b[LogStatus.error] = 'times',
5902
- _b[LogStatus.skipHierarchy] = ['far', 'circle'],
5903
- _b[LogStatus.dataProvided] = 'circle',
5904
- _b[LogStatus.notRequired] = 'dot-circle',
5927
+ _b[exports.LogStatus.success] = 'check',
5928
+ _b[exports.LogStatus.error] = 'times',
5929
+ _b[exports.LogStatus.skipHierarchy] = ['far', 'circle'],
5930
+ _b[exports.LogStatus.dataProvided] = 'circle',
5931
+ _b[exports.LogStatus.notRequired] = 'dot-circle',
5905
5932
  _b);
5906
5933
  var logColor = (_c$1 = {},
5907
- _c$1[LogStatus.success] = 'success',
5908
- _c$1[LogStatus.error] = 'danger',
5909
- _c$1[LogStatus.skipHierarchy] = 'dark',
5910
- _c$1[LogStatus.dataProvided] = 'dark',
5911
- _c$1[LogStatus.notRequired] = 'grey',
5934
+ _c$1[exports.LogStatus.success] = 'success',
5935
+ _c$1[exports.LogStatus.error] = 'danger',
5936
+ _c$1[exports.LogStatus.skipHierarchy] = 'dark',
5937
+ _c$1[exports.LogStatus.dataProvided] = 'dark',
5938
+ _c$1[exports.LogStatus.notRequired] = 'grey',
5912
5939
  _c$1);
5913
5940
  var methodIdLabel = function (methodId) { return methodId ?
5914
5941
  ({
@@ -5936,7 +5963,7 @@
5936
5963
  this.terms = [];
5937
5964
  this.baseUrl = baseUrl();
5938
5965
  this.isExternal = isExternal();
5939
- this.LogStatus = LogStatus;
5966
+ this.LogStatus = exports.LogStatus;
5940
5967
  this.logIcon = logIcon;
5941
5968
  this.logColor = logColor;
5942
5969
  this.propertyValue = term.propertyValue;
@@ -5953,20 +5980,23 @@
5953
5980
  }
5954
5981
  NodeLogsModelsComponent.prototype.ngOnInit = function () {
5955
5982
  return __awaiter(this, void 0, void 0, function () {
5956
- var logsString, groupedLogs, logs, nodeType, config, models, _b, engineModels, _c, _d;
5957
- return __generator(this, function (_e) {
5958
- switch (_e.label) {
5983
+ var _b, groupedLogs, logs, nodeType, config, models, _c, engineModels, _d, _e;
5984
+ return __generator(this, function (_f) {
5985
+ switch (_f.label) {
5959
5986
  case 0:
5960
5987
  this.logsUrl = this.nodeService.nodeLogsUrl(this.node);
5961
- return [4 /*yield*/, this.nodeService.getLog(this.node).toPromise()];
5988
+ // save as local variable to avoid "reserved yield keyword" issue
5989
+ _b = this;
5990
+ return [4 /*yield*/, this.getLogs()];
5962
5991
  case 1:
5963
- logsString = _e.sent();
5964
- groupedLogs = groupLogsByModel(logsString);
5992
+ // save as local variable to avoid "reserved yield keyword" issue
5993
+ _b.logs = _f.sent();
5994
+ groupedLogs = groupLogsByModel(this.logs);
5965
5995
  logs = this.logsKey ? groupedLogs[this.logsKey] : groupedLogs;
5966
5996
  nodeType = this.node['@type'] || this.node.type;
5967
5997
  return [4 /*yield*/, this.engineService.ochestratorConfig(nodeType)];
5968
5998
  case 2:
5969
- config = _e.sent();
5999
+ config = _f.sent();
5970
6000
  return [4 /*yield*/, this.searchService.search({
5971
6001
  fields: ['@type', '@id', 'name'],
5972
6002
  limit: 1000,
@@ -5980,28 +6010,28 @@
5980
6010
  }
5981
6011
  })];
5982
6012
  case 3:
5983
- models = (_e.sent()).results;
5984
- _b = this;
6013
+ models = (_f.sent()).results;
6014
+ _c = this;
5985
6015
  return [4 /*yield*/, rxjs.from(models).pipe(operators.filter(function (v) { return !!v; }), operators.distinct(function (v) { return v['@id']; }), operators.reduce(function (prev, curr) {
5986
6016
  var _b;
5987
6017
  return (Object.assign(Object.assign({}, prev), (_b = {}, _b[curr['@id']] = curr, _b)));
5988
6018
  }, {})).toPromise()];
5989
6019
  case 4:
5990
- _b.methodsById = _e.sent();
6020
+ _c.methodsById = _f.sent();
5991
6021
  if (!this.includeAllModels) return [3 /*break*/, 6];
5992
6022
  return [4 /*yield*/, this.engineService.models()];
5993
6023
  case 5:
5994
- _c = _e.sent();
6024
+ _d = _f.sent();
5995
6025
  return [3 /*break*/, 7];
5996
6026
  case 6:
5997
- _c = [];
5998
- _e.label = 7;
6027
+ _d = [];
6028
+ _f.label = 7;
5999
6029
  case 7:
6000
- engineModels = _c;
6001
- _d = this;
6030
+ engineModels = _d;
6031
+ _e = this;
6002
6032
  return [4 /*yield*/, computeTerms(this.originalValues, this.recalculatedValues, this.terms, this.filterTermTypes)];
6003
6033
  case 8:
6004
- _d.allTerms = _e.sent();
6034
+ _e.allTerms = _f.sent();
6005
6035
  this.allBlankNodes = this.allTerms.flatMap(groupLogsByTerm(nodeType, logs, engineModels, config, this.originalValues, this.recalculatedValues, this.nodeKey));
6006
6036
  this.methodModelsCount = modelCount(this.allBlankNodes);
6007
6037
  this.rowsCount = this.allBlankNodes.reduce(function (prev, curr) { return prev + 1 + curr.subValues.length + curr.keys.length; }, 0);
@@ -6012,6 +6042,9 @@
6012
6042
  });
6013
6043
  });
6014
6044
  };
6045
+ NodeLogsModelsComponent.prototype.getLogs = function () {
6046
+ return this.nodeService.getLog(this.node).toPromise();
6047
+ };
6015
6048
  NodeLogsModelsComponent.prototype.suggestByTerm = function (term) {
6016
6049
  return rxjs.from(this.allTerms).pipe(operators.map(function (v) { return v.name; }), operators.filter(function (v) { return v.toLowerCase().includes(term.toLowerCase()); }), operators.toArray());
6017
6050
  };
@@ -6127,6 +6160,10 @@
6127
6160
  this.additionalKeys = additionalKeys;
6128
6161
  this.tableKeys = tableKeys;
6129
6162
  }
6163
+ NodeValueDetailsComponent.prototype.ngOnInit = function () {
6164
+ var _this = this;
6165
+ this.tableKeys = tableKeys.filter(function (key) { var _a; return (((_a = _this.data) === null || _a === void 0 ? void 0 : _a.nodes) || []).some(function (node) { return key in node; }); });
6166
+ };
6130
6167
  Object.defineProperty(NodeValueDetailsComponent.prototype, "type", {
6131
6168
  get: function () {
6132
6169
  var _a;
@@ -6135,14 +6172,18 @@
6135
6172
  enumerable: false,
6136
6173
  configurable: true
6137
6174
  });
6138
- NodeValueDetailsComponent.prototype.ngOnInit = function () {
6139
- var _this = this;
6140
- this.tableKeys = tableKeys.filter(function (key) { var _a; return (((_a = _this.data) === null || _a === void 0 ? void 0 : _a.nodes) || []).some(function (node) { return key in node; }); });
6141
- };
6175
+ Object.defineProperty(NodeValueDetailsComponent.prototype, "showInline", {
6176
+ get: function () {
6177
+ var _a, _b;
6178
+ return ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.length) === 1;
6179
+ },
6180
+ enumerable: false,
6181
+ configurable: true
6182
+ });
6142
6183
  return NodeValueDetailsComponent;
6143
6184
  }());
6144
6185
  NodeValueDetailsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeValueDetailsComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
6145
- NodeValueDetailsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: { data: "data", nodeType: "nodeType", dataKey: "dataKey" }, ngImport: i0__namespace, template: "<ng-container *bindOnce=\"data\">\n <ng-container *ngIf=\"data?.nodes?.length === 1; else showTable\">\n <ng-container *ngFor=\"let key of keys\">\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </ng-container>\n <ng-container *ngFor=\"let key of additionalKeys\">\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #showTable>\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" key=\"term\"></he-link-key-value>\n\n <div class=\"table-container mt-2\">\n <table class=\"table is-narrow\">\n <thead>\n <th *ngFor=\"let key of tableKeys\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n </th>\n </thead>\n <tbody>\n <tr *ngFor=\"let node of data!.nodes\">\n <td *ngFor=\"let key of tableKeys\">\n <he-link-key-value [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</ng-template>\n", styles: ["table{background-color:transparent;color:#fff}table::ng-deep he-link-key-value>a:first-child,table::ng-deep he-link-key-value>a:first-child+span{display:none}\n"], components: [{ type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: ["node", "nodeType", "dataKey", "key"] }], directives: [{ type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
6186
+ NodeValueDetailsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: { data: "data", nodeType: "nodeType", dataKey: "dataKey" }, ngImport: i0__namespace, template: "<ng-container *bindOnce=\"data\">\n <ng-container *ngIf=\"showInline; else asTable\">\n <ng-container *ngFor=\"let key of keys\">\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </ng-container>\n <ng-container *ngFor=\"let key of additionalKeys\">\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #asTable>\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" key=\"term\"></he-link-key-value>\n\n <div class=\"table-container mt-2\">\n <table class=\"table is-narrow\">\n <thead>\n <th *ngFor=\"let key of tableKeys\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n </th>\n </thead>\n <tbody>\n <tr *ngFor=\"let node of data!.nodes\">\n <td *ngFor=\"let key of tableKeys\">\n <he-link-key-value [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</ng-template>\n", styles: ["table{background-color:transparent;color:#fff}table::ng-deep he-link-key-value>a:first-child,table::ng-deep he-link-key-value>a:first-child+span{display:none}\n"], components: [{ type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: ["node", "nodeType", "dataKey", "key"] }], directives: [{ type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
6146
6187
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeValueDetailsComponent, decorators: [{
6147
6188
  type: i0.Component,
6148
6189
  args: [{
@@ -7270,7 +7311,10 @@
7270
7311
  var contactUsEmail = 'community@hestia.earth';
7271
7312
  var externalLink = function (href, text) { return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>"; };
7272
7313
  var glossaryLink = function (text) { return externalLink(baseUrl() + "/glossary", text); };
7273
- var glossaryTypeLink = function (type) { return externalLink(baseUrl() + "/glossary?termType=" + type, termTypeLabel(type)); };
7314
+ var glossaryTypeLink = function (type, text) {
7315
+ if (text === void 0) { text = termTypeLabel(type); }
7316
+ return externalLink(baseUrl() + "/glossary?termType=" + type, text);
7317
+ };
7274
7318
  var termLink = function (_g) {
7275
7319
  var id = _g.id, name = _g.name;
7276
7320
  return externalLink(baseUrl() + "/term/" + id, name);
@@ -7471,6 +7515,7 @@
7471
7515
  var params = _g.params;
7472
7516
  return (errorCount === 1 ? code(params === null || params === void 0 ? void 0 : params.term.name) + " exists" : 'Some Emissions exist') + " in both the Cycle and the Transformation but " + (errorCount === 1 ? 'it is' : 'they are') + " not linked using " + code('cycle.emissions.X.transformation.term') + ". This may be an error.";
7473
7517
  },
7518
+ _g['should add an animal production system'] = function () { return "For animal production cycles, we recommend specifying the animal production " + glossaryTypeLink(schema.TermTermType.system) + " as a Practice.\n You can find a list of systems in the " + glossaryTypeLink(schema.TermTermType.system, 'Glossary') + "."; },
7474
7519
  _g);
7475
7520
  var formatCustomErrorMessage = function (message, error, errorCount) {
7476
7521
  if (errorCount === void 0) { errorCount = 1; }
@@ -9980,6 +10025,7 @@
9980
10025
  exports.calculateCycleStartDateEnabled = calculateCycleStartDateEnabled;
9981
10026
  exports.clustererImage = clustererImage;
9982
10027
  exports.code = code;
10028
+ exports.computeTerms = computeTerms;
9983
10029
  exports.coordinatesToPoint = coordinatesToPoint;
9984
10030
  exports.copyObject = copyObject;
9985
10031
  exports.countriesQuery = countriesQuery;
@@ -10014,6 +10060,8 @@
10014
10060
  exports.gitHome = gitHome;
10015
10061
  exports.gitRawBaseUrl = gitRawBaseUrl;
10016
10062
  exports.groupChanged = groupChanged;
10063
+ exports.groupLogsByModel = groupLogsByModel;
10064
+ exports.groupLogsByTerm = groupLogsByTerm;
10017
10065
  exports.handleAPIError = handleAPIError;
10018
10066
  exports.hasError = hasError;
10019
10067
  exports.hasWarning = hasWarning;
@@ -10055,6 +10103,7 @@
10055
10103
  exports.measurementValue = measurementValue;
10056
10104
  exports.missingNodeErrorMessage = missingNodeErrorMessage;
10057
10105
  exports.missingNodeErrors = missingNodeErrors;
10106
+ exports.modelCount = modelCount;
10058
10107
  exports.modelKeyParams = modelKeyParams;
10059
10108
  exports.modelParams = modelParams;
10060
10109
  exports.multiMatchQuery = multiMatchQuery;