@adonis-agora/durable 0.1.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 +29 -0
- package/dist/assets/dashboard.html +446 -0
- package/dist/commands/main.d.ts +15 -0
- package/dist/commands/main.d.ts.map +1 -0
- package/dist/commands/main.js +15 -0
- package/dist/commands/main.js.map +1 -0
- package/dist/commands/retry.d.ts +16 -0
- package/dist/commands/retry.d.ts.map +1 -0
- package/dist/commands/retry.js +34 -0
- package/dist/commands/retry.js.map +1 -0
- package/dist/commands/runs.d.ts +17 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +40 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/work.d.ts +18 -0
- package/dist/commands/work.d.ts.map +1 -0
- package/dist/commands/work.js +58 -0
- package/dist/commands/work.js.map +1 -0
- package/dist/configure.d.ts +15 -0
- package/dist/configure.d.ts.map +1 -0
- package/dist/configure.js +26 -0
- package/dist/configure.js.map +1 -0
- package/dist/providers/dashboard_provider.d.ts +27 -0
- package/dist/providers/dashboard_provider.d.ts.map +1 -0
- package/dist/providers/dashboard_provider.js +94 -0
- package/dist/providers/dashboard_provider.js.map +1 -0
- package/dist/providers/durable_provider.d.ts +36 -0
- package/dist/providers/durable_provider.d.ts.map +1 -0
- package/dist/providers/durable_provider.js +113 -0
- package/dist/providers/durable_provider.js.map +1 -0
- package/dist/src/admission-redis/index.d.ts +2 -0
- package/dist/src/admission-redis/index.d.ts.map +1 -0
- package/dist/src/admission-redis/index.js +2 -0
- package/dist/src/admission-redis/index.js.map +1 -0
- package/dist/src/admission-redis/redis-admission-backend.d.ts +83 -0
- package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -0
- package/dist/src/admission-redis/redis-admission-backend.js +200 -0
- package/dist/src/admission-redis/redis-admission-backend.js.map +1 -0
- package/dist/src/admission.d.ts +49 -0
- package/dist/src/admission.d.ts.map +1 -0
- package/dist/src/admission.js +30 -0
- package/dist/src/admission.js.map +1 -0
- package/dist/src/backoff.d.ts +5 -0
- package/dist/src/backoff.d.ts.map +1 -0
- package/dist/src/backoff.js +11 -0
- package/dist/src/backoff.js.map +1 -0
- package/dist/src/checkpoints.d.ts +42 -0
- package/dist/src/checkpoints.d.ts.map +1 -0
- package/dist/src/checkpoints.js +57 -0
- package/dist/src/checkpoints.js.map +1 -0
- package/dist/src/codec-state-store.d.ts +60 -0
- package/dist/src/codec-state-store.d.ts.map +1 -0
- package/dist/src/codec-state-store.js +129 -0
- package/dist/src/codec-state-store.js.map +1 -0
- package/dist/src/commands/index.d.ts +3 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +3 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/runs.d.ts +24 -0
- package/dist/src/commands/runs.d.ts.map +1 -0
- package/dist/src/commands/runs.js +39 -0
- package/dist/src/commands/runs.js.map +1 -0
- package/dist/src/commands/worker.d.ts +61 -0
- package/dist/src/commands/worker.d.ts.map +1 -0
- package/dist/src/commands/worker.js +74 -0
- package/dist/src/commands/worker.js.map +1 -0
- package/dist/src/completion.d.ts +15 -0
- package/dist/src/completion.d.ts.map +1 -0
- package/dist/src/completion.js +10 -0
- package/dist/src/completion.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +48 -0
- package/dist/src/dashboard/define_config.d.ts.map +1 -0
- package/dist/src/dashboard/define_config.js +57 -0
- package/dist/src/dashboard/define_config.js.map +1 -0
- package/dist/src/dashboard/handlers.d.ts +47 -0
- package/dist/src/dashboard/handlers.d.ts.map +1 -0
- package/dist/src/dashboard/handlers.js +163 -0
- package/dist/src/dashboard/handlers.js.map +1 -0
- package/dist/src/dashboard/html.d.ts +7 -0
- package/dist/src/dashboard/html.d.ts.map +1 -0
- package/dist/src/dashboard/html.js +24 -0
- package/dist/src/dashboard/html.js.map +1 -0
- package/dist/src/dashboard/index.d.ts +8 -0
- package/dist/src/dashboard/index.d.ts.map +1 -0
- package/dist/src/dashboard/index.js +6 -0
- package/dist/src/dashboard/index.js.map +1 -0
- package/dist/src/define_config.d.ts +72 -0
- package/dist/src/define_config.d.ts.map +1 -0
- package/dist/src/define_config.js +8 -0
- package/dist/src/define_config.js.map +1 -0
- package/dist/src/diagnostics-bridge.d.ts +22 -0
- package/dist/src/diagnostics-bridge.d.ts.map +1 -0
- package/dist/src/diagnostics-bridge.js +25 -0
- package/dist/src/diagnostics-bridge.js.map +1 -0
- package/dist/src/duration.d.ts +6 -0
- package/dist/src/duration.d.ts.map +1 -0
- package/dist/src/duration.js +39 -0
- package/dist/src/duration.js.map +1 -0
- package/dist/src/engine.d.ts +583 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/engine.js +1894 -0
- package/dist/src/engine.js.map +1 -0
- package/dist/src/entities.d.ts +44 -0
- package/dist/src/entities.d.ts.map +1 -0
- package/dist/src/entities.js +64 -0
- package/dist/src/entities.js.map +1 -0
- package/dist/src/errors.d.ts +68 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +102 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/event-accumulators.d.ts +39 -0
- package/dist/src/event-accumulators.d.ts.map +1 -0
- package/dist/src/event-accumulators.js +70 -0
- package/dist/src/event-accumulators.js.map +1 -0
- package/dist/src/events.d.ts +9 -0
- package/dist/src/events.d.ts.map +1 -0
- package/dist/src/events.js +35 -0
- package/dist/src/events.js.map +1 -0
- package/dist/src/index.d.ts +36 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interfaces.d.ts +909 -0
- package/dist/src/interfaces.d.ts.map +1 -0
- package/dist/src/interfaces.js +2 -0
- package/dist/src/interfaces.js.map +1 -0
- package/dist/src/metrics.d.ts +44 -0
- package/dist/src/metrics.d.ts.map +1 -0
- package/dist/src/metrics.js +78 -0
- package/dist/src/metrics.js.map +1 -0
- package/dist/src/otel/durable-metrics.d.ts +42 -0
- package/dist/src/otel/durable-metrics.d.ts.map +1 -0
- package/dist/src/otel/durable-metrics.js +75 -0
- package/dist/src/otel/durable-metrics.js.map +1 -0
- package/dist/src/otel/durable-otel.d.ts +20 -0
- package/dist/src/otel/durable-otel.d.ts.map +1 -0
- package/dist/src/otel/durable-otel.js +74 -0
- package/dist/src/otel/durable-otel.js.map +1 -0
- package/dist/src/otel/index.d.ts +4 -0
- package/dist/src/otel/index.d.ts.map +1 -0
- package/dist/src/otel/index.js +4 -0
- package/dist/src/otel/index.js.map +1 -0
- package/dist/src/otel/traceparent.d.ts +17 -0
- package/dist/src/otel/traceparent.d.ts.map +1 -0
- package/dist/src/otel/traceparent.js +21 -0
- package/dist/src/otel/traceparent.js.map +1 -0
- package/dist/src/pollers.d.ts +33 -0
- package/dist/src/pollers.d.ts.map +1 -0
- package/dist/src/pollers.js +76 -0
- package/dist/src/pollers.js.map +1 -0
- package/dist/src/protocol.d.ts +17 -0
- package/dist/src/protocol.d.ts.map +1 -0
- package/dist/src/protocol.js +47 -0
- package/dist/src/protocol.js.map +1 -0
- package/dist/src/queue.d.ts +113 -0
- package/dist/src/queue.d.ts.map +1 -0
- package/dist/src/queue.js +128 -0
- package/dist/src/queue.js.map +1 -0
- package/dist/src/remote-step-factory.d.ts +15 -0
- package/dist/src/remote-step-factory.d.ts.map +1 -0
- package/dist/src/remote-step-factory.js +12 -0
- package/dist/src/remote-step-factory.js.map +1 -0
- package/dist/src/remote-workflow-executor.d.ts +24 -0
- package/dist/src/remote-workflow-executor.d.ts.map +1 -0
- package/dist/src/remote-workflow-executor.js +70 -0
- package/dist/src/remote-workflow-executor.js.map +1 -0
- package/dist/src/scheduler.d.ts +67 -0
- package/dist/src/scheduler.d.ts.map +1 -0
- package/dist/src/scheduler.js +111 -0
- package/dist/src/scheduler.js.map +1 -0
- package/dist/src/search-attributes.d.ts +48 -0
- package/dist/src/search-attributes.d.ts.map +1 -0
- package/dist/src/search-attributes.js +98 -0
- package/dist/src/search-attributes.js.map +1 -0
- package/dist/src/singleton-gate.d.ts +44 -0
- package/dist/src/singleton-gate.d.ts.map +1 -0
- package/dist/src/singleton-gate.js +90 -0
- package/dist/src/singleton-gate.js.map +1 -0
- package/dist/src/step-logger.d.ts +9 -0
- package/dist/src/step-logger.d.ts.map +1 -0
- package/dist/src/step-logger.js +89 -0
- package/dist/src/step-logger.js.map +1 -0
- package/dist/src/stores/factory.d.ts +42 -0
- package/dist/src/stores/factory.d.ts.map +1 -0
- package/dist/src/stores/factory.js +29 -0
- package/dist/src/stores/factory.js.map +1 -0
- package/dist/src/stores/lucid-helpers.d.ts +11 -0
- package/dist/src/stores/lucid-helpers.d.ts.map +1 -0
- package/dist/src/stores/lucid-helpers.js +38 -0
- package/dist/src/stores/lucid-helpers.js.map +1 -0
- package/dist/src/stores/lucid-mappers.d.ts +58 -0
- package/dist/src/stores/lucid-mappers.d.ts.map +1 -0
- package/dist/src/stores/lucid-mappers.js +174 -0
- package/dist/src/stores/lucid-mappers.js.map +1 -0
- package/dist/src/stores/lucid-schema.d.ts +28 -0
- package/dist/src/stores/lucid-schema.d.ts.map +1 -0
- package/dist/src/stores/lucid-schema.js +115 -0
- package/dist/src/stores/lucid-schema.js.map +1 -0
- package/dist/src/stores/lucid.d.ts +69 -0
- package/dist/src/stores/lucid.d.ts.map +1 -0
- package/dist/src/stores/lucid.js +342 -0
- package/dist/src/stores/lucid.js.map +1 -0
- package/dist/src/telescope/dashboard.d.ts +15 -0
- package/dist/src/telescope/dashboard.d.ts.map +1 -0
- package/dist/src/telescope/dashboard.js +113 -0
- package/dist/src/telescope/dashboard.js.map +1 -0
- package/dist/src/telescope/data-providers.d.ts +20 -0
- package/dist/src/telescope/data-providers.d.ts.map +1 -0
- package/dist/src/telescope/data-providers.js +322 -0
- package/dist/src/telescope/data-providers.js.map +1 -0
- package/dist/src/telescope/extension.d.ts +22 -0
- package/dist/src/telescope/extension.d.ts.map +1 -0
- package/dist/src/telescope/extension.js +38 -0
- package/dist/src/telescope/extension.js.map +1 -0
- package/dist/src/telescope/index.d.ts +5 -0
- package/dist/src/telescope/index.d.ts.map +1 -0
- package/dist/src/telescope/index.js +4 -0
- package/dist/src/telescope/index.js.map +1 -0
- package/dist/src/telescope/telescope-sdk.d.ts +123 -0
- package/dist/src/telescope/telescope-sdk.d.ts.map +1 -0
- package/dist/src/telescope/telescope-sdk.js +12 -0
- package/dist/src/telescope/telescope-sdk.js.map +1 -0
- package/dist/src/test-helpers.d.ts +11 -0
- package/dist/src/test-helpers.d.ts.map +1 -0
- package/dist/src/test-helpers.js +12 -0
- package/dist/src/test-helpers.js.map +1 -0
- package/dist/src/testing/in-memory-state-store.d.ts +64 -0
- package/dist/src/testing/in-memory-state-store.d.ts.map +1 -0
- package/dist/src/testing/in-memory-state-store.js +259 -0
- package/dist/src/testing/in-memory-state-store.js.map +1 -0
- package/dist/src/testing/in-memory-transport.d.ts +25 -0
- package/dist/src/testing/in-memory-transport.d.ts.map +1 -0
- package/dist/src/testing/in-memory-transport.js +49 -0
- package/dist/src/testing/in-memory-transport.js.map +1 -0
- package/dist/src/testing-kit/admission-backend-conformance.d.ts +18 -0
- package/dist/src/testing-kit/admission-backend-conformance.d.ts.map +1 -0
- package/dist/src/testing-kit/admission-backend-conformance.js +81 -0
- package/dist/src/testing-kit/admission-backend-conformance.js.map +1 -0
- package/dist/src/testing-kit/assertions.d.ts +10 -0
- package/dist/src/testing-kit/assertions.d.ts.map +1 -0
- package/dist/src/testing-kit/assertions.js +41 -0
- package/dist/src/testing-kit/assertions.js.map +1 -0
- package/dist/src/testing-kit/harness.d.ts +28 -0
- package/dist/src/testing-kit/harness.d.ts.map +1 -0
- package/dist/src/testing-kit/harness.js +42 -0
- package/dist/src/testing-kit/harness.js.map +1 -0
- package/dist/src/testing-kit/index.d.ts +8 -0
- package/dist/src/testing-kit/index.d.ts.map +1 -0
- package/dist/src/testing-kit/index.js +8 -0
- package/dist/src/testing-kit/index.js.map +1 -0
- package/dist/src/testing-kit/replay.d.ts +22 -0
- package/dist/src/testing-kit/replay.d.ts.map +1 -0
- package/dist/src/testing-kit/replay.js +38 -0
- package/dist/src/testing-kit/replay.js.map +1 -0
- package/dist/src/testing-kit/state-store-conformance.d.ts +51 -0
- package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -0
- package/dist/src/testing-kit/state-store-conformance.js +430 -0
- package/dist/src/testing-kit/state-store-conformance.js.map +1 -0
- package/dist/src/testing-kit/steps.d.ts +5 -0
- package/dist/src/testing-kit/steps.d.ts.map +1 -0
- package/dist/src/testing-kit/steps.js +15 -0
- package/dist/src/testing-kit/steps.js.map +1 -0
- package/dist/src/testing-kit/transport-conformance.d.ts +16 -0
- package/dist/src/testing-kit/transport-conformance.d.ts.map +1 -0
- package/dist/src/testing-kit/transport-conformance.js +64 -0
- package/dist/src/testing-kit/transport-conformance.js.map +1 -0
- package/dist/src/tokens.d.ts +18 -0
- package/dist/src/tokens.d.ts.map +1 -0
- package/dist/src/tokens.js +18 -0
- package/dist/src/tokens.js.map +1 -0
- package/dist/src/transport-pool.d.ts +30 -0
- package/dist/src/transport-pool.d.ts.map +1 -0
- package/dist/src/transport-pool.js +82 -0
- package/dist/src/transport-pool.js.map +1 -0
- package/dist/src/transports/db-helpers.d.ts +10 -0
- package/dist/src/transports/db-helpers.d.ts.map +1 -0
- package/dist/src/transports/db-helpers.js +33 -0
- package/dist/src/transports/db-helpers.js.map +1 -0
- package/dist/src/transports/db-schema.d.ts +28 -0
- package/dist/src/transports/db-schema.d.ts.map +1 -0
- package/dist/src/transports/db-schema.js +98 -0
- package/dist/src/transports/db-schema.js.map +1 -0
- package/dist/src/transports/db.d.ts +81 -0
- package/dist/src/transports/db.d.ts.map +1 -0
- package/dist/src/transports/db.js +340 -0
- package/dist/src/transports/db.js.map +1 -0
- package/dist/src/transports/factory.d.ts +79 -0
- package/dist/src/transports/factory.d.ts.map +1 -0
- package/dist/src/transports/factory.js +57 -0
- package/dist/src/transports/factory.js.map +1 -0
- package/dist/src/transports/queue-mock-adapter.d.ts +39 -0
- package/dist/src/transports/queue-mock-adapter.d.ts.map +1 -0
- package/dist/src/transports/queue-mock-adapter.js +86 -0
- package/dist/src/transports/queue-mock-adapter.js.map +1 -0
- package/dist/src/transports/queue.d.ts +84 -0
- package/dist/src/transports/queue.d.ts.map +1 -0
- package/dist/src/transports/queue.js +210 -0
- package/dist/src/transports/queue.js.map +1 -0
- package/dist/src/workflow-ctx.d.ts +64 -0
- package/dist/src/workflow-ctx.d.ts.map +1 -0
- package/dist/src/workflow-ctx.js +457 -0
- package/dist/src/workflow-ctx.js.map +1 -0
- package/dist/src/workflow-ref.d.ts +34 -0
- package/dist/src/workflow-ref.d.ts.map +1 -0
- package/dist/src/workflow-ref.js +28 -0
- package/dist/src/workflow-ref.js.map +1 -0
- package/dist/stubs/config/durable.stub +49 -0
- package/dist/stubs/config/durable_dashboard.stub +17 -0
- package/dist/stubs/database/migrations/create_durable_tables.stub +87 -0
- package/dist/stubs/database/migrations/create_durable_transport_tables.stub +75 -0
- package/dist/stubs/main.d.ts +3 -0
- package/dist/stubs/main.d.ts.map +1 -0
- package/dist/stubs/main.js +4 -0
- package/dist/stubs/main.js.map +1 -0
- package/package.json +154 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
/**
|
|
4
|
+
* The dashboard HTML, loaded once from the bundled asset. The build copies
|
|
5
|
+
* `assets/dashboard.html` into `dist/assets/`, so this resolves relative to the
|
|
6
|
+
* compiled `dist/src/dashboard/html.js`.
|
|
7
|
+
*/
|
|
8
|
+
let template;
|
|
9
|
+
function load() {
|
|
10
|
+
if (template === undefined) {
|
|
11
|
+
const assetUrl = new URL('../../assets/dashboard.html', import.meta.url);
|
|
12
|
+
template = readFileSync(fileURLToPath(assetUrl), 'utf8');
|
|
13
|
+
}
|
|
14
|
+
return template;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Render the dashboard HTML with the JSON API base path injected, so the
|
|
18
|
+
* single-page client knows where to fetch from regardless of the configured
|
|
19
|
+
* mount prefix.
|
|
20
|
+
*/
|
|
21
|
+
export function renderDashboard(apiBase) {
|
|
22
|
+
return load().replaceAll('__API_BASE__', apiBase);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/dashboard/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,IAAI,QAA4B,CAAC;AAEjC,SAAS,IAAI;IACX,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzE,QAAQ,GAAG,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,OAAO,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
+
export declare const VERSION = "0.1.0";
|
|
3
|
+
export { defineConfig, defaultAuthorize, resolveConfig } from './define_config.js';
|
|
4
|
+
export type { AuthorizeHook, DurableDashboardConfig, ResolvedDurableDashboardConfig, } from './define_config.js';
|
|
5
|
+
export { listRuns, getRun, retryRun, cancelRun, health, } from './handlers.js';
|
|
6
|
+
export type { ApiRequest, ApiResponse, Deps } from './handlers.js';
|
|
7
|
+
export { renderDashboard } from './html.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnF,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
+
export const VERSION = '0.1.0';
|
|
3
|
+
export { defineConfig, defaultAuthorize, resolveConfig } from './define_config.js';
|
|
4
|
+
export { listRuns, getRun, retryRun, cancelRun, health, } from './handlers.js';
|
|
5
|
+
export { renderDashboard } from './html.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMnF,OAAO,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ControlPlane, RunDispatcher } from './interfaces.js';
|
|
2
|
+
import type { ScheduledWorkflow } from './scheduler.js';
|
|
3
|
+
import { stores } from './stores/factory.js';
|
|
4
|
+
import type { LucidStoreConfig, StoreContext, StoreFactory } from './stores/factory.js';
|
|
5
|
+
import { transports } from './transports/factory.js';
|
|
6
|
+
import type { DbTransportConfig, MemoryTransportConfig, QueueTransportConfig, TransportContext, TransportFactory } from './transports/factory.js';
|
|
7
|
+
/**
|
|
8
|
+
* Shape of `config/durable.ts`. Everything is optional — by default the engine uses an in-process
|
|
9
|
+
* state store + transport (single-process, no extra infra). Pick a `transport`/`store` by name from
|
|
10
|
+
* the `transports`/`stores` maps to run cross-process or persist durably; build the entries with the
|
|
11
|
+
* {@link transports} / {@link stores} factories so each peer dependency (`@adonisjs/queue`,
|
|
12
|
+
* `@adonisjs/lucid`) is imported lazily, only when that driver is actually selected.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { defineConfig, transports, stores } from '@adonis-agora/durable'
|
|
16
|
+
* import { redis } from '@adonisjs/queue'
|
|
17
|
+
*
|
|
18
|
+
* export default defineConfig({
|
|
19
|
+
* transport: 'queue',
|
|
20
|
+
* transports: {
|
|
21
|
+
* memory: transports.memory(),
|
|
22
|
+
* queue: transports.queue({ adapter: redis({ host: '127.0.0.1' }), group: 'durable' }),
|
|
23
|
+
* db: transports.db({ connection: 'pg' }),
|
|
24
|
+
* },
|
|
25
|
+
* store: 'lucid',
|
|
26
|
+
* stores: {
|
|
27
|
+
* lucid: stores.lucid({ connection: 'pg' }),
|
|
28
|
+
* },
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface DurableConfig {
|
|
33
|
+
/**
|
|
34
|
+
* Name of the transport (a key of {@link transports}) the engine dispatches over. Omit for the
|
|
35
|
+
* in-process transport (single-process, no extra infra).
|
|
36
|
+
*/
|
|
37
|
+
transport?: string;
|
|
38
|
+
/** Named transports, built with the {@link transports} factory. */
|
|
39
|
+
transports?: Record<string, TransportFactory>;
|
|
40
|
+
/**
|
|
41
|
+
* Name of the state store (a key of {@link stores}) for runs/checkpoints/timers. Omit for the
|
|
42
|
+
* in-memory store (single-process).
|
|
43
|
+
*/
|
|
44
|
+
store?: string;
|
|
45
|
+
/** Named state stores, built with the {@link stores} factory. */
|
|
46
|
+
stores?: Record<string, StoreFactory>;
|
|
47
|
+
/** Cross-instance broadcast for lifecycle events + cancellation. Omit for single-instance. */
|
|
48
|
+
controlPlane?: ControlPlane;
|
|
49
|
+
/** Recovery lease duration in ms. Default 30s. */
|
|
50
|
+
leaseMs?: number;
|
|
51
|
+
/** Unique id for this engine instance. Defaults to a random id. */
|
|
52
|
+
instanceId?: string;
|
|
53
|
+
/** Cap crash-recovery pickups before dead-lettering a poison run. Omit for unlimited. */
|
|
54
|
+
maxRecoveryAttempts?: number;
|
|
55
|
+
/** Attempts per saga compensation on run failure. Default 1. */
|
|
56
|
+
compensationRetries?: number;
|
|
57
|
+
/** Where a freshly-started run executes. Defaults to in-process (microtask). */
|
|
58
|
+
runDispatcher?: RunDispatcher;
|
|
59
|
+
/**
|
|
60
|
+
* Recurring workflows to start on a schedule (fixed interval via `everyMs`, or cron via `cron` +
|
|
61
|
+
* `timezone`). The `durable:work` worker loop fires any due windows on every tick (the 5th phase,
|
|
62
|
+
* after timeouts are swept). `engine.start` is idempotent by each schedule's time-bucket run id, so
|
|
63
|
+
* racing worker instances start every window **exactly once**. Cron schedules need the optional
|
|
64
|
+
* `cron-parser` peer dependency. Omit (or leave empty) to register no schedules.
|
|
65
|
+
*/
|
|
66
|
+
schedules?: ScheduledWorkflow[];
|
|
67
|
+
}
|
|
68
|
+
/** Identity helper giving `config/durable.ts` full type-checking. */
|
|
69
|
+
export declare function defineConfig(config?: DurableConfig): DurableConfig;
|
|
70
|
+
export { transports, stores };
|
|
71
|
+
export type { TransportContext, TransportFactory, MemoryTransportConfig, QueueTransportConfig, DbTransportConfig, StoreContext, StoreFactory, LucidStoreConfig, };
|
|
72
|
+
//# sourceMappingURL=define_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,8FAA8F;IAC9F,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gFAAgF;IAChF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,MAAM,GAAE,aAAkB,GAAG,aAAa,CAEtE;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { stores } from './stores/factory.js';
|
|
2
|
+
import { transports } from './transports/factory.js';
|
|
3
|
+
/** Identity helper giving `config/durable.ts` full type-checking. */
|
|
4
|
+
export function defineConfig(config = {}) {
|
|
5
|
+
return config;
|
|
6
|
+
}
|
|
7
|
+
export { transports, stores };
|
|
8
|
+
//# sourceMappingURL=define_config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAuErD,qEAAqE;AACrE,MAAM,UAAU,YAAY,CAAC,SAAwB,EAAE;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EngineEvent } from './interfaces.js';
|
|
2
|
+
/** The minimal engine surface the bridge needs: a lifecycle-event subscription. */
|
|
3
|
+
export interface DurableEventSource {
|
|
4
|
+
subscribe(listener: (event: EngineEvent) => void): () => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Bridge every engine lifecycle event onto the `@adonis-agora/diagnostics` bus as `agora:durable:<type>`
|
|
8
|
+
* (e.g. `agora:durable:run.failed`); the whole {@link EngineEvent} is the payload. The emit
|
|
9
|
+
* capability is read STRUCTURALLY from its global slot per event — durable never imports or depends
|
|
10
|
+
* on `@adonis-agora/diagnostics`, and when diagnostics isn't installed the slot is empty and this is an
|
|
11
|
+
* inert subscription.
|
|
12
|
+
*
|
|
13
|
+
* One bridge lights up everything downstream of the diagnostics hub at once: `onDiagnostic('durable')`
|
|
14
|
+
* subscribers, the Telescope generic watcher (which auto-captures every channel), the cross-process
|
|
15
|
+
* relays, and the OTel bridge (each event recorded on the active span). `emit` short-circuits on
|
|
16
|
+
* `hasSubscribers`, so an unsubscribed channel costs nothing, and it never throws back into the
|
|
17
|
+
* engine. All event types are forwarded verbatim — filtering is the subscriber's job.
|
|
18
|
+
*
|
|
19
|
+
* @returns an unsubscribe function that detaches the bridge from the engine.
|
|
20
|
+
*/
|
|
21
|
+
export declare function attachDurableDiagnostics(engine: DurableEventSource): () => void;
|
|
22
|
+
//# sourceMappingURL=diagnostics-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics-bridge.d.ts","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC/D;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAK/E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The `@adonis-agora/diagnostics` emit capability, published on this slot at that package's module load. */
|
|
2
|
+
const EMIT_SLOT = Symbol.for('@agora/diagnostics:emit');
|
|
3
|
+
/**
|
|
4
|
+
* Bridge every engine lifecycle event onto the `@adonis-agora/diagnostics` bus as `agora:durable:<type>`
|
|
5
|
+
* (e.g. `agora:durable:run.failed`); the whole {@link EngineEvent} is the payload. The emit
|
|
6
|
+
* capability is read STRUCTURALLY from its global slot per event — durable never imports or depends
|
|
7
|
+
* on `@adonis-agora/diagnostics`, and when diagnostics isn't installed the slot is empty and this is an
|
|
8
|
+
* inert subscription.
|
|
9
|
+
*
|
|
10
|
+
* One bridge lights up everything downstream of the diagnostics hub at once: `onDiagnostic('durable')`
|
|
11
|
+
* subscribers, the Telescope generic watcher (which auto-captures every channel), the cross-process
|
|
12
|
+
* relays, and the OTel bridge (each event recorded on the active span). `emit` short-circuits on
|
|
13
|
+
* `hasSubscribers`, so an unsubscribed channel costs nothing, and it never throws back into the
|
|
14
|
+
* engine. All event types are forwarded verbatim — filtering is the subscriber's job.
|
|
15
|
+
*
|
|
16
|
+
* @returns an unsubscribe function that detaches the bridge from the engine.
|
|
17
|
+
*/
|
|
18
|
+
export function attachDurableDiagnostics(engine) {
|
|
19
|
+
return engine.subscribe((event) => {
|
|
20
|
+
const emit = globalThis[EMIT_SLOT];
|
|
21
|
+
if (typeof emit === 'function')
|
|
22
|
+
emit('durable', event.type, event);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=diagnostics-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics-bridge.js","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AAOA,6GAA6G;AAC7G,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAGxD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAA0B;IACjE,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,KAAkB,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAI,UAAsC,CAAC,SAAS,CAAuB,CAAC;QACtF,IAAI,OAAO,IAAI,KAAK,UAAU;YAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a human duration to milliseconds. Accepts a number (already ms) or a string like
|
|
3
|
+
* `'500ms'`, `'30s'`, `'15m'`, `'2h'`, `'7d'`, `'7 days'`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseDuration(duration: string | number): number;
|
|
6
|
+
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/duration.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAS/D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const UNIT_MS = {
|
|
2
|
+
ms: 1,
|
|
3
|
+
s: 1_000,
|
|
4
|
+
sec: 1_000,
|
|
5
|
+
second: 1_000,
|
|
6
|
+
seconds: 1_000,
|
|
7
|
+
m: 60_000,
|
|
8
|
+
min: 60_000,
|
|
9
|
+
minute: 60_000,
|
|
10
|
+
minutes: 60_000,
|
|
11
|
+
h: 3_600_000,
|
|
12
|
+
hr: 3_600_000,
|
|
13
|
+
hour: 3_600_000,
|
|
14
|
+
hours: 3_600_000,
|
|
15
|
+
d: 86_400_000,
|
|
16
|
+
day: 86_400_000,
|
|
17
|
+
days: 86_400_000,
|
|
18
|
+
w: 604_800_000,
|
|
19
|
+
week: 604_800_000,
|
|
20
|
+
weeks: 604_800_000,
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Parse a human duration to milliseconds. Accepts a number (already ms) or a string like
|
|
24
|
+
* `'500ms'`, `'30s'`, `'15m'`, `'2h'`, `'7d'`, `'7 days'`.
|
|
25
|
+
*/
|
|
26
|
+
export function parseDuration(duration) {
|
|
27
|
+
if (typeof duration === 'number')
|
|
28
|
+
return duration;
|
|
29
|
+
const match = duration.trim().match(/^(\d+(?:\.\d+)?)\s*([a-z]+)$/i);
|
|
30
|
+
if (!match)
|
|
31
|
+
throw new Error(`invalid duration: ${duration}`);
|
|
32
|
+
const value = Number(match[1]);
|
|
33
|
+
const unit = (match[2] ?? '').toLowerCase();
|
|
34
|
+
const factor = UNIT_MS[unit];
|
|
35
|
+
if (factor === undefined)
|
|
36
|
+
throw new Error(`unknown duration unit: ${unit}`);
|
|
37
|
+
return value * factor;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.js","sourceRoot":"","sources":["../../src/duration.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAA2B;IACtC,EAAE,EAAE,CAAC;IACL,CAAC,EAAE,KAAK;IACR,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,CAAC,EAAE,MAAM;IACT,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,CAAC,EAAE,SAAS;IACZ,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,CAAC,EAAE,UAAU;IACb,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,UAAU;IAChB,CAAC,EAAE,WAAW;IACd,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,QAAyB;IACrD,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACrE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IAC5E,OAAO,KAAK,GAAG,MAAM,CAAC;AACxB,CAAC"}
|