minotor 7.0.0 → 7.0.1

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/CHANGELOG.md CHANGED
@@ -1,11 +1,6 @@
1
- # [7.0.0](https://github.com/aubryio/minotor/compare/v6.0.0...v7.0.0) (2025-09-19)
1
+ ## [7.0.1](https://github.com/aubryio/minotor/compare/v7.0.0...v7.0.1) (2025-09-23)
2
2
 
3
3
 
4
- ### Performance Improvements
4
+ ### Bug Fixes
5
5
 
6
- * optimize loops on the critical path ([#26](https://github.com/aubryio/minotor/issues/26)) ([8504930](https://github.com/aubryio/minotor/commit/85049308f7bbcf4d88f3dcfb47edd2511e9da80d))
7
-
8
-
9
- ### BREAKING CHANGES
10
-
11
- * Timetable binary format was updated and is not compatible with the old one.
6
+ * address corner cases with boarding conditions ([#27](https://github.com/aubryio/minotor/issues/27)) ([cd5fe68](https://github.com/aubryio/minotor/commit/cd5fe682ca359872a6bac46dbdc30ec9d603c8ef))
package/dist/cli.mjs CHANGED
@@ -17314,29 +17314,35 @@ let Route$1 = class Route {
17314
17314
  * @returns The index of the earliest trip meeting the criteria, or undefined if no such trip is found.
17315
17315
  */
17316
17316
  findEarliestTrip(stopId, after = Time.origin(), beforeTrip) {
17317
- const maxTripIndex = beforeTrip !== undefined
17318
- ? Math.min(beforeTrip - 1, this.nbTrips - 1)
17319
- : this.nbTrips - 1;
17320
- if (maxTripIndex < 0) {
17317
+ if (this.nbTrips <= 0)
17321
17318
  return undefined;
17322
- }
17323
- let earliestTripIndex;
17324
- let lowTrip = 0;
17325
- let highTrip = maxTripIndex;
17326
- while (lowTrip <= highTrip) {
17327
- const midTrip = Math.floor((lowTrip + highTrip) / 2);
17328
- const departure = this.departureFrom(stopId, midTrip);
17329
- const pickUpType = this.pickUpTypeFrom(stopId, midTrip);
17330
- if ((departure.isAfter(after) || departure.equals(after)) &&
17331
- pickUpType !== 'NOT_AVAILABLE') {
17332
- earliestTripIndex = midTrip;
17333
- highTrip = midTrip - 1;
17319
+ let hi = this.nbTrips - 1;
17320
+ if (beforeTrip !== undefined)
17321
+ hi = Math.min(hi, beforeTrip - 1);
17322
+ if (hi < 0)
17323
+ return undefined;
17324
+ let lo = 0;
17325
+ let lb = -1;
17326
+ while (lo <= hi) {
17327
+ const mid = (lo + hi) >>> 1;
17328
+ const depMid = this.departureFrom(stopId, mid);
17329
+ if (depMid.isBefore(after)) {
17330
+ lo = mid + 1;
17334
17331
  }
17335
17332
  else {
17336
- lowTrip = midTrip + 1;
17333
+ lb = mid;
17334
+ hi = mid - 1;
17335
+ }
17336
+ }
17337
+ if (lb === -1)
17338
+ return undefined;
17339
+ for (let t = lb; t < (beforeTrip !== null && beforeTrip !== void 0 ? beforeTrip : this.nbTrips); t++) {
17340
+ const pickup = this.pickUpTypeFrom(stopId, t);
17341
+ if (pickup !== 'NOT_AVAILABLE') {
17342
+ return t;
17337
17343
  }
17338
17344
  }
17339
- return earliestTripIndex;
17345
+ return undefined;
17340
17346
  }
17341
17347
  /**
17342
17348
  * Retrieves the index of a stop within the route.
@@ -20801,7 +20807,7 @@ class Result {
20801
20807
 
20802
20808
  const UNREACHED = Time.infinity();
20803
20809
  /**
20804
- * A public transportation network router utilizing the RAPTOR algorithm for
20810
+ * A public transportation network router implementing the RAPTOR algorithm for
20805
20811
  * efficient journey planning and routing. For more information on the RAPTOR
20806
20812
  * algorithm, refer to its detailed explanation in the research paper:
20807
20813
  * https://www.microsoft.com/en-us/research/wp-content/uploads/2012/01/raptor_alenex.pdf
@@ -20976,8 +20982,8 @@ class Router {
20976
20982
  const earliestArrivalOnPreviousRound = (_c = arrivalsAtPreviousRound.get(currentStop)) === null || _c === void 0 ? void 0 : _c.arrival;
20977
20983
  if (earliestArrivalOnPreviousRound !== undefined &&
20978
20984
  (currentTrip === undefined ||
20979
- earliestArrivalOnPreviousRound.isBefore(route.arrivalAt(currentStop, currentTrip.tripIndex)) ||
20980
- earliestArrivalOnPreviousRound.equals(route.arrivalAt(currentStop, currentTrip.tripIndex)))) {
20985
+ earliestArrivalOnPreviousRound.isBefore(route.departureFrom(currentStop, currentTrip.tripIndex)) ||
20986
+ earliestArrivalOnPreviousRound.equals(route.departureFrom(currentStop, currentTrip.tripIndex)))) {
20981
20987
  const earliestTrip = route.findEarliestTrip(currentStop, earliestArrivalOnPreviousRound, currentTrip === null || currentTrip === void 0 ? void 0 : currentTrip.tripIndex);
20982
20988
  if (earliestTrip !== undefined) {
20983
20989
  currentTrip = {