bunqueue-client 0.1.9 → 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 +150 -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} +5 -5
- 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 +8 -6
- 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 -107
- 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,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlowProducer Types
|
|
3
|
+
* Type definitions for job flows and pipelines
|
|
4
|
+
*/
|
|
5
|
+
import type { Job, JobOptions, ConnectionOptions } from "./types.js";
|
|
6
|
+
/** FlowProducer options */
|
|
7
|
+
export interface FlowProducerOptions {
|
|
8
|
+
/** Use embedded mode (no server) */
|
|
9
|
+
embedded?: boolean;
|
|
10
|
+
/** TCP connection options */
|
|
11
|
+
connection?: ConnectionOptions;
|
|
12
|
+
}
|
|
13
|
+
/** Step definition in a flow (legacy bunqueue API) */
|
|
14
|
+
export interface FlowStep<T = unknown> {
|
|
15
|
+
/** Job name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Queue name */
|
|
18
|
+
queueName: string;
|
|
19
|
+
/** Job data */
|
|
20
|
+
data: T;
|
|
21
|
+
/** Job options */
|
|
22
|
+
opts?: JobOptions;
|
|
23
|
+
/** Child steps (for tree structures) */
|
|
24
|
+
children?: FlowStep<T>[];
|
|
25
|
+
}
|
|
26
|
+
/** Result of adding a flow (legacy bunqueue API) */
|
|
27
|
+
export interface FlowResult {
|
|
28
|
+
/** Job IDs in order */
|
|
29
|
+
jobIds: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* FlowJob - BullMQ v5 compatible flow job definition.
|
|
33
|
+
* Children are processed BEFORE the parent.
|
|
34
|
+
*/
|
|
35
|
+
export interface FlowJob<T = unknown> {
|
|
36
|
+
/** Job name */
|
|
37
|
+
name: string;
|
|
38
|
+
/** Queue name */
|
|
39
|
+
queueName: string;
|
|
40
|
+
/** Job data */
|
|
41
|
+
data?: T;
|
|
42
|
+
/** Job options */
|
|
43
|
+
opts?: JobOptions;
|
|
44
|
+
/** Child jobs (processed BEFORE this job) */
|
|
45
|
+
children?: FlowJob<T>[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* JobNode - BullMQ v5 compatible result from adding a flow.
|
|
49
|
+
* Contains the job and its children nodes.
|
|
50
|
+
*/
|
|
51
|
+
export interface JobNode<T = unknown> {
|
|
52
|
+
/** The job instance */
|
|
53
|
+
job: Job<T>;
|
|
54
|
+
/** Child nodes (if any) */
|
|
55
|
+
children?: JobNode<T>[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Options for getFlow method (BullMQ v5 compatible).
|
|
59
|
+
*/
|
|
60
|
+
export interface GetFlowOpts {
|
|
61
|
+
/** Job ID to get the flow for */
|
|
62
|
+
id: string;
|
|
63
|
+
/** Queue name where the job is located */
|
|
64
|
+
queueName: string;
|
|
65
|
+
/** Maximum depth to traverse (default: unlimited) */
|
|
66
|
+
depth?: number;
|
|
67
|
+
/** Maximum number of children to fetch per level (default: unlimited) */
|
|
68
|
+
maxChildren?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* FlowOpts - BullMQ v5 compatible options for flow creation.
|
|
72
|
+
* Allows setting default job options per queue when adding flows.
|
|
73
|
+
*/
|
|
74
|
+
export interface FlowOpts {
|
|
75
|
+
/** Default job options per queue name. Set `jobId` on the individual flow node. */
|
|
76
|
+
queuesOptions?: Record<string, Omit<Partial<JobOptions>, 'jobId'>>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forwarder — store-and-forward from a local (edge) queue to a remote
|
|
3
|
+
* bunqueue server.
|
|
4
|
+
*
|
|
5
|
+
* The edge pattern: jobs buffer in the local queue (typically embedded
|
|
6
|
+
* SQLite on a gateway); the Forwarder drains them to a central server over
|
|
7
|
+
* TCP/TLS. A remote failure makes the local job fail → local retry/backoff →
|
|
8
|
+
* local DLQ. With a persistent local `dataPath`, queued work survives uplink
|
|
9
|
+
* outages and process restarts; memory-only sources provide no such guarantee.
|
|
10
|
+
*
|
|
11
|
+
* Idempotency: every forwarded job carries the deterministic remote jobId
|
|
12
|
+
* `fwd:<localQueueKey>:<localJobId>`. The server dedupes custom jobIds while
|
|
13
|
+
* their ownership is retained; after bounded retention or removal, downstream
|
|
14
|
+
* effects must still tolerate at-least-once delivery.
|
|
15
|
+
*/
|
|
16
|
+
import { EventEmitter } from 'events';
|
|
17
|
+
import type { ConnectionOptions, QueueOptions } from "./types.js";
|
|
18
|
+
/** Options for queue.forward() */
|
|
19
|
+
export interface ForwardOptions {
|
|
20
|
+
/** Remote server connection (host/port/tls/token...) */
|
|
21
|
+
to: ConnectionOptions;
|
|
22
|
+
/** Remote queue name (default: same as the source queue) */
|
|
23
|
+
queue?: string;
|
|
24
|
+
/** Parallel forwards (default: 4) */
|
|
25
|
+
concurrency?: number;
|
|
26
|
+
/** Push with durable: true (bypasses SQLite buffering; PostgreSQL is already transactional). */
|
|
27
|
+
durable?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Source queue identity + config, provided by Queue.forward() */
|
|
30
|
+
export interface ForwardSource {
|
|
31
|
+
/** Logical source queue name */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Source queue key (prefixKey + name) — used in the deterministic jobId */
|
|
34
|
+
queueKey: string;
|
|
35
|
+
prefixKey?: string;
|
|
36
|
+
embedded: boolean;
|
|
37
|
+
dataPath?: string;
|
|
38
|
+
connection?: ConnectionOptions;
|
|
39
|
+
}
|
|
40
|
+
/** Minimal remote-queue surface the Forwarder needs (avoids a Queue import cycle) */
|
|
41
|
+
interface RemoteQueueLike {
|
|
42
|
+
add(name: string, data: unknown, opts?: {
|
|
43
|
+
jobId?: string;
|
|
44
|
+
priority?: number;
|
|
45
|
+
durable?: boolean;
|
|
46
|
+
}): Promise<unknown>;
|
|
47
|
+
close(): Promise<void> | void;
|
|
48
|
+
}
|
|
49
|
+
/** Constructor for the remote queue, injected by Queue.forward() */
|
|
50
|
+
export type RemoteQueueCtor = new (name: string, opts: QueueOptions) => RemoteQueueLike;
|
|
51
|
+
/** Info emitted with each 'forwarded' event */
|
|
52
|
+
export interface ForwardedInfo {
|
|
53
|
+
/** Local job id */
|
|
54
|
+
id: string;
|
|
55
|
+
/** Deterministic remote job id (fwd:<queueKey>:<id>) */
|
|
56
|
+
remoteId: string;
|
|
57
|
+
/** Job name */
|
|
58
|
+
name: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Drains a local queue into a remote bunqueue server.
|
|
62
|
+
* Create via `queue.forward(options)`; stop with `close()`.
|
|
63
|
+
*/
|
|
64
|
+
export declare class Forwarder extends EventEmitter {
|
|
65
|
+
on(event: 'forwarded', listener: (info: ForwardedInfo) => void): this;
|
|
66
|
+
on(event: 'error', listener: (error: Error) => void): this;
|
|
67
|
+
private readonly remote;
|
|
68
|
+
private readonly worker;
|
|
69
|
+
private closed;
|
|
70
|
+
constructor(source: ForwardSource, options: ForwardOptions, RemoteQueue: RemoteQueueCtor);
|
|
71
|
+
/** Stop forwarding and release connections. Safe to call more than once. */
|
|
72
|
+
close(): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { normalizeGroupId } from "../domain/types/group.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bunqueue Client API
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { Queue, Worker } from 'bunqueue/client';
|
|
7
|
+
*
|
|
8
|
+
* const queue = new Queue('emails');
|
|
9
|
+
* await queue.add('send', { to: 'user@test.com' });
|
|
10
|
+
*
|
|
11
|
+
* const worker = new Worker('emails', async (job) => {
|
|
12
|
+
* await job.updateProgress(50);
|
|
13
|
+
* await job.log('Processing...');
|
|
14
|
+
* return { success: true };
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* worker.on('completed', (job, result) => console.log(result));
|
|
18
|
+
* worker.on('progress', (job, progress) => console.log(progress));
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import "../require-bun.js";
|
|
22
|
+
export { defineConfig } from "../config/index.js";
|
|
23
|
+
export type { BunqueueConfig } from "../config/index.js";
|
|
24
|
+
export { Queue } from "./queue.js";
|
|
25
|
+
export { Worker } from "./worker.js";
|
|
26
|
+
export type { ManualJob } from "./worker/types/index.js";
|
|
27
|
+
export { Bunqueue } from "./bunqueue.js";
|
|
28
|
+
export type { BunqueueOptions, BunqueueMiddleware, RetryStrategy, RetryConfig, CircuitBreakerConfig, TriggerRule, PriorityAgingConfig, BatchProcessor, BatchConfig, JobTtlConfig, BunqueueDeduplicationConfig, BunqueueDebounceConfig, BunqueueDlqConfig, } from "./bunqueue.js";
|
|
29
|
+
export { SandboxedWorker } from "./sandboxedWorker.js";
|
|
30
|
+
export { Forwarder } from "./forwarder.js";
|
|
31
|
+
export type { ForwardOptions, ForwardedInfo } from "./forwarder.js";
|
|
32
|
+
export { QueueEvents } from "./events.js";
|
|
33
|
+
export { QueuePro, WorkerPro, QueueEventsPro } from "./pro.js";
|
|
34
|
+
export type { JobPro } from "./pro.js";
|
|
35
|
+
export type { ActiveEvent, CompletedEvent, DelayedEvent, DrainedEvent, DuplicatedEvent, FailedEvent, ProgressEvent, QueueEventsOptions, RemovedEvent, RetriedEvent, StalledEvent, WaitingChildrenEvent, WaitingEvent, } from "./types/events.js";
|
|
36
|
+
export { QueueGroup } from "./queueGroup.js";
|
|
37
|
+
export { FlowProducer } from "./flow.js";
|
|
38
|
+
export { UnrecoverableError, DelayedError, RateLimitError } from "./errors.js";
|
|
39
|
+
export { shutdownManager } from "./manager.js";
|
|
40
|
+
export { closeSharedTcpClient } from "./tcpClient.js";
|
|
41
|
+
export type { ConnectionHealth } from "./tcpClient.js";
|
|
42
|
+
export { TcpConnectionPool, getSharedPool, closeAllSharedPools } from "./tcpPool.js";
|
|
43
|
+
export type { Job, JobOptions, GroupJobOptions, GroupWorkerOptions, BatchWorkerOptions, JobJson, JobJsonRaw, QueueOptions, WorkerOptions, Processor, ProcessorContext, ObservableLike, FlowJobData, StallConfig, DlqConfig, DlqEntry, DlqStats, DlqFilter, FailureReason, ConnectionOptions, ParentOpts, RateLimiterOptions, ChangePriorityOpts, GetDependenciesOpts, JobDependencies, JobDependenciesCount, QueueMetrics, QueueMetricsMeta, QueueMetricType, } from "./types.js";
|
|
44
|
+
export type { FlowStep, FlowResult, FlowJob, JobNode, FlowProducerOptions, FlowOpts } from "./flow.js";
|
|
45
|
+
export type { RepeatOpts, JobTemplate, SchedulerInfo } from "./queue/scheduler.js";
|
|
46
|
+
export type { SandboxedWorkerOptions } from "./sandboxedWorker.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DlqEntry as InternalDlqEntry } from "../domain/types/dlq.js";
|
|
2
|
+
import type { Job, DlqEntry } from "./types.js";
|
|
3
|
+
import type { CreatePublicJobOptions, PublicJobMethodContext, ToPublicJobOptions } from "./jobConversionTypes.js";
|
|
4
|
+
export type { CreatePublicJobOptions, PublicJobMethodContext, ToPublicJobOptions, } from "./jobConversionTypes.js";
|
|
5
|
+
/** Convert internal job to public job (with methods) */
|
|
6
|
+
export declare function createPublicJob<T>(opts: CreatePublicJobOptions): Job<T>;
|
|
7
|
+
/** Simple public job without methods (for Queue.getJob) */
|
|
8
|
+
export declare function toPublicJob<T>(opts: ToPublicJobOptions): Job<T>;
|
|
9
|
+
/** Convert internal DLQ entry to public DLQ entry */
|
|
10
|
+
export declare function toDlqEntry<T>(entry: InternalDlqEntry, methods: PublicJobMethodContext): DlqEntry<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Conversion Helpers
|
|
3
|
+
* Builder functions for constructing public job properties
|
|
4
|
+
*/
|
|
5
|
+
import type { Job as InternalJob } from "../domain/types/job.js";
|
|
6
|
+
import type { Job, JobStateType, JobOptions, GetDependenciesOpts, JobDependenciesCount } from "./types.js";
|
|
7
|
+
interface JobPropertyOptions {
|
|
8
|
+
stacktrace?: string[] | null;
|
|
9
|
+
token?: string;
|
|
10
|
+
processedBy?: string;
|
|
11
|
+
returnvalue?: unknown;
|
|
12
|
+
failedReason?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Build common job properties from internal job */
|
|
15
|
+
export declare function buildJobProperties<T>(job: InternalJob, name: string, options?: JobPropertyOptions): Pick<Job<T>, 'id' | 'name' | 'data' | 'queueName' | 'attemptsMade' | 'timestamp' | 'progress' | 'parent' | 'delay' | 'processedOn' | 'finishedOn' | 'stacktrace' | 'returnvalue' | 'failedReason' | 'stalledCounter' | 'priority' | 'parentKey' | 'opts' | 'token' | 'processedBy' | 'deduplicationId' | 'repeatJobKey' | 'attemptsStarted'>;
|
|
16
|
+
/** Build state check methods */
|
|
17
|
+
export declare function buildStateCheckMethods(id: string, getState?: (id: string) => Promise<JobStateType>, _getDependenciesCount?: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependenciesCount>): Pick<Job, 'isWaiting' | 'isActive' | 'isDelayed' | 'isCompleted' | 'isFailed' | 'isWaitingChildren'>;
|
|
18
|
+
interface JobSerializationOptions {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
jobOpts: JobOptions;
|
|
22
|
+
stacktrace?: string[] | null;
|
|
23
|
+
returnvalue?: unknown;
|
|
24
|
+
failedReason?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Build serialization methods */
|
|
27
|
+
export declare function buildSerializationMethods<T>(job: InternalJob, options: JobSerializationOptions): Pick<Job<T>, 'toJSON' | 'asJSON'>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Conversion Types
|
|
3
|
+
* Interfaces for job conversion options
|
|
4
|
+
*/
|
|
5
|
+
import type { Job as InternalJob } from "../domain/types/job.js";
|
|
6
|
+
import type { JobStateType, ChangePriorityOpts, GetDependenciesOpts, JobDependencies, JobDependenciesCount } from "./types.js";
|
|
7
|
+
/** Options for creating a public job */
|
|
8
|
+
export interface CreatePublicJobOptions {
|
|
9
|
+
job: InternalJob;
|
|
10
|
+
name: string;
|
|
11
|
+
updateProgress: (id: string, progress: number, message?: string) => Promise<void>;
|
|
12
|
+
log: (id: string, message: string) => Promise<void>;
|
|
13
|
+
getState?: (id: string) => Promise<JobStateType>;
|
|
14
|
+
remove?: (id: string) => Promise<void>;
|
|
15
|
+
retry?: (id: string) => Promise<void>;
|
|
16
|
+
getChildrenValues?: (id: string) => Promise<Record<string, unknown>>;
|
|
17
|
+
updateData?: (id: string, data: unknown) => Promise<void>;
|
|
18
|
+
promote?: (id: string) => Promise<void>;
|
|
19
|
+
changeDelay?: (id: string, delay: number) => Promise<void>;
|
|
20
|
+
changePriority?: (id: string, opts: ChangePriorityOpts) => Promise<void>;
|
|
21
|
+
extendLock?: (id: string, token: string, duration: number) => Promise<number>;
|
|
22
|
+
clearLogs?: (id: string, keepLogs?: number) => Promise<void>;
|
|
23
|
+
getDependencies?: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependencies>;
|
|
24
|
+
getDependenciesCount?: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependenciesCount>;
|
|
25
|
+
moveToCompleted?: (id: string, returnValue: unknown, token?: string) => Promise<unknown>;
|
|
26
|
+
moveToFailed?: (id: string, error: Error, token?: string) => Promise<void>;
|
|
27
|
+
moveToWait?: (id: string, token?: string) => Promise<boolean>;
|
|
28
|
+
moveToDelayed?: (id: string, timestamp: number, token?: string) => Promise<void>;
|
|
29
|
+
moveToWaitingChildren?: (id: string, token?: string, opts?: {
|
|
30
|
+
child?: {
|
|
31
|
+
id: string;
|
|
32
|
+
queue: string;
|
|
33
|
+
};
|
|
34
|
+
}) => Promise<boolean>;
|
|
35
|
+
waitUntilFinished?: (id: string, queueEvents: unknown, ttl?: number) => Promise<unknown>;
|
|
36
|
+
discard?: (id: string) => void;
|
|
37
|
+
getFailedChildrenValues?: (id: string) => Promise<Record<string, string>>;
|
|
38
|
+
getIgnoredChildrenFailures?: (id: string) => Promise<Record<string, string>>;
|
|
39
|
+
removeChildDependency?: (id: string) => Promise<boolean>;
|
|
40
|
+
removeDeduplicationKey?: (id: string) => Promise<boolean>;
|
|
41
|
+
removeUnprocessedChildren?: (id: string) => Promise<void>;
|
|
42
|
+
token?: string;
|
|
43
|
+
processedBy?: string;
|
|
44
|
+
stacktrace?: string[] | null;
|
|
45
|
+
returnvalue?: unknown;
|
|
46
|
+
failedReason?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Complete operation set required when exposing a live job from another view. */
|
|
49
|
+
export type PublicJobMethodContext = Required<Omit<CreatePublicJobOptions, 'job' | 'name' | 'token' | 'processedBy' | 'stacktrace' | 'returnvalue' | 'failedReason'>>;
|
|
50
|
+
/** Options for creating a simple public job */
|
|
51
|
+
export interface ToPublicJobOptions {
|
|
52
|
+
job: InternalJob;
|
|
53
|
+
name: string;
|
|
54
|
+
updateProgress?: (id: string, progress: number, message?: string) => Promise<void>;
|
|
55
|
+
log?: (id: string, message: string) => Promise<void>;
|
|
56
|
+
getState?: (id: string) => Promise<JobStateType>;
|
|
57
|
+
remove?: (id: string) => Promise<void>;
|
|
58
|
+
retry?: (id: string) => Promise<void>;
|
|
59
|
+
getChildrenValues?: (id: string) => Promise<Record<string, unknown>>;
|
|
60
|
+
updateData?: (id: string, data: unknown) => Promise<void>;
|
|
61
|
+
promote?: (id: string) => Promise<void>;
|
|
62
|
+
changeDelay?: (id: string, delay: number) => Promise<void>;
|
|
63
|
+
changePriority?: (id: string, opts: ChangePriorityOpts) => Promise<void>;
|
|
64
|
+
extendLock?: (id: string, token: string, duration: number) => Promise<number>;
|
|
65
|
+
clearLogs?: (id: string, keepLogs?: number) => Promise<void>;
|
|
66
|
+
getDependencies?: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependencies>;
|
|
67
|
+
getDependenciesCount?: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependenciesCount>;
|
|
68
|
+
moveToCompleted?: (id: string, returnValue: unknown, token?: string) => Promise<unknown>;
|
|
69
|
+
moveToFailed?: (id: string, error: Error, token?: string) => Promise<void>;
|
|
70
|
+
moveToWait?: (id: string, token?: string) => Promise<boolean>;
|
|
71
|
+
moveToDelayed?: (id: string, timestamp: number, token?: string) => Promise<void>;
|
|
72
|
+
moveToWaitingChildren?: (id: string, token?: string, opts?: {
|
|
73
|
+
child?: {
|
|
74
|
+
id: string;
|
|
75
|
+
queue: string;
|
|
76
|
+
};
|
|
77
|
+
}) => Promise<boolean>;
|
|
78
|
+
waitUntilFinished?: (id: string, queueEvents: unknown, ttl?: number) => Promise<unknown>;
|
|
79
|
+
discard?: (id: string) => void;
|
|
80
|
+
getFailedChildrenValues?: (id: string) => Promise<Record<string, string>>;
|
|
81
|
+
getIgnoredChildrenFailures?: (id: string) => Promise<Record<string, string>>;
|
|
82
|
+
removeChildDependency?: (id: string) => Promise<boolean>;
|
|
83
|
+
removeDeduplicationKey?: (id: string) => Promise<boolean>;
|
|
84
|
+
removeUnprocessedChildren?: (id: string) => Promise<void>;
|
|
85
|
+
stacktrace?: string[] | null;
|
|
86
|
+
returnvalue?: unknown;
|
|
87
|
+
failedReason?: string;
|
|
88
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface CommandTransport {
|
|
2
|
+
send(command: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3
|
+
}
|
|
4
|
+
/** Remove only the deduplication key currently owned by the given job. */
|
|
5
|
+
export declare function removeJobDeduplicationKey(id: string, embedded: boolean, transport: CommandTransport | null | undefined): Promise<boolean>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Helper Functions
|
|
3
|
+
* Internal utilities for extracting and building job data
|
|
4
|
+
*/
|
|
5
|
+
import { type Job as InternalJob } from "../domain/types/job.js";
|
|
6
|
+
import type { RepeatOptions, JobOptions } from "./types.js";
|
|
7
|
+
/** Decode a bare pre-name-field payload. Modern conversions use normalizeJobPayload(job). */
|
|
8
|
+
export declare function extractUserData(jobData: unknown): unknown;
|
|
9
|
+
/** Resolve legacy names while preserving documented engine-owned flow metadata. */
|
|
10
|
+
export declare function resolvePublicJobPayload(job: InternalJob): {
|
|
11
|
+
name: string;
|
|
12
|
+
data: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** Extract parent info from job data if present */
|
|
15
|
+
export declare function extractParent(jobData: unknown): {
|
|
16
|
+
id: string;
|
|
17
|
+
queueQualifiedName: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
/** Build repeat options from internal job repeat config */
|
|
20
|
+
export declare function buildRepeatOpts(repeat: InternalJob['repeat']): RepeatOptions | undefined;
|
|
21
|
+
/** Build parent reference from job data */
|
|
22
|
+
export declare function buildParentOpts(job: InternalJob): {
|
|
23
|
+
id: string;
|
|
24
|
+
queue: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
/** Build JobOptions from internal job */
|
|
27
|
+
export declare function buildJobOpts(job: InternalJob): JobOptions;
|
|
28
|
+
/** Build parent key from job */
|
|
29
|
+
export declare function buildParentKey(job: InternalJob): string | undefined;
|
|
30
|
+
/** Build repeat job key from job */
|
|
31
|
+
export declare function buildRepeatJobKey(job: InternalJob): string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throw when TCP-mode options carry flat connection keys.
|
|
3
|
+
* @param owner - Class name shown in the error message.
|
|
4
|
+
* @param options - Caller-supplied options object.
|
|
5
|
+
* @param embedded - True when the caller selected embedded mode, where no
|
|
6
|
+
* connection is made and the keys are irrelevant.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rejectLegacyConnectionOptions(owner: string, options: object | undefined, embedded: boolean): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared QueueManager singleton
|
|
3
|
+
*/
|
|
4
|
+
import { QueueManager } from "../application/queueManager.js";
|
|
5
|
+
/** Shared manager type export */
|
|
6
|
+
export type SharedManager = QueueManager;
|
|
7
|
+
/**
|
|
8
|
+
* Get the process-wide QueueManager.
|
|
9
|
+
* A later explicit dataPath must identify the database selected on first use.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getSharedManager(dataPath?: string): QueueManager;
|
|
12
|
+
/** Shutdown shared manager */
|
|
13
|
+
/** Inspect an existing manager without initializing an embedded runtime. */
|
|
14
|
+
export declare function peekSharedManager(): SharedManager | null;
|
|
15
|
+
export declare function shutdownManager(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Queue } from "./queue.js";
|
|
2
|
+
import { Worker } from "./worker.js";
|
|
3
|
+
import { QueueEvents } from "./events.js";
|
|
4
|
+
import type { Job } from "./types.js";
|
|
5
|
+
/** BullMQ Pro-compatible import aliases backed by bunqueue's native implementations. */
|
|
6
|
+
export declare const QueuePro: typeof Queue;
|
|
7
|
+
export declare const WorkerPro: typeof Worker;
|
|
8
|
+
export declare const QueueEventsPro: typeof QueueEvents;
|
|
9
|
+
export type JobPro<T = unknown> = Job<T>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add Batcher
|
|
3
|
+
* Batches queue.add() calls for efficient TCP communication via PUSHB
|
|
4
|
+
*
|
|
5
|
+
* Strategy: if no flush is in-flight, send immediately (zero overhead for
|
|
6
|
+
* sequential await). If a flush IS in-flight, buffer and send when it
|
|
7
|
+
* completes or after maxDelayMs, whichever comes first. This gives both
|
|
8
|
+
* zero-latency sequential adds AND automatic batching for concurrent adds.
|
|
9
|
+
*/
|
|
10
|
+
import type { Job, JobOptions } from "../types.js";
|
|
11
|
+
/** Add batcher configuration */
|
|
12
|
+
export interface AddBatcherConfig {
|
|
13
|
+
/** Max items before auto-flush (default: 50) */
|
|
14
|
+
maxSize: number;
|
|
15
|
+
/** Max delay in ms before auto-flush (default: 5) */
|
|
16
|
+
maxDelayMs: number;
|
|
17
|
+
/** Max pending items before overflow protection (default: 10000) */
|
|
18
|
+
maxPending?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Flush callback that sends a batch and returns Job objects */
|
|
21
|
+
export type FlushCallback<T> = (jobs: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
data: T;
|
|
24
|
+
opts?: JobOptions;
|
|
25
|
+
}>) => Promise<Job<T>[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Batches add() operations into addBulk() calls for efficient TCP throughput.
|
|
28
|
+
*
|
|
29
|
+
* - If no flush is in-flight: flushes immediately (no timer delay)
|
|
30
|
+
* - If a flush IS in-flight: buffers until maxSize or maxDelayMs
|
|
31
|
+
* - After each flush completes: drains any accumulated buffer immediately
|
|
32
|
+
*/
|
|
33
|
+
export declare class AddBatcher<T> {
|
|
34
|
+
private readonly maxPending;
|
|
35
|
+
private readonly pending;
|
|
36
|
+
private timer;
|
|
37
|
+
private readonly config;
|
|
38
|
+
private readonly flushCb;
|
|
39
|
+
private stopped;
|
|
40
|
+
private flushing;
|
|
41
|
+
private readonly inFlightFlushes;
|
|
42
|
+
constructor(config: AddBatcherConfig, flushCb: FlushCallback<T>);
|
|
43
|
+
/** Enqueue an add() call, returns Promise<Job<T>> resolved after flush */
|
|
44
|
+
enqueue(name: string, data: T, opts?: JobOptions): Promise<Job<T>>;
|
|
45
|
+
/** Start a flush and track it */
|
|
46
|
+
private triggerFlush;
|
|
47
|
+
/** Flush pending adds, then drain any items that accumulated during flush */
|
|
48
|
+
private doFlush;
|
|
49
|
+
/** Flush all pending adds as a single addBulk call */
|
|
50
|
+
flush(): Promise<void>;
|
|
51
|
+
/** Send one batch */
|
|
52
|
+
private flushOnce;
|
|
53
|
+
/** Stop the batcher - rejects remaining pending entries */
|
|
54
|
+
stop(): void;
|
|
55
|
+
/** Wait for all in-flight flush operations to complete */
|
|
56
|
+
waitForInFlight(): Promise<void>;
|
|
57
|
+
/** Check if there are pending adds */
|
|
58
|
+
hasPending(): boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BullMQ v5 Compatibility Operations
|
|
3
|
+
*/
|
|
4
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
5
|
+
import type { Job, JobDependencies, JobDependenciesCount, GetDependenciesOpts } from "../types.js";
|
|
6
|
+
interface CompatibilityContext<T = unknown> {
|
|
7
|
+
name: string;
|
|
8
|
+
embedded: boolean;
|
|
9
|
+
tcp: TcpConnectionPool | null;
|
|
10
|
+
getJobState: (id: string) => Promise<'waiting' | 'delayed' | 'active' | 'completed' | 'failed' | 'unknown'>;
|
|
11
|
+
removeAsync: (id: string) => Promise<void>;
|
|
12
|
+
retryJob: (id: string) => Promise<void>;
|
|
13
|
+
getChildrenValues: (id: string) => Promise<Record<string, unknown>>;
|
|
14
|
+
updateJobData: (id: string, data: unknown) => Promise<void>;
|
|
15
|
+
promoteJob: (id: string) => Promise<void>;
|
|
16
|
+
changeJobDelay: (id: string, delay: number) => Promise<void>;
|
|
17
|
+
changeJobPriority: (id: string, opts: {
|
|
18
|
+
priority: number;
|
|
19
|
+
lifo?: boolean;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
extendJobLock: (id: string, token: string, duration: number) => Promise<number>;
|
|
22
|
+
clearJobLogs: (id: string, keepLogs?: number) => Promise<void>;
|
|
23
|
+
getJobDependencies: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependencies>;
|
|
24
|
+
getJobDependenciesCount: (id: string, opts?: GetDependenciesOpts) => Promise<JobDependenciesCount>;
|
|
25
|
+
getJobCountsAsync: () => Promise<{
|
|
26
|
+
prioritized: number;
|
|
27
|
+
'waiting-children': number;
|
|
28
|
+
}>;
|
|
29
|
+
getWaitingAsync: (start?: number, end?: number) => Promise<Job<T>[]>;
|
|
30
|
+
getPrioritizedAsync: (start?: number, end?: number) => Promise<Job<T>[]>;
|
|
31
|
+
getJobsAsync: (options: {
|
|
32
|
+
state?: string | string[];
|
|
33
|
+
start?: number;
|
|
34
|
+
end?: number;
|
|
35
|
+
asc?: boolean;
|
|
36
|
+
}) => Promise<Job<T>[]>;
|
|
37
|
+
}
|
|
38
|
+
/** Get jobs in the "prioritized" state (priority > 0, BullMQ v5) */
|
|
39
|
+
export declare function getPrioritized<T>(ctx: CompatibilityContext<T>, start?: number, end?: number): Promise<Job<T>[]>;
|
|
40
|
+
/** Get count of prioritized jobs (priority > 0) */
|
|
41
|
+
export declare function getPrioritizedCount<T>(ctx: CompatibilityContext<T>): Promise<number>;
|
|
42
|
+
/** Get jobs waiting for parent to complete */
|
|
43
|
+
export declare function getWaitingChildren<T>(ctx: CompatibilityContext<T>, start?: number, end?: number): Promise<Job<T>[]>;
|
|
44
|
+
/** Get count of jobs waiting for parent */
|
|
45
|
+
export declare function getWaitingChildrenCount<T>(ctx: CompatibilityContext<T>): Promise<number>;
|
|
46
|
+
/** Get dependencies of a parent job */
|
|
47
|
+
export declare function getDependencies(ctx: CompatibilityContext, parentId: string, type?: 'processed' | 'unprocessed', start?: number, end?: number): Promise<{
|
|
48
|
+
processed?: Record<string, unknown>;
|
|
49
|
+
unprocessed?: string[];
|
|
50
|
+
nextProcessedCursor?: number;
|
|
51
|
+
nextUnprocessedCursor?: number;
|
|
52
|
+
}>;
|
|
53
|
+
/** Get job dependencies (for Job instance method) */
|
|
54
|
+
export declare function getJobDependencies(ctx: CompatibilityContext, id: string, _opts?: GetDependenciesOpts): Promise<JobDependencies>;
|
|
55
|
+
/** Get job dependencies count */
|
|
56
|
+
export declare function getJobDependenciesCount(ctx: CompatibilityContext, id: string, _opts?: GetDependenciesOpts): Promise<JobDependenciesCount>;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deduplication Operations
|
|
3
|
+
*/
|
|
4
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
5
|
+
interface DeduplicationContext {
|
|
6
|
+
name: string;
|
|
7
|
+
embedded: boolean;
|
|
8
|
+
tcp: TcpConnectionPool | null;
|
|
9
|
+
}
|
|
10
|
+
/** Get the job ID associated with a deduplication key */
|
|
11
|
+
export declare function getDeduplicationJobId(ctx: DeduplicationContext, deduplicationId: string): Promise<string | null>;
|
|
12
|
+
/** Remove a deduplication key */
|
|
13
|
+
export declare function removeDeduplicationKey(ctx: DeduplicationContext, deduplicationId: string): Promise<number>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DLQ Operations Wrapper
|
|
3
|
+
* Wraps dlqOps for Queue class usage
|
|
4
|
+
*/
|
|
5
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
6
|
+
import type { Job, DlqConfig, DlqEntry, DlqStats, DlqFilter } from "../types.js";
|
|
7
|
+
import { type DlqJobContext } from "./dlqJobMethods.js";
|
|
8
|
+
interface DlqContext {
|
|
9
|
+
name: string;
|
|
10
|
+
embedded: boolean;
|
|
11
|
+
tcp: TcpConnectionPool | null;
|
|
12
|
+
}
|
|
13
|
+
/** Set DLQ configuration */
|
|
14
|
+
export declare function setDlqConfig(ctx: DlqContext, config: Partial<DlqConfig>): void;
|
|
15
|
+
/** Set DLQ configuration and resolve once the server has applied it. */
|
|
16
|
+
export declare function setDlqConfigAsync(ctx: DlqContext, config: Partial<DlqConfig>): Promise<void>;
|
|
17
|
+
/** Get DLQ configuration */
|
|
18
|
+
export declare function getDlqConfig(ctx: DlqContext): DlqConfig;
|
|
19
|
+
/** Get DLQ configuration (async, works in TCP mode) */
|
|
20
|
+
export declare function getDlqConfigAsync(ctx: DlqContext): Promise<DlqConfig>;
|
|
21
|
+
/** Get DLQ entries */
|
|
22
|
+
export declare function getDlq<T>(ctx: DlqQueryContext, filter?: DlqFilter): DlqEntry<T>[];
|
|
23
|
+
type DlqQueryContext = DlqJobContext;
|
|
24
|
+
/** Read full DLQ metadata from the selected broker runtime. */
|
|
25
|
+
export declare function getDlqAsync<T>(ctx: DlqQueryContext, filter?: DlqFilter): Promise<DlqEntry<T>[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get only the public jobs from the DLQ. Use getDlqAsync() when the full entry
|
|
28
|
+
* metadata is needed; both views work over TCP through the same command.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getDlqJobsAsync<T>(ctx: DlqQueryContext, count?: number): Promise<Job<T>[]>;
|
|
31
|
+
/** Get DLQ stats */
|
|
32
|
+
export declare function getDlqStats(ctx: DlqContext): DlqStats;
|
|
33
|
+
/** Read authoritative DLQ statistics from the selected broker runtime. */
|
|
34
|
+
export declare function getDlqStatsAsync(ctx: DlqContext): Promise<DlqStats>;
|
|
35
|
+
/** Retry DLQ entries */
|
|
36
|
+
export declare function retryDlq(ctx: DlqContext, id?: string): number;
|
|
37
|
+
/**
|
|
38
|
+
* Retry DLQ entries and resolve with the retried count once the server has
|
|
39
|
+
* processed it. The fire-and-forget retryDlq() always returns 0 over TCP and
|
|
40
|
+
* discards the server's count.
|
|
41
|
+
*/
|
|
42
|
+
export declare function retryDlqAsync(ctx: DlqContext, id?: string): Promise<number>;
|
|
43
|
+
/** Retry DLQ entries by filter */
|
|
44
|
+
export declare function retryDlqByFilter(ctx: DlqContext, filter: DlqFilter): number;
|
|
45
|
+
/** Retry matching DLQ entries and return the applied count. */
|
|
46
|
+
export declare function retryDlqByFilterAsync(ctx: DlqContext, filter: DlqFilter): Promise<number>;
|
|
47
|
+
/** Purge DLQ */
|
|
48
|
+
export declare function purgeDlq(ctx: DlqContext): number;
|
|
49
|
+
/**
|
|
50
|
+
* Purge the DLQ and resolve with the purged count once the server has
|
|
51
|
+
* processed it. The fire-and-forget purgeDlq() always returns 0 over TCP;
|
|
52
|
+
* purge-then-assert-empty patterns need this variant.
|
|
53
|
+
*/
|
|
54
|
+
export declare function purgeDlqAsync(ctx: DlqContext): Promise<number>;
|
|
55
|
+
/** Remove one DLQ entry without re-enqueuing it. */
|
|
56
|
+
export declare function removeDlqJobAsync(ctx: DlqContext, id: string): Promise<boolean>;
|
|
57
|
+
/** Retry completed job */
|
|
58
|
+
export declare function retryCompleted(ctx: DlqContext, id?: string): number;
|
|
59
|
+
/** Retry completed job (async) */
|
|
60
|
+
export declare function retryCompletedAsync(ctx: DlqContext, id?: string): Promise<number>;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PublicJobMethodContext } from "../jobConversionTypes.js";
|
|
2
|
+
import type { TcpConnectionPool } from "../tcpPool.js";
|
|
3
|
+
import type { SimpleJobContext } from "./jobProxy.js";
|
|
4
|
+
export interface DlqJobContext extends Pick<SimpleJobContext, 'getJobState' | 'removeAsync' | 'retryJob' | 'getChildrenValues'> {
|
|
5
|
+
name: string;
|
|
6
|
+
embedded: boolean;
|
|
7
|
+
tcp: TcpConnectionPool | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function createDlqJobMethods(ctx: DlqJobContext): PublicJobMethodContext;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DLQ Operations
|
|
3
|
+
* Dead Letter Queue management for embedded mode
|
|
4
|
+
*/
|
|
5
|
+
import type { DlqConfig, DlqEntry, DlqStats, DlqFilter, StallConfig } from "../types.js";
|
|
6
|
+
import type { PublicJobMethodContext } from "../jobConversionTypes.js";
|
|
7
|
+
/** Set DLQ configuration (embedded only) */
|
|
8
|
+
export declare function setDlqConfig(queue: string, config: Partial<DlqConfig>): void;
|
|
9
|
+
/** Get DLQ configuration (embedded only) */
|
|
10
|
+
export declare function getDlqConfigEmbedded(queue: string): DlqConfig;
|
|
11
|
+
/** Get DLQ entries (embedded only) */
|
|
12
|
+
export declare function getDlqEntries<T>(queue: string, methods: PublicJobMethodContext, filter?: DlqFilter): DlqEntry<T>[];
|
|
13
|
+
/** Get DLQ statistics (embedded only) */
|
|
14
|
+
export declare function getDlqStatsEmbedded(queue: string): DlqStats;
|
|
15
|
+
/** Retry DLQ jobs by filter (embedded only) */
|
|
16
|
+
export declare function retryDlqByFilterEmbedded(queue: string, filter: DlqFilter): number;
|
|
17
|
+
/** Retry DLQ jobs (embedded) */
|
|
18
|
+
export declare function retryDlqEmbedded(queue: string, id?: string): number;
|
|
19
|
+
/** Purge DLQ (embedded) */
|
|
20
|
+
export declare function purgeDlqEmbedded(queue: string): number;
|
|
21
|
+
/** Remove one DLQ entry in embedded mode. */
|
|
22
|
+
export declare function removeDlqJobEmbedded(queue: string, id: string): boolean;
|
|
23
|
+
/** Set stall config (embedded only) */
|
|
24
|
+
export declare function setStallConfigEmbedded(queue: string, config: Record<string, unknown>): void;
|
|
25
|
+
/** Get stall config (embedded only) */
|
|
26
|
+
export declare function getStallConfigEmbedded(queue: string): StallConfig;
|