@lunora/studio 1.0.0-alpha.85 → 1.0.0-alpha.87
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.
- package/dist/index.d.ts +18 -3
- package/dist/index.js +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.js +1 -1
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +1 -1
- package/dist/packem_chunks/ExportImportPanel.js +1 -1
- package/dist/packem_chunks/FileBrowser.js +1 -1
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
- package/dist/packem_chunks/HealthPanel.js +1 -1
- package/dist/packem_chunks/InsightsPanel.js +1 -1
- package/dist/packem_chunks/LogsPanel.js +1 -1
- package/dist/packem_chunks/MailPanel.js +1 -1
- package/dist/packem_chunks/MetricsPanel.js +1 -1
- package/dist/packem_chunks/NotificationsPanel.js +1 -1
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
- package/dist/packem_chunks/SettingsPanel.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +6 -6
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/agents-panel.js +1 -1
- package/dist/packem_chunks/auth-audit-panel.js +1 -1
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +1 -1
- package/dist/packem_chunks/fanout-panel.js +1 -1
- package/dist/packem_chunks/flags-panel.js +1 -1
- package/dist/packem_chunks/issues-panel.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_chunks/migrations-route.js +1 -1
- package/dist/packem_chunks/payments-panel.js +1 -1
- package/dist/packem_chunks/permissions-panel.js +1 -1
- package/dist/packem_chunks/queues-panel.js +1 -1
- package/dist/packem_chunks/rls-panel.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +1 -1
- package/dist/packem_chunks/subscriptions-panel.js +1 -1
- package/dist/packem_chunks/traces-panel.js +1 -1
- package/dist/packem_chunks/users-panel.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js +1 -0
- package/dist/packem_shared/{ApiDocsPanel-fYS9NiLg.js → ApiDocsPanel-DLMeLZ5-.js} +1 -1
- package/dist/packem_shared/DataBrowser-CZZ_WkJ-.js +1 -0
- package/dist/packem_shared/{GlobalDataBrowser-CSttudUx.js → GlobalDataBrowser-DpkjHfDg.js} +1 -1
- package/dist/packem_shared/{HomePanel-BYsfMhKh.js → HomePanel-3baDsDBU.js} +1 -1
- package/dist/packem_shared/MigrationsPanel-dygzHUvg.js +1 -0
- package/dist/packem_shared/{Studio-Ba9x0dG_.js → Studio-forQt-PC.js} +1 -1
- package/dist/packem_shared/{StudioApp-B_PRdg4h.js → StudioApp-B1AWsBzi.js} +1 -1
- package/dist/packem_shared/{home-panel-B60-5YfI.js → home-panel-CeeqqV0z.js} +1 -1
- package/dist/packem_shared/{studio-CPuoAmjh.js → studio-BtC7WPbz.js} +1 -1
- package/dist/packem_shared/table-list-sidebar-D9Bd4qgi.js +1 -0
- package/dist/packem_shared/use-shard-key-B2JtNa5m.js +1 -0
- package/dist/packem_shared/{use-sql-assistant-BLG9unQN.js → use-sql-assistant-C6dl2_Ty.js} +1 -1
- package/dist/packem_shared/useDebounced-CU-uftxO.js +1 -0
- package/dist/standalone/chunk-2VWWXVWK.js +1 -0
- package/dist/standalone/chunk-3CWGJYBB.js +1 -0
- package/dist/standalone/{chunk-52OYJHM7.js → chunk-4JIOFDMR.js} +1 -1
- package/dist/standalone/{chunk-MN64D74P.js → chunk-4LCY5XUR.js} +1 -1
- package/dist/standalone/{chunk-JE3WK77V.js → chunk-5KRD6F67.js} +1 -1
- package/dist/standalone/{chunk-RC3H4OP3.js → chunk-5X4OZ7OD.js} +1 -1
- package/dist/standalone/{chunk-TO45V3L6.js → chunk-6MGI5IN6.js} +1 -1
- package/dist/standalone/{chunk-HJR42BJY.js → chunk-7DNDRUMZ.js} +1 -1
- package/dist/standalone/chunk-7FO57AZY.js +1 -0
- package/dist/standalone/{chunk-YNBIW2GN.js → chunk-B5S6GSUC.js} +1 -1
- package/dist/standalone/{chunk-QZ6TCNWR.js → chunk-B5UFGO4E.js} +1 -1
- package/dist/standalone/{chunk-RFBU5RZI.js → chunk-BDNDSBYM.js} +1 -1
- package/dist/standalone/{chunk-QS4IFAFJ.js → chunk-CLNB7I3O.js} +1 -1
- package/dist/standalone/{chunk-QSFKPGK4.js → chunk-D3JTCLSF.js} +1 -1
- package/dist/standalone/chunk-DABW4OOI.js +1 -0
- package/dist/standalone/{chunk-SPT3KPV7.js → chunk-EAIUBZA5.js} +1 -1
- package/dist/standalone/{chunk-FUBR2PAD.js → chunk-EJ2CHD4G.js} +1 -1
- package/dist/standalone/chunk-EVTCXQ5D.js +1 -0
- package/dist/standalone/{chunk-OLM62NLS.js → chunk-EWDLYYJM.js} +1 -1
- package/dist/standalone/{chunk-ZOX6X2DL.js → chunk-F7NVC7YK.js} +1 -1
- package/dist/standalone/chunk-FURI47Z2.js +1 -0
- package/dist/standalone/chunk-FW75RYZU.js +1 -0
- package/dist/standalone/chunk-GE5WTIWX.js +1 -0
- package/dist/standalone/{chunk-BAAU4OTI.js → chunk-GZS3ORGS.js} +1 -1
- package/dist/standalone/chunk-HYCMT2V5.js +1 -0
- package/dist/standalone/{chunk-5YADKLAQ.js → chunk-IAKPXGTQ.js} +1 -1
- package/dist/standalone/chunk-IVCIG5J7.js +4 -0
- package/dist/standalone/chunk-KJIBL5D4.js +1 -0
- package/dist/standalone/chunk-L4RW5BFD.js +1 -0
- package/dist/standalone/{chunk-PWTURL56.js → chunk-LYRAWNV7.js} +1 -1
- package/dist/standalone/chunk-MIFLRBVS.js +11 -0
- package/dist/standalone/{chunk-OOL3FV6A.js → chunk-MV4A2PAK.js} +1 -1
- package/dist/standalone/{chunk-347H2BQO.js → chunk-NBUBAW3V.js} +1 -1
- package/dist/standalone/{chunk-232MBXB2.js → chunk-NCWUTRZB.js} +1 -1
- package/dist/standalone/{chunk-D67BVBQW.js → chunk-NMLCYY4H.js} +1 -1
- package/dist/standalone/{chunk-MDHUWMFD.js → chunk-OOWHAURL.js} +1 -1
- package/dist/standalone/{chunk-UOQ24BAY.js → chunk-ORVR33FM.js} +1 -1
- package/dist/standalone/{chunk-7AG3T4DK.js → chunk-OUCGTB3Y.js} +2 -2
- package/dist/standalone/chunk-PDMZITZZ.js +1 -0
- package/dist/standalone/{chunk-VORDESEQ.js → chunk-PNAVAJAF.js} +1 -1
- package/dist/standalone/{chunk-LVJ5IHEU.js → chunk-QJTGO4JG.js} +1 -1
- package/dist/standalone/{chunk-EDOMDMVI.js → chunk-QP7IQOKF.js} +1 -1
- package/dist/standalone/chunk-QXDMHM2V.js +1 -0
- package/dist/standalone/{chunk-VKEJTZY7.js → chunk-S2CXYDNT.js} +1 -1
- package/dist/standalone/{chunk-AQKXMWNF.js → chunk-S3DWUXGY.js} +1 -1
- package/dist/standalone/{chunk-YSMJN36P.js → chunk-SJZQPIZB.js} +1 -1
- package/dist/standalone/{chunk-ETZYJL7Z.js → chunk-SMEW3ZTU.js} +1 -1
- package/dist/standalone/chunk-SNK7TOOO.js +6 -0
- package/dist/standalone/{chunk-QI25LTPH.js → chunk-T2Q7I3V2.js} +1 -1
- package/dist/standalone/{chunk-ESKVOZLC.js → chunk-T3CGXSXO.js} +1 -1
- package/dist/standalone/{chunk-YGKR536O.js → chunk-TS6346VY.js} +1 -1
- package/dist/standalone/{chunk-ENBTOX7N.js → chunk-TVGKSIIW.js} +1 -1
- package/dist/standalone/{chunk-U5IIRHZ6.js → chunk-UNVK2VZP.js} +1 -1
- package/dist/standalone/{chunk-U44CWN7H.js → chunk-UR3X4K4T.js} +1 -1
- package/dist/standalone/chunk-VDW32UET.js +1 -0
- package/dist/standalone/chunk-VQK34A2H.js +1 -0
- package/dist/standalone/{chunk-MBVSXVTV.js → chunk-WPUINKEO.js} +1 -1
- package/dist/standalone/chunk-XNGYYOLS.js +14 -0
- package/dist/standalone/{chunk-2SC3EG5Y.js → chunk-XR7RBXKA.js} +1 -1
- package/dist/standalone/{chunk-KNHWIHC7.js → chunk-XZN645UJ.js} +1 -1
- package/dist/standalone/chunk-YFJXQUPW.js +1 -0
- package/dist/standalone/chunk-YKAO3JNJ.js +1 -0
- package/dist/standalone/{chunk-AHVDZWB3.js → chunk-YRYEZHOJ.js} +1 -1
- package/dist/standalone/{chunk-TIR6CWHO.js → chunk-ZCFDQW4U.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/packem_shared/ADMIN_FUNCTIONS-CZESgd10.js +0 -1
- package/dist/packem_shared/DataBrowser-C4J4gVUu.js +0 -1
- package/dist/packem_shared/MigrationsPanel-2JbQ2HwG.js +0 -1
- package/dist/packem_shared/table-list-sidebar-BRv3hTLX.js +0 -1
- package/dist/packem_shared/useDebounced-Ihdiid_k.js +0 -1
- package/dist/standalone/chunk-22LOWEEC.js +0 -1
- package/dist/standalone/chunk-2EJADIPC.js +0 -1
- package/dist/standalone/chunk-4I2TBTZS.js +0 -1
- package/dist/standalone/chunk-6IEBRNDW.js +0 -1
- package/dist/standalone/chunk-D3FRQZ4X.js +0 -1
- package/dist/standalone/chunk-ERMTJYQF.js +0 -1
- package/dist/standalone/chunk-JAT5ZBQK.js +0 -1
- package/dist/standalone/chunk-JOFD43OI.js +0 -1
- package/dist/standalone/chunk-LFKCLLPT.js +0 -1
- package/dist/standalone/chunk-MLULN4R2.js +0 -1
- package/dist/standalone/chunk-MUGKOGZG.js +0 -1
- package/dist/standalone/chunk-NPKNFZUW.js +0 -6
- package/dist/standalone/chunk-OV63HVE4.js +0 -4
- package/dist/standalone/chunk-QFJRZR4U.js +0 -1
- package/dist/standalone/chunk-QNRAMF4X.js +0 -1
- package/dist/standalone/chunk-QNUWWC3N.js +0 -14
- package/dist/standalone/chunk-S67SBGB3.js +0 -1
- package/dist/standalone/chunk-SHD2IWQI.js +0 -1
- package/dist/standalone/chunk-SKFZXESP.js +0 -1
- package/dist/standalone/chunk-UBR4KB6K.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as W}from"react/compiler-runtime";import{useState as T}from"react";import{E as B}from"../packem_shared/error-alert-t6cpEi0z.js";import{g as _}from"../packem_shared/badge-BbuuAio7.js";import{u as z}from"../packem_shared/button-BkCrNcAs.js";import{c as O,u as U}from"../packem_shared/card-CIDGUN6K.js";import{E as q}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as G}from"../packem_shared/input-JHu63lTv.js";import{n as J,d as K,m as F,p as h,f as Q,u as f}from"../packem_shared/table-DdJBrClo.js";import{N as X}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as Z}from"../packem_shared/ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as W}from"react/compiler-runtime";import{useState as T}from"react";import{E as B}from"../packem_shared/error-alert-t6cpEi0z.js";import{g as _}from"../packem_shared/badge-BbuuAio7.js";import{u as z}from"../packem_shared/button-BkCrNcAs.js";import{c as O,u as U}from"../packem_shared/card-CIDGUN6K.js";import{E as q}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as G}from"../packem_shared/input-JHu63lTv.js";import{n as J,d as K,m as F,p as h,f as Q,u as f}from"../packem_shared/table-DdJBrClo.js";import{N as X}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as Z}from"../packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js";import{i as ee}from"../packem_shared/internal-BSIsQVC6.js";import{jsx as t,jsxs as x}from"react/jsx-runtime";const te=e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary",P=e=>e.endpoint??e.id,ve=()=>{const e=W(38),r=Y(),[i,R]=T("all"),[s,V]=T("");let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];const{data:S,error:o,errorSource:p,isLoading:C,refetch:v}=X(Z.listPushSubscriptions,g);let N;if(e[1]!==S?.subscriptions||e[2]!==o||e[3]!==p||e[4]!==C||e[5]!==i||e[6]!==v||e[7]!==s||e[8]!==r){const A=S?.subscriptions??[],j=s.trim().toLowerCase(),E=A.filter(a=>i!=="all"&&a.kind!==i?!1:j===""?!0:`${P(a)} ${a.userId??""}`.toLowerCase().includes(j));let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=a=>{V(a.target.value)},e[10]=b):b=e[10];const D=b;let w;e[11]!==v?(w=()=>{v()},e[11]=v,e[12]=w):w=e[12];const I=w;let y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=["all","web-push","fcm"],e[13]=y):y=e[13];const H=y;let l;e[14]!==i||e[15]!==r?(l=t("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:H.map(a=>t(z,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:()=>{R(a)},role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=l):l=e[16];let n;e[17]!==r?(n=r("Filter devices"),e[17]=r,e[18]=n):n=e[18];let c;e[19]!==r?(c=r("filter endpoint, user"),e[19]=r,e[20]=c):c=e[20];let d;e[21]!==s||e[22]!==n||e[23]!==c?(d=t(G,{"aria-label":n,className:"h-8 w-56","data-testid":"nt-search",onChange:D,placeholder:c,value:s}),e[21]=s,e[22]=n,e[23]=c,e[24]=d):d=e[24];let m;e[25]!==r?(m=r("Refresh"),e[25]=r,e[26]=m):m=e[26];let u;e[27]!==I||e[28]!==m?(u=t(z,{className:"ml-auto","data-testid":"nt-refresh",onClick:I,size:"sm",type:"button",variant:"outline",children:m}),e[27]=I,e[28]=m,e[29]=u):u=e[29];const L=A.length>0&&t(_,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:A.length})});let $;e[30]!==u||e[31]!==L||e[32]!==l||e[33]!==d?($=x("div",{className:"flex flex-wrap items-center gap-2",children:[l,d,u,L]}),e[30]=u,e[31]=L,e[32]=l,e[33]=d,e[34]=$):$=e[34];let k;e[35]!==o||e[36]!==p?(k=o!==null&&t(B,{error:p,testId:"nt-error"}),e[35]=o,e[36]=p,e[37]=k):k=e[37],N=x("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[$,k,o===null&&!C&&E.length===0&&t(q,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),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:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),E.length>0&&t(O,{className:"overflow-hidden py-0",children:t(U,{className:"max-h-[30rem] overflow-auto px-0",children:x(J,{"data-testid":"nt-table",children:[t(K,{children:x(F,{children:[t(h,{children:r("kind")}),t(h,{children:r("endpoint")}),t(h,{children:r("user")}),t(h,{children:r("last seen")}),t(h,{children:r("status")}),t(h,{children:r("error")})]})}),t(Q,{children:E.map(a=>{const M=P(a);return x(F,{"data-testid":"nt-row",children:[t(f,{children:t(_,{variant:"outline",children:a.kind})}),t(f,{className:"max-w-[28ch] truncate font-mono text-xs",title:M,children:M}),t(f,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??t("span",{className:"text-muted-foreground",children:"—"})}),t(f,{className:"text-muted-foreground tabular-nums",children:ee(a.lastSeenAt,"—")}),t(f,{children:t(_,{"data-testid":`nt-status-${a.id}`,variant:te(a.lastStatus),children:a.lastStatus??r("n/a")})}),t(f,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??t("span",{className:"text-muted-foreground",children:"—"})})]},a.id)})})]})})})]}),e[1]=S?.subscriptions,e[2]=o,e[3]=p,e[4]=C,e[5]=i,e[6]=v,e[7]=s,e[8]=r,e[9]=N}else N=e[9];return N};export{ve as NotificationsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLunora as E}from"@lunora/react";import{useState as s,useCallback as H,useEffect as W}from"react";import{ConfirmButton as F}from"../packem_shared/ConfirmButton-CTL3f3kr.js";import{g as Z}from"../packem_shared/badge-BbuuAio7.js";import{u as _}from"../packem_shared/button-BkCrNcAs.js";import{u as I}from"../packem_shared/input-JHu63lTv.js";import{p as g}from"../packem_shared/label-6uP1obNF.js";import{useAutoRefresh as G}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as J}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-
|
|
1
|
+
import{useLunora as E}from"@lunora/react";import{useState as s,useCallback as H,useEffect as W}from"react";import{ConfirmButton as F}from"../packem_shared/ConfirmButton-CTL3f3kr.js";import{g as Z}from"../packem_shared/badge-BbuuAio7.js";import{u as _}from"../packem_shared/button-BkCrNcAs.js";import{u as I}from"../packem_shared/input-JHu63lTv.js";import{p as g}from"../packem_shared/label-6uP1obNF.js";import{useAutoRefresh as G}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as J}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js";import{d as u,b as N,f as p,g as S}from"../packem_shared/internal-BSIsQVC6.js";import{jsxs as a,jsx as r}from"react/jsx-runtime";const y=S(B.getPitrBookmark),Q=S(B.pitrRestore),de=({initialShardKey:T})=>{const m=E(),t=J(),i=T??"",[O,f]=s(null),[l,P]=s(""),[v,w]=s(null),[c,q]=s(""),[h,A]=s(!1),[o,L]=s(null),[C,n]=s(null),[x,d]=s(!1),b=H(async()=>{d(!0),n(null);try{const e=await m.query(y,{},u(i));f(e.current)}catch(e){n(N(e))}d(!1)},[m,i]);W(()=>{p(b())},[b]),G(()=>{p((async()=>{try{const e=await m.query(y,{},u(i));f(e.current)}catch{}})())},!0);const U=e=>{P(e.target.value)},j=e=>{q(e.target.value)},M=e=>{A(e.target.checked)},z=()=>{l.trim()!==""&&p((async()=>{d(!0),n(null);try{const e=await m.query(y,{time:l.trim()},u(i));w(e.forTime??null),f(e.current)}catch(e){w(null),n(N(e))}d(!1)})())},R=e=>{p((async()=>{d(!0),n(null);try{const k=await m.mutation(Q,e,u(i));L(k),await b()}catch(k){n(N(k))}d(!1)})())},K=c.trim()!==""||l.trim()!=="",$=()=>{const e=h?{restart:!0}:{};c.trim()===""?e.time=l.trim():e.bookmark=c.trim(),R(e)},D=()=>{o!==null&&R(h?{bookmark:o.undoBookmark,restart:!0}:{bookmark:o.undoBookmark})};return a("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[r("div",{className:"flex flex-wrap items-center gap-3",children:a("span",{className:"text-xs text-muted-foreground",children:[t("Shard"),": ",r("span",{className:"font-mono",children:i===""?t("root"):i})]})}),r("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),C!==null&&r("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:C}),a("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[r("h3",{className:"mb-2 text-sm font-semibold",children:t("Current bookmark")}),r("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:O??r("span",{className:"text-muted-foreground",children:"—"})})]}),a("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[r("h3",{className:"text-sm font-semibold",children:t("Restore")}),a("div",{className:"flex flex-col gap-1",children:[r(g,{htmlFor:"pitr-time",children:t("Time (ISO or epoch-ms, last 30 days)")}),a("div",{className:"flex items-center gap-2",children:[r(I,{"data-testid":"pitr-time",id:"pitr-time",onChange:U,placeholder:"2026-06-01T00:00:00.000Z",value:l}),r(_,{"data-testid":"pitr-preview",disabled:x||l.trim()==="",onClick:z,size:"sm",type:"button",variant:"outline",children:t("Preview")})]}),v!==null&&a("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",v]})]}),a("div",{className:"flex flex-col gap-1",children:[r(g,{htmlFor:"pitr-bookmark",children:t("Or an explicit bookmark (wins over time)")}),r(I,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:j,placeholder:t("bookmark string"),value:c})]}),a(g,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[r("input",{checked:h,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:M,type:"checkbox"}),t("Restart the shard now so recovery applies immediately")]}),r("div",{children:r(F,{confirmLabel:t("Confirm restore"),disabled:x||!K,onConfirm:$,testId:"pitr-restore",children:t("Restore")})})]}),o!==null&&a("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[a("div",{className:"flex items-center gap-2",children:[r("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),r(Z,{variant:o.restarted?"destructive":"secondary",children:o.restarted?t("restarted now"):t("on next restart")})]}),a("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",o.restoredTo]}),a("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",o.undoBookmark]}),r("div",{children:r(F,{confirmLabel:t("Confirm undo"),disabled:x,onConfirm:D,testId:"pitr-undo",children:t("Undo restore")})})]})]})};export{de as PitrPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as we}from"react/compiler-runtime";import{ShardInput as Qe}from"../packem_shared/ShardInput-BVn2iCU0.js";import{g as Ve,d as qe}from"../packem_shared/storage-tier-DznqOf-q.js";import{g as Fe}from"../packem_shared/badge-BbuuAio7.js";import{f as Ge,m as Le,n as Ke,u as Me,c as De}from"../packem_shared/card-CIDGUN6K.js";import{E as Ze}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as Ie}from"../packem_shared/input-JHu63lTv.js";import{useT as ze}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{d as Ae,b as Ee,f as ye,g as je}from"../packem_shared/internal-BSIsQVC6.js";import{c as We}from"../packem_shared/utils-bhneXptQ.js";import{useLunora as et}from"@lunora/react";import{useState as S,useEffect as Pe,useRef as tt}from"react";import lt from"../packem_shared/useDebounced-Ihdiid_k.js";import{ADMIN_FUNCTIONS as Oe}from"../packem_shared/ADMIN_FUNCTIONS-CZESgd10.js";import{r as at}from"../packem_shared/shard-history-DMEW5VBE.js";import{S as nt}from"../packem_shared/schema-diagram-cg-bz_VL.js";import{useNavigate as st}from"@tanstack/react-router";import{u as ve}from"../packem_shared/button-BkCrNcAs.js";import{p as $e}from"../packem_shared/label-6uP1obNF.js";import{jsx as l,jsxs as g,Fragment as Be}from"react/jsx-runtime";const rt=je(Oe.listTables),ot=je(Oe.listTableIndexes),it=je(Oe.readTablePage),dt=je(Oe.describeTables),ct={},Ue=[],mt=s=>{const e=we(75),{initialShardKey:m,initialTable:n}=s,t=et(),[a,d]=S("graph"),[o,i]=S(m??""),[u,c]=S(""),[r,b]=S(null),[N,h]=S(null);let F;e[0]===Symbol.for("react.memo_cache_sentinel")?(F={},e[0]=F):F=e[0];const[w,ce]=S(F);let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x={},e[1]=x):x=e[1];const[q,z]=S(x),[A,_]=S(null);let C;e[2]===Symbol.for("react.memo_cache_sentinel")?(C={},e[2]=C):C=e[2];const[k,P]=S(C);let Z;e[3]===Symbol.for("react.memo_cache_sentinel")?(Z={},e[3]=Z):Z=e[3];const[me,I]=S(Z),[v,ge]=S(null),[G,ue]=S(null);let ee;e[4]===Symbol.for("react.memo_cache_sentinel")?(ee={},e[4]=ee):ee=e[4];const[U,Ne]=S(ee),[X,be]=S(null);let Y;e[5]!==t?(Y=async p=>{h(null);try{const y=await t.query(rt,{},Ae(p));at(p),b(y),ce({}),z({}),_(null),P(T=>Object.fromEntries(Object.entries(T).filter(E=>{const[$]=E;return $!==p}))),I(T=>Object.fromEntries(Object.entries(T).filter(E=>{const[$]=E;return $!==p})))}catch(y){const T=y;b(null),h(Ee(T))}},e[5]=t,e[6]=Y):Y=e[6];const te=Y;let L;e[7]!==t?(L=async()=>{ue(null);try{ge(await t.listGlobalTables())}catch(p){const y=p;ge(null),ue(Ee(y))}},e[7]=t,e[8]=L):L=e[8];const le=L;let ae;e[9]!==o?(ae=o.trim(),e[9]=o,e[10]=ae):ae=e[10];const he=lt(ae,400);let K,ne;e[11]!==he||e[12]!==te||e[13]!==le?(ne=()=>{ye(te(he)),ye(le())},K=[te,le,he],e[11]=he,e[12]=te,e[13]=le,e[14]=K,e[15]=ne):(K=e[14],ne=e[15]),Pe(ne,K);let M;e[16]!==t||e[17]!==w||e[18]!==A||e[19]!==o?(M=async p=>{if(A===p){_(null);return}_(p);const y=`${o}:${p}`;if(w[y]!==void 0)return;const[T,E]=await Promise.allSettled([t.query(it,{limit:1,offset:0,table:p},Ae(o)),t.query(ot,{table:p},Ae(o))]);T.status==="fulfilled"?ce($=>({...$,[y]:T.value.columns})):h(Ee(T.reason)),E.status==="fulfilled"&&z($=>({...$,[y]:E.value.indexes}))},e[16]=t,e[17]=w,e[18]=A,e[19]=o,e[20]=M):M=e[20];const se=M;let re;e[21]!==t||e[22]!==U||e[23]!==X?(re=async p=>{if(X===p){be(null);return}if(be(p),U[p]===void 0)try{const y=await t.readGlobalTablePage({limit:1,offset:0,table:p});Ne(T=>({...T,[p]:y.columns}))}catch(y){ue(Ee(y))}},e[21]=t,e[22]=U,e[23]=X,e[24]=re):re=e[24];const pe=re,H=tt(void 0);let J,D;e[25]!==n||e[26]!==r||e[27]!==se?(J=()=>{n===void 0||r===null||H.current===n||r.some(p=>p.name===n)&&(H.current=n,ye(se(n)))},D=[n,r,se],e[25]=n,e[26]=r,e[27]=se,e[28]=J,e[29]=D):(J=e[28],D=e[29]),Pe(J,D);let oe;e[30]!==t?(oe=async(p,y,T)=>{const[E,$]=await Promise.all([Promise.allSettled([t.query(dt,{tables:[...y,...T]},Ae(p))]),Promise.all(T.map(async B=>{const Te=await Promise.allSettled([t.readGlobalTablePage({limit:1,offset:0,table:B})]),Re=Te[0].status==="fulfilled"?Te[0].value:void 0;return{columns:Re?.columns??[],refs:Re?.refs??{},table:B}}))]),Se=E[0].status==="fulfilled"?E[0].value?.columnsByTable??{}:{},_e=E[0].status==="rejected",ke=new Map($.map(ut)),O=[...y,...T].map(B=>{const Te=Se[B]??[];return[B,Te.length>0?Te:ke.get(B)??[]]});P(B=>({...B,[p]:Object.fromEntries(O)})),I(B=>({...B,[p]:_e}))},e[30]=t,e[31]=oe):oe=e[31];const R=oe;let ie,V;e[32]!==G||e[33]!==v||e[34]!==R||e[35]!==k||e[36]!==o||e[37]!==r||e[38]!==a?(ie=()=>{a!=="graph"||r===null||v===null&&G===null||k[o]!==void 0||ye(R(o,r.map(ht),(v??[]).map(pt)))},V=[a,r,v,G,o,k,R],e[32]=G,e[33]=v,e[34]=R,e[35]=k,e[36]=o,e[37]=r,e[38]=a,e[39]=ie,e[40]=V):(ie=e[39],V=e[40]),Pe(ie,V);const j=k[o]??ct;let W;if(e[41]!==j||e[42]!==v||e[43]!==r){let p;e[45]!==j?(p=$=>({columns:j[$.name]??Ue,name:$.name,tier:"shard"}),e[45]=j,e[46]=p):p=e[46];const y=(r??[]).map(p);let T;e[47]!==j?(T=$=>({columns:j[$.name]??Ue,name:$.name,tier:"global"}),e[47]=j,e[48]=T):T=e[48];const E=(v??[]).map(T);W=[...y,...E],e[41]=j,e[42]=v,e[43]=r,e[44]=W}else W=e[44];const f=W;let Q;if(e[49]!==u||e[50]!==r){const p=u.trim().toLowerCase();Q=(r??[]).filter(y=>y.name.toLowerCase().includes(p)),e[49]=u,e[50]=r,e[51]=Q}else Q=e[51];const de=Q;let fe;if(e[52]!==v||e[53]!==u){const p=u.trim().toLowerCase();fe=(v??[]).filter(y=>y.name.toLowerCase().includes(p)),e[52]=v,e[53]=u,e[54]=fe}else fe=e[54];const Ce=fe;let xe;return e[55]!==w||e[56]!==f||e[57]!==N||e[58]!==A||e[59]!==Ce||e[60]!==de||e[61]!==U||e[62]!==G||e[63]!==X||e[64]!==v||e[65]!==q||e[66]!==te||e[67]!==me||e[68]!==o||e[69]!==u||e[70]!==r||e[71]!==se||e[72]!==pe||e[73]!==a?(xe={columns:w,diagramTables:f,error:N,expanded:A,filteredGlobalTables:Ce,filteredTables:de,globalColumns:U,globalError:G,globalExpanded:X,globalTables:v,indexes:q,refresh:te,setShardKey:i,setTableFilter:c,setView:d,shardColumnsError:me,shardKey:o,tableFilter:u,tables:r,toggle:se,toggleGlobal:pe,view:a},e[55]=w,e[56]=f,e[57]=N,e[58]=A,e[59]=Ce,e[60]=de,e[61]=U,e[62]=G,e[63]=X,e[64]=v,e[65]=q,e[66]=te,e[67]=me,e[68]=o,e[69]=u,e[70]=r,e[71]=se,e[72]=pe,e[73]=a,e[74]=xe):xe=e[74],xe};function ut(s){const{columns:e,refs:m,table:n}=s;return[n,e.map(t=>{const a=m[t];return a===void 0?{name:t,optional:!1,type:""}:{name:t,optional:!1,ref:a,type:"id"}})]}function ht(s){return s.name}function pt(s){return s.name}const gt="/__lunora/schema-edit",bt=async s=>{const e=await fetch(gt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),m=await e.json();return m.needsMigration===!0?{kind:"needs-migration",message:m.message??"This edit needs a migration."}:e.ok&&m.tables!==void 0?{diagnostics:m.diagnostics??[],kind:"ok",tables:m.tables}:{kind:"error",message:m.error??`schema edit failed (${String(e.status)})`}},ft=s=>{const e=we(32),{hasTables:m,mode:n,onAddColumn:t,onAddIndex:a,onAddTable:d,onDestructive:o}=s,i=ze(),u=n==="addTable"?"default":"outline";let c;e[0]!==i?(c=i("Add table"),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==d||e[3]!==u||e[4]!==c?(r=l(ve,{"data-testid":"sc-editor-add-table",onClick:d,size:"xs",type:"button",variant:u,children:c}),e[2]=d,e[3]=u,e[4]=c,e[5]=r):r=e[5];const b=!m,N=n==="addColumn"?"default":"outline";let h;e[6]!==i?(h=i("Add column"),e[6]=i,e[7]=h):h=e[7];let F;e[8]!==t||e[9]!==b||e[10]!==N||e[11]!==h?(F=l(ve,{"data-testid":"sc-editor-add-column",disabled:b,onClick:t,size:"xs",type:"button",variant:N,children:h}),e[8]=t,e[9]=b,e[10]=N,e[11]=h,e[12]=F):F=e[12];const w=!m,ce=n==="addIndex"?"default":"outline";let x;e[13]!==i?(x=i("Add index"),e[13]=i,e[14]=x):x=e[14];let q;e[15]!==a||e[16]!==x||e[17]!==w||e[18]!==ce?(q=l(ve,{"data-testid":"sc-editor-add-index",disabled:w,onClick:a,size:"xs",type:"button",variant:ce,children:x}),e[15]=a,e[16]=x,e[17]=w,e[18]=ce,e[19]=q):q=e[19];const z=!m,A=n==="destructive"?"default":"ghost";let _;e[20]!==i?(_=i("Rename / drop / change type…"),e[20]=i,e[21]=_):_=e[21];let C;e[22]!==o||e[23]!==z||e[24]!==A||e[25]!==_?(C=l(ve,{"data-testid":"sc-editor-destructive",disabled:z,onClick:o,size:"xs",type:"button",variant:A,children:_}),e[22]=o,e[23]=z,e[24]=A,e[25]=_,e[26]=C):C=e[26];let k;return e[27]!==q||e[28]!==C||e[29]!==r||e[30]!==F?(k=g("div",{className:"flex flex-wrap gap-2",children:[r,F,q,C]}),e[27]=q,e[28]=C,e[29]=r,e[30]=F,e[31]=k):k=e[31],k},xt=s=>{const e=we(28),{onOpenMigrations:m,result:n}=s,t=ze();if(n===null){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=l(Be,{}),e[0]=c):c=e[0],c}if(n.kind==="error"){let c;return e[1]!==n.message?(c=l("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=c):c=e[2],c}if(n.kind==="needs-migration"){let c;e[3]!==n.message||e[4]!==t?(c=n.message===""?t("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=t,e[5]=c):c=e[5];let r;e[6]!==c?(r=l("p",{className:"text-sm text-warning",role:"alert",children:c}),e[6]=c,e[7]=r):r=e[7];let b;e[8]!==t?(b=t("Open Migrations"),e[8]=t,e[9]=b):b=e[9];let N;e[10]!==m||e[11]!==b?(N=l(ve,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:m,size:"xs",type:"button",variant:"outline",children:b}),e[10]=m,e[11]=b,e[12]=N):N=e[12];let h;return e[13]!==r||e[14]!==N?(h=g("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[r,N]}),e[13]=r,e[14]=N,e[15]=h):h=e[15],h}if(n.diagnostics.length===0){let c;return e[16]===Symbol.for("react.memo_cache_sentinel")?(c=l(Be,{}),e[16]=c):c=e[16],c}let a;e[17]!==t?(a=t("Codegen reported diagnostics:"),e[17]=t,e[18]=a):a=e[18];let d;e[19]!==a?(d=l("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=d):d=e[20];let o;e[21]!==n.diagnostics?(o=n.diagnostics.map(vt),e[21]=n.diagnostics,e[22]=o):o=e[22];let i;e[23]!==o?(i=l("ul",{className:"flex flex-col gap-0.5",children:o}),e[23]=o,e[24]=i):i=e[24];let u;return e[25]!==d||e[26]!==i?(u=g("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[d,i]}),e[25]=d,e[26]=i,e[27]=u):u=e[27],u};function vt(s){return l("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}const yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Nt="v.string()",Ct=s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),Tt=s=>{const e=we(83),{onApplied:m,tableNames:n}=s,t=ze(),a=st(),[d,o]=S(null),[i,u]=S(!1),[c,r]=S(null),[b,N]=S(""),[h,F]=S(""),[w,ce]=S(Nt),[x,q]=S(n[0]??""),[z,A]=S(""),[_,C]=S(""),[k,P]=S(!1);let Z;e[0]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{o(null),N(""),F(""),A(""),C(""),P(!1)},e[0]=Z):Z=e[0];const me=Z;let I;e[1]!==m?(I=async O=>{u(!0),r(null);try{const B=await bt(O);r(B),B.kind==="ok"&&(m(B.tables),me())}catch(B){const Te=B;r({kind:"error",message:Te instanceof Error?Te.message:String(Te)})}u(!1)},e[1]=m,e[2]=I):I=e[2];const v=I;let ge;e[3]!==v||e[4]!==b?(ge=()=>{ye(v({kind:"addTable",table:b.trim()}))},e[3]=v,e[4]=b,e[5]=ge):ge=e[5];const G=ge;let ue;e[6]!==h||e[7]!==v||e[8]!==x||e[9]!==w?(ue=()=>{ye(v({column:h.trim(),kind:"addOptionalColumn",table:x,validator:w}))},e[6]=h,e[7]=v,e[8]=x,e[9]=w,e[10]=ue):ue=e[10];const ee=ue;let U;e[11]!==_||e[12]!==z||e[13]!==v||e[14]!==x||e[15]!==k?(U=()=>{ye(v({fields:Ct(_),kind:"addIndex",name:z.trim(),table:x,unique:k}))},e[11]=_,e[12]=z,e[13]=v,e[14]=x,e[15]=k,e[16]=U):U=e[16];const Ne=U;let X;e[17]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{r(null),o("addTable")},e[17]=X):X=e[17];const be=X;let Y;e[18]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>{r(null),o("addColumn")},e[18]=Y):Y=e[18];const te=Y;let L;e[19]===Symbol.for("react.memo_cache_sentinel")?(L=()=>{r(null),o("addIndex")},e[19]=L):L=e[19];const le=L;let ae;e[20]!==t?(ae=()=>{o("destructive"),r({kind:"needs-migration",message:t("This edit changes stored data and must go through a migration. Review the migration before applying.")})},e[20]=t,e[21]=ae):ae=e[21];const he=ae;let K;e[22]===Symbol.for("react.memo_cache_sentinel")?(K=O=>{N(O.target.value)},e[22]=K):K=e[22];const ne=K;let M;e[23]===Symbol.for("react.memo_cache_sentinel")?(M=O=>{F(O.target.value)},e[23]=M):M=e[23];const se=M;let re;e[24]===Symbol.for("react.memo_cache_sentinel")?(re=O=>{ce(O.target.value)},e[24]=re):re=e[24];const pe=re;let H;e[25]===Symbol.for("react.memo_cache_sentinel")?(H=O=>{q(O.target.value)},e[25]=H):H=e[25];const J=H;let D;e[26]===Symbol.for("react.memo_cache_sentinel")?(D=O=>{A(O.target.value)},e[26]=D):D=e[26];const oe=D;let R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=O=>{C(O.target.value)},e[27]=R):R=e[27];const ie=R;let V;e[28]===Symbol.for("react.memo_cache_sentinel")?(V=O=>{P(O.target.checked)},e[28]=V):V=e[28];const j=V;let W;e[29]!==a?(W=()=>{ye(a({to:"/migrations"}))},e[29]=a,e[30]=W):W=e[30];const f=W;let Q;e[31]!==t?(Q=t("Edit schema"),e[31]=t,e[32]=Q):Q=e[32];let de;e[33]!==Q?(de=l(Ge,{children:Q}),e[33]=Q,e[34]=de):de=e[34];let fe;e[35]!==t?(fe=t("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=t,e[36]=fe):fe=e[36];let Ce;e[37]!==fe?(Ce=l(Le,{children:fe}),e[37]=fe,e[38]=Ce):Ce=e[38];let xe;e[39]!==de||e[40]!==Ce?(xe=g(Ke,{children:[de,Ce]}),e[39]=de,e[40]=Ce,e[41]=xe):xe=e[41];const p=n.length>0;let y;e[42]!==d||e[43]!==he||e[44]!==p?(y=l(ft,{hasTables:p,mode:d,onAddColumn:te,onAddIndex:le,onAddTable:be,onDestructive:he}),e[42]=d,e[43]=he,e[44]=p,e[45]=y):y=e[45];let T;e[46]!==i||e[47]!==d||e[48]!==G||e[49]!==t||e[50]!==b?(T=d==="addTable"&&g("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-table-name",children:t("Table name")}),l(Ie,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:ne,value:b})]}),l(ve,{"data-testid":"sc-editor-table-apply",disabled:i||b.trim()==="",onClick:G,size:"xs",type:"button",children:t(i?"Applying…":"Apply")}),l(ve,{onClick:me,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[46]=i,e[47]=d,e[48]=G,e[49]=t,e[50]=b,e[51]=T):T=e[51];let E;e[52]!==i||e[53]!==h||e[54]!==d||e[55]!==ee||e[56]!==t||e[57]!==n||e[58]!==x||e[59]!==w?(E=d==="addColumn"&&g("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-column-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:J,value:x,children:n.map(wt)})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-column-name",children:t("Column name")}),l(Ie,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:se,value:h})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-column-type",children:t("Column type")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:pe,value:w,children:yt.map(St)})]}),l("span",{className:"text-[11px] text-muted-foreground",children:t("Optional")}),l(ve,{"data-testid":"sc-editor-column-apply",disabled:i||h.trim()===""||x==="",onClick:ee,size:"xs",type:"button",children:t(i?"Applying…":"Apply")}),l(ve,{onClick:me,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[52]=i,e[53]=h,e[54]=d,e[55]=ee,e[56]=t,e[57]=n,e[58]=x,e[59]=w,e[60]=E):E=e[60];let $;e[61]!==i||e[62]!==_||e[63]!==z||e[64]!==d||e[65]!==Ne||e[66]!==t||e[67]!==n||e[68]!==x||e[69]!==k?($=d==="addIndex"&&g("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-index-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:J,value:x,children:n.map(_t)})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-index-name",children:t("Index name")}),l(Ie,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:oe,value:z})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l($e,{htmlFor:"sc-editor-index-fields",children:t("Index fields (comma-separated)")}),l(Ie,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ie,value:_})]}),g($e,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[l("input",{checked:k,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:j,type:"checkbox"}),l("span",{className:"text-muted-foreground",children:t("Unique")})]}),l(ve,{"data-testid":"sc-editor-index-apply",disabled:i||z.trim()===""||_.trim()==="",onClick:Ne,size:"xs",type:"button",children:t(i?"Applying…":"Apply")}),l(ve,{onClick:me,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[61]=i,e[62]=_,e[63]=z,e[64]=d,e[65]=Ne,e[66]=t,e[67]=n,e[68]=x,e[69]=k,e[70]=$):$=e[70];let Se;e[71]!==f||e[72]!==c?(Se=l(xt,{onOpenMigrations:f,result:c}),e[71]=f,e[72]=c,e[73]=Se):Se=e[73];let _e;e[74]!==y||e[75]!==T||e[76]!==E||e[77]!==$||e[78]!==Se?(_e=g(Me,{children:[y,T,E,$,Se]}),e[74]=y,e[75]=T,e[76]=E,e[77]=$,e[78]=Se,e[79]=_e):_e=e[79];let ke;return e[80]!==xe||e[81]!==_e?(ke=g(De,{"data-testid":"sc-editor",size:"sm",children:[xe,_e]}),e[80]=xe,e[81]=_e,e[82]=ke):ke=e[82],ke};function wt(s){return l("option",{value:s,children:s},s)}function St(s){return l("option",{value:s.validator,children:s.label},s.validator)}function _t(s){return l("option",{value:s,children:s},s)}const Xe=[],$t=s=>{const e=we(5),{open:m}=s,n=m&&"rotate-90";let t;e[0]!==n?(t=We("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=t):t=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=l("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let d;return e[3]!==t?(d=l("svg",{"aria-hidden":"true",className:t,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=t,e[4]=d):d=e[4],d},Ye=s=>{const e=we(20),{children:m,expanded:n,name:t,onToggle:a,rowCount:d,rowTestId:o,toggleTestId:i}=s;let u;e[0]!==n?(u=l($t,{open:n}),e[0]=n,e[1]=u):u=e[1];let c;e[2]!==t?(c=l("span",{className:"truncate font-mono text-xs text-foreground",title:t,children:t}),e[2]=t,e[3]=c):c=e[3];let r;e[4]!==d?(r=g("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",d,")"]}),e[4]=d,e[5]=r):r=e[5];let b;e[6]!==n||e[7]!==a||e[8]!==u||e[9]!==c||e[10]!==r||e[11]!==i?(b=g("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":i,onClick:a,type:"button",children:[u,c," ",r]}),e[6]=n,e[7]=a,e[8]=u,e[9]=c,e[10]=r,e[11]=i,e[12]=b):b=e[12];let N;e[13]!==m||e[14]!==n?(N=n&&l("div",{className:"px-3 pb-3 ps-8",children:m}),e[13]=m,e[14]=n,e[15]=N):N=e[15];let h;return e[16]!==o||e[17]!==b||e[18]!==N?(h=g("li",{className:"border-t border-border/60 first:border-t-0","data-testid":o,children:[b,N]}),e[16]=o,e[17]=b,e[18]=N,e[19]=h):h=e[19],h},He=s=>{const e=we(5),{columns:m,testId:n}=s;let t;e[0]!==m?(t=m.map(It),e[0]=m,e[1]=t):t=e[1];let a;return e[2]!==t||e[3]!==n?(a=l("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:t}),e[2]=t,e[3]=n,e[4]=a):a=e[4],a},kt=s=>{const e=we(10),{heading:m,indexes:n,testId:t}=s;let a;e[0]!==m?(a=l("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:m}),e[0]=m,e[1]=a):a=e[1];let d;e[2]!==n?(d=n.map(At),e[2]=n,e[3]=d):d=e[3];let o;e[4]!==d||e[5]!==t?(o=l("ul",{className:"flex flex-col gap-1","data-testid":t,children:d}),e[4]=d,e[5]=t,e[6]=o):o=e[6];let i;return e[7]!==a||e[8]!==o?(i=g("div",{className:"pt-3",children:[a,o]}),e[7]=a,e[8]=o,e[9]=i):i=e[9],i},Je=s=>We("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),Qt=s=>{const e=we(85),{initialShardKey:m,initialTable:n,schemaEditable:t}=s,a=ze();let d;e[0]!==m||e[1]!==n?(d={initialShardKey:m,initialTable:n},e[0]=m,e[1]=n,e[2]=d):d=e[2];const{columns:o,diagramTables:i,error:u,expanded:c,filteredGlobalTables:r,filteredTables:b,globalColumns:N,globalError:h,globalExpanded:F,globalTables:w,indexes:ce,refresh:x,setShardKey:q,setTableFilter:z,setView:A,shardColumnsError:_,shardKey:C,tableFilter:k,tables:P,toggle:Z,toggleGlobal:me,view:I}=mt(d);let v;e[3]!==A?(v=()=>{A("list")},e[3]=A,e[4]=v):v=e[4];const ge=v;let G;e[5]!==A?(G=()=>{A("graph")},e[5]=A,e[6]=G):G=e[6];const ue=G;let ee;e[7]!==z?(ee=f=>{z(f.target.value)},e[7]=z,e[8]=ee):ee=e[8];const U=ee;let Ne;e[9]!==x||e[10]!==C?(Ne=f=>{ye(x(C))},e[9]=x,e[10]=C,e[11]=Ne):Ne=e[11];const X=Ne;let be;e[12]!==P?(be=P??[],e[12]=P,e[13]=be):be=e[13];let Y;e[14]!==be?(Y=be.map(Et),e[14]=be,e[15]=Y):Y=e[15];const te=Y;let L;e[16]!==q||e[17]!==C?(L=l(Qe,{onChange:q,testId:"sc-shard-input",value:C}),e[16]=q,e[17]=C,e[18]=L):L=e[18];let le;e[19]!==a?(le=a("Schema view"),e[19]=a,e[20]=le):le=e[20];const ae=I==="graph",he=I==="graph";let K;e[21]!==he?(K=Je(he),e[21]=he,e[22]=K):K=e[22];let ne;e[23]!==a?(ne=a("Graph"),e[23]=a,e[24]=ne):ne=e[24];let M;e[25]!==ue||e[26]!==ae||e[27]!==K||e[28]!==ne?(M=l("button",{"aria-selected":ae,className:K,"data-testid":"sc-view-graph",onClick:ue,role:"tab",type:"button",children:ne}),e[25]=ue,e[26]=ae,e[27]=K,e[28]=ne,e[29]=M):M=e[29];const se=I==="list",re=I==="list";let pe;e[30]!==re?(pe=Je(re),e[30]=re,e[31]=pe):pe=e[31];let H;e[32]!==a?(H=a("Table list"),e[32]=a,e[33]=H):H=e[33];let J;e[34]!==ge||e[35]!==se||e[36]!==pe||e[37]!==H?(J=l("button",{"aria-selected":se,className:pe,"data-testid":"sc-view-list",onClick:ge,role:"tab",type:"button",children:H}),e[34]=ge,e[35]=se,e[36]=pe,e[37]=H,e[38]=J):J=e[38];let D;e[39]!==M||e[40]!==J||e[41]!==le?(D=g("div",{"aria-label":le,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[M,J]}),e[39]=M,e[40]=J,e[41]=le,e[42]=D):D=e[42];let oe;e[43]!==D||e[44]!==L?(oe=g("div",{className:"flex flex-wrap items-center gap-3",children:[L,D]}),e[43]=D,e[44]=L,e[45]=oe):oe=e[45];let R;e[46]!==X||e[47]!==t||e[48]!==te?(R=t===!0&&l(Tt,{onApplied:X,tableNames:te}),e[46]=X,e[47]=t,e[48]=te,e[49]=R):R=e[49];let ie;e[50]!==U||e[51]!==a||e[52]!==k||e[53]!==I?(ie=I==="list"&&l(Ie,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:U,placeholder:a("Filter tables"),value:k}),e[50]=U,e[51]=a,e[52]=k,e[53]=I,e[54]=ie):ie=e[54];let V;e[55]!==i||e[56]!==u||e[57]!==h||e[58]!==_||e[59]!==C||e[60]!==I?(V=I==="graph"&&g("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[u!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:u}),h!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:h}),l(nt,{columnsError:_[C]===!0,tables:i,testIdPrefix:"sc-graph"})]}),e[55]=i,e[56]=u,e[57]=h,e[58]=_,e[59]=C,e[60]=I,e[61]=V):V=e[61];let j;e[62]!==o||e[63]!==u||e[64]!==c||e[65]!==r||e[66]!==b||e[67]!==N||e[68]!==h||e[69]!==F||e[70]!==w||e[71]!==ce||e[72]!==C||e[73]!==a||e[74]!==P||e[75]!==Z||e[76]!==me||e[77]!==I?(j=I==="list"&&g("div",{className:"flex flex-col gap-4",children:[g(De,{"data-testid":"sc-shard-section",size:"sm",children:[g(Ke,{children:[g("div",{className:"flex items-center gap-2",children:[l(Ve,{tier:"shard"}),l(Ge,{children:a("Shard tables")}),P!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:b.length})]}),l(Le,{children:qe.shard.hint})]}),g(Me,{children:[u!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:u}),P!==null&&P.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),P!==null&&P.length>0&&b.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),b.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:b.map(f=>{const Q=`${C}:${f.name}`,de=ce[Q]??[];return g(Ye,{expanded:c===f.name,name:f.name,onToggle:()=>{ye(Z(f.name))},rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[l(He,{columns:o[Q]??Xe,testId:`sc-columns-${f.name}`}),de.length>0&&l(kt,{heading:a("Indexes"),indexes:de,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),g(De,{"data-testid":"sc-global-section",size:"sm",children:[g(Ke,{children:[g("div",{className:"flex items-center gap-2",children:[l(Ve,{tier:"global"}),l(Ge,{children:a("Global tables (D1)")}),w!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:r.length})]}),l(Le,{children:qe.global.hint})]}),g(Me,{children:[h!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:h}),w!==null&&w.length===0&&l(Ze,{description:qe.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),w!==null&&w.length>0&&r.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),r.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:r.map(f=>l(Ye,{expanded:F===f.name,name:f.name,onToggle:()=>{ye(me(f.name))},rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:l(He,{columns:N[f.name]??Xe,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=o,e[63]=u,e[64]=c,e[65]=r,e[66]=b,e[67]=N,e[68]=h,e[69]=F,e[70]=w,e[71]=ce,e[72]=C,e[73]=a,e[74]=P,e[75]=Z,e[76]=me,e[77]=I,e[78]=j):j=e[78];let W;return e[79]!==oe||e[80]!==R||e[81]!==ie||e[82]!==V||e[83]!==j?(W=g("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[oe,R,ie,V,j]}),e[79]=oe,e[80]=R,e[81]=ie,e[82]=V,e[83]=j,e[84]=W):W=e[84],W};function It(s){return l("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}function At(s){return g("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[l("span",{className:"font-mono",children:s.name}),l(Fe,{variant:"outline",children:s.type}),s.unique===!0&&l(Fe,{variant:"secondary",children:"unique"}),l("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}function Et(s){return s.name}export{Qt as SchemaViewer};
|
|
1
|
+
import{c as Ce}from"react/compiler-runtime";import{ShardInput as Ze}from"../packem_shared/ShardInput-BVn2iCU0.js";import{g as Re,d as Oe}from"../packem_shared/storage-tier-DznqOf-q.js";import{g as Fe}from"../packem_shared/badge-BbuuAio7.js";import{f as Ke,m as Ge,n as Le,u as Me,c as De}from"../packem_shared/card-CIDGUN6K.js";import{E as He}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as Ie}from"../packem_shared/input-JHu63lTv.js";import{useT as je}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{d as Ae,b as Ee,f as fe,g as qe}from"../packem_shared/internal-BSIsQVC6.js";import{c as We}from"../packem_shared/utils-bhneXptQ.js";import{useLunora as Qe}from"@lunora/react";import{useState as $,useEffect as Pe,useRef as et}from"react";import{S as tt}from"../packem_shared/use-shard-key-B2JtNa5m.js";import{ADMIN_FUNCTIONS as ze}from"../packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js";import{r as lt}from"../packem_shared/shard-history-DMEW5VBE.js";import{S as at}from"../packem_shared/schema-diagram-cg-bz_VL.js";import{useNavigate as nt}from"@tanstack/react-router";import{u as be}from"../packem_shared/button-BkCrNcAs.js";import{p as _e}from"../packem_shared/label-6uP1obNF.js";import{jsx as l,jsxs as g,Fragment as Ve}from"react/jsx-runtime";const st=qe(ze.listTables),rt=qe(ze.listTableIndexes),ot=qe(ze.readTablePage),it=qe(ze.describeTables),dt={},Be=[],ct=s=>{const e=Ce(74),{initialShardKey:m,initialTable:n}=s,t=Qe(),[a,c]=$("graph"),{queryShardKey:d,setShardKey:i,shardKey:f}=tt(m),[r,h]=$(""),[o,x]=$(null),[p,P]=$(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];const[L,v]=$(S);let K;e[1]===Symbol.for("react.memo_cache_sentinel")?(K={},e[1]=K):K=e[1];const[F,M]=$(K),[w,N]=$(null);let A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A={},e[2]=A):A=e[2];const[j,me]=$(A);let Z;e[3]===Symbol.for("react.memo_cache_sentinel")?(Z={},e[3]=Z):Z=e[3];const[k,G]=$(Z),[_,ue]=$(null),[D,oe]=$(null);let H;e[4]===Symbol.for("react.memo_cache_sentinel")?(H={},e[4]=H):H=e[4];const[X,xe]=$(H),[Y,ie]=$(null);let ve;e[5]!==t?(ve=async u=>{P(null);try{const C=await t.query(st,{},Ae(u));lt(u),x(C),v({}),M({}),N(null),me(y=>Object.fromEntries(Object.entries(y).filter(O=>{const[I]=O;return I!==u}))),G(y=>Object.fromEntries(Object.entries(y).filter(O=>{const[I]=O;return I!==u})))}catch(C){const y=C;x(null),P(Ee(y))}},e[5]=t,e[6]=ve):ve=e[6];const q=ve;let Q;e[7]!==t?(Q=async()=>{oe(null);try{ue(await t.listGlobalTables())}catch(u){const C=u;ue(null),oe(Ee(C))}},e[7]=t,e[8]=Q):Q=e[8];const ee=Q;let de,R;e[9]!==d||e[10]!==q||e[11]!==ee?(de=()=>{fe(q(d)),fe(ee())},R=[q,ee,d],e[9]=d,e[10]=q,e[11]=ee,e[12]=de,e[13]=R):(de=e[12],R=e[13]),Pe(de,R);let te;e[14]!==t||e[15]!==L||e[16]!==w||e[17]!==d?(te=async u=>{if(w===u){N(null);return}N(u);const C=`${d}:${u}`;if(L[C]!==void 0)return;const[y,O]=await Promise.allSettled([t.query(ot,{limit:1,offset:0,table:u},Ae(d)),t.query(rt,{table:u},Ae(d))]);y.status==="fulfilled"?v(I=>({...I,[C]:y.value.columns})):P(Ee(y.reason)),O.status==="fulfilled"&&M(I=>({...I,[C]:O.value.indexes}))},e[14]=t,e[15]=L,e[16]=w,e[17]=d,e[18]=te):te=e[18];const z=te;let ye;e[19]!==t||e[20]!==X||e[21]!==Y?(ye=async u=>{if(Y===u){ie(null);return}if(ie(u),X[u]===void 0)try{const C=await t.readGlobalTablePage({limit:1,offset:0,table:u});xe(y=>({...y,[u]:C.columns}))}catch(C){oe(Ee(C))}},e[19]=t,e[20]=X,e[21]=Y,e[22]=ye):ye=e[22];const ce=ye,he=et(void 0);let V,J;e[23]!==n||e[24]!==o||e[25]!==z?(V=()=>{n===void 0||o===null||he.current===n||o.some(u=>u.name===n)&&(he.current=n,fe(z(n)))},J=[n,o,z],e[23]=n,e[24]=o,e[25]=z,e[26]=V,e[27]=J):(V=e[26],J=e[27]),Pe(V,J);let B;e[28]!==t?(B=async(u,C,y)=>{const[O,I]=await Promise.all([Promise.allSettled([t.query(it,{tables:[...C,...y]},Ae(u))]),Promise.all(y.map(async T=>{const ge=await Promise.allSettled([t.readGlobalTablePage({limit:1,offset:0,table:T})]),ke=ge[0].status==="fulfilled"?ge[0].value:void 0;return{columns:ke?.columns??[],refs:ke?.refs??{},table:T}}))]),Te=O[0].status==="fulfilled"?O[0].value?.columnsByTable??{}:{},we=O[0].status==="rejected",Se=new Map(I.map(mt)),$e=[...C,...y].map(T=>{const ge=Te[T]??[];return[T,ge.length>0?ge:Se.get(T)??[]]});me(T=>({...T,[u]:Object.fromEntries($e)})),G(T=>({...T,[u]:we}))},e[28]=t,e[29]=B):B=e[29];const le=B;let U,ae;e[30]!==D||e[31]!==_||e[32]!==le||e[33]!==d||e[34]!==j||e[35]!==o||e[36]!==a?(U=()=>{a!=="graph"||o===null||_===null&&D===null||j[d]!==void 0||fe(le(d,o.map(ut),(_??[]).map(ht)))},ae=[a,o,_,D,d,j,le],e[30]=D,e[31]=_,e[32]=le,e[33]=d,e[34]=j,e[35]=o,e[36]=a,e[37]=U,e[38]=ae):(U=e[37],ae=e[38]),Pe(U,ae);const E=j[d]??dt;let ne;if(e[39]!==E||e[40]!==_||e[41]!==o){let u;e[43]!==E?(u=I=>({columns:E[I.name]??Be,name:I.name,tier:"shard"}),e[43]=E,e[44]=u):u=e[44];const C=(o??[]).map(u);let y;e[45]!==E?(y=I=>({columns:E[I.name]??Be,name:I.name,tier:"global"}),e[45]=E,e[46]=y):y=e[46];const O=(_??[]).map(y);ne=[...C,...O],e[39]=E,e[40]=_,e[41]=o,e[42]=ne}else ne=e[42];const se=ne;let b;if(e[47]!==r||e[48]!==o){const u=r.trim().toLowerCase();b=(o??[]).filter(C=>C.name.toLowerCase().includes(u)),e[47]=r,e[48]=o,e[49]=b}else b=e[49];const re=b;let W;if(e[50]!==_||e[51]!==r){const u=r.trim().toLowerCase();W=(_??[]).filter(C=>C.name.toLowerCase().includes(u)),e[50]=_,e[51]=r,e[52]=W}else W=e[52];const Ne=W;let pe;return e[53]!==L||e[54]!==se||e[55]!==p||e[56]!==w||e[57]!==Ne||e[58]!==re||e[59]!==X||e[60]!==D||e[61]!==Y||e[62]!==_||e[63]!==F||e[64]!==q||e[65]!==i||e[66]!==k||e[67]!==f||e[68]!==r||e[69]!==o||e[70]!==z||e[71]!==ce||e[72]!==a?(pe={columns:L,diagramTables:se,error:p,expanded:w,filteredGlobalTables:Ne,filteredTables:re,globalColumns:X,globalError:D,globalExpanded:Y,globalTables:_,indexes:F,refresh:q,setShardKey:i,setTableFilter:h,setView:c,shardColumnsError:k,shardKey:f,tableFilter:r,tables:o,toggle:z,toggleGlobal:ce,view:a},e[53]=L,e[54]=se,e[55]=p,e[56]=w,e[57]=Ne,e[58]=re,e[59]=X,e[60]=D,e[61]=Y,e[62]=_,e[63]=F,e[64]=q,e[65]=i,e[66]=k,e[67]=f,e[68]=r,e[69]=o,e[70]=z,e[71]=ce,e[72]=a,e[73]=pe):pe=e[73],pe};function mt(s){const{columns:e,refs:m,table:n}=s;return[n,e.map(t=>{const a=m[t];return a===void 0?{name:t,optional:!1,type:""}:{name:t,optional:!1,ref:a,type:"id"}})]}function ut(s){return s.name}function ht(s){return s.name}const pt="/__lunora/schema-edit",gt=async s=>{const e=await fetch(pt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),m=await e.json();return m.needsMigration===!0?{kind:"needs-migration",message:m.message??"This edit needs a migration."}:e.ok&&m.tables!==void 0?{diagnostics:m.diagnostics??[],kind:"ok",tables:m.tables}:{kind:"error",message:m.error??`schema edit failed (${String(e.status)})`}},bt=s=>{const e=Ce(32),{hasTables:m,mode:n,onAddColumn:t,onAddIndex:a,onAddTable:c,onDestructive:d}=s,i=je(),f=n==="addTable"?"default":"outline";let r;e[0]!==i?(r=i("Add table"),e[0]=i,e[1]=r):r=e[1];let h;e[2]!==c||e[3]!==f||e[4]!==r?(h=l(be,{"data-testid":"sc-editor-add-table",onClick:c,size:"xs",type:"button",variant:f,children:r}),e[2]=c,e[3]=f,e[4]=r,e[5]=h):h=e[5];const o=!m,x=n==="addColumn"?"default":"outline";let p;e[6]!==i?(p=i("Add column"),e[6]=i,e[7]=p):p=e[7];let P;e[8]!==t||e[9]!==o||e[10]!==x||e[11]!==p?(P=l(be,{"data-testid":"sc-editor-add-column",disabled:o,onClick:t,size:"xs",type:"button",variant:x,children:p}),e[8]=t,e[9]=o,e[10]=x,e[11]=p,e[12]=P):P=e[12];const S=!m,L=n==="addIndex"?"default":"outline";let v;e[13]!==i?(v=i("Add index"),e[13]=i,e[14]=v):v=e[14];let K;e[15]!==a||e[16]!==v||e[17]!==S||e[18]!==L?(K=l(be,{"data-testid":"sc-editor-add-index",disabled:S,onClick:a,size:"xs",type:"button",variant:L,children:v}),e[15]=a,e[16]=v,e[17]=S,e[18]=L,e[19]=K):K=e[19];const F=!m,M=n==="destructive"?"default":"ghost";let w;e[20]!==i?(w=i("Rename / drop / change type…"),e[20]=i,e[21]=w):w=e[21];let N;e[22]!==d||e[23]!==F||e[24]!==M||e[25]!==w?(N=l(be,{"data-testid":"sc-editor-destructive",disabled:F,onClick:d,size:"xs",type:"button",variant:M,children:w}),e[22]=d,e[23]=F,e[24]=M,e[25]=w,e[26]=N):N=e[26];let A;return e[27]!==K||e[28]!==N||e[29]!==h||e[30]!==P?(A=g("div",{className:"flex flex-wrap gap-2",children:[h,P,K,N]}),e[27]=K,e[28]=N,e[29]=h,e[30]=P,e[31]=A):A=e[31],A},ft=s=>{const e=Ce(28),{onOpenMigrations:m,result:n}=s,t=je();if(n===null){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=l(Ve,{}),e[0]=r):r=e[0],r}if(n.kind==="error"){let r;return e[1]!==n.message?(r=l("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=r):r=e[2],r}if(n.kind==="needs-migration"){let r;e[3]!==n.message||e[4]!==t?(r=n.message===""?t("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=t,e[5]=r):r=e[5];let h;e[6]!==r?(h=l("p",{className:"text-sm text-warning",role:"alert",children:r}),e[6]=r,e[7]=h):h=e[7];let o;e[8]!==t?(o=t("Open Migrations"),e[8]=t,e[9]=o):o=e[9];let x;e[10]!==m||e[11]!==o?(x=l(be,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:m,size:"xs",type:"button",variant:"outline",children:o}),e[10]=m,e[11]=o,e[12]=x):x=e[12];let p;return e[13]!==h||e[14]!==x?(p=g("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[h,x]}),e[13]=h,e[14]=x,e[15]=p):p=e[15],p}if(n.diagnostics.length===0){let r;return e[16]===Symbol.for("react.memo_cache_sentinel")?(r=l(Ve,{}),e[16]=r):r=e[16],r}let a;e[17]!==t?(a=t("Codegen reported diagnostics:"),e[17]=t,e[18]=a):a=e[18];let c;e[19]!==a?(c=l("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=c):c=e[20];let d;e[21]!==n.diagnostics?(d=n.diagnostics.map(xt),e[21]=n.diagnostics,e[22]=d):d=e[22];let i;e[23]!==d?(i=l("ul",{className:"flex flex-col gap-0.5",children:d}),e[23]=d,e[24]=i):i=e[24];let f;return e[25]!==c||e[26]!==i?(f=g("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[c,i]}),e[25]=c,e[26]=i,e[27]=f):f=e[27],f};function xt(s){return l("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}const vt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],yt="v.string()",Nt=s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),Ct=s=>{const e=Ce(83),{onApplied:m,tableNames:n}=s,t=je(),a=nt(),[c,d]=$(null),[i,f]=$(!1),[r,h]=$(null),[o,x]=$(""),[p,P]=$(""),[S,L]=$(yt),[v,K]=$(n[0]??""),[F,M]=$(""),[w,N]=$(""),[A,j]=$(!1);let me;e[0]===Symbol.for("react.memo_cache_sentinel")?(me=()=>{d(null),x(""),P(""),M(""),N(""),j(!1)},e[0]=me):me=e[0];const Z=me;let k;e[1]!==m?(k=async T=>{f(!0),h(null);try{const ge=await gt(T);h(ge),ge.kind==="ok"&&(m(ge.tables),Z())}catch(ge){const ke=ge;h({kind:"error",message:ke instanceof Error?ke.message:String(ke)})}f(!1)},e[1]=m,e[2]=k):k=e[2];const G=k;let _;e[3]!==G||e[4]!==o?(_=()=>{fe(G({kind:"addTable",table:o.trim()}))},e[3]=G,e[4]=o,e[5]=_):_=e[5];const ue=_;let D;e[6]!==p||e[7]!==G||e[8]!==v||e[9]!==S?(D=()=>{fe(G({column:p.trim(),kind:"addOptionalColumn",table:v,validator:S}))},e[6]=p,e[7]=G,e[8]=v,e[9]=S,e[10]=D):D=e[10];const oe=D;let H;e[11]!==w||e[12]!==F||e[13]!==G||e[14]!==v||e[15]!==A?(H=()=>{fe(G({fields:Nt(w),kind:"addIndex",name:F.trim(),table:v,unique:A}))},e[11]=w,e[12]=F,e[13]=G,e[14]=v,e[15]=A,e[16]=H):H=e[16];const X=H;let xe;e[17]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>{h(null),d("addTable")},e[17]=xe):xe=e[17];const Y=xe;let ie;e[18]===Symbol.for("react.memo_cache_sentinel")?(ie=()=>{h(null),d("addColumn")},e[18]=ie):ie=e[18];const ve=ie;let q;e[19]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{h(null),d("addIndex")},e[19]=q):q=e[19];const Q=q;let ee;e[20]!==t?(ee=()=>{d("destructive"),h({kind:"needs-migration",message:t("This edit changes stored data and must go through a migration. Review the migration before applying.")})},e[20]=t,e[21]=ee):ee=e[21];const de=ee;let R;e[22]===Symbol.for("react.memo_cache_sentinel")?(R=T=>{x(T.target.value)},e[22]=R):R=e[22];const te=R;let z;e[23]===Symbol.for("react.memo_cache_sentinel")?(z=T=>{P(T.target.value)},e[23]=z):z=e[23];const ye=z;let ce;e[24]===Symbol.for("react.memo_cache_sentinel")?(ce=T=>{L(T.target.value)},e[24]=ce):ce=e[24];const he=ce;let V;e[25]===Symbol.for("react.memo_cache_sentinel")?(V=T=>{K(T.target.value)},e[25]=V):V=e[25];const J=V;let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=T=>{M(T.target.value)},e[26]=B):B=e[26];const le=B;let U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=T=>{N(T.target.value)},e[27]=U):U=e[27];const ae=U;let E;e[28]===Symbol.for("react.memo_cache_sentinel")?(E=T=>{j(T.target.checked)},e[28]=E):E=e[28];const ne=E;let se;e[29]!==a?(se=()=>{fe(a({to:"/migrations"}))},e[29]=a,e[30]=se):se=e[30];const b=se;let re;e[31]!==t?(re=t("Edit schema"),e[31]=t,e[32]=re):re=e[32];let W;e[33]!==re?(W=l(Ke,{children:re}),e[33]=re,e[34]=W):W=e[34];let Ne;e[35]!==t?(Ne=t("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=t,e[36]=Ne):Ne=e[36];let pe;e[37]!==Ne?(pe=l(Ge,{children:Ne}),e[37]=Ne,e[38]=pe):pe=e[38];let u;e[39]!==W||e[40]!==pe?(u=g(Le,{children:[W,pe]}),e[39]=W,e[40]=pe,e[41]=u):u=e[41];const C=n.length>0;let y;e[42]!==c||e[43]!==de||e[44]!==C?(y=l(bt,{hasTables:C,mode:c,onAddColumn:ve,onAddIndex:Q,onAddTable:Y,onDestructive:de}),e[42]=c,e[43]=de,e[44]=C,e[45]=y):y=e[45];let O;e[46]!==i||e[47]!==c||e[48]!==ue||e[49]!==t||e[50]!==o?(O=c==="addTable"&&g("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-table-name",children:t("Table name")}),l(Ie,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:te,value:o})]}),l(be,{"data-testid":"sc-editor-table-apply",disabled:i||o.trim()==="",onClick:ue,size:"xs",type:"button",children:t(i?"Applying…":"Apply")}),l(be,{onClick:Z,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[46]=i,e[47]=c,e[48]=ue,e[49]=t,e[50]=o,e[51]=O):O=e[51];let I;e[52]!==i||e[53]!==p||e[54]!==c||e[55]!==oe||e[56]!==t||e[57]!==n||e[58]!==v||e[59]!==S?(I=c==="addColumn"&&g("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-column-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:J,value:v,children:n.map(Tt)})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-column-name",children:t("Column name")}),l(Ie,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ye,value:p})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-column-type",children:t("Column type")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:he,value:S,children:vt.map(wt)})]}),l("span",{className:"text-[11px] text-muted-foreground",children:t("Optional")}),l(be,{"data-testid":"sc-editor-column-apply",disabled:i||p.trim()===""||v==="",onClick:oe,size:"xs",type:"button",children:t(i?"Applying…":"Apply")}),l(be,{onClick:Z,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[52]=i,e[53]=p,e[54]=c,e[55]=oe,e[56]=t,e[57]=n,e[58]=v,e[59]=S,e[60]=I):I=e[60];let Te;e[61]!==i||e[62]!==w||e[63]!==F||e[64]!==c||e[65]!==X||e[66]!==t||e[67]!==n||e[68]!==v||e[69]!==A?(Te=c==="addIndex"&&g("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-index-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:J,value:v,children:n.map(St)})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-index-name",children:t("Index name")}),l(Ie,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:le,value:F})]}),g("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-index-fields",children:t("Index fields (comma-separated)")}),l(Ie,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ae,value:w})]}),g(_e,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[l("input",{checked:A,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:ne,type:"checkbox"}),l("span",{className:"text-muted-foreground",children:t("Unique")})]}),l(be,{"data-testid":"sc-editor-index-apply",disabled:i||F.trim()===""||w.trim()==="",onClick:X,size:"xs",type:"button",children:t(i?"Applying…":"Apply")}),l(be,{onClick:Z,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[61]=i,e[62]=w,e[63]=F,e[64]=c,e[65]=X,e[66]=t,e[67]=n,e[68]=v,e[69]=A,e[70]=Te):Te=e[70];let we;e[71]!==b||e[72]!==r?(we=l(ft,{onOpenMigrations:b,result:r}),e[71]=b,e[72]=r,e[73]=we):we=e[73];let Se;e[74]!==y||e[75]!==O||e[76]!==I||e[77]!==Te||e[78]!==we?(Se=g(Me,{children:[y,O,I,Te,we]}),e[74]=y,e[75]=O,e[76]=I,e[77]=Te,e[78]=we,e[79]=Se):Se=e[79];let $e;return e[80]!==u||e[81]!==Se?($e=g(De,{"data-testid":"sc-editor",size:"sm",children:[u,Se]}),e[80]=u,e[81]=Se,e[82]=$e):$e=e[82],$e};function Tt(s){return l("option",{value:s,children:s},s)}function wt(s){return l("option",{value:s.validator,children:s.label},s.validator)}function St(s){return l("option",{value:s,children:s},s)}const Ue=[],_t=s=>{const e=Ce(5),{open:m}=s,n=m&&"rotate-90";let t;e[0]!==n?(t=We("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=t):t=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=l("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let c;return e[3]!==t?(c=l("svg",{"aria-hidden":"true",className:t,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=t,e[4]=c):c=e[4],c},Xe=s=>{const e=Ce(20),{children:m,expanded:n,name:t,onToggle:a,rowCount:c,rowTestId:d,toggleTestId:i}=s;let f;e[0]!==n?(f=l(_t,{open:n}),e[0]=n,e[1]=f):f=e[1];let r;e[2]!==t?(r=l("span",{className:"truncate font-mono text-xs text-foreground",title:t,children:t}),e[2]=t,e[3]=r):r=e[3];let h;e[4]!==c?(h=g("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",c,")"]}),e[4]=c,e[5]=h):h=e[5];let o;e[6]!==n||e[7]!==a||e[8]!==f||e[9]!==r||e[10]!==h||e[11]!==i?(o=g("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":i,onClick:a,type:"button",children:[f,r," ",h]}),e[6]=n,e[7]=a,e[8]=f,e[9]=r,e[10]=h,e[11]=i,e[12]=o):o=e[12];let x;e[13]!==m||e[14]!==n?(x=n&&l("div",{className:"px-3 pb-3 ps-8",children:m}),e[13]=m,e[14]=n,e[15]=x):x=e[15];let p;return e[16]!==d||e[17]!==o||e[18]!==x?(p=g("li",{className:"border-t border-border/60 first:border-t-0","data-testid":d,children:[o,x]}),e[16]=d,e[17]=o,e[18]=x,e[19]=p):p=e[19],p},Ye=s=>{const e=Ce(5),{columns:m,testId:n}=s;let t;e[0]!==m?(t=m.map(kt),e[0]=m,e[1]=t):t=e[1];let a;return e[2]!==t||e[3]!==n?(a=l("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:t}),e[2]=t,e[3]=n,e[4]=a):a=e[4],a},$t=s=>{const e=Ce(10),{heading:m,indexes:n,testId:t}=s;let a;e[0]!==m?(a=l("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:m}),e[0]=m,e[1]=a):a=e[1];let c;e[2]!==n?(c=n.map(It),e[2]=n,e[3]=c):c=e[3];let d;e[4]!==c||e[5]!==t?(d=l("ul",{className:"flex flex-col gap-1","data-testid":t,children:c}),e[4]=c,e[5]=t,e[6]=d):d=e[6];let i;return e[7]!==a||e[8]!==d?(i=g("div",{className:"pt-3",children:[a,d]}),e[7]=a,e[8]=d,e[9]=i):i=e[9],i},Je=s=>We("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),Zt=s=>{const e=Ce(85),{initialShardKey:m,initialTable:n,schemaEditable:t}=s,a=je();let c;e[0]!==m||e[1]!==n?(c={initialShardKey:m,initialTable:n},e[0]=m,e[1]=n,e[2]=c):c=e[2];const{columns:d,diagramTables:i,error:f,expanded:r,filteredGlobalTables:h,filteredTables:o,globalColumns:x,globalError:p,globalExpanded:P,globalTables:S,indexes:L,refresh:v,setShardKey:K,setTableFilter:F,setView:M,shardColumnsError:w,shardKey:N,tableFilter:A,tables:j,toggle:me,toggleGlobal:Z,view:k}=ct(c);let G;e[3]!==M?(G=()=>{M("list")},e[3]=M,e[4]=G):G=e[4];const _=G;let ue;e[5]!==M?(ue=()=>{M("graph")},e[5]=M,e[6]=ue):ue=e[6];const D=ue;let oe;e[7]!==F?(oe=b=>{F(b.target.value)},e[7]=F,e[8]=oe):oe=e[8];const H=oe;let X;e[9]!==v||e[10]!==N?(X=b=>{fe(v(N))},e[9]=v,e[10]=N,e[11]=X):X=e[11];const xe=X;let Y;e[12]!==j?(Y=j??[],e[12]=j,e[13]=Y):Y=e[13];let ie;e[14]!==Y?(ie=Y.map(At),e[14]=Y,e[15]=ie):ie=e[15];const ve=ie;let q;e[16]!==K||e[17]!==N?(q=l(Ze,{onChange:K,testId:"sc-shard-input",value:N}),e[16]=K,e[17]=N,e[18]=q):q=e[18];let Q;e[19]!==a?(Q=a("Schema view"),e[19]=a,e[20]=Q):Q=e[20];const ee=k==="graph",de=k==="graph";let R;e[21]!==de?(R=Je(de),e[21]=de,e[22]=R):R=e[22];let te;e[23]!==a?(te=a("Graph"),e[23]=a,e[24]=te):te=e[24];let z;e[25]!==D||e[26]!==ee||e[27]!==R||e[28]!==te?(z=l("button",{"aria-selected":ee,className:R,"data-testid":"sc-view-graph",onClick:D,role:"tab",type:"button",children:te}),e[25]=D,e[26]=ee,e[27]=R,e[28]=te,e[29]=z):z=e[29];const ye=k==="list",ce=k==="list";let he;e[30]!==ce?(he=Je(ce),e[30]=ce,e[31]=he):he=e[31];let V;e[32]!==a?(V=a("Table list"),e[32]=a,e[33]=V):V=e[33];let J;e[34]!==_||e[35]!==ye||e[36]!==he||e[37]!==V?(J=l("button",{"aria-selected":ye,className:he,"data-testid":"sc-view-list",onClick:_,role:"tab",type:"button",children:V}),e[34]=_,e[35]=ye,e[36]=he,e[37]=V,e[38]=J):J=e[38];let B;e[39]!==z||e[40]!==J||e[41]!==Q?(B=g("div",{"aria-label":Q,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[z,J]}),e[39]=z,e[40]=J,e[41]=Q,e[42]=B):B=e[42];let le;e[43]!==B||e[44]!==q?(le=g("div",{className:"flex flex-wrap items-center gap-3",children:[q,B]}),e[43]=B,e[44]=q,e[45]=le):le=e[45];let U;e[46]!==xe||e[47]!==t||e[48]!==ve?(U=t===!0&&l(Ct,{onApplied:xe,tableNames:ve}),e[46]=xe,e[47]=t,e[48]=ve,e[49]=U):U=e[49];let ae;e[50]!==H||e[51]!==a||e[52]!==A||e[53]!==k?(ae=k==="list"&&l(Ie,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:H,placeholder:a("Filter tables"),value:A}),e[50]=H,e[51]=a,e[52]=A,e[53]=k,e[54]=ae):ae=e[54];let E;e[55]!==i||e[56]!==f||e[57]!==p||e[58]!==w||e[59]!==N||e[60]!==k?(E=k==="graph"&&g("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[f!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:f}),p!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),l(at,{columnsError:w[N]===!0,tables:i,testIdPrefix:"sc-graph"})]}),e[55]=i,e[56]=f,e[57]=p,e[58]=w,e[59]=N,e[60]=k,e[61]=E):E=e[61];let ne;e[62]!==d||e[63]!==f||e[64]!==r||e[65]!==h||e[66]!==o||e[67]!==x||e[68]!==p||e[69]!==P||e[70]!==S||e[71]!==L||e[72]!==N||e[73]!==a||e[74]!==j||e[75]!==me||e[76]!==Z||e[77]!==k?(ne=k==="list"&&g("div",{className:"flex flex-col gap-4",children:[g(De,{"data-testid":"sc-shard-section",size:"sm",children:[g(Le,{children:[g("div",{className:"flex items-center gap-2",children:[l(Re,{tier:"shard"}),l(Ke,{children:a("Shard tables")}),j!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:o.length})]}),l(Ge,{children:Oe.shard.hint})]}),g(Me,{children:[f!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:f}),j!==null&&j.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),j!==null&&j.length>0&&o.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),o.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:o.map(b=>{const re=`${N}:${b.name}`,W=L[re]??[];return g(Xe,{expanded:r===b.name,name:b.name,onToggle:()=>{fe(me(b.name))},rowCount:b.rowCount,rowTestId:`sc-table-${b.name}`,toggleTestId:`sc-toggle-${b.name}`,children:[l(Ye,{columns:d[re]??Ue,testId:`sc-columns-${b.name}`}),W.length>0&&l($t,{heading:a("Indexes"),indexes:W,testId:`sc-indexes-${b.name}`})]},b.name)})})]})]}),g(De,{"data-testid":"sc-global-section",size:"sm",children:[g(Le,{children:[g("div",{className:"flex items-center gap-2",children:[l(Re,{tier:"global"}),l(Ke,{children:a("Global tables (D1)")}),S!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:h.length})]}),l(Ge,{children:Oe.global.hint})]}),g(Me,{children:[p!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:p}),S!==null&&S.length===0&&l(He,{description:Oe.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),S!==null&&S.length>0&&h.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),h.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:h.map(b=>l(Xe,{expanded:P===b.name,name:b.name,onToggle:()=>{fe(Z(b.name))},rowCount:b.rowCount,rowTestId:`sc-global-table-${b.name}`,toggleTestId:`sc-global-toggle-${b.name}`,children:l(Ye,{columns:x[b.name]??Ue,testId:`sc-global-columns-${b.name}`})},b.name))})]})]})]}),e[62]=d,e[63]=f,e[64]=r,e[65]=h,e[66]=o,e[67]=x,e[68]=p,e[69]=P,e[70]=S,e[71]=L,e[72]=N,e[73]=a,e[74]=j,e[75]=me,e[76]=Z,e[77]=k,e[78]=ne):ne=e[78];let se;return e[79]!==le||e[80]!==U||e[81]!==ae||e[82]!==E||e[83]!==ne?(se=g("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[le,U,ae,E,ne]}),e[79]=le,e[80]=U,e[81]=ae,e[82]=E,e[83]=ne,e[84]=se):se=e[84],se};function kt(s){return l("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}function It(s){return g("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[l("span",{className:"font-mono",children:s.name}),l(Fe,{variant:"outline",children:s.type}),s.unique===!0&&l(Fe,{variant:"secondary",children:"unique"}),l("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}function At(s){return s.name}export{Zt as SchemaViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"react/compiler-runtime";import{N as m}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as h}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as f}from"../packem_shared/ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as u}from"react/compiler-runtime";import{N as m}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as h}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as f}from"../packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js";import{A as g}from"../packem_shared/advisor-view-Pa8HLtBv.js";import{jsx as p}from"react/jsx-runtime";const R=(e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[s.kind],k=e=>Array.isArray(e.findings)?e.findings:[],S=e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],A=(e,s)=>({"admin-token-weak":e("Your admin token is {length} characters — use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters — use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed — browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[s.kind],N=()=>{const e=u(8),s=h();let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={},e[0]=t):t=e[0];const{data:i,error:n,errorSource:d}=m(f.getSecurityAudit,t);let a;if(e[1]!==i||e[2]!==s){const l=i===void 0?null:k(i);a=l===null?null:l.map(r=>({description:A(s,r),entity:S(r),issueType:R(s,r),key:r.kind,level:r.level})),e[1]=i,e[2]=s,e[3]=a}else a=e[3];const c=a;let o;return e[4]!==n||e[5]!==d||e[6]!==c?(o=p(g,{error:n,errorSource:d,rows:c,testId:"lunora-security-advisor"}),e[4]=n,e[5]=d,e[6]=c,e[7]=o):o=e[7],o};export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as O}from"react/compiler-runtime";import{E as A}from"../packem_shared/error-alert-t6cpEi0z.js";import{g as K}from"../packem_shared/badge-BbuuAio7.js";import{c as D,u as I}from"../packem_shared/card-CIDGUN6K.js";import{n as j,d as F,m as L,p as T,f as V,u as U}from"../packem_shared/table-DdJBrClo.js";import{N as W}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as q}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as z}from"../packem_shared/ADMIN_FUNCTIONS-
|
|
1
|
+
import{c as O}from"react/compiler-runtime";import{E as A}from"../packem_shared/error-alert-t6cpEi0z.js";import{g as K}from"../packem_shared/badge-BbuuAio7.js";import{c as D,u as I}from"../packem_shared/card-CIDGUN6K.js";import{n as j,d as F,m as L,p as T,f as V,u as U}from"../packem_shared/table-DdJBrClo.js";import{N as W}from"../packem_shared/use-admin-query-QJ-ibl5u.js";import{useT as q}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as z}from"../packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js";import{C as M}from"../packem_shared/cf-links-Dmg86v1D.js";import{jsx as t,jsxs as m}from"react/jsx-runtime";const P={binding:"outline",secret:"destructive",var:"secondary"},B=(r,e)=>{if(r===void 0)return[];const c=[];return r.workerUrl!==void 0&&c.push({label:e("URL"),value:r.workerUrl}),r.environment!==void 0&&c.push({label:e("Environment"),value:r.environment}),r.deploymentId!==void 0&&c.push({label:e("Deployment"),value:r.deploymentId}),r.versionTag!==void 0&&c.push({label:e("Version"),value:r.versionTag}),c},le=r=>{const e=O(52),{initialShardKey:c}=r,n=q();let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];const _=c??"";let $;e[1]!==_?($={shardKey:_},e[1]=_,e[2]=$):$=e[2];const{data:l,error:s,errorSource:k,isLoading:R}=W(z.getSettings,w,$);let a,p,u,d,o,i,h;if(e[3]!==s||e[4]!==k||e[5]!==l?.deploy||e[6]!==l?.settings||e[7]!==n){const C=B(l?.deploy,n);let S;e[15]!==l?.settings?(S=l?.settings??[],e[15]=l?.settings,e[16]=S):S=e[16],a=S,p="flex flex-col gap-4",u="lunora-settings";let N;e[17]!==n?(N=n("Open in Cloudflare"),e[17]=n,e[18]=N):N=e[18],e[19]!==N?(d=t("div",{className:"flex flex-wrap items-center gap-3",children:t("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:M,rel:"noreferrer",target:"_blank",children:N})}),e[19]=N,e[20]=d):d=e[20];let b;e[21]!==n?(b=n("View-only — values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=n,e[22]=b):b=e[22],e[23]!==b?(o=t("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:b}),e[23]=b,e[24]=o):o=e[24],e[25]!==s||e[26]!==k?(i=s!==null&&t(A,{error:k,testId:"set-error"}),e[25]=s,e[26]=k,e[27]=i):i=e[27],h=C.length>0&&m(D,{className:"py-0","data-testid":"set-deploy",children:[t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Deployment")})}),t(I,{className:"py-3",children:t("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:C.map(G)})})]}),e[3]=s,e[4]=k,e[5]=l?.deploy,e[6]=l?.settings,e[7]=n,e[8]=a,e[9]=p,e[10]=u,e[11]=d,e[12]=o,e[13]=i,e[14]=h}else a=e[8],p=e[9],u=e[10],d=e[11],o=e[12],i=e[13],h=e[14];let f;e[28]!==n?(f=n("Environment & bindings"),e[28]=n,e[29]=f):f=e[29];let g;e[30]!==f?(g=t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f})}),e[30]=f,e[31]=g):g=e[31];let x;e[32]!==s||e[33]!==R||e[34]!==a.length||e[35]!==n?(x=s===null&&!R&&a.length===0&&t("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:n("No environment variables or bindings.")}),e[32]=s,e[33]=R,e[34]=a.length,e[35]=n,e[36]=x):x=e[36];let v;e[37]!==a||e[38]!==n?(v=a.length>0&&t(I,{className:"px-0 py-0",children:m(j,{"data-testid":"set-table",children:[t(F,{children:m(L,{children:[t(T,{children:n("name")}),t(T,{children:n("kind")}),t(T,{children:n("value")})]})}),t(V,{children:a.map(H)})]})}),e[37]=a,e[38]=n,e[39]=v):v=e[39];let y;e[40]!==g||e[41]!==x||e[42]!==v?(y=m(D,{className:"py-0",children:[g,x,v]}),e[40]=g,e[41]=x,e[42]=v,e[43]=y):y=e[43];let E;return e[44]!==y||e[45]!==p||e[46]!==u||e[47]!==d||e[48]!==o||e[49]!==i||e[50]!==h?(E=m("div",{className:p,"data-testid":u,children:[d,o,i,h,y]}),e[44]=y,e[45]=p,e[46]=u,e[47]=d,e[48]=o,e[49]=i,e[50]=h,e[51]=E):E=e[51],E};function G(r){return m("div",{className:"contents","data-testid":"set-deploy-row",children:[t("dt",{className:"text-muted-foreground",children:r.label}),t("dd",{className:"truncate font-mono text-xs",title:r.value,children:r.value})]},r.label)}function H(r){return m(L,{"data-testid":"set-row",children:[t(U,{className:"font-mono text-xs font-medium",children:r.name}),t(U,{children:t(K,{variant:P[r.kind],children:r.bindingType??r.kind})}),t(U,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:r.value??t("span",{className:"text-muted-foreground",children:"—"})})]},r.name)}export{le as SettingsPanel};
|