@golemio/pid 3.2.3-dev.1572823338 → 3.2.3-dev.1589820139

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 (29) hide show
  1. package/db/example/20_jis_infotexts.sql +18 -17
  2. package/dist/input-gateway/jis/JisInfotextsController.d.ts +9 -0
  3. package/dist/input-gateway/jis/JisInfotextsController.js +37 -0
  4. package/dist/input-gateway/jis/JisInfotextsController.js.map +1 -0
  5. package/dist/input-gateway/jis/JisInfotextsRouter.d.ts +9 -0
  6. package/dist/input-gateway/jis/JisInfotextsRouter.js +36 -0
  7. package/dist/input-gateway/jis/JisInfotextsRouter.js.map +1 -0
  8. package/dist/integration-engine/jis/ioc/Di.js +2 -0
  9. package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
  10. package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +1 -0
  11. package/dist/integration-engine/jis/ioc/JISContainerToken.js +1 -0
  12. package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
  13. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +3 -4
  14. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +32 -7
  15. package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
  16. package/dist/integration-engine/jis/services/JISInfotextsDataService.js +1 -2
  17. package/dist/integration-engine/jis/services/JISInfotextsDataService.js.map +1 -1
  18. package/dist/integration-engine/jis/workers/JISWorker.js +1 -0
  19. package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
  20. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.d.ts +10 -0
  21. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js +62 -0
  22. package/dist/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.js.map +1 -0
  23. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +8 -12
  24. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +13 -48
  25. package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
  26. package/docs/asyncapi.yaml +96 -2
  27. package/docs/implementation_documentation.md +9 -20
  28. package/docs/openapi-input.yaml +192 -1
  29. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  -- 0
2
2
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
3
- VALUES ('40507cee-6468-488e-ba78-e36d9c20e67c', 'SEVERE', 'INLINE', '2024-02-07 13:11:00.000+01', NULL, '{"cs": "Provoz tramvají směrem z centra na Starý Hloubětín z důvodu údržby přerušen do neděle 18:00. Zaveden autobus X-8.", "en": "No tram service in direction to Starý Hloubětín until Sunday 18:00 due to track maintenance. Replacement bus X-8 instated."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
3
+ VALUES ('40507cee-6468-488e-ba78-e36d9c20e67c', 'SEVERE', 'INLINE', '2024-02-07 13:11:00.000+01', NULL, '{"cs": "Provoz tramvají směrem z centra na Starý Hloubětín z důvodu údržby přerušen do neděle 18:00. Zaveden autobus X-8.", "en": "No tram service in direction to Starý Hloubětín until Sunday 18:00 due to track maintenance. Replacement bus X-8 instated."}', '2024-02-07 13:24:55.000', now());
4
4
 
5
5
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
6
6
  VALUES ('40507cee-6468-488e-ba78-e36d9c20e67c', 'U1131Z1P', '2024-04-19 09:00:00+02', now() + interval '1 day');
7
7
 
8
8
  -- 1
9
9
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
10
- VALUES ('6bdc3fdb-dd18-438b-878a-7972bddb0d92', 'SEVERE', 'INLINE', '2024-03-05 08:30:00.000+02', NULL, '{"cs": "cca 8:30 - 9:15: VŠECHNY LINKY ODKLON do zast. BUDĚJOVICKÁ, stanice Kačerov uzavřena.", "en": "approx. 8:30 - 9:15: ALL LINES DEPARTURE to stop. BUDĚJOVICKÁ, station Kačerov closed."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
10
+ VALUES ('6bdc3fdb-dd18-438b-878a-7972bddb0d92', 'SEVERE', 'INLINE', '2024-03-05 08:30:00.000+02', NULL, '{"cs": "cca 8:30 - 9:15: VŠECHNY LINKY ODKLON do zast. BUDĚJOVICKÁ, stanice Kačerov uzavřena.", "en": "approx. 8:30 - 9:15: ALL LINES DEPARTURE to stop. BUDĚJOVICKÁ, station Kačerov closed."}', '2024-02-07 13:24:55.000', now());
11
11
 
12
12
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
13
13
  VALUES ('6bdc3fdb-dd18-438b-878a-7972bddb0d92', 'U1132Z1P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -15,7 +15,7 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
15
15
 
16
16
  -- 2
17
17
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
18
- VALUES ('eba39046-86d2-4f8c-aa39-932dfcfd6d0f', 'SEVERE', 'INLINE', '2024-03-04 13:11:00.000+02', NULL, '{"cs": "Cizí dopravní nehoda ve Psárském lese. Linka 332 je odkloněna přes Libeř, přičemž neobsluhuje zastávku Psáry,Domov Laguna.", "en": "Traffic accident in the Psar Forest. Line 332 is diverted via Libeř, while it does not serve the stop Psáry,Domov Laguna.."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
18
+ VALUES ('eba39046-86d2-4f8c-aa39-932dfcfd6d0f', 'SEVERE', 'INLINE', '2024-03-04 13:11:00.000+02', NULL, '{"cs": "Cizí dopravní nehoda ve Psárském lese. Linka 332 je odkloněna přes Libeř, přičemž neobsluhuje zastávku Psáry,Domov Laguna.", "en": "Traffic accident in the Psar Forest. Line 332 is diverted via Libeř, while it does not serve the stop Psáry,Domov Laguna.."}', '2024-02-07 13:24:55.000', now());
19
19
 
20
20
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
21
21
  VALUES ('eba39046-86d2-4f8c-aa39-932dfcfd6d0f', 'U713Z102P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -23,14 +23,14 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
23
23
 
24
24
  -- 3
25
25
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
26
- VALUES ('8556cf18-786b-453a-a516-85c8fe2b9878', 'SEVERE', 'INLINE', '2024-03-02 10:00:00.000+02', NULL, '{"cs": "Dnes v noci tramvaje mimo provoz. Zastávky náhradních autobusů X8 a X90: směr Lehovec - vlevo, u Lidlu; směr Palmovka - na chodníku u původní tramvajové zastávky.", "en": "Trams out of service tonight. Stopping points for replacement buses X8 and X90: direction Lehovec - left, near Lidl; direction Palmovka - on the pavement near the original tram stop."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
26
+ VALUES ('8556cf18-786b-453a-a516-85c8fe2b9878', 'SEVERE', 'INLINE', '2024-03-02 10:00:00.000+02', NULL, '{"cs": "Dnes v noci tramvaje mimo provoz. Zastávky náhradních autobusů X8 a X90: směr Lehovec - vlevo, u Lidlu; směr Palmovka - na chodníku u původní tramvajové zastávky.", "en": "Trams out of service tonight. Stopping points for replacement buses X8 and X90: direction Lehovec - left, near Lidl; direction Palmovka - on the pavement near the original tram stop."}', '2024-02-07 13:24:55.000', now());
27
27
 
28
28
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
29
29
  VALUES ('8556cf18-786b-453a-a516-85c8fe2b9878', 'U1334Z2P', '2024-04-19 09:00:00+02', now() + interval '1 day');
30
30
 
31
31
  -- 4
32
32
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
33
- VALUES ('9923c199-d61c-47fa-9f7e-14d01473eb18', 'SEVERE', 'GENERAL', '2024-03-18 16:00:00.000+02', NULL, '{"cs": "Dnes v sobotu 8. konání půl maratonu. Od 16h do 23h změna trasy linek 392, 395, 500, 501, 502, 503, 506, 517, 531, 754. Podrobnosti na zastávkách a pid.cz/zmeny", "en": "Today on Saturday the 8th holding of the half marathon. From 16h to 23h change of route of lines 392, 395, 500, 501, 502, 503, 506, 517, 531, 754. Details at the stops and pid.cz/changes"}', '2024-02-07 13:24:55.000', now() + interval '1 day');
33
+ VALUES ('9923c199-d61c-47fa-9f7e-14d01473eb18', 'SEVERE', 'GENERAL', '2024-03-18 16:00:00.000+02', NULL, '{"cs": "Dnes v sobotu 8. konání půl maratonu. Od 16h do 23h změna trasy linek 392, 395, 500, 501, 502, 503, 506, 517, 531, 754. Podrobnosti na zastávkách a pid.cz/zmeny", "en": "Today on Saturday the 8th holding of the half marathon. From 16h to 23h change of route of lines 392, 395, 500, 501, 502, 503, 506, 517, 531, 754. Details at the stops and pid.cz/changes"}', '2024-02-07 13:24:55.000', now());
34
34
 
35
35
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
36
36
  VALUES ('9923c199-d61c-47fa-9f7e-14d01473eb18', 'U376Z105P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -38,7 +38,7 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
38
38
 
39
39
  -- 5
40
40
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
41
- VALUES ('0a3c97d0-43d4-4882-8a1d-27079044f51b', 'SEVERE', 'INLINE', '2024-03-25 10:00:00.000+02', NULL, '{"cs": "Do 15:00 je zastávka mimo provoz. Linky 1, 12 a 25 odjíždí ze stanoviště D, od nábřeží. Linky 8 jede ze stanoviště E od Výstaviště, linka 26 zde neprojíždí.", "en": "The stop is out of service until 15:00. Lines 1, 12 and 25 depart from Station D, from the waterfront. Line 8 departs from station E from the Exhibition Grounds, line 26 does not run here."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
41
+ VALUES ('0a3c97d0-43d4-4882-8a1d-27079044f51b', 'SEVERE', 'INLINE', '2024-03-25 10:00:00.000+02', NULL, '{"cs": "Do 15:00 je zastávka mimo provoz. Linky 1, 12 a 25 odjíždí ze stanoviště D, od nábřeží. Linky 8 jede ze stanoviště E od Výstaviště, linka 26 zde neprojíždí.", "en": "The stop is out of service until 15:00. Lines 1, 12 and 25 depart from Station D, from the waterfront. Line 8 departs from station E from the Exhibition Grounds, line 26 does not run here."}', '2024-02-07 13:24:55.000', now());
42
42
 
43
43
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
44
44
  VALUES ('0a3c97d0-43d4-4882-8a1d-27079044f51b', 'U476Z104P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -46,7 +46,7 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
46
46
 
47
47
  -- 6
48
48
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
49
- VALUES ('ba52df69-5db3-4c60-94be-8f4b5442c1e0', 'SEVERE', 'INLINE', '2024-03-11 13:11:00.000+02', NULL, '{"cs": "Do 16:00 zde nejezdí tramvaje z důvodu údržby tratě, mezi Palmovkou a Lehovcem využijte náhradní autobus X-8.", "en": "Trams do not run here until 16:00 due to track maintenance, use the alternative bus X-8 between Palmovka and Lehovec."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
49
+ VALUES ('ba52df69-5db3-4c60-94be-8f4b5442c1e0', 'SEVERE', 'INLINE', '2024-03-11 13:11:00.000+02', NULL, '{"cs": "Do 16:00 zde nejezdí tramvaje z důvodu údržby tratě, mezi Palmovkou a Lehovcem využijte náhradní autobus X-8.", "en": "Trams do not run here until 16:00 due to track maintenance, use the alternative bus X-8 between Palmovka and Lehovec."}', '2024-02-07 13:24:55.000', now());
50
50
 
51
51
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
52
52
  VALUES ('ba52df69-5db3-4c60-94be-8f4b5442c1e0', 'U953Z102P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -54,28 +54,28 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
54
54
 
55
55
  -- 7
56
56
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
57
- VALUES ('ee330c7f-cf53-4762-a231-08af9f22442f', 'SEVERE', 'INLINE', '2024-03-04 10:00:00.000+02', '2024-08-10 18:00:00.000+02', '{"cs": "Do 18:00 údržba tramvajové trati Hlubočepy – Slivenec. Tram 12 a 20 zkráceny do zastávky Hlubočepy.", "en": "Until 18:00 maintenance of the tram line Hlubočepy - Slivenec. Tram 12 and 20 shortened to the Hlubočepy stop."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
57
+ VALUES ('ee330c7f-cf53-4762-a231-08af9f22442f', 'SEVERE', 'INLINE', '2024-03-04 10:00:00.000+02', '2024-08-10 18:00:00.000+02', '{"cs": "Do 18:00 údržba tramvajové trati Hlubočepy – Slivenec. Tram 12 a 20 zkráceny do zastávky Hlubočepy.", "en": "Until 18:00 maintenance of the tram line Hlubočepy - Slivenec. Tram 12 and 20 shortened to the Hlubočepy stop."}', '2024-02-07 13:24:55.000', now());
58
58
 
59
59
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
60
60
  VALUES ('ee330c7f-cf53-4762-a231-08af9f22442f', 'U118Z102P', '2024-04-19 09:00:00+02', now() + interval '1 day');
61
61
 
62
62
  -- 8
63
63
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
64
- VALUES ('265cdc5b-d6da-48e0-a114-6901200c4d46', 'SEVERE', 'GENERAL', '2024-03-27 10:00:00.000+02', '2024-09-11 00:00:00.000+02', '{"cs": "Do 10.9. 24:00 nepojedou tramvaje mezi Výstavištěm a Strossmayerovým náměstím. Pro cestu na Strossmayerovo náměstí použijte linky 12 nebo 17.", "en": "Trams will not run between Výstaviště and Strossmayer Square until 24:00 on 24 April. Use lines 12 or 17 to get to Strossmayer Square."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
64
+ VALUES ('265cdc5b-d6da-48e0-a114-6901200c4d46', 'SEVERE', 'GENERAL', '2024-03-27 10:00:00.000+02', '2024-09-11 00:00:00.000+02', '{"cs": "Do 10.9. 24:00 nepojedou tramvaje mezi Výstavištěm a Strossmayerovým náměstím. Pro cestu na Strossmayerovo náměstí použijte linky 12 nebo 17.", "en": "Trams will not run between Výstaviště and Strossmayer Square until 24:00 on 24 April. Use lines 12 or 17 to get to Strossmayer Square."}', '2024-02-07 13:24:55.000', now());
65
65
 
66
66
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
67
67
  VALUES ('265cdc5b-d6da-48e0-a114-6901200c4d46', 'U462Z102P', '2024-04-19 09:00:00+02', now() + interval '1 day');
68
68
 
69
69
  -- 9
70
70
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
71
- VALUES ('adfd2cef-9c2c-4ed0-bd0d-be0b3216faad', 'SEVERE', 'INLINE', '2024-03-28 09:00:00.000+02', '2024-09-22 00:00:00.000+02', '{"cs": "Do nedělní půlnoci přerušen provoz odsud na Výstaviště. Linka 6 jede přes Pražskou tržnici. Polovina spojů 17 odkloněna přes Pražskou tržnici a Nádraží Holešovice. Druhá polovina pokračuje jako 27 přes Letnou na Špejchar. Využijte náhradní autobus X6.", "en": "Until Sunday midnight no tram service from here to Výstaviště. Tram 6 diverted via Pražská tržnice. Every other tram 17 diverted via Pražská tržnice and Nádraží Holešovice. The rest of 17 turns left to end at Špejchar. Use substitute bus X6."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
71
+ VALUES ('adfd2cef-9c2c-4ed0-bd0d-be0b3216faad', 'SEVERE', 'INLINE', '2024-03-28 09:00:00.000+02', '2024-09-22 00:00:00.000+02', '{"cs": "Do nedělní půlnoci přerušen provoz odsud na Výstaviště. Linka 6 jede přes Pražskou tržnici. Polovina spojů 17 odkloněna přes Pražskou tržnici a Nádraží Holešovice. Druhá polovina pokračuje jako 27 přes Letnou na Špejchar. Využijte náhradní autobus X6.", "en": "Until Sunday midnight no tram service from here to Výstaviště. Tram 6 diverted via Pražská tržnice. Every other tram 17 diverted via Pražská tržnice and Nádraží Holešovice. The rest of 17 turns left to end at Špejchar. Use substitute bus X6."}', '2024-02-07 13:24:55.000', now());
72
72
 
73
73
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
74
74
  VALUES ('adfd2cef-9c2c-4ed0-bd0d-be0b3216faad', 'U209Z102P', '2024-04-19 09:00:00+02', now() + interval '1 day');
75
75
 
76
76
  -- 10
77
77
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
78
- VALUES ('15bd72da-a3da-484b-b592-742deab84b55', 'WARNING', 'INLINE', '2024-03-22 13:11:00.000+02', '2024-10-06 13:11:00.000+02', '{"cs": "Do pondělní půlnoci probíhá výluka metra C mezi I. P. Pavlova a Nádraží Holešovice. Náhradní autobus X-C navazuje ze zastávky I. P. Pavlova.", "en": "Until Monday midnight, the C metro station is closed between I. P. Pavlova and Nádraží Holešovice. A replacement bus X-C will connect from the stop I. P. Pavlova."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
78
+ VALUES ('15bd72da-a3da-484b-b592-742deab84b55', 'WARNING', 'INLINE', '2024-03-22 13:11:00.000+02', '2024-10-06 13:11:00.000+02', '{"cs": "Do pondělní půlnoci probíhá výluka metra C mezi I. P. Pavlova a Nádraží Holešovice. Náhradní autobus X-C navazuje ze zastávky I. P. Pavlova.", "en": "Until Monday midnight, the C metro station is closed between I. P. Pavlova and Nádraží Holešovice. A replacement bus X-C will connect from the stop I. P. Pavlova."}', '2024-02-07 13:24:55.000', now());
79
79
 
80
80
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
81
81
  VALUES ('15bd72da-a3da-484b-b592-742deab84b55', 'U476Z102P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -85,7 +85,7 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
85
85
 
86
86
  -- 11
87
87
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
88
- VALUES ('a7446544-a907-4b9f-877b-b29458ad9c82', 'SEVERE', 'INLINE', '2024-03-16 10:00:00.000+02', '2024-05-15 00:00:00.000+02', '{"cs": "Do pondělní půlnoci probíhá výluka metra C mezi Nádražím Holešovice a I. P. Pavlova. Náhradní autobus X-C odjíždí z nástupiště C (jako bus 201).", "en": "Until Monday midnight, the C metro station is closed between Nádraž Holešovice and I. P. Pavlova. The replacement bus X-C departs from platform C (as bus 201)."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
88
+ VALUES ('a7446544-a907-4b9f-877b-b29458ad9c82', 'SEVERE', 'INLINE', '2024-03-16 10:00:00.000+02', '2024-05-15 00:00:00.000+02', '{"cs": "Do pondělní půlnoci probíhá výluka metra C mezi Nádražím Holešovice a I. P. Pavlova. Náhradní autobus X-C odjíždí z nástupiště C (jako bus 201).", "en": "Until Monday midnight, the C metro station is closed between Nádraž Holešovice and I. P. Pavlova. The replacement bus X-C departs from platform C (as bus 201)."}', '2024-02-07 13:24:55.000', now());
89
89
 
90
90
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
91
91
  VALUES ('a7446544-a907-4b9f-877b-b29458ad9c82', 'U1131Z1P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -95,14 +95,14 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
95
95
 
96
96
  -- 12
97
97
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
98
- VALUES ('07a8449a-52b2-4266-a611-89d2b8758637', 'SEVERE', 'INLINE', '2024-09-10 17:00:00.000+02', '2024-11-20 00:00:00.000+02', '{"cs": "Do pondělní půlnoci probíhá výluka metra C mezi Nádražím Holešovice a I. P. Pavlova. Zastávky náhradního autobusu X-C jsou na Florenci nahoře na magistrále.", "en": "Until Monday midnight, the C metro station is closed between Nádraž Holešovice and I. P. Pavlova. The stops of the replacement bus X-C are at Florence at the top of the main line."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
98
+ VALUES ('07a8449a-52b2-4266-a611-89d2b8758637', 'SEVERE', 'INLINE', '2024-09-10 17:00:00.000+02', '2024-11-20 00:00:00.000+02', '{"cs": "Do pondělní půlnoci probíhá výluka metra C mezi Nádražím Holešovice a I. P. Pavlova. Zastávky náhradního autobusu X-C jsou na Florenci nahoře na magistrále.", "en": "Until Monday midnight, the C metro station is closed between Nádraž Holešovice and I. P. Pavlova. The stops of the replacement bus X-C are at Florence at the top of the main line."}', '2024-02-07 13:24:55.000', now());
99
99
 
100
100
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
101
101
  VALUES ('07a8449a-52b2-4266-a611-89d2b8758637', 'U1131Z2P', '2024-04-19 09:00:00+02', now() + interval '1 day');
102
102
 
103
103
  -- 13
104
104
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
105
- VALUES ('59a0b461-df44-42a6-940f-2abf0fd4e980', 'INFO', 'GENERAL', '2024-03-01 00:00.000+02', '2024-06-12 00:00.000+02', '{"cs": "Do pondělí 12.6. bude uzavřen tento vstup do metra. Vstup od zastávky tramvaje v ulici Plynární zůstává v provozu.", "en": "This entrance to the metro will be closed until Monday 12 June. The entrance from the tram stop in Plynární Street will remain open."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
105
+ VALUES ('59a0b461-df44-42a6-940f-2abf0fd4e980', 'INFO', 'GENERAL', '2024-03-01 00:00.000+02', '2024-06-12 00:00.000+02', '{"cs": "Do pondělí 12.6. bude uzavřen tento vstup do metra. Vstup od zastávky tramvaje v ulici Plynární zůstává v provozu.", "en": "This entrance to the metro will be closed until Monday 12 June. The entrance from the tram stop in Plynární Street will remain open."}', '2024-02-07 13:24:55.000', now());
106
106
 
107
107
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
108
108
  VALUES ('59a0b461-df44-42a6-940f-2abf0fd4e980', 'U52Z4P', '2024-04-19 09:00:00+02', now() + interval '1 day'),
@@ -110,14 +110,15 @@ INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, upda
110
110
 
111
111
  -- 14
112
112
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
113
- VALUES ('e9a15133-e606-406b-b492-9af05c643e7a', 'SEVERE', 'INLINE', '2024-03-27 00:00:00.000+02', '2024-09-22 00:00:00.000+02', '{"cs": "Do pondělí probíhá výluka metra C mezi I. P. Pavlova a Nádraží Holešovice. Náhradní autobus X-C navazuje ze zastávky I. P. Pavlova.", "en": "Until Monday, the C metro station is closed between I. P. Pavlova and Nádraží Holešovice. The replacement bus X-C will connect from the stop I. P. Pavlova."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
113
+ VALUES ('e9a15133-e606-406b-b492-9af05c643e7a', 'SEVERE', 'INLINE', '2024-03-27 00:00:00.000+02', '2024-09-22 00:00:00.000+02', '{"cs": "Do pondělí probíhá výluka metra C mezi I. P. Pavlova a Nádraží Holešovice. Náhradní autobus X-C navazuje ze zastávky I. P. Pavlova.", "en": "Until Monday, the C metro station is closed between I. P. Pavlova and Nádraží Holešovice. The replacement bus X-C will connect from the stop I. P. Pavlova."}', '2024-02-07 13:24:55.000', now());
114
114
 
115
115
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
116
116
  VALUES ('e9a15133-e606-406b-b492-9af05c643e7a', 'U52Z2P', '2024-04-19 09:00:00+02', now() + interval '1 day');
117
117
 
118
118
  -- 15
119
119
  INSERT INTO jis_infotexts(id, severity_level, display_type, active_period_start, active_period_end, description_text, created_at, updated_at)
120
- VALUES ('cdcc2d15-2cdc-4205-b82a-5cc819a79738', 'SEVERE', 'INLINE', '2023-03-27 00:00:00.000+02', null, '{"cs": "Nejede to."}', '2024-02-07 13:24:55.000', now() + interval '1 day');
120
+ VALUES ('cdcc2d15-2cdc-4205-b82a-5cc819a79738', 'SEVERE', 'INLINE', '2023-03-27 00:00:00.000+02', NULL, '{"cs": "Nejede to."}', '2024-02-07 13:24:55.000', now());
121
121
 
122
122
  INSERT INTO jis_infotexts_ropidgtfs_stops(infotext_id, stop_id, created_at, updated_at)
123
- VALUES ('cdcc2d15-2cdc-4205-b82a-5cc819a79738', 'U142Z301', '2024-04-19 09:00:00+02', now() + interval '1 day');
123
+ VALUES ('cdcc2d15-2cdc-4205-b82a-5cc819a79738', 'U142Z301', '2024-04-19 09:00:00+02', now() + interval '1 day');
124
+
@@ -0,0 +1,9 @@
1
+ import { BaseController } from "@golemio/core/dist/input-gateway/controllers";
2
+ import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
3
+ export declare class JisInfotextsController extends BaseController {
4
+ name: string;
5
+ protected validator: JSONSchemaValidator;
6
+ protected queuePrefix: string;
7
+ constructor();
8
+ processData: (inputData: any) => Promise<void>;
9
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.JisInfotextsController = void 0;
13
+ const JISInfotextsJsonSchema_1 = require("../../schema-definitions/jis/datasources/JISInfotextsJsonSchema");
14
+ const controllers_1 = require("@golemio/core/dist/input-gateway/controllers");
15
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
16
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
17
+ class JisInfotextsController extends controllers_1.BaseController {
18
+ constructor() {
19
+ super("jis", new golemio_validator_1.JSONSchemaValidator("jisInfotextsDataValidation", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema));
20
+ this.processData = (inputData) => __awaiter(this, void 0, void 0, function* () {
21
+ try {
22
+ yield this.validator.Validate(inputData);
23
+ yield this.sendMessageToExchange("input." + this.queuePrefix + ".refreshJISInfotexts", JSON.stringify(inputData));
24
+ }
25
+ catch (err) {
26
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
27
+ throw err;
28
+ }
29
+ else {
30
+ throw new golemio_errors_1.GeneralError("Error while validating input data.", this.constructor.name, err, 422);
31
+ }
32
+ }
33
+ });
34
+ }
35
+ }
36
+ exports.JisInfotextsController = JisInfotextsController;
37
+ //# sourceMappingURL=JisInfotextsController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JisInfotextsController.js","sourceRoot":"","sources":["../../../src/input-gateway/jis/JisInfotextsController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4GAAqF;AACrF,8EAA8E;AAC9E,6EAA8F;AAC9F,mFAAkF;AAElF,MAAa,sBAAuB,SAAQ,4BAAc;IAKtD;QACI,KAAK,CAAC,KAAK,EAAE,IAAI,uCAAmB,CAAC,4BAA4B,EAAE,+CAAsB,CAAC,CAAC,CAAC;QAGzF,gBAAW,GAAG,CAAO,SAAc,EAAiB,EAAE;YACzD,IAAI;gBACA,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;gBACzC,MAAM,IAAI,CAAC,qBAAqB,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;aACrH;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,qCAAoB,EAAE;oBACrC,MAAM,GAAG,CAAC;iBACb;qBAAM;oBACH,MAAM,IAAI,6BAAY,CAAC,oCAAoC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;iBACjG;aACJ;QACL,CAAC,CAAA,CAAC;IAbF,CAAC;CAcJ;AArBD,wDAqBC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="express" />
2
+ import { Router } from "@golemio/core/dist/shared/express";
3
+ export declare class JisInfotextsRouter {
4
+ router: Router;
5
+ private controller;
6
+ constructor();
7
+ private initRoutes;
8
+ private post;
9
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.JisInfotextsRouter = void 0;
13
+ const CheckContentTypeMiddleware_1 = require("@golemio/core/dist/input-gateway/helpers/CheckContentTypeMiddleware");
14
+ const express_1 = require("@golemio/core/dist/shared/express");
15
+ const JisInfotextsController_1 = require("./JisInfotextsController");
16
+ class JisInfotextsRouter {
17
+ constructor() {
18
+ this.post = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ yield this.controller.processData(req.body);
21
+ res.sendStatus(204);
22
+ }
23
+ catch (err) {
24
+ next(err);
25
+ }
26
+ });
27
+ this.router = (0, express_1.Router)();
28
+ this.controller = new JisInfotextsController_1.JisInfotextsController();
29
+ this.initRoutes();
30
+ }
31
+ initRoutes() {
32
+ this.router.post("/infotexts", (0, CheckContentTypeMiddleware_1.checkContentTypeMiddleware)(["application/json"]), this.post);
33
+ }
34
+ }
35
+ exports.JisInfotextsRouter = JisInfotextsRouter;
36
+ //# sourceMappingURL=JisInfotextsRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JisInfotextsRouter.js","sourceRoot":"","sources":["../../../src/input-gateway/jis/JisInfotextsRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oHAAiH;AACjH,+DAA4F;AAC5F,qEAAkE;AAElE,MAAa,kBAAkB;IAI3B;QAUQ,SAAI,GAAG,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAiB,EAAE;YACpF,IAAI;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC5C,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;aACvB;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,GAAG,CAAC,CAAC;aACb;QACL,CAAC,CAAA,CAAC;QAhBE,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,+CAAsB,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAEO,UAAU;QACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,IAAA,uDAA0B,EAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAChG,CAAC;CAUJ;AAtBD,gDAsBC"}
@@ -10,6 +10,7 @@ const JISInfotextsDataService_1 = require("../services/JISInfotextsDataService")
10
10
  const JISInfotextsTransformation_1 = require("../transformations/JISInfotextsTransformation");
11
11
  const RefreshJISInfotextsTask_1 = require("../workers/tasks/RefreshJISInfotextsTask");
12
12
  const JISContainerToken_1 = require("./JISContainerToken");
13
+ const FetchJISInfotextsTask_1 = require("../workers/tasks/FetchJISInfotextsTask");
13
14
  //#region Initialization
14
15
  const JISContainer = Di_1.PidContainer.createChildContainer();
15
16
  exports.JISContainer = JISContainer;
@@ -27,6 +28,7 @@ JISContainer.register(JISContainerToken_1.JISContainerToken.JISInfotextsDataServ
27
28
  //#endregion
28
29
  //#region Tasks
29
30
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask, RefreshJISInfotextsTask_1.RefreshJISInfotextsTask);
31
+ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask, FetchJISInfotextsTask_1.FetchJISInfotextsTask);
30
32
  //#endregion
31
33
  //#region Transformations
32
34
  JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation, JISInfotextsTransformation_1.JISInfotextsTransformation);
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAE1C,gGAA6F;AAC7F,mFAAgF;AAChF,+GAA4G;AAC5G,iFAA8E;AAC9E,iFAA8E;AAC9E,8FAA2F;AAC3F,sFAAmF;AACnF,2DAAwD;AAExD,wBAAwB;AACxB,MAAM,YAAY,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;AAyBrE,oCAAY;AAxBrB,YAAY;AAEZ,sBAAsB;AACtB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AAC/G,YAA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YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY;AAEZ,kBAAkB;AAClB,YAAY,CAAC,QAAQ,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AAC1F,YAAY;AAEZ,eAAe;AACf,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACnG,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AAC/F,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC"}
@@ -6,5 +6,6 @@ declare const JISContainerToken: {
6
6
  JISInfotextsDataService: symbol;
7
7
  JISInfotextsTransformation: symbol;
8
8
  RefreshJISInfotextsTask: symbol;
9
+ FetchJISInfotextsTask: symbol;
9
10
  };
10
11
  export { JISContainerToken };
@@ -14,6 +14,7 @@ const JISContainerToken = {
14
14
  JISInfotextsTransformation: Symbol(),
15
15
  /* Tasks */
16
16
  RefreshJISInfotextsTask: Symbol(),
17
+ FetchJISInfotextsTask: Symbol(),
17
18
  };
18
19
  exports.JISContainerToken = JISContainerToken;
19
20
  //# 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,6BAA6B,EAAE,MAAM,EAAE;IACvC,kBAAkB;IAClB,sBAAsB,EAAE,MAAM,EAAE;IAChC,oCAAoC,EAAE,MAAM,EAAE;IAC9C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,cAAc;IACd,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB;IACrB,0BAA0B,EAAE,MAAM,EAAE;IACpC,WAAW;IACX,uBAAuB,EAAE,MAAM,EAAE;CACpC,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,6BAA6B,EAAE,MAAM,EAAE;IACvC,kBAAkB;IAClB,sBAAsB,EAAE,MAAM,EAAE;IAChC,oCAAoC,EAAE,MAAM,EAAE;IAC9C,qBAAqB,EAAE,MAAM,EAAE;IAC/B,cAAc;IACd,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB;IACrB,0BAA0B,EAAE,MAAM,EAAE;IACpC,WAAW;IACX,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB,EAAE,MAAM,EAAE;CAClC,CAAC;AAEO,8CAAiB"}
@@ -4,7 +4,7 @@ import { ILogger } from "@golemio/core/dist/helpers";
4
4
  import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
5
5
  import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
6
6
  import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
7
- import { ModelStatic, Transaction } from "@golemio/core/dist/shared/sequelize";
7
+ import { Transaction } from "@golemio/core/dist/shared/sequelize";
8
8
  type RepositoryOptions = {
9
9
  transaction?: Transaction;
10
10
  };
@@ -24,13 +24,12 @@ export declare class JISInfotextsRepository extends AbstractValidatableRepositor
24
24
  */
25
25
  deleteAllLastUpdatedBefore(dateTime: Date, options?: RepositoryOptions): Promise<number>;
26
26
  /**
27
- * Insert or update all given data. In case of an update, all attributes except for `created_at` shall be overwritten.
27
+ * Refresh all data from VYMI and delete old data
28
28
  *
29
29
  * @param data The data to be upserted
30
30
  * @param options Options for the operation
31
- * @returns The upserted items
32
31
  */
33
- upsertAll(data: IJISInfotext[], options?: RepositoryOptions): ReturnType<ModelStatic<JISInfotextsModel>["bulkCreate"]>;
32
+ refreshData(data: IJISInfotext[], options?: RepositoryOptions): Promise<JISInfotextsModel[]>;
34
33
  private getUpdateAttributes;
35
34
  /**
36
35
  * @param options
@@ -64,20 +64,45 @@ let JISInfotextsRepository = exports.JISInfotextsRepository = class JISInfotexts
64
64
  });
65
65
  }
66
66
  /**
67
- * Insert or update all given data. In case of an update, all attributes except for `created_at` shall be overwritten.
67
+ * Refresh all data from VYMI and delete old data
68
68
  *
69
69
  * @param data The data to be upserted
70
70
  * @param options Options for the operation
71
- * @returns The upserted items
72
71
  */
73
- upsertAll(data, options) {
72
+ refreshData(data, options) {
74
73
  var _a;
75
74
  return __awaiter(this, void 0, void 0, function* () {
76
75
  try {
77
- return yield this.sequelizeModel.bulkCreate(data, {
78
- updateOnDuplicate: this.getUpdateAttributes(),
79
- transaction: options === null || options === void 0 ? void 0 : options.transaction,
80
- });
76
+ const currentInfotexts = yield this.sequelizeModel.findAll({ transaction: options === null || options === void 0 ? void 0 : options.transaction });
77
+ const currentInfotextsMap = new Map();
78
+ for (const infotext of currentInfotexts) {
79
+ currentInfotextsMap.set(infotext.id, infotext);
80
+ }
81
+ const toBeUpserted = [];
82
+ for (const infotext of data) {
83
+ const info = currentInfotextsMap.get(infotext.id);
84
+ if (!info || info.updated_at <= infotext.updated_timestamp) {
85
+ toBeUpserted.push(infotext);
86
+ }
87
+ currentInfotextsMap.delete(infotext.id);
88
+ }
89
+ const toBeDeleted = [];
90
+ for (const { id } of currentInfotextsMap.values()) {
91
+ toBeDeleted.push(id);
92
+ }
93
+ const [upserted] = yield Promise.all([
94
+ this.sequelizeModel.bulkCreate(toBeUpserted, {
95
+ updateOnDuplicate: this.getUpdateAttributes(),
96
+ transaction: options === null || options === void 0 ? void 0 : options.transaction,
97
+ }),
98
+ this.sequelizeModel.destroy({
99
+ where: {
100
+ id: { [sequelize_1.Op.in]: toBeDeleted },
101
+ },
102
+ transaction: options === null || options === void 0 ? void 0 : options.transaction,
103
+ }),
104
+ ]);
105
+ return upserted;
81
106
  }
82
107
  catch (err) {
83
108
  if (err instanceof sequelize_1.ValidationError && ((_a = err.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"JISInfotextsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,gGAAsE;AAItE,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAyF;AACzF,mFAAkF;AAClF,mEAAgI;AAChI,iEAAwE;AAOjE,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,6DAA6B;IAOrE,YACyC,SAA6B,EACxC,MAAuB;QAEjD,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAFS,WAAM,GAAN,MAAM,CAAS;QAP9C,WAAM,GAAG,iBAAS,CAAC;QACnB,cAAS,GAAG,qCAAiB,CAAC,SAAS,CAAC;QAS3C,IAAI,CAAC,SAAS,GAAG,IAAI,uCAAmB,CAAC,wBAAwB,EAAE,qCAAiB,CAAC,UAAU,CAAC,CAAC;QACjG,IAAI,CAAC,cAAc,GAAG,SAAS;aAC1B,aAAa,EAAE;aACf,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,qCAAiB,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACU,0BAA0B,CAAC,QAAc,EAAE,OAA2B;;YAC/E,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,KAAK,EAAE;wBACH,UAAU,EAAE,EAAE,CAAC,cAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE;qBACpC;oBACD,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO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;;OAGG;IACU,SAAS,CAAC,OAA2B;;YAC9C,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE,CAAC,CAAC;aAC9F;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC5E;QACL,CAAC;KAAA;CACJ,CAAA;iCAnFY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IASJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IACnC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GATpB,sBAAsB,CAmFlC"}
1
+ {"version":3,"file":"JISInfotextsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,gGAAsE;AAItE,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAyF;AACzF,mFAAkF;AAClF,mEAAgI;AAChI,iEAAwE;AAOjE,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,6DAA6B;IAOrE,YACyC,SAA6B,EACxC,MAAuB;QAEjD,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAFS,WAAM,GAAN,MAAM,CAAS;QAP9C,WAAM,GAAG,iBAAS,CAAC;QACnB,cAAS,GAAG,qCAAiB,CAAC,SAAS,CAAC;QAS3C,IAAI,CAAC,SAAS,GAAG,IAAI,uCAAmB,CAAC,wBAAwB,EAAE,qCAAiB,CAAC,UAAU,CAAC,CAAC;QACjG,IAAI,CAAC,cAAc,GAAG,SAAS;aAC1B,aAAa,EAAE;aACf,MAAM,CA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S,EACT,KAAK,CACR,CAAC;iBACL;gBACD,MAAM,IAAI,6BAAY,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC5E;;KACJ;IAEO,mBAAmB;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,qCAAiB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACpH,CAAC;IACD;;;OAGG;IACU,SAAS,CAAC,OAA2B;;YAC9C,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE,CAAC,CAAC;aAC9F;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC5E;QACL,CAAC;KAAA;CACJ,CAAA;iCA/GY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IASJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IACnC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GATpB,sBAAsB,CA+GlC"}
@@ -56,10 +56,9 @@ let JISInfotextsDataService = exports.JISInfotextsDataService = class JISInfotex
56
56
  this.logger.info(`${this.constructor.name}.refreshData: all JIS infotexts were deleted because 0 infotexts were imported`);
57
57
  }
58
58
  else {
59
- yield this.infotextsRepository.upsertAll(infotexts, { transaction });
59
+ yield this.infotextsRepository.refreshData(infotexts, { transaction });
60
60
  yield this.infotextsRopidGTFSStopsRepository.upsertAll(infotextsRopidGTFSStops, { transaction });
61
61
  yield this.infotextsRopidGTFSStopsRepository.deleteAllLastUpdatedBefore(saveTime, { transaction });
62
- yield this.infotextsRepository.deleteAllLastUpdatedBefore(saveTime, { transaction });
63
62
  yield transaction.commit();
64
63
  this.logger.info(`${this.constructor.name}.refreshData: ${infotexts.length} JIS infotexts and ` +
65
64
  `${infotextsRopidGTFSStops.length} JIS infotextsRopidGTFSStops were saved`);
@@ -1 +1 @@
1
- {"version":3,"file":"JISInfotextsDataService.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/services/JISInfotextsDataService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAkE;AAClE,mFAAqF;AACrF,+GAAiH;AAIjH,wEAAqE;AACrE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,uBAAuB,qCAA7B,MAAM,uBAAuB;IAChC,YAEY,mBAA2C,EAE3C,iCAAuE,EAClC,iBAAqC,EAChD,MAAe;QAJzC,wBAAmB,GAAnB,mBAAmB,CAAwB;QAE3C,sCAAiC,GAAjC,iCAAiC,CAAsC;QAClC,sBAAiB,GAAjB,iBAAiB,CAAoB;QAChD,WAAM,GAAN,MAAM,CAAS;QAEjD,aAAa;IACjB,CAAC;IAED;;;;;;OAMG;IACU,WAAW,CAAC,SAAyB,EAAE,uBAAsD;;YACtG,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;YAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,WAAW,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;YAE5B,IAAI;gBACA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;oBACxB,MAAM,IAAI,CAAC,iCAAiC,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;oBACxE,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;oBAC1D,MAAM,WAAW,CAAC,MAAM,EAAE,CAAC;o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ACnC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCAJI,+CAAsB;QAER,2EAAoC;GAL1E,uBAAuB,CAiDnC"}
1
+ {"version":3,"file":"JISInfotextsDataService.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/services/JISInfotextsDataService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAkE;AAClE,mFAAqF;AACrF,+GAAiH;AAIjH,wEAAqE;AACrE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,uBAAuB,qCAA7B,MAAM,uBAAuB;IAChC,YAEY,mBAA2C,EAE3C,iCAAuE,EAClC,iBAAqC,EAChD,MAAe;QAJzC,wBAAmB,GAAnB,mBAAmB,CAAwB;QAE3C,sCAAiC,GAAjC,iCAAiC,CAAsC;QAClC,sBAAiB,GAAjB,iBAAiB,CAAoB;QAChD,WAAM,GAAN,MAAM,CAAS;QAEjD,aAAa;IACjB,CAAC;IAED;;;;;;OAMG;IACU,WAAW,CAAC,SAAyB,EAAE,uBAAsD;;YACtG,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;YAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,WAAW,EAAE,CAAC;YACnD,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;YAE5B,IAAI;gBACA,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;oBACxB,MAAM,IAAI,CAAC,iCAAiC,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;oBACxE,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;oBAC1D,MAAM,WAAW,CAAC,MAAM,EAAE,CAAC;oBAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,gFAAgF,CAC3G,CAAC;iBACL;qBAAM;oB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olve(JISContainerToken_1.JISContainerToken.RefreshJISInfotextsTask));
18
+ this.registerTask(Di_1.JISContainer.resolve(JISContainerToken_1.JISContainerToken.FetchJISInfotextsTask));
18
19
  }
19
20
  }
20
21
  exports.JISWorker = JISWorker;
@@ -1 +1 @@
1
- {"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;AAG9C,MAAa,SAAU,SAAQ,wBAAc;IAGzC;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,2BAAe,CAAC,WAAW,EAAE,CAAC;QASxC,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QAPE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA0B,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAChH,CAAC;CAMJ;AAdD,8BAcC"}
1
+ {"version":3,"file":"JISWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/workers/JISWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAE/E,kCAAyC;AACzC,gEAA6D;AAC7D,2CAA8C;AAI9C,MAAa,SAAU,SAAQ,wBAAc;IAGzC;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,2BAAe,CAAC,WAAW,EAAE,CAAC;QAUxC,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7C,CAAC,CAAC;QARE,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAA0B,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC5G,IAAI,CAAC,YAAY,CAAC,iBAAY,CAAC,OAAO,CAAwB,qCAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC5G,CAAC;CAMJ;AAfD,8BAeC"}
@@ -0,0 +1,10 @@
1
+ import { JISInfotextsDataSourceFactory } from "../../datasources/JISInfotextsDataSourceFactory";
2
+ import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
3
+ export declare class FetchJISInfotextsTask extends AbstractEmptyTask {
4
+ private dataSourceFactory;
5
+ readonly queueName = "fetchJISInfotexts";
6
+ readonly queueTtl: number;
7
+ constructor(dataSourceFactory: JISInfotextsDataSourceFactory);
8
+ /** Fetch JIS Infotexts data source */
9
+ protected execute(): Promise<void>;
10
+ }
@@ -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.FetchJISInfotextsTask = void 0;
25
+ const JISInfotextsDataSourceFactory_1 = require("../../datasources/JISInfotextsDataSourceFactory");
26
+ const JISContainerToken_1 = require("../../ioc/JISContainerToken");
27
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
28
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
29
+ const constants_1 = require("../constants");
30
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
31
+ let FetchJISInfotextsTask = exports.FetchJISInfotextsTask = class FetchJISInfotextsTask extends integration_engine_1.AbstractEmptyTask {
32
+ constructor(dataSourceFactory) {
33
+ super(constants_1.JIS_WORKER_NAME.toLowerCase());
34
+ this.dataSourceFactory = dataSourceFactory;
35
+ this.queueName = "fetchJISInfotexts";
36
+ this.queueTtl = 20 * 1000; // 20 seconds
37
+ }
38
+ /** Fetch JIS Infotexts data source */
39
+ execute() {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ try {
42
+ const dataSource = this.dataSourceFactory.getDataSource();
43
+ const data = yield dataSource.getAll();
44
+ yield integration_engine_1.QueueManager.sendMessageToExchange("input." + this.queuePrefix + ".refreshJISInfotexts", JSON.stringify(data), {});
45
+ }
46
+ catch (err) {
47
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
48
+ throw err;
49
+ }
50
+ else {
51
+ throw new golemio_errors_1.GeneralError("Error while fetching new JIS infotexts", this.constructor.name, err);
52
+ }
53
+ }
54
+ });
55
+ }
56
+ };
57
+ exports.FetchJISInfotextsTask = FetchJISInfotextsTask = __decorate([
58
+ (0, tsyringe_1.injectable)(),
59
+ __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory)),
60
+ __metadata("design:paramtypes", [JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory])
61
+ ], FetchJISInfotextsTask);
62
+ //# sourceMappingURL=FetchJISInfotextsTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetchJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/FetchJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mGAAkG;AAClG,mEAAkE;AAClE,8EAAwF;AACxF,iEAAwE;AACxE,4CAA+C;AAC/C,6EAA8F;AAGvF,IAAM,qBAAqB,mCAA3B,MAAM,qBAAsB,SAAQ,sCAAiB;IAIxD,YAEI,iBAAwD;QAExD,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAF7B,sBAAiB,GAAjB,iBAAiB,CAA+B;QAL5C,cAAS,GAAG,mBAAmB,CAAC;QAChC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;IAOnD,CAAC;IAED,sCAAsC;IACtB,OAAO;;YACnB,IAAI;gBACA,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,CAAC;gBAC1D,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;gBAEvC,MAAM,iCAAY,CAAC,qBAAqB,CACpC,QAAQ,GAAG,IAAI,CAAC,WAAW,GAAG,sBAAsB,EACpD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EACpB,EAAE,CACL,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,YAAY,qCAAoB,EAAE;oBACrC,MAAM,GAAG,CAAC;iBACb;qBAAM;oBACH,MAAM,IAAI,6BAAY,CAAC,wCAAwC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;iBAChG;aACJ;QACL,CAAC;KAAA;CACJ,CAAA;gCA9BY,qBAAqB;IADjC,IAAA,qBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,6BAA6B,CAAC,CAAA;qCAC7B,6DAA6B;GANnD,qBAAqB,CA8BjC"}
@@ -1,20 +1,16 @@
1
- import { JISInfotextsDataSourceFactory } from "../../datasources/JISInfotextsDataSourceFactory";
2
- import { JISMetadataRepository } from "../../repositories/JISMetadataRepository";
3
1
  import { JISInfotextsDataService } from "../../services/JISInfotextsDataService";
4
2
  import { JISInfotextsTransformation } from "../../transformations/JISInfotextsTransformation";
5
- import { ILogger } from "@golemio/core/dist/helpers";
6
- import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
7
- export declare class RefreshJISInfotextsTask extends AbstractEmptyTask {
8
- private dataSourceFactory;
3
+ import { AbstractTaskJsonSchema } from "@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema";
4
+ import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
5
+ import { IJISInfotext } from "../../../../schema-definitions/jis/datasources/interfaces";
6
+ export declare class RefreshJISInfotextsTask extends AbstractTaskJsonSchema<IJISInfotext[]> {
9
7
  private infotextsDataService;
10
8
  private infotextsTransformation;
11
- private metadataRepository;
12
- private logger;
9
+ readonly schema: JSONSchemaValidator;
13
10
  readonly queueName = "refreshJISInfotexts";
14
11
  readonly queueTtl: number;
15
- constructor(dataSourceFactory: JISInfotextsDataSourceFactory, infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation, metadataRepository: JISMetadataRepository, logger: ILogger);
16
- /** Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database */
17
- protected execute(): Promise<void>;
18
- private getResponseEtag;
12
+ constructor(infotextsDataService: JISInfotextsDataService, infotextsTransformation: JISInfotextsTransformation);
13
+ /** refresh JIS Infotexts data in database */
14
+ protected execute(data: IJISInfotext[]): Promise<void>;
19
15
  private getEntitiesFromTransformationResult;
20
16
  }
@@ -22,61 +22,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.RefreshJISInfotextsTask = void 0;
25
- const JISInfotextsDataSourceFactory_1 = require("../../datasources/JISInfotextsDataSourceFactory");
26
25
  const JISContainerToken_1 = require("../../ioc/JISContainerToken");
27
- const JISMetadataRepository_1 = require("../../repositories/JISMetadataRepository");
28
26
  const JISInfotextsDataService_1 = require("../../services/JISInfotextsDataService");
29
27
  const JISInfotextsTransformation_1 = require("../../transformations/JISInfotextsTransformation");
30
- const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
31
- const integration_engine_1 = require("@golemio/core/dist/integration-engine");
32
- const ResourceNotModified_1 = require("@golemio/core/dist/integration-engine/helpers/ResourceNotModified");
33
28
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
34
29
  const constants_1 = require("../constants");
35
- let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends integration_engine_1.AbstractEmptyTask {
36
- constructor(dataSourceFactory, infotextsDataService, infotextsTransformation, metadataRepository, logger) {
30
+ const AbstractTaskJsonSchema_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTaskJsonSchema");
31
+ const JISInfotextsJsonSchema_1 = require("../../../../schema-definitions/jis/datasources/JISInfotextsJsonSchema");
32
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
33
+ let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJISInfotextsTask extends AbstractTaskJsonSchema_1.AbstractTaskJsonSchema {
34
+ constructor(infotextsDataService, infotextsTransformation) {
37
35
  super(constants_1.JIS_WORKER_NAME.toLowerCase());
38
- this.dataSourceFactory = dataSourceFactory;
39
36
  this.infotextsDataService = infotextsDataService;
40
37
  this.infotextsTransformation = infotextsTransformation;
41
- this.metadataRepository = metadataRepository;
42
- this.logger = logger;
38
+ this.schema = new golemio_validator_1.JSONSchemaValidator("jisInfotextsDataValidation", JISInfotextsJsonSchema_1.jisInfotextsJsonSchema);
43
39
  this.queueName = "refreshJISInfotexts";
44
- this.queueTtl = 20 * 1000; // 20 seconds
40
+ this.queueTtl = 60 * 1000; // 1 minute
45
41
  }
46
- /** Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database */
47
- execute() {
42
+ /** refresh JIS Infotexts data in database */
43
+ execute(data) {
48
44
  return __awaiter(this, void 0, void 0, function* () {
49
- const lastEtag = yield this.metadataRepository.getLastInfotextsEtag();
50
- const dataSource = this.dataSourceFactory.getDataSource(lastEtag);
51
- const { data, metadata } = yield dataSource.getAllWithMetadata();
52
- if (data instanceof ResourceNotModified_1.ResourceNotModified) {
53
- this.logger.info(`${this.constructor.name}.execute: JIS infotexts data source hasn't been updated since last refresh in ` +
54
- `database (received 304 Not Modified for request with ETag: ${lastEtag}).`);
55
- return;
56
- }
57
45
  const transformedData = this.infotextsTransformation.transformArray(data);
58
46
  const { infotexts, infotextsRopidGTFSStops } = this.getEntitiesFromTransformationResult(transformedData);
59
47
  yield this.infotextsDataService.refreshData(infotexts, infotextsRopidGTFSStops);
60
- const responseEtag = this.getResponseEtag(metadata);
61
- if (typeof responseEtag === "string") {
62
- yield this.metadataRepository.setLastInfotextsEtag(responseEtag);
63
- }
64
- else {
65
- this.logger.warn(`${this.constructor.name}.execute: JIS infotexts data source response has no ETag.`);
66
- }
67
48
  });
68
49
  }
69
- getResponseEtag(metadata) {
70
- if (typeof metadata === "object" &&
71
- metadata !== null &&
72
- "headers" in metadata &&
73
- typeof metadata.headers === "object" &&
74
- metadata.headers !== null &&
75
- "etag" in metadata.headers &&
76
- typeof metadata.headers["etag"] === "string") {
77
- return metadata.headers["etag"];
78
- }
79
- }
80
50
  getEntitiesFromTransformationResult(transformedData) {
81
51
  const infotextEntities = [];
82
52
  const infotextsRopidGTFSStopsEntities = [];
@@ -95,14 +65,9 @@ let RefreshJISInfotextsTask = exports.RefreshJISInfotextsTask = class RefreshJIS
95
65
  };
96
66
  exports.RefreshJISInfotextsTask = RefreshJISInfotextsTask = __decorate([
97
67
  (0, tsyringe_1.injectable)(),
98
- __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataSourceFactory)),
99
- __param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataService)),
100
- __param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation)),
101
- __param(3, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISMetadataRepository)),
102
- __param(4, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
103
- __metadata("design:paramtypes", [JISInfotextsDataSourceFactory_1.JISInfotextsDataSourceFactory,
104
- JISInfotextsDataService_1.JISInfotextsDataService,
105
- JISInfotextsTransformation_1.JISInfotextsTransformation,
106
- JISMetadataRepository_1.JISMetadataRepository, Object])
68
+ __param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsDataService)),
69
+ __param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsTransformation)),
70
+ __metadata("design:paramtypes", [JISInfotextsDataService_1.JISInfotextsDataService,
71
+ JISInfotextsTransformation_1.JISInfotextsTransformation])
107
72
  ], RefreshJISInfotextsTask);
108
73
  //# sourceMappingURL=RefreshJISInfotextsTask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mGAAkG;AAClG,mEAAkE;AAClE,oFAAmF;AACnF,oFAAmF;AACnF,iGAAgG;AAGhG,wEAAqE;AACrE,8EAA0E;AAC1E,2GAAwG;AACxG,iEAAwE;AACxE,4CAA+C;AAGxC,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ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,uBAAuB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,0BAA0B,CAAC,CAAA;IAEpD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,qBAAqB,CAAC,CAAA;IAE/C,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCAPE,6DAA6B;QAE1B,iDAAuB;QAEpB,uDAA0B;QAE/B,6CAAqB;GAZ5C,uBAAuB,CAwEnC"}
1
+ {"version":3,"file":"RefreshJISInfotextsTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,oFAAmF;AACnF,iGAAgG;AAEhG,iEAAwE;AACxE,4CAA+C;AAC/C,iHAA8G;AAC9G,kHAAqF;AACrF,mFAAkF;AAK3E,IAAM,uBAAuB,qCAA7B,MAAM,uBAAwB,SAAQ,+CAAsC;IAK/E,YAEI,oBAAqD,EAErD,uBAA2D;QAE3D,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAJ7B,yBAAoB,GAApB,oBAAoB,CAAyB;QAE7C,4BAAuB,GAAvB,uBAAuB,CAA4B;QAR/C,WAAM,GAAG,IAAI,uCAAmB,CAAC,4BAA4B,EAAE,+CAAsB,CAAC,CAAC;QACvF,cAAS,GAAG,qBAAqB,CAAC;QAClC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;IASjD,CAAC;IAED,6CAA6C;IAC7B,OAAO,CAAC,IAAoB;;YACxC,MAAM,eAAe,GAAG,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC1E,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC,mCAAmC,CAAC,eAAe,CAAC,CAAC;YACzG,MAAM,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QACpF,CAAC;KAAA;IAEO,mCAAmC,CAAC,eAAyE;QACjH,MAAM,gBAAgB,GAAwB,EAAE,CAAC;QACjD,MAAM,+BAA+B,GAAkC,EAAE,CAAC;QAC1E,KAAK,MAAM,EAAE,QAAQ,EAAE,uBAAuB,EAAE,IAAI,eAAe,EAAE;YACjE,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC,EAAE;gBACtC,SAAS;aACZ;YACD,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,+BAA+B,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC,CAAC;SACpE;QACD,OAAO;YACH,SAAS,EAAE,gBAAgB;YAC3B,uBAAuB,EAAE,+BAA+B;SAC3D,CAAC;IACN,CAAC;CACJ,CAAA;kCApCY,uBAAuB;IADnC,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAA;IAEjD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,0BAA0B,CAAC,CAAA;qCADvB,iDAAuB;QAEpB,uDAA0B;GATtD,uBAAuB,CAoCnC"}
@@ -4,9 +4,20 @@ info:
4
4
  version: 1.0.0
5
5
  description: PID
6
6
  channels:
7
+ jis.fetchJISInfotexts:
8
+ address: vehicle-positions.jis.fetchJISInfotexts
9
+ description: Fetch JIS Infotexts from data source
10
+ bindings:
11
+ amqp:
12
+ is: queue
13
+ queue:
14
+ durable: true
15
+ messages:
16
+ empty:
17
+ $ref: "#/components/messages/emptyMessage"
7
18
  jis.refreshJISInfotexts:
8
19
  address: vehicle-positions.jis.refreshJISInfotexts
9
- description: Fetch JIS Infotexts data source and if it has been updated, refresh JIS Infotexts data in database
20
+ description: Refresh JIS Infotexts in database
10
21
  bindings:
11
22
  amqp:
12
23
  is: queue
@@ -14,7 +25,7 @@ channels:
14
25
  durable: true
15
26
  messages:
16
27
  empty:
17
- $ref: "#/components/messages/emptyMessage"
28
+ $ref: "#/components/messages/IJISInfotext"
18
29
  updateGTFSTripId:
19
30
  address: vehicle-positions.vehiclepositions.updateGTFSTripId
20
31
  description: some description
@@ -447,6 +458,12 @@ components:
447
458
  type: array
448
459
  items:
449
460
  $ref: "#/components/schemas/IScheduleDto"
461
+ IJISInfotext:
462
+ payload:
463
+ type: array
464
+ items:
465
+ $ref: "#/components/schemas/JisInfotext"
466
+
450
467
  schemas:
451
468
  IUpdateGTFSTripIdData:
452
469
  type: object
@@ -1508,3 +1525,80 @@ components:
1508
1525
  actual_position_timestamp_scheduled:
1509
1526
  type: string
1510
1527
  format: date-time
1528
+ JisInfotext:
1529
+ type: object
1530
+ properties:
1531
+ id:
1532
+ type: string
1533
+ format: uuid
1534
+ description: Unique identifier for the infotext
1535
+ severity_level:
1536
+ type: string
1537
+ enum:
1538
+ - SEVERE
1539
+ - WARNING
1540
+ - INFO
1541
+ description: Severity level of the infotext
1542
+ display_type:
1543
+ type: string
1544
+ description: How the infotext is displayed
1545
+ active_period:
1546
+ type: object
1547
+ properties:
1548
+ start:
1549
+ type: string
1550
+ format: date-time
1551
+ description: Start time of the active period
1552
+ end:
1553
+ type: string
1554
+ format: date-time
1555
+ description: End time of the active period
1556
+ required:
1557
+ - start
1558
+ - end
1559
+ description: The period during which the infotext is active
1560
+ description_text:
1561
+ type: object
1562
+ properties:
1563
+ cs:
1564
+ type: string
1565
+ description: Description in Czech
1566
+ en:
1567
+ type: string
1568
+ description: Description in English
1569
+ required:
1570
+ - cs
1571
+ - en
1572
+ description: Localized descriptions of the infotext
1573
+ informed_entity:
1574
+ type: object
1575
+ properties:
1576
+ stops:
1577
+ type: array
1578
+ items:
1579
+ type: object
1580
+ properties:
1581
+ stop_id:
1582
+ type: string
1583
+ description: Unique identifier for the stop
1584
+ required:
1585
+ - stop_id
1586
+ required:
1587
+ - stops
1588
+ created_timestamp:
1589
+ type: string
1590
+ format: date-time
1591
+ description: Timestamp when the infotext was created in VYMI
1592
+ last_modified_timestamp:
1593
+ type: string
1594
+ format: date-time
1595
+ description: Timestamp when the infotext was updated in VYMI
1596
+ required:
1597
+ - id
1598
+ - severity_level
1599
+ - display_type
1600
+ - active_period
1601
+ - description_text
1602
+ - informed_entity
1603
+ - created_timestamp
1604
+ - last_modified_timestamp
@@ -215,26 +215,6 @@ _:warning: Původním záměrem bylo využití OIS číselníku během zpracová
215
215
  - prod `0 */1 * * * *`
216
216
  - názvy rabbitmq front
217
217
  - vehicle-positions.ropidpresets.collectAndSaveLogs se zprávou `{ "targetMinutes": n }`
218
-
219
- #### _JIS Infotexty_
220
-
221
- - zdroj dat
222
- - baseUrl: module.pid.jis.baseUrl
223
- - infotexts path: module.pid.jis.infotexts.path
224
- - hlavičky infotexts dotazu: module.pid.jis.infotexts.headers
225
- - formát dat
226
- - protokol: http
227
- - datový typ: json
228
- - validační schéma: [JISInfotextsJsonSchema](../src/schema-definitions/jis/datasources/JISInfotextsJsonSchema.ts)
229
- - příklad vstupnich dat: [infotextsDataSourceFixture](../test/integration-engine/jis/fixtures/infotextsDataSourceFixture.ts)
230
- - frekvence stahování
231
- - cron definice:
232
- - cron.vehicle-positions.jis.refreshJISInfotexts
233
- - rabin `*/30 * * * * *`
234
- - prod `*/30 * * * * *`
235
- - název rabbitmq fronty
236
- - vehicle-positions.jis.refreshJISInfotexts
237
-
238
218
  ### _Ropid staticka data_
239
219
 
240
220
  - zdroj dat
@@ -385,6 +365,15 @@ _:warning: Původním záměrem bylo využití OIS číselníku během zpracová
385
365
  - agregace dat: 1 MB
386
366
  - odhadovaná zátěž
387
367
  - desítky až stovky zpráv za minutu
368
+ #### _JIS Infotexty_
369
+
370
+ - formát dat
371
+ - protokol: http
372
+ - datový typ: json
373
+ - validační schéma: [JISInfotextsJsonSchema](../src/schema-definitions/jis/datasources/JISInfotextsJsonSchema.ts)
374
+ - příklad vstupnich dat: [infotextsDataSourceFixture](../test/integration-engine/jis/fixtures/infotextsDataSourceFixture.ts)
375
+ - název rabbitmq fronty
376
+ - vehicle-positions.jis.refreshJISInfotexts
388
377
 
389
378
  ## Výstupní data
390
379
 
@@ -18,6 +18,8 @@ servers:
18
18
  tags:
19
19
  - name: 🛤 Vehicle Positions
20
20
  description: ""
21
+ - name: 🪧 JIS
22
+ description: ""
21
23
  paths:
22
24
  /vehiclepositions:
23
25
  post:
@@ -159,6 +161,62 @@ paths:
159
161
  WWW_Authenticate:
160
162
  schema:
161
163
  type: string
164
+ /jis/infotexts:
165
+ post:
166
+ summary: POST JIS infotexts
167
+ description: ""
168
+ tags:
169
+ - 🪧 JIS
170
+ parameters:
171
+ - in: header
172
+ name: Content-Type
173
+ schema:
174
+ type: string
175
+ example: "application/json"
176
+ required: true
177
+ requestBody:
178
+ required: true
179
+ content:
180
+ application/json:
181
+ schema:
182
+ $ref: "#/components/schemas/JisInfotexts"
183
+ examples:
184
+ json:
185
+ $ref: "#/components/examples/JisInfotextsExample"
186
+ responses:
187
+ "204":
188
+ description: Successful Operation
189
+
190
+ "422":
191
+ description: Unprocessable Entity
192
+ content:
193
+ application/json:
194
+ schema:
195
+ $ref: "#/components/schemas/Error"
196
+ example:
197
+ error_info: "validation failed [{\"keyword\":\"type\",\"dataPath\":\"[0].severity_level\",\"schemaPath\":\"#/items/properties/severity_level/type\",\"params\":{\"type\":\"string\"},\"message\":\"should be string\"}]"
198
+ error_message: "Unprocessable Entity"
199
+ error_status: 422
200
+ "400":
201
+ description: Bad Request
202
+ content:
203
+ application/json:
204
+ schema:
205
+ $ref: "#/components/schemas/Error"
206
+ example:
207
+ error_message: "Bad Request"
208
+ error_status: 400
209
+ "406":
210
+ description: Not Acceptable
211
+ "413":
212
+ description: Payload Too Large
213
+ content:
214
+ application/json:
215
+ schema:
216
+ $ref: "#/components/schemas/Error"
217
+ example:
218
+ error_message: "Request entity too large"
219
+ error_status: 413
162
220
 
163
221
  components:
164
222
  schemas:
@@ -357,7 +415,86 @@ components:
357
415
  query:
358
416
  type: string
359
417
  example: "?minutesAfter=300&limit=8&mode=departures&cisIds=40110"
360
-
418
+ JisInfotexts:
419
+ title: Jis infotexts
420
+ type: array
421
+ items:
422
+ type: object
423
+ properties:
424
+ id:
425
+ type: string
426
+ format: uuid
427
+ description: Unique identifier for the infotext
428
+ severity_level:
429
+ type: string
430
+ enum:
431
+ - SEVERE
432
+ - WARNING
433
+ - INFO
434
+ description: Severity level of the infotext
435
+ display_type:
436
+ type: string
437
+ description: How the infotext is displayed
438
+ active_period:
439
+ type: object
440
+ properties:
441
+ start:
442
+ type: string
443
+ format: date-time
444
+ description: Start time of the active period
445
+ end:
446
+ type: string
447
+ format: date-time
448
+ description: End time of the active period
449
+ required:
450
+ - start
451
+ - end
452
+ description: The period during which the infotext is active
453
+ description_text:
454
+ type: object
455
+ properties:
456
+ cs:
457
+ type: string
458
+ description: Description in Czech
459
+ en:
460
+ type: string
461
+ description: Description in English
462
+ required:
463
+ - cs
464
+ - en
465
+ description: Localized descriptions of the infotext
466
+ informed_entity:
467
+ type: object
468
+ properties:
469
+ stops:
470
+ type: array
471
+ items:
472
+ type: object
473
+ properties:
474
+ stop_id:
475
+ type: string
476
+ description: Unique identifier for the stop
477
+ required:
478
+ - stop_id
479
+ required:
480
+ - stops
481
+ created_timestamp:
482
+ type: string
483
+ format: date-time
484
+ description: Timestamp when the infotext was created in VYMI
485
+ last_modified_timestamp:
486
+ type: string
487
+ format: date-time
488
+ description: Timestamp when the infotext was updated in VYMI
489
+ required:
490
+ - id
491
+ - severity_level
492
+ - display_type
493
+ - active_period
494
+ - description_text
495
+ - informed_entity
496
+ - created_timestamp
497
+ - last_modified_timestamp
361
498
  examples:
362
499
  VehiclePositionsBodyExample:
363
500
  value: |-
@@ -433,3 +570,57 @@ components:
433
570
  "query": "?minutesAfter=40&limit=6&mode=departures&filter=routeHeadingOnceNoGapFill&order=real&aswIds=2781_2&aswIds=2781_52&skip=atStop&airCondition=true"
434
571
  }
435
572
  ]
573
+ JisInfotextsExample:
574
+ value : |-
575
+ [
576
+ {
577
+ "id": "1833020b-b8c2-4903-85d5-469b0a2ebc70",
578
+ "severity_level": "SEVERE",
579
+ "display_type": "INLINE",
580
+ "active_period": {
581
+ "start": "2024-12-05T11:12:00.000Z",
582
+ "end": "2025-01-30T23:00:00.000Z"
583
+ },
584
+ "description_text": {
585
+ "cs": "Test po aktualizaci Node.js",
586
+ "en": "This is a test"
587
+ },
588
+ "informed_entity": {
589
+ "stops": [
590
+ {
591
+ "stop_id": "U31070Z20"
592
+ },
593
+ {
594
+ "stop_id": "U32268Z1"
595
+ }
596
+ ]
597
+ },
598
+ "created_timestamp": "2024-12-06T14:08:02.669Z"
599
+ "last_modified_timestamp": "2024-12-06T14:08:02.669Z"
600
+ },
601
+ {
602
+ "id": "178c4bff-b098-41a9-b0e7-d611bd3c54ac",
603
+ "severity_level": "INFO",
604
+ "display_type": "INLINE",
605
+ "active_period": {
606
+ "start": "2024-12-03T10:44:00.000Z",
607
+ "end": null
608
+ },
609
+ "description_text": {
610
+ "cs": "Tento text se zobrazí v budoucnosti a bude mít historii",
611
+ "en": null
612
+ },
613
+ "informed_entity": {
614
+ "stops": [
615
+ {
616
+ "stop_id": "U85Z1P"
617
+ },
618
+ {
619
+ "stop_id": "U876Z1P"
620
+ }
621
+ ]
622
+ },
623
+ "created_timestamp": "2024-11-08T10:44:34.701Z"
624
+ "last_modified_timestamp": "2024-11-08T10:44:34.701Z"
625
+ }
626
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "3.2.3-dev.1572823338",
3
+ "version": "3.2.3-dev.1589820139",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",