mobility-toolbox-js 3.0.0-beta.34 → 3.0.0-beta.35

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.
@@ -115,7 +115,7 @@ declare class RealtimeEngine {
115
115
  * @param {function} filterFc A function use to filter results.
116
116
  * @return {Array<Object>} Array of vehicle.
117
117
  */
118
- getVehicle(filterFc: FilterFunction): RealtimeTrajectory[];
118
+ getVehicles(filterFc: FilterFunction): RealtimeTrajectory[];
119
119
  /**
120
120
  * Request feature information for a given coordinate.
121
121
  *
@@ -170,7 +170,7 @@ class RealtimeEngine {
170
170
  * @param {function} filterFc A function use to filter results.
171
171
  * @return {Array<Object>} Array of vehicle.
172
172
  */
173
- getVehicle(filterFc) {
173
+ getVehicles(filterFc) {
174
174
  return ((this.trajectories &&
175
175
  // @ts-expect-error good type must be defined
176
176
  Object.values(this.trajectories).filter(filterFc)) ||
package/mbt.js CHANGED
@@ -44565,13 +44565,12 @@ uniform ${i3} ${a3} u_${s3};
44565
44565
  this.routingLayer?.getSource()?.addFeature(routeFeature);
44566
44566
  this.loading = false;
44567
44567
  }).catch((error) => {
44568
- if (/AbortError/.test(error.message)) {
44568
+ if (/AbortError/.test(error.name)) {
44569
44569
  return;
44570
44570
  }
44571
44571
  this.segments = [];
44572
44572
  this.dispatchEvent(new Event_default("error"));
44573
44573
  this.onRouteError(error, this);
44574
- this.routingLayer?.getSource()?.clear();
44575
44574
  this.loading = false;
44576
44575
  });
44577
44576
  })
@@ -44602,7 +44601,13 @@ uniform ${i3} ${a3} u_${s3};
44602
44601
  `${this.stopsApiUrl}lookup/${stationId}?key=${this.stopsApiKey}`,
44603
44602
  { signal: abortController.signal }
44604
44603
  ).then((res) => res.json()).then((stationData) => {
44605
- const { coordinates: coordinates2 } = stationData.features[0].geometry;
44604
+ const { coordinates: coordinates2 } = stationData?.features?.[0]?.geometry || {};
44605
+ if (!coordinates2) {
44606
+ console.log(
44607
+ "No coordinates found for station " + stationId,
44608
+ stationData
44609
+ );
44610
+ }
44606
44611
  this.cacheStationData[viaPoint] = fromLonLat(coordinates2);
44607
44612
  pointFeature.set("viaPointTrack", track2);
44608
44613
  pointFeature.setGeometry(new Point_default(fromLonLat(coordinates2)));
@@ -44614,6 +44619,7 @@ uniform ${i3} ${a3} u_${s3};
44614
44619
  }
44615
44620
  this.dispatchEvent(new Event_default("error"));
44616
44621
  this.onRouteError(error, this);
44622
+ this.routingLayer?.getSource()?.clear();
44617
44623
  this.loading = false;
44618
44624
  });
44619
44625
  }
@@ -46278,7 +46284,7 @@ uniform ${i3} ${a3} u_${s3};
46278
46284
  * @param {function} filterFc A function use to filter results.
46279
46285
  * @return {Array<Object>} Array of vehicle.
46280
46286
  */
46281
- getVehicle(filterFc) {
46287
+ getVehicles(filterFc) {
46282
46288
  return this.trajectories && // @ts-expect-error good type must be defined
46283
46289
  Object.values(this.trajectories).filter(filterFc) || [];
46284
46290
  }
@@ -47000,6 +47006,9 @@ uniform ${i3} ${a3} u_${s3};
47000
47006
  return response;
47001
47007
  });
47002
47008
  }
47009
+ getVehicles(filterFunc) {
47010
+ return this.engine.getVehicles(filterFunc);
47011
+ }
47003
47012
  getViewState() {
47004
47013
  if (!this.map?.getView()) {
47005
47014
  return {};
@@ -47117,6 +47126,9 @@ uniform ${i3} ${a3} u_${s3};
47117
47126
  get filter() {
47118
47127
  return this.engine.filter;
47119
47128
  }
47129
+ set filter(filter) {
47130
+ this.engine.filter = filter;
47131
+ }
47120
47132
  get hoverVehicleId() {
47121
47133
  return this.engine.hoverVehicleId;
47122
47134
  }
@@ -47141,6 +47153,9 @@ uniform ${i3} ${a3} u_${s3};
47141
47153
  get sort() {
47142
47154
  return this.engine.sort;
47143
47155
  }
47156
+ set sort(sort) {
47157
+ this.engine.sort = sort;
47158
+ }
47144
47159
  get trajectories() {
47145
47160
  return this.engine.trajectories;
47146
47161
  }