@powercalc/power-router 1.0.19 → 1.0.22
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/converter.d.ts +8 -0
- package/dist/converter.js +80 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.js +3 -78
- package/package.json +2 -2
- package/src/converter.ts +64 -0
- package/src/index.ts +6 -63
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class Convert {
|
|
2
|
+
static start(): Promise<void>;
|
|
3
|
+
static getCountries(): Promise<any>;
|
|
4
|
+
static getGeneration(countryCode: string): Promise<any>;
|
|
5
|
+
static getLoad(countryCode: string): Promise<any>;
|
|
6
|
+
static getPrice(countryCode: string): Promise<any>;
|
|
7
|
+
static getHydrofill(countryCode: string): Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Convert = void 0;
|
|
13
|
+
const genTypes_1 = require("./genTypes");
|
|
14
|
+
const maxHydrofill_1 = require("./router/services/batch/maxHydrofill");
|
|
15
|
+
const promises_1 = require("node:fs/promises");
|
|
16
|
+
class Convert {
|
|
17
|
+
static start() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const countries = yield this.getCountries();
|
|
20
|
+
console.log(countries);
|
|
21
|
+
for (const country of countries) {
|
|
22
|
+
const types = yield genTypes_1.GenTypes.getTypes(country.code);
|
|
23
|
+
country.types = types;
|
|
24
|
+
console.log(country.name, types.join(', '));
|
|
25
|
+
const h = yield maxHydrofill_1.Hydrofill.getMaxHydrofill(country.code);
|
|
26
|
+
if (h.max) {
|
|
27
|
+
const GW = Math.round(h.max / 1000) + ' GW';
|
|
28
|
+
console.log(country.name, GW);
|
|
29
|
+
country.hydrofill = {
|
|
30
|
+
min: h.min,
|
|
31
|
+
max: h.max
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const gen = yield this.getGeneration(country.code);
|
|
35
|
+
const load = yield this.getLoad(country.code);
|
|
36
|
+
const price = yield this.getPrice(country.code);
|
|
37
|
+
const hydrofill = yield this.getHydrofill(country.code);
|
|
38
|
+
}
|
|
39
|
+
console.log(countries);
|
|
40
|
+
(0, promises_1.writeFile)('data/countrydata.json', JSON.stringify(countries, null, 2), 'utf-8');
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static getCountries() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const url = 'https://powercalculator.eu/entsoe/datalists/countries';
|
|
46
|
+
const response = yield fetch(url);
|
|
47
|
+
return yield response.json();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static getGeneration(countryCode) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/generation?year=2021&month=9`;
|
|
53
|
+
const response = yield fetch(url);
|
|
54
|
+
return yield response.json();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
static getLoad(countryCode) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/load?year=2021&month=9`;
|
|
60
|
+
const response = yield fetch(url);
|
|
61
|
+
return yield response.json();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static getPrice(countryCode) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/prices?year=2021&month=9`;
|
|
67
|
+
const response = yield fetch(url);
|
|
68
|
+
return yield response.json();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static getHydrofill(countryCode) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const url = `https://powercalculator.eu/entsoe/${countryCode}/hydrofill?year=2021`;
|
|
74
|
+
const response = yield fetch(url);
|
|
75
|
+
return yield response.json();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.Convert = Convert;
|
|
80
|
+
Convert.start();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
static getGeneration(countryCode: string): Promise<any>;
|
|
5
|
-
static getLoad(countryCode: string): Promise<any>;
|
|
6
|
-
static getPrice(countryCode: string): Promise<any>;
|
|
7
|
-
static getHydrofill(countryCode: string): Promise<any>;
|
|
8
|
-
}
|
|
1
|
+
import { Config } from './router/interfaces/config';
|
|
2
|
+
import { PowerRouter } from './router/controllers/Router';
|
|
3
|
+
export { Config, PowerRouter };
|
package/dist/index.js
CHANGED
|
@@ -1,80 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const promises_1 = require("node:fs/promises");
|
|
16
|
-
class Convert {
|
|
17
|
-
static start() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const countries = yield this.getCountries();
|
|
20
|
-
console.log(countries);
|
|
21
|
-
for (const country of countries) {
|
|
22
|
-
const types = yield genTypes_1.GenTypes.getTypes(country.code);
|
|
23
|
-
country.types = types;
|
|
24
|
-
console.log(country.name, types.join(', '));
|
|
25
|
-
const h = yield maxHydrofill_1.Hydrofill.getMaxHydrofill(country.code);
|
|
26
|
-
if (h.max) {
|
|
27
|
-
const GW = Math.round(h.max / 1000) + ' GW';
|
|
28
|
-
console.log(country.name, GW);
|
|
29
|
-
country.hydrofill = {
|
|
30
|
-
min: h.min,
|
|
31
|
-
max: h.max
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const gen = yield this.getGeneration(country.code);
|
|
35
|
-
const load = yield this.getLoad(country.code);
|
|
36
|
-
const price = yield this.getPrice(country.code);
|
|
37
|
-
const hydrofill = yield this.getHydrofill(country.code);
|
|
38
|
-
}
|
|
39
|
-
console.log(countries);
|
|
40
|
-
(0, promises_1.writeFile)('data/countrydata.json', JSON.stringify(countries, null, 2), 'utf-8');
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
static getCountries() {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const url = 'https://powercalculator.eu/entsoe/datalists/countries';
|
|
46
|
-
const response = yield fetch(url);
|
|
47
|
-
return yield response.json();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
static getGeneration(countryCode) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const url = `https://powercalculator.eu/entsoe/${countryCode}/generation?year=2021&month=9`;
|
|
53
|
-
const response = yield fetch(url);
|
|
54
|
-
return yield response.json();
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
static getLoad(countryCode) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const url = `https://powercalculator.eu/entsoe/${countryCode}/load?year=2021&month=9`;
|
|
60
|
-
const response = yield fetch(url);
|
|
61
|
-
return yield response.json();
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
static getPrice(countryCode) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const url = `https://powercalculator.eu/entsoe/${countryCode}/prices?year=2021&month=9`;
|
|
67
|
-
const response = yield fetch(url);
|
|
68
|
-
return yield response.json();
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
static getHydrofill(countryCode) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const url = `https://powercalculator.eu/entsoe/${countryCode}/hydrofill?year=2021`;
|
|
74
|
-
const response = yield fetch(url);
|
|
75
|
-
return yield response.json();
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.Convert = Convert;
|
|
80
|
-
Convert.start();
|
|
3
|
+
exports.PowerRouter = void 0;
|
|
4
|
+
const Router_1 = require("./router/controllers/Router");
|
|
5
|
+
Object.defineProperty(exports, "PowerRouter", { enumerable: true, get: function () { return Router_1.PowerRouter; } });
|
package/package.json
CHANGED
package/src/converter.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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();
|
package/src/index.ts
CHANGED
|
@@ -1,64 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { writeFile } from 'node:fs/promises';
|
|
1
|
+
import { Config } from './router/interfaces/config';
|
|
2
|
+
import { PowerRouter } from './router/controllers/Router';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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();
|
|
4
|
+
export {
|
|
5
|
+
Config,
|
|
6
|
+
PowerRouter
|
|
7
|
+
}
|