
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@idempotix/client
Advanced tools
Client-side idempotency helpers for browser and frontend applications
Client-side utilities for idempotency key generation and response handling.
npm install @idempotix/client
import { generateKey } from '@idempotix/client';
const response = await fetch('/api/orders', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Idempotency-Key': generateKey(),
},
body: JSON.stringify(order),
});
import { generateKey, generatePrefixedKey, createKeyGenerator } from '@idempotix/client';
// UUID v4
const key = generateKey();
// => '550e8400-e29b-41d4-a716-446655440000'
// Prefixed UUID
const key = generatePrefixedKey('ord');
// => 'ord_550e8400-e29b-41d4-a716-446655440000'
// Deterministic key from components
const key = generateKey('user', userId, 'create-order');
// => 'f8e9b4a2' (consistent hash for same inputs)
// Key generator namespace
const key = createKeyGenerator();
key(); // UUID
key('a', 'b', 'c'); // Deterministic hash
key.prefixed('txn'); // Prefixed UUID
Track pending requests to prevent duplicate submissions:
import { createStore } from '@idempotix/client';
const store = createStore({
prefix: 'Idempotix:',
ttl: '5m',
storage: localStorage,
});
// Mark request as pending
store.pending('key-123');
// Check if request is pending
if (store.isPending('key-123')) {
throw new Error('Request already in progress');
}
// Mark as completed
store.complete('key-123');
// Clear a specific key
store.clear('key-123');
// Clear all Idempotix keys
store.clearAll();
import { isReplay, isConflict, isMismatch, getRetryAfter } from '@idempotix/client';
const response = await fetch('/api/orders', { ... });
// Check if response was served from cache
if (isReplay(response)) {
console.log('Cached response');
}
// Handle 409 Conflict
if (isConflict(response)) {
const seconds = getRetryAfter(response);
await delay(seconds * 1000);
// Retry with same key...
}
// Handle 422 Mismatch
if (isMismatch(response)) {
// Key was reused with different body - generate new key
}
import ky from 'ky';
import { generateKey, IDEMPOTENCY_KEY_HEADER } from '@idempotix/client';
const api = ky.extend({
hooks: {
beforeRequest: [
(request) => {
if (['POST', 'PUT', 'PATCH'].includes(request.method)) {
request.headers.set(IDEMPOTENCY_KEY_HEADER, generateKey());
}
},
],
},
});
import axios from 'axios';
import { generateKey, IDEMPOTENCY_KEY_HEADER } from '@idempotix/client';
const api = axios.create();
api.interceptors.request.use((config) => {
if (['post', 'put', 'patch'].includes(config.method ?? '')) {
config.headers[IDEMPOTENCY_KEY_HEADER] = generateKey();
}
return config;
});
import { IDEMPOTENCY_KEY_HEADER, IDEMPOTENCY_REPLAY_HEADER } from '@idempotix/client';
IDEMPOTENCY_KEY_HEADER; // 'Idempotency-Key'
IDEMPOTENCY_REPLAY_HEADER; // 'Idempotency-Replay'
MIT
FAQs
Client-side idempotency helpers for browser and frontend applications
The npm package @idempotix/client receives a total of 6 weekly downloads. As such, @idempotix/client popularity was classified as not popular.
We found that @idempotix/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.