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

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
  }
@@ -45349,7 +45355,7 @@ uniform ${i3} ${a3} u_${s3};
45349
45355
  this.set("hitTolerance", newValue);
45350
45356
  }
45351
45357
  get key() {
45352
- return this.get("key") || this.get("name") || getUid(this);
45358
+ return this.get("key") || this.get("name");
45353
45359
  }
45354
45360
  get map() {
45355
45361
  return this.getMapInternal();
@@ -45513,6 +45519,9 @@ uniform ${i3} ${a3} u_${s3};
45513
45519
  if (this.url.includes("style.json")) {
45514
45520
  return this.url;
45515
45521
  }
45522
+ if (this.get("mapLibreOptions")?.style) {
45523
+ return this.get("mapLibreOptions").style;
45524
+ }
45516
45525
  return buildStyleUrl(this.url, this.style, this.apiKey, this.apiKeyName);
45517
45526
  }
45518
45527
  updateMaplibreMap() {
@@ -46278,7 +46287,7 @@ uniform ${i3} ${a3} u_${s3};
46278
46287
  * @param {function} filterFc A function use to filter results.
46279
46288
  * @return {Array<Object>} Array of vehicle.
46280
46289
  */
46281
- getVehicle(filterFc) {
46290
+ getVehicles(filterFc) {
46282
46291
  return this.trajectories && // @ts-expect-error good type must be defined
46283
46292
  Object.values(this.trajectories).filter(filterFc) || [];
46284
46293
  }
@@ -47000,6 +47009,9 @@ uniform ${i3} ${a3} u_${s3};
47000
47009
  return response;
47001
47010
  });
47002
47011
  }
47012
+ getVehicles(filterFunc) {
47013
+ return this.engine.getVehicles(filterFunc);
47014
+ }
47003
47015
  getViewState() {
47004
47016
  if (!this.map?.getView()) {
47005
47017
  return {};
@@ -47117,6 +47129,9 @@ uniform ${i3} ${a3} u_${s3};
47117
47129
  get filter() {
47118
47130
  return this.engine.filter;
47119
47131
  }
47132
+ set filter(filter) {
47133
+ this.engine.filter = filter;
47134
+ }
47120
47135
  get hoverVehicleId() {
47121
47136
  return this.engine.hoverVehicleId;
47122
47137
  }
@@ -47141,6 +47156,9 @@ uniform ${i3} ${a3} u_${s3};
47141
47156
  get sort() {
47142
47157
  return this.engine.sort;
47143
47158
  }
47159
+ set sort(sort) {
47160
+ this.engine.sort = sort;
47161
+ }
47144
47162
  get trajectories() {
47145
47163
  return this.engine.trajectories;
47146
47164
  }