@powercalc/power-router 1.0.39 → 1.0.42
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/README.md +6 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +26 -26
- package/dist/config/countrydata.json +265 -265
- package/dist/converter.d.ts +8 -8
- package/dist/converter.js +56 -59
- package/dist/converter.js.map +1 -1
- package/dist/genTypes.d.ts +4 -4
- package/dist/genTypes.js +53 -53
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/load.d.ts +7 -7
- package/dist/load.js +31 -31
- package/dist/router/config/countries.json +194 -0
- package/dist/router/config/countrydata.json +266 -0
- package/dist/router/config/types.json +333 -0
- package/dist/router/controllers/LoadAndParse.d.ts +10 -10
- package/dist/router/controllers/LoadAndParse.js +57 -57
- package/dist/router/controllers/Router.d.ts +7 -7
- package/dist/router/controllers/Router.js +105 -105
- package/dist/router/index.d.ts +2 -2
- package/dist/router/index.js +5 -5
- package/dist/router/interfaces/config.d.ts +5 -5
- package/dist/router/interfaces/config.js +2 -2
- package/dist/router/interfaces/entsoe.d.ts +50 -50
- package/dist/router/interfaces/entsoe.js +2 -2
- package/dist/router/interfaces/queryoptions.d.ts +15 -15
- package/dist/router/interfaces/queryoptions.js +15 -15
- package/dist/router/interfaces/types.d.ts +12 -12
- package/dist/router/interfaces/types.js +2 -2
- package/dist/router/services/CommonTimestamps.d.ts +15 -15
- package/dist/router/services/CommonTimestamps.js +185 -173
- package/dist/router/services/CommonTimestamps.js.map +1 -1
- package/dist/router/services/Eurostat.d.ts +10 -10
- package/dist/router/services/Eurostat.js +72 -72
- package/dist/router/services/Eurostat.js.map +1 -1
- package/dist/router/services/LoadService.d.ts +27 -27
- package/dist/router/services/LoadService.js +82 -82
- package/dist/router/services/Loader.d.ts +38 -38
- package/dist/router/services/Loader.js +119 -121
- package/dist/router/services/Loader.js.map +1 -1
- package/dist/router/services/ParseEdifact.d.ts +28 -28
- package/dist/router/services/ParseEdifact.js +159 -159
- package/dist/router/services/ParseInstalled.d.ts +9 -9
- package/dist/router/services/ParseInstalled.js +45 -45
- package/dist/router/services/batch/maxHydrofill.d.ts +10 -10
- package/dist/router/services/batch/maxHydrofill.js +65 -65
- package/package.json +53 -53
- package/src/converter.ts +61 -64
- package/src/router/config/countrydata.json +265 -265
- package/src/router/services/CommonTimestamps.ts +90 -54
- package/src/router/services/Eurostat.ts +3 -3
- package/src/router/services/Loader.ts +2 -5
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@powercalc/power-router",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"v": "node -v",
|
|
10
|
-
"build2": "tsc -p tsconfig.build.json && npm run copy2",
|
|
11
|
-
"build": "tsc && npm run copy2",
|
|
12
|
-
"xy": "tsc && node dist/index.js",
|
|
13
|
-
"hydro": "npm run copy && tsc && node dist/services/batch/maxHydrofill.js",
|
|
14
|
-
"stat": "npm run copy && tsc && node dist/services/Eurostat.js",
|
|
15
|
-
"start": "npm run build2 && node dist/app.js",
|
|
16
|
-
"pup": "tsc && node dist/pup.js",
|
|
17
|
-
"start:debug": "npm run copy && tsc && node dist/app.js >log-file.txt 2>error-file.txt",
|
|
18
|
-
"copy": "cp -r src/router/config dist-build/router",
|
|
19
|
-
"copy2": "cp -r src/router/config dist",
|
|
20
|
-
"lint": "eslint src"
|
|
21
|
-
},
|
|
22
|
-
"author": "",
|
|
23
|
-
"license": "ISC",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"cors": "2.8.5",
|
|
26
|
-
"date-fns": "^2.29.3",
|
|
27
|
-
"express": "^4.18.2",
|
|
28
|
-
"gzip": "^0.1.0",
|
|
29
|
-
"luxon": "^3.3.0",
|
|
30
|
-
"node": "19.8.1",
|
|
31
|
-
"reflect-metadata": "^0.1.13",
|
|
32
|
-
"rxjs": "^7.8.0",
|
|
33
|
-
"tsc-hooks": "^1.1.2",
|
|
34
|
-
"tsyringe": "4.3.0",
|
|
35
|
-
"xml2js": "^0.4.23"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@types/cors": "2.8.13",
|
|
39
|
-
"@types/express": "^4.17.17",
|
|
40
|
-
"@types/luxon": "^3.2.0",
|
|
41
|
-
"@types/node": "^18.15.3",
|
|
42
|
-
"@types/xml2js": "^0.4.11",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "5.59.6",
|
|
44
|
-
"@typescript-eslint/parser": "5.59.6",
|
|
45
|
-
"eslint": "8.40.0",
|
|
46
|
-
"typescript": "4.9.5"
|
|
47
|
-
},
|
|
48
|
-
"files": [
|
|
49
|
-
"dist/**/*",
|
|
50
|
-
"src/**/*",
|
|
51
|
-
"!**/*.test.js"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@powercalc/power-router",
|
|
3
|
+
"version": "1.0.42",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"v": "node -v",
|
|
10
|
+
"build2": "tsc -p tsconfig.build.json && npm run copy2",
|
|
11
|
+
"build": "tsc && npm run copy2",
|
|
12
|
+
"xy": "tsc && node dist/index.js",
|
|
13
|
+
"hydro": "npm run copy && tsc && node dist/services/batch/maxHydrofill.js",
|
|
14
|
+
"stat": "npm run copy && tsc && node dist/services/Eurostat.js",
|
|
15
|
+
"start": "npm run build2 && node dist/app.js",
|
|
16
|
+
"pup": "tsc && node dist/pup.js",
|
|
17
|
+
"start:debug": "npm run copy && tsc && node dist/app.js >log-file.txt 2>error-file.txt",
|
|
18
|
+
"copy": "cp -r src/router/config dist-build/router",
|
|
19
|
+
"copy2": "cp -r src/router/config dist/router",
|
|
20
|
+
"lint": "eslint src"
|
|
21
|
+
},
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"cors": "2.8.5",
|
|
26
|
+
"date-fns": "^2.29.3",
|
|
27
|
+
"express": "^4.18.2",
|
|
28
|
+
"gzip": "^0.1.0",
|
|
29
|
+
"luxon": "^3.3.0",
|
|
30
|
+
"node": "19.8.1",
|
|
31
|
+
"reflect-metadata": "^0.1.13",
|
|
32
|
+
"rxjs": "^7.8.0",
|
|
33
|
+
"tsc-hooks": "^1.1.2",
|
|
34
|
+
"tsyringe": "4.3.0",
|
|
35
|
+
"xml2js": "^0.4.23"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/cors": "2.8.13",
|
|
39
|
+
"@types/express": "^4.17.17",
|
|
40
|
+
"@types/luxon": "^3.2.0",
|
|
41
|
+
"@types/node": "^18.15.3",
|
|
42
|
+
"@types/xml2js": "^0.4.11",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "5.59.6",
|
|
44
|
+
"@typescript-eslint/parser": "5.59.6",
|
|
45
|
+
"eslint": "8.40.0",
|
|
46
|
+
"typescript": "4.9.5"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist/**/*",
|
|
50
|
+
"src/**/*",
|
|
51
|
+
"!**/*.test.js"
|
|
52
|
+
]
|
|
53
|
+
}
|
package/src/converter.ts
CHANGED
|
@@ -1,64 +1,61 @@
|
|
|
1
|
-
import { GenTypes } from "./genTypes";
|
|
2
|
-
import { Hydrofill } from "./router/services/batch/maxHydrofill";
|
|
3
|
-
import { writeFile } from 'node:fs/promises';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export class Convert {
|
|
7
|
-
static async start() {
|
|
8
|
-
const countries = await this.getCountries()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Convert.start();
|
|
1
|
+
import { GenTypes } from "./genTypes";
|
|
2
|
+
import { Hydrofill } from "./router/services/batch/maxHydrofill";
|
|
3
|
+
import { writeFile } from 'node:fs/promises';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class Convert {
|
|
7
|
+
static async start() {
|
|
8
|
+
const countries = await this.getCountries()
|
|
9
|
+
for (const country of countries) {
|
|
10
|
+
const types = await GenTypes.getTypes(country.code);
|
|
11
|
+
country.types = types;
|
|
12
|
+
const h = await Hydrofill.getMaxHydrofill(country.code)
|
|
13
|
+
if (h.max) {
|
|
14
|
+
const GW = Math.round(h.max / 1000) + ' GW'
|
|
15
|
+
country.hydrofill = {
|
|
16
|
+
min: h.min,
|
|
17
|
+
max: h.max
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const gen = await this.getGeneration(country.code)
|
|
21
|
+
const load = await this.getLoad(country.code)
|
|
22
|
+
const price = await this.getPrice(country.code)
|
|
23
|
+
const hydrofill = await this.getHydrofill(country.code)
|
|
24
|
+
}
|
|
25
|
+
console.log(countries);
|
|
26
|
+
writeFile('data/countrydata.json', JSON.stringify(countries, null, 2), 'utf-8')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async getCountries() {
|
|
30
|
+
const url = 'https://powercalculator.eu/entsoe/datalists/countries';
|
|
31
|
+
const response = await fetch(url);
|
|
32
|
+
return await response.json()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static async getGeneration(countryCode: string) {
|
|
36
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/generation?year=2021&month=9`;
|
|
37
|
+
const response = await fetch(url);
|
|
38
|
+
return await response.json()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static async getLoad(countryCode: string) {
|
|
42
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/load?year=2021&month=9`;
|
|
43
|
+
const response = await fetch(url);
|
|
44
|
+
return await response.json()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static async getPrice(countryCode: string) {
|
|
48
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/prices?year=2021&month=9`;
|
|
49
|
+
const response = await fetch(url);
|
|
50
|
+
return await response.json()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static async getHydrofill(countryCode: string) {
|
|
54
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/hydrofill?year=2021`
|
|
55
|
+
const response = await fetch(url);
|
|
56
|
+
return await response.json()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Convert.start();
|