@golemio/pid 4.0.0-dev.1978030357 → 4.0.0-rc.1979558866
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.
- package/dist/helpers/GtfsStopParser.d.ts +0 -2
- package/dist/helpers/GtfsStopParser.js +8 -11
- package/dist/helpers/GtfsStopParser.js.map +1 -1
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js +1 -0
- package/dist/input-gateway/vehicle-positions/VehiclePositionsController.js.map +1 -1
- package/dist/integration-engine/jis/ioc/Di.js +0 -8
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +0 -3
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +0 -4
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +1 -6
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +2 -50
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
- package/dist/integration-engine/jis/workers/JISWorker.js +0 -1
- package/dist/integration-engine/jis/workers/JISWorker.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.d.ts +2 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +4 -5
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.d.ts +1 -5
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js +0 -24
- package/dist/integration-engine/ropid-gtfs/RopidGTFSStopsModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/index.d.ts +0 -1
- package/dist/integration-engine/ropid-gtfs/index.js +0 -1
- package/dist/integration-engine/ropid-gtfs/index.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js +0 -8
- package/dist/integration-engine/ropid-gtfs/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.d.ts +0 -3
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js +0 -3
- package/dist/integration-engine/ropid-gtfs/ioc/RopidGtfsContainerToken.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/RopidDeparturesPresetsTransformation.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/TimetableWorker.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js +5 -8
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/CheckSavedRowsAndReplaceTablesTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.d.ts +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/TransformAndSaveDataTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessRegionalBusRunMessagesTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveArrivaCityRunsToDBTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveBusRunsToDBTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveTramRunsToDBTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/PropagateTrainDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/SaveDataToDBTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateRunsGtfsTripIdTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/helpers/UpdateDelayLimiter.d.ts +1 -1
- package/dist/output-gateway/jis/routers/v1/V1JISRouter.d.ts +1 -3
- package/dist/output-gateway/jis/routers/v1/V1JISRouter.js.map +1 -1
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.d.ts +1 -3
- package/dist/output-gateway/pid/routers/v3/V3PIDRouter.js.map +1 -1
- package/dist/schema-definitions/jis/redis/const.d.ts +0 -1
- package/dist/schema-definitions/jis/redis/const.js +1 -2
- package/dist/schema-definitions/jis/redis/const.js.map +1 -1
- package/dist/schema-definitions/ropid-departures-presets/index.d.ts +0 -1
- package/dist/schema-definitions/ropid-departures-presets/index.js +0 -3
- package/dist/schema-definitions/ropid-departures-presets/index.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopDto.d.ts +0 -1
- package/dist/schema-definitions/ropid-gtfs/redis/const.d.ts +0 -1
- package/dist/schema-definitions/ropid-gtfs/redis/const.js +1 -2
- package/dist/schema-definitions/ropid-gtfs/redis/const.js.map +1 -1
- package/docs/asyncapi.yaml +0 -45
- package/docs/cache/types/redis.md +2 -82
- package/docs/jis/index.md +5 -15
- package/docs/openapi-input.yaml +2 -13
- package/package.json +5 -4
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.d.ts +0 -9
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js +0 -78
- package/dist/integration-engine/jis/repositories/JISInfotextsRedisRepository.js.map +0 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +0 -11
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +0 -42
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.d.ts +0 -18
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js +0 -44
- package/dist/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.d.ts +0 -12
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js +0 -44
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js.map +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.d.ts +0 -12
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js +0 -87
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRepository.js.map +0 -1
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.d.ts +0 -16
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js +0 -3
- package/dist/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.js.map +0 -1
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.d.ts +0 -58
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js +0 -69
- package/dist/schema-definitions/ropid-gtfs/models/StopCisDto.js.map +0 -1
package/docs/jis/index.md
CHANGED
|
@@ -123,11 +123,9 @@ flowchart TB
|
|
|
123
123
|
subgraph "Golemio VP Integration Engine"
|
|
124
124
|
golemio_refresh_events_task["`RefreshJISEventsTask`"];
|
|
125
125
|
golemio_refresh_infotexts_task["`RefreshJISInfotextsTask`"];
|
|
126
|
-
golemio_refresh_infotexts_cache_task["`RefreshJISInfotextsCacheTask`"];
|
|
127
126
|
end
|
|
128
127
|
|
|
129
128
|
vp_pg[("`VP PostgreSQL`")];
|
|
130
|
-
vp_redis[("`VP Redis (Valkey)`")];
|
|
131
129
|
end
|
|
132
130
|
|
|
133
131
|
vymi_events_controller_create --> vymi_get_events;
|
|
@@ -136,8 +134,8 @@ flowchart TB
|
|
|
136
134
|
vymi_infotexts_controller_create --> vymi_get_infotexts;
|
|
137
135
|
vymi_infotexts_controller_update --> vymi_get_infotexts;
|
|
138
136
|
|
|
139
|
-
vymi_get_events
|
|
140
|
-
vymi_get_infotexts
|
|
137
|
+
vymi_get_events -- "`SELECT aktuálních událostí z tabulek vehicle-positions.pid.jis_events a vehicle-positions.pid.jis_events_ropidgtfs_routes`" --> vymi_pg;
|
|
138
|
+
vymi_get_infotexts -- "`SELECT aktuálních infotextů z tabulek vehicle-positions.pid.jis_infotexts a vehicle-positions.pid.jis_infotexts_ropidgtfs_stops`" --> vymi_pg;
|
|
141
139
|
|
|
142
140
|
vymi_get_events --> golemio_api_post_events;
|
|
143
141
|
vymi_get_infotexts --> golemio_api_post_infotexts;
|
|
@@ -153,12 +151,9 @@ flowchart TB
|
|
|
153
151
|
|
|
154
152
|
golemio_refresh_events_task -- "`UPSERT do tabulek vehicle-positions.pid.jis_events a vehicle-positions.pid.jis_events_ropidgtfs_routes`" --> vp_pg;
|
|
155
153
|
golemio_refresh_infotexts_task -- "`UPSERT do tabulek vehicle-positions.pid.jis_infotexts a vehicle-positions.pid.jis_infotexts_ropidgtfs_stops`" --> vp_pg;
|
|
156
|
-
golemio_refresh_infotexts_task --> golemio_refresh_infotexts_cache_task;
|
|
157
|
-
|
|
158
|
-
golemio_refresh_infotexts_cache_task -- "`Aktualizace cache jisCache:infotexts:* a jisCache:stop-infotexts:*`" --> vp_redis;
|
|
159
154
|
```
|
|
160
155
|
|
|
161
|
-
Formát zasílaných dat je dále více popsán v implementační dokumentaci ([události](../implementation_documentation.md#jis-events-1), [infotexty](../implementation_documentation.md#jis-infotexts-1)), stejně tak jako odkazy na [Input Gateway OpenAPI](../implementation_documentation.md#input-api) a popis [uložení dat](../implementation_documentation.md#uložení-dat) včetně databázového schema a popisu retence.
|
|
156
|
+
Formát zasílaných dat je dále více popsán v implementační dokumentaci ([události](../implementation_documentation.md#jis-events-1), [infotexty](../implementation_documentation.md#jis-infotexts-1)), stejně tak jako odkazy na [Input Gateway OpenAPI](../implementation_documentation.md#input-api) a popis [uložení dat](../implementation_documentation.md#uložení-dat) včetně databázového schema a popisu retence.
|
|
162
157
|
|
|
163
158
|
## Pasivní načítání (pull) dat
|
|
164
159
|
|
|
@@ -205,7 +200,6 @@ flowchart TB
|
|
|
205
200
|
golemio_fetch_infotexts_task["`FetchJISInfotextsTask`"];
|
|
206
201
|
golemio_refresh_events_task["`RefreshJISEventsTask`"];
|
|
207
202
|
golemio_refresh_infotexts_task["`RefreshJISInfotextsTask`"];
|
|
208
|
-
golemio_refresh_infotexts_cache_task["`RefreshJISInfotextsCacheTask`"];
|
|
209
203
|
|
|
210
204
|
%% invisible unicode char due to https://github.com/orgs/community/discussions/106690
|
|
211
205
|
golemio_api_get_events["`HTTPS GET s API klíčem na https://api-vymi.golemio.cz/v1/exports/events/custom-format`"];
|
|
@@ -213,11 +207,10 @@ flowchart TB
|
|
|
213
207
|
end
|
|
214
208
|
|
|
215
209
|
vp_pg[("`VP PostgreSQL`")];
|
|
216
|
-
vp_redis[("`VP Redis (Valkey)`")];
|
|
217
210
|
end
|
|
218
211
|
|
|
219
|
-
vymi_get_events
|
|
220
|
-
vymi_get_infotexts
|
|
212
|
+
vymi_get_events -- "`SELECT aktuálních událostí z tabulek vehicle-positions.pid.jis_events a vehicle-positions.pid.jis_events_ropidgtfs_routes`" --> vymi_pg;
|
|
213
|
+
vymi_get_infotexts -- "`SELECT aktuálních infotextů z tabulek vehicle-positions.pid.jis_infotexts a vehicle-positions.pid.jis_infotexts_ropidgtfs_stops`" --> vymi_pg;
|
|
221
214
|
|
|
222
215
|
golemio_rabbit_fetch_events --> golemio_fetch_events_task;
|
|
223
216
|
golemio_rabbit_fetch_infotexts --> golemio_fetch_infotexts_task;
|
|
@@ -238,9 +231,6 @@ flowchart TB
|
|
|
238
231
|
|
|
239
232
|
golemio_refresh_events_task -- "`UPSERT do tabulek vehicle-positions.pid.jis_events a vehicle-positions.pid.jis_events_ropidgtfs_routes`" --> vp_pg;
|
|
240
233
|
golemio_refresh_infotexts_task -- "`UPSERT do tabulek vehicle-positions.pid.jis_infotexts a vehicle-positions.pid.jis_infotexts_ropidgtfs_stops`" --> vp_pg;
|
|
241
|
-
golemio_refresh_infotexts_task --> golemio_refresh_infotexts_cache_task;
|
|
242
|
-
|
|
243
|
-
golemio_refresh_infotexts_cache_task -- "`Aktualizace cache jisCache:infotexts:* a jisCache:stop-infotexts:*`" --> vp_redis;
|
|
244
234
|
```
|
|
245
235
|
|
|
246
236
|
Zdroj a formát dat pro aktivní stahování jsou dále více popsány v implementační dokumentaci ([události](../implementation_documentation.md#jis-events), [infotexty](../implementation_documentation.md#jis-infotexts)), stejně tak jako [worker a tasky](../implementation_documentation.md#jisworker) a popis [uložení dat](../implementation_documentation.md#uložení-dat) včetně databázového schema a popisu retence.
|
package/docs/openapi-input.yaml
CHANGED
|
@@ -453,12 +453,6 @@ components:
|
|
|
453
453
|
type: array
|
|
454
454
|
items:
|
|
455
455
|
type: object
|
|
456
|
-
required:
|
|
457
|
-
- routeName
|
|
458
|
-
- note
|
|
459
|
-
- apiVersion
|
|
460
|
-
- route
|
|
461
|
-
- query
|
|
462
456
|
properties:
|
|
463
457
|
routeName:
|
|
464
458
|
type: string
|
|
@@ -475,9 +469,6 @@ components:
|
|
|
475
469
|
query:
|
|
476
470
|
type: string
|
|
477
471
|
example: "?minutesAfter=300&limit=8&mode=departures&cisIds=40110"
|
|
478
|
-
isTesting:
|
|
479
|
-
type: boolean
|
|
480
|
-
example: true
|
|
481
472
|
JISEvents:
|
|
482
473
|
title: JIS events
|
|
483
474
|
type: array
|
|
@@ -840,16 +831,14 @@ components:
|
|
|
840
831
|
"note": "Tablo Zahradní město z centra (APEX)",
|
|
841
832
|
"apiVersion": 2,
|
|
842
833
|
"route": "/pid/departureboards",
|
|
843
|
-
"query": "?minutesAfter=40&limit=6&mode=departures&filter=routeHeadingOnceNoGapFill&order=real&aswIds=2781_2&aswIds=2781_52&skip=atStop&airCondition=true"
|
|
844
|
-
"isTesting": true
|
|
834
|
+
"query": "?minutesAfter=40&limit=6&mode=departures&filter=routeHeadingOnceNoGapFill&order=real&aswIds=2781_2&aswIds=2781_52&skip=atStop&airCondition=true"
|
|
845
835
|
},
|
|
846
836
|
{
|
|
847
837
|
"routeName": "apex-zahradnimesto-6048-kopie",
|
|
848
838
|
"note": "Tablo Zahradní město z centra (APEX)",
|
|
849
839
|
"apiVersion": 2,
|
|
850
840
|
"route": "/pid/departureboards",
|
|
851
|
-
"query": "?minutesAfter=40&limit=6&mode=departures&filter=routeHeadingOnceNoGapFill&order=real&aswIds=2781_2&aswIds=2781_52&skip=atStop&airCondition=true"
|
|
852
|
-
"isTesting": false
|
|
841
|
+
"query": "?minutesAfter=40&limit=6&mode=departures&filter=routeHeadingOnceNoGapFill&order=real&aswIds=2781_2&aswIds=2781_52&skip=atStop&airCondition=true"
|
|
853
842
|
}
|
|
854
843
|
]
|
|
855
844
|
JISEventsExample:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/pid",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.1979558866",
|
|
4
4
|
"description": "Golemio PID Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
"@apideck/portman": "^1.26.5",
|
|
37
37
|
"@commitlint/cli": "^11.0.0",
|
|
38
38
|
"@commitlint/config-conventional": "^11.0.0",
|
|
39
|
-
"@golemio/cli": "1.10.
|
|
40
|
-
"@golemio/core": "1.20.
|
|
39
|
+
"@golemio/cli": "1.10.0",
|
|
40
|
+
"@golemio/core": "1.20.12",
|
|
41
41
|
"@golemio/db-common": "1.2.0",
|
|
42
42
|
"@golemio/eslint-config": "1.1.2",
|
|
43
|
+
"@types/amqplib": "^0.5.17",
|
|
43
44
|
"@types/chai": "4.2.3",
|
|
44
45
|
"@types/chai-as-promised": "7.1.2",
|
|
45
46
|
"@types/mocha": "^9.1.1",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"@golemio/core": ">=1.16.0-rc.1551191551"
|
|
76
77
|
},
|
|
77
78
|
"dependencies": {
|
|
78
|
-
"@golemio/ovapi-gtfs-realtime-bindings": "1.2.
|
|
79
|
+
"@golemio/ovapi-gtfs-realtime-bindings": "1.2.3",
|
|
79
80
|
"@turf/turf": "^6.5.0",
|
|
80
81
|
"cheap-ruler": "^3.0.2",
|
|
81
82
|
"csv-parser": "^3.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JISInfotextsModel } from "../../../schema-definitions/jis/models/JISInfotextsModel";
|
|
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: JISInfotextsModel[]): Promise<void>;
|
|
7
|
-
private createNewCache;
|
|
8
|
-
private deleteOldCache;
|
|
9
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
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 integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
16
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
17
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
18
|
-
const node_crypto_1 = require("node:crypto");
|
|
19
|
-
const TTL_SECONDS_BEFORE_DELETE = 60;
|
|
20
|
-
let JISInfotextsRedisRepository = exports.JISInfotextsRedisRepository = JISInfotextsRedisRepository_1 = class JISInfotextsRedisRepository extends integration_engine_1.RedisModel {
|
|
21
|
-
constructor() {
|
|
22
|
-
super("JISInfotextsRedisRepository", {
|
|
23
|
-
isKeyConstructedFromData: false,
|
|
24
|
-
prefix: JISInfotextsRedisRepository_1.NAMESPACE_PREFIX,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async refreshData(infotexts) {
|
|
28
|
-
try {
|
|
29
|
-
const oldSetName = (await this.connection.get(`${this.prefix}:activeSetName`)) ?? "";
|
|
30
|
-
await this.createNewCache(infotexts);
|
|
31
|
-
await this.deleteOldCache(oldSetName);
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
throw new golemio_errors_1.GeneralError("refreshData failed", this.constructor.name, err);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async createNewCache(infotexts) {
|
|
38
|
-
try {
|
|
39
|
-
const infotextIdsByStopId = new Map();
|
|
40
|
-
const infotextsByInfotextId = new Map();
|
|
41
|
-
for (const infotext of infotexts) {
|
|
42
|
-
infotextsByInfotextId.set(infotext.id, JSON.stringify(infotext));
|
|
43
|
-
for (const { stop_id } of infotext?.stops ?? []) {
|
|
44
|
-
let stopInfotextsIds = infotextIdsByStopId.get(stop_id) ?? [];
|
|
45
|
-
stopInfotextsIds.push(infotext.id);
|
|
46
|
-
infotextIdsByStopId.set(stop_id, stopInfotextsIds);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const setName = (0, node_crypto_1.randomBytes)(4).toString("hex");
|
|
50
|
-
const pipeline = this.connection.pipeline();
|
|
51
|
-
pipeline.hset(`${this.prefix}:${setName}:infotexts`, infotextsByInfotextId);
|
|
52
|
-
pipeline.hset(`${this.prefix}:${setName}:stops-infotexts`, infotextIdsByStopId);
|
|
53
|
-
pipeline.publish(`${this.prefix}`, `${this.prefix}:${setName}`);
|
|
54
|
-
pipeline.set(`${this.prefix}:activeSetName`, `${this.prefix}:${setName}`);
|
|
55
|
-
await pipeline.exec();
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
throw new golemio_errors_1.GeneralError("createNewCache failed", this.constructor.name, err);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async deleteOldCache(setName) {
|
|
62
|
-
try {
|
|
63
|
-
const pipeline = this.connection.pipeline();
|
|
64
|
-
pipeline.expire(`${setName}:infotexts`, TTL_SECONDS_BEFORE_DELETE);
|
|
65
|
-
pipeline.expire(`${setName}:stops-infotexts`, TTL_SECONDS_BEFORE_DELETE);
|
|
66
|
-
await pipeline.exec();
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
throw new golemio_errors_1.GeneralError("deleteOldCache failed", this.constructor.name, err);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
JISInfotextsRedisRepository.NAMESPACE_PREFIX = const_1.JIS_NAMESPACE_PREFIX;
|
|
74
|
-
exports.JISInfotextsRedisRepository = JISInfotextsRedisRepository = JISInfotextsRedisRepository_1 = __decorate([
|
|
75
|
-
(0, tsyringe_1.injectable)(),
|
|
76
|
-
__metadata("design:paramtypes", [])
|
|
77
|
-
], JISInfotextsRedisRepository);
|
|
78
|
-
//# sourceMappingURL=JISInfotextsRedisRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextsRedisRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRedisRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,uEAA4D;AAC5D,8EAAmE;AACnE,6EAAwE;AACxE,iEAAgE;AAChE,6CAA0C;AAE1C,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAG9B,IAAM,2BAA2B,yEAAjC,MAAM,2BAA4B,SAAQ,+BAAU;IAGvD;QACI,KAAK,CAAC,6BAA6B,EAAE;YACjC,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,6BAA2B,CAAC,gBAAgB;SACvD,CAAC,CAAC;IACP,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAA8B;QACnD,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,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BAAgB,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;;AArDa,4CAAgB,GAAG,4BAAoB,AAAvB,CAAwB;sCAD7C,2BAA2B;IADvC,IAAA,qBAAU,GAAE;;GACA,2BAA2B,CAuDvC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JISInfotextsRedisRepository } from "../../repositories/JISInfotextsRedisRepository";
|
|
2
|
-
import { JISInfotextsRepository } from "../../repositories/JISInfotextsRepository";
|
|
3
|
-
import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
|
|
4
|
-
export declare class RefreshJISInfotextsCacheTask extends AbstractEmptyTask {
|
|
5
|
-
private infotextsRepository;
|
|
6
|
-
private infotextCacheRepository;
|
|
7
|
-
readonly queueName = "refreshJISInfotextsCache";
|
|
8
|
-
readonly queueTtl: number;
|
|
9
|
-
constructor(infotextsRepository: JISInfotextsRepository, infotextCacheRepository: JISInfotextsRedisRepository);
|
|
10
|
-
protected execute(): Promise<void>;
|
|
11
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.RefreshJISInfotextsCacheTask = void 0;
|
|
16
|
-
const JISContainerToken_1 = require("../../ioc/JISContainerToken");
|
|
17
|
-
const JISInfotextsRedisRepository_1 = require("../../repositories/JISInfotextsRedisRepository");
|
|
18
|
-
const JISInfotextsRepository_1 = require("../../repositories/JISInfotextsRepository");
|
|
19
|
-
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
20
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
21
|
-
const constants_1 = require("../constants");
|
|
22
|
-
let RefreshJISInfotextsCacheTask = exports.RefreshJISInfotextsCacheTask = class RefreshJISInfotextsCacheTask extends integration_engine_1.AbstractEmptyTask {
|
|
23
|
-
constructor(infotextsRepository, infotextCacheRepository) {
|
|
24
|
-
super(constants_1.JIS_WORKER_NAME.toLowerCase());
|
|
25
|
-
this.infotextsRepository = infotextsRepository;
|
|
26
|
-
this.infotextCacheRepository = infotextCacheRepository;
|
|
27
|
-
this.queueName = "refreshJISInfotextsCache";
|
|
28
|
-
this.queueTtl = 60 * 1000; // 1 minute
|
|
29
|
-
}
|
|
30
|
-
async execute() {
|
|
31
|
-
const infotexts = await this.infotextsRepository.findAll();
|
|
32
|
-
await this.infotextCacheRepository.refreshData(infotexts);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.RefreshJISInfotextsCacheTask = RefreshJISInfotextsCacheTask = __decorate([
|
|
36
|
-
(0, tsyringe_1.injectable)(),
|
|
37
|
-
__param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRepository)),
|
|
38
|
-
__param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRedisRepository)),
|
|
39
|
-
__metadata("design:paramtypes", [JISInfotextsRepository_1.JISInfotextsRepository,
|
|
40
|
-
JISInfotextsRedisRepository_1.JISInfotextsRedisRepository])
|
|
41
|
-
], RefreshJISInfotextsCacheTask);
|
|
42
|
-
//# sourceMappingURL=RefreshJISInfotextsCacheTask.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshJISInfotextsCacheTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAAkE;AAClE,gGAA+F;AAC/F,sFAAqF;AACrF,8EAA0E;AAC1E,iEAAwE;AACxE,4CAA+C;AAGxC,IAAM,4BAA4B,0CAAlC,MAAM,4BAA6B,SAAQ,sCAAiB;IAI/D,YACsD,mBAAmD,EAC9C,uBAA4D;QAEnH,KAAK,CAAC,2BAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAHqB,wBAAmB,GAAnB,mBAAmB,CAAwB;QACtC,4BAAuB,GAAvB,uBAAuB,CAA6B;QALvG,cAAS,GAAG,0BAA0B,CAAC;QACvC,aAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;IAOjD,CAAC;IAES,KAAK,CAAC,OAAO;QACnB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAC3D,MAAM,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACJ,CAAA;uCAfY,4BAA4B;IADxC,IAAA,qBAAU,GAAE;IAMJ,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,sBAAsB,CAAC,CAAA;IAChD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,2BAA2B,CAAC,CAAA;qCADyB,+CAAsB;QACb,yDAA2B;GAN9G,4BAA4B,CAexC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IStopCisDto } from "../../schema-definitions/ropid-gtfs/interfaces/IStopCisDto";
|
|
2
|
-
import { IModel, PostgresModel } from "@golemio/core/dist/integration-engine";
|
|
3
|
-
import { IValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
4
|
-
import Sequelize from "@golemio/core/dist/shared/sequelize";
|
|
5
|
-
export declare class RopidGTFSCisStopsModel extends PostgresModel implements IModel {
|
|
6
|
-
/** Model name */
|
|
7
|
-
name: string;
|
|
8
|
-
/** The Sequelize Model */
|
|
9
|
-
sequelizeModel: Sequelize.ModelCtor<any>;
|
|
10
|
-
/** The Sequelize Model for temporary table */
|
|
11
|
-
protected tmpSequelizeModel: Sequelize.ModelCtor<any> | null;
|
|
12
|
-
/** Validation helper */
|
|
13
|
-
protected validator: IValidator;
|
|
14
|
-
/** Type/Strategy of saving the data */
|
|
15
|
-
protected savingType: "insertOnly" | "insertOrUpdate";
|
|
16
|
-
constructor();
|
|
17
|
-
getAll: () => Promise<Array<Pick<IStopCisDto, "id" | "cis">>>;
|
|
18
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RopidGTFSCisStopsModel = void 0;
|
|
13
|
-
const const_1 = require("../../schema-definitions/const");
|
|
14
|
-
const StopCisDto_1 = require("../../schema-definitions/ropid-gtfs/models/StopCisDto");
|
|
15
|
-
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
16
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
17
|
-
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
19
|
-
let RopidGTFSCisStopsModel = exports.RopidGTFSCisStopsModel = class RopidGTFSCisStopsModel extends integration_engine_1.PostgresModel {
|
|
20
|
-
constructor() {
|
|
21
|
-
super("RopidGTFSCisStopsModel", {
|
|
22
|
-
outputSequelizeAttributes: StopCisDto_1.StopCisDto.attributeModel,
|
|
23
|
-
pgTableName: StopCisDto_1.StopCisDto.tableName,
|
|
24
|
-
pgSchema: const_1.PG_SCHEMA,
|
|
25
|
-
savingType: "insertOnly",
|
|
26
|
-
}, new golemio_validator_1.JSONSchemaValidator(StopCisDto_1.StopCisDto.tableName + "ModelValidator", StopCisDto_1.StopCisDto.jsonSchema));
|
|
27
|
-
this.getAll = async () => {
|
|
28
|
-
try {
|
|
29
|
-
return await this.sequelizeModel.findAll({
|
|
30
|
-
attributes: ["id", "cis"],
|
|
31
|
-
raw: true,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
throw new golemio_errors_1.GeneralError("Database error", this.constructor.name, err, 500);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.RopidGTFSCisStopsModel = RopidGTFSCisStopsModel = __decorate([
|
|
41
|
-
(0, tsyringe_1.injectable)(),
|
|
42
|
-
__metadata("design:paramtypes", [])
|
|
43
|
-
], RopidGTFSCisStopsModel);
|
|
44
|
-
//# sourceMappingURL=RopidGTFSCisStopsModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RopidGTFSCisStopsModel.js","sourceRoot":"","sources":["../../../src/integration-engine/ropid-gtfs/RopidGTFSCisStopsModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAuC;AAEvC,sFAA+D;AAC/D,8EAA8E;AAC9E,6EAAwE;AACxE,mFAA8F;AAE9F,iEAAgE;AAGzD,IAAM,sBAAsB,oCAA5B,MAAM,sBAAuB,SAAQ,kCAAa;IAYrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,uBAAU,CAAC,cAAc;YACpD,WAAW,EAAE,uBAAU,CAAC,SAAS;YACjC,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,uBAAU,CAAC,SAAS,GAAG,gBAAgB,EAAE,uBAAU,CAAC,UAAU,CAAC,CAC1F,CAAC;QAGC,WAAM,GAAG,KAAK,IAAqD,EAAE;YACxE,IAAI;gBACA,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACrC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;oBACzB,GAAG,EAAE,IAAI;iBACZ,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;aAC7E;QACL,CAAC,CAAC;IAXF,CAAC;CAYJ,CAAA;iCAnCY,sBAAsB;IADlC,IAAA,qBAAU,GAAE;;GACA,sBAAsB,CAmClC"}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RopidGTFSCisStopsModel } from "../../..";
|
|
2
|
-
import { AbstractEmptyTask } from "@golemio/core/dist/integration-engine";
|
|
3
|
-
import { GtfsStopsRedisRepository } from "./data-access/cache/GtfsStopsRedisRepository";
|
|
4
|
-
export declare class RefreshGtfsStopsCacheTask extends AbstractEmptyTask {
|
|
5
|
-
private gtfsStopsRedisRepository;
|
|
6
|
-
private gtfsStopCisModel;
|
|
7
|
-
readonly queueName = "refreshGtfsStopsCache";
|
|
8
|
-
readonly queueTtl: number;
|
|
9
|
-
private readonly gtfsStopRepository;
|
|
10
|
-
constructor(gtfsStopsRedisRepository: GtfsStopsRedisRepository, gtfsStopCisModel: RopidGTFSCisStopsModel);
|
|
11
|
-
protected execute(): Promise<void>;
|
|
12
|
-
}
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.RefreshGtfsStopsCacheTask = void 0;
|
|
16
|
-
const ropid_gtfs_1 = require("../../..");
|
|
17
|
-
const RopidGtfsContainerToken_1 = require("../../../ioc/RopidGtfsContainerToken");
|
|
18
|
-
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
19
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
20
|
-
const constants_1 = require("../constants");
|
|
21
|
-
const GtfsStopsRedisRepository_1 = require("./data-access/cache/GtfsStopsRedisRepository");
|
|
22
|
-
let RefreshGtfsStopsCacheTask = exports.RefreshGtfsStopsCacheTask = class RefreshGtfsStopsCacheTask extends integration_engine_1.AbstractEmptyTask {
|
|
23
|
-
constructor(gtfsStopsRedisRepository, gtfsStopCisModel) {
|
|
24
|
-
super(constants_1.TIMETABLE_WORKER_NAME);
|
|
25
|
-
this.gtfsStopsRedisRepository = gtfsStopsRedisRepository;
|
|
26
|
-
this.gtfsStopCisModel = gtfsStopCisModel;
|
|
27
|
-
this.queueName = "refreshGtfsStopsCache";
|
|
28
|
-
this.queueTtl = 59 * 60 * 1000; // 59 minutes
|
|
29
|
-
this.gtfsStopRepository = new ropid_gtfs_1.RopidGTFSStopsModel();
|
|
30
|
-
}
|
|
31
|
-
async execute() {
|
|
32
|
-
const cisStops = await this.gtfsStopCisModel.getAll();
|
|
33
|
-
const gtfsStops = await this.gtfsStopRepository.getAllAswNodeGtfsStops();
|
|
34
|
-
await this.gtfsStopsRedisRepository.refreshData(cisStops, gtfsStops);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.RefreshGtfsStopsCacheTask = RefreshGtfsStopsCacheTask = __decorate([
|
|
38
|
-
(0, tsyringe_1.injectable)(),
|
|
39
|
-
__param(0, (0, tsyringe_1.inject)(RopidGtfsContainerToken_1.RopidGtfsContainerToken.GtfsStopsRedisRepository)),
|
|
40
|
-
__param(1, (0, tsyringe_1.inject)(RopidGtfsContainerToken_1.RopidGtfsContainerToken.RopidGTFSCisStopsModel)),
|
|
41
|
-
__metadata("design:paramtypes", [GtfsStopsRedisRepository_1.GtfsStopsRedisRepository,
|
|
42
|
-
ropid_gtfs_1.RopidGTFSCisStopsModel])
|
|
43
|
-
], RefreshGtfsStopsCacheTask);
|
|
44
|
-
//# sourceMappingURL=RefreshGtfsStopsCacheTask.js.map
|
package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshGtfsStopsCacheTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshGtfsStopsCacheTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA6E;AAC7E,kFAAqF;AACrF,8EAA0E;AAC1E,iEAAwE;AACxE,4CAAqD;AACrD,2FAAwF;AAGjF,IAAM,yBAAyB,uCAA/B,MAAM,yBAA0B,SAAQ,sCAAiB;IAM5D,YAC8D,wBAA0D,EAC5D,gBAAgD;QAExG,KAAK,CAAC,iCAAqB,CAAC,CAAC;QAHqC,6BAAwB,GAAxB,wBAAwB,CAA0B;QACpD,qBAAgB,GAAhB,gBAAgB,CAAwB;QAP5F,cAAS,GAAG,uBAAuB,CAAC;QACpC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;QAUpD,IAAI,CAAC,kBAAkB,GAAG,IAAI,gCAAmB,EAAE,CAAC;IACxD,CAAC;IAES,KAAK,CAAC,OAAO;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QACtD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,CAAC;QAEzE,MAAM,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;CACJ,CAAA;oCArBY,yBAAyB;IADrC,IAAA,qBAAU,GAAE;IAQJ,WAAA,IAAA,iBAAM,EAAC,iDAAuB,CAAC,wBAAwB,CAAC,CAAA;IACxD,WAAA,IAAA,iBAAM,EAAC,iDAAuB,CAAC,sBAAsB,CAAC,CAAA;qCADqC,mDAAwB;QAClC,mCAAsB;GARnG,yBAAyB,CAqBrC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { GtfsStopParser } from "../../../../../../../helpers/GtfsStopParser";
|
|
2
|
-
import { IStopCisDto } from "../../../../../../../schema-definitions/ropid-gtfs/interfaces/IStopCisDto";
|
|
3
|
-
import { IAwsNodeIdGtfsStopIdDto } from "../../../../../../../schema-definitions/ropid-gtfs/interfaces/IStopDto";
|
|
4
|
-
import { RedisModel } from "@golemio/core/dist/integration-engine";
|
|
5
|
-
export declare class GtfsStopsRedisRepository extends RedisModel {
|
|
6
|
-
private gtfsStopParser;
|
|
7
|
-
static NAMESPACE_PREFIX: string;
|
|
8
|
-
constructor(gtfsStopParser: GtfsStopParser);
|
|
9
|
-
refreshData(cisStops: Array<Pick<IStopCisDto, "id" | "cis">>, gtfsStops: IAwsNodeIdGtfsStopIdDto[]): Promise<void>;
|
|
10
|
-
private createNewCache;
|
|
11
|
-
private deleteOldCache;
|
|
12
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
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 GtfsStopsRedisRepository_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.GtfsStopsRedisRepository = void 0;
|
|
17
|
-
const GtfsStopParser_1 = require("../../../../../../../helpers/GtfsStopParser");
|
|
18
|
-
const RopidGtfsContainerToken_1 = require("../../../../../ioc/RopidGtfsContainerToken");
|
|
19
|
-
const const_1 = require("../../../../../../../schema-definitions/ropid-gtfs/redis/const");
|
|
20
|
-
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
21
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
22
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
23
|
-
const node_crypto_1 = require("node:crypto");
|
|
24
|
-
const TTL_SECONDS_BEFORE_DELETE = 60;
|
|
25
|
-
let GtfsStopsRedisRepository = exports.GtfsStopsRedisRepository = GtfsStopsRedisRepository_1 = class GtfsStopsRedisRepository extends integration_engine_1.RedisModel {
|
|
26
|
-
constructor(gtfsStopParser) {
|
|
27
|
-
super("GtfsStopsRedisRepository", {
|
|
28
|
-
isKeyConstructedFromData: false,
|
|
29
|
-
prefix: GtfsStopsRedisRepository_1.NAMESPACE_PREFIX,
|
|
30
|
-
});
|
|
31
|
-
this.gtfsStopParser = gtfsStopParser;
|
|
32
|
-
}
|
|
33
|
-
async refreshData(cisStops, gtfsStops) {
|
|
34
|
-
try {
|
|
35
|
-
const oldSetName = (await this.connection.get(`${this.prefix}:activeSetName`)) ?? "";
|
|
36
|
-
await this.createNewCache(cisStops, gtfsStops);
|
|
37
|
-
await this.deleteOldCache(oldSetName);
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
throw new golemio_errors_1.GeneralError("refreshData failed", this.constructor.name, err);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async createNewCache(cisStops, gtfsStops) {
|
|
44
|
-
try {
|
|
45
|
-
const cisToAswNode = new Map();
|
|
46
|
-
for (const stop of cisStops) {
|
|
47
|
-
cisToAswNode.set(stop.cis, this.gtfsStopParser.getAswNodeFromId(stop.id));
|
|
48
|
-
}
|
|
49
|
-
const awsNodeToGtfsStops = new Map();
|
|
50
|
-
for (const stop of gtfsStops) {
|
|
51
|
-
const nodeStopIds = awsNodeToGtfsStops.get(stop.asw_node_id) ?? [];
|
|
52
|
-
if (nodeStopIds.length === 0) {
|
|
53
|
-
awsNodeToGtfsStops.set(stop.asw_node_id, nodeStopIds);
|
|
54
|
-
}
|
|
55
|
-
nodeStopIds.push(stop.stop_id);
|
|
56
|
-
}
|
|
57
|
-
const setName = (0, node_crypto_1.randomBytes)(4).toString("hex");
|
|
58
|
-
const pipeline = this.connection.pipeline();
|
|
59
|
-
pipeline.hset(`${this.prefix}:${setName}:awsNodeToGtfsStops`, awsNodeToGtfsStops);
|
|
60
|
-
pipeline.hset(`${this.prefix}:${setName}:cisToAswNode`, cisToAswNode);
|
|
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}:awsNodeToGtfsStops`, TTL_SECONDS_BEFORE_DELETE);
|
|
73
|
-
pipeline.expire(`${setName}:cisToAswNode`, 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
|
-
GtfsStopsRedisRepository.NAMESPACE_PREFIX = const_1.GTFS_STOPS_NAMESPACE_PREFIX;
|
|
82
|
-
exports.GtfsStopsRedisRepository = GtfsStopsRedisRepository = GtfsStopsRedisRepository_1 = __decorate([
|
|
83
|
-
(0, tsyringe_1.injectable)(),
|
|
84
|
-
__param(0, (0, tsyringe_1.inject)(RopidGtfsContainerToken_1.RopidGtfsContainerToken.GtfsStopParser)),
|
|
85
|
-
__metadata("design:paramtypes", [GtfsStopParser_1.GtfsStopParser])
|
|
86
|
-
], GtfsStopsRedisRepository);
|
|
87
|
-
//# sourceMappingURL=GtfsStopsRedisRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GtfsStopsRedisRepository.js","sourceRoot":"","sources":["../../../../../../../../src/integration-engine/ropid-gtfs/workers/timetables/tasks/data-access/cache/GtfsStopsRedisRep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AAU,CAAC,QAAQ,EAAE,CAAC;YAC5C,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,qBAAqB,EAAE,yBAAyB,CAAC,CAAC;YAC5E,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,eAAe,EAAE,yBAAyB,CAAC,CAAC;YACtE,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;;AA9Da,yCAAgB,GAAG,mCAA2B,AAA9B,CAA+B;mCADpD,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAII,WAAA,IAAA,iBAAM,EAAC,iDAAuB,CAAC,cAAc,CAAC,CAAA;qCAAyB,+BAAc;GAHzF,wBAAwB,CAgEpC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IStopDto } from "./IStopDto";
|
|
2
|
-
export interface IStopCisDto {
|
|
3
|
-
alt_idos_name: string;
|
|
4
|
-
cis: number;
|
|
5
|
-
id: string;
|
|
6
|
-
jtsk_x: number;
|
|
7
|
-
jtsk_y: number;
|
|
8
|
-
lat: number;
|
|
9
|
-
lon: number;
|
|
10
|
-
platform: string;
|
|
11
|
-
wheelchair_access: string;
|
|
12
|
-
zone: string;
|
|
13
|
-
created_at: Date;
|
|
14
|
-
updated_at: Date;
|
|
15
|
-
gtfs_stop?: IStopDto;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IStopCisDto.js","sourceRoot":"","sources":["../../../../src/schema-definitions/ropid-gtfs/interfaces/IStopCisDto.ts"],"names":[],"mappings":""}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { IStopCisDto } from "../interfaces/IStopCisDto";
|
|
2
|
-
import { Model, CreationOptional, ModelAttributes } from "@golemio/core/dist/shared/sequelize";
|
|
3
|
-
export declare class StopCisDto extends Model<IStopCisDto> implements IStopCisDto {
|
|
4
|
-
static tableName: string;
|
|
5
|
-
alt_idos_name: string;
|
|
6
|
-
cis: number;
|
|
7
|
-
id: string;
|
|
8
|
-
jtsk_x: number;
|
|
9
|
-
jtsk_y: number;
|
|
10
|
-
lat: number;
|
|
11
|
-
lon: number;
|
|
12
|
-
platform: string;
|
|
13
|
-
wheelchair_access: string;
|
|
14
|
-
zone: string;
|
|
15
|
-
created_at: CreationOptional<Date>;
|
|
16
|
-
updated_at: CreationOptional<Date>;
|
|
17
|
-
stop_id?: string;
|
|
18
|
-
static attributeModel: ModelAttributes<StopCisDto>;
|
|
19
|
-
static jsonSchema: {
|
|
20
|
-
type: string;
|
|
21
|
-
properties: {
|
|
22
|
-
type: string;
|
|
23
|
-
properties: {
|
|
24
|
-
alt_idos_name: {
|
|
25
|
-
type: string;
|
|
26
|
-
};
|
|
27
|
-
cis: {
|
|
28
|
-
type: string;
|
|
29
|
-
};
|
|
30
|
-
id: {
|
|
31
|
-
type: string;
|
|
32
|
-
};
|
|
33
|
-
jtsk_x: {
|
|
34
|
-
type: string;
|
|
35
|
-
};
|
|
36
|
-
jtsk_y: {
|
|
37
|
-
type: string;
|
|
38
|
-
};
|
|
39
|
-
lat: {
|
|
40
|
-
type: string;
|
|
41
|
-
};
|
|
42
|
-
lon: {
|
|
43
|
-
type: string;
|
|
44
|
-
};
|
|
45
|
-
platform: {
|
|
46
|
-
type: string;
|
|
47
|
-
};
|
|
48
|
-
wheelchair_access: {
|
|
49
|
-
type: string;
|
|
50
|
-
};
|
|
51
|
-
zone: {
|
|
52
|
-
type: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
required: string[];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
}
|