@adonis-agora/durable 0.4.0 → 0.5.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +47 -0
  3. package/dist/configure.d.ts +5 -2
  4. package/dist/configure.d.ts.map +1 -1
  5. package/dist/configure.js +7 -2
  6. package/dist/configure.js.map +1 -1
  7. package/dist/providers/durable_provider.d.ts +8 -4
  8. package/dist/providers/durable_provider.d.ts.map +1 -1
  9. package/dist/providers/durable_provider.js +37 -6
  10. package/dist/providers/durable_provider.js.map +1 -1
  11. package/dist/src/define_config.d.ts +4 -3
  12. package/dist/src/define_config.d.ts.map +1 -1
  13. package/dist/src/define_config.js.map +1 -1
  14. package/dist/src/hooks/workflows.d.ts +53 -0
  15. package/dist/src/hooks/workflows.d.ts.map +1 -0
  16. package/dist/src/hooks/workflows.js +55 -0
  17. package/dist/src/hooks/workflows.js.map +1 -0
  18. package/dist/src/index.d.ts +2 -1
  19. package/dist/src/index.d.ts.map +1 -1
  20. package/dist/src/index.js +1 -0
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/transports/event-emitter.d.ts +60 -0
  23. package/dist/src/transports/event-emitter.d.ts.map +1 -0
  24. package/dist/src/transports/event-emitter.js +103 -0
  25. package/dist/src/transports/event-emitter.js.map +1 -0
  26. package/dist/src/transports/factory.d.ts +23 -2
  27. package/dist/src/transports/factory.d.ts.map +1 -1
  28. package/dist/src/transports/factory.js +20 -1
  29. package/dist/src/transports/factory.js.map +1 -1
  30. package/dist/src/workflow-discovery.d.ts +15 -0
  31. package/dist/src/workflow-discovery.d.ts.map +1 -1
  32. package/dist/src/workflow-discovery.js +25 -0
  33. package/dist/src/workflow-discovery.js.map +1 -1
  34. package/dist/stubs/config/durable.stub +6 -1
  35. package/package.json +10 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @adonis-agora/durable
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`9ae80aa`](https://github.com/DavideCarvalho/adonis-durable/commit/9ae80aa167fc27157b8e7c605bdb2805e6730dea) - feat: in-process EventEmitter transport; workflows codegen via Adonis assembler hook
8
+
9
+ - New production **in-process** transport `transports.eventEmitter()` backed by a single Node `EventEmitter`: a single-process app runs real durable workflows with NO external infrastructure (no DB, no Redis, no broker). It decouples dispatch → worker → result over the event loop (mirroring a real broker), and funnels every step through `runStepHandler`, so the scoped context restore works identically. Distinct from the test-only `transports.memory()`. Selectable via `transport: 'event-emitter'` in `config/durable.ts`; the default is unchanged.
10
+ - Workflows discovery now prefers a **build-time barrel** generated by an AdonisJS Assembler `init` hook (`@adonis-agora/durable/hooks/workflows`), exactly how core generates the controllers/events/listeners barrels via `IndexGenerator`. The dev server / test runner / bundler generates `.adonisjs/durable/workflows.ts` and the file watcher regenerates it on change; the provider imports it at boot instead of scanning `app/workflows` with `readdir`. Register it in `adonisrc.ts` under `hooks.init` (the `configure` command wires it for you). The runtime `readdir` scan is kept as a **fallback** so apps that don't register the hook keep working unchanged.
11
+
3
12
  ## 0.4.0
4
13
 
5
14
  ### Minor Changes
package/README.md CHANGED
@@ -24,6 +24,53 @@ persistent store and a broker-backed transport in `config/durable.ts` for
24
24
  production. When `@adonis-agora/context` is installed, the originating tenant/user/
25
25
  correlation carrier rides each dispatched task (best-effort, no hard dependency).
26
26
 
27
+ ## Transports
28
+
29
+ Select a transport by name in `config/durable.ts`:
30
+
31
+ - `transports.eventEmitter()` — **production in-process** transport over a Node
32
+ `EventEmitter`. Zero external infrastructure (no DB, no Redis, no broker): step
33
+ handlers run in this same process, decoupled from the dispatching workflow over
34
+ the event loop. Use it for a single-process production app.
35
+ - `transports.queue({ connection })` — cross-process over `@adonisjs/queue`.
36
+ - `transports.db({ connection })` — cross-process over the app database
37
+ (`@adonisjs/lucid`), no broker.
38
+ - `transports.memory()` — test-only (drives `dispatch` straight into the handler).
39
+
40
+ ```ts
41
+ import { defineConfig, transports } from '@adonis-agora/durable'
42
+
43
+ export default defineConfig({
44
+ transport: 'event-emitter',
45
+ transports: {
46
+ 'event-emitter': transports.eventEmitter(),
47
+ },
48
+ })
49
+ ```
50
+
51
+ ## Workflows codegen (Assembler hook)
52
+
53
+ `node ace configure` registers an AdonisJS **Assembler `init` hook** that generates
54
+ a typed barrel of `app/workflows/` at build/dev time — exactly how core generates
55
+ the controllers/events/listeners barrels. The provider imports the generated
56
+ `.adonisjs/durable/workflows.ts` at boot and registers every `@Workflow` class,
57
+ instead of scanning the directory with `readdir` at runtime. The file watcher
58
+ regenerates the barrel whenever a workflow file changes.
59
+
60
+ Register it in `adonisrc.ts` (the `configure` command does this for you):
61
+
62
+ ```ts
63
+ export default defineConfig({
64
+ hooks: {
65
+ init: [() => import('@adonis-agora/durable/hooks/workflows')],
66
+ },
67
+ })
68
+ ```
69
+
70
+ If the hook is not registered (or the barrel hasn't been generated yet) the
71
+ provider **falls back** to the runtime directory scan, so apps that don't opt in
72
+ keep working unchanged. Opt out of discovery entirely with `workflowsPath: false`.
73
+
27
74
  ## License
28
75
 
29
76
  MIT © Davi Carvalho
@@ -6,8 +6,11 @@ import type Configure from '@adonisjs/core/commands/configure';
6
6
  * 2. registers the ace commands barrel (`durable:work`, `durable:runs`,
7
7
  * `durable:retry`);
8
8
  * 3. registers the optional dashboard provider;
9
- * 4. publishes `config/durable.ts` + `config/durable_dashboard.ts`;
10
- * 5. publishes the Lucid migrations for the optional `lucid` store and `db`
9
+ * 4. registers the Assembler `init` hook that generates the typed `app/workflows`
10
+ * barrel at build/dev time (the provider imports it instead of scanning at
11
+ * runtime; it falls back to the runtime scan when the barrel is absent);
12
+ * 5. publishes `config/durable.ts` + `config/durable_dashboard.ts`;
13
+ * 6. publishes the Lucid migrations for the optional `lucid` store and `db`
11
14
  * transport drivers (run `node ace migration:run`, and delete the transport
12
15
  * migration if you don't use the `db` transport).
13
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAC;AAG/D;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,iBAiBjD"}
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAC;AAG/D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,iBAmBjD"}
package/dist/configure.js CHANGED
@@ -6,8 +6,11 @@ import { stubsRoot } from './stubs/main.js';
6
6
  * 2. registers the ace commands barrel (`durable:work`, `durable:runs`,
7
7
  * `durable:retry`);
8
8
  * 3. registers the optional dashboard provider;
9
- * 4. publishes `config/durable.ts` + `config/durable_dashboard.ts`;
10
- * 5. publishes the Lucid migrations for the optional `lucid` store and `db`
9
+ * 4. registers the Assembler `init` hook that generates the typed `app/workflows`
10
+ * barrel at build/dev time (the provider imports it instead of scanning at
11
+ * runtime; it falls back to the runtime scan when the barrel is absent);
12
+ * 5. publishes `config/durable.ts` + `config/durable_dashboard.ts`;
13
+ * 6. publishes the Lucid migrations for the optional `lucid` store and `db`
11
14
  * transport drivers (run `node ace migration:run`, and delete the transport
12
15
  * migration if you don't use the `db` transport).
13
16
  */
@@ -17,6 +20,8 @@ export async function configure(command) {
17
20
  rcFile.addProvider('@adonis-agora/durable/durable_provider');
18
21
  rcFile.addProvider('@adonis-agora/durable/dashboard_provider');
19
22
  rcFile.addCommand('@adonis-agora/durable/commands');
23
+ // Generate the typed app/workflows barrel at build/dev time (replaces the runtime readdir scan).
24
+ rcFile.addAssemblerHook('init', '@adonis-agora/durable/hooks/workflows');
20
25
  });
21
26
  await codemods.makeUsingStub(stubsRoot, 'config/durable.stub', {});
22
27
  await codemods.makeUsingStub(stubsRoot, 'config/durable_dashboard.stub', {});
@@ -1 +1 @@
1
- {"version":3,"file":"configure.js","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAkB;IAChD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;IAEhD,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;QAC7D,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;QAC/D,MAAM,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,+BAA+B,EAAE,EAAE,CAAC,CAAC;IAC7E,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,gDAAgD,EAAE,EAAE,CAAC,CAAC;IAC9F,MAAM,QAAQ,CAAC,aAAa,CAC1B,SAAS,EACT,0DAA0D,EAC1D,EAAE,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAkB;IAChD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;IAEhD,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;QAC7D,MAAM,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;QAC/D,MAAM,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC;QACpD,iGAAiG;QACjG,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,uCAAuC,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,+BAA+B,EAAE,EAAE,CAAC,CAAC;IAC7E,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,gDAAgD,EAAE,EAAE,CAAC,CAAC;IAC9F,MAAM,QAAQ,CAAC,aAAa,CAC1B,SAAS,EACT,0DAA0D,EAC1D,EAAE,CACH,CAAC;AACJ,CAAC"}
@@ -24,10 +24,14 @@ export default class DurableProvider {
24
24
  constructor(app: ApplicationService);
25
25
  register(): void;
26
26
  /**
27
- * Auto-register the `app/workflows` convention: scan the configured directory for
28
- * `@Workflow`-decorated classes and register each on the engine — so users never call
29
- * `engine.register(...)` by hand (mirrors `@adonisjs/queue`'s `app/jobs`). Opt-out with
30
- * `config.workflowsPath = false`; a missing directory is a no-op. The low-level
27
+ * Auto-register the `app/workflows` convention so users never call `engine.register(...)` by hand
28
+ * (mirrors `@adonisjs/queue`'s `app/jobs`). Opt-out with `config.workflowsPath = false`.
29
+ *
30
+ * Prefers the **build-time barrel** generated by the Assembler `init` hook
31
+ * (`@adonis-agora/durable/hooks/workflows` → `.adonisjs/durable/workflows.js`): registering from it
32
+ * avoids any runtime `readdir`. When that barrel is absent (the hook isn't registered in
33
+ * `adonisrc.ts`, or it hasn't been generated yet) it FALLS BACK to the runtime directory scan, so
34
+ * apps that don't opt into the hook keep working unchanged. The low-level
31
35
  * `engine.register(name, version, fn)` remains the escape hatch.
32
36
  */
33
37
  boot(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"durable_provider.d.ts","sourceRoot":"","sources":["../../providers/durable_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAkC/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;;IAKtB,SAAS,CAAC,GAAG,EAAE,kBAAkB;gBAAvB,GAAG,EAAE,kBAAkB;IAE7C,QAAQ;IA4CR;;;;;;OAMG;IACG,IAAI;IAgDV;;;;;;OAMG;IACG,KAAK;IAOL,QAAQ;CAUf"}
1
+ {"version":3,"file":"durable_provider.d.ts","sourceRoot":"","sources":["../../providers/durable_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAoC/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;;IAKtB,SAAS,CAAC,GAAG,EAAE,kBAAkB;gBAAvB,GAAG,EAAE,kBAAkB;IAE7C,QAAQ;IA4CR;;;;;;;;;;OAUG;IACG,IAAI;IA2EV;;;;;;OAMG;IACG,KAAK;IAOL,QAAQ;CAUf"}
@@ -1,4 +1,5 @@
1
- import { InMemoryStateStore, InMemoryTransport, WorkflowEngine, attachDurableDiagnostics, registerWorkflowsFromDir, } from '../src/index.js';
1
+ import { pathToFileURL } from 'node:url';
2
+ import { InMemoryStateStore, InMemoryTransport, WorkflowEngine, attachDurableDiagnostics, registerWorkflowsFromBarrel, registerWorkflowsFromDir, } from '../src/index.js';
2
3
  const CONTEXT_ACCESSOR = Symbol.for('@agora/context:accessor');
3
4
  /**
4
5
  * Global slot `@adonis-agora/diagnostics-otel` publishes its `otelTraceparent` under: a
@@ -73,20 +74,50 @@ export default class DurableProvider {
73
74
  });
74
75
  }
75
76
  /**
76
- * Auto-register the `app/workflows` convention: scan the configured directory for
77
- * `@Workflow`-decorated classes and register each on the engine — so users never call
78
- * `engine.register(...)` by hand (mirrors `@adonisjs/queue`'s `app/jobs`). Opt-out with
79
- * `config.workflowsPath = false`; a missing directory is a no-op. The low-level
77
+ * Auto-register the `app/workflows` convention so users never call `engine.register(...)` by hand
78
+ * (mirrors `@adonisjs/queue`'s `app/jobs`). Opt-out with `config.workflowsPath = false`.
79
+ *
80
+ * Prefers the **build-time barrel** generated by the Assembler `init` hook
81
+ * (`@adonis-agora/durable/hooks/workflows` → `.adonisjs/durable/workflows.js`): registering from it
82
+ * avoids any runtime `readdir`. When that barrel is absent (the hook isn't registered in
83
+ * `adonisrc.ts`, or it hasn't been generated yet) it FALLS BACK to the runtime directory scan, so
84
+ * apps that don't opt into the hook keep working unchanged. The low-level
80
85
  * `engine.register(name, version, fn)` remains the escape hatch.
81
86
  */
82
87
  async boot() {
83
88
  const config = this.app.config.get('durable', {});
84
89
  if (config.workflowsPath === false)
85
90
  return;
86
- const dir = this.app.makePath(config.workflowsPath ?? 'app/workflows');
87
91
  const engine = await this.app.container.make(WorkflowEngine);
92
+ const barrel = await this.#loadGeneratedWorkflowsBarrel();
93
+ if (barrel) {
94
+ await registerWorkflowsFromBarrel(engine, barrel);
95
+ return;
96
+ }
97
+ // Fallback: no generated barrel — scan the configured directory at runtime.
98
+ const dir = this.app.makePath(config.workflowsPath ?? 'app/workflows');
88
99
  await registerWorkflowsFromDir(engine, dir);
89
100
  }
101
+ /**
102
+ * Best-effort import of the build-time workflows barrel the Assembler `init` hook generates. Returns
103
+ * the barrel's `workflows` export when present, or `null` when the file doesn't exist (the hook
104
+ * isn't registered) — the signal for `boot()` to fall back to the runtime scan. Only a genuine
105
+ * "module not found" is swallowed; any other import error propagates (a broken generated barrel
106
+ * should surface, not silently degrade).
107
+ */
108
+ async #loadGeneratedWorkflowsBarrel() {
109
+ const path = this.app.makePath('.adonisjs/durable/workflows.js');
110
+ try {
111
+ const mod = (await import(pathToFileURL(path).href));
112
+ return mod.workflows ?? null;
113
+ }
114
+ catch (err) {
115
+ const code = err.code;
116
+ if (code === 'ERR_MODULE_NOT_FOUND' || code === 'ENOENT')
117
+ return null;
118
+ throw err;
119
+ }
120
+ }
90
121
  /** Resolve the configured state store (a key of `config.stores`), or the in-memory default. */
91
122
  async #resolveStore(config, ctx) {
92
123
  const name = config.store;
@@ -1 +1 @@
1
- {"version":3,"file":"durable_provider.js","sourceRoot":"","sources":["../../providers/durable_provider.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EAKjB,cAAc,EAEd,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAMzB,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE/D,6GAA6G;AAC7G,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;IAKZ;IAJtB,kBAAkB,GAAwB,IAAI,CAAC;IAC/C,UAAU,GAAyD,IAAI,CAAC;IACxE,aAAa,GAA4D,IAAI,CAAC;IAE9E,YAAsB,GAAuB;QAAvB,QAAG,GAAH,GAAG,CAAoB;IAAG,CAAC;IAEjD,QAAQ;QACN,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE;YACtD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAgB,SAAS,EAAE,EAAE,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAI,UAAsC,CAAC,gBAAgB,CAE5D,CAAC;YACd,MAAM,eAAe,GAAI,UAAsC,CAAC,gBAAgB,CAEnE,CAAC;YAEd,MAAM,GAAG,GAA0D,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;YACrF,MAAM,KAAK,GAAG,MAAM,IAAI,CA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AO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,oBAAoB,CACxB,MAAqB,EACrB,GAAwB;QAExB,MAAM,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC;QAC/B,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QACrB,OAAO,OAAO,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,GAAI,UAAsC,CAAC,gBAAgB,CAAC,CAAC;QACvE,IAAI,OAAO,IAAI,KAAK,UAAU;YAAE,OAAO;QACvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC7D,IAAI,CAAC,kBAAkB,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAC5B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,+FAA+F;QAC/F,MAAM,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,sFAAsF;QACtF,MAAM,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF"}
@@ -5,7 +5,7 @@ import type { ScheduledWorkflow } from './scheduler.js';
5
5
  import { stores } from './stores/factory.js';
6
6
  import type { LucidStoreConfig, StoreContext, StoreFactory } from './stores/factory.js';
7
7
  import { transports } from './transports/factory.js';
8
- import type { DbTransportConfig, MemoryTransportConfig, QueueTransportConfig, TransportContext, TransportFactory } from './transports/factory.js';
8
+ import type { DbTransportConfig, EventEmitterTransportConfig, MemoryTransportConfig, QueueTransportConfig, TransportContext, TransportFactory } from './transports/factory.js';
9
9
  /**
10
10
  * Shape of `config/durable.ts`. Everything is optional — by default the engine uses an in-process
11
11
  * state store + transport (single-process, no extra infra). Pick a `transport`/`store` by name from
@@ -20,7 +20,8 @@ import type { DbTransportConfig, MemoryTransportConfig, QueueTransportConfig, Tr
20
20
  * export default defineConfig({
21
21
  * transport: 'queue',
22
22
  * transports: {
23
- * memory: transports.memory(),
23
+ * // production single-process, no external infra:
24
+ * 'event-emitter': transports.eventEmitter(),
24
25
  * queue: transports.queue({ adapter: redis({ host: '127.0.0.1' }), group: 'durable' }),
25
26
  * db: transports.db({ connection: 'pg' }),
26
27
  * },
@@ -82,5 +83,5 @@ export interface DurableConfig {
82
83
  /** Identity helper giving `config/durable.ts` full type-checking. */
83
84
  export declare function defineConfig(config?: DurableConfig): DurableConfig;
84
85
  export { transports, stores, controlPlanes };
85
- export type { TransportContext, TransportFactory, MemoryTransportConfig, QueueTransportConfig, DbTransportConfig, StoreContext, StoreFactory, LucidStoreConfig, ControlPlaneContext, ControlPlaneFactory, RedisControlPlaneConfig, };
86
+ export type { TransportContext, TransportFactory, MemoryTransportConfig, EventEmitterTransportConfig, QueueTransportConfig, DbTransportConfig, StoreContext, StoreFactory, LucidStoreConfig, ControlPlaneContext, ControlPlaneFactory, RedisControlPlaneConfig, };
86
87
  //# sourceMappingURL=define_config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,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AAY,GAAG,mBAAmB,CAAC;IAClD,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gFAAgF;IAChF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAChC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,MAAM,GAAE,aAAkB,GAAG,aAAa,CAEtE;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAC7C,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAQ5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAmFrD,qEAAqE;AACrE,MAAM,UAAU,YAAY,CAAC,SAAwB,EAAE;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAQ5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAqFrD,qEAAqE;AACrE,MAAM,UAAU,YAAY,CAAC,SAAwB,EAAE;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { IndexGenerator } from '@adonisjs/assembler/index_generator';
2
+ /**
3
+ * Where the generated workflows barrel is written, relative to the app root. The durable provider
4
+ * imports THIS path at boot (build-time codegen) instead of scanning `app/workflows` with `readdir`
5
+ * at runtime. Kept in sync with {@link GENERATED_WORKFLOWS_MODULE} the provider imports.
6
+ */
7
+ export declare const GENERATED_WORKFLOWS_OUTPUT = ".adonisjs/durable/workflows.ts";
8
+ /**
9
+ * Options for {@link workflowsHook} — mirror the relevant `IndexGenerator.add` knobs so an app can
10
+ * point the generator at a non-default workflows directory or import alias.
11
+ */
12
+ export interface WorkflowsHookOptions {
13
+ /** Directory the generator scans for workflow modules, relative to the app root. Default `app/workflows`. */
14
+ source?: string;
15
+ /** Import alias the generated barrel uses for each workflow module. Default `#workflows`. */
16
+ importAlias?: string;
17
+ /** Output path for the generated barrel, relative to the app root. Default `.adonisjs/durable/workflows.ts`. */
18
+ output?: string;
19
+ }
20
+ /**
21
+ * An AdonisJS **Assembler `init` hook** that generates a typed barrel of the app's `app/workflows/`
22
+ * directory at build/dev time — exactly how `@adonisjs/core` generates the controllers/events/listeners
23
+ * barrels (`indexEntities`). The build-time barrel replaces the provider's runtime `readdir` scan: the
24
+ * dev server / test runner / bundler runs this `init` hook once, and the file watcher re-runs the
25
+ * `IndexGenerator` (via its tracked `addFile`/`removeFile`) whenever a workflow file changes, so the
26
+ * generated `.adonisjs/durable/workflows.ts` always reflects `app/workflows`.
27
+ *
28
+ * The generated file is a lazy barrel — `export const workflows = { Name: () => import('#workflows/…') }`
29
+ * — which the durable provider imports at boot, awaiting each thunk and registering every
30
+ * `@Workflow`-decorated export it finds (falling back to the runtime scan when the barrel is absent).
31
+ *
32
+ * Register it in `adonisrc.ts`:
33
+ *
34
+ * ```ts
35
+ * export default defineConfig({
36
+ * hooks: {
37
+ * init: [() => import('@adonis-agora/durable/hooks/workflows')],
38
+ * },
39
+ * })
40
+ * ```
41
+ *
42
+ * The default export is the hook object the assembler expects (`{ run(parent, hooks, indexGenerator) }`).
43
+ */
44
+ export declare function workflowsHook(options?: WorkflowsHookOptions): {
45
+ run(_parent: unknown, _hooks: unknown, indexGenerator: IndexGenerator): void;
46
+ };
47
+ /** The default export is the hook object itself, so `() => import('@adonis-agora/durable/hooks/workflows')`
48
+ * in `adonisrc.ts` resolves to a ready hook (the assembler calls its `run`). */
49
+ declare const _default: {
50
+ run(_parent: unknown, _hooks: unknown, indexGenerator: IndexGenerator): void;
51
+ };
52
+ export default _default;
53
+ //# sourceMappingURL=workflows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../src/hooks/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,mCAAmC,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,6GAA6G;IAC7G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB;iBAM/C,OAAO,UAAU,OAAO,kBAAkB,cAAc,GAAG,IAAI;EAe/E;AAED;iFACiF;;iBAlBhE,OAAO,UAAU,OAAO,kBAAkB,cAAc,GAAG,IAAI;;AAmBhF,wBAA+B"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Where the generated workflows barrel is written, relative to the app root. The durable provider
3
+ * imports THIS path at boot (build-time codegen) instead of scanning `app/workflows` with `readdir`
4
+ * at runtime. Kept in sync with {@link GENERATED_WORKFLOWS_MODULE} the provider imports.
5
+ */
6
+ export const GENERATED_WORKFLOWS_OUTPUT = '.adonisjs/durable/workflows.ts';
7
+ /**
8
+ * An AdonisJS **Assembler `init` hook** that generates a typed barrel of the app's `app/workflows/`
9
+ * directory at build/dev time — exactly how `@adonisjs/core` generates the controllers/events/listeners
10
+ * barrels (`indexEntities`). The build-time barrel replaces the provider's runtime `readdir` scan: the
11
+ * dev server / test runner / bundler runs this `init` hook once, and the file watcher re-runs the
12
+ * `IndexGenerator` (via its tracked `addFile`/`removeFile`) whenever a workflow file changes, so the
13
+ * generated `.adonisjs/durable/workflows.ts` always reflects `app/workflows`.
14
+ *
15
+ * The generated file is a lazy barrel — `export const workflows = { Name: () => import('#workflows/…') }`
16
+ * — which the durable provider imports at boot, awaiting each thunk and registering every
17
+ * `@Workflow`-decorated export it finds (falling back to the runtime scan when the barrel is absent).
18
+ *
19
+ * Register it in `adonisrc.ts`:
20
+ *
21
+ * ```ts
22
+ * export default defineConfig({
23
+ * hooks: {
24
+ * init: [() => import('@adonis-agora/durable/hooks/workflows')],
25
+ * },
26
+ * })
27
+ * ```
28
+ *
29
+ * The default export is the hook object the assembler expects (`{ run(parent, hooks, indexGenerator) }`).
30
+ */
31
+ export function workflowsHook(options = {}) {
32
+ const source = options.source ?? 'app/workflows';
33
+ const importAlias = options.importAlias ?? '#workflows';
34
+ const output = options.output ?? GENERATED_WORKFLOWS_OUTPUT;
35
+ return {
36
+ run(_parent, _hooks, indexGenerator) {
37
+ indexGenerator.add('workflows', {
38
+ source,
39
+ as: 'barrelFile',
40
+ exportName: 'workflows',
41
+ importAlias,
42
+ // `app/workflows/billing/charge_workflow.ts` → key `Billing/Charge`; the `Workflow` suffix is
43
+ // dropped so a barrel key reads as the class, mirroring controllers' `removeSuffix: 'controller'`.
44
+ removeSuffix: 'workflow',
45
+ skipSegments: ['workflows'],
46
+ output,
47
+ comment: true,
48
+ });
49
+ },
50
+ };
51
+ }
52
+ /** The default export is the hook object itself, so `() => import('@adonis-agora/durable/hooks/workflows')`
53
+ * in `adonisrc.ts` resolves to a ready hook (the assembler calls its `run`). */
54
+ export default workflowsHook();
55
+ //# sourceMappingURL=workflows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/hooks/workflows.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AAe3E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAAC,UAAgC,EAAE;IAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,eAAe,CAAC;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,YAAY,CAAC;IACxD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,0BAA0B,CAAC;IAE5D,OAAO;QACL,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,cAA8B;YACnE,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE;gBAC9B,MAAM;gBACN,EAAE,EAAE,YAAY;gBAChB,UAAU,EAAE,WAAW;gBACvB,WAAW;gBACX,8FAA8F;gBAC9F,mGAAmG;gBACnG,YAAY,EAAE,UAAU;gBACxB,YAAY,EAAE,CAAC,WAAW,CAAC;gBAC3B,MAAM;gBACN,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED;iFACiF;AACjF,eAAe,aAAa,EAAE,CAAC"}
@@ -24,7 +24,8 @@ export * from './workflow-discovery.js';
24
24
  export { InMemoryStateStore } from './testing/in-memory-state-store.js';
25
25
  export { InMemoryTransport } from './testing/in-memory-transport.js';
26
26
  export { transports } from './transports/factory.js';
27
- export type { TransportContext, TransportFactory, MemoryTransportConfig, QueueTransportConfig, DbTransportConfig, } from './transports/factory.js';
27
+ export type { TransportContext, TransportFactory, MemoryTransportConfig, EventEmitterTransportConfig, QueueTransportConfig, DbTransportConfig, } from './transports/factory.js';
28
+ export { EventEmitterTransport, type EventEmitterTransportOptions, } from './transports/event-emitter.js';
28
29
  export { QueueTransport, type QueueTransportOptions } from './transports/queue.js';
29
30
  export { DbTransport, type DbTransportOptions } from './transports/db.js';
30
31
  export { TRANSPORT_TABLES, createDurableTransportTables, dropDurableTransportTables, } from './transports/db-schema.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,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EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlG,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,GACjB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/src/index.js CHANGED
@@ -26,6 +26,7 @@ export { InMemoryStateStore } from './testing/in-memory-state-store.js';
26
26
  export { InMemoryTransport } from './testing/in-memory-transport.js';
27
27
  // --- config-driven transport drivers ----------------------------------------
28
28
  export { transports } from './transports/factory.js';
29
+ export { EventEmitterTransport, } from './transports/event-emitter.js';
29
30
  export { QueueTransport } from './transports/queue.js';
30
31
  export { DbTransport } from './transports/db.js';
31
32
  export { TRANSPORT_TABLES, createDurableTransportTables, dropDurableTransportTables, } from './transports/db-schema.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,+EAA+E;AAC/E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,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{ type ControlMessage, type ControlPlane, type Heartbeat, type RemoteTask, type StepResult, type Transport } from '../interfaces.js';
3
+ import { type StepHandler } from '../protocol.js';
4
+ /** Event names the transport multiplexes over a single in-process emitter. */
5
+ export declare const TASK_EVENT = "durable.task";
6
+ export declare const RESULT_EVENT = "durable.result";
7
+ export declare const HEARTBEAT_EVENT = "durable.heartbeat";
8
+ export declare const CONTROL_EVENT = "durable.control";
9
+ export interface EventEmitterTransportOptions {
10
+ /**
11
+ * The in-process emitter to multiplex over. Defaults to a fresh Node `EventEmitter` (listener cap
12
+ * lifted, since the engine wires several long-lived listeners). Pass `@adonisjs/core`'s `emitter`
13
+ * service if you'd rather ride the app's bus — it is API-compatible for `on`/`emit`.
14
+ */
15
+ emitter?: EventEmitter;
16
+ /**
17
+ * The worker group this instance serves. Unused for routing (handlers are matched by step name in
18
+ * this same process) — accepted for parity with the broker transports, and stamped nowhere.
19
+ */
20
+ group?: string;
21
+ /** Stable id for this process (stamped on control `from` when a publisher leaves it unset). Default random. */
22
+ instanceId?: string;
23
+ }
24
+ /**
25
+ * A production **in-process** {@link Transport} (and {@link ControlPlane}) backed by a single Node
26
+ * `EventEmitter`. Zero external infrastructure (no DB, no Redis, no broker): step handlers run in the
27
+ * same process, fully decoupled from the workflow that dispatched them, so a single-process app runs
28
+ * real durable workflows with nothing else to deploy.
29
+ *
30
+ * Distinct from the test-only {@link import('../testing/in-memory-transport.js').InMemoryTransport}:
31
+ * that one drives `dispatch` straight into the handler (synchronous-ish, for deterministic tests);
32
+ * this one decouples both directions through the emitter's event loop, mirroring how a real broker
33
+ * fans dispatch → worker → result back. Both funnel every step through {@link runStepHandler}, so the
34
+ * scoped context restore (the `@agora/context:scope` slot) works identically here.
35
+ *
36
+ * Swap to {@link import('./db.js').DbTransport} / {@link import('./queue.js').QueueTransport} for
37
+ * true cross-process or cross-language steps. The {@link ControlPlane} here broadcasts locally (every
38
+ * subscriber in this process), correct for single-instance; it does NOT fan out across pods.
39
+ *
40
+ * Usually you don't construct this directly: `config/durable.ts` selects it via
41
+ * `transports.eventEmitter()` (alias `transports.memory()` from the factory points at the test
42
+ * transport) and the provider builds it for you.
43
+ */
44
+ export declare class EventEmitterTransport implements Transport, ControlPlane {
45
+ #private;
46
+ constructor(options?: EventEmitterTransportOptions);
47
+ /** Stable id stamped on control `from` when a publisher leaves it unset. */
48
+ get instanceId(): string;
49
+ dispatch(task: RemoteTask): Promise<void>;
50
+ /** Register a step handler by name (the worker side, in this same process). */
51
+ handle(name: string, fn: StepHandler): void;
52
+ /** Worker side: a liveness heartbeat. In-process handlers run synchronously, so emit it straight
53
+ * through for symmetry — an engine that wired `onHeartbeat` still observes it. */
54
+ heartbeat(beat: Heartbeat): Promise<void>;
55
+ onResult(handler: (result: StepResult) => Promise<void>): void;
56
+ onHeartbeat(handler: (beat: Heartbeat) => Promise<void>): void;
57
+ publishControl(msg: ControlMessage): Promise<void>;
58
+ onControl(handler: (msg: ControlMessage) => void): void;
59
+ }
60
+ //# sourceMappingURL=event-emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../../../src/transports/event-emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,UAAU,iBAAiB,CAAC;AACzC,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAC7C,eAAO,MAAM,eAAe,sBAAsB,CAAC;AACnD,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+GAA+G;IAC/G,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,qBAAsB,YAAW,SAAS,EAAE,YAAY;;gBAKvD,OAAO,GAAE,4BAAiC;IAatD,4EAA4E;IAC5E,IAAI,UAAU,IAAI,MAAM,CAEvB;IAMK,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/C,+EAA+E;IAC/E,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI;IAI3C;uFACmF;IAC7E,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB/C,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAM9D,WAAW,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAUxD,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxD,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;CAGxD"}
@@ -0,0 +1,103 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { EventEmitter } from 'node:events';
3
+ import { runStepHandler } from '../protocol.js';
4
+ /** Event names the transport multiplexes over a single in-process emitter. */
5
+ export const TASK_EVENT = 'durable.task';
6
+ export const RESULT_EVENT = 'durable.result';
7
+ export const HEARTBEAT_EVENT = 'durable.heartbeat';
8
+ export const CONTROL_EVENT = 'durable.control';
9
+ /**
10
+ * A production **in-process** {@link Transport} (and {@link ControlPlane}) backed by a single Node
11
+ * `EventEmitter`. Zero external infrastructure (no DB, no Redis, no broker): step handlers run in the
12
+ * same process, fully decoupled from the workflow that dispatched them, so a single-process app runs
13
+ * real durable workflows with nothing else to deploy.
14
+ *
15
+ * Distinct from the test-only {@link import('../testing/in-memory-transport.js').InMemoryTransport}:
16
+ * that one drives `dispatch` straight into the handler (synchronous-ish, for deterministic tests);
17
+ * this one decouples both directions through the emitter's event loop, mirroring how a real broker
18
+ * fans dispatch → worker → result back. Both funnel every step through {@link runStepHandler}, so the
19
+ * scoped context restore (the `@agora/context:scope` slot) works identically here.
20
+ *
21
+ * Swap to {@link import('./db.js').DbTransport} / {@link import('./queue.js').QueueTransport} for
22
+ * true cross-process or cross-language steps. The {@link ControlPlane} here broadcasts locally (every
23
+ * subscriber in this process), correct for single-instance; it does NOT fan out across pods.
24
+ *
25
+ * Usually you don't construct this directly: `config/durable.ts` selects it via
26
+ * `transports.eventEmitter()` (alias `transports.memory()` from the factory points at the test
27
+ * transport) and the provider builds it for you.
28
+ */
29
+ export class EventEmitterTransport {
30
+ #emitter;
31
+ #instanceId;
32
+ #handlers = new Map();
33
+ constructor(options = {}) {
34
+ // A long-lived single emitter carries several engine listeners; lift Node's default cap so the
35
+ // engine wiring (result + heartbeat + control + task) never trips a MaxListenersExceededWarning.
36
+ const emitter = options.emitter ?? new EventEmitter();
37
+ if (emitter instanceof EventEmitter)
38
+ emitter.setMaxListeners(0);
39
+ this.#emitter = emitter;
40
+ this.#instanceId = options.instanceId ?? randomUUID();
41
+ // The worker side listens for every dispatched task and runs it if it owns the step name.
42
+ this.#emitter.on(TASK_EVENT, (task) => {
43
+ void this.#process(task);
44
+ });
45
+ }
46
+ /** Stable id stamped on control `from` when a publisher leaves it unset. */
47
+ get instanceId() {
48
+ return this.#instanceId;
49
+ }
50
+ // ---------------------------------------------------------------------------
51
+ // engine → worker
52
+ // ---------------------------------------------------------------------------
53
+ async dispatch(task) {
54
+ this.#emitter.emit(TASK_EVENT, task);
55
+ }
56
+ // ---------------------------------------------------------------------------
57
+ // worker side — register a step handler, run it, emit the result back
58
+ // ---------------------------------------------------------------------------
59
+ /** Register a step handler by name (the worker side, in this same process). */
60
+ handle(name, fn) {
61
+ this.#handlers.set(name, fn);
62
+ }
63
+ /** Worker side: a liveness heartbeat. In-process handlers run synchronously, so emit it straight
64
+ * through for symmetry — an engine that wired `onHeartbeat` still observes it. */
65
+ async heartbeat(beat) {
66
+ this.#emitter.emit(HEARTBEAT_EVENT, beat);
67
+ }
68
+ async #process(task) {
69
+ const handler = this.#handlers.get(task.name);
70
+ // Another subscriber may own this step name — stay silent, don't synthesize a "no handler" failure.
71
+ if (!handler)
72
+ return;
73
+ const result = await runStepHandler(task, handler);
74
+ // Emit the result on a LATER tick: a durable `ctx.call` suspends the run right after dispatch, so
75
+ // the result must land AFTER that unwinds (else the resume re-enters mid-suspend). Real brokers
76
+ // deliver asynchronously; this mirrors them.
77
+ setImmediate(() => this.#emitter.emit(RESULT_EVENT, result));
78
+ }
79
+ // ---------------------------------------------------------------------------
80
+ // worker → engine — the engine consumes results + heartbeats
81
+ // ---------------------------------------------------------------------------
82
+ onResult(handler) {
83
+ this.#emitter.on(RESULT_EVENT, (result) => {
84
+ void handler(result);
85
+ });
86
+ }
87
+ onHeartbeat(handler) {
88
+ this.#emitter.on(HEARTBEAT_EVENT, (beat) => {
89
+ void handler(beat);
90
+ });
91
+ }
92
+ // ---------------------------------------------------------------------------
93
+ // control plane (broadcast within this process)
94
+ // ---------------------------------------------------------------------------
95
+ async publishControl(msg) {
96
+ const stamped = msg.from ? msg : { ...msg, from: this.#instanceId };
97
+ this.#emitter.emit(CONTROL_EVENT, stamped);
98
+ }
99
+ onControl(handler) {
100
+ this.#emitter.on(CONTROL_EVENT, (msg) => handler(msg));
101
+ }
102
+ }
103
+ //# sourceMappingURL=event-emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../../../src/transports/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO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B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QACpF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,OAAsC;QAC9C,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,GAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,CAAC;CACF"}
@@ -24,9 +24,19 @@ export interface TransportContext {
24
24
  * actually selected — keeping those packages optional.
25
25
  */
26
26
  export type TransportFactory = (ctx: TransportContext) => Promise<Transport & Partial<ControlPlane>>;
27
- /** Options for the in-memory transport (no peer dependency). */
27
+ /** Options for the in-memory (test-only) transport (no peer dependency). */
28
28
  export interface MemoryTransportConfig {
29
29
  }
30
+ /** Options for the production in-process EventEmitter transport (no peer dependency). */
31
+ export interface EventEmitterTransportConfig {
32
+ /**
33
+ * The worker group this instance serves. Accepted for parity with the broker transports; handlers
34
+ * are matched by step name in-process, so it does not affect routing.
35
+ */
36
+ group?: string;
37
+ /** Stable id for this process (stamped on control `from` when a publisher leaves it unset). Default random. */
38
+ instanceId?: string;
39
+ }
30
40
  /** Options for the `@adonisjs/queue` transport. */
31
41
  export interface QueueTransportConfig {
32
42
  /**
@@ -69,8 +79,19 @@ export interface DbTransportConfig {
69
79
  instanceId?: string;
70
80
  }
71
81
  export declare const transports: {
72
- /** In-process transport + control plane (single-process, no extra infra). The default. */
82
+ /**
83
+ * The test-only in-process transport + control plane (the engine's default when no `transport` is
84
+ * named). Drives `dispatch` straight into the handler for deterministic tests — for a real
85
+ * single-process production app, prefer {@link transports.eventEmitter}.
86
+ */
73
87
  memory(_config?: MemoryTransportConfig): TransportFactory;
88
+ /**
89
+ * Production **in-process** transport + control plane backed by a single Node `EventEmitter`. Zero
90
+ * external infrastructure (no DB, no Redis, no broker) — a single-process app runs real durable
91
+ * workflows with nothing else to deploy. Decouples dispatch → worker → result over the event loop
92
+ * (mirroring a real broker), unlike the test-only {@link transports.memory}.
93
+ */
94
+ eventEmitter(config?: EventEmitterTransportConfig): TransportFactory;
74
95
  /** Run remote steps cross-process over `@adonisjs/queue`, using a connection from `config/queue.ts`. */
75
96
  queue(config?: QueueTransportConfig): TransportFactory;
76
97
  /** Run remote steps cross-process over the app's database, using `@adonisjs/lucid` — no broker. */
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/transports/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wFAAwF;IACxF,GAAG,EAAE;QACH,SAAS,EAAE;YAAE,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;SAAE,CAAC;QACxD,MAAM,EAAE;YAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;SAAE,CAAC;KACtD,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,gBAAgB,KAClB,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;AAEhD,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;CAErC;AAED,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,M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AA2B,GAAQ,gBAAgB;IAUxE,wGAAwG;mBAC1F,oBAAoB,GAAQ,gBAAgB;IAc1D,mGAAmG;gBACxF,iBAAiB,GAAQ,gBAAgB;CAgBrD,CAAC"}
@@ -18,10 +18,29 @@ async function resolveQueueAdapter(ctx, connection) {
18
18
  return typeof entry === 'function' ? entry : entry.resolver(ctx.app);
19
19
  }
20
20
  export const transports = {
21
- /** In-process transport + control plane (single-process, no extra infra). The default. */
21
+ /**
22
+ * The test-only in-process transport + control plane (the engine's default when no `transport` is
23
+ * named). Drives `dispatch` straight into the handler for deterministic tests — for a real
24
+ * single-process production app, prefer {@link transports.eventEmitter}.
25
+ */
22
26
  memory(_config = {}) {
23
27
  return async () => new InMemoryTransport();
24
28
  },
29
+ /**
30
+ * Production **in-process** transport + control plane backed by a single Node `EventEmitter`. Zero
31
+ * external infrastructure (no DB, no Redis, no broker) — a single-process app runs real durable
32
+ * workflows with nothing else to deploy. Decouples dispatch → worker → result over the event loop
33
+ * (mirroring a real broker), unlike the test-only {@link transports.memory}.
34
+ */
35
+ eventEmitter(config = {}) {
36
+ return async () => {
37
+ const { EventEmitterTransport } = await import('./event-emitter.js');
38
+ return new EventEmitterTransport({
39
+ ...(config.group !== undefined ? { group: config.group } : {}),
40
+ ...(config.instanceId !== undefined ? { instanceId: config.instanceId } : {}),
41
+ });
42
+ };
43
+ },
25
44
  /** Run remote steps cross-process over `@adonisjs/queue`, using a connection from `config/queue.ts`. */
26
45
  queue(config = {}) {
27
46
  return async (ctx) => {
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/transports/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAmGtE;;;;;GAKG;AACH,KAAK,UAAU,mBAAmB,CAChC,GAAqB,EACrB,UAAmB;IAEnB,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAGnC,OAAO,EAAE,E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AAC,CAAC,CAAC,EAAE,CAAC;gBACpE,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1E,GAAG,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7E,GAAG,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9E,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -27,4 +27,19 @@ export declare function discoverWorkflows(dir: string): Promise<DiscoveredWorkfl
27
27
  * registered metadata so the caller can log what was wired. Best-effort over a missing directory.
28
28
  */
29
29
  export declare function registerWorkflowsFromDir(engine: WorkflowEngine, dir: string): Promise<WorkflowMeta[]>;
30
+ /**
31
+ * The shape of the build-time barrel generated by the Assembler `init` hook
32
+ * (`@adonis-agora/durable/hooks/workflows`): a map of stable key → lazy module import, e.g.
33
+ * `{ Charge: () => import('#workflows/charge_workflow') }`. The exact key is irrelevant here — we
34
+ * register every `@Workflow`-decorated export of every module, identical to the runtime scan.
35
+ */
36
+ export type WorkflowsBarrel = Record<string, () => Promise<Record<string, unknown>>>;
37
+ /**
38
+ * Register every `@Workflow` class reachable from a generated {@link WorkflowsBarrel}, by awaiting
39
+ * each lazy module import and registering each decorated export — the build-time equivalent of
40
+ * {@link registerWorkflowsFromDir}, with no runtime `readdir`. Each module is imported once and each
41
+ * decorated class registered once (deduped), so a class re-exported from several modules is safe.
42
+ * Returns the registered metadata so the caller can log what was wired.
43
+ */
44
+ export declare function registerWorkflowsFromBarrel(engine: WorkflowEngine, barrel: WorkflowsBarrel): Promise<WorkflowMeta[]>;
30
45
  //# sourceMappingURL=workflow-discovery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-discovery.d.ts","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAExF,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,aAAa,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAgBnF;AAUD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuBlF;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB"}
1
+ {"version":3,"file":"workflow-discovery.d.ts","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAExF,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,aAAa,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAgBnF;AAUD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuBlF;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAErF;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,YAAY,EAAE,CAAC,CAezB"}
@@ -75,4 +75,29 @@ export async function registerWorkflowsFromDir(engine, dir) {
75
75
  registerWorkflowClass(engine, cls);
76
76
  return discovered.map((d) => d.meta);
77
77
  }
78
+ /**
79
+ * Register every `@Workflow` class reachable from a generated {@link WorkflowsBarrel}, by awaiting
80
+ * each lazy module import and registering each decorated export — the build-time equivalent of
81
+ * {@link registerWorkflowsFromDir}, with no runtime `readdir`. Each module is imported once and each
82
+ * decorated class registered once (deduped), so a class re-exported from several modules is safe.
83
+ * Returns the registered metadata so the caller can log what was wired.
84
+ */
85
+ export async function registerWorkflowsFromBarrel(engine, barrel) {
86
+ const registered = [];
87
+ const seen = new Set();
88
+ for (const load of Object.values(barrel)) {
89
+ const mod = await load();
90
+ for (const exported of Object.values(mod)) {
91
+ if (seen.has(exported))
92
+ continue;
93
+ const meta = workflowMeta(exported);
94
+ if (!meta)
95
+ continue;
96
+ seen.add(exported);
97
+ registerWorkflowClass(engine, exported);
98
+ registered.push(meta);
99
+ }
100
+ }
101
+ return registered;
102
+ }
78
103
  //# sourceMappingURL=workflow-discovery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-discovery.js","sourceRoot":"","sources":["../../src/workflow-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAk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C;YACpC,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACnB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACxC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -8,6 +8,10 @@ import { defineConfig, transports } from '@adonis-agora/durable'
8
8
  * maps below; each driver's peer dependency is imported lazily, only when selected. The default is
9
9
  * the in-process `memory` transport + the in-memory store — single-process, no extra infrastructure.
10
10
  *
11
+ * For a single-process PRODUCTION app with NO external infra, select the `event-emitter` transport:
12
+ * step handlers run in this same process over a Node EventEmitter (no DB, no Redis, no broker). The
13
+ * `memory` transport is test-only.
14
+ *
11
15
  * For cross-process / production, select the `queue` (@adonisjs/queue) or `db` (@adonisjs/lucid)
12
16
  * transport, and the `lucid` store, then run `node ace migration:run`:
13
17
  *
@@ -17,7 +21,8 @@ import { defineConfig, transports } from '@adonis-agora/durable'
17
21
  * export default defineConfig({
18
22
  * transport: 'queue',
19
23
  * transports: {
20
- * memory: transports.memory(),
24
+ * // single-process production, no external infra:
25
+ * 'event-emitter': transports.eventEmitter(),
21
26
  * // `connection` names an adapter from config/queue.ts (configure @adonisjs/queue first):
22
27
  * queue: transports.queue({ connection: 'redis', group: 'durable' }),
23
28
  * db: transports.db(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/durable",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Durable cross-app workflows for AdonisJS — deterministic replay engine, AdonisJS binding, ace commands, dashboard, OpenTelemetry, Telescope, testing harness and Redis admission, all in one package. Part of the Agora ecosystem.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,6 +53,11 @@
53
53
  "import": "./dist/src/testing-kit/index.js",
54
54
  "default": "./dist/src/testing-kit/index.js"
55
55
  },
56
+ "./hooks/workflows": {
57
+ "types": "./dist/src/hooks/workflows.d.ts",
58
+ "import": "./dist/src/hooks/workflows.js",
59
+ "default": "./dist/src/hooks/workflows.js"
60
+ },
56
61
  "./admission-redis": {
57
62
  "types": "./dist/src/admission-redis/index.d.ts",
58
63
  "import": "./dist/src/admission-redis/index.js",
@@ -84,6 +89,7 @@
84
89
  "zod": "^3.23.0"
85
90
  },
86
91
  "peerDependencies": {
92
+ "@adonisjs/assembler": "^8.4.0",
87
93
  "@adonisjs/core": "^7.3.0",
88
94
  "@adonisjs/lucid": "^22.4.0",
89
95
  "@adonisjs/queue": "^0.6.0",
@@ -94,6 +100,9 @@
94
100
  "vitest": "^3.0.0"
95
101
  },
96
102
  "peerDependenciesMeta": {
103
+ "@adonisjs/assembler": {
104
+ "optional": true
105
+ },
97
106
  "@adonisjs/lucid": {
98
107
  "optional": true
99
108
  },