@nicnocquee/dataqueue 1.24.0 → 1.26.0-beta.20260223195940

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 (72) hide show
  1. package/README.md +44 -0
  2. package/ai/build-docs-content.ts +96 -0
  3. package/ai/build-llms-full.ts +42 -0
  4. package/ai/docs-content.json +278 -0
  5. package/ai/rules/advanced.md +132 -0
  6. package/ai/rules/basic.md +159 -0
  7. package/ai/rules/react-dashboard.md +83 -0
  8. package/ai/skills/dataqueue-advanced/SKILL.md +320 -0
  9. package/ai/skills/dataqueue-core/SKILL.md +234 -0
  10. package/ai/skills/dataqueue-react/SKILL.md +189 -0
  11. package/dist/cli.cjs +1149 -14
  12. package/dist/cli.cjs.map +1 -1
  13. package/dist/cli.d.cts +66 -1
  14. package/dist/cli.d.ts +66 -1
  15. package/dist/cli.js +1146 -13
  16. package/dist/cli.js.map +1 -1
  17. package/dist/index.cjs +4630 -928
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1033 -15
  20. package/dist/index.d.ts +1033 -15
  21. package/dist/index.js +4626 -929
  22. package/dist/index.js.map +1 -1
  23. package/dist/mcp-server.cjs +186 -0
  24. package/dist/mcp-server.cjs.map +1 -0
  25. package/dist/mcp-server.d.cts +32 -0
  26. package/dist/mcp-server.d.ts +32 -0
  27. package/dist/mcp-server.js +175 -0
  28. package/dist/mcp-server.js.map +1 -0
  29. package/migrations/1751131910825_add_timeout_seconds_to_job_queue.sql +2 -2
  30. package/migrations/1751186053000_add_job_events_table.sql +12 -8
  31. package/migrations/1751984773000_add_tags_to_job_queue.sql +1 -1
  32. package/migrations/1765809419000_add_force_kill_on_timeout_to_job_queue.sql +1 -1
  33. package/migrations/1771100000000_add_idempotency_key_to_job_queue.sql +7 -0
  34. package/migrations/1781200000000_add_wait_support.sql +12 -0
  35. package/migrations/1781200000001_create_waitpoints_table.sql +18 -0
  36. package/migrations/1781200000002_add_performance_indexes.sql +34 -0
  37. package/migrations/1781200000003_add_progress_to_job_queue.sql +7 -0
  38. package/migrations/1781200000004_create_cron_schedules_table.sql +33 -0
  39. package/migrations/1781200000005_add_retry_config_to_job_queue.sql +17 -0
  40. package/package.json +40 -23
  41. package/src/backend.ts +328 -0
  42. package/src/backends/postgres.ts +2040 -0
  43. package/src/backends/redis-scripts.ts +865 -0
  44. package/src/backends/redis.test.ts +1906 -0
  45. package/src/backends/redis.ts +1792 -0
  46. package/src/cli.test.ts +82 -6
  47. package/src/cli.ts +73 -10
  48. package/src/cron.test.ts +126 -0
  49. package/src/cron.ts +40 -0
  50. package/src/db-util.ts +4 -2
  51. package/src/index.test.ts +688 -1
  52. package/src/index.ts +277 -39
  53. package/src/init-command.test.ts +449 -0
  54. package/src/init-command.ts +709 -0
  55. package/src/install-mcp-command.test.ts +216 -0
  56. package/src/install-mcp-command.ts +185 -0
  57. package/src/install-rules-command.test.ts +218 -0
  58. package/src/install-rules-command.ts +233 -0
  59. package/src/install-skills-command.test.ts +176 -0
  60. package/src/install-skills-command.ts +124 -0
  61. package/src/mcp-server.test.ts +162 -0
  62. package/src/mcp-server.ts +231 -0
  63. package/src/processor.test.ts +559 -18
  64. package/src/processor.ts +456 -49
  65. package/src/queue.test.ts +682 -6
  66. package/src/queue.ts +135 -944
  67. package/src/supervisor.test.ts +340 -0
  68. package/src/supervisor.ts +162 -0
  69. package/src/test-util.ts +32 -0
  70. package/src/types.ts +726 -17
  71. package/src/wait.test.ts +698 -0
  72. package/LICENSE +0 -21
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)
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Build script that reads all MDX documentation files, strips MDX-specific
3
+ * components, and outputs a JSON file for the MCP server to search.
4
+ *
5
+ * Usage: npx tsx ai/build-docs-content.ts
6
+ */
7
+
8
+ import fs from 'node:fs';
9
+ import path from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+
15
+ interface DocPage {
16
+ slug: string;
17
+ title: string;
18
+ description: string;
19
+ content: string;
20
+ }
21
+
22
+ const DOCS_DIR = path.resolve(__dirname, '../../../apps/docs/content/docs');
23
+ const OUTPUT_FILE = path.resolve(__dirname, 'docs-content.json');
24
+
25
+ function extractFrontmatter(raw: string): {
26
+ title: string;
27
+ description: string;
28
+ body: string;
29
+ } {
30
+ const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
31
+ if (!match) return { title: '', description: '', body: raw };
32
+
33
+ const fm = match[1];
34
+ const body = match[2];
35
+
36
+ const titleMatch = fm.match(/^title:\s*(.+)$/m);
37
+ const descMatch = fm.match(/^description:\s*(.+)$/m);
38
+
39
+ return {
40
+ title: titleMatch ? titleMatch[1].trim() : '',
41
+ description: descMatch ? descMatch[1].trim() : '',
42
+ body,
43
+ };
44
+ }
45
+
46
+ function stripMdxComponents(content: string): string {
47
+ return (
48
+ content
49
+ .replace(/<Callout[^>]*>\s*/g, '> **Note:** ')
50
+ .replace(/<\/Callout>\s*/g, '\n')
51
+ .replace(/<Steps>|<\/Steps>/g, '')
52
+ .replace(/<Step[^>]*>/g, '')
53
+ .replace(/<\/Step>/g, '')
54
+ .replace(/!\[.*?\]\(\/[^)]+\)/g, '')
55
+ // Strip code annotations like [!code highlight] and [!code highlight:N]
56
+ .replace(/\s*\/\/\s*\[!code\s+highlight(?::\d+)?\]\s*/g, '')
57
+ .replace(/```package-install\n/g, '```bash\n')
58
+ .trim()
59
+ );
60
+ }
61
+
62
+ function collectMdxFiles(dir: string, prefix = ''): DocPage[] {
63
+ const pages: DocPage[] = [];
64
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
65
+
66
+ for (const entry of entries) {
67
+ if (entry.isDirectory()) {
68
+ pages.push(
69
+ ...collectMdxFiles(
70
+ path.join(dir, entry.name),
71
+ `${prefix}${entry.name}/`,
72
+ ),
73
+ );
74
+ } else if (entry.name.endsWith('.mdx')) {
75
+ const raw = fs.readFileSync(path.join(dir, entry.name), 'utf-8');
76
+ const { title, description, body } = extractFrontmatter(raw);
77
+ const slug =
78
+ entry.name === 'index.mdx'
79
+ ? prefix.replace(/\/$/, '') || 'index'
80
+ : `${prefix}${entry.name.replace(/\.mdx$/, '')}`;
81
+
82
+ pages.push({
83
+ slug,
84
+ title,
85
+ description,
86
+ content: stripMdxComponents(body),
87
+ });
88
+ }
89
+ }
90
+
91
+ return pages;
92
+ }
93
+
94
+ const pages = collectMdxFiles(DOCS_DIR);
95
+ fs.writeFileSync(OUTPUT_FILE, JSON.stringify(pages, null, 2));
96
+ console.log(`Built ${pages.length} doc pages to ${OUTPUT_FILE}`);
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Generates llms-full.txt from docs-content.json — a single concatenated file
3
+ * of all documentation, suitable for feeding into an LLM context window.
4
+ *
5
+ * Usage: npx tsx ai/build-llms-full.ts
6
+ */
7
+
8
+ import fs from 'node:fs';
9
+ import path from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+
15
+ interface DocPage {
16
+ slug: string;
17
+ title: string;
18
+ description: string;
19
+ content: string;
20
+ }
21
+
22
+ const INPUT = path.resolve(__dirname, 'docs-content.json');
23
+ const OUTPUT = path.resolve(
24
+ __dirname,
25
+ '../../../apps/docs/public/llms-full.txt',
26
+ );
27
+
28
+ const pages: DocPage[] = JSON.parse(fs.readFileSync(INPUT, 'utf-8'));
29
+
30
+ const sections = pages.map((page) => {
31
+ const header = page.description
32
+ ? `# ${page.title}\n\n> ${page.description}`
33
+ : `# ${page.title}`;
34
+ return `${header}\n\nSlug: ${page.slug}\n\n${page.content}`;
35
+ });
36
+
37
+ const output = `# DataQueue — Full Documentation\n\n${sections.join('\n\n---\n\n')}\n`;
38
+
39
+ fs.writeFileSync(OUTPUT, output);
40
+ console.log(
41
+ `Built llms-full.txt (${pages.length} pages, ${output.length} chars)`,
42
+ );