mobility-toolbox-js 2.0.0-beta.52 → 2.0.0-beta.54
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 +26 -3
- package/api/RealtimeAPI.d.ts +79 -84
- package/api/RealtimeAPI.d.ts.map +1 -1
- package/api/RealtimeAPI.js +102 -266
- package/common/api/WebSocketAPI.d.ts +13 -15
- package/common/api/WebSocketAPI.d.ts.map +1 -1
- package/common/controls/ControlCommon.d.ts +1 -1
- package/common/controls/ControlCommon.d.ts.map +1 -1
- package/common/layers/LayerCommon.d.ts +1 -0
- package/common/layers/LayerCommon.d.ts.map +1 -1
- package/common/layers/LayerCommon.js +3 -0
- package/common/mixins/RealtimeLayerMixin.d.ts +5 -5
- package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -1
- package/common/mixins/RealtimeLayerMixin.js +6 -6
- package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -1
- package/common/mixins/UserInteractionsLayerMixin.js +7 -10
- package/common/styles/realtimeDefaultStyle.d.ts +2 -2
- package/common/styles/realtimeDefaultStyle.d.ts.map +1 -1
- package/common/styles/realtimeDelayStyle.d.ts +2 -2
- package/common/styles/realtimeDelayStyle.d.ts.map +1 -1
- package/common/styles/realtimeSimpleStyle.d.ts +2 -1
- package/common/styles/realtimeSimpleStyle.d.ts.map +1 -1
- package/common/typedefs.js +3 -3
- package/common/utils/{createTrackerFilters.d.ts → createRealtimeFilters.d.ts} +3 -3
- package/common/utils/createRealtimeFilters.d.ts.map +1 -0
- package/common/utils/{createTrackerFilters.js → createRealtimeFilters.js} +2 -2
- package/common/utils/debounceDeparturesMessages.d.ts +12 -0
- package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
- package/common/utils/debounceDeparturesMessages.js +24 -0
- package/common/utils/debounceWebsocketMessages.d.ts +11 -0
- package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
- package/common/utils/debounceWebsocketMessages.js +29 -0
- package/common/utils/getMapboxRender.d.ts +3 -3
- package/common/utils/getMapboxRender.d.ts.map +1 -1
- package/common/utils/getMapboxRender.js +2 -1
- package/common/utils/getMaplibreRender.d.ts +3 -1
- package/common/utils/getMaplibreRender.d.ts.map +1 -1
- package/common/utils/getMaplibreRender.js +4 -4
- package/common/utils/getRealtimeModeSuffix.d.ts +4 -2
- package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -1
- package/common/utils/getUrlWithParams.d.ts +2 -2
- package/common/utils/getUrlWithParams.d.ts.map +1 -1
- package/common/utils/getVehiclePosition.d.ts +7 -5
- package/common/utils/getVehiclePosition.d.ts.map +1 -1
- package/common/utils/index.d.ts +5 -2
- package/common/utils/index.js +6 -3
- package/common/utils/realtimeConfig.d.ts +49 -0
- package/common/utils/realtimeConfig.d.ts.map +1 -0
- package/common/utils/{trackerConfig.js → realtimeConfig.js} +17 -17
- package/common/utils/sortAndFilterDepartures.d.ts +16 -0
- package/common/utils/sortAndFilterDepartures.d.ts.map +1 -0
- package/common/utils/sortAndFilterDepartures.js +58 -0
- package/common/utils/sortByDelay.d.ts +1 -1
- package/common/utils/sortByDelay.d.ts.map +1 -1
- package/common/utils/timeUtils.d.ts +23 -4
- package/common/utils/timeUtils.d.ts.map +1 -1
- package/common/utils/timeUtils.js +1 -1
- package/mapbox/layers/RealtimeLayer.d.ts +4 -4
- package/mbt.js +349 -410
- package/mbt.js.map +3 -3
- package/mbt.min.js +62 -62
- package/mbt.min.js.map +3 -3
- package/ol/controls/RoutingControl.d.ts +95 -91
- package/ol/controls/RoutingControl.d.ts.map +1 -1
- package/ol/controls/RoutingControl.js +100 -90
- package/ol/layers/Layer.d.ts +3 -2
- package/ol/layers/Layer.d.ts.map +1 -1
- package/ol/layers/Layer.js +2 -0
- package/ol/layers/MapGlLayer.d.ts.map +1 -1
- package/ol/layers/MapGlLayer.js +3 -5
- package/ol/layers/MapboxLayer.d.ts +1 -1
- package/ol/layers/MapboxLayer.d.ts.map +1 -1
- package/ol/layers/MapboxLayer.js +1 -0
- package/ol/layers/MapboxStyleLayer.js +4 -2
- package/ol/layers/MaplibreLayer.d.ts +2 -1
- package/ol/layers/MaplibreLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.d.ts +8 -6
- package/ol/layers/RealtimeLayer.d.ts.map +1 -1
- package/ol/layers/RealtimeLayer.js +3 -3
- package/ol/layers/RoutingLayer.d.ts +15 -5
- package/ol/layers/RoutingLayer.d.ts.map +1 -1
- package/ol/layers/RoutingLayer.js +3 -2
- package/ol/styles/fullTrajectoryStyle.d.ts +2 -2
- package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/types/common.d.ts +6 -1
- package/types/realtime.d.ts +0 -2
- package/common/utils/cleanStopTime.d.ts +0 -8
- package/common/utils/cleanStopTime.d.ts.map +0 -1
- package/common/utils/cleanStopTime.js +0 -25
- package/common/utils/createTrackerFilters.d.ts.map +0 -1
- package/common/utils/trackerConfig.d.ts +0 -24
- package/common/utils/trackerConfig.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -13,17 +13,40 @@ Visit https://mobility-toolbox-js.vercel.app/
|
|
|
13
13
|
|
|
14
14
|
## Demos
|
|
15
15
|
|
|
16
|
-
* Display [real-time vehicle positions and prognosis data](
|
|
16
|
+
* Display [real-time vehicle positions and prognosis data](https://mobility.portal.geops.io) on a map.
|
|
17
17
|
* Search for [stops and stations](https://maps.trafimage.ch) all over the world.
|
|
18
18
|
* Get [precise geographic courses](https://routing-demo.geops.io/) for all modes of transport.
|
|
19
19
|
* Generate beautiful [schematic](https://mobility.portal.geops.io/world.geops.networkplans) or [topographic](https://mobility.portal.geops.io) maps for public transport, mobility and logistics.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Install
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Install the library and the peer dependencies:
|
|
24
|
+
|
|
25
|
+
### Using mapbox-gl
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn add mobility-toolbox-js ol@6.14.1 mapbox-gl@1 maplibre-gl@npm:empty-npm-package@1.0.0
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Using maplibre-gl
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add mobility-toolbox-js ol@6.14.1 maplibre-gl@2 mapbox-gl@npm:empty-npm-package@1.0.0
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
yarn install
|
|
41
|
+
yarn dev
|
|
42
|
+
```
|
|
24
43
|
|
|
25
44
|
## Deploy
|
|
26
45
|
|
|
27
46
|
This library website is deployed automatically using [Vercel](https://vercel.com/geops).
|
|
28
47
|
For Vercel we have to add the nextjs and raw-loader modules in the dev dependencies of the main package.json.
|
|
29
48
|
But those 2 librairies are not need to build the library.
|
|
49
|
+
|
|
50
|
+
## Version 1.x.x
|
|
51
|
+
|
|
52
|
+
The master branch is now open for the version 2 development. The version 1 is still available in [1.x.x](https://github.com/geops/mobility-toolbox-js/tree/1.x.x) branch.
|
package/api/RealtimeAPI.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import WebSocketAPI, {
|
|
2
|
-
import { RealtimeMode, RealtimeDeparture, RealtimeNews,
|
|
1
|
+
import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData } from '../common/api/WebSocketAPI';
|
|
2
|
+
import { RealtimeMode, RealtimeDeparture, RealtimeNews, RealtimeStation, RealtimeExtraGeom, RealtimeTrainId, RealtimeGeneralizationLevel, RealtimeFullTrajectory, RealtimeTrajectoryResponse, RealtimeStationId } from '../types';
|
|
3
|
+
import { StopSequence } from './typedefs';
|
|
3
4
|
export declare type RealtimeAPIOptions = {
|
|
4
5
|
url?: string;
|
|
5
6
|
apiKey?: string;
|
|
@@ -15,6 +16,11 @@ export declare type RealtimeAPIExtraGeomsById = {
|
|
|
15
16
|
export declare type RealtimeAPIDeparturesById = {
|
|
16
17
|
[index: string]: RealtimeDeparture;
|
|
17
18
|
};
|
|
19
|
+
export declare type RealtimeModesType = {
|
|
20
|
+
RAW: RealtimeMode;
|
|
21
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
22
|
+
SCHEMATIC: RealtimeMode;
|
|
23
|
+
};
|
|
18
24
|
/**
|
|
19
25
|
* Enum for Realtime modes.
|
|
20
26
|
* @readonly
|
|
@@ -25,9 +31,9 @@ export declare type RealtimeAPIDeparturesById = {
|
|
|
25
31
|
* @enum {RealtimeMode}
|
|
26
32
|
*/
|
|
27
33
|
export declare const RealtimeModes: {
|
|
28
|
-
RAW:
|
|
29
|
-
TOPOGRAPHIC:
|
|
30
|
-
SCHEMATIC:
|
|
34
|
+
RAW: RealtimeMode;
|
|
35
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
36
|
+
SCHEMATIC: RealtimeMode;
|
|
31
37
|
};
|
|
32
38
|
/**
|
|
33
39
|
* This class provides convenience methods to access to the [geOps realtime api](https://developer.geops.io/apis/realtime/).
|
|
@@ -51,17 +57,11 @@ declare class RealtimeAPI {
|
|
|
51
57
|
projection?: string;
|
|
52
58
|
bbox?: (number | string)[];
|
|
53
59
|
buffer?: number[];
|
|
54
|
-
subscribedStationUic?: number;
|
|
55
|
-
maxDepartureAge: number;
|
|
56
60
|
prefix: string;
|
|
57
|
-
extraGeoms: RealtimeAPIExtraGeomsById;
|
|
58
|
-
departureUpdateTimeout?: number;
|
|
59
61
|
pingInterval: number;
|
|
60
62
|
pingIntervalMs: number;
|
|
61
63
|
reconnectTimeout?: number;
|
|
62
64
|
reconnectTimeoutMs?: number;
|
|
63
|
-
stationUpdateTimeout?: number;
|
|
64
|
-
fullTrajectoryUpdateTimeout?: number;
|
|
65
65
|
/**
|
|
66
66
|
* Constructor
|
|
67
67
|
*
|
|
@@ -102,183 +102,178 @@ declare class RealtimeAPI {
|
|
|
102
102
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
103
103
|
* @private
|
|
104
104
|
*/
|
|
105
|
-
subscribe(channel: string, onSuccess:
|
|
105
|
+
subscribe(channel: string, onSuccess: WebSocketAPIMessageCallback<any>, onError?: EventListener, quiet?: boolean): void;
|
|
106
106
|
/**
|
|
107
107
|
* Unsubscribe both modes of a channel.
|
|
108
108
|
*
|
|
109
109
|
* @param {string} channel Name of the websocket channel to unsubscribe.
|
|
110
110
|
* @param {string} suffix Suffix to add to the channel name.
|
|
111
|
-
* @param {function}
|
|
112
|
-
* @private
|
|
113
|
-
*/
|
|
114
|
-
unsubscribe(channel: string, suffix?: string, cb?: WebSocketAPIDataCallback): void;
|
|
115
|
-
/**
|
|
116
|
-
* Filter departures and return an array.
|
|
117
|
-
*
|
|
118
|
-
* @param {Object} depObject The object containing departures by id.
|
|
119
|
-
* @param {boolean} [sortByMinArrivalTime=false] If true sort departures by arrival time.
|
|
120
|
-
* @return {Array<Departure>} Return departures array.
|
|
111
|
+
* @param {function} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
121
112
|
* @private
|
|
122
113
|
*/
|
|
123
|
-
|
|
114
|
+
unsubscribe(channel: string, suffix?: string, onMessage?: WebSocketAPIMessageCallback<any>): void;
|
|
124
115
|
/**
|
|
125
116
|
* Subscribe to departures channel of a given station.
|
|
126
117
|
*
|
|
127
118
|
* @param {number} stationId UIC of the station.
|
|
128
119
|
* @param {Boolean} sortByMinArrivalTime Sort by minimum arrival time
|
|
129
120
|
* @param {function(departures:Departure[])} onMessage Function called on each message of the channel.
|
|
121
|
+
* @param {function} onError Callback when the subscription fails.
|
|
122
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
130
123
|
*/
|
|
131
|
-
subscribeDepartures(stationId: number,
|
|
124
|
+
subscribeDepartures(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
132
125
|
/**
|
|
133
126
|
* Unsubscribe from current departures channel.
|
|
134
|
-
* @param {
|
|
127
|
+
* @param {RealtimeStationId} id Station's id
|
|
128
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
135
129
|
*/
|
|
136
|
-
unsubscribeDepartures(
|
|
130
|
+
unsubscribeDepartures(id: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
137
131
|
/**
|
|
138
132
|
* Subscribe to the disruptions channel for tenant.
|
|
139
133
|
*
|
|
140
|
-
* @param {function(
|
|
134
|
+
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
135
|
+
* @param {function} onError Callback when the subscription fails.
|
|
136
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
141
137
|
*/
|
|
142
|
-
subscribeDisruptions(onMessage:
|
|
138
|
+
subscribeDisruptions(onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
143
139
|
/**
|
|
144
140
|
* Unsubscribe disruptions.
|
|
145
|
-
*
|
|
141
|
+
*
|
|
142
|
+
* @param {function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
146
143
|
*/
|
|
147
|
-
unsubscribeDisruptions(
|
|
144
|
+
unsubscribeDisruptions(onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
|
|
148
145
|
/**
|
|
149
146
|
* Return a station with a given uic number and a mode.
|
|
150
147
|
*
|
|
151
148
|
* @param {number} uic UIC of the station.
|
|
152
149
|
* @param {RealtimeMode} mode Realtime mode.
|
|
153
|
-
* @return {Promise<
|
|
150
|
+
* @return {Promise<{data: { content: RealtimeStation }}>} A station.
|
|
154
151
|
*/
|
|
155
|
-
getStation(uic:
|
|
152
|
+
getStation(uic: RealtimeStationId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeStation>>;
|
|
156
153
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
154
|
+
* Get the list of ststions available for a specifc mode. The promise is resolved every 100ms
|
|
159
155
|
* @param {RealtimeMode} mode Realtime mode.
|
|
160
|
-
* @
|
|
156
|
+
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
157
|
+
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
161
158
|
*/
|
|
162
|
-
getStations(mode: RealtimeMode): Promise<
|
|
159
|
+
getStations(mode: RealtimeMode, timeout?: number): Promise<RealtimeStation[]>;
|
|
163
160
|
/**
|
|
164
161
|
* Subscribe to stations channel.
|
|
165
162
|
* One message pro station.
|
|
166
163
|
*
|
|
167
164
|
* @param {RealtimeMode} mode Realtime mode.
|
|
168
|
-
* @param {function(
|
|
165
|
+
* @param {function(data: { content: RealtimeStation })} onMessage Function called on each message of the channel.
|
|
166
|
+
* @param {function} onError Callback when the subscription fails.
|
|
167
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
169
168
|
*/
|
|
170
|
-
subscribeStations(mode: RealtimeMode, onMessage:
|
|
169
|
+
subscribeStations(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeStation>, onError?: EventListener, quiet?: boolean): void;
|
|
171
170
|
/**
|
|
172
171
|
* Unsubscribe to stations channel.
|
|
173
|
-
* @param {function}
|
|
172
|
+
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
174
173
|
*/
|
|
175
|
-
unsubscribeStations(
|
|
174
|
+
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
176
175
|
/**
|
|
177
176
|
* Subscribe to extra_geoms channel.
|
|
178
177
|
*
|
|
179
|
-
* @param {function(
|
|
178
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Function called on each message of the channel.
|
|
179
|
+
* @param {function} onError Callback when the subscription fails.
|
|
180
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
180
181
|
*/
|
|
181
|
-
subscribeExtraGeoms(onMessage:
|
|
182
|
+
subscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>, onError?: EventListener, quiet?: boolean): void;
|
|
182
183
|
/**
|
|
183
184
|
* Unsubscribe to extra_geoms channel.
|
|
184
|
-
* @param {function}
|
|
185
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
185
186
|
*/
|
|
186
|
-
unsubscribeExtraGeoms(
|
|
187
|
+
unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
|
|
187
188
|
/**
|
|
188
189
|
* Subscribe to trajectory channel.
|
|
189
190
|
*
|
|
190
191
|
* @param {RealtimeMode} mode Realtime mode.
|
|
191
|
-
* @param {function(
|
|
192
|
-
* @param {
|
|
192
|
+
* @param {function(data: { content: RealtimeTrajectoryResponse[] })} onMessage Function called on each message of the channel.
|
|
193
|
+
* @param {function} onError Callback when the subscription fails.
|
|
194
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
193
195
|
*/
|
|
194
|
-
subscribeTrajectory(mode: RealtimeMode, onMessage:
|
|
196
|
+
subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrajectoryResponse[]>, onError?: EventListener, quiet?: boolean): void;
|
|
195
197
|
/**
|
|
196
198
|
* Unsubscribe to trajectory channels.
|
|
197
|
-
* @param {function}
|
|
199
|
+
* @param {function(data: { content: RealtimeTrajectoryResponse[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
198
200
|
*/
|
|
199
|
-
unsubscribeTrajectory(
|
|
201
|
+
unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectoryResponse[]>): void;
|
|
200
202
|
/**
|
|
201
203
|
* Subscribe to deleted_vhicles channel.
|
|
202
204
|
*
|
|
203
205
|
* @param {RealtimeMode} mode Realtime mode.
|
|
204
|
-
* @param {function(
|
|
205
|
-
* @param {
|
|
206
|
+
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
207
|
+
* @param {function} onError Callback when the subscription fails.
|
|
208
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
206
209
|
*/
|
|
207
|
-
subscribeDeletedVehicles(mode: RealtimeMode, onMessage:
|
|
210
|
+
subscribeDeletedVehicles(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>, onError?: EventListener, quiet?: boolean): void;
|
|
208
211
|
/**
|
|
209
212
|
* Unsubscribe to deleted_vhicles channels.
|
|
210
|
-
* @param {function}
|
|
213
|
+
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
211
214
|
*/
|
|
212
|
-
unsubscribeDeletedVehicles(
|
|
215
|
+
unsubscribeDeletedVehicles(onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>): void;
|
|
213
216
|
/**
|
|
214
217
|
* Get a full trajectory of a vehicule .
|
|
215
218
|
*
|
|
216
219
|
* @param {string} id A vehicle id.
|
|
217
220
|
* @param {RealtimeMode} mode Realtime mode.
|
|
218
221
|
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
219
|
-
* @return {Promise<FullTrajectory>} Return a full trajectory.
|
|
220
|
-
*/
|
|
221
|
-
getFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, generalizationLevel: RealtimeGeneralizationLevel | undefined): Promise<RealtimeFullTrajectory>;
|
|
222
|
-
/**
|
|
223
|
-
* Get full trajectories of a vehicules .
|
|
224
|
-
*
|
|
225
|
-
* @param {string[]} ids List of vehicles ids.
|
|
226
|
-
* @param {RealtimeMode} mode Realtime mode.
|
|
227
|
-
* @param {string} generalizationLevel The generalization level to request. Can be one of '', 'gen5', 'gen10', 'gen30', 'gen100'.
|
|
228
|
-
* @return {Promise<Array<FullTrajectory>>} Return an array of full trajectories.
|
|
222
|
+
* @return {Promise<{ data: { content: FullTrajectory } }>} Return a full trajectory.
|
|
229
223
|
*/
|
|
230
|
-
|
|
224
|
+
getFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, generalizationLevel: RealtimeGeneralizationLevel | undefined): Promise<WebSocketAPIMessageEventData<RealtimeFullTrajectory>>;
|
|
231
225
|
/**
|
|
232
226
|
* Subscribe to full_trajectory channel of a given vehicle.
|
|
233
227
|
*
|
|
234
228
|
* @param {string} id A vehicle id.
|
|
235
229
|
* @param {RealtimeMode} mode Realtime mode.
|
|
230
|
+
* @param {function(data: { content: RealtimeFullTrajectory })} onMessage Function called on each message of the channel.
|
|
231
|
+
* @param {function} onError Callback when the subscription fails.
|
|
232
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
236
233
|
*/
|
|
237
|
-
subscribeFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode): void;
|
|
234
|
+
subscribeFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeFullTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
238
235
|
/**
|
|
239
236
|
* Unsubscribe from full_trajectory channel
|
|
240
237
|
*
|
|
241
238
|
* @param {string} id A vehicle id.
|
|
242
|
-
* @param {function}
|
|
239
|
+
* @param {function(data: { content: RealtimeFullTrajectory })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
243
240
|
*/
|
|
244
|
-
unsubscribeFullTrajectory(id: RealtimeTrainId,
|
|
241
|
+
unsubscribeFullTrajectory(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeFullTrajectory>): void;
|
|
245
242
|
/**
|
|
246
243
|
* Get the list of stops for this vehicle.
|
|
247
244
|
*
|
|
248
245
|
* @param {string} id A vehicle id.
|
|
249
|
-
* @return {Promise<StopSequence>} Returns a stop sequence object.
|
|
250
|
-
*/
|
|
251
|
-
getStopSequence(id: RealtimeTrainId): Promise<unknown>;
|
|
252
|
-
/**
|
|
253
|
-
* Get a list of stops for a list of vehicles.
|
|
254
|
-
*
|
|
255
|
-
* @param {string[]} ids List of vehicles ids.
|
|
256
|
-
* @return {Promise<Array<StopSequence>>} Return an array of stop sequences.
|
|
246
|
+
* @return {Promise<{ data: { content: StopSequence[] } }>} Returns a stop sequence object.
|
|
257
247
|
*/
|
|
258
|
-
|
|
248
|
+
getStopSequence(id: RealtimeTrainId): Promise<WebSocketAPIMessageEventData<StopSequence[]>>;
|
|
259
249
|
/**
|
|
260
250
|
* Subscribe to stopsequence channel of a given vehicle.
|
|
261
251
|
*
|
|
262
252
|
* @param {string} id A vehicle id.
|
|
263
|
-
* @param {function(
|
|
253
|
+
* @param {function(data: { content: StopSequence[] })} onMessage Function called on each message of the channel.
|
|
254
|
+
* @param {function} onError Callback when the subscription fails.
|
|
255
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
264
256
|
*/
|
|
265
|
-
subscribeStopSequence(id: RealtimeTrainId, onMessage:
|
|
257
|
+
subscribeStopSequence(id: RealtimeTrainId, onMessage: WebSocketAPIMessageCallback<StopSequence[]>, onError?: EventListener, quiet?: boolean): void;
|
|
266
258
|
/**
|
|
267
259
|
* Unsubscribe from stopsequence channel
|
|
268
260
|
*
|
|
269
261
|
* @param {string} id A vehicle id.
|
|
270
|
-
* @param {function}
|
|
262
|
+
* @param {function(data: { content: StopSequence[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
271
263
|
*/
|
|
272
|
-
unsubscribeStopSequence(id: RealtimeTrainId,
|
|
264
|
+
unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<StopSequence[]>): void;
|
|
273
265
|
/**
|
|
274
266
|
* Subscribe to healthcheck channel.
|
|
275
|
-
* @param {function} onMessage Callback when the subscribe to healthcheck channel succeeds.
|
|
267
|
+
* @param {function(data: { content: string })} onMessage Callback when the subscribe to healthcheck channel succeeds.
|
|
268
|
+
* @param {function} onError Callback when the subscription fails.
|
|
269
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
276
270
|
*/
|
|
277
|
-
subscribeHealthCheck(onMessage:
|
|
271
|
+
subscribeHealthCheck(onMessage: WebSocketAPIMessageCallback<string>, onError?: EventListener, quiet?: boolean): void;
|
|
278
272
|
/**
|
|
279
273
|
* Unsubscribe to healthcheck channel.
|
|
274
|
+
* @param {function(data: { content: string })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
280
275
|
*/
|
|
281
|
-
unsubscribeHealthCheck(): void;
|
|
276
|
+
unsubscribeHealthCheck(onMessage?: WebSocketAPIMessageCallback<string>): void;
|
|
282
277
|
}
|
|
283
278
|
export default RealtimeAPI;
|
|
284
279
|
//# sourceMappingURL=RealtimeAPI.d.ts.map
|
package/api/RealtimeAPI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealtimeAPI.d.ts","sourceRoot":"","sources":["../../src/api/RealtimeAPI.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EACnB,
|
|
1
|
+
{"version":3,"file":"RealtimeAPI.d.ts","sourceRoot":"","sources":["../../src/api/RealtimeAPI.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,oBAAY,kBAAkB,GA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