@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,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineExternalCall` — declarative HTTP/RPC call going OUT of the system.
|
|
3
|
+
*
|
|
4
|
+
* export const chargeStripe = defineExternalCall({
|
|
5
|
+
* name: "stripe.create-payment-intent",
|
|
6
|
+
* target: { provider: "stripe", endpoint: "/v1/payment_intents" },
|
|
7
|
+
* request: ChargePaymentIntentSchema,
|
|
8
|
+
* response: PaymentIntentSchema,
|
|
9
|
+
* idempotencyKey: (req) => `charge-${req.orderId}-${req.amount}`,
|
|
10
|
+
* slo: { p95LatencyMs: 600, successRate: 0.995 },
|
|
11
|
+
* retry: { max: 3, backoff: "exponential" },
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* The framework treats external calls as first-class boundaries. The
|
|
15
|
+
* declaration is pure data; the actual call is performed by a registered
|
|
16
|
+
* executor (HTTP client adapter / mock in tests / etc.). Studio renders
|
|
17
|
+
* external calls as boundary stickies in EventStorming and surfaces
|
|
18
|
+
* declared SLOs alongside observed latency from the telemetry stream.
|
|
19
|
+
*
|
|
20
|
+
* Wired at runtime via `ctx.externalCall(definition, request)` — see the
|
|
21
|
+
* HandlerContext extension in `define-handler.ts`.
|
|
22
|
+
*/
|
|
23
|
+
import type { z } from "zod";
|
|
24
|
+
import type { ZodTypeAny } from "@nwire/messages";
|
|
25
|
+
export interface ExternalCallTarget {
|
|
26
|
+
/** Free-form provider tag (e.g. `'stripe'`, `'twilio'`). Studio groups by this. */
|
|
27
|
+
readonly provider: string;
|
|
28
|
+
/** Path or RPC method on the provider. */
|
|
29
|
+
readonly endpoint: string;
|
|
30
|
+
/** Optional environment / region hint. */
|
|
31
|
+
readonly region?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ExternalCallSlo {
|
|
34
|
+
readonly p95LatencyMs?: number;
|
|
35
|
+
readonly successRate?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ExternalCallRetry {
|
|
38
|
+
readonly max: number;
|
|
39
|
+
readonly backoff?: "exponential" | "fixed";
|
|
40
|
+
readonly baseDelayMs?: number;
|
|
41
|
+
readonly maxDelayMs?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ExternalCallMeta<TRequest extends ZodTypeAny = ZodTypeAny, TResponse extends ZodTypeAny = ZodTypeAny> {
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly description?: string;
|
|
46
|
+
readonly target: ExternalCallTarget;
|
|
47
|
+
readonly request: TRequest;
|
|
48
|
+
readonly response?: TResponse;
|
|
49
|
+
/**
|
|
50
|
+
* Pure key extractor — runtime + Studio use it for idempotent retries
|
|
51
|
+
* and request dedup. Same shape as `when().idempotencyKey`.
|
|
52
|
+
*/
|
|
53
|
+
readonly idempotencyKey?: (req: z.output<TRequest>) => string;
|
|
54
|
+
readonly slo?: ExternalCallSlo;
|
|
55
|
+
readonly retry?: ExternalCallRetry;
|
|
56
|
+
readonly tags?: readonly string[];
|
|
57
|
+
}
|
|
58
|
+
export interface ExternalCallDefinition<TRequest extends ZodTypeAny = ZodTypeAny, TResponse extends ZodTypeAny = ZodTypeAny> {
|
|
59
|
+
readonly $kind: "external-call";
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly description?: string;
|
|
62
|
+
readonly target: ExternalCallTarget;
|
|
63
|
+
readonly request: TRequest;
|
|
64
|
+
readonly response?: TResponse;
|
|
65
|
+
readonly idempotencyKey?: (req: z.output<TRequest>) => string;
|
|
66
|
+
/** Flag for the scanner — boolean form of `idempotencyKey` for the cache. */
|
|
67
|
+
readonly hasIdempotencyKey: boolean;
|
|
68
|
+
readonly slo?: ExternalCallSlo;
|
|
69
|
+
readonly retry?: ExternalCallRetry;
|
|
70
|
+
readonly tags?: readonly string[];
|
|
71
|
+
}
|
|
72
|
+
export declare function defineExternalCall<TRequest extends ZodTypeAny, TResponse extends ZodTypeAny = ZodTypeAny>(meta: ExternalCallMeta<TRequest, TResponse>): ExternalCallDefinition<TRequest, TResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* `ExternalCallExecutor` — pluggable transport for a single external call.
|
|
75
|
+
* Adapters (a Stripe SDK wrapper, a generic HTTP client, a test mock) plug
|
|
76
|
+
* one of these in at runtime via `runtime.registerExternalCall(def, exec)`.
|
|
77
|
+
* The runtime owns retry + telemetry + idempotency-key threading; the
|
|
78
|
+
* executor only performs the actual request and returns the validated
|
|
79
|
+
* response (or throws).
|
|
80
|
+
*/
|
|
81
|
+
export type ExternalCallExecutor<TRequest extends ZodTypeAny = ZodTypeAny, TResponse extends ZodTypeAny = ZodTypeAny> = (req: z.output<TRequest>, meta: {
|
|
82
|
+
readonly idempotencyKey?: string;
|
|
83
|
+
readonly attempt: number;
|
|
84
|
+
}) => Promise<z.output<TResponse>>;
|
|
85
|
+
//# sourceMappingURL=define-external-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-external-call.d.ts","sourceRoot":"","sources":["../src/define-external-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,C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AC,MAAM,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC;IAC9D,6EAA6E;IAC7E,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,SAAS,UAAU,EAC3B,SAAS,SAAS,UAAU,GAAG,UAAU,EACzC,IAAI,EAAE,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,sBAAsB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAc1F;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,CAC9B,QAAQ,SAAS,UAAU,GAAG,UAAU,EACxC,SAAS,SAAS,UAAU,GAAG,UAAU,IACvC,CACF,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EACvB,IAAI,EAAE;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,KACjE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineExternalCall` — declarative HTTP/RPC call going OUT of the system.
|
|
3
|
+
*
|
|
4
|
+
* export const chargeStripe = defineExternalCall({
|
|
5
|
+
* name: "stripe.create-payment-intent",
|
|
6
|
+
* target: { provider: "stripe", endpoint: "/v1/payment_intents" },
|
|
7
|
+
* request: ChargePaymentIntentSchema,
|
|
8
|
+
* response: PaymentIntentSchema,
|
|
9
|
+
* idempotencyKey: (req) => `charge-${req.orderId}-${req.amount}`,
|
|
10
|
+
* slo: { p95LatencyMs: 600, successRate: 0.995 },
|
|
11
|
+
* retry: { max: 3, backoff: "exponential" },
|
|
12
|
+
* });
|
|
13
|
+
*
|
|
14
|
+
* The framework treats external calls as first-class boundaries. The
|
|
15
|
+
* declaration is pure data; the actual call is performed by a registered
|
|
16
|
+
* executor (HTTP client adapter / mock in tests / etc.). Studio renders
|
|
17
|
+
* external calls as boundary stickies in EventStorming and surfaces
|
|
18
|
+
* declared SLOs alongside observed latency from the telemetry stream.
|
|
19
|
+
*
|
|
20
|
+
* Wired at runtime via `ctx.externalCall(definition, request)` — see the
|
|
21
|
+
* HandlerContext extension in `define-handler.ts`.
|
|
22
|
+
*/
|
|
23
|
+
export function defineExternalCall(meta) {
|
|
24
|
+
return {
|
|
25
|
+
$kind: "external-call",
|
|
26
|
+
name: meta.name,
|
|
27
|
+
description: meta.description,
|
|
28
|
+
target: meta.target,
|
|
29
|
+
request: meta.request,
|
|
30
|
+
response: meta.response,
|
|
31
|
+
idempotencyKey: meta.idempotencyKey,
|
|
32
|
+
hasIdempotencyKey: !!meta.idempotencyKey,
|
|
33
|
+
slo: meta.slo,
|
|
34
|
+
retry: meta.retry,
|
|
35
|
+
tags: meta.tags,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=define-external-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-external-call.js","sourceRoot":"","sources":["../src/define-external-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA+DH,MAAM,UAAU,kBAAkB,CAGhC,IAA2C;IAC3C,OAAO;QACL,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc;QACxC,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineHandler` — handlers orchestrate and return events.
|
|
3
|
+
*
|
|
4
|
+
* The handler reads the world (external APIs, cross-module `request`s), decides
|
|
5
|
+
* what happened, and returns event(s). It never touches actor state, never
|
|
6
|
+
* persists, never knows what state any actor is in. State changes happen
|
|
7
|
+
* inside actors, driven by the events the handler returns.
|
|
8
|
+
*
|
|
9
|
+
* defineHandler(autoGrade, async (input, { request }) => {
|
|
10
|
+
* const grade = await request(evaluateGrade, { ... })
|
|
11
|
+
* return grade.confidence >= THRESHOLD
|
|
12
|
+
* ? AnswerAutoGradedEvent({ ... })
|
|
13
|
+
* : AnswerFlaggedEvent({ ... })
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* The first argument is the action's `ActionDefinition`. The action carries
|
|
17
|
+
* the name + schema; the handler reads input typed against the schema. The
|
|
18
|
+
* returned events route to actors + workflows and commit atomically.
|
|
19
|
+
*
|
|
20
|
+
* If the handler does pure side effects (no events to commit), return `void`.
|
|
21
|
+
*/
|
|
22
|
+
import type { z } from "zod";
|
|
23
|
+
import type { ZodTypeAny } from "@nwire/messages";
|
|
24
|
+
import type { Container } from "@nwire/container";
|
|
25
|
+
import type { MessageEnvelope } from "@nwire/envelope";
|
|
26
|
+
import type { EventMessage } from "./event-message.js";
|
|
27
|
+
import type { ActionDefinition } from "./define-action.js";
|
|
28
|
+
import type { ActorDefinition, ActorInstanceView } from "./define-actor.js";
|
|
29
|
+
import type { QueryDefinition } from "./define-query.js";
|
|
30
|
+
import type { ExternalCallDefinition } from "./define-external-call.js";
|
|
31
|
+
import type { Logger } from "@nwire/logger";
|
|
32
|
+
export interface HandlerContext {
|
|
33
|
+
readonly container: Container;
|
|
34
|
+
readonly envelope: MessageEnvelope;
|
|
35
|
+
/** Convenience getter — equivalent to `envelope.messageId`. */
|
|
36
|
+
readonly requestId: string;
|
|
37
|
+
/** Look up a dependency by name. Shortcut for `container.resolve(name)`. */
|
|
38
|
+
resolve<T = unknown>(name: string): T;
|
|
39
|
+
/**
|
|
40
|
+
* Logger scoped to this envelope — `messageId`, `correlationId`,
|
|
41
|
+
* `causationId`, `tenant`, `userId` are auto-attached to every line.
|
|
42
|
+
* Domain code never threads ids manually.
|
|
43
|
+
*/
|
|
44
|
+
readonly logger: Logger;
|
|
45
|
+
/**
|
|
46
|
+
* Universal "ask and wait." Calls another action by reference, returns its
|
|
47
|
+
* result. The framework derives a child envelope (same correlationId,
|
|
48
|
+
* causationId = this handler's messageId) and handles transport routing.
|
|
49
|
+
*/
|
|
50
|
+
request<TInput, TResult>(action: ActionDefinition<ZodTypeAny>, input: TInput): Promise<TResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Read-during-handler — invoke a query (projection-backed read function)
|
|
53
|
+
* scoped to the envelope's tenant. Used by reactions that need to look up
|
|
54
|
+
* state to decide what action to dispatch.
|
|
55
|
+
*
|
|
56
|
+
* Per ADR-008, queries always read projections, never actor stores. Per
|
|
57
|
+
* ADR-007, handlers stay pure of state mutation; reads via `query` are the
|
|
58
|
+
* sanctioned way to inform a handler's decision.
|
|
59
|
+
*/
|
|
60
|
+
query<TResult = unknown>(query: QueryDefinition<any, any, any>, input: unknown): Promise<TResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Fire-and-forget dispatch of another action. Returns when the message is
|
|
63
|
+
* accepted by the transport, not when the handler completes.
|
|
64
|
+
*/
|
|
65
|
+
send<TInput>(action: ActionDefinition<ZodTypeAny>, input: TInput): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Load an actor instance by id (envelope.tenant-scoped) and return a view
|
|
68
|
+
* with `state`, `stateName`, `key`, plus every method declared on the actor
|
|
69
|
+
* pre-bound to the loaded state. The view is a snapshot — subsequent
|
|
70
|
+
* dispatches do not refresh it. Re-call `ctx.use` after a dispatch that
|
|
71
|
+
* mutated the actor to observe the new state.
|
|
72
|
+
*
|
|
73
|
+
* Methods are pure: they take state, return event(s) or read values. To
|
|
74
|
+
* apply an event the method minted, return it from the handler.
|
|
75
|
+
*
|
|
76
|
+
* const submission = await ctx.use(Submission, input.submissionId)
|
|
77
|
+
* if (!submission.isGradable()) throw new Error('not gradable')
|
|
78
|
+
* return submission.grade(input.verdict) // event consumed by handler
|
|
79
|
+
*/
|
|
80
|
+
use<TActor extends ActorDefinition>(actor: TActor, id: string): Promise<ActorInstanceView<TActor>>;
|
|
81
|
+
/**
|
|
82
|
+
* Invoke a declared external call (HTTP/RPC to another system). The
|
|
83
|
+
* runtime threads the declared idempotency key, applies retry policy,
|
|
84
|
+
* and emits `external.call.started/.completed/.failed` telemetry. The
|
|
85
|
+
* actual transport is the registered `ExternalCallExecutor` for this
|
|
86
|
+
* definition; if none is registered the call throws at runtime so
|
|
87
|
+
* misconfigured wiring surfaces loudly.
|
|
88
|
+
*/
|
|
89
|
+
externalCall<TRequest extends ZodTypeAny, TResponse extends ZodTypeAny>(call: ExternalCallDefinition<TRequest, TResponse>, request: z.output<TRequest>): Promise<z.output<TResponse>>;
|
|
90
|
+
}
|
|
91
|
+
export type HandlerReturn = void | EventMessage | EventMessage[] | null;
|
|
92
|
+
export interface HandlerDefinition<TSchema extends ZodTypeAny = ZodTypeAny> {
|
|
93
|
+
readonly $kind: "v3-handler";
|
|
94
|
+
readonly action: ActionDefinition<TSchema>;
|
|
95
|
+
readonly handler: (input: z.output<TSchema>, ctx: HandlerContext) => Promise<HandlerReturn> | HandlerReturn;
|
|
96
|
+
}
|
|
97
|
+
export declare function defineHandler<TSchema extends ZodTypeAny>(action: ActionDefinition<TSchema>, handler: HandlerDefinition<TSchema>["handler"]): HandlerDefinition<TSchema>;
|
|
98
|
+
//# sourceMappingURL=define-handler.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,GAC7C,iBAAiB,CAAC,OAAO,CAAC,CAM5B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineHandler` — handlers orchestrate and return events.
|
|
3
|
+
*
|
|
4
|
+
* The handler reads the world (external APIs, cross-module `request`s), decides
|
|
5
|
+
* what happened, and returns event(s). It never touches actor state, never
|
|
6
|
+
* persists, never knows what state any actor is in. State changes happen
|
|
7
|
+
* inside actors, driven by the events the handler returns.
|
|
8
|
+
*
|
|
9
|
+
* defineHandler(autoGrade, async (input, { request }) => {
|
|
10
|
+
* const grade = await request(evaluateGrade, { ... })
|
|
11
|
+
* return grade.confidence >= THRESHOLD
|
|
12
|
+
* ? AnswerAutoGradedEvent({ ... })
|
|
13
|
+
* : AnswerFlaggedEvent({ ... })
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* The first argument is the action's `ActionDefinition`. The action carries
|
|
17
|
+
* the name + schema; the handler reads input typed against the schema. The
|
|
18
|
+
* returned events route to actors + workflows and commit atomically.
|
|
19
|
+
*
|
|
20
|
+
* If the handler does pure side effects (no events to commit), return `void`.
|
|
21
|
+
*/
|
|
22
|
+
export function defineHandler(action, handler) {
|
|
23
|
+
return {
|
|
24
|
+
$kind: "v3-handler",
|
|
25
|
+
action,
|
|
26
|
+
handler,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=define-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-handler.js","sourceRoot":"","sources":["../src/define-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA8FH,MAAM,UAAU,aAAa,CAC3B,MAAiC,EACjC,OAA8C;IAE9C,OAAO;QACL,KAAK,EAAE,YAAY;QACnB,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineInboundWebhook` — declarative entry point for callbacks FROM
|
|
3
|
+
* external systems (Stripe events, Twilio status, partner pushes, …).
|
|
4
|
+
*
|
|
5
|
+
* export const stripeWebhook = defineInboundWebhook({
|
|
6
|
+
* name: "stripe.payment-events",
|
|
7
|
+
* source: "stripe",
|
|
8
|
+
* path: "/webhooks/stripe",
|
|
9
|
+
* verifySignature: (rawBody, headers, secret) => stripeLib.verify(...),
|
|
10
|
+
* dedupe: { window: "24h", keyFrom: (msg) => msg.id },
|
|
11
|
+
* schema: StripeWebhookSchema,
|
|
12
|
+
* routes: {
|
|
13
|
+
* "payment_intent.succeeded": confirmPayment,
|
|
14
|
+
* "payment_intent.payment_failed": markPaymentFailed,
|
|
15
|
+
* },
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* Wire-level handlers (`@nwire/http`) mount the route and on each request:
|
|
19
|
+
* 1. Run `verifySignature` (deny if invalid)
|
|
20
|
+
* 2. Run `dedupe.keyFrom` and check the inbox (skip if already seen)
|
|
21
|
+
* 3. Parse the payload through `schema`
|
|
22
|
+
* 4. Look up the discriminator field in `routes` → dispatch the action
|
|
23
|
+
*
|
|
24
|
+
* Studio renders inbound webhooks as boundary stickies and surfaces
|
|
25
|
+
* signature-failed / dedup hits / unrouted events as drift signals.
|
|
26
|
+
*/
|
|
27
|
+
import type { ZodTypeAny } from "@nwire/messages";
|
|
28
|
+
import type { ActionDefinition } from "./define-action.js";
|
|
29
|
+
export interface WebhookSignatureVerifier {
|
|
30
|
+
(req: {
|
|
31
|
+
readonly rawBody: string;
|
|
32
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
33
|
+
readonly secret?: string;
|
|
34
|
+
}): boolean | Promise<boolean>;
|
|
35
|
+
}
|
|
36
|
+
export interface WebhookDedupe {
|
|
37
|
+
/** Window for dedup memory. Parseable duration: `'24h'`, `'7d'`. */
|
|
38
|
+
readonly window: string;
|
|
39
|
+
/** Pure extractor: return the unique id from the parsed body. */
|
|
40
|
+
readonly keyFrom: (msg: unknown) => string;
|
|
41
|
+
}
|
|
42
|
+
export interface InboundWebhookMeta<TSchema extends ZodTypeAny = ZodTypeAny> {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly description?: string;
|
|
45
|
+
/** Provider tag (e.g. `'stripe'`, `'twilio'`). */
|
|
46
|
+
readonly source: string;
|
|
47
|
+
/** HTTP path the wire mounts this on. */
|
|
48
|
+
readonly path: string;
|
|
49
|
+
/** Optional signature verifier — recommended for production. */
|
|
50
|
+
readonly verifySignature?: WebhookSignatureVerifier;
|
|
51
|
+
/** Optional dedupe config — Studio surfaces dedup hits. */
|
|
52
|
+
readonly dedupe?: WebhookDedupe;
|
|
53
|
+
/** Body schema. */
|
|
54
|
+
readonly schema: TSchema;
|
|
55
|
+
/**
|
|
56
|
+
* Discriminator field inside the parsed body. Default `'type'`.
|
|
57
|
+
* Webhook providers like Stripe use `type` (`payment_intent.succeeded`);
|
|
58
|
+
* Twilio uses `MessageStatus`; etc.
|
|
59
|
+
*/
|
|
60
|
+
readonly discriminator?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Map of discriminator value → action to dispatch. Studio draws an edge
|
|
63
|
+
* from this webhook to each routed action.
|
|
64
|
+
*/
|
|
65
|
+
readonly routes: Readonly<Record<string, ActionDefinition>>;
|
|
66
|
+
readonly tags?: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
export interface InboundWebhookDefinition<TSchema extends ZodTypeAny = ZodTypeAny> {
|
|
69
|
+
readonly $kind: "inbound-webhook";
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly description?: string;
|
|
72
|
+
readonly source: string;
|
|
73
|
+
readonly path: string;
|
|
74
|
+
readonly verifySignature?: WebhookSignatureVerifier;
|
|
75
|
+
readonly dedupe?: WebhookDedupe;
|
|
76
|
+
readonly schema: TSchema;
|
|
77
|
+
readonly discriminator: string;
|
|
78
|
+
readonly routes: Readonly<Record<string, ActionDefinition>>;
|
|
79
|
+
readonly tags?: readonly string[];
|
|
80
|
+
}
|
|
81
|
+
export declare function defineInboundWebhook<TSchema extends ZodTypeAny>(meta: InboundWebhookMeta<TSchema>): InboundWebhookDefinition<TSchema>;
|
|
82
|
+
//# sourceMappingURL=define-inbound-webhook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-inbound-webhook.d.ts","sourceRoot":"","sources":["../src/define-inbound-webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,wBAAwB;IACvC,CAAC,GAAG,EAAE;QACJ,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,eAAe,CAAC,EA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point for callbacks FROM
|
|
3
|
+
* external systems (Stripe events, Twilio status, partner pushes, …).
|
|
4
|
+
*
|
|
5
|
+
* export const stripeWebhook = defineInboundWebhook({
|
|
6
|
+
* name: "stripe.payment-events",
|
|
7
|
+
* source: "stripe",
|
|
8
|
+
* path: "/webhooks/stripe",
|
|
9
|
+
* verifySignature: (rawBody, headers, secret) => stripeLib.verify(...),
|
|
10
|
+
* dedupe: { window: "24h", keyFrom: (msg) => msg.id },
|
|
11
|
+
* schema: StripeWebhookSchema,
|
|
12
|
+
* routes: {
|
|
13
|
+
* "payment_intent.succeeded": confirmPayment,
|
|
14
|
+
* "payment_intent.payment_failed": markPaymentFailed,
|
|
15
|
+
* },
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* Wire-level handlers (`@nwire/http`) mount the route and on each request:
|
|
19
|
+
* 1. Run `verifySignature` (deny if invalid)
|
|
20
|
+
* 2. Run `dedupe.keyFrom` and check the inbox (skip if already seen)
|
|
21
|
+
* 3. Parse the payload through `schema`
|
|
22
|
+
* 4. Look up the discriminator field in `routes` → dispatch the action
|
|
23
|
+
*
|
|
24
|
+
* Studio renders inbound webhooks as boundary stickies and surfaces
|
|
25
|
+
* signature-failed / dedup hits / unrouted events as drift signals.
|
|
26
|
+
*/
|
|
27
|
+
export function defineInboundWebhook(meta) {
|
|
28
|
+
return {
|
|
29
|
+
$kind: "inbound-webhook",
|
|
30
|
+
name: meta.name,
|
|
31
|
+
description: meta.description,
|
|
32
|
+
source: meta.source,
|
|
33
|
+
path: meta.path,
|
|
34
|
+
verifySignature: meta.verifySignature,
|
|
35
|
+
dedupe: meta.dedupe,
|
|
36
|
+
schema: meta.schema,
|
|
37
|
+
discriminator: meta.discriminator ?? "type",
|
|
38
|
+
routes: meta.routes,
|
|
39
|
+
tags: meta.tags,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=define-inbound-webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-inbound-webhook.js","sourceRoot":"","sources":["../src/define-inbound-webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA6DH,MAAM,UAAU,oBAAoB,CAClC,IAAiC;IAEjC,OAAO;QACL,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,MAAM;QAC3C,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineInbox` — declarative inbound dedupe window.
|
|
3
|
+
*
|
|
4
|
+
* export const ordersInbox = defineInbox({
|
|
5
|
+
* name: "orders",
|
|
6
|
+
* window: "7d",
|
|
7
|
+
* on: [orderConfirmedFromPartner],
|
|
8
|
+
* });
|
|
9
|
+
*
|
|
10
|
+
* An inbox tracks message ids that have already been processed. At-least-once
|
|
11
|
+
* delivery from a bus or webhook source can deliver the same message twice;
|
|
12
|
+
* the inbox short-circuits the duplicate.
|
|
13
|
+
*
|
|
14
|
+
* The framework treats inboxes as first-class so Studio can render them
|
|
15
|
+
* as boundary stickies and surface dedup-hit rates as health signals.
|
|
16
|
+
*
|
|
17
|
+
* Runtime: a registered `InboxStore` adapter holds seen-keys with a TTL.
|
|
18
|
+
* Used by `defineInboundWebhook` (when the webhook declares `dedupe`) and
|
|
19
|
+
* by inbound bus events (when the consuming action declares idempotency).
|
|
20
|
+
*/
|
|
21
|
+
import type { ActionDefinition } from "./define-action.js";
|
|
22
|
+
export interface InboxMeta {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly description?: string;
|
|
25
|
+
/** TTL window for the dedup memory. Parseable duration: `'24h'`, `'7d'`. */
|
|
26
|
+
readonly window: string;
|
|
27
|
+
/** Actions this inbox guards — Studio uses this to draw arrows. */
|
|
28
|
+
readonly on: readonly ActionDefinition[];
|
|
29
|
+
readonly tags?: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export interface InboxDefinition {
|
|
32
|
+
readonly $kind: "inbox";
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly description?: string;
|
|
35
|
+
readonly window: string;
|
|
36
|
+
readonly on: readonly ActionDefinition[];
|
|
37
|
+
readonly tags?: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
export declare function defineInbox(meta: InboxMeta): InboxDefinition;
|
|
40
|
+
//# sourceMappingURL=define-inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-inbox.d.ts","sourceRoot":"","sources":["../src/define-inbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CAS5D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineInbox` — declarative inbound dedupe window.
|
|
3
|
+
*
|
|
4
|
+
* export const ordersInbox = defineInbox({
|
|
5
|
+
* name: "orders",
|
|
6
|
+
* window: "7d",
|
|
7
|
+
* on: [orderConfirmedFromPartner],
|
|
8
|
+
* });
|
|
9
|
+
*
|
|
10
|
+
* An inbox tracks message ids that have already been processed. At-least-once
|
|
11
|
+
* delivery from a bus or webhook source can deliver the same message twice;
|
|
12
|
+
* the inbox short-circuits the duplicate.
|
|
13
|
+
*
|
|
14
|
+
* The framework treats inboxes as first-class so Studio can render them
|
|
15
|
+
* as boundary stickies and surface dedup-hit rates as health signals.
|
|
16
|
+
*
|
|
17
|
+
* Runtime: a registered `InboxStore` adapter holds seen-keys with a TTL.
|
|
18
|
+
* Used by `defineInboundWebhook` (when the webhook declares `dedupe`) and
|
|
19
|
+
* by inbound bus events (when the consuming action declares idempotency).
|
|
20
|
+
*/
|
|
21
|
+
export function defineInbox(meta) {
|
|
22
|
+
return {
|
|
23
|
+
$kind: "inbox",
|
|
24
|
+
name: meta.name,
|
|
25
|
+
description: meta.description,
|
|
26
|
+
window: meta.window,
|
|
27
|
+
on: meta.on,
|
|
28
|
+
tags: meta.tags,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=define-inbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-inbox.js","sourceRoot":"","sources":["../src/define-inbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAuBH,MAAM,UAAU,WAAW,CAAC,IAAe;IACzC,OAAO;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineInitializer` — app lifecycle hook.
|
|
3
|
+
*
|
|
4
|
+
* Two-phase boot (register → boot) + reverse-order shutdown. Initializers
|
|
5
|
+
* live in `apps/<app>/wires/initializers/` and have access to the app's
|
|
6
|
+
* container + config + the app itself.
|
|
7
|
+
*
|
|
8
|
+
* export const persistence = defineInitializer("persistence", {
|
|
9
|
+
* register: ({ container, config }) => {
|
|
10
|
+
* container.register("db", () => new PrismaClient(config.dbUrl));
|
|
11
|
+
* },
|
|
12
|
+
* boot: async ({ container }) => {
|
|
13
|
+
* await container.resolve("db").$connect();
|
|
14
|
+
* },
|
|
15
|
+
* shutdown: async ({ container }) => {
|
|
16
|
+
* await container.resolve("db").$disconnect();
|
|
17
|
+
* },
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* Lifecycle:
|
|
21
|
+
* 1. App starts. All initializers' `register` run first (in declared order).
|
|
22
|
+
* 2. All initializers' `boot` run next (in declared order). Providers
|
|
23
|
+
* registered in step 1 are now available.
|
|
24
|
+
* 3. App serves traffic.
|
|
25
|
+
* 4. On stop, `shutdown` runs in REVERSE order so things that depend on
|
|
26
|
+
* others get shut down first.
|
|
27
|
+
*
|
|
28
|
+
* Distinct from `defineProvider` (which is a single resolvable value) and
|
|
29
|
+
* `definePlugin` (which carries middleware + actor hooks + routes too).
|
|
30
|
+
* Initializers are pure lifecycle.
|
|
31
|
+
*/
|
|
32
|
+
export type InitContainer = any;
|
|
33
|
+
export type InitConfig = Record<string, any>;
|
|
34
|
+
export type InitApp = any;
|
|
35
|
+
export interface InitializerContext {
|
|
36
|
+
readonly container: InitContainer;
|
|
37
|
+
readonly config: InitConfig;
|
|
38
|
+
readonly app: InitApp;
|
|
39
|
+
}
|
|
40
|
+
export interface InitializerSpec {
|
|
41
|
+
/** Register providers/values into the container. Runs before any boot. */
|
|
42
|
+
readonly register?: (ctx: InitializerContext) => void | Promise<void>;
|
|
43
|
+
/** Boot — initializers run after every `register` has completed. */
|
|
44
|
+
readonly boot?: (ctx: InitializerContext) => void | Promise<void>;
|
|
45
|
+
/** Shutdown — runs in REVERSE order on app stop. */
|
|
46
|
+
readonly shutdown?: (ctx: InitializerContext) => void | Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export interface InitializerDefinition extends InitializerSpec {
|
|
49
|
+
readonly $kind: "initializer";
|
|
50
|
+
readonly name: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function defineInitializer(name: string, spec: InitializerSpec): InitializerDefinition;
|
|
53
|
+
export declare const isInitializer: (x: unknown) => x is InitializerDefinition;
|
|
54
|
+
//# sourceMappingURL=define-initializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-initializer.d.ts","sourceRoot":"","sources":["../src/define-initializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC;AAEhC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE7C,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC;AAE1B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,oEAAoE;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,eAAe,GACpB,qBAAqB,CAEvB;AAED,eAAO,MAAM,aAAa,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,qBAGI,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineInitializer` — app lifecycle hook.
|
|
3
|
+
*
|
|
4
|
+
* Two-phase boot (register → boot) + reverse-order shutdown. Initializers
|
|
5
|
+
* live in `apps/<app>/wires/initializers/` and have access to the app's
|
|
6
|
+
* container + config + the app itself.
|
|
7
|
+
*
|
|
8
|
+
* export const persistence = defineInitializer("persistence", {
|
|
9
|
+
* register: ({ container, config }) => {
|
|
10
|
+
* container.register("db", () => new PrismaClient(config.dbUrl));
|
|
11
|
+
* },
|
|
12
|
+
* boot: async ({ container }) => {
|
|
13
|
+
* await container.resolve("db").$connect();
|
|
14
|
+
* },
|
|
15
|
+
* shutdown: async ({ container }) => {
|
|
16
|
+
* await container.resolve("db").$disconnect();
|
|
17
|
+
* },
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* Lifecycle:
|
|
21
|
+
* 1. App starts. All initializers' `register` run first (in declared order).
|
|
22
|
+
* 2. All initializers' `boot` run next (in declared order). Providers
|
|
23
|
+
* registered in step 1 are now available.
|
|
24
|
+
* 3. App serves traffic.
|
|
25
|
+
* 4. On stop, `shutdown` runs in REVERSE order so things that depend on
|
|
26
|
+
* others get shut down first.
|
|
27
|
+
*
|
|
28
|
+
* Distinct from `defineProvider` (which is a single resolvable value) and
|
|
29
|
+
* `definePlugin` (which carries middleware + actor hooks + routes too).
|
|
30
|
+
* Initializers are pure lifecycle.
|
|
31
|
+
*/
|
|
32
|
+
export function defineInitializer(name, spec) {
|
|
33
|
+
return { $kind: "initializer", name, ...spec };
|
|
34
|
+
}
|
|
35
|
+
export const isInitializer = (x) => typeof x === "object" &&
|
|
36
|
+
x !== null &&
|
|
37
|
+
x.$kind === "initializer";
|
|
38
|
+
//# sourceMappingURL=define-initializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-initializer.js","sourceRoot":"","sources":["../src/define-initializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA6BH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,IAAqB;IAErB,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAU,EAA8B,EAAE,CACtE,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,KAAK,IAAI;IACT,CAAyB,CAAC,KAAK,KAAK,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware primitives — re-exported from `@nwire/handler`.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation moved to `@nwire/handler`. Forge keeps
|
|
5
|
+
* the same export names so existing call sites compile unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export { defineMiddleware, defineHook, pipe, unwindPipe, isMiddleware, isHook, isPipe, type MiddlewareDefinition, type HookDefinition, type MiddlewarePipe, type PipeStep, type ChainFn, type ResolverCtx, type Next, } from "@nwire/handler";
|
|
8
|
+
//# sourceMappingURL=define-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-middleware.d.ts","sourceRoot":"","sources":["../src/define-middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,MAAM,EACN,MAAM,EACN,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,IAAI,GACV,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware primitives — re-exported from `@nwire/handler`.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation moved to `@nwire/handler`. Forge keeps
|
|
5
|
+
* the same export names so existing call sites compile unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export { defineMiddleware, defineHook, pipe, unwindPipe, isMiddleware, isHook, isPipe, } from "@nwire/handler";
|
|
8
|
+
//# sourceMappingURL=define-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-middleware.js","sourceRoot":"","sources":["../src/define-middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,MAAM,EACN,MAAM,GAQP,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineModel` — re-exported from `@nwire/handler` as `defineResource`.
|
|
3
|
+
*
|
|
4
|
+
* The canonical name for the interface/response shape primitive moved
|
|
5
|
+
* to `defineResource` in `@nwire/handler` as part of the v1.0 sealed-
|
|
6
|
+
* architecture extraction. Forge re-exports under both names so existing
|
|
7
|
+
* call sites compile unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export { defineModel, isModelDefinition, defineResource, isResourceDefinition, type ModelDefinition, type DefineModelOptions, type ResourceDefinition, type DefineResourceOptions, } from "@nwire/handler";
|
|
10
|
+
//# sourceMappingURL=define-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-model.d.ts","sourceRoot":"","sources":["../src/define-model.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,WAAW,EACX,iBAAiB,EAGjB,cAAc,EACd,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC"}
|