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

@sweidos/next

v2.0.0

Published

Next.js Server Actions integration for Eidos action() — neverLose wrapper, idempotency context for Server Action bodies.

Downloads

224

Readme

@sweidos/next

Next.js Server Actions integration for @sweidos/eidos action(). Server Actions are the canonical "don't lose this write" case — this package wraps them with neverLose queueing/replay by default and gives the Server Action body a typed way to read the idempotencyKey/attempt that action() threads through on every call.

Install

npm install @sweidos/next

Usage

// app/orders/actions.ts
'use server';

import type { ActionContext } from '@sweidos/eidos';
import { getActionContext, idempotencyHeaders } from '@sweidos/next';

export async function createOrderRaw(input: { amount: number }, _ctx?: ActionContext) {
  const ctx = getActionContext(arguments);

  const res = await fetch('https://api.example.com/orders', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...(ctx ? idempotencyHeaders(ctx) : {}) },
    body: JSON.stringify(input),
  });
  if (!res.ok) throw res;
  return res.json();
}
// app/orders/client-actions.ts
'use client';

import { serverAction } from '@sweidos/next';
import { createOrderRaw } from './actions';

export const createOrder = serverAction(createOrderRaw, {
  name: 'createOrder',
  namespace: 'orders',
});

Call createOrder(input) from a Client Component — offline, it's queued in IndexedDB with a stable idempotencyKey and replayed on reconnect, with the same key on every retry.

API

serverAction(fn, config)

Thin wrapper around action(). config.name is required and combined with config.namespace into the registered actionId (namespace::name), so two Server Actions named the same in different routes don't collide. reliability defaults to 'neverLose' — pass reliability: 'best-effort' to opt out.

getActionContext(args)

Recovers the trailing ActionContext ({ idempotencyKey, attempt, signal? }) action() appends to every call — pass arguments or an args array from inside the Server Action body. Returns undefined if the action wasn't invoked through action() (e.g. called directly in a test).

idempotencyHeaders(ctx)

Maps an ActionContext to { 'Idempotency-Key', 'Idempotency-Attempt' } headers for forwarding to a downstream API guarded by @sweidos/server-idempotency.

License

MIT