@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
@@ -1,27 +1,27 @@
1
- import { EntsoeLoader, LoaderConfig } from "./Loader";
2
- import { EdifactParser } from "./ParseEdifact";
3
- import { ParseInstalled } from "./ParseInstalled";
4
- import { QueryOptions } from "../interfaces/queryoptions";
5
- export declare class LoadService {
6
- private loaderConfig;
7
- country: string;
8
- loader: EntsoeLoader;
9
- parser: EdifactParser;
10
- parseInstalled: ParseInstalled;
11
- constructor(loaderConfig: LoaderConfig);
12
- getPower(countryCode: string, year: number, month: number, queryOptions?: QueryOptions): Promise<any>;
13
- getInstalled(countryCode: string, reload: boolean): Promise<any>;
14
- getHydrofill(countryCode: string, reload: boolean): Promise<{
15
- time: number[];
16
- hydroFill: number[];
17
- }>;
18
- getFossil(country: string): Promise<any>;
19
- getCountrydata(country: string, reload: boolean): Promise<{
20
- fossil: any;
21
- installed: any;
22
- hydrofill: {
23
- time: number[];
24
- hydroFill: number[];
25
- };
26
- }>;
27
- }
1
+ import { EntsoeLoader, LoaderConfig } from "./Loader";
2
+ import { EdifactParser } from "./ParseEdifact";
3
+ import { ParseInstalled } from "./ParseInstalled";
4
+ import { QueryOptions } from "../interfaces/queryoptions";
5
+ export declare class LoadService {
6
+ private loaderConfig;
7
+ country: string;
8
+ loader: EntsoeLoader;
9
+ parser: EdifactParser;
10
+ parseInstalled: ParseInstalled;
11
+ constructor(loaderConfig: LoaderConfig);
12
+ getPower(countryCode: string, year: number, month: number, queryOptions?: QueryOptions): Promise<any>;
13
+ getInstalled(countryCode: string, reload: boolean): Promise<any>;
14
+ getHydrofill(countryCode: string, reload: boolean): Promise<{
15
+ time: number[];
16
+ hydroFill: number[];
17
+ }>;
18
+ getFossil(country: string): Promise<any>;
19
+ getCountrydata(country: string, reload: boolean): Promise<{
20
+ fossil: any;
21
+ installed: any;
22
+ hydrofill: {
23
+ time: number[];
24
+ hydroFill: number[];
25
+ };
26
+ }>;
27
+ }
@@ -1,83 +1,83 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoadService = void 0;
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- const Loader_1 = require("./Loader");
7
- const ParseEdifact_1 = require("./ParseEdifact");
8
- const ParseInstalled_1 = require("./ParseInstalled");
9
- const CommonTimestamps_1 = require("./CommonTimestamps");
10
- const Eurostat_1 = require("./Eurostat");
11
- const queryoptions_1 = require("../interfaces/queryoptions");
12
- class LoadService {
13
- constructor(loaderConfig) {
14
- this.loaderConfig = loaderConfig;
15
- this.country = '';
16
- const typesPath = (0, path_1.join)(__dirname, '../config/types.json'); // Set the path to your config file
17
- const types = JSON.parse((0, fs_1.readFileSync)(typesPath, 'utf8')); // Read the config file from disk
18
- this.loader = new Loader_1.EntsoeLoader(loaderConfig);
19
- this.parser = new ParseEdifact_1.EdifactParser(types);
20
- this.parseInstalled = new ParseInstalled_1.ParseInstalled(types);
21
- }
22
- async getPower(countryCode, year, month, queryOptions) {
23
- const wanted = ['generation', 'price', 'consumption'];
24
- if ((queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.format) === queryoptions_1.Format.SOURCES) {
25
- return this.loader.makeUrls(wanted, countryCode, year, month);
26
- }
27
- const edifactAsJson = await this.loader.load(wanted, countryCode, year, month, queryOptions);
28
- if ((queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.format) === queryoptions_1.Format.EDIJSON) {
29
- return edifactAsJson;
30
- }
31
- const parsed = await this.parser.parseAll(edifactAsJson);
32
- if ((queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.format) === queryoptions_1.Format.KEYVALUE) {
33
- return parsed;
34
- }
35
- const startMonth = (new Date(Date.UTC(year, month - 1))).toISOString();
36
- const endMonth = (new Date(Date.UTC(year, month))).toISOString();
37
- const ready = CommonTimestamps_1.CommonTimestamps.transform(parsed, startMonth, endMonth);
38
- return ready;
39
- }
40
- async getInstalled(countryCode, reload) {
41
- const edifactAsJson = await this.loader.loadInstalled(countryCode, reload);
42
- const ready = await this.parseInstalled.parse(edifactAsJson);
43
- return ready;
44
- }
45
- async getHydrofill(countryCode, reload) {
46
- var _a;
47
- const wanted = ['hydroFill'];
48
- const endYear = new Date().getFullYear() + 1;
49
- let all = [];
50
- for (let year = 2015; year < endYear; year++) {
51
- const month = 1;
52
- const edifactAsJson = await this.loader.load(wanted, countryCode, year, month, { reload });
53
- const parsed = await this.parser.parseAll(edifactAsJson);
54
- if (parsed === null || parsed === void 0 ? void 0 : parsed.hydroFill) {
55
- const yearArr = (_a = Object.values(parsed === null || parsed === void 0 ? void 0 : parsed.hydroFill)) === null || _a === void 0 ? void 0 : _a[0];
56
- if (yearArr) {
57
- all = all.concat(yearArr);
58
- }
59
- }
60
- }
61
- const keyValue = all.filter((obj, index, self) => {
62
- return index === self.findIndex((o) => o.time === obj.time);
63
- });
64
- return {
65
- time: keyValue.map(item => item.time),
66
- hydroFill: keyValue.map(item => item.value)
67
- };
68
- }
69
- async getFossil(country) {
70
- const eurostat = new Eurostat_1.EurostatAPI();
71
- return await eurostat.load(country);
72
- }
73
- async getCountrydata(country, reload) {
74
- console.log('reload', country, reload);
75
- return {
76
- fossil: await this.getFossil(country),
77
- installed: await this.getInstalled(country, reload),
78
- hydrofill: await this.getHydrofill(country, reload)
79
- };
80
- }
81
- }
82
- exports.LoadService = LoadService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoadService = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const Loader_1 = require("./Loader");
7
+ const ParseEdifact_1 = require("./ParseEdifact");
8
+ const ParseInstalled_1 = require("./ParseInstalled");
9
+ const CommonTimestamps_1 = require("./CommonTimestamps");
10
+ const Eurostat_1 = require("./Eurostat");
11
+ const queryoptions_1 = require("../interfaces/queryoptions");
12
+ class LoadService {
13
+ constructor(loaderConfig) {
14
+ this.loaderConfig = loaderConfig;
15
+ this.country = '';
16
+ const typesPath = (0, path_1.join)(__dirname, '../config/types.json'); // Set the path to your config file
17
+ const types = JSON.parse((0, fs_1.readFileSync)(typesPath, 'utf8')); // Read the config file from disk
18
+ this.loader = new Loader_1.EntsoeLoader(loaderConfig);
19
+ this.parser = new ParseEdifact_1.EdifactParser(types);
20
+ this.parseInstalled = new ParseInstalled_1.ParseInstalled(types);
21
+ }
22
+ async getPower(countryCode, year, month, queryOptions) {
23
+ const wanted = ['generation', 'price', 'consumption'];
24
+ if ((queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.format) === queryoptions_1.Format.SOURCES) {
25
+ return this.loader.makeUrls(wanted, countryCode, year, month);
26
+ }
27
+ const edifactAsJson = await this.loader.load(wanted, countryCode, year, month, queryOptions);
28
+ if ((queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.format) === queryoptions_1.Format.EDIJSON) {
29
+ return edifactAsJson;
30
+ }
31
+ const parsed = await this.parser.parseAll(edifactAsJson);
32
+ if ((queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.format) === queryoptions_1.Format.KEYVALUE) {
33
+ return parsed;
34
+ }
35
+ const startMonth = (new Date(Date.UTC(year, month - 1))).toISOString();
36
+ const endMonth = (new Date(Date.UTC(year, month))).toISOString();
37
+ const ready = CommonTimestamps_1.CommonTimestamps.transform(parsed, startMonth, endMonth);
38
+ return ready;
39
+ }
40
+ async getInstalled(countryCode, reload) {
41
+ const edifactAsJson = await this.loader.loadInstalled(countryCode, reload);
42
+ const ready = await this.parseInstalled.parse(edifactAsJson);
43
+ return ready;
44
+ }
45
+ async getHydrofill(countryCode, reload) {
46
+ var _a;
47
+ const wanted = ['hydroFill'];
48
+ const endYear = new Date().getFullYear() + 1;
49
+ let all = [];
50
+ for (let year = 2015; year < endYear; year++) {
51
+ const month = 1;
52
+ const edifactAsJson = await this.loader.load(wanted, countryCode, year, month, { reload });
53
+ const parsed = await this.parser.parseAll(edifactAsJson);
54
+ if (parsed === null || parsed === void 0 ? void 0 : parsed.hydroFill) {
55
+ const yearArr = (_a = Object.values(parsed === null || parsed === void 0 ? void 0 : parsed.hydroFill)) === null || _a === void 0 ? void 0 : _a[0];
56
+ if (yearArr) {
57
+ all = all.concat(yearArr);
58
+ }
59
+ }
60
+ }
61
+ const keyValue = all.filter((obj, index, self) => {
62
+ return index === self.findIndex((o) => o.time === obj.time);
63
+ });
64
+ return {
65
+ time: keyValue.map(item => item.time),
66
+ hydroFill: keyValue.map(item => item.value)
67
+ };
68
+ }
69
+ async getFossil(country) {
70
+ const eurostat = new Eurostat_1.EurostatAPI();
71
+ return await eurostat.load(country);
72
+ }
73
+ async getCountrydata(country, reload) {
74
+ console.log('reload', country, reload);
75
+ return {
76
+ fossil: await this.getFossil(country),
77
+ installed: await this.getInstalled(country, reload),
78
+ hydrofill: await this.getHydrofill(country, reload)
79
+ };
80
+ }
81
+ }
82
+ exports.LoadService = LoadService;
83
83
  //# sourceMappingURL=LoadService.js.map
@@ -1,38 +1,38 @@
1
- import { Entsoe } from '../interfaces/entsoe';
2
- import { QueryOptions } from '../interfaces/queryoptions';
3
- export interface AllEntsoe {
4
- [key: string]: Entsoe;
5
- }
6
- export interface EntsoeConfig {
7
- entsoeDomain: string;
8
- countries: Country[];
9
- }
10
- export interface Country {
11
- code: string;
12
- name: string;
13
- short: string;
14
- }
15
- export interface Data {
16
- [key: string]: number[];
17
- }
18
- export interface LoaderConfig {
19
- securityToken: string;
20
- cacheDir?: string;
21
- entsoeDomain: string;
22
- }
23
- interface KV {
24
- [key: string]: string;
25
- }
26
- export declare class EntsoeLoader {
27
- private loaderConfig;
28
- private config;
29
- constructor(loaderConfig: LoaderConfig);
30
- load(wanted: string[], countryCode: string, year: number, month: number, queryOptions?: QueryOptions): Promise<AllEntsoe>;
31
- makeUrls(wanted: string[], countryCode: string, year: number, month: number): KV;
32
- loadInstalled(countryCode: string, reload?: boolean): Promise<Entsoe[]>;
33
- fetchAndMakeJson(urls: string[], reload?: boolean): Promise<Entsoe[]>;
34
- filterEmpty(all: Data): void;
35
- fetchAndCache(url: string, reload?: boolean): Promise<Entsoe>;
36
- filterURLs(obj: KV, keys: string[]): KV;
37
- }
38
- export {};
1
+ import { Entsoe } from '../interfaces/entsoe';
2
+ import { QueryOptions } from '../interfaces/queryoptions';
3
+ export interface AllEntsoe {
4
+ [key: string]: Entsoe;
5
+ }
6
+ export interface EntsoeConfig {
7
+ entsoeDomain: string;
8
+ countries: Country[];
9
+ }
10
+ export interface Country {
11
+ code: string;
12
+ name: string;
13
+ short: string;
14
+ }
15
+ export interface Data {
16
+ [key: string]: number[];
17
+ }
18
+ export interface LoaderConfig {
19
+ securityToken: string;
20
+ cacheDir?: string;
21
+ entsoeDomain: string;
22
+ }
23
+ interface KV {
24
+ [key: string]: string;
25
+ }
26
+ export declare class EntsoeLoader {
27
+ private loaderConfig;
28
+ private config;
29
+ constructor(loaderConfig: LoaderConfig);
30
+ load(wanted: string[], countryCode: string, year: number, month: number, queryOptions?: QueryOptions): Promise<AllEntsoe>;
31
+ makeUrls(wanted: string[], countryCode: string, year: number, month: number): KV;
32
+ loadInstalled(countryCode: string, reload?: boolean): Promise<Entsoe[]>;
33
+ fetchAndMakeJson(urls: string[], reload?: boolean): Promise<Entsoe[]>;
34
+ filterEmpty(all: Data): void;
35
+ fetchAndCache(url: string, reload?: boolean): Promise<Entsoe>;
36
+ filterURLs(obj: KV, keys: string[]): KV;
37
+ }
38
+ export {};
@@ -1,122 +1,120 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntsoeLoader = void 0;
4
- const xml2js_1 = require("xml2js");
5
- const promises_1 = require("node:fs/promises");
6
- const node_path_1 = require("node:path");
7
- const date_fns_1 = require("date-fns");
8
- class EntsoeLoader {
9
- constructor(loaderConfig) {
10
- this.loaderConfig = loaderConfig;
11
- this.config = loaderConfig;
12
- }
13
- async load(wanted, countryCode, year, month, queryOptions) {
14
- const urls = this.makeUrls(wanted, countryCode, year, month);
15
- const allJsons = await this.fetchAndMakeJson(Object.values(urls), queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.reload);
16
- const result = {};
17
- Object.keys(urls).forEach((key, i) => {
18
- if (allJsons[i]) {
19
- result[key] = allJsons[i];
20
- }
21
- });
22
- return result;
23
- }
24
- makeUrls(wanted, countryCode, year, month) {
25
- let start = new Date(Date.UTC(year, month - 1));
26
- start = (0, date_fns_1.sub)(start, { hours: 3 });
27
- let end = new Date(Date.UTC(year, month));
28
- end = (0, date_fns_1.add)(end, { hours: 3 });
29
- const periodStart = (0, date_fns_1.format)(start, 'yyyyMMddHHmm');
30
- const periodEnd = (0, date_fns_1.format)(end, 'yyyyMMddHHmm');
31
- const hydroStart = (0, date_fns_1.sub)(start, { days: 7 });
32
- const hydroPeriodStart = (0, date_fns_1.format)(hydroStart, 'yyyyMMddHHmm');
33
- const hydroPeriodEnd = (0, date_fns_1.format)((0, date_fns_1.add)(hydroStart, { days: 380 }), 'yyyyMMddHHmm');
34
- let priceCountryCode = countryCode;
35
- //germany luxemburg
36
- if (countryCode === '10Y1001A1001A83F' || countryCode === '10YLU-CEGEDEL-NQ') {
37
- priceCountryCode = '10Y1001A1001A82H';
38
- }
39
- //italy
40
- if (countryCode === '10YIT-GRTN-----B') {
41
- priceCountryCode = '10Y1001A1001A70O';
42
- }
43
- const generation = `${this.config.entsoeDomain}/api?documentType=A75&processType=A16&in_Domain=${countryCode}&outBiddingZone_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
44
- const price = `${this.config.entsoeDomain}/api?documentType=A44&in_Domain=${priceCountryCode}&out_Domain=${priceCountryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
45
- const consumption = `${this.config.entsoeDomain}/api?documentType=A65&processType=A16&in_Domain=${countryCode}&outBiddingZone_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
46
- const hydroFill = `${this.config.entsoeDomain}/api?documentType=A72&processType=A16&in_Domain=${countryCode}&periodStart=${hydroPeriodStart}&periodEnd=${hydroPeriodEnd}`;
47
- console.log(generation);
48
- console.log(hydroFill);
49
- const urls = {
50
- generation,
51
- price,
52
- consumption,
53
- hydroFill,
54
- };
55
- const filteredUrls = this.filterURLs(urls, wanted);
56
- return filteredUrls;
57
- }
58
- async loadInstalled(countryCode, reload) {
59
- const currentYear = (new Date()).getFullYear() + 1;
60
- const urls = [];
61
- for (let year = 2015; year < currentYear; year++) {
62
- const periodStart = `${year}12302200`;
63
- const periodEnd = `${year + 2}01020400`;
64
- const installed = `${this.config.entsoeDomain}/api?documentType=A68&processType=A33&in_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
65
- urls.push(installed);
66
- }
67
- console.log(urls);
68
- const allJsons = await this.fetchAndMakeJson(Object.values(urls), reload);
69
- return allJsons;
70
- }
71
- async fetchAndMakeJson(urls, reload) {
72
- const promises = [];
73
- urls.forEach(url => {
74
- promises.push(this.fetchAndCache(url, reload));
75
- });
76
- const settled = await Promise.allSettled(promises);
77
- const fulfilled = settled.filter((res) => res.status === 'fulfilled');
78
- return fulfilled.map(item => item.value);
79
- }
80
- filterEmpty(all) {
81
- Object.keys(all).forEach(name => {
82
- if (!all[name].some(item => item !== 0)) {
83
- delete all[name];
84
- }
85
- });
86
- }
87
- async fetchAndCache(url, reload) {
88
- const simpleUrl = url.replace(/[\W_]+/g, "_");
89
- let filename;
90
- if (this.config.cacheDir) {
91
- filename = (0, node_path_1.join)(this.config.cacheDir, simpleUrl + '.json');
92
- }
93
- try {
94
- if (reload || !filename) {
95
- throw Error('go for full reload');
96
- }
97
- const jsonString = await (0, promises_1.readFile)(filename, 'utf-8');
98
- return JSON.parse(jsonString);
99
- }
100
- catch (e) {
101
- const urlWithToken = `${url}&securityToken=${this.config.securityToken}`;
102
- const response = await fetch(urlWithToken);
103
- if (response.status !== 200) {
104
- return Promise.reject(new Error(`${response.status} ${response.statusText}`));
105
- }
106
- const data = await response.text();
107
- const json = await (0, xml2js_1.parseStringPromise)(data);
108
- if (filename) {
109
- (0, promises_1.writeFile)(filename, JSON.stringify(json), 'utf-8');
110
- }
111
- return json;
112
- }
113
- }
114
- filterURLs(obj, keys) {
115
- return keys.reduce((acc, key) => {
116
- acc[key] = obj[key];
117
- return acc;
118
- }, {});
119
- }
120
- }
121
- exports.EntsoeLoader = EntsoeLoader;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntsoeLoader = void 0;
4
+ const xml2js_1 = require("xml2js");
5
+ const promises_1 = require("node:fs/promises");
6
+ const node_path_1 = require("node:path");
7
+ const date_fns_1 = require("date-fns");
8
+ class EntsoeLoader {
9
+ constructor(loaderConfig) {
10
+ this.loaderConfig = loaderConfig;
11
+ this.config = loaderConfig;
12
+ }
13
+ async load(wanted, countryCode, year, month, queryOptions) {
14
+ const urls = this.makeUrls(wanted, countryCode, year, month);
15
+ const allJsons = await this.fetchAndMakeJson(Object.values(urls), queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.reload);
16
+ const result = {};
17
+ Object.keys(urls).forEach((key, i) => {
18
+ if (allJsons[i]) {
19
+ result[key] = allJsons[i];
20
+ }
21
+ });
22
+ return result;
23
+ }
24
+ makeUrls(wanted, countryCode, year, month) {
25
+ let start = new Date(Date.UTC(year, month - 1));
26
+ start = (0, date_fns_1.sub)(start, { hours: 3 });
27
+ let end = new Date(Date.UTC(year, month));
28
+ end = (0, date_fns_1.add)(end, { hours: 3 });
29
+ const periodStart = (0, date_fns_1.format)(start, 'yyyyMMddHHmm');
30
+ const periodEnd = (0, date_fns_1.format)(end, 'yyyyMMddHHmm');
31
+ const hydroStart = (0, date_fns_1.sub)(start, { days: 7 });
32
+ const hydroPeriodStart = (0, date_fns_1.format)(hydroStart, 'yyyyMMddHHmm');
33
+ const hydroPeriodEnd = (0, date_fns_1.format)((0, date_fns_1.add)(hydroStart, { days: 380 }), 'yyyyMMddHHmm');
34
+ let priceCountryCode = countryCode;
35
+ //germany luxemburg
36
+ if (countryCode === '10Y1001A1001A83F' || countryCode === '10YLU-CEGEDEL-NQ') {
37
+ priceCountryCode = '10Y1001A1001A82H';
38
+ }
39
+ //italy
40
+ if (countryCode === '10YIT-GRTN-----B') {
41
+ priceCountryCode = '10Y1001A1001A70O';
42
+ }
43
+ const generation = `${this.config.entsoeDomain}/api?documentType=A75&processType=A16&in_Domain=${countryCode}&outBiddingZone_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
44
+ const price = `${this.config.entsoeDomain}/api?documentType=A44&in_Domain=${priceCountryCode}&out_Domain=${priceCountryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
45
+ const consumption = `${this.config.entsoeDomain}/api?documentType=A65&processType=A16&in_Domain=${countryCode}&outBiddingZone_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
46
+ const hydroFill = `${this.config.entsoeDomain}/api?documentType=A72&processType=A16&in_Domain=${countryCode}&periodStart=${hydroPeriodStart}&periodEnd=${hydroPeriodEnd}`;
47
+ //const crossBorder = `${this.config.entsoeDomain}/api?documentType=A88&acquiring_Domain=10YCZ-CEPS-----N&connecting_Domain=10YSK-SEPS-----K&periodStart=${periodStart}&periodEnd=${periodEnd}`
48
+ const urls = {
49
+ generation,
50
+ price,
51
+ consumption,
52
+ hydroFill
53
+ };
54
+ const filteredUrls = this.filterURLs(urls, wanted);
55
+ return filteredUrls;
56
+ }
57
+ async loadInstalled(countryCode, reload) {
58
+ const currentYear = (new Date()).getFullYear() + 1;
59
+ const urls = [];
60
+ for (let year = 2015; year < currentYear; year++) {
61
+ const periodStart = `${year}12302200`;
62
+ const periodEnd = `${year + 2}01020400`;
63
+ const installed = `${this.config.entsoeDomain}/api?documentType=A68&processType=A33&in_Domain=${countryCode}&periodStart=${periodStart}&periodEnd=${periodEnd}`;
64
+ urls.push(installed);
65
+ }
66
+ const allJsons = await this.fetchAndMakeJson(Object.values(urls), reload);
67
+ return allJsons;
68
+ }
69
+ async fetchAndMakeJson(urls, reload) {
70
+ const promises = [];
71
+ urls.forEach(url => {
72
+ promises.push(this.fetchAndCache(url, reload));
73
+ });
74
+ const settled = await Promise.allSettled(promises);
75
+ const fulfilled = settled.filter((res) => res.status === 'fulfilled');
76
+ return fulfilled.map(item => item.value);
77
+ }
78
+ filterEmpty(all) {
79
+ Object.keys(all).forEach(name => {
80
+ if (!all[name].some(item => item !== 0)) {
81
+ delete all[name];
82
+ }
83
+ });
84
+ }
85
+ async fetchAndCache(url, reload) {
86
+ const simpleUrl = url.replace(/[\W_]+/g, "_");
87
+ let filename;
88
+ if (this.config.cacheDir) {
89
+ filename = (0, node_path_1.join)(this.config.cacheDir, simpleUrl + '.json');
90
+ }
91
+ try {
92
+ if (reload || !filename) {
93
+ throw Error('go for full reload');
94
+ }
95
+ const jsonString = await (0, promises_1.readFile)(filename, 'utf-8');
96
+ return JSON.parse(jsonString);
97
+ }
98
+ catch (e) {
99
+ const urlWithToken = `${url}&securityToken=${this.config.securityToken}`;
100
+ const response = await fetch(urlWithToken);
101
+ if (response.status !== 200) {
102
+ return Promise.reject(new Error(`${response.status} ${response.statusText}`));
103
+ }
104
+ const data = await response.text();
105
+ const json = await (0, xml2js_1.parseStringPromise)(data);
106
+ if (filename) {
107
+ (0, promises_1.writeFile)(filename, JSON.stringify(json), 'utf-8');
108
+ }
109
+ return json;
110
+ }
111
+ }
112
+ filterURLs(obj, keys) {
113
+ return keys.reduce((acc, key) => {
114
+ acc[key] = obj[key];
115
+ return acc;
116
+ }, {});
117
+ }
118
+ }
119
+ exports.EntsoeLoader = EntsoeLoader;
122
120
  //# sourceMappingURL=Loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../../src/router/services/Loader.ts"],"names":[],"mappings":";;;AAAA,mCAA4C;AAC5C,+CAAuD;AAEvD,yCAAiC;AACjC,uCAA2C;AAgC3C,MAAa,YAAY;IAGvB,YAAoB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAC5C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAgB,EAAE,WAAmB,EAAE,IAAY,EAAE,KAAa,EAAE,YAA2B;QACxG,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,CAAC,CAAC;QACxF,MAAM,MAAM,GAAc,EAAE,CAAA;QAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACnC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;gBACf,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAW,CAAC;aACrC;QACH,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,MAAgB,EAAE,WAAmB,EAAE,IAAY,EAAE,KAAa;QACzE,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QAChD,KAAK,GA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E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;YAC3C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;aAE/E;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAkB,EAAC,IAAI,CAAW,CAAC;YACtD,IAAI,QAAQ,EAAE;gBACZ,IAAA,oBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAA;aACnD;YACD,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IACD,UAAU,CAAC,GAAO,EAAE,IAAc;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAO,EAAE,GAAW,EAAE,EAAE;YAC1C,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACpB,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;CACF;AAtHD,oCAsHC"}
@@ -1,28 +1,28 @@
1
- import { Entsoe, TimeSeries } from "../interfaces/entsoe";
2
- import { Types } from "../interfaces/types";
3
- import { AllEntsoe } from "./Loader";
4
- export interface DataPoint {
5
- time: number;
6
- value: number;
7
- }
8
- export interface DataPointResolutions {
9
- [key: string]: DataPoint[];
10
- }
11
- export interface AllInResulotions {
12
- [key: string]: DataPointResolutions;
13
- }
14
- export declare class EdifactParser {
15
- private types;
16
- private psrName;
17
- constructor(types: Types);
18
- parseAll(all: AllEntsoe): AllInResulotions;
19
- parse(json: Entsoe, key: string): AllInResulotions | undefined;
20
- parseTimeSeries(timeSerie: TimeSeries, name: string): [string, DataPoint[]];
21
- makeTimeArray(startIsoString: string, endIsoString: string, resolution: string, timeSerie: TimeSeries): number[];
22
- getStartEndResolution(timeSeries: TimeSeries[] | TimeSeries): {
23
- startIsoString: any;
24
- endIsoString: any;
25
- resolution: string;
26
- };
27
- mergeEqualTimeStamps(data: DataPoint[]): DataPoint[];
28
- }
1
+ import { Entsoe, TimeSeries } from "../interfaces/entsoe";
2
+ import { Types } from "../interfaces/types";
3
+ import { AllEntsoe } from "./Loader";
4
+ export interface DataPoint {
5
+ time: number;
6
+ value: number;
7
+ }
8
+ export interface DataPointResolutions {
9
+ [key: string]: DataPoint[];
10
+ }
11
+ export interface AllInResulotions {
12
+ [key: string]: DataPointResolutions;
13
+ }
14
+ export declare class EdifactParser {
15
+ private types;
16
+ private psrName;
17
+ constructor(types: Types);
18
+ parseAll(all: AllEntsoe): AllInResulotions;
19
+ parse(json: Entsoe, key: string): AllInResulotions | undefined;
20
+ parseTimeSeries(timeSerie: TimeSeries, name: string): [string, DataPoint[]];
21
+ makeTimeArray(startIsoString: string, endIsoString: string, resolution: string, timeSerie: TimeSeries): number[];
22
+ getStartEndResolution(timeSeries: TimeSeries[] | TimeSeries): {
23
+ startIsoString: any;
24
+ endIsoString: any;
25
+ resolution: string;
26
+ };
27
+ mergeEqualTimeStamps(data: DataPoint[]): DataPoint[];
28
+ }