@mantiq/queue 0.1.2 → 0.2.0-rc.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/README.md +2 -2
- package/package.json +11 -6
- package/src/QueueServiceProvider.ts +22 -0
- package/src/types.d.ts +4 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Job dispatching, chains, batches, and scheduling for MantiqJS — sync, SQLite, Redis, SQS, and Kafka drivers.
|
|
4
4
|
|
|
5
|
-
Part of [MantiqJS](https://github.com/
|
|
5
|
+
Part of [MantiqJS](https://github.com/mantiqjs/mantiq) — a batteries-included TypeScript web framework for Bun.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ bun add @mantiq/queue
|
|
|
12
12
|
|
|
13
13
|
## Documentation
|
|
14
14
|
|
|
15
|
-
See the [MantiqJS repository](https://github.com/
|
|
15
|
+
See the [MantiqJS repository](https://github.com/mantiqjs/mantiq) for full documentation.
|
|
16
16
|
|
|
17
17
|
## License
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantiq/queue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.2",
|
|
4
4
|
"description": "Job dispatching, workers, retry logic",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Abdullah Khan",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/mantiqjs/mantiq/tree/main/packages/queue",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/
|
|
11
|
+
"url": "https://github.com/mantiqjs/mantiq.git",
|
|
12
12
|
"directory": "packages/queue"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/mantiqjs/mantiq/issues"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"mantiq",
|
|
@@ -40,14 +40,16 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
43
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target bun --packages=external",
|
|
44
44
|
"test": "bun test",
|
|
45
45
|
"typecheck": "tsc --noEmit",
|
|
46
46
|
"clean": "rm -rf dist"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"bun-types": "latest",
|
|
50
|
-
"typescript": "^5.7.0"
|
|
50
|
+
"typescript": "^5.7.0",
|
|
51
|
+
"@mantiq/core": "workspace:*",
|
|
52
|
+
"@mantiq/cli": "workspace:*"
|
|
51
53
|
},
|
|
52
54
|
"peerDependencies": {
|
|
53
55
|
"@mantiq/core": "^0.1.0",
|
|
@@ -66,5 +68,8 @@
|
|
|
66
68
|
"kafkajs": {
|
|
67
69
|
"optional": true
|
|
68
70
|
}
|
|
71
|
+
},
|
|
72
|
+
"mantiq": {
|
|
73
|
+
"provider": "QueueServiceProvider"
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ServiceProvider } from '@mantiq/core'
|
|
2
|
+
import { registerCommands } from '@mantiq/cli'
|
|
2
3
|
import { QueueManager } from './QueueManager.ts'
|
|
3
4
|
import type { QueueConfig, QueueConnectionConfig } from './QueueManager.ts'
|
|
4
5
|
import { SyncDriver } from './drivers/SyncDriver.ts'
|
|
@@ -10,6 +11,12 @@ import { setQueueManager, QUEUE_MANAGER } from './helpers/queue.ts'
|
|
|
10
11
|
import { setPendingDispatchResolver } from './PendingDispatch.ts'
|
|
11
12
|
import { setChainResolver } from './JobChain.ts'
|
|
12
13
|
import { setBatchResolver } from './JobBatch.ts'
|
|
14
|
+
import { Schedule } from './schedule/Schedule.ts'
|
|
15
|
+
import { QueueWorkCommand } from './commands/QueueWorkCommand.ts'
|
|
16
|
+
import { QueueRetryCommand } from './commands/QueueRetryCommand.ts'
|
|
17
|
+
import { QueueFailedCommand } from './commands/QueueFailedCommand.ts'
|
|
18
|
+
import { QueueFlushCommand } from './commands/QueueFlushCommand.ts'
|
|
19
|
+
import { ScheduleRunCommand } from './commands/ScheduleRunCommand.ts'
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
22
|
* Registers the QueueManager in the container and wires up helpers.
|
|
@@ -53,6 +60,9 @@ export class QueueServiceProvider extends ServiceProvider {
|
|
|
53
60
|
this.app.singleton(QUEUE_MANAGER as any, () => {
|
|
54
61
|
return this.app.make(QueueManager)
|
|
55
62
|
})
|
|
63
|
+
|
|
64
|
+
// Register a Schedule singleton for the schedule:run command
|
|
65
|
+
this.app.singleton(Schedule, () => new Schedule())
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
override boot(): void {
|
|
@@ -65,6 +75,18 @@ export class QueueServiceProvider extends ServiceProvider {
|
|
|
65
75
|
} catch {
|
|
66
76
|
// Events package not installed — fine, events are optional
|
|
67
77
|
}
|
|
78
|
+
|
|
79
|
+
// Register queue CLI commands via the CommandRegistry
|
|
80
|
+
const manager = this.app.make(QueueManager) as QueueManager
|
|
81
|
+
const schedule = this.app.make(Schedule) as Schedule
|
|
82
|
+
|
|
83
|
+
registerCommands([
|
|
84
|
+
new QueueWorkCommand(manager),
|
|
85
|
+
new QueueRetryCommand(manager),
|
|
86
|
+
new QueueFailedCommand(manager),
|
|
87
|
+
new QueueFlushCommand(manager),
|
|
88
|
+
new ScheduleRunCommand(schedule),
|
|
89
|
+
])
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
|
package/src/types.d.ts
ADDED