@vyriy/smoke
v0.8.7
Published
Smoke request matcher for short-circuiting handlers in Vyriy projects
Readme
@vyriy/smoke
Part of Vyriy - a calm architecture toolkit for TypeScript, React, SSR, SSG, APIs, and cloud-ready apps.
Full documentation: https://vyriy.dev/docs/smoke/
Smoke request matcher for Vyriy projects.
Purpose
This package provides a small helper for recognizing a dedicated smoke request and returning a predefined response without running the main handler logic.
It is intended to be used directly or through packages such as @vyriy/handler.
Install
With npm:
npm install @vyriy/smokeWith Yarn:
yarn add @vyriy/smokeUsage
Use the default smoke request and response:
import { smoke } from '@vyriy/smoke';
const result = smoke({ isSmoke: true });
if (result) {
return result;
}API
requestDefault smoke request payload:{ isSmoke: true }.responseDefault API Gateway-compatible smoke response:
{
statusCode: 200,
body: JSON.stringify({
status: 'success',
}),
}smoke(event)Returns the smoke response wheneventmatches the smoke request, otherwise returnsfalse.
Notes
- matching checks whether the incoming event is an object with
isSmoke: true - the helper is best suited for small, stable smoke payloads
