
Security News
Node.js Considers Public Workflow for Security Reports Amid AI-Driven Surge
Node.js is debating whether AI-driven security report volume warrants moving more vulnerability reports into public workflows.
@oncely/next
Advanced tools
Next.js integration for oncely idempotency.
npm install @oncely/core @oncely/next
// app/api/orders/route.ts import { next } from '@oncely/next';
export const POST = next()(async (req) => { const body = await req.json(); return Response.json(await createOrder(body), { status: 201 }); });
// With options export const POST = next({ required: true, ttl: '1h', })(handler);
// pages/api/orders.ts import { pages } from '@oncely/next/pages';
export default pages()(async (req, res) => { res.status(201).json(await createOrder(req.body)); });
import { configure } from '@oncely/next'; import { upstash } from '@oncely/upstash';
export const idempotent = configure({ storage: upstash(), ttl: '1h', });
// Usage export const POST = idempotent()(handler);
Request: Idempotency-Key Response: Idempotency-Key, Idempotency-Replay (on cache hit)
MIT }
const result = await idempotency.run({
key,
hash: hashObject(body),
handler: () => handler(req, ctx, body),
});
return result.data;
}
return handler(req, ctx, body);
}; }
## Pages Router
```typescript
// pages/api/orders.ts
import { oncely } from "oncely-next/pages";
import { memory } from "oncely";
export default oncely(
async (req, res) => {
const order = await createOrder(req.body);
res.status(201).json(order);
},
{ storage: memory },
);
// lib/idempotency.ts
import { configure } from 'oncely-next/pages';
import { ioredis } from 'oncely-redis';
export const oncely = configure({
storage: ioredis({ client: redis }),
ttl: '24h',
});
// pages/api/orders.ts
import { oncely } from '@/lib/idempotency';
export default oncely(async (req, res) => {
const order = await createOrder(req.body);
res.status(201).json(order);
});
oncely(handler, {
// Required
storage: StorageAdapter,
// Optional
keyHeader: 'Idempotency-Key', // Header name (default: 'Idempotency-Key')
required: false, // Require key? (default: false)
responseHeaders: true, // Add idempotency headers to response
ttl: '24h', // Key expiration
debug: false, // Enable debug logging
// Custom hash function
hashRequest: async (req) => hashObject(await req.json()),
// Callbacks
onHit: (key) => {},
onMiss: (key) => {},
onError: (key, err) => {},
});
When responseHeaders is enabled (default), responses include:
Idempotency-Key: <key>
Idempotency-Status: hit | created
Idempotency-Created: <ISO timestamp> (on cache hit)
Retry-After: <seconds> (on 409 conflict)
MIT
FAQs
Next.js integration for oncely idempotency
The npm package @oncely/next receives a total of 0 weekly downloads. As such, @oncely/next popularity was classified as not popular.
We found that @oncely/next 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
Node.js is debating whether AI-driven security report volume warrants moving more vulnerability reports into public workflows.

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.