@golemio/pid 2.11.6-dev.1157246600 → 2.11.6-dev.1157542305
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/17_blocked_trains.sql +5 -8
- package/db/example/redis/publicVehiclePositionsMock.json +26 -8
- package/db/migrations/postgresql/20240122141600-public-api-detailed-endpoint.js +53 -0
- package/db/migrations/postgresql/sqls/20240122141600-public-api-detailed-endpoint-down.sql +16 -0
- package/db/migrations/postgresql/sqls/20240122141600-public-api-detailed-endpoint-up.sql +137 -0
- package/dist/integration-engine/ioc/Di.d.ts +2 -1
- package/dist/integration-engine/ioc/Di.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSTripsModel.js +1 -1
- package/dist/integration-engine/ropid-gtfs/RopidGTFSTripsModel.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.d.ts +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js +27 -1
- package/dist/integration-engine/ropid-gtfs/data-access/cache/DelayComputationRedisRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js +4 -2
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/interfaces/TripModelInterfaces.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/ioc/Di.js +8 -2
- package/dist/integration-engine/vehicle-positions/ioc/Di.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.d.ts +4 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js +4 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/VPWorker.js +2 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/VPWorker.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js +13 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js +2 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicApiCacheRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.d.ts +7 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js +70 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.js +7 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/interfaces/TripRepositoryInterfaces.d.ts +13 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.d.ts +9 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.js +54 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/views/PublicStopTimeRepository.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.d.ts +2 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +9 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/interfaces/VPInterfaces.d.ts +2 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.d.ts +4 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js +14 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.d.ts +19 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +117 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/{RefreshPublicCacheTask.d.ts → RefreshPublicTripCacheTask.d.ts} +3 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/{RefreshPublicCacheTask.js → RefreshPublicTripCacheTask.js} +15 -15
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicTripCacheTask.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.d.ts +4 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +14 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.d.ts +2 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js +21 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PublicApiTripTransformation.js.map +1 -1
- package/dist/output-gateway/pid/PIDRouter.d.ts +1 -1
- package/dist/output-gateway/pid/PIDRouter.js +1 -1
- package/dist/output-gateway/pid/PIDRouter.js.map +1 -1
- package/dist/output-gateway/public/controllers/v1/PublicVehiclePositionsController.d.ts +6 -5
- package/dist/output-gateway/public/controllers/v1/PublicVehiclePositionsController.js +22 -3
- package/dist/output-gateway/public/controllers/v1/PublicVehiclePositionsController.js.map +1 -1
- package/dist/output-gateway/public/controllers/v1/interfaces/PublicParamsInterfaces.d.ts +12 -0
- package/dist/output-gateway/public/controllers/v1/interfaces/PublicParamsInterfaces.js +3 -0
- package/dist/output-gateway/public/controllers/v1/interfaces/PublicParamsInterfaces.js.map +1 -0
- package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.d.ts +13 -0
- package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.js +71 -0
- package/dist/output-gateway/public/data-access/VehicleDescriptorCachedRepository.js.map +1 -0
- package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.d.ts +10 -0
- package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.js +68 -0
- package/dist/output-gateway/public/data-access/redis/DelayComputationRepository.js.map +1 -0
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.d.ts +10 -0
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js +68 -0
- package/dist/output-gateway/public/data-access/redis/PublicStopTimeRepository.js.map +1 -0
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.d.ts +3 -1
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js +64 -7
- package/dist/output-gateway/public/data-access/redis/PublicVehiclePositionsRepository.js.map +1 -1
- package/dist/output-gateway/public/domain/PublicApiDetailedTripInterfaces.d.ts +48 -0
- package/dist/output-gateway/public/domain/PublicApiDetailedTripInterfaces.js +3 -0
- package/dist/output-gateway/public/domain/PublicApiDetailedTripInterfaces.js.map +1 -0
- package/dist/output-gateway/public/domain/repository/IDelayComputationRepository.d.ts +4 -0
- package/dist/output-gateway/public/domain/repository/IDelayComputationRepository.js +3 -0
- package/dist/output-gateway/public/domain/repository/IDelayComputationRepository.js.map +1 -0
- package/dist/output-gateway/public/domain/repository/IStopTimeRepository.d.ts +4 -0
- package/dist/output-gateway/public/domain/repository/IStopTimeRepository.js +3 -0
- package/dist/output-gateway/public/domain/repository/IStopTimeRepository.js.map +1 -0
- package/dist/output-gateway/public/domain/repository/IVehiclePositionsRepository.d.ts +3 -1
- package/dist/output-gateway/public/ioc/Di.js +20 -0
- package/dist/output-gateway/public/ioc/Di.js.map +1 -1
- package/dist/output-gateway/public/ioc/OgModuleToken.d.ts +8 -0
- package/dist/output-gateway/public/ioc/OgModuleToken.js +8 -0
- package/dist/output-gateway/public/ioc/OgModuleToken.js.map +1 -1
- package/dist/output-gateway/public/routers/v1/PublicRouter.d.ts +1 -1
- package/dist/output-gateway/public/routers/v1/PublicRouter.js +4 -2
- package/dist/output-gateway/public/routers/v1/PublicRouter.js.map +1 -1
- package/dist/output-gateway/public/routers/v1/helpers/CustomScopeValidator.d.ts +6 -0
- package/dist/output-gateway/public/routers/v1/helpers/CustomScopeValidator.js +26 -0
- package/dist/output-gateway/public/routers/v1/helpers/CustomScopeValidator.js.map +1 -0
- package/dist/output-gateway/public/routers/v1/helpers/DetailedTripScopeEnum.d.ts +6 -0
- package/dist/output-gateway/public/routers/v1/helpers/DetailedTripScopeEnum.js +11 -0
- package/dist/output-gateway/public/routers/v1/helpers/DetailedTripScopeEnum.js.map +1 -0
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.d.ts +8 -0
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.js +42 -0
- package/dist/output-gateway/public/service/facade/DetailedTripFacade.js.map +1 -0
- package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js +10 -1
- package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/TripScopeHelper.d.ts +6 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/TripScopeHelper.js +11 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/TripScopeHelper.js.map +1 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/AbstractTripScopeHandler.d.ts +5 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/AbstractTripScopeHandler.js +7 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/AbstractTripScopeHandler.js.map +1 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHelper.d.ts +8 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHelper.js +41 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHelper.js.map +1 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.d.ts +10 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.js +53 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.js.map +1 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHelper.d.ts +12 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHelper.js +77 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHelper.js.map +1 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/TripScopeHandlerFactory.d.ts +9 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/TripScopeHandlerFactory.js +30 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/TripScopeHandlerFactory.js.map +1 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHelper.d.ts +10 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHelper.js +54 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHelper.js.map +1 -0
- package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.d.ts +1 -1
- package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js +15 -3
- package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js.map +1 -1
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.d.ts +26 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.js +47 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripInfoTransformation.js.map +1 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripShapesTransformation.d.ts +7 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripShapesTransformation.js +21 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripShapesTransformation.js.map +1 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.d.ts +7 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.js +41 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPTripStopTimesTransformation.js.map +1 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPVehicleDescriptorTransformation.d.ts +14 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPVehicleDescriptorTransformation.js +22 -0
- package/dist/output-gateway/public/service/transformations/scopes/PublicVPVehicleDescriptorTransformation.js.map +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js +1 -0
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +3 -0
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +4 -0
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/redis/interfaces/IDelayComputationDto.d.ts +6 -0
- package/dist/schema-definitions/ropid-gtfs/redis/schemas/DelayComputationDtoSchema.js +19 -2
- package/dist/schema-definitions/ropid-gtfs/redis/schemas/DelayComputationDtoSchema.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +4 -0
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IVPTripsModel.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.d.ts +10 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js +33 -0
- package/dist/schema-definitions/vehicle-positions/models/views/PublicStopTimeModel.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/index.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/index.js +1 -0
- package/dist/schema-definitions/vehicle-positions/models/views/index.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.d.ts +6 -0
- package/dist/{output-gateway/public/controllers/v1/IParams.js → schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.js} +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/IPublicStopTimeDto.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/const.d.ts +2 -0
- package/dist/schema-definitions/vehicle-positions/redis/const.js +3 -1
- package/dist/schema-definitions/vehicle-positions/redis/const.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto.d.ts +13 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.d.ts +5 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.js +3 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IPublicStopTimeCacheDto.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/GtfsRunTripCacheDtoSchema.js +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/GtfsRunTripCacheDtoSchema.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js +49 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicApiCacheDtoSchema.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.d.ts +4 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js +41 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/PublicStopTimeCacheDtoSchema.js.map +1 -0
- package/docs/implementation_documentation.md +31 -4
- package/docs/openapi-input.yaml +4 -5
- package/docs/openapi-output.yaml +262 -3
- package/package.json +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicCacheTask.js.map +0 -1
- package/dist/output-gateway/public/controllers/v1/IParams.d.ts +0 -7
- package/dist/output-gateway/public/controllers/v1/IParams.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CustomValidator } from "@golemio/core/dist/shared/express-validator";
|
|
2
|
+
import { DetailedTripScope } from "./DetailedTripScopeEnum";
|
|
3
|
+
export declare class CustomScopeValidator {
|
|
4
|
+
static allowedScopes: DetailedTripScope[];
|
|
5
|
+
static validate: CustomValidator;
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var _a;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.CustomScopeValidator = void 0;
|
|
14
|
+
const DetailedTripScopeEnum_1 = require("./DetailedTripScopeEnum");
|
|
15
|
+
class CustomScopeValidator {
|
|
16
|
+
}
|
|
17
|
+
exports.CustomScopeValidator = CustomScopeValidator;
|
|
18
|
+
_a = CustomScopeValidator;
|
|
19
|
+
CustomScopeValidator.allowedScopes = Object.values(DetailedTripScopeEnum_1.DetailedTripScope);
|
|
20
|
+
CustomScopeValidator.validate = (value, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
if (value instanceof Array) {
|
|
22
|
+
return value.every((scope) => _a.allowedScopes.includes(scope));
|
|
23
|
+
}
|
|
24
|
+
return _a.allowedScopes.includes(value);
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=CustomScopeValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomScopeValidator.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/routers/v1/helpers/CustomScopeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,mEAA4D;AAE5D,MAAa,oBAAoB;;AAAjC,oDAUC;;AATiB,kCAAa,GAAG,MAAM,CAAC,MAAM,CAAC,yCAAiB,CAAC,AAAnC,CAAoC;AAEjD,6BAAQ,GAAoB,CAAO,KAAK,EAAE,OAAO,EAAE,EAAE;IAC/D,IAAI,KAAK,YAAY,KAAK,EAAE;QACxB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;KACrE;IAED,OAAO,EAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAA,AANqB,CAMpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DetailedTripScope = void 0;
|
|
4
|
+
var DetailedTripScope;
|
|
5
|
+
(function (DetailedTripScope) {
|
|
6
|
+
DetailedTripScope["Info"] = "info";
|
|
7
|
+
DetailedTripScope["StopTimes"] = "stop_times";
|
|
8
|
+
DetailedTripScope["Shapes"] = "shapes";
|
|
9
|
+
DetailedTripScope["VehicleDescriptor"] = "vehicle_descriptor";
|
|
10
|
+
})(DetailedTripScope || (exports.DetailedTripScope = DetailedTripScope = {}));
|
|
11
|
+
//# sourceMappingURL=DetailedTripScopeEnum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailedTripScopeEnum.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/routers/v1/helpers/DetailedTripScopeEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAKX;AALD,WAAY,iBAAiB;IACzB,kCAAa,CAAA;IACb,6CAAwB,CAAA;IACxB,sCAAiB,CAAA;IACjB,6DAAwC,CAAA;AAC5C,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IPublicApiDetailedTrip } from "../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { IVehiclePositionsRepository } from "../../domain/repository/IVehiclePositionsRepository";
|
|
3
|
+
import { DetailedTripScope } from "../../routers/v1/helpers/DetailedTripScopeEnum";
|
|
4
|
+
export declare class DetailedTripFacade {
|
|
5
|
+
private vehiclePositionRepository;
|
|
6
|
+
constructor(vehiclePositionRepository: IVehiclePositionsRepository);
|
|
7
|
+
getOneByVehicleId(vehicleId: string, scopes: DetailedTripScope[]): Promise<IPublicApiDetailedTrip>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.DetailedTripFacade = void 0;
|
|
13
|
+
const DetailedTripScopeEnum_1 = require("../../routers/v1/helpers/DetailedTripScopeEnum");
|
|
14
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
15
|
+
const TripScopeHelper_1 = require("../helpers/trip-scope/TripScopeHelper");
|
|
16
|
+
class DetailedTripFacade {
|
|
17
|
+
constructor(vehiclePositionRepository) {
|
|
18
|
+
this.vehiclePositionRepository = vehiclePositionRepository;
|
|
19
|
+
}
|
|
20
|
+
getOneByVehicleId(vehicleId, scopes) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const vehiclePosition = yield this.vehiclePositionRepository.getDetailedVehiclePosition(vehicleId);
|
|
23
|
+
if (!vehiclePosition) {
|
|
24
|
+
throw new golemio_errors_1.GeneralError("not_found", this.constructor.name, undefined, 404);
|
|
25
|
+
}
|
|
26
|
+
let output = {};
|
|
27
|
+
if (scopes.includes(DetailedTripScopeEnum_1.DetailedTripScope.Info)) {
|
|
28
|
+
output = yield TripScopeHelper_1.TripScopeHelper.handle(DetailedTripScopeEnum_1.DetailedTripScope.Info, output, vehiclePosition);
|
|
29
|
+
}
|
|
30
|
+
const promises = scopes.map((scope) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (scope === DetailedTripScopeEnum_1.DetailedTripScope.Info) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
output = yield TripScopeHelper_1.TripScopeHelper.handle(scope, output, vehiclePosition);
|
|
35
|
+
}));
|
|
36
|
+
yield Promise.all(promises);
|
|
37
|
+
return output;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.DetailedTripFacade = DetailedTripFacade;
|
|
42
|
+
//# sourceMappingURL=DetailedTripFacade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailedTripFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/DetailedTripFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,0FAAwF;AACxF,6EAAwE;AACxE,2EAAwE;AAExE,MAAa,kBAAkB;IAC3B,YAAoB,yBAAsD;QAAtD,8BAAyB,GAAzB,yBAAyB,CAA6B;IAAG,CAAC;IAEjE,iBAAiB,CAAC,SAAiB,EAAE,MAA2B;;YACzE,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;YACnG,IAAI,CAAC,eAAe,EAAE;gBAClB,MAAM,IAAI,6BAAY,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;aAC9E;YAED,IAAI,MAAM,GAA2B,EAAE,CAAC;YACxC,IAAI,MAAM,CAAC,QAAQ,CAAC,yCAAiB,CAAC,IAAI,CAAC,EAAE;gBACzC,MAAM,GAAG,MAAM,iCAAe,CAAC,MAAM,CAAC,yCAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;aAC1F;YAED,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAO,KAAK,EAAE,EAAE;gBACxC,IAAI,KAAK,KAAK,yCAAiB,CAAC,IAAI,EAAE;oBAClC,OAAO;iBACV;gBAED,MAAM,GAAG,MAAM,iCAAe,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;YAC1E,CAAC,CAAA,CAAC,CAAC;YAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5B,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AAzBD,gDAyBC"}
|
|
@@ -23,8 +23,17 @@ class PublicVehiclePositionsFacade {
|
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
const boundingBoxWithCenter = this.boundingBoxHelper.mapToCenterFormat(boundingBox);
|
|
25
25
|
this.log.debug(`width: ${boundingBoxWithCenter.width}m, height: ${boundingBoxWithCenter.height}m`);
|
|
26
|
-
const
|
|
26
|
+
const vehicleIds = yield this.repository.getAllVehicleIds(boundingBoxWithCenter);
|
|
27
|
+
if (vehicleIds.length === 0) {
|
|
28
|
+
this.log.debug("No vehicle ids found.");
|
|
29
|
+
return (0, output_gateway_1.buildGeojsonFeatureCollection)([]);
|
|
30
|
+
}
|
|
31
|
+
const vehiclePositions = yield this.repository.getAllVehiclePositions(vehicleIds);
|
|
27
32
|
const filteredResults = vehiclePositions.filter((el) => this.filterClientSide(el, routeShortName, type));
|
|
33
|
+
if (filteredResults.length === 0) {
|
|
34
|
+
this.log.debug("No vehicle positions found.");
|
|
35
|
+
return (0, output_gateway_1.buildGeojsonFeatureCollection)([]);
|
|
36
|
+
}
|
|
28
37
|
return (0, output_gateway_1.buildGeojsonFeatureCollection)(this.transformation.transformArray(filteredResults));
|
|
29
38
|
});
|
|
30
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VehiclePositionsFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/VehiclePositionsFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,sEAA6G;AAE7G,kHAA+G;AAE/G,MAAa,4BAA4B;IAGrC,YACY,UAAuC,EACvC,iBAAqC,EACrC,GAAY;QAFZ,eAAU,GAAV,UAAU,CAA6B;QACvC,sBAAiB,GAAjB,iBAAiB,CAAoB;QACrC,QAAG,GAAH,GAAG,CAAS;QAEpB,IAAI,CAAC,cAAc,GAAG,IAAI,2EAAoC,EAAE,CAAC;IACrE,CAAC;IAEY,MAAM,CACf,WAAyB,EACzB,cAAkC,EAClC,IAAqC;;YAErC,MAAM,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;YACpF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,qBAAqB,CAAC,KAAK,cAAc,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;YAEnG,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"VehiclePositionsFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/VehiclePositionsFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,sEAA6G;AAE7G,kHAA+G;AAE/G,MAAa,4BAA4B;IAGrC,YACY,UAAuC,EACvC,iBAAqC,EACrC,GAAY;QAFZ,eAAU,GAAV,UAAU,CAA6B;QACvC,sBAAiB,GAAjB,iBAAiB,CAAoB;QACrC,QAAG,GAAH,GAAG,CAAS;QAEpB,IAAI,CAAC,cAAc,GAAG,IAAI,2EAAoC,EAAE,CAAC;IACrE,CAAC;IAEY,MAAM,CACf,WAAyB,EACzB,cAAkC,EAClC,IAAqC;;YAErC,MAAM,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;YACpF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,qBAAqB,CAAC,KAAK,cAAc,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;YAEnG,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YACjF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;gBACxC,OAAO,IAAA,8CAA6B,EAAC,EAAE,CAAC,CAAC;aAC5C;YAED,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;YAClF,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;YACzG,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC9B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;gBAC9C,OAAO,IAAA,8CAA6B,EAAC,EAAE,CAAC,CAAC;aAC5C;YAED,OAAO,IAAA,8CAA6B,EAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;QAC9F,CAAC;KAAA;IAEO,gBAAgB,CACpB,EAAsB,EACtB,cAAkC,EAClC,KAAsC;QAEtC,IAAI,cAAc,IAAI,EAAE,CAAC,qBAAqB,KAAK,cAAc,EAAE;YAC/D,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE;YACxD,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlDD,oEAkDC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IPublicApiDetailedTrip } from "../../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { DetailedTripScope } from "../../../routers/v1/helpers/DetailedTripScopeEnum";
|
|
3
|
+
import { IPublicApiCacheDto } from "../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
4
|
+
export declare class TripScopeHelper {
|
|
5
|
+
static handle(scope: DetailedTripScope, output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TripScopeHelper = void 0;
|
|
4
|
+
const TripScopeHandlerFactory_1 = require("./strategy/TripScopeHandlerFactory");
|
|
5
|
+
class TripScopeHelper {
|
|
6
|
+
static handle(scope, output, vehiclePosition) {
|
|
7
|
+
return TripScopeHandlerFactory_1.TripScopeHandlerFactory.getInstance().getStrategy(scope).handle(output, vehiclePosition);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.TripScopeHelper = TripScopeHelper;
|
|
11
|
+
//# sourceMappingURL=TripScopeHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TripScopeHelper.js","sourceRoot":"","sources":["../../../../../../src/output-gateway/public/service/helpers/trip-scope/TripScopeHelper.ts"],"names":[],"mappings":";;;AAGA,gFAA6E;AAE7E,MAAa,eAAe;IACjB,MAAM,CAAC,MAAM,CAChB,KAAwB,EACxB,MAA8B,EAC9B,eAAmC;QAEnC,OAAO,iDAAuB,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACpG,CAAC;CACJ;AARD,0CAQC"}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/AbstractTripScopeHandler.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IPublicApiDetailedTrip } from "../../../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { IPublicApiCacheDto } from "../../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
3
|
+
export declare abstract class AbstractTripScopeHandler {
|
|
4
|
+
abstract handle(output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
5
|
+
}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/AbstractTripScopeHandler.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractTripScopeHandler = void 0;
|
|
4
|
+
class AbstractTripScopeHandler {
|
|
5
|
+
}
|
|
6
|
+
exports.AbstractTripScopeHandler = AbstractTripScopeHandler;
|
|
7
|
+
//# sourceMappingURL=AbstractTripScopeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractTripScopeHandler.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/AbstractTripScopeHandler.ts"],"names":[],"mappings":";;;AAGA,MAAsB,wBAAwB;CAE7C;AAFD,4DAEC"}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHelper.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IPublicApiDetailedTrip } from "../../../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { IPublicApiCacheDto } from "../../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
3
|
+
import { AbstractTripScopeHandler } from "./AbstractTripScopeHandler";
|
|
4
|
+
export declare class InfoTripScopeHelper extends AbstractTripScopeHandler {
|
|
5
|
+
private tripInfoTransformation;
|
|
6
|
+
constructor();
|
|
7
|
+
handle(output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.InfoTripScopeHelper = void 0;
|
|
22
|
+
const PublicVPTripInfoTransformation_1 = require("../../../transformations/scopes/PublicVPTripInfoTransformation");
|
|
23
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
24
|
+
const AbstractTripScopeHandler_1 = require("./AbstractTripScopeHandler");
|
|
25
|
+
let InfoTripScopeHelper = exports.InfoTripScopeHelper = class InfoTripScopeHelper extends AbstractTripScopeHandler_1.AbstractTripScopeHandler {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.tripInfoTransformation = new PublicVPTripInfoTransformation_1.PublicVPTripInfoTransformation();
|
|
29
|
+
}
|
|
30
|
+
handle(output, vehiclePosition) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
output = this.tripInfoTransformation.transformElement(vehiclePosition);
|
|
33
|
+
return output;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.InfoTripScopeHelper = InfoTripScopeHelper = __decorate([
|
|
38
|
+
(0, tsyringe_1.injectable)(),
|
|
39
|
+
__metadata("design:paramtypes", [])
|
|
40
|
+
], InfoTripScopeHelper);
|
|
41
|
+
//# sourceMappingURL=InfoTripScopeHelper.js.map
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHelper.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoTripScopeHelper.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/InfoTripScopeHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,mHAA0H;AAE1H,iEAAgE;AAChE,yEAAsE;AAG/D,IAAM,mBAAmB,iCAAzB,MAAM,mBAAoB,SAAQ,mDAAwB;IAG7D;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,sBAAsB,GAAG,IAAI,+DAA8B,EAAE,CAAC;IACvE,CAAC;IAEY,MAAM,CAAC,MAA8B,EAAE,eAAmC;;YACnF,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;YACvE,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ,CAAA;8BAZY,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;;GACA,mBAAmB,CAY/B"}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IPublicApiDetailedTrip } from "../../../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { IDelayComputationRepository } from "../../../../domain/repository/IDelayComputationRepository";
|
|
3
|
+
import { IPublicApiCacheDto } from "../../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
4
|
+
import { AbstractTripScopeHandler } from "./AbstractTripScopeHandler";
|
|
5
|
+
export declare class ShapesTripScopeHelper extends AbstractTripScopeHandler {
|
|
6
|
+
private delayComputationRepository;
|
|
7
|
+
private tripShapesTransformation;
|
|
8
|
+
constructor(delayComputationRepository: IDelayComputationRepository);
|
|
9
|
+
handle(output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
10
|
+
}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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.ShapesTripScopeHelper = void 0;
|
|
25
|
+
const OgModuleToken_1 = require("../../../../ioc/OgModuleToken");
|
|
26
|
+
const PublicVPTripShapesTransformation_1 = require("../../../transformations/scopes/PublicVPTripShapesTransformation");
|
|
27
|
+
const Geo_1 = require("@golemio/core/dist/output-gateway/Geo");
|
|
28
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
29
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
30
|
+
const AbstractTripScopeHandler_1 = require("./AbstractTripScopeHandler");
|
|
31
|
+
let ShapesTripScopeHelper = exports.ShapesTripScopeHelper = class ShapesTripScopeHelper extends AbstractTripScopeHandler_1.AbstractTripScopeHandler {
|
|
32
|
+
constructor(delayComputationRepository) {
|
|
33
|
+
super();
|
|
34
|
+
this.delayComputationRepository = delayComputationRepository;
|
|
35
|
+
this.tripShapesTransformation = new PublicVPTripShapesTransformation_1.PublicVPTripShapesTransformation();
|
|
36
|
+
}
|
|
37
|
+
handle(output, vehiclePosition) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const delayComputationCache = yield this.delayComputationRepository.getDelayComputationCache(vehiclePosition.gtfs_trip_id);
|
|
40
|
+
if (!delayComputationCache) {
|
|
41
|
+
throw new golemio_errors_1.GeneralError("delay_computation_cache_not_found", this.constructor.name, undefined, 500);
|
|
42
|
+
}
|
|
43
|
+
output.shapes = (0, Geo_1.buildGeojsonFeatureCollection)(delayComputationCache.shapes ? this.tripShapesTransformation.transformArray(delayComputationCache.shapes) : []);
|
|
44
|
+
return output;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.ShapesTripScopeHelper = ShapesTripScopeHelper = __decorate([
|
|
49
|
+
(0, tsyringe_1.injectable)(),
|
|
50
|
+
__param(0, (0, tsyringe_1.inject)(OgModuleToken_1.OgModuleToken.DelayComputationRepository)),
|
|
51
|
+
__metadata("design:paramtypes", [Object])
|
|
52
|
+
], ShapesTripScopeHelper);
|
|
53
|
+
//# sourceMappingURL=ShapesTripScopeHelper.js.map
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShapesTripScopeHelper.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/ShapesTripScopeHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,iEAA6D;AAC7D,uHAA8H;AAE9H,+DAAsF;AACtF,6EAAwE;AACxE,iEAAwE;AACxE,yEAAsE;AAG/D,IAAM,qBAAqB,mCAA3B,MAAM,qBAAsB,SAAQ,mDAAwB;IAG/D,YAC8D,0BAAuD;QAEjH,KAAK,EAAE,CAAC;QAFkD,+BAA0B,GAA1B,0BAA0B,CAA6B;QAGjH,IAAI,CAAC,wBAAwB,GAAG,IAAI,mEAAgC,EAAE,CAAC;IAC3E,CAAC;IAEY,MAAM,CAAC,MAA8B,EAAE,eAAmC;;YACnF,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,wBAAwB,CACxF,eAAe,CAAC,YAAY,CAC/B,CAAC;YAEF,IAAI,CAAC,qBAAqB,EAAE;gBACxB,MAAM,IAAI,6BAAY,CAAC,mCAAmC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;aACtG;YAED,MAAM,CAAC,MAAM,GAAG,IAAA,mCAA6B,EACzC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CACjH,CAAC;YAEF,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ,CAAA;gCAzBY,qBAAqB;IADjC,IAAA,qBAAU,GAAE;IAKJ,WAAA,IAAA,iBAAM,EAAC,6BAAa,CAAC,0BAA0B,CAAC,CAAA;;GAJ5C,qBAAqB,CAyBjC"}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHelper.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IPublicApiDetailedTrip } from "../../../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { IDelayComputationRepository } from "../../../../domain/repository/IDelayComputationRepository";
|
|
3
|
+
import { IStopTimeRepository } from "../../../../domain/repository/IStopTimeRepository";
|
|
4
|
+
import { IPublicApiCacheDto } from "../../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
5
|
+
import { AbstractTripScopeHandler } from "./AbstractTripScopeHandler";
|
|
6
|
+
export declare class StopTimesTripScopeHelper extends AbstractTripScopeHandler {
|
|
7
|
+
private delayComputationRepository;
|
|
8
|
+
private stopTimeRepository;
|
|
9
|
+
private tripStopTimesTransformation;
|
|
10
|
+
constructor(delayComputationRepository: IDelayComputationRepository, stopTimeRepository: IStopTimeRepository);
|
|
11
|
+
handle(output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
12
|
+
}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHelper.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
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.StopTimesTripScopeHelper = void 0;
|
|
25
|
+
const OgModuleToken_1 = require("../../../../ioc/OgModuleToken");
|
|
26
|
+
const PublicVPTripStopTimesTransformation_1 = require("../../../transformations/scopes/PublicVPTripStopTimesTransformation");
|
|
27
|
+
const Geo_1 = require("@golemio/core/dist/output-gateway/Geo");
|
|
28
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
29
|
+
const luxon_1 = require("@golemio/core/dist/shared/luxon");
|
|
30
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
31
|
+
const AbstractTripScopeHandler_1 = require("./AbstractTripScopeHandler");
|
|
32
|
+
let StopTimesTripScopeHelper = exports.StopTimesTripScopeHelper = class StopTimesTripScopeHelper extends AbstractTripScopeHandler_1.AbstractTripScopeHandler {
|
|
33
|
+
constructor(delayComputationRepository, stopTimeRepository) {
|
|
34
|
+
super();
|
|
35
|
+
this.delayComputationRepository = delayComputationRepository;
|
|
36
|
+
this.stopTimeRepository = stopTimeRepository;
|
|
37
|
+
this.tripStopTimesTransformation = new PublicVPTripStopTimesTransformation_1.PublicVPTripStopTimesTransformation();
|
|
38
|
+
}
|
|
39
|
+
handle(output, vehiclePosition) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const delayComputationCache = yield this.delayComputationRepository.getDelayComputationCache(vehiclePosition.gtfs_trip_id);
|
|
42
|
+
if (!delayComputationCache) {
|
|
43
|
+
throw new golemio_errors_1.GeneralError("delay_computation_cache_not_found", this.constructor.name, undefined, 500);
|
|
44
|
+
}
|
|
45
|
+
const stopTimes = this.tripStopTimesTransformation.transformArray(delayComputationCache.stop_times);
|
|
46
|
+
const stopTimesWithDelay = yield this.stopTimeRepository.getPublicStopTimeCache(vehiclePosition.gtfs_trip_id);
|
|
47
|
+
if (stopTimesWithDelay.length > 0) {
|
|
48
|
+
for (const stopTimeWithDelay of stopTimesWithDelay) {
|
|
49
|
+
const stopTime = stopTimes[stopTimeWithDelay.sequence - 1];
|
|
50
|
+
if (stopTime) {
|
|
51
|
+
const rtArrivalTime = stopTimeWithDelay.arr_delay
|
|
52
|
+
? luxon_1.DateTime.fromFormat(stopTime.properties.arrival_time, "HH:mm:ss")
|
|
53
|
+
.plus({ seconds: stopTimeWithDelay.arr_delay })
|
|
54
|
+
.toFormat("HH:mm:ss")
|
|
55
|
+
: null;
|
|
56
|
+
const rtDepartureTime = stopTimeWithDelay.dep_delay
|
|
57
|
+
? luxon_1.DateTime.fromFormat(stopTime.properties.departure_time, "HH:mm:ss")
|
|
58
|
+
.plus({ seconds: stopTimeWithDelay.dep_delay })
|
|
59
|
+
.toFormat("HH:mm:ss")
|
|
60
|
+
: null;
|
|
61
|
+
stopTime.properties.realtime_arrival_time = rtArrivalTime;
|
|
62
|
+
stopTime.properties.realtime_departure_time = rtDepartureTime;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
output.stop_times = (0, Geo_1.buildGeojsonFeatureCollection)(stopTimes);
|
|
67
|
+
return output;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.StopTimesTripScopeHelper = StopTimesTripScopeHelper = __decorate([
|
|
72
|
+
(0, tsyringe_1.injectable)(),
|
|
73
|
+
__param(0, (0, tsyringe_1.inject)(OgModuleToken_1.OgModuleToken.DelayComputationRepository)),
|
|
74
|
+
__param(1, (0, tsyringe_1.inject)(OgModuleToken_1.OgModuleToken.PublicStopTimeRepository)),
|
|
75
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
76
|
+
], StopTimesTripScopeHelper);
|
|
77
|
+
//# sourceMappingURL=StopTimesTripScopeHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StopTimesTripScopeHelper.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,iEAA6D;AAC7D,6HAAoI;AAEpI,+DAAsF;AAEtF,6EAAwE;AACxE,2DAA2D;AAC3D,iEAAwE;AACxE,yEAAsE;AAG/D,IAAM,wBAAwB,sCAA9B,MAAM,wBAAyB,SAAQ,mDAAwB;IAGlE,YAC8D,0BAAuD,EACzD,kBAAuC;QAE/F,KAAK,EAAE,CAAC;QAHkD,+BAA0B,GAA1B,0BAA0B,CAA6B;QACzD,uBAAkB,GAAlB,kBAAkB,CAAqB;QAG/F,IAAI,CAAC,2BAA2B,GAAG,IAAI,yEAAmC,EAAE,CAAC;IACjF,CAAC;IAEY,MAAM,CAAC,MAA8B,EAAE,eAAmC;;YACnF,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,wBAAwB,CACxF,eAAe,CAAC,YAAY,CAC/B,CAAC;YAEF,IAAI,CAAC,qBAAqB,EAAE;gBACxB,MAAM,IAAI,6BAAY,CAAC,mCAAmC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;aACtG;YAED,MAAM,SAAS,GAAG,IAAI,CAAC,2BAA2B,CAAC,cAAc,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACpG,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9G,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/B,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE;oBAChD,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,CAAC,QAAQ,GAAG,CAAC,CAGxD,CAAC;oBAEF,IAAI,QAAQ,EAAE;wBACV,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS;4BAC7C,CAAC,CAAC,gBAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC;iCAC5D,IAAI,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,CAAC;iCAC9C,QAAQ,CAAC,UAAU,CAAC;4BAC3B,CAAC,CAAC,IAAI,CAAC;wBAEX,MAAM,eAAe,GAAG,iBAAiB,CAAC,SAAS;4BAC/C,CAAC,CAAC,gBAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC;iCAC9D,IAAI,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,CAAC;iCAC9C,QAAQ,CAAC,UAAU,CAAC;4BAC3B,CAAC,CAAC,IAAI,CAAC;wBAEX,QAAQ,CAAC,UAAU,CAAC,qBAAqB,GAAG,aAAa,CAAC;wBAC1D,QAAQ,CAAC,UAAU,CAAC,uBAAuB,GAAG,eAAe,CAAC;qBACjE;iBACJ;aACJ;YAED,MAAM,CAAC,UAAU,GAAG,IAAA,mCAA6B,EAAC,SAAS,CAAC,CAAC;YAC7D,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ,CAAA;mCApDY,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAKJ,WAAA,IAAA,iBAAM,EAAC,6BAAa,CAAC,0BAA0B,CAAC,CAAA;IAChD,WAAA,IAAA,iBAAM,EAAC,6BAAa,CAAC,wBAAwB,CAAC,CAAA;;GAL1C,wBAAwB,CAoDpC"}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/TripScopeHandlerFactory.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DetailedTripScope } from "../../../../routers/v1/helpers/DetailedTripScopeEnum";
|
|
2
|
+
import { AbstractTripScopeHandler } from "./AbstractTripScopeHandler";
|
|
3
|
+
export declare class TripScopeHandlerFactory {
|
|
4
|
+
private static _instance;
|
|
5
|
+
private dictionary;
|
|
6
|
+
static getInstance(): TripScopeHandlerFactory;
|
|
7
|
+
private constructor();
|
|
8
|
+
getStrategy(scope: DetailedTripScope): AbstractTripScopeHandler;
|
|
9
|
+
}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/TripScopeHandlerFactory.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TripScopeHandlerFactory = void 0;
|
|
4
|
+
const Di_1 = require("../../../../ioc/Di");
|
|
5
|
+
const OgModuleToken_1 = require("../../../../ioc/OgModuleToken");
|
|
6
|
+
const DetailedTripScopeEnum_1 = require("../../../../routers/v1/helpers/DetailedTripScopeEnum");
|
|
7
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
8
|
+
class TripScopeHandlerFactory {
|
|
9
|
+
static getInstance() {
|
|
10
|
+
if (!this._instance) {
|
|
11
|
+
this._instance = new TripScopeHandlerFactory();
|
|
12
|
+
}
|
|
13
|
+
return this._instance;
|
|
14
|
+
}
|
|
15
|
+
constructor() {
|
|
16
|
+
this.dictionary = new Map();
|
|
17
|
+
this.dictionary.set(DetailedTripScopeEnum_1.DetailedTripScope.Info, Di_1.OgPublicContainer.resolve(OgModuleToken_1.OgModuleToken.InfoTripScopeHelper));
|
|
18
|
+
this.dictionary.set(DetailedTripScopeEnum_1.DetailedTripScope.StopTimes, Di_1.OgPublicContainer.resolve(OgModuleToken_1.OgModuleToken.StopTimesTripScopeHelper));
|
|
19
|
+
this.dictionary.set(DetailedTripScopeEnum_1.DetailedTripScope.Shapes, Di_1.OgPublicContainer.resolve(OgModuleToken_1.OgModuleToken.ShapesTripScopeHelper));
|
|
20
|
+
this.dictionary.set(DetailedTripScopeEnum_1.DetailedTripScope.VehicleDescriptor, Di_1.OgPublicContainer.resolve(OgModuleToken_1.OgModuleToken.VehicleDescriptorTripScopeHelper));
|
|
21
|
+
}
|
|
22
|
+
getStrategy(scope) {
|
|
23
|
+
if (this.dictionary.has(scope)) {
|
|
24
|
+
return this.dictionary.get(scope);
|
|
25
|
+
}
|
|
26
|
+
throw new golemio_errors_1.GeneralError("unknown_detailed_trip_scope", this.constructor.name, undefined, 500);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.TripScopeHandlerFactory = TripScopeHandlerFactory;
|
|
30
|
+
//# sourceMappingURL=TripScopeHandlerFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TripScopeHandlerFactory.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/TripScopeHandlerFactory.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,iEAA6D;AAC7D,gGAAwF;AACxF,6EAAwE;AAGxE,MAAa,uBAAuB;IAIzB,MAAM,CAAC,WAAW;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,uBAAuB,EAAE,CAAC;SAClD;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;QACI,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAA+C,CAAC;QACzE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,yCAAiB,CAAC,IAAI,EAAE,sBAAiB,CAAC,OAAO,CAAC,6BAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC1G,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,yCAAiB,CAAC,SAAS,EAAE,sBAAiB,CAAC,OAAO,CAAC,6BAAa,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACpH,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,yCAAiB,CAAC,MAAM,EAAE,sBAAiB,CAAC,OAAO,CAAC,6BAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,UAAU,CAAC,GAAG,CACf,yCAAiB,CAAC,iBAAiB,EACnC,sBAAiB,CAAC,OAAO,CAAC,6BAAa,CAAC,gCAAgC,CAAC,CAC5E,CAAC;IACN,CAAC;IAEM,WAAW,CAAC,KAAwB;QACvC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;SACtC;QAED,MAAM,IAAI,6BAAY,CAAC,6BAA6B,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACjG,CAAC;CACJ;AA9BD,0DA8BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VehicleDescriptorCachedRepository } from "../../../../data-access/VehicleDescriptorCachedRepository";
|
|
2
|
+
import { IPublicApiDetailedTrip } from "../../../../domain/PublicApiDetailedTripInterfaces";
|
|
3
|
+
import { IPublicApiCacheDto } from "../../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
4
|
+
import { AbstractTripScopeHandler } from "./AbstractTripScopeHandler";
|
|
5
|
+
export declare class VehicleDescriptorTripScopeHelper extends AbstractTripScopeHandler {
|
|
6
|
+
private vehicleDescriptorRepository;
|
|
7
|
+
private vehicleDescriptorTransformation;
|
|
8
|
+
constructor(vehicleDescriptorRepository: VehicleDescriptorCachedRepository);
|
|
9
|
+
handle(output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.VehicleDescriptorTripScopeHelper = void 0;
|
|
25
|
+
const VehicleDescriptorCachedRepository_1 = require("../../../../data-access/VehicleDescriptorCachedRepository");
|
|
26
|
+
const OgModuleToken_1 = require("../../../../ioc/OgModuleToken");
|
|
27
|
+
const PublicVPVehicleDescriptorTransformation_1 = require("../../../transformations/scopes/PublicVPVehicleDescriptorTransformation");
|
|
28
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
29
|
+
const AbstractTripScopeHandler_1 = require("./AbstractTripScopeHandler");
|
|
30
|
+
let VehicleDescriptorTripScopeHelper = exports.VehicleDescriptorTripScopeHelper = class VehicleDescriptorTripScopeHelper extends AbstractTripScopeHandler_1.AbstractTripScopeHandler {
|
|
31
|
+
constructor(vehicleDescriptorRepository) {
|
|
32
|
+
super();
|
|
33
|
+
this.vehicleDescriptorRepository = vehicleDescriptorRepository;
|
|
34
|
+
this.vehicleDescriptorTransformation = new PublicVPVehicleDescriptorTransformation_1.PublicVPVehicleDescriptorTransformation();
|
|
35
|
+
}
|
|
36
|
+
handle(output, vehiclePosition) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
output.vehicle_descriptor = this.vehicleDescriptorTransformation.transformElement(vehiclePosition);
|
|
39
|
+
const registrationNumber = vehiclePosition.detailed_info.registration_number;
|
|
40
|
+
if (registrationNumber) {
|
|
41
|
+
const routeType = vehiclePosition.route_type;
|
|
42
|
+
const descriptor = yield this.vehicleDescriptorRepository.getOneByRegNumber(routeType, registrationNumber);
|
|
43
|
+
output.vehicle_descriptor = Object.assign(Object.assign({}, output.vehicle_descriptor), (descriptor !== null && descriptor !== void 0 ? descriptor : {}));
|
|
44
|
+
}
|
|
45
|
+
return output;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.VehicleDescriptorTripScopeHelper = VehicleDescriptorTripScopeHelper = __decorate([
|
|
50
|
+
(0, tsyringe_1.injectable)(),
|
|
51
|
+
__param(0, (0, tsyringe_1.inject)(OgModuleToken_1.OgModuleToken.VehicleDescriptorCachedRepository)),
|
|
52
|
+
__metadata("design:paramtypes", [VehicleDescriptorCachedRepository_1.VehicleDescriptorCachedRepository])
|
|
53
|
+
], VehicleDescriptorTripScopeHelper);
|
|
54
|
+
//# sourceMappingURL=VehicleDescriptorTripScopeHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VehicleDescriptorTripScopeHelper.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/VehicleDescriptorTripScopeHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iHAA6G;AAE7G,iEAA6D;AAC7D,qIAA4I;AAE5I,iEAAwE;AACxE,yEAAsE;AAG/D,IAAM,gCAAgC,8CAAtC,MAAM,gCAAiC,SAAQ,mDAAwB;IAG1E,YAEY,2BAA8D;QAEtE,KAAK,EAAE,CAAC;QAFA,gCAA2B,GAA3B,2BAA2B,CAAmC;QAGtE,IAAI,CAAC,+BAA+B,GAAG,IAAI,iFAAuC,EAAE,CAAC;IACzF,CAAC;IAEY,MAAM,CAAC,MAA8B,EAAE,eAAmC;;YACnF,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,+BAA+B,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;YAEnG,MAAM,kBAAkB,GAAG,eAAe,CAAC,aAAa,CAAC,mBAAmB,CAAC;YAC7E,IAAI,kBAAkB,EAAE;gBACpB,MAAM,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC;gBAC7C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;gBAE3G,MAAM,CAAC,kBAAkB,mCAClB,MAAM,CAAC,kBAAkB,GACzB,CAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC,CACxB,CAAC;aACL;YAED,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ,CAAA;2CA3BY,gCAAgC;IAD5C,IAAA,qBAAU,GAAE;IAKJ,WAAA,IAAA,iBAAM,EAAC,6BAAa,CAAC,iCAAiC,CAAC,CAAA;qCACnB,qEAAiC;GALjE,gCAAgC,CA2B5C"}
|
package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { AbstractTransformation } from "@golemio/core/dist/helpers/transformatio
|
|
|
3
3
|
import { IGeoJSONFeature } from "@golemio/core/dist/output-gateway/Geo";
|
|
4
4
|
export declare class PublicVehiclePositionsTransformation extends AbstractTransformation<IPublicApiCacheDto, IGeoJSONFeature> {
|
|
5
5
|
name: string;
|
|
6
|
-
protected transformInternal: (element: IPublicApiCacheDto) => IGeoJSONFeature;
|
|
6
|
+
protected transformInternal: ({ detailed_info, ...element }: IPublicApiCacheDto) => IGeoJSONFeature;
|
|
7
7
|
}
|
package/dist/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.PublicVehiclePositionsTransformation = void 0;
|
|
4
15
|
const RouteTypeEnums_1 = require("../../../../helpers/RouteTypeEnums");
|
|
@@ -8,9 +19,10 @@ class PublicVehiclePositionsTransformation extends AbstractTransformation_1.Abst
|
|
|
8
19
|
constructor() {
|
|
9
20
|
super(...arguments);
|
|
10
21
|
this.name = "OutputDtoTransformation";
|
|
11
|
-
this.transformInternal = (
|
|
12
|
-
var
|
|
13
|
-
|
|
22
|
+
this.transformInternal = (_a) => {
|
|
23
|
+
var _b;
|
|
24
|
+
var { detailed_info } = _a, element = __rest(_a, ["detailed_info"]);
|
|
25
|
+
return (0, Geo_1.buildGeojsonFeature)(Object.assign(Object.assign({}, element), { route_type: ((_b = RouteTypeEnums_1.GTFSRouteTypeEnum[element.route_type]) !== null && _b !== void 0 ? _b : RouteTypeEnums_1.GTFSRouteTypeEnum[1700]).toLowerCase() }), "lng", "lat", true);
|
|
14
26
|
};
|
|
15
27
|
}
|
|
16
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicVehiclePositionsTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PublicVehiclePositionsTransformation.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/transformations/PublicVehiclePositionsTransformation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uEAA4D;AAE5D,6GAA0G;AAC1G,+DAA6F;AAE7F,MAAa,oCAAqC,SAAQ,+CAA2D;IAArH;;QACW,SAAI,GAAG,yBAAyB,CAAC;QAE9B,sBAAiB,GAAG,CAAC,EAAiD,EAAE,EAAE;;gBAArD,EAAE,aAAa,OAAkC,EAA7B,OAAO,cAA3B,iBAA6B,CAAF;YACtD,OAAO,IAAA,yBAAmB,kCAEf,OAAO,KACV,UAAU,EAAE,CAAC,MAAA,kCAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,mCAAI,kCAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,KAEhG,KAAK,EACL,KAAK,EACL,IAAI,CACP,CAAC;QACN,CAAC,CAAC;IACN,CAAC;CAAA;AAdD,oFAcC"}
|