@hestia-earth/api 0.9.32 → 0.9.33

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.
@@ -65,12 +65,13 @@ exports.paramToNodeType = function (type) { return Object.values(schema_1.NodeTy
65
65
  var csvValue = function (value) { return (value || '').replace('[', '').replace(']', ''); };
66
66
  var parseMessage = function (message) {
67
67
  try {
68
- return JSON.parse(message).message.split(',').reduce(function (prev, parts) {
68
+ var data = JSON.parse(message);
69
+ return data.message.split(',').reduce(function (prev, parts) {
69
70
  var _a;
70
71
  var _b = parts.split('='), key = _b[0], value = _b[1];
71
72
  var val = csvValue(value);
72
73
  return __assign(__assign({}, prev), (key && val ? (_a = {}, _a[key.trim()] = val, _a) : {}));
73
- }, {});
74
+ }, { logger: data.logger });
74
75
  }
75
76
  catch (err) {
76
77
  return {};
@@ -97,13 +98,13 @@ exports.parseLogMissingLookups = function (data) {
97
98
  };
98
99
  exports.groupLogsByModel = function (data) {
99
100
  return data.split('\n')
100
- .filter(function (log) { return log.includes('hestia_earth.models'); })
101
101
  .map(parseMessage)
102
102
  .filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && !!(v === null || v === void 0 ? void 0 : v.model); })
103
103
  .reduce(function (group, _a) {
104
- var term = _a.term, model = _a.model, key = _a.key, should_run = _a.should_run, input = _a.input, property = _a.property, log = __rest(_a, ["term", "model", "key", "should_run", "input", "property"]);
105
- var modelKey = key || model;
106
- var isKey = !!key;
104
+ var logger = _a.logger, term = _a.term, model = _a.model, key = _a.key, should_run = _a.should_run, input = _a.input, property = _a.property, log = __rest(_a, ["logger", "term", "model", "key", "should_run", "input", "property"]);
105
+ var isOrchestrator = logger.includes('orchestrator');
106
+ var modelKey = isOrchestrator ? model : key || model;
107
+ var isKey = !isOrchestrator && !!key;
107
108
  group[term] = group[term] || {};
108
109
  group[term][modelKey] = group[term][modelKey] || __assign({ isKey: isKey }, (isKey ? { model: model } : {}));
109
110
  if (typeof input !== 'undefined') {
@@ -117,7 +118,11 @@ exports.groupLogsByModel = function (data) {
117
118
  ]));
118
119
  }
119
120
  if (typeof should_run !== 'undefined') {
120
- group[term][modelKey] = __assign(__assign(__assign({}, group[term][modelKey]), log), { shouldRun: should_run === 'True' });
121
+ var shouldRun = should_run === 'True';
122
+ group[term][modelKey] = isOrchestrator ?
123
+ {
124
+ shouldRunOrchestrator: shouldRun
125
+ } : __assign(__assign(__assign({}, group[term][modelKey]), log), { shouldRun: shouldRun });
121
126
  }
122
127
  else if ('requirements' in log) {
123
128
  var requirements = log.requirements, logData = __rest(log, ["requirements"]);
@@ -128,7 +133,7 @@ exports.groupLogsByModel = function (data) {
128
133
  parseLookup(log)
129
134
  ]));
130
135
  }
131
- else {
136
+ else if (!isOrchestrator) {
132
137
  group[term][modelKey].logs = __assign(__assign({}, (group[term][modelKey].logs || {})), log);
133
138
  }
134
139
  return group;
@@ -1,6 +1,14 @@
1
1
  import { BaseModel } from '../../db/model.base';
2
+ export declare enum ReconciliationLevel {
3
+ success = "success",
4
+ warning = "warning",
5
+ danger = "danger"
6
+ }
2
7
  export declare class Reconciliation extends BaseModel {
3
8
  idExpected: string;
4
9
  idRecalculated: string;
5
10
  name: string;
11
+ level?: ReconciliationLevel;
12
+ details?: any;
13
+ error?: string;
6
14
  }
@@ -13,8 +13,14 @@ var __extends = (this && this.__extends) || (function () {
13
13
  };
14
14
  })();
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Reconciliation = void 0;
16
+ exports.Reconciliation = exports.ReconciliationLevel = void 0;
17
17
  var model_base_1 = require("../../db/model.base");
18
+ var ReconciliationLevel;
19
+ (function (ReconciliationLevel) {
20
+ ReconciliationLevel["success"] = "success";
21
+ ReconciliationLevel["warning"] = "warning";
22
+ ReconciliationLevel["danger"] = "danger";
23
+ })(ReconciliationLevel = exports.ReconciliationLevel || (exports.ReconciliationLevel = {}));
18
24
  var Reconciliation = (function (_super) {
19
25
  __extends(Reconciliation, _super);
20
26
  function Reconciliation() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/api",
3
- "version": "0.9.32",
3
+ "version": "0.9.33",
4
4
  "description": "Hestia API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",