@golemio/pid 4.0.2 → 4.0.3-dev.1993091012

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 (201) hide show
  1. package/README.md +1 -1
  2. package/db/example/redis/gtfsStopsCacheMock.json +8 -0
  3. package/db/example/redis/jisCacheMock.json +31 -0
  4. package/db/migrations/postgresql/20250716143052-add-stop-name-to-combined-stop-times.js +53 -0
  5. package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-down.sql +47 -0
  6. package/db/migrations/postgresql/sqls/20250716143052-add-stop-name-to-combined-stop-times-up.sql +47 -0
  7. package/dist/helpers/GtfsStopParser.d.ts +2 -0
  8. package/dist/helpers/GtfsStopParser.js +11 -8
  9. package/dist/helpers/GtfsStopParser.js.map +1 -1
  10. package/dist/helpers/jis/JISInfotextSeverityLevelPriority.d.ts +6 -0
  11. package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js +11 -0
  12. package/dist/helpers/jis/JISInfotextSeverityLevelPriority.js.map +1 -0
  13. package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +0 -1
  14. package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
  15. package/dist/integration-engine/jis/ioc/Di.js +10 -0
  16. package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
  17. package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +4 -0
  18. package/dist/integration-engine/jis/ioc/JISContainerToken.js +5 -0
  19. package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
  20. package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.d.ts +9 -0
  21. package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js +86 -0
  22. package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js.map +1 -0
  23. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +6 -1
  24. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +50 -2
  25. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
  26. package/dist/integration-engine/jis/repositories/JISMetadataRepository.d.ts +4 -1
  27. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js +37 -12
  28. package/dist/integration-engine/jis/repositories/JISMetadataRepository.js.map +1 -1
  29. package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.d.ts +7 -0
  30. package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js +37 -0
  31. package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js.map +1 -0
  32. package/dist/integration-engine/jis/workers/JISWorker.js +1 -0
  33. package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
  34. package/dist/integration-engine/jis/workers/tasks/AbstractFetchJISResourceTask.d.ts +14 -0
  35. package/dist/integration-engine/jis/workers/tasks/AbstractFetchJISResourceTask.js +71 -0
  36. package/dist/integration-engine/jis/workers/tasks/AbstractFetchJISResourceTask.js.map +1 -0
  37. package/dist/integration-engine/jis/workers/tasks/FetchJISEventsTask.d.ts +10 -4
  38. package/dist/integration-engine/jis/workers/tasks/FetchJISEventsTask.js +15 -22
  39. package/dist/integration-engine/jis/workers/tasks/FetchJISEventsTask.js.map +1 -1
  40. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.d.ts +10 -5
  41. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js +15 -23
  42. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js.map +1 -1
  43. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +13 -0
  44. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +47 -0
  45. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +1 -0
  46. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +1 -2
  47. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +5 -4
  48. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  49. package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.d.ts +18 -0
  50. package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js +44 -0
  51. package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js.map +1 -0
  52. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.d.ts +5 -1
  53. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +24 -0
  54. package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
  55. package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
  56. package/dist/integration-engine/ropid-gtfs/index.d.ts +1 -0
  57. package/dist/integration-engine/ropid-gtfs/index.js +1 -0
  58. package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
  59. package/dist/integration-engine/ropid-gtfs/ioc/Di.js +8 -0
  60. package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
  61. package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +3 -0
  62. package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +3 -0
  63. package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
  64. package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js +1 -1
  65. package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js.map +1 -1
  66. package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +1 -0
  67. package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -1
  68. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +8 -5
  69. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
  70. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.d.ts +12 -0
  71. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js +44 -0
  72. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js.map +1 -0
  73. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.d.ts +12 -0
  74. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js +87 -0
  75. package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js.map +1 -0
  76. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +1 -0
  77. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
  78. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/interfaces/TripRepositoryInterfaces.d.ts +2 -1
  79. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.d.ts +3 -1
  80. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +100 -85
  81. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
  82. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
  83. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +1 -0
  84. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
  85. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +2 -0
  86. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
  87. package/dist/output-gateway/index.js +1 -0
  88. package/dist/output-gateway/index.js.map +1 -1
  89. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.d.ts +17 -0
  90. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js +113 -0
  91. package/dist/output-gateway/jis/data-access/cache/JISInfotextsRedisRepository.js.map +1 -0
  92. package/dist/output-gateway/jis/ioc/Di.js +2 -2
  93. package/dist/output-gateway/jis/ioc/Di.js.map +1 -1
  94. package/dist/output-gateway/jis/ioc/OgJisToken.d.ts +2 -0
  95. package/dist/output-gateway/jis/ioc/OgJisToken.js +2 -0
  96. package/dist/output-gateway/jis/ioc/OgJisToken.js.map +1 -1
  97. package/dist/output-gateway/pid/controllers/v3/V3TransferBoardsController.js.map +1 -1
  98. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.d.ts +17 -0
  99. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js +154 -0
  100. package/dist/output-gateway/pid/controllers/v4/V4TransferBoardsController.js.map +1 -0
  101. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.d.ts +14 -0
  102. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js +3 -0
  103. package/dist/output-gateway/pid/controllers/v4/interfaces/ITransferBoardsParams.js.map +1 -0
  104. package/dist/output-gateway/pid/domain/InfotextInterfaces.d.ts +5 -0
  105. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.d.ts +4 -1
  106. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js +7 -1
  107. package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -1
  108. package/dist/output-gateway/pid/helpers/TransferBoardFilter.d.ts +5 -0
  109. package/dist/output-gateway/pid/helpers/TransferBoardFilter.js +33 -0
  110. package/dist/output-gateway/pid/helpers/TransferBoardFilter.js.map +1 -0
  111. package/dist/output-gateway/pid/helpers/TransferBoardSorter.d.ts +6 -0
  112. package/dist/output-gateway/pid/helpers/TransferBoardSorter.js +61 -0
  113. package/dist/output-gateway/pid/helpers/TransferBoardSorter.js.map +1 -0
  114. package/dist/output-gateway/pid/index.d.ts +50 -0
  115. package/dist/output-gateway/pid/index.js.map +1 -1
  116. package/dist/output-gateway/pid/ioc/Di.js +62 -6
  117. package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
  118. package/dist/output-gateway/pid/ioc/OgPidToken.d.ts +11 -0
  119. package/dist/output-gateway/pid/ioc/OgPidToken.js +11 -0
  120. package/dist/output-gateway/pid/ioc/OgPidToken.js.map +1 -1
  121. package/dist/output-gateway/pid/routers/index.d.ts +1 -0
  122. package/dist/output-gateway/pid/routers/index.js +3 -1
  123. package/dist/output-gateway/pid/routers/index.js.map +1 -1
  124. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.d.ts +16 -0
  125. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js +67 -0
  126. package/dist/output-gateway/pid/routers/v4/V4PIDRouter.js.map +1 -0
  127. package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +7 -2
  128. package/dist/output-gateway/pid/service/facade/InfotextFacade.js +29 -4
  129. package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
  130. package/dist/output-gateway/pid/service/facade/StopFacade.d.ts +12 -3
  131. package/dist/output-gateway/pid/service/facade/StopFacade.js +43 -7
  132. package/dist/output-gateway/pid/service/facade/StopFacade.js.map +1 -1
  133. package/dist/output-gateway/pid/service/facade/TransferFacade.d.ts +11 -9
  134. package/dist/output-gateway/pid/service/facade/TransferFacade.js +117 -14
  135. package/dist/output-gateway/pid/service/facade/TransferFacade.js.map +1 -1
  136. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.d.ts +7 -1
  137. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js +12 -0
  138. package/dist/output-gateway/pid/service/helpers/PlatformCodeResolver.js.map +1 -1
  139. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.d.ts +13 -0
  140. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js +31 -0
  141. package/dist/output-gateway/pid/service/transformations/JISInfotextCacheTransferTransformation.js.map +1 -0
  142. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.d.ts +27 -0
  143. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js +78 -0
  144. package/dist/output-gateway/pid/service/transformations/TransferDepartureCacheTransformation.js.map +1 -0
  145. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.d.ts +1 -1
  146. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +4 -4
  147. package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
  148. package/dist/output-gateway/public/ioc/Di.js +1 -1
  149. package/dist/output-gateway/public/ioc/Di.js.map +1 -1
  150. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.d.ts +13 -0
  151. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js +83 -0
  152. package/dist/output-gateway/ropid-gtfs/data-access/redis/GtfsStopsRedisRepository.js.map +1 -0
  153. package/dist/output-gateway/shared/constants/route-version.d.ts +2 -1
  154. package/dist/output-gateway/shared/constants/route-version.js +1 -0
  155. package/dist/output-gateway/shared/constants/route-version.js.map +1 -1
  156. package/dist/output-gateway/{public → shared}/service/VPSubscriber.d.ts +4 -2
  157. package/dist/output-gateway/{public → shared}/service/VPSubscriber.js +1 -1
  158. package/dist/output-gateway/shared/service/VPSubscriber.js.map +1 -0
  159. package/dist/schema-definitions/jis/redis/const.d.ts +1 -0
  160. package/dist/schema-definitions/jis/redis/const.js +2 -1
  161. package/dist/schema-definitions/jis/redis/const.js.map +1 -1
  162. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.d.ts +17 -0
  163. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js +3 -0
  164. package/dist/schema-definitions/jis/redis/interfaces/IJISInfotextDto.js.map +1 -0
  165. package/dist/schema-definitions/jis/redis/interfaces/IJISMetadataDto.d.ts +1 -5
  166. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.d.ts +3 -0
  167. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js +59 -0
  168. package/dist/schema-definitions/jis/redis/schemas/JISInfotextDtoSchema.js.map +1 -0
  169. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js +5 -11
  170. package/dist/schema-definitions/jis/redis/schemas/JISMetadataDtoSchema.js.map +1 -1
  171. package/dist/schema-definitions/ropid-departures-presets/index.d.ts +1 -0
  172. package/dist/schema-definitions/ropid-departures-presets/index.js +3 -0
  173. package/dist/schema-definitions/ropid-departures-presets/index.js.map +1 -1
  174. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.d.ts +16 -0
  175. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js +3 -0
  176. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js.map +1 -0
  177. package/dist/schema-definitions/ropid-gtfs/interfaces/IStopDto.d.ts +1 -0
  178. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.d.ts +58 -0
  179. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js +69 -0
  180. package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js.map +1 -0
  181. package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +1 -0
  182. package/dist/schema-definitions/ropid-gtfs/redis/const.js +2 -1
  183. package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
  184. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +3 -2
  185. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +4 -0
  186. package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -1
  187. package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +1 -0
  188. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +2 -0
  189. package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +1 -0
  190. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +8 -0
  191. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
  192. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +4 -1
  193. package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
  194. package/docs/asyncapi.yaml +45 -0
  195. package/docs/cache/types/redis.md +82 -2
  196. package/docs/implementation_documentation.md +2 -0
  197. package/docs/jis/index.md +17 -5
  198. package/docs/openapi-input.yaml +13 -2
  199. package/docs/openapi-output.yaml +326 -4
  200. package/package.json +2 -2
  201. package/dist/output-gateway/public/service/VPSubscriber.js.map +0 -1
package/README.md CHANGED
@@ -43,4 +43,4 @@ npm install --save-exact @golemio/pid@dev
43
43
 
44
44
  <!-- ## Description -->
45
45
 
46
- <!-- Insert module-specific info here -->
46
+ <!-- Insert module-specific info here -->
@@ -0,0 +1,8 @@
1
+ {
2
+ "awsNodeToGtfsStops": [
3
+ {
4
+ "476": "U476Z1P,U476Z2P,U476Z5P,U476Z101P,U476Z102P"
5
+ }
6
+ ],
7
+ "cisToAswNode": [{ "59162": "476" }]
8
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "infotexts": [
3
+ {
4
+ "75eb0ccc-2a35-4260-bdaf-c61565a9c888": {
5
+ "id": "75eb0ccc-2a35-4260-bdaf-c61565a9c888",
6
+ "severity_level": "SEVERE",
7
+ "display_type": "INLINE",
8
+ "active_period_start": "2000-03-28T09:11:00.000Z",
9
+ "active_period_end": null,
10
+ "description_text": {
11
+ "cs": "test",
12
+ "en": "test"
13
+ },
14
+ "created_timestamp": "2025-03-07T08:49:25.907Z",
15
+ "updated_timestamp": "2025-04-10T20:54:14.646Z",
16
+ "created_at": "2025-07-01T11:41:41.689Z",
17
+ "updated_at": "2025-07-01T11:41:41.689Z",
18
+ "stops": [
19
+ {
20
+ "stop_id": "U476Z2P"
21
+ }
22
+ ]
23
+ }
24
+ }
25
+ ],
26
+ "stops-infotexts": [
27
+ {
28
+ "U476Z2P": "75eb0ccc-2a35-4260-bdaf-c61565a9c888"
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20250716143052-add-stop-name-to-combined-stop-times-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20250716143052-add-stop-name-to-combined-stop-times-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,47 @@
1
+ drop view v_public_vehiclepositions_combined_stop_times;
2
+
3
+ create view v_public_vehiclepositions_combined_stop_times as
4
+ select
5
+ distinct on (rt_trip_id, stop_sequence) stop_times.rt_trip_id,
6
+ vt.gtfs_trip_id,
7
+ stop_times.stop_sequence,
8
+ stop_times.stop_arr_delay,
9
+ stop_times.stop_dep_delay,
10
+ vt.gtfs_route_type,
11
+ vt.gtfs_route_short_name,
12
+ vt.run_number,
13
+ vt.internal_run_number,
14
+ vt.provider_source_type,
15
+ vt.cis_trip_number,
16
+ vt.vehicle_registration_number,
17
+ stop_times.stop_id,
18
+ vcs.cis_stop_platform_code,
19
+ rs.platform_code
20
+ from
21
+ (
22
+ select
23
+ *
24
+ from
25
+ v_public_vehiclepositions_future_stop_times prediction
26
+ union
27
+ all
28
+ select
29
+ *
30
+ from
31
+ v_public_vehiclepositions_past_stop_times history
32
+ ) as stop_times
33
+ join vehiclepositions_trips vt on vt.id = stop_times.rt_trip_id
34
+ join vehiclepositions_positions vp on vt.last_position_id = vp.id
35
+ and (
36
+ vp.valid_to is null
37
+ or vp.valid_to >= now()
38
+ )
39
+ and vp.state_position != 'after_track'
40
+ left join ropidgtfs_stops rs on rs.stop_id = stop_times.stop_id
41
+ left join ropidgtfs_cis_stops rcs on rcs.id = rs.computed_cis_stop_id
42
+ left join vehiclepositions_cis_stops vcs
43
+ on vcs.rt_trip_id = stop_times.rt_trip_id
44
+ and vcs.cis_stop_group_id = rcs.cis
45
+ order by
46
+ rt_trip_id,
47
+ stop_sequence;
@@ -0,0 +1,47 @@
1
+ create
2
+ or replace view v_public_vehiclepositions_combined_stop_times as
3
+ select
4
+ distinct on (rt_trip_id, stop_sequence) stop_times.rt_trip_id,
5
+ vt.gtfs_trip_id,
6
+ stop_times.stop_sequence,
7
+ stop_times.stop_arr_delay,
8
+ stop_times.stop_dep_delay,
9
+ vt.gtfs_route_type,
10
+ vt.gtfs_route_short_name,
11
+ vt.run_number,
12
+ vt.internal_run_number,
13
+ vt.provider_source_type,
14
+ vt.cis_trip_number,
15
+ vt.vehicle_registration_number,
16
+ stop_times.stop_id,
17
+ vcs.cis_stop_platform_code,
18
+ rs.platform_code,
19
+ rs.stop_name
20
+ from
21
+ (
22
+ select
23
+ *
24
+ from
25
+ v_public_vehiclepositions_future_stop_times prediction
26
+ union
27
+ all
28
+ select
29
+ *
30
+ from
31
+ v_public_vehiclepositions_past_stop_times history
32
+ ) as stop_times
33
+ join vehiclepositions_trips vt on vt.id = stop_times.rt_trip_id
34
+ join vehiclepositions_positions vp on vt.last_position_id = vp.id
35
+ and (
36
+ vp.valid_to is null
37
+ or vp.valid_to >= now()
38
+ )
39
+ and vp.state_position != 'after_track'
40
+ left join ropidgtfs_stops rs on rs.stop_id = stop_times.stop_id
41
+ left join ropidgtfs_cis_stops rcs on rcs.id = rs.computed_cis_stop_id
42
+ left join vehiclepositions_cis_stops vcs
43
+ on vcs.rt_trip_id = stop_times.rt_trip_id
44
+ and vcs.cis_stop_group_id = rcs.cis
45
+ order by
46
+ rt_trip_id,
47
+ stop_sequence;
@@ -3,4 +3,6 @@ export declare class GtfsStopParser {
3
3
  prepareAswWhereOptions(aswIds: string[]): WhereOptions[];
4
4
  private isValidInteger;
5
5
  private validateAswId;
6
+ private parseAswId;
7
+ getAswNodeFromId(aswId: string): string;
6
8
  }
@@ -15,16 +15,12 @@ let GtfsStopParser = exports.GtfsStopParser = class GtfsStopParser {
15
15
  prepareAswWhereOptions(aswIds) {
16
16
  let aswWhereOptions = [];
17
17
  for (const aswId of aswIds) {
18
- let aswIdLike = aswId.replaceAll("_", "/");
19
- if (aswIdLike.slice(-1) === "/") {
20
- aswIdLike = aswIdLike.slice(0, -1);
21
- }
22
- const [nodeId, stopId] = aswIdLike.split("/");
23
- if (!nodeId) {
18
+ const { aswNode, aswStopId } = this.parseAswId(aswId);
19
+ if (!aswNode) {
24
20
  continue;
25
21
  }
26
- this.validateAswId(aswId, nodeId, stopId);
27
- aswWhereOptions.push(sequelize_1.Sequelize.and(sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_node_id"), "=", nodeId), stopId && sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_stop_id"), "=", stopId)));
22
+ this.validateAswId(aswId, aswNode, aswStopId);
23
+ aswWhereOptions.push(sequelize_1.Sequelize.and(sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_node_id"), "=", aswNode), aswStopId && sequelize_1.Sequelize.where(sequelize_1.Sequelize.col("asw_stop_id"), "=", aswStopId)));
28
24
  }
29
25
  return aswWhereOptions;
30
26
  }
@@ -37,6 +33,13 @@ let GtfsStopParser = exports.GtfsStopParser = class GtfsStopParser {
37
33
  throw new golemio_errors_1.GeneralError(`Invalid ASW ID: ${aswId}`, this.constructor.name, `Invalid ASW ID: ${aswId}`, 400);
38
34
  }
39
35
  }
36
+ parseAswId(aswId) {
37
+ const [aswNode, aswStopId] = aswId.replaceAll("_", "/").split("/");
38
+ return { aswNode, aswStopId };
39
+ }
40
+ getAswNodeFromId(aswId) {
41
+ return this.parseAswId(aswId).aswNode;
42
+ }
40
43
  };
41
44
  exports.GtfsStopParser = GtfsStopParser = __decorate([
42
45
  (0, tsyringe_1.injectable)()
@@ -1 +1 @@
1
- {"version":3,"file":"GtfsStopParser.js","sourceRoot":"","sources":["../../src/helpers/GtfsStopParser.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6EAAwE;AACxE,mEAA8E;AAC9E,iEAAgE;AAChE,oCAAmD;AAG5C,IAAM,cAAc,4BAApB,MAAM,cAAc;IAChB,sBAAsB,CAAC,MAAgB;QAC1C,IAAI,eAAe,GAAmB,EAAE,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YACxB,IAAI,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAE3C,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBAC7B,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;aACtC;YA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,KAAa;QAI5B,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;IAC1C,CAAC;CACJ,CAAA;yBA3CY,cAAc;IAD1B,IAAA,qBAAU,GAAE;GACA,cAAc,CA2C1B"}
@@ -0,0 +1,6 @@
1
+ /** Mapping of infotext severity level to numbers, where higher number = higher severity and priority */
2
+ export declare const JISInfotextSeverityLevelPriority: {
3
+ readonly INFO: 1;
4
+ readonly WARNING: 2;
5
+ readonly SEVERE: 3;
6
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JISInfotextSeverityLevelPriority = void 0;
4
+ const JISInfotextSeverityLevelEnum_1 = require("./JISInfotextSeverityLevelEnum");
5
+ /** Mapping of infotext severity level to numbers, where higher number = higher severity and priority */
6
+ exports.JISInfotextSeverityLevelPriority = {
7
+ [JISInfotextSeverityLevelEnum_1.JISInfotextSeverityLevel.Info]: 1,
8
+ [JISInfotextSeverityLevelEnum_1.JISInfotextSeverityLevel.Warning]: 2,
9
+ [JISInfotextSeverityLevelEnum_1.JISInfotextSeverityLevel.Severe]: 3,
10
+ };
11
+ //# sourceMappingURL=JISInfotextSeverityLevelPriority.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISInfotextSeverityLevelPriority.js","sourceRoot":"","sources":["../../../src/helpers/jis/JISInfotextSeverityLevelPriority.ts"],"names":[],"mappings":";;;AAAA,iFAA0E;AAE1E,wGAAwG;AAC3F,QAAA,gCAAgC,GAAG;IAC5C,CAAC,uDAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,CAAC,uDAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;IACrC,CAAC,uDAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;CAC9B,CAAC"}
@@ -20,7 +20,6 @@ class VehiclePositionsController extends controllers_1.BaseController {
20
20
  const dataBatches = this.splitData(inputData);
21
21
  for (const batch of dataBatches) {
22
22
  await this.sendMessageToExchange("input." + this.queuePrefix + ".saveDataToDB", JSON.stringify(batch), {
23
- persistent: true,
24
23
  timestamp: new Date().getTime(),
25
24
  });
26
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VehiclePositionsController.js","sourceRoot":"","sources":["../../../src/input-gateway/vehicle-positions/VehiclePositionsController.ts"],"names":[],"mappings":";;;AAAA,kFAA0D;AAG1D,wEAAqE;AACrE,8EAA8E;AAC9E,8DAA6E;AAC7E,6EAA8F;AAC9F,mFAAkF;AAElF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAa,0BAA2B,SAAQ,4BAAc;IAM1D;QACI,KAAK,CACD,oCAAgB,CAAC,IAAI,EACrB,IAAI,uCAAmB,CAAC,oCAAgB,CAAC,IAAI,GAAG,YAAY,EAAE,oCAAgB,CAAC,oBAAoB,CAAC,CACvG,CAAC;QAMN;;WAEG;QACI,gBAAW,GAAG,KAAK,EAAE,SAA2B,EAAiB,EAAE;YACtE,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB;gBAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAC9C,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE;oBAC7B,MAAM,IAAI,CAAC,qBAAqB,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;wBACnG,UAAU,EAAE,IAAI;wBAChB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,OA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AC,EAAE;gBAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;aACjB;YAED,MAAM,MAAM,GAAuB,EAAE,CAAC;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE;gBAChF,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC;gBAClD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;aACvC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC;QArCE,MAAM,MAAM,GAAG,2BAAqB,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QACpF,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,4CAA4C,EAAE,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/G,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;CAmCJ;AAjDD,gEAiDC"}
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JISContainer = void 0;
4
4
  const Di_1 = require("../../ioc/Di");
5
+ const RopidGTFSStopsModel_1 = require("../../ropid-gtfs/RopidGTFSStopsModel");
5
6
  const JISEventsDataSourceFactory_1 = require("../datasources/JISEventsDataSourceFactory");
6
7
  const JISInfotextsDataSourceFactory_1 = require("../datasources/JISInfotextsDataSourceFactory");
7
8
  const JISEventsRepository_1 = require("../repositories/JISEventsRepository");
8
9
  const JISEventsRopidGTFSRoutesRepository_1 = require("../repositories/JISEventsRopidGTFSRoutesRepository");
10
+ const JISInfotextsRedisRepository_1 = require("../repositories/JISInfotextsRedisRepository");
9
11
  const JISInfotextsRepository_1 = require("../repositories/JISInfotextsRepository");
10
12
  const JISInfotextsRopidGTFSStopsRepository_1 = require("../repositories/JISInfotextsRopidGTFSStopsRepository");
11
13
  const JISMetadataRepository_1 = require("../repositories/JISMetadataRepository");
@@ -17,8 +19,10 @@ const JISInfotextsTransformation_1 = require("../transformations/JISInfotextsTra
17
19
  const FetchJISEventsTask_1 = require("../workers/tasks/FetchJISEventsTask");
18
20
  const FetchJISInfotextsTask_1 = require("../workers/tasks/FetchJISInfotextsTask");
19
21
  const RefreshJISEventsTask_1 = require("../workers/tasks/RefreshJISEventsTask");
22
+ const RefreshJISInfotextsCacheTask_1 = require("../workers/tasks/RefreshJISInfotextsCacheTask");
20
23
  const RefreshJISInfotextsTask_1 = require("../workers/tasks/RefreshJISInfotextsTask");
21
24
  const JISContainerToken_1 = require("./JISContainerToken");
25
+ const JISInfotextCacheTranformation_1 = require("../transformations/JISInfotextCacheTranformation");
22
26
  //#region Initialization
23
27
  const JISContainer = Di_1.PidContainer.createChildContainer();
24
28
  exports.JISContainer = JISContainer;
@@ -27,12 +31,16 @@ exports.JISContainer = JISContainer;
27
31
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsDataSourceFactory, JISEventsDataSourceFactory_1.JISEventsDataSourceFactory);
28
32
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory, JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory);
29
33
  //#endregion
34
+ //#region Cache Repositories
35
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRedisRepository, JISInfotextsRedisRepository_1.JISInfotextsRedisRepository);
36
+ //#endregion
30
37
  //#region Repositories
31
38
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsRepository, JISEventsRepository_1.JISEventsRepository);
32
39
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsRopidGTFSRoutesRepository, JISEventsRopidGTFSRoutesRepository_1.JISEventsRopidGTFSRoutesRepository);
33
40
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRepository, JISInfotextsRepository_1.JISInfotextsRepository);
34
41
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository);
35
42
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISMetadataRepository, JISMetadataRepository_1.JISMetadataRepository);
43
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RopidGTFSStopsRepository, RopidGTFSStopsModel_1.RopidGTFSStopsModel);
36
44
  //#endregion
37
45
  //#region Services
38
46
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsDataService, JISEventsDataService_1.JISEventsDataService);
@@ -43,9 +51,11 @@ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.FetchJISEve
43
51
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask, FetchJISInfotextsTask_1.FetchJISInfotextsTask);
44
52
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISEventsTask, RefreshJISEventsTask_1.RefreshJISEventsTask);
45
53
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask, RefreshJISInfotextsTask_1.RefreshJISInfotextsTask);
54
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsCacheTask, RefreshJISInfotextsCacheTask_1.RefreshJISInfotextsCacheTask);
46
55
  //#endregion
47
56
  //#region Transformations
48
57
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsTransformation, JISEventsTransformation_1.JISEventsTransformation);
49
58
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsGtfsRtTransformation, JISEventsGtfsRtTransformation_1.JISEventsGtfsRtTransformation);
50
59
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation, JISInfotextsTransformation_1.JISInfotextsTransformation);
60
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextCacheTranformation, JISInfotextCacheTranformation_1.JISInfotextCacheTranformation);
51
61
  //# sourceMappingURL=Di.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAE1C,0FAAuF;AACvF,gGAA6F;AAC7F,6EAA0E;AAC1E,2GAAwG;AACxG,mFAAgF;AAChF,+GAA4G;AAC5G,iFAA8E;AAC9E,2EAAwE;AACxE,iFAA8E;AAC9E,oGAAiG;AACjG,wFAAqF;AACrF,8FAA2F;AAC3F,4EAAyE;AACzE,kFAA+E;AAC/E,gFAA6E;AAC7E,sFAAmF;AACnF,2DAAwD;AAExD,wBAAwB;AACxB,MAAM,YAAY,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;AAkCrE,oCAAY;AAjCrB,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACzG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AAC/G,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,mBAAmB,EAAE,yCAAmB,CAAC,CAAC;AAC3F,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,kCAAkC,EAAE,uEAAkC,CAAC,CAAC;AACzH,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC;AACjG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,oCAAoC,EAAE,2EAAoC,CAAC,CAAC;AAC7H,YAAY,CAAC,iBAAiB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C,qCAAiB,CAAC,kBAAkB,EAAE,uCAAkB,CAAC,CAAC;AACzF,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,CAAC;AAC7F,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,4BAA4B,EAAE,2DAA4B,CAAC,CAAC;AAC7G,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AAC/G,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACzG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC"}
@@ -1,19 +1,23 @@
1
1
  declare const JISContainerToken: {
2
2
  JISEventsDataSourceFactory: symbol;
3
3
  JISInfotextsDataSourceFactory: symbol;
4
+ JISInfotextsRedisRepository: symbol;
4
5
  JISEventsRepository: symbol;
5
6
  JISEventsRopidGTFSRoutesRepository: symbol;
6
7
  JISInfotextsRepository: symbol;
7
8
  JISInfotextsRopidGTFSStopsRepository: symbol;
8
9
  JISMetadataRepository: symbol;
10
+ RopidGTFSStopsRepository: symbol;
9
11
  JISEventsDataService: symbol;
10
12
  JISInfotextsDataService: symbol;
11
13
  JISEventsTransformation: symbol;
12
14
  JISEventsGtfsRtTransformation: symbol;
13
15
  JISInfotextsTransformation: symbol;
16
+ JISInfotextCacheTranformation: symbol;
14
17
  FetchJISEventsTask: symbol;
15
18
  FetchJISInfotextsTask: symbol;
16
19
  RefreshJISEventsTask: symbol;
17
20
  RefreshJISInfotextsTask: symbol;
21
+ RefreshJISInfotextsCacheTask: symbol;
18
22
  };
19
23
  export { JISContainerToken };
@@ -5,12 +5,15 @@ const JISContainerToken = {
5
5
  /* Data Sources */
6
6
  JISEventsDataSourceFactory: Symbol("JISEventsDataSourceFactory"),
7
7
  JISInfotextsDataSourceFactory: Symbol("JISInfotextsDataSourceFactory"),
8
+ /* Cache Repositories */
9
+ JISInfotextsRedisRepository: Symbol("JISInfotextsRedisRepository"),
8
10
  /* Repositories */
9
11
  JISEventsRepository: Symbol("JISEventsRepository"),
10
12
  JISEventsRopidGTFSRoutesRepository: Symbol("JISEventsRopidGTFSRoutesRepository"),
11
13
  JISInfotextsRepository: Symbol("JISInfotextsRepository"),
12
14
  JISInfotextsRopidGTFSStopsRepository: Symbol("JISInfotextsRopidGTFSStopsRepository"),
13
15
  JISMetadataRepository: Symbol("JISMetadataRepository"),
16
+ RopidGTFSStopsRepository: Symbol("RopidGTFSStopsRepository"),
14
17
  /* Services */
15
18
  JISEventsDataService: Symbol("JISEventsDataService"),
16
19
  JISInfotextsDataService: Symbol("JISInfotextsDataService"),
@@ -18,11 +21,13 @@ const JISContainerToken = {
18
21
  JISEventsTransformation: Symbol("JISEventsTransformation"),
19
22
  JISEventsGtfsRtTransformation: Symbol("JISEventsGtfsRtTransformation"),
20
23
  JISInfotextsTransformation: Symbol("JISInfotextsTransformation"),
24
+ JISInfotextCacheTranformation: Symbol("JISInfotextCacheTranformation"),
21
25
  /* Tasks */
22
26
  FetchJISEventsTask: Symbol("FetchJISEventsTask"),
23
27
  FetchJISInfotextsTask: Symbol("FetchJISInfotextsTask"),
24
28
  RefreshJISEventsTask: Symbol("RefreshJISEventsTask"),
25
29
  RefreshJISInfotextsTask: Symbol("RefreshJISInfotextsTask"),
30
+ RefreshJISInfotextsCacheTask: Symbol("RefreshJISInfotextsCacheTask"),
26
31
  };
27
32
  exports.JISContainerToken = JISContainerToken;
28
33
  //# sourceMappingURL=JISContainerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;CAC7D,CAAC;AAEO,8CAAiB"}
1
+ {"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,wBAAwB;IACxB,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAClE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC5D,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAAC;CACvE,CAAC;AAEO,8CAAiB"}
@@ -0,0 +1,9 @@
1
+ import { IJISInfotextDto } from "../../../schema-definitions/jis/redis/interfaces/IJISInfotextDto";
2
+ import { RedisModel } from "@golemio/core/dist/integration-engine";
3
+ export declare class JISInfotextsRedisRepository extends RedisModel {
4
+ static NAMESPACE_PREFIX: string;
5
+ constructor();
6
+ refreshData(infotexts: IJISInfotextDto[]): Promise<void>;
7
+ private createNewCache;
8
+ private deleteOldCache;
9
+ }
@@ -0,0 +1,86 @@
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 JISInfotextsRedisRepository_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.JISInfotextsRedisRepository = void 0;
14
+ const const_1 = require("../../../schema-definitions/jis/redis/const");
15
+ const JISInfotextDtoSchema_1 = require("../../../schema-definitions/jis/redis/schemas/JISInfotextDtoSchema");
16
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
17
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
18
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
19
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
20
+ const node_crypto_1 = require("node:crypto");
21
+ const TTL_SECONDS_BEFORE_DELETE = 60;
22
+ let JISInfotextsRedisRepository = exports.JISInfotextsRedisRepository = JISInfotextsRedisRepository_1 = class JISInfotextsRedisRepository extends integration_engine_1.RedisModel {
23
+ constructor() {
24
+ super("JISInfotextsRedisRepository", {
25
+ isKeyConstructedFromData: false,
26
+ prefix: JISInfotextsRedisRepository_1.NAMESPACE_PREFIX,
27
+ }, new golemio_validator_1.JSONSchemaValidator("JISInfotextsRedisRepositoryValidator", JISInfotextDtoSchema_1.JISInfotextDtoSchema));
28
+ }
29
+ async refreshData(infotexts) {
30
+ try {
31
+ const oldSetName = (await this.connection.get(`${this.prefix}:activeSetName`)) ?? "";
32
+ await this.createNewCache(infotexts);
33
+ await this.deleteOldCache(oldSetName);
34
+ }
35
+ catch (err) {
36
+ throw new golemio_errors_1.GeneralError("refreshData failed", this.constructor.name, err);
37
+ }
38
+ }
39
+ async createNewCache(infotexts) {
40
+ try {
41
+ await this.validator.Validate(infotexts);
42
+ }
43
+ catch (error) {
44
+ throw new golemio_errors_1.GeneralError(`JISInfotextsRedisRepository: data validation failed: ${error.message}`, this.constructor.name, error);
45
+ }
46
+ try {
47
+ const infotextIdsByStopId = new Map();
48
+ const infotextsByInfotextId = new Map();
49
+ for (const infotext of infotexts) {
50
+ infotextsByInfotextId.set(infotext.id, JSON.stringify(infotext));
51
+ for (const { stop_id } of infotext?.stops ?? []) {
52
+ let stopInfotextsIds = infotextIdsByStopId.get(stop_id) ?? [];
53
+ stopInfotextsIds.push(infotext.id);
54
+ infotextIdsByStopId.set(stop_id, stopInfotextsIds);
55
+ }
56
+ }
57
+ const setName = (0, node_crypto_1.randomBytes)(4).toString("hex");
58
+ const pipeline = this.connection.pipeline();
59
+ pipeline.hset(`${this.prefix}:${setName}:infotexts`, infotextsByInfotextId);
60
+ pipeline.hset(`${this.prefix}:${setName}:stops-infotexts`, infotextIdsByStopId);
61
+ pipeline.publish(`${this.prefix}`, `${this.prefix}:${setName}`);
62
+ pipeline.set(`${this.prefix}:activeSetName`, `${this.prefix}:${setName}`);
63
+ await pipeline.exec();
64
+ }
65
+ catch (err) {
66
+ throw new golemio_errors_1.GeneralError("createNewCache failed", this.constructor.name, err);
67
+ }
68
+ }
69
+ async deleteOldCache(setName) {
70
+ try {
71
+ const pipeline = this.connection.pipeline();
72
+ pipeline.expire(`${setName}:infotexts`, TTL_SECONDS_BEFORE_DELETE);
73
+ pipeline.expire(`${setName}:stops-infotexts`, TTL_SECONDS_BEFORE_DELETE);
74
+ await pipeline.exec();
75
+ }
76
+ catch (err) {
77
+ throw new golemio_errors_1.GeneralError("deleteOldCache failed", this.constructor.name, err);
78
+ }
79
+ }
80
+ };
81
+ JISInfotextsRedisRepository.NAMESPACE_PREFIX = const_1.JIS_NAMESPACE_PREFIX;
82
+ exports.JISInfotextsRedisRepository = JISInfotextsRedisRepository = JISInfotextsRedisRepository_1 = __decorate([
83
+ (0, tsyringe_1.injectable)(),
84
+ __metadata("design:paramtypes", [])
85
+ ], JISInfotextsRedisRepository);
86
+ //# sourceMappingURL=JISInfotextsRedisRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JISInfotextsRedisRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRedisRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,uEAA4D;AAE5D,6GAAmF;AACnF,8EAAmE;AACnE,6EAAwE;AACxE,mFAAkF;AAClF,iEAAgE;AAChE,6CAA0C;AAE1C,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAG9B,IAAM,2BAA2B,yEAAjC,MAAM,2BAA4B,SAAQ,+BAAU;IAGvD;QACI,KAAK,CACD,6BAA6B,EAC7B;YACI,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,6BAA2B,CAAC,gBAAgB;SACvD,EACD,IAAI,uCAAmB,CAAC,sCAAsC,EAAE,2CAAoB,CAAC,CACxF,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAA4B;QACjD,IAAI;YACA,MAAM,UAAU,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,gBAAgB,CAAC,CAAC,IAAI,EAAE,CAAC;YACrF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YACrC,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;SACzC;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAA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,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;YAChF,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;YAChE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,gBAAgB,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;YAC1E,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SACzB;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,uBAAuB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC/E;IACL,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAAe;QACxC,IAAI;YACA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YAC5C,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,YAAY,EAAE,yBAAyB,CAAC,CAAC;YACnE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,kBAAkB,EAAE,yBAAyB,CAAC,CAAC;YACzE,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SACzB;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,6BAAY,CAAC,uBAAuB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC/E;IACL,CAAC;;AAnEa,4CAAgB,GAAG,4BAAoB,AAAvB,CAAwB;sCAD7C,2BAA2B;IADvC,IAAA,qBAAU,GAAE;;GACA,2BAA2B,CAqEvC"}
@@ -1,3 +1,4 @@
1
+ import { RopidGTFSStopsModel } from "../../ropid-gtfs";
1
2
  import { JISInfotextsModel } from "../../../schema-definitions/jis/models/JISInfotextsModel";
2
3
  import { IJISInfotext } from "../../../schema-definitions/jis/models/interfaces";
3
4
  import { ILogger } from "@golemio/core/dist/helpers";
@@ -5,16 +6,19 @@ import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postg
5
6
  import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
6
7
  import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
7
8
  import { Transaction } from "@golemio/core/dist/shared/sequelize";
9
+ import { JISInfotextsRopidGTFSStopsRepository } from "./JISInfotextsRopidGTFSStopsRepository";
8
10
  type RepositoryOptions = {
9
11
  transaction?: Transaction;
10
12
  };
11
13
  export declare class JISInfotextsRepository extends AbstractValidatableRepository {
12
14
  private logger;
15
+ private infotextStopRepository;
16
+ private gtfsStopRepository;
13
17
  validator: JSONSchemaValidator;
14
18
  schema: string;
15
19
  tableName: string;
16
20
  private sequelizeModel;
17
- constructor(connector: IDatabaseConnector, logger: ILogger);
21
+ constructor(connector: IDatabaseConnector, logger: ILogger, infotextStopRepository: JISInfotextsRopidGTFSStopsRepository, gtfsStopRepository: RopidGTFSStopsModel);
18
22
  /**
19
23
  * Refresh all data from VYMI and delete old data
20
24
  *
@@ -28,5 +32,6 @@ export declare class JISInfotextsRepository extends AbstractValidatableRepositor
28
32
  * @returns The number of deleted items
29
33
  */
30
34
  deleteAll(options?: RepositoryOptions): Promise<number>;
35
+ findAll(): Promise<JISInfotextsModel[]>;
31
36
  }
32
37
  export {};