Thanks for helping. Bug reports, fixes and docs improvements are all welcome. For a change to the public API, open an issue first so we can agree on the shape before you write it.
Using the package needs Node 20.19 or later (or Bun, Deno or an edge runtime); developing it needs Node 22.12 or later.
git clone https://github.com/FlightByte-dev/flightbyte-node.git
cd flightbyte-node
npm ci
npm testThe tests never touch the real API and need no key.
npm run check # typecheck, lint, test and buildCI runs the same checks on Node 22 and 24, checks the packed package with publint and attw, and runs the build on Node 20.19, Bun and Deno. A pull request needs all of it green.
src/uses web-standard APIs only:fetch,Request,Response,crypto.subtle,AbortSignal,TextEncoder. The build cannot see Node's types and ESLint rejectsnode:imports there, so the package keeps running on Bun, Deno and the edge.- Everything exported has a TSDoc comment. It shows in editors and on npm.
- Every change has a test. Requests go through a fake
fetch(seetest/helpers/mock.ts), never to the network. - No runtime dependencies. Keep it that way unless an issue agrees otherwise.
- Add a line to
CHANGELOG.mdunder a## Unreleasedheading for anything a user would notice.
The types mirror the API's OpenAPI document, and test/spec.test.ts checks them against a copy of it in spec/openapi.json. Refresh that copy and see what changed:
npm run sync:openapi
npm test- The API adds a field: add it to the interface in
src/models.ts. A field the API may leave out is optional; one it may send asnullincludesnull. The spec test fails until you do, and fails if a field has no place in the document unless it is listed, with the reason, inUNDOCUMENTED_FIELDS. - The API adds an enum value (a phase, status, change type or event type): add it to its list in
src/models.ts. Until then the value is still a valid string, which is why nothing breaks for users in the meantime. - The API adds an error code or status: map it in
src/errors.tsand add a case totest/errors.test.ts. - The API adds an endpoint: add a method to the resource in
src/resources/, a line toCALLSintest/spec.test.ts, a test intest/resources.test.ts, and a row to the README's API tables.
test/fixtures/webhook_vectors.json holds signatures made with Node's createHmac, exactly as the API signs deliveries, so the Web Crypto verifier is checked against the server and not only against itself. Do not edit those files by hand. To regenerate them, for example after adding a case to the script:
node tool/webhook_vectors.mjsOne line that says what changed and why it matters, in plain words, for example Subscriptions can be listed by origin airport. Add a body when the reason is not obvious from the diff.
Maintainers only.
- Set
versioninpackage.jsonandVERSIONinsrc/version.ts; a test fails if they differ. - Rename
## UnreleasedinCHANGELOG.mdto the new version. - Push a tag
v<version>, for examplev1.0.1.
The release workflow checks that the tag, package.json and src/version.ts agree and that the changelog has the section, runs every check, publishes to npm with trusted publishing unless that version is already there, and creates the GitHub release from the version's CHANGELOG.md section. To rehearse a release without publishing anything, run the workflow by hand from the Actions tab.
A version on npm can never be republished, even after an unpublish. Fix a bad release with a new version.
By contributing you agree that your contributions are licensed under the MIT License.