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

@mizunashi/api-client

v1.0.0

Published

水無海浜温泉 入浴可能時間 API の薄いクライアント(非公式)

Readme

@mizunashi/api-client

函館市 水無海浜温泉 の入浴可能時間 API(非公式)の薄いクライアントです。

標準の fetch だけを使うので、ブラウザ / Node / Cloudflare Workers / Deno で同じコードが動きます。CJS と ESM の両方に対応しています。

npm install @mizunashi/api-client

使い方

import { MizunashiClient } from '@mizunashi/api-client';

const client = new MizunashiClient({ baseUrl: 'https://example.com' });

const { data, receivedAt, ageSeconds } = await client.status();

if (data.state === 'open') {
  console.log(`${data.current?.end} まで入浴できます`);
} else if (data.nextToday != null) {
  console.log(`次は今日 ${data.nextToday.start} から`);
} else if (data.next != null) {
  console.log(`本日は終了。次は ${data.next.date} ${data.next.start} から`);
}

期間ビュー

4 種とも同じ形が返るので、1 つのレンダラで扱えます。

await client.day('today');
await client.day('2026-07-26');
await client.week('today');        // 指定日から 7 日間(暦週に丸めない)
await client.month(2026, 7);       // 1 日から最終日まで
await client.year('current');
await client.range('2026-07-26', '2026-08-01');

年の切替

const { data } = await client.years();
// data.activeYears が 2 件以上なら来年の時間表が公開されている

エラー

problem+jsonMizunashiApiError として投げます。

import { MizunashiApiError } from '@mizunashi/api-client';

try {
  await client.range('2026-01-01', '2028-01-01');
} catch (err) {
  if (err instanceof MizunashiApiError) {
    console.error(err.status, err.type, err.detail);
  }
}

静的バリアント

at: 'none' を渡すと、現在時刻に依存する relative を省いた共有キャッシュ可能なレスポンスになります。相対的な情報が要らない場合や、自前で計算する場合に使ってください。

const { data } = await client.month(2026, 7, { at: 'none' });

オプション

new MizunashiClient({
  baseUrl,          // 既定は公式ホスト
  fetch: myFetch,   // 差し替え可能。テストのフェイクをそのまま渡せる
  timeoutMs: 10000,
  userAgent,        // 連絡先を入れておくと運営側から辿れる
});

各メソッドは AbortSignal を受け取れます。

意図的に持たない機能

リトライのバックオフ戦略、永続キャッシュ、React フック、日時の書式整形は入れていません。利用者ごとに要件が違い、薄さという価値を壊すためです。必要なら呼び出し側で組み合わせてください。

受信時刻について

レスポンスは { data, receivedAt, ageSeconds } の形で返ります。data.meta.servedAtorigin がペイロードを生成した時刻なので、共有キャッシュを経由すると最大でキャッシュの有効期間だけ古くなります。正確な受信時刻が必要なときは receivedAt(クライアントの時計)か ageSeconds(HTTP の Age ヘッダ)を使ってください。

なお、現在時刻に依存する値を含むレスポンスはサーバ側で共有キャッシュを禁止しているため、通常 ageSecondsnull になります。

著者

otoneko. https://github.com/otnc

ライセンス

MIT