@nwire/envelope 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.
- package/README.md +0 -25
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -12,26 +12,6 @@
|
|
|
12
12
|
pnpm add @nwire/envelope
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## Standalone use
|
|
16
|
-
|
|
17
|
-
For developers who want a tiny correlation-id / causation-chain primitive in any TS app — no Nwire dependency required.
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { seedEnvelope, deriveEnvelope } from "@nwire/envelope";
|
|
21
|
-
|
|
22
|
-
// At the edge — seed a new envelope for an incoming request
|
|
23
|
-
const root = seedEnvelope({
|
|
24
|
-
source: "http",
|
|
25
|
-
tenant: "acme",
|
|
26
|
-
userId: req.userId,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// Inside a handler — derive a child envelope for the next message
|
|
30
|
-
const child = deriveEnvelope(root, { source: "queue" });
|
|
31
|
-
// child.correlationId === root.correlationId (same chain)
|
|
32
|
-
// child.causationId === root.messageId (parent reference)
|
|
33
|
-
```
|
|
34
|
-
|
|
35
15
|
## Within nwire-app
|
|
36
16
|
|
|
37
17
|
For developers using this package as part of the Nwire stack. Already transitively present in every layer; you usually read `ctx.envelope` inside a handler. Touch this package directly when writing a custom transport or bus adapter that must construct envelopes.
|
|
@@ -52,8 +32,3 @@ defineAction("recordWash", {
|
|
|
52
32
|
- `seedEnvelope(input)` — start a new chain at a system edge.
|
|
53
33
|
- `deriveEnvelope(parent, overrides?)` — descend one step; carries correlation, advances causation.
|
|
54
34
|
- `SeedEnvelopeInput` — caller-side type.
|
|
55
|
-
|
|
56
|
-
## See also
|
|
57
|
-
|
|
58
|
-
- [Architecture sketch §05 — Foundation tier](../../architecture-sketch.html#packages)
|
|
59
|
-
- Sibling packages: [@nwire/messages](../nwire-messages), [@nwire/logger](../nwire-logger), [@nwire/queue](../nwire-queue)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/envelope",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Nwire — universal message envelope. messageId, correlationId, causationId, tenant, userId. Zero-dep; every nwire package depends on this.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"causation",
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
"nwire",
|
|
10
10
|
"tracing"
|
|
11
11
|
],
|
|
12
|
+
"license": "MIT",
|
|
12
13
|
"files": [
|
|
13
14
|
"dist",
|
|
14
|
-
"README.md"
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
15
17
|
],
|
|
16
18
|
"type": "module",
|
|
17
19
|
"main": "./dist/envelope.js",
|