bunqueue-dashboard 0.0.41 → 0.0.42

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 (64) hide show
  1. package/README.md +10 -8
  2. package/agent/backup/resultValidation.ts +1 -1
  3. package/agent/manager/config.ts +1 -1
  4. package/agent/queue/routes.ts +33 -3
  5. package/agent/queue/runtime.ts +49 -3
  6. package/agent/queue/types.ts +16 -1
  7. package/agent/queue/validation.ts +8 -0
  8. package/agent/workflows.ts +1 -1
  9. package/dist/.vite/manifest.json +122 -120
  10. package/dist/assets/AddJob-FNaPbs_V.js +3 -0
  11. package/dist/assets/{Alerts-CYwfGLSQ.js → Alerts-BvWBv-z7.js} +1 -1
  12. package/dist/assets/{Benchmark-BINaJvak.js → Benchmark-BywalSmU.js} +1 -1
  13. package/dist/assets/BulkAddJobs-IiL1uud0.js +5 -0
  14. package/dist/assets/{CopilotPanel-DjHfX9ta.js → CopilotPanel-CH2jbbYA.js} +1 -1
  15. package/dist/assets/{Cron-CSoEPVeq.js → Cron-1DZTZWXO.js} +1 -1
  16. package/dist/assets/{CronManager-s4xjNhGD.js → CronManager-B6xLLgI5.js} +1 -1
  17. package/dist/assets/{Database-x6iWCu3-.js → Database-BzEkXws0.js} +1 -1
  18. package/dist/assets/{Diagnostics-DFshXeHl.js → Diagnostics-CPqhV3er.js} +1 -1
  19. package/dist/assets/{Dlq-Cayt1PEN.js → Dlq-CbLN0zQ5.js} +1 -1
  20. package/dist/assets/{DlqControl-BBQc6uu9.js → DlqControl-C5Bgzmk0.js} +1 -1
  21. package/dist/assets/{DlqPro-BmrnGQ-3.js → DlqPro-Cgaxtuwh.js} +1 -1
  22. package/dist/assets/{Flows-CcNdf_jS.js → Flows-BtUGOaif.js} +2 -2
  23. package/dist/assets/{JobInspector-BMjVR96H.js → JobInspector-DsOt4mLJ.js} +2 -2
  24. package/dist/assets/{Jobs-NN0fJ3BQ.js → Jobs-BTMpbAHD.js} +1 -1
  25. package/dist/assets/{JobsPro-D_l1c80Q.js → JobsPro-BfXTm9gH.js} +1 -1
  26. package/dist/assets/{Logs-BGeTppXO.js → Logs-uuzU5ohI.js} +1 -1
  27. package/dist/assets/{LogsPro-D7vvgZmb.js → LogsPro-DHWbhWyq.js} +1 -1
  28. package/dist/assets/{McpServer-AsaFGnYZ.js → McpServer-BqmbhrKh.js} +2 -2
  29. package/dist/assets/{Metrics-CvoY4uhX.js → Metrics-DKyBZoFa.js} +1 -1
  30. package/dist/assets/{MetricsPro-C01FjqvR.js → MetricsPro-BR2ULqIc.js} +1 -1
  31. package/dist/assets/{Overview-WStfS5ee.js → Overview-ClsyxH2e.js} +1 -1
  32. package/dist/assets/{QueueActions-D51CYOjo.js → QueueActions-BWnmNEqV.js} +1 -1
  33. package/dist/assets/QueueControl-BW0XXd0B.js +1 -0
  34. package/dist/assets/{QueueDetail-D5TKm4bv.js → QueueDetail-C1dXXN70.js} +1 -1
  35. package/dist/assets/{QueueDetailPro-CFNQcKho.js → QueueDetailPro-DDGxs2J2.js} +1 -1
  36. package/dist/assets/{Queues-DlznHsfh.js → Queues-DkPuIy1C.js} +1 -1
  37. package/dist/assets/{QueuesOverview-DGtapyV0.js → QueuesOverview-COo-V8D_.js} +1 -1
  38. package/dist/assets/{S3Backup-CxwbLJGK.js → S3Backup-DNABHR2Q.js} +1 -1
  39. package/dist/assets/{S3BackupPro-8y0J0-3_.js → S3BackupPro-DxNVFvY1.js} +3 -3
  40. package/dist/assets/{ServerControl-DpE7t-OF.js → ServerControl-B0Po974t.js} +1 -1
  41. package/dist/assets/{Settings-Bw5MtDTF.js → Settings-z9k4EVa_.js} +1 -1
  42. package/dist/assets/{Usage-DpShi3FE.js → Usage-cdWDQUaq.js} +1 -1
  43. package/dist/assets/{UsagePro-D4cGbozz.js → UsagePro-DLuwnM8n.js} +1 -1
  44. package/dist/assets/{Webhooks-UYiTg6hn.js → Webhooks-DT2LK17V.js} +1 -1
  45. package/dist/assets/{Workers-D70B_uAI.js → Workers-CVo9rJ_V.js} +1 -1
  46. package/dist/assets/{WorkersPro-YycNhm9w.js → WorkersPro-BYaredE9.js} +1 -1
  47. package/dist/assets/{Workflows-BxlrgGEB.js → Workflows-DZZA6aGW.js} +1 -1
  48. package/dist/assets/{api-BAGaBh6R.js → api-BgWE-705.js} +1 -1
  49. package/dist/assets/bq-F5BbTG1T.js +1 -0
  50. package/dist/assets/{flowMutationSafety-DSd3JLAV.js → flowMutationSafety-YKTHxqKv.js} +1 -1
  51. package/dist/assets/{index-CxhXRVH_.css → index-C9yGKhQ8.css} +1 -1
  52. package/dist/assets/{index-ByvrmBif.js → index-mID5W7vq.js} +3 -3
  53. package/dist/assets/{install-C5y2ohOo.js → install-D4uRZ7XA.js} +2 -2
  54. package/dist/assets/responses-BkR2JTH9.js +1 -0
  55. package/dist/assets/{upstreamPaths-B_cyinGI.js → upstreamPaths-DQeKSxGc.js} +1 -1
  56. package/dist/assets/{useThroughputSeries-Cagm3qzB.js → useThroughputSeries-DgO8uicf.js} +1 -1
  57. package/dist/index.html +5 -5
  58. package/package.json +6 -3
  59. package/scripts/embedded.gen.ts +152 -152
  60. package/dist/assets/AddJob-CFnESFEU.js +0 -3
  61. package/dist/assets/BulkAddJobs-vyGFvlO3.js +0 -5
  62. package/dist/assets/QueueControl-Ce-O1L4p.js +0 -1
  63. package/dist/assets/bq-Qh0VFLKV.js +0 -1
  64. package/dist/assets/responses-DiIfPXXq.js +0 -1
@@ -4,83 +4,83 @@ import f0 from "../dist/index.html" with { type: 'file' };
4
4
  import f1 from "../dist/favicon.svg" with { type: 'file' };
5
5
  import f2 from "../dist/og.png" with { type: 'file' };
6
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' };
7
+ import f4 from "../dist/assets/Cron-1DZTZWXO.js" with { type: 'file' };
8
+ import f5 from "../dist/assets/Webhooks-DT2LK17V.js" with { type: 'file' };
9
+ import f6 from "../dist/assets/McpServer-BqmbhrKh.js" with { type: 'file' };
10
+ import f7 from "../dist/assets/flowMutationSafety-YKTHxqKv.js" with { type: 'file' };
11
+ import f8 from "../dist/assets/BulkAddJobs-IiL1uud0.js" with { type: 'file' };
12
+ import f9 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
13
+ import f10 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
14
+ import f11 from "../dist/assets/Workers-CVo9rJ_V.js" with { type: 'file' };
15
+ import f12 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
16
+ import f13 from "../dist/assets/connectionStore-BJLihGaC.js" with { type: 'file' };
17
+ import f14 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
18
+ import f15 from "../dist/assets/S3Backup-DNABHR2Q.js" with { type: 'file' };
19
+ import f16 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
20
+ import f17 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
21
+ import f18 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
22
+ import f19 from "../dist/assets/Usage-cdWDQUaq.js" with { type: 'file' };
23
+ import f20 from "../dist/assets/responses-BkR2JTH9.js" with { type: 'file' };
24
+ import f21 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
25
+ import f22 from "../dist/assets/Logs-uuzU5ohI.js" with { type: 'file' };
26
+ import f23 from "../dist/assets/CopilotPanel-CH2jbbYA.js" with { type: 'file' };
27
+ import f24 from "../dist/assets/Dlq-CbLN0zQ5.js" with { type: 'file' };
28
+ import f25 from "../dist/assets/Overview-ClsyxH2e.js" with { type: 'file' };
29
+ import f26 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
30
+ import f27 from "../dist/assets/DlqPro-Cgaxtuwh.js" with { type: 'file' };
31
+ import f28 from "../dist/assets/Jobs-BTMpbAHD.js" with { type: 'file' };
32
+ import f29 from "../dist/assets/QueueDetailPro-DDGxs2J2.js" with { type: 'file' };
33
+ import f30 from "../dist/assets/Settings-z9k4EVa_.js" with { type: 'file' };
34
+ import f31 from "../dist/assets/controlConnectionEpoch-CZsS0wAb.js" with { type: 'file' };
35
+ import f32 from "../dist/assets/AddJob-FNaPbs_V.js" with { type: 'file' };
36
+ import f33 from "../dist/assets/AreaChart-DEAalJ6P.js" with { type: 'file' };
37
+ import f34 from "../dist/assets/MetricsPro-BR2ULqIc.js" with { type: 'file' };
38
+ import f35 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
39
+ import f36 from "../dist/assets/UsagePro-DLuwnM8n.js" with { type: 'file' };
40
+ import f37 from "../dist/assets/Diagnostics-CPqhV3er.js" with { type: 'file' };
41
+ import f38 from "../dist/assets/Database-BzEkXws0.js" with { type: 'file' };
42
+ import f39 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
43
+ import f40 from "../dist/assets/QueueControl-BW0XXd0B.js" with { type: 'file' };
44
+ import f41 from "../dist/assets/dist-DpZcbP9W.js" with { type: 'file' };
45
+ import f42 from "../dist/assets/Queues-DkPuIy1C.js" with { type: 'file' };
46
+ import f43 from "../dist/assets/bq-F5BbTG1T.js" with { type: 'file' };
47
+ import f44 from "../dist/assets/QueuesOverview-COo-V8D_.js" with { type: 'file' };
48
+ import f45 from "../dist/assets/S3BackupPro-DxNVFvY1.js" with { type: 'file' };
49
+ import f46 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
50
+ import f47 from "../dist/assets/useServerActionGuard-uGePilQQ.js" with { type: 'file' };
51
+ import f48 from "../dist/assets/ServerControl-B0Po974t.js" with { type: 'file' };
52
+ import f49 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
53
+ import f50 from "../dist/assets/Fleet-Bdrj9bLI.js" with { type: 'file' };
54
+ import f51 from "../dist/assets/index-mID5W7vq.js" with { type: 'file' };
55
+ import f52 from "../dist/assets/upstreamPaths-DQeKSxGc.js" with { type: 'file' };
56
+ import f53 from "../dist/assets/useControlActionGuard-B-bzKZKI.js" with { type: 'file' };
57
+ import f54 from "../dist/assets/WorkersPro-BYaredE9.js" with { type: 'file' };
58
+ import f55 from "../dist/assets/api-BgWE-705.js" with { type: 'file' };
59
+ import f56 from "../dist/assets/Metrics-DKyBZoFa.js" with { type: 'file' };
60
+ import f57 from "../dist/assets/useThroughputSeries-DgO8uicf.js" with { type: 'file' };
61
+ import f58 from "../dist/assets/Alerts-BvWBv-z7.js" with { type: 'file' };
62
+ import f59 from "../dist/assets/DlqControl-C5Bgzmk0.js" with { type: 'file' };
63
+ import f60 from "../dist/assets/toastStore-IZn6OPLZ.js" with { type: 'file' };
64
+ import f61 from "../dist/assets/QueueDetail-C1dXXN70.js" with { type: 'file' };
65
+ import f62 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
66
+ import f63 from "../dist/assets/format-Cg7VCIZW.js" with { type: 'file' };
67
+ import f64 from "../dist/assets/JobInspector-DsOt4mLJ.js" with { type: 'file' };
68
+ import f65 from "../dist/assets/LogsPro-DHWbhWyq.js" with { type: 'file' };
69
+ import f66 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
70
+ import f67 from "../dist/assets/QueueActions-BWnmNEqV.js" with { type: 'file' };
71
+ import f68 from "../dist/assets/CronManager-B6xLLgI5.js" with { type: 'file' };
72
+ import f69 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
73
+ import f70 from "../dist/assets/JobsPro-BfXTm9gH.js" with { type: 'file' };
74
+ import f71 from "../dist/assets/Flows-BtUGOaif.js" with { type: 'file' };
75
+ import f72 from "../dist/assets/Benchmark-BywalSmU.js" with { type: 'file' };
76
+ import f73 from "../dist/assets/Workflows-DZZA6aGW.js" with { type: 'file' };
77
+ import f74 from "../dist/assets/index-C9yGKhQ8.css" with { type: 'file' };
78
+ import f75 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
79
+ import f76 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
80
+ import f77 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
81
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' };
82
+ import f79 from "../dist/assets/install-D4uRZ7XA.js" with { type: 'file' };
83
+ import f80 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
84
84
  import f81 from "../dist/.vite/manifest.json" with { type: 'file' };
85
85
 
86
86
  export const ASSETS: Record<string, string> = {
@@ -88,82 +88,82 @@ export const ASSETS: Record<string, string> = {
88
88
  "/favicon.svg": f1,
89
89
  "/og.png": f2,
90
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,
91
+ "/assets/Cron-1DZTZWXO.js": f4,
92
+ "/assets/Webhooks-DT2LK17V.js": f5,
93
+ "/assets/McpServer-BqmbhrKh.js": f6,
94
+ "/assets/flowMutationSafety-YKTHxqKv.js": f7,
95
+ "/assets/BulkAddJobs-IiL1uud0.js": f8,
96
+ "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f9,
97
+ "/assets/icons-BVzwsfbG.js": f10,
98
+ "/assets/Workers-CVo9rJ_V.js": f11,
99
+ "/assets/feedback-QDN1AsYt.js": f12,
100
+ "/assets/connectionStore-BJLihGaC.js": f13,
101
+ "/assets/react-vendor-CvwrP0tU.js": f14,
102
+ "/assets/S3Backup-DNABHR2Q.js": f15,
103
+ "/assets/StatusBadge-BoOVTnKu.js": f16,
104
+ "/assets/Button-Ch1W94fJ.js": f17,
105
+ "/assets/exportFile-C7xhE8Yh.js": f18,
106
+ "/assets/Usage-cdWDQUaq.js": f19,
107
+ "/assets/responses-BkR2JTH9.js": f20,
108
+ "/assets/dist-DjvZiKhB.js": f21,
109
+ "/assets/Logs-uuzU5ohI.js": f22,
110
+ "/assets/CopilotPanel-CH2jbbYA.js": f23,
111
+ "/assets/Dlq-CbLN0zQ5.js": f24,
112
+ "/assets/Overview-ClsyxH2e.js": f25,
113
+ "/assets/form-C4oby9pI.js": f26,
114
+ "/assets/DlqPro-Cgaxtuwh.js": f27,
115
+ "/assets/Jobs-BTMpbAHD.js": f28,
116
+ "/assets/QueueDetailPro-DDGxs2J2.js": f29,
117
+ "/assets/Settings-z9k4EVa_.js": f30,
118
+ "/assets/controlConnectionEpoch-CZsS0wAb.js": f31,
119
+ "/assets/AddJob-FNaPbs_V.js": f32,
120
+ "/assets/AreaChart-DEAalJ6P.js": f33,
121
+ "/assets/MetricsPro-BR2ULqIc.js": f34,
122
+ "/assets/Pagination-x-Cwgrul.js": f35,
123
+ "/assets/UsagePro-DLuwnM8n.js": f36,
124
+ "/assets/Diagnostics-CPqhV3er.js": f37,
125
+ "/assets/Database-BzEkXws0.js": f38,
126
+ "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f39,
127
+ "/assets/QueueControl-BW0XXd0B.js": f40,
128
+ "/assets/dist-DpZcbP9W.js": f41,
129
+ "/assets/Queues-DkPuIy1C.js": f42,
130
+ "/assets/bq-F5BbTG1T.js": f43,
131
+ "/assets/QueuesOverview-COo-V8D_.js": f44,
132
+ "/assets/S3BackupPro-DxNVFvY1.js": f45,
133
+ "/assets/cn-zFEt5SO8.js": f46,
134
+ "/assets/useServerActionGuard-uGePilQQ.js": f47,
135
+ "/assets/ServerControl-B0Po974t.js": f48,
136
+ "/assets/PageHeader-CvIyaFOO.js": f49,
137
+ "/assets/Fleet-Bdrj9bLI.js": f50,
138
+ "/assets/index-mID5W7vq.js": f51,
139
+ "/assets/upstreamPaths-DQeKSxGc.js": f52,
140
+ "/assets/useControlActionGuard-B-bzKZKI.js": f53,
141
+ "/assets/WorkersPro-BYaredE9.js": f54,
142
+ "/assets/api-BgWE-705.js": f55,
143
+ "/assets/Metrics-DKyBZoFa.js": f56,
144
+ "/assets/useThroughputSeries-DgO8uicf.js": f57,
145
+ "/assets/Alerts-BvWBv-z7.js": f58,
146
+ "/assets/DlqControl-C5Bgzmk0.js": f59,
147
+ "/assets/toastStore-IZn6OPLZ.js": f60,
148
+ "/assets/QueueDetail-C1dXXN70.js": f61,
149
+ "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f62,
150
+ "/assets/format-Cg7VCIZW.js": f63,
151
+ "/assets/JobInspector-DsOt4mLJ.js": f64,
152
+ "/assets/LogsPro-DHWbhWyq.js": f65,
153
+ "/assets/dist-1f1fMHVO.js": f66,
154
+ "/assets/QueueActions-BWnmNEqV.js": f67,
155
+ "/assets/CronManager-B6xLLgI5.js": f68,
156
+ "/assets/promisePool-BVfQ9n9Q.js": f69,
157
+ "/assets/JobsPro-BfXTm9gH.js": f70,
158
+ "/assets/Flows-BtUGOaif.js": f71,
159
+ "/assets/Benchmark-BywalSmU.js": f72,
160
+ "/assets/Workflows-DZZA6aGW.js": f73,
161
+ "/assets/index-C9yGKhQ8.css": f74,
162
+ "/assets/Card-CWxrC8OY.js": f75,
163
+ "/assets/dist-BlWBaCN6.js": f76,
164
+ "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f77,
165
165
  "/assets/jobActions-LQD4KfCc.js": f78,
166
- "/assets/dist-DZL8soAh.js": f79,
167
- "/assets/flowMutationSafety-DSd3JLAV.js": f80,
166
+ "/assets/install-D4uRZ7XA.js": f79,
167
+ "/assets/dist-DZL8soAh.js": f80,
168
168
  "/.vite/manifest.json": f81,
169
169
  };
@@ -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};
@@ -1 +0,0 @@
1
- import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CvwrP0tU.js";import{t as r}from"./bq-Qh0VFLKV.js";import{n as i}from"./usePolledData-0CVelkl2.js";import{t as a}from"./Button-Ch1W94fJ.js";import{n as o,t as s}from"./Card-CWxrC8OY.js";import{i as c,n as l,r as u}from"./feedback-QDN1AsYt.js";import{n as d}from"./StatusBadge-BoOVTnKu.js";import{t as f}from"./PageHeader-CvIyaFOO.js";import{s as p}from"./format-Cg7VCIZW.js";import{n as m}from"./index-ByvrmBif.js";import{a as h,n as g,t as _}from"./form-C4oby9pI.js";import{r as v}from"./useServerActionGuard-uGePilQQ.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as ee}from"./QueueActions-D51CYOjo.js";var T=e(t(),1),E={limits:async(e,t)=>k(await r.queueOperations.limits(e,t)),group:async(e,t,n,i)=>D(await r.queueOperations.group(e,t,n,i)),setGroupRateLimit:async(e,t,n,i)=>{O(await r.queueOperations.setGroupRateLimit(e,t,n,i))},removeGroupRateLimit:async(e,t)=>j(await r.queueOperations.removeGroupRateLimit(e,t)),setGroupConcurrency:async(e,t,n)=>{O(await r.queueOperations.setGroupConcurrency(e,t,n))},removeGroupConcurrency:async(e,t)=>j(await r.queueOperations.removeGroupConcurrency(e,t)),deduplicationJobId:async(e,t)=>A(await r.queueOperations.deduplicationJobId(e,t)),removeDeduplicationKey:async(e,t)=>j(await r.queueOperations.removeDeduplicationKey(e,t)),metrics:async(e,t,n,i)=>M(await r.queueOperations.metrics(e,t,n,i)),trimEvents:async(e,t)=>j(await r.queueOperations.trimEvents(e,t))};function D(e){let t=P(N(e,`Queue group`).group,`Queue group`),n=t.rateLimit;if(!L(t.jobs,0)||!L(t.active,0)||!L(t.totalGrouped,0)||n!==null&&(!F(n)||!I(n.max)||!I(n.duration))||!L(t.rateLimitTtl,-2)||t.concurrency!==null&&!I(t.concurrency))throw R(`Queue group`);return t}function O(e){if(N(e,`Queue mutation`).applied!==!0)throw R(`Queue mutation`)}function k(e){let t=P(N(e,`Queue limits`).limits,`Queue limits`),n=t.rateLimit;if(n!==null&&(!F(n)||!I(n.max)||!I(n.duration))||t.concurrency!==null&&!I(t.concurrency)||!L(t.rateLimitTtl,-2)||typeof t.maxed!=`boolean`)throw R(`Queue limits`);return{rateLimit:n,concurrency:t.concurrency,rateLimitTtl:t.rateLimitTtl,maxed:t.maxed}}function A(e){let t=N(e,`deduplication lookup`).jobId;if(t!==null&&(typeof t!=`string`||!t))throw R(`deduplication lookup`);return t}function j(e){let t=N(e,`Queue mutation`).removed;if(!L(t,0))throw R(`Queue mutation`);return t}function M(e){let t=P(N(e,`Queue metrics`).metrics,`Queue metrics`),n=P(t.meta,`Queue metrics`);if(!L(n.count,0)||!L(n.prevTS,0)||!L(n.prevCount,0)||!L(t.count,0)||!Array.isArray(t.data)||t.data.length>10001||!t.data.every(e=>L(e,0)))throw R(`Queue metrics`);return t}function N(e,t){let n=P(e,t);if(n.ok!==!0)throw R(t);return n}function P(e,t){if(!F(e))throw R(t);return e}function F(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}var I=e=>L(e,1),L=(e,t)=>Number.isSafeInteger(e)&&e>=t,R=e=>Error(`Malformed ${e} response`),z=n();function te({queue:e,repository:t,busy:n,run:r}){let[i,o]=(0,T.useState)(``),[s,c]=(0,T.useState)(),[l,u]=(0,T.useState)(``),d=i.length>0&&i.length<=1024;return(0,z.jsxs)(`section`,{"aria-labelledby":`queue-dedup-title`,className:`border-t border-line pt-4 xl:border-t-0`,children:[(0,z.jsx)(`h3`,{id:`queue-dedup-title`,className:`text-sm font-semibold text-fg`,children:`Deduplication registry`}),(0,z.jsx)(`p`,{className:`mt-1 mb-4 text-xs leading-5 text-faint`,children:`Resolve an official deduplication ID to its current job, or release only the registry key.`}),(0,z.jsx)(_,{label:`Deduplication ID`,children:(0,z.jsx)(g,{name:`queue-sdk-deduplication-id`,autoComplete:`off`,spellCheck:!1,maxLength:1024,value:i,onChange:e=>{o(e.target.value),c(void 0),u(``)}})}),(0,z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,z.jsx)(a,{size:`sm`,disabled:!d||!!n,onClick:()=>r(`Looking up deduplication key`,()=>t.deduplicationJobId(e,i),c),children:`Find owner`}),(0,z.jsx)(a,{variant:`warning`,size:`sm`,disabled:!d||!!n,onClick:()=>{window.confirm(`Remove deduplication key "${i}" from queue "${e}"? The job is not deleted, but a later enqueue may reuse this key.`)&&r(`Removing deduplication key`,()=>t.removeDeduplicationKey(e,i),e=>{u(e?`Deduplication key removed.`:`No matching key was active.`),c(void 0)},!0)},children:`Remove key`})]}),s!==void 0&&(0,z.jsx)(`p`,{role:`status`,className:`mt-3 break-all text-xs text-muted`,children:s===null?`No active owner.`:`Current job: ${s}`}),l&&(0,z.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:l})]})}function ne({queue:e,repository:t,busy:n,run:r}){let[i,o]=(0,T.useState)(`default`),[s,c]=(0,T.useState)(``),[l,u]=(0,T.useState)(`100`),[d,f]=(0,T.useState)(`100`),[p,m]=(0,T.useState)(`60000`),[h,v]=(0,T.useState)(`1`),[y,b]=(0,T.useState)(null),x=re(i);return(0,z.jsxs)(`section`,{className:`xl:col-span-2`,"aria-labelledby":`queue-groups-title`,children:[(0,z.jsx)(`h3`,{id:`queue-groups-title`,className:`mb-3 text-sm font-medium text-fg`,children:`Groups`}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3 xl:grid-cols-6`,children:[(0,z.jsx)(_,{label:`Group ID`,children:(0,z.jsx)(g,{value:i,maxLength:256,onChange:e=>o(e.target.value)})}),(0,z.jsx)(_,{label:`TTL maxJobs`,hint:`Optional`,children:(0,z.jsx)(g,{type:`number`,min:0,value:s,onChange:e=>c(e.target.value)})}),(0,z.jsx)(_,{label:`Groups maxCount`,children:(0,z.jsx)(g,{type:`number`,min:1,value:l,onChange:e=>u(e.target.value)})}),(0,z.jsx)(_,{label:`Rate max`,children:(0,z.jsx)(g,{type:`number`,min:1,value:d,onChange:e=>f(e.target.value)})}),(0,z.jsx)(_,{label:`Duration (ms)`,children:(0,z.jsx)(g,{type:`number`,min:1,value:p,onChange:e=>m(e.target.value)})}),(0,z.jsx)(_,{label:`Concurrency`,children:(0,z.jsx)(g,{type:`number`,min:1,value:h,onChange:e=>v(e.target.value)})})]}),(0,z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,z.jsx)(a,{size:`sm`,disabled:!!n||!x,onClick:()=>{let n=H(s,0),i=H(l,1);!x||n===null||i===null||r(`Reading group`,()=>t.group(e,x,n,i),b)},children:`Read group`}),(0,z.jsx)(a,{size:`sm`,disabled:!!n||!x,onClick:()=>{let n=V(d),i=V(p);!x||n===null||i===null||r(`Setting group rate limit`,async()=>(await t.setGroupRateLimit(e,x,n,i),t.group(e,x)),b,!0)},children:`Set rate limit`}),(0,z.jsx)(a,{size:`sm`,disabled:!!n||!x,onClick:()=>r(`Clearing group rate limit`,async()=>(await t.removeGroupRateLimit(e,x),t.group(e,x)),b,!0),children:`Clear rate limit`}),(0,z.jsx)(a,{size:`sm`,disabled:!!n||!x,onClick:()=>{let n=V(h);!x||n===null||r(`Setting group concurrency`,async()=>(await t.setGroupConcurrency(e,x,n),t.group(e,x)),b,!0)},children:`Set concurrency`}),(0,z.jsx)(a,{size:`sm`,disabled:!!n||!x,onClick:()=>r(`Clearing group concurrency`,async()=>(await t.removeGroupConcurrency(e,x),t.group(e,x)),b,!0),children:`Clear concurrency`})]}),!x&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:`Group ID must contain 1–256 characters and no NUL.`}),y&&(0,z.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 rounded-lg border border-line p-3 text-xs sm:grid-cols-6`,children:[(0,z.jsx)(B,{label:`Jobs`,value:y.jobs}),(0,z.jsx)(B,{label:`Active`,value:y.active}),(0,z.jsx)(B,{label:`All grouped`,value:y.totalGrouped}),(0,z.jsx)(B,{label:`Rate`,value:y.rateLimit?`${y.rateLimit.max}/${y.rateLimit.duration}ms`:`None`}),(0,z.jsx)(B,{label:`TTL`,value:`${y.rateLimitTtl} ms`}),(0,z.jsx)(B,{label:`Concurrency`,value:y.concurrency??`None`})]})]})}function B({label:e,value:t}){return(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-faint`,children:e}),(0,z.jsx)(`dd`,{className:`mt-1 font-mono text-fg`,children:t})]})}var re=e=>e.length>=1&&e.length<=256&&!e.includes(`\0`)?e:null,V=e=>{let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:null},H=(e,t)=>{if(!e.trim())return;let n=Number(e);return Number.isSafeInteger(n)&&n>=t?n:null};function ie({snapshot:e,loading:t,error:n}){if(t&&!e)return(0,z.jsx)(`p`,{className:`text-sm text-muted`,children:`Reading broker limit state...`});if(n&&!e)return(0,z.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:n});if(!e)return null;let r=e.rateLimit;return(0,z.jsxs)(`div`,{children:[n&&(0,z.jsxs)(`p`,{role:`alert`,className:`mb-3 text-xs text-warning`,children:[`Refresh failed. Showing the last successful limit snapshot: `,n]}),(0,z.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,z.jsx)(U,{label:`Global rate limit`,value:r?`${r.max} / ${r.duration} ms`:`Not configured`}),(0,z.jsx)(U,{label:`Rate-limit TTL`,value:e.rateLimitTtl===-2?`No active limit`:`${e.rateLimitTtl} ms`}),(0,z.jsx)(U,{label:`Global concurrency`,value:e.concurrency===null?`Not configured`:String(e.concurrency)}),(0,z.jsx)(U,{label:`Capacity`,value:e.maxed?`Maxed`:`Available`})]})]})}function U({label:e,value:t}){return(0,z.jsxs)(`div`,{className:`min-w-0 border-l-2 border-line pl-3`,children:[(0,z.jsx)(`dt`,{className:`text-[11px] font-medium text-faint`,children:e}),(0,z.jsx)(`dd`,{className:`mt-1 break-words font-mono text-sm text-fg`,children:t})]})}function ae({queue:e,repository:t,busy:n,run:r}){let[i,o]=(0,T.useState)(`completed`),[s,c]=(0,T.useState)(`0`),[l,u]=(0,T.useState)(`29`),[d,f]=(0,T.useState)(`1000`),[p,m]=(0,T.useState)(null),[v,y]=(0,T.useState)(``),b=se(s,l),x=W(d,0,1e6);return(0,z.jsxs)(`section`,{"aria-labelledby":`queue-telemetry-title`,className:`border-t border-line pt-4 xl:border-t-0`,children:[(0,z.jsx)(`h3`,{id:`queue-telemetry-title`,className:`text-sm font-semibold text-fg`,children:`Durable queue telemetry`}),(0,z.jsx)(`p`,{className:`mt-1 mb-4 text-xs leading-5 text-faint`,children:`Read paged one-minute completion or failure buckets, and bound the lifecycle-event journal.`}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,z.jsx)(_,{label:`Metric`,children:(0,z.jsxs)(h,{name:`queue-sdk-metric-type`,value:i,onChange:e=>o(e.target.value),children:[(0,z.jsx)(`option`,{value:`completed`,children:`Completed`}),(0,z.jsx)(`option`,{value:`failed`,children:`Failed`})]})}),(0,z.jsx)(_,{label:`Start bucket`,children:(0,z.jsx)(g,{name:`queue-sdk-metric-start`,type:`number`,min:0,max:1e4,value:s,onChange:e=>c(e.target.value)})}),(0,z.jsx)(_,{label:`End bucket`,hint:`Use -1 for all remaining buckets`,children:(0,z.jsx)(g,{name:`queue-sdk-metric-end`,type:`number`,min:-1,max:1e4,value:l,onChange:e=>u(e.target.value)})})]}),(0,z.jsx)(a,{className:`mt-3`,size:`sm`,disabled:!b||!!n,onClick:()=>{b&&r(`Reading ${i} metrics`,()=>t.metrics(e,i,b.start,b.end),m)},children:`Read metrics`}),!b&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:`Use integer buckets from 0 to 10000; end must be -1 or at least start.`}),p&&(0,z.jsx)(oe,{metrics:p}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-end gap-3 border-t border-line pt-4`,children:[(0,z.jsx)(`div`,{className:`min-w-48 flex-1`,children:(0,z.jsx)(_,{label:`Retain lifecycle events`,hint:`0 clears the queue journal`,children:(0,z.jsx)(g,{name:`queue-sdk-event-retention`,type:`number`,min:0,max:1e6,value:d,onChange:e=>f(e.target.value)})})}),(0,z.jsx)(a,{variant:`warning`,size:`sm`,disabled:x===null||!!n,onClick:()=>{x!==null&&window.confirm(`Retain at most ${x} lifecycle events for queue "${e}"? Older journal events are permanently removed; metric buckets are unchanged.`)&&r(`Trimming lifecycle journal`,()=>t.trimEvents(e,x),e=>y(`${e} lifecycle events removed.`),!0)},children:`Trim journal`})]}),v&&(0,z.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:v})]})}function oe({metrics:e}){let t=e.data.slice(0,120).map((t,n)=>({timestamp:e.meta.prevTS-n*6e4,value:t,offset:n})),n=Math.max(1,...t.map(e=>e.value));return(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-2 p-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 font-mono text-xs text-muted`,children:[(0,z.jsxs)(`span`,{children:[`Total terminal: `,e.meta.count]}),(0,z.jsxs)(`span`,{children:[`Available buckets: `,e.count]}),(0,z.jsxs)(`span`,{children:[`Latest bucket: `,e.meta.prevCount]})]}),t.length?(0,z.jsx)(`div`,{className:`mt-3 flex h-16 items-end gap-px overflow-hidden`,role:`img`,"aria-label":`${t.length} one-minute metric buckets, newest first`,children:t.map(e=>(0,z.jsx)(`span`,{title:`Bucket ${e.offset}: ${e.value}`,className:`min-w-px flex-1 bg-accent/70`,style:{height:`${Math.max(2,e.value/n*100)}%`}},e.timestamp))}):(0,z.jsx)(`p`,{className:`mt-3 text-xs text-faint`,children:`No buckets in this range.`}),e.data.length>t.length&&(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Showing the first 120 returned buckets.`})]})}function se(e,t){let n=W(e,0,1e4),r=W(t,-1,1e4);return n===null||r===null||r!==-1&&r<n?null:{start:n,end:r}}function W(e,t,n){let r=Number(e);return Number.isSafeInteger(r)&&r>=t&&r<=n?r:null}function ce({queue:e,refreshKey:t=0,repository:n=E,onApplied:r}){let[i,c]=(0,T.useState)(``),[l,u]=(0,T.useState)(null),[d,f]=(0,T.useState)(``),[p,m]=(0,T.useState)(``),h=(0,T.useRef)(!1),v=(0,T.useRef)(0),y=(0,T.useRef)(!0),b=l?.queue===e?l:{queue:e,snapshot:null,loading:!0,error:``};(0,T.useEffect)(()=>(y.current=!0,()=>{y.current=!1,v.current+=1}),[]);let x=(0,T.useCallback)(async()=>{let t=le(i);if(t===null){u(t=>({queue:e,snapshot:t?.queue===e?t.snapshot:null,loading:!1,error:`maxJobs must be a whole number from 0 to 1000000.`}));return}let r=++v.current;u(t=>({queue:e,snapshot:t?.queue===e?t.snapshot:null,loading:!0,error:``}));try{let i=await n.limits(e,t);y.current&&r===v.current&&u({queue:e,snapshot:i,loading:!1,error:``})}catch(t){y.current&&r===v.current&&u({queue:e,snapshot:null,loading:!1,error:G(t)})}},[i,e,n]);(0,T.useEffect)(()=>void x(),[e,t]);let S=(e,t,n,i=!1)=>{h.current||(h.current=!0,f(e),m(``),t().then(e=>{y.current&&(n(e),i&&(r?.(),r||x()))}).catch(e=>{y.current&&m(G(e))}).finally(()=>{h.current=!1,y.current&&f(``)}))};return(0,z.jsxs)(s,{className:`mb-6`,children:[(0,z.jsx)(o,{title:`Queue SDK operations`,action:d?(0,z.jsxs)(`span`,{className:`font-mono text-xs text-accent`,children:[d,`...`]}):void 0}),(0,z.jsx)(`p`,{className:`mb-5 max-w-3xl text-xs leading-5 text-faint`,children:`Live Bunqueue 2.9.2 limit, group, deduplication, metric, and event-journal contracts. Requests are pinned to the server managed by this control agent.`}),(0,z.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-end gap-3 border-b border-line pb-5`,children:[(0,z.jsx)(`div`,{className:`w-48`,children:(0,z.jsx)(_,{label:`TTL threshold (maxJobs)`,hint:`Optional token-consumption threshold`,children:(0,z.jsx)(g,{name:`queue-sdk-max-jobs`,type:`number`,min:0,max:1e6,step:1,value:i,onChange:e=>c(e.target.value),placeholder:`Not set`})})}),(0,z.jsx)(a,{size:`sm`,disabled:b.loading||!!d,onClick:x,children:`Refresh limits`})]}),(0,z.jsx)(ie,{snapshot:b.snapshot,loading:b.loading,error:b.error}),p&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p}),(0,z.jsxs)(`div`,{className:`mt-6 grid gap-6 xl:grid-cols-[0.8fr_1.2fr]`,children:[(0,z.jsx)(ne,{queue:e,repository:n,busy:d,run:S},`${e}:groups`),(0,z.jsx)(te,{queue:e,repository:n,busy:d,run:S},`${e}:deduplication`),(0,z.jsx)(ae,{queue:e,repository:n,busy:d,run:S},`${e}:telemetry`)]})]})}function le(e){if(!e.trim())return;let t=Number(e);return Number.isSafeInteger(t)&&t>=0&&t<=1e6?t:null}var G=e=>e instanceof Error?e.message:String(e),K=[`waiting`,`prioritized`,`active`,`completed`,`failed`,`delayed`,`waiting-children`,`paused`],q=500,J=200,Y=q*J;function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function ue(e){return X(e)&&K.every(t=>Z(e[t]))}function Q(e,t){if(!X(e)||e.ok!==!0||!Array.isArray(e.queues)||!Z(e.total)||!Z(e.limit)||e.limit<1||!Z(e.offset)||e.offset!==t||typeof e.timestamp!=`number`||!Number.isFinite(e.timestamp)||!e.queues.every(e=>X(e)&&typeof e.name==`string`&&e.name.length>0&&Z(e.waiting)&&Z(e.delayed)&&Z(e.active)&&Z(e.dlq)&&typeof e.paused==`boolean`))throw Error(`Malformed /dashboard/queues response.`)}async function $(){let e=await r.queues(q,0);Q(e,0);let t=e.total;if(t>Y)throw Error(`Queue discovery reported ${t} queues, above the safe dashboard limit of ${Y}.`);if(e.queues.length!==Math.min(q,t))throw Error(`Incomplete /dashboard/queues page at offset 0: expected ${Math.min(q,t)} queues, received ${e.queues.length}.`);let n=new Map,i=e=>{for(let t of e.queues){if(n.has(t.name))throw Error(`Overlapping /dashboard/queues pages: queue "${t.name}" appeared more than once.`);n.set(t.name,t)}};i(e);let a=e.queues.length,o=1;for(;a<t;){if(o>=J)throw Error(`Queue discovery exceeded the safe limit of ${J} pages.`);let e=await r.queues(q,a);if(Q(e,a),e.total!==t)throw Error(`Queue discovery changed during pagination: total moved from ${t} to ${e.total}. Retry the snapshot.`);let n=Math.min(q,t-a);if(e.queues.length!==n)throw Error(`Incomplete /dashboard/queues page at offset ${a}: expected ${n} queues, received ${e.queues.length}.`);i(e),a+=e.queues.length,o+=1}if(n.size!==t)throw Error(`Incomplete /dashboard/queues snapshot: expected ${t} unique queues, received ${n.size}.`);return{...e,queues:[...n.values()],total:t,limit:q,offset:0}}function de(e,t){if(!X(e)||e.ok!==!0||e.name!==t||typeof e.paused!=`boolean`||!ue(e.counts))throw Error(`Malformed queue detail response for "${t}".`)}function fe(e){if(!X(e)||e.ok!==!0||!w(e.config))throw Error(`Malformed /stall-config response.`);return e.config}function pe(e){if(!X(e)||e.ok!==!0||!S(e.config))throw Error(`Malformed /dlq-config response.`);return e.config}function me(e){if(!X(e)||e.ok!==!0)throw Error(`Malformed queue action response: expected { ok: true }.`);if(e.count!==void 0){if(!Z(e.count))throw Error(`Malformed queue action response: count must be a non-negative integer.`);return e.count}}function he(e,t){return t.some(t=>t.name===e)?e:t[0]?.name??``}function ge(){let[e,t]=(0,T.useState)(``),[n,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(0),[g,_]=(0,T.useState)(null),S=v(`queue-control:${e}`);(0,T.useEffect)(()=>{a(!1),_(null)},[S.scopeKey]);let{data:w,error:E,loading:D,refetch:O}=i($,[],{intervalMs:3e4});(0,T.useEffect)(()=>{w&&t(e=>he(e,w.queues))},[w]);let{data:k,error:A,loading:j,refetch:M}=i((0,T.useCallback)(async()=>{if(!e)return null;let[t,n,i]=await Promise.all([r.queueDetail(e,!1),r.getStallConfig(e).then(fe).catch(()=>null),r.getDlqConfig(e).then(pe).catch(()=>null)]);return de(t,e),{queue:e,detail:t,stall:n,dlq:i}},[e]),[e]),N=!w||w.queues.some(t=>t.name===e),P=k?.queue===e&&N?k:null,F=(t,n,i,o)=>{let c=e;if(!c||i&&!window.confirm(i))return;let l=S.begin(`queue-write`);l&&(a(!0),_(null),(async()=>{try{let e=await r.queuesSummary();if(!l.isCurrent())return;if(!e.some(e=>e.name===c))throw Error(`Queue "${c}" no longer exists`);let i=me(await n());if(!l.isCurrent())return;_({queue:c,ok:!0,text:`${t}${i==null?` ✓`:`: ${i}`}`}),o?.(),s(e=>e+1),await M()}catch(e){l.isCurrent()&&_({queue:c,ok:!1,text:e.message})}finally{l.finish()&&a(!1)}})())};return(0,z.jsxs)(`div`,{children:[(0,z.jsx)(f,{title:`Queue Control`,description:`Full per-queue operations and configuration.`,live:!!e&&!!P?.detail&&!!P.stall&&!!P.dlq&&!A&&!E}),(0,z.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(`div`,{className:`w-56`,children:(0,z.jsx)(h,{value:e,"aria-label":`Queue`,name:`queue-control-queue`,autoComplete:`off`,onChange:e=>t(e.target.value),children:(w?.queues??[]).map(e=>(0,z.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),P?.detail&&(0,z.jsx)(d,{label:P.detail.paused?`Paused`:`Active`,tone:P.detail.paused?`amber`:`green`}),g?.queue===e&&(0,z.jsx)(`span`,{role:`status`,className:g.ok?`text-xs text-success`:`text-xs text-danger`,children:g.text})]}),E&&(0,z.jsx)(c,{onRetry:O,message:`Could not discover queues — ${E.message}. Retry to choose a queue.`}),A&&P&&(0,z.jsx)(c,{message:`Queue refresh failed — showing the last successful configuration.`,onRetry:M}),A&&!P?(0,z.jsx)(l,{error:A,onRetry:M}):D&&!w&&!e&&!E?(0,z.jsx)(u,{label:`Discovering queues…`}):j&&!P?(0,z.jsx)(u,{}):E&&!e?(0,z.jsx)(`p`,{role:`alert`,className:`text-sm text-warning`,children:`Queue discovery failed. Retry the request above before choosing a queue.`}):P?.detail?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-8`,children:K.map(e=>(0,z.jsx)(m,{label:e,value:p(P.detail.counts[e]),compact:!0},e))}),(0,z.jsx)(x,{queue:e,paused:P.detail.paused,busy:n,run:F},`${e}:lifecycle`),(0,z.jsx)(ee,{queue:e,busy:n,run:F},`${e}:limits`),(0,z.jsx)(ce,{queue:e,refreshKey:o,onApplied:()=>s(e=>e+1)},`${e}:sdk-operations`),(0,z.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[P.stall?(0,z.jsx)(b,{queue:e,config:P.stall,onSaved:async()=>{_({queue:e,ok:!0,text:`Stall config saved ✓`}),await M()}},`${e}:stall`):(0,z.jsx)(C,{title:`Stall detection`,onRetry:M}),P.dlq?(0,z.jsx)(y,{queue:e,config:P.dlq,onSaved:async()=>{_({queue:e,ok:!0,text:`DLQ config saved ✓`}),await M()}},`${e}:dlq`):(0,z.jsx)(C,{title:`DLQ policy`,onRetry:M})]})]}):!A&&(0,z.jsx)(`p`,{className:`text-sm text-faint`,children:w?.queues.length===0?`No queues are available.`:`Select a queue.`})]})}export{ge as QueueControl,$ as t};
@@ -1 +0,0 @@
1
- import{a as e,i as t,n,r}from"./connectionStore-BJLihGaC.js";import{a as i,i as a,n as o,r as s,s as c}from"./upstreamPaths-B_cyinGI.js";var l=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`BqError`}},u=3e4,d=()=>u;async function f(e,t,n,r,i=!0,a=`server`,o=[],s=u){let c=AbortSignal.timeout(s),d=r?.signal?AbortSignal.any([r.signal,c]):c,f=new Headers(n);r?.headers&&new Headers(r.headers).forEach((e,t)=>{f.set(t,e)}),r?.body!=null&&!f.has(`Content-Type`)&&f.set(`Content-Type`,`application/json`);let p;try{p=await fetch(e+t,{...r,headers:f,signal:d})}catch(e){throw c.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new l(`Request timed out`,0):e}if(!p.ok&&!o.includes(p.status)){let t=`HTTP ${p.status}`;try{let e=await p.json();e?.error&&(t=e.error)}catch{}throw p.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:a,auth:f.get(`Authorization`)??void 0,target:e}})),new l(t,p.status)}if(p.status===204)return;let m;try{m=await p.text()}catch(e){throw c.aborted&&!r?.signal?.aborted?new l(`Request timed out`,0):e}if(!m)return;let h;try{h=JSON.parse(m)}catch{throw new l(`Invalid JSON response (HTTP ${p.status})`,p.status)}if(i&&h&&typeof h==`object`&&h.ok===!1)throw new l(h.error??`Operation failed`,p.status);return h}var p=(n,r,i=!0,a=[],o=u)=>f(e(),n,t(),r,i,`server`,a,o),m=()=>r(),h=(e,t,r=u)=>f(m(),e,n(),t,!0,`agent`,[],r),g=(e,t)=>({method:e,body:t===void 0?void 0:JSON.stringify(t)}),_=3e5,v=(e,t)=>g(e,t),y=new WeakMap,b=new WeakMap;function x(){let n=Object.freeze({baseUrl:e()});return y.set(n,Object.freeze({...t()})),n}function S(){let e=Object.freeze({baseUrl:m()});return b.set(e,Object.freeze({...n()})),e}function C(e){let t=y.get(e);if(!t)throw TypeError(`Invalid server request target.`);return t}function w(e){let t=b.get(e);if(!t)throw TypeError(`Invalid agent request target.`);return t}function ee(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function te(n){let r=C(n);if(n.baseUrl!==e()||!ee(r,t()))throw Error(`Server connection changed after confirmation was requested for ${n.baseUrl}; action refused.`)}async function T(e,t,n){n?.throwIfAborted();let r=await f(e.baseUrl,`/jobs/${i(t)}`,{...C(e)},n?{signal:n}:void 0);return n?.throwIfAborted(),r}var E=encodeURIComponent,ne={info:()=>h(`/db/info`),tables:()=>h(`/db/tables`),schema:e=>h(`/db/tables/${o(e,`Database table`)}/schema`),rows:(e,t=50,n=0,r,i=`asc`,a)=>h(`/db/tables/${o(e,`Database table`)}?limit=${t}&offset=${n}${r?`&orderBy=${E(r)}&dir=${i}`:``}${a?.value?`&fcol=${E(a.column)}&fop=${a.op}&fval=${E(a.value)}`:``}`),cell:(e,t,n)=>h(`/db/tables/${o(e,`Database table`)}/cell?rowid=${E(String(t))}&column=${E(n)}`),query:e=>h(`/db/query`,g(`POST`,{sql:e}))},re={status:()=>h(`/control/status`),start:()=>h(`/control/start`,{method:`POST`}),stop:()=>h(`/control/stop`,{method:`POST`}),restart:()=>h(`/control/restart`,{method:`POST`}),logs:()=>h(`/control/logs`),getConfig:()=>h(`/control/config`),setConfig:(e,t)=>h(`/control/config`,g(`PUT`,{...e,...t===void 0?{}:{expectedRevision:t}}))},ie={stats:()=>h(`/workflows/stats`),list:(e={})=>{let t=new URLSearchParams;return e.kind&&t.set(`kind`,e.kind),e.workflowName&&t.set(`workflowName`,e.workflowName),e.state&&t.set(`state`,e.state),e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),h(`/workflows${t.size?`?${t}`:``}`)},get:(e,t=`active`)=>h(`/workflows/${o(e,`Workflow execution id`)}?kind=${t}`)},ae=2e5,D=16*1024*1024,oe=12e4,se=64*1024,O=encodeURIComponent;async function ce(e,t,n=50,r=0,i,a=`asc`,s,c){c?.throwIfAborted();let l=await f(e.baseUrl,`/db/tables/${o(t,`Database table`)}?limit=${n}&offset=${r}${i?`&orderBy=${O(i)}&dir=${a}`:``}${s?.value?`&fcol=${O(s.column)}&fop=${s.op}&fval=${O(s.value)}`:``}`,{...w(e)},c?{signal:c}:void 0,!0,`agent`);return c?.throwIfAborted(),l}function k(e,t,n,r=!0){let i=e.get(t);if(!i||!/^\d+$/.test(i))throw new l(`Malformed database export response: invalid ${t} header.`,200);let a=Number(i);if(!Number.isSafeInteger(a)||a>n||!r&&a===0)throw new l(`Malformed database export response: invalid ${t} header.`,200);return a}async function le(e){if(!e.body)return``;let t=e.body.getReader(),n=new Uint8Array(se),r=0;try{for(;;){let e=await t.read();if(e.done)break;if(r+e.value.byteLength>n.byteLength)return t.cancel().catch(()=>void 0),``;n.set(e.value,r),r+=e.value.byteLength}}finally{t.releaseLock()}return new TextDecoder().decode(n.subarray(0,r))}async function ue(e,t,n){if(!e.body)throw new l(`Malformed database export response: missing CSV body.`,200);let r=new Uint8Array(t),i=e.body.getReader(),a=0;try{for(;;){n?.throwIfAborted();let e=await i.read();if(e.done)break;if(a+e.value.byteLength>t)throw i.cancel().catch(()=>void 0),new l(`Malformed database export response: body exceeds declared ${t} bytes.`,200);r.set(e.value,a),a+=e.value.byteLength}}finally{i.releaseLock()}if(n?.throwIfAborted(),a!==t)throw new l(`Malformed database export response: received ${a} of ${t} declared bytes.`,200);return r}function de(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`Invalid database export request.`);if(typeof e.table!=`string`||!e.table)throw TypeError(`Database export table must not be empty.`);if(e.dir!==`asc`&&e.dir!==`desc`)throw TypeError(`Invalid database export sort direction.`);if(e.orderBy!==void 0&&(typeof e.orderBy!=`string`||!e.orderBy))throw TypeError(`Database export sort column must not be empty.`);let t=e.filter;if(t&&(typeof t!=`object`||Array.isArray(t)||typeof t.column!=`string`||!t.column||typeof t.value!=`string`||!t.value||![`contains`,`eq`,`ne`].includes(t.op)))throw TypeError(`Invalid database export filter.`);return Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:t?Object.freeze({...t}):void 0})}async function fe(e,t,n){e.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:`agent`,auth:new Headers(n).get(`Authorization`)??void 0,target:t.baseUrl}}));let r=`HTTP ${e.status}`,i=await le(e);if(i)try{let e=JSON.parse(i);typeof e?.error==`string`&&(r=e.error)}catch{}return new l(r,e.status)}async function pe(e,t,n){n?.throwIfAborted();let r={...w(e)},i=de(t),a=new URLSearchParams;i.orderBy&&a.set(`orderBy`,i.orderBy),a.set(`dir`,i.dir),i.filter&&(a.set(`fcol`,i.filter.column),a.set(`fop`,i.filter.op),a.set(`fval`,i.filter.value));let s=`/db/tables/${o(i.table,`Database table`)}/export?${a}`,c=AbortSignal.timeout(oe),u=n?AbortSignal.any([n,c]):c;try{let t=await fetch(e.baseUrl+s,{headers:r,signal:u});if(!t.ok)throw await fe(t,e,r);if(t.headers.get(`X-Bunqueue-Db-Export-Version`)!==`1`)throw new l(`Malformed database export response: unsupported contract version.`,200);if(!/^text\/csv(?:;|$)/i.test(t.headers.get(`Content-Type`)??``))throw new l(`Malformed database export response: expected CSV content.`,200);let a;try{let e=t.headers.get(`X-Bunqueue-Db-Export-Table`);if(!e)throw Error(`missing`);a=decodeURIComponent(e)}catch{throw new l(`Malformed database export response: invalid table identity.`,200)}if(a!==i.table)throw new l(`Database export target changed: requested "${i.table}", received "${a}".`,200);let o=k(t.headers,`X-Bunqueue-Db-Export-Rows`,ae),c=k(t.headers,`X-Bunqueue-Db-Export-Bytes`,D,!1);if(k(t.headers,`Content-Length`,16777216,!1)!==c)throw new l(`Malformed database export response: Content-Length does not match X-Bunqueue-Db-Export-Bytes.`,200);let d=t.headers.get(`X-Bunqueue-Db-Export-Cap`);if(d!==`none`&&d!==`rows`&&d!==`bytes`)throw new l(`Malformed database export response: invalid export cap.`,200);if(d===`rows`&&o!==2e5)throw new l(`Malformed database export response: inconsistent row cap.`,200);let f=await ue(t,c,u);return n?.throwIfAborted(),{table:a,content:f,rowCount:o,bytes:c,cap:d===`none`?null:d}}catch(e){throw c.aborted&&!n?.aborted?new l(`Database export timed out`,0):e}}var me={counts:e=>p(`/queues/${c(e)}/counts`),pause:e=>p(`/queues/${c(e)}/pause`,g(`POST`)),resume:e=>p(`/queues/${c(e)}/resume`,g(`POST`)),drain:e=>p(`/queues/${c(e)}/drain`,v(`POST`),!0,[],_),obliterate:e=>p(`/queues/${c(e)}/obliterate`,v(`POST`),!0,[],_),clean:(e,t={})=>p(`/queues/${c(e)}/clean`,g(`POST`,t)),promoteJobs:(e,t)=>p(`/queues/${c(e)}/promote-jobs`,g(`POST`,t==null?void 0:{count:t})),retryCompleted:(e,t)=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.9.2 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t,n,r)=>p(`/queues/${c(e)}/rate-limit`,g(`PUT`,{limit:t,...n===void 0?{}:{duration:n},...r===void 0?{}:{ttl:r}})),clearRateLimit:e=>p(`/queues/${c(e)}/rate-limit`,{method:`DELETE`}),setConcurrency:(e,t)=>p(`/queues/${c(e)}/concurrency`,g(`PUT`,{concurrency:t})),clearConcurrency:e=>p(`/queues/${c(e)}/concurrency`,{method:`DELETE`}),getStallConfig:e=>p(`/queues/${c(e)}/stall-config`),setStallConfig:(e,t)=>p(`/queues/${c(e)}/stall-config`,g(`PUT`,{config:t})),getDlqConfig:e=>p(`/queues/${c(e)}/dlq-config`),setDlqConfig:(e,t)=>{if(t.autoRetry===!0)throw TypeError(`DLQ auto-retry is unavailable: Bunqueue v2.9.2 does not rebuild flow dependency registration.`);if(t.maxAge!==void 0||t.maxEntries!==void 0)throw TypeError(`DLQ retention is read-only: maxAge/maxEntries can destructively expire or evict flow jobs without an atomic dependency check.`);return p(`/queues/${c(e)}/dlq-config`,g(`PUT`,{config:t}))},dlq:(e,t=100,n=0)=>p(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>p(`/queues/${c(e)}/dlq/stats`),retryDlq:(e,t)=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.9.2 because the endpoint has no atomic job-generation, state, or flow-topology precondition.`)},purgeDlq:e=>p(`/queues/${c(e)}/dlq/purge`,g(`POST`))},A=()=>encodeURIComponent(e()),he={limits:(e,t)=>{let n=t===void 0?``:`&maxJobs=${t}`;return h(`/queue-operations/${c(e)}/limits?target=${A()}${n}`)},group:(t,n,r,i)=>{let a=new URLSearchParams({target:e(),groupId:n});return r!==void 0&&a.set(`maxJobs`,String(r)),i!==void 0&&a.set(`maxCount`,String(i)),h(`/queue-operations/${c(t)}/groups?${a}`)},setGroupRateLimit:(e,t,n,r)=>h(`/queue-operations/${c(e)}/groups/rate-limit?target=${A()}`,g(`POST`,{groupId:t,max:n,duration:r})),removeGroupRateLimit:(e,t)=>h(`/queue-operations/${c(e)}/groups/rate-limit/remove?target=${A()}`,g(`POST`,{groupId:t})),setGroupConcurrency:(e,t,n)=>h(`/queue-operations/${c(e)}/groups/concurrency?target=${A()}`,g(`POST`,{groupId:t,concurrency:n})),removeGroupConcurrency:(e,t)=>h(`/queue-operations/${c(e)}/groups/concurrency/remove?target=${A()}`,g(`POST`,{groupId:t})),deduplicationJobId:(t,n)=>h(`/queue-operations/${c(t)}/deduplication?${new URLSearchParams({target:e(),deduplicationId:n})}`),removeDeduplicationKey:(e,t)=>h(`/queue-operations/${c(e)}/deduplication/remove?target=${A()}`,g(`POST`,{deduplicationId:t})),metrics:(t,n,r,i)=>h(`/queue-operations/${c(t)}/metrics?${new URLSearchParams({target:e(),type:n,start:String(r),end:String(i)})}`),trimEvents:(e,t)=>h(`/queue-operations/${c(e)}/events/trim?target=${A()}`,g(`POST`,{maxLength:t}))},j=1e4,ge=1e3,_e=864e13,ve=new Set([`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`,`job.stalled`]);function M(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function N(e,t,n=!1){if(typeof e!=`string`||e.length>t||!n&&e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!1}return!0}function P(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function ye(e){return typeof e==`number`&&Number.isFinite(e)}function F(e){return P(e)&&e<=_e}function be(e,t){return e===null||N(e,t)}function xe(e,t,n){if(!Array.isArray(e)||e.length>t)return!1;let r=new Set;for(let t of e){if(!N(t,n)||r.has(t))return!1;r.add(t)}return!0}function I(e,t){let n=M(e),r=n&&M(n.data);if(n?.ok!==!0||!r)throw Error(`Malformed ${t} response.`);return r}function L(e){if(!Array.isArray(e))throw Error(`Malformed queue summary response.`);let t=new Set,n=[];for(let r of e){let e=M(r),i=e&&M(e.counts);if(!e||!N(e.name,256)||t.has(e.name)||typeof e.paused!=`boolean`||!i||!P(i.waiting)||!P(i.prioritized)||!P(i.active)||!P(i.completed)||!P(i.failed)||!P(i.delayed))throw Error(`Malformed queue summary response.`);t.add(e.name),n.push(r)}return n}function R(e){let t=I(e,`workers`);if(!Array.isArray(t.workers)||t.workers.length>j)throw Error(`Malformed workers response.`);let n=new Set,r=[],i=[];for(let e=0;e<t.workers.length;e++){let a=t.workers[e],o=M(a),s=o&&typeof o.id==`string`?o.id:null,c=[];if(o?(N(o.id,1024)?n.has(o.id)&&c.push(`duplicate id`):c.push(`id`),N(o.name,512,!0)||c.push(`name`),xe(o.queues,ge,256)||c.push(`queues`),(!P(o.concurrency)||o.concurrency<1)&&c.push(`concurrency`),N(o.hostname,512,!0)||c.push(`hostname`),P(o.pid)||c.push(`pid`),o.status!==`active`&&o.status!==`stale`&&c.push(`status`),F(o.registeredAt)||c.push(`registeredAt`),F(o.lastSeen)||c.push(`lastSeen`),P(o.activeJobs)||c.push(`activeJobs`),P(o.processedJobs)||c.push(`processedJobs`),P(o.failedJobs)||c.push(`failedJobs`),be(o.currentJob,1024)||c.push(`currentJob`),ye(o.uptime)||c.push(`uptime`)):c.push(`entry is not an object`),s&&n.add(s),c.length>0){i.push({index:e,id:s,reason:c.join(`, `)});continue}r.push(a)}return{ok:!0,data:{workers:r,quarantinedWorkers:i,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}function Se(e){if(!N(e,2048))return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Ce(e){let t=I(e,`webhooks`);if(!Array.isArray(t.webhooks)||t.webhooks.length>j)throw Error(`Malformed webhooks response.`);let n=new Set,r=[];for(let e of t.webhooks){let t=M(e);if(!t||!N(t.id,1024)||n.has(t.id)||!Se(t.url)||!Array.isArray(t.events)||!t.events.every(e=>ve.has(e))||!(t.queue===null||typeof t.queue==`string`)||!F(t.createdAt)||!(t.lastTriggered===null||F(t.lastTriggered))||!P(t.successCount)||!P(t.failureCount)||typeof t.enabled!=`boolean`)throw Error(`Malformed webhooks response.`);n.add(t.id),r.push(e)}return{ok:!0,data:{webhooks:r,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}var we={crons:()=>p(`/crons`),createCron:e=>p(`/crons`,g(`POST`,e)),deleteCron:e=>p(`/crons/${o(e,`Cron name`,256)}`,{method:`DELETE`}),webhooks:async()=>Ce(await p(`/webhooks`)),addWebhook:e=>p(`/webhooks`,g(`POST`,e)),removeWebhook:e=>p(`/webhooks/${i(e)}`,{method:`DELETE`}),setWebhookEnabled:(e,t)=>p(`/webhooks/${i(e)}/enabled`,g(`PUT`,{enabled:t})),workers:async()=>R(await p(`/workers`)),unregisterWorker:e=>p(`/workers/${i(e)}`,{method:`DELETE`}),eventsUrl:t=>e()+(t?`/events/queues/${s(t)}`:`/events`)},z=365*24*60*60*1e3,B=64*1024*1024,V=1e4,Te=[`childrenIds`,`parentId`,`failParentOnFailure`,`removeDependencyOnFailure`,`continueParentOnFailure`,`ignoreDependencyOnFailure`,`keepLogs`,`sizeLimit`,`debounceId`,`debounceTtl`];function H(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`Repeat must be an object with a positive "every" interval`);let t=Object.keys(e).filter(e=>e!==`every`&&e!==`limit`);if(t.length)throw TypeError(`Unsupported repeat option(s): ${t.join(`, `)}. bunqueue v2.9.2 pattern repeats are unsafe; use the Cron API instead.`);if(!Number.isSafeInteger(e.every)||e.every<1||e.every>z)throw TypeError(`Repeat "every" must be a whole number from 1 to ${z} ms`);if(e.limit!==void 0&&(!Number.isSafeInteger(e.limit)||e.limit<1))throw TypeError(`Repeat "limit" must be a whole number of at least 1`)}function U(e){if(e!==void 0&&(typeof e!=`string`||!e||e.length>256))throw TypeError(`Job name must be a non-empty string of at most 256 characters`)}function W(e){let t=e,n=Te.filter(e=>t[e]!==void 0);if(n.length)throw TypeError(`Unsupported Bunqueue v2.9.2 enqueue option(s): ${n.join(`, `)}. Flow topology must use the atomic flow API; inert compatibility fields are not sent.`)}function G(e,t){let n=a(t);if(n)throw TypeError(`${e}: ${n}. The job would not be manageable through v2.9.2 HTTP.`)}function Ee(e){if(U(e.name),H(e.repeat),W(e),e.dependsOn!==void 0&&(!Array.isArray(e.dependsOn)||!e.dependsOn.every(e=>typeof e==`string`)))throw TypeError(`dependsOn must be an array of job ID strings`);e.jobId!==void 0&&G(`jobId`,e.jobId);for(let t of e.dependsOn??[])G(`dependsOn`,t)}function De(e){let t;try{t=JSON.stringify(e)}catch{throw TypeError(`Job payload must be JSON serializable`)}if(t===void 0)throw TypeError(`Job payload must be JSON serializable`);let n;try{n=JSON.parse(t)}catch{throw TypeError(`Job payload encoding failed`)}if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`Job payload must serialize to a JSON object`);return Ee(n),t}function Oe({jobId:e,...t}){return e===void 0?t:{...t,customId:e}}function ke(e){let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`must serialize to a JSON object`);let n=t;if(n.jobId!==void 0)throw TypeError(`serialized jobId is invalid; the bulk transport requires customId`);if(U(n.name),H(n.repeat),W(n),n.customId!==void 0){if(typeof n.customId!=`string`)throw TypeError(`customId must be a string`);G(`customId`,n.customId)}if(n.dependsOn!==void 0){if(!Array.isArray(n.dependsOn)||!n.dependsOn.every(e=>typeof e==`string`))throw TypeError(`dependsOn must be an array of job ID strings`);for(let e of n.dependsOn)G(`dependsOn`,e)}}function Ae(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i<=127?n+=1:i<=2047?n+=2:i>=55296&&i<=56319&&r+1<e.length&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r+=1):n+=3,n>t)return n}return n}function K(e,t,n){if(!Array.isArray(e)||e.length>1e4)return{ok:!1,error:`Bulk request must contain at most ${V} jobs`};if(!Number.isSafeInteger(t)||t<0)return{ok:!1,error:`Bulk request payload limit is invalid`};let r=11,i=n?Array(e.length):null;for(let a=0;a<e.length;a++){if(a&&(r+=1),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};let o;try{o=JSON.stringify(Oe(e[a]))}catch{return{ok:!1,error:`Bulk request payload must be JSON serializable`}}if(o===void 0)return{ok:!1,error:`Bulk request payload must be JSON serializable`};if(r+=Ae(o,t-r),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};if(n)try{ke(o)}catch(e){return{ok:!1,error:`Bulk job ${a+1}: ${e instanceof Error?e.message:String(e)}`}}i&&(i[a]=o)}return{ok:!0,bytes:r,body:i?`{"jobs":[${i.join(`,`)}]}`:void 0}}function je(e,t=B){let n=K(e,t,!1);return n.ok?null:n.error}function q(e){let t=K(e,B,!0);if(!t.ok)throw TypeError(t.error);if(t.body===void 0)throw TypeError(`Bulk request payload encoding failed`);return t.body}function J(e){if(!Array.isArray(e)||e.length>1e4)throw TypeError(`Bulk request must contain at most ${V} jobs`)}var Me={overview:e=>p(`/dashboard`,e),queues:(e=500,t=0)=>p(`/dashboard/queues?limit=${e}&offset=${t}`),queuesSummary:async()=>L(await p(`/queues/summary`)),queueDetail:(e,t=!0)=>p(`/dashboard/queues/${c(e)}?includeJobs=${t}`),stats:e=>p(`/stats`,e),storage:()=>p(`/storage`,void 0,!1),health:()=>p(`/health`,void 0,!1,[503]),ping:()=>p(`/ping`),prometheusUrl:()=>`${e()}/prometheus`,gc:()=>p(`/gc`,g(`POST`)),heapStats:()=>p(`/heapstats`)},Ne={jobsList:(e,t,n=50,r=0)=>{let i=new URLSearchParams;return t?.length&&i.set(`states`,t.join(`,`)),i.set(`limit`,String(n)),i.set(`offset`,String(r)),p(`/queues/${c(e)}/jobs/list?${i}`)},job:e=>p(`/jobs/${i(e)}`),jobByCustomId:e=>p(`/jobs/custom/${o(e,`Custom job ID`)}`),jobResult:e=>p(`/jobs/${i(e)}/result`),jobLogs:e=>p(`/jobs/${i(e)}/logs`),jobChildren:e=>p(`/jobs/${i(e)}/children`),addJob:async(e,t)=>p(`/queues/${c(e)}/jobs`,{method:`POST`,body:De(t)}),addJobsBulk:async(e,t)=>(J(t),p(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:q(t)},!0,[],_)),pullBatch:(e,t,n)=>p(`/queues/${c(e)}/jobs/pull-batch`,g(`POST`,{count:t,...n?{owner:n}:{}})),ackBatch:(e,t)=>p(`/jobs/ack-batch`,g(`POST`,{ids:e,...t?{tokens:t}:{}})),cancelJob:e=>p(`/jobs/${i(e)}`,{method:`DELETE`}),promoteJob:e=>p(`/jobs/${i(e)}/promote`,g(`POST`)),discardJob:e=>p(`/jobs/${i(e)}/discard`,g(`POST`)),retryJob:e=>p(`/jobs/${i(e)}/move-to-wait`,g(`POST`)),failJob:(e,t,n={})=>p(`/jobs/${i(e)}/fail`,g(`POST`,{error:t,...n})),updateJobData:(e,t)=>p(`/jobs/${i(e)}/data`,g(`PUT`,{data:t})),changePriority:(e,t,n)=>p(`/jobs/${i(e)}/priority`,g(`PUT`,{priority:t,...n===void 0?{}:{lifo:n}})),changeDelay:(e,t)=>p(`/jobs/${i(e)}/delay`,g(`PUT`,{delay:t})),moveToDelayed:(e,t)=>p(`/jobs/${i(e)}/move-to-delayed`,g(`POST`,{delay:t})),addJobLog:(e,t,n)=>p(`/jobs/${i(e)}/logs`,g(`POST`,{message:t,level:n})),clearJobLogs:e=>p(`/jobs/${i(e)}/logs`,{method:`DELETE`}),setJobProgress:(e,t,n)=>p(`/jobs/${i(e)}/progress`,g(`POST`,{progress:t,message:n}))};function Y(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new l(`Malformed ${t} response.`,200);return e}function X(e,t){let n=Y(e,t);if(n.ok!==!0)throw new l(`Malformed ${t} response.`,200);return n}var Z=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function Q(e,t){if(e!==void 0)return X(e,t)}function Pe(e,t){let n={...C(e)},r=(r,i,a=d())=>{let o=t?{...i,signal:i?.signal?AbortSignal.any([i.signal,t]):t}:i;return f(e.baseUrl,r,n,o,!0,`server`,[],a)};return Object.freeze({queuesSummary:async()=>L(await r(`/queues/summary`)),overview:()=>r(`/dashboard`),counts:async e=>{let t=Y(X(await r(`/queues/${c(e)}/counts`),`queue counts`).counts,`queue counts`);if(!Object.values(t).every(Z))throw new l(`Malformed queue counts response.`,200);return{ok:!0,counts:t}},jobsList:async(e,t,n=50,i=0)=>{let a=new URLSearchParams;t?.length&&a.set(`states`,t.join(`,`)),a.set(`limit`,String(n)),a.set(`offset`,String(i));let o=X(await r(`/queues/${c(e)}/jobs/list?${a}`),`jobs list`);if(!Array.isArray(o.jobs)||!o.jobs.every(t=>{let n=t;return typeof n==`object`&&!!n&&!Array.isArray(n)&&typeof n.id==`string`&&n.id.length>0&&(n.queue===void 0||n.queue===e)}))throw new l(`Malformed jobs list response.`,200);return{ok:!0,jobs:o.jobs}},job:async e=>{let t=Y(X(await r(`/jobs/${i(e)}`),`job`).job,`job`);if(t.id!==e)throw new l(`Malformed job response.`,200);return{ok:!0,job:t}},dlqStats:async e=>{let t=Y(X(await r(`/queues/${c(e)}/dlq/stats`),`DLQ stats`).stats,`DLQ stats`);if(!Z(t.total))throw new l(`Malformed DLQ stats response.`,200);return{ok:!0,stats:t}},dlq:async(e,t=100,n=0)=>{let i=X(await r(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),`DLQ list`);if(!Array.isArray(i.entries)||!Z(i.total))throw new l(`Malformed DLQ list response.`,200);for(let e of i.entries){let t=Y(Y(e,`DLQ list`).job,`DLQ list`);if(typeof t.id!=`string`||!t.id)throw new l(`Malformed DLQ list response.`,200)}return{ok:!0,entries:i.entries,total:i.total}},health:async()=>Y(await f(e.baseUrl,`/health`,n,t?{signal:t}:void 0,!1,`server`,[503]),`health`),stats:async()=>{let e=await r(`/stats`);return Y(X(e,`server stats`).stats,`server stats`),e},workers:async()=>R(await r(`/workers`)),crons:async()=>{let e=X(await r(`/crons`),`crons`);if(!Array.isArray(e.crons)||!e.crons.every(e=>{let t=e;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.name==`string`&&!!t.name&&typeof t.queue==`string`&&!!t.queue}))throw new l(`Malformed crons response.`,200);return{ok:!0,crons:e.crons}},addJobsBulk:async(e,t)=>(J(t),r(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:q(t)},_)),pullBatch:(e,t,n)=>r(`/queues/${c(e)}/jobs/pull-batch`,g(`POST`,{count:t,...n?{owner:n}:{}})),heartbeatBatch:(e,t)=>r(`/jobs/heartbeat-batch`,g(`POST`,{ids:e,...t?{tokens:t}:{}})),ackBatch:(e,t)=>r(`/jobs/ack-batch`,g(`POST`,{ids:e,...t?{tokens:t}:{}})),retryJob:(e,t)=>r(`/jobs/${i(e)}/move-to-wait`,g(`POST`,t?{token:t}:{})),promoteJob:async e=>Q(await r(`/jobs/${i(e)}/promote`,g(`POST`)),`promote job`),pause:async e=>Q(await r(`/queues/${c(e)}/pause`,g(`POST`)),`pause queue`),resume:async e=>Q(await r(`/queues/${c(e)}/resume`,g(`POST`)),`resume queue`),clean:(e,t={})=>r(`/queues/${c(e)}/clean`,g(`POST`,t))})}var $={...Me,captureServerRequestTarget:x,createServerTargetClient:Pe,getJobAtTarget:T,captureAgentRequestTarget:S,getDbRowsAtTarget:ce,getDbExportAtTarget:pe,...Ne,...me,queueOperations:he,...we,db:ne,get agentBase(){return m()},control:re,workflows:ie};Object.defineProperty($,"agentBase",{configurable:!1});export{l as a,te as c,x as d,T as f,D as i,f as l,Pe as n,w as o,je as r,h as s,$ as t,S as u};
@@ -1 +0,0 @@
1
- import{o as e}from"./upstreamPaths-B_cyinGI.js";var t=10*1024*1024,n=10*1024*1024;function r(e,t=1/0){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i<=127?n+=1:i<=2047?n+=2:i>=55296&&i<=56319&&r+1<e.length&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r+=1):n+=3,n>t)return n}return n}function i(e){return e.length>10485760||r(e,10485760)>10485760?`Job data is too large (maximum 10 MiB UTF-8 / 10,485,760 characters)`:null}function a(e){let t=i(e);if(t)return{ok:!1,kind:`size`,msg:t};let n;try{n=JSON.parse(e)}catch(e){return{ok:!1,kind:`json`,msg:`Invalid JSON: ${e.message}`}}let a=JSON.stringify(n);return a.length>10485760||r(a,10485760)>10485760?{ok:!1,kind:`size`,msg:`Job data is too large after JSON encoding (maximum 10 MiB UTF-8)`}:{ok:!0,data:n}}var o=365*24*60*60*1e3,s=1440*60*1e3;function c(e){let t=[{key:`priority`,label:`Priority`,min:-1e6,max:1e6},{key:`delay`,label:`Delay`,min:0,max:o},{key:`maxAttempts`,label:`Max attempts`,min:1,max:1e3},{key:`backoff`,label:`Backoff`,min:0,max:s},{key:`timeout`,label:`Timeout`,min:0,max:s},{key:`ttl`,label:`TTL`,min:0,max:o}],n={};for(let r of t){let t=(e[r.key]??``).trim();if(!t)continue;let i=Number(t);if(!Number.isFinite(i))return{ok:!1,msg:`${r.label} must be a number`};if(!Number.isSafeInteger(i))return{ok:!1,msg:`${r.label} must be a whole, safe integer`};if(i<r.min||i>r.max)return{ok:!1,msg:`${r.label} must be between ${r.min} and ${r.max}`};n[r.key]=i}return{ok:!0,options:n}}function l(t){let n=e(t);return!t&&n?`Choose a queue`:n}function u(e,t){return e==null?t?{ok:!1,msg:`Backoff strategy needs a base delay in Backoff (ms)`}:{ok:!0,backoff:void 0}:{ok:!0,backoff:t?{type:t,delay:e}:e}}function d(e){if(!e.trim())return{ok:!0,repeat:void 0};try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return{ok:!1,msg:`Repeat must be a JSON object`};let n=t,r=new Set([`every`,`limit`,`pattern`]),i=Object.keys(n).filter(e=>!r.has(e));if(i.length)return{ok:!1,msg:`Unknown repeat option${i.length===1?``:`s`}: ${i.join(`, `)}`};if(n.pattern!==void 0)return{ok:!1,msg:`repeat.pattern is unsafe in bunqueue v2.9.2; use repeat.every or a Cron schedule`};let a=n.every;return!Number.isSafeInteger(a)||a<=0||a>31536e6?{ok:!1,msg:`Repeat "every" must be a whole number from 1 to ${o} ms`}:n.limit!==void 0&&(!Number.isSafeInteger(n.limit)||n.limit<1)?{ok:!1,msg:`Repeat "limit" must be a whole number of at least 1`}:{ok:!0,repeat:{every:a,...typeof n.limit==`number`?{limit:n.limit}:{}}}}catch(e){return{ok:!1,msg:`Repeat is not valid JSON: ${e.message}`}}}function f(e){let t=typeof e.backoff==`object`?e.backoff:void 0,n=e.backoffConfig??t;return{backoff:p(n?.delay??(typeof e.backoff==`number`?e.backoff:void 0)),backoffType:n?.type??``,tags:e.tags?.join(`, `)??``,groupId:e.groupId??``,ttl:p(e.ttl)}}var p=e=>e==null?``:String(e);function m(e,t){return{ok:!0,msg:`Accepted ${t} job submission${t===1?``:`s`}; server returned ${e} distinct job ID${e===1?``:`s`} (deduplication may reuse existing jobs)`}}function h(e){if(typeof e!=`object`||!e||e.ok!==!0||typeof e.id!=`string`||!e.id||e.id.length>1024)throw Error(`Add job returned a malformed success response`);return e.id}function g(e,t){let n=e?.ids;if(typeof e!=`object`||!e||e.ok!==!0||!Array.isArray(n)||n.length!==t||n.some(e=>typeof e!=`string`||e.length===0||e.length>1024))throw Error(`Bulk add returned a malformed success response`);return n}export{s as a,c,u as d,n as f,r as h,o as i,d as l,a as m,h as n,f as o,t as p,m as r,p as s,g as t,l as u};