@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
|
@@ -12,17 +12,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.DurableContext = exports.Context = void 0;
|
|
15
|
+
exports.DurableContext = exports.Context = exports.ContextWorker = void 0;
|
|
16
|
+
/**
|
|
17
|
+
* The Hatchet Context class provides helper methods and useful data to tasks at runtime. It is passed as the second argument to all tasks and durable tasks.
|
|
18
|
+
*
|
|
19
|
+
* There are two types of context classes you'll encounter:
|
|
20
|
+
*
|
|
21
|
+
* - Context - The standard context for regular tasks with methods for logging, task output retrieval, cancellation, and more.
|
|
22
|
+
* - DurableContext - An extended context for durable tasks that includes additional methods for durable execution.
|
|
23
|
+
* @module Context
|
|
24
|
+
*/
|
|
16
25
|
/* eslint-disable no-underscore-dangle */
|
|
17
26
|
/* eslint-disable max-classes-per-file */
|
|
18
|
-
const declaration_1 = require("
|
|
19
|
-
const hatchet_error_1 = __importDefault(require("
|
|
20
|
-
const parse_1 = require("
|
|
21
|
-
const conditions_1 = require("
|
|
22
|
-
const transformer_1 = require("
|
|
23
|
-
const condition_1 = require("
|
|
24
|
-
const
|
|
25
|
-
const
|
|
27
|
+
const declaration_1 = require("../../../../v1/declaration");
|
|
28
|
+
const hatchet_error_1 = __importDefault(require("../../../../util/errors/hatchet-error"));
|
|
29
|
+
const parse_1 = require("../../../../util/parse");
|
|
30
|
+
const conditions_1 = require("../../../../v1/conditions");
|
|
31
|
+
const transformer_1 = require("../../../../v1/conditions/transformer");
|
|
32
|
+
const condition_1 = require("../../../../protoc/v1/shared/condition");
|
|
33
|
+
const apply_namespace_1 = require("../../../../util/apply-namespace");
|
|
34
|
+
const abort_error_1 = require("../../../../util/abort-error");
|
|
35
|
+
/**
|
|
36
|
+
* ContextWorker is a wrapper around the V1Worker class that provides a more user-friendly interface for the worker from the context of a run.
|
|
37
|
+
*/
|
|
38
|
+
class ContextWorker {
|
|
39
|
+
constructor(worker) {
|
|
40
|
+
this.worker = worker;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the ID of the worker.
|
|
44
|
+
* @returns The ID of the worker.
|
|
45
|
+
*/
|
|
46
|
+
id() {
|
|
47
|
+
return this.worker.workerId;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the worker has a registered workflow.
|
|
51
|
+
* @param workflowName - The name of the workflow to check.
|
|
52
|
+
* @returns True if the workflow is registered, otherwise false.
|
|
53
|
+
*/
|
|
54
|
+
hasWorkflow(workflowName) {
|
|
55
|
+
return !!this.worker.workflow_registry.find((workflow) => 'id' in workflow ? workflow.id === workflowName : workflow.name === workflowName);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the current state of the worker labels.
|
|
59
|
+
* @returns The labels of the worker.
|
|
60
|
+
*/
|
|
61
|
+
labels() {
|
|
62
|
+
return this.worker.labels;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Upserts the a set of labels on the worker.
|
|
66
|
+
* @param labels - The labels to upsert.
|
|
67
|
+
* @returns A promise that resolves when the labels have been upserted.
|
|
68
|
+
*/
|
|
69
|
+
upsertLabels(labels) {
|
|
70
|
+
return this.worker.upsertLabels(labels);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.ContextWorker = ContextWorker;
|
|
26
74
|
class Context {
|
|
27
75
|
constructor(action, v1, worker) {
|
|
28
76
|
// @deprecated use ctx.abortController instead
|
|
@@ -35,7 +83,7 @@ class Context {
|
|
|
35
83
|
this.data = data;
|
|
36
84
|
this.action = action;
|
|
37
85
|
this.v1 = v1;
|
|
38
|
-
this.worker = new
|
|
86
|
+
this.worker = new ContextWorker(worker);
|
|
39
87
|
this._logger = v1.config.logger(`Context Logger`, v1.config.log_level);
|
|
40
88
|
// if this is a getGroupKeyRunId, the data is the workflow input
|
|
41
89
|
if (action.getGroupKeyRunId !== '') {
|
|
@@ -56,6 +104,22 @@ class Context {
|
|
|
56
104
|
get cancelled() {
|
|
57
105
|
return this.controller.signal.aborted;
|
|
58
106
|
}
|
|
107
|
+
throwIfCancelled() {
|
|
108
|
+
if (this.abortController.signal.aborted) {
|
|
109
|
+
throw (0, abort_error_1.createAbortError)('Operation cancelled by AbortSignal');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Helper for broad `catch` blocks so cancellation isn't accidentally swallowed.
|
|
114
|
+
*
|
|
115
|
+
* Example:
|
|
116
|
+
* ```ts
|
|
117
|
+
* try { ... } catch (e) { ctx.rethrowIfCancelled(e); ... }
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
rethrowIfCancelled(err) {
|
|
121
|
+
(0, abort_error_1.rethrowIfAborted)(err);
|
|
122
|
+
}
|
|
59
123
|
cancel() {
|
|
60
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
125
|
yield this.v1.runs.cancel({
|
|
@@ -91,6 +155,7 @@ class Context {
|
|
|
91
155
|
* @returns A record mapping task names to error messages.
|
|
92
156
|
* @throws A warning if no errors are found (this method should be used in on-failure tasks).
|
|
93
157
|
* @deprecated use ctx.errors() instead
|
|
158
|
+
* @hidden
|
|
94
159
|
*/
|
|
95
160
|
stepRunErrors() {
|
|
96
161
|
return this.errors();
|
|
@@ -184,6 +249,7 @@ class Context {
|
|
|
184
249
|
* Gets the ID of the current task run.
|
|
185
250
|
* @returns The task run ID.
|
|
186
251
|
* @deprecated use taskRunExternalId() instead
|
|
252
|
+
* @hidden
|
|
187
253
|
*/
|
|
188
254
|
taskRunId() {
|
|
189
255
|
return this.taskRunExternalId();
|
|
@@ -200,6 +266,7 @@ class Context {
|
|
|
200
266
|
* @param message - The message to log.
|
|
201
267
|
* @param level - The log level (optional).
|
|
202
268
|
* @deprecated use ctx.logger.infoger.info, ctx.logger.infoger.debug, ctx.logger.infoger.warn, ctx.logger.infoger.error, ctx.logger.infoger.trace instead
|
|
269
|
+
* @hidden
|
|
203
270
|
*/
|
|
204
271
|
log(message, level, extra) {
|
|
205
272
|
const { taskRunExternalId } = this.action;
|
|
@@ -263,7 +330,7 @@ class Context {
|
|
|
263
330
|
this._logger.warn('cannot refresh timeout from context without stepRunId');
|
|
264
331
|
return;
|
|
265
332
|
}
|
|
266
|
-
yield this.v1.
|
|
333
|
+
yield this.v1.dispatcher.refreshTimeout(incrementBy, taskRunExternalId);
|
|
267
334
|
});
|
|
268
335
|
}
|
|
269
336
|
/**
|
|
@@ -273,7 +340,7 @@ class Context {
|
|
|
273
340
|
*/
|
|
274
341
|
releaseSlot() {
|
|
275
342
|
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
yield this.v1.
|
|
343
|
+
yield this.v1.dispatcher.client.releaseSlot({
|
|
277
344
|
taskRunExternalId: this.action.taskRunExternalId,
|
|
278
345
|
});
|
|
279
346
|
});
|
|
@@ -292,16 +359,17 @@ class Context {
|
|
|
292
359
|
return;
|
|
293
360
|
}
|
|
294
361
|
const index = this._incrementStreamIndex();
|
|
295
|
-
yield this.v1.
|
|
362
|
+
yield this.v1.events.putStream(taskRunExternalId, data, index);
|
|
296
363
|
});
|
|
297
364
|
}
|
|
298
365
|
spawnOptions(workflow, options) {
|
|
366
|
+
this.throwIfCancelled();
|
|
299
367
|
let workflowName;
|
|
300
368
|
if (typeof workflow === 'string') {
|
|
301
369
|
workflowName = workflow;
|
|
302
370
|
}
|
|
303
371
|
else {
|
|
304
|
-
workflowName = workflow.
|
|
372
|
+
workflowName = workflow.name;
|
|
305
373
|
}
|
|
306
374
|
const opts = options || {};
|
|
307
375
|
const { sticky } = opts;
|
|
@@ -309,7 +377,7 @@ class Context {
|
|
|
309
377
|
throw new hatchet_error_1.default(`Cannot run with sticky: workflow ${workflowName} is not registered on the worker`);
|
|
310
378
|
}
|
|
311
379
|
const { workflowRunId, taskRunExternalId } = this.action;
|
|
312
|
-
const finalOpts = Object.assign(Object.assign({},
|
|
380
|
+
const finalOpts = Object.assign(Object.assign({}, opts), { parentId: workflowRunId, parentTaskRunExternalId: taskRunExternalId, childIndex: this.spawnIndex, childKey: options === null || options === void 0 ? void 0 : options.key, desiredWorkerId: sticky ? this.worker.id() : undefined, _standaloneTaskName: workflow instanceof declaration_1.TaskWorkflowDeclaration ? workflow._standalone_task_name : undefined });
|
|
313
381
|
this.spawnIndex += 1;
|
|
314
382
|
return { workflowName, opts: finalOpts };
|
|
315
383
|
}
|
|
@@ -318,6 +386,7 @@ class Context {
|
|
|
318
386
|
return this.v1.admin.runWorkflow(workflowName, input, opts);
|
|
319
387
|
}
|
|
320
388
|
spawnBulk(children) {
|
|
389
|
+
this.throwIfCancelled();
|
|
321
390
|
const workflows = children.map((child) => {
|
|
322
391
|
const { workflowName, opts } = this.spawnOptions(child.workflow, child.options);
|
|
323
392
|
return { workflowName, input: child.input, options: opts };
|
|
@@ -331,7 +400,12 @@ class Context {
|
|
|
331
400
|
*/
|
|
332
401
|
bulkRunNoWaitChildren(children) {
|
|
333
402
|
return __awaiter(this, void 0, void 0, function* () {
|
|
334
|
-
|
|
403
|
+
const refs = yield this.spawnBulk(children);
|
|
404
|
+
refs.forEach((ref) => {
|
|
405
|
+
// eslint-disable-next-line no-param-reassign
|
|
406
|
+
ref.defaultSignal = this.abortController.signal;
|
|
407
|
+
});
|
|
408
|
+
return refs;
|
|
335
409
|
});
|
|
336
410
|
}
|
|
337
411
|
/**
|
|
@@ -356,6 +430,9 @@ class Context {
|
|
|
356
430
|
runChild(workflow, input, options) {
|
|
357
431
|
return __awaiter(this, void 0, void 0, function* () {
|
|
358
432
|
const run = yield this.spawn(workflow, input, options);
|
|
433
|
+
// Ensure waiting for the child result aborts when this task is cancelled.
|
|
434
|
+
// eslint-disable-next-line no-param-reassign
|
|
435
|
+
run.defaultSignal = this.abortController.signal;
|
|
359
436
|
return run.output;
|
|
360
437
|
});
|
|
361
438
|
}
|
|
@@ -370,6 +447,7 @@ class Context {
|
|
|
370
447
|
runNoWaitChild(workflow, input, options) {
|
|
371
448
|
return __awaiter(this, void 0, void 0, function* () {
|
|
372
449
|
const ref = yield this.spawn(workflow, input, options);
|
|
450
|
+
ref.defaultSignal = this.abortController.signal;
|
|
373
451
|
return ref;
|
|
374
452
|
});
|
|
375
453
|
}
|
|
@@ -425,6 +503,7 @@ class Context {
|
|
|
425
503
|
* @returns The output of the task.
|
|
426
504
|
* @throws An error if the task output is not found.
|
|
427
505
|
* @deprecated use ctx.parentOutput instead
|
|
506
|
+
* @hidden
|
|
428
507
|
*/
|
|
429
508
|
stepOutput(step) {
|
|
430
509
|
if (!this.data.parents) {
|
|
@@ -439,6 +518,7 @@ class Context {
|
|
|
439
518
|
* Gets the input data for the current workflow.
|
|
440
519
|
* @returns The input data for the workflow.
|
|
441
520
|
* @deprecated use task input parameter instead
|
|
521
|
+
* @hidden
|
|
442
522
|
*/
|
|
443
523
|
workflowInput() {
|
|
444
524
|
return this.input;
|
|
@@ -447,6 +527,7 @@ class Context {
|
|
|
447
527
|
* Gets the name of the current task.
|
|
448
528
|
* @returns The name of the task.
|
|
449
529
|
* @deprecated use ctx.taskName instead
|
|
530
|
+
* @hidden
|
|
450
531
|
*/
|
|
451
532
|
stepName() {
|
|
452
533
|
return this.taskName();
|
|
@@ -457,9 +538,11 @@ class Context {
|
|
|
457
538
|
* @param workflows - An array of objects containing the workflow name, input data, and options for each workflow.
|
|
458
539
|
* @returns A list of references to the spawned workflow runs.
|
|
459
540
|
* @deprecated Use bulkRunNoWaitChildren or bulkRunChildren instead.
|
|
541
|
+
* @hidden
|
|
460
542
|
*/
|
|
461
543
|
spawnWorkflows(workflows) {
|
|
462
544
|
return __awaiter(this, void 0, void 0, function* () {
|
|
545
|
+
this.throwIfCancelled();
|
|
463
546
|
const { workflowRunId, taskRunExternalId } = this.action;
|
|
464
547
|
const workflowRuns = workflows.map(({ workflow, input, options }) => {
|
|
465
548
|
let workflowName;
|
|
@@ -467,18 +550,22 @@ class Context {
|
|
|
467
550
|
workflowName = workflow;
|
|
468
551
|
}
|
|
469
552
|
else {
|
|
470
|
-
workflowName = workflow.
|
|
553
|
+
workflowName = workflow.name;
|
|
471
554
|
}
|
|
472
|
-
const name = (0, apply_namespace_1.applyNamespace)(workflowName, this.v1.config.namespace);
|
|
555
|
+
const name = (0, apply_namespace_1.applyNamespace)(workflowName, this.v1.config.namespace).toLowerCase();
|
|
473
556
|
const opts = options || {};
|
|
474
557
|
const { sticky } = opts;
|
|
475
558
|
if (sticky && !this.worker.hasWorkflow(name)) {
|
|
476
559
|
throw new hatchet_error_1.default(`Cannot run with sticky: workflow ${name} is not registered on the worker`);
|
|
477
560
|
}
|
|
561
|
+
// `signal` must never be sent over the wire.
|
|
562
|
+
const optsWithoutSignal = Object.assign({}, opts);
|
|
563
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
564
|
+
delete optsWithoutSignal.signal;
|
|
478
565
|
const resp = {
|
|
479
566
|
workflowName: name,
|
|
480
567
|
input,
|
|
481
|
-
options: Object.assign(Object.assign({},
|
|
568
|
+
options: Object.assign(Object.assign({}, optsWithoutSignal), { parentId: workflowRunId, parentTaskRunExternalId: taskRunExternalId, childIndex: this.spawnIndex, desiredWorkerId: sticky ? this.worker.id() : undefined }),
|
|
482
569
|
};
|
|
483
570
|
this.spawnIndex += 1;
|
|
484
571
|
return resp;
|
|
@@ -488,7 +575,7 @@ class Context {
|
|
|
488
575
|
let resp = [];
|
|
489
576
|
for (let i = 0; i < workflowRuns.length; i += batchSize) {
|
|
490
577
|
const batch = workflowRuns.slice(i, i + batchSize);
|
|
491
|
-
const batchResp = yield this.v1.
|
|
578
|
+
const batchResp = yield this.v1.admin.runWorkflows(batch);
|
|
492
579
|
resp = resp.concat(batchResp);
|
|
493
580
|
}
|
|
494
581
|
const res = [];
|
|
@@ -515,25 +602,27 @@ class Context {
|
|
|
515
602
|
* @param options - Additional options for spawning the workflow.
|
|
516
603
|
* @returns A reference to the spawned workflow run.
|
|
517
604
|
* @deprecated Use runChild or runNoWaitChild instead.
|
|
605
|
+
* @hidden
|
|
518
606
|
*/
|
|
519
607
|
spawnWorkflow(workflow, input, options) {
|
|
520
608
|
return __awaiter(this, void 0, void 0, function* () {
|
|
609
|
+
this.throwIfCancelled();
|
|
521
610
|
const { workflowRunId, taskRunExternalId } = this.action;
|
|
522
611
|
let workflowName = '';
|
|
523
612
|
if (typeof workflow === 'string') {
|
|
524
613
|
workflowName = workflow;
|
|
525
614
|
}
|
|
526
615
|
else {
|
|
527
|
-
workflowName = workflow.
|
|
616
|
+
workflowName = workflow.name;
|
|
528
617
|
}
|
|
529
|
-
const name = (0, apply_namespace_1.applyNamespace)(workflowName, this.v1.config.namespace);
|
|
618
|
+
const name = (0, apply_namespace_1.applyNamespace)(workflowName, this.v1.config.namespace).toLowerCase();
|
|
530
619
|
const opts = options || {};
|
|
531
620
|
const { sticky } = opts;
|
|
532
621
|
if (sticky && !this.worker.hasWorkflow(name)) {
|
|
533
622
|
throw new hatchet_error_1.default(`cannot run with sticky: workflow ${name} is not registered on the worker`);
|
|
534
623
|
}
|
|
535
624
|
try {
|
|
536
|
-
const resp = yield this.v1.
|
|
625
|
+
const resp = yield this.v1.admin.runWorkflow(name, input, Object.assign({ parentId: workflowRunId, parentTaskRunExternalId: taskRunExternalId, childIndex: this.spawnIndex, desiredWorkerId: sticky ? this.worker.id() : undefined }, opts));
|
|
537
626
|
this.spawnIndex += 1;
|
|
538
627
|
if (workflow instanceof declaration_1.TaskWorkflowDeclaration) {
|
|
539
628
|
resp._standaloneTaskName = workflow._standalone_task_name;
|
|
@@ -552,6 +641,10 @@ class Context {
|
|
|
552
641
|
}
|
|
553
642
|
}
|
|
554
643
|
exports.Context = Context;
|
|
644
|
+
/**
|
|
645
|
+
* DurableContext provides helper methods and useful data to durable tasks at runtime.
|
|
646
|
+
* It extends the Context class and includes additional methods for durable execution like sleepFor and waitFor.
|
|
647
|
+
*/
|
|
555
648
|
class DurableContext extends Context {
|
|
556
649
|
constructor() {
|
|
557
650
|
super(...arguments);
|
|
@@ -576,20 +669,20 @@ class DurableContext extends Context {
|
|
|
576
669
|
*/
|
|
577
670
|
waitFor(conditions) {
|
|
578
671
|
return __awaiter(this, void 0, void 0, function* () {
|
|
672
|
+
this.throwIfCancelled();
|
|
579
673
|
const pbConditions = (0, transformer_1.conditionsToPb)((0, conditions_1.Render)(condition_1.Action.CREATE, conditions));
|
|
580
674
|
// eslint-disable-next-line no-plusplus
|
|
581
675
|
const key = `waitFor-${this.waitKey++}`;
|
|
582
|
-
yield this.v1.
|
|
676
|
+
yield this.v1.durableListener.registerDurableEvent({
|
|
583
677
|
taskId: this.action.taskRunExternalId,
|
|
584
678
|
signalKey: key,
|
|
585
679
|
sleepConditions: pbConditions.sleepConditions,
|
|
586
680
|
userEventConditions: pbConditions.userEventConditions,
|
|
587
681
|
});
|
|
588
|
-
const
|
|
682
|
+
const event = yield this.v1.durableListener.result({
|
|
589
683
|
taskId: this.action.taskRunExternalId,
|
|
590
684
|
signalKey: key,
|
|
591
|
-
});
|
|
592
|
-
const event = yield listener.get();
|
|
685
|
+
}, { signal: this.abortController.signal });
|
|
593
686
|
// Convert event.data from Uint8Array to string if needed
|
|
594
687
|
const eventData = event.data instanceof Uint8Array ? new TextDecoder().decode(event.data) : event.data;
|
|
595
688
|
const res = JSON.parse(eventData);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Defaults: warnDays=90, errorDays=undefined (error phase disabled unless set).
|
|
10
10
|
*/
|
|
11
|
-
import { Logger } from '
|
|
11
|
+
import { Logger } from '../../../../../util/logger';
|
|
12
12
|
export declare class DeprecationError extends Error {
|
|
13
13
|
feature: string;
|
|
14
14
|
constructor(feature: string, message: string);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* instead of `slotConfig`. For backward compatibility with engines
|
|
4
4
|
* that do not support multiple slot types.
|
|
5
5
|
*/
|
|
6
|
-
import { DispatcherClient, WorkerLabels } from '
|
|
7
|
-
import { ActionListener } from '
|
|
6
|
+
import { DispatcherClient, WorkerLabels } from '../../../../../clients/dispatcher/dispatcher-client';
|
|
7
|
+
import { ActionListener } from '../../../../../clients/dispatcher/action-listener';
|
|
8
8
|
export interface LegacyRegistrationOptions {
|
|
9
9
|
workerName: string;
|
|
10
10
|
services: string[];
|
|
@@ -15,8 +15,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.legacyGetActionListener = legacyGetActionListener;
|
|
18
|
-
const dispatcher_client_1 = require("
|
|
19
|
-
const action_listener_1 = require("
|
|
18
|
+
const dispatcher_client_1 = require("../../../../../clients/dispatcher/dispatcher-client");
|
|
19
|
+
const action_listener_1 = require("../../../../../clients/dispatcher/action-listener");
|
|
20
20
|
/**
|
|
21
21
|
* Registers a worker using the legacy `slots` proto field instead of `slotConfig`.
|
|
22
22
|
*/
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Legacy V1Worker subclass that registers with the old `slots` proto field
|
|
3
3
|
* instead of `slotConfig`. Used when connected to pre-slot-config engines.
|
|
4
4
|
*/
|
|
5
|
-
import { ActionListener } from '
|
|
6
|
-
import { HatchetClient } from '
|
|
7
|
-
import {
|
|
8
|
-
export declare class LegacyV1Worker extends
|
|
5
|
+
import { ActionListener } from '../../../../../clients/dispatcher/action-listener';
|
|
6
|
+
import { HatchetClient } from '../../../../../v1';
|
|
7
|
+
import { InternalWorker } from '../worker-internal';
|
|
8
|
+
export declare class LegacyV1Worker extends InternalWorker {
|
|
9
9
|
private _legacySlotCount;
|
|
10
|
-
constructor(client: HatchetClient, options: ConstructorParameters<typeof
|
|
10
|
+
constructor(client: HatchetClient, options: ConstructorParameters<typeof InternalWorker>[1], legacySlots: number);
|
|
11
11
|
/**
|
|
12
12
|
* Override registration to use the legacy `slots` proto field.
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.LegacyV1Worker = void 0;
|
|
17
17
|
const worker_internal_1 = require("../worker-internal");
|
|
18
18
|
const legacy_registration_1 = require("./legacy-registration");
|
|
19
|
-
class LegacyV1Worker extends worker_internal_1.
|
|
19
|
+
class LegacyV1Worker extends worker_internal_1.InternalWorker {
|
|
20
20
|
constructor(client, options, legacySlots) {
|
|
21
21
|
super(client, options);
|
|
22
22
|
this._legacySlotCount = legacySlots;
|
|
@@ -26,7 +26,7 @@ class LegacyV1Worker extends worker_internal_1.V1Worker {
|
|
|
26
26
|
*/
|
|
27
27
|
createListener() {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
return (0, legacy_registration_1.legacyGetActionListener)(this.client.
|
|
29
|
+
return (0, legacy_registration_1.legacyGetActionListener)(this.client.dispatcher, {
|
|
30
30
|
workerName: this.name,
|
|
31
31
|
services: ['default'],
|
|
32
32
|
actions: Object.keys(this.action_registry),
|
|
@@ -18,10 +18,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.LegacyDualWorker = void 0;
|
|
20
20
|
exports.isLegacyEngine = isLegacyEngine;
|
|
21
|
+
/* eslint-disable no-underscore-dangle */
|
|
21
22
|
const nice_grpc_1 = require("nice-grpc");
|
|
22
23
|
const declaration_1 = require("../../../declaration");
|
|
23
24
|
const legacy_v1_worker_1 = require("./legacy-v1-worker");
|
|
24
25
|
const deprecation_1 = require("./deprecation");
|
|
26
|
+
const legacy_transformer_1 = require("../../../../legacy/legacy-transformer");
|
|
25
27
|
const DEFAULT_DEFAULT_SLOTS = 100;
|
|
26
28
|
const DEFAULT_DURABLE_SLOTS = 1000;
|
|
27
29
|
/** The date when slot_config support was released. */
|
|
@@ -40,10 +42,10 @@ const LEGACY_ENGINE_MESSAGE = 'Connected to an older Hatchet engine that does no
|
|
|
40
42
|
function isLegacyEngine(v1) {
|
|
41
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
44
|
try {
|
|
43
|
-
const version = yield v1.
|
|
45
|
+
const version = yield v1.dispatcher.getVersion();
|
|
44
46
|
// If the version is empty or older than the minimum, treat as legacy
|
|
45
47
|
if (!version || (0, deprecation_1.semverLessThan)(version, MIN_SLOT_CONFIG_VERSION)) {
|
|
46
|
-
const logger = v1.
|
|
48
|
+
const logger = v1.config.logger('Worker', v1.config.log_level);
|
|
47
49
|
(0, deprecation_1.emitDeprecationNotice)('legacy-engine', LEGACY_ENGINE_MESSAGE, LEGACY_ENGINE_START, logger, {
|
|
48
50
|
errorDays: 180,
|
|
49
51
|
});
|
|
@@ -53,7 +55,7 @@ function isLegacyEngine(v1) {
|
|
|
53
55
|
}
|
|
54
56
|
catch (e) {
|
|
55
57
|
if ((e === null || e === void 0 ? void 0 : e.code) === nice_grpc_1.Status.UNIMPLEMENTED) {
|
|
56
|
-
const logger = v1.
|
|
58
|
+
const logger = v1.config.logger('Worker', v1.config.log_level);
|
|
57
59
|
(0, deprecation_1.emitDeprecationNotice)('legacy-engine', LEGACY_ENGINE_MESSAGE, LEGACY_ENGINE_START, logger, {
|
|
58
60
|
errorDays: 180,
|
|
59
61
|
});
|
|
@@ -105,16 +107,16 @@ class LegacyDualWorker {
|
|
|
105
107
|
for (const wf of options.workflows || []) {
|
|
106
108
|
if (wf instanceof declaration_1.BaseWorkflowDeclaration) {
|
|
107
109
|
if (wf.definition._durableTasks.length > 0 && durableWorker) {
|
|
108
|
-
yield durableWorker.
|
|
109
|
-
durableWorker.
|
|
110
|
+
yield durableWorker.registerWorkflow(wf);
|
|
111
|
+
durableWorker.registerDurableActions(wf.definition);
|
|
110
112
|
}
|
|
111
113
|
else {
|
|
112
|
-
yield nonDurable.
|
|
114
|
+
yield nonDurable.registerWorkflow(wf);
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
else {
|
|
116
118
|
// fallback to v0 client for backwards compatibility
|
|
117
|
-
yield nonDurable.registerWorkflow(wf);
|
|
119
|
+
yield nonDurable.registerWorkflow((0, legacy_transformer_1.transformLegacyWorkflow)(wf));
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
return legacyWorker;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Workflow as V0Workflow } from '../../../workflow';
|
|
2
1
|
import { BaseWorkflowDeclaration } from '../../declaration';
|
|
2
|
+
import type { LegacyWorkflow } from '../../../legacy/legacy-transformer';
|
|
3
3
|
import { SlotConfig } from '../../slot-types';
|
|
4
4
|
export interface WorkerSlotOptions {
|
|
5
5
|
/** (optional) Maximum number of concurrent runs on this worker, defaults to 100 */
|
|
6
6
|
slots?: number;
|
|
7
7
|
/** (optional) Maximum number of concurrent durable tasks, defaults to 1,000 */
|
|
8
8
|
durableSlots?: number;
|
|
9
|
-
/** (optional) Array of workflows to register */
|
|
10
|
-
workflows?: BaseWorkflowDeclaration<any, any>
|
|
9
|
+
/** (optional) Array of workflows to register (supports both v1 and legacy workflow formats) */
|
|
10
|
+
workflows?: Array<BaseWorkflowDeclaration<any, any> | LegacyWorkflow>;
|
|
11
11
|
/** @deprecated Use slots instead */
|
|
12
12
|
maxRuns?: number;
|
|
13
13
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Action, ActionListener } from '
|
|
2
|
-
import { StepActionEvent, StepActionEventType, GroupKeyActionEvent, GroupKeyActionEventType } from '
|
|
3
|
-
import HatchetPromise from '
|
|
4
|
-
import {
|
|
5
|
-
import { Logger } from '
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { WorkerLabels } from '
|
|
9
|
-
import { StepRunFunction } from '../../../step';
|
|
1
|
+
import { Action, ActionListener } from '../../../../clients/dispatcher/action-listener';
|
|
2
|
+
import { StepActionEvent, StepActionEventType, GroupKeyActionEvent, GroupKeyActionEventType } from '../../../../protoc/dispatcher';
|
|
3
|
+
import HatchetPromise from '../../../../util/hatchet-promise/hatchet-promise';
|
|
4
|
+
import { CreateStepRateLimit } from '../../../../protoc/workflows';
|
|
5
|
+
import { Logger } from '../../../../util/logger';
|
|
6
|
+
import { BaseWorkflowDeclaration, WorkflowDefinition, HatchetClient } from '../../../../v1';
|
|
7
|
+
import { CreateWorkflowTaskOpts } from '../../../../v1/task';
|
|
8
|
+
import { WorkerLabels } from '../../../../clients/dispatcher/dispatcher-client';
|
|
10
9
|
import { Context } from './context';
|
|
11
10
|
import { SlotConfig } from '../../slot-types';
|
|
12
11
|
export type ActionRegistry = Record<Action['actionId'], Function>;
|
|
@@ -19,14 +18,14 @@ export interface WorkerOpts {
|
|
|
19
18
|
healthPort?: number;
|
|
20
19
|
enableHealthServer?: boolean;
|
|
21
20
|
}
|
|
22
|
-
export declare class
|
|
21
|
+
export declare class InternalWorker {
|
|
23
22
|
client: HatchetClient;
|
|
24
23
|
name: string;
|
|
25
24
|
workerId: string | undefined;
|
|
26
25
|
killing: boolean;
|
|
27
26
|
handle_kill: boolean;
|
|
28
27
|
action_registry: ActionRegistry;
|
|
29
|
-
workflow_registry: Array<WorkflowDefinition
|
|
28
|
+
workflow_registry: Array<WorkflowDefinition>;
|
|
30
29
|
listener: ActionListener | undefined;
|
|
31
30
|
futures: Record<Action['taskRunExternalId'], HatchetPromise<any>>;
|
|
32
31
|
contexts: Record<Action['taskRunExternalId'], Context<any, any>>;
|
|
@@ -53,18 +52,9 @@ export declare class V1Worker {
|
|
|
53
52
|
private getRegisteredActions;
|
|
54
53
|
private getFilteredLabels;
|
|
55
54
|
private setStatus;
|
|
55
|
+
registerDurableActions(workflow: WorkflowDefinition): void;
|
|
56
56
|
private registerActions;
|
|
57
|
-
|
|
58
|
-
registerWebhook(webhook: WebhookWorkerCreateRequest): Promise<import("axios").AxiosResponse<import("../../../clients/rest/generated/data-contracts").WebhookWorkerCreated, any, {}>>;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated use registerWorkflow instead
|
|
61
|
-
*/
|
|
62
|
-
register_workflow(initWorkflow: Workflow): Promise<void>;
|
|
63
|
-
registerDurableActionsV1(workflow: WorkflowDefinition): void;
|
|
64
|
-
private registerActionsV1;
|
|
65
|
-
registerWorkflowV1(initWorkflow: BaseWorkflowDeclaration<any, any>, durable?: boolean): Promise<void>;
|
|
66
|
-
registerWorkflow(initWorkflow: Workflow): Promise<void>;
|
|
67
|
-
registerAction<T, K>(actionId: string, action: StepRunFunction<T, K>): void;
|
|
57
|
+
registerWorkflow(initWorkflow: BaseWorkflowDeclaration<any, any>, durable?: boolean): Promise<void>;
|
|
68
58
|
handleStartStepRun(action: Action): Promise<void>;
|
|
69
59
|
handleStartGroupKeyRun(action: Action): Promise<void>;
|
|
70
60
|
getStepActionEvent(action: Action, eventType: StepActionEventType, shouldNotRetry: boolean, payload?: any, retryCount?: number): StepActionEvent;
|
|
@@ -81,3 +71,4 @@ export declare class V1Worker {
|
|
|
81
71
|
handleAction(action: Action): Promise<void>;
|
|
82
72
|
upsertLabels(labels: WorkerLabels): Promise<WorkerLabels>;
|
|
83
73
|
}
|
|
74
|
+
export declare function mapRateLimitPb(limits: CreateWorkflowTaskOpts<any, any>['rateLimits']): CreateStepRateLimit[];
|