@eristack/idempotency
Version:
Idempotency-Key guard with Drizzle store, scoped keys, lease, Express/Nest/client adapters
27 lines (19 loc) • 822 B
Markdown
# Getting started
```bash
pnpm add /idempotency
```
```ts
import {
createIdempotencyGuard,
createMemoryIdempotencyStore,
} from "@eristack/idempotency";
const store = createMemoryIdempotencyStore(); // tests only — use Drizzle in prod
const guard = createIdempotencyGuard(store);
await guard.run("pay-1", async () => chargePayment());
```
Production path, ledger dedup, outbox, and PO UNIQUE: one guide — load `/ai-knowledge#idempotency-and-outbox` (`knowledge/idempotency-and-outbox.md`).
## Adapters
- `/idempotency/drizzle` — `createIdempotencyTables`, `createDrizzleIdempotencyStore`
- `/idempotency/express` — `wrapIdempotentHandler`
- `/idempotency/client` — `createIdempotencyClientFetch`
- `/idempotency/nest` — `IdempotencyInterceptor`