add todos, migrating to 3.x guide, related repos 📝

This commit is contained in:
Jannis R 2018-06-27 11:13:55 +02:00
parent f6c824eecb
commit eeb9ec2535
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
5 changed files with 78 additions and 16 deletions

View file

@ -2,23 +2,31 @@
## `3.0.0` ## `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)) - 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})` 💥 - 40b559f change `radar(n, w, s, e)` signature to `radar({north, west, south, east})`
- 005f3f8 remove `journey.departure`, `journey.arrival`, … 💥 - 005f3f8 remove `journey.departure`, `journey.arrival`, …
- 0ef0301 validate `opt.when` 💥 - 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) - 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 💥 - a356a26 throw if 0 products enabled
- c82ad23 `journeys()`: `opt.when``opt.departure`/`opt.arrival` 💥 - c82ad23 `journeys()`: `opt.when``opt.departure`/`opt.arrival`
- 21c273c `journeys()`/`journeyLeg()`: leg stopovers: parse & expose delays - 665bed9 rename `location(id)` to `station(id)`
- 665bed9 `location(id)``station(id)` 💥 - 6611f26 `journeys()`/`journeyLeg()`: `leg.passed``leg.stopovers`
- 6611f26 `journeys()`/`journeyLeg()`: `leg.passed``leg.stopovers` 💥 - ebe4fa6 `journeys()`/`journeyLeg()`: `opt.passedStations``opt.stopovers`
- ebe4fa6 `journeys()`/`journeyLeg()`: `opt.passedStations``opt.stopovers` 💥 - 3e672ee `journeys()`/`journeyLeg()`: `stopover.station``stopover.stop`
- 3e672ee `journeys()`/`journeyLeg()`: `stopover.station``stopover.stop` 💥 - 2e6aefe journey leg, departure, movement: `journeyId` -> `tripId`
- 021ae45: `journeys()`/`journeyLeg()`: leg stopovers: parse & expose platforms - 8881d8a & b6fbaa5: change parsers signature to `parse…(profile, opt, data)`
- 85e0bdf `journeys()`: `startWithWalking` option with default `true`
- 2e6aefe journey leg, departure, movement: `journeyId` -> `tripId` 💥
## `2.7.0` ## `2.7.0`

49
docs/migrating-to-3.md Normal file
View file

@ -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`

View file

@ -50,7 +50,7 @@ const createClient = (profile, request = _request) => {
dirLoc: dir, dirLoc: dir,
jnyFltrL: [products], jnyFltrL: [products],
dur: opt.duration, dur: opt.duration,
getPasslist: false getPasslist: false // todo: what is this?
} }
}) })
.then((d) => { .then((d) => {

View file

@ -37,6 +37,7 @@ const applyRemarks = (leg, hints, warnings, refs) => {
const createParseJourneyLeg = (profile, opt, data) => { const createParseJourneyLeg = (profile, opt, data) => {
const {locations, lines, hints, warnings, polylines} = data const {locations, lines, hints, warnings, polylines} = data
// todo: pt.status // todo: pt.status
// todo: pt.status, pt.isPartCncl
// todo: pt.sDays // todo: pt.sDays
// todo: pt.dep.dProgType, pt.arr.dProgType // todo: pt.dep.dProgType, pt.arr.dProgType
// todo: what is pt.jny.dirFlg? // todo: what is pt.jny.dirFlg?

View file

@ -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. - [`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-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-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-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. - [`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) - [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) - [Collection of european transport JavaScript modules.](https://github.com/public-transport/european-transport-modules)