bunqueue-dashboard 0.0.40 → 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 (85) hide show
  1. package/README.md +24 -8
  2. package/agent/backup/resultValidation.ts +1 -1
  3. package/agent/manager/config.ts +1 -1
  4. package/agent/manager/storageMode.ts +19 -0
  5. package/agent/manager.ts +5 -1
  6. package/agent/queue/routes.ts +33 -3
  7. package/agent/queue/runtime.ts +49 -3
  8. package/agent/queue/types.ts +16 -1
  9. package/agent/queue/validation.ts +8 -0
  10. package/agent/server/controlStatus.ts +5 -0
  11. package/agent/workflows.ts +1 -1
  12. package/dist/.vite/manifest.json +235 -216
  13. package/dist/assets/AddJob-FNaPbs_V.js +3 -0
  14. package/dist/assets/{Alerts-CFj-u0iV.js → Alerts-BvWBv-z7.js} +1 -1
  15. package/dist/assets/{Benchmark-Ey2sq57q.js → Benchmark-BywalSmU.js} +1 -1
  16. package/dist/assets/BulkAddJobs-IiL1uud0.js +5 -0
  17. package/dist/assets/{CopilotPanel-CniuIIPn.js → CopilotPanel-CH2jbbYA.js} +1 -1
  18. package/dist/assets/{Cron-B5XFBvU-.js → Cron-1DZTZWXO.js} +1 -1
  19. package/dist/assets/CronManager-B6xLLgI5.js +1 -0
  20. package/dist/assets/Database-BzEkXws0.js +3 -0
  21. package/dist/assets/{Diagnostics-BDRftXQy.js → Diagnostics-CPqhV3er.js} +1 -1
  22. package/dist/assets/{Dlq-CJO9itzJ.js → Dlq-CbLN0zQ5.js} +1 -1
  23. package/dist/assets/{DlqControl-DZL2lHOU.js → DlqControl-C5Bgzmk0.js} +1 -1
  24. package/dist/assets/DlqPro-Cgaxtuwh.js +1 -0
  25. package/dist/assets/Fleet-Bdrj9bLI.js +1 -0
  26. package/dist/assets/{Flows-BItJzbVQ.js → Flows-BtUGOaif.js} +2 -2
  27. package/dist/assets/{JobInspector-CJHX63p_.js → JobInspector-DsOt4mLJ.js} +2 -2
  28. package/dist/assets/{Jobs-BwmTsjJx.js → Jobs-BTMpbAHD.js} +1 -1
  29. package/dist/assets/{JobsPro-eFVAZJ10.js → JobsPro-BfXTm9gH.js} +1 -1
  30. package/dist/assets/{Logs-CXIf58M4.js → Logs-uuzU5ohI.js} +1 -1
  31. package/dist/assets/{LogsPro-Xm6rylAd.js → LogsPro-DHWbhWyq.js} +1 -1
  32. package/dist/assets/{McpServer-Rf3i6lRn.js → McpServer-BqmbhrKh.js} +2 -2
  33. package/dist/assets/{Metrics-Cj3VYxzL.js → Metrics-DKyBZoFa.js} +1 -1
  34. package/dist/assets/{MetricsPro-C63eY00A.js → MetricsPro-BR2ULqIc.js} +1 -1
  35. package/dist/assets/{Overview-CUM3XG7A.js → Overview-ClsyxH2e.js} +1 -1
  36. package/dist/assets/{QueueActions-b19K0vCT.js → QueueActions-BWnmNEqV.js} +1 -1
  37. package/dist/assets/QueueControl-BW0XXd0B.js +1 -0
  38. package/dist/assets/{QueueDetail-CpFIG1PU.js → QueueDetail-C1dXXN70.js} +1 -1
  39. package/dist/assets/{QueueDetailPro-BNlBOj5s.js → QueueDetailPro-DDGxs2J2.js} +1 -1
  40. package/dist/assets/{Queues-CZ2qc7FY.js → Queues-DkPuIy1C.js} +1 -1
  41. package/dist/assets/QueuesOverview-COo-V8D_.js +1 -0
  42. package/dist/assets/{S3Backup-x4mOV-AO.js → S3Backup-DNABHR2Q.js} +1 -1
  43. package/dist/assets/{S3BackupPro-BtvbPVg-.js → S3BackupPro-DxNVFvY1.js} +3 -3
  44. package/dist/assets/{ServerControl-C5nQ7CCp.js → ServerControl-B0Po974t.js} +2 -2
  45. package/dist/assets/Settings-z9k4EVa_.js +1 -0
  46. package/dist/assets/{Usage-UYovs3D-.js → Usage-cdWDQUaq.js} +1 -1
  47. package/dist/assets/{UsagePro-bT82DS-d.js → UsagePro-DLuwnM8n.js} +1 -1
  48. package/dist/assets/{Webhooks-BjsUMJAn.js → Webhooks-DT2LK17V.js} +1 -1
  49. package/dist/assets/{Workers-CD4YZpca.js → Workers-CVo9rJ_V.js} +1 -1
  50. package/dist/assets/{WorkersPro-hCPhfb1Z.js → WorkersPro-BYaredE9.js} +1 -1
  51. package/dist/assets/Workflows-DZZA6aGW.js +1 -0
  52. package/dist/assets/{api-BxYPEynh.js → api-BgWE-705.js} +1 -1
  53. package/dist/assets/bq-F5BbTG1T.js +1 -0
  54. package/dist/assets/connectionStore-BJLihGaC.js +1 -0
  55. package/dist/assets/controlConnectionEpoch-CZsS0wAb.js +1 -0
  56. package/dist/assets/{flowMutationSafety-DSd3JLAV.js → flowMutationSafety-YKTHxqKv.js} +1 -1
  57. package/dist/assets/index-C9yGKhQ8.css +1 -0
  58. package/dist/assets/index-mID5W7vq.js +8 -0
  59. package/dist/assets/{install-C5y2ohOo.js → install-D4uRZ7XA.js} +2 -2
  60. package/dist/assets/responses-BkR2JTH9.js +1 -0
  61. package/dist/assets/{toastStore-B31o6Z5J.js → toastStore-IZn6OPLZ.js} +1 -1
  62. package/dist/assets/{upstreamPaths-B_cyinGI.js → upstreamPaths-DQeKSxGc.js} +1 -1
  63. package/dist/assets/{useControlActionGuard-DT7uudrj.js → useControlActionGuard-B-bzKZKI.js} +1 -1
  64. package/dist/assets/usePolledData-0CVelkl2.js +1 -0
  65. package/dist/assets/{useServerActionGuard-Db7PPgaI.js → useServerActionGuard-uGePilQQ.js} +1 -1
  66. package/dist/assets/{useThroughputSeries-y7Yyi7Zh.js → useThroughputSeries-DgO8uicf.js} +1 -1
  67. package/dist/index.html +8 -8
  68. package/package.json +8 -4
  69. package/scripts/embedded.gen.ts +150 -148
  70. package/dist/assets/AddJob-DkbI_J5p.js +0 -3
  71. package/dist/assets/BulkAddJobs-BwPoeSB6.js +0 -5
  72. package/dist/assets/CronManager-Bdg2BECM.js +0 -1
  73. package/dist/assets/Database-CB0oOEFB.js +0 -3
  74. package/dist/assets/DlqPro-OqBlzCnN.js +0 -1
  75. package/dist/assets/QueueControl-DusMoa05.js +0 -1
  76. package/dist/assets/QueuesOverview-CBFqQ3N_.js +0 -1
  77. package/dist/assets/Settings-B5kCRSBH.js +0 -1
  78. package/dist/assets/Workflows-DOpeo-TP.js +0 -1
  79. package/dist/assets/bq-C7wdABtE.js +0 -1
  80. package/dist/assets/connectionStore-CFuNYZ_8.js +0 -1
  81. package/dist/assets/controlConnectionEpoch-DzbuWOhe.js +0 -1
  82. package/dist/assets/index-AUHH2nTG.js +0 -8
  83. package/dist/assets/index-BK7fjWKK.css +0 -1
  84. package/dist/assets/responses-DiIfPXXq.js +0 -1
  85. package/dist/assets/usePolledData-CNtNtd0a.js +0 -1
@@ -3,165 +3,167 @@
3
3
  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
- import f3 from "../dist/assets/Metrics-Cj3VYxzL.js" with { type: 'file' };
7
- import f4 from "../dist/assets/Workflows-DOpeo-TP.js" with { type: 'file' };
8
- import f5 from "../dist/assets/Logs-CXIf58M4.js" with { type: 'file' };
9
- import f6 from "../dist/assets/useServerActionGuard-Db7PPgaI.js" with { type: 'file' };
10
- import f7 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
11
- import f8 from "../dist/assets/icons-BVzwsfbG.js" with { type: 'file' };
12
- import f9 from "../dist/assets/feedback-QDN1AsYt.js" with { type: 'file' };
13
- import f10 from "../dist/assets/MetricsPro-C63eY00A.js" with { type: 'file' };
14
- import f11 from "../dist/assets/react-vendor-CvwrP0tU.js" with { type: 'file' };
15
- import f12 from "../dist/assets/bq-C7wdABtE.js" with { type: 'file' };
16
- import f13 from "../dist/assets/Queues-CZ2qc7FY.js" with { type: 'file' };
17
- import f14 from "../dist/assets/S3Backup-x4mOV-AO.js" with { type: 'file' };
18
- import f15 from "../dist/assets/usePolledData-CNtNtd0a.js" with { type: 'file' };
6
+ import f3 from "../dist/assets/usePolledData-0CVelkl2.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
19
  import f16 from "../dist/assets/StatusBadge-BoOVTnKu.js" with { type: 'file' };
20
20
  import f17 from "../dist/assets/Button-Ch1W94fJ.js" with { type: 'file' };
21
21
  import f18 from "../dist/assets/exportFile-C7xhE8Yh.js" with { type: 'file' };
22
- import f19 from "../dist/assets/api-BxYPEynh.js" with { type: 'file' };
23
- import f20 from "../dist/assets/McpServer-Rf3i6lRn.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
24
  import f21 from "../dist/assets/dist-DjvZiKhB.js" with { type: 'file' };
25
- import f22 from "../dist/assets/toastStore-B31o6Z5J.js" with { type: 'file' };
26
- import f23 from "../dist/assets/WorkersPro-hCPhfb1Z.js" with { type: 'file' };
27
- import f24 from "../dist/assets/UsagePro-bT82DS-d.js" with { type: 'file' };
28
- import f25 from "../dist/assets/useControlActionGuard-DT7uudrj.js" with { type: 'file' };
29
- import f26 from "../dist/assets/controlConnectionEpoch-DzbuWOhe.js" with { type: 'file' };
30
- import f27 from "../dist/assets/index-BK7fjWKK.css" with { type: 'file' };
31
- import f28 from "../dist/assets/Dlq-CJO9itzJ.js" with { type: 'file' };
32
- import f29 from "../dist/assets/S3BackupPro-BtvbPVg-.js" with { type: 'file' };
33
- import f30 from "../dist/assets/Usage-UYovs3D-.js" with { type: 'file' };
34
- import f31 from "../dist/assets/Settings-B5kCRSBH.js" with { type: 'file' };
35
- import f32 from "../dist/assets/upstreamPaths-B_cyinGI.js" with { type: 'file' };
36
- import f33 from "../dist/assets/form-C4oby9pI.js" with { type: 'file' };
37
- import f34 from "../dist/assets/Flows-BItJzbVQ.js" with { type: 'file' };
38
- import f35 from "../dist/assets/responses-DiIfPXXq.js" with { type: 'file' };
39
- import f36 from "../dist/assets/BulkAddJobs-BwPoeSB6.js" with { type: 'file' };
40
- import f37 from "../dist/assets/AreaChart-DEAalJ6P.js" with { type: 'file' };
41
- import f38 from "../dist/assets/Pagination-x-Cwgrul.js" with { type: 'file' };
42
- import f39 from "../dist/assets/CronManager-Bdg2BECM.js" with { type: 'file' };
43
- import f40 from "../dist/assets/Jobs-BwmTsjJx.js" with { type: 'file' };
44
- import f41 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
45
- import f42 from "../dist/assets/Workers-CD4YZpca.js" with { type: 'file' };
46
- import f43 from "../dist/assets/QueueControl-DusMoa05.js" with { type: 'file' };
47
- import f44 from "../dist/assets/Alerts-CFj-u0iV.js" with { type: 'file' };
48
- import f45 from "../dist/assets/Database-CB0oOEFB.js" with { type: 'file' };
49
- import f46 from "../dist/assets/ServerControl-C5nQ7CCp.js" with { type: 'file' };
50
- import f47 from "../dist/assets/dist-DpZcbP9W.js" with { type: 'file' };
51
- import f48 from "../dist/assets/cn-zFEt5SO8.js" with { type: 'file' };
52
- import f49 from "../dist/assets/QueuesOverview-CBFqQ3N_.js" with { type: 'file' };
53
- import f50 from "../dist/assets/PageHeader-CvIyaFOO.js" with { type: 'file' };
54
- import f51 from "../dist/assets/DlqPro-OqBlzCnN.js" with { type: 'file' };
55
- import f52 from "../dist/assets/install-C5y2ohOo.js" with { type: 'file' };
56
- import f53 from "../dist/assets/Overview-CUM3XG7A.js" with { type: 'file' };
57
- import f54 from "../dist/assets/AddJob-DkbI_J5p.js" with { type: 'file' };
58
- import f55 from "../dist/assets/connectionStore-CFuNYZ_8.js" with { type: 'file' };
59
- import f56 from "../dist/assets/QueueDetailPro-BNlBOj5s.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/JobInspector-CJHX63p_.js" with { type: 'file' };
63
- import f60 from "../dist/assets/dist-1f1fMHVO.js" with { type: 'file' };
64
- import f61 from "../dist/assets/promisePool-BVfQ9n9Q.js" with { type: 'file' };
65
- import f62 from "../dist/assets/CopilotPanel-CniuIIPn.js" with { type: 'file' };
66
- import f63 from "../dist/assets/DlqControl-DZL2lHOU.js" with { type: 'file' };
67
- import f64 from "../dist/assets/Benchmark-Ey2sq57q.js" with { type: 'file' };
68
- import f65 from "../dist/assets/index-AUHH2nTG.js" with { type: 'file' };
69
- import f66 from "../dist/assets/Diagnostics-BDRftXQy.js" with { type: 'file' };
70
- import f67 from "../dist/assets/QueueActions-b19K0vCT.js" with { type: 'file' };
71
- import f68 from "../dist/assets/JobsPro-eFVAZJ10.js" with { type: 'file' };
72
- import f69 from "../dist/assets/Card-CWxrC8OY.js" with { type: 'file' };
73
- import f70 from "../dist/assets/useThroughputSeries-y7Yyi7Zh.js" with { type: 'file' };
74
- import f71 from "../dist/assets/LogsPro-Xm6rylAd.js" with { type: 'file' };
75
- import f72 from "../dist/assets/dist-BlWBaCN6.js" with { type: 'file' };
76
- import f73 from "../dist/assets/Cron-B5XFBvU-.js" with { type: 'file' };
77
- import f74 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
78
- import f75 from "../dist/assets/jobActions-LQD4KfCc.js" with { type: 'file' };
79
- import f76 from "../dist/assets/dist-DZL8soAh.js" with { type: 'file' };
80
- import f77 from "../dist/assets/flowMutationSafety-DSd3JLAV.js" with { type: 'file' };
81
- import f78 from "../dist/assets/Webhooks-BjsUMJAn.js" with { type: 'file' };
82
- import f79 from "../dist/assets/QueueDetail-CpFIG1PU.js" with { type: 'file' };
83
- import f80 from "../dist/.vite/manifest.json" 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
+ import f78 from "../dist/assets/jobActions-LQD4KfCc.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
+ import f81 from "../dist/.vite/manifest.json" with { type: 'file' };
84
85
 
85
86
  export const ASSETS: Record<string, string> = {
86
87
  "/index.html": f0,
87
88
  "/favicon.svg": f1,
88
89
  "/og.png": f2,
89
- "/assets/Metrics-Cj3VYxzL.js": f3,
90
- "/assets/Workflows-DOpeo-TP.js": f4,
91
- "/assets/Logs-CXIf58M4.js": f5,
92
- "/assets/useServerActionGuard-Db7PPgaI.js": f6,
93
- "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f7,
94
- "/assets/icons-BVzwsfbG.js": f8,
95
- "/assets/feedback-QDN1AsYt.js": f9,
96
- "/assets/MetricsPro-C63eY00A.js": f10,
97
- "/assets/react-vendor-CvwrP0tU.js": f11,
98
- "/assets/bq-C7wdABtE.js": f12,
99
- "/assets/Queues-CZ2qc7FY.js": f13,
100
- "/assets/S3Backup-x4mOV-AO.js": f14,
101
- "/assets/usePolledData-CNtNtd0a.js": f15,
90
+ "/assets/usePolledData-0CVelkl2.js": f3,
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,
102
103
  "/assets/StatusBadge-BoOVTnKu.js": f16,
103
104
  "/assets/Button-Ch1W94fJ.js": f17,
104
105
  "/assets/exportFile-C7xhE8Yh.js": f18,
105
- "/assets/api-BxYPEynh.js": f19,
106
- "/assets/McpServer-Rf3i6lRn.js": f20,
106
+ "/assets/Usage-cdWDQUaq.js": f19,
107
+ "/assets/responses-BkR2JTH9.js": f20,
107
108
  "/assets/dist-DjvZiKhB.js": f21,
108
- "/assets/toastStore-B31o6Z5J.js": f22,
109
- "/assets/WorkersPro-hCPhfb1Z.js": f23,
110
- "/assets/UsagePro-bT82DS-d.js": f24,
111
- "/assets/useControlActionGuard-DT7uudrj.js": f25,
112
- "/assets/controlConnectionEpoch-DzbuWOhe.js": f26,
113
- "/assets/index-BK7fjWKK.css": f27,
114
- "/assets/Dlq-CJO9itzJ.js": f28,
115
- "/assets/S3BackupPro-BtvbPVg-.js": f29,
116
- "/assets/Usage-UYovs3D-.js": f30,
117
- "/assets/Settings-B5kCRSBH.js": f31,
118
- "/assets/upstreamPaths-B_cyinGI.js": f32,
119
- "/assets/form-C4oby9pI.js": f33,
120
- "/assets/Flows-BItJzbVQ.js": f34,
121
- "/assets/responses-DiIfPXXq.js": f35,
122
- "/assets/BulkAddJobs-BwPoeSB6.js": f36,
123
- "/assets/AreaChart-DEAalJ6P.js": f37,
124
- "/assets/Pagination-x-Cwgrul.js": f38,
125
- "/assets/CronManager-Bdg2BECM.js": f39,
126
- "/assets/Jobs-BwmTsjJx.js": f40,
127
- "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f41,
128
- "/assets/Workers-CD4YZpca.js": f42,
129
- "/assets/QueueControl-DusMoa05.js": f43,
130
- "/assets/Alerts-CFj-u0iV.js": f44,
131
- "/assets/Database-CB0oOEFB.js": f45,
132
- "/assets/ServerControl-C5nQ7CCp.js": f46,
133
- "/assets/dist-DpZcbP9W.js": f47,
134
- "/assets/cn-zFEt5SO8.js": f48,
135
- "/assets/QueuesOverview-CBFqQ3N_.js": f49,
136
- "/assets/PageHeader-CvIyaFOO.js": f50,
137
- "/assets/DlqPro-OqBlzCnN.js": f51,
138
- "/assets/install-C5y2ohOo.js": f52,
139
- "/assets/Overview-CUM3XG7A.js": f53,
140
- "/assets/AddJob-DkbI_J5p.js": f54,
141
- "/assets/connectionStore-CFuNYZ_8.js": f55,
142
- "/assets/QueueDetailPro-BNlBOj5s.js": f56,
143
- "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f57,
144
- "/assets/format-Cg7VCIZW.js": f58,
145
- "/assets/JobInspector-CJHX63p_.js": f59,
146
- "/assets/dist-1f1fMHVO.js": f60,
147
- "/assets/promisePool-BVfQ9n9Q.js": f61,
148
- "/assets/CopilotPanel-CniuIIPn.js": f62,
149
- "/assets/DlqControl-DZL2lHOU.js": f63,
150
- "/assets/Benchmark-Ey2sq57q.js": f64,
151
- "/assets/index-AUHH2nTG.js": f65,
152
- "/assets/Diagnostics-BDRftXQy.js": f66,
153
- "/assets/QueueActions-b19K0vCT.js": f67,
154
- "/assets/JobsPro-eFVAZJ10.js": f68,
155
- "/assets/Card-CWxrC8OY.js": f69,
156
- "/assets/useThroughputSeries-y7Yyi7Zh.js": f70,
157
- "/assets/LogsPro-Xm6rylAd.js": f71,
158
- "/assets/dist-BlWBaCN6.js": f72,
159
- "/assets/Cron-B5XFBvU-.js": f73,
160
- "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f74,
161
- "/assets/jobActions-LQD4KfCc.js": f75,
162
- "/assets/dist-DZL8soAh.js": f76,
163
- "/assets/flowMutationSafety-DSd3JLAV.js": f77,
164
- "/assets/Webhooks-BjsUMJAn.js": f78,
165
- "/assets/QueueDetail-CpFIG1PU.js": f79,
166
- "/.vite/manifest.json": f80,
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
+ "/assets/jobActions-LQD4KfCc.js": f78,
166
+ "/assets/install-D4uRZ7XA.js": f79,
167
+ "/assets/dist-DZL8soAh.js": f80,
168
+ "/.vite/manifest.json": f81,
167
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-C7wdABtE.js";import{t as l}from"./toastStore-B31o6Z5J.js";import{n as u}from"./usePolledData-CNtNtd0a.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-Db7PPgaI.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-C7wdABtE.js";import{t as o}from"./toastStore-B31o6Z5J.js";import{n as s}from"./usePolledData-CNtNtd0a.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-Db7PPgaI.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,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CvwrP0tU.js";import{t as i}from"./upstreamPaths-B_cyinGI.js";import{t as a}from"./bq-C7wdABtE.js";import{t as o}from"./toastStore-B31o6Z5J.js";import{O as s,c}from"./icons-BVzwsfbG.js";import{n as l}from"./usePolledData-CNtNtd0a.js";import{n as u,t as d}from"./Button-Ch1W94fJ.js";import{n as f,t as p}from"./Card-CWxrC8OY.js";import{i as m,n as h,r as g,t as _}from"./feedback-QDN1AsYt.js";import{t as v}from"./PageHeader-CvIyaFOO.js";import{i as y,s as b}from"./format-Cg7VCIZW.js";import{i as x,n as S,o as C,t as w}from"./form-C4oby9pI.js";import{t as ee}from"./Pagination-x-Cwgrul.js";import{r as te}from"./useServerActionGuard-Db7PPgaI.js";import{m as ne,p as re,u as T}from"./responses-DiIfPXXq.js";import"./AddJob-DkbI_J5p.js";var E=e(n(),1),D=6e4;function O(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),weekday:e.getDay(),hour:e.getHours(),minute:e.getMinutes()}}function k(e){e.minute>59&&(e.minute-=60,e.hour+=1),e.hour>23&&(e.hour-=24,e.day+=1);let t=new Date(Date.UTC(e.year,e.month-1,e.day,12));e.year=t.getUTCFullYear(),e.month=t.getUTCMonth()+1,e.day=t.getUTCDate(),e.weekday=t.getUTCDay()}function A(e,t,n){let r=e.dayOfMonth.values.has(t),i=e.dayOfWeek.values.has(n);return e.dayOfMonth.literalWildcard||e.dayOfWeek.literalWildcard?r&&i:r||i}function j(e,t){let n=new Date(t);return e.minute.values.has(n.getMinutes())&&e.hour.values.has(n.getHours())&&e.month.values.has(n.getMonth()+1)&&A(e,n.getDate(),n.getDay())}function M(e,t){return e.values.size===t}function N(e,t,n,r){let i=new Date(t.year,t.month-1,t.day,t.hour,t.minute,0,0).getTime();if(M(e.minute,60)||M(e.hour,24)){let a=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute),o=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute);if(i<=n||i-n>o-a){let t=(Math.floor(n/D)+1)*D,r=n+121*D;for(i>n&&(r=Math.min(r,i));t<r;){if(j(e,t))return t;t+=D}}}return i>n?i:null}function P(e,t){if(!Number.isFinite(t))return null;let n=O(new Date(t)),r={...n,minute:n.minute+1},i=n.year+8;for(let a=0;a<1e5&&r.year<=i;a++){if(k(r),!e.month.values.has(r.month)){r.month+=1,r.day=1,r.hour=0,r.minute=0;continue}if(!A(e,r.day,r.weekday)){r.day+=1,r.hour=0,r.minute=0;continue}if(!e.hour.values.has(r.hour)){r.hour+=1,r.minute=0;continue}if(!e.minute.values.has(r.minute)){r.minute+=1;continue}let i=N(e,r,t,n);if(i!==null)return i;r.minute+=1}return null}function F(e,t,n){let r=P(e,Math.floor(n/D)*D-1);for(;r!==null;){for(let e of t){let t=r+e*1e3;if(t>n)return t}let i=P(e,r);if(i===null||i<=r)return null;r=i}return null}var I={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12},L={sun:0,sunday:0,mon:1,monday:1,tue:2,tuesday:2,wed:3,wednesday:3,thu:4,thursday:4,fri:5,friday:5,sat:6,saturday:6},ie={"@yearly":`0 0 1 1 *`,"@annually":`0 0 1 1 *`,"@monthly":`0 0 1 * *`,"@weekly":`0 0 * * 0`,"@daily":`0 0 * * *`,"@midnight":`0 0 * * *`,"@hourly":`0 * * * *`};function R(e,t,n,r){let i=e===`*`,a=new Set;for(let i of e.split(`,`)){let e=i.trim().toLowerCase();if(e===``)return null;let o=e.match(/^(.+)\/(\+?\d+)$/),s=o?Number(o[2]):1,c=o?o[1]:e;if(!Number.isSafeInteger(s)||s<1||s>127)return null;let l,u;if(c===`*`)l=t,u=n;else if(c.includes(`-`)){let e=c.split(`-`);if(e.length!==2)return null;let[t,n]=e,i=z(t,r),a=z(n,r);if(i==null||a==null)return null;l=i,u=a}else{let e=z(c,r);if(e==null)return null;l=e,u=o?n:e}if(l<t||u>n||l>u)return null;for(let e=l;e<=u;e+=s)a.add(e)}return a.size?{values:a,star:i}:null}function z(e,t){let n=e.trim().toLowerCase();if(n===``)return null;if(t){let e=t[n];if(e!==void 0)return e}if(!/^\+?\d+$/.test(n))return null;let r=Number(n);return Number.isSafeInteger(r)?r:null}function B(e,t,n){let r=e.trim(),i=(ie[r.toLowerCase()]??r).split(/\s+/);if(i.length!==5&&i.length!==6)return{valid:!1,error:`Expected 5 fields (min hour day month weekday) or 6 with leading seconds, got ${i.length}.`,runs:[]};let a=i.length===6,o=+!!a,s=a?H(i[0]):V(0),c=R(i[o],0,59),l=R(i[o+1],0,23),u=R(i[o+2],1,31),d=R(i[o+3],1,12,I),f=R(i[o+4],0,7,L);if(!s||!c||!l||!u||!d||!f)return{valid:!1,error:`Invalid field syntax.`,runs:[]};let p=new Set;for(let e of f.values)p.add(e===7?0:e);let m={values:p,star:f.star},h={minute:{values:c.values,literalWildcard:c.star},hour:{values:l.values,literalWildcard:l.star},dayOfMonth:{values:u.values,literalWildcard:u.star},month:{values:d.values,literalWildcard:d.star},dayOfWeek:{values:m.values,literalWildcard:m.star}},g=[],_=Number.isSafeInteger(t)?Math.max(0,Math.min(t,100)):0,v=[...s.values].sort((e,t)=>e-t),y=n;for(;g.length<_;){let e=a?F(h,v,y):P(h,y);if(e===null||e<=y)break;g.push(e),y=e}return{valid:!0,runs:g}}function V(e){return{values:new Set([e]),star:!1}}function H(e){let t=new Set;for(let n of e.split(`,`)){if(!n)return null;let e=n.split(`/`);if(e.length>2||!e[0]||e[1]===``)return null;let r=e[0],i=e.length===2;if(i&&!/^\d+$/.test(e[1]))return null;let a=i?Number(e[1]):1;if(a<1||a>60)return null;let o,s;if(r===`*`)o=0,s=59;else if(r.includes(`-`)){let e=r.split(`-`);if(e.length!==2||!e[0]||!e[1]||!/^\d+$/.test(e[0])||!/^\d+$/.test(e[1]))return null;o=Number(e[0]),s=Number(e[1])}else{if(i||!/^\d+$/.test(r))return null;o=Number(r),s=o}if(o<0||s>59||o>s)return null;for(let e=o;e<=s;e+=a)t.add(e)}return t.size?{values:t,star:e===`*`||/^\*\/\d+$/.test(e)}:null}var U=365*24*60*60*1e3,W=1440*60*1e3;function G(e){if(typeof e!=`object`||!e||e.ok!==!0)throw Error(`Delete cron returned a malformed success response`)}function K(e,t){let n=e?.cron;if(typeof e!=`object`||!e||e.ok!==!0||typeof n!=`object`||!n||n.name!==t.name||n.queue!==t.queue)throw Error(`Create cron returned a malformed success response`)}var q=e=>`Cron "${e}" already exists. Bunqueue v2.9.2 does not return complete cron definitions, so editing could reset hidden options. Delete it explicitly, wait for the list to refresh, then create the replacement as a separate action.`;function J(e,t){let n=e.trim();return n&&t.has(n)?q(n):null}function ae(e,t){let n=e;if(typeof n!=`object`||!n||n.ok!==!0||!Array.isArray(n.crons)||n.crons.some(e=>typeof e!=`object`||!e||typeof e.name!=`string`))throw Error(`Cannot verify that the cron name is unused; creation was not attempted`);if(n.crons.some(e=>e.name===t.trim()))throw Error(q(t.trim()))}function oe(e){let t=Number(e);if(!Number.isInteger(t)||t<=0)return null;if(t<1e3)return`every ${t}ms`;for(let[e,n]of[[864e5,`d`],[36e5,`h`],[6e4,`m`],[1e3,`s`]])if(t>=e){let r=t/e;return`${Number.isInteger(r)?``:`≈ `}every ${Math.round(r*10)/10}${n}`}return null}function Y(e,t,n,r){if(!e.trim())return{ok:!0};let i=Number(e);return!Number.isSafeInteger(i)||i<n||i>r?{ok:!1,msg:`${t} must be a whole number from ${n} to ${r}`}:{ok:!0,value:i}}function se(e,t=Date.now()){let n=e.name.trim(),r=e.queue.trim();if(!n)return{ok:!1,msg:`Name is required`};if(n.length>256)return{ok:!1,msg:`Name must be 256 characters or fewer`};let a=i(n,`Name`,256);if(a)return{ok:!1,msg:a};let o=T(r);if(o)return{ok:!1,msg:o};let s=e.jobName?.trim()||`default`;if(s.length>256)return{ok:!1,msg:`Spawned job name must be 256 characters or fewer`};let c={};if(e.dataText.trim()){let t=ne(e.dataText);if(!t.ok)return{ok:!1,msg:t.kind===`json`?`Data is not valid JSON`:t.msg};c=t.data}let l={name:n,jobName:s,queue:r,data:c,preventOverlap:e.preventOverlap,skipIfNoWorker:e.skipIfNoWorker,immediately:e.immediately,skipMissedOnRestart:e.skipMissedOnRestart};if(e.mode===`cron`){let n=e.schedule.trim();if(!n)return{ok:!1,msg:`Cron expression required`};let r=B(n,1,t);if(!r.valid)return{ok:!1,msg:`Cron expression is not supported by Bunqueue 2.9: ${r.error??`invalid syntax`}`};l.schedule=n}else{let t=Y(e.every,`Interval`,1,U);if(!t.ok||t.value===void 0)return{ok:!1,msg:t.ok?`Interval is required`:t.msg};l.repeatEvery=t.value}let u=e.timezone.trim();if(u){if(e.mode!==`cron`)return{ok:!1,msg:`Timezone applies only to cron expressions, not intervals`};try{new Intl.DateTimeFormat(`en`,{timeZone:u}).format(t)}catch{return{ok:!1,msg:`Timezone must be a valid IANA timezone`}}l.timezone=u}let d=Y(e.priority,`Priority`,-1e6,1e6);if(!d.ok)return d;d.value!==void 0&&(l.priority=d.value);let f=Y(e.maxLimit,`Max executions`,1,2**53-1);if(!f.ok)return f;f.value!==void 0&&(l.maxLimit=f.value);let p=e.uniqueKey.trim();if(p.length>1024)return{ok:!1,msg:`Unique key must be 1024 characters or fewer`};p&&(l.uniqueKey=p);let m=Y(e.dedupTtl,`Dedup TTL`,1,U);if(!m.ok)return m;let h=m.value!==void 0||e.dedupExtend||e.dedupReplace;if(e.dedupExtend&&e.dedupReplace)return{ok:!1,msg:`Dedup extend and replace are mutually exclusive`};if(e.dedupExtend&&m.value===void 0)return{ok:!1,msg:`Dedup extend requires a TTL`};if(h&&!p&&!e.preventOverlap)return{ok:!1,msg:`Dedup options require a unique key or Prevent overlap`};h&&(l.dedup={...m.value===void 0?{}:{ttl:m.value},...e.dedupExtend?{extend:!0}:{},...e.dedupReplace?{replace:!0}:{}});let g=[{raw:e.jobMaxAttempts,label:`Spawned-job max attempts`,min:1,max:1e3,key:`maxAttempts`},{raw:e.jobBackoff,label:`Spawned-job backoff`,min:0,max:W,key:`backoff`},{raw:e.jobTimeout,label:`Spawned-job timeout`,min:0,max:W,key:`timeout`},{raw:e.jobDelay,label:`Spawned-job delay`,min:0,max:U,key:`delay`},{raw:e.jobStallTimeout,label:`Spawned-job stall timeout`,min:0,max:W,key:`stallTimeout`}],_={};for(let e of g){let t=Y(e.raw,e.label,e.min,e.max);if(!t.ok)return t;t.value!==void 0&&(_[e.key]=t.value)}return e.jobRemoveOnComplete&&(_.removeOnComplete=!0),e.jobRemoveOnFail&&(_.removeOnFail=!0),Object.keys(_).length&&(l.jobOptions=_),{ok:!0,body:l}}var X=r();function ce({values:e,setValue:t}){return(0,X.jsxs)(`div`,{id:`cron-advanced-options`,className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,X.jsx)(w,{label:`Timezone (IANA)`,hint:`e.g. Europe/Rome. Default: server timezone.`,children:(0,X.jsx)(S,{name:`cron-timezone`,autoComplete:`off`,value:e.timezone,onChange:e=>t(`timezone`,e.target.value),placeholder:`Europe/Rome`})}),(0,X.jsx)(w,{label:`Priority`,children:(0,X.jsx)(S,{type:`number`,min:-1e6,max:1e6,step:1,name:`cron-priority`,value:e.priority,onChange:e=>t(`priority`,e.target.value),placeholder:`0`})}),(0,X.jsx)(w,{label:`Max executions`,hint:`blank = unlimited`,children:(0,X.jsx)(S,{type:`number`,min:1,max:2**53-1,step:1,name:`cron-max-executions`,value:e.maxLimit,onChange:e=>t(`maxLimit`,e.target.value),placeholder:`∞`})}),(0,X.jsx)(w,{label:`Unique key`,hint:`optional deduplication key`,children:(0,X.jsx)(S,{name:`cron-unique-key`,autoComplete:`off`,maxLength:1024,value:e.uniqueKey,onChange:e=>t(`uniqueKey`,e.target.value),placeholder:`daily-report`})}),(0,X.jsxs)(`div`,{className:`col-span-2 flex flex-wrap gap-6`,children:[(0,X.jsx)(Q,{label:`prevent overlap`,checked:e.preventOverlap,onChange:e=>t(`preventOverlap`,e)}),(0,X.jsx)(Q,{label:`skip if no worker`,checked:e.skipIfNoWorker,onChange:e=>t(`skipIfNoWorker`,e)}),(0,X.jsx)(Q,{label:`run immediately`,checked:e.immediately,onChange:e=>t(`immediately`,e)}),(0,X.jsx)(Q,{label:`skip missed on restart`,checked:e.skipMissedOnRestart,onChange:e=>t(`skipMissedOnRestart`,e)})]}),(0,X.jsxs)(`div`,{className:`col-span-2`,children:[(0,X.jsx)(`div`,{className:`mb-2 text-[11px] uppercase tracking-wider text-faint`,children:`Cron deduplication`}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,X.jsx)(w,{label:`Dedup TTL (ms)`,hint:`blank = no TTL`,children:(0,X.jsx)(S,{type:`number`,min:1,max:U,step:1,name:`cron-dedup-ttl`,value:e.dedupTtl,onChange:e=>t(`dedupTtl`,e.target.value),placeholder:`60000`})}),(0,X.jsx)(Q,{className:`items-end pb-2`,label:`extend TTL`,controlLabel:`extend dedup TTL`,checked:e.dedupExtend,onChange:e=>t(`dedupExtend`,e)}),(0,X.jsx)(Q,{className:`items-end pb-2`,label:`replace duplicate`,checked:e.dedupReplace,onChange:e=>t(`dedupReplace`,e)})]})]}),(0,X.jsxs)(`div`,{className:`col-span-2`,children:[(0,X.jsx)(`div`,{className:`mb-2 text-[11px] uppercase tracking-wider text-faint`,children:`Spawned-job options`}),(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-5`,children:[(0,X.jsx)(Z,{label:`Max attempts`,name:`cron-job-max-attempts`,value:e.jobMaxAttempts,min:1,max:1e3,placeholder:`3`,onChange:e=>t(`jobMaxAttempts`,e)}),(0,X.jsx)(Z,{label:`Backoff (ms)`,name:`cron-job-backoff`,value:e.jobBackoff,min:0,max:W,placeholder:`1000`,onChange:e=>t(`jobBackoff`,e)}),(0,X.jsx)(Z,{label:`Timeout (ms)`,name:`cron-job-timeout`,value:e.jobTimeout,min:0,max:W,placeholder:`—`,onChange:e=>t(`jobTimeout`,e)}),(0,X.jsx)(Z,{label:`Delay (ms)`,name:`cron-job-delay`,value:e.jobDelay,min:0,max:U,placeholder:`0`,onChange:e=>t(`jobDelay`,e)}),(0,X.jsx)(Z,{label:`Stall timeout (ms)`,name:`cron-job-stall-timeout`,value:e.jobStallTimeout,min:0,max:W,placeholder:`server default`,onChange:e=>t(`jobStallTimeout`,e)})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-6`,children:[(0,X.jsx)(Q,{label:`remove on complete`,controlLabel:`remove spawned jobs on complete`,checked:e.jobRemoveOnComplete,onChange:e=>t(`jobRemoveOnComplete`,e)}),(0,X.jsx)(Q,{label:`remove on fail`,controlLabel:`remove spawned jobs on fail`,checked:e.jobRemoveOnFail,onChange:e=>t(`jobRemoveOnFail`,e)})]})]})]})}function Z({label:e,name:t,value:n,min:r,max:i,placeholder:a,onChange:o}){return(0,X.jsx)(w,{label:e,children:(0,X.jsx)(S,{type:`number`,min:r,max:i,step:1,name:t,value:n,onChange:e=>o(e.target.value),placeholder:a})})}function Q({label:e,controlLabel:t=e,checked:n,onChange:r,className:i=`items-center`}){return(0,X.jsxs)(`div`,{className:`flex gap-2 ${i}`,children:[(0,X.jsx)(C,{checked:n,onChange:r,label:t}),(0,X.jsx)(`span`,{className:`text-sm text-muted`,children:e})]})}function le({values:e,setValue:n}){let r=e.mode===`cron`&&e.schedule.trim()?B(e.schedule.trim(),3,Date.now()):null,i=oe(e.every);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,X.jsx)(w,{label:`Name`,children:(0,X.jsx)(S,{name:`cron-name`,autoComplete:`off`,maxLength:256,value:e.name,onChange:e=>n(`name`,e.target.value),placeholder:`daily-report`})}),(0,X.jsx)(w,{label:`Queue`,children:(0,X.jsx)(S,{name:`cron-queue`,autoComplete:`off`,maxLength:256,value:e.queue,onChange:e=>n(`queue`,e.target.value),placeholder:`reports`})}),(0,X.jsx)(w,{label:`Spawned job name`,hint:`First-class worker routing name; separate from schedule data.`,children:(0,X.jsx)(S,{name:`cron-job-name`,autoComplete:`off`,maxLength:256,value:e.jobName,onChange:e=>n(`jobName`,e.target.value),placeholder:`default`})})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,X.jsxs)(`fieldset`,{children:[(0,X.jsx)(`legend`,{className:`sr-only`,children:`Schedule type`}),(0,X.jsx)(x,{options:[`cron`,`every`],value:e.mode,onChange:e=>n(`mode`,e)})]}),e.mode===`cron`?(0,X.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,X.jsx)(w,{label:`Cron expression`,hint:`Standard 5-field syntax, 6 fields with leading seconds, or an official @hourly/@daily-style shortcut. Croner extensions L/W/#/? are rejected by Bunqueue 2.9.`,children:(0,X.jsx)(S,{name:`cron-expression`,value:e.schedule,onChange:e=>n(`schedule`,e.target.value),placeholder:`0 9 * * *`})})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`w-40`,children:(0,X.jsx)(w,{label:`Every (ms)`,children:(0,X.jsx)(S,{type:`number`,min:1,max:U,step:1,name:`cron-interval`,value:e.every,onChange:e=>n(`every`,e.target.value),placeholder:`30000`})})}),e.every.trim()!==``&&(0,X.jsx)(`span`,{className:t(`pb-2 text-xs`,i?`text-muted`:`text-danger`),children:i??`not a valid interval`})]})]}),e.mode===`cron`&&e.schedule.trim()&&r&&(0,X.jsx)(`div`,{className:`rounded-lg border border-line bg-surface-2 px-3 py-2 text-xs`,children:r.valid?r.runs.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsxs)(`span`,{className:`text-faint`,children:[`Next runs`,e.timezone.trim()?` (local)`:``,`:`]}),r.runs.map(e=>(0,X.jsx)(`span`,{className:`font-mono text-muted`,children:y(e)},e)),e.timezone.trim()&&(0,X.jsxs)(`span`,{className:`text-faint`,children:[`— server evaluates in `,e.timezone.trim()]})]}):(0,X.jsx)(`span`,{className:`text-warning`,children:`Valid, but no runs in the next few years.`}):(0,X.jsxs)(`span`,{className:`text-warning`,children:[`Unsupported expression: `,r.error,` Fix it before creating the schedule.`]})}),(0,X.jsx)(w,{label:`Data (JSON)`,children:(0,X.jsx)(`textarea`,{name:`cron-data`,value:e.dataText,onChange:e=>n(`dataText`,e.target.value),maxLength:re,rows:3,spellCheck:!1,className:`w-full rounded-lg border border-line bg-surface-2 px-3 py-2 font-mono text-sm text-fg placeholder:text-faint transition-colors focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})})]})}function $(e){let[t,n]=(0,E.useState)(0);return(0,E.useEffect)(()=>{t>e-1&&n(e-1)},[t,e]),[Math.min(t,e-1),n]}function ue(e){let[t,n]=(0,E.useState)(!1),r=(0,E.useRef)(null),i=()=>{r.current&&clearTimeout(r.current),r.current=null};return(0,E.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),{on:t,fire:()=>{i(),n(!0),r.current=setTimeout(()=>n(!1),e)},reset:()=>{i(),n(!1)}}}var de={name:``,jobName:`default`,queue:``,mode:`cron`,schedule:``,every:``,dataText:`{}`,timezone:``,priority:``,preventOverlap:!0,skipIfNoWorker:!1,maxLimit:``,immediately:!1,skipMissedOnRestart:!0,uniqueKey:``,dedupTtl:``,dedupExtend:!1,dedupReplace:!1,jobMaxAttempts:``,jobBackoff:``,jobTimeout:``,jobDelay:``,jobStallTimeout:``,jobRemoveOnComplete:!1,jobRemoveOnFail:!1};function fe({onCreate:e,onAccepted:t,beginCreate:n,scopeKey:r,existingNames:i}){let[a,s]=(0,E.useState)(de),[c,l]=(0,E.useState)(!1),[u,f]=(0,E.useState)(null),[p,m]=(0,E.useState)(!1),{on:h,fire:g,reset:_}=ue(3e3),v=(e,t)=>s(n=>({...n,[e]:t}));(0,E.useEffect)(()=>{m(!1),f(null),_()},[r]);let y=J(a.name,i),b=async()=>{f(null),_();let r=se(a);if(!r.ok){f(r.msg);return}let c=J(r.body.name,i);if(c){f(c);return}if(!window.confirm(`Submit an upsert for cron "${r.body.name}"? Bunqueue v2.9.2 has no atomic create-only condition. The dashboard will recheck immediately before writing, but another client using the same name at the same time could still be replaced. Continue only if you authorize last-writer-wins behavior for this globally unique name.`))return;let l=n(r.body.name);if(l){m(!0);try{if(K(await e(r.body,l.isCurrent),r.body),!l.isCurrent())return;s(e=>({...e,name:``,schedule:``,every:``})),g(),o.success(`Cron upsert acknowledged`,r.body.name),t()}catch(e){l.isCurrent()&&f(e.message)}finally{l.finish()&&m(!1)}}};return(0,X.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,X.jsx)(le,{values:a,setValue:v}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-expanded":c,"aria-controls":`cron-advanced-options`,className:`text-xs font-medium text-muted hover:text-fg`,children:c?`− Hide advanced`:`+ Advanced options`}),c&&(0,X.jsx)(ce,{values:a,setValue:v})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(d,{type:`submit`,variant:`accent`,size:`sm`,disabled:p||!!y,children:p?`Saving…`:y?`Name already exists`:`Submit upsert`}),y&&!u&&(0,X.jsx)(`span`,{role:`alert`,className:`max-w-2xl text-xs text-warning`,children:y}),u&&(0,X.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:u}),h&&(0,X.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Cron upsert acknowledged ✓`})]}),(0,X.jsx)(`p`,{className:`text-xs text-warning`,children:`Creation is an upstream upsert, not an atomic create-only operation. Use a globally unique name; the fail-closed preflight cannot eliminate a simultaneous write from another client.`})]})}function pe({crons:e,page:t,removing:n,onPageChange:r,onRemove:i}){let a=e.slice(t*15,t*15+15);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,X.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Name`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Queue`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Job name`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Schedule`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Next Run`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Runs`}),(0,X.jsx)(`th`,{scope:`col`,className:`w-12 px-5 py-3`})]})}),(0,X.jsx)(`tbody`,{children:a.map(e=>(0,X.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,X.jsx)(`td`,{className:`px-5 py-3 font-medium text-fg`,children:e.name}),(0,X.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue}),(0,X.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.jobName??`default`}),(0,X.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.schedule??(e.repeatEvery?`every ${e.repeatEvery}ms`:`—`)}),(0,X.jsx)(`td`,{className:`px-5 py-3 text-faint`,children:y(e.nextRun)}),(0,X.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:b(e.executions)}),(0,X.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,X.jsx)(u,{"aria-label":`Delete cron ${e.name}`,disabled:n.has(e.name),onClick:()=>i(e.name),children:(0,X.jsx)(s,{className:`size-3.5`})})})]},e.name))})]})}),(0,X.jsx)(ee,{page:t,pageSize:15,total:e.length,onPageChange:r,label:`crons`})]})}function me(){let{data:e,error:t,loading:n,refetch:r}=l(()=>a.crons(),[]),i=e?.crons??[],s=(0,E.useMemo)(()=>new Set(i.map(e=>e.name)),[i]),[u,d]=$(Math.max(1,Math.ceil(i.length/15))),[y,b]=(0,E.useState)(null),[x,S]=(0,E.useState)(new Set),C=te(`cron-manager`);(0,E.useEffect)(()=>{b(null),S(new Set)},[C.scopeKey]);let w=async e=>{if(!window.confirm(`Delete cron "${e}"? It will not be recreated automatically; creating a replacement is a separate action.`))return;let t=C.begin(`cron:${e}`);if(t){b(null),S(t=>new Set(t).add(e));try{if(G(await a.deleteCron(e)),!t.isCurrent())return;o.success(`Cron deleted`,e),r()}catch(e){if(!t.isCurrent())return;b(e.message),o.error(`Delete cron failed`,e.message)}finally{t.finish()&&S(t=>{let n=new Set(t);return n.delete(e),n})}}};return(0,X.jsxs)(`div`,{children:[t&&e&&(0,X.jsx)(m,{message:`Cron refresh failed — showing the last successful schedule list.`,onRetry:r}),(0,X.jsx)(v,{title:`Cron Manager`,description:`Submit explicitly acknowledged schedule upserts and manage repeatable jobs.`,live:!!e&&!t}),y&&(0,X.jsx)(`div`,{role:`status`,className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:y}),(0,X.jsxs)(p,{className:`mb-6`,children:[(0,X.jsx)(f,{title:`Create schedule via upstream upsert`}),(0,X.jsx)(fe,{existingNames:s,onCreate:async(e,t)=>{let n=await a.crons();if(!t())throw Error(`Cron creation target changed during preflight`);return ae(n,e.name),a.createCron(e)},onAccepted:r,beginCreate:e=>C.begin(`cron:${e}`),scopeKey:C.scopeKey})]}),t&&!e?(0,X.jsx)(h,{error:t,onRetry:r}):n&&!e?(0,X.jsx)(g,{label:`Loading crons…`}):i.length===0?(0,X.jsx)(_,{icon:(0,X.jsx)(c,{}),title:`No scheduled jobs`,hint:`Submit one above.`}):(0,X.jsx)(pe,{crons:i,page:u,removing:x,onPageChange:d,onRemove:e=>void w(e)})]})}export{me as CronManager};
@@ -1,3 +0,0 @@
1
- import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,h as r,t as i}from"./react-vendor-CvwrP0tU.js";import{o as a}from"./connectionStore-CFuNYZ_8.js";import{a as o,i as s,t as c}from"./bq-C7wdABtE.js";import{t as l}from"./toastStore-B31o6Z5J.js";import{T as u,o as d}from"./icons-BVzwsfbG.js";import{n as f}from"./usePolledData-CNtNtd0a.js";import{t as p}from"./Button-Ch1W94fJ.js";import{n as m,t as h}from"./Card-CWxrC8OY.js";import{i as g,n as _,r as v,t as y}from"./feedback-QDN1AsYt.js";import{t as b}from"./PageHeader-CvIyaFOO.js";import{n as x,s as S}from"./format-Cg7VCIZW.js";import{a as C,c as w,n as T,s as E}from"./index-AUHH2nTG.js";import{a as D}from"./form-C4oby9pI.js";import{t as ee}from"./Pagination-x-Cwgrul.js";var O=e(r(),1),k=e(n(),1),A=i();function j({columns:e,filter:t,onChange:n}){let[r,i]=(0,k.useState)(t?.column??``),[a,o]=(0,k.useState)(t?.op??`contains`),[s,c]=(0,k.useState)(t?.value??``),l=r||e[0]||``,d=()=>n(s.trim()?{column:l,op:a,value:s.trim()}:null);return e.length===0?null:(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`w-40`,children:(0,A.jsx)(D,{value:l,"aria-label":`Filter column`,name:`database-filter-column`,autoComplete:`off`,onChange:e=>i(e.target.value),children:e.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))})}),(0,A.jsx)(`div`,{className:`w-32`,children:(0,A.jsxs)(D,{value:a,"aria-label":`Filter operator`,name:`database-filter-operator`,autoComplete:`off`,onChange:e=>o(e.target.value),children:[(0,A.jsx)(`option`,{value:`contains`,children:`contains`}),(0,A.jsx)(`option`,{value:`eq`,children:`=`}),(0,A.jsx)(`option`,{value:`ne`,children:`≠`})]})}),(0,A.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,A.jsx)(u,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,A.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&d(),"aria-label":`Filter value`,name:`database-filter-value`,autoComplete:`off`,placeholder:`value — Enter to filter`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-8 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,A.jsx)(p,{size:`sm`,onClick:d,disabled:!s.trim(),children:`Filter`}),t&&(0,A.jsx)(p,{size:`sm`,variant:`ghost`,onClick:()=>{c(``),n(null)},children:`Clear`}),(0,A.jsx)(`span`,{className:`text-[11px] text-faint`,children:`filters the whole table, server-side`})]})}var M=`bq-dash-db-history`,N=10,P=2e4,F=100;function I(e){let t=e==null?``:String(e),n=typeof e==`string`&&/^[=+\-@\t\r]/.test(e)?`'${e}`:t;return/[",\r\n]/.test(n)?`"${n.replaceAll(`"`,`""`)}"`:n}function L(e,t){return[e.map(I).join(`,`),...t.map(e=>e.map(I).join(`,`))].join(`
2
- `)}function R(e,t,n){let r=URL.createObjectURL(new Blob([n],{type:t})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)}function z(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e.slice(0,F))if(!(typeof r!=`string`||r.length===0||r.length>P||n.has(r))&&(n.add(r),t.push(r),t.length===N))break;return t}function B(){try{return z(JSON.parse(localStorage.getItem(M)??`[]`))}catch{return[]}}function V(e){let t=z(e);try{localStorage.setItem(M,JSON.stringify(t))}catch{}return t}function H(e){return V([e,...B().filter(t=>t!==e)].slice(0,N))}function U(e){if(e==null)return`NULL`;let t=typeof e==`string`?e:String(e),n=t.trimStart();if(n.startsWith(`{`)||n.startsWith(`[`))try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return t}async function W(e,t=c.captureAgentRequestTarget(),n){let r=Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:e.filter?Object.freeze({...e.filter}):void 0});return c.getDbExportAtTarget(t,r,n)}var G=e=>JSON.stringify([e.baseUrl,e.token,e.agentToken]);function te({value:e,align:n}){if(e==null)return(0,A.jsx)(`span`,{className:`italic text-faint`,children:`NULL`});let r=typeof e==`string`?e:String(e);return(0,A.jsx)(`span`,{className:t(`block max-w-[24rem] truncate`,n===`right`&&`text-right tabular-nums`),title:r,children:r})}function ne({columns:e,rows:n,truncatedCells:r,colMeta:i,sort:a,onSort:o,onRowClick:s,dimmed:c}){let l=(0,k.useMemo)(()=>e.map((e,t)=>{let r=i?.[e]?.type?.toUpperCase()??``;if(/INT|REAL|NUM|DEC|DOUB|FLOA/.test(r))return!0;let a=!1;for(let e of n){let n=e[t];if(n!=null&&(a=!0,typeof n!=`number`))return!1}return a}),[e,n,i]);return(0,A.jsx)(`div`,{className:t(`max-h-[70vh] overflow-auto rounded-xl border border-line bg-surface transition-opacity`,c&&`pointer-events-none opacity-50`),children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`text-left text-[11px] uppercase tracking-wider text-faint`,children:[s&&(0,A.jsx)(`th`,{className:`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,children:(0,A.jsx)(`span`,{className:`sr-only`,children:`Row actions`})}),e.map((e,n)=>{let r=i?.[e];return(0,A.jsx)(`th`,{className:t(`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,l[n]&&`text-right`),"aria-sort":a?.col===e?a.dir===`asc`?`ascending`:`descending`:o?`none`:void 0,children:o?(0,A.jsxs)(`button`,{type:`button`,onClick:()=>o(e),"aria-label":`Sort by ${e}`,className:`inline-flex items-center gap-1 uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[e,r?.primaryKey&&(0,A.jsx)(`span`,{className:`rounded bg-accent/15 px-1 py-0.5 text-[9px] font-semibold text-accent`,children:`PK`}),r?.type&&(0,A.jsx)(`span`,{className:`text-faint/70`,children:r.type.toLowerCase()}),(0,A.jsx)(`span`,{"aria-hidden":`true`,className:a?.col===e?`text-accent`:`text-faint/60`,children:a?.col===e?a.dir===`asc`?`▲`:`▼`:`↕`})]}):e},e)})]})}),(0,A.jsx)(`tbody`,{children:n.map((e,t)=>(0,A.jsxs)(`tr`,{className:`border-b border-line font-mono text-xs last:border-0 hover:bg-surface-2/40`,children:[s&&(0,A.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`View row ${t+1} details`,onClick:()=>s(t),className:`rounded-md border border-line px-2 py-1 font-sans text-[11px] font-medium text-muted transition-colors hover:border-line-strong hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`View`})}),e.map((e,n)=>(0,A.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2 text-muted`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(te,{value:e,align:l[n]?`right`:`left`}),r?.[t]?.[n]&&(0,A.jsx)(`span`,{title:`Value truncated — use the row's View action to read it in full`,className:`shrink-0 rounded bg-warning/15 px-1 text-[9px] font-semibold text-warning`,children:`…`})]})},n))]},t))})]})})}function K(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed database query response.`);let t=e;if(t.ok!==!0||!Array.isArray(t.columns)||t.columns.some(e=>typeof e!=`string`)||!Array.isArray(t.rows)||t.rows.length>500||t.rows.some(e=>!Array.isArray(e)||e.length!==t.columns.length)||!Number.isSafeInteger(t.rowCount)||t.rowCount!==t.rows.length||typeof t.truncated!=`boolean`||typeof t.ms!=`number`||!Number.isFinite(t.ms)||t.ms<0)throw Error(`Malformed database query response.`);return{columns:[...t.columns],rows:t.rows.map(e=>[...e]),rowCount:t.rowCount,truncated:t.truncated,ms:t.ms}}function re({sql:e,setSql:t,editorRef:n}){let r=a(G),[i,o]=(0,k.useState)(null),[s,l]=(0,k.useState)(null),[u,d]=(0,k.useState)(B),[f,g]=(0,k.useState)(null),_=(0,k.useRef)(0),v=(0,k.useRef)(null),y=(0,k.useRef)(r);y.current!==r&&(y.current=r,_.current++,v.current=null),(0,k.useEffect)(()=>(_.current++,v.current=null,o(null),l(null),g(null),()=>{_.current++,v.current=null}),[r]);let b=i===r,x=s?.target===r?s.message:null,C=f?.target===r?f:null,w=async(t=e,n=!0)=>{let i=t.trim();if(!i||v.current?.target===r)return;let s=++_.current,u=r;v.current={generation:s,target:u},o(u),l(null);try{let e=K(await c.db.query(t));if(s!==_.current||G(a.getState())!==u)return;g({...e,target:u}),n&&d(H(i))}catch(e){if(s!==_.current||G(a.getState())!==u)return;g(null),l({target:u,message:e.message})}finally{v.current?.generation===s&&(v.current=null),s===_.current&&o(null)}};return(0,A.jsxs)(h,{className:`mt-6`,children:[(0,A.jsx)(m,{title:`Query`,action:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(p,{size:`sm`,disabled:b||!e.trim(),onClick:()=>{let t=e.trim();t&&w(`EXPLAIN QUERY PLAN ${t}`,!1)},children:`Explain`}),(0,A.jsx)(p,{size:`sm`,variant:`accent`,disabled:b||!e.trim(),onClick:()=>w(),children:b?`Running…`:`Run`})]})}),(0,A.jsx)(`textarea`,{name:`database-sql-query`,autoComplete:`off`,ref:n,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&w()},rows:3,spellCheck:!1,"aria-label":`SQL query`,placeholder:`SELECT … — read-only: writes are rejected by the engine`,className:`w-full resize-y 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,A.jsx)(`p`,{className:`mt-1 text-[11px] text-faint`,children:`⌘/Ctrl+Enter runs. Connection is read-only.`}),u.length>0&&(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`History`}),u.map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>t(e),title:e,className:`max-w-56 truncate rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:e},e)),(0,A.jsx)(`button`,{type:`button`,onClick:()=>{V([]),d([])},className:`rounded-md px-2 py-1 text-[11px] text-faint transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Clear`})]}),(0,A.jsxs)(`div`,{"aria-live":`polite`,children:[x&&(0,A.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:x}),C&&!x&&(0,A.jsxs)(`div`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,A.jsxs)(`p`,{className:`text-xs text-faint`,children:[C.truncated?`≥ `:``,S(C.rowCount),` row`,C.rowCount===1?``:`s`,` · `,S(C.ms),` ms`,C.truncated&&(0,A.jsxs)(`span`,{className:`text-warning`,children:[` — showing first `,C.rows.length]})]}),C.rows.length>0&&(0,A.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,A.jsx)(p,{size:`sm`,onClick:()=>R(`query-results.csv`,`text/csv`,L(C.columns,C.rows)),children:`CSV`}),(0,A.jsx)(p,{size:`sm`,onClick:()=>R(`query-results.json`,`application/json`,JSON.stringify(C.rows.map(e=>Object.fromEntries(C.columns.map((t,n)=>[t,e[n]]))),null,2)),children:`JSON`})]})]}),C.rows.length>0?(0,A.jsx)(ne,{columns:C.columns,rows:C.rows}):(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`Query returned no rows.`})]})]})]})}var q=(e,t)=>t?e?.column===t.column&&e.op===t.op&&e.value===t.value:e===null;function J(e,t){return e.table===t.table&&e.limit===t.limit&&e.offset===t.offset&&e.orderBy===(t.orderBy??null)&&e.dir===t.dir&&q(e.filter,t.filter)}var Y=-(1n<<63n),X=(1n<<63n)-1n;function Z(e){if(e===null)return!0;if(typeof e==`number`)return Number.isSafeInteger(e);if(typeof e!=`string`||!/^-?(?:0|[1-9]\d*)$/.test(e)||e.length>20)return!1;try{let t=BigInt(e);return t>=Y&&t<=X}catch{return!1}}var ie=e=>e===null||typeof e==`string`||typeof e==`number`&&Number.isFinite(e);function ae(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed database rows response.`);let n=e,r=n.columns,i=n.rows,a=n.rowids,o=n.truncatedCells,s=n.filter,c=s===null||typeof s==`object`&&!!s&&!Array.isArray(s)&&typeof s.column==`string`&&(s.op===`contains`||s.op===`eq`||s.op===`ne`)&&typeof s.value==`string`;if(n.ok!==!0||typeof n.table!=`string`||!Array.isArray(r)||r.length===0||r.length>2e3||r.some(e=>typeof e!=`string`||!e)||new Set(r).size!==r.length||!Array.isArray(i)||i.length>t.limit||i.some(e=>!Array.isArray(e)||e.length!==r.length||e.some(e=>!ie(e)))||!Array.isArray(a)||a.length!==i.length||a.some(e=>!Z(e))||!Array.isArray(o)||o.length!==i.length||o.some(e=>!Array.isArray(e)||e.length!==r.length||e.some(e=>typeof e!=`boolean`))||!Number.isSafeInteger(n.total)||n.total<0||!Number.isSafeInteger(n.limit)||!Number.isSafeInteger(n.offset)||n.offset<0||n.orderBy!==null&&typeof n.orderBy!=`string`||n.dir!==`asc`&&n.dir!==`desc`||!c)throw Error(`Malformed database rows response.`);let l={ok:!0,table:n.table,columns:[...r],rows:i.map(e=>[...e]),rowids:[...a],truncatedCells:o.map(e=>[...e]),total:n.total,limit:n.limit,offset:n.offset,orderBy:n.orderBy,dir:n.dir,filter:s===null?null:{...s}};if(!J(l,t))throw Error(`Database rows identity mismatch: requested table "${t.table}" at offset ${t.offset}.`);let u=Math.min(l.limit,Math.max(0,l.total-l.offset));if(l.rows.length!==u)throw Error(`Malformed database rows response: row count does not match pagination metadata.`);return l}function Q(e,t){let n=e.rows[t],r=e.truncatedCells[t],i=e.rowids[t];return!n||!r||i===void 0||t<0?null:{index:t,table:e.table,columns:[...e.columns],row:[...n],rowid:i,truncated:[...r]}}var oe=(e,t)=>e.length===t.length&&e.every((e,n)=>Object.is(e,t[n]));function se(e,t){let n=Q(t,e.index);return n!==null&&n.table===e.table&&n.rowid===e.rowid&&oe(n.columns,e.columns)&&oe(n.row,e.row)&&oe(n.truncated,e.truncated)}function ce({schema:e}){return(0,A.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Column`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Type`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Constraints`}),(0,A.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Default`})]})}),(0,A.jsx)(`tbody`,{children:e.columns.map(e=>(0,A.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-fg`,children:e.name}),(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-muted`,children:e.type}),(0,A.jsxs)(`td`,{className:`px-4 py-2 text-xs`,children:[e.primaryKey&&(0,A.jsx)(`span`,{className:`mr-1 rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`PK`}),e.notNull&&(0,A.jsx)(`span`,{className:`rounded-md bg-surface-2 px-1.5 py-0.5 text-[10px] font-semibold text-muted`,children:`NOT NULL`})]}),(0,A.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-faint`,children:e.defaultValue??`—`})]},e.name))})]})}),(0,A.jsxs)(h,{children:[(0,A.jsx)(m,{title:`Indexes (${e.indexes.length})`}),e.indexes.length===0?(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`No indexes on this table.`}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.indexes.map(e=>(0,A.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-fg`,children:e.name}),e.unique&&(0,A.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`UNIQUE`}),(0,A.jsxs)(`span`,{className:`text-faint`,children:[`(`,e.columns.join(`, `),`)`]})]},e.name))})]}),e.sql&&(0,A.jsxs)(h,{children:[(0,A.jsx)(m,{title:`DDL`,action:(0,A.jsx)(C,{value:e.sql})}),(0,A.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:e.sql})]})]})}function le({db:e}){let{anyTruncated:n,colMeta:r,cycleSort:i,data:a,dbMissing:o,detail:s,editorRef:c,exportBusy:l,exportPage:u,exportTable:d,filter:f,info:m,infoError:C,msg:w,page:E,pageSize:D,queryThisTable:O,refetchInfo:k,refetchRows:M,refetchSchema:N,refetchTables:P,requestModal:F,rowsLoading:I,schema:L,schemaError:R,selectTable:z,selected:B,setDetailSelection:V,setFilter:H,setPage:U,setSql:W,setTab:G,sort:te,sql:K,tab:q,tables:J,tablesError:Y,tablesLoading:X,visibleRowsError:Z}=e;return(0,A.jsxs)(`div`,{"data-database-background":``,inert:s?!0:void 0,"aria-hidden":s?!0:void 0,children:[(0,A.jsx)(b,{title:`Database`,description:`SQLite inspector — schema, data and queries over a read-only connection.`,actions:(0,A.jsx)(`span`,{className:`rounded-full bg-emerald-500/10 px-2.5 py-1 text-[11px] font-medium text-success`,children:`read-only`})}),Y&&!o&&(0,A.jsx)(g,{message:`Could not read the database — ${Y.message}`,onRetry:P}),C&&!o&&(0,A.jsx)(g,{message:`Could not read database metadata — ${C.message}`,onRetry:k}),m&&(0,A.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-5`,children:[(0,A.jsx)(T,{label:`SQLite`,value:m.sqliteVersion,compact:!0}),(0,A.jsx)(T,{label:`On disk`,value:x(m.fileSize+m.walSize),compact:!0}),(0,A.jsx)(T,{label:`Journal`,value:m.journalMode.toUpperCase(),compact:!0}),(0,A.jsx)(T,{label:`Tables`,value:S(m.tables),compact:!0}),(0,A.jsx)(T,{label:`Indexes`,value:S(m.indexes),compact:!0})]}),o?(0,A.jsx)(y,{title:`No database yet`,hint:Y.message}):X&&J.length===0?(0,A.jsx)(v,{label:`Reading database…`}):(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-4`,children:[(0,A.jsxs)(h,{padded:!1,className:`self-start overflow-hidden`,children:[(0,A.jsxs)(`div`,{className:`border-b border-line px-4 py-3 text-[11px] font-medium uppercase tracking-wider text-faint`,children:[`Tables (`,J.length,`)`]}),(0,A.jsxs)(`ul`,{className:`max-h-[28rem] overflow-y-auto`,children:[J.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,onClick:()=>z(e.name),className:t(`flex w-full items-center justify-between gap-2 px-4 py-2 text-left text-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,B===e.name?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.name}),(0,A.jsx)(`span`,{className:`shrink-0 text-[11px] text-faint tabular-nums`,children:S(e.rows)})]})},e.name)),J.length===0&&(0,A.jsx)(`li`,{className:`px-4 py-6 text-center text-xs text-faint`,children:`No tables.`})]})]}),(0,A.jsx)(`div`,{className:`min-w-0 lg:col-span-3`,children:J.length===0?(0,A.jsx)(y,{title:`No tables`,hint:`This database has no user tables yet.`}):(0,A.jsxs)(A.Fragment,{children:[B&&(0,A.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-sm text-fg`,title:B,children:B}),(0,A.jsx)(p,{size:`sm`,variant:`ghost`,onClick:O,children:`Query`}),(0,A.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[`data`,`schema`].map(e=>(0,A.jsx)(`button`,{type:`button`,onClick:()=>G(e),"aria-pressed":q===e,className:t(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,q===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`),children:e},e))}),q===`data`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(p,{size:`sm`,disabled:!a||a.rows.length===0,title:a?`Exports the ${a.rows.length} rows on this page only`:void 0,onClick:u,children:[`Export page`,a?` (${a.rows.length})`:``]}),(0,A.jsx)(p,{size:`sm`,variant:`accent`,disabled:l||!a||a.total===0,onClick:d,children:l?`Exporting…`:`Export table${a?` (${S(a.total)})`:``}`})]})]}),q===`data`&&B&&(0,A.jsx)(j,{columns:a?.columns??L?.columns.map(e=>e.name)??[],filter:f,onChange:e=>{H(e),U(0),V(null)}},B),w&&(0,A.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:w}),q===`schema`?R?(0,A.jsx)(y,{title:`Could not read schema`,hint:R.message,action:(0,A.jsx)(p,{size:`sm`,onClick:N,children:`Retry`})}):L?.table===B?(0,A.jsx)(ce,{schema:L}):(0,A.jsx)(v,{label:`Reading schema of ${B}…`}):Z?(0,A.jsx)(_,{error:Z,onRetry:M}):I&&!a?(0,A.jsx)(v,{label:`Reading ${B}…`}):a?a.total===0?(0,A.jsx)(y,{title:f?`No matching rows`:`Empty table`,hint:f?`No rows match the current filter.`:`"${a.table}" has no rows.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{columns:a.columns,rows:a.rows,truncatedCells:a.truncatedCells,colMeta:r,sort:te,onSort:i,onRowClick:e=>{let t=Q(a,e);t&&F(`database-row`)&&V(t)},dimmed:I&&!a}),n&&(0,A.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Cells over 2000 chars and BLOBs are abbreviated in the grid and CSV — use the row's View action to read the full value.`}),(0,A.jsx)(ee,{page:E,pageSize:D,total:a.total,onPageChange:e=>{U(e),V(null)},label:`rows`})]}):(0,A.jsx)(y,{title:`Select a table`,hint:`Pick a table on the left to browse its rows.`}),(0,A.jsx)(re,{sql:K,setSql:W,editorRef:c})]})})]})]})}var ue=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function de({table:e,columns:t,row:n,rowid:r,truncated:i,onClose:a}){let[o,s]=(0,k.useState)({}),[l,u]=(0,k.useState)({}),f=(0,k.useRef)(null),p=(0,k.useRef)(null),m=(0,k.useRef)(a);m.current=a,(0,k.useEffect)(()=>{let e=document.activeElement,t=f.current,n=()=>t?Array.from(t.querySelectorAll(ue)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`):[],r=(e=!1)=>{let r=n();(e?r.at(-1):r[0])?.focus(),r.length===0&&t?.focus()},i=e=>{if(e.key===`Escape`){e.preventDefault(),m.current();return}if(e.key!==`Tab`)return;let r=n();if(r.length===0){e.preventDefault(),t?.focus();return}let i=document.activeElement,a=r[0],o=r[r.length-1];e.shiftKey&&(i===a||!i||!t?.contains(i))?(e.preventDefault(),o.focus()):!e.shiftKey&&(i===o||!i||!t?.contains(i))&&(e.preventDefault(),a.focus())},a=e=>{t&&!t.contains(e.target)&&r()};return p.current?.focus(),document.activeElement!==p.current&&t?.focus(),document.addEventListener(`keydown`,i,!0),document.addEventListener(`focusin`,a),()=>{document.removeEventListener(`keydown`,i,!0),document.removeEventListener(`focusin`,a),E(`database-row`)&&e?.isConnected&&e.focus()}},[]);let h=JSON.stringify(t.filter((e,t)=>i[t]));return(0,k.useEffect)(()=>{s({}),u({});let t=JSON.parse(h);if(r==null||t.length===0)return;let n=!1;return Promise.all(t.map(async t=>{try{let i=await c.db.cell(e,r,t);if(!i||typeof i!=`object`||!Object.hasOwn(i,`value`))throw Error(`Malformed full-cell response.`);n||s(e=>({...e,[t]:i.value}))}catch(e){if(!n){let n=e instanceof Error?e.message:String(e);u(e=>({...e,[t]:n.slice(0,300)}))}}})),()=>{n=!0}},[e,r,h]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close row detail`,onClick:a,className:`fixed inset-0 z-40 bg-black/50`}),(0,A.jsxs)(`aside`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":`${e} row ${r??`detail`}`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-50 flex w-full max-w-xl flex-col border-l border-line bg-surface shadow-xl focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-4`,children:[(0,A.jsxs)(`h2`,{className:`font-mono text-sm text-fg`,children:[e,` · row detail`]}),(0,A.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Close`,onClick:a,className:`flex size-8 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,A.jsx)(d,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`flex-1 overscroll-contain overflow-y-auto p-5`,children:(0,A.jsx)(`dl`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>{let r=Object.hasOwn(o,e),a=r?o[e]:n[t],s=U(a),c=s.includes(`
3
- `)||s.length>80;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`dt`,{className:`mb-1 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-faint`,children:[e,a!=null&&(0,A.jsx)(C,{value:String(a)}),i[t]&&!r&&(Object.hasOwn(l,e)?(0,A.jsxs)(`span`,{role:`alert`,className:`normal-case text-danger`,children:[`(full value unavailable — `,l[e],`)`]}):(0,A.jsx)(`span`,{className:`text-warning`,children:`(loading full value…)`}))]}),(0,A.jsx)(`dd`,{children:a==null?(0,A.jsx)(`span`,{className:`italic text-faint`,children:`NULL`}):c?(0,A.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:s}):(0,A.jsx)(`span`,{className:`break-words font-mono text-sm text-fg`,children:s})})]},e)})})})]})]})}function fe({data:e,filter:t,page:n,selected:r,sort:i}){let o=a(G),[u,d]=(0,k.useState)(!1),[f,p]=(0,k.useState)(null),m=(0,k.useRef)(!1),h=(0,k.useRef)(null);return(0,k.useEffect)(()=>(h.current?.abort(),h.current=null,m.current=!1,d(!1),p(null),()=>{h.current?.abort(),h.current=null,m.current=!1}),[o]),{exportBusy:u,exportPage:()=>{e&&R(`${e.table}-page${n+1}.csv`,`text/csv`,L(e.columns,e.rows))},exportTable:async()=>{if(!r||m.current)return;m.current=!0;let e=G(a.getState()),n={table:r,orderBy:i?.col,dir:i?.dir??`asc`,filter:t?{...t}:void 0},o=c.captureAgentRequestTarget(),u=new AbortController;h.current=u,d(!0),p(null);try{let t=await W(n,o,u.signal);if(u.signal.aborted||G(a.getState())!==e)return;R(`${n.table}.csv`,`text/csv;charset=utf-8`,t.content);let r=t.cap===`rows`?`Exported the first ${S(t.rowCount)} rows (row cap reached)`:t.cap===`bytes`?`Exported ${S(t.rowCount)} rows (${x(s)} byte cap reached)`:`Exported ${S(t.rowCount)} rows`;p(r),l.success(`Export of ${n.table} complete`,r)}catch(t){if(u.signal.aborted||G(a.getState())!==e)return;p(`Export failed: ${t.message}`),l.error(`Export of ${n.table} failed`,t.message)}finally{h.current===u&&(h.current=null,m.current=!1,u.signal.aborted||d(!1))}},msg:f}}var $=50;function pe(){let[e,t]=(0,k.useState)(``),[n,r]=(0,k.useState)(0),[i,a]=(0,k.useState)(null),[s,l]=(0,k.useState)(`data`),[u,d]=(0,k.useState)(null),[p,m]=(0,k.useState)(null),h=w(e=>e.active),g=w(e=>e.request),_=w(e=>e.release),[v,y]=(0,k.useState)(`SELECT name FROM sqlite_master WHERE type = 'table'`),b=(0,k.useRef)(null);(0,k.useEffect)(()=>{p===null?_(`database-row`):h!==`database-row`&&m(null)},[p,h,_]),(0,k.useEffect)(()=>()=>{w.getState().release(`database-row`)},[]);let{data:x,error:S,loading:C,refetch:T}=f(()=>c.db.tables(),[],{intervalMs:1e4}),E=(0,k.useMemo)(()=>x?.tables??[],[x]),D=S instanceof o&&S.status===404,{data:ee,error:O,refetch:A}=f(()=>D?Promise.resolve(null):c.db.info(),[D],{intervalMs:15e3}),j=e||E[0]?.name||``;(0,k.useEffect)(()=>{!e&&E[0]&&t(E[0].name)},[e,E]);let{data:M,error:N,refetch:P}=f(()=>j?c.db.schema(j):Promise.resolve(null),[j],{intervalMs:3e4}),F=(0,k.useMemo)(()=>{let e={};if(M?.table===j)for(let t of M.columns)e[t.name]={type:t.type,primaryKey:t.primaryKey};return e},[M,j]),I=u?JSON.stringify([u.column,u.op,u.value]):``,{data:L,error:R,loading:z,refetch:B}=f((0,k.useCallback)(async()=>{if(!j)return null;let e={table:j,limit:$,offset:n*$,orderBy:i?.col,dir:i?.dir??`asc`,filter:u??void 0};return ae(await c.db.rows(j,$,e.offset,i?.col,i?.dir,u??void 0),e)},[j,n,i,u]),[j,n,i,I],{intervalMs:6e3}),V={table:j,limit:$,offset:n*$,orderBy:i?.col,dir:i?.dir??`asc`,filter:u??void 0},H=!!L&&J(L,V),U=R??(L&&!H?Error(`Database rows identity no longer matches the selected table and page.`):null),W=!U&&H?L:null,G=p!==null&&W!==null&&se(p,W),te=G?p:null;(0,k.useEffect)(()=>{p&&!G&&m(null)},[p,G]),(0,k.useEffect)(()=>{W&&W.total>0&&W.rows.length===0&&n>0&&r(Math.max(0,Math.ceil(W.total/$)-1))},[W,n]);let ne=()=>{r(0),a(null),d(null),m(null)},K=e=>{t(e),l(`data`),ne()},re=e=>{r(0),m(null),a(t=>t?.col===e?t.dir===`asc`?{col:e,dir:`desc`}:null:{col:e,dir:`asc`})},q=()=>{let e=`SELECT * FROM "${j.replaceAll(`"`,`""`)}" LIMIT 100`;y(e),requestAnimationFrame(()=>{b.current?.focus(),b.current?.scrollIntoView({behavior:`smooth`,block:`center`})})},Y=!!W?.truncatedCells.some(e=>e.some(Boolean)),{exportBusy:X,exportPage:Z,exportTable:ie,msg:Q}=fe({data:W,filter:u,page:n,selected:j,sort:i});return{activeModal:h,anyTruncated:Y,colMeta:F,cycleSort:re,data:W,dbMissing:D,detail:te,editorRef:b,exportBusy:X,exportPage:Z,exportTable:ie,filter:u,info:ee,infoError:O,msg:Q,page:n,pageSize:$,queryThisTable:q,refetchInfo:A,refetchRows:B,refetchSchema:P,refetchTables:T,requestModal:g,rowsLoading:z,schema:M,schemaError:N,selectTable:K,selected:j,setDetailSelection:m,setFilter:d,setPage:r,setSql:y,setTab:l,sort:i,sql:v,tab:s,tables:E,tablesError:S,tablesLoading:C,visibleRowsError:U}}function me(){let e=pe(),{activeModal:t,detail:n,setDetailSelection:r}=e;return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(le,{db:e}),n&&t===`database-row`&&(0,O.createPortal)((0,A.jsx)(de,{table:n.table,columns:n.columns,row:n.row,rowid:n.rowid,truncated:n.truncated,onClose:()=>r(null)}),document.body)]})}export{me as Database};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./cn-zFEt5SO8.js";import{f as n,g as r,r as i,t as a}from"./react-vendor-CvwrP0tU.js";import{t as o}from"./bq-C7wdABtE.js";import{t as s}from"./toastStore-B31o6Z5J.js";import{C as c,d as l,u}from"./icons-BVzwsfbG.js";import{n as d}from"./usePolledData-CNtNtd0a.js";import{n as f,t as p}from"./Button-Ch1W94fJ.js";import{t as m}from"./Card-CWxrC8OY.js";import{i as h,n as g,r as _,t as v}from"./feedback-QDN1AsYt.js";import{t as y}from"./PageHeader-CvIyaFOO.js";import{l as b,s as x}from"./format-Cg7VCIZW.js";import{a as S}from"./form-C4oby9pI.js";import{t as C}from"./Pagination-x-Cwgrul.js";import{r as w,t as T}from"./flowMutationSafety-DSd3JLAV.js";import{t as E}from"./exportFile-C7xhE8Yh.js";import{t as D}from"./QueueControl-DusMoa05.js";var O=e(r(),1),k=a();function ee({total:e,discoveryError:n,healthy:r,statsError:i,queue:a,topReason:o,pendingRetry:s,reasonCount:c}){return(0,k.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,k.jsxs)(m,{children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Total in DLQ`}),(0,k.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,n?`bg-amber-500/10 text-warning`:e==null?`bg-surface-2 text-muted`:r?`bg-emerald-500/10 text-success`:`bg-red-500/10 text-danger`),children:n?`Unavailable`:e==null?`Loading`:r?`Healthy`:`Attention`})]}),(0,k.jsx)(`div`,{className:t(`mt-2 text-3xl font-bold tnum`,e==null||n?`text-muted`:r?`text-success`:`text-danger`),children:e==null?`—`:x(e)})]}),(0,k.jsxs)(m,{children:[(0,k.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Top Reason`}),(0,k.jsx)(`div`,{className:`mt-2 text-lg font-semibold text-fg`,children:n||i?`Unavailable`:a?o??`No failures`:`Select a queue`})]}),(0,k.jsxs)(m,{children:[(0,k.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Pending Retry`}),(0,k.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:s==null?`—`:x(s)}),(0,k.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:a?`in this queue`:`awaiting retry`})]}),(0,k.jsxs)(m,{children:[(0,k.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Failure Types`}),(0,k.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:c==null?`—`:x(c)}),(0,k.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`distinct reasons`})]})]})}function te({queues:e,queue:n,onSelect:r}){return e.length===0?null:(0,k.jsxs)(m,{className:`mb-6`,children:[(0,k.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,k.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`DLQ by queue`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(p,{size:`sm`,disabled:!0,title:T,children:[(0,k.jsx)(c,{className:`size-3.5`}),` Retry all (`,e.length,` queues)`]}),(0,k.jsxs)(p,{variant:`danger`,size:`sm`,disabled:!0,title:w,children:[`Purge all (`,e.length,` queues)`]})]})]}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-5`,children:e.map(e=>(0,k.jsxs)(`button`,{type:`button`,onClick:()=>r(e.name),className:t(`rounded-lg border p-3 text-left transition-colors`,n===e.name?`border-accent/50 bg-surface-2`:`border-line hover:border-line-strong`),children:[(0,k.jsx)(`div`,{className:`truncate font-mono text-xs text-muted`,children:e.name}),(0,k.jsx)(`div`,{className:`mt-1 text-xl font-bold tnum text-danger`,children:e.dlq})]},e.name))})]})}function A({queue:e,queues:t,reason:n,reasons:r,sort:i,search:a,pageScoped:o,onQueue:s,onReason:u,onSort:d,onSearch:m,onExport:h}){return(0,k.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,k.jsx)(`div`,{className:`w-48`,children:(0,k.jsxs)(S,{value:e,"aria-label":`Queue`,name:`dlq-queue`,autoComplete:`off`,onChange:e=>s(e.target.value),children:[(0,k.jsx)(`option`,{value:``,children:`Select a queue…`}),t.map(e=>(0,k.jsxs)(`option`,{value:e.name,children:[e.name,e.dlq?` (${e.dlq})`:``]},e.name))]})}),(0,k.jsx)(`div`,{className:`w-40`,children:(0,k.jsxs)(S,{value:n,onChange:e=>u(e.target.value),"aria-label":`Filter by reason`,name:`dlq-reason-filter`,autoComplete:`off`,children:[(0,k.jsx)(`option`,{value:`all`,children:`All Reasons`}),r.map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))]})}),(0,k.jsx)(`div`,{className:`w-36`,children:(0,k.jsxs)(S,{value:i,onChange:e=>d(e.target.value),"aria-label":o?`Sort this page`:`Sort`,name:`dlq-sort`,autoComplete:`off`,children:[(0,k.jsxs)(`option`,{value:`newest`,children:[`Newest First`,o?` (this page)`:``]}),(0,k.jsxs)(`option`,{value:`oldest`,children:[`Oldest First`,o?` (this page)`:``]})]})}),(0,k.jsx)(`input`,{value:a,onChange:e=>m(e.target.value),placeholder:`Filter this page by job ID…`,"aria-label":`Filter this page by job ID`,name:`dlq-job-filter`,autoComplete:`off`,className:`h-9 min-w-40 flex-1 rounded-lg border border-line bg-surface px-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,k.jsxs)(p,{size:`sm`,disabled:!0,title:T,children:[(0,k.jsx)(c,{className:`size-3.5`}),` Retry All`]}),(0,k.jsx)(p,{variant:`danger`,size:`sm`,disabled:!0,title:w,children:`Purge All`}),(0,k.jsx)(f,{"aria-label":`Export this page to CSV`,title:`Export this page to CSV`,disabled:!e,onClick:h,children:(0,k.jsx)(l,{className:`size-3.5`})})]})}function j({entries:e,expanded:n,onToggle:r}){return(0,k.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,k.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,k.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Error`}),(0,k.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Entered`}),(0,k.jsx)(`th`,{className:`w-16 px-5 py-3`})]})}),(0,k.jsx)(`tbody`,{children:e.map(e=>{let a=`${e.job.id}-${e.enteredAt}`;return(0,k.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,k.jsx)(`td`,{className:`px-5 py-3`,children:(0,k.jsx)(i,{to:`/job?id=${encodeURIComponent(e.job.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:e.job.id})}),(0,k.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.job.name??`default`}),(0,k.jsx)(`td`,{className:`px-5 py-3`,children:(0,k.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:e.reason})}),(0,k.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-danger/80`,children:e.error?(0,k.jsx)(`button`,{type:`button`,title:e.error,"aria-expanded":n.has(a),onClick:()=>r(a),className:t(`block w-full break-words text-left`,!n.has(a)&&`line-clamp-2`),children:e.error}):`—`}),(0,k.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:b(e.enteredAt)}),(0,k.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,k.jsx)(f,{"aria-label":`Retry unavailable`,disabled:!0,title:T,children:(0,k.jsx)(c,{className:`size-3.5`})})})]},a)})})]})})}var M=25;function N(){let[e,t]=n(),[r,i]=(0,O.useState)(``),[a,c]=(0,O.useState)(`all`),[l,f]=(0,O.useState)(`newest`),[p,m]=(0,O.useState)(``),[b,x]=(0,O.useState)(0),[S,w]=(0,O.useState)(new Set),{data:N,error:P,loading:F,refetch:I}=d(D,[],{intervalMs:1e4}),L=N?.queues??[],R=N?L.reduce((e,t)=>e+t.dlq,0):null,{data:z,error:B,loading:V,refetch:H}=d((0,O.useCallback)(async()=>{if(!r)return{queue:r,page:b,entries:[],entriesTotal:0,stats:null,statsError:null};let[e,t]=await Promise.all([o.dlq(r,M,b*M),o.dlqStats(r).then(e=>({stats:e.stats,error:null})).catch(e=>({stats:null,error:e.message||`Unknown error`}))]);return{queue:r,page:b,entries:e.entries??[],entriesTotal:e.total??0,stats:t.stats,statsError:t.error}},[r,b]),[r,b]),U=z?.queue===r&&z.page===b?z:null;(0,O.useEffect)(()=>{if(!U)return;let e=U.entriesTotal??0;b>0&&b*M>=e&&x(Math.max(0,Math.ceil(e/M)-1))},[U,b]);let W=()=>{let e=(U?.entries??[]).map(e=>({jobId:e.job.id,reason:e.reason,error:e.error??``,enteredAt:new Date(e.enteredAt).toISOString(),attempts:e.attempts?.length??0}));if(e.length===0){s.info(`Nothing to export on this page`);return}E(`dlq-${r}`,e,[`jobId`,`reason`,`error`,`enteredAt`,`attempts`])},G=e=>{X.current=!0,i(e),x(0),c(`all`),t(e?{queue:e}:{},{replace:!0})},K=U?.stats?.byReason??{},q=Object.keys(K).filter(e=>K[e]>0),J=[...q].sort((e,t)=>(K[t]??0)-(K[e]??0))[0],Y=(0,O.useMemo)(()=>L.filter(e=>e.dlq>0).sort((e,t)=>t.dlq-e.dlq),[L]),X=(0,O.useRef)(!1),Z=e.get(`queue`);(0,O.useEffect)(()=>{if(!(X.current||r)){if(Z){if(L.some(e=>e.name===Z)){X.current=!0,i(Z),x(0),c(`all`);return}if(L.length===0)return}Y.length!==0&&(X.current=!0,i(Y[0].name),x(0),c(`all`))}},[r,L,Y,Z]);let Q=(0,O.useMemo)(()=>{let e=U?.entries??[];a!==`all`&&(e=e.filter(e=>e.reason===a));let t=p.trim().toLowerCase();return t&&(e=e.filter(e=>e.job.id.toLowerCase().includes(t))),[...e].sort((e,t)=>l===`newest`?t.enteredAt-e.enteredAt:e.enteredAt-t.enteredAt)},[U,a,p,l]),ne=R===0&&!P,$=a!==`all`||p.trim()!==``,re=(U?.entriesTotal??0)>M;return(0,k.jsxs)(`div`,{children:[(0,k.jsx)(y,{title:`Dead Letter Queue`,description:`Jobs that failed after exhausting all retries. Inspect and export entries without mutating flow topology.`,live:!!r&&!!U&&!U.statsError&&!B&&!P}),B&&U&&(0,k.jsx)(h,{message:`DLQ refresh failed — showing the last successful page.`,onRetry:H}),P&&(0,k.jsx)(h,{onRetry:I,message:`Could not discover queue DLQ totals — ${P.message}. Health status is unavailable.`}),U?.statsError&&(0,k.jsx)(h,{message:`DLQ statistics are unavailable — ${U.statsError}. The entry list may still be current.`,onRetry:H}),(0,k.jsx)(ee,{total:R,discoveryError:!!P,healthy:ne,statsError:!!U?.statsError,queue:r,topReason:J,pendingRetry:U?.stats?.pendingRetry,reasonCount:U?.stats?q.length:void 0}),(0,k.jsx)(te,{queues:Y,queue:r,onSelect:G}),(0,k.jsx)(A,{queue:r,queues:L,reason:a,reasons:q,sort:l,search:p,pageScoped:re,onQueue:G,onReason:c,onSort:f,onSearch:m,onExport:W}),(0,k.jsx)(`p`,{className:`mb-4 text-xs text-warning`,children:T}),B&&!U?(0,k.jsx)(g,{error:B,onRetry:H}):F&&!N&&!r&&!P?(0,k.jsx)(_,{label:`Discovering queues…`}):V&&!U&&!B?(0,k.jsx)(_,{label:`Loading DLQ…`}):P&&!r?(0,k.jsx)(v,{icon:(0,k.jsx)(u,{}),title:`Could not discover queues`,hint:`${P.message}. Retry the queue discovery request above.`}):r?Q.length===0?(0,k.jsx)(v,{icon:(0,k.jsx)(u,{}),title:$?`No matches on this page`:`No dead letter entries`,hint:$?`No entries on this page match your filter — the filter is page-scoped. Use the pager below to check other pages.`:`This queue has no dead letter entries.`}):(0,k.jsx)(j,{entries:Q,expanded:S,onToggle:e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}):(0,k.jsx)(v,{icon:(0,k.jsx)(u,{}),title:`Select a queue`,hint:`Choose a queue from the dropdown to view its dead letter queue entries.`}),r&&U&&(0,k.jsx)(C,{page:b,pageSize:M,total:U.entriesTotal,onPageChange:x,label:`entries`})]})}export{N as DlqPro};