@hestia-earth/api 0.21.11 → 0.21.13

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,4 @@
1
+ import { Aggregation } from './model';
2
+ import { IMongooseDocument } from '../../db/mongoose.model';
3
+ export interface IAggregationDocument extends Aggregation, IMongooseDocument {
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { NodeType } from '@hestia-earth/schema';
2
+ import { BaseModel } from '../../db/model.base';
3
+ import { status, pipelineStatus } from '../../files/model/model';
4
+ export declare class Aggregation extends BaseModel {
5
+ filename: string;
6
+ filepath: string;
7
+ validatedAt?: Date;
8
+ status?: status;
9
+ pipelineStatus?: pipelineStatus;
10
+ readonly nodeType: NodeType;
11
+ readonly productId: string;
12
+ readonly countryId: string;
13
+ readonly startYear: number;
14
+ readonly endYear: number;
15
+ }
16
+ export declare const parseValues: ({ filename }: Pick<Aggregation, 'filename'>) => Pick<Aggregation, 'nodeType' | 'productId' | 'countryId' | 'startYear' | 'endYear'>;
@@ -0,0 +1,42 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.parseValues = exports.Aggregation = void 0;
19
+ var schema_1 = require("@hestia-earth/schema");
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));
29
+ exports.Aggregation = Aggregation;
30
+ var parseValues = function (_a) {
31
+ var filename = _a.filename;
32
+ var _b = (0, model_1.filenameWithoutExt)(filename).split('-'), nodeType = _b[0], productId = _b[1], parts = _b.slice(2);
33
+ var endYear = +parts.pop();
34
+ return {
35
+ nodeType: Object.values(schema_1.NodeType).find(function (v) { return v.toLowerCase() === nodeType.toLowerCase(); }),
36
+ productId: productId,
37
+ countryId: parts.join('-'),
38
+ startYear: endYear - 9,
39
+ endYear: endYear
40
+ };
41
+ };
42
+ exports.parseValues = parseValues;
package/dist/models.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './api-calls/model/model';
2
+ export * from './aggregations/model/model';
2
3
  export * from './analyses/model/model';
3
4
  export * from './cycles/model/model';
4
5
  export * from './earth-engine/model/model';
package/dist/models.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./api-calls/model/model"), exports);
18
+ __exportStar(require("./aggregations/model/model"), exports);
18
19
  __exportStar(require("./analyses/model/model"), exports);
19
20
  __exportStar(require("./cycles/model/model"), exports);
20
21
  __exportStar(require("./earth-engine/model/model"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/api",
3
- "version": "0.21.11",
3
+ "version": "0.21.13",
4
4
  "description": "Hestia API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",