@stadiamaps/ferrostar 0.44.0 → 0.45.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/ferrostar.d.ts CHANGED
@@ -1,86 +1,110 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * JavaScript wrapper for `advance_location_simulation`.
5
+ */
6
+ export function advanceLocationSimulation(state: any): any;
3
7
  /**
4
8
  * JavaScript wrapper for `location_simulation_from_coordinates`.
5
9
  */
6
10
  export function locationSimulationFromCoordinates(coordinates: any, resample_distance: number | null | undefined, bias: LocationBias): any;
11
+ /**
12
+ * JavaScript wrapper for `location_simulation_from_polyline`.
13
+ */
14
+ export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance: number | null | undefined, bias: LocationBias): any;
7
15
  /**
8
16
  * JavaScript wrapper for `location_simulation_from_route`.
9
17
  */
10
18
  export function locationSimulationFromRoute(route: any, resample_distance: number | null | undefined, bias: LocationBias): any;
11
19
  /**
12
- * JavaScript wrapper for `location_simulation_from_polyline`.
20
+ * The lane type blocked by the incident.
13
21
  */
14
- export function locationSimulationFromPolyline(polyline: string, precision: number, resample_distance: number | null | undefined, bias: LocationBias): any;
22
+ export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
23
+
15
24
  /**
16
- * JavaScript wrapper for `advance_location_simulation`.
25
+ * The location of the user that is navigating.
26
+ *
27
+ * In addition to coordinates, this includes estimated accuracy and course information,
28
+ * which can influence navigation logic and UI.
29
+ *
30
+ * NOTE: Heading is absent on purpose.
31
+ * Heading updates are not related to a change in the user\'s location.
17
32
  */
18
- export function advanceLocationSimulation(state: any): any;
33
+ export interface UserLocation {
34
+ coordinates: GeographicCoordinate;
35
+ /**
36
+ * The estimated accuracy of the coordinate (in meters)
37
+ */
38
+ horizontalAccuracy: number;
39
+ courseOverGround: CourseOverGround | undefined;
40
+ timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
41
+ speed: Speed | undefined;
42
+ }
43
+
19
44
  /**
20
- * An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
45
+ * A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
46
+ * the next step.
21
47
  */
22
- export interface VisualInstruction {
48
+ export interface RouteStep {
23
49
  /**
24
- * The primary instruction content.
25
- *
26
- * This is usually given more visual weight.
50
+ * The full route geometry for this step.
27
51
  */
28
- primaryContent: VisualInstructionContent;
52
+ geometry: GeographicCoordinate[];
29
53
  /**
30
- * Optional secondary instruction content.
54
+ * The distance, in meters, to travel along the route after the maneuver to reach the next step.
31
55
  */
32
- secondaryContent: VisualInstructionContent | undefined;
56
+ distance: number;
33
57
  /**
34
- * Optional sub-maneuver instruction content.
58
+ * The estimated duration, in seconds, that it will take to complete this step.
35
59
  */
36
- subContent: VisualInstructionContent | undefined;
60
+ duration: number;
37
61
  /**
38
- * How far (in meters) from the upcoming maneuver the instruction should start being displayed
62
+ * The name of the road being traveled on (useful for certain UI styles).
39
63
  */
40
- triggerDistanceBeforeManeuver: number;
41
- }
42
-
43
- /**
44
- * The content of a visual instruction.
45
- */
46
- export interface VisualInstructionContent {
64
+ roadName: string | undefined;
47
65
  /**
48
- * The text to display.
66
+ * A list of exits (name or number).
49
67
  */
50
- text: string;
68
+ exits: string[];
51
69
  /**
52
- * A standardized maneuver type (if any).
70
+ * A description of the maneuver (ex: \"Turn wright onto main street\").
71
+ *
72
+ * Note for UI implementers: the context this appears in (or doesn\'t)
73
+ * depends somewhat on your use case and routing engine.
74
+ * For example, this field is useful as a written instruction in Valhalla.
53
75
  */
54
- maneuverType: ManeuverType | undefined;
76
+ instruction: string;
55
77
  /**
56
- * A standardized maneuver modifier (if any).
78
+ * A list of instructions for visual display (usually as banners) at specific points along the step.
57
79
  */
58
- maneuverModifier: ManeuverModifier | undefined;
80
+ visualInstructions: VisualInstruction[];
59
81
  /**
60
- * If applicable, the number of degrees you need to go around the roundabout before exiting.
61
- *
62
- * For example, entering and exiting the roundabout in the same direction of travel
63
- * (as if you had gone straight, apart from the detour)
64
- * would be an exit angle of 180 degrees.
82
+ * A list of prompts to announce (via speech synthesis) at specific points along the step.
65
83
  */
66
- roundaboutExitDegrees: number | undefined;
84
+ spokenInstructions: SpokenInstruction[];
67
85
  /**
68
- * Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
86
+ * A list of json encoded strings representing annotations between each coordinate along the step.
69
87
  */
70
- laneInfo: LaneInfo[] | undefined;
88
+ annotations: string[] | undefined;
71
89
  /**
72
- * The exit number (or similar identifier like \"8B\").
90
+ * A list of incidents that occur along the step.
73
91
  */
74
- exitNumbers: string[];
92
+ incidents: Incident[];
75
93
  }
76
94
 
77
95
  /**
78
- * The content of a visual instruction.
96
+ * The direction in which the user/device is observed to be traveling.
79
97
  */
80
- export interface LaneInfo {
81
- active: boolean;
82
- directions: string[];
83
- activeDirection: string | undefined;
98
+ export interface CourseOverGround {
99
+ /**
100
+ * The direction in which the user\'s device is traveling, measured in clockwise degrees from
101
+ * true north (N = 0, E = 90, S = 180, W = 270).
102
+ */
103
+ degrees: number;
104
+ /**
105
+ * The accuracy of the course value, measured in degrees.
106
+ */
107
+ accuracy: number | undefined;
84
108
  }
85
109
 
86
110
  /**
@@ -169,41 +193,19 @@ export interface Incident {
169
193
  }
170
194
 
171
195
  /**
172
- * Details about congestion for an incident.
196
+ * The speed of the user from the location provider.
173
197
  */
174
- export interface Congestion {
198
+ export interface Speed {
175
199
  /**
176
- * The level of congestion caused by the incident.
177
- *
178
- * 0 = no congestion
179
- *
180
- * 100 = road closed
181
- *
182
- * Other values mean no congestion was calculated
200
+ * The user\'s speed in meters per second.
183
201
  */
184
202
  value: number;
203
+ /**
204
+ * The accuracy of the speed value, measured in meters per second.
205
+ */
206
+ accuracy: number | undefined;
185
207
  }
186
208
 
187
- /**
188
- * The lane type blocked by the incident.
189
- */
190
- export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
191
-
192
- /**
193
- * The impact of the incident that has occurred.
194
- */
195
- export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
196
-
197
- /**
198
- * The type of incident that has occurred.
199
- */
200
- export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
201
-
202
- /**
203
- * Additional information to further specify a [`ManeuverType`].
204
- */
205
- export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
206
-
207
209
  /**
208
210
  * The broad class of maneuver to perform.
209
211
  *
@@ -212,85 +214,60 @@ export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right
212
214
  export type ManeuverType = "turn" | "new name" | "depart" | "arrive" | "merge" | "on ramp" | "off ramp" | "fork" | "end of road" | "continue" | "roundabout" | "rotary" | "roundabout turn" | "notification" | "exit roundabout" | "exit rotary";
213
215
 
214
216
  /**
215
- * An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver.
216
- *
217
- * Note that these do not have any locale information attached.
217
+ * A geographic coordinate in WGS84.
218
218
  */
219
- export interface SpokenInstruction {
220
- /**
221
- * Plain-text instruction which can be synthesized with a TTS engine.
222
- */
223
- text: string;
224
- /**
225
- * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
226
- */
227
- ssml: string | undefined;
219
+ export interface GeographicCoordinate {
228
220
  /**
229
- * How far (in meters) from the upcoming maneuver the instruction should start being displayed
221
+ * The latitude (in degrees).
230
222
  */
231
- triggerDistanceBeforeManeuver: number;
223
+ lat: number;
232
224
  /**
233
- * A unique identifier for this instruction.
234
- *
235
- * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances,
236
- * which may have the same textual content.
237
- * UUIDs conveniently fill this purpose.
238
- *
239
- * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time.
240
- * This should be theoretically possible though if someone cares to write up a proposal and a PR.
225
+ * The Longitude (in degrees).
241
226
  */
242
- utteranceId: string;
227
+ lng: number;
243
228
  }
244
229
 
245
230
  /**
246
- * A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
247
- * the next step.
231
+ * The type of incident that has occurred.
248
232
  */
249
- export interface RouteStep {
250
- /**
251
- * The full route geometry for this step.
252
- */
253
- geometry: GeographicCoordinate[];
254
- /**
255
- * The distance, in meters, to travel along the route after the maneuver to reach the next step.
256
- */
257
- distance: number;
258
- /**
259
- * The estimated duration, in seconds, that it will take to complete this step.
260
- */
261
- duration: number;
233
+ export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
234
+
235
+ /**
236
+ * A geographic bounding box defined by its corners.
237
+ */
238
+ export interface BoundingBox {
262
239
  /**
263
- * The name of the road being traveled on (useful for certain UI styles).
240
+ * The southwest corner of the bounding box.
264
241
  */
265
- roadName: string | undefined;
242
+ sw: GeographicCoordinate;
266
243
  /**
267
- * A list of exits (name or number).
244
+ * The northeast corner of the bounding box.
268
245
  */
269
- exits: string[];
246
+ ne: GeographicCoordinate;
247
+ }
248
+
249
+ /**
250
+ * An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
251
+ */
252
+ export interface VisualInstruction {
270
253
  /**
271
- * A description of the maneuver (ex: \"Turn wright onto main street\").
254
+ * The primary instruction content.
272
255
  *
273
- * Note for UI implementers: the context this appears in (or doesn\'t)
274
- * depends somewhat on your use case and routing engine.
275
- * For example, this field is useful as a written instruction in Valhalla.
276
- */
277
- instruction: string;
278
- /**
279
- * A list of instructions for visual display (usually as banners) at specific points along the step.
256
+ * This is usually given more visual weight.
280
257
  */
281
- visualInstructions: VisualInstruction[];
258
+ primaryContent: VisualInstructionContent;
282
259
  /**
283
- * A list of prompts to announce (via speech synthesis) at specific points along the step.
260
+ * Optional secondary instruction content.
284
261
  */
285
- spokenInstructions: SpokenInstruction[];
262
+ secondaryContent: VisualInstructionContent | undefined;
286
263
  /**
287
- * A list of json encoded strings representing annotations between each coordinate along the step.
264
+ * Optional sub-maneuver instruction content.
288
265
  */
289
- annotations: string[] | undefined;
266
+ subContent: VisualInstructionContent | undefined;
290
267
  /**
291
- * A list of incidents that occur along the step.
268
+ * How far (in meters) from the upcoming maneuver the instruction should start being displayed
292
269
  */
293
- incidents: Incident[];
270
+ triggerDistanceBeforeManeuver: number;
294
271
  }
295
272
 
296
273
  /**
@@ -316,73 +293,76 @@ export interface Route {
316
293
  }
317
294
 
318
295
  /**
319
- * The location of the user that is navigating.
320
- *
321
- * In addition to coordinates, this includes estimated accuracy and course information,
322
- * which can influence navigation logic and UI.
323
- *
324
- * NOTE: Heading is absent on purpose.
325
- * Heading updates are not related to a change in the user\'s location.
296
+ * Additional information to further specify a [`ManeuverType`].
326
297
  */
327
- export interface UserLocation {
328
- coordinates: GeographicCoordinate;
329
- /**
330
- * The estimated accuracy of the coordinate (in meters)
331
- */
332
- horizontalAccuracy: number;
333
- courseOverGround: CourseOverGround | undefined;
334
- timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
335
- speed: Speed | undefined;
298
+ export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
299
+
300
+ /**
301
+ * The content of a visual instruction.
302
+ */
303
+ export interface LaneInfo {
304
+ active: boolean;
305
+ directions: string[];
306
+ activeDirection: string | undefined;
336
307
  }
337
308
 
338
309
  /**
339
- * The speed of the user from the location provider.
310
+ * An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver.
311
+ *
312
+ * Note that these do not have any locale information attached.
340
313
  */
341
- export interface Speed {
314
+ export interface SpokenInstruction {
342
315
  /**
343
- * The user\'s speed in meters per second.
316
+ * Plain-text instruction which can be synthesized with a TTS engine.
344
317
  */
345
- value: number;
318
+ text: string;
346
319
  /**
347
- * The accuracy of the speed value, measured in meters per second.
320
+ * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
348
321
  */
349
- accuracy: number | undefined;
350
- }
351
-
352
- /**
353
- * The direction in which the user/device is observed to be traveling.
354
- */
355
- export interface CourseOverGround {
322
+ ssml: string | undefined;
356
323
  /**
357
- * The direction in which the user\'s device is traveling, measured in clockwise degrees from
358
- * true north (N = 0, E = 90, S = 180, W = 270).
324
+ * How far (in meters) from the upcoming maneuver the instruction should start being spoken.
359
325
  */
360
- degrees: number;
326
+ triggerDistanceBeforeManeuver: number;
361
327
  /**
362
- * The accuracy of the course value, measured in degrees.
328
+ * A unique identifier for this instruction.
329
+ *
330
+ * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances,
331
+ * which may have the same textual content.
332
+ * UUIDs conveniently fill this purpose.
333
+ *
334
+ * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time.
335
+ * This should be theoretically possible though if someone cares to write up a proposal and a PR.
363
336
  */
364
- accuracy: number | undefined;
337
+ utteranceId: string;
365
338
  }
366
339
 
367
340
  /**
368
- * A geographic bounding box defined by its corners.
341
+ * Details about congestion for an incident.
369
342
  */
370
- export interface BoundingBox {
371
- /**
372
- * The southwest corner of the bounding box.
373
- */
374
- sw: GeographicCoordinate;
343
+ export interface Congestion {
375
344
  /**
376
- * The northeast corner of the bounding box.
345
+ * The level of congestion caused by the incident.
346
+ *
347
+ * 0 = no congestion
348
+ *
349
+ * 100 = road closed
350
+ *
351
+ * Other values mean no congestion was calculated
377
352
  */
378
- ne: GeographicCoordinate;
353
+ value: number;
379
354
  }
380
355
 
381
356
  /**
382
- * Describes characteristics of the waypoint for the routing backend.
357
+ * Describes characteristics of the waypoint for routing purposes.
383
358
  */
384
359
  export type WaypointKind = "Break" | "Via";
385
360
 
361
+ /**
362
+ * The impact of the incident that has occurred.
363
+ */
364
+ export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
365
+
386
366
  /**
387
367
  * A waypoint along a route.
388
368
  *
@@ -403,7 +383,7 @@ export interface Waypoint {
403
383
  * Optional additional properties that will be passed on to the [`crate::routing_adapters::RouteRequestGenerator`].
404
384
  *
405
385
  * Most users should prefer convenience functions like [`Waypoint::new_with_valhalla_properties`]
406
- * (or, on platforms like iOS and Android with UniFFI bindings, [`crate::routing_adapters::valhalla::create_waypoint_with_valhalla_properties`]).
386
+ * (or, on platforms like iOS and Android with `UniFFI` bindings, [`crate::routing_adapters::valhalla::create_waypoint_with_valhalla_properties`]).
407
387
  *
408
388
  * # Format guidelines
409
389
  *
@@ -424,80 +404,105 @@ export interface Waypoint {
424
404
  }
425
405
 
426
406
  /**
427
- * A geographic coordinate in WGS84.
407
+ * The content of a visual instruction.
428
408
  */
429
- export interface GeographicCoordinate {
430
- /**
431
- * The latitude (in degrees).
432
- */
433
- lat: number;
409
+ export interface VisualInstructionContent {
434
410
  /**
435
- * The Longitude (in degrees).
411
+ * The text to display.
436
412
  */
437
- lng: number;
438
- }
439
-
440
- /**
441
- * A set of optional filters to exclude candidate edges based on their attributes.
442
- */
443
- export interface ValhallaLocationSearchFilter {
413
+ text: string;
444
414
  /**
445
- * Whether to exclude roads marked as tunnels.
415
+ * A standardized maneuver type (if any).
446
416
  */
447
- exclude_tunnel?: boolean;
417
+ maneuverType: ManeuverType | undefined;
448
418
  /**
449
- * Whether to exclude roads marked as bridges.
419
+ * A standardized maneuver modifier (if any).
450
420
  */
451
- exclude_bridge?: boolean;
421
+ maneuverModifier: ManeuverModifier | undefined;
452
422
  /**
453
- * Whether to exclude roads with tolls.
423
+ * If applicable, the number of degrees you need to go around the roundabout before exiting.
424
+ *
425
+ * For example, entering and exiting the roundabout in the same direction of travel
426
+ * (as if you had gone straight, apart from the detour)
427
+ * would be an exit angle of 180 degrees.
454
428
  */
455
- exclude_tolls?: boolean;
429
+ roundaboutExitDegrees: number | undefined;
456
430
  /**
457
- * Whether to exclude ferries.
431
+ * Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
458
432
  */
459
- exclude_ferry?: boolean;
433
+ laneInfo: LaneInfo[] | undefined;
460
434
  /**
461
- * Whether to exclude roads marked as ramps.
435
+ * The exit number (or similar identifier like \"8B\").
462
436
  */
463
- exclude_ramp?: boolean;
437
+ exitNumbers: string[];
438
+ }
439
+
440
+ /**
441
+ * Waypoint properties parsed from an OSRM-compatible server response.
442
+ *
443
+ * NOTE: Some servers (such as Valhalla) may support additional parameters at request time
444
+ * which are _not_ echoed back in the response time.
445
+ * This is unfortunate; PRs upstream would likely be welcomed!
446
+ * Similarly, if your server is OSRM-compatible and returns additional attributes,
447
+ * feel free to open a PR to include these as optional properties.
448
+ */
449
+ export interface OsrmWaypointProperties {
464
450
  /**
465
- * Whether to exclude roads marked as closed due to a live traffic closure.
451
+ * The name of the street that the waypoint snapped to.
466
452
  */
467
- exclude_closures?: boolean;
453
+ name: string | undefined;
468
454
  /**
469
- * The lowest road class allowed.
455
+ * The distance (in meters) between the snapped point and the input coordinate.
470
456
  */
471
- min_road_class?: ValhallaRoadClass;
457
+ distance: number | undefined;
458
+ }
459
+
460
+ /**
461
+ * The event type.
462
+ *
463
+ * For full replayability, we record things like rerouting, and not just location updates.
464
+ */
465
+ export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
466
+
467
+ /**
468
+ * An event that occurs during navigation.
469
+ *
470
+ * This is used for the optional session recording / telemetry.
471
+ */
472
+ export interface NavigationRecordingEvent {
472
473
  /**
473
- * The highest road class allowed.
474
+ * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
474
475
  */
475
- max_road_class?: ValhallaRoadClass;
476
- /**
477
- * If specified, will only consider edges that are on or traverse the passed floor level.
478
- * It will set `search_cutoff` to a default value of 300 meters if no cutoff value is passed.
479
- * Additionally, if a `search_cutoff` is passed, it will be clamped to 1000 meters.
476
+ timestamp: number;
477
+ /**
478
+ * Data associated with the event.
480
479
  */
481
- level?: number;
480
+ event_data: NavigationRecordingEventData;
482
481
  }
483
482
 
484
483
  /**
485
- * A road class in the Valhalla taxonomy.
486
- *
487
- * These are ordered from highest (fastest travel speed) to lowest.
484
+ * Configurations for built-in route providers.
488
485
  */
489
- export type ValhallaRoadClass = "motorway" | "trunk" | "primary" | "secondary" | "tertiary" | "unclassified" | "residential" | "service_other";
486
+ export type WellKnownRouteProvider = { Valhalla: { endpointUrl: string; profile: string; optionsJson?: string | undefined } } | { GraphHopper: { endpointUrl: string; profile: string; locale: string; voiceUnits: GraphHopperVoiceUnits; optionsJson?: string | undefined } };
487
+
488
+ export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
490
489
 
491
490
  /**
492
- * Specifies a preferred side for departing from / arriving at a location.
493
- *
494
- * Examples:
495
- * - Germany drives on the right side of the road. A value of `same` will only allow leaving
496
- * or arriving at a location such that it is on your right.
497
- * - Australia drives on the left side of the road. Passing a value of `same` will only allow
498
- * leaving or arriving at a location such that it is on your left.
491
+ * Controls how simulated locations deviate from the actual route line.
492
+ * This simulates real-world GPS behavior where readings often have systematic bias.
499
493
  */
500
- export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
494
+ export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
495
+
496
+ /**
497
+ * The current state of the simulation.
498
+ */
499
+ export interface LocationSimulationState {
500
+ current_location: UserLocation;
501
+ remaining_locations: GeographicCoordinate[];
502
+ bias: LocationBias;
503
+ }
504
+
505
+ export type GraphHopperVoiceUnits = "metric" | "imperial";
501
506
 
502
507
  /**
503
508
  * Waypoint properties supported by Valhalla servers.
@@ -514,6 +519,10 @@ export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
514
519
  export interface ValhallaWaypointProperties {
515
520
  /**
516
521
  * Preferred direction of travel for the start from the location.
522
+ *
523
+ * The heading is indicated in degrees from north in a clockwise direction, where north is 0°, east is 90°, south is 180°, and west is 270°.
524
+ * Avoid specifying this unless you really know what you\'re doing.
525
+ * Most use cases for this are better served by `preferred_side`.
517
526
  */
518
527
  heading: number | undefined;
519
528
  /**
@@ -532,6 +541,13 @@ export interface ValhallaWaypointProperties {
532
541
  * will be considered as candidates for said location.
533
542
  * If there are no candidates within this distance,
534
543
  * it will return the closest candidate within reason.
544
+ *
545
+ * This allows the routing engine to match another edge which is NOT
546
+ * the closest to your location, but in within this range.
547
+ * This can be useful if you have other constraints and want to disambiguate,
548
+ * but beware that this can lead to very strange results,
549
+ * particularly if you have specified other parameters like `heading`.
550
+ * This is an advanced feature and should only be used with extreme care.
535
551
  */
536
552
  radius: number | undefined;
537
553
  /**
@@ -587,114 +603,91 @@ export interface ValhallaWaypointProperties {
587
603
  }
588
604
 
589
605
  /**
590
- * Waypoint properties parsed from an OSRM-compatible server response.
606
+ * Specifies a preferred side for departing from / arriving at a location.
591
607
  *
592
- * NOTE: Some servers (such as Valhalla) may support additional parameters at request time
593
- * which are _not_ echoed back in the response time.
594
- * This is unfortunate; PRs upstream would likely be welcomed!
595
- * Similarly, if your server is OSRM-compatible and returns additional attributes,
596
- * feel free to open a PR to include these as optional properties.
608
+ * Examples:
609
+ * - Germany drives on the right side of the road. A value of `same` will only allow leaving
610
+ * or arriving at a location such that it is on your right.
611
+ * - Australia drives on the left side of the road. Passing a value of `same` will only allow
612
+ * leaving or arriving at a location such that it is on your left.
597
613
  */
598
- export interface OsrmWaypointProperties {
599
- /**
600
- * The name of the street that the waypoint snapped to.
601
- */
602
- name: string | undefined;
603
- /**
604
- * The distance (in meters) between the snapped point and the input coordinate.
605
- */
606
- distance: number | undefined;
607
- }
614
+ export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
608
615
 
609
616
  /**
610
- * The event type.
617
+ * A road class in the Valhalla taxonomy.
611
618
  *
612
- * For full replayability, we record things like rerouting, and not just location updates.
619
+ * These are ordered from highest (fastest travel speed) to lowest.
613
620
  */
614
- export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
621
+ export type ValhallaRoadClass = "motorway" | "trunk" | "primary" | "secondary" | "tertiary" | "unclassified" | "residential" | "service_other";
615
622
 
616
623
  /**
617
- * An event that occurs during navigation.
618
- *
619
- * This is used for the optional session recording / telemetry.
624
+ * A set of optional filters to exclude candidate edges based on their attributes.
620
625
  */
621
- export interface NavigationRecordingEvent {
626
+ export interface ValhallaLocationSearchFilter {
622
627
  /**
623
- * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
628
+ * Whether to exclude roads marked as tunnels.
624
629
  */
625
- timestamp: number;
630
+ exclude_tunnel?: boolean;
626
631
  /**
627
- * Data associated with the event.
632
+ * Whether to exclude roads marked as bridges.
628
633
  */
629
- event_data: NavigationRecordingEventData;
630
- }
631
-
632
- export type SerializableStepAdvanceCondition = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceFromStep: { distance: number; minimumHorizontalAccuracy: number; calculateWhileOffRoute: boolean } } | { DistanceEntryExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { DistanceEntryAndSnappedExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { OrAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } } | { AndAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } };
633
-
634
- export interface SerializableNavigationControllerConfig {
634
+ exclude_bridge?: boolean;
635
635
  /**
636
- * Configures when navigation advances to the next waypoint in the route.
636
+ * Whether to exclude roads with tolls.
637
637
  */
638
- waypointAdvance: WaypointAdvanceMode;
638
+ exclude_tolls?: boolean;
639
639
  /**
640
- * Configures when navigation advances to the next step in the route.
640
+ * Whether to exclude ferries.
641
641
  */
642
- stepAdvanceCondition: SerializableStepAdvanceCondition;
642
+ exclude_ferry?: boolean;
643
643
  /**
644
- * A special advance condition used for the final 2 route steps (last and arrival).
645
- *
646
- * This exists because several of our step advance conditions require entry and
647
- * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
648
- * the expected location updates for the core step advance condition.
644
+ * Whether to exclude roads marked as ramps.
649
645
  */
650
- arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
646
+ exclude_ramp?: boolean;
651
647
  /**
652
- * Configures when the user is deemed to be off course.
653
- *
654
- * NOTE: This is distinct from the action that is taken.
655
- * It is only the determination that the user has deviated from the expected route.
648
+ * Whether to exclude roads marked as closed due to a live traffic closure.
656
649
  */
657
- routeDeviationTracking: RouteDeviationTracking;
650
+ exclude_closures?: boolean;
658
651
  /**
659
- * Configures how the heading component of the snapped location is reported in [`TripState`].
652
+ * The lowest road class allowed.
660
653
  */
661
- snappedLocationCourseFiltering: CourseFiltering;
654
+ min_road_class?: ValhallaRoadClass;
655
+ /**
656
+ * The highest road class allowed.
657
+ */
658
+ max_road_class?: ValhallaRoadClass;
659
+ /**
660
+ * If specified, will only consider edges that are on or traverse the passed floor level.
661
+ * It will set `search_cutoff` to a default value of 300 meters if no cutoff value is passed.
662
+ * Additionally, if a `search_cutoff` is passed, it will be clamped to 1000 meters.
663
+ */
664
+ level?: number;
662
665
  }
663
666
 
664
667
  /**
665
- * Controls when a waypoint should be marked as complete.
666
- *
667
- * While a route may consist of thousands of points, waypoints are special.
668
- * A simple trip will have only one waypoint: the final destination.
669
- * A more complex trip may have several intermediate stops.
670
- * Just as the navigation state keeps track of which steps remain in the route,
671
- * it also tracks which waypoints are still remaining.
672
- *
673
- * Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
674
- * The waypoint advance mode specifies how the framework decides
675
- * that a waypoint has been visited (and is removed from the list).
668
+ * Status information that describes whether the user is proceeding according to the route or not.
676
669
  *
677
- * NOTE: Advancing to the next *step* and advancing to the next *waypoint*
678
- * are separate processes.
679
- * This will not normally cause any issues, but keep in mind that
680
- * manually advancing to the next step does not *necessarily* imply
681
- * that the waypoint will be marked as complete!
670
+ * Note that the name is intentionally a bit generic to allow for expansion of other states.
671
+ * For example, we could conceivably add a \"wrong way\" status in the future.
682
672
  */
683
- export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
673
+ export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
684
674
 
685
675
  /**
686
- * Controls filtering/post-processing of user course by the [`NavigationController`].
676
+ * Determines if the user has deviated from the expected route.
687
677
  */
688
- export type CourseFiltering = "SnapToRoute" | "Raw";
678
+ export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
679
+
680
+ export type SerializableStepAdvanceCondition = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceFromStep: { distance: number; minimumHorizontalAccuracy: number; calculateWhileOffRoute: boolean } } | { DistanceEntryExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { DistanceEntryAndSnappedExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { OrAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } } | { AndAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } };
681
+
682
+ export interface SerializableNavState {
683
+ tripState: TripState;
684
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
685
+ }
689
686
 
690
687
  /**
691
- * The state of a navigation session.
692
- *
693
- * This is produced by [`NavigationController`](super::NavigationController) methods
694
- * including [`get_initial_state`](super::NavigationController::get_initial_state)
695
- * and [`update_user_location`](super::NavigationController::update_user_location).
688
+ * Controls filtering/post-processing of user course by the [`NavigationController`].
696
689
  */
697
- export type TripState = { Idle: { user_location: UserLocation | undefined } } | { Navigating: { currentStepGeometryIndex: number | undefined; userLocation: UserLocation; snappedUserLocation: UserLocation; remainingSteps: RouteStep[]; remainingWaypoints: Waypoint[]; progress: TripProgress; summary: TripSummary; deviation: RouteDeviation; visualInstruction: VisualInstruction | undefined; spokenInstruction: SpokenInstruction | undefined; annotationJson: string | undefined } } | { Complete: { user_location: UserLocation; summary: TripSummary } };
690
+ export type CourseFiltering = "SnapToRoute" | "Raw";
698
691
 
699
692
  /**
700
693
  * Information pertaining to the user\'s full navigation trip. This includes
@@ -739,39 +732,64 @@ export interface TripProgress {
739
732
  durationRemaining: number;
740
733
  }
741
734
 
742
- export interface SerializableNavState {
743
- tripState: TripState;
744
- stepAdvanceCondition: SerializableStepAdvanceCondition;
745
- }
746
-
747
735
  /**
748
- * Status information that describes whether the user is proceeding according to the route or not.
736
+ * Controls when a waypoint should be marked as complete.
749
737
  *
750
- * Note that the name is intentionally a bit generic to allow for expansion of other states.
751
- * For example, we could conceivably add a \"wrong way\" status in the future.
752
- */
753
- export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
754
-
755
- /**
756
- * Determines if the user has deviated from the expected route.
738
+ * While a route may consist of thousands of points, waypoints are special.
739
+ * A simple trip will have only one waypoint: the final destination.
740
+ * A more complex trip may have several intermediate stops.
741
+ * Just as the navigation state keeps track of which steps remain in the route,
742
+ * it also tracks which waypoints are still remaining.
743
+ *
744
+ * Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
745
+ * The waypoint advance mode specifies how the framework decides
746
+ * that a waypoint has been visited (and is removed from the list).
747
+ *
748
+ * NOTE: Advancing to the next *step* and advancing to the next *waypoint*
749
+ * are separate processes.
750
+ * This will not normally cause any issues, but keep in mind that
751
+ * manually advancing to the next step does not *necessarily* imply
752
+ * that the waypoint will be marked as complete!
757
753
  */
758
- export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
759
-
760
- export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
754
+ export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
761
755
 
762
756
  /**
763
- * Controls how simulated locations deviate from the actual route line.
764
- * This simulates real-world GPS behavior where readings often have systematic bias.
757
+ * The state of a navigation session.
758
+ *
759
+ * This is produced by [`NavigationController`](super::NavigationController) methods
760
+ * including [`get_initial_state`](super::NavigationController::get_initial_state)
761
+ * and [`update_user_location`](super::NavigationController::update_user_location).
765
762
  */
766
- export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
763
+ export type TripState = { Idle: { user_location: UserLocation | undefined } } | { Navigating: { currentStepGeometryIndex: number | undefined; userLocation: UserLocation; snappedUserLocation: UserLocation; remainingSteps: RouteStep[]; remainingWaypoints: Waypoint[]; progress: TripProgress; summary: TripSummary; deviation: RouteDeviation; visualInstruction: VisualInstruction | undefined; spokenInstruction: SpokenInstruction | undefined; annotationJson: string | undefined } } | { Complete: { user_location: UserLocation; summary: TripSummary } };
767
764
 
768
- /**
769
- * The current state of the simulation.
770
- */
771
- export interface LocationSimulationState {
772
- current_location: UserLocation;
773
- remaining_locations: GeographicCoordinate[];
774
- bias: LocationBias;
765
+ export interface SerializableNavigationControllerConfig {
766
+ /**
767
+ * Configures when navigation advances to the next waypoint in the route.
768
+ */
769
+ waypointAdvance: WaypointAdvanceMode;
770
+ /**
771
+ * Configures when navigation advances to the next step in the route.
772
+ */
773
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
774
+ /**
775
+ * A special advance condition used for the final 2 route steps (last and arrival).
776
+ *
777
+ * This exists because several of our step advance conditions require entry and
778
+ * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
779
+ * the expected location updates for the core step advance condition.
780
+ */
781
+ arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
782
+ /**
783
+ * Configures when the user is deemed to be off course.
784
+ *
785
+ * NOTE: This is distinct from the action that is taken.
786
+ * It is only the determination that the user has deviated from the expected route.
787
+ */
788
+ routeDeviationTracking: RouteDeviationTracking;
789
+ /**
790
+ * Configures how the heading component of the snapped location is reported in [`TripState`].
791
+ */
792
+ snappedLocationCourseFiltering: CourseFiltering;
775
793
  }
776
794
 
777
795
  /**
@@ -781,10 +799,11 @@ export interface LocationSimulationState {
781
799
  */
782
800
  export class NavigationController {
783
801
  free(): void;
784
- constructor(route: any, config: any, should_record: any);
802
+ [Symbol.dispose](): void;
785
803
  getInitialState(location: any): any;
786
804
  advanceToNextStep(state: any): any;
787
805
  updateUserLocation(location: any, state: any): any;
806
+ constructor(route: any, config: any, should_record: any);
788
807
  }
789
808
  /**
790
809
  * A WebAssembly-compatible wrapper for `NavigationReplay` that exposes its functionality as a JavaScript object.
@@ -794,47 +813,51 @@ export class NavigationController {
794
813
  */
795
814
  export class NavigationReplay {
796
815
  free(): void;
797
- constructor(json: any);
798
- getEventByIndex(current_index: any): any;
816
+ [Symbol.dispose](): void;
799
817
  getAllEvents(): any;
818
+ getInitialRoute(): any;
819
+ getEventByIndex(current_index: any): any;
800
820
  getTotalDuration(): any;
801
821
  getInitialTimestamp(): any;
802
- getInitialRoute(): any;
822
+ constructor(json: any);
803
823
  }
804
824
  /**
805
- * JavaScript wrapper for `NavigationSession` (simple version).
825
+ * JavaScript wrapper for [`NavigationSession`] (simple version).
806
826
  * This wrapper provides basic navigation functionality without observers.
807
827
  */
808
828
  export class NavigationSession {
809
829
  free(): void;
810
- constructor(route: any, config: any);
830
+ [Symbol.dispose](): void;
811
831
  getInitialState(location: any): any;
812
832
  advanceToNextStep(state: any): any;
813
833
  updateUserLocation(location: any, state: any): any;
834
+ constructor(route: any, config: any);
814
835
  }
815
836
  /**
816
- * JavaScript wrapper for `NavigationSession` with recording capabilities.
837
+ * JavaScript wrapper for [`NavigationSession`] with recording capabilities.
817
838
  * This version includes a NavigationRecorder observer and provides direct access to recording functionality.
818
839
  */
819
840
  export class NavigationSessionRecording {
820
841
  free(): void;
821
- constructor(route: any, config: any);
842
+ [Symbol.dispose](): void;
843
+ getEvents(): any;
844
+ getRecording(): any;
822
845
  getInitialState(location: any): any;
823
846
  advanceToNextStep(state: any): any;
824
847
  updateUserLocation(location: any, state: any): any;
825
- getRecording(): any;
826
- getEvents(): any;
848
+ constructor(route: any, config: any);
827
849
  }
828
850
  /**
829
851
  * JavaScript wrapper for `RouteAdapter`.
830
852
  */
831
853
  export class RouteAdapter {
832
854
  free(): void;
855
+ [Symbol.dispose](): void;
856
+ parseResponse(response: Uint8Array): any;
857
+ generateRequest(user_location: any, waypoints: any): any;
833
858
  /**
834
859
  * Creates a new RouteAdapter with a Valhalla HTTP request generator and an OSRM response parser.
835
860
  * At the moment, this is the only supported combination.
836
861
  */
837
- constructor(endpoint_url: string, profile: string, costing_options_json?: string | null);
838
- generateRequest(user_location: any, waypoints: any): any;
839
- parseResponse(response: Uint8Array): any;
862
+ constructor(well_known_route_provider: WellKnownRouteProvider);
840
863
  }