diff --git a/docs/changelog.md b/docs/changelog.md index a15661a2..19bf6d8a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,23 +2,31 @@ ## `3.0.0` -This version is not fully backwords-compatible. Check out [the migration guide](migration-to-3.md). +This version is not fully backwords-compatible. Check out [the migration guide](migrating-to-3.md). + +### new features ✨ + +- 0db84ce #61 parse remarks for stopovers and journey legs +- ac9819b `arrivals()` method – [docs](arrivals.md) +- 21c273c `journeys()`/`journeyLeg()`: leg stopovers: parse & expose delays +- 021ae45 `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms +- 85e0bdf `journeys()`: `startWithWalking` option with default `true` + +### breaking changes 💥 - b7c1ee3 profiles: new products markup ([guide](https://github.com/public-transport/hafas-client/blob/ebe4fa64d871f711ced99d528c0171b180edc135/docs/writing-a-profile.md#3-products)) -- 40b559f `radar(n, w, s, e)` → `radar({n, w, s, e})` 💥 -- 005f3f8 remove `journey.departure`, `journey.arrival`, … 💥 -- 0ef0301 validate `opt.when` 💥 -- 431574b parse polylines using `profile.parsePolyLine` 💥 – [docs for the output format](https://github.com/public-transport/hafas-client/blob/ebe4fa64d871f711ced99d528c0171b180edc135/docs/journey-leg.md#polyline-option) -- a356a26 throw if 0 products enabled 💥 -- c82ad23 `journeys()`: `opt.when` → `opt.departure`/`opt.arrival` 💥 -- 21c273c `journeys()`/`journeyLeg()`: leg stopovers: parse & expose delays -- 665bed9 `location(id)` → `station(id)` 💥 -- 6611f26 `journeys()`/`journeyLeg()`: `leg.passed` → `leg.stopovers` 💥 -- ebe4fa6 `journeys()`/`journeyLeg()`: `opt.passedStations` → `opt.stopovers` 💥 -- 3e672ee `journeys()`/`journeyLeg()`: `stopover.station` → `stopover.stop` 💥 -- 021ae45: `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms -- 85e0bdf `journeys()`: `startWithWalking` option with default `true` ✨ -- 2e6aefe journey leg, departure, movement: `journeyId` -> `tripId` 💥 +- 40b559f change `radar(n, w, s, e)` signature to `radar({north, west, south, east})` +- 005f3f8 remove `journey.departure`, `journey.arrival`, … +- 0ef0301 validate `opt.when` +- 431574b parse polylines using `profile.parsePolyLine` – [docs for the output format](https://github.com/public-transport/hafas-client/blob/ebe4fa64d871f711ced99d528c0171b180edc135/docs/journey-leg.md#polyline-option) +- a356a26 throw if 0 products enabled +- c82ad23 `journeys()`: `opt.when` → `opt.departure`/`opt.arrival` +- 665bed9 rename `location(id)` to `station(id)` +- 6611f26 `journeys()`/`journeyLeg()`: `leg.passed` → `leg.stopovers` +- ebe4fa6 `journeys()`/`journeyLeg()`: `opt.passedStations` → `opt.stopovers` +- 3e672ee `journeys()`/`journeyLeg()`: `stopover.station` → `stopover.stop` +- 2e6aefe journey leg, departure, movement: `journeyId` -> `tripId` +- 8881d8a & b6fbaa5: change parsers signature to `parse…(profile, opt, data)` ## `2.7.0` diff --git a/docs/migrating-to-3.md b/docs/migrating-to-3.md new file mode 100644 index 00000000..668e67a5 --- /dev/null +++ b/docs/migrating-to-3.md @@ -0,0 +1,49 @@ +# Migrating to `hafas-client@3` + +## If you use the `journeys()` or `journeyLeg()` methods… + +- …instead of `journey.departure`, use `journey.legs[0].departure`. 005f3f8 +- …instead of `journey.arrival`, use `journey.legs[last].arrival`. 005f3f8 +- …rename `opt.passedStations` to `opt.stopovers`. ebe4fa6 +- …rename `leg.journeyId` to `leg.tripId`. 2e6aefe +- …rename `leg.passed` to `leg.stopovers`. 6611f26 +- …rename `leg.stopovers[].station` to `leg.stopovers[].stop`. 3e672ee + +## If you use the `journeys()` method and `opt.when`… + +…use `opt.departure` instead. Use `opt.arrival` to get journeys arriving before the specified date+time. This replaces the `opt.when` & `opt.whenRepresents` options from `hafas-client@2`. c82ad23 + +## If you use the `journeys()` and `opt.polylines` or `journeyLeg()` and `opt.polyline`… + +…`leg.polyline` will be [parsed for you now](https://github.com/public-transport/hafas-client/blob/f6c824eecb459181ea90ddf41bf1a1e8b64539ec/docs/journey-leg.md#polyline-option). + +## If you use the `departures()` method… + +…rename `departure.journeyId` to `departure.tripId`. 2e6aefe + +## If you use the `location()` method… + +…change the `location(id)` call to `station(id)`. 665bed9 + +## If you use the `radar()` method… + +- …change the `radar(north, west, south, east)` call to `radar({north, west, south, east})`. 40b559f +- …rename `movement.journeyId` to `movement.tripId`. 2e6aefe + +## If you use `hafas-client` with a custom profile… + +…write your profile in [the new format](writing-a-profile.md). Then, you can pass it into `hafas-client` just like before. #32/b7c1ee3 + +## If you use `hafas-client` with custom parse functions… + +…change the following parsers to the `parse…(profile, opt, data)` signature. 8881d8a/b6fbaa5 + +- `parseDeparture` +- `parseJourney` +- `parseJourneyLeg` +- `parseLine` +- `parseMovement` +- `parseLocation` +- `parseNearby` +- `parsePolyline` +- `parseStopover` diff --git a/index.js b/index.js index 1d0cde19..a83218d9 100644 --- a/index.js +++ b/index.js @@ -50,7 +50,7 @@ const createClient = (profile, request = _request) => { dirLoc: dir, jnyFltrL: [products], dur: opt.duration, - getPasslist: false + getPasslist: false // todo: what is this? } }) .then((d) => { diff --git a/parse/journey-leg.js b/parse/journey-leg.js index 58d51096..c92d8204 100644 --- a/parse/journey-leg.js +++ b/parse/journey-leg.js @@ -37,6 +37,7 @@ const applyRemarks = (leg, hints, warnings, refs) => { const createParseJourneyLeg = (profile, opt, data) => { const {locations, lines, hints, warnings, polylines} = data // todo: pt.status + // todo: pt.status, pt.isPartCncl // todo: pt.sDays // todo: pt.dep.dProgType, pt.arr.dProgType // todo: what is pt.jny.dirFlg? diff --git a/readme.md b/readme.md index 8467b3b2..c7129099 100644 --- a/readme.md +++ b/readme.md @@ -177,7 +177,11 @@ The returned [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript - [`vbb-hafas`](https://github.com/derhuerst/vbb-hafas#vbb-hafas) – JavaScript client for Berlin & Brandenburg public transport HAFAS API. - [`hafas-departures-in-direction`](https://github.com/derhuerst/hafas-departures-in-direction#hafas-departures-in-direction) – Pass in a HAFAS client, get departures in a certain direction. - [`hafas-collect-departures-at`](https://github.com/derhuerst/hafas-collect-departures-at#hafas-collect-departures-at) – Utility to collect departures, using any HAFAS client. +- [`hafas-monitor-departures`](https://github.com/derhuerst/hafas-monitor-departures#hafas-monitor-departures) – Pass in a HAFAS client, fetch all departures at any set of stations. +- [`hafas-departures-in-direction`](https://github.com/derhuerst/hafas-departures-in-direction#hafas-departures-in-direction) – Pass in a HAFAS client, get departures in a certain direction. - [`hafas-discover-stations`](https://github.com/derhuerst/hafas-discover-stations#hafas-discover-stations) – Pass in a HAFAS client, discover stations by querying departures. +- [`hafas-record-delays`](https://github.com/derhuerst/hafas-record-delays#hafas-record-delays) – Record delays from hafas-monitor-departures into a LevelDB. +- [`hafas-estimate-station-weight`](https://github.com/derhuerst/hafas-estimate-station-weight#hafas-estimate-station-weight) – Pass in a HAFAS client, estimate the importance of a station. - [`hafas-rest-api`](https://github.com/derhuerst/hafas-rest-api#hafas-rest-api) – Expose a HAFAS client via an HTTP REST API. - [List of european long-distance transport operators, available API endpoints, GTFS feeds and client modules.](https://github.com/public-transport/european-transport-operators) - [Collection of european transport JavaScript modules.](https://github.com/public-transport/european-transport-modules)