@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
|
@@ -27,12 +27,23 @@
|
|
|
27
27
|
* the `eventName` + `payload` shape — plain objects pass straight through.
|
|
28
28
|
*/
|
|
29
29
|
import { captureSourceLocation } from "@nwire/messages";
|
|
30
|
+
// Forge dispatcher binding name — duplicated here to avoid a runtime →
|
|
31
|
+
// primitives import cycle. Matches `FORGE_DISPATCHER_BINDING` in
|
|
32
|
+
// `runtime/forge-plugin.ts`.
|
|
33
|
+
const FORGE_DISPATCHER_BINDING = "forge.dispatcher";
|
|
30
34
|
export function defineHandler(action, handler) {
|
|
31
|
-
|
|
35
|
+
const def = {
|
|
32
36
|
$kind: "handler",
|
|
33
37
|
action,
|
|
34
38
|
handler,
|
|
35
39
|
$source: captureSourceLocation(),
|
|
40
|
+
name: action.name,
|
|
41
|
+
input: action.schema,
|
|
42
|
+
async run(ctx, opts) {
|
|
43
|
+
const dispatcher = ctx.resolve(FORGE_DISPATCHER_BINDING);
|
|
44
|
+
const result = await dispatcher.dispatch(action, ctx.input, ctx.envelope, { signal: opts?.signal });
|
|
45
|
+
return { result };
|
|
46
|
+
},
|
|
36
47
|
};
|
|
48
|
+
return def;
|
|
37
49
|
}
|
|
38
|
-
//# sourceMappingURL=define-handler.js.map
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* },
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
|
-
* Wire-level handlers (`@nwire/
|
|
18
|
+
* Wire-level handlers (`@nwire/koa`) mount the route and on each request:
|
|
19
19
|
* 1. Run `verifySignature` (deny if invalid)
|
|
20
20
|
* 2. Run `dedupe.keyFrom` and check the inbox (skip if already seen)
|
|
21
21
|
* 3. Parse the payload through `schema`
|
|
@@ -79,4 +79,3 @@ export interface InboundWebhookDefinition<TSchema extends ZodTypeAny = ZodTypeAn
|
|
|
79
79
|
readonly tags?: readonly string[];
|
|
80
80
|
}
|
|
81
81
|
export declare function defineInboundWebhook<TSchema extends ZodTypeAny>(meta: InboundWebhookMeta<TSchema>): InboundWebhookDefinition<TSchema>;
|
|
82
|
-
//# sourceMappingURL=define-inbound-webhook.d.ts.map
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* },
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
|
-
* Wire-level handlers (`@nwire/
|
|
18
|
+
* Wire-level handlers (`@nwire/koa`) mount the route and on each request:
|
|
19
19
|
* 1. Run `verifySignature` (deny if invalid)
|
|
20
20
|
* 2. Run `dedupe.keyFrom` and check the inbox (skip if already seen)
|
|
21
21
|
* 3. Parse the payload through `schema`
|
|
@@ -39,4 +39,3 @@ export function defineInboundWebhook(meta) {
|
|
|
39
39
|
tags: meta.tags,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=define-inbound-webhook.js.map
|
|
@@ -55,4 +55,3 @@ export interface ProjectionDefinition<TState = unknown> {
|
|
|
55
55
|
readonly $source?: SourceLocation;
|
|
56
56
|
}
|
|
57
57
|
export declare function defineProjection<TState>(name: string, options: ProjectionOptions<TState>): ProjectionDefinition<TState>;
|
|
58
|
-
//# sourceMappingURL=define-projection.d.ts.map
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
import type { z } from "zod";
|
|
33
33
|
import type { ZodTypeAny, SourceLocation } from "@nwire/messages";
|
|
34
34
|
import type { ProjectionDefinition } from "./define-projection.js";
|
|
35
|
-
import { type PublicMarker } from "
|
|
35
|
+
import { type PublicMarker } from "../helpers/public-marker.js";
|
|
36
36
|
/** Studio-aware: declared read-path SLO. */
|
|
37
37
|
export interface QuerySlo {
|
|
38
38
|
/** Declared p95 latency target in milliseconds. */
|
|
@@ -107,4 +107,3 @@ export interface QueryDefinition<TState = unknown, TSchema extends ZodTypeAny =
|
|
|
107
107
|
}
|
|
108
108
|
export declare function defineQuery<TState, TSchema extends ZodTypeAny, TResult>(projection: ProjectionDefinition<TState>, options: QueryOptions<TState, TSchema, TResult>): QueryDefinition<TState, TSchema, TResult>;
|
|
109
109
|
export declare function defineQuery<TSchema extends ZodTypeAny, TResult>(options: QueryHandlerOptions<TSchema, TResult>): QueryDefinition<any, TSchema, TResult>;
|
|
110
|
-
//# sourceMappingURL=define-query.d.ts.map
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* routes wire queries; HTTP POST routes wire actions).
|
|
31
31
|
*/
|
|
32
32
|
import { captureSourceLocation } from "@nwire/messages";
|
|
33
|
-
import { markable } from "
|
|
33
|
+
import { markable } from "../helpers/public-marker.js";
|
|
34
34
|
export function defineQuery(projectionOrOptions, maybeOptions) {
|
|
35
35
|
const $source = captureSourceLocation();
|
|
36
36
|
// Handler form — first arg is the options object with `handler`.
|
|
@@ -63,4 +63,3 @@ export function defineQuery(projectionOrOptions, maybeOptions) {
|
|
|
63
63
|
$source,
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
//# sourceMappingURL=define-query.js.map
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* Why it's separate from `defineActor`:
|
|
30
30
|
* - Studio can render the data model without booting the actor.
|
|
31
|
-
* - Persistent stores (`@nwire/
|
|
31
|
+
* - Persistent stores (`@nwire/mongo`, `@nwire/store-prisma`) read
|
|
32
32
|
* `indexes` + `unique` to build adapter-level constraints.
|
|
33
33
|
* - Projections can reference the same schema for view-typing.
|
|
34
34
|
*
|
|
@@ -85,4 +85,3 @@ export interface SchemaDefinition<TFields extends Readonly<Record<string, ZodTyp
|
|
|
85
85
|
export declare function defineSchema<TFields extends Readonly<Record<string, ZodTypeAny>>>(options: SchemaOptions<TFields>): SchemaDefinition<TFields>;
|
|
86
86
|
/** Type narrow — true if `x` is a SchemaDefinition produced by `defineSchema`. */
|
|
87
87
|
export declare function isSchemaDefinition(x: unknown): x is SchemaDefinition;
|
|
88
|
-
//# sourceMappingURL=define-schema.d.ts.map
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* Why it's separate from `defineActor`:
|
|
30
30
|
* - Studio can render the data model without booting the actor.
|
|
31
|
-
* - Persistent stores (`@nwire/
|
|
31
|
+
* - Persistent stores (`@nwire/mongo`, `@nwire/store-prisma`) read
|
|
32
32
|
* `indexes` + `unique` to build adapter-level constraints.
|
|
33
33
|
* - Projections can reference the same schema for view-typing.
|
|
34
34
|
*
|
|
@@ -69,4 +69,3 @@ export function defineSchema(options) {
|
|
|
69
69
|
export function isSchemaDefinition(x) {
|
|
70
70
|
return typeof x === "object" && x !== null && x.$kind === "schema";
|
|
71
71
|
}
|
|
72
|
-
//# sourceMappingURL=define-schema.js.map
|
|
@@ -20,8 +20,8 @@ import type { z } from "zod";
|
|
|
20
20
|
import type { ZodTypeAny, SourceLocation } from "@nwire/messages";
|
|
21
21
|
import type { EventDefinition, EventPayload } from "@nwire/messages";
|
|
22
22
|
import type { ActionDefinition, ActionInput, ActionResult } from "./define-action.js";
|
|
23
|
-
import type { EventMessage } from "
|
|
24
|
-
import { type PublicMarker } from "
|
|
23
|
+
import type { EventMessage } from "../messages/event-message.js";
|
|
24
|
+
import { type PublicMarker } from "../helpers/public-marker.js";
|
|
25
25
|
/**
|
|
26
26
|
* Timer definition produced by `timeout(name, delay)`. Acts like an event
|
|
27
27
|
* for subscription purposes — `on(timer, handler)` registers a handler
|
|
@@ -208,4 +208,3 @@ export interface WorkflowInstance {
|
|
|
208
208
|
export declare function defineWorkflow<TData extends ZodTypeAny>(name: string, closure: (ctx: StatefulWorkflowContext<z.output<TData>>) => void, options: StatefulWorkflowOptions<TData>): WorkflowDefinition;
|
|
209
209
|
export declare function defineWorkflow(name: string, closure: (ctx: StatelessWorkflowContext) => void, options?: StatelessWorkflowOptions): WorkflowDefinition;
|
|
210
210
|
export {};
|
|
211
|
-
//# sourceMappingURL=define-workflow.d.ts.map
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* Example shapes appear in `docs/concepts/workflow.md`.
|
|
18
18
|
*/
|
|
19
19
|
import { captureSourceLocation } from "@nwire/messages";
|
|
20
|
-
import { markable } from "
|
|
21
|
-
import { timerEventName } from "
|
|
20
|
+
import { markable } from "../helpers/public-marker.js";
|
|
21
|
+
import { timerEventName } from "../stores/workflow-timer-store.js";
|
|
22
22
|
/**
|
|
23
23
|
* `complete` — framework-emitted pseudo-event that fires when a stateful
|
|
24
24
|
* workflow enters any state marked `final: true`. Exposed on the closure
|
|
@@ -376,4 +376,3 @@ function buildFireStateCallables(specs, registrations) {
|
|
|
376
376
|
}
|
|
377
377
|
return out;
|
|
378
378
|
}
|
|
379
|
-
//# sourceMappingURL=define-workflow.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createForgeApp` — foundation-form composition entry point.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `createRuntime() + runtime.registerPlugin(forgePlugin) +
|
|
5
|
+
* runtime.start/stop` with the forge dispatch verbs added on the returned
|
|
6
|
+
* app handle. Each verb resolves the `ForgeDispatcher` bound on the
|
|
7
|
+
* container by `forgePlugin` and delegates.
|
|
8
|
+
*
|
|
9
|
+
* Modules are gone in 0.10 — the App is the bounded context. Pass
|
|
10
|
+
* actors / projections / queries / workflows / external calls / handlers
|
|
11
|
+
* directly on opts; they register against the dispatcher during plugin
|
|
12
|
+
* boot (an AppBooting chain step does the registration before any
|
|
13
|
+
* plugin's boot() runs).
|
|
14
|
+
*/
|
|
15
|
+
import { type Container } from "@nwire/container/awilix";
|
|
16
|
+
import { type PluginDefinition, type Runtime } from "@nwire/app";
|
|
17
|
+
import type { Logger } from "@nwire/logger";
|
|
18
|
+
import type { MessageEnvelope } from "@nwire/envelope";
|
|
19
|
+
import type { z } from "zod";
|
|
20
|
+
import type { ZodTypeAny } from "@nwire/messages";
|
|
21
|
+
import type { ForgeDispatcher } from "./forge-dispatcher.js";
|
|
22
|
+
import type { ActionDefinition, ActionInput, ActionResult } from "../primitives/define-action.js";
|
|
23
|
+
import type { HandlerDefinition as ForgeHandlerDef } from "../primitives/define-handler.js";
|
|
24
|
+
import type { ActorDefinition } from "../primitives/define-actor.js";
|
|
25
|
+
import type { WorkflowDefinition } from "../primitives/define-workflow.js";
|
|
26
|
+
import type { ProjectionDefinition } from "../primitives/define-projection.js";
|
|
27
|
+
import type { QueryDefinition } from "../primitives/define-query.js";
|
|
28
|
+
import type { ExternalCallDefinition } from "../primitives/define-external-call.js";
|
|
29
|
+
import type { EventMessage } from "../messages/event-message.js";
|
|
30
|
+
import type { DispatchOptions } from "./forge-types.js";
|
|
31
|
+
export interface ForgeAppOptions {
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly plugins?: readonly PluginDefinition[];
|
|
34
|
+
readonly container?: Container;
|
|
35
|
+
readonly logger?: Logger;
|
|
36
|
+
readonly handlers?: readonly ForgeHandlerDef<any>[];
|
|
37
|
+
readonly actors?: readonly ActorDefinition[];
|
|
38
|
+
readonly projections?: readonly ProjectionDefinition<any>[];
|
|
39
|
+
readonly queries?: readonly QueryDefinition<any, any, any>[];
|
|
40
|
+
readonly workflows?: readonly WorkflowDefinition[];
|
|
41
|
+
readonly externalCalls?: readonly ExternalCallDefinition<any, any>[];
|
|
42
|
+
}
|
|
43
|
+
export interface ForgeApp {
|
|
44
|
+
readonly $nwireApp: true;
|
|
45
|
+
readonly appName: string;
|
|
46
|
+
readonly runtime: Runtime;
|
|
47
|
+
readonly container: Container;
|
|
48
|
+
start(): Promise<void>;
|
|
49
|
+
stop(reason?: string): Promise<void>;
|
|
50
|
+
/** Endpoint alias. */
|
|
51
|
+
boot(): Promise<void>;
|
|
52
|
+
/** Endpoint alias. */
|
|
53
|
+
shutdown(): Promise<void>;
|
|
54
|
+
dispatch<A extends ActionDefinition>(action: A, input: ActionInput<A>, parentEnvelope?: MessageEnvelope, opts?: DispatchOptions): Promise<ActionResult<A>>;
|
|
55
|
+
publish(events: readonly EventMessage[], parentEnvelope: MessageEnvelope): Promise<void>;
|
|
56
|
+
applyExternalEvent(eventName: string, payload: unknown, envelope: MessageEnvelope): Promise<void>;
|
|
57
|
+
query<TResult = unknown>(queryName: string, input: unknown, tenant?: string): Promise<TResult>;
|
|
58
|
+
executeExternalCall<TRequest extends ZodTypeAny, TResponse extends ZodTypeAny>(def: ExternalCallDefinition<TRequest, TResponse>, request: z.output<TRequest>, envelope?: MessageEnvelope): Promise<z.output<TResponse>>;
|
|
59
|
+
fireDueTimers(now?: number): Promise<number>;
|
|
60
|
+
fireDueWorkflowTimers(now?: Date): Promise<number>;
|
|
61
|
+
dispatcher(): ForgeDispatcher;
|
|
62
|
+
}
|
|
63
|
+
export declare function createForgeApp(options: ForgeAppOptions): ForgeApp;
|
|
64
|
+
export type { Runtime };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createForgeApp` — foundation-form composition entry point.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `createRuntime() + runtime.registerPlugin(forgePlugin) +
|
|
5
|
+
* runtime.start/stop` with the forge dispatch verbs added on the returned
|
|
6
|
+
* app handle. Each verb resolves the `ForgeDispatcher` bound on the
|
|
7
|
+
* container by `forgePlugin` and delegates.
|
|
8
|
+
*
|
|
9
|
+
* Modules are gone in 0.10 — the App is the bounded context. Pass
|
|
10
|
+
* actors / projections / queries / workflows / external calls / handlers
|
|
11
|
+
* directly on opts; they register against the dispatcher during plugin
|
|
12
|
+
* boot (an AppBooting chain step does the registration before any
|
|
13
|
+
* plugin's boot() runs).
|
|
14
|
+
*/
|
|
15
|
+
import { createContainer } from "@nwire/container/awilix";
|
|
16
|
+
import { createRuntime } from "@nwire/app";
|
|
17
|
+
import { forgePlugin as defaultForgePlugin, FORGE_DISPATCHER_BINDING, } from "./forge-plugin.js";
|
|
18
|
+
export function createForgeApp(options) {
|
|
19
|
+
const container = options.container ?? createContainer();
|
|
20
|
+
const runtime = createRuntime({
|
|
21
|
+
container,
|
|
22
|
+
logger: options.logger,
|
|
23
|
+
appName: options.name,
|
|
24
|
+
});
|
|
25
|
+
// Forge plugin first; user plugins after. The user can also pass an
|
|
26
|
+
// explicit `createForgePlugin(opts)` in their list to control stores.
|
|
27
|
+
const plugins = ensureForgePlugin(options.plugins ?? []);
|
|
28
|
+
for (const p of plugins) {
|
|
29
|
+
runtime.registerPlugin(p);
|
|
30
|
+
}
|
|
31
|
+
// Direct registrations land on the dispatcher during AppBooting —
|
|
32
|
+
// after every plugin's setup ran (so forge's dispatcher is bound)
|
|
33
|
+
// but before plugin boot queues fire (so domain routes are wired
|
|
34
|
+
// when downstream plugins' boot work might reach for them).
|
|
35
|
+
runtime.hooks.AppBooting.use(async (_, next) => {
|
|
36
|
+
const d = container.resolve(FORGE_DISPATCHER_BINDING);
|
|
37
|
+
for (const h of options.handlers ?? []) {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
d.registerActionHandler(h);
|
|
40
|
+
}
|
|
41
|
+
for (const actor of options.actors ?? [])
|
|
42
|
+
d.registerActor(actor);
|
|
43
|
+
for (const projection of options.projections ?? [])
|
|
44
|
+
d.registerProjection(projection);
|
|
45
|
+
for (const query of options.queries ?? [])
|
|
46
|
+
d.registerQuery(query);
|
|
47
|
+
for (const workflow of options.workflows ?? [])
|
|
48
|
+
d.registerWorkflow(workflow);
|
|
49
|
+
for (const call of options.externalCalls ?? [])
|
|
50
|
+
d.registerExternalCall(call);
|
|
51
|
+
await next();
|
|
52
|
+
}, { name: "forge.app.register-domain", priority: 1_000_000 });
|
|
53
|
+
const dispatcher = () => container.resolve(FORGE_DISPATCHER_BINDING);
|
|
54
|
+
const app = {
|
|
55
|
+
$nwireApp: true,
|
|
56
|
+
appName: options.name,
|
|
57
|
+
runtime,
|
|
58
|
+
container,
|
|
59
|
+
start: () => runtime.start(),
|
|
60
|
+
stop: (reason) => runtime.stop(reason),
|
|
61
|
+
boot: () => runtime.start(),
|
|
62
|
+
shutdown: () => runtime.stop(),
|
|
63
|
+
dispatcher,
|
|
64
|
+
dispatch: (action, input, parentEnvelope, opts) => dispatcher().dispatch(action, input, parentEnvelope, opts),
|
|
65
|
+
publish: (events, parentEnvelope) => dispatcher().publish(events, parentEnvelope),
|
|
66
|
+
applyExternalEvent: (eventName, payload, envelope) => dispatcher().applyExternalEvent(eventName, payload, envelope),
|
|
67
|
+
query: (name, input, tenant = "") => dispatcher().query(name, input, tenant),
|
|
68
|
+
executeExternalCall: (def, request, envelope) => dispatcher().executeExternalCall(def, request, envelope),
|
|
69
|
+
fireDueTimers: (now) => dispatcher().fireDueTimers(now),
|
|
70
|
+
fireDueWorkflowTimers: (now) => dispatcher().fireDueWorkflowTimers(now),
|
|
71
|
+
};
|
|
72
|
+
return app;
|
|
73
|
+
}
|
|
74
|
+
function ensureForgePlugin(plugins) {
|
|
75
|
+
if (plugins.some((p) => p.name === "forge"))
|
|
76
|
+
return plugins;
|
|
77
|
+
return [defaultForgePlugin, ...plugins];
|
|
78
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ForgeDispatcher` — the CQRS state container that forge layers on top of
|
|
3
|
+
* the kernel runtime.
|
|
4
|
+
*
|
|
5
|
+
* Stage 1 of the forge-as-plugin refactor: pull all the registries, stores,
|
|
6
|
+
* and per-domain hook maps out of `forge.Runtime` into a single composable
|
|
7
|
+
* object. `forge.Runtime` keeps its public methods (`dispatch`, `publish`,
|
|
8
|
+
* `registerHandler`, etc.) and reads from this dispatcher; Stage 2 moves
|
|
9
|
+
* the methods here too and ships a `forgePlugin` that constructs a
|
|
10
|
+
* dispatcher and binds it into the container — at which point
|
|
11
|
+
* `forge.Runtime` disappears entirely and any `kernel.Runtime` becomes
|
|
12
|
+
* forge-capable by installing the plugin.
|
|
13
|
+
*
|
|
14
|
+
* The dispatcher holds a reference to its kernel `Runtime` so per-domain
|
|
15
|
+
* hooks can be created via `runtime.observe(h)` and telemetry pushed via
|
|
16
|
+
* `runtime.emit(rec)` without subclassing.
|
|
17
|
+
*/
|
|
18
|
+
import { type Runtime } from "@nwire/app";
|
|
19
|
+
import { type Hook } from "@nwire/hooks";
|
|
20
|
+
import { type ZodTypeAny } from "@nwire/messages";
|
|
21
|
+
import { type MessageEnvelope } from "@nwire/envelope";
|
|
22
|
+
import { type DeadLetterSink } from "@nwire/dead-letter";
|
|
23
|
+
import type { EventBus } from "@nwire/bus";
|
|
24
|
+
import type { z } from "zod";
|
|
25
|
+
import type { ActionDefinition, ActionInput, ActionResult } from "../primitives/define-action.js";
|
|
26
|
+
import type { HandlerDefinition } from "../primitives/define-handler.js";
|
|
27
|
+
import type { ActorDefinition } from "../primitives/define-actor.js";
|
|
28
|
+
import type { WorkflowDefinition, WorkflowInstance } from "../primitives/define-workflow.js";
|
|
29
|
+
import type { ProjectionDefinition } from "../primitives/define-projection.js";
|
|
30
|
+
import type { QueryDefinition } from "../primitives/define-query.js";
|
|
31
|
+
import type { ExternalCallDefinition, ExternalCallExecutor } from "../primitives/define-external-call.js";
|
|
32
|
+
import { type ActorStore } from "../stores/actor-store.js";
|
|
33
|
+
import { type ProjectionStore } from "../stores/projection-store.js";
|
|
34
|
+
import { type IdempotencyStore } from "../stores/idempotency-store.js";
|
|
35
|
+
import { type WorkflowTimerStore } from "../stores/workflow-timer-store.js";
|
|
36
|
+
import { type EventMessage } from "../messages/event-message.js";
|
|
37
|
+
import type { DispatchOptions, ActionBeforeHookCtx, ActionAfterHookCtx, ActorTransitionHookCtx, WorkflowFireHookCtx } from "./forge-types.js";
|
|
38
|
+
/** Options that configure forge's dispatch behaviour + persistence seams. */
|
|
39
|
+
export interface ForgeDispatcherOptions {
|
|
40
|
+
readonly actorStore?: ActorStore;
|
|
41
|
+
readonly projectionStore?: ProjectionStore;
|
|
42
|
+
readonly deadLetterSink?: DeadLetterSink;
|
|
43
|
+
readonly idempotencyStore?: IdempotencyStore;
|
|
44
|
+
readonly workflowTimerStore?: WorkflowTimerStore;
|
|
45
|
+
readonly bus?: EventBus;
|
|
46
|
+
readonly publishToBus?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Legacy plugin-supplied actor-transition hook signature — kept for back-compat. */
|
|
49
|
+
export type ActorTransitionListener = (actor: ActorDefinition, key: string, fromState: string, toState: string, event: EventMessage, envelope: MessageEnvelope) => Promise<void> | void;
|
|
50
|
+
export declare class ForgeDispatcher {
|
|
51
|
+
readonly runtime: Runtime;
|
|
52
|
+
readonly handlers: Map<string, HandlerDefinition<ZodTypeAny>>;
|
|
53
|
+
readonly actors: Map<string, ActorDefinition<ZodTypeAny, Readonly<Record<string, import("..").ActorMethod<any>>>>>;
|
|
54
|
+
readonly workflowsByEvent: Map<string, WorkflowDefinition[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Per-workflow instance state — keyed first by workflow name, then by
|
|
57
|
+
* correlation key. In-memory for now; durable adapters plug in via a
|
|
58
|
+
* future WorkflowStore contract analogous to ActorStore.
|
|
59
|
+
*/
|
|
60
|
+
readonly workflowInstances: Map<string, Map<string, WorkflowInstance>>;
|
|
61
|
+
readonly projections: Map<string, ProjectionDefinition<any>>;
|
|
62
|
+
readonly projectionsByEvent: Map<string, ProjectionDefinition<any>[]>;
|
|
63
|
+
readonly queries: Map<string, QueryDefinition<any, any, any>>;
|
|
64
|
+
readonly externalCalls: Map<string, ExternalCallDefinition<any, any>>;
|
|
65
|
+
readonly externalCallExecutors: Map<string, ExternalCallExecutor<any, any>>;
|
|
66
|
+
/**
|
|
67
|
+
* Per-action `action.before:<name>` hooks. Pre-created at
|
|
68
|
+
* `registerHandler()` so they show up in `listHooks()` + scan + Studio
|
|
69
|
+
* even before any plugin's `before(name, …)` sugar runs. Observed into
|
|
70
|
+
* the canonical telemetry stream so each chain step emits `hook.step`.
|
|
71
|
+
*/
|
|
72
|
+
readonly actionBeforeHooks: Map<string, Hook<ActionBeforeHookCtx>>;
|
|
73
|
+
/** Per-action `action.after:<name>` hooks. Pre-created identically. */
|
|
74
|
+
readonly actionAfterHooks: Map<string, Hook<ActionAfterHookCtx>>;
|
|
75
|
+
/** Per-actor `actor.transition:<name>` hooks. Pre-created at `registerActor()`. */
|
|
76
|
+
readonly perActorHooks: Map<string, Hook<ActorTransitionHookCtx>>;
|
|
77
|
+
/** Per-workflow `workflow.fire:<name>` hooks. Pre-created at `registerWorkflow()`. */
|
|
78
|
+
readonly perWorkflowHooks: Map<string, Hook<WorkflowFireHookCtx>>;
|
|
79
|
+
/** Legacy plugin-supplied actor-transition listeners — runs after the per-actor hook. */
|
|
80
|
+
readonly actorTransitionHooks: ActorTransitionListener[];
|
|
81
|
+
readonly actorStore: ActorStore;
|
|
82
|
+
readonly projectionStore: ProjectionStore;
|
|
83
|
+
readonly deadLetterSink: DeadLetterSink;
|
|
84
|
+
readonly idempotencyStore: IdempotencyStore;
|
|
85
|
+
readonly workflowTimerStore: WorkflowTimerStore;
|
|
86
|
+
readonly bus?: EventBus;
|
|
87
|
+
readonly publishToBus: boolean;
|
|
88
|
+
/** Known external events — populated by createApp from modules' needs.externalEvents. */
|
|
89
|
+
readonly externalEventNames: Set<string>;
|
|
90
|
+
/** Public-event names (visibility: 'public') — populated by createApp from modules' events. */
|
|
91
|
+
readonly publicEventNames: Set<string>;
|
|
92
|
+
constructor(runtime: Runtime, options?: ForgeDispatcherOptions);
|
|
93
|
+
/** Get-or-create the per-workflow instance store. */
|
|
94
|
+
workflowInstanceStore(workflowName: string): Map<string, WorkflowInstance>;
|
|
95
|
+
/**
|
|
96
|
+
* Register a forge action handler (ActionDefinition + handler closure).
|
|
97
|
+
* Distinct from kernel.Runtime.registerHandler, which registers the
|
|
98
|
+
* canonical @nwire/handler HandlerDefinition. Forge actions carry
|
|
99
|
+
* retry + event-publishing metadata that the bare kernel doesn't know
|
|
100
|
+
* how to apply.
|
|
101
|
+
*/
|
|
102
|
+
registerActionHandler(handler: HandlerDefinition<any>): void;
|
|
103
|
+
registerActor(actor: ActorDefinition): void;
|
|
104
|
+
registerWorkflow(workflow: WorkflowDefinition): void;
|
|
105
|
+
registerProjection(projection: ProjectionDefinition<any>): void;
|
|
106
|
+
registerQuery(query: QueryDefinition<any, any, any>): void;
|
|
107
|
+
registerExternalCall(def: ExternalCallDefinition<any, any>): void;
|
|
108
|
+
registerExternalCallExecutor(def: ExternalCallDefinition<any, any>, executor: ExternalCallExecutor<any, any>): void;
|
|
109
|
+
registerExternalEvent(eventName: string): void;
|
|
110
|
+
registerPublicEvent(eventName: string): void;
|
|
111
|
+
registerActorTransitionHook(listener: ActorTransitionListener): void;
|
|
112
|
+
/** Get-or-create the per-action `action.before:<name>` hook, observed for telemetry. */
|
|
113
|
+
ensureActionBeforeHook(actionName: string): Hook<ActionBeforeHookCtx>;
|
|
114
|
+
ensureActionAfterHook(actionName: string): Hook<ActionAfterHookCtx>;
|
|
115
|
+
ensureActorTransitionHook(actorName: string): Hook<ActorTransitionHookCtx>;
|
|
116
|
+
ensureWorkflowFireHook(workflowName: string): Hook<WorkflowFireHookCtx>;
|
|
117
|
+
executeExternalCall<TRequest extends ZodTypeAny, TResponse extends ZodTypeAny>(def: ExternalCallDefinition<TRequest, TResponse>, request: z.output<TRequest>, envelope?: MessageEnvelope): Promise<z.output<TResponse>>;
|
|
118
|
+
listHandlers(): readonly string[];
|
|
119
|
+
listActors(): readonly string[];
|
|
120
|
+
listProjections(): readonly string[];
|
|
121
|
+
listQueries(): readonly string[];
|
|
122
|
+
listExternalCalls(): readonly string[];
|
|
123
|
+
/** Deduplicated list of every registered workflow definition. */
|
|
124
|
+
listWorkflows(): readonly WorkflowDefinition[];
|
|
125
|
+
getExternalCall(name: string): ExternalCallDefinition<any, any> | undefined;
|
|
126
|
+
/** Resolve a handler definition by action name. */
|
|
127
|
+
findHandler(name: string): HandlerDefinition | undefined;
|
|
128
|
+
/** Resolve an action by routing name — useful when only the name is known. */
|
|
129
|
+
findActionByName(name: string): ActionDefinition<ZodTypeAny> | undefined;
|
|
130
|
+
/** Has a handler been registered for this action name? */
|
|
131
|
+
hasHandler(name: string): boolean;
|
|
132
|
+
query<TResult = unknown>(queryName: string, input: unknown, tenant?: string): Promise<TResult>;
|
|
133
|
+
fireDueTimers(now?: number): Promise<number>;
|
|
134
|
+
fireDueWorkflowTimers(now?: Date): Promise<number>;
|
|
135
|
+
dispatch<A extends ActionDefinition>(action: A, input: ActionInput<A>, parentEnvelope?: MessageEnvelope, opts?: DispatchOptions): Promise<ActionResult<A>>;
|
|
136
|
+
publish(events: readonly EventMessage[], parentEnvelope: MessageEnvelope): Promise<void>;
|
|
137
|
+
applyExternalEvent(eventName: string, payload: unknown, envelope: MessageEnvelope): Promise<void>;
|
|
138
|
+
private foldProjections;
|
|
139
|
+
private applyToActors;
|
|
140
|
+
private extractKey;
|
|
141
|
+
private applyEventToActor;
|
|
142
|
+
private applyEventToActorLocked;
|
|
143
|
+
private computeTimersForState;
|
|
144
|
+
private runWorkflows;
|
|
145
|
+
private buildHandlerContext;
|
|
146
|
+
private loadActorView;
|
|
147
|
+
getDeadLetterSink(): DeadLetterSink;
|
|
148
|
+
}
|