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,66 @@
|
|
|
1
|
+
import type { Job, JobOptions, JobStateType } from "../../types.js";
|
|
2
|
+
import * as countsOps from "../operations/counts.js";
|
|
3
|
+
import { QueueState } from "./state.js";
|
|
4
|
+
/** Job creation, lookup, state-listing, and count operations. */
|
|
5
|
+
export declare class QueueQueries<T> extends QueueState<T> {
|
|
6
|
+
getGroupJobsCount(groupId: string): Promise<number>;
|
|
7
|
+
getGroupsJobsCount(maxCount?: number): Promise<number>;
|
|
8
|
+
getGroupActiveCount(groupId: string): Promise<number>;
|
|
9
|
+
setGroupRateLimit(groupId: string, max: number, duration: number): Promise<void>;
|
|
10
|
+
getGroupRateLimit(groupId: string): Promise<{
|
|
11
|
+
max: number;
|
|
12
|
+
duration: number;
|
|
13
|
+
} | null>;
|
|
14
|
+
removeGroupRateLimit(groupId: string): Promise<number>;
|
|
15
|
+
getGroupRateLimitTtl(groupId: string, maxJobs?: number): Promise<number>;
|
|
16
|
+
setGroupConcurrency(groupId: string, concurrency: number): Promise<void>;
|
|
17
|
+
getGroupConcurrency(groupId: string): Promise<number | null>;
|
|
18
|
+
removeGroupConcurrency(groupId: string): Promise<number>;
|
|
19
|
+
pauseGroup(groupId: string): Promise<boolean>;
|
|
20
|
+
resumeGroup(groupId: string): Promise<boolean>;
|
|
21
|
+
isGroupPaused(groupId: string): Promise<boolean>;
|
|
22
|
+
getGroupJobs(groupId: string, start?: number, end?: number): Promise<Job<T>[]>;
|
|
23
|
+
getCountsPerPriorityForGroup(groupId: string): Promise<Record<number, number>>;
|
|
24
|
+
add(name: string, data: T, opts?: JobOptions): Promise<Job<T>>;
|
|
25
|
+
addBulk(jobs: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
data: T;
|
|
28
|
+
opts?: JobOptions;
|
|
29
|
+
}>): Promise<Job<T>[]>;
|
|
30
|
+
getJob(id: string): Promise<Job<T> | null>;
|
|
31
|
+
getJobState(id: string): Promise<JobStateType>;
|
|
32
|
+
getChildrenValues(id: string): Promise<Record<string, unknown>>;
|
|
33
|
+
getJobs(opts?: {
|
|
34
|
+
state?: string | string[];
|
|
35
|
+
start?: number;
|
|
36
|
+
end?: number;
|
|
37
|
+
asc?: boolean;
|
|
38
|
+
}): Job<T>[];
|
|
39
|
+
getJobsAsync(opts?: {
|
|
40
|
+
state?: string | string[];
|
|
41
|
+
start?: number;
|
|
42
|
+
end?: number;
|
|
43
|
+
asc?: boolean;
|
|
44
|
+
}): Promise<Job<unknown>[]>;
|
|
45
|
+
getWaiting(start?: number, end?: number): Job<T>[];
|
|
46
|
+
getWaitingAsync(start?: number, end?: number): Promise<Job<T>[]>;
|
|
47
|
+
getDelayed(start?: number, end?: number): Job<T>[];
|
|
48
|
+
getDelayedAsync(start?: number, end?: number): Promise<Job<T>[]>;
|
|
49
|
+
getActive(start?: number, end?: number): Job<T>[];
|
|
50
|
+
getActiveAsync(start?: number, end?: number): Promise<Job<T>[]>;
|
|
51
|
+
getCompleted(start?: number, end?: number): Job<T>[];
|
|
52
|
+
getCompletedAsync(start?: number, end?: number): Promise<Job<T>[]>;
|
|
53
|
+
getFailed(start?: number, end?: number): Job<T>[];
|
|
54
|
+
getFailedAsync(start?: number, end?: number): Promise<Job<T>[]>;
|
|
55
|
+
getJobCounts(): countsOps.JobCounts | Promise<countsOps.JobCounts>;
|
|
56
|
+
getJobCountsAsync(): Promise<countsOps.JobCounts>;
|
|
57
|
+
getWaitingCount(): Promise<number>;
|
|
58
|
+
getActiveCount(): Promise<number>;
|
|
59
|
+
getCompletedCount(): Promise<number>;
|
|
60
|
+
getFailedCount(): Promise<number>;
|
|
61
|
+
getDelayedCount(): Promise<number>;
|
|
62
|
+
count(): number;
|
|
63
|
+
countAsync(): Promise<number>;
|
|
64
|
+
getCountsPerPriority(): Record<number, number>;
|
|
65
|
+
getCountsPerPriorityAsync(): Promise<Record<number, number>>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GetDependenciesOpts, JobDependencies, JobDependenciesCount } from "../../types.js";
|
|
2
|
+
import * as schedulerOps from "../scheduler.js";
|
|
3
|
+
import type { JobTemplate, RepeatOpts, SchedulerInfo } from "../scheduler.js";
|
|
4
|
+
import { QueueConfiguration } from "./configuration.js";
|
|
5
|
+
/** Scheduler, deduplication, job-transition, and dependency operations. */
|
|
6
|
+
export declare class QueueScheduling<T> extends QueueConfiguration<T> {
|
|
7
|
+
upsertJobScheduler(schedulerId: string, repeatOpts: RepeatOpts, jobTemplate?: JobTemplate<T>): Promise<SchedulerInfo | null>;
|
|
8
|
+
removeJobScheduler(schedulerId: string): Promise<boolean>;
|
|
9
|
+
getJobScheduler(schedulerId: string): Promise<schedulerOps.SchedulerInfo | null>;
|
|
10
|
+
getJobSchedulers(start?: number, end?: number, asc?: boolean): Promise<schedulerOps.SchedulerInfo[]>;
|
|
11
|
+
getJobSchedulersCount(): Promise<number>;
|
|
12
|
+
getDeduplicationJobId(deduplicationId: string): Promise<string | null>;
|
|
13
|
+
removeDeduplicationKey(deduplicationId: string): Promise<number>;
|
|
14
|
+
moveJobToCompleted(id: string, returnValue: unknown, token?: string): Promise<unknown>;
|
|
15
|
+
moveJobToFailed(id: string, error: Error, token?: string): Promise<void>;
|
|
16
|
+
moveJobToWait(id: string, token?: string): Promise<boolean>;
|
|
17
|
+
moveJobToDelayed(id: string, timestamp: number, token?: string): Promise<void>;
|
|
18
|
+
moveJobToWaitingChildren(id: string, token?: string, opts?: {
|
|
19
|
+
child?: {
|
|
20
|
+
id: string;
|
|
21
|
+
queue: string;
|
|
22
|
+
};
|
|
23
|
+
}): Promise<boolean>;
|
|
24
|
+
waitJobUntilFinished(id: string, queueEvents: unknown, ttl?: number): Promise<unknown>;
|
|
25
|
+
getJobDependencies(id: string, opts?: GetDependenciesOpts): Promise<JobDependencies>;
|
|
26
|
+
getJobDependenciesCount(id: string, opts?: GetDependenciesOpts): Promise<JobDependenciesCount>;
|
|
27
|
+
getDependencies(parentId: string, type?: 'processed' | 'unprocessed', start?: number, end?: number): Promise<{
|
|
28
|
+
processed?: Record<string, unknown>;
|
|
29
|
+
unprocessed?: string[];
|
|
30
|
+
nextProcessedCursor?: number;
|
|
31
|
+
nextUnprocessedCursor?: number;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ChangePriorityOpts, GetDependenciesOpts, QueueOptions } from "../../types.js";
|
|
2
|
+
import { TcpConnectionPool } from "../../tcpPool.js";
|
|
3
|
+
import { AddBatcher } from "../addBatcher.js";
|
|
4
|
+
/** Owns Queue connection state and builds the shared operation contexts. */
|
|
5
|
+
export declare class QueueState<T> {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
protected readonly queueKey: string;
|
|
8
|
+
protected readonly prefixKey: string;
|
|
9
|
+
protected readonly opts: QueueOptions;
|
|
10
|
+
protected readonly embedded: boolean;
|
|
11
|
+
protected readonly tcpPool: TcpConnectionPool | null;
|
|
12
|
+
protected readonly useSharedPool: boolean;
|
|
13
|
+
protected readonly addBatcher: AddBatcher<unknown> | null;
|
|
14
|
+
private connectionReleased;
|
|
15
|
+
constructor(name: string, opts?: QueueOptions);
|
|
16
|
+
protected get ctx(): {
|
|
17
|
+
name: string;
|
|
18
|
+
embedded: boolean;
|
|
19
|
+
tcp: TcpConnectionPool | null;
|
|
20
|
+
prefixKey: string;
|
|
21
|
+
dataPath: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
protected get addCtx(): {
|
|
24
|
+
opts: QueueOptions;
|
|
25
|
+
getJobState: (id: string) => Promise<import("../../types.js").JobStateType>;
|
|
26
|
+
removeAsync: (id: string) => Promise<void>;
|
|
27
|
+
retryJob: (id: string) => Promise<void>;
|
|
28
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
29
|
+
updateJobData: (id: string, data: unknown) => Promise<void>;
|
|
30
|
+
promoteJob: (id: string) => Promise<void>;
|
|
31
|
+
changeJobDelay: (id: string, delay: number) => Promise<void>;
|
|
32
|
+
changeJobPriority: (id: string, options: ChangePriorityOpts) => Promise<void>;
|
|
33
|
+
extendJobLock: (id: string, token: string, duration: number) => Promise<number>;
|
|
34
|
+
clearJobLogs: (id: string, keep?: number) => Promise<void>;
|
|
35
|
+
getJobDependencies: (id: string, options?: GetDependenciesOpts) => Promise<import("../../index.js").JobDependencies>;
|
|
36
|
+
getJobDependenciesCount: (id: string, options?: GetDependenciesOpts) => Promise<import("../../index.js").JobDependenciesCount>;
|
|
37
|
+
getJobCountsAsync: () => Promise<unknown>;
|
|
38
|
+
getJobsAsync: (options: {
|
|
39
|
+
state?: string | string[];
|
|
40
|
+
start?: number;
|
|
41
|
+
end?: number;
|
|
42
|
+
asc?: boolean;
|
|
43
|
+
}) => Promise<import("../../index.js").Job<T>[]>;
|
|
44
|
+
moveJobToCompleted: (id: string, result: unknown, token?: string) => Promise<unknown>;
|
|
45
|
+
moveJobToFailed: (id: string, error: Error, token?: string) => Promise<void>;
|
|
46
|
+
moveJobToWait: (id: string, token?: string) => Promise<boolean>;
|
|
47
|
+
moveJobToDelayed: (id: string, timestamp: number, token?: string) => Promise<void>;
|
|
48
|
+
moveJobToWaitingChildren: (id: string, token?: string, options?: {
|
|
49
|
+
child?: {
|
|
50
|
+
id: string;
|
|
51
|
+
queue: string;
|
|
52
|
+
};
|
|
53
|
+
}) => Promise<boolean>;
|
|
54
|
+
waitJobUntilFinished: (id: string, queueEvents: unknown, ttl?: number) => Promise<unknown>;
|
|
55
|
+
name: string;
|
|
56
|
+
embedded: boolean;
|
|
57
|
+
tcp: TcpConnectionPool | null;
|
|
58
|
+
prefixKey: string;
|
|
59
|
+
dataPath: string | undefined;
|
|
60
|
+
};
|
|
61
|
+
protected get queryCtx(): {
|
|
62
|
+
getJobState: (id: string) => Promise<import("../../types.js").JobStateType>;
|
|
63
|
+
removeAsync: (id: string) => Promise<void>;
|
|
64
|
+
retryJob: (id: string) => Promise<void>;
|
|
65
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
66
|
+
updateJobData: (id: string, data: unknown) => Promise<void>;
|
|
67
|
+
promoteJob: (id: string) => Promise<void>;
|
|
68
|
+
changeJobDelay: (id: string, delay: number) => Promise<void>;
|
|
69
|
+
changeJobPriority: (id: string, options: ChangePriorityOpts) => Promise<void>;
|
|
70
|
+
extendJobLock: (id: string, token: string, duration: number) => Promise<number>;
|
|
71
|
+
clearJobLogs: (id: string, keep?: number) => Promise<void>;
|
|
72
|
+
getJobDependencies: (id: string, options?: GetDependenciesOpts) => Promise<import("../../index.js").JobDependencies>;
|
|
73
|
+
getJobDependenciesCount: (id: string, options?: GetDependenciesOpts) => Promise<import("../../index.js").JobDependenciesCount>;
|
|
74
|
+
moveJobToCompleted: (id: string, result: unknown, token?: string) => Promise<unknown>;
|
|
75
|
+
moveJobToFailed: (id: string, error: Error, token?: string) => Promise<void>;
|
|
76
|
+
moveJobToWait: (id: string, token?: string) => Promise<boolean>;
|
|
77
|
+
moveJobToDelayed: (id: string, timestamp: number, token?: string) => Promise<void>;
|
|
78
|
+
moveJobToWaitingChildren: (id: string, token?: string, options?: {
|
|
79
|
+
child?: {
|
|
80
|
+
id: string;
|
|
81
|
+
queue: string;
|
|
82
|
+
};
|
|
83
|
+
}) => Promise<boolean>;
|
|
84
|
+
waitJobUntilFinished: (id: string, queueEvents: unknown, ttl?: number) => Promise<unknown>;
|
|
85
|
+
name: string;
|
|
86
|
+
embedded: boolean;
|
|
87
|
+
tcp: TcpConnectionPool | null;
|
|
88
|
+
prefixKey: string;
|
|
89
|
+
dataPath: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
protected get moveCtx(): {
|
|
92
|
+
getJobState: (id: string) => Promise<import("../../types.js").JobStateType>;
|
|
93
|
+
getJobDependencies: (id: string) => Promise<import("../../index.js").JobDependencies>;
|
|
94
|
+
name: string;
|
|
95
|
+
embedded: boolean;
|
|
96
|
+
tcp: TcpConnectionPool | null;
|
|
97
|
+
prefixKey: string;
|
|
98
|
+
dataPath: string | undefined;
|
|
99
|
+
};
|
|
100
|
+
protected releaseConnection(): void;
|
|
101
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Scheduler Operations (BullMQ v5 repeatable jobs)
|
|
3
|
+
*/
|
|
4
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
5
|
+
import type { JobOptions } from "../types.js";
|
|
6
|
+
interface SchedulerContext {
|
|
7
|
+
/** Server-side queue key (already prefixed with `prefixKey` if set). */
|
|
8
|
+
name: string;
|
|
9
|
+
embedded: boolean;
|
|
10
|
+
tcp: TcpConnectionPool | null;
|
|
11
|
+
/**
|
|
12
|
+
* Namespace prefix from QueueOptions. When set, scheduler IDs are stored
|
|
13
|
+
* under `${prefixKey}${schedulerId}` so two queues with different prefixes
|
|
14
|
+
* cannot collide on the global cron-name PRIMARY KEY.
|
|
15
|
+
*/
|
|
16
|
+
prefixKey?: string;
|
|
17
|
+
/** Queue-level default job options, merged under the scheduler template opts. */
|
|
18
|
+
defaultJobOptions?: JobOptions;
|
|
19
|
+
}
|
|
20
|
+
export interface RepeatOpts {
|
|
21
|
+
pattern?: string;
|
|
22
|
+
every?: number;
|
|
23
|
+
limit?: number;
|
|
24
|
+
immediately?: boolean;
|
|
25
|
+
count?: number;
|
|
26
|
+
prevMillis?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
jobId?: string;
|
|
29
|
+
timezone?: string;
|
|
30
|
+
/** Skip missed runs on restart instead of executing them (default: true) */
|
|
31
|
+
skipMissedOnRestart?: boolean;
|
|
32
|
+
/** Skip job push if no worker is registered for the queue (default: false) */
|
|
33
|
+
skipIfNoWorker?: boolean;
|
|
34
|
+
/** Prevent overlapping cron jobs via automatic dedup (default: true) */
|
|
35
|
+
preventOverlap?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface JobTemplate<T = unknown> {
|
|
38
|
+
name?: string;
|
|
39
|
+
data?: T;
|
|
40
|
+
opts?: JobOptions;
|
|
41
|
+
}
|
|
42
|
+
export interface SchedulerInfo {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
next: number;
|
|
46
|
+
pattern?: string;
|
|
47
|
+
every?: number;
|
|
48
|
+
/** Max number of times the scheduler will fire (RepeatOpts.limit). #111 */
|
|
49
|
+
limit?: number;
|
|
50
|
+
}
|
|
51
|
+
/** Create or update a job scheduler */
|
|
52
|
+
export declare function upsertJobScheduler(ctx: SchedulerContext, schedulerId: string, repeatOpts: RepeatOpts, jobTemplate?: JobTemplate): Promise<SchedulerInfo | null>;
|
|
53
|
+
export declare function removeJobScheduler(ctx: SchedulerContext, schedulerId: string): Promise<boolean>;
|
|
54
|
+
/** Get a job scheduler by ID */
|
|
55
|
+
export declare function getJobScheduler(ctx: SchedulerContext, schedulerId: string): Promise<SchedulerInfo | null>;
|
|
56
|
+
export declare function getJobSchedulers(ctx: SchedulerContext, start?: number, end?: number, asc?: boolean): Promise<SchedulerInfo[]>;
|
|
57
|
+
export declare function getJobSchedulersCount(ctx: SchedulerContext): Promise<number>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ScheduledEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
next: number;
|
|
4
|
+
}
|
|
5
|
+
/** Sort schedulers like BullMQ's scored range and apply its inclusive indexes. */
|
|
6
|
+
export declare function paginateSchedulers<T extends ScheduledEntry>(schedulers: T[], start: number, end: number, asc: boolean): T[];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stall Detection Operations
|
|
3
|
+
* setStallConfig, getStallConfig
|
|
4
|
+
*/
|
|
5
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
6
|
+
import type { StallConfig } from "../types.js";
|
|
7
|
+
interface StallContext {
|
|
8
|
+
name: string;
|
|
9
|
+
embedded: boolean;
|
|
10
|
+
tcp: TcpConnectionPool | null;
|
|
11
|
+
}
|
|
12
|
+
/** Set stall detection configuration */
|
|
13
|
+
export declare function setStallConfig(ctx: StallContext, config: Partial<StallConfig>): void;
|
|
14
|
+
/** Set stall detection configuration and resolve once the server has applied it. */
|
|
15
|
+
export declare function setStallConfigAsync(ctx: StallContext, config: Partial<StallConfig>): Promise<void>;
|
|
16
|
+
/** Get stall detection configuration */
|
|
17
|
+
export declare function getStallConfig(ctx: StallContext): StallConfig;
|
|
18
|
+
/** Get stall detection configuration (async, works in TCP mode) */
|
|
19
|
+
export declare function getStallConfigAsync(ctx: StallContext): Promise<StallConfig>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TcpConnectionPool } from "../../tcpPool.js";
|
|
2
|
+
import type { GetDependenciesOpts, JobDependencies, JobDependenciesCount, JobOptions, JobStateType, QueueOptions } from "../../types.js";
|
|
3
|
+
export interface ExtendedJobOptions extends JobOptions {
|
|
4
|
+
ttl?: number;
|
|
5
|
+
dependsOn?: string[];
|
|
6
|
+
tags?: string[];
|
|
7
|
+
groupId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AddContext {
|
|
10
|
+
name: string;
|
|
11
|
+
opts: QueueOptions;
|
|
12
|
+
embedded: boolean;
|
|
13
|
+
tcp: TcpConnectionPool | null;
|
|
14
|
+
getJobState: (id: string) => Promise<JobStateType>;
|
|
15
|
+
removeAsync: (id: string) => Promise<void>;
|
|
16
|
+
retryJob: (id: string) => Promise<void>;
|
|
17
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
18
|
+
updateJobData: (id: string, data: unknown) => Promise<void>;
|
|
19
|
+
promoteJob: (id: string) => Promise<void>;
|
|
20
|
+
changeJobDelay: (id: string, delay: number) => Promise<void>;
|
|
21
|
+
changeJobPriority: (id: string, opts: {
|
|
22
|
+
priority: number;
|
|
23
|
+
lifo?: boolean;
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
extendJobLock: (id: string, token: string, duration: number) => Promise<number>;
|
|
26
|
+
clearJobLogs: (id: string, keepLogs?: number) => Promise<void>;
|
|
27
|
+
getJobDependencies: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependencies>;
|
|
28
|
+
getJobDependenciesCount: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependenciesCount>;
|
|
29
|
+
moveJobToCompleted: (id: string, result: unknown, token?: string) => Promise<unknown>;
|
|
30
|
+
moveJobToFailed: (id: string, error: Error, token?: string) => Promise<void>;
|
|
31
|
+
moveJobToWait: (id: string, token?: string) => Promise<boolean>;
|
|
32
|
+
moveJobToDelayed: (id: string, timestamp: number, token?: string) => Promise<void>;
|
|
33
|
+
moveJobToWaitingChildren: (id: string, token?: string, opts?: {
|
|
34
|
+
child?: {
|
|
35
|
+
id: string;
|
|
36
|
+
queue: string;
|
|
37
|
+
};
|
|
38
|
+
}) => Promise<boolean>;
|
|
39
|
+
waitJobUntilFinished: (id: string, queueEvents: unknown, ttl?: number) => Promise<unknown>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue Internal Types
|
|
3
|
+
* Shared types for queue module operations
|
|
4
|
+
*/
|
|
5
|
+
import type { TcpConnectionPool } from "../../tcpPool.js";
|
|
6
|
+
import type { JobStateType, QueueOptions } from "../../types.js";
|
|
7
|
+
/** Internal queue context for operations */
|
|
8
|
+
export interface QueueContext {
|
|
9
|
+
name: string;
|
|
10
|
+
opts: QueueOptions;
|
|
11
|
+
embedded: boolean;
|
|
12
|
+
tcp: TcpConnectionPool | null;
|
|
13
|
+
getJobState: (id: string) => Promise<JobStateType>;
|
|
14
|
+
removeAsync: (id: string) => Promise<void>;
|
|
15
|
+
retryJob: (id: string) => Promise<void>;
|
|
16
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
17
|
+
}
|
|
18
|
+
/** Job creation context for proxy */
|
|
19
|
+
export interface JobCreationContext {
|
|
20
|
+
queueName: string;
|
|
21
|
+
tcp: TcpConnectionPool | null;
|
|
22
|
+
getJobState: (id: string) => Promise<string>;
|
|
23
|
+
removeAsync: (id: string) => Promise<void>;
|
|
24
|
+
retryJob: (id: string) => Promise<void>;
|
|
25
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
26
|
+
}
|
|
27
|
+
/** TCP response with optional data */
|
|
28
|
+
export interface TcpResponse {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
data?: unknown;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TcpConnectionPool } from "../../tcpPool.js";
|
|
2
|
+
import type { JobOptions, JobStateType } from "../../types.js";
|
|
3
|
+
export interface JobProxyContext {
|
|
4
|
+
queueName: string;
|
|
5
|
+
tcp: TcpConnectionPool;
|
|
6
|
+
getJobState: (id: string) => Promise<JobStateType>;
|
|
7
|
+
removeAsync: (id: string) => Promise<void>;
|
|
8
|
+
retryJob: (id: string) => Promise<void>;
|
|
9
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
10
|
+
}
|
|
11
|
+
export interface JobReflectionMeta {
|
|
12
|
+
attemptsMade?: number;
|
|
13
|
+
attemptsStarted?: number;
|
|
14
|
+
progress?: number;
|
|
15
|
+
stalledCounter?: number;
|
|
16
|
+
priority?: number;
|
|
17
|
+
delay?: number;
|
|
18
|
+
processedOn?: number;
|
|
19
|
+
finishedOn?: number;
|
|
20
|
+
opts?: JobOptions;
|
|
21
|
+
timestamp?: number;
|
|
22
|
+
stacktrace?: string[] | null;
|
|
23
|
+
returnvalue?: unknown;
|
|
24
|
+
failedReason?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ReflectedFields {
|
|
27
|
+
delay: number;
|
|
28
|
+
priority: number;
|
|
29
|
+
opts: JobOptions;
|
|
30
|
+
deduplicationId: string | undefined;
|
|
31
|
+
parentKey: string | undefined;
|
|
32
|
+
parent: {
|
|
33
|
+
id: string;
|
|
34
|
+
queueQualifiedName: string;
|
|
35
|
+
} | undefined;
|
|
36
|
+
repeatJobKey: string | undefined;
|
|
37
|
+
stacktrace: string[] | null;
|
|
38
|
+
returnvalue: unknown;
|
|
39
|
+
failedReason: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface SimpleJobContext {
|
|
42
|
+
queueName: string;
|
|
43
|
+
embedded?: boolean;
|
|
44
|
+
tcp?: TcpConnectionPool | null;
|
|
45
|
+
getJobState: (id: string) => Promise<JobStateType>;
|
|
46
|
+
removeAsync: (id: string) => Promise<void>;
|
|
47
|
+
retryJob: (id: string) => Promise<void>;
|
|
48
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
49
|
+
meta?: JobReflectionMeta;
|
|
50
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ChangePriorityOpts, GetDependenciesOpts, Job, JobDependencies, JobDependenciesCount, JobStateType } from "../../types.js";
|
|
2
|
+
/** Internal contract used by context callbacks across the Queue runtime layers. */
|
|
3
|
+
export interface QueueRuntime<T> {
|
|
4
|
+
getJobState(id: string): Promise<JobStateType>;
|
|
5
|
+
removeAsync(id: string): Promise<void>;
|
|
6
|
+
retryJob(id: string): Promise<void>;
|
|
7
|
+
getChildrenValues(id: string): Promise<Record<string, unknown>>;
|
|
8
|
+
updateJobData(id: string, data: unknown): Promise<void>;
|
|
9
|
+
promoteJob(id: string): Promise<void>;
|
|
10
|
+
changeJobDelay(id: string, delay: number): Promise<void>;
|
|
11
|
+
changeJobPriority(id: string, opts: ChangePriorityOpts): Promise<void>;
|
|
12
|
+
extendJobLock(id: string, token: string, duration: number): Promise<number>;
|
|
13
|
+
clearJobLogs(id: string, keepLogs?: number): Promise<void>;
|
|
14
|
+
getJobDependencies(id: string, opts?: GetDependenciesOpts): Promise<JobDependencies>;
|
|
15
|
+
getJobDependenciesCount(id: string, opts?: GetDependenciesOpts): Promise<JobDependenciesCount>;
|
|
16
|
+
getJobCountsAsync(): Promise<unknown>;
|
|
17
|
+
getJobsAsync(options: {
|
|
18
|
+
state?: string | string[];
|
|
19
|
+
start?: number;
|
|
20
|
+
end?: number;
|
|
21
|
+
asc?: boolean;
|
|
22
|
+
}): Promise<Job<T>[]>;
|
|
23
|
+
moveJobToCompleted(id: string, result: unknown, token?: string): Promise<unknown>;
|
|
24
|
+
moveJobToFailed(id: string, error: Error, token?: string): Promise<void>;
|
|
25
|
+
moveJobToWait(id: string, token?: string): Promise<boolean>;
|
|
26
|
+
moveJobToDelayed(id: string, timestamp: number, token?: string): Promise<void>;
|
|
27
|
+
moveJobToWaitingChildren(id: string, token?: string, opts?: {
|
|
28
|
+
child?: {
|
|
29
|
+
id: string;
|
|
30
|
+
queue: string;
|
|
31
|
+
};
|
|
32
|
+
}): Promise<boolean>;
|
|
33
|
+
waitJobUntilFinished(id: string, queueEvents: unknown, ttl?: number): Promise<unknown>;
|
|
34
|
+
getWaitingAsync(start?: number, end?: number): Promise<Job<T>[]>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Query Operations
|
|
3
|
+
*/
|
|
4
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
5
|
+
import type { QueueMetrics, QueueMetricType } from "../../domain/types/metrics.js";
|
|
6
|
+
interface WorkersContext {
|
|
7
|
+
name: string;
|
|
8
|
+
embedded: boolean;
|
|
9
|
+
tcp: TcpConnectionPool | null;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkerInfo {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
addr?: string;
|
|
15
|
+
queues?: string[];
|
|
16
|
+
concurrency?: number;
|
|
17
|
+
hostname?: string;
|
|
18
|
+
pid?: number;
|
|
19
|
+
status?: 'active' | 'stale';
|
|
20
|
+
registeredAt?: number;
|
|
21
|
+
lastSeen?: number;
|
|
22
|
+
activeJobs?: number;
|
|
23
|
+
processedJobs?: number;
|
|
24
|
+
failedJobs?: number;
|
|
25
|
+
currentJob?: string | null;
|
|
26
|
+
uptime?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Get workers processing this queue */
|
|
29
|
+
export declare function getWorkers(ctx: WorkersContext): Promise<WorkerInfo[]>;
|
|
30
|
+
/** Get worker count */
|
|
31
|
+
export declare function getWorkersCount(ctx: WorkersContext): Promise<number>;
|
|
32
|
+
/** Get metrics for this queue */
|
|
33
|
+
export declare function getMetrics(ctx: WorkersContext, type: QueueMetricType, start?: number, end?: number): Promise<QueueMetrics>;
|
|
34
|
+
/** Trim old events from this queue's durable lifecycle journal. */
|
|
35
|
+
export declare function trimEvents(ctx: WorkersContext, maxLength: number): Promise<number>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JobEvent } from "../../domain/types/queue.js";
|
|
2
|
+
import type { ConnectionOptions } from "../types.js";
|
|
3
|
+
interface TcpEventSubscriptionOptions {
|
|
4
|
+
connection?: ConnectionOptions;
|
|
5
|
+
onError: (error: Error) => void;
|
|
6
|
+
onEvent: (event: JobEvent) => void;
|
|
7
|
+
queue: string;
|
|
8
|
+
}
|
|
9
|
+
/** One dedicated TCP connection with one broker-side queue subscription. */
|
|
10
|
+
export declare class TcpEventSubscription {
|
|
11
|
+
private readonly client;
|
|
12
|
+
private readonly queue;
|
|
13
|
+
private readonly onError;
|
|
14
|
+
private closed;
|
|
15
|
+
private ready;
|
|
16
|
+
private generation;
|
|
17
|
+
private subscriptionPromise;
|
|
18
|
+
constructor(options: TcpEventSubscriptionOptions);
|
|
19
|
+
waitUntilReady(): Promise<void>;
|
|
20
|
+
close(): void;
|
|
21
|
+
private ensureSubscribed;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueueGroup - Namespace isolation for queues
|
|
3
|
+
*/
|
|
4
|
+
import { Queue } from "./queue.js";
|
|
5
|
+
import { Worker } from "./worker.js";
|
|
6
|
+
import type { QueueOptions, WorkerOptions, Processor } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* QueueGroup provides namespace isolation for queues.
|
|
9
|
+
* All queues in a group share a common prefix.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const billing = new QueueGroup('billing');
|
|
14
|
+
*
|
|
15
|
+
* const invoices = billing.getQueue('invoices');
|
|
16
|
+
* const payments = billing.getQueue('payments');
|
|
17
|
+
*
|
|
18
|
+
* // Creates queues: "billing:invoices", "billing:payments"
|
|
19
|
+
*
|
|
20
|
+
* billing.pauseAll(); // Pauses all billing queues
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class QueueGroup {
|
|
24
|
+
readonly prefix: string;
|
|
25
|
+
private readonly queues;
|
|
26
|
+
constructor(namespace: string);
|
|
27
|
+
/** Get a queue within this group */
|
|
28
|
+
getQueue<T = unknown>(name: string, opts?: QueueOptions): Queue<T>;
|
|
29
|
+
/** Create a worker for a queue in this group */
|
|
30
|
+
getWorker<T = unknown, R = unknown>(name: string, processor: Processor<T, R>, opts?: WorkerOptions): Worker<T, R>;
|
|
31
|
+
/** List all queues in this group */
|
|
32
|
+
listQueues(): string[];
|
|
33
|
+
/** Pause all queues in this group */
|
|
34
|
+
pauseAll(): void;
|
|
35
|
+
/** Resume all queues in this group */
|
|
36
|
+
resumeAll(): void;
|
|
37
|
+
/** Drain all queues in this group (remove waiting jobs) */
|
|
38
|
+
drainAll(): void;
|
|
39
|
+
/** Obliterate all queues in this group (remove all data) */
|
|
40
|
+
obliterateAll(): void;
|
|
41
|
+
/** List queues created through this group, including remote queues. */
|
|
42
|
+
listQueuesAsync(): Promise<string[]>;
|
|
43
|
+
/** Pause every queue created through this group. */
|
|
44
|
+
pauseAllAsync(): Promise<void>;
|
|
45
|
+
/** Resume every queue created through this group. */
|
|
46
|
+
resumeAllAsync(): Promise<void>;
|
|
47
|
+
/** Drain waiting jobs from every queue and return the aggregate count. */
|
|
48
|
+
drainAllAsync(): Promise<number>;
|
|
49
|
+
/** Remove all data from every queue created through this group. */
|
|
50
|
+
obliterateAllAsync(): Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve auth token with priority:
|
|
3
|
+
* 1. explicitToken (from connection.token) - highest
|
|
4
|
+
* 2. Bun.env.BQ_TOKEN
|
|
5
|
+
* 3. Bun.env.BUNQUEUE_TOKEN
|
|
6
|
+
* 4. undefined if none set
|
|
7
|
+
*
|
|
8
|
+
* Empty strings are treated as not set.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveToken(explicitToken: string | undefined): string | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandboxed Worker Module
|
|
3
|
+
* Re-exports all sandboxed worker components
|
|
4
|
+
*/
|
|
5
|
+
export type { SandboxedWorkerOptions, RequiredSandboxedWorkerOptions, WorkerProcess, IPCRequest, IPCResponse, } from "./types/index.js";
|
|
6
|
+
export { createWrapperScript, cleanupWrapperScript } from "./wrapper.js";
|
|
7
|
+
export { SandboxedWorker } from "./worker.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue Operations for SandboxedWorker
|
|
3
|
+
* Provides a unified interface for embedded and TCP mode queue operations
|
|
4
|
+
*/
|
|
5
|
+
import type { Job as DomainJob, JobId } from "../../domain/types/job.js";
|
|
6
|
+
import type { SharedManager } from "../manager.js";
|
|
7
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
8
|
+
/** Unified queue operations interface */
|
|
9
|
+
export interface QueueOps {
|
|
10
|
+
pull(queue: string, workerId: string, timeout: number): Promise<{
|
|
11
|
+
job: DomainJob | null;
|
|
12
|
+
token: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
ack(id: JobId, result: unknown, token?: string): Promise<boolean>;
|
|
15
|
+
fail(id: JobId, error: string, token?: string): Promise<boolean>;
|
|
16
|
+
updateProgress(id: JobId, progress: number): Promise<void>;
|
|
17
|
+
addLog(id: JobId, message: string): void;
|
|
18
|
+
sendHeartbeat(ids: string[], tokens: string[]): Promise<void>;
|
|
19
|
+
countWaiting(queue: string): Promise<number>;
|
|
20
|
+
}
|
|
21
|
+
/** Create embedded mode operations using shared QueueManager */
|
|
22
|
+
export declare function createEmbeddedOps(manager: SharedManager): QueueOps;
|
|
23
|
+
/** Create TCP mode operations using connection pool */
|
|
24
|
+
export declare function createTcpOps(tcp: TcpConnectionPool): QueueOps;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Job as DomainJob } from "../../../domain/types/job.js";
|
|
2
|
+
import type { Job } from "../../types.js";
|
|
3
|
+
import type { IPCResponse, WorkerProcess } from "../types/index.js";
|
|
4
|
+
import { SandboxedPool } from "./pool.js";
|
|
5
|
+
export declare abstract class SandboxedDispatch<T = unknown> extends SandboxedPool<T> {
|
|
6
|
+
protected dispatch(worker: WorkerProcess, job: DomainJob, token: string | null): void;
|
|
7
|
+
protected handleMessage(worker: WorkerProcess, message: IPCResponse): void;
|
|
8
|
+
protected complete(worker: WorkerProcess, result: unknown): Promise<void>;
|
|
9
|
+
protected fail(worker: WorkerProcess, error: string): Promise<void>;
|
|
10
|
+
protected handleTimeout(worker: WorkerProcess, job: DomainJob): Promise<void>;
|
|
11
|
+
protected abstract safeEmitError(error: Error): void;
|
|
12
|
+
protected abstract createEventJob(domainJob: DomainJob): Job;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WorkerProcess } from "../types/index.js";
|
|
2
|
+
import { SandboxedState } from "./state.js";
|
|
3
|
+
export declare abstract class SandboxedLifecycle<T = unknown> extends SandboxedState<T> {
|
|
4
|
+
start(): Promise<void>;
|
|
5
|
+
stop(force?: boolean): Promise<void>;
|
|
6
|
+
protected stopAndWatch(): Promise<void>;
|
|
7
|
+
protected checkAndRestart(): Promise<void>;
|
|
8
|
+
isRunning(): boolean;
|
|
9
|
+
getStats(): {
|
|
10
|
+
total: number;
|
|
11
|
+
busy: number;
|
|
12
|
+
idle: number;
|
|
13
|
+
recycled: number;
|
|
14
|
+
restarts: number;
|
|
15
|
+
};
|
|
16
|
+
protected resetWorkerState(worker: WorkerProcess): void;
|
|
17
|
+
protected abstract spawnWorker(index: number): Promise<void>;
|
|
18
|
+
protected abstract pullLoop(): Promise<void>;
|
|
19
|
+
protected abstract startHeartbeat(): void;
|
|
20
|
+
}
|