@nwire/forge 0.7.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/LICENSE +21 -0
- package/README.md +77 -0
- package/dist/__tests__/actor-methods.test.d.ts +9 -0
- package/dist/__tests__/actor-methods.test.d.ts.map +1 -0
- package/dist/__tests__/actor-methods.test.js +210 -0
- package/dist/__tests__/actor-methods.test.js.map +1 -0
- package/dist/__tests__/actor-schema-bound.test.d.ts +6 -0
- package/dist/__tests__/actor-schema-bound.test.d.ts.map +1 -0
- package/dist/__tests__/actor-schema-bound.test.js +112 -0
- package/dist/__tests__/actor-schema-bound.test.js.map +1 -0
- package/dist/__tests__/app-capabilities.test.d.ts +19 -0
- package/dist/__tests__/app-capabilities.test.d.ts.map +1 -0
- package/dist/__tests__/app-capabilities.test.js +57 -0
- package/dist/__tests__/app-capabilities.test.js.map +1 -0
- package/dist/__tests__/cli-runner.test.d.ts +6 -0
- package/dist/__tests__/cli-runner.test.d.ts.map +1 -0
- package/dist/__tests__/cli-runner.test.js +158 -0
- package/dist/__tests__/cli-runner.test.js.map +1 -0
- package/dist/__tests__/create-app.test.d.ts +18 -0
- package/dist/__tests__/create-app.test.d.ts.map +1 -0
- package/dist/__tests__/create-app.test.js +189 -0
- package/dist/__tests__/create-app.test.js.map +1 -0
- package/dist/__tests__/cross-service-bus.test.d.ts +8 -0
- package/dist/__tests__/cross-service-bus.test.d.ts.map +1 -0
- package/dist/__tests__/cross-service-bus.test.js +139 -0
- package/dist/__tests__/cross-service-bus.test.js.map +1 -0
- package/dist/__tests__/define-schema.test.d.ts +5 -0
- package/dist/__tests__/define-schema.test.d.ts.map +1 -0
- package/dist/__tests__/define-schema.test.js +83 -0
- package/dist/__tests__/define-schema.test.js.map +1 -0
- package/dist/__tests__/dev-logger.test.d.ts +9 -0
- package/dist/__tests__/dev-logger.test.d.ts.map +1 -0
- package/dist/__tests__/dev-logger.test.js +126 -0
- package/dist/__tests__/dev-logger.test.js.map +1 -0
- package/dist/__tests__/external-call.test.d.ts +14 -0
- package/dist/__tests__/external-call.test.d.ts.map +1 -0
- package/dist/__tests__/external-call.test.js +99 -0
- package/dist/__tests__/external-call.test.js.map +1 -0
- package/dist/__tests__/framework-events.test.d.ts +13 -0
- package/dist/__tests__/framework-events.test.d.ts.map +1 -0
- package/dist/__tests__/framework-events.test.js +204 -0
- package/dist/__tests__/framework-events.test.js.map +1 -0
- package/dist/__tests__/inline-handler.test.d.ts +8 -0
- package/dist/__tests__/inline-handler.test.d.ts.map +1 -0
- package/dist/__tests__/inline-handler.test.js +101 -0
- package/dist/__tests__/inline-handler.test.js.map +1 -0
- package/dist/__tests__/lifecycle-logging.test.d.ts +12 -0
- package/dist/__tests__/lifecycle-logging.test.d.ts.map +1 -0
- package/dist/__tests__/lifecycle-logging.test.js +112 -0
- package/dist/__tests__/lifecycle-logging.test.js.map +1 -0
- package/dist/__tests__/middleware.test.d.ts +7 -0
- package/dist/__tests__/middleware.test.d.ts.map +1 -0
- package/dist/__tests__/middleware.test.js +109 -0
- package/dist/__tests__/middleware.test.js.map +1 -0
- package/dist/__tests__/module-needs.test.d.ts +10 -0
- package/dist/__tests__/module-needs.test.d.ts.map +1 -0
- package/dist/__tests__/module-needs.test.js +77 -0
- package/dist/__tests__/module-needs.test.js.map +1 -0
- package/dist/__tests__/module-topo-sort.test.d.ts +15 -0
- package/dist/__tests__/module-topo-sort.test.d.ts.map +1 -0
- package/dist/__tests__/module-topo-sort.test.js +105 -0
- package/dist/__tests__/module-topo-sort.test.js.map +1 -0
- package/dist/__tests__/multi-tenancy.test.d.ts +10 -0
- package/dist/__tests__/multi-tenancy.test.d.ts.map +1 -0
- package/dist/__tests__/multi-tenancy.test.js +122 -0
- package/dist/__tests__/multi-tenancy.test.js.map +1 -0
- package/dist/__tests__/needs-topology.test.d.ts +11 -0
- package/dist/__tests__/needs-topology.test.d.ts.map +1 -0
- package/dist/__tests__/needs-topology.test.js +82 -0
- package/dist/__tests__/needs-topology.test.js.map +1 -0
- package/dist/__tests__/plugin-closure.test.d.ts +15 -0
- package/dist/__tests__/plugin-closure.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-closure.test.js +140 -0
- package/dist/__tests__/plugin-closure.test.js.map +1 -0
- package/dist/__tests__/plugin.test.d.ts +10 -0
- package/dist/__tests__/plugin.test.d.ts.map +1 -0
- package/dist/__tests__/plugin.test.js +225 -0
- package/dist/__tests__/plugin.test.js.map +1 -0
- package/dist/__tests__/primitives.test.d.ts +9 -0
- package/dist/__tests__/primitives.test.d.ts.map +1 -0
- package/dist/__tests__/primitives.test.js +434 -0
- package/dist/__tests__/primitives.test.js.map +1 -0
- package/dist/__tests__/production-readiness.test.d.ts +22 -0
- package/dist/__tests__/production-readiness.test.d.ts.map +1 -0
- package/dist/__tests__/production-readiness.test.js +196 -0
- package/dist/__tests__/production-readiness.test.js.map +1 -0
- package/dist/__tests__/provider.test.d.ts +6 -0
- package/dist/__tests__/provider.test.d.ts.map +1 -0
- package/dist/__tests__/provider.test.js +122 -0
- package/dist/__tests__/provider.test.js.map +1 -0
- package/dist/__tests__/public-marker.test.d.ts +7 -0
- package/dist/__tests__/public-marker.test.d.ts.map +1 -0
- package/dist/__tests__/public-marker.test.js +54 -0
- package/dist/__tests__/public-marker.test.js.map +1 -0
- package/dist/__tests__/retry-dlq.test.d.ts +6 -0
- package/dist/__tests__/retry-dlq.test.d.ts.map +1 -0
- package/dist/__tests__/retry-dlq.test.js +68 -0
- package/dist/__tests__/retry-dlq.test.js.map +1 -0
- package/dist/__tests__/validate.test.d.ts +5 -0
- package/dist/__tests__/validate.test.d.ts.map +1 -0
- package/dist/__tests__/validate.test.js +53 -0
- package/dist/__tests__/validate.test.js.map +1 -0
- package/dist/__tests__/workflow-saga.test.d.ts +7 -0
- package/dist/__tests__/workflow-saga.test.d.ts.map +1 -0
- package/dist/__tests__/workflow-saga.test.js +239 -0
- package/dist/__tests__/workflow-saga.test.js.map +1 -0
- package/dist/actor-store.d.ts +83 -0
- package/dist/actor-store.d.ts.map +1 -0
- package/dist/actor-store.js +85 -0
- package/dist/actor-store.js.map +1 -0
- package/dist/cli-runner.d.ts +46 -0
- package/dist/cli-runner.d.ts.map +1 -0
- package/dist/cli-runner.js +164 -0
- package/dist/cli-runner.js.map +1 -0
- package/dist/create-app.d.ts +131 -0
- package/dist/create-app.d.ts.map +1 -0
- package/dist/create-app.js +593 -0
- package/dist/create-app.js.map +1 -0
- package/dist/define-action.d.ts +148 -0
- package/dist/define-action.d.ts.map +1 -0
- package/dist/define-action.js +52 -0
- package/dist/define-action.js.map +1 -0
- package/dist/define-actor.d.ts +302 -0
- package/dist/define-actor.d.ts.map +1 -0
- package/dist/define-actor.js +294 -0
- package/dist/define-actor.js.map +1 -0
- package/dist/define-app.d.ts +104 -0
- package/dist/define-app.d.ts.map +1 -0
- package/dist/define-app.js +49 -0
- package/dist/define-app.js.map +1 -0
- package/dist/define-cron.d.ts +50 -0
- package/dist/define-cron.d.ts.map +1 -0
- package/dist/define-cron.js +34 -0
- package/dist/define-cron.js.map +1 -0
- package/dist/define-error.d.ts +10 -0
- package/dist/define-error.d.ts.map +1 -0
- package/dist/define-error.js +10 -0
- package/dist/define-error.js.map +1 -0
- package/dist/define-external-call.d.ts +85 -0
- package/dist/define-external-call.d.ts.map +1 -0
- package/dist/define-external-call.js +38 -0
- package/dist/define-external-call.js.map +1 -0
- package/dist/define-handler.d.ts +98 -0
- package/dist/define-handler.d.ts.map +1 -0
- package/dist/define-handler.js +29 -0
- package/dist/define-handler.js.map +1 -0
- package/dist/define-inbound-webhook.d.ts +82 -0
- package/dist/define-inbound-webhook.d.ts.map +1 -0
- package/dist/define-inbound-webhook.js +42 -0
- package/dist/define-inbound-webhook.js.map +1 -0
- package/dist/define-inbox.d.ts +40 -0
- package/dist/define-inbox.d.ts.map +1 -0
- package/dist/define-inbox.js +31 -0
- package/dist/define-inbox.js.map +1 -0
- package/dist/define-initializer.d.ts +54 -0
- package/dist/define-initializer.d.ts.map +1 -0
- package/dist/define-initializer.js +38 -0
- package/dist/define-initializer.js.map +1 -0
- package/dist/define-middleware.d.ts +8 -0
- package/dist/define-middleware.d.ts.map +1 -0
- package/dist/define-middleware.js +8 -0
- package/dist/define-middleware.js.map +1 -0
- package/dist/define-model.d.ts +10 -0
- package/dist/define-model.d.ts.map +1 -0
- package/dist/define-model.js +13 -0
- package/dist/define-model.js.map +1 -0
- package/dist/define-module.d.ts +157 -0
- package/dist/define-module.d.ts.map +1 -0
- package/dist/define-module.js +60 -0
- package/dist/define-module.js.map +1 -0
- package/dist/define-outbox.d.ts +47 -0
- package/dist/define-outbox.d.ts.map +1 -0
- package/dist/define-outbox.js +36 -0
- package/dist/define-outbox.js.map +1 -0
- package/dist/define-plugin.d.ts +171 -0
- package/dist/define-plugin.d.ts.map +1 -0
- package/dist/define-plugin.js +134 -0
- package/dist/define-plugin.js.map +1 -0
- package/dist/define-projection.d.ts +56 -0
- package/dist/define-projection.d.ts.map +1 -0
- package/dist/define-projection.js +44 -0
- package/dist/define-projection.js.map +1 -0
- package/dist/define-provider.d.ts +49 -0
- package/dist/define-provider.d.ts.map +1 -0
- package/dist/define-provider.js +45 -0
- package/dist/define-provider.js.map +1 -0
- package/dist/define-query.d.ts +50 -0
- package/dist/define-query.d.ts.map +1 -0
- package/dist/define-query.js +33 -0
- package/dist/define-query.js.map +1 -0
- package/dist/define-resolver.d.ts +111 -0
- package/dist/define-resolver.d.ts.map +1 -0
- package/dist/define-resolver.js +146 -0
- package/dist/define-resolver.js.map +1 -0
- package/dist/define-schema.d.ts +88 -0
- package/dist/define-schema.d.ts.map +1 -0
- package/dist/define-schema.js +72 -0
- package/dist/define-schema.js.map +1 -0
- package/dist/define-workflow.d.ts +193 -0
- package/dist/define-workflow.d.ts.map +1 -0
- package/dist/define-workflow.js +345 -0
- package/dist/define-workflow.js.map +1 -0
- package/dist/dev-logger.d.ts +41 -0
- package/dist/dev-logger.d.ts.map +1 -0
- package/dist/dev-logger.js +135 -0
- package/dist/dev-logger.js.map +1 -0
- package/dist/event-message.d.ts +37 -0
- package/dist/event-message.d.ts.map +1 -0
- package/dist/event-message.js +51 -0
- package/dist/event-message.js.map +1 -0
- package/dist/foundation.d.ts +14 -0
- package/dist/foundation.d.ts.map +1 -0
- package/dist/foundation.js +14 -0
- package/dist/foundation.js.map +1 -0
- package/dist/framework-event-bus.d.ts +13 -0
- package/dist/framework-event-bus.d.ts.map +1 -0
- package/dist/framework-event-bus.js +13 -0
- package/dist/framework-event-bus.js.map +1 -0
- package/dist/framework-events.d.ts +121 -0
- package/dist/framework-events.d.ts.map +1 -0
- package/dist/framework-events.js +67 -0
- package/dist/framework-events.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/module-surface.d.ts +47 -0
- package/dist/module-surface.d.ts.map +1 -0
- package/dist/module-surface.js +65 -0
- package/dist/module-surface.js.map +1 -0
- package/dist/projection-store.d.ts +26 -0
- package/dist/projection-store.d.ts.map +1 -0
- package/dist/projection-store.js +28 -0
- package/dist/projection-store.js.map +1 -0
- package/dist/public-marker.d.ts +35 -0
- package/dist/public-marker.d.ts.map +1 -0
- package/dist/public-marker.js +45 -0
- package/dist/public-marker.js.map +1 -0
- package/dist/response.d.ts +8 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/response.js +8 -0
- package/dist/response.js.map +1 -0
- package/dist/runtime.d.ts +497 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1083 -0
- package/dist/runtime.js.map +1 -0
- package/dist/validate.d.ts +33 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +48 -0
- package/dist/validate.js.map +1 -0
- package/dist/when.d.ts +101 -0
- package/dist/when.d.ts.map +1 -0
- package/dist/when.js +57 -0
- package/dist/when.js.map +1 -0
- package/dist/workflow-timer-store.d.ts +78 -0
- package/dist/workflow-timer-store.d.ts.map +1 -0
- package/dist/workflow-timer-store.js +56 -0
- package/dist/workflow-timer-store.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nwire/forge` — Nwire framework primitives.
|
|
3
|
+
*
|
|
4
|
+
* Public surface domain code uses: `defineAction`, `defineEvent`,
|
|
5
|
+
* `defineHandler`, `defineActor`, `defineProjection`, `defineQuery`,
|
|
6
|
+
* `defineWorkflow`, `defineModule`, `defineApp`, `definePlugin`,
|
|
7
|
+
* `createApp`, `eventFactory`, the runtime, and the InMemory store defaults.
|
|
8
|
+
*
|
|
9
|
+
* `MessageEnvelope` and its constructors are re-exported from `@nwire/envelope`
|
|
10
|
+
* so consumers don't need to import that package separately.
|
|
11
|
+
*/
|
|
12
|
+
export { seedEnvelope, deriveEnvelope, type MessageEnvelope, type SeedEnvelopeInput, } from "@nwire/envelope";
|
|
13
|
+
export * from "./index.js";
|
|
14
|
+
//# sourceMappingURL=foundation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundation.d.ts","sourceRoot":"","sources":["../src/foundation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nwire/forge` — Nwire framework primitives.
|
|
3
|
+
*
|
|
4
|
+
* Public surface domain code uses: `defineAction`, `defineEvent`,
|
|
5
|
+
* `defineHandler`, `defineActor`, `defineProjection`, `defineQuery`,
|
|
6
|
+
* `defineWorkflow`, `defineModule`, `defineApp`, `definePlugin`,
|
|
7
|
+
* `createApp`, `eventFactory`, the runtime, and the InMemory store defaults.
|
|
8
|
+
*
|
|
9
|
+
* `MessageEnvelope` and its constructors are re-exported from `@nwire/envelope`
|
|
10
|
+
* so consumers don't need to import that package separately.
|
|
11
|
+
*/
|
|
12
|
+
export { seedEnvelope, deriveEnvelope, } from "@nwire/envelope";
|
|
13
|
+
export * from "./index.js";
|
|
14
|
+
//# sourceMappingURL=foundation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundation.js","sourceRoot":"","sources":["../src/foundation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,GAGf,MAAM,iBAAiB,CAAC;AAEzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `FrameworkEventBus` — re-exported from `@nwire/app`.
|
|
3
|
+
*
|
|
4
|
+
* The bus lives in `@nwire/app` (the canonical "managed Container with
|
|
5
|
+
* lifecycle" layer). Forge re-exports the same surface so consumers that
|
|
6
|
+
* already pull from forge don't need a second import line.
|
|
7
|
+
*
|
|
8
|
+
* Standalone code can import directly from `@nwire/app`:
|
|
9
|
+
*
|
|
10
|
+
* import { FrameworkEventBus, type FrameworkEventHandler } from "@nwire/app"
|
|
11
|
+
*/
|
|
12
|
+
export { FrameworkEventBus, type FrameworkEventHandler } from "@nwire/app";
|
|
13
|
+
//# sourceMappingURL=framework-event-bus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-event-bus.d.ts","sourceRoot":"","sources":["../src/framework-event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `FrameworkEventBus` — re-exported from `@nwire/app`.
|
|
3
|
+
*
|
|
4
|
+
* The bus lives in `@nwire/app` (the canonical "managed Container with
|
|
5
|
+
* lifecycle" layer). Forge re-exports the same surface so consumers that
|
|
6
|
+
* already pull from forge don't need a second import line.
|
|
7
|
+
*
|
|
8
|
+
* Standalone code can import directly from `@nwire/app`:
|
|
9
|
+
*
|
|
10
|
+
* import { FrameworkEventBus, type FrameworkEventHandler } from "@nwire/app"
|
|
11
|
+
*/
|
|
12
|
+
export { FrameworkEventBus } from "@nwire/app";
|
|
13
|
+
//# sourceMappingURL=framework-event-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-event-bus.js","sourceRoot":"","sources":["../src/framework-event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAA8B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework events — re-exports of app-layer events + forge-specific events.
|
|
3
|
+
*
|
|
4
|
+
* The generic infrastructure (`defineFrameworkEvent` +
|
|
5
|
+
* `FrameworkEventDefinition`) and the app-lifecycle events (App* / Plugin* /
|
|
6
|
+
* Wire*) live in `@nwire/app`; this module re-exports them so consumers
|
|
7
|
+
* pulling from forge get one import line.
|
|
8
|
+
*
|
|
9
|
+
* The action-specific events (`ActionDispatching` / `ActionCompleted` /
|
|
10
|
+
* `ActionFailed`) and event-recording events (`EventRecording` /
|
|
11
|
+
* `EventRecorded`) are defined here because their payload types reference
|
|
12
|
+
* forge-specific types (`ActionDefinition`, `HandlerContext`) and the
|
|
13
|
+
* domain-event bus forge owns.
|
|
14
|
+
*/
|
|
15
|
+
import { type FrameworkEventDefinition } from "@nwire/app";
|
|
16
|
+
import type { ActionDefinition } from "./define-action.js";
|
|
17
|
+
import type { HandlerContext } from "./define-handler.js";
|
|
18
|
+
export { defineFrameworkEvent, AppRegistering, AppBooting, AppBooted, AppReady, AppShuttingDown, AppShutdown, PluginRegistered, PluginBooting, PluginBooted, PluginShuttingDown, PluginShutdown, WireMounting, WireMounted, WireUnmounted, builtInLifecycleEvents, type FrameworkEventDefinition, type FrameworkEventMode, } from "@nwire/app";
|
|
19
|
+
/**
|
|
20
|
+
* Fired before a dispatch reaches the handler. Interceptable: return
|
|
21
|
+
* `false` to silently prevent execution, throw to fail with a specific
|
|
22
|
+
* error, or mutate `payload.input` to transform what the handler sees.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ActionDispatching: FrameworkEventDefinition<{
|
|
25
|
+
readonly action: ActionDefinition;
|
|
26
|
+
readonly input: unknown;
|
|
27
|
+
readonly ctx: HandlerContext;
|
|
28
|
+
}>;
|
|
29
|
+
/** Fired after a handler returns successfully. Observable; runs in parallel. */
|
|
30
|
+
export declare const ActionCompleted: FrameworkEventDefinition<{
|
|
31
|
+
readonly action: ActionDefinition;
|
|
32
|
+
readonly input: unknown;
|
|
33
|
+
readonly result: unknown;
|
|
34
|
+
readonly durationMs: number;
|
|
35
|
+
}>;
|
|
36
|
+
/** Fired after a handler throws. Observable; runs in parallel. */
|
|
37
|
+
export declare const ActionFailed: FrameworkEventDefinition<{
|
|
38
|
+
readonly action: ActionDefinition;
|
|
39
|
+
readonly input: unknown;
|
|
40
|
+
readonly error: unknown;
|
|
41
|
+
readonly durationMs: number;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Fired before an event is persisted. Interceptable: return false to drop
|
|
45
|
+
* the event (rarely useful in practice — events represent facts that
|
|
46
|
+
* already happened). Throw to fail the dispatch that produced this event.
|
|
47
|
+
*/
|
|
48
|
+
export declare const EventRecording: FrameworkEventDefinition<{
|
|
49
|
+
readonly eventName: string;
|
|
50
|
+
readonly payload: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
/** Fired after an event is persisted + workflows have been notified. */
|
|
53
|
+
export declare const EventRecorded: FrameworkEventDefinition<{
|
|
54
|
+
readonly eventName: string;
|
|
55
|
+
readonly payload: unknown;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const builtInFrameworkEvents: readonly [FrameworkEventDefinition<{
|
|
58
|
+
readonly appName: string;
|
|
59
|
+
}>, FrameworkEventDefinition<{
|
|
60
|
+
readonly appName: string;
|
|
61
|
+
}>, FrameworkEventDefinition<{
|
|
62
|
+
readonly appName: string;
|
|
63
|
+
readonly bootedAt: string;
|
|
64
|
+
}>, FrameworkEventDefinition<{
|
|
65
|
+
readonly appName: string;
|
|
66
|
+
readonly readyAt: string;
|
|
67
|
+
}>, FrameworkEventDefinition<{
|
|
68
|
+
readonly appName: string;
|
|
69
|
+
readonly reason?: string;
|
|
70
|
+
}>, FrameworkEventDefinition<{
|
|
71
|
+
readonly appName: string;
|
|
72
|
+
}>, FrameworkEventDefinition<{
|
|
73
|
+
readonly appName: string;
|
|
74
|
+
readonly pluginName: string;
|
|
75
|
+
}>, FrameworkEventDefinition<{
|
|
76
|
+
readonly appName: string;
|
|
77
|
+
readonly pluginName: string;
|
|
78
|
+
}>, FrameworkEventDefinition<{
|
|
79
|
+
readonly appName: string;
|
|
80
|
+
readonly pluginName: string;
|
|
81
|
+
readonly durationMs: number;
|
|
82
|
+
}>, FrameworkEventDefinition<{
|
|
83
|
+
readonly appName: string;
|
|
84
|
+
readonly pluginName: string;
|
|
85
|
+
}>, FrameworkEventDefinition<{
|
|
86
|
+
readonly appName: string;
|
|
87
|
+
readonly pluginName: string;
|
|
88
|
+
readonly durationMs: number;
|
|
89
|
+
}>, FrameworkEventDefinition<{
|
|
90
|
+
readonly appName: string;
|
|
91
|
+
readonly transport: string;
|
|
92
|
+
readonly manifest: unknown;
|
|
93
|
+
}>, FrameworkEventDefinition<{
|
|
94
|
+
readonly appName: string;
|
|
95
|
+
readonly transport: string;
|
|
96
|
+
readonly manifest: unknown;
|
|
97
|
+
}>, FrameworkEventDefinition<{
|
|
98
|
+
readonly appName: string;
|
|
99
|
+
readonly transport: string;
|
|
100
|
+
}>, FrameworkEventDefinition<{
|
|
101
|
+
readonly action: ActionDefinition;
|
|
102
|
+
readonly input: unknown;
|
|
103
|
+
readonly ctx: HandlerContext;
|
|
104
|
+
}>, FrameworkEventDefinition<{
|
|
105
|
+
readonly action: ActionDefinition;
|
|
106
|
+
readonly input: unknown;
|
|
107
|
+
readonly result: unknown;
|
|
108
|
+
readonly durationMs: number;
|
|
109
|
+
}>, FrameworkEventDefinition<{
|
|
110
|
+
readonly action: ActionDefinition;
|
|
111
|
+
readonly input: unknown;
|
|
112
|
+
readonly error: unknown;
|
|
113
|
+
readonly durationMs: number;
|
|
114
|
+
}>, FrameworkEventDefinition<{
|
|
115
|
+
readonly eventName: string;
|
|
116
|
+
readonly payload: unknown;
|
|
117
|
+
}>, FrameworkEventDefinition<{
|
|
118
|
+
readonly eventName: string;
|
|
119
|
+
readonly payload: unknown;
|
|
120
|
+
}>];
|
|
121
|
+
//# sourceMappingURL=framework-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-events.d.ts","sourceRoot":"","sources":["../src/framework-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAwB,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AAIpB;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;qBACX,gBAAgB;oBACjB,OAAO;kBACT,cAAc;EACe,CAAC;AAE9C,gFAAgF;AAChF,eAAO,MAAM,eAAe;qBACT,gBAAgB;oBACjB,OAAO;qBACN,OAAO;yBACH,MAAM;EACW,CAAC;AAEzC,kEAAkE;AAClE,eAAO,MAAM,YAAY;qBACN,gBAAgB;oBACjB,OAAO;oBACP,OAAO;yBACF,MAAM;EACQ,CAAC;AAItC;;;;GAIG;AACH,eAAO,MAAM,cAAc;wBACL,MAAM;sBACR,OAAO;EACe,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,aAAa;wBACJ,MAAM;sBACR,OAAO;EACW,CAAC;AA0BvC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA/DhB,gBAAgB;oBACjB,OAAO;kBACT,cAAc;;qBAKX,gBAAgB;oBACjB,OAAO;qBACN,OAAO;yBACH,MAAM;;qBAKV,gBAAgB;oBACjB,OAAO;oBACP,OAAO;yBACF,MAAM;;wBAWP,MAAM;sBACR,OAAO;;wBAKL,MAAM;sBACR,OAAO;GA+CjB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework events — re-exports of app-layer events + forge-specific events.
|
|
3
|
+
*
|
|
4
|
+
* The generic infrastructure (`defineFrameworkEvent` +
|
|
5
|
+
* `FrameworkEventDefinition`) and the app-lifecycle events (App* / Plugin* /
|
|
6
|
+
* Wire*) live in `@nwire/app`; this module re-exports them so consumers
|
|
7
|
+
* pulling from forge get one import line.
|
|
8
|
+
*
|
|
9
|
+
* The action-specific events (`ActionDispatching` / `ActionCompleted` /
|
|
10
|
+
* `ActionFailed`) and event-recording events (`EventRecording` /
|
|
11
|
+
* `EventRecorded`) are defined here because their payload types reference
|
|
12
|
+
* forge-specific types (`ActionDefinition`, `HandlerContext`) and the
|
|
13
|
+
* domain-event bus forge owns.
|
|
14
|
+
*/
|
|
15
|
+
import { defineFrameworkEvent } from "@nwire/app";
|
|
16
|
+
// ─── Re-exports from @nwire/app ────────────────────────────────────
|
|
17
|
+
export { defineFrameworkEvent, AppRegistering, AppBooting, AppBooted, AppReady, AppShuttingDown, AppShutdown, PluginRegistered, PluginBooting, PluginBooted, PluginShuttingDown, PluginShutdown, WireMounting, WireMounted, WireUnmounted, builtInLifecycleEvents, } from "@nwire/app";
|
|
18
|
+
// ─── Action dispatch (forge-local — depends on ActionDefinition) ───
|
|
19
|
+
/**
|
|
20
|
+
* Fired before a dispatch reaches the handler. Interceptable: return
|
|
21
|
+
* `false` to silently prevent execution, throw to fail with a specific
|
|
22
|
+
* error, or mutate `payload.input` to transform what the handler sees.
|
|
23
|
+
*/
|
|
24
|
+
export const ActionDispatching = defineFrameworkEvent("nwire.action.dispatching", "series-bail");
|
|
25
|
+
/** Fired after a handler returns successfully. Observable; runs in parallel. */
|
|
26
|
+
export const ActionCompleted = defineFrameworkEvent("nwire.action.completed", "parallel");
|
|
27
|
+
/** Fired after a handler throws. Observable; runs in parallel. */
|
|
28
|
+
export const ActionFailed = defineFrameworkEvent("nwire.action.failed", "parallel");
|
|
29
|
+
// ─── Event recording (forge-local — about the domain event bus) ────
|
|
30
|
+
/**
|
|
31
|
+
* Fired before an event is persisted. Interceptable: return false to drop
|
|
32
|
+
* the event (rarely useful in practice — events represent facts that
|
|
33
|
+
* already happened). Throw to fail the dispatch that produced this event.
|
|
34
|
+
*/
|
|
35
|
+
export const EventRecording = defineFrameworkEvent("nwire.event.recording", "series-bail");
|
|
36
|
+
/** Fired after an event is persisted + workflows have been notified. */
|
|
37
|
+
export const EventRecorded = defineFrameworkEvent("nwire.event.recorded", "parallel");
|
|
38
|
+
// ─── Catalog ────────────────────────────────────────────────────
|
|
39
|
+
/**
|
|
40
|
+
* Every built-in framework event — union of app-lifecycle (from @nwire/app)
|
|
41
|
+
* and forge-specific (action + event-recording). Studio reads this list to
|
|
42
|
+
* render the "what can I hook into?" page.
|
|
43
|
+
*/
|
|
44
|
+
import { AppRegistering, AppBooting, AppBooted, AppReady, AppShuttingDown, AppShutdown, PluginRegistered, PluginBooting, PluginBooted, PluginShuttingDown, PluginShutdown, WireMounting, WireMounted, WireUnmounted, } from "@nwire/app";
|
|
45
|
+
export const builtInFrameworkEvents = [
|
|
46
|
+
AppRegistering,
|
|
47
|
+
AppBooting,
|
|
48
|
+
AppBooted,
|
|
49
|
+
AppReady,
|
|
50
|
+
AppShuttingDown,
|
|
51
|
+
AppShutdown,
|
|
52
|
+
PluginRegistered,
|
|
53
|
+
PluginBooting,
|
|
54
|
+
PluginBooted,
|
|
55
|
+
PluginShuttingDown,
|
|
56
|
+
PluginShutdown,
|
|
57
|
+
WireMounting,
|
|
58
|
+
WireMounted,
|
|
59
|
+
WireUnmounted,
|
|
60
|
+
ActionDispatching,
|
|
61
|
+
ActionCompleted,
|
|
62
|
+
ActionFailed,
|
|
63
|
+
EventRecording,
|
|
64
|
+
EventRecorded,
|
|
65
|
+
];
|
|
66
|
+
void {};
|
|
67
|
+
//# sourceMappingURL=framework-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-events.js","sourceRoot":"","sources":["../src/framework-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,oBAAoB,EAAiC,MAAM,YAAY,CAAC;AAIjF,sEAAsE;AAEtE,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,EACb,sBAAsB,GAGvB,MAAM,YAAY,CAAC;AAEpB,sEAAsE;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAIlD,0BAA0B,EAAE,aAAa,CAAC,CAAC;AAE9C,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAKhD,wBAAwB,EAAE,UAAU,CAAC,CAAC;AAEzC,kEAAkE;AAClE,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAK7C,qBAAqB,EAAE,UAAU,CAAC,CAAC;AAEtC,sEAAsE;AAEtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAG/C,uBAAuB,EAAE,aAAa,CAAC,CAAC;AAE3C,wEAAwE;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAG9C,sBAAsB,EAAE,UAAU,CAAC,CAAC;AAEvC,mEAAmE;AAEnE;;;;GAIG;AACH,OAAO,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,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;IACb,iBAAiB;IACjB,eAAe;IACf,YAAY;IACZ,cAAc;IACd,aAAa;CACL,CAAC;AAIX,KAAK,EAA2C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nwire/forge` — the framework's public surface.
|
|
3
|
+
*
|
|
4
|
+
* The center of gravity is the action as intent. Resolvers wrap actions for
|
|
5
|
+
* transport; workflows wire events to effects (reactions, translators, sagas
|
|
6
|
+
* — one primitive). Actors carry state when entities need identity over time.
|
|
7
|
+
* Projections + queries are the read side.
|
|
8
|
+
*
|
|
9
|
+
* Surface at a glance:
|
|
10
|
+
* - defineAction, defineEvent (events re-exported from @nwire/messages)
|
|
11
|
+
* - defineHandler, defineActor, defineWorkflow
|
|
12
|
+
* - defineProjection, defineQuery
|
|
13
|
+
* - defineResource, defineMiddleware, defineError
|
|
14
|
+
* - defineModule, defineApp, createApp
|
|
15
|
+
* - ctx verbs (in handlers + resolvers): request, send, use, query
|
|
16
|
+
* - .public() marks an item exposed across module boundaries
|
|
17
|
+
*/
|
|
18
|
+
export { defineAction, type ActionDefinition, type ActionMeta, type ActionInput, } from "./define-action.js";
|
|
19
|
+
export { defineActor, eventKey, type ActorDefinition, type ActorOptions, type ActorOptionsBound, type ActorReaction, type ActorStateConfig, type ActorTimerSpec, type ActorMethod, type ActorInstanceView, } from "./define-actor.js";
|
|
20
|
+
export { defineSchema, isSchemaDefinition, type SchemaDefinition, type SchemaOptions, type SchemaStateSpec, type SchemaStorageHints, } from "./define-schema.js";
|
|
21
|
+
export { validate, isInvariantError, InvariantError, type Invariant } from "./validate.js";
|
|
22
|
+
export { defineHandler, type HandlerContext, type HandlerDefinition, type HandlerReturn, } from "./define-handler.js";
|
|
23
|
+
export { eventFactory, isEventMessage, normalizeEventReturn, type EventMessage, type EventFactory, } from "./event-message.js";
|
|
24
|
+
export { assertModuleSurface, type ExpectedSurface } from "./module-surface.js";
|
|
25
|
+
export { InMemoryWorkflowTimerStore, timerEventName, type WorkflowTimer, type WorkflowTimerStore, } from "./workflow-timer-store.js";
|
|
26
|
+
export { isPublic, type PublicMarker } from "./public-marker.js";
|
|
27
|
+
export { defineWorkflow, COMPLETE_EVENT_NAME, type WorkflowDefinition, type WorkflowContext, type StatelessWorkflowContext, type StatefulWorkflowContext, type WorkflowEffects, type WorkflowOptions, type StatelessWorkflowOptions, type StatefulWorkflowOptions, type WorkflowOnOptions, type WorkflowRetryPolicy, type WorkflowStateSpec, type WorkflowInstance, type WorkflowCorrelateMap, type FireContext, type CompleteEvent, type StateCallable, type TimerDefinition, } from "./define-workflow.js";
|
|
28
|
+
export { defineExternalCall, type ExternalCallDefinition, type ExternalCallMeta, type ExternalCallTarget, type ExternalCallSlo, type ExternalCallRetry, type ExternalCallExecutor, } from "./define-external-call.js";
|
|
29
|
+
export { defineInboundWebhook, type InboundWebhookDefinition, type InboundWebhookMeta, type WebhookSignatureVerifier, type WebhookDedupe, } from "./define-inbound-webhook.js";
|
|
30
|
+
export { defineOutbox, type OutboxDefinition, type OutboxMeta } from "./define-outbox.js";
|
|
31
|
+
export { defineInbox, type InboxDefinition, type InboxMeta } from "./define-inbox.js";
|
|
32
|
+
export { defineCron, type CronDefinition, type CronMeta } from "./define-cron.js";
|
|
33
|
+
export { Runtime, parseDelay, type RuntimeOptions, type DispatchMiddleware, type Telemetry, type TelemetryListener, type SerializedError, } from "./runtime.js";
|
|
34
|
+
export { defineFrameworkEvent, AppRegistering, AppBooting, AppBooted, AppReady, AppShuttingDown, AppShutdown, ActionDispatching, ActionCompleted, ActionFailed, EventRecording, EventRecorded, builtInFrameworkEvents, type FrameworkEventDefinition, type FrameworkEventMode, } from "./framework-events.js";
|
|
35
|
+
export { FrameworkEventBus, type FrameworkEventHandler } from "./framework-event-bus.js";
|
|
36
|
+
export { InMemoryActorStore, createInitialInstance, type ActorStore, type ActorInstance, type ActorTimerHandle, } from "./actor-store.js";
|
|
37
|
+
export { runCli, type RunCliOptions } from "./cli-runner.js";
|
|
38
|
+
export { NoopLogger, ConsoleLogger, loggerForEnvelope, type Logger } from "@nwire/logger";
|
|
39
|
+
export { InMemoryDeadLetterSink, buildDeadLetterEntry, type DeadLetterSink, type DeadLetterEntry, } from "@nwire/dead-letter";
|
|
40
|
+
export type { RetryPolicy } from "./define-action.js";
|
|
41
|
+
export { defineProjection, type ProjectionDefinition, type ProjectionOptions, type ProjectionReducer, } from "./define-projection.js";
|
|
42
|
+
export { InMemoryProjectionStore, type ProjectionStore } from "./projection-store.js";
|
|
43
|
+
export { defineQuery, type QueryDefinition, type QueryOptions } from "./define-query.js";
|
|
44
|
+
export { defineModule, type ModuleDefinition, type ModuleManifest, type ModuleNeeds, } from "./define-module.js";
|
|
45
|
+
export { createApp, type App, type CreateAppOptions, type TimerSchedulerOptions, } from "./create-app.js";
|
|
46
|
+
export { attachDevLogger, formatTelemetry, type DevLoggerOptions } from "./dev-logger.js";
|
|
47
|
+
export { defineApp, type AppDefinition, type DefineAppOptions, type EndpointDefinition, type TenantModel, } from "./define-app.js";
|
|
48
|
+
export { definePlugin, type PluginDefinition, type PluginOptions, type PluginContext, type PluginSetup, type PluginActorHooks, type ActorTransitionHook, } from "./define-plugin.js";
|
|
49
|
+
export { defineResource, isResourceDefinition, type ResourceDefinition, type DefineResourceOptions, } from "@nwire/handler";
|
|
50
|
+
export { defineError, isNwireError, NwireError, Unauthorized, Forbidden, NotFound, Gone, BadRequest, Conflict, type ErrorDefinition, type ErrorMeta, } from "./define-error.js";
|
|
51
|
+
export { defineMiddleware, defineHook, pipe, unwindPipe, isMiddleware, isHook, isPipe, type MiddlewareDefinition, type HookDefinition, type MiddlewarePipe, type PipeStep, type ResolverCtx, type Next, } from "./define-middleware.js";
|
|
52
|
+
export { response, isResponseSpec, isResponseInstance, ok, created, accepted, noContent, notModified, gone, type ResponseSpec, type ListResponseSpec, type ResponseInstance, type ResponseKind, } from "./response.js";
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAA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K,WAAW,EAChB,KAAK,IAAI,GACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,EAAE,EACF,OAAO,EACP,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EACJ,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nwire/forge` — the framework's public surface.
|
|
3
|
+
*
|
|
4
|
+
* The center of gravity is the action as intent. Resolvers wrap actions for
|
|
5
|
+
* transport; workflows wire events to effects (reactions, translators, sagas
|
|
6
|
+
* — one primitive). Actors carry state when entities need identity over time.
|
|
7
|
+
* Projections + queries are the read side.
|
|
8
|
+
*
|
|
9
|
+
* Surface at a glance:
|
|
10
|
+
* - defineAction, defineEvent (events re-exported from @nwire/messages)
|
|
11
|
+
* - defineHandler, defineActor, defineWorkflow
|
|
12
|
+
* - defineProjection, defineQuery
|
|
13
|
+
* - defineResource, defineMiddleware, defineError
|
|
14
|
+
* - defineModule, defineApp, createApp
|
|
15
|
+
* - ctx verbs (in handlers + resolvers): request, send, use, query
|
|
16
|
+
* - .public() marks an item exposed across module boundaries
|
|
17
|
+
*/
|
|
18
|
+
export { defineAction, } from "./define-action.js";
|
|
19
|
+
export { defineActor, eventKey, } from "./define-actor.js";
|
|
20
|
+
export { defineSchema, isSchemaDefinition, } from "./define-schema.js";
|
|
21
|
+
export { validate, isInvariantError, InvariantError } from "./validate.js";
|
|
22
|
+
export { defineHandler, } from "./define-handler.js";
|
|
23
|
+
export { eventFactory, isEventMessage, normalizeEventReturn, } from "./event-message.js";
|
|
24
|
+
export { assertModuleSurface } from "./module-surface.js";
|
|
25
|
+
export { InMemoryWorkflowTimerStore, timerEventName, } from "./workflow-timer-store.js";
|
|
26
|
+
export { isPublic } from "./public-marker.js";
|
|
27
|
+
export { defineWorkflow, COMPLETE_EVENT_NAME, } from "./define-workflow.js";
|
|
28
|
+
// ─── Orchestrator primitives ──────────────────────────
|
|
29
|
+
export { defineExternalCall, } from "./define-external-call.js";
|
|
30
|
+
export { defineInboundWebhook, } from "./define-inbound-webhook.js";
|
|
31
|
+
export { defineOutbox } from "./define-outbox.js";
|
|
32
|
+
export { defineInbox } from "./define-inbox.js";
|
|
33
|
+
export { defineCron } from "./define-cron.js";
|
|
34
|
+
export { Runtime, parseDelay, } from "./runtime.js";
|
|
35
|
+
// ─── Framework events ───────────────────────────────────────────
|
|
36
|
+
export { defineFrameworkEvent, AppRegistering, AppBooting, AppBooted, AppReady, AppShuttingDown, AppShutdown, ActionDispatching, ActionCompleted, ActionFailed, EventRecording, EventRecorded, builtInFrameworkEvents, } from "./framework-events.js";
|
|
37
|
+
export { FrameworkEventBus } from "./framework-event-bus.js";
|
|
38
|
+
export { InMemoryActorStore, createInitialInstance, } from "./actor-store.js";
|
|
39
|
+
// File-snapshot store extracted to `@nwire/store-file`.
|
|
40
|
+
// Mongo stores extracted to `@nwire/store-mongo`.
|
|
41
|
+
// Forge ships only interfaces + InMemory defaults; persistent adapters
|
|
42
|
+
// are separate packages consumers add as needed.
|
|
43
|
+
// Queue transport + createQueueWorker live in `@nwire/queue` (consumers
|
|
44
|
+
// import from there directly to avoid a forge ↔ queue dep cycle).
|
|
45
|
+
export { runCli } from "./cli-runner.js";
|
|
46
|
+
export { NoopLogger, ConsoleLogger, loggerForEnvelope } from "@nwire/logger";
|
|
47
|
+
export { InMemoryDeadLetterSink, buildDeadLetterEntry, } from "@nwire/dead-letter";
|
|
48
|
+
export { defineProjection, } from "./define-projection.js";
|
|
49
|
+
export { InMemoryProjectionStore } from "./projection-store.js";
|
|
50
|
+
export { defineQuery } from "./define-query.js";
|
|
51
|
+
export { defineModule, } from "./define-module.js";
|
|
52
|
+
export { createApp, } from "./create-app.js";
|
|
53
|
+
export { attachDevLogger, formatTelemetry } from "./dev-logger.js";
|
|
54
|
+
export { defineApp, } from "./define-app.js";
|
|
55
|
+
export { definePlugin, } from "./define-plugin.js";
|
|
56
|
+
// ─── Interface / app layer primitives ────────────────────────────
|
|
57
|
+
export { defineResource, isResourceDefinition, } from "@nwire/handler";
|
|
58
|
+
export { defineError, isNwireError, NwireError, Unauthorized, Forbidden, NotFound, Gone, BadRequest, Conflict, } from "./define-error.js";
|
|
59
|
+
export { defineMiddleware, defineHook, pipe, unwindPipe, isMiddleware, isHook, isPipe, } from "./define-middleware.js";
|
|
60
|
+
export { response, isResponseSpec, isResponseInstance, ok, created, accepted, noContent, notModified, gone, } from "./response.js";
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,YAAY,GAIb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,WAAW,EACX,QAAQ,GAST,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,kBAAkB,GAKnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAC;AAExF,OAAO,EACL,aAAa,GAId,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,oBAAoB,GAGrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,mBAAmB,EAAwB,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EACL,0BAA0B,EAC1B,cAAc,GAGf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAqB,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EACL,cAAc,EACd,mBAAmB,GAkBpB,MAAM,mBAAmB,CAAC;AAE3B,yDAAyD;AACzD,OAAO,EACL,kBAAkB,GAOnB,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AAO,EACL,SAAS,GAKV,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,GAOb,MAAM,iBAAiB,CAAC;AAEzB,oEAAoE;AACpE,OAAO,EACL,cAAc,EACd,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAQ,GAGT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,MAAM,EACN,MAAM,GAOP,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,EAAE,EACF,OAAO,EACP,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,GAKL,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module barrel helpers.
|
|
3
|
+
*
|
|
4
|
+
* The recommended import pattern is `import { x } from "@modules/<bc>"` —
|
|
5
|
+
* a single barrel file per bounded context that re-exports only the items
|
|
6
|
+
* the module declared `.public()` on. Three layers of enforcement:
|
|
7
|
+
*
|
|
8
|
+
* 1. The barrel itself is hand-written, listing only public symbols.
|
|
9
|
+
* Drift is loud — a missing re-export, an unexposed symbol.
|
|
10
|
+
* 2. `assertModuleSurface(module, expected)` runs at module-load time
|
|
11
|
+
* and throws if the manifest's public surface doesn't match. Catches
|
|
12
|
+
* "exported in barrel but not .public() in manifest" and vice versa.
|
|
13
|
+
* 3. `package.json` `exports` field locks consumers to the barrel
|
|
14
|
+
* (workspace-package-per-module mode). Direct-file imports raise
|
|
15
|
+
* module-not-found errors at build/runtime.
|
|
16
|
+
*
|
|
17
|
+
* This file gives you the assertion helper. The barrel is yours to write
|
|
18
|
+
* (it's the part that names what's public).
|
|
19
|
+
*/
|
|
20
|
+
import type { ModuleDefinition } from "./define-module.js";
|
|
21
|
+
export interface ExpectedSurface {
|
|
22
|
+
readonly actions?: readonly string[];
|
|
23
|
+
readonly events?: readonly string[];
|
|
24
|
+
readonly queries?: readonly string[];
|
|
25
|
+
readonly workflows?: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Assert that the module's manifest exposes exactly the items the barrel
|
|
29
|
+
* intends to re-export. Throws with a structured diff message on mismatch.
|
|
30
|
+
*
|
|
31
|
+
* // modules/stations/index.ts
|
|
32
|
+
* import { stationsModule } from "./stations.module";
|
|
33
|
+
* import { createStation } from "./actions/create-station";
|
|
34
|
+
* import { recordWash } from "./actions/record-wash";
|
|
35
|
+
* import { listStations } from "./queries/list-stations";
|
|
36
|
+
* import { WashRecorded_v1 } from "./events/wash-recorded.v1";
|
|
37
|
+
*
|
|
38
|
+
* export { stationsModule, createStation, recordWash, listStations, WashRecorded_v1 };
|
|
39
|
+
*
|
|
40
|
+
* assertModuleSurface(stationsModule, {
|
|
41
|
+
* actions: ["stations.create-station", "stations.record-wash"],
|
|
42
|
+
* queries: ["stations.list-stations"],
|
|
43
|
+
* events: ["stations.wash-recorded.v1"],
|
|
44
|
+
* });
|
|
45
|
+
*/
|
|
46
|
+
export declare function assertModuleSurface(module: ModuleDefinition, expected: ExpectedSurface): void;
|
|
47
|
+
//# sourceMappingURL=module-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-surface.d.ts","sourceRoot":"","sources":["../src/module-surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,CA+B7F"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module barrel helpers.
|
|
3
|
+
*
|
|
4
|
+
* The recommended import pattern is `import { x } from "@modules/<bc>"` —
|
|
5
|
+
* a single barrel file per bounded context that re-exports only the items
|
|
6
|
+
* the module declared `.public()` on. Three layers of enforcement:
|
|
7
|
+
*
|
|
8
|
+
* 1. The barrel itself is hand-written, listing only public symbols.
|
|
9
|
+
* Drift is loud — a missing re-export, an unexposed symbol.
|
|
10
|
+
* 2. `assertModuleSurface(module, expected)` runs at module-load time
|
|
11
|
+
* and throws if the manifest's public surface doesn't match. Catches
|
|
12
|
+
* "exported in barrel but not .public() in manifest" and vice versa.
|
|
13
|
+
* 3. `package.json` `exports` field locks consumers to the barrel
|
|
14
|
+
* (workspace-package-per-module mode). Direct-file imports raise
|
|
15
|
+
* module-not-found errors at build/runtime.
|
|
16
|
+
*
|
|
17
|
+
* This file gives you the assertion helper. The barrel is yours to write
|
|
18
|
+
* (it's the part that names what's public).
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Assert that the module's manifest exposes exactly the items the barrel
|
|
22
|
+
* intends to re-export. Throws with a structured diff message on mismatch.
|
|
23
|
+
*
|
|
24
|
+
* // modules/stations/index.ts
|
|
25
|
+
* import { stationsModule } from "./stations.module";
|
|
26
|
+
* import { createStation } from "./actions/create-station";
|
|
27
|
+
* import { recordWash } from "./actions/record-wash";
|
|
28
|
+
* import { listStations } from "./queries/list-stations";
|
|
29
|
+
* import { WashRecorded_v1 } from "./events/wash-recorded.v1";
|
|
30
|
+
*
|
|
31
|
+
* export { stationsModule, createStation, recordWash, listStations, WashRecorded_v1 };
|
|
32
|
+
*
|
|
33
|
+
* assertModuleSurface(stationsModule, {
|
|
34
|
+
* actions: ["stations.create-station", "stations.record-wash"],
|
|
35
|
+
* queries: ["stations.list-stations"],
|
|
36
|
+
* events: ["stations.wash-recorded.v1"],
|
|
37
|
+
* });
|
|
38
|
+
*/
|
|
39
|
+
export function assertModuleSurface(module, expected) {
|
|
40
|
+
const checks = [
|
|
41
|
+
{ kind: "actions", want: expected.actions ?? [], have: module.publicSurface.actions },
|
|
42
|
+
{ kind: "events", want: expected.events ?? [], have: module.publicSurface.events },
|
|
43
|
+
{ kind: "queries", want: expected.queries ?? [], have: module.publicSurface.queries },
|
|
44
|
+
{ kind: "workflows", want: expected.workflows ?? [], have: module.publicSurface.workflows },
|
|
45
|
+
];
|
|
46
|
+
const errors = [];
|
|
47
|
+
for (const { kind, want, have } of checks) {
|
|
48
|
+
const wantSet = new Set(want);
|
|
49
|
+
const missingFromManifest = [...wantSet].filter((n) => !have.has(n));
|
|
50
|
+
const missingFromBarrel = [...have].filter((n) => !wantSet.has(n));
|
|
51
|
+
if (missingFromManifest.length > 0) {
|
|
52
|
+
errors.push(`${kind}: barrel re-exports ${missingFromManifest.map((n) => `"${n}"`).join(", ")} ` +
|
|
53
|
+
`but the module manifest did not call .public() on ${missingFromManifest.length === 1 ? "it" : "them"}.`);
|
|
54
|
+
}
|
|
55
|
+
if (missingFromBarrel.length > 0) {
|
|
56
|
+
errors.push(`${kind}: manifest exposes ${missingFromBarrel.map((n) => `"${n}"`).join(", ")} ` +
|
|
57
|
+
`but the barrel does not re-export ${missingFromBarrel.length === 1 ? "it" : "them"}.`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (errors.length > 0) {
|
|
61
|
+
throw new Error(`assertModuleSurface(${module.name}): public surface drift detected.\n` +
|
|
62
|
+
errors.map((e) => ` • ${e}`).join("\n"));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+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AC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,uBAAuB,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAClF,qDAAqD,mBAAmB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAC3G,CAAC;QACJ,CAAC;QACD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,sBAAsB,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAC/E,qCAAqC,iBAAiB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CACzF,CAAC;QACJ,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,uBAAuB,MAAM,CAAC,IAAI,qCAAqC;YACrE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3C,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProjectionStore — persistence contract for projection state.
|
|
3
|
+
*
|
|
4
|
+
* Each projection has a single state value (the fold result over its event
|
|
5
|
+
* stream). The store is keyed by projection name. Implementations are kept
|
|
6
|
+
* deliberately thin; richer query patterns belong in the projection's own
|
|
7
|
+
* structure (typically a Map keyed by entity id).
|
|
8
|
+
*/
|
|
9
|
+
export interface ProjectionStore {
|
|
10
|
+
/**
|
|
11
|
+
* Load the projection's state for `tenant` (default `''` for the global
|
|
12
|
+
* / single-tenant scope). Returns `null` if no events have folded yet
|
|
13
|
+
* for this tenant — the runtime then seeds with `projection.initial()`.
|
|
14
|
+
*/
|
|
15
|
+
load<TState = unknown>(projectionName: string, tenant?: string): Promise<TState | null>;
|
|
16
|
+
save<TState = unknown>(projectionName: string, state: TState, tenant?: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare class InMemoryProjectionStore implements ProjectionStore {
|
|
19
|
+
private readonly entries;
|
|
20
|
+
private cacheKey;
|
|
21
|
+
load<TState = unknown>(projectionName: string, tenant?: string): Promise<TState | null>;
|
|
22
|
+
save<TState = unknown>(projectionName: string, state: TState, tenant?: string): Promise<void>;
|
|
23
|
+
/** Test-only — clear all projection state. */
|
|
24
|
+
clear(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=projection-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-store.d.ts","sourceRoot":"","sources":["../src/projection-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxF,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/F;AAED,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IAEtD,OAAO,CAAC,QAAQ;IAIV,IAAI,CAAC,MAAM,GAAG,OAAO,EACzB,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,MAAW,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAMnB,IAAI,CAAC,MAAM,GAAG,OAAO,EACzB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,MAAW,GAClB,OAAO,CAAC,IAAI,CAAC;IAIhB,8CAA8C;IAC9C,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProjectionStore — persistence contract for projection state.
|
|
3
|
+
*
|
|
4
|
+
* Each projection has a single state value (the fold result over its event
|
|
5
|
+
* stream). The store is keyed by projection name. Implementations are kept
|
|
6
|
+
* deliberately thin; richer query patterns belong in the projection's own
|
|
7
|
+
* structure (typically a Map keyed by entity id).
|
|
8
|
+
*/
|
|
9
|
+
export class InMemoryProjectionStore {
|
|
10
|
+
entries = new Map();
|
|
11
|
+
cacheKey(projectionName, tenant) {
|
|
12
|
+
return `${tenant}::${projectionName}`;
|
|
13
|
+
}
|
|
14
|
+
async load(projectionName, tenant = "") {
|
|
15
|
+
const k = this.cacheKey(projectionName, tenant);
|
|
16
|
+
if (!this.entries.has(k))
|
|
17
|
+
return null;
|
|
18
|
+
return structuredClone(this.entries.get(k));
|
|
19
|
+
}
|
|
20
|
+
async save(projectionName, state, tenant = "") {
|
|
21
|
+
this.entries.set(this.cacheKey(projectionName, tenant), structuredClone(state));
|
|
22
|
+
}
|
|
23
|
+
/** Test-only — clear all projection state. */
|
|
24
|
+
clear() {
|
|
25
|
+
this.entries.clear();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=projection-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-store.js","sourceRoot":"","sources":["../src/projection-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,OAAO,uBAAuB;IACjB,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IAE9C,QAAQ,CAAC,cAAsB,EAAE,MAAc;QACrD,OAAO,GAAG,MAAM,KAAK,cAAc,EAAE,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,IAAI,CACR,cAAsB,EACtB,SAAiB,EAAE;QAEnB,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,OAAO,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAW,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,IAAI,CACR,cAAsB,EACtB,KAAa,EACb,SAAiB,EAAE;QAEnB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,8CAA8C;IAC9C,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `.public()` — the marker every cross-module-eligible primitive carries.
|
|
3
|
+
*
|
|
4
|
+
* Visibility is a module-level decision: a definition declares *behavior*,
|
|
5
|
+
* the module manifest declares *exposure*. Code calls `def.public()` only
|
|
6
|
+
* inside the manifest array (or inline at the call site if it's convenient),
|
|
7
|
+
* and `defineModule` reads the `$public` flag to partition each array into
|
|
8
|
+
* the module's public surface vs its internals.
|
|
9
|
+
*
|
|
10
|
+
* actions: [
|
|
11
|
+
* createStation.public(), // public — other modules may dispatch
|
|
12
|
+
* normalizeTraffic, // internal — only this module sees it
|
|
13
|
+
* ]
|
|
14
|
+
*
|
|
15
|
+
* The marker is non-enumerable so it doesn't pollute logs / OpenAPI dumps;
|
|
16
|
+
* the `public()` method is non-enumerable for the same reason. Calling
|
|
17
|
+
* `.public()` returns a SHALLOW clone — the original stays unmarked, so
|
|
18
|
+
* the definition file remains visibility-agnostic.
|
|
19
|
+
*/
|
|
20
|
+
export interface PublicMarker {
|
|
21
|
+
/** Truthy when this definition was marked via `.public()` in a manifest. */
|
|
22
|
+
readonly $public?: true;
|
|
23
|
+
/** Return a clone of this definition with `$public: true`. */
|
|
24
|
+
public: () => this;
|
|
25
|
+
}
|
|
26
|
+
export declare function isPublic(def: {
|
|
27
|
+
readonly $public?: boolean;
|
|
28
|
+
}): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Attach the `.public()` method + the `$public` slot in place. Each call
|
|
31
|
+
* to `.public()` produces a fresh clone with `$public: true` and the method
|
|
32
|
+
* re-installed so the clone remains markable (idempotent).
|
|
33
|
+
*/
|
|
34
|
+
export declare function markable<T extends object>(def: T): T & PublicMarker;
|
|
35
|
+
//# sourceMappingURL=public-marker.d.ts.map
|