@hestia-earth/engine-models 0.76.1 → 0.76.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/validate-config.d.ts +14 -1
- package/dist/validate-config.js +68 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/model-links.json +3 -621
- package/package.json +1 -1
- package/search-results.json +1 -1
- package/src/validate-config.spec.ts +22 -20
- package/src/validate-config.ts +36 -1
- package/src/version.ts +1 -1
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { allowedType, IOrchestratorModelConfig } from './config';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Use inter-dependencies to detect models that are in the wrong order.
|
|
4
|
+
*
|
|
5
|
+
* @param nodeType Cycle, Site, or ImpactAssessment
|
|
6
|
+
* @returns List of models that have dependencies that could not be found prior to running.
|
|
7
|
+
*/
|
|
8
|
+
export declare const validateConfigOrder: (nodeType: allowedType) => {
|
|
3
9
|
model: IOrchestratorModelConfig;
|
|
4
10
|
existing: string[];
|
|
5
11
|
missing: string[];
|
|
6
12
|
}[];
|
|
13
|
+
/**
|
|
14
|
+
* Detect multiple models running in parallel when they should not.
|
|
15
|
+
* Note: we use the `mergeArgs` to handle special cases when multiple identical models CAN run in parallel
|
|
16
|
+
*
|
|
17
|
+
* @param nodeType Cycle, Site, or ImpactAssessment
|
|
18
|
+
*/
|
|
19
|
+
export declare const validateConfigDuplicates: (nodeType: allowedType) => IOrchestratorModelConfig[];
|
package/dist/validate-config.js
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
39
|
+
exports.validateConfigDuplicates = exports.validateConfigOrder = void 0;
|
|
4
40
|
var config_1 = require("./config");
|
|
5
41
|
var utils_1 = require("./utils");
|
|
6
42
|
// models not included in the links
|
|
@@ -46,11 +82,40 @@ var matchDependencies = function (models) { return function (model) {
|
|
|
46
82
|
})) !== null && _c !== void 0 ? _c : []
|
|
47
83
|
};
|
|
48
84
|
}; };
|
|
49
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Use inter-dependencies to detect models that are in the wrong order.
|
|
87
|
+
*
|
|
88
|
+
* @param nodeType Cycle, Site, or ImpactAssessment
|
|
89
|
+
* @returns List of models that have dependencies that could not be found prior to running.
|
|
90
|
+
*/
|
|
91
|
+
var validateConfigOrder = function (nodeType) {
|
|
50
92
|
var config = (0, config_1.loadConfig)(nodeType);
|
|
51
93
|
// flatten all models to process one by one, starting with the last one
|
|
52
94
|
var models = config.models.flat();
|
|
53
95
|
var results = models.filter(includeModel).map(matchDependencies(models));
|
|
54
96
|
return results.filter(function (r) { return r.missing.length > 0; });
|
|
55
97
|
};
|
|
56
|
-
exports.
|
|
98
|
+
exports.validateConfigOrder = validateConfigOrder;
|
|
99
|
+
var findDuplicatedConfigs = function (models) {
|
|
100
|
+
var modelsByValue = models.reduce(function (prev, curr) {
|
|
101
|
+
var _a;
|
|
102
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[curr.value] = __spreadArray(__spreadArray([], __read((prev[curr.value] || [])), false), [curr], false), _a)));
|
|
103
|
+
}, {});
|
|
104
|
+
return Object.values(modelsByValue)
|
|
105
|
+
.map(function (values) { return values.filter(function (v) { var _a; return !((_a = v.mergeArgs) === null || _a === void 0 ? void 0 : _a.sameMethodModel); }); })
|
|
106
|
+
.filter(function (values) { return values.length > 1; });
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Detect multiple models running in parallel when they should not.
|
|
110
|
+
* Note: we use the `mergeArgs` to handle special cases when multiple identical models CAN run in parallel
|
|
111
|
+
*
|
|
112
|
+
* @param nodeType Cycle, Site, or ImpactAssessment
|
|
113
|
+
*/
|
|
114
|
+
var validateConfigDuplicates = function (nodeType) {
|
|
115
|
+
var config = (0, config_1.loadConfig)(nodeType);
|
|
116
|
+
var duplicates = config.models
|
|
117
|
+
.map(function (value) { return (Array.isArray(value) ? findDuplicatedConfigs(value) : []); })
|
|
118
|
+
.flat(2);
|
|
119
|
+
return duplicates;
|
|
120
|
+
};
|
|
121
|
+
exports.validateConfigDuplicates = validateConfigDuplicates;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ENGINE_VERSION = "0.76.
|
|
1
|
+
export declare const ENGINE_VERSION = "0.76.2";
|
package/dist/version.js
CHANGED