@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
|
@@ -1,60 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ResolvedRetryConfig } from "./retry.mjs";
|
|
2
|
+
import { ListRunsOptions } from "./run-list.mjs";
|
|
3
|
+
import { StepMetadata } from "./step.mjs";
|
|
4
|
+
import { RunSummary } from "./summary.mjs";
|
|
5
|
+
import { ObservationEventArgs } from "./observation.mjs";
|
|
5
6
|
import { ExecutionResult } from "./result.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { z } from "zod";
|
|
7
|
+
import { RunRecord } from "./run.mjs";
|
|
8
8
|
//#region src/types/telemetry.d.ts
|
|
9
|
-
declare const workflowTelemetryContextSchema: z.ZodObject<{
|
|
10
|
-
traceparent: z.ZodOptional<z.ZodString>;
|
|
11
|
-
tracestate: z.ZodOptional<z.ZodString>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
9
|
/** Persisted W3C trace context captured when a workflow run is created. */
|
|
14
|
-
interface TelemetryContext {
|
|
10
|
+
export interface TelemetryContext {
|
|
15
11
|
readonly traceparent?: string;
|
|
16
12
|
readonly tracestate?: string;
|
|
17
13
|
}
|
|
18
14
|
/** Context passed to telemetry adapters around workflow run execution. */
|
|
19
|
-
interface RunTelemetryContext {
|
|
20
|
-
readonly run:
|
|
15
|
+
export interface RunTelemetryContext {
|
|
16
|
+
readonly run: RunRecord;
|
|
21
17
|
readonly traceContext?: TelemetryContext;
|
|
22
18
|
}
|
|
23
19
|
/** Context passed to telemetry adapters after workflow run execution finishes. */
|
|
24
|
-
interface RunTelemetryResultContext<TOutput = unknown> extends RunTelemetryContext {
|
|
20
|
+
export interface RunTelemetryResultContext<TOutput = unknown> extends RunTelemetryContext {
|
|
25
21
|
readonly result?: ExecutionResult<TOutput>;
|
|
26
22
|
readonly error?: unknown;
|
|
27
23
|
}
|
|
28
24
|
/** Context passed to telemetry adapters around durable task callback execution. */
|
|
29
|
-
interface StepTelemetryContext {
|
|
30
|
-
readonly run:
|
|
31
|
-
readonly step:
|
|
25
|
+
export interface StepTelemetryContext {
|
|
26
|
+
readonly run: RunRecord;
|
|
27
|
+
readonly step: StepMetadata;
|
|
32
28
|
readonly attempt: number;
|
|
33
|
-
readonly retry:
|
|
29
|
+
readonly retry: ResolvedRetryConfig;
|
|
34
30
|
readonly timeoutAt?: Temporal.Instant;
|
|
35
31
|
}
|
|
36
32
|
/** Context passed to telemetry adapters after durable task callback execution finishes. */
|
|
37
|
-
interface StepTelemetryResultContext extends StepTelemetryContext {
|
|
33
|
+
export interface StepTelemetryResultContext extends StepTelemetryContext {
|
|
38
34
|
readonly error?: unknown;
|
|
39
35
|
}
|
|
40
36
|
/** Storage/backend operation names observed by the default workflow store. */
|
|
41
|
-
type StorageTelemetryOperation = "get" | "tryGet" | "set" | "trySet" | "compareAndSet" | "tryCompareAndSet" | "compareAndSetMany" | "tryCompareAndSetMany" | "has" | "tryHas" | "delete" | "tryDelete" | "getMany" | "tryGetMany" | "setMany" | "trySetMany" | "deleteMany" | "tryDeleteMany" | "keys" | "tryKeys" | "entries" | "tryEntries" | "clear" | "tryClear" | "watch" | "unwatch" | "dispose" | "tryDispose";
|
|
37
|
+
export type StorageTelemetryOperation = "get" | "tryGet" | "set" | "trySet" | "compareAndSet" | "tryCompareAndSet" | "compareAndSetMany" | "tryCompareAndSetMany" | "has" | "tryHas" | "delete" | "tryDelete" | "getMany" | "tryGetMany" | "setMany" | "trySetMany" | "deleteMany" | "tryDeleteMany" | "keys" | "tryKeys" | "entries" | "tryEntries" | "clear" | "tryClear" | "watch" | "unwatch" | "dispose" | "tryDispose";
|
|
42
38
|
/** Context passed to telemetry adapters around workflow storage/backend operations. */
|
|
43
|
-
interface StorageTelemetryContext {
|
|
39
|
+
export interface StorageTelemetryContext {
|
|
44
40
|
readonly operation: StorageTelemetryOperation;
|
|
45
41
|
readonly backend: string;
|
|
46
42
|
}
|
|
47
43
|
/** Minimal engine read model exposed to telemetry adapters after engine creation. */
|
|
48
|
-
interface TelemetryEngine {
|
|
44
|
+
export interface TelemetryEngine {
|
|
49
45
|
/** Returns aggregate run metrics for runs matching optional filters. */
|
|
50
|
-
getRunSummary(options?:
|
|
46
|
+
getRunSummary(options?: ListRunsOptions): Promise<RunSummary>;
|
|
51
47
|
}
|
|
52
48
|
/** Optional telemetry hooks used to observe running workflow behavior. */
|
|
53
|
-
interface Telemetry {
|
|
49
|
+
export interface Telemetry {
|
|
54
50
|
/** Captures ambient trace context for a newly-created workflow run. */
|
|
55
51
|
captureContext?(): TelemetryContext | undefined;
|
|
56
52
|
/** Runs a workflow execution callback with telemetry context. */
|
|
57
|
-
withRunExecution?<T>(context: RunTelemetryContext, callback: () => Promise<T>): Promise<T>;
|
|
53
|
+
withRunExecution?<T extends ExecutionResult>(context: RunTelemetryContext, callback: () => Promise<T>): Promise<T>;
|
|
58
54
|
/** Runs a durable task callback with telemetry context. */
|
|
59
55
|
withStepExecution?<T>(context: StepTelemetryContext, callback: () => Promise<T>): Promise<T>;
|
|
60
56
|
/** Runs a workflow storage/backend operation callback with telemetry context. */
|
|
@@ -64,11 +60,10 @@ interface Telemetry {
|
|
|
64
60
|
/** Observes the final outcome of a durable task callback. */
|
|
65
61
|
recordStepExecution?(context: StepTelemetryResultContext): void;
|
|
66
62
|
/** Observes committed workflow observation events. */
|
|
67
|
-
observe
|
|
63
|
+
observe?(...event: ObservationEventArgs): void;
|
|
68
64
|
/** Binds the telemetry adapter to an engine after engine creation. */
|
|
69
65
|
bindEngine?(engine: TelemetryEngine): void;
|
|
70
66
|
/** Releases telemetry resources owned by the adapter. */
|
|
71
67
|
shutdown?(): Promise<void> | void;
|
|
72
68
|
}
|
|
73
|
-
//#endregion
|
|
74
|
-
export { RunTelemetryContext, RunTelemetryResultContext, StepTelemetryContext, StepTelemetryResultContext, StorageTelemetryContext, StorageTelemetryOperation, Telemetry, TelemetryContext, TelemetryEngine, workflowTelemetryContextSchema };
|
|
69
|
+
//#endregion
|
package/dist/types/telemetry.mjs
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region src/types/telemetry.ts
|
|
4
|
-
const workflowTelemetryContextSchema = z.object({
|
|
5
|
-
traceparent: nonBlankStringSchema.optional(),
|
|
6
|
-
tracestate: nonBlankStringSchema.optional()
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|
|
9
|
-
export { workflowTelemetryContextSchema };
|
|
1
|
+
export {};
|
|
@@ -1,237 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { StepId } from "./step-id.mjs";
|
|
4
|
-
import { StreamId } from "./stream-id.mjs";
|
|
5
|
-
import { WorkflowAttributePatch, WorkflowRunRecord } from "./run.mjs";
|
|
6
|
-
import { WorkflowErrorRecord } from "./error.mjs";
|
|
7
|
-
import { AttributesSetEvent, ChildWorkflowCompletedEvent, ChildWorkflowFailedEvent, ChildWorkflowStartedEvent, DeterministicValueRecordedEvent, EventRecord, MessageSendCompletedEvent, MessageSendFailedEvent, MessageSendStartedEvent, MessageSentEvent, MessageWaitCompletedEvent, MessageWaitFailedEvent, MessageWaitStartedEvent, MetadataSetEvent, SleepCompletedEvent, SleepStartedEvent, StreamChunkEvent, StreamClosedEvent, StreamFailedEvent, StreamStartedEvent, WorkflowStepCompletedEvent, WorkflowStepFailedEvent, WorkflowStepStartedEvent } from "./events.mjs";
|
|
8
|
-
import { StorageValue } from "@temelj/storage";
|
|
1
|
+
import { AttributePatch, RunRecord } from "./run.mjs";
|
|
2
|
+
import { EventKind, EventRecord } from "./events.mjs";
|
|
9
3
|
//#region src/types/timeline.d.ts
|
|
10
|
-
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
type WorkflowCompletedEvent = Extract<EventRecord, {
|
|
14
|
-
readonly kind: "workflow_completed";
|
|
15
|
-
}>;
|
|
16
|
-
type WorkflowFailedEvent = Extract<EventRecord, {
|
|
17
|
-
readonly kind: "workflow_failed";
|
|
18
|
-
}>;
|
|
19
|
-
/** Describes the workflow timeline contract. */
|
|
20
|
-
interface Timeline {
|
|
21
|
-
readonly run: WorkflowRunRecord;
|
|
22
|
-
readonly entries: readonly TimelineEntryRecord[];
|
|
4
|
+
export interface Timeline {
|
|
5
|
+
readonly run: RunRecord;
|
|
6
|
+
readonly entries: readonly TimelineEntry[];
|
|
23
7
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
readonly
|
|
8
|
+
/** What each durable event kind means on a timeline: the thing it belongs to and what happened. */
|
|
9
|
+
export interface TimelineClassification {
|
|
10
|
+
readonly workflow_started: readonly ["workflow", "started"];
|
|
11
|
+
readonly workflow_completed: readonly ["workflow", "completed"];
|
|
12
|
+
readonly workflow_failed: readonly ["workflow", "failed"];
|
|
13
|
+
readonly step_started: readonly ["step", "started"];
|
|
14
|
+
readonly step_completed: readonly ["step", "completed"];
|
|
15
|
+
readonly step_failed: readonly ["step", "failed"];
|
|
16
|
+
readonly metadata_set: readonly ["metadata", "set"];
|
|
17
|
+
readonly attributes_set: readonly ["attributes", "set"];
|
|
18
|
+
readonly deterministic_value_recorded: readonly ["deterministic", "recorded"];
|
|
19
|
+
readonly sleep_started: readonly ["sleep", "started"];
|
|
20
|
+
readonly sleep_completed: readonly ["sleep", "completed"];
|
|
21
|
+
readonly child_workflow_started: readonly ["child_workflow", "started"];
|
|
22
|
+
readonly child_workflow_completed: readonly ["child_workflow", "completed"];
|
|
23
|
+
readonly child_workflow_failed: readonly ["child_workflow", "failed"];
|
|
24
|
+
readonly message_send_started: readonly ["message", "send_started"];
|
|
25
|
+
readonly message_send_completed: readonly ["message", "send_completed"];
|
|
26
|
+
readonly message_send_failed: readonly ["message", "send_failed"];
|
|
27
|
+
readonly message_sent: readonly ["message", "sent"];
|
|
28
|
+
readonly message_wait_started: readonly ["message", "waiting"];
|
|
29
|
+
readonly message_wait_completed: readonly ["message", "received"];
|
|
30
|
+
readonly message_wait_failed: readonly ["message", "failed"];
|
|
31
|
+
readonly stream_started: readonly ["stream", "started"];
|
|
32
|
+
readonly stream_chunk: readonly ["stream", "chunk"];
|
|
33
|
+
readonly stream_closed: readonly ["stream", "closed"];
|
|
34
|
+
readonly stream_failed: readonly ["stream", "failed"];
|
|
45
35
|
}
|
|
46
|
-
|
|
36
|
+
/**
|
|
37
|
+
* One durable event on a run's timeline, classified by `kind` and `status`. The event itself holds
|
|
38
|
+
* the details; attribute entries also carry the patch the event applied.
|
|
39
|
+
*/
|
|
40
|
+
export type TimelineEntry = { readonly [Kind in EventKind]: {
|
|
41
|
+
readonly kind: TimelineClassification[Kind][0];
|
|
42
|
+
readonly status: TimelineClassification[Kind][1];
|
|
47
43
|
readonly timestamp: Temporal.Instant;
|
|
48
|
-
readonly
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
readonly
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
readonly stepId?: StepId;
|
|
56
|
-
readonly stepName?: string;
|
|
57
|
-
readonly count?: number;
|
|
58
|
-
readonly targetRunId?: RunId;
|
|
59
|
-
readonly timeoutAt?: Temporal.Instant;
|
|
60
|
-
readonly payload?: StorageValue;
|
|
61
|
-
readonly error?: WorkflowErrorRecord;
|
|
62
|
-
readonly messageTimestamp?: Temporal.Instant;
|
|
63
|
-
readonly waiterStepIds?: readonly string[];
|
|
64
|
-
};
|
|
65
|
-
/** Describes the workflow timeline workflow entry contract. */
|
|
66
|
-
type TimelineWorkflowEntry = {
|
|
67
|
-
readonly kind: "workflow";
|
|
68
|
-
readonly status: "started";
|
|
69
|
-
readonly timestamp: Temporal.Instant;
|
|
70
|
-
readonly event: WorkflowStartedEvent;
|
|
71
|
-
} | {
|
|
72
|
-
readonly kind: "workflow";
|
|
73
|
-
readonly status: "completed";
|
|
74
|
-
readonly timestamp: Temporal.Instant;
|
|
75
|
-
readonly event: WorkflowCompletedEvent;
|
|
76
|
-
} | {
|
|
77
|
-
readonly kind: "workflow";
|
|
78
|
-
readonly status: "failed";
|
|
79
|
-
readonly timestamp: Temporal.Instant;
|
|
80
|
-
readonly event: WorkflowFailedEvent;
|
|
81
|
-
};
|
|
82
|
-
/** Describes the workflow timeline step entry contract. */
|
|
83
|
-
type TimelineStepEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
84
|
-
readonly kind: "step";
|
|
85
|
-
readonly status: "started";
|
|
86
|
-
readonly attempt: number;
|
|
87
|
-
readonly event: WorkflowStepStartedEvent;
|
|
88
|
-
}) | (WorkflowTimelineStepFields & {
|
|
89
|
-
readonly kind: "step";
|
|
90
|
-
readonly status: "completed";
|
|
91
|
-
readonly attempt: number;
|
|
92
|
-
readonly result?: StorageValue;
|
|
93
|
-
readonly event: WorkflowStepCompletedEvent;
|
|
94
|
-
}) | (WorkflowTimelineStepFields & {
|
|
95
|
-
readonly kind: "step";
|
|
96
|
-
readonly status: "failed";
|
|
97
|
-
readonly attempt: number;
|
|
98
|
-
readonly error?: WorkflowErrorRecord;
|
|
99
|
-
readonly event: WorkflowStepFailedEvent;
|
|
100
|
-
});
|
|
101
|
-
/** Describes the workflow timeline sleep entry contract. */
|
|
102
|
-
type TimelineSleepEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
103
|
-
readonly kind: "sleep";
|
|
104
|
-
readonly status: "started";
|
|
105
|
-
readonly until?: Temporal.Instant;
|
|
106
|
-
readonly duration?: Temporal.Duration;
|
|
107
|
-
readonly event: SleepStartedEvent;
|
|
108
|
-
}) | (WorkflowTimelineStepFields & {
|
|
109
|
-
readonly kind: "sleep";
|
|
110
|
-
readonly status: "completed";
|
|
111
|
-
readonly event: SleepCompletedEvent;
|
|
112
|
-
});
|
|
113
|
-
/** Describes the workflow timeline child workflow entry contract. */
|
|
114
|
-
type TimelineChildWorkflowEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
115
|
-
readonly kind: "child_workflow";
|
|
116
|
-
readonly status: "started";
|
|
117
|
-
readonly childRunId: RunId;
|
|
118
|
-
readonly workflowName?: string;
|
|
119
|
-
readonly workflowVersion?: string;
|
|
120
|
-
readonly input?: StorageValue;
|
|
121
|
-
readonly timeoutAt?: Temporal.Instant;
|
|
122
|
-
readonly event: ChildWorkflowStartedEvent;
|
|
123
|
-
}) | (WorkflowTimelineStepFields & {
|
|
124
|
-
readonly kind: "child_workflow";
|
|
125
|
-
readonly status: "completed";
|
|
126
|
-
readonly childRunId: RunId;
|
|
127
|
-
readonly result?: StorageValue;
|
|
128
|
-
readonly event: ChildWorkflowCompletedEvent;
|
|
129
|
-
}) | (WorkflowTimelineStepFields & {
|
|
130
|
-
readonly kind: "child_workflow";
|
|
131
|
-
readonly status: "failed";
|
|
132
|
-
readonly childRunId: RunId;
|
|
133
|
-
readonly error?: WorkflowErrorRecord;
|
|
134
|
-
readonly event: ChildWorkflowFailedEvent;
|
|
135
|
-
});
|
|
136
|
-
/** Describes the workflow timeline messageId entry contract. */
|
|
137
|
-
type TimelineMessageEntry = (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
138
|
-
readonly kind: "message";
|
|
139
|
-
readonly status: "send_started";
|
|
140
|
-
readonly targetRunId: RunId;
|
|
141
|
-
readonly messageId: MessageId;
|
|
142
|
-
readonly event: MessageSendStartedEvent;
|
|
143
|
-
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
144
|
-
readonly kind: "message";
|
|
145
|
-
readonly status: "send_completed";
|
|
146
|
-
readonly targetRunId: RunId;
|
|
147
|
-
readonly messageId: MessageId;
|
|
148
|
-
readonly event: MessageSendCompletedEvent;
|
|
149
|
-
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
150
|
-
readonly kind: "message";
|
|
151
|
-
readonly status: "send_failed";
|
|
152
|
-
readonly targetRunId: RunId;
|
|
153
|
-
readonly messageId: MessageId;
|
|
154
|
-
readonly error?: WorkflowErrorRecord;
|
|
155
|
-
readonly event: MessageSendFailedEvent;
|
|
156
|
-
}) | (WorkflowTimelineOptionalMessageFields & {
|
|
157
|
-
readonly kind: "message";
|
|
158
|
-
readonly status: "sent";
|
|
159
|
-
readonly timestamp: Temporal.Instant;
|
|
160
|
-
readonly messageId: MessageId;
|
|
161
|
-
readonly payload?: StorageValue;
|
|
162
|
-
readonly event: MessageSentEvent;
|
|
163
|
-
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
164
|
-
readonly kind: "message";
|
|
165
|
-
readonly status: "waiting";
|
|
166
|
-
readonly messageId: MessageId;
|
|
167
|
-
readonly timeoutAt?: Temporal.Instant;
|
|
168
|
-
readonly event: MessageWaitStartedEvent;
|
|
169
|
-
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
170
|
-
readonly kind: "message";
|
|
171
|
-
readonly status: "received";
|
|
172
|
-
readonly messageId: MessageId;
|
|
173
|
-
readonly payload?: StorageValue;
|
|
174
|
-
readonly messageTimestamp?: Temporal.Instant;
|
|
175
|
-
readonly event: MessageWaitCompletedEvent;
|
|
176
|
-
}) | (WorkflowTimelineOptionalMessageFields & WorkflowTimelineStepFields & {
|
|
177
|
-
readonly kind: "message";
|
|
178
|
-
readonly status: "failed";
|
|
179
|
-
readonly messageId: MessageId;
|
|
180
|
-
readonly error?: WorkflowErrorRecord;
|
|
181
|
-
readonly event: MessageWaitFailedEvent;
|
|
182
|
-
});
|
|
183
|
-
/** Describes the workflow timeline metadata entry contract. */
|
|
184
|
-
type TimelineMetadataEntry = WorkflowTimelineStepFields & {
|
|
185
|
-
readonly kind: "metadata";
|
|
186
|
-
readonly status: TimelineSetStatus;
|
|
187
|
-
readonly count: number;
|
|
188
|
-
readonly metadata: StorageValue;
|
|
189
|
-
readonly event: MetadataSetEvent;
|
|
190
|
-
};
|
|
191
|
-
/** Describes the workflow timeline attributes entry contract. */
|
|
192
|
-
type TimelineAttributesEntry = WorkflowTimelineStepFields & {
|
|
193
|
-
readonly kind: "attributes";
|
|
194
|
-
readonly status: TimelineSetStatus;
|
|
195
|
-
readonly count: number;
|
|
196
|
-
readonly attributes: WorkflowAttributePatch;
|
|
197
|
-
readonly event: AttributesSetEvent;
|
|
198
|
-
};
|
|
199
|
-
/** Describes the workflow timeline stream entry contract. */
|
|
200
|
-
type TimelineStreamEntry = (WorkflowTimelineStepFields & WorkflowTimelineCountField & {
|
|
201
|
-
readonly kind: "stream";
|
|
202
|
-
readonly status: "started";
|
|
203
|
-
readonly streamId: StreamId;
|
|
204
|
-
readonly contentType?: string;
|
|
205
|
-
readonly metadata?: StorageValue;
|
|
206
|
-
readonly event: StreamStartedEvent;
|
|
207
|
-
}) | (WorkflowTimelineStepFields & {
|
|
208
|
-
readonly kind: "stream";
|
|
209
|
-
readonly status: "chunk";
|
|
210
|
-
readonly streamId: StreamId;
|
|
211
|
-
readonly index: number;
|
|
212
|
-
readonly chunk?: StorageValue;
|
|
213
|
-
readonly event: StreamChunkEvent;
|
|
214
|
-
}) | (WorkflowTimelineStepFields & {
|
|
215
|
-
readonly kind: "stream";
|
|
216
|
-
readonly status: "closed";
|
|
217
|
-
readonly streamId: StreamId;
|
|
218
|
-
readonly event: StreamClosedEvent;
|
|
219
|
-
}) | (WorkflowTimelineStepFields & {
|
|
220
|
-
readonly kind: "stream";
|
|
221
|
-
readonly status: "failed";
|
|
222
|
-
readonly streamId: StreamId;
|
|
223
|
-
readonly error?: WorkflowErrorRecord;
|
|
224
|
-
readonly event: StreamFailedEvent;
|
|
225
|
-
});
|
|
226
|
-
/** Describes the workflow timeline deterministic entry contract. */
|
|
227
|
-
type TimelineDeterministicEntry = WorkflowTimelineStepFields & {
|
|
228
|
-
readonly kind: "deterministic";
|
|
229
|
-
readonly status: TimelineRecordedStatus;
|
|
230
|
-
readonly count: number;
|
|
231
|
-
readonly value: StorageValue;
|
|
232
|
-
readonly event: DeterministicValueRecordedEvent;
|
|
233
|
-
};
|
|
234
|
-
/** Type used for workflow timeline entry values. */
|
|
235
|
-
type TimelineEntryRecord = TimelineWorkflowEntry | TimelineStepEntry | TimelineSleepEntry | TimelineChildWorkflowEntry | TimelineMessageEntry | TimelineStreamEntry | TimelineDeterministicEntry | TimelineMetadataEntry | TimelineAttributesEntry;
|
|
236
|
-
//#endregion
|
|
237
|
-
export { Timeline, TimelineAttributesEntry, TimelineChildWorkflowEntry, TimelineChildWorkflowStatus, TimelineDeterministicEntry, TimelineEntry, TimelineEntryKind, TimelineEntryRecord, TimelineMessageEntry, TimelineMessageStatus, TimelineMetadataEntry, TimelineRecordedStatus, TimelineSetStatus, TimelineSleepEntry, TimelineSleepStatus, TimelineStepEntry, TimelineStepStatus, TimelineStreamEntry, TimelineStreamStatus, TimelineWorkflowEntry, TimelineWorkflowStatus };
|
|
44
|
+
readonly event: Extract<EventRecord, {
|
|
45
|
+
readonly kind: Kind;
|
|
46
|
+
}>;
|
|
47
|
+
} & (Kind extends "attributes_set" ? {
|
|
48
|
+
readonly attributes: AttributePatch;
|
|
49
|
+
} : unknown); }[EventKind];
|
|
50
|
+
//#endregion
|
package/dist/types/worker.d.mts
CHANGED
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
import { RunId } from "./
|
|
2
|
-
import {
|
|
1
|
+
import { RunId, WorkerId } from "./ids.mjs";
|
|
2
|
+
import { MissingImplementationRetryConfig } from "./retry.mjs";
|
|
3
3
|
import { RegistryLike } from "./definition.mjs";
|
|
4
|
-
import { WorkerId } from "./worker-id.mjs";
|
|
5
4
|
import { ExecutionResult } from "./result.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { RunRecord, RunRetryReason, RunStatus, RunTransitionReason, WorkflowAttributeValue } from "./run.mjs";
|
|
6
|
+
import { WorkflowEngine } from "../engine/create.mjs";
|
|
8
7
|
//#region src/types/worker.d.ts
|
|
9
8
|
/** Options for creating a direct workflow worker host. */
|
|
10
|
-
interface CreateWorkflowWorkerOptions {
|
|
11
|
-
readonly engine:
|
|
9
|
+
export interface CreateWorkflowWorkerOptions {
|
|
10
|
+
readonly engine: WorkflowEngine;
|
|
12
11
|
readonly registry: RegistryLike;
|
|
13
12
|
readonly workerId?: WorkerId;
|
|
14
13
|
readonly leaseDuration?: Temporal.Duration;
|
|
15
14
|
readonly pollInterval?: Temporal.Duration;
|
|
16
15
|
readonly heartbeatInterval?: Temporal.Duration;
|
|
17
16
|
readonly stopDrainTimeout?: Temporal.Duration;
|
|
18
|
-
readonly missingImplementationRetry?:
|
|
17
|
+
readonly missingImplementationRetry?: MissingImplementationRetryConfig;
|
|
19
18
|
readonly now?: () => Temporal.Instant;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
interface WorkflowWorker {
|
|
20
|
+
export interface WorkflowWorker {
|
|
23
21
|
/** Claims and processes a specific run by ID. */
|
|
24
22
|
processRun(runId: RunId): Promise<ExecutionResult<unknown>>;
|
|
25
23
|
/** Claims and processes the next available run matching the optional filters. */
|
|
26
|
-
processNextRun(options?:
|
|
24
|
+
processNextRun(options?: WorkerRunFilterOptions): Promise<ExecutionResult<unknown> | undefined>;
|
|
27
25
|
/** Extends the worker lease for a claimed run. */
|
|
28
|
-
extendLease(runId: RunId, options?:
|
|
26
|
+
extendLease(runId: RunId, options?: WorkerLeaseOptions): Promise<RunRecord | undefined>;
|
|
29
27
|
/** Releases the worker lease for a claimed run. */
|
|
30
|
-
releaseLease(runId: RunId, options?:
|
|
28
|
+
releaseLease(runId: RunId, options?: WorkerLeaseOptions): Promise<RunRecord | undefined>;
|
|
31
29
|
/** Runs the worker polling loop until stopped, aborted, or maxRuns is reached. */
|
|
32
|
-
run(options?:
|
|
30
|
+
run(options?: WorkerRunOptions): Promise<WorkerRunResult>;
|
|
33
31
|
/** Stops the worker polling loop and waits for active work to settle. */
|
|
34
32
|
stop(): Promise<void>;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
interface WorkflowWorkerLeaseOptions {
|
|
34
|
+
export interface WorkerLeaseOptions {
|
|
38
35
|
readonly attempts?: number;
|
|
39
36
|
}
|
|
40
37
|
/** Run filters accepted by workers; worker identity is supplied by the worker itself. */
|
|
41
|
-
interface
|
|
42
|
-
readonly status?:
|
|
38
|
+
export interface WorkerRunFilterOptions {
|
|
39
|
+
readonly status?: RunStatus | readonly RunStatus[];
|
|
43
40
|
readonly workflowName?: string;
|
|
44
41
|
readonly workflowVersion?: string;
|
|
45
42
|
readonly idempotencyKey?: string;
|
|
@@ -47,7 +44,7 @@ interface WorkflowWorkerRunFilterOptions {
|
|
|
47
44
|
readonly parentStepId?: string;
|
|
48
45
|
readonly parentStepName?: string;
|
|
49
46
|
readonly parentStepAttempt?: number;
|
|
50
|
-
readonly lastTransitionReason?:
|
|
47
|
+
readonly lastTransitionReason?: RunTransitionReason | readonly RunTransitionReason[];
|
|
51
48
|
readonly createdAtFrom?: Temporal.Instant;
|
|
52
49
|
readonly createdAtTo?: Temporal.Instant;
|
|
53
50
|
readonly updatedAtFrom?: Temporal.Instant;
|
|
@@ -60,7 +57,7 @@ interface WorkflowWorkerRunFilterOptions {
|
|
|
60
57
|
readonly availableAtTo?: Temporal.Instant;
|
|
61
58
|
readonly leaseExpiresAtFrom?: Temporal.Instant;
|
|
62
59
|
readonly leaseExpiresAtTo?: Temporal.Instant;
|
|
63
|
-
readonly retryReason?:
|
|
60
|
+
readonly retryReason?: RunRetryReason | readonly RunRetryReason[];
|
|
64
61
|
readonly retryAtFrom?: Temporal.Instant;
|
|
65
62
|
readonly retryAtTo?: Temporal.Instant;
|
|
66
63
|
readonly cleanupFinishedAtBefore?: Temporal.Instant;
|
|
@@ -69,26 +66,22 @@ interface WorkflowWorkerRunFilterOptions {
|
|
|
69
66
|
readonly attributeMissing?: string | readonly string[];
|
|
70
67
|
readonly limit?: number;
|
|
71
68
|
}
|
|
72
|
-
|
|
73
|
-
interface WorkflowWorkerRunOptions extends WorkflowWorkerRunFilterOptions {
|
|
69
|
+
export interface WorkerRunOptions extends WorkerRunFilterOptions {
|
|
74
70
|
readonly signal?: AbortSignal;
|
|
75
71
|
readonly maxRuns?: number;
|
|
76
72
|
readonly concurrency?: number;
|
|
77
73
|
readonly pollInterval?: Temporal.Duration;
|
|
78
74
|
readonly tickSchedules?: boolean;
|
|
79
75
|
}
|
|
80
|
-
|
|
81
|
-
interface WorkflowWorkerRunResult {
|
|
76
|
+
export interface WorkerRunResult {
|
|
82
77
|
readonly processedRuns: number;
|
|
83
78
|
}
|
|
84
|
-
|
|
85
|
-
interface WorkflowWakeDueRunsOptions extends WorkflowWorkerRunFilterOptions {
|
|
79
|
+
export interface WakeDueRunsOptions extends WorkerRunFilterOptions {
|
|
86
80
|
readonly workerId?: string;
|
|
87
81
|
readonly leaseDuration?: Temporal.Duration;
|
|
88
82
|
readonly heartbeatInterval?: Temporal.Duration;
|
|
89
|
-
readonly missingImplementationRetry?:
|
|
83
|
+
readonly missingImplementationRetry?: MissingImplementationRetryConfig;
|
|
90
84
|
readonly signal?: AbortSignal;
|
|
91
85
|
readonly maxRuns?: number;
|
|
92
86
|
}
|
|
93
|
-
//#endregion
|
|
94
|
-
export { CreateWorkflowWorkerOptions, WorkflowWakeDueRunsOptions, WorkflowWorker, WorkflowWorkerLeaseOptions, WorkflowWorkerRunFilterOptions, WorkflowWorkerRunOptions, WorkflowWorkerRunResult };
|
|
87
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/values.d.ts
|
|
2
|
+
/** Returns the greatest positive safe integer from two optional values. */
|
|
3
|
+
export declare function greatestOptionalNumber(current: number | undefined, next: number | undefined): number | undefined;
|
|
4
|
+
export declare function isPositiveSafeInteger(value: number): boolean;
|
|
5
|
+
export declare function isNonNegativeSafeInteger(value: number): boolean;
|
|
6
|
+
/** Returns the next positive safe integer, or undefined when the input cannot be advanced. */
|
|
7
|
+
export declare function nextPositiveSafeInteger(value: number): number | undefined;
|
|
8
|
+
export declare function isAbortError(cause: unknown): boolean;
|
|
9
|
+
export declare function positiveSafeInteger(value: number, label: string): number;
|
|
10
|
+
export declare function resolvePositiveSafeIntegerOption(value: number | undefined, label: string): number | undefined;
|
|
11
|
+
export declare function safeDuration(value: number, label: string): number;
|
|
12
|
+
export declare function durationAmount(value: Temporal.Duration, label: string): number;
|
|
13
|
+
/** Returns a retry delay in milliseconds and reports invalid numbers as duration errors. */
|
|
14
|
+
export declare function resolveSafeRetryDelay(value: number | undefined, label: string): number | undefined;
|
|
15
|
+
//#endregion
|
package/dist/values.mjs
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { WorkflowErrorCode } from "./errors/codes.mjs";
|
|
2
|
+
import { WorkflowOptionsError } from "./errors/base.mjs";
|
|
3
|
+
import { WorkflowDurationError } from "./errors/failures.mjs";
|
|
4
|
+
//#region src/values.ts
|
|
5
|
+
/** Returns the greatest positive safe integer from two optional values. */
|
|
6
|
+
function greatestOptionalNumber(current, next) {
|
|
7
|
+
if (next === void 0 || !isPositiveSafeInteger(next)) return current;
|
|
8
|
+
if (current === void 0) return next;
|
|
9
|
+
return Math.max(current, next);
|
|
10
|
+
}
|
|
11
|
+
function isPositiveSafeInteger(value) {
|
|
12
|
+
return Number.isSafeInteger(value) && value > 0;
|
|
13
|
+
}
|
|
14
|
+
function isNonNegativeSafeInteger(value) {
|
|
15
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
16
|
+
}
|
|
17
|
+
/** Returns the next positive safe integer, or undefined when the input cannot be advanced. */
|
|
18
|
+
function nextPositiveSafeInteger(value) {
|
|
19
|
+
return isPositiveSafeInteger(value) && value < Number.MAX_SAFE_INTEGER ? value + 1 : void 0;
|
|
20
|
+
}
|
|
21
|
+
function isAbortError(cause) {
|
|
22
|
+
return cause instanceof Error && cause.name === "AbortError" || cause instanceof DOMException && cause.name === "AbortError";
|
|
23
|
+
}
|
|
24
|
+
function positiveSafeInteger(value, label) {
|
|
25
|
+
if (!isPositiveSafeInteger(value)) throw new WorkflowDurationError(`${label} must be a positive safe integer`);
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
function resolvePositiveSafeIntegerOption(value, label) {
|
|
29
|
+
if (value === void 0) return;
|
|
30
|
+
if (!isPositiveSafeInteger(value)) WorkflowOptionsError.positiveSafeInteger(label);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
function safeDuration(value, label) {
|
|
34
|
+
try {
|
|
35
|
+
resolveSafeRetryDelay(value, label);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (!(error instanceof WorkflowOptionsError)) throw error;
|
|
38
|
+
throw new WorkflowDurationError(`${label} must be a timer-safe duration`);
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function durationAmount(value, label) {
|
|
43
|
+
if (!(value instanceof Temporal.Duration)) throw new WorkflowDurationError(`${label} must be a Temporal.Duration`);
|
|
44
|
+
const amount = value.total({ unit: "millisecond" });
|
|
45
|
+
if (!Number.isFinite(amount)) throw new WorkflowDurationError(`${label} must be finite`);
|
|
46
|
+
return amount;
|
|
47
|
+
}
|
|
48
|
+
/** Returns a retry delay in milliseconds and reports invalid numbers as duration errors. */
|
|
49
|
+
function resolveSafeRetryDelay(value, label) {
|
|
50
|
+
if (value !== void 0 && !Number.isSafeInteger(value)) throw new WorkflowOptionsError(`${label} must be a timer-safe duration`, {
|
|
51
|
+
code: WorkflowErrorCode.OPTIONS_EXPECTED_TIMER_SAFE_DURATION,
|
|
52
|
+
details: { label }
|
|
53
|
+
});
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { durationAmount, greatestOptionalNumber, isAbortError, isNonNegativeSafeInteger, isPositiveSafeInteger, nextPositiveSafeInteger, positiveSafeInteger, resolvePositiveSafeIntegerOption, resolveSafeRetryDelay, safeDuration };
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export { type DirectiveKind, GENERATED_PREFIX, type TransformManifest, type TransformManifestFunction, type TransformManifestImportEdge, type TransformMetadata, type TransformMetadataEntry, type TransformOptions, type TransformResult, type VitePluginOptions, type WorkflowPluginOptions, WorkflowTransformError, makeGeneratedName, transformWorkflowSource, workflow, workflowPlugin };
|
|
1
|
+
import { WorkflowTransformError } from "./compiler/error.mjs";
|
|
2
|
+
import { DirectiveKind, PluginOptions, TransformManifest, TransformManifestFunction, TransformManifestImportEdge, TransformMetadata, TransformMetadataEntry, TransformOptions, TransformResult } from "./types/compiler.mjs";
|
|
3
|
+
import { workflow, workflowPlugin } from "./compiler/plugin.mjs";
|
|
4
|
+
import { GENERATED_PREFIX, makeGeneratedName, transformWorkflowSource } from "./compiler/transform.mjs";
|
|
5
|
+
export { type DirectiveKind, GENERATED_PREFIX, type PluginOptions, type TransformManifest, type TransformManifestFunction, type TransformManifestImportEdge, type TransformMetadata, type TransformMetadataEntry, type TransformOptions, type TransformResult, WorkflowTransformError, makeGeneratedName, transformWorkflowSource, workflow, workflowPlugin };
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { WorkflowTransformError } from "./
|
|
2
|
-
import { GENERATED_PREFIX, makeGeneratedName } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { workflow, workflowPlugin } from "./vite/plugin.mjs";
|
|
1
|
+
import { WorkflowTransformError } from "./compiler/error.mjs";
|
|
2
|
+
import { GENERATED_PREFIX, makeGeneratedName, transformWorkflowSource } from "./compiler/transform.mjs";
|
|
3
|
+
import { workflow, workflowPlugin } from "./compiler/plugin.mjs";
|
|
5
4
|
export { GENERATED_PREFIX, WorkflowTransformError, makeGeneratedName, transformWorkflowSource, workflow, workflowPlugin };
|
package/dist/webpack.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { workflowPlugin } from "./
|
|
1
|
+
import { PluginOptions } from "./types/compiler.mjs";
|
|
2
|
+
import { workflowPlugin } from "./compiler/plugin.mjs";
|
|
3
|
+
import "./esbuild.mjs";
|
|
4
|
+
import "temporal-polyfill/global";
|
|
3
5
|
//#region src/webpack.d.ts
|
|
4
6
|
/** Creates the webpack plugin that compiles workflow and step directives. */
|
|
5
|
-
declare const workflow: (options?:
|
|
7
|
+
export declare const workflow: (options?: PluginOptions | undefined) => import("webpack").WebpackPluginInstance;
|
|
6
8
|
//#endregion
|
|
7
|
-
export { type
|
|
9
|
+
export { type PluginOptions, workflowPlugin };
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { workflowPlugin } from "./
|
|
1
|
+
import { workflowPlugin } from "./compiler/plugin.mjs";
|
|
2
|
+
import "temporal-polyfill/global";
|
|
2
3
|
//#region src/webpack.ts
|
|
3
4
|
/** Creates the webpack plugin that compiles workflow and step directives. */
|
|
4
5
|
const workflow = workflowPlugin.webpack;
|