@nwire/forge 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime/forge-plugin.js +15 -1
- package/package.json +11 -11
|
@@ -77,8 +77,22 @@ export function createForgePlugin(options = {}) {
|
|
|
77
77
|
// Pin the dispatch chain handler step at priority -Infinity so any
|
|
78
78
|
// user `runtime.use()` middleware stays strictly outside the
|
|
79
79
|
// handler invocation.
|
|
80
|
+
//
|
|
81
|
+
// The runtime installs its OWN core step (`__nwire_runtime_core__`,
|
|
82
|
+
// also -Infinity) the first time a `runtime.use()` middleware routes
|
|
83
|
+
// a dispatch through the chain. Both steps would otherwise call
|
|
84
|
+
// `coreFn()`, so a forge action running while any user middleware is
|
|
85
|
+
// present would execute its handler twice. Guard the call with a
|
|
86
|
+
// per-dispatch sentinel: whichever -Infinity step runs first invokes
|
|
87
|
+
// the handler; the rest fall through. Forge keeps its own step
|
|
88
|
+
// because it dispatches straight through `dispatchHook$.run`, where
|
|
89
|
+
// the runtime's lazily-pinned step may not exist yet.
|
|
80
90
|
runtime.dispatchHook$.use(async (hctx, next) => {
|
|
81
|
-
|
|
91
|
+
const h = hctx;
|
|
92
|
+
if (!h.__nwireCoreInvoked) {
|
|
93
|
+
h.__nwireCoreInvoked = true;
|
|
94
|
+
hctx.result = await hctx.coreFn();
|
|
95
|
+
}
|
|
82
96
|
await next();
|
|
83
97
|
}, { name: "handler", priority: -Infinity });
|
|
84
98
|
// Domain registration runs at AppBooting — after every plugin's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/forge",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.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/
|
|
38
|
-
"@nwire/
|
|
39
|
-
"@nwire/
|
|
40
|
-
"@nwire/
|
|
41
|
-
"@nwire/
|
|
42
|
-
"@nwire/
|
|
43
|
-
"@nwire/
|
|
44
|
-
"@nwire/
|
|
45
|
-
"@nwire/
|
|
46
|
-
"@nwire/
|
|
37
|
+
"@nwire/bus": "0.12.1",
|
|
38
|
+
"@nwire/container": "0.12.1",
|
|
39
|
+
"@nwire/dead-letter": "0.12.1",
|
|
40
|
+
"@nwire/app": "0.12.1",
|
|
41
|
+
"@nwire/handler": "0.12.1",
|
|
42
|
+
"@nwire/envelope": "0.12.1",
|
|
43
|
+
"@nwire/hooks": "0.12.1",
|
|
44
|
+
"@nwire/logger": "0.12.1",
|
|
45
|
+
"@nwire/messages": "0.12.1",
|
|
46
|
+
"@nwire/wires": "0.12.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/koa": "^2.15.0",
|