@stadiamaps/ferrostar 0.39.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,7 +415,32 @@ export interface GeographicCoordinate {
415
415
  lng: number;
416
416
  }
417
417
 
418
- export interface JsNavigationControllerConfig {
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
+
420
+ /**
421
+ * The event type.
422
+ *
423
+ * For full replayability, we record things like rerouting, and not just location updates.
424
+ */
425
+ export type NavigationRecordingEventData = { StateUpdate: { trip_state: TripState; step_advance_condition: SerializableStepAdvanceCondition } } | { RouteUpdate: { route: Route } };
426
+
427
+ /**
428
+ * An event that occurs during navigation.
429
+ *
430
+ * This is used for the optional session recording / telemetry.
431
+ */
432
+ export interface NavigationRecordingEvent {
433
+ /**
434
+ * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
435
+ */
436
+ timestamp: number;
437
+ /**
438
+ * Data associated with the event.
439
+ */
440
+ event_data: NavigationRecordingEventData;
441
+ }
442
+
443
+ export interface SerializableNavigationControllerConfig {
419
444
  /**
420
445
  * Configures when navigation advances to the next waypoint in the route.
421
446
  */
@@ -423,7 +448,7 @@ export interface JsNavigationControllerConfig {
423
448
  /**
424
449
  * Configures when navigation advances to the next step in the route.
425
450
  */
426
- stepAdvanceCondition: JsStepAdvanceCondition;
451
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
427
452
  /**
428
453
  * A special advance condition used for the final 2 route steps (last and arrival).
429
454
  *
@@ -431,7 +456,7 @@ export interface JsNavigationControllerConfig {
431
456
  * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
432
457
  * the expected location updates for the core step advance condition.
433
458
  */
434
- arrivalStepAdvanceCondition: JsStepAdvanceCondition;
459
+ arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
435
460
  /**
436
461
  * Configures when the user is deemed to be off course.
437
462
  *
@@ -523,24 +548,12 @@ export interface TripProgress {
523
548
  durationRemaining: number;
524
549
  }
525
550
 
526
- export interface JsNavState {
551
+ export interface SerializableNavState {
527
552
  tripState: TripState;
528
- stepAdvanceCondition: JsStepAdvanceCondition;
553
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
554
+ recordingEvents: NavigationRecordingEvent[] | undefined;
529
555
  }
530
556
 
531
- /**
532
- * Status information that describes whether the user is proceeding according to the route or not.
533
- *
534
- * Note that the name is intentionally a bit generic to allow for expansion of other states.
535
- * For example, we could conceivably add a \"wrong way\" status in the future.
536
- */
537
- export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
538
-
539
- /**
540
- * Determines if the user has deviated from the expected route.
541
- */
542
- export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
543
-
544
557
  export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
545
558
 
546
559
  /**
@@ -558,17 +571,46 @@ export interface LocationSimulationState {
558
571
  bias: LocationBias;
559
572
  }
560
573
 
561
- export type JsStepAdvanceCondition = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceFromStep: { distance: number; minimumHorizontalAccuracy: number } } | { DistanceEntryExit: { minimumHorizontalAccuracy: number; distanceToEndOfStep: number; distanceAfterEndStep: number; hasReachedEndOfCurrentStep: boolean } } | { OrAdvanceConditions: { conditions: JsStepAdvanceCondition[] } } | { AndAdvanceConditions: { conditions: JsStepAdvanceCondition[] } };
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 } };
562
586
 
563
587
  /**
564
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.
565
591
  */
566
592
  export class NavigationController {
567
593
  free(): void;
568
- constructor(route: any, config: any);
594
+ constructor(route: any, config: any, should_record: any);
569
595
  getInitialState(location: any): any;
570
- advance_to_next_step(state: any): any;
596
+ advanceToNextStep(state: any): any;
571
597
  updateUserLocation(location: any, state: any): any;
598
+ getRecording(events: any): any;
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
+ */
606
+ export class NavigationReplay {
607
+ free(): void;
608
+ constructor(json: any);
609
+ getEventByIndex(current_index: any): any;
610
+ getAllEvents(): any;
611
+ getTotalDuration(): any;
612
+ getInitialTimestamp(): any;
613
+ getInitialRoute(): any;
572
614
  }
573
615
  /**
574
616
  * JavaScript wrapper for `RouteAdapter`.
package/ferrostar_bg.js CHANGED
@@ -100,17 +100,6 @@ function getArrayU8FromWasm0(ptr, len) {
100
100
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
101
101
  }
102
102
 
103
- const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
104
-
105
- let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
106
-
107
- cachedTextDecoder.decode();
108
-
109
- function getStringFromWasm0(ptr, len) {
110
- ptr = ptr >>> 0;
111
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
112
- }
113
-
114
103
  function isLikeNone(x) {
115
104
  return x === undefined || x === null;
116
105
  }
@@ -180,6 +169,17 @@ function debugString(val) {
180
169
  return className;
181
170
  }
182
171
 
172
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
173
+
174
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
175
+
176
+ cachedTextDecoder.decode();
177
+
178
+ function getStringFromWasm0(ptr, len) {
179
+ ptr = ptr >>> 0;
180
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
181
+ }
182
+
183
183
  function takeFromExternrefTable0(idx) {
184
184
  const value = wasm.__wbindgen_export_4.get(idx);
185
185
  wasm.__externref_table_dealloc(idx);
@@ -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
 
@@ -272,9 +274,10 @@ export class NavigationController {
272
274
  /**
273
275
  * @param {any} route
274
276
  * @param {any} config
277
+ * @param {any} should_record
275
278
  */
276
- constructor(route, config) {
277
- const ret = wasm.navigationcontroller_new(route, config);
279
+ constructor(route, config, should_record) {
280
+ const ret = wasm.navigationcontroller_new(route, config, should_record);
278
281
  if (ret[2]) {
279
282
  throw takeFromExternrefTable0(ret[1]);
280
283
  }
@@ -297,8 +300,8 @@ export class NavigationController {
297
300
  * @param {any} state
298
301
  * @returns {any}
299
302
  */
300
- advance_to_next_step(state) {
301
- const ret = wasm.navigationcontroller_advance_to_next_step(this.__wbg_ptr, state);
303
+ advanceToNextStep(state) {
304
+ const ret = wasm.navigationcontroller_advanceToNextStep(this.__wbg_ptr, state);
302
305
  if (ret[2]) {
303
306
  throw takeFromExternrefTable0(ret[1]);
304
307
  }
@@ -316,6 +319,104 @@ export class NavigationController {
316
319
  }
317
320
  return takeFromExternrefTable0(ret[0]);
318
321
  }
322
+ /**
323
+ * @param {any} events
324
+ * @returns {any}
325
+ */
326
+ getRecording(events) {
327
+ const ret = wasm.navigationcontroller_getRecording(this.__wbg_ptr, events);
328
+ if (ret[2]) {
329
+ throw takeFromExternrefTable0(ret[1]);
330
+ }
331
+ return takeFromExternrefTable0(ret[0]);
332
+ }
333
+ }
334
+
335
+ const NavigationReplayFinalization = (typeof FinalizationRegistry === 'undefined')
336
+ ? { register: () => {}, unregister: () => {} }
337
+ : new FinalizationRegistry(ptr => wasm.__wbg_navigationreplay_free(ptr >>> 0, 1));
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
+ */
344
+ export class NavigationReplay {
345
+
346
+ __destroy_into_raw() {
347
+ const ptr = this.__wbg_ptr;
348
+ this.__wbg_ptr = 0;
349
+ NavigationReplayFinalization.unregister(this);
350
+ return ptr;
351
+ }
352
+
353
+ free() {
354
+ const ptr = this.__destroy_into_raw();
355
+ wasm.__wbg_navigationreplay_free(ptr, 0);
356
+ }
357
+ /**
358
+ * @param {any} json
359
+ */
360
+ constructor(json) {
361
+ const ret = wasm.navigationreplay_new(json);
362
+ if (ret[2]) {
363
+ throw takeFromExternrefTable0(ret[1]);
364
+ }
365
+ this.__wbg_ptr = ret[0] >>> 0;
366
+ NavigationReplayFinalization.register(this, this.__wbg_ptr, this);
367
+ return this;
368
+ }
369
+ /**
370
+ * @param {any} current_index
371
+ * @returns {any}
372
+ */
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);
395
+ if (ret[2]) {
396
+ throw takeFromExternrefTable0(ret[1]);
397
+ }
398
+ return takeFromExternrefTable0(ret[0]);
399
+ }
400
+ /**
401
+ * @returns {any}
402
+ */
403
+ getInitialTimestamp() {
404
+ const ret = wasm.navigationreplay_getInitialTimestamp(this.__wbg_ptr);
405
+ if (ret[2]) {
406
+ throw takeFromExternrefTable0(ret[1]);
407
+ }
408
+ return takeFromExternrefTable0(ret[0]);
409
+ }
410
+ /**
411
+ * @returns {any}
412
+ */
413
+ getInitialRoute() {
414
+ const ret = wasm.navigationreplay_getInitialRoute(this.__wbg_ptr);
415
+ if (ret[2]) {
416
+ throw takeFromExternrefTable0(ret[1]);
417
+ }
418
+ return takeFromExternrefTable0(ret[0]);
419
+ }
319
420
  }
320
421
 
321
422
  const RouteAdapterFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -404,16 +505,6 @@ export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg
404
505
  return ret;
405
506
  }, arguments) };
406
507
 
407
- export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg0, arg1, arg2) {
408
- const ret = arg0.call(arg1, arg2);
409
- return ret;
410
- }, arguments) };
411
-
412
- export function __wbg_crypto_ed58b8e10a292839(arg0) {
413
- const ret = arg0.crypto;
414
- return ret;
415
- };
416
-
417
508
  export function __wbg_done_769e5ede4b31c67b(arg0) {
418
509
  const ret = arg0.done;
419
510
  return ret;
@@ -428,8 +519,8 @@ export function __wbg_getRandomValues_38097e921c2494c3() { return handleError(fu
428
519
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
429
520
  }, arguments) };
430
521
 
431
- export function __wbg_getRandomValues_bcb4912f16000dc4() { return handleError(function (arg0, arg1) {
432
- arg0.getRandomValues(arg1);
522
+ export function __wbg_getRandomValues_3c9c0d586e575a16() { return handleError(function (arg0, arg1) {
523
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
433
524
  }, arguments) };
434
525
 
435
526
  export function __wbg_getTime_46267b1c24877e30(arg0) {
@@ -499,11 +590,6 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
499
590
  return ret;
500
591
  };
501
592
 
502
- export function __wbg_msCrypto_0a36e2ec3a343d26(arg0) {
503
- const ret = arg0.msCrypto;
504
- return ret;
505
- };
506
-
507
593
  export function __wbg_new0_f788a2397c7ca929() {
508
594
  const ret = new Date();
509
595
  return ret;
@@ -529,21 +615,6 @@ export function __wbg_new_a12002a7f91c75be(arg0) {
529
615
  return ret;
530
616
  };
531
617
 
532
- export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
533
- const ret = new Function(getStringFromWasm0(arg0, arg1));
534
- return ret;
535
- };
536
-
537
- export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
538
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
539
- return ret;
540
- };
541
-
542
- export function __wbg_newwithlength_a381634e90c276d4(arg0) {
543
- const ret = new Uint8Array(arg0 >>> 0);
544
- return ret;
545
- };
546
-
547
618
  export function __wbg_next_25feadfc0913fea9(arg0) {
548
619
  const ret = arg0.next;
549
620
  return ret;
@@ -554,30 +625,11 @@ export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg
554
625
  return ret;
555
626
  }, arguments) };
556
627
 
557
- export function __wbg_node_02999533c4ea02e3(arg0) {
558
- const ret = arg0.node;
559
- return ret;
560
- };
561
-
562
628
  export function __wbg_now_807e54c39636c349() {
563
629
  const ret = Date.now();
564
630
  return ret;
565
631
  };
566
632
 
567
- export function __wbg_process_5c1d670bc53614b8(arg0) {
568
- const ret = arg0.process;
569
- return ret;
570
- };
571
-
572
- export function __wbg_randomFillSync_ab2cfe79ebbf2740() { return handleError(function (arg0, arg1) {
573
- arg0.randomFillSync(arg1);
574
- }, arguments) };
575
-
576
- export function __wbg_require_79b1e9274cde3c87() { return handleError(function () {
577
- const ret = module.require;
578
- return ret;
579
- }, arguments) };
580
-
581
633
  export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
582
634
  arg0[arg1 >>> 0] = arg2;
583
635
  };
@@ -595,41 +647,11 @@ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
595
647
  return ret;
596
648
  };
597
649
 
598
- export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
599
- const ret = typeof global === 'undefined' ? null : global;
600
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
601
- };
602
-
603
- export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
604
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
605
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
606
- };
607
-
608
- export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
609
- const ret = typeof self === 'undefined' ? null : self;
610
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
611
- };
612
-
613
- export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
614
- const ret = typeof window === 'undefined' ? null : window;
615
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
616
- };
617
-
618
- export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
619
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
620
- return ret;
621
- };
622
-
623
650
  export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
624
651
  const ret = arg0.value;
625
652
  return ret;
626
653
  };
627
654
 
628
- export function __wbg_versions_c71aa1626a93e0a1(arg0) {
629
- const ret = arg0.versions;
630
- return ret;
631
- };
632
-
633
655
  export function __wbindgen_as_number(arg0) {
634
656
  const ret = +arg0;
635
657
  return ret;
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.39.0",
10
+ "version": "0.41.0",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",