@lunora/studio 1.0.0-alpha.330 → 1.0.0-alpha.332

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 (191) hide show
  1. package/dist/index.d.mts +26 -12
  2. package/dist/index.d.ts +26 -12
  3. package/dist/index.mjs +1 -1
  4. package/dist/mount.mjs +1 -1
  5. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  6. package/dist/packem_chunks/ApiTab.mjs +1 -1
  7. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  8. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
  9. package/dist/packem_chunks/ExportImportPanel.mjs +6 -3
  10. package/dist/packem_chunks/FileBrowser.mjs +4 -4
  11. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  12. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  13. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  14. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  15. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  16. package/dist/packem_chunks/MailPanel.mjs +1 -1
  17. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  18. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  19. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  20. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  21. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  22. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  23. package/dist/packem_chunks/SqlEditorPanel.mjs +2 -2
  24. package/dist/packem_chunks/TableEditor.mjs +1 -1
  25. package/dist/packem_chunks/agents-panel.mjs +1 -1
  26. package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
  27. package/dist/packem_chunks/analytics-panel.mjs +1 -1
  28. package/dist/packem_chunks/architecture-panel.mjs +1 -1
  29. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  30. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  31. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  32. package/dist/packem_chunks/containers-panel.mjs +1 -1
  33. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  34. package/dist/packem_chunks/evals-panel.mjs +1 -1
  35. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  36. package/dist/packem_chunks/flags-panel.mjs +1 -1
  37. package/dist/packem_chunks/issues-panel.mjs +1 -1
  38. package/dist/packem_chunks/kv-browser.mjs +1 -1
  39. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  40. package/dist/packem_chunks/migrations-route.mjs +1 -1
  41. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  42. package/dist/packem_chunks/payments-panel.mjs +1 -1
  43. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  44. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  45. package/dist/packem_chunks/queues-panel.mjs +1 -1
  46. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  47. package/dist/packem_chunks/rls-panel.mjs +1 -1
  48. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  49. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  50. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  51. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  52. package/dist/packem_chunks/traces-panel.mjs +1 -1
  53. package/dist/packem_chunks/users-panel.mjs +1 -1
  54. package/dist/packem_chunks/vector-browser.mjs +1 -1
  55. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  56. package/dist/packem_shared/{ApiDocsPanel-6yZaaxch.mjs → ApiDocsPanel-Py7C4ibM.mjs} +1 -1
  57. package/dist/packem_shared/{ApiReferencePanel-mwEK_vL7.mjs → ApiReferencePanel-DlYVADAy.mjs} +1 -1
  58. package/dist/packem_shared/{CommandPalette-CcTVGQvw.mjs → CommandPalette-CM1hqAOD.mjs} +1 -1
  59. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs +1 -0
  60. package/dist/packem_shared/{DataBrowser-B6xr6S3s.mjs → DataBrowser-DxlLv5x1.mjs} +2 -2
  61. package/dist/packem_shared/GlobalDataBrowser-TFTQpSVj.mjs +1 -0
  62. package/dist/packem_shared/{HomePanel-DBUgY2yE.mjs → HomePanel-BVz2sDQ4.mjs} +1 -1
  63. package/dist/packem_shared/{MigrationsPanel-_H327LDl.mjs → MigrationsPanel-fUyhbt0w.mjs} +1 -1
  64. package/dist/packem_shared/{OpenRpcReferencePanel-DJg4AbuZ.mjs → OpenRpcReferencePanel-CPIr-u-J.mjs} +1 -1
  65. package/dist/packem_shared/ScheduledJobs-zSeU_6cN.mjs +1 -0
  66. package/dist/packem_shared/{Studio-s4EbmwaL.mjs → Studio-CNqMkRmB.mjs} +1 -1
  67. package/dist/packem_shared/{StudioApp-D1e2uc7_.mjs → StudioApp-BG3kyQ-I.mjs} +1 -1
  68. package/dist/packem_shared/{advisor-view-kg9uZT7H.mjs → advisor-view-CXiPdw4B.mjs} +1 -1
  69. package/dist/packem_shared/{data-grid-XIuWrWDy.mjs → data-grid-BHTuvSI7.mjs} +1 -1
  70. package/dist/packem_shared/{diagram-export-panel-DrYRni_b.mjs → diagram-export-panel-BMLzao0Y.mjs} +1 -1
  71. package/dist/packem_shared/{error-alert-Dr4RMEID.mjs → error-alert-D-ftqyo-.mjs} +1 -1
  72. package/dist/packem_shared/{grid-features-6mTvrzgT.mjs → grid-features-CIdZ8Dqo.mjs} +2 -2
  73. package/dist/packem_shared/{home-panel-CKbpgpz9.mjs → home-panel-CF-MfsnH.mjs} +1 -1
  74. package/dist/packem_shared/internal-BXEjuLPN.mjs +2 -0
  75. package/dist/packem_shared/{log-line-DP0b3YT5.mjs → log-line-BWDt_F56.mjs} +1 -1
  76. package/dist/packem_shared/{recording-client-BbX9ql7w.mjs → recording-client-CFBkH4uZ.mjs} +1 -1
  77. package/dist/packem_shared/{reference-view-DNdYDPow.mjs → reference-view-BrsL8UGn.mjs} +3 -3
  78. package/dist/packem_shared/{schema-diagram-DKBYRWsL.mjs → schema-diagram-LRfchcoA.mjs} +1 -1
  79. package/dist/packem_shared/{sql-result-table-B7g48CHO.mjs → sql-result-table-COsfUSGc.mjs} +1 -1
  80. package/dist/packem_shared/{studio-BTM7dITm.mjs → studio-BcHsk7mT.mjs} +1 -1
  81. package/dist/packem_shared/table-list-sidebar-DwqtHSHU.mjs +1 -0
  82. package/dist/packem_shared/{use-admin-query-B2jU5P5u.mjs → use-admin-query-I1uILsUP.mjs} +1 -1
  83. package/dist/packem_shared/{use-admin-spec-CISwmdXM.mjs → use-admin-spec-BdNLZbTO.mjs} +1 -1
  84. package/dist/packem_shared/{use-async-submit-CgvRHgaD.mjs → use-async-submit-2eBBD0-m.mjs} +1 -1
  85. package/dist/packem_shared/{use-auth-config-B9w5-1-p.mjs → use-auth-config-DQ8tNyBh.mjs} +1 -1
  86. package/dist/packem_shared/{use-open-trace-CUyoDXjN.mjs → use-open-trace-B_0LbTD7.mjs} +1 -1
  87. package/dist/packem_shared/{use-sql-assistant-CK6G1ycr.mjs → use-sql-assistant-DetnUyFf.mjs} +1 -1
  88. package/dist/standalone/chunk-22MSJQDH.js +1 -0
  89. package/dist/standalone/chunk-2GYGUDJS.js +2 -0
  90. package/dist/standalone/chunk-34HRTSIP.js +1 -0
  91. package/dist/standalone/{chunk-A4R7GZQS.js → chunk-3O4QTTSY.js} +3 -3
  92. package/dist/standalone/{chunk-X472RKFD.js → chunk-4CGBMYO3.js} +3 -3
  93. package/dist/standalone/chunk-4DPZVEBK.js +1 -0
  94. package/dist/standalone/{chunk-NA7GP6EE.js → chunk-4NSXTCPY.js} +1 -1
  95. package/dist/standalone/{chunk-PLVFYL6L.js → chunk-4ZPDCXIA.js} +1 -1
  96. package/dist/standalone/chunk-5QXC7TAH.js +1 -0
  97. package/dist/standalone/{chunk-C5KBRXQG.js → chunk-5XSZGYSM.js} +1 -1
  98. package/dist/standalone/{chunk-3RSD3XAG.js → chunk-5ZCMUHYK.js} +1 -1
  99. package/dist/standalone/chunk-6UKEJNM5.js +1 -0
  100. package/dist/standalone/{chunk-5OMZCVRF.js → chunk-74IYYDDI.js} +9 -9
  101. package/dist/standalone/{chunk-D6ZXOSCM.js → chunk-7FTJLXZH.js} +1 -1
  102. package/dist/standalone/{chunk-2EYOYWS2.js → chunk-7Q256NLI.js} +1 -1
  103. package/dist/standalone/{chunk-DQSV2OFA.js → chunk-AH56E26M.js} +1 -1
  104. package/dist/standalone/{chunk-BPBEVNUM.js → chunk-B3SX5SBI.js} +2 -2
  105. package/dist/standalone/{chunk-D3HPOVEQ.js → chunk-B475OGG2.js} +1 -1
  106. package/dist/standalone/{chunk-QBTZMN5E.js → chunk-BDAZK3QX.js} +1 -1
  107. package/dist/standalone/{chunk-KRVD6WPH.js → chunk-BOGUQHYU.js} +1 -1
  108. package/dist/standalone/{chunk-DS2DTZFS.js → chunk-CHF23IX6.js} +3 -3
  109. package/dist/standalone/{chunk-OU56VN3R.js → chunk-CLXX5RVY.js} +1 -1
  110. package/dist/standalone/{chunk-G3NIGELJ.js → chunk-E75V5AEB.js} +1 -1
  111. package/dist/standalone/{chunk-2PNG3QHQ.js → chunk-EFXC3EHZ.js} +1 -1
  112. package/dist/standalone/{chunk-S63L3TCR.js → chunk-ENRGUWYC.js} +1 -1
  113. package/dist/standalone/{chunk-D746I7ZX.js → chunk-EWMBX5N2.js} +1 -1
  114. package/dist/standalone/{chunk-ULW7I6FO.js → chunk-F4HMMGVL.js} +1 -1
  115. package/dist/standalone/{chunk-V3RAWH63.js → chunk-FZJY5QLO.js} +1 -1
  116. package/dist/standalone/{chunk-K7OJ77CA.js → chunk-G3ZNPPY3.js} +1 -1
  117. package/dist/standalone/{chunk-X2YHVCMH.js → chunk-GUDC24NJ.js} +1 -1
  118. package/dist/standalone/{chunk-FCVKROK5.js → chunk-HIJGQX6F.js} +1 -1
  119. package/dist/standalone/chunk-HQPW3EZF.js +6 -0
  120. package/dist/standalone/chunk-HXO6YGKL.js +1 -0
  121. package/dist/standalone/{chunk-AQFI2GWT.js → chunk-IKT6EYHN.js} +1 -1
  122. package/dist/standalone/{chunk-MRFJSQBZ.js → chunk-IVZT3XO6.js} +1 -1
  123. package/dist/standalone/chunk-J2OLAMJR.js +1 -0
  124. package/dist/standalone/{chunk-I5RZUA4J.js → chunk-J4BVPEXN.js} +1 -1
  125. package/dist/standalone/{chunk-ZBRLJQ46.js → chunk-JKOBTLQU.js} +2 -2
  126. package/dist/standalone/{chunk-CVPVFONU.js → chunk-JYPEPARL.js} +1 -1
  127. package/dist/standalone/{chunk-ZQ4C2DMJ.js → chunk-K2EHRNYW.js} +1 -1
  128. package/dist/standalone/{chunk-SZIEPXZM.js → chunk-K3ST3XOT.js} +1 -1
  129. package/dist/standalone/{chunk-PDF22AMX.js → chunk-K73JDHTM.js} +1 -1
  130. package/dist/standalone/{chunk-P6UD4I65.js → chunk-KDF7XOVW.js} +1 -1
  131. package/dist/standalone/{chunk-CYWRJGWD.js → chunk-LVCMJJQO.js} +1 -1
  132. package/dist/standalone/{chunk-I23ULEUU.js → chunk-LXCVA5SP.js} +1 -1
  133. package/dist/standalone/{chunk-WMPXMPVF.js → chunk-M45NNDDU.js} +1 -1
  134. package/dist/standalone/{chunk-HYKN42SO.js → chunk-MC44447W.js} +1 -1
  135. package/dist/standalone/{chunk-DXYCOA4Y.js → chunk-NBYAGXMZ.js} +1 -1
  136. package/dist/standalone/{chunk-WS7WNXF3.js → chunk-NRAAYZ4C.js} +3 -3
  137. package/dist/standalone/{chunk-TM5C7YPO.js → chunk-NSNRU3CH.js} +1 -1
  138. package/dist/standalone/{chunk-VASJTDMU.js → chunk-PSMQQV6S.js} +1 -1
  139. package/dist/standalone/chunk-QMECH2OK.js +1 -0
  140. package/dist/standalone/{chunk-PH4VNMUO.js → chunk-QMENQICE.js} +1 -1
  141. package/dist/standalone/{chunk-QJACMRR5.js → chunk-RC6CRS3F.js} +1 -1
  142. package/dist/standalone/{chunk-LXBSXLLK.js → chunk-RFRFJ6GK.js} +1 -1
  143. package/dist/standalone/chunk-RNVXXJBN.js +1 -0
  144. package/dist/standalone/{chunk-YGNPACVK.js → chunk-SHY25BCU.js} +1 -1
  145. package/dist/standalone/{chunk-J5NS6XO4.js → chunk-T6XTWQC2.js} +1 -1
  146. package/dist/standalone/{chunk-AFX6YYGP.js → chunk-TBEEPT5P.js} +1 -1
  147. package/dist/standalone/{chunk-74WMPCOL.js → chunk-TRUA26Q4.js} +1 -1
  148. package/dist/standalone/{chunk-Y57U7WES.js → chunk-U2ACS5ID.js} +1 -1
  149. package/dist/standalone/{chunk-2W67FQCF.js → chunk-VDC6JP4A.js} +1 -1
  150. package/dist/standalone/chunk-VESZYIB4.js +1 -0
  151. package/dist/standalone/{chunk-MCHTZFX6.js → chunk-VFAP6A6G.js} +1 -1
  152. package/dist/standalone/{chunk-LSEISHAB.js → chunk-VNBONC2Q.js} +1 -1
  153. package/dist/standalone/{chunk-OMN44W6V.js → chunk-VQRCJJXS.js} +1 -1
  154. package/dist/standalone/{chunk-DVX5J34S.js → chunk-W4CQMJH3.js} +1 -1
  155. package/dist/standalone/{chunk-6XIDYONR.js → chunk-WAJZ4QKG.js} +1 -1
  156. package/dist/standalone/{chunk-3CBQDJ4S.js → chunk-WDGITBC6.js} +1 -1
  157. package/dist/standalone/{chunk-2G3B5PAO.js → chunk-WVWCUB4S.js} +1 -1
  158. package/dist/standalone/{chunk-GPNP4QSZ.js → chunk-X4MAMXRE.js} +1 -1
  159. package/dist/standalone/chunk-X6XAMP4E.js +7 -0
  160. package/dist/standalone/{chunk-6B7YJY6X.js → chunk-XDWPHAV6.js} +1 -1
  161. package/dist/standalone/{chunk-2QXJTBVX.js → chunk-XKISL2CG.js} +1 -1
  162. package/dist/standalone/chunk-XVE6WFB4.js +1 -0
  163. package/dist/standalone/chunk-YCQP3TYK.js +5 -0
  164. package/dist/standalone/chunk-ZBHXISOD.js +1 -0
  165. package/dist/standalone/{chunk-FBGCQYRO.js → chunk-ZFW3QEVE.js} +1 -1
  166. package/dist/standalone/{chunk-TSNDFT5D.js → chunk-ZVXBXVS3.js} +1 -1
  167. package/dist/standalone/{chunk-FGVGIVB6.js → chunk-ZWLIXZWR.js} +1 -1
  168. package/dist/standalone/studio.js +1 -1
  169. package/dist/styles.css +1 -1
  170. package/package.json +5 -5
  171. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +0 -1
  172. package/dist/packem_shared/GlobalDataBrowser-DlBYI85g.mjs +0 -1
  173. package/dist/packem_shared/ScheduledJobs-CscRWLW-.mjs +0 -1
  174. package/dist/packem_shared/internal-S7SDbbPa.mjs +0 -2
  175. package/dist/packem_shared/table-list-sidebar-DcvrtBkE.mjs +0 -1
  176. package/dist/standalone/chunk-3ADTLIRI.js +0 -1
  177. package/dist/standalone/chunk-5LEVE36K.js +0 -1
  178. package/dist/standalone/chunk-7XYNQ3JS.js +0 -1
  179. package/dist/standalone/chunk-AJSSEAMP.js +0 -1
  180. package/dist/standalone/chunk-DSXEICMD.js +0 -1
  181. package/dist/standalone/chunk-GV2QZP42.js +0 -2
  182. package/dist/standalone/chunk-GV6O3NPO.js +0 -1
  183. package/dist/standalone/chunk-GXYXVKOM.js +0 -1
  184. package/dist/standalone/chunk-HHT7X6VO.js +0 -1
  185. package/dist/standalone/chunk-HKQSHNFB.js +0 -1
  186. package/dist/standalone/chunk-JQXA2OYK.js +0 -1
  187. package/dist/standalone/chunk-KXYSX2SV.js +0 -1
  188. package/dist/standalone/chunk-NXVOCK3P.js +0 -5
  189. package/dist/standalone/chunk-PAAYRW3Q.js +0 -9
  190. package/dist/standalone/chunk-YPY2NU35.js +0 -3
  191. package/dist/standalone/chunk-YQQTRX55.js +0 -1
@@ -1 +1 @@
1
- import{useLunora as ee}from"@lunora/react";import{useState as f,useRef as G,useEffect as se}from"react";import{B as W}from"../packem_shared/button-q0UYSmrn.mjs";import{C as P,a as j}from"../packem_shared/card-By2O8ULa.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ne}from"../packem_shared/input-CXhxesPC.mjs";import{T as q,a as U,b as y,c as i,d as z,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as ae}from"../packem_shared/textarea--40GKAyz.mjs";import{u as oe}from"../packem_shared/use-admin-query-B2jU5P5u.mjs";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as Q}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as A,b as E,j as te,d as Z,c as re}from"../packem_shared/internal-S7SDbbPa.mjs";import{c as le}from"react/compiler-runtime";import{ConfirmButton as ie}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{jsxs as o,jsx as t,Fragment as de}from"react/jsx-runtime";const ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],me=l=>{const r=le(7),{busy:h,id:g,onAct:u}=l,x=M();let s;r[0]!==h||r[1]!==g||r[2]!==u||r[3]!==x?(s=ue.map(c=>c==="restart"?t(ie,{confirmLabel:x("Restart?"),disabled:h,onConfirm:()=>{u(c)},testId:`workflow-instance-${c}-${g}`,children:x(c)},c):t(W,{"data-testid":`workflow-instance-${c}-${g}`,disabled:h,onClick:()=>{u(c)},size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=h,r[1]=g,r[2]=u,r[3]=x,r[4]=s):s=r[4];let m;return r[5]!==s?(m=t(de,{children:s}),r[5]=s,r[6]=m):m=r[6],m},fe="WORKFLOWS_NOT_CONFIGURED",he=l=>typeof l=="object"&&l!==null&&l.code===fe,pe=l=>{const r=l.error??l.output;if(r===void 0)return"—";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},xe=({loadDetail:l,loadInstances:r,readOnly:h,runAction:g,workflowName:u})=>{const x=ee(),s=M(),[m,c]=f(null),[S,C]=f(null),[k,R]=f(""),[I,b]=f(null),[$,O]=f(!1),[_,F]=f(null),w=G(0),N=G(0),v=G(0),D=l??(e=>x.getWorkflowInstance(e)),T=h?void 0:g??(r===void 0?e=>x.setWorkflowInstanceStatus(e):void 0),L=async()=>{N.current+=1;const e=N.current;b(null),O(!1);const n=k===""?void 0:k;try{if(r===void 0){const p=await x.listWorkflowInstances({name:u,status:n});if(e!==N.current)return;if(p.configured===!1){c(null),O(!0);return}c(p.instances);return}const a=await r({name:u,status:n});e===N.current&&c(a)}catch(a){if(e!==N.current)return;c(null),he(a)?O(!0):b(E(a))}};se(()=>{w.current+=1,v.current+=1,C(null),A(L())},[u,k]);const B=async e=>{v.current+=1;const n=v.current;b(null);try{const a=await D({id:e,name:u});n===v.current&&C(a)}catch(a){n===v.current&&b(E(a))}},J=()=>{v.current+=1,C(null)},K=async(e,n)=>{if(T===void 0)return;const a=w.current;F(e),b(null);try{await T({action:n,id:e,name:u}),a===w.current&&await L()}catch(p){b(E(p))}F(null)};return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[o("div",{className:"flex items-center justify-between gap-2",children:[t("h3",{className:"text-sm font-medium",children:s("Instance history")}),o("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:e=>{R(e.target.value)},value:k,children:[t("option",{value:"",children:s("All statuses")}),ce.map(e=>t("option",{value:e,children:e},e))]})]}),I!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:I}),$&&t(H,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!$&&m!==null&&m.length===0&&t(H,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),m!==null&&m.length>0&&t(P,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflow-instances-table",children:[t(U,{children:o(y,{children:[t(i,{children:s("Instance id")}),t(i,{children:s("Status")}),t(i,{children:s("Created")}),t(i,{children:s("Ended")}),t(i,{"aria-label":s("Actions")})]})}),t(z,{children:m.map(e=>o(y,{"data-testid":`workflow-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"text-muted-foreground tabular-nums",children:e.createdOn??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.endedOn??"—"}),t(d,{className:"text-right",children:o("div",{className:"flex justify-end gap-1.5",children:[t(W,{"data-testid":`workflow-instance-steps-${e.id}`,onClick:()=>{A(B(e.id))},size:"sm",type:"button",variant:"outline",children:s("Steps")}),T!==void 0&&t(me,{busy:_===e.id,id:e.id,onAct:n=>{A(K(e.id,n))}},u)]})})]},e.id))})]})})}),S!==null&&t(P,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:o(j,{className:"flex flex-col gap-2 px-4 py-3",children:[o("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-mono text-xs",children:[s("Steps")," · ",S.id]}),t(W,{"data-testid":"workflow-instance-detail-close",onClick:J,size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?t("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):o(q,{"data-testid":"workflow-instance-steps",children:[t(U,{children:o(y,{children:[t(i,{children:s("Step")}),t(i,{children:s("Type")}),t(i,{children:s("Attempts")}),t(i,{children:s("Started")}),t(i,{children:s("Output")})]})}),t(z,{children:S.steps.map((e,n)=>o(y,{"data-testid":`workflow-step-${String(n)}`,children:[t(d,{className:"font-mono text-xs",children:e.name}),t(d,{className:"text-xs text-muted-foreground",children:e.type??"—"}),t(d,{className:"tabular-nums",children:e.attempts??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.start??"—"}),t(d,{className:"font-mono text-xs text-muted-foreground",children:pe(e)})]},`${e.name}:${String(n)}`))})]})]})})]})},we=re(Q.createWorkflowInstance),Ne=re(Q.getWorkflowInstanceStatus),ge=l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"—";try{return JSON.stringify(l.output,te)}catch{return"(unserializable)"}},be=(l,r)=>l.some(h=>h.exportName===r)?r:l[0]?.exportName??"",De=()=>{const l=ee(),r=M(),{data:h,error:g}=oe(Q.listWorkflows,{}),[u,x]=f(""),[s,m]=f(""),[c,S]=f(""),[C,k]=f(!1),[R,I]=f(null),[b,$]=f([]),[O,_]=f(null),F=h!==void 0,w=Array.isArray(h?.workflows)?[...h.workflows].toSorted((e,n)=>e.exportName.localeCompare(n.exportName)):[],N=be(w,u),v=w.find(e=>e.exportName===N),D=e=>{$(n=>{const a=n.filter(p=>!(p.exportName===e.exportName&&p.id===e.id));return[e,...a]})},V=async()=>{const e=N;if(e==="")return;let n;const a=c.trim();if(a!=="")try{n=JSON.parse(a)}catch{I(r("Params must be valid JSON"));return}k(!0),I(null);try{const p=s.trim(),Y=await l.query(we,{exportName:e,id:p===""?void 0:p,params:n},Z(""));D({exportName:e,id:Y.id,status:Y.status}),m("")}catch(p){I(E(p))}k(!1)},X=()=>{A(V())},T=async(e,n)=>{_(n);try{const a=await l.query(Ne,{exportName:e,id:n},Z(""));D({error:a.error,exportName:e,id:a.id,output:a.output,status:a.status})}catch(a){I(E(a))}_(null)},L=e=>{x(e.target.value)},B=e=>{m(e.target.value)},J=e=>{S(e.target.value)},K=e=>{const{export:n,id:a}=e.currentTarget.dataset;n!==void 0&&a!==void 0&&A(T(n,a))};return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:g}),t("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),F&&w.length===0?t(H,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):t(P,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflows-table",children:[t(U,{children:o(y,{children:[t(i,{children:r("Export")}),t(i,{children:r("Name")}),t(i,{children:r("Class")})]})}),t(z,{children:w.map(e=>o(y,{"data-testid":`workflows-row-${e.exportName}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.name}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.className})]},e.exportName))})]})})}),w.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[t("h3",{className:"text-sm font-medium",children:r("Start instance")}),R!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:R}),o("div",{className:"flex flex-wrap items-center gap-2",children:[t("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:L,value:N,children:w.map(e=>t("option",{value:e.exportName,children:e.exportName},e.exportName))}),t(ne,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:B,placeholder:r("Instance id (optional)"),value:s}),t(W,{"data-testid":"workflows-start-button",disabled:C||N==="",onClick:X,children:r(C?"Starting…":"Start instance")})]}),t(ae,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:J,placeholder:r("Params (JSON, optional)"),value:c})]}),b.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[t("h3",{className:"text-sm font-medium",children:r("Instances")}),t(P,{className:"overflow-hidden py-0",children:t(j,{className:"px-0",children:o(q,{"data-testid":"workflows-instances-table",children:[t(U,{children:o(y,{children:[t(i,{children:r("Workflow")}),t(i,{children:r("Instance id")}),t(i,{children:r("Status")}),t(i,{children:r("Output")}),t(i,{})]})}),t(z,{children:b.map(e=>o(y,{"data-testid":`workflows-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"font-mono text-xs text-muted-foreground",children:ge(e)}),t(d,{children:t(W,{"data-export":e.exportName,"data-id":e.id,"data-testid":`workflows-instance-refresh-${e.id}`,disabled:O===e.id,onClick:K,size:"xs",variant:"outline",children:O===e.id?r("Refreshing…"):r("Refresh")})})]},`${e.exportName}:${e.id}`))})]})})})]}),v!==void 0&&t(xe,{workflowName:v.name})]})};export{De as default};
1
+ import{useLunora as ee}from"@lunora/react";import{useState as f,useRef as G,useEffect as se}from"react";import{B as W}from"../packem_shared/button-q0UYSmrn.mjs";import{C as P,a as q}from"../packem_shared/card-By2O8ULa.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ne}from"../packem_shared/input-CXhxesPC.mjs";import{T as U,a as j,b as y,c as i,d as z,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as ae}from"../packem_shared/textarea--40GKAyz.mjs";import{u as oe}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as Q}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as A,b as E,k as te,d as Z,c as re}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as le}from"react/compiler-runtime";import{ConfirmButton as ie}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{jsxs as o,jsx as t,Fragment as de}from"react/jsx-runtime";const ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],me=l=>{const r=le(7),{busy:h,id:g,onAct:u}=l,x=M();let s;r[0]!==h||r[1]!==g||r[2]!==u||r[3]!==x?(s=ue.map(c=>c==="restart"?t(ie,{confirmLabel:x("Restart?"),disabled:h,onConfirm:()=>{u(c)},testId:`workflow-instance-${c}-${g}`,children:x(c)},c):t(W,{"data-testid":`workflow-instance-${c}-${g}`,disabled:h,onClick:()=>{u(c)},size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=h,r[1]=g,r[2]=u,r[3]=x,r[4]=s):s=r[4];let m;return r[5]!==s?(m=t(de,{children:s}),r[5]=s,r[6]=m):m=r[6],m},fe="WORKFLOWS_NOT_CONFIGURED",he=l=>typeof l=="object"&&l!==null&&l.code===fe,pe=l=>{const r=l.error??l.output;if(r===void 0)return"—";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},xe=({loadDetail:l,loadInstances:r,readOnly:h,runAction:g,workflowName:u})=>{const x=ee(),s=M(),[m,c]=f(null),[S,C]=f(null),[k,R]=f(""),[I,b]=f(null),[$,O]=f(!1),[_,F]=f(null),w=G(0),N=G(0),v=G(0),D=l??(e=>x.getWorkflowInstance(e)),T=h?void 0:g??(r===void 0?e=>x.setWorkflowInstanceStatus(e):void 0),L=async()=>{N.current+=1;const e=N.current;b(null),O(!1);const n=k===""?void 0:k;try{if(r===void 0){const p=await x.listWorkflowInstances({name:u,status:n});if(e!==N.current)return;if(p.configured===!1){c(null),O(!0);return}c(p.instances);return}const a=await r({name:u,status:n});e===N.current&&c(a)}catch(a){if(e!==N.current)return;c(null),he(a)?O(!0):b(E(a))}};se(()=>{w.current+=1,v.current+=1,C(null),A(L())},[u,k]);const B=async e=>{v.current+=1;const n=v.current;b(null);try{const a=await D({id:e,name:u});n===v.current&&C(a)}catch(a){n===v.current&&b(E(a))}},J=()=>{v.current+=1,C(null)},K=async(e,n)=>{if(T===void 0)return;const a=w.current;F(e),b(null);try{await T({action:n,id:e,name:u}),a===w.current&&await L()}catch(p){b(E(p))}F(null)};return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[o("div",{className:"flex items-center justify-between gap-2",children:[t("h3",{className:"text-sm font-medium",children:s("Instance history")}),o("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:e=>{R(e.target.value)},value:k,children:[t("option",{value:"",children:s("All statuses")}),ce.map(e=>t("option",{value:e,children:e},e))]})]}),I!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:I}),$&&t(H,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!$&&m!==null&&m.length===0&&t(H,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),m!==null&&m.length>0&&t(P,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflow-instances-table",children:[t(j,{children:o(y,{children:[t(i,{children:s("Instance id")}),t(i,{children:s("Status")}),t(i,{children:s("Created")}),t(i,{children:s("Ended")}),t(i,{"aria-label":s("Actions")})]})}),t(z,{children:m.map(e=>o(y,{"data-testid":`workflow-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"text-muted-foreground tabular-nums",children:e.createdOn??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.endedOn??"—"}),t(d,{className:"text-right",children:o("div",{className:"flex justify-end gap-1.5",children:[t(W,{"data-testid":`workflow-instance-steps-${e.id}`,onClick:()=>{A(B(e.id))},size:"sm",type:"button",variant:"outline",children:s("Steps")}),T!==void 0&&t(me,{busy:_===e.id,id:e.id,onAct:n=>{A(K(e.id,n))}},u)]})})]},e.id))})]})})}),S!==null&&t(P,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:o(q,{className:"flex flex-col gap-2 px-4 py-3",children:[o("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-mono text-xs",children:[s("Steps")," · ",S.id]}),t(W,{"data-testid":"workflow-instance-detail-close",onClick:J,size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?t("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):o(U,{"data-testid":"workflow-instance-steps",children:[t(j,{children:o(y,{children:[t(i,{children:s("Step")}),t(i,{children:s("Type")}),t(i,{children:s("Attempts")}),t(i,{children:s("Started")}),t(i,{children:s("Output")})]})}),t(z,{children:S.steps.map((e,n)=>o(y,{"data-testid":`workflow-step-${String(n)}`,children:[t(d,{className:"font-mono text-xs",children:e.name}),t(d,{className:"text-xs text-muted-foreground",children:e.type??"—"}),t(d,{className:"tabular-nums",children:e.attempts??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.start??"—"}),t(d,{className:"font-mono text-xs text-muted-foreground",children:pe(e)})]},`${e.name}:${String(n)}`))})]})]})})]})},we=re(Q.createWorkflowInstance),Ne=re(Q.getWorkflowInstanceStatus),ge=l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"—";try{return JSON.stringify(l.output,te)}catch{return"(unserializable)"}},be=(l,r)=>l.some(h=>h.exportName===r)?r:l[0]?.exportName??"",De=()=>{const l=ee(),r=M(),{data:h,error:g}=oe(Q.listWorkflows,{}),[u,x]=f(""),[s,m]=f(""),[c,S]=f(""),[C,k]=f(!1),[R,I]=f(null),[b,$]=f([]),[O,_]=f(null),F=h!==void 0,w=Array.isArray(h?.workflows)?[...h.workflows].toSorted((e,n)=>e.exportName.localeCompare(n.exportName)):[],N=be(w,u),v=w.find(e=>e.exportName===N),D=e=>{$(n=>{const a=n.filter(p=>!(p.exportName===e.exportName&&p.id===e.id));return[e,...a]})},V=async()=>{const e=N;if(e==="")return;let n;const a=c.trim();if(a!=="")try{n=JSON.parse(a)}catch{I(r("Params must be valid JSON"));return}k(!0),I(null);try{const p=s.trim(),Y=await l.query(we,{exportName:e,id:p===""?void 0:p,params:n},Z(""));D({exportName:e,id:Y.id,status:Y.status}),m("")}catch(p){I(E(p))}k(!1)},X=()=>{A(V())},T=async(e,n)=>{_(n);try{const a=await l.query(Ne,{exportName:e,id:n},Z(""));D({error:a.error,exportName:e,id:a.id,output:a.output,status:a.status})}catch(a){I(E(a))}_(null)},L=e=>{x(e.target.value)},B=e=>{m(e.target.value)},J=e=>{S(e.target.value)},K=e=>{const{export:n,id:a}=e.currentTarget.dataset;n!==void 0&&a!==void 0&&A(T(n,a))};return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:g}),t("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),F&&w.length===0?t(H,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):t(P,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflows-table",children:[t(j,{children:o(y,{children:[t(i,{children:r("Export")}),t(i,{children:r("Name")}),t(i,{children:r("Class")})]})}),t(z,{children:w.map(e=>o(y,{"data-testid":`workflows-row-${e.exportName}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.name}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.className})]},e.exportName))})]})})}),w.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[t("h3",{className:"text-sm font-medium",children:r("Start instance")}),R!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:R}),o("div",{className:"flex flex-wrap items-center gap-2",children:[t("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:L,value:N,children:w.map(e=>t("option",{value:e.exportName,children:e.exportName},e.exportName))}),t(ne,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:B,placeholder:r("Instance id (optional)"),value:s}),t(W,{"data-testid":"workflows-start-button",disabled:C||N==="",onClick:X,children:r(C?"Starting…":"Start instance")})]}),t(ae,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:J,placeholder:r("Params (JSON, optional)"),value:c})]}),b.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[t("h3",{className:"text-sm font-medium",children:r("Instances")}),t(P,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflows-instances-table",children:[t(j,{children:o(y,{children:[t(i,{children:r("Workflow")}),t(i,{children:r("Instance id")}),t(i,{children:r("Status")}),t(i,{children:r("Output")}),t(i,{})]})}),t(z,{children:b.map(e=>o(y,{"data-testid":`workflows-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"font-mono text-xs text-muted-foreground",children:ge(e)}),t(d,{children:t(W,{"data-export":e.exportName,"data-id":e.id,"data-testid":`workflows-instance-refresh-${e.id}`,disabled:O===e.id,onClick:K,size:"xs",variant:"outline",children:O===e.id?r("Refreshing…"):r("Refresh")})})]},`${e.exportName}:${e.id}`))})]})})})]}),v!==void 0&&t(xe,{workflowName:v.name})]})};export{De as default};
@@ -1,2 +1,2 @@
1
- import{c as F}from"react/compiler-runtime";import{useLunora as V}from"@lunora/react";import{useState as z,useEffect as W}from"react";import{B as H}from"./button-q0UYSmrn.mjs";import{E as K}from"./empty-state-D7jEML_T.mjs";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as Z,d as ee,g as te}from"./internal-S7SDbbPa.mjs";import{jsxs as R,jsx as u}from"react/jsx-runtime";const le=Z(X.listTables),ne=["react","client","cli"],ae={action:"action",mutation:"mutation",query:"query"},Q=a=>{const e=a.indexOf(":");return e===-1?{file:"",fn:a}:{file:a.slice(0,e),fn:a.slice(e+1)}},ie=({file:a,fn:e,kind:i})=>`await client.${ae[i]}(api.${a}.${e}, { /* args */ });`,se=a=>{const e=`api.${a.file}.${a.fn}`;switch(a.kind){case"action":return`const { call: ${a.fn} } = useAction(${e});`;case"mutation":return`const ${a.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},oe=({file:a,fn:e})=>`lunora run ${a}:${e} --args '{ }'`,ce=a=>["// Read rows",`const rows = await ctx.db.query("${a}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${a}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${a}">;`,`type RowId = Id<"${a}">;`].join(`
1
+ import{c as F}from"react/compiler-runtime";import{useLunora as V}from"@lunora/react";import{useState as z,useEffect as W}from"react";import{B as H}from"./button-q0UYSmrn.mjs";import{E as K}from"./empty-state-D7jEML_T.mjs";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as Z,d as ee,g as te}from"./internal-BXEjuLPN.mjs";import{jsxs as R,jsx as u}from"react/jsx-runtime";const le=Z(X.listTables),ne=["react","client","cli"],ae={action:"action",mutation:"mutation",query:"query"},Q=a=>{const e=a.indexOf(":");return e===-1?{file:"",fn:a}:{file:a.slice(0,e),fn:a.slice(e+1)}},ie=({file:a,fn:e,kind:i})=>`await client.${ae[i]}(api.${a}.${e}, { /* args */ });`,se=a=>{const e=`api.${a.file}.${a.fn}`;switch(a.kind){case"action":return`const { call: ${a.fn} } = useAction(${e});`;case"mutation":return`const ${a.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},oe=({file:a,fn:e})=>`lunora run ${a}:${e} --args '{ }'`,ce=a=>["// Read rows",`const rows = await ctx.db.query("${a}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${a}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${a}">;`,`type RowId = Id<"${a}">;`].join(`
2
2
  `),re=(a,e)=>{switch(a){case"cli":return oe(e);case"client":return ie(e);default:return se(e)}},U=a=>{const e=F(19),{code:i,label:s,testId:l}=a,n=M();let c;e[0]!==i?(c=()=>{te(i)},e[0]=i,e[1]=c):c=e[1];const m=c;let t;e[2]!==s?(t=u("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[2]=s,e[3]=t):t=e[3];const d=`${l}-copy`;let o;e[4]!==n?(o=n("Copy"),e[4]=n,e[5]=o):o=e[5];let f;e[6]!==m||e[7]!==d||e[8]!==o?(f=u(H,{"data-testid":d,onClick:m,size:"xs",type:"button",variant:"ghost",children:o}),e[6]=m,e[7]=d,e[8]=o,e[9]=f):f=e[9];let p;e[10]!==t||e[11]!==f?(p=R("div",{className:"flex items-center justify-between gap-2",children:[t,f]}),e[10]=t,e[11]=f,e[12]=p):p=e[12];let r;e[13]!==i||e[14]!==l?(r=u("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":l,children:i}),e[13]=i,e[14]=l,e[15]=r):r=e[15];let b;return e[16]!==p||e[17]!==r?(b=R("div",{className:"flex flex-col gap-1.5",children:[p,r]}),e[16]=p,e[17]=r,e[18]=b):b=e[18],b},de=a=>{const e=F(46),{file:i,fn:s,kind:l}=a,n=M(),[c,m]=z("react");let t,d,o;if(e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n||e[4]!==c){const x={file:i,fn:s,kind:l};let k;e[8]!==n?(k=n("CLI"),e[8]=n,e[9]=k):k=e[9];let w;e[10]!==n?(w=n("Client"),e[10]=n,e[11]=w):w=e[11];let I;e[12]!==n?(I=n("React"),e[12]=n,e[13]=I):I=e[13];let C;e[14]!==k||e[15]!==w||e[16]!==I?(C={cli:k,client:w,react:I},e[14]=k,e[15]=w,e[16]=I,e[17]=C):C=e[17],o=C;let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=D=>{m(D.currentTarget.dataset.tab)},e[18]=B):B=e[18],t=B,d=re(c,x),e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=c,e[5]=t,e[6]=d,e[7]=o}else t=e[5],d=e[6],o=e[7];const f=d,p=`api.${i}.${s}`;let r;e[19]!==p?(r=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:p}),e[19]=p,e[20]=r):r=e[20];let b;e[21]!==l||e[22]!==n?(b=n("Call this {kind} from your app.",{kind:l}),e[21]=l,e[22]=n,e[23]=b):b=e[23];let h;e[24]!==b?(h=u("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=h):h=e[25];let v;e[26]!==r||e[27]!==h?(v=R("div",{children:[r,h]}),e[26]=r,e[27]=h,e[28]=v):v=e[28];let $;e[29]!==n?($=n("Snippet flavour"),e[29]=n,e[30]=$):$=e[30];let y;e[31]!==t||e[32]!==c||e[33]!==o?(y=ne.map(x=>u(H,{"aria-selected":c===x,"data-tab":x,"data-testid":`api-tab-${x}`,onClick:t,role:"tab",size:"xs",type:"button",variant:c===x?"default":"outline",children:o[x]},x)),e[31]=t,e[32]=c,e[33]=o,e[34]=y):y=e[34];let N;e[35]!==$||e[36]!==y?(N=u("div",{"aria-label":$,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=$,e[36]=y,e[37]=N):N=e[37];const _=o[c],A=`api-snippet-${c}`;let S;e[38]!==f||e[39]!==_||e[40]!==A?(S=u(U,{code:f,label:_,testId:A}),e[38]=f,e[39]=_,e[40]=A,e[41]=S):S=e[41];let T;return e[42]!==S||e[43]!==v||e[44]!==N?(T=R("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,N,S]}),e[42]=S,e[43]=v,e[44]=N,e[45]=T):T=e[45],T},fe=a=>{const e=F(19),{name:i}=a,s=M();let l;e[0]!==i?(l=ce(i),e[0]=i,e[1]=l):l=e[1];const n=l;let c;e[2]!==i?(c=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:i}),e[2]=i,e[3]=c):c=e[3];let m;e[4]!==s?(m=s("Read and write this table through the typed data model."),e[4]=s,e[5]=m):m=e[5];let t;e[6]!==m?(t=u("p",{className:"text-xs text-muted-foreground",children:m}),e[6]=m,e[7]=t):t=e[7];let d;e[8]!==c||e[9]!==t?(d=R("div",{children:[c,t]}),e[8]=c,e[9]=t,e[10]=d):d=e[10];let o;e[11]!==s?(o=s("Data model"),e[11]=s,e[12]=o):o=e[12];let f;e[13]!==n||e[14]!==o?(f=u(U,{code:n,label:o,testId:"api-snippet-table"}),e[13]=n,e[14]=o,e[15]=f):f=e[15];let p;return e[16]!==d||e[17]!==f?(p=R("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[d,f]}),e[16]=d,e[17]=f,e[18]=p):p=e[18],p},G=a=>{const e=F(8),{active:i,label:s,onSelect:l,testId:n,value:c}=a;let m;e[0]!==l||e[1]!==c?(m=()=>{l(c)},e[0]=l,e[1]=c,e[2]=m):m=e[2];const t=m,d=i?"page":void 0;let o;return e[3]!==s||e[4]!==t||e[5]!==d||e[6]!==n?(o=u("button",{"aria-current":d,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":n,onClick:t,type:"button",children:s}),e[3]=s,e[4]=t,e[5]=d,e[6]=n,e[7]=o):o=e[7],o},pe=a=>{const e=new Map;for(const i of a){const{file:s,fn:l}=Q(i.path),n=e.get(s)??[];n.push({fn:l,kind:i.kind,path:i.path}),e.set(s,n)}return[...e.entries()].map(([i,s])=>({file:i,items:s.toSorted((l,n)=>l.fn.localeCompare(n.fn))})).toSorted((i,s)=>i.file.localeCompare(s.file))},ke=a=>{const e=F(58),{functions:i,initialShardKey:s}=a,l=M(),n=V(),[c,m]=z(null),[t,d]=z(null);let o,f;e[0]!==n||e[1]!==s?(o=()=>{let D=!1;return n.query(le,{},ee(s??"")).then(L=>(D||m(L),L)).catch(()=>{D||m([])}),()=>{D=!0}},f=[n,s],e[0]=n,e[1]=s,e[2]=o,e[3]=f):(o=e[2],f=e[3]),W(o,f);let p,r,b,h,v,$,y,N,_,A;if(e[4]!==i||e[5]!==t||e[6]!==l||e[7]!==c){const D=i??[],L=pe(D),O=(c??[]).map(ue).toSorted(me);let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=g=>{d({kind:"fn",path:g})},e[18]=P):P=e[18];const Y=P;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=g=>{d({kind:"table",name:g})},e[19]=j):j=e[19];const J=j;r=t?.kind==="fn"?D.find(g=>g.path===t.path):void 0,p=D.length>0||O.length>0,b=r===void 0?void 0:Q(r.path),_="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",A="lunora-api-docs",e[20]!==l?(h=l("API resources"),e[20]=l,e[21]=h):h=e[21],v="flex flex-col gap-4 overflow-y-auto",$="api-rail";let q;e[22]!==t||e[23]!==l?(q=g=>R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g.file||l("(root)")}),g.items.map(E=>u(G,{active:t?.kind==="fn"&&t.path===E.path,label:E.fn,onSelect:Y,testId:`api-rail-fn-${E.path}`,value:E.path},E.path))]},g.file),e[22]=t,e[23]=l,e[24]=q):q=e[24],y=L.map(q),N=O.length>0&&R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l("Tables")}),O.map(g=>u(G,{active:t?.kind==="table"&&t.name===g,label:g,onSelect:J,testId:`api-rail-table-${g}`,value:g},g))]}),e[4]=i,e[5]=t,e[6]=l,e[7]=c,e[8]=p,e[9]=r,e[10]=b,e[11]=h,e[12]=v,e[13]=$,e[14]=y,e[15]=N,e[16]=_,e[17]=A}else p=e[8],r=e[9],b=e[10],h=e[11],v=e[12],$=e[13],y=e[14],N=e[15],_=e[16],A=e[17];let S;e[25]!==p||e[26]!==l?(S=!p&&u("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:l("No functions or tables to document yet.")}),e[25]=p,e[26]=l,e[27]=S):S=e[27];let T;e[28]!==S||e[29]!==h||e[30]!==v||e[31]!==$||e[32]!==y||e[33]!==N?(T=R("nav",{"aria-label":h,className:v,"data-testid":$,children:[y,N,S]}),e[28]=S,e[29]=h,e[30]=v,e[31]=$,e[32]=y,e[33]=N,e[34]=T):T=e[34];let x;e[35]!==t||e[36]!==l?(x=t===null&&u(K,{description:l("Select a function or table to see how to call it from your app."),testId:"api-empty",title:l("API usage snippets")}),e[35]=t,e[36]=l,e[37]=x):x=e[37];let k;e[38]!==t?.kind||e[39]!==r||e[40]!==b?(k=t?.kind==="fn"&&r!==void 0&&b!==void 0&&u(de,{file:b.file,fn:b.fn,kind:r.kind},r.path),e[38]=t?.kind,e[39]=r,e[40]=b,e[41]=k):k=e[41];let w;e[42]!==t?.kind||e[43]!==r||e[44]!==l?(w=t?.kind==="fn"&&r===void 0&&u(K,{testId:"api-empty",title:l("API usage snippets")}),e[42]=t?.kind,e[43]=r,e[44]=l,e[45]=w):w=e[45];let I;e[46]!==t?(I=t?.kind==="table"&&u(fe,{name:t.name}),e[46]=t,e[47]=I):I=e[47];let C;e[48]!==x||e[49]!==k||e[50]!==w||e[51]!==I?(C=R("div",{className:"min-w-0",children:[x,k,w,I]}),e[48]=x,e[49]=k,e[50]=w,e[51]=I,e[52]=C):C=e[52];let B;return e[53]!==T||e[54]!==C||e[55]!==_||e[56]!==A?(B=R("div",{className:_,"data-testid":A,children:[T,C]}),e[53]=T,e[54]=C,e[55]=_,e[56]=A,e[57]=B):B=e[57],B};function ue(a){return a.name}function me(a,e){return a.localeCompare(e)}export{oe as buildCliSnippet,ie as buildClientSnippet,se as buildReactSnippet,ce as buildTableSnippet,ke as default,Q as splitPath};
@@ -1 +1 @@
1
- import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-D7jEML_T.mjs";import{S as g}from"./skeleton-DX1gfixl.mjs";import{u as O}from"./use-admin-spec-CISwmdXM.mjs";import{useT as S}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{R as A}from"./reference-view-DNdYDPow.mjs";import{jsxs as I,jsx as m}from"react/jsx-runtime";const P=["get","post","put","patch","delete","head","options","trace"],y=r=>r?.content?.["application/json"]?.schema,j=(r,e)=>Object.entries(r.responses??{}).map(([i,s])=>{const c=s.$ref?.replace("#/components/responses/",""),n=c===void 0?s:e.components?.responses?.[c]??s;return{description:n.description,schema:y(n),status:i}}),b=(r,e,i,s,c)=>{const n=y(s.requestBody),l=n?.properties?.functionPath?.const,t=typeof l=="string"?l:void 0,f=t===void 0?n:n?.properties?.args,a=s.operationId??`${i} ${e}`;return{argsSchema:f,description:s.description,functionPath:t,httpPath:e,key:r,kind:s["x-lunora-function-kind"],method:i.toUpperCase(),operationId:a,requestSchema:n,responses:j(s,c),summary:s.summary??a,tags:s.tags??[],title:s.summary??a}},x=r=>{const e=[];for(const[i,s]of Object.entries(r.paths??{})){const c=i.includes("#")?i.slice(0,i.indexOf("#")):i;for(const n of P){const l=s[n];l!==void 0&&e.push(b(i,c,n,l,r))}}return e},w=r=>{const e=r??{},i=x(e),s=new Map((e.tags??[]).map(t=>[t.name,t.description])),c=new Set,n=[],l=t=>{if(c.has(t))return;c.add(t);const f=i.filter(a=>(a.tags[0]??"")===t);f.length>0&&n.push({description:s.get(t),name:t,operations:f})};for(const t of e.tags??[])l(t.name);for(const t of i)l(t.tags[0]??"");return{groups:n,operationByKey:new Map(i.map(t=>[t.key,t])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},R=r=>{const{paths:e}=r;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},T=r=>{const e=r;return R(e)?{kind:"empty"}:{kind:"ready",spec:e}},H=r=>{const e=k(23),{spec:i}=r,s=S(),c=v();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const t=O(i,n,T);let f;e[2]!==t.kind||e[3]!==t.spec?(f=t.kind==="ready"?w(t.spec):void 0,e[2]=t.kind,e[3]=t.spec,e[4]=f):f=e[4];const a=f;if(t.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=I("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[m(g,{className:"h-8 w-48"}),m(g,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(t.kind==="error"){let o;e[6]!==t.message||e[7]!==s?(o=s("Couldn't load the OpenAPI spec: {message}",{message:t.message}),e[6]=t.message,e[7]=s,e[8]=o):o=e[8];let p;e[9]!==s?(p=s("API reference unavailable"),e[9]=s,e[10]=p):p=e[10];let d;return e[11]!==o||e[12]!==p?(d=m(h,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=d):d=e[13],d}if(t.kind==="empty"||a===void 0){let o;e[14]!==s?(o=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=o):o=e[15];let p;e[16]!==s?(p=s("No OpenAPI spec configured"),e[16]=s,e[17]=p):p=e[17];let d;return e[18]!==o||e[19]!==p?(d=m(h,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=d):d=e[20],d}let u;return e[21]!==a?(u=m(A,{model:a}),e[21]=a,e[22]=u):u=e[22],u};export{H as default};
1
+ import{c as k}from"react/compiler-runtime";import{useLunora as v}from"@lunora/react";import{E as h}from"./empty-state-D7jEML_T.mjs";import{S as g}from"./skeleton-DX1gfixl.mjs";import{u as O}from"./use-admin-spec-BdNLZbTO.mjs";import{useT as S}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{R as A}from"./reference-view-BrsL8UGn.mjs";import{jsxs as I,jsx as m}from"react/jsx-runtime";const P=["get","post","put","patch","delete","head","options","trace"],y=r=>r?.content?.["application/json"]?.schema,j=(r,e)=>Object.entries(r.responses??{}).map(([i,s])=>{const c=s.$ref?.replace("#/components/responses/",""),n=c===void 0?s:e.components?.responses?.[c]??s;return{description:n.description,schema:y(n),status:i}}),b=(r,e,i,s,c)=>{const n=y(s.requestBody),l=n?.properties?.functionPath?.const,t=typeof l=="string"?l:void 0,f=t===void 0?n:n?.properties?.args,a=s.operationId??`${i} ${e}`;return{argsSchema:f,description:s.description,functionPath:t,httpPath:e,key:r,kind:s["x-lunora-function-kind"],method:i.toUpperCase(),operationId:a,requestSchema:n,responses:j(s,c),summary:s.summary??a,tags:s.tags??[],title:s.summary??a}},x=r=>{const e=[];for(const[i,s]of Object.entries(r.paths??{})){const c=i.includes("#")?i.slice(0,i.indexOf("#")):i;for(const n of P){const l=s[n];l!==void 0&&e.push(b(i,c,n,l,r))}}return e},w=r=>{const e=r??{},i=x(e),s=new Map((e.tags??[]).map(t=>[t.name,t.description])),c=new Set,n=[],l=t=>{if(c.has(t))return;c.add(t);const f=i.filter(a=>(a.tags[0]??"")===t);f.length>0&&n.push({description:s.get(t),name:t,operations:f})};for(const t of e.tags??[])l(t.name);for(const t of i)l(t.tags[0]??"");return{groups:n,operationByKey:new Map(i.map(t=>[t.key,t])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},R=r=>{const{paths:e}=r;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},T=r=>{const e=r;return R(e)?{kind:"empty"}:{kind:"ready",spec:e}},H=r=>{const e=k(23),{spec:i}=r,s=S(),c=v();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const t=O(i,n,T);let f;e[2]!==t.kind||e[3]!==t.spec?(f=t.kind==="ready"?w(t.spec):void 0,e[2]=t.kind,e[3]=t.spec,e[4]=f):f=e[4];const a=f;if(t.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=I("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[m(g,{className:"h-8 w-48"}),m(g,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(t.kind==="error"){let o;e[6]!==t.message||e[7]!==s?(o=s("Couldn't load the OpenAPI spec: {message}",{message:t.message}),e[6]=t.message,e[7]=s,e[8]=o):o=e[8];let p;e[9]!==s?(p=s("API reference unavailable"),e[9]=s,e[10]=p):p=e[10];let d;return e[11]!==o||e[12]!==p?(d=m(h,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=d):d=e[13],d}if(t.kind==="empty"||a===void 0){let o;e[14]!==s?(o=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=o):o=e[15];let p;e[16]!==s?(p=s("No OpenAPI spec configured"),e[16]=s,e[17]=p):p=e[17];let d;return e[18]!==o||e[19]!==p?(d=m(h,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=d):d=e[20],d}let u;return e[21]!==a?(u=m(A,{model:a}),e[21]=a,e[22]=u):u=e[22],u};export{H as default};
@@ -1 +1 @@
1
- import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as X}from"./internal-S7SDbbPa.mjs";import{u as G}from"./shortcuts-B9gDaXmw.mjs";import{c as J}from"./utils-bhneXptQ.mjs";import{jsx as r,jsxs as A}from"react/jsx-runtime";const F="lunora:command-palette",ce=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(F))},Y=v=>{const e=U(18),{active:f,index:o,item:n,onActivate:h,onSelect:b}=v;let g;e[0]!==n||e[1]!==b?(g=()=>{b(n)},e[0]=n,e[1]=b,e[2]=g):g=e[2];const c=g;let x;e[3]!==o||e[4]!==h?(x=()=>{h(o)},e[3]=o,e[4]=h,e[5]=x):x=e[5];const d=x,m=f?"bg-accent text-accent-foreground":"text-foreground";let u;e[6]!==m?(u=J("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=u):u=e[7];let s;e[8]!==n.label?(s=r("span",{children:n.label}),e[8]=n.label,e[9]=s):s=e[9];let i;e[10]!==n.group?(i=r("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=i):i=e[11];let p;return e[12]!==c||e[13]!==d||e[14]!==u||e[15]!==s||e[16]!==i?(p=r("li",{children:A("button",{className:u,onClick:c,onMouseEnter:d,type:"button",children:[s,i]})}),e[12]=c,e[13]=d,e[14]=u,e[15]=s,e[16]=i,e[17]=p):p=e[17],p},Z=(v,e)=>{const f=e.trim().toLowerCase();return f===""?v:v.filter(o=>o.label.toLowerCase().includes(f)||o.group.toLowerCase().includes(f))},de=v=>{const e=U(40),{items:f}=v,o=W(),n=H(),{palette:h}=G(),[b,g]=B(!1),[c,x]=B(""),[d,m]=B(0),u=Q(null);let s,i;e[0]!==h?(s=()=>{const t=S=>{if(!(S.metaKey||S.ctrlKey)||S.key.toLowerCase()!==h)return;const{target:_}=S;_ instanceof HTMLElement&&(_.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(_.tagName))||(S.preventDefault(),g(!0))},l=()=>{g(!0)};return globalThis.addEventListener("keydown",t),globalThis.addEventListener(F,l),()=>{globalThis.removeEventListener("keydown",t),globalThis.removeEventListener(F,l)}},i=[h],e[0]=h,e[1]=s,e[2]=i):(s=e[1],i=e[2]),V(s,i);let p;e[3]!==f||e[4]!==c?(p=Z(f,c),e[3]=f,e[4]=c,e[5]=p):p=e[5];const a=p;let I;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{g(t),t||(x(""),m(0))},e[6]=I):I=e[6];const M=I;let K;e[7]!==n?(K=t=>{if(M(!1),t.run!==void 0){t.run();return}t.to!==void 0&&X(n({to:t.to}))},e[7]=n,e[8]=K):K=e[8];const w=K;let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=t=>{x(t.target.value),m(0)},e[9]=P):P=e[9];const q=P;let z;e[10]!==d||e[11]!==a||e[12]!==w?(z=t=>{e:switch(t.key){case"ArrowDown":{t.preventDefault(),m(l=>a.length===0?0:(l+1)%a.length);break e}case"ArrowUp":{t.preventDefault(),m(l=>a.length===0?0:(l-1+a.length)%a.length);break e}case"Enter":{t.preventDefault();const l=a[d];l!==void 0&&w(l);break e}}},e[10]=d,e[11]=a,e[12]=w,e[13]=z):z=e[13];const j=z;let R;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=r(D.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[14]=R):R=e[14];let y;e[15]!==o?(y=o("Command palette"),e[15]=o,e[16]=y):y=e[16];let E;e[17]!==y?(E=r(D.Title,{className:"sr-only",children:y}),e[17]=y,e[18]=E):E=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=A("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[19]=O):O=e[19];let N;e[20]!==o?(N=o("Search…"),e[20]=o,e[21]=N):N=e[21];let C;e[22]!==j||e[23]!==c||e[24]!==N?(C=A("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[O,r("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:q,onKeyDown:j,placeholder:N,ref:u,type:"text",value:c})]}),e[22]=j,e[23]=c,e[24]=N,e[25]=C):C=e[25];let T;e[26]!==d||e[27]!==a||e[28]!==w||e[29]!==o?(T=a.length===0?r("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("No results.")}):a.map((t,l)=>r(Y,{active:l===d,index:l,item:t,onActivate:m,onSelect:w},t.to??`${t.group}:${t.label}`)),e[26]=d,e[27]=a,e[28]=w,e[29]=o,e[30]=T):T=e[30];let k;e[31]!==T?(k=r("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:T}),e[31]=T,e[32]=k):k=e[32];let L;e[33]!==E||e[34]!==C||e[35]!==k?(L=A(D.Portal,{children:[R,A(D.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:u,children:[E,C,k]})]}),e[33]=E,e[34]=C,e[35]=k,e[36]=L):L=e[36];let $;return e[37]!==b||e[38]!==L?($=r(D.Root,{onOpenChange:M,open:b,children:L}),e[37]=b,e[38]=L,e[39]=$):$=e[39],$};export{de as CommandPalette,ce as openCommandPalette};
1
+ import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as X}from"./internal-BXEjuLPN.mjs";import{u as G}from"./shortcuts-B9gDaXmw.mjs";import{c as J}from"./utils-bhneXptQ.mjs";import{jsx as r,jsxs as A}from"react/jsx-runtime";const F="lunora:command-palette",ce=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(F))},Y=v=>{const e=U(18),{active:f,index:o,item:n,onActivate:h,onSelect:b}=v;let g;e[0]!==n||e[1]!==b?(g=()=>{b(n)},e[0]=n,e[1]=b,e[2]=g):g=e[2];const c=g;let x;e[3]!==o||e[4]!==h?(x=()=>{h(o)},e[3]=o,e[4]=h,e[5]=x):x=e[5];const d=x,m=f?"bg-accent text-accent-foreground":"text-foreground";let u;e[6]!==m?(u=J("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=u):u=e[7];let s;e[8]!==n.label?(s=r("span",{children:n.label}),e[8]=n.label,e[9]=s):s=e[9];let i;e[10]!==n.group?(i=r("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=i):i=e[11];let p;return e[12]!==c||e[13]!==d||e[14]!==u||e[15]!==s||e[16]!==i?(p=r("li",{children:A("button",{className:u,onClick:c,onMouseEnter:d,type:"button",children:[s,i]})}),e[12]=c,e[13]=d,e[14]=u,e[15]=s,e[16]=i,e[17]=p):p=e[17],p},Z=(v,e)=>{const f=e.trim().toLowerCase();return f===""?v:v.filter(o=>o.label.toLowerCase().includes(f)||o.group.toLowerCase().includes(f))},de=v=>{const e=U(40),{items:f}=v,o=W(),n=H(),{palette:h}=G(),[b,g]=B(!1),[c,x]=B(""),[d,m]=B(0),u=Q(null);let s,i;e[0]!==h?(s=()=>{const t=S=>{if(!(S.metaKey||S.ctrlKey)||S.key.toLowerCase()!==h)return;const{target:_}=S;_ instanceof HTMLElement&&(_.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(_.tagName))||(S.preventDefault(),g(!0))},l=()=>{g(!0)};return globalThis.addEventListener("keydown",t),globalThis.addEventListener(F,l),()=>{globalThis.removeEventListener("keydown",t),globalThis.removeEventListener(F,l)}},i=[h],e[0]=h,e[1]=s,e[2]=i):(s=e[1],i=e[2]),V(s,i);let p;e[3]!==f||e[4]!==c?(p=Z(f,c),e[3]=f,e[4]=c,e[5]=p):p=e[5];const a=p;let I;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{g(t),t||(x(""),m(0))},e[6]=I):I=e[6];const M=I;let K;e[7]!==n?(K=t=>{if(M(!1),t.run!==void 0){t.run();return}t.to!==void 0&&X(n({to:t.to}))},e[7]=n,e[8]=K):K=e[8];const w=K;let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=t=>{x(t.target.value),m(0)},e[9]=P):P=e[9];const q=P;let z;e[10]!==d||e[11]!==a||e[12]!==w?(z=t=>{e:switch(t.key){case"ArrowDown":{t.preventDefault(),m(l=>a.length===0?0:(l+1)%a.length);break e}case"ArrowUp":{t.preventDefault(),m(l=>a.length===0?0:(l-1+a.length)%a.length);break e}case"Enter":{t.preventDefault();const l=a[d];l!==void 0&&w(l);break e}}},e[10]=d,e[11]=a,e[12]=w,e[13]=z):z=e[13];const j=z;let R;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=r(D.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[14]=R):R=e[14];let y;e[15]!==o?(y=o("Command palette"),e[15]=o,e[16]=y):y=e[16];let E;e[17]!==y?(E=r(D.Title,{className:"sr-only",children:y}),e[17]=y,e[18]=E):E=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=A("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[19]=O):O=e[19];let N;e[20]!==o?(N=o("Search…"),e[20]=o,e[21]=N):N=e[21];let C;e[22]!==j||e[23]!==c||e[24]!==N?(C=A("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[O,r("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:q,onKeyDown:j,placeholder:N,ref:u,type:"text",value:c})]}),e[22]=j,e[23]=c,e[24]=N,e[25]=C):C=e[25];let T;e[26]!==d||e[27]!==a||e[28]!==w||e[29]!==o?(T=a.length===0?r("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("No results.")}):a.map((t,l)=>r(Y,{active:l===d,index:l,item:t,onActivate:m,onSelect:w},t.to??`${t.group}:${t.label}`)),e[26]=d,e[27]=a,e[28]=w,e[29]=o,e[30]=T):T=e[30];let k;e[31]!==T?(k=r("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:T}),e[31]=T,e[32]=k):k=e[32];let L;e[33]!==E||e[34]!==C||e[35]!==k?(L=A(D.Portal,{children:[R,A(D.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:u,children:[E,C,k]})]}),e[33]=E,e[34]=C,e[35]=k,e[36]=L):L=e[36];let $;return e[37]!==b||e[38]!==L?($=r(D.Root,{onOpenChange:M,open:b,children:L}),e[37]=b,e[38]=L,e[39]=$):$=e[39],$};export{de as CommandPalette,ce as openCommandPalette};
@@ -0,0 +1 @@
1
+ import{c as R}from"react/compiler-runtime";import{useLunora as F}from"@lunora/react";import{useRef as P,useEffect as M}from"react";import{i as S}from"./internal-BXEjuLPN.mjs";const T=6e4,g=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",D=5e3,U=(e,r,s)=>{const t=R(9),o=s===void 0?D:s,u=F(),a=P(e);let c;t[0]!==e?(c=()=>{a.current=e},t[0]=e,t[1]=c):c=t[1],M(c);let n;t[2]!==r||t[3]!==o?(n=()=>{if(!r)return;let l=o,d=!1,h;const f=()=>{d||(h=setTimeout(A,l))},p=()=>{l=o,f()},_=y=>{S(y)||(l=Math.max(o,Math.min(l*2,T)),f())},A=()=>{if(globalThis.document?.hidden===!0){f();return}let m;try{m=a.current()}catch(E){_(E);return}g(m)?Promise.resolve(m).then(p).catch(_):p()};return f(),()=>{d=!0,clearTimeout(h)}},t[2]=r,t[3]=o,t[4]=n):n=t[4];let i;t[5]!==u||t[6]!==r||t[7]!==o?(i=[u,r,o],t[5]=u,t[6]=r,t[7]=o,t[8]=i):i=t[8],M(n,i)},v=async e=>{const s=(await Promise.allSettled(e)).find(t=>t.status==="rejected");if(s!==void 0)throw s.reason};export{D as DEFAULT_AUTO_REFRESH_MS,v as settlePolls,U as useAutoRefresh};