@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.
Files changed (53) hide show
  1. package/README.md +6 -0
  2. package/dist/app.d.ts +1 -1
  3. package/dist/app.js +26 -26
  4. package/dist/config/countrydata.json +265 -265
  5. package/dist/converter.d.ts +8 -8
  6. package/dist/converter.js +56 -59
  7. package/dist/converter.js.map +1 -1
  8. package/dist/genTypes.d.ts +4 -4
  9. package/dist/genTypes.js +53 -53
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +5 -5
  12. package/dist/load.d.ts +7 -7
  13. package/dist/load.js +31 -31
  14. package/dist/router/config/countries.json +194 -0
  15. package/dist/router/config/countrydata.json +266 -0
  16. package/dist/router/config/types.json +333 -0
  17. package/dist/router/controllers/LoadAndParse.d.ts +10 -10
  18. package/dist/router/controllers/LoadAndParse.js +57 -57
  19. package/dist/router/controllers/Router.d.ts +7 -7
  20. package/dist/router/controllers/Router.js +105 -105
  21. package/dist/router/index.d.ts +2 -2
  22. package/dist/router/index.js +5 -5
  23. package/dist/router/interfaces/config.d.ts +5 -5
  24. package/dist/router/interfaces/config.js +2 -2
  25. package/dist/router/interfaces/entsoe.d.ts +50 -50
  26. package/dist/router/interfaces/entsoe.js +2 -2
  27. package/dist/router/interfaces/queryoptions.d.ts +15 -15
  28. package/dist/router/interfaces/queryoptions.js +15 -15
  29. package/dist/router/interfaces/types.d.ts +12 -12
  30. package/dist/router/interfaces/types.js +2 -2
  31. package/dist/router/services/CommonTimestamps.d.ts +15 -15
  32. package/dist/router/services/CommonTimestamps.js +185 -173
  33. package/dist/router/services/CommonTimestamps.js.map +1 -1
  34. package/dist/router/services/Eurostat.d.ts +10 -10
  35. package/dist/router/services/Eurostat.js +72 -72
  36. package/dist/router/services/Eurostat.js.map +1 -1
  37. package/dist/router/services/LoadService.d.ts +27 -27
  38. package/dist/router/services/LoadService.js +82 -82
  39. package/dist/router/services/Loader.d.ts +38 -38
  40. package/dist/router/services/Loader.js +119 -121
  41. package/dist/router/services/Loader.js.map +1 -1
  42. package/dist/router/services/ParseEdifact.d.ts +28 -28
  43. package/dist/router/services/ParseEdifact.js +159 -159
  44. package/dist/router/services/ParseInstalled.d.ts +9 -9
  45. package/dist/router/services/ParseInstalled.js +45 -45
  46. package/dist/router/services/batch/maxHydrofill.d.ts +10 -10
  47. package/dist/router/services/batch/maxHydrofill.js +65 -65
  48. package/package.json +53 -53
  49. package/src/converter.ts +61 -64
  50. package/src/router/config/countrydata.json +265 -265
  51. package/src/router/services/CommonTimestamps.ts +90 -54
  52. package/src/router/services/Eurostat.ts +3 -3
  53. 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.39",
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
- console.log(countries)
10
- for (const country of countries) {
11
- const types = await GenTypes.getTypes(country.code);
12
- country.types = types;
13
- console.log(country.name, types.join(', '))
14
- const h = await Hydrofill.getMaxHydrofill(country.code)
15
- if (h.max) {
16
- const GW = Math.round(h.max / 1000) + ' GW'
17
- console.log(country.name, GW)
18
- country.hydrofill = {
19
- min: h.min,
20
- max: h.max
21
- }
22
- }
23
- const gen = await this.getGeneration(country.code)
24
- const load = await this.getLoad(country.code)
25
- const price = await this.getPrice(country.code)
26
- const hydrofill = await this.getHydrofill(country.code)
27
- }
28
- console.log(countries);
29
- writeFile('data/countrydata.json', JSON.stringify(countries, null, 2), 'utf-8')
30
- }
31
-
32
- static async getCountries() {
33
- const url = 'https://powercalculator.eu/entsoe/datalists/countries';
34
- const response = await fetch(url);
35
- return await response.json()
36
- }
37
-
38
- static async getGeneration(countryCode: string) {
39
- const url = `https://powercalculator.eu/entsoe/${countryCode}/generation?year=2021&month=9`;
40
- const response = await fetch(url);
41
- return await response.json()
42
- }
43
-
44
- static async getLoad(countryCode: string) {
45
- const url = `https://powercalculator.eu/entsoe/${countryCode}/load?year=2021&month=9`;
46
- const response = await fetch(url);
47
- return await response.json()
48
- }
49
-
50
- static async getPrice(countryCode: string) {
51
- const url = `https://powercalculator.eu/entsoe/${countryCode}/prices?year=2021&month=9`;
52
- const response = await fetch(url);
53
- return await response.json()
54
- }
55
-
56
- static async getHydrofill(countryCode: string) {
57
- const url = `https://powercalculator.eu/entsoe/${countryCode}/hydrofill?year=2021`
58
- const response = await fetch(url);
59
- return await response.json()
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();