@stadiamaps/ferrostar 0.39.0 → 0.40.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,35 @@ export interface GeographicCoordinate {
415
415
  lng: number;
416
416
  }
417
417
 
418
- export interface JsNavigationControllerConfig {
418
+ /**
419
+ * Status information that describes whether the user is proceeding according to the route or not.
420
+ *
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
+ */
424
+ export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
425
+
426
+ /**
427
+ * Determines if the user has deviated from the expected route.
428
+ */
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
+ export interface NavigationRecordingEvent {
436
+ /**
437
+ * The timestamp of the event in milliseconds since Jan 1, 1970 UTC.
438
+ */
439
+ timestamp: number;
440
+ /**
441
+ * Data associated with the event.
442
+ */
443
+ event_data: NavigationRecordingEventData;
444
+ }
445
+
446
+ export interface SerializableNavigationControllerConfig {
419
447
  /**
420
448
  * Configures when navigation advances to the next waypoint in the route.
421
449
  */
@@ -423,7 +451,7 @@ export interface JsNavigationControllerConfig {
423
451
  /**
424
452
  * Configures when navigation advances to the next step in the route.
425
453
  */
426
- stepAdvanceCondition: JsStepAdvanceCondition;
454
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
427
455
  /**
428
456
  * A special advance condition used for the final 2 route steps (last and arrival).
429
457
  *
@@ -431,7 +459,7 @@ export interface JsNavigationControllerConfig {
431
459
  * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
432
460
  * the expected location updates for the core step advance condition.
433
461
  */
434
- arrivalStepAdvanceCondition: JsStepAdvanceCondition;
462
+ arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
435
463
  /**
436
464
  * Configures when the user is deemed to be off course.
437
465
  *
@@ -523,24 +551,12 @@ export interface TripProgress {
523
551
  durationRemaining: number;
524
552
  }
525
553
 
526
- export interface JsNavState {
554
+ export interface SerializableNavState {
527
555
  tripState: TripState;
528
- stepAdvanceCondition: JsStepAdvanceCondition;
556
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
557
+ recordingEvents: NavigationRecordingEvent[] | undefined;
529
558
  }
530
559
 
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
560
  export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
545
561
 
546
562
  /**
@@ -558,17 +574,23 @@ export interface LocationSimulationState {
558
574
  bias: LocationBias;
559
575
  }
560
576
 
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[] } };
562
-
563
577
  /**
564
578
  * JavaScript wrapper for `NavigationController`.
565
579
  */
566
580
  export class NavigationController {
567
581
  free(): void;
568
- constructor(route: any, config: any);
582
+ constructor(route: any, config: any, should_record: any);
569
583
  getInitialState(location: any): any;
570
- advance_to_next_step(state: any): any;
584
+ advanceToNextStep(state: any): any;
571
585
  updateUserLocation(location: any, state: any): any;
586
+ getRecording(events: any): any;
587
+ }
588
+ export class NavigationReplay {
589
+ free(): void;
590
+ constructor(json: any);
591
+ getNextEvent(current_index: any): any;
592
+ getInitialTimestamp(): any;
593
+ getInitialRoute(): any;
572
594
  }
573
595
  /**
574
596
  * 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);
@@ -272,9 +272,10 @@ export class NavigationController {
272
272
  /**
273
273
  * @param {any} route
274
274
  * @param {any} config
275
+ * @param {any} should_record
275
276
  */
276
- constructor(route, config) {
277
- const ret = wasm.navigationcontroller_new(route, config);
277
+ constructor(route, config, should_record) {
278
+ const ret = wasm.navigationcontroller_new(route, config, should_record);
278
279
  if (ret[2]) {
279
280
  throw takeFromExternrefTable0(ret[1]);
280
281
  }
@@ -297,8 +298,8 @@ export class NavigationController {
297
298
  * @param {any} state
298
299
  * @returns {any}
299
300
  */
300
- advance_to_next_step(state) {
301
- const ret = wasm.navigationcontroller_advance_to_next_step(this.__wbg_ptr, state);
301
+ advanceToNextStep(state) {
302
+ const ret = wasm.navigationcontroller_advanceToNextStep(this.__wbg_ptr, state);
302
303
  if (ret[2]) {
303
304
  throw takeFromExternrefTable0(ret[1]);
304
305
  }
@@ -316,6 +317,79 @@ export class NavigationController {
316
317
  }
317
318
  return takeFromExternrefTable0(ret[0]);
318
319
  }
320
+ /**
321
+ * @param {any} events
322
+ * @returns {any}
323
+ */
324
+ getRecording(events) {
325
+ const ret = wasm.navigationcontroller_getRecording(this.__wbg_ptr, events);
326
+ if (ret[2]) {
327
+ throw takeFromExternrefTable0(ret[1]);
328
+ }
329
+ return takeFromExternrefTable0(ret[0]);
330
+ }
331
+ }
332
+
333
+ const NavigationReplayFinalization = (typeof FinalizationRegistry === 'undefined')
334
+ ? { register: () => {}, unregister: () => {} }
335
+ : new FinalizationRegistry(ptr => wasm.__wbg_navigationreplay_free(ptr >>> 0, 1));
336
+
337
+ export class NavigationReplay {
338
+
339
+ __destroy_into_raw() {
340
+ const ptr = this.__wbg_ptr;
341
+ this.__wbg_ptr = 0;
342
+ NavigationReplayFinalization.unregister(this);
343
+ return ptr;
344
+ }
345
+
346
+ free() {
347
+ const ptr = this.__destroy_into_raw();
348
+ wasm.__wbg_navigationreplay_free(ptr, 0);
349
+ }
350
+ /**
351
+ * @param {any} json
352
+ */
353
+ constructor(json) {
354
+ const ret = wasm.navigationreplay_new(json);
355
+ if (ret[2]) {
356
+ throw takeFromExternrefTable0(ret[1]);
357
+ }
358
+ this.__wbg_ptr = ret[0] >>> 0;
359
+ NavigationReplayFinalization.register(this, this.__wbg_ptr, this);
360
+ return this;
361
+ }
362
+ /**
363
+ * @param {any} current_index
364
+ * @returns {any}
365
+ */
366
+ getNextEvent(current_index) {
367
+ const ret = wasm.navigationreplay_getNextEvent(this.__wbg_ptr, current_index);
368
+ if (ret[2]) {
369
+ throw takeFromExternrefTable0(ret[1]);
370
+ }
371
+ return takeFromExternrefTable0(ret[0]);
372
+ }
373
+ /**
374
+ * @returns {any}
375
+ */
376
+ getInitialTimestamp() {
377
+ const ret = wasm.navigationreplay_getInitialTimestamp(this.__wbg_ptr);
378
+ if (ret[2]) {
379
+ throw takeFromExternrefTable0(ret[1]);
380
+ }
381
+ return takeFromExternrefTable0(ret[0]);
382
+ }
383
+ /**
384
+ * @returns {any}
385
+ */
386
+ getInitialRoute() {
387
+ const ret = wasm.navigationreplay_getInitialRoute(this.__wbg_ptr);
388
+ if (ret[2]) {
389
+ throw takeFromExternrefTable0(ret[1]);
390
+ }
391
+ return takeFromExternrefTable0(ret[0]);
392
+ }
319
393
  }
320
394
 
321
395
  const RouteAdapterFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -404,16 +478,6 @@ export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg
404
478
  return ret;
405
479
  }, arguments) };
406
480
 
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
481
  export function __wbg_done_769e5ede4b31c67b(arg0) {
418
482
  const ret = arg0.done;
419
483
  return ret;
@@ -428,8 +492,8 @@ export function __wbg_getRandomValues_38097e921c2494c3() { return handleError(fu
428
492
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
429
493
  }, arguments) };
430
494
 
431
- export function __wbg_getRandomValues_bcb4912f16000dc4() { return handleError(function (arg0, arg1) {
432
- arg0.getRandomValues(arg1);
495
+ export function __wbg_getRandomValues_3c9c0d586e575a16() { return handleError(function (arg0, arg1) {
496
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
433
497
  }, arguments) };
434
498
 
435
499
  export function __wbg_getTime_46267b1c24877e30(arg0) {
@@ -499,11 +563,6 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
499
563
  return ret;
500
564
  };
501
565
 
502
- export function __wbg_msCrypto_0a36e2ec3a343d26(arg0) {
503
- const ret = arg0.msCrypto;
504
- return ret;
505
- };
506
-
507
566
  export function __wbg_new0_f788a2397c7ca929() {
508
567
  const ret = new Date();
509
568
  return ret;
@@ -529,21 +588,6 @@ export function __wbg_new_a12002a7f91c75be(arg0) {
529
588
  return ret;
530
589
  };
531
590
 
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
591
  export function __wbg_next_25feadfc0913fea9(arg0) {
548
592
  const ret = arg0.next;
549
593
  return ret;
@@ -554,30 +598,11 @@ export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg
554
598
  return ret;
555
599
  }, arguments) };
556
600
 
557
- export function __wbg_node_02999533c4ea02e3(arg0) {
558
- const ret = arg0.node;
559
- return ret;
560
- };
561
-
562
601
  export function __wbg_now_807e54c39636c349() {
563
602
  const ret = Date.now();
564
603
  return ret;
565
604
  };
566
605
 
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
606
  export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
582
607
  arg0[arg1 >>> 0] = arg2;
583
608
  };
@@ -595,41 +620,11 @@ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
595
620
  return ret;
596
621
  };
597
622
 
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
623
  export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
624
624
  const ret = arg0.value;
625
625
  return ret;
626
626
  };
627
627
 
628
- export function __wbg_versions_c71aa1626a93e0a1(arg0) {
629
- const ret = arg0.versions;
630
- return ret;
631
- };
632
-
633
628
  export function __wbindgen_as_number(arg0) {
634
629
  const ret = +arg0;
635
630
  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.40.0",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",