@stadiamaps/ferrostar 0.40.0 → 0.41.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
@@ -415,23 +415,20 @@ export interface GeographicCoordinate {
415
415
  lng: number;
416
416
  }
417
417
 
418
+ 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[] } };
419
+
418
420
  /**
419
- * Status information that describes whether the user is proceeding according to the route or not.
421
+ * The event type.
420
422
  *
421
- * Note that the name is intentionally a bit generic to allow for expansion of other states.
422
- * For example, we could conceivably add a \"wrong way\" status in the future.
423
+ * For full replayability, we record things like rerouting, and not just location updates.
423
424
  */
424
- export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
425
+ export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
425
426
 
426
427
  /**
427
- * Determines if the user has deviated from the expected route.
428
+ * An event that occurs during navigation.
429
+ *
430
+ * This is used for the optional session recording / telemetry.
428
431
  */
429
- export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
430
-
431
- 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[] } };
432
-
433
- export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } } | { Error: { error_message: string } };
434
-
435
432
  export interface NavigationRecordingEvent {
436
433
  /**
437
434
  * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
@@ -574,8 +571,23 @@ export interface LocationSimulationState {
574
571
  bias: LocationBias;
575
572
  }
576
573
 
574
+ /**
575
+ * Status information that describes whether the user is proceeding according to the route or not.
576
+ *
577
+ * Note that the name is intentionally a bit generic to allow for expansion of other states.
578
+ * For example, we could conceivably add a \"wrong way\" status in the future.
579
+ */
580
+ export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
581
+
582
+ /**
583
+ * Determines if the user has deviated from the expected route.
584
+ */
585
+ export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
586
+
577
587
  /**
578
588
  * JavaScript wrapper for `NavigationController`.
589
+ * This wrapper is required because `NavigationController` cannot be directly converted to a JavaScript object
590
+ * and requires serialization/deserialization of its methods' inputs and outputs.
579
591
  */
580
592
  export class NavigationController {
581
593
  free(): void;
@@ -585,10 +597,18 @@ export class NavigationController {
585
597
  updateUserLocation(location: any, state: any): any;
586
598
  getRecording(events: any): any;
587
599
  }
600
+ /**
601
+ * A WebAssembly-compatible wrapper for `NavigationReplay` that exposes its functionality as a JavaScript object.
602
+ *
603
+ * This wrapper is required because `NavigationReplay` cannot be directly converted to a JavaScript object
604
+ * and requires serialization/deserialization of its methods' inputs and outputs.
605
+ */
588
606
  export class NavigationReplay {
589
607
  free(): void;
590
608
  constructor(json: any);
591
- getNextEvent(current_index: any): any;
609
+ getEventByIndex(current_index: any): any;
610
+ getAllEvents(): any;
611
+ getTotalDuration(): any;
592
612
  getInitialTimestamp(): any;
593
613
  getInitialRoute(): any;
594
614
  }
package/ferrostar_bg.js CHANGED
@@ -255,6 +255,8 @@ const NavigationControllerFinalization = (typeof FinalizationRegistry === 'undef
255
255
  : new FinalizationRegistry(ptr => wasm.__wbg_navigationcontroller_free(ptr >>> 0, 1));
256
256
  /**
257
257
  * JavaScript wrapper for `NavigationController`.
258
+ * This wrapper is required because `NavigationController` cannot be directly converted to a JavaScript object
259
+ * and requires serialization/deserialization of its methods' inputs and outputs.
258
260
  */
259
261
  export class NavigationController {
260
262
 
@@ -333,7 +335,12 @@ export class NavigationController {
333
335
  const NavigationReplayFinalization = (typeof FinalizationRegistry === 'undefined')
334
336
  ? { register: () => {}, unregister: () => {} }
335
337
  : new FinalizationRegistry(ptr => wasm.__wbg_navigationreplay_free(ptr >>> 0, 1));
336
-
338
+ /**
339
+ * A WebAssembly-compatible wrapper for `NavigationReplay` that exposes its functionality as a JavaScript object.
340
+ *
341
+ * This wrapper is required because `NavigationReplay` cannot be directly converted to a JavaScript object
342
+ * and requires serialization/deserialization of its methods' inputs and outputs.
343
+ */
337
344
  export class NavigationReplay {
338
345
 
339
346
  __destroy_into_raw() {
@@ -363,8 +370,28 @@ export class NavigationReplay {
363
370
  * @param {any} current_index
364
371
  * @returns {any}
365
372
  */
366
- getNextEvent(current_index) {
367
- const ret = wasm.navigationreplay_getNextEvent(this.__wbg_ptr, current_index);
373
+ getEventByIndex(current_index) {
374
+ const ret = wasm.navigationreplay_getEventByIndex(this.__wbg_ptr, current_index);
375
+ if (ret[2]) {
376
+ throw takeFromExternrefTable0(ret[1]);
377
+ }
378
+ return takeFromExternrefTable0(ret[0]);
379
+ }
380
+ /**
381
+ * @returns {any}
382
+ */
383
+ getAllEvents() {
384
+ const ret = wasm.navigationreplay_getAllEvents(this.__wbg_ptr);
385
+ if (ret[2]) {
386
+ throw takeFromExternrefTable0(ret[1]);
387
+ }
388
+ return takeFromExternrefTable0(ret[0]);
389
+ }
390
+ /**
391
+ * @returns {any}
392
+ */
393
+ getTotalDuration() {
394
+ const ret = wasm.navigationreplay_getTotalDuration(this.__wbg_ptr);
368
395
  if (ret[2]) {
369
396
  throw takeFromExternrefTable0(ret[1]);
370
397
  }
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.40.0",
10
+ "version": "0.41.0",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",