@trigger.dev/core 3.3.17 → 4.0.0-v4-beta.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/dist/commonjs/debounce.d.ts +2 -0
- package/dist/commonjs/debounce.js +19 -0
- package/dist/commonjs/debounce.js.map +1 -0
- package/dist/commonjs/index.d.ts +2 -7
- package/dist/commonjs/index.js +2 -7
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/retry.d.ts +0 -2
- package/dist/commonjs/retry.js +0 -24
- package/dist/commonjs/retry.js.map +1 -1
- package/dist/commonjs/schemas/index.d.ts +0 -16
- package/dist/commonjs/schemas/index.js +0 -16
- package/dist/commonjs/schemas/index.js.map +1 -1
- package/dist/commonjs/types.d.ts +0 -6
- package/dist/commonjs/utils.d.ts +1 -2
- package/dist/commonjs/utils.js +10 -27
- package/dist/commonjs/utils.js.map +1 -1
- package/dist/commonjs/v3/apiClient/core.d.ts +11 -3
- package/dist/commonjs/v3/apiClient/core.js +42 -2
- package/dist/commonjs/v3/apiClient/core.js.map +1 -1
- package/dist/commonjs/v3/apiClient/index.d.ts +191 -113
- package/dist/commonjs/v3/apiClient/index.js +153 -7
- package/dist/commonjs/v3/apiClient/index.js.map +1 -1
- package/dist/commonjs/v3/apiClient/runStream.js +7 -1
- package/dist/commonjs/v3/apiClient/runStream.js.map +1 -1
- package/dist/commonjs/v3/apiClient/stream.js +51 -30
- package/dist/commonjs/v3/apiClient/stream.js.map +1 -1
- package/dist/commonjs/v3/apiClient/types.d.ts +9 -1
- package/dist/commonjs/v3/apps/exec.d.ts +30 -0
- package/dist/commonjs/v3/apps/exec.js +82 -0
- package/dist/commonjs/v3/apps/exec.js.map +1 -0
- package/dist/commonjs/v3/apps/http.d.ts +8 -6
- package/dist/commonjs/v3/apps/http.js +38 -2
- package/dist/commonjs/v3/apps/http.js.map +1 -1
- package/dist/commonjs/v3/apps/index.d.ts +1 -3
- package/dist/commonjs/v3/apps/index.js +1 -3
- package/dist/commonjs/v3/apps/index.js.map +1 -1
- package/dist/commonjs/v3/build/flags.d.ts +20 -0
- package/dist/commonjs/v3/build/flags.js +49 -0
- package/dist/commonjs/v3/build/flags.js.map +1 -0
- package/dist/commonjs/v3/build/flags.test.d.ts +1 -0
- package/dist/commonjs/v3/build/flags.test.js +50 -0
- package/dist/commonjs/v3/build/flags.test.js.map +1 -0
- package/dist/commonjs/v3/build/index.d.ts +1 -0
- package/dist/commonjs/v3/build/index.js +1 -0
- package/dist/commonjs/v3/build/index.js.map +1 -1
- package/dist/commonjs/v3/build/resolvedConfig.d.ts +3 -1
- package/dist/commonjs/v3/build/runtime.d.ts +2 -2
- package/dist/commonjs/v3/build/runtime.js +11 -4
- package/dist/commonjs/v3/build/runtime.js.map +1 -1
- package/dist/commonjs/v3/config.d.ts +19 -7
- package/dist/commonjs/v3/errors.d.ts +9 -0
- package/dist/commonjs/v3/errors.js +90 -2
- package/dist/commonjs/v3/errors.js.map +1 -1
- package/dist/commonjs/v3/idempotencyKeys.d.ts +1 -0
- package/dist/commonjs/v3/idempotencyKeys.js +19 -0
- package/dist/commonjs/v3/idempotencyKeys.js.map +1 -1
- package/dist/commonjs/v3/index.d.ts +7 -2
- package/dist/commonjs/v3/index.js +10 -2
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/isomorphic/consts.d.ts +2 -0
- package/dist/commonjs/v3/isomorphic/consts.js +6 -0
- package/dist/commonjs/v3/isomorphic/consts.js.map +1 -0
- package/dist/commonjs/v3/{apps → isomorphic}/duration.d.ts +1 -0
- package/dist/commonjs/v3/{apps → isomorphic}/duration.js +19 -0
- package/dist/commonjs/v3/isomorphic/duration.js.map +1 -0
- package/dist/commonjs/v3/isomorphic/friendlyId.d.ts +36 -0
- package/dist/commonjs/v3/isomorphic/friendlyId.js +102 -0
- package/dist/commonjs/v3/isomorphic/friendlyId.js.map +1 -0
- package/dist/commonjs/v3/isomorphic/index.d.ts +5 -0
- package/dist/commonjs/v3/isomorphic/index.js +22 -0
- package/dist/commonjs/v3/isomorphic/index.js.map +1 -0
- package/dist/commonjs/v3/isomorphic/maxDuration.d.ts +2 -0
- package/dist/commonjs/v3/isomorphic/maxDuration.js +20 -0
- package/dist/commonjs/v3/isomorphic/maxDuration.js.map +1 -0
- package/dist/commonjs/v3/isomorphic/queueName.d.ts +1 -0
- package/dist/commonjs/v3/isomorphic/queueName.js +8 -0
- package/dist/commonjs/v3/isomorphic/queueName.js.map +1 -0
- package/dist/commonjs/v3/lifecycle-hooks-api.d.ts +4 -0
- package/dist/commonjs/v3/{task-catalog-api.js → lifecycle-hooks-api.js} +4 -4
- package/dist/commonjs/v3/lifecycle-hooks-api.js.map +1 -0
- package/dist/commonjs/v3/lifecycleHooks/index.d.ts +53 -0
- package/dist/commonjs/v3/lifecycleHooks/index.js +160 -0
- package/dist/commonjs/v3/lifecycleHooks/index.js.map +1 -0
- package/dist/commonjs/v3/lifecycleHooks/manager.d.ts +115 -0
- package/dist/commonjs/v3/lifecycleHooks/manager.js +401 -0
- package/dist/commonjs/v3/lifecycleHooks/manager.js.map +1 -0
- package/dist/commonjs/v3/lifecycleHooks/types.d.ts +179 -0
- package/dist/commonjs/v3/lifecycleHooks/types.js +3 -0
- package/dist/commonjs/v3/lifecycleHooks/types.js.map +1 -0
- package/dist/commonjs/v3/locals/index.d.ts +12 -0
- package/dist/commonjs/v3/locals/index.js +37 -0
- package/dist/commonjs/v3/locals/index.js.map +1 -0
- package/dist/commonjs/v3/locals/manager.d.ts +12 -0
- package/dist/commonjs/v3/locals/manager.js +35 -0
- package/dist/commonjs/v3/locals/manager.js.map +1 -0
- package/dist/commonjs/v3/locals/types.d.ts +14 -0
- package/dist/commonjs/v3/locals/types.js +3 -0
- package/dist/commonjs/v3/locals/types.js.map +1 -0
- package/dist/commonjs/v3/locals-api.d.ts +12 -0
- package/dist/commonjs/v3/locals-api.js +28 -0
- package/dist/commonjs/v3/locals-api.js.map +1 -0
- package/dist/commonjs/v3/logger/index.d.ts +4 -4
- package/dist/commonjs/v3/logger/index.js.map +1 -1
- package/dist/commonjs/v3/logger/taskLogger.d.ts +8 -4
- package/dist/commonjs/v3/logger/taskLogger.js +16 -2
- package/dist/commonjs/v3/logger/taskLogger.js.map +1 -1
- package/dist/commonjs/v3/machines/index.d.ts +27 -0
- package/dist/commonjs/v3/machines/index.js +51 -0
- package/dist/commonjs/v3/machines/index.js.map +1 -0
- package/dist/commonjs/v3/machines/max-old-space.test.d.ts +1 -0
- package/dist/commonjs/v3/machines/max-old-space.test.js +44 -0
- package/dist/commonjs/v3/machines/max-old-space.test.js.map +1 -0
- package/dist/commonjs/v3/otel/tracingSDK.js +1 -1
- package/dist/commonjs/v3/otel/tracingSDK.js.map +1 -1
- package/dist/commonjs/v3/otel/utils.d.ts +1 -0
- package/dist/commonjs/v3/otel/utils.js +6 -0
- package/dist/commonjs/v3/otel/utils.js.map +1 -1
- package/dist/{esm/v3/task-catalog → commonjs/v3/resource-catalog}/catalog.d.ts +7 -3
- package/dist/commonjs/v3/resource-catalog/catalog.js.map +1 -0
- package/dist/commonjs/v3/resource-catalog/index.d.ts +22 -0
- package/dist/commonjs/v3/resource-catalog/index.js +61 -0
- package/dist/commonjs/v3/resource-catalog/index.js.map +1 -0
- package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.d.ts +17 -0
- package/dist/commonjs/v3/{task-catalog/noopTaskCatalog.js → resource-catalog/noopResourceCatalog.js} +17 -5
- package/dist/commonjs/v3/resource-catalog/noopResourceCatalog.js.map +1 -0
- package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.d.ts +22 -0
- package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.js +129 -0
- package/dist/commonjs/v3/resource-catalog/standardResourceCatalog.js.map +1 -0
- package/dist/commonjs/v3/resource-catalog-api.d.ts +3 -0
- package/dist/commonjs/v3/resource-catalog-api.js +9 -0
- package/dist/commonjs/v3/resource-catalog-api.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/consts.d.ts +12 -0
- package/dist/commonjs/v3/runEngineWorker/consts.js +16 -0
- package/dist/commonjs/v3/runEngineWorker/consts.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/index.d.ts +7 -0
- package/dist/commonjs/v3/runEngineWorker/index.js +24 -0
- package/dist/commonjs/v3/runEngineWorker/index.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/events.d.ts +49 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/events.js +3 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/events.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/http.d.ts +351 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/http.js +154 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/http.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.d.ts +26 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js +92 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.d.ts +3537 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js +91 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/session.d.ts +32 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/session.js +174 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/session.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/types.d.ts +13 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/types.js +3 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/types.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/util.d.ts +3 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/util.js +39 -0
- package/dist/commonjs/v3/runEngineWorker/supervisor/util.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/types.d.ts +52 -0
- package/dist/commonjs/v3/runEngineWorker/types.js +3 -0
- package/dist/commonjs/v3/runEngineWorker/types.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/util.d.ts +4 -0
- package/dist/commonjs/v3/runEngineWorker/util.js +15 -0
- package/dist/commonjs/v3/runEngineWorker/util.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/workload/http.d.ts +266 -0
- package/dist/commonjs/v3/runEngineWorker/workload/http.js +117 -0
- package/dist/commonjs/v3/runEngineWorker/workload/http.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/workload/schemas.d.ts +2996 -0
- package/dist/commonjs/v3/runEngineWorker/workload/schemas.js +25 -0
- package/dist/commonjs/v3/runEngineWorker/workload/schemas.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/workload/types.d.ts +7 -0
- package/dist/commonjs/v3/runEngineWorker/workload/types.js +3 -0
- package/dist/commonjs/v3/runEngineWorker/workload/types.js.map +1 -0
- package/dist/commonjs/v3/runEngineWorker/workload/util.d.ts +2 -0
- package/dist/commonjs/v3/runEngineWorker/workload/util.js +14 -0
- package/dist/commonjs/v3/runEngineWorker/workload/util.js.map +1 -0
- package/dist/commonjs/v3/runTimelineMetrics/runTimelineMetricsManager.d.ts +1 -1
- package/dist/commonjs/v3/runTimelineMetrics/runTimelineMetricsManager.js +5 -2
- package/dist/commonjs/v3/runTimelineMetrics/runTimelineMetricsManager.js.map +1 -1
- package/dist/commonjs/v3/runtime/index.d.ts +4 -4
- package/dist/commonjs/v3/runtime/index.js +5 -5
- package/dist/commonjs/v3/runtime/index.js.map +1 -1
- package/dist/commonjs/v3/runtime/managedRuntimeManager.d.ts +30 -0
- package/dist/commonjs/v3/runtime/managedRuntimeManager.js +185 -0
- package/dist/commonjs/v3/runtime/managedRuntimeManager.js.map +1 -0
- package/dist/commonjs/v3/runtime/manager.d.ts +6 -4
- package/dist/commonjs/v3/runtime/noopRuntimeManager.d.ts +6 -4
- package/dist/commonjs/v3/runtime/noopRuntimeManager.js +4 -5
- package/dist/commonjs/v3/runtime/noopRuntimeManager.js.map +1 -1
- package/dist/commonjs/v3/schemas/api.d.ts +1966 -586
- package/dist/commonjs/v3/schemas/api.js +252 -11
- package/dist/commonjs/v3/schemas/api.js.map +1 -1
- package/dist/commonjs/v3/schemas/build.d.ts +464 -356
- package/dist/commonjs/v3/schemas/build.js +5 -2
- package/dist/commonjs/v3/schemas/build.js.map +1 -1
- package/dist/commonjs/v3/schemas/checkpoints.d.ts +419 -0
- package/dist/commonjs/v3/schemas/checkpoints.js +26 -0
- package/dist/commonjs/v3/schemas/checkpoints.js.map +1 -0
- package/dist/commonjs/v3/schemas/common.d.ts +302 -189
- package/dist/commonjs/v3/schemas/common.js +50 -9
- package/dist/commonjs/v3/schemas/common.js.map +1 -1
- package/dist/commonjs/v3/schemas/fetch.d.ts +42 -42
- package/dist/commonjs/v3/schemas/index.d.ts +4 -0
- package/dist/commonjs/v3/schemas/index.js +4 -0
- package/dist/commonjs/v3/schemas/index.js.map +1 -1
- package/dist/commonjs/v3/schemas/messages.d.ts +4701 -3934
- package/dist/commonjs/v3/schemas/messages.js +27 -0
- package/dist/commonjs/v3/schemas/messages.js.map +1 -1
- package/dist/commonjs/v3/schemas/openTelemetry.d.ts +18 -18
- package/dist/commonjs/v3/schemas/queues.d.ts +97 -0
- package/dist/commonjs/v3/schemas/queues.js +70 -0
- package/dist/commonjs/v3/schemas/queues.js.map +1 -0
- package/dist/commonjs/v3/schemas/resources.d.ts +153 -114
- package/dist/commonjs/v3/schemas/resources.js +3 -2
- package/dist/commonjs/v3/schemas/resources.js.map +1 -1
- package/dist/commonjs/v3/schemas/runEngine.d.ts +1630 -0
- package/dist/commonjs/v3/schemas/runEngine.js +202 -0
- package/dist/commonjs/v3/schemas/runEngine.js.map +1 -0
- package/dist/commonjs/v3/schemas/schemas.d.ts +523 -401
- package/dist/commonjs/v3/schemas/schemas.js +23 -5
- package/dist/commonjs/v3/schemas/schemas.js.map +1 -1
- package/dist/commonjs/v3/schemas/style.d.ts +6 -4
- package/dist/commonjs/v3/schemas/style.js +4 -2
- package/dist/commonjs/v3/schemas/style.js.map +1 -1
- package/dist/commonjs/v3/schemas/warmStart.d.ts +12 -0
- package/dist/commonjs/v3/schemas/warmStart.js +9 -0
- package/dist/commonjs/v3/schemas/warmStart.js.map +1 -0
- package/dist/commonjs/v3/schemas/webhooks.d.ts +204 -204
- package/dist/commonjs/v3/schemas/webhooks.js +6 -7
- package/dist/commonjs/v3/schemas/webhooks.js.map +1 -1
- package/dist/commonjs/v3/semanticInternalAttributes.d.ts +7 -0
- package/dist/commonjs/v3/semanticInternalAttributes.js +7 -0
- package/dist/commonjs/v3/semanticInternalAttributes.js.map +1 -1
- package/dist/commonjs/v3/serverOnly/checkpointClient.d.ts +23 -0
- package/dist/commonjs/v3/serverOnly/checkpointClient.js +80 -0
- package/dist/commonjs/v3/serverOnly/checkpointClient.js.map +1 -0
- package/dist/commonjs/v3/{apps/checkpoints.js → serverOnly/checkpointTest.js} +2 -2
- package/dist/commonjs/v3/serverOnly/checkpointTest.js.map +1 -0
- package/dist/commonjs/v3/serverOnly/httpServer.d.ts +49 -0
- package/dist/commonjs/v3/serverOnly/httpServer.js +244 -0
- package/dist/commonjs/v3/serverOnly/httpServer.js.map +1 -0
- package/dist/commonjs/v3/serverOnly/index.d.ts +6 -0
- package/dist/commonjs/v3/serverOnly/index.js +23 -0
- package/dist/commonjs/v3/serverOnly/index.js.map +1 -0
- package/dist/commonjs/v3/serverOnly/k8s.d.ts +1 -0
- package/dist/commonjs/v3/serverOnly/k8s.js +18 -0
- package/dist/commonjs/v3/serverOnly/k8s.js.map +1 -0
- package/dist/commonjs/v3/serverOnly/shutdownManager.d.ts +20 -0
- package/dist/commonjs/v3/serverOnly/shutdownManager.js +92 -0
- package/dist/commonjs/v3/serverOnly/shutdownManager.js.map +1 -0
- package/dist/commonjs/v3/serverOnly/shutdownManager.test.d.ts +1 -0
- package/dist/commonjs/v3/serverOnly/shutdownManager.test.js +139 -0
- package/dist/commonjs/v3/serverOnly/shutdownManager.test.js.map +1 -0
- package/dist/commonjs/v3/serverOnly/singleton.d.ts +1 -0
- package/dist/commonjs/v3/serverOnly/singleton.js +10 -0
- package/dist/commonjs/v3/serverOnly/singleton.js.map +1 -0
- package/dist/commonjs/v3/taskContext/index.d.ts +1 -0
- package/dist/commonjs/v3/taskContext/index.js +4 -0
- package/dist/commonjs/v3/taskContext/index.js.map +1 -1
- package/dist/commonjs/v3/taskContext/otelProcessors.d.ts +3 -1
- package/dist/commonjs/v3/taskContext/otelProcessors.js +34 -1
- package/dist/commonjs/v3/taskContext/otelProcessors.js.map +1 -1
- package/dist/commonjs/v3/taskContext/types.d.ts +1 -0
- package/dist/commonjs/v3/tracer.js +21 -16
- package/dist/commonjs/v3/tracer.js.map +1 -1
- package/dist/commonjs/v3/tryCatch.d.ts +5 -0
- package/dist/commonjs/v3/tryCatch.js +14 -0
- package/dist/commonjs/v3/tryCatch.js.map +1 -0
- package/dist/commonjs/v3/types/index.d.ts +1 -0
- package/dist/commonjs/v3/types/index.js +1 -0
- package/dist/commonjs/v3/types/index.js.map +1 -1
- package/dist/commonjs/v3/types/queues.d.ts +43 -0
- package/dist/commonjs/v3/types/queues.js +3 -0
- package/dist/commonjs/v3/types/queues.js.map +1 -0
- package/dist/commonjs/v3/types/schemas.d.ts +3 -0
- package/dist/commonjs/v3/types/schemas.js +16 -0
- package/dist/commonjs/v3/types/schemas.js.map +1 -1
- package/dist/commonjs/v3/types/tasks.d.ts +77 -34
- package/dist/commonjs/v3/types/tasks.js.map +1 -1
- package/dist/commonjs/v3/utils/durations.d.ts +1 -0
- package/dist/commonjs/v3/utils/durations.js +1 -1
- package/dist/commonjs/v3/utils/durations.js.map +1 -1
- package/dist/commonjs/v3/utils/globals.d.ts +6 -2
- package/dist/commonjs/v3/utils/globals.js.map +1 -1
- package/dist/commonjs/v3/utils/heartbeat.d.ts +21 -0
- package/dist/commonjs/v3/utils/heartbeat.js +79 -0
- package/dist/commonjs/v3/utils/heartbeat.js.map +1 -0
- package/dist/commonjs/v3/utils/imageRef.d.ts +8 -0
- package/dist/commonjs/v3/utils/imageRef.js +55 -0
- package/dist/commonjs/v3/utils/imageRef.js.map +1 -0
- package/dist/commonjs/v3/workers/index.d.ts +8 -2
- package/dist/commonjs/v3/workers/index.js +15 -3
- package/dist/commonjs/v3/workers/index.js.map +1 -1
- package/dist/commonjs/v3/workers/populateEnv.d.ts +23 -0
- package/dist/commonjs/v3/workers/populateEnv.js +33 -0
- package/dist/commonjs/v3/workers/populateEnv.js.map +1 -0
- package/dist/commonjs/v3/workers/taskExecutor.d.ts +10 -9
- package/dist/commonjs/v3/workers/taskExecutor.js +648 -247
- package/dist/commonjs/v3/workers/taskExecutor.js.map +1 -1
- package/dist/commonjs/v3/workers/warmStartClient.d.ts +27 -0
- package/dist/commonjs/v3/workers/warmStartClient.js +112 -0
- package/dist/commonjs/v3/workers/warmStartClient.js.map +1 -0
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/debounce.d.ts +2 -0
- package/dist/esm/debounce.js +16 -0
- package/dist/esm/debounce.js.map +1 -0
- package/dist/esm/index.d.ts +2 -7
- package/dist/esm/index.js +2 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/retry.d.ts +0 -2
- package/dist/esm/retry.js +0 -23
- package/dist/esm/retry.js.map +1 -1
- package/dist/esm/schemas/index.d.ts +0 -16
- package/dist/esm/schemas/index.js +0 -16
- package/dist/esm/schemas/index.js.map +1 -1
- package/dist/esm/types.d.ts +0 -6
- package/dist/esm/utils.d.ts +1 -2
- package/dist/esm/utils.js +9 -26
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/v3/apiClient/core.d.ts +11 -3
- package/dist/esm/v3/apiClient/core.js +41 -2
- package/dist/esm/v3/apiClient/core.js.map +1 -1
- package/dist/esm/v3/apiClient/index.d.ts +191 -113
- package/dist/esm/v3/apiClient/index.js +154 -8
- package/dist/esm/v3/apiClient/index.js.map +1 -1
- package/dist/esm/v3/apiClient/runStream.js +7 -1
- package/dist/esm/v3/apiClient/runStream.js.map +1 -1
- package/dist/esm/v3/apiClient/stream.js +51 -30
- package/dist/esm/v3/apiClient/stream.js.map +1 -1
- package/dist/esm/v3/apiClient/types.d.ts +9 -1
- package/dist/esm/v3/apps/exec.d.ts +30 -0
- package/dist/esm/v3/apps/exec.js +77 -0
- package/dist/esm/v3/apps/exec.js.map +1 -0
- package/dist/esm/v3/apps/http.d.ts +8 -6
- package/dist/esm/v3/apps/http.js +37 -2
- package/dist/esm/v3/apps/http.js.map +1 -1
- package/dist/esm/v3/apps/index.d.ts +1 -3
- package/dist/esm/v3/apps/index.js +1 -3
- package/dist/esm/v3/apps/index.js.map +1 -1
- package/dist/esm/v3/build/flags.d.ts +20 -0
- package/dist/esm/v3/build/flags.js +46 -0
- package/dist/esm/v3/build/flags.js.map +1 -0
- package/dist/esm/v3/build/flags.test.d.ts +1 -0
- package/dist/esm/v3/build/flags.test.js +48 -0
- package/dist/esm/v3/build/flags.test.js.map +1 -0
- package/dist/esm/v3/build/index.d.ts +1 -0
- package/dist/esm/v3/build/index.js +1 -0
- package/dist/esm/v3/build/index.js.map +1 -1
- package/dist/esm/v3/build/resolvedConfig.d.ts +3 -1
- package/dist/esm/v3/build/runtime.d.ts +2 -2
- package/dist/esm/v3/build/runtime.js +11 -4
- package/dist/esm/v3/build/runtime.js.map +1 -1
- package/dist/esm/v3/config.d.ts +19 -7
- package/dist/esm/v3/errors.d.ts +9 -0
- package/dist/esm/v3/errors.js +85 -1
- package/dist/esm/v3/errors.js.map +1 -1
- package/dist/esm/v3/idempotencyKeys.d.ts +1 -0
- package/dist/esm/v3/idempotencyKeys.js +18 -0
- package/dist/esm/v3/idempotencyKeys.js.map +1 -1
- package/dist/esm/v3/index.d.ts +7 -2
- package/dist/esm/v3/index.js +7 -2
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/isomorphic/consts.d.ts +2 -0
- package/dist/esm/v3/isomorphic/consts.js +3 -0
- package/dist/esm/v3/isomorphic/consts.js.map +1 -0
- package/dist/esm/v3/{apps → isomorphic}/duration.d.ts +1 -0
- package/dist/esm/v3/{apps → isomorphic}/duration.js +18 -0
- package/dist/esm/v3/isomorphic/duration.js.map +1 -0
- package/dist/esm/v3/isomorphic/friendlyId.d.ts +36 -0
- package/dist/esm/v3/isomorphic/friendlyId.js +90 -0
- package/dist/esm/v3/isomorphic/friendlyId.js.map +1 -0
- package/dist/esm/v3/isomorphic/index.d.ts +5 -0
- package/dist/esm/v3/isomorphic/index.js +6 -0
- package/dist/esm/v3/isomorphic/index.js.map +1 -0
- package/dist/esm/v3/isomorphic/maxDuration.d.ts +2 -0
- package/dist/esm/v3/isomorphic/maxDuration.js +16 -0
- package/dist/esm/v3/isomorphic/maxDuration.js.map +1 -0
- package/dist/esm/v3/isomorphic/queueName.d.ts +1 -0
- package/dist/esm/v3/isomorphic/queueName.js +5 -0
- package/dist/esm/v3/isomorphic/queueName.js.map +1 -0
- package/dist/esm/v3/lifecycle-hooks-api.d.ts +4 -0
- package/dist/esm/v3/lifecycle-hooks-api.js +6 -0
- package/dist/esm/v3/lifecycle-hooks-api.js.map +1 -0
- package/dist/esm/v3/lifecycleHooks/index.d.ts +53 -0
- package/dist/esm/v3/lifecycleHooks/index.js +156 -0
- package/dist/esm/v3/lifecycleHooks/index.js.map +1 -0
- package/dist/esm/v3/lifecycleHooks/manager.d.ts +115 -0
- package/dist/esm/v3/lifecycleHooks/manager.js +396 -0
- package/dist/esm/v3/lifecycleHooks/manager.js.map +1 -0
- package/dist/esm/v3/lifecycleHooks/types.d.ts +179 -0
- package/dist/esm/v3/lifecycleHooks/types.js +2 -0
- package/dist/esm/v3/lifecycleHooks/types.js.map +1 -0
- package/dist/esm/v3/locals/index.d.ts +12 -0
- package/dist/esm/v3/locals/index.js +33 -0
- package/dist/esm/v3/locals/index.js.map +1 -0
- package/dist/esm/v3/locals/manager.d.ts +12 -0
- package/dist/esm/v3/locals/manager.js +30 -0
- package/dist/esm/v3/locals/manager.js.map +1 -0
- package/dist/esm/v3/locals/types.d.ts +14 -0
- package/dist/esm/v3/locals/types.js +2 -0
- package/dist/esm/v3/locals/types.js.map +1 -0
- package/dist/esm/v3/locals-api.d.ts +12 -0
- package/dist/esm/v3/locals-api.js +25 -0
- package/dist/esm/v3/locals-api.js.map +1 -0
- package/dist/esm/v3/logger/index.d.ts +4 -4
- package/dist/esm/v3/logger/index.js.map +1 -1
- package/dist/esm/v3/logger/taskLogger.d.ts +8 -4
- package/dist/esm/v3/logger/taskLogger.js +16 -2
- package/dist/esm/v3/logger/taskLogger.js.map +1 -1
- package/dist/esm/v3/machines/index.d.ts +27 -0
- package/dist/esm/v3/machines/index.js +46 -0
- package/dist/esm/v3/machines/index.js.map +1 -0
- package/dist/esm/v3/machines/max-old-space.test.d.ts +1 -0
- package/dist/esm/v3/machines/max-old-space.test.js +42 -0
- package/dist/esm/v3/machines/max-old-space.test.js.map +1 -0
- package/dist/esm/v3/otel/tracingSDK.js +1 -1
- package/dist/esm/v3/otel/tracingSDK.js.map +1 -1
- package/dist/esm/v3/otel/utils.d.ts +1 -0
- package/dist/esm/v3/otel/utils.js +6 -1
- package/dist/esm/v3/otel/utils.js.map +1 -1
- package/dist/{commonjs/v3/task-catalog → esm/v3/resource-catalog}/catalog.d.ts +7 -3
- package/dist/esm/v3/resource-catalog/catalog.js.map +1 -0
- package/dist/esm/v3/resource-catalog/index.d.ts +22 -0
- package/dist/esm/v3/resource-catalog/index.js +57 -0
- package/dist/esm/v3/resource-catalog/index.js.map +1 -0
- package/dist/esm/v3/resource-catalog/noopResourceCatalog.d.ts +17 -0
- package/dist/esm/v3/{task-catalog/noopTaskCatalog.js → resource-catalog/noopResourceCatalog.js} +15 -3
- package/dist/esm/v3/resource-catalog/noopResourceCatalog.js.map +1 -0
- package/dist/esm/v3/resource-catalog/standardResourceCatalog.d.ts +22 -0
- package/dist/esm/v3/resource-catalog/standardResourceCatalog.js +125 -0
- package/dist/esm/v3/resource-catalog/standardResourceCatalog.js.map +1 -0
- package/dist/esm/v3/resource-catalog-api.d.ts +3 -0
- package/dist/esm/v3/resource-catalog-api.js +6 -0
- package/dist/esm/v3/resource-catalog-api.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/consts.d.ts +12 -0
- package/dist/esm/v3/runEngineWorker/consts.js +13 -0
- package/dist/esm/v3/runEngineWorker/consts.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/index.d.ts +7 -0
- package/dist/esm/v3/runEngineWorker/index.js +8 -0
- package/dist/esm/v3/runEngineWorker/index.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/events.d.ts +49 -0
- package/dist/esm/v3/runEngineWorker/supervisor/events.js +2 -0
- package/dist/esm/v3/runEngineWorker/supervisor/events.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/http.d.ts +351 -0
- package/dist/esm/v3/runEngineWorker/supervisor/http.js +150 -0
- package/dist/esm/v3/runEngineWorker/supervisor/http.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.d.ts +26 -0
- package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js +88 -0
- package/dist/esm/v3/runEngineWorker/supervisor/queueConsumer.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/schemas.d.ts +3537 -0
- package/dist/esm/v3/runEngineWorker/supervisor/schemas.js +88 -0
- package/dist/esm/v3/runEngineWorker/supervisor/schemas.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/session.d.ts +32 -0
- package/dist/esm/v3/runEngineWorker/supervisor/session.js +167 -0
- package/dist/esm/v3/runEngineWorker/supervisor/session.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/types.d.ts +13 -0
- package/dist/esm/v3/runEngineWorker/supervisor/types.js +2 -0
- package/dist/esm/v3/runEngineWorker/supervisor/types.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/supervisor/util.d.ts +3 -0
- package/dist/esm/v3/runEngineWorker/supervisor/util.js +35 -0
- package/dist/esm/v3/runEngineWorker/supervisor/util.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/types.d.ts +52 -0
- package/dist/esm/v3/runEngineWorker/types.js +2 -0
- package/dist/esm/v3/runEngineWorker/types.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/util.d.ts +4 -0
- package/dist/esm/v3/runEngineWorker/util.js +12 -0
- package/dist/esm/v3/runEngineWorker/util.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/workload/http.d.ts +266 -0
- package/dist/esm/v3/runEngineWorker/workload/http.js +113 -0
- package/dist/esm/v3/runEngineWorker/workload/http.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/workload/schemas.d.ts +2996 -0
- package/dist/esm/v3/runEngineWorker/workload/schemas.js +22 -0
- package/dist/esm/v3/runEngineWorker/workload/schemas.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/workload/types.d.ts +7 -0
- package/dist/esm/v3/runEngineWorker/workload/types.js +2 -0
- package/dist/esm/v3/runEngineWorker/workload/types.js.map +1 -0
- package/dist/esm/v3/runEngineWorker/workload/util.d.ts +2 -0
- package/dist/esm/v3/runEngineWorker/workload/util.js +11 -0
- package/dist/esm/v3/runEngineWorker/workload/util.js.map +1 -0
- package/dist/esm/v3/runTimelineMetrics/runTimelineMetricsManager.d.ts +1 -1
- package/dist/esm/v3/runTimelineMetrics/runTimelineMetricsManager.js +5 -2
- package/dist/esm/v3/runTimelineMetrics/runTimelineMetricsManager.js.map +1 -1
- package/dist/esm/v3/runtime/index.d.ts +4 -4
- package/dist/esm/v3/runtime/index.js +5 -5
- package/dist/esm/v3/runtime/index.js.map +1 -1
- package/dist/esm/v3/runtime/managedRuntimeManager.d.ts +30 -0
- package/dist/esm/v3/runtime/managedRuntimeManager.js +181 -0
- package/dist/esm/v3/runtime/managedRuntimeManager.js.map +1 -0
- package/dist/esm/v3/runtime/manager.d.ts +6 -4
- package/dist/esm/v3/runtime/noopRuntimeManager.d.ts +6 -4
- package/dist/esm/v3/runtime/noopRuntimeManager.js +4 -5
- package/dist/esm/v3/runtime/noopRuntimeManager.js.map +1 -1
- package/dist/esm/v3/schemas/api.d.ts +1966 -586
- package/dist/esm/v3/schemas/api.js +249 -10
- package/dist/esm/v3/schemas/api.js.map +1 -1
- package/dist/esm/v3/schemas/build.d.ts +464 -356
- package/dist/esm/v3/schemas/build.js +6 -3
- package/dist/esm/v3/schemas/build.js.map +1 -1
- package/dist/esm/v3/schemas/checkpoints.d.ts +419 -0
- package/dist/esm/v3/schemas/checkpoints.js +20 -0
- package/dist/esm/v3/schemas/checkpoints.js.map +1 -0
- package/dist/esm/v3/schemas/common.d.ts +302 -189
- package/dist/esm/v3/schemas/common.js +49 -8
- package/dist/esm/v3/schemas/common.js.map +1 -1
- package/dist/esm/v3/schemas/fetch.d.ts +42 -42
- package/dist/esm/v3/schemas/index.d.ts +4 -0
- package/dist/esm/v3/schemas/index.js +4 -0
- package/dist/esm/v3/schemas/index.js.map +1 -1
- package/dist/esm/v3/schemas/messages.d.ts +4701 -3934
- package/dist/esm/v3/schemas/messages.js +28 -1
- package/dist/esm/v3/schemas/messages.js.map +1 -1
- package/dist/esm/v3/schemas/openTelemetry.d.ts +18 -18
- package/dist/esm/v3/schemas/queues.d.ts +97 -0
- package/dist/esm/v3/schemas/queues.js +67 -0
- package/dist/esm/v3/schemas/queues.js.map +1 -0
- package/dist/esm/v3/schemas/resources.d.ts +153 -114
- package/dist/esm/v3/schemas/resources.js +4 -3
- package/dist/esm/v3/schemas/resources.js.map +1 -1
- package/dist/esm/v3/schemas/runEngine.d.ts +1630 -0
- package/dist/esm/v3/schemas/runEngine.js +199 -0
- package/dist/esm/v3/schemas/runEngine.js.map +1 -0
- package/dist/esm/v3/schemas/schemas.d.ts +523 -401
- package/dist/esm/v3/schemas/schemas.js +22 -4
- package/dist/esm/v3/schemas/schemas.js.map +1 -1
- package/dist/esm/v3/schemas/style.d.ts +6 -4
- package/dist/esm/v3/schemas/style.js +3 -1
- package/dist/esm/v3/schemas/style.js.map +1 -1
- package/dist/esm/v3/schemas/warmStart.d.ts +12 -0
- package/dist/esm/v3/schemas/warmStart.js +6 -0
- package/dist/esm/v3/schemas/warmStart.js.map +1 -0
- package/dist/esm/v3/schemas/webhooks.d.ts +204 -204
- package/dist/esm/v3/schemas/webhooks.js +3 -4
- package/dist/esm/v3/schemas/webhooks.js.map +1 -1
- package/dist/esm/v3/semanticInternalAttributes.d.ts +7 -0
- package/dist/esm/v3/semanticInternalAttributes.js +7 -0
- package/dist/esm/v3/semanticInternalAttributes.js.map +1 -1
- package/dist/esm/v3/serverOnly/checkpointClient.d.ts +23 -0
- package/dist/esm/v3/serverOnly/checkpointClient.js +76 -0
- package/dist/esm/v3/serverOnly/checkpointClient.js.map +1 -0
- package/dist/esm/v3/{apps/checkpoints.js → serverOnly/checkpointTest.js} +2 -2
- package/dist/esm/v3/serverOnly/checkpointTest.js.map +1 -0
- package/dist/esm/v3/serverOnly/httpServer.d.ts +49 -0
- package/dist/esm/v3/serverOnly/httpServer.js +240 -0
- package/dist/esm/v3/serverOnly/httpServer.js.map +1 -0
- package/dist/esm/v3/serverOnly/index.d.ts +6 -0
- package/dist/esm/v3/serverOnly/index.js +7 -0
- package/dist/esm/v3/serverOnly/index.js.map +1 -0
- package/dist/esm/v3/serverOnly/k8s.d.ts +1 -0
- package/dist/esm/v3/serverOnly/k8s.js +15 -0
- package/dist/esm/v3/serverOnly/k8s.js.map +1 -0
- package/dist/esm/v3/serverOnly/shutdownManager.d.ts +20 -0
- package/dist/esm/v3/serverOnly/shutdownManager.js +88 -0
- package/dist/esm/v3/serverOnly/shutdownManager.js.map +1 -0
- package/dist/esm/v3/serverOnly/shutdownManager.test.d.ts +1 -0
- package/dist/esm/v3/serverOnly/shutdownManager.test.js +137 -0
- package/dist/esm/v3/serverOnly/shutdownManager.test.js.map +1 -0
- package/dist/esm/v3/serverOnly/singleton.d.ts +1 -0
- package/dist/esm/v3/serverOnly/singleton.js +7 -0
- package/dist/esm/v3/serverOnly/singleton.js.map +1 -0
- package/dist/esm/v3/taskContext/index.d.ts +1 -0
- package/dist/esm/v3/taskContext/index.js +4 -0
- package/dist/esm/v3/taskContext/index.js.map +1 -1
- package/dist/esm/v3/taskContext/otelProcessors.d.ts +3 -1
- package/dist/esm/v3/taskContext/otelProcessors.js +34 -1
- package/dist/esm/v3/taskContext/otelProcessors.js.map +1 -1
- package/dist/esm/v3/taskContext/types.d.ts +1 -0
- package/dist/esm/v3/tracer.js +21 -16
- package/dist/esm/v3/tracer.js.map +1 -1
- package/dist/esm/v3/tryCatch.d.ts +5 -0
- package/dist/esm/v3/tryCatch.js +11 -0
- package/dist/esm/v3/tryCatch.js.map +1 -0
- package/dist/esm/v3/types/index.d.ts +1 -0
- package/dist/esm/v3/types/index.js +1 -0
- package/dist/esm/v3/types/index.js.map +1 -1
- package/dist/esm/v3/types/queues.d.ts +43 -0
- package/dist/esm/v3/types/queues.js +2 -0
- package/dist/esm/v3/types/queues.js.map +1 -0
- package/dist/esm/v3/types/schemas.d.ts +3 -0
- package/dist/esm/v3/types/schemas.js +13 -0
- package/dist/esm/v3/types/schemas.js.map +1 -1
- package/dist/esm/v3/types/tasks.d.ts +77 -34
- package/dist/esm/v3/types/tasks.js.map +1 -1
- package/dist/esm/v3/utils/durations.d.ts +1 -0
- package/dist/esm/v3/utils/durations.js +1 -1
- package/dist/esm/v3/utils/durations.js.map +1 -1
- package/dist/esm/v3/utils/globals.d.ts +6 -2
- package/dist/esm/v3/utils/globals.js.map +1 -1
- package/dist/esm/v3/utils/heartbeat.d.ts +21 -0
- package/dist/esm/v3/utils/heartbeat.js +75 -0
- package/dist/esm/v3/utils/heartbeat.js.map +1 -0
- package/dist/esm/v3/utils/imageRef.d.ts +8 -0
- package/dist/esm/v3/utils/imageRef.js +51 -0
- package/dist/esm/v3/utils/imageRef.js.map +1 -0
- package/dist/esm/v3/workers/index.d.ts +8 -2
- package/dist/esm/v3/workers/index.js +8 -2
- package/dist/esm/v3/workers/index.js.map +1 -1
- package/dist/esm/v3/workers/populateEnv.d.ts +23 -0
- package/dist/esm/v3/workers/populateEnv.js +30 -0
- package/dist/esm/v3/workers/populateEnv.js.map +1 -0
- package/dist/esm/v3/workers/taskExecutor.d.ts +10 -9
- package/dist/esm/v3/workers/taskExecutor.js +651 -250
- package/dist/esm/v3/workers/taskExecutor.js.map +1 -1
- package/dist/esm/v3/workers/warmStartClient.d.ts +27 -0
- package/dist/esm/v3/workers/warmStartClient.js +108 -0
- package/dist/esm/v3/workers/warmStartClient.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/package.json +72 -128
- package/dist/commonjs/bloom.d.ts +0 -10
- package/dist/commonjs/bloom.js +0 -58
- package/dist/commonjs/bloom.js.map +0 -1
- package/dist/commonjs/replacements.d.ts +0 -19
- package/dist/commonjs/replacements.js +0 -27
- package/dist/commonjs/replacements.js.map +0 -1
- package/dist/commonjs/requestFilterMatches.d.ts +0 -7
- package/dist/commonjs/requestFilterMatches.js +0 -62
- package/dist/commonjs/requestFilterMatches.js.map +0 -1
- package/dist/commonjs/schemas/addMissingVersionField.d.ts +0 -1
- package/dist/commonjs/schemas/addMissingVersionField.js +0 -13
- package/dist/commonjs/schemas/addMissingVersionField.js.map +0 -1
- package/dist/commonjs/schemas/api.d.ts +0 -13789
- package/dist/commonjs/schemas/api.js +0 -852
- package/dist/commonjs/schemas/api.js.map +0 -1
- package/dist/commonjs/schemas/errors.d.ts +0 -26
- package/dist/commonjs/schemas/errors.js +0 -14
- package/dist/commonjs/schemas/errors.js.map +0 -1
- package/dist/commonjs/schemas/events.d.ts +0 -66
- package/dist/commonjs/schemas/events.js +0 -31
- package/dist/commonjs/schemas/events.js.map +0 -1
- package/dist/commonjs/schemas/fetch.d.ts +0 -682
- package/dist/commonjs/schemas/fetch.js +0 -68
- package/dist/commonjs/schemas/fetch.js.map +0 -1
- package/dist/commonjs/schemas/integrations.d.ts +0 -66
- package/dist/commonjs/schemas/integrations.js +0 -21
- package/dist/commonjs/schemas/integrations.js.map +0 -1
- package/dist/commonjs/schemas/jobs.d.ts +0 -12
- package/dist/commonjs/schemas/jobs.js +0 -9
- package/dist/commonjs/schemas/jobs.js.map +0 -1
- package/dist/commonjs/schemas/notifications.d.ts +0 -587
- package/dist/commonjs/schemas/notifications.js +0 -59
- package/dist/commonjs/schemas/notifications.js.map +0 -1
- package/dist/commonjs/schemas/properties.d.ts +0 -57
- package/dist/commonjs/schemas/properties.js +0 -23
- package/dist/commonjs/schemas/properties.js.map +0 -1
- package/dist/commonjs/schemas/request.d.ts +0 -17
- package/dist/commonjs/schemas/request.js +0 -11
- package/dist/commonjs/schemas/request.js.map +0 -1
- package/dist/commonjs/schemas/requestFilter.d.ts +0 -225
- package/dist/commonjs/schemas/requestFilter.js +0 -60
- package/dist/commonjs/schemas/requestFilter.js.map +0 -1
- package/dist/commonjs/schemas/runs.d.ts +0 -344
- package/dist/commonjs/schemas/runs.js +0 -91
- package/dist/commonjs/schemas/runs.js.map +0 -1
- package/dist/commonjs/schemas/schedules.d.ts +0 -185
- package/dist/commonjs/schemas/schedules.js +0 -48
- package/dist/commonjs/schemas/schedules.js.map +0 -1
- package/dist/commonjs/schemas/statuses.d.ts +0 -89
- package/dist/commonjs/schemas/statuses.js +0 -23
- package/dist/commonjs/schemas/statuses.js.map +0 -1
- package/dist/commonjs/schemas/tasks.d.ts +0 -294
- package/dist/commonjs/schemas/tasks.js +0 -50
- package/dist/commonjs/schemas/tasks.js.map +0 -1
- package/dist/commonjs/schemas/triggers.d.ts +0 -532
- package/dist/commonjs/schemas/triggers.js +0 -57
- package/dist/commonjs/schemas/triggers.js.map +0 -1
- package/dist/commonjs/searchParams.d.ts +0 -1
- package/dist/commonjs/searchParams.js +0 -16
- package/dist/commonjs/searchParams.js.map +0 -1
- package/dist/commonjs/v3/apps/checkpoints.js.map +0 -1
- package/dist/commonjs/v3/apps/duration.js.map +0 -1
- package/dist/commonjs/v3/apps/friendlyId.d.ts +0 -1
- package/dist/commonjs/v3/apps/friendlyId.js +0 -9
- package/dist/commonjs/v3/apps/friendlyId.js.map +0 -1
- package/dist/commonjs/v3/dev/index.d.ts +0 -1
- package/dist/commonjs/v3/dev/index.js +0 -6
- package/dist/commonjs/v3/dev/index.js.map +0 -1
- package/dist/commonjs/v3/prod/index.d.ts +0 -1
- package/dist/commonjs/v3/prod/index.js +0 -6
- package/dist/commonjs/v3/prod/index.js.map +0 -1
- package/dist/commonjs/v3/runtime/devRuntimeManager.d.ts +0 -27
- package/dist/commonjs/v3/runtime/devRuntimeManager.js +0 -77
- package/dist/commonjs/v3/runtime/devRuntimeManager.js.map +0 -1
- package/dist/commonjs/v3/runtime/prodRuntimeManager.d.ts +0 -38
- package/dist/commonjs/v3/runtime/prodRuntimeManager.js +0 -94
- package/dist/commonjs/v3/runtime/prodRuntimeManager.js.map +0 -1
- package/dist/commonjs/v3/task-catalog/catalog.js.map +0 -1
- package/dist/commonjs/v3/task-catalog/index.d.ts +0 -18
- package/dist/commonjs/v3/task-catalog/index.js +0 -49
- package/dist/commonjs/v3/task-catalog/index.js.map +0 -1
- package/dist/commonjs/v3/task-catalog/noopTaskCatalog.d.ts +0 -13
- package/dist/commonjs/v3/task-catalog/noopTaskCatalog.js.map +0 -1
- package/dist/commonjs/v3/task-catalog/standardTaskCatalog.d.ts +0 -16
- package/dist/commonjs/v3/task-catalog/standardTaskCatalog.js +0 -84
- package/dist/commonjs/v3/task-catalog/standardTaskCatalog.js.map +0 -1
- package/dist/commonjs/v3/task-catalog-api.d.ts +0 -3
- package/dist/commonjs/v3/task-catalog-api.js.map +0 -1
- package/dist/commonjs/versions.d.ts +0 -9
- package/dist/commonjs/versions.js +0 -23
- package/dist/commonjs/versions.js.map +0 -1
- package/dist/esm/bloom.d.ts +0 -10
- package/dist/esm/bloom.js +0 -54
- package/dist/esm/bloom.js.map +0 -1
- package/dist/esm/replacements.d.ts +0 -19
- package/dist/esm/replacements.js +0 -24
- package/dist/esm/replacements.js.map +0 -1
- package/dist/esm/requestFilterMatches.d.ts +0 -7
- package/dist/esm/requestFilterMatches.js +0 -58
- package/dist/esm/requestFilterMatches.js.map +0 -1
- package/dist/esm/schemas/addMissingVersionField.d.ts +0 -1
- package/dist/esm/schemas/addMissingVersionField.js +0 -10
- package/dist/esm/schemas/addMissingVersionField.js.map +0 -1
- package/dist/esm/schemas/api.d.ts +0 -13789
- package/dist/esm/schemas/api.js +0 -847
- package/dist/esm/schemas/api.js.map +0 -1
- package/dist/esm/schemas/errors.d.ts +0 -26
- package/dist/esm/schemas/errors.js +0 -11
- package/dist/esm/schemas/errors.js.map +0 -1
- package/dist/esm/schemas/events.d.ts +0 -66
- package/dist/esm/schemas/events.js +0 -28
- package/dist/esm/schemas/events.js.map +0 -1
- package/dist/esm/schemas/fetch.d.ts +0 -682
- package/dist/esm/schemas/fetch.js +0 -65
- package/dist/esm/schemas/fetch.js.map +0 -1
- package/dist/esm/schemas/integrations.d.ts +0 -66
- package/dist/esm/schemas/integrations.js +0 -18
- package/dist/esm/schemas/integrations.js.map +0 -1
- package/dist/esm/schemas/jobs.d.ts +0 -12
- package/dist/esm/schemas/jobs.js +0 -6
- package/dist/esm/schemas/jobs.js.map +0 -1
- package/dist/esm/schemas/notifications.d.ts +0 -587
- package/dist/esm/schemas/notifications.js +0 -56
- package/dist/esm/schemas/notifications.js.map +0 -1
- package/dist/esm/schemas/properties.d.ts +0 -57
- package/dist/esm/schemas/properties.js +0 -20
- package/dist/esm/schemas/properties.js.map +0 -1
- package/dist/esm/schemas/request.d.ts +0 -17
- package/dist/esm/schemas/request.js +0 -8
- package/dist/esm/schemas/request.js.map +0 -1
- package/dist/esm/schemas/requestFilter.d.ts +0 -225
- package/dist/esm/schemas/requestFilter.js +0 -57
- package/dist/esm/schemas/requestFilter.js.map +0 -1
- package/dist/esm/schemas/runs.d.ts +0 -344
- package/dist/esm/schemas/runs.js +0 -88
- package/dist/esm/schemas/runs.js.map +0 -1
- package/dist/esm/schemas/schedules.d.ts +0 -185
- package/dist/esm/schemas/schedules.js +0 -45
- package/dist/esm/schemas/schedules.js.map +0 -1
- package/dist/esm/schemas/statuses.d.ts +0 -89
- package/dist/esm/schemas/statuses.js +0 -20
- package/dist/esm/schemas/statuses.js.map +0 -1
- package/dist/esm/schemas/tasks.d.ts +0 -294
- package/dist/esm/schemas/tasks.js +0 -47
- package/dist/esm/schemas/tasks.js.map +0 -1
- package/dist/esm/schemas/triggers.d.ts +0 -532
- package/dist/esm/schemas/triggers.js +0 -54
- package/dist/esm/schemas/triggers.js.map +0 -1
- package/dist/esm/searchParams.d.ts +0 -1
- package/dist/esm/searchParams.js +0 -13
- package/dist/esm/searchParams.js.map +0 -1
- package/dist/esm/v3/apps/checkpoints.js.map +0 -1
- package/dist/esm/v3/apps/duration.js.map +0 -1
- package/dist/esm/v3/apps/friendlyId.d.ts +0 -1
- package/dist/esm/v3/apps/friendlyId.js +0 -6
- package/dist/esm/v3/apps/friendlyId.js.map +0 -1
- package/dist/esm/v3/dev/index.d.ts +0 -1
- package/dist/esm/v3/dev/index.js +0 -2
- package/dist/esm/v3/dev/index.js.map +0 -1
- package/dist/esm/v3/prod/index.d.ts +0 -1
- package/dist/esm/v3/prod/index.js +0 -2
- package/dist/esm/v3/prod/index.js.map +0 -1
- package/dist/esm/v3/runtime/devRuntimeManager.d.ts +0 -27
- package/dist/esm/v3/runtime/devRuntimeManager.js +0 -73
- package/dist/esm/v3/runtime/devRuntimeManager.js.map +0 -1
- package/dist/esm/v3/runtime/prodRuntimeManager.d.ts +0 -38
- package/dist/esm/v3/runtime/prodRuntimeManager.js +0 -90
- package/dist/esm/v3/runtime/prodRuntimeManager.js.map +0 -1
- package/dist/esm/v3/task-catalog/catalog.js.map +0 -1
- package/dist/esm/v3/task-catalog/index.d.ts +0 -18
- package/dist/esm/v3/task-catalog/index.js +0 -45
- package/dist/esm/v3/task-catalog/index.js.map +0 -1
- package/dist/esm/v3/task-catalog/noopTaskCatalog.d.ts +0 -13
- package/dist/esm/v3/task-catalog/noopTaskCatalog.js.map +0 -1
- package/dist/esm/v3/task-catalog/standardTaskCatalog.d.ts +0 -16
- package/dist/esm/v3/task-catalog/standardTaskCatalog.js +0 -80
- package/dist/esm/v3/task-catalog/standardTaskCatalog.js.map +0 -1
- package/dist/esm/v3/task-catalog-api.d.ts +0 -3
- package/dist/esm/v3/task-catalog-api.js +0 -6
- package/dist/esm/v3/task-catalog-api.js.map +0 -1
- package/dist/esm/versions.d.ts +0 -9
- package/dist/esm/versions.js +0 -19
- package/dist/esm/versions.js.map +0 -1
- /package/dist/commonjs/v3/{task-catalog → resource-catalog}/catalog.js +0 -0
- /package/dist/commonjs/v3/{apps/checkpoints.d.ts → serverOnly/checkpointTest.d.ts} +0 -0
- /package/dist/esm/v3/{task-catalog → resource-catalog}/catalog.js +0 -0
- /package/dist/esm/v3/{apps/checkpoints.d.ts → serverOnly/checkpointTest.d.ts} +0 -0
|
@@ -10,6 +10,7 @@ const run_timeline_metrics_api_js_1 = require("../run-timeline-metrics-api.js");
|
|
|
10
10
|
const index_js_3 = require("../schemas/index.js");
|
|
11
11
|
const semanticInternalAttributes_js_1 = require("../semanticInternalAttributes.js");
|
|
12
12
|
const task_context_api_js_1 = require("../task-context-api.js");
|
|
13
|
+
const tryCatch_js_1 = require("../tryCatch.js");
|
|
13
14
|
const ioSerialization_js_1 = require("../utils/ioSerialization.js");
|
|
14
15
|
const retries_js_1 = require("../utils/retries.js");
|
|
15
16
|
class TaskExecutor {
|
|
@@ -17,17 +18,17 @@ class TaskExecutor {
|
|
|
17
18
|
_tracingSDK;
|
|
18
19
|
_tracer;
|
|
19
20
|
_consoleInterceptor;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
_retries;
|
|
22
|
+
_isWarmStart;
|
|
22
23
|
constructor(task, options) {
|
|
23
24
|
this.task = task;
|
|
24
25
|
this._tracingSDK = options.tracingSDK;
|
|
25
26
|
this._tracer = options.tracer;
|
|
26
27
|
this._consoleInterceptor = options.consoleInterceptor;
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
28
|
+
this._retries = options.retries;
|
|
29
|
+
this._isWarmStart = options.isWarmStart;
|
|
29
30
|
}
|
|
30
|
-
async execute(execution, worker, traceContext,
|
|
31
|
+
async execute(execution, worker, traceContext, signal, isWarmStart) {
|
|
31
32
|
const ctx = index_js_3.TaskRunContext.parse(execution);
|
|
32
33
|
const attemptMessage = `Attempt ${execution.attempt.number}`;
|
|
33
34
|
const originalPacket = {
|
|
@@ -37,6 +38,7 @@ class TaskExecutor {
|
|
|
37
38
|
task_context_api_js_1.taskContext.setGlobalTaskContext({
|
|
38
39
|
ctx,
|
|
39
40
|
worker,
|
|
41
|
+
isWarmStart: isWarmStart ?? this._isWarmStart,
|
|
40
42
|
});
|
|
41
43
|
if (execution.run.metadata) {
|
|
42
44
|
index_js_1.runMetadata.enterWithMetadata(execution.run.metadata);
|
|
@@ -50,75 +52,49 @@ class TaskExecutor {
|
|
|
50
52
|
return await this._consoleInterceptor.intercept(console, async () => {
|
|
51
53
|
let parsedPayload;
|
|
52
54
|
let initOutput;
|
|
53
|
-
|
|
54
|
-
await
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
catch (inputError) {
|
|
55
|
+
const [inputError, payloadResult] = await (0, tryCatch_js_1.tryCatch)(run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "payload", async () => {
|
|
56
|
+
const payloadPacket = await (0, ioSerialization_js_1.conditionallyImportPacket)(originalPacket, this._tracer);
|
|
57
|
+
return await (0, ioSerialization_js_1.parsePacket)(payloadPacket);
|
|
58
|
+
}));
|
|
59
|
+
if (inputError) {
|
|
60
60
|
(0, index_js_2.recordSpanException)(span, inputError);
|
|
61
|
-
return
|
|
62
|
-
ok: false,
|
|
63
|
-
id: execution.run.id,
|
|
64
|
-
error: {
|
|
65
|
-
type: "INTERNAL_ERROR",
|
|
66
|
-
code: index_js_3.TaskRunErrorCodes.TASK_INPUT_ERROR,
|
|
67
|
-
message: inputError instanceof Error
|
|
68
|
-
? `${inputError.name}: ${inputError.message}`
|
|
69
|
-
: typeof inputError === "string"
|
|
70
|
-
? inputError
|
|
71
|
-
: undefined,
|
|
72
|
-
stackTrace: inputError instanceof Error ? inputError.stack : undefined,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
61
|
+
return this.#internalErrorResult(execution, index_js_3.TaskRunErrorCodes.TASK_INPUT_ERROR, inputError);
|
|
75
62
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
63
|
+
parsedPayload = await this.#parsePayload(payloadResult);
|
|
64
|
+
index_js_1.lifecycleHooks.registerOnWaitHookListener(async (wait) => {
|
|
65
|
+
await this.#callOnWaitFunctions(wait, parsedPayload, ctx, initOutput, signal);
|
|
66
|
+
});
|
|
67
|
+
index_js_1.lifecycleHooks.registerOnResumeHookListener(async (wait) => {
|
|
68
|
+
await this.#callOnResumeFunctions(wait, parsedPayload, ctx, initOutput, signal);
|
|
69
|
+
});
|
|
70
|
+
const executeTask = async (payload) => {
|
|
71
|
+
const [runError, output] = await (0, tryCatch_js_1.tryCatch)((async () => {
|
|
72
|
+
initOutput = await this.#callInitFunctions(payload, ctx, signal);
|
|
73
|
+
if (execution.attempt.number === 1) {
|
|
74
|
+
await this.#callOnStartFunctions(payload, ctx, initOutput, signal);
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
return await this.#callRun(payload, ctx, initOutput, signal);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if ((0, errors_js_1.isCompleteTaskWithOutput)(error)) {
|
|
81
|
+
return error.output;
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
})());
|
|
86
|
+
if (runError) {
|
|
87
|
+
const [handleErrorError, handleErrorResult] = await (0, tryCatch_js_1.tryCatch)(this.#handleError(execution, runError, payload, ctx, initOutput, signal));
|
|
88
|
+
if (handleErrorError) {
|
|
89
|
+
(0, index_js_2.recordSpanException)(span, handleErrorError);
|
|
90
|
+
return this.#internalErrorResult(execution, index_js_3.TaskRunErrorCodes.HANDLE_ERROR_ERROR, handleErrorError);
|
|
90
91
|
}
|
|
91
|
-
return {
|
|
92
|
-
ok: true,
|
|
93
|
-
id: execution.run.id,
|
|
94
|
-
output: finalOutput.data,
|
|
95
|
-
outputType: finalOutput.dataType,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
catch (outputError) {
|
|
99
|
-
(0, index_js_2.recordSpanException)(span, outputError);
|
|
100
|
-
return {
|
|
101
|
-
ok: false,
|
|
102
|
-
id: execution.run.id,
|
|
103
|
-
error: {
|
|
104
|
-
type: "INTERNAL_ERROR",
|
|
105
|
-
code: index_js_3.TaskRunErrorCodes.TASK_OUTPUT_ERROR,
|
|
106
|
-
message: outputError instanceof Error
|
|
107
|
-
? outputError.message
|
|
108
|
-
: typeof outputError === "string"
|
|
109
|
-
? outputError
|
|
110
|
-
: undefined,
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
catch (runError) {
|
|
116
|
-
try {
|
|
117
|
-
const handleErrorResult = await this.#handleError(execution, runError, parsedPayload, ctx, initOutput, signal);
|
|
118
92
|
(0, index_js_2.recordSpanException)(span, handleErrorResult.error ?? runError);
|
|
119
93
|
if (handleErrorResult.status !== "retry") {
|
|
120
|
-
await this.#callOnFailureFunctions(
|
|
94
|
+
await this.#callOnFailureFunctions(payload, handleErrorResult.error ?? runError, ctx, initOutput, signal);
|
|
95
|
+
await this.#callOnCompleteFunctions(payload, { ok: false, error: handleErrorResult.error ?? runError }, ctx, initOutput, signal);
|
|
121
96
|
}
|
|
97
|
+
await this.#cleanupAndWaitUntil(payload, ctx, initOutput, signal);
|
|
122
98
|
return {
|
|
123
99
|
id: execution.run.id,
|
|
124
100
|
ok: false,
|
|
@@ -129,37 +105,56 @@ class TaskExecutor {
|
|
|
129
105
|
skippedRetrying: handleErrorResult.status === "skipped",
|
|
130
106
|
};
|
|
131
107
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
error: {
|
|
138
|
-
type: "INTERNAL_ERROR",
|
|
139
|
-
code: index_js_3.TaskRunErrorCodes.HANDLE_ERROR_ERROR,
|
|
140
|
-
message: handleErrorError instanceof Error
|
|
141
|
-
? handleErrorError.message
|
|
142
|
-
: typeof handleErrorError === "string"
|
|
143
|
-
? handleErrorError
|
|
144
|
-
: undefined,
|
|
145
|
-
},
|
|
146
|
-
};
|
|
108
|
+
const [outputError, stringifiedOutput] = await (0, tryCatch_js_1.tryCatch)((0, ioSerialization_js_1.stringifyIO)(output));
|
|
109
|
+
if (outputError) {
|
|
110
|
+
(0, index_js_2.recordSpanException)(span, outputError);
|
|
111
|
+
await this.#cleanupAndWaitUntil(payload, ctx, initOutput, signal);
|
|
112
|
+
return this.#internalErrorResult(execution, index_js_3.TaskRunErrorCodes.TASK_OUTPUT_ERROR, outputError);
|
|
147
113
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
114
|
+
const [exportError, finalOutput] = await (0, tryCatch_js_1.tryCatch)((0, ioSerialization_js_1.conditionallyExportPacket)(stringifiedOutput, `${execution.attempt.id}/output`, this._tracer));
|
|
115
|
+
if (exportError) {
|
|
116
|
+
(0, index_js_2.recordSpanException)(span, exportError);
|
|
117
|
+
await this.#cleanupAndWaitUntil(payload, ctx, initOutput, signal);
|
|
118
|
+
return this.#internalErrorResult(execution, index_js_3.TaskRunErrorCodes.TASK_OUTPUT_ERROR, exportError);
|
|
119
|
+
}
|
|
120
|
+
const [attrError, attributes] = await (0, tryCatch_js_1.tryCatch)((0, ioSerialization_js_1.createPacketAttributes)(finalOutput, semanticInternalAttributes_js_1.SemanticInternalAttributes.OUTPUT, semanticInternalAttributes_js_1.SemanticInternalAttributes.OUTPUT_TYPE));
|
|
121
|
+
if (!attrError && attributes) {
|
|
122
|
+
span.setAttributes(attributes);
|
|
123
|
+
}
|
|
124
|
+
await this.#callOnSuccessFunctions(payload, output, ctx, initOutput, signal);
|
|
125
|
+
await this.#callOnCompleteFunctions(payload, { ok: true, data: output }, ctx, initOutput, signal);
|
|
126
|
+
await this.#cleanupAndWaitUntil(payload, ctx, initOutput, signal);
|
|
127
|
+
return {
|
|
128
|
+
ok: true,
|
|
129
|
+
id: execution.run.id,
|
|
130
|
+
output: finalOutput.data,
|
|
131
|
+
outputType: finalOutput.dataType,
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
const globalMiddlewareHooks = index_js_1.lifecycleHooks.getGlobalMiddlewareHooks();
|
|
135
|
+
const taskMiddlewareHook = index_js_1.lifecycleHooks.getTaskMiddlewareHook(this.task.id);
|
|
136
|
+
const middlewareHooks = [
|
|
137
|
+
...globalMiddlewareHooks,
|
|
138
|
+
taskMiddlewareHook ? { id: this.task.id, fn: taskMiddlewareHook } : undefined,
|
|
139
|
+
].filter(Boolean);
|
|
140
|
+
return await this.#executeTaskWithMiddlewareHooks(parsedPayload, ctx, execution, middlewareHooks, executeTask, signal);
|
|
154
141
|
});
|
|
155
142
|
}, {
|
|
156
143
|
kind: api_1.SpanKind.CONSUMER,
|
|
157
144
|
attributes: {
|
|
158
145
|
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "attempt",
|
|
146
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.ENTITY_TYPE]: "attempt",
|
|
159
147
|
[semanticInternalAttributes_js_1.SemanticInternalAttributes.SPAN_ATTEMPT]: true,
|
|
160
148
|
...(execution.attempt.number === 1
|
|
161
149
|
? run_timeline_metrics_api_js_1.runTimelineMetrics.convertMetricsToSpanAttributes()
|
|
162
150
|
: {}),
|
|
151
|
+
...(execution.environment.type !== "DEVELOPMENT"
|
|
152
|
+
? {
|
|
153
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_VARIANT]: this._isWarmStart
|
|
154
|
+
? index_js_3.WARM_VARIANT
|
|
155
|
+
: index_js_3.COLD_VARIANT,
|
|
156
|
+
}
|
|
157
|
+
: {}),
|
|
163
158
|
},
|
|
164
159
|
events: execution.attempt.number === 1
|
|
165
160
|
? run_timeline_metrics_api_js_1.runTimelineMetrics.convertMetricsToSpanEvents()
|
|
@@ -167,129 +162,426 @@ class TaskExecutor {
|
|
|
167
162
|
}, this._tracer.extractContext(traceContext), signal);
|
|
168
163
|
return { result };
|
|
169
164
|
}
|
|
165
|
+
async #executeTaskWithMiddlewareHooks(payload, ctx, execution, hooks, executeTask, signal) {
|
|
166
|
+
let output;
|
|
167
|
+
let executeError;
|
|
168
|
+
const runner = hooks.reduceRight((next, hook) => {
|
|
169
|
+
return async () => {
|
|
170
|
+
await this._tracer.startActiveSpan("middleware()", async (span) => {
|
|
171
|
+
await hook.fn({ payload, ctx, signal, task: this.task.id, next });
|
|
172
|
+
}, {
|
|
173
|
+
attributes: {
|
|
174
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-middleware",
|
|
175
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
}, async () => {
|
|
180
|
+
const [error, result] = await (0, tryCatch_js_1.tryCatch)(executeTask(payload));
|
|
181
|
+
if (error) {
|
|
182
|
+
executeError = error;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
output = result;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
const [runnerError] = await (0, tryCatch_js_1.tryCatch)(runner());
|
|
189
|
+
if (runnerError) {
|
|
190
|
+
return this.#internalErrorResult(execution, index_js_3.TaskRunErrorCodes.TASK_MIDDLEWARE_ERROR, runnerError);
|
|
191
|
+
}
|
|
192
|
+
if (executeError) {
|
|
193
|
+
throw executeError;
|
|
194
|
+
}
|
|
195
|
+
return output;
|
|
196
|
+
}
|
|
170
197
|
async #callRun(payload, ctx, init, signal) {
|
|
171
198
|
const runFn = this.task.fns.run;
|
|
172
|
-
const middlewareFn = this.task.fns.middleware;
|
|
173
199
|
if (!runFn) {
|
|
174
200
|
throw new Error("Task does not have a run function");
|
|
175
201
|
}
|
|
176
|
-
|
|
177
|
-
|
|
202
|
+
// Create a promise that rejects when the signal aborts
|
|
203
|
+
const abortPromise = signal
|
|
204
|
+
? new Promise((_, reject) => {
|
|
205
|
+
signal.addEventListener("abort", () => {
|
|
206
|
+
const maxDuration = ctx.run.maxDuration;
|
|
207
|
+
reject(new errors_js_1.InternalError({
|
|
208
|
+
code: index_js_3.TaskRunErrorCodes.MAX_DURATION_EXCEEDED,
|
|
209
|
+
message: `Run exceeded maximum compute time (maxDuration) of ${maxDuration} seconds`,
|
|
210
|
+
}));
|
|
211
|
+
});
|
|
212
|
+
})
|
|
213
|
+
: undefined;
|
|
214
|
+
return run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "run", async () => {
|
|
215
|
+
return await this._tracer.startActiveSpan("run()", async (span) => {
|
|
216
|
+
if (abortPromise) {
|
|
217
|
+
// Race between the run function and the abort promise
|
|
218
|
+
return await Promise.race([runFn(payload, { ctx, init, signal }), abortPromise]);
|
|
219
|
+
}
|
|
220
|
+
return await runFn(payload, { ctx, init, signal });
|
|
221
|
+
}, {
|
|
222
|
+
attributes: { [semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-fn-run" },
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
async #callOnWaitFunctions(wait, payload, ctx, initOutput, signal) {
|
|
227
|
+
const globalWaitHooks = index_js_1.lifecycleHooks.getGlobalWaitHooks();
|
|
228
|
+
const taskWaitHook = index_js_1.lifecycleHooks.getTaskWaitHook(this.task.id);
|
|
229
|
+
if (globalWaitHooks.length === 0 && !taskWaitHook) {
|
|
230
|
+
return;
|
|
178
231
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
232
|
+
const result = await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "onWait", async () => {
|
|
233
|
+
for (const hook of globalWaitHooks) {
|
|
234
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onWait()", async (span) => {
|
|
235
|
+
await hook.fn({ payload, ctx, signal, task: this.task.id, wait, init: initOutput });
|
|
236
|
+
}, {
|
|
237
|
+
attributes: {
|
|
238
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onWait",
|
|
239
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
240
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
241
|
+
},
|
|
242
|
+
}));
|
|
243
|
+
if (hookError) {
|
|
244
|
+
throw hookError;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (taskWaitHook) {
|
|
248
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onWait()", async (span) => {
|
|
249
|
+
await taskWaitHook({
|
|
250
|
+
payload,
|
|
251
|
+
ctx,
|
|
252
|
+
signal,
|
|
253
|
+
task: this.task.id,
|
|
254
|
+
wait,
|
|
255
|
+
init: initOutput,
|
|
256
|
+
});
|
|
257
|
+
}, {
|
|
258
|
+
attributes: {
|
|
259
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onWait",
|
|
260
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
261
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
262
|
+
},
|
|
263
|
+
}));
|
|
264
|
+
if (hookError) {
|
|
265
|
+
throw hookError;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
183
268
|
});
|
|
184
269
|
}
|
|
185
|
-
async #
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
189
|
-
return
|
|
270
|
+
async #callOnResumeFunctions(wait, payload, ctx, initOutput, signal) {
|
|
271
|
+
const globalResumeHooks = index_js_1.lifecycleHooks.getGlobalResumeHooks();
|
|
272
|
+
const taskResumeHook = index_js_1.lifecycleHooks.getTaskResumeHook(this.task.id);
|
|
273
|
+
if (globalResumeHooks.length === 0 && !taskResumeHook) {
|
|
274
|
+
return;
|
|
190
275
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
276
|
+
const result = await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "onResume", async () => {
|
|
277
|
+
for (const hook of globalResumeHooks) {
|
|
278
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onResume()", async (span) => {
|
|
279
|
+
await hook.fn({ payload, ctx, signal, task: this.task.id, wait, init: initOutput });
|
|
280
|
+
}, {
|
|
281
|
+
attributes: {
|
|
282
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onResume",
|
|
283
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
284
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
285
|
+
},
|
|
286
|
+
}));
|
|
287
|
+
if (hookError) {
|
|
288
|
+
throw hookError;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (taskResumeHook) {
|
|
292
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onResume()", async (span) => {
|
|
293
|
+
await taskResumeHook({
|
|
294
|
+
payload,
|
|
295
|
+
ctx,
|
|
296
|
+
signal,
|
|
297
|
+
task: this.task.id,
|
|
298
|
+
wait,
|
|
299
|
+
init: initOutput,
|
|
300
|
+
});
|
|
301
|
+
}, {
|
|
302
|
+
attributes: {
|
|
303
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onResume",
|
|
304
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
305
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
306
|
+
},
|
|
307
|
+
}));
|
|
308
|
+
if (hookError) {
|
|
309
|
+
throw hookError;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
197
312
|
});
|
|
198
313
|
}
|
|
199
|
-
async #
|
|
200
|
-
const
|
|
201
|
-
|
|
314
|
+
async #callInitFunctions(payload, ctx, signal) {
|
|
315
|
+
const globalInitHooks = index_js_1.lifecycleHooks.getGlobalInitHooks();
|
|
316
|
+
const taskInitHook = index_js_1.lifecycleHooks.getTaskInitHook(this.task.id);
|
|
317
|
+
if (globalInitHooks.length === 0 && !taskInitHook) {
|
|
202
318
|
return {};
|
|
203
319
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
[
|
|
209
|
-
|
|
320
|
+
const result = await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "init", async () => {
|
|
321
|
+
// Store global hook results in an array
|
|
322
|
+
const globalResults = [];
|
|
323
|
+
for (const hook of globalInitHooks) {
|
|
324
|
+
const [hookError, result] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("init()", async (span) => {
|
|
325
|
+
const result = await hook.fn({ payload, ctx, signal, task: this.task.id });
|
|
326
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
327
|
+
span.setAttributes((0, index_js_1.flattenAttributes)(result));
|
|
328
|
+
return result;
|
|
329
|
+
}
|
|
330
|
+
return {};
|
|
331
|
+
}, {
|
|
332
|
+
attributes: {
|
|
333
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-init",
|
|
334
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
335
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
336
|
+
},
|
|
337
|
+
}));
|
|
338
|
+
if (hookError) {
|
|
339
|
+
throw hookError;
|
|
340
|
+
}
|
|
341
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
342
|
+
globalResults.push(result);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Merge all global results into a single object
|
|
346
|
+
const mergedGlobalResults = Object.assign({}, ...globalResults);
|
|
347
|
+
if (taskInitHook) {
|
|
348
|
+
const [hookError, taskResult] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("init()", async (span) => {
|
|
349
|
+
const result = await taskInitHook({ payload, ctx, signal, task: this.task.id });
|
|
350
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
351
|
+
span.setAttributes((0, index_js_1.flattenAttributes)(result));
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
return {};
|
|
355
|
+
}, {
|
|
356
|
+
attributes: {
|
|
357
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-init",
|
|
358
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
359
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
360
|
+
},
|
|
361
|
+
}));
|
|
362
|
+
if (hookError) {
|
|
363
|
+
throw hookError;
|
|
364
|
+
}
|
|
365
|
+
// Only merge if taskResult is an object
|
|
366
|
+
if (taskResult && typeof taskResult === "object" && !Array.isArray(taskResult)) {
|
|
367
|
+
return { ...mergedGlobalResults, ...taskResult };
|
|
368
|
+
}
|
|
369
|
+
// If taskResult isn't an object, return global results
|
|
370
|
+
return mergedGlobalResults;
|
|
371
|
+
}
|
|
372
|
+
return mergedGlobalResults;
|
|
210
373
|
});
|
|
374
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
375
|
+
return result;
|
|
376
|
+
}
|
|
377
|
+
return;
|
|
211
378
|
}
|
|
212
379
|
async #callOnSuccessFunctions(payload, output, ctx, initOutput, signal) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
async #callOnSuccessFunction(onSuccessFn, name, payload, output, ctx, initOutput, signal) {
|
|
217
|
-
if (!onSuccessFn) {
|
|
380
|
+
const globalSuccessHooks = index_js_1.lifecycleHooks.getGlobalSuccessHooks();
|
|
381
|
+
const taskSuccessHook = index_js_1.lifecycleHooks.getTaskSuccessHook(this.task.id);
|
|
382
|
+
if (globalSuccessHooks.length === 0 && !taskSuccessHook) {
|
|
218
383
|
return;
|
|
219
384
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
385
|
+
return await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "success", async () => {
|
|
386
|
+
for (const hook of globalSuccessHooks) {
|
|
387
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onSuccess()", async (span) => {
|
|
388
|
+
await hook.fn({
|
|
389
|
+
payload,
|
|
390
|
+
output,
|
|
391
|
+
ctx,
|
|
392
|
+
signal,
|
|
393
|
+
task: this.task.id,
|
|
394
|
+
init: initOutput,
|
|
395
|
+
});
|
|
396
|
+
}, {
|
|
397
|
+
attributes: {
|
|
398
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onSuccess",
|
|
399
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
400
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
401
|
+
},
|
|
402
|
+
}));
|
|
403
|
+
if (hookError) {
|
|
404
|
+
throw hookError;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (taskSuccessHook) {
|
|
408
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onSuccess()", async (span) => {
|
|
409
|
+
await taskSuccessHook({
|
|
410
|
+
payload,
|
|
411
|
+
output,
|
|
412
|
+
ctx,
|
|
413
|
+
signal,
|
|
414
|
+
task: this.task.id,
|
|
415
|
+
init: initOutput,
|
|
416
|
+
});
|
|
417
|
+
}, {
|
|
418
|
+
attributes: {
|
|
419
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onSuccess",
|
|
420
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
421
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
422
|
+
},
|
|
423
|
+
}));
|
|
424
|
+
if (hookError) {
|
|
425
|
+
throw hookError;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
});
|
|
232
429
|
}
|
|
233
430
|
async #callOnFailureFunctions(payload, error, ctx, initOutput, signal) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
async #callOnFailureFunction(onFailureFn, name, payload, error, ctx, initOutput, signal) {
|
|
238
|
-
if (!onFailureFn) {
|
|
431
|
+
const globalFailureHooks = index_js_1.lifecycleHooks.getGlobalFailureHooks();
|
|
432
|
+
const taskFailureHook = index_js_1.lifecycleHooks.getTaskFailureHook(this.task.id);
|
|
433
|
+
if (globalFailureHooks.length === 0 && !taskFailureHook) {
|
|
239
434
|
return;
|
|
240
435
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
436
|
+
return await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "failure", async () => {
|
|
437
|
+
for (const hook of globalFailureHooks) {
|
|
438
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onFailure()", async (span) => {
|
|
439
|
+
await hook.fn({
|
|
440
|
+
payload,
|
|
441
|
+
error,
|
|
442
|
+
ctx,
|
|
443
|
+
signal,
|
|
444
|
+
task: this.task.id,
|
|
445
|
+
init: initOutput,
|
|
446
|
+
});
|
|
447
|
+
}, {
|
|
448
|
+
attributes: {
|
|
449
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onFailure",
|
|
450
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
451
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
452
|
+
},
|
|
453
|
+
}));
|
|
454
|
+
if (hookError) {
|
|
455
|
+
throw hookError;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (taskFailureHook) {
|
|
459
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onFailure()", async (span) => {
|
|
460
|
+
await taskFailureHook({
|
|
461
|
+
payload,
|
|
462
|
+
error,
|
|
463
|
+
ctx,
|
|
464
|
+
signal,
|
|
465
|
+
task: this.task.id,
|
|
466
|
+
init: initOutput,
|
|
467
|
+
});
|
|
468
|
+
}, {
|
|
469
|
+
attributes: {
|
|
470
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onFailure",
|
|
471
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
472
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
473
|
+
},
|
|
474
|
+
}));
|
|
475
|
+
if (hookError) {
|
|
476
|
+
throw hookError;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
});
|
|
253
480
|
}
|
|
254
481
|
async #parsePayload(payload) {
|
|
255
482
|
if (!this.task.fns.parsePayload) {
|
|
256
483
|
return payload;
|
|
257
484
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
catch (e) {
|
|
262
|
-
throw new errors_js_1.TaskPayloadParsedError(e);
|
|
485
|
+
const [parseError, result] = await (0, tryCatch_js_1.tryCatch)(this.task.fns.parsePayload(payload));
|
|
486
|
+
if (parseError) {
|
|
487
|
+
throw new errors_js_1.TaskPayloadParsedError(parseError);
|
|
263
488
|
}
|
|
489
|
+
return result;
|
|
264
490
|
}
|
|
265
|
-
async #callOnStartFunctions(payload, ctx, signal) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
async #callOnStartFunction(onStartFn, name, payload, ctx, initOutput, signal) {
|
|
270
|
-
if (!onStartFn) {
|
|
491
|
+
async #callOnStartFunctions(payload, ctx, initOutput, signal) {
|
|
492
|
+
const globalStartHooks = index_js_1.lifecycleHooks.getGlobalStartHooks();
|
|
493
|
+
const taskStartHook = index_js_1.lifecycleHooks.getTaskStartHook(this.task.id);
|
|
494
|
+
if (globalStartHooks.length === 0 && !taskStartHook) {
|
|
271
495
|
return;
|
|
272
496
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
497
|
+
return await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "start", async () => {
|
|
498
|
+
for (const hook of globalStartHooks) {
|
|
499
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onStart()", async (span) => {
|
|
500
|
+
await hook.fn({ payload, ctx, signal, task: this.task.id, init: initOutput });
|
|
501
|
+
}, {
|
|
502
|
+
attributes: {
|
|
503
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onStart",
|
|
504
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
505
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
506
|
+
},
|
|
507
|
+
}));
|
|
508
|
+
if (hookError) {
|
|
509
|
+
throw hookError;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (taskStartHook) {
|
|
513
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onStart()", async (span) => {
|
|
514
|
+
await taskStartHook({
|
|
515
|
+
payload,
|
|
516
|
+
ctx,
|
|
517
|
+
signal,
|
|
518
|
+
task: this.task.id,
|
|
519
|
+
init: initOutput,
|
|
520
|
+
});
|
|
521
|
+
}, {
|
|
522
|
+
attributes: {
|
|
523
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onStart",
|
|
524
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
525
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
526
|
+
},
|
|
527
|
+
}));
|
|
528
|
+
if (hookError) {
|
|
529
|
+
throw hookError;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
});
|
|
285
533
|
}
|
|
286
|
-
async #
|
|
287
|
-
|
|
288
|
-
|
|
534
|
+
async #cleanupAndWaitUntil(payload, ctx, initOutput, signal) {
|
|
535
|
+
await this.#callCleanupFunctions(payload, ctx, initOutput, signal);
|
|
536
|
+
await this.#blockForWaitUntil();
|
|
537
|
+
}
|
|
538
|
+
async #callCleanupFunctions(payload, ctx, initOutput, signal) {
|
|
539
|
+
const globalCleanupHooks = index_js_1.lifecycleHooks.getGlobalCleanupHooks();
|
|
540
|
+
const taskCleanupHook = index_js_1.lifecycleHooks.getTaskCleanupHook(this.task.id);
|
|
541
|
+
if (globalCleanupHooks.length === 0 && !taskCleanupHook) {
|
|
289
542
|
return;
|
|
290
543
|
}
|
|
291
|
-
return
|
|
292
|
-
|
|
544
|
+
return await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "cleanup", async () => {
|
|
545
|
+
for (const hook of globalCleanupHooks) {
|
|
546
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("cleanup()", async (span) => {
|
|
547
|
+
await hook.fn({
|
|
548
|
+
payload,
|
|
549
|
+
ctx,
|
|
550
|
+
signal,
|
|
551
|
+
task: this.task.id,
|
|
552
|
+
init: initOutput,
|
|
553
|
+
});
|
|
554
|
+
}, {
|
|
555
|
+
attributes: {
|
|
556
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-cleanup",
|
|
557
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
558
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
559
|
+
},
|
|
560
|
+
}));
|
|
561
|
+
if (hookError) {
|
|
562
|
+
throw hookError;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (taskCleanupHook) {
|
|
566
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("cleanup()", async (span) => {
|
|
567
|
+
await taskCleanupHook({
|
|
568
|
+
payload,
|
|
569
|
+
ctx,
|
|
570
|
+
signal,
|
|
571
|
+
task: this.task.id,
|
|
572
|
+
init: initOutput,
|
|
573
|
+
});
|
|
574
|
+
}, {
|
|
575
|
+
attributes: {
|
|
576
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-cleanup",
|
|
577
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
578
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
579
|
+
},
|
|
580
|
+
}));
|
|
581
|
+
if (hookError) {
|
|
582
|
+
throw hookError;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
293
585
|
});
|
|
294
586
|
}
|
|
295
587
|
async #blockForWaitUntil() {
|
|
@@ -300,103 +592,212 @@ class TaskExecutor {
|
|
|
300
592
|
return await index_js_1.waitUntil.blockUntilSettled(60_000);
|
|
301
593
|
}, {
|
|
302
594
|
attributes: {
|
|
303
|
-
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "clock",
|
|
595
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "tabler-clock",
|
|
596
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
304
597
|
},
|
|
305
598
|
});
|
|
306
599
|
}
|
|
307
600
|
async #handleError(execution, error, payload, ctx, init, signal) {
|
|
308
|
-
const retriesConfig = this.
|
|
601
|
+
const retriesConfig = this._retries;
|
|
309
602
|
const retry = this.task.retry ?? retriesConfig?.default;
|
|
310
|
-
|
|
311
|
-
|
|
603
|
+
// Early exit conditions that prevent retrying
|
|
604
|
+
if ((0, errors_js_1.isInternalError)(error) && error.skipRetrying) {
|
|
605
|
+
return { status: "skipped", error };
|
|
312
606
|
}
|
|
313
607
|
if (error instanceof Error &&
|
|
314
608
|
(error.name === "AbortTaskRunError" || error.name === "TaskPayloadParsedError")) {
|
|
315
609
|
return { status: "skipped" };
|
|
316
610
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
611
|
+
// Calculate default retry delay if retry config exists
|
|
612
|
+
let defaultDelay;
|
|
613
|
+
if (retry) {
|
|
614
|
+
if (execution.run.maxAttempts) {
|
|
615
|
+
retry.maxAttempts = Math.max(execution.run.maxAttempts, 1);
|
|
616
|
+
}
|
|
617
|
+
defaultDelay = (0, retries_js_1.calculateNextRetryDelay)(retry, execution.attempt.number);
|
|
618
|
+
// Handle rate limit errors
|
|
619
|
+
if (defaultDelay &&
|
|
620
|
+
error instanceof Error &&
|
|
621
|
+
error.name === "TriggerApiError" &&
|
|
622
|
+
error.status === 429) {
|
|
623
|
+
const rateLimitError = error;
|
|
624
|
+
defaultDelay = rateLimitError.millisecondsUntilReset;
|
|
625
|
+
}
|
|
330
626
|
}
|
|
627
|
+
const defaultRetryResult = typeof defaultDelay === "undefined"
|
|
628
|
+
? { status: "noop" }
|
|
629
|
+
: {
|
|
630
|
+
status: "retry",
|
|
631
|
+
retry: { timestamp: Date.now() + defaultDelay, delay: defaultDelay },
|
|
632
|
+
};
|
|
633
|
+
// Check if retries are enabled in dev environment
|
|
331
634
|
if (execution.environment.type === "DEVELOPMENT" &&
|
|
332
635
|
typeof retriesConfig?.enabledInDev === "boolean" &&
|
|
333
636
|
!retriesConfig.enabledInDev) {
|
|
334
637
|
return { status: "skipped" };
|
|
335
638
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
639
|
+
const taskCatchErrorHook = index_js_1.lifecycleHooks.getTaskCatchErrorHook(this.task.id);
|
|
640
|
+
const globalCatchErrorHooks = index_js_1.lifecycleHooks.getGlobalCatchErrorHooks();
|
|
641
|
+
if (globalCatchErrorHooks.length === 0 && !taskCatchErrorHook) {
|
|
642
|
+
return defaultRetryResult;
|
|
643
|
+
}
|
|
644
|
+
return this._tracer.startActiveSpan("catchError", async (span) => {
|
|
645
|
+
// Try task-specific catch error hook first
|
|
646
|
+
if (taskCatchErrorHook) {
|
|
647
|
+
const result = await taskCatchErrorHook({
|
|
648
|
+
payload,
|
|
649
|
+
error,
|
|
339
650
|
ctx,
|
|
340
651
|
init,
|
|
341
652
|
retry,
|
|
342
|
-
retryDelayInMs:
|
|
343
|
-
retryAt:
|
|
653
|
+
retryDelayInMs: defaultDelay,
|
|
654
|
+
retryAt: defaultDelay ? new Date(Date.now() + defaultDelay) : undefined,
|
|
344
655
|
signal,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
retry,
|
|
351
|
-
retryDelayInMs: delay,
|
|
352
|
-
retryAt: delay ? new Date(Date.now() + delay) : undefined,
|
|
353
|
-
signal,
|
|
354
|
-
})
|
|
355
|
-
: undefined;
|
|
356
|
-
// If handleErrorResult
|
|
357
|
-
if (!handleErrorResult) {
|
|
358
|
-
return typeof delay === "undefined"
|
|
359
|
-
? { status: "noop" }
|
|
360
|
-
: { status: "retry", retry: { timestamp: Date.now() + delay, delay } };
|
|
656
|
+
task: this.task.id,
|
|
657
|
+
});
|
|
658
|
+
if (result) {
|
|
659
|
+
return this.#processHandleErrorResult(result, execution.attempt.number, defaultDelay);
|
|
660
|
+
}
|
|
361
661
|
}
|
|
362
|
-
|
|
363
|
-
|
|
662
|
+
// Try global catch error hooks in order
|
|
663
|
+
for (const hook of globalCatchErrorHooks) {
|
|
664
|
+
const result = await hook.fn({
|
|
665
|
+
payload,
|
|
666
|
+
error,
|
|
667
|
+
ctx,
|
|
668
|
+
init,
|
|
669
|
+
retry,
|
|
670
|
+
retryDelayInMs: defaultDelay,
|
|
671
|
+
retryAt: defaultDelay ? new Date(Date.now() + defaultDelay) : undefined,
|
|
672
|
+
signal,
|
|
673
|
+
task: this.task.id,
|
|
674
|
+
});
|
|
675
|
+
if (result) {
|
|
676
|
+
return this.#processHandleErrorResult(result, execution.attempt.number, defaultDelay);
|
|
677
|
+
}
|
|
364
678
|
}
|
|
365
|
-
|
|
366
|
-
|
|
679
|
+
// If no hooks handled the error, use default retry behavior
|
|
680
|
+
return defaultRetryResult;
|
|
681
|
+
}, {
|
|
682
|
+
attributes: {
|
|
683
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-catchError",
|
|
684
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
685
|
+
},
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
// Helper method to process handle error results
|
|
689
|
+
#processHandleErrorResult(result, attemptNumber, defaultDelay) {
|
|
690
|
+
if (result.skipRetrying) {
|
|
691
|
+
return { status: "skipped", error: result.error };
|
|
692
|
+
}
|
|
693
|
+
if (typeof result.retryAt !== "undefined") {
|
|
694
|
+
return {
|
|
695
|
+
status: "retry",
|
|
696
|
+
retry: {
|
|
697
|
+
timestamp: result.retryAt.getTime(),
|
|
698
|
+
delay: result.retryAt.getTime() - Date.now(),
|
|
699
|
+
},
|
|
700
|
+
error: result.error,
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
if (typeof result.retryDelayInMs === "number") {
|
|
704
|
+
return {
|
|
705
|
+
status: "retry",
|
|
706
|
+
retry: {
|
|
707
|
+
timestamp: Date.now() + result.retryDelayInMs,
|
|
708
|
+
delay: result.retryDelayInMs,
|
|
709
|
+
},
|
|
710
|
+
error: result.error,
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
if (result.retry && typeof result.retry === "object") {
|
|
714
|
+
const delay = (0, retries_js_1.calculateNextRetryDelay)(result.retry, attemptNumber);
|
|
715
|
+
return typeof delay === "undefined"
|
|
716
|
+
? { status: "noop", error: result.error }
|
|
717
|
+
: {
|
|
367
718
|
status: "retry",
|
|
368
|
-
retry: {
|
|
369
|
-
|
|
370
|
-
delay: handleErrorResult.retryAt.getTime() - Date.now(),
|
|
371
|
-
},
|
|
372
|
-
error: handleErrorResult.error,
|
|
719
|
+
retry: { timestamp: Date.now() + delay, delay },
|
|
720
|
+
error: result.error,
|
|
373
721
|
};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
722
|
+
}
|
|
723
|
+
return { status: "noop", error: result.error };
|
|
724
|
+
}
|
|
725
|
+
async #callOnCompleteFunctions(payload, result, ctx, initOutput, signal) {
|
|
726
|
+
const globalCompleteHooks = index_js_1.lifecycleHooks.getGlobalCompleteHooks();
|
|
727
|
+
const taskCompleteHook = index_js_1.lifecycleHooks.getTaskCompleteHook(this.task.id);
|
|
728
|
+
if (globalCompleteHooks.length === 0 && !taskCompleteHook) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
return await run_timeline_metrics_api_js_1.runTimelineMetrics.measureMetric("trigger.dev/execution", "complete", async () => {
|
|
732
|
+
for (const hook of globalCompleteHooks) {
|
|
733
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onComplete()", async (span) => {
|
|
734
|
+
await hook.fn({
|
|
735
|
+
payload,
|
|
736
|
+
result,
|
|
737
|
+
ctx,
|
|
738
|
+
signal,
|
|
739
|
+
task: this.task.id,
|
|
740
|
+
init: initOutput,
|
|
741
|
+
});
|
|
742
|
+
}, {
|
|
743
|
+
attributes: {
|
|
744
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onComplete",
|
|
745
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
746
|
+
...this.#lifecycleHookAccessoryAttributes(hook.name),
|
|
381
747
|
},
|
|
382
|
-
|
|
383
|
-
|
|
748
|
+
}));
|
|
749
|
+
if (hookError) {
|
|
750
|
+
throw hookError;
|
|
751
|
+
}
|
|
384
752
|
}
|
|
385
|
-
if (
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
753
|
+
if (taskCompleteHook) {
|
|
754
|
+
const [hookError] = await (0, tryCatch_js_1.tryCatch)(this._tracer.startActiveSpan("onComplete()", async (span) => {
|
|
755
|
+
await taskCompleteHook({
|
|
756
|
+
payload,
|
|
757
|
+
result,
|
|
758
|
+
ctx,
|
|
759
|
+
signal,
|
|
760
|
+
task: this.task.id,
|
|
761
|
+
init: initOutput,
|
|
762
|
+
});
|
|
763
|
+
}, {
|
|
764
|
+
attributes: {
|
|
765
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.STYLE_ICON]: "task-hook-onComplete",
|
|
766
|
+
[semanticInternalAttributes_js_1.SemanticInternalAttributes.COLLAPSED]: true,
|
|
767
|
+
...this.#lifecycleHookAccessoryAttributes("task"),
|
|
768
|
+
},
|
|
769
|
+
}));
|
|
770
|
+
if (hookError) {
|
|
771
|
+
throw hookError;
|
|
772
|
+
}
|
|
394
773
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
#internalErrorResult(execution, code, error) {
|
|
777
|
+
return {
|
|
778
|
+
ok: false,
|
|
779
|
+
id: execution.run.id,
|
|
780
|
+
error: {
|
|
781
|
+
type: "INTERNAL_ERROR",
|
|
782
|
+
code,
|
|
783
|
+
message: error instanceof Error
|
|
784
|
+
? `${error.name}: ${error.message}`
|
|
785
|
+
: typeof error === "string"
|
|
786
|
+
? error
|
|
787
|
+
: undefined,
|
|
788
|
+
stackTrace: error instanceof Error ? error.stack : undefined,
|
|
399
789
|
},
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
#lifecycleHookAccessoryAttributes(name) {
|
|
793
|
+
return (0, index_js_1.accessoryAttributes)({
|
|
794
|
+
items: [
|
|
795
|
+
{
|
|
796
|
+
text: name ?? "global",
|
|
797
|
+
variant: "normal",
|
|
798
|
+
},
|
|
799
|
+
],
|
|
800
|
+
style: "codepath",
|
|
400
801
|
});
|
|
401
802
|
}
|
|
402
803
|
}
|