@lunora/studio 1.0.0-alpha.59 → 1.0.0-alpha.60

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 (381) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -43
  3. package/dist/mount.js +1 -27
  4. package/dist/packem_chunks/ApiTab.js +1 -251
  5. package/dist/packem_chunks/AuditPanel.js +1 -200
  6. package/dist/packem_chunks/DeploymentHealthPanel.js +1 -664
  7. package/dist/packem_chunks/ExportImportPanel.js +3 -198
  8. package/dist/packem_chunks/FileBrowser.js +4 -2955
  9. package/dist/packem_chunks/FunctionRunner.js +1 -326
  10. package/dist/packem_chunks/FunctionStatsPanel.js +1 -377
  11. package/dist/packem_chunks/HealthPanel.js +1 -648
  12. package/dist/packem_chunks/InsightsPanel.js +1 -462
  13. package/dist/packem_chunks/LogsPanel.js +1 -1303
  14. package/dist/packem_chunks/MailPanel.js +2 -353
  15. package/dist/packem_chunks/MetricsPanel.js +1 -1960
  16. package/dist/packem_chunks/MigrationsPanel.js +1 -239
  17. package/dist/packem_chunks/NotificationsPanel.js +1 -306
  18. package/dist/packem_chunks/PitrPanel.js +1 -252
  19. package/dist/packem_chunks/SchemaViewer.js +1 -2512
  20. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -95
  21. package/dist/packem_chunks/SettingsPanel.js +1 -391
  22. package/dist/packem_chunks/SqlEditorPanel.js +4 -2340
  23. package/dist/packem_chunks/TableEditor.js +1 -290
  24. package/dist/packem_chunks/agents-panel.js +1 -326
  25. package/dist/packem_chunks/analytics-panel.js +1 -261
  26. package/dist/packem_chunks/auth-audit-panel.js +1 -247
  27. package/dist/packem_chunks/auth-config-panel.js +1 -365
  28. package/dist/packem_chunks/auth-sessions-panel.js +1 -175
  29. package/dist/packem_chunks/containers-panel.js +1 -261
  30. package/dist/packem_chunks/dashboards-panel.js +1 -781
  31. package/dist/packem_chunks/fanout-panel.js +1 -482
  32. package/dist/packem_chunks/flags-panel.js +1 -176
  33. package/dist/packem_chunks/issues-panel.js +1 -427
  34. package/dist/packem_chunks/kv-browser.js +1 -1896
  35. package/dist/packem_chunks/log-drains-panel.js +4 -273
  36. package/dist/packem_chunks/organizations-panel.js +1 -3209
  37. package/dist/packem_chunks/payments-panel.js +1 -213
  38. package/dist/packem_chunks/permissions-panel.js +1 -805
  39. package/dist/packem_chunks/queues-panel.js +1 -1075
  40. package/dist/packem_chunks/rls-panel.js +1 -315
  41. package/dist/packem_chunks/schedule-panel.js +1 -831
  42. package/dist/packem_chunks/sparkline.js +1 -79
  43. package/dist/packem_chunks/storage-rules-panel.js +1 -140
  44. package/dist/packem_chunks/subscriptions-panel.js +1 -238
  45. package/dist/packem_chunks/sync-client-panel.js +1 -0
  46. package/dist/packem_chunks/traces-panel.js +1 -747
  47. package/dist/packem_chunks/users-panel.js +1 -1731
  48. package/dist/packem_chunks/vector-browser.js +1 -281
  49. package/dist/packem_chunks/workflows-panel.js +1 -562
  50. package/dist/packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js +1 -0
  51. package/dist/packem_shared/ApiDocsPanel-eJYZlylw.js +2 -0
  52. package/dist/packem_shared/ApiReferencePanel-C42v1jr6.js +1 -0
  53. package/dist/packem_shared/CommandPalette-CVIaY3j8.js +1 -0
  54. package/dist/packem_shared/ConfirmButton-CTL3f3kr.js +1 -0
  55. package/dist/packem_shared/ConnectionBadge-DOk0CQWo.js +1 -0
  56. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js +1 -0
  57. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js +1 -0
  58. package/dist/packem_shared/DEFAULT_LOCALE-BZ4NojpD.js +1 -0
  59. package/dist/packem_shared/DataBrowser-B8J5lHjP.js +1 -0
  60. package/dist/packem_shared/DataFilters-Csb30F0C.js +1 -0
  61. package/dist/packem_shared/ErrorBoundary-DvzYskH7.js +1 -0
  62. package/dist/packem_shared/GlobalDataBrowser-RLJ6NvOs.js +1 -0
  63. package/dist/packem_shared/HomePanel-DL1HupAN.js +1 -0
  64. package/dist/packem_shared/OpenRpcReferencePanel-sGsIgYWj.js +1 -0
  65. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js +1 -0
  66. package/dist/packem_shared/ScheduledJobs-DUbo6epc.js +1 -0
  67. package/dist/packem_shared/ShardInput-BVn2iCU0.js +1 -0
  68. package/dist/packem_shared/Studio-BWBclm_C.js +1 -0
  69. package/dist/packem_shared/StudioApp-BFm73yVr.js +1 -0
  70. package/dist/packem_shared/StudioI18nProvider-CZ5h4nrV.js +1 -0
  71. package/dist/packem_shared/advisor-view-DaCX9Jy5.js +1 -0
  72. package/dist/packem_shared/aggregateMetrics-BNfajLa2.js +1 -0
  73. package/dist/packem_shared/alert-CVcOFuDR.js +1 -0
  74. package/dist/packem_shared/badge-BbuuAio7.js +1 -0
  75. package/dist/packem_shared/bar-chart-AryFCeoa.js +9 -0
  76. package/dist/packem_shared/browser-storage-xjTyMKY0.js +1 -0
  77. package/dist/packem_shared/button-BkCrNcAs.js +1 -0
  78. package/dist/packem_shared/card-CIDGUN6K.js +1 -0
  79. package/dist/packem_shared/cf-links-gbDy51nR.js +1 -0
  80. package/dist/packem_shared/checkbox-StT4Gob6.js +1 -0
  81. package/dist/packem_shared/data-grid-BMBKzMEJ.js +1 -0
  82. package/dist/packem_shared/data-view-params-C8T3bW1z.js +1 -0
  83. package/dist/packem_shared/dropdown-menu-C3RQ_HlW.js +2 -0
  84. package/dist/packem_shared/empty-state-Cg7t_8qu.js +1 -0
  85. package/dist/packem_shared/error-alert-B59DnrDI.js +1 -0
  86. package/dist/packem_shared/grid-features-uZCUj955.js +6 -0
  87. package/dist/packem_shared/home-panel-B-8BCffw.js +3 -0
  88. package/dist/packem_shared/input-JHu63lTv.js +1 -0
  89. package/dist/packem_shared/internal-AtZ4bTal.js +2 -0
  90. package/dist/packem_shared/label-6uP1obNF.js +1 -0
  91. package/dist/packem_shared/live-status-CGW2JHf_.js +1 -0
  92. package/dist/packem_shared/log-fields-CoL3hsIQ.js +1 -0
  93. package/dist/packem_shared/modal-shell-CUwwWC2o.js +1 -0
  94. package/dist/packem_shared/reference-view-KvhektwF.js +12 -0
  95. package/dist/packem_shared/result-chart-CwKhhKM0.js +1 -0
  96. package/dist/packem_shared/scroll-area-DTEq6Jec.js +2 -0
  97. package/dist/packem_shared/select-Bul-DeII.js +2 -0
  98. package/dist/packem_shared/shard-history-DMEW5VBE.js +1 -0
  99. package/dist/packem_shared/skeleton-C1wQ9M5t.js +1 -0
  100. package/dist/packem_shared/sparkline-DtcZoU48.js +1 -0
  101. package/dist/packem_shared/storage-tier-DznqOf-q.js +1 -0
  102. package/dist/packem_shared/studio-BHA7hnI3.js +2 -0
  103. package/dist/packem_shared/table-DdJBrClo.js +2 -0
  104. package/dist/packem_shared/table-list-sidebar-CMCcNALK.js +1 -0
  105. package/dist/packem_shared/textarea-Bu2-jKAs.js +1 -0
  106. package/dist/packem_shared/trace-handoff-Dw7mwjxu.js +1 -0
  107. package/dist/packem_shared/use-admin-query-Di3fLE8H.js +1 -0
  108. package/dist/packem_shared/use-async-submit-H68GHPz8.js +1 -0
  109. package/dist/packem_shared/useDebounced-Ihdiid_k.js +1 -0
  110. package/dist/packem_shared/utils-bhneXptQ.js +1 -0
  111. package/dist/packem_shared/virtual-rect-1o1veP7R.js +1 -0
  112. package/dist/standalone/chunk-23HKRH5H.js +13 -0
  113. package/dist/standalone/chunk-2A4RKII2.js +1 -0
  114. package/dist/standalone/chunk-3DTM4GI5.js +1 -0
  115. package/dist/standalone/chunk-3MHKT76P.js +1 -0
  116. package/dist/standalone/chunk-46IB4C4Q.js +1 -0
  117. package/dist/standalone/chunk-4AYEV5UN.js +1 -0
  118. package/dist/standalone/chunk-4FNHHFWR.js +1 -0
  119. package/dist/standalone/chunk-6CLVIOCB.js +1 -0
  120. package/dist/standalone/chunk-6I62RSI5.js +1 -0
  121. package/dist/standalone/chunk-6OKDCV7J.js +1 -0
  122. package/dist/standalone/chunk-6P7HIPUE.js +1 -0
  123. package/dist/standalone/chunk-6UYILUSX.js +1 -0
  124. package/dist/standalone/chunk-725RLB7D.js +1 -0
  125. package/dist/standalone/chunk-7AZZ7OJO.js +1 -0
  126. package/dist/standalone/chunk-7CRLAMGB.js +1 -0
  127. package/dist/standalone/chunk-7Z5QEFR4.js +2 -0
  128. package/dist/standalone/chunk-AGVJJQFL.js +1 -0
  129. package/dist/standalone/chunk-AKTGRZXN.js +1 -0
  130. package/dist/standalone/chunk-BAIN7UJ4.js +1 -0
  131. package/dist/standalone/chunk-BHWSIIDT.js +1 -0
  132. package/dist/standalone/{chunk-L7SK4ZZD.js → chunk-C4O5UR4Y.js} +1 -1
  133. package/dist/standalone/chunk-C4VURT57.js +1 -0
  134. package/dist/standalone/chunk-CKO3F55C.js +4 -0
  135. package/dist/standalone/chunk-CVMRZUF5.js +4 -0
  136. package/dist/standalone/chunk-CWWGDW4V.js +1 -0
  137. package/dist/standalone/chunk-CYET4BRZ.js +1 -0
  138. package/dist/standalone/chunk-CZEUVNCQ.js +1 -0
  139. package/dist/standalone/chunk-FXFK4M4E.js +1 -0
  140. package/dist/standalone/chunk-FYAJPWE7.js +1 -0
  141. package/dist/standalone/chunk-GS7OBQO5.js +1 -0
  142. package/dist/standalone/chunk-GTXVH7I5.js +1 -0
  143. package/dist/standalone/chunk-H6SIM4BT.js +1 -0
  144. package/dist/standalone/chunk-H6WOFY6A.js +8 -0
  145. package/dist/standalone/chunk-HA34GYEX.js +1 -0
  146. package/dist/standalone/chunk-HMIOF5GV.js +1 -0
  147. package/dist/standalone/chunk-HY46NTNW.js +6 -0
  148. package/dist/standalone/chunk-IBCKC2BO.js +1 -0
  149. package/dist/standalone/chunk-ICKBVXPP.js +1 -0
  150. package/dist/standalone/chunk-IE4ROTQD.js +1 -0
  151. package/dist/standalone/chunk-IYYTWZ2E.js +2 -0
  152. package/dist/standalone/chunk-J2LMP2A7.js +1 -0
  153. package/dist/standalone/chunk-JC6WYIHM.js +1 -0
  154. package/dist/standalone/chunk-JKPK25JO.js +1 -0
  155. package/dist/standalone/chunk-JLFCXBNQ.js +1 -0
  156. package/dist/standalone/chunk-JRWBGR5B.js +1 -0
  157. package/dist/standalone/chunk-K5PFWU5J.js +1 -0
  158. package/dist/standalone/chunk-KJTLW5W2.js +11 -0
  159. package/dist/standalone/{chunk-HBGS4SEX.js → chunk-KLLYGWNF.js} +9 -9
  160. package/dist/standalone/chunk-KNN3ZEQ7.js +1 -0
  161. package/dist/standalone/{chunk-4QHKBC77.js → chunk-KOC5KV3E.js} +1 -1
  162. package/dist/standalone/chunk-KSRXMTBV.js +1 -0
  163. package/dist/standalone/chunk-KYCAYNXM.js +1 -0
  164. package/dist/standalone/chunk-KZ2YUNMR.js +1 -0
  165. package/dist/standalone/chunk-LKHUVEHX.js +1 -0
  166. package/dist/standalone/chunk-LPOKAJT4.js +4 -0
  167. package/dist/standalone/chunk-MZEK4SGD.js +1 -0
  168. package/dist/standalone/chunk-NCCUM26H.js +1 -0
  169. package/dist/standalone/chunk-O62HJZV3.js +1 -0
  170. package/dist/standalone/chunk-OTJOI23O.js +62 -0
  171. package/dist/standalone/chunk-P2NBOUGZ.js +1 -0
  172. package/dist/standalone/chunk-P4J6XNG3.js +1 -0
  173. package/dist/standalone/chunk-PGDWFWH5.js +1 -0
  174. package/dist/standalone/chunk-PR2SE2MD.js +1 -0
  175. package/dist/standalone/chunk-PTTDIYGP.js +1 -0
  176. package/dist/standalone/chunk-PWDMXMRD.js +1 -0
  177. package/dist/standalone/chunk-Q34MSC2F.js +1 -0
  178. package/dist/standalone/chunk-Q5WXTZWX.js +1 -0
  179. package/dist/standalone/chunk-QC5HCNJZ.js +4 -0
  180. package/dist/standalone/chunk-QJKRHZYV.js +1 -0
  181. package/dist/standalone/chunk-R43KHQDA.js +1 -0
  182. package/dist/standalone/chunk-RC2K5RBE.js +1 -0
  183. package/dist/standalone/chunk-RE6UWCMG.js +1 -0
  184. package/dist/standalone/chunk-RUP3M2GF.js +3 -0
  185. package/dist/standalone/chunk-SA6MBPBL.js +1 -0
  186. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-SEDZDNQF.js} +1 -1
  187. package/dist/standalone/chunk-SKHEGARW.js +1 -0
  188. package/dist/standalone/chunk-SKJZDOHG.js +1 -0
  189. package/dist/standalone/chunk-SNDYNCAA.js +1 -0
  190. package/dist/standalone/chunk-SZUHZ2OG.js +1 -0
  191. package/dist/standalone/chunk-TAE2H7PU.js +1 -0
  192. package/dist/standalone/chunk-TEIBKU46.js +1 -0
  193. package/dist/standalone/chunk-TO6NLVFD.js +1 -0
  194. package/dist/standalone/chunk-TYTJDFX2.js +1 -0
  195. package/dist/standalone/{chunk-LXULVPEM.js → chunk-UDZY7MKE.js} +3 -3
  196. package/dist/standalone/chunk-UHHTEBC3.js +1 -0
  197. package/dist/standalone/chunk-UNDFOYRI.js +1 -0
  198. package/dist/standalone/chunk-UNN4CESU.js +1 -0
  199. package/dist/standalone/chunk-UNXX5GQH.js +1 -0
  200. package/dist/standalone/{chunk-ZHVTQ37P.js → chunk-UREY4GLG.js} +1 -1
  201. package/dist/standalone/chunk-UWF5DOGV.js +1 -0
  202. package/dist/standalone/chunk-UY2Y5CXB.js +1 -0
  203. package/dist/standalone/{chunk-VLXV72QE.js → chunk-UZYGEOWY.js} +1 -1
  204. package/dist/standalone/chunk-V66TSUKV.js +1 -0
  205. package/dist/standalone/chunk-VEFNSN7P.js +1 -0
  206. package/dist/standalone/chunk-VUJGR4PB.js +1 -0
  207. package/dist/standalone/chunk-VUXJER3D.js +1 -0
  208. package/dist/standalone/chunk-W572365D.js +1 -0
  209. package/dist/standalone/chunk-WYFLGXZ3.js +3 -0
  210. package/dist/standalone/chunk-XDKFPBIL.js +1 -0
  211. package/dist/standalone/chunk-XRKCGQM2.js +1 -0
  212. package/dist/standalone/chunk-YNBJ6ICE.js +1 -0
  213. package/dist/standalone/chunk-YQ5PILIJ.js +1 -0
  214. package/dist/standalone/chunk-YT7VXQVX.js +1 -0
  215. package/dist/standalone/chunk-Z7MUQMLE.js +1 -0
  216. package/dist/standalone/chunk-ZFWEPGWG.js +1 -0
  217. package/dist/standalone/chunk-ZMFZRGAN.js +1 -0
  218. package/dist/standalone/studio.js +9 -214
  219. package/package.json +4 -4
  220. package/dist/packem_shared/ADMIN_FUNCTIONS-P2UzJscH.js +0 -62
  221. package/dist/packem_shared/ApiDocsPanel-DNDpeR5O.js +0 -842
  222. package/dist/packem_shared/ApiReferencePanel-ChlRsAXU.js +0 -230
  223. package/dist/packem_shared/CommandPalette-BpkopP5f.js +0 -373
  224. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  225. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  226. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  227. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  228. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  229. package/dist/packem_shared/DataBrowser-obTn4sKX.js +0 -4493
  230. package/dist/packem_shared/DataFilters-B1Q7mrt7.js +0 -253
  231. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  232. package/dist/packem_shared/GlobalDataBrowser-BCaohHZ5.js +0 -293
  233. package/dist/packem_shared/HomePanel-DCRj3hGB.js +0 -14
  234. package/dist/packem_shared/OpenRpcReferencePanel-CIeQE1aE.js +0 -192
  235. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  236. package/dist/packem_shared/ScheduledJobs-BQzQo84k.js +0 -262
  237. package/dist/packem_shared/ShardInput-CZnpHILL.js +0 -107
  238. package/dist/packem_shared/Studio-DnlPCbID.js +0 -16
  239. package/dist/packem_shared/StudioApp-CzqlB4zO.js +0 -708
  240. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  241. package/dist/packem_shared/advisor-view-D95sN-wO.js +0 -159
  242. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  243. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  244. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  245. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  246. package/dist/packem_shared/browser-storage-L4gOP5gJ.js +0 -105
  247. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  248. package/dist/packem_shared/card-F2vH_aj2.js +0 -175
  249. package/dist/packem_shared/cf-links-SIbyi4Y1.js +0 -8
  250. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  251. package/dist/packem_shared/data-grid-BywzWfek.js +0 -183
  252. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  253. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  254. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  255. package/dist/packem_shared/error-alert-D9uIFJUS.js +0 -114
  256. package/dist/packem_shared/grid-features-ZOLhHKrR.js +0 -809
  257. package/dist/packem_shared/home-panel-BRAA2UlM.js +0 -1889
  258. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  259. package/dist/packem_shared/internal-DzHCc2Rq.js +0 -131
  260. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  261. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  262. package/dist/packem_shared/log-fields-jEH83H2G.js +0 -18
  263. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  264. package/dist/packem_shared/reference-view-DfXN7oWP.js +0 -2127
  265. package/dist/packem_shared/result-chart-Bf9mbCIo.js +0 -119
  266. package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
  267. package/dist/packem_shared/select-D9OwHEch.js +0 -273
  268. package/dist/packem_shared/shard-history-AxiJ1WPP.js +0 -16
  269. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  270. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  271. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  272. package/dist/packem_shared/studio-8QSXbZ98.js +0 -4192
  273. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  274. package/dist/packem_shared/table-list-sidebar-gCE17v9B.js +0 -842
  275. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  276. package/dist/packem_shared/trace-handoff-CGolF3KS.js +0 -38
  277. package/dist/packem_shared/use-admin-query-C7JNuQp-.js +0 -106
  278. package/dist/packem_shared/use-async-submit-rnSk_jXl.js +0 -91
  279. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  280. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  281. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  282. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  283. package/dist/standalone/chunk-2MLA6WFH.js +0 -1
  284. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  285. package/dist/standalone/chunk-2TJVFKD2.js +0 -1
  286. package/dist/standalone/chunk-2YTF6LJ6.js +0 -1
  287. package/dist/standalone/chunk-3GXGLNKW.js +0 -1
  288. package/dist/standalone/chunk-3HGNPZBN.js +0 -1
  289. package/dist/standalone/chunk-3LJEGSMK.js +0 -11
  290. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  291. package/dist/standalone/chunk-4PC7IXNY.js +0 -1
  292. package/dist/standalone/chunk-56XQYNUJ.js +0 -1
  293. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  294. package/dist/standalone/chunk-5QT5JRXD.js +0 -3
  295. package/dist/standalone/chunk-6RLPR7PL.js +0 -1
  296. package/dist/standalone/chunk-6V74EUPK.js +0 -1
  297. package/dist/standalone/chunk-7EE33WLB.js +0 -1
  298. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  299. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  300. package/dist/standalone/chunk-AN4RKMKW.js +0 -1
  301. package/dist/standalone/chunk-APSSZB6Z.js +0 -1
  302. package/dist/standalone/chunk-AXNGWSBM.js +0 -1
  303. package/dist/standalone/chunk-AXZILWRM.js +0 -1
  304. package/dist/standalone/chunk-C7RHEBOH.js +0 -1
  305. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  306. package/dist/standalone/chunk-CSWIYOB3.js +0 -1
  307. package/dist/standalone/chunk-D3VAON25.js +0 -1
  308. package/dist/standalone/chunk-DDLQN67F.js +0 -1
  309. package/dist/standalone/chunk-DGHW5JG5.js +0 -1
  310. package/dist/standalone/chunk-DMCSOTAE.js +0 -3
  311. package/dist/standalone/chunk-E3BKETAS.js +0 -1
  312. package/dist/standalone/chunk-E3OXNN6O.js +0 -1
  313. package/dist/standalone/chunk-E6BOGDIS.js +0 -1
  314. package/dist/standalone/chunk-F2YMCQ6B.js +0 -1
  315. package/dist/standalone/chunk-F7GE4X2U.js +0 -1
  316. package/dist/standalone/chunk-FAVUOGJR.js +0 -1
  317. package/dist/standalone/chunk-FXP6256Q.js +0 -1
  318. package/dist/standalone/chunk-G6CTAYHJ.js +0 -1
  319. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  320. package/dist/standalone/chunk-H42W62SE.js +0 -1
  321. package/dist/standalone/chunk-HTF5ZX4I.js +0 -8
  322. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  323. package/dist/standalone/chunk-I2PS4L74.js +0 -1
  324. package/dist/standalone/chunk-IYHPYY4A.js +0 -1
  325. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  326. package/dist/standalone/chunk-J7OGP4NN.js +0 -1
  327. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  328. package/dist/standalone/chunk-JZLGLG4T.js +0 -1
  329. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  330. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  331. package/dist/standalone/chunk-L2LN3MK4.js +0 -4
  332. package/dist/standalone/chunk-LT3FH6MW.js +0 -1
  333. package/dist/standalone/chunk-LZUWZBPE.js +0 -1
  334. package/dist/standalone/chunk-M4JM3TOY.js +0 -1
  335. package/dist/standalone/chunk-MLA5ZAEB.js +0 -1
  336. package/dist/standalone/chunk-MRBI5HNQ.js +0 -1
  337. package/dist/standalone/chunk-N5XX4HOL.js +0 -6
  338. package/dist/standalone/chunk-N7SVJOHN.js +0 -1
  339. package/dist/standalone/chunk-NKFXMDOD.js +0 -1
  340. package/dist/standalone/chunk-NPSNKFHE.js +0 -1
  341. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  342. package/dist/standalone/chunk-O7FVPUCO.js +0 -1
  343. package/dist/standalone/chunk-OKQXTLFX.js +0 -1
  344. package/dist/standalone/chunk-OXHHSUXO.js +0 -1
  345. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  346. package/dist/standalone/chunk-QAIM6KWT.js +0 -1
  347. package/dist/standalone/chunk-QCPMTB6W.js +0 -1
  348. package/dist/standalone/chunk-QQ2LOSZL.js +0 -1
  349. package/dist/standalone/chunk-QVIPA6UJ.js +0 -1
  350. package/dist/standalone/chunk-QVUQXJCT.js +0 -4
  351. package/dist/standalone/chunk-R2GMHLJY.js +0 -1
  352. package/dist/standalone/chunk-RD5UG2YL.js +0 -1
  353. package/dist/standalone/chunk-RJTIP3WF.js +0 -1
  354. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  355. package/dist/standalone/chunk-SHERR7ZP.js +0 -1
  356. package/dist/standalone/chunk-SOC5CY3F.js +0 -1
  357. package/dist/standalone/chunk-SS7JLF2I.js +0 -4
  358. package/dist/standalone/chunk-SWWYUGPL.js +0 -2
  359. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  360. package/dist/standalone/chunk-TTXRHJUP.js +0 -4
  361. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  362. package/dist/standalone/chunk-UKDHGVOC.js +0 -1
  363. package/dist/standalone/chunk-UPNTMJFF.js +0 -1
  364. package/dist/standalone/chunk-V43BLH4J.js +0 -1
  365. package/dist/standalone/chunk-VL23Y44O.js +0 -4
  366. package/dist/standalone/chunk-VXM5H542.js +0 -4
  367. package/dist/standalone/chunk-WMDH2CIZ.js +0 -1
  368. package/dist/standalone/chunk-WVTPZ6CM.js +0 -1
  369. package/dist/standalone/chunk-XN6QYJQ6.js +0 -13
  370. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  371. package/dist/standalone/chunk-Y4U6CC22.js +0 -1
  372. package/dist/standalone/chunk-Y572GMZE.js +0 -1
  373. package/dist/standalone/chunk-Y7PD5KP4.js +0 -76
  374. package/dist/standalone/chunk-YFIPHCEC.js +0 -1
  375. package/dist/standalone/chunk-YJXOWLFJ.js +0 -1
  376. package/dist/standalone/chunk-YNN6NFRZ.js +0 -1
  377. package/dist/standalone/chunk-YUGHRVPD.js +0 -1
  378. package/dist/standalone/chunk-ZIGWVHCS.js +0 -1
  379. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  380. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
  381. /package/dist/standalone/{chunk-TEWVD66F.js → chunk-GXZAXNZI.js} +0 -0
@@ -1,1303 +1 @@
1
- import { c } from 'react/compiler-runtime';
2
- import { useVirtualizer } from '@tanstack/react-virtual';
3
- import { useState, useReducer, useRef, useEffect, useMemo } from 'react';
4
- import { f as formatLogFields } from '../packem_shared/log-fields-jEH83H2G.js';
5
- import { E as ErrorAlert } from '../packem_shared/error-alert-D9uIFJUS.js';
6
- import { L as LiveError } from '../packem_shared/live-status-FZ0psC1z.js';
7
- import { ShardInput } from '../packem_shared/ShardInput-CZnpHILL.js';
8
- import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
9
- import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
10
- import { I as Input } from '../packem_shared/input-XH4r1Pt1.js';
11
- import { u as useAdminQuery } from '../packem_shared/use-admin-query-C7JNuQp-.js';
12
- import useDebounced from '../packem_shared/useDebounced-Dxncpg6z.js';
13
- import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
14
- import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-P2UzJscH.js';
15
- import { b as CLOUDFLARE_OBSERVABILITY_URL } from '../packem_shared/cf-links-SIbyi4Y1.js';
16
- import { r as recordShard } from '../packem_shared/shard-history-AxiJ1WPP.js';
17
- import { c as cn } from '../packem_shared/utils-B05Dmz_H.js';
18
- import { f as flooredRectObserver } from '../packem_shared/virtual-rect-CVMUskSm.js';
19
- import { useLunora } from '@lunora/react';
20
- import { B as Button } from '../packem_shared/button-BhsN2uZH.js';
21
- import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from '../packem_shared/table-DsCa9Qp9.js';
22
- import { f as fireAndForget, l as errorCode, e as errorMessage } from '../packem_shared/internal-DzHCc2Rq.js';
23
- import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
24
-
25
- const LOG_LEVEL_ORDER = ["trace", "debug", "log", "info", "warn", "error", "fatal"];
26
-
27
- const LOG_ARCHIVE_NOT_CONFIGURED = "LOG_ARCHIVE_NOT_CONFIGURED";
28
-
29
- const LEVEL_VARIANT = {
30
- debug: "secondary",
31
- error: "destructive",
32
- fatal: "destructive",
33
- info: "outline",
34
- log: "outline",
35
- trace: "outline",
36
- warn: "secondary"
37
- };
38
-
39
- const INITIAL_STATE = {
40
- cursor: void 0,
41
- error: null,
42
- loading: false,
43
- notConfigured: false,
44
- rows: null
45
- };
46
- const archiveReducer = (state, action) => {
47
- switch (action.type) {
48
- case "append": {
49
- return {
50
- ...state,
51
- cursor: action.cursor,
52
- error: null,
53
- loading: false,
54
- rows: [...state.rows ?? [], ...action.rows]
55
- };
56
- }
57
- case "failed": {
58
- return {
59
- cursor: void 0,
60
- error: action.message,
61
- loading: false,
62
- notConfigured: false,
63
- rows: null
64
- };
65
- }
66
- case "loaded": {
67
- return {
68
- cursor: action.cursor,
69
- error: null,
70
- loading: false,
71
- notConfigured: false,
72
- rows: action.rows
73
- };
74
- }
75
- case "loading": {
76
- return {
77
- ...state,
78
- error: null,
79
- loading: true,
80
- notConfigured: false
81
- };
82
- }
83
- case "notConfigured": {
84
- return {
85
- cursor: void 0,
86
- error: null,
87
- loading: false,
88
- notConfigured: true,
89
- rows: null
90
- };
91
- }
92
- case "pageFailed": {
93
- return {
94
- ...state,
95
- error: action.message,
96
- loading: false
97
- };
98
- }
99
- default: {
100
- return state;
101
- }
102
- }
103
- };
104
- const ArchiveRow = (t0) => {
105
- const $ = c(33);
106
- const {
107
- row
108
- } = t0;
109
- let t1;
110
- if ($[0] !== row.fields) {
111
- t1 = formatLogFields(row.fields);
112
- $[0] = row.fields;
113
- $[1] = t1;
114
- } else {
115
- t1 = $[1];
116
- }
117
- const fields = t1;
118
- const t2 = `lg-archive-row-${String(row.ts)}`;
119
- let t3;
120
- if ($[2] !== row.ts) {
121
- t3 = new Date(row.ts).toLocaleString();
122
- $[2] = row.ts;
123
- $[3] = t3;
124
- } else {
125
- t3 = $[3];
126
- }
127
- let t4;
128
- if ($[4] !== t3) {
129
- t4 = /* @__PURE__ */ jsxDEV(TableCell, {
130
- className: "tabular-nums whitespace-nowrap text-xs text-muted-foreground",
131
- children: t3
132
- }, void 0, false);
133
- $[4] = t3;
134
- $[5] = t4;
135
- } else {
136
- t4 = $[5];
137
- }
138
- const t5 = LEVEL_VARIANT[row.level];
139
- let t6;
140
- if ($[6] !== row.level || $[7] !== t5) {
141
- t6 = /* @__PURE__ */ jsxDEV(TableCell, {
142
- children: /* @__PURE__ */ jsxDEV(Badge, {
143
- variant: t5,
144
- children: row.level
145
- }, void 0, false)
146
- }, void 0, false);
147
- $[6] = row.level;
148
- $[7] = t5;
149
- $[8] = t6;
150
- } else {
151
- t6 = $[8];
152
- }
153
- let t7;
154
- if ($[9] !== row.functionPath) {
155
- t7 = /* @__PURE__ */ jsxDEV(TableCell, {
156
- className: "font-mono text-xs",
157
- children: row.functionPath
158
- }, void 0, false);
159
- $[9] = row.functionPath;
160
- $[10] = t7;
161
- } else {
162
- t7 = $[10];
163
- }
164
- let t8;
165
- if ($[11] !== row.message) {
166
- t8 = /* @__PURE__ */ jsxDEV("div", {
167
- className: "truncate",
168
- title: row.message,
169
- children: row.message
170
- }, void 0, false);
171
- $[11] = row.message;
172
- $[12] = t8;
173
- } else {
174
- t8 = $[12];
175
- }
176
- let t9;
177
- if ($[13] !== fields) {
178
- t9 = fields !== "" && /* @__PURE__ */ jsxDEV("div", {
179
- className: "truncate font-mono text-[11px] text-muted-foreground",
180
- title: fields,
181
- children: fields
182
- }, void 0, false);
183
- $[13] = fields;
184
- $[14] = t9;
185
- } else {
186
- t9 = $[14];
187
- }
188
- let t10;
189
- if ($[15] !== t8 || $[16] !== t9) {
190
- t10 = /* @__PURE__ */ jsxDEV(TableCell, {
191
- className: "max-w-md",
192
- children: [t8, t9]
193
- }, void 0, true);
194
- $[15] = t8;
195
- $[16] = t9;
196
- $[17] = t10;
197
- } else {
198
- t10 = $[17];
199
- }
200
- const t11 = row.traceId ?? "—";
201
- let t12;
202
- if ($[18] !== t11) {
203
- t12 = /* @__PURE__ */ jsxDEV(TableCell, {
204
- className: "font-mono text-[11px] text-muted-foreground",
205
- children: t11
206
- }, void 0, false);
207
- $[18] = t11;
208
- $[19] = t12;
209
- } else {
210
- t12 = $[19];
211
- }
212
- const t13 = row.shardKey ?? "—";
213
- let t14;
214
- if ($[20] !== t13) {
215
- t14 = /* @__PURE__ */ jsxDEV(TableCell, {
216
- className: "font-mono text-[11px] text-muted-foreground",
217
- children: t13
218
- }, void 0, false);
219
- $[20] = t13;
220
- $[21] = t14;
221
- } else {
222
- t14 = $[21];
223
- }
224
- const t15 = row.userId ?? "—";
225
- let t16;
226
- if ($[22] !== t15) {
227
- t16 = /* @__PURE__ */ jsxDEV(TableCell, {
228
- className: "font-mono text-[11px] text-muted-foreground",
229
- children: t15
230
- }, void 0, false);
231
- $[22] = t15;
232
- $[23] = t16;
233
- } else {
234
- t16 = $[23];
235
- }
236
- let t17;
237
- if ($[24] !== t10 || $[25] !== t12 || $[26] !== t14 || $[27] !== t16 || $[28] !== t2 || $[29] !== t4 || $[30] !== t6 || $[31] !== t7) {
238
- t17 = /* @__PURE__ */ jsxDEV(TableRow, {
239
- "data-testid": t2,
240
- children: [t4, t6, t7, t10, t12, t14, t16]
241
- }, void 0, true);
242
- $[24] = t10;
243
- $[25] = t12;
244
- $[26] = t14;
245
- $[27] = t16;
246
- $[28] = t2;
247
- $[29] = t4;
248
- $[30] = t6;
249
- $[31] = t7;
250
- $[32] = t17;
251
- } else {
252
- t17 = $[32];
253
- }
254
- return t17;
255
- };
256
- const ArchiveFeed = ({
257
- shardKey
258
- }) => {
259
- const client = useLunora();
260
- const t = useT();
261
- const [pathPrefix, setPathPrefix] = useState("");
262
- const [userIdFilter, setUserIdFilter] = useState("");
263
- const [minLevel, setMinLevel] = useState("");
264
- const [{
265
- cursor,
266
- error,
267
- loading,
268
- notConfigured,
269
- rows
270
- }, dispatch] = useReducer(archiveReducer, INITIAL_STATE);
271
- const debouncedPathPrefix = useDebounced(pathPrefix.trim(), 400);
272
- const debouncedUserId = useDebounced(userIdFilter.trim(), 400);
273
- const baseQuery = {
274
- ...debouncedPathPrefix === "" ? {} : {
275
- functionPathPrefix: debouncedPathPrefix
276
- },
277
- ...minLevel === "" ? {} : {
278
- minLevel
279
- },
280
- ...shardKey === "" ? {} : {
281
- shardKey
282
- },
283
- ...debouncedUserId === "" ? {} : {
284
- userId: debouncedUserId
285
- }
286
- };
287
- const querySignature = JSON.stringify(baseQuery);
288
- const activeSignatureRef = useRef(querySignature);
289
- useEffect(() => {
290
- const token = {
291
- cancelled: false
292
- };
293
- activeSignatureRef.current = querySignature;
294
- fireAndForget((async () => {
295
- dispatch({
296
- type: "loading"
297
- });
298
- try {
299
- const page = await client.queryLogArchive(baseQuery);
300
- if (!token.cancelled) {
301
- dispatch({
302
- cursor: page.nextCursor,
303
- rows: page.rows,
304
- type: "loaded"
305
- });
306
- }
307
- } catch (error_) {
308
- if (!token.cancelled) {
309
- dispatch(errorCode(error_) === LOG_ARCHIVE_NOT_CONFIGURED ? {
310
- type: "notConfigured"
311
- } : {
312
- message: errorMessage(error_),
313
- type: "failed"
314
- });
315
- }
316
- }
317
- })());
318
- return () => {
319
- token.cancelled = true;
320
- };
321
- }, [client, querySignature]);
322
- const loadMore = async () => {
323
- if (cursor === void 0) {
324
- return;
325
- }
326
- const signature = querySignature;
327
- dispatch({
328
- type: "loading"
329
- });
330
- try {
331
- const page = await client.queryLogArchive({
332
- ...baseQuery,
333
- cursor
334
- });
335
- if (activeSignatureRef.current === signature) {
336
- dispatch({
337
- cursor: page.nextCursor,
338
- rows: page.rows,
339
- type: "append"
340
- });
341
- }
342
- } catch (error_) {
343
- if (activeSignatureRef.current === signature) {
344
- dispatch({
345
- message: errorMessage(error_),
346
- type: "pageFailed"
347
- });
348
- }
349
- }
350
- };
351
- const onPathPrefixChange = (event) => {
352
- setPathPrefix(event.target.value);
353
- };
354
- const onUserIdChange = (event) => {
355
- setUserIdFilter(event.target.value);
356
- };
357
- const onMinLevelChange = (event) => {
358
- setMinLevel(event.target.value);
359
- };
360
- const onLoadMore = () => {
361
- fireAndForget(loadMore());
362
- };
363
- if (notConfigured) {
364
- return /* @__PURE__ */ jsxDEV(EmptyState, {
365
- action: /* @__PURE__ */ jsxDEV("a", {
366
- className: "text-sm text-primary underline-offset-4 hover:underline",
367
- href: CLOUDFLARE_OBSERVABILITY_URL,
368
- rel: "noreferrer",
369
- target: "_blank",
370
- children: t("Open in Cloudflare")
371
- }, void 0, false),
372
- description: t("Wire pipelineLogSink to a Cloudflare Pipeline → R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),
373
- testId: "lg-archive-not-configured",
374
- title: t("Log archive not configured")
375
- }, void 0, false);
376
- }
377
- return /* @__PURE__ */ jsxDEV("div", {
378
- className: "flex flex-col gap-4",
379
- "data-testid": "lg-archive",
380
- children: [/* @__PURE__ */ jsxDEV("div", {
381
- className: "flex flex-wrap items-center gap-2",
382
- children: [/* @__PURE__ */ jsxDEV(Input, {
383
- "aria-label": t("Function path prefix"),
384
- className: "h-8 w-48",
385
- "data-testid": "lg-archive-path",
386
- onChange: onPathPrefixChange,
387
- placeholder: t("function path…"),
388
- value: pathPrefix
389
- }, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
390
- "aria-label": t("User id"),
391
- className: "h-8 w-40",
392
- "data-testid": "lg-archive-user",
393
- onChange: onUserIdChange,
394
- placeholder: t("user id…"),
395
- value: userIdFilter
396
- }, void 0, false), /* @__PURE__ */ jsxDEV("select", {
397
- "aria-label": t("Minimum level"),
398
- className: "h-8 rounded-md border border-border bg-background px-2 text-sm",
399
- "data-testid": "lg-archive-min-level",
400
- onChange: onMinLevelChange,
401
- value: minLevel,
402
- children: [/* @__PURE__ */ jsxDEV("option", {
403
- value: "",
404
- children: t("min level")
405
- }, void 0, false), LOG_LEVEL_ORDER.map((level) => /* @__PURE__ */ jsxDEV("option", {
406
- value: level,
407
- children: level
408
- }, level, false))]
409
- }, void 0, true)]
410
- }, void 0, true), error !== null && /* @__PURE__ */ jsxDEV("p", {
411
- className: "text-sm text-destructive",
412
- "data-testid": "lg-archive-error",
413
- role: "alert",
414
- children: error
415
- }, void 0, false), loading && rows === null && error === null && /* @__PURE__ */ jsxDEV("p", {
416
- className: "text-sm text-muted-foreground",
417
- "data-testid": "lg-archive-loading",
418
- children: t("Loading…")
419
- }, void 0, false), rows !== null && rows.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
420
- description: t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),
421
- testId: "lg-archive-empty",
422
- title: t("No archived logs.")
423
- }, void 0, false), rows !== null && rows.length > 0 && /* @__PURE__ */ jsxDEV("div", {
424
- className: "overflow-hidden rounded-xl border border-border shadow-xs",
425
- children: /* @__PURE__ */ jsxDEV(Table, {
426
- "data-testid": "lg-archive-table",
427
- children: [/* @__PURE__ */ jsxDEV(TableHeader, {
428
- children: /* @__PURE__ */ jsxDEV(TableRow, {
429
- children: [/* @__PURE__ */ jsxDEV(TableHead, {
430
- children: t("Time")
431
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
432
- children: t("Level")
433
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
434
- children: t("Function")
435
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
436
- children: t("Message")
437
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
438
- children: t("Trace")
439
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
440
- children: t("Shard")
441
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
442
- children: t("User")
443
- }, void 0, false)]
444
- }, void 0, true)
445
- }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
446
- children: rows.map((row, index) => /* @__PURE__ */ jsxDEV(ArchiveRow, {
447
- row
448
- }, `${String(row.ts)}-${String(index)}`, false))
449
- }, void 0, false)]
450
- }, void 0, true)
451
- }, void 0, false), cursor !== void 0 && /* @__PURE__ */ jsxDEV("div", {
452
- children: /* @__PURE__ */ jsxDEV(Button, {
453
- "data-testid": "lg-archive-more",
454
- disabled: loading,
455
- onClick: onLoadMore,
456
- size: "sm",
457
- variant: "outline",
458
- children: loading ? t("Loading…") : t("Load more")
459
- }, void 0, false)
460
- }, void 0, false)]
461
- }, void 0, true);
462
- };
463
-
464
- const SCROLL_HEIGHT = 400;
465
- const ROW_HEIGHT = 36;
466
- const SCROLL_STYLE = {
467
- height: SCROLL_HEIGHT,
468
- overflow: "auto"
469
- };
470
- const ROW_BASE_STYLE = {
471
- left: 0,
472
- position: "absolute",
473
- top: 0,
474
- width: "100%"
475
- };
476
- const OUTCOME_VARIANT = {
477
- error: "destructive",
478
- ok: "secondary"
479
- };
480
- const LogRow = (t0) => {
481
- const $ = c(26);
482
- const {
483
- entry,
484
- index,
485
- measureRef,
486
- start
487
- } = t0;
488
- const t1 = `translateY(${String(start)}px)`;
489
- let t2;
490
- if ($[0] !== t1) {
491
- t2 = {
492
- ...ROW_BASE_STYLE,
493
- transform: t1
494
- };
495
- $[0] = t1;
496
- $[1] = t2;
497
- } else {
498
- t2 = $[1];
499
- }
500
- const style = t2;
501
- let t3;
502
- if ($[2] !== entry.fields) {
503
- t3 = formatLogFields(entry.fields);
504
- $[2] = entry.fields;
505
- $[3] = t3;
506
- } else {
507
- t3 = $[3];
508
- }
509
- const fields = t3;
510
- let t4;
511
- if ($[4] !== entry.timestamp) {
512
- t4 = new Date(entry.timestamp).toLocaleString();
513
- $[4] = entry.timestamp;
514
- $[5] = t4;
515
- } else {
516
- t4 = $[5];
517
- }
518
- let t5;
519
- if ($[6] !== t4) {
520
- t5 = /* @__PURE__ */ jsxDEV("span", {
521
- className: "w-44 shrink-0 tabular-nums text-muted-foreground",
522
- role: "gridcell",
523
- children: t4
524
- }, void 0, false);
525
- $[6] = t4;
526
- $[7] = t5;
527
- } else {
528
- t5 = $[7];
529
- }
530
- const t6 = LEVEL_VARIANT[entry.level];
531
- let t7;
532
- if ($[8] !== entry.level || $[9] !== t6) {
533
- t7 = /* @__PURE__ */ jsxDEV("span", {
534
- className: "w-20 shrink-0",
535
- role: "gridcell",
536
- children: /* @__PURE__ */ jsxDEV(Badge, {
537
- variant: t6,
538
- children: entry.level
539
- }, void 0, false)
540
- }, void 0, false);
541
- $[8] = entry.level;
542
- $[9] = t6;
543
- $[10] = t7;
544
- } else {
545
- t7 = $[10];
546
- }
547
- const t8 = entry.functionPath ?? "—";
548
- let t9;
549
- if ($[11] !== t8) {
550
- t9 = /* @__PURE__ */ jsxDEV("span", {
551
- className: "w-48 shrink-0 truncate text-muted-foreground",
552
- role: "gridcell",
553
- children: t8
554
- }, void 0, false);
555
- $[11] = t8;
556
- $[12] = t9;
557
- } else {
558
- t9 = $[12];
559
- }
560
- let t10;
561
- if ($[13] !== fields) {
562
- t10 = fields === "" ? null : /* @__PURE__ */ jsxDEV("span", {
563
- className: "ml-2 text-muted-foreground",
564
- "data-testid": "lg-fields",
565
- children: fields
566
- }, void 0, false);
567
- $[13] = fields;
568
- $[14] = t10;
569
- } else {
570
- t10 = $[14];
571
- }
572
- let t11;
573
- if ($[15] !== entry.message || $[16] !== t10) {
574
- t11 = /* @__PURE__ */ jsxDEV("span", {
575
- className: "flex-1 truncate",
576
- role: "gridcell",
577
- children: [entry.message, t10]
578
- }, void 0, true);
579
- $[15] = entry.message;
580
- $[16] = t10;
581
- $[17] = t11;
582
- } else {
583
- t11 = $[17];
584
- }
585
- let t12;
586
- if ($[18] !== index || $[19] !== measureRef || $[20] !== style || $[21] !== t11 || $[22] !== t5 || $[23] !== t7 || $[24] !== t9) {
587
- t12 = /* @__PURE__ */ jsxDEV("div", {
588
- className: "flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50",
589
- "data-index": index,
590
- "data-testid": "lg-row",
591
- ref: measureRef,
592
- role: "row",
593
- style,
594
- children: [t5, t7, t9, t11]
595
- }, void 0, true);
596
- $[18] = index;
597
- $[19] = measureRef;
598
- $[20] = style;
599
- $[21] = t11;
600
- $[22] = t5;
601
- $[23] = t7;
602
- $[24] = t9;
603
- $[25] = t12;
604
- } else {
605
- t12 = $[25];
606
- }
607
- return t12;
608
- };
609
- const tablesLabel = (tables) => tables.length === 0 ? "—" : tables.join(", ");
610
- const RequestRow = (t0) => {
611
- const $ = c(37);
612
- const {
613
- entry,
614
- index,
615
- measureRef,
616
- start
617
- } = t0;
618
- const t1 = `translateY(${String(start)}px)`;
619
- let t2;
620
- if ($[0] !== t1) {
621
- t2 = {
622
- ...ROW_BASE_STYLE,
623
- transform: t1
624
- };
625
- $[0] = t1;
626
- $[1] = t2;
627
- } else {
628
- t2 = $[1];
629
- }
630
- const style = t2;
631
- let t3;
632
- if ($[2] !== entry.ts) {
633
- t3 = new Date(entry.ts).toLocaleString();
634
- $[2] = entry.ts;
635
- $[3] = t3;
636
- } else {
637
- t3 = $[3];
638
- }
639
- let t4;
640
- if ($[4] !== t3) {
641
- t4 = /* @__PURE__ */ jsxDEV("span", {
642
- className: "w-40 shrink-0 tabular-nums text-muted-foreground",
643
- role: "gridcell",
644
- children: t3
645
- }, void 0, false);
646
- $[4] = t3;
647
- $[5] = t4;
648
- } else {
649
- t4 = $[5];
650
- }
651
- const t5 = OUTCOME_VARIANT[entry.outcome];
652
- let t6;
653
- if ($[6] !== entry.outcome || $[7] !== t5) {
654
- t6 = /* @__PURE__ */ jsxDEV("span", {
655
- className: "w-16 shrink-0",
656
- role: "gridcell",
657
- children: /* @__PURE__ */ jsxDEV(Badge, {
658
- variant: t5,
659
- children: entry.outcome
660
- }, void 0, false)
661
- }, void 0, false);
662
- $[6] = entry.outcome;
663
- $[7] = t5;
664
- $[8] = t6;
665
- } else {
666
- t6 = $[8];
667
- }
668
- let t7;
669
- if ($[9] !== entry.functionPath) {
670
- t7 = /* @__PURE__ */ jsxDEV("span", {
671
- className: "w-44 shrink-0 truncate",
672
- role: "gridcell",
673
- title: entry.functionPath,
674
- children: entry.functionPath
675
- }, void 0, false);
676
- $[9] = entry.functionPath;
677
- $[10] = t7;
678
- } else {
679
- t7 = $[10];
680
- }
681
- const t8 = entry.shardKey ?? "—";
682
- let t9;
683
- if ($[11] !== t8) {
684
- t9 = /* @__PURE__ */ jsxDEV("span", {
685
- className: "w-24 shrink-0 truncate text-muted-foreground",
686
- role: "gridcell",
687
- children: t8
688
- }, void 0, false);
689
- $[11] = t8;
690
- $[12] = t9;
691
- } else {
692
- t9 = $[12];
693
- }
694
- const t10 = entry.userId ?? "—";
695
- let t11;
696
- if ($[13] !== t10) {
697
- t11 = /* @__PURE__ */ jsxDEV("span", {
698
- className: "w-24 shrink-0 truncate text-muted-foreground",
699
- role: "gridcell",
700
- children: t10
701
- }, void 0, false);
702
- $[13] = t10;
703
- $[14] = t11;
704
- } else {
705
- t11 = $[14];
706
- }
707
- let t12;
708
- if ($[15] !== entry.durationMs) {
709
- t12 = Math.round(entry.durationMs);
710
- $[15] = entry.durationMs;
711
- $[16] = t12;
712
- } else {
713
- t12 = $[16];
714
- }
715
- const t13 = `${String(t12)}ms`;
716
- let t14;
717
- if ($[17] !== t13) {
718
- t14 = /* @__PURE__ */ jsxDEV("span", {
719
- className: "w-16 shrink-0 tabular-nums text-muted-foreground",
720
- role: "gridcell",
721
- children: t13
722
- }, void 0, false);
723
- $[17] = t13;
724
- $[18] = t14;
725
- } else {
726
- t14 = $[18];
727
- }
728
- let t15;
729
- if ($[19] !== entry.errorMessage || $[20] !== entry.outcome || $[21] !== entry.tablesRead || $[22] !== entry.tablesWritten) {
730
- t15 = entry.outcome === "error" && entry.errorMessage !== void 0 ? entry.errorMessage : `r:${tablesLabel(entry.tablesRead)} · w:${tablesLabel(entry.tablesWritten)}`;
731
- $[19] = entry.errorMessage;
732
- $[20] = entry.outcome;
733
- $[21] = entry.tablesRead;
734
- $[22] = entry.tablesWritten;
735
- $[23] = t15;
736
- } else {
737
- t15 = $[23];
738
- }
739
- let t16;
740
- if ($[24] !== t15) {
741
- t16 = /* @__PURE__ */ jsxDEV("span", {
742
- className: "flex-1 truncate text-muted-foreground",
743
- role: "gridcell",
744
- children: t15
745
- }, void 0, false);
746
- $[24] = t15;
747
- $[25] = t16;
748
- } else {
749
- t16 = $[25];
750
- }
751
- let t17;
752
- if ($[26] !== index || $[27] !== measureRef || $[28] !== style || $[29] !== t11 || $[30] !== t14 || $[31] !== t16 || $[32] !== t4 || $[33] !== t6 || $[34] !== t7 || $[35] !== t9) {
753
- t17 = /* @__PURE__ */ jsxDEV("div", {
754
- className: "flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50",
755
- "data-index": index,
756
- "data-testid": "lg-req-row",
757
- ref: measureRef,
758
- role: "row",
759
- style,
760
- children: [t4, t6, t7, t9, t11, t14, t16]
761
- }, void 0, true);
762
- $[26] = index;
763
- $[27] = measureRef;
764
- $[28] = style;
765
- $[29] = t11;
766
- $[30] = t14;
767
- $[31] = t16;
768
- $[32] = t4;
769
- $[33] = t6;
770
- $[34] = t7;
771
- $[35] = t9;
772
- $[36] = t17;
773
- } else {
774
- t17 = $[36];
775
- }
776
- return t17;
777
- };
778
- const entriesOf = (result) => {
779
- const {
780
- entries
781
- } = result ?? {};
782
- return Array.isArray(entries) ? entries : [];
783
- };
784
- const buildRequestQuery = (filters) => {
785
- const query = {};
786
- if (filters.functionPathPrefix.trim() !== "") {
787
- query.functionPathPrefix = filters.functionPathPrefix.trim();
788
- }
789
- if (filters.userId.trim() !== "") {
790
- query.userId = filters.userId.trim();
791
- }
792
- if (filters.tableTouched.trim() !== "") {
793
- query.tableTouched = filters.tableTouched.trim();
794
- }
795
- if (filters.outcome === "ok" || filters.outcome === "error") {
796
- query.outcome = filters.outcome;
797
- }
798
- return query;
799
- };
800
- const LOG_LEVELS = LOG_LEVEL_ORDER;
801
- const TIME_RANGE_MS = {
802
- "5m": 5 * 60 * 1e3,
803
- "15m": 15 * 60 * 1e3,
804
- "1h": 60 * 60 * 1e3
805
- };
806
- const filterLogs = (entries, criteria) => {
807
- const needle = criteria.search.trim().toLowerCase();
808
- const pathNeedle = criteria.path.trim().toLowerCase();
809
- const floor = criteria.range === "all" ? Number.NEGATIVE_INFINITY : criteria.now - TIME_RANGE_MS[criteria.range];
810
- return entries.filter((entry) => {
811
- if (criteria.levels.size > 0 && !criteria.levels.has(entry.level)) {
812
- return false;
813
- }
814
- if (entry.timestamp < floor) {
815
- return false;
816
- }
817
- if (pathNeedle !== "" && !(entry.functionPath ?? "").toLowerCase().includes(pathNeedle)) {
818
- return false;
819
- }
820
- return needle === "" || entry.message.toLowerCase().includes(needle) || formatLogFields(entry.fields).toLowerCase().includes(needle);
821
- });
822
- };
823
- const NO_PATH_KEY = "—";
824
- const summarizeLogs = (entries) => {
825
- const levelCounts = /* @__PURE__ */ new Map();
826
- const pathCounts = /* @__PURE__ */ new Map();
827
- for (const entry of entries) {
828
- levelCounts.set(entry.level, (levelCounts.get(entry.level) ?? 0) + 1);
829
- const pathKey = entry.functionPath ?? NO_PATH_KEY;
830
- pathCounts.set(pathKey, (pathCounts.get(pathKey) ?? 0) + 1);
831
- }
832
- const byLevel = LOG_LEVELS.filter((level) => levelCounts.has(level)).map((level) => {
833
- return {
834
- count: levelCounts.get(level) ?? 0,
835
- key: level
836
- };
837
- });
838
- const byPath = [...pathCounts.entries()].map(([key, count]) => {
839
- return {
840
- count,
841
- key
842
- };
843
- }).toSorted((a, b) => b.count === a.count ? a.key.localeCompare(b.key) : b.count - a.count);
844
- return {
845
- byLevel,
846
- byPath,
847
- total: entries.length
848
- };
849
- };
850
- const LevelToggle = (t0) => {
851
- const $ = c(11);
852
- const {
853
- level,
854
- onToggle,
855
- selected
856
- } = t0;
857
- let t1;
858
- if ($[0] !== level || $[1] !== onToggle) {
859
- t1 = () => {
860
- onToggle(level);
861
- };
862
- $[0] = level;
863
- $[1] = onToggle;
864
- $[2] = t1;
865
- } else {
866
- t1 = $[2];
867
- }
868
- const onClick = t1;
869
- const t2 = selected ? "border-border bg-muted font-medium" : "border-input text-muted-foreground";
870
- let t3;
871
- if ($[3] !== t2) {
872
- t3 = cn("rounded-md border px-2 py-1 text-xs", t2);
873
- $[3] = t2;
874
- $[4] = t3;
875
- } else {
876
- t3 = $[4];
877
- }
878
- const t4 = `logs-level-${level}`;
879
- let t5;
880
- if ($[5] !== level || $[6] !== onClick || $[7] !== selected || $[8] !== t3 || $[9] !== t4) {
881
- t5 = /* @__PURE__ */ jsxDEV("button", {
882
- "aria-pressed": selected,
883
- className: t3,
884
- "data-testid": t4,
885
- onClick,
886
- type: "button",
887
- children: level
888
- }, void 0, false);
889
- $[5] = level;
890
- $[6] = onClick;
891
- $[7] = selected;
892
- $[8] = t3;
893
- $[9] = t4;
894
- $[10] = t5;
895
- } else {
896
- t5 = $[10];
897
- }
898
- return t5;
899
- };
900
- const SummaryBucketRow = (t0) => {
901
- const $ = c(7);
902
- const {
903
- bucket
904
- } = t0;
905
- let t1;
906
- if ($[0] !== bucket.key) {
907
- t1 = /* @__PURE__ */ jsxDEV("span", {
908
- className: "truncate text-muted-foreground",
909
- role: "gridcell",
910
- children: bucket.key
911
- }, void 0, false);
912
- $[0] = bucket.key;
913
- $[1] = t1;
914
- } else {
915
- t1 = $[1];
916
- }
917
- let t2;
918
- if ($[2] !== bucket.count) {
919
- t2 = /* @__PURE__ */ jsxDEV("span", {
920
- className: "shrink-0 tabular-nums",
921
- role: "gridcell",
922
- children: bucket.count
923
- }, void 0, false);
924
- $[2] = bucket.count;
925
- $[3] = t2;
926
- } else {
927
- t2 = $[3];
928
- }
929
- let t3;
930
- if ($[4] !== t1 || $[5] !== t2) {
931
- t3 = /* @__PURE__ */ jsxDEV("div", {
932
- className: "flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs",
933
- "data-testid": "logs-summary-row",
934
- role: "row",
935
- children: [t1, t2]
936
- }, void 0, true);
937
- $[4] = t1;
938
- $[5] = t2;
939
- $[6] = t3;
940
- } else {
941
- t3 = $[6];
942
- }
943
- return t3;
944
- };
945
- const LogsPanel = ({
946
- initialShardKey
947
- }) => {
948
- const t = useT();
949
- const [view, setView] = useState("requests");
950
- const [shardKey, setShardKey] = useState(initialShardKey ?? "");
951
- const [search, setSearch] = useState("");
952
- const [levelFilter, setLevelFilter] = useState(() => /* @__PURE__ */ new Set());
953
- const [pathFilter, setPathFilter] = useState("");
954
- const [timeRange, setTimeRange] = useState("all");
955
- const [showSummary, setShowSummary] = useState(false);
956
- const [pathPrefix, setPathPrefix] = useState("");
957
- const [userIdFilter, setUserIdFilter] = useState("");
958
- const [tableFilter, setTableFilter] = useState("");
959
- const [outcomeFilter, setOutcomeFilter] = useState("all");
960
- const debouncedShard = useDebounced(shardKey.trim(), 400);
961
- const requestQuery = buildRequestQuery({
962
- functionPathPrefix: pathPrefix,
963
- outcome: outcomeFilter,
964
- tableTouched: tableFilter,
965
- userId: userIdFilter
966
- });
967
- const requestsQuery = useAdminQuery(ADMIN_FUNCTIONS.getRequestLog, requestQuery, {
968
- enabled: view === "requests",
969
- live: true,
970
- shardKey: debouncedShard
971
- });
972
- const errorsQuery = useAdminQuery(ADMIN_FUNCTIONS.getLogs, {}, {
973
- enabled: view === "errors",
974
- live: true,
975
- shardKey: debouncedShard
976
- });
977
- const activeQuery = view === "requests" ? requestsQuery : errorsQuery;
978
- const {
979
- error,
980
- errorSource,
981
- isLoading: activeLoading,
982
- liveError
983
- } = activeQuery;
984
- const entries = entriesOf(errorsQuery.data);
985
- const requests = entriesOf(requestsQuery.data);
986
- useEffect(() => {
987
- if (activeQuery.data !== void 0) {
988
- recordShard(debouncedShard);
989
- }
990
- }, [activeQuery.data, debouncedShard]);
991
- const filtered = filterLogs(entries, {
992
- levels: levelFilter,
993
- now: Date.now(),
994
- path: pathFilter,
995
- range: timeRange,
996
- search
997
- });
998
- const summary = summarizeLogs(filtered);
999
- const activeCount = view === "requests" ? requests.length : filtered.length;
1000
- const summaryVisible = view === "errors" && showSummary;
1001
- const readout = useMemo(() => {
1002
- if (error !== null) {
1003
- return "error";
1004
- }
1005
- if (activeCount === 0) {
1006
- if (activeLoading) {
1007
- return summaryVisible ? "summary" : "list";
1008
- }
1009
- return "empty";
1010
- }
1011
- return summaryVisible ? "summary" : "list";
1012
- }, [activeCount, activeLoading, error, summaryVisible]);
1013
- const scrollRef = useRef(null);
1014
- const virtualizer = useVirtualizer({
1015
- count: activeCount,
1016
- estimateSize: () => ROW_HEIGHT,
1017
- getScrollElement: () => scrollRef.current,
1018
- initialRect: {
1019
- height: SCROLL_HEIGHT,
1020
- width: 800
1021
- },
1022
- observeElementRect: (instance, callback) => flooredRectObserver(instance, callback, SCROLL_HEIGHT),
1023
- overscan: 8
1024
- });
1025
- const virtualRows = virtualizer.getVirtualItems();
1026
- const totalSize = virtualizer.getTotalSize();
1027
- const gridStyle = {
1028
- height: totalSize,
1029
- position: "relative",
1030
- width: "100%"
1031
- };
1032
- const onSearchChange = (event) => {
1033
- setSearch(event.target.value);
1034
- };
1035
- const toggleLevel = (level) => {
1036
- setLevelFilter((previous) => {
1037
- const next = new Set(previous);
1038
- if (next.has(level)) {
1039
- next.delete(level);
1040
- } else {
1041
- next.add(level);
1042
- }
1043
- return next;
1044
- });
1045
- };
1046
- const onLogPathChange = (event_0) => {
1047
- setPathFilter(event_0.target.value);
1048
- };
1049
- const onTimeRangeChange = (event_1) => {
1050
- setTimeRange(event_1.target.value);
1051
- };
1052
- const toggleSummary = () => {
1053
- setShowSummary((previous_0) => !previous_0);
1054
- };
1055
- const onPathChange = (event_2) => {
1056
- setPathPrefix(event_2.target.value);
1057
- };
1058
- const onUserChange = (event_3) => {
1059
- setUserIdFilter(event_3.target.value);
1060
- };
1061
- const onTableChange = (event_4) => {
1062
- setTableFilter(event_4.target.value);
1063
- };
1064
- const onOutcomeChange = (event_5) => {
1065
- setOutcomeFilter(event_5.target.value);
1066
- };
1067
- const showRequests = () => {
1068
- setView("requests");
1069
- setShowSummary(false);
1070
- };
1071
- const showErrors = () => {
1072
- setView("errors");
1073
- setShowSummary(false);
1074
- };
1075
- const showArchive = () => {
1076
- setView("archive");
1077
- setShowSummary(false);
1078
- };
1079
- return /* @__PURE__ */ jsxDEV("div", {
1080
- className: "flex flex-col gap-4",
1081
- "data-testid": "lunora-logs",
1082
- children: [/* @__PURE__ */ jsxDEV("div", {
1083
- className: "flex flex-wrap items-center gap-2",
1084
- children: [/* @__PURE__ */ jsxDEV("div", {
1085
- className: "inline-flex overflow-hidden rounded-lg border border-border",
1086
- role: "tablist",
1087
- children: [/* @__PURE__ */ jsxDEV("button", {
1088
- "aria-selected": view === "requests",
1089
- className: cn("px-3 py-1 text-sm", view === "requests" ? "bg-muted font-medium" : "text-muted-foreground"),
1090
- "data-testid": "lg-view-requests",
1091
- onClick: showRequests,
1092
- role: "tab",
1093
- type: "button",
1094
- children: t("Requests")
1095
- }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
1096
- "aria-selected": view === "errors",
1097
- className: cn("px-3 py-1 text-sm", view === "errors" ? "bg-muted font-medium" : "text-muted-foreground"),
1098
- "data-testid": "lg-view-errors",
1099
- onClick: showErrors,
1100
- role: "tab",
1101
- type: "button",
1102
- children: t("Errors")
1103
- }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
1104
- "aria-selected": view === "archive",
1105
- className: cn("px-3 py-1 text-sm", view === "archive" ? "bg-muted font-medium" : "text-muted-foreground"),
1106
- "data-testid": "lg-view-archive",
1107
- onClick: showArchive,
1108
- role: "tab",
1109
- type: "button",
1110
- children: t("Archive")
1111
- }, void 0, false)]
1112
- }, void 0, true), /* @__PURE__ */ jsxDEV(ShardInput, {
1113
- onChange: setShardKey,
1114
- testId: "lg-shard-input",
1115
- value: shardKey
1116
- }, void 0, false), view !== "archive" && /* @__PURE__ */ jsxDEV(LiveError, {
1117
- message: liveError,
1118
- prefix: "lg"
1119
- }, void 0, false), /* @__PURE__ */ jsxDEV("a", {
1120
- className: "text-sm text-primary underline-offset-4 hover:underline",
1121
- "data-testid": "lg-cf-link",
1122
- href: CLOUDFLARE_OBSERVABILITY_URL,
1123
- rel: "noreferrer",
1124
- target: "_blank",
1125
- children: t("Open in Cloudflare")
1126
- }, void 0, false)]
1127
- }, void 0, true), view === "errors" && /* @__PURE__ */ jsxDEV("div", {
1128
- className: "flex flex-wrap items-center gap-2",
1129
- children: [/* @__PURE__ */ jsxDEV(Input, {
1130
- "aria-label": t("Search messages"),
1131
- className: "h-8 w-48",
1132
- "data-testid": "lg-search",
1133
- onChange: onSearchChange,
1134
- placeholder: t("search message"),
1135
- value: search
1136
- }, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
1137
- "aria-label": t("Function path"),
1138
- className: "h-8 w-40",
1139
- "data-testid": "logs-path-filter",
1140
- onChange: onLogPathChange,
1141
- placeholder: t("filter path"),
1142
- value: pathFilter
1143
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1144
- "aria-label": t("Level filter"),
1145
- className: "inline-flex items-center gap-1",
1146
- "data-testid": "logs-level-filter",
1147
- role: "group",
1148
- children: LOG_LEVELS.map((level_0) => /* @__PURE__ */ jsxDEV(LevelToggle, {
1149
- level: level_0,
1150
- onToggle: toggleLevel,
1151
- selected: levelFilter.has(level_0)
1152
- }, level_0, false))
1153
- }, void 0, false), /* @__PURE__ */ jsxDEV("select", {
1154
- "aria-label": t("Time range"),
1155
- className: "h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none",
1156
- "data-testid": "logs-time-range",
1157
- onChange: onTimeRangeChange,
1158
- value: timeRange,
1159
- children: [/* @__PURE__ */ jsxDEV("option", {
1160
- value: "all",
1161
- children: t("All time")
1162
- }, void 0, false), /* @__PURE__ */ jsxDEV("option", {
1163
- value: "5m",
1164
- children: t("Last 5m")
1165
- }, void 0, false), /* @__PURE__ */ jsxDEV("option", {
1166
- value: "15m",
1167
- children: t("Last 15m")
1168
- }, void 0, false), /* @__PURE__ */ jsxDEV("option", {
1169
- value: "1h",
1170
- children: t("Last hour")
1171
- }, void 0, false)]
1172
- }, void 0, true), /* @__PURE__ */ jsxDEV("button", {
1173
- "aria-pressed": showSummary,
1174
- className: cn("h-8 rounded-md border px-3 text-sm", showSummary ? "border-border bg-muted font-medium" : "border-input text-muted-foreground"),
1175
- "data-testid": "logs-summary-toggle",
1176
- onClick: toggleSummary,
1177
- type: "button",
1178
- children: showSummary ? t("List") : t("Summary")
1179
- }, void 0, false)]
1180
- }, void 0, true), view === "requests" && /* @__PURE__ */ jsxDEV("div", {
1181
- className: "flex flex-wrap items-center gap-2",
1182
- children: [/* @__PURE__ */ jsxDEV(Input, {
1183
- "aria-label": t("Function path"),
1184
- className: "h-8 w-44",
1185
- "data-testid": "lg-req-path",
1186
- onChange: onPathChange,
1187
- placeholder: t("file:function"),
1188
- value: pathPrefix
1189
- }, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
1190
- "aria-label": t("User id"),
1191
- className: "h-8 w-32",
1192
- "data-testid": "lg-req-user",
1193
- onChange: onUserChange,
1194
- placeholder: t("userId"),
1195
- value: userIdFilter
1196
- }, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
1197
- "aria-label": t("Table touched"),
1198
- className: "h-8 w-32",
1199
- "data-testid": "lg-req-table",
1200
- onChange: onTableChange,
1201
- placeholder: t("table"),
1202
- value: tableFilter
1203
- }, void 0, false), /* @__PURE__ */ jsxDEV("select", {
1204
- "aria-label": t("Outcome filter"),
1205
- className: "h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none",
1206
- "data-testid": "lg-req-outcome",
1207
- onChange: onOutcomeChange,
1208
- value: outcomeFilter,
1209
- children: [/* @__PURE__ */ jsxDEV("option", {
1210
- value: "all",
1211
- children: t("all")
1212
- }, void 0, false), /* @__PURE__ */ jsxDEV("option", {
1213
- value: "ok",
1214
- children: t("ok")
1215
- }, void 0, false), /* @__PURE__ */ jsxDEV("option", {
1216
- value: "error",
1217
- children: t("error")
1218
- }, void 0, false)]
1219
- }, void 0, true)]
1220
- }, void 0, true), view === "archive" ? /* @__PURE__ */ jsxDEV(ArchiveFeed, {
1221
- shardKey: debouncedShard
1222
- }, void 0, false) : /* @__PURE__ */ jsxDEV(Fragment, {
1223
- children: [readout === "error" && /* @__PURE__ */ jsxDEV(ErrorAlert, {
1224
- error: errorSource,
1225
- testId: "lg-error"
1226
- }, void 0, false), readout === "empty" && /* @__PURE__ */ jsxDEV(EmptyState, {
1227
- description: t("Function and request logs for this shard show up here as your app handles traffic."),
1228
- icon: /* @__PURE__ */ jsxDEV("svg", {
1229
- "aria-hidden": "true",
1230
- fill: "none",
1231
- stroke: "currentColor",
1232
- strokeLinecap: "round",
1233
- strokeLinejoin: "round",
1234
- strokeWidth: 1.6,
1235
- viewBox: "0 0 24 24",
1236
- children: /* @__PURE__ */ jsxDEV("path", {
1237
- d: "M4 5h16M4 12h16M4 19h10"
1238
- }, void 0, false)
1239
- }, void 0, false),
1240
- testId: "lg-empty",
1241
- title: t("No logs.")
1242
- }, void 0, false), readout === "summary" && /* @__PURE__ */ jsxDEV("div", {
1243
- className: "flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs",
1244
- "data-testid": "logs-summary",
1245
- children: [/* @__PURE__ */ jsxDEV("p", {
1246
- className: "text-xs text-muted-foreground",
1247
- "data-testid": "logs-summary-total",
1248
- children: t("{count} entries", {
1249
- count: summary.total
1250
- })
1251
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1252
- children: [/* @__PURE__ */ jsxDEV("h4", {
1253
- className: "mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
1254
- children: t("By level")
1255
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1256
- className: "overflow-hidden rounded-lg border border-border",
1257
- "data-testid": "logs-summary-levels",
1258
- role: "grid",
1259
- children: summary.byLevel.map((bucket) => /* @__PURE__ */ jsxDEV(SummaryBucketRow, {
1260
- bucket
1261
- }, bucket.key, false))
1262
- }, void 0, false)]
1263
- }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
1264
- children: [/* @__PURE__ */ jsxDEV("h4", {
1265
- className: "mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
1266
- children: t("By function")
1267
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1268
- className: "overflow-hidden rounded-lg border border-border",
1269
- "data-testid": "logs-summary-paths",
1270
- role: "grid",
1271
- children: summary.byPath.map((bucket_0) => /* @__PURE__ */ jsxDEV(SummaryBucketRow, {
1272
- bucket: bucket_0
1273
- }, bucket_0.key, false))
1274
- }, void 0, false)]
1275
- }, void 0, true)]
1276
- }, void 0, true), readout === "list" && /* @__PURE__ */ jsxDEV("div", {
1277
- className: "rounded-xl border border-border shadow-xs",
1278
- "data-testid": "lg-scroll",
1279
- ref: scrollRef,
1280
- style: SCROLL_STYLE,
1281
- children: /* @__PURE__ */ jsxDEV("div", {
1282
- "aria-label": t("Recent logs"),
1283
- "data-testid": "lg-table",
1284
- role: "grid",
1285
- style: gridStyle,
1286
- children: virtualRows.map((virtualRow) => view === "requests" ? /* @__PURE__ */ jsxDEV(RequestRow, {
1287
- entry: requests[virtualRow.index],
1288
- index: virtualRow.index,
1289
- measureRef: virtualizer.measureElement,
1290
- start: virtualRow.start
1291
- }, virtualRow.key, false) : /* @__PURE__ */ jsxDEV(LogRow, {
1292
- entry: filtered[virtualRow.index],
1293
- index: virtualRow.index,
1294
- measureRef: virtualizer.measureElement,
1295
- start: virtualRow.start
1296
- }, virtualRow.key, false))
1297
- }, void 0, false)
1298
- }, void 0, false)]
1299
- }, void 0, true)]
1300
- }, void 0, true);
1301
- };
1302
-
1303
- export { LogsPanel, filterLogs, summarizeLogs };
1
+ import{c as M}from"react/compiler-runtime";import{useVirtualizer as qe}from"@tanstack/react-virtual";import{useState as $,useReducer as Me,useRef as ie,useEffect as de,useMemo as Ae}from"react";import{f as Q}from"../packem_shared/log-fields-CoL3hsIQ.js";import{E as Oe}from"../packem_shared/error-alert-B59DnrDI.js";import{L as Fe}from"../packem_shared/live-status-CGW2JHf_.js";import{ShardInput as De}from"../packem_shared/ShardInput-BVn2iCU0.js";import{g as Y}from"../packem_shared/badge-BbuuAio7.js";import{E as B}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as _}from"../packem_shared/input-JHu63lTv.js";import{K as re}from"../packem_shared/use-admin-query-Di3fLE8H.js";import G from"../packem_shared/useDebounced-Ihdiid_k.js";import{useT as ce}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as te}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{b as ue}from"../packem_shared/cf-links-gbDy51nR.js";import{r as Ke}from"../packem_shared/shard-history-DMEW5VBE.js";import{c as q}from"../packem_shared/utils-bhneXptQ.js";import{l as Ue}from"../packem_shared/virtual-rect-1o1veP7R.js";import{useLunora as Ve}from"@lunora/react";import{u as ze}from"../packem_shared/button-BkCrNcAs.js";import{n as je,d as Be,m as me,p as P,f as Ge,u as T}from"../packem_shared/table-DdJBrClo.js";import{f as ae,l as We,e as le}from"../packem_shared/internal-AtZ4bTal.js";import{jsx as t,jsxs as w,Fragment as Qe}from"react/jsx-runtime";const he=["trace","debug","log","info","warn","error","fatal"],Ye="LOG_ARCHIVE_NOT_CONFIGURED",ge={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},He={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Je=(l,e)=>{switch(e.type){case"append":return{...l,cursor:e.cursor,error:null,loading:!1,rows:[...l.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...l,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...l,error:e.message,loading:!1};default:return l}},Xe=l=>{const e=M(33),{row:r}=l;let s;e[0]!==r.fields?(s=Q(r.fields),e[0]=r.fields,e[1]=s):s=e[1];const n=s,a=`lg-archive-row-${String(r.ts)}`;let i;e[2]!==r.ts?(i=new Date(r.ts).toLocaleString(),e[2]=r.ts,e[3]=i):i=e[3];let u;e[4]!==i?(u=t(T,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=u):u=e[5];const v=ge[r.level];let c;e[6]!==r.level||e[7]!==v?(c=t(T,{children:t(Y,{variant:v,children:r.level})}),e[6]=r.level,e[7]=v,e[8]=c):c=e[8];let d;e[9]!==r.functionPath?(d=t(T,{className:"font-mono text-xs",children:r.functionPath}),e[9]=r.functionPath,e[10]=d):d=e[10];let b;e[11]!==r.message?(b=t("div",{className:"truncate",title:r.message,children:r.message}),e[11]=r.message,e[12]=b):b=e[12];let f;e[13]!==n?(f=n!==""&&t("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:n,children:n}),e[13]=n,e[14]=f):f=e[14];let m;e[15]!==b||e[16]!==f?(m=w(T,{className:"max-w-md",children:[b,f]}),e[15]=b,e[16]=f,e[17]=m):m=e[17];const h=r.traceId??"—";let p;e[18]!==h?(p=t(T,{className:"font-mono text-[11px] text-muted-foreground",children:h}),e[18]=h,e[19]=p):p=e[19];const L=r.shardKey??"—";let g;e[20]!==L?(g=t(T,{className:"font-mono text-[11px] text-muted-foreground",children:L}),e[20]=L,e[21]=g):g=e[21];const x=r.userId??"—";let y;e[22]!==x?(y=t(T,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let C;return e[24]!==m||e[25]!==p||e[26]!==g||e[27]!==y||e[28]!==a||e[29]!==u||e[30]!==c||e[31]!==d?(C=w(me,{"data-testid":a,children:[u,c,d,m,p,g,y]}),e[24]=m,e[25]=p,e[26]=g,e[27]=y,e[28]=a,e[29]=u,e[30]=c,e[31]=d,e[32]=C):C=e[32],C},Ze=({shardKey:l})=>{const e=Ve(),r=ce(),[s,n]=$(""),[a,i]=$(""),[u,v]=$(""),[{cursor:c,error:d,loading:b,notConfigured:f,rows:m},h]=Me(Je,He),p=G(s.trim(),400),L=G(a.trim(),400),g={...p===""?{}:{functionPathPrefix:p},...u===""?{}:{minLevel:u},...l===""?{}:{shardKey:l},...L===""?{}:{userId:L}},x=JSON.stringify(g),y=ie(x);de(()=>{const N={cancelled:!1};return y.current=x,ae((async()=>{h({type:"loading"});try{const k=await e.queryLogArchive(g);N.cancelled||h({cursor:k.nextCursor,rows:k.rows,type:"loaded"})}catch(k){N.cancelled||h(We(k)===Ye?{type:"notConfigured"}:{message:le(k),type:"failed"})}})()),()=>{N.cancelled=!0}},[e,x]);const C=async()=>{if(c===void 0)return;const N=x;h({type:"loading"});try{const k=await e.queryLogArchive({...g,cursor:c});y.current===N&&h({cursor:k.nextCursor,rows:k.rows,type:"append"})}catch(k){y.current===N&&h({message:le(k),type:"pageFailed"})}},R=N=>{n(N.target.value)},S=N=>{i(N.target.value)},I=N=>{v(N.target.value)},E=()=>{ae(C())};return f?t(B,{action:t("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:ue,rel:"noreferrer",target:"_blank",children:r("Open in Cloudflare")}),description:r("Wire pipelineLogSink to a Cloudflare Pipeline → R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:r("Log archive not configured")}):w("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[w("div",{className:"flex flex-wrap items-center gap-2",children:[t(_,{"aria-label":r("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:r("function path…"),value:s}),t(_,{"aria-label":r("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:S,placeholder:r("user id…"),value:a}),w("select",{"aria-label":r("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:I,value:u,children:[t("option",{value:"",children:r("min level")}),he.map(N=>t("option",{value:N,children:N},N))]})]}),d!==null&&t("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:d}),b&&m===null&&d===null&&t("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:r("Loading…")}),m!==null&&m.length===0&&t(B,{description:r("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:r("No archived logs.")}),m!==null&&m.length>0&&t("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:w(je,{"data-testid":"lg-archive-table",children:[t(Be,{children:w(me,{children:[t(P,{children:r("Time")}),t(P,{children:r("Level")}),t(P,{children:r("Function")}),t(P,{children:r("Message")}),t(P,{children:r("Trace")}),t(P,{children:r("Shard")}),t(P,{children:r("User")})]})}),t(Ge,{children:m.map((N,k)=>t(Xe,{row:N},`${String(N.ts)}-${String(k)}`))})]})}),c!==void 0&&t("div",{children:t(ze,{"data-testid":"lg-archive-more",disabled:b,onClick:E,size:"sm",variant:"outline",children:r(b?"Loading…":"Load more")})})]})},W=400,er=36,rr={height:W,overflow:"auto"},fe={left:0,position:"absolute",top:0,width:"100%"},tr={error:"destructive",ok:"secondary"},ar=l=>{const e=M(26),{entry:r,index:s,measureRef:n,start:a}=l,i=`translateY(${String(a)}px)`;let u;e[0]!==i?(u={...fe,transform:i},e[0]=i,e[1]=u):u=e[1];const v=u;let c;e[2]!==r.fields?(c=Q(r.fields),e[2]=r.fields,e[3]=c):c=e[3];const d=c;let b;e[4]!==r.timestamp?(b=new Date(r.timestamp).toLocaleString(),e[4]=r.timestamp,e[5]=b):b=e[5];let f;e[6]!==b?(f=t("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:b}),e[6]=b,e[7]=f):f=e[7];const m=ge[r.level];let h;e[8]!==r.level||e[9]!==m?(h=t("span",{className:"w-20 shrink-0",role:"gridcell",children:t(Y,{variant:m,children:r.level})}),e[8]=r.level,e[9]=m,e[10]=h):h=e[10];const p=r.functionPath??"—";let L;e[11]!==p?(L=t("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p}),e[11]=p,e[12]=L):L=e[12];let g;e[13]!==d?(g=d===""?null:t("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:d}),e[13]=d,e[14]=g):g=e[14];let x;e[15]!==r.message||e[16]!==g?(x=w("span",{className:"flex-1 truncate",role:"gridcell",children:[r.message,g]}),e[15]=r.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==n||e[20]!==v||e[21]!==x||e[22]!==f||e[23]!==h||e[24]!==L?(y=w("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:n,role:"row",style:v,children:[f,h,L,x]}),e[18]=s,e[19]=n,e[20]=v,e[21]=x,e[22]=f,e[23]=h,e[24]=L,e[25]=y):y=e[25],y},oe=l=>l.length===0?"—":l.join(", "),lr=l=>{const e=M(37),{entry:r,index:s,measureRef:n,start:a}=l,i=`translateY(${String(a)}px)`;let u;e[0]!==i?(u={...fe,transform:i},e[0]=i,e[1]=u):u=e[1];const v=u;let c;e[2]!==r.ts?(c=new Date(r.ts).toLocaleString(),e[2]=r.ts,e[3]=c):c=e[3];let d;e[4]!==c?(d=t("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:c}),e[4]=c,e[5]=d):d=e[5];const b=tr[r.outcome];let f;e[6]!==r.outcome||e[7]!==b?(f=t("span",{className:"w-16 shrink-0",role:"gridcell",children:t(Y,{variant:b,children:r.outcome})}),e[6]=r.outcome,e[7]=b,e[8]=f):f=e[8];let m;e[9]!==r.functionPath?(m=t("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:r.functionPath,children:r.functionPath}),e[9]=r.functionPath,e[10]=m):m=e[10];const h=r.shardKey??"—";let p;e[11]!==h?(p=t("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=p):p=e[12];const L=r.userId??"—";let g;e[13]!==L?(g=t("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:L}),e[13]=L,e[14]=g):g=e[14];let x;e[15]!==r.durationMs?(x=Math.round(r.durationMs),e[15]=r.durationMs,e[16]=x):x=e[16];const y=`${String(x)}ms`;let C;e[17]!==y?(C=t("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=C):C=e[18];let R;e[19]!==r.errorMessage||e[20]!==r.outcome||e[21]!==r.tablesRead||e[22]!==r.tablesWritten?(R=r.outcome==="error"&&r.errorMessage!==void 0?r.errorMessage:`r:${oe(r.tablesRead)} · w:${oe(r.tablesWritten)}`,e[19]=r.errorMessage,e[20]=r.outcome,e[21]=r.tablesRead,e[22]=r.tablesWritten,e[23]=R):R=e[23];let S;e[24]!==R?(S=t("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=S):S=e[25];let I;return e[26]!==s||e[27]!==n||e[28]!==v||e[29]!==g||e[30]!==C||e[31]!==S||e[32]!==d||e[33]!==f||e[34]!==m||e[35]!==p?(I=w("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:n,role:"row",style:v,children:[d,f,m,p,g,C,S]}),e[26]=s,e[27]=n,e[28]=v,e[29]=g,e[30]=C,e[31]=S,e[32]=d,e[33]=f,e[34]=m,e[35]=p,e[36]=I):I=e[36],I},se=l=>{const{entries:e}=l??{};return Array.isArray(e)?e:[]},or=l=>{const e={};return l.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=l.functionPathPrefix.trim()),l.userId.trim()!==""&&(e.userId=l.userId.trim()),l.tableTouched.trim()!==""&&(e.tableTouched=l.tableTouched.trim()),(l.outcome==="ok"||l.outcome==="error")&&(e.outcome=l.outcome),e},pe=he,sr={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},nr=(l,e)=>{const r=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),n=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-sr[e.range];return l.filter(a=>e.levels.size>0&&!e.levels.has(a.level)||a.timestamp<n||s!==""&&!(a.functionPath??"").toLowerCase().includes(s)?!1:r===""||a.message.toLowerCase().includes(r)||Q(a.fields).toLowerCase().includes(r))},ir="—",dr=l=>{const e=new Map,r=new Map;for(const a of l){e.set(a.level,(e.get(a.level)??0)+1);const i=a.functionPath??ir;r.set(i,(r.get(i)??0)+1)}const s=pe.filter(a=>e.has(a)).map(a=>({count:e.get(a)??0,key:a})),n=[...r.entries()].map(([a,i])=>({count:i,key:a})).toSorted((a,i)=>i.count===a.count?a.key.localeCompare(i.key):i.count-a.count);return{byLevel:s,byPath:n,total:l.length}},cr=l=>{const e=M(11),{level:r,onToggle:s,selected:n}=l;let a;e[0]!==r||e[1]!==s?(a=()=>{s(r)},e[0]=r,e[1]=s,e[2]=a):a=e[2];const i=a,u=n?"border-border bg-muted font-medium":"border-input text-muted-foreground";let v;e[3]!==u?(v=q("rounded-md border px-2 py-1 text-xs",u),e[3]=u,e[4]=v):v=e[4];const c=`logs-level-${r}`;let d;return e[5]!==r||e[6]!==i||e[7]!==n||e[8]!==v||e[9]!==c?(d=t("button",{"aria-pressed":n,className:v,"data-testid":c,onClick:i,type:"button",children:r}),e[5]=r,e[6]=i,e[7]=n,e[8]=v,e[9]=c,e[10]=d):d=e[10],d},ne=l=>{const e=M(7),{bucket:r}=l;let s;e[0]!==r.key?(s=t("span",{className:"truncate text-muted-foreground",role:"gridcell",children:r.key}),e[0]=r.key,e[1]=s):s=e[1];let n;e[2]!==r.count?(n=t("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:r.count}),e[2]=r.count,e[3]=n):n=e[3];let a;return e[4]!==s||e[5]!==n?(a=w("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,n]}),e[4]=s,e[5]=n,e[6]=a):a=e[6],a},qr=({initialShardKey:l})=>{const e=ce(),[r,s]=$("requests"),[n,a]=$(l??""),[i,u]=$(""),[v,c]=$(()=>new Set),[d,b]=$(""),[f,m]=$("all"),[h,p]=$(!1),[L,g]=$(""),[x,y]=$(""),[C,R]=$(""),[S,I]=$("all"),E=G(n.trim(),400),N=or({functionPathPrefix:L,outcome:S,tableTouched:C,userId:x}),k=re(te.getRequestLog,N,{enabled:r==="requests",live:!0,shardKey:E}),H=re(te.getLogs,{},{enabled:r==="errors",live:!0,shardKey:E}),D=r==="requests"?k:H,{error:J,errorSource:ve,isLoading:X,liveError:be}=D,xe=se(H.data),Z=se(k.data);de(()=>{D.data!==void 0&&Ke(E)},[D.data,E]);const K=nr(xe,{levels:v,now:Date.now(),path:d,range:f,search:i}),U=dr(K),V=r==="requests"?Z.length:K.length,z=r==="errors"&&h,A=Ae(()=>J!==null?"error":V===0?X?z?"summary":"list":"empty":z?"summary":"list",[V,X,J,z]),ee=ie(null),O=qe({count:V,estimateSize:()=>er,getScrollElement:()=>ee.current,initialRect:{height:W,width:800},observeElementRect:(o,j)=>Ue(o,j,W),overscan:8}),we=O.getVirtualItems(),ye={height:O.getTotalSize(),position:"relative",width:"100%"},Ne=o=>{u(o.target.value)},Le=o=>{c(j=>{const F=new Set(j);return F.has(o)?F.delete(o):F.add(o),F})},Ce=o=>{b(o.target.value)},ke=o=>{m(o.target.value)},$e=()=>{p(o=>!o)},Se=o=>{g(o.target.value)},Re=o=>{y(o.target.value)},Ie=o=>{R(o.target.value)},Ee=o=>{I(o.target.value)},Pe=()=>{s("requests"),p(!1)},Te=()=>{s("errors"),p(!1)},_e=()=>{s("archive"),p(!1)};return w("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[w("div",{className:"flex flex-wrap items-center gap-2",children:[w("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[t("button",{"aria-selected":r==="requests",className:q("px-3 py-1 text-sm",r==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:Pe,role:"tab",type:"button",children:e("Requests")}),t("button",{"aria-selected":r==="errors",className:q("px-3 py-1 text-sm",r==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:Te,role:"tab",type:"button",children:e("Errors")}),t("button",{"aria-selected":r==="archive",className:q("px-3 py-1 text-sm",r==="archive"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-archive",onClick:_e,role:"tab",type:"button",children:e("Archive")})]}),t(De,{onChange:a,testId:"lg-shard-input",value:n}),r!=="archive"&&t(Fe,{message:be,prefix:"lg"}),t("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:ue,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")})]}),r==="errors"&&w("div",{className:"flex flex-wrap items-center gap-2",children:[t(_,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:Ne,placeholder:e("search message"),value:i}),t(_,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:Ce,placeholder:e("filter path"),value:d}),t("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:pe.map(o=>t(cr,{level:o,onToggle:Le,selected:v.has(o)},o))}),w("select",{"aria-label":e("Time range"),className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:ke,value:f,children:[t("option",{value:"all",children:e("All time")}),t("option",{value:"5m",children:e("Last 5m")}),t("option",{value:"15m",children:e("Last 15m")}),t("option",{value:"1h",children:e("Last hour")})]}),t("button",{"aria-pressed":h,className:q("h-8 rounded-md border px-3 text-sm",h?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:$e,type:"button",children:e(h?"List":"Summary")})]}),r==="requests"&&w("div",{className:"flex flex-wrap items-center gap-2",children:[t(_,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:Se,placeholder:e("file:function"),value:L}),t(_,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:Re,placeholder:e("userId"),value:x}),t(_,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:Ie,placeholder:e("table"),value:C}),w("select",{"aria-label":e("Outcome filter"),className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:Ee,value:S,children:[t("option",{value:"all",children:e("all")}),t("option",{value:"ok",children:e("ok")}),t("option",{value:"error",children:e("error")})]})]}),r==="archive"?t(Ze,{shardKey:E}):w(Qe,{children:[A==="error"&&t(Oe,{error:ve,testId:"lg-error"}),A==="empty"&&t(B,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),A==="summary"&&w("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[t("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:U.total})}),w("div",{children:[t("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")}),t("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:U.byLevel.map(o=>t(ne,{bucket:o},o.key))})]}),w("div",{children:[t("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")}),t("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:U.byPath.map(o=>t(ne,{bucket:o},o.key))})]})]}),A==="list"&&t("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:ee,style:rr,children:t("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:ye,children:we.map(o=>r==="requests"?t(lr,{entry:Z[o.index],index:o.index,measureRef:O.measureElement,start:o.start},o.key):t(ar,{entry:K[o.index],index:o.index,measureRef:O.measureElement,start:o.start},o.key))})})]})]})};export{qr as LogsPanel,nr as filterLogs,dr as summarizeLogs};