@stadiamaps/ferrostar 0.38.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,15 +415,51 @@ export interface GeographicCoordinate {
415
415
  lng: number;
416
416
  }
417
417
 
418
- export interface NavigationControllerConfig {
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 {
419
436
  /**
420
- * Configures when navigation advances to next waypoint in the route.
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 {
447
+ /**
448
+ * Configures when navigation advances to the next waypoint in the route.
421
449
  */
422
450
  waypointAdvance: WaypointAdvanceMode;
423
451
  /**
424
452
  * Configures when navigation advances to the next step in the route.
425
453
  */
426
- stepAdvance: StepAdvanceMode;
454
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
455
+ /**
456
+ * A special advance condition used for the final 2 route steps (last and arrival).
457
+ *
458
+ * This exists because several of our step advance conditions require entry and
459
+ * exit from a step\'s geometry. The end of the route/arrival doesn\'t always accommodate
460
+ * the expected location updates for the core step advance condition.
461
+ */
462
+ arrivalStepAdvanceCondition: SerializableStepAdvanceCondition;
427
463
  /**
428
464
  * Configures when the user is deemed to be off course.
429
465
  *
@@ -458,17 +494,6 @@ export interface NavigationControllerConfig {
458
494
  */
459
495
  export type WaypointAdvanceMode = { WaypointWithinRange: number };
460
496
 
461
- /**
462
- * Special conditions which alter the normal step advance logic,
463
- */
464
- export type SpecialAdvanceConditions = { AdvanceAtDistanceFromEnd: number } | { MinimumDistanceFromCurrentStepLine: number };
465
-
466
- /**
467
- * The step advance mode describes when the current maneuver has been successfully completed,
468
- * and we should advance to the next step.
469
- */
470
- export type StepAdvanceMode = "Manual" | { DistanceToEndOfStep: { distance: number; minimumHorizontalAccuracy: number } } | { RelativeLineStringDistance: { minimumHorizontalAccuracy: number; specialAdvanceConditions: SpecialAdvanceConditions | undefined } };
471
-
472
497
  /**
473
498
  * Controls filtering/post-processing of user course by the [`NavigationController`].
474
499
  */
@@ -526,18 +551,11 @@ export interface TripProgress {
526
551
  durationRemaining: number;
527
552
  }
528
553
 
529
- /**
530
- * Status information that describes whether the user is proceeding according to the route or not.
531
- *
532
- * Note that the name is intentionally a bit generic to allow for expansion of other states.
533
- * For example, we could conceivably add a \"wrong way\" status in the future.
534
- */
535
- export type RouteDeviation = "NoDeviation" | { OffRoute: { deviationFromRouteLine: number } };
536
-
537
- /**
538
- * Determines if the user has deviated from the expected route.
539
- */
540
- export type RouteDeviationTracking = "None" | { StaticThreshold: { minimumHorizontalAccuracy: number; maxAcceptableDeviation: number } };
554
+ export interface SerializableNavState {
555
+ tripState: TripState;
556
+ stepAdvanceCondition: SerializableStepAdvanceCondition;
557
+ recordingEvents: NavigationRecordingEvent[] | undefined;
558
+ }
541
559
 
542
560
  export type SimulationError = { PolylineError: { error: string } } | "NotEnoughPoints";
543
561
 
@@ -561,10 +579,18 @@ export interface LocationSimulationState {
561
579
  */
562
580
  export class NavigationController {
563
581
  free(): void;
564
- constructor(route: any, config: any);
582
+ constructor(route: any, config: any, should_record: any);
565
583
  getInitialState(location: any): any;
566
- advance_to_next_step(state: any): any;
584
+ advanceToNextStep(state: any): any;
567
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;
568
594
  }
569
595
  /**
570
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,11 +169,29 @@ 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);
186
186
  return value;
187
187
  }
188
+
189
+ function passArray8ToWasm0(arg, malloc) {
190
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
191
+ getUint8ArrayMemory0().set(arg, ptr / 1);
192
+ WASM_VECTOR_LEN = arg.length;
193
+ return ptr;
194
+ }
188
195
  /**
189
196
  * JavaScript wrapper for `location_simulation_from_coordinates`.
190
197
  * @param {any} coordinates
@@ -243,13 +250,6 @@ export function advanceLocationSimulation(state) {
243
250
  return ret;
244
251
  }
245
252
 
246
- function passArray8ToWasm0(arg, malloc) {
247
- const ptr = malloc(arg.length * 1, 1) >>> 0;
248
- getUint8ArrayMemory0().set(arg, ptr / 1);
249
- WASM_VECTOR_LEN = arg.length;
250
- return ptr;
251
- }
252
-
253
253
  const NavigationControllerFinalization = (typeof FinalizationRegistry === 'undefined')
254
254
  ? { register: () => {}, unregister: () => {} }
255
255
  : new FinalizationRegistry(ptr => wasm.__wbg_navigationcontroller_free(ptr >>> 0, 1));
@@ -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.38.0",
10
+ "version": "0.40.0",
11
11
  "license": "BSD-3-Clause",
12
12
  "repository": {
13
13
  "type": "git",