mobility-toolbox-js 2.0.0 → 2.1.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.
Files changed (271) hide show
  1. package/api/RealtimeAPI.d.ts +279 -0
  2. package/api/RealtimeAPI.d.ts.map +1 -0
  3. package/api/RealtimeAPI.js +466 -0
  4. package/api/RoutingAPI.d.ts +37 -0
  5. package/api/RoutingAPI.d.ts.map +1 -0
  6. package/api/RoutingAPI.js +35 -0
  7. package/api/StopsAPI.d.ts +38 -0
  8. package/api/StopsAPI.d.ts.map +1 -0
  9. package/api/StopsAPI.js +36 -0
  10. package/api/index.d.ts +4 -0
  11. package/api/index.d.ts.map +1 -0
  12. package/api/index.js +3 -3
  13. package/api/typedefs.d.ts +179 -0
  14. package/api/typedefs.d.ts.map +1 -0
  15. package/api/{tralis/typedefs.js → typedefs.js} +4 -10
  16. package/common/api/HttpAPI.d.ts +31 -0
  17. package/common/api/HttpAPI.d.ts.map +1 -0
  18. package/common/api/HttpAPI.js +57 -0
  19. package/common/api/WebSocketAPI.d.ts +153 -0
  20. package/common/api/WebSocketAPI.d.ts.map +1 -0
  21. package/common/api/WebSocketAPI.js +341 -0
  22. package/common/controls/ControlCommon.d.ts +76 -0
  23. package/common/controls/ControlCommon.d.ts.map +1 -0
  24. package/common/controls/ControlCommon.js +150 -0
  25. package/common/controls/CopyrightControlCommon.d.ts +13 -0
  26. package/common/controls/CopyrightControlCommon.d.ts.map +1 -0
  27. package/common/controls/CopyrightControlCommon.js +34 -0
  28. package/common/controls/StopFinderControlCommon.d.ts +55 -0
  29. package/common/controls/StopFinderControlCommon.d.ts.map +1 -0
  30. package/common/controls/StopFinderControlCommon.js +144 -0
  31. package/common/index.d.ts +3 -0
  32. package/common/index.d.ts.map +1 -0
  33. package/common/index.js +2 -0
  34. package/common/layers/LayerCommon.d.ts +94 -0
  35. package/common/layers/LayerCommon.d.ts.map +1 -0
  36. package/common/layers/LayerCommon.js +244 -0
  37. package/common/mixins/RealtimeLayerMixin.d.ts +286 -0
  38. package/common/mixins/RealtimeLayerMixin.d.ts.map +1 -0
  39. package/common/mixins/RealtimeLayerMixin.js +776 -0
  40. package/common/mixins/UserInteractionsLayerMixin.d.ts +60 -0
  41. package/common/mixins/UserInteractionsLayerMixin.d.ts.map +1 -0
  42. package/common/mixins/UserInteractionsLayerMixin.js +241 -0
  43. package/common/styles/index.d.ts +5 -0
  44. package/common/styles/index.d.ts.map +1 -0
  45. package/common/styles/index.js +4 -4
  46. package/common/styles/realtimeDefaultStyle.d.ts +36 -0
  47. package/common/styles/realtimeDefaultStyle.d.ts.map +1 -0
  48. package/common/styles/realtimeDefaultStyle.js +275 -0
  49. package/common/styles/{trackerDelayStyle.js → realtimeDelayStyle.d.ts} +4 -9
  50. package/common/styles/realtimeDelayStyle.d.ts.map +1 -0
  51. package/common/styles/realtimeDelayStyle.js +13 -0
  52. package/common/styles/realtimeHeadingStyle.d.ts +12 -0
  53. package/common/styles/realtimeHeadingStyle.d.ts.map +1 -0
  54. package/common/styles/realtimeHeadingStyle.js +85 -0
  55. package/common/styles/realtimeSimpleStyle.d.ts +4 -0
  56. package/common/styles/realtimeSimpleStyle.d.ts.map +1 -0
  57. package/common/styles/realtimeSimpleStyle.js +23 -0
  58. package/common/typedefs.d.ts +111 -0
  59. package/common/typedefs.d.ts.map +1 -0
  60. package/common/typedefs.js +35 -6
  61. package/common/utils/compareDepartures.d.ts +11 -0
  62. package/common/utils/compareDepartures.d.ts.map +1 -0
  63. package/common/utils/compareDepartures.js +35 -0
  64. package/common/utils/createCanvas.d.ts +10 -0
  65. package/common/utils/createCanvas.d.ts.map +1 -0
  66. package/common/utils/createCanvas.js +27 -0
  67. package/common/utils/createRealtimeFilters.d.ts +13 -0
  68. package/common/utils/createRealtimeFilters.d.ts.map +1 -0
  69. package/common/utils/createRealtimeFilters.js +74 -0
  70. package/common/utils/debounceDeparturesMessages.d.ts +12 -0
  71. package/common/utils/debounceDeparturesMessages.d.ts.map +1 -0
  72. package/common/utils/debounceDeparturesMessages.js +24 -0
  73. package/common/utils/debounceWebsocketMessages.d.ts +11 -0
  74. package/common/utils/debounceWebsocketMessages.d.ts.map +1 -0
  75. package/common/utils/debounceWebsocketMessages.js +29 -0
  76. package/common/utils/getLayersAsFlatArray.d.ts +3 -0
  77. package/common/utils/getLayersAsFlatArray.d.ts.map +1 -0
  78. package/common/utils/getLayersAsFlatArray.js +15 -0
  79. package/common/utils/getMapboxMapCopyrights.d.ts +18 -0
  80. package/common/utils/getMapboxMapCopyrights.d.ts.map +1 -0
  81. package/common/utils/getMapboxMapCopyrights.js +21 -23
  82. package/common/utils/getMapboxRender.d.ts +7 -0
  83. package/common/utils/getMapboxRender.d.ts.map +1 -0
  84. package/common/utils/getMapboxRender.js +87 -0
  85. package/common/utils/getMaplibreRender.d.ts +7 -0
  86. package/common/utils/getMaplibreRender.d.ts.map +1 -0
  87. package/common/utils/getMaplibreRender.js +38 -0
  88. package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
  89. package/common/utils/getRealtimeModeSuffix.d.ts.map +1 -0
  90. package/common/utils/getRealtimeModeSuffix.js +7 -0
  91. package/common/utils/getUrlWithParams.d.ts +9 -0
  92. package/common/utils/getUrlWithParams.d.ts.map +1 -0
  93. package/common/utils/getUrlWithParams.js +18 -0
  94. package/common/utils/getVehiclePosition.d.ts +16 -0
  95. package/common/utils/getVehiclePosition.d.ts.map +1 -0
  96. package/common/utils/getVehiclePosition.js +60 -60
  97. package/common/utils/index.d.ts +17 -0
  98. package/common/utils/index.d.ts.map +1 -0
  99. package/common/utils/index.js +13 -2
  100. package/common/utils/realtimeConfig.d.ts +49 -0
  101. package/common/utils/realtimeConfig.d.ts.map +1 -0
  102. package/common/utils/realtimeConfig.js +173 -0
  103. package/common/utils/removeDuplicate.d.ts +10 -0
  104. package/common/utils/removeDuplicate.d.ts.map +1 -0
  105. package/common/utils/removeDuplicate.js +5 -12
  106. package/common/utils/renderTrajectories.d.ts +17 -0
  107. package/common/utils/renderTrajectories.d.ts.map +1 -0
  108. package/common/utils/renderTrajectories.js +110 -0
  109. package/common/utils/sortAndFilterDepartures.d.ts +16 -0
  110. package/common/utils/sortAndFilterDepartures.d.ts.map +1 -0
  111. package/common/utils/sortAndFilterDepartures.js +58 -0
  112. package/common/utils/sortByDelay.d.ts +3 -0
  113. package/common/utils/sortByDelay.d.ts.map +1 -0
  114. package/common/utils/sortByDelay.js +17 -20
  115. package/common/utils/timeUtils.d.ts +24 -0
  116. package/common/utils/timeUtils.d.ts.map +1 -0
  117. package/common/utils/timeUtils.js +13 -18
  118. package/iife.d.ts +3 -0
  119. package/iife.d.ts.map +1 -0
  120. package/iife.js +5 -0
  121. package/index.d.ts +10 -0
  122. package/index.d.ts.map +1 -0
  123. package/index.js +10 -2
  124. package/mapbox/controls/CopyrightControl.d.ts +29 -0
  125. package/mapbox/controls/CopyrightControl.d.ts.map +1 -0
  126. package/mapbox/controls/CopyrightControl.js +25 -35
  127. package/mapbox/controls/index.d.ts +2 -0
  128. package/mapbox/controls/index.d.ts.map +1 -0
  129. package/mapbox/controls/index.js +2 -0
  130. package/mapbox/index.d.ts +6 -0
  131. package/mapbox/index.d.ts.map +1 -0
  132. package/mapbox/index.js +5 -3
  133. package/mapbox/layers/Layer.d.ts +59 -0
  134. package/mapbox/layers/Layer.d.ts.map +1 -0
  135. package/mapbox/layers/Layer.js +78 -95
  136. package/mapbox/layers/RealtimeLayer.d.ts +181 -0
  137. package/mapbox/layers/RealtimeLayer.d.ts.map +1 -0
  138. package/mapbox/layers/RealtimeLayer.js +276 -0
  139. package/mapbox/layers/index.d.ts +3 -0
  140. package/mapbox/layers/index.d.ts.map +1 -0
  141. package/mapbox/layers/index.js +2 -0
  142. package/mapbox/utils/getMercatorResolution.d.ts +9 -0
  143. package/mapbox/utils/getMercatorResolution.d.ts.map +1 -0
  144. package/mapbox/utils/getMercatorResolution.js +18 -0
  145. package/mapbox/utils/getSourceCoordinates.d.ts +9 -0
  146. package/mapbox/utils/getSourceCoordinates.d.ts.map +1 -0
  147. package/mapbox/utils/getSourceCoordinates.js +27 -0
  148. package/mapbox/utils/index.d.ts +3 -0
  149. package/mapbox/utils/index.d.ts.map +1 -0
  150. package/mapbox/utils/index.js +2 -0
  151. package/mbt.js +60005 -0
  152. package/mbt.js.map +7 -0
  153. package/mbt.min.js +1084 -0
  154. package/mbt.min.js.map +7 -0
  155. package/ol/controls/CopyrightControl.d.ts +31 -0
  156. package/ol/controls/CopyrightControl.d.ts.map +1 -0
  157. package/ol/controls/CopyrightControl.js +44 -56
  158. package/ol/controls/RoutingControl.d.ts +193 -0
  159. package/ol/controls/RoutingControl.d.ts.map +1 -0
  160. package/ol/controls/RoutingControl.js +546 -667
  161. package/ol/controls/StopFinderControl.d.ts +30 -0
  162. package/ol/controls/StopFinderControl.d.ts.map +1 -0
  163. package/ol/controls/StopFinderControl.js +10 -16
  164. package/ol/controls/index.d.ts +4 -0
  165. package/ol/controls/index.d.ts.map +1 -0
  166. package/ol/controls/index.js +3 -0
  167. package/ol/index.d.ts +6 -0
  168. package/ol/index.d.ts.map +1 -0
  169. package/ol/index.js +4 -12
  170. package/ol/layers/Layer.d.ts +86 -0
  171. package/ol/layers/Layer.d.ts.map +1 -0
  172. package/ol/layers/Layer.js +147 -166
  173. package/ol/layers/MapGlLayer.d.ts +67 -0
  174. package/ol/layers/MapGlLayer.d.ts.map +1 -0
  175. package/ol/layers/MapGlLayer.js +218 -0
  176. package/ol/layers/MapboxLayer.d.ts +50 -0
  177. package/ol/layers/MapboxLayer.d.ts.map +1 -0
  178. package/ol/layers/MapboxLayer.js +79 -348
  179. package/ol/layers/MapboxStyleLayer.d.ts +129 -0
  180. package/ol/layers/MapboxStyleLayer.d.ts.map +1 -0
  181. package/ol/layers/MapboxStyleLayer.js +329 -368
  182. package/ol/layers/MaplibreLayer.d.ts +28 -0
  183. package/ol/layers/MaplibreLayer.d.ts.map +1 -0
  184. package/ol/layers/MaplibreLayer.js +13 -259
  185. package/ol/layers/RealtimeLayer.d.ts +202 -0
  186. package/ol/layers/RealtimeLayer.d.ts.map +1 -0
  187. package/ol/layers/RealtimeLayer.js +340 -0
  188. package/ol/layers/RoutingLayer.d.ts +34 -0
  189. package/ol/layers/RoutingLayer.d.ts.map +1 -0
  190. package/ol/layers/RoutingLayer.js +62 -68
  191. package/ol/layers/VectorLayer.d.ts +25 -0
  192. package/ol/layers/VectorLayer.d.ts.map +1 -0
  193. package/ol/layers/VectorLayer.js +27 -32
  194. package/ol/layers/WMSLayer.d.ts +42 -0
  195. package/ol/layers/WMSLayer.d.ts.map +1 -0
  196. package/ol/layers/WMSLayer.js +74 -66
  197. package/ol/layers/index.d.ts +9 -0
  198. package/ol/layers/index.d.ts.map +1 -0
  199. package/ol/layers/index.js +8 -0
  200. package/ol/styles/fullTrajectoryDelayStyle.d.ts +4 -0
  201. package/ol/styles/fullTrajectoryDelayStyle.d.ts.map +1 -0
  202. package/ol/styles/fullTrajectoryDelayStyle.js +23 -25
  203. package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
  204. package/ol/styles/fullTrajectoryStyle.d.ts.map +1 -0
  205. package/ol/styles/fullTrajectoryStyle.js +37 -44
  206. package/ol/styles/index.d.ts +3 -0
  207. package/ol/styles/index.d.ts.map +1 -0
  208. package/package.json +98 -177
  209. package/setupTests.d.ts +2 -0
  210. package/setupTests.d.ts.map +1 -0
  211. package/setupTests.js +26 -0
  212. package/types/common.d.ts +122 -0
  213. package/types/index.d.ts +11 -0
  214. package/types/realtime.d.ts +320 -0
  215. package/types/routing.d.ts +206 -0
  216. package/types/stops.d.ts +143 -0
  217. package/README.md +0 -23
  218. package/api/routing/RoutingAPI.js +0 -44
  219. package/api/routing/RoutingAPI.test.js +0 -41
  220. package/api/stops/StopsAPI.js +0 -41
  221. package/api/stops/StopsAPI.test.js +0 -34
  222. package/api/tralis/TralisAPI.js +0 -731
  223. package/api/tralis/TralisAPI.test.js +0 -75
  224. package/api/tralis/TralisAPIUtils.js +0 -73
  225. package/api/tralis/WebSocketConnector.js +0 -338
  226. package/api/tralis/WebSocketConnector.test.js +0 -356
  227. package/common/Tracker.js +0 -197
  228. package/common/api/api.js +0 -64
  229. package/common/api/api.test.js +0 -68
  230. package/common/controls/Control.js +0 -146
  231. package/common/controls/Control.test.js +0 -98
  232. package/common/layers/Layer.js +0 -404
  233. package/common/layers/Layer.test.js +0 -585
  234. package/common/mixins/CopyrightMixin.js +0 -48
  235. package/common/mixins/SearchMixin.js +0 -176
  236. package/common/mixins/TralisLayerMixin.js +0 -930
  237. package/common/styles/trackerDefaultStyle.js +0 -333
  238. package/common/styles/trackerSimpleStyle.js +0 -22
  239. package/common/trackerConfig.js +0 -190
  240. package/common/trackerConfig.test.js +0 -25
  241. package/common/utils/createTrackerFilters.js +0 -87
  242. package/common/utils/createTrackerFilters.test.js +0 -95
  243. package/common/utils/getMapboxMapCopyrights.test.js +0 -47
  244. package/common/utils/getMapboxStyleUrl.js +0 -32
  245. package/common/utils/removeDuplicate.test.js +0 -22
  246. package/common/utils/timeUtils.test.js +0 -16
  247. package/index.js.map +0 -1
  248. package/mapbox/layers/Layer.test.js +0 -202
  249. package/mapbox/layers/TralisLayer.js +0 -329
  250. package/mapbox/layers/TralisLayer.test.js +0 -40
  251. package/mapbox/utils.js +0 -46
  252. package/module.js +0 -23
  253. package/ol/README.md +0 -0
  254. package/ol/controls/CopyrightControl.test.js +0 -211
  255. package/ol/controls/RoutingControl.test.js +0 -216
  256. package/ol/controls/StopFinderControl.test.js +0 -59
  257. package/ol/controls/snapshots/RoutingControlRouteGen10.json +0 -58
  258. package/ol/controls/snapshots/RoutingControlRouteGen100.json +0 -292
  259. package/ol/controls/snapshots/RoutingControlRouteGen30.json +0 -69
  260. package/ol/controls/snapshots/RoutingControlRouteGen5.json +0 -58
  261. package/ol/controls/snapshots/RoutingControlRouteOSM.json +0 -759
  262. package/ol/controls/snapshots/RoutingControlStation1.json +0 -60
  263. package/ol/controls/snapshots/RoutingControlStation2.json +0 -49
  264. package/ol/layers/Layer.test.js +0 -197
  265. package/ol/layers/MapboxLayer.test.js +0 -186
  266. package/ol/layers/MapboxStyleLayer.test.js +0 -262
  267. package/ol/layers/RoutingLayer.test.js +0 -49
  268. package/ol/layers/TralisLayer.js +0 -359
  269. package/ol/layers/TralisLayer.test.js +0 -97
  270. package/ol/layers/VectorLayer.test.js +0 -98
  271. package/ol/layers/WMSLayer.test.js +0 -84
@@ -0,0 +1,320 @@
1
+ import { Feature, FeatureCollection, Point } from 'geojson';
2
+
3
+ export declare type RealtimeMode = 'topographic' | 'schematic' | 'raw';
4
+
5
+ export declare type RealtimeChannelModeSuffix = '' | '_schematic';
6
+
7
+ export type RealtimeTrainId = string;
8
+
9
+ export type RealtimeStationId = number;
10
+
11
+ export type RealtimeService =
12
+ | 'redis_websocket_api'
13
+ | 'tralis_stations'
14
+ | 'tralis_fzo'
15
+ | 'tralis_worker'
16
+ | 'tralis_vdv'
17
+ | 'tralis_newsticker'
18
+ | 'tralis_geofox'
19
+ | string;
20
+
21
+ export type RealtimeTenant = 'sbb' | 'sbh' | 'sbm' | '' | string;
22
+
23
+ export type RealtimeElevatorState = 'ALL_OPERABLE' | string;
24
+
25
+ export type RealtimeStopState = 'LEAVING' | 'BOARDING' | string;
26
+
27
+ export type RealtimeTrajectoryState =
28
+ | 'HIDDEN'
29
+ | 'BOARDING'
30
+ | 'STOP_CANCELLED'
31
+ | 'JOURNEY_CANCELLED';
32
+
33
+ export type RealtimeGeneralizationLevel = 5 | 10 | 30 | 100;
34
+
35
+ export type RealtimeMot =
36
+ | 'tram'
37
+ | 'subway'
38
+ | 'rail'
39
+ | 'bus'
40
+ | 'ferry'
41
+ | 'cablecar'
42
+ | 'gondola'
43
+ | 'funicular'
44
+ | 'coach';
45
+
46
+ export type RealtimeChannelName =
47
+ | 'websocket'
48
+ | 'buffer'
49
+ | 'line'
50
+ | 'extra_geoms'
51
+ | 'healthcheck'
52
+ | `timetable_${RealtimeStationId}`
53
+ | `trajectory${RealtimeChannelModeSuffix}`
54
+ | `deleted_vehicles${RealtimeChannelModeSuffix}`
55
+ | `stopsequence_${RealtimeTenant}_${RealtimeTrainId}`
56
+ | `full_trajectory${RealtimeChannelModeSuffix}_${RealtimeTenant}_${RealtimeTrainId}`;
57
+
58
+ export interface RealtimeTrajectoryProperties {
59
+ // Tralis and trafimage
60
+ bounds: [number, number, number, number];
61
+ delay: number | null;
62
+ event_timestamp: number;
63
+ gen_level?: RealtimeGeneralizationLevel;
64
+ gen_range: [number, number];
65
+ has_journey: boolean;
66
+ has_realtime: boolean;
67
+ has_realtime_journey: boolean;
68
+ line?: RealtimeLine;
69
+ operator_provides_realtime_journey: 'unknown' | 'yes' | 'no';
70
+ rake?: string;
71
+ raw_time?: string;
72
+ route_identifier: string;
73
+ state: RealtimeTrajectoryState;
74
+ tenant: string;
75
+ time_intervals?: Array<Array<number>>;
76
+ time_since_update?: string;
77
+ timestamp: number;
78
+ train_id?: RealtimeTrainId;
79
+ train_number?: number;
80
+ type: RealtimeMots;
81
+
82
+ operator?: string; // deprecated, operator is an old property, use tenant instead.
83
+ name?: string; // deprecated, name is an old property, use line.name instead.
84
+
85
+ // Tralis
86
+ event?: string;
87
+ event_delay?: number;
88
+ event_timestamp?: number;
89
+ original_line?: RealtimeLine;
90
+ original_rake?: string;
91
+ original_train_number?: number;
92
+ position_correction?: number;
93
+ raw_coordinates?: [number, number];
94
+ ride_state?: string;
95
+ routeIdentifier?: string;
96
+ transmitting_vehicle?: string;
97
+ }
98
+
99
+ export interface RealtimeTrajectory extends Feature {
100
+ properties: RealtimeTrajectoryProperties;
101
+ }
102
+
103
+ export interface RealtimeFullTrajectoryProperties {
104
+ gen_level?: RealtimeGeneralizationLevel;
105
+ gen_range: [number, number];
106
+ license?: string;
107
+ licenseNote?: string;
108
+ licenseUrl?: string;
109
+ operator?: string;
110
+ operatorUrl?: string;
111
+ publisher?: string;
112
+ publisherUrl?: string;
113
+ tenant: RealtimeTenant;
114
+ train_id: RealtimeTrainId;
115
+ }
116
+
117
+ export interface RealtimeFullTrajectory extends FeatureCollection {
118
+ properties: RealtimeFullTrajectoryProperties;
119
+ }
120
+
121
+ export interface RealtimeStop {
122
+ aimedArrivalTime: number;
123
+ aimedDepartureTime: number;
124
+ arrivalDelay?: number;
125
+ arrivalTime: number;
126
+ cancelled: booblean;
127
+ coordinate: number[];
128
+ departureDelay: number;
129
+ departureTime: number;
130
+ noDropOff?: boolean;
131
+ noPickUp?: boolean;
132
+ state?: RealtimeStopState;
133
+ stationId: RealtimeStationId;
134
+ stationName: string;
135
+ }
136
+
137
+ export interface RealtimeStopSequence {
138
+ backgroundColor?: string;
139
+ color?: string;
140
+ destination: string;
141
+ id: RealtimeTrainId;
142
+ license?: string;
143
+ licenseNote?: string;
144
+ licenseUrl?: string;
145
+ longName?: string;
146
+ new_destination?: string;
147
+ operator?: string;
148
+ operatorUrl?: string;
149
+ publisher?: string;
150
+ publisherUrl?: string;
151
+ routeIdentifier: string;
152
+ shortName: string;
153
+ stations: RealtimeStop[];
154
+ stroke?: strinealtimeTenant;
155
+ text_color: string;
156
+ type: RealtimeMot;
157
+ vehicleType: number;
158
+ }
159
+
160
+ export interface RealtimeExtraGeomProperties {
161
+ ref: string | number;
162
+ }
163
+
164
+ export interface RealtimeExtraGeom extends Feature {
165
+ properties: RealtimeExtraGeomProperties;
166
+ }
167
+
168
+ export interface RealtimeExtraGeomDeleted {
169
+ type: 'Deleted';
170
+ properties: RealtimeExtraGeomProperties;
171
+ }
172
+
173
+ export type RealtimeExtraGeoms = {
174
+ [index: string]: Feature[];
175
+ };
176
+
177
+ export interface RealtimeLine {
178
+ id: number;
179
+ color: string;
180
+ stroke: string;
181
+ name: string;
182
+ text_color: string;
183
+ }
184
+
185
+ export interface RealtimeTransfer {
186
+ mot: RealtimeMot;
187
+ lines: string[];
188
+ }
189
+
190
+ export interface RealtimeStationproperties extends Feature {
191
+ transfers: RealtimeTransfer[];
192
+ elevatorOutOfOrder: boolean;
193
+ elevatorState: RealtimeElevatorState;
194
+ elevators: object;
195
+ uic: RealtimeStationId;
196
+ name: string;
197
+ networkLines: RealtimeLine[];
198
+ hasElevator: boolean;
199
+ hasZOB: boolean;
200
+ hasAccessibility: boolean;
201
+ hasAirport: boolean;
202
+ tenant: RealtimeTenant;
203
+ }
204
+
205
+ export interface RealtimeStation extends Feature {
206
+ geometry: Point;
207
+ properties: RealtimeStationproperties;
208
+ }
209
+
210
+ export interface RealtimeDeparture {
211
+ to: string[];
212
+ time: number;
213
+ no_stop_between: boolean;
214
+ new_to: boolean;
215
+ has_fzo: boolean;
216
+ next_stoppoints: string[];
217
+ platform: string;
218
+ created_at: string;
219
+ at_station_ds100: string;
220
+ train_number: number;
221
+ ris_aimed_time: number;
222
+ updated_at: number;
223
+ min_arrival_time: number;
224
+ ris_estimated_time: number;
225
+ train_id: RealtimeTrainId;
226
+ fzo_estimated_time: number;
227
+ train_type: number;
228
+ call_id: number;
229
+ line: RealtimeLine;
230
+ state: string; /// (BOARDING|STOP_CANCELLED|JOURNEY_CANCELLED|HIDDEN)/
231
+ formation: any;
232
+ no_stop_till: any;
233
+ timestamp: number; // This property seems to never exists
234
+ timediff: number; // This property seems to alawy been 0
235
+ }
236
+
237
+ export interface RealtimeDepartureExtended extends RealtimeDeparture {
238
+ cancelled?: boolean; // value generated by RealtimeAPI class
239
+ }
240
+
241
+ export interface RealtimeNewsMessage {
242
+ content: string;
243
+ lines: RealtimeLine[];
244
+ title: string;
245
+ updated: string; // TODO: ISO string
246
+ }
247
+
248
+ export interface RealtimeNews {
249
+ incident_program: boolean;
250
+ messages: RealtimeNewsMessage[];
251
+ }
252
+
253
+ export interface RealtimeHealth {
254
+ heathly: boolean;
255
+ service: RealtimeService;
256
+ tenant: string | null;
257
+ }
258
+
259
+ export interface RealtimeExtraGeomsResponse {
260
+ source: `extra_geoms`;
261
+ timestamp: number;
262
+ client_reference: null;
263
+ content: RealtimeExtraGeom | RealtimeExtraGeomDeleted;
264
+ }
265
+
266
+ export interface RealtimeStationResponse {
267
+ source: `station_${RealtimeStationId}`;
268
+ timestamp: number;
269
+ client_reference: null;
270
+ content: RealtimeNews;
271
+ }
272
+
273
+ export interface RealtimeNewsTickerResponse {
274
+ source: `${RealtimeTenant}_newsticker`;
275
+ timestamp: number;
276
+ client_reference: null;
277
+ content: RealtimeNews;
278
+ }
279
+
280
+ export interface RealtimeTimetableResponse {
281
+ source: `timetable_${RealtimeStationId}`;
282
+ timestamp: number;
283
+ client_reference: null;
284
+ content: RealtimeDeparture;
285
+ }
286
+
287
+ export interface RealtimeTrajectoryResponse {
288
+ source: `trajectory${RealtimeChannelModeSuffix}`;
289
+ timestamp: number;
290
+ client_reference: '';
291
+ content: RealtimeTrajectory;
292
+ }
293
+
294
+ export interface RealtimeStopSequenceResponse {
295
+ source: `stopsequence_${RealtimeTenant}_${RealtimeTrainId}`;
296
+ timestamp: number;
297
+ client_reference: '';
298
+ content: Array<RealtimeStopSequence>;
299
+ }
300
+
301
+ export interface RealtimeBufferResponse {
302
+ source: 'buffer';
303
+ timestamp: number;
304
+ client_reference: '';
305
+ content: RealtimeTrajectoryResponse[];
306
+ }
307
+
308
+ export interface RealtimeDeletedVehiclesResponse {
309
+ source: `deleted_vehicles${RealtimeChannelModeSuffix}`;
310
+ timestamp: number;
311
+ client_reference: null;
312
+ content: string;
313
+ }
314
+
315
+ export interface RealtimeHealthCheckResponse {
316
+ source: 'healthcheck';
317
+ timestamp: number;
318
+ client_reference: null;
319
+ content: RealtimeHealth;
320
+ }
@@ -0,0 +1,206 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface Paths {
7
+ '/': {
8
+ /** Returns a route as GeoJSON */
9
+ get: {
10
+ parameters: {
11
+ query: {
12
+ /**
13
+ * A pipe separated list of hops. A hop describes a station with either
14
+ * - a name or abbreviation
15
+ * - a station id, prefixed with `!`
16
+ * - comma-seperated coordinates starting with geographic latitude followed by longitude, prefixed with `@`
17
+ * - an additional platform code, prefixed with `$`
18
+ *
19
+ * Station names do not need to match exactly the names in the
20
+ * database that is used for routing. The correct names are searched
21
+ * for by simple normalization, by lookup of synonyms or abbreviation
22
+ * as well as fuzzy algorithms.
23
+ *
24
+ * The usage of different schemes of IDs used by the transit agencies
25
+ * is handled to a large part. A station can be found by all IDs that
26
+ * we know for it. E.g. the station Basel Bad can be found with the ID
27
+ * 8500090 that is used by Swiss Federal Railways SBB and by 8518816,
28
+ * the number used by German Railways DB. Also the usage of numbers
29
+ * used by the UIC is supported for many stations. If you need an
30
+ * additional numbering scheme please contact us.
31
+ *
32
+ * Note on coordinates:
33
+ * If you do not prefix the coordinate pair with `@`, no snapping to
34
+ * the next station is performed. Instead the route will forcefully
35
+ * traverse the specified point.
36
+ *
37
+ * Note on mot's "foot" and "car":
38
+ * Some features might not be available, such as "line-from",
39
+ * "line-to", because they dont apply to those means of transport.
40
+ *
41
+ * Examples for a single hop:
42
+ * - `@47.37811,8.53935` a station at position 47.37811, 8.53935
43
+ * - `basel sbb` a station named "basel sbb"
44
+ * - `ZUE`, station "Zürich HB" by its common abbreviation
45
+ * - `Zürich Hauptbahnhof` or `HBF Zürich` are all valid synonyms für "Zürich HB"
46
+ * - `!8596126` a station with id 8596126
47
+ * - `basel sbb$4` track 4 in a station "Basel SBB"
48
+ * - `@47.37811,8.53935$4` track 4 in a station at position 47.37811, 8.53935
49
+ * - `zürich hb@47.37811,8.53935$8` track 8 in station "Zürich HB" at position 47.37811, 8.53935
50
+ *
51
+ * Example for a valid via with three hops:
52
+ * - `freiburg|basel%20sbb|bern` - from Freiburg (Breisgau) Hbf via Basel SBB to Bern
53
+ */
54
+ via: string;
55
+ /** Mode of transport */
56
+ mot:
57
+ | 'rail'
58
+ | 'bus'
59
+ | 'coach'
60
+ | 'foot'
61
+ | 'tram'
62
+ | 'subway'
63
+ | 'gondola'
64
+ | 'funicular'
65
+ | 'ferry'
66
+ | 'car';
67
+ /** Only for mot=rail. Default is a detailed network based on OpenStreetMap. gen1 to gen4 provide rail networks with increasing levels of generalization */
68
+ graph?: 'gen1' | 'gen2' | 'gen3' | 'gen4';
69
+ /** A line name that should be preferred */
70
+ line?: string;
71
+ /** Name of origin of the preferred line */
72
+ 'line-from'?: string;
73
+ /** Name of destination of the preferred line */
74
+ 'line-to'?: string;
75
+ /** Douglas-Peucker distance parameter for simplification. Default 0.5 in Mercator units */
76
+ simplify?: number;
77
+ /**
78
+ * Maximum allowed ratio of hops to skip if not found. Only non-start
79
+ * and non-end hops are counted in ratio numerator and denominator.
80
+ */
81
+ 'max-skip-hop-ratio'?: number;
82
+ /**
83
+ * Whether to include intermediate hops (stations/stops) found on the
84
+ * route to the response. "true", "on", "yes", "y", "1" will enable
85
+ * intermediate hops. Default: disabled
86
+ */
87
+ hops?: string;
88
+ /**
89
+ * Whether to use beelines (line strings with 2 points) between
90
+ * mutually unreachable hops as a fallback for "Route not found"
91
+ * errors. "true", "on", "yes", "y", "1" will enable the
92
+ * fallback. Default: enabled
93
+ */
94
+ 'beeline-fallback'?: string;
95
+ /**
96
+ * Search radius for candidate edges during snapping of coordinates
97
+ * (see "Note on coordinates" at the top) Default: -1.0
98
+ */
99
+ 'coord-radius'?: number;
100
+ /**
101
+ * Distance punishment factor for edge snapping of coordinates (see
102
+ * "Note on coordinates" at the top). Large: prefer close edge. Small:
103
+ * prefer short total route. Negative value: like worst edge
104
+ * category. Default: -1.0
105
+ */
106
+ 'coord-punish'?: number;
107
+ /**
108
+ * Whether to output OSM way ids in Feature properties.
109
+ * "true", "on", "yes", "y", "1" will enable output. Default: disabled
110
+ */
111
+ 'way-ids'?: string;
112
+ };
113
+ };
114
+ responses: {
115
+ /** A route */
116
+ 200: {
117
+ schema: {
118
+ features?: {
119
+ geometry?: {
120
+ /**
121
+ * @example [
122
+ * [
123
+ * 7.8958421,
124
+ * 47.9816362
125
+ * ],
126
+ * [
127
+ * 7.9048287,
128
+ * 47.9796056
129
+ * ]
130
+ * ]
131
+ */
132
+ coordinates?: number[][];
133
+ /** @enum {string} */
134
+ type?: 'LineString';
135
+ };
136
+ properties?: {
137
+ lines?: {
138
+ /** @example ICE */
139
+ name?: string;
140
+ /** @example 0.99 */
141
+ prop?: number;
142
+ }[];
143
+ };
144
+ station_from?: {
145
+ /**
146
+ * @description IBNR
147
+ * @example
148
+ */
149
+ id?: string;
150
+ /** @example Freiburg Littenweiler */
151
+ name?: string;
152
+ /** @example 1 */
153
+ platform?: string;
154
+ /** @description Latitude of the stop, in WGS84 */
155
+ latitude?: number;
156
+ /** @description Latitude of the stop, in WGS84 */
157
+ longitude?: number;
158
+ };
159
+ station_to?: {
160
+ /**
161
+ * @description IBNR
162
+ * @example 8004158
163
+ */
164
+ id?: string;
165
+ /** @example Muenchen Pasing */
166
+ name?: string;
167
+ /** @example 4 */
168
+ platform?: string;
169
+ /** @description Latitude of the stop, in WGS84 */
170
+ latitude?: number;
171
+ /** @description Latitude of the stop, in WGS84 */
172
+ longitude?: number;
173
+ };
174
+ /** @enum {string} */
175
+ type?: 'Feature';
176
+ };
177
+ properties?: {
178
+ lines?: {
179
+ /** @example ICE */
180
+ name?: string;
181
+ /** @example 0.99 */
182
+ prop?: number;
183
+ }[];
184
+ /**
185
+ * @description routing was done on this graph
186
+ * @example osm-eu-rail
187
+ */
188
+ network?: string;
189
+ /**
190
+ * @description via's you passed as a parameter but were
191
+ * skipped when routing (maybe because they were not found)
192
+ */
193
+ skippedVias?: string[];
194
+ };
195
+ /** @enum {string} */
196
+ type?: 'FeatureCollection';
197
+ };
198
+ };
199
+ };
200
+ };
201
+ };
202
+ }
203
+
204
+ export interface Operations {}
205
+
206
+ export interface External {}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ export interface Paths {
7
+ '/': {
8
+ /** Returns a stop (or multiple) as GeoJSON FeatureCollection */
9
+ get: {
10
+ parameters: {
11
+ query: {
12
+ /** Control how many matches will be returned */
13
+ limit?: number;
14
+ /** Anything you'd like to search for */
15
+ q: string;
16
+ /**
17
+ * comma seperated list, order chooses which agency will be preferred
18
+ * as ident_source (for id and code fields)
19
+ */
20
+ prefagencies?: 'sbb' | 'db';
21
+ /**
22
+ * comma seperated list of mot's which should be available
23
+ * at the stop
24
+ */
25
+ mots?:
26
+ | 'bus'
27
+ | 'ferry'
28
+ | 'gondola'
29
+ | 'tram'
30
+ | 'rail'
31
+ | 'funicular'
32
+ | 'cable_car'
33
+ | 'subway';
34
+ /**
35
+ * left,bottom,right,up coordinates in WGS84 wherein the
36
+ * station should lie
37
+ */
38
+ bbox?: string;
39
+ /** which field to look up, default: all of them */
40
+ field?: 'id' | 'name' | 'coords';
41
+ /**
42
+ * Coordinates in WGS84 (in lat,lon order) used to rank stops close to
43
+ * this position higher
44
+ */
45
+ ref_location?: string;
46
+ };
47
+ };
48
+ responses: {
49
+ /** stop(s) */
50
+ 200: {
51
+ schema: {
52
+ /** @enum {string} */
53
+ type?: 'FeatureCollection';
54
+ features?: {
55
+ /** @enum {string} */
56
+ type?: 'Feature';
57
+ properties?: {
58
+ /** @description internal ID */
59
+ uid?: string;
60
+ /**
61
+ * @description name of the stop
62
+ * @example Bern
63
+ */
64
+ name?: string;
65
+ /**
66
+ * @description 2 letter country code where the station is located
67
+ * @example CH
68
+ */
69
+ country_code?: string;
70
+ /**
71
+ * @description how well the result matches your query, 0
72
+ * means best
73
+ */
74
+ rank?: number;
75
+ /**
76
+ * @description array of translations of the stopname
77
+ * @default []
78
+ */
79
+ translated_names?: {
80
+ value?: string;
81
+ /** @enum {string} */
82
+ language?: 'de' | 'en' | 'fr' | 'it';
83
+ }[];
84
+ /** @description Means of transport that are available at this station */
85
+ mot?: {
86
+ bus?: boolean;
87
+ ferry?: boolean;
88
+ gondola?: boolean;
89
+ tram?: boolean;
90
+ rail?: boolean;
91
+ funicular?: boolean;
92
+ cable_car?: boolean;
93
+ subway?: boolean;
94
+ };
95
+ /**
96
+ * @description source agency for id and code (see below)
97
+ * @example sbb
98
+ */
99
+ ident_source?: string;
100
+ /**
101
+ * @description uic number
102
+ * @example 8507000
103
+ */
104
+ id?: string;
105
+ /**
106
+ * @description Abbreviation code from the transport agency (e.g. DS100 for Deutsche Bahn)
107
+ *
108
+ * @example BN
109
+ */
110
+ code?: string;
111
+ /** @description ifopt identifier, if available */
112
+ ifopt?: string;
113
+ };
114
+ /** @description the coordinates of the stop */
115
+ geometry?: {
116
+ /** @enum {string} */
117
+ type?: 'Point';
118
+ /**
119
+ * @example [
120
+ * 7.439119,
121
+ * 46.94882
122
+ * ]
123
+ */
124
+ coordinates?: number[];
125
+ };
126
+ }[];
127
+ };
128
+ };
129
+ /** limit parameter too high */
130
+ 400: {
131
+ schema: {
132
+ /** @enum {string} */
133
+ error?: '400 Bad Request: Limit has to be an integer between 1 and 500';
134
+ };
135
+ };
136
+ };
137
+ };
138
+ };
139
+ }
140
+
141
+ export interface Operations {}
142
+
143
+ export interface External {}
package/README.md DELETED
@@ -1,23 +0,0 @@
1
- # mobility-toolbox-js
2
-
3
- Toolbox for JavaScript applications in the domains of mobility and logistics.
4
- The tools in this library have been inspired by many projects realized for public transport agencies, mobility providers and logistics companies.
5
-
6
- [![npm](https://img.shields.io/npm/v/mobility-toolbox-js.svg?style=flat-square)](https://www.npmjs.com/package/mobility-toolbox-js)
7
- [![Build](https://github.com/geops/mobility-toolbox-js/workflows/Build/badge.svg)](https://github.com/geops/mobility-toolbox-js/actions?query=workflow%3ABuild)
8
- [![Netlify Status](https://api.netlify.com/api/v1/badges/b368ab18-9dbf-416c-91f6-a82076b02c10/deploy-status)](https://app.netlify.com/sites/mobility-toolbox-js/deploys)
9
-
10
- ## Main Features
11
-
12
- * Display [real-time vehicle positions and prognosis data](http://tracker.geops.ch/) on a map.
13
- * Search for [stops and stations](https://maps2.trafimage.ch) all over the world.
14
- * Get [precise geographic courses](https://geops.github.io/geops-routing-demo/) for all modes of transport.
15
- * Generate beautiful maps for public transport, mobility and logistics
16
-
17
- ## Documentation and examples
18
-
19
- Visit https://master--mobility-toolbox-js.netlify.app/
20
-
21
- ## Version 1.x.x
22
-
23
- 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.