@golemio/pid 5.15.4-dev.2629000433 → 5.16.0-rc.2635246332
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/db/example/19_train_trip_with_cis_platform_code.sql +4 -9
- package/dist/integration-engine/jis/ioc/Di.js +2 -2
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISEventsRepository.d.ts +0 -1
- package/dist/integration-engine/jis/repositories/JISEventsRepository.js +0 -14
- package/dist/integration-engine/jis/repositories/JISEventsRepository.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +3 -2
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +28 -22
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
- package/dist/integration-engine/jis/transformations/{JISInfotextCacheTransformation.d.ts → JISInfotextCacheTranformation.d.ts} +1 -1
- package/dist/integration-engine/jis/transformations/{JISInfotextCacheTransformation.js → JISInfotextCacheTranformation.js} +7 -7
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTranformation.js.map +1 -0
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js +0 -1
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.d.ts +3 -3
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js +6 -6
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsCacheTask.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.d.ts +0 -1
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js +0 -10
- package/dist/integration-engine/ropid-gtfs/data-access/RopidGtfsRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js +0 -1
- package/dist/integration-engine/ropid-gtfs/workers/timetables/tasks/RefreshPrecomputedTablesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/Di.js +0 -8
- package/dist/integration-engine/vehicle-positions/ioc/Di.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.d.ts +0 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js +0 -3
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/interfaces/AlertsInterfaces.d.ts +1 -11
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/interfaces/AlertsInterfaces.js +0 -8
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/interfaces/AlertsInterfaces.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.d.ts +1 -4
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js +7 -29
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/tasks/GenerateFilesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
- package/dist/output-gateway/jis/data-access/JISEventsRepository.js +0 -1
- package/dist/output-gateway/jis/data-access/JISEventsRepository.js.map +1 -1
- package/dist/{helpers/jis → output-gateway/pid/helpers}/JISInfotextStopSuppressionFilter.d.ts +2 -2
- package/dist/{helpers/jis → output-gateway/pid/helpers}/JISInfotextStopSuppressionFilter.js +18 -18
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -0
- package/dist/output-gateway/pid/ioc/Di.js +1 -1
- package/dist/output-gateway/pid/ioc/Di.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js +0 -1
- package/dist/output-gateway/vehicle-positions/routers/v2/V2VehiclePositionsRouter.js.map +1 -1
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.js +0 -2
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.js.map +1 -1
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotext.d.ts +0 -1
- package/dist/schema-definitions/jis/models/JISInfotextsModel.d.ts +0 -1
- package/dist/schema-definitions/jis/models/JISInfotextsModel.js +0 -5
- package/dist/schema-definitions/jis/models/JISInfotextsModel.js.map +1 -1
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotext.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +0 -4
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +0 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +0 -4
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -1
- package/docs/cache/types/redis.md +0 -1
- package/docs/implementation_documentation.md +0 -41
- package/docs/openapi-input.yaml +0 -7
- package/docs/openapi-output.yaml +0 -24
- package/package.json +2 -2
- package/db/migrations/postgresql/20260611120000-jis-infotexts-event-id.js +0 -49
- package/db/migrations/postgresql/20260615120000-create-shapes-for-mvt-view.js +0 -53
- package/db/migrations/postgresql/20260617140000-add-assigned-stop-id-to-combined-stop-times.js +0 -49
- package/db/migrations/postgresql/sqls/20260611120000-jis-infotexts-event-id-down.sql +0 -2
- package/db/migrations/postgresql/sqls/20260611120000-jis-infotexts-event-id-up.sql +0 -2
- package/db/migrations/postgresql/sqls/20260615120000-create-shapes-for-mvt-view-down.sql +0 -2
- package/db/migrations/postgresql/sqls/20260615120000-create-shapes-for-mvt-view-up.sql +0 -27
- package/db/migrations/postgresql/sqls/20260617140000-add-assigned-stop-id-to-combined-stop-times-down.sql +0 -52
- package/db/migrations/postgresql/sqls/20260617140000-add-assigned-stop-id-to-combined-stop-times-up.sql +0 -60
- package/dist/helpers/jis/JISInfotextStopSuppressionFilter.js.map +0 -1
- package/dist/helpers/jis/getJISStopId.d.ts +0 -4
- package/dist/helpers/jis/getJISStopId.js +0 -7
- package/dist/helpers/jis/getJISStopId.js.map +0 -1
- package/dist/integration-engine/jis/transformations/JISInfotextCacheTransformation.js.map +0 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/DisplayAlertsGenerator.d.ts +0 -15
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/DisplayAlertsGenerator.js +0 -55
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/DisplayAlertsGenerator.js.map +0 -1
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/JISInfotextsGtfsRtTransformation.d.ts +0 -15
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/JISInfotextsGtfsRtTransformation.js +0 -58
- package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/JISInfotextsGtfsRtTransformation.js.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getJISStopId = getJISStopId;
|
|
4
|
-
function getJISStopId(stop) {
|
|
5
|
-
return typeof stop.getDataValue === "function" ? stop.getDataValue("stop_id") : stop.stop_id;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=getJISStopId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getJISStopId.js","sourceRoot":"","sources":["../../../src/helpers/jis/getJISStopId.ts"],"names":[],"mappings":";;AAAA,oCAEC;AAFD,SAAgB,YAAY,CAAC,IAA8D;IACvF,OAAO,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAE,IAAI,CAAC,YAAY,CAAC,SAAS,CAAY,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;AAC7G,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextCacheTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/transformations/JISInfotextCacheTransformation.ts"],"names":[],"mappings":";;;;;;;;;AAEA,6GAA0G;AAC1G,iEAAgE;AAGzD,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,+CAA0D;IAAvG;;QACI,SAAI,GAAG,gCAAgC,CAAC;QAErC,sBAAiB,GAAG,CAAC,IAAuB,EAAmB,EAAE;YACvE,OAAO;gBACH,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE;gBAC3D,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,WAAW,EAAE,IAAI,IAAI;gBAChE,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,KAAK;gBAC5C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,IAAI;gBACjD,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,IAAI;gBAC7C,gBAAgB,EAAE;oBACd,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE;oBAC5B,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,IAAI,IAAI;iBACvC;gBACD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE;gBACvD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE;gBACvD,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE;aACtE,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;AAtBY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,qBAAU,GAAE;GACA,8BAA8B,CAsB1C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { JISEventsRepository } from "../../../../jis/repositories/JISEventsRepository";
|
|
2
|
-
import { JISInfotextsRepository } from "../../../../jis/repositories/JISInfotextsRepository";
|
|
3
|
-
import { ILogger } from "@golemio/core/dist/helpers/logger";
|
|
4
|
-
import { GtfsRtRedisRepository } from "../data-access/GtfsRtRedisRepository";
|
|
5
|
-
import { IFeedHeader } from "../interfaces/GtfsRealtimeInterfaces";
|
|
6
|
-
export declare class DisplayAlertsGenerator {
|
|
7
|
-
private readonly gtfsRtRedisRepository;
|
|
8
|
-
private readonly jisInfotextsRepository;
|
|
9
|
-
private readonly jisEventsRepository;
|
|
10
|
-
private readonly logger;
|
|
11
|
-
private readonly transformation;
|
|
12
|
-
private readonly suppressionFilter;
|
|
13
|
-
constructor(gtfsRtRedisRepository: GtfsRtRedisRepository, jisInfotextsRepository: JISInfotextsRepository, jisEventsRepository: JISEventsRepository, logger: ILogger);
|
|
14
|
-
generateDisplayAlerts(feedHeader: IFeedHeader): Promise<void>;
|
|
15
|
-
}
|
package/dist/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/DisplayAlertsGenerator.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DisplayAlertsGenerator = void 0;
|
|
4
|
-
const JISInfotextStopSuppressionFilter_1 = require("../../../../../helpers/jis/JISInfotextStopSuppressionFilter");
|
|
5
|
-
const getJISStopId_1 = require("../../../../../helpers/jis/getJISStopId");
|
|
6
|
-
const DateTimeUtils_1 = require("../../../../../helpers/DateTimeUtils");
|
|
7
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
8
|
-
const ovapi_gtfs_realtime_bindings_1 = require("@golemio/ovapi-gtfs-realtime-bindings");
|
|
9
|
-
const JISInfotextsGtfsRtTransformation_1 = require("../transformations/JISInfotextsGtfsRtTransformation");
|
|
10
|
-
class DisplayAlertsGenerator {
|
|
11
|
-
constructor(gtfsRtRedisRepository, jisInfotextsRepository, jisEventsRepository, logger) {
|
|
12
|
-
this.gtfsRtRedisRepository = gtfsRtRedisRepository;
|
|
13
|
-
this.jisInfotextsRepository = jisInfotextsRepository;
|
|
14
|
-
this.jisEventsRepository = jisEventsRepository;
|
|
15
|
-
this.logger = logger;
|
|
16
|
-
this.transformation = new JISInfotextsGtfsRtTransformation_1.JISInfotextsGtfsRtTransformation();
|
|
17
|
-
this.suppressionFilter = new JISInfotextStopSuppressionFilter_1.JISInfotextStopSuppressionFilter();
|
|
18
|
-
}
|
|
19
|
-
async generateDisplayAlerts(feedHeader) {
|
|
20
|
-
const feedMessage = ovapi_gtfs_realtime_bindings_1.transit_realtime.FeedMessage.create({ header: feedHeader });
|
|
21
|
-
const now = feedHeader.timestamp ? new Date(feedHeader.timestamp * 1000) : new Date();
|
|
22
|
-
const activeInfotexts = await this.jisInfotextsRepository.findAllActive(now);
|
|
23
|
-
const currentTime = DateTimeUtils_1.DateTimeUtils.toLocalTimeFormat(now);
|
|
24
|
-
const windowFilteredInfotexts = activeInfotexts.filter((infotext) => {
|
|
25
|
-
if (!infotext.repeat_enabled)
|
|
26
|
-
return true;
|
|
27
|
-
return DateTimeUtils_1.DateTimeUtils.isInRepeatTimeWindow(infotext.repeat_time_start, infotext.repeat_time_end, currentTime);
|
|
28
|
-
});
|
|
29
|
-
const filteredInfotexts = this.suppressionFilter.filterInfotexts(windowFilteredInfotexts, { includeFuture: false });
|
|
30
|
-
const eventIds = [...new Set(filteredInfotexts.map((infotext) => infotext.jis_event_id))];
|
|
31
|
-
const eventsMap = await this.jisEventsRepository.findByIds(eventIds);
|
|
32
|
-
const infotextsWithResolvedEvent = filteredInfotexts.filter((infotext) => eventsMap.has(infotext.jis_event_id));
|
|
33
|
-
const inputs = infotextsWithResolvedEvent.map((infotext) => {
|
|
34
|
-
const event = eventsMap.get(infotext.jis_event_id);
|
|
35
|
-
const stopIds = (infotext.stops ?? []).map((stop) => (0, getJISStopId_1.getJISStopId)(stop));
|
|
36
|
-
return { infotext, stopIds, event };
|
|
37
|
-
});
|
|
38
|
-
const alerts = this.transformation.transformArray(inputs);
|
|
39
|
-
for (const alert of alerts) {
|
|
40
|
-
feedMessage.entity.push(ovapi_gtfs_realtime_bindings_1.transit_realtime.FeedEntity.fromObject(alert));
|
|
41
|
-
}
|
|
42
|
-
const verificationResult = ovapi_gtfs_realtime_bindings_1.transit_realtime.FeedMessage.verify(feedMessage);
|
|
43
|
-
if (verificationResult !== null) {
|
|
44
|
-
this.logger.error(new golemio_errors_1.GeneralError("Invalid GTFS-RT message for feed 'pid_display_alerts'", this.constructor.name, verificationResult, undefined, "pid"));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const buffer = ovapi_gtfs_realtime_bindings_1.transit_realtime.FeedMessage.encode(feedMessage).finish();
|
|
48
|
-
await Promise.all([
|
|
49
|
-
this.gtfsRtRedisRepository.set("pid_display_alerts_timestamp", feedMessage.header.timestamp),
|
|
50
|
-
this.gtfsRtRedisRepository.hset("pid_display_alerts.pb", buffer.toString("binary")),
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.DisplayAlertsGenerator = DisplayAlertsGenerator;
|
|
55
|
-
//# sourceMappingURL=DisplayAlertsGenerator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayAlertsGenerator.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/gtfs-rt/helpers/DisplayAlertsGenerator.ts"],"names":[],"mappings":";;;AAAA,kHAAiG;AACjG,0EAAyD;AACzD,wEAAuD;AAIvD,6EAAwE;AACxE,wFAAyF;AAGzF,0GAAuG;AAEvG,MAAa,sBAAsB;IAI/B,YACqB,qBAA4C,EAC5C,sBAA8C,EAC9C,mBAAwC,EACxC,MAAe;QAHf,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,WAAM,GAAN,MAAM,CAAS;QAEhC,IAAI,CAAC,cAAc,GAAG,IAAI,mEAAgC,EAAE,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,IAAI,mEAAgC,EAAE,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,UAAuB;QACtD,MAAM,WAAW,GAAG,+CAAY,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QAE5E,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAE,UAAU,CAAC,SAAoB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QAElG,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAE7E,MAAM,WAAW,GAAG,6BAAa,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,uBAAuB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAA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,MAAM,EAAE,CAAC;YACzB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,+CAAY,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,kBAAkB,GAAG,+CAAY,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACxE,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,IAAI,6BAAY,CACZ,uDAAuD,EACvD,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,kBAAkB,EAClB,SAAS,EACT,KAAK,CACR,CACJ,CAAC;YACF,OAAO;QACX,CAAC;QAED,MAAM,MAAM,GAAG,+CAAY,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,EAAY,CAAC;QAC/E,MAAM,OAAO,CAAC,GAAG,CAAC;YACd,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,8BAA8B,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC;YAC5F,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACtF,CAAC,CAAC;IACP,CAAC;CACJ;AA/DD,wDA+DC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IGtfsRtAlert } from "../interfaces/AlertsInterfaces";
|
|
2
|
-
import { JISEventsModel } from "../../../../../schema-definitions/jis/models/JISEventsModel";
|
|
3
|
-
import { JISInfotextsModel } from "../../../../../schema-definitions/jis/models/JISInfotextsModel";
|
|
4
|
-
import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
|
|
5
|
-
type TransformInput = {
|
|
6
|
-
infotext: JISInfotextsModel;
|
|
7
|
-
stopIds: string[];
|
|
8
|
-
event: JISEventsModel | undefined;
|
|
9
|
-
};
|
|
10
|
-
export declare class JISInfotextsGtfsRtTransformation extends AbstractTransformation<TransformInput, IGtfsRtAlert> {
|
|
11
|
-
name: string;
|
|
12
|
-
protected transformInternal: ({ infotext, stopIds, event }: TransformInput) => IGtfsRtAlert;
|
|
13
|
-
private static buildTranslations;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JISInfotextsGtfsRtTransformation = void 0;
|
|
4
|
-
const JISEventEffectHelper_1 = require("../../../../../helpers/jis/JISEventEffectHelper");
|
|
5
|
-
const AlertsInterfaces_1 = require("../interfaces/AlertsInterfaces");
|
|
6
|
-
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
|
|
7
|
-
const PID_WEB_EVENTS_URL = "https://pid.cz/mimoradnost/?uuid=";
|
|
8
|
-
class JISInfotextsGtfsRtTransformation extends AbstractTransformation_1.AbstractTransformation {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.name = "JISInfotextsGtfsRtTransformation";
|
|
12
|
-
this.transformInternal = ({ infotext, stopIds, event }) => {
|
|
13
|
-
const severityLevel = infotext.display_type === "INLINE" ? AlertsInterfaces_1.GtfsAlertSeverityLevelEnum.WARNING : AlertsInterfaces_1.GtfsAlertSeverityLevelEnum.SEVERE;
|
|
14
|
-
const eventCsUrl = event?.url?.cs !== "nevyplněno" ? event?.url?.cs : `${PID_WEB_EVENTS_URL}${event.id}`;
|
|
15
|
-
return {
|
|
16
|
-
id: `alert-${infotext.id}`,
|
|
17
|
-
alert: {
|
|
18
|
-
activePeriod: [
|
|
19
|
-
{
|
|
20
|
-
start: Math.round(new Date(infotext.active_period_start).getTime() / 1000),
|
|
21
|
-
...(infotext.active_period_end
|
|
22
|
-
? { end: Math.round(new Date(infotext.active_period_end).getTime() / 1000) }
|
|
23
|
-
: {}),
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
informedEntity: stopIds.map((stopId) => ({ stopId })),
|
|
27
|
-
cause: (event?.cause ?? "UNKNOWN_CAUSE"),
|
|
28
|
-
causeDetail: {
|
|
29
|
-
translation: JISInfotextsGtfsRtTransformation.buildTranslations(event?.cause_detail?.cs, event?.cause_detail?.en),
|
|
30
|
-
},
|
|
31
|
-
effect: (event ? JISEventEffectHelper_1.JISEventEffectHelper.getMainEffect(event.effect) : "UNKNOWN_EFFECT"),
|
|
32
|
-
severityLevel,
|
|
33
|
-
url: {
|
|
34
|
-
translation: event
|
|
35
|
-
? JISInfotextsGtfsRtTransformation.buildTranslations(eventCsUrl, event.url?.en ?? null)
|
|
36
|
-
: [],
|
|
37
|
-
},
|
|
38
|
-
headerText: {
|
|
39
|
-
translation: JISInfotextsGtfsRtTransformation.buildTranslations(event?.header_text?.cs, event?.header_text?.en),
|
|
40
|
-
},
|
|
41
|
-
descriptionText: {
|
|
42
|
-
translation: JISInfotextsGtfsRtTransformation.buildTranslations(infotext.description_text.cs, infotext.description_text.en ?? null),
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
static buildTranslations(cs, en) {
|
|
49
|
-
const result = [];
|
|
50
|
-
if (cs)
|
|
51
|
-
result.push({ text: cs, language: "cs" });
|
|
52
|
-
if (en)
|
|
53
|
-
result.push({ text: en, language: "en" });
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.JISInfotextsGtfsRtTransformation = JISInfotextsGtfsRtTransformation;
|
|
58
|
-
//# sourceMappingURL=JISInfotextsGtfsRtTransformation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextsGtfsRtTransformation.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/gtfs-rt/transformations/JISInfotextsGtfsRtTransformation.ts"],"names":[],"mappings":";;;AAAA,0FAAyE;AAGzE,qEAI2E;A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