Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
902 commits
Select commit Hold shift + click to select a range
e2bbef3
Merge pull request #184 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Jun 24, 2025
a0cf524
For .text properties we need the before step (#text parsing) to be ex…
vasile Jun 24, 2025
c27d967
Updates CHANGELOG
vasile Jun 24, 2025
9aaa6e8
Links PR
vasile Jun 24, 2025
f11b572
Updates patch version
vasile Jun 24, 2025
289c2cc
Merge pull request #185 from openTdataCH/feature/ojp-sdk-next-fix-str…
vasile Jun 24, 2025
4dc54c4
Updates latest `ojp-shared-types`
vasile Jul 8, 2025
d669ea0
Updates CHANGELOG
vasile Jul 8, 2025
38cd051
Links PR
vasile Jul 8, 2025
51428e9
Bumps patch version
vasile Jul 8, 2025
26c5bde
npm fresh install
vasile Jul 8, 2025
c502f85
Merge pull request #189 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Jul 8, 2025
d51608e
Use latest ojp-shared-types version
vasile Aug 20, 2025
c4c372b
Updates README, reflect demo app changes
vasile Aug 20, 2025
37ad9f2
Updates CHANGELOG
vasile Aug 20, 2025
459047d
Bumps patch version
vasile Aug 20, 2025
4263115
Links PR
vasile Aug 20, 2025
13ac2aa
Merge pull request #191 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Aug 20, 2025
7ddd5b7
Adds tests for ExpectedDepartureOccupancy array
vasile Aug 21, 2025
e3ca90e
Adds TRR fixture
vasile Sep 1, 2025
ce2033d
Adds TRR tests
vasile Sep 1, 2025
75d003d
Use latest ojp-shared-types
vasile Sep 1, 2025
1384819
Bump patch version
vasile Sep 1, 2025
0f3eeea
Updates CHANGELOG
vasile Sep 1, 2025
de8a7eb
Links PR
vasile Sep 1, 2025
79df75b
Merge pull request #193 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Sep 1, 2025
b744574
Use latest ojp-shared-types
vasile Sep 17, 2025
64e3012
No need for these
vasile Sep 17, 2025
2de47e4
explicit disable / enable LinkProjection
vasile Sep 17, 2025
4ef8e30
Adds public transport request with optional MOT filter
vasile Sep 17, 2025
973a985
Adds method that enables TR car request filter
vasile Sep 17, 2025
4903f86
npm fresh install
vasile Sep 17, 2025
5e2effd
Merge pull request #194 from openTdataCH/feature/tr-car-filter
vasile Sep 17, 2025
b7502c0
Updates CHANGELOG
vasile Sep 17, 2025
fa6ccf4
Bumps patch version
vasile Sep 17, 2025
bb72543
Merge pull request #195 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Sep 17, 2025
b672ef4
Use latest ojp-shared-types
vasile Sep 26, 2025
d60c65b
Bumps patch version
vasile Sep 26, 2025
40f97a9
Updates CHANGELOG
vasile Sep 26, 2025
b053649
Merge pull request #200 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Sep 26, 2025
7f2e7f2
Use latest ojp-shared-types
vasile Oct 16, 2025
6a4a0ea
Bump patch version
vasile Oct 16, 2025
cb47e45
Updates CHANGELOG
vasile Oct 16, 2025
b6f1714
Links PR
vasile Oct 16, 2025
57a8ddb
npm fresh install
vasile Oct 16, 2025
17d6cd2
Merge pull request #201 from openTdataCH/feature/ojp-sdk-next-new-ver…
vasile Oct 16, 2025
4ce7135
Adds npm publish workflow
vasile Oct 27, 2025
1945b45
Use latest ojp-shared-types
vasile Oct 27, 2025
c4c1c25
Use latest ojp-shared-types
vasile Oct 31, 2025
2a8bedb
Bumps patch version
vasile Oct 31, 2025
5802e93
service.personalMode is now required
vasile Oct 31, 2025
5e00e98
individualTransportOption is array and required
vasile Oct 31, 2025
f15e409
Adds setMaxDurationWalkingTime for TR request to allow routes with lo…
vasile Oct 31, 2025
564dda3
Adds runTR_ItModeFilter example
vasile Oct 31, 2025
57587af
Use latest ojp-shared-types
vasile Oct 31, 2025
8d0a456
Updates CHANGELOG
vasile Oct 31, 2025
4305f4e
Updates CHANGELOG
vasile Oct 31, 2025
d1b84fa
Links PR
vasile Oct 31, 2025
68ee405
Merge pull request #205 from openTdataCH/feature/ojp-sdk-next-adds-it…
vasile Oct 31, 2025
61c6e35
Fresh npm install
vasile Oct 31, 2025
342ec76
Merge pull request #206 from openTdataCH/fix/ojp-sdk-next-fresh-install
vasile Oct 31, 2025
d4cbfd5
Adds sync lockfile task
vasile Oct 31, 2025
a4553f9
Merge pull request #207 from openTdataCH/fix/ojp-sdk-next-build
vasile Oct 31, 2025
f5496ec
adds required param
vasile Nov 7, 2025
2696428
Formatting
vasile Nov 7, 2025
cf03801
Allow also to send place types and number of results
vasile Nov 7, 2025
461a17c
Better name
vasile Nov 7, 2025
013f5b7
Adds (now) required params
vasile Nov 7, 2025
ae2062b
Expose OJP 1.0 XML_Config
vasile Nov 7, 2025
a25ffdc
Adds Response types
vasile Nov 7, 2025
1d640ef
Use extracted types
vasile Nov 7, 2025
ed5312e
Expose Response types and XML_Config data
vasile Nov 7, 2025
c905d40
Use XML_Config data
vasile Nov 7, 2025
863069c
New approach, add SDK main member
vasile Nov 8, 2025
7c59b66
Use a registry to map the requests
vasile Nov 8, 2025
2e3a80b
Adds RequestHelpers
vasile Nov 10, 2025
b5ddf01
Extract OJP_VERSION
vasile Nov 10, 2025
a7c4e4b
Adds Base
vasile Nov 10, 2025
c6a3382
Renamed v2 to current
vasile Nov 10, 2025
54bc23f
Adds SharedLocationInformationRequest
vasile Nov 10, 2025
1ba9386
Use OJP_VERSION, store also other members (requestorRef, language, ht…
vasile Nov 10, 2025
0571ec0
Adds OJPv1_LocationInformationRequestResponse
vasile Nov 10, 2025
2b585be
Adds per-version LIR request files
vasile Nov 10, 2025
d22e680
Expose request files
vasile Nov 10, 2025
64211b5
Allow to infer the type
vasile Nov 10, 2025
546877c
sdk-new replaces sdk content
vasile Nov 10, 2025
1906314
Updates SDK exports
vasile Nov 10, 2025
deefa5b
Order
vasile Nov 10, 2025
fcfbe7d
No more need for this hack
vasile Nov 10, 2025
9f49e17
Always ask for XML_Config
vasile Nov 10, 2025
b4df8ae
XML_Config is now required
vasile Nov 10, 2025
7b2842f
Extract initWithRequestMock, initWithResponseMock in Base
vasile Nov 10, 2025
d75cfc1
Adds TIR Request v1, v2, shared files
vasile Nov 10, 2025
f922f77
Adds / register TripInfoRequest
vasile Nov 10, 2025
1690615
No more need of this
vasile Nov 10, 2025
ce4fe36
Formatting
vasile Nov 10, 2025
796320d
Adds TIR response
vasile Nov 10, 2025
aad8972
Adds TIR request
vasile Nov 10, 2025
5072534
Expose only SDK
vasile Nov 10, 2025
b39dfde
Exposes also XMLSerializer
vasile Nov 10, 2025
966c5dc
Adds patchPayload, fetchResponse, buildRequestXML to Base. Adapt LIR …
vasile Nov 10, 2025
3b7684e
Bring back to individual classes so in the future we can extend the c…
vasile Nov 10, 2025
d249494
Remove patchPayload and patch the TIR OJP 1.0 request in constructor
vasile Nov 10, 2025
39a3fd8
Adds TR+Shared requests
vasile Nov 10, 2025
93f0a2a
Register TR
vasile Nov 10, 2025
a94d09d
Adds TR to OJP SDK
vasile Nov 10, 2025
2d5385d
Adds SER+Shared requests
vasile Nov 10, 2025
12467d0
Registers SER
vasile Nov 10, 2025
9d37165
Adds SER to SDK.requests
vasile Nov 10, 2025
b7dffd7
Adds missing imports
vasile Nov 10, 2025
ec3f669
Adds TRR+Shared requests
vasile Nov 10, 2025
985d8f7
Order
vasile Nov 10, 2025
c0f9312
Registers TRR
vasile Nov 10, 2025
a449023
Adds TRR to SDK.requests
vasile Nov 10, 2025
b1cef0f
Dont use shared, no need to invent fake requests
vasile Nov 11, 2025
e2d545b
Fix TRR, the real one should be for v2
vasile Nov 11, 2025
1055a8b
Remove FakeOJPv1_TripRefineRequest
vasile Nov 11, 2025
ee504ea
No more need of this
vasile Nov 11, 2025
5afe66d
No more need of this
vasile Nov 11, 2025
3026238
Adds FareRequest
vasile Nov 11, 2025
13a50ad
Registers FareRequest
vasile Nov 11, 2025
785a618
Adds FareRequest to SDK
vasile Nov 11, 2025
09489a8
Directly export DateHelpers
vasile Nov 11, 2025
f8c7d71
Use new path
vasile Nov 11, 2025
6316a92
No more need of this
vasile Nov 11, 2025
6e38413
Export responses
vasile Nov 11, 2025
44b571a
Keeps old clients happy
vasile Nov 11, 2025
15c12b0
No more need of this
vasile Nov 11, 2025
a7919d2
FareRequest is using OJP1.0, adds more checks
vasile Nov 11, 2025
db52b1a
Export OJPv1_FareRequest, use it for SDK 1.0
vasile Nov 11, 2025
2ee24db
Make static init Default public so can be reused by initWithResponseMock
vasile Nov 11, 2025
ea0d954
Make it protected so cant be reused from outside
vasile Nov 11, 2025
74dde42
Check on sdk.version when sending the XML_Config
vasile Nov 11, 2025
066dc85
Throw errors in case of unsuccessful parsing
vasile Nov 11, 2025
a2f07b6
InitialInput has to be undefined otherwise is sent as empty node
vasile Nov 11, 2025
524bfc9
Formatting
vasile Nov 11, 2025
64e4ec4
Pass placeTypes and not only ['stop']
vasile Nov 11, 2025
7c501e2
Updates imports
vasile Nov 11, 2025
cc112a7
make the constructor private and always require version. Add 2 static…
vasile Nov 11, 2025
47abb33
Formatting
vasile Nov 11, 2025
8dd07b6
Use new SDK constructs
vasile Nov 11, 2025
53897bf
Updates tests to use newest SDK constructs
vasile Nov 11, 2025
f839a08
No more need of these
vasile Nov 11, 2025
36243f8
Formatting
vasile Nov 11, 2025
71bf271
Use new constructs
vasile Nov 11, 2025
87ee573
Use latest ojp-shared-types
vasile Nov 12, 2025
065d330
npm fresh install
vasile Nov 12, 2025
30a9d8a
Use latest ojp-shared-types
vasile Nov 12, 2025
9aa451d
npm fresh install
vasile Nov 12, 2025
c54aed3
Use latest ojp-shared-types
vasile Nov 12, 2025
00ff4c2
npm fresh install
vasile Nov 12, 2025
25625c7
ptMode and exclude are now required
vasile Nov 12, 2025
fd89aef
Adds restricted RailSubmodeType
vasile Nov 13, 2025
f1eb0aa
Adds OJP_Types.OJPv1_LocationSchema support for Place init
vasile Nov 13, 2025
9b9274f
Adds method to update RailSubmode filter
vasile Nov 13, 2025
511ce9d
Adds RailSubmode filter example
vasile Nov 13, 2025
541436b
npm fresh install
vasile Nov 13, 2025
f3843d7
Updates CHANGELOG
vasile Nov 13, 2025
b1f9557
Bumps patch version
vasile Nov 13, 2025
876adeb
Updates README, ojp-shared-types latest version
vasile Nov 13, 2025
efd011c
Use latest ojp-shared-types
vasile Nov 13, 2025
2363610
npm fresh install
vasile Nov 13, 2025
c92bffc
Use latest ojp-shared-types
vasile Nov 13, 2025
0d92a48
npm fresh install
vasile Nov 13, 2025
b8a5ae4
Updates README
vasile Nov 13, 2025
9312f0f
Merge pull request #212 from openTdataCH/feature/ojp-sdk-next-updates
vasile Nov 13, 2025
463bdfd
Use latest ojp-shared-types
vasile Nov 13, 2025
7dad592
npm fresh install
vasile Nov 13, 2025
85acef3
fixed typo
vasile Nov 13, 2025
3e0b0af
Convert GeneralAttribute between versions
vasile Nov 13, 2025
d413896
Send also GeneralAttribute
vasile Nov 13, 2025
1eeac41
Bumps patch version
vasile Nov 13, 2025
8705f16
Updates to latest ojp-shared-types
vasile Nov 13, 2025
2b5b0b0
Updates CHANGELOG, links PR
vasile Nov 13, 2025
7208e86
Merge pull request #213 from openTdataCH/fix/ojp-v1-attribute
vasile Nov 13, 2025
ac34b60
adds prepare task so we can reference the Github branch
vasile Nov 14, 2025
9efc7d3
Merge branch 'feature/ojp-sdk-next' into feature/ojp-sdk-next-refacto…
vasile Nov 14, 2025
50dbc87
adds prepare task so we can reference the Github branch
vasile Nov 14, 2025
0880479
stand-alone request should be gone
vasile Nov 14, 2025
eb3c8b4
npm fresh install
vasile Nov 14, 2025
7d1fa4f
npm fresh install
vasile Nov 14, 2025
25ed1b8
Adds helper to set the railsubmodes
vasile Nov 14, 2025
b9cef26
Use default (2.0)
vasile Nov 14, 2025
035a5f5
Adds V2-INT SDK
vasile Nov 14, 2025
6a66d6c
Updates runTR_RailSubmodeFilter using new constructs
vasile Nov 14, 2025
85ff225
Protected constructors
vasile Nov 14, 2025
cc9541c
Compute RequestKey from builders
vasile Nov 14, 2025
d3cdc37
Adds enableTrackProjection method helper
vasile Nov 14, 2025
7f57211
Order
vasile Nov 15, 2025
5bf9b41
Export AnySDK
vasile Nov 15, 2025
2dcbc74
Export all Responses
vasile Nov 15, 2025
e816807
Export all Request classes
vasile Nov 15, 2025
b0cb55d
Default is '2.0'
vasile Nov 15, 2025
c168a69
Adds OJPv1 example
vasile Nov 15, 2025
33ce2a3
Adds InitWithMock example
vasile Nov 15, 2025
fd75341
Enforcing to always return T
vasile Nov 16, 2025
0c44c0f
Pass AnySDK
vasile Nov 16, 2025
d65b9a8
No need to pass version
vasile Nov 16, 2025
b6da580
No more need to pass version
vasile Nov 16, 2025
c3f87a4
Updates imports
vasile Nov 16, 2025
e87c5f0
Move the tag parser in XmlSerializer so can be reused from outside
vasile Nov 16, 2025
a691419
No more need for this, is legacy only
vasile Nov 16, 2025
2051846
Dont change already ALL_CAPITALS tag names
vasile Nov 16, 2025
cf22ff2
Better name (fixed also typo)
vasile Nov 16, 2025
436e0af
Conforms with PlaceSchema, adds attributes
vasile Nov 16, 2025
6ea45d3
No need to pass anyway undefined params, set them instead
vasile Nov 19, 2025
3c1596a
No need to pass anyway undefined params, set them instead
vasile Nov 19, 2025
591c840
No more need of this
vasile Nov 19, 2025
e4970c8
Fix strange typing issue: the payload.placeRef is of type OJPv1 Place…
vasile Nov 19, 2025
d7a4839
Adds helper to export OJPv1 PlaceRefSchema
vasile Nov 19, 2025
cc3601e
Better write of the hack
vasile Nov 19, 2025
97d0f61
IncludeAllRestrictedLines is only in v2, in v1 generates 4xx
vasile Nov 20, 2025
9988baf
Use OJPv1 request/response for SER
vasile Nov 20, 2025
91ac3e9
Propagate version so we have the correct params
vasile Nov 20, 2025
040b1ca
Actual params implementation
vasile Nov 20, 2025
13732f2
Adds OJPv1_StopEventRequestResponse
vasile Nov 20, 2025
1a6b980
Expose OJPv1_StopEventRequestResponse
vasile Nov 20, 2025
2a1750c
OJP v2 can use the requests directly
vasile Nov 20, 2025
363a38d
New line
vasile Nov 22, 2025
7003780
Use latest ojp-shared-types
vasile Nov 22, 2025
e0a9cf0
fresh install
vasile Nov 22, 2025
942266f
Bumps patch version
vasile Nov 22, 2025
10d44c6
Updates also the playground app packages
vasile Nov 22, 2025
43fd11c
Updates CHANGELOG
vasile Nov 22, 2025
b720997
Merge pull request #215 from openTdataCH/feature/ojp-sdk-next-updates
vasile Nov 22, 2025
46bf3fd
Use github branch for ojp-shared-types
vasile Nov 23, 2025
9c01200
Merge branch 'feature/ojp-sdk-next' into feature/ojp-sdk-next-refacto…
vasile Nov 23, 2025
0c8d179
Fixed typo
vasile Nov 23, 2025
328ae5e
Adds new parser code that is handling better the `#text` cases
vasile Nov 23, 2025
f994f65
Use new parser, remove old code
vasile Nov 23, 2025
b780b90
No more need for this, the issue doesnt occur anymore
vasile Nov 23, 2025
9a1807d
State that we use new minor + dev version
vasile Nov 23, 2025
93e12e9
ojp-shared-types is now declared as peer-dependency
vasile Nov 25, 2025
634c67d
Remove commented code
vasile Nov 25, 2025
8630366
Cleanup imports
vasile Nov 25, 2025
a641e98
Use latest ojp-shared-types package
vasile Nov 25, 2025
d5ffc4c
Use new minor version, switch to 0.21.1
vasile Nov 25, 2025
92fd2b9
Publish 0.21.x
vasile Nov 25, 2025
5e49c10
Updates README
vasile Nov 25, 2025
bb63f4b
Use latest ojp-shared-types
vasile Nov 25, 2025
b06f1c2
npm fresh install
vasile Nov 25, 2025
6198fff
Updates CHANGELOG
vasile Nov 25, 2025
fa8d794
Updates CHANGELOG
vasile Nov 25, 2025
4674f15
Merge pull request #210 from openTdataCH/feature/ojp-sdk-next-refacto…
vasile Nov 25, 2025
e2d319b
Updates TRR request params
vasile Jan 22, 2026
6709a12
Updates CHANGELOG
vasile Jan 22, 2026
08e4a6c
Use latest ojp-shared-types
vasile Jan 22, 2026
1bd1152
Bumps patch version
vasile Jan 22, 2026
5c193d2
npm fresh install
vasile Jan 22, 2026
081573e
Merge pull request #219 from openTdataCH/feature/updates-api
vasile Jan 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish ojp-sdk-next on npm

on:
push:
tags:
- '0.21.*'
# allow manual trigger
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'

- name: Sync lockfile
run: npm install --package-lock-only --ignore-scripts

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
lib
node_modules
/lib
153 changes: 153 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,158 @@
# CHANGELOG

## 0.21.2 - 22.01.2025
- updates API - [PR #219](https://github.com/openTdataCH/ojp-js/pull/219)
- updates TRR refine params
- use latest `ojp-shared-types`

## 0.21.1 - 25.11.2025
- refactor SDK - [PR #210](https://github.com/openTdataCH/ojp-js/pull/210)
- package
- bumps minor version to `0.21.x`
- declare `ojp-shared-types` as peerDependency
- SDK constructor is now private and uses generics to differentiate between OJP versions
- use `OJP.SDK.create()` to create a OJP 2.0 instance
- or `OJP.SDK.v1()` to create a OJP 1.0
- update requests
- refactor creation to allow a clear separation between OJP v1 and OJP v2, adds request per OJP version/request type
- old static inits are kept, however a new construct mode is recommended
```
const ojpSDK = OJP.SDK.create('my_requestor_ref', httpConfig, 'de');
const request = ojpSDK.requests.LocationInformationRequest.initWithLocationName('Bern');
// instead of
// const request = OJP.LocationInformationRequest.initWithLocationName('Bern');
```
- update requests (continued)
- requests dont conform to XSD schemas anymore, a property `.payload` is used for that
- updated requests, added LIR, SER for OJPv1
- request fetching + parsing is done now via `await request.fetchResponse(sdkInstance) call`
- see more changes in this [short gist](https://gist.github.com/vasile/40399cd2bb390ec7b9eb1fbbe52e5020)
- updates XML parser
- changed parser, improve handling of the `#text` nodes generated by `fast-xml-parser`
- requests dont conform to XSD schemas anymore, a property `.payload` is used for that, therefore no more need for the `MapModelKeepPropertiesXML` lookup hack in `ojp-shared-types` dependency

## 0.20.33 - 23.11.2025
- use latest `ojp-shared-types` - [PR #215](https://github.com/openTdataCH/ojp-js/pull/215)

## 0.20.32 - 13.11.2025
- Fix OJPv1 GeneralAttribute - [PR #213](https://github.com/openTdataCH/ojp-js/pull/213)
- use new OJP_Types `GeneralAttributeSchema`

## 0.20.31 - 13.11.2025
- Params Updates - [PR #212](https://github.com/openTdataCH/ojp-js/pull/212)
- TR - adds filter helper for `RailSubmode`
- Place - adds support for OJP v1 init, adds `initWithOJPv1XMLSchema` static initializer
- use latest `ojp-shared-types`
- TR restriction mode filter requires now `ptMode`, `personalMode` arrays

## 0.20.30 - 31.10.2025
- TR with IndividualTransportOption - [PR #205](https://github.com/openTdataCH/ojp-js/pull/205)
- adds `setMaxDurationWalkingTime`method for TR requests with longer walking (at origin / destination)
- adds Github workflow for npm publish automation

## 0.20.29 - 16.10.2025
- use latest `ojp-shared-types` - [PR #201](https://github.com/openTdataCH/ojp-js/pull/201)

## 0.20.28 - 26.09.2025
- use latest `ojp-shared-types` - [PR #200](https://github.com/openTdataCH/ojp-js/pull/200)

## 0.20.27 - 17.09.2025
- TR car filter - [add car routing support #190](https://github.com/openTdataCH/ojp-js/issues/190) - [PR #193](https://github.com/openTdataCH/ojp-js/pull/194)

## 0.20.26 - 01.09.2025
- use latest `ojp-shared-types` - [PR #193](https://github.com/openTdataCH/ojp-js/pull/193)

## 0.20.25 - 20.08.2025
- use latest `ojp-shared-types` - [PR #191](https://github.com/openTdataCH/ojp-js/pull/191)

## 0.20.24 - 08.07.2025
- use latest `ojp-shared-types` - [PR #189](https://github.com/openTdataCH/ojp-js/pull/189)

## 0.20.23 - 24.06.2025
- fix parsing order - [PR #185](https://github.com/openTdataCH/ojp-js/pull/185)

## 0.20.22 - 24.06.2025
- use latest `ojp-shared-types` - [PR #184](https://github.com/openTdataCH/ojp-js/pull/184)

## 0.20.21 - 12.06.2025
- LIR filter with PtMode - [PR #182](https://github.com/openTdataCH/ojp-js/pull/182)
- use latest `ojp-shared-types` package
- updates examples for PtMode filter (TR, LIR)

## 0.20.20 - 11.06.2025
- updates SDK - [PR #181](https://github.com/openTdataCH/ojp-js/pull/181)
- adds TRR, FareRequest initialisers with mock request / response
- adds tests for FareRequest

## 0.20.19 - 11.06.2025
- updates SDK - [PR #180](https://github.com/openTdataCH/ojp-js/pull/180)
- updates `ojp-shared-types` (TR params `walkSpeed`)

## 0.20.18 - 06.06.2025
- Improve serialising - [PR #178](https://github.com/openTdataCH/ojp-js/pull/178)
- improve internal `buildXML`, adds `XmlSerializer` for outside SDK serialising objects to XML
- harmonise FareRequest response, adds `fetchFareRequestResponse` with `FareDeliverySchema`
- remove `Trip.rawXML` property
- updates playground associated app

## 0.20.17 - 02.06.2025
- harmonise SDK Response - [PR #171](https://github.com/openTdataCH/ojp-js/pull/171)
- harmonise SDK response, use `Promise<OJP_Response<OJP_Types.(LIR | TR | SER TIR), Error>>` response type
- deprecate older methods (i.e. the ones fetching individual Trip[])
- adds tests for SIRI-SX situation models

## 0.20.16 - 29.05.2025
- adds TripInfoRequest request / response - [PR #170](https://github.com/openTdataCH/ojp-js/pull/170)
- dynamically build `MapParentArrayTags`, dont rely on `ojp-shared-types` package

## 0.20.15 - 27.05.2025
- save raw XML for `Trip` - [PR #169](https://github.com/openTdataCH/ojp-js/pull/169)

## 0.20.14 - 14.05.2025
- export `RequestInfo`

## 0.20.13 - 13.05.2025
- (re-)adds FareRequest - [PR #167](https://github.com/openTdataCH/ojp-js/pull/167)

## 0.20.11 - 13.05.2025
- use [ojp-shared-types](https://github.com/openTdataCH/ojp-shared-types) package - [PR #166](https://github.com/openTdataCH/ojp-js/pull/166)

## 0.20.10 - 17.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- [Adds TripRefinementRequest #151](https://github.com/openTdataCH/ojp-js/pull/151)
- TR - [Feature/trip response status #152](https://github.com/openTdataCH/ojp-js/pull/152)
- TRR TripParam - [Updates TRR #153](https://github.com/openTdataCH/ojp-js/pull/153)

## 0.20.8 - 15.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- [Fix LIR models (Place.Mode) #148](https://github.com/openTdataCH/ojp-js/pull/148)

## 0.20.7 - 14.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- fixed JSON (xml-parsed) traverse, catch case for expected empty arrays

## 0.20.5 - 13.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- use dual builds (CommonJS and ESM) via `tsup`

## 0.20.4 - 12.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- revert to use CJS module style

## 0.20.3 - 12.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- use NodeNext, ESM style
- more robust NS parsing

## 0.20.2 - 01.04.2025
- refactor/next version of the SDK (continued) - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)

## 0.20.1 - 26.03.2025
- refactor/next version of the SDK - [PR #139](https://github.com/openTdataCH/ojp-js/pull/139)
- OJP 2.0 APIs is now used
- [XSD schema](https://vdvde.github.io/OJP/develop/documentation-tables/ojp.html) is used for models
- bundle OJP demo app in [examples/ojp-demo-app](./examples/ojp-demo-app)

## 0.16.3 - 14.03.2025
- internal change, refactor params/request implementation - [PR #137](https://github.com/openTdataCH/ojp-js/pull/137)
- adds hack for OJP-SI to allow Trip nodes without Transfer children node - [PR #138](https://github.com/openTdataCH/ojp-js/pull/138)
Expand Down
116 changes: 85 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,112 @@

The OJP Javascript SDK is a Javascript/Typescript package used for communication with [OJP APIs](https://opentransportdata.swiss/en/cookbook/open-journey-planner-ojp/).

See [Reference](./docs/reference.md) and [examples](./examples/) for usage.
## Current Development Status

Javascript SDK branches

| Branch | NPM | Demo App | Description |
|-|-|-|-|
| [ojp-js#ojp-sdk-legacy](https://github.com/openTdataCH/ojp-js/tree/feature/ojp-sdk-legacy) | [ojp-sdk-legacy](https://www.npmjs.com/package/ojp-sdk-legacy) | <ul><li>[PROD - OJP 2.0](https://opentdatach.github.io/ojp-demo-app/search)</li><li>[BETA - OJP 1.0](https://tools.odpch.ch/beta-ojp-demo/search)</li></ul> | original SDK, contains dual code for OJP `1.0`,`2.0` |
| [ojp-js#ojp-sdk-next](https://github.com/openTdataCH/ojp-js/tree/feature/ojp-sdk-next) | [ojp-sdk-next](https://www.npmjs.com/package/ojp-sdk-next) - temporarely, long-term will be published under `ojp-sdk` | under development | new SDK code with models derived from XSD schema, this will be the main development reference for OJP JS SDK |

Code / Demo App Implementation

| Code Place | LIR | SER | TR | TIR | FR | TRR | Comments |
| - | - | - | - | - | - | - | - |
| `ojp-sdk-legacy` (legacy SDK) | :white_check_mark: | :white_check_mark: | :white_check_mark: | - | - | - | TRR is only available for OJP v2.0 |
| `ojp-sdk-next` (new SDK) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
| DemoApp Beta | `legacy` | `legacy` | `legacy` | `ojp-sdk-next` | `ojp-sdk-next` | `ojp-sdk-next` | `legacy` is the old SDK (OJP v1 and v2, see above) |

- LIR - LocationInformationRequest
- SER - StopEventRequest
- TR - TripRequest
- TIR - TripInfoRequest
- FR - FareRequest
- TRR - TripRefineRequest

## Resources

- OJP Demo App: https://opentdatach.github.io/ojp-demo-app/ - web application this SDK
- OJP Demo App: https://opentdatach.github.io/ojp-demo-app/ - web application using this SDK
- [CHANGELOG](./CHANGELOG.md) for latest changes
- npm `ojp-sdk` package: https://www.npmjs.com/package/ojp-sdk

## Install

Two versions of the OJP APIs can be used:
- [OJP 1.0](https://opentransportdata.swiss/en/cookbook/open-journey-planner-ojp/) - still supported by `ojp-js` SDK but might receive less support in the future
- [OJP 2.0](https://opentransportdata.swiss/de/cookbook/ojp2entwicklung/) - next version, see [VDVde/OJP](https://github.com/VDVde/OJP/blob/changes_for_v1.1/README.md) specs
## Usage

### OJP 1.0
The main branch of `ojp-js` repo is using OJP 1.0 APIs. The releases are published to [npmjs.com](https://www.npmjs.com/package/ojp-sdk) as `ojp-sdk` packages.
**Note:** 26.Mar - a different package name is used for test purpose: `ojp-sdk-next`. This package will replace the current `ojp-sdk` package.

- include the `ojp-sdk` package in the `./package.json` dependencies of your project
- include [ojp-sdk-next](https://www.npmjs.com/package/ojp-sdk-next), [ojp-shared-types](https://www.npmjs.com/package/ojp-shared-types) packages in the `./package.json` dependencies of the project
```
"dependencies": {
"ojp-sdk": "0.16.3"
"ojp-shared-types": "0.1.2",
"ojp-sdk-next": "0.21.2",
}
```

### OJP 2.0
The [ojp-v2](https://github.com/openTdataCH/ojp-js/tree/feature/ojp-v2) branch is used for developing [OJP 2.0](https://opentransportdata.swiss/de/cookbook/ojp2entwicklung/) bindings,
- include the `#ojp-v2` branch
```
"dependencies": {
"ojp-sdk": "git+https://github.com/openTdataCH/ojp-js.git#feature/ojp-v2"
}
```
- get an API key from [opentransportdata.swiss](https://api-manager.opentransportdata.swiss/) API manager

## Usage
- use the SDK, see also [playground.component.ts](./examples/ojp-playground/src/app/playground/playground.component.ts) in examples

- update project dependencies
```
$ npm install
```
import * as OJP from 'ojp-sdk-next';

- include OJP SDK in the Typescript / Javascript code
```
import * as OJP from 'ojp-sdk'
// ...

// declare the stage config, PROD example below
const httpConfig: OJP.HTTPConfig = {
url: 'https://api.opentransportdata.swiss/ojp20',
authToken: 'TOKEN_FROM_opentransportdata.swiss',
};

// define a requestorRef that describes the client
const requestorRef = 'MyExampleTransportApp.v1';

// create the SDK
const language = 'de'; // de, fr, it, en
const ojpSDK = OJP.SDK.create(requestorRef, httpConfig, language);

// build LIR by Name
const searchTerm = 'Bern';
const request1 = ojpSDK.requests.LocationInformationRequest.initWithLocationName('Bern');

// build LIR by StopRef
const stopRef = '8507000'; // Bern
const request2 = ojpSDK.requests.LocationInformationRequest.initWithPlaceRef(stopRef);

// build LIR by BBOX
// these are equivalent
let bbox: string | number[] = '7.433259,46.937798,7.475252,46.954805';
bbox = [7.433259, 46.937798, 7.475252, 46.954805];

const request3 = ojpSDK.requests.LocationInformationRequest.initWithBBOX(bbox, ['stop']);

// change XML payload if needed
request1.payload.initialInput ...

// fetch the results
async myMethod() {
// ...
const response = await request1.fetchResponse(ojpSDK);

if (!response.ok) {
// handle error
console.log(response.error);
return;
}

// do something with the value
const placeResults = response.value.placeResult ?? [];
placeResults.forEach(placeResult => {
console.log(placeResult.place.name);
});
}
```

- for more details check:
- this repo [reference](./docs/reference.md)
- this repo [examples](./examples/)
- [OJP Demo App](https://github.com/openTdataCH/ojp-demo-app-src) source code
TBA
- update [docs](./docs/)

## License

The project is released under a [MIT license](./LICENSE).

Copyright (c) 2021 - 2024 Open Data Platform Mobility Switzerland - [opentransportdata.swiss](https://opentransportdata.swiss/en/).
Copyright (c) 2021 - 2025 Open Data Platform Mobility Switzerland - [opentransportdata.swiss](https://opentransportdata.swiss/en/).
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# OJP JS SDK Documentation

WIP, old pages below

----

- [Architecture](./architecture.md)
- [Reference](./reference.md)
Loading