@haneinfo/domain-events 11.1.0 → 11.1.2
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 +34 -34
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# @haneinfo/domain-events
|
|
2
|
-
|
|
3
|
-
Transaction-bound domain event recording and database-backed delivery for Haneinfo Apps.
|
|
4
|
-
See [the Prisma model pattern](docs/prisma-model.md) for the App-owned schema and drift checks.
|
|
5
|
-
|
|
6
|
-
Register stable handlers with `DomainEventRegistry`. Call `DomainEventsService.record(tx, input)`
|
|
7
|
-
inside the same transaction as the business write; event creation and delivery fanout then commit
|
|
8
|
-
or roll back together. Handler-key contributors receive that same transaction.
|
|
9
|
-
|
|
10
|
-
The dispatcher claims bounded batches with PostgreSQL `FOR UPDATE SKIP LOCKED`. Each claim has a
|
|
11
|
-
unique lease, and completion compares that lease so a stale worker cannot overwrite another claim
|
|
12
|
-
or an administrator's decision. Delivery is at least once: retries and stale-lock recovery may
|
|
13
|
-
repeat external effects, so handlers must be idempotent.
|
|
14
|
-
|
|
15
|
-
Resolver and handler errors use the same per-delivery classification. Ignored errors become
|
|
16
|
-
`IGNORED`, terminal errors become `DEAD_LETTER`, and other failures retry with bounded backoff
|
|
17
|
-
until `maxAttempts`. An absent handler is ignored. A resolver failure does not stop later deliveries
|
|
18
|
-
in the claimed batch. Disabled integration bindings remain pending without consuming attempts.
|
|
19
|
-
|
|
20
|
-
`DomainEventsModule.forRoot({ dispatcher })` accepts dispatcher options. Environment-based
|
|
21
|
-
configuration is also available through `dispatcherOptionsFromEnvironment()`. Use `autoStart: false`
|
|
22
|
-
for explicit test/operator ticks. Stopping the dispatcher clears its poll timer; handlers already
|
|
23
|
-
in progress remain responsible for finishing safely.
|
|
24
|
-
Polling intervals must be integers from 1 through 2,147,483,647 milliseconds. Invalid environment
|
|
25
|
-
intervals use the default; invalid direct options fail at startup. Explicitly undefined options
|
|
26
|
-
retain their defaults, including auto-start.
|
|
27
|
-
|
|
28
|
-
Integration events pin their payload schema, binding and digests when recorded. Webhook helpers
|
|
29
|
-
validate destinations and signatures; inbound receipt processing joins the business transaction.
|
|
30
|
-
Do not put secrets in event payloads or handler errors.
|
|
31
|
-
|
|
32
|
-
## Dispatcher shutdown
|
|
33
|
-
|
|
34
|
-
The dispatcher stops accepting ticks at shutdown and waits for an active batch. `shutdownTimeoutMs` defaults to 30000 and accepts integers from 1 to 2147483647. A timeout logs a warning and does not cancel the batch or an external handler.
|
|
1
|
+
# @haneinfo/domain-events
|
|
2
|
+
|
|
3
|
+
Transaction-bound domain event recording and database-backed delivery for Haneinfo Apps.
|
|
4
|
+
See [the Prisma model pattern](docs/prisma-model.md) for the App-owned schema and drift checks.
|
|
5
|
+
|
|
6
|
+
Register stable handlers with `DomainEventRegistry`. Call `DomainEventsService.record(tx, input)`
|
|
7
|
+
inside the same transaction as the business write; event creation and delivery fanout then commit
|
|
8
|
+
or roll back together. Handler-key contributors receive that same transaction.
|
|
9
|
+
|
|
10
|
+
The dispatcher claims bounded batches with PostgreSQL `FOR UPDATE SKIP LOCKED`. Each claim has a
|
|
11
|
+
unique lease, and completion compares that lease so a stale worker cannot overwrite another claim
|
|
12
|
+
or an administrator's decision. Delivery is at least once: retries and stale-lock recovery may
|
|
13
|
+
repeat external effects, so handlers must be idempotent.
|
|
14
|
+
|
|
15
|
+
Resolver and handler errors use the same per-delivery classification. Ignored errors become
|
|
16
|
+
`IGNORED`, terminal errors become `DEAD_LETTER`, and other failures retry with bounded backoff
|
|
17
|
+
until `maxAttempts`. An absent handler is ignored. A resolver failure does not stop later deliveries
|
|
18
|
+
in the claimed batch. Disabled integration bindings remain pending without consuming attempts.
|
|
19
|
+
|
|
20
|
+
`DomainEventsModule.forRoot({ dispatcher })` accepts dispatcher options. Environment-based
|
|
21
|
+
configuration is also available through `dispatcherOptionsFromEnvironment()`. Use `autoStart: false`
|
|
22
|
+
for explicit test/operator ticks. Stopping the dispatcher clears its poll timer; handlers already
|
|
23
|
+
in progress remain responsible for finishing safely.
|
|
24
|
+
Polling intervals must be integers from 1 through 2,147,483,647 milliseconds. Invalid environment
|
|
25
|
+
intervals use the default; invalid direct options fail at startup. Explicitly undefined options
|
|
26
|
+
retain their defaults, including auto-start.
|
|
27
|
+
|
|
28
|
+
Integration events pin their payload schema, binding and digests when recorded. Webhook helpers
|
|
29
|
+
validate destinations and signatures; inbound receipt processing joins the business transaction.
|
|
30
|
+
Do not put secrets in event payloads or handler errors.
|
|
31
|
+
|
|
32
|
+
## Dispatcher shutdown
|
|
33
|
+
|
|
34
|
+
The dispatcher stops accepting ticks at shutdown and waits for an active batch. `shutdownTimeoutMs` defaults to 30000 and accepts integers from 1 to 2147483647. A timeout logs a warning and does not cancel the batch or an external handler.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haneinfo/domain-events",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"docs",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"reflect-metadata": "^0.2.2",
|
|
47
|
-
"@haneinfo/frontend-shell": "1.6.
|
|
47
|
+
"@haneinfo/frontend-shell": "1.6.1",
|
|
48
48
|
"@haneinfo/integration-contracts": "0.4.2",
|
|
49
|
-
"@haneinfo/plugin-api": "1.
|
|
49
|
+
"@haneinfo/plugin-api": "1.28.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@haneinfo/common": "^0.6.1",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"typescript": "^5.9.3",
|
|
90
90
|
"vitest": "^4.1.11",
|
|
91
91
|
"zod": "^4.4.0",
|
|
92
|
-
"@haneinfo/frontend-shell": "1.6.0",
|
|
93
92
|
"@haneinfo/common": "0.6.1",
|
|
93
|
+
"@haneinfo/frontend-shell": "1.6.1",
|
|
94
94
|
"@haneinfo/plugin-host-nest": "2.1.1",
|
|
95
95
|
"@haneinfo/plugin-testkit": "2.3.1"
|
|
96
96
|
},
|