@nicnocquee/dataqueue 1.22.0 → 1.25.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.
Files changed (34) hide show
  1. package/README.md +44 -0
  2. package/dist/index.cjs +2822 -583
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +589 -12
  5. package/dist/index.d.ts +589 -12
  6. package/dist/index.js +2818 -584
  7. package/dist/index.js.map +1 -1
  8. package/migrations/1751131910825_add_timeout_seconds_to_job_queue.sql +2 -2
  9. package/migrations/1751186053000_add_job_events_table.sql +12 -8
  10. package/migrations/1751984773000_add_tags_to_job_queue.sql +1 -1
  11. package/migrations/1765809419000_add_force_kill_on_timeout_to_job_queue.sql +6 -0
  12. package/migrations/1771100000000_add_idempotency_key_to_job_queue.sql +7 -0
  13. package/migrations/1781200000000_add_wait_support.sql +12 -0
  14. package/migrations/1781200000001_create_waitpoints_table.sql +18 -0
  15. package/migrations/1781200000002_add_performance_indexes.sql +34 -0
  16. package/migrations/1781200000003_add_progress_to_job_queue.sql +7 -0
  17. package/package.json +20 -6
  18. package/src/backend.ts +163 -0
  19. package/src/backends/postgres.ts +1111 -0
  20. package/src/backends/redis-scripts.ts +533 -0
  21. package/src/backends/redis.test.ts +543 -0
  22. package/src/backends/redis.ts +834 -0
  23. package/src/db-util.ts +4 -2
  24. package/src/handler-validation.test.ts +414 -0
  25. package/src/handler-validation.ts +168 -0
  26. package/src/index.test.ts +230 -1
  27. package/src/index.ts +128 -32
  28. package/src/processor.test.ts +612 -16
  29. package/src/processor.ts +759 -47
  30. package/src/queue.test.ts +736 -3
  31. package/src/queue.ts +346 -660
  32. package/src/test-util.ts +32 -0
  33. package/src/types.ts +451 -16
  34. package/src/wait.test.ts +698 -0
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # DataQueue
2
+
3
+ A lightweight job queue backed by PostgreSQL or Redis.
4
+
5
+ - [Website](https://dataqueue.dev)
6
+ - [Documentation](https://docs.dataqueue.dev)
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @nicnocquee/dataqueue
12
+ ```
13
+
14
+ ## Testing
15
+
16
+ First, run the following command to start the PostgreSQL and Redis containers:
17
+
18
+ ```bash
19
+ docker-compose up
20
+ ```
21
+
22
+ Then, run the tests:
23
+
24
+ ```bash
25
+ pnpm run test
26
+ ```
27
+
28
+ For E2E tests, run the following command:
29
+
30
+ ```bash
31
+ # First time: create DB and run migrations
32
+ PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c "CREATE DATABASE e2e_test;"
33
+ cd apps/e2e && PG_DATAQUEUE_DATABASE=postgres://postgres:postgres@localhost:5432/e2e_test pnpm run migrate-dataqueue
34
+ # Run tests
35
+ pnpm test:e2e
36
+ ```
37
+
38
+ ## License
39
+
40
+ MIT
41
+
42
+ ## Author
43
+
44
+ [Nico Prananta](https://nico.fyi)