@hestia-earth/data-api 0.0.2 → 0.0.4
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.
- package/dist/aggregated-nodes/model/index.d.ts +43 -4
- package/package.json +9 -4
- package/.prettierrc +0 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITermJSONLD, Product } from '@hestia-earth/schema';
|
|
1
|
+
import { ISourceJSONLD, ITermJSONLD, Product } from '@hestia-earth/schema';
|
|
2
2
|
export interface IFilter {
|
|
3
3
|
regions?: string[];
|
|
4
4
|
periods?: string[];
|
|
@@ -6,17 +6,36 @@ export interface IFilter {
|
|
|
6
6
|
defaultMethodClassifications?: string[];
|
|
7
7
|
practices?: string[];
|
|
8
8
|
minAggregatedQualityScore?: number;
|
|
9
|
+
measurements?: string[];
|
|
9
10
|
}
|
|
10
11
|
export declare const validFilterFields: string[];
|
|
11
|
-
export interface
|
|
12
|
-
cycleCount: number;
|
|
13
|
-
impactAssessmentCount: number;
|
|
12
|
+
export interface IFiltersBase {
|
|
14
13
|
products: string[];
|
|
15
14
|
periods: string[];
|
|
16
15
|
practices: string[];
|
|
17
16
|
minAggregatedQualityScore: number[];
|
|
18
17
|
regions: string[];
|
|
19
18
|
defaultMethodClassifications: string[];
|
|
19
|
+
measurements: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface IFiltersResponsePG extends IFiltersBase {
|
|
22
|
+
cycleCount: number;
|
|
23
|
+
impactAssessmentCount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface IFiltersResponseFieldItem<T> {
|
|
26
|
+
value: T;
|
|
27
|
+
count: number;
|
|
28
|
+
id?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface IFiltersResponse {
|
|
31
|
+
count: number;
|
|
32
|
+
products: IFiltersResponseFieldItem<string>[];
|
|
33
|
+
periods: IFiltersResponseFieldItem<string>[];
|
|
34
|
+
practices: IFiltersResponseFieldItem<string>[];
|
|
35
|
+
minAggregatedQualityScore: IFiltersResponseFieldItem<number>[];
|
|
36
|
+
regions: IFiltersResponseFieldItem<string>[];
|
|
37
|
+
defaultMethodClassifications: IFiltersResponseFieldItem<string>[];
|
|
38
|
+
measurements: IFiltersResponseFieldItem<string>[];
|
|
20
39
|
}
|
|
21
40
|
type pivotedValue = {
|
|
22
41
|
[termId: string]: {
|
|
@@ -46,6 +65,7 @@ export interface IImpactAssessmentPivoted {
|
|
|
46
65
|
'@id': string;
|
|
47
66
|
};
|
|
48
67
|
country: Pick<ITermJSONLD, '@id' | 'name'>;
|
|
68
|
+
source: Pick<ISourceJSONLD, '@id' | 'name'>;
|
|
49
69
|
startDate: string | number;
|
|
50
70
|
endDate: string | number;
|
|
51
71
|
aggregated: boolean;
|
|
@@ -54,9 +74,28 @@ export interface IImpactAssessmentPivoted {
|
|
|
54
74
|
impacts?: pivotedValue;
|
|
55
75
|
endpoints?: pivotedValue;
|
|
56
76
|
}
|
|
77
|
+
export interface ISitePivoted {
|
|
78
|
+
'@id': string;
|
|
79
|
+
name: string;
|
|
80
|
+
country?: ITermJSONLD;
|
|
81
|
+
region?: ITermJSONLD;
|
|
82
|
+
measurements?: pivotedValue;
|
|
83
|
+
}
|
|
57
84
|
export interface IAggregatedNodeRow {
|
|
58
85
|
cycle: ICyclePivoted;
|
|
59
86
|
region: Pick<ITermJSONLD, '@id' | 'name'>;
|
|
60
87
|
impactAssessments: IImpactAssessmentPivoted[];
|
|
61
88
|
}
|
|
89
|
+
type MapNullable<Type> = {
|
|
90
|
+
[Key in keyof Type]: Type[Key] | null;
|
|
91
|
+
};
|
|
92
|
+
interface IAggregatedNodesBase {
|
|
93
|
+
impactAssessments: IImpactAssessmentPivoted[];
|
|
94
|
+
cyclesByCycleId: Record<ICyclePivoted['@id'], ICyclePivoted>;
|
|
95
|
+
}
|
|
96
|
+
export type IAggregatedNodesQueryResult = MapNullable<IAggregatedNodesBase>;
|
|
97
|
+
export interface IAggregatedNodesResponse {
|
|
98
|
+
count: number;
|
|
99
|
+
results: IAggregatedNodesBase | {};
|
|
100
|
+
}
|
|
62
101
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hestia-earth/data-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Hestia Data API definitions",
|
|
5
5
|
"main": "dist/models.js",
|
|
6
6
|
"typings": "dist/models.d.ts",
|
|
@@ -36,13 +36,15 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://gitlab.com/hestia-earth/hestia-data-api#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@hestia-earth/schema": "^
|
|
39
|
+
"@hestia-earth/schema": "^23.5.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@commitlint/cli": "^17.6.5",
|
|
43
43
|
"@commitlint/config-conventional": "^17.6.5",
|
|
44
|
-
"@hestia-earth/
|
|
44
|
+
"@hestia-earth/api": "^0.22.1",
|
|
45
|
+
"@hestia-earth/eslint-config": "^0.1.0",
|
|
45
46
|
"@hestia-earth/pipeline-utils": "^0.12.1",
|
|
47
|
+
"@hestia-earth/utils": "^0.11.5",
|
|
46
48
|
"@sentry/node": "^7.51.2",
|
|
47
49
|
"@sentry/serverless": "^7.55.2",
|
|
48
50
|
"@sentry/tracing": "^7.51.2",
|
|
@@ -77,6 +79,7 @@
|
|
|
77
79
|
"http2-express-bridge": "^1.0.7",
|
|
78
80
|
"husky": "^4.3.8",
|
|
79
81
|
"lodash.chunk": "^4.2.0",
|
|
82
|
+
"lodash.isequal": "^4.5.0",
|
|
80
83
|
"lodash.uniqby": "^4.7.0",
|
|
81
84
|
"map-obj": "^5.0.2",
|
|
82
85
|
"mocha": "^10.2.0",
|
|
@@ -84,6 +87,7 @@
|
|
|
84
87
|
"nyc": "^15.1.0",
|
|
85
88
|
"pg": "^8.11.0",
|
|
86
89
|
"postgrator": "^7.1.1",
|
|
90
|
+
"prettier": "^3.0.3",
|
|
87
91
|
"rxjs": "^7.8.1",
|
|
88
92
|
"serverless": "^3.32.2",
|
|
89
93
|
"serverless-deployment-bucket": "^1.6.0",
|
|
@@ -102,5 +106,6 @@
|
|
|
102
106
|
"hooks": {
|
|
103
107
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
104
108
|
}
|
|
105
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"prettier": "@hestia-earth/eslint-config/prettier.json"
|
|
106
111
|
}
|
package/.prettierrc
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tabWidth": 2,
|
|
3
|
-
"useTabs": false,
|
|
4
|
-
"singleQuote": true,
|
|
5
|
-
"semi": true,
|
|
6
|
-
"bracketSpacing": true,
|
|
7
|
-
"arrowParens": "avoid",
|
|
8
|
-
"trailingComma": "none",
|
|
9
|
-
"bracketSameLine": true,
|
|
10
|
-
"printWidth": 120,
|
|
11
|
-
"endOfLine": "auto",
|
|
12
|
-
"htmlWhitespaceSensitivity": "ignore"
|
|
13
|
-
}
|