@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,254 @@
|
|
|
1
|
+
import { MessageId } from "./message-id.mjs";
|
|
2
|
+
import { RunId } from "./run-id.mjs";
|
|
3
|
+
import { CleanupMarkerRecord, CleanupRunsOptions, CleanupRunsResult } from "./cleanup.mjs";
|
|
4
|
+
import { PageOptions, WorkflowPage } from "./pagination.mjs";
|
|
5
|
+
import { ListSchedulesOptions, ScheduleId, ScheduleRecord } from "./schedule.mjs";
|
|
6
|
+
import { LockRecord } from "./lock.mjs";
|
|
7
|
+
import { WorkflowListRunsOptions } from "./run-list.mjs";
|
|
8
|
+
import { WorkflowListStepAttemptsOptions, WorkflowStepAttemptRecord } from "./step-attempts.mjs";
|
|
9
|
+
import { WorkflowRunRecord } from "./run.mjs";
|
|
10
|
+
import { EventRecord } from "./events.mjs";
|
|
11
|
+
import { WorkflowWorkerRunFilterOptions } from "./worker.mjs";
|
|
12
|
+
import { Storage, StorageValue, StoredValue } from "@temelj/storage";
|
|
13
|
+
//#region src/types/store.d.ts
|
|
14
|
+
/** Type used for workflow storage values. */
|
|
15
|
+
type WorkflowStorage = Storage<Record<string, StorageValue>, StorageValue, StoredValue>;
|
|
16
|
+
/** Storage value stored for cleanup index entries. */
|
|
17
|
+
type WorkflowCleanupIndexValue = StorageValue;
|
|
18
|
+
/** Storage index entry removed during workflow cleanup. */
|
|
19
|
+
interface WorkflowCleanupIndexKey {
|
|
20
|
+
readonly key: string;
|
|
21
|
+
readonly value: WorkflowCleanupIndexValue;
|
|
22
|
+
}
|
|
23
|
+
/** Index entry used to detect duplicate messageId delivery idempotency keys. */
|
|
24
|
+
interface WorkflowMessageIdempotencyIndex {
|
|
25
|
+
readonly runId: RunId;
|
|
26
|
+
readonly messageId: MessageId;
|
|
27
|
+
readonly timestamp: Temporal.Instant;
|
|
28
|
+
}
|
|
29
|
+
/** Options for workflow creation store. */
|
|
30
|
+
interface CreateWorkflowStoreOptions {
|
|
31
|
+
readonly storage?: WorkflowStorage;
|
|
32
|
+
readonly namespace?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Exposes workflow store namespace identity. */
|
|
35
|
+
interface WorkflowStoreNamespace {
|
|
36
|
+
/** Namespace prefix used to isolate workflow records in storage. */
|
|
37
|
+
readonly namespace: string;
|
|
38
|
+
}
|
|
39
|
+
/** Exposes workflow store storage identity. */
|
|
40
|
+
interface WorkflowStoreStorageContext extends WorkflowStoreNamespace {
|
|
41
|
+
/** Underlying key-value storage used by the workflow store. */
|
|
42
|
+
readonly storage: WorkflowStorage;
|
|
43
|
+
}
|
|
44
|
+
/** Shared workflow store metadata needed by default repository implementations. */
|
|
45
|
+
interface WorkflowStoreMetadata extends WorkflowStoreStorageContext, WorkflowStoreCapabilitiesSource {}
|
|
46
|
+
/** Exposes workflow store capability flags. */
|
|
47
|
+
interface WorkflowStoreCapabilitiesSource {
|
|
48
|
+
/** Store capability flags used by engine services to choose safe coordination code paths. */
|
|
49
|
+
readonly capabilities: WorkflowStoreCapabilities;
|
|
50
|
+
}
|
|
51
|
+
/** Creates workflow run records. */
|
|
52
|
+
interface WorkflowRunCreationRepository {
|
|
53
|
+
/** Creates a workflow run record. */
|
|
54
|
+
createRun(run: WorkflowRunRecord): Promise<WorkflowRunRecord>;
|
|
55
|
+
}
|
|
56
|
+
/** Reads workflow run records. */
|
|
57
|
+
interface WorkflowRunReaderRepository {
|
|
58
|
+
/** Returns a workflow run by ID, if it exists. */
|
|
59
|
+
getRun(runId: RunId): Promise<WorkflowRunRecord | undefined>;
|
|
60
|
+
}
|
|
61
|
+
/** Updates workflow run records conditionally. */
|
|
62
|
+
interface WorkflowRunConditionalWriterRepository {
|
|
63
|
+
/** Replaces a workflow run only when the stored record still matches the current value. */
|
|
64
|
+
updateRunIfCurrent(current: WorkflowRunRecord, next: WorkflowRunRecord): Promise<WorkflowRunRecord | undefined>;
|
|
65
|
+
}
|
|
66
|
+
/** Updates workflow run records unconditionally. */
|
|
67
|
+
interface WorkflowRunUnconditionalWriterRepository {
|
|
68
|
+
/** Replaces a workflow run record. */
|
|
69
|
+
updateRun(run: WorkflowRunRecord): Promise<WorkflowRunRecord>;
|
|
70
|
+
}
|
|
71
|
+
/** Updates workflow run records. */
|
|
72
|
+
interface WorkflowRunWriterRepository extends WorkflowRunUnconditionalWriterRepository, WorkflowRunConditionalWriterRepository {}
|
|
73
|
+
/** Lists workflow run records. */
|
|
74
|
+
interface WorkflowRunListerRepository {
|
|
75
|
+
/** Lists workflow runs matching optional filters. */
|
|
76
|
+
listRuns(options?: WorkflowListRunsOptions): Promise<readonly WorkflowRunRecord[]>;
|
|
77
|
+
}
|
|
78
|
+
/** Queries workflow run records. */
|
|
79
|
+
interface WorkflowRunQueryRepository extends WorkflowRunReaderRepository, WorkflowRunListerRepository {
|
|
80
|
+
/** Lists one page of workflow runs matching optional filters. */
|
|
81
|
+
listRunsPage(options?: WorkflowListRunsOptions & PageOptions): Promise<WorkflowPage<WorkflowRunRecord>>;
|
|
82
|
+
/** Counts workflow runs matching optional filters. */
|
|
83
|
+
countRuns(options?: WorkflowListRunsOptions): Promise<number>;
|
|
84
|
+
}
|
|
85
|
+
/** Coordinates workflow run worker leases. */
|
|
86
|
+
interface WorkflowRunLeaseRepository {
|
|
87
|
+
/** Claims a pending or reclaimable run for a worker. */
|
|
88
|
+
claimRun(options: WorkflowClaimRunOptions): Promise<WorkflowRunRecord | undefined>;
|
|
89
|
+
/** Extends the lease for a run already claimed by a worker. */
|
|
90
|
+
extendRunLease(options: WorkflowExtendRunLeaseOptions): Promise<WorkflowRunRecord | undefined>;
|
|
91
|
+
/** Releases the lease for a run claimed by a worker. */
|
|
92
|
+
releaseRunLease(options: WorkflowReleaseRunLeaseOptions): Promise<WorkflowRunRecord | undefined>;
|
|
93
|
+
}
|
|
94
|
+
/** Stores workflow run records and run leases. */
|
|
95
|
+
interface WorkflowRunRepository extends WorkflowRunCreationRepository, WorkflowRunReaderRepository, WorkflowRunUnconditionalWriterRepository, WorkflowRunConditionalWriterRepository, WorkflowRunWriterRepository, WorkflowRunListerRepository, WorkflowRunQueryRepository, WorkflowRunLeaseRepository {}
|
|
96
|
+
/** Stores workflow-scoped idempotency indexes for run creation. */
|
|
97
|
+
interface WorkflowIdempotencyIndex {
|
|
98
|
+
/** Returns a workflow run by its workflow-scoped idempotency key, if it exists. */
|
|
99
|
+
getRunByIdempotencyKey(options: WorkflowIdempotencyKeyOptions): Promise<WorkflowRunRecord | undefined>;
|
|
100
|
+
}
|
|
101
|
+
/** Repairs duplicate-delivery idempotency indexes for messages sent to workflow runs. */
|
|
102
|
+
interface WorkflowMessageIdempotencyRepairModel {
|
|
103
|
+
/** Rebuilds message idempotency indexes for a run from its event history. */
|
|
104
|
+
repairMessageIdempotencyIndexes(runId: RunId): Promise<readonly WorkflowMessageIdempotencyIndex[]>;
|
|
105
|
+
}
|
|
106
|
+
/** Looks up duplicate-delivery idempotency indexes for messages sent to workflow runs. */
|
|
107
|
+
interface WorkflowMessageIdempotencyIndexLookup {
|
|
108
|
+
/** Returns true when a message idempotency key is already claimed for a run. */
|
|
109
|
+
hasMessageIdempotencyKey(runId: RunId, idempotencyKey: string): Promise<boolean>;
|
|
110
|
+
}
|
|
111
|
+
/** Appends durable workflow events. */
|
|
112
|
+
interface WorkflowEventAppender {
|
|
113
|
+
/** Appends one durable event to a run's history. */
|
|
114
|
+
appendEvent(runId: RunId, event: EventRecord): Promise<readonly EventRecord[]>;
|
|
115
|
+
}
|
|
116
|
+
/** Appends durable workflow events conditionally on the current run record. */
|
|
117
|
+
interface WorkflowConditionalEventAppender {
|
|
118
|
+
/** Appends one durable event only when the stored run still matches the current value. */
|
|
119
|
+
appendEventIfRunCurrent(current: WorkflowRunRecord, event: EventRecord): Promise<readonly EventRecord[] | undefined>;
|
|
120
|
+
}
|
|
121
|
+
/** Reads durable workflow event history. */
|
|
122
|
+
interface WorkflowEventReader {
|
|
123
|
+
/** Returns all durable events recorded for a run. */
|
|
124
|
+
getEvents(runId: RunId): Promise<readonly EventRecord[]>;
|
|
125
|
+
}
|
|
126
|
+
/** Waits for durable workflow event history changes. */
|
|
127
|
+
interface WorkflowEventHistoryWatcher {
|
|
128
|
+
/** Resolves after the durable event history for a run changes or the optional signal aborts. */
|
|
129
|
+
waitForEventHistoryChange(runId: RunId, options?: WorkflowEventHistoryChangeWaitOptions): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
/** Stores durable workflow event history. */
|
|
132
|
+
interface WorkflowEventLog extends WorkflowEventAppender, WorkflowConditionalEventAppender, WorkflowEventReader, WorkflowEventHistoryWatcher {}
|
|
133
|
+
/** Options for waiting for durable event history changes. */
|
|
134
|
+
interface WorkflowEventHistoryChangeWaitOptions {
|
|
135
|
+
readonly signal?: AbortSignal;
|
|
136
|
+
}
|
|
137
|
+
/** Looks up materialized step-attempt read models for runtime coordination. */
|
|
138
|
+
interface WorkflowStepAttemptLookup {
|
|
139
|
+
/** Lists materialized step attempts for a run. */
|
|
140
|
+
listStepAttempts(runId: RunId, options?: WorkflowListStepAttemptsOptions): Promise<readonly WorkflowStepAttemptRecord[]>;
|
|
141
|
+
}
|
|
142
|
+
/** Stores materialized step-attempt read models. */
|
|
143
|
+
interface WorkflowStepAttemptReadModel extends WorkflowStepAttemptLookup {
|
|
144
|
+
/** Lists one page of materialized step attempts for a run. */
|
|
145
|
+
listStepAttemptsPage(runId: RunId, options?: WorkflowListStepAttemptsOptions & PageOptions): Promise<WorkflowPage<WorkflowStepAttemptRecord>>;
|
|
146
|
+
/** Counts materialized step attempts for a run. */
|
|
147
|
+
countStepAttempts(runId: RunId, options?: WorkflowListStepAttemptsOptions): Promise<number>;
|
|
148
|
+
/** Rebuilds materialized step attempts for a run from its event history. */
|
|
149
|
+
repairStepAttempts(runId: RunId): Promise<readonly WorkflowStepAttemptRecord[]>;
|
|
150
|
+
}
|
|
151
|
+
/** Stores workflow cleanup markers and terminal-run cleanup operations. */
|
|
152
|
+
interface WorkflowCleanupRepository {
|
|
153
|
+
/** Deletes terminal run data according to cleanup options. */
|
|
154
|
+
cleanupRuns(options: CleanupRunsOptions): Promise<CleanupRunsResult>;
|
|
155
|
+
/** Lists cleanup marker records. */
|
|
156
|
+
listCleanupMarkers(): Promise<readonly CleanupMarkerRecord[]>;
|
|
157
|
+
}
|
|
158
|
+
/** Creates workflow schedule records. */
|
|
159
|
+
interface WorkflowScheduleCreationRepository {
|
|
160
|
+
/** Creates a workflow schedule record. */
|
|
161
|
+
createSchedule<TInput = StorageValue>(schedule: ScheduleRecord<TInput>): Promise<ScheduleRecord<TInput>>;
|
|
162
|
+
}
|
|
163
|
+
/** Reads workflow schedule records. */
|
|
164
|
+
interface WorkflowScheduleReaderRepository {
|
|
165
|
+
/** Returns a workflow schedule by ID, if it exists. */
|
|
166
|
+
getSchedule(scheduleId: ScheduleId): Promise<ScheduleRecord | undefined>;
|
|
167
|
+
}
|
|
168
|
+
/** Updates workflow schedule records conditionally. */
|
|
169
|
+
interface WorkflowScheduleConditionalWriterRepository {
|
|
170
|
+
/** Replaces a schedule only when the stored record still matches the current value. */
|
|
171
|
+
updateScheduleIfCurrent<TInput = StorageValue>(current: ScheduleRecord, next: ScheduleRecord<TInput>): Promise<ScheduleRecord<TInput> | undefined>;
|
|
172
|
+
}
|
|
173
|
+
/** Lists workflow schedule records. */
|
|
174
|
+
interface WorkflowScheduleListerRepository {
|
|
175
|
+
/** Lists workflow schedules matching optional filters. */
|
|
176
|
+
listSchedules(options?: ListSchedulesOptions): Promise<readonly ScheduleRecord[]>;
|
|
177
|
+
}
|
|
178
|
+
/** Queries workflow schedule records. */
|
|
179
|
+
interface WorkflowScheduleQueryRepository extends WorkflowScheduleListerRepository {
|
|
180
|
+
/** Lists one page of workflow schedules matching optional filters. */
|
|
181
|
+
listSchedulesPage(options?: ListSchedulesOptions & PageOptions): Promise<WorkflowPage<ScheduleRecord>>;
|
|
182
|
+
}
|
|
183
|
+
/** Stores workflow schedules. */
|
|
184
|
+
interface WorkflowScheduleRepository extends WorkflowScheduleCreationRepository, WorkflowScheduleReaderRepository, WorkflowScheduleConditionalWriterRepository, WorkflowScheduleQueryRepository {}
|
|
185
|
+
/** Reads workflow lock records. */
|
|
186
|
+
interface WorkflowLockReaderRepository {
|
|
187
|
+
/** Returns a workflow lock by key, if it exists. */
|
|
188
|
+
getLock(key: string): Promise<LockRecord | undefined>;
|
|
189
|
+
}
|
|
190
|
+
/** Lists workflow lock records. */
|
|
191
|
+
interface WorkflowLockListerRepository {
|
|
192
|
+
/** Lists workflow locks. */
|
|
193
|
+
listLocks(): Promise<readonly LockRecord[]>;
|
|
194
|
+
}
|
|
195
|
+
/** Updates workflow lock records conditionally. */
|
|
196
|
+
interface WorkflowLockConditionalWriterRepository {
|
|
197
|
+
/** Replaces or creates a lock only when the stored record still matches the current value. */
|
|
198
|
+
updateLockIfCurrent(current: LockRecord | undefined, next: LockRecord): Promise<LockRecord | undefined>;
|
|
199
|
+
}
|
|
200
|
+
/** Stores workflow lock records. */
|
|
201
|
+
interface WorkflowLockRepository extends WorkflowLockReaderRepository, WorkflowLockListerRepository, WorkflowLockConditionalWriterRepository {}
|
|
202
|
+
/** Describes the full workflow store contract implemented by the default store. */
|
|
203
|
+
interface WorkflowStore extends WorkflowStoreMetadata, WorkflowRunRepository, WorkflowIdempotencyIndex, WorkflowMessageIdempotencyIndexLookup, WorkflowMessageIdempotencyRepairModel, WorkflowEventLog, WorkflowStepAttemptReadModel, WorkflowCleanupRepository, WorkflowScheduleRepository, WorkflowLockRepository {}
|
|
204
|
+
/** Describes the workflow store capabilities contract. */
|
|
205
|
+
interface WorkflowStoreCapabilities {
|
|
206
|
+
readonly conditionalWrites: boolean;
|
|
207
|
+
readonly conditionalRunClaims: boolean;
|
|
208
|
+
readonly conditionalRunUpdates: boolean;
|
|
209
|
+
readonly conditionalRunLeaseExtensions: boolean;
|
|
210
|
+
readonly conditionalRunLeaseReleases: boolean;
|
|
211
|
+
readonly conditionalEventAppends: boolean;
|
|
212
|
+
readonly conditionalStepAttemptMaterialization: boolean;
|
|
213
|
+
readonly atomicRunCreation: boolean;
|
|
214
|
+
readonly atomicEventAndStepAttemptMaterialization: boolean;
|
|
215
|
+
readonly messageIdempotencyIndexes: boolean;
|
|
216
|
+
readonly indexedRunQueries: boolean;
|
|
217
|
+
readonly indexedRunCounts: boolean;
|
|
218
|
+
readonly indexedClaimableRunQueries: boolean;
|
|
219
|
+
readonly indexedStepAttemptQueries: boolean;
|
|
220
|
+
readonly indexedScheduleQueries: boolean;
|
|
221
|
+
readonly indexedLockQueries: boolean;
|
|
222
|
+
readonly rollsBackEventsOnMaterializationFailure: boolean;
|
|
223
|
+
readonly reconcilesStepAttemptsFromEvents: boolean;
|
|
224
|
+
}
|
|
225
|
+
/** Options for workflow idempotency key. */
|
|
226
|
+
interface WorkflowIdempotencyKeyOptions {
|
|
227
|
+
readonly workflowName: string;
|
|
228
|
+
readonly workflowVersion?: string;
|
|
229
|
+
readonly idempotencyKey: string;
|
|
230
|
+
}
|
|
231
|
+
/** Options for workflow claim run. */
|
|
232
|
+
interface WorkflowClaimRunOptions extends WorkflowWorkerRunFilterOptions {
|
|
233
|
+
readonly runId?: RunId;
|
|
234
|
+
readonly workerId: string;
|
|
235
|
+
readonly now: Temporal.Instant;
|
|
236
|
+
readonly leaseDuration: Temporal.Duration;
|
|
237
|
+
}
|
|
238
|
+
/** Options for workflow extend run lease. */
|
|
239
|
+
interface WorkflowExtendRunLeaseOptions {
|
|
240
|
+
readonly runId: RunId;
|
|
241
|
+
readonly workerId: string;
|
|
242
|
+
readonly attempts?: number;
|
|
243
|
+
readonly now: Temporal.Instant;
|
|
244
|
+
readonly leaseDuration: Temporal.Duration;
|
|
245
|
+
}
|
|
246
|
+
/** Options for workflow release run lease. */
|
|
247
|
+
interface WorkflowReleaseRunLeaseOptions {
|
|
248
|
+
readonly runId: RunId;
|
|
249
|
+
readonly workerId: string;
|
|
250
|
+
readonly attempts?: number;
|
|
251
|
+
readonly now: Temporal.Instant;
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
export { CreateWorkflowStoreOptions, WorkflowClaimRunOptions, WorkflowCleanupIndexKey, WorkflowCleanupIndexValue, WorkflowCleanupRepository, WorkflowConditionalEventAppender, WorkflowEventAppender, WorkflowEventHistoryChangeWaitOptions, WorkflowEventHistoryWatcher, WorkflowEventLog, WorkflowEventReader, WorkflowExtendRunLeaseOptions, WorkflowIdempotencyIndex, WorkflowIdempotencyKeyOptions, WorkflowLockConditionalWriterRepository, WorkflowLockListerRepository, WorkflowLockReaderRepository, WorkflowLockRepository, WorkflowMessageIdempotencyIndex, WorkflowMessageIdempotencyIndexLookup, WorkflowMessageIdempotencyRepairModel, WorkflowReleaseRunLeaseOptions, WorkflowRunConditionalWriterRepository, WorkflowRunCreationRepository, WorkflowRunLeaseRepository, WorkflowRunListerRepository, WorkflowRunQueryRepository, WorkflowRunReaderRepository, WorkflowRunRepository, WorkflowRunUnconditionalWriterRepository, WorkflowRunWriterRepository, WorkflowScheduleConditionalWriterRepository, WorkflowScheduleCreationRepository, WorkflowScheduleListerRepository, WorkflowScheduleQueryRepository, WorkflowScheduleReaderRepository, WorkflowScheduleRepository, WorkflowStepAttemptLookup, WorkflowStepAttemptReadModel, WorkflowStorage, WorkflowStore, WorkflowStoreCapabilities, WorkflowStoreCapabilitiesSource, WorkflowStoreMetadata, WorkflowStoreNamespace, WorkflowStoreStorageContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { RunId } from "./run-id.mjs";
|
|
2
|
+
import { PageOptions, WorkflowPage } from "./pagination.mjs";
|
|
3
|
+
import { StreamId } from "./stream-id.mjs";
|
|
4
|
+
import "./run.mjs";
|
|
5
|
+
import { WorkflowErrorRecord } from "./error.mjs";
|
|
6
|
+
import { StorageValue } from "@temelj/storage";
|
|
7
|
+
//#region src/types/stream.d.ts
|
|
8
|
+
/** Writable durable stream created by workflow code and persisted in run history. */
|
|
9
|
+
interface Stream<TChunk = unknown> {
|
|
10
|
+
/** Stable stream ID recorded in workflow history. */
|
|
11
|
+
readonly id: StreamId;
|
|
12
|
+
/** User-facing stream name used to look up the stream. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** Optional MIME type or content type associated with stream chunks. */
|
|
15
|
+
readonly contentType?: string;
|
|
16
|
+
/** Optional persisted stream metadata. */
|
|
17
|
+
readonly metadata?: unknown;
|
|
18
|
+
/** Appends one chunk to the stream. */
|
|
19
|
+
write(chunk: TChunk): Promise<void>;
|
|
20
|
+
/** Closes the stream successfully. */
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
/** Fails the stream with an error that readers can observe. */
|
|
23
|
+
error(error: unknown): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/** Options for creating a durable stream from workflow code. */
|
|
26
|
+
interface CreateStreamOptions {
|
|
27
|
+
readonly id?: StreamId;
|
|
28
|
+
readonly contentType?: string;
|
|
29
|
+
readonly metadata?: unknown;
|
|
30
|
+
readonly maximumChunks?: number;
|
|
31
|
+
}
|
|
32
|
+
/** Options for reading durable stream chunks by index or from the tail. */
|
|
33
|
+
interface ReadStreamOptions {
|
|
34
|
+
readonly fromIndex?: number;
|
|
35
|
+
readonly fromTail?: number;
|
|
36
|
+
readonly maxChunks?: number;
|
|
37
|
+
}
|
|
38
|
+
/** Paginated stream read options combining stream offsets with cursor paging. */
|
|
39
|
+
type ReadStreamPageOptions = ReadStreamOptions & PageOptions;
|
|
40
|
+
/** Options for following stream updates until cancellation or a terminal stream event. */
|
|
41
|
+
interface FollowStreamOptions extends ReadStreamOptions {
|
|
42
|
+
readonly pollInterval?: Temporal.Duration;
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
readonly includeTerminal?: boolean;
|
|
45
|
+
readonly pageSize?: number;
|
|
46
|
+
}
|
|
47
|
+
/** Options for polling stream availability or terminal state. */
|
|
48
|
+
interface WaitStreamOptions {
|
|
49
|
+
readonly pollInterval?: Temporal.Duration;
|
|
50
|
+
readonly signal?: AbortSignal;
|
|
51
|
+
}
|
|
52
|
+
/** Terminal-aware status of a durable workflow stream. */
|
|
53
|
+
type StreamStatus = "open" | "closed" | "failed";
|
|
54
|
+
/** Single ordered value written to a durable workflow stream. */
|
|
55
|
+
interface StreamChunk<TChunk = unknown> {
|
|
56
|
+
readonly index: number;
|
|
57
|
+
readonly timestamp: Temporal.Instant;
|
|
58
|
+
readonly value: TChunk;
|
|
59
|
+
}
|
|
60
|
+
/** Current durable stream state including chunk history and optional terminal error. */
|
|
61
|
+
interface StreamState<TChunk = unknown> {
|
|
62
|
+
readonly runId: RunId;
|
|
63
|
+
readonly id: StreamId;
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly status: StreamStatus;
|
|
66
|
+
readonly createdAt: Temporal.Instant;
|
|
67
|
+
readonly updatedAt: Temporal.Instant;
|
|
68
|
+
readonly contentType?: string;
|
|
69
|
+
readonly metadata?: StorageValue;
|
|
70
|
+
readonly chunkCount: number;
|
|
71
|
+
readonly lastIndex?: number;
|
|
72
|
+
readonly chunks: readonly StreamChunk<TChunk>[];
|
|
73
|
+
readonly error?: WorkflowErrorRecord;
|
|
74
|
+
}
|
|
75
|
+
/** Durable stream metadata without chunk contents. */
|
|
76
|
+
interface StreamInfo {
|
|
77
|
+
readonly runId: RunId;
|
|
78
|
+
readonly id: StreamId;
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly status: StreamStatus;
|
|
81
|
+
readonly createdAt: Temporal.Instant;
|
|
82
|
+
readonly updatedAt: Temporal.Instant;
|
|
83
|
+
readonly contentType?: string;
|
|
84
|
+
readonly metadata?: StorageValue;
|
|
85
|
+
readonly chunkCount: number;
|
|
86
|
+
readonly lastIndex?: number;
|
|
87
|
+
readonly error?: WorkflowErrorRecord;
|
|
88
|
+
}
|
|
89
|
+
/** Paginated durable stream state where chunks are returned as a page. */
|
|
90
|
+
interface StreamPage<TChunk = unknown> {
|
|
91
|
+
readonly runId: RunId;
|
|
92
|
+
readonly id: StreamId;
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly status: StreamStatus;
|
|
95
|
+
readonly createdAt: Temporal.Instant;
|
|
96
|
+
readonly updatedAt: Temporal.Instant;
|
|
97
|
+
readonly contentType?: string;
|
|
98
|
+
readonly metadata?: StorageValue;
|
|
99
|
+
readonly chunkCount: number;
|
|
100
|
+
readonly lastIndex?: number;
|
|
101
|
+
readonly error?: WorkflowErrorRecord;
|
|
102
|
+
readonly chunks: WorkflowPage<StreamChunk<TChunk>>;
|
|
103
|
+
}
|
|
104
|
+
/** Incremental update emitted when a durable stream chunk is written. */
|
|
105
|
+
type StreamUpdateKind = "chunk" | "closed" | "failed";
|
|
106
|
+
/** Base contract for incremental durable stream updates. */
|
|
107
|
+
interface StreamUpdateBase {
|
|
108
|
+
readonly kind: StreamUpdateKind;
|
|
109
|
+
readonly runId: RunId;
|
|
110
|
+
readonly streamId: StreamId;
|
|
111
|
+
readonly streamName: string;
|
|
112
|
+
}
|
|
113
|
+
/** Incremental update emitted when a durable stream chunk is written. */
|
|
114
|
+
type StreamChunkUpdate<TChunk = unknown> = StreamUpdateBase & {
|
|
115
|
+
readonly kind: "chunk";
|
|
116
|
+
readonly chunk: StreamChunk<TChunk>;
|
|
117
|
+
};
|
|
118
|
+
/** Incremental update emitted when a durable stream closes or fails. */
|
|
119
|
+
type StreamTerminalUpdate = StreamUpdateBase & {
|
|
120
|
+
readonly kind: "closed" | "failed";
|
|
121
|
+
readonly info: StreamInfo;
|
|
122
|
+
};
|
|
123
|
+
/** Incremental durable stream update yielded while following a stream. */
|
|
124
|
+
type StreamUpdate<TChunk = unknown> = StreamChunkUpdate<TChunk> | StreamTerminalUpdate;
|
|
125
|
+
//#endregion
|
|
126
|
+
export { CreateStreamOptions, FollowStreamOptions, ReadStreamOptions, ReadStreamPageOptions, Stream, StreamChunk, StreamChunkUpdate, StreamInfo, StreamPage, StreamState, StreamStatus, StreamTerminalUpdate, StreamUpdate, StreamUpdateBase, StreamUpdateKind, WaitStreamOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|