@temelj/workflow 0.0.0-alpha.3 → 0.0.0-alpha.4
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/README.md +394 -2
- package/dist/attributes.d.mts +11 -9
- package/dist/attributes.mjs +23 -5
- package/dist/bundle.d.mts +5 -23
- package/dist/bundle.mjs +2 -18
- package/dist/client/create.d.mts +26 -23
- package/dist/client/create.mjs +26 -32
- package/dist/client/facades.d.mts +12 -18
- package/dist/client/facades.mjs +102 -93
- package/dist/client/mod.mjs +1 -2
- package/dist/client/run-handle.d.mts +17 -54
- package/dist/client/run-handle.mjs +35 -105
- package/dist/client/worker-options.d.mts +8 -8
- package/dist/client/worker-options.mjs +11 -11
- package/dist/cloudflare/cloudflare.d.mts +4 -5
- package/dist/cloudflare/codec.d.mts +28 -13
- package/dist/cloudflare/codec.mjs +40 -17
- package/dist/cloudflare/entrypoint.d.mts +3 -4
- package/dist/cloudflare/entrypoint.mjs +4 -3
- package/dist/cloudflare/execution.d.mts +3 -4
- package/dist/cloudflare/execution.mjs +20 -13
- package/dist/cloudflare/host.d.mts +6 -7
- package/dist/cloudflare/host.mjs +7 -6
- package/dist/cloudflare/mod.d.mts +4 -4
- package/dist/cloudflare/mod.mjs +2 -2
- package/dist/cloudflare/name.d.mts +3 -4
- package/dist/cloudflare/name.mjs +3 -3
- package/dist/cloudflare/registry.d.mts +3 -23
- package/dist/cloudflare/registry.mjs +2 -20
- package/dist/cloudflare/runtime.d.mts +11 -18
- package/dist/cloudflare/runtime.mjs +52 -73
- package/dist/cloudflare/step.d.mts +6 -6
- package/dist/cloudflare/step.mjs +69 -57
- package/dist/cloudflare/types.d.mts +17 -36
- package/dist/collection.d.mts +8 -11
- package/dist/collection.mjs +10 -14
- package/dist/compiled-function.d.mts +14 -19
- package/dist/compiled-function.mjs +12 -24
- package/dist/compiled.d.mts +4 -0
- package/dist/compiled.mjs +4 -0
- package/dist/compiler/ast.d.mts +26 -0
- package/dist/{vite → compiler}/ast.mjs +24 -16
- package/dist/{vite → compiler}/error.d.mts +4 -6
- package/dist/{vite → compiler}/error.mjs +14 -16
- package/dist/compiler/manifest.d.mts +6 -0
- package/dist/{vite → compiler}/manifest.mjs +9 -7
- package/dist/compiler/plugin.d.mts +7 -0
- package/dist/{vite → compiler}/plugin.mjs +45 -46
- package/dist/compiler/safety.d.mts +12 -0
- package/dist/{vite → compiler}/safety.mjs +5 -11
- package/dist/{vite → compiler}/source-edit.d.mts +3 -4
- package/dist/{vite → compiler}/source-edit.mjs +1 -1
- package/dist/{vite → compiler}/source-map.d.mts +4 -3
- package/dist/{vite → compiler}/source-map.mjs +3 -3
- package/dist/compiler/source.d.mts +7 -0
- package/dist/{vite → compiler}/source.mjs +1 -1
- package/dist/compiler/transform.d.mts +12 -0
- package/dist/{vite → compiler}/transform.mjs +37 -38
- package/dist/definition.d.mts +17 -25
- package/dist/definition.mjs +19 -35
- package/dist/engine/child-workflow.d.mts +5 -9
- package/dist/engine/child-workflow.mjs +46 -67
- package/dist/engine/command-identity.d.mts +5 -6
- package/dist/engine/command-identity.mjs +9 -5
- package/dist/engine/context.d.mts +17 -0
- package/dist/engine/create.d.mts +36 -94
- package/dist/engine/create.mjs +55 -260
- package/dist/engine/deterministic.d.mts +6 -11
- package/dist/engine/deterministic.mjs +47 -68
- package/dist/engine/durable-command.d.mts +5 -5
- package/dist/engine/durable-command.mjs +2 -2
- package/dist/engine/execution-service.d.mts +20 -24
- package/dist/engine/execution-service.mjs +54 -52
- package/dist/engine/hooks.d.mts +17 -39
- package/dist/engine/hooks.mjs +73 -94
- package/dist/engine/inspection.d.mts +23 -15
- package/dist/engine/inspection.mjs +55 -29
- package/dist/engine/lifecycle.d.mts +6 -12
- package/dist/engine/lifecycle.mjs +5 -5
- package/dist/engine/lock-replay.d.mts +8 -15
- package/dist/engine/lock-replay.mjs +12 -25
- package/dist/engine/lock.d.mts +10 -15
- package/dist/engine/lock.mjs +65 -51
- package/dist/engine/message.d.mts +14 -34
- package/dist/engine/message.mjs +94 -127
- package/dist/engine/observation.d.mts +9 -11
- package/dist/engine/observation.mjs +18 -27
- package/dist/engine/replay.d.mts +18 -19
- package/dist/engine/replay.mjs +32 -56
- package/dist/engine/resume.d.mts +16 -0
- package/dist/engine/resume.mjs +24 -0
- package/dist/engine/retry.d.mts +15 -19
- package/dist/engine/retry.mjs +17 -17
- package/dist/engine/run-data.d.mts +4 -8
- package/dist/engine/run-data.mjs +24 -22
- package/dist/engine/run-service.d.mts +24 -33
- package/dist/engine/run-service.mjs +125 -93
- package/dist/engine/run-utils.d.mts +11 -13
- package/dist/engine/run-utils.mjs +23 -46
- package/dist/engine/schedule.d.mts +8 -22
- package/dist/engine/schedule.mjs +37 -34
- package/dist/engine/serialization.d.mts +9 -6
- package/dist/engine/serialization.mjs +30 -21
- package/dist/engine/signals.d.mts +23 -0
- package/dist/engine/signals.mjs +41 -0
- package/dist/engine/start.d.mts +18 -0
- package/dist/engine/start.mjs +88 -0
- package/dist/engine/state.d.mts +37 -67
- package/dist/engine/state.mjs +119 -280
- package/dist/engine/step-api.d.mts +5 -8
- package/dist/engine/step-api.mjs +16 -16
- package/dist/engine/stream-reader.d.mts +12 -0
- package/dist/engine/stream-reader.mjs +154 -0
- package/dist/engine/stream.d.mts +9 -54
- package/dist/engine/stream.mjs +54 -196
- package/dist/engine/summary/recovery.d.mts +35 -0
- package/dist/engine/summary/recovery.mjs +363 -0
- package/dist/engine/summary/runs.d.mts +43 -0
- package/dist/engine/summary/runs.mjs +294 -0
- package/dist/engine/summary/step-attempts.d.mts +5 -10
- package/dist/engine/summary/step-attempts.mjs +157 -36
- package/dist/engine/summary/tally.d.mts +44 -0
- package/dist/engine/summary/tally.mjs +142 -0
- package/dist/engine/task.d.mts +4 -5
- package/dist/engine/task.mjs +40 -48
- package/dist/errors/base.d.mts +17 -77
- package/dist/errors/base.mjs +26 -327
- package/dist/errors/capability.d.mts +3 -6
- package/dist/errors/capability.mjs +4 -8
- package/dist/errors/codes.d.mts +116 -0
- package/dist/{types/error-code.mjs → errors/codes.mjs} +2 -17
- package/dist/errors/definition.d.mts +3 -17
- package/dist/errors/definition.mjs +5 -42
- package/dist/errors/failures.d.mts +17 -51
- package/dist/errors/failures.mjs +35 -102
- package/dist/errors/hook.d.mts +5 -9
- package/dist/errors/hook.mjs +4 -16
- package/dist/errors/implementation.d.mts +3 -6
- package/dist/errors/implementation.mjs +7 -12
- package/dist/errors/lock.d.mts +7 -20
- package/dist/errors/lock.mjs +8 -44
- package/dist/errors/message.d.mts +14 -59
- package/dist/errors/message.mjs +13 -39
- package/dist/errors/mod.d.mts +4 -5
- package/dist/errors/mod.mjs +5 -7
- package/dist/errors/records.d.mts +10 -4
- package/dist/errors/records.mjs +256 -256
- package/dist/errors/run.d.mts +27 -68
- package/dist/errors/run.mjs +31 -85
- package/dist/errors/schedule.d.mts +7 -18
- package/dist/errors/schedule.mjs +7 -39
- package/dist/errors/step.d.mts +12 -45
- package/dist/errors/step.mjs +13 -34
- package/dist/errors/stream.d.mts +8 -16
- package/dist/errors/stream.mjs +7 -41
- package/dist/esbuild.d.mts +6 -4
- package/dist/esbuild.mjs +2 -1
- package/dist/events/descriptors.d.mts +12 -241
- package/dist/events/descriptors.mjs +12 -5
- package/dist/history/projection.d.mts +4 -6
- package/dist/history/projection.mjs +22 -26
- package/dist/history/replay-projection.d.mts +44 -48
- package/dist/history/replay-projection.mjs +41 -50
- package/dist/history/{mod.d.mts → replay.d.mts} +16 -21
- package/dist/history/{mod.mjs → replay.mjs} +21 -25
- package/dist/history/sequencer.d.mts +10 -11
- package/dist/history/sequencer.mjs +11 -7
- package/dist/history/step-attempts.d.mts +4 -7
- package/dist/history/step-attempts.mjs +8 -9
- package/dist/history/timeline.d.mts +4 -13
- package/dist/history/timeline.mjs +46 -265
- package/dist/history/validator.d.mts +5 -7
- package/dist/history/validator.mjs +9 -24
- package/dist/hook-token.d.mts +7 -0
- package/dist/hook-token.mjs +32 -0
- package/dist/ids.d.mts +8 -0
- package/dist/ids.mjs +21 -0
- package/dist/message-options.d.mts +11 -5
- package/dist/message-options.mjs +9 -7
- package/dist/mod.d.mts +32 -36
- package/dist/mod.mjs +9 -13
- package/dist/otel/metrics.d.mts +31 -0
- package/dist/otel/metrics.mjs +60 -0
- package/dist/otel/mod.d.mts +3 -0
- package/dist/otel/mod.mjs +3 -0
- package/dist/otel/spans.d.mts +24 -0
- package/dist/otel/spans.mjs +218 -0
- package/dist/otel/support.d.mts +15 -8
- package/dist/otel/support.mjs +18 -40
- package/dist/{otel.d.mts → otel/telemetry.d.mts} +5 -6
- package/dist/otel/telemetry.mjs +305 -0
- package/dist/pagination.d.mts +6 -12
- package/dist/pagination.mjs +10 -14
- package/dist/registry.d.mts +8 -5
- package/dist/registry.mjs +19 -10
- package/dist/rolldown.d.mts +6 -4
- package/dist/rolldown.mjs +2 -1
- package/dist/rollup.d.mts +6 -4
- package/dist/rollup.mjs +2 -1
- package/dist/rspack.d.mts +6 -4
- package/dist/rspack.mjs +2 -1
- package/dist/run-status.d.mts +29 -0
- package/dist/run-status.mjs +42 -0
- package/dist/schema/common.d.mts +22 -0
- package/dist/schema/common.mjs +54 -0
- package/dist/schema/error.d.mts +17 -0
- package/dist/schema/error.mjs +39 -0
- package/dist/schema/events.d.mts +446 -0
- package/dist/schema/events.mjs +235 -0
- package/dist/schema/pagination.d.mts +5 -0
- package/dist/schema/pagination.mjs +11 -0
- package/dist/schema/persisted-value.d.mts +8 -0
- package/dist/schema/persisted-value.mjs +94 -0
- package/dist/schema/run.d.mts +51 -0
- package/dist/schema/run.mjs +88 -0
- package/dist/schema/store.d.mts +94 -0
- package/dist/schema/store.mjs +116 -0
- package/dist/step-definition.d.mts +4 -9
- package/dist/step-definition.mjs +2 -2
- package/dist/store/capabilities.d.mts +8 -9
- package/dist/store/capabilities.mjs +7 -7
- package/dist/store/cleanup.d.mts +9 -14
- package/dist/store/cleanup.mjs +86 -85
- package/dist/store/create.d.mts +28 -29
- package/dist/store/create.mjs +10 -11
- package/dist/store/events.d.mts +48 -0
- package/dist/store/events.mjs +263 -0
- package/dist/store/indexes.d.mts +25 -0
- package/dist/store/indexes.mjs +282 -0
- package/dist/store/instrumentation.d.mts +2 -3
- package/dist/store/instrumentation.mjs +30 -30
- package/dist/store/lock.d.mts +4 -5
- package/dist/store/lock.mjs +5 -7
- package/dist/store/materialization.d.mts +10 -17
- package/dist/store/materialization.mjs +39 -33
- package/dist/store/mod.d.mts +3 -3
- package/dist/store/mod.mjs +2 -2
- package/dist/store/query.d.mts +13 -17
- package/dist/store/query.mjs +13 -13
- package/dist/store/run.d.mts +25 -34
- package/dist/store/run.mjs +67 -108
- package/dist/store/schedule.d.mts +6 -8
- package/dist/store/schedule.mjs +11 -11
- package/dist/store/step-attempt.d.mts +9 -12
- package/dist/store/step-attempt.mjs +9 -9
- package/dist/store/storage-value.d.mts +3 -3
- package/dist/store/storage-value.mjs +17 -1
- package/dist/store/validation.d.mts +17 -20
- package/dist/store/validation.mjs +30 -33
- package/dist/store-keys.d.mts +35 -47
- package/dist/store-keys.mjs +9 -17
- package/dist/telemetry.d.mts +16 -16
- package/dist/telemetry.mjs +3 -3
- package/dist/temporal.d.mts +11 -16
- package/dist/temporal.mjs +8 -9
- package/dist/timer.d.mts +12 -10
- package/dist/timer.mjs +11 -3
- package/dist/types/cleanup.d.mts +13 -50
- package/dist/types/cleanup.mjs +1 -22
- package/dist/types/client.d.mts +101 -162
- package/dist/types/{vite.d.mts → compiler.d.mts} +17 -24
- package/dist/types/compiler.mjs +1 -0
- package/dist/types/definition.d.mts +22 -34
- package/dist/types/engine-options.d.mts +10 -17
- package/dist/types/engine.d.mts +15 -274
- package/dist/types/error.d.mts +15 -217
- package/dist/types/error.mjs +1 -48
- package/dist/types/events.d.mts +59 -2730
- package/dist/types/events.mjs +1 -283
- package/dist/types/hook.d.mts +27 -85
- package/dist/types/hook.mjs +1 -66
- package/dist/types/ids.d.mts +9 -0
- package/dist/types/ids.mjs +1 -0
- package/dist/types/lock.d.mts +8 -26
- package/dist/types/lock.mjs +1 -18
- package/dist/types/message.d.mts +29 -43
- package/dist/types/observation.d.mts +43 -58
- package/dist/types/pagination.d.mts +6 -22
- package/dist/types/pagination.mjs +1 -13
- package/dist/types/result.d.mts +11 -43
- package/dist/types/retry.d.mts +7 -14
- package/dist/types/run-list.d.mts +9 -11
- package/dist/types/run-options.d.mts +25 -32
- package/dist/types/run.d.mts +35 -315
- package/dist/types/run.mjs +1 -207
- package/dist/types/runtime.d.mts +33 -145
- package/dist/types/runtime.mjs +1 -21
- package/dist/types/schedule.d.mts +13 -72
- package/dist/types/schedule.mjs +1 -48
- package/dist/types/step-attempts.d.mts +65 -261
- package/dist/types/step-attempts.mjs +1 -43
- package/dist/types/step.d.mts +66 -77
- package/dist/types/step.mjs +1 -5
- package/dist/types/store.d.mts +50 -182
- package/dist/types/stream.d.mts +19 -40
- package/dist/types/summary.d.mts +174 -278
- package/dist/types/telemetry.d.mts +23 -28
- package/dist/types/telemetry.mjs +1 -9
- package/dist/types/timeline.d.mts +46 -233
- package/dist/types/worker.d.mts +22 -29
- package/dist/values.d.mts +15 -0
- package/dist/values.mjs +57 -0
- package/dist/vite.d.mts +5 -6
- package/dist/vite.mjs +3 -4
- package/dist/webpack.d.mts +6 -4
- package/dist/webpack.mjs +2 -1
- package/dist/worker/error.d.mts +2 -9
- package/dist/worker/error.mjs +20 -32
- package/dist/worker/missing-implementation.d.mts +19 -0
- package/dist/worker/missing-implementation.mjs +62 -0
- package/dist/worker/worker.d.mts +18 -0
- package/dist/{worker.mjs → worker/worker.mjs} +64 -118
- package/package.json +28 -47
- package/dist/engine/execution-api.d.mts +0 -29
- package/dist/engine/execution-api.mjs +0 -33
- package/dist/engine/inspection-api.d.mts +0 -34
- package/dist/engine/inspection-api.mjs +0 -78
- package/dist/engine/mod.d.mts +0 -4
- package/dist/engine/mod.mjs +0 -2
- package/dist/engine/recovery.d.mts +0 -26
- package/dist/engine/recovery.mjs +0 -92
- package/dist/engine/retry-policy.d.mts +0 -4
- package/dist/engine/retry-policy.mjs +0 -4
- package/dist/engine/start-api.d.mts +0 -30
- package/dist/engine/start-api.mjs +0 -99
- package/dist/engine/summary/active-events.d.mts +0 -34
- package/dist/engine/summary/active-events.mjs +0 -69
- package/dist/engine/summary/child-workflow-runs.d.mts +0 -24
- package/dist/engine/summary/child-workflow-runs.mjs +0 -138
- package/dist/engine/summary/child-workflow-waits.d.mts +0 -21
- package/dist/engine/summary/child-workflow-waits.mjs +0 -67
- package/dist/engine/summary/recovery-child-workflow-waits.d.mts +0 -11
- package/dist/engine/summary/recovery-child-workflow-waits.mjs +0 -89
- package/dist/engine/summary/recovery-due-runs.d.mts +0 -16
- package/dist/engine/summary/recovery-due-runs.mjs +0 -52
- package/dist/engine/summary/recovery-failed-runs.d.mts +0 -14
- package/dist/engine/summary/recovery-failed-runs.mjs +0 -33
- package/dist/engine/summary/recovery-lease-runs.d.mts +0 -16
- package/dist/engine/summary/recovery-lease-runs.mjs +0 -69
- package/dist/engine/summary/recovery-locks.d.mts +0 -18
- package/dist/engine/summary/recovery-locks.mjs +0 -100
- package/dist/engine/summary/recovery-message-waits.d.mts +0 -11
- package/dist/engine/summary/recovery-message-waits.mjs +0 -74
- package/dist/engine/summary/recovery-retry-runs.d.mts +0 -17
- package/dist/engine/summary/recovery-retry-runs.mjs +0 -65
- package/dist/engine/summary/recovery-run-timestamps.d.mts +0 -13
- package/dist/engine/summary/recovery-run-timestamps.mjs +0 -18
- package/dist/engine/summary/recovery-runs.d.mts +0 -23
- package/dist/engine/summary/recovery-runs.mjs +0 -54
- package/dist/engine/summary/recovery-schedules.d.mts +0 -10
- package/dist/engine/summary/recovery-schedules.mjs +0 -46
- package/dist/engine/summary/recovery-sleep-waits.d.mts +0 -10
- package/dist/engine/summary/recovery-sleep-waits.mjs +0 -53
- package/dist/engine/summary/recovery-waits.d.mts +0 -21
- package/dist/engine/summary/recovery-waits.mjs +0 -29
- package/dist/engine/summary/run-availability.d.mts +0 -13
- package/dist/engine/summary/run-availability.mjs +0 -37
- package/dist/engine/summary/run-cleanup.d.mts +0 -14
- package/dist/engine/summary/run-cleanup.mjs +0 -44
- package/dist/engine/summary/run-failure.d.mts +0 -14
- package/dist/engine/summary/run-failure.mjs +0 -62
- package/dist/engine/summary/run-hooks.d.mts +0 -14
- package/dist/engine/summary/run-hooks.mjs +0 -63
- package/dist/engine/summary/run-lease.d.mts +0 -11
- package/dist/engine/summary/run-lease.mjs +0 -64
- package/dist/engine/summary/run-message-waits.d.mts +0 -15
- package/dist/engine/summary/run-message-waits.mjs +0 -62
- package/dist/engine/summary/run-metrics.d.mts +0 -31
- package/dist/engine/summary/run-metrics.mjs +0 -93
- package/dist/engine/summary/run-retry.d.mts +0 -9
- package/dist/engine/summary/run-retry.mjs +0 -69
- package/dist/engine/summary/run-sleeps.d.mts +0 -15
- package/dist/engine/summary/run-sleeps.mjs +0 -61
- package/dist/engine/summary/run-state.d.mts +0 -26
- package/dist/engine/summary/run-state.mjs +0 -48
- package/dist/engine/summary/run-status.d.mts +0 -16
- package/dist/engine/summary/run-status.mjs +0 -35
- package/dist/engine/summary/run-streams.d.mts +0 -14
- package/dist/engine/summary/run-streams.mjs +0 -46
- package/dist/engine/summary/run-transition.d.mts +0 -9
- package/dist/engine/summary/run-transition.mjs +0 -39
- package/dist/engine/summary/run-workflow.d.mts +0 -9
- package/dist/engine/summary/run-workflow.mjs +0 -47
- package/dist/engine/summary/step-attempt-active-child-workflows.d.mts +0 -13
- package/dist/engine/summary/step-attempt-active-child-workflows.mjs +0 -55
- package/dist/engine/summary/step-attempt-active-fields.d.mts +0 -23
- package/dist/engine/summary/step-attempt-active-fields.mjs +0 -14
- package/dist/engine/summary/step-attempt-active-message-waits.d.mts +0 -12
- package/dist/engine/summary/step-attempt-active-message-waits.mjs +0 -47
- package/dist/engine/summary/step-attempt-active-sleeps.d.mts +0 -19
- package/dist/engine/summary/step-attempt-active-sleeps.mjs +0 -44
- package/dist/engine/summary/step-attempt-buckets.d.mts +0 -22
- package/dist/engine/summary/step-attempt-buckets.mjs +0 -152
- package/dist/engine/summary/step-attempt-failure.d.mts +0 -12
- package/dist/engine/summary/step-attempt-failure.mjs +0 -61
- package/dist/engine/summary/step-attempt-lifecycle.d.mts +0 -13
- package/dist/engine/summary/step-attempt-lifecycle.mjs +0 -19
- package/dist/engine/summary.d.mts +0 -32
- package/dist/engine/summary.mjs +0 -37
- package/dist/errors/details.d.mts +0 -13
- package/dist/errors/details.mjs +0 -66
- package/dist/errors/record-view.d.mts +0 -11
- package/dist/errors/record-view.mjs +0 -24
- package/dist/errors/runtime.d.mts +0 -12
- package/dist/errors/runtime.mjs +0 -24
- package/dist/events/mod.d.mts +0 -3
- package/dist/events/mod.mjs +0 -2
- package/dist/history/attempt-key.d.mts +0 -6
- package/dist/history/attempt-key.mjs +0 -7
- package/dist/inspection/mod.d.mts +0 -5
- package/dist/inspection/mod.mjs +0 -3
- package/dist/otel.mjs +0 -590
- package/dist/runtime.d.mts +0 -35
- package/dist/runtime.mjs +0 -198
- package/dist/store/append-projection.d.mts +0 -15
- package/dist/store/append-projection.mjs +0 -26
- package/dist/store/compaction.d.mts +0 -5
- package/dist/store/compaction.mjs +0 -8
- package/dist/store/event-append-project.d.mts +0 -15
- package/dist/store/event-append-project.mjs +0 -77
- package/dist/store/event-append.d.mts +0 -37
- package/dist/store/event-append.mjs +0 -80
- package/dist/store/event-history.d.mts +0 -22
- package/dist/store/event-history.mjs +0 -75
- package/dist/store/event.d.mts +0 -10
- package/dist/store/event.mjs +0 -28
- package/dist/store/idempotency.d.mts +0 -10
- package/dist/store/idempotency.mjs +0 -167
- package/dist/store/message-index.d.mts +0 -21
- package/dist/store/message-index.mjs +0 -122
- package/dist/store/revision.d.mts +0 -4
- package/dist/store/revision.mjs +0 -7
- package/dist/store/schema.d.mts +0 -14
- package/dist/store/schema.mjs +0 -17
- package/dist/types/common.d.mts +0 -20
- package/dist/types/common.mjs +0 -16
- package/dist/types/error-code.d.mts +0 -256
- package/dist/types/message-id.d.mts +0 -7
- package/dist/types/message-id.mjs +0 -5
- package/dist/types/run-id.d.mts +0 -7
- package/dist/types/run-id.mjs +0 -5
- package/dist/types/step-id.d.mts +0 -7
- package/dist/types/step-id.mjs +0 -5
- package/dist/types/stream-id.d.mts +0 -7
- package/dist/types/stream-id.mjs +0 -5
- package/dist/types/worker-id.d.mts +0 -7
- package/dist/types/worker-id.mjs +0 -5
- package/dist/utility.d.mts +0 -49
- package/dist/utility.mjs +0 -122
- package/dist/vite/ast.d.mts +0 -23
- package/dist/vite/generated-name.d.mts +0 -7
- package/dist/vite/generated-name.mjs +0 -9
- package/dist/vite/manifest.d.mts +0 -7
- package/dist/vite/plugin.d.mts +0 -7
- package/dist/vite/safety.d.mts +0 -12
- package/dist/vite/source.d.mts +0 -7
- package/dist/vite/transform.d.mts +0 -7
- package/dist/webhook.d.mts +0 -16
- package/dist/webhook.mjs +0 -17
- package/dist/worker.d.mts +0 -19
- /package/dist/{types/vite.mjs → engine/context.mjs} +0 -0
package/dist/types/message.d.mts
CHANGED
|
@@ -1,69 +1,56 @@
|
|
|
1
|
-
import { MessageId } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { WorkflowListRunsOptions } from "./run-list.mjs";
|
|
1
|
+
import { MessageId, RunId } from "./ids.mjs";
|
|
2
|
+
import { ListRunsOptions } from "./run-list.mjs";
|
|
4
3
|
import { Schema } from "@temelj/standard-schema";
|
|
5
4
|
//#region src/types/message.d.ts
|
|
6
|
-
/**
|
|
7
|
-
interface MessageChannel<TPayload = unknown,
|
|
5
|
+
/** Schema-validated message channel bound to one durable message ID. */
|
|
6
|
+
export interface MessageChannel<TPayload = unknown, TRawPayload = unknown> {
|
|
8
7
|
readonly name: string;
|
|
9
|
-
readonly schema
|
|
10
|
-
readonly resolveMessageId: (...args: MessageChannelKeyArgs<TKey>) => MessageId;
|
|
11
|
-
readonly types?: MessageChannelTypes<TPayload, TKey>;
|
|
8
|
+
readonly schema: Schema<TRawPayload, TPayload>;
|
|
12
9
|
}
|
|
13
|
-
/** Compile-time payload and key markers carried by a message channel. */
|
|
14
|
-
interface MessageChannelTypes<TPayload, TKey> {
|
|
15
|
-
readonly payload: TPayload;
|
|
16
|
-
readonly key: TKey;
|
|
17
|
-
}
|
|
18
|
-
/** Argument tuple required when deriving a message id from a channel key. */
|
|
19
|
-
type MessageChannelKeyArgs<TKey> = [void] extends [TKey] ? [key?: TKey] : [key: TKey];
|
|
20
10
|
/** Configuration for defining a typed message channel. */
|
|
21
|
-
interface MessageChannelConfig<
|
|
11
|
+
export interface MessageChannelConfig<TPayload, TRawPayload = unknown> {
|
|
22
12
|
readonly name: string;
|
|
23
|
-
readonly schema
|
|
24
|
-
readonly resolveMessageId?: (...args: MessageChannelKeyArgs<TKey>) => MessageId;
|
|
13
|
+
readonly schema: Schema<TRawPayload, TPayload>;
|
|
25
14
|
}
|
|
26
15
|
/** Options for sending a concrete message id to a workflow run. */
|
|
27
|
-
interface SendMessageOptions {
|
|
16
|
+
export interface SendMessageOptions {
|
|
28
17
|
readonly messageId: MessageId;
|
|
29
18
|
readonly payload?: unknown;
|
|
30
19
|
readonly idempotencyKey?: string;
|
|
31
20
|
}
|
|
32
|
-
|
|
33
|
-
interface SendMessageChannelOptions<TPayload = unknown, TKey = void> {
|
|
34
|
-
readonly key?: TKey;
|
|
21
|
+
export interface SendMessageChannelOptions<TPayload = unknown> {
|
|
35
22
|
readonly payload?: TPayload;
|
|
36
23
|
readonly idempotencyKey?: string;
|
|
37
24
|
}
|
|
38
25
|
/** Object form for sending through a typed message channel. */
|
|
39
|
-
interface SendMessageChannelObject<TPayload = unknown,
|
|
40
|
-
readonly channel: MessageChannel<TPayload,
|
|
26
|
+
export interface SendMessageChannelObject<TPayload = unknown, TRawPayload = TPayload> extends SendMessageChannelOptions<TRawPayload> {
|
|
27
|
+
readonly channel: MessageChannel<TPayload, TRawPayload>;
|
|
41
28
|
}
|
|
42
29
|
/** Accepted input forms for sending a message to one run. */
|
|
43
|
-
type SendMessageInput = SendMessageOptions | SendMessageChannelObject;
|
|
30
|
+
export type SendMessageInput = SendMessageOptions | SendMessageChannelObject;
|
|
44
31
|
/** Options for broadcasting a concrete message id to matching runs. */
|
|
45
|
-
interface BroadcastMessageOptions extends SendMessageOptions {
|
|
32
|
+
export interface BroadcastMessageOptions extends SendMessageOptions {
|
|
46
33
|
readonly payload?: unknown;
|
|
47
|
-
readonly target?:
|
|
34
|
+
readonly target?: ListRunsOptions;
|
|
48
35
|
}
|
|
49
36
|
/** Options for broadcasting through a typed message channel to matching runs. */
|
|
50
|
-
interface BroadcastMessageChannelOptions<TPayload = unknown
|
|
51
|
-
readonly target?:
|
|
37
|
+
export interface BroadcastMessageChannelOptions<TPayload = unknown> extends SendMessageChannelOptions<TPayload> {
|
|
38
|
+
readonly target?: ListRunsOptions;
|
|
52
39
|
}
|
|
53
40
|
/** Object form for broadcasting through a typed message channel. */
|
|
54
|
-
interface BroadcastMessageChannelObject<TPayload = unknown,
|
|
55
|
-
readonly channel: MessageChannel<TPayload,
|
|
41
|
+
export interface BroadcastMessageChannelObject<TPayload = unknown, TRawPayload = TPayload> extends BroadcastMessageChannelOptions<TRawPayload> {
|
|
42
|
+
readonly channel: MessageChannel<TPayload, TRawPayload>;
|
|
56
43
|
}
|
|
57
44
|
/** Accepted input forms for broadcasting a message to matching runs. */
|
|
58
|
-
type BroadcastMessageInput = BroadcastMessageOptions | BroadcastMessageChannelObject;
|
|
45
|
+
export type BroadcastMessageInput = BroadcastMessageOptions | BroadcastMessageChannelObject;
|
|
59
46
|
/** Summary returned after broadcasting a message to matching runs. */
|
|
60
|
-
interface BroadcastMessageResult {
|
|
47
|
+
export interface BroadcastMessageResult {
|
|
61
48
|
readonly messageId: MessageId;
|
|
62
49
|
readonly runIds: RunId[];
|
|
63
50
|
readonly deliveredMessages: number;
|
|
64
51
|
}
|
|
65
52
|
/** Options for waiting on a concrete message id from workflow code. */
|
|
66
|
-
interface WaitForMessageOptions<TSchema extends Schema | undefined = undefined> {
|
|
53
|
+
export interface WaitForMessageOptions<TSchema extends Schema | undefined = undefined> {
|
|
67
54
|
readonly commandId?: string;
|
|
68
55
|
readonly name?: string;
|
|
69
56
|
readonly messageId: MessageId;
|
|
@@ -71,17 +58,16 @@ interface WaitForMessageOptions<TSchema extends Schema | undefined = undefined>
|
|
|
71
58
|
readonly schema?: TSchema;
|
|
72
59
|
}
|
|
73
60
|
/** Options for waiting through a typed message channel from workflow code. */
|
|
74
|
-
interface WaitForMessageChannelOptions
|
|
61
|
+
export interface WaitForMessageChannelOptions {
|
|
75
62
|
readonly commandId?: string;
|
|
76
63
|
readonly name?: string;
|
|
77
|
-
readonly key?: TKey;
|
|
78
64
|
readonly timeout?: Temporal.Duration;
|
|
79
65
|
}
|
|
80
|
-
/**
|
|
81
|
-
interface
|
|
82
|
-
|
|
66
|
+
/** Sends messages to workflow runs, by message ID or through a typed channel. */
|
|
67
|
+
export interface MessageSender {
|
|
68
|
+
/** Sends a named message to a workflow run. */
|
|
69
|
+
send(runId: RunId, options: SendMessageInput): Promise<void>;
|
|
70
|
+
/** Sends a payload through a typed message channel to a workflow run. */
|
|
71
|
+
send<TPayload, TRawPayload = TPayload>(runId: RunId, channel: MessageChannel<TPayload, TRawPayload>, options?: SendMessageChannelOptions<TRawPayload>): Promise<void>;
|
|
83
72
|
}
|
|
84
|
-
|
|
85
|
-
type WaitForMessageInput<TSchema extends Schema | undefined = undefined> = WaitForMessageOptions<TSchema> | WaitForMessageChannelObject;
|
|
86
|
-
//#endregion
|
|
87
|
-
export { BroadcastMessageChannelObject, BroadcastMessageChannelOptions, BroadcastMessageInput, BroadcastMessageOptions, BroadcastMessageResult, MessageChannel, MessageChannelConfig, MessageChannelKeyArgs, MessageChannelTypes, type MessageId, SendMessageChannelObject, SendMessageChannelOptions, SendMessageInput, SendMessageOptions, WaitForMessageChannelObject, WaitForMessageChannelOptions, WaitForMessageInput, WaitForMessageOptions };
|
|
73
|
+
//#endregion
|
|
@@ -1,46 +1,38 @@
|
|
|
1
|
-
import { MessageId } from "./
|
|
2
|
-
import {
|
|
1
|
+
import { MessageId, RunId, StreamId, WorkerId } from "./ids.mjs";
|
|
2
|
+
import { WorkflowErrorRecord } from "./error.mjs";
|
|
3
3
|
import { CleanupRunsResult } from "./cleanup.mjs";
|
|
4
|
+
import { HookKind } from "./hook.mjs";
|
|
4
5
|
import { ScheduleId, TickSchedulesResult } from "./schedule.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { WorkflowStepAttemptRecord } from "./step-attempts.mjs";
|
|
7
|
-
import { WorkerId } from "./worker-id.mjs";
|
|
6
|
+
import { StepAttemptRecord } from "./step-attempts.mjs";
|
|
8
7
|
import { TelemetryContext } from "./telemetry.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import { ChildWorkflowStartedEvent, EventRecord, MessageSentEvent, StreamEventKind
|
|
8
|
+
import { RunRecord, WorkflowLifecycleEvent } from "./run.mjs";
|
|
9
|
+
import { ChildWorkflowStartedEvent, EventRecord, MessageSentEvent, StreamEventKind } from "./events.mjs";
|
|
11
10
|
import { StorageValue } from "@temelj/storage";
|
|
12
|
-
import { EventHandler, EventPattern
|
|
11
|
+
import { EventHandler, EventPattern } from "@temelj/event";
|
|
13
12
|
//#region src/types/observation.d.ts
|
|
14
|
-
|
|
15
|
-
type RunObservationEvent = WorkflowLifecycleEvent;
|
|
16
|
-
/** Describes the workflow durable event observation event contract. */
|
|
17
|
-
interface DurableEventObservationEvent {
|
|
13
|
+
export interface DurableEventObservationEvent {
|
|
18
14
|
readonly runId: RunId;
|
|
19
15
|
readonly event: EventRecord;
|
|
20
16
|
readonly events: readonly EventRecord[];
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
interface StepAttemptObservationEvent {
|
|
18
|
+
export interface StepAttemptObservationEvent {
|
|
24
19
|
readonly runId: RunId;
|
|
25
|
-
readonly attempt:
|
|
20
|
+
readonly attempt: StepAttemptRecord;
|
|
26
21
|
}
|
|
27
|
-
|
|
28
|
-
interface MessageObservationEvent {
|
|
22
|
+
export interface MessageObservationEvent {
|
|
29
23
|
readonly runId: RunId;
|
|
30
24
|
readonly messageId: MessageId;
|
|
31
25
|
readonly payload?: StorageValue;
|
|
32
26
|
readonly timestamp?: Temporal.Instant;
|
|
33
27
|
readonly traceContext?: TelemetryContext;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
interface ResumeObservationEvent {
|
|
29
|
+
export interface ResumeObservationEvent {
|
|
37
30
|
readonly runId: RunId;
|
|
38
31
|
readonly messageId: MessageId;
|
|
39
32
|
readonly payload?: StorageValue;
|
|
40
33
|
readonly traceContext?: TelemetryContext;
|
|
41
34
|
}
|
|
42
|
-
|
|
43
|
-
interface StreamObservationEvent {
|
|
35
|
+
export interface StreamObservationEvent {
|
|
44
36
|
readonly runId: RunId;
|
|
45
37
|
readonly streamId: StreamId;
|
|
46
38
|
readonly streamName?: string;
|
|
@@ -49,29 +41,27 @@ interface StreamObservationEvent {
|
|
|
49
41
|
readonly stepId: string;
|
|
50
42
|
readonly stepName: string;
|
|
51
43
|
readonly index?: number;
|
|
52
|
-
readonly error?:
|
|
44
|
+
readonly error?: WorkflowErrorRecord;
|
|
53
45
|
}
|
|
54
|
-
|
|
55
|
-
interface ChildWorkflowStartedObservationEvent {
|
|
46
|
+
export interface ChildWorkflowStartedObservationEvent {
|
|
56
47
|
readonly runId: RunId;
|
|
57
48
|
readonly event: ChildWorkflowStartedEvent;
|
|
58
49
|
}
|
|
59
|
-
|
|
60
|
-
interface CleanupObservationEvent {
|
|
50
|
+
export interface CleanupObservationEvent {
|
|
61
51
|
readonly result: CleanupRunsResult;
|
|
62
52
|
}
|
|
63
53
|
/** Describes worker-side operation observations that are not durable run transitions. */
|
|
64
|
-
interface WorkerOperationObservationEvent {
|
|
54
|
+
export interface WorkerOperationObservationEvent {
|
|
65
55
|
readonly workerId: WorkerId;
|
|
66
56
|
readonly runId?: RunId;
|
|
67
57
|
readonly operation: "poll" | "claim" | "heartbeat" | "lease_extension" | "lease_release";
|
|
68
58
|
readonly status: "success" | "failure" | "claimed" | "empty";
|
|
69
59
|
readonly timestamp: Temporal.Instant;
|
|
70
|
-
readonly run?:
|
|
60
|
+
readonly run?: RunRecord;
|
|
71
61
|
readonly error?: unknown;
|
|
72
62
|
}
|
|
73
63
|
/** Describes one recurring schedule fire that created a workflow run. */
|
|
74
|
-
interface ScheduleRunCreatedObservationEvent {
|
|
64
|
+
export interface ScheduleRunCreatedObservationEvent {
|
|
75
65
|
readonly scheduleId: ScheduleId;
|
|
76
66
|
readonly runId: RunId;
|
|
77
67
|
readonly workflowName: string;
|
|
@@ -80,25 +70,24 @@ interface ScheduleRunCreatedObservationEvent {
|
|
|
80
70
|
readonly timestamp: Temporal.Instant;
|
|
81
71
|
}
|
|
82
72
|
/** Describes one recurring schedule tick operation. */
|
|
83
|
-
interface ScheduleTickObservationEvent {
|
|
73
|
+
export interface ScheduleTickObservationEvent {
|
|
84
74
|
readonly result: TickSchedulesResult;
|
|
85
75
|
readonly timestamp: Temporal.Instant;
|
|
86
76
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
readonly "workflow:run-
|
|
90
|
-
readonly "workflow:run-
|
|
91
|
-
readonly "workflow:run-
|
|
92
|
-
readonly "workflow:run-
|
|
93
|
-
readonly "workflow:run-
|
|
94
|
-
readonly "workflow:run-
|
|
95
|
-
readonly "workflow:run-
|
|
96
|
-
readonly "workflow:run-
|
|
97
|
-
readonly "workflow:run-
|
|
98
|
-
readonly "workflow:run-
|
|
99
|
-
readonly "workflow:run-
|
|
100
|
-
readonly "workflow:run-
|
|
101
|
-
readonly "workflow:run-metadata-updated": RunObservationEvent;
|
|
77
|
+
export interface ObservationEventMap {
|
|
78
|
+
readonly "workflow:run-created": WorkflowLifecycleEvent;
|
|
79
|
+
readonly "workflow:run-claimed": WorkflowLifecycleEvent;
|
|
80
|
+
readonly "workflow:run-started": WorkflowLifecycleEvent;
|
|
81
|
+
readonly "workflow:run-waiting": WorkflowLifecycleEvent;
|
|
82
|
+
readonly "workflow:run-rescheduled": WorkflowLifecycleEvent;
|
|
83
|
+
readonly "workflow:run-lease-released": WorkflowLifecycleEvent;
|
|
84
|
+
readonly "workflow:run-manual-retry": WorkflowLifecycleEvent;
|
|
85
|
+
readonly "workflow:run-permanently-failed": WorkflowLifecycleEvent;
|
|
86
|
+
readonly "workflow:run-retrying": WorkflowLifecycleEvent;
|
|
87
|
+
readonly "workflow:run-completed": WorkflowLifecycleEvent;
|
|
88
|
+
readonly "workflow:run-failed": WorkflowLifecycleEvent;
|
|
89
|
+
readonly "workflow:run-canceled": WorkflowLifecycleEvent;
|
|
90
|
+
readonly "workflow:run-metadata-updated": WorkflowLifecycleEvent;
|
|
102
91
|
readonly "workflow:durable-event-appended": DurableEventObservationEvent;
|
|
103
92
|
readonly "workflow:step-attempt-updated": StepAttemptObservationEvent;
|
|
104
93
|
readonly "workflow:message-sent": MessageObservationEvent;
|
|
@@ -112,14 +101,12 @@ interface ObservationEventMap {
|
|
|
112
101
|
readonly "workflow:schedule-ticked": ScheduleTickObservationEvent;
|
|
113
102
|
readonly "workflow:schedule-run-created": ScheduleRunCreatedObservationEvent;
|
|
114
103
|
}
|
|
115
|
-
/**
|
|
116
|
-
type
|
|
117
|
-
|
|
118
|
-
type ObservationEventHandler<Pattern extends ObservationEventPattern = ObservationEventPattern> = EventHandler<ObservationEventMap, Pattern>;
|
|
119
|
-
/** Type used for workflow observation unsubscribe values. */
|
|
120
|
-
type ObservationUnsubscribe = Unsubscribe;
|
|
104
|
+
/** An observation name paired with its corresponding payload. */
|
|
105
|
+
export type ObservationEventArgs = { [Key in keyof ObservationEventMap]: [name: Key, payload: ObservationEventMap[Key]]; }[keyof ObservationEventMap];
|
|
106
|
+
export type ObservationEventPattern = EventPattern<ObservationEventMap>;
|
|
107
|
+
export type ObservationEventHandler<Pattern extends ObservationEventPattern = ObservationEventPattern> = EventHandler<ObservationEventMap, Pattern>;
|
|
121
108
|
/** Internal emitter facade used to publish workflow observation events. */
|
|
122
|
-
interface ObservationEmitter {
|
|
109
|
+
export interface ObservationEmitter {
|
|
123
110
|
readonly on: <Pattern extends ObservationEventPattern>(pattern: Pattern, handler: ObservationEventHandler<Pattern>) => () => void;
|
|
124
111
|
readonly once: <Pattern extends ObservationEventPattern>(pattern: Pattern, handler: ObservationEventHandler<Pattern>) => () => void;
|
|
125
112
|
readonly off: <Pattern extends ObservationEventPattern>(pattern: Pattern, handler: ObservationEventHandler<Pattern>) => void;
|
|
@@ -129,12 +116,11 @@ interface ObservationEmitter {
|
|
|
129
116
|
};
|
|
130
117
|
readonly clearListeners: (pattern?: ObservationEventPattern) => void;
|
|
131
118
|
readonly listenerCount: (pattern?: ObservationEventPattern) => number;
|
|
132
|
-
readonly emitRunEvent: (run:
|
|
133
|
-
readonly emitRunMetadataUpdated: (run:
|
|
119
|
+
readonly emitRunEvent: (run: RunRecord, previousRun?: RunRecord) => void;
|
|
120
|
+
readonly emitRunMetadataUpdated: (run: RunRecord, previousRun?: RunRecord) => void;
|
|
134
121
|
readonly emitDurableEventAppended: (runId: RunId, event: EventRecord, events: readonly EventRecord[]) => void;
|
|
135
122
|
readonly emitMessageSent: (runId: RunId, event: MessageSentEvent) => void;
|
|
136
|
-
readonly emitHookResumed: (runId: RunId, messageId: MessageId, payload: StorageValue | undefined, traceContext: TelemetryContext | undefined) => void;
|
|
137
|
-
readonly emitWebhookResumed: (runId: RunId, messageId: MessageId, payload: StorageValue | undefined, traceContext: TelemetryContext | undefined) => void;
|
|
123
|
+
readonly emitHookResumed: (kind: HookKind, runId: RunId, messageId: MessageId, payload: StorageValue | undefined, traceContext: TelemetryContext | undefined) => void;
|
|
138
124
|
readonly emitChildWorkflowStarted: (event: ChildWorkflowStartedObservationEvent) => void;
|
|
139
125
|
readonly emitCleanupCompleted: (result: CleanupRunsResult) => void;
|
|
140
126
|
readonly emitRetentionApplied: (result: CleanupRunsResult) => void;
|
|
@@ -142,5 +128,4 @@ interface ObservationEmitter {
|
|
|
142
128
|
readonly emitScheduleTicked: (event: ScheduleTickObservationEvent) => void;
|
|
143
129
|
readonly emitScheduleRunCreated: (event: ScheduleRunCreatedObservationEvent) => void;
|
|
144
130
|
}
|
|
145
|
-
//#endregion
|
|
146
|
-
export { ChildWorkflowStartedObservationEvent, CleanupObservationEvent, DurableEventObservationEvent, MessageObservationEvent, ObservationEmitter, ObservationEventHandler, ObservationEventMap, ObservationEventPattern, ObservationUnsubscribe, ResumeObservationEvent, RunObservationEvent, ScheduleRunCreatedObservationEvent, ScheduleTickObservationEvent, StepAttemptObservationEvent, StreamObservationEvent, WorkerOperationObservationEvent };
|
|
131
|
+
//#endregion
|
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
//#region src/types/pagination.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const workflowCursorKeyPartSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
6
|
-
declare const workflowCursorPayloadSchema: z.ZodObject<{
|
|
7
|
-
key: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
/** Type used for workflow cursor values. */
|
|
10
|
-
type Cursor = string;
|
|
11
|
-
/** Type used for workflow page direction values. */
|
|
12
|
-
type PageDirection = "forward";
|
|
13
|
-
/** Options for workflow page. */
|
|
14
|
-
interface PageOptions {
|
|
2
|
+
export type Cursor = string;
|
|
3
|
+
export interface PageOptions {
|
|
15
4
|
readonly cursor?: Cursor;
|
|
16
5
|
readonly limit?: number;
|
|
17
|
-
readonly direction?: PageDirection;
|
|
18
6
|
}
|
|
19
|
-
|
|
20
|
-
interface CursorPayload {
|
|
7
|
+
export interface CursorPayload {
|
|
21
8
|
readonly key: readonly CursorKeyPart[];
|
|
22
9
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** Describes the workflow page contract. */
|
|
26
|
-
interface WorkflowPage<TItem> {
|
|
10
|
+
export type CursorKeyPart = string | number | boolean | null;
|
|
11
|
+
export interface WorkflowPage<TItem> {
|
|
27
12
|
readonly items: readonly TItem[];
|
|
28
13
|
readonly nextCursor?: Cursor;
|
|
29
14
|
readonly hasMore: boolean;
|
|
30
15
|
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { Cursor, CursorKeyPart, CursorPayload, PageDirection, PageOptions, WorkflowPage, workflowCursorKeyPartSchema, workflowCursorPayloadSchema, workflowCursorSchema, workflowPageDirectionSchema };
|
|
16
|
+
//#endregion
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/types/pagination.ts
|
|
3
|
-
const workflowCursorSchema = z.string({ error: "Workflow cursor is invalid" });
|
|
4
|
-
const workflowPageDirectionSchema = z.literal("forward", { error: "Workflow page direction is invalid" });
|
|
5
|
-
const workflowCursorKeyPartSchema = z.union([
|
|
6
|
-
z.string(),
|
|
7
|
-
z.number(),
|
|
8
|
-
z.boolean(),
|
|
9
|
-
z.null()
|
|
10
|
-
]);
|
|
11
|
-
const workflowCursorPayloadSchema = z.object({ key: z.array(workflowCursorKeyPartSchema).nonempty() });
|
|
12
|
-
//#endregion
|
|
13
|
-
export { workflowCursorKeyPartSchema, workflowCursorPayloadSchema, workflowCursorSchema, workflowPageDirectionSchema };
|
|
1
|
+
export {};
|
package/dist/types/result.d.mts
CHANGED
|
@@ -1,62 +1,30 @@
|
|
|
1
|
-
import { RunId } from "./run-id.mjs";
|
|
2
|
-
import { Timeline } from "./timeline.mjs";
|
|
3
|
-
import { WorkflowAttributePatch, WorkflowRunRecord, WorkflowRunStatus } from "./run.mjs";
|
|
4
1
|
import { WorkflowErrorRecord } from "./error.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { StorageValue } from "@temelj/storage";
|
|
2
|
+
import { RunRecord } from "./run.mjs";
|
|
7
3
|
//#region src/types/result.d.ts
|
|
8
|
-
|
|
9
|
-
type ExecutionResultKind = "completed" | "waiting" | "failed";
|
|
10
|
-
/** Base contract for workflow execution results. */
|
|
11
|
-
interface ExecutionResultBase {
|
|
12
|
-
readonly kind: ExecutionResultKind;
|
|
13
|
-
readonly run: WorkflowRunRecord;
|
|
14
|
-
}
|
|
4
|
+
export type ExecutionResultKind = "completed" | "waiting" | "failed";
|
|
15
5
|
/** Result returned after a workflow execution attempt completes, waits, or fails. */
|
|
16
|
-
type ExecutionResult<TOutput = unknown> = CompletedResult<TOutput> | WaitingResult | FailedResult;
|
|
6
|
+
export type ExecutionResult<TOutput = unknown> = CompletedResult<TOutput> | WaitingResult | FailedResult;
|
|
17
7
|
/** Execution result for a workflow run that completed during the attempt. */
|
|
18
|
-
interface CompletedResult<TOutput> {
|
|
8
|
+
export interface CompletedResult<TOutput> {
|
|
19
9
|
readonly kind: "completed";
|
|
20
|
-
readonly run:
|
|
10
|
+
readonly run: RunRecord;
|
|
21
11
|
readonly output: TOutput;
|
|
22
12
|
}
|
|
23
13
|
/** Execution result for a workflow run that parked until a later time or message. */
|
|
24
|
-
interface WaitingResult {
|
|
14
|
+
export interface WaitingResult {
|
|
25
15
|
readonly kind: "waiting";
|
|
26
|
-
readonly run:
|
|
16
|
+
readonly run: RunRecord;
|
|
27
17
|
readonly availableAt: Temporal.Instant;
|
|
28
18
|
}
|
|
29
19
|
/** Execution result for a workflow run that failed during the attempt. */
|
|
30
|
-
interface FailedResult {
|
|
20
|
+
export interface FailedResult {
|
|
31
21
|
readonly kind: "failed";
|
|
32
|
-
readonly run:
|
|
22
|
+
readonly run: RunRecord;
|
|
33
23
|
readonly error: WorkflowErrorRecord;
|
|
34
24
|
}
|
|
35
|
-
/** Engine-level handle for inspecting and controlling a workflow run. */
|
|
36
|
-
interface WorkflowHandle<TOutput = unknown> {
|
|
37
|
-
readonly runId: RunId;
|
|
38
|
-
readonly workflowName: string;
|
|
39
|
-
readonly workflowVersion?: string;
|
|
40
|
-
getRun(): Promise<WorkflowRunRecord>;
|
|
41
|
-
status(): Promise<WorkflowRunStatus>;
|
|
42
|
-
events(): Promise<readonly EventRecord[]>;
|
|
43
|
-
timeline(): Promise<Timeline>;
|
|
44
|
-
result(): Promise<ExecutionResult<TOutput>>;
|
|
45
|
-
setMetadata(metadata: unknown): Promise<WorkflowRunRecord>;
|
|
46
|
-
setAttributes(attributes: WorkflowAttributePatch): Promise<WorkflowRunRecord>;
|
|
47
|
-
cancel(): Promise<WorkflowRunRecord>;
|
|
48
|
-
}
|
|
49
|
-
/** Operations backing a workflow run handle facade. */
|
|
50
|
-
interface HandleOperations {
|
|
51
|
-
getTimeline(runId: RunId): Promise<Timeline>;
|
|
52
|
-
setMetadata(runId: RunId, metadata: unknown): Promise<WorkflowRunRecord>;
|
|
53
|
-
setAttributes(runId: RunId, attributes: WorkflowAttributePatch): Promise<WorkflowRunRecord>;
|
|
54
|
-
cancel(runId: RunId): Promise<WorkflowRunRecord>;
|
|
55
|
-
}
|
|
56
25
|
/** Options for polling a client run handle until the run reaches a terminal result. */
|
|
57
|
-
interface ResultOptions {
|
|
26
|
+
export interface ResultOptions {
|
|
58
27
|
readonly pollInterval?: Temporal.Duration;
|
|
59
28
|
readonly timeout?: Temporal.Duration;
|
|
60
29
|
}
|
|
61
|
-
//#endregion
|
|
62
|
-
export { CompletedResult, ExecutionResult, ExecutionResultBase, ExecutionResultKind, FailedResult, HandleOperations, ResultOptions, WaitingResult, WorkflowHandle };
|
|
30
|
+
//#endregion
|
package/dist/types/retry.d.mts
CHANGED
|
@@ -1,48 +1,41 @@
|
|
|
1
1
|
//#region src/types/retry.d.ts
|
|
2
2
|
/** Retry policy for workflow runs after retryable workflow failures. */
|
|
3
|
-
interface
|
|
3
|
+
export interface RetryConfig {
|
|
4
4
|
readonly maximumAttempts?: number;
|
|
5
5
|
readonly initialInterval?: Temporal.Duration;
|
|
6
6
|
readonly backoffCoefficient?: number;
|
|
7
7
|
readonly maximumInterval?: Temporal.Duration;
|
|
8
8
|
}
|
|
9
9
|
/** Retry policy after duration values and defaults have been normalized. */
|
|
10
|
-
interface
|
|
10
|
+
export interface ResolvedRetryConfig {
|
|
11
11
|
readonly maximumAttempts: number;
|
|
12
12
|
readonly initialInterval?: Temporal.Duration;
|
|
13
13
|
readonly backoffCoefficient: number;
|
|
14
14
|
readonly maximumInterval?: Temporal.Duration;
|
|
15
15
|
}
|
|
16
|
-
/** Retry policy for durable task attempts. */
|
|
17
|
-
type WorkflowStepRetryConfig = WorkflowRetryConfig;
|
|
18
|
-
/** Step retry policy after duration values and defaults have been normalized. */
|
|
19
|
-
type WorkflowResolvedStepRetryConfig = WorkflowResolvedRetryConfig;
|
|
20
16
|
/** Resolved retry policy used after a worker cannot find a workflow implementation. */
|
|
21
|
-
interface
|
|
17
|
+
export interface ResolvedMissingImplementationRetryConfig {
|
|
22
18
|
readonly initialInterval: Temporal.Duration;
|
|
23
19
|
readonly backoffCoefficient: number;
|
|
24
20
|
readonly maximumInterval?: Temporal.Duration;
|
|
25
21
|
readonly maximumAttempts: number;
|
|
26
22
|
}
|
|
27
23
|
/** Required default values used to complete missing-implementation retry options. */
|
|
28
|
-
interface
|
|
24
|
+
export interface MissingImplementationRetryDefaults {
|
|
29
25
|
readonly initialInterval: Temporal.Duration;
|
|
30
26
|
readonly backoffCoefficient: number;
|
|
31
27
|
readonly maximumAttempts: number;
|
|
32
28
|
}
|
|
33
29
|
/** Required default values used to complete workflow and step retry options. */
|
|
34
|
-
interface
|
|
30
|
+
export interface ResolvedRetryDefaults {
|
|
35
31
|
readonly maximumAttempts: number;
|
|
36
32
|
readonly backoffCoefficient: number;
|
|
37
33
|
}
|
|
38
|
-
/** Parsed retry policy before runtime defaults are applied. */
|
|
39
|
-
type WorkflowParsedRetryConfig = WorkflowRetryConfig;
|
|
40
34
|
/** Retry policy used when a worker cannot find an implementation for a claimed run. */
|
|
41
|
-
interface
|
|
35
|
+
export interface MissingImplementationRetryConfig {
|
|
42
36
|
readonly initialInterval?: Temporal.Duration;
|
|
43
37
|
readonly backoffCoefficient?: number;
|
|
44
38
|
readonly maximumInterval?: Temporal.Duration;
|
|
45
39
|
readonly maximumAttempts?: number;
|
|
46
40
|
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { WorkflowMissingImplementationRetryConfig, WorkflowMissingImplementationRetryDefaults, WorkflowParsedRetryConfig, WorkflowResolvedMissingImplementationRetryConfig, WorkflowResolvedRetryConfig, WorkflowResolvedRetryDefaults, WorkflowResolvedStepRetryConfig, WorkflowRetryConfig, WorkflowStepRetryConfig };
|
|
41
|
+
//#endregion
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { PageOptions } from "./pagination.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ListStepAttemptsOptions } from "./step-attempts.mjs";
|
|
3
|
+
import { RunRetryReason, RunStatus, RunTransitionReason, WorkflowAttributeValue } from "./run.mjs";
|
|
4
4
|
//#region src/types/run-list.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly status?: WorkflowRunStatus | readonly WorkflowRunStatus[];
|
|
5
|
+
export interface ListRunsOptions {
|
|
6
|
+
readonly status?: RunStatus | readonly RunStatus[];
|
|
8
7
|
readonly workflowName?: string;
|
|
9
8
|
readonly workflowVersion?: string;
|
|
10
9
|
readonly idempotencyKey?: string;
|
|
@@ -13,7 +12,7 @@ interface WorkflowListRunsOptions {
|
|
|
13
12
|
readonly parentStepId?: string;
|
|
14
13
|
readonly parentStepName?: string;
|
|
15
14
|
readonly parentStepAttempt?: number;
|
|
16
|
-
readonly lastTransitionReason?:
|
|
15
|
+
readonly lastTransitionReason?: RunTransitionReason | readonly RunTransitionReason[];
|
|
17
16
|
readonly createdAtFrom?: Temporal.Instant;
|
|
18
17
|
readonly createdAtTo?: Temporal.Instant;
|
|
19
18
|
readonly updatedAtFrom?: Temporal.Instant;
|
|
@@ -26,7 +25,7 @@ interface WorkflowListRunsOptions {
|
|
|
26
25
|
readonly availableAtTo?: Temporal.Instant;
|
|
27
26
|
readonly leaseExpiresAtFrom?: Temporal.Instant;
|
|
28
27
|
readonly leaseExpiresAtTo?: Temporal.Instant;
|
|
29
|
-
readonly retryReason?:
|
|
28
|
+
readonly retryReason?: RunRetryReason | readonly RunRetryReason[];
|
|
30
29
|
readonly retryAtFrom?: Temporal.Instant;
|
|
31
30
|
readonly retryAtTo?: Temporal.Instant;
|
|
32
31
|
readonly cleanupFinishedAtBefore?: Temporal.Instant;
|
|
@@ -36,8 +35,7 @@ interface WorkflowListRunsOptions {
|
|
|
36
35
|
readonly limit?: number;
|
|
37
36
|
}
|
|
38
37
|
/** Paginated filters for listing stored workflow runs. */
|
|
39
|
-
type
|
|
38
|
+
export type ListRunsPageOptions = ListRunsOptions & PageOptions;
|
|
40
39
|
/** Paginated filters for listing materialized step attempts. */
|
|
41
|
-
type
|
|
42
|
-
//#endregion
|
|
43
|
-
export { WorkflowListRunsOptions, WorkflowListRunsPageOptions, WorkflowListStepAttemptsPageOptions };
|
|
40
|
+
export type ListStepAttemptsPageOptions = ListStepAttemptsOptions & PageOptions;
|
|
41
|
+
//#endregion
|
|
@@ -1,86 +1,79 @@
|
|
|
1
|
-
import { RunId } from "./
|
|
2
|
-
import { StepId } from "./step-id.mjs";
|
|
1
|
+
import { RunId, StepId } from "./ids.mjs";
|
|
3
2
|
import { WorkflowDefinition } from "./definition.mjs";
|
|
4
|
-
import "./run.mjs";
|
|
5
3
|
//#region src/types/run-options.d.ts
|
|
6
4
|
/** Callback used to resolve the workflow version stored on a new run. */
|
|
7
|
-
type
|
|
5
|
+
export type VersionResolver = (workflowName: string, definition: WorkflowDefinition<unknown, unknown, unknown>) => string | undefined | Promise<string | undefined>;
|
|
8
6
|
/** Options that control workflow run creation and scheduling. */
|
|
9
|
-
interface
|
|
7
|
+
export interface StartOptions {
|
|
10
8
|
readonly id?: string;
|
|
11
9
|
readonly idempotencyKey?: string;
|
|
12
10
|
readonly workflowVersion?: string;
|
|
13
|
-
readonly workflowVersionResolver?:
|
|
11
|
+
readonly workflowVersionResolver?: VersionResolver;
|
|
14
12
|
readonly context?: unknown;
|
|
15
|
-
readonly parent?:
|
|
13
|
+
readonly parent?: RunParentOptions;
|
|
16
14
|
readonly availableAt?: Temporal.Instant;
|
|
17
15
|
readonly deadlineAt?: Temporal.Instant;
|
|
18
16
|
}
|
|
19
17
|
/** Options for creating a single delayed workflow run at the next interval boundary. */
|
|
20
|
-
interface ScheduleNextOptions {
|
|
18
|
+
export interface ScheduleNextOptions {
|
|
21
19
|
readonly id?: string;
|
|
22
20
|
readonly every: Temporal.Duration;
|
|
23
21
|
readonly idempotencyKey: string;
|
|
24
22
|
readonly workflowVersion?: string;
|
|
25
|
-
readonly workflowVersionResolver?:
|
|
23
|
+
readonly workflowVersionResolver?: VersionResolver;
|
|
26
24
|
readonly context?: unknown;
|
|
27
|
-
readonly parent?:
|
|
25
|
+
readonly parent?: RunParentOptions;
|
|
28
26
|
readonly deadlineAt?: Temporal.Instant;
|
|
29
27
|
readonly from?: Temporal.Instant;
|
|
30
28
|
}
|
|
31
29
|
/** Resolved schedule-next options split into schedule metadata and run-start options. */
|
|
32
|
-
interface ResolvedScheduleNextOptions {
|
|
30
|
+
export interface ResolvedScheduleNextOptions {
|
|
33
31
|
readonly schedule: ScheduleNextOptions & {
|
|
34
32
|
readonly from: Temporal.Instant;
|
|
35
33
|
};
|
|
36
|
-
readonly start:
|
|
34
|
+
readonly start: StartOptions;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
interface WorkflowBatchStartItem<TRawInput = unknown> {
|
|
36
|
+
export interface BatchStartItem<TRawInput = unknown> {
|
|
40
37
|
readonly input: TRawInput;
|
|
41
|
-
readonly options?:
|
|
38
|
+
readonly options?: StartOptions;
|
|
42
39
|
}
|
|
43
40
|
/** Parent workflow metadata stored on a child workflow run. */
|
|
44
|
-
interface
|
|
41
|
+
export interface RunParentOptions {
|
|
45
42
|
readonly runId: RunId;
|
|
46
43
|
readonly stepId?: StepId;
|
|
47
44
|
readonly stepName?: string;
|
|
48
45
|
readonly stepAttempt?: number;
|
|
49
46
|
}
|
|
50
47
|
/** Options for executing or resuming a workflow run. */
|
|
51
|
-
interface
|
|
52
|
-
readonly start?:
|
|
48
|
+
export interface ExecutionOptions {
|
|
49
|
+
readonly start?: StartOptions;
|
|
53
50
|
readonly signal?: AbortSignal;
|
|
54
51
|
}
|
|
55
52
|
/** Options for creating a new run from an existing run record. */
|
|
56
|
-
interface
|
|
53
|
+
export interface RerunOptions {
|
|
57
54
|
readonly workflowName?: string;
|
|
58
55
|
readonly workflowVersion?: string;
|
|
59
|
-
readonly workflowVersionResolver?:
|
|
60
|
-
readonly start?:
|
|
56
|
+
readonly workflowVersionResolver?: VersionResolver;
|
|
57
|
+
readonly start?: StartOptions;
|
|
61
58
|
}
|
|
62
59
|
/** Options for moving a run back to pending at a new availability time. */
|
|
63
|
-
interface
|
|
60
|
+
export interface RescheduleRunOptions {
|
|
64
61
|
readonly availableAt?: Temporal.Instant;
|
|
65
62
|
}
|
|
66
63
|
/** Options for releasing an expired worker lease from a run. */
|
|
67
|
-
interface
|
|
64
|
+
export interface ReleaseStaleLeaseOptions {
|
|
68
65
|
readonly availableAt?: Temporal.Instant;
|
|
69
66
|
}
|
|
70
|
-
|
|
71
|
-
interface WorkflowRetryFailedRunOptions {
|
|
67
|
+
export interface RetryFailedRunOptions {
|
|
72
68
|
readonly availableAt?: Temporal.Instant;
|
|
73
69
|
readonly force?: boolean;
|
|
74
70
|
}
|
|
75
|
-
|
|
76
|
-
interface WorkflowMarkRunPermanentlyFailedOptions {
|
|
71
|
+
export interface MarkRunPermanentlyFailedOptions {
|
|
77
72
|
readonly reason: string;
|
|
78
73
|
}
|
|
79
|
-
|
|
80
|
-
interface WorkflowResumeOptions {
|
|
74
|
+
export interface ResumeOptions {
|
|
81
75
|
readonly signal?: AbortSignal;
|
|
82
76
|
}
|
|
83
77
|
/** Typed argument tuple used by runnable workflow wrappers. */
|
|
84
|
-
type
|
|
85
|
-
//#endregion
|
|
86
|
-
export { ResolvedScheduleNextOptions, ScheduleNextOptions, WorkflowBatchStartItem, WorkflowExecutionOptions, WorkflowMarkRunPermanentlyFailedOptions, WorkflowReleaseStaleLeaseOptions, WorkflowRerunOptions, WorkflowRescheduleRunOptions, WorkflowResumeOptions, WorkflowRetryFailedRunOptions, WorkflowRunArguments, WorkflowRunParentOptions, WorkflowStartOptions, WorkflowVersionResolver };
|
|
78
|
+
export type RunArguments<TRawInput, TOptions> = [unknown] extends [TRawInput] ? [input: TRawInput, options?: TOptions] : [undefined] extends [TRawInput] ? [input?: TRawInput, options?: TOptions] : [input: TRawInput, options?: TOptions];
|
|
79
|
+
//#endregion
|