@zizq-labs/zizq 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 +21 -0
- package/README.md +86 -0
- package/dist/client.d.ts +747 -0
- package/dist/client.js +902 -0
- package/dist/enqueue.d.ts +119 -0
- package/dist/enqueue.js +110 -0
- package/dist/handler.d.ts +179 -0
- package/dist/handler.js +45 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -0
- package/dist/query.d.ts +372 -0
- package/dist/query.js +653 -0
- package/dist/resources.d.ts +281 -0
- package/dist/resources.js +319 -0
- package/dist/unique-key.d.ts +58 -0
- package/dist/unique-key.js +122 -0
- package/dist/worker.d.ts +307 -0
- package/dist/worker.js +396 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chris Corbyn <chris@zizq.io>
|
|
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,86 @@
|
|
|
1
|
+
# Zizq — Official Node.js Client
|
|
2
|
+
|
|
3
|
+
Zizq is a simple, zero dependency, single binary job queue system that is both
|
|
4
|
+
fast and durable. It is designed to work in any stack through a simple HTTP
|
|
5
|
+
API.
|
|
6
|
+
|
|
7
|
+
This is the official Zizq client library for Node.js, written in TypeScript.
|
|
8
|
+
|
|
9
|
+
[](https://github.com/zizq-labs/zizq-node/actions/workflows/ci.yml)
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* Concurrent async-based worker
|
|
14
|
+
* Enqueue and process jobs from one language to another
|
|
15
|
+
* Arbitrary named queues
|
|
16
|
+
* Granular job priorities
|
|
17
|
+
* Scheduled jobs
|
|
18
|
+
* Configurable backoff policies
|
|
19
|
+
* Configurable job retention policies
|
|
20
|
+
* Job introspection and management APIs, with support for `jq` query filters
|
|
21
|
+
* Unique jobs
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
> [!TIP]
|
|
26
|
+
> There is also a composable function-based convenience wrapper available. Read
|
|
27
|
+
> the documentation on
|
|
28
|
+
> [Handler Functions](https://zizq.io/docs/clients/node/handlers.html) for more
|
|
29
|
+
> info
|
|
30
|
+
|
|
31
|
+
Enqueueing a job.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { Client, enqueue } from "@zizq-labs/zizq";
|
|
35
|
+
|
|
36
|
+
const client = new Client({ url: "http://localhost:7890" });
|
|
37
|
+
|
|
38
|
+
await enqueue(client, {
|
|
39
|
+
type: "send_email",
|
|
40
|
+
queue: "emails",
|
|
41
|
+
payload: { to: "user@example.com" },
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A very basic worker with a custom handler.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { Client, Worker } from "@zizq-labs/zizq";
|
|
49
|
+
|
|
50
|
+
const client = new Client({ url: "http://localhost:7890" });
|
|
51
|
+
|
|
52
|
+
const worker = new Worker({
|
|
53
|
+
client,
|
|
54
|
+
concurrency: 25,
|
|
55
|
+
queues: ["emails"],
|
|
56
|
+
handler: async (job) => {
|
|
57
|
+
switch (job.type) {
|
|
58
|
+
case "send_email":
|
|
59
|
+
console.log(`sending email using payload ${JSON.stringify(job.payload)}`);
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
throw new Error(`unknown job type: ${job.type}`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
process.on("SIGINT", () => worker.stop());
|
|
68
|
+
process.on("SIGTERM", () => worker.stop());
|
|
69
|
+
|
|
70
|
+
await worker.run();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Resources
|
|
74
|
+
|
|
75
|
+
* [Node.js Client Docs](https://zizq.io/docs/clients/node/)
|
|
76
|
+
* [Getting Started Docs](https://zizq.io/docs/getting-started/)
|
|
77
|
+
* [Zizq Command Reference](https://zizq.io/docs/cli/)
|
|
78
|
+
* [Zizq Node.js Client Source](https://github.com/zizq-labs/zizq-node)
|
|
79
|
+
* [Zizq Source](https://github.com/zizq-labs/zizq)
|
|
80
|
+
|
|
81
|
+
## Support & Feedback
|
|
82
|
+
|
|
83
|
+
If you need help using Zizq,
|
|
84
|
+
[create an issue](https://github.com/zizq-labs/zizq-node/issues) on the
|
|
85
|
+
[zizq-node](https://github.com/zizq-labs/zizq-node) repo. Feedback is very
|
|
86
|
+
welcome.
|