@dudousxd/nestjs-durable 0.57.0 → 0.59.0

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.
@@ -3,7 +3,7 @@ name: durable-signals-and-timers
3
3
  description: >
4
4
  Pause and resume @dudousxd/nestjs-durable workflows — ctx.waitForSignal(token) resumed by
5
5
  WorkflowService.signal(token, payload), ctx.waitForEvent(name, { match }) resumed by
6
- publishEvent(name, payload), @OnEvent / @Workflow({ onEvent }) event-triggered starts,
6
+ publishEvent(name, payload), @OnDurableEvent / @Workflow({ onEvent }) event-triggered starts,
7
7
  durable ctx.sleep(duration) / ctx.sleepUntil(date), ctx.webhook() for third-party callbacks, and
8
8
  signalWithStart for the durable-entity/accumulator pattern. Covers the timeoutMs determinism caveat.
9
9
  license: MIT
@@ -81,7 +81,7 @@ export class ApprovalController {
81
81
  `workflows.signal(token, payload)`. One token, one waiting run.
82
82
  - `ctx.waitForEvent<T>(name, { match?, timeoutMs? })` waits on a named event with optional `match`
83
83
  filtering; `workflows.publishEvent(name, payload)` fans out to every run whose `match` the payload
84
- satisfies (and starts any `@OnEvent` workflows whose `where` accepts the payload, with
84
+ satisfies (and starts any `@OnDurableEvent` workflows whose `where` accepts the payload, with
85
85
  `input(payload)` as the run's input when the entry maps it). Returns how many runs it touched.
86
86
 
87
87
  ```ts
@@ -91,14 +91,14 @@ const order = await ctx.waitForEvent<Order>('order.paid', { match: { orderId: id
91
91
 
92
92
  ### Event-triggered workflow starts
93
93
 
94
- `@Workflow({ onEvent })` or `@OnEvent(...)` start a **fresh run** whenever the event is published —
94
+ `@Workflow({ onEvent })` or `@OnDurableEvent(...)` start a **fresh run** whenever the event is published —
95
95
  the payload becomes the run's input, or `input(payload)` when the entry maps it; an entry
96
96
  `{ event, where, input }` starts only when `where(payload)` accepts it. `debounce` / `batch` coalesce bursts.
97
97
 
98
98
  ```ts
99
- import { Workflow, OnEvent } from '@dudousxd/nestjs-durable';
99
+ import { OnDurableEvent, Workflow } from '@dudousxd/nestjs-durable';
100
100
 
101
- @OnEvent('user.registered', 'user.invited')
101
+ @OnDurableEvent('user.registered', 'user.invited')
102
102
  @Workflow({ name: 'welcome', version: '1', debounce: '30s' })
103
103
  export class WelcomeWorkflow {
104
104
  async run(ctx: WorkflowCtx, user: { id: string }) { /* ... */ }