@hestia-earth/api 0.20.0 → 0.20.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.
|
@@ -19,5 +19,5 @@ export declare const parseLogMissingLookups: (data: string) => {
|
|
|
19
19
|
}[];
|
|
20
20
|
export declare const formatForUpload: (nodes: any[], typeToId?: {
|
|
21
21
|
[type: string]: string[];
|
|
22
|
-
}) => any;
|
|
22
|
+
}, schemas?: import("@hestia-earth/json-schema").definitions) => any;
|
|
23
23
|
export declare const setPrivate: ({ source, defaultSource, ...node }: any) => any;
|
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.setPrivate = exports.formatForUpload = exports.parseLogMissingLookups = exports.paramToNodeType = exports.nodeTypeToParam = exports.pathWithState = exports.allowedDataStates = exports.dataStatesTypeMapping = exports.DataState = exports.blankNodeTypes = void 0;
|
|
27
27
|
var schema_1 = require("@hestia-earth/schema");
|
|
28
28
|
var utils_1 = require("@hestia-earth/utils");
|
|
29
|
+
var json_schema_1 = require("@hestia-earth/json-schema");
|
|
29
30
|
var model_1 = require("../../files/model/model");
|
|
30
31
|
exports.blankNodeTypes = Object.values(schema_1.SchemaType).filter(function (t) { return !(0, schema_1.isTypeNode)(t); });
|
|
31
32
|
var DataState;
|
|
@@ -102,19 +103,24 @@ var mapTypeToId = function (nodes) { return nodes.reduce(function (prev, _a) {
|
|
|
102
103
|
prev[type].push(id);
|
|
103
104
|
return prev;
|
|
104
105
|
}, {}); };
|
|
105
|
-
var formatForUpload = function (nodes, typeToId) {
|
|
106
|
+
var formatForUpload = function (nodes, typeToId, schemas) {
|
|
106
107
|
if (typeToId === void 0) { typeToId = mapTypeToId(nodes); }
|
|
108
|
+
if (schemas === void 0) { schemas = (0, json_schema_1.loadSchemas)(); }
|
|
107
109
|
return nodes.map(function (_a) {
|
|
108
110
|
var _b;
|
|
109
111
|
var type = _a["@type"], id = _a["@id"], node = __rest(_a, ['@type', '@id']);
|
|
110
112
|
return type === schema_1.NodeType.Term
|
|
111
113
|
? { '@type': type, '@id': id }
|
|
112
|
-
: (0, utils_1.reduceUndefinedValues)(__assign(__assign({}, (!id || ((_b = typeToId[type]) !== null && _b !== void 0 ? _b : []).includes(id) ? { type: type, id: id } : { '@type': type, '@id': id })), Object.fromEntries(Object.entries(node).
|
|
114
|
+
: (0, utils_1.reduceUndefinedValues)(__assign(__assign({}, (!id || ((_b = typeToId[type]) !== null && _b !== void 0 ? _b : []).includes(id) ? { type: type, id: id } : { '@type': type, '@id': id })), Object.fromEntries(Object.entries(node).filter(function (_a) {
|
|
115
|
+
var _b, _c, _d;
|
|
116
|
+
var key = _a[0];
|
|
117
|
+
return !((_d = (_c = (_b = schemas === null || schemas === void 0 ? void 0 : schemas[type]) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c[key]) === null || _d === void 0 ? void 0 : _d.internal);
|
|
118
|
+
}).map(function (_a) {
|
|
113
119
|
var key = _a[0], value = _a[1];
|
|
114
120
|
var newValue = (0, schema_1.isExpandable)(value)
|
|
115
121
|
? Array.isArray(value)
|
|
116
|
-
? (0, exports.formatForUpload)(value, typeToId)
|
|
117
|
-
: (0, exports.formatForUpload)([value], typeToId)[0]
|
|
122
|
+
? (0, exports.formatForUpload)(value, typeToId, schemas)
|
|
123
|
+
: (0, exports.formatForUpload)([value], typeToId, schemas)[0]
|
|
118
124
|
: value;
|
|
119
125
|
return [key, newValue];
|
|
120
126
|
}))), true);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseModel } from '../../db/model.base';
|
|
2
|
+
import { status, pipelineStatus } from '../../files/model/model';
|
|
2
3
|
export { getMainErrorMessage as reconciliationsGetMainErrorMessage, validateProductCorrespondence as reconciliationsValidateProductCorrespondence, validateImpactAssessmentLinks as reconciliationsValidateImpactAssessmentLinks, validateExpectedNodes as reconciliationsValidateExpectedNodes, validatePrivate as reconciliationsValidatePrivate } from './validations';
|
|
3
4
|
export declare enum ReconciliationLevel {
|
|
4
5
|
success = "success",
|
|
@@ -16,4 +17,6 @@ export declare class Reconciliation extends BaseModel {
|
|
|
16
17
|
message: string;
|
|
17
18
|
subMessages: string[];
|
|
18
19
|
};
|
|
20
|
+
readonly uploadStatus?: status;
|
|
21
|
+
readonly uploadPipelineStatus?: pipelineStatus;
|
|
19
22
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NodeType, ICycleJSONLD, JSONLD, JSON, SchemaType, ITermJSONLD, Term } from '@hestia-earth/schema';
|
|
2
|
-
|
|
3
|
-
export type Node = (INode | JSONLD<NodeType>) & {
|
|
2
|
+
export type Node = (JSONLD<NodeType> | JSON<SchemaType>) & {
|
|
4
3
|
site?: JSON<SchemaType.Site> | JSONLD<NodeType.Site>;
|
|
5
4
|
cycle?: JSON<SchemaType.Cycle> | JSONLD<NodeType.Cycle>;
|
|
6
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hestia-earth/api",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"description": "Hestia API definitions",
|
|
5
5
|
"main": "dist/models.js",
|
|
6
6
|
"typings": "dist/models.d.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"author": "Guillaume Royer <guillaumeroyer.mail@gmail.com>",
|
|
31
31
|
"license": "UNLICENSED",
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@hestia-earth/json-schema": ">=20.0.0",
|
|
33
34
|
"@hestia-earth/schema": ">=20.0.0",
|
|
34
35
|
"@hestia-earth/utils": ">=0.11.2"
|
|
35
36
|
},
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
"@commitlint/config-conventional": "^16.2.4",
|
|
39
40
|
"@elastic/elasticsearch": "7.13.0",
|
|
40
41
|
"@hestia-earth/eslint-config": "^0.0.5",
|
|
41
|
-
"@hestia-earth/json-schema": "^20.0.0",
|
|
42
42
|
"@hestia-earth/schema-convert": "^20.0.0",
|
|
43
43
|
"@hestia-earth/schema-validation": "^20.0.0",
|
|
44
44
|
"@mendeley/api": "^10.0.2",
|