@mapvx/web-js 4.0.2 → 4.0.3-dev.2
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/README.md +7 -7
- package/dist/cjs/index.js +4 -2
- package/dist/es/assets/icons.d.ts +0 -1
- package/dist/es/assets/icons.js +0 -50
- package/dist/es/config/draco.d.ts +0 -1
- package/dist/es/config/draco.js +0 -10
- package/dist/es/config/sdkConfig.d.ts +0 -1
- package/dist/es/config/sdkConfig.js +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts +0 -1
- package/dist/es/controllers/markerLayoutController.js +0 -103
- package/dist/es/controllers/routeController.d.ts +0 -1
- package/dist/es/controllers/routeController.js +1 -473
- package/dist/es/domain/models/_internal.d.ts +0 -1
- package/dist/es/domain/models/_internal.js +0 -8
- package/dist/es/domain/models/animation.d.ts +0 -1
- package/dist/es/domain/models/animation.js +0 -6
- package/dist/es/domain/models/banner.d.ts +0 -1
- package/dist/es/domain/models/banner.js +0 -10
- package/dist/es/domain/models/campaign.d.ts +0 -1
- package/dist/es/domain/models/campaign.js +0 -29
- package/dist/es/domain/models/categories.d.ts +0 -1
- package/dist/es/domain/models/categories.js +0 -20
- package/dist/es/domain/models/circle.d.ts +0 -1
- package/dist/es/domain/models/circle.js +0 -118
- package/dist/es/domain/models/cityFilterOption.d.ts +0 -1
- package/dist/es/domain/models/cityFilterOption.js +0 -1
- package/dist/es/domain/models/configuration.d.ts +0 -1
- package/dist/es/domain/models/configuration.js +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts +0 -1
- package/dist/es/domain/models/cssCustomization.js +0 -1
- package/dist/es/domain/models/fitOptions.d.ts +0 -1
- package/dist/es/domain/models/fitOptions.js +0 -1
- package/dist/es/domain/models/innerFloors.d.ts +0 -1
- package/dist/es/domain/models/innerFloors.js +0 -1
- package/dist/es/domain/models/institution.d.ts +0 -1
- package/dist/es/domain/models/institution.js +0 -26
- package/dist/es/domain/models/latLng.d.ts +0 -1
- package/dist/es/domain/models/latLng.js +0 -1
- package/dist/es/domain/models/location.d.ts +0 -1
- package/dist/es/domain/models/location.js +0 -1
- package/dist/es/domain/models/loggeable.d.ts +0 -1
- package/dist/es/domain/models/loggeable.js +0 -24
- package/dist/es/domain/models/mapCamera.d.ts +0 -1
- package/dist/es/domain/models/mapCamera.js +0 -1
- package/dist/es/domain/models/mapConfig.d.ts +0 -1
- package/dist/es/domain/models/mapConfig.js +1 -17
- package/dist/es/domain/models/marker.d.ts +0 -1
- package/dist/es/domain/models/marker.js +0 -292
- package/dist/es/domain/models/multilanguage.d.ts +0 -1
- package/dist/es/domain/models/multilanguage.js +0 -10
- package/dist/es/domain/models/openingHours.d.ts +0 -1
- package/dist/es/domain/models/openingHours.js +0 -1
- package/dist/es/domain/models/place.d.ts +0 -1
- package/dist/es/domain/models/place.js +0 -68
- package/dist/es/domain/models/platform.d.ts +0 -1
- package/dist/es/domain/models/platform.js +0 -1
- package/dist/es/domain/models/popover.d.ts +0 -1
- package/dist/es/domain/models/popover.js +0 -1
- package/dist/es/domain/models/product.d.ts +0 -1
- package/dist/es/domain/models/product.js +0 -1
- package/dist/es/domain/models/property.d.ts +0 -1
- package/dist/es/domain/models/property.js +0 -16
- package/dist/es/domain/models/route.d.ts +0 -1
- package/dist/es/domain/models/route.js +0 -71
- package/dist/es/domain/models/routeConfiguration.d.ts +0 -1
- package/dist/es/domain/models/routeConfiguration.js +0 -36
- package/dist/es/domain/models/routeInstance.d.ts +0 -1
- package/dist/es/domain/models/routeInstance.js +0 -8
- package/dist/es/domain/models/routeStyle.d.ts +0 -1
- package/dist/es/domain/models/routeStyle.js +0 -1
- package/dist/es/domain/models/scene3D.d.ts +0 -1
- package/dist/es/domain/models/scene3D.js +0 -1
- package/dist/es/domain/models/transport.d.ts +0 -1
- package/dist/es/domain/models/transport.js +0 -12
- package/dist/es/domain/ports/ICache.d.ts +0 -1
- package/dist/es/domain/ports/ICache.js +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts +0 -1
- package/dist/es/domain/ports/IHttpClient.js +0 -1
- package/dist/es/domain/ports/ILogger.d.ts +0 -1
- package/dist/es/domain/ports/ILogger.js +0 -9
- package/dist/es/domain/ports/index.d.ts +0 -1
- package/dist/es/domain/ports/index.js +0 -5
- package/dist/es/index.d.ts +0 -1
- package/dist/es/index.js +1 -28
- package/dist/es/infrastructure/cache/CacheManager.d.ts +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js +0 -94
- package/dist/es/infrastructure/cache/LRUCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js +0 -57
- package/dist/es/infrastructure/cache/PersistentCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js +0 -51
- package/dist/es/infrastructure/cache/cacheConfig.d.ts +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js +8 -27
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js +0 -36
- package/dist/es/infrastructure/logging/MVXLogger.d.ts +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js +0 -37
- package/dist/es/interfaces/cache.d.ts +0 -1
- package/dist/es/interfaces/cache.js +0 -1
- package/dist/es/interfaces/healthResponse.d.ts +0 -1
- package/dist/es/interfaces/healthResponse.js +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts +0 -1
- package/dist/es/interfaces/institutionResponse.js +0 -1
- package/dist/es/interfaces/metadata.d.ts +0 -1
- package/dist/es/interfaces/metadata.js +0 -1
- package/dist/es/interfaces/placeResponse.d.ts +0 -1
- package/dist/es/interfaces/placeResponse.js +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts +0 -1
- package/dist/es/interfaces/routeCacheResponse.js +0 -1
- package/dist/es/interfaces/routeResponse.d.ts +0 -1
- package/dist/es/interfaces/routeResponse.js +0 -1
- package/dist/es/interfaces/styleResponse.d.ts +0 -1
- package/dist/es/interfaces/styleResponse.js +0 -1
- package/dist/es/logger/logger.d.ts +0 -1
- package/dist/es/logger/logger.js +0 -10
- package/dist/es/logger/sentry.d.ts +0 -1
- package/dist/es/logger/sentry.js +1 -39
- package/dist/es/map/fitCamera.d.ts +0 -1
- package/dist/es/map/fitCamera.js +0 -44
- package/dist/es/map/generated/maplibreWorkerSource.d.ts +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js +0 -12
- package/dist/es/map/installMapLibreWorker.d.ts +0 -1
- package/dist/es/map/installMapLibreWorker.js +0 -100
- package/dist/es/map/liveMapFitTransform.d.ts +0 -1
- package/dist/es/map/liveMapFitTransform.js +0 -82
- package/dist/es/map/map.d.ts +0 -1
- package/dist/es/map/map.js +4 -681
- package/dist/es/map/mapInteractionOptions.d.ts +0 -1
- package/dist/es/map/mapInteractionOptions.js +0 -35
- package/dist/es/map/scene3DController.d.ts +0 -1
- package/dist/es/map/scene3DController.js +0 -221
- package/dist/es/repository/repository.d.ts +0 -1
- package/dist/es/repository/repository.js +0 -56
- package/dist/es/repository/requester.d.ts +0 -1
- package/dist/es/repository/requester.js +0 -233
- package/dist/es/sdk.d.ts +0 -1
- package/dist/es/sdk.js +0 -35
- package/dist/es/utils/3d.d.ts +0 -1
- package/dist/es/utils/3d.js +0 -79
- package/dist/es/utils/deckLayers.d.ts +0 -1
- package/dist/es/utils/deckLayers.js +1 -27
- package/dist/es/utils/error.d.ts +0 -1
- package/dist/es/utils/error.js +0 -7
- package/dist/es/utils/images.d.ts +0 -1
- package/dist/es/utils/images.js +0 -7
- package/dist/es/utils/loadGlb.d.ts +0 -1
- package/dist/es/utils/loadGlb.js +2 -96
- package/dist/es/utils/mapvxHostname.d.ts +0 -1
- package/dist/es/utils/mapvxHostname.js +0 -11
- package/dist/es/utils/nav-functions.d.ts +0 -1
- package/dist/es/utils/nav-functions.js +0 -82
- package/dist/es/utils/opening-hours-helper.d.ts +0 -1
- package/dist/es/utils/opening-hours-helper.js +6 -382
- package/dist/es/utils/preconnect.d.ts +0 -1
- package/dist/es/utils/preconnect.js +0 -61
- package/dist/es/utils/route-utils.d.ts +0 -1
- package/dist/es/utils/route-utils.js +0 -25
- package/dist/es/utils/semaphore.d.ts +0 -1
- package/dist/es/utils/semaphore.js +0 -78
- package/dist/es/utils/three.d.ts +0 -1
- package/dist/es/utils/three.js +0 -43
- package/dist/es/utils/threeScene.d.ts +0 -1
- package/dist/es/utils/threeScene.js +0 -38
- package/dist/es/utils/update-css.d.ts +0 -1
- package/dist/es/utils/update-css.js +0 -26
- package/dist/es/utils/utils.d.ts +0 -1
- package/dist/es/utils/utils.js +0 -53
- package/dist/umd/index.js +4 -29240
- package/dist/umd/index.js.LICENSE.txt +1 -0
- package/dist/umd/styles.css +0 -1
- package/dist/umd/styles.js +3 -32
- package/package.json +12 -6
- package/dist/cjs/index.js.map +0 -1
- package/dist/es/assets/icons.d.ts.map +0 -1
- package/dist/es/assets/icons.js.map +0 -1
- package/dist/es/config/draco.d.ts.map +0 -1
- package/dist/es/config/draco.js.map +0 -1
- package/dist/es/config/sdkConfig.d.ts.map +0 -1
- package/dist/es/config/sdkConfig.js.map +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts.map +0 -1
- package/dist/es/controllers/markerLayoutController.js.map +0 -1
- package/dist/es/controllers/routeController.d.ts.map +0 -1
- package/dist/es/controllers/routeController.js.map +0 -1
- package/dist/es/domain/models/_internal.d.ts.map +0 -1
- package/dist/es/domain/models/_internal.js.map +0 -1
- package/dist/es/domain/models/animation.d.ts.map +0 -1
- package/dist/es/domain/models/animation.js.map +0 -1
- package/dist/es/domain/models/banner.d.ts.map +0 -1
- package/dist/es/domain/models/banner.js.map +0 -1
- package/dist/es/domain/models/campaign.d.ts.map +0 -1
- package/dist/es/domain/models/campaign.js.map +0 -1
- package/dist/es/domain/models/categories.d.ts.map +0 -1
- package/dist/es/domain/models/categories.js.map +0 -1
- package/dist/es/domain/models/circle.d.ts.map +0 -1
- package/dist/es/domain/models/circle.js.map +0 -1
- package/dist/es/domain/models/cityFilterOption.d.ts.map +0 -1
- package/dist/es/domain/models/cityFilterOption.js.map +0 -1
- package/dist/es/domain/models/configuration.d.ts.map +0 -1
- package/dist/es/domain/models/configuration.js.map +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts.map +0 -1
- package/dist/es/domain/models/cssCustomization.js.map +0 -1
- package/dist/es/domain/models/fitOptions.d.ts.map +0 -1
- package/dist/es/domain/models/fitOptions.js.map +0 -1
- package/dist/es/domain/models/innerFloors.d.ts.map +0 -1
- package/dist/es/domain/models/innerFloors.js.map +0 -1
- package/dist/es/domain/models/institution.d.ts.map +0 -1
- package/dist/es/domain/models/institution.js.map +0 -1
- package/dist/es/domain/models/latLng.d.ts.map +0 -1
- package/dist/es/domain/models/latLng.js.map +0 -1
- package/dist/es/domain/models/location.d.ts.map +0 -1
- package/dist/es/domain/models/location.js.map +0 -1
- package/dist/es/domain/models/loggeable.d.ts.map +0 -1
- package/dist/es/domain/models/loggeable.js.map +0 -1
- package/dist/es/domain/models/mapCamera.d.ts.map +0 -1
- package/dist/es/domain/models/mapCamera.js.map +0 -1
- package/dist/es/domain/models/mapConfig.d.ts.map +0 -1
- package/dist/es/domain/models/mapConfig.js.map +0 -1
- package/dist/es/domain/models/marker.d.ts.map +0 -1
- package/dist/es/domain/models/marker.js.map +0 -1
- package/dist/es/domain/models/multilanguage.d.ts.map +0 -1
- package/dist/es/domain/models/multilanguage.js.map +0 -1
- package/dist/es/domain/models/openingHours.d.ts.map +0 -1
- package/dist/es/domain/models/openingHours.js.map +0 -1
- package/dist/es/domain/models/place.d.ts.map +0 -1
- package/dist/es/domain/models/place.js.map +0 -1
- package/dist/es/domain/models/platform.d.ts.map +0 -1
- package/dist/es/domain/models/platform.js.map +0 -1
- package/dist/es/domain/models/popover.d.ts.map +0 -1
- package/dist/es/domain/models/popover.js.map +0 -1
- package/dist/es/domain/models/product.d.ts.map +0 -1
- package/dist/es/domain/models/product.js.map +0 -1
- package/dist/es/domain/models/property.d.ts.map +0 -1
- package/dist/es/domain/models/property.js.map +0 -1
- package/dist/es/domain/models/route.d.ts.map +0 -1
- package/dist/es/domain/models/route.js.map +0 -1
- package/dist/es/domain/models/routeConfiguration.d.ts.map +0 -1
- package/dist/es/domain/models/routeConfiguration.js.map +0 -1
- package/dist/es/domain/models/routeInstance.d.ts.map +0 -1
- package/dist/es/domain/models/routeInstance.js.map +0 -1
- package/dist/es/domain/models/routeStyle.d.ts.map +0 -1
- package/dist/es/domain/models/routeStyle.js.map +0 -1
- package/dist/es/domain/models/scene3D.d.ts.map +0 -1
- package/dist/es/domain/models/scene3D.js.map +0 -1
- package/dist/es/domain/models/transport.d.ts.map +0 -1
- package/dist/es/domain/models/transport.js.map +0 -1
- package/dist/es/domain/ports/ICache.d.ts.map +0 -1
- package/dist/es/domain/ports/ICache.js.map +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts.map +0 -1
- package/dist/es/domain/ports/IHttpClient.js.map +0 -1
- package/dist/es/domain/ports/ILogger.d.ts.map +0 -1
- package/dist/es/domain/ports/ILogger.js.map +0 -1
- package/dist/es/domain/ports/index.d.ts.map +0 -1
- package/dist/es/domain/ports/index.js.map +0 -1
- package/dist/es/index.d.ts.map +0 -1
- package/dist/es/index.js.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.d.ts.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js.map +0 -1
- package/dist/es/interfaces/cache.d.ts.map +0 -1
- package/dist/es/interfaces/cache.js.map +0 -1
- package/dist/es/interfaces/healthResponse.d.ts.map +0 -1
- package/dist/es/interfaces/healthResponse.js.map +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts.map +0 -1
- package/dist/es/interfaces/institutionResponse.js.map +0 -1
- package/dist/es/interfaces/metadata.d.ts.map +0 -1
- package/dist/es/interfaces/metadata.js.map +0 -1
- package/dist/es/interfaces/placeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/placeResponse.js.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.js.map +0 -1
- package/dist/es/interfaces/routeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeResponse.js.map +0 -1
- package/dist/es/interfaces/styleResponse.d.ts.map +0 -1
- package/dist/es/interfaces/styleResponse.js.map +0 -1
- package/dist/es/logger/logger.d.ts.map +0 -1
- package/dist/es/logger/logger.js.map +0 -1
- package/dist/es/logger/sentry.d.ts.map +0 -1
- package/dist/es/logger/sentry.js.map +0 -1
- package/dist/es/map/fitCamera.d.ts.map +0 -1
- package/dist/es/map/fitCamera.js.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.d.ts.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js.map +0 -1
- package/dist/es/map/installMapLibreWorker.d.ts.map +0 -1
- package/dist/es/map/installMapLibreWorker.js.map +0 -1
- package/dist/es/map/liveMapFitTransform.d.ts.map +0 -1
- package/dist/es/map/liveMapFitTransform.js.map +0 -1
- package/dist/es/map/map.d.ts.map +0 -1
- package/dist/es/map/map.js.map +0 -1
- package/dist/es/map/mapInteractionOptions.d.ts.map +0 -1
- package/dist/es/map/mapInteractionOptions.js.map +0 -1
- package/dist/es/map/scene3DController.d.ts.map +0 -1
- package/dist/es/map/scene3DController.js.map +0 -1
- package/dist/es/repository/repository.d.ts.map +0 -1
- package/dist/es/repository/repository.js.map +0 -1
- package/dist/es/repository/requester.d.ts.map +0 -1
- package/dist/es/repository/requester.js.map +0 -1
- package/dist/es/sdk.d.ts.map +0 -1
- package/dist/es/sdk.js.map +0 -1
- package/dist/es/utils/3d.d.ts.map +0 -1
- package/dist/es/utils/3d.js.map +0 -1
- package/dist/es/utils/deckLayers.d.ts.map +0 -1
- package/dist/es/utils/deckLayers.js.map +0 -1
- package/dist/es/utils/error.d.ts.map +0 -1
- package/dist/es/utils/error.js.map +0 -1
- package/dist/es/utils/images.d.ts.map +0 -1
- package/dist/es/utils/images.js.map +0 -1
- package/dist/es/utils/loadGlb.d.ts.map +0 -1
- package/dist/es/utils/loadGlb.js.map +0 -1
- package/dist/es/utils/mapvxHostname.d.ts.map +0 -1
- package/dist/es/utils/mapvxHostname.js.map +0 -1
- package/dist/es/utils/nav-functions.d.ts.map +0 -1
- package/dist/es/utils/nav-functions.js.map +0 -1
- package/dist/es/utils/opening-hours-helper.d.ts.map +0 -1
- package/dist/es/utils/opening-hours-helper.js.map +0 -1
- package/dist/es/utils/preconnect.d.ts.map +0 -1
- package/dist/es/utils/preconnect.js.map +0 -1
- package/dist/es/utils/route-utils.d.ts.map +0 -1
- package/dist/es/utils/route-utils.js.map +0 -1
- package/dist/es/utils/semaphore.d.ts.map +0 -1
- package/dist/es/utils/semaphore.js.map +0 -1
- package/dist/es/utils/three.d.ts.map +0 -1
- package/dist/es/utils/three.js.map +0 -1
- package/dist/es/utils/threeScene.d.ts.map +0 -1
- package/dist/es/utils/threeScene.js.map +0 -1
- package/dist/es/utils/update-css.d.ts.map +0 -1
- package/dist/es/utils/update-css.js.map +0 -1
- package/dist/es/utils/utils.d.ts.map +0 -1
- package/dist/es/utils/utils.js.map +0 -1
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/styles.css.map +0 -1
- package/dist/umd/styles.js.map +0 -1
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { decode } from "@googlemaps/polyline-codec";
|
|
2
2
|
import { v4 as uuid } from "uuid";
|
|
3
|
-
/**
|
|
4
|
-
* Represents a complete route in MapVX that can contain multiple legs.
|
|
5
|
-
* Each route is composed of a series of legs that connect different points.
|
|
6
|
-
* @group Routes
|
|
7
|
-
*/
|
|
8
3
|
export class MVXRoute {
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new route instance from API response data
|
|
11
|
-
* @hidden
|
|
12
|
-
* @param data API response data containing route information
|
|
13
|
-
*/
|
|
14
4
|
constructor(data) {
|
|
15
5
|
this.id = uuid();
|
|
16
6
|
this.legs = [];
|
|
@@ -19,47 +9,21 @@ export class MVXRoute {
|
|
|
19
9
|
this.legs.push(leg);
|
|
20
10
|
});
|
|
21
11
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Gets all steps of the route by combining steps from all legs
|
|
24
|
-
* @returns Array with all route steps
|
|
25
|
-
*/
|
|
26
12
|
get steps() {
|
|
27
13
|
return this.legs.flatMap((leg) => leg.steps);
|
|
28
14
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Gets the total duration of the route.
|
|
31
|
-
* This property calculates the sum of the duration of all legs in the route.
|
|
32
|
-
*
|
|
33
|
-
* @returns {number} The total duration of the route, in seconds.
|
|
34
|
-
*/
|
|
35
15
|
get duration() {
|
|
36
16
|
return this.legs
|
|
37
17
|
.map((leg) => leg.duration)
|
|
38
18
|
.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
39
19
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Gets the total length of the route.
|
|
42
|
-
* This property calculates the sum of the length of all legs in the route.
|
|
43
|
-
*
|
|
44
|
-
* @returns {number} The total length of the route, in meters.
|
|
45
|
-
*/
|
|
46
20
|
get length() {
|
|
47
21
|
return this.legs
|
|
48
22
|
.map((leg) => leg.distance)
|
|
49
23
|
.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
50
24
|
}
|
|
51
25
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Represents a route leg that connects two specific points.
|
|
54
|
-
* Each leg contains information about distance, duration, and detailed steps.
|
|
55
|
-
* @group Routes
|
|
56
|
-
*/
|
|
57
26
|
export class MVXRouteLeg {
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new route leg instance from response data
|
|
60
|
-
* @hidden
|
|
61
|
-
* @param data API response data containing leg information
|
|
62
|
-
*/
|
|
63
27
|
constructor(data) {
|
|
64
28
|
this.distance = data.distance.value;
|
|
65
29
|
this.duration = data.duration.value;
|
|
@@ -72,17 +36,7 @@ export class MVXRouteLeg {
|
|
|
72
36
|
});
|
|
73
37
|
}
|
|
74
38
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Represents an individual step within a route leg.
|
|
77
|
-
* Each step contains specific instructions and coordinates for navigation.
|
|
78
|
-
* @group Routes
|
|
79
|
-
*/
|
|
80
39
|
export class MVXRouteStep {
|
|
81
|
-
/**
|
|
82
|
-
* Creates a new route step instance from response data
|
|
83
|
-
* @hidden
|
|
84
|
-
* @param data API response data containing step information
|
|
85
|
-
*/
|
|
86
40
|
constructor(data) {
|
|
87
41
|
this.distance = data.distance.value;
|
|
88
42
|
this.duration = data.duration.value;
|
|
@@ -100,30 +54,14 @@ export class MVXRouteStep {
|
|
|
100
54
|
this.iconPrefix = data.icon_prefix;
|
|
101
55
|
this.polyline = new Polyline(data.polyline);
|
|
102
56
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Gets the polyline coordinates in GeoJSON format
|
|
105
|
-
* @returns Array of coordinates in [longitude, latitude] format
|
|
106
|
-
*/
|
|
107
57
|
get geoJsonCoordinates() {
|
|
108
58
|
return this.polyline.geoJsonCoordinates;
|
|
109
59
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Gets the polyline coordinates in LatLng format
|
|
112
|
-
* @returns Array of LatLng coordinates
|
|
113
|
-
*/
|
|
114
60
|
get coordinates() {
|
|
115
61
|
return this.polyline.coordinates;
|
|
116
62
|
}
|
|
117
63
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Internal class that handles polyline decoding and management.
|
|
120
|
-
* A polyline is an encoded representation of a series of coordinates.
|
|
121
|
-
*/
|
|
122
64
|
class Polyline {
|
|
123
|
-
/**
|
|
124
|
-
* Creates a new polyline instance from response data
|
|
125
|
-
* @param data Response data containing polyline information
|
|
126
|
-
*/
|
|
127
65
|
constructor(data) {
|
|
128
66
|
this.points = data.points;
|
|
129
67
|
this.pointsLatLng = data.points_lat_lng;
|
|
@@ -132,10 +70,6 @@ class Polyline {
|
|
|
132
70
|
return { lat: point[0], lng: point[1] };
|
|
133
71
|
});
|
|
134
72
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Gets coordinates in GeoJSON format
|
|
137
|
-
* @returns Array of coordinates in [longitude, latitude] format
|
|
138
|
-
*/
|
|
139
73
|
get geoJsonCoordinates() {
|
|
140
74
|
if (this.overviewPoints != null) {
|
|
141
75
|
return this.overviewPoints.map((point) => [point.lng, point.lat]);
|
|
@@ -144,10 +78,6 @@ class Polyline {
|
|
|
144
78
|
return this.decodedPoints.map((point) => [point.lng, point.lat]);
|
|
145
79
|
}
|
|
146
80
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Gets coordinates in LatLng format
|
|
149
|
-
* @returns Array of LatLng coordinates
|
|
150
|
-
*/
|
|
151
81
|
get coordinates() {
|
|
152
82
|
if (this.overviewPoints != null) {
|
|
153
83
|
return this.overviewPoints;
|
|
@@ -157,4 +87,3 @@ class Polyline {
|
|
|
157
87
|
}
|
|
158
88
|
}
|
|
159
89
|
}
|
|
160
|
-
//# sourceMappingURL=route.js.map
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the announce format for the route.
|
|
3
|
-
* @group Routes
|
|
4
|
-
*/
|
|
5
1
|
export var AnnounceFormat;
|
|
6
2
|
(function (AnnounceFormat) {
|
|
7
3
|
AnnounceFormat["cardinal"] = "CARDINAL";
|
|
8
4
|
AnnounceFormat["clock"] = "CLOCK";
|
|
9
5
|
AnnounceFormat["relative"] = "RELATIVE";
|
|
10
6
|
})(AnnounceFormat || (AnnounceFormat = {}));
|
|
11
|
-
/**
|
|
12
|
-
* Represents the unit system for the route.
|
|
13
|
-
* @group Routes
|
|
14
|
-
*/
|
|
15
7
|
export var UnitSystem;
|
|
16
8
|
(function (UnitSystem) {
|
|
17
9
|
UnitSystem["metric"] = "METRIC";
|
|
18
10
|
UnitSystem["imperial"] = "IMPERIAL";
|
|
19
11
|
UnitSystem["steps"] = "STEPS";
|
|
20
12
|
})(UnitSystem || (UnitSystem = {}));
|
|
21
|
-
/**
|
|
22
|
-
* Represents the transportation mode for the route.
|
|
23
|
-
* @group Routes
|
|
24
|
-
*/
|
|
25
13
|
export var TransportationMode;
|
|
26
14
|
(function (TransportationMode) {
|
|
27
15
|
TransportationMode["walking"] = "WALKING";
|
|
@@ -29,21 +17,7 @@ export var TransportationMode;
|
|
|
29
17
|
TransportationMode["bicycling"] = "BICYCLING";
|
|
30
18
|
TransportationMode["transit"] = "TRANSIT";
|
|
31
19
|
})(TransportationMode || (TransportationMode = {}));
|
|
32
|
-
/**
|
|
33
|
-
* Class representing the configuration of a route.
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
36
20
|
export class InternalGetRouteConfiguration {
|
|
37
|
-
/**
|
|
38
|
-
* Create a new route configuration.
|
|
39
|
-
* @param initialLocation The initial location for the route.
|
|
40
|
-
* @param finalLocation The final location for the route.
|
|
41
|
-
* @param preferAccessibleRoute The option to generate a route (if available) for people with mobility disabilities.
|
|
42
|
-
* @param language The language for the instructions.
|
|
43
|
-
* @param unitSystem The unit system used for the distance.
|
|
44
|
-
* @param announceFormat The format used to announce directions in the instructions.
|
|
45
|
-
* @param userBearing The user's heading in degrees used as the reference direction for announcing turns.
|
|
46
|
-
*/
|
|
47
21
|
constructor(config) {
|
|
48
22
|
var _a, _b, _c, _d, _e;
|
|
49
23
|
this.initialLocation = config.initialLocation;
|
|
@@ -55,16 +29,7 @@ export class InternalGetRouteConfiguration {
|
|
|
55
29
|
this.userBearing = (_e = config.userBearing) !== null && _e !== void 0 ? _e : 0;
|
|
56
30
|
}
|
|
57
31
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Internal class for the configuration to draw the route on a map.
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
32
|
export class InternalDrawRouteConfiguration {
|
|
63
|
-
/**
|
|
64
|
-
* Create a new configuration to draw a route in the map.
|
|
65
|
-
* @param polylineWidth The width of the route line in the map. If omitted, default to `10`.
|
|
66
|
-
* @param routeStyle The style for the steps on the route. If omitted, default to `{ color: "#33B5E5" }`.
|
|
67
|
-
*/
|
|
68
33
|
constructor(config) {
|
|
69
34
|
var _a, _b;
|
|
70
35
|
this.polylineWidth = (_a = config.polylineWidth) !== null && _a !== void 0 ? _a : 10;
|
|
@@ -74,4 +39,3 @@ export class InternalDrawRouteConfiguration {
|
|
|
74
39
|
};
|
|
75
40
|
}
|
|
76
41
|
}
|
|
77
|
-
//# sourceMappingURL=routeConfiguration.js.map
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a new RouteInstance from a route.
|
|
3
|
-
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
4
|
-
* @param route The route to create an instance for.
|
|
5
|
-
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
6
|
-
* @group Routes
|
|
7
|
-
*/
|
|
8
1
|
export function createRouteInstance(route) {
|
|
9
2
|
return {
|
|
10
3
|
id: route.id,
|
|
@@ -24,4 +17,3 @@ export function createRouteInstance(route) {
|
|
|
24
17
|
layerDrawConfigs: {},
|
|
25
18
|
};
|
|
26
19
|
}
|
|
27
|
-
//# sourceMappingURL=routeInstance.js.map
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class that represents a transport object in MapVX.
|
|
3
|
-
* Contains both regular schedules and real-time information.
|
|
4
|
-
* @group Others
|
|
5
|
-
*/
|
|
6
1
|
export class MVXTransport {
|
|
7
|
-
/**
|
|
8
|
-
* Creates a new transport instance with the parameters specified in the response of the endpoint.
|
|
9
|
-
* @hidden
|
|
10
|
-
* @param data json parameters for the transport object.
|
|
11
|
-
* @returns A new instance of MVXTransport is returned.
|
|
12
|
-
*/
|
|
13
2
|
constructor(data) {
|
|
14
3
|
this.schedule = data.schedules;
|
|
15
4
|
this.routes = data.realtimeSchedules;
|
|
16
5
|
}
|
|
17
6
|
}
|
|
18
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* No-op logger implementation for testing or when logging is disabled
|
|
3
|
-
* @group Utils
|
|
4
|
-
*/
|
|
5
1
|
export class NoopLogger {
|
|
6
2
|
logEvent() {
|
|
7
|
-
// No-op
|
|
8
3
|
}
|
|
9
4
|
logError() {
|
|
10
|
-
// No-op
|
|
11
5
|
}
|
|
12
6
|
logWarning() {
|
|
13
|
-
// No-op
|
|
14
7
|
}
|
|
15
8
|
logDebug() {
|
|
16
|
-
// No-op
|
|
17
9
|
}
|
|
18
10
|
}
|
|
19
|
-
//# sourceMappingURL=ILogger.js.map
|
package/dist/es/index.d.ts
CHANGED
|
@@ -65,4 +65,3 @@ export declare const loadStyles: () => void;
|
|
|
65
65
|
* @group Utils
|
|
66
66
|
*/
|
|
67
67
|
export type { Map as MapLibreMap, Marker as MapLibreMarker, PositionAnchor, PointLike, StyleSpecification, LngLatLike, LngLatBoundsLike, MapOptions, MapEventType, MapLayerEventType, } from "maplibre-gl";
|
|
68
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/es/index.js
CHANGED
|
@@ -1,61 +1,34 @@
|
|
|
1
|
-
// ─── Infrastructure: Cache ───────────────────────────────────────────────────
|
|
2
1
|
export { LRUCache } from "./infrastructure/cache/LRUCache";
|
|
3
2
|
export { PersistentCache } from "./infrastructure/cache/PersistentCache";
|
|
4
3
|
export { CacheManager } from "./infrastructure/cache/CacheManager";
|
|
5
4
|
export { DEFAULT_CACHE_CONFIGS, DEFAULT_MAX_STORAGE_BYTES, } from "./infrastructure/cache/cacheConfig";
|
|
6
|
-
// ─── Infrastructure: HTTP ────────────────────────────────────────────────────
|
|
7
5
|
export { FetchHttpClient } from "./infrastructure/http/FetchHttpClient";
|
|
8
|
-
// ─── Infrastructure: Logging ─────────────────────────────────────────────────
|
|
9
6
|
export { MVXLogger } from "./infrastructure/logging/MVXLogger";
|
|
10
|
-
// ─── SDK ─────────────────────────────────────────────────────────────────────
|
|
11
7
|
export { initializeSDK } from "./sdk";
|
|
12
|
-
// ─── Domain Models: Assets / Icons ───────────────────────────────────────────
|
|
13
8
|
export { createRouteAnimationIconDataUrl } from "./assets/icons";
|
|
14
|
-
// ─── Domain Models: Banner ───────────────────────────────────────────────────
|
|
15
9
|
export { Banner } from "./domain/models/banner";
|
|
16
|
-
// ─── Domain Models: Campaigns ────────────────────────────────────────────────
|
|
17
10
|
export { Campaign } from "./domain/models/campaign";
|
|
18
|
-
// ─── Domain Models: Categories ───────────────────────────────────────────────
|
|
19
11
|
export { isBasicWithIcon, isBasicWithImageUrl, isBasicWithLogo } from "./domain/models/categories";
|
|
20
|
-
// ─── Domain Models: Circle ───────────────────────────────────────────────────
|
|
21
12
|
export { circleRing, CIRCLE_DEFAULTS, MAPVX_BRAND_COLOR, isValidCircleConfig, } from "./domain/models/circle";
|
|
22
|
-
// ─── Domain Models: Institution ──────────────────────────────────────────────
|
|
23
13
|
export { Institution } from "./domain/models/institution";
|
|
24
|
-
// ─── Domain Models: Map Config ───────────────────────────────────────────────
|
|
25
14
|
export { DEFAULT_MARKER_LAYOUT_CONFIG, DEFAULT_TILE_CACHE_CONFIG, MAPLIBRE_MAX_TILE_CACHE_HARD_CAP, } from "./domain/models/mapConfig";
|
|
26
|
-
// ─── Domain Models: Marker ───────────────────────────────────────────────────
|
|
27
15
|
export { TextPosition } from "./domain/models/marker";
|
|
28
|
-
// ─── Domain Models: Place ────────────────────────────────────────────────────
|
|
29
16
|
export { MVXPlace } from "./domain/models/place";
|
|
30
|
-
// ─── Domain Models: Route ────────────────────────────────────────────────────
|
|
31
17
|
export { MVXRoute, MVXRouteLeg, MVXRouteStep } from "./domain/models/route";
|
|
32
|
-
// ─── Domain Models: Route Configuration ──────────────────────────────────────
|
|
33
18
|
export { AnnounceFormat, TransportationMode, UnitSystem } from "./domain/models/routeConfiguration";
|
|
34
|
-
// ─── Domain Models: Transport ────────────────────────────────────────────────
|
|
35
19
|
export { MVXTransport } from "./domain/models/transport";
|
|
36
|
-
// ─── Utils ───────────────────────────────────────────────────────────────────
|
|
37
20
|
export { loadCustomization } from "./utils/update-css";
|
|
38
21
|
export { OpeningHoursHelper } from "./utils/opening-hours-helper";
|
|
39
22
|
export { isMapVxRequestHostname } from "./utils/mapvxHostname";
|
|
40
23
|
export { injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "./utils/preconnect";
|
|
41
|
-
// ─── MapLibre worker ─────────────────────────────────────────────────────────
|
|
42
|
-
// The SDK carries MapLibre's worker internally and installs it when the first map is created;
|
|
43
|
-
// these exist for consumers whose Content-Security-Policy forbids blob: workers and who therefore
|
|
44
|
-
// need to self-host it. See src/map/installMapLibreWorker.ts.
|
|
45
24
|
export { installMapLibreWorker, setMapLibreWorkerUrl, getMapLibreWorkerUrl, } from "./map/installMapLibreWorker";
|
|
46
|
-
/**
|
|
47
|
-
* Function to load default styles
|
|
48
|
-
* @group Utils
|
|
49
|
-
*/
|
|
50
25
|
export const loadStyles = () => {
|
|
51
|
-
// Check if styles are already loaded
|
|
52
26
|
if (document.querySelector("link[data-mapvx-styles]")) {
|
|
53
27
|
return;
|
|
54
28
|
}
|
|
55
29
|
const link = document.createElement("link");
|
|
56
30
|
link.rel = "stylesheet";
|
|
57
|
-
link.href = "./styles.css";
|
|
31
|
+
link.href = "./styles.css";
|
|
58
32
|
link.setAttribute("data-mapvx-styles", "true");
|
|
59
33
|
document.head.appendChild(link);
|
|
60
34
|
};
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -2,16 +2,8 @@ import { DEFAULT_MAX_STORAGE_BYTES, getCacheConfig, } from "./cacheConfig";
|
|
|
2
2
|
import { LRUCache } from "./LRUCache";
|
|
3
3
|
import { PersistentCache } from "./PersistentCache";
|
|
4
4
|
import { MVXPlace } from "../../domain/models/place";
|
|
5
|
-
/**
|
|
6
|
-
* Per-type revivers restoring class prototypes lost when the persistent cache
|
|
7
|
-
* rehydrates values from localStorage (`JSON.parse` yields plain objects without
|
|
8
|
-
* methods). Only caches that hold class instances need an entry; plain-data caches
|
|
9
|
-
* (routes, configurations, etc.) are left untouched.
|
|
10
|
-
*/
|
|
11
5
|
const CACHE_DESERIALIZERS = {
|
|
12
|
-
// `places` stores MVXPlace instances.
|
|
13
6
|
places: (value) => MVXPlace.fromCache(value),
|
|
14
|
-
// `subPlaces` stores a DataSnapshot wrapping an MVXPlace[].
|
|
15
7
|
subPlaces: (value) => {
|
|
16
8
|
const snapshot = value;
|
|
17
9
|
if (!snapshot || !Array.isArray(snapshot.data))
|
|
@@ -19,39 +11,12 @@ const CACHE_DESERIALIZERS = {
|
|
|
19
11
|
return Object.assign(Object.assign({}, snapshot), { data: snapshot.data.map((place) => MVXPlace.fromCache(place)) });
|
|
20
12
|
},
|
|
21
13
|
};
|
|
22
|
-
/**
|
|
23
|
-
* CacheManager - Facade for managing multiple typed caches
|
|
24
|
-
*
|
|
25
|
-
* Replaces the old Cache singleton with a more flexible, configurable system.
|
|
26
|
-
* Supports:
|
|
27
|
-
* - Multiple cache types (places, routes, configurations, etc.)
|
|
28
|
-
* - Language-aware caching
|
|
29
|
-
* - Optional localStorage persistence
|
|
30
|
-
* - Configurable limits and TTL per cache type
|
|
31
|
-
*
|
|
32
|
-
* @group Configuration
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const cacheManager = new CacheManager({
|
|
37
|
-
* persistent: true,
|
|
38
|
-
* maxStorageBytes: 5 * 1024 * 1024,
|
|
39
|
-
* configs: {
|
|
40
|
-
* places: { maxItems: 1000, ttlMs: 60000 }
|
|
41
|
-
* }
|
|
42
|
-
* })
|
|
43
|
-
*
|
|
44
|
-
* cacheManager.setPlace("place-1", "en", placeData)
|
|
45
|
-
* const place = cacheManager.getPlace("place-1", "en")
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
14
|
export class CacheManager {
|
|
49
15
|
constructor(config) {
|
|
50
16
|
var _a, _b, _c;
|
|
51
17
|
this.caches = new Map();
|
|
52
18
|
this.persistent = (_a = config === null || config === void 0 ? void 0 : config.persistent) !== null && _a !== void 0 ? _a : false;
|
|
53
19
|
this.maxStorageBytes = (_b = config === null || config === void 0 ? void 0 : config.maxStorageBytes) !== null && _b !== void 0 ? _b : DEFAULT_MAX_STORAGE_BYTES;
|
|
54
|
-
// Initialize all cache types
|
|
55
20
|
const cacheTypes = [
|
|
56
21
|
"places",
|
|
57
22
|
"routes",
|
|
@@ -67,42 +32,22 @@ export class CacheManager {
|
|
|
67
32
|
this.caches.set(cacheType, this.createCache(cacheConfig, CACHE_DESERIALIZERS[cacheType]));
|
|
68
33
|
}
|
|
69
34
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Creates a cache instance based on persistence configuration.
|
|
72
|
-
*
|
|
73
|
-
* @param config - Per-type cache configuration.
|
|
74
|
-
* @param deserialize - Optional reviver forwarded to the persistent cache to
|
|
75
|
-
* rebuild class prototypes when values are rehydrated from localStorage.
|
|
76
|
-
*/
|
|
77
35
|
createCache(config, deserialize) {
|
|
78
36
|
if (this.persistent && config.persistenceKey) {
|
|
79
37
|
return new PersistentCache(config, this.maxStorageBytes, deserialize);
|
|
80
38
|
}
|
|
81
39
|
return new LRUCache(config);
|
|
82
40
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Generates a language-aware cache key
|
|
85
|
-
*/
|
|
86
41
|
makeKey(id, lang) {
|
|
87
42
|
return `${id}_${lang}`;
|
|
88
43
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Generates a composite key for configurations
|
|
91
|
-
*/
|
|
92
44
|
makeConfigKey(placeId, product, lang) {
|
|
93
45
|
return `${placeId || "default"}_${product || "default"}_${lang}`;
|
|
94
46
|
}
|
|
95
|
-
// ==================== Places ====================
|
|
96
47
|
getPlace(id, lang) {
|
|
97
48
|
const cache = this.caches.get("places");
|
|
98
49
|
return cache.get(this.makeKey(id, lang));
|
|
99
50
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Stores a place in cache
|
|
102
|
-
* @param id - Place ID
|
|
103
|
-
* @param value - Place data
|
|
104
|
-
* @param lang - Language code
|
|
105
|
-
*/
|
|
106
51
|
setPlace(id, value, lang) {
|
|
107
52
|
const cache = this.caches.get("places");
|
|
108
53
|
cache.set(this.makeKey(id, lang), value);
|
|
@@ -111,7 +56,6 @@ export class CacheManager {
|
|
|
111
56
|
const cache = this.caches.get("places");
|
|
112
57
|
return cache.has(this.makeKey(id, lang));
|
|
113
58
|
}
|
|
114
|
-
// ==================== Routes ====================
|
|
115
59
|
getRoute(destinationId) {
|
|
116
60
|
const cache = this.caches.get("routes");
|
|
117
61
|
return cache.get(destinationId);
|
|
@@ -123,7 +67,6 @@ export class CacheManager {
|
|
|
123
67
|
cleanRoutesCache() {
|
|
124
68
|
this.caches.get("routes").clear();
|
|
125
69
|
}
|
|
126
|
-
// ==================== Accessible Routes ====================
|
|
127
70
|
getAccessibleRoute(destinationId) {
|
|
128
71
|
const cache = this.caches.get("accessibleRoutes");
|
|
129
72
|
return cache.get(destinationId);
|
|
@@ -135,7 +78,6 @@ export class CacheManager {
|
|
|
135
78
|
cleanAccessibleRoutesCache() {
|
|
136
79
|
this.caches.get("accessibleRoutes").clear();
|
|
137
80
|
}
|
|
138
|
-
// ==================== Configurations ====================
|
|
139
81
|
getConfiguration(placeId, product, lang) {
|
|
140
82
|
const cache = this.caches.get("configurations");
|
|
141
83
|
return cache.get(this.makeConfigKey(placeId, product, lang));
|
|
@@ -144,7 +86,6 @@ export class CacheManager {
|
|
|
144
86
|
const cache = this.caches.get("configurations");
|
|
145
87
|
cache.set(this.makeConfigKey(placeId, product, lang), value);
|
|
146
88
|
}
|
|
147
|
-
// ==================== Categories ====================
|
|
148
89
|
getCategories(placeId, lang) {
|
|
149
90
|
const cache = this.caches.get("categories");
|
|
150
91
|
return cache.get(this.makeKey(placeId || "default", lang));
|
|
@@ -153,63 +94,35 @@ export class CacheManager {
|
|
|
153
94
|
const cache = this.caches.get("categories");
|
|
154
95
|
cache.set(this.makeKey(placeId || "default", lang), value);
|
|
155
96
|
}
|
|
156
|
-
// ==================== Vehicles ====================
|
|
157
97
|
getVehicle(id, lang) {
|
|
158
98
|
const cache = this.caches.get("vehicles");
|
|
159
99
|
return cache.get(this.makeKey(id, lang));
|
|
160
100
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Stores a vehicle in cache
|
|
163
|
-
* @param id - Stop ID
|
|
164
|
-
* @param value - Vehicle data (can be DataSnapshot for backward compatibility)
|
|
165
|
-
* @param lang - Language code
|
|
166
|
-
*/
|
|
167
101
|
setVehicle(id, value, lang) {
|
|
168
102
|
const cache = this.caches.get("vehicles");
|
|
169
103
|
cache.set(this.makeKey(id, lang), value);
|
|
170
104
|
}
|
|
171
|
-
// ==================== Stops ====================
|
|
172
105
|
getStops(id, lang) {
|
|
173
106
|
const cache = this.caches.get("stops");
|
|
174
107
|
return cache.get(this.makeKey(id, lang));
|
|
175
108
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Stores stops in cache
|
|
178
|
-
* @param id - Combined stop+vehicle ID
|
|
179
|
-
* @param value - Stops data (can be DataSnapshot for backward compatibility)
|
|
180
|
-
* @param lang - Language code
|
|
181
|
-
*/
|
|
182
109
|
setStops(id, value, lang) {
|
|
183
110
|
const cache = this.caches.get("stops");
|
|
184
111
|
cache.set(this.makeKey(id, lang), value);
|
|
185
112
|
}
|
|
186
|
-
// ==================== SubPlaces ====================
|
|
187
113
|
getSubPlaces(parentPlaceId, lang) {
|
|
188
114
|
const cache = this.caches.get("subPlaces");
|
|
189
115
|
return cache.get(this.makeKey(parentPlaceId, lang));
|
|
190
116
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Stores subplaces in cache
|
|
193
|
-
* @param parentPlaceId - Parent place ID
|
|
194
|
-
* @param lang - Language code
|
|
195
|
-
* @param value - SubPlaces data (can be DataSnapshot for backward compatibility)
|
|
196
|
-
*/
|
|
197
117
|
setSubPlaces(parentPlaceId, lang, value) {
|
|
198
118
|
const cache = this.caches.get("subPlaces");
|
|
199
119
|
cache.set(this.makeKey(parentPlaceId, lang), value);
|
|
200
120
|
}
|
|
201
|
-
// ==================== Global Operations ====================
|
|
202
|
-
/**
|
|
203
|
-
* Clears all caches
|
|
204
|
-
*/
|
|
205
121
|
cleanAllCache() {
|
|
206
122
|
for (const cache of this.caches.values()) {
|
|
207
123
|
cache.clear();
|
|
208
124
|
}
|
|
209
125
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Clears all entries for a specific language across all language-aware caches
|
|
212
|
-
*/
|
|
213
126
|
cleanLanguageCache(lang) {
|
|
214
127
|
const languageAwareCaches = [
|
|
215
128
|
"places",
|
|
@@ -230,9 +143,6 @@ export class CacheManager {
|
|
|
230
143
|
}
|
|
231
144
|
}
|
|
232
145
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Gets statistics for a specific cache type
|
|
235
|
-
*/
|
|
236
146
|
getCacheStats(cacheType) {
|
|
237
147
|
const cache = this.caches.get(cacheType);
|
|
238
148
|
if (!cache) {
|
|
@@ -240,9 +150,6 @@ export class CacheManager {
|
|
|
240
150
|
}
|
|
241
151
|
return cache.getStats();
|
|
242
152
|
}
|
|
243
|
-
/**
|
|
244
|
-
* Gets statistics for all caches
|
|
245
|
-
*/
|
|
246
153
|
getAllCacheStats() {
|
|
247
154
|
const stats = {};
|
|
248
155
|
for (const [cacheType, cache] of this.caches) {
|
|
@@ -251,4 +158,3 @@ export class CacheManager {
|
|
|
251
158
|
return stats;
|
|
252
159
|
}
|
|
253
160
|
}
|
|
254
|
-
//# sourceMappingURL=CacheManager.js.map
|