@golemio/fcd 1.2.4 → 1.2.5-dev.1262829891

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 (93) hide show
  1. package/db/example/sql_dump.sql +7 -0
  2. package/db/migrations/postgresql/20240419120732-fcd-new-view.js +53 -0
  3. package/db/migrations/postgresql/sqls/20240419120732-fcd-new-view-down.sql +2 -0
  4. package/db/migrations/postgresql/sqls/20240419120732-fcd-new-view-up.sql +78 -0
  5. package/dist/integration-engine/index.d.ts +2 -2
  6. package/dist/integration-engine/index.js +3 -3
  7. package/dist/integration-engine/index.js.map +1 -1
  8. package/dist/integration-engine/ioc/Di.d.ts +3 -0
  9. package/dist/integration-engine/ioc/Di.js +29 -0
  10. package/dist/integration-engine/ioc/Di.js.map +1 -0
  11. package/dist/integration-engine/ioc/ModuleContainer.d.ts +10 -0
  12. package/dist/integration-engine/ioc/ModuleContainer.js +14 -0
  13. package/dist/integration-engine/ioc/ModuleContainer.js.map +1 -0
  14. package/dist/integration-engine/repositories/fcd/FloatingCarDataRegionsRepository.d.ts +6 -0
  15. package/dist/integration-engine/repositories/fcd/FloatingCarDataRegionsRepository.js +37 -0
  16. package/dist/integration-engine/repositories/fcd/FloatingCarDataRegionsRepository.js.map +1 -0
  17. package/dist/integration-engine/repositories/fcd/FloatingCarDataRepository.d.ts +6 -0
  18. package/dist/integration-engine/repositories/fcd/FloatingCarDataRepository.js +37 -0
  19. package/dist/integration-engine/repositories/fcd/FloatingCarDataRepository.js.map +1 -0
  20. package/dist/integration-engine/schemas/floatingCarData.d.ts +324 -0
  21. package/dist/integration-engine/schemas/floatingCarData.js +346 -0
  22. package/dist/integration-engine/schemas/floatingCarData.js.map +1 -0
  23. package/dist/integration-engine/transformations/FloatingCarDataTransformation.d.ts +2 -1
  24. package/dist/integration-engine/transformations/FloatingCarDataTransformation.js.map +1 -1
  25. package/dist/integration-engine/transformations/index.d.ts +2 -0
  26. package/dist/integration-engine/transformations/index.js +19 -0
  27. package/dist/integration-engine/transformations/index.js.map +1 -0
  28. package/dist/integration-engine/transformations/{FloatingCarDataInterface.d.ts → interfaces/FloatingCarDataInterface.d.ts} +2 -48
  29. package/dist/integration-engine/transformations/interfaces/FloatingCarDataInterface.js.map +1 -0
  30. package/dist/integration-engine/workers/FCDWorker.d.ts +7 -0
  31. package/dist/integration-engine/workers/FCDWorker.js +21 -0
  32. package/dist/integration-engine/workers/FCDWorker.js.map +1 -0
  33. package/dist/integration-engine/workers/index.d.ts +2 -0
  34. package/dist/integration-engine/workers/index.js +6 -0
  35. package/dist/integration-engine/workers/index.js.map +1 -0
  36. package/dist/integration-engine/workers/tasks/RegionsDataRetentionTask.d.ts +10 -0
  37. package/dist/integration-engine/workers/tasks/RegionsDataRetentionTask.js +59 -0
  38. package/dist/integration-engine/workers/tasks/RegionsDataRetentionTask.js.map +1 -0
  39. package/dist/integration-engine/workers/tasks/SaveFloatingCarDataTask.d.ts +13 -0
  40. package/dist/integration-engine/workers/tasks/SaveFloatingCarDataTask.js +62 -0
  41. package/dist/integration-engine/workers/tasks/SaveFloatingCarDataTask.js.map +1 -0
  42. package/dist/integration-engine/workers/tasks/SaveRegionsDataTask.d.ts +15 -0
  43. package/dist/integration-engine/workers/tasks/SaveRegionsDataTask.js +68 -0
  44. package/dist/integration-engine/workers/tasks/SaveRegionsDataTask.js.map +1 -0
  45. package/dist/integration-engine/workers/tasks/index.d.ts +3 -0
  46. package/dist/integration-engine/workers/tasks/index.js +20 -0
  47. package/dist/integration-engine/workers/tasks/index.js.map +1 -0
  48. package/dist/output-gateway/FCDRouter.d.ts +4 -2
  49. package/dist/output-gateway/FCDRouter.js +17 -7
  50. package/dist/output-gateway/FCDRouter.js.map +1 -1
  51. package/dist/output-gateway/models/FloatingCarDataModel.d.ts +1 -1
  52. package/dist/output-gateway/models/FloatingCarDataModel.js.map +1 -1
  53. package/dist/output-gateway/models/FloatingCarExtendedDataModel.d.ts +1 -1
  54. package/dist/output-gateway/models/FloatingCarExtendedDataModel.js.map +1 -1
  55. package/dist/output-gateway/models/FloatingCarWithOsmPathDataModel.d.ts +11 -0
  56. package/dist/output-gateway/models/FloatingCarWithOsmPathDataModel.js +54 -0
  57. package/dist/output-gateway/models/FloatingCarWithOsmPathDataModel.js.map +1 -0
  58. package/dist/output-gateway/models/FloatingCarWithOsmPathExtendedDataModel.d.ts +12 -0
  59. package/dist/output-gateway/models/FloatingCarWithOsmPathExtendedDataModel.js +61 -0
  60. package/dist/output-gateway/models/FloatingCarWithOsmPathExtendedDataModel.js.map +1 -0
  61. package/dist/output-gateway/models/index.d.ts +2 -0
  62. package/dist/output-gateway/models/index.js +2 -0
  63. package/dist/output-gateway/models/index.js.map +1 -1
  64. package/dist/output-gateway/transformations/OutputFloatingCarDataTransformation.d.ts +6 -5
  65. package/dist/output-gateway/transformations/OutputFloatingCarDataTransformation.js +42 -50
  66. package/dist/output-gateway/transformations/OutputFloatingCarDataTransformation.js.map +1 -1
  67. package/dist/output-gateway/transformations/interfaces/outputApiFloatingCarData.d.ts +13 -0
  68. package/dist/output-gateway/transformations/interfaces/outputApiFloatingCarData.js +3 -0
  69. package/dist/output-gateway/transformations/interfaces/outputApiFloatingCarData.js.map +1 -0
  70. package/dist/schema-definitions/index.js +1 -0
  71. package/dist/schema-definitions/index.js.map +1 -1
  72. package/dist/schema-definitions/interfaces/FloatingCarDataInterface.d.ts +38 -0
  73. package/dist/schema-definitions/interfaces/FloatingCarDataInterface.js +3 -0
  74. package/dist/schema-definitions/interfaces/FloatingCarDataInterface.js.map +1 -0
  75. package/dist/schema-definitions/schemas/fcd_output_schema.d.ts +1 -0
  76. package/dist/schema-definitions/schemas/fcd_output_schema.js +2 -1
  77. package/dist/schema-definitions/schemas/fcd_output_schema.js.map +1 -1
  78. package/docs/assets/db_schema.png +0 -0
  79. package/docs/assets/schemas/floating_car_data_rabbitmq_message.json +1954 -0
  80. package/docs/assets/schemas/floating_car_data_schema.xml +18255 -0
  81. package/docs/implementation_documentation.md +103 -0
  82. package/package.json +3 -3
  83. package/dist/integration-engine/FCDWorker.d.ts +0 -13
  84. package/dist/integration-engine/FCDWorker.js +0 -71
  85. package/dist/integration-engine/FCDWorker.js.map +0 -1
  86. package/dist/integration-engine/queueDefinitions.d.ts +0 -3
  87. package/dist/integration-engine/queueDefinitions.js +0 -46
  88. package/dist/integration-engine/queueDefinitions.js.map +0 -1
  89. package/dist/integration-engine/transformations/FloatingCarDataInterface.js.map +0 -1
  90. package/dist/output-gateway/transformations/getLocationPointsFromTsString.d.ts +0 -2
  91. package/dist/output-gateway/transformations/getLocationPointsFromTsString.js +0 -19
  92. package/dist/output-gateway/transformations/getLocationPointsFromTsString.js.map +0 -1
  93. /package/dist/integration-engine/transformations/{FloatingCarDataInterface.js → interfaces/FloatingCarDataInterface.js} +0 -0
@@ -0,0 +1,62 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.SaveFloatingCarDataTask = void 0;
25
+ const _ie_1 = require("../..");
26
+ const _sch_1 = require("../../../schema-definitions");
27
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
28
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
29
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
30
+ const ModuleContainer_1 = require("../../ioc/ModuleContainer");
31
+ const FloatingCarDataRepository_1 = require("../../repositories/fcd/FloatingCarDataRepository");
32
+ const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
33
+ const floatingCarData_1 = require("../../schemas/floatingCarData");
34
+ let SaveFloatingCarDataTask = exports.SaveFloatingCarDataTask = class SaveFloatingCarDataTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
35
+ constructor(floatingCarDataTransformation, floatingCarDataRepository) {
36
+ super(_sch_1.FCD.name.toLowerCase());
37
+ this.floatingCarDataTransformation = floatingCarDataTransformation;
38
+ this.floatingCarDataRepository = floatingCarDataRepository;
39
+ this.queueName = "saveFloatingCarData";
40
+ this.queueTtl = 59 * 60 * 1000;
41
+ this.schema = new golemio_validator_1.JSONSchemaValidator("floatingCarDataValidation", floatingCarData_1.floatingCarDataJsonSchema);
42
+ }
43
+ execute(data) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ const transformedData = yield this.floatingCarDataTransformation.transform(data);
47
+ yield this.floatingCarDataRepository.save(transformedData);
48
+ }
49
+ catch (error) {
50
+ throw new golemio_errors_1.GeneralError("Error while processing Floating Car Data.", "SaveFloatingCarDataTask", error, 422);
51
+ }
52
+ });
53
+ }
54
+ };
55
+ exports.SaveFloatingCarDataTask = SaveFloatingCarDataTask = __decorate([
56
+ (0, tsyringe_1.injectable)(),
57
+ __param(0, (0, tsyringe_1.inject)(ModuleContainer_1.ModuleContainerToken.FloatingCarDataTransformation)),
58
+ __param(1, (0, tsyringe_1.inject)(ModuleContainer_1.ModuleContainerToken.FloatingCarDataRepository)),
59
+ __metadata("design:paramtypes", [_ie_1.FloatingCarDataTransformation,
60
+ FloatingCarDataRepository_1.FloatingCarDataRepository])
61
+ ], SaveFloatingCarDataTask);
62
+ //# sourceMappingURL=SaveFloatingCarDataTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SaveFloatingCarDataTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/SaveFloatingCarDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAsE;AACtE,sDAA2B;AAC3B,6EAAwE;AACxE,mFAAkF;AAClF,iEAAwE;AACxE,+DAA+D;AAC/D,gGAA2F;AAC3F,iHAA8G;AAC9G,mEAAwE;AAGjE,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,+CAAwC;IAMjF,YAEI,6BAAoE,EAEpE,yBAA4D;QAE5D,KAAK,CAAC,UAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAJtB,kCAA6B,GAA7B,6BAA6B,CAA+B;QAE5D,8BAAyB,GAAzB,yBAAyB,CAA2B;QAThD,cAAS,GAAG,qBAAqB,CAAC;QAElC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAChC,WAAM,GAAG,IAAI,uCAAmB,CAAC,2BAA2B,EAAE,2CAAyB,CAAC,CAAC;IASnG,CAAC;IAEe,OAAO,CAAC,IAAsB;;YAC1C,IAAI;gBACA,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACjF,MAAM,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAC9D;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,IAAI,6BAAY,CAAC,2CAA2C,EAAE,yBAAyB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aAC9G;QACL,CAAC;KAAA;CACJ,CAAA;kCAvBY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAQJ,WAAA,IAAA,iBAAM,EAAC,sCAAoB,CAAC,6BAA6B,CAAC,CAAA;IAE1D,WAAA,IAAA,iBAAM,EAAC,sCAAoB,CAAC,yBAAyB,CAAC,CAAA;qCADhB,mCAA6B;QAEjC,qDAAyB;GAVvD,uBAAuB,CAuBnC"}
@@ -0,0 +1,15 @@
1
+ import { LteCze90PointsChecker } from "../../helpers/LteCze90PointsChecker";
2
+ import { FloatingCarDataTransformation, IFloatingCarData } from "../..";
3
+ import { FloatingCarDataRegionsRepository } from "../../repositories/fcd/FloatingCarDataRegionsRepository";
4
+ import { AbstractTaskJsonSchema } from "@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema";
5
+ import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
6
+ export declare class SaveRegionsDataTask extends AbstractTaskJsonSchema<IFloatingCarData> {
7
+ private floatingCarDataTransformation;
8
+ private lteCze90PointsChecker;
9
+ private floatingCarDataRegionsModel;
10
+ readonly queueName = "saveRegionsData";
11
+ readonly queueTtl: number;
12
+ protected schema: JSONSchemaValidator;
13
+ constructor(floatingCarDataTransformation: FloatingCarDataTransformation, lteCze90PointsChecker: LteCze90PointsChecker, floatingCarDataRegionsModel: FloatingCarDataRegionsRepository);
14
+ protected execute(data: IFloatingCarData): Promise<void>;
15
+ }
@@ -0,0 +1,68 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.SaveRegionsDataTask = void 0;
25
+ const LteCze90PointsChecker_1 = require("../../helpers/LteCze90PointsChecker");
26
+ const _ie_1 = require("../..");
27
+ const _sch_1 = require("../../../schema-definitions");
28
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
29
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
30
+ const FloatingCarDataRegionsRepository_1 = require("../../repositories/fcd/FloatingCarDataRegionsRepository");
31
+ const ModuleContainer_1 = require("../../ioc/ModuleContainer");
32
+ const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
33
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
34
+ const src_1 = require("../../..");
35
+ let SaveRegionsDataTask = exports.SaveRegionsDataTask = class SaveRegionsDataTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
36
+ constructor(floatingCarDataTransformation, lteCze90PointsChecker, floatingCarDataRegionsModel) {
37
+ super(_sch_1.FCD.name.toLowerCase());
38
+ this.floatingCarDataTransformation = floatingCarDataTransformation;
39
+ this.lteCze90PointsChecker = lteCze90PointsChecker;
40
+ this.floatingCarDataRegionsModel = floatingCarDataRegionsModel;
41
+ this.queueName = "saveRegionsData";
42
+ this.queueTtl = 59 * 60 * 1000;
43
+ this.schema = new golemio_validator_1.JSONSchemaValidator("floatingCarDataValidation", src_1.SchemaDefinitions.FCD.datasourceSchema);
44
+ }
45
+ execute(data) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ try {
48
+ const transformedData = yield this.floatingCarDataTransformation.transform(data);
49
+ yield this.lteCze90PointsChecker.initialize();
50
+ const filteredData = transformedData.filter((element) => this.lteCze90PointsChecker.shouldSave(element.source_identification));
51
+ yield this.floatingCarDataRegionsModel.save(filteredData);
52
+ }
53
+ catch (error) {
54
+ throw new golemio_errors_1.GeneralError("Error while processing Floating Car Data for regions.", "SaveRegionsDataTask", error, 422);
55
+ }
56
+ });
57
+ }
58
+ };
59
+ exports.SaveRegionsDataTask = SaveRegionsDataTask = __decorate([
60
+ (0, tsyringe_1.injectable)(),
61
+ __param(0, (0, tsyringe_1.inject)(ModuleContainer_1.ModuleContainerToken.FloatingCarDataTransformation)),
62
+ __param(1, (0, tsyringe_1.inject)(ModuleContainer_1.ModuleContainerToken.lteCze90PointsChecker)),
63
+ __param(2, (0, tsyringe_1.inject)(ModuleContainer_1.ModuleContainerToken.FloatingCarDataRegionsRepository)),
64
+ __metadata("design:paramtypes", [_ie_1.FloatingCarDataTransformation,
65
+ LteCze90PointsChecker_1.LteCze90PointsChecker,
66
+ FloatingCarDataRegionsRepository_1.FloatingCarDataRegionsRepository])
67
+ ], SaveRegionsDataTask);
68
+ //# sourceMappingURL=SaveRegionsDataTask.js.map
@@ -0,0 +1 @@
1
+ {"version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BAAY,CAAC,uDAAuD,EAAE,qBAAqB,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;aACtH;QACL,CAAC;KAAA;CACJ,CAAA;8BA7BY,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,sCAAoB,CAAC,6BAA6B,CAAC,CAAA;IAE1D,WAAA,IAAA,iBAAM,EAAC,sCAAoB,CAAC,qBAAqB,CAAC,CAAA;IAElD,WAAA,IAAA,iBAAM,EAAC,sCAAoB,CAAC,gCAAgC,CAAC,CAAA;qCAHvB,mCAA6B;QAErC,6CAAqB;QAEf,mEAAgC;GAXhE,mBAAmB,CA6B/B"}
@@ -0,0 +1,3 @@
1
+ export * from "./RegionsDataRetentionTask";
2
+ export * from "./SaveFloatingCarDataTask";
3
+ export * from "./SaveRegionsDataTask";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./RegionsDataRetentionTask"), exports);
18
+ __exportStar(require("./SaveFloatingCarDataTask"), exports);
19
+ __exportStar(require("./SaveRegionsDataTask"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,4DAA0C;AAC1C,wDAAsC"}
@@ -1,13 +1,15 @@
1
1
  /// <reference types="express" />
2
2
  import { NextFunction, Request, Response, Router } from "@golemio/core/dist/shared/express";
3
3
  import { BaseRouter } from "@golemio/core/dist/output-gateway/routes/BaseRouter";
4
- import { FloatingCarDataModel, FloatingCarExtendedDataModel } from "./models";
4
+ import { FloatingCarDataModel, FloatingCarWithOsmPathDataModel, FloatingCarExtendedDataModel, FloatingCarWithOsmPathExtendedDataModel } from "./models";
5
5
  import { OutputFloatingCarDataTransformation } from "./transformations/OutputFloatingCarDataTransformation";
6
6
  export declare class FCDRouter extends BaseRouter {
7
7
  protected floatingCarDataModel: FloatingCarDataModel;
8
+ protected floatingCarWithOsmPathDataModel: FloatingCarWithOsmPathDataModel;
8
9
  protected floatingCarExtendedDataModel: FloatingCarExtendedDataModel;
10
+ protected floatingCarWithOsmPathExtendedDataModel: FloatingCarWithOsmPathExtendedDataModel;
9
11
  private outputFloatingCarDataTransformation;
10
- constructor(floatingCarDataModel: FloatingCarDataModel, floatingCarExtendedDataModel: FloatingCarExtendedDataModel, outputFloatingCarDataTransformation: OutputFloatingCarDataTransformation);
12
+ constructor(floatingCarDataModel: FloatingCarDataModel, floatingCarWithOsmPathDataModel: FloatingCarWithOsmPathDataModel, floatingCarExtendedDataModel: FloatingCarExtendedDataModel, floatingCarWithOsmPathExtendedDataModel: FloatingCarWithOsmPathExtendedDataModel, outputFloatingCarDataTransformation: OutputFloatingCarDataTransformation);
11
13
  GetFloatingCarData: (req: Request, res: Response, next: NextFunction) => Promise<void>;
12
14
  }
13
15
  declare const fcdRouter: Router;
@@ -17,12 +17,13 @@ const BaseRouter_1 = require("@golemio/core/dist/output-gateway/routes/BaseRoute
17
17
  const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
18
18
  const models_1 = require("./models");
19
19
  const OutputFloatingCarDataTransformation_1 = require("./transformations/OutputFloatingCarDataTransformation");
20
- const repositories_1 = require("@golemio/traffic-common/dist/output-gateway/repositories");
21
20
  class FCDRouter extends BaseRouter_1.BaseRouter {
22
- constructor(floatingCarDataModel, floatingCarExtendedDataModel, outputFloatingCarDataTransformation) {
21
+ constructor(floatingCarDataModel, floatingCarWithOsmPathDataModel, floatingCarExtendedDataModel, floatingCarWithOsmPathExtendedDataModel, outputFloatingCarDataTransformation) {
23
22
  super();
24
23
  this.floatingCarDataModel = floatingCarDataModel;
24
+ this.floatingCarWithOsmPathDataModel = floatingCarWithOsmPathDataModel;
25
25
  this.floatingCarExtendedDataModel = floatingCarExtendedDataModel;
26
+ this.floatingCarWithOsmPathExtendedDataModel = floatingCarWithOsmPathExtendedDataModel;
26
27
  this.outputFloatingCarDataTransformation = outputFloatingCarDataTransformation;
27
28
  this.GetFloatingCarData = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
28
29
  try {
@@ -33,14 +34,23 @@ class FCDRouter extends BaseRouter_1.BaseRouter {
33
34
  limit: req.query.limit ? +req.query.limit : undefined,
34
35
  offset: req.query.offset ? +req.query.offset : undefined,
35
36
  minutesBefore,
37
+ isRequestedPathOsm,
36
38
  };
37
- const dataFromDb = minutesBefore
38
- ? yield this.floatingCarExtendedDataModel.GetAll(options)
39
- : yield this.floatingCarDataModel.GetAll(options);
39
+ let dataFromDb = [];
40
+ if (isRequestedPathOsm) {
41
+ dataFromDb = minutesBefore
42
+ ? yield this.floatingCarWithOsmPathExtendedDataModel.GetAll(options)
43
+ : yield this.floatingCarWithOsmPathDataModel.GetAll(options);
44
+ }
45
+ else {
46
+ dataFromDb = minutesBefore
47
+ ? yield this.floatingCarExtendedDataModel.GetAll(options)
48
+ : yield this.floatingCarDataModel.GetAll(options);
49
+ }
40
50
  if (!(dataFromDb === null || dataFromDb === void 0 ? void 0 : dataFromDb.length)) {
41
51
  throw new golemio_errors_1.GeneralError("No data found", "FCDRouter", undefined, 404);
42
52
  }
43
- const transformedData = yield this.outputFloatingCarDataTransformation.transform(dataFromDb, isRequestedPathOsm);
53
+ const transformedData = this.outputFloatingCarDataTransformation.transform(dataFromDb, isRequestedPathOsm);
44
54
  res.status(200).send(transformedData);
45
55
  }
46
56
  catch (err) {
@@ -55,6 +65,6 @@ class FCDRouter extends BaseRouter_1.BaseRouter {
55
65
  }
56
66
  }
57
67
  exports.FCDRouter = FCDRouter;
58
- const fcdRouter = new FCDRouter(new models_1.FloatingCarDataModel(), new models_1.FloatingCarExtendedDataModel(), new OutputFloatingCarDataTransformation_1.OutputFloatingCarDataTransformation(new repositories_1.RsdTmcOsmMappingRepository())).router;
68
+ const fcdRouter = new FCDRouter(new models_1.FloatingCarDataModel(), new models_1.FloatingCarWithOsmPathDataModel(), new models_1.FloatingCarExtendedDataModel(), new models_1.FloatingCarWithOsmPathExtendedDataModel(), new OutputFloatingCarDataTransformation_1.OutputFloatingCarDataTransformation()).router;
59
69
  exports.fcdRouter = fcdRouter;
60
70
  //# sourceMappingURL=FCDRouter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FCDRouter.js","sourceRoot":"","sources":["../../src/output-gateway/FCDRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mFAAoE;AACpE,6EAAwE;AACxE,mEAA6E;AAC7E,oFAAiF;AACjF,6EAAkH;AAClH,qCAA8E;AAC9E,+GAA8G;AAC9G,2FAAsG;AAEtG,MAAa,SAAU,SAAQ,uBAAU;IACrC,YACc,oBAA0C,EAC1C,4BAA0D,EAC5D,mCAAwE;QAEhF,KAAK,EAAE,CAAC;QAJE,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,iCAA4B,GAA5B,4BAA4B,CAA8B;QAC5D,wCAAmC,GAAnC,mCAAmC,CAAqC;QAmB7E,uBAAkB,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YAClF,IAAI;gBACA,MAAM,kBAAkB,GAAI,GAAG,CAAC,KAAK,CAAC,OAAkB,IAAI,MAAM,CAAC;gBACnE,M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AAW,IAAI,SAAS,CACnC,IAAI,6BAAoB,EAAE,EAC1B,IAAI,wCAA+B,EAAE,EACrC,IAAI,qCAA4B,EAAE,EAClC,IAAI,gDAAuC,EAAE,EAC7C,IAAI,yEAAmC,EAAE,CAC5C,CAAC,MAAM,CAAC;AAEA,8BAAS"}
@@ -1,4 +1,4 @@
1
- import { IFloatingCarDataModel } from "../../integration-engine/transformations/FloatingCarDataInterface";
1
+ import { IFloatingCarDataModel } from "../../schema-definitions/interfaces/FloatingCarDataInterface";
2
2
  import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
3
3
  export declare class FloatingCarDataModel extends SequelizeModel {
4
4
  constructor();
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingCarDataModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FloatingCarDataModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0DAAiC;AACjC,qEAA0E;AAC1E,6EAAwE;AACxE,oFAA4D;AAE5D,MAAa,oBAAqB,SAAQ,uBAAc;IACpD;QACI,KAAK,CAAC,WAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,EAAE,WAAG,CAAC,QAAQ,CAAC,yBAAyB,EAAE;YACrF,MAAM,EAAE,WAAG,CAAC,QAAQ;SACvB,CAAC,CAAC;QAGA,WAAM,GAAG,CACZ,UAII,EAAE,EAC0B,EAAE;YAClC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAC9C,IAAI;gBACA,MAAM,EAAE,GAAG,mBAAS,CAAC,EAAE,CAAC;gBACxB,MAAM,KAAK,GAAG;oBACV,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;iBACjB,CAAC;gBAEF,IAAI,UAAU,EAAE;oBACZ,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACf,mBAAmB,EAAE,UAAU;qBAClC,CAAC,CAAC;iBACN;gBAED,OAAO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AClC,CAAC,CAAC;iBACN;gBAED,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK;oBACL,MAAM;oBACN,GAAG,EAAE,IAAI;oBACT,KAAK;iBACR,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,sBAAsB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aACnG;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,6BAAY,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;QACtE,CAAC,CAAA,CAAC;IAnCF,CAAC;CAoCJ;AAzCD,oDAyCC"}
@@ -1,4 +1,4 @@
1
- import { IFloatingCarDataModel } from "../../integration-engine/transformations/FloatingCarDataInterface";
1
+ import { IFloatingCarDataModel } from "../../schema-definitions/interfaces/FloatingCarDataInterface";
2
2
  import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
3
3
  export declare class FloatingCarExtendedDataModel extends SequelizeModel {
4
4
  constructor();
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingCarExtendedDataModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FloatingCarExtendedDataModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0DAAiC;AACjC,qEAA0E;AAC1E,6EAAwE;AACxE,oFAA4D;AAE5D,MAAa,4BAA6B,SAAQ,uBAAc;IAC5D;QACI,KAAK,CAAC,WAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,4BAA4B,EAAE,WAAG,CAAC,QAAQ,CAAC,yBAAyB,EAAE;YAC3F,MAAM,EAAE,WAAG,CAAC,QAAQ;SACvB,CAAC,CAAC;QAGA,WAAM,GAAG,CACZ,UAKI,EAAE,EAC0B,EAAE;YAClC,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAC7D,IAAI;gBACA,MAAM,EAAE,GAAG,mBAAS,CAAC,EAAE,CAAC;gBACxB,MAAM,KAAK,GAAG;oBACV,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;iBACjB,CAAC;gBAEF,IAAI,UAAU,EAAE;oBACZ,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACf,mBAAmB,EAAE,UAAU;qBAClC,CAAC,CAAC;iBACN;gBAED,IAAI,aAAa,EAAE;oBACf,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACf,+BAA+B,EAAE;4BAC7B,CAAC,mBAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,mBAAS,CAAC,OAAO,CAAC,qBAAqB,aAAa,WAAW,CAAC;yBACvF;qBACJ,CAAC,CAAC;iBACN;gBAED,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK;oBACL,MAAM;oBACN,GAAG,EAAE,IAAI;oBACT,KAAK;iBACR,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,8BAA8B,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC3G;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,6BAAY,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,CAAC;QAC9E,CAAC,CAAA,CAAC;IA5CF,CAAC;CA6CJ;AAlDD,oEAkDC"}
1
+ {"version":3,"file":"FloatingCarExtendedDataModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FloatingCarExtendedDataModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AAEjC,qEAA0E;AAC1E,6EAAwE;AACxE,oFAA4D;AAE5D,MAAa,4B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AAY,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,CAAC;QAC9E,CAAC,CAAA,CAAC;IA5CF,CAAC;CA6CJ;AAlDD,oEAkDC"}
@@ -0,0 +1,11 @@
1
+ import { IFloatingCarWithOsmPathDataModel } from "../../schema-definitions/interfaces/FloatingCarDataInterface";
2
+ import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
3
+ export declare class FloatingCarWithOsmPathDataModel extends SequelizeModel {
4
+ constructor();
5
+ GetAll: (options?: {
6
+ locationId?: string;
7
+ limit?: number;
8
+ offset?: number;
9
+ }) => Promise<IFloatingCarWithOsmPathDataModel[]>;
10
+ GetOne: () => Promise<object | null>;
11
+ }
@@ -0,0 +1,54 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.FloatingCarWithOsmPathDataModel = void 0;
16
+ const index_1 = require("../../schema-definitions/index");
17
+ const models_1 = require("@golemio/core/dist/output-gateway/models");
18
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
19
+ const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
20
+ class FloatingCarWithOsmPathDataModel extends models_1.SequelizeModel {
21
+ constructor() {
22
+ super(index_1.FCD.fcd_info.name, "v_traffic_params_all_with_osm_path", index_1.FCD.fcd_info.outputSequelizeAttributesWithOsmPath, {
23
+ schema: index_1.FCD.pgSchema,
24
+ });
25
+ this.GetAll = (options = {}) => __awaiter(this, void 0, void 0, function* () {
26
+ const { locationId, limit, offset } = options;
27
+ try {
28
+ const Op = sequelize_1.default.Op;
29
+ const where = {
30
+ [Op.and]: [{}],
31
+ };
32
+ if (locationId) {
33
+ where[Op.and].push({
34
+ predefined_location: locationId,
35
+ });
36
+ }
37
+ return yield this.sequelizeModel.findAll({
38
+ limit,
39
+ offset,
40
+ raw: true,
41
+ where,
42
+ });
43
+ }
44
+ catch (err) {
45
+ throw new golemio_errors_1.GeneralError(`GetAll method error: ${err.message}`, "FloatingCarDataModel", err, 500);
46
+ }
47
+ });
48
+ this.GetOne = () => __awaiter(this, void 0, void 0, function* () {
49
+ throw new golemio_errors_1.GeneralError("Not implemented", "FloatingCarDataModel");
50
+ });
51
+ }
52
+ }
53
+ exports.FloatingCarWithOsmPathDataModel = FloatingCarWithOsmPathDataModel;
54
+ //# sourceMappingURL=FloatingCarWithOsmPathDataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingCarWithOsmPathDataModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FloatingCarWithOsmPathDataModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AAEjC,qEAA0E;AAC1E,6EAAwE;AACxE,oFAA4D;AAE5D,MAAa,+BAAgC,SAAQ,uBAAc;IAC/D;QACI,KAAK,CAAC,WAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,oCAAoC,EAAE,WAAG,CAAC,QAAQ,CAAC,oCAAoC,EAAE;YAC9G,MAAM,EAAE,WAAG,CAAC,QAAQ;SACvB,CAAC,CAAC;QAGA,WAAM,GAAG,CACZ,UAII,EAAE,EACqC,EAAE;YAC7C,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAC9C,IAAI;gBACA,MAAM,EAAE,GAAG,mBAAS,CAAC,EAAE,CAAC;gBACxB,MAAM,KAAK,GAAG;oBACV,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;iBACjB,CAAC;gBAEF,IAAI,UAAU,EAAE;oBACZ,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACf,mBAAmB,EAAE,UAAU;qBAClC,CAAC,CAAC;iBACN;gBAED,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK;oBACL,MAAM;oBACN,GAAG,EAAE,IAAI;oBACT,KAAK;iBACR,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,sBAAsB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aACnG;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,6BAAY,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;QACtE,CAAC,CAAA,CAAC;IAnCF,CAAC;CAoCJ;AAzCD,0EAyCC"}
@@ -0,0 +1,12 @@
1
+ import { IFloatingCarWithOsmPathDataModel } from "../../schema-definitions/interfaces/FloatingCarDataInterface";
2
+ import { SequelizeModel } from "@golemio/core/dist/output-gateway/models";
3
+ export declare class FloatingCarWithOsmPathExtendedDataModel extends SequelizeModel {
4
+ constructor();
5
+ GetAll: (options?: {
6
+ locationId?: string;
7
+ minutesBefore?: number;
8
+ limit?: number;
9
+ offset?: number;
10
+ }) => Promise<IFloatingCarWithOsmPathDataModel[]>;
11
+ GetOne: () => Promise<object | null>;
12
+ }
@@ -0,0 +1,61 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.FloatingCarWithOsmPathExtendedDataModel = void 0;
16
+ const index_1 = require("../../schema-definitions/index");
17
+ const models_1 = require("@golemio/core/dist/output-gateway/models");
18
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
19
+ const sequelize_1 = __importDefault(require("@golemio/core/dist/shared/sequelize"));
20
+ class FloatingCarWithOsmPathExtendedDataModel extends models_1.SequelizeModel {
21
+ constructor() {
22
+ super(index_1.FCD.fcd_info.name, "v_traffic_params_last_hour", index_1.FCD.fcd_info.outputSequelizeAttributesWithOsmPath, {
23
+ schema: index_1.FCD.pgSchema,
24
+ });
25
+ this.GetAll = (options = {}) => __awaiter(this, void 0, void 0, function* () {
26
+ const { locationId, minutesBefore, limit, offset } = options;
27
+ try {
28
+ const Op = sequelize_1.default.Op;
29
+ const where = {
30
+ [Op.and]: [{}],
31
+ };
32
+ if (locationId) {
33
+ where[Op.and].push({
34
+ predefined_location: locationId,
35
+ });
36
+ }
37
+ if (minutesBefore) {
38
+ where[Op.and].push({
39
+ measurement_or_calculation_time: {
40
+ [sequelize_1.default.Op.gte]: sequelize_1.default.literal(`NOW() - INTERVAL '${minutesBefore} minutes'`),
41
+ },
42
+ });
43
+ }
44
+ return yield this.sequelizeModel.findAll({
45
+ limit,
46
+ offset,
47
+ raw: true,
48
+ where,
49
+ });
50
+ }
51
+ catch (err) {
52
+ throw new golemio_errors_1.GeneralError(`GetAll method error: ${err.message}`, "FloatingCarExtendedDataModel", err, 500);
53
+ }
54
+ });
55
+ this.GetOne = () => __awaiter(this, void 0, void 0, function* () {
56
+ throw new golemio_errors_1.GeneralError("Not implemented", "FloatingCarExtendedDataModel");
57
+ });
58
+ }
59
+ }
60
+ exports.FloatingCarWithOsmPathExtendedDataModel = FloatingCarWithOsmPathExtendedDataModel;
61
+ //# sourceMappingURL=FloatingCarWithOsmPathExtendedDataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FloatingCarWithOsmPathExtendedDataModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FloatingCarWithOsmPathExtendedDataModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AAEjC,qEAA0E;AAC1E,6EAAwE;AACxE,oFAA4D;AAE5D,MAAa,uCAAwC,SAAQ,uBAAc;IACvE;QACI,KAAK,CAAC,WAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,4BAA4B,EAAE,WAAG,CAAC,QAAQ,CAAC,oCAAoC,EAAE;YACtG,MAAM,EAAE,WAAG,CAAC,QAAQ;SACvB,CAAC,CAAC;QAGA,WAAM,GAAG,CACZ,UAKI,EAAE,EACqC,EAAE;YAC7C,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAC7D,IAAI;gBACA,MAAM,EAAE,GAAG,mBAAS,CAAC,EAAE,CAAC;gBACxB,MAAM,KAAK,GAAG;oBACV,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;iBACjB,CAAC;gBAEF,IAAI,UAAU,EAAE;oBACZ,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACf,mBAAmB,EAAE,UAAU;qBAClC,CAAC,CAAC;iBACN;gBAED,IAAI,aAAa,EAAE;oBACf,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBACf,+BAA+B,EAAE;4BAC7B,CAAC,mBAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,mBAAS,CAAC,OAAO,CAAC,qBAAqB,aAAa,WAAW,CAAC;yBACvF;qBACJ,CAAC,CAAC;iBACN;gBAED,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK;oBACL,MAAM;oBACN,GAAG,EAAE,IAAI;oBACT,KAAK;iBACR,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,8BAA8B,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC3G;QACL,CAAC,CAAA,CAAC;QAEK,WAAM,GAAG,GAAiC,EAAE;YAC/C,MAAM,IAAI,6BAAY,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,CAAC;QAC9E,CAAC,CAAA,CAAC;IA5CF,CAAC;CA6CJ;AAlDD,0FAkDC"}
@@ -1,2 +1,4 @@
1
1
  export * from "./FloatingCarDataModel";
2
2
  export * from "./FloatingCarExtendedDataModel";
3
+ export * from "./FloatingCarWithOsmPathDataModel";
4
+ export * from "./FloatingCarWithOsmPathExtendedDataModel";
@@ -16,4 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./FloatingCarDataModel"), exports);
18
18
  __exportStar(require("./FloatingCarExtendedDataModel"), exports);
19
+ __exportStar(require("./FloatingCarWithOsmPathDataModel"), exports);
20
+ __exportStar(require("./FloatingCarWithOsmPathExtendedDataModel"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,iEAA+C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,4EAA0D"}
@@ -1,8 +1,9 @@
1
- import { IFloatingCarDataModel, IOutputApiFloatingCarData } from "../../integration-engine/transformations/FloatingCarDataInterface";
2
- import { RsdTmcOsmMappingRepository } from "@golemio/traffic-common/dist/output-gateway/repositories";
1
+ import { IFloatingCarWithOsmPathDataModel, IOutputApiFloatingCarDataElaboratedData } from "../../schema-definitions/interfaces/FloatingCarDataInterface";
2
+ import { IOutputApiFloatingCarData } from "./interfaces/outputApiFloatingCarData";
3
3
  export declare class OutputFloatingCarDataTransformation {
4
4
  name: string;
5
- protected rsdTmcOsmMappingRepository: RsdTmcOsmMappingRepository;
6
- constructor(rsdTmcOsmMappingRepository: RsdTmcOsmMappingRepository);
7
- transform: (data: IFloatingCarDataModel[], isRequestedPathOsm: Boolean) => Promise<IOutputApiFloatingCarData>;
5
+ private latestPublicationTime;
6
+ constructor();
7
+ transform: (data: IFloatingCarWithOsmPathDataModel[], isRequestedPathOsm: boolean) => IOutputApiFloatingCarData;
8
+ transformElement: (item: IFloatingCarWithOsmPathDataModel, isRequestedPathOsm: boolean) => IOutputApiFloatingCarDataElaboratedData;
8
9
  }
@@ -1,63 +1,21 @@
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
3
  exports.OutputFloatingCarDataTransformation = void 0;
13
4
  const _sch_1 = require("../../schema-definitions");
14
- const getLocationPointsFromTsString_1 = require("./getLocationPointsFromTsString");
15
5
  const helpers_1 = require("@golemio/core/dist/helpers");
16
6
  class OutputFloatingCarDataTransformation {
17
- constructor(rsdTmcOsmMappingRepository) {
18
- this.transform = (data, isRequestedPathOsm) => __awaiter(this, void 0, void 0, function* () {
19
- const elaboratedData = [];
20
- let latestPublicationTime = new Date(data[0].measurement_or_calculation_time);
7
+ constructor() {
8
+ this.transform = (data, isRequestedPathOsm) => {
9
+ let elaboratedData = [];
10
+ this.latestPublicationTime = new Date(data[0].measurement_or_calculation_time);
21
11
  for (const item of data) {
22
- const itemMeasurementTime = new Date(item.measurement_or_calculation_time);
23
- const itemResultObject = {
24
- measurementOrCalculationTime: (0, helpers_1.dateTime)(itemMeasurementTime).setTimeZone("Europe/Prague").toISOString(),
25
- sourceIdentification: item.source_identification,
26
- supplierCalculatedDataQuality: item.data_quality.toString(),
27
- numberOfInputValuesUsed: item.input_values.toString(),
28
- predefinedLocationId: item.predefined_location,
29
- trafficLevel: item.traffic_level,
30
- averageVehicleSpeed: item.average_vehicle_speed.toString(),
31
- travelTime: item.travel_time.toString(),
32
- freeFlowTravelTime: item.free_flow_travel_time.toString(),
33
- freeFlowSpeed: item.free_flow_speed.toString(),
34
- };
35
- if (item.queue_exists) {
36
- itemResultObject.queueExists = item.queue_exists.toString();
37
- }
38
- if (item.queue_length) {
39
- itemResultObject.queueLength = item.queue_length.toString();
40
- }
41
- if (item.from_point) {
42
- itemResultObject.fromPoint = item.from_point.toString();
43
- }
44
- if (item.to_point) {
45
- itemResultObject.toPoint = item.to_point.toString();
46
- }
47
- if (isRequestedPathOsm) {
48
- const osmPath = yield this.rsdTmcOsmMappingRepository.GetOne((0, getLocationPointsFromTsString_1.getLocationPointsFromTsString)(item.predefined_location));
49
- itemResultObject.osmPath = osmPath !== null && osmPath !== void 0 ? osmPath : null;
50
- }
51
- elaboratedData.push(itemResultObject);
52
- if (itemMeasurementTime > latestPublicationTime) {
53
- latestPublicationTime = itemMeasurementTime;
54
- }
12
+ elaboratedData.push(this.transformElement(item, isRequestedPathOsm));
55
13
  }
56
14
  return {
57
15
  modelBaseVersion: "3",
58
16
  payloadPublicationLight: {
59
17
  lang: "cz",
60
- publicationTime: (0, helpers_1.dateTime)(latestPublicationTime).setTimeZone("Europe/Prague").toISOString(),
18
+ publicationTime: (0, helpers_1.dateTime)(this.latestPublicationTime).setTimeZone("Europe/Prague").toISOString(),
61
19
  publicationCreator: {
62
20
  country: "cz",
63
21
  nationalIdentifier: "ŘSD",
@@ -65,9 +23,43 @@ class OutputFloatingCarDataTransformation {
65
23
  elaboratedData,
66
24
  },
67
25
  };
68
- });
26
+ };
27
+ this.transformElement = (item, isRequestedPathOsm) => {
28
+ const itemMeasurementTime = new Date(item.measurement_or_calculation_time);
29
+ const itemResultObject = {
30
+ measurementOrCalculationTime: (0, helpers_1.dateTime)(itemMeasurementTime).setTimeZone("Europe/Prague").toISOString(),
31
+ sourceIdentification: item.source_identification,
32
+ supplierCalculatedDataQuality: item.data_quality.toString(),
33
+ numberOfInputValuesUsed: item.input_values.toString(),
34
+ predefinedLocationId: item.predefined_location,
35
+ trafficLevel: item.traffic_level,
36
+ averageVehicleSpeed: item.average_vehicle_speed.toString(),
37
+ travelTime: item.travel_time.toString(),
38
+ freeFlowTravelTime: item.free_flow_travel_time.toString(),
39
+ freeFlowSpeed: item.free_flow_speed.toString(),
40
+ };
41
+ if (item.queue_exists) {
42
+ itemResultObject.queueExists = item.queue_exists.toString();
43
+ }
44
+ if (item.queue_length) {
45
+ itemResultObject.queueLength = item.queue_length.toString();
46
+ }
47
+ if (item.from_point) {
48
+ itemResultObject.fromPoint = item.from_point.toString();
49
+ }
50
+ if (item.to_point) {
51
+ itemResultObject.toPoint = item.to_point.toString();
52
+ }
53
+ if (isRequestedPathOsm) {
54
+ itemResultObject.osmPath = item.osm_path ? JSON.parse(item.osm_path) : null;
55
+ if (itemMeasurementTime > this.latestPublicationTime) {
56
+ this.latestPublicationTime = itemMeasurementTime;
57
+ }
58
+ }
59
+ return itemResultObject;
60
+ };
69
61
  this.name = _sch_1.FCD.fcd_info.name;
70
- this.rsdTmcOsmMappingRepository = rsdTmcOsmMappingRepository;
62
+ this.latestPublicationTime = new Date();
71
63
  }
72
64
  }
73
65
  exports.OutputFloatingCarDataTransformation = OutputFloatingCarDataTransformation;