@hatchet-dev/typescript-sdk 1.13.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/doc_types.d.ts +12 -0
- package/docs/doc_types.js +62 -0
- package/docs/generate.js +87 -0
- package/docs/paths.d.ts +2 -0
- package/docs/paths.js +16 -0
- package/docs/shared.d.ts +3 -0
- package/docs/shared.js +6 -0
- package/package.json +5 -4
- package/{clients → src/clients}/admin/admin-client.d.ts +17 -9
- package/{clients → src/clients}/admin/admin-client.js +26 -10
- package/{clients → src/clients}/dispatcher/action-listener.d.ts +4 -4
- package/{clients → src/clients}/dispatcher/action-listener.js +3 -3
- package/{clients → src/clients}/dispatcher/dispatcher-client.d.ts +10 -10
- package/{clients → src/clients}/dispatcher/dispatcher-client.js +5 -5
- package/{clients → src/clients}/dispatcher/heartbeat/heartbeat-controller.d.ts +2 -2
- package/{clients → src/clients}/dispatcher/heartbeat/heartbeat-controller.js +14 -2
- package/{clients → src/clients}/dispatcher/heartbeat/heartbeat-worker.js +7 -6
- package/{clients → src/clients}/event/event-client.d.ts +8 -9
- package/{clients → src/clients}/event/event-client.js +6 -6
- package/{clients → src/clients}/hatchet-client/client-config.d.ts +17 -7
- package/{clients → src/clients}/hatchet-client/client-config.js +3 -0
- package/{clients → src/clients}/hatchet-client/hatchet-logger.d.ts +1 -1
- package/{clients → src/clients}/hatchet-client/hatchet-logger.js +2 -1
- package/src/clients/hatchet-client/index.d.ts +3 -0
- package/{clients → src/clients}/hatchet-client/index.js +2 -2
- package/{clients → src/clients}/listeners/durable-listener/durable-listener-client.d.ts +11 -5
- package/{clients → src/clients}/listeners/durable-listener/durable-listener-client.js +9 -1
- package/{clients → src/clients}/listeners/durable-listener/pooled-durable-listener-client.d.ts +11 -4
- package/{clients → src/clients}/listeners/durable-listener/pooled-durable-listener-client.js +68 -16
- package/{clients → src/clients}/listeners/run-listener/child-listener-client.d.ts +3 -3
- package/{clients → src/clients}/listeners/run-listener/child-listener-client.js +4 -3
- package/{clients → src/clients}/listeners/run-listener/pooled-child-listener-client.d.ts +11 -3
- package/{clients → src/clients}/listeners/run-listener/pooled-child-listener-client.js +65 -9
- package/src/clients/rest/api.js +21 -0
- package/{clients → src/clients}/rest/generated/Api.d.ts +2 -2
- package/{clients → src/clients}/rest/generated/data-contracts.d.ts +6 -0
- package/{index.d.ts → src/index.d.ts} +3 -4
- package/{index.js → src/index.js} +3 -4
- package/{examples → src/legacy/examples}/affinity-workers.js +2 -2
- package/{examples → src/legacy/examples}/bulk-fanout-trigger.js +1 -1
- package/{examples → src/legacy/examples}/bulk-fanout-worker.js +1 -1
- package/{examples → src/legacy/examples}/bulk-trigger.js +1 -1
- package/{examples → src/legacy/examples}/concurrency/cancel-in-progress/concurrency-event.js +1 -1
- package/{examples → src/legacy/examples}/concurrency/cancel-in-progress/concurrency-worker.js +1 -1
- package/{examples → src/legacy/examples}/concurrency/group-round-robin/concurrency-event.js +1 -1
- package/{examples → src/legacy/examples}/concurrency/group-round-robin/concurrency-worker-expression.js +2 -2
- package/{examples → src/legacy/examples}/concurrency/group-round-robin/concurrency-worker-key-fn.js +2 -2
- package/{examples → src/legacy/examples}/crons/cron-worker.d.ts +1 -1
- package/{examples → src/legacy/examples}/crons/cron-worker.js +1 -1
- package/{examples → src/legacy/examples}/crons/programatic-crons.js +1 -1
- package/{examples → src/legacy/examples}/dag-worker.js +1 -1
- package/{examples → src/legacy/examples}/example-event-with-results.js +2 -2
- package/{examples → src/legacy/examples}/example-event.js +1 -1
- package/{examples → src/legacy/examples}/fanout-worker.js +1 -1
- package/{examples → src/legacy/examples}/logger.js +1 -1
- package/{examples → src/legacy/examples}/manual-trigger.js +1 -1
- package/{examples → src/legacy/examples}/multi-workflow.js +1 -1
- package/{examples → src/legacy/examples}/namespaced-worker.js +1 -1
- package/{examples → src/legacy/examples}/on-failure.js +1 -1
- package/{examples → src/legacy/examples}/rate-limit/events.js +1 -1
- package/{examples → src/legacy/examples}/rate-limit/worker.js +2 -2
- package/{examples → src/legacy/examples}/retries-with-backoff.js +1 -1
- package/{examples → src/legacy/examples}/retries-worker.js +1 -1
- package/{examples → src/legacy/examples}/scheduled-runs/programatic-schedules.js +1 -1
- package/{examples → src/legacy/examples}/simple-worker.d.ts +1 -1
- package/{examples → src/legacy/examples}/simple-worker.js +1 -1
- package/{examples → src/legacy/examples}/sticky-trigger.js +1 -1
- package/{examples → src/legacy/examples}/sticky-worker-with-check.js +2 -2
- package/{examples → src/legacy/examples}/sticky-worker.js +2 -2
- package/{examples → src/legacy/examples}/stream-by-additional-meta.js +2 -2
- package/{clients/hatchet-client/hatchet-client.d.ts → src/legacy/legacy-client.d.ts} +8 -13
- package/src/legacy/legacy-client.js +67 -0
- package/src/legacy/legacy-transformer.d.ts +38 -0
- package/src/legacy/legacy-transformer.js +181 -0
- package/{step.d.ts → src/legacy/step.d.ts} +30 -31
- package/{step.js → src/legacy/step.js} +17 -16
- package/{workflow.d.ts → src/legacy/workflow.d.ts} +47 -50
- package/{workflow.js → src/legacy/workflow.js} +3 -6
- package/{protoc → src/protoc}/v1/workflows.d.ts +8 -0
- package/{protoc → src/protoc}/v1/workflows.js +109 -2
- package/{protoc → src/protoc}/workflows/workflows.d.ts +9 -0
- package/{protoc → src/protoc}/workflows/workflows.js +109 -2
- package/src/sdk.d.ts +2 -0
- package/{sdk.js → src/sdk.js} +1 -1
- package/src/step.d.ts +1 -0
- package/{clients/worker/index.js → src/step.js} +4 -1
- package/src/util/abort-error.d.ts +38 -0
- package/src/util/abort-error.js +58 -0
- package/{util → src/util}/config-loader/config-loader.d.ts +1 -1
- package/{util → src/util}/config-loader/config-loader.js +1 -1
- package/{util → src/util}/grpc-helpers.d.ts +1 -1
- package/src/util/hatchet-promise/hatchet-promise.d.ts +13 -0
- package/{util → src/util}/hatchet-promise/hatchet-promise.js +3 -2
- package/src/util/logger/index.d.ts +2 -0
- package/{util → src/util}/logger/index.js +1 -0
- package/{util → src/util}/logger/logger.d.ts +1 -1
- package/src/util/logger/task-run-log.d.ts +3 -0
- package/src/util/logger/task-run-log.js +20 -0
- package/{util → src/util}/sleep.d.ts +5 -2
- package/src/util/sleep.js +37 -0
- package/{util → src/util}/workflow-run-ref.d.ts +9 -3
- package/{util → src/util}/workflow-run-ref.js +5 -3
- package/{v1 → src/v1}/client/admin.d.ts +24 -8
- package/{v1 → src/v1}/client/admin.js +50 -18
- package/{v1 → src/v1}/client/client.d.ts +59 -23
- package/{v1 → src/v1}/client/client.interface.d.ts +9 -2
- package/{v1 → src/v1}/client/client.js +73 -35
- package/{v1 → src/v1}/client/features/cel.d.ts +1 -1
- package/{v1 → src/v1}/client/features/cel.js +1 -1
- package/{v1 → src/v1}/client/features/crons.d.ts +8 -6
- package/{v1 → src/v1}/client/features/crons.js +6 -5
- package/{v1 → src/v1}/client/features/filters.d.ts +30 -0
- package/{v1 → src/v1}/client/features/filters.js +30 -0
- package/{v1 → src/v1}/client/features/metrics.d.ts +10 -6
- package/{v1 → src/v1}/client/features/metrics.js +10 -6
- package/src/v1/client/features/ratelimits.d.ts +30 -0
- package/{v1 → src/v1}/client/features/ratelimits.js +13 -3
- package/{v1 → src/v1}/client/features/runs.d.ts +43 -8
- package/{v1 → src/v1}/client/features/runs.js +38 -3
- package/{v1 → src/v1}/client/features/schedules.d.ts +7 -4
- package/{v1 → src/v1}/client/features/schedules.js +7 -5
- package/{v1 → src/v1}/client/features/tenant.d.ts +4 -1
- package/src/v1/client/features/webhooks.d.ts +54 -0
- package/{v1 → src/v1}/client/features/webhooks.js +31 -5
- package/src/v1/client/features/workers.d.ts +38 -0
- package/{v1 → src/v1}/client/features/workers.js +25 -1
- package/src/v1/client/features/workflows.d.ts +42 -0
- package/{v1 → src/v1}/client/features/workflows.js +27 -10
- package/{v1 → src/v1}/client/worker/context.d.ts +78 -18
- package/{v1 → src/v1}/client/worker/context.js +120 -27
- package/{v1 → src/v1}/client/worker/deprecated/deprecation.d.ts +1 -1
- package/{v1 → src/v1}/client/worker/deprecated/legacy-registration.d.ts +2 -2
- package/{v1 → src/v1}/client/worker/deprecated/legacy-registration.js +2 -2
- package/{v1 → src/v1}/client/worker/deprecated/legacy-v1-worker.d.ts +5 -5
- package/{v1 → src/v1}/client/worker/deprecated/legacy-v1-worker.js +2 -2
- package/{v1 → src/v1}/client/worker/deprecated/legacy-worker.js +9 -7
- package/{v1 → src/v1}/client/worker/health-server.d.ts +1 -1
- package/{v1 → src/v1}/client/worker/slot-utils.d.ts +3 -3
- package/{v1 → src/v1}/client/worker/worker-internal.d.ts +13 -22
- package/{v1 → src/v1}/client/worker/worker-internal.js +232 -216
- package/{v1 → src/v1}/client/worker/worker.d.ts +19 -19
- package/{v1 → src/v1}/client/worker/worker.js +45 -30
- package/{v1 → src/v1}/conditions/transformer.d.ts +1 -1
- package/{v1 → src/v1}/declaration.d.ts +120 -15
- package/{v1 → src/v1}/declaration.js +118 -10
- package/src/v1/examples/__e2e__/harness.d.ts +19 -0
- package/src/v1/examples/__e2e__/harness.js +70 -0
- package/{v1 → src/v1}/examples/affinity/affinity-workers.js +4 -4
- package/src/v1/examples/bulk_fanout/workflow.d.ts +9 -0
- package/src/v1/examples/bulk_fanout/workflow.js +34 -0
- package/src/v1/examples/bulk_operations/workflow.d.ts +3 -0
- package/src/v1/examples/bulk_operations/workflow.js +44 -0
- package/src/v1/examples/cancellation/cancellation-workflow.d.ts +2 -0
- package/src/v1/examples/cancellation/cancellation-workflow.js +69 -0
- package/src/v1/examples/cancellation/run.js +53 -0
- package/src/v1/examples/cancellation/worker.js +29 -0
- package/{v1 → src/v1}/examples/cancellations/run.js +1 -1
- package/{v1 → src/v1}/examples/cancellations/workflow.js +1 -1
- package/{v1 → src/v1}/examples/concurrency-rr/workflow.js +1 -1
- package/src/v1/examples/concurrency-types.d.ts +5 -0
- package/src/v1/examples/concurrency_cancel_in_progress/workflow.d.ts +9 -0
- package/src/v1/examples/concurrency_cancel_in_progress/workflow.js +45 -0
- package/src/v1/examples/concurrency_cancel_newest/workflow.d.ts +9 -0
- package/src/v1/examples/concurrency_cancel_newest/workflow.js +45 -0
- package/src/v1/examples/concurrency_limit_rr/load.js +54 -0
- package/src/v1/examples/concurrency_limit_rr/run.js +39 -0
- package/src/v1/examples/concurrency_limit_rr/worker.js +24 -0
- package/src/v1/examples/concurrency_limit_rr/workflow.d.ts +12 -0
- package/src/v1/examples/concurrency_limit_rr/workflow.js +62 -0
- package/src/v1/examples/concurrency_multiple_keys/workflow.d.ts +12 -0
- package/src/v1/examples/concurrency_multiple_keys/workflow.js +42 -0
- package/src/v1/examples/concurrency_workflow_level/workflow.d.ts +13 -0
- package/src/v1/examples/concurrency_workflow_level/workflow.js +49 -0
- package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/complex-workflow.js +2 -2
- package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/workflow.js +2 -2
- package/{v1 → src/v1}/examples/dag/interface-workflow.d.ts +2 -2
- package/src/v1/examples/dag_match_condition/complex-workflow.d.ts +1 -0
- package/src/v1/examples/dag_match_condition/complex-workflow.js +107 -0
- package/src/v1/examples/dag_match_condition/run.js +25 -0
- package/src/v1/examples/dag_match_condition/worker.js +24 -0
- package/src/v1/examples/dag_match_condition/workflow.d.ts +11 -0
- package/src/v1/examples/dag_match_condition/workflow.js +41 -0
- package/{v1 → src/v1}/examples/deep/workflow.js +1 -1
- package/src/v1/examples/durable/workflow.d.ts +7 -0
- package/src/v1/examples/durable/workflow.js +116 -0
- package/{v1 → src/v1}/examples/durable-event/workflow.js +1 -1
- package/src/v1/examples/durable-sleep/event.js +28 -0
- package/{v1 → src/v1}/examples/durable-sleep/workflow.js +1 -1
- package/src/v1/examples/durable_event/event.js +28 -0
- package/src/v1/examples/durable_event/run.js +30 -0
- package/src/v1/examples/durable_event/worker.js +24 -0
- package/src/v1/examples/durable_event/workflow.d.ts +6 -0
- package/src/v1/examples/durable_event/workflow.js +46 -0
- package/src/v1/examples/durable_sleep/event.js +28 -0
- package/src/v1/examples/durable_sleep/run.js +30 -0
- package/src/v1/examples/durable_sleep/worker.js +24 -0
- package/src/v1/examples/durable_sleep/workflow.d.ts +1 -0
- package/src/v1/examples/durable_sleep/workflow.js +31 -0
- package/src/v1/examples/e2e-worker.js +82 -0
- package/src/v1/examples/events/filter.js +32 -0
- package/{v1 → src/v1}/examples/hatchet-client.d.ts +1 -1
- package/{v1 → src/v1}/examples/hatchet-client.js +1 -1
- package/{v1 → src/v1}/examples/high-memory/workflow-with-child.js +1 -1
- package/{v1 → src/v1}/examples/landing_page/durable-excution.js +1 -1
- package/{v1 → src/v1}/examples/landing_page/flow-control.js +1 -1
- package/src/v1/examples/legacy/workflow.d.ts +2 -0
- package/{examples → src/v1/examples/logger}/byo-logger.js +1 -1
- package/src/v1/examples/logger/workflow.d.ts +2 -0
- package/src/v1/examples/logger/workflow.js +38 -0
- package/src/v1/examples/logging/byo-logger.js +73 -0
- package/src/v1/examples/logging/logger.js +46 -0
- package/{v1 → src/v1}/examples/middleware/client.d.ts +1 -1
- package/{v1 → src/v1}/examples/middleware/client.js +1 -1
- package/{v1 → src/v1}/examples/middleware/recipes.js +1 -1
- package/{v1 → src/v1}/examples/migration-guides/hatchet-client.d.ts +1 -1
- package/{v1 → src/v1}/examples/migration-guides/hatchet-client.js +1 -1
- package/{v1 → src/v1}/examples/multiple_wf_concurrency/workflow.d.ts +1 -1
- package/{v1 → src/v1}/examples/multiple_wf_concurrency/workflow.js +3 -3
- package/{v1 → src/v1}/examples/non_retryable/workflow.js +1 -1
- package/src/v1/examples/on_event/event.js +53 -0
- package/src/v1/examples/on_event/worker.js +24 -0
- package/src/v1/examples/on_event/workflow.d.ts +19 -0
- package/src/v1/examples/on_event/workflow.js +60 -0
- package/{v1 → src/v1}/examples/on_failure/workflow.d.ts +1 -0
- package/{v1 → src/v1}/examples/on_failure/workflow.js +12 -7
- package/{v1 → src/v1}/examples/priority/run.js +1 -1
- package/src/v1/examples/priority/workflow.d.ts +8 -0
- package/{v1 → src/v1}/examples/priority/workflow.js +2 -2
- package/{v1 → src/v1}/examples/quickstart/hatchet-client.d.ts +1 -1
- package/{v1 → src/v1}/examples/quickstart/hatchet-client.js +1 -1
- package/src/v1/examples/quickstart/run.d.ts +1 -0
- package/src/v1/examples/quickstart/worker.d.ts +1 -0
- package/src/v1/examples/rate_limit/workflow.d.ts +1 -0
- package/{v1 → src/v1}/examples/rate_limit/workflow.js +1 -1
- package/src/v1/examples/retries/run.d.ts +1 -0
- package/src/v1/examples/retries/worker.d.ts +1 -0
- package/{v1 → src/v1}/examples/retries/workflow.js +2 -2
- package/src/v1/examples/return_exceptions/workflow.d.ts +6 -0
- package/src/v1/examples/return_exceptions/workflow.js +22 -0
- package/src/v1/examples/run_details/workflow.d.ts +4 -0
- package/src/v1/examples/run_details/workflow.js +65 -0
- package/src/v1/examples/runtime_affinity/workflow.d.ts +3 -0
- package/src/v1/examples/runtime_affinity/workflow.js +19 -0
- package/src/v1/examples/simple/bulk.d.ts +1 -0
- package/src/v1/examples/simple/client-run.d.ts +1 -0
- package/src/v1/examples/simple/cron.d.ts +1 -0
- package/src/v1/examples/simple/delay.d.ts +1 -0
- package/src/v1/examples/simple/e2e-workflows.d.ts +14 -0
- package/src/v1/examples/simple/e2e-workflows.js +27 -0
- package/src/v1/examples/simple/enqueue.d.ts +1 -0
- package/{v1 → src/v1}/examples/simple/enqueue.js +2 -2
- package/src/v1/examples/simple/replay-cancel.d.ts +1 -0
- package/{v1 → src/v1}/examples/simple/replay-cancel.js +1 -1
- package/src/v1/examples/simple/schedule.d.ts +1 -0
- package/src/v1/examples/simple/typed-run-methods.d.ts +1 -0
- package/src/v1/examples/simple/worker.d.ts +1 -0
- package/src/v1/examples/sticky/run.d.ts +1 -0
- package/src/v1/examples/sticky/worker.d.ts +1 -0
- package/src/v1/examples/sticky/workflow.d.ts +5 -0
- package/{v1 → src/v1}/examples/sticky/workflow.js +2 -2
- package/src/v1/examples/streaming/run.d.ts +1 -0
- package/src/v1/examples/streaming/worker.d.ts +1 -0
- package/src/v1/examples/timeout/run.d.ts +1 -0
- package/src/v1/examples/timeout/run.js +30 -0
- package/src/v1/examples/timeout/worker.d.ts +1 -0
- package/src/v1/examples/timeout/worker.js +25 -0
- package/src/v1/examples/timeout/workflow.d.ts +10 -0
- package/src/v1/examples/timeout/workflow.js +56 -0
- package/src/v1/examples/timeouts/run.d.ts +1 -0
- package/src/v1/examples/timeouts/worker.d.ts +1 -0
- package/{v1 → src/v1}/examples/timeouts/workflow.js +1 -1
- package/src/v1/examples/webhooks/workflow.d.ts +5 -0
- package/src/v1/examples/webhooks/workflow.js +23 -0
- package/{v1 → src/v1}/examples/with_timeouts/workflow.js +1 -1
- package/{v1 → src/v1}/index.d.ts +1 -0
- package/{v1 → src/v1}/index.js +1 -0
- package/{v1 → src/v1}/parent-run-context-vars.d.ts +6 -0
- package/{v1 → src/v1}/parent-run-context-vars.js +3 -0
- package/{v1 → src/v1}/task.d.ts +22 -7
- package/src/v1/task.js +14 -0
- package/{v1 → src/v1}/types.d.ts +1 -1
- package/src/v1/types.js +2 -0
- package/src/version.d.ts +1 -0
- package/{version.js → src/version.js} +1 -1
- package/src/workflow.d.ts +3 -0
- package/src/workflow.js +25 -0
- package/clients/hatchet-client/hatchet-client.js +0 -108
- package/clients/hatchet-client/index.d.ts +0 -3
- package/clients/rest/api.js +0 -13
- package/clients/worker/handler.d.ts +0 -50
- package/clients/worker/handler.js +0 -214
- package/clients/worker/index.d.ts +0 -1
- package/clients/worker/worker.d.ts +0 -59
- package/clients/worker/worker.js +0 -568
- package/examples/webhooks.js +0 -45
- package/sdk.d.ts +0 -2
- package/util/hatchet-promise/hatchet-promise.d.ts +0 -6
- package/util/logger/index.d.ts +0 -1
- package/util/sleep.js +0 -14
- package/v1/client/features/ratelimits.d.ts +0 -20
- package/v1/client/features/webhooks.d.ts +0 -28
- package/v1/client/features/workers.d.ts +0 -14
- package/v1/client/features/workflows.d.ts +0 -24
- package/v1/examples/legacy/workflow.d.ts +0 -2
- package/v1/examples/priority/workflow.d.ts +0 -8
- package/v1/examples/sticky/workflow.d.ts +0 -5
- package/v1/task.js +0 -11
- package/version.d.ts +0 -1
- /package/{clients/dispatcher/heartbeat/heartbeat-worker.d.ts → docs/generate.d.ts} +0 -0
- /package/{clients → src/clients}/admin/index.d.ts +0 -0
- /package/{clients → src/clients}/admin/index.js +0 -0
- /package/{examples/affinity-workers.d.ts → src/clients/dispatcher/heartbeat/heartbeat-worker.d.ts} +0 -0
- /package/{clients → src/clients}/rest/api.d.ts +0 -0
- /package/{clients → src/clients}/rest/generated/Api.js +0 -0
- /package/{clients → src/clients}/rest/generated/data-contracts.js +0 -0
- /package/{clients → src/clients}/rest/generated/http-client.d.ts +0 -0
- /package/{clients → src/clients}/rest/generated/http-client.js +0 -0
- /package/{clients → src/clients}/rest/index.d.ts +0 -0
- /package/{clients → src/clients}/rest/index.js +0 -0
- /package/{v1/examples/affinity → src/legacy/examples}/affinity-workers.d.ts +0 -0
- /package/{examples → src/legacy/examples}/bulk-fanout-trigger.d.ts +0 -0
- /package/{examples → src/legacy/examples}/bulk-fanout-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/bulk-trigger.d.ts +0 -0
- /package/{examples → src/legacy/examples}/byo-logger.d.ts +0 -0
- /package/{v1/examples/logging → src/legacy/examples}/byo-logger.js +0 -0
- /package/{examples → src/legacy/examples}/concurrency/cancel-in-progress/concurrency-event.d.ts +0 -0
- /package/{examples → src/legacy/examples}/concurrency/cancel-in-progress/concurrency-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/concurrency/group-round-robin/concurrency-event.d.ts +0 -0
- /package/{examples → src/legacy/examples}/concurrency/group-round-robin/concurrency-worker-expression.d.ts +0 -0
- /package/{examples → src/legacy/examples}/concurrency/group-round-robin/concurrency-worker-key-fn.d.ts +0 -0
- /package/{examples → src/legacy/examples}/crons/programatic-crons.d.ts +0 -0
- /package/{examples → src/legacy/examples}/dag-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/example-event-with-results.d.ts +0 -0
- /package/{examples → src/legacy/examples}/example-event.d.ts +0 -0
- /package/{examples → src/legacy/examples}/fanout-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/logger.d.ts +0 -0
- /package/{examples → src/legacy/examples}/manual-trigger.d.ts +0 -0
- /package/{examples → src/legacy/examples}/multi-workflow.d.ts +0 -0
- /package/{examples → src/legacy/examples}/namespaced-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/on-failure.d.ts +0 -0
- /package/{examples → src/legacy/examples}/rate-limit/events.d.ts +0 -0
- /package/{examples → src/legacy/examples}/rate-limit/worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/retries-with-backoff.d.ts +0 -0
- /package/{examples → src/legacy/examples}/retries-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/scheduled-runs/programatic-schedules.d.ts +0 -0
- /package/{examples → src/legacy/examples}/sticky-trigger.d.ts +0 -0
- /package/{examples → src/legacy/examples}/sticky-worker-with-check.d.ts +0 -0
- /package/{examples → src/legacy/examples}/sticky-worker.d.ts +0 -0
- /package/{examples → src/legacy/examples}/stream-by-additional-meta.d.ts +0 -0
- /package/{protoc → src/protoc}/dispatcher/dispatcher.d.ts +0 -0
- /package/{protoc → src/protoc}/dispatcher/dispatcher.js +0 -0
- /package/{protoc → src/protoc}/dispatcher/index.d.ts +0 -0
- /package/{protoc → src/protoc}/dispatcher/index.js +0 -0
- /package/{protoc → src/protoc}/events/events.d.ts +0 -0
- /package/{protoc → src/protoc}/events/events.js +0 -0
- /package/{protoc → src/protoc}/events/index.d.ts +0 -0
- /package/{protoc → src/protoc}/events/index.js +0 -0
- /package/{protoc → src/protoc}/google/protobuf/timestamp.d.ts +0 -0
- /package/{protoc → src/protoc}/google/protobuf/timestamp.js +0 -0
- /package/{protoc → src/protoc}/google/protobuf/wrappers.d.ts +0 -0
- /package/{protoc → src/protoc}/google/protobuf/wrappers.js +0 -0
- /package/{protoc → src/protoc}/v1/dispatcher.d.ts +0 -0
- /package/{protoc → src/protoc}/v1/dispatcher.js +0 -0
- /package/{protoc → src/protoc}/v1/shared/condition.d.ts +0 -0
- /package/{protoc → src/protoc}/v1/shared/condition.js +0 -0
- /package/{protoc → src/protoc}/workflows/index.d.ts +0 -0
- /package/{protoc → src/protoc}/workflows/index.js +0 -0
- /package/{protoc → src/protoc}/workflows/v1-admin.d.ts +0 -0
- /package/{protoc → src/protoc}/workflows/v1-admin.js +0 -0
- /package/{util → src/util}/apply-namespace.d.ts +0 -0
- /package/{util → src/util}/apply-namespace.js +0 -0
- /package/{util → src/util}/batch.d.ts +0 -0
- /package/{util → src/util}/batch.js +0 -0
- /package/{util → src/util}/config-loader/index.d.ts +0 -0
- /package/{util → src/util}/config-loader/index.js +0 -0
- /package/{util → src/util}/config-loader/token.d.ts +0 -0
- /package/{util → src/util}/config-loader/token.js +0 -0
- /package/{util → src/util}/errors/hatchet-error.d.ts +0 -0
- /package/{util → src/util}/errors/hatchet-error.js +0 -0
- /package/{util → src/util}/grpc-helpers.js +0 -0
- /package/{util → src/util}/logger/logger.js +0 -0
- /package/{util → src/util}/parse.d.ts +0 -0
- /package/{util → src/util}/parse.js +0 -0
- /package/{util → src/util}/retrier.d.ts +0 -0
- /package/{util → src/util}/retrier.js +0 -0
- /package/{util → src/util}/thread-helper.d.ts +0 -0
- /package/{util → src/util}/thread-helper.js +0 -0
- /package/{util → src/util}/uuid.d.ts +0 -0
- /package/{util → src/util}/uuid.js +0 -0
- /package/{v1 → src/v1}/client/client.interface.js +0 -0
- /package/{v1 → src/v1}/client/duration.d.ts +0 -0
- /package/{v1 → src/v1}/client/duration.js +0 -0
- /package/{v1 → src/v1}/client/features/index.d.ts +0 -0
- /package/{v1 → src/v1}/client/features/index.js +0 -0
- /package/{v1 → src/v1}/client/features/tenant.js +0 -0
- /package/{v1 → src/v1}/client/worker/deprecated/deprecation.js +0 -0
- /package/{v1 → src/v1}/client/worker/deprecated/index.d.ts +0 -0
- /package/{v1 → src/v1}/client/worker/deprecated/index.js +0 -0
- /package/{v1 → src/v1}/client/worker/deprecated/legacy-worker.d.ts +0 -0
- /package/{v1 → src/v1}/client/worker/health-server.js +0 -0
- /package/{v1 → src/v1}/client/worker/slot-utils.js +0 -0
- /package/{v1 → src/v1}/conditions/base.d.ts +0 -0
- /package/{v1 → src/v1}/conditions/base.js +0 -0
- /package/{v1 → src/v1}/conditions/index.d.ts +0 -0
- /package/{v1 → src/v1}/conditions/index.js +0 -0
- /package/{v1 → src/v1}/conditions/parent-condition.d.ts +0 -0
- /package/{v1 → src/v1}/conditions/parent-condition.js +0 -0
- /package/{v1 → src/v1}/conditions/sleep-condition.d.ts +0 -0
- /package/{v1 → src/v1}/conditions/sleep-condition.js +0 -0
- /package/{v1 → src/v1}/conditions/transformer.js +0 -0
- /package/{v1 → src/v1}/conditions/user-event-condition.d.ts +0 -0
- /package/{v1 → src/v1}/conditions/user-event-condition.js +0 -0
- /package/{examples/webhooks.d.ts → src/v1/examples/affinity/affinity-workers.d.ts} +0 -0
- /package/{v1/examples/cancellations → src/v1/examples/cancellation}/run.d.ts +0 -0
- /package/{v1/examples/cancellations → src/v1/examples/cancellation}/worker.d.ts +0 -0
- /package/{v1/examples/child_workflows → src/v1/examples/cancellations}/run.d.ts +0 -0
- /package/{v1/examples/child_workflows → src/v1/examples/cancellations}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/cancellations/worker.js +0 -0
- /package/{v1 → src/v1}/examples/cancellations/workflow.d.ts +0 -0
- /package/{v1/examples/concurrency-rr → src/v1/examples/child_workflows}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/child_workflows/run.js +0 -0
- /package/{v1/examples/concurrency-rr → src/v1/examples/child_workflows}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/child_workflows/worker.js +0 -0
- /package/{v1 → src/v1}/examples/child_workflows/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/child_workflows/workflow.js +0 -0
- /package/{v1 → src/v1}/examples/concurrency-rr/load.d.ts +0 -0
- /package/{v1 → src/v1}/examples/concurrency-rr/load.js +0 -0
- /package/{v1/examples/dag → src/v1/examples/concurrency-rr}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/concurrency-rr/run.js +0 -0
- /package/{v1/examples/dag → src/v1/examples/concurrency-rr}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/concurrency-rr/worker.js +0 -0
- /package/{v1 → src/v1}/examples/concurrency-rr/workflow.d.ts +0 -0
- /package/{v1/types.js → src/v1/examples/concurrency-types.js} +0 -0
- /package/{v1/examples/dag_match_condition/event.d.ts → src/v1/examples/concurrency_limit_rr/load.d.ts} +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/concurrency_limit_rr}/run.d.ts +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/concurrency_limit_rr}/worker.d.ts +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/complex-workflow.d.ts +0 -0
- /package/{v1/examples/durable-event → src/v1/examples/conditions}/event.d.ts +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/event.js +0 -0
- /package/{v1/examples/deep → src/v1/examples/conditions}/run.d.ts +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/run.js +0 -0
- /package/{v1/examples/deep → src/v1/examples/conditions}/worker.d.ts +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/worker.js +0 -0
- /package/{v1/examples/dag_match_condition → src/v1/examples/conditions}/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/dag/interface-workflow.js +0 -0
- /package/{v1/examples/durable-event → src/v1/examples/dag}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/dag/run.js +0 -0
- /package/{v1/examples/durable-event → src/v1/examples/dag}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/dag/worker.js +0 -0
- /package/{v1 → src/v1}/examples/dag/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/dag/workflow.js +0 -0
- /package/{v1/examples/durable-sleep → src/v1/examples/dag_match_condition}/event.d.ts +0 -0
- /package/{v1/examples/durable-sleep → src/v1/examples/dag_match_condition}/event.js +0 -0
- /package/{v1/examples/durable-sleep → src/v1/examples/dag_match_condition}/run.d.ts +0 -0
- /package/{v1/examples/durable-sleep → src/v1/examples/dag_match_condition}/worker.d.ts +0 -0
- /package/{v1/examples/high-memory → src/v1/examples/deep}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/deep/run.js +0 -0
- /package/{v1/examples/inferred-typing → src/v1/examples/deep}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/deep/worker.js +0 -0
- /package/{v1 → src/v1}/examples/deep/workflow.d.ts +0 -0
- /package/{v1/examples/on_event → src/v1/examples/durable-event}/event.d.ts +0 -0
- /package/{v1 → src/v1}/examples/durable-event/event.js +0 -0
- /package/{v1/examples/inferred-typing → src/v1/examples/durable-event}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/durable-event/run.js +0 -0
- /package/{v1/examples/legacy → src/v1/examples/durable-event}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/durable-event/worker.js +0 -0
- /package/{v1 → src/v1}/examples/durable-event/workflow.d.ts +0 -0
- /package/{v1/examples/high-memory/child-worker.d.ts → src/v1/examples/durable-sleep/event.d.ts} +0 -0
- /package/{v1/examples/legacy → src/v1/examples/durable-sleep}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/durable-sleep/run.js +0 -0
- /package/{v1/examples/middleware → src/v1/examples/durable-sleep}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/durable-sleep/worker.js +0 -0
- /package/{v1 → src/v1}/examples/durable-sleep/workflow.d.ts +0 -0
- /package/{v1/examples/high-memory/parent-worker.d.ts → src/v1/examples/durable_event/event.d.ts} +0 -0
- /package/{v1/examples/middleware → src/v1/examples/durable_event}/run.d.ts +0 -0
- /package/{v1/examples/multiple_wf_concurrency → src/v1/examples/durable_event}/worker.d.ts +0 -0
- /package/{v1/examples/landing_page/scheduling.d.ts → src/v1/examples/durable_sleep/event.d.ts} +0 -0
- /package/{v1/examples/multiple_wf_concurrency → src/v1/examples/durable_sleep}/run.d.ts +0 -0
- /package/{v1/examples/non_retryable → src/v1/examples/durable_sleep}/worker.d.ts +0 -0
- /package/{v1/examples/logging/byo-logger.d.ts → src/v1/examples/e2e-worker.d.ts} +0 -0
- /package/{v1/examples/logging/logger.d.ts → src/v1/examples/events/event.d.ts} +0 -0
- /package/{v1/examples/on_event → src/v1/examples/events}/event.js +0 -0
- /package/{v1/examples/on_event → src/v1/examples/events}/filter.d.ts +0 -0
- /package/{v1/examples/on_cron → src/v1/examples/events}/worker.d.ts +0 -0
- /package/{v1/examples/on_event → src/v1/examples/events}/worker.js +0 -0
- /package/{v1/examples/on_event → src/v1/examples/events}/workflow.d.ts +0 -0
- /package/{v1/examples/on_event → src/v1/examples/events}/workflow.js +0 -0
- /package/{v1/examples/middleware/recipes.d.ts → src/v1/examples/high-memory/child-worker.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/high-memory/child-worker.js +0 -0
- /package/{v1/examples/non_retryable/run.d.ts → src/v1/examples/high-memory/parent-worker.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/high-memory/parent-worker.js +0 -0
- /package/{v1/examples/on_failure → src/v1/examples/high-memory}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/high-memory/run.js +0 -0
- /package/{v1 → src/v1}/examples/high-memory/workflow-with-child.d.ts +0 -0
- /package/{v1/examples/on_success → src/v1/examples/inferred-typing}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/inferred-typing/run.js +0 -0
- /package/{v1/examples/on_event → src/v1/examples/inferred-typing}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/inferred-typing/worker.js +0 -0
- /package/{v1 → src/v1}/examples/inferred-typing/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/inferred-typing/workflow.js +0 -0
- /package/{v1 → src/v1}/examples/landing_page/durable-excution.d.ts +0 -0
- /package/{v1 → src/v1}/examples/landing_page/event-signaling.d.ts +0 -0
- /package/{v1 → src/v1}/examples/landing_page/event-signaling.js +0 -0
- /package/{v1 → src/v1}/examples/landing_page/flow-control.d.ts +0 -0
- /package/{v1 → src/v1}/examples/landing_page/queues.d.ts +0 -0
- /package/{v1 → src/v1}/examples/landing_page/queues.js +0 -0
- /package/{v1/examples/on_failure/worker.d.ts → src/v1/examples/landing_page/scheduling.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/landing_page/scheduling.js +0 -0
- /package/{v1 → src/v1}/examples/landing_page/task-routing.d.ts +0 -0
- /package/{v1 → src/v1}/examples/landing_page/task-routing.js +0 -0
- /package/{v1/examples/priority → src/v1/examples/legacy}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/legacy/run.js +0 -0
- /package/{v1/examples/on_success → src/v1/examples/legacy}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/legacy/worker.js +0 -0
- /package/{v1 → src/v1}/examples/legacy/workflow.js +0 -0
- /package/{v1/examples/priority/worker.d.ts → src/v1/examples/logger/byo-logger.d.ts} +0 -0
- /package/{v1/examples/quickstart/run.d.ts → src/v1/examples/logger/logger.d.ts} +0 -0
- /package/{v1/examples/logging → src/v1/examples/logger}/logger.js +0 -0
- /package/{v1/examples/quickstart/worker.d.ts → src/v1/examples/logging/byo-logger.d.ts} +0 -0
- /package/{v1/examples/rate_limit/workflow.d.ts → src/v1/examples/logging/logger.d.ts} +0 -0
- /package/{v1/examples/retries/run.d.ts → src/v1/examples/middleware/recipes.d.ts} +0 -0
- /package/{v1/examples/sticky → src/v1/examples/middleware}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/middleware/run.js +0 -0
- /package/{v1/examples/retries → src/v1/examples/middleware}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/middleware/worker.js +0 -0
- /package/{v1 → src/v1}/examples/middleware/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/middleware/workflow.js +0 -0
- /package/{v1 → src/v1}/examples/migration-guides/mergent.d.ts +0 -0
- /package/{v1 → src/v1}/examples/migration-guides/mergent.js +0 -0
- /package/{v1/examples/streaming → src/v1/examples/multiple_wf_concurrency}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/multiple_wf_concurrency/run.js +0 -0
- /package/{v1/examples/simple → src/v1/examples/multiple_wf_concurrency}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/multiple_wf_concurrency/worker.js +0 -0
- /package/{v1/examples/timeouts → src/v1/examples/non_retryable}/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/non_retryable/run.js +0 -0
- /package/{v1/examples/sticky → src/v1/examples/non_retryable}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/non_retryable/worker.js +0 -0
- /package/{v1 → src/v1}/examples/non_retryable/workflow.d.ts +0 -0
- /package/{v1/examples/streaming → src/v1/examples/on_cron}/worker.d.ts +0 -0
- /package/{v1 → src/v1}/examples/on_cron/worker.js +0 -0
- /package/{v1 → src/v1}/examples/on_cron/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/on_cron/workflow.js +0 -0
- /package/{v1/examples/simple/bulk.d.ts → src/v1/examples/on_event/event.d.ts} +0 -0
- /package/{v1/examples/simple/client-run.d.ts → src/v1/examples/on_event/filter.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/on_event/filter.js +0 -0
- /package/{v1/examples/timeouts → src/v1/examples/on_event}/worker.d.ts +0 -0
- /package/{v1/examples/simple/cron.d.ts → src/v1/examples/on_failure/run.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/on_failure/run.js +0 -0
- /package/{v1/examples/simple/delay.d.ts → src/v1/examples/on_failure/worker.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/on_failure/worker.js +0 -0
- /package/{v1/examples/simple/enqueue.d.ts → src/v1/examples/on_success/run.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/on_success/run.js +0 -0
- /package/{v1/examples/simple/replay-cancel.d.ts → src/v1/examples/on_success/worker.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/on_success/worker.js +0 -0
- /package/{v1 → src/v1}/examples/on_success/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/on_success/workflow.js +0 -0
- /package/{v1/examples/simple/schedule.d.ts → src/v1/examples/priority/run.d.ts} +0 -0
- /package/{v1/examples/simple/typed-run-methods.d.ts → src/v1/examples/priority/worker.d.ts} +0 -0
- /package/{v1 → src/v1}/examples/priority/worker.js +0 -0
- /package/{v1 → src/v1}/examples/quickstart/run.js +0 -0
- /package/{v1 → src/v1}/examples/quickstart/worker.js +0 -0
- /package/{v1 → src/v1}/examples/quickstart/workflows/first-task.d.ts +0 -0
- /package/{v1 → src/v1}/examples/quickstart/workflows/first-task.js +0 -0
- /package/{v1 → src/v1}/examples/retries/run.js +0 -0
- /package/{v1 → src/v1}/examples/retries/worker.js +0 -0
- /package/{v1 → src/v1}/examples/retries/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/simple/bulk.js +0 -0
- /package/{v1 → src/v1}/examples/simple/client-run.js +0 -0
- /package/{v1 → src/v1}/examples/simple/cron.js +0 -0
- /package/{v1 → src/v1}/examples/simple/delay.js +0 -0
- /package/{v1 → src/v1}/examples/simple/run.d.ts +0 -0
- /package/{v1 → src/v1}/examples/simple/run.js +0 -0
- /package/{v1 → src/v1}/examples/simple/schedule.js +0 -0
- /package/{v1 → src/v1}/examples/simple/stub-workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/simple/stub-workflow.js +0 -0
- /package/{v1 → src/v1}/examples/simple/typed-run-methods.js +0 -0
- /package/{v1 → src/v1}/examples/simple/worker.js +0 -0
- /package/{v1 → src/v1}/examples/simple/workflow-with-child.d.ts +0 -0
- /package/{v1 → src/v1}/examples/simple/workflow-with-child.js +0 -0
- /package/{v1 → src/v1}/examples/simple/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/simple/workflow.js +0 -0
- /package/{v1 → src/v1}/examples/simple/zod.d.ts +0 -0
- /package/{v1 → src/v1}/examples/simple/zod.js +0 -0
- /package/{v1 → src/v1}/examples/sticky/run.js +0 -0
- /package/{v1 → src/v1}/examples/sticky/worker.js +0 -0
- /package/{v1 → src/v1}/examples/streaming/nextjs-proxy.d.ts +0 -0
- /package/{v1 → src/v1}/examples/streaming/nextjs-proxy.js +0 -0
- /package/{v1 → src/v1}/examples/streaming/run.js +0 -0
- /package/{v1 → src/v1}/examples/streaming/worker.js +0 -0
- /package/{v1 → src/v1}/examples/streaming/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/streaming/workflow.js +0 -0
- /package/{v1 → src/v1}/examples/timeouts/run.js +0 -0
- /package/{v1 → src/v1}/examples/timeouts/worker.js +0 -0
- /package/{v1 → src/v1}/examples/timeouts/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/examples/with_timeouts/workflow.d.ts +0 -0
- /package/{v1 → src/v1}/slot-types.d.ts +0 -0
- /package/{v1 → src/v1}/slot-types.js +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { WorkerLabels } from '
|
|
2
|
-
import { LegacyHatchetClient } from '../../../clients/hatchet-client';
|
|
3
|
-
import { Workflow as V0Workflow } from '../../../workflow';
|
|
4
|
-
import { WebhookWorkerCreateRequest } from '../../../clients/rest/generated/data-contracts';
|
|
1
|
+
import { WorkerLabels } from '../../../../clients/dispatcher/dispatcher-client';
|
|
5
2
|
import { BaseWorkflowDeclaration } from '../../declaration';
|
|
3
|
+
import type { LegacyWorkflow } from '../../../legacy/legacy-transformer';
|
|
6
4
|
import { HatchetClient } from '../..';
|
|
7
|
-
import {
|
|
5
|
+
import { InternalWorker } from './worker-internal';
|
|
8
6
|
import { type WorkerSlotOptions } from './slot-utils';
|
|
9
7
|
/**
|
|
10
8
|
* Options for creating a new hatchet worker
|
|
@@ -23,9 +21,8 @@ export declare class Worker {
|
|
|
23
21
|
config: CreateWorkerOpts;
|
|
24
22
|
name: string;
|
|
25
23
|
_v1: HatchetClient;
|
|
26
|
-
_v0: LegacyHatchetClient;
|
|
27
24
|
/** Internal reference to the underlying V0 worker implementation */
|
|
28
|
-
_internal:
|
|
25
|
+
_internal: InternalWorker;
|
|
29
26
|
/** Set when connected to a legacy engine that needs dual-worker architecture */
|
|
30
27
|
private _legacyWorker;
|
|
31
28
|
/** Tracks all workflows registered after construction (via registerWorkflow/registerWorkflows) */
|
|
@@ -34,27 +31,31 @@ export declare class Worker {
|
|
|
34
31
|
* Creates a new HatchetWorker instance
|
|
35
32
|
* @param nonDurable - The V0 worker implementation
|
|
36
33
|
*/
|
|
37
|
-
constructor(v1: HatchetClient,
|
|
34
|
+
constructor(v1: HatchetClient, nonDurable: InternalWorker, config: CreateWorkerOpts, name: string);
|
|
38
35
|
/**
|
|
39
36
|
* Creates and initializes a new HatchetWorker
|
|
40
37
|
* @param v0 - The HatchetClient instance
|
|
41
38
|
* @param options - Worker creation options
|
|
42
39
|
* @returns A new HatchetWorker instance
|
|
43
40
|
*/
|
|
44
|
-
static create(v1: HatchetClient,
|
|
41
|
+
static create(v1: HatchetClient, name: string, options: CreateWorkerOpts): Promise<Worker>;
|
|
45
42
|
/**
|
|
46
|
-
* Registers workflows with the worker
|
|
43
|
+
* Registers workflows with the worker.
|
|
44
|
+
* Accepts both v1 BaseWorkflowDeclaration and legacy Workflow objects.
|
|
45
|
+
* Legacy workflows are automatically transformed and a deprecation warning is emitted.
|
|
47
46
|
* @param workflows - Array of workflows to register
|
|
48
47
|
* @returns Array of registered workflow promises
|
|
49
48
|
*/
|
|
50
|
-
registerWorkflows(workflows?: Array<BaseWorkflowDeclaration<any, any> |
|
|
49
|
+
registerWorkflows(workflows?: Array<BaseWorkflowDeclaration<any, any> | LegacyWorkflow>): Promise<void>;
|
|
51
50
|
/**
|
|
52
|
-
* Registers a single workflow with the worker
|
|
51
|
+
* Registers a single workflow with the worker.
|
|
52
|
+
* Accepts both v1 BaseWorkflowDeclaration and legacy Workflow objects.
|
|
53
|
+
* Legacy workflows are automatically transformed and a deprecation warning is emitted.
|
|
53
54
|
* @param workflow - The workflow to register
|
|
54
55
|
* @returns A promise that resolves when the workflow is registered
|
|
55
56
|
* @deprecated use registerWorkflows instead
|
|
56
57
|
*/
|
|
57
|
-
registerWorkflow(workflow: BaseWorkflowDeclaration<any, any> |
|
|
58
|
+
registerWorkflow(workflow: BaseWorkflowDeclaration<any, any> | LegacyWorkflow): Promise<void>;
|
|
58
59
|
/**
|
|
59
60
|
* Starts the worker
|
|
60
61
|
* @returns Promise that resolves when the worker is stopped or killed
|
|
@@ -76,14 +77,13 @@ export declare class Worker {
|
|
|
76
77
|
* @returns The labels for the worker
|
|
77
78
|
*/
|
|
78
79
|
getLabels(): WorkerLabels;
|
|
79
|
-
/**
|
|
80
|
-
* Register a webhook with the worker
|
|
81
|
-
* @param webhook - The webhook to register
|
|
82
|
-
* @returns A promise that resolves when the webhook is registered
|
|
83
|
-
*/
|
|
84
|
-
registerWebhook(webhook: WebhookWorkerCreateRequest): Promise<import("axios").AxiosResponse<import("../../../clients/rest/generated/data-contracts").WebhookWorkerCreated, any, {}>>;
|
|
85
80
|
isPaused(): Promise<boolean>;
|
|
86
81
|
pause(): Promise<void> | Promise<import("../../../clients/rest/generated/data-contracts").Worker>;
|
|
87
82
|
unpause(): Promise<void> | Promise<import("../../../clients/rest/generated/data-contracts").Worker>;
|
|
83
|
+
/**
|
|
84
|
+
* Waits until the worker has connected and registered with the server.
|
|
85
|
+
* Polls every 200ms. Use after start() to avoid fixed sleeps before running workflows.
|
|
86
|
+
*/
|
|
87
|
+
waitUntilReady(timeoutMs?: number): Promise<void>;
|
|
88
88
|
}
|
|
89
89
|
export { testingExports as __testing } from './slot-utils';
|
|
@@ -8,9 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.__testing = exports.Worker = void 0;
|
|
13
|
-
const
|
|
16
|
+
const sleep_1 = __importDefault(require("../../../../util/sleep"));
|
|
17
|
+
const legacy_transformer_1 = require("../../../legacy/legacy-transformer");
|
|
14
18
|
const worker_internal_1 = require("./worker-internal");
|
|
15
19
|
const slot_utils_1 = require("./slot-utils");
|
|
16
20
|
const deprecated_1 = require("./deprecated");
|
|
@@ -22,11 +26,10 @@ class Worker {
|
|
|
22
26
|
* Creates a new HatchetWorker instance
|
|
23
27
|
* @param nonDurable - The V0 worker implementation
|
|
24
28
|
*/
|
|
25
|
-
constructor(v1,
|
|
29
|
+
constructor(v1, nonDurable, config, name) {
|
|
26
30
|
/** Tracks all workflows registered after construction (via registerWorkflow/registerWorkflows) */
|
|
27
31
|
this._registeredWorkflows = [];
|
|
28
32
|
this._v1 = v1;
|
|
29
|
-
this._v0 = v0;
|
|
30
33
|
this._internal = nonDurable;
|
|
31
34
|
this.config = config;
|
|
32
35
|
this.name = name;
|
|
@@ -37,41 +40,40 @@ class Worker {
|
|
|
37
40
|
* @param options - Worker creation options
|
|
38
41
|
* @returns A new HatchetWorker instance
|
|
39
42
|
*/
|
|
40
|
-
static create(v1,
|
|
43
|
+
static create(v1, name, options) {
|
|
41
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
|
|
45
|
+
// Normalize any legacy workflows before resolving worker options
|
|
46
|
+
const normalizedOptions = Object.assign(Object.assign({}, options), { workflows: options.workflows ? (0, legacy_transformer_1.normalizeWorkflows)(options.workflows) : undefined });
|
|
47
|
+
const resolvedOptions = (0, slot_utils_1.resolveWorkerOptions)(normalizedOptions);
|
|
43
48
|
const opts = Object.assign({ name }, resolvedOptions);
|
|
44
|
-
const internalWorker = new worker_internal_1.
|
|
45
|
-
const worker = new Worker(v1,
|
|
46
|
-
yield worker.registerWorkflows(
|
|
49
|
+
const internalWorker = new worker_internal_1.InternalWorker(v1, opts);
|
|
50
|
+
const worker = new Worker(v1, internalWorker, normalizedOptions, name);
|
|
51
|
+
yield worker.registerWorkflows(normalizedOptions.workflows);
|
|
47
52
|
return worker;
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
/**
|
|
51
|
-
* Registers workflows with the worker
|
|
56
|
+
* Registers workflows with the worker.
|
|
57
|
+
* Accepts both v1 BaseWorkflowDeclaration and legacy Workflow objects.
|
|
58
|
+
* Legacy workflows are automatically transformed and a deprecation warning is emitted.
|
|
52
59
|
* @param workflows - Array of workflows to register
|
|
53
60
|
* @returns Array of registered workflow promises
|
|
54
61
|
*/
|
|
55
62
|
registerWorkflows(workflows) {
|
|
56
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (wf.definition._durableTasks.length > 0) {
|
|
63
|
-
this._internal.registerDurableActionsV1(wf.definition);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// fallback to v0 client for backwards compatibility
|
|
68
|
-
yield this._internal.registerWorkflow(wf);
|
|
64
|
+
const normalized = workflows ? (0, legacy_transformer_1.normalizeWorkflows)(workflows) : [];
|
|
65
|
+
for (const wf of normalized) {
|
|
66
|
+
yield this._internal.registerWorkflow(wf);
|
|
67
|
+
if (wf.definition._durableTasks.length > 0) {
|
|
68
|
+
this._internal.registerDurableActions(wf.definition);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* Registers a single workflow with the worker
|
|
74
|
+
* Registers a single workflow with the worker.
|
|
75
|
+
* Accepts both v1 BaseWorkflowDeclaration and legacy Workflow objects.
|
|
76
|
+
* Legacy workflows are automatically transformed and a deprecation warning is emitted.
|
|
75
77
|
* @param workflow - The workflow to register
|
|
76
78
|
* @returns A promise that resolves when the workflow is registered
|
|
77
79
|
* @deprecated use registerWorkflows instead
|
|
@@ -123,14 +125,6 @@ class Worker {
|
|
|
123
125
|
getLabels() {
|
|
124
126
|
return this._internal.labels;
|
|
125
127
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Register a webhook with the worker
|
|
128
|
-
* @param webhook - The webhook to register
|
|
129
|
-
* @returns A promise that resolves when the webhook is registered
|
|
130
|
-
*/
|
|
131
|
-
registerWebhook(webhook) {
|
|
132
|
-
return this._internal.registerWebhook(webhook);
|
|
133
|
-
}
|
|
134
128
|
isPaused() {
|
|
135
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
130
|
var _a;
|
|
@@ -155,6 +149,27 @@ class Worker {
|
|
|
155
149
|
}
|
|
156
150
|
return this._v1.workers.unpause(this._internal.workerId);
|
|
157
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Waits until the worker has connected and registered with the server.
|
|
154
|
+
* Polls every 200ms. Use after start() to avoid fixed sleeps before running workflows.
|
|
155
|
+
*/
|
|
156
|
+
waitUntilReady() {
|
|
157
|
+
return __awaiter(this, arguments, void 0, function* (timeoutMs = 10000) {
|
|
158
|
+
var _a;
|
|
159
|
+
if (this._legacyWorker) {
|
|
160
|
+
yield (0, sleep_1.default)(2000);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const pollInterval = 200;
|
|
164
|
+
const start = Date.now();
|
|
165
|
+
while (Date.now() - start < timeoutMs) {
|
|
166
|
+
if ((_a = this._internal) === null || _a === void 0 ? void 0 : _a.workerId)
|
|
167
|
+
return;
|
|
168
|
+
yield (0, sleep_1.default)(pollInterval);
|
|
169
|
+
}
|
|
170
|
+
throw new Error(`Worker ${this.name} did not become ready within ${timeoutMs}ms`);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
158
173
|
}
|
|
159
174
|
exports.Worker = Worker;
|
|
160
175
|
var slot_utils_2 = require("./slot-utils");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaskConditions } from '
|
|
1
|
+
import { TaskConditions } from '../../../protoc/v1/shared/condition';
|
|
2
2
|
import { CreateWorkflowTaskOpts } from '../task';
|
|
3
3
|
import { Condition } from './base';
|
|
4
4
|
export declare function taskConditionsToPb(task: Omit<CreateWorkflowTaskOpts<any, any>, 'fn'>): TaskConditions;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `Runnables` in the Hatchet TypeScript SDK are things that can be run, namely tasks and workflows. The two main types of runnables you'll encounter are:
|
|
3
|
+
*
|
|
4
|
+
* - `WorkflowDeclaration`, returned by `hatchet.workflow(...)`, which lets you define tasks and call `run()`, `schedule()`, `cron()`, etc.
|
|
5
|
+
* - `TaskWorkflowDeclaration`, returned by `hatchet.task(...)`, which is a single standalone task that exposes the same execution helpers as a workflow.
|
|
6
|
+
* @module Runnables
|
|
7
|
+
*/
|
|
8
|
+
import WorkflowRunRef from '../../util/workflow-run-ref';
|
|
9
|
+
import { CronWorkflows, ScheduledWorkflows, V1CreateFilterRequest } from '../../clients/rest/generated/data-contracts';
|
|
4
10
|
import { z } from 'zod';
|
|
11
|
+
import { WorkerLabelComparator } from '../../protoc/v1/workflows';
|
|
5
12
|
import { IHatchetClient } from './client/client.interface';
|
|
6
13
|
import { CreateWorkflowTaskOpts, CreateOnFailureTaskOpts, TaskFn, CreateWorkflowDurableTaskOpts, CreateBaseTaskOpts, CreateOnSuccessTaskOpts, Concurrency, DurableTaskFn } from './task';
|
|
7
14
|
import { Duration } from './client/duration';
|
|
@@ -19,6 +26,7 @@ export declare enum Priority {
|
|
|
19
26
|
type AdditionalMetadata = Record<string, string>;
|
|
20
27
|
/**
|
|
21
28
|
* Options for running a workflow.
|
|
29
|
+
* @hidden
|
|
22
30
|
*/
|
|
23
31
|
export type RunOpts = {
|
|
24
32
|
/**
|
|
@@ -41,38 +49,72 @@ export type RunOpts = {
|
|
|
41
49
|
* only used if spawned from within a parent task.
|
|
42
50
|
*/
|
|
43
51
|
childKey?: string;
|
|
52
|
+
/**
|
|
53
|
+
* (optional) when running multiple workflows (array input), if true, return
|
|
54
|
+
* exceptions in the result array instead of throwing. Successes are outputs,
|
|
55
|
+
* failures are Error instances.
|
|
56
|
+
*/
|
|
57
|
+
returnExceptions?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* (optional) desired worker labels for routing the workflow run to specific workers.
|
|
60
|
+
*/
|
|
61
|
+
desiredWorkerLabels?: Record<string, {
|
|
62
|
+
value: string | number;
|
|
63
|
+
required?: boolean;
|
|
64
|
+
weight?: number;
|
|
65
|
+
comparator?: WorkerLabelComparator;
|
|
66
|
+
}>;
|
|
44
67
|
};
|
|
45
68
|
/**
|
|
46
69
|
* Helper type to safely extract output types from task results
|
|
70
|
+
* @hidden
|
|
47
71
|
*/
|
|
48
72
|
export type TaskOutput<O, Key extends string, Fallback> = O extends Record<Key, infer Value> ? (Value extends OutputType ? Value : Fallback) : Fallback;
|
|
49
73
|
/**
|
|
50
74
|
* Extracts a property from an object type based on task name, or falls back to inferred type
|
|
75
|
+
* @hidden
|
|
51
76
|
*/
|
|
52
77
|
export type TaskOutputType<O, TaskName extends string, InferredType extends OutputType> = TaskName extends keyof O ? O[TaskName] extends OutputType ? O[TaskName] : InferredType : InferredType;
|
|
53
78
|
type DefaultFilter = Omit<V1CreateFilterRequest, 'workflowId'>;
|
|
79
|
+
/**
|
|
80
|
+
* Sticky strategy for workflow scheduling.
|
|
81
|
+
*
|
|
82
|
+
* Prefer using `StickyStrategy.SOFT` / `StickyStrategy.HARD` (v1, non-protobuf).
|
|
83
|
+
* For backwards compatibility, the workflow/task `sticky` field also accepts legacy
|
|
84
|
+
* protobuf enum values (`0`/`1`) and strings (`'SOFT'`/`'HARD'`).
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export declare const StickyStrategy: {
|
|
88
|
+
readonly SOFT: "soft";
|
|
89
|
+
readonly HARD: "hard";
|
|
90
|
+
};
|
|
91
|
+
export type StickyStrategy = (typeof StickyStrategy)[keyof typeof StickyStrategy];
|
|
92
|
+
export type StickyStrategyInput = StickyStrategy | 'SOFT' | 'HARD' | 0 | 1;
|
|
54
93
|
export type CreateBaseWorkflowOpts = {
|
|
55
94
|
/**
|
|
56
95
|
* The name of the workflow.
|
|
57
96
|
*/
|
|
58
|
-
name:
|
|
97
|
+
name: string;
|
|
59
98
|
/**
|
|
60
99
|
* (optional) description of the workflow.
|
|
61
100
|
*/
|
|
62
|
-
description?:
|
|
101
|
+
description?: string;
|
|
63
102
|
/**
|
|
64
103
|
* (optional) version of the workflow.
|
|
65
104
|
*/
|
|
66
|
-
version?:
|
|
105
|
+
version?: string;
|
|
67
106
|
/**
|
|
68
107
|
* (optional) sticky strategy for the workflow.
|
|
69
108
|
*/
|
|
70
|
-
sticky?:
|
|
109
|
+
sticky?: StickyStrategyInput;
|
|
71
110
|
/**
|
|
72
111
|
* (optional) on config for the workflow.
|
|
73
|
-
* @
|
|
112
|
+
* @alias for onCrons and onEvents
|
|
74
113
|
*/
|
|
75
|
-
on?:
|
|
114
|
+
on?: {
|
|
115
|
+
cron?: string | string[];
|
|
116
|
+
event?: string | string[];
|
|
117
|
+
};
|
|
76
118
|
/**
|
|
77
119
|
* (optional) cron config for the workflow.
|
|
78
120
|
*/
|
|
@@ -102,6 +144,7 @@ export type CreateTaskWorkflowOpts<I extends InputType = UnknownInputType, O ext
|
|
|
102
144
|
export type CreateDurableTaskWorkflowOpts<I extends InputType = UnknownInputType, O extends OutputType = void> = CreateBaseWorkflowOpts & CreateBaseTaskOpts<I, O, DurableTaskFn<I, O>>;
|
|
103
145
|
/**
|
|
104
146
|
* Options for creating a new workflow.
|
|
147
|
+
* @hidden
|
|
105
148
|
*/
|
|
106
149
|
export type CreateWorkflowOpts = CreateBaseWorkflowOpts & {
|
|
107
150
|
/**
|
|
@@ -112,6 +155,7 @@ export type CreateWorkflowOpts = CreateBaseWorkflowOpts & {
|
|
|
112
155
|
/**
|
|
113
156
|
* Default configuration for all tasks in the workflow.
|
|
114
157
|
* Can be overridden by task-specific options.
|
|
158
|
+
* @hidden
|
|
115
159
|
*/
|
|
116
160
|
export type TaskDefaults = {
|
|
117
161
|
/**
|
|
@@ -160,6 +204,7 @@ export type TaskDefaults = {
|
|
|
160
204
|
};
|
|
161
205
|
/**
|
|
162
206
|
* Internal definition of a workflow and its tasks.
|
|
207
|
+
* @hidden
|
|
163
208
|
*/
|
|
164
209
|
export type WorkflowDefinition = CreateWorkflowOpts & {
|
|
165
210
|
/**
|
|
@@ -187,24 +232,28 @@ export type WorkflowDefinition = CreateWorkflowOpts & {
|
|
|
187
232
|
* Represents a workflow that can be executed by Hatchet.
|
|
188
233
|
* @template I The input type for the workflow.
|
|
189
234
|
* @template O The return type of the workflow.
|
|
235
|
+
* @internal
|
|
190
236
|
*/
|
|
191
237
|
export declare class BaseWorkflowDeclaration<I extends InputType = UnknownInputType, O extends OutputType = void> {
|
|
192
238
|
/**
|
|
193
239
|
* The Hatchet client instance used to execute the workflow.
|
|
240
|
+
* @internal
|
|
194
241
|
*/
|
|
195
242
|
client: IHatchetClient | undefined;
|
|
196
243
|
/**
|
|
197
244
|
* The internal workflow definition.
|
|
245
|
+
* @internal
|
|
198
246
|
*/
|
|
199
247
|
definition: WorkflowDefinition;
|
|
200
248
|
/**
|
|
201
249
|
* Creates a new workflow instance.
|
|
202
250
|
* @param options The options for creating the workflow.
|
|
203
251
|
* @param client Optional Hatchet client instance.
|
|
252
|
+
* @internal
|
|
204
253
|
*/
|
|
205
254
|
constructor(options: CreateWorkflowOpts, client?: IHatchetClient);
|
|
206
255
|
/**
|
|
207
|
-
*
|
|
256
|
+
* Synchronously trigger a workflow run without waiting for it to complete. This method is useful for starting a workflow run and immediately returning a reference to the run without blocking while the workflow runs.
|
|
208
257
|
* @param input The input data for the workflow.
|
|
209
258
|
* @param options Optional configuration for this workflow run.
|
|
210
259
|
* @returns A WorkflowRunRef containing the run ID and methods to get results and interact with the run.
|
|
@@ -279,9 +328,10 @@ export declare class BaseWorkflowDeclaration<I extends InputType = UnknownInputT
|
|
|
279
328
|
* @returns A promise that resolves with the workflow state.
|
|
280
329
|
* @throws Error if the workflow is not bound to a Hatchet client.
|
|
281
330
|
*/
|
|
282
|
-
get(): Promise<import("
|
|
331
|
+
get(): Promise<import("../../clients/rest/generated/data-contracts").Workflow>;
|
|
283
332
|
/**
|
|
284
333
|
* @deprecated use definition.name instead
|
|
334
|
+
* @hidden
|
|
285
335
|
*/
|
|
286
336
|
get id(): string;
|
|
287
337
|
/**
|
|
@@ -290,6 +340,44 @@ export declare class BaseWorkflowDeclaration<I extends InputType = UnknownInputT
|
|
|
290
340
|
*/
|
|
291
341
|
get name(): string;
|
|
292
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* A Hatchet workflow, which lets you define tasks and perform actions on the workflow.
|
|
345
|
+
*
|
|
346
|
+
* Workflows in Hatchet represent coordinated units of work that can be triggered,
|
|
347
|
+
* scheduled, or run on a cron schedule. Each workflow can contain multiple tasks
|
|
348
|
+
* that can be arranged in dependencies (DAGs), with customized retry behavior,
|
|
349
|
+
* timeouts, concurrency controls, and more.
|
|
350
|
+
*
|
|
351
|
+
* Example:
|
|
352
|
+
* ```typescript
|
|
353
|
+
* import { hatchet } from './hatchet-client';
|
|
354
|
+
*
|
|
355
|
+
* type MyInput = { name: string };
|
|
356
|
+
*
|
|
357
|
+
* const workflow = hatchet.workflow<MyInput>({
|
|
358
|
+
* name: 'my-workflow',
|
|
359
|
+
* });
|
|
360
|
+
*
|
|
361
|
+
* workflow.task({
|
|
362
|
+
* name: 'greet',
|
|
363
|
+
* fn: async (input) => {
|
|
364
|
+
* return { message: `Hello, ${input.name}!` };
|
|
365
|
+
* },
|
|
366
|
+
* });
|
|
367
|
+
*
|
|
368
|
+
* // Run the workflow
|
|
369
|
+
* await workflow.run({ name: 'World' });
|
|
370
|
+
* ```
|
|
371
|
+
*
|
|
372
|
+
* Workflows support various execution patterns, including:
|
|
373
|
+
* - One-time execution with `run()` and `runNoWait()`
|
|
374
|
+
* - Scheduled execution with `schedule()`
|
|
375
|
+
* - Cron-based recurring execution with `cron()`
|
|
376
|
+
* - Bulk execution by passing an array input to `run()` and `runNoWait()`
|
|
377
|
+
*
|
|
378
|
+
* Tasks within workflows can be defined with `workflow.task()` or
|
|
379
|
+
* `workflow.durableTask()` and arranged into complex dependency patterns.
|
|
380
|
+
*/
|
|
293
381
|
export declare class WorkflowDeclaration<I extends InputType = UnknownInputType, O extends OutputType = void, MiddlewareBefore extends Record<string, any> = {}> extends BaseWorkflowDeclaration<I, O> {
|
|
294
382
|
/**
|
|
295
383
|
* Adds a task to the workflow.
|
|
@@ -341,10 +429,26 @@ export declare class WorkflowDeclaration<I extends InputType = UnknownInputType,
|
|
|
341
429
|
}): CreateWorkflowDurableTaskOpts<I, TO>;
|
|
342
430
|
}
|
|
343
431
|
/**
|
|
344
|
-
* A standalone task
|
|
432
|
+
* A standalone task declaration that can be run like a workflow.
|
|
433
|
+
*
|
|
434
|
+
* `TaskWorkflowDeclaration` is returned by `hatchet.task(...)` and wraps a single
|
|
435
|
+
* task definition while exposing the same execution helpers as workflows, such as
|
|
436
|
+
* `run()`, `runNoWait()`, `schedule()`, and `cron()` (inherited from
|
|
437
|
+
* `BaseWorkflowDeclaration`).
|
|
438
|
+
*
|
|
439
|
+
* Example:
|
|
440
|
+
* ```typescript
|
|
441
|
+
* const greet = hatchet.task<{ name: string }, { message: string }>({
|
|
442
|
+
* name: 'greet',
|
|
443
|
+
* fn: async (input) => ({ message: `Hello, ${input.name}!` }),
|
|
444
|
+
* });
|
|
445
|
+
*
|
|
446
|
+
* await greet.run({ name: 'World' });
|
|
447
|
+
* const ref = await greet.runNoWait({ name: 'World' });
|
|
448
|
+
* ```
|
|
345
449
|
*
|
|
346
|
-
* @template I
|
|
347
|
-
* @template O
|
|
450
|
+
* @template I The input type for the standalone task.
|
|
451
|
+
* @template O The output type returned by the standalone task.
|
|
348
452
|
* @template GlobalInput - Global input type from the client, merged into all run/schedule/cron input signatures.
|
|
349
453
|
* @template MiddlewareBefore - Extra fields added to the task fn input by pre-middleware hooks.
|
|
350
454
|
* @template MiddlewareAfter - Extra fields merged into the task output by post-middleware hooks.
|
|
@@ -359,6 +463,7 @@ export declare class TaskWorkflowDeclaration<I extends InputType = UnknownInputT
|
|
|
359
463
|
* @returns A promise that resolves with the task output merged with post-middleware fields.
|
|
360
464
|
*/
|
|
361
465
|
runAndWait(input: I & GlobalInput, options?: RunOpts): Promise<O & Resolved<GlobalOutput, MiddlewareAfter>>;
|
|
466
|
+
/** @hidden */
|
|
362
467
|
runAndWait(input: (I & GlobalInput)[], options?: RunOpts): Promise<(O & Resolved<GlobalOutput, MiddlewareAfter>)[]>;
|
|
363
468
|
/**
|
|
364
469
|
* Triggers a task run and waits for the result.
|
|
@@ -367,6 +472,7 @@ export declare class TaskWorkflowDeclaration<I extends InputType = UnknownInputT
|
|
|
367
472
|
* @returns A promise that resolves with the task output merged with post-middleware fields.
|
|
368
473
|
*/
|
|
369
474
|
run(input: I & GlobalInput, options?: RunOpts): Promise<O & Resolved<GlobalOutput, MiddlewareAfter>>;
|
|
475
|
+
/** @hidden */
|
|
370
476
|
run(input: (I & GlobalInput)[], options?: RunOpts): Promise<(O & Resolved<GlobalOutput, MiddlewareAfter>)[]>;
|
|
371
477
|
/**
|
|
372
478
|
* Triggers a task run without waiting for completion.
|
|
@@ -401,7 +507,6 @@ export declare class TaskWorkflowDeclaration<I extends InputType = UnknownInputT
|
|
|
401
507
|
* @returns A promise that resolves with the cron workflow details.
|
|
402
508
|
*/
|
|
403
509
|
cron(name: string, expression: string, input: I & GlobalInput, options?: RunOpts): Promise<CronWorkflows>;
|
|
404
|
-
/** Returns the underlying task definition for this declaration. */
|
|
405
510
|
get taskDef(): CreateWorkflowTaskOpts<any, any>;
|
|
406
511
|
}
|
|
407
512
|
/**
|