@orchestr-sh/orchestr 1.7.3 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Console/Commands/MakeJobCommand.d.ts +20 -0
- package/dist/Console/Commands/MakeJobCommand.d.ts.map +1 -0
- package/dist/Console/Commands/MakeJobCommand.js +165 -0
- package/dist/Console/Commands/MakeJobCommand.js.map +1 -0
- package/dist/Console/Commands/QueueBatchesTableCommand.d.ts +17 -0
- package/dist/Console/Commands/QueueBatchesTableCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueBatchesTableCommand.js +92 -0
- package/dist/Console/Commands/QueueBatchesTableCommand.js.map +1 -0
- package/dist/Console/Commands/QueueClearCommand.d.ts +16 -0
- package/dist/Console/Commands/QueueClearCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueClearCommand.js +29 -0
- package/dist/Console/Commands/QueueClearCommand.js.map +1 -0
- package/dist/Console/Commands/QueueFailedCommand.d.ts +18 -0
- package/dist/Console/Commands/QueueFailedCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueFailedCommand.js +76 -0
- package/dist/Console/Commands/QueueFailedCommand.js.map +1 -0
- package/dist/Console/Commands/QueueFailedTableCommand.d.ts +17 -0
- package/dist/Console/Commands/QueueFailedTableCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueFailedTableCommand.js +89 -0
- package/dist/Console/Commands/QueueFailedTableCommand.js.map +1 -0
- package/dist/Console/Commands/QueueFlushCommand.d.ts +18 -0
- package/dist/Console/Commands/QueueFlushCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueFlushCommand.js +44 -0
- package/dist/Console/Commands/QueueFlushCommand.js.map +1 -0
- package/dist/Console/Commands/QueueForgetCommand.d.ts +18 -0
- package/dist/Console/Commands/QueueForgetCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueForgetCommand.js +48 -0
- package/dist/Console/Commands/QueueForgetCommand.js.map +1 -0
- package/dist/Console/Commands/QueueMonitorCommand.d.ts +16 -0
- package/dist/Console/Commands/QueueMonitorCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueMonitorCommand.js +42 -0
- package/dist/Console/Commands/QueueMonitorCommand.js.map +1 -0
- package/dist/Console/Commands/QueuePruneBatchesCommand.d.ts +16 -0
- package/dist/Console/Commands/QueuePruneBatchesCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueuePruneBatchesCommand.js +44 -0
- package/dist/Console/Commands/QueuePruneBatchesCommand.js.map +1 -0
- package/dist/Console/Commands/QueuePruneFailedCommand.d.ts +18 -0
- package/dist/Console/Commands/QueuePruneFailedCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueuePruneFailedCommand.js +39 -0
- package/dist/Console/Commands/QueuePruneFailedCommand.js.map +1 -0
- package/dist/Console/Commands/QueueRestartCommand.d.ts +16 -0
- package/dist/Console/Commands/QueueRestartCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueRestartCommand.js +34 -0
- package/dist/Console/Commands/QueueRestartCommand.js.map +1 -0
- package/dist/Console/Commands/QueueRetryCommand.d.ts +20 -0
- package/dist/Console/Commands/QueueRetryCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueRetryCommand.js +77 -0
- package/dist/Console/Commands/QueueRetryCommand.js.map +1 -0
- package/dist/Console/Commands/QueueTableCommand.d.ts +17 -0
- package/dist/Console/Commands/QueueTableCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueTableCommand.js +89 -0
- package/dist/Console/Commands/QueueTableCommand.js.map +1 -0
- package/dist/Console/Commands/QueueWorkCommand.d.ts +16 -0
- package/dist/Console/Commands/QueueWorkCommand.d.ts.map +1 -0
- package/dist/Console/Commands/QueueWorkCommand.js +51 -0
- package/dist/Console/Commands/QueueWorkCommand.js.map +1 -0
- package/dist/Events/Dispatcher.d.ts.map +1 -1
- package/dist/Events/Dispatcher.js +10 -1
- package/dist/Events/Dispatcher.js.map +1 -1
- package/dist/Facades/Bus.d.ts +62 -0
- package/dist/Facades/Bus.d.ts.map +1 -0
- package/dist/Facades/Bus.js +102 -0
- package/dist/Facades/Bus.js.map +1 -0
- package/dist/Facades/Queue.d.ts +42 -0
- package/dist/Facades/Queue.d.ts.map +1 -0
- package/dist/Facades/Queue.js +71 -0
- package/dist/Facades/Queue.js.map +1 -0
- package/dist/Facades/index.d.ts +2 -0
- package/dist/Facades/index.d.ts.map +1 -1
- package/dist/Facades/index.js +5 -1
- package/dist/Facades/index.js.map +1 -1
- package/dist/Queue/Batching/Batch.d.ts +86 -0
- package/dist/Queue/Batching/Batch.d.ts.map +1 -0
- package/dist/Queue/Batching/Batch.js +170 -0
- package/dist/Queue/Batching/Batch.js.map +1 -0
- package/dist/Queue/Batching/PendingBatch.d.ts +72 -0
- package/dist/Queue/Batching/PendingBatch.d.ts.map +1 -0
- package/dist/Queue/Batching/PendingBatch.js +122 -0
- package/dist/Queue/Batching/PendingBatch.js.map +1 -0
- package/dist/Queue/Batching/index.d.ts +3 -0
- package/dist/Queue/Batching/index.d.ts.map +1 -0
- package/dist/Queue/Batching/index.js +8 -0
- package/dist/Queue/Batching/index.js.map +1 -0
- package/dist/Queue/Concerns/Dispatchable.d.ts +36 -0
- package/dist/Queue/Concerns/Dispatchable.d.ts.map +1 -0
- package/dist/Queue/Concerns/Dispatchable.js +102 -0
- package/dist/Queue/Concerns/Dispatchable.js.map +1 -0
- package/dist/Queue/Contracts/QueueDriver.d.ts +67 -0
- package/dist/Queue/Contracts/QueueDriver.d.ts.map +1 -0
- package/dist/Queue/Contracts/QueueDriver.js +9 -0
- package/dist/Queue/Contracts/QueueDriver.js.map +1 -0
- package/dist/Queue/Contracts/QueueableJob.d.ts +74 -0
- package/dist/Queue/Contracts/QueueableJob.d.ts.map +1 -0
- package/dist/Queue/Contracts/QueueableJob.js +9 -0
- package/dist/Queue/Contracts/QueueableJob.js.map +1 -0
- package/dist/Queue/Contracts/ShouldBeUnique.d.ts +43 -0
- package/dist/Queue/Contracts/ShouldBeUnique.d.ts.map +1 -0
- package/dist/Queue/Contracts/ShouldBeUnique.js +12 -0
- package/dist/Queue/Contracts/ShouldBeUnique.js.map +1 -0
- package/dist/Queue/Drivers/DatabaseDriver.d.ts +39 -0
- package/dist/Queue/Drivers/DatabaseDriver.d.ts.map +1 -0
- package/dist/Queue/Drivers/DatabaseDriver.js +176 -0
- package/dist/Queue/Drivers/DatabaseDriver.js.map +1 -0
- package/dist/Queue/Drivers/NullDriver.d.ts +30 -0
- package/dist/Queue/Drivers/NullDriver.d.ts.map +1 -0
- package/dist/Queue/Drivers/NullDriver.js +57 -0
- package/dist/Queue/Drivers/NullDriver.js.map +1 -0
- package/dist/Queue/Drivers/SyncDriver.d.ts +29 -0
- package/dist/Queue/Drivers/SyncDriver.d.ts.map +1 -0
- package/dist/Queue/Drivers/SyncDriver.js +67 -0
- package/dist/Queue/Drivers/SyncDriver.js.map +1 -0
- package/dist/Queue/Drivers/index.d.ts +4 -0
- package/dist/Queue/Drivers/index.d.ts.map +1 -0
- package/dist/Queue/Drivers/index.js +10 -0
- package/dist/Queue/Drivers/index.js.map +1 -0
- package/dist/Queue/Events/JobExceptionOccurred.d.ts +13 -0
- package/dist/Queue/Events/JobExceptionOccurred.d.ts.map +1 -0
- package/dist/Queue/Events/JobExceptionOccurred.js +20 -0
- package/dist/Queue/Events/JobExceptionOccurred.js.map +1 -0
- package/dist/Queue/Events/JobFailed.d.ts +13 -0
- package/dist/Queue/Events/JobFailed.d.ts.map +1 -0
- package/dist/Queue/Events/JobFailed.js +20 -0
- package/dist/Queue/Events/JobFailed.js.map +1 -0
- package/dist/Queue/Events/JobProcessed.d.ts +12 -0
- package/dist/Queue/Events/JobProcessed.d.ts.map +1 -0
- package/dist/Queue/Events/JobProcessed.js +18 -0
- package/dist/Queue/Events/JobProcessed.js.map +1 -0
- package/dist/Queue/Events/JobProcessing.d.ts +12 -0
- package/dist/Queue/Events/JobProcessing.d.ts.map +1 -0
- package/dist/Queue/Events/JobProcessing.js +18 -0
- package/dist/Queue/Events/JobProcessing.js.map +1 -0
- package/dist/Queue/Events/JobQueued.d.ts +14 -0
- package/dist/Queue/Events/JobQueued.d.ts.map +1 -0
- package/dist/Queue/Events/JobQueued.js +22 -0
- package/dist/Queue/Events/JobQueued.js.map +1 -0
- package/dist/Queue/Events/JobRetryRequested.d.ts +12 -0
- package/dist/Queue/Events/JobRetryRequested.d.ts.map +1 -0
- package/dist/Queue/Events/JobRetryRequested.js +20 -0
- package/dist/Queue/Events/JobRetryRequested.js.map +1 -0
- package/dist/Queue/Events/WorkerStopping.d.ts +11 -0
- package/dist/Queue/Events/WorkerStopping.d.ts.map +1 -0
- package/dist/Queue/Events/WorkerStopping.js +18 -0
- package/dist/Queue/Events/WorkerStopping.js.map +1 -0
- package/dist/Queue/Events/index.d.ts +8 -0
- package/dist/Queue/Events/index.d.ts.map +1 -0
- package/dist/Queue/Events/index.js +18 -0
- package/dist/Queue/Events/index.js.map +1 -0
- package/dist/Queue/Failed/DatabaseFailedJobProvider.d.ts +33 -0
- package/dist/Queue/Failed/DatabaseFailedJobProvider.d.ts.map +1 -0
- package/dist/Queue/Failed/DatabaseFailedJobProvider.js +100 -0
- package/dist/Queue/Failed/DatabaseFailedJobProvider.js.map +1 -0
- package/dist/Queue/Failed/FailedJobProvider.d.ts +42 -0
- package/dist/Queue/Failed/FailedJobProvider.d.ts.map +1 -0
- package/dist/Queue/Failed/FailedJobProvider.js +9 -0
- package/dist/Queue/Failed/FailedJobProvider.js.map +1 -0
- package/dist/Queue/Job.d.ts +194 -0
- package/dist/Queue/Job.d.ts.map +1 -0
- package/dist/Queue/Job.js +286 -0
- package/dist/Queue/Job.js.map +1 -0
- package/dist/Queue/JobPayload.d.ts +37 -0
- package/dist/Queue/JobPayload.d.ts.map +1 -0
- package/dist/Queue/JobPayload.js +46 -0
- package/dist/Queue/JobPayload.js.map +1 -0
- package/dist/Queue/Middleware/JobMiddleware.d.ts +29 -0
- package/dist/Queue/Middleware/JobMiddleware.d.ts.map +1 -0
- package/dist/Queue/Middleware/JobMiddleware.js +21 -0
- package/dist/Queue/Middleware/JobMiddleware.js.map +1 -0
- package/dist/Queue/Middleware/RateLimited.d.ts +56 -0
- package/dist/Queue/Middleware/RateLimited.d.ts.map +1 -0
- package/dist/Queue/Middleware/RateLimited.js +83 -0
- package/dist/Queue/Middleware/RateLimited.js.map +1 -0
- package/dist/Queue/Middleware/ThrottlesExceptions.d.ts +71 -0
- package/dist/Queue/Middleware/ThrottlesExceptions.d.ts.map +1 -0
- package/dist/Queue/Middleware/ThrottlesExceptions.js +119 -0
- package/dist/Queue/Middleware/ThrottlesExceptions.js.map +1 -0
- package/dist/Queue/Middleware/WithoutOverlapping.d.ts +64 -0
- package/dist/Queue/Middleware/WithoutOverlapping.d.ts.map +1 -0
- package/dist/Queue/Middleware/WithoutOverlapping.js +103 -0
- package/dist/Queue/Middleware/WithoutOverlapping.js.map +1 -0
- package/dist/Queue/Middleware/index.d.ts +5 -0
- package/dist/Queue/Middleware/index.d.ts.map +1 -0
- package/dist/Queue/Middleware/index.js +10 -0
- package/dist/Queue/Middleware/index.js.map +1 -0
- package/dist/Queue/PendingChain.d.ts +63 -0
- package/dist/Queue/PendingChain.d.ts.map +1 -0
- package/dist/Queue/PendingChain.js +111 -0
- package/dist/Queue/PendingChain.js.map +1 -0
- package/dist/Queue/PendingDispatch.d.ts +66 -0
- package/dist/Queue/PendingDispatch.d.ts.map +1 -0
- package/dist/Queue/PendingDispatch.js +101 -0
- package/dist/Queue/PendingDispatch.js.map +1 -0
- package/dist/Queue/QueueManager.d.ts +151 -0
- package/dist/Queue/QueueManager.d.ts.map +1 -0
- package/dist/Queue/QueueManager.js +227 -0
- package/dist/Queue/QueueManager.js.map +1 -0
- package/dist/Queue/QueueServiceProvider.d.ts +19 -0
- package/dist/Queue/QueueServiceProvider.d.ts.map +1 -0
- package/dist/Queue/QueueServiceProvider.js +75 -0
- package/dist/Queue/QueueServiceProvider.js.map +1 -0
- package/dist/Queue/Workers/Worker.d.ts +99 -0
- package/dist/Queue/Workers/Worker.d.ts.map +1 -0
- package/dist/Queue/Workers/Worker.js +324 -0
- package/dist/Queue/Workers/Worker.js.map +1 -0
- package/dist/Queue/Workers/WorkerOptions.d.ts +62 -0
- package/dist/Queue/Workers/WorkerOptions.d.ts.map +1 -0
- package/dist/Queue/Workers/WorkerOptions.js +23 -0
- package/dist/Queue/Workers/WorkerOptions.js.map +1 -0
- package/dist/Queue/index.d.ts +41 -0
- package/dist/Queue/index.d.ts.map +1 -0
- package/dist/Queue/index.js +67 -0
- package/dist/Queue/index.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MakeJobCommand
|
|
3
|
+
*
|
|
4
|
+
* Create a new job class.
|
|
5
|
+
* Mirrors Laravel's `php artisan make:job`.
|
|
6
|
+
*/
|
|
7
|
+
import { Command, CommandOptions } from '../Command';
|
|
8
|
+
import { Application } from '../../Foundation/Application';
|
|
9
|
+
export declare class MakeJobCommand extends Command {
|
|
10
|
+
protected app: Application;
|
|
11
|
+
signature: string;
|
|
12
|
+
description: string;
|
|
13
|
+
constructor(app: Application);
|
|
14
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
15
|
+
protected getPath(options: CommandOptions): string;
|
|
16
|
+
protected fileExists(filePath: string): Promise<boolean>;
|
|
17
|
+
protected getStub(): string;
|
|
18
|
+
protected getSyncStub(): string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=MakeJobCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MakeJobCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/MakeJobCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,qBAAa,cAAe,SAAQ,OAAO;IAI7B,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAqB;IAC9B,WAAW,SAA4B;gBAEjB,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCpE,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM;cAIlC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS9D,SAAS,CAAC,OAAO,IAAI,MAAM;IA8C3B,SAAS,CAAC,WAAW,IAAI,MAAM;CAsBhC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MakeJobCommand
|
|
4
|
+
*
|
|
5
|
+
* Create a new job class.
|
|
6
|
+
* Mirrors Laravel's `php artisan make:job`.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.MakeJobCommand = void 0;
|
|
43
|
+
const Command_1 = require("../Command");
|
|
44
|
+
const fs = __importStar(require("fs/promises"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
class MakeJobCommand extends Command_1.Command {
|
|
47
|
+
app;
|
|
48
|
+
signature = 'make:job <name>';
|
|
49
|
+
description = 'Create a new job class';
|
|
50
|
+
constructor(app) {
|
|
51
|
+
super();
|
|
52
|
+
this.app = app;
|
|
53
|
+
}
|
|
54
|
+
async handle(args, options) {
|
|
55
|
+
const name = args[0];
|
|
56
|
+
if (!name) {
|
|
57
|
+
this.error('Job name is required.');
|
|
58
|
+
this.line('Usage: make:job <name>');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const jobsPath = this.getPath(options);
|
|
62
|
+
const filePath = path.join(jobsPath, `${name}.ts`);
|
|
63
|
+
// Check if file already exists
|
|
64
|
+
if (await this.fileExists(filePath)) {
|
|
65
|
+
this.error(`Job already exists: ${filePath}`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Create directory if it doesn't exist
|
|
69
|
+
await fs.mkdir(jobsPath, { recursive: true });
|
|
70
|
+
// Determine if sync or queued
|
|
71
|
+
const sync = options.sync === true || options.sync === 'true';
|
|
72
|
+
// Generate file content
|
|
73
|
+
const content = (sync ? this.getSyncStub() : this.getStub())
|
|
74
|
+
.replace(/\{\{className\}\}/g, name);
|
|
75
|
+
// Write file
|
|
76
|
+
await fs.writeFile(filePath, content);
|
|
77
|
+
this.info(`Job created successfully: ${filePath}`);
|
|
78
|
+
this.newLine();
|
|
79
|
+
this.comment('Next steps:');
|
|
80
|
+
this.comment('1. Add your job logic to the handle() method');
|
|
81
|
+
this.comment('2. Dispatch the job:');
|
|
82
|
+
this.comment(` await ${name}.dispatch();`);
|
|
83
|
+
}
|
|
84
|
+
getPath(options) {
|
|
85
|
+
return options.path || this.app.path('Jobs');
|
|
86
|
+
}
|
|
87
|
+
async fileExists(filePath) {
|
|
88
|
+
try {
|
|
89
|
+
await fs.access(filePath);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
getStub() {
|
|
97
|
+
return `import { Job } from '@orchestr-sh/orchestr';
|
|
98
|
+
|
|
99
|
+
export class {{className}} extends Job {
|
|
100
|
+
/**
|
|
101
|
+
* The number of times the job may be attempted.
|
|
102
|
+
*/
|
|
103
|
+
public tries = 3;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The number of seconds the job can run before timing out.
|
|
107
|
+
*/
|
|
108
|
+
public timeout = 60;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The number of seconds to wait before retrying the job.
|
|
112
|
+
* Can use an array for progressive backoff: [10, 30, 60]
|
|
113
|
+
*/
|
|
114
|
+
public backoff = 10;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Create a new job instance.
|
|
118
|
+
*/
|
|
119
|
+
constructor(
|
|
120
|
+
// Add your job data here
|
|
121
|
+
) {
|
|
122
|
+
super();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Execute the job.
|
|
127
|
+
*/
|
|
128
|
+
async handle(): Promise<void> {
|
|
129
|
+
//
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Handle a job failure.
|
|
134
|
+
*/
|
|
135
|
+
async failed(error: Error): Promise<void> {
|
|
136
|
+
console.error(\`[\${this.displayName()}] Failed:\`, error.message);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
getSyncStub() {
|
|
142
|
+
return `import { Job } from '@orchestr-sh/orchestr';
|
|
143
|
+
|
|
144
|
+
export class {{className}} extends Job {
|
|
145
|
+
/**
|
|
146
|
+
* Create a new job instance.
|
|
147
|
+
*/
|
|
148
|
+
constructor(
|
|
149
|
+
// Add your job data here
|
|
150
|
+
) {
|
|
151
|
+
super();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Execute the job.
|
|
156
|
+
*/
|
|
157
|
+
async handle(): Promise<void> {
|
|
158
|
+
//
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.MakeJobCommand = MakeJobCommand;
|
|
165
|
+
//# sourceMappingURL=MakeJobCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MakeJobCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/MakeJobCommand.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAqD;AAErD,gDAAkC;AAClC,2CAA6B;AAE7B,MAAa,cAAe,SAAQ,iBAAO;IAInB;IAHtB,SAAS,GAAG,iBAAiB,CAAC;IAC9B,WAAW,GAAG,wBAAwB,CAAC;IAEvC,YAAsB,GAAgB;QACpC,KAAK,E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AC;QACf,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,cAAc,CAAC,CAAC;IAC/C,CAAC;IAES,OAAO,CAAC,OAAuB;QACvC,OAAQ,OAAO,CAAC,IAAe,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,QAAgB;QACzC,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAES,OAAO;QACf,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CV,CAAC;IACA,CAAC;IAES,WAAW;QACnB,OAAO;;;;;;;;;;;;;;;;;;;CAmBV,CAAC;IACA,CAAC;CACF;AAhID,wCAgIC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueueBatchesTableCommand
|
|
3
|
+
*
|
|
4
|
+
* Create a migration for the batches database table.
|
|
5
|
+
* Mirrors Laravel's `php artisan queue:batches-table`.
|
|
6
|
+
*/
|
|
7
|
+
import { Command, CommandOptions } from '../Command';
|
|
8
|
+
import { Application } from '../../Foundation/Application';
|
|
9
|
+
export declare class QueueBatchesTableCommand extends Command {
|
|
10
|
+
protected app: Application;
|
|
11
|
+
signature: string;
|
|
12
|
+
description: string;
|
|
13
|
+
constructor(app: Application);
|
|
14
|
+
handle(_args: string[], options: CommandOptions): Promise<void>;
|
|
15
|
+
protected getStub(): string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=QueueBatchesTableCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueBatchesTableCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/QueueBatchesTableCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,qBAAa,wBAAyB,SAAQ,OAAO;IAIvC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAyB;IAClC,WAAW,SAAuD;gBAE5C,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrE,SAAS,CAAC,OAAO,IAAI,MAAM;CA0B5B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueueBatchesTableCommand
|
|
4
|
+
*
|
|
5
|
+
* Create a migration for the batches database table.
|
|
6
|
+
* Mirrors Laravel's `php artisan queue:batches-table`.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.QueueBatchesTableCommand = void 0;
|
|
43
|
+
const Command_1 = require("../Command");
|
|
44
|
+
const fs = __importStar(require("fs/promises"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
class QueueBatchesTableCommand extends Command_1.Command {
|
|
47
|
+
app;
|
|
48
|
+
signature = 'queue:batches-table';
|
|
49
|
+
description = 'Create a migration for the batches database table';
|
|
50
|
+
constructor(app) {
|
|
51
|
+
super();
|
|
52
|
+
this.app = app;
|
|
53
|
+
}
|
|
54
|
+
async handle(_args, options) {
|
|
55
|
+
const migrationsPath = options.path || this.app.databasePath('migrations');
|
|
56
|
+
await fs.mkdir(migrationsPath, { recursive: true });
|
|
57
|
+
const timestamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14);
|
|
58
|
+
const fileName = `${timestamp}_create_job_batches_table.ts`;
|
|
59
|
+
const filePath = path.join(migrationsPath, fileName);
|
|
60
|
+
await fs.writeFile(filePath, this.getStub());
|
|
61
|
+
this.info(`Migration created successfully: ${filePath}`);
|
|
62
|
+
this.comment('Run "npx orchestr migrate" to create the table.');
|
|
63
|
+
}
|
|
64
|
+
getStub() {
|
|
65
|
+
return `import { Migration } from '@orchestr-sh/orchestr';
|
|
66
|
+
import type { SchemaBuilder } from '@orchestr-sh/orchestr';
|
|
67
|
+
|
|
68
|
+
export default class CreateJobBatchesTable extends Migration {
|
|
69
|
+
async up(schema: SchemaBuilder): Promise<void> {
|
|
70
|
+
await schema.create('job_batches', (table) => {
|
|
71
|
+
table.string('id').primary();
|
|
72
|
+
table.string('name');
|
|
73
|
+
table.integer('total_jobs');
|
|
74
|
+
table.integer('pending_jobs');
|
|
75
|
+
table.integer('failed_jobs');
|
|
76
|
+
table.text('failed_job_ids');
|
|
77
|
+
table.text('options').nullable();
|
|
78
|
+
table.integer('cancelled_at').nullable();
|
|
79
|
+
table.integer('created_at');
|
|
80
|
+
table.integer('finished_at').nullable();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async down(schema: SchemaBuilder): Promise<void> {
|
|
85
|
+
await schema.drop('job_batches');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.QueueBatchesTableCommand = QueueBatchesTableCommand;
|
|
92
|
+
//# sourceMappingURL=QueueBatchesTableCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueBatchesTableCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/QueueBatchesTableCommand.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAqD;AAErD,gDAAkC;AAClC,2CAA6B;AAE7B,MAAa,wBAAyB,SAAQ,iBAAO;IAI7B;IAHtB,SAAS,GAAG,qBAAqB,CAAC;IAClC,WAAW,GAAG,mDAAmD,CAAC;IAElE,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAe,EAAE,OAAuB;QACnD,MAAM,cAAc,GAAI,OAAO,CAAC,IAAe,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACvF,MAAM,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEpD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9E,MAAM,QAAQ,GAAG,GAAG,SAAS,8BAA8B,CAAC;QAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAErD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7C,IAAI,CAAC,IAAI,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC;IAClE,CAAC;IAES,OAAO;QACf,OAAO;;;;;;;;;;;;;;;;;;;;;;;CAuBV,CAAC;IACA,CAAC;CACF;AAhDD,4DAgDC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueueClearCommand
|
|
3
|
+
*
|
|
4
|
+
* Delete all of the jobs from the specified queue.
|
|
5
|
+
* Mirrors Laravel's `php artisan queue:clear`.
|
|
6
|
+
*/
|
|
7
|
+
import { Command, CommandOptions } from '../Command';
|
|
8
|
+
import { Application } from '../../Foundation/Application';
|
|
9
|
+
export declare class QueueClearCommand extends Command {
|
|
10
|
+
protected app: Application;
|
|
11
|
+
signature: string;
|
|
12
|
+
description: string;
|
|
13
|
+
constructor(app: Application);
|
|
14
|
+
handle(args: string[], options: CommandOptions): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=QueueClearCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueClearCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/QueueClearCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,qBAAa,iBAAkB,SAAQ,OAAO;IAIhC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAA8B;IACvC,WAAW,SAAqD;gBAE1C,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAUrE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueueClearCommand
|
|
4
|
+
*
|
|
5
|
+
* Delete all of the jobs from the specified queue.
|
|
6
|
+
* Mirrors Laravel's `php artisan queue:clear`.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.QueueClearCommand = void 0;
|
|
10
|
+
const Command_1 = require("../Command");
|
|
11
|
+
class QueueClearCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'queue:clear [connection]';
|
|
14
|
+
description = 'Delete all of the jobs from the specified queue';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(args, options) {
|
|
20
|
+
const manager = this.app.make('queue');
|
|
21
|
+
const connection = args[0] || manager.getDefaultConnection();
|
|
22
|
+
const queue = options.queue || 'default';
|
|
23
|
+
const driver = manager.connection(connection);
|
|
24
|
+
const count = await driver.clear(queue);
|
|
25
|
+
this.info(`Cleared ${count} job(s) from the [${queue}] queue on [${connection}] connection.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.QueueClearCommand = QueueClearCommand;
|
|
29
|
+
//# sourceMappingURL=QueueClearCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueClearCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/QueueClearCommand.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,wCAAqD;AAIrD,MAAa,iBAAkB,SAAQ,iBAAO;IAItB;IAHtB,SAAS,GAAG,0BAA0B,CAAC;IACvC,WAAW,GAAG,iDAAiD,CAAC;IAEhE,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAc,EAAE,OAAuB;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,OAAO,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAI,OAAO,CAAC,KAAgB,IAAI,SAAS,CAAC;QAErD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAExC,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,qBAAqB,KAAK,eAAe,UAAU,eAAe,CAAC,CAAC;IAChG,CAAC;CACF;AAlBD,8CAkBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueueFailedCommand
|
|
3
|
+
*
|
|
4
|
+
* List all of the failed queue jobs.
|
|
5
|
+
* Mirrors Laravel's `php artisan queue:failed`.
|
|
6
|
+
*/
|
|
7
|
+
import { Command, CommandOptions } from '../Command';
|
|
8
|
+
import { Application } from '../../Foundation/Application';
|
|
9
|
+
import type { FailedJobProvider } from '../../Queue/Failed/FailedJobProvider';
|
|
10
|
+
export declare class QueueFailedCommand extends Command {
|
|
11
|
+
protected app: Application;
|
|
12
|
+
signature: string;
|
|
13
|
+
description: string;
|
|
14
|
+
constructor(app: Application);
|
|
15
|
+
handle(_args: string[], _options: CommandOptions): Promise<void>;
|
|
16
|
+
protected getFailedJobProvider(): FailedJobProvider | null;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=QueueFailedCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueFailedCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/QueueFailedCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,qBAAa,kBAAmB,SAAQ,OAAO;IAIjC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAkB;IAC3B,WAAW,SAAuC;gBAE5B,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDtE,SAAS,CAAC,oBAAoB,IAAI,iBAAiB,GAAG,IAAI;CAO3D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueueFailedCommand
|
|
4
|
+
*
|
|
5
|
+
* List all of the failed queue jobs.
|
|
6
|
+
* Mirrors Laravel's `php artisan queue:failed`.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.QueueFailedCommand = void 0;
|
|
10
|
+
const Command_1 = require("../Command");
|
|
11
|
+
class QueueFailedCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'queue:failed';
|
|
14
|
+
description = 'List all of the failed queue jobs';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(_args, _options) {
|
|
20
|
+
const failer = this.getFailedJobProvider();
|
|
21
|
+
if (!failer) {
|
|
22
|
+
this.error('No failed job provider configured.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const failedJobs = await failer.all();
|
|
26
|
+
if (failedJobs.length === 0) {
|
|
27
|
+
this.info('No failed jobs found.');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.info(`Found ${failedJobs.length} failed job(s):`);
|
|
31
|
+
this.newLine();
|
|
32
|
+
const headers = ['ID', 'UUID', 'Connection', 'Queue', 'Job', 'Failed At'];
|
|
33
|
+
const rows = failedJobs.map((job) => {
|
|
34
|
+
let jobName = 'Unknown';
|
|
35
|
+
try {
|
|
36
|
+
const payload = JSON.parse(job.payload);
|
|
37
|
+
jobName = payload.displayName || payload.job || 'Unknown';
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Invalid payload
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
String(job.id),
|
|
44
|
+
job.uuid.substring(0, 8) + '...',
|
|
45
|
+
job.connection,
|
|
46
|
+
job.queue,
|
|
47
|
+
jobName,
|
|
48
|
+
job.failed_at,
|
|
49
|
+
];
|
|
50
|
+
});
|
|
51
|
+
// Simple table output
|
|
52
|
+
const colWidths = headers.map((h, i) => {
|
|
53
|
+
const maxData = Math.max(...rows.map((r) => String(r[i]).length));
|
|
54
|
+
return Math.max(h.length, maxData);
|
|
55
|
+
});
|
|
56
|
+
const separator = colWidths.map((w) => '-'.repeat(w + 2)).join('+');
|
|
57
|
+
const formatRow = (row) => row.map((cell, i) => ` ${String(cell).padEnd(colWidths[i])} `).join('|');
|
|
58
|
+
this.line(separator);
|
|
59
|
+
this.line(formatRow(headers));
|
|
60
|
+
this.line(separator);
|
|
61
|
+
for (const row of rows) {
|
|
62
|
+
this.line(formatRow(row));
|
|
63
|
+
}
|
|
64
|
+
this.line(separator);
|
|
65
|
+
}
|
|
66
|
+
getFailedJobProvider() {
|
|
67
|
+
try {
|
|
68
|
+
return this.app.make('queue.failer');
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.QueueFailedCommand = QueueFailedCommand;
|
|
76
|
+
//# sourceMappingURL=QueueFailedCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueFailedCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/QueueFailedCommand.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,wCAAqD;AAIrD,MAAa,kBAAmB,SAAQ,iBAAO;IAIvB;IAHtB,SAAS,GAAG,cAAc,CAAC;IAC3B,WAAW,GAAG,mCAAmC,CAAC;IAElD,YAAsB,GAAgB;QACpC,KAAK,EAAE,CAAC;QADY,QAAG,GAAH,GAAG,CAAa;IAEtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAe,EAAE,QAAwB;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACjD,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;QAEtC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,u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AC;QAEH,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,CAAC,GAAa,EAAE,EAAE,CAClC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE3E,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IAES,oBAAoB;QAC5B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAoB,cAAc,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAxED,gDAwEC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QueueFailedTableCommand
|
|
3
|
+
*
|
|
4
|
+
* Create a migration for the failed queue jobs database table.
|
|
5
|
+
* Mirrors Laravel's `php artisan queue:failed-table`.
|
|
6
|
+
*/
|
|
7
|
+
import { Command, CommandOptions } from '../Command';
|
|
8
|
+
import { Application } from '../../Foundation/Application';
|
|
9
|
+
export declare class QueueFailedTableCommand extends Command {
|
|
10
|
+
protected app: Application;
|
|
11
|
+
signature: string;
|
|
12
|
+
description: string;
|
|
13
|
+
constructor(app: Application);
|
|
14
|
+
handle(_args: string[], options: CommandOptions): Promise<void>;
|
|
15
|
+
protected getStub(): string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=QueueFailedTableCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueFailedTableCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/QueueFailedTableCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,qBAAa,uBAAwB,SAAQ,OAAO;IAItC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAwB;IACjC,WAAW,SAAiE;gBAEtD,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAcrE,SAAS,CAAC,OAAO,IAAI,MAAM;CAuB5B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueueFailedTableCommand
|
|
4
|
+
*
|
|
5
|
+
* Create a migration for the failed queue jobs database table.
|
|
6
|
+
* Mirrors Laravel's `php artisan queue:failed-table`.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.QueueFailedTableCommand = void 0;
|
|
43
|
+
const Command_1 = require("../Command");
|
|
44
|
+
const fs = __importStar(require("fs/promises"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
class QueueFailedTableCommand extends Command_1.Command {
|
|
47
|
+
app;
|
|
48
|
+
signature = 'queue:failed-table';
|
|
49
|
+
description = 'Create a migration for the failed queue jobs database table';
|
|
50
|
+
constructor(app) {
|
|
51
|
+
super();
|
|
52
|
+
this.app = app;
|
|
53
|
+
}
|
|
54
|
+
async handle(_args, options) {
|
|
55
|
+
const migrationsPath = options.path || this.app.databasePath('migrations');
|
|
56
|
+
await fs.mkdir(migrationsPath, { recursive: true });
|
|
57
|
+
const timestamp = new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14);
|
|
58
|
+
const fileName = `${timestamp}_create_failed_jobs_table.ts`;
|
|
59
|
+
const filePath = path.join(migrationsPath, fileName);
|
|
60
|
+
await fs.writeFile(filePath, this.getStub());
|
|
61
|
+
this.info(`Migration created successfully: ${filePath}`);
|
|
62
|
+
this.comment('Run "npx orchestr migrate" to create the table.');
|
|
63
|
+
}
|
|
64
|
+
getStub() {
|
|
65
|
+
return `import { Migration } from '@orchestr-sh/orchestr';
|
|
66
|
+
import type { SchemaBuilder } from '@orchestr-sh/orchestr';
|
|
67
|
+
|
|
68
|
+
export default class CreateFailedJobsTable extends Migration {
|
|
69
|
+
async up(schema: SchemaBuilder): Promise<void> {
|
|
70
|
+
await schema.create('failed_jobs', (table) => {
|
|
71
|
+
table.bigIncrements('id');
|
|
72
|
+
table.string('uuid').unique();
|
|
73
|
+
table.text('connection');
|
|
74
|
+
table.text('queue');
|
|
75
|
+
table.text('payload');
|
|
76
|
+
table.text('exception');
|
|
77
|
+
table.timestamp('failed_at').defaultTo(new Date().toISOString());
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async down(schema: SchemaBuilder): Promise<void> {
|
|
82
|
+
await schema.drop('failed_jobs');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.QueueFailedTableCommand = QueueFailedTableCommand;
|
|
89
|
+
//# sourceMappingURL=QueueFailedTableCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueFailedTableCommand.js","sourceRoot":"","sources":["../../../src/Console/Commands/QueueFailedTableCommand.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAqD;AAErD,gDAAkC;AAClC,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ions } from '../Command';
|
|
8
|
+
import { Application } from '../../Foundation/Application';
|
|
9
|
+
import type { FailedJobProvider } from '../../Queue/Failed/FailedJobProvider';
|
|
10
|
+
export declare class QueueFlushCommand extends Command {
|
|
11
|
+
protected app: Application;
|
|
12
|
+
signature: string;
|
|
13
|
+
description: string;
|
|
14
|
+
constructor(app: Application);
|
|
15
|
+
handle(_args: string[], options: CommandOptions): Promise<void>;
|
|
16
|
+
protected getFailedJobProvider(): FailedJobProvider | null;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=QueueFlushCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueueFlushCommand.d.ts","sourceRoot":"","sources":["../../../src/Console/Commands/QueueFlushCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,qBAAa,iBAAkB,SAAQ,OAAO;IAIhC,SAAS,CAAC,GAAG,EAAE,WAAW;IAHtC,SAAS,SAAiB;IAC1B,WAAW,SAAwC;gBAE7B,GAAG,EAAE,WAAW;IAIhC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBrE,SAAS,CAAC,oBAAoB,IAAI,iBAAiB,GAAG,IAAI;CAO3D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueueFlushCommand
|
|
4
|
+
*
|
|
5
|
+
* Flush all of the failed queue jobs.
|
|
6
|
+
* Mirrors Laravel's `php artisan queue:flush`.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.QueueFlushCommand = void 0;
|
|
10
|
+
const Command_1 = require("../Command");
|
|
11
|
+
class QueueFlushCommand extends Command_1.Command {
|
|
12
|
+
app;
|
|
13
|
+
signature = 'queue:flush';
|
|
14
|
+
description = 'Flush all of the failed queue jobs';
|
|
15
|
+
constructor(app) {
|
|
16
|
+
super();
|
|
17
|
+
this.app = app;
|
|
18
|
+
}
|
|
19
|
+
async handle(_args, options) {
|
|
20
|
+
const failer = this.getFailedJobProvider();
|
|
21
|
+
if (!failer) {
|
|
22
|
+
this.error('No failed job provider configured.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const hours = options.hours ? Number(options.hours) : undefined;
|
|
26
|
+
await failer.flush(hours);
|
|
27
|
+
if (hours) {
|
|
28
|
+
this.info(`All failed jobs older than ${hours} hour(s) have been deleted.`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.info('All failed jobs deleted successfully.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
getFailedJobProvider() {
|
|
35
|
+
try {
|
|
36
|
+
return this.app.make('queue.failer');
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.QueueFlushCommand = QueueFlushCommand;
|
|
44
|
+
//# sourceMappingURL=QueueFlushCommand.js.map
|