@nwire/forge 0.9.2 → 0.10.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 +133 -155
- package/dist/foundation.d.ts +0 -13
- package/dist/foundation.js +2 -13
- package/dist/framework-events.d.ts +51 -54
- package/dist/framework-events.js +18 -65
- package/dist/{cli-runner.d.ts → helpers/cli-runner.d.ts} +2 -3
- package/dist/{cli-runner.js → helpers/cli-runner.js} +11 -27
- package/dist/{public-marker.d.ts → helpers/public-marker.d.ts} +0 -1
- package/dist/{public-marker.js → helpers/public-marker.js} +0 -1
- package/dist/{response.d.ts → helpers/response.d.ts} +0 -1
- package/dist/{response.js → helpers/response.js} +0 -1
- package/dist/helpers/retry-helpers.d.ts +22 -0
- package/dist/helpers/retry-helpers.js +43 -0
- package/dist/{validate.d.ts → helpers/validate.d.ts} +0 -1
- package/dist/{validate.js → helpers/validate.js} +0 -1
- package/dist/index.d.ts +42 -48
- package/dist/index.js +47 -55
- package/dist/{event-message.d.ts → messages/event-message.d.ts} +0 -1
- package/dist/{event-message.js → messages/event-message.js} +0 -1
- package/dist/{dev-logger.d.ts → observability/dev-logger.d.ts} +2 -2
- package/dist/{dev-logger.js → observability/dev-logger.js} +0 -30
- package/dist/{define-action.d.ts → primitives/define-action.d.ts} +0 -1
- package/dist/{define-action.js → primitives/define-action.js} +0 -1
- package/dist/{define-actor.d.ts → primitives/define-actor.d.ts} +0 -1
- package/dist/{define-actor.js → primitives/define-actor.js} +0 -1
- package/dist/{define-cron.d.ts → primitives/define-cron.d.ts} +0 -1
- package/dist/{define-cron.js → primitives/define-cron.js} +0 -1
- package/dist/{define-error.d.ts → primitives/define-error.d.ts} +0 -1
- package/dist/{define-error.js → primitives/define-error.js} +0 -1
- package/dist/{define-external-call.d.ts → primitives/define-external-call.d.ts} +0 -1
- package/dist/{define-external-call.js → primitives/define-external-call.js} +0 -1
- package/dist/{define-handler.d.ts → primitives/define-handler.d.ts} +29 -2
- package/dist/{define-handler.js → primitives/define-handler.js} +13 -2
- package/dist/{define-inbound-webhook.d.ts → primitives/define-inbound-webhook.d.ts} +1 -2
- package/dist/{define-inbound-webhook.js → primitives/define-inbound-webhook.js} +1 -2
- package/dist/{define-inbox.d.ts → primitives/define-inbox.d.ts} +0 -1
- package/dist/{define-inbox.js → primitives/define-inbox.js} +0 -1
- package/dist/{define-outbox.d.ts → primitives/define-outbox.d.ts} +0 -1
- package/dist/{define-outbox.js → primitives/define-outbox.js} +0 -1
- package/dist/{define-projection.d.ts → primitives/define-projection.d.ts} +0 -1
- package/dist/{define-projection.js → primitives/define-projection.js} +0 -1
- package/dist/{define-query.d.ts → primitives/define-query.d.ts} +1 -2
- package/dist/{define-query.js → primitives/define-query.js} +1 -2
- package/dist/{define-schema.d.ts → primitives/define-schema.d.ts} +1 -2
- package/dist/{define-schema.js → primitives/define-schema.js} +1 -2
- package/dist/{define-upcaster.d.ts → primitives/define-upcaster.d.ts} +0 -1
- package/dist/{define-upcaster.js → primitives/define-upcaster.js} +0 -1
- package/dist/{define-workflow.d.ts → primitives/define-workflow.d.ts} +2 -3
- package/dist/{define-workflow.js → primitives/define-workflow.js} +2 -3
- package/dist/runtime/create-forge-app.d.ts +64 -0
- package/dist/runtime/create-forge-app.js +78 -0
- package/dist/runtime/forge-dispatcher.d.ts +148 -0
- package/dist/{runtime.js → runtime/forge-dispatcher.js} +242 -571
- package/dist/runtime/forge-plugin.d.ts +59 -0
- package/dist/runtime/forge-plugin.js +121 -0
- package/dist/runtime/forge-types.d.ts +204 -0
- package/dist/runtime/forge-types.js +5 -0
- package/dist/{actor-store.d.ts → stores/actor-store.d.ts} +1 -2
- package/dist/{actor-store.js → stores/actor-store.js} +0 -1
- package/dist/{idempotency-store.d.ts → stores/idempotency-store.d.ts} +0 -1
- package/dist/{idempotency-store.js → stores/idempotency-store.js} +0 -1
- package/dist/{projection-store.d.ts → stores/projection-store.d.ts} +0 -1
- package/dist/{projection-store.js → stores/projection-store.js} +0 -1
- package/dist/{workflow-timer-store.d.ts → stores/workflow-timer-store.d.ts} +0 -1
- package/dist/{workflow-timer-store.js → stores/workflow-timer-store.js} +0 -1
- package/package.json +11 -11
- package/dist/__tests__/action-hooks.test.d.ts +0 -8
- package/dist/__tests__/action-hooks.test.d.ts.map +0 -1
- package/dist/__tests__/action-hooks.test.js +0 -95
- package/dist/__tests__/action-hooks.test.js.map +0 -1
- package/dist/__tests__/actor-methods.test.d.ts +0 -9
- package/dist/__tests__/actor-methods.test.d.ts.map +0 -1
- package/dist/__tests__/actor-methods.test.js +0 -210
- package/dist/__tests__/actor-methods.test.js.map +0 -1
- package/dist/__tests__/actor-schema-bound.test.d.ts +0 -6
- package/dist/__tests__/actor-schema-bound.test.d.ts.map +0 -1
- package/dist/__tests__/actor-schema-bound.test.js +0 -112
- package/dist/__tests__/actor-schema-bound.test.js.map +0 -1
- package/dist/__tests__/actor-workflow-hooks.test.d.ts +0 -8
- package/dist/__tests__/actor-workflow-hooks.test.d.ts.map +0 -1
- package/dist/__tests__/actor-workflow-hooks.test.js +0 -106
- package/dist/__tests__/actor-workflow-hooks.test.js.map +0 -1
- package/dist/__tests__/app-capabilities.test.d.ts +0 -19
- package/dist/__tests__/app-capabilities.test.d.ts.map +0 -1
- package/dist/__tests__/app-capabilities.test.js +0 -57
- package/dist/__tests__/app-capabilities.test.js.map +0 -1
- package/dist/__tests__/cli-runner.test.d.ts +0 -6
- package/dist/__tests__/cli-runner.test.d.ts.map +0 -1
- package/dist/__tests__/cli-runner.test.js +0 -158
- package/dist/__tests__/cli-runner.test.js.map +0 -1
- package/dist/__tests__/create-app.test.d.ts +0 -18
- package/dist/__tests__/create-app.test.d.ts.map +0 -1
- package/dist/__tests__/create-app.test.js +0 -189
- package/dist/__tests__/create-app.test.js.map +0 -1
- package/dist/__tests__/cross-service-bus.test.d.ts +0 -8
- package/dist/__tests__/cross-service-bus.test.d.ts.map +0 -1
- package/dist/__tests__/cross-service-bus.test.js +0 -139
- package/dist/__tests__/cross-service-bus.test.js.map +0 -1
- package/dist/__tests__/define-schema.test.d.ts +0 -5
- package/dist/__tests__/define-schema.test.d.ts.map +0 -1
- package/dist/__tests__/define-schema.test.js +0 -83
- package/dist/__tests__/define-schema.test.js.map +0 -1
- package/dist/__tests__/dev-logger.test.d.ts +0 -9
- package/dist/__tests__/dev-logger.test.d.ts.map +0 -1
- package/dist/__tests__/dev-logger.test.js +0 -126
- package/dist/__tests__/dev-logger.test.js.map +0 -1
- package/dist/__tests__/external-call.test.d.ts +0 -14
- package/dist/__tests__/external-call.test.d.ts.map +0 -1
- package/dist/__tests__/external-call.test.js +0 -99
- package/dist/__tests__/external-call.test.js.map +0 -1
- package/dist/__tests__/framework-events.test.d.ts +0 -13
- package/dist/__tests__/framework-events.test.d.ts.map +0 -1
- package/dist/__tests__/framework-events.test.js +0 -204
- package/dist/__tests__/framework-events.test.js.map +0 -1
- package/dist/__tests__/inline-handler.test.d.ts +0 -8
- package/dist/__tests__/inline-handler.test.d.ts.map +0 -1
- package/dist/__tests__/inline-handler.test.js +0 -101
- package/dist/__tests__/inline-handler.test.js.map +0 -1
- package/dist/__tests__/lifecycle-logging.test.d.ts +0 -12
- package/dist/__tests__/lifecycle-logging.test.d.ts.map +0 -1
- package/dist/__tests__/lifecycle-logging.test.js +0 -114
- package/dist/__tests__/lifecycle-logging.test.js.map +0 -1
- package/dist/__tests__/middleware.test.d.ts +0 -7
- package/dist/__tests__/middleware.test.d.ts.map +0 -1
- package/dist/__tests__/middleware.test.js +0 -109
- package/dist/__tests__/middleware.test.js.map +0 -1
- package/dist/__tests__/module-needs.test.d.ts +0 -10
- package/dist/__tests__/module-needs.test.d.ts.map +0 -1
- package/dist/__tests__/module-needs.test.js +0 -77
- package/dist/__tests__/module-needs.test.js.map +0 -1
- package/dist/__tests__/module-topo-sort.test.d.ts +0 -15
- package/dist/__tests__/module-topo-sort.test.d.ts.map +0 -1
- package/dist/__tests__/module-topo-sort.test.js +0 -105
- package/dist/__tests__/module-topo-sort.test.js.map +0 -1
- package/dist/__tests__/multi-tenancy.test.d.ts +0 -10
- package/dist/__tests__/multi-tenancy.test.d.ts.map +0 -1
- package/dist/__tests__/multi-tenancy.test.js +0 -122
- package/dist/__tests__/multi-tenancy.test.js.map +0 -1
- package/dist/__tests__/needs-topology.test.d.ts +0 -11
- package/dist/__tests__/needs-topology.test.d.ts.map +0 -1
- package/dist/__tests__/needs-topology.test.js +0 -82
- package/dist/__tests__/needs-topology.test.js.map +0 -1
- package/dist/__tests__/plugin-app-narrow.test.d.ts +0 -12
- package/dist/__tests__/plugin-app-narrow.test.d.ts.map +0 -1
- package/dist/__tests__/plugin-app-narrow.test.js +0 -77
- package/dist/__tests__/plugin-app-narrow.test.js.map +0 -1
- package/dist/__tests__/plugin-closure.test.d.ts +0 -15
- package/dist/__tests__/plugin-closure.test.d.ts.map +0 -1
- package/dist/__tests__/plugin-closure.test.js +0 -140
- package/dist/__tests__/plugin-closure.test.js.map +0 -1
- package/dist/__tests__/plugin-stress.test.d.ts +0 -21
- package/dist/__tests__/plugin-stress.test.d.ts.map +0 -1
- package/dist/__tests__/plugin-stress.test.js +0 -203
- package/dist/__tests__/plugin-stress.test.js.map +0 -1
- package/dist/__tests__/plugin.test.d.ts +0 -10
- package/dist/__tests__/plugin.test.d.ts.map +0 -1
- package/dist/__tests__/plugin.test.js +0 -225
- package/dist/__tests__/plugin.test.js.map +0 -1
- package/dist/__tests__/primitives.test.d.ts +0 -9
- package/dist/__tests__/primitives.test.d.ts.map +0 -1
- package/dist/__tests__/primitives.test.js +0 -434
- package/dist/__tests__/primitives.test.js.map +0 -1
- package/dist/__tests__/production-readiness.test.d.ts +0 -22
- package/dist/__tests__/production-readiness.test.d.ts.map +0 -1
- package/dist/__tests__/production-readiness.test.js +0 -196
- package/dist/__tests__/production-readiness.test.js.map +0 -1
- package/dist/__tests__/provider.test.d.ts +0 -6
- package/dist/__tests__/provider.test.d.ts.map +0 -1
- package/dist/__tests__/provider.test.js +0 -122
- package/dist/__tests__/provider.test.js.map +0 -1
- package/dist/__tests__/public-marker.test.d.ts +0 -7
- package/dist/__tests__/public-marker.test.d.ts.map +0 -1
- package/dist/__tests__/public-marker.test.js +0 -58
- package/dist/__tests__/public-marker.test.js.map +0 -1
- package/dist/__tests__/retry-dlq.test.d.ts +0 -6
- package/dist/__tests__/retry-dlq.test.d.ts.map +0 -1
- package/dist/__tests__/retry-dlq.test.js +0 -68
- package/dist/__tests__/retry-dlq.test.js.map +0 -1
- package/dist/__tests__/validate.test.d.ts +0 -5
- package/dist/__tests__/validate.test.d.ts.map +0 -1
- package/dist/__tests__/validate.test.js +0 -53
- package/dist/__tests__/validate.test.js.map +0 -1
- package/dist/__tests__/workflow-saga.test.d.ts +0 -7
- package/dist/__tests__/workflow-saga.test.d.ts.map +0 -1
- package/dist/__tests__/workflow-saga.test.js +0 -265
- package/dist/__tests__/workflow-saga.test.js.map +0 -1
- package/dist/actor-store.d.ts.map +0 -1
- package/dist/actor-store.js.map +0 -1
- package/dist/cli-runner.d.ts.map +0 -1
- package/dist/cli-runner.js.map +0 -1
- package/dist/create-app.d.ts +0 -146
- package/dist/create-app.d.ts.map +0 -1
- package/dist/create-app.js +0 -703
- package/dist/create-app.js.map +0 -1
- package/dist/define-action.d.ts.map +0 -1
- package/dist/define-action.js.map +0 -1
- package/dist/define-actor.d.ts.map +0 -1
- package/dist/define-actor.js.map +0 -1
- package/dist/define-app.d.ts +0 -104
- package/dist/define-app.d.ts.map +0 -1
- package/dist/define-app.js +0 -49
- package/dist/define-app.js.map +0 -1
- package/dist/define-cron.d.ts.map +0 -1
- package/dist/define-cron.js.map +0 -1
- package/dist/define-error.d.ts.map +0 -1
- package/dist/define-error.js.map +0 -1
- package/dist/define-external-call.d.ts.map +0 -1
- package/dist/define-external-call.js.map +0 -1
- package/dist/define-handler.d.ts.map +0 -1
- package/dist/define-handler.js.map +0 -1
- package/dist/define-inbound-webhook.d.ts.map +0 -1
- package/dist/define-inbound-webhook.js.map +0 -1
- package/dist/define-inbox.d.ts.map +0 -1
- package/dist/define-inbox.js.map +0 -1
- package/dist/define-initializer.d.ts +0 -54
- package/dist/define-initializer.d.ts.map +0 -1
- package/dist/define-initializer.js +0 -38
- package/dist/define-initializer.js.map +0 -1
- package/dist/define-middleware.d.ts +0 -8
- package/dist/define-middleware.d.ts.map +0 -1
- package/dist/define-middleware.js +0 -8
- package/dist/define-middleware.js.map +0 -1
- package/dist/define-model.d.ts +0 -10
- package/dist/define-model.d.ts.map +0 -1
- package/dist/define-model.js +0 -13
- package/dist/define-model.js.map +0 -1
- package/dist/define-module.d.ts +0 -160
- package/dist/define-module.d.ts.map +0 -1
- package/dist/define-module.js +0 -63
- package/dist/define-module.js.map +0 -1
- package/dist/define-outbox.d.ts.map +0 -1
- package/dist/define-outbox.js.map +0 -1
- package/dist/define-plugin.d.ts +0 -195
- package/dist/define-plugin.d.ts.map +0 -1
- package/dist/define-plugin.js +0 -220
- package/dist/define-plugin.js.map +0 -1
- package/dist/define-projection.d.ts.map +0 -1
- package/dist/define-projection.js.map +0 -1
- package/dist/define-provider.d.ts +0 -49
- package/dist/define-provider.d.ts.map +0 -1
- package/dist/define-provider.js +0 -45
- package/dist/define-provider.js.map +0 -1
- package/dist/define-query.d.ts.map +0 -1
- package/dist/define-query.js.map +0 -1
- package/dist/define-resolver.d.ts +0 -111
- package/dist/define-resolver.d.ts.map +0 -1
- package/dist/define-resolver.js +0 -146
- package/dist/define-resolver.js.map +0 -1
- package/dist/define-schema.d.ts.map +0 -1
- package/dist/define-schema.js.map +0 -1
- package/dist/define-upcaster.d.ts.map +0 -1
- package/dist/define-upcaster.js.map +0 -1
- package/dist/define-workflow.d.ts.map +0 -1
- package/dist/define-workflow.js.map +0 -1
- package/dist/dev-logger.d.ts.map +0 -1
- package/dist/dev-logger.js.map +0 -1
- package/dist/event-message.d.ts.map +0 -1
- package/dist/event-message.js.map +0 -1
- package/dist/foundation.d.ts.map +0 -1
- package/dist/foundation.js.map +0 -1
- package/dist/framework-event-bus.d.ts +0 -13
- package/dist/framework-event-bus.d.ts.map +0 -1
- package/dist/framework-event-bus.js +0 -13
- package/dist/framework-event-bus.js.map +0 -1
- package/dist/framework-events.d.ts.map +0 -1
- package/dist/framework-events.js.map +0 -1
- package/dist/idempotency-store.d.ts.map +0 -1
- package/dist/idempotency-store.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/module-surface.d.ts +0 -47
- package/dist/module-surface.d.ts.map +0 -1
- package/dist/module-surface.js +0 -65
- package/dist/module-surface.js.map +0 -1
- package/dist/projection-store.d.ts.map +0 -1
- package/dist/projection-store.js.map +0 -1
- package/dist/public-marker.d.ts.map +0 -1
- package/dist/public-marker.js.map +0 -1
- package/dist/response.d.ts.map +0 -1
- package/dist/response.js.map +0 -1
- package/dist/runtime.d.ts +0 -621
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js.map +0 -1
- package/dist/when.d.ts +0 -101
- package/dist/when.d.ts.map +0 -1
- package/dist/when.js +0 -57
- package/dist/when.js.map +0 -1
- package/dist/workflow-timer-store.d.ts.map +0 -1
- package/dist/workflow-timer-store.js.map +0 -1
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin + module lifecycle stress test.
|
|
3
|
-
*
|
|
4
|
-
* Covers the failure modes that aren't exercised by `plugin.test.ts` /
|
|
5
|
-
* `plugin-closure.test.ts` / `lifecycle-logging.test.ts`:
|
|
6
|
-
*
|
|
7
|
-
* 1. Cross-plugin DI — plugin B reads plugin A's binding in its boot.
|
|
8
|
-
* 2. Slow boot timing — PluginBooted carries a real `durationMs`.
|
|
9
|
-
* 3. Boot failure recovery — A boots, B throws, stop() still cleans A.
|
|
10
|
-
* 4. Shutdown isolation — first plugin's shutdown throws but second still runs;
|
|
11
|
-
* the error surfaces from app.stop().
|
|
12
|
-
* 5. Ordering at scale — 10 plugins boot in registration order, shutdown reverse.
|
|
13
|
-
* 6. Module + plugin mixed — PluginRegistered fires with `kind:"module"` for
|
|
14
|
-
* modules first (topo order) then `kind:"plugin"` for plugins.
|
|
15
|
-
*
|
|
16
|
-
* Style follows `lifecycle-logging.test.ts` — real `createApp`, real
|
|
17
|
-
* `app.start()/stop()`, observe via the runtime's framework event bus
|
|
18
|
-
* (`runtime.frameworkEvents.onFire(...)`) and per-event subscriptions.
|
|
19
|
-
*/
|
|
20
|
-
import { describe, it, expect } from "vitest";
|
|
21
|
-
import { createApp, defineModule, definePlugin } from "../foundation.js";
|
|
22
|
-
import { PluginRegistered, PluginBooted } from "../framework-events.js";
|
|
23
|
-
import { createContainer } from "@nwire/container";
|
|
24
|
-
describe("plugin + module lifecycle stress", () => {
|
|
25
|
-
it("cross-plugin DI: plugin B's boot resolves a binding plugin A provided", async () => {
|
|
26
|
-
const pluginA = definePlugin("provider", ({ bind }) => {
|
|
27
|
-
bind("config-service", () => ({ name: "from-A" }));
|
|
28
|
-
});
|
|
29
|
-
const seen = [];
|
|
30
|
-
const pluginB = definePlugin("consumer", {
|
|
31
|
-
boot: (container) => {
|
|
32
|
-
seen.push(container.resolve("config-service"));
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const app = createApp({
|
|
36
|
-
container: createContainer(),
|
|
37
|
-
modules: [],
|
|
38
|
-
plugins: [pluginA, pluginB],
|
|
39
|
-
devLogs: false,
|
|
40
|
-
});
|
|
41
|
-
await app.start();
|
|
42
|
-
await app.stop();
|
|
43
|
-
expect(seen).toHaveLength(1);
|
|
44
|
-
expect(seen[0]).toEqual({ name: "from-A" });
|
|
45
|
-
});
|
|
46
|
-
it("slow boot timing: PluginBooted carries a durationMs >= the sleep", async () => {
|
|
47
|
-
const SLEEP_MS = 150;
|
|
48
|
-
const TOLERANCE_MS = 120;
|
|
49
|
-
const slow = definePlugin("slow-boot", {
|
|
50
|
-
boot: async () => {
|
|
51
|
-
await new Promise((resolve) => setTimeout(resolve, SLEEP_MS));
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
const app = createApp({
|
|
55
|
-
container: createContainer(),
|
|
56
|
-
modules: [],
|
|
57
|
-
plugins: [slow],
|
|
58
|
-
devLogs: false,
|
|
59
|
-
});
|
|
60
|
-
const observed = [];
|
|
61
|
-
app.runtime.frameworkEvents.on(PluginBooted, (payload) => {
|
|
62
|
-
observed.push({ name: payload.pluginName, durationMs: payload.durationMs });
|
|
63
|
-
});
|
|
64
|
-
await app.start();
|
|
65
|
-
await app.stop();
|
|
66
|
-
const slowRecord = observed.find((r) => r.name === "slow-boot");
|
|
67
|
-
expect(slowRecord).toBeDefined();
|
|
68
|
-
expect(slowRecord.durationMs).toBeGreaterThanOrEqual(TOLERANCE_MS);
|
|
69
|
-
});
|
|
70
|
-
it("boot failure recovery: B throws, A booted, stop() still cleans up A", async () => {
|
|
71
|
-
const bootErr = new Error("plugin B boot exploded");
|
|
72
|
-
const pluginA = definePlugin("a", {
|
|
73
|
-
boot: () => {
|
|
74
|
-
/* succeeds */
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
const pluginB = definePlugin("b", {
|
|
78
|
-
boot: () => {
|
|
79
|
-
throw bootErr;
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
const pluginC = definePlugin("c", {
|
|
83
|
-
boot: () => {
|
|
84
|
-
/* should never run — B's failure aborts boot */
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
const app = createApp({
|
|
88
|
-
container: createContainer(),
|
|
89
|
-
modules: [],
|
|
90
|
-
plugins: [pluginA, pluginB, pluginC],
|
|
91
|
-
devLogs: false,
|
|
92
|
-
});
|
|
93
|
-
const bootedNames = [];
|
|
94
|
-
app.runtime.frameworkEvents.on(PluginBooted, (payload) => {
|
|
95
|
-
bootedNames.push(payload.pluginName);
|
|
96
|
-
});
|
|
97
|
-
const shutdownNames = [];
|
|
98
|
-
// Use the catch-all observer the dev logger / Studio use, so we see
|
|
99
|
-
// every firing regardless of subscriber count.
|
|
100
|
-
app.runtime.frameworkEvents.onFire((rec) => {
|
|
101
|
-
if (rec.eventName === "nwire.plugin.shutdown") {
|
|
102
|
-
const p = rec.payload;
|
|
103
|
-
shutdownNames.push(p.pluginName);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
await expect(app.start()).rejects.toBe(bootErr);
|
|
107
|
-
// A booted before B threw. C should NOT have booted.
|
|
108
|
-
expect(bootedNames).toContain("a");
|
|
109
|
-
expect(bootedNames).not.toContain("c");
|
|
110
|
-
// Now tear the app down — shutdown should still emit PluginShutdown
|
|
111
|
-
// events in reverse declaration order so observers see a clean close.
|
|
112
|
-
await app.stop();
|
|
113
|
-
// A must appear in the shutdown sweep regardless of B's boot failure.
|
|
114
|
-
expect(shutdownNames).toContain("a");
|
|
115
|
-
// Reverse order: C is iterated first, then B, then A. (Their
|
|
116
|
-
// shutdown callbacks are no-ops because none was registered, but
|
|
117
|
-
// the framework still fires the lifecycle events.)
|
|
118
|
-
const aIdx = shutdownNames.indexOf("a");
|
|
119
|
-
const cIdx = shutdownNames.indexOf("c");
|
|
120
|
-
if (cIdx >= 0) {
|
|
121
|
-
// When C appears (framework also fires shutdown events for plugins
|
|
122
|
-
// that never booted), it must come BEFORE A.
|
|
123
|
-
expect(cIdx).toBeLessThan(aIdx);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
it("shutdown isolation: first plugin's shutdown throws, second still runs, error surfaces from stop()", async () => {
|
|
127
|
-
const shutErr = new Error("plugin A shutdown failed");
|
|
128
|
-
const cleanupRan = [];
|
|
129
|
-
const pluginA = definePlugin("a", {
|
|
130
|
-
shutdown: () => {
|
|
131
|
-
cleanupRan.push("a-attempted");
|
|
132
|
-
throw shutErr;
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
const pluginB = definePlugin("b", {
|
|
136
|
-
shutdown: () => {
|
|
137
|
-
cleanupRan.push("b-ran");
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
const app = createApp({
|
|
141
|
-
container: createContainer(),
|
|
142
|
-
modules: [],
|
|
143
|
-
plugins: [pluginA, pluginB],
|
|
144
|
-
devLogs: false,
|
|
145
|
-
});
|
|
146
|
-
await app.start();
|
|
147
|
-
// Shutdown order is reverse: B first, then A. B should run cleanly;
|
|
148
|
-
// then A throws. The framework must surface A's error but only AFTER
|
|
149
|
-
// every other shutdown step has run.
|
|
150
|
-
await expect(app.stop()).rejects.toBe(shutErr);
|
|
151
|
-
expect(cleanupRan).toEqual(["b-ran", "a-attempted"]);
|
|
152
|
-
});
|
|
153
|
-
it("ordering at scale: 10 plugins boot in registration order, shutdown reverse", async () => {
|
|
154
|
-
const boots = [];
|
|
155
|
-
const shutdowns = [];
|
|
156
|
-
const plugins = Array.from({ length: 10 }, (_, i) => {
|
|
157
|
-
const name = `p${i}`;
|
|
158
|
-
return definePlugin(name, {
|
|
159
|
-
boot: () => {
|
|
160
|
-
boots.push(name);
|
|
161
|
-
},
|
|
162
|
-
shutdown: () => {
|
|
163
|
-
shutdowns.push(name);
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
const app = createApp({
|
|
168
|
-
container: createContainer(),
|
|
169
|
-
modules: [],
|
|
170
|
-
plugins,
|
|
171
|
-
devLogs: false,
|
|
172
|
-
});
|
|
173
|
-
await app.start();
|
|
174
|
-
await app.stop();
|
|
175
|
-
expect(boots).toEqual(["p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"]);
|
|
176
|
-
expect(shutdowns).toEqual(["p9", "p8", "p7", "p6", "p5", "p4", "p3", "p2", "p1", "p0"]);
|
|
177
|
-
});
|
|
178
|
-
it("module + plugin mixed: PluginRegistered fires for modules first (topo) then plugins, with correct kind", async () => {
|
|
179
|
-
const moduleA = defineModule("mod-a", {});
|
|
180
|
-
const moduleB = defineModule("mod-b", {});
|
|
181
|
-
const pluginX = definePlugin("plug-x", {});
|
|
182
|
-
const pluginY = definePlugin("plug-y", {});
|
|
183
|
-
const app = createApp({
|
|
184
|
-
container: createContainer(),
|
|
185
|
-
modules: [moduleA, moduleB],
|
|
186
|
-
plugins: [pluginX, pluginY],
|
|
187
|
-
devLogs: false,
|
|
188
|
-
});
|
|
189
|
-
const registrations = [];
|
|
190
|
-
app.runtime.frameworkEvents.on(PluginRegistered, (payload) => {
|
|
191
|
-
registrations.push({ pluginName: payload.pluginName, kind: payload.kind });
|
|
192
|
-
});
|
|
193
|
-
await app.start();
|
|
194
|
-
await app.stop();
|
|
195
|
-
expect(registrations).toEqual([
|
|
196
|
-
{ pluginName: "mod-a", kind: "module" },
|
|
197
|
-
{ pluginName: "mod-b", kind: "module" },
|
|
198
|
-
{ pluginName: "plug-x", kind: "plugin" },
|
|
199
|
-
{ pluginName: "plug-y", kind: "plugin" },
|
|
200
|
-
]);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
//# sourceMappingURL=plugin-stress.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-stress.test.js","sourceRoot":"","sources":["../../src/__tests__/plugin-stress.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;QAKrF,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YACpD,IAAI,CAAgB,gBAAgB,EAAE,GAAG,EAAE,CAA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
/**
|
|
2
|
-
* `definePlugin` — the only extension primitive.
|
|
3
|
-
*
|
|
4
|
-
* Plugins compose alongside modules. They bind values on the container,
|
|
5
|
-
* subscribe to framework events, contribute middleware + actor hooks, and
|
|
6
|
-
* own boot/shutdown lifecycle. Both authoring forms (object + closure)
|
|
7
|
-
* route through the same registration loop.
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=plugin.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/plugin.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `definePlugin` — the only extension primitive.
|
|
3
|
-
*
|
|
4
|
-
* Plugins compose alongside modules. They bind values on the container,
|
|
5
|
-
* subscribe to framework events, contribute middleware + actor hooks, and
|
|
6
|
-
* own boot/shutdown lifecycle. Both authoring forms (object + closure)
|
|
7
|
-
* route through the same registration loop.
|
|
8
|
-
*/
|
|
9
|
-
import { describe, it, expect } from "vitest";
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
import { defineEvent } from "@nwire/messages";
|
|
12
|
-
import { definePlugin, defineAction, defineActor, defineModule, createApp, eventFactory, } from "../foundation.js";
|
|
13
|
-
describe("definePlugin", () => {
|
|
14
|
-
it("object-form register/boot/shutdown lifecycle fires in correct order", async () => {
|
|
15
|
-
const order = [];
|
|
16
|
-
const plugin = definePlugin("audit", {
|
|
17
|
-
register: (container) => {
|
|
18
|
-
order.push("plugin.register");
|
|
19
|
-
container.register("auditLog", { tag: "audit" });
|
|
20
|
-
},
|
|
21
|
-
boot: async () => {
|
|
22
|
-
order.push("plugin.boot");
|
|
23
|
-
},
|
|
24
|
-
shutdown: async () => {
|
|
25
|
-
order.push("plugin.shutdown");
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
const app = createApp({ modules: [], plugins: [plugin] });
|
|
29
|
-
await app.start();
|
|
30
|
-
await app.stop();
|
|
31
|
-
expect(order).toEqual(["plugin.register", "plugin.boot", "plugin.shutdown"]);
|
|
32
|
-
});
|
|
33
|
-
it("closure-form: bind / boot / shutdown / resolve compose end-to-end", async () => {
|
|
34
|
-
const counterPlugin = definePlugin("counter", ({ bind }) => {
|
|
35
|
-
bind("counter", () => {
|
|
36
|
-
const counter = {
|
|
37
|
-
value: 0,
|
|
38
|
-
incr() {
|
|
39
|
-
counter.value += 1;
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
return counter;
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
let observed = -1;
|
|
46
|
-
const bump = defineAction({
|
|
47
|
-
name: "bump",
|
|
48
|
-
schema: z.object({}),
|
|
49
|
-
handler: async (_input, ctx) => {
|
|
50
|
-
const counter = ctx.resolve("counter");
|
|
51
|
-
counter.incr();
|
|
52
|
-
observed = counter.value;
|
|
53
|
-
return undefined;
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
const app = createApp({
|
|
57
|
-
modules: [defineModule("m", { actions: [bump] })],
|
|
58
|
-
plugins: [counterPlugin],
|
|
59
|
-
});
|
|
60
|
-
await app.start();
|
|
61
|
-
await app.runtime.dispatch(bump, {});
|
|
62
|
-
await app.runtime.dispatch(bump, {});
|
|
63
|
-
expect(observed).toBe(2);
|
|
64
|
-
await app.stop();
|
|
65
|
-
});
|
|
66
|
-
it("middleware composes around dispatch", async () => {
|
|
67
|
-
const trace = [];
|
|
68
|
-
const action = defineAction({
|
|
69
|
-
name: "ping",
|
|
70
|
-
schema: z.object({}),
|
|
71
|
-
handler: async () => {
|
|
72
|
-
trace.push("handler");
|
|
73
|
-
return undefined;
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
const plugin = definePlugin("trace", {
|
|
77
|
-
middleware: [
|
|
78
|
-
async (next) => {
|
|
79
|
-
trace.push("mw:before");
|
|
80
|
-
const r = await next();
|
|
81
|
-
trace.push("mw:after");
|
|
82
|
-
return r;
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
});
|
|
86
|
-
const app = createApp({
|
|
87
|
-
modules: [defineModule("m", { actions: [action] })],
|
|
88
|
-
plugins: [plugin],
|
|
89
|
-
});
|
|
90
|
-
await app.start();
|
|
91
|
-
await app.runtime.dispatch(action, {});
|
|
92
|
-
await app.stop();
|
|
93
|
-
expect(trace).toEqual(["mw:before", "handler", "mw:after"]);
|
|
94
|
-
});
|
|
95
|
-
it("actorHooks.afterTransition fires AFTER actor state change persists", async () => {
|
|
96
|
-
const TickSchema = z.object({ counter: z.number() });
|
|
97
|
-
const TickedEventDef = defineEvent({
|
|
98
|
-
name: "tick.ticked",
|
|
99
|
-
schema: z.object({ tickId: z.string() }),
|
|
100
|
-
});
|
|
101
|
-
const Ticked = eventFactory(TickedEventDef);
|
|
102
|
-
const Tick = defineActor("tick", {
|
|
103
|
-
schema: TickSchema,
|
|
104
|
-
key: "tickId",
|
|
105
|
-
initial: "fresh",
|
|
106
|
-
states: {
|
|
107
|
-
fresh: {
|
|
108
|
-
on: {
|
|
109
|
-
[TickedEventDef.name]: {
|
|
110
|
-
target: "done",
|
|
111
|
-
assign: (state) => ({ counter: (state.counter ?? 0) + 1 }),
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
done: { final: true },
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
const tickIt = defineAction({
|
|
119
|
-
name: "tick.it",
|
|
120
|
-
schema: z.object({ tickId: z.string() }),
|
|
121
|
-
handler: async (input) => Ticked({ tickId: input.tickId }),
|
|
122
|
-
});
|
|
123
|
-
const observed = [];
|
|
124
|
-
const observer = definePlugin("observer", {
|
|
125
|
-
actorHooks: {
|
|
126
|
-
afterTransition: (_actor, _key, fromState, toState) => {
|
|
127
|
-
observed.push({ from: fromState, to: toState });
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
const app = createApp({
|
|
132
|
-
modules: [
|
|
133
|
-
defineModule("m", {
|
|
134
|
-
actions: [tickIt],
|
|
135
|
-
actors: [Tick],
|
|
136
|
-
events: [TickedEventDef],
|
|
137
|
-
}),
|
|
138
|
-
],
|
|
139
|
-
plugins: [observer],
|
|
140
|
-
});
|
|
141
|
-
await app.start();
|
|
142
|
-
await app.runtime.dispatch(tickIt, { tickId: "t1" });
|
|
143
|
-
await app.stop();
|
|
144
|
-
expect(observed).toEqual([{ from: "fresh", to: "done" }]);
|
|
145
|
-
});
|
|
146
|
-
it("plugins boot in declaration order; shutdown in REVERSE", async () => {
|
|
147
|
-
const order = [];
|
|
148
|
-
const a = definePlugin("a", {
|
|
149
|
-
boot: async () => {
|
|
150
|
-
order.push("a.boot");
|
|
151
|
-
},
|
|
152
|
-
shutdown: async () => {
|
|
153
|
-
order.push("a.shutdown");
|
|
154
|
-
},
|
|
155
|
-
});
|
|
156
|
-
const b = definePlugin("b", {
|
|
157
|
-
boot: async () => {
|
|
158
|
-
order.push("b.boot");
|
|
159
|
-
},
|
|
160
|
-
shutdown: async () => {
|
|
161
|
-
order.push("b.shutdown");
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
const app = createApp({ modules: [], plugins: [a, b] });
|
|
165
|
-
await app.start();
|
|
166
|
-
await app.stop();
|
|
167
|
-
expect(order).toEqual(["a.boot", "b.boot", "b.shutdown", "a.shutdown"]);
|
|
168
|
-
});
|
|
169
|
-
it("shutdown errors propagate (so wires can detect stuck shutdowns)", async () => {
|
|
170
|
-
const flaky = definePlugin("flaky", {
|
|
171
|
-
boot: async () => undefined,
|
|
172
|
-
shutdown: async () => {
|
|
173
|
-
throw new Error("shutdown failed");
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
const app = createApp({ modules: [], plugins: [flaky] });
|
|
177
|
-
await app.start();
|
|
178
|
-
await expect(app.stop()).rejects.toThrow(/shutdown failed/);
|
|
179
|
-
});
|
|
180
|
-
it("a bad plugin's shutdown does NOT block subsequent plugins", async () => {
|
|
181
|
-
const order = [];
|
|
182
|
-
const bad = definePlugin("bad", {
|
|
183
|
-
shutdown: async () => {
|
|
184
|
-
order.push("bad.attempted");
|
|
185
|
-
throw new Error("boom");
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
const good = definePlugin("good", {
|
|
189
|
-
shutdown: async () => {
|
|
190
|
-
order.push("good.shutdown");
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
// Declaration order: bad → good. Reverse shutdown: good → bad. Good
|
|
194
|
-
// must run before bad's failure is surfaced.
|
|
195
|
-
const app = createApp({ modules: [], plugins: [bad, good] });
|
|
196
|
-
await app.start();
|
|
197
|
-
await expect(app.stop()).rejects.toThrow(/boom/);
|
|
198
|
-
expect(order).toEqual(["good.shutdown", "bad.attempted"]);
|
|
199
|
-
});
|
|
200
|
-
it("plugin can register values on the container at register time", async () => {
|
|
201
|
-
const auditPlugin = definePlugin("audit", {
|
|
202
|
-
register: (container) => {
|
|
203
|
-
container.register("auditLogger", { tag: "audit" });
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
let seen = null;
|
|
207
|
-
const action = defineAction({
|
|
208
|
-
name: "audited",
|
|
209
|
-
schema: z.object({}),
|
|
210
|
-
handler: async (_input, ctx) => {
|
|
211
|
-
seen = ctx.resolve("auditLogger");
|
|
212
|
-
return undefined;
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
const app = createApp({
|
|
216
|
-
modules: [defineModule("m", { actions: [action] })],
|
|
217
|
-
plugins: [auditPlugin],
|
|
218
|
-
});
|
|
219
|
-
await app.start();
|
|
220
|
-
await app.runtime.dispatch(action, {});
|
|
221
|
-
expect(seen).toEqual({ tag: "audit" });
|
|
222
|
-
await app.stop();
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
//# sourceMappingURL=plugin.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.test.js","sourceRoot":"","sources":["../../src/__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,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;gBAC7B,IAAI,GAAG,GAAG,CAAC,OAAO,CAAkB,aAAa,CAAC,CAAC;gBACnD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,SAAS,CAAC;YACpB,OAAO,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACnD,OAAO,EAAE,CAAC,WAAW,CAAC;SACvB,CAAC,CAAC;QACH,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QACvC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Forge contract tests — verify the public surface and the runtime end-to-end.
|
|
3
|
-
*
|
|
4
|
-
* Each test exercises one design rule. If a test fails, it likely means a
|
|
5
|
-
* design rule changed and either the docs or the runtime need to be brought
|
|
6
|
-
* back in sync.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=primitives.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/primitives.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|