@hestia-earth/api 0.9.25 → 0.9.26
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/nodes/model/model.js +28 -7
- package/package.json +1 -1
|
@@ -21,6 +21,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
+
r[k] = a[j];
|
|
29
|
+
return r;
|
|
30
|
+
};
|
|
24
31
|
var _a;
|
|
25
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
33
|
exports.groupLogsByModel = exports.parseLogMissingLookups = exports.paramToNodeType = exports.nodeTypeToParam = exports.pathWithState = exports.allowedDataStates = exports.dataStatesTypeMapping = exports.DataState = void 0;
|
|
@@ -68,30 +75,44 @@ var parseFilename = function (filepath) {
|
|
|
68
75
|
var ext = termTypes.includes(filename) ? model_1.SupportedExtensions.xlsx : model_1.SupportedExtensions.csv;
|
|
69
76
|
return model_1.fileToExt(filename, ext);
|
|
70
77
|
};
|
|
78
|
+
var missingLookupPrefix = 'Missing lookup';
|
|
71
79
|
exports.parseLogMissingLookups = function (data) {
|
|
72
|
-
var lines = data.split('\n').filter(function (log) { return log.includes(
|
|
80
|
+
var lines = data.split('\n').filter(function (log) { return log.includes(missingLookupPrefix); });
|
|
73
81
|
var messages = lines.map(parseMessage).filter(function (v) { return Object.keys(v).length > 1; });
|
|
74
82
|
var lookups = messages.map(function (_a) {
|
|
75
|
-
var path = _a[
|
|
83
|
+
var _b = missingLookupPrefix, path = _a[_b], termId = _a.termid, column = _a.column;
|
|
76
84
|
return JSON.stringify({ filename: parseFilename(path), termId: termId, column: column });
|
|
77
85
|
});
|
|
78
86
|
return utils_1.unique(lookups).map(function (v) { return JSON.parse(v); });
|
|
79
87
|
};
|
|
88
|
+
var addMissingLookup = function (_a) {
|
|
89
|
+
var column = _a.column, termid = _a.termid, missingLookup = _a["Missing lookup"];
|
|
90
|
+
return missingLookup ? { filename: parseFilename(missingLookup), termId: termid, column: column } : null;
|
|
91
|
+
};
|
|
80
92
|
exports.groupLogsByModel = function (data) {
|
|
81
93
|
return data.split('\n')
|
|
82
94
|
.filter(function (log) { return log.includes('hestia_earth.models'); })
|
|
83
95
|
.map(parseMessage)
|
|
84
96
|
.filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && !!(v === null || v === void 0 ? void 0 : v.model); })
|
|
85
97
|
.reduce(function (group, _a) {
|
|
86
|
-
var term = _a.term, model = _a.model, should_run = _a.should_run, log = __rest(_a, ["term", "model", "should_run"]);
|
|
98
|
+
var term = _a.term, model = _a.model, key = _a.key, should_run = _a.should_run, log = __rest(_a, ["term", "model", "key", "should_run"]);
|
|
99
|
+
var modelKey = key || model;
|
|
87
100
|
group[term] = group[term] || {};
|
|
88
|
-
group[term][
|
|
101
|
+
group[term][modelKey] = group[term][modelKey] || {};
|
|
89
102
|
if (typeof should_run !== 'undefined') {
|
|
90
|
-
group[term][
|
|
103
|
+
group[term][modelKey] = __assign(__assign(__assign({}, group[term][modelKey]), log), { shouldRun: should_run === 'True' });
|
|
91
104
|
}
|
|
92
|
-
if ('requirements' in log) {
|
|
105
|
+
else if ('requirements' in log) {
|
|
93
106
|
var requirements = log.requirements, logData = __rest(log, ["requirements"]);
|
|
94
|
-
group[term][
|
|
107
|
+
group[term][modelKey].requirements = __assign(__assign({}, (group[term][modelKey].requirements || {})), logData);
|
|
108
|
+
}
|
|
109
|
+
else if ('Missing lookup' in log) {
|
|
110
|
+
group[term][modelKey].missingLookups = __spreadArrays((group[term][modelKey].missingLookups || []), [
|
|
111
|
+
addMissingLookup(log)
|
|
112
|
+
]);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
group[term][modelKey].logs = __assign(__assign({}, (group[term][modelKey].logs || {})), log);
|
|
95
116
|
}
|
|
96
117
|
return group;
|
|
97
118
|
}, {});
|