@hestia-earth/data-api 0.0.29 → 0.0.31

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.
@@ -1,5 +1,5 @@
1
- import { ITermJSONLD, NodeType } from '@hestia-earth/schema';
2
- import { ICyclePivoted, IImpactAssessmentPivoted, IFiltersResponseFieldItem, MapNullable } from '../../models';
1
+ import { ICyclePivoted, IImpactAssessmentPivoted, ITermJSONLD, NodeType } from '@hestia-earth/schema';
2
+ import { IFiltersResponseFieldItem, MapNullable } from '../../models';
3
3
  export interface IFilterAggregated {
4
4
  regions?: string[];
5
5
  periods?: string[];
package/dist/models.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ICycleJSONLD, ISiteJSONLD, ISourceJSONLD, ITermJSONLD, Product } from '@hestia-earth/schema';
2
1
  export * from './aggregated-nodes/model';
3
2
  export * from './nodes/model';
4
3
  export interface IFiltersResponseFieldItem<T> {
@@ -6,46 +5,6 @@ export interface IFiltersResponseFieldItem<T> {
6
5
  count?: number;
7
6
  id?: string;
8
7
  }
9
- type pivotedValue = {
10
- [termId: string]: {
11
- value: number;
12
- };
13
- };
14
- export interface ICyclePivoted {
15
- '@id': string;
16
- name: string;
17
- defaultSource: Pick<ISourceJSONLD, '@id'>;
18
- site?: Pick<ISiteJSONLD, '@id'>;
19
- startDate: string | number;
20
- endDate: string | number;
21
- aggregated: boolean;
22
- inputs?: pivotedValue;
23
- products?: pivotedValue;
24
- emissions?: pivotedValue;
25
- }
26
- export interface IImpactAssessmentPivoted {
27
- '@id': string;
28
- name: string;
29
- site?: Pick<ISiteJSONLD, '@id'>;
30
- cycle?: Pick<ICycleJSONLD, '@id'>;
31
- country: Pick<ITermJSONLD, '@id' | 'name'>;
32
- source: Pick<ISourceJSONLD, '@id' | 'name'>;
33
- startDate: string | number;
34
- endDate: string | number;
35
- aggregated: boolean;
36
- product: Product;
37
- emissionsResourceUse?: pivotedValue;
38
- impacts?: pivotedValue;
39
- endpoints?: pivotedValue;
40
- }
41
- export interface ISitePivoted {
42
- '@id': string;
43
- name: string;
44
- country?: ITermJSONLD;
45
- region?: ITermJSONLD;
46
- measurements?: pivotedValue;
47
- }
48
- export type ISourcePivoted = ISourceJSONLD;
49
8
  export type MapNullable<Type> = {
50
9
  [Key in keyof Type]: Type[Key] | null;
51
10
  };
@@ -1,5 +1,5 @@
1
- import { EmissionMethodTier, ITermJSONLD, NodeType } from '@hestia-earth/schema';
2
- import { ICyclePivoted, ISourcePivoted, IFiltersResponseFieldItem, MapNullable, ISitePivoted, IImpactAssessmentPivoted } from '../../models';
1
+ import { EmissionMethodTier, ICyclePivoted, IImpactAssessmentPivoted, ISitePivoted, ISourcePivoted, ITermJSONLD, NodeType } from '@hestia-earth/schema';
2
+ import { IFiltersResponseFieldItem, MapNullable } from '../../models';
3
3
  export interface IFilter {
4
4
  regions?: string[];
5
5
  endYears?: string[];
@@ -80,3 +80,14 @@ export interface INodeIdsResponse {
80
80
  id: string;
81
81
  }[];
82
82
  }
83
+ export declare const filterResponse: ({ count, results }: INodesResponse, fields?: string) => {
84
+ count: number;
85
+ results: {
86
+ [k: string]: Pick<any, string>[] | {
87
+ [k: string]: Partial<unknown>;
88
+ };
89
+ };
90
+ } | {
91
+ count: number;
92
+ results: INodesBase;
93
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/data-api",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "Hestia Data API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",
@@ -36,16 +36,17 @@
36
36
  },
37
37
  "homepage": "https://gitlab.com/hestia-earth/hestia-data-api#readme",
38
38
  "dependencies": {
39
- "@hestia-earth/schema": ">=25.0.0"
39
+ "@hestia-earth/schema": ">=30.0.0",
40
+ "lodash.pick": "^4.0.0"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@commitlint/cli": "^17.6.5",
43
44
  "@commitlint/config-conventional": "^17.6.5",
44
45
  "@elastic/elasticsearch": "^7.13.0",
45
- "@hestia-earth/api": "^0.22.1",
46
+ "@hestia-earth/api": "^0.24.58",
46
47
  "@hestia-earth/eslint-config": "^0.1.0",
47
48
  "@hestia-earth/pipeline-utils": "^0.13.3",
48
- "@hestia-earth/utils": "^0.11.5",
49
+ "@hestia-earth/utils": "^0.13.11",
49
50
  "@sentry/node": "^7.51.2",
50
51
  "@sentry/serverless": "^7.55.2",
51
52
  "@sentry/tracing": "^7.51.2",
@@ -58,6 +59,7 @@
58
59
  "@types/express": "^4.17.6",
59
60
  "@types/lodash.chunk": "^4.2.7",
60
61
  "@types/lodash.isequal": "^4.5.8",
62
+ "@types/lodash.pick": "^4.4.9",
61
63
  "@types/lodash.uniqby": "^4.7.7",
62
64
  "@types/mocha-prepare": "^0.1.0",
63
65
  "@types/morgan": "^1.9.4",