@stadiamaps/ferrostar 0.47.2 → 0.48.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,210 +1,40 @@
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.
11
- */
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
- }
22
-
23
- /**
24
- * The type of incident that has occurred.
25
- */
26
- export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
27
-
28
- /**
29
- * The broad class of maneuver to perform.
30
- *
31
- * This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
32
- */
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";
34
-
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.
39
- */
40
- export interface SpokenInstruction {
41
- /**
42
- * Plain-text instruction which can be synthesized with a TTS engine.
43
- */
44
- text: string;
45
- /**
46
- * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
47
- */
48
- ssml: string | undefined;
49
- /**
50
- * How far (in meters) from the upcoming maneuver the instruction should start being spoken.
51
- */
52
- triggerDistanceBeforeManeuver: number;
53
- /**
54
- * A unique identifier for this instruction.
55
- *
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.
59
- *
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.
62
- */
63
- utteranceId: string;
64
- }
65
-
66
- /**
67
- * A geographic bounding box defined by its corners.
68
- */
69
- export interface BoundingBox {
70
- /**
71
- * The southwest corner of the bounding box.
72
- */
73
- sw: GeographicCoordinate;
74
- /**
75
- * The northeast corner of the bounding box.
76
- */
77
- ne: GeographicCoordinate;
78
- }
79
-
80
- /**
81
- * An incident affecting the free flow of traffic,
82
- * such as constructions, accidents, and congestion.
4
+ * A geographic coordinate in WGS84.
83
5
  */
84
- export interface Incident {
85
- /**
86
- * A unique identifier for the incident.
87
- */
88
- id: string;
89
- /**
90
- * The type of incident.
91
- */
92
- incidentType: IncidentType;
93
- /**
94
- * A short description of the incident.
95
- */
96
- description: string | undefined;
97
- /**
98
- * A longer description of the incident.
99
- */
100
- longDescription: string | undefined;
101
- /**
102
- * The time at which the incident was *last* created.
103
- *
104
- * NB: This can change throughout the life of the incident.
105
- */
106
- creationTime: Date | null;
107
- /**
108
- * The time at which the incident started or is expected to start (ex: planned closure).
109
- */
110
- startTime: Date | null;
111
- /**
112
- * The time at which the incident ended or is expected to end.
113
- */
114
- endTime: Date | null;
115
- /**
116
- * The level of impact to traffic.
117
- */
118
- impact: Impact | undefined;
119
- /**
120
- * Lanes which are blocked by the incident.
121
- */
122
- lanesBlocked: BlockedLane[];
123
- /**
124
- * Info about the amount of congestion on the road around the incident.
125
- */
126
- congestion: Congestion | undefined;
127
- /**
128
- * Is the road completely closed?
129
- */
130
- closed: boolean | undefined;
131
- /**
132
- * The index into the [`RouteStep`] geometry where the incident starts.
133
- */
134
- geometryIndexStart: number;
135
- /**
136
- * The index into the [`RouteStep`] geometry where the incident ends.
137
- */
138
- geometryIndexEnd: number | undefined;
139
- /**
140
- * Optional additional information about the type of incident (free-form text).
141
- */
142
- subType: string | undefined;
143
- /**
144
- * Optional descriptions about the type of incident (free-form text).
145
- */
146
- subTypeDescription: string | undefined;
147
- /**
148
- * The ISO 3166-1 alpha-2 code of the country in which the incident occurs.
149
- */
150
- iso31661Alpha2: string | undefined;
151
- /**
152
- * The ISO 3166-1 alpha-3 code of the country in which the incident occurs.
153
- */
154
- iso31661Alpha3: string | undefined;
6
+ export interface GeographicCoordinate {
155
7
  /**
156
- * A list of road names affected by the incident.
8
+ * The latitude (in degrees).
157
9
  */
158
- affectedRoadNames: string[];
10
+ lat: number;
159
11
  /**
160
- * The bounding box over which the incident occurs.
12
+ * The Longitude (in degrees).
161
13
  */
162
- bbox: BoundingBox | undefined;
14
+ lng: number;
163
15
  }
164
16
 
165
17
  /**
166
- * The direction in which the user/device is observed to be traveling.
18
+ * The speed of the user from the location provider.
167
19
  */
168
- export interface CourseOverGround {
20
+ export interface Speed {
169
21
  /**
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).
22
+ * The user\'s speed in meters per second.
172
23
  */
173
- degrees: number;
24
+ value: number;
174
25
  /**
175
- * The accuracy of the course value, measured in degrees.
26
+ * The accuracy of the speed value, measured in meters per second.
176
27
  */
177
28
  accuracy: number | undefined;
178
29
  }
179
30
 
180
31
  /**
181
- * Details about congestion for an incident.
182
- */
183
- export interface Congestion {
184
- /**
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
192
- */
193
- value: number;
194
- }
195
-
196
- /**
197
- * A geographic coordinate in WGS84.
32
+ * The content of a visual instruction.
198
33
  */
199
- export interface GeographicCoordinate {
200
- /**
201
- * The latitude (in degrees).
202
- */
203
- lat: number;
204
- /**
205
- * The Longitude (in degrees).
206
- */
207
- lng: number;
34
+ export interface LaneInfo {
35
+ active: boolean;
36
+ directions: string[];
37
+ activeDirection: string | undefined;
208
38
  }
209
39
 
210
40
  /**
@@ -241,6 +71,37 @@ export interface VisualInstructionContent {
241
71
  exitNumbers: string[];
242
72
  }
243
73
 
74
+ /**
75
+ * An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver.
76
+ *
77
+ * Note that these do not have any locale information attached.
78
+ */
79
+ export interface SpokenInstruction {
80
+ /**
81
+ * Plain-text instruction which can be synthesized with a TTS engine.
82
+ */
83
+ text: string;
84
+ /**
85
+ * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it.
86
+ */
87
+ ssml: string | undefined;
88
+ /**
89
+ * How far (in meters) from the upcoming maneuver the instruction should start being spoken.
90
+ */
91
+ triggerDistanceBeforeManeuver: number;
92
+ /**
93
+ * A unique identifier for this instruction.
94
+ *
95
+ * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances,
96
+ * which may have the same textual content.
97
+ * UUIDs conveniently fill this purpose.
98
+ *
99
+ * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time.
100
+ * This should be theoretically possible though if someone cares to write up a proposal and a PR.
101
+ */
102
+ utteranceId: string;
103
+ }
104
+
244
105
  /**
245
106
  * An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`].
246
107
  */
@@ -266,54 +127,9 @@ export interface VisualInstruction {
266
127
  }
267
128
 
268
129
  /**
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.
130
+ * The lane type blocked by the incident.
301
131
  */
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
- }
132
+ export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
317
133
 
318
134
  /**
319
135
  * A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching
@@ -377,6 +193,76 @@ export interface RouteStep {
377
193
  roundaboutExitNumber: number | undefined;
378
194
  }
379
195
 
196
+ /**
197
+ * The type of incident that has occurred.
198
+ */
199
+ export type IncidentType = "accident" | "congestion" | "construction" | "disabled_vehicle" | "lane_restriction" | "mass_transit" | "miscellaneous" | "other_news" | "planned_event" | "road_closure" | "road_hazard" | "weather";
200
+
201
+ /**
202
+ * The impact of the incident that has occurred.
203
+ */
204
+ export type Impact = "unknown" | "critical" | "major" | "minor" | "low";
205
+
206
+ /**
207
+ * Describes characteristics of the waypoint for routing purposes.
208
+ */
209
+ export type WaypointKind = "Break" | "Via";
210
+
211
+ /**
212
+ * Additional information to further specify a [`ManeuverType`].
213
+ */
214
+ export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
215
+
216
+ /**
217
+ * The location of the user that is navigating.
218
+ *
219
+ * In addition to coordinates, this includes estimated accuracy and course information,
220
+ * which can influence navigation logic and UI.
221
+ *
222
+ * NOTE: Heading is absent on purpose.
223
+ * Heading updates are not related to a change in the user\'s location.
224
+ */
225
+ export interface UserLocation {
226
+ coordinates: GeographicCoordinate;
227
+ /**
228
+ * The estimated accuracy of the coordinate (in meters)
229
+ */
230
+ horizontalAccuracy: number;
231
+ courseOverGround: CourseOverGround | undefined;
232
+ timestamp: { secs_since_epoch: number; nanos_since_epoch: number };
233
+ speed: Speed | undefined;
234
+ }
235
+
236
+ /**
237
+ * Details about congestion for an incident.
238
+ */
239
+ export interface Congestion {
240
+ /**
241
+ * The level of congestion caused by the incident.
242
+ *
243
+ * 0 = no congestion
244
+ *
245
+ * 100 = road closed
246
+ *
247
+ * Other values mean no congestion was calculated
248
+ */
249
+ value: number;
250
+ }
251
+
252
+ /**
253
+ * A geographic bounding box defined by its corners.
254
+ */
255
+ export interface BoundingBox {
256
+ /**
257
+ * The southwest corner of the bounding box.
258
+ */
259
+ sw: GeographicCoordinate;
260
+ /**
261
+ * The northeast corner of the bounding box.
262
+ */
263
+ ne: GeographicCoordinate;
264
+ }
265
+
380
266
  /**
381
267
  * A waypoint along a route.
382
268
  *
@@ -418,147 +304,169 @@ export interface Waypoint {
418
304
  }
419
305
 
420
306
  /**
421
- * Additional information to further specify a [`ManeuverType`].
422
- */
423
- export type ManeuverModifier = "uturn" | "sharp right" | "right" | "slight right" | "straight" | "slight left" | "left" | "sharp left";
424
-
425
- /**
426
- * Describes characteristics of the waypoint for routing purposes.
427
- */
428
- export type WaypointKind = "Break" | "Via";
429
-
430
- /**
431
- * Which side of the road traffic drives on.
432
- *
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.
441
- */
442
- export type BlockedLane = "left" | "left center" | "left turn lane" | "center" | "right" | "right center" | "right turn lane" | "hov";
443
-
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
- export type GraphHopperVoiceUnits = "metric" | "imperial";
450
-
451
- /**
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).
457
- */
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 } };
459
-
460
- /**
461
- * High-level state describing progress through a route.
307
+ * An incident affecting the free flow of traffic,
308
+ * such as constructions, accidents, and congestion.
462
309
  */
463
- export interface TripProgress {
310
+ export interface Incident {
464
311
  /**
465
- * The distance to the next maneuver, in meters.
312
+ * A unique identifier for the incident.
466
313
  */
467
- distanceToNextManeuver: number;
314
+ id: string;
468
315
  /**
469
- * The total distance remaining in the trip, in meters.
316
+ * The type of incident.
317
+ */
318
+ incidentType: IncidentType;
319
+ /**
320
+ * A short description of the incident.
321
+ */
322
+ description: string | undefined;
323
+ /**
324
+ * A longer description of the incident.
325
+ */
326
+ longDescription: string | undefined;
327
+ /**
328
+ * The time at which the incident was *last* created.
470
329
  *
471
- * This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
330
+ * NB: This can change throughout the life of the incident.
472
331
  */
473
- distanceRemaining: number;
332
+ creationTime: Date | null;
474
333
  /**
475
- * The total duration remaining in the trip, in seconds.
334
+ * The time at which the incident started or is expected to start (ex: planned closure).
476
335
  */
477
- durationRemaining: number;
336
+ startTime: Date | null;
337
+ /**
338
+ * The time at which the incident ended or is expected to end.
339
+ */
340
+ endTime: Date | null;
341
+ /**
342
+ * The level of impact to traffic.
343
+ */
344
+ impact: Impact | undefined;
345
+ /**
346
+ * Lanes which are blocked by the incident.
347
+ */
348
+ lanesBlocked: BlockedLane[];
349
+ /**
350
+ * Info about the amount of congestion on the road around the incident.
351
+ */
352
+ congestion: Congestion | undefined;
353
+ /**
354
+ * Is the road completely closed?
355
+ */
356
+ closed: boolean | undefined;
357
+ /**
358
+ * The index into the [`RouteStep`] geometry where the incident starts.
359
+ */
360
+ geometryIndexStart: number;
361
+ /**
362
+ * The index into the [`RouteStep`] geometry where the incident ends.
363
+ */
364
+ geometryIndexEnd: number | undefined;
365
+ /**
366
+ * Optional additional information about the type of incident (free-form text).
367
+ */
368
+ subType: string | undefined;
369
+ /**
370
+ * Optional descriptions about the type of incident (free-form text).
371
+ */
372
+ subTypeDescription: string | undefined;
373
+ /**
374
+ * The ISO 3166-1 alpha-2 code of the country in which the incident occurs.
375
+ */
376
+ iso31661Alpha2: string | undefined;
377
+ /**
378
+ * The ISO 3166-1 alpha-3 code of the country in which the incident occurs.
379
+ */
380
+ iso31661Alpha3: string | undefined;
381
+ /**
382
+ * A list of road names affected by the incident.
383
+ */
384
+ affectedRoadNames: string[];
385
+ /**
386
+ * The bounding box over which the incident occurs.
387
+ */
388
+ bbox: BoundingBox | undefined;
478
389
  }
479
390
 
480
391
  /**
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).
392
+ * Information describing the series of steps needed to travel between two or more points.
492
393
  *
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!
498
- */
499
- export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
500
-
501
- export interface SerializableNavState {
502
- tripState: TripState;
503
- stepAdvanceCondition: SerializableStepAdvanceCondition;
504
- }
505
-
506
- /**
507
- * Information pertaining to the user\'s full navigation trip. This includes
508
- * simple stats like total duration and distance.
394
+ * NOTE: This type is unstable and is still under active development and should be
395
+ * considered unstable.
509
396
  */
510
- export interface TripSummary {
397
+ export interface Route {
398
+ geometry: GeographicCoordinate[];
399
+ bbox: BoundingBox;
511
400
  /**
512
- * The total raw distance traveled in the trip, in meters.
401
+ * The total route distance, in meters.
513
402
  */
514
- distanceTraveled: number;
403
+ distance: number;
515
404
  /**
516
- * The total snapped distance traveled in the trip, in meters.
405
+ * The ordered list of waypoints to visit, including the starting point.
406
+ * Note that this is distinct from the *geometry* which includes all points visited.
407
+ * A waypoint represents a start/end point for a route leg.
517
408
  */
518
- snappedDistanceTraveled: number;
409
+ waypoints: Waypoint[];
410
+ steps: RouteStep[];
411
+ }
412
+
413
+ /**
414
+ * The direction in which the user/device is observed to be traveling.
415
+ */
416
+ export interface CourseOverGround {
519
417
  /**
520
- * When the trip was started.
418
+ * The direction in which the user\'s device is traveling, measured in clockwise degrees from
419
+ * true north (N = 0, E = 90, S = 180, W = 270).
521
420
  */
522
- startedAt: Date;
421
+ degrees: number;
523
422
  /**
524
- * When the trip was completed or canceled.
423
+ * The accuracy of the course value, measured in degrees.
525
424
  */
526
- endedAt: Date | null;
425
+ accuracy: number | undefined;
527
426
  }
528
427
 
529
428
  /**
530
- * Controls filtering/post-processing of user course by the [`NavigationController`].
429
+ * Which side of the road traffic drives on.
430
+ *
431
+ * This is needed by consumers like Android Auto to determine whether
432
+ * a roundabout should be rendered as clockwise (right-hand traffic)
433
+ * or counterclockwise (left-hand traffic).
531
434
  */
532
- export type CourseFiltering = "SnapToRoute" | "Raw";
435
+ export type DrivingSide = "left" | "right";
533
436
 
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;
437
+ /**
438
+ * The broad class of maneuver to perform.
439
+ *
440
+ * This is usually combined with [`ManeuverModifier`] in [`VisualInstructionContent`].
441
+ */
442
+ 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
+
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
+ * The event type.
451
+ *
452
+ * For full replayability, we record things like rerouting, and not just location updates.
453
+ */
454
+ export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
455
+
456
+ /**
457
+ * An event that occurs during navigation.
458
+ *
459
+ * This is used for the optional session recording / telemetry.
460
+ */
461
+ export interface NavigationRecordingEvent {
551
462
  /**
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.
463
+ * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
556
464
  */
557
- routeDeviationTracking: RouteDeviationTracking;
465
+ timestamp: number;
558
466
  /**
559
- * Configures how the heading component of the snapped location is reported in [`TripState`].
467
+ * Data associated with the event.
560
468
  */
561
- snappedLocationCourseFiltering: CourseFiltering;
469
+ event_data: NavigationRecordingEventData;
562
470
  }
563
471
 
564
472
  /**
@@ -567,6 +475,8 @@ export interface SerializableNavigationControllerConfig {
567
475
  */
568
476
  export type LocationBias = { Left: number } | { Right: number } | { Random: number } | "None";
569
477
 
478
+ export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
479
+
570
480
  /**
571
481
  * The current state of the simulation.
572
482
  */
@@ -576,8 +486,6 @@ export interface LocationSimulationState {
576
486
  bias: LocationBias;
577
487
  }
578
488
 
579
- export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
580
-
581
489
  /**
582
490
  * A set of optional filters to exclude candidate edges based on their attributes.
583
491
  */
@@ -622,24 +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
- /**
637
- * A road class in the Valhalla taxonomy.
638
- *
639
- * These are ordered from highest (fastest travel speed) to lowest.
640
- */
641
- export type ValhallaRoadClass = "motorway" | "trunk" | "primary" | "secondary" | "tertiary" | "unclassified" | "residential" | "service_other";
642
-
643
533
  /**
644
534
  * Waypoint properties supported by Valhalla servers.
645
535
  *
@@ -736,30 +626,33 @@ export interface ValhallaWaypointProperties {
736
626
  * A set of optional filters to exclude candidate edges based on their attributes.
737
627
  */
738
628
  search_filter: ValhallaLocationSearchFilter | undefined;
629
+ /**
630
+ * Determines whether U-Turns are allowed at the waypoint
631
+ * (if it is an intermediate waypoint, not the first or last).
632
+ *
633
+ * Defaults to `true`. This has the effect of converting a [`WaypointKind::Break`]
634
+ * into a Valhalla `break_through`, and a [`WaypointKind::Via`] into a `through`.
635
+ */
636
+ allow_uturns: boolean | undefined;
739
637
  }
740
638
 
741
639
  /**
742
- * The event type.
640
+ * A road class in the Valhalla taxonomy.
743
641
  *
744
- * For full replayability, we record things like rerouting, and not just location updates.
642
+ * These are ordered from highest (fastest travel speed) to lowest.
745
643
  */
746
- export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
644
+ export type ValhallaRoadClass = "motorway" | "trunk" | "primary" | "secondary" | "tertiary" | "unclassified" | "residential" | "service_other";
747
645
 
748
646
  /**
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
+ * High-level state describing progress through a route.
696
+ */
697
+ export interface TripProgress {
698
+ /**
699
+ * The distance to the next maneuver, in meters.
700
+ */
701
+ distanceToNextManeuver: number;
702
+ /**
703
+ * The total distance remaining in the trip, in meters.
704
+ *
705
+ * This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps.
706
+ */
707
+ distanceRemaining: number;
708
+ /**
709
+ * The total duration remaining in the trip, in seconds.
710
+ */
711
+ durationRemaining: number;
712
+ }
713
+
714
+ export interface SerializableNavigationControllerConfig {
715
+ /**
716
+ * Configures when navigation advances to the next waypoint in the route.
717
+ */
718
+ waypointAdvance: WaypointAdvanceMode;
719
+ /**
720
+ * Configures when navigation advances to the next step in the route.
721
+ */
722
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
723
+ /**
724
+ * A special advance condition used for the final 2 route steps (last and arrival).
725
+ *
726
+ * This exists because several of our step advance conditions require entry and
727
+ * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
728
+ * the expected location updates for the core step advance condition.
729
+ */
730
+ arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
731
+ /**
732
+ * Configures when the user is deemed to be off course.
733
+ *
734
+ * NOTE: This is distinct from the action that is taken.
735
+ * It is only the determination that the user has deviated from the expected route.
736
+ */
737
+ routeDeviationTracking: RouteDeviationTracking;
738
+ /**
739
+ * Configures how the heading component of the snapped location is reported in [`TripState`].
740
+ */
741
+ snappedLocationCourseFiltering: CourseFiltering;
742
+ }
743
+
744
+ /**
745
+ * The state of a navigation session.
746
+ *
747
+ * This is produced by [`NavigationController`](super::NavigationController) methods
748
+ * including [`get_initial_state`](super::NavigationController::get_initial_state)
749
+ * and [`update_user_location`](super::NavigationController::update_user_location).
750
+ */
751
+ 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 } };
752
+
753
+ /**
754
+ * Controls when a waypoint should be marked as complete.
755
+ *
756
+ * While a route may consist of thousands of points, waypoints are special.
757
+ * A simple trip will have only one waypoint: the final destination.
758
+ * A more complex trip may have several intermediate stops.
759
+ * Just as the navigation state keeps track of which steps remain in the route,
760
+ * it also tracks which waypoints are still remaining.
761
+ *
762
+ * Tracking waypoints enables Ferrostar to reroute users when they stray off the route line.
763
+ * The waypoint advance mode specifies how the framework decides
764
+ * that a waypoint has been visited (and is removed from the list).
765
+ *
766
+ * NOTE: Advancing to the next *step* and advancing to the next *waypoint*
767
+ * are separate processes.
768
+ * This will not normally cause any issues, but keep in mind that
769
+ * manually advancing to the next step does not *necessarily* imply
770
+ * that the waypoint will be marked as complete!
771
+ */
772
+ export type WaypointAdvanceMode = { WaypointWithinRange: number } | { WaypointAlongAdvancingStep: number };
773
+
774
+ /**
775
+ * Information pertaining to the user\'s full navigation trip. This includes
776
+ * simple stats like total duration and distance.
777
+ */
778
+ export interface TripSummary {
779
+ /**
780
+ * The total raw distance traveled in the trip, in meters.
781
+ */
782
+ distanceTraveled: number;
783
+ /**
784
+ * The total snapped distance traveled in the trip, in meters.
785
+ */
786
+ snappedDistanceTraveled: number;
787
+ /**
788
+ * When the trip was started.
789
+ */
790
+ startedAt: Date;
791
+ /**
792
+ * When the trip was completed or canceled.
793
+ */
794
+ endedAt: Date | null;
795
+ }
796
+
797
+ /**
798
+ * Controls filtering/post-processing of user course by the [`NavigationController`].
799
+ */
800
+ export type CourseFiltering = "SnapToRoute" | "Raw";
801
+
802
+ export interface SerializableNavState {
803
+ tripState: TripState;
804
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
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.0",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",