@hestia-earth/api 0.25.46 → 0.25.47

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.
@@ -21,4 +21,4 @@ export declare class Aggregation extends BaseModel {
21
21
  }
22
22
  export declare const defaultAggregationPeriod = 20;
23
23
  export declare const aggregationFolderFromFilename: (filename: string) => string;
24
- export declare const parseAggregationValues: (value: string) => Pick<Aggregation, 'productId' | 'countryId' | 'startYear' | 'endYear'>;
24
+ export declare const parseAggregationValues: (value: string) => Pick<Aggregation, "productId" | "countryId" | "startYear" | "endYear">;
@@ -1,51 +1,42 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.parseAggregationValues = exports.aggregationFolderFromFilename = exports.defaultAggregationPeriod = exports.Aggregation = void 0;
19
- var utils_1 = require("@hestia-earth/utils");
20
- var model_base_1 = require("../../db/model.base");
21
- var model_1 = require("../../files/model/model");
22
- var Aggregation = (function (_super) {
23
- __extends(Aggregation, _super);
24
- function Aggregation() {
25
- return _super !== null && _super.apply(this, arguments) || this;
26
- }
27
- return Aggregation;
28
- }(model_base_1.BaseModel));
4
+ const utils_1 = require("@hestia-earth/utils");
5
+ const model_base_1 = require("../../db/model.base");
6
+ const model_1 = require("../../files/model/model");
7
+ class Aggregation extends model_base_1.BaseModel {
8
+ folder;
9
+ filename;
10
+ filepath;
11
+ validatedAt;
12
+ status;
13
+ pipelineStatus;
14
+ metadata;
15
+ productId;
16
+ countryId;
17
+ startYear;
18
+ endYear;
19
+ }
29
20
  exports.Aggregation = Aggregation;
30
21
  exports.defaultAggregationPeriod = 20;
31
- var aggregationFolderFromFilename = function (filename) {
32
- var name = (0, model_1.filenameWithoutExt)(filename);
33
- var parts = name.split('-');
34
- var timestamp = parts.pop();
22
+ const aggregationFolderFromFilename = (filename) => {
23
+ const name = (0, model_1.filenameWithoutExt)(filename);
24
+ const parts = name.split('-');
25
+ const timestamp = parts.pop();
35
26
  return timestamp.length === 8 ? parts.join('-') : name;
36
27
  };
37
28
  exports.aggregationFolderFromFilename = aggregationFolderFromFilename;
38
- var parseAggregationValues = function (value) {
39
- var _a = (0, exports.aggregationFolderFromFilename)(value).split('-'), productId = _a[0], parts = _a.slice(1);
40
- var countryId = parts.filter(function (v) { return !(0, utils_1.isNumber)(v); }).join('-');
41
- var endYear = +parts.pop();
42
- var lastPart = parts.pop();
43
- var startYear = (0, utils_1.isNumber)(lastPart) ? +lastPart : endYear - exports.defaultAggregationPeriod + 1;
29
+ const parseAggregationValues = (value) => {
30
+ const [productId, ...parts] = (0, exports.aggregationFolderFromFilename)(value).split('-');
31
+ const countryId = parts.filter(v => !(0, utils_1.isNumber)(v)).join('-');
32
+ const endYear = +parts.pop();
33
+ const lastPart = parts.pop();
34
+ const startYear = (0, utils_1.isNumber)(lastPart) ? +lastPart : endYear - exports.defaultAggregationPeriod + 1;
44
35
  return {
45
- productId: productId,
46
- countryId: countryId,
47
- startYear: startYear,
48
- endYear: endYear
36
+ productId,
37
+ countryId,
38
+ startYear,
39
+ endYear
49
40
  };
50
41
  };
51
42
  exports.parseAggregationValues = parseAggregationValues;
@@ -1,33 +1,20 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.Analysis = exports.AnalysisType = void 0;
19
- var model_base_1 = require("../../db/model.base");
4
+ const model_base_1 = require("../../db/model.base");
20
5
  var AnalysisType;
21
6
  (function (AnalysisType) {
22
7
  AnalysisType["gapFilling"] = "gap-filling";
23
8
  AnalysisType["quantity"] = "quantity";
24
9
  AnalysisType["term"] = "term";
25
- })(AnalysisType = exports.AnalysisType || (exports.AnalysisType = {}));
26
- var Analysis = (function (_super) {
27
- __extends(Analysis, _super);
28
- function Analysis() {
29
- return _super !== null && _super.apply(this, arguments) || this;
30
- }
31
- return Analysis;
32
- }(model_base_1.BaseModel));
10
+ })(AnalysisType || (exports.AnalysisType = AnalysisType = {}));
11
+ class Analysis extends model_base_1.BaseModel {
12
+ cycleId;
13
+ name;
14
+ indicators;
15
+ cycle;
16
+ impactAssessment;
17
+ quantity;
18
+ term;
19
+ }
33
20
  exports.Analysis = Analysis;
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.ApiCall = void 0;
19
- var model_base_1 = require("../../db/model.base");
20
- var ApiCall = (function (_super) {
21
- __extends(ApiCall, _super);
22
- function ApiCall() {
23
- return _super !== null && _super.apply(this, arguments) || this;
24
- }
25
- return ApiCall;
26
- }(model_base_1.BaseModel));
4
+ const model_base_1 = require("../../db/model.base");
5
+ class ApiCall extends model_base_1.BaseModel {
6
+ url;
7
+ user;
8
+ duration;
9
+ }
27
10
  exports.ApiCall = ApiCall;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPrimaryProduct = void 0;
4
- var getPrimaryProduct = function (products) { return (products || []).find(function (product) { return product.primary === true; }); };
4
+ const getPrimaryProduct = (products) => (products || []).find(product => product.primary === true);
5
5
  exports.getPrimaryProduct = getPrimaryProduct;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseModel = void 0;
4
- var BaseModel = (function () {
5
- function BaseModel() {
6
- }
7
- return BaseModel;
8
- }());
4
+ class BaseModel {
5
+ id;
6
+ createdAt;
7
+ updatedAt;
8
+ }
9
9
  exports.BaseModel = BaseModel;
@@ -6,9 +6,9 @@ var EarthEngineCallType;
6
6
  EarthEngineCallType["boundary"] = "boundary";
7
7
  EarthEngineCallType["coordinates"] = "coordinates";
8
8
  EarthEngineCallType["gadm"] = "gadm";
9
- })(EarthEngineCallType = exports.EarthEngineCallType || (exports.EarthEngineCallType = {}));
9
+ })(EarthEngineCallType || (exports.EarthEngineCallType = EarthEngineCallType = {}));
10
10
  var EarthEngineType;
11
11
  (function (EarthEngineType) {
12
12
  EarthEngineType["raster"] = "raster";
13
13
  EarthEngineType["vector"] = "vector";
14
- })(EarthEngineType = exports.EarthEngineType || (exports.EarthEngineType = {}));
14
+ })(EarthEngineType || (exports.EarthEngineType = EarthEngineType = {}));
@@ -191,7 +191,7 @@ export declare const isAuthorized: ({ authorizedUsers }: Partial<File>, user: Us
191
191
  export declare const isAssigned: ({ assignedUsers }: Partial<File>, user: User) => boolean;
192
192
  export declare const canRemove: (file: Partial<File>, user: User) => boolean;
193
193
  export declare const validatedStatuses: FileStatus[];
194
- export declare const canValidate: ({ status, isPrivate, archived }: Partial<File>, user: Pick<User, 'role'>) => boolean;
194
+ export declare const canValidate: ({ status, isPrivate, archived }: Partial<File>, user: Pick<User, "role">) => boolean;
195
195
  export declare const isValidated: ({ validatedAt, status }: Partial<File>) => boolean;
196
196
  export declare const canSubmit: (file: Partial<File>, user: User) => boolean;
197
197
  export declare const isDraft: ({ filepath, filename }: Partial<File>) => boolean;