bunqueue-dashboard 0.0.41 → 0.0.43

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 (74) hide show
  1. package/README.md +11 -8
  2. package/agent/backup/resultValidation.ts +1 -1
  3. package/agent/flow/routes.ts +2 -0
  4. package/agent/flow/service.ts +7 -2
  5. package/agent/managedConnection.ts +35 -0
  6. package/agent/manager/config.ts +1 -1
  7. package/agent/queue/routes.ts +33 -3
  8. package/agent/queue/runtime.ts +51 -5
  9. package/agent/queue/types.ts +16 -1
  10. package/agent/queue/validation.ts +8 -0
  11. package/agent/workflow/runtime.ts +2 -6
  12. package/agent/workflow/runtimeConfig.ts +2 -2
  13. package/agent/workflows.ts +1 -1
  14. package/dist/.vite/manifest.json +130 -127
  15. package/dist/assets/AddJob-FNaPbs_V.js +3 -0
  16. package/dist/assets/{Alerts-CYwfGLSQ.js → Alerts-C961Al5D.js} +1 -1
  17. package/dist/assets/{Benchmark-BINaJvak.js → Benchmark-DQNZV7dM.js} +1 -1
  18. package/dist/assets/BulkAddJobs-IiL1uud0.js +5 -0
  19. package/dist/assets/{CopilotPanel-DjHfX9ta.js → CopilotPanel-Dlm8XwBj.js} +1 -1
  20. package/dist/assets/{Cron-CSoEPVeq.js → Cron-1DZTZWXO.js} +1 -1
  21. package/dist/assets/{CronManager-s4xjNhGD.js → CronManager-B6xLLgI5.js} +1 -1
  22. package/dist/assets/{Database-x6iWCu3-.js → Database-DGM2BIHy.js} +1 -1
  23. package/dist/assets/{Diagnostics-DFshXeHl.js → Diagnostics-_Sh3UyaT.js} +1 -1
  24. package/dist/assets/{Dlq-Cayt1PEN.js → Dlq-mtInIoTh.js} +1 -1
  25. package/dist/assets/{DlqControl-BBQc6uu9.js → DlqControl-Lq9ISb9b.js} +1 -1
  26. package/dist/assets/{DlqPro-BmrnGQ-3.js → DlqPro-0_75vrd1.js} +1 -1
  27. package/dist/assets/Flows-CE7KzaFN.js +2 -0
  28. package/dist/assets/{JobInspector-BMjVR96H.js → JobInspector-DyWZk1eW.js} +2 -2
  29. package/dist/assets/{Jobs-NN0fJ3BQ.js → Jobs-ELSH1Wbd.js} +1 -1
  30. package/dist/assets/JobsPro-BlWwDeFN.js +1 -0
  31. package/dist/assets/{Logs-BGeTppXO.js → Logs-DMukqmHy.js} +1 -1
  32. package/dist/assets/{LogsPro-D7vvgZmb.js → LogsPro-BfYbmZHi.js} +1 -1
  33. package/dist/assets/{McpServer-AsaFGnYZ.js → McpServer-DNrOEp9j.js} +2 -2
  34. package/dist/assets/{Metrics-CvoY4uhX.js → Metrics-Cm5ZvfTo.js} +1 -1
  35. package/dist/assets/{MetricsPro-C01FjqvR.js → MetricsPro-C9g1sp-u.js} +1 -1
  36. package/dist/assets/{Overview-WStfS5ee.js → Overview-CKAA3h9f.js} +1 -1
  37. package/dist/assets/{QueueActions-D51CYOjo.js → QueueActions-BWnmNEqV.js} +1 -1
  38. package/dist/assets/QueueControl-Bvm8GUQa.js +1 -0
  39. package/dist/assets/{QueueDetail-D5TKm4bv.js → QueueDetail-BRDATlp0.js} +1 -1
  40. package/dist/assets/{QueueDetailPro-CFNQcKho.js → QueueDetailPro-Dkz4-1wn.js} +1 -1
  41. package/dist/assets/{Queues-DlznHsfh.js → Queues-BV99vr68.js} +1 -1
  42. package/dist/assets/{QueuesOverview-DGtapyV0.js → QueuesOverview-CT6JBaim.js} +1 -1
  43. package/dist/assets/{S3Backup-CxwbLJGK.js → S3Backup-DNABHR2Q.js} +1 -1
  44. package/dist/assets/{S3BackupPro-8y0J0-3_.js → S3BackupPro-CjR0y18n.js} +3 -3
  45. package/dist/assets/{ServerControl-DpE7t-OF.js → ServerControl-BH6Doax0.js} +1 -1
  46. package/dist/assets/{Settings-Bw5MtDTF.js → Settings-CL7odwoU.js} +1 -1
  47. package/dist/assets/{Usage-DpShi3FE.js → Usage-BWZkz7Se.js} +1 -1
  48. package/dist/assets/{UsagePro-D4cGbozz.js → UsagePro-CoBbI-Cl.js} +1 -1
  49. package/dist/assets/{Webhooks-UYiTg6hn.js → Webhooks-DT2LK17V.js} +1 -1
  50. package/dist/assets/{Workers-D70B_uAI.js → Workers-CBEDvXm_.js} +1 -1
  51. package/dist/assets/{WorkersPro-YycNhm9w.js → WorkersPro-Dk4NfplT.js} +1 -1
  52. package/dist/assets/{Workflows-BxlrgGEB.js → Workflows-DZZA6aGW.js} +1 -1
  53. package/dist/assets/{api-BAGaBh6R.js → api-BgWE-705.js} +1 -1
  54. package/dist/assets/bq-F5BbTG1T.js +1 -0
  55. package/dist/assets/{flowMutationSafety-DSd3JLAV.js → flowMutationSafety-YKTHxqKv.js} +1 -1
  56. package/dist/assets/flowOperationPolicy-B2Etcb3f.js +1 -0
  57. package/dist/assets/{index-ByvrmBif.js → index-BFW2_47n.js} +3 -3
  58. package/dist/assets/{index-CxhXRVH_.css → index-C9yGKhQ8.css} +1 -1
  59. package/dist/assets/{install-C5y2ohOo.js → install-oydLpc1T.js} +2 -2
  60. package/dist/assets/responses-BkR2JTH9.js +1 -0
  61. package/dist/assets/{upstreamPaths-B_cyinGI.js → upstreamPaths-DQeKSxGc.js} +1 -1
  62. package/dist/assets/{useThroughputSeries-Cagm3qzB.js → useThroughputSeries-DgO8uicf.js} +1 -1
  63. package/dist/index.html +5 -5
  64. package/package.json +11 -5
  65. package/scripts/embedded.gen.ts +164 -164
  66. package/shared/flowOperationPolicy.ts +66 -0
  67. package/dist/assets/AddJob-CFnESFEU.js +0 -3
  68. package/dist/assets/BulkAddJobs-vyGFvlO3.js +0 -5
  69. package/dist/assets/Flows-CcNdf_jS.js +0 -2
  70. package/dist/assets/JobsPro-D_l1c80Q.js +0 -1
  71. package/dist/assets/QueueControl-Ce-O1L4p.js +0 -1
  72. package/dist/assets/bq-Qh0VFLKV.js +0 -1
  73. package/dist/assets/jobActions-LQD4KfCc.js +0 -1
  74. package/dist/assets/responses-DiIfPXXq.js +0 -1
package/dist/index.html CHANGED
@@ -49,15 +49,15 @@
49
49
  content="Fully drive a bunqueue server from one UI: queues, jobs, DLQ, cron, webhooks, workers, and start/stop/restart. Live demo, no signup."
50
50
  />
51
51
  <meta name="twitter:image" content="https://egeominotti.github.io/bunqueue-dashboard/og.png" />
52
- <script type="module" crossorigin src="./assets/index-ByvrmBif.js"></script>
52
+ <script type="module" crossorigin src="./assets/index-BFW2_47n.js"></script>
53
53
  <link rel="modulepreload" crossorigin href="./assets/cn-zFEt5SO8.js">
54
54
  <link rel="modulepreload" crossorigin href="./assets/react-vendor-CvwrP0tU.js">
55
55
  <link rel="modulepreload" crossorigin href="./assets/connectionStore-BJLihGaC.js">
56
- <link rel="modulepreload" crossorigin href="./assets/upstreamPaths-B_cyinGI.js">
57
- <link rel="modulepreload" crossorigin href="./assets/bq-Qh0VFLKV.js">
56
+ <link rel="modulepreload" crossorigin href="./assets/upstreamPaths-DQeKSxGc.js">
57
+ <link rel="modulepreload" crossorigin href="./assets/bq-F5BbTG1T.js">
58
58
  <link rel="modulepreload" crossorigin href="./assets/toastStore-IZn6OPLZ.js">
59
59
  <link rel="modulepreload" crossorigin href="./assets/icons-BVzwsfbG.js">
60
- <link rel="modulepreload" crossorigin href="./assets/api-BAGaBh6R.js">
60
+ <link rel="modulepreload" crossorigin href="./assets/api-BgWE-705.js">
61
61
  <link rel="modulepreload" crossorigin href="./assets/usePolledData-0CVelkl2.js">
62
62
  <link rel="modulepreload" crossorigin href="./assets/Button-Ch1W94fJ.js">
63
63
  <link rel="modulepreload" crossorigin href="./assets/Card-CWxrC8OY.js">
@@ -65,7 +65,7 @@
65
65
  <link rel="modulepreload" crossorigin href="./assets/StatusBadge-BoOVTnKu.js">
66
66
  <link rel="modulepreload" crossorigin href="./assets/PageHeader-CvIyaFOO.js">
67
67
  <link rel="modulepreload" crossorigin href="./assets/format-Cg7VCIZW.js">
68
- <link rel="stylesheet" crossorigin href="./assets/index-CxhXRVH_.css">
68
+ <link rel="stylesheet" crossorigin href="./assets/index-C9yGKhQ8.css">
69
69
  </head>
70
70
  <body>
71
71
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunqueue-dashboard",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "type": "module",
5
5
  "description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun 1.4.0).",
6
6
  "packageManager": "bun@1.4.0",
@@ -14,7 +14,8 @@
14
14
  "scripts/servePolicy.ts",
15
15
  "scripts/bunVersion.ts",
16
16
  "scripts/embedded.gen.ts",
17
- "agent"
17
+ "agent",
18
+ "shared"
18
19
  ],
19
20
  "publishConfig": {
20
21
  "access": "public"
@@ -55,8 +56,9 @@
55
56
  "dev": "vite",
56
57
  "agent": "bun run agent/index.ts",
57
58
  "build": "bun run typecheck && vite build",
58
- "typecheck": "tsc --noEmit && bun run typecheck:agent",
59
+ "typecheck": "tsc --noEmit && bun run typecheck:agent && bun run typecheck:examples",
59
60
  "typecheck:agent": "tsc -p tsconfig.agent.json",
61
+ "typecheck:examples": "tsc -p tsconfig.examples.json",
60
62
  "size": "bun run scripts/check-bundle.ts",
61
63
  "version:check": "bun run scripts/check-bun-version.ts",
62
64
  "architecture": "bun run scripts/check-file-size.ts",
@@ -68,11 +70,14 @@
68
70
  "test": "bun test",
69
71
  "test:e2e:flow": "bun run scripts/validate-flow-runtime.ts",
70
72
  "test:e2e:queue-operations": "bun run scripts/validate-queue-operations.ts",
73
+ "test:e2e:upgrade": "bun run scripts/validate-sqlite-upgrade-runtime.ts",
71
74
  "test:e2e:workflow": "bun run scripts/validate-workflow-runtime.ts",
72
75
  "test:e2e:postgres-fleet": "bun run scripts/validate-postgres-fleet-runtime.ts",
73
- "test:e2e": "bun run test:e2e:flow && bun run test:e2e:workflow && bun run test:e2e:queue-operations && bun run test:e2e:postgres-fleet",
76
+ "test:e2e:tls": "bun run scripts/validate-tls-runtime.ts",
77
+ "test:e2e": "bun run test:e2e:tls && bun run test:e2e:upgrade && bun run test:e2e:flow && bun run test:e2e:workflow && bun run test:e2e:queue-operations && bun run test:e2e:postgres-fleet",
74
78
  "test:e2e:browser:install": "playwright install chromium firefox webkit",
75
79
  "test:e2e:browser:serve": "bun e2e/runtime.ts",
80
+ "test:e2e:browser:postgres-fleet": "bun run scripts/validate-postgres-fleet-dashboard-runtime.ts",
76
81
  "test:e2e:browser": "bun run build && bun scripts/gen-embed.ts && playwright test",
77
82
  "test:package": "bun run scripts/validate-package-runtime.ts",
78
83
  "test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov --coverage-dir=coverage && bun scripts/check-coverage.ts && bun scripts/check-test-inventory.ts",
@@ -102,6 +107,7 @@
102
107
  "@vitejs/plugin-react": "^6.0.3",
103
108
  "ai": "^7.0.14",
104
109
  "bun-types": "1.4.0",
110
+ "bunqueue-v2-9-2": "npm:bunqueue@2.9.2",
105
111
  "happy-dom": "^20.10.6",
106
112
  "mermaid": "^11.16.0",
107
113
  "oxfmt": "^0.63.0",
@@ -127,7 +133,7 @@
127
133
  "postcss": "^8.5.25"
128
134
  },
129
135
  "dependencies": {
130
- "bunqueue": "2.9.2",
136
+ "bunqueue": "2.9.4",
131
137
  "msgpackr": "^1.11.8"
132
138
  }
133
139
  }
@@ -1,169 +1,169 @@
1
1
  // @ts-nocheck
2
2
  // AUTO-GENERATED by scripts/gen-embed.ts — do not edit, not committed.
3
- import f0 from "../dist/index.html" with { type: 'file' };
4
- import f1 from "../dist/favicon.svg" with { type: 'file' };
5
- import f2 from "../dist/og.png" with { type: 'file' };
6
- import f3 from "../dist/assets/usePolledData-0CVelkl2.js" with { type: 'file' };
7
- import f4 from "../dist/assets/Workflows-BxlrgGEB.js" with { type: 'file' };
8
- import f5 from "../dist/assets/QueueDetailPro-CFNQcKho.js" with { type: 'file' };
9
- import f6 from "../dist/assets/Metrics-CvoY4uhX.js" with { type: 'file' };
10
- import f7 from "../dist/assets/Diagnostics-DFshXeHl.js" with { type: 'file' };
11
- import f8 from "../dist/assets/WorkersPro-YycNhm9w.js" with { type: 'file' };
12
- import f9 from "../dist/assets/Logs-BGeTppXO.js" with { type: 'file' };
13
- import f10 from "../dist/assets/Settings-Bw5MtDTF.js" with { type: 'file' };
14
- import f11 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
15
- import f12 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
16
- import f13 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
17
- import f14 from "../dist/assets/Alerts-CYwfGLSQ.js" with { type: 'file' };
18
- import f15 from "../dist/assets/connectionStore-BJLihGaC.js" with { type: 'file' };
19
- import f16 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
20
- import f17 from "../dist/assets/Flows-CcNdf_jS.js" with { type: 'file' };
21
- import f18 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
22
- import f19 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
23
- import f20 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
24
- import f21 from "../dist/assets/Jobs-NN0fJ3BQ.js" with { type: 'file' };
25
- import f22 from "../dist/assets/QueueControl-Ce-O1L4p.js" with { type: 'file' };
26
- import f23 from "../dist/assets/index-ByvrmBif.js" with { type: 'file' };
27
- import f24 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
28
- import f25 from "../dist/assets/McpServer-AsaFGnYZ.js" with { type: 'file' };
29
- import f26 from "../dist/assets/Cron-CSoEPVeq.js" with { type: 'file' };
30
- import f27 from "../dist/assets/Queues-DlznHsfh.js" with { type: 'file' };
31
- import f28 from "../dist/assets/UsagePro-D4cGbozz.js" with { type: 'file' };
32
- import f29 from "../dist/assets/upstreamPaths-B_cyinGI.js" with { type: 'file' };
33
- import f30 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
34
- import f31 from "../dist/assets/BulkAddJobs-vyGFvlO3.js" with { type: 'file' };
35
- import f32 from "../dist/assets/responses-DiIfPXXq.js" with { type: 'file' };
36
- import f33 from "../dist/assets/api-BAGaBh6R.js" with { type: 'file' };
37
- import f34 from "../dist/assets/Benchmark-BINaJvak.js" with { type: 'file' };
38
- import f35 from "../dist/assets/controlConnectionEpoch-CZsS0wAb.js" with { type: 'file' };
39
- import f36 from "../dist/assets/AreaChart-DEAalJ6P.js" with { type: 'file' };
40
- import f37 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
41
- import f38 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
42
- import f39 from "../dist/assets/useThroughputSeries-Cagm3qzB.js" with { type: 'file' };
43
- import f40 from "../dist/assets/S3BackupPro-8y0J0-3_.js" with { type: 'file' };
44
- import f41 from "../dist/assets/DlqPro-BmrnGQ-3.js" with { type: 'file' };
45
- import f42 from "../dist/assets/dist-DpZcbP9W.js" with { type: 'file' };
46
- import f43 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
47
- import f44 from "../dist/assets/useServerActionGuard-uGePilQQ.js" with { type: 'file' };
48
- import f45 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
49
- import f46 from "../dist/assets/Fleet-Bdrj9bLI.js" with { type: 'file' };
50
- import f47 from "../dist/assets/MetricsPro-C01FjqvR.js" with { type: 'file' };
51
- import f48 from "../dist/assets/bq-Qh0VFLKV.js" with { type: 'file' };
52
- import f49 from "../dist/assets/Overview-WStfS5ee.js" with { type: 'file' };
53
- import f50 from "../dist/assets/index-CxhXRVH_.css" with { type: 'file' };
54
- import f51 from "../dist/assets/useControlActionGuard-B-bzKZKI.js" with { type: 'file' };
55
- import f52 from "../dist/assets/JobsPro-D_l1c80Q.js" with { type: 'file' };
56
- import f53 from "../dist/assets/Usage-DpShi3FE.js" with { type: 'file' };
57
- import f54 from "../dist/assets/CronManager-s4xjNhGD.js" with { type: 'file' };
58
- import f55 from "../dist/assets/install-C5y2ohOo.js" with { type: 'file' };
59
- import f56 from "../dist/assets/toastStore-IZn6OPLZ.js" with { type: 'file' };
60
- import f57 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
61
- import f58 from "../dist/assets/format-Cg7VCIZW.js" with { type: 'file' };
62
- import f59 from "../dist/assets/Database-x6iWCu3-.js" with { type: 'file' };
63
- import f60 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
64
- import f61 from "../dist/assets/QueuesOverview-DGtapyV0.js" with { type: 'file' };
65
- import f62 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
66
- import f63 from "../dist/assets/S3Backup-CxwbLJGK.js" with { type: 'file' };
67
- import f64 from "../dist/assets/DlqControl-BBQc6uu9.js" with { type: 'file' };
68
- import f65 from "../dist/assets/ServerControl-DpE7t-OF.js" with { type: 'file' };
69
- import f66 from "../dist/assets/QueueDetail-D5TKm4bv.js" with { type: 'file' };
70
- import f67 from "../dist/assets/Workers-D70B_uAI.js" with { type: 'file' };
71
- import f68 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
72
- import f69 from "../dist/assets/LogsPro-D7vvgZmb.js" with { type: 'file' };
73
- import f70 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
74
- import f71 from "../dist/assets/AddJob-CFnESFEU.js" with { type: 'file' };
75
- import f72 from "../dist/assets/Dlq-Cayt1PEN.js" with { type: 'file' };
76
- import f73 from "../dist/assets/JobInspector-BMjVR96H.js" with { type: 'file' };
77
- import f74 from "../dist/assets/Webhooks-UYiTg6hn.js" with { type: 'file' };
78
- import f75 from "../dist/assets/CopilotPanel-DjHfX9ta.js" with { type: 'file' };
79
- import f76 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
80
- import f77 from "../dist/assets/QueueActions-D51CYOjo.js" with { type: 'file' };
81
- import f78 from "../dist/assets/jobActions-LQD4KfCc.js" with { type: 'file' };
82
- import f79 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
83
- import f80 from "../dist/assets/flowMutationSafety-DSd3JLAV.js" with { type: 'file' };
84
- import f81 from "../dist/.vite/manifest.json" with { type: 'file' };
3
+ import f0 from "../dist/.vite/manifest.json" with { type: 'file' };
4
+ import f1 from "../dist/og.png" with { type: 'file' };
5
+ import f2 from "../dist/index.html" with { type: 'file' };
6
+ import f3 from "../dist/favicon.svg" with { type: 'file' };
7
+ import f4 from "../dist/assets/index-C9yGKhQ8.css" with { type: 'file' };
8
+ import f5 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
9
+ import f6 from "../dist/assets/useThroughputSeries-DgO8uicf.js" with { type: 'file' };
10
+ import f7 from "../dist/assets/AddJob-FNaPbs_V.js" with { type: 'file' };
11
+ import f8 from "../dist/assets/AreaChart-DEAalJ6P.js" with { type: 'file' };
12
+ import f9 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
13
+ import f10 from "../dist/assets/Alerts-C961Al5D.js" with { type: 'file' };
14
+ import f11 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
15
+ import f12 from "../dist/assets/WorkersPro-Dk4NfplT.js" with { type: 'file' };
16
+ import f13 from "../dist/assets/QueueDetail-BRDATlp0.js" with { type: 'file' };
17
+ import f14 from "../dist/assets/Dlq-mtInIoTh.js" with { type: 'file' };
18
+ import f15 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
19
+ import f16 from "../dist/assets/JobInspector-DyWZk1eW.js" with { type: 'file' };
20
+ import f17 from "../dist/assets/Workers-CBEDvXm_.js" with { type: 'file' };
21
+ import f18 from "../dist/assets/CopilotPanel-Dlm8XwBj.js" with { type: 'file' };
22
+ import f19 from "../dist/assets/Flows-CE7KzaFN.js" with { type: 'file' };
23
+ import f20 from "../dist/assets/JobsPro-BlWwDeFN.js" with { type: 'file' };
24
+ import f21 from "../dist/assets/McpServer-DNrOEp9j.js" with { type: 'file' };
25
+ import f22 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
26
+ import f23 from "../dist/assets/S3BackupPro-CjR0y18n.js" with { type: 'file' };
27
+ import f24 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
28
+ import f25 from "../dist/assets/useServerActionGuard-uGePilQQ.js" with { type: 'file' };
29
+ import f26 from "../dist/assets/install-oydLpc1T.js" with { type: 'file' };
30
+ import f27 from "../dist/assets/useControlActionGuard-B-bzKZKI.js" with { type: 'file' };
31
+ import f28 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
32
+ import f29 from "../dist/assets/QueueControl-Bvm8GUQa.js" with { type: 'file' };
33
+ import f30 from "../dist/assets/Fleet-Bdrj9bLI.js" with { type: 'file' };
34
+ import f31 from "../dist/assets/Overview-CKAA3h9f.js" with { type: 'file' };
35
+ import f32 from "../dist/assets/Metrics-Cm5ZvfTo.js" with { type: 'file' };
36
+ import f33 from "../dist/assets/ServerControl-BH6Doax0.js" with { type: 'file' };
37
+ import f34 from "../dist/assets/Queues-BV99vr68.js" with { type: 'file' };
38
+ import f35 from "../dist/assets/MetricsPro-C9g1sp-u.js" with { type: 'file' };
39
+ import f36 from "../dist/assets/connectionStore-BJLihGaC.js" with { type: 'file' };
40
+ import f37 from "../dist/assets/usePolledData-0CVelkl2.js" with { type: 'file' };
41
+ import f38 from "../dist/assets/api-BgWE-705.js" with { type: 'file' };
42
+ import f39 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
43
+ import f40 from "../dist/assets/DlqPro-0_75vrd1.js" with { type: 'file' };
44
+ import f41 from "../dist/assets/Workflows-DZZA6aGW.js" with { type: 'file' };
45
+ import f42 from "../dist/assets/format-Cg7VCIZW.js" with { type: 'file' };
46
+ import f43 from "../dist/assets/Jobs-ELSH1Wbd.js" with { type: 'file' };
47
+ import f44 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
48
+ import f45 from "../dist/assets/BulkAddJobs-IiL1uud0.js" with { type: 'file' };
49
+ import f46 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
50
+ import f47 from "../dist/assets/flowMutationSafety-YKTHxqKv.js" with { type: 'file' };
51
+ import f48 from "../dist/assets/upstreamPaths-DQeKSxGc.js" with { type: 'file' };
52
+ import f49 from "../dist/assets/Usage-BWZkz7Se.js" with { type: 'file' };
53
+ import f50 from "../dist/assets/Settings-CL7odwoU.js" with { type: 'file' };
54
+ import f51 from "../dist/assets/LogsPro-BfYbmZHi.js" with { type: 'file' };
55
+ import f52 from "../dist/assets/Webhooks-DT2LK17V.js" with { type: 'file' };
56
+ import f53 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
57
+ import f54 from "../dist/assets/S3Backup-DNABHR2Q.js" with { type: 'file' };
58
+ import f55 from "../dist/assets/DlqControl-Lq9ISb9b.js" with { type: 'file' };
59
+ import f56 from "../dist/assets/controlConnectionEpoch-CZsS0wAb.js" with { type: 'file' };
60
+ import f57 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
61
+ import f58 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
62
+ import f59 from "../dist/assets/CronManager-B6xLLgI5.js" with { type: 'file' };
63
+ import f60 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
64
+ import f61 from "../dist/assets/Logs-DMukqmHy.js" with { type: 'file' };
65
+ import f62 from "../dist/assets/bq-F5BbTG1T.js" with { type: 'file' };
66
+ import f63 from "../dist/assets/responses-BkR2JTH9.js" with { type: 'file' };
67
+ import f64 from "../dist/assets/toastStore-IZn6OPLZ.js" with { type: 'file' };
68
+ import f65 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
69
+ import f66 from "../dist/assets/QueueDetailPro-Dkz4-1wn.js" with { type: 'file' };
70
+ import f67 from "../dist/assets/Database-DGM2BIHy.js" with { type: 'file' };
71
+ import f68 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
72
+ import f69 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
73
+ import f70 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
74
+ import f71 from "../dist/assets/QueueActions-BWnmNEqV.js" with { type: 'file' };
75
+ import f72 from "../dist/assets/index-BFW2_47n.js" with { type: 'file' };
76
+ import f73 from "../dist/assets/dist-DpZcbP9W.js" with { type: 'file' };
77
+ import f74 from "../dist/assets/Diagnostics-_Sh3UyaT.js" with { type: 'file' };
78
+ import f75 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
79
+ import f76 from "../dist/assets/flowOperationPolicy-B2Etcb3f.js" with { type: 'file' };
80
+ import f77 from "../dist/assets/QueuesOverview-CT6JBaim.js" with { type: 'file' };
81
+ import f78 from "../dist/assets/UsagePro-CoBbI-Cl.js" with { type: 'file' };
82
+ import f79 from "../dist/assets/Cron-1DZTZWXO.js" with { type: 'file' };
83
+ import f80 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
84
+ import f81 from "../dist/assets/Benchmark-DQNZV7dM.js" with { type: 'file' };
85
85
 
86
86
  export const ASSETS: Record<string, string> = {
87
- "/index.html": f0,
88
- "/favicon.svg": f1,
89
- "/og.png": f2,
90
- "/assets/usePolledData-0CVelkl2.js": f3,
91
- "/assets/Workflows-BxlrgGEB.js": f4,
92
- "/assets/QueueDetailPro-CFNQcKho.js": f5,
93
- "/assets/Metrics-CvoY4uhX.js": f6,
94
- "/assets/Diagnostics-DFshXeHl.js": f7,
95
- "/assets/WorkersPro-YycNhm9w.js": f8,
96
- "/assets/Logs-BGeTppXO.js": f9,
97
- "/assets/Settings-Bw5MtDTF.js": f10,
98
- "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f11,
99
- "/assets/icons-BVzwsfbG.js": f12,
100
- "/assets/feedback-QDN1AsYt.js": f13,
101
- "/assets/Alerts-CYwfGLSQ.js": f14,
102
- "/assets/connectionStore-BJLihGaC.js": f15,
103
- "/assets/react-vendor-CvwrP0tU.js": f16,
104
- "/assets/Flows-CcNdf_jS.js": f17,
105
- "/assets/StatusBadge-BoOVTnKu.js": f18,
106
- "/assets/Button-Ch1W94fJ.js": f19,
107
- "/assets/exportFile-C7xhE8Yh.js": f20,
108
- "/assets/Jobs-NN0fJ3BQ.js": f21,
109
- "/assets/QueueControl-Ce-O1L4p.js": f22,
110
- "/assets/index-ByvrmBif.js": f23,
111
- "/assets/dist-DjvZiKhB.js": f24,
112
- "/assets/McpServer-AsaFGnYZ.js": f25,
113
- "/assets/Cron-CSoEPVeq.js": f26,
114
- "/assets/Queues-DlznHsfh.js": f27,
115
- "/assets/UsagePro-D4cGbozz.js": f28,
116
- "/assets/upstreamPaths-B_cyinGI.js": f29,
117
- "/assets/form-C4oby9pI.js": f30,
118
- "/assets/BulkAddJobs-vyGFvlO3.js": f31,
119
- "/assets/responses-DiIfPXXq.js": f32,
120
- "/assets/api-BAGaBh6R.js": f33,
121
- "/assets/Benchmark-BINaJvak.js": f34,
122
- "/assets/controlConnectionEpoch-CZsS0wAb.js": f35,
123
- "/assets/AreaChart-DEAalJ6P.js": f36,
124
- "/assets/Pagination-x-Cwgrul.js": f37,
125
- "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f38,
126
- "/assets/useThroughputSeries-Cagm3qzB.js": f39,
127
- "/assets/S3BackupPro-8y0J0-3_.js": f40,
128
- "/assets/DlqPro-BmrnGQ-3.js": f41,
129
- "/assets/dist-DpZcbP9W.js": f42,
130
- "/assets/cn-zFEt5SO8.js": f43,
131
- "/assets/useServerActionGuard-uGePilQQ.js": f44,
132
- "/assets/PageHeader-CvIyaFOO.js": f45,
133
- "/assets/Fleet-Bdrj9bLI.js": f46,
134
- "/assets/MetricsPro-C01FjqvR.js": f47,
135
- "/assets/bq-Qh0VFLKV.js": f48,
136
- "/assets/Overview-WStfS5ee.js": f49,
137
- "/assets/index-CxhXRVH_.css": f50,
138
- "/assets/useControlActionGuard-B-bzKZKI.js": f51,
139
- "/assets/JobsPro-D_l1c80Q.js": f52,
140
- "/assets/Usage-DpShi3FE.js": f53,
141
- "/assets/CronManager-s4xjNhGD.js": f54,
142
- "/assets/install-C5y2ohOo.js": f55,
143
- "/assets/toastStore-IZn6OPLZ.js": f56,
144
- "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f57,
145
- "/assets/format-Cg7VCIZW.js": f58,
146
- "/assets/Database-x6iWCu3-.js": f59,
147
- "/assets/dist-1f1fMHVO.js": f60,
148
- "/assets/QueuesOverview-DGtapyV0.js": f61,
149
- "/assets/promisePool-BVfQ9n9Q.js": f62,
150
- "/assets/S3Backup-CxwbLJGK.js": f63,
151
- "/assets/DlqControl-BBQc6uu9.js": f64,
152
- "/assets/ServerControl-DpE7t-OF.js": f65,
153
- "/assets/QueueDetail-D5TKm4bv.js": f66,
154
- "/assets/Workers-D70B_uAI.js": f67,
155
- "/assets/Card-CWxrC8OY.js": f68,
156
- "/assets/LogsPro-D7vvgZmb.js": f69,
157
- "/assets/dist-BlWBaCN6.js": f70,
158
- "/assets/AddJob-CFnESFEU.js": f71,
159
- "/assets/Dlq-Cayt1PEN.js": f72,
160
- "/assets/JobInspector-BMjVR96H.js": f73,
161
- "/assets/Webhooks-UYiTg6hn.js": f74,
162
- "/assets/CopilotPanel-DjHfX9ta.js": f75,
163
- "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f76,
164
- "/assets/QueueActions-D51CYOjo.js": f77,
165
- "/assets/jobActions-LQD4KfCc.js": f78,
166
- "/assets/dist-DZL8soAh.js": f79,
167
- "/assets/flowMutationSafety-DSd3JLAV.js": f80,
168
- "/.vite/manifest.json": f81,
87
+ "/.vite/manifest.json": f0,
88
+ "/og.png": f1,
89
+ "/index.html": f2,
90
+ "/favicon.svg": f3,
91
+ "/assets/index-C9yGKhQ8.css": f4,
92
+ "/assets/react-vendor-CvwrP0tU.js": f5,
93
+ "/assets/useThroughputSeries-DgO8uicf.js": f6,
94
+ "/assets/AddJob-FNaPbs_V.js": f7,
95
+ "/assets/AreaChart-DEAalJ6P.js": f8,
96
+ "/assets/promisePool-BVfQ9n9Q.js": f9,
97
+ "/assets/Alerts-C961Al5D.js": f10,
98
+ "/assets/dist-DjvZiKhB.js": f11,
99
+ "/assets/WorkersPro-Dk4NfplT.js": f12,
100
+ "/assets/QueueDetail-BRDATlp0.js": f13,
101
+ "/assets/Dlq-mtInIoTh.js": f14,
102
+ "/assets/icons-BVzwsfbG.js": f15,
103
+ "/assets/JobInspector-DyWZk1eW.js": f16,
104
+ "/assets/Workers-CBEDvXm_.js": f17,
105
+ "/assets/CopilotPanel-Dlm8XwBj.js": f18,
106
+ "/assets/Flows-CE7KzaFN.js": f19,
107
+ "/assets/JobsPro-BlWwDeFN.js": f20,
108
+ "/assets/McpServer-DNrOEp9j.js": f21,
109
+ "/assets/Pagination-x-Cwgrul.js": f22,
110
+ "/assets/S3BackupPro-CjR0y18n.js": f23,
111
+ "/assets/feedback-QDN1AsYt.js": f24,
112
+ "/assets/useServerActionGuard-uGePilQQ.js": f25,
113
+ "/assets/install-oydLpc1T.js": f26,
114
+ "/assets/useControlActionGuard-B-bzKZKI.js": f27,
115
+ "/assets/Button-Ch1W94fJ.js": f28,
116
+ "/assets/QueueControl-Bvm8GUQa.js": f29,
117
+ "/assets/Fleet-Bdrj9bLI.js": f30,
118
+ "/assets/Overview-CKAA3h9f.js": f31,
119
+ "/assets/Metrics-Cm5ZvfTo.js": f32,
120
+ "/assets/ServerControl-BH6Doax0.js": f33,
121
+ "/assets/Queues-BV99vr68.js": f34,
122
+ "/assets/MetricsPro-C9g1sp-u.js": f35,
123
+ "/assets/connectionStore-BJLihGaC.js": f36,
124
+ "/assets/usePolledData-0CVelkl2.js": f37,
125
+ "/assets/api-BgWE-705.js": f38,
126
+ "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f39,
127
+ "/assets/DlqPro-0_75vrd1.js": f40,
128
+ "/assets/Workflows-DZZA6aGW.js": f41,
129
+ "/assets/format-Cg7VCIZW.js": f42,
130
+ "/assets/Jobs-ELSH1Wbd.js": f43,
131
+ "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f44,
132
+ "/assets/BulkAddJobs-IiL1uud0.js": f45,
133
+ "/assets/dist-BlWBaCN6.js": f46,
134
+ "/assets/flowMutationSafety-YKTHxqKv.js": f47,
135
+ "/assets/upstreamPaths-DQeKSxGc.js": f48,
136
+ "/assets/Usage-BWZkz7Se.js": f49,
137
+ "/assets/Settings-CL7odwoU.js": f50,
138
+ "/assets/LogsPro-BfYbmZHi.js": f51,
139
+ "/assets/Webhooks-DT2LK17V.js": f52,
140
+ "/assets/Card-CWxrC8OY.js": f53,
141
+ "/assets/S3Backup-DNABHR2Q.js": f54,
142
+ "/assets/DlqControl-Lq9ISb9b.js": f55,
143
+ "/assets/controlConnectionEpoch-CZsS0wAb.js": f56,
144
+ "/assets/exportFile-C7xhE8Yh.js": f57,
145
+ "/assets/StatusBadge-BoOVTnKu.js": f58,
146
+ "/assets/CronManager-B6xLLgI5.js": f59,
147
+ "/assets/dist-DZL8soAh.js": f60,
148
+ "/assets/Logs-DMukqmHy.js": f61,
149
+ "/assets/bq-F5BbTG1T.js": f62,
150
+ "/assets/responses-BkR2JTH9.js": f63,
151
+ "/assets/toastStore-IZn6OPLZ.js": f64,
152
+ "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f65,
153
+ "/assets/QueueDetailPro-Dkz4-1wn.js": f66,
154
+ "/assets/Database-DGM2BIHy.js": f67,
155
+ "/assets/dist-1f1fMHVO.js": f68,
156
+ "/assets/form-C4oby9pI.js": f69,
157
+ "/assets/cn-zFEt5SO8.js": f70,
158
+ "/assets/QueueActions-BWnmNEqV.js": f71,
159
+ "/assets/index-BFW2_47n.js": f72,
160
+ "/assets/dist-DpZcbP9W.js": f73,
161
+ "/assets/Diagnostics-_Sh3UyaT.js": f74,
162
+ "/assets/PageHeader-CvIyaFOO.js": f75,
163
+ "/assets/flowOperationPolicy-B2Etcb3f.js": f76,
164
+ "/assets/QueuesOverview-CT6JBaim.js": f77,
165
+ "/assets/UsagePro-CoBbI-Cl.js": f78,
166
+ "/assets/Cron-1DZTZWXO.js": f79,
167
+ "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f80,
168
+ "/assets/Benchmark-DQNZV7dM.js": f81,
169
169
  };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Which job actions the server will actually accept for a given state. Shared
3
+ * between JobInspector (single job) and JobsPro (bulk/per-row) so the two
4
+ * surfaces never drift on what's legal to attempt.
5
+ *
6
+ * Mirrors the location-based gating in src/application/operations/jobManagement.ts
7
+ * only where the upstream operation is safe for an HTTP client. `waiting-children`
8
+ * is NOT in the runnable heap, so priority and delay are unavailable there.
9
+ * Cancel and Discard are deliberately unavailable in every state: v2.9.3 cannot
10
+ * inspect reverse dependencies or make either transition conditional on the state
11
+ * that the dashboard read. Discard also bypasses terminal flow-failure resolution
12
+ * and accepts a job that became active after the snapshot, which can strand its
13
+ * parent while the worker continues external side effects. DLQ retry is also
14
+ * unavailable: a read followed by retry is subject to id-reuse TOCTOU, and the
15
+ * endpoint has no atomic generation/topology precondition. Completed requeue is
16
+ * unavailable because v2.9.3 does not rebuild a child's dependency registration.
17
+ *
18
+ * Active state transitions are deliberately absent. Bunqueue v2.9.3 removes
19
+ * the broker processing record but cannot cancel the already-running worker;
20
+ * retry/discard/fail/move-to-delayed can therefore duplicate external side
21
+ * effects. The dashboard only permits the non-transitioning progress update.
22
+ */
23
+ export function actionGates(state: string | undefined) {
24
+ const inRunQueue = state === 'waiting' || state === 'delayed' || state === 'prioritized';
25
+ return {
26
+ cancel: false,
27
+ discard: false,
28
+ promote: state === 'delayed',
29
+ retryDlq: false,
30
+ requeueCompleted: false,
31
+ setPriority: inRunQueue,
32
+ setDelay: inRunQueue,
33
+ };
34
+ }
35
+
36
+ /** Shared by the UI and agent: the SDK does not add atomic topology guards. */
37
+ export function flowOperationError(operation: string): string | null {
38
+ if (operation === 'updateData') {
39
+ return 'Flow data is read-only: replacing the payload can remove dependency metadata.';
40
+ }
41
+ if (operation === 'retry') {
42
+ return 'Flow retry is unavailable: Bunqueue has no atomic job-generation or state precondition.';
43
+ }
44
+ if (operation === 'remove' || operation === 'removeUnprocessedChildren') {
45
+ return 'Flow removal is unavailable: Bunqueue cannot atomically protect reverse dependencies.';
46
+ }
47
+ return null;
48
+ }
49
+
50
+ export function assertFlowOperationAllowed(operation: string): void {
51
+ const error = flowOperationError(operation);
52
+ if (error) throw new Error(error);
53
+ }
54
+
55
+ export function assertFlowOperationState(operation: string, state: string): void {
56
+ const gates = actionGates(state);
57
+ const allowed =
58
+ operation === 'promote'
59
+ ? gates.promote
60
+ : operation === 'changePriority'
61
+ ? gates.setPriority
62
+ : operation === 'changeDelay'
63
+ ? gates.setDelay
64
+ : true;
65
+ if (!allowed) throw new Error(`Flow ${operation} is unavailable for a ${state} job.`);
66
+ }
@@ -1,3 +0,0 @@
1
- import{i as e,r as t}from"./cn-zFEt5SO8.js";import{g as n,l as r,r as i,t as a}from"./react-vendor-CvwrP0tU.js";import{i as o}from"./upstreamPaths-B_cyinGI.js";import{r as s,t as c}from"./bq-Qh0VFLKV.js";import{t as l}from"./toastStore-IZn6OPLZ.js";import{n as u}from"./usePolledData-0CVelkl2.js";import{t as d}from"./Button-Ch1W94fJ.js";import{n as f,t as p}from"./Card-CWxrC8OY.js";import{t as m}from"./PageHeader-CvIyaFOO.js";import{a as h,n as g,o as _,t as v}from"./form-C4oby9pI.js";import{r as y}from"./useServerActionGuard-uGePilQQ.js";import{a as b,c as x,d as S,i as C,l as w,m as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./responses-DiIfPXXq.js";var N=e(n(),1),P=a();function F({values:e,setValue:t,queueNames:n,queueDiscoveryError:r,onRetryQueues:i,jsonError:a,setJsonError:o}){return(0,P.jsxs)(p,{children:[(0,P.jsx)(f,{title:`Job`}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,P.jsxs)(v,{label:`Queue`,children:[(0,P.jsx)(g,{list:`queue-options`,"aria-label":`Queue`,name:`target-queue`,autoComplete:`off`,value:e.queue,onChange:e=>t(`queue`,e.target.value),placeholder:`queue name (existing or new)`}),(0,P.jsx)(`datalist`,{id:`queue-options`,children:n.map(e=>(0,P.jsx)(`option`,{value:e},e))})]}),(0,P.jsx)(v,{label:`Job name`,hint:`Worker routing name in Bunqueue 2.9.2; separate from the JSON payload.`,children:(0,P.jsx)(g,{name:`job-name`,autoComplete:`off`,maxLength:256,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`default`})}),r&&(0,P.jsxs)(`p`,{role:`status`,className:`-mt-2 text-xs text-warning`,children:[`Existing queue suggestions unavailable — `,r.message,`. You can still enter a queue name manually.`,` `,(0,P.jsx)(`button`,{type:`button`,onClick:i,className:`font-medium underline underline-offset-2 hover:text-fg`,children:`Retry`})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(v,{label:`Data (JSON)`,children:(0,P.jsx)(`textarea`,{name:`job-data`,value:e.dataText,onChange:e=>t(`dataText`,e.target.value),onBlur:()=>{let t=T(e.dataText);o(t.ok?null:t.msg)},maxLength:O,spellCheck:!1,rows:7,className:`w-full rounded-lg border border-line bg-surface-2 p-3 font-mono text-sm text-fg focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})}),a&&(0,P.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a})]})]})]})}function I({values:e,setValue:t}){return(0,P.jsxs)(p,{children:[(0,P.jsx)(f,{title:`Options`}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,P.jsx)(z,{label:`Priority`,name:`priority`,value:e.priority,min:-1e6,max:1e6,placeholder:`0`,onChange:e=>t(`priority`,e)}),(0,P.jsx)(z,{label:`Delay (ms)`,name:`delay`,value:e.delay,min:0,max:C,placeholder:`0`,disabled:e.runAt.trim()!==``,onChange:e=>t(`delay`,e)}),(0,P.jsx)(v,{label:`Run at`,hint:e.runAt.trim()?`Overrides Delay — derived from this time (local time).`:`(local time)`,children:(0,P.jsx)(g,{type:`datetime-local`,name:`run-at`,value:e.runAt,onChange:e=>t(`runAt`,e.target.value)})}),(0,P.jsx)(z,{label:`Max attempts`,hint:`blank = server default`,name:`max-attempts`,value:e.maxAttempts,min:1,max:1e3,placeholder:`3`,onChange:e=>t(`maxAttempts`,e)}),(0,P.jsx)(z,{label:`Backoff (ms)`,hint:`blank = server default`,name:`backoff`,value:e.backoff,min:0,max:b,placeholder:`1000`,onChange:e=>t(`backoff`,e)}),(0,P.jsx)(v,{label:`Backoff strategy`,hint:`flat delay unless set`,children:(0,P.jsxs)(h,{name:`backoff-strategy`,value:e.backoffType,onChange:e=>t(`backoffType`,e.target.value),children:[(0,P.jsx)(`option`,{value:``,children:`flat`}),(0,P.jsx)(`option`,{value:`fixed`,children:`fixed`}),(0,P.jsx)(`option`,{value:`exponential`,children:`exponential`})]})}),(0,P.jsx)(z,{label:`Timeout (ms)`,name:`timeout`,value:e.timeout,min:0,max:b,placeholder:`—`,onChange:e=>t(`timeout`,e)}),(0,P.jsx)(z,{label:`TTL (ms)`,hint:`blank = no expiry`,name:`ttl`,value:e.ttl,min:0,max:C,placeholder:`—`,onChange:e=>t(`ttl`,e)}),(0,P.jsx)(v,{label:`Custom job ID`,children:(0,P.jsx)(g,{name:`custom-job-id`,value:e.jobId,onChange:e=>t(`jobId`,e.target.value),placeholder:`idempotency key`})})]}),(0,P.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-6`,children:[(0,P.jsx)(B,{label:`removeOnComplete`,checked:e.removeOnComplete,onChange:e=>t(`removeOnComplete`,e)}),(0,P.jsx)(B,{label:`removeOnFail`,checked:e.removeOnFail,onChange:e=>t(`removeOnFail`,e)}),(0,P.jsx)(B,{label:`durable`,checked:e.durable,onChange:e=>t(`durable`,e)}),(0,P.jsx)(B,{label:`lifo`,checked:e.lifo,onChange:e=>t(`lifo`,e)})]}),(0,P.jsx)(L,{values:e,setValue:t})]})}function L({values:e,setValue:t}){return(0,P.jsxs)(`div`,{className:`mt-4 border-t border-line pt-4`,children:[(0,P.jsx)(`div`,{className:`mb-3 text-[11px] uppercase tracking-wider text-faint`,children:`Advanced`}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,P.jsx)(R,{label:`Tags`,hint:`comma-separated`,name:`tags`,value:e.tags,placeholder:`email, urgent`,onChange:e=>t(`tags`,e)}),(0,P.jsx)(R,{label:`Group ID`,name:`group-id`,value:e.groupId,placeholder:`—`,onChange:e=>t(`groupId`,e)}),(0,P.jsx)(R,{label:`Unique key`,hint:`dedup key`,name:`unique-key`,value:e.uniqueKey,placeholder:`—`,onChange:e=>t(`uniqueKey`,e)}),(0,P.jsx)(R,{label:`Depends on`,hint:`parent job ids, comma-separated`,name:`depends-on`,value:e.dependsOn,placeholder:`job-id-1, job-id-2`,onChange:e=>t(`dependsOn`,e)}),(0,P.jsx)(`div`,{className:`col-span-2 md:col-span-3`,children:(0,P.jsx)(v,{label:`Repeat policy (JSON)`,hint:`v2.9.2-safe form: e.g. {"every":60000,"limit":10}. Use Cron Manager for cron patterns.`,children:(0,P.jsx)(`textarea`,{name:`repeat-policy`,value:e.repeatText,onChange:e=>t(`repeatText`,e.target.value),rows:2,spellCheck:!1,placeholder:`{"every": 60000}`,className:`w-full rounded-lg border border-line bg-surface-2 px-3 py-2 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})})})]})]})}function R({label:e,hint:t,name:n,value:r,placeholder:i,onChange:a}){return(0,P.jsx)(v,{label:e,hint:t,children:(0,P.jsx)(g,{name:n,value:r,onChange:e=>a(e.target.value),placeholder:i})})}function z({label:e,hint:t,name:n,value:r,min:i,max:a,placeholder:o,disabled:s,onChange:c}){return(0,P.jsx)(v,{label:e,hint:t,children:(0,P.jsx)(g,{type:`number`,min:i,max:a,step:1,name:n,value:r,onChange:e=>c(e.target.value),placeholder:o,disabled:s})})}function B({label:e,checked:t,onChange:n}){return(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(_,{checked:t,onChange:n,label:e}),(0,P.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e})]})}function V(e){let t=e?.options??{},n=D(t);return{queue:e?.queue??``,name:e?.name??`default`,dataText:e?.dataText??`{
2
- "hello": "world"
3
- }`,count:`1`,priority:A(t.priority),delay:``,runAt:``,maxAttempts:A(t.maxAttempts),backoff:n.backoff,timeout:A(t.timeout),ttl:n.ttl,jobId:``,removeOnComplete:t.removeOnComplete??!1,removeOnFail:t.removeOnFail??!1,durable:!1,lifo:!1,backoffType:n.backoffType,tags:n.tags,groupId:n.groupId,dependsOn:``,uniqueKey:``,repeatText:``}}function H(e,t=Date.now()){let n=e.queue.trim(),r=M(n);if(r)return U(r);let i=e.name.trim();if(!i||i.length>256)return U(`Job name must be a non-empty string of at most 256 characters`);let a=T(e.dataText);if(!a.ok)return{ok:!1,msg:a.msg,field:a.kind===`json`?`data`:`result`};let s=x({priority:e.priority,delay:e.runAt.trim()?``:e.delay,maxAttempts:e.maxAttempts,backoff:e.backoff,timeout:e.timeout,ttl:e.ttl});if(!s.ok)return U(s.msg);let c=s.options.delay;if(e.runAt.trim()){let n=new Date(e.runAt).getTime();if(!Number.isFinite(n))return U(`Run at is not a valid date/time`);if(c=Math.max(0,n-t),c>31536e6)return U(`Run at must be within the next 365 days`)}let l=S(s.options.backoff,e.backoffType);if(!l.ok)return U(l.msg);let u=W(e.tags),d=W(e.dependsOn),f=e.jobId.trim();if(f){let e=o(f);if(e)return U(`Job ID: ${e}`)}for(let e of d){let t=o(e);if(t)return U(`Dependency ID "${e}": ${t}`)}let p=w(e.repeatText);if(!p.ok)return U(p.msg);let m=Number(e.count);return!Number.isSafeInteger(m)||m<1||m>1e4?U(`Count must be a whole number from 1 to 10000`):{ok:!0,target:n,count:m,body:{name:i,data:a.data,priority:s.options.priority,delay:c,maxAttempts:s.options.maxAttempts,backoff:l.backoff,timeout:s.options.timeout,ttl:s.options.ttl,jobId:f||void 0,removeOnComplete:e.removeOnComplete||void 0,removeOnFail:e.removeOnFail||void 0,durable:e.durable||void 0,lifo:e.lifo||void 0,tags:u.length?u:void 0,groupId:e.groupId.trim()||void 0,dependsOn:d.length?d:void 0,uniqueKey:e.uniqueKey.trim()||void 0,repeat:p.repeat}}}var U=e=>({ok:!1,msg:e,field:`result`}),W=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),G=t({AddJob:()=>K,MAX_JOB_DATA_BYTES:()=>MAX_JOB_DATA_BYTES,MAX_JOB_DATA_CHARS:()=>O});function K(){let{data:e,error:t,refetch:n}=u(()=>c.queues(),[],{intervalMs:3e4}),a=r().state?.clone,[o,f]=(0,N.useState)(()=>V(a)),[p,h]=(0,N.useState)(!1),[_,b]=(0,N.useState)(null),[x,S]=(0,N.useState)(null),C=y(`add-job`),w=(e,t)=>f(n=>({...n,[e]:t}));(0,N.useEffect)(()=>{h(!1),b(null),S(null)},[C.scopeKey]);let T=async()=>{b(null),S(null);let e=H(o);if(!e.ok){e.field===`data`?S(e.msg):b({ok:!1,msg:e.msg});return}let t=C.begin();if(!t)return;h(!0);let{target:n,body:r,count:i}=e;try{if(i===1){let e=E(await c.addJob(n,r));if(!t.isCurrent())return;b({ok:!0,msg:`Accepted job ID ${e} (it may be an existing deduplicated job)`}),l.success(`Job submission accepted`,`${n} · ${e}`)}else{let e=Array.from({length:i},()=>r),a=s(e);if(a){t.isCurrent()&&b({ok:!1,msg:a});return}let o=j(await c.addJobsBulk(n,e),i);if(!t.isCurrent())return;let u=k(new Set(o).size,i);b(u),l.success(u.msg,`in ${n}`)}}catch(e){if(!t.isCurrent())return;b({ok:!1,msg:e.message}),l.error(`Add job failed`,e.message)}finally{t.finish()&&h(!1)}};return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(m,{title:`Add Job`,description:`Enqueue a job with full options.`,actions:(0,P.jsx)(i,{to:`/jobs/bulk-add`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Bulk import`})}),a&&(0,P.jsx)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-accent/30 bg-accent/[0.06] px-4 py-2 text-sm text-accent`,children:`Pre-filled from an existing job. Review the data and options, then enqueue a fresh job.`}),(0,P.jsxs)(`form`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,onSubmit:e=>{e.preventDefault(),T()},children:[(0,P.jsx)(F,{values:o,setValue:w,queueNames:(e?.queues??[]).map(e=>e.name),queueDiscoveryError:t,onRetryQueues:()=>void n(),jsonError:x,setJsonError:S}),(0,P.jsx)(I,{values:o,setValue:w}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 lg:col-span-2`,children:[(0,P.jsx)(`div`,{className:`w-28`,children:(0,P.jsx)(v,{label:`Count`,hint:`1–10000`,children:(0,P.jsx)(g,{type:`number`,min:1,max:1e4,step:1,name:`count`,value:o.count,onChange:e=>w(`count`,e.target.value)})})}),(0,P.jsx)(d,{type:`submit`,variant:`accent`,disabled:p,children:p?`Adding…`:`Add job`}),_&&(0,P.jsx)(`span`,{role:_.ok?`status`:`alert`,className:_.ok?`text-sm text-success`:`text-sm text-danger`,children:_.msg})]})]})]})}export{G as t};
@@ -1,5 +0,0 @@
1
- import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CvwrP0tU.js";import{i as r}from"./upstreamPaths-B_cyinGI.js";import{r as i,t as a}from"./bq-Qh0VFLKV.js";import{t as o}from"./toastStore-IZn6OPLZ.js";import{n as s}from"./usePolledData-0CVelkl2.js";import{t as c}from"./Button-Ch1W94fJ.js";import{n as l,t as u}from"./Card-CWxrC8OY.js";import{t as d}from"./PageHeader-CvIyaFOO.js";import{i as f,n as p,t as m}from"./form-C4oby9pI.js";import{r as h}from"./useServerActionGuard-uGePilQQ.js";import{f as g,h as _,l as v,t as y,u as b}from"./responses-DiIfPXXq.js";var x=e(t(),1),S=1e4,C=365*24*60*60*1e3,w=1440*60*1e3,T=64*1024*1024,E=64*1024*1024,D=`[
2
- { "data": { "to": "a@example.com", "template": "welcome" }, "priority": 1 },
3
- { "data": { "to": "b@example.com", "template": "welcome" } }
4
- ]`,O=n();function k({values:e,setValue:t,parsedCount:n,parseError:r,validation:i,onFile:a,onBeforeTextChange:o}){return(0,O.jsxs)(u,{className:`lg:col-span-2`,children:[(0,O.jsx)(l,{title:`Jobs`,action:(0,O.jsxs)(`label`,{className:`cursor-pointer rounded-lg border border-line px-3 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg`,children:[`Upload file`,(0,O.jsx)(`input`,{type:`file`,name:`jobs-file`,accept:`.json,.ndjson,.txt,application/json`,onChange:a,className:`hidden`})]})}),(0,O.jsx)(`textarea`,{name:`jobs-json`,value:e.text,onChange:e=>{o(),t(`text`,e.target.value)},maxLength:T,spellCheck:!1,rows:16,placeholder:D,"aria-label":`Jobs JSON`,className:`w-full rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,O.jsxs)(`fieldset`,{className:`mt-3 flex flex-wrap items-center gap-3`,children:[(0,O.jsx)(`legend`,{className:`sr-only`,children:`Import interpretation`}),(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs font-medium text-faint`,children:`Interpret each item as`}),(0,O.jsx)(f,{options:[`spec`,`raw`],value:e.mode,onChange:e=>t(`mode`,e)}),(0,O.jsx)(`span`,{className:`text-xs text-faint`,children:e.mode===`spec`?`job spec: an object with a "data" key sets options from its sibling fields.`:`raw data: the whole item becomes the job payload, untouched.`})]}),(0,O.jsx)(`p`,{className:`mt-2 text-xs text-faint`,children:`Accepts a JSON array, a single object, or newline-delimited JSON.`}),(0,O.jsx)(`div`,{className:`mt-2 text-sm`,children:r?(0,O.jsx)(`span`,{role:`alert`,className:`text-danger`,children:r}):n>1e4?(0,O.jsxs)(`span`,{role:`alert`,className:`text-danger`,children:[`Too many jobs (`,n,`). Limit is `,S,`.`]}):n>0?(0,O.jsxs)(`span`,{className:`text-success`,children:[n,` job(s) parsed ✓`]}):(0,O.jsx)(`span`,{className:`text-faint`,children:`Nothing parsed yet.`})}),!r&&n>0&&!i.ok&&(0,O.jsxs)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:[`Import blocked — `,i.msg,`. Fix the spec or switch to “raw” when the whole object is job data.`]})]})}function A({values:e,setValue:t,queueNames:n,queueDiscoveryError:r,onRetryQueues:i,busy:a,parsedCount:o,parseError:s,validationOk:d,result:f,onSubmit:h}){return(0,O.jsxs)(u,{children:[(0,O.jsx)(l,{title:`Target & defaults`}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,O.jsxs)(m,{label:`Queue`,children:[(0,O.jsx)(p,{list:`bulk-queue-options`,"aria-label":`Queue`,name:`bulk-target-queue`,autoComplete:`off`,value:e.queue,onChange:e=>t(`queue`,e.target.value),placeholder:`queue name (existing or new)`}),(0,O.jsx)(`datalist`,{id:`bulk-queue-options`,children:n.map(e=>(0,O.jsx)(`option`,{value:e},e))})]}),r&&(0,O.jsxs)(`p`,{role:`status`,className:`-mt-2 text-xs text-warning`,children:[`Existing queue suggestions unavailable — `,r.message,`. You can still enter a queue name manually.`,` `,(0,O.jsx)(`button`,{type:`button`,onClick:i,className:`font-medium underline underline-offset-2 hover:text-fg`,children:`Retry`})]}),(0,O.jsx)(`p`,{className:`-mt-2 text-xs text-faint`,children:`Defaults below fill any field an item omits.`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,O.jsx)(j,{label:`Priority`,name:`default-priority`,value:e.priority,min:-1e6,max:1e6,placeholder:`0`,onChange:e=>t(`priority`,e)}),(0,O.jsx)(j,{label:`Max attempts`,name:`default-max-attempts`,value:e.maxAttempts,min:1,max:1e3,placeholder:`3`,onChange:e=>t(`maxAttempts`,e)}),(0,O.jsx)(j,{label:`Backoff (ms)`,name:`default-backoff`,value:e.backoff,min:0,max:w,placeholder:`1000`,onChange:e=>t(`backoff`,e)}),(0,O.jsx)(j,{label:`Timeout (ms)`,name:`default-timeout`,value:e.timeout,min:0,max:w,placeholder:`—`,onChange:e=>t(`timeout`,e)})]}),(0,O.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,O.jsx)(c,{variant:`accent`,disabled:a||o===0||o>1e4||s!=null||!d,onClick:h,children:a?`Importing…`:`Import ${o||``}`})}),f&&(0,O.jsx)(`span`,{role:f.ok?`status`:`alert`,className:f.ok?`text-sm text-success`:`text-sm text-danger`,children:f.msg})]})]})}function j({label:e,name:t,value:n,min:r,max:i,placeholder:a,onChange:o}){return(0,O.jsx)(m,{label:e,children:(0,O.jsx)(p,{type:`number`,min:r,max:i,step:1,name:t,value:n,onChange:e=>o(e.target.value),placeholder:a})})}function M(e){return e.length>67108864||_(e,67108864)>67108864?`Import text exceeds the 64 MiB UTF-8 safety limit`:null}function N(e,t=E){return i(e,t)}function P(e,t,n){return{ok:!0,msg:`Accepted ${t} job submission${t===1?``:`s`} in ${n}; server returned ${e} distinct job ID${e===1?``:`s`} (deduplication may reuse existing jobs)`}}function F(e){let t=M(e);if(t)return{items:[],error:t};let n=e.trim();if(!n)return{items:[],error:null};try{let e=JSON.parse(n);return{items:Array.isArray(e)?e:[e],error:null}}catch{}let r=[],i=e.split(`
5
- `);for(let e=0;e<i.length;e++){let t=i[e].trim();if(t)try{r.push(JSON.parse(t))}catch(t){return{items:[],error:`Line ${e+1}: ${t.message}`}}}return{items:r,error:null}}function I({text:e,setText:t,setResult:n}){let r=(0,x.useRef)(null),i=(0,x.useRef)(0),a=(0,x.useCallback)(()=>{i.current+=1;let e=r.current;r.current=null;try{e?.abort()}catch{}},[]);return(0,x.useEffect)(()=>a,[a]),{cancelPending:a,onFile:a=>{let o=a.currentTarget,s=o.files?.[0];if(!s)return;let c=i.current+1;i.current=c;let l=r.current;r.current=null;try{l?.abort()}catch{}if(o.value=``,!Number.isSafeInteger(s.size)||s.size<0||s.size>67108864){n({ok:!1,msg:`File is too large; maximum is 64 MiB (${s.name})`});return}if(e.trim()!==``&&!window.confirm(`Replace the current input with "${s.name}"?`))return;let u=new FileReader,d=()=>i.current===c&&r.current===u,f=()=>{d()&&(r.current=null)};u.onload=()=>{if(!d())return;if(typeof u.result!=`string`){n({ok:!1,msg:`Could not decode file as text (${s.name})`}),f();return}let e=M(u.result);e?n({ok:!1,msg:`${e} (${s.name})`}):(t(u.result),n(null)),f()},u.onerror=()=>{d()&&(n({ok:!1,msg:`Could not read file (${s.name})`}),f())},u.onabort=f,r.current=u,n(null);try{u.readAsText(s)}catch{if(!d())return;n({ok:!1,msg:`Could not read file (${s.name})`}),f()}}}}var L=e=>{let t=typeof e==`string`&&e.trim()!==``?Number(e.trim()):e;return typeof t==`number`&&Number.isFinite(t)?t:void 0},R=e=>typeof e==`boolean`?e:void 0,z=e=>typeof e==`string`?e.trim()===``?void 0:e.trim():typeof e==`number`&&Number.isFinite(e)?String(e):void 0,B=e=>{if(!Array.isArray(e))return;let t=e.map(z);return t.every(e=>e!==void 0)?t:void 0},V=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:void 0,H=e=>{let t=L(e);if(t!==void 0)return t;let n=V(e);if(!n||n.type!==`fixed`&&n.type!==`exponential`||Object.keys(n).some(e=>e!==`type`&&e!==`delay`))return;let r=L(n.delay);return r===void 0?void 0:{type:n.type,delay:r}},U=e=>{let t=V(e);if(!t)return;let n=v(JSON.stringify(t));return n.ok?n.repeat:void 0};function W(e){let t=V(e);if(!t)return{ok:!1,msg:`must be an object`};let n=new Set([`ttl`,`extend`,`replace`]),r=Object.keys(t).filter(e=>!n.has(e));if(r.length)return{ok:!1,msg:`has unknown option(s): ${r.join(`, `)}`};if(t.ttl!==void 0&&(!Number.isSafeInteger(t.ttl)||t.ttl<=0||t.ttl>31536e6))return{ok:!1,msg:`ttl must be a whole number from 1 to ${C} ms`};for(let e of[`extend`,`replace`])if(t[e]!==void 0&&typeof t[e]!=`boolean`)return{ok:!1,msg:`${e} must be a boolean`};return t.extend===!0&&t.replace===!0?{ok:!1,msg:`extend and replace are mutually exclusive`}:t.extend===!0&&t.ttl===void 0?{ok:!1,msg:`extend requires ttl`}:{ok:!0,dedup:{...typeof t.ttl==`number`?{ttl:t.ttl}:{},...typeof t.extend==`boolean`?{extend:t.extend}:{},...typeof t.replace==`boolean`?{replace:t.replace}:{}}}}var G=e=>{let t=W(e);return t.ok?t.dedup:void 0};function K(e,t,n){if(n===`spec`&&e&&typeof e==`object`&&!Array.isArray(e)&&`data`in e){let n=e;return{name:z(n.name),data:n.data,priority:L(n.priority)??t.priority,delay:L(n.delay),maxAttempts:L(n.maxAttempts)??t.maxAttempts,backoff:H(n.backoff)??t.backoff,timeout:L(n.timeout)??t.timeout,jobId:z(n.jobId)??z(n.customId),removeOnComplete:R(n.removeOnComplete),removeOnFail:R(n.removeOnFail),durable:R(n.durable),lifo:R(n.lifo),ttl:L(n.ttl),uniqueKey:z(n.uniqueKey),tags:B(n.tags),groupId:z(n.groupId),dependsOn:B(n.dependsOn),stallTimeout:L(n.stallTimeout),repeat:U(n.repeat),dedup:G(n.dedup),stackTraceLimit:L(n.stackTraceLimit),timestamp:L(n.timestamp)}}return{data:e,...t}}var q=new Set([`name`,`data`,`priority`,`delay`,`maxAttempts`,`backoff`,`timeout`,`jobId`,`customId`,`removeOnComplete`,`removeOnFail`,`durable`,`lifo`,`ttl`,`uniqueKey`,`tags`,`groupId`,`dependsOn`,`stallTimeout`,`repeat`,`dedup`,`stackTraceLimit`,`timestamp`]);function J(e,t,n,r){if(e===void 0)return null;let i=L(e);return i===void 0?`${t} must be a number`:Number.isSafeInteger(i)?i<n||i>r?`${t} must be between ${n} and ${r}`:null:`${t} must be a whole, safe integer`}function Y(e){let t={priority:e.priority.trim()||void 0,maxAttempts:e.maxAttempts.trim()||void 0,backoff:e.backoff.trim()||void 0,timeout:e.timeout.trim()||void 0},n=[[`priority`,`Default priority`,-1e6,1e6],[`maxAttempts`,`Default max attempts`,1,1e3],[`backoff`,`Default backoff`,0,w],[`timeout`,`Default timeout`,0,w]],r={};for(let[e,i,a,o]of n){let n=J(t[e],i,a,o);if(n)return{ok:!1,msg:n};let s=L(t[e]);s!==void 0&&(r[e]=s)}return{ok:!0,defaults:r}}function X(e){let t=Object.keys(e).filter(e=>!q.has(e));if(t.length)return`unknown job option(s): ${t.join(`, `)}`;let n=[[`priority`,`priority`,-1e6,1e6],[`delay`,`delay`,0,C],[`maxAttempts`,`maxAttempts`,1,1e3],[`timeout`,`timeout`,0,w],[`ttl`,`ttl`,0,C],[`stallTimeout`,`stallTimeout`,0,w],[`stackTraceLimit`,`stackTraceLimit`,0,1e4],[`timestamp`,`timestamp`,0,2**53-1]];for(let[t,r,i,a]of n){let n=J(e[t],r,i,a);if(n)return n}if(e.backoff!==void 0){let t=H(e.backoff);if(t===void 0)return`backoff must be a number or {"type":"fixed|exponential","delay":number} with no extra keys`;let n=J(typeof t==`number`?t:t.delay,`backoff delay`,0,w);if(n)return n}if(e.repeat!==void 0){let t=V(e.repeat);if(!t)return`repeat must be an object`;let n=v(JSON.stringify(t));if(!n.ok)return n.msg}if(e.dedup!==void 0){let t=W(e.dedup);if(!t.ok)return`dedup ${t.msg}`;if(z(e.uniqueKey)===void 0)return`dedup requires a non-empty uniqueKey`}for(let t of[`removeOnComplete`,`removeOnFail`,`durable`,`lifo`])if(e[t]!==void 0&&typeof e[t]!=`boolean`)return`${t} must be a boolean`;for(let t of[`jobId`,`customId`,`uniqueKey`]){let n=e[t];if(n===void 0)continue;let i=z(n);if(i===void 0||i.length>1024)return`${t} must be a non-empty string (or finite numeric id) of at most 1024 characters`;if((t===`jobId`||t===`customId`)&&r(i))return`${t}: ${r(i)}`}let i=z(e.jobId),a=z(e.customId);if(i!==void 0&&a!==void 0&&i!==a)return`jobId and customId disagree; provide only one spelling`;if(e.groupId!==void 0){let t=z(e.groupId);if(t===void 0||t.length>256)return`groupId must be a non-empty string of at most 256 characters`}for(let t of[`tags`,`dependsOn`]){if(e[t]===void 0)continue;let n=B(e[t]),i=t===`tags`?256:1024;if(!n||n.some(e=>e.length>i))return`${t} must be an array of non-empty strings of at most ${i} characters`;if(t===`dependsOn`){let e=n.find(e=>r(e));if(e)return`dependsOn ID "${e}": ${r(e)}`}}return null}function Z(e){let t=new Map;for(let n of e)if(n.jobId){if(t.has(n.jobId))return`duplicate jobId/customId "${n.jobId}" makes dependency resolution ambiguous`;t.set(n.jobId,n)}let n=new Set,r=new Set,i=e=>{if(n.has(e))return!0;if(r.has(e))return!1;n.add(e);for(let n of t.get(e)?.dependsOn??[])if(t.has(n)&&i(n))return!0;return n.delete(e),r.add(e),!1};for(let e of t.keys())if(i(e))return`dependency cycle detected in this batch (involving "${e}")`;return null}function Q(e,t,n){if(e.length>1e4)return{ok:!1,msg:`Too many jobs (${e.length}). Limit is ${S}.`};let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a];if(n===`spec`&&$(o)){let e=X(o);if(e)return{ok:!1,msg:`Job ${a+1}: ${e}`}}let s=K(o,t,n),c;try{c=JSON.stringify(s.data)}catch{return{ok:!1,msg:`Job ${a+1}: data must be JSON serializable`}}if(c===void 0)return{ok:!1,msg:`Job ${a+1}: data must be JSON serializable`};if(c.length>10485760)return{ok:!1,msg:`Job ${a+1}: data exceeds the 10 MiB UTF-8 limit`};let l=_(c,g);if(l>10485760)return{ok:!1,msg:`Job ${a+1}: data exceeds the 10 MiB UTF-8 limit`};if(i+=l,i>67108864)return{ok:!1,msg:`Combined job data exceeds the 64 MiB import safety limit`};r.push(s)}let a=Z(r);return a?{ok:!1,msg:a}:{ok:!0,bodies:r}}var $=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&`data`in e,ee={queue:``,text:``,mode:`spec`,priority:``,maxAttempts:``,backoff:``,timeout:``};function te(){let{data:e,error:t,refetch:n}=s(()=>a.queues(),[],{intervalMs:3e4}),[r,i]=(0,x.useState)(ee),[c,l]=(0,x.useState)(!1),[u,f]=(0,x.useState)(null),p=h(`bulk-add-jobs`),m=(e,t)=>i(n=>({...n,[e]:t})),g=I({text:r.text,setText:e=>m(`text`,e),setResult:f});(0,x.useEffect)(()=>{l(!1),f(null)},[p.scopeKey]);let _=(0,x.useMemo)(()=>F(r.text),[r.text]),v=(0,x.useMemo)(()=>{if(_.error)return{ok:!1,msg:_.error};if(_.items.length>1e4)return{ok:!1,msg:`Too many jobs (${_.items.length}). Limit is ${S}.`};let e=Y(r);return e.ok?Q(_.items,e.defaults,r.mode):e},[_,r]),C=async()=>{f(null);let e=r.queue.trim(),t=b(e);if(t){f({ok:!1,msg:t});return}let n=M(r.text);if(n){f({ok:!1,msg:n});return}if(_.error){f({ok:!1,msg:_.error});return}if(_.items.length===0){f({ok:!1,msg:`Nothing to enqueue — paste a JSON array or NDJSON.`});return}if(_.items.length>1e4){f({ok:!1,msg:`Too many jobs (${_.items.length}). Limit is ${S}.`});return}if(!v.ok){f({ok:!1,msg:v.msg});return}let i=N(v.bodies);if(i){f({ok:!1,msg:i});return}let s=p.begin();if(s){l(!0);try{let t=y(await a.addJobsBulk(e,v.bodies),v.bodies.length);if(!s.isCurrent())return;let n=P(new Set(t).size,v.bodies.length,e);f(n),o.success(n.msg)}catch(e){if(!s.isCurrent())return;let t=e.message;f({ok:!1,msg:t}),o.error(`Bulk import failed`,t)}finally{s.finish()&&l(!1)}}};return(0,O.jsxs)(`div`,{children:[(0,O.jsx)(d,{title:`Bulk Add Jobs`,description:`Import many distinct jobs at once from a JSON array, NDJSON, or a file.`}),(0,O.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,O.jsx)(k,{values:r,setValue:m,parsedCount:_.items.length,parseError:_.error,validation:v,onFile:g.onFile,onBeforeTextChange:g.cancelPending}),(0,O.jsx)(A,{values:r,setValue:m,queueNames:(e?.queues??[]).map(e=>e.name),queueDiscoveryError:t,onRetryQueues:()=>void n(),busy:c,parsedCount:_.items.length,parseError:_.error,validationOk:v.ok,result:u,onSubmit:()=>void C()})]})]})}export{te as BulkAddJobs};