@hestia-earth/api 0.9.20 → 0.9.24
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.d.ts +2 -0
- package/dist/nodes/model/model.js +66 -1
- package/package.json +12 -12
|
@@ -11,3 +11,5 @@ export declare const allowedDataStates: (type: SchemaType | NodeType) => DataSta
|
|
|
11
11
|
export declare const pathWithState: (type: SchemaType | NodeType, id: string, dataState?: DataState) => string;
|
|
12
12
|
export declare const nodeTypeToParam: (type: NodeType) => string;
|
|
13
13
|
export declare const paramToNodeType: (type: string) => NodeType;
|
|
14
|
+
export declare const parseLogMissingLookups: (data: string) => any[];
|
|
15
|
+
export declare const groupLogsByModel: (data: string) => any;
|
|
@@ -1,8 +1,32 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
var _a;
|
|
3
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.paramToNodeType = exports.nodeTypeToParam = exports.pathWithState = exports.allowedDataStates = exports.dataStatesTypeMapping = exports.DataState = void 0;
|
|
26
|
+
exports.groupLogsByModel = exports.parseLogMissingLookups = exports.paramToNodeType = exports.nodeTypeToParam = exports.pathWithState = exports.allowedDataStates = exports.dataStatesTypeMapping = exports.DataState = void 0;
|
|
5
27
|
var schema_1 = require("@hestia-earth/schema");
|
|
28
|
+
var utils_1 = require("@hestia-earth/utils");
|
|
29
|
+
var model_1 = require("../../files/model/model");
|
|
6
30
|
var DataState;
|
|
7
31
|
(function (DataState) {
|
|
8
32
|
DataState["original"] = "original";
|
|
@@ -31,3 +55,44 @@ exports.pathWithState = function (type, id, dataState) {
|
|
|
31
55
|
};
|
|
32
56
|
exports.nodeTypeToParam = function (type) { return (type || '').toLowerCase() + "s"; };
|
|
33
57
|
exports.paramToNodeType = function (type) { return Object.values(schema_1.NodeType).find(function (v) { return exports.nodeTypeToParam(v) === type; }); };
|
|
58
|
+
var csvValue = function (value) { return (value || '').replace('[', '').replace(']', ''); };
|
|
59
|
+
var parseMessage = function (message) { return JSON.parse(message).message.split(',').reduce(function (prev, parts) {
|
|
60
|
+
var _a;
|
|
61
|
+
var _b = parts.split('='), key = _b[0], value = _b[1];
|
|
62
|
+
var val = csvValue(value);
|
|
63
|
+
return __assign(__assign({}, prev), (key && val ? (_a = {}, _a[key.trim()] = val, _a) : {}));
|
|
64
|
+
}, {}); };
|
|
65
|
+
var termTypes = Object.values(schema_1.TermTermType);
|
|
66
|
+
var parseFilename = function (filepath) {
|
|
67
|
+
var filename = filepath.split('.')[0];
|
|
68
|
+
var ext = termTypes.includes(filename) ? model_1.SupportedExtensions.xlsx : model_1.SupportedExtensions.csv;
|
|
69
|
+
return model_1.fileToExt(filename, ext);
|
|
70
|
+
};
|
|
71
|
+
exports.parseLogMissingLookups = function (data) {
|
|
72
|
+
var lines = data.split('\n').filter(function (log) { return log.includes('Missing lookup'); });
|
|
73
|
+
var messages = lines.map(parseMessage).filter(function (v) { return Object.keys(v).length > 1; });
|
|
74
|
+
var lookups = messages.map(function (_a) {
|
|
75
|
+
var path = _a["Missing lookup"], termId = _a.termid, column = _a.column;
|
|
76
|
+
return JSON.stringify({ filename: parseFilename(path), termId: termId, column: column });
|
|
77
|
+
});
|
|
78
|
+
return utils_1.unique(lookups).map(function (v) { return JSON.parse(v); });
|
|
79
|
+
};
|
|
80
|
+
exports.groupLogsByModel = function (data) {
|
|
81
|
+
return data.split('\n')
|
|
82
|
+
.filter(function (log) { return log.includes('hestia_earth.models'); })
|
|
83
|
+
.map(parseMessage)
|
|
84
|
+
.filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && !!(v === null || v === void 0 ? void 0 : v.model); })
|
|
85
|
+
.reduce(function (group, _a) {
|
|
86
|
+
var term = _a.term, model = _a.model, log = __rest(_a, ["term", "model"]);
|
|
87
|
+
group[term] = group[term] || {};
|
|
88
|
+
group[term][model] = group[term][model] || {};
|
|
89
|
+
if ('should_run' in log) {
|
|
90
|
+
group[term][model].shouldRun = log.should_run === 'True';
|
|
91
|
+
}
|
|
92
|
+
if ('requirements' in log) {
|
|
93
|
+
var requirements = log.requirements, logData = __rest(log, ["requirements"]);
|
|
94
|
+
group[term][model].requirements = logData;
|
|
95
|
+
}
|
|
96
|
+
return group;
|
|
97
|
+
}, {});
|
|
98
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hestia-earth/api",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.24",
|
|
4
4
|
"description": "Hestia API definitions",
|
|
5
5
|
"main": "dist/models.js",
|
|
6
6
|
"typings": "dist/models.d.ts",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"author": "Guillaume Royer <guillaumeroyer.mail@gmail.com>",
|
|
30
30
|
"license": "UNLICENSED",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@hestia-earth/schema": "^
|
|
32
|
+
"@hestia-earth/schema": "^7.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@commitlint/cli": "^12.1.4",
|
|
36
36
|
"@commitlint/config-conventional": "^12.1.4",
|
|
37
37
|
"@elastic/elasticsearch": "7.13.0",
|
|
38
|
-
"@hestia-earth/schema-convert": "^
|
|
39
|
-
"@hestia-earth/schema-validation": "^
|
|
38
|
+
"@hestia-earth/schema-convert": "^7.0.0",
|
|
39
|
+
"@hestia-earth/schema-validation": "^7.0.0",
|
|
40
40
|
"@hestia-earth/utils": "^0.10.3",
|
|
41
41
|
"@mendeley/api": "^10.0.2",
|
|
42
42
|
"@sentry/node": "^6.16.1",
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@types/mongoose": "^5.11.97",
|
|
56
56
|
"@types/morgan": "^1.9.3",
|
|
57
57
|
"@types/multer": "^1.4.7",
|
|
58
|
-
"@types/node": "^14.18.
|
|
58
|
+
"@types/node": "^14.18.7",
|
|
59
59
|
"@types/orientjs": "^3.0.12",
|
|
60
|
-
"@types/request": "^2.48.
|
|
60
|
+
"@types/request": "^2.48.8",
|
|
61
61
|
"@types/request-promise-native": "^1.0.18",
|
|
62
62
|
"@types/winston": "^2.4.4",
|
|
63
63
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
64
64
|
"@typescript-eslint/parser": "^4.33.0",
|
|
65
|
-
"aws-sdk": "^2.
|
|
65
|
+
"aws-sdk": "^2.1058.0",
|
|
66
66
|
"axios": "^0.21.4",
|
|
67
67
|
"body-parser": "^1.19.1",
|
|
68
68
|
"capitalize": "^2.0.4",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"dotenv": "^6.0.0",
|
|
73
73
|
"eslint": "^7.32.0",
|
|
74
74
|
"eslint-plugin-jsdoc": "^25.4.3",
|
|
75
|
-
"express": "^4.17.
|
|
75
|
+
"express": "^4.17.2",
|
|
76
76
|
"express-recaptcha": "^5.0.2",
|
|
77
77
|
"express-redis-cache": "^1.1.3",
|
|
78
78
|
"express-session": "^1.17.2",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"lodash.get": "^4.4.2",
|
|
82
82
|
"lodash.orderby": "^4.6.0",
|
|
83
83
|
"lodash.pick": "^4.4.0",
|
|
84
|
-
"mocha": "^9.1.
|
|
84
|
+
"mocha": "^9.1.4",
|
|
85
85
|
"mocha-prepare": "^0.1.0",
|
|
86
|
-
"mongoose": "^5.13.
|
|
86
|
+
"mongoose": "^5.13.14",
|
|
87
87
|
"mongoose-bcrypt": "^1.9.0",
|
|
88
88
|
"morgan": "^1.10.0",
|
|
89
89
|
"multer": "^1.4.4",
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"supertest": "^3.4.2",
|
|
105
105
|
"swagger-jsdoc": "^4.3.2",
|
|
106
106
|
"swagger-ui-dist": "^4.1.3",
|
|
107
|
-
"swagger-ui-express": "^4.
|
|
107
|
+
"swagger-ui-express": "^4.3.0",
|
|
108
108
|
"ts-node": "^8.10.2",
|
|
109
109
|
"typescript": "^3.9.10",
|
|
110
110
|
"uid-generator": "^2.0.0",
|
|
111
|
-
"winston": "^3.
|
|
111
|
+
"winston": "^3.4.0"
|
|
112
112
|
},
|
|
113
113
|
"husky": {
|
|
114
114
|
"hooks": {
|