@stadiamaps/ferrostar 0.47.2 → 0.48.1

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,80 +1,150 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * The location of the user that is navigating.
5
- *
6
- * In addition to coordinates, this includes estimated accuracy and course information,
7
- * which can influence navigation logic and UI.
8
- *
9
- * NOTE: Heading is absent on purpose.
10
- * Heading updates are not related to a change in the user\'s location.
4
+ * The type of incident that has occurred.
11
5
  */
12
- export interface UserLocation {
13
- coordinates: GeographicCoordinate;
14
- /**
15
- * The estimated accuracy of the coordinate (in meters)
16
- */
17
- horizontalAccuracy: number;
18
- courseOverGround: CourseOverGround | undefined;
19
- timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
20
- speed: Speed | undefined;
21
- }
6
+ export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
22
7
 
23
8
  /**
24
- * The type of incident that has occurred.
9
+ * Additional information to further specify a [`ManeuverType`].
25
10
  */
26
- export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
11
+ export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
27
12
 
28
13
  /**
29
- * The broad class of maneuver to perform.
14
+ * Information describing the series of steps needed to travel between two or more points.
30
15
  *
31
- * This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
16
+ * NOTE: This type is unstable and is still under active development and should be
17
+ * considered unstable.
32
18
  */
33
- 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";
19
+ export interface Route {
20
+ geometry: GeographicCoordinate[];
21
+ bbox: BoundingBox;
22
+ /**
23
+ * The total route distance, in meters.
24
+ */
25
+ distance: number;
26
+ /**
27
+ * The ordered list of waypoints to visit, including the starting point.
28
+ * Note that this is distinct from the *geometry* which includes all points visited.
29
+ * A waypoint represents a start/end point for a route leg.
30
+ */
31
+ waypoints: Waypoint[];
32
+ steps: RouteStep[];
33
+ }
34
34
 
35
35
  /**
36
- * An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver.
37
- *
38
- * Note that these do not have any locale information attached.
36
+ * The content of a visual instruction.
39
37
  */
40
- export interface SpokenInstruction {
38
+ export interface LaneInfo {
39
+ active: boolean;
40
+ directions: string[];
41
+ activeDirection: string | undefined;
42
+ }
43
+
44
+ /**
45
+ * A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
46
+ * the next step.
47
+ */
48
+ export interface RouteStep {
41
49
  /**
42
- * Plain-text instruction which can be synthesized with a TTS engine.
50
+ * The full route geometry for this step.
43
51
  */
44
- text: string;
52
+ geometry: GeographicCoordinate[];
45
53
  /**
46
- * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
54
+ * The distance, in meters, to travel along the route after the maneuver to reach the next step.
47
55
  */
48
- ssml: string | undefined;
56
+ distance: number;
49
57
  /**
50
- * How far (in meters) from the upcoming maneuver the instruction should start being spoken.
58
+ * The estimated duration, in seconds, that it will take to complete this step.
51
59
  */
52
- triggerDistanceBeforeManeuver: number;
60
+ duration: number;
53
61
  /**
54
- * A unique identifier for this instruction.
62
+ * The name of the road being traveled on (useful for certain UI styles).
63
+ */
64
+ roadName: string | undefined;
65
+ /**
66
+ * A list of exits (name or number).
67
+ */
68
+ exits: string[];
69
+ /**
70
+ * A description of the maneuver (ex: \"Turn wright onto main street\").
55
71
  *
56
- * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances,
57
- * which may have the same textual content.
58
- * UUIDs conveniently fill this purpose.
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.
75
+ */
76
+ instruction: string;
77
+ /**
78
+ * A list of instructions for visual display (usually as banners) at specific points along the step.
79
+ */
80
+ visualInstructions: VisualInstruction[];
81
+ /**
82
+ * A list of prompts to announce (via speech synthesis) at specific points along the step.
83
+ */
84
+ spokenInstructions: SpokenInstruction[];
85
+ /**
86
+ * A list of json encoded strings representing annotations between each coordinate along the step.
87
+ */
88
+ annotations: string[] | undefined;
89
+ /**
90
+ * A list of incidents that occur along the step.
91
+ */
92
+ incidents: Incident[];
93
+ /**
94
+ * Which side of the road traffic drives on for this step.
59
95
  *
60
- * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time.
61
- * This should be theoretically possible though if someone cares to write up a proposal and a PR.
96
+ * This is relevant for roundabouts: left-hand traffic (e.g. UK) uses clockwise roundabouts,
97
+ * while right-hand traffic uses counterclockwise roundabouts.
62
98
  */
63
- utteranceId: string;
99
+ drivingSide: DrivingSide | undefined;
100
+ /**
101
+ * The exit number when entering a roundabout (1 = first exit, 2 = second, etc.).
102
+ */
103
+ roundaboutExitNumber: number | undefined;
64
104
  }
65
105
 
66
106
  /**
67
- * A geographic bounding box defined by its corners.
107
+ * The location of the user that is navigating.
108
+ *
109
+ * In addition to coordinates, this includes estimated accuracy and course information,
110
+ * which can influence navigation logic and UI.
111
+ *
112
+ * NOTE: Heading is absent on purpose.
113
+ * Heading updates are not related to a change in the user\'s location.
68
114
  */
69
- export interface BoundingBox {
115
+ export interface UserLocation {
116
+ coordinates: GeographicCoordinate;
70
117
  /**
71
- * The southwest corner of the bounding box.
118
+ * The estimated accuracy of the coordinate (in meters)
72
119
  */
73
- sw: GeographicCoordinate;
120
+ horizontalAccuracy: number;
121
+ courseOverGround: CourseOverGround | undefined;
122
+ timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
123
+ speed: Speed | undefined;
124
+ }
125
+
126
+ /**
127
+ * An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
128
+ */
129
+ export interface VisualInstruction {
74
130
  /**
75
- * The northeast corner of the bounding box.
131
+ * The primary instruction content.
132
+ *
133
+ * This is usually given more visual weight.
76
134
  */
77
- ne: GeographicCoordinate;
135
+ primaryContent: VisualInstructionContent;
136
+ /**
137
+ * Optional secondary instruction content.
138
+ */
139
+ secondaryContent: VisualInstructionContent | undefined;
140
+ /**
141
+ * Optional sub-maneuver instruction content.
142
+ */
143
+ subContent: VisualInstructionContent | undefined;
144
+ /**
145
+ * How far (in meters) from the upcoming maneuver the instruction should start being displayed
146
+ */
147
+ triggerDistanceBeforeManeuver: number;
78
148
  }
79
149
 
80
150
  /**
@@ -163,34 +233,17 @@ export interface Incident {
163
233
  }
164
234
 
165
235
  /**
166
- * The direction in which the user/device is observed to be traveling.
236
+ * A geographic bounding box defined by its corners.
167
237
  */
168
- export interface CourseOverGround {
169
- /**
170
- * The direction in which the user\'s device is traveling, measured in clockwise degrees from
171
- * true north (N = 0, E = 90, S = 180, W = 270).
172
- */
173
- degrees: number;
238
+ export interface BoundingBox {
174
239
  /**
175
- * The accuracy of the course value, measured in degrees.
240
+ * The southwest corner of the bounding box.
176
241
  */
177
- accuracy: number | undefined;
178
- }
179
-
180
- /**
181
- * Details about congestion for an incident.
182
- */
183
- export interface Congestion {
242
+ sw: GeographicCoordinate;
184
243
  /**
185
- * The level of congestion caused by the incident.
186
- *
187
- * 0 = no congestion
188
- *
189
- * 100 = road closed
190
- *
191
- * Other values mean no congestion was calculated
244
+ * The northeast corner of the bounding box.
192
245
  */
193
- value: number;
246
+ ne: GeographicCoordinate;
194
247
  }
195
248
 
196
249
  /**
@@ -207,176 +260,6 @@ export interface GeographicCoordinate {
207
260
  lng: number;
208
261
  }
209
262
 
210
- /**
211
- * The content of a visual instruction.
212
- */
213
- export interface VisualInstructionContent {
214
- /**
215
- * The text to display.
216
- */
217
- text: string;
218
- /**
219
- * A standardized maneuver type (if any).
220
- */
221
- maneuverType: ManeuverType | undefined;
222
- /**
223
- * A standardized maneuver modifier (if any).
224
- */
225
- maneuverModifier: ManeuverModifier | undefined;
226
- /**
227
- * If applicable, the number of degrees you need to go around the roundabout before exiting.
228
- *
229
- * For example, entering and exiting the roundabout in the same direction of travel
230
- * (as if you had gone straight, apart from the detour)
231
- * would be an exit angle of 180 degrees.
232
- */
233
- roundaboutExitDegrees: number | undefined;
234
- /**
235
- * Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
236
- */
237
- laneInfo: LaneInfo[] | undefined;
238
- /**
239
- * The exit number (or similar identifier like \"8B\").
240
- */
241
- exitNumbers: string[];
242
- }
243
-
244
- /**
245
- * An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
246
- */
247
- export interface VisualInstruction {
248
- /**
249
- * The primary instruction content.
250
- *
251
- * This is usually given more visual weight.
252
- */
253
- primaryContent: VisualInstructionContent;
254
- /**
255
- * Optional secondary instruction content.
256
- */
257
- secondaryContent: VisualInstructionContent | undefined;
258
- /**
259
- * Optional sub-maneuver instruction content.
260
- */
261
- subContent: VisualInstructionContent | undefined;
262
- /**
263
- * How far (in meters) from the upcoming maneuver the instruction should start being displayed
264
- */
265
- triggerDistanceBeforeManeuver: number;
266
- }
267
-
268
- /**
269
- * The speed of the user from the location provider.
270
- */
271
- export interface Speed {
272
- /**
273
- * The user\'s speed in meters per second.
274
- */
275
- value: number;
276
- /**
277
- * The accuracy of the speed value, measured in meters per second.
278
- */
279
- accuracy: number | undefined;
280
- }
281
-
282
- /**
283
- * The content of a visual instruction.
284
- */
285
- export interface LaneInfo {
286
- active: boolean;
287
- directions: string[];
288
- activeDirection: string | undefined;
289
- }
290
-
291
- /**
292
- * The impact of the incident that has occurred.
293
- */
294
- export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
295
-
296
- /**
297
- * Information describing the series of steps needed to travel between two or more points.
298
- *
299
- * NOTE: This type is unstable and is still under active development and should be
300
- * considered unstable.
301
- */
302
- export interface Route {
303
- geometry: GeographicCoordinate[];
304
- bbox: BoundingBox;
305
- /**
306
- * The total route distance, in meters.
307
- */
308
- distance: number;
309
- /**
310
- * The ordered list of waypoints to visit, including the starting point.
311
- * Note that this is distinct from the *geometry* which includes all points visited.
312
- * A waypoint represents a start/end point for a route leg.
313
- */
314
- waypoints: Waypoint[];
315
- steps: RouteStep[];
316
- }
317
-
318
- /**
319
- * A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
320
- * the next step.
321
- */
322
- export interface RouteStep {
323
- /**
324
- * The full route geometry for this step.
325
- */
326
- geometry: GeographicCoordinate[];
327
- /**
328
- * The distance, in meters, to travel along the route after the maneuver to reach the next step.
329
- */
330
- distance: number;
331
- /**
332
- * The estimated duration, in seconds, that it will take to complete this step.
333
- */
334
- duration: number;
335
- /**
336
- * The name of the road being traveled on (useful for certain UI styles).
337
- */
338
- roadName: string | undefined;
339
- /**
340
- * A list of exits (name or number).
341
- */
342
- exits: string[];
343
- /**
344
- * A description of the maneuver (ex: \"Turn wright onto main street\").
345
- *
346
- * Note for UI implementers: the context this appears in (or doesn\'t)
347
- * depends somewhat on your use case and routing engine.
348
- * For example, this field is useful as a written instruction in Valhalla.
349
- */
350
- instruction: string;
351
- /**
352
- * A list of instructions for visual display (usually as banners) at specific points along the step.
353
- */
354
- visualInstructions: VisualInstruction[];
355
- /**
356
- * A list of prompts to announce (via speech synthesis) at specific points along the step.
357
- */
358
- spokenInstructions: SpokenInstruction[];
359
- /**
360
- * A list of json encoded strings representing annotations between each coordinate along the step.
361
- */
362
- annotations: string[] | undefined;
363
- /**
364
- * A list of incidents that occur along the step.
365
- */
366
- incidents: Incident[];
367
- /**
368
- * Which side of the road traffic drives on for this step.
369
- *
370
- * This is relevant for roundabouts: left-hand traffic (e.g. UK) uses clockwise roundabouts,
371
- * while right-hand traffic uses counterclockwise roundabouts.
372
- */
373
- drivingSide: DrivingSide | undefined;
374
- /**
375
- * The exit number when entering a roundabout (1 = first exit, 2 = second, etc.).
376
- */
377
- roundaboutExitNumber: number | undefined;
378
- }
379
-
380
263
  /**
381
264
  * A waypoint along a route.
382
265
  *
@@ -418,149 +301,174 @@ export interface Waypoint {
418
301
  }
419
302
 
420
303
  /**
421
- * Additional information to further specify a [`ManeuverType`].
304
+ * An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver.
305
+ *
306
+ * Note that these do not have any locale information attached.
422
307
  */
423
- export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
308
+ export interface SpokenInstruction {
309
+ /**
310
+ * Plain-text instruction which can be synthesized with a TTS engine.
311
+ */
312
+ text: string;
313
+ /**
314
+ * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
315
+ */
316
+ ssml: string | undefined;
317
+ /**
318
+ * How far (in meters) from the upcoming maneuver the instruction should start being spoken.
319
+ */
320
+ triggerDistanceBeforeManeuver: number;
321
+ /**
322
+ * A unique identifier for this instruction.
323
+ *
324
+ * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances,
325
+ * which may have the same textual content.
326
+ * UUIDs conveniently fill this purpose.
327
+ *
328
+ * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time.
329
+ * This should be theoretically possible though if someone cares to write up a proposal and a PR.
330
+ */
331
+ utteranceId: string;
332
+ }
424
333
 
425
334
  /**
426
- * Describes characteristics of the waypoint for routing purposes.
335
+ * The direction in which the user/device is observed to be traveling.
427
336
  */
428
- export type WaypointKind = "Break" | "Via";
337
+ export interface CourseOverGround {
338
+ /**
339
+ * The direction in which the user\'s device is traveling, measured in clockwise degrees from
340
+ * true north (N = 0, E = 90, S = 180, W = 270).
341
+ */
342
+ degrees: number;
343
+ /**
344
+ * The accuracy of the course value, measured in degrees.
345
+ */
346
+ accuracy: number | undefined;
347
+ }
429
348
 
430
349
  /**
431
- * Which side of the road traffic drives on.
350
+ * The broad class of maneuver to perform.
432
351
  *
433
- * This is needed by consumers like Android Auto to determine whether
434
- * a roundabout should be rendered as clockwise (right-hand traffic)
435
- * or counterclockwise (left-hand traffic).
436
- */
437
- export type DrivingSide = "left" | "right";
438
-
439
- /**
440
- * The lane type blocked by the incident.
352
+ * This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
441
353
  */
442
- export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
354
+ 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";
443
355
 
444
356
  /**
445
- * Configurations for built-in route providers.
357
+ * The speed of the user from the location provider.
446
358
  */
447
- export type WellKnownRouteProvider = { Valhalla: { endpointUrl: string; profile: string; optionsJson?: string | undefined } } | { GraphHopper: { endpointUrl: string; profile: string; locale: string; voiceUnits: GraphHopperVoiceUnits; optionsJson?: string | undefined } };
448
-
449
- export type GraphHopperVoiceUnits = "metric" | "imperial";
359
+ export interface Speed {
360
+ /**
361
+ * The user\'s speed in meters per second.
362
+ */
363
+ value: number;
364
+ /**
365
+ * The accuracy of the speed value, measured in meters per second.
366
+ */
367
+ accuracy: number | undefined;
368
+ }
450
369
 
451
370
  /**
452
- * The state of a navigation session.
453
- *
454
- * This is produced by [`NavigationController`](super::NavigationController) methods
455
- * including [`get_initial_state`](super::NavigationController::get_initial_state)
456
- * and [`update_user_location`](super::NavigationController::update_user_location).
371
+ * The impact of the incident that has occurred.
457
372
  */
458
- 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 } };
373
+ export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
459
374
 
460
375
  /**
461
- * High-level state describing progress through a route.
376
+ * Details about congestion for an incident.
462
377
  */
463
- export interface TripProgress {
464
- /**
465
- * The distance to the next maneuver, in meters.
466
- */
467
- distanceToNextManeuver: number;
378
+ export interface Congestion {
468
379
  /**
469
- * The total distance remaining in the trip, in meters.
380
+ * The level of congestion caused by the incident.
470
381
  *
471
- * This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
472
- */
473
- distanceRemaining: number;
474
- /**
475
- * The total duration remaining in the trip, in seconds.
382
+ * 0 = no congestion
383
+ *
384
+ * 100 = road closed
385
+ *
386
+ * Other values mean no congestion was calculated
476
387
  */
477
- durationRemaining: number;
478
- }
479
-
480
- /**
481
- * Controls when a waypoint should be marked as complete.
482
- *
483
- * While a route may consist of thousands of points, waypoints are special.
484
- * A simple trip will have only one waypoint: the final destination.
485
- * A more complex trip may have several intermediate stops.
486
- * Just as the navigation state keeps track of which steps remain in the route,
487
- * it also tracks which waypoints are still remaining.
488
- *
489
- * Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
490
- * The waypoint advance mode specifies how the framework decides
491
- * that a waypoint has been visited (and is removed from the list).
492
- *
493
- * NOTE: Advancing to the next *step* and advancing to the next *waypoint*
494
- * are separate processes.
495
- * This will not normally cause any issues, but keep in mind that
496
- * manually advancing to the next step does not *necessarily* imply
497
- * that the waypoint will be marked as complete!
388
+ value: number;
389
+ }
390
+
391
+ /**
392
+ * The lane type blocked by the incident.
498
393
  */
499
- export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
394
+ export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
500
395
 
501
- export interface SerializableNavState {
502
- tripState: TripState;
503
- stepAdvanceCondition: SerializableStepAdvanceCondition;
504
- }
396
+ /**
397
+ * Describes characteristics of the waypoint for routing purposes.
398
+ */
399
+ export type WaypointKind = "Break" | "Via";
505
400
 
506
401
  /**
507
- * Information pertaining to the user\'s full navigation trip. This includes
508
- * simple stats like total duration and distance.
402
+ * The content of a visual instruction.
509
403
  */
510
- export interface TripSummary {
404
+ export interface VisualInstructionContent {
511
405
  /**
512
- * The total raw distance traveled in the trip, in meters.
406
+ * The text to display.
513
407
  */
514
- distanceTraveled: number;
408
+ text: string;
515
409
  /**
516
- * The total snapped distance traveled in the trip, in meters.
410
+ * A standardized maneuver type (if any).
517
411
  */
518
- snappedDistanceTraveled: number;
412
+ maneuverType: ManeuverType | undefined;
519
413
  /**
520
- * When the trip was started.
414
+ * A standardized maneuver modifier (if any).
521
415
  */
522
- startedAt: Date;
416
+ maneuverModifier: ManeuverModifier | undefined;
523
417
  /**
524
- * When the trip was completed or canceled.
418
+ * If applicable, the number of degrees you need to go around the roundabout before exiting.
419
+ *
420
+ * For example, entering and exiting the roundabout in the same direction of travel
421
+ * (as if you had gone straight, apart from the detour)
422
+ * would be an exit angle of 180 degrees.
525
423
  */
526
- endedAt: Date | null;
424
+ roundaboutExitDegrees: number | undefined;
425
+ /**
426
+ * Detailed information about the lanes. This is typically only present in sub-maneuver instructions.
427
+ */
428
+ laneInfo: LaneInfo[] | undefined;
429
+ /**
430
+ * The exit number (or similar identifier like \"8B\").
431
+ */
432
+ exitNumbers: string[];
527
433
  }
528
434
 
529
435
  /**
530
- * Controls filtering/post-processing of user course by the [`NavigationController`].
436
+ * Which side of the road traffic drives on.
437
+ *
438
+ * This is needed by consumers like Android Auto to determine whether
439
+ * a roundabout should be rendered as clockwise (right-hand traffic)
440
+ * or counterclockwise (left-hand traffic).
531
441
  */
532
- export type CourseFiltering = "SnapToRoute" | "Raw";
442
+ export type DrivingSide = "left" | "right";
533
443
 
534
- export interface SerializableNavigationControllerConfig {
535
- /**
536
- * Configures when navigation advances to the next waypoint in the route.
537
- */
538
- waypointAdvance: WaypointAdvanceMode;
539
- /**
540
- * Configures when navigation advances to the next step in the route.
541
- */
542
- stepAdvanceCondition: SerializableStepAdvanceCondition;
543
- /**
544
- * A special advance condition used for the final 2 route steps (last and arrival).
545
- *
546
- * This exists because several of our step advance conditions require entry and
547
- * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
548
- * the expected location updates for the core step advance condition.
549
- */
550
- arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
444
+ /**
445
+ * Configurations for built-in route providers.
446
+ */
447
+ export type WellKnownRouteProvider = { Valhalla: { endpointUrl: string; profile: string; optionsJson?: string | undefined } } | { GraphHopper: { endpointUrl: string; profile: string; locale: string; voiceUnits: GraphHopperVoiceUnits; optionsJson?: string | undefined } };
448
+
449
+ /**
450
+ * An event that occurs during navigation.
451
+ *
452
+ * This is used for the optional session recording / telemetry.
453
+ */
454
+ export interface NavigationRecordingEvent {
551
455
  /**
552
- * Configures when the user is deemed to be off course.
553
- *
554
- * NOTE: This is distinct from the action that is taken.
555
- * It is only the determination that the user has deviated from the expected route.
456
+ * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
556
457
  */
557
- routeDeviationTracking: RouteDeviationTracking;
458
+ timestamp: number;
558
459
  /**
559
- * Configures how the heading component of the snapped location is reported in [`TripState`].
460
+ * Data associated with the event.
560
461
  */
561
- snappedLocationCourseFiltering: CourseFiltering;
462
+ event_data: NavigationRecordingEventData;
562
463
  }
563
464
 
465
+ /**
466
+ * The event type.
467
+ *
468
+ * For full replayability, we record things like rerouting, and not just location updates.
469
+ */
470
+ export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
471
+
564
472
  /**
565
473
  * Controls how simulated locations deviate from the actual route line.
566
474
  * This simulates real-world GPS behavior where readings often have systematic bias.
@@ -622,17 +530,6 @@ export interface ValhallaLocationSearchFilter {
622
530
  level?: number;
623
531
  }
624
532
 
625
- /**
626
- * Specifies a preferred side for departing from / arriving at a location.
627
- *
628
- * Examples:
629
- * - Germany drives on the right side of the road. A value of `same` will only allow leaving
630
- * or arriving at a location such that it is on your right.
631
- * - Australia drives on the left side of the road. Passing a value of `same` will only allow
632
- * leaving or arriving at a location such that it is on your left.
633
- */
634
- export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
635
-
636
533
  /**
637
534
  * A road class in the Valhalla taxonomy.
638
535
  *
@@ -736,30 +633,26 @@ export interface ValhallaWaypointProperties {
736
633
  * A set of optional filters to exclude candidate edges based on their attributes.
737
634
  */
738
635
  search_filter: ValhallaLocationSearchFilter | undefined;
636
+ /**
637
+ * Determines whether U-Turns are allowed at the waypoint
638
+ * (if it is an intermediate waypoint, not the first or last).
639
+ *
640
+ * Defaults to `true`. This has the effect of converting a [`WaypointKind::Break`]
641
+ * into a Valhalla `break_through`, and a [`WaypointKind::Via`] into a `through`.
642
+ */
643
+ allow_uturns: boolean | undefined;
739
644
  }
740
645
 
741
646
  /**
742
- * The event type.
743
- *
744
- * For full replayability, we record things like rerouting, and not just location updates.
745
- */
746
- export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
747
-
748
- /**
749
- * An event that occurs during navigation.
647
+ * Specifies a preferred side for departing from / arriving at a location.
750
648
  *
751
- * This is used for the optional session recording / telemetry.
649
+ * Examples:
650
+ * - Germany drives on the right side of the road. A value of `same` will only allow leaving
651
+ * or arriving at a location such that it is on your right.
652
+ * - Australia drives on the left side of the road. Passing a value of `same` will only allow
653
+ * leaving or arriving at a location such that it is on your left.
752
654
  */
753
- export interface NavigationRecordingEvent {
754
- /**
755
- * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
756
- */
757
- timestamp: number;
758
- /**
759
- * Data associated with the event.
760
- */
761
- event_data: NavigationRecordingEventData;
762
- }
655
+ export type ValhallaWaypointPreferredSide = "same" | "opposite" | "either";
763
656
 
764
657
  /**
765
658
  * Waypoint properties parsed from an OSRM-compatible server response.
@@ -796,6 +689,121 @@ export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLin
796
689
 
797
690
  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[] } };
798
691
 
692
+ export type GraphHopperVoiceUnits = "metric" | "imperial";
693
+
694
+ /**
695
+ * The state of a navigation session.
696
+ *
697
+ * This is produced by [`NavigationController`](super::NavigationController) methods
698
+ * including [`get_initial_state`](super::NavigationController::get_initial_state)
699
+ * and [`update_user_location`](super::NavigationController::update_user_location).
700
+ */
701
+ 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 } };
702
+
703
+ /**
704
+ * Information pertaining to the user\'s full navigation trip. This includes
705
+ * simple stats like total duration and distance.
706
+ */
707
+ export interface TripSummary {
708
+ /**
709
+ * The total raw distance traveled in the trip, in meters.
710
+ */
711
+ distanceTraveled: number;
712
+ /**
713
+ * The total snapped distance traveled in the trip, in meters.
714
+ */
715
+ snappedDistanceTraveled: number;
716
+ /**
717
+ * When the trip was started.
718
+ */
719
+ startedAt: Date;
720
+ /**
721
+ * When the trip was completed or canceled.
722
+ */
723
+ endedAt: Date | null;
724
+ }
725
+
726
+ export interface SerializableNavState {
727
+ tripState: TripState;
728
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
729
+ }
730
+
731
+ /**
732
+ * Controls filtering/post-processing of user course by the [`NavigationController`].
733
+ */
734
+ export type CourseFiltering = "SnapToRoute" | "Raw";
735
+
736
+ export interface SerializableNavigationControllerConfig {
737
+ /**
738
+ * Configures when navigation advances to the next waypoint in the route.
739
+ */
740
+ waypointAdvance: WaypointAdvanceMode;
741
+ /**
742
+ * Configures when navigation advances to the next step in the route.
743
+ */
744
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
745
+ /**
746
+ * A special advance condition used for the final 2 route steps (last and arrival).
747
+ *
748
+ * This exists because several of our step advance conditions require entry and
749
+ * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
750
+ * the expected location updates for the core step advance condition.
751
+ */
752
+ arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
753
+ /**
754
+ * Configures when the user is deemed to be off course.
755
+ *
756
+ * NOTE: This is distinct from the action that is taken.
757
+ * It is only the determination that the user has deviated from the expected route.
758
+ */
759
+ routeDeviationTracking: RouteDeviationTracking;
760
+ /**
761
+ * Configures how the heading component of the snapped location is reported in [`TripState`].
762
+ */
763
+ snappedLocationCourseFiltering: CourseFiltering;
764
+ }
765
+
766
+ /**
767
+ * Controls when a waypoint should be marked as complete.
768
+ *
769
+ * While a route may consist of thousands of points, waypoints are special.
770
+ * A simple trip will have only one waypoint: the final destination.
771
+ * A more complex trip may have several intermediate stops.
772
+ * Just as the navigation state keeps track of which steps remain in the route,
773
+ * it also tracks which waypoints are still remaining.
774
+ *
775
+ * Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
776
+ * The waypoint advance mode specifies how the framework decides
777
+ * that a waypoint has been visited (and is removed from the list).
778
+ *
779
+ * NOTE: Advancing to the next *step* and advancing to the next *waypoint*
780
+ * are separate processes.
781
+ * This will not normally cause any issues, but keep in mind that
782
+ * manually advancing to the next step does not *necessarily* imply
783
+ * that the waypoint will be marked as complete!
784
+ */
785
+ export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
786
+
787
+ /**
788
+ * High-level state describing progress through a route.
789
+ */
790
+ export interface TripProgress {
791
+ /**
792
+ * The distance to the next maneuver, in meters.
793
+ */
794
+ distanceToNextManeuver: number;
795
+ /**
796
+ * The total distance remaining in the trip, in meters.
797
+ *
798
+ * This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
799
+ */
800
+ distanceRemaining: number;
801
+ /**
802
+ * The total duration remaining in the trip, in seconds.
803
+ */
804
+ durationRemaining: number;
805
+ }
806
+
799
807
 
800
808
  export class NavigationController {
801
809
  free(): void;
package/ferrostar_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "Luke Seelenbinder <luke@stadiamaps.com>"
8
8
  ],
9
9
  "description": "The core of modern turn-by-turn navigation.",
10
- "version": "0.47.2",
10
+ "version": "0.48.1",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",