bunqueue-client 0.1.8 → 0.2.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/CHANGELOG.md +162 -0
- package/LEGACY.md +460 -0
- package/README.md +204 -349
- package/dist/ack-batcher.js +7 -67
- package/dist/canonical-manifest.json +930 -0
- package/dist/chunk-b967v3w3.js +79 -0
- package/dist/chunk-fekm0ma6.js +110 -0
- package/dist/chunk-jxkszwqp.js +573 -0
- package/dist/embedded.js +16418 -0
- package/dist/frame.js +14 -57
- package/dist/index.d.ts +1 -27
- package/dist/index.js +10905 -16
- package/dist/legacy.d.ts +1 -0
- package/dist/legacy.js +2081 -0
- package/dist/{ack-batcher.d.ts → types/sdk/typescript/src/ack-batcher.d.ts} +3 -3
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/aging.d.ts +2 -2
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/batch.d.ts +2 -2
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/bunqueue-api.d.ts +5 -5
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/bunqueue.d.ts +13 -13
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/circuit-breaker.d.ts +2 -2
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/dedup-debounce.d.ts +2 -2
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/dlq-rate-limit.d.ts +2 -2
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/rate-gate.d.ts +1 -1
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/retry.d.ts +1 -1
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/triggers.d.ts +3 -3
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/ttl.d.ts +1 -1
- package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/types.d.ts +4 -4
- package/dist/types/sdk/typescript/src/canonical-transport/bun-sqlite-types.d.ts +21 -0
- package/dist/{connection-pool.d.ts → types/sdk/typescript/src/connection-pool.d.ts} +1 -1
- package/dist/{connection-types.d.ts → types/sdk/typescript/src/connection-types.d.ts} +1 -1
- package/dist/{connection.d.ts → types/sdk/typescript/src/connection.d.ts} +6 -19
- package/dist/{errors.d.ts → types/sdk/typescript/src/errors.d.ts} +3 -0
- package/dist/types/sdk/typescript/src/flow-commit.d.ts +5 -0
- package/dist/types/sdk/typescript/src/flow-plan-legacy.d.ts +13 -0
- package/dist/types/sdk/typescript/src/flow-plan.d.ts +29 -0
- package/dist/{flow-types.d.ts → types/sdk/typescript/src/flow-types.d.ts} +7 -4
- package/dist/{flow.d.ts → types/sdk/typescript/src/flow.d.ts} +6 -10
- package/dist/{frame.d.ts → types/sdk/typescript/src/frame.d.ts} +1 -1
- package/dist/types/sdk/typescript/src/index.d.ts +10 -0
- package/dist/{job.d.ts → types/sdk/typescript/src/job.d.ts} +4 -3
- package/dist/types/sdk/typescript/src/legacy.d.ts +27 -0
- package/dist/{observability.d.ts → types/sdk/typescript/src/observability.d.ts} +14 -0
- package/dist/{queue-admin.d.ts → types/sdk/typescript/src/queue-admin.d.ts} +3 -4
- package/dist/{queue-control.d.ts → types/sdk/typescript/src/queue-control.d.ts} +7 -6
- package/dist/{queue-query.d.ts → types/sdk/typescript/src/queue-query.d.ts} +3 -3
- package/dist/{queue.d.ts → types/sdk/typescript/src/queue.d.ts} +8 -8
- package/dist/{responses.d.ts → types/sdk/typescript/src/responses.d.ts} +2 -2
- package/dist/types/sdk/typescript/src/serialization.d.ts +10 -0
- package/dist/{socket-factory.d.ts → types/sdk/typescript/src/socket-factory.d.ts} +1 -1
- package/dist/types/sdk/typescript/src/terminal-outcome.d.ts +8 -0
- package/dist/{types.d.ts → types/sdk/typescript/src/types.d.ts} +5 -2
- package/dist/{worker-base.d.ts → types/sdk/typescript/src/worker-base.d.ts} +6 -6
- package/dist/types/sdk/typescript/src/worker-slot-signal.d.ts +6 -0
- package/dist/{worker-types.d.ts → types/sdk/typescript/src/worker-types.d.ts} +3 -3
- package/dist/{worker.d.ts → types/sdk/typescript/src/worker.d.ts} +3 -2
- package/dist/types/src/application/background/dlq.d.ts +2 -0
- package/dist/types/src/application/background/lifecycle.d.ts +4 -0
- package/dist/types/src/application/background/recovery/active.d.ts +5 -0
- package/dist/types/src/application/background/recovery/index.d.ts +2 -0
- package/dist/types/src/application/background/recovery/pending.d.ts +3 -0
- package/dist/types/src/application/background/recovery/restore.d.ts +5 -0
- package/dist/types/src/application/background/recovery/shared.d.ts +6 -0
- package/dist/types/src/application/background/timeouts.d.ts +25 -0
- package/dist/types/src/application/backgroundTasks.d.ts +7 -0
- package/dist/types/src/application/cleanupTasks.d.ts +10 -0
- package/dist/types/src/application/clientTracking.d.ts +44 -0
- package/dist/types/src/application/completedCleanup.d.ts +34 -0
- package/dist/types/src/application/completedRetry.d.ts +21 -0
- package/dist/types/src/application/contextFactory.d.ts +49 -0
- package/dist/types/src/application/dependencyCompletions.d.ts +63 -0
- package/dist/types/src/application/dependencyProcessor.d.ts +15 -0
- package/dist/types/src/application/dependencyResultTracker.d.ts +18 -0
- package/dist/types/src/application/dlqManager.d.ts +49 -0
- package/dist/types/src/application/dlqRetry.d.ts +12 -0
- package/dist/types/src/application/emptyQueueCleanup.d.ts +3 -0
- package/dist/types/src/application/eventsManager.d.ts +50 -0
- package/dist/types/src/application/flowFailureRecovery.d.ts +20 -0
- package/dist/types/src/application/flowParentBackpatch.d.ts +27 -0
- package/dist/types/src/application/jobLogsManager.d.ts +21 -0
- package/dist/types/src/application/latencyTracker.d.ts +39 -0
- package/dist/types/src/application/lockManager.d.ts +15 -0
- package/dist/types/src/application/lockOperations.d.ts +38 -0
- package/dist/types/src/application/metricsExporter.d.ts +27 -0
- package/dist/types/src/application/monitoringChecks.d.ts +36 -0
- package/dist/types/src/application/operations/ack/batch.d.ts +8 -0
- package/dist/types/src/application/operations/ack/completion.d.ts +3 -0
- package/dist/types/src/application/operations/ack/failure.d.ts +3 -0
- package/dist/types/src/application/operations/ack.d.ts +5 -0
- package/dist/types/src/application/operations/ackHelpers.d.ts +36 -0
- package/dist/types/src/application/operations/customId.d.ts +51 -0
- package/dist/types/src/application/operations/flowPush.d.ts +9 -0
- package/dist/types/src/application/operations/flowTopologyValidation.d.ts +3 -0
- package/dist/types/src/application/operations/flowValidation.d.ts +3 -0
- package/dist/types/src/application/operations/jobClaim.d.ts +17 -0
- package/dist/types/src/application/operations/jobManagement.d.ts +43 -0
- package/dist/types/src/application/operations/jobMoveOperations.d.ts +9 -0
- package/dist/types/src/application/operations/jobPromotion.d.ts +7 -0
- package/dist/types/src/application/operations/jobStateTransitions.d.ts +15 -0
- package/dist/types/src/application/operations/parentLink.d.ts +36 -0
- package/dist/types/src/application/operations/parentLinkInput.d.ts +8 -0
- package/dist/types/src/application/operations/pull.d.ts +20 -0
- package/dist/types/src/application/operations/pullFinalization.d.ts +6 -0
- package/dist/types/src/application/operations/pullStateTransition.d.ts +51 -0
- package/dist/types/src/application/operations/push.d.ts +13 -0
- package/dist/types/src/application/operations/pushAdmission.d.ts +36 -0
- package/dist/types/src/application/operations/pushBatch.d.ts +4 -0
- package/dist/types/src/application/operations/pushContext.d.ts +48 -0
- package/dist/types/src/application/operations/pushDeduplication.d.ts +42 -0
- package/dist/types/src/application/operations/pushInsert.d.ts +39 -0
- package/dist/types/src/application/operations/pushLocks.d.ts +15 -0
- package/dist/types/src/application/operations/query/collect.d.ts +12 -0
- package/dist/types/src/application/operations/query/jobLookup.d.ts +9 -0
- package/dist/types/src/application/operations/query/pagination.d.ts +8 -0
- package/dist/types/src/application/operations/query/state.d.ts +4 -0
- package/dist/types/src/application/operations/queryOperations.d.ts +5 -0
- package/dist/types/src/application/operations/queueControl.d.ts +50 -0
- package/dist/types/src/application/prometheusOperationalMetrics.d.ts +31 -0
- package/dist/types/src/application/queue-manager/ack.d.ts +23 -0
- package/dist/types/src/application/queue-manager/configuration.d.ts +27 -0
- package/dist/types/src/application/queue-manager/context.d.ts +5 -0
- package/dist/types/src/application/queue-manager/control.d.ts +20 -0
- package/dist/types/src/application/queue-manager/delivery.d.ts +33 -0
- package/dist/types/src/application/queue-manager/dependencies.d.ts +8 -0
- package/dist/types/src/application/queue-manager/dependency-runtime.d.ts +8 -0
- package/dist/types/src/application/queue-manager/flow-failures.d.ts +18 -0
- package/dist/types/src/application/queue-manager/flow-options.d.ts +8 -0
- package/dist/types/src/application/queue-manager/job-management.d.ts +17 -0
- package/dist/types/src/application/queue-manager/lifecycle.d.ts +4 -0
- package/dist/types/src/application/queue-manager/limits.d.ts +58 -0
- package/dist/types/src/application/queue-manager/locks.d.ts +21 -0
- package/dist/types/src/application/queue-manager/observability.d.ts +16 -0
- package/dist/types/src/application/queue-manager/queries.d.ts +24 -0
- package/dist/types/src/application/queue-manager/repeat.d.ts +4 -0
- package/dist/types/src/application/queue-manager/services.d.ts +19 -0
- package/dist/types/src/application/queue-manager/state.d.ts +96 -0
- package/dist/types/src/application/queue-manager/stats.d.ts +28 -0
- package/dist/types/src/application/queueManager.d.ts +5 -0
- package/dist/types/src/application/queueStatsAggregator.d.ts +23 -0
- package/dist/types/src/application/queueTelemetryJournal.d.ts +24 -0
- package/dist/types/src/application/repeatJobs.d.ts +7 -0
- package/dist/types/src/application/stallDetection.d.ts +10 -0
- package/dist/types/src/application/statsManager.d.ts +59 -0
- package/dist/types/src/application/taskErrorTracking.d.ts +22 -0
- package/dist/types/src/application/throughputTracker.d.ts +34 -0
- package/dist/types/src/application/types/ack.d.ts +136 -0
- package/dist/types/src/application/types/background.d.ts +18 -0
- package/dist/types/src/application/types/config.d.ts +41 -0
- package/dist/types/src/application/types/contextFactory.d.ts +87 -0
- package/dist/types/src/application/types/contexts.d.ts +114 -0
- package/dist/types/src/application/types/index.d.ts +7 -0
- package/dist/types/src/application/types/query.d.ts +23 -0
- package/dist/types/src/application/types/queueManager.d.ts +98 -0
- package/dist/types/src/application/webhookManager.d.ts +47 -0
- package/dist/types/src/application/workerManager.d.ts +61 -0
- package/dist/types/src/client/bunqueue/aging.d.ts +16 -0
- package/dist/types/src/client/bunqueue/batch.d.ts +16 -0
- package/dist/types/src/client/bunqueue/cancellation.d.ts +21 -0
- package/dist/types/src/client/bunqueue/circuitBreaker.d.ts +21 -0
- package/dist/types/src/client/bunqueue/dedupDebounce.d.ts +12 -0
- package/dist/types/src/client/bunqueue/dlqRateLimit.d.ts +26 -0
- package/dist/types/src/client/bunqueue/retry.d.ts +8 -0
- package/dist/types/src/client/bunqueue/runtime.d.ts +35 -0
- package/dist/types/src/client/bunqueue/triggers.d.ts +17 -0
- package/dist/types/src/client/bunqueue/ttl.d.ts +17 -0
- package/dist/types/src/client/bunqueue/types.d.ts +147 -0
- package/dist/types/src/client/bunqueue.d.ts +73 -0
- package/dist/types/src/client/dlqConversion.d.ts +5 -0
- package/dist/types/src/client/errors.d.ts +24 -0
- package/dist/types/src/client/events.d.ts +85 -0
- package/dist/types/src/client/flow.d.ts +70 -0
- package/dist/types/src/client/flowAtomic.d.ts +9 -0
- package/dist/types/src/client/flowJobCoreMethods.d.ts +28 -0
- package/dist/types/src/client/flowJobDependencies.d.ts +7 -0
- package/dist/types/src/client/flowJobFactory.d.ts +24 -0
- package/dist/types/src/client/flowJobMoveMethods.d.ts +16 -0
- package/dist/types/src/client/flowJobTypes.d.ts +29 -0
- package/dist/types/src/client/flowLegacyPlan.d.ts +16 -0
- package/dist/types/src/client/flowOptions.d.ts +10 -0
- package/dist/types/src/client/flowPlan.d.ts +16 -0
- package/dist/types/src/client/flowPush.d.ts +27 -0
- package/dist/types/src/client/flowReader.d.ts +10 -0
- package/dist/types/src/client/flowResults.d.ts +11 -0
- package/dist/types/src/client/flowTypes.d.ts +77 -0
- package/dist/types/src/client/forwarder.d.ts +74 -0
- package/dist/types/src/client/groupId.d.ts +1 -0
- package/dist/types/src/client/index.d.ts +46 -0
- package/dist/types/src/client/jobConversion.d.ts +10 -0
- package/dist/types/src/client/jobConversionHelpers.d.ts +28 -0
- package/dist/types/src/client/jobConversionTypes.d.ts +88 -0
- package/dist/types/src/client/jobDeduplication.d.ts +6 -0
- package/dist/types/src/client/jobHelpers.d.ts +31 -0
- package/dist/types/src/client/legacyConnectionOptions.d.ts +8 -0
- package/dist/types/src/client/manager.d.ts +15 -0
- package/dist/types/src/client/pro.d.ts +9 -0
- package/dist/types/src/client/queue/addBatcher.d.ts +59 -0
- package/dist/types/src/client/queue/bullmqCompat.d.ts +57 -0
- package/dist/types/src/client/queue/deduplication.d.ts +14 -0
- package/dist/types/src/client/queue/dlq.d.ts +61 -0
- package/dist/types/src/client/queue/dlqJobMethods.d.ts +9 -0
- package/dist/types/src/client/queue/dlqOps.d.ts +26 -0
- package/dist/types/src/client/queue/dlqStats.d.ts +3 -0
- package/dist/types/src/client/queue/failWire.d.ts +17 -0
- package/dist/types/src/client/queue/helpers.d.ts +19 -0
- package/dist/types/src/client/queue/job-proxy/dependencies.d.ts +9 -0
- package/dist/types/src/client/queue/job-proxy/reflection.d.ts +2 -0
- package/dist/types/src/client/queue/job-proxy/simple.d.ts +3 -0
- package/dist/types/src/client/queue/job-proxy/tcp.d.ts +4 -0
- package/dist/types/src/client/queue/jobMetadata.d.ts +10 -0
- package/dist/types/src/client/queue/jobMove.d.ts +32 -0
- package/dist/types/src/client/queue/jobProxy.d.ts +4 -0
- package/dist/types/src/client/queue/operations/add/bulk.d.ts +7 -0
- package/dist/types/src/client/queue/operations/add/payload.d.ts +25 -0
- package/dist/types/src/client/queue/operations/add/single.d.ts +3 -0
- package/dist/types/src/client/queue/operations/add.d.ts +2 -0
- package/dist/types/src/client/queue/operations/control.d.ts +42 -0
- package/dist/types/src/client/queue/operations/counts.d.ts +48 -0
- package/dist/types/src/client/queue/operations/groups.d.ts +24 -0
- package/dist/types/src/client/queue/operations/management.d.ts +51 -0
- package/dist/types/src/client/queue/operations/query.d.ts +50 -0
- package/dist/types/src/client/queue/operations/queryStates.d.ts +13 -0
- package/dist/types/src/client/queue/operations/queryTcpPages.d.ts +14 -0
- package/dist/types/src/client/queue/queue.d.ts +12 -0
- package/dist/types/src/client/queue/rateLimit.d.ts +46 -0
- package/dist/types/src/client/queue/runtime/compatibility.d.ts +13 -0
- package/dist/types/src/client/queue/runtime/configuration.d.ts +46 -0
- package/dist/types/src/client/queue/runtime/connection.d.ts +6 -0
- package/dist/types/src/client/queue/runtime/control.d.ts +41 -0
- package/dist/types/src/client/queue/runtime/queries.d.ts +66 -0
- package/dist/types/src/client/queue/runtime/scheduling.d.ts +33 -0
- package/dist/types/src/client/queue/runtime/state.d.ts +101 -0
- package/dist/types/src/client/queue/scheduler.d.ts +58 -0
- package/dist/types/src/client/queue/schedulerPagination.d.ts +7 -0
- package/dist/types/src/client/queue/stall.d.ts +20 -0
- package/dist/types/src/client/queue/types/add.d.ts +40 -0
- package/dist/types/src/client/queue/types/contexts.d.ts +33 -0
- package/dist/types/src/client/queue/types/index.d.ts +3 -0
- package/dist/types/src/client/queue/types/job.d.ts +50 -0
- package/dist/types/src/client/queue/types/runtime.d.ts +35 -0
- package/dist/types/src/client/queue/workers.d.ts +36 -0
- package/dist/types/src/client/queue-events/tcpSubscription.d.ts +23 -0
- package/dist/types/src/client/queue.d.ts +5 -0
- package/dist/types/src/client/queueGroup.d.ts +51 -0
- package/dist/types/src/client/resolveToken.d.ts +10 -0
- package/dist/types/src/client/sandboxed/index.d.ts +7 -0
- package/dist/types/src/client/sandboxed/queueOps.d.ts +24 -0
- package/dist/types/src/client/sandboxed/runtime/dispatch.d.ts +13 -0
- package/dist/types/src/client/sandboxed/runtime/lifecycle.d.ts +20 -0
- package/dist/types/src/client/sandboxed/runtime/log.d.ts +1 -0
- package/dist/types/src/client/sandboxed/runtime/pool.d.ts +11 -0
- package/dist/types/src/client/sandboxed/runtime/recovery.d.ts +11 -0
- package/dist/types/src/client/sandboxed/runtime/state.d.ts +39 -0
- package/dist/types/src/client/sandboxed/types/index.d.ts +2 -0
- package/dist/types/src/client/sandboxed/types/options.d.ts +27 -0
- package/dist/types/src/client/sandboxed/types/process.d.ts +39 -0
- package/dist/types/src/client/sandboxed/worker.d.ts +4 -0
- package/dist/types/src/client/sandboxed/wrapper.d.ts +12 -0
- package/dist/types/src/client/sandboxedWorker.d.ts +6 -0
- package/dist/types/src/client/tcp/client.d.ts +6 -0
- package/dist/types/src/client/tcp/commandQueue.d.ts +23 -0
- package/dist/types/src/client/tcp/connection.d.ts +4 -0
- package/dist/types/src/client/tcp/errors.d.ts +6 -0
- package/dist/types/src/client/tcp/health.d.ts +60 -0
- package/dist/types/src/client/tcp/index.d.ts +11 -0
- package/dist/types/src/client/tcp/reconnect.d.ts +47 -0
- package/dist/types/src/client/tcp/runtime/commands.d.ts +9 -0
- package/dist/types/src/client/tcp/runtime/connectivity.d.ts +13 -0
- package/dist/types/src/client/tcp/runtime/health.d.ts +14 -0
- package/dist/types/src/client/tcp/runtime/lifecycle.d.ts +8 -0
- package/dist/types/src/client/tcp/runtime/state.d.ts +50 -0
- package/dist/types/src/client/tcp/shared.d.ts +12 -0
- package/dist/types/src/client/tcp/transport.d.ts +18 -0
- package/dist/types/src/client/tcp/types/command.d.ts +9 -0
- package/dist/types/src/client/tcp/types/connection.d.ts +31 -0
- package/dist/types/src/client/tcp/types/index.d.ts +5 -0
- package/dist/types/src/client/tcp/types/socket.d.ts +8 -0
- package/dist/types/src/client/tcp/types/tls.d.ts +4 -0
- package/dist/types/src/client/tcp/types.d.ts +2 -0
- package/dist/types/src/client/tcpClient.d.ts +6 -0
- package/dist/types/src/client/tcpPool.d.ts +69 -0
- package/dist/types/src/client/types/connection.d.ts +30 -0
- package/dist/types/src/client/types/dlq.d.ts +45 -0
- package/dist/types/src/client/types/events.d.ts +54 -0
- package/dist/types/src/client/types/flow.d.ts +22 -0
- package/dist/types/src/client/types/index.d.ts +10 -0
- package/dist/types/src/client/types/job.d.ts +131 -0
- package/dist/types/src/client/types/metrics.d.ts +1 -0
- package/dist/types/src/client/types/options.d.ts +70 -0
- package/dist/types/src/client/types/worker.d.ts +54 -0
- package/dist/types/src/client/types.d.ts +2 -0
- package/dist/types/src/client/worker/ackBatcher.d.ts +55 -0
- package/dist/types/src/client/worker/ackFrontier.d.ts +21 -0
- package/dist/types/src/client/worker/ackOutcome.d.ts +8 -0
- package/dist/types/src/client/worker/batchExecution.d.ts +14 -0
- package/dist/types/src/client/worker/constants.d.ts +7 -0
- package/dist/types/src/client/worker/groupConcurrency.d.ts +49 -0
- package/dist/types/src/client/worker/handlers/completion.d.ts +29 -0
- package/dist/types/src/client/worker/handlers/dependencies.d.ts +11 -0
- package/dist/types/src/client/worker/handlers/mutations.d.ts +23 -0
- package/dist/types/src/client/worker/handlers/queries.d.ts +15 -0
- package/dist/types/src/client/worker/jobParser.d.ts +9 -0
- package/dist/types/src/client/worker/processor.d.ts +11 -0
- package/dist/types/src/client/worker/processorHandlers.d.ts +4 -0
- package/dist/types/src/client/worker/processorOutcome.d.ts +14 -0
- package/dist/types/src/client/worker/processorResult.d.ts +2 -0
- package/dist/types/src/client/worker/runtime/buffer.d.ts +8 -0
- package/dist/types/src/client/worker/runtime/control.d.ts +28 -0
- package/dist/types/src/client/worker/runtime/execution.d.ts +16 -0
- package/dist/types/src/client/worker/runtime/lifecycle.d.ts +7 -0
- package/dist/types/src/client/worker/runtime/manual.d.ts +10 -0
- package/dist/types/src/client/worker/runtime/options.d.ts +5 -0
- package/dist/types/src/client/worker/runtime/polling.d.ts +14 -0
- package/dist/types/src/client/worker/runtime/state.d.ts +121 -0
- package/dist/types/src/client/worker/types/index.d.ts +5 -0
- package/dist/types/src/client/worker/types/manual.d.ts +7 -0
- package/dist/types/src/client/worker/types/options.d.ts +26 -0
- package/dist/types/src/client/worker/types/outcome.d.ts +23 -0
- package/dist/types/src/client/worker/types/processor.d.ts +25 -0
- package/dist/types/src/client/worker/types/transport.d.ts +11 -0
- package/dist/types/src/client/worker/worker.d.ts +6 -0
- package/dist/types/src/client/worker/workerHeartbeat.d.ts +15 -0
- package/dist/types/src/client/worker/workerPull.d.ts +24 -0
- package/dist/types/src/client/worker/workerRateLimiter.d.ts +51 -0
- package/dist/types/src/client/worker.d.ts +6 -0
- package/dist/types/src/client/workflow/admission.d.ts +45 -0
- package/dist/types/src/client/workflow/clock.d.ts +60 -0
- package/dist/types/src/client/workflow/compensationChild.d.ts +33 -0
- package/dist/types/src/client/workflow/compensationClaim.d.ts +11 -0
- package/dist/types/src/client/workflow/compensationPass.d.ts +17 -0
- package/dist/types/src/client/workflow/compensationSupport.d.ts +24 -0
- package/dist/types/src/client/workflow/compensator.d.ts +34 -0
- package/dist/types/src/client/workflow/definitionGuard.d.ts +11 -0
- package/dist/types/src/client/workflow/emitter.d.ts +17 -0
- package/dist/types/src/client/workflow/engine.d.ts +66 -0
- package/dist/types/src/client/workflow/eventTypes.d.ts +44 -0
- package/dist/types/src/client/workflow/executionFence.d.ts +15 -0
- package/dist/types/src/client/workflow/executionTypes.d.ts +133 -0
- package/dist/types/src/client/workflow/executor.d.ts +52 -0
- package/dist/types/src/client/workflow/executorLifecycle.d.ts +19 -0
- package/dist/types/src/client/workflow/executorNodes.d.ts +18 -0
- package/dist/types/src/client/workflow/executorQueue.d.ts +9 -0
- package/dist/types/src/client/workflow/forEachRunner.d.ts +4 -0
- package/dist/types/src/client/workflow/identity.d.ts +48 -0
- package/dist/types/src/client/workflow/index.d.ts +23 -0
- package/dist/types/src/client/workflow/loops.d.ts +11 -0
- package/dist/types/src/client/workflow/mapRunner.d.ts +4 -0
- package/dist/types/src/client/workflow/recovery.d.ts +32 -0
- package/dist/types/src/client/workflow/rollbackControl.d.ts +37 -0
- package/dist/types/src/client/workflow/runner.d.ts +23 -0
- package/dist/types/src/client/workflow/runnerTiming.d.ts +14 -0
- package/dist/types/src/client/workflow/stepTypes.d.ts +171 -0
- package/dist/types/src/client/workflow/store.d.ts +83 -0
- package/dist/types/src/client/workflow/storeCodec.d.ts +7 -0
- package/dist/types/src/client/workflow/storeExecutionCodec.d.ts +11 -0
- package/dist/types/src/client/workflow/storeListing.d.ts +11 -0
- package/dist/types/src/client/workflow/storeMaintenance.d.ts +4 -0
- package/dist/types/src/client/workflow/storeSignals.d.ts +70 -0
- package/dist/types/src/client/workflow/subWorkflowRunner.d.ts +14 -0
- package/dist/types/src/client/workflow/types.d.ts +4 -0
- package/dist/types/src/client/workflow/unwindPlan.d.ts +87 -0
- package/dist/types/src/client/workflow/waitFor.d.ts +56 -0
- package/dist/types/src/client/workflow/workflow.d.ts +70 -0
- package/dist/types/src/client/workflow/workflowDecisions.d.ts +11 -0
- package/dist/types/src/client/workflow/workflowDefinition.d.ts +16 -0
- package/dist/types/src/client/workflow/workflowIntrospection.d.ts +5 -0
- package/dist/types/src/client/workflow/workflowValidation.d.ts +44 -0
- package/dist/types/src/config/index.d.ts +9 -0
- package/dist/types/src/config/loader.d.ts +7 -0
- package/dist/types/src/config/resolve.d.ts +59 -0
- package/dist/types/src/config/types.d.ts +88 -0
- package/dist/types/src/domain/job/constants.d.ts +12 -0
- package/dist/types/src/domain/job/create.d.ts +2 -0
- package/dist/types/src/domain/job/groupFifoOrder.d.ts +9 -0
- package/dist/types/src/domain/job/ids.d.ts +7 -0
- package/dist/types/src/domain/job/locks.d.ts +4 -0
- package/dist/types/src/domain/job/payload.d.ts +18 -0
- package/dist/types/src/domain/job/state.d.ts +8 -0
- package/dist/types/src/domain/job/terminal.d.ts +3 -0
- package/dist/types/src/domain/queue/dependencyTracker.d.ts +78 -0
- package/dist/types/src/domain/queue/dlqShard.d.ts +66 -0
- package/dist/types/src/domain/queue/groupLimiterManager.d.ts +30 -0
- package/dist/types/src/domain/queue/groupScheduler.d.ts +31 -0
- package/dist/types/src/domain/queue/groupSchedulerOrder.d.ts +6 -0
- package/dist/types/src/domain/queue/limiterManager.d.ts +68 -0
- package/dist/types/src/domain/queue/priorityQueue.d.ts +54 -0
- package/dist/types/src/domain/queue/priorityQueueOrder.d.ts +3 -0
- package/dist/types/src/domain/queue/shard/dependencies.d.ts +11 -0
- package/dist/types/src/domain/queue/shard/dlq.d.ts +26 -0
- package/dist/types/src/domain/queue/shard/keys.d.ts +19 -0
- package/dist/types/src/domain/queue/shard/lifecycle.d.ts +10 -0
- package/dist/types/src/domain/queue/shard/limits.d.ts +47 -0
- package/dist/types/src/domain/queue/shard/metrics.d.ts +32 -0
- package/dist/types/src/domain/queue/shard/state.d.ts +40 -0
- package/dist/types/src/domain/queue/shard.d.ts +7 -0
- package/dist/types/src/domain/queue/shardCounters.d.ts +35 -0
- package/dist/types/src/domain/queue/temporalIndex.d.ts +24 -0
- package/dist/types/src/domain/queue/temporalManager.d.ts +72 -0
- package/dist/types/src/domain/queue/uniqueKeyManager.d.ts +33 -0
- package/dist/types/src/domain/queue/waiterManager.d.ts +18 -0
- package/dist/types/src/domain/response/builders.d.ts +15 -0
- package/dist/types/src/domain/types/command.d.ts +2 -0
- package/dist/types/src/domain/types/commands/base.d.ts +5 -0
- package/dist/types/src/domain/types/commands/core.d.ts +110 -0
- package/dist/types/src/domain/types/commands/cron.d.ts +36 -0
- package/dist/types/src/domain/types/commands/dashboard.d.ts +13 -0
- package/dist/types/src/domain/types/commands/dlq.d.ts +44 -0
- package/dist/types/src/domain/types/commands/extended.d.ts +63 -0
- package/dist/types/src/domain/types/commands/index.d.ts +12 -0
- package/dist/types/src/domain/types/commands/limits.d.ts +108 -0
- package/dist/types/src/domain/types/commands/management.d.ts +73 -0
- package/dist/types/src/domain/types/commands/monitoring.d.ts +49 -0
- package/dist/types/src/domain/types/commands/protocol.d.ts +20 -0
- package/dist/types/src/domain/types/commands/query.d.ts +46 -0
- package/dist/types/src/domain/types/commands/union.d.ts +13 -0
- package/dist/types/src/domain/types/commands/workers.d.ts +39 -0
- package/dist/types/src/domain/types/cron.d.ts +91 -0
- package/dist/types/src/domain/types/deduplication.d.ts +43 -0
- package/dist/types/src/domain/types/dlq.d.ts +136 -0
- package/dist/types/src/domain/types/flow.d.ts +25 -0
- package/dist/types/src/domain/types/group.d.ts +26 -0
- package/dist/types/src/domain/types/job.d.ts +8 -0
- package/dist/types/src/domain/types/jobs/model.d.ts +153 -0
- package/dist/types/src/domain/types/metrics.d.ts +16 -0
- package/dist/types/src/domain/types/priorityQueue.d.ts +13 -0
- package/dist/types/src/domain/types/protocol.d.ts +5 -0
- package/dist/types/src/domain/types/queue.d.ts +110 -0
- package/dist/types/src/domain/types/response.d.ts +3 -0
- package/dist/types/src/domain/types/responses/model.d.ts +152 -0
- package/dist/types/src/domain/types/shard.d.ts +4 -0
- package/dist/types/src/domain/types/stall.d.ts +48 -0
- package/dist/types/src/domain/types/webhook.d.ts +42 -0
- package/dist/types/src/domain/types/worker.d.ts +40 -0
- package/dist/types/src/infrastructure/backup/backupTelemetry.d.ts +30 -0
- package/dist/types/src/infrastructure/backup/s3BackupConfig.d.ts +80 -0
- package/dist/types/src/infrastructure/cloud/types/config.d.ts +18 -0
- package/dist/types/src/infrastructure/cloud/types/event.d.ts +14 -0
- package/dist/types/src/infrastructure/cloud/types/snapshot.d.ts +52 -0
- package/dist/types/src/infrastructure/cloud/types/snapshotCore.d.ts +125 -0
- package/dist/types/src/infrastructure/cloud/types/snapshotJobs.d.ts +124 -0
- package/dist/types/src/infrastructure/cloud/types/snapshotTelemetry.d.ts +100 -0
- package/dist/types/src/infrastructure/cloud/types.d.ts +3 -0
- package/dist/types/src/infrastructure/persistence/batchInsert.d.ts +13 -0
- package/dist/types/src/infrastructure/persistence/completedJobCountSchema.d.ts +6 -0
- package/dist/types/src/infrastructure/persistence/dependencyCompletionSchema.d.ts +6 -0
- package/dist/types/src/infrastructure/persistence/dependencyCompletionStore.d.ts +40 -0
- package/dist/types/src/infrastructure/persistence/index.d.ts +5 -0
- package/dist/types/src/infrastructure/persistence/jobOptionsBlob.d.ts +19 -0
- package/dist/types/src/infrastructure/persistence/legacyNameMigration.d.ts +17 -0
- package/dist/types/src/infrastructure/persistence/migrationProgressSchema.d.ts +2 -0
- package/dist/types/src/infrastructure/persistence/migrations.d.ts +3 -0
- package/dist/types/src/infrastructure/persistence/schema.d.ts +8 -0
- package/dist/types/src/infrastructure/persistence/sqlite/admission.d.ts +9 -0
- package/dist/types/src/infrastructure/persistence/sqlite/completed.d.ts +17 -0
- package/dist/types/src/infrastructure/persistence/sqlite/control.d.ts +48 -0
- package/dist/types/src/infrastructure/persistence/sqlite/flows.d.ts +26 -0
- package/dist/types/src/infrastructure/persistence/sqlite/jobLifecycle.d.ts +17 -0
- package/dist/types/src/infrastructure/persistence/sqlite/jobs.d.ts +15 -0
- package/dist/types/src/infrastructure/persistence/sqlite/lifecycle.d.ts +6 -0
- package/dist/types/src/infrastructure/persistence/sqlite/mutations.d.ts +27 -0
- package/dist/types/src/infrastructure/persistence/sqlite/queries.d.ts +23 -0
- package/dist/types/src/infrastructure/persistence/sqlite/queueDeletionSql.d.ts +3 -0
- package/dist/types/src/infrastructure/persistence/sqlite/records.d.ts +24 -0
- package/dist/types/src/infrastructure/persistence/sqlite/state.d.ts +42 -0
- package/dist/types/src/infrastructure/persistence/sqlite/telemetry.d.ts +17 -0
- package/dist/types/src/infrastructure/persistence/sqlite/telemetryStore.d.ts +30 -0
- package/dist/types/src/infrastructure/persistence/sqlite/telemetryWrites.d.ts +47 -0
- package/dist/types/src/infrastructure/persistence/sqlite.d.ts +6 -0
- package/dist/types/src/infrastructure/persistence/sqliteBatch.d.ts +4 -0
- package/dist/types/src/infrastructure/persistence/sqliteMigration.d.ts +5 -0
- package/dist/types/src/infrastructure/persistence/sqliteSerializer.d.ts +50 -0
- package/dist/types/src/infrastructure/persistence/statements.d.ts +86 -0
- package/dist/types/src/infrastructure/persistence/types/admission.d.ts +8 -0
- package/dist/types/src/infrastructure/persistence/types/batch.d.ts +12 -0
- package/dist/types/src/infrastructure/persistence/types/sqlite.d.ts +27 -0
- package/dist/types/src/infrastructure/persistence/writeBuffer.d.ts +48 -0
- package/dist/types/src/infrastructure/persistence/writeBufferPending.d.ts +11 -0
- package/dist/types/src/infrastructure/scheduler/cron/execution.d.ts +12 -0
- package/dist/types/src/infrastructure/scheduler/cron/persisted.d.ts +5 -0
- package/dist/types/src/infrastructure/scheduler/cron/runtime.d.ts +31 -0
- package/dist/types/src/infrastructure/scheduler/cron/validation.d.ts +3 -0
- package/dist/types/src/infrastructure/scheduler/cronParser.d.ts +45 -0
- package/dist/types/src/infrastructure/scheduler/cronScheduler.d.ts +5 -0
- package/dist/types/src/infrastructure/scheduler/types/cronScheduler.d.ts +16 -0
- package/dist/types/src/infrastructure/server/protocol/commands.d.ts +8 -0
- package/dist/types/src/infrastructure/server/protocol/frameParser.d.ts +16 -0
- package/dist/types/src/infrastructure/server/protocol/lineBuffer.d.ts +6 -0
- package/dist/types/src/infrastructure/server/protocol/validation.d.ts +10 -0
- package/dist/types/src/infrastructure/server/protocol.d.ts +6 -0
- package/dist/types/src/infrastructure/server/socketWriteQueue.d.ts +66 -0
- package/dist/types/src/infrastructure/server/types/protocol.d.ts +4 -0
- package/dist/types/src/require-bun.d.ts +13 -0
- package/dist/types/src/shared/asyncLock.d.ts +13 -0
- package/dist/types/src/shared/boundedMap.d.ts +30 -0
- package/dist/types/src/shared/boundedSet.d.ts +26 -0
- package/dist/types/src/shared/hash.d.ts +30 -0
- package/dist/types/src/shared/histogram.d.ts +23 -0
- package/dist/types/src/shared/lock.d.ts +13 -0
- package/dist/types/src/shared/lockError.d.ts +3 -0
- package/dist/types/src/shared/lockTimeout.d.ts +2 -0
- package/dist/types/src/shared/logger.d.ts +48 -0
- package/dist/types/src/shared/lru.d.ts +9 -0
- package/dist/types/src/shared/lruMap.d.ts +42 -0
- package/dist/types/src/shared/lruSet.d.ts +36 -0
- package/dist/types/src/shared/minHeap.d.ts +43 -0
- package/dist/types/src/shared/msgpack.d.ts +3 -0
- package/dist/types/src/shared/pausedView.d.ts +19 -0
- package/dist/types/src/shared/rwLock.d.ts +22 -0
- package/dist/types/src/shared/serialization.d.ts +24 -0
- package/dist/types/src/shared/skipList.d.ts +97 -0
- package/dist/types/src/shared/skipListNodes.d.ts +6 -0
- package/dist/types/src/shared/storageHealth.d.ts +9 -0
- package/dist/types/src/shared/ttlMap.d.ts +81 -0
- package/dist/types/src/shared/types/lock.d.ts +7 -0
- package/dist/types/src/shared/types/skipList.d.ts +4 -0
- package/dist/types/src/shared/version.d.ts +4 -0
- package/dist/types/src/shared/webhookValidation.d.ts +6 -0
- package/package.json +27 -9
- package/src/ack-batcher.ts +8 -5
- package/src/bunqueue/bunqueue-api.ts +1 -1
- package/src/bunqueue/bunqueue.ts +2 -1
- package/src/canonical-transport/bun-sqlite-types.ts +22 -0
- package/src/canonical-transport/dlq.ts +12 -0
- package/src/canonical-transport/embedded.ts +55 -0
- package/src/canonical-transport/runtime.ts +49 -0
- package/src/canonical-transport/thread-worker.ts +83 -0
- package/src/canonical-transport/transport.ts +153 -0
- package/src/connection.ts +25 -30
- package/src/errors.ts +3 -0
- package/src/flow-commit.ts +45 -0
- package/src/flow-plan-legacy.ts +117 -0
- package/src/flow-plan.ts +209 -0
- package/src/flow-types.ts +4 -0
- package/src/flow.ts +31 -163
- package/src/frame.ts +5 -2
- package/src/index.ts +7 -75
- package/src/job.ts +43 -9
- package/src/legacy.ts +91 -0
- package/src/observability.ts +59 -1
- package/src/queue-admin.ts +5 -5
- package/src/queue-control.ts +12 -8
- package/src/queue.ts +10 -6
- package/src/serialization.ts +93 -0
- package/src/terminal-outcome.ts +58 -0
- package/src/types.ts +3 -6
- package/src/worker-base.ts +9 -6
- package/src/worker-slot-signal.ts +23 -0
- package/src/worker.ts +11 -5
- package/dist/backpressure.js +0 -39
- package/dist/bunqueue/aging.js +0 -53
- package/dist/bunqueue/batch.js +0 -60
- package/dist/bunqueue/bunqueue-api.js +0 -116
- package/dist/bunqueue/bunqueue.js +0 -194
- package/dist/bunqueue/cancellation.js +0 -48
- package/dist/bunqueue/circuit-breaker.js +0 -69
- package/dist/bunqueue/dedup-debounce.js +0 -37
- package/dist/bunqueue/dlq-rate-limit.js +0 -65
- package/dist/bunqueue/rate-gate.js +0 -61
- package/dist/bunqueue/retry.js +0 -56
- package/dist/bunqueue/triggers.js +0 -42
- package/dist/bunqueue/ttl.js +0 -31
- package/dist/bunqueue/types.js +0 -6
- package/dist/connection-pool.js +0 -60
- package/dist/connection-types.js +0 -2
- package/dist/connection.js +0 -281
- package/dist/errors.js +0 -25
- package/dist/flow-types.js +0 -2
- package/dist/flow.js +0 -212
- package/dist/job.js +0 -155
- package/dist/observability.js +0 -110
- package/dist/queue-admin.js +0 -158
- package/dist/queue-control.js +0 -105
- package/dist/queue-query.js +0 -187
- package/dist/queue.js +0 -92
- package/dist/responses.js +0 -10
- package/dist/socket-factory.js +0 -47
- package/dist/types.js +0 -50
- package/dist/worker-base.js +0 -159
- package/dist/worker-types.js +0 -5
- package/dist/worker.js +0 -211
- /package/dist/{backpressure.d.ts → types/sdk/typescript/src/backpressure.d.ts} +0 -0
- /package/dist/{bunqueue → types/sdk/typescript/src/bunqueue}/cancellation.d.ts +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Job } from "./job.js";
|
|
2
|
+
export interface DlqConfig {
|
|
3
|
+
autoRetry?: boolean;
|
|
4
|
+
autoRetryInterval?: number;
|
|
5
|
+
maxAutoRetries?: number;
|
|
6
|
+
maxAge?: number | null;
|
|
7
|
+
maxEntries?: number;
|
|
8
|
+
}
|
|
9
|
+
export type FailureReason = 'explicit_fail' | 'max_attempts_exceeded' | 'timeout' | 'stalled' | 'ttl_expired' | 'worker_lost' | 'unknown';
|
|
10
|
+
export interface DlqEntry<T = unknown> {
|
|
11
|
+
job: Job<T>;
|
|
12
|
+
enteredAt: number;
|
|
13
|
+
reason: FailureReason;
|
|
14
|
+
error: string | null;
|
|
15
|
+
attempts: Array<{
|
|
16
|
+
attempt: number;
|
|
17
|
+
startedAt: number;
|
|
18
|
+
failedAt: number;
|
|
19
|
+
reason: FailureReason;
|
|
20
|
+
error: string | null;
|
|
21
|
+
duration: number;
|
|
22
|
+
}>;
|
|
23
|
+
retryCount: number;
|
|
24
|
+
lastRetryAt: number | null;
|
|
25
|
+
nextRetryAt: number | null;
|
|
26
|
+
expiresAt: number | null;
|
|
27
|
+
}
|
|
28
|
+
export interface DlqStats {
|
|
29
|
+
total: number;
|
|
30
|
+
byReason: Record<FailureReason, number>;
|
|
31
|
+
byQueue: Record<string, number>;
|
|
32
|
+
pendingRetry: number;
|
|
33
|
+
expired: number;
|
|
34
|
+
oldestEntry: number | null;
|
|
35
|
+
newestEntry: number | null;
|
|
36
|
+
}
|
|
37
|
+
export interface DlqFilter {
|
|
38
|
+
reason?: FailureReason;
|
|
39
|
+
olderThan?: number;
|
|
40
|
+
newerThan?: number;
|
|
41
|
+
retriable?: boolean;
|
|
42
|
+
expired?: boolean;
|
|
43
|
+
limit?: number;
|
|
44
|
+
offset?: number;
|
|
45
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ConnectionOptions } from "./connection.js";
|
|
2
|
+
export interface QueueEventsOptions {
|
|
3
|
+
/** Select the embedded manager instead of the TCP broker. */
|
|
4
|
+
embedded?: boolean;
|
|
5
|
+
/** TCP connection used when embedded is false. */
|
|
6
|
+
connection?: ConnectionOptions;
|
|
7
|
+
/** Embedded SQLite path; must match an already-active shared manager. */
|
|
8
|
+
dataPath?: string;
|
|
9
|
+
/** Namespace prefix applied to the queue name. */
|
|
10
|
+
prefixKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WaitingEvent {
|
|
13
|
+
jobId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ActiveEvent {
|
|
16
|
+
jobId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CompletedEvent<R = unknown> {
|
|
19
|
+
jobId: string;
|
|
20
|
+
returnvalue: R;
|
|
21
|
+
}
|
|
22
|
+
export interface FailedEvent {
|
|
23
|
+
jobId: string;
|
|
24
|
+
failedReason: string;
|
|
25
|
+
data?: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface ProgressEvent<P = unknown> {
|
|
28
|
+
jobId: string;
|
|
29
|
+
data: P;
|
|
30
|
+
}
|
|
31
|
+
export interface StalledEvent {
|
|
32
|
+
jobId: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RemovedEvent {
|
|
35
|
+
jobId: string;
|
|
36
|
+
prev: string;
|
|
37
|
+
}
|
|
38
|
+
export interface DelayedEvent {
|
|
39
|
+
jobId: string;
|
|
40
|
+
delay: number;
|
|
41
|
+
}
|
|
42
|
+
export interface DuplicatedEvent {
|
|
43
|
+
jobId: string;
|
|
44
|
+
}
|
|
45
|
+
export interface RetriedEvent {
|
|
46
|
+
jobId: string;
|
|
47
|
+
prev: string;
|
|
48
|
+
}
|
|
49
|
+
export interface WaitingChildrenEvent {
|
|
50
|
+
jobId: string;
|
|
51
|
+
}
|
|
52
|
+
export interface DrainedEvent {
|
|
53
|
+
id: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Job } from "./job.js";
|
|
2
|
+
export interface FlowJobData {
|
|
3
|
+
__flowParentId?: string;
|
|
4
|
+
__flowParentIds?: string[];
|
|
5
|
+
__parentId?: string;
|
|
6
|
+
__parentQueue?: string;
|
|
7
|
+
__childrenIds?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface ProcessorContext {
|
|
10
|
+
signal: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export interface ObservableLike<T> {
|
|
13
|
+
subscribe(observer: {
|
|
14
|
+
next(value: T): void;
|
|
15
|
+
error(error: unknown): void;
|
|
16
|
+
complete(): void;
|
|
17
|
+
}): {
|
|
18
|
+
unsubscribe(): void;
|
|
19
|
+
} | (() => void) | undefined;
|
|
20
|
+
}
|
|
21
|
+
export type Processor<T = unknown, R = unknown> = (job: Job<T & FlowJobData>, context?: ProcessorContext) => Promise<R> | ObservableLike<R> | R;
|
|
22
|
+
export type QueueEventType = 'waiting' | 'active' | 'completed' | 'failed' | 'progress' | 'removed' | 'drained';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { AutoBatchOptions, ClientTlsOptions, ConnectionOptions, QueueOptions, } from "./connection.js";
|
|
2
|
+
export type { DlqConfig, DlqEntry, DlqFilter, DlqStats, FailureReason } from "./dlq.js";
|
|
3
|
+
export type { ActiveEvent, CompletedEvent, DelayedEvent, DrainedEvent, DuplicatedEvent, FailedEvent, ProgressEvent, QueueEventsOptions, RemovedEvent, RetriedEvent, StalledEvent, WaitingChildrenEvent, WaitingEvent, } from "./events.js";
|
|
4
|
+
export type { FlowJobData, ObservableLike, Processor, ProcessorContext, QueueEventType, } from "./flow.js";
|
|
5
|
+
export type { ChangePriorityOpts, GetDependenciesOpts, Job, JobDependencies, JobDependenciesCount, JobJson, JobJsonRaw, JobStateType, } from "./job.js";
|
|
6
|
+
export type { QueueMetrics, QueueMetricsMeta, QueueMetricType } from "./metrics.js";
|
|
7
|
+
export type { BackoffOptions, DebounceOptions, DeduplicationOptions, GroupJobOptions, JobOptions, KeepJobs, ParentOpts, RepeatOptions, } from "./options.js";
|
|
8
|
+
export type { BatchWorkerOptions, GroupWorkerOptions, RateLimiterOptions, StallConfig, WorkerOptions, } from "./worker.js";
|
|
9
|
+
export { createPublicJob, toDlqEntry, toPublicJob } from "../jobConversion.js";
|
|
10
|
+
export type { CreatePublicJobOptions, ToPublicJobOptions } from "../jobConversion.js";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { JobOptions } from "./options.js";
|
|
2
|
+
export type JobStateType = 'waiting' | 'prioritized' | 'delayed' | 'active' | 'completed' | 'failed' | 'waiting-children' | 'unknown';
|
|
3
|
+
export interface JobJson<T = unknown> {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
data: T;
|
|
7
|
+
opts: JobOptions;
|
|
8
|
+
progress: number;
|
|
9
|
+
delay: number;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
attemptsMade: number;
|
|
12
|
+
stacktrace: string[] | null;
|
|
13
|
+
returnvalue?: unknown;
|
|
14
|
+
failedReason?: string;
|
|
15
|
+
finishedOn?: number;
|
|
16
|
+
processedOn?: number;
|
|
17
|
+
queueQualifiedName: string;
|
|
18
|
+
parentKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface JobJsonRaw {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
data: string;
|
|
24
|
+
opts: string;
|
|
25
|
+
progress: string;
|
|
26
|
+
delay: string;
|
|
27
|
+
timestamp: string;
|
|
28
|
+
attemptsMade: string;
|
|
29
|
+
stacktrace: string | null;
|
|
30
|
+
returnvalue?: string;
|
|
31
|
+
failedReason?: string;
|
|
32
|
+
finishedOn?: string;
|
|
33
|
+
processedOn?: string;
|
|
34
|
+
parentKey?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ChangePriorityOpts {
|
|
37
|
+
priority: number;
|
|
38
|
+
lifo?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface GetDependenciesOpts {
|
|
41
|
+
processed?: {
|
|
42
|
+
cursor?: number;
|
|
43
|
+
count?: number;
|
|
44
|
+
};
|
|
45
|
+
unprocessed?: {
|
|
46
|
+
cursor?: number;
|
|
47
|
+
count?: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface JobDependencies {
|
|
51
|
+
processed: Record<string, unknown>;
|
|
52
|
+
unprocessed: string[];
|
|
53
|
+
nextProcessedCursor?: number;
|
|
54
|
+
nextUnprocessedCursor?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface JobDependenciesCount {
|
|
57
|
+
processed: number;
|
|
58
|
+
unprocessed: number;
|
|
59
|
+
}
|
|
60
|
+
/** Public BullMQ-compatible job contract. */
|
|
61
|
+
export interface Job<T = unknown> {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
data: T;
|
|
65
|
+
queueName: string;
|
|
66
|
+
attemptsMade: number;
|
|
67
|
+
timestamp: number;
|
|
68
|
+
progress: number;
|
|
69
|
+
returnvalue?: unknown;
|
|
70
|
+
failedReason?: string;
|
|
71
|
+
parent?: {
|
|
72
|
+
id: string;
|
|
73
|
+
queueQualifiedName: string;
|
|
74
|
+
};
|
|
75
|
+
delay: number;
|
|
76
|
+
processedOn?: number;
|
|
77
|
+
finishedOn?: number;
|
|
78
|
+
stacktrace: string[] | null;
|
|
79
|
+
stalledCounter: number;
|
|
80
|
+
priority: number;
|
|
81
|
+
parentKey?: string;
|
|
82
|
+
opts: JobOptions;
|
|
83
|
+
token?: string;
|
|
84
|
+
processedBy?: string;
|
|
85
|
+
deduplicationId?: string;
|
|
86
|
+
repeatJobKey?: string;
|
|
87
|
+
attemptsStarted: number;
|
|
88
|
+
updateProgress(progress: number, message?: string): Promise<void>;
|
|
89
|
+
log(message: string): Promise<void>;
|
|
90
|
+
getState(): Promise<JobStateType>;
|
|
91
|
+
remove(): Promise<void>;
|
|
92
|
+
retry(): Promise<void>;
|
|
93
|
+
getChildrenValues<R = unknown>(): Promise<Record<string, R>>;
|
|
94
|
+
isWaiting(): Promise<boolean>;
|
|
95
|
+
isActive(): Promise<boolean>;
|
|
96
|
+
isDelayed(): Promise<boolean>;
|
|
97
|
+
isCompleted(): Promise<boolean>;
|
|
98
|
+
isFailed(): Promise<boolean>;
|
|
99
|
+
isWaitingChildren(): Promise<boolean>;
|
|
100
|
+
updateData(data: T): Promise<void>;
|
|
101
|
+
promote(): Promise<void>;
|
|
102
|
+
changeDelay(delay: number): Promise<void>;
|
|
103
|
+
changePriority(opts: ChangePriorityOpts): Promise<void>;
|
|
104
|
+
extendLock(token: string, duration: number): Promise<number>;
|
|
105
|
+
clearLogs(keepLogs?: number): Promise<void>;
|
|
106
|
+
getDependencies(opts?: GetDependenciesOpts): Promise<JobDependencies>;
|
|
107
|
+
getDependenciesCount(opts?: GetDependenciesOpts): Promise<JobDependenciesCount>;
|
|
108
|
+
toJSON(): JobJson<T>;
|
|
109
|
+
asJSON(): JobJsonRaw;
|
|
110
|
+
moveToCompleted(returnValue: unknown, token?: string, fetchNext?: boolean): Promise<unknown>;
|
|
111
|
+
moveToFailed(error: Error, token?: string, fetchNext?: boolean): Promise<void>;
|
|
112
|
+
moveToWait(token?: string): Promise<boolean>;
|
|
113
|
+
moveToDelayed(timestamp: number, token?: string): Promise<void>;
|
|
114
|
+
moveToWaitingChildren(token?: string, opts?: {
|
|
115
|
+
child?: {
|
|
116
|
+
id: string;
|
|
117
|
+
queue: string;
|
|
118
|
+
};
|
|
119
|
+
}): Promise<boolean>;
|
|
120
|
+
waitUntilFinished(queueEvents: unknown, ttl?: number): Promise<unknown>;
|
|
121
|
+
discard(): void;
|
|
122
|
+
getFailedChildrenValues(): Promise<Record<string, string>>;
|
|
123
|
+
getIgnoredChildrenFailures(): Promise<Record<string, string>>;
|
|
124
|
+
removeChildDependency(): Promise<boolean>;
|
|
125
|
+
removeDeduplicationKey(): Promise<boolean>;
|
|
126
|
+
removeUnprocessedChildren(): Promise<void>;
|
|
127
|
+
/** Available on a native batch processor's leading job. */
|
|
128
|
+
getBatch?(): Job<T>[];
|
|
129
|
+
/** Mark only this member as failed while allowing the rest of its batch to complete. */
|
|
130
|
+
setAsFailed?(error: Error): void;
|
|
131
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { QueueMetrics, QueueMetricsMeta, QueueMetricType } from "../../domain/types/metrics.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface ParentOpts {
|
|
2
|
+
id: string;
|
|
3
|
+
queue: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BackoffOptions {
|
|
6
|
+
type: 'fixed' | 'exponential';
|
|
7
|
+
delay: number;
|
|
8
|
+
}
|
|
9
|
+
export interface KeepJobs {
|
|
10
|
+
age?: number;
|
|
11
|
+
count?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DeduplicationOptions {
|
|
14
|
+
id: string;
|
|
15
|
+
ttl?: number;
|
|
16
|
+
extend?: boolean;
|
|
17
|
+
replace?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface DebounceOptions {
|
|
20
|
+
id: string;
|
|
21
|
+
ttl: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RepeatOptions {
|
|
24
|
+
every?: number;
|
|
25
|
+
limit?: number;
|
|
26
|
+
pattern?: string;
|
|
27
|
+
startDate?: Date | string | number;
|
|
28
|
+
endDate?: Date | string | number;
|
|
29
|
+
tz?: string;
|
|
30
|
+
immediately?: boolean;
|
|
31
|
+
count?: number;
|
|
32
|
+
prevMillis?: number;
|
|
33
|
+
offset?: number;
|
|
34
|
+
jobId?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface GroupJobOptions {
|
|
37
|
+
id: string | number;
|
|
38
|
+
/** Maximum number of pending jobs admitted for this group. */
|
|
39
|
+
maxSize?: number;
|
|
40
|
+
/** Intra-group priority from 0 to 2,097,151; lower values run first. */
|
|
41
|
+
priority?: number;
|
|
42
|
+
}
|
|
43
|
+
/** Options accepted when adding a job. */
|
|
44
|
+
export interface JobOptions {
|
|
45
|
+
priority?: number;
|
|
46
|
+
delay?: number;
|
|
47
|
+
attempts?: number;
|
|
48
|
+
backoff?: number | BackoffOptions;
|
|
49
|
+
timeout?: number;
|
|
50
|
+
jobId?: string;
|
|
51
|
+
/** Age/count retention is intentionally unsupported. */
|
|
52
|
+
removeOnComplete?: boolean;
|
|
53
|
+
removeOnFail?: boolean;
|
|
54
|
+
stallTimeout?: number;
|
|
55
|
+
repeat?: RepeatOptions;
|
|
56
|
+
durable?: boolean;
|
|
57
|
+
parent?: ParentOpts;
|
|
58
|
+
lifo?: boolean;
|
|
59
|
+
stackTraceLimit?: number;
|
|
60
|
+
keepLogs?: number;
|
|
61
|
+
sizeLimit?: number;
|
|
62
|
+
failParentOnFailure?: boolean;
|
|
63
|
+
removeDependencyOnFailure?: boolean;
|
|
64
|
+
continueParentOnFailure?: boolean;
|
|
65
|
+
ignoreDependencyOnFailure?: boolean;
|
|
66
|
+
timestamp?: number;
|
|
67
|
+
deduplication?: DeduplicationOptions;
|
|
68
|
+
debounce?: DebounceOptions;
|
|
69
|
+
group?: GroupJobOptions;
|
|
70
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ConnectionOptions } from "./connection.js";
|
|
2
|
+
export interface RateLimiterOptions {
|
|
3
|
+
max: number;
|
|
4
|
+
duration: number;
|
|
5
|
+
groupKey?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GroupWorkerOptions {
|
|
8
|
+
concurrency?: number;
|
|
9
|
+
limit?: {
|
|
10
|
+
max: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface BatchWorkerOptions {
|
|
15
|
+
size: number;
|
|
16
|
+
minSize?: number;
|
|
17
|
+
timeout?: number;
|
|
18
|
+
groupAffinity?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface WorkerOptions {
|
|
21
|
+
concurrency?: number;
|
|
22
|
+
autorun?: boolean;
|
|
23
|
+
heartbeatInterval?: number;
|
|
24
|
+
connection?: ConnectionOptions;
|
|
25
|
+
embedded?: boolean;
|
|
26
|
+
/** Must match the process-wide embedded manager when one is already active. */
|
|
27
|
+
dataPath?: string;
|
|
28
|
+
batchSize?: number;
|
|
29
|
+
pollTimeout?: number;
|
|
30
|
+
useLocks?: boolean;
|
|
31
|
+
limiter?: RateLimiterOptions;
|
|
32
|
+
group?: GroupWorkerOptions;
|
|
33
|
+
batch?: BatchWorkerOptions;
|
|
34
|
+
lockDuration?: number;
|
|
35
|
+
maxStalledCount?: number;
|
|
36
|
+
skipStalledCheck?: boolean;
|
|
37
|
+
skipLockRenewal?: boolean;
|
|
38
|
+
drainDelay?: number;
|
|
39
|
+
removeOnComplete?: boolean | number | {
|
|
40
|
+
age?: number;
|
|
41
|
+
count?: number;
|
|
42
|
+
};
|
|
43
|
+
removeOnFail?: boolean | number | {
|
|
44
|
+
age?: number;
|
|
45
|
+
count?: number;
|
|
46
|
+
};
|
|
47
|
+
prefixKey?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface StallConfig {
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
stallInterval?: number;
|
|
52
|
+
maxStalls?: number;
|
|
53
|
+
gracePeriod?: number;
|
|
54
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACK Batcher
|
|
3
|
+
* Batches acknowledgments for efficient TCP communication
|
|
4
|
+
*/
|
|
5
|
+
import type { TcpConnection } from "./types/index.js";
|
|
6
|
+
/** ACK batcher configuration */
|
|
7
|
+
export interface AckBatcherConfig {
|
|
8
|
+
batchSize: number;
|
|
9
|
+
interval: number;
|
|
10
|
+
embedded: boolean;
|
|
11
|
+
maxBatchSize?: (pendingCount: number) => number;
|
|
12
|
+
/** Receives an error thrown by `maxBatchSize`; the static `batchSize` applies instead. */
|
|
13
|
+
onThresholdError?: (error: Error) => void;
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
retryDelayMs?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Batches ACK operations for efficient processing
|
|
19
|
+
*/
|
|
20
|
+
export declare class AckBatcher {
|
|
21
|
+
private readonly MAX_PENDING_ACKS;
|
|
22
|
+
private readonly pendingAcks;
|
|
23
|
+
private ackTimer;
|
|
24
|
+
private readonly config;
|
|
25
|
+
private tcp;
|
|
26
|
+
private stopped;
|
|
27
|
+
private readonly inFlightFlushes;
|
|
28
|
+
constructor(config: AckBatcherConfig);
|
|
29
|
+
/** Set TCP connection */
|
|
30
|
+
setTcp(tcp: TcpConnection | null): void;
|
|
31
|
+
/** Queue ACK for batch processing (with optional lock token) */
|
|
32
|
+
queue(id: string, result: unknown, token?: string, removeOnComplete?: boolean, onQueued?: () => void): Promise<boolean>;
|
|
33
|
+
/** Re-evaluate a dynamic batch ceiling after worker capacity changes. */
|
|
34
|
+
notifyCapacityChanged(): void;
|
|
35
|
+
/** Flush pending ACKs with retry logic */
|
|
36
|
+
flush(): Promise<void>;
|
|
37
|
+
/** Send batch with exponential backoff retry */
|
|
38
|
+
private sendBatchWithRetry;
|
|
39
|
+
/** Stop and cleanup - clears pending acks without processing */
|
|
40
|
+
stop(): void;
|
|
41
|
+
/** Check if there are pending acks */
|
|
42
|
+
hasPending(): boolean;
|
|
43
|
+
/** Wait for all in-flight flush operations to complete */
|
|
44
|
+
waitForInFlight(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Never throws: `queue()` evaluates this after an ACK is already buffered, and
|
|
47
|
+
* `notifyCapacityChanged()` runs from worker setters and failure paths. A
|
|
48
|
+
* throwing dynamic ceiling falls back to the static `batchSize`, so the ACK
|
|
49
|
+
* stays owned by this batcher and is still flushed by size or by the timer.
|
|
50
|
+
*/
|
|
51
|
+
private effectiveBatchSize;
|
|
52
|
+
private reportThresholdError;
|
|
53
|
+
private flushIfThresholdReached;
|
|
54
|
+
private startTrackedFlush;
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Job } from "../../domain/types/job.js";
|
|
2
|
+
import type { GroupConcurrencyLimiter } from "./groupConcurrency.js";
|
|
3
|
+
interface BufferedDelivery {
|
|
4
|
+
generation: number;
|
|
5
|
+
job: Job;
|
|
6
|
+
}
|
|
7
|
+
interface StartableAckDeliveryOptions<T extends BufferedDelivery> {
|
|
8
|
+
activeExecutions: number;
|
|
9
|
+
concurrency: number;
|
|
10
|
+
running: boolean;
|
|
11
|
+
closing: boolean;
|
|
12
|
+
nativeBatch: boolean;
|
|
13
|
+
rateSlots: number;
|
|
14
|
+
deliveries: readonly T[];
|
|
15
|
+
head: number;
|
|
16
|
+
isCurrent: (delivery: T) => boolean;
|
|
17
|
+
groupLimiter: GroupConcurrencyLimiter | null;
|
|
18
|
+
}
|
|
19
|
+
/** Count buffered scalar deliveries that can start without settling an ACK first. */
|
|
20
|
+
export declare function countImmediatelyStartableAckDeliveries<T extends BufferedDelivery>(options: StartableAckDeliveryOptions<T>): number;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface AckEntry {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
}
|
|
4
|
+
/** Parse structured ACKB evidence, retaining duplicate job-ID positions. */
|
|
5
|
+
export declare function ignoredAckIndices(data: unknown, batch: readonly AckEntry[]): ReadonlySet<number>;
|
|
6
|
+
/** Parse a single ACK response; normal historical responses carry no data. */
|
|
7
|
+
export declare function outcomeWasApplied(data: unknown): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Processor } from "../types.js";
|
|
2
|
+
/** Coordinates one processor invocation across independently acknowledged jobs. */
|
|
3
|
+
export declare class BatchExecution<T, R> {
|
|
4
|
+
private readonly processor;
|
|
5
|
+
private readonly size;
|
|
6
|
+
private readonly jobs;
|
|
7
|
+
private readonly failures;
|
|
8
|
+
private readonly signals;
|
|
9
|
+
private readonly ready;
|
|
10
|
+
private registered;
|
|
11
|
+
private outcome;
|
|
12
|
+
constructor(processor: Processor<T, R>, size: number);
|
|
13
|
+
handler(index: number): Processor<T, R>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GroupConcurrencyLimiter - Per-group concurrency limiting for workers
|
|
3
|
+
*
|
|
4
|
+
* When a worker has limiter.groupKey set, this tracks how many jobs
|
|
5
|
+
* are active per group and enforces the limiter.max cap per group.
|
|
6
|
+
*/
|
|
7
|
+
import type { RateLimiterOptions } from "../types.js";
|
|
8
|
+
import type { Job as InternalJob } from "../../domain/types/job.js";
|
|
9
|
+
export declare class GroupConcurrencyLimiter {
|
|
10
|
+
private readonly groupKey;
|
|
11
|
+
private readonly maxPerGroup;
|
|
12
|
+
private readonly activeByGroup;
|
|
13
|
+
constructor(groupKey: string, max: number);
|
|
14
|
+
/**
|
|
15
|
+
* Create a GroupConcurrencyLimiter from limiter options, or null if
|
|
16
|
+
* groupKey is not configured.
|
|
17
|
+
*/
|
|
18
|
+
static fromOptions(limiter: RateLimiterOptions | null | undefined): GroupConcurrencyLimiter | null;
|
|
19
|
+
/**
|
|
20
|
+
* Extract the group key value from a job's data.
|
|
21
|
+
* Returns null if the job data doesn't contain the group key field.
|
|
22
|
+
* Total: never throws, because the ACK frontier, admission and group
|
|
23
|
+
* accounting all call it on producer-controlled data.
|
|
24
|
+
*/
|
|
25
|
+
getGroupValue(job: InternalJob): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a job's group has capacity for another active job.
|
|
28
|
+
* Jobs without a group value are always allowed (no group limit applies).
|
|
29
|
+
*/
|
|
30
|
+
canProcess(job: InternalJob): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Increment the active count for a job's group.
|
|
33
|
+
* Call this when a job starts processing.
|
|
34
|
+
*/
|
|
35
|
+
increment(job: InternalJob): void;
|
|
36
|
+
/**
|
|
37
|
+
* Decrement the active count for a job's group.
|
|
38
|
+
* Call this when a job finishes (completed or failed).
|
|
39
|
+
*/
|
|
40
|
+
decrement(job: InternalJob): void;
|
|
41
|
+
/** Get the current active count for a specific group. */
|
|
42
|
+
getGroupCount(group: string): number;
|
|
43
|
+
/** Get max per group. */
|
|
44
|
+
getMax(): number;
|
|
45
|
+
/** Get the group key field name. */
|
|
46
|
+
getGroupKey(): string;
|
|
47
|
+
/** Clear all tracking state. */
|
|
48
|
+
clear(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Job as InternalJob } from "../../../domain/types/job.js";
|
|
2
|
+
import type { AckBatcher } from "../ackBatcher.js";
|
|
3
|
+
import type { TcpConnection } from "../types/index.js";
|
|
4
|
+
export declare function computeStackLines(error: Error): {
|
|
5
|
+
stackLines: string[];
|
|
6
|
+
wireStack: string[] | undefined;
|
|
7
|
+
};
|
|
8
|
+
interface MoveToFailedHandlerOptions {
|
|
9
|
+
embedded: boolean;
|
|
10
|
+
tcp: TcpConnection | null;
|
|
11
|
+
internalJob: InternalJob;
|
|
12
|
+
token: string | null | undefined;
|
|
13
|
+
removeOnFail: boolean | undefined;
|
|
14
|
+
onCalled: (error: Error) => void;
|
|
15
|
+
onIgnored: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function createMoveToFailedHandler(options: MoveToFailedHandlerOptions): (id: string, error: Error, _lockToken?: string) => Promise<void>;
|
|
18
|
+
interface MoveToCompletedHandlerOptions {
|
|
19
|
+
embedded: boolean;
|
|
20
|
+
ackBatcher: AckBatcher;
|
|
21
|
+
internalJob: InternalJob;
|
|
22
|
+
token: string | null | undefined;
|
|
23
|
+
removeOnComplete: boolean | undefined;
|
|
24
|
+
onAckQueued?: () => void;
|
|
25
|
+
onCalled: (value: unknown) => void;
|
|
26
|
+
onIgnored: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function createMoveToCompletedHandler(options: MoveToCompletedHandlerOptions): (id: string, returnValue: unknown, _lockToken?: string) => Promise<unknown>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Job as InternalJob } from "../../../domain/types/job.js";
|
|
2
|
+
import type { JobDependencies, JobDependenciesCount } from "../../types.js";
|
|
3
|
+
import type { PendingTransitionSettlement, TcpConnection } from "../types/index.js";
|
|
4
|
+
export declare function createWaitUntilFinishedHandler(embedded: boolean, tcp: TcpConnection | null): (id: string, _queueEvents: unknown, ttl?: number) => Promise<unknown>;
|
|
5
|
+
export declare function createDiscardHandler(embedded: boolean, tcp: TcpConnection | null, options?: {
|
|
6
|
+
token?: string;
|
|
7
|
+
onPending?: (pending: Promise<PendingTransitionSettlement>) => void;
|
|
8
|
+
}): (id: string) => void;
|
|
9
|
+
export declare function createGetDependenciesHandler(embedded: boolean, tcp: TcpConnection | null, internalJob: InternalJob): (_id: string) => Promise<JobDependencies>;
|
|
10
|
+
export declare function createGetDependenciesCountHandler(embedded: boolean, tcp: TcpConnection | null, internalJob: InternalJob): (_id: string) => Promise<JobDependenciesCount>;
|
|
11
|
+
export declare function createRemoveDeduplicationKeyHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<boolean>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Job as InternalJob } from "../../../domain/types/job.js";
|
|
2
|
+
import type { ChangePriorityOpts } from "../../types.js";
|
|
3
|
+
import type { TcpConnection } from "../types/index.js";
|
|
4
|
+
export declare function createRemoveHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<void>;
|
|
5
|
+
export declare function createRetryHandler(embedded: boolean, tcp: TcpConnection | null, options: {
|
|
6
|
+
internalJob: InternalJob;
|
|
7
|
+
token?: string;
|
|
8
|
+
onTransitionApplied?: () => void;
|
|
9
|
+
}): (id: string) => Promise<void>;
|
|
10
|
+
export declare function createUpdateDataHandler(embedded: boolean, tcp: TcpConnection | null): (id: string, data: unknown) => Promise<void>;
|
|
11
|
+
export declare function createPromoteHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<void>;
|
|
12
|
+
export declare function createChangeDelayHandler(embedded: boolean, tcp: TcpConnection | null, token?: string, onTransitionApplied?: () => void): (id: string, delay: number) => Promise<void>;
|
|
13
|
+
export declare function createChangePriorityHandler(embedded: boolean, tcp: TcpConnection | null): (id: string, options: ChangePriorityOpts) => Promise<void>;
|
|
14
|
+
export declare function createExtendLockHandler(embedded: boolean, tcp: TcpConnection | null): (id: string, token: string, duration: number) => Promise<number>;
|
|
15
|
+
export declare function createClearLogsHandler(embedded: boolean, tcp: TcpConnection | null): (id: string, keepLogs?: number) => Promise<void>;
|
|
16
|
+
export declare function createMoveToWaitHandler(embedded: boolean, tcp: TcpConnection | null, onTransitionApplied?: () => void): (id: string, token?: string) => Promise<boolean>;
|
|
17
|
+
export declare function createMoveToDelayedHandler(embedded: boolean, tcp: TcpConnection | null, onTransitionApplied?: () => void): (id: string, timestamp: number, token?: string) => Promise<void>;
|
|
18
|
+
export declare function createMoveToWaitingChildrenHandler(embedded: boolean, tcp: TcpConnection | null, onTransitionApplied?: () => void): (id: string, token?: string, _opts?: {
|
|
19
|
+
child?: {
|
|
20
|
+
id: string;
|
|
21
|
+
queue: string;
|
|
22
|
+
};
|
|
23
|
+
}) => Promise<boolean>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EventEmitter } from 'events';
|
|
2
|
+
import type { FlowJobData, Job, JobStateType } from "../../types.js";
|
|
3
|
+
import type { TcpConnection } from "../types/index.js";
|
|
4
|
+
export declare function createProgressHandler<T extends FlowJobData>(embedded: boolean, tcp: TcpConnection | null, emitter: EventEmitter, jobHolder: {
|
|
5
|
+
current: Job<T> | null;
|
|
6
|
+
}): (id: string, progress: number, message?: string) => Promise<void>;
|
|
7
|
+
export declare function createLogHandler<T extends FlowJobData>(embedded: boolean, tcp: TcpConnection | null, emitter: EventEmitter, jobHolder: {
|
|
8
|
+
current: Job<T> | null;
|
|
9
|
+
}): (id: string, message: string) => Promise<void>;
|
|
10
|
+
export declare function createGetStateHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<JobStateType>;
|
|
11
|
+
export declare function createGetChildrenValuesHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<Record<string, unknown>>;
|
|
12
|
+
export declare function createGetFailedChildrenValuesHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<Record<string, string>>;
|
|
13
|
+
export declare function createGetIgnoredChildrenFailuresHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<Record<string, string>>;
|
|
14
|
+
export declare function createRemoveChildDependencyHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<boolean>;
|
|
15
|
+
export declare function createRemoveUnprocessedChildrenHandler(embedded: boolean, tcp: TcpConnection | null): (id: string) => Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Parser
|
|
3
|
+
* Parses job data from TCP responses
|
|
4
|
+
*/
|
|
5
|
+
import type { Job as InternalJob } from "../../domain/types/job.js";
|
|
6
|
+
/**
|
|
7
|
+
* Parse job from TCP response data
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseJobFromResponse(jobData: Record<string, unknown>, queueName: string): InternalJob;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Processor
|
|
3
|
+
* Handles job execution and result reporting
|
|
4
|
+
*/
|
|
5
|
+
import type { Job as InternalJob } from "../../domain/types/job.js";
|
|
6
|
+
import type { ProcessorConfig } from "./types/index.js";
|
|
7
|
+
export type { ProcessorConfig } from "./types/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Process a single job
|
|
10
|
+
*/
|
|
11
|
+
export declare function processJob<T, R>(internalJob: InternalJob, config: ProcessorConfig<T, R>): Promise<void>;
|