@hestia-earth/api 0.9.33 → 0.9.35-1

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.
@@ -0,0 +1,2 @@
1
+ import { Product } from '@hestia-earth/schema';
2
+ export declare const getPrimaryProduct: (products?: Product[]) => Product;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPrimaryProduct = void 0;
4
+ exports.getPrimaryProduct = function (products) { return (products || []).find(function (product) { return product.primary === true; }); };
@@ -1,5 +1,6 @@
1
1
  import { BaseModel } from '../../db/model.base';
2
2
  import { User } from '../../users/model/model';
3
+ export declare const mb = 1048576;
3
4
  export declare const MAX_SIZE = 2;
4
5
  export declare const MAX_SIZE_MB: number;
5
6
  export declare const sizeInMb: (size: number) => number;
@@ -20,12 +20,12 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
20
20
  return r;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.isDraft = exports.isValidated = exports.isFolderUpload = exports.isAggregation = exports.aggregationFolder = exports.isGlossary = exports.glossaryFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.replaceInvalidChars = exports.validPathChars = exports.fileToExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.HestiaExtensions = exports.SupportedExtensions = exports.sizeInMb = exports.MAX_SIZE_MB = exports.MAX_SIZE = void 0;
23
+ exports.isDraft = exports.isValidated = exports.isFolderUpload = exports.isAggregation = exports.aggregationFolder = exports.isGlossary = exports.glossaryFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.replaceInvalidChars = exports.validPathChars = exports.fileToExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.HestiaExtensions = exports.SupportedExtensions = exports.sizeInMb = exports.MAX_SIZE_MB = exports.MAX_SIZE = exports.mb = void 0;
24
24
  var model_base_1 = require("../../db/model.base");
25
- var mb = 1048576;
25
+ exports.mb = 1048576;
26
26
  exports.MAX_SIZE = 2;
27
- exports.MAX_SIZE_MB = 2 * mb;
28
- exports.sizeInMb = function (size) { return Math.round((size / mb) * 1000) / 1000; };
27
+ exports.MAX_SIZE_MB = 2 * exports.mb;
28
+ exports.sizeInMb = function (size) { return Math.round((size / exports.mb) * 1000) / 1000; };
29
29
  var SupportedExtensions;
30
30
  (function (SupportedExtensions) {
31
31
  SupportedExtensions["xlsx"] = "xlsx";
package/dist/models.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './migrations/model/model';
5
5
  export * from './nodes/model/model';
6
6
  export * from './reconciliations/model/model';
7
7
  export * from './users/model/model';
8
+ export * from './cycles/model/model';
package/dist/models.js CHANGED
@@ -17,3 +17,4 @@ __exportStar(require("./migrations/model/model"), exports);
17
17
  __exportStar(require("./nodes/model/model"), exports);
18
18
  __exportStar(require("./reconciliations/model/model"), exports);
19
19
  __exportStar(require("./users/model/model"), exports);
20
+ __exportStar(require("./cycles/model/model"), exports);
@@ -16,4 +16,4 @@ export declare const parseLogMissingLookups: (data: string) => {
16
16
  termId: any;
17
17
  column: any;
18
18
  }[];
19
- export declare const groupLogsByModel: (data: string) => any;
19
+ export declare const groupLogsByModel: (type: NodeType, data: string) => any;
@@ -96,10 +96,22 @@ exports.parseLogMissingLookups = function (data) {
96
96
  var messages = lines.map(parseMessage).filter(function (v) { return Object.keys(v).length > 1; });
97
97
  return utils_1.unique(messages.map(parseLookup));
98
98
  };
99
- exports.groupLogsByModel = function (data) {
99
+ var filterByType = function (expectedType, _a) {
100
+ var type = _a.type;
101
+ return !type ||
102
+ type === expectedType ||
103
+ Object
104
+ .values(schema_1.SchemaType)
105
+ .filter(function (t) {
106
+ return !schema_1.isTypeNode(t) &&
107
+ t !== schema_1.SchemaType.Transformation;
108
+ })
109
+ .includes(type);
110
+ };
111
+ exports.groupLogsByModel = function (type, data) {
100
112
  return data.split('\n')
101
113
  .map(parseMessage)
102
- .filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && !!(v === null || v === void 0 ? void 0 : v.model); })
114
+ .filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && !!(v === null || v === void 0 ? void 0 : v.model) && filterByType(type, v); })
103
115
  .reduce(function (group, _a) {
104
116
  var logger = _a.logger, term = _a.term, model = _a.model, key = _a.key, should_run = _a.should_run, input = _a.input, property = _a.property, log = __rest(_a, ["logger", "term", "model", "key", "should_run", "input", "property"]);
105
117
  var isOrchestrator = logger.includes('orchestrator');
@@ -10,5 +10,8 @@ export declare class Reconciliation extends BaseModel {
10
10
  name: string;
11
11
  level?: ReconciliationLevel;
12
12
  details?: any;
13
- error?: string;
13
+ error?: {
14
+ message: string;
15
+ subMessages: string[];
16
+ };
14
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/api",
3
- "version": "0.9.33",
3
+ "version": "0.9.35-1",
4
4
  "description": "Hestia API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",
@@ -33,9 +33,10 @@
33
33
  "@hestia-earth/schema": "^7.6.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@commitlint/cli": "^12.1.4",
37
- "@commitlint/config-conventional": "^12.1.4",
36
+ "@commitlint/cli": "^16.2.4",
37
+ "@commitlint/config-conventional": "^16.2.4",
38
38
  "@elastic/elasticsearch": "7.13.0",
39
+ "@hestia-earth/eslint-config": "0.0.3",
39
40
  "@hestia-earth/json-schema": "^7.6.1",
40
41
  "@hestia-earth/schema-convert": "^7.6.1",
41
42
  "@hestia-earth/schema-validation": "^7.6.1",
@@ -62,8 +63,8 @@
62
63
  "@types/request": "^2.48.8",
63
64
  "@types/request-promise-native": "^1.0.18",
64
65
  "@types/winston": "^2.4.4",
65
- "@typescript-eslint/eslint-plugin": "^4.33.0",
66
- "@typescript-eslint/parser": "^4.33.0",
66
+ "@typescript-eslint/eslint-plugin": "^5.23.0",
67
+ "@typescript-eslint/parser": "^5.23.0",
67
68
  "aws-sdk": "^2.1092.0",
68
69
  "axios": "^0.21.4",
69
70
  "body-parser": "^1.19.2",