@golemio/energetics 1.4.13 → 1.5.0-rc.2021437640

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 (90) hide show
  1. package/db/example/00_clear_test_data.sql +2 -1
  2. package/db/migrations/postgresql/20250819094030-enapo-pre.js +53 -0
  3. package/db/migrations/postgresql/sqls/20250819094030-enapo-pre-down.sql +3 -0
  4. package/db/migrations/postgresql/sqls/20250819094030-enapo-pre-up.sql +31 -0
  5. package/dist/input-gateway/pre/PreInputRouter.js +5 -6
  6. package/dist/input-gateway/pre/PreInputRouter.js.map +1 -1
  7. package/dist/input-gateway/pre/PreJsonInputController.d.ts +2 -4
  8. package/dist/input-gateway/pre/PreJsonInputController.js +8 -12
  9. package/dist/input-gateway/pre/PreJsonInputController.js.map +1 -1
  10. package/dist/integration-engine/commodity-providers/helper/EnapoMeasurementsDataNormalizer.d.ts +1 -1
  11. package/dist/integration-engine/commodity-providers/helper/PreMeasurementFilter.d.ts +1 -2
  12. package/dist/integration-engine/commodity-providers/helper/PreMeasurementFilter.js +4 -4
  13. package/dist/integration-engine/commodity-providers/helper/PreMeasurementFilter.js.map +1 -1
  14. package/dist/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.js +4 -1
  15. package/dist/integration-engine/commodity-providers/workers/tasks/ProcessPreEanMeasurementsTask.js.map +1 -1
  16. package/dist/integration-engine/enapo/helpers/MeasurementsDataNormalizer.d.ts +1 -1
  17. package/dist/integration-engine/enapo/interfaces/predi/IPrediMetadata.d.ts +17 -0
  18. package/dist/integration-engine/enapo/interfaces/predi/IPrediMetadata.js +3 -0
  19. package/dist/integration-engine/enapo/interfaces/predi/IPrediMetadata.js.map +1 -0
  20. package/dist/integration-engine/enapo/ioc/Di.js +14 -5
  21. package/dist/integration-engine/enapo/ioc/Di.js.map +1 -1
  22. package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.d.ts +6 -0
  23. package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.js +6 -0
  24. package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.js.map +1 -1
  25. package/dist/integration-engine/enapo/repositories/EnapoMeasurementsRepository.js +1 -1
  26. package/dist/integration-engine/enapo/repositories/EnapoMeasurementsRepository.js.map +1 -1
  27. package/dist/integration-engine/enapo/repositories/PreIncomingDataLogRepository.d.ts +5 -0
  28. package/dist/integration-engine/enapo/repositories/PreIncomingDataLogRepository.js +32 -0
  29. package/dist/integration-engine/enapo/repositories/PreIncomingDataLogRepository.js.map +1 -0
  30. package/dist/integration-engine/enapo/transformations/PPasMeasurementTransformation.d.ts +1 -1
  31. package/dist/integration-engine/enapo/transformations/PPasMeasurementTransformation.js +4 -3
  32. package/dist/integration-engine/enapo/transformations/PPasMeasurementTransformation.js.map +1 -1
  33. package/dist/integration-engine/enapo/transformations/pre/PreDailyMeasurementsTransformation.d.ts +8 -0
  34. package/dist/integration-engine/enapo/transformations/pre/PreDailyMeasurementsTransformation.js +64 -0
  35. package/dist/integration-engine/enapo/transformations/pre/PreDailyMeasurementsTransformation.js.map +1 -0
  36. package/dist/integration-engine/enapo/transformations/pre/PreMeasurementsTransformation.d.ts +7 -0
  37. package/dist/integration-engine/enapo/transformations/pre/PreMeasurementsTransformation.js +66 -0
  38. package/dist/integration-engine/enapo/transformations/pre/PreMeasurementsTransformation.js.map +1 -0
  39. package/dist/integration-engine/enapo/transformations/pre/PreMetadataTransfromation.d.ts +7 -0
  40. package/dist/integration-engine/enapo/transformations/pre/PreMetadataTransfromation.js +43 -0
  41. package/dist/integration-engine/enapo/transformations/pre/PreMetadataTransfromation.js.map +1 -0
  42. package/dist/integration-engine/enapo/transformations/pre/helpers/DeviceSerialNumberExtractor.d.ts +4 -0
  43. package/dist/integration-engine/enapo/transformations/pre/helpers/DeviceSerialNumberExtractor.js +35 -0
  44. package/dist/integration-engine/enapo/transformations/pre/helpers/DeviceSerialNumberExtractor.js.map +1 -0
  45. package/dist/integration-engine/enapo/workers/EnapoWorker.js +1 -0
  46. package/dist/integration-engine/enapo/workers/EnapoWorker.js.map +1 -1
  47. package/dist/integration-engine/enapo/workers/task/AbstractEnapoFetchMeasurementsTask.d.ts +1 -1
  48. package/dist/integration-engine/enapo/workers/task/AbstractEnapoFetchMeasurementsTask.js +1 -1
  49. package/dist/integration-engine/enapo/workers/task/AbstractEnapoFetchMeasurementsTask.js.map +1 -1
  50. package/dist/integration-engine/enapo/workers/task/EnapoPrediTask.d.ts +26 -0
  51. package/dist/integration-engine/enapo/workers/task/EnapoPrediTask.js +81 -0
  52. package/dist/integration-engine/enapo/workers/task/EnapoPrediTask.js.map +1 -0
  53. package/dist/schema-definitions/datasources/enapo/EnapoPreInputSchema.d.ts +3 -0
  54. package/dist/schema-definitions/datasources/enapo/EnapoPreInputSchema.js +113 -0
  55. package/dist/schema-definitions/datasources/enapo/EnapoPreInputSchema.js.map +1 -0
  56. package/dist/schema-definitions/datasources/helpers/MeasurementVariableEnum.d.ts +6 -1
  57. package/dist/schema-definitions/datasources/helpers/MeasurementVariableEnum.js +5 -0
  58. package/dist/schema-definitions/datasources/helpers/MeasurementVariableEnum.js.map +1 -1
  59. package/dist/schema-definitions/datasources/interfaces/enapo/IEnapoMetadata.d.ts +17 -0
  60. package/dist/schema-definitions/datasources/interfaces/enapo/IEnapoMetadata.js +3 -0
  61. package/dist/schema-definitions/datasources/interfaces/enapo/IEnapoMetadata.js.map +1 -0
  62. package/dist/schema-definitions/datasources/interfaces/enapo/IPreIncomingDataLog.d.ts +18 -0
  63. package/dist/schema-definitions/datasources/interfaces/enapo/IPreIncomingDataLog.js +3 -0
  64. package/dist/schema-definitions/datasources/interfaces/enapo/IPreIncomingDataLog.js.map +1 -0
  65. package/dist/schema-definitions/datasources/interfaces/enapo/IPrediInputData.d.ts +37 -0
  66. package/dist/schema-definitions/datasources/interfaces/enapo/IPrediInputData.js +3 -0
  67. package/dist/schema-definitions/datasources/interfaces/enapo/IPrediInputData.js.map +1 -0
  68. package/dist/schema-definitions/models/{EnapoMeasurementsModel.d.ts → enapo/EnapoMeasurementsModel.d.ts} +2 -1
  69. package/dist/schema-definitions/models/{EnapoMeasurementsModel.js → enapo/EnapoMeasurementsModel.js} +9 -5
  70. package/dist/schema-definitions/models/enapo/EnapoMeasurementsModel.js.map +1 -0
  71. package/dist/schema-definitions/models/enapo/EnapoMetadataModel.d.ts +18 -0
  72. package/dist/schema-definitions/models/enapo/EnapoMetadataModel.js +60 -0
  73. package/dist/schema-definitions/models/enapo/EnapoMetadataModel.js.map +1 -0
  74. package/dist/schema-definitions/models/enapo/PreIncomingDataLogModel.d.ts +26 -0
  75. package/dist/schema-definitions/models/enapo/PreIncomingDataLogModel.js +89 -0
  76. package/dist/schema-definitions/models/enapo/PreIncomingDataLogModel.js.map +1 -0
  77. package/dist/schema-definitions/models/enapo/helpers/ProviderTypeEnum.d.ts +4 -0
  78. package/dist/schema-definitions/models/enapo/helpers/ProviderTypeEnum.js +9 -0
  79. package/dist/schema-definitions/models/enapo/helpers/ProviderTypeEnum.js.map +1 -0
  80. package/dist/schema-definitions/models/{interfaces → enapo/interfaces}/IEnapoMeasurmentsDto.d.ts +2 -1
  81. package/dist/schema-definitions/models/enapo/interfaces/IEnapoMeasurmentsDto.js.map +1 -0
  82. package/docs/implementation_documentation.md +30 -3
  83. package/docs/openapi-input.yaml +27 -1
  84. package/package.json +4 -4
  85. package/dist/input-gateway/helpers/PreDataExtractor.d.ts +0 -5
  86. package/dist/input-gateway/helpers/PreDataExtractor.js +0 -20
  87. package/dist/input-gateway/helpers/PreDataExtractor.js.map +0 -1
  88. package/dist/schema-definitions/models/EnapoMeasurementsModel.js.map +0 -1
  89. package/dist/schema-definitions/models/interfaces/IEnapoMeasurmentsDto.js.map +0 -1
  90. /package/dist/schema-definitions/models/{interfaces → enapo/interfaces}/IEnapoMeasurmentsDto.js +0 -0
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PreMeasurementsTransformation = void 0;
10
+ const PreMeasurementFilter_1 = require("../../../commodity-providers/helper/PreMeasurementFilter");
11
+ const MeasurementVariableEnum_1 = require("../../../../schema-definitions/datasources/helpers/MeasurementVariableEnum");
12
+ const ProviderTypeEnum_1 = require("../../../../schema-definitions/models/enapo/helpers/ProviderTypeEnum");
13
+ const helpers_1 = require("@golemio/core/dist/helpers");
14
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
15
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
16
+ const DeviceSerialNumberExtractor_1 = require("./helpers/DeviceSerialNumberExtractor");
17
+ let PreMeasurementsTransformation = exports.PreMeasurementsTransformation = class PreMeasurementsTransformation extends AbstractTransformation_1.AbstractTransformation {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.name = "PreMeasurementsTransformation";
21
+ this.transformInternal = (data) => {
22
+ const output = [];
23
+ for (const company of Object.keys(data.stored_month.companies)) {
24
+ const companyData = data.stored_month.companies[company];
25
+ for (const ean of Object.keys(companyData.EAN_list)) {
26
+ const eanData = companyData.EAN_list[ean];
27
+ const measurementsT1 = PreMeasurementFilter_1.PreMeasurementFilter.sumDuplicates(eanData.daily_data_Wh_per_EAN.T1_Wh_raw_data.flat());
28
+ for (const measurement of measurementsT1) {
29
+ const date = helpers_1.DateTime.fromFormat(measurement[0], "dd.MM.yyyy T", { timeZone: "UTC" }).toDate();
30
+ const deviceSerialNumber = DeviceSerialNumberExtractor_1.DeviceSerialNumberExtractor.extractActual(eanData.meter_replaced, date);
31
+ output.push({
32
+ id: ean,
33
+ id_type: "ean",
34
+ timestamp: date,
35
+ source: ProviderTypeEnum_1.ProviderType.PREdi,
36
+ place_id: eanData.consumption_point,
37
+ device_serial_number: deviceSerialNumber,
38
+ value: Number(measurement[1]),
39
+ var: MeasurementVariableEnum_1.MeasurementVariable.EFwActi_VT,
40
+ });
41
+ }
42
+ const measurementsT2 = PreMeasurementFilter_1.PreMeasurementFilter.sumDuplicates(eanData.daily_data_Wh_per_EAN.T2_Wh_raw_data.flat());
43
+ for (const measurement of measurementsT2) {
44
+ const date = helpers_1.DateTime.fromFormat(measurement[0], "dd.MM.yyyy T", { timeZone: "UTC" }).toDate();
45
+ const deviceSerialNumber = DeviceSerialNumberExtractor_1.DeviceSerialNumberExtractor.extractActual(eanData.meter_replaced, date);
46
+ output.push({
47
+ id: ean,
48
+ id_type: "ean",
49
+ timestamp: date,
50
+ source: ProviderTypeEnum_1.ProviderType.PREdi,
51
+ place_id: eanData.consumption_point,
52
+ device_serial_number: deviceSerialNumber,
53
+ value: Number(measurement[1]),
54
+ var: MeasurementVariableEnum_1.MeasurementVariable.EFwActi_NT,
55
+ });
56
+ }
57
+ }
58
+ }
59
+ return output;
60
+ };
61
+ }
62
+ };
63
+ exports.PreMeasurementsTransformation = PreMeasurementsTransformation = __decorate([
64
+ (0, tsyringe_1.injectable)()
65
+ ], PreMeasurementsTransformation);
66
+ //# sourceMappingURL=PreMeasurementsTransformation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreMeasurementsTransformation.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/transformations/pre/PreMeasurementsTransformation.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mGAA2F;AAC3F,wHAAuF;AAEvF,2GAA0E;AAE1E,wDAAsD;AACtD,6GAA0G;AAC1G,iEAAgE;AAChE,uFAAoF;AAG7E,IAAM,6BAA6B,2CAAnC,MAA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qBAC/B;oBAED,MAAM,cAAc,GAAG,2CAAoB,CAAC,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;oBAE/G,KAAK,MAAM,WAAW,IAAI,cAAc,EAAE;wBACtC,MAAM,IAAI,GAAG,kBAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;wBAC/F,MAAM,kBAAkB,GAAG,yDAA2B,CAAC,aAAa,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;wBACnG,MAAM,CAAC,IAAI,CAAC;4BACR,EAAE,EAAE,GAAG;4BACP,OAAO,EAAE,KAAK;4BACd,SAAS,EAAE,IAAI;4BACf,MAAM,EAAE,+BAAY,CAAC,KAAK;4BAC1B,QAAQ,EAAE,OAAO,CAAC,iBAAiB;4BACnC,oBAAoB,EAAE,kBAAkB;4BACxC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;4BAC7B,GAAG,EAAE,6CAAmB,CAAC,UAAU;yBACb,CAAC,CAAC;qBAC/B;iBACJ;aACJ;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;wCA9CY,6BAA6B;IADzC,IAAA,qBAAU,GAAE;GACA,6BAA6B,CA8CzC"}
@@ -0,0 +1,7 @@
1
+ import { IPreIncomingDataLog } from "../../../../schema-definitions/datasources/interfaces/enapo/IPreIncomingDataLog";
2
+ import { IPrediInputData } from "../../../../schema-definitions/datasources/interfaces/enapo/IPrediInputData";
3
+ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
4
+ export declare class PreMetadataTransformation extends AbstractTransformation<IPrediInputData, IPreIncomingDataLog[]> {
5
+ name: string;
6
+ protected transformInternal: (element: IPrediInputData) => IPreIncomingDataLog[];
7
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PreMetadataTransformation = void 0;
4
+ const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
5
+ class PreMetadataTransformation extends AbstractTransformation_1.AbstractTransformation {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.name = "PreMetadataTransformation";
9
+ this.transformInternal = (element) => {
10
+ const header = {
11
+ year: element.stored_month.year,
12
+ month: element.stored_month.month,
13
+ month_name: element.stored_month.month_name,
14
+ days_in_stored_month: element.stored_month.days_in_stored_month,
15
+ };
16
+ const log = [];
17
+ for (const company of Object.keys(element.stored_month.companies)) {
18
+ const companyData = element.stored_month.companies[company];
19
+ for (const ean of Object.keys(companyData.EAN_list)) {
20
+ const eanData = companyData.EAN_list[ean];
21
+ log.push({
22
+ ...header,
23
+ ean: ean,
24
+ consumption_point: eanData.consumption_point,
25
+ address: eanData.address,
26
+ location_type: eanData.location_type,
27
+ company_name: companyData.trade_name,
28
+ company_id: company,
29
+ tarif_type: eanData.tarif_type,
30
+ tarif_1t2t: eanData.tarif_1T2T,
31
+ phases: eanData.phases,
32
+ circuit_breaker: eanData.circuit_breaker,
33
+ type_b_meter: eanData.type_B_meter,
34
+ meter_replaced: eanData.meter_replaced,
35
+ });
36
+ }
37
+ }
38
+ return log;
39
+ };
40
+ }
41
+ }
42
+ exports.PreMetadataTransformation = PreMetadataTransformation;
43
+ //# sourceMappingURL=PreMetadataTransfromation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreMetadataTransfromation.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/transformations/pre/PreMetadataTransfromation.ts"],"names":[],"mappings":";;;AAEA,6GAA0G;AAE1G,MAAa,yBAA0B,SAAQ,+CAA8D;IAA7G;;QACW,SAAI,GAAG,2BAA2B,CAAC;QAEhC,sBAAiB,GAAG,CAAC,OAAwB,EAAyB,EAAE;YAC9E,MAAM,MAAM,GAAG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readonly DEFAULT_CHANGE_TIME;
3
+ static extractActual(meterReplaced: string, date: Date, isDaily?: boolean): string;
4
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceSerialNumberExtractor = void 0;
4
+ const DateTime_1 = require("@golemio/core/dist/helpers/DateTime");
5
+ class DeviceSerialNumberExtractor {
6
+ /* Změna elekroměru na odběrném místě v daném měsíci je indikována takto:
7
+ * "meter_replaced": "53435572" ==> beze změny
8
+ * "meter_replaced": "2025-06-19|54292510|55505332" ==> změna "datumZměny|starý|nový"
9
+ * "meter_replaced": "2025-06-19|54292510|55505332|2025-06-30|55505332|96933662" ==> případně dvě a více změn
10
+ */
11
+ static extractActual(meterReplaced, date, isDaily = false) {
12
+ if (!meterReplaced.includes("|")) {
13
+ return meterReplaced;
14
+ }
15
+ const changes = meterReplaced.split("|");
16
+ let actualMeter = changes[1];
17
+ for (let i = 0; i < changes.length / 3; i++) {
18
+ const changeDate = isDaily
19
+ ? DateTime_1.DateTime.fromFormat(changes[i * 3], "yyyy-MM-dd", { timeZone: "Europe/Prague" }).toDate()
20
+ : DateTime_1.DateTime.fromFormat(changes[i * 3], "yyyy-MM-dd", { timeZone: "Europe/Prague" })
21
+ .add(10, "hours")
22
+ .toDate();
23
+ if (date >= changeDate) {
24
+ actualMeter = changes[i * 3 + 2];
25
+ }
26
+ else {
27
+ break;
28
+ }
29
+ }
30
+ return actualMeter;
31
+ }
32
+ }
33
+ exports.DeviceSerialNumberExtractor = DeviceSerialNumberExtractor;
34
+ DeviceSerialNumberExtractor.DEFAULT_CHANGE_TIME = "10:00";
35
+ //# sourceMappingURL=DeviceSerialNumberExtractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceSerialNumberExtractor.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/enapo/transformations/pre/helpers/DeviceSerialNumberExtractor.ts"],"names":[],"mappings":";;;AAAA,kEAA+D;AAE/D,MAAa,2BAA2B;IAEpC;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,aAAqB,EAAE,IAAU,EAAE,UAAmB,KAAK;QACnF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9B,OAAO,aAAa,CAAC;SACxB;QAED,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YACzC,MAAM,UAAU,GAAG,OAAO;gBACtB,CAAC,CAAC,mBAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;gBAC3F,CAAC,CAAC,mBAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;qBAC3E,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC;qBAChB,MAAM,EAAE,CAAC;YACpB,IAAI,IAAI,IAAI,UAAU,EAAE;gBACpB,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;aACpC;iBAAM;gBACH,MAAM;aACT;SACJ;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;;AA7BL,kEA8BC;AA7B2B,+CAAmB,GAAG,OAAO,CAAC"}
@@ -15,6 +15,7 @@ class EnapoWorker extends integration_engine_1.AbstractWorker {
15
15
  };
16
16
  // Register tasks
17
17
  this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasTask));
18
+ this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPrediTask));
18
19
  }
19
20
  }
20
21
  exports.EnapoWorker = EnapoWorker;
@@ -1 +1 @@
1
- {"version":3,"file":"EnapoWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/workers/EnapoWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AAEvE,4CAAiD;AACjD,kCAA2C;AAC3C,gFAA6E;AAE7E,MAAa,WAAY,SAAQ,mCAAc;IAG3C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,6BAAiB,CAAC;QAS5B,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QAPE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9F,CAAC;CAMJ;AAdD,kCAcC"}
1
+ {"version":3,"file":"EnapoWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/workers/EnapoWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AAEvE,4CAAiD;AACjD,kCAA2C;AAC3C,gFAA6E;AAE7E,MAAa,WAAY,SAAQ,mCAAc;IAG3C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,6BAAiB,CAAC;QAU5B,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QARE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,YAAY,CAAC,mBAAc,CAAC,OAAO,CAAQ,qDAAyB,CAAC,cAAc,CAAC,CAAC,CAAC;IAC/F,CAAC;CAMJ;AAfD,kCAeC"}
@@ -1,5 +1,5 @@
1
1
  import { EnapoMeasurementsRepository } from "../../repositories/EnapoMeasurementsRepository";
2
- import { IEnapoMeasurementsDto } from "../../../../schema-definitions/models/interfaces/IEnapoMeasurmentsDto";
2
+ import { IEnapoMeasurementsDto } from "../../../../schema-definitions/models/enapo/interfaces/IEnapoMeasurmentsDto";
3
3
  import { AbstractTask } from "@golemio/core/dist/integration-engine";
4
4
  export declare abstract class AbstractEnapoFetchMeasurementsTask<T extends object> extends AbstractTask<T> {
5
5
  protected abstract measurementsRepository: EnapoMeasurementsRepository;
@@ -17,7 +17,7 @@ class AbstractEnapoFetchMeasurementsTask extends integration_engine_1.AbstractTa
17
17
  }
18
18
  const uniqueValues = new Set();
19
19
  batch = batch.filter((item) => {
20
- const key = `${item.timestamp.getTime()}_${item.var}_${item.place_id}_${item.eic}`;
20
+ const key = `${item.timestamp.getTime()}_${item.var}_${item.place_id}_${item.id}`;
21
21
  if (uniqueValues.has(key))
22
22
  return false;
23
23
  uniqueValues.add(key);
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractEnapoFetchMeasurementsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/AbstractEnapoFetchMeasurementsTask.ts"],"names":[],"mappings":";;;AAAA,+CAAwD;AACxD,yFAA+F;AAG/F,8EAAqE;AAErE,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC,MAAsB,kCAAqD,SAAQ,iCAAe;IAG9F;QACI,KAAK,CAAC,6BAAiB,CAAC,CAAC;IAC7B,CAAC;IAES,KAAK,CAAC,mBAAmB,CAAC,IAA6B,EAAE,aAAsB,KAAK;QAC1F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,uBAAuB,EAAE;YAC3D,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,uBAAuB,CAAC,CAAC;YAEvD,IAAI,CAAC,UAAU,EAAE;gBACb,KAAK,GAAG,4DAA+B,CAAC,MAAM,CAAC,KAAK,CAA4B,CAAC;aACpF;YAED,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;YACvC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC1B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;gBACnF,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACxC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACtB,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC,CAAC;YAEH,IAAI,KAAK,CAAC,MAAM,EAAE;gBACd,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACrD;SACJ;IACL,CAAC;CACJ;AA5BD,gFA4BC"}
1
+ {"version":3,"file":"AbstractEnapoFetchMeasurementsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/AbstractEnapoFetchMeasurementsTask.ts"],"names":[],"mappings":";;;AAAA,+CAAwD;AACxD,yFAA+F;AAG/F,8EAAqE;AAErE,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC,MAAsB,kCAAqD,SAAQ,iCAAe;IAG9F;QACI,KAAK,CAAC,6BAAiB,CAAC,CAAC;IAC7B,CAAC;IAES,KAAK,CAAC,mBAAmB,CAAC,IAA6B,EAAE,aAAsB,KAAK;QAC1F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,uBAAuB,EAAE;YAC3D,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,uBAAuB,CAAC,CAAC;YAEvD,IAAI,CAAC,UAAU,EAAE;gBACb,KAAK,GAAG,4DAA+B,CAAC,MAAM,CAAC,KAAK,CAA4B,CAAC;aACpF;YAED,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;YACvC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC1B,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;gBAClF,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;oBAAE,OAAO,KAAK,CAAC;gBACxC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACtB,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC,CAAC;YAEH,IAAI,KAAK,CAAC,MAAM,EAAE;gBACd,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACrD;SACJ;IACL,CAAC;CACJ;AA5BD,gFA4BC"}
@@ -0,0 +1,26 @@
1
+ import { EnapoMeasurementsRepository } from "../../repositories/EnapoMeasurementsRepository";
2
+ import { PreIncomingDataLogRepository } from "../../repositories/PreIncomingDataLogRepository";
3
+ import { PreDailyMeasurementsTransformation } from "../../transformations/pre/PreDailyMeasurementsTransformation";
4
+ import { PreMeasurementsTransformation } from "../../transformations/pre/PreMeasurementsTransformation";
5
+ import { PreMetadataTransformation } from "../../transformations/pre/PreMetadataTransfromation";
6
+ import { IPrediInputData } from "../../../../schema-definitions/datasources/interfaces/enapo/IPrediInputData";
7
+ import { ILogger } from "@golemio/core/dist/helpers";
8
+ import { ISimpleConfig } from "@golemio/core/dist/helpers/configuration/ISimpleConfig";
9
+ import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
10
+ import { AbstractTaskJsonSchema } from "@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema";
11
+ import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
12
+ export declare class EnapoPrediTask extends AbstractTaskJsonSchema<IPrediInputData> {
13
+ protected config: ISimpleConfig;
14
+ protected measurementsRepository: EnapoMeasurementsRepository;
15
+ protected logger: ILogger;
16
+ protected preMeasurementsTransformation: PreMeasurementsTransformation;
17
+ protected preDailyMeasurementsTransformation: PreDailyMeasurementsTransformation;
18
+ protected preMetadataTransformation: PreMetadataTransformation;
19
+ protected dbConnector: IDatabaseConnector;
20
+ protected preIncomingDataLogRepository: PreIncomingDataLogRepository;
21
+ queueName: string;
22
+ queueTtl: number;
23
+ schema: JSONSchemaValidator;
24
+ constructor(config: ISimpleConfig, measurementsRepository: EnapoMeasurementsRepository, logger: ILogger, preMeasurementsTransformation: PreMeasurementsTransformation, preDailyMeasurementsTransformation: PreDailyMeasurementsTransformation, preMetadataTransformation: PreMetadataTransformation, dbConnector: IDatabaseConnector, preIncomingDataLogRepository: PreIncomingDataLogRepository);
25
+ protected execute(data: IPrediInputData): Promise<void>;
26
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.EnapoPrediTask = void 0;
16
+ const constants_1 = require("../../constants");
17
+ const EnapoWorkerContainerToken_1 = require("../../ioc/EnapoWorkerContainerToken");
18
+ const EnapoMeasurementsRepository_1 = require("../../repositories/EnapoMeasurementsRepository");
19
+ const PreIncomingDataLogRepository_1 = require("../../repositories/PreIncomingDataLogRepository");
20
+ const PreDailyMeasurementsTransformation_1 = require("../../transformations/pre/PreDailyMeasurementsTransformation");
21
+ const PreMeasurementsTransformation_1 = require("../../transformations/pre/PreMeasurementsTransformation");
22
+ const PreMetadataTransfromation_1 = require("../../transformations/pre/PreMetadataTransfromation");
23
+ const EnapoPreInputSchema_1 = require("../../../../schema-definitions/datasources/enapo/EnapoPreInputSchema");
24
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
25
+ const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
26
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
27
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
28
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
29
+ let EnapoPrediTask = exports.EnapoPrediTask = class EnapoPrediTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
30
+ constructor(config, measurementsRepository, logger, preMeasurementsTransformation, preDailyMeasurementsTransformation, preMetadataTransformation, dbConnector, preIncomingDataLogRepository) {
31
+ super(constants_1.ENAPO_WORKER_NAME);
32
+ this.config = config;
33
+ this.measurementsRepository = measurementsRepository;
34
+ this.logger = logger;
35
+ this.preMeasurementsTransformation = preMeasurementsTransformation;
36
+ this.preDailyMeasurementsTransformation = preDailyMeasurementsTransformation;
37
+ this.preMetadataTransformation = preMetadataTransformation;
38
+ this.dbConnector = dbConnector;
39
+ this.preIncomingDataLogRepository = preIncomingDataLogRepository;
40
+ this.queueName = "processPrediData";
41
+ this.queueTtl = 60 * 60 * 1000;
42
+ this.schema = new golemio_validator_1.JSONSchemaValidator("PrediInputDataValidator", EnapoPreInputSchema_1.enapoPreInputSchema);
43
+ }
44
+ async execute(data) {
45
+ const transaction = await this.dbConnector.getConnection().transaction();
46
+ try {
47
+ let transformedMeasurements = this.preMeasurementsTransformation.transformElement(data);
48
+ await this.measurementsRepository.bulkSave(transformedMeasurements, undefined, undefined, undefined, transaction);
49
+ transformedMeasurements = [];
50
+ let transformedDailyMeasurements = this.preDailyMeasurementsTransformation.transformElement(data);
51
+ await this.measurementsRepository.bulkSave(transformedDailyMeasurements, undefined, undefined, undefined, transaction);
52
+ transformedDailyMeasurements = [];
53
+ let prelog = this.preMetadataTransformation.transformElement(data);
54
+ await this.preIncomingDataLogRepository.bulkSave(prelog, undefined, undefined, undefined, transaction);
55
+ prelog = [];
56
+ await transaction.commit();
57
+ }
58
+ catch (err) {
59
+ await transaction.rollback();
60
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
61
+ throw err;
62
+ }
63
+ throw new golemio_errors_1.GeneralError("Failed to save ENAPO Predi data", this.constructor.name, err);
64
+ }
65
+ }
66
+ };
67
+ exports.EnapoPrediTask = EnapoPrediTask = __decorate([
68
+ (0, tsyringe_1.injectable)(),
69
+ __param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.SimpleConfig)),
70
+ __param(1, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoMeasurementsRepository)),
71
+ __param(2, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
72
+ __param(3, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PreMeasurementsTransformation)),
73
+ __param(4, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PreDailyMeasurementsTransformation)),
74
+ __param(5, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PreMetadataTransformation)),
75
+ __param(6, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
76
+ __param(7, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PreIncomingDataLogRepository)),
77
+ __metadata("design:paramtypes", [Object, EnapoMeasurementsRepository_1.EnapoMeasurementsRepository, Object, PreMeasurementsTransformation_1.PreMeasurementsTransformation,
78
+ PreDailyMeasurementsTransformation_1.PreDailyMeasurementsTransformation,
79
+ PreMetadataTransfromation_1.PreMetadataTransformation, Object, PreIncomingDataLogRepository_1.PreIncomingDataLogRepository])
80
+ ], EnapoPrediTask);
81
+ //# sourceMappingURL=EnapoPrediTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnapoPrediTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/EnapoPrediTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAwD;AACxD,mFAAoF;AACpF,gGAAiG;AACjG,kGAAmG;AACnG,qHAAsH;AACtH,2GAA4G;AAC5G,mGAAoG;AACpG,8GAAiF;AAKjF,wEAAqE;AACrE,iHAA8G;AAC9G,6EAA8F;AAC9F,mFAAkF;AAClF,iEAAwE;AAGjE,IAAM,cAAc,4BAApB,MAAM,cAAe,SAAQ,+CAAuC;IAKvE,YACoC,MAA+B,EAE/D,sBAA6D,EACnC,MAAyB,EAEnD,6BAAsE,EAEtE,kCAAgF,EAEhF,yBAA8D,EACzB,WAAyC,EAE9E,4BAAoE;QAEpE,KAAK,CAAC,6BAAiB,CAAC,CAAC;QAdiB,WAAM,GAAN,MAAM,CAAe;QAErD,2BAAsB,GAAtB,sBAAsB,CAA6B;QACzB,WAAM,GAAN,MAAM,CAAS;QAEzC,kCAA6B,GAA7B,6BAA6B,CAA+B;QAE5D,uCAAkC,GAAlC,kCAAkC,CAAoC;QAEtE,8BAAyB,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AE7B,IAAI,GAAG,YAAY,qCAAoB,EAAE;gBACrC,MAAM,GAAG,CAAC;aACb;YAED,MAAM,IAAI,6BAAY,CAAC,iCAAiC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SACzF;IACL,CAAC;CACJ,CAAA;yBArDY,cAAc;IAD1B,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;IAC9B,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,2BAA2B,CAAC,CAAA;IAE7D,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,6BAA6B,CAAC,CAAA;IAE/D,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,kCAAkC,CAAC,CAAA;IAEpE,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,yBAAyB,CAAC,CAAA;IAE3D,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IACnC,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,4BAA4B,CAAC,CAAA;6CAT7B,yDAA2B,UAGpB,6DAA6B;QAExB,uEAAkC;QAE3C,qDAAyB,UAGtB,2DAA4B;GAlB/D,cAAc,CAqD1B"}
@@ -0,0 +1,3 @@
1
+ import { JSONSchemaType } from "@golemio/core/dist/shared/ajv";
2
+ import { IPrediInputData } from "../interfaces/enapo/IPrediInputData";
3
+ export declare const enapoPreInputSchema: JSONSchemaType<IPrediInputData>;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enapoPreInputSchema = void 0;
4
+ exports.enapoPreInputSchema = {
5
+ type: "object",
6
+ properties: {
7
+ stored_month: {
8
+ type: "object",
9
+ properties: {
10
+ year: { type: "integer" },
11
+ month: { type: "integer" },
12
+ month_name: { type: "string" },
13
+ days_in_stored_month: { type: "integer" },
14
+ EANs_in_total: { type: "integer" },
15
+ companies_in_total: { type: "integer" },
16
+ companies: {
17
+ type: "object",
18
+ patternProperties: {
19
+ "^[0-9]+$": {
20
+ type: "object",
21
+ properties: {
22
+ trade_name: { type: "string" },
23
+ EAN_list: {
24
+ type: "object",
25
+ patternProperties: {
26
+ "^[0-9]+$": {
27
+ type: "object",
28
+ properties: {
29
+ daily_data_Wh_per_EAN: {
30
+ type: "object",
31
+ additionalProperties: true,
32
+ properties: {
33
+ T1_Wh_total: { type: "array", items: { type: "number" } },
34
+ T2_Wh_total: { type: "array", items: { type: "number" } },
35
+ T1_plus_T2_Wh_total: { type: "array", items: { type: "number" } },
36
+ T1_Wh_raw_data: {
37
+ type: "array",
38
+ items: {
39
+ type: "array",
40
+ items: {
41
+ type: "array",
42
+ items: [{ type: "string" }, { type: "number" }],
43
+ minItems: 2,
44
+ maxItems: 2,
45
+ },
46
+ },
47
+ },
48
+ T2_Wh_raw_data: {
49
+ type: "array",
50
+ items: {
51
+ type: "array",
52
+ items: {
53
+ type: "array",
54
+ items: [{ type: "string" }, { type: "number" }],
55
+ minItems: 2,
56
+ maxItems: 2,
57
+ },
58
+ },
59
+ },
60
+ },
61
+ required: [
62
+ "T1_Wh_total",
63
+ "T2_Wh_total",
64
+ "T1_plus_T2_Wh_total",
65
+ "T1_Wh_raw_data",
66
+ "T2_Wh_raw_data",
67
+ ],
68
+ },
69
+ consumption_point: { type: "string" },
70
+ address: { type: "string" },
71
+ tarif_type: { type: "string" },
72
+ tarif_1T2T: { type: "string" },
73
+ phases: { type: "string" },
74
+ circuit_breaker: { type: "string" },
75
+ location_type: { type: "string" },
76
+ found_in_converge_reports: { type: "string" },
77
+ type_B_meter: { type: "string" },
78
+ meter_replaced: { type: "string" },
79
+ },
80
+ additionalProperties: true,
81
+ required: [
82
+ "daily_data_Wh_per_EAN",
83
+ "address",
84
+ "tarif_type",
85
+ "tarif_1T2T",
86
+ "phases",
87
+ "circuit_breaker",
88
+ "location_type",
89
+ "meter_replaced",
90
+ ],
91
+ },
92
+ },
93
+ additionalProperties: true,
94
+ required: [],
95
+ },
96
+ },
97
+ additionalProperties: true,
98
+ required: ["EAN_list"],
99
+ },
100
+ },
101
+ additionalProperties: true,
102
+ required: [],
103
+ },
104
+ },
105
+ additionalProperties: true,
106
+ required: ["companies"],
107
+ },
108
+ project_name: { type: "string" },
109
+ },
110
+ additionalProperties: true,
111
+ required: ["stored_month"],
112
+ };
113
+ //# sourceMappingURL=EnapoPreInputSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnapoPreInputSchema.js","sourceRoot":"","sources":["../../../../src/schema-definitions/datasources/enapo/EnapoPreInputSchema.ts"],"names":[],"mappings":";;;AAGa,QAAA,mBAAmB,GAAoC;IAChE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,YAAY,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBACzB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC1B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC9B,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBACzC,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAClC,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBACvC,SAAS,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,iBAAiB,EAAE;wBACf,UAAU,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACR,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gCAC9B,QAAQ,EAAE;oCACN,IAAI,EAAE,QAAQ;oCACd,iBAAiB,EAAE;wCACf,UAAU,EAAE;4CACR,IAAI,EAAE,QAAQ;4CACd,UAAU,EAAE;gDACR,qBAAqB,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Q,EAAE;gDAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gDAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gDAC1B,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gDACnC,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gDACjC,yBAAyB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gDAC7C,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gDAChC,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;6CACrC;4CACD,oBAAoB,EAAE,IAAI;4CAC1B,QAAQ,EAAE;gDACN,uBAAuB;gDACvB,SAAS;gDACT,YAAY;gDACZ,YAAY;gDACZ,QAAQ;gDACR,iBAAiB;gDACjB,eAAe;gDACf,gBAAgB;6CACnB;yCACJ;qCACJ;oCACD,oBAAoB,EAAE,IAAI;oCAC1B,QAAQ,EAAE,EAAE;iCACf;6BACJ;4BACD,oBAAoB,EAAE,IAAI;4BAC1B,QAAQ,EAAE,CAAC,UAAU,CAAC;yBACzB;qBACJ;oBACD,oBAAoB,EAAE,IAAI;oBAC1B,QAAQ,EAAE,EAAE;iBACf;aACJ;YACD,oBAAoB,EAAE,IAAI;YAC1B,QAAQ,EAAE,CAAC,WAAW,CAAC;SAC1B;QACD,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACnC;IACD,oBAAoB,EAAE,IAAI;IAC1B,QAAQ,EAAE,CAAC,cAAc,CAAC;CAC7B,CAAC"}
@@ -1,5 +1,10 @@
1
1
  export declare enum MeasurementVariable {
2
2
  Core = "core",
3
3
  Core2 = "core2",
4
- CoreDiff = "corediff"
4
+ CoreDiff = "corediff",
5
+ EFwActi_VT = "EFwActi_VT",
6
+ EFwActi_NT = "EFwActi_NT",
7
+ EActi_VT_DaySum = "EActi_VT_DaySum",
8
+ EActi_NT_DaySum = "EActi_NT_DaySum",
9
+ EActi_VT_NT_DaySum = "EActi_VT_NT_DaySum"
5
10
  }
@@ -6,5 +6,10 @@ var MeasurementVariable;
6
6
  MeasurementVariable["Core"] = "core";
7
7
  MeasurementVariable["Core2"] = "core2";
8
8
  MeasurementVariable["CoreDiff"] = "corediff";
9
+ MeasurementVariable["EFwActi_VT"] = "EFwActi_VT";
10
+ MeasurementVariable["EFwActi_NT"] = "EFwActi_NT";
11
+ MeasurementVariable["EActi_VT_DaySum"] = "EActi_VT_DaySum";
12
+ MeasurementVariable["EActi_NT_DaySum"] = "EActi_NT_DaySum";
13
+ MeasurementVariable["EActi_VT_NT_DaySum"] = "EActi_VT_NT_DaySum";
9
14
  })(MeasurementVariable || (exports.MeasurementVariable = MeasurementVariable = {}));
10
15
  //# sourceMappingURL=MeasurementVariableEnum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MeasurementVariableEnum.js","sourceRoot":"","sources":["../../../../src/schema-definitions/datasources/helpers/MeasurementVariableEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,oCAAa,CAAA;IACb,sCAAe,CAAA;IACf,4CAAqB,CAAA;AACzB,CAAC,EAJW,mBAAmB,mCAAnB,mBAAmB,QAI9B"}
1
+ {"version":3,"file":"MeasurementVariableEnum.js","sourceRoot":"","sources":["../../../../src/schema-definitions/datasources/helpers/MeasurementVariableEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC3B,oCAAa,CAAA;IACb,sCAAe,CAAA;IACf,4CAAqB,CAAA;IACrB,gDAAyB,CAAA;IACzB,gDAAyB,CAAA;IACzB,0DAAmC,CAAA;IACnC,0DAAmC,CAAA;IACnC,gEAAyC,CAAA;AAC7C,CAAC,EATW,mBAAmB,mCAAnB,mBAAmB,QAS9B"}
@@ -0,0 +1,17 @@
1
+ export interface IEnapoMetadata {
2
+ id: string;
3
+ id_type: "ean" | "eic";
4
+ source: string;
5
+ address: string;
6
+ location_type: string;
7
+ company_name: string;
8
+ company_id: string;
9
+ custom_fields: Partial<IEnapoCustomFields>;
10
+ }
11
+ export interface IEnapoCustomFields {
12
+ tarif_type: string;
13
+ tarif_1T2T: string;
14
+ phases: string;
15
+ circuit_breaker: string;
16
+ type_B_meter: boolean;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IEnapoMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEnapoMetadata.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/datasources/interfaces/enapo/IEnapoMetadata.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export interface IPreIncomingDataLog {
2
+ ean: string;
3
+ year: number;
4
+ month: number;
5
+ month_name: string;
6
+ days_in_stored_month: number;
7
+ consumption_point: string;
8
+ address: string;
9
+ location_type: string;
10
+ company_name: string;
11
+ company_id: string;
12
+ tarif_type: string;
13
+ tarif_1t2t: string;
14
+ phases: string;
15
+ circuit_breaker: string;
16
+ type_b_meter: string;
17
+ meter_replaced: string;
18
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPreIncomingDataLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPreIncomingDataLog.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/datasources/interfaces/enapo/IPreIncomingDataLog.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ export interface IPrediInputData {
2
+ project_name: string;
3
+ stored_month: IPrediStoredMonth;
4
+ }
5
+ export interface IPrediStoredMonth {
6
+ year: number;
7
+ month: number;
8
+ month_name: string;
9
+ days_in_stored_month: number;
10
+ companies_in_total: number;
11
+ EANs_in_total: number;
12
+ companies: Record<string, IPrediCompany>;
13
+ }
14
+ export interface IPrediCompany {
15
+ trade_name: string;
16
+ EAN_list: Record<string, IPrediEanDetail>;
17
+ }
18
+ export interface IPrediEanDetail {
19
+ consumption_point: string;
20
+ address: string;
21
+ tarif_type: string;
22
+ tarif_1T2T: string;
23
+ phases: string;
24
+ circuit_breaker: string;
25
+ location_type: string;
26
+ found_in_converge_reports: string;
27
+ type_B_meter: string;
28
+ meter_replaced: string;
29
+ daily_data_Wh_per_EAN: IPrediDailyDataPerEan;
30
+ }
31
+ export interface IPrediDailyDataPerEan {
32
+ T1_Wh_total: number[];
33
+ T2_Wh_total: number[];
34
+ T1_plus_T2_Wh_total: number[];
35
+ T1_Wh_raw_data: Array<Array<[string, number]>>;
36
+ T2_Wh_raw_data: Array<Array<[string, number]>>;
37
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPrediInputData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPrediInputData.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/datasources/interfaces/enapo/IPrediInputData.ts"],"names":[],"mappings":""}
@@ -5,7 +5,8 @@ export declare class EnapoMeasurementsModel extends Model<IEnapoMeasurementsDto>
5
5
  static TABLE_NAME: string;
6
6
  static REPOSITORY_NAME: string;
7
7
  static JSON_SCHEMA_VALIDATOR_NAME: string;
8
- eic: string;
8
+ id: string;
9
+ id_type: string;
9
10
  value: number;
10
11
  timestamp: Date;
11
12
  var: string;