@temelj/workflow 0.0.0-alpha.1
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 +38 -0
- package/dist/attributes.d.mts +15 -0
- package/dist/attributes.mjs +30 -0
- package/dist/client/create.d.mts +31 -0
- package/dist/client/create.mjs +67 -0
- package/dist/client/facades.d.mts +21 -0
- package/dist/client/facades.mjs +142 -0
- package/dist/client/mod.d.mts +2 -0
- package/dist/client/mod.mjs +2 -0
- package/dist/client/run-handle.d.mts +66 -0
- package/dist/client/run-handle.mjs +156 -0
- package/dist/client/worker-options.d.mts +17 -0
- package/dist/client/worker-options.mjs +25 -0
- package/dist/collection.d.mts +15 -0
- package/dist/collection.mjs +33 -0
- package/dist/compiled-function.d.mts +27 -0
- package/dist/compiled-function.mjs +54 -0
- package/dist/definition.d.mts +37 -0
- package/dist/definition.mjs +83 -0
- package/dist/engine/child-workflow.d.mts +10 -0
- package/dist/engine/child-workflow.mjs +333 -0
- package/dist/engine/command-identity.d.mts +9 -0
- package/dist/engine/command-identity.mjs +14 -0
- package/dist/engine/create.d.mts +106 -0
- package/dist/engine/create.mjs +402 -0
- package/dist/engine/deterministic.d.mts +12 -0
- package/dist/engine/deterministic.mjs +102 -0
- package/dist/engine/durable-command.d.mts +10 -0
- package/dist/engine/durable-command.mjs +17 -0
- package/dist/engine/execution-api.d.mts +29 -0
- package/dist/engine/execution-api.mjs +33 -0
- package/dist/engine/execution-service.d.mts +41 -0
- package/dist/engine/execution-service.mjs +288 -0
- package/dist/engine/hooks.d.mts +56 -0
- package/dist/engine/hooks.mjs +237 -0
- package/dist/engine/inspection-api.d.mts +34 -0
- package/dist/engine/inspection-api.mjs +77 -0
- package/dist/engine/inspection.d.mts +18 -0
- package/dist/engine/inspection.mjs +149 -0
- package/dist/engine/lifecycle.d.mts +18 -0
- package/dist/engine/lifecycle.mjs +38 -0
- package/dist/engine/lock-replay.d.mts +30 -0
- package/dist/engine/lock-replay.mjs +38 -0
- package/dist/engine/lock.d.mts +21 -0
- package/dist/engine/lock.mjs +197 -0
- package/dist/engine/message.d.mts +47 -0
- package/dist/engine/message.mjs +357 -0
- package/dist/engine/mod.d.mts +4 -0
- package/dist/engine/mod.mjs +2 -0
- package/dist/engine/observation.d.mts +35 -0
- package/dist/engine/observation.mjs +201 -0
- package/dist/engine/recovery.d.mts +26 -0
- package/dist/engine/recovery.mjs +92 -0
- package/dist/engine/replay.d.mts +41 -0
- package/dist/engine/replay.mjs +122 -0
- package/dist/engine/retry-policy.d.mts +4 -0
- package/dist/engine/retry-policy.mjs +4 -0
- package/dist/engine/retry.d.mts +23 -0
- package/dist/engine/retry.mjs +75 -0
- package/dist/engine/run-data.d.mts +9 -0
- package/dist/engine/run-data.mjs +74 -0
- package/dist/engine/run-service.d.mts +38 -0
- package/dist/engine/run-service.mjs +133 -0
- package/dist/engine/run-utils.d.mts +16 -0
- package/dist/engine/run-utils.mjs +83 -0
- package/dist/engine/schedule.d.mts +25 -0
- package/dist/engine/schedule.mjs +207 -0
- package/dist/engine/serialization.d.mts +9 -0
- package/dist/engine/serialization.mjs +85 -0
- package/dist/engine/start-api.d.mts +30 -0
- package/dist/engine/start-api.mjs +98 -0
- package/dist/engine/state.d.mts +77 -0
- package/dist/engine/state.mjs +464 -0
- package/dist/engine/step-api.d.mts +9 -0
- package/dist/engine/step-api.mjs +25 -0
- package/dist/engine/stream.d.mts +55 -0
- package/dist/engine/stream.mjs +333 -0
- package/dist/engine/summary/active-events.d.mts +34 -0
- package/dist/engine/summary/active-events.mjs +69 -0
- package/dist/engine/summary/child-workflow-runs.d.mts +24 -0
- package/dist/engine/summary/child-workflow-runs.mjs +138 -0
- package/dist/engine/summary/child-workflow-waits.d.mts +21 -0
- package/dist/engine/summary/child-workflow-waits.mjs +67 -0
- package/dist/engine/summary/recovery-child-workflow-waits.d.mts +11 -0
- package/dist/engine/summary/recovery-child-workflow-waits.mjs +89 -0
- package/dist/engine/summary/recovery-due-runs.d.mts +16 -0
- package/dist/engine/summary/recovery-due-runs.mjs +52 -0
- package/dist/engine/summary/recovery-failed-runs.d.mts +14 -0
- package/dist/engine/summary/recovery-failed-runs.mjs +33 -0
- package/dist/engine/summary/recovery-lease-runs.d.mts +16 -0
- package/dist/engine/summary/recovery-lease-runs.mjs +69 -0
- package/dist/engine/summary/recovery-locks.d.mts +18 -0
- package/dist/engine/summary/recovery-locks.mjs +100 -0
- package/dist/engine/summary/recovery-message-waits.d.mts +11 -0
- package/dist/engine/summary/recovery-message-waits.mjs +74 -0
- package/dist/engine/summary/recovery-retry-runs.d.mts +17 -0
- package/dist/engine/summary/recovery-retry-runs.mjs +65 -0
- package/dist/engine/summary/recovery-run-timestamps.d.mts +13 -0
- package/dist/engine/summary/recovery-run-timestamps.mjs +18 -0
- package/dist/engine/summary/recovery-runs.d.mts +23 -0
- package/dist/engine/summary/recovery-runs.mjs +54 -0
- package/dist/engine/summary/recovery-schedules.d.mts +10 -0
- package/dist/engine/summary/recovery-schedules.mjs +46 -0
- package/dist/engine/summary/recovery-sleep-waits.d.mts +10 -0
- package/dist/engine/summary/recovery-sleep-waits.mjs +53 -0
- package/dist/engine/summary/recovery-waits.d.mts +21 -0
- package/dist/engine/summary/recovery-waits.mjs +29 -0
- package/dist/engine/summary/run-availability.d.mts +13 -0
- package/dist/engine/summary/run-availability.mjs +37 -0
- package/dist/engine/summary/run-cleanup.d.mts +14 -0
- package/dist/engine/summary/run-cleanup.mjs +44 -0
- package/dist/engine/summary/run-failure.d.mts +14 -0
- package/dist/engine/summary/run-failure.mjs +62 -0
- package/dist/engine/summary/run-hooks.d.mts +14 -0
- package/dist/engine/summary/run-hooks.mjs +63 -0
- package/dist/engine/summary/run-lease.d.mts +11 -0
- package/dist/engine/summary/run-lease.mjs +64 -0
- package/dist/engine/summary/run-message-waits.d.mts +15 -0
- package/dist/engine/summary/run-message-waits.mjs +62 -0
- package/dist/engine/summary/run-metrics.d.mts +31 -0
- package/dist/engine/summary/run-metrics.mjs +93 -0
- package/dist/engine/summary/run-retry.d.mts +9 -0
- package/dist/engine/summary/run-retry.mjs +69 -0
- package/dist/engine/summary/run-sleeps.d.mts +15 -0
- package/dist/engine/summary/run-sleeps.mjs +61 -0
- package/dist/engine/summary/run-state.d.mts +26 -0
- package/dist/engine/summary/run-state.mjs +48 -0
- package/dist/engine/summary/run-status.d.mts +16 -0
- package/dist/engine/summary/run-status.mjs +35 -0
- package/dist/engine/summary/run-streams.d.mts +14 -0
- package/dist/engine/summary/run-streams.mjs +46 -0
- package/dist/engine/summary/run-transition.d.mts +9 -0
- package/dist/engine/summary/run-transition.mjs +39 -0
- package/dist/engine/summary/run-workflow.d.mts +9 -0
- package/dist/engine/summary/run-workflow.mjs +47 -0
- package/dist/engine/summary/step-attempt-active-child-workflows.d.mts +13 -0
- package/dist/engine/summary/step-attempt-active-child-workflows.mjs +55 -0
- package/dist/engine/summary/step-attempt-active-fields.d.mts +23 -0
- package/dist/engine/summary/step-attempt-active-fields.mjs +14 -0
- package/dist/engine/summary/step-attempt-active-message-waits.d.mts +12 -0
- package/dist/engine/summary/step-attempt-active-message-waits.mjs +47 -0
- package/dist/engine/summary/step-attempt-active-sleeps.d.mts +19 -0
- package/dist/engine/summary/step-attempt-active-sleeps.mjs +44 -0
- package/dist/engine/summary/step-attempt-buckets.d.mts +22 -0
- package/dist/engine/summary/step-attempt-buckets.mjs +152 -0
- package/dist/engine/summary/step-attempt-failure.d.mts +12 -0
- package/dist/engine/summary/step-attempt-failure.mjs +61 -0
- package/dist/engine/summary/step-attempt-lifecycle.d.mts +13 -0
- package/dist/engine/summary/step-attempt-lifecycle.mjs +19 -0
- package/dist/engine/summary/step-attempts.d.mts +11 -0
- package/dist/engine/summary/step-attempts.mjs +43 -0
- package/dist/engine/summary.d.mts +32 -0
- package/dist/engine/summary.mjs +37 -0
- package/dist/engine/task.d.mts +6 -0
- package/dist/engine/task.mjs +207 -0
- package/dist/errors/base.d.mts +99 -0
- package/dist/errors/base.mjs +426 -0
- package/dist/errors/capability.d.mts +11 -0
- package/dist/errors/capability.mjs +23 -0
- package/dist/errors/definition.d.mts +21 -0
- package/dist/errors/definition.mjs +51 -0
- package/dist/errors/details.d.mts +13 -0
- package/dist/errors/details.mjs +65 -0
- package/dist/errors/failures.d.mts +81 -0
- package/dist/errors/failures.mjs +168 -0
- package/dist/errors/hook.d.mts +14 -0
- package/dist/errors/hook.mjs +30 -0
- package/dist/errors/implementation.d.mts +11 -0
- package/dist/errors/implementation.mjs +25 -0
- package/dist/errors/lock.d.mts +28 -0
- package/dist/errors/lock.mjs +70 -0
- package/dist/errors/message.d.mts +106 -0
- package/dist/errors/message.mjs +122 -0
- package/dist/errors/mod.d.mts +17 -0
- package/dist/errors/mod.mjs +17 -0
- package/dist/errors/record-view.d.mts +11 -0
- package/dist/errors/record-view.mjs +24 -0
- package/dist/errors/records.d.mts +7 -0
- package/dist/errors/records.mjs +280 -0
- package/dist/errors/run.d.mts +116 -0
- package/dist/errors/run.mjs +232 -0
- package/dist/errors/runtime.d.mts +12 -0
- package/dist/errors/runtime.mjs +24 -0
- package/dist/errors/schedule.d.mts +27 -0
- package/dist/errors/schedule.mjs +65 -0
- package/dist/errors/step.d.mts +76 -0
- package/dist/errors/step.mjs +113 -0
- package/dist/errors/stream.d.mts +24 -0
- package/dist/errors/stream.mjs +64 -0
- package/dist/esbuild.d.mts +7 -0
- package/dist/esbuild.mjs +6 -0
- package/dist/events/descriptors.d.mts +245 -0
- package/dist/events/descriptors.mjs +405 -0
- package/dist/events/mod.d.mts +3 -0
- package/dist/events/mod.mjs +2 -0
- package/dist/history/attempt-key.d.mts +6 -0
- package/dist/history/attempt-key.mjs +7 -0
- package/dist/history/mod.d.mts +71 -0
- package/dist/history/mod.mjs +195 -0
- package/dist/history/projection.d.mts +8 -0
- package/dist/history/projection.mjs +259 -0
- package/dist/history/replay-projection.d.mts +88 -0
- package/dist/history/replay-projection.mjs +369 -0
- package/dist/history/sequencer.d.mts +16 -0
- package/dist/history/sequencer.mjs +78 -0
- package/dist/history/step-attempts.d.mts +9 -0
- package/dist/history/step-attempts.mjs +50 -0
- package/dist/history/timeline.d.mts +16 -0
- package/dist/history/timeline.mjs +272 -0
- package/dist/history/validator.d.mts +9 -0
- package/dist/history/validator.mjs +110 -0
- package/dist/inspection/mod.d.mts +5 -0
- package/dist/inspection/mod.mjs +3 -0
- package/dist/message-options.d.mts +8 -0
- package/dist/message-options.mjs +25 -0
- package/dist/mod.d.mts +52 -0
- package/dist/mod.mjs +26 -0
- package/dist/otel/support.d.mts +18 -0
- package/dist/otel/support.mjs +102 -0
- package/dist/otel.d.mts +30 -0
- package/dist/otel.mjs +588 -0
- package/dist/pagination.d.mts +25 -0
- package/dist/pagination.mjs +73 -0
- package/dist/registry.d.mts +20 -0
- package/dist/registry.mjs +48 -0
- package/dist/rolldown.d.mts +7 -0
- package/dist/rolldown.mjs +6 -0
- package/dist/rollup.d.mts +7 -0
- package/dist/rollup.mjs +6 -0
- package/dist/rspack.d.mts +7 -0
- package/dist/rspack.mjs +6 -0
- package/dist/runtime.d.mts +34 -0
- package/dist/runtime.mjs +194 -0
- package/dist/step-definition.d.mts +10 -0
- package/dist/step-definition.mjs +15 -0
- package/dist/store/append-projection.d.mts +15 -0
- package/dist/store/append-projection.mjs +26 -0
- package/dist/store/capabilities.d.mts +14 -0
- package/dist/store/capabilities.mjs +42 -0
- package/dist/store/cleanup.d.mts +18 -0
- package/dist/store/cleanup.mjs +338 -0
- package/dist/store/compaction.d.mts +5 -0
- package/dist/store/compaction.mjs +8 -0
- package/dist/store/create.d.mts +52 -0
- package/dist/store/create.mjs +159 -0
- package/dist/store/event-append-project.d.mts +15 -0
- package/dist/store/event-append-project.mjs +77 -0
- package/dist/store/event-append.d.mts +37 -0
- package/dist/store/event-append.mjs +80 -0
- package/dist/store/event-history.d.mts +22 -0
- package/dist/store/event-history.mjs +75 -0
- package/dist/store/event.d.mts +10 -0
- package/dist/store/event.mjs +28 -0
- package/dist/store/idempotency.d.mts +10 -0
- package/dist/store/idempotency.mjs +167 -0
- package/dist/store/instrumentation.d.mts +7 -0
- package/dist/store/instrumentation.mjs +123 -0
- package/dist/store/lock.d.mts +8 -0
- package/dist/store/lock.mjs +28 -0
- package/dist/store/materialization.d.mts +30 -0
- package/dist/store/materialization.mjs +127 -0
- package/dist/store/message-index.d.mts +21 -0
- package/dist/store/message-index.mjs +121 -0
- package/dist/store/mod.d.mts +5 -0
- package/dist/store/mod.mjs +4 -0
- package/dist/store/query.d.mts +24 -0
- package/dist/store/query.mjs +82 -0
- package/dist/store/revision.d.mts +4 -0
- package/dist/store/revision.mjs +7 -0
- package/dist/store/run.d.mts +49 -0
- package/dist/store/run.mjs +236 -0
- package/dist/store/schedule.d.mts +12 -0
- package/dist/store/schedule.mjs +41 -0
- package/dist/store/schema.d.mts +14 -0
- package/dist/store/schema.mjs +17 -0
- package/dist/store/step-attempt.d.mts +14 -0
- package/dist/store/step-attempt.mjs +23 -0
- package/dist/store/storage-value.d.mts +5 -0
- package/dist/store/storage-value.mjs +6 -0
- package/dist/store/validation.d.mts +35 -0
- package/dist/store/validation.mjs +77 -0
- package/dist/store-keys.d.mts +49 -0
- package/dist/store-keys.mjs +63 -0
- package/dist/telemetry.d.mts +132 -0
- package/dist/telemetry.mjs +172 -0
- package/dist/temporal.d.mts +23 -0
- package/dist/temporal.mjs +59 -0
- package/dist/timer.d.mts +12 -0
- package/dist/timer.mjs +28 -0
- package/dist/types/cleanup.d.mts +112 -0
- package/dist/types/cleanup.mjs +22 -0
- package/dist/types/client.d.mts +270 -0
- package/dist/types/client.mjs +1 -0
- package/dist/types/common.d.mts +19 -0
- package/dist/types/common.mjs +15 -0
- package/dist/types/definition.d.mts +92 -0
- package/dist/types/definition.mjs +1 -0
- package/dist/types/engine-options.d.mts +76 -0
- package/dist/types/engine-options.mjs +1 -0
- package/dist/types/engine.d.mts +309 -0
- package/dist/types/engine.mjs +1 -0
- package/dist/types/error-code.d.mts +256 -0
- package/dist/types/error-code.mjs +131 -0
- package/dist/types/error.d.mts +236 -0
- package/dist/types/error.mjs +48 -0
- package/dist/types/events.d.mts +2869 -0
- package/dist/types/events.mjs +283 -0
- package/dist/types/hook.d.mts +149 -0
- package/dist/types/hook.mjs +66 -0
- package/dist/types/lock.d.mts +63 -0
- package/dist/types/lock.mjs +18 -0
- package/dist/types/message-id.d.mts +7 -0
- package/dist/types/message-id.mjs +5 -0
- package/dist/types/message.d.mts +87 -0
- package/dist/types/message.mjs +1 -0
- package/dist/types/observation.d.mts +146 -0
- package/dist/types/observation.mjs +1 -0
- package/dist/types/pagination.d.mts +32 -0
- package/dist/types/pagination.mjs +13 -0
- package/dist/types/result.d.mts +62 -0
- package/dist/types/result.mjs +1 -0
- package/dist/types/retry.d.mts +48 -0
- package/dist/types/retry.mjs +1 -0
- package/dist/types/run-id.d.mts +7 -0
- package/dist/types/run-id.mjs +5 -0
- package/dist/types/run-list.d.mts +43 -0
- package/dist/types/run-list.mjs +1 -0
- package/dist/types/run-options.d.mts +86 -0
- package/dist/types/run-options.mjs +1 -0
- package/dist/types/run.d.mts +355 -0
- package/dist/types/run.mjs +207 -0
- package/dist/types/runtime.d.mts +143 -0
- package/dist/types/runtime.mjs +21 -0
- package/dist/types/schedule.d.mts +127 -0
- package/dist/types/schedule.mjs +48 -0
- package/dist/types/step-attempts.d.mts +326 -0
- package/dist/types/step-attempts.mjs +43 -0
- package/dist/types/step-id.d.mts +7 -0
- package/dist/types/step-id.mjs +5 -0
- package/dist/types/step.d.mts +183 -0
- package/dist/types/step.mjs +5 -0
- package/dist/types/store.d.mts +254 -0
- package/dist/types/store.mjs +1 -0
- package/dist/types/stream-id.d.mts +7 -0
- package/dist/types/stream-id.mjs +5 -0
- package/dist/types/stream.d.mts +126 -0
- package/dist/types/stream.mjs +1 -0
- package/dist/types/summary.d.mts +318 -0
- package/dist/types/summary.mjs +1 -0
- package/dist/types/telemetry.d.mts +74 -0
- package/dist/types/telemetry.mjs +9 -0
- package/dist/types/timeline.d.mts +237 -0
- package/dist/types/timeline.mjs +1 -0
- package/dist/types/vite.d.mts +65 -0
- package/dist/types/vite.mjs +1 -0
- package/dist/types/worker-id.d.mts +7 -0
- package/dist/types/worker-id.mjs +5 -0
- package/dist/types/worker.d.mts +94 -0
- package/dist/types/worker.mjs +1 -0
- package/dist/utility.d.mts +49 -0
- package/dist/utility.mjs +122 -0
- package/dist/vite/ast.d.mts +23 -0
- package/dist/vite/ast.mjs +73 -0
- package/dist/vite/error.d.mts +19 -0
- package/dist/vite/error.mjs +47 -0
- package/dist/vite/generated-name.d.mts +7 -0
- package/dist/vite/generated-name.mjs +9 -0
- package/dist/vite/manifest.d.mts +7 -0
- package/dist/vite/manifest.mjs +106 -0
- package/dist/vite/plugin.d.mts +7 -0
- package/dist/vite/plugin.mjs +190 -0
- package/dist/vite/safety.d.mts +12 -0
- package/dist/vite/safety.mjs +96 -0
- package/dist/vite/source-edit.d.mts +12 -0
- package/dist/vite/source-edit.mjs +44 -0
- package/dist/vite/source-map.d.mts +11 -0
- package/dist/vite/source-map.mjs +53 -0
- package/dist/vite/source.d.mts +7 -0
- package/dist/vite/source.mjs +14 -0
- package/dist/vite/transform.d.mts +7 -0
- package/dist/vite/transform.mjs +405 -0
- package/dist/vite.d.mts +6 -0
- package/dist/vite.mjs +5 -0
- package/dist/webhook.d.mts +16 -0
- package/dist/webhook.mjs +17 -0
- package/dist/webpack.d.mts +7 -0
- package/dist/webpack.mjs +6 -0
- package/dist/worker/error.d.mts +11 -0
- package/dist/worker/error.mjs +40 -0
- package/dist/worker.d.mts +18 -0
- package/dist/worker.mjs +427 -0
- package/package.json +144 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { RunId } from "./run-id.mjs";
|
|
2
|
+
import { StepId } from "./step-id.mjs";
|
|
3
|
+
import { ScheduleId } from "./schedule.mjs";
|
|
4
|
+
import { WorkflowListRunsOptions } from "./run-list.mjs";
|
|
5
|
+
import { WorkflowRunRetryReason, WorkflowRunStatus, WorkflowRunTransitionReason, WorkflowTerminalRunStatus } from "./run.mjs";
|
|
6
|
+
//#region src/types/summary.d.ts
|
|
7
|
+
type WorkflowSummaryIdArray = readonly string[];
|
|
8
|
+
/** Options for workflow run summary. */
|
|
9
|
+
type WorkflowRunSummaryOptions = WorkflowListRunsOptions;
|
|
10
|
+
/** Options for workflow recovery summary. */
|
|
11
|
+
type WorkflowRecoverySummaryOptions = WorkflowListRunsOptions;
|
|
12
|
+
/** Counts grouped by run status. */
|
|
13
|
+
type WorkflowRunStatusCounts = Readonly<Record<WorkflowRunStatus, number>>;
|
|
14
|
+
/** Run IDs grouped by run status. */
|
|
15
|
+
type WorkflowRunStatusRunIds = Readonly<Record<WorkflowRunStatus, WorkflowSummaryIdArray>>;
|
|
16
|
+
/** Counts grouped by run transition reason. */
|
|
17
|
+
type WorkflowRunTransitionReasonCounts = Readonly<Record<WorkflowRunTransitionReason, number>>;
|
|
18
|
+
/** Run IDs grouped by run transition reason. */
|
|
19
|
+
type WorkflowRunTransitionReasonRunIds = Readonly<Record<WorkflowRunTransitionReason, WorkflowSummaryIdArray>>;
|
|
20
|
+
/** Counts grouped by run retry reason. */
|
|
21
|
+
type WorkflowRunRetryReasonCounts = Readonly<Record<WorkflowRunRetryReason, number>>;
|
|
22
|
+
/** Counts grouped by terminal run status. */
|
|
23
|
+
type WorkflowTerminalRunStatusCounts = Readonly<Record<WorkflowTerminalRunStatus, number>>;
|
|
24
|
+
/** Run IDs grouped by terminal run status. */
|
|
25
|
+
type WorkflowTerminalRunStatusRunIds = Readonly<Record<WorkflowTerminalRunStatus, WorkflowSummaryIdArray>>;
|
|
26
|
+
/** Summary data for workflow recovery due. */
|
|
27
|
+
interface WorkflowRecoveryDueSummary {
|
|
28
|
+
readonly total: number;
|
|
29
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
30
|
+
readonly pendingRunIds: WorkflowSummaryIdArray;
|
|
31
|
+
readonly waitingRunIds: WorkflowSummaryIdArray;
|
|
32
|
+
readonly invalidScheduleRunIds: WorkflowSummaryIdArray;
|
|
33
|
+
readonly nextAvailableAt?: Temporal.Instant;
|
|
34
|
+
readonly nextAvailableRunId?: RunId;
|
|
35
|
+
}
|
|
36
|
+
/** Summary data for workflow recovery lease. */
|
|
37
|
+
interface WorkflowRecoveryLeaseSummary {
|
|
38
|
+
readonly total: number;
|
|
39
|
+
readonly stale: number;
|
|
40
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
41
|
+
readonly staleRunIds: WorkflowSummaryIdArray;
|
|
42
|
+
readonly ownerlessRunIds: WorkflowSummaryIdArray;
|
|
43
|
+
readonly missingExpiresAtRunIds: WorkflowSummaryIdArray;
|
|
44
|
+
readonly invalidExpiresAtRunIds: WorkflowSummaryIdArray;
|
|
45
|
+
readonly expiredRunIds: WorkflowSummaryIdArray;
|
|
46
|
+
readonly workerIds: WorkflowSummaryIdArray;
|
|
47
|
+
readonly nextExpiresAt?: Temporal.Instant;
|
|
48
|
+
readonly nextExpiringRunId?: RunId;
|
|
49
|
+
readonly oldestStaleAt?: Temporal.Instant;
|
|
50
|
+
}
|
|
51
|
+
/** Summary data for workflow recovery retry. */
|
|
52
|
+
interface WorkflowRecoveryRetrySummary {
|
|
53
|
+
readonly total: number;
|
|
54
|
+
readonly due: number;
|
|
55
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
56
|
+
readonly dueRunIds: WorkflowSummaryIdArray;
|
|
57
|
+
readonly nextRetryAt?: Temporal.Instant;
|
|
58
|
+
readonly nextRetryRunId?: RunId;
|
|
59
|
+
}
|
|
60
|
+
/** Summary data for workflow recovery missing implementation. */
|
|
61
|
+
type WorkflowRecoveryMissingImplementationSummary = WorkflowRecoveryRetrySummary;
|
|
62
|
+
/** Summary data for workflow recovery failed. */
|
|
63
|
+
interface WorkflowRecoveryFailedSummary {
|
|
64
|
+
readonly total: number;
|
|
65
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
66
|
+
readonly latestFailedAt?: Temporal.Instant;
|
|
67
|
+
}
|
|
68
|
+
/** Summary data for workflow recovery schedule. */
|
|
69
|
+
interface WorkflowRecoveryScheduleSummary {
|
|
70
|
+
readonly total: number;
|
|
71
|
+
readonly due: number;
|
|
72
|
+
readonly scheduleIds: WorkflowSummaryIdArray;
|
|
73
|
+
readonly dueScheduleIds: WorkflowSummaryIdArray;
|
|
74
|
+
readonly invalidNextFireScheduleIds: WorkflowSummaryIdArray;
|
|
75
|
+
readonly nextFireAt?: Temporal.Instant;
|
|
76
|
+
readonly nextFireScheduleId?: ScheduleId;
|
|
77
|
+
}
|
|
78
|
+
/** Summary data for workflow recovery lock. */
|
|
79
|
+
interface WorkflowRecoveryLockSummary {
|
|
80
|
+
readonly total: number;
|
|
81
|
+
readonly stale: number;
|
|
82
|
+
readonly keys: WorkflowSummaryIdArray;
|
|
83
|
+
readonly staleKeys: WorkflowSummaryIdArray;
|
|
84
|
+
readonly holderIds: WorkflowSummaryIdArray;
|
|
85
|
+
readonly waitingRunIds: WorkflowSummaryIdArray;
|
|
86
|
+
readonly dueWaitingRunIds: WorkflowSummaryIdArray;
|
|
87
|
+
readonly waitingStepIds: WorkflowSummaryIdArray;
|
|
88
|
+
readonly waitingKeys: WorkflowSummaryIdArray;
|
|
89
|
+
readonly nextExpiresAt?: Temporal.Instant;
|
|
90
|
+
readonly nextExpiringKey?: string;
|
|
91
|
+
readonly oldestStaleAt?: Temporal.Instant;
|
|
92
|
+
readonly nextWaitDeadlineAt?: Temporal.Instant;
|
|
93
|
+
readonly nextWaitDeadlineRunId?: RunId;
|
|
94
|
+
}
|
|
95
|
+
/** Summary data for workflow recovery sleep wait. */
|
|
96
|
+
interface WorkflowRecoverySleepWaitSummary {
|
|
97
|
+
readonly active: number;
|
|
98
|
+
readonly due: number;
|
|
99
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
100
|
+
readonly dueRunIds: WorkflowSummaryIdArray;
|
|
101
|
+
readonly dueStepIds: WorkflowSummaryIdArray;
|
|
102
|
+
readonly invalidUntilRunIds: WorkflowSummaryIdArray;
|
|
103
|
+
readonly nextWakeAt?: Temporal.Instant;
|
|
104
|
+
readonly nextWakeRunId?: RunId;
|
|
105
|
+
}
|
|
106
|
+
/** Summary data for workflow recovery message wait. */
|
|
107
|
+
interface WorkflowRecoveryMessageWaitSummary {
|
|
108
|
+
readonly active: number;
|
|
109
|
+
readonly ready: number;
|
|
110
|
+
readonly timedOut: number;
|
|
111
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
112
|
+
readonly readyRunIds: WorkflowSummaryIdArray;
|
|
113
|
+
readonly timedOutRunIds: WorkflowSummaryIdArray;
|
|
114
|
+
readonly readyStepIds: WorkflowSummaryIdArray;
|
|
115
|
+
readonly timedOutStepIds: WorkflowSummaryIdArray;
|
|
116
|
+
readonly messages: WorkflowSummaryIdArray;
|
|
117
|
+
readonly nextTimeoutAt?: Temporal.Instant;
|
|
118
|
+
readonly nextTimeoutRunId?: RunId;
|
|
119
|
+
}
|
|
120
|
+
/** Summary data for workflow recovery child workflow wait. */
|
|
121
|
+
interface WorkflowRecoveryChildWorkflowWaitSummary {
|
|
122
|
+
readonly active: number;
|
|
123
|
+
readonly terminal: number;
|
|
124
|
+
readonly missing: number;
|
|
125
|
+
readonly timedOut: number;
|
|
126
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
127
|
+
readonly terminalRunIds: WorkflowSummaryIdArray;
|
|
128
|
+
readonly missingRunIds: WorkflowSummaryIdArray;
|
|
129
|
+
readonly timedOutRunIds: WorkflowSummaryIdArray;
|
|
130
|
+
readonly terminalStepIds: WorkflowSummaryIdArray;
|
|
131
|
+
readonly missingStepIds: WorkflowSummaryIdArray;
|
|
132
|
+
readonly timedOutStepIds: WorkflowSummaryIdArray;
|
|
133
|
+
readonly childRunIds: WorkflowSummaryIdArray;
|
|
134
|
+
readonly completedChildRunIds: WorkflowSummaryIdArray;
|
|
135
|
+
readonly failedChildRunIds: WorkflowSummaryIdArray;
|
|
136
|
+
readonly canceledChildRunIds: WorkflowSummaryIdArray;
|
|
137
|
+
readonly nextTimeoutAt?: Temporal.Instant;
|
|
138
|
+
readonly nextTimeoutRunId?: RunId;
|
|
139
|
+
}
|
|
140
|
+
/** Summary data for workflow recovery wait. */
|
|
141
|
+
interface WorkflowRecoveryWaitSummary {
|
|
142
|
+
readonly sleep: WorkflowRecoverySleepWaitSummary;
|
|
143
|
+
readonly message: WorkflowRecoveryMessageWaitSummary;
|
|
144
|
+
readonly childWorkflow: WorkflowRecoveryChildWorkflowWaitSummary;
|
|
145
|
+
}
|
|
146
|
+
/** Summary data for workflow recovery. */
|
|
147
|
+
interface WorkflowRecoverySummary {
|
|
148
|
+
readonly total: number;
|
|
149
|
+
readonly recoverableRunIds: WorkflowSummaryIdArray;
|
|
150
|
+
readonly due: WorkflowRecoveryDueSummary;
|
|
151
|
+
readonly lease: WorkflowRecoveryLeaseSummary;
|
|
152
|
+
readonly retry: WorkflowRecoveryRetrySummary;
|
|
153
|
+
readonly missingImplementation: WorkflowRecoveryMissingImplementationSummary;
|
|
154
|
+
readonly failed: WorkflowRecoveryFailedSummary;
|
|
155
|
+
readonly schedule: WorkflowRecoveryScheduleSummary;
|
|
156
|
+
readonly lock: WorkflowRecoveryLockSummary;
|
|
157
|
+
readonly wait: WorkflowRecoveryWaitSummary;
|
|
158
|
+
readonly nextRecoveryAt?: Temporal.Instant;
|
|
159
|
+
}
|
|
160
|
+
/** Describes the workflow run workflow count contract. */
|
|
161
|
+
interface WorkflowRunWorkflowCount {
|
|
162
|
+
readonly name: string;
|
|
163
|
+
readonly version?: string;
|
|
164
|
+
readonly count: number;
|
|
165
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
166
|
+
}
|
|
167
|
+
/** Summary data for workflow run workflow. */
|
|
168
|
+
interface WorkflowRunWorkflowSummary {
|
|
169
|
+
readonly total: number;
|
|
170
|
+
readonly workflows: readonly WorkflowRunWorkflowCount[];
|
|
171
|
+
}
|
|
172
|
+
/** Summary data for workflow run transition. */
|
|
173
|
+
interface WorkflowRunTransitionSummary {
|
|
174
|
+
readonly latestTransitionAt?: Temporal.Instant;
|
|
175
|
+
readonly reason: WorkflowRunTransitionReasonCounts;
|
|
176
|
+
readonly runIds: WorkflowRunTransitionReasonRunIds;
|
|
177
|
+
}
|
|
178
|
+
/** Summary data for workflow run retry. */
|
|
179
|
+
interface WorkflowRunRetrySummary {
|
|
180
|
+
readonly total: number;
|
|
181
|
+
readonly retryRunIds: WorkflowSummaryIdArray;
|
|
182
|
+
readonly retryStepIds: WorkflowSummaryIdArray;
|
|
183
|
+
readonly retryStepNames: WorkflowSummaryIdArray;
|
|
184
|
+
readonly nextRetryAt?: Temporal.Instant;
|
|
185
|
+
readonly nextRetryRunId?: RunId;
|
|
186
|
+
readonly highestAttempt?: number;
|
|
187
|
+
readonly reason: WorkflowRunRetryReasonCounts;
|
|
188
|
+
}
|
|
189
|
+
/** Summary data for workflow run failure error. */
|
|
190
|
+
interface WorkflowRunFailureErrorSummary {
|
|
191
|
+
readonly name: string;
|
|
192
|
+
readonly count: number;
|
|
193
|
+
readonly failedRunIds: WorkflowSummaryIdArray;
|
|
194
|
+
readonly latestFailedAt?: Temporal.Instant;
|
|
195
|
+
}
|
|
196
|
+
/** Summary data for workflow run failure. */
|
|
197
|
+
interface WorkflowRunFailureSummary {
|
|
198
|
+
readonly total: number;
|
|
199
|
+
readonly failedRunIds: WorkflowSummaryIdArray;
|
|
200
|
+
readonly errors: readonly WorkflowRunFailureErrorSummary[];
|
|
201
|
+
readonly latestFailedAt?: Temporal.Instant;
|
|
202
|
+
}
|
|
203
|
+
/** Summary data for workflow run lease. */
|
|
204
|
+
interface WorkflowRunLeaseSummary {
|
|
205
|
+
readonly total: number;
|
|
206
|
+
readonly expired: number;
|
|
207
|
+
readonly runIds: WorkflowSummaryIdArray;
|
|
208
|
+
readonly expiredRunIds: WorkflowSummaryIdArray;
|
|
209
|
+
readonly workerIds: WorkflowSummaryIdArray;
|
|
210
|
+
readonly nextExpiresAt?: Temporal.Instant;
|
|
211
|
+
readonly nextExpiringRunId?: RunId;
|
|
212
|
+
readonly oldestExpiredAt?: Temporal.Instant;
|
|
213
|
+
}
|
|
214
|
+
/** Summary data for workflow run cleanup. */
|
|
215
|
+
interface WorkflowRunCleanupSummary {
|
|
216
|
+
readonly eligibleRuns: number;
|
|
217
|
+
readonly status: WorkflowTerminalRunStatusCounts;
|
|
218
|
+
readonly statusRunIds: WorkflowTerminalRunStatusRunIds;
|
|
219
|
+
readonly oldestFinishedAt?: Temporal.Instant;
|
|
220
|
+
readonly newestFinishedAt?: Temporal.Instant;
|
|
221
|
+
}
|
|
222
|
+
/** Summary data for workflow run stream. */
|
|
223
|
+
interface WorkflowRunStreamSummary {
|
|
224
|
+
readonly activeStreams: number;
|
|
225
|
+
readonly activeStreamRuns: number;
|
|
226
|
+
readonly streamRunIds: WorkflowSummaryIdArray;
|
|
227
|
+
readonly streamStepIds: WorkflowSummaryIdArray;
|
|
228
|
+
readonly streamIds: WorkflowSummaryIdArray;
|
|
229
|
+
readonly streamNames: WorkflowSummaryIdArray;
|
|
230
|
+
readonly chunkCount: number;
|
|
231
|
+
readonly oldestStartedAt?: Temporal.Instant;
|
|
232
|
+
}
|
|
233
|
+
/** Summary data for workflow run hook. */
|
|
234
|
+
interface WorkflowRunHookSummary {
|
|
235
|
+
readonly activeHooks: number;
|
|
236
|
+
readonly activeWebhooks: number;
|
|
237
|
+
readonly activeHookRuns: number;
|
|
238
|
+
readonly hookRunIds: WorkflowSummaryIdArray;
|
|
239
|
+
readonly hookStepIds: WorkflowSummaryIdArray;
|
|
240
|
+
readonly hookNames: WorkflowSummaryIdArray;
|
|
241
|
+
readonly webhookNames: WorkflowSummaryIdArray;
|
|
242
|
+
readonly messages: WorkflowSummaryIdArray;
|
|
243
|
+
readonly oldestStartedAt?: Temporal.Instant;
|
|
244
|
+
readonly nextTimeoutAt?: Temporal.Instant;
|
|
245
|
+
readonly nextTimeoutRunId?: RunId;
|
|
246
|
+
readonly nextTimeoutStepId?: StepId;
|
|
247
|
+
}
|
|
248
|
+
/** Summary data for workflow run sleep. */
|
|
249
|
+
interface WorkflowRunSleepSummary {
|
|
250
|
+
readonly activeSleeps: number;
|
|
251
|
+
readonly activeSleepRuns: number;
|
|
252
|
+
readonly sleepRunIds: WorkflowSummaryIdArray;
|
|
253
|
+
readonly sleepStepIds: WorkflowSummaryIdArray;
|
|
254
|
+
readonly sleepAttemptKeys: WorkflowSummaryIdArray;
|
|
255
|
+
readonly oldestStartedAt?: Temporal.Instant;
|
|
256
|
+
readonly nextWakeAt?: Temporal.Instant;
|
|
257
|
+
readonly nextWakingRunId?: RunId;
|
|
258
|
+
readonly nextWakingStepId?: StepId;
|
|
259
|
+
readonly nextWakingAttemptKey?: string;
|
|
260
|
+
readonly nextWakingDuration?: Temporal.Duration;
|
|
261
|
+
}
|
|
262
|
+
/** Summary data for workflow run messageId. */
|
|
263
|
+
interface WorkflowRunMessageSummary {
|
|
264
|
+
readonly activeWaits: number;
|
|
265
|
+
readonly activeWaitRuns: number;
|
|
266
|
+
readonly waitRunIds: WorkflowSummaryIdArray;
|
|
267
|
+
readonly waitStepIds: WorkflowSummaryIdArray;
|
|
268
|
+
readonly waitAttemptKeys: WorkflowSummaryIdArray;
|
|
269
|
+
readonly messages: WorkflowSummaryIdArray;
|
|
270
|
+
readonly oldestWaitStartedAt?: Temporal.Instant;
|
|
271
|
+
readonly nextWaitTimeoutAt?: Temporal.Instant;
|
|
272
|
+
readonly nextWaitTimeoutRunId?: RunId;
|
|
273
|
+
readonly nextWaitTimeoutStepId?: StepId;
|
|
274
|
+
readonly nextWaitTimeoutAttemptKey?: string;
|
|
275
|
+
}
|
|
276
|
+
/** Summary data for workflow run child workflow. */
|
|
277
|
+
interface WorkflowRunChildWorkflowSummary {
|
|
278
|
+
readonly activeWaits: number;
|
|
279
|
+
readonly activeWaitRuns: number;
|
|
280
|
+
readonly waitRunIds: WorkflowSummaryIdArray;
|
|
281
|
+
readonly waitStepIds: WorkflowSummaryIdArray;
|
|
282
|
+
readonly waitAttemptKeys: WorkflowSummaryIdArray;
|
|
283
|
+
readonly childRunIds: WorkflowSummaryIdArray;
|
|
284
|
+
readonly retryChildRunIds?: WorkflowSummaryIdArray;
|
|
285
|
+
readonly failedChildRunIds?: WorkflowSummaryIdArray;
|
|
286
|
+
readonly canceledChildRunIds?: WorkflowSummaryIdArray;
|
|
287
|
+
readonly workflows: WorkflowSummaryIdArray;
|
|
288
|
+
readonly childStatus: WorkflowRunStatusCounts;
|
|
289
|
+
readonly childRetry?: WorkflowRunRetrySummary;
|
|
290
|
+
readonly childFailure?: WorkflowRunFailureSummary;
|
|
291
|
+
readonly oldestWaitStartedAt?: Temporal.Instant;
|
|
292
|
+
readonly nextWaitTimeoutAt?: Temporal.Instant;
|
|
293
|
+
readonly nextWaitTimeoutRunId?: RunId;
|
|
294
|
+
readonly nextWaitTimeoutStepId?: StepId;
|
|
295
|
+
readonly nextWaitTimeoutAttemptKey?: string;
|
|
296
|
+
}
|
|
297
|
+
/** Summary data for workflow run. */
|
|
298
|
+
interface WorkflowRunSummary {
|
|
299
|
+
readonly total: number;
|
|
300
|
+
readonly status: WorkflowRunStatusCounts;
|
|
301
|
+
readonly statusRunIds: WorkflowRunStatusRunIds;
|
|
302
|
+
readonly workflow: WorkflowRunWorkflowSummary;
|
|
303
|
+
readonly transition: WorkflowRunTransitionSummary;
|
|
304
|
+
readonly retry: WorkflowRunRetrySummary;
|
|
305
|
+
readonly failure?: WorkflowRunFailureSummary;
|
|
306
|
+
readonly lease: WorkflowRunLeaseSummary;
|
|
307
|
+
readonly cleanup?: WorkflowRunCleanupSummary;
|
|
308
|
+
readonly stream?: WorkflowRunStreamSummary;
|
|
309
|
+
readonly hook?: WorkflowRunHookSummary;
|
|
310
|
+
readonly sleep?: WorkflowRunSleepSummary;
|
|
311
|
+
readonly childWorkflow?: WorkflowRunChildWorkflowSummary;
|
|
312
|
+
readonly messageId?: WorkflowRunMessageSummary;
|
|
313
|
+
readonly nextAvailableAt?: Temporal.Instant;
|
|
314
|
+
readonly oldestPendingAt?: Temporal.Instant;
|
|
315
|
+
readonly oldestRunningAt?: Temporal.Instant;
|
|
316
|
+
}
|
|
317
|
+
//#endregion
|
|
318
|
+
export { WorkflowRecoveryChildWorkflowWaitSummary, WorkflowRecoveryDueSummary, WorkflowRecoveryFailedSummary, WorkflowRecoveryLeaseSummary, WorkflowRecoveryLockSummary, WorkflowRecoveryMessageWaitSummary, WorkflowRecoveryMissingImplementationSummary, WorkflowRecoveryRetrySummary, WorkflowRecoveryScheduleSummary, WorkflowRecoverySleepWaitSummary, WorkflowRecoverySummary, WorkflowRecoverySummaryOptions, WorkflowRecoveryWaitSummary, WorkflowRunChildWorkflowSummary, WorkflowRunCleanupSummary, WorkflowRunFailureErrorSummary, WorkflowRunFailureSummary, WorkflowRunHookSummary, WorkflowRunLeaseSummary, WorkflowRunMessageSummary, WorkflowRunRetryReasonCounts, WorkflowRunRetrySummary, WorkflowRunSleepSummary, WorkflowRunStatusCounts, WorkflowRunStatusRunIds, WorkflowRunStreamSummary, WorkflowRunSummary, WorkflowRunSummaryOptions, WorkflowRunTransitionReasonCounts, WorkflowRunTransitionReasonRunIds, WorkflowRunTransitionSummary, WorkflowRunWorkflowCount, WorkflowRunWorkflowSummary, WorkflowTerminalRunStatusCounts, WorkflowTerminalRunStatusRunIds };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { WorkflowResolvedStepRetryConfig } from "./retry.mjs";
|
|
2
|
+
import { WorkflowStepMetadata } from "./step.mjs";
|
|
3
|
+
import { WorkflowRunSummary, WorkflowRunSummaryOptions } from "./summary.mjs";
|
|
4
|
+
import { ObservationEventMap } from "./observation.mjs";
|
|
5
|
+
import { ExecutionResult } from "./result.mjs";
|
|
6
|
+
import { WorkflowRunRecord } from "./run.mjs";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
//#region src/types/telemetry.d.ts
|
|
9
|
+
declare const workflowTelemetryContextSchema: z.ZodObject<{
|
|
10
|
+
traceparent: z.ZodOptional<z.ZodString>;
|
|
11
|
+
tracestate: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
/** Persisted W3C trace context captured when a workflow run is created. */
|
|
14
|
+
interface TelemetryContext {
|
|
15
|
+
readonly traceparent?: string;
|
|
16
|
+
readonly tracestate?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Context passed to telemetry adapters around workflow run execution. */
|
|
19
|
+
interface RunTelemetryContext {
|
|
20
|
+
readonly run: WorkflowRunRecord;
|
|
21
|
+
readonly traceContext?: TelemetryContext;
|
|
22
|
+
}
|
|
23
|
+
/** Context passed to telemetry adapters after workflow run execution finishes. */
|
|
24
|
+
interface RunTelemetryResultContext<TOutput = unknown> extends RunTelemetryContext {
|
|
25
|
+
readonly result?: ExecutionResult<TOutput>;
|
|
26
|
+
readonly error?: unknown;
|
|
27
|
+
}
|
|
28
|
+
/** Context passed to telemetry adapters around durable task callback execution. */
|
|
29
|
+
interface StepTelemetryContext {
|
|
30
|
+
readonly run: WorkflowRunRecord;
|
|
31
|
+
readonly step: WorkflowStepMetadata;
|
|
32
|
+
readonly attempt: number;
|
|
33
|
+
readonly retry: WorkflowResolvedStepRetryConfig;
|
|
34
|
+
readonly timeoutAt?: Temporal.Instant;
|
|
35
|
+
}
|
|
36
|
+
/** Context passed to telemetry adapters after durable task callback execution finishes. */
|
|
37
|
+
interface StepTelemetryResultContext extends StepTelemetryContext {
|
|
38
|
+
readonly error?: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** Storage/backend operation names observed by the default workflow store. */
|
|
41
|
+
type StorageTelemetryOperation = "get" | "tryGet" | "set" | "trySet" | "compareAndSet" | "tryCompareAndSet" | "compareAndSetMany" | "tryCompareAndSetMany" | "has" | "tryHas" | "delete" | "tryDelete" | "getMany" | "tryGetMany" | "setMany" | "trySetMany" | "deleteMany" | "tryDeleteMany" | "keys" | "tryKeys" | "entries" | "tryEntries" | "clear" | "tryClear" | "watch" | "unwatch" | "dispose" | "tryDispose";
|
|
42
|
+
/** Context passed to telemetry adapters around workflow storage/backend operations. */
|
|
43
|
+
interface StorageTelemetryContext {
|
|
44
|
+
readonly operation: StorageTelemetryOperation;
|
|
45
|
+
readonly backend: string;
|
|
46
|
+
}
|
|
47
|
+
/** Minimal engine read model exposed to telemetry adapters after engine creation. */
|
|
48
|
+
interface TelemetryEngine {
|
|
49
|
+
/** Returns aggregate run metrics for runs matching optional filters. */
|
|
50
|
+
getRunSummary(options?: WorkflowRunSummaryOptions): Promise<WorkflowRunSummary>;
|
|
51
|
+
}
|
|
52
|
+
/** Optional telemetry hooks used to observe running workflow behavior. */
|
|
53
|
+
interface Telemetry {
|
|
54
|
+
/** Captures ambient trace context for a newly-created workflow run. */
|
|
55
|
+
captureContext?(): TelemetryContext | undefined;
|
|
56
|
+
/** Runs a workflow execution callback with telemetry context. */
|
|
57
|
+
withRunExecution?<T>(context: RunTelemetryContext, callback: () => Promise<T>): Promise<T>;
|
|
58
|
+
/** Runs a durable task callback with telemetry context. */
|
|
59
|
+
withStepExecution?<T>(context: StepTelemetryContext, callback: () => Promise<T>): Promise<T>;
|
|
60
|
+
/** Runs a workflow storage/backend operation callback with telemetry context. */
|
|
61
|
+
withStorageOperation?<T>(context: StorageTelemetryContext, callback: () => Promise<T>): Promise<T>;
|
|
62
|
+
/** Observes the final outcome of a workflow execution callback. */
|
|
63
|
+
recordRunExecution?<TOutput>(context: RunTelemetryResultContext<TOutput>): void;
|
|
64
|
+
/** Observes the final outcome of a durable task callback. */
|
|
65
|
+
recordStepExecution?(context: StepTelemetryResultContext): void;
|
|
66
|
+
/** Observes committed workflow observation events. */
|
|
67
|
+
observe?<Key extends keyof ObservationEventMap>(name: Key, payload: ObservationEventMap[Key]): void;
|
|
68
|
+
/** Binds the telemetry adapter to an engine after engine creation. */
|
|
69
|
+
bindEngine?(engine: TelemetryEngine): void;
|
|
70
|
+
/** Releases telemetry resources owned by the adapter. */
|
|
71
|
+
shutdown?(): Promise<void> | void;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { RunTelemetryContext, RunTelemetryResultContext, StepTelemetryContext, StepTelemetryResultContext, StorageTelemetryContext, StorageTelemetryOperation, Telemetry, TelemetryContext, TelemetryEngine, workflowTelemetryContextSchema };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { nonBlankStringSchema } from "./common.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/types/telemetry.ts
|
|
4
|
+
const workflowTelemetryContextSchema = z.object({
|
|
5
|
+
traceparent: nonBlankStringSchema.optional(),
|
|
6
|
+
tracestate: nonBlankStringSchema.optional()
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { workflowTelemetryContextSchema };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { MessageId } from "./message-id.mjs";
|
|
2
|
+
import { RunId } from "./run-id.mjs";
|
|
3
|
+
import { StepId } from "./step-id.mjs";
|
|
4
|
+
import { StreamId } from "./stream-id.mjs";
|
|
5
|
+
import { WorkflowAttributePatch, WorkflowRunRecord } from "./run.mjs";
|
|
6
|
+
import { WorkflowErrorRecord } from "./error.mjs";
|
|
7
|
+
import { AttributesSetEvent, ChildWorkflowCompletedEvent, ChildWorkflowFailedEvent, ChildWorkflowStartedEvent, DeterministicValueRecordedEvent, EventRecord, MessageSendCompletedEvent, MessageSendFailedEvent, MessageSendStartedEvent, MessageSentEvent, MessageWaitCompletedEvent, MessageWaitFailedEvent, MessageWaitStartedEvent, MetadataSetEvent, SleepCompletedEvent, SleepStartedEvent, StreamChunkEvent, StreamClosedEvent, StreamFailedEvent, StreamStartedEvent, WorkflowStepCompletedEvent, WorkflowStepFailedEvent, WorkflowStepStartedEvent } from "./events.mjs";
|
|
8
|
+
import { StorageValue } from "@temelj/storage";
|
|
9
|
+
//#region src/types/timeline.d.ts
|
|
10
|
+
type WorkflowStartedEvent = Extract<EventRecord, {
|
|
11
|
+
readonly kind: "workflow_started";
|
|
12
|
+
}>;
|
|
13
|
+
type WorkflowCompletedEvent = Extract<EventRecord, {
|
|
14
|
+
readonly kind: "workflow_completed";
|
|
15
|
+
}>;
|
|
16
|
+
type WorkflowFailedEvent = Extract<EventRecord, {
|
|
17
|
+
readonly kind: "workflow_failed";
|
|
18
|
+
}>;
|
|
19
|
+
/** Describes the workflow timeline contract. */
|
|
20
|
+
interface Timeline {
|
|
21
|
+
readonly run: WorkflowRunRecord;
|
|
22
|
+
readonly entries: readonly TimelineEntryRecord[];
|
|
23
|
+
}
|
|
24
|
+
/** Kind values for workflow timeline entries. */
|
|
25
|
+
type TimelineEntryKind = "workflow" | "step" | "sleep" | "child_workflow" | "message" | "stream" | "deterministic" | "metadata" | "attributes";
|
|
26
|
+
/** Status values for workflow-level timeline entries. */
|
|
27
|
+
type TimelineWorkflowStatus = "started" | "completed" | "failed";
|
|
28
|
+
/** Status values for durable task timeline entries. */
|
|
29
|
+
type TimelineStepStatus = "started" | "completed" | "failed";
|
|
30
|
+
/** Status values for sleep timeline entries. */
|
|
31
|
+
type TimelineSleepStatus = "started" | "completed";
|
|
32
|
+
/** Status values for child workflow timeline entries. */
|
|
33
|
+
type TimelineChildWorkflowStatus = "started" | "completed" | "failed";
|
|
34
|
+
/** Status values for messageId timeline entries. */
|
|
35
|
+
type TimelineMessageStatus = "send_started" | "send_completed" | "send_failed" | "sent" | "waiting" | "received" | "failed";
|
|
36
|
+
/** Status values for stream timeline entries. */
|
|
37
|
+
type TimelineStreamStatus = "started" | "chunk" | "closed" | "failed";
|
|
38
|
+
/** Status value for metadata and attribute timeline entries. */
|
|
39
|
+
type TimelineSetStatus = "set";
|
|
40
|
+
/** Status value for deterministic-value timeline entries. */
|
|
41
|
+
type TimelineRecordedStatus = "recorded";
|
|
42
|
+
/** Base contract for workflow timeline entries. */
|
|
43
|
+
interface TimelineEntry {
|
|
44
|
+
readonly kind: TimelineEntryKind;
|
|
45
|
+
}
|
|
46
|
+
type WorkflowTimelineStepFields = {
|
|
47
|
+
readonly timestamp: Temporal.Instant;
|
|
48
|
+
readonly stepId: StepId;
|
|
49
|
+
readonly stepName: string;
|
|
50
|
+
};
|
|
51
|
+
type WorkflowTimelineCountField = {
|
|
52
|
+
readonly count?: number;
|
|
53
|
+
};
|
|
54
|
+
type WorkflowTimelineOptionalMessageFields = {
|
|
55
|
+
readonly stepId?: StepId;
|
|
56
|
+
readonly stepName?: string;
|
|
57
|
+
readonly count?: number;
|
|
58
|
+
readonly targetRunId?: RunId;
|
|
59
|
+
readonly timeoutAt?: Temporal.Instant;
|
|
60
|
+
readonly payload?: StorageValue;
|
|
61
|
+
readonly error?: WorkflowErrorRecord;
|
|
62
|
+
readonly messageTimestamp?: Temporal.Instant;
|
|
63
|
+
readonly waiterStepIds?: readonly string[];
|
|
64
|
+
};
|
|
65
|
+
/** Describes the workflow timeline workflow entry contract. */
|
|
66
|
+
type TimelineWorkflowEntry = {
|
|
67
|
+
readonly kind: "workflow";
|
|
68
|
+
readonly status: "started";
|
|
69
|
+
readonly timestamp: Temporal.Instant;
|
|
70
|
+
readonly event: WorkflowStartedEvent;
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "workflow";
|
|
73
|
+
readonly status: "completed";
|
|
74
|
+
readonly timestamp: Temporal.Instant;
|
|
75
|
+
readonly event: WorkflowCompletedEvent;
|
|
76
|
+
} | {
|
|
77
|
+
readonly kind: "workflow";
|
|
78
|
+
readonly status: "failed";
|
|
79
|
+
readonly timestamp: Temporal.Instant;
|
|
80
|
+
readonly event: WorkflowFailedEvent;
|
|
81
|
+
};
|
|
82
|
+
/** Describes the workflow timeline step entry contract. */
|
|
83
|
+
type TimelineStepEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
84
|
+
readonly kind: "step";
|
|
85
|
+
readonly status: "started";
|
|
86
|
+
readonly attempt: number;
|
|
87
|
+
readonly event: WorkflowStepStartedEvent;
|
|
88
|
+
}) | (WorkflowTimelineStepFields & {
|
|
89
|
+
readonly kind: "step";
|
|
90
|
+
readonly status: "completed";
|
|
91
|
+
readonly attempt: number;
|
|
92
|
+
readonly result?: StorageValue;
|
|
93
|
+
readonly event: WorkflowStepCompletedEvent;
|
|
94
|
+
}) | (WorkflowTimelineStepFields & {
|
|
95
|
+
readonly kind: "step";
|
|
96
|
+
readonly status: "failed";
|
|
97
|
+
readonly attempt: number;
|
|
98
|
+
readonly error?: WorkflowErrorRecord;
|
|
99
|
+
readonly event: WorkflowStepFailedEvent;
|
|
100
|
+
});
|
|
101
|
+
/** Describes the workflow timeline sleep entry contract. */
|
|
102
|
+
type TimelineSleepEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
103
|
+
readonly kind: "sleep";
|
|
104
|
+
readonly status: "started";
|
|
105
|
+
readonly until?: Temporal.Instant;
|
|
106
|
+
readonly duration?: Temporal.Duration;
|
|
107
|
+
readonly event: SleepStartedEvent;
|
|
108
|
+
}) | (WorkflowTimelineStepFields & {
|
|
109
|
+
readonly kind: "sleep";
|
|
110
|
+
readonly status: "completed";
|
|
111
|
+
readonly event: SleepCompletedEvent;
|
|
112
|
+
});
|
|
113
|
+
/** Describes the workflow timeline child workflow entry contract. */
|
|
114
|
+
type TimelineChildWorkflowEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
115
|
+
readonly kind: "child_workflow";
|
|
116
|
+
readonly status: "started";
|
|
117
|
+
readonly childRunId: RunId;
|
|
118
|
+
readonly workflowName?: string;
|
|
119
|
+
readonly workflowVersion?: string;
|
|
120
|
+
readonly input?: StorageValue;
|
|
121
|
+
readonly timeoutAt?: Temporal.Instant;
|
|
122
|
+
readonly event: ChildWorkflowStartedEvent;
|
|
123
|
+
}) | (WorkflowTimelineStepFields & {
|
|
124
|
+
readonly kind: "child_workflow";
|
|
125
|
+
readonly status: "completed";
|
|
126
|
+
readonly childRunId: RunId;
|
|
127
|
+
readonly result?: StorageValue;
|
|
128
|
+
readonly event: ChildWorkflowCompletedEvent;
|
|
129
|
+
}) | (WorkflowTimelineStepFields & {
|
|
130
|
+
readonly kind: "child_workflow";
|
|
131
|
+
readonly status: "failed";
|
|
132
|
+
readonly childRunId: RunId;
|
|
133
|
+
readonly error?: WorkflowErrorRecord;
|
|
134
|
+
readonly event: ChildWorkflowFailedEvent;
|
|
135
|
+
});
|
|
136
|
+
/** Describes the workflow timeline messageId entry contract. */
|
|
137
|
+
type TimelineMessageEntry = (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
138
|
+
readonly kind: "message";
|
|
139
|
+
readonly status: "send_started";
|
|
140
|
+
readonly targetRunId: RunId;
|
|
141
|
+
readonly messageId: MessageId;
|
|
142
|
+
readonly event: MessageSendStartedEvent;
|
|
143
|
+
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
144
|
+
readonly kind: "message";
|
|
145
|
+
readonly status: "send_completed";
|
|
146
|
+
readonly targetRunId: RunId;
|
|
147
|
+
readonly messageId: MessageId;
|
|
148
|
+
readonly event: MessageSendCompletedEvent;
|
|
149
|
+
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
150
|
+
readonly kind: "message";
|
|
151
|
+
readonly status: "send_failed";
|
|
152
|
+
readonly targetRunId: RunId;
|
|
153
|
+
readonly messageId: MessageId;
|
|
154
|
+
readonly error?: WorkflowErrorRecord;
|
|
155
|
+
readonly event: MessageSendFailedEvent;
|
|
156
|
+
}) | (WorkflowTimelineOptionalMessageFields & {
|
|
157
|
+
readonly kind: "message";
|
|
158
|
+
readonly status: "sent";
|
|
159
|
+
readonly timestamp: Temporal.Instant;
|
|
160
|
+
readonly messageId: MessageId;
|
|
161
|
+
readonly payload?: StorageValue;
|
|
162
|
+
readonly event: MessageSentEvent;
|
|
163
|
+
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
164
|
+
readonly kind: "message";
|
|
165
|
+
readonly status: "waiting";
|
|
166
|
+
readonly messageId: MessageId;
|
|
167
|
+
readonly timeoutAt?: Temporal.Instant;
|
|
168
|
+
readonly event: MessageWaitStartedEvent;
|
|
169
|
+
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
170
|
+
readonly kind: "message";
|
|
171
|
+
readonly status: "received";
|
|
172
|
+
readonly messageId: MessageId;
|
|
173
|
+
readonly payload?: StorageValue;
|
|
174
|
+
readonly messageTimestamp?: Temporal.Instant;
|
|
175
|
+
readonly event: MessageWaitCompletedEvent;
|
|
176
|
+
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
177
|
+
readonly kind: "message";
|
|
178
|
+
readonly status: "failed";
|
|
179
|
+
readonly messageId: MessageId;
|
|
180
|
+
readonly error?: WorkflowErrorRecord;
|
|
181
|
+
readonly event: MessageWaitFailedEvent;
|
|
182
|
+
});
|
|
183
|
+
/** Describes the workflow timeline metadata entry contract. */
|
|
184
|
+
type TimelineMetadataEntry = WorkflowTimelineStepFields & {
|
|
185
|
+
readonly kind: "metadata";
|
|
186
|
+
readonly status: TimelineSetStatus;
|
|
187
|
+
readonly count: number;
|
|
188
|
+
readonly metadata: StorageValue;
|
|
189
|
+
readonly event: MetadataSetEvent;
|
|
190
|
+
};
|
|
191
|
+
/** Describes the workflow timeline attributes entry contract. */
|
|
192
|
+
type TimelineAttributesEntry = WorkflowTimelineStepFields & {
|
|
193
|
+
readonly kind: "attributes";
|
|
194
|
+
readonly status: TimelineSetStatus;
|
|
195
|
+
readonly count: number;
|
|
196
|
+
readonly attributes: WorkflowAttributePatch;
|
|
197
|
+
readonly event: AttributesSetEvent;
|
|
198
|
+
};
|
|
199
|
+
/** Describes the workflow timeline stream entry contract. */
|
|
200
|
+
type TimelineStreamEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
201
|
+
readonly kind: "stream";
|
|
202
|
+
readonly status: "started";
|
|
203
|
+
readonly streamId: StreamId;
|
|
204
|
+
readonly contentType?: string;
|
|
205
|
+
readonly metadata?: StorageValue;
|
|
206
|
+
readonly event: StreamStartedEvent;
|
|
207
|
+
}) | (WorkflowTimelineStepFields & {
|
|
208
|
+
readonly kind: "stream";
|
|
209
|
+
readonly status: "chunk";
|
|
210
|
+
readonly streamId: StreamId;
|
|
211
|
+
readonly index: number;
|
|
212
|
+
readonly chunk?: StorageValue;
|
|
213
|
+
readonly event: StreamChunkEvent;
|
|
214
|
+
}) | (WorkflowTimelineStepFields & {
|
|
215
|
+
readonly kind: "stream";
|
|
216
|
+
readonly status: "closed";
|
|
217
|
+
readonly streamId: StreamId;
|
|
218
|
+
readonly event: StreamClosedEvent;
|
|
219
|
+
}) | (WorkflowTimelineStepFields & {
|
|
220
|
+
readonly kind: "stream";
|
|
221
|
+
readonly status: "failed";
|
|
222
|
+
readonly streamId: StreamId;
|
|
223
|
+
readonly error?: WorkflowErrorRecord;
|
|
224
|
+
readonly event: StreamFailedEvent;
|
|
225
|
+
});
|
|
226
|
+
/** Describes the workflow timeline deterministic entry contract. */
|
|
227
|
+
type TimelineDeterministicEntry = WorkflowTimelineStepFields & {
|
|
228
|
+
readonly kind: "deterministic";
|
|
229
|
+
readonly status: TimelineRecordedStatus;
|
|
230
|
+
readonly count: number;
|
|
231
|
+
readonly value: StorageValue;
|
|
232
|
+
readonly event: DeterministicValueRecordedEvent;
|
|
233
|
+
};
|
|
234
|
+
/** Type used for workflow timeline entry values. */
|
|
235
|
+
type TimelineEntryRecord = TimelineWorkflowEntry | TimelineStepEntry | TimelineSleepEntry | TimelineChildWorkflowEntry | TimelineMessageEntry | TimelineStreamEntry | TimelineDeterministicEntry | TimelineMetadataEntry | TimelineAttributesEntry;
|
|
236
|
+
//#endregion
|
|
237
|
+
export { Timeline, TimelineAttributesEntry, TimelineChildWorkflowEntry, TimelineChildWorkflowStatus, TimelineDeterministicEntry, TimelineEntry, TimelineEntryKind, TimelineEntryRecord, TimelineMessageEntry, TimelineMessageStatus, TimelineMetadataEntry, TimelineRecordedStatus, TimelineSetStatus, TimelineSleepEntry, TimelineSleepStatus, TimelineStepEntry, TimelineStepStatus, TimelineStreamEntry, TimelineStreamStatus, TimelineWorkflowEntry, TimelineWorkflowStatus };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|