mobility-toolbox-js 3.0.0-beta.9 → 3.0.0
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 +11 -3
- package/api/HttpAPI.d.ts +5 -16
- package/api/HttpAPI.js +1 -14
- package/api/RealtimeAPI.d.ts +188 -143
- package/api/RealtimeAPI.js +265 -206
- package/api/RoutingAPI.d.ts +21 -11
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +20 -14
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -165
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +0 -102
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +13 -13
- package/common/controls/StopFinderControlCommon.js +32 -32
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/styles/realtimeDefaultStyle.js +6 -11
- package/common/styles/realtimeHeadingStyle.js +5 -10
- package/common/styles/realtimeSimpleStyle.d.ts +0 -1
- package/common/styles/realtimeSimpleStyle.js +0 -1
- package/common/typedefs.d.ts +11 -121
- package/common/typedefs.js +6 -31
- package/common/utils/RealtimeEngine.d.ts +214 -0
- package/common/utils/RealtimeEngine.js +554 -0
- package/common/utils/compareDepartures.d.ts +2 -2
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/debounceWebsocketMessages.d.ts +1 -1
- package/common/utils/getLayersAsFlatArray.d.ts +0 -1
- package/common/utils/getLayersAsFlatArray.js +0 -1
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getVehiclePosition.d.ts +5 -4
- package/common/utils/getVehiclePosition.js +6 -3
- package/common/utils/realtimeConfig.d.ts +1 -1
- package/common/utils/realtimeConfig.js +0 -1
- package/common/utils/renderTrajectories.d.ts +2 -1
- package/common/utils/renderTrajectories.js +7 -6
- package/common/utils/sortAndFilterDepartures.d.ts +2 -1
- package/common/utils/sortAndFilterDepartures.js +2 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/controls/CopyrightControl.d.ts +9 -6
- package/maplibre/controls/CopyrightControl.js +11 -8
- package/maplibre/layers/Layer.d.ts +8 -7
- package/maplibre/layers/Layer.js +2 -3
- package/maplibre/layers/RealtimeLayer.d.ts +82 -118
- package/maplibre/layers/RealtimeLayer.js +154 -118
- package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
- package/maplibre/utils/getSourceCoordinates.js +6 -5
- package/mbt.js +14611 -14591
- package/mbt.js.map +4 -4
- package/mbt.min.js +75 -75
- package/mbt.min.js.map +4 -4
- package/ol/controls/CopyrightControl.d.ts +13 -5
- package/ol/controls/CopyrightControl.js +13 -5
- package/ol/controls/RoutingControl.d.ts +105 -101
- package/ol/controls/RoutingControl.js +250 -264
- package/ol/controls/StopFinderControl.d.ts +24 -5
- package/ol/controls/StopFinderControl.js +24 -5
- package/ol/layers/Layer.d.ts +26 -0
- package/ol/layers/Layer.js +39 -0
- package/ol/layers/MaplibreLayer.d.ts +56 -28
- package/ol/layers/MaplibreLayer.js +154 -31
- package/ol/layers/MaplibreStyleLayer.d.ts +71 -149
- package/ol/layers/MaplibreStyleLayer.js +281 -210
- package/ol/layers/RealtimeLayer.d.ts +95 -230
- package/ol/layers/RealtimeLayer.js +209 -211
- package/ol/layers/VectorLayer.d.ts +17 -0
- package/ol/layers/VectorLayer.js +33 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +7 -7
- package/ol/renderers/RealtimeLayerRenderer.js +46 -66
- package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
- package/ol/styles/fullTrajectoryStyle.d.ts +1 -2
- package/ol/styles/fullTrajectoryStyle.js +5 -7
- package/ol/styles/routingStyle.d.ts +0 -1
- package/ol/styles/routingStyle.js +13 -10
- package/ol/utils/defineDeprecatedProperties.d.ts +10 -0
- package/ol/utils/defineDeprecatedProperties.js +180 -0
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +44 -44
- package/setupTests.js +17 -4
- package/types/common.d.ts +53 -69
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +98 -95
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/common/mixins/RealtimeLayerMixin.d.ts +0 -273
- package/common/mixins/RealtimeLayerMixin.js +0 -743
- package/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
- package/ol/mixins/MobilityLayerMixin.d.ts +0 -98
- package/ol/mixins/MobilityLayerMixin.js +0 -6
- package/ol/mixins/PropertiesLayerMixin.d.ts +0 -127
- package/ol/mixins/PropertiesLayerMixin.js +0 -143
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The tools in this library have been inspired by many projects realized for publi
|
|
|
10
10
|
|
|
11
11
|
## Documentation and examples
|
|
12
12
|
|
|
13
|
-
Visit https://mobility-toolbox-js.
|
|
13
|
+
Visit https://mobility-toolbox-js.geops.io/
|
|
14
14
|
|
|
15
15
|
## Demos
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ Visit https://mobility-toolbox-js.vercel.app/
|
|
|
24
24
|
Install the library and the peer dependencies:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
yarn add mobility-toolbox-js
|
|
27
|
+
yarn add ol maplibre-gl mobility-toolbox-js
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Development
|
|
@@ -34,9 +34,17 @@ yarn install
|
|
|
34
34
|
yarn dev
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
`yarn dev` starts a vite server using the `index.html` file at the root of the project.
|
|
38
|
+
This html file loads the `dev.js` file. Use this file to develop the library.
|
|
39
|
+
Each time you modifiy the library code you have to run `yarn build:tsc` to see the changes.
|
|
40
|
+
|
|
41
|
+
## Development documentation
|
|
42
|
+
|
|
43
|
+
The documentations website is located in the `doc/` folder.
|
|
44
|
+
It's a nextJS website that use the mobility-toolbox-js library built from the `build/` folder.
|
|
45
|
+
|
|
37
46
|
## Deploy
|
|
38
47
|
|
|
39
48
|
This library website is deployed automatically using [Vercel](https://vercel.com/geops).
|
|
40
49
|
For Vercel we have to add the nextjs and raw-loader modules in the dev dependencies of the main package.json.
|
|
41
50
|
But those 2 librairies are not needed to build the library.
|
|
42
|
-
|
package/api/HttpAPI.d.ts
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
url: string;
|
|
1
|
+
export interface HttpAPIOptions {
|
|
3
2
|
apiKey?: string;
|
|
4
|
-
|
|
3
|
+
url: string;
|
|
4
|
+
}
|
|
5
5
|
/**
|
|
6
6
|
* Common class to access to a geOps api using http.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* import { API } from 'mobility-toolbox-js/api';
|
|
10
|
-
*
|
|
11
|
-
* const api = new HttpApi({
|
|
12
|
-
* url: [yourUrl],
|
|
13
|
-
* apiKey: [yourApiKey]
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* @classproperty {string} url Url of the service.
|
|
17
|
-
* @classproperty {string} apiKey Api key to access the service.
|
|
18
7
|
* @private
|
|
19
8
|
*/
|
|
20
9
|
declare class HttpAPI {
|
|
21
|
-
url: string;
|
|
22
10
|
apiKey?: string;
|
|
11
|
+
url: string;
|
|
23
12
|
constructor(options: HttpAPIOptions);
|
|
24
13
|
/**
|
|
25
14
|
* Append the apiKey before sending the request.
|
|
26
15
|
*
|
|
27
16
|
* @private
|
|
28
17
|
*/
|
|
29
|
-
fetch(path: string, params:
|
|
18
|
+
fetch(path: string, params: object, config: RequestInit): Promise<any>;
|
|
30
19
|
}
|
|
31
20
|
export default HttpAPI;
|
package/api/HttpAPI.js
CHANGED
|
@@ -10,24 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import getUrlWithParams from '../common/utils/getUrlWithParams';
|
|
11
11
|
/**
|
|
12
12
|
* Common class to access to a geOps api using http.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* import { API } from 'mobility-toolbox-js/api';
|
|
16
|
-
*
|
|
17
|
-
* const api = new HttpApi({
|
|
18
|
-
* url: [yourUrl],
|
|
19
|
-
* apiKey: [yourApiKey]
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* @classproperty {string} url Url of the service.
|
|
23
|
-
* @classproperty {string} apiKey Api key to access the service.
|
|
24
13
|
* @private
|
|
25
14
|
*/
|
|
26
15
|
class HttpAPI {
|
|
27
16
|
constructor(options) {
|
|
28
|
-
/** @private */
|
|
29
17
|
this.url = options.url;
|
|
30
|
-
/** @private */
|
|
31
18
|
this.apiKey = options.apiKey;
|
|
32
19
|
}
|
|
33
20
|
/**
|
|
@@ -40,7 +27,7 @@ class HttpAPI {
|
|
|
40
27
|
if (!this.url) {
|
|
41
28
|
throw new Error(`No url defined for request to ${this.url}/${path}`);
|
|
42
29
|
}
|
|
43
|
-
if (!this.url && !this.apiKey &&
|
|
30
|
+
if (!this.url && !this.apiKey && !this.url.includes('key=')) {
|
|
44
31
|
// eslint-disable-next-line no-console
|
|
45
32
|
throw new Error(`No apiKey defined for request to ${this.url}`);
|
|
46
33
|
}
|
package/api/RealtimeAPI.d.ts
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData, WebSocketAPIParameters } from './WebSocketAPI';
|
|
2
|
-
import type {
|
|
3
|
-
import { StopSequence } from './typedefs';
|
|
2
|
+
import type { RealtimeBbox, RealtimeDeparture, RealtimeExtraGeom, RealtimeFullTrajectory, RealtimeGeneralizationLevel, RealtimeMode, RealtimeNews, RealtimeStation, RealtimeStationId, RealtimeStopSequence, RealtimeTenant, RealtimeTrainId, RealtimeTrajectory, RealtimeVersion } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* @typedef RealtimeAPIOptions
|
|
6
5
|
*/
|
|
7
|
-
export
|
|
8
|
-
url?: string;
|
|
6
|
+
export interface RealtimeAPIOptions {
|
|
9
7
|
apiKey?: string;
|
|
10
|
-
version?: RealtimeVersion;
|
|
11
8
|
bbox?: RealtimeBbox;
|
|
12
9
|
buffer?: number[];
|
|
13
10
|
pingIntervalMs?: number;
|
|
14
11
|
reconnectTimeoutMs?: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type RealtimeAPIDeparturesById =
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export type RealtimeModesType = {
|
|
12
|
+
url?: string;
|
|
13
|
+
version?: RealtimeVersion;
|
|
14
|
+
}
|
|
15
|
+
export type RealtimeAPIExtraGeomsById = Record<string, RealtimeExtraGeom>;
|
|
16
|
+
export type RealtimeAPIDeparturesById = Record<string, RealtimeDeparture>;
|
|
17
|
+
export interface RealtimeModesType {
|
|
23
18
|
RAW: RealtimeMode;
|
|
24
|
-
TOPOGRAPHIC: RealtimeMode;
|
|
25
19
|
SCHEMATIC: RealtimeMode;
|
|
26
|
-
|
|
20
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
21
|
+
}
|
|
27
22
|
/**
|
|
28
23
|
* Enum for Realtime modes.
|
|
29
24
|
* @readonly
|
|
@@ -32,14 +27,15 @@ export type RealtimeModesType = {
|
|
|
32
27
|
* @property {string} SCHEMATIC "schematic"
|
|
33
28
|
* @property {string} TOPOGRAPHIC "topographic"
|
|
34
29
|
* @enum {RealtimeMode}
|
|
30
|
+
* @public
|
|
35
31
|
*/
|
|
36
32
|
export declare const RealtimeModes: {
|
|
37
33
|
RAW: RealtimeMode;
|
|
38
|
-
TOPOGRAPHIC: RealtimeMode;
|
|
39
34
|
SCHEMATIC: RealtimeMode;
|
|
35
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
40
36
|
};
|
|
41
37
|
/**
|
|
42
|
-
* This class provides convenience methods to use to the [geOps
|
|
38
|
+
* This class provides convenience methods to use to the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
43
39
|
*
|
|
44
40
|
* @example
|
|
45
41
|
* import { RealtimeAPI } from 'mobility-toolbox-js/api';
|
|
@@ -50,19 +46,32 @@ export declare const RealtimeModes: {
|
|
|
50
46
|
* // url: "wss://api.geops.io/tracker-ws/v1/",
|
|
51
47
|
* });
|
|
52
48
|
*
|
|
49
|
+
* // Open the websocket connection
|
|
53
50
|
* api.open();
|
|
54
51
|
*
|
|
52
|
+
* // Subscribe to channel
|
|
55
53
|
* api.subscribeTrajectory('topographic', (data) => {
|
|
56
54
|
* console.log('Log trajectories:', JSON.stringify(data.content));
|
|
57
55
|
* });
|
|
58
56
|
*
|
|
57
|
+
* // Close the websocket connection
|
|
58
|
+
* api.close();
|
|
59
|
+
*
|
|
59
60
|
* @public
|
|
60
61
|
*/
|
|
61
62
|
declare class RealtimeAPI {
|
|
62
|
-
_url: string;
|
|
63
|
-
get url(): string;
|
|
64
|
-
set url(newUrl: string);
|
|
65
63
|
_bbox?: RealtimeBbox;
|
|
64
|
+
_buffer?: number[];
|
|
65
|
+
_url: string;
|
|
66
|
+
version: RealtimeVersion;
|
|
67
|
+
wsApi: WebSocketAPI;
|
|
68
|
+
/**
|
|
69
|
+
* This callback type is called `requestCallback` and is displayed as a global symbol.
|
|
70
|
+
*
|
|
71
|
+
* @callback onFullTrajectoryMessageCallback
|
|
72
|
+
* @param {number} responseCode
|
|
73
|
+
* @param {string} responseMessage
|
|
74
|
+
*/
|
|
66
75
|
/**
|
|
67
76
|
* The bounding box to receive data from.\
|
|
68
77
|
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
@@ -95,11 +104,10 @@ declare class RealtimeAPI {
|
|
|
95
104
|
*/
|
|
96
105
|
get bbox(): RealtimeBbox | undefined;
|
|
97
106
|
set bbox(newBbox: RealtimeBbox | undefined);
|
|
98
|
-
_buffer?: number[];
|
|
99
107
|
get buffer(): number[] | undefined;
|
|
100
108
|
set buffer(newBuffer: number[] | undefined);
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
get url(): string;
|
|
110
|
+
set url(newUrl: string);
|
|
103
111
|
private pingInterval;
|
|
104
112
|
private pingIntervalMs;
|
|
105
113
|
private reconnectTimeout?;
|
|
@@ -107,35 +115,71 @@ declare class RealtimeAPI {
|
|
|
107
115
|
/**
|
|
108
116
|
* Constructor
|
|
109
117
|
*
|
|
110
|
-
* @param {Object} options
|
|
111
|
-
* @param {string} options.url Url to the [geOps realtime API](https://developer.geops.io/apis/realtime/).
|
|
118
|
+
* @param {Object} options Options.
|
|
112
119
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
113
120
|
* @param {string[]} options.bbox The bounding box to receive data from.
|
|
121
|
+
* @param {string} [options.url='wss://api.geops.io/tracker-ws/v1/'] Url of the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
114
122
|
* @public
|
|
115
123
|
*/
|
|
116
124
|
constructor(options?: RealtimeAPIOptions);
|
|
117
125
|
/**
|
|
118
|
-
*
|
|
126
|
+
* Close the websocket connection without reconnection.
|
|
119
127
|
*
|
|
120
128
|
* @public
|
|
121
129
|
*/
|
|
122
|
-
|
|
130
|
+
close(): void;
|
|
123
131
|
/**
|
|
124
|
-
*
|
|
132
|
+
* Send GET to a channel.
|
|
125
133
|
*
|
|
134
|
+
* @param {string | WebSocketAPIParameters} channelOrParams Name of the websocket channel to send GET or an object representing parameters to send
|
|
135
|
+
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
126
136
|
* @public
|
|
127
137
|
*/
|
|
128
|
-
|
|
138
|
+
get(channelOrParams: string | WebSocketAPIParameters): Promise<WebSocketAPIMessageEventData<any>>;
|
|
129
139
|
/**
|
|
130
|
-
*
|
|
140
|
+
* Get a full trajectory of a vehicule .
|
|
141
|
+
*
|
|
142
|
+
* @param {string} id A vehicle id.
|
|
143
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
144
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
145
|
+
* @return {Promise<{data: { content: RealtimeFullTrajectory }}>} Return a full trajectory.
|
|
146
|
+
* @public
|
|
131
147
|
*/
|
|
132
|
-
|
|
148
|
+
getFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, generalizationLevel: RealtimeGeneralizationLevel | undefined): Promise<WebSocketAPIMessageEventData<RealtimeFullTrajectory>>;
|
|
133
149
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* @
|
|
150
|
+
* Return a station with a given uic number and a mode.
|
|
151
|
+
*
|
|
152
|
+
* @param {number} uic UIC of the station.
|
|
153
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
154
|
+
* @return {Promise<{data: { content: RealtimeStation }}>} A station.
|
|
155
|
+
* @public
|
|
137
156
|
*/
|
|
138
|
-
|
|
157
|
+
getStation(uic: RealtimeStationId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeStation>>;
|
|
158
|
+
/**
|
|
159
|
+
* Get the list of ststions available for a specifc mode. The promise is resolved every 100ms
|
|
160
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
161
|
+
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
162
|
+
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
getStations(mode: RealtimeMode, timeout?: number): Promise<RealtimeStation[]>;
|
|
166
|
+
/**
|
|
167
|
+
* Get the list of stops for this vehicle.
|
|
168
|
+
*
|
|
169
|
+
* @param {string} id A vehicle id.
|
|
170
|
+
* @return {Promise<{data: { content: RealtimeStopSequence[] }}>} Returns a stop sequence object.
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
getStopSequence(id: RealtimeTrainId): Promise<WebSocketAPIMessageEventData<RealtimeStopSequence[]>>;
|
|
174
|
+
/**
|
|
175
|
+
* Return a partial trajectory with a given id and a mode.
|
|
176
|
+
*
|
|
177
|
+
* @param {number} id The identifier of a trajectory.
|
|
178
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
179
|
+
* @return {Promise<{data: { content: RealtimeTrajectory }}>} A trajectory.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
getTrajectory(id: RealtimeTrainId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeTrajectory>>;
|
|
139
183
|
/**
|
|
140
184
|
* Callback when the websocket is closed by the server.
|
|
141
185
|
* It auto reconnects after a timeout.
|
|
@@ -143,12 +187,21 @@ declare class RealtimeAPI {
|
|
|
143
187
|
*/
|
|
144
188
|
onClose(): void;
|
|
145
189
|
/**
|
|
146
|
-
*
|
|
190
|
+
* Callback when the websocket is opened and ready.
|
|
191
|
+
* It applies the bbox and the projection.
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
onOpen(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Open the websocket connection.
|
|
147
197
|
*
|
|
148
|
-
* @
|
|
149
|
-
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
198
|
+
* @public
|
|
150
199
|
*/
|
|
151
|
-
|
|
200
|
+
open(): void;
|
|
201
|
+
/**
|
|
202
|
+
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
203
|
+
*/
|
|
204
|
+
reset(): void;
|
|
152
205
|
/**
|
|
153
206
|
* Subscribe to a channel.
|
|
154
207
|
*
|
|
@@ -156,69 +209,75 @@ declare class RealtimeAPI {
|
|
|
156
209
|
* @param {function} onSuccess Callback when the subscription succeeds.
|
|
157
210
|
* @param {function} onError Callback when the subscription fails.
|
|
158
211
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
159
|
-
* @
|
|
212
|
+
* @public
|
|
160
213
|
*/
|
|
161
214
|
subscribe(channel: string, onSuccess: WebSocketAPIMessageCallback<any>, onError?: EventListener, quiet?: boolean): void;
|
|
162
215
|
/**
|
|
163
|
-
*
|
|
216
|
+
* Subscribe to deleted_vhicles channel.
|
|
164
217
|
*
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @param {function}
|
|
168
|
-
* @
|
|
218
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
219
|
+
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
220
|
+
* @param {function} onError Callback when the subscription fails.
|
|
221
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
222
|
+
* @public
|
|
169
223
|
*/
|
|
170
|
-
|
|
224
|
+
subscribeDeletedVehicles(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>, onError?: EventListener, quiet?: boolean): void;
|
|
171
225
|
/**
|
|
172
226
|
* Subscribe to departures channel of a given station.
|
|
173
227
|
*
|
|
174
228
|
* @param {number} stationId UIC of the station.
|
|
175
|
-
* @param {
|
|
176
|
-
* @param {function(departures:Departure[])} onMessage Function called on each message of the channel.
|
|
229
|
+
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
177
230
|
* @param {function} onError Callback when the subscription fails.
|
|
178
231
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
179
|
-
* @
|
|
232
|
+
* @deprecated Use subscribeTimetable instead.
|
|
180
233
|
*/
|
|
181
234
|
subscribeDepartures(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
182
|
-
/**
|
|
183
|
-
* Unsubscribe from current departures channel.
|
|
184
|
-
* @param {RealtimeStationId} id Station's id
|
|
185
|
-
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
unsubscribeDepartures(id: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
189
235
|
/**
|
|
190
236
|
* Subscribe to the disruptions channel for tenant.
|
|
191
237
|
*
|
|
238
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
192
239
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
193
240
|
* @param {function} onError Callback when the subscription fails.
|
|
194
241
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
195
|
-
* @
|
|
242
|
+
* @deprecated Use subscribeNewsticker instead.
|
|
196
243
|
*/
|
|
197
244
|
subscribeDisruptions(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
198
245
|
/**
|
|
199
|
-
*
|
|
246
|
+
* Subscribe to extra_geoms channel.
|
|
200
247
|
*
|
|
201
|
-
* @param {function(data: { content:
|
|
202
|
-
* @
|
|
248
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Function called on each message of the channel.
|
|
249
|
+
* @param {function} onError Callback when the subscription fails.
|
|
250
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
203
251
|
*/
|
|
204
|
-
|
|
252
|
+
subscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>, onError?: EventListener, quiet?: boolean): void;
|
|
205
253
|
/**
|
|
206
|
-
*
|
|
254
|
+
* Subscribe to full_trajectory channel of a given vehicle.
|
|
207
255
|
*
|
|
208
|
-
* @param {
|
|
256
|
+
* @param {string} id A vehicle id.
|
|
209
257
|
* @param {RealtimeMode} mode Realtime mode.
|
|
210
|
-
* @
|
|
258
|
+
* @param {function(data:{content: RealtimeFullTrajectory})} onMessage Function called on each message of the channel.
|
|
259
|
+
* @param {function} onError Callback when the subscription fails.
|
|
260
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
211
261
|
* @public
|
|
212
262
|
*/
|
|
213
|
-
|
|
263
|
+
subscribeFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeFullTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
214
264
|
/**
|
|
215
|
-
*
|
|
216
|
-
* @param {
|
|
217
|
-
* @param {
|
|
218
|
-
* @
|
|
265
|
+
* Subscribe to healthcheck channel.
|
|
266
|
+
* @param {function(data: { content: string })} onMessage Callback when the subscribe to healthcheck channel succeeds.
|
|
267
|
+
* @param {function} onError Callback when the subscription fails.
|
|
268
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
269
|
+
*/
|
|
270
|
+
subscribeHealthCheck(onMessage: WebSocketAPIMessageCallback<string>, onError?: EventListener, quiet?: boolean): void;
|
|
271
|
+
/**
|
|
272
|
+
* Subscribe to the newsticker channel for tenant.
|
|
273
|
+
*
|
|
274
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
275
|
+
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
276
|
+
* @param {function} onError Callback when the subscription fails.
|
|
277
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
219
278
|
* @public
|
|
220
279
|
*/
|
|
221
|
-
|
|
280
|
+
subscribeNewsticker(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
222
281
|
/**
|
|
223
282
|
* Subscribe to stations channel.
|
|
224
283
|
* One message pro station.
|
|
@@ -231,129 +290,115 @@ declare class RealtimeAPI {
|
|
|
231
290
|
*/
|
|
232
291
|
subscribeStations(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeStation>, onError?: EventListener, quiet?: boolean): void;
|
|
233
292
|
/**
|
|
234
|
-
*
|
|
235
|
-
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
239
|
-
/**
|
|
240
|
-
* Subscribe to extra_geoms channel.
|
|
293
|
+
* Subscribe to stopsequence channel of a given vehicle.
|
|
241
294
|
*
|
|
242
|
-
* @param {
|
|
295
|
+
* @param {string} id A vehicle id.
|
|
296
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Function called on each message of the channel.
|
|
243
297
|
* @param {function} onError Callback when the subscription fails.
|
|
244
298
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
299
|
+
* @public
|
|
245
300
|
*/
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Unsubscribe to extra_geoms channel.
|
|
249
|
-
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
250
|
-
*/
|
|
251
|
-
unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
|
|
301
|
+
subscribeStopSequence(id: RealtimeTrainId, onMessage: WebSocketAPIMessageCallback<RealtimeStopSequence[]>, onError?: EventListener, quiet?: boolean): void;
|
|
252
302
|
/**
|
|
253
|
-
*
|
|
303
|
+
* Subscribe to timetable channel of a given station.
|
|
254
304
|
*
|
|
255
|
-
* @param {number}
|
|
256
|
-
* @param {
|
|
257
|
-
* @
|
|
305
|
+
* @param {number} stationId UIC of the station.
|
|
306
|
+
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
307
|
+
* @param {function} onError Callback when the subscription fails.
|
|
308
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
258
309
|
* @public
|
|
259
310
|
*/
|
|
260
|
-
|
|
311
|
+
subscribeTimetable(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
261
312
|
/**
|
|
262
313
|
* Subscribe to trajectory channel.
|
|
263
314
|
*
|
|
264
315
|
* @param {RealtimeMode} mode Realtime mode.
|
|
265
|
-
* @param {function(data: { content:
|
|
316
|
+
* @param {function(data: { content: RealtimeTrajectory })} onMessage Function called on each message of the channel.
|
|
266
317
|
* @param {function} onError Callback when the subscription fails.
|
|
267
318
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
268
319
|
* @public
|
|
269
320
|
*/
|
|
270
|
-
subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<
|
|
321
|
+
subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
271
322
|
/**
|
|
272
|
-
* Unsubscribe
|
|
273
|
-
* @param {function(data: { content: RealtimeTrajectoryResponse[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
274
|
-
* @public
|
|
275
|
-
*/
|
|
276
|
-
unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectoryResponse[]>): void;
|
|
277
|
-
/**
|
|
278
|
-
* Subscribe to deleted_vhicles channel.
|
|
323
|
+
* Unsubscribe both modes of a channel.
|
|
279
324
|
*
|
|
280
|
-
* @param {
|
|
281
|
-
* @param {
|
|
282
|
-
* @param {function}
|
|
283
|
-
* @
|
|
325
|
+
* @param {string} channel Name of the websocket channel to unsubscribe.
|
|
326
|
+
* @param {string} suffix Suffix to add to the channel name.
|
|
327
|
+
* @param {function} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
328
|
+
* @public
|
|
284
329
|
*/
|
|
285
|
-
|
|
330
|
+
unsubscribe(channel: string, suffix?: string, onMessage?: WebSocketAPIMessageCallback<any>): void;
|
|
286
331
|
/**
|
|
287
332
|
* Unsubscribe to deleted_vhicles channels.
|
|
288
333
|
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
334
|
+
* @public
|
|
289
335
|
*/
|
|
290
336
|
unsubscribeDeletedVehicles(onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>): void;
|
|
291
337
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* @param {
|
|
295
|
-
* @
|
|
296
|
-
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
297
|
-
* @return {Promise<{ data: { content: RealtimeFullTrajectory } }>} Return a full trajectory.
|
|
298
|
-
* @public
|
|
338
|
+
* Unsubscribe from current departures channel.
|
|
339
|
+
* @param {number} stationId UIC of the station.
|
|
340
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
341
|
+
* @deprecated Use RealtimeAPI.unsubscribeTimetabe instead.
|
|
299
342
|
*/
|
|
300
|
-
|
|
343
|
+
unsubscribeDepartures(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
301
344
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* @param {
|
|
305
|
-
* @
|
|
306
|
-
* @param {function(data: { content: RealtimeFullTrajectory })} onMessage Function called on each message of the channel.
|
|
307
|
-
* @param {function} onError Callback when the subscription fails.
|
|
308
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
309
|
-
* @public
|
|
345
|
+
* Unsubscribe disruptions.
|
|
346
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
347
|
+
* @param {Function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
348
|
+
* @deprecated Use unsubscribeNewsticker instead.
|
|
310
349
|
*/
|
|
311
|
-
|
|
350
|
+
unsubscribeDisruptions(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
|
|
351
|
+
/**
|
|
352
|
+
* Unsubscribe to extra_geoms channel.
|
|
353
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
354
|
+
*/
|
|
355
|
+
unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
|
|
312
356
|
/**
|
|
313
357
|
* Unsubscribe from full_trajectory channel
|
|
314
358
|
*
|
|
315
359
|
* @param {string} id A vehicle id.
|
|
316
|
-
* @param {
|
|
360
|
+
* @param {onFullTrajectoryMessageCallback} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
317
361
|
* @public
|
|
318
362
|
*/
|
|
319
363
|
unsubscribeFullTrajectory(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeFullTrajectory>): void;
|
|
320
364
|
/**
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
|
|
324
|
-
|
|
365
|
+
* Unsubscribe to healthcheck channel.
|
|
366
|
+
* @param {function(data: { content: string })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
367
|
+
*/
|
|
368
|
+
unsubscribeHealthCheck(onMessage?: WebSocketAPIMessageCallback<string>): void;
|
|
369
|
+
/**
|
|
370
|
+
* Unsubscribe disruptions.
|
|
371
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
372
|
+
* @param {Function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
325
373
|
* @public
|
|
326
374
|
*/
|
|
327
|
-
|
|
375
|
+
unsubscribeNewsticker(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
|
|
328
376
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* @param {string} id A vehicle id.
|
|
332
|
-
* @param {function(data: { content: StopSequence[] })} onMessage Function called on each message of the channel.
|
|
333
|
-
* @param {function} onError Callback when the subscription fails.
|
|
334
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
377
|
+
* Unsubscribe to stations channel.
|
|
378
|
+
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
335
379
|
* @public
|
|
336
380
|
*/
|
|
337
|
-
|
|
381
|
+
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
338
382
|
/**
|
|
339
383
|
* Unsubscribe from stopsequence channel
|
|
340
384
|
*
|
|
341
385
|
* @param {string} id A vehicle id.
|
|
342
|
-
* @param {function(data: { content:
|
|
386
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
343
387
|
* @public
|
|
344
388
|
*/
|
|
345
|
-
unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<
|
|
389
|
+
unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeStopSequence[]>): void;
|
|
346
390
|
/**
|
|
347
|
-
*
|
|
348
|
-
* @param {
|
|
349
|
-
* @param {function}
|
|
350
|
-
* @
|
|
391
|
+
* Unsubscribe from current departures channel.
|
|
392
|
+
* @param {number} stationId UIC of the station.
|
|
393
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
394
|
+
* @public
|
|
351
395
|
*/
|
|
352
|
-
|
|
396
|
+
unsubscribeTimetable(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
353
397
|
/**
|
|
354
|
-
* Unsubscribe to
|
|
355
|
-
* @param {function(data: { content:
|
|
398
|
+
* Unsubscribe to trajectory channels.
|
|
399
|
+
* @param {function(data: { content: RealtimeTrajectory })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
400
|
+
* @public
|
|
356
401
|
*/
|
|
357
|
-
|
|
402
|
+
unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>): void;
|
|
358
403
|
}
|
|
359
404
|
export default RealtimeAPI;
|