@arikajs/queue 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ArikaJs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+
2
+ ## Arika Queue
3
+
4
+ `@arikajs/queue` provides asynchronous job processing for the ArikaJS framework.
5
+
6
+ It allows applications to defer heavy or time-consuming tasks — such as emails, notifications, or event listeners — to background workers, improving performance and scalability.
7
+
8
+ ---
9
+
10
+ ## ✨ Features
11
+
12
+ - **Job dispatching**: Easily send tasks to the queue
13
+ - **Background job workers**: Processes jobs offline
14
+ - **Sync & async queue drivers**: Flexible processing modes
15
+ - **Redis-based queue driver (v1)**: Robust, scalable backend support
16
+ - **Queueable events & mail**: Integration with other framework components
17
+ - **Automatic retry handling**: Resilient job execution
18
+ - **TypeScript-first design**: Fully typed API
19
+
20
+ ---
21
+
22
+ ## 📦 Installation
23
+
24
+ ```bash
25
+ npm install @arikajs/queue
26
+ # or
27
+ yarn add @arikajs/queue
28
+ # or
29
+ pnpm add @arikajs/queue
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 🚀 Basic Usage
35
+
36
+ ### Dispatching a Job
37
+
38
+ ```ts
39
+ import { Queue } from '@arikajs/queue';
40
+
41
+ await Queue.dispatch(new SendEmailJob(user));
42
+ ```
43
+
44
+ ### Defining a Job
45
+
46
+ ```ts
47
+ export class SendEmailJob {
48
+ async handle() {
49
+ // job logic
50
+ }
51
+ }
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 🔁 Queue Drivers (v1)
57
+
58
+ | Driver | Status | Description |
59
+ | :--- | :--- | :--- |
60
+ | **Sync** | ✅ Supported | Default synchronous driver for local dev |
61
+ | **Database** | ✅ Supported | Stores jobs in your database |
62
+ | **Redis** | ⏳ Planned | Redis-based queue driver |
63
+
64
+ ---
65
+
66
+ ## ⚙️ Configuration
67
+
68
+ ```ts
69
+ export default {
70
+ default: process.env.QUEUE_CONNECTION || 'sync',
71
+
72
+ connections: {
73
+ sync: {
74
+ driver: 'sync',
75
+ },
76
+
77
+ database: {
78
+ driver: 'database',
79
+ table: 'jobs',
80
+ connection: null,
81
+ },
82
+ },
83
+ };
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 🛠 Database Queue Setup
89
+
90
+ To use the database driver, you need to create the `jobs` table migration:
91
+
92
+ ```bash
93
+ arika queue:table
94
+ arika migrate
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🔗 Integration
100
+
101
+ - **`@arikajs/mail`** → queued emails
102
+ - **`@arikajs/events`** → async listeners
103
+ - **`@arikajs/logging`** → job logs
104
+ - **`@arikajs/console`** → worker commands
105
+
106
+ ---
107
+
108
+ ## 🧠 Architecture (High Level)
109
+
110
+ ```
111
+ queue/
112
+ ├── src/
113
+ │ ├── QueueManager.ts
114
+ │ ├── Job.ts
115
+ │ ├── Worker.ts
116
+ │ ├── Drivers/
117
+ │ │ ├── SyncDriver.ts
118
+ │ │ └── DatabaseDriver.ts
119
+ │ └── index.ts
120
+ ├── tests/
121
+ ├── package.json
122
+ ├── tsconfig.json
123
+ ├── README.md
124
+ └── LICENSE
125
+ ```
126
+
127
+ ---
128
+
129
+ ## 📄 License
130
+
131
+ `@arikajs/queue` is open-source software licensed under the **MIT License**.
132
+
133
+ ---
134
+
135
+ ## 🧭 Philosophy
136
+
137
+ > "Fast requests. Slow work in the background."
@@ -0,0 +1,7 @@
1
+ export interface Job {
2
+ handle(): Promise<void> | void;
3
+ }
4
+ export interface QueueDriver {
5
+ push(job: Job): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=Contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contracts.d.ts","sourceRoot":"","sources":["../src/Contracts.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,GAAG;IAChB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAGlC;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contracts.js","sourceRoot":"","sources":["../src/Contracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { Job, QueueDriver } from '../Contracts';
2
+ export interface DatabaseQueueConfig {
3
+ driver: 'database';
4
+ table: string;
5
+ connection?: string;
6
+ }
7
+ export declare class DatabaseDriver implements QueueDriver {
8
+ private database;
9
+ private config;
10
+ constructor(database: any, config: DatabaseQueueConfig);
11
+ push(job: Job): Promise<void>;
12
+ protected createPayload(job: Job): any;
13
+ protected getJobData(job: any): any;
14
+ }
15
+ //# sourceMappingURL=DatabaseDriver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseDriver.d.ts","sourceRoot":"","sources":["../../src/Drivers/DatabaseDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,cAAe,YAAW,WAAW;IAE1C,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;gBADN,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,mBAAmB;IAGjC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAYnC,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG;IAQtC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG;CAQtC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DatabaseDriver = void 0;
4
+ class DatabaseDriver {
5
+ constructor(database, config) {
6
+ this.database = database;
7
+ this.config = config;
8
+ }
9
+ async push(job) {
10
+ const payload = this.createPayload(job);
11
+ await this.database.table(this.config.table).insert({
12
+ queue: 'default',
13
+ payload: JSON.stringify(payload),
14
+ attempts: 0,
15
+ available_at: new Date(),
16
+ created_at: new Date(),
17
+ });
18
+ }
19
+ createPayload(job) {
20
+ return {
21
+ displayName: job.constructor.name,
22
+ job: job.constructor.name,
23
+ data: this.getJobData(job),
24
+ };
25
+ }
26
+ getJobData(job) {
27
+ // Simple serialization of job properties
28
+ const data = {};
29
+ for (const key of Object.keys(job)) {
30
+ data[key] = job[key];
31
+ }
32
+ return data;
33
+ }
34
+ }
35
+ exports.DatabaseDriver = DatabaseDriver;
36
+ //# sourceMappingURL=DatabaseDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseDriver.js","sourceRoot":"","sources":["../../src/Drivers/DatabaseDriver.ts"],"names":[],"mappings":";;;AASA,MAAa,cAAc;IACvB,YACY,QAAa,EACb,MAA2B;QAD3B,aAAQ,GAAR,QAAQ,CAAK;QACb,WAAM,GAAN,MAAM,CAAqB;IACnC,CAAC;IAEL,KAAK,CAAC,IAAI,CAAC,GAAQ;QACf,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;YAChD,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAChC,QAAQ,EAAE,CAAC;YACX,YAAY,EAAE,IAAI,IAAI,EAAE;YACxB,UAAU,EAAE,IAAI,IAAI,EAAE;SACzB,CAAC,CAAC;IACP,CAAC;IAES,aAAa,CAAC,GAAQ;QAC5B,OAAO;YACH,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI;YACjC,GAAG,EAAE,GAAG,CAAC,WAAW,CAAC,IAAI;YACzB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;SAC7B,CAAC;IACN,CAAC;IAES,UAAU,CAAC,GAAQ;QACzB,yCAAyC;QACzC,MAAM,IAAI,GAAQ,EAAE,CAAC;QACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlCD,wCAkCC"}
@@ -0,0 +1,5 @@
1
+ import { Job, QueueDriver } from '../Contracts';
2
+ export declare class SyncDriver implements QueueDriver {
3
+ push(job: Job): Promise<void>;
4
+ }
5
+ //# sourceMappingURL=SyncDriver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncDriver.d.ts","sourceRoot":"","sources":["../../src/Drivers/SyncDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,qBAAa,UAAW,YAAW,WAAW;IACpC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAStC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncDriver = void 0;
4
+ class SyncDriver {
5
+ async push(job) {
6
+ // Sync driver executes immediately
7
+ try {
8
+ await job.handle();
9
+ }
10
+ catch (error) {
11
+ console.error('Job failed:', error);
12
+ throw error; // Or handle failure policy
13
+ }
14
+ }
15
+ }
16
+ exports.SyncDriver = SyncDriver;
17
+ //# sourceMappingURL=SyncDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncDriver.js","sourceRoot":"","sources":["../../src/Drivers/SyncDriver.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IACnB,KAAK,CAAC,IAAI,CAAC,GAAQ;QACf,mCAAmC;QACnC,IAAI,CAAC;YACD,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YACpC,MAAM,KAAK,CAAC,CAAC,2BAA2B;QAC5C,CAAC;IACL,CAAC;CACJ;AAVD,gCAUC"}
package/dist/Job.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Job } from './Contracts';
2
+ export declare abstract class BaseJob implements Job {
3
+ abstract handle(): Promise<void> | void;
4
+ }
5
+ //# sourceMappingURL=Job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Job.d.ts","sourceRoot":"","sources":["../src/Job.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,8BAAsB,OAAQ,YAAW,GAAG;IACxC,QAAQ,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CAC1C"}
package/dist/Job.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseJob = void 0;
4
+ // Base class for Jobs if users prefer inheritance
5
+ class BaseJob {
6
+ }
7
+ exports.BaseJob = BaseJob;
8
+ //# sourceMappingURL=Job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Job.js","sourceRoot":"","sources":["../src/Job.ts"],"names":[],"mappings":";;;AAGA,kDAAkD;AAClD,MAAsB,OAAO;CAE5B;AAFD,0BAEC"}
@@ -0,0 +1,11 @@
1
+ import { Job, QueueDriver } from './Contracts';
2
+ export declare class QueueManager {
3
+ private drivers;
4
+ private config;
5
+ private database;
6
+ constructor(config: any, database?: any);
7
+ driver(name?: string): QueueDriver;
8
+ protected resolve(name: string): QueueDriver;
9
+ dispatch(job: Job, connection?: string): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=QueueManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueManager.d.ts","sourceRoot":"","sources":["../src/QueueManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,qBAAa,YAAY;IACrB,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,QAAQ,CAAM;gBAEV,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAG;IAKhC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAUzC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAiB/B,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM;CAGtD"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueueManager = void 0;
4
+ const SyncDriver_1 = require("./Drivers/SyncDriver");
5
+ const DatabaseDriver_1 = require("./Drivers/DatabaseDriver");
6
+ class QueueManager {
7
+ constructor(config, database) {
8
+ this.drivers = new Map();
9
+ this.config = config;
10
+ this.database = database;
11
+ }
12
+ driver(name) {
13
+ const driverName = name || this.config.default;
14
+ if (!this.drivers.has(driverName)) {
15
+ this.drivers.set(driverName, this.resolve(driverName));
16
+ }
17
+ return this.drivers.get(driverName);
18
+ }
19
+ resolve(name) {
20
+ const config = this.config.connections[name];
21
+ if (!config) {
22
+ throw new Error(`Queue connection [${name}] not configured.`);
23
+ }
24
+ switch (config.driver) {
25
+ case 'sync':
26
+ return new SyncDriver_1.SyncDriver();
27
+ case 'database':
28
+ return new DatabaseDriver_1.DatabaseDriver(this.database.connection(config.connection), config);
29
+ default:
30
+ throw new Error(`Unsupported queue driver [${config.driver}].`);
31
+ }
32
+ }
33
+ async dispatch(job, connection) {
34
+ return this.driver(connection).push(job);
35
+ }
36
+ }
37
+ exports.QueueManager = QueueManager;
38
+ //# sourceMappingURL=QueueManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueManager.js","sourceRoot":"","sources":["../src/QueueManager.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAClD,6DAA0D;AAE1D,MAAa,YAAY;IAKrB,YAAY,MAAW,EAAE,QAAc;QAJ/B,YAAO,GAA6B,IAAI,GAAG,EAAE,CAAC;QAKlD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEM,MAAM,CAAC,IAAa;QACvB,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;IACzC,CAAC;IAES,OAAO,CAAC,IAAY;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,mBAAmB,CAAC,CAAC;QAClE,CAAC;QAED,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACpB,KAAK,MAAM;gBACP,OAAO,IAAI,uBAAU,EAAE,CAAC;YAC5B,KAAK,UAAU;gBACX,OAAO,IAAI,+BAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;YACnF;gBACI,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,GAAQ,EAAE,UAAmB;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;CACJ;AAxCD,oCAwCC"}
@@ -0,0 +1,7 @@
1
+ import { Job } from './Contracts';
2
+ export declare class Worker {
3
+ private driver;
4
+ constructor(driver: any);
5
+ process(job: Job): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=Worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Worker.d.ts","sourceRoot":"","sources":["../src/Worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,qBAAa,MAAM;IACH,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,GAAG;IAIzB,OAAO,CAAC,GAAG,EAAE,GAAG;CAOzB"}
package/dist/Worker.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Worker = void 0;
4
+ class Worker {
5
+ constructor(driver) {
6
+ this.driver = driver;
7
+ // In future: Worker will pull from driver
8
+ }
9
+ async process(job) {
10
+ try {
11
+ await job.handle();
12
+ }
13
+ catch (e) {
14
+ throw e;
15
+ }
16
+ }
17
+ }
18
+ exports.Worker = Worker;
19
+ //# sourceMappingURL=Worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Worker.js","sourceRoot":"","sources":["../src/Worker.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IACf,YAAoB,MAAW;QAAX,WAAM,GAAN,MAAM,CAAK;QAC3B,0CAA0C;IAC9C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAQ;QAClB,IAAI,CAAC;YACD,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;CACJ;AAZD,wBAYC"}
@@ -0,0 +1,10 @@
1
+ import { QueueManager } from './QueueManager';
2
+ import { Job } from './Contracts';
3
+ export declare let queueManager: QueueManager;
4
+ export declare class Queue {
5
+ static setManager(manager: QueueManager): void;
6
+ static dispatch(job: Job): Promise<void>;
7
+ }
8
+ export { QueueManager, Job };
9
+ export { BaseJob } from './Job';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,eAAO,IAAI,YAAY,EAAE,YAAY,CAAC;AAEtC,qBAAa,KAAK;IACd,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY;WAI1B,QAAQ,CAAC,GAAG,EAAE,GAAG;CAMjC;AAED,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseJob = exports.QueueManager = exports.Queue = exports.queueManager = void 0;
4
+ const QueueManager_1 = require("./QueueManager");
5
+ Object.defineProperty(exports, "QueueManager", { enumerable: true, get: function () { return QueueManager_1.QueueManager; } });
6
+ class Queue {
7
+ static setManager(manager) {
8
+ exports.queueManager = manager;
9
+ }
10
+ static async dispatch(job) {
11
+ if (!exports.queueManager) {
12
+ throw new Error('Queue not configured. Please use Queue.setManager().');
13
+ }
14
+ return exports.queueManager.dispatch(job);
15
+ }
16
+ }
17
+ exports.Queue = Queue;
18
+ var Job_1 = require("./Job");
19
+ Object.defineProperty(exports, "BaseJob", { enumerable: true, get: function () { return Job_1.BaseJob; } });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAmBrC,6FAnBA,2BAAY,OAmBA;AAbrB,MAAa,KAAK;IACd,MAAM,CAAC,UAAU,CAAC,OAAqB;QACnC,oBAAY,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAQ;QAC1B,IAAI,CAAC,oBAAY,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,oBAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;CACJ;AAXD,sBAWC;AAGD,6BAAgC;AAAvB,8FAAA,OAAO,OAAA"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@arikajs/queue",
3
+ "version": "0.0.1",
4
+ "description": "Asynchronous job processing for the ArikaJS framework.",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc -p tsconfig.json",
10
+ "build:tests": "tsc -p tsconfig.test.json",
11
+ "clean": "rm -rf dist",
12
+ "prepare": "echo skip",
13
+ "test": "npm run build && npm run build:tests && node scripts/fix-test-imports.js && node --test 'dist/tests/**/*.test.js'",
14
+ "test:watch": "npm run build && npm run build:tests && node --test --watch 'dist/tests/**/*.test.js'"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "keywords": [
20
+ "arika",
21
+ "arika-js",
22
+ "queue",
23
+ "job",
24
+ "background-job",
25
+ "redis",
26
+ "worker"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20.0.0"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/arikajs/queue.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/arikajs/queue/issues"
37
+ },
38
+ "homepage": "https://github.com/arikajs/queue#readme",
39
+ "dependencies": {},
40
+ "devDependencies": {
41
+ "@types/node": "^20.11.24",
42
+ "typescript": "^5.3.3"
43
+ },
44
+ "author": "Prakash Tank"
45
+ }