npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fairnight-beds24

v0.2.1

Published

Beds24 connector for Fairnight: read rooms and bookings, write nightly prices and minimum stays through the official API v2 (refresh token, credit-aware).

Readme

fairnight-beds24

The Beds24 connector of Fairnight. Hosts use it through the fairnight beds24 commands of fairnight-cli. This package is the library underneath.

Built only from Beds24's public documentation: the API V2.0 wiki and the OpenAPI spec at beds24.com/api/v2. No scraping, and no dependencies besides the Fairnight engine's types. It uses Node's own fetch.

What it does

  • Authenticates.
    • It turns an invite code into a refresh token (GET /authentication/setup).
    • It gets short tokens from it (GET /authentication/token), with the lifetime from expiresIn.
    • It renews them when less than 2 minutes are left, and once, at once, after a 401 in the middle of a run.
    • It can reuse a token saved by a previous run.
  • Watches the credits:
    • it reads X-FiveMinCreditLimit, -Remaining, -ResetsIn and X-RequestCost (also in the wiki's x-five-min-limit-* spelling);
    • it never uses more than half of the 5-minute window;
    • on 429 it waits for the window to reset, plus one second;
    • 5xx are retried after 1, 2, 4 and 8 seconds;
    • 400 and the rest stop with Beds24's message.
  • Reads rooms (GET /properties?includeAllRooms=true), bookings (GET /bookings, every page) and the calendar (GET /inventory/rooms/calendar, expanded night by night).
  • Writes (POST /inventory/rooms/calendar) only the chosen price field and minStay, one element per write. It reports the answer of each element.
  • Plans a push (planPush, buildWrites) and maps bookings (mapBookings):
    • confirmed, new and request are bookings;
    • black is blocked;
    • cancelled is removed;
    • inquiry is ignored.

No token ever appears in an error message.

Tests

Every test runs against a fake Beds24 server on 127.0.0.1. It follows the spec's shapes and reproduces:

  • tokens that expire;
  • credits that run out (429 with ResetsIn);
  • paginated bookings;
  • calendar runs;
  • 201 answers with errors for some elements.

No test ever calls the real Beds24.

License

AGPL-3.0-only. See LICENSE.