@nwire/forge 0.9.2 → 0.10.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 (291) hide show
  1. package/README.md +133 -155
  2. package/dist/foundation.d.ts +0 -13
  3. package/dist/foundation.js +2 -13
  4. package/dist/framework-events.d.ts +51 -54
  5. package/dist/framework-events.js +18 -65
  6. package/dist/{cli-runner.d.ts → helpers/cli-runner.d.ts} +2 -3
  7. package/dist/{cli-runner.js → helpers/cli-runner.js} +11 -27
  8. package/dist/{public-marker.d.ts → helpers/public-marker.d.ts} +0 -1
  9. package/dist/{public-marker.js → helpers/public-marker.js} +0 -1
  10. package/dist/{response.d.ts → helpers/response.d.ts} +0 -1
  11. package/dist/{response.js → helpers/response.js} +0 -1
  12. package/dist/helpers/retry-helpers.d.ts +22 -0
  13. package/dist/helpers/retry-helpers.js +43 -0
  14. package/dist/{validate.d.ts → helpers/validate.d.ts} +0 -1
  15. package/dist/{validate.js → helpers/validate.js} +0 -1
  16. package/dist/index.d.ts +42 -48
  17. package/dist/index.js +47 -55
  18. package/dist/{event-message.d.ts → messages/event-message.d.ts} +0 -1
  19. package/dist/{event-message.js → messages/event-message.js} +0 -1
  20. package/dist/{dev-logger.d.ts → observability/dev-logger.d.ts} +2 -2
  21. package/dist/{dev-logger.js → observability/dev-logger.js} +0 -30
  22. package/dist/{define-action.d.ts → primitives/define-action.d.ts} +0 -1
  23. package/dist/{define-action.js → primitives/define-action.js} +0 -1
  24. package/dist/{define-actor.d.ts → primitives/define-actor.d.ts} +0 -1
  25. package/dist/{define-actor.js → primitives/define-actor.js} +0 -1
  26. package/dist/{define-cron.d.ts → primitives/define-cron.d.ts} +0 -1
  27. package/dist/{define-cron.js → primitives/define-cron.js} +0 -1
  28. package/dist/{define-error.d.ts → primitives/define-error.d.ts} +0 -1
  29. package/dist/{define-error.js → primitives/define-error.js} +0 -1
  30. package/dist/{define-external-call.d.ts → primitives/define-external-call.d.ts} +0 -1
  31. package/dist/{define-external-call.js → primitives/define-external-call.js} +0 -1
  32. package/dist/{define-handler.d.ts → primitives/define-handler.d.ts} +29 -2
  33. package/dist/{define-handler.js → primitives/define-handler.js} +13 -2
  34. package/dist/{define-inbound-webhook.d.ts → primitives/define-inbound-webhook.d.ts} +1 -2
  35. package/dist/{define-inbound-webhook.js → primitives/define-inbound-webhook.js} +1 -2
  36. package/dist/{define-inbox.d.ts → primitives/define-inbox.d.ts} +0 -1
  37. package/dist/{define-inbox.js → primitives/define-inbox.js} +0 -1
  38. package/dist/{define-outbox.d.ts → primitives/define-outbox.d.ts} +0 -1
  39. package/dist/{define-outbox.js → primitives/define-outbox.js} +0 -1
  40. package/dist/{define-projection.d.ts → primitives/define-projection.d.ts} +0 -1
  41. package/dist/{define-projection.js → primitives/define-projection.js} +0 -1
  42. package/dist/{define-query.d.ts → primitives/define-query.d.ts} +1 -2
  43. package/dist/{define-query.js → primitives/define-query.js} +1 -2
  44. package/dist/{define-schema.d.ts → primitives/define-schema.d.ts} +1 -2
  45. package/dist/{define-schema.js → primitives/define-schema.js} +1 -2
  46. package/dist/{define-upcaster.d.ts → primitives/define-upcaster.d.ts} +0 -1
  47. package/dist/{define-upcaster.js → primitives/define-upcaster.js} +0 -1
  48. package/dist/{define-workflow.d.ts → primitives/define-workflow.d.ts} +2 -3
  49. package/dist/{define-workflow.js → primitives/define-workflow.js} +2 -3
  50. package/dist/runtime/create-forge-app.d.ts +64 -0
  51. package/dist/runtime/create-forge-app.js +78 -0
  52. package/dist/runtime/forge-dispatcher.d.ts +148 -0
  53. package/dist/{runtime.js → runtime/forge-dispatcher.js} +242 -571
  54. package/dist/runtime/forge-plugin.d.ts +59 -0
  55. package/dist/runtime/forge-plugin.js +121 -0
  56. package/dist/runtime/forge-types.d.ts +204 -0
  57. package/dist/runtime/forge-types.js +5 -0
  58. package/dist/{actor-store.d.ts → stores/actor-store.d.ts} +1 -2
  59. package/dist/{actor-store.js → stores/actor-store.js} +0 -1
  60. package/dist/{idempotency-store.d.ts → stores/idempotency-store.d.ts} +0 -1
  61. package/dist/{idempotency-store.js → stores/idempotency-store.js} +0 -1
  62. package/dist/{projection-store.d.ts → stores/projection-store.d.ts} +0 -1
  63. package/dist/{projection-store.js → stores/projection-store.js} +0 -1
  64. package/dist/{workflow-timer-store.d.ts → stores/workflow-timer-store.d.ts} +0 -1
  65. package/dist/{workflow-timer-store.js → stores/workflow-timer-store.js} +0 -1
  66. package/package.json +11 -11
  67. package/dist/__tests__/action-hooks.test.d.ts +0 -8
  68. package/dist/__tests__/action-hooks.test.d.ts.map +0 -1
  69. package/dist/__tests__/action-hooks.test.js +0 -95
  70. package/dist/__tests__/action-hooks.test.js.map +0 -1
  71. package/dist/__tests__/actor-methods.test.d.ts +0 -9
  72. package/dist/__tests__/actor-methods.test.d.ts.map +0 -1
  73. package/dist/__tests__/actor-methods.test.js +0 -210
  74. package/dist/__tests__/actor-methods.test.js.map +0 -1
  75. package/dist/__tests__/actor-schema-bound.test.d.ts +0 -6
  76. package/dist/__tests__/actor-schema-bound.test.d.ts.map +0 -1
  77. package/dist/__tests__/actor-schema-bound.test.js +0 -112
  78. package/dist/__tests__/actor-schema-bound.test.js.map +0 -1
  79. package/dist/__tests__/actor-workflow-hooks.test.d.ts +0 -8
  80. package/dist/__tests__/actor-workflow-hooks.test.d.ts.map +0 -1
  81. package/dist/__tests__/actor-workflow-hooks.test.js +0 -106
  82. package/dist/__tests__/actor-workflow-hooks.test.js.map +0 -1
  83. package/dist/__tests__/app-capabilities.test.d.ts +0 -19
  84. package/dist/__tests__/app-capabilities.test.d.ts.map +0 -1
  85. package/dist/__tests__/app-capabilities.test.js +0 -57
  86. package/dist/__tests__/app-capabilities.test.js.map +0 -1
  87. package/dist/__tests__/cli-runner.test.d.ts +0 -6
  88. package/dist/__tests__/cli-runner.test.d.ts.map +0 -1
  89. package/dist/__tests__/cli-runner.test.js +0 -158
  90. package/dist/__tests__/cli-runner.test.js.map +0 -1
  91. package/dist/__tests__/create-app.test.d.ts +0 -18
  92. package/dist/__tests__/create-app.test.d.ts.map +0 -1
  93. package/dist/__tests__/create-app.test.js +0 -189
  94. package/dist/__tests__/create-app.test.js.map +0 -1
  95. package/dist/__tests__/cross-service-bus.test.d.ts +0 -8
  96. package/dist/__tests__/cross-service-bus.test.d.ts.map +0 -1
  97. package/dist/__tests__/cross-service-bus.test.js +0 -139
  98. package/dist/__tests__/cross-service-bus.test.js.map +0 -1
  99. package/dist/__tests__/define-schema.test.d.ts +0 -5
  100. package/dist/__tests__/define-schema.test.d.ts.map +0 -1
  101. package/dist/__tests__/define-schema.test.js +0 -83
  102. package/dist/__tests__/define-schema.test.js.map +0 -1
  103. package/dist/__tests__/dev-logger.test.d.ts +0 -9
  104. package/dist/__tests__/dev-logger.test.d.ts.map +0 -1
  105. package/dist/__tests__/dev-logger.test.js +0 -126
  106. package/dist/__tests__/dev-logger.test.js.map +0 -1
  107. package/dist/__tests__/external-call.test.d.ts +0 -14
  108. package/dist/__tests__/external-call.test.d.ts.map +0 -1
  109. package/dist/__tests__/external-call.test.js +0 -99
  110. package/dist/__tests__/external-call.test.js.map +0 -1
  111. package/dist/__tests__/framework-events.test.d.ts +0 -13
  112. package/dist/__tests__/framework-events.test.d.ts.map +0 -1
  113. package/dist/__tests__/framework-events.test.js +0 -204
  114. package/dist/__tests__/framework-events.test.js.map +0 -1
  115. package/dist/__tests__/inline-handler.test.d.ts +0 -8
  116. package/dist/__tests__/inline-handler.test.d.ts.map +0 -1
  117. package/dist/__tests__/inline-handler.test.js +0 -101
  118. package/dist/__tests__/inline-handler.test.js.map +0 -1
  119. package/dist/__tests__/lifecycle-logging.test.d.ts +0 -12
  120. package/dist/__tests__/lifecycle-logging.test.d.ts.map +0 -1
  121. package/dist/__tests__/lifecycle-logging.test.js +0 -114
  122. package/dist/__tests__/lifecycle-logging.test.js.map +0 -1
  123. package/dist/__tests__/middleware.test.d.ts +0 -7
  124. package/dist/__tests__/middleware.test.d.ts.map +0 -1
  125. package/dist/__tests__/middleware.test.js +0 -109
  126. package/dist/__tests__/middleware.test.js.map +0 -1
  127. package/dist/__tests__/module-needs.test.d.ts +0 -10
  128. package/dist/__tests__/module-needs.test.d.ts.map +0 -1
  129. package/dist/__tests__/module-needs.test.js +0 -77
  130. package/dist/__tests__/module-needs.test.js.map +0 -1
  131. package/dist/__tests__/module-topo-sort.test.d.ts +0 -15
  132. package/dist/__tests__/module-topo-sort.test.d.ts.map +0 -1
  133. package/dist/__tests__/module-topo-sort.test.js +0 -105
  134. package/dist/__tests__/module-topo-sort.test.js.map +0 -1
  135. package/dist/__tests__/multi-tenancy.test.d.ts +0 -10
  136. package/dist/__tests__/multi-tenancy.test.d.ts.map +0 -1
  137. package/dist/__tests__/multi-tenancy.test.js +0 -122
  138. package/dist/__tests__/multi-tenancy.test.js.map +0 -1
  139. package/dist/__tests__/needs-topology.test.d.ts +0 -11
  140. package/dist/__tests__/needs-topology.test.d.ts.map +0 -1
  141. package/dist/__tests__/needs-topology.test.js +0 -82
  142. package/dist/__tests__/needs-topology.test.js.map +0 -1
  143. package/dist/__tests__/plugin-app-narrow.test.d.ts +0 -12
  144. package/dist/__tests__/plugin-app-narrow.test.d.ts.map +0 -1
  145. package/dist/__tests__/plugin-app-narrow.test.js +0 -77
  146. package/dist/__tests__/plugin-app-narrow.test.js.map +0 -1
  147. package/dist/__tests__/plugin-closure.test.d.ts +0 -15
  148. package/dist/__tests__/plugin-closure.test.d.ts.map +0 -1
  149. package/dist/__tests__/plugin-closure.test.js +0 -140
  150. package/dist/__tests__/plugin-closure.test.js.map +0 -1
  151. package/dist/__tests__/plugin-stress.test.d.ts +0 -21
  152. package/dist/__tests__/plugin-stress.test.d.ts.map +0 -1
  153. package/dist/__tests__/plugin-stress.test.js +0 -203
  154. package/dist/__tests__/plugin-stress.test.js.map +0 -1
  155. package/dist/__tests__/plugin.test.d.ts +0 -10
  156. package/dist/__tests__/plugin.test.d.ts.map +0 -1
  157. package/dist/__tests__/plugin.test.js +0 -225
  158. package/dist/__tests__/plugin.test.js.map +0 -1
  159. package/dist/__tests__/primitives.test.d.ts +0 -9
  160. package/dist/__tests__/primitives.test.d.ts.map +0 -1
  161. package/dist/__tests__/primitives.test.js +0 -434
  162. package/dist/__tests__/primitives.test.js.map +0 -1
  163. package/dist/__tests__/production-readiness.test.d.ts +0 -22
  164. package/dist/__tests__/production-readiness.test.d.ts.map +0 -1
  165. package/dist/__tests__/production-readiness.test.js +0 -196
  166. package/dist/__tests__/production-readiness.test.js.map +0 -1
  167. package/dist/__tests__/provider.test.d.ts +0 -6
  168. package/dist/__tests__/provider.test.d.ts.map +0 -1
  169. package/dist/__tests__/provider.test.js +0 -122
  170. package/dist/__tests__/provider.test.js.map +0 -1
  171. package/dist/__tests__/public-marker.test.d.ts +0 -7
  172. package/dist/__tests__/public-marker.test.d.ts.map +0 -1
  173. package/dist/__tests__/public-marker.test.js +0 -58
  174. package/dist/__tests__/public-marker.test.js.map +0 -1
  175. package/dist/__tests__/retry-dlq.test.d.ts +0 -6
  176. package/dist/__tests__/retry-dlq.test.d.ts.map +0 -1
  177. package/dist/__tests__/retry-dlq.test.js +0 -68
  178. package/dist/__tests__/retry-dlq.test.js.map +0 -1
  179. package/dist/__tests__/validate.test.d.ts +0 -5
  180. package/dist/__tests__/validate.test.d.ts.map +0 -1
  181. package/dist/__tests__/validate.test.js +0 -53
  182. package/dist/__tests__/validate.test.js.map +0 -1
  183. package/dist/__tests__/workflow-saga.test.d.ts +0 -7
  184. package/dist/__tests__/workflow-saga.test.d.ts.map +0 -1
  185. package/dist/__tests__/workflow-saga.test.js +0 -265
  186. package/dist/__tests__/workflow-saga.test.js.map +0 -1
  187. package/dist/actor-store.d.ts.map +0 -1
  188. package/dist/actor-store.js.map +0 -1
  189. package/dist/cli-runner.d.ts.map +0 -1
  190. package/dist/cli-runner.js.map +0 -1
  191. package/dist/create-app.d.ts +0 -146
  192. package/dist/create-app.d.ts.map +0 -1
  193. package/dist/create-app.js +0 -703
  194. package/dist/create-app.js.map +0 -1
  195. package/dist/define-action.d.ts.map +0 -1
  196. package/dist/define-action.js.map +0 -1
  197. package/dist/define-actor.d.ts.map +0 -1
  198. package/dist/define-actor.js.map +0 -1
  199. package/dist/define-app.d.ts +0 -104
  200. package/dist/define-app.d.ts.map +0 -1
  201. package/dist/define-app.js +0 -49
  202. package/dist/define-app.js.map +0 -1
  203. package/dist/define-cron.d.ts.map +0 -1
  204. package/dist/define-cron.js.map +0 -1
  205. package/dist/define-error.d.ts.map +0 -1
  206. package/dist/define-error.js.map +0 -1
  207. package/dist/define-external-call.d.ts.map +0 -1
  208. package/dist/define-external-call.js.map +0 -1
  209. package/dist/define-handler.d.ts.map +0 -1
  210. package/dist/define-handler.js.map +0 -1
  211. package/dist/define-inbound-webhook.d.ts.map +0 -1
  212. package/dist/define-inbound-webhook.js.map +0 -1
  213. package/dist/define-inbox.d.ts.map +0 -1
  214. package/dist/define-inbox.js.map +0 -1
  215. package/dist/define-initializer.d.ts +0 -54
  216. package/dist/define-initializer.d.ts.map +0 -1
  217. package/dist/define-initializer.js +0 -38
  218. package/dist/define-initializer.js.map +0 -1
  219. package/dist/define-middleware.d.ts +0 -8
  220. package/dist/define-middleware.d.ts.map +0 -1
  221. package/dist/define-middleware.js +0 -8
  222. package/dist/define-middleware.js.map +0 -1
  223. package/dist/define-model.d.ts +0 -10
  224. package/dist/define-model.d.ts.map +0 -1
  225. package/dist/define-model.js +0 -13
  226. package/dist/define-model.js.map +0 -1
  227. package/dist/define-module.d.ts +0 -160
  228. package/dist/define-module.d.ts.map +0 -1
  229. package/dist/define-module.js +0 -63
  230. package/dist/define-module.js.map +0 -1
  231. package/dist/define-outbox.d.ts.map +0 -1
  232. package/dist/define-outbox.js.map +0 -1
  233. package/dist/define-plugin.d.ts +0 -195
  234. package/dist/define-plugin.d.ts.map +0 -1
  235. package/dist/define-plugin.js +0 -220
  236. package/dist/define-plugin.js.map +0 -1
  237. package/dist/define-projection.d.ts.map +0 -1
  238. package/dist/define-projection.js.map +0 -1
  239. package/dist/define-provider.d.ts +0 -49
  240. package/dist/define-provider.d.ts.map +0 -1
  241. package/dist/define-provider.js +0 -45
  242. package/dist/define-provider.js.map +0 -1
  243. package/dist/define-query.d.ts.map +0 -1
  244. package/dist/define-query.js.map +0 -1
  245. package/dist/define-resolver.d.ts +0 -111
  246. package/dist/define-resolver.d.ts.map +0 -1
  247. package/dist/define-resolver.js +0 -146
  248. package/dist/define-resolver.js.map +0 -1
  249. package/dist/define-schema.d.ts.map +0 -1
  250. package/dist/define-schema.js.map +0 -1
  251. package/dist/define-upcaster.d.ts.map +0 -1
  252. package/dist/define-upcaster.js.map +0 -1
  253. package/dist/define-workflow.d.ts.map +0 -1
  254. package/dist/define-workflow.js.map +0 -1
  255. package/dist/dev-logger.d.ts.map +0 -1
  256. package/dist/dev-logger.js.map +0 -1
  257. package/dist/event-message.d.ts.map +0 -1
  258. package/dist/event-message.js.map +0 -1
  259. package/dist/foundation.d.ts.map +0 -1
  260. package/dist/foundation.js.map +0 -1
  261. package/dist/framework-event-bus.d.ts +0 -13
  262. package/dist/framework-event-bus.d.ts.map +0 -1
  263. package/dist/framework-event-bus.js +0 -13
  264. package/dist/framework-event-bus.js.map +0 -1
  265. package/dist/framework-events.d.ts.map +0 -1
  266. package/dist/framework-events.js.map +0 -1
  267. package/dist/idempotency-store.d.ts.map +0 -1
  268. package/dist/idempotency-store.js.map +0 -1
  269. package/dist/index.d.ts.map +0 -1
  270. package/dist/index.js.map +0 -1
  271. package/dist/module-surface.d.ts +0 -47
  272. package/dist/module-surface.d.ts.map +0 -1
  273. package/dist/module-surface.js +0 -65
  274. package/dist/module-surface.js.map +0 -1
  275. package/dist/projection-store.d.ts.map +0 -1
  276. package/dist/projection-store.js.map +0 -1
  277. package/dist/public-marker.d.ts.map +0 -1
  278. package/dist/public-marker.js.map +0 -1
  279. package/dist/response.d.ts.map +0 -1
  280. package/dist/response.js.map +0 -1
  281. package/dist/runtime.d.ts +0 -621
  282. package/dist/runtime.d.ts.map +0 -1
  283. package/dist/runtime.js.map +0 -1
  284. package/dist/validate.d.ts.map +0 -1
  285. package/dist/validate.js.map +0 -1
  286. package/dist/when.d.ts +0 -101
  287. package/dist/when.d.ts.map +0 -1
  288. package/dist/when.js +0 -57
  289. package/dist/when.js.map +0 -1
  290. package/dist/workflow-timer-store.d.ts.map +0 -1
  291. package/dist/workflow-timer-store.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ /**
2
+ * `forgePlugin` — the foundation-form delivery of forge's CQRS engine.
3
+ *
4
+ * Used two ways:
5
+ *
6
+ * // Default stores (InMemory*):
7
+ * createApp({ plugins: [forgePlugin, ...] })
8
+ *
9
+ * // Custom stores / cross-service bus / persistent timers:
10
+ * createApp({ plugins: [createForgePlugin({ actorStore, bus }), ...] })
11
+ *
12
+ * Setup work:
13
+ * 1. Construct a `ForgeDispatcher(runtime, opts)`.
14
+ * 2. Bind it on the container as `"forge.dispatcher"`; consumer code
15
+ * (and forge.createApp's app-handle delegators) resolves it from
16
+ * there to call `dispatch / publish / fireDueTimers / …`.
17
+ * 3. Materialise the Action* / Event* framework-hook slots forge's
18
+ * module augmentation declares — kernel pre-instantiates only
19
+ * App* / Plugin* / Wire* slots; forge's domain slots come in via
20
+ * the plugin so a non-forge app's runtime stays uncluttered.
21
+ * 4. Pin the action handler chain step on `runtime.dispatchHook$` at
22
+ * priority `-Infinity` so user-registered `runtime.use()` middleware
23
+ * stays strictly OUTSIDE the handler invocation.
24
+ *
25
+ * Dispose work:
26
+ * - Best-effort cleanup of the in-memory workflow timer scheduler if
27
+ * the dispatcher started one. Persistent stores release through
28
+ * their own `bind({ dispose })` registrations.
29
+ */
30
+ import type { PluginDefinition } from "@nwire/app";
31
+ import { type ForgeDispatcherOptions } from "./forge-dispatcher.js";
32
+ /** Canonical container binding name for the forge dispatcher. */
33
+ export declare const FORGE_DISPATCHER_BINDING: "forge.dispatcher";
34
+ /** Capability bindings — handler / resolver ctx resolves these by name. */
35
+ export declare const FORGE_EXECUTE_BINDING: "execute";
36
+ export declare const FORGE_SEND_BINDING: "send";
37
+ export declare const FORGE_USE_PROJECTION_BINDING: "useProjection";
38
+ /**
39
+ * Default forge plugin — uses in-memory stores for everything.
40
+ * Suitable for tests, demos, and single-process apps. For custom
41
+ * stores or a cross-service bus, use `createForgePlugin(opts)`.
42
+ */
43
+ export declare const forgePlugin: PluginDefinition;
44
+ /**
45
+ * Configurable forge plugin. Pass:
46
+ * - durable stores (actorStore, projectionStore, deadLetterSink, …)
47
+ * - a cross-service EventBus to bridge in-process events out
48
+ * - domain registrations (actors, workflows, projections, queries,
49
+ * externalCalls) — picked up at AppBooting and forwarded to the
50
+ * dispatcher so consumers don't need to wire them manually.
51
+ */
52
+ export interface ForgePluginOptions extends ForgeDispatcherOptions {
53
+ readonly actors?: readonly any[];
54
+ readonly workflows?: readonly any[];
55
+ readonly projections?: readonly any[];
56
+ readonly queries?: readonly any[];
57
+ readonly externalCalls?: readonly any[];
58
+ }
59
+ export declare function createForgePlugin(options?: ForgePluginOptions): PluginDefinition;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * `forgePlugin` — the foundation-form delivery of forge's CQRS engine.
3
+ *
4
+ * Used two ways:
5
+ *
6
+ * // Default stores (InMemory*):
7
+ * createApp({ plugins: [forgePlugin, ...] })
8
+ *
9
+ * // Custom stores / cross-service bus / persistent timers:
10
+ * createApp({ plugins: [createForgePlugin({ actorStore, bus }), ...] })
11
+ *
12
+ * Setup work:
13
+ * 1. Construct a `ForgeDispatcher(runtime, opts)`.
14
+ * 2. Bind it on the container as `"forge.dispatcher"`; consumer code
15
+ * (and forge.createApp's app-handle delegators) resolves it from
16
+ * there to call `dispatch / publish / fireDueTimers / …`.
17
+ * 3. Materialise the Action* / Event* framework-hook slots forge's
18
+ * module augmentation declares — kernel pre-instantiates only
19
+ * App* / Plugin* / Wire* slots; forge's domain slots come in via
20
+ * the plugin so a non-forge app's runtime stays uncluttered.
21
+ * 4. Pin the action handler chain step on `runtime.dispatchHook$` at
22
+ * priority `-Infinity` so user-registered `runtime.use()` middleware
23
+ * stays strictly OUTSIDE the handler invocation.
24
+ *
25
+ * Dispose work:
26
+ * - Best-effort cleanup of the in-memory workflow timer scheduler if
27
+ * the dispatcher started one. Persistent stores release through
28
+ * their own `bind({ dispose })` registrations.
29
+ */
30
+ import { ForgeDispatcher } from "./forge-dispatcher.js";
31
+ /** Canonical container binding name for the forge dispatcher. */
32
+ export const FORGE_DISPATCHER_BINDING = "forge.dispatcher";
33
+ /** Capability bindings — handler / resolver ctx resolves these by name. */
34
+ export const FORGE_EXECUTE_BINDING = "execute";
35
+ export const FORGE_SEND_BINDING = "send";
36
+ export const FORGE_USE_PROJECTION_BINDING = "useProjection";
37
+ /**
38
+ * Default forge plugin — uses in-memory stores for everything.
39
+ * Suitable for tests, demos, and single-process apps. For custom
40
+ * stores or a cross-service bus, use `createForgePlugin(opts)`.
41
+ */
42
+ export const forgePlugin = createForgePlugin();
43
+ export function createForgePlugin(options = {}) {
44
+ return {
45
+ name: "forge",
46
+ setup({ runtime, bind, dispose, hooks }) {
47
+ const dispatcher = new ForgeDispatcher(runtime, options);
48
+ // 1. Bind the dispatcher on the container so the app handle's
49
+ // `dispatch / publish / request / …` delegators can resolve it.
50
+ bind(FORGE_DISPATCHER_BINDING, dispatcher);
51
+ // 1b. Bind capability factories — what handlers / HTTP resolvers
52
+ // reach for via `ctx.resolve("execute" | "send" | "useProjection")`.
53
+ const execute = (action, input, envelope) => dispatcher.dispatch(action, input, envelope);
54
+ const send = (action, input, envelope) => {
55
+ void dispatcher.dispatch(action, input, envelope);
56
+ return Promise.resolve();
57
+ };
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ const useProjection = (query, input, tenant = "") => dispatcher.query(query.name, input, tenant);
60
+ bind(FORGE_EXECUTE_BINDING, () => execute);
61
+ bind(FORGE_SEND_BINDING, () => send);
62
+ bind(FORGE_USE_PROJECTION_BINDING, () => useProjection);
63
+ // 2. Materialise forge's Action* / Event* framework-hook slots.
64
+ // The kernel pre-instantiates App* / Plugin* / Wire*; forge's
65
+ // augmentation gets installed here so a runtime without forge
66
+ // doesn't carry empty Action*/Event* hooks.
67
+ for (const slot of ["ActionDispatching", "ActionCompleted", "ActionFailed", "EventRecording", "EventRecorded"]) {
68
+ runtime.defineHook(slot);
69
+ }
70
+ // 3. Pin the dispatch chain step. priority -Infinity keeps every
71
+ // user `runtime.use()` middleware strictly outside it; the
72
+ // pinned step calls the dispatcher's prepared `coreFn` and
73
+ // writes the result back onto `hctx.result`.
74
+ runtime.dispatchHook$.use(async (hctx, next) => {
75
+ hctx.result = await hctx.coreFn();
76
+ await next();
77
+ }, { name: "handler", priority: -Infinity });
78
+ // 3a. Forward runtime-registered forge handlers to the dispatcher
79
+ // at AppBooting time. createApp's `handlers` option lands them on
80
+ // runtime.handlers; the dispatcher needs its own registration to
81
+ // route by action name. We pick them up by checking for `$kind
82
+ // === "handler"` (forge HandlerDefinition shape) — anything else
83
+ // stays on the runtime side.
84
+ hooks.AppBooting.use(async (_, next) => {
85
+ // Forward runtime-registered forge handlers to the dispatcher.
86
+ for (const name of runtime.listHandlers()) {
87
+ const def = runtime.getHandler(name);
88
+ if (def?.$kind === "handler") {
89
+ dispatcher.registerActionHandler(def);
90
+ }
91
+ }
92
+ // Register plugin-option domain primitives.
93
+ for (const actor of options.actors ?? []) {
94
+ dispatcher.registerActor(actor);
95
+ }
96
+ for (const workflow of options.workflows ?? []) {
97
+ dispatcher.registerWorkflow(workflow);
98
+ }
99
+ for (const projection of options.projections ?? []) {
100
+ dispatcher.registerProjection(projection);
101
+ }
102
+ for (const query of options.queries ?? []) {
103
+ dispatcher.registerQuery(query);
104
+ }
105
+ for (const call of options.externalCalls ?? []) {
106
+ dispatcher.registerExternalCall(call);
107
+ }
108
+ await next();
109
+ }, { name: "forge.forward-handlers", priority: 1_000_000 });
110
+ // 4. Graceful shutdown — close any internally-managed schedulers.
111
+ // The in-memory timer store has no thread to stop; durable
112
+ // adapters that DO own threads pass themselves in via opts and
113
+ // handle their own dispose via `bind(name, store, { dispose })`.
114
+ dispose(async () => {
115
+ // No-op for in-memory; reserved for future timer-scheduler
116
+ // ownership semantics.
117
+ void dispatcher;
118
+ });
119
+ },
120
+ };
121
+ }
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Forge-internal type shapes — per-domain hook contexts, dispatch options,
3
+ * and the widened telemetry union forge emits.
4
+ */
5
+ import type { MessageEnvelope } from "@nwire/envelope";
6
+ import type { SerializedError, HookStepTelemetry } from "@nwire/app";
7
+ import type { ActionDefinition } from "../primitives/define-action.js";
8
+ import type { ActorDefinition } from "../primitives/define-actor.js";
9
+ import type { WorkflowDefinition } from "../primitives/define-workflow.js";
10
+ import type { HandlerContext } from "../primitives/define-handler.js";
11
+ import type { EventMessage } from "../messages/event-message.js";
12
+ export interface DispatchOptions {
13
+ readonly signal?: AbortSignal;
14
+ }
15
+ /** `action.before:<name>` hook ctx. Set `vetoed = true` to cleanly skip the handler. */
16
+ export interface ActionBeforeHookCtx {
17
+ readonly action: ActionDefinition;
18
+ readonly input: unknown;
19
+ readonly ctx: HandlerContext;
20
+ vetoed?: boolean;
21
+ }
22
+ /** `action.after:<name>` hook ctx — observation only. */
23
+ export interface ActionAfterHookCtx {
24
+ readonly action: ActionDefinition;
25
+ readonly input: unknown;
26
+ readonly result: unknown;
27
+ readonly durationMs: number;
28
+ }
29
+ /** `actor.transition:<name>` hook ctx — fires after the actor's state has been saved. */
30
+ export interface ActorTransitionHookCtx {
31
+ readonly actor: ActorDefinition;
32
+ readonly key: string;
33
+ readonly fromState: string;
34
+ readonly toState: string;
35
+ readonly triggeringEvent: EventMessage;
36
+ readonly envelope: MessageEnvelope;
37
+ }
38
+ /** `workflow.fire:<name>` hook ctx — wraps every saga invocation. */
39
+ export interface WorkflowFireHookCtx {
40
+ readonly workflow: WorkflowDefinition;
41
+ readonly event: EventMessage;
42
+ readonly envelope: MessageEnvelope;
43
+ readonly correlationKey: string;
44
+ }
45
+ export type ForgeTelemetry = HookStepTelemetry | {
46
+ kind: "action.dispatched";
47
+ action: string;
48
+ input: unknown;
49
+ envelope: MessageEnvelope;
50
+ appName: string;
51
+ ts: string;
52
+ } | {
53
+ kind: "action.completed";
54
+ action: string;
55
+ durationMs: number;
56
+ emittedEvents: string[];
57
+ envelope: MessageEnvelope;
58
+ appName: string;
59
+ ts: string;
60
+ } | {
61
+ kind: "action.failed";
62
+ action: string;
63
+ attempt: number;
64
+ maxAttempts: number;
65
+ willRetry: boolean;
66
+ error: SerializedError;
67
+ envelope: MessageEnvelope;
68
+ appName: string;
69
+ ts: string;
70
+ } | {
71
+ kind: "event.published";
72
+ event: EventMessage;
73
+ envelope: MessageEnvelope;
74
+ source: "in-process" | "external";
75
+ appName: string;
76
+ ts: string;
77
+ } | {
78
+ kind: "event.deduped";
79
+ event: EventMessage;
80
+ envelope: MessageEnvelope;
81
+ source: "in-process" | "external";
82
+ appName: string;
83
+ ts: string;
84
+ } | {
85
+ kind: "actor.transitioned";
86
+ actor: string;
87
+ key: string;
88
+ tenant: string;
89
+ from: string;
90
+ to: string;
91
+ triggeringEvent: string;
92
+ envelope: MessageEnvelope;
93
+ appName: string;
94
+ ts: string;
95
+ } | {
96
+ kind: "projection.folded";
97
+ projection: string;
98
+ event: string;
99
+ tenant: string;
100
+ durationMs: number;
101
+ envelope: MessageEnvelope;
102
+ appName: string;
103
+ ts: string;
104
+ } | {
105
+ kind: "projection.failed";
106
+ projection: string;
107
+ event: string;
108
+ tenant: string;
109
+ durationMs: number;
110
+ error: SerializedError;
111
+ envelope: MessageEnvelope;
112
+ appName: string;
113
+ ts: string;
114
+ } | {
115
+ kind: "reaction.fired";
116
+ sourceEvent: string;
117
+ durationMs: number;
118
+ envelope: MessageEnvelope;
119
+ appName: string;
120
+ ts: string;
121
+ } | {
122
+ kind: "reaction.failed";
123
+ sourceEvent: string;
124
+ error: SerializedError;
125
+ envelope: MessageEnvelope;
126
+ appName: string;
127
+ ts: string;
128
+ workflow: string;
129
+ attempt?: number;
130
+ maxAttempts?: number;
131
+ willRetry?: boolean;
132
+ } | {
133
+ kind: "reaction.exhausted";
134
+ workflow: string;
135
+ sourceEvent: string;
136
+ attempts: number;
137
+ error: SerializedError;
138
+ envelope: MessageEnvelope;
139
+ appName: string;
140
+ ts: string;
141
+ } | {
142
+ kind: "dlq.recorded";
143
+ action: string;
144
+ attempts: number;
145
+ error: SerializedError;
146
+ envelope: MessageEnvelope;
147
+ appName: string;
148
+ ts: string;
149
+ } | {
150
+ kind: "timer.fired";
151
+ actor: string;
152
+ key: string;
153
+ timer: string;
154
+ action: string;
155
+ lateByMs: number;
156
+ tenant: string;
157
+ appName: string;
158
+ ts: string;
159
+ } | {
160
+ kind: "timer.scheduled";
161
+ actor: string;
162
+ key: string;
163
+ timer: string;
164
+ action: string;
165
+ fireAt: number;
166
+ tenant: string;
167
+ appName: string;
168
+ ts: string;
169
+ } | {
170
+ kind: "query.executed";
171
+ query: string;
172
+ input: unknown;
173
+ durationMs: number;
174
+ tenant: string;
175
+ appName: string;
176
+ ts: string;
177
+ } | {
178
+ kind: "external.call.started";
179
+ call: string;
180
+ target: string;
181
+ idempotencyKey: string | undefined;
182
+ envelope?: MessageEnvelope;
183
+ appName: string;
184
+ ts: string;
185
+ } | {
186
+ kind: "external.call.completed";
187
+ call: string;
188
+ target: string;
189
+ durationMs: number;
190
+ idempotencyKey: string | undefined;
191
+ envelope?: MessageEnvelope;
192
+ appName: string;
193
+ ts: string;
194
+ } | {
195
+ kind: "external.call.failed";
196
+ call: string;
197
+ target: string;
198
+ attempt: number;
199
+ willRetry: boolean;
200
+ error: SerializedError;
201
+ envelope?: MessageEnvelope;
202
+ appName: string;
203
+ ts: string;
204
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Forge-internal type shapes — per-domain hook contexts, dispatch options,
3
+ * and the widened telemetry union forge emits.
4
+ */
5
+ export {};
@@ -9,7 +9,7 @@
9
9
  * The store is intentionally thin: load/save/exists keyed by (actorName, key).
10
10
  * No queries, no joins, no streaming — those live in projections.
11
11
  */
12
- import type { ActorDefinition } from "./define-actor.js";
12
+ import type { ActorDefinition } from "../primitives/define-actor.js";
13
13
  export declare class ActorVersionConflictError extends Error {
14
14
  readonly actorName: string;
15
15
  readonly key: string;
@@ -122,4 +122,3 @@ export declare class InMemoryActorStore implements ActorStore {
122
122
  * save time.
123
123
  */
124
124
  export declare function createInitialInstance(actor: ActorDefinition, key: string, tenant?: string): ActorInstance;
125
- //# sourceMappingURL=actor-store.d.ts.map
@@ -139,4 +139,3 @@ export function createInitialInstance(actor, key, tenant = "") {
139
139
  activeTimers: {},
140
140
  };
141
141
  }
142
- //# sourceMappingURL=actor-store.js.map
@@ -32,4 +32,3 @@ export declare class InMemoryIdempotencyStore implements IdempotencyStore {
32
32
  /** Test seam — drop all entries. */
33
33
  clear(): void;
34
34
  }
35
- //# sourceMappingURL=idempotency-store.d.ts.map
@@ -29,4 +29,3 @@ export class InMemoryIdempotencyStore {
29
29
  this.entries.clear();
30
30
  }
31
31
  }
32
- //# sourceMappingURL=idempotency-store.js.map
@@ -23,4 +23,3 @@ export declare class InMemoryProjectionStore implements ProjectionStore {
23
23
  /** Test-only — clear all projection state. */
24
24
  clear(): void;
25
25
  }
26
- //# sourceMappingURL=projection-store.d.ts.map
@@ -25,4 +25,3 @@ export class InMemoryProjectionStore {
25
25
  this.entries.clear();
26
26
  }
27
27
  }
28
- //# sourceMappingURL=projection-store.js.map
@@ -75,4 +75,3 @@ export declare class InMemoryWorkflowTimerStore implements WorkflowTimerStore {
75
75
  * by `timeout("foo", "7d")`; both sides agree on the same canonical name.
76
76
  */
77
77
  export declare function timerEventName(workflowName: string, timerName: string): string;
78
- //# sourceMappingURL=workflow-timer-store.d.ts.map
@@ -53,4 +53,3 @@ export class InMemoryWorkflowTimerStore {
53
53
  export function timerEventName(workflowName, timerName) {
54
54
  return `__nwire/timer/${workflowName}/${timerName}`;
55
55
  }
56
- //# sourceMappingURL=workflow-timer-store.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nwire/forge",
3
- "version": "0.9.2",
3
+ "version": "0.10.1",
4
4
  "description": "Nwire — the framework's core primitives. defineAction, defineEvent, defineHandler, defineActor, defineProjection, defineQuery, defineWorkflow, defineModule, defineApp, definePlugin, createApp. MessageEnvelope with correlation/causation. The runtime is the bus.",
5
5
  "keywords": [
6
6
  "actions",
@@ -34,16 +34,16 @@
34
34
  "emittery": "1.0.1",
35
35
  "koa": "^2.16.4",
36
36
  "zod": "^4.0.0",
37
- "@nwire/app": "0.9.2",
38
- "@nwire/bus": "0.9.2",
39
- "@nwire/dead-letter": "0.9.2",
40
- "@nwire/container": "0.9.2",
41
- "@nwire/messages": "0.9.2",
42
- "@nwire/handler": "0.9.2",
43
- "@nwire/envelope": "0.9.2",
44
- "@nwire/interface": "0.9.2",
45
- "@nwire/hooks": "0.9.2",
46
- "@nwire/logger": "0.9.2"
37
+ "@nwire/app": "0.10.1",
38
+ "@nwire/container": "0.10.1",
39
+ "@nwire/dead-letter": "0.10.1",
40
+ "@nwire/envelope": "0.10.1",
41
+ "@nwire/handler": "0.10.1",
42
+ "@nwire/hooks": "0.10.1",
43
+ "@nwire/messages": "0.10.1",
44
+ "@nwire/logger": "0.10.1",
45
+ "@nwire/bus": "0.10.1",
46
+ "@nwire/wires": "0.10.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/koa": "^2.15.0",
@@ -1,8 +0,0 @@
1
- /**
2
- * Per-action `action.before:<name>` and `action.after:<name>` hooks —
3
- * proves the named-hook surface that plugin `before()`/`after()` sugar
4
- * registers chain steps on, AND that the dispatcher honors veto + observes
5
- * after-success.
6
- */
7
- export {};
8
- //# sourceMappingURL=action-hooks.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-hooks.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/action-hooks.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -1,95 +0,0 @@
1
- /**
2
- * Per-action `action.before:<name>` and `action.after:<name>` hooks —
3
- * proves the named-hook surface that plugin `before()`/`after()` sugar
4
- * registers chain steps on, AND that the dispatcher honors veto + observes
5
- * after-success.
6
- */
7
- import { describe, it, expect } from "vitest";
8
- import { z } from "zod";
9
- import { listHooks } from "@nwire/hooks";
10
- import { createApp, defineAction, defineHandler, defineModule, definePlugin } from "../foundation.js";
11
- const Ping = defineAction({
12
- name: "test/action-hooks-ping",
13
- schema: z.object({ n: z.number() }),
14
- });
15
- const pingHandler = defineHandler(Ping, async (input) => undefined);
16
- const mod = defineModule("test-action-hooks", {
17
- actions: [Ping],
18
- handlers: [pingHandler],
19
- });
20
- describe("per-action hooks", () => {
21
- it("registers action.before:<name> + action.after:<name> on handler register", async () => {
22
- const app = createApp({ appName: "action-hooks-test", modules: [mod] });
23
- await app.start();
24
- const names = listHooks().map((h) => h.name);
25
- expect(names).toContain("action.before:test/action-hooks-ping");
26
- expect(names).toContain("action.after:test/action-hooks-ping");
27
- await app.stop();
28
- });
29
- it("plugin.before chain step that returns false vetoes the dispatch", async () => {
30
- let handlerRan = false;
31
- let beforeRan = false;
32
- let afterRan = false;
33
- const ping2 = defineHandler(defineAction({ name: "test/veto-ping", schema: z.object({}) }), async () => {
34
- handlerRan = true;
35
- return undefined;
36
- });
37
- const m = defineModule("test-veto", { actions: [ping2.action], handlers: [ping2] });
38
- const vetoer = definePlugin("vetoer", ({ before, after }) => {
39
- before("test/veto-ping", () => {
40
- beforeRan = true;
41
- return false;
42
- });
43
- after("test/veto-ping", () => {
44
- afterRan = true;
45
- });
46
- });
47
- const app = createApp({ appName: "veto-test", modules: [m], plugins: [vetoer] });
48
- await app.start();
49
- await app.runtime.dispatch(ping2.action, {});
50
- expect(beforeRan).toBe(true);
51
- expect(handlerRan).toBe(false);
52
- expect(afterRan).toBe(false);
53
- await app.stop();
54
- });
55
- it("plugin.after observes the result + durationMs of a successful dispatch", async () => {
56
- let captured = null;
57
- const ping3 = defineHandler(defineAction({ name: "test/observe-ping", schema: z.object({}) }), async () => undefined);
58
- const m = defineModule("test-observe", { actions: [ping3.action], handlers: [ping3] });
59
- const observer = definePlugin("observer", ({ after }) => {
60
- after("test/observe-ping", ({ result, durationMs }) => {
61
- captured = { result, durationMs };
62
- });
63
- });
64
- const app = createApp({ appName: "observe-test", modules: [m], plugins: [observer] });
65
- await app.start();
66
- await app.runtime.dispatch(ping3.action, {});
67
- expect(captured).not.toBeNull();
68
- expect(typeof captured.durationMs).toBe("number");
69
- await app.stop();
70
- });
71
- it("multiple plugins.before steps stack as named chain steps on the same hook", async () => {
72
- const callOrder = [];
73
- const ping4 = defineHandler(defineAction({ name: "test/stack-ping", schema: z.object({}) }), async () => {
74
- callOrder.push("handler");
75
- return undefined;
76
- });
77
- const m = defineModule("test-stack", { actions: [ping4.action], handlers: [ping4] });
78
- const pluginA = definePlugin("a", ({ before }) => {
79
- before("test/stack-ping", () => {
80
- callOrder.push("a.before");
81
- });
82
- });
83
- const pluginB = definePlugin("b", ({ before }) => {
84
- before("test/stack-ping", () => {
85
- callOrder.push("b.before");
86
- });
87
- });
88
- const app = createApp({ appName: "stack-test", modules: [m], plugins: [pluginA, pluginB] });
89
- await app.start();
90
- await app.runtime.dispatch(ping4.action, {});
91
- expect(callOrder).toEqual(["a.before", "b.before", "handler"]);
92
- await app.stop();
93
- });
94
- });
95
- //# sourceMappingURL=action-hooks.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-hooks.test.js","sourceRoot":"","sources":["../../src/__tests__/action-hooks.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EA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C,CAAC;QAE7C,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;QAE/D,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Actor methods + `ctx.use(Actor, id)` — pure invariant-enforcers + event
3
- * minters bound to the loaded state. Methods take state, return events or
4
- * read values, throw on invariant violation. `ctx.use` loads the actor from
5
- * the store and returns a view with state, stateName, key, and pre-bound
6
- * methods. The view is a snapshot — the loaded state is frozen for that view.
7
- */
8
- export {};
9
- //# sourceMappingURL=actor-methods.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor-methods.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/actor-methods.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}