@mantiq/queue 0.1.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantiq/queue",
3
- "version": "0.1.3",
3
+ "version": "0.2.0-rc.2",
4
4
  "description": "Job dispatching, workers, retry logic",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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
@@ -0,0 +1,4 @@
1
+ // Optional peer dependencies
2
+ declare module 'ioredis' { const x: any; export = x; export default x; }
3
+ declare module '@aws-sdk/client-sqs' { const x: any; export = x; export default x; }
4
+ declare module 'kafkajs' { const x: any; export = x; export default x; }