@wild-framework/queue 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Wild Framework contributors
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,28 @@
1
+ # @wild-framework/queue
2
+
3
+ Job queue abstraction for [Wild Framework](https://github.com/your-org/wild-framework).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @wild-framework/queue
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { Queue } from "@wild-framework/queue";
15
+
16
+ class SendEmailJob {
17
+ constructor(private mail: MailService) {}
18
+ async handle(payload: { to: string }) {
19
+ await this.mail.send(payload.to);
20
+ }
21
+ }
22
+
23
+ await queue.dispatch(SendEmailJob, { to: "user@example.com" });
24
+ ```
25
+
26
+ ## License
27
+
28
+ MIT
@@ -0,0 +1,4 @@
1
+ export { QueueProvider } from "./provider.js";
2
+ export { Queue } from "./queue.js";
3
+ export type { Job, JobConstructor } from "./queue.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { QueueProvider } from "./provider.js";
2
+ export { Queue } from "./queue.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Provider, Application } from "@wild-framework/core";
2
+ /**
3
+ * Registers the queue with the application.
4
+ *
5
+ * Binds an in-process `Queue` into the container. Swap for a
6
+ * distributed queue (e.g. BullMQ) by replacing this provider —
7
+ * the dispatch API stays the same.
8
+ */
9
+ export declare class QueueProvider implements Provider {
10
+ register(app: Application): void;
11
+ }
12
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIlE;;;;;;GAMG;AACH,qBAAa,aAAc,YAAW,QAAQ;IAC1C,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;CAKnC"}
@@ -0,0 +1,17 @@
1
+ import { Container } from "@wild-framework/container";
2
+ import { Queue } from "./queue.js";
3
+ /**
4
+ * Registers the queue with the application.
5
+ *
6
+ * Binds an in-process `Queue` into the container. Swap for a
7
+ * distributed queue (e.g. BullMQ) by replacing this provider —
8
+ * the dispatch API stays the same.
9
+ */
10
+ export class QueueProvider {
11
+ register(app) {
12
+ const container = app.resolve(Container);
13
+ const queue = new Queue(container);
14
+ container.singleton(Queue, () => queue);
15
+ }
16
+ }
17
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,aAAa;IACtB,QAAQ,CAAC,GAAgB;QACrB,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;QACnC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACJ"}
@@ -0,0 +1,36 @@
1
+ import { Container } from "@wild-framework/container";
2
+ /**
3
+ * A job that can be queued.
4
+ *
5
+ * Jobs are classes with a `handle()` method. The job class is resolved
6
+ * from the container (constructor DI), and `handle()` receives the
7
+ * dispatch payload.
8
+ */
9
+ export interface Job<TPayload = unknown> {
10
+ handle(payload: TPayload): void | Promise<void>;
11
+ }
12
+ /**
13
+ * A job class constructor.
14
+ */
15
+ export type JobConstructor<TPayload = unknown> = new () => Job<TPayload>;
16
+ /**
17
+ * Queue.
18
+ *
19
+ * Currently an in-process queue — jobs are resolved from the container
20
+ * (so they get DI) and processed immediately on dispatch.
21
+ *
22
+ * Swapping to a distributed queue (e.g. BullMQ) later means replacing
23
+ * this implementation in QueueProvider — the dispatch API stays the same.
24
+ */
25
+ export declare class Queue {
26
+ private container;
27
+ constructor(container: Container);
28
+ /**
29
+ * Dispatch a job with a payload.
30
+ *
31
+ * The job class is resolved from the container, then `handle(payload)`
32
+ * is called. Errors from the job propagate to the caller.
33
+ */
34
+ dispatch<TPayload>(job: JobConstructor<TPayload>, payload: TPayload): Promise<void>;
35
+ }
36
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,QAAQ,GAAG,OAAO;IACnC,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,GAAG,OAAO,IAAI,UAAU,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,qBAAa,KAAK;IACF,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAExC;;;;;OAKG;IACG,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAI5F"}
package/dist/queue.js ADDED
@@ -0,0 +1,27 @@
1
+ import { Container } from "@wild-framework/container";
2
+ /**
3
+ * Queue.
4
+ *
5
+ * Currently an in-process queue — jobs are resolved from the container
6
+ * (so they get DI) and processed immediately on dispatch.
7
+ *
8
+ * Swapping to a distributed queue (e.g. BullMQ) later means replacing
9
+ * this implementation in QueueProvider — the dispatch API stays the same.
10
+ */
11
+ export class Queue {
12
+ container;
13
+ constructor(container) {
14
+ this.container = container;
15
+ }
16
+ /**
17
+ * Dispatch a job with a payload.
18
+ *
19
+ * The job class is resolved from the container, then `handle(payload)`
20
+ * is called. Errors from the job propagate to the caller.
21
+ */
22
+ async dispatch(job, payload) {
23
+ const instance = this.container.resolve(job);
24
+ await instance.handle(payload);
25
+ }
26
+ }
27
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAkBtD;;;;;;;;GAQG;AACH,MAAM,OAAO,KAAK;IACM;IAApB,YAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE5C;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAW,GAA6B,EAAE,OAAiB;QACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAgB,GAAG,CAAC,CAAC;QAC5D,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACJ"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@wild-framework/queue",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Sphah",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/KhandaSoftware/wild-framework.git"
24
+ },
25
+ "description": "Job queue abstraction for Wild Framework.",
26
+ "keywords": [
27
+ "wild",
28
+ "framework",
29
+ "queue",
30
+ "jobs",
31
+ "worker"
32
+ ],
33
+ "dependencies": {
34
+ "@wild-framework/core": "0.1.0",
35
+ "@wild-framework/container": "0.1.0"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc",
39
+ "clean": "rm -rf dist",
40
+ "test": "vitest run"
41
+ }
42
+ }