@nwire/handler 0.7.0 → 0.7.1

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.
Files changed (2) hide show
  1. package/README.md +0 -28
  2. package/package.json +8 -6
package/README.md CHANGED
@@ -12,29 +12,6 @@
12
12
  pnpm add @nwire/handler
13
13
  ```
14
14
 
15
- ## Standalone use
16
-
17
- For developers who want a portable operation primitive without pulling in the rest of Nwire. Define a handler once, run it from anywhere.
18
-
19
- ```ts
20
- import { defineHandler, execute, ok } from "@nwire/handler";
21
- import { z } from "zod";
22
-
23
- const createUser = defineHandler("createUser", {
24
- input: z.object({ email: z.string().email() }),
25
- handler: async ({ input }) => ok({ id: crypto.randomUUID(), email: input.email }),
26
- });
27
-
28
- // Run it directly:
29
- const res = await execute(createUser, { email: "a@b.co" });
30
-
31
- // Or mount in Express:
32
- app.post("/users", async (req, res) => {
33
- const out = await execute(createUser, req.body);
34
- res.status(out.status).json(out.body);
35
- });
36
- ```
37
-
38
15
  ## Within nwire-app
39
16
 
40
17
  For developers using this package as part of the Nwire stack. Every Nwire transport (`@nwire/http`, `@nwire/queue`, `@nwire/mcp`) speaks this exact shape; `@nwire/forge`'s `defineAction` / `defineQuery` are flavored sugar over `defineHandler`.
@@ -57,8 +34,3 @@ const api = httpInterface("api").wire(post("/users", createUser));
57
34
  - `execute(handler, input, ctx?)` — run one; returns a response envelope.
58
35
  - `defineResource(...)` / `defineError(...)` — REST resource + typed error definitions.
59
36
  - Response factories: `ok` / `created` / `accepted` / `noContent` / `notFound` / etc.
60
-
61
- ## See also
62
-
63
- - [Architecture sketch §08 — Handler, the operation](../../architecture-sketch.html#handler)
64
- - Sibling packages: [@nwire/hooks](../nwire-hooks), [@nwire/interface](../nwire-interface), [@nwire/http](../nwire-http)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nwire/handler",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Nwire — the operation primitive. defineHandler / defineError / defineResource / defineMiddleware / pipe / response factories / typed framework errors. Standalone — depend on this without pulling forge. Every transport (HTTP, queue, MCP, …) speaks the same handler shape.",
5
5
  "keywords": [
6
6
  "execute",
@@ -8,9 +8,11 @@
8
8
  "nwire",
9
9
  "operation"
10
10
  ],
11
+ "license": "MIT",
11
12
  "files": [
12
13
  "dist",
13
- "README.md"
14
+ "README.md",
15
+ "LICENSE"
14
16
  ],
15
17
  "type": "module",
16
18
  "main": "./dist/handler-index.js",
@@ -26,10 +28,10 @@
26
28
  },
27
29
  "dependencies": {
28
30
  "zod": "^4.0.0",
29
- "@nwire/container": "0.7.0",
30
- "@nwire/envelope": "0.7.0",
31
- "@nwire/logger": "0.7.0",
32
- "@nwire/messages": "0.7.0"
31
+ "@nwire/container": "0.7.1",
32
+ "@nwire/envelope": "0.7.1",
33
+ "@nwire/logger": "0.7.1",
34
+ "@nwire/messages": "0.7.1"
33
35
  },
34
36
  "devDependencies": {
35
37
  "@types/node": "^22.19.9",