@hestia-earth/api 0.11.2 → 0.12.0

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.
@@ -135,7 +135,9 @@ exports.fileToExt = function (path, extension) {
135
135
  exports.validPathChars = 'A-Za-z\\d.\\-_';
136
136
  exports.replaceInvalidChars = function (value) {
137
137
  return value
138
+ .replace(/\s/g, '_')
138
139
  .replace(new RegExp("[^" + exports.validPathChars + "]", 'g'), '')
140
+ .replace(new RegExp("(\\.)[^(" + Object.values(SupportedExtensions).map(function (v) { return "." + v; }).join('|') + ")]", 'g'), function (v) { return v.replace('.', '_'); })
139
141
  .replace(/\^/g, '');
140
142
  };
141
143
  exports.folderFromPath = function (path) {
@@ -9,7 +9,7 @@ export declare const dataStatesTypeMapping: {
9
9
  [state in DataState]: (SchemaType | NodeType)[];
10
10
  };
11
11
  export declare const allowedDataStates: (type: SchemaType | NodeType) => DataState[];
12
- export declare const pathWithState: (type: SchemaType | NodeType, id: string, dataState?: DataState) => string;
12
+ export declare const pathWithState: (type: SchemaType | NodeType, id: string, dataState?: DataState, strictDataState?: boolean) => string;
13
13
  export declare const nodeTypeToParam: (type: NodeType) => string;
14
14
  export declare const paramToNodeType: (type: string) => NodeType;
15
15
  export declare const parseLogMissingLookups: (data: string) => {
@@ -53,13 +53,14 @@ exports.dataStatesTypeMapping = (_a = {},
53
53
  exports.allowedDataStates = function (type) {
54
54
  return Object.values(DataState).filter(function (dataState) { return exports.dataStatesTypeMapping[dataState].includes(type); });
55
55
  };
56
- exports.pathWithState = function (type, id, dataState) {
56
+ exports.pathWithState = function (type, id, dataState, strictDataState) {
57
57
  if (dataState === void 0) { dataState = DataState.original; }
58
+ if (strictDataState === void 0) { strictDataState = false; }
58
59
  var state = exports.dataStatesTypeMapping[dataState].includes(type) ? dataState : null;
59
- return [
60
+ return (state !== null || !strictDataState) ? [
60
61
  state === DataState.original ? null : state,
61
62
  schema_1.jsonldPath(type, id)
62
- ].filter(Boolean).join('/');
63
+ ].filter(Boolean).join('/') : null;
63
64
  };
64
65
  exports.nodeTypeToParam = function (type) { return (type || '').toLowerCase() + "s"; };
65
66
  exports.paramToNodeType = function (type) { return Object.values(schema_1.NodeType).find(function (v) { return exports.nodeTypeToParam(v) === type; }); };
@@ -165,7 +166,6 @@ var groupLogSubValue = function (group, log, key) {
165
166
  return group;
166
167
  };
167
168
  var subValues = [
168
- 'input',
169
169
  'property',
170
170
  'transformation'
171
171
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/api",
3
- "version": "0.11.2",
3
+ "version": "0.12.0",
4
4
  "description": "Hestia API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",
@@ -30,16 +30,16 @@
30
30
  "author": "Guillaume Royer <guillaumeroyer.mail@gmail.com>",
31
31
  "license": "UNLICENSED",
32
32
  "dependencies": {
33
- "@hestia-earth/schema": "^8.0.0"
33
+ "@hestia-earth/schema": "^9.0.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@commitlint/cli": "^16.2.4",
37
37
  "@commitlint/config-conventional": "^16.2.4",
38
38
  "@elastic/elasticsearch": "7.13.0",
39
39
  "@hestia-earth/eslint-config": "0.0.3",
40
- "@hestia-earth/json-schema": "^8.0.0",
41
- "@hestia-earth/schema-convert": "^8.0.0",
42
- "@hestia-earth/schema-validation": "^8.0.0",
40
+ "@hestia-earth/json-schema": "^9.0.0",
41
+ "@hestia-earth/schema-convert": "^9.0.0",
42
+ "@hestia-earth/schema-validation": "^9.0.0",
43
43
  "@hestia-earth/utils": "^0.10.20",
44
44
  "@mendeley/api": "^10.0.2",
45
45
  "@sentry/node": "^6.18.2",