@stadiamaps/ferrostar 0.43.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;
336
- }
298
+ export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
337
299
 
338
300
  /**
339
- * The speed of the user from the location provider.
301
+ * The content of a visual instruction.
340
302
  */
341
- export interface Speed {
342
- /**
343
- * The user\'s speed in meters per second.
344
- */
345
- value: number;
346
- /**
347
- * The accuracy of the speed value, measured in meters per second.
348
- */
349
- accuracy: number | undefined;
303
+ export interface LaneInfo {
304
+ active: boolean;
305
+ directions: string[];
306
+ activeDirection: string | undefined;
350
307
  }
351
308
 
352
309
  /**
353
- * The direction in which the user/device is observed to be traveling.
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.
354
313
  */
355
- export interface CourseOverGround {
314
+ export interface SpokenInstruction {
356
315
  /**
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).
316
+ * Plain-text instruction which can be synthesized with a TTS engine.
359
317
  */
360
- degrees: number;
318
+ text: string;
361
319
  /**
362
- * The accuracy of the course value, measured in degrees.
320
+ * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
363
321
  */
364
- accuracy: number | undefined;
322
+ ssml: string | undefined;
323
+ /**
324
+ * How far (in meters) from the upcoming maneuver the instruction should start being spoken.
325
+ */
326
+ triggerDistanceBeforeManeuver: number;
327
+ /**
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.
336
+ */
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
  *
@@ -399,22 +379,112 @@ export type WaypointKind = "Break" | "Via";
399
379
  export interface Waypoint {
400
380
  coordinate: GeographicCoordinate;
401
381
  kind: WaypointKind;
382
+ /**
383
+ * Optional additional properties that will be passed on to the [`crate::routing_adapters::RouteRequestGenerator`].
384
+ *
385
+ * Most users should prefer convenience functions like [`Waypoint::new_with_valhalla_properties`]
386
+ * (or, on platforms like iOS and Android with `UniFFI` bindings, [`crate::routing_adapters::valhalla::create_waypoint_with_valhalla_properties`]).
387
+ *
388
+ * # Format guidelines
389
+ *
390
+ * This MAY be any format agreed upon by both the request generator and response parser.
391
+ * However, to promote interoperability, all implementations in the Ferrostar codebase
392
+ * MUST use JSON.
393
+ *
394
+ * We selected JSON is selected not because it is good,
395
+ * but because generics (i.e., becoming `Waypoint<T>`, where an example `T` is `ValhallaProperties`)
396
+ * would be way too painful, particularly for foreign code.
397
+ * Especially JavaScript.
398
+ *
399
+ * In any case, [`crate::routing_adapters::RouteRequestGenerator`] and [`crate::routing_adapters::RouteResponseParser`]
400
+ * implementations SHOULD document their level support for this,
401
+ * ideally with an exportable record type.
402
+ */
403
+ properties: number[] | undefined;
402
404
  }
403
405
 
404
406
  /**
405
- * A geographic coordinate in WGS84.
407
+ * The content of a visual instruction.
406
408
  */
407
- export interface GeographicCoordinate {
409
+ export interface VisualInstructionContent {
408
410
  /**
409
- * The latitude (in degrees).
411
+ * The text to display.
410
412
  */
411
- lat: number;
413
+ text: string;
412
414
  /**
413
- * The Longitude (in degrees).
415
+ * A standardized maneuver type (if any).
414
416
  */
415
- lng: number;
417
+ maneuverType: ManeuverType | undefined;
418
+ /**
419
+ * A standardized maneuver modifier (if any).
420
+ */
421
+ maneuverModifier: ManeuverModifier | undefined;
422
+ /**
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.
428
+ */
429
+ roundaboutExitDegrees: number | undefined;
430
+ /**
431
+ * Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
432
+ */
433
+ laneInfo: LaneInfo[] | undefined;
434
+ /**
435
+ * The exit number (or similar identifier like \"8B\").
436
+ */
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 {
450
+ /**
451
+ * The name of the street that the waypoint snapped to.
452
+ */
453
+ name: string | undefined;
454
+ /**
455
+ * The distance (in meters) between the snapped point and the input coordinate.
456
+ */
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 {
473
+ /**
474
+ * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
475
+ */
476
+ timestamp: number;
477
+ /**
478
+ * Data associated with the event.
479
+ */
480
+ event_data: NavigationRecordingEventData;
416
481
  }
417
482
 
483
+ /**
484
+ * Configurations for built-in route providers.
485
+ */
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
+
418
488
  export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
419
489
 
420
490
  /**
@@ -432,108 +502,192 @@ export interface LocationSimulationState {
432
502
  bias: LocationBias;
433
503
  }
434
504
 
435
- export type SerializableStepAdvanceCondition = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceFromStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceEntryExit: { distanceToEndOfStep: number; distanceAfterEndStep: number; minimumHorizontalAccuracy: number; hasReachedEndOfCurrentStep: boolean } } | { OrAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } } | { AndAdvanceConditions: { conditions: SerializableStepAdvanceCondition[] } };
505
+ export type GraphHopperVoiceUnits = "metric" | "imperial";
436
506
 
437
507
  /**
438
- * Status information that describes whether the user is proceeding according to the route or not.
508
+ * Waypoint properties supported by Valhalla servers.
439
509
  *
440
- * Note that the name is intentionally a bit generic to allow for expansion of other states.
441
- * For example, we could conceivably add a \"wrong way\" status in the future.
510
+ * Our docstrings are short here, since Valhalla is the final authority.
511
+ * Refer to <https://valhalla.github.io/valhalla/api/turn-by-turn/api-reference/#locations>
512
+ * for more details, including default values.
513
+ * Other Valhalla-based APIs such as Stadia Maps or Mapbox may have slightly different defaults.
514
+ * Refer to your vendor\'s documentation when in doubt.
515
+ *
516
+ * NOTE: Waypoint properties will NOT currently be echoed back in OSRM format,
517
+ * so these are sent to the server one time.
442
518
  */
443
- export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
519
+ export interface ValhallaWaypointProperties {
520
+ /**
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`.
526
+ */
527
+ heading: number | undefined;
528
+ /**
529
+ * How close in degrees a given street\'s angle must be
530
+ * in order for it to be considered as in the same direction of the heading parameter.
531
+ */
532
+ heading_tolerance: number | undefined;
533
+ /**
534
+ * Minimum number of nodes (intersections) reachable for a given edge
535
+ * (road between intersections) to consider that edge as belonging to a connected region.
536
+ * Disconnected edges are ignored.
537
+ */
538
+ minimum_reachability: number | undefined;
539
+ /**
540
+ * The number of meters about this input location within which edges
541
+ * will be considered as candidates for said location.
542
+ * If there are no candidates within this distance,
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.
551
+ */
552
+ radius: number | undefined;
553
+ /**
554
+ * Determines whether the location should be visited from the same, opposite or either side of the road,
555
+ * with respect to the side of the road the given locale drives on.
556
+ *
557
+ * NOTE: If the location is not offset from the road centerline
558
+ * or is very close to an intersection, this option has no effect!
559
+ */
560
+ preferred_side: ValhallaWaypointPreferredSide | undefined;
561
+ /**
562
+ * Latitude of the map location in degrees.
563
+ *
564
+ * If provided, the waypoint location will still be used for routing,
565
+ * but these coordinates will determine the side of the street.
566
+ */
567
+ display_coordinate: GeographicCoordinate | undefined;
568
+ /**
569
+ * The cutoff at which we will assume the input is too far away from civilization
570
+ * to be worth correlating to the nearest graph elements.
571
+ */
572
+ search_cutoff: number | undefined;
573
+ /**
574
+ * During edge correlation, this is the tolerance used to determine whether to snap
575
+ * to the intersection rather than along the street.
576
+ * If the snap location is within this distance from the intersection,
577
+ * the intersection is used instead.
578
+ */
579
+ node_snap_tolerance: number | undefined;
580
+ /**
581
+ * A tolerance in meters from the edge centerline used for determining the side of the street
582
+ * that the location is on.
583
+ * If the distance to the centerline is less than this tolerance,
584
+ * no side will be inferred.
585
+ * Otherwise, the left or right side will be selected depending on the direction of travel.
586
+ */
587
+ street_side_tolerance: number | undefined;
588
+ /**
589
+ * The max distance in meters that the input coordinates or display lat/lon can be
590
+ * from the edge centerline for them to be used for determining the side of the street.
591
+ * Beyond this distance, no street side is inferred.
592
+ */
593
+ street_side_max_distance: number | undefined;
594
+ /**
595
+ * Disables the `preferred_side` when set to `same` or `opposite`
596
+ * if the edge has a road class less than that provided by `street_side_cutoff`.
597
+ */
598
+ street_side_cutoff: ValhallaRoadClass | undefined;
599
+ /**
600
+ * A set of optional filters to exclude candidate edges based on their attributes.
601
+ */
602
+ search_filter: ValhallaLocationSearchFilter | undefined;
603
+ }
444
604
 
445
605
  /**
446
- * Determines if the user has deviated from the expected route.
606
+ * Specifies a preferred side for departing from / arriving at a location.
607
+ *
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.
447
613
  */
448
- export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
614
+ export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
449
615
 
450
616
  /**
451
- * The event type.
617
+ * A road class in the Valhalla taxonomy.
452
618
  *
453
- * For full replayability, we record things like rerouting, and not just location updates.
619
+ * These are ordered from highest (fastest travel speed) to lowest.
454
620
  */
455
- 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";
456
622
 
457
623
  /**
458
- * An event that occurs during navigation.
459
- *
460
- * This is used for the optional session recording / telemetry.
624
+ * A set of optional filters to exclude candidate edges based on their attributes.
461
625
  */
462
- export interface NavigationRecordingEvent {
626
+ export interface ValhallaLocationSearchFilter {
463
627
  /**
464
- * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
628
+ * Whether to exclude roads marked as tunnels.
465
629
  */
466
- timestamp: number;
630
+ exclude_tunnel?: boolean;
467
631
  /**
468
- * Data associated with the event.
632
+ * Whether to exclude roads marked as bridges.
469
633
  */
470
- event_data: NavigationRecordingEventData;
471
- }
472
-
473
- export interface SerializableNavigationControllerConfig {
634
+ exclude_bridge?: boolean;
474
635
  /**
475
- * Configures when navigation advances to the next waypoint in the route.
636
+ * Whether to exclude roads with tolls.
476
637
  */
477
- waypointAdvance: WaypointAdvanceMode;
638
+ exclude_tolls?: boolean;
478
639
  /**
479
- * Configures when navigation advances to the next step in the route.
640
+ * Whether to exclude ferries.
480
641
  */
481
- stepAdvanceCondition: SerializableStepAdvanceCondition;
642
+ exclude_ferry?: boolean;
482
643
  /**
483
- * A special advance condition used for the final 2 route steps (last and arrival).
484
- *
485
- * This exists because several of our step advance conditions require entry and
486
- * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
487
- * the expected location updates for the core step advance condition.
644
+ * Whether to exclude roads marked as ramps.
488
645
  */
489
- arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
646
+ exclude_ramp?: boolean;
490
647
  /**
491
- * Configures when the user is deemed to be off course.
492
- *
493
- * NOTE: This is distinct from the action that is taken.
494
- * 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.
495
649
  */
496
- routeDeviationTracking: RouteDeviationTracking;
650
+ exclude_closures?: boolean;
497
651
  /**
498
- * Configures how the heading component of the snapped location is reported in [`TripState`].
652
+ * The lowest road class allowed.
499
653
  */
500
- 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;
501
665
  }
502
666
 
503
667
  /**
504
- * Controls when a waypoint should be marked as complete.
505
- *
506
- * While a route may consist of thousands of points, waypoints are special.
507
- * A simple trip will have only one waypoint: the final destination.
508
- * A more complex trip may have several intermediate stops.
509
- * Just as the navigation state keeps track of which steps remain in the route,
510
- * it also tracks which waypoints are still remaining.
511
- *
512
- * Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
513
- * The waypoint advance mode specifies how the framework decides
514
- * 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.
515
669
  *
516
- * NOTE: Advancing to the next *step* and advancing to the next *waypoint*
517
- * are separate processes.
518
- * This will not normally cause any issues, but keep in mind that
519
- * manually advancing to the next step does not *necessarily* imply
520
- * 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.
521
672
  */
522
- export type WaypointAdvanceMode = { WaypointWithinRange: number };
673
+ export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
523
674
 
524
675
  /**
525
- * Controls filtering/post-processing of user course by the [`NavigationController`].
676
+ * Determines if the user has deviated from the expected route.
526
677
  */
527
- 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
+ }
528
686
 
529
687
  /**
530
- * The state of a navigation session.
531
- *
532
- * This is produced by [`NavigationController`](super::NavigationController) methods
533
- * including [`get_initial_state`](super::NavigationController::get_initial_state)
534
- * and [`update_user_location`](super::NavigationController::update_user_location).
688
+ * Controls filtering/post-processing of user course by the [`NavigationController`].
535
689
  */
536
- 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";
537
691
 
538
692
  /**
539
693
  * Information pertaining to the user\'s full navigation trip. This includes
@@ -578,9 +732,64 @@ export interface TripProgress {
578
732
  durationRemaining: number;
579
733
  }
580
734
 
581
- export interface SerializableNavState {
582
- tripState: TripState;
735
+ /**
736
+ * Controls when a waypoint should be marked as complete.
737
+ *
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!
753
+ */
754
+ export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
755
+
756
+ /**
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).
762
+ */
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 } };
764
+
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
+ */
583
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;
584
793
  }
585
794
 
586
795
  /**
@@ -590,10 +799,11 @@ export interface SerializableNavState {
590
799
  */
591
800
  export class NavigationController {
592
801
  free(): void;
593
- constructor(route: any, config: any, should_record: any);
802
+ [Symbol.dispose](): void;
594
803
  getInitialState(location: any): any;
595
804
  advanceToNextStep(state: any): any;
596
805
  updateUserLocation(location: any, state: any): any;
806
+ constructor(route: any, config: any, should_record: any);
597
807
  }
598
808
  /**
599
809
  * A WebAssembly-compatible wrapper for `NavigationReplay` that exposes its functionality as a JavaScript object.
@@ -603,47 +813,51 @@ export class NavigationController {
603
813
  */
604
814
  export class NavigationReplay {
605
815
  free(): void;
606
- constructor(json: any);
607
- getEventByIndex(current_index: any): any;
816
+ [Symbol.dispose](): void;
608
817
  getAllEvents(): any;
818
+ getInitialRoute(): any;
819
+ getEventByIndex(current_index: any): any;
609
820
  getTotalDuration(): any;
610
821
  getInitialTimestamp(): any;
611
- getInitialRoute(): any;
822
+ constructor(json: any);
612
823
  }
613
824
  /**
614
- * JavaScript wrapper for `NavigationSession` (simple version).
825
+ * JavaScript wrapper for [`NavigationSession`] (simple version).
615
826
  * This wrapper provides basic navigation functionality without observers.
616
827
  */
617
828
  export class NavigationSession {
618
829
  free(): void;
619
- constructor(route: any, config: any);
830
+ [Symbol.dispose](): void;
620
831
  getInitialState(location: any): any;
621
832
  advanceToNextStep(state: any): any;
622
833
  updateUserLocation(location: any, state: any): any;
834
+ constructor(route: any, config: any);
623
835
  }
624
836
  /**
625
- * JavaScript wrapper for `NavigationSession` with recording capabilities.
837
+ * JavaScript wrapper for [`NavigationSession`] with recording capabilities.
626
838
  * This version includes a NavigationRecorder observer and provides direct access to recording functionality.
627
839
  */
628
840
  export class NavigationSessionRecording {
629
841
  free(): void;
630
- constructor(route: any, config: any);
842
+ [Symbol.dispose](): void;
843
+ getEvents(): any;
844
+ getRecording(): any;
631
845
  getInitialState(location: any): any;
632
846
  advanceToNextStep(state: any): any;
633
847
  updateUserLocation(location: any, state: any): any;
634
- getRecording(): any;
635
- getEvents(): any;
848
+ constructor(route: any, config: any);
636
849
  }
637
850
  /**
638
851
  * JavaScript wrapper for `RouteAdapter`.
639
852
  */
640
853
  export class RouteAdapter {
641
854
  free(): void;
855
+ [Symbol.dispose](): void;
856
+ parseResponse(response: Uint8Array): any;
857
+ generateRequest(user_location: any, waypoints: any): any;
642
858
  /**
643
859
  * Creates a new RouteAdapter with a Valhalla HTTP request generator and an OSRM response parser.
644
860
  * At the moment, this is the only supported combination.
645
861
  */
646
- constructor(endpoint_url: string, profile: string, costing_options_json?: string | null);
647
- generateRequest(user_location: any, waypoints: any): any;
648
- parseResponse(response: Uint8Array): any;
862
+ constructor(well_known_route_provider: WellKnownRouteProvider);
649
863
  }