@orchestr-sh/orchestr 1.11.1 → 1.11.2
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 +2 -0
- package/dist/Cache/CacheManager.cjs +1 -1
- package/dist/Cache/CacheManager.mjs +1 -1
- package/dist/Cache/CacheManager.mjs.map +1 -1
- package/dist/Cache/Events/CacheFlushed.cjs +1 -1
- package/dist/Cache/Events/CacheFlushed.mjs +1 -1
- package/dist/Cache/Events/CacheFlushed.mjs.map +1 -1
- package/dist/Cache/Events/CacheHit.cjs +1 -1
- package/dist/Cache/Events/CacheHit.mjs +1 -1
- package/dist/Cache/Events/CacheHit.mjs.map +1 -1
- package/dist/Cache/Events/CacheMissed.cjs +1 -1
- package/dist/Cache/Events/CacheMissed.mjs +1 -1
- package/dist/Cache/Events/CacheMissed.mjs.map +1 -1
- package/dist/Cache/Events/KeyForgotten.cjs +1 -1
- package/dist/Cache/Events/KeyForgotten.mjs +1 -1
- package/dist/Cache/Events/KeyForgotten.mjs.map +1 -1
- package/dist/Cache/Events/KeyWritten.cjs +1 -1
- package/dist/Cache/Events/KeyWritten.mjs +1 -1
- package/dist/Cache/Events/KeyWritten.mjs.map +1 -1
- package/dist/Cache/Locks/CacheLock.cjs +1 -1
- package/dist/Cache/Locks/CacheLock.mjs +1 -1
- package/dist/Cache/Locks/CacheLock.mjs.map +1 -1
- package/dist/Cache/Locks/Lock.cjs +1 -1
- package/dist/Cache/Locks/Lock.mjs +1 -1
- package/dist/Cache/Locks/Lock.mjs.map +1 -1
- package/dist/Cache/Repository.cjs +1 -1
- package/dist/Cache/Repository.mjs +1 -1
- package/dist/Cache/Repository.mjs.map +1 -1
- package/dist/Cache/Stores/ArrayStore.cjs +1 -1
- package/dist/Cache/Stores/ArrayStore.mjs +1 -1
- package/dist/Cache/Stores/ArrayStore.mjs.map +1 -1
- package/dist/Cache/Stores/DatabaseStore.cjs +1 -1
- package/dist/Cache/Stores/DatabaseStore.mjs +1 -1
- package/dist/Cache/Stores/DatabaseStore.mjs.map +1 -1
- package/dist/Cache/Stores/FileStore.cjs +1 -1
- package/dist/Cache/Stores/FileStore.mjs +1 -1
- package/dist/Cache/Stores/FileStore.mjs.map +1 -1
- package/dist/Cache/Tags/TagSet.cjs +1 -1
- package/dist/Cache/Tags/TagSet.mjs +1 -1
- package/dist/Cache/Tags/TagSet.mjs.map +1 -1
- package/dist/Cache/Tags/TaggedCache.cjs +1 -1
- package/dist/Cache/Tags/TaggedCache.mjs +1 -1
- package/dist/Cache/Tags/TaggedCache.mjs.map +1 -1
- package/dist/Console/Commands/CacheClearCommand.cjs +1 -1
- package/dist/Console/Commands/CacheClearCommand.mjs +1 -1
- package/dist/Console/Commands/CacheClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/CacheForgetCommand.cjs +1 -1
- package/dist/Console/Commands/CacheForgetCommand.mjs +1 -1
- package/dist/Console/Commands/CacheForgetCommand.mjs.map +1 -1
- package/dist/Console/Commands/CacheTableCommand.cjs +1 -1
- package/dist/Console/Commands/CacheTableCommand.mjs +1 -1
- package/dist/Console/Commands/CacheTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployEnvCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployInitCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployProvisionCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployRollbackCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployServerCommand.mjs.map +1 -1
- package/dist/Console/Commands/DeployStatusCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventCacheCommand.cjs +1 -1
- package/dist/Console/Commands/EventCacheCommand.mjs +1 -1
- package/dist/Console/Commands/EventCacheCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventClearCommand.cjs +1 -1
- package/dist/Console/Commands/EventClearCommand.mjs +1 -1
- package/dist/Console/Commands/EventClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/EventListCommand.cjs +1 -1
- package/dist/Console/Commands/EventListCommand.mjs +1 -1
- package/dist/Console/Commands/EventListCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeControllerCommand.cjs +1 -1
- package/dist/Console/Commands/MakeControllerCommand.mjs +1 -1
- package/dist/Console/Commands/MakeControllerCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeEventCommand.cjs +1 -1
- package/dist/Console/Commands/MakeEventCommand.mjs +1 -1
- package/dist/Console/Commands/MakeEventCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeJobCommand.cjs +1 -1
- package/dist/Console/Commands/MakeJobCommand.mjs +1 -1
- package/dist/Console/Commands/MakeJobCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeListenerCommand.cjs +1 -1
- package/dist/Console/Commands/MakeListenerCommand.mjs +1 -1
- package/dist/Console/Commands/MakeListenerCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.cjs +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.mjs +1 -1
- package/dist/Console/Commands/MakeMigrationCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeSeederCommand.cjs +1 -1
- package/dist/Console/Commands/MakeSeederCommand.mjs +1 -1
- package/dist/Console/Commands/MakeSeederCommand.mjs.map +1 -1
- package/dist/Console/Commands/MakeViewCommand.cjs +1 -1
- package/dist/Console/Commands/MakeViewCommand.mjs +1 -1
- package/dist/Console/Commands/MakeViewCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateFreshCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateRefreshCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateResetCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateResetCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateResetCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateRollbackCommand.mjs.map +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.cjs +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.mjs +1 -1
- package/dist/Console/Commands/MigrateStatusCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueBatchesTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueClearCommand.cjs +1 -1
- package/dist/Console/Commands/QueueClearCommand.mjs +1 -1
- package/dist/Console/Commands/QueueClearCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFailedCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFailedCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFailedCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFailedTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueFlushCommand.cjs +1 -1
- package/dist/Console/Commands/QueueFlushCommand.mjs +1 -1
- package/dist/Console/Commands/QueueFlushCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueForgetCommand.cjs +1 -1
- package/dist/Console/Commands/QueueForgetCommand.mjs +1 -1
- package/dist/Console/Commands/QueueForgetCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.cjs +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.mjs +1 -1
- package/dist/Console/Commands/QueueMonitorCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.cjs +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.mjs +1 -1
- package/dist/Console/Commands/QueuePruneBatchesCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.cjs +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.mjs +1 -1
- package/dist/Console/Commands/QueuePruneFailedCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueRestartCommand.cjs +1 -1
- package/dist/Console/Commands/QueueRestartCommand.mjs +1 -1
- package/dist/Console/Commands/QueueRestartCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueRetryCommand.cjs +1 -1
- package/dist/Console/Commands/QueueRetryCommand.mjs +1 -1
- package/dist/Console/Commands/QueueRetryCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueTableCommand.cjs +1 -1
- package/dist/Console/Commands/QueueTableCommand.mjs +1 -1
- package/dist/Console/Commands/QueueTableCommand.mjs.map +1 -1
- package/dist/Console/Commands/QueueWorkCommand.cjs +1 -1
- package/dist/Console/Commands/QueueWorkCommand.mjs +1 -1
- package/dist/Console/Commands/QueueWorkCommand.mjs.map +1 -1
- package/dist/Console/Commands/SeedCommand.cjs +1 -1
- package/dist/Console/Commands/SeedCommand.mjs +1 -1
- package/dist/Console/Commands/SeedCommand.mjs.map +1 -1
- package/dist/Console/ConsoleKernel.cjs +1 -1
- package/dist/Console/ConsoleKernel.mjs +1 -1
- package/dist/Console/ConsoleKernel.mjs.map +1 -1
- package/dist/Console/orchestr.mjs.map +1 -1
- package/dist/Container/Container.mjs.map +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.cjs +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.mjs +1 -1
- package/dist/Database/Adapters/DrizzleAdapter.mjs.map +1 -1
- package/dist/Database/Connection.cjs +1 -1
- package/dist/Database/Connection.mjs +1 -1
- package/dist/Database/Connection.mjs.map +1 -1
- package/dist/Database/DatabaseManager.cjs +1 -1
- package/dist/Database/DatabaseManager.mjs +1 -1
- package/dist/Database/DatabaseManager.mjs.map +1 -1
- package/dist/Database/Ensemble/Ensemble.mjs.map +1 -1
- package/dist/Database/Ensemble/EnsembleBuilder.mjs.map +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.cjs +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.mjs +1 -1
- package/dist/Database/Ensemble/EnsembleCollection.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsTo.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.cjs +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.mjs +1 -1
- package/dist/Database/Ensemble/Relations/BelongsToMany.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/HasMany.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphTo.mjs.map +1 -1
- package/dist/Database/Ensemble/Relations/MorphToMany.mjs.map +1 -1
- package/dist/Database/Migrations/Blueprint.cjs +1 -1
- package/dist/Database/Migrations/Blueprint.mjs +1 -1
- package/dist/Database/Migrations/Blueprint.mjs.map +1 -1
- package/dist/Database/Migrations/MigrationCreator.cjs +1 -1
- package/dist/Database/Migrations/MigrationCreator.mjs +1 -1
- package/dist/Database/Migrations/MigrationCreator.mjs.map +1 -1
- package/dist/Database/Migrations/MigrationRepository.cjs +1 -1
- package/dist/Database/Migrations/MigrationRepository.mjs +1 -1
- package/dist/Database/Migrations/MigrationRepository.mjs.map +1 -1
- package/dist/Database/Migrations/Migrator.cjs +1 -1
- package/dist/Database/Migrations/Migrator.mjs +1 -1
- package/dist/Database/Migrations/Migrator.mjs.map +1 -1
- package/dist/Database/Migrations/SchemaBuilder.cjs +1 -1
- package/dist/Database/Migrations/SchemaBuilder.mjs +1 -1
- package/dist/Database/Migrations/SchemaBuilder.mjs.map +1 -1
- package/dist/Database/Query/Builder.cjs +1 -1
- package/dist/Database/Query/Builder.mjs +1 -1
- package/dist/Database/Query/Builder.mjs.map +1 -1
- package/dist/Database/Query/Expression.cjs +1 -1
- package/dist/Database/Query/Expression.mjs +1 -1
- package/dist/Database/Query/Expression.mjs.map +1 -1
- package/dist/Database/Seeders/SeederRunner.cjs +1 -1
- package/dist/Database/Seeders/SeederRunner.mjs +1 -1
- package/dist/Database/Seeders/SeederRunner.mjs.map +1 -1
- package/dist/Deploy/Deployer.cjs +1 -1
- package/dist/Deploy/Deployer.mjs +1 -1
- package/dist/Deploy/Deployer.mjs.map +1 -1
- package/dist/Deploy/ProjectConfig.mjs.map +1 -1
- package/dist/Deploy/Provisioner.cjs +1 -1
- package/dist/Deploy/Provisioner.mjs +1 -1
- package/dist/Deploy/Provisioner.mjs.map +1 -1
- package/dist/Deploy/SSHConnection.mjs.map +1 -1
- package/dist/Deploy/SymphonyClient.cjs +1 -1
- package/dist/Deploy/SymphonyClient.mjs +1 -1
- package/dist/Deploy/SymphonyClient.mjs.map +1 -1
- package/dist/Deploy/TarBuilder.mjs.map +1 -1
- package/dist/Deploy/prompt.mjs.map +1 -1
- package/dist/Events/Dispatcher.cjs +1 -1
- package/dist/Events/Dispatcher.mjs +1 -1
- package/dist/Events/Dispatcher.mjs.map +1 -1
- package/dist/Events/EventServiceProvider.cjs +1 -1
- package/dist/Events/EventServiceProvider.mjs.map +1 -1
- package/dist/Facades/Bus.mjs.map +1 -1
- package/dist/Facades/Cache.mjs.map +1 -1
- package/dist/Facades/Config.mjs.map +1 -1
- package/dist/Facades/DB.mjs.map +1 -1
- package/dist/Facades/Event.mjs.map +1 -1
- package/dist/Facades/Queue.mjs.map +1 -1
- package/dist/Facades/Route.mjs.map +1 -1
- package/dist/Facades/View.mjs.map +1 -1
- package/dist/Foundation/Application.mjs.map +1 -1
- package/dist/Foundation/Http/FormRequest.mjs.map +1 -1
- package/dist/Foundation/Http/Rules/AnyOfRule.mjs.map +1 -1
- package/dist/Foundation/Http/Rules/ImageFileRule.mjs.map +1 -1
- package/dist/Foundation/Http/Validator.mjs.map +1 -1
- package/dist/Queue/Batching/Batch.cjs +1 -1
- package/dist/Queue/Batching/Batch.mjs +1 -1
- package/dist/Queue/Batching/Batch.mjs.map +1 -1
- package/dist/Queue/Batching/PendingBatch.cjs +1 -1
- package/dist/Queue/Batching/PendingBatch.mjs +1 -1
- package/dist/Queue/Batching/PendingBatch.mjs.map +1 -1
- package/dist/Queue/Concerns/Dispatchable.mjs.map +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.cjs +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.mjs +1 -1
- package/dist/Queue/Drivers/DatabaseDriver.mjs.map +1 -1
- package/dist/Queue/Drivers/NullDriver.cjs +1 -1
- package/dist/Queue/Drivers/NullDriver.mjs +1 -1
- package/dist/Queue/Drivers/NullDriver.mjs.map +1 -1
- package/dist/Queue/Drivers/SyncDriver.cjs +1 -1
- package/dist/Queue/Drivers/SyncDriver.mjs +1 -1
- package/dist/Queue/Drivers/SyncDriver.mjs.map +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.cjs +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.mjs +1 -1
- package/dist/Queue/Events/JobExceptionOccurred.mjs.map +1 -1
- package/dist/Queue/Events/JobFailed.cjs +1 -1
- package/dist/Queue/Events/JobFailed.mjs +1 -1
- package/dist/Queue/Events/JobFailed.mjs.map +1 -1
- package/dist/Queue/Events/JobProcessed.cjs +1 -1
- package/dist/Queue/Events/JobProcessed.mjs +1 -1
- package/dist/Queue/Events/JobProcessed.mjs.map +1 -1
- package/dist/Queue/Events/JobProcessing.cjs +1 -1
- package/dist/Queue/Events/JobProcessing.mjs +1 -1
- package/dist/Queue/Events/JobProcessing.mjs.map +1 -1
- package/dist/Queue/Events/JobQueued.cjs +1 -1
- package/dist/Queue/Events/JobQueued.mjs +1 -1
- package/dist/Queue/Events/JobQueued.mjs.map +1 -1
- package/dist/Queue/Events/JobRetryRequested.cjs +1 -1
- package/dist/Queue/Events/JobRetryRequested.mjs +1 -1
- package/dist/Queue/Events/JobRetryRequested.mjs.map +1 -1
- package/dist/Queue/Events/WorkerStopping.cjs +1 -1
- package/dist/Queue/Events/WorkerStopping.mjs +1 -1
- package/dist/Queue/Events/WorkerStopping.mjs.map +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.cjs +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.mjs +1 -1
- package/dist/Queue/Failed/DatabaseFailedJobProvider.mjs.map +1 -1
- package/dist/Queue/Middleware/RateLimited.cjs +1 -1
- package/dist/Queue/Middleware/RateLimited.mjs +1 -1
- package/dist/Queue/Middleware/RateLimited.mjs.map +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.cjs +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.mjs +1 -1
- package/dist/Queue/Middleware/ThrottlesExceptions.mjs.map +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.cjs +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.mjs +1 -1
- package/dist/Queue/Middleware/WithoutOverlapping.mjs.map +1 -1
- package/dist/Queue/PendingChain.cjs +1 -1
- package/dist/Queue/PendingChain.mjs +1 -1
- package/dist/Queue/PendingChain.mjs.map +1 -1
- package/dist/Queue/PendingDispatch.cjs +1 -1
- package/dist/Queue/PendingDispatch.mjs +1 -1
- package/dist/Queue/PendingDispatch.mjs.map +1 -1
- package/dist/Queue/QueueManager.cjs +1 -1
- package/dist/Queue/QueueManager.mjs +1 -1
- package/dist/Queue/QueueManager.mjs.map +1 -1
- package/dist/Queue/QueueServiceProvider.mjs.map +1 -1
- package/dist/Queue/Workers/Worker.cjs +1 -1
- package/dist/Queue/Workers/Worker.mjs +1 -1
- package/dist/Queue/Workers/Worker.mjs.map +1 -1
- package/dist/Routing/Request.mjs.map +1 -1
- package/dist/Routing/Response.mjs.map +1 -1
- package/dist/Support/EventDiscovery.cjs +1 -1
- package/dist/Support/EventDiscovery.mjs +1 -1
- package/dist/Support/EventDiscovery.mjs.map +1 -1
- package/dist/Support/Testing/Fakes/EventFake.cjs +1 -1
- package/dist/Support/Testing/Fakes/EventFake.mjs +1 -1
- package/dist/Support/Testing/Fakes/EventFake.mjs.map +1 -1
- package/dist/Support/helpers.mjs.map +1 -1
- package/dist/View/Engines/TemplateEngine.mjs.map +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseDriver.mjs","names":[],"sources":["../../../src/Queue/Drivers/DatabaseDriver.ts"],"sourcesContent":["/**\n * DatabaseDriver\n *\n * Database queue driver that stores jobs in a database table.\n * This is the most common driver for most applications.\n *\n * Mirrors Laravel's Illuminate\\Queue\\DatabaseQueue.\n */\n\nimport { randomUUID } from 'crypto';\nimport type { Connection } from '@/Database/Connection';\nimport type { DatabaseManager } from '@/Database/DatabaseManager';\nimport type { Application } from '@/Foundation/Application';\nimport type { QueueDriver, QueueDriverJob } from '@/Queue/Contracts/QueueDriver';\nimport type { Job } from '@/Queue/Job';\nimport type { QueueConnectionConfig } from '@/Queue/QueueManager';\nimport { JobPayload } from '@/Queue/JobPayload';\n\nexport class DatabaseDriver implements QueueDriver {\n protected connectionName: string = 'database';\n protected defaultQueue: string;\n protected table: string;\n protected retryAfter: number;\n\n constructor(\n protected config: QueueConnectionConfig,\n protected app: Application\n ) {\n this.defaultQueue = config.queue || 'default';\n this.table = config.table || 'jobs';\n this.retryAfter = config.retry_after || 90;\n }\n\n /**\n * Get the database connection\n */\n protected getConnection(): Connection {\n const db = this.app.make<DatabaseManager>('db');\n return db.connection(this.config.connection);\n }\n\n async size(queue?: string): Promise<number> {\n const queueName = this.getQueue(queue);\n const connection = this.getConnection();\n\n const result = await connection.table(this.table).where('queue', '=', queueName).count();\n\n return Number(result) || 0;\n }\n\n async push(job: Job, queue?: string): Promise<string> {\n const queueName = this.getQueue(queue);\n const payload = JobPayload.create(job);\n const now = Math.floor(Date.now() / 1000);\n\n const connection = this.getConnection();\n\n await connection.table(this.table).insert({\n queue: queueName,\n payload: JobPayload.serialize(payload),\n attempts: 0,\n reserved_at: null,\n available_at: now,\n created_at: now,\n });\n\n return payload.uuid;\n }\n\n async pushRaw(payload: string, queue?: string, options?: Record<string, any>): Promise<string> {\n const queueName = this.getQueue(queue);\n const now = Math.floor(Date.now() / 1000);\n const delay = options?.delay || 0;\n\n const connection = this.getConnection();\n\n await connection.table(this.table).insert({\n queue: queueName,\n payload,\n attempts: 0,\n reserved_at: null,\n available_at: now + delay,\n created_at: now,\n });\n\n return randomUUID();\n }\n\n async later(delay: number | Date, job: Job, queue?: string): Promise<string> {\n const queueName = this.getQueue(queue);\n const payload = JobPayload.create(job);\n const now = Math.floor(Date.now() / 1000);\n\n let availableAt: number;\n if (delay instanceof Date) {\n availableAt = Math.floor(delay.getTime() / 1000);\n } else {\n availableAt = now + delay;\n }\n\n const connection = this.getConnection();\n\n await connection.table(this.table).insert({\n queue: queueName,\n payload: JobPayload.serialize(payload),\n attempts: 0,\n reserved_at: null,\n available_at: availableAt,\n created_at: now,\n });\n\n return payload.uuid;\n }\n\n async bulk(jobs: Job[], queue?: string): Promise<void> {\n for (const job of jobs) {\n await this.push(job, queue);\n }\n }\n\n async pop(queue?: string): Promise<QueueDriverJob | null> {\n const queueName = this.getQueue(queue);\n const now = Math.floor(Date.now() / 1000);\n const connection = this.getConnection();\n\n // Find the next available job\n // First, expire any reserved jobs that have been held too long\n await connection\n .table(this.table)\n .where('queue', '=', queueName)\n .where('reserved_at', '<=', now - this.retryAfter)\n .update({\n reserved_at: null,\n });\n\n // Get the next available job and reserve it\n const job = await connection\n .table(this.table)\n .where('queue', '=', queueName)\n .where('available_at', '<=', now)\n .whereNull('reserved_at')\n .orderBy('id', 'asc')\n .limit(1)\n .first();\n\n if (!job) {\n return null;\n }\n\n // Reserve the job\n await connection\n .table(this.table)\n .where('id', '=', job.id)\n .update({\n reserved_at: now,\n attempts: (job.attempts || 0) + 1,\n });\n\n return {\n id: String(job.id),\n queue: job.queue,\n payload: job.payload,\n attempts: (job.attempts || 0) + 1,\n reservedAt: now,\n availableAt: job.available_at,\n createdAt: job.created_at,\n };\n }\n\n async release(id: string, delay: number = 0): Promise<void> {\n const now = Math.floor(Date.now() / 1000);\n const connection = this.getConnection();\n\n await connection\n .table(this.table)\n .where('id', '=', id)\n .update({\n reserved_at: null,\n available_at: now + delay,\n });\n }\n\n async delete(id: string): Promise<void> {\n const connection = this.getConnection();\n\n await connection.table(this.table).where('id', '=', id).delete();\n }\n\n async clear(queue?: string): Promise<number> {\n const queueName = this.getQueue(queue);\n const connection = this.getConnection();\n\n const count = await this.size(queueName);\n\n await connection.table(this.table).where('queue', '=', queueName).delete();\n\n return count;\n }\n\n getConnectionName(): string {\n return this.connectionName;\n }\n\n setConnectionName(name: string): void {\n this.connectionName = name;\n }\n\n getQueue(queue?: string): string {\n return queue || this.defaultQueue;\n }\n}\n"],"mappings":"mFAkBA,IAAa,EAAb,KAAmD,
|
|
1
|
+
{"version":3,"file":"DatabaseDriver.mjs","names":[],"sources":["../../../src/Queue/Drivers/DatabaseDriver.ts"],"sourcesContent":["/**\n * DatabaseDriver\n *\n * Database queue driver that stores jobs in a database table.\n * This is the most common driver for most applications.\n *\n * Mirrors Laravel's Illuminate\\Queue\\DatabaseQueue.\n */\n\nimport { randomUUID } from 'crypto';\nimport type { Connection } from '@/Database/Connection';\nimport type { DatabaseManager } from '@/Database/DatabaseManager';\nimport type { Application } from '@/Foundation/Application';\nimport type { QueueDriver, QueueDriverJob } from '@/Queue/Contracts/QueueDriver';\nimport type { Job } from '@/Queue/Job';\nimport type { QueueConnectionConfig } from '@/Queue/QueueManager';\nimport { JobPayload } from '@/Queue/JobPayload';\n\nexport class DatabaseDriver implements QueueDriver {\n protected connectionName: string = 'database';\n protected defaultQueue: string;\n protected table: string;\n protected retryAfter: number;\n\n constructor(\n protected config: QueueConnectionConfig,\n protected app: Application\n ) {\n this.defaultQueue = config.queue || 'default';\n this.table = config.table || 'jobs';\n this.retryAfter = config.retry_after || 90;\n }\n\n /**\n * Get the database connection\n */\n protected getConnection(): Connection {\n const db = this.app.make<DatabaseManager>('db');\n return db.connection(this.config.connection);\n }\n\n async size(queue?: string): Promise<number> {\n const queueName = this.getQueue(queue);\n const connection = this.getConnection();\n\n const result = await connection.table(this.table).where('queue', '=', queueName).count();\n\n return Number(result) || 0;\n }\n\n async push(job: Job, queue?: string): Promise<string> {\n const queueName = this.getQueue(queue);\n const payload = JobPayload.create(job);\n const now = Math.floor(Date.now() / 1000);\n\n const connection = this.getConnection();\n\n await connection.table(this.table).insert({\n queue: queueName,\n payload: JobPayload.serialize(payload),\n attempts: 0,\n reserved_at: null,\n available_at: now,\n created_at: now,\n });\n\n return payload.uuid;\n }\n\n async pushRaw(payload: string, queue?: string, options?: Record<string, any>): Promise<string> {\n const queueName = this.getQueue(queue);\n const now = Math.floor(Date.now() / 1000);\n const delay = options?.delay || 0;\n\n const connection = this.getConnection();\n\n await connection.table(this.table).insert({\n queue: queueName,\n payload,\n attempts: 0,\n reserved_at: null,\n available_at: now + delay,\n created_at: now,\n });\n\n return randomUUID();\n }\n\n async later(delay: number | Date, job: Job, queue?: string): Promise<string> {\n const queueName = this.getQueue(queue);\n const payload = JobPayload.create(job);\n const now = Math.floor(Date.now() / 1000);\n\n let availableAt: number;\n if (delay instanceof Date) {\n availableAt = Math.floor(delay.getTime() / 1000);\n } else {\n availableAt = now + delay;\n }\n\n const connection = this.getConnection();\n\n await connection.table(this.table).insert({\n queue: queueName,\n payload: JobPayload.serialize(payload),\n attempts: 0,\n reserved_at: null,\n available_at: availableAt,\n created_at: now,\n });\n\n return payload.uuid;\n }\n\n async bulk(jobs: Job[], queue?: string): Promise<void> {\n for (const job of jobs) {\n await this.push(job, queue);\n }\n }\n\n async pop(queue?: string): Promise<QueueDriverJob | null> {\n const queueName = this.getQueue(queue);\n const now = Math.floor(Date.now() / 1000);\n const connection = this.getConnection();\n\n // Find the next available job\n // First, expire any reserved jobs that have been held too long\n await connection\n .table(this.table)\n .where('queue', '=', queueName)\n .where('reserved_at', '<=', now - this.retryAfter)\n .update({\n reserved_at: null,\n });\n\n // Get the next available job and reserve it\n const job = await connection\n .table(this.table)\n .where('queue', '=', queueName)\n .where('available_at', '<=', now)\n .whereNull('reserved_at')\n .orderBy('id', 'asc')\n .limit(1)\n .first();\n\n if (!job) {\n return null;\n }\n\n // Reserve the job\n await connection\n .table(this.table)\n .where('id', '=', job.id)\n .update({\n reserved_at: now,\n attempts: (job.attempts || 0) + 1,\n });\n\n return {\n id: String(job.id),\n queue: job.queue,\n payload: job.payload,\n attempts: (job.attempts || 0) + 1,\n reservedAt: now,\n availableAt: job.available_at,\n createdAt: job.created_at,\n };\n }\n\n async release(id: string, delay: number = 0): Promise<void> {\n const now = Math.floor(Date.now() / 1000);\n const connection = this.getConnection();\n\n await connection\n .table(this.table)\n .where('id', '=', id)\n .update({\n reserved_at: null,\n available_at: now + delay,\n });\n }\n\n async delete(id: string): Promise<void> {\n const connection = this.getConnection();\n\n await connection.table(this.table).where('id', '=', id).delete();\n }\n\n async clear(queue?: string): Promise<number> {\n const queueName = this.getQueue(queue);\n const connection = this.getConnection();\n\n const count = await this.size(queueName);\n\n await connection.table(this.table).where('queue', '=', queueName).delete();\n\n return count;\n }\n\n getConnectionName(): string {\n return this.connectionName;\n }\n\n setConnectionName(name: string): void {\n this.connectionName = name;\n }\n\n getQueue(queue?: string): string {\n return queue || this.defaultQueue;\n }\n}\n"],"mappings":"mFAkBA,IAAa,EAAb,KAAmD,CAOrC,OACA,IAPZ,eAAmC,WACnC,aACA,MACA,WAEA,YACE,EACA,EACA,CAFU,KAAA,OAAA,EACA,KAAA,IAAA,EAEV,KAAK,aAAe,EAAO,OAAS,UACpC,KAAK,MAAQ,EAAO,OAAS,OAC7B,KAAK,WAAa,EAAO,aAAe,GAM1C,eAAsC,CAEpC,OADW,KAAK,IAAI,KAAsB,KACjC,CAAC,WAAW,KAAK,OAAO,WAAW,CAG9C,MAAM,KAAK,EAAiC,CAC1C,IAAM,EAAY,KAAK,SAAS,EAAM,CAGhC,EAAS,MAFI,KAAK,eAEO,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,QAAS,IAAK,EAAU,CAAC,OAAO,CAExF,OAAO,OAAO,EAAO,EAAI,EAG3B,MAAM,KAAK,EAAU,EAAiC,CACpD,IAAM,EAAY,KAAK,SAAS,EAAM,CAChC,EAAU,EAAW,OAAO,EAAI,CAChC,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAazC,OATA,MAFmB,KAAK,eAER,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CACxC,MAAO,EACP,QAAS,EAAW,UAAU,EAAQ,CACtC,SAAU,EACV,YAAa,KACb,aAAc,EACd,WAAY,EACb,CAAC,CAEK,EAAQ,KAGjB,MAAM,QAAQ,EAAiB,EAAgB,EAAgD,CAC7F,IAAM,EAAY,KAAK,SAAS,EAAM,CAChC,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CACnC,EAAQ,GAAS,OAAS,EAahC,OATA,MAFmB,KAAK,eAER,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CACxC,MAAO,EACP,UACA,SAAU,EACV,YAAa,KACb,aAAc,EAAM,EACpB,WAAY,EACb,CAAC,CAEK,GAAY,CAGrB,MAAM,MAAM,EAAsB,EAAU,EAAiC,CAC3E,IAAM,EAAY,KAAK,SAAS,EAAM,CAChC,EAAU,EAAW,OAAO,EAAI,CAChC,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAErC,EAkBJ,MAjBA,CAGE,EAHE,aAAiB,KACL,KAAK,MAAM,EAAM,SAAS,CAAG,IAAK,CAElC,EAAM,EAKtB,MAFmB,KAAK,eAER,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CACxC,MAAO,EACP,QAAS,EAAW,UAAU,EAAQ,CACtC,SAAU,EACV,YAAa,KACb,aAAc,EACd,WAAY,EACb,CAAC,CAEK,EAAQ,KAGjB,MAAM,KAAK,EAAa,EAA+B,CACrD,IAAK,IAAM,KAAO,EAChB,MAAM,KAAK,KAAK,EAAK,EAAM,CAI/B,MAAM,IAAI,EAAgD,CACxD,IAAM,EAAY,KAAK,SAAS,EAAM,CAChC,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CACnC,EAAa,KAAK,eAAe,CAIvC,MAAM,EACH,MAAM,KAAK,MAAM,CACjB,MAAM,QAAS,IAAK,EAAU,CAC9B,MAAM,cAAe,KAAM,EAAM,KAAK,WAAW,CACjD,OAAO,CACN,YAAa,KACd,CAAC,CAGJ,IAAM,EAAM,MAAM,EACf,MAAM,KAAK,MAAM,CACjB,MAAM,QAAS,IAAK,EAAU,CAC9B,MAAM,eAAgB,KAAM,EAAI,CAChC,UAAU,cAAc,CACxB,QAAQ,KAAM,MAAM,CACpB,MAAM,EAAE,CACR,OAAO,CAeV,OAbK,GAKL,MAAM,EACH,MAAM,KAAK,MAAM,CACjB,MAAM,KAAM,IAAK,EAAI,GAAG,CACxB,OAAO,CACN,YAAa,EACb,UAAW,EAAI,UAAY,GAAK,EACjC,CAAC,CAEG,CACL,GAAI,OAAO,EAAI,GAAG,CAClB,MAAO,EAAI,MACX,QAAS,EAAI,QACb,UAAW,EAAI,UAAY,GAAK,EAChC,WAAY,EACZ,YAAa,EAAI,aACjB,UAAW,EAAI,WAChB,EApBQ,KAuBX,MAAM,QAAQ,EAAY,EAAgB,EAAkB,CAC1D,IAAM,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAGzC,MAFmB,KAAK,eAER,CACb,MAAM,KAAK,MAAM,CACjB,MAAM,KAAM,IAAK,EAAG,CACpB,OAAO,CACN,YAAa,KACb,aAAc,EAAM,EACrB,CAAC,CAGN,MAAM,OAAO,EAA2B,CAGtC,MAFmB,KAAK,eAER,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,KAAM,IAAK,EAAG,CAAC,QAAQ,CAGlE,MAAM,MAAM,EAAiC,CAC3C,IAAM,EAAY,KAAK,SAAS,EAAM,CAChC,EAAa,KAAK,eAAe,CAEjC,EAAQ,MAAM,KAAK,KAAK,EAAU,CAIxC,OAFA,MAAM,EAAW,MAAM,KAAK,MAAM,CAAC,MAAM,QAAS,IAAK,EAAU,CAAC,QAAQ,CAEnE,EAGT,mBAA4B,CAC1B,OAAO,KAAK,eAGd,kBAAkB,EAAoB,CACpC,KAAK,eAAiB,EAGxB,SAAS,EAAwB,CAC/B,OAAO,GAAS,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName=`null`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){return e.uuid}async pushRaw(e,t,n){return``}async later(e,t,n){return t.uuid}async bulk(e,t){}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};exports.NullDriver=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{config;connectionName=`null`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){return e.uuid}async pushRaw(e,t,n){return``}async later(e,t,n){return t.uuid}async bulk(e,t){}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};exports.NullDriver=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{connectionName=`null`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){return e.uuid}async pushRaw(e,t,n){return``}async later(e,t,n){return t.uuid}async bulk(e,t){}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};export{e as NullDriver};
|
|
1
|
+
var e=class{config;connectionName=`null`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){return e.uuid}async pushRaw(e,t,n){return``}async later(e,t,n){return t.uuid}async bulk(e,t){}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};export{e as NullDriver};
|
|
2
2
|
//# sourceMappingURL=NullDriver.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NullDriver.mjs","names":[],"sources":["../../../src/Queue/Drivers/NullDriver.ts"],"sourcesContent":["/**\n * NullDriver\n *\n * Null queue driver that discards all jobs.\n * Useful for testing when you want to verify jobs are dispatched\n * but don't want them to actually execute.\n *\n * Mirrors Laravel's Illuminate\\Queue\\NullQueue.\n */\n\nimport type { QueueDriver, QueueDriverJob } from '@/Queue/Contracts/QueueDriver';\nimport type { Job } from '@/Queue/Job';\nimport type { QueueConnectionConfig } from '@/Queue/QueueManager';\n\nexport class NullDriver implements QueueDriver {\n protected connectionName: string = 'null';\n\n constructor(protected config: QueueConnectionConfig) {}\n\n async size(_queue?: string): Promise<number> {\n return 0;\n }\n\n async push(job: Job, _queue?: string): Promise<string> {\n return job.uuid;\n }\n\n async pushRaw(_payload: string, _queue?: string, _options?: Record<string, any>): Promise<string> {\n return '';\n }\n\n async later(_delay: number | Date, job: Job, _queue?: string): Promise<string> {\n return job.uuid;\n }\n\n async bulk(_jobs: Job[], _queue?: string): Promise<void> {\n // Discard all jobs\n }\n\n async pop(_queue?: string): Promise<QueueDriverJob | null> {\n return null;\n }\n\n async release(_id: string, _delay?: number): Promise<void> {\n // No-op\n }\n\n async delete(_id: string): Promise<void> {\n // No-op\n }\n\n async clear(_queue?: string): Promise<number> {\n return 0;\n }\n\n getConnectionName(): string {\n return this.connectionName;\n }\n\n setConnectionName(name: string): void {\n this.connectionName = name;\n }\n\n getQueue(queue?: string): string {\n return queue || this.config.queue || 'default';\n }\n}\n"],"mappings":"AAcA,IAAa,EAAb,KAA+C,
|
|
1
|
+
{"version":3,"file":"NullDriver.mjs","names":[],"sources":["../../../src/Queue/Drivers/NullDriver.ts"],"sourcesContent":["/**\n * NullDriver\n *\n * Null queue driver that discards all jobs.\n * Useful for testing when you want to verify jobs are dispatched\n * but don't want them to actually execute.\n *\n * Mirrors Laravel's Illuminate\\Queue\\NullQueue.\n */\n\nimport type { QueueDriver, QueueDriverJob } from '@/Queue/Contracts/QueueDriver';\nimport type { Job } from '@/Queue/Job';\nimport type { QueueConnectionConfig } from '@/Queue/QueueManager';\n\nexport class NullDriver implements QueueDriver {\n protected connectionName: string = 'null';\n\n constructor(protected config: QueueConnectionConfig) {}\n\n async size(_queue?: string): Promise<number> {\n return 0;\n }\n\n async push(job: Job, _queue?: string): Promise<string> {\n return job.uuid;\n }\n\n async pushRaw(_payload: string, _queue?: string, _options?: Record<string, any>): Promise<string> {\n return '';\n }\n\n async later(_delay: number | Date, job: Job, _queue?: string): Promise<string> {\n return job.uuid;\n }\n\n async bulk(_jobs: Job[], _queue?: string): Promise<void> {\n // Discard all jobs\n }\n\n async pop(_queue?: string): Promise<QueueDriverJob | null> {\n return null;\n }\n\n async release(_id: string, _delay?: number): Promise<void> {\n // No-op\n }\n\n async delete(_id: string): Promise<void> {\n // No-op\n }\n\n async clear(_queue?: string): Promise<number> {\n return 0;\n }\n\n getConnectionName(): string {\n return this.connectionName;\n }\n\n setConnectionName(name: string): void {\n this.connectionName = name;\n }\n\n getQueue(queue?: string): string {\n return queue || this.config.queue || 'default';\n }\n}\n"],"mappings":"AAcA,IAAa,EAAb,KAA+C,CAGvB,OAFtB,eAAmC,OAEnC,YAAY,EAAyC,CAA/B,KAAA,OAAA,EAEtB,MAAM,KAAK,EAAkC,CAC3C,MAAO,GAGT,MAAM,KAAK,EAAU,EAAkC,CACrD,OAAO,EAAI,KAGb,MAAM,QAAQ,EAAkB,EAAiB,EAAiD,CAChG,MAAO,GAGT,MAAM,MAAM,EAAuB,EAAU,EAAkC,CAC7E,OAAO,EAAI,KAGb,MAAM,KAAK,EAAc,EAAgC,EAIzD,MAAM,IAAI,EAAiD,CACzD,OAAO,KAGT,MAAM,QAAQ,EAAa,EAAgC,EAI3D,MAAM,OAAO,EAA4B,EAIzC,MAAM,MAAM,EAAkC,CAC5C,MAAO,GAGT,mBAA4B,CAC1B,OAAO,KAAK,eAGd,kBAAkB,EAAoB,CACpC,KAAK,eAAiB,EAGxB,SAAS,EAAwB,CAC/B,OAAO,GAAS,KAAK,OAAO,OAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName=`sync`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}return e.uuid}async pushRaw(e,t,n){throw Error(`Sync driver does not support pushing raw payloads.`)}async later(e,t,n){return this.push(t)}async bulk(e,t){for(let t of e)await this.push(t)}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};exports.SyncDriver=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{config;connectionName=`sync`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}return e.uuid}async pushRaw(e,t,n){throw Error(`Sync driver does not support pushing raw payloads.`)}async later(e,t,n){return this.push(t)}async bulk(e,t){for(let t of e)await this.push(t)}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};exports.SyncDriver=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{connectionName=`sync`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}return e.uuid}async pushRaw(e,t,n){throw Error(`Sync driver does not support pushing raw payloads.`)}async later(e,t,n){return this.push(t)}async bulk(e,t){for(let t of e)await this.push(t)}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};export{e as SyncDriver};
|
|
1
|
+
var e=class{config;connectionName=`sync`;constructor(e){this.config=e}async size(e){return 0}async push(e,t){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}return e.uuid}async pushRaw(e,t,n){throw Error(`Sync driver does not support pushing raw payloads.`)}async later(e,t,n){return this.push(t)}async bulk(e,t){for(let t of e)await this.push(t)}async pop(e){return null}async release(e,t){}async delete(e){}async clear(e){return 0}getConnectionName(){return this.connectionName}setConnectionName(e){this.connectionName=e}getQueue(e){return e||this.config.queue||`default`}};export{e as SyncDriver};
|
|
2
2
|
//# sourceMappingURL=SyncDriver.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncDriver.mjs","names":[],"sources":["../../../src/Queue/Drivers/SyncDriver.ts"],"sourcesContent":["/**\n * SyncDriver\n *\n * Synchronous queue driver that executes jobs immediately.\n * Useful for local development and testing.\n *\n * Mirrors Laravel's Illuminate\\Queue\\SyncQueue.\n */\n\nimport type { QueueDriver, QueueDriverJob } from '@/Queue/Contracts/QueueDriver';\nimport type { Job } from '@/Queue/Job';\nimport type { QueueConnectionConfig } from '@/Queue/QueueManager';\n\nexport class SyncDriver implements QueueDriver {\n protected connectionName: string = 'sync';\n\n constructor(protected config: QueueConnectionConfig) {}\n\n async size(_queue?: string): Promise<number> {\n return 0;\n }\n\n async push(job: Job, _queue?: string): Promise<string> {\n try {\n await job.handle();\n } catch (error) {\n if (job.failed) {\n await job.failed(error as Error);\n }\n throw error;\n }\n\n return job.uuid;\n }\n\n async pushRaw(_payload: string, _queue?: string, _options?: Record<string, any>): Promise<string> {\n throw new Error('Sync driver does not support pushing raw payloads.');\n }\n\n async later(_delay: number | Date, job: Job, _queue?: string): Promise<string> {\n return this.push(job);\n }\n\n async bulk(jobs: Job[], _queue?: string): Promise<void> {\n for (const job of jobs) {\n await this.push(job);\n }\n }\n\n async pop(_queue?: string): Promise<QueueDriverJob | null> {\n return null;\n }\n\n async release(_id: string, _delay?: number): Promise<void> {\n // No-op for sync driver\n }\n\n async delete(_id: string): Promise<void> {\n // No-op for sync driver\n }\n\n async clear(_queue?: string): Promise<number> {\n return 0;\n }\n\n getConnectionName(): string {\n return this.connectionName;\n }\n\n setConnectionName(name: string): void {\n this.connectionName = name;\n }\n\n getQueue(queue?: string): string {\n return queue || this.config.queue || 'default';\n }\n}\n"],"mappings":"AAaA,IAAa,EAAb,KAA+C,
|
|
1
|
+
{"version":3,"file":"SyncDriver.mjs","names":[],"sources":["../../../src/Queue/Drivers/SyncDriver.ts"],"sourcesContent":["/**\n * SyncDriver\n *\n * Synchronous queue driver that executes jobs immediately.\n * Useful for local development and testing.\n *\n * Mirrors Laravel's Illuminate\\Queue\\SyncQueue.\n */\n\nimport type { QueueDriver, QueueDriverJob } from '@/Queue/Contracts/QueueDriver';\nimport type { Job } from '@/Queue/Job';\nimport type { QueueConnectionConfig } from '@/Queue/QueueManager';\n\nexport class SyncDriver implements QueueDriver {\n protected connectionName: string = 'sync';\n\n constructor(protected config: QueueConnectionConfig) {}\n\n async size(_queue?: string): Promise<number> {\n return 0;\n }\n\n async push(job: Job, _queue?: string): Promise<string> {\n try {\n await job.handle();\n } catch (error) {\n if (job.failed) {\n await job.failed(error as Error);\n }\n throw error;\n }\n\n return job.uuid;\n }\n\n async pushRaw(_payload: string, _queue?: string, _options?: Record<string, any>): Promise<string> {\n throw new Error('Sync driver does not support pushing raw payloads.');\n }\n\n async later(_delay: number | Date, job: Job, _queue?: string): Promise<string> {\n return this.push(job);\n }\n\n async bulk(jobs: Job[], _queue?: string): Promise<void> {\n for (const job of jobs) {\n await this.push(job);\n }\n }\n\n async pop(_queue?: string): Promise<QueueDriverJob | null> {\n return null;\n }\n\n async release(_id: string, _delay?: number): Promise<void> {\n // No-op for sync driver\n }\n\n async delete(_id: string): Promise<void> {\n // No-op for sync driver\n }\n\n async clear(_queue?: string): Promise<number> {\n return 0;\n }\n\n getConnectionName(): string {\n return this.connectionName;\n }\n\n setConnectionName(name: string): void {\n this.connectionName = name;\n }\n\n getQueue(queue?: string): string {\n return queue || this.config.queue || 'default';\n }\n}\n"],"mappings":"AAaA,IAAa,EAAb,KAA+C,CAGvB,OAFtB,eAAmC,OAEnC,YAAY,EAAyC,CAA/B,KAAA,OAAA,EAEtB,MAAM,KAAK,EAAkC,CAC3C,MAAO,GAGT,MAAM,KAAK,EAAU,EAAkC,CACrD,GAAI,CACF,MAAM,EAAI,QAAQ,OACX,EAAO,CAId,MAHI,EAAI,QACN,MAAM,EAAI,OAAO,EAAe,CAE5B,EAGR,OAAO,EAAI,KAGb,MAAM,QAAQ,EAAkB,EAAiB,EAAiD,CAChG,MAAU,MAAM,qDAAqD,CAGvE,MAAM,MAAM,EAAuB,EAAU,EAAkC,CAC7E,OAAO,KAAK,KAAK,EAAI,CAGvB,MAAM,KAAK,EAAa,EAAgC,CACtD,IAAK,IAAM,KAAO,EAChB,MAAM,KAAK,KAAK,EAAI,CAIxB,MAAM,IAAI,EAAiD,CACzD,OAAO,KAGT,MAAM,QAAQ,EAAa,EAAgC,EAI3D,MAAM,OAAO,EAA4B,EAIzC,MAAM,MAAM,EAAkC,CAC5C,MAAO,GAGT,mBAA4B,CAC1B,OAAO,KAAK,eAGd,kBAAkB,EAAoB,CACpC,KAAK,eAAiB,EAGxB,SAAS,EAAwB,CAC/B,OAAO,GAAS,KAAK,OAAO,OAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};exports.JobExceptionOccurred=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName;job;exception;constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};exports.JobExceptionOccurred=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};export{e as JobExceptionOccurred};
|
|
1
|
+
var e=class{connectionName;job;exception;constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};export{e as JobExceptionOccurred};
|
|
2
2
|
//# sourceMappingURL=JobExceptionOccurred.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobExceptionOccurred.mjs","names":[],"sources":["../../../src/Queue/Events/JobExceptionOccurred.ts"],"sourcesContent":["/**\n * JobExceptionOccurred Event\n *\n * Dispatched when a job throws an exception (but may still be retried).\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobExceptionOccurred {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job,\n public readonly exception: Error\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAAkC,
|
|
1
|
+
{"version":3,"file":"JobExceptionOccurred.mjs","names":[],"sources":["../../../src/Queue/Events/JobExceptionOccurred.ts"],"sourcesContent":["/**\n * JobExceptionOccurred Event\n *\n * Dispatched when a job throws an exception (but may still be retried).\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobExceptionOccurred {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job,\n public readonly exception: Error\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAAkC,CAEd,eACA,IACA,UAHlB,YACE,EACA,EACA,EACA,CAHgB,KAAA,eAAA,EACA,KAAA,IAAA,EACA,KAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};exports.JobFailed=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName;job;exception;constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};exports.JobFailed=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};export{e as JobFailed};
|
|
1
|
+
var e=class{connectionName;job;exception;constructor(e,t,n){this.connectionName=e,this.job=t,this.exception=n}};export{e as JobFailed};
|
|
2
2
|
//# sourceMappingURL=JobFailed.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobFailed.mjs","names":[],"sources":["../../../src/Queue/Events/JobFailed.ts"],"sourcesContent":["/**\n * JobFailed Event\n *\n * Dispatched when a job has failed and exceeded its maximum attempts.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobFailed {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job,\n public readonly exception: Error\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAAuB,
|
|
1
|
+
{"version":3,"file":"JobFailed.mjs","names":[],"sources":["../../../src/Queue/Events/JobFailed.ts"],"sourcesContent":["/**\n * JobFailed Event\n *\n * Dispatched when a job has failed and exceeded its maximum attempts.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobFailed {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job,\n public readonly exception: Error\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAAuB,CAEH,eACA,IACA,UAHlB,YACE,EACA,EACA,EACA,CAHgB,KAAA,eAAA,EACA,KAAA,IAAA,EACA,KAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t){this.connectionName=e,this.job=t}};exports.JobProcessed=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName;job;constructor(e,t){this.connectionName=e,this.job=t}};exports.JobProcessed=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t){this.connectionName=e,this.job=t}};export{e as JobProcessed};
|
|
1
|
+
var e=class{connectionName;job;constructor(e,t){this.connectionName=e,this.job=t}};export{e as JobProcessed};
|
|
2
2
|
//# sourceMappingURL=JobProcessed.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobProcessed.mjs","names":[],"sources":["../../../src/Queue/Events/JobProcessed.ts"],"sourcesContent":["/**\n * JobProcessed Event\n *\n * Dispatched after a job has been successfully processed.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobProcessed {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAA0B,
|
|
1
|
+
{"version":3,"file":"JobProcessed.mjs","names":[],"sources":["../../../src/Queue/Events/JobProcessed.ts"],"sourcesContent":["/**\n * JobProcessed Event\n *\n * Dispatched after a job has been successfully processed.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobProcessed {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAA0B,CAEN,eACA,IAFlB,YACE,EACA,EACA,CAFgB,KAAA,eAAA,EACA,KAAA,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t){this.connectionName=e,this.job=t}};exports.JobProcessing=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName;job;constructor(e,t){this.connectionName=e,this.job=t}};exports.JobProcessing=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t){this.connectionName=e,this.job=t}};export{e as JobProcessing};
|
|
1
|
+
var e=class{connectionName;job;constructor(e,t){this.connectionName=e,this.job=t}};export{e as JobProcessing};
|
|
2
2
|
//# sourceMappingURL=JobProcessing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobProcessing.mjs","names":[],"sources":["../../../src/Queue/Events/JobProcessing.ts"],"sourcesContent":["/**\n * JobProcessing Event\n *\n * Dispatched before a job is processed by the worker.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobProcessing {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAA2B,
|
|
1
|
+
{"version":3,"file":"JobProcessing.mjs","names":[],"sources":["../../../src/Queue/Events/JobProcessing.ts"],"sourcesContent":["/**\n * JobProcessing Event\n *\n * Dispatched before a job is processed by the worker.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobProcessing {\n constructor(\n public readonly connectionName: string,\n public readonly job: Job\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAA2B,CAEP,eACA,IAFlB,YACE,EACA,EACA,CAFgB,KAAA,eAAA,EACA,KAAA,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t,n,r){this.connectionName=e,this.queue=t,this.job=n,this.id=r}};exports.JobQueued=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{connectionName;queue;job;id;constructor(e,t,n,r){this.connectionName=e,this.queue=t,this.job=n,this.id=r}};exports.JobQueued=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t,n,r){this.connectionName=e,this.queue=t,this.job=n,this.id=r}};export{e as JobQueued};
|
|
1
|
+
var e=class{connectionName;queue;job;id;constructor(e,t,n,r){this.connectionName=e,this.queue=t,this.job=n,this.id=r}};export{e as JobQueued};
|
|
2
2
|
//# sourceMappingURL=JobQueued.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobQueued.mjs","names":[],"sources":["../../../src/Queue/Events/JobQueued.ts"],"sourcesContent":["/**\n * JobQueued Event\n *\n * Dispatched when a job is pushed onto the queue.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobQueued {\n constructor(\n public readonly connectionName: string,\n public readonly queue: string,\n public readonly job: Job,\n public readonly id: string\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAAuB,
|
|
1
|
+
{"version":3,"file":"JobQueued.mjs","names":[],"sources":["../../../src/Queue/Events/JobQueued.ts"],"sourcesContent":["/**\n * JobQueued Event\n *\n * Dispatched when a job is pushed onto the queue.\n */\n\nimport type { Job } from '@/Queue/Job';\n\nexport class JobQueued {\n constructor(\n public readonly connectionName: string,\n public readonly queue: string,\n public readonly job: Job,\n public readonly id: string\n ) {}\n}\n"],"mappings":"AAQA,IAAa,EAAb,KAAuB,CAEH,eACA,MACA,IACA,GAJlB,YACE,EACA,EACA,EACA,EACA,CAJgB,KAAA,eAAA,EACA,KAAA,MAAA,EACA,KAAA,IAAA,EACA,KAAA,GAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e,t,n){this.payload=e,this.connectionName=t,this.queue=n}};exports.JobRetryRequested=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{payload;connectionName;queue;constructor(e,t,n){this.payload=e,this.connectionName=t,this.queue=n}};exports.JobRetryRequested=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e,t,n){this.payload=e,this.connectionName=t,this.queue=n}};export{e as JobRetryRequested};
|
|
1
|
+
var e=class{payload;connectionName;queue;constructor(e,t,n){this.payload=e,this.connectionName=t,this.queue=n}};export{e as JobRetryRequested};
|
|
2
2
|
//# sourceMappingURL=JobRetryRequested.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobRetryRequested.mjs","names":[],"sources":["../../../src/Queue/Events/JobRetryRequested.ts"],"sourcesContent":["/**\n * JobRetryRequested Event\n *\n * Dispatched when a failed job is manually retried.\n */\n\nexport class JobRetryRequested {\n constructor(\n public readonly payload: string,\n public readonly connectionName: string,\n public readonly queue: string\n ) {}\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAA+B,
|
|
1
|
+
{"version":3,"file":"JobRetryRequested.mjs","names":[],"sources":["../../../src/Queue/Events/JobRetryRequested.ts"],"sourcesContent":["/**\n * JobRetryRequested Event\n *\n * Dispatched when a failed job is manually retried.\n */\n\nexport class JobRetryRequested {\n constructor(\n public readonly payload: string,\n public readonly connectionName: string,\n public readonly queue: string\n ) {}\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAA+B,CAEX,QACA,eACA,MAHlB,YACE,EACA,EACA,EACA,CAHgB,KAAA,QAAA,EACA,KAAA,eAAA,EACA,KAAA,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{constructor(e=0,t){this.status=e,this.workerName=t}};exports.WorkerStopping=e;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=class{status;workerName;constructor(e=0,t){this.status=e,this.workerName=t}};exports.WorkerStopping=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{constructor(e=0,t){this.status=e,this.workerName=t}};export{e as WorkerStopping};
|
|
1
|
+
var e=class{status;workerName;constructor(e=0,t){this.status=e,this.workerName=t}};export{e as WorkerStopping};
|
|
2
2
|
//# sourceMappingURL=WorkerStopping.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerStopping.mjs","names":[],"sources":["../../../src/Queue/Events/WorkerStopping.ts"],"sourcesContent":["/**\n * WorkerStopping Event\n *\n * Dispatched when a queue worker is stopping.\n */\n\nexport class WorkerStopping {\n constructor(\n public readonly status: number = 0,\n public readonly workerName?: string\n ) {}\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAA4B,
|
|
1
|
+
{"version":3,"file":"WorkerStopping.mjs","names":[],"sources":["../../../src/Queue/Events/WorkerStopping.ts"],"sourcesContent":["/**\n * WorkerStopping Event\n *\n * Dispatched when a queue worker is stopping.\n */\n\nexport class WorkerStopping {\n constructor(\n public readonly status: number = 0,\n public readonly workerName?: string\n ) {}\n}\n"],"mappings":"AAMA,IAAa,EAAb,KAA4B,CAER,OACA,WAFlB,YACE,EAAiC,EACjC,EACA,CAFgB,KAAA,OAAA,EACA,KAAA,WAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`crypto`);var t=class{table;databaseConnection;constructor(e,t){this.app=e,this.table=t.table||`failed_jobs`,this.databaseConnection=t.database}getConnection(){return this.app.make(`db`).connection(this.databaseConnection)}async log(t,n,r,i){let a=(0,e.randomUUID)();return await this.getConnection().table(this.table).insert({uuid:a,connection:t,queue:n,payload:r,exception:this.formatException(i),failed_at:new Date().toISOString()}),a}async all(){return await this.getConnection().table(this.table).orderBy(`id`,`desc`).get()}async find(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).first()||null}async forget(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).delete()>0}async flush(e){let t=this.getConnection();if(e!==void 0&&e>0){let n=new Date(Date.now()-e*60*60*1e3).toISOString();await t.table(this.table).where(`failed_at`,`<=`,n).delete()}else await t.table(this.table).delete()}async count(e,t){let n=this.getConnection().table(this.table);return e&&(n=n.where(`connection`,`=`,e)),t&&(n=n.where(`queue`,`=`,t)),Number(await n.count())||0}formatException(e){let t=[`${e.constructor.name}: ${e.message}`];return e.stack&&t.push(``,e.stack),t.join(`
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`crypto`);var t=class{app;table;databaseConnection;constructor(e,t){this.app=e,this.table=t.table||`failed_jobs`,this.databaseConnection=t.database}getConnection(){return this.app.make(`db`).connection(this.databaseConnection)}async log(t,n,r,i){let a=(0,e.randomUUID)();return await this.getConnection().table(this.table).insert({uuid:a,connection:t,queue:n,payload:r,exception:this.formatException(i),failed_at:new Date().toISOString()}),a}async all(){return await this.getConnection().table(this.table).orderBy(`id`,`desc`).get()}async find(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).first()||null}async forget(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).delete()>0}async flush(e){let t=this.getConnection();if(e!==void 0&&e>0){let n=new Date(Date.now()-e*60*60*1e3).toISOString();await t.table(this.table).where(`failed_at`,`<=`,n).delete()}else await t.table(this.table).delete()}async count(e,t){let n=this.getConnection().table(this.table);return e&&(n=n.where(`connection`,`=`,e)),t&&(n=n.where(`queue`,`=`,t)),Number(await n.count())||0}formatException(e){let t=[`${e.constructor.name}: ${e.message}`];return e.stack&&t.push(``,e.stack),t.join(`
|
|
2
2
|
`)}};exports.DatabaseFailedJobProvider=t;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{randomUUID as e}from"crypto";var t=class{table;databaseConnection;constructor(e,t){this.app=e,this.table=t.table||`failed_jobs`,this.databaseConnection=t.database}getConnection(){return this.app.make(`db`).connection(this.databaseConnection)}async log(t,n,r,i){let a=e();return await this.getConnection().table(this.table).insert({uuid:a,connection:t,queue:n,payload:r,exception:this.formatException(i),failed_at:new Date().toISOString()}),a}async all(){return await this.getConnection().table(this.table).orderBy(`id`,`desc`).get()}async find(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).first()||null}async forget(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).delete()>0}async flush(e){let t=this.getConnection();if(e!==void 0&&e>0){let n=new Date(Date.now()-e*60*60*1e3).toISOString();await t.table(this.table).where(`failed_at`,`<=`,n).delete()}else await t.table(this.table).delete()}async count(e,t){let n=this.getConnection().table(this.table);return e&&(n=n.where(`connection`,`=`,e)),t&&(n=n.where(`queue`,`=`,t)),Number(await n.count())||0}formatException(e){let t=[`${e.constructor.name}: ${e.message}`];return e.stack&&t.push(``,e.stack),t.join(`
|
|
1
|
+
import{randomUUID as e}from"crypto";var t=class{app;table;databaseConnection;constructor(e,t){this.app=e,this.table=t.table||`failed_jobs`,this.databaseConnection=t.database}getConnection(){return this.app.make(`db`).connection(this.databaseConnection)}async log(t,n,r,i){let a=e();return await this.getConnection().table(this.table).insert({uuid:a,connection:t,queue:n,payload:r,exception:this.formatException(i),failed_at:new Date().toISOString()}),a}async all(){return await this.getConnection().table(this.table).orderBy(`id`,`desc`).get()}async find(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).first()||null}async forget(e){return await this.getConnection().table(this.table).where(`id`,`=`,e).orWhere(`uuid`,`=`,String(e)).delete()>0}async flush(e){let t=this.getConnection();if(e!==void 0&&e>0){let n=new Date(Date.now()-e*60*60*1e3).toISOString();await t.table(this.table).where(`failed_at`,`<=`,n).delete()}else await t.table(this.table).delete()}async count(e,t){let n=this.getConnection().table(this.table);return e&&(n=n.where(`connection`,`=`,e)),t&&(n=n.where(`queue`,`=`,t)),Number(await n.count())||0}formatException(e){let t=[`${e.constructor.name}: ${e.message}`];return e.stack&&t.push(``,e.stack),t.join(`
|
|
2
2
|
`)}};export{t as DatabaseFailedJobProvider};
|
|
3
3
|
//# sourceMappingURL=DatabaseFailedJobProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseFailedJobProvider.mjs","names":[],"sources":["../../../src/Queue/Failed/DatabaseFailedJobProvider.ts"],"sourcesContent":["/**\n * DatabaseFailedJobProvider\n *\n * Stores failed jobs in a database table.\n * Mirrors Laravel's Illuminate\\Queue\\Failed\\DatabaseUuidFailedJobProvider.\n */\n\nimport { randomUUID } from 'crypto';\nimport type { Connection } from '@/Database/Connection';\nimport type { DatabaseManager } from '@/Database/DatabaseManager';\nimport type { Application } from '@/Foundation/Application';\nimport type { FailedJobProvider, FailedJobRecord } from './FailedJobProvider';\n\nexport class DatabaseFailedJobProvider implements FailedJobProvider {\n protected table: string;\n protected databaseConnection?: string;\n\n constructor(\n protected app: Application,\n config: { table?: string; database?: string }\n ) {\n this.table = config.table || 'failed_jobs';\n this.databaseConnection = config.database;\n }\n\n /**\n * Get the database connection\n */\n protected getConnection(): Connection {\n const db = this.app.make<DatabaseManager>('db');\n return db.connection(this.databaseConnection);\n }\n\n async log(connection: string, queue: string, payload: string, exception: Error): Promise<string> {\n const uuid = randomUUID();\n const conn = this.getConnection();\n\n await conn.table(this.table).insert({\n uuid,\n connection,\n queue,\n payload,\n exception: this.formatException(exception),\n failed_at: new Date().toISOString(),\n });\n\n return uuid;\n }\n\n async all(): Promise<FailedJobRecord[]> {\n const conn = this.getConnection();\n const results = await conn.table(this.table).orderBy('id', 'desc').get();\n\n return results as FailedJobRecord[];\n }\n\n async find(id: string | number): Promise<FailedJobRecord | null> {\n const conn = this.getConnection();\n const result = await conn.table(this.table).where('id', '=', id).orWhere('uuid', '=', String(id)).first();\n\n return (result as FailedJobRecord) || null;\n }\n\n async forget(id: string | number): Promise<boolean> {\n const conn = this.getConnection();\n const deleted = await conn.table(this.table).where('id', '=', id).orWhere('uuid', '=', String(id)).delete();\n\n return deleted > 0;\n }\n\n async flush(hours?: number): Promise<void> {\n const conn = this.getConnection();\n\n if (hours !== undefined && hours > 0) {\n const cutoff = new Date(Date.now() - hours * 60 * 60 * 1000).toISOString();\n await conn.table(this.table).where('failed_at', '<=', cutoff).delete();\n } else {\n await conn.table(this.table).delete();\n }\n }\n\n async count(connection?: string, queue?: string): Promise<number> {\n const conn = this.getConnection();\n let query = conn.table(this.table);\n\n if (connection) {\n query = query.where('connection', '=', connection);\n }\n\n if (queue) {\n query = query.where('queue', '=', queue);\n }\n\n return Number(await query.count()) || 0;\n }\n\n /**\n * Format an exception for storage\n */\n protected formatException(exception: Error): string {\n const lines: string[] = [`${exception.constructor.name}: ${exception.message}`];\n\n if (exception.stack) {\n lines.push('', exception.stack);\n }\n\n return lines.join('\\n');\n }\n}\n"],"mappings":"oCAaA,IAAa,EAAb,KAAoE,
|
|
1
|
+
{"version":3,"file":"DatabaseFailedJobProvider.mjs","names":[],"sources":["../../../src/Queue/Failed/DatabaseFailedJobProvider.ts"],"sourcesContent":["/**\n * DatabaseFailedJobProvider\n *\n * Stores failed jobs in a database table.\n * Mirrors Laravel's Illuminate\\Queue\\Failed\\DatabaseUuidFailedJobProvider.\n */\n\nimport { randomUUID } from 'crypto';\nimport type { Connection } from '@/Database/Connection';\nimport type { DatabaseManager } from '@/Database/DatabaseManager';\nimport type { Application } from '@/Foundation/Application';\nimport type { FailedJobProvider, FailedJobRecord } from './FailedJobProvider';\n\nexport class DatabaseFailedJobProvider implements FailedJobProvider {\n protected table: string;\n protected databaseConnection?: string;\n\n constructor(\n protected app: Application,\n config: { table?: string; database?: string }\n ) {\n this.table = config.table || 'failed_jobs';\n this.databaseConnection = config.database;\n }\n\n /**\n * Get the database connection\n */\n protected getConnection(): Connection {\n const db = this.app.make<DatabaseManager>('db');\n return db.connection(this.databaseConnection);\n }\n\n async log(connection: string, queue: string, payload: string, exception: Error): Promise<string> {\n const uuid = randomUUID();\n const conn = this.getConnection();\n\n await conn.table(this.table).insert({\n uuid,\n connection,\n queue,\n payload,\n exception: this.formatException(exception),\n failed_at: new Date().toISOString(),\n });\n\n return uuid;\n }\n\n async all(): Promise<FailedJobRecord[]> {\n const conn = this.getConnection();\n const results = await conn.table(this.table).orderBy('id', 'desc').get();\n\n return results as FailedJobRecord[];\n }\n\n async find(id: string | number): Promise<FailedJobRecord | null> {\n const conn = this.getConnection();\n const result = await conn.table(this.table).where('id', '=', id).orWhere('uuid', '=', String(id)).first();\n\n return (result as FailedJobRecord) || null;\n }\n\n async forget(id: string | number): Promise<boolean> {\n const conn = this.getConnection();\n const deleted = await conn.table(this.table).where('id', '=', id).orWhere('uuid', '=', String(id)).delete();\n\n return deleted > 0;\n }\n\n async flush(hours?: number): Promise<void> {\n const conn = this.getConnection();\n\n if (hours !== undefined && hours > 0) {\n const cutoff = new Date(Date.now() - hours * 60 * 60 * 1000).toISOString();\n await conn.table(this.table).where('failed_at', '<=', cutoff).delete();\n } else {\n await conn.table(this.table).delete();\n }\n }\n\n async count(connection?: string, queue?: string): Promise<number> {\n const conn = this.getConnection();\n let query = conn.table(this.table);\n\n if (connection) {\n query = query.where('connection', '=', connection);\n }\n\n if (queue) {\n query = query.where('queue', '=', queue);\n }\n\n return Number(await query.count()) || 0;\n }\n\n /**\n * Format an exception for storage\n */\n protected formatException(exception: Error): string {\n const lines: string[] = [`${exception.constructor.name}: ${exception.message}`];\n\n if (exception.stack) {\n lines.push('', exception.stack);\n }\n\n return lines.join('\\n');\n }\n}\n"],"mappings":"oCAaA,IAAa,EAAb,KAAoE,CAKtD,IAJZ,MACA,mBAEA,YACE,EACA,EACA,CAFU,KAAA,IAAA,EAGV,KAAK,MAAQ,EAAO,OAAS,cAC7B,KAAK,mBAAqB,EAAO,SAMnC,eAAsC,CAEpC,OADW,KAAK,IAAI,KAAsB,KACjC,CAAC,WAAW,KAAK,mBAAmB,CAG/C,MAAM,IAAI,EAAoB,EAAe,EAAiB,EAAmC,CAC/F,IAAM,EAAO,GAAY,CAYzB,OATA,MAFa,KAAK,eAER,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CAClC,OACA,aACA,QACA,UACA,UAAW,KAAK,gBAAgB,EAAU,CAC1C,UAAW,IAAI,MAAM,CAAC,aAAa,CACpC,CAAC,CAEK,EAGT,MAAM,KAAkC,CAItC,OAAO,MAHM,KAAK,eACQ,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,KAAM,OAAO,CAAC,KAAK,CAK1E,MAAM,KAAK,EAAsD,CAI/D,OAAQ,MAHK,KAAK,eACO,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,KAAM,IAAK,EAAG,CAAC,QAAQ,OAAQ,IAAK,OAAO,EAAG,CAAC,CAAC,OAAO,EAEnE,KAGxC,MAAM,OAAO,EAAuC,CAIlD,OAAO,MAHM,KAAK,eACQ,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,KAAM,IAAK,EAAG,CAAC,QAAQ,OAAQ,IAAK,OAAO,EAAG,CAAC,CAAC,QAAQ,CAE1F,EAGnB,MAAM,MAAM,EAA+B,CACzC,IAAM,EAAO,KAAK,eAAe,CAEjC,GAAI,IAAU,IAAA,IAAa,EAAQ,EAAG,CACpC,IAAM,EAAS,IAAI,KAAK,KAAK,KAAK,CAAG,EAAQ,GAAK,GAAK,IAAK,CAAC,aAAa,CAC1E,MAAM,EAAK,MAAM,KAAK,MAAM,CAAC,MAAM,YAAa,KAAM,EAAO,CAAC,QAAQ,MAEtE,MAAM,EAAK,MAAM,KAAK,MAAM,CAAC,QAAQ,CAIzC,MAAM,MAAM,EAAqB,EAAiC,CAEhE,IAAI,EADS,KAAK,eACF,CAAC,MAAM,KAAK,MAAM,CAUlC,OARI,IACF,EAAQ,EAAM,MAAM,aAAc,IAAK,EAAW,EAGhD,IACF,EAAQ,EAAM,MAAM,QAAS,IAAK,EAAM,EAGnC,OAAO,MAAM,EAAM,OAAO,CAAC,EAAI,EAMxC,gBAA0B,EAA0B,CAClD,IAAM,EAAkB,CAAC,GAAG,EAAU,YAAY,KAAK,IAAI,EAAU,UAAU,CAM/E,OAJI,EAAU,OACZ,EAAM,KAAK,GAAI,EAAU,MAAM,CAG1B,EAAM,KAAK;EAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=new Map;var t=class{releaseAfterSeconds=0;constructor(e,t=1,n=60){this.key=e,this.maxAttempts=t,this.decaySeconds=n}async handle(t,n){let r=Math.floor(Date.now()/1e3),i=e.get(this.key);i&&i.resetAt<=r&&e.delete(this.key);let a=e.get(this.key);if(a&&a.count>=this.maxAttempts){let e=a.resetAt-r;t.release(this.releaseAfterSeconds||e);return}a?a.count++:e.set(this.key,{count:1,resetAt:r+this.decaySeconds}),await n()}releaseAfter(e){return this.releaseAfterSeconds=e,this}};exports.RateLimited=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=new Map;var t=class{key;maxAttempts;decaySeconds;releaseAfterSeconds=0;constructor(e,t=1,n=60){this.key=e,this.maxAttempts=t,this.decaySeconds=n}async handle(t,n){let r=Math.floor(Date.now()/1e3),i=e.get(this.key);i&&i.resetAt<=r&&e.delete(this.key);let a=e.get(this.key);if(a&&a.count>=this.maxAttempts){let e=a.resetAt-r;t.release(this.releaseAfterSeconds||e);return}a?a.count++:e.set(this.key,{count:1,resetAt:r+this.decaySeconds}),await n()}releaseAfter(e){return this.releaseAfterSeconds=e,this}};exports.RateLimited=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=new Map;var t=class{releaseAfterSeconds=0;constructor(e,t=1,n=60){this.key=e,this.maxAttempts=t,this.decaySeconds=n}async handle(t,n){let r=Math.floor(Date.now()/1e3),i=e.get(this.key);i&&i.resetAt<=r&&e.delete(this.key);let a=e.get(this.key);if(a&&a.count>=this.maxAttempts){let e=a.resetAt-r;t.release(this.releaseAfterSeconds||e);return}a?a.count++:e.set(this.key,{count:1,resetAt:r+this.decaySeconds}),await n()}releaseAfter(e){return this.releaseAfterSeconds=e,this}};export{t as RateLimited};
|
|
1
|
+
const e=new Map;var t=class{key;maxAttempts;decaySeconds;releaseAfterSeconds=0;constructor(e,t=1,n=60){this.key=e,this.maxAttempts=t,this.decaySeconds=n}async handle(t,n){let r=Math.floor(Date.now()/1e3),i=e.get(this.key);i&&i.resetAt<=r&&e.delete(this.key);let a=e.get(this.key);if(a&&a.count>=this.maxAttempts){let e=a.resetAt-r;t.release(this.releaseAfterSeconds||e);return}a?a.count++:e.set(this.key,{count:1,resetAt:r+this.decaySeconds}),await n()}releaseAfter(e){return this.releaseAfterSeconds=e,this}};export{t as RateLimited};
|
|
2
2
|
//# sourceMappingURL=RateLimited.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RateLimited.mjs","names":[],"sources":["../../../src/Queue/Middleware/RateLimited.ts"],"sourcesContent":["/**\n * RateLimited Middleware\n *\n * Rate limits job execution. When the rate limit is exceeded,\n * the job is released back onto the queue.\n *\n * Mirrors Laravel's Illuminate\\Queue\\Middleware\\RateLimited.\n *\n * @example\n * ```typescript\n * class ProcessPodcast extends Job {\n * middleware() {\n * return [new RateLimited('podcasts', 10, 60)];\n * }\n * }\n * ```\n */\n\nimport type { Job } from '@/Queue/Job';\nimport type { JobMiddleware } from './JobMiddleware';\n\n// Simple in-memory rate limiter store\nconst rateLimiterStore: Map<string, { count: number; resetAt: number }> = new Map();\n\nexport class RateLimited implements JobMiddleware {\n /**\n * The number of seconds to release the job for when rate limited\n */\n protected releaseAfterSeconds: number = 0;\n\n constructor(\n /**\n * The rate limiter key\n */\n protected key: string,\n\n /**\n * The maximum number of attempts within the decay period\n */\n protected maxAttempts: number = 1,\n\n /**\n * The number of seconds until the rate limit resets\n */\n protected decaySeconds: number = 60\n ) {}\n\n async handle(job: Job, next: () => Promise<void>): Promise<void> {\n const now = Math.floor(Date.now() / 1000);\n const limiter = rateLimiterStore.get(this.key);\n\n // Check if the rate limit has expired\n if (limiter && limiter.resetAt <= now) {\n rateLimiterStore.delete(this.key);\n }\n\n const current = rateLimiterStore.get(this.key);\n\n if (current && current.count >= this.maxAttempts) {\n // Rate limited - release the job back\n const retryAfter = current.resetAt - now;\n job.release(this.releaseAfterSeconds || retryAfter);\n return;\n }\n\n // Increment the counter\n if (current) {\n current.count++;\n } else {\n rateLimiterStore.set(this.key, {\n count: 1,\n resetAt: now + this.decaySeconds,\n });\n }\n\n await next();\n }\n\n /**\n * Set the number of seconds to release the job for\n */\n releaseAfter(seconds: number): this {\n this.releaseAfterSeconds = seconds;\n return this;\n }\n}\n"],"mappings":"AAsBA,MAAM,EAAoE,IAAI,IAE9E,IAAa,EAAb,KAAkD,
|
|
1
|
+
{"version":3,"file":"RateLimited.mjs","names":[],"sources":["../../../src/Queue/Middleware/RateLimited.ts"],"sourcesContent":["/**\n * RateLimited Middleware\n *\n * Rate limits job execution. When the rate limit is exceeded,\n * the job is released back onto the queue.\n *\n * Mirrors Laravel's Illuminate\\Queue\\Middleware\\RateLimited.\n *\n * @example\n * ```typescript\n * class ProcessPodcast extends Job {\n * middleware() {\n * return [new RateLimited('podcasts', 10, 60)];\n * }\n * }\n * ```\n */\n\nimport type { Job } from '@/Queue/Job';\nimport type { JobMiddleware } from './JobMiddleware';\n\n// Simple in-memory rate limiter store\nconst rateLimiterStore: Map<string, { count: number; resetAt: number }> = new Map();\n\nexport class RateLimited implements JobMiddleware {\n /**\n * The number of seconds to release the job for when rate limited\n */\n protected releaseAfterSeconds: number = 0;\n\n constructor(\n /**\n * The rate limiter key\n */\n protected key: string,\n\n /**\n * The maximum number of attempts within the decay period\n */\n protected maxAttempts: number = 1,\n\n /**\n * The number of seconds until the rate limit resets\n */\n protected decaySeconds: number = 60\n ) {}\n\n async handle(job: Job, next: () => Promise<void>): Promise<void> {\n const now = Math.floor(Date.now() / 1000);\n const limiter = rateLimiterStore.get(this.key);\n\n // Check if the rate limit has expired\n if (limiter && limiter.resetAt <= now) {\n rateLimiterStore.delete(this.key);\n }\n\n const current = rateLimiterStore.get(this.key);\n\n if (current && current.count >= this.maxAttempts) {\n // Rate limited - release the job back\n const retryAfter = current.resetAt - now;\n job.release(this.releaseAfterSeconds || retryAfter);\n return;\n }\n\n // Increment the counter\n if (current) {\n current.count++;\n } else {\n rateLimiterStore.set(this.key, {\n count: 1,\n resetAt: now + this.decaySeconds,\n });\n }\n\n await next();\n }\n\n /**\n * Set the number of seconds to release the job for\n */\n releaseAfter(seconds: number): this {\n this.releaseAfterSeconds = seconds;\n return this;\n }\n}\n"],"mappings":"AAsBA,MAAM,EAAoE,IAAI,IAE9E,IAAa,EAAb,KAAkD,CAUpC,IAKA,YAKA,aAhBZ,oBAAwC,EAExC,YAIE,EAKA,EAAgC,EAKhC,EAAiC,GACjC,CAXU,KAAA,IAAA,EAKA,KAAA,YAAA,EAKA,KAAA,aAAA,EAGZ,MAAM,OAAO,EAAU,EAA0C,CAC/D,IAAM,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CACnC,EAAU,EAAiB,IAAI,KAAK,IAAI,CAG1C,GAAW,EAAQ,SAAW,GAChC,EAAiB,OAAO,KAAK,IAAI,CAGnC,IAAM,EAAU,EAAiB,IAAI,KAAK,IAAI,CAE9C,GAAI,GAAW,EAAQ,OAAS,KAAK,YAAa,CAEhD,IAAM,EAAa,EAAQ,QAAU,EACrC,EAAI,QAAQ,KAAK,qBAAuB,EAAW,CACnD,OAIE,EACF,EAAQ,QAER,EAAiB,IAAI,KAAK,IAAK,CAC7B,MAAO,EACP,QAAS,EAAM,KAAK,aACrB,CAAC,CAGJ,MAAM,GAAM,CAMd,aAAa,EAAuB,CAElC,MADA,MAAK,oBAAsB,EACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=new Map;var t=class{backoffMinutes=5;keyPrefix=``;shouldRetryOnThrottle=!0;constructor(e=10,t=10){this.maxExceptions=e,this.decayMinutes=t}async handle(t,n){let r=this.getKey(t),i=Math.floor(Date.now()/1e3),a=e.get(r);a&&a.resetAt<=i&&e.delete(r);let o=e.get(r);if(o&&o.count>=this.maxExceptions){this.shouldRetryOnThrottle?t.release(this.backoffMinutes*60):t.delete();return}try{await n()}catch(t){throw o?o.count++:e.set(r,{count:1,resetAt:i+this.decayMinutes*60}),t}}getKey(e){return`throttle:${this.keyPrefix||e.displayName()}`}backoff(e){return this.backoffMinutes=e,this}by(e){return this.keyPrefix=e,this}dontRetry(){return this.shouldRetryOnThrottle=!1,this}};exports.ThrottlesExceptions=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=new Map;var t=class{maxExceptions;decayMinutes;backoffMinutes=5;keyPrefix=``;shouldRetryOnThrottle=!0;constructor(e=10,t=10){this.maxExceptions=e,this.decayMinutes=t}async handle(t,n){let r=this.getKey(t),i=Math.floor(Date.now()/1e3),a=e.get(r);a&&a.resetAt<=i&&e.delete(r);let o=e.get(r);if(o&&o.count>=this.maxExceptions){this.shouldRetryOnThrottle?t.release(this.backoffMinutes*60):t.delete();return}try{await n()}catch(t){throw o?o.count++:e.set(r,{count:1,resetAt:i+this.decayMinutes*60}),t}}getKey(e){return`throttle:${this.keyPrefix||e.displayName()}`}backoff(e){return this.backoffMinutes=e,this}by(e){return this.keyPrefix=e,this}dontRetry(){return this.shouldRetryOnThrottle=!1,this}};exports.ThrottlesExceptions=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=new Map;var t=class{backoffMinutes=5;keyPrefix=``;shouldRetryOnThrottle=!0;constructor(e=10,t=10){this.maxExceptions=e,this.decayMinutes=t}async handle(t,n){let r=this.getKey(t),i=Math.floor(Date.now()/1e3),a=e.get(r);a&&a.resetAt<=i&&e.delete(r);let o=e.get(r);if(o&&o.count>=this.maxExceptions){this.shouldRetryOnThrottle?t.release(this.backoffMinutes*60):t.delete();return}try{await n()}catch(t){throw o?o.count++:e.set(r,{count:1,resetAt:i+this.decayMinutes*60}),t}}getKey(e){return`throttle:${this.keyPrefix||e.displayName()}`}backoff(e){return this.backoffMinutes=e,this}by(e){return this.keyPrefix=e,this}dontRetry(){return this.shouldRetryOnThrottle=!1,this}};export{t as ThrottlesExceptions};
|
|
1
|
+
const e=new Map;var t=class{maxExceptions;decayMinutes;backoffMinutes=5;keyPrefix=``;shouldRetryOnThrottle=!0;constructor(e=10,t=10){this.maxExceptions=e,this.decayMinutes=t}async handle(t,n){let r=this.getKey(t),i=Math.floor(Date.now()/1e3),a=e.get(r);a&&a.resetAt<=i&&e.delete(r);let o=e.get(r);if(o&&o.count>=this.maxExceptions){this.shouldRetryOnThrottle?t.release(this.backoffMinutes*60):t.delete();return}try{await n()}catch(t){throw o?o.count++:e.set(r,{count:1,resetAt:i+this.decayMinutes*60}),t}}getKey(e){return`throttle:${this.keyPrefix||e.displayName()}`}backoff(e){return this.backoffMinutes=e,this}by(e){return this.keyPrefix=e,this}dontRetry(){return this.shouldRetryOnThrottle=!1,this}};export{t as ThrottlesExceptions};
|
|
2
2
|
//# sourceMappingURL=ThrottlesExceptions.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThrottlesExceptions.mjs","names":[],"sources":["../../../src/Queue/Middleware/ThrottlesExceptions.ts"],"sourcesContent":["/**\n * ThrottlesExceptions Middleware\n *\n * When a job throws too many exceptions within a given time window,\n * subsequent attempts are delayed to prevent rapid failure loops.\n *\n * Mirrors Laravel's Illuminate\\Queue\\Middleware\\ThrottlesExceptions.\n *\n * @example\n * ```typescript\n * class ProcessPodcast extends Job {\n * middleware() {\n * return [\n * new ThrottlesExceptions(10, 5) // 10 exceptions per 5 minutes\n * .backoff(5) // Wait 5 minutes before retrying\n * ];\n * }\n * }\n * ```\n */\n\nimport type { Job } from '@/Queue/Job';\nimport type { JobMiddleware } from './JobMiddleware';\n\n// In-memory exception tracking\nconst exceptionStore: Map<string, { count: number; resetAt: number }> = new Map();\n\nexport class ThrottlesExceptions implements JobMiddleware {\n /**\n * The number of minutes to back off for\n */\n protected backoffMinutes: number = 5;\n\n /**\n * The prefix for the throttle key\n */\n protected keyPrefix: string = '';\n\n /**\n * Whether to retry the job or delete it when throttled\n */\n protected shouldRetryOnThrottle: boolean = true;\n\n constructor(\n /**\n * The maximum number of exceptions allowed\n */\n protected maxExceptions: number = 10,\n\n /**\n * The number of minutes in the decay window\n */\n protected decayMinutes: number = 10\n ) {}\n\n async handle(job: Job, next: () => Promise<void>): Promise<void> {\n const key = this.getKey(job);\n const now = Math.floor(Date.now() / 1000);\n\n // Clean up expired entries\n const existing = exceptionStore.get(key);\n if (existing && existing.resetAt <= now) {\n exceptionStore.delete(key);\n }\n\n const current = exceptionStore.get(key);\n\n // Check if throttled\n if (current && current.count >= this.maxExceptions) {\n if (this.shouldRetryOnThrottle) {\n job.release(this.backoffMinutes * 60);\n } else {\n job.delete();\n }\n return;\n }\n\n try {\n await next();\n } catch (error) {\n // Record the exception\n if (current) {\n current.count++;\n } else {\n exceptionStore.set(key, {\n count: 1,\n resetAt: now + this.decayMinutes * 60,\n });\n }\n\n throw error;\n }\n }\n\n /**\n * Get the throttle key for this job\n */\n protected getKey(job: Job): string {\n const prefix = this.keyPrefix || job.displayName();\n return `throttle:${prefix}`;\n }\n\n /**\n * Set the number of minutes to back off for when throttled\n */\n backoff(minutes: number): this {\n this.backoffMinutes = minutes;\n return this;\n }\n\n /**\n * Set a custom key prefix\n */\n by(key: string): this {\n this.keyPrefix = key;\n return this;\n }\n\n /**\n * Indicate the job should NOT be retried when throttled\n */\n dontRetry(): this {\n this.shouldRetryOnThrottle = false;\n return this;\n }\n}\n"],"mappings":"AAyBA,MAAM,EAAkE,IAAI,IAE5E,IAAa,EAAb,KAA0D,
|
|
1
|
+
{"version":3,"file":"ThrottlesExceptions.mjs","names":[],"sources":["../../../src/Queue/Middleware/ThrottlesExceptions.ts"],"sourcesContent":["/**\n * ThrottlesExceptions Middleware\n *\n * When a job throws too many exceptions within a given time window,\n * subsequent attempts are delayed to prevent rapid failure loops.\n *\n * Mirrors Laravel's Illuminate\\Queue\\Middleware\\ThrottlesExceptions.\n *\n * @example\n * ```typescript\n * class ProcessPodcast extends Job {\n * middleware() {\n * return [\n * new ThrottlesExceptions(10, 5) // 10 exceptions per 5 minutes\n * .backoff(5) // Wait 5 minutes before retrying\n * ];\n * }\n * }\n * ```\n */\n\nimport type { Job } from '@/Queue/Job';\nimport type { JobMiddleware } from './JobMiddleware';\n\n// In-memory exception tracking\nconst exceptionStore: Map<string, { count: number; resetAt: number }> = new Map();\n\nexport class ThrottlesExceptions implements JobMiddleware {\n /**\n * The number of minutes to back off for\n */\n protected backoffMinutes: number = 5;\n\n /**\n * The prefix for the throttle key\n */\n protected keyPrefix: string = '';\n\n /**\n * Whether to retry the job or delete it when throttled\n */\n protected shouldRetryOnThrottle: boolean = true;\n\n constructor(\n /**\n * The maximum number of exceptions allowed\n */\n protected maxExceptions: number = 10,\n\n /**\n * The number of minutes in the decay window\n */\n protected decayMinutes: number = 10\n ) {}\n\n async handle(job: Job, next: () => Promise<void>): Promise<void> {\n const key = this.getKey(job);\n const now = Math.floor(Date.now() / 1000);\n\n // Clean up expired entries\n const existing = exceptionStore.get(key);\n if (existing && existing.resetAt <= now) {\n exceptionStore.delete(key);\n }\n\n const current = exceptionStore.get(key);\n\n // Check if throttled\n if (current && current.count >= this.maxExceptions) {\n if (this.shouldRetryOnThrottle) {\n job.release(this.backoffMinutes * 60);\n } else {\n job.delete();\n }\n return;\n }\n\n try {\n await next();\n } catch (error) {\n // Record the exception\n if (current) {\n current.count++;\n } else {\n exceptionStore.set(key, {\n count: 1,\n resetAt: now + this.decayMinutes * 60,\n });\n }\n\n throw error;\n }\n }\n\n /**\n * Get the throttle key for this job\n */\n protected getKey(job: Job): string {\n const prefix = this.keyPrefix || job.displayName();\n return `throttle:${prefix}`;\n }\n\n /**\n * Set the number of minutes to back off for when throttled\n */\n backoff(minutes: number): this {\n this.backoffMinutes = minutes;\n return this;\n }\n\n /**\n * Set a custom key prefix\n */\n by(key: string): this {\n this.keyPrefix = key;\n return this;\n }\n\n /**\n * Indicate the job should NOT be retried when throttled\n */\n dontRetry(): this {\n this.shouldRetryOnThrottle = false;\n return this;\n }\n}\n"],"mappings":"AAyBA,MAAM,EAAkE,IAAI,IAE5E,IAAa,EAAb,KAA0D,CAoB5C,cAKA,aArBZ,eAAmC,EAKnC,UAA8B,GAK9B,sBAA2C,GAE3C,YAIE,EAAkC,GAKlC,EAAiC,GACjC,CANU,KAAA,cAAA,EAKA,KAAA,aAAA,EAGZ,MAAM,OAAO,EAAU,EAA0C,CAC/D,IAAM,EAAM,KAAK,OAAO,EAAI,CACtB,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAGnC,EAAW,EAAe,IAAI,EAAI,CACpC,GAAY,EAAS,SAAW,GAClC,EAAe,OAAO,EAAI,CAG5B,IAAM,EAAU,EAAe,IAAI,EAAI,CAGvC,GAAI,GAAW,EAAQ,OAAS,KAAK,cAAe,CAC9C,KAAK,sBACP,EAAI,QAAQ,KAAK,eAAiB,GAAG,CAErC,EAAI,QAAQ,CAEd,OAGF,GAAI,CACF,MAAM,GAAM,OACL,EAAO,CAWd,MATI,EACF,EAAQ,QAER,EAAe,IAAI,EAAK,CACtB,MAAO,EACP,QAAS,EAAM,KAAK,aAAe,GACpC,CAAC,CAGE,GAOV,OAAiB,EAAkB,CAEjC,MAAO,YADQ,KAAK,WAAa,EAAI,aAAa,GAOpD,QAAQ,EAAuB,CAE7B,MADA,MAAK,eAAiB,EACf,KAMT,GAAG,EAAmB,CAEpB,MADA,MAAK,UAAY,EACV,KAMT,WAAkB,CAEhB,MADA,MAAK,sBAAwB,GACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../_virtual/_rolldown/runtime.cjs`);const e=new Map;var t=class{releaseAfterSeconds=0;lockExpiresAfter=0;shouldDontRelease=!1;constructor(e,t=`overlap:`){this.key=e,this.prefix=t}async handle(t,n){let r=`${this.prefix}${this.key}`,i=Math.floor(Date.now()/1e3),a=e.get(r);if(a&&a.expiresAt>0&&a.expiresAt<=i&&e.delete(r),e.has(r)){if(this.shouldDontRelease){t.delete();return}t.release(this.releaseAfterSeconds||5);return}let o=this.lockExpiresAfter>0?i+this.lockExpiresAfter:0;e.set(r,{expiresAt:o});try{await n()}finally{e.delete(r)}}releaseAfter(e){return this.releaseAfterSeconds=e,this}expireAfter(e){return this.lockExpiresAfter=e,this}dontRelease(){return this.shouldDontRelease=!0,this}};exports.WithoutOverlapping=t;
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=new Map;var t=class{key;prefix;releaseAfterSeconds=0;lockExpiresAfter=0;shouldDontRelease=!1;constructor(e,t=`overlap:`){this.key=e,this.prefix=t}async handle(t,n){let r=`${this.prefix}${this.key}`,i=Math.floor(Date.now()/1e3),a=e.get(r);if(a&&a.expiresAt>0&&a.expiresAt<=i&&e.delete(r),e.has(r)){if(this.shouldDontRelease){t.delete();return}t.release(this.releaseAfterSeconds||5);return}let o=this.lockExpiresAfter>0?i+this.lockExpiresAfter:0;e.set(r,{expiresAt:o});try{await n()}finally{e.delete(r)}}releaseAfter(e){return this.releaseAfterSeconds=e,this}expireAfter(e){return this.lockExpiresAfter=e,this}dontRelease(){return this.shouldDontRelease=!0,this}};exports.WithoutOverlapping=t;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=new Map;var t=class{releaseAfterSeconds=0;lockExpiresAfter=0;shouldDontRelease=!1;constructor(e,t=`overlap:`){this.key=e,this.prefix=t}async handle(t,n){let r=`${this.prefix}${this.key}`,i=Math.floor(Date.now()/1e3),a=e.get(r);if(a&&a.expiresAt>0&&a.expiresAt<=i&&e.delete(r),e.has(r)){if(this.shouldDontRelease){t.delete();return}t.release(this.releaseAfterSeconds||5);return}let o=this.lockExpiresAfter>0?i+this.lockExpiresAfter:0;e.set(r,{expiresAt:o});try{await n()}finally{e.delete(r)}}releaseAfter(e){return this.releaseAfterSeconds=e,this}expireAfter(e){return this.lockExpiresAfter=e,this}dontRelease(){return this.shouldDontRelease=!0,this}};export{t as WithoutOverlapping};
|
|
1
|
+
const e=new Map;var t=class{key;prefix;releaseAfterSeconds=0;lockExpiresAfter=0;shouldDontRelease=!1;constructor(e,t=`overlap:`){this.key=e,this.prefix=t}async handle(t,n){let r=`${this.prefix}${this.key}`,i=Math.floor(Date.now()/1e3),a=e.get(r);if(a&&a.expiresAt>0&&a.expiresAt<=i&&e.delete(r),e.has(r)){if(this.shouldDontRelease){t.delete();return}t.release(this.releaseAfterSeconds||5);return}let o=this.lockExpiresAfter>0?i+this.lockExpiresAfter:0;e.set(r,{expiresAt:o});try{await n()}finally{e.delete(r)}}releaseAfter(e){return this.releaseAfterSeconds=e,this}expireAfter(e){return this.lockExpiresAfter=e,this}dontRelease(){return this.shouldDontRelease=!0,this}};export{t as WithoutOverlapping};
|
|
2
2
|
//# sourceMappingURL=WithoutOverlapping.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithoutOverlapping.mjs","names":[],"sources":["../../../src/Queue/Middleware/WithoutOverlapping.ts"],"sourcesContent":["/**\n * WithoutOverlapping Middleware\n *\n * Prevents a job from running if another instance with the same\n * key is currently being processed.\n *\n * Mirrors Laravel's Illuminate\\Queue\\Middleware\\WithoutOverlapping.\n *\n * @example\n * ```typescript\n * class UpdateSearchIndex extends Job {\n * middleware() {\n * return [new WithoutOverlapping(this.productId)];\n * }\n * }\n * ```\n */\n\nimport type { Job } from '@/Queue/Job';\nimport type { JobMiddleware } from './JobMiddleware';\n\n// Simple in-memory lock store\nconst lockStore: Map<string, { expiresAt: number }> = new Map();\n\nexport class WithoutOverlapping implements JobMiddleware {\n /**\n * The number of seconds to release the job for if locked\n */\n protected releaseAfterSeconds: number = 0;\n\n /**\n * The number of seconds the lock should be held\n */\n protected lockExpiresAfter: number = 0;\n\n /**\n * Whether to skip the job entirely if locked (vs releasing back to queue)\n */\n protected shouldDontRelease: boolean = false;\n\n constructor(\n /**\n * The lock key to prevent overlapping\n */\n protected key: string | number,\n\n /**\n * The prefix for the lock key\n */\n protected prefix: string = 'overlap:'\n ) {}\n\n async handle(job: Job, next: () => Promise<void>): Promise<void> {\n const lockKey = `${this.prefix}${this.key}`;\n const now = Math.floor(Date.now() / 1000);\n\n // Clean up expired locks\n const existing = lockStore.get(lockKey);\n if (existing && existing.expiresAt > 0 && existing.expiresAt <= now) {\n lockStore.delete(lockKey);\n }\n\n // Check if locked\n if (lockStore.has(lockKey)) {\n if (this.shouldDontRelease) {\n // Skip the job entirely\n job.delete();\n return;\n }\n\n // Release back onto the queue\n job.release(this.releaseAfterSeconds || 5);\n return;\n }\n\n // Acquire lock\n const expiresAt = this.lockExpiresAfter > 0 ? now + this.lockExpiresAfter : 0;\n lockStore.set(lockKey, { expiresAt });\n\n try {\n await next();\n } finally {\n // Release lock\n lockStore.delete(lockKey);\n }\n }\n\n /**\n * Set the number of seconds to release the job for if locked\n */\n releaseAfter(seconds: number): this {\n this.releaseAfterSeconds = seconds;\n return this;\n }\n\n /**\n * Set the lock expiration time in seconds\n */\n expireAfter(seconds: number): this {\n this.lockExpiresAfter = seconds;\n return this;\n }\n\n /**\n * Indicate the job should be deleted if locked (instead of released)\n */\n dontRelease(): this {\n this.shouldDontRelease = true;\n return this;\n }\n}\n"],"mappings":"AAsBA,MAAM,EAAgD,IAAI,IAE1D,IAAa,EAAb,KAAyD,
|
|
1
|
+
{"version":3,"file":"WithoutOverlapping.mjs","names":[],"sources":["../../../src/Queue/Middleware/WithoutOverlapping.ts"],"sourcesContent":["/**\n * WithoutOverlapping Middleware\n *\n * Prevents a job from running if another instance with the same\n * key is currently being processed.\n *\n * Mirrors Laravel's Illuminate\\Queue\\Middleware\\WithoutOverlapping.\n *\n * @example\n * ```typescript\n * class UpdateSearchIndex extends Job {\n * middleware() {\n * return [new WithoutOverlapping(this.productId)];\n * }\n * }\n * ```\n */\n\nimport type { Job } from '@/Queue/Job';\nimport type { JobMiddleware } from './JobMiddleware';\n\n// Simple in-memory lock store\nconst lockStore: Map<string, { expiresAt: number }> = new Map();\n\nexport class WithoutOverlapping implements JobMiddleware {\n /**\n * The number of seconds to release the job for if locked\n */\n protected releaseAfterSeconds: number = 0;\n\n /**\n * The number of seconds the lock should be held\n */\n protected lockExpiresAfter: number = 0;\n\n /**\n * Whether to skip the job entirely if locked (vs releasing back to queue)\n */\n protected shouldDontRelease: boolean = false;\n\n constructor(\n /**\n * The lock key to prevent overlapping\n */\n protected key: string | number,\n\n /**\n * The prefix for the lock key\n */\n protected prefix: string = 'overlap:'\n ) {}\n\n async handle(job: Job, next: () => Promise<void>): Promise<void> {\n const lockKey = `${this.prefix}${this.key}`;\n const now = Math.floor(Date.now() / 1000);\n\n // Clean up expired locks\n const existing = lockStore.get(lockKey);\n if (existing && existing.expiresAt > 0 && existing.expiresAt <= now) {\n lockStore.delete(lockKey);\n }\n\n // Check if locked\n if (lockStore.has(lockKey)) {\n if (this.shouldDontRelease) {\n // Skip the job entirely\n job.delete();\n return;\n }\n\n // Release back onto the queue\n job.release(this.releaseAfterSeconds || 5);\n return;\n }\n\n // Acquire lock\n const expiresAt = this.lockExpiresAfter > 0 ? now + this.lockExpiresAfter : 0;\n lockStore.set(lockKey, { expiresAt });\n\n try {\n await next();\n } finally {\n // Release lock\n lockStore.delete(lockKey);\n }\n }\n\n /**\n * Set the number of seconds to release the job for if locked\n */\n releaseAfter(seconds: number): this {\n this.releaseAfterSeconds = seconds;\n return this;\n }\n\n /**\n * Set the lock expiration time in seconds\n */\n expireAfter(seconds: number): this {\n this.lockExpiresAfter = seconds;\n return this;\n }\n\n /**\n * Indicate the job should be deleted if locked (instead of released)\n */\n dontRelease(): this {\n this.shouldDontRelease = true;\n return this;\n }\n}\n"],"mappings":"AAsBA,MAAM,EAAgD,IAAI,IAE1D,IAAa,EAAb,KAAyD,CAoB3C,IAKA,OArBZ,oBAAwC,EAKxC,iBAAqC,EAKrC,kBAAuC,GAEvC,YAIE,EAKA,EAA2B,WAC3B,CANU,KAAA,IAAA,EAKA,KAAA,OAAA,EAGZ,MAAM,OAAO,EAAU,EAA0C,CAC/D,IAAM,EAAU,GAAG,KAAK,SAAS,KAAK,MAChC,EAAM,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAGnC,EAAW,EAAU,IAAI,EAAQ,CAMvC,GALI,GAAY,EAAS,UAAY,GAAK,EAAS,WAAa,GAC9D,EAAU,OAAO,EAAQ,CAIvB,EAAU,IAAI,EAAQ,CAAE,CAC1B,GAAI,KAAK,kBAAmB,CAE1B,EAAI,QAAQ,CACZ,OAIF,EAAI,QAAQ,KAAK,qBAAuB,EAAE,CAC1C,OAIF,IAAM,EAAY,KAAK,iBAAmB,EAAI,EAAM,KAAK,iBAAmB,EAC5E,EAAU,IAAI,EAAS,CAAE,YAAW,CAAC,CAErC,GAAI,CACF,MAAM,GAAM,QACJ,CAER,EAAU,OAAO,EAAQ,EAO7B,aAAa,EAAuB,CAElC,MADA,MAAK,oBAAsB,EACpB,KAMT,YAAY,EAAuB,CAEjC,MADA,MAAK,iBAAmB,EACjB,KAMT,aAAoB,CAElB,MADA,MAAK,kBAAoB,GAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);var e=class{_connection;_queue;_delay;_catchCallback;_finallyCallback;constructor(e,t){this.manager=e,this.jobs=t}onConnection(e){return this._connection=e,this}onQueue(e){return this._queue=e,this}delay(e){return this._delay=e,this}catch(e){return this._catchCallback=e,this}finally(e){return this._finallyCallback=e,this}async dispatch(){if(this.jobs.length===0)throw Error(`Cannot dispatch an empty chain.`);for(let e of this.jobs)this._connection&&(e.connection=this._connection),this._queue&&(e.queue=this._queue);let e=this.jobs[0];return e._chainJobs=this.jobs.slice(1).map(e=>({class:e.constructor.name,data:e.toJSON()})),e._chainCatch=this._catchCallback,e._chainFinally=this._finallyCallback,this._delay&&(e.delay=this._delay),this.manager.dispatch(e)}};exports.PendingChain=e;
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);var e=class{manager;jobs;_connection;_queue;_delay;_catchCallback;_finallyCallback;constructor(e,t){this.manager=e,this.jobs=t}onConnection(e){return this._connection=e,this}onQueue(e){return this._queue=e,this}delay(e){return this._delay=e,this}catch(e){return this._catchCallback=e,this}finally(e){return this._finallyCallback=e,this}async dispatch(){if(this.jobs.length===0)throw Error(`Cannot dispatch an empty chain.`);for(let e of this.jobs)this._connection&&(e.connection=this._connection),this._queue&&(e.queue=this._queue);let e=this.jobs[0];return e._chainJobs=this.jobs.slice(1).map(e=>({class:e.constructor.name,data:e.toJSON()})),e._chainCatch=this._catchCallback,e._chainFinally=this._finallyCallback,this._delay&&(e.delay=this._delay),this.manager.dispatch(e)}};exports.PendingChain=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{_connection;_queue;_delay;_catchCallback;_finallyCallback;constructor(e,t){this.manager=e,this.jobs=t}onConnection(e){return this._connection=e,this}onQueue(e){return this._queue=e,this}delay(e){return this._delay=e,this}catch(e){return this._catchCallback=e,this}finally(e){return this._finallyCallback=e,this}async dispatch(){if(this.jobs.length===0)throw Error(`Cannot dispatch an empty chain.`);for(let e of this.jobs)this._connection&&(e.connection=this._connection),this._queue&&(e.queue=this._queue);let e=this.jobs[0];return e._chainJobs=this.jobs.slice(1).map(e=>({class:e.constructor.name,data:e.toJSON()})),e._chainCatch=this._catchCallback,e._chainFinally=this._finallyCallback,this._delay&&(e.delay=this._delay),this.manager.dispatch(e)}};export{e as PendingChain};
|
|
1
|
+
var e=class{manager;jobs;_connection;_queue;_delay;_catchCallback;_finallyCallback;constructor(e,t){this.manager=e,this.jobs=t}onConnection(e){return this._connection=e,this}onQueue(e){return this._queue=e,this}delay(e){return this._delay=e,this}catch(e){return this._catchCallback=e,this}finally(e){return this._finallyCallback=e,this}async dispatch(){if(this.jobs.length===0)throw Error(`Cannot dispatch an empty chain.`);for(let e of this.jobs)this._connection&&(e.connection=this._connection),this._queue&&(e.queue=this._queue);let e=this.jobs[0];return e._chainJobs=this.jobs.slice(1).map(e=>({class:e.constructor.name,data:e.toJSON()})),e._chainCatch=this._catchCallback,e._chainFinally=this._finallyCallback,this._delay&&(e.delay=this._delay),this.manager.dispatch(e)}};export{e as PendingChain};
|
|
2
2
|
//# sourceMappingURL=PendingChain.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PendingChain.mjs","names":[],"sources":["../../src/Queue/PendingChain.ts"],"sourcesContent":["/**\n * PendingChain\n *\n * Fluent builder for chaining multiple jobs together.\n * Jobs in a chain are executed sequentially - if one fails,\n * the remaining jobs in the chain are not executed.\n *\n * Mirrors Laravel's Illuminate\\Foundation\\Bus\\PendingChain.\n *\n * @example\n * ```typescript\n * await Bus.chain([\n * new ProcessPodcast(id),\n * new OptimizePodcast(id),\n * new ReleasePodcast(id),\n * ])\n * .onConnection('redis')\n * .onQueue('processing')\n * .catch((error) => console.error('Chain failed:', error))\n * .dispatch();\n * ```\n */\n\nimport type { Job } from './Job';\nimport type { QueueManager } from './QueueManager';\n\nexport class PendingChain {\n protected _connection?: string;\n protected _queue?: string;\n protected _delay?: number | Date;\n protected _catchCallback?: (error: Error) => void | Promise<void>;\n protected _finallyCallback?: () => void | Promise<void>;\n\n constructor(\n protected manager: QueueManager,\n protected jobs: Job[]\n ) {}\n\n /**\n * Set the connection for all jobs in the chain\n */\n onConnection(connection: string): this {\n this._connection = connection;\n return this;\n }\n\n /**\n * Set the queue for all jobs in the chain\n */\n onQueue(queue: string): this {\n this._queue = queue;\n return this;\n }\n\n /**\n * Set the delay before the first job starts\n */\n delay(delay: number | Date): this {\n this._delay = delay;\n return this;\n }\n\n /**\n * Set a callback to execute if any job in the chain fails\n */\n catch(callback: (error: Error) => void | Promise<void>): this {\n this._catchCallback = callback;\n return this;\n }\n\n /**\n * Set a callback to execute when the chain completes (success or failure)\n */\n finally(callback: () => void | Promise<void>): this {\n this._finallyCallback = callback;\n return this;\n }\n\n /**\n * Dispatch the chain\n *\n * The first job is dispatched immediately. Each subsequent job\n * stores the remaining chain and dispatches the next job upon\n * successful completion.\n */\n async dispatch(): Promise<string> {\n if (this.jobs.length === 0) {\n throw new Error('Cannot dispatch an empty chain.');\n }\n\n // Apply connection/queue to all jobs\n for (const job of this.jobs) {\n if (this._connection) {\n job.connection = this._connection;\n }\n if (this._queue) {\n job.queue = this._queue;\n }\n }\n\n // Store chain metadata on the first job\n const firstJob = this.jobs[0];\n const remainingJobs = this.jobs.slice(1);\n\n // Store chain info as serializable data\n (firstJob as any)._chainJobs = remainingJobs.map((j) => ({\n class: j.constructor.name,\n data: j.toJSON(),\n }));\n (firstJob as any)._chainCatch = this._catchCallback;\n (firstJob as any)._chainFinally = this._finallyCallback;\n\n // Apply delay to first job only\n if (this._delay) {\n firstJob.delay = this._delay;\n }\n\n return this.manager.dispatch(firstJob);\n }\n}\n"],"mappings":"AA0BA,IAAa,EAAb,KAA0B,
|
|
1
|
+
{"version":3,"file":"PendingChain.mjs","names":[],"sources":["../../src/Queue/PendingChain.ts"],"sourcesContent":["/**\n * PendingChain\n *\n * Fluent builder for chaining multiple jobs together.\n * Jobs in a chain are executed sequentially - if one fails,\n * the remaining jobs in the chain are not executed.\n *\n * Mirrors Laravel's Illuminate\\Foundation\\Bus\\PendingChain.\n *\n * @example\n * ```typescript\n * await Bus.chain([\n * new ProcessPodcast(id),\n * new OptimizePodcast(id),\n * new ReleasePodcast(id),\n * ])\n * .onConnection('redis')\n * .onQueue('processing')\n * .catch((error) => console.error('Chain failed:', error))\n * .dispatch();\n * ```\n */\n\nimport type { Job } from './Job';\nimport type { QueueManager } from './QueueManager';\n\nexport class PendingChain {\n protected _connection?: string;\n protected _queue?: string;\n protected _delay?: number | Date;\n protected _catchCallback?: (error: Error) => void | Promise<void>;\n protected _finallyCallback?: () => void | Promise<void>;\n\n constructor(\n protected manager: QueueManager,\n protected jobs: Job[]\n ) {}\n\n /**\n * Set the connection for all jobs in the chain\n */\n onConnection(connection: string): this {\n this._connection = connection;\n return this;\n }\n\n /**\n * Set the queue for all jobs in the chain\n */\n onQueue(queue: string): this {\n this._queue = queue;\n return this;\n }\n\n /**\n * Set the delay before the first job starts\n */\n delay(delay: number | Date): this {\n this._delay = delay;\n return this;\n }\n\n /**\n * Set a callback to execute if any job in the chain fails\n */\n catch(callback: (error: Error) => void | Promise<void>): this {\n this._catchCallback = callback;\n return this;\n }\n\n /**\n * Set a callback to execute when the chain completes (success or failure)\n */\n finally(callback: () => void | Promise<void>): this {\n this._finallyCallback = callback;\n return this;\n }\n\n /**\n * Dispatch the chain\n *\n * The first job is dispatched immediately. Each subsequent job\n * stores the remaining chain and dispatches the next job upon\n * successful completion.\n */\n async dispatch(): Promise<string> {\n if (this.jobs.length === 0) {\n throw new Error('Cannot dispatch an empty chain.');\n }\n\n // Apply connection/queue to all jobs\n for (const job of this.jobs) {\n if (this._connection) {\n job.connection = this._connection;\n }\n if (this._queue) {\n job.queue = this._queue;\n }\n }\n\n // Store chain metadata on the first job\n const firstJob = this.jobs[0];\n const remainingJobs = this.jobs.slice(1);\n\n // Store chain info as serializable data\n (firstJob as any)._chainJobs = remainingJobs.map((j) => ({\n class: j.constructor.name,\n data: j.toJSON(),\n }));\n (firstJob as any)._chainCatch = this._catchCallback;\n (firstJob as any)._chainFinally = this._finallyCallback;\n\n // Apply delay to first job only\n if (this._delay) {\n firstJob.delay = this._delay;\n }\n\n return this.manager.dispatch(firstJob);\n }\n}\n"],"mappings":"AA0BA,IAAa,EAAb,KAA0B,CAQZ,QACA,KARZ,YACA,OACA,OACA,eACA,iBAEA,YACE,EACA,EACA,CAFU,KAAA,QAAA,EACA,KAAA,KAAA,EAMZ,aAAa,EAA0B,CAErC,MADA,MAAK,YAAc,EACZ,KAMT,QAAQ,EAAqB,CAE3B,MADA,MAAK,OAAS,EACP,KAMT,MAAM,EAA4B,CAEhC,MADA,MAAK,OAAS,EACP,KAMT,MAAM,EAAwD,CAE5D,MADA,MAAK,eAAiB,EACf,KAMT,QAAQ,EAA4C,CAElD,MADA,MAAK,iBAAmB,EACjB,KAUT,MAAM,UAA4B,CAChC,GAAI,KAAK,KAAK,SAAW,EACvB,MAAU,MAAM,kCAAkC,CAIpD,IAAK,IAAM,KAAO,KAAK,KACjB,KAAK,cACP,EAAI,WAAa,KAAK,aAEpB,KAAK,SACP,EAAI,MAAQ,KAAK,QAKrB,IAAM,EAAW,KAAK,KAAK,GAgB3B,MAZA,GAAkB,WAHI,KAAK,KAAK,MAAM,EAGM,CAAC,IAAK,IAAO,CACvD,MAAO,EAAE,YAAY,KACrB,KAAM,EAAE,QAAQ,CACjB,EAAE,CACH,EAAkB,YAAc,KAAK,eACrC,EAAkB,cAAgB,KAAK,iBAGnC,KAAK,SACP,EAAS,MAAQ,KAAK,QAGjB,KAAK,QAAQ,SAAS,EAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);var e=class{_afterCommit=!1;constructor(e,t){this.manager=e,this.job=t}onConnection(e){return this.job.connection=e,this}onQueue(e){return this.job.queue=e,this}delay(e){return this.job.delay=e,this}tries(e){return this.job.tries=e,this}timeout(e){return this.job.timeout=e,this}backoff(e){return this.job.backoff=e,this}afterCommit(){return this._afterCommit=!0,this.job.afterCommit=!0,this}beforeCommit(){return this._afterCommit=!1,this.job.afterCommit=!1,this}async dispatch(){return this.manager.dispatch(this.job)}then(e,t){return this.dispatch().then(e,t)}};exports.PendingDispatch=e;
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);var e=class{manager;job;_afterCommit=!1;constructor(e,t){this.manager=e,this.job=t}onConnection(e){return this.job.connection=e,this}onQueue(e){return this.job.queue=e,this}delay(e){return this.job.delay=e,this}tries(e){return this.job.tries=e,this}timeout(e){return this.job.timeout=e,this}backoff(e){return this.job.backoff=e,this}afterCommit(){return this._afterCommit=!0,this.job.afterCommit=!0,this}beforeCommit(){return this._afterCommit=!1,this.job.afterCommit=!1,this}async dispatch(){return this.manager.dispatch(this.job)}then(e,t){return this.dispatch().then(e,t)}};exports.PendingDispatch=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{_afterCommit=!1;constructor(e,t){this.manager=e,this.job=t}onConnection(e){return this.job.connection=e,this}onQueue(e){return this.job.queue=e,this}delay(e){return this.job.delay=e,this}tries(e){return this.job.tries=e,this}timeout(e){return this.job.timeout=e,this}backoff(e){return this.job.backoff=e,this}afterCommit(){return this._afterCommit=!0,this.job.afterCommit=!0,this}beforeCommit(){return this._afterCommit=!1,this.job.afterCommit=!1,this}async dispatch(){return this.manager.dispatch(this.job)}then(e,t){return this.dispatch().then(e,t)}};export{e as PendingDispatch};
|
|
1
|
+
var e=class{manager;job;_afterCommit=!1;constructor(e,t){this.manager=e,this.job=t}onConnection(e){return this.job.connection=e,this}onQueue(e){return this.job.queue=e,this}delay(e){return this.job.delay=e,this}tries(e){return this.job.tries=e,this}timeout(e){return this.job.timeout=e,this}backoff(e){return this.job.backoff=e,this}afterCommit(){return this._afterCommit=!0,this.job.afterCommit=!0,this}beforeCommit(){return this._afterCommit=!1,this.job.afterCommit=!1,this}async dispatch(){return this.manager.dispatch(this.job)}then(e,t){return this.dispatch().then(e,t)}};export{e as PendingDispatch};
|
|
2
2
|
//# sourceMappingURL=PendingDispatch.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PendingDispatch.mjs","names":[],"sources":["../../src/Queue/PendingDispatch.ts"],"sourcesContent":["/**\n * PendingDispatch\n *\n * Provides a fluent interface for configuring job dispatch.\n * Mirrors Laravel's Illuminate\\Foundation\\Bus\\PendingDispatch.\n *\n * @example\n * ```typescript\n * await ProcessPodcast.dispatch(podcastId)\n * .onConnection('redis')\n * .onQueue('processing')\n * .delay(60);\n *\n * // The dispatch happens when the PendingDispatch is awaited\n * // or when .dispatch() is explicitly called\n * ```\n */\n\nimport type { Job } from './Job';\nimport type { QueueManager } from './QueueManager';\n\nexport class PendingDispatch implements PromiseLike<string> {\n protected _afterCommit: boolean = false;\n\n constructor(\n protected manager: QueueManager,\n protected job: Job\n ) {}\n\n /**\n * Set the desired connection for the job\n */\n onConnection(connection: string): this {\n this.job.connection = connection;\n return this;\n }\n\n /**\n * Set the desired queue for the job\n */\n onQueue(queue: string): this {\n this.job.queue = queue;\n return this;\n }\n\n /**\n * Set the delay for the job\n */\n delay(delay: number | Date): this {\n this.job.delay = delay;\n return this;\n }\n\n /**\n * Set the number of times the job may be attempted\n */\n tries(tries: number): this {\n this.job.tries = tries;\n return this;\n }\n\n /**\n * Set the timeout for the job\n */\n timeout(timeout: number): this {\n this.job.timeout = timeout;\n return this;\n }\n\n /**\n * Set the backoff strategy for the job\n */\n backoff(backoff: number | number[]): this {\n this.job.backoff = backoff;\n return this;\n }\n\n /**\n * Indicate that the job should be dispatched after all DB transactions commit\n */\n afterCommit(): this {\n this._afterCommit = true;\n this.job.afterCommit = true;\n return this;\n }\n\n /**\n * Indicate that the job should not wait for DB transactions\n */\n beforeCommit(): this {\n this._afterCommit = false;\n this.job.afterCommit = false;\n return this;\n }\n\n /**\n * Dispatch the job to the queue\n */\n async dispatch(): Promise<string> {\n return this.manager.dispatch(this.job);\n }\n\n /**\n * PromiseLike implementation - allows `await ProcessPodcast.dispatch(id)`\n */\n then<TResult1 = string, TResult2 = never>(\n onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null\n ): PromiseLike<TResult1 | TResult2> {\n return this.dispatch().then(onfulfilled, onrejected);\n }\n}\n"],"mappings":"AAqBA,IAAa,EAAb,KAA4D,
|
|
1
|
+
{"version":3,"file":"PendingDispatch.mjs","names":[],"sources":["../../src/Queue/PendingDispatch.ts"],"sourcesContent":["/**\n * PendingDispatch\n *\n * Provides a fluent interface for configuring job dispatch.\n * Mirrors Laravel's Illuminate\\Foundation\\Bus\\PendingDispatch.\n *\n * @example\n * ```typescript\n * await ProcessPodcast.dispatch(podcastId)\n * .onConnection('redis')\n * .onQueue('processing')\n * .delay(60);\n *\n * // The dispatch happens when the PendingDispatch is awaited\n * // or when .dispatch() is explicitly called\n * ```\n */\n\nimport type { Job } from './Job';\nimport type { QueueManager } from './QueueManager';\n\nexport class PendingDispatch implements PromiseLike<string> {\n protected _afterCommit: boolean = false;\n\n constructor(\n protected manager: QueueManager,\n protected job: Job\n ) {}\n\n /**\n * Set the desired connection for the job\n */\n onConnection(connection: string): this {\n this.job.connection = connection;\n return this;\n }\n\n /**\n * Set the desired queue for the job\n */\n onQueue(queue: string): this {\n this.job.queue = queue;\n return this;\n }\n\n /**\n * Set the delay for the job\n */\n delay(delay: number | Date): this {\n this.job.delay = delay;\n return this;\n }\n\n /**\n * Set the number of times the job may be attempted\n */\n tries(tries: number): this {\n this.job.tries = tries;\n return this;\n }\n\n /**\n * Set the timeout for the job\n */\n timeout(timeout: number): this {\n this.job.timeout = timeout;\n return this;\n }\n\n /**\n * Set the backoff strategy for the job\n */\n backoff(backoff: number | number[]): this {\n this.job.backoff = backoff;\n return this;\n }\n\n /**\n * Indicate that the job should be dispatched after all DB transactions commit\n */\n afterCommit(): this {\n this._afterCommit = true;\n this.job.afterCommit = true;\n return this;\n }\n\n /**\n * Indicate that the job should not wait for DB transactions\n */\n beforeCommit(): this {\n this._afterCommit = false;\n this.job.afterCommit = false;\n return this;\n }\n\n /**\n * Dispatch the job to the queue\n */\n async dispatch(): Promise<string> {\n return this.manager.dispatch(this.job);\n }\n\n /**\n * PromiseLike implementation - allows `await ProcessPodcast.dispatch(id)`\n */\n then<TResult1 = string, TResult2 = never>(\n onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null\n ): PromiseLike<TResult1 | TResult2> {\n return this.dispatch().then(onfulfilled, onrejected);\n }\n}\n"],"mappings":"AAqBA,IAAa,EAAb,KAA4D,CAI9C,QACA,IAJZ,aAAkC,GAElC,YACE,EACA,EACA,CAFU,KAAA,QAAA,EACA,KAAA,IAAA,EAMZ,aAAa,EAA0B,CAErC,MADA,MAAK,IAAI,WAAa,EACf,KAMT,QAAQ,EAAqB,CAE3B,MADA,MAAK,IAAI,MAAQ,EACV,KAMT,MAAM,EAA4B,CAEhC,MADA,MAAK,IAAI,MAAQ,EACV,KAMT,MAAM,EAAqB,CAEzB,MADA,MAAK,IAAI,MAAQ,EACV,KAMT,QAAQ,EAAuB,CAE7B,MADA,MAAK,IAAI,QAAU,EACZ,KAMT,QAAQ,EAAkC,CAExC,MADA,MAAK,IAAI,QAAU,EACZ,KAMT,aAAoB,CAGlB,MAFA,MAAK,aAAe,GACpB,KAAK,IAAI,YAAc,GAChB,KAMT,cAAqB,CAGnB,MAFA,MAAK,aAAe,GACpB,KAAK,IAAI,YAAc,GAChB,KAMT,MAAM,UAA4B,CAChC,OAAO,KAAK,QAAQ,SAAS,KAAK,IAAI,CAMxC,KACE,EACA,EACkC,CAClC,OAAO,KAAK,UAAU,CAAC,KAAK,EAAa,EAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);var e=class{connections=new Map;driverFactories=new Map;jobRegistry=new Map;beforeCallbacks=[];afterCallbacks=[];failingCallbacks=[];loopingCallbacks=[];constructor(e){this.config=e}registerDriver(e,t){this.driverFactories.set(e,t)}registerJob(e,t){this.jobRegistry.set(e,t)}getJobClass(e){return this.jobRegistry.get(e)}connection(e){let t=e||this.config.default;if(this.connections.has(t))return this.connections.get(t);let n=this.createConnection(t);return this.connections.set(t,n),n}createConnection(e){let t=this.config.connections[e];if(!t)throw Error(`Queue connection [${e}] not configured.`);let n=this.driverFactories.get(t.driver);if(!n)throw Error(`Queue driver [${t.driver}] not registered. Available drivers: ${Array.from(this.driverFactories.keys()).join(`, `)}`);let r=n(t);return r.setConnectionName(e),r}async dispatch(e){let t=e.connection||this.config.default,n=this.connection(t),r=e.queue;return e.delay?n.later(e.delay,e,r):n.push(e,r)}async dispatchSync(e){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}}async push(e,t){let n=e.connection||this.config.default;return this.connection(n).push(e,t)}async pushOn(e,t){return t.queue=e,this.push(t)}async later(e,t,n){let r=t.connection||this.config.default;return this.connection(r).later(e,t,n)}async bulk(e,t){let n=this.config.default;return this.connection(n).bulk(e,t)}before(e){this.beforeCallbacks.push(e)}after(e){this.afterCallbacks.push(e)}failing(e){this.failingCallbacks.push(e)}looping(e){this.loopingCallbacks.push(e)}fireBeforeCallbacks(e,t){for(let n of this.beforeCallbacks)n(e,t)}fireAfterCallbacks(e,t){for(let n of this.afterCallbacks)n(e,t)}fireFailingCallbacks(e,t,n){for(let r of this.failingCallbacks)r(e,t,n)}fireLoopingCallbacks(){for(let e of this.loopingCallbacks)e()}disconnect(e){let t=e||this.config.default;this.connections.delete(t)}getDefaultConnection(){return this.config.default}setDefaultConnection(e){this.config.default=e}getConnections(){return Object.keys(this.config.connections)}getConfig(){return this.config}getConnectionConfig(e){let t=e||this.config.default,n=this.config.connections[t];if(!n)throw Error(`Queue connection [${t}] not configured.`);return n}};exports.QueueManager=e;
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);var e=class{config;connections=new Map;driverFactories=new Map;jobRegistry=new Map;beforeCallbacks=[];afterCallbacks=[];failingCallbacks=[];loopingCallbacks=[];constructor(e){this.config=e}registerDriver(e,t){this.driverFactories.set(e,t)}registerJob(e,t){this.jobRegistry.set(e,t)}getJobClass(e){return this.jobRegistry.get(e)}connection(e){let t=e||this.config.default;if(this.connections.has(t))return this.connections.get(t);let n=this.createConnection(t);return this.connections.set(t,n),n}createConnection(e){let t=this.config.connections[e];if(!t)throw Error(`Queue connection [${e}] not configured.`);let n=this.driverFactories.get(t.driver);if(!n)throw Error(`Queue driver [${t.driver}] not registered. Available drivers: ${Array.from(this.driverFactories.keys()).join(`, `)}`);let r=n(t);return r.setConnectionName(e),r}async dispatch(e){let t=e.connection||this.config.default,n=this.connection(t),r=e.queue;return e.delay?n.later(e.delay,e,r):n.push(e,r)}async dispatchSync(e){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}}async push(e,t){let n=e.connection||this.config.default;return this.connection(n).push(e,t)}async pushOn(e,t){return t.queue=e,this.push(t)}async later(e,t,n){let r=t.connection||this.config.default;return this.connection(r).later(e,t,n)}async bulk(e,t){let n=this.config.default;return this.connection(n).bulk(e,t)}before(e){this.beforeCallbacks.push(e)}after(e){this.afterCallbacks.push(e)}failing(e){this.failingCallbacks.push(e)}looping(e){this.loopingCallbacks.push(e)}fireBeforeCallbacks(e,t){for(let n of this.beforeCallbacks)n(e,t)}fireAfterCallbacks(e,t){for(let n of this.afterCallbacks)n(e,t)}fireFailingCallbacks(e,t,n){for(let r of this.failingCallbacks)r(e,t,n)}fireLoopingCallbacks(){for(let e of this.loopingCallbacks)e()}disconnect(e){let t=e||this.config.default;this.connections.delete(t)}getDefaultConnection(){return this.config.default}setDefaultConnection(e){this.config.default=e}getConnections(){return Object.keys(this.config.connections)}getConfig(){return this.config}getConnectionConfig(e){let t=e||this.config.default,n=this.config.connections[t];if(!n)throw Error(`Queue connection [${t}] not configured.`);return n}};exports.QueueManager=e;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{connections=new Map;driverFactories=new Map;jobRegistry=new Map;beforeCallbacks=[];afterCallbacks=[];failingCallbacks=[];loopingCallbacks=[];constructor(e){this.config=e}registerDriver(e,t){this.driverFactories.set(e,t)}registerJob(e,t){this.jobRegistry.set(e,t)}getJobClass(e){return this.jobRegistry.get(e)}connection(e){let t=e||this.config.default;if(this.connections.has(t))return this.connections.get(t);let n=this.createConnection(t);return this.connections.set(t,n),n}createConnection(e){let t=this.config.connections[e];if(!t)throw Error(`Queue connection [${e}] not configured.`);let n=this.driverFactories.get(t.driver);if(!n)throw Error(`Queue driver [${t.driver}] not registered. Available drivers: ${Array.from(this.driverFactories.keys()).join(`, `)}`);let r=n(t);return r.setConnectionName(e),r}async dispatch(e){let t=e.connection||this.config.default,n=this.connection(t),r=e.queue;return e.delay?n.later(e.delay,e,r):n.push(e,r)}async dispatchSync(e){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}}async push(e,t){let n=e.connection||this.config.default;return this.connection(n).push(e,t)}async pushOn(e,t){return t.queue=e,this.push(t)}async later(e,t,n){let r=t.connection||this.config.default;return this.connection(r).later(e,t,n)}async bulk(e,t){let n=this.config.default;return this.connection(n).bulk(e,t)}before(e){this.beforeCallbacks.push(e)}after(e){this.afterCallbacks.push(e)}failing(e){this.failingCallbacks.push(e)}looping(e){this.loopingCallbacks.push(e)}fireBeforeCallbacks(e,t){for(let n of this.beforeCallbacks)n(e,t)}fireAfterCallbacks(e,t){for(let n of this.afterCallbacks)n(e,t)}fireFailingCallbacks(e,t,n){for(let r of this.failingCallbacks)r(e,t,n)}fireLoopingCallbacks(){for(let e of this.loopingCallbacks)e()}disconnect(e){let t=e||this.config.default;this.connections.delete(t)}getDefaultConnection(){return this.config.default}setDefaultConnection(e){this.config.default=e}getConnections(){return Object.keys(this.config.connections)}getConfig(){return this.config}getConnectionConfig(e){let t=e||this.config.default,n=this.config.connections[t];if(!n)throw Error(`Queue connection [${t}] not configured.`);return n}};export{e as QueueManager};
|
|
1
|
+
var e=class{config;connections=new Map;driverFactories=new Map;jobRegistry=new Map;beforeCallbacks=[];afterCallbacks=[];failingCallbacks=[];loopingCallbacks=[];constructor(e){this.config=e}registerDriver(e,t){this.driverFactories.set(e,t)}registerJob(e,t){this.jobRegistry.set(e,t)}getJobClass(e){return this.jobRegistry.get(e)}connection(e){let t=e||this.config.default;if(this.connections.has(t))return this.connections.get(t);let n=this.createConnection(t);return this.connections.set(t,n),n}createConnection(e){let t=this.config.connections[e];if(!t)throw Error(`Queue connection [${e}] not configured.`);let n=this.driverFactories.get(t.driver);if(!n)throw Error(`Queue driver [${t.driver}] not registered. Available drivers: ${Array.from(this.driverFactories.keys()).join(`, `)}`);let r=n(t);return r.setConnectionName(e),r}async dispatch(e){let t=e.connection||this.config.default,n=this.connection(t),r=e.queue;return e.delay?n.later(e.delay,e,r):n.push(e,r)}async dispatchSync(e){try{await e.handle()}catch(t){throw e.failed&&await e.failed(t),t}}async push(e,t){let n=e.connection||this.config.default;return this.connection(n).push(e,t)}async pushOn(e,t){return t.queue=e,this.push(t)}async later(e,t,n){let r=t.connection||this.config.default;return this.connection(r).later(e,t,n)}async bulk(e,t){let n=this.config.default;return this.connection(n).bulk(e,t)}before(e){this.beforeCallbacks.push(e)}after(e){this.afterCallbacks.push(e)}failing(e){this.failingCallbacks.push(e)}looping(e){this.loopingCallbacks.push(e)}fireBeforeCallbacks(e,t){for(let n of this.beforeCallbacks)n(e,t)}fireAfterCallbacks(e,t){for(let n of this.afterCallbacks)n(e,t)}fireFailingCallbacks(e,t,n){for(let r of this.failingCallbacks)r(e,t,n)}fireLoopingCallbacks(){for(let e of this.loopingCallbacks)e()}disconnect(e){let t=e||this.config.default;this.connections.delete(t)}getDefaultConnection(){return this.config.default}setDefaultConnection(e){this.config.default=e}getConnections(){return Object.keys(this.config.connections)}getConfig(){return this.config}getConnectionConfig(e){let t=e||this.config.default,n=this.config.connections[t];if(!n)throw Error(`Queue connection [${t}] not configured.`);return n}};export{e as QueueManager};
|
|
2
2
|
//# sourceMappingURL=QueueManager.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueueManager.mjs","names":[],"sources":["../../src/Queue/QueueManager.ts"],"sourcesContent":["/**\n * QueueManager\n *\n * Manages multiple queue connections and drivers.\n * Follows the same Manager pattern as DatabaseManager.\n *\n * Mirrors Laravel's Illuminate\\Queue\\QueueManager.\n */\n\nimport type { QueueDriver } from './Contracts/QueueDriver';\nimport type { Job } from './Job';\nimport type { Worker } from './Workers/Worker';\nimport type { WorkerOptions } from './Workers/WorkerOptions';\nimport { JobPayload } from './JobPayload';\n\nexport interface QueueConnectionConfig {\n driver: string;\n connection?: string;\n table?: string;\n queue?: string;\n retry_after?: number;\n block_for?: number | null;\n after_commit?: boolean;\n [key: string]: any;\n}\n\nexport interface QueueFailedConfig {\n driver: string;\n database?: string;\n table?: string;\n}\n\nexport interface QueueBatchingConfig {\n database: string;\n table: string;\n}\n\nexport interface QueueConfig {\n default: string;\n connections: Record<string, QueueConnectionConfig>;\n batching?: QueueBatchingConfig;\n failed?: QueueFailedConfig;\n}\n\nexport type DriverFactory = (config: QueueConnectionConfig) => QueueDriver;\n\nexport class QueueManager {\n protected connections: Map<string, QueueDriver> = new Map();\n protected driverFactories: Map<string, DriverFactory> = new Map();\n protected jobRegistry: Map<string, new (...args: any[]) => Job> = new Map();\n\n /**\n * Event callbacks\n */\n protected beforeCallbacks: Array<(connectionName: string, job: Job) => void> = [];\n protected afterCallbacks: Array<(connectionName: string, job: Job) => void> = [];\n protected failingCallbacks: Array<(connectionName: string, job: Job, error: Error) => void> = [];\n protected loopingCallbacks: Array<() => void> = [];\n\n constructor(protected config: QueueConfig) {}\n\n /**\n * Register a queue driver factory\n */\n registerDriver(name: string, factory: DriverFactory): void {\n this.driverFactories.set(name, factory);\n }\n\n /**\n * Register a job class for deserialization\n */\n registerJob(name: string, jobClass: new (...args: any[]) => Job): void {\n this.jobRegistry.set(name, jobClass);\n }\n\n /**\n * Get a job class from the registry\n */\n getJobClass(name: string): (new (...args: any[]) => Job) | undefined {\n return this.jobRegistry.get(name);\n }\n\n /**\n * Get a queue connection instance\n */\n connection(name?: string): QueueDriver {\n const connectionName = name || this.config.default;\n\n if (this.connections.has(connectionName)) {\n return this.connections.get(connectionName)!;\n }\n\n const driver = this.createConnection(connectionName);\n this.connections.set(connectionName, driver);\n\n return driver;\n }\n\n /**\n * Create a new queue connection\n */\n protected createConnection(name: string): QueueDriver {\n const config = this.config.connections[name];\n\n if (!config) {\n throw new Error(`Queue connection [${name}] not configured.`);\n }\n\n const factory = this.driverFactories.get(config.driver);\n\n if (!factory) {\n throw new Error(\n `Queue driver [${config.driver}] not registered. Available drivers: ${Array.from(this.driverFactories.keys()).join(', ')}`\n );\n }\n\n const driver = factory(config);\n driver.setConnectionName(name);\n\n return driver;\n }\n\n /**\n * Dispatch a job to its configured connection and queue\n */\n async dispatch(job: Job): Promise<string> {\n const connectionName = job.connection || this.config.default;\n const driver = this.connection(connectionName);\n const queue = job.queue;\n\n if (job.delay) {\n return driver.later(job.delay, job, queue);\n }\n\n return driver.push(job, queue);\n }\n\n /**\n * Dispatch a job synchronously (bypass queue, execute immediately)\n */\n async dispatchSync(job: Job): Promise<void> {\n try {\n await job.handle();\n } catch (error) {\n if (job.failed) {\n await job.failed(error as Error);\n }\n throw error;\n }\n }\n\n /**\n * Push a job onto a specific queue\n */\n async push(job: Job, queue?: string): Promise<string> {\n const connectionName = job.connection || this.config.default;\n return this.connection(connectionName).push(job, queue);\n }\n\n /**\n * Push a job onto a specific named queue\n */\n async pushOn(queue: string, job: Job): Promise<string> {\n job.queue = queue;\n return this.push(job);\n }\n\n /**\n * Push a job after a delay\n */\n async later(delay: number | Date, job: Job, queue?: string): Promise<string> {\n const connectionName = job.connection || this.config.default;\n return this.connection(connectionName).later(delay, job, queue);\n }\n\n /**\n * Push multiple jobs onto the queue\n */\n async bulk(jobs: Job[], queue?: string): Promise<void> {\n const connectionName = this.config.default;\n return this.connection(connectionName).bulk(jobs, queue);\n }\n\n /**\n * Register a callback to be called before a job is processed\n */\n before(callback: (connectionName: string, job: Job) => void): void {\n this.beforeCallbacks.push(callback);\n }\n\n /**\n * Register a callback to be called after a job is processed\n */\n after(callback: (connectionName: string, job: Job) => void): void {\n this.afterCallbacks.push(callback);\n }\n\n /**\n * Register a callback to be called when a job fails\n */\n failing(callback: (connectionName: string, job: Job, error: Error) => void): void {\n this.failingCallbacks.push(callback);\n }\n\n /**\n * Register a callback to be called on each worker loop iteration\n */\n looping(callback: () => void): void {\n this.loopingCallbacks.push(callback);\n }\n\n /**\n * Fire the before job callbacks\n */\n fireBeforeCallbacks(connectionName: string, job: Job): void {\n for (const callback of this.beforeCallbacks) {\n callback(connectionName, job);\n }\n }\n\n /**\n * Fire the after job callbacks\n */\n fireAfterCallbacks(connectionName: string, job: Job): void {\n for (const callback of this.afterCallbacks) {\n callback(connectionName, job);\n }\n }\n\n /**\n * Fire the failing job callbacks\n */\n fireFailingCallbacks(connectionName: string, job: Job, error: Error): void {\n for (const callback of this.failingCallbacks) {\n callback(connectionName, job, error);\n }\n }\n\n /**\n * Fire the looping callbacks\n */\n fireLoopingCallbacks(): void {\n for (const callback of this.loopingCallbacks) {\n callback();\n }\n }\n\n /**\n * Disconnect from a queue connection\n */\n disconnect(name?: string): void {\n const connectionName = name || this.config.default;\n this.connections.delete(connectionName);\n }\n\n /**\n * Get the default connection name\n */\n getDefaultConnection(): string {\n return this.config.default;\n }\n\n /**\n * Set the default connection name\n */\n setDefaultConnection(name: string): void {\n this.config.default = name;\n }\n\n /**\n * Get all connection names\n */\n getConnections(): string[] {\n return Object.keys(this.config.connections);\n }\n\n /**\n * Get the queue configuration\n */\n getConfig(): QueueConfig {\n return this.config;\n }\n\n /**\n * Get the connection configuration\n */\n getConnectionConfig(name?: string): QueueConnectionConfig {\n const connectionName = name || this.config.default;\n const config = this.config.connections[connectionName];\n\n if (!config) {\n throw new Error(`Queue connection [${connectionName}] not configured.`);\n }\n\n return config;\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"QueueManager.mjs","names":[],"sources":["../../src/Queue/QueueManager.ts"],"sourcesContent":["/**\n * QueueManager\n *\n * Manages multiple queue connections and drivers.\n * Follows the same Manager pattern as DatabaseManager.\n *\n * Mirrors Laravel's Illuminate\\Queue\\QueueManager.\n */\n\nimport type { QueueDriver } from './Contracts/QueueDriver';\nimport type { Job } from './Job';\nimport type { Worker } from './Workers/Worker';\nimport type { WorkerOptions } from './Workers/WorkerOptions';\nimport { JobPayload } from './JobPayload';\n\nexport interface QueueConnectionConfig {\n driver: string;\n connection?: string;\n table?: string;\n queue?: string;\n retry_after?: number;\n block_for?: number | null;\n after_commit?: boolean;\n [key: string]: any;\n}\n\nexport interface QueueFailedConfig {\n driver: string;\n database?: string;\n table?: string;\n}\n\nexport interface QueueBatchingConfig {\n database: string;\n table: string;\n}\n\nexport interface QueueConfig {\n default: string;\n connections: Record<string, QueueConnectionConfig>;\n batching?: QueueBatchingConfig;\n failed?: QueueFailedConfig;\n}\n\nexport type DriverFactory = (config: QueueConnectionConfig) => QueueDriver;\n\nexport class QueueManager {\n protected connections: Map<string, QueueDriver> = new Map();\n protected driverFactories: Map<string, DriverFactory> = new Map();\n protected jobRegistry: Map<string, new (...args: any[]) => Job> = new Map();\n\n /**\n * Event callbacks\n */\n protected beforeCallbacks: Array<(connectionName: string, job: Job) => void> = [];\n protected afterCallbacks: Array<(connectionName: string, job: Job) => void> = [];\n protected failingCallbacks: Array<(connectionName: string, job: Job, error: Error) => void> = [];\n protected loopingCallbacks: Array<() => void> = [];\n\n constructor(protected config: QueueConfig) {}\n\n /**\n * Register a queue driver factory\n */\n registerDriver(name: string, factory: DriverFactory): void {\n this.driverFactories.set(name, factory);\n }\n\n /**\n * Register a job class for deserialization\n */\n registerJob(name: string, jobClass: new (...args: any[]) => Job): void {\n this.jobRegistry.set(name, jobClass);\n }\n\n /**\n * Get a job class from the registry\n */\n getJobClass(name: string): (new (...args: any[]) => Job) | undefined {\n return this.jobRegistry.get(name);\n }\n\n /**\n * Get a queue connection instance\n */\n connection(name?: string): QueueDriver {\n const connectionName = name || this.config.default;\n\n if (this.connections.has(connectionName)) {\n return this.connections.get(connectionName)!;\n }\n\n const driver = this.createConnection(connectionName);\n this.connections.set(connectionName, driver);\n\n return driver;\n }\n\n /**\n * Create a new queue connection\n */\n protected createConnection(name: string): QueueDriver {\n const config = this.config.connections[name];\n\n if (!config) {\n throw new Error(`Queue connection [${name}] not configured.`);\n }\n\n const factory = this.driverFactories.get(config.driver);\n\n if (!factory) {\n throw new Error(\n `Queue driver [${config.driver}] not registered. Available drivers: ${Array.from(this.driverFactories.keys()).join(', ')}`\n );\n }\n\n const driver = factory(config);\n driver.setConnectionName(name);\n\n return driver;\n }\n\n /**\n * Dispatch a job to its configured connection and queue\n */\n async dispatch(job: Job): Promise<string> {\n const connectionName = job.connection || this.config.default;\n const driver = this.connection(connectionName);\n const queue = job.queue;\n\n if (job.delay) {\n return driver.later(job.delay, job, queue);\n }\n\n return driver.push(job, queue);\n }\n\n /**\n * Dispatch a job synchronously (bypass queue, execute immediately)\n */\n async dispatchSync(job: Job): Promise<void> {\n try {\n await job.handle();\n } catch (error) {\n if (job.failed) {\n await job.failed(error as Error);\n }\n throw error;\n }\n }\n\n /**\n * Push a job onto a specific queue\n */\n async push(job: Job, queue?: string): Promise<string> {\n const connectionName = job.connection || this.config.default;\n return this.connection(connectionName).push(job, queue);\n }\n\n /**\n * Push a job onto a specific named queue\n */\n async pushOn(queue: string, job: Job): Promise<string> {\n job.queue = queue;\n return this.push(job);\n }\n\n /**\n * Push a job after a delay\n */\n async later(delay: number | Date, job: Job, queue?: string): Promise<string> {\n const connectionName = job.connection || this.config.default;\n return this.connection(connectionName).later(delay, job, queue);\n }\n\n /**\n * Push multiple jobs onto the queue\n */\n async bulk(jobs: Job[], queue?: string): Promise<void> {\n const connectionName = this.config.default;\n return this.connection(connectionName).bulk(jobs, queue);\n }\n\n /**\n * Register a callback to be called before a job is processed\n */\n before(callback: (connectionName: string, job: Job) => void): void {\n this.beforeCallbacks.push(callback);\n }\n\n /**\n * Register a callback to be called after a job is processed\n */\n after(callback: (connectionName: string, job: Job) => void): void {\n this.afterCallbacks.push(callback);\n }\n\n /**\n * Register a callback to be called when a job fails\n */\n failing(callback: (connectionName: string, job: Job, error: Error) => void): void {\n this.failingCallbacks.push(callback);\n }\n\n /**\n * Register a callback to be called on each worker loop iteration\n */\n looping(callback: () => void): void {\n this.loopingCallbacks.push(callback);\n }\n\n /**\n * Fire the before job callbacks\n */\n fireBeforeCallbacks(connectionName: string, job: Job): void {\n for (const callback of this.beforeCallbacks) {\n callback(connectionName, job);\n }\n }\n\n /**\n * Fire the after job callbacks\n */\n fireAfterCallbacks(connectionName: string, job: Job): void {\n for (const callback of this.afterCallbacks) {\n callback(connectionName, job);\n }\n }\n\n /**\n * Fire the failing job callbacks\n */\n fireFailingCallbacks(connectionName: string, job: Job, error: Error): void {\n for (const callback of this.failingCallbacks) {\n callback(connectionName, job, error);\n }\n }\n\n /**\n * Fire the looping callbacks\n */\n fireLoopingCallbacks(): void {\n for (const callback of this.loopingCallbacks) {\n callback();\n }\n }\n\n /**\n * Disconnect from a queue connection\n */\n disconnect(name?: string): void {\n const connectionName = name || this.config.default;\n this.connections.delete(connectionName);\n }\n\n /**\n * Get the default connection name\n */\n getDefaultConnection(): string {\n return this.config.default;\n }\n\n /**\n * Set the default connection name\n */\n setDefaultConnection(name: string): void {\n this.config.default = name;\n }\n\n /**\n * Get all connection names\n */\n getConnections(): string[] {\n return Object.keys(this.config.connections);\n }\n\n /**\n * Get the queue configuration\n */\n getConfig(): QueueConfig {\n return this.config;\n }\n\n /**\n * Get the connection configuration\n */\n getConnectionConfig(name?: string): QueueConnectionConfig {\n const connectionName = name || this.config.default;\n const config = this.config.connections[connectionName];\n\n if (!config) {\n throw new Error(`Queue connection [${connectionName}] not configured.`);\n }\n\n return config;\n }\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueueServiceProvider.mjs","names":[],"sources":["../../src/Queue/QueueServiceProvider.ts"],"sourcesContent":["/**\n * QueueServiceProvider\n *\n * Registers queue services into the container.\n * Mirrors Laravel's Illuminate\\Queue\\QueueServiceProvider.\n */\n\nimport { ServiceProvider } from '@/Foundation/ServiceProvider';\nimport type { QueueConfig } from './QueueManager';\nimport { DatabaseDriver } from './Drivers/DatabaseDriver';\nimport { NullDriver } from './Drivers/NullDriver';\nimport { SyncDriver } from './Drivers/SyncDriver';\nimport { DatabaseFailedJobProvider } from './Failed/DatabaseFailedJobProvider';\nimport { QueueManager } from './QueueManager';\nimport { Worker } from './Workers/Worker';\n\nexport class QueueServiceProvider extends ServiceProvider {\n /**\n * Register queue services\n */\n register(): void {\n this.app.singleton('queue', () => {\n const config = this.getConfig();\n const manager = new QueueManager(config);\n\n // Register built-in drivers\n manager.registerDriver('sync', (driverConfig) => new SyncDriver(driverConfig));\n manager.registerDriver('database', (driverConfig) => new DatabaseDriver(driverConfig, this.app));\n manager.registerDriver('null', (driverConfig) => new NullDriver(driverConfig));\n\n return manager;\n });\n\n this.app.singleton('queue.worker', () => {\n const manager = this.app.make<QueueManager>('queue');\n return new Worker(manager, this.app);\n });\n\n this.app.singleton('queue.failer', () => {\n const config = this.getConfig();\n const failedConfig = config.failed || { driver: 'database', table: 'failed_jobs' };\n\n return new DatabaseFailedJobProvider(this.app, {\n table: failedConfig.table || 'failed_jobs',\n database: failedConfig.database,\n });\n });\n }\n\n /**\n * Get the queue configuration\n */\n protected getConfig(): QueueConfig {\n try {\n const configService = this.app.make('config') as any;\n const queueConfig = configService?.items?.queue || configService?.get?.('queue');\n if (queueConfig) {\n return queueConfig;\n }\n } catch {\n // Config service not available\n }\n\n // Default configuration\n return {\n default: 'sync',\n connections: {\n sync: {\n driver: 'sync',\n },\n },\n failed: {\n driver: 'database',\n database: 'sqlite',\n table: 'failed_jobs',\n },\n };\n }\n}\n"],"mappings":"iaAgBA,IAAa,EAAb,cAA0C,CAAgB,CAIxD,UAAiB,CACf,KAAK,IAAI,UAAU,YAAe,CAEhC,IAAM,EAAU,IAAI,EADL,KAAK,
|
|
1
|
+
{"version":3,"file":"QueueServiceProvider.mjs","names":[],"sources":["../../src/Queue/QueueServiceProvider.ts"],"sourcesContent":["/**\n * QueueServiceProvider\n *\n * Registers queue services into the container.\n * Mirrors Laravel's Illuminate\\Queue\\QueueServiceProvider.\n */\n\nimport { ServiceProvider } from '@/Foundation/ServiceProvider';\nimport type { QueueConfig } from './QueueManager';\nimport { DatabaseDriver } from './Drivers/DatabaseDriver';\nimport { NullDriver } from './Drivers/NullDriver';\nimport { SyncDriver } from './Drivers/SyncDriver';\nimport { DatabaseFailedJobProvider } from './Failed/DatabaseFailedJobProvider';\nimport { QueueManager } from './QueueManager';\nimport { Worker } from './Workers/Worker';\n\nexport class QueueServiceProvider extends ServiceProvider {\n /**\n * Register queue services\n */\n register(): void {\n this.app.singleton('queue', () => {\n const config = this.getConfig();\n const manager = new QueueManager(config);\n\n // Register built-in drivers\n manager.registerDriver('sync', (driverConfig) => new SyncDriver(driverConfig));\n manager.registerDriver('database', (driverConfig) => new DatabaseDriver(driverConfig, this.app));\n manager.registerDriver('null', (driverConfig) => new NullDriver(driverConfig));\n\n return manager;\n });\n\n this.app.singleton('queue.worker', () => {\n const manager = this.app.make<QueueManager>('queue');\n return new Worker(manager, this.app);\n });\n\n this.app.singleton('queue.failer', () => {\n const config = this.getConfig();\n const failedConfig = config.failed || { driver: 'database', table: 'failed_jobs' };\n\n return new DatabaseFailedJobProvider(this.app, {\n table: failedConfig.table || 'failed_jobs',\n database: failedConfig.database,\n });\n });\n }\n\n /**\n * Get the queue configuration\n */\n protected getConfig(): QueueConfig {\n try {\n const configService = this.app.make('config') as any;\n const queueConfig = configService?.items?.queue || configService?.get?.('queue');\n if (queueConfig) {\n return queueConfig;\n }\n } catch {\n // Config service not available\n }\n\n // Default configuration\n return {\n default: 'sync',\n connections: {\n sync: {\n driver: 'sync',\n },\n },\n failed: {\n driver: 'database',\n database: 'sqlite',\n table: 'failed_jobs',\n },\n };\n }\n}\n"],"mappings":"iaAgBA,IAAa,EAAb,cAA0C,CAAgB,CAIxD,UAAiB,CACf,KAAK,IAAI,UAAU,YAAe,CAEhC,IAAM,EAAU,IAAI,EADL,KAAK,WACmB,CAAC,CAOxC,OAJA,EAAQ,eAAe,OAAS,GAAiB,IAAI,EAAW,EAAa,CAAC,CAC9E,EAAQ,eAAe,WAAa,GAAiB,IAAI,EAAe,EAAc,KAAK,IAAI,CAAC,CAChG,EAAQ,eAAe,OAAS,GAAiB,IAAI,EAAW,EAAa,CAAC,CAEvE,GACP,CAEF,KAAK,IAAI,UAAU,mBAEV,IAAI,EADK,KAAK,IAAI,KAAmB,QACnB,CAAE,KAAK,IAAI,CACpC,CAEF,KAAK,IAAI,UAAU,mBAAsB,CAEvC,IAAM,EADS,KAAK,WACO,CAAC,QAAU,CAAE,OAAQ,WAAY,MAAO,cAAe,CAElF,OAAO,IAAI,EAA0B,KAAK,IAAK,CAC7C,MAAO,EAAa,OAAS,cAC7B,SAAU,EAAa,SACxB,CAAC,EACF,CAMJ,WAAmC,CACjC,GAAI,CACF,IAAM,EAAgB,KAAK,IAAI,KAAK,SAAS,CACvC,EAAc,GAAe,OAAO,OAAS,GAAe,MAAM,QAAQ,CAChF,GAAI,EACF,OAAO,OAEH,EAKR,MAAO,CACL,QAAS,OACT,YAAa,CACX,KAAM,CACJ,OAAQ,OACT,CACF,CACD,OAAQ,CACN,OAAQ,WACR,SAAU,SACV,MAAO,cACR,CACF"}
|