@nwire/app 0.7.0 → 0.8.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.
- package/README.md +90 -36
- package/dist/define-plugin.d.ts +3 -0
- package/dist/define-plugin.d.ts.map +1 -1
- package/dist/define-plugin.js +2 -0
- package/dist/define-plugin.js.map +1 -1
- package/dist/framework-event-bus.d.ts +29 -1
- package/dist/framework-event-bus.d.ts.map +1 -1
- package/dist/framework-event-bus.js +36 -1
- package/dist/framework-event-bus.js.map +1 -1
- package/dist/framework-events.d.ts +16 -0
- package/dist/framework-events.d.ts.map +1 -1
- package/dist/framework-events.js +0 -6
- package/dist/framework-events.js.map +1 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -1,60 +1,114 @@
|
|
|
1
1
|
# @nwire/app
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Plugin primitive, framework-event bus, and the lifecycle event catalog every app fires.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Install
|
|
5
|
+
The "app" layer of the sealed architecture. Ships `definePlugin`, the
|
|
6
|
+
typed `FrameworkEventBus`, and the built-in lifecycle events. The
|
|
7
|
+
composition root (`createApp`) currently lives in `@nwire/forge` and
|
|
8
|
+
re-exports everything here so a single import line keeps working.
|
|
10
9
|
|
|
11
10
|
```bash
|
|
12
11
|
pnpm add @nwire/app
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
## Quick
|
|
14
|
+
## Quick example
|
|
16
15
|
|
|
17
16
|
```ts
|
|
18
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
FrameworkEventBus,
|
|
19
|
+
AppBooted,
|
|
20
|
+
PluginBooting,
|
|
21
|
+
defineFrameworkEvent,
|
|
22
|
+
definePlugin,
|
|
23
|
+
} from "@nwire/app";
|
|
19
24
|
import { NoopLogger } from "@nwire/logger";
|
|
20
25
|
|
|
21
26
|
const bus = new FrameworkEventBus(new NoopLogger());
|
|
22
27
|
|
|
23
|
-
bus.on(AppBooted,
|
|
28
|
+
bus.on(AppBooted, ({ appName, bootedAt }) => {
|
|
24
29
|
console.log(`${appName} booted at ${bootedAt}`);
|
|
25
30
|
});
|
|
26
31
|
|
|
32
|
+
// A series-bail handler can veto by returning `false`.
|
|
33
|
+
bus.on(PluginBooting, ({ pluginName }) => {
|
|
34
|
+
if (pluginName === "broken") return false;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// User-defined framework event — same machinery.
|
|
27
38
|
const TenantSwitched = defineFrameworkEvent<{ tenantId: string }>(
|
|
28
39
|
"app.tenant-switched",
|
|
29
40
|
"parallel",
|
|
30
41
|
);
|
|
31
|
-
bus.on(TenantSwitched, ({ tenantId }) => console.log(
|
|
32
|
-
|
|
42
|
+
bus.on(TenantSwitched, ({ tenantId }) => console.log("→", tenantId));
|
|
33
43
|
await bus.fire(TenantSwitched, { tenantId: "acme" });
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## API surface
|
|
37
|
-
|
|
38
|
-
- `defineFrameworkEvent<TPayload>(name, mode)` — declare a typed lifecycle event.
|
|
39
|
-
- `FrameworkEventBus` — typed dispatcher; one per app instance.
|
|
40
|
-
- `AppRegistering` / `AppBooting` / `AppBooted` / `AppReady` / `AppShuttingDown` / `AppShutdown` — built-in lifecycle events.
|
|
41
|
-
- `definePlugin(name, setup)` — closure-form plugin with `bind` / `provide` / `on` / `before` / `after` / `middleware` / `boot` / `shutdown`.
|
|
42
|
-
- Dispatch modes — `parallel` (`*-ed`, fire-and-forget), `series` (sequential await), `series-bail` (`*-ing`, vetoable).
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- [`@nwire/http`](../nwire-http/README.md) — typed HTTP without forge
|
|
55
|
-
- [`@nwire/endpoint`](../nwire-endpoint/README.md) — graceful shutdown for any host
|
|
56
|
-
|
|
57
|
-
## See also
|
|
45
|
+
// definePlugin — narrow primitive (no forge-specific knowledge).
|
|
46
|
+
export const tracing = definePlugin("tracing", ({ provide, on, boot }) => {
|
|
47
|
+
provide("tracer", {
|
|
48
|
+
boot: () => createTracer(),
|
|
49
|
+
shutdown: (t) => t.shutdown(),
|
|
50
|
+
});
|
|
51
|
+
on(AppBooted, ({ appName }) => console.log(`tracing live on ${appName}`));
|
|
52
|
+
boot(async () => {/* warm-up */});
|
|
53
|
+
});
|
|
54
|
+
```
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
## Surface
|
|
57
|
+
|
|
58
|
+
| Export | Role |
|
|
59
|
+
| -------------------------- | ----------------------------------------------------------------- |
|
|
60
|
+
| `FrameworkEventBus` | Typed dispatcher; one per app instance. |
|
|
61
|
+
| `defineFrameworkEvent` | Declare a typed event + its dispatch mode. |
|
|
62
|
+
| `definePlugin(name, setup)`| Narrow plugin: `provide` / `on` / `boot` / `shutdown`. |
|
|
63
|
+
| `isAppPlugin(x)` | Type guard for `definePlugin` output. |
|
|
64
|
+
| `AppRegistering` (series-bail) | Before provider boot — vetoable. |
|
|
65
|
+
| `AppBooting` (series-bail) | After provider boot, before plugin boot — vetoable. |
|
|
66
|
+
| `AppBooted` (parallel) | All plugins booted. |
|
|
67
|
+
| `AppReady` (parallel) | Wire mounted, K8s `/ready` flipped. |
|
|
68
|
+
| `AppShuttingDown` (series-bail) | Vetoable shutdown signal. |
|
|
69
|
+
| `AppShutdown` (parallel) | Everything torn down. |
|
|
70
|
+
| `PluginRegistered` / `PluginBooting` / `PluginBooted` / `PluginShuttingDown` / `PluginShutdown` | Per-plugin lifecycle, all carry an optional `kind: "plugin" \| "module"`. |
|
|
71
|
+
| `WireMounting` (series-bail) / `WireMounted` / `WireUnmounted` | Transport mount lifecycle, fired by `@nwire/endpoint`. |
|
|
72
|
+
| `builtInLifecycleEvents` | Array of every built-in above — useful for observability adapters.|
|
|
73
|
+
|
|
74
|
+
### Dispatch modes (tense convention)
|
|
75
|
+
|
|
76
|
+
| Mode | Tense | Semantics |
|
|
77
|
+
| ------------- | -------- | ------------------------------------------------------------ |
|
|
78
|
+
| `series-bail` | `*-ing` | Sequential await. Return `false` to short-circuit. |
|
|
79
|
+
| `series` | (rare) | Sequential await. Throw stops the chain. |
|
|
80
|
+
| `parallel` | `*-ed` | `Promise.allSettled`; one failing handler logs but continues.|
|
|
81
|
+
|
|
82
|
+
`FrameworkEventBus.fire()` returns `false` only when a `series-bail`
|
|
83
|
+
handler vetoed; `true` otherwise.
|
|
84
|
+
|
|
85
|
+
### Module-as-plugin
|
|
86
|
+
|
|
87
|
+
Modules participate in the same plugin lifecycle. `PluginRegistered` /
|
|
88
|
+
`PluginBooting` / `PluginBooted` payloads carry an optional
|
|
89
|
+
`kind: "plugin" | "module"` field so Studio + observability adapters
|
|
90
|
+
render each with the right affordance.
|
|
91
|
+
|
|
92
|
+
## When to reach for which `definePlugin`
|
|
93
|
+
|
|
94
|
+
| You need… | Use |
|
|
95
|
+
| ---------------------------------------- | ------------------ |
|
|
96
|
+
| Bind a DB / cache / SDK to the container | `@nwire/app` |
|
|
97
|
+
| React to lifecycle events | `@nwire/app` |
|
|
98
|
+
| Intercept every action dispatch | `@nwire/forge` |
|
|
99
|
+
| Hook actor transitions | `@nwire/forge` |
|
|
100
|
+
| `before("action.x", ...)` sugar | `@nwire/forge` |
|
|
101
|
+
|
|
102
|
+
`@nwire/forge`'s richer `definePlugin` is a superset — both shapes
|
|
103
|
+
coexist in the same plugin list and the runtime dispatches each through
|
|
104
|
+
the right wiring path.
|
|
105
|
+
|
|
106
|
+
## Related
|
|
107
|
+
|
|
108
|
+
- `@nwire/forge` — wraps this package and adds the action/actor primitives.
|
|
109
|
+
- `@nwire/hooks` — the dispatch substrate; `FrameworkEventBus` adopts a per-event hook lazily so `listHooks()` and `nwire scan` see every framework event.
|
|
110
|
+
- `@nwire/endpoint` — fires `WireMounting` / `WireMounted` / `WireUnmounted` on this bus.
|
|
111
|
+
|
|
112
|
+
## Status
|
|
113
|
+
|
|
114
|
+
v0.x — `definePlugin` closure shape, framework-event catalog, and dispatch modes are locked. `createApp` extraction from forge is a follow-up; imports won't change.
|
package/dist/define-plugin.d.ts
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* actor transitions, you don't need forge's plugin form. Use this one.
|
|
32
32
|
*/
|
|
33
33
|
import type { Container } from "@nwire/container";
|
|
34
|
+
import { type SourceLocation } from "@nwire/messages";
|
|
34
35
|
import type { FrameworkEventDefinition } from "./framework-events.js";
|
|
35
36
|
import type { FrameworkEventBus, FrameworkEventHandler } from "./framework-event-bus.js";
|
|
36
37
|
/**
|
|
@@ -118,6 +119,8 @@ export interface AppPluginDefinition {
|
|
|
118
119
|
* before proceeding to provider boot.
|
|
119
120
|
*/
|
|
120
121
|
readonly setup: (ctx: AppPluginContext) => void | Promise<void>;
|
|
122
|
+
/** Call-site of `definePlugin(...)` — Studio + scan render this. */
|
|
123
|
+
readonly $source?: SourceLocation;
|
|
121
124
|
}
|
|
122
125
|
/**
|
|
123
126
|
* Build a plugin. The returned value is opaque — pass it to your app's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-plugin.d.ts","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAItF;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACvB,QAAQ,CAAC,CAAC,KAAK,EA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GAAG,IAAI,CAAC;CAChD;AAID;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;CACnC;AAID;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACrD,mBAAmB,CAOrB;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,mBAAmB,CAMhE"}
|
package/dist/define-plugin.js
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* In other words: if you don't need to peek inside action dispatch or
|
|
31
31
|
* actor transitions, you don't need forge's plugin form. Use this one.
|
|
32
32
|
*/
|
|
33
|
+
import { captureSourceLocation } from "@nwire/messages";
|
|
33
34
|
// ─── The factory ──────────────────────────────────────────────────
|
|
34
35
|
/**
|
|
35
36
|
* Build a plugin. The returned value is opaque — pass it to your app's
|
|
@@ -61,6 +62,7 @@ export function definePlugin(name, setup) {
|
|
|
61
62
|
$nwireAppPlugin: true,
|
|
62
63
|
name,
|
|
63
64
|
setup,
|
|
65
|
+
$source: captureSourceLocation(),
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
/** Type guard — does this look like an app-layer plugin definition? */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-plugin.js","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;
|
|
1
|
+
{"version":3,"file":"define-plugin.js","sourceRoot":"","sources":["../src/define-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,qBAAqB,EAAuB,MAAM,iBAAiB,CAAC;AA8G7E,qEAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,KAAsD;IAEtD,OAAO;QACL,eAAe,EAAE,IAAI;QACrB,IAAI;QACJ,KAAK;QACL,OAAO,EAAE,qBAAqB,EAAE;KACjC,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACT,CAAmC,CAAC,eAAe,KAAK,IAAI,CAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -56,11 +56,39 @@ export type FrameworkEventObserver = (record: FrameworkEventObservation) => void
|
|
|
56
56
|
* focused on the domain pipeline. Designed to be reusable — Studio, the
|
|
57
57
|
* orchestrator, and external plugins all hit the same surface.
|
|
58
58
|
*/
|
|
59
|
+
import { type Hook } from "@nwire/hooks";
|
|
59
60
|
export declare class FrameworkEventBus {
|
|
60
61
|
private readonly subs;
|
|
61
62
|
private readonly observers;
|
|
62
63
|
private readonly logger;
|
|
63
|
-
|
|
64
|
+
/**
|
|
65
|
+
* One hook per event name, lazily created on first `fire()`. Each hook has
|
|
66
|
+
* a single no-op chain step named "dispatch" so every fire emits start +
|
|
67
|
+
* end taps under `framework.event:<eventName>`. The dispatch logic in
|
|
68
|
+
* `fire()` is unchanged — these hooks are an observation surface so
|
|
69
|
+
* `listHooks()` + scan + Studio see every framework event in the
|
|
70
|
+
* registry, not a replacement for the existing dispatcher.
|
|
71
|
+
*
|
|
72
|
+
* Runtime can pass an `adoptHook` callback in the constructor; each
|
|
73
|
+
* lazily-created hook is adopted so taps flow into the canonical
|
|
74
|
+
* telemetry stream as `kind: "hook.step"`.
|
|
75
|
+
*/
|
|
76
|
+
private readonly eventHooks;
|
|
77
|
+
private readonly adoptHook?;
|
|
78
|
+
constructor(logger: Logger, options?: {
|
|
79
|
+
adoptHook?: (h: Hook<unknown>) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Built-in framework events to pre-create observation hooks for at
|
|
82
|
+
* construction. Pass the host's known event registry (e.g. forge's
|
|
83
|
+
* `builtInFrameworkEvents`) so `listHooks()` + scan see them BEFORE
|
|
84
|
+
* the first fire — Studio's Hooks page and CLI both consume that.
|
|
85
|
+
*/
|
|
86
|
+
events?: ReadonlyArray<{
|
|
87
|
+
readonly name: string;
|
|
88
|
+
}>;
|
|
89
|
+
});
|
|
90
|
+
/** Lazily create + adopt the per-event hook. Called from `fire()`. */
|
|
91
|
+
private ensureEventHook;
|
|
64
92
|
/**
|
|
65
93
|
* Subscribe to EVERY framework-event firing on this bus. Used by the
|
|
66
94
|
* dev logger, Studio Live, and OTel exporter to surface lifecycle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-event-bus.d.ts","sourceRoot":"","sources":["../src/framework-event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,CAAC,QAAQ,IAAI,CAC5C,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC;AAO9C;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAA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|
29
29
|
*/
|
|
30
|
+
import { hook } from "@nwire/hooks";
|
|
30
31
|
export class FrameworkEventBus {
|
|
31
32
|
subs = new Map();
|
|
32
33
|
observers = [];
|
|
33
34
|
logger;
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* One hook per event name, lazily created on first `fire()`. Each hook has
|
|
37
|
+
* a single no-op chain step named "dispatch" so every fire emits start +
|
|
38
|
+
* end taps under `framework.event:<eventName>`. The dispatch logic in
|
|
39
|
+
* `fire()` is unchanged — these hooks are an observation surface so
|
|
40
|
+
* `listHooks()` + scan + Studio see every framework event in the
|
|
41
|
+
* registry, not a replacement for the existing dispatcher.
|
|
42
|
+
*
|
|
43
|
+
* Runtime can pass an `adoptHook` callback in the constructor; each
|
|
44
|
+
* lazily-created hook is adopted so taps flow into the canonical
|
|
45
|
+
* telemetry stream as `kind: "hook.step"`.
|
|
46
|
+
*/
|
|
47
|
+
eventHooks = new Map();
|
|
48
|
+
adoptHook;
|
|
49
|
+
constructor(logger, options = {}) {
|
|
35
50
|
this.logger = logger;
|
|
51
|
+
this.adoptHook = options.adoptHook;
|
|
52
|
+
for (const event of options.events ?? []) {
|
|
53
|
+
this.ensureEventHook(event.name);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Lazily create + adopt the per-event hook. Called from `fire()`. */
|
|
57
|
+
ensureEventHook(eventName) {
|
|
58
|
+
let h = this.eventHooks.get(eventName);
|
|
59
|
+
if (h)
|
|
60
|
+
return h;
|
|
61
|
+
h = hook(`framework.event:${eventName}`);
|
|
62
|
+
h.use(async (_, next) => { await next(); }, { name: "dispatch" });
|
|
63
|
+
this.eventHooks.set(eventName, h);
|
|
64
|
+
this.adoptHook?.(h);
|
|
65
|
+
return h;
|
|
36
66
|
}
|
|
37
67
|
/**
|
|
38
68
|
* Subscribe to EVERY framework-event firing on this bus. Used by the
|
|
@@ -94,6 +124,11 @@ export class FrameworkEventBus {
|
|
|
94
124
|
*/
|
|
95
125
|
async fire(event, payload) {
|
|
96
126
|
const handlers = (this.subs.get(event.name) ?? []);
|
|
127
|
+
// Observation surface — emit start + end taps via the per-event hook.
|
|
128
|
+
// Cheap (one closure invocation per fire) and adds the event to
|
|
129
|
+
// `listHooks()` for scan + Studio + CLI visibility.
|
|
130
|
+
const eventHook = this.ensureEventHook(event.name);
|
|
131
|
+
await eventHook.run(payload);
|
|
97
132
|
// Always notify observers — even when no subscribers exist for this
|
|
98
133
|
// event. The lifecycle is the signal worth recording; subscribers are
|
|
99
134
|
// an orthogonal concern (could be none in dev, several in prod).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-event-bus.js","sourceRoot":"","sources":["../src/framework-event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAyCH;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACX,IAAI,GAAG,IAAI,GAAG,EAAmC,CAAC;IAClD,SAAS,GAA6B,EAAE,CAAC;IACzC,MAAM,CAAS;IAEhC,
|
|
1
|
+
{"version":3,"file":"framework-event-bus.js","sourceRoot":"","sources":["../src/framework-event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAyCH;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,MAAM,OAAO,iBAAiB;IACX,IAAI,GAAG,IAAI,GAAG,EAAmC,CAAC;IAClD,SAAS,GAA6B,EAAE,CAAC;IACzC,MAAM,CAAS;IAEhC;;;;;;;;;;;OAWG;IACc,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC9C,SAAS,CAA8B;IAExD,YACE,MAAc,EACd,UASI,EAAE;QAEN,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YACzC,I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ACxD,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;oBACnC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;gBACzB,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,KAAK,aAAa,CAAC,CAAC,CAAC;gBACnB,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;oBACnC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;oBACtC,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;wBACrB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,sCAAsC,EAAE;4BACzD,KAAK,EAAE,KAAK,CAAC,IAAI;yBAClB,CAAC,CAAC;wBACH,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;wBACjC,OAAO,KAAK,CAAC;oBACf,CAAC;gBACH,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,eAAe,CAAC,KAA+B;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -102,9 +102,16 @@ export declare const AppShutdown: FrameworkEventDefinition<{
|
|
|
102
102
|
* begins. Useful for an observer that wants to list "what's this app made
|
|
103
103
|
* of?" before lifecycle starts. Observable; runs in parallel.
|
|
104
104
|
*/
|
|
105
|
+
/**
|
|
106
|
+
* `kind` distinguishes a plugin proper from a module that's been compiled
|
|
107
|
+
* onto the plugin lifecycle. Optional + defaulting to "plugin" so existing
|
|
108
|
+
* subscribers stay back-compat.
|
|
109
|
+
*/
|
|
110
|
+
export type PluginKind = "plugin" | "module";
|
|
105
111
|
export declare const PluginRegistered: FrameworkEventDefinition<{
|
|
106
112
|
readonly appName: string;
|
|
107
113
|
readonly pluginName: string;
|
|
114
|
+
readonly kind?: PluginKind;
|
|
108
115
|
}>;
|
|
109
116
|
/**
|
|
110
117
|
* Fired before a plugin's `boot()` callback (object-form) or its `boot(...)`
|
|
@@ -115,12 +122,14 @@ export declare const PluginRegistered: FrameworkEventDefinition<{
|
|
|
115
122
|
export declare const PluginBooting: FrameworkEventDefinition<{
|
|
116
123
|
readonly appName: string;
|
|
117
124
|
readonly pluginName: string;
|
|
125
|
+
readonly kind?: PluginKind;
|
|
118
126
|
}>;
|
|
119
127
|
/** Fired after a plugin's boot completes successfully. Observable. */
|
|
120
128
|
export declare const PluginBooted: FrameworkEventDefinition<{
|
|
121
129
|
readonly appName: string;
|
|
122
130
|
readonly pluginName: string;
|
|
123
131
|
readonly durationMs: number;
|
|
132
|
+
readonly kind?: PluginKind;
|
|
124
133
|
}>;
|
|
125
134
|
/**
|
|
126
135
|
* Fired before a plugin's `shutdown()` callback runs. Interceptable. Used
|
|
@@ -129,12 +138,14 @@ export declare const PluginBooted: FrameworkEventDefinition<{
|
|
|
129
138
|
export declare const PluginShuttingDown: FrameworkEventDefinition<{
|
|
130
139
|
readonly appName: string;
|
|
131
140
|
readonly pluginName: string;
|
|
141
|
+
readonly kind?: PluginKind;
|
|
132
142
|
}>;
|
|
133
143
|
/** Fired after a plugin's shutdown completes. Observable. */
|
|
134
144
|
export declare const PluginShutdown: FrameworkEventDefinition<{
|
|
135
145
|
readonly appName: string;
|
|
136
146
|
readonly pluginName: string;
|
|
137
147
|
readonly durationMs: number;
|
|
148
|
+
readonly kind?: PluginKind;
|
|
138
149
|
}>;
|
|
139
150
|
/**
|
|
140
151
|
* Fired before an interface is attached to a host (typically an endpoint).
|
|
@@ -188,20 +199,25 @@ export declare const builtInLifecycleEvents: readonly [FrameworkEventDefinition<
|
|
|
188
199
|
}>, FrameworkEventDefinition<{
|
|
189
200
|
readonly appName: string;
|
|
190
201
|
readonly pluginName: string;
|
|
202
|
+
readonly kind?: PluginKind;
|
|
191
203
|
}>, FrameworkEventDefinition<{
|
|
192
204
|
readonly appName: string;
|
|
193
205
|
readonly pluginName: string;
|
|
206
|
+
readonly kind?: PluginKind;
|
|
194
207
|
}>, FrameworkEventDefinition<{
|
|
195
208
|
readonly appName: string;
|
|
196
209
|
readonly pluginName: string;
|
|
197
210
|
readonly durationMs: number;
|
|
211
|
+
readonly kind?: PluginKind;
|
|
198
212
|
}>, FrameworkEventDefinition<{
|
|
199
213
|
readonly appName: string;
|
|
200
214
|
readonly pluginName: string;
|
|
215
|
+
readonly kind?: PluginKind;
|
|
201
216
|
}>, FrameworkEventDefinition<{
|
|
202
217
|
readonly appName: string;
|
|
203
218
|
readonly pluginName: string;
|
|
204
219
|
readonly durationMs: number;
|
|
220
|
+
readonly kind?: PluginKind;
|
|
205
221
|
}>, FrameworkEventDefinition<{
|
|
206
222
|
readonly appName: string;
|
|
207
223
|
readonly transport: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-events.d.ts","sourceRoot":"","sources":["../src/framework-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEvE,wEAAwE;AACxE,MAAM,WAAW,wBAAwB,CAAC,QAAQ,GAAG,OAAO;IAC1D,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CA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AW;sBACJ,MAAM;wBACJ,MAAM;uBACP,OAAO;EACQ,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,aAAa;sBACN,MAAM;wBACJ,MAAM;EACU,CAAC;AAIvC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;sBAjJf,MAAM;;sBASN,MAAM;;sBAQN,MAAM;uBACL,MAAM;;sBASP,MAAM;sBACN,MAAM;;sBASN,MAAM;sBACN,MAAM;;sBAKN,MAAM;;sBAkBF,MAAM;yBACN,MAAM;oBACN,UAAU;;sBAUX,MAAM;yBACN,MAAM;oBACN,UAAU;;sBAKV,MAAM;yBACN,MAAM;yBACN,MAAM;oBACN,UAAU;;sBAQV,MAAM;yBACN,MAAM;oBACN,UAAU;;sBAKV,MAAM;yBACN,MAAM;yBACN,MAAM;oBACN,UAAU;;sBAab,MAAM;wBACJ,MAAM;uBACP,OAAO;;sBASR,MAAM;wBACJ,MAAM;uBACP,OAAO;;sBAQR,MAAM;wBACJ,MAAM;GAwBlB,CAAC"}
|
package/dist/framework-events.js
CHANGED
|
@@ -75,12 +75,6 @@ export const AppReady = defineFrameworkEvent("nwire.app.ready", "parallel");
|
|
|
75
75
|
export const AppShuttingDown = defineFrameworkEvent("nwire.app.shutting-down", "series-bail");
|
|
76
76
|
/** Fired after `app.stop()` completes — everything torn down. */
|
|
77
77
|
export const AppShutdown = defineFrameworkEvent("nwire.app.shutdown", "parallel");
|
|
78
|
-
// ─── Plugin lifecycle ──────────────────────────────────────────────
|
|
79
|
-
/**
|
|
80
|
-
* Fired once per plugin during `createApp` composition, before any boot
|
|
81
|
-
* begins. Useful for an observer that wants to list "what's this app made
|
|
82
|
-
* of?" before lifecycle starts. Observable; runs in parallel.
|
|
83
|
-
*/
|
|
84
78
|
export const PluginRegistered = defineFrameworkEvent("nwire.plugin.registered", "parallel");
|
|
85
79
|
/**
|
|
86
80
|
* Fired before a plugin's `boot()` callback (object-form) or its `boot(...)`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-events.js","sourceRoot":"","sources":["../src/framework-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAcH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,IAAwB;IAExB,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,mEAAmE;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAE/C,uBAAuB,EAAE,aAAa,CAAC,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAE3C,mBAAmB,EAAE,aAAa,CAAC,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,oBAAoB,CAG1C,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,oBAAoB,CAGzC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAGhD,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAE7C,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAE5C,oBAAoB,EAAE,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"framework-events.js","sourceRoot":"","sources":["../src/framework-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAcH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,IAAwB;IAExB,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,mEAAmE;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,oB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,UAAU,CAAC,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAG9C,sBAAsB,EAAE,UAAU,CAAC,CAAC;AAEvC,sEAAsE;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc;IACd,UAAU;IACV,SAAS;IACT,QAAQ;IACR,eAAe;IACf,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,kBAAkB;IAClB,cAAc;IACd,YAAY;IACZ,WAAW;IACX,aAAa;CACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nwire/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Nwire — managed Container with plugin lifecycle, framework events, and DI hooks. The 'app' in the sealed architecture: composes modules + plugins, boots in order, exposes a Container, fires framework events at every lifecycle transition. Phase 69 extraction in progress; currently ships the framework events + bus.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
"nwire",
|
|
11
11
|
"plugin"
|
|
12
12
|
],
|
|
13
|
+
"license": "MIT",
|
|
13
14
|
"files": [
|
|
14
15
|
"dist",
|
|
15
|
-
"README.md"
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
16
18
|
],
|
|
17
19
|
"type": "module",
|
|
18
20
|
"main": "./dist/app.js",
|
|
@@ -27,8 +29,10 @@
|
|
|
27
29
|
"access": "public"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"@nwire/container": "0.
|
|
31
|
-
"@nwire/logger": "0.
|
|
32
|
+
"@nwire/container": "0.8.0",
|
|
33
|
+
"@nwire/logger": "0.8.0",
|
|
34
|
+
"@nwire/messages": "0.8.0",
|
|
35
|
+
"@nwire/hooks": "0.8.0"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
38
|
"@types/node": "^22.19.9",
|