@adonis-agora/durable 1.0.0-rc.1 → 1.0.0-rc.11
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/CHANGELOG.md +131 -0
- package/dist/assets/spa/assets/index-B2kIfzsc.css +1 -0
- package/dist/assets/spa/assets/index-Bgf_8IJ0.js +16 -0
- package/dist/assets/spa/assets/index-Bgf_8IJ0.js.map +1 -0
- package/dist/assets/spa/index.html +2 -2
- package/dist/commands/durable_worker.d.ts +3 -3
- package/dist/commands/durable_worker.js +7 -7
- package/dist/commands/durable_worker.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +4 -2
- package/dist/commands/runs.js.map +1 -1
- package/dist/providers/dashboard_provider.d.ts +20 -54
- package/dist/providers/dashboard_provider.d.ts.map +1 -1
- package/dist/providers/dashboard_provider.js +87 -262
- package/dist/providers/dashboard_provider.js.map +1 -1
- package/dist/providers/durable_provider.d.ts.map +1 -1
- package/dist/providers/durable_provider.js +38 -33
- package/dist/providers/durable_provider.js.map +1 -1
- package/dist/src/commands/runs.js +1 -1
- package/dist/src/commands/runs.js.map +1 -1
- package/dist/src/concurrency.d.ts.map +1 -1
- package/dist/src/concurrency.js +1 -0
- package/dist/src/concurrency.js.map +1 -1
- package/dist/src/config_types.d.ts +12 -12
- package/dist/src/config_types.d.ts.map +1 -1
- package/dist/src/control-flow-signal.d.ts +5 -4
- package/dist/src/control-flow-signal.d.ts.map +1 -1
- package/dist/src/control-flow-signal.js +5 -4
- package/dist/src/control-flow-signal.js.map +1 -1
- package/dist/src/dashboard/access_denied_page.d.ts +5 -7
- package/dist/src/dashboard/access_denied_page.d.ts.map +1 -1
- package/dist/src/dashboard/access_denied_page.js +2 -6
- package/dist/src/dashboard/access_denied_page.js.map +1 -1
- package/dist/src/dashboard/console_authorize.d.ts +76 -0
- package/dist/src/dashboard/console_authorize.d.ts.map +1 -0
- package/dist/src/dashboard/console_authorize.js +101 -0
- package/dist/src/dashboard/console_authorize.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +44 -81
- package/dist/src/dashboard/define_config.d.ts.map +1 -1
- package/dist/src/dashboard/define_config.js +16 -112
- package/dist/src/dashboard/define_config.js.map +1 -1
- package/dist/src/dashboard/diagnostics-recorder.d.ts +1 -1
- package/dist/src/dashboard/diagnostics-recorder.js +1 -1
- package/dist/src/dashboard/gateway-adapter.d.ts +6 -6
- package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -1
- package/dist/src/dashboard/gateway-adapter.js +5 -5
- package/dist/src/dashboard/gateway-adapter.js.map +1 -1
- package/dist/src/dashboard/handlers.d.ts +4 -4
- package/dist/src/dashboard/handlers.d.ts.map +1 -1
- package/dist/src/dashboard/handlers.js +11 -7
- package/dist/src/dashboard/handlers.js.map +1 -1
- package/dist/src/dashboard/index.d.ts +6 -9
- package/dist/src/dashboard/index.d.ts.map +1 -1
- package/dist/src/dashboard/index.js +5 -7
- package/dist/src/dashboard/index.js.map +1 -1
- package/dist/src/dashboard/openapi.d.ts.map +1 -1
- package/dist/src/dashboard/openapi.js +12 -2
- package/dist/src/dashboard/openapi.js.map +1 -1
- package/dist/src/dashboard/run-filter.d.ts.map +1 -1
- package/dist/src/dashboard/run-filter.js +1 -0
- package/dist/src/dashboard/run-filter.js.map +1 -1
- package/dist/src/define_config.d.ts +10 -12
- package/dist/src/define_config.d.ts.map +1 -1
- package/dist/src/define_config.js +9 -4
- package/dist/src/define_config.js.map +1 -1
- package/dist/src/diagnostics/index.d.ts +11 -0
- package/dist/src/diagnostics/index.d.ts.map +1 -0
- package/dist/src/diagnostics/index.js +6 -0
- package/dist/src/diagnostics/index.js.map +1 -0
- package/dist/src/diagnostics/transport.d.ts +71 -0
- package/dist/src/diagnostics/transport.d.ts.map +1 -0
- package/dist/src/diagnostics/transport.js +188 -0
- package/dist/src/diagnostics/transport.js.map +1 -0
- package/dist/src/diagnostics-bridge.d.ts +2 -1
- package/dist/src/diagnostics-bridge.d.ts.map +1 -1
- package/dist/src/diagnostics-bridge.js +7 -1
- package/dist/src/diagnostics-bridge.js.map +1 -1
- package/dist/src/engine.d.ts +14 -9
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/engine.js +137 -52
- package/dist/src/engine.js.map +1 -1
- package/dist/src/errors.d.ts +9 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +13 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/event-trigger-bridge.d.ts +5 -14
- package/dist/src/event-trigger-bridge.d.ts.map +1 -1
- package/dist/src/event-trigger-bridge.js +11 -99
- package/dist/src/event-trigger-bridge.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces.d.ts +24 -8
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/interfaces.js +8 -0
- package/dist/src/interfaces.js.map +1 -1
- package/dist/src/origin.js +3 -3
- package/dist/src/role_bindings.d.ts +8 -8
- package/dist/src/role_bindings.js +8 -8
- package/dist/src/run-gateway/interface.d.ts +4 -3
- package/dist/src/run-gateway/interface.d.ts.map +1 -1
- package/dist/src/run-gateway/proxy-run-gateway.d.ts +1 -1
- package/dist/src/run-gateway/proxy-run-gateway.js +1 -1
- package/dist/src/run-gateway/run-request-responder.d.ts +1 -1
- package/dist/src/run-gateway/store-run-gateway.d.ts +4 -4
- package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -1
- package/dist/src/run-gateway/store-run-gateway.js +4 -4
- package/dist/src/run-gateway/store-run-gateway.js.map +1 -1
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +2 -1
- package/dist/src/scheduler.js.map +1 -1
- package/dist/src/services/main.d.ts +3 -3
- package/dist/src/services/main.js +6 -6
- package/dist/src/services/main.js.map +1 -1
- package/dist/src/singleton-admission.d.ts.map +1 -1
- package/dist/src/singleton-admission.js +2 -0
- package/dist/src/singleton-admission.js.map +1 -1
- package/dist/src/singleton-gate.d.ts +1 -1
- package/dist/src/singleton-gate.d.ts.map +1 -1
- package/dist/src/singleton-gate.js +4 -3
- package/dist/src/singleton-gate.js.map +1 -1
- package/dist/src/stores/lucid-pg-hot-path.d.ts +6 -2
- package/dist/src/stores/lucid-pg-hot-path.d.ts.map +1 -1
- package/dist/src/stores/lucid-pg-hot-path.js +7 -3
- package/dist/src/stores/lucid-pg-hot-path.js.map +1 -1
- package/dist/src/stores/lucid.d.ts +15 -2
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +191 -49
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/testing/in-memory-state-store.js +3 -3
- package/dist/src/testing/in-memory-state-store.js.map +1 -1
- package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
- package/dist/src/testing-kit/state-store-conformance.js +13 -0
- package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
- package/dist/src/testing-kit/transport-conformance.d.ts.map +1 -1
- package/dist/src/testing-kit/transport-conformance.js +5 -1
- package/dist/src/testing-kit/transport-conformance.js.map +1 -1
- package/dist/src/transports/bullmq/bullmq-transport.d.ts +1 -1
- package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
- package/dist/src/transports/bullmq/bullmq-transport.js +14 -3
- package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
- package/dist/src/transports/db.d.ts.map +1 -1
- package/dist/src/transports/db.js +42 -3
- package/dist/src/transports/db.js.map +1 -1
- package/dist/src/transports/queue.d.ts +2 -2
- package/dist/src/transports/queue.d.ts.map +1 -1
- package/dist/src/transports/queue.js +49 -8
- package/dist/src/transports/queue.js.map +1 -1
- package/dist/src/workflow-discovery.d.ts +1 -1
- package/dist/src/workflow-discovery.d.ts.map +1 -1
- package/dist/src/workflow-discovery.js +4 -7
- package/dist/src/workflow-discovery.js.map +1 -1
- package/dist/src/workflow-events.d.ts +20 -51
- package/dist/src/workflow-events.d.ts.map +1 -1
- package/dist/src/workflow-events.js +12 -30
- package/dist/src/workflow-events.js.map +1 -1
- package/dist/src/workflow-ref.d.ts +1 -1
- package/dist/src/workflow-turn.d.ts.map +1 -1
- package/dist/src/workflow-turn.js +18 -1
- package/dist/src/workflow-turn.js.map +1 -1
- package/dist/stubs/config/durable_dashboard.stub +9 -29
- package/package.json +12 -2
- package/skills/durable-cluster/SKILL.md +34 -22
- package/skills/durable-reliability/SKILL.md +2 -2
- package/dist/assets/spa/assets/index-70hGzOnT.css +0 -1
- package/dist/assets/spa/assets/index-CJjMAUau.js +0 -16
- package/dist/assets/spa/assets/index-CJjMAUau.js.map +0 -1
- package/dist/src/dashboard/auth.d.ts +0 -134
- package/dist/src/dashboard/auth.d.ts.map +0 -1
- package/dist/src/dashboard/auth.js +0 -156
- package/dist/src/dashboard/auth.js.map +0 -1
- package/dist/src/dashboard/login_page.d.ts +0 -36
- package/dist/src/dashboard/login_page.d.ts.map +0 -1
- package/dist/src/dashboard/login_page.js +0 -158
- package/dist/src/dashboard/login_page.js.map +0 -1
- package/dist/src/dashboard/session_cookie.d.ts +0 -45
- package/dist/src/dashboard/session_cookie.d.ts.map +0 -1
- package/dist/src/dashboard/session_cookie.js +0 -97
- package/dist/src/dashboard/session_cookie.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-filter.js","sourceRoot":"","sources":["../../../src/dashboard/run-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGrE;sEACsE;AACtE,MAAM,CAAC,MAAM,YAAY,GAAyB;IAChD,SAAS;IACT,SAAS;IACT,WAAW;IACX,SAAS;IACT,WAAW;IACX,QAAQ;IACR,WAAW;IACX,MAAM;CACP,CAAC;AAEF;;;mBAGmB;AACnB,SAAS,IAAI,CAAC,K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I,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF;AAED,4GAA4G;AAC5G,SAAS,aAAa,CAAC,GAAY;IACjC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,GAAiC,CAAC;AAC7F,CAAC;AAED,wEAAwE;AACxE,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -13,7 +13,7 @@ import type { DbTransportConfig, EventEmitterTransportConfig, MemoryTransportCon
|
|
|
13
13
|
import { transports } from './transports/factory.js';
|
|
14
14
|
import type { WorkflowRef } from './workflow-ref.js';
|
|
15
15
|
/**
|
|
16
|
-
* The **shared** fields of `config/durable.ts`, common to every {@link DurableConfig}
|
|
16
|
+
* The **shared** fields of `config/durable.ts`, common to every {@link DurableConfig} topology. Everything
|
|
17
17
|
* here is optional — by default the engine uses an in-process
|
|
18
18
|
* state store + transport (single-process, no extra infra). Pick a `transport`/`store` by name from
|
|
19
19
|
* the `transports`/`stores` maps to run cross-process or persist durably; build the entries with the
|
|
@@ -57,10 +57,10 @@ export interface BaseDurableConfig {
|
|
|
57
57
|
* Which topology this engine runs as (spec §3): `'standalone'` (default — control-plane + embedded
|
|
58
58
|
* worker), `'control-plane'` (pure coordinator), or `'tenant'` (store-less thin pod). Selected
|
|
59
59
|
* explicitly, never inferred. Omit it and {@link defineConfig} defaults to `'standalone'`, so a
|
|
60
|
-
* config
|
|
60
|
+
* config that omits it behaves identically. The concrete per-topology shape is a member
|
|
61
61
|
* of the {@link DurableConfig} union; this base only declares the discriminant for shared reads.
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
topology?: 'standalone' | 'control-plane' | 'tenant';
|
|
64
64
|
/**
|
|
65
65
|
* Name of the transport (a key of {@link transports}) the engine dispatches over. Omit for the
|
|
66
66
|
* in-process transport (single-process, no extra infra).
|
|
@@ -74,7 +74,7 @@ export interface BaseDurableConfig {
|
|
|
74
74
|
* and a step can pin any of them by name with `ctx.step(step, input, { transport: 'db' })`. Each
|
|
75
75
|
* one gets the same consumer deferral, namespace and shutdown as `transport`. Only the transports
|
|
76
76
|
* named here (and `transport`) are built: the rest of `transports` stays a menu. Store-backed
|
|
77
|
-
*
|
|
77
|
+
* topologies only; a `tenant` pod uses its one `transport`.
|
|
78
78
|
*/
|
|
79
79
|
transportPool?: string[];
|
|
80
80
|
/**
|
|
@@ -158,7 +158,7 @@ export interface BaseDurableConfig {
|
|
|
158
158
|
* queue names. Set distinct values to safely share ONE state store + broker across
|
|
159
159
|
* non-interchangeable pools (e.g. local dev vs a cluster).
|
|
160
160
|
*
|
|
161
|
-
* Absent, it depends on the
|
|
161
|
+
* Absent, it depends on the topology. A `standalone` engine (the default topology) is in `'default'`: it
|
|
162
162
|
* drives only the default pool (runs stamped `'default'`, and legacy rows stored without a
|
|
163
163
|
* namespace, which every shipped store reads back as `'default'`) — byte-identical to a
|
|
164
164
|
* single-pool deployment. A `control-plane` engine with no namespace is the OPERATOR: it drives,
|
|
@@ -409,19 +409,17 @@ export interface BaseDurableConfig {
|
|
|
409
409
|
stepsPath?: string | readonly string[] | false;
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
412
|
-
* Shape of `config/durable.ts` — a **
|
|
413
|
-
* accepted config on the `
|
|
412
|
+
* Shape of `config/durable.ts` — a **topology-discriminated union** (spec §5). TypeScript narrows the
|
|
413
|
+
* accepted config on the `topology` literal, so each topology gets exactly the right fields and an
|
|
414
414
|
* invalid combination is a compile error. The headline invariant: a `tenant` config may not name a
|
|
415
415
|
* store (`store?: never` on {@link TenantConfig}), making store-less isolation a compile-time fact.
|
|
416
|
-
* A config with no `
|
|
417
|
-
* pre-roles config byte-for-byte.
|
|
416
|
+
* A config with no `topology` lands on {@link StandaloneConfig} — the default.
|
|
418
417
|
*/
|
|
419
418
|
export type DurableConfig = StandaloneConfig | ControlPlaneConfig | TenantConfig;
|
|
420
419
|
/**
|
|
421
420
|
* Identity helper giving `config/durable.ts` full type-checking. Overloaded so the return type
|
|
422
|
-
* **narrows on `
|
|
423
|
-
* `
|
|
424
|
-
* before roles existed) still boots as the single-process standalone engine.
|
|
421
|
+
* **narrows on `topology`**: pass a `tenant` config and you get a {@link TenantConfig} back, etc. The
|
|
422
|
+
* `topology` is defaulted to `'standalone'` at runtime, so a config that omits it still boots as the single-process standalone engine.
|
|
425
423
|
*/
|
|
426
424
|
export declare function defineConfig(config: TenantConfig): TenantConfig;
|
|
427
425
|
export declare function defineConfig(config: ControlPlaneConfig): ControlPlaneConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kGAAkG;IAClG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,
|
|
1
|
+
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY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AgBG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,KAAK,CAAC;IACnD;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,KAAK,CAAC;CAChD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,YAAY,CAAC;AAEjF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAC;AACjE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;AAC7E,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;AAc1E,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,CAAC;AACF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -2,10 +2,15 @@ import { admissions } from './admissions/factory.js';
|
|
|
2
2
|
import { controlPlanes } from './control-planes/factory.js';
|
|
3
3
|
import { stores } from './stores/factory.js';
|
|
4
4
|
import { transports } from './transports/factory.js';
|
|
5
|
-
export function defineConfig(config = {
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
5
|
+
export function defineConfig(config = { topology: 'standalone' }) {
|
|
6
|
+
// `role` was renamed to `topology` in 1.0. Refuse the old key: ignoring it would boot a
|
|
7
|
+
// control-plane or tenant config as `standalone`, silently.
|
|
8
|
+
if ('role' in config) {
|
|
9
|
+
throw new Error("@adonis-agora/durable: `role` was renamed to `topology` in config/durable.ts (same values: 'standalone' | 'control-plane' | 'tenant'). Rename the key.");
|
|
10
|
+
}
|
|
11
|
+
// Default the discriminant so downstream (provider, gateway) can branch on a always-present `topology`
|
|
12
|
+
// without re-deriving it. `...config` wins, so an explicit topology is preserved.
|
|
13
|
+
return { topology: 'standalone', ...config };
|
|
9
14
|
}
|
|
10
15
|
export { admissions, controlPlanes, stores, transports };
|
|
11
16
|
//# sourceMappingURL=define_config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAarD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAarD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAkarD,MAAM,UAAU,YAAY,CAAC,MAAM,GAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE;IAC7E,wFAAwF;IACxF,4DAA4D;IAC5D,IAAI,MAAM,IAAK,MAAiB,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,wJAAwJ,CACzJ,CAAC;IACJ,CAAC;IACD,uGAAuG;IACvG,kFAAkF;IAClF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,EAAmB,CAAC;AAChE,CAAC;AAwBD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@adonis-agora/durable/diagnostics`: the module `transports.durable()` of
|
|
3
|
+
* `@adonis-agora/diagnostics` loads at boot. It runs every diagnostics listener call as a durable
|
|
4
|
+
* run. Durable only imports types from diagnostics, so this module never loads it.
|
|
5
|
+
*/
|
|
6
|
+
import type { DurableDiagnosticsModule } from '@adonis-agora/diagnostics/delivery';
|
|
7
|
+
export { createDeliveryTransport, DIAGNOSTICS_DEFAULT_RETRY, DIAGNOSTICS_LISTENER_ORIGIN, DIAGNOSTICS_LISTENER_WORKFLOW, DIAGNOSTICS_RUN_PREFIX, type DiagnosticsListenerInput, DurableDeliveryTransport, diagnosticsRunId, diagnosticsRunTags, isConfigured, } from './transport.js';
|
|
8
|
+
/** The module as one object. Typing it checks this module is what `transports.durable()` expects. */
|
|
9
|
+
declare const durableDiagnostics: DurableDiagnosticsModule;
|
|
10
|
+
export default durableDiagnostics;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/diagnostics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAGnF,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,qGAAqG;AACrG,QAAA,MAAM,kBAAkB,EAAE,wBAAoE,CAAC;eAChF,kBAAkB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createDeliveryTransport, isConfigured } from './transport.js';
|
|
2
|
+
export { createDeliveryTransport, DIAGNOSTICS_DEFAULT_RETRY, DIAGNOSTICS_LISTENER_ORIGIN, DIAGNOSTICS_LISTENER_WORKFLOW, DIAGNOSTICS_RUN_PREFIX, DurableDeliveryTransport, diagnosticsRunId, diagnosticsRunTags, isConfigured, } from './transport.js';
|
|
3
|
+
/** The module as one object. Typing it checks this module is what `transports.durable()` expects. */
|
|
4
|
+
const durableDiagnostics = { isConfigured, createDeliveryTransport };
|
|
5
|
+
export default durableDiagnostics;
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/diagnostics/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EAEtB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,qGAAqG;AACrG,MAAM,kBAAkB,GAA6B,EAAE,YAAY,EAAE,uBAAuB,EAAE,CAAC;AAC/F,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { DeliveredEvent, DeliveryTransportContext, DurableTransportConfig, ListenerDelivery, ListenerDeliveryTransport } from '@adonis-agora/diagnostics/delivery';
|
|
2
|
+
import type { ApplicationService } from '@adonisjs/core/types';
|
|
3
|
+
import { WorkflowEngine } from '../engine.js';
|
|
4
|
+
import type { StepOptions } from '../interfaces.js';
|
|
5
|
+
/** The internal workflow every diagnostics listener delivery runs as. */
|
|
6
|
+
export declare const DIAGNOSTICS_LISTENER_WORKFLOW = "durable.diagnostics.listener";
|
|
7
|
+
/** The origin stamped on those runs, so the console groups them under diagnostics. */
|
|
8
|
+
export declare const DIAGNOSTICS_LISTENER_ORIGIN = "@adonis-agora/diagnostics";
|
|
9
|
+
/** The prefix of every delivery run id: `diag:<event id>:<listener id>`. */
|
|
10
|
+
export declare const DIAGNOSTICS_RUN_PREFIX = "diag:";
|
|
11
|
+
/**
|
|
12
|
+
* The retry policy a listener gets when `transports.durable()` sets none: three attempts, one
|
|
13
|
+
* second apart and doubling, at most 30 seconds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DIAGNOSTICS_DEFAULT_RETRY: Readonly<StepOptions>;
|
|
16
|
+
/** The input of a delivery run: which listener, and the event it receives. */
|
|
17
|
+
export interface DiagnosticsListenerInput {
|
|
18
|
+
listenerId: string;
|
|
19
|
+
envelope: DeliveredEvent;
|
|
20
|
+
}
|
|
21
|
+
/** The run id of one delivery. The same event and listener always give the same id. */
|
|
22
|
+
export declare function diagnosticsRunId(eventId: string, listenerId: string): string;
|
|
23
|
+
/** The tags a delivery run carries, so the console can filter by lib, event or listener. */
|
|
24
|
+
export declare function diagnosticsRunTags(delivery: ListenerDelivery): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether an engine event belongs to a delivery run. Durable does not forward those runs' own
|
|
27
|
+
* lifecycle events to the diagnostics bus: a listener on `durable` events would otherwise start a
|
|
28
|
+
* delivery run for every delivery run it caused, without end.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isDiagnosticsDeliveryEvent(event: {
|
|
31
|
+
runId?: string | undefined;
|
|
32
|
+
workflow?: string | undefined;
|
|
33
|
+
}): boolean;
|
|
34
|
+
/** Validate `transports.durable(options)` and merge it over {@link DIAGNOSTICS_DEFAULT_RETRY}. */
|
|
35
|
+
export declare function diagnosticsStepOptions(config?: DurableTransportConfig): StepOptions;
|
|
36
|
+
/**
|
|
37
|
+
* Stop every diagnostics delivery transport created on `engine`: each one stops taking deliveries
|
|
38
|
+
* and waits for the runs it is creating. The durable provider calls it on shutdown before it drains
|
|
39
|
+
* the engine, whichever of the two providers shuts down first.
|
|
40
|
+
*/
|
|
41
|
+
export declare function stopDiagnosticsDeliveries(engine: WorkflowEngine): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* The {@link ListenerDeliveryTransport} behind `transports.durable()`: each `(listener, event)` is a
|
|
44
|
+
* run of {@link DIAGNOSTICS_LISTENER_WORKFLOW}, which calls the listener inside the `handle` step.
|
|
45
|
+
*/
|
|
46
|
+
export declare class DurableDeliveryTransport implements ListenerDeliveryTransport {
|
|
47
|
+
#private;
|
|
48
|
+
constructor(engine: WorkflowEngine);
|
|
49
|
+
/**
|
|
50
|
+
* Start one run per delivery and resolve once every run is stored. A delivery whose run already
|
|
51
|
+
* exists (the same event handed over twice) counts as delivered. When some starts fail, the others
|
|
52
|
+
* still go through and the returned promise rejects with the failures.
|
|
53
|
+
*/
|
|
54
|
+
deliver(deliveries: readonly ListenerDelivery[]): Promise<void>;
|
|
55
|
+
/** Stop taking deliveries and wait for the runs being created. */
|
|
56
|
+
stop(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Register {@link DIAGNOSTICS_LISTENER_WORKFLOW} on `engine`. Its run calls the listener through
|
|
60
|
+
* `invoke` in a `handle` step with the given retry policy. A listener this process does not know is
|
|
61
|
+
* a {@link FatalError}: retrying cannot make it appear.
|
|
62
|
+
*/
|
|
63
|
+
export declare function registerDiagnosticsListenerWorkflow(engine: WorkflowEngine, invoke: DeliveryTransportContext['invoke'], stepOptions: StepOptions): void;
|
|
64
|
+
/** Whether a durable engine is bound in `app`'s container. */
|
|
65
|
+
export declare function isConfigured(app: ApplicationService): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Create the delivery transport for this process: register the listener workflow on the app's
|
|
68
|
+
* engine, so this process can run deliveries, and return the transport that starts them.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createDeliveryTransport(context: DeliveryTransportContext, config?: DurableTransportConfig): Promise<DurableDeliveryTransport>;
|
|
71
|
+
//# sourceMappingURL=transport.d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AAsB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAIrF;AAED;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,yBAAyB;;IAKxE,YAAY,MAAM,EAAE,cAAc,EAQjC;IAED;;;;OAIG;IACH,OAAO,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9D;IAkCD,kEAAkE;IAC5D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAI1B;CACF;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC1C,WAAW,EAAE,WAAW,GACvB,IAAI,CA8BN;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAG7D;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,wBAAwB,EACjC,MAAM,GAAE,sBAA2B,GAClC,OAAO,CAAC,wBAAwB,CAAC,CAKnC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { WorkflowEngine } from '../engine.js';
|
|
2
|
+
import { FatalError, RunAlreadyExistsError } from '../errors.js';
|
|
3
|
+
/** The internal workflow every diagnostics listener delivery runs as. */
|
|
4
|
+
export const DIAGNOSTICS_LISTENER_WORKFLOW = 'durable.diagnostics.listener';
|
|
5
|
+
/** The origin stamped on those runs, so the console groups them under diagnostics. */
|
|
6
|
+
export const DIAGNOSTICS_LISTENER_ORIGIN = '@adonis-agora/diagnostics';
|
|
7
|
+
/** The prefix of every delivery run id: `diag:<event id>:<listener id>`. */
|
|
8
|
+
export const DIAGNOSTICS_RUN_PREFIX = 'diag:';
|
|
9
|
+
/** The error code `ctx.invoke` rejects with when this process has no listener with that id. */
|
|
10
|
+
const UNKNOWN_LISTENER = 'E_UNKNOWN_DIAGNOSTICS_LISTENER';
|
|
11
|
+
/**
|
|
12
|
+
* The retry policy a listener gets when `transports.durable()` sets none: three attempts, one
|
|
13
|
+
* second apart and doubling, at most 30 seconds.
|
|
14
|
+
*/
|
|
15
|
+
export const DIAGNOSTICS_DEFAULT_RETRY = Object.freeze({
|
|
16
|
+
retries: 3,
|
|
17
|
+
backoff: 'exp',
|
|
18
|
+
backoffMs: 1_000,
|
|
19
|
+
backoffMaxMs: 30_000,
|
|
20
|
+
});
|
|
21
|
+
/** The run id of one delivery. The same event and listener always give the same id. */
|
|
22
|
+
export function diagnosticsRunId(eventId, listenerId) {
|
|
23
|
+
return `${DIAGNOSTICS_RUN_PREFIX}${eventId}:${listenerId}`;
|
|
24
|
+
}
|
|
25
|
+
/** The tags a delivery run carries, so the console can filter by lib, event or listener. */
|
|
26
|
+
export function diagnosticsRunTags(delivery) {
|
|
27
|
+
return [
|
|
28
|
+
'diagnostics',
|
|
29
|
+
`lib:${delivery.envelope.lib}`,
|
|
30
|
+
`event:${delivery.envelope.event}`,
|
|
31
|
+
`listener:${delivery.listenerId}`,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether an engine event belongs to a delivery run. Durable does not forward those runs' own
|
|
36
|
+
* lifecycle events to the diagnostics bus: a listener on `durable` events would otherwise start a
|
|
37
|
+
* delivery run for every delivery run it caused, without end.
|
|
38
|
+
*/
|
|
39
|
+
export function isDiagnosticsDeliveryEvent(event) {
|
|
40
|
+
if (event.workflow !== undefined)
|
|
41
|
+
return event.workflow === DIAGNOSTICS_LISTENER_WORKFLOW;
|
|
42
|
+
return typeof event.runId === 'string' && event.runId.startsWith(DIAGNOSTICS_RUN_PREFIX);
|
|
43
|
+
}
|
|
44
|
+
/** Validate `transports.durable(options)` and merge it over {@link DIAGNOSTICS_DEFAULT_RETRY}. */
|
|
45
|
+
export function diagnosticsStepOptions(config = {}) {
|
|
46
|
+
const options = { ...DIAGNOSTICS_DEFAULT_RETRY };
|
|
47
|
+
if (config.retries !== undefined) {
|
|
48
|
+
if (!Number.isInteger(config.retries) || config.retries < 1) {
|
|
49
|
+
throw new Error(`@adonis-agora/durable: transports.durable({ retries }) must be an integer of at least 1 (got ${String(config.retries)})`);
|
|
50
|
+
}
|
|
51
|
+
options.retries = config.retries;
|
|
52
|
+
}
|
|
53
|
+
for (const key of ['backoffMs', 'backoffMaxMs']) {
|
|
54
|
+
const value = config[key];
|
|
55
|
+
if (value === undefined)
|
|
56
|
+
continue;
|
|
57
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
|
|
58
|
+
throw new Error(`@adonis-agora/durable: transports.durable({ ${key} }) must be a number of milliseconds of at least 0 (got ${String(value)})`);
|
|
59
|
+
}
|
|
60
|
+
options[key] = value;
|
|
61
|
+
}
|
|
62
|
+
if (config.backoff !== undefined) {
|
|
63
|
+
if (config.backoff !== 'fixed' && config.backoff !== 'exp') {
|
|
64
|
+
throw new Error(`@adonis-agora/durable: transports.durable({ backoff }) must be 'fixed' or 'exp' (got ${String(config.backoff)})`);
|
|
65
|
+
}
|
|
66
|
+
options.backoff = config.backoff;
|
|
67
|
+
}
|
|
68
|
+
if (config.jitter !== undefined)
|
|
69
|
+
options.jitter = config.jitter === true;
|
|
70
|
+
return options;
|
|
71
|
+
}
|
|
72
|
+
/** The delivery transports alive per engine, stopped by the durable provider before it drains. */
|
|
73
|
+
const liveTransports = new WeakMap();
|
|
74
|
+
/**
|
|
75
|
+
* Stop every diagnostics delivery transport created on `engine`: each one stops taking deliveries
|
|
76
|
+
* and waits for the runs it is creating. The durable provider calls it on shutdown before it drains
|
|
77
|
+
* the engine, whichever of the two providers shuts down first.
|
|
78
|
+
*/
|
|
79
|
+
export async function stopDiagnosticsDeliveries(engine) {
|
|
80
|
+
const transports = liveTransports.get(engine);
|
|
81
|
+
if (!transports)
|
|
82
|
+
return;
|
|
83
|
+
await Promise.all([...transports].map((transport) => transport.stop()));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The {@link ListenerDeliveryTransport} behind `transports.durable()`: each `(listener, event)` is a
|
|
87
|
+
* run of {@link DIAGNOSTICS_LISTENER_WORKFLOW}, which calls the listener inside the `handle` step.
|
|
88
|
+
*/
|
|
89
|
+
export class DurableDeliveryTransport {
|
|
90
|
+
#engine;
|
|
91
|
+
#inFlight = new Set();
|
|
92
|
+
#stopped = false;
|
|
93
|
+
constructor(engine) {
|
|
94
|
+
this.#engine = engine;
|
|
95
|
+
let transports = liveTransports.get(engine);
|
|
96
|
+
if (!transports) {
|
|
97
|
+
transports = new Set();
|
|
98
|
+
liveTransports.set(engine, transports);
|
|
99
|
+
}
|
|
100
|
+
transports.add(this);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Start one run per delivery and resolve once every run is stored. A delivery whose run already
|
|
104
|
+
* exists (the same event handed over twice) counts as delivered. When some starts fail, the others
|
|
105
|
+
* still go through and the returned promise rejects with the failures.
|
|
106
|
+
*/
|
|
107
|
+
deliver(deliveries) {
|
|
108
|
+
if (this.#stopped) {
|
|
109
|
+
return Promise.reject(new Error('@adonis-agora/durable: the diagnostics delivery transport is stopped'));
|
|
110
|
+
}
|
|
111
|
+
const work = this.#startAll(deliveries);
|
|
112
|
+
this.#inFlight.add(work);
|
|
113
|
+
const forget = () => this.#inFlight.delete(work);
|
|
114
|
+
work.then(forget, forget);
|
|
115
|
+
return work;
|
|
116
|
+
}
|
|
117
|
+
async #startAll(deliveries) {
|
|
118
|
+
const results = await Promise.allSettled(deliveries.map((d) => this.#start(d)));
|
|
119
|
+
const errors = results.flatMap((r) => (r.status === 'rejected' ? [r.reason] : []));
|
|
120
|
+
if (errors.length === 1)
|
|
121
|
+
throw errors[0];
|
|
122
|
+
if (errors.length > 1) {
|
|
123
|
+
throw new AggregateError(errors, `@adonis-agora/durable: ${errors.length} of ${deliveries.length} diagnostics deliveries could not be started`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async #start(delivery) {
|
|
127
|
+
const input = {
|
|
128
|
+
listenerId: delivery.listenerId,
|
|
129
|
+
envelope: delivery.envelope,
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
await this.#engine.start(DIAGNOSTICS_LISTENER_WORKFLOW, input, diagnosticsRunId(delivery.envelope.id, delivery.listenerId), { tags: diagnosticsRunTags(delivery), origin: DIAGNOSTICS_LISTENER_ORIGIN });
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
// `start` already reports a duplicate id as the existing run; a store that still throws it
|
|
136
|
+
// means the same thing: this delivery is already a run.
|
|
137
|
+
if (error instanceof RunAlreadyExistsError)
|
|
138
|
+
return;
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/** Stop taking deliveries and wait for the runs being created. */
|
|
143
|
+
async stop() {
|
|
144
|
+
this.#stopped = true;
|
|
145
|
+
await Promise.allSettled([...this.#inFlight]);
|
|
146
|
+
liveTransports.get(this.#engine)?.delete(this);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Register {@link DIAGNOSTICS_LISTENER_WORKFLOW} on `engine`. Its run calls the listener through
|
|
151
|
+
* `invoke` in a `handle` step with the given retry policy. A listener this process does not know is
|
|
152
|
+
* a {@link FatalError}: retrying cannot make it appear.
|
|
153
|
+
*/
|
|
154
|
+
export function registerDiagnosticsListenerWorkflow(engine, invoke, stepOptions) {
|
|
155
|
+
engine.register(DIAGNOSTICS_LISTENER_WORKFLOW, '1', async (ctx, raw) => {
|
|
156
|
+
const { listenerId, envelope } = raw;
|
|
157
|
+
await ctx.localStep('handle', async () => {
|
|
158
|
+
try {
|
|
159
|
+
await invoke(listenerId, envelope);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (error?.code === UNKNOWN_LISTENER) {
|
|
163
|
+
throw new FatalError(error instanceof Error
|
|
164
|
+
? error.message
|
|
165
|
+
: `unknown diagnostics listener ${listenerId}`, UNKNOWN_LISTENER, { listenerId });
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}, stepOptions);
|
|
171
|
+
}, { tags: ['diagnostics'], origin: DIAGNOSTICS_LISTENER_ORIGIN });
|
|
172
|
+
}
|
|
173
|
+
/** Whether a durable engine is bound in `app`'s container. */
|
|
174
|
+
export function isConfigured(app) {
|
|
175
|
+
const container = app.container;
|
|
176
|
+
return typeof container.hasBinding === 'function' && container.hasBinding(WorkflowEngine);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create the delivery transport for this process: register the listener workflow on the app's
|
|
180
|
+
* engine, so this process can run deliveries, and return the transport that starts them.
|
|
181
|
+
*/
|
|
182
|
+
export async function createDeliveryTransport(context, config = {}) {
|
|
183
|
+
const stepOptions = diagnosticsStepOptions(config);
|
|
184
|
+
const engine = await context.app.container.make(WorkflowEngine);
|
|
185
|
+
registerDiagnosticsListenerWorkflow(engine, context.invoke, stepOptions);
|
|
186
|
+
return new DurableDeliveryTransport(engine);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/diagnostics/transport.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGjE,yEAAyE;AACzE,MAAM,CAAC,MAAM,6BAA6B,GAAG,8BAA8B,CAAC;AAE5E,sFAAsF;AACtF,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AAEvE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAE9C,+FAA+F;AAC/F,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA0B,MAAM,CAAC,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AAC,KAAK,UAAU,uBAAuB,CAC3C,OAAiC,EACjC,MAAM,GAA2B,EAAE;IAEnC,MAAM,WAAW,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChE,mCAAmC,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzE,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -27,7 +27,8 @@ export interface DurableDiagnosticsOptions {
|
|
|
27
27
|
* `hasSubscribers`, so an unsubscribed channel costs nothing, and it never throws back into the
|
|
28
28
|
* engine. Only the events THIS instance produced are forwarded by default (see
|
|
29
29
|
* {@link DurableDiagnosticsOptions.includeRemote}), so a fleet records each event once; all event
|
|
30
|
-
* types are forwarded — filtering is the subscriber's job
|
|
30
|
+
* types are forwarded — filtering is the subscriber's job — except those of the runs that deliver
|
|
31
|
+
* diagnostics listener calls (`transports.durable()`), which would otherwise feed themselves. An event of a child run
|
|
31
32
|
* the engine started (`ctx.all`, `ctx.child`, `ctx.startChild` without a caller-chosen id) also
|
|
32
33
|
* carries `parentRunId`: each child is its own run, so that field is how a subscriber (a Telescope
|
|
33
34
|
* search, say) finds every child of one parent, a whole `ctx.all` fan included. An event of a run a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics-bridge.d.ts","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diagnostics-bridge.d.ts","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC/D;AAMD,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,EAC1B,OAAO,GAAE,yBAA8B,GACtC,MAAM,IAAI,CAyBZ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDiagnosticsDeliveryEvent } from './diagnostics/transport.js';
|
|
1
2
|
import { parentRunIdOf } from './fan-join.js';
|
|
2
3
|
import { lifecycleSourceOf } from './lifecycle-events.js';
|
|
3
4
|
import { isRemoteEvent } from './remote-event.js';
|
|
@@ -16,7 +17,8 @@ const EMIT_SLOT = Symbol.for('@agora/diagnostics:emit');
|
|
|
16
17
|
* `hasSubscribers`, so an unsubscribed channel costs nothing, and it never throws back into the
|
|
17
18
|
* engine. Only the events THIS instance produced are forwarded by default (see
|
|
18
19
|
* {@link DurableDiagnosticsOptions.includeRemote}), so a fleet records each event once; all event
|
|
19
|
-
* types are forwarded — filtering is the subscriber's job
|
|
20
|
+
* types are forwarded — filtering is the subscriber's job — except those of the runs that deliver
|
|
21
|
+
* diagnostics listener calls (`transports.durable()`), which would otherwise feed themselves. An event of a child run
|
|
20
22
|
* the engine started (`ctx.all`, `ctx.child`, `ctx.startChild` without a caller-chosen id) also
|
|
21
23
|
* carries `parentRunId`: each child is its own run, so that field is how a subscriber (a Telescope
|
|
22
24
|
* search, say) finds every child of one parent, a whole `ctx.all` fan included. An event of a run a
|
|
@@ -32,6 +34,10 @@ export function attachDurableDiagnostics(engine, options = {}) {
|
|
|
32
34
|
return engine.subscribe((event) => {
|
|
33
35
|
if (!includeRemote && isRemoteEvent(event))
|
|
34
36
|
return;
|
|
37
|
+
// A run delivering a diagnostics listener call (`transports.durable()`) is not echoed back onto
|
|
38
|
+
// the bus: a listener on `durable` events would start a delivery run for each one, forever.
|
|
39
|
+
if (isDiagnosticsDeliveryEvent(event))
|
|
40
|
+
return;
|
|
35
41
|
const emit = globalThis[EMIT_SLOT];
|
|
36
42
|
if (typeof emit !== 'function')
|
|
37
43
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics-bridge.js","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOlD,6GAA6G;AAC7G,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAexD
|
|
1
|
+
{"version":3,"file":"diagnostics-bridge.js","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOlD,6GAA6G;AAC7G,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAexD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAA0B,EAC1B,OAAO,GAA8B,EAAE;IAEvC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,KAAK,IAAI,CAAC;IACrD,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,KAAkB,EAAE,EAAE;QAC7C,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,KAAK,CAAC;YAAE,OAAO;QACnD,gGAAgG;QAChG,4FAA4F;QAC5F,IAAI,0BAA0B,CAAC,KAAK,CAAC;YAAE,OAAO;QAC9C,MAAM,IAAI,GAAI,UAAsC,CAAC,SAAS,CAAuB,CAAC;QACtF,IAAI,OAAO,IAAI,KAAK,UAAU;YAAE,OAAO;QACvC,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ;YAC3B,CAAC,CAAC,iBAAiB,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;YAClE,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,CACF,SAAS,EACT,KAAK,CAAC,IAAI,EACV,WAAW,IAAI,MAAM;YACnB,CAAC,CAAC;gBACE,GAAG,KAAK;gBACR,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtF;YACH,CAAC,CAAC,KAAK,CACV,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/engine.d.ts
CHANGED
|
@@ -163,7 +163,7 @@ export interface WorkflowEngineDeps {
|
|
|
163
163
|
*
|
|
164
164
|
* The AdonisJS provider maps `config/durable.ts` onto this: an absent `namespace` is `'default'` on
|
|
165
165
|
* a `standalone` engine (it drives only the default pool, legacy rows included), and stays
|
|
166
|
-
* `undefined` — the operator — only on a `
|
|
166
|
+
* `undefined` — the operator — only on a `topology: 'control-plane'` engine. Constructing the engine by
|
|
167
167
|
* hand keeps the raw meaning above.
|
|
168
168
|
*/
|
|
169
169
|
namespace?: string | undefined;
|
|
@@ -1467,8 +1467,7 @@ export declare class WorkflowEngine {
|
|
|
1467
1467
|
/**
|
|
1468
1468
|
* Sweep a deleted run's token-keyed buffered signals — they are not run-scoped rows, so the store's
|
|
1469
1469
|
* deleteRun can't cascade them. Without this every fire-and-forget child that was never joined leaks
|
|
1470
|
-
* its buffered `child:<id>` completion FOREVER (one row per spawn)
|
|
1471
|
-
* can leave a `cancel:<id>` marker behind.
|
|
1470
|
+
* its buffered `child:<id>` completion FOREVER (one row per spawn).
|
|
1472
1471
|
*/
|
|
1473
1472
|
private sweepRunBufferedSignals;
|
|
1474
1473
|
/**
|
|
@@ -1987,6 +1986,7 @@ export declare class WorkflowEngine {
|
|
|
1987
1986
|
cancel(runId: string, opts?: {
|
|
1988
1987
|
compensate?: boolean;
|
|
1989
1988
|
}): Promise<RunResult | null>;
|
|
1989
|
+
private cancelOnce;
|
|
1990
1990
|
/**
|
|
1991
1991
|
* Bulk-cancel every run matching a filter — e.g. cancel all `order` runs tagged `vip`, or every run
|
|
1992
1992
|
* whose `tier` search attribute is `free`. The filter is a {@link RunQuery} (workflow / status / tag
|
|
@@ -2390,14 +2390,19 @@ export declare class WorkflowEngine {
|
|
|
2390
2390
|
* record what already ran, and must never dispatch anything new. */
|
|
2391
2391
|
private applyCommands;
|
|
2392
2392
|
/**
|
|
2393
|
-
* Whether a compensating cancel is pending for this run, consuming the in-memory flag. The
|
|
2394
|
-
*
|
|
2395
|
-
*
|
|
2396
|
-
*
|
|
2397
|
-
*
|
|
2398
|
-
* `cancelled` is durably recorded.
|
|
2393
|
+
* Whether a compensating cancel is pending for this run, consuming the in-memory flag. The flag is
|
|
2394
|
+
* set by `cancel()` on this pod, and at turn start for a run that reads `cancelling` (the durable
|
|
2395
|
+
* intent: a cancel from another pod, or one re-driven by recovery). A cancel another pod persists
|
|
2396
|
+
* while this turn runs is found at the settle instead: the run no longer reads a settle-eligible
|
|
2397
|
+
* status, and {@link settleOrUnwind} unwinds it.
|
|
2399
2398
|
*/
|
|
2400
2399
|
private takeCancelIntent;
|
|
2400
|
+
/**
|
|
2401
|
+
* Settle this turn's `outcome` — unless a compensating cancel was persisted on another pod while the
|
|
2402
|
+
* turn ran: the settle's status check then reads `cancelling`, and this turn (which still holds the
|
|
2403
|
+
* lease and the saga it registered) undoes it and settles `cancelled` itself.
|
|
2404
|
+
*/
|
|
2405
|
+
private settleOrUnwind;
|
|
2401
2406
|
/**
|
|
2402
2407
|
* Undo the registered saga compensations in reverse and settle the run `cancelled`. Shared by EVERY
|
|
2403
2408
|
* exit of a turn with a compensating cancel pending — the body returned, suspended, hit
|