@vyriy/smoke 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vyriy contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @vyriy/smoke
2
+
3
+ Smoke request matcher for Vyriy projects.
4
+
5
+ ## Purpose
6
+
7
+ This package provides a small helper for recognizing a dedicated smoke request and returning a predefined response without running the main handler logic.
8
+
9
+ It is intended to be used directly or through packages such as `@vyriy/handler`.
10
+
11
+ ## Install
12
+
13
+ With npm:
14
+
15
+ ```bash
16
+ npm install @vyriy/smoke
17
+ ```
18
+
19
+ With Yarn:
20
+
21
+ ```bash
22
+ yarn add @vyriy/smoke
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ Use the default smoke request and response:
28
+
29
+ ```ts
30
+ import { smoke } from '@vyriy/smoke';
31
+
32
+ const result = smoke({ isSmoke: true });
33
+
34
+ if (result) {
35
+ return result;
36
+ }
37
+ ```
38
+
39
+ ## API
40
+
41
+ - `request`
42
+ Default smoke request payload: `{ isSmoke: true }`.
43
+
44
+ - `response`
45
+ Default smoke response payload: `{ status: 'success' }`.
46
+
47
+ - `smoke(event)`
48
+ Returns the smoke response when `event` matches the smoke request, otherwise returns `false`.
49
+
50
+ ## Notes
51
+
52
+ - matching is performed by comparing `JSON.stringify(event)` and `JSON.stringify(request)`
53
+ - if property order differs, objects that are otherwise structurally equal may not match
54
+ - the helper is best suited for small, stable smoke payloads
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './smoke.js';
2
+ export type * from './types.js';
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './smoke.js';
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@vyriy/smoke",
3
+ "version": "0.1.9",
4
+ "description": "Smoke request matcher for short-circuiting handlers in Vyriy projects",
5
+ "type": "module",
6
+ "main": "./index.js",
7
+ "license": "MIT",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./index.d.ts",
12
+ "import": "./index.js",
13
+ "default": "./index.js"
14
+ },
15
+ "./index": {
16
+ "types": "./index.d.ts",
17
+ "import": "./index.js",
18
+ "default": "./index.js"
19
+ },
20
+ "./index.js": {
21
+ "types": "./index.d.ts",
22
+ "import": "./index.js",
23
+ "default": "./index.js"
24
+ },
25
+ "./smoke": {
26
+ "types": "./smoke.d.ts",
27
+ "import": "./smoke.js",
28
+ "default": "./smoke.js"
29
+ },
30
+ "./smoke.js": {
31
+ "types": "./smoke.d.ts",
32
+ "import": "./smoke.js",
33
+ "default": "./smoke.js"
34
+ }
35
+ }
36
+ }
package/smoke.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { Request, Response, Smoke } from './types.js';
2
+ export declare const request: Request;
3
+ export declare const response: Response;
4
+ export declare const smoke: Smoke;
package/smoke.js ADDED
@@ -0,0 +1,8 @@
1
+ export const request = { isSmoke: true };
2
+ export const response = { status: 'success' };
3
+ export const smoke = (event) => {
4
+ if (JSON.stringify(event) === JSON.stringify(request)) {
5
+ return response;
6
+ }
7
+ return false;
8
+ };
package/types.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type Request = Record<string, unknown>;
2
+ export type Response = Record<string, unknown>;
3
+ export type Smoke = (event: unknown) => Response | false;