@hestia-earth/api 0.20.8 → 0.21.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.
@@ -185,6 +185,8 @@ var replaceInvalidChars = function (value) {
185
185
  .replace(new RegExp("[^".concat(exports.validPathChars, "]"), 'g'), '')
186
186
  .replace(/\^/g, '')
187
187
  .replace(/\./g, '_')
188
+ .replace(new RegExp(Object.values(SupportedExtensions).map(function (v) { return "(_".concat(v, ")"); }).join('|'), 'g'), '')
189
+ .replace(/_$/g, '')
188
190
  : null;
189
191
  return newFilename
190
192
  ? (value === null || value === void 0 ? void 0 : value.includes('.'))
@@ -19,6 +19,7 @@ var isExtraneousError = function (error) { var _a; return (_a = (typeof error ==
19
19
  var isNotPrivateError = function (error) { return (typeof error === 'string' ? error : error === null || error === void 0 ? void 0 : error.message) === exports.notPrivateError; };
20
20
  var getType = function (node) { return (node === null || node === void 0 ? void 0 : node['@type']) || (node === null || node === void 0 ? void 0 : node.type); };
21
21
  var getId = function (node) { return (node === null || node === void 0 ? void 0 : node['@id']) || (node === null || node === void 0 ? void 0 : node.id); };
22
+ var filterByType = function (nodeType) { return function (node) { return getType(node) === nodeType; }; };
22
23
  var getErrorsFromValidationsObj = function (validations) {
23
24
  return Object.entries(validations)
24
25
  .filter(function (_a) {
@@ -47,13 +48,13 @@ var validateExpectedNodes = function (nodes) {
47
48
  };
48
49
  exports.validateExpectedNodes = validateExpectedNodes;
49
50
  var matchedProduct = function (impacts) { return function (product) {
50
- return impacts.filter(function (ia) { return getId(product.term) === getId(ia.product); }).length > 1;
51
+ return impacts.filter(function (ia) { return getId(product.term) === getId(ia.product.term); }).length > 1;
51
52
  }; };
52
53
  var validateImpactAssessmentLinks = function (nodes) {
53
54
  var _a;
54
55
  var _b, _c;
55
- var impactAssessments = nodes.filter(function (node) { return getType(node) === schema_1.NodeType.ImpactAssessment; });
56
- var cycle = nodes.find(function (node) { return getType(node) === schema_1.NodeType.Cycle; });
56
+ var impactAssessments = nodes.filter(filterByType(schema_1.NodeType.ImpactAssessment));
57
+ var cycle = nodes.find(filterByType(schema_1.NodeType.Cycle));
57
58
  var cycleId = getId(cycle);
58
59
  return getErrorsFromValidationsObj((_a = {},
59
60
  _a["Cycle ".concat(cycleId, " has no associated impact assessment")] = !impactAssessments.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/api",
3
- "version": "0.20.8",
3
+ "version": "0.21.0",
4
4
  "description": "Hestia API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",
@@ -30,8 +30,8 @@
30
30
  "author": "Guillaume Royer <guillaumeroyer.mail@gmail.com>",
31
31
  "license": "UNLICENSED",
32
32
  "dependencies": {
33
- "@hestia-earth/json-schema": ">=20.0.0",
34
- "@hestia-earth/schema": ">=20.0.0",
33
+ "@hestia-earth/json-schema": ">=21.0.0",
34
+ "@hestia-earth/schema": ">=21.0.0",
35
35
  "@hestia-earth/utils": ">=0.11.2"
36
36
  },
37
37
  "devDependencies": {
@@ -39,8 +39,8 @@
39
39
  "@commitlint/config-conventional": "^16.2.4",
40
40
  "@elastic/elasticsearch": "7.13.0",
41
41
  "@hestia-earth/eslint-config": "^0.0.5",
42
- "@hestia-earth/schema-convert": "^20.0.0",
43
- "@hestia-earth/schema-validation": "^20.0.0",
42
+ "@hestia-earth/schema-convert": "^21.0.0",
43
+ "@hestia-earth/schema-validation": "^21.0.0",
44
44
  "@mendeley/api": "^10.0.2",
45
45
  "@sentry/node": "^7.33.0",
46
46
  "@sentry/tracing": "^7.33.0",