@lunora/studio 1.0.0-alpha.102 → 1.0.0-alpha.103
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/standalone/{chunk-GSQDZMV5.js → chunk-2POO335F.js} +1 -1
- package/dist/standalone/{chunk-6C6FRIYD.js → chunk-3JJIZ5GZ.js} +1 -1
- package/dist/standalone/{chunk-YZ7OINPX.js → chunk-44W6IDID.js} +1 -1
- package/dist/standalone/{chunk-ZNNKWEH5.js → chunk-56Q3NCCQ.js} +1 -1
- package/dist/standalone/{chunk-U62QRT34.js → chunk-5BKFMQKO.js} +1 -1
- package/dist/standalone/{chunk-ORNIQZ2P.js → chunk-5VYZCZNH.js} +1 -1
- package/dist/standalone/{chunk-ELI5HREQ.js → chunk-6VTX32BC.js} +1 -1
- package/dist/standalone/{chunk-4PDTGZDC.js → chunk-6ZVSFYWY.js} +2 -2
- package/dist/standalone/{chunk-3RC2X4I2.js → chunk-76XT6OKR.js} +1 -1
- package/dist/standalone/{chunk-BB7WLC24.js → chunk-AAU2LQP2.js} +1 -1
- package/dist/standalone/{chunk-A3DCTWSA.js → chunk-AB5HDI3T.js} +1 -1
- package/dist/standalone/{chunk-LPBWDHKM.js → chunk-AI5UNHBF.js} +1 -1
- package/dist/standalone/chunk-BR5GIQWK.js +15 -0
- package/dist/standalone/{chunk-NLHEYDAA.js → chunk-C2W6YSI7.js} +1 -1
- package/dist/standalone/{chunk-W3VOX7VR.js → chunk-DUFBHFX6.js} +1 -1
- package/dist/standalone/{chunk-5BEGIQM7.js → chunk-EAGPIRHK.js} +1 -1
- package/dist/standalone/{chunk-ELJZNBBJ.js → chunk-EP5VOTNC.js} +1 -1
- package/dist/standalone/{chunk-ZMDNTTAC.js → chunk-EVPGUJH7.js} +1 -1
- package/dist/standalone/{chunk-4KPBTODU.js → chunk-FGMDIASJ.js} +1 -1
- package/dist/standalone/{chunk-U4THUBUT.js → chunk-FSPXSK4F.js} +1 -1
- package/dist/standalone/{chunk-GRRBUXEI.js → chunk-GCIAXZBG.js} +1 -1
- package/dist/standalone/{chunk-MRK53LUL.js → chunk-GPXYZOOF.js} +1 -1
- package/dist/standalone/{chunk-NH4HJFG3.js → chunk-GY66QQZJ.js} +1 -1
- package/dist/standalone/{chunk-T6YGEL6X.js → chunk-ICUATQ6I.js} +1 -1
- package/dist/standalone/{chunk-DSDJ3QRD.js → chunk-ILQLRPP6.js} +1 -1
- package/dist/standalone/{chunk-TFSGDOCG.js → chunk-IN6NPKXV.js} +1 -1
- package/dist/standalone/{chunk-BCMLQ3LV.js → chunk-J6IUJLIJ.js} +1 -1
- package/dist/standalone/{chunk-6THGMZNI.js → chunk-K5463KGW.js} +1 -1
- package/dist/standalone/{chunk-WMBDXCYL.js → chunk-KHZFULUH.js} +1 -1
- package/dist/standalone/{chunk-RTXAZLAE.js → chunk-KMGVTPH2.js} +1 -1
- package/dist/standalone/{chunk-UP7OTXKF.js → chunk-KMT6UDR7.js} +1 -1
- package/dist/standalone/{chunk-W3XKLUWQ.js → chunk-L6ZL7C6I.js} +1 -1
- package/dist/standalone/{chunk-LKBKYLWK.js → chunk-LFOT3KUL.js} +1 -1
- package/dist/standalone/{chunk-UALL2OBT.js → chunk-LFYM72CD.js} +1 -1
- package/dist/standalone/{chunk-BIVP5DZB.js → chunk-LMZCWLYL.js} +1 -1
- package/dist/standalone/{chunk-5HMBKUFH.js → chunk-NLANS7IB.js} +1 -1
- package/dist/standalone/{chunk-IID7VT2A.js → chunk-NVY2U3IB.js} +1 -1
- package/dist/standalone/{chunk-4V4RO52I.js → chunk-OJDJMESX.js} +1 -1
- package/dist/standalone/{chunk-7AY2447G.js → chunk-OXGSORBK.js} +1 -1
- package/dist/standalone/{chunk-7MT6C3FS.js → chunk-P6U7JNSA.js} +1 -1
- package/dist/standalone/{chunk-RO6LEET3.js → chunk-Q5LK5ZBG.js} +1 -1
- package/dist/standalone/{chunk-QJW2Z3SI.js → chunk-QM4IZJHK.js} +1 -1
- package/dist/standalone/{chunk-OHOWUEQ3.js → chunk-RPGUPO5I.js} +1 -1
- package/dist/standalone/{chunk-35SAF2LS.js → chunk-TWF72RNA.js} +1 -1
- package/dist/standalone/{chunk-APBWFKW5.js → chunk-VA5RUELS.js} +1 -1
- package/dist/standalone/{chunk-22SUVVIR.js → chunk-WE4LGWB4.js} +1 -1
- package/dist/standalone/{chunk-DBAMCESO.js → chunk-WEOEKMJN.js} +1 -1
- package/dist/standalone/{chunk-EWGPDRH3.js → chunk-WNCBCYI4.js} +1 -1
- package/dist/standalone/{chunk-LYVP5PT6.js → chunk-WVU7GHTG.js} +3 -3
- package/dist/standalone/{chunk-TQEVFVNP.js → chunk-WVXS24SB.js} +1 -1
- package/dist/standalone/{chunk-IRXDBOOU.js → chunk-WWOB5XZT.js} +1 -1
- package/dist/standalone/{chunk-G6VZTEGG.js → chunk-WXALMQCU.js} +1 -1
- package/dist/standalone/{chunk-B5FMYLVA.js → chunk-X3W5GATZ.js} +1 -1
- package/dist/standalone/{chunk-NLWDTGEP.js → chunk-XOIXFWZS.js} +1 -1
- package/dist/standalone/{chunk-DC23USXJ.js → chunk-YPQISHBM.js} +1 -1
- package/dist/standalone/{chunk-6IZBFC3G.js → chunk-ZBVGZ4YA.js} +1 -1
- package/dist/standalone/{chunk-DY34ZZ5K.js → chunk-ZD3CL42S.js} +1 -1
- package/dist/standalone/{chunk-PCAI3G4M.js → chunk-ZKDSO2VL.js} +1 -1
- package/dist/standalone/{chunk-37PXYIVK.js → chunk-ZMNCF2DE.js} +1 -1
- package/dist/standalone/{chunk-7GNNMMT4.js → chunk-ZU6JSCBE.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/standalone/chunk-X7B6PLEW.js +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ze}from"./chunk-7GNNMMT4.js";import"./chunk-GMR677FL.js";import"./chunk-GG6PIGQO.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as Me}from"./chunk-5Y3QLNWX.js";import{a as Ye}from"./chunk-IGCNMZSB.js";import"./chunk-I6A5C46N.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import"./chunk-4UOFSGUS.js";import{a as Xe}from"./chunk-Y32QIKBS.js";import{a as ze}from"./chunk-3CWGJYBB.js";import{a as We}from"./chunk-RMN2JN4S.js";import{b as Ve}from"./chunk-GRL5MG3Z.js";import{d as De,e as Fe}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import{R as Ae}from"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{a as Ee}from"./chunk-MWIKAR7F.js";import"./chunk-DJZYD5I5.js";import"./chunk-2OUPA2WJ.js";import{b as _e}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as we}from"./chunk-6IZBFC3G.js";import"./chunk-XXQUMVWH.js";import"./chunk-ZNNKWEH5.js";import"./chunk-QLQADHFE.js";import{a as C}from"./chunk-VDW32UET.js";import{c as de}from"./chunk-UP7OTXKF.js";import{f as Te}from"./chunk-LYVP5PT6.js";import"./chunk-XBDKZZ67.js";import{a as ye}from"./chunk-XQCVZAGU.js";import{a as Ge,b as He,c as Qe,d as Ie,e as O,f as I}from"./chunk-WJQLNYGX.js";import{a as Le,e as Je}from"./chunk-WQH3LT2P.js";import{d as oe,f as Ue,g as Pe,h as Be,o as ke,r as Ne}from"./chunk-IUYFXK4X.js";import"./chunk-X7B6PLEW.js";import{a as m,e as ie,f as qe,g as Ce,h as Ke,j as ne}from"./chunk-3XIESWL4.js";var me=ie(Ce(),1),ce=ie(qe(),1);var et=ie(Ce(),1);var j=ie(qe(),1);var l=ie(Ke(),1);var ct=Ue(C.runMigration),tt=m(a=>{let e=(0,et.c)(98),{initialShardKey:r}=a,s=Te(),t=oe(),{queryShardKey:d,setShardKey:i,shardKey:n}=ze(r),[u,b]=(0,j.useState)(""),[h,v]=(0,j.useState)("up"),[p,g]=(0,j.useState)(!0),[f,y]=(0,j.useState)(!1),[x,c]=(0,j.useState)(null),[N,k]=(0,j.useState)(null),K;e[0]!==n?(K=n.trim(),e[0]=n,e[1]=K):K=e[1];let M=K===d,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S={},e[2]=S):S=e[2];let R;e[3]!==d?(R={live:!0,shardKey:d},e[3]=d,e[4]=R):R=e[4];let w=de(C.migrationStatus,S,R),$=w.data?.migrations??null,$e=w.error,{errorSource:je,liveError:Se}=w,ue,he;e[5]!==d||e[6]!==w.data?(ue=m(()=>{w.data!==void 0&&Ve(d)},"Q"),he=[w.data,d],e[5]=d,e[6]=w.data,e[7]=ue,e[8]=he):(ue=e[7],he=e[8]),(0,j.useEffect)(ue,he);let pe;if(e[9]!==s||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==n||e[14]!==w||e[15]!==t){let q=m(async()=>{let Re=u.trim();if(Re===""){k(t("Enter a migration id")),c(null);return}y(!0),k(null);try{let Oe=await s.query(ct,{direction:h,dryRun:p,id:Re},Pe(n));c(Oe),w.refetch()}catch(Oe){let lt=Oe;c(null),k(Be(lt))}y(!1)},"m");pe=m(()=>{ke(q())},"X"),e[9]=s,e[10]=h,e[11]=p,e[12]=u,e[13]=n,e[14]=w,e[15]=t,e[16]=pe}else pe=e[16];let fe=pe,ge;e[17]===Symbol.for("react.memo_cache_sentinel")?(ge=m(q=>{b(q.target.value)},"Z"),e[17]=ge):ge=e[17];let nt=ge,be;e[18]===Symbol.for("react.memo_cache_sentinel")?(be=m(q=>{v(q.target.value==="down"?"down":"up")},"H"),e[18]=be):be=e[18];let ot=be,ve;e[19]===Symbol.for("react.memo_cache_sentinel")?(ve=m(q=>{g(q.target.checked)},"ee"),e[19]=ve):ve=e[19];let dt=ve,T;e[20]!==i||e[21]!==n?(T=(0,l.jsx)(We,{onChange:i,testId:"mg-shard-input",value:n}),e[20]=i,e[21]=n,e[22]=T):T=e[22];let D;e[23]!==Se?(D=(0,l.jsx)(Ye,{message:Se,prefix:"mg"}),e[23]=Se,e[24]=D):D=e[24];let F;e[25]!==T||e[26]!==D?(F=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=F):F=e[27];let _;e[28]!==$e||e[29]!==je?(_=$e!==null&&(0,l.jsx)(we,{error:je,testId:"mg-status-error"}),e[28]=$e,e[29]=je,e[30]=_):_=e[30];let A;e[31]!==$||e[32]!==t?(A=$!==null&&$.length===0&&(0,l.jsx)(ye,{description:t("Data migrations you run against this shard will be tracked here."),icon:(0,l.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=$,e[32]=t,e[33]=A):A=e[33];let E;e[34]!==$||e[35]!==t?(E=$!==null&&$.length>0&&(0,l.jsx)(Le,{className:"overflow-hidden py-0",children:(0,l.jsx)(Je,{className:"px-0",children:(0,l.jsxs)(Ge,{"data-testid":"mg-table",children:[(0,l.jsx)(He,{children:(0,l.jsxs)(Ie,{children:[(0,l.jsx)(O,{children:t("id")}),(0,l.jsx)(O,{children:t("direction")}),(0,l.jsx)(O,{children:t("status")}),(0,l.jsx)(O,{children:t("processed")}),(0,l.jsx)(O,{children:t("changed")}),(0,l.jsx)(O,{children:t("updated")}),(0,l.jsx)(O,{children:t("error")})]})}),(0,l.jsx)(Qe,{children:$.map(mt)})]})})}),e[34]=$,e[35]=t,e[36]=E):E=e[36];let L;e[37]!==t?(L=t("Run migration"),e[37]=t,e[38]=L):L=e[38];let J;e[39]!==L?(J=(0,l.jsx)(Me,{children:L}),e[39]=L,e[40]=J):J=e[40];let U;e[41]!==t?(U=t("Migration id"),e[41]=t,e[42]=U):U=e[42];let P;e[43]!==t?(P=t("migration id"),e[43]=t,e[44]=P):P=e[44];let B;e[45]!==u||e[46]!==U||e[47]!==P?(B=(0,l.jsx)(Ae,{"aria-label":U,className:"w-auto","data-testid":"mg-id-input",onChange:nt,placeholder:P,value:u}),e[45]=u,e[46]=U,e[47]=P,e[48]=B):B=e[48];let V;e[49]!==t?(V=t("Direction"),e[49]=t,e[50]=V):V=e[50];let W;e[51]!==t?(W=t("up"),e[51]=t,e[52]=W):W=e[52];let z;e[53]!==W?(z=(0,l.jsx)("option",{value:"up",children:W}),e[53]=W,e[54]=z):z=e[54];let G;e[55]!==t?(G=t("down"),e[55]=t,e[56]=G):G=e[56];let H;e[57]!==G?(H=(0,l.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=H):H=e[58];let Q;e[59]!==h||e[60]!==V||e[61]!==z||e[62]!==H?(Q=(0,l.jsxs)("select",{"aria-label":V,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:ot,value:h,children:[z,H]}),e[59]=h,e[60]=V,e[61]=z,e[62]=H,e[63]=Q):Q=e[63];let X;e[64]!==p?(X=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dt,type:"checkbox"}),e[64]=p,e[65]=X):X=e[65];let Y;e[66]!==t?(Y=t("Dry run"),e[66]=t,e[67]=Y):Y=e[67];let Z;e[68]!==X||e[69]!==Y?(Z=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[X,Y]}),e[68]=X,e[69]=Y,e[70]=Z):Z=e[70];let ee;e[71]!==p||e[72]!==fe||e[73]!==f||e[74]!==M||e[75]!==t?(ee=p?(0,l.jsx)(Ee,{"data-testid":"mg-run",disabled:f||!M,onClick:fe,type:"button",children:t(f?"Running\u2026":"Run")}):(0,l.jsx)(Xe,{confirmLabel:t(f?"Running\u2026":"Run migration?"),disabled:f||!M,onConfirm:fe,testId:"mg-run",children:t("Run")}),e[71]=p,e[72]=fe,e[73]=f,e[74]=M,e[75]=t,e[76]=ee):ee=e[76];let te;e[77]!==B||e[78]!==Q||e[79]!==Z||e[80]!==ee?(te=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[B,Q,Z,ee]}),e[77]=B,e[78]=Q,e[79]=Z,e[80]=ee,e[81]=te):te=e[81];let ae;e[82]!==J||e[83]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[J,te]}),e[82]=J,e[83]=te,e[84]=ae):ae=e[84];let re;e[85]!==N?(re=N!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:N}),e[85]=N,e[86]=re):re=e[86];let se;e[87]!==x||e[88]!==t?(se=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?t("Dry run: "):"",t("{status} \u2014 processed",{status:x.status}),x.processed,t(", changed"),x.changed]}),e[87]=x,e[88]=t,e[89]=se):se=e[89];let xe;return e[90]!==F||e[91]!==_||e[92]!==A||e[93]!==E||e[94]!==ae||e[95]!==re||e[96]!==se?(xe=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[F,_,A,E,ae,re,se]}),e[90]=F,e[91]=_,e[92]=A,e[93]=E,e[94]=ae,e[95]=re,e[96]=se,e[97]=xe):xe=e[97],xe},"yr");function mt(a){return(0,l.jsxs)(Ie,{"data-testid":`mg-row-${a.id}`,children:[(0,l.jsx)(I,{children:a.id}),(0,l.jsx)(I,{children:a.direction}),(0,l.jsx)(I,{children:(0,l.jsx)(_e,{variant:"secondary",children:a.status})}),(0,l.jsx)(I,{children:a.processed}),(0,l.jsx)(I,{children:a.changed}),(0,l.jsx)(I,{children:Ne(a.updatedAt)}),(0,l.jsx)(I,{children:a.error??""})]},a.id)}m(mt,"Ve");var o=ie(Ke(),1);var le=m(a=>typeof a=="object"&&a!==null,"k"),ut=m(a=>le(a)&&le(a.fields)&&le(a.indexes)&&le(a.relations)&&typeof a.shardMode=="string","z"),ht=m(a=>{if(a===void 0||a.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(a)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!le(e)||e.version!==1||!le(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(1)})`,status:"invalid"};for(let[r,s]of Object.entries(e.tables))if(!ut(s))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:1},status:"ok"}},"B"),pt=m((a,e)=>a.unique===e.unique&&a.fields.length===e.fields.length&&a.fields.every((r,s)=>r===e.fields[s]),"L"),ft=m((a,e,r,s)=>{let t=[];return r.kind!==s.kind&&t.push({severity:"breaking",summary:`field ${a}.${e} changed type: ${r.kind} \u2192 ${s.kind} \u2014 add a data migration to convert existing values`,table:a,scope:"table",type:"changedFieldKind"}),r.optional&&!s.optional?t.push({severity:"breaking",summary:`field ${a}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:a,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&s.optional&&t.push({scope:"table",severity:"safe",summary:`field ${a}.${e} became optional`,table:a,type:"fieldRequiredToOptional"}),t},"Q"),gt=m((a,e,r)=>r.optional?{scope:"table",severity:"safe",summary:`added optional field ${a}.${e}`,table:a,type:"addedOptionalField"}:{severity:"breaking",summary:`added required field ${a}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:a,scope:"table",type:"addedRequiredField"},"G"),bt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.fields)){let i=e.fields[t];i===void 0?s.push(gt(a,t,d)):s.push(...ft(a,t,i,d))}for(let t of Object.keys(e.fields))r.fields[t]===void 0&&s.push({severity:"breaking",summary:`removed field ${a}.${t} \u2014 add a data migration if stored data must be cleaned up`,table:a,scope:"table",type:"removedField"})},"X"),vt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.indexes)){let i=e.indexes[t];if(i===void 0){s.push({scope:"table",severity:"safe",summary:`added index ${t} on ${a}`,table:a,type:"addedIndex"});continue}pt(i,d)||s.push({severity:"breaking",summary:`index ${t} on ${a} changed shape \u2014 a query may have relied on the old index`,table:a,scope:"table",type:"changedIndex"})}for(let t of Object.keys(e.indexes))r.indexes[t]===void 0&&s.push({severity:"breaking",summary:`removed index ${t} on ${a} \u2014 a query that used \`.withIndex("${t}")\` would break`,table:a,scope:"table",type:"removedIndex"})},"Y"),xt=m((a,e,r,s)=>{for(let t of Object.keys(r.relations))e.relations[t]===void 0&&s.push({scope:"schema",severity:"safe",summary:`added relation ${a}.${t}`,table:a,type:"addedRelation"});for(let t of Object.keys(e.relations))r.relations[t]===void 0&&s.push({scope:"schema",severity:"breaking",summary:`removed relation ${a}.${t}`,table:a,type:"removedRelation"})},"Z"),yt=m((a,e,r,s)=>{e.shardMode!==r.shardMode&&s.push({severity:"breaking",summary:`table ${a} changed shard mode: ${e.shardMode} \u2192 ${r.shardMode} \u2014 its physical storage moves; add a data migration / re-shard plan`,table:a,scope:"table",type:"changedShardMode"}),bt(a,e,r,s),vt(a,e,r,s),xt(a,e,r,s)},"ee"),kt=m((a,e)=>{let r=[],s=a?.tables??{};for(let[t,d]of Object.entries(e.tables)){let i=s[t];if(i===void 0){r.push({scope:"table",severity:"safe",summary:`added table ${t}`,table:t,type:"addedTable"});continue}yt(t,i,d,r)}for(let t of Object.keys(s))e.tables[t]===void 0&&r.push({scope:"table",severity:"breaking",summary:`removed table ${t} \u2014 add a data migration if its data must be archived/cleaned up`,table:t,type:"removedTable"});if(a!==void 0&&a.jurisdiction!==e.jurisdiction){let t=a.jurisdiction??"(none)",d=e.jurisdiction??"(none)";r.push({scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${t} to ${d} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:r}},"te"),at=m(a=>Object.entries(a.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(a.relations).find(s=>s.field===e&&s.kind==="one")?.table,type:r.kind})),"T"),rt=m((a,e)=>{let r={},s=a?.fields??{},t=e?.fields??{};for(let[d,i]of Object.entries(t)){let n=s[d];n===void 0?r[d]=a===void 0?"unchanged":"added":r[d]=n.kind===i.kind&&n.optional===i.optional?"unchanged":"changed"}for(let d of Object.keys(s))t[d]===void 0&&(r[d]="removed");return r},"F"),Nt=m((a,e)=>{let{changes:r}=kt(a,e),s=new Set(r.filter(i=>i.scope==="table"&&i.table!==void 0).map(i=>i.table)),t=[],d=m((i,n)=>i?"added":s.has(n)?"changed":"context","o");for(let[i,n]of Object.entries(e.tables)){let u=a?.tables[i],b=d(u===void 0,i);t.push({columns:at(n),fieldStatus:rt(u,n),name:i,shardMode:n.shardMode,status:b})}for(let[i,n]of Object.entries(a?.tables??{}))e.tables[i]===void 0&&t.push({columns:at(n),fieldStatus:rt(n,void 0),name:i,shardMode:n.shardMode,status:"removed"});return t.sort((i,n)=>i.name.localeCompare(n.name)),{breakingCount:r.filter(i=>i.severity==="breaking").length,changes:r,tables:t}},"ae"),st=m(a=>{let e=ht(a);return e.status==="ok"?e.snapshot:void 0},"K"),wt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},$t=m(a=>a==="global"?"global":"shard","se"),jt=m(a=>{let e=(0,me.c)(24),{appliedAt:r,hash:s,onSelect:t,selected:d,seq:i}=a,n=d?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==n?(u=ne("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",n),e[0]=n,e[1]=u):u=e[1];let b=`sh-version-${s}`,h;e[2]!==s||e[3]!==t?(h=m(()=>{t(s)},"m"),e[2]=s,e[3]=t,e[4]=h):h=e[4];let v;e[5]!==i?(v=(0,o.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",i]}),e[5]=i,e[6]=v):v=e[6];let p;e[7]!==s?(p=s.slice(0,7),e[7]=s,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=g):g=e[10];let f;e[11]!==v||e[12]!==g?(f=(0,o.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[v,g]}),e[11]=v,e[12]=g,e[13]=f):f=e[13];let y;e[14]!==r?(y=Ne(r),e[14]=r,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:y}),e[16]=y,e[17]=x):x=e[17];let c;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(c=(0,o.jsx)("li",{children:(0,o.jsxs)("button",{className:u,"data-testid":b,onClick:h,type:"button",children:[f,x]})}),e[18]=x,e[19]=u,e[20]=b,e[21]=h,e[22]=f,e[23]=c):c=e[23],c},"ie"),St=m(a=>{let e=(0,me.c)(26),{breaking:r,count:s,first:t}=a,d=oe();if(t){let g;e[0]!==s?(g=(0,o.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:s}),e[0]=s,e[1]=g):g=e[1];let f;e[2]!==d?(f=d("tables"),e[2]=d,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[4]=f,e[5]=y):y=e[5];let x;return e[6]!==g||e[7]!==y?(x=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[g,y]}),e[6]=g,e[7]=y,e[8]=x):x=e[8],x}let i=r>0&&"text-destructive",n;e[9]!==i?(n=ne("text-3xl leading-none font-light tracking-tight tabular-nums",i),e[9]=i,e[10]=n):n=e[10];let u;e[11]!==s||e[12]!==n?(u=(0,o.jsx)("span",{className:n,children:s}),e[11]=s,e[12]=n,e[13]=u):u=e[13];let b;e[14]!==s||e[15]!==d?(b=d(s===1?"change":"changes"),e[14]=s,e[15]=d,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:b}),e[17]=b,e[18]=h):h=e[18];let v;e[19]!==r||e[20]!==d?(v=r>0&&(0,o.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",d("{count} breaking",{count:r})]}),e[19]=r,e[20]=d,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[u,h,v]}),e[22]=u,e[23]=h,e[24]=v,e[25]=p):p=e[25],p},"re"),it={addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedFieldKind:{action:"changed",kind:"field kind"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedShardMode:{action:"changed",kind:"shard mode"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"}},Ot=m((a,e)=>{let r=`${it[a.type].action} ${e} `;return a.summary.startsWith(r)?a.summary.slice(r.length):a.summary},"oe"),It=m(a=>{let e=new Map;for(let s of a){let t=s.table??"",d=e.get(t);d===void 0?e.set(t,[s]):d.push(s)}let r=[...e].map(([s,t])=>({changes:t,table:s}));return[...r.filter(s=>s.table!==""),...r.filter(s=>s.table==="")]},"de"),Mt=m(a=>{let e=(0,me.c)(2),{children:r}=a,s;return e[0]!==r?(s=(0,o.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=s):s=e[1],s},"le"),Rt=m(({pane:a,shardKey:e=""})=>{let r=oe(),s=Fe(),t=De({strict:!1}).version,d=m(c=>{ke(s({search:{version:c},to:"/migrations"}))},"o"),i=de(C.schemaHistory,{},{shardKey:e}),n=i.data?.versions??[],u=t!==void 0&&n.some(c=>c.hash===t)?t:n[0]?.hash,b=n.findIndex(c=>c.hash===u),h=b===-1?void 0:n[b+1]?.hash,v=de(C.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=de(C.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,ce.useMemo)(()=>{let c=st(v.data?.version?.snapshotJson);if(c!==void 0)return Nt(st(p.data?.version?.snapshotJson),c)},[v.data,p.data]),f=(0,ce.useMemo)(()=>(g?.tables??[]).map(c=>({columns:c.columns,name:c.name,tier:$t(c.shardMode)})),[g]),y=(0,ce.useMemo)(()=>{let c={};for(let N of g?.tables??[])c[N.name]=wt[N.status];return c},[g]);if(i.error!==null)return(0,o.jsx)(we,{error:i.errorSource,testId:"sh-error"});if(n.length===0)return(0,o.jsx)(ye,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let x=g?.changes??[];return(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,o.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,o.jsx)(Mt,{children:r("Schema versions")}),(0,o.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:n.map(c=>(0,o.jsx)(jt,{appliedAt:c.appliedAt,hash:c.hash,onSelect:d,selected:c.hash===u,seq:c.seq},c.hash))})]}),(0,o.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,o.jsx)(St,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),a==="diagram"?(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,o.jsx)(Ze,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:It(x).map(c=>{let N=(g?.tables??[]).find(k=>k.name===c.table);return(0,o.jsxs)("section",{className:"mb-6",children:[(0,o.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,o.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:c.table===""?r("schema"):c.table}),N!==void 0&&(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:N.columns.length})}),c.changes.length>1&&(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:c.changes.length})]}),(0,o.jsx)("ul",{children:c.changes.map(k=>{let{action:K,kind:M}=it[k.type],S=k.severity==="breaking",R=Ot(k,M);return(0,o.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,o.jsx)("span",{"aria-hidden":"true",className:ne("-ms-3 h-3 w-0.5 shrink-0 self-center",S?"bg-destructive":"bg-transparent")}),(0,o.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(K)," ",M]}),R!==c.table&&(0,o.jsx)("span",{className:ne("min-w-0 font-mono text-[13px]",S?"text-destructive":"text-foreground"),children:R}),S&&(0,o.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},c.table)})})]})]})},"ce"),qt=m(a=>ne("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",a?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"me"),da=m(a=>{let e=(0,me.c)(11),{initialShardKey:r}=a,s=oe(),[t,d]=(0,ce.useState)("diagram"),i;e[0]!==t?(i=m((v,p,g,f)=>(0,o.jsxs)("button",{"aria-selected":t===v,className:qt(t===v),"data-testid":g,onClick:m(()=>{d(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,o.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"i"),e[0]=t,e[1]=i):i=e[1];let n=i,u;e[2]!==s||e[3]!==n?(u=(0,o.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[n("diagram",s("Diagram"),"mg-pane-diagram"),n("changes",s("Changes"),"mg-pane-changes"),n("data",s("Data migrations"),"mg-pane-data")]}),e[2]=s,e[3]=n,e[4]=u):u=e[4];let b;e[5]!==r||e[6]!==t?(b=(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:t==="data"?(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,o.jsx)(tt,{initialShardKey:r})}):(0,o.jsx)(Rt,{pane:t,shardKey:r})}),e[5]=r,e[6]=t,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[u,b]}),e[8]=u,e[9]=b,e[10]=h):h=e[10],h},"je");export{da as default};
|
|
1
|
+
import{a as Ze}from"./chunk-ZU6JSCBE.js";import"./chunk-GMR677FL.js";import"./chunk-GG6PIGQO.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as Me}from"./chunk-5Y3QLNWX.js";import{a as Ye}from"./chunk-IGCNMZSB.js";import"./chunk-I6A5C46N.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import"./chunk-4UOFSGUS.js";import{a as Xe}from"./chunk-Y32QIKBS.js";import{a as ze}from"./chunk-3CWGJYBB.js";import{a as We}from"./chunk-RMN2JN4S.js";import{b as Ve}from"./chunk-GRL5MG3Z.js";import{d as De,e as Fe}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import{R as Ae}from"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{a as Ee}from"./chunk-MWIKAR7F.js";import"./chunk-DJZYD5I5.js";import"./chunk-2OUPA2WJ.js";import{b as _e}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as we}from"./chunk-ZBVGZ4YA.js";import"./chunk-XXQUMVWH.js";import"./chunk-56Q3NCCQ.js";import"./chunk-QLQADHFE.js";import{a as C}from"./chunk-VDW32UET.js";import{c as de}from"./chunk-KMT6UDR7.js";import{f as Te}from"./chunk-WVU7GHTG.js";import"./chunk-XBDKZZ67.js";import{a as ye}from"./chunk-XQCVZAGU.js";import{a as Ge,b as He,c as Qe,d as Ie,e as O,f as I}from"./chunk-WJQLNYGX.js";import{a as Le,e as Je}from"./chunk-WQH3LT2P.js";import{d as oe,f as Ue,g as Pe,h as Be,o as ke,r as Ne}from"./chunk-IUYFXK4X.js";import"./chunk-BR5GIQWK.js";import{a as m,e as ie,f as qe,g as Ce,h as Ke,j as ne}from"./chunk-3XIESWL4.js";var me=ie(Ce(),1),ce=ie(qe(),1);var et=ie(Ce(),1);var j=ie(qe(),1);var l=ie(Ke(),1);var ct=Ue(C.runMigration),tt=m(a=>{let e=(0,et.c)(98),{initialShardKey:r}=a,s=Te(),t=oe(),{queryShardKey:d,setShardKey:i,shardKey:n}=ze(r),[u,b]=(0,j.useState)(""),[h,v]=(0,j.useState)("up"),[p,g]=(0,j.useState)(!0),[f,y]=(0,j.useState)(!1),[x,c]=(0,j.useState)(null),[N,k]=(0,j.useState)(null),K;e[0]!==n?(K=n.trim(),e[0]=n,e[1]=K):K=e[1];let M=K===d,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S={},e[2]=S):S=e[2];let R;e[3]!==d?(R={live:!0,shardKey:d},e[3]=d,e[4]=R):R=e[4];let w=de(C.migrationStatus,S,R),$=w.data?.migrations??null,$e=w.error,{errorSource:je,liveError:Se}=w,ue,he;e[5]!==d||e[6]!==w.data?(ue=m(()=>{w.data!==void 0&&Ve(d)},"Q"),he=[w.data,d],e[5]=d,e[6]=w.data,e[7]=ue,e[8]=he):(ue=e[7],he=e[8]),(0,j.useEffect)(ue,he);let pe;if(e[9]!==s||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==n||e[14]!==w||e[15]!==t){let q=m(async()=>{let Re=u.trim();if(Re===""){k(t("Enter a migration id")),c(null);return}y(!0),k(null);try{let Oe=await s.query(ct,{direction:h,dryRun:p,id:Re},Pe(n));c(Oe),w.refetch()}catch(Oe){let lt=Oe;c(null),k(Be(lt))}y(!1)},"m");pe=m(()=>{ke(q())},"X"),e[9]=s,e[10]=h,e[11]=p,e[12]=u,e[13]=n,e[14]=w,e[15]=t,e[16]=pe}else pe=e[16];let fe=pe,ge;e[17]===Symbol.for("react.memo_cache_sentinel")?(ge=m(q=>{b(q.target.value)},"Z"),e[17]=ge):ge=e[17];let nt=ge,be;e[18]===Symbol.for("react.memo_cache_sentinel")?(be=m(q=>{v(q.target.value==="down"?"down":"up")},"H"),e[18]=be):be=e[18];let ot=be,ve;e[19]===Symbol.for("react.memo_cache_sentinel")?(ve=m(q=>{g(q.target.checked)},"ee"),e[19]=ve):ve=e[19];let dt=ve,T;e[20]!==i||e[21]!==n?(T=(0,l.jsx)(We,{onChange:i,testId:"mg-shard-input",value:n}),e[20]=i,e[21]=n,e[22]=T):T=e[22];let D;e[23]!==Se?(D=(0,l.jsx)(Ye,{message:Se,prefix:"mg"}),e[23]=Se,e[24]=D):D=e[24];let F;e[25]!==T||e[26]!==D?(F=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=F):F=e[27];let _;e[28]!==$e||e[29]!==je?(_=$e!==null&&(0,l.jsx)(we,{error:je,testId:"mg-status-error"}),e[28]=$e,e[29]=je,e[30]=_):_=e[30];let A;e[31]!==$||e[32]!==t?(A=$!==null&&$.length===0&&(0,l.jsx)(ye,{description:t("Data migrations you run against this shard will be tracked here."),icon:(0,l.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=$,e[32]=t,e[33]=A):A=e[33];let E;e[34]!==$||e[35]!==t?(E=$!==null&&$.length>0&&(0,l.jsx)(Le,{className:"overflow-hidden py-0",children:(0,l.jsx)(Je,{className:"px-0",children:(0,l.jsxs)(Ge,{"data-testid":"mg-table",children:[(0,l.jsx)(He,{children:(0,l.jsxs)(Ie,{children:[(0,l.jsx)(O,{children:t("id")}),(0,l.jsx)(O,{children:t("direction")}),(0,l.jsx)(O,{children:t("status")}),(0,l.jsx)(O,{children:t("processed")}),(0,l.jsx)(O,{children:t("changed")}),(0,l.jsx)(O,{children:t("updated")}),(0,l.jsx)(O,{children:t("error")})]})}),(0,l.jsx)(Qe,{children:$.map(mt)})]})})}),e[34]=$,e[35]=t,e[36]=E):E=e[36];let L;e[37]!==t?(L=t("Run migration"),e[37]=t,e[38]=L):L=e[38];let J;e[39]!==L?(J=(0,l.jsx)(Me,{children:L}),e[39]=L,e[40]=J):J=e[40];let U;e[41]!==t?(U=t("Migration id"),e[41]=t,e[42]=U):U=e[42];let P;e[43]!==t?(P=t("migration id"),e[43]=t,e[44]=P):P=e[44];let B;e[45]!==u||e[46]!==U||e[47]!==P?(B=(0,l.jsx)(Ae,{"aria-label":U,className:"w-auto","data-testid":"mg-id-input",onChange:nt,placeholder:P,value:u}),e[45]=u,e[46]=U,e[47]=P,e[48]=B):B=e[48];let V;e[49]!==t?(V=t("Direction"),e[49]=t,e[50]=V):V=e[50];let W;e[51]!==t?(W=t("up"),e[51]=t,e[52]=W):W=e[52];let z;e[53]!==W?(z=(0,l.jsx)("option",{value:"up",children:W}),e[53]=W,e[54]=z):z=e[54];let G;e[55]!==t?(G=t("down"),e[55]=t,e[56]=G):G=e[56];let H;e[57]!==G?(H=(0,l.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=H):H=e[58];let Q;e[59]!==h||e[60]!==V||e[61]!==z||e[62]!==H?(Q=(0,l.jsxs)("select",{"aria-label":V,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:ot,value:h,children:[z,H]}),e[59]=h,e[60]=V,e[61]=z,e[62]=H,e[63]=Q):Q=e[63];let X;e[64]!==p?(X=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dt,type:"checkbox"}),e[64]=p,e[65]=X):X=e[65];let Y;e[66]!==t?(Y=t("Dry run"),e[66]=t,e[67]=Y):Y=e[67];let Z;e[68]!==X||e[69]!==Y?(Z=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[X,Y]}),e[68]=X,e[69]=Y,e[70]=Z):Z=e[70];let ee;e[71]!==p||e[72]!==fe||e[73]!==f||e[74]!==M||e[75]!==t?(ee=p?(0,l.jsx)(Ee,{"data-testid":"mg-run",disabled:f||!M,onClick:fe,type:"button",children:t(f?"Running\u2026":"Run")}):(0,l.jsx)(Xe,{confirmLabel:t(f?"Running\u2026":"Run migration?"),disabled:f||!M,onConfirm:fe,testId:"mg-run",children:t("Run")}),e[71]=p,e[72]=fe,e[73]=f,e[74]=M,e[75]=t,e[76]=ee):ee=e[76];let te;e[77]!==B||e[78]!==Q||e[79]!==Z||e[80]!==ee?(te=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[B,Q,Z,ee]}),e[77]=B,e[78]=Q,e[79]=Z,e[80]=ee,e[81]=te):te=e[81];let ae;e[82]!==J||e[83]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[J,te]}),e[82]=J,e[83]=te,e[84]=ae):ae=e[84];let re;e[85]!==N?(re=N!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:N}),e[85]=N,e[86]=re):re=e[86];let se;e[87]!==x||e[88]!==t?(se=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?t("Dry run: "):"",t("{status} \u2014 processed",{status:x.status}),x.processed,t(", changed"),x.changed]}),e[87]=x,e[88]=t,e[89]=se):se=e[89];let xe;return e[90]!==F||e[91]!==_||e[92]!==A||e[93]!==E||e[94]!==ae||e[95]!==re||e[96]!==se?(xe=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[F,_,A,E,ae,re,se]}),e[90]=F,e[91]=_,e[92]=A,e[93]=E,e[94]=ae,e[95]=re,e[96]=se,e[97]=xe):xe=e[97],xe},"yr");function mt(a){return(0,l.jsxs)(Ie,{"data-testid":`mg-row-${a.id}`,children:[(0,l.jsx)(I,{children:a.id}),(0,l.jsx)(I,{children:a.direction}),(0,l.jsx)(I,{children:(0,l.jsx)(_e,{variant:"secondary",children:a.status})}),(0,l.jsx)(I,{children:a.processed}),(0,l.jsx)(I,{children:a.changed}),(0,l.jsx)(I,{children:Ne(a.updatedAt)}),(0,l.jsx)(I,{children:a.error??""})]},a.id)}m(mt,"Ve");var o=ie(Ke(),1);var le=m(a=>typeof a=="object"&&a!==null,"k"),ut=m(a=>le(a)&&le(a.fields)&&le(a.indexes)&&le(a.relations)&&typeof a.shardMode=="string","z"),ht=m(a=>{if(a===void 0||a.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(a)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!le(e)||e.version!==1||!le(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(1)})`,status:"invalid"};for(let[r,s]of Object.entries(e.tables))if(!ut(s))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:1},status:"ok"}},"B"),pt=m((a,e)=>a.unique===e.unique&&a.fields.length===e.fields.length&&a.fields.every((r,s)=>r===e.fields[s]),"L"),ft=m((a,e,r,s)=>{let t=[];return r.kind!==s.kind&&t.push({severity:"breaking",summary:`field ${a}.${e} changed type: ${r.kind} \u2192 ${s.kind} \u2014 add a data migration to convert existing values`,table:a,scope:"table",type:"changedFieldKind"}),r.optional&&!s.optional?t.push({severity:"breaking",summary:`field ${a}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:a,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&s.optional&&t.push({scope:"table",severity:"safe",summary:`field ${a}.${e} became optional`,table:a,type:"fieldRequiredToOptional"}),t},"Q"),gt=m((a,e,r)=>r.optional?{scope:"table",severity:"safe",summary:`added optional field ${a}.${e}`,table:a,type:"addedOptionalField"}:{severity:"breaking",summary:`added required field ${a}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:a,scope:"table",type:"addedRequiredField"},"G"),bt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.fields)){let i=e.fields[t];i===void 0?s.push(gt(a,t,d)):s.push(...ft(a,t,i,d))}for(let t of Object.keys(e.fields))r.fields[t]===void 0&&s.push({severity:"breaking",summary:`removed field ${a}.${t} \u2014 add a data migration if stored data must be cleaned up`,table:a,scope:"table",type:"removedField"})},"X"),vt=m((a,e,r,s)=>{for(let[t,d]of Object.entries(r.indexes)){let i=e.indexes[t];if(i===void 0){s.push({scope:"table",severity:"safe",summary:`added index ${t} on ${a}`,table:a,type:"addedIndex"});continue}pt(i,d)||s.push({severity:"breaking",summary:`index ${t} on ${a} changed shape \u2014 a query may have relied on the old index`,table:a,scope:"table",type:"changedIndex"})}for(let t of Object.keys(e.indexes))r.indexes[t]===void 0&&s.push({severity:"breaking",summary:`removed index ${t} on ${a} \u2014 a query that used \`.withIndex("${t}")\` would break`,table:a,scope:"table",type:"removedIndex"})},"Y"),xt=m((a,e,r,s)=>{for(let t of Object.keys(r.relations))e.relations[t]===void 0&&s.push({scope:"schema",severity:"safe",summary:`added relation ${a}.${t}`,table:a,type:"addedRelation"});for(let t of Object.keys(e.relations))r.relations[t]===void 0&&s.push({scope:"schema",severity:"breaking",summary:`removed relation ${a}.${t}`,table:a,type:"removedRelation"})},"Z"),yt=m((a,e,r,s)=>{e.shardMode!==r.shardMode&&s.push({severity:"breaking",summary:`table ${a} changed shard mode: ${e.shardMode} \u2192 ${r.shardMode} \u2014 its physical storage moves; add a data migration / re-shard plan`,table:a,scope:"table",type:"changedShardMode"}),bt(a,e,r,s),vt(a,e,r,s),xt(a,e,r,s)},"ee"),kt=m((a,e)=>{let r=[],s=a?.tables??{};for(let[t,d]of Object.entries(e.tables)){let i=s[t];if(i===void 0){r.push({scope:"table",severity:"safe",summary:`added table ${t}`,table:t,type:"addedTable"});continue}yt(t,i,d,r)}for(let t of Object.keys(s))e.tables[t]===void 0&&r.push({scope:"table",severity:"breaking",summary:`removed table ${t} \u2014 add a data migration if its data must be archived/cleaned up`,table:t,type:"removedTable"});if(a!==void 0&&a.jurisdiction!==e.jurisdiction){let t=a.jurisdiction??"(none)",d=e.jurisdiction??"(none)";r.push({scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${t} to ${d} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:r}},"te"),at=m(a=>Object.entries(a.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(a.relations).find(s=>s.field===e&&s.kind==="one")?.table,type:r.kind})),"T"),rt=m((a,e)=>{let r={},s=a?.fields??{},t=e?.fields??{};for(let[d,i]of Object.entries(t)){let n=s[d];n===void 0?r[d]=a===void 0?"unchanged":"added":r[d]=n.kind===i.kind&&n.optional===i.optional?"unchanged":"changed"}for(let d of Object.keys(s))t[d]===void 0&&(r[d]="removed");return r},"F"),Nt=m((a,e)=>{let{changes:r}=kt(a,e),s=new Set(r.filter(i=>i.scope==="table"&&i.table!==void 0).map(i=>i.table)),t=[],d=m((i,n)=>i?"added":s.has(n)?"changed":"context","o");for(let[i,n]of Object.entries(e.tables)){let u=a?.tables[i],b=d(u===void 0,i);t.push({columns:at(n),fieldStatus:rt(u,n),name:i,shardMode:n.shardMode,status:b})}for(let[i,n]of Object.entries(a?.tables??{}))e.tables[i]===void 0&&t.push({columns:at(n),fieldStatus:rt(n,void 0),name:i,shardMode:n.shardMode,status:"removed"});return t.sort((i,n)=>i.name.localeCompare(n.name)),{breakingCount:r.filter(i=>i.severity==="breaking").length,changes:r,tables:t}},"ae"),st=m(a=>{let e=ht(a);return e.status==="ok"?e.snapshot:void 0},"K"),wt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},$t=m(a=>a==="global"?"global":"shard","se"),jt=m(a=>{let e=(0,me.c)(24),{appliedAt:r,hash:s,onSelect:t,selected:d,seq:i}=a,n=d?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==n?(u=ne("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",n),e[0]=n,e[1]=u):u=e[1];let b=`sh-version-${s}`,h;e[2]!==s||e[3]!==t?(h=m(()=>{t(s)},"m"),e[2]=s,e[3]=t,e[4]=h):h=e[4];let v;e[5]!==i?(v=(0,o.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",i]}),e[5]=i,e[6]=v):v=e[6];let p;e[7]!==s?(p=s.slice(0,7),e[7]=s,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=g):g=e[10];let f;e[11]!==v||e[12]!==g?(f=(0,o.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[v,g]}),e[11]=v,e[12]=g,e[13]=f):f=e[13];let y;e[14]!==r?(y=Ne(r),e[14]=r,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:y}),e[16]=y,e[17]=x):x=e[17];let c;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(c=(0,o.jsx)("li",{children:(0,o.jsxs)("button",{className:u,"data-testid":b,onClick:h,type:"button",children:[f,x]})}),e[18]=x,e[19]=u,e[20]=b,e[21]=h,e[22]=f,e[23]=c):c=e[23],c},"ie"),St=m(a=>{let e=(0,me.c)(26),{breaking:r,count:s,first:t}=a,d=oe();if(t){let g;e[0]!==s?(g=(0,o.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:s}),e[0]=s,e[1]=g):g=e[1];let f;e[2]!==d?(f=d("tables"),e[2]=d,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[4]=f,e[5]=y):y=e[5];let x;return e[6]!==g||e[7]!==y?(x=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[g,y]}),e[6]=g,e[7]=y,e[8]=x):x=e[8],x}let i=r>0&&"text-destructive",n;e[9]!==i?(n=ne("text-3xl leading-none font-light tracking-tight tabular-nums",i),e[9]=i,e[10]=n):n=e[10];let u;e[11]!==s||e[12]!==n?(u=(0,o.jsx)("span",{className:n,children:s}),e[11]=s,e[12]=n,e[13]=u):u=e[13];let b;e[14]!==s||e[15]!==d?(b=d(s===1?"change":"changes"),e[14]=s,e[15]=d,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,o.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:b}),e[17]=b,e[18]=h):h=e[18];let v;e[19]!==r||e[20]!==d?(v=r>0&&(0,o.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",d("{count} breaking",{count:r})]}),e[19]=r,e[20]=d,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,o.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[u,h,v]}),e[22]=u,e[23]=h,e[24]=v,e[25]=p):p=e[25],p},"re"),it={addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedFieldKind:{action:"changed",kind:"field kind"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedShardMode:{action:"changed",kind:"shard mode"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"}},Ot=m((a,e)=>{let r=`${it[a.type].action} ${e} `;return a.summary.startsWith(r)?a.summary.slice(r.length):a.summary},"oe"),It=m(a=>{let e=new Map;for(let s of a){let t=s.table??"",d=e.get(t);d===void 0?e.set(t,[s]):d.push(s)}let r=[...e].map(([s,t])=>({changes:t,table:s}));return[...r.filter(s=>s.table!==""),...r.filter(s=>s.table==="")]},"de"),Mt=m(a=>{let e=(0,me.c)(2),{children:r}=a,s;return e[0]!==r?(s=(0,o.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=s):s=e[1],s},"le"),Rt=m(({pane:a,shardKey:e=""})=>{let r=oe(),s=Fe(),t=De({strict:!1}).version,d=m(c=>{ke(s({search:{version:c},to:"/migrations"}))},"o"),i=de(C.schemaHistory,{},{shardKey:e}),n=i.data?.versions??[],u=t!==void 0&&n.some(c=>c.hash===t)?t:n[0]?.hash,b=n.findIndex(c=>c.hash===u),h=b===-1?void 0:n[b+1]?.hash,v=de(C.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=de(C.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,ce.useMemo)(()=>{let c=st(v.data?.version?.snapshotJson);if(c!==void 0)return Nt(st(p.data?.version?.snapshotJson),c)},[v.data,p.data]),f=(0,ce.useMemo)(()=>(g?.tables??[]).map(c=>({columns:c.columns,name:c.name,tier:$t(c.shardMode)})),[g]),y=(0,ce.useMemo)(()=>{let c={};for(let N of g?.tables??[])c[N.name]=wt[N.status];return c},[g]);if(i.error!==null)return(0,o.jsx)(we,{error:i.errorSource,testId:"sh-error"});if(n.length===0)return(0,o.jsx)(ye,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let x=g?.changes??[];return(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,o.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,o.jsx)(Mt,{children:r("Schema versions")}),(0,o.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:n.map(c=>(0,o.jsx)(jt,{appliedAt:c.appliedAt,hash:c.hash,onSelect:d,selected:c.hash===u,seq:c.seq},c.hash))})]}),(0,o.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,o.jsx)(St,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),a==="diagram"?(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,o.jsx)(Ze,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:It(x).map(c=>{let N=(g?.tables??[]).find(k=>k.name===c.table);return(0,o.jsxs)("section",{className:"mb-6",children:[(0,o.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,o.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:c.table===""?r("schema"):c.table}),N!==void 0&&(0,o.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:N.columns.length})}),c.changes.length>1&&(0,o.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:c.changes.length})]}),(0,o.jsx)("ul",{children:c.changes.map(k=>{let{action:K,kind:M}=it[k.type],S=k.severity==="breaking",R=Ot(k,M);return(0,o.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,o.jsx)("span",{"aria-hidden":"true",className:ne("-ms-3 h-3 w-0.5 shrink-0 self-center",S?"bg-destructive":"bg-transparent")}),(0,o.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(K)," ",M]}),R!==c.table&&(0,o.jsx)("span",{className:ne("min-w-0 font-mono text-[13px]",S?"text-destructive":"text-foreground"),children:R}),S&&(0,o.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},c.table)})})]})]})},"ce"),qt=m(a=>ne("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",a?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"me"),da=m(a=>{let e=(0,me.c)(11),{initialShardKey:r}=a,s=oe(),[t,d]=(0,ce.useState)("diagram"),i;e[0]!==t?(i=m((v,p,g,f)=>(0,o.jsxs)("button",{"aria-selected":t===v,className:qt(t===v),"data-testid":g,onClick:m(()=>{d(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,o.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"i"),e[0]=t,e[1]=i):i=e[1];let n=i,u;e[2]!==s||e[3]!==n?(u=(0,o.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[n("diagram",s("Diagram"),"mg-pane-diagram"),n("changes",s("Changes"),"mg-pane-changes"),n("data",s("Data migrations"),"mg-pane-data")]}),e[2]=s,e[3]=n,e[4]=u):u=e[4];let b;e[5]!==r||e[6]!==t?(b=(0,o.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:t==="data"?(0,o.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,o.jsx)(tt,{initialShardKey:r})}):(0,o.jsx)(Rt,{pane:t,shardKey:r})}),e[5]=r,e[6]=t,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,o.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[u,b]}),e[8]=u,e[9]=b,e[10]=h):h=e[10],h},"je");export{da as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as L}from"./chunk-54MMVNPT.js";import{a as w}from"./chunk-MWIKAR7F.js";import"./chunk-DJZYD5I5.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{b as $}from"./chunk-
|
|
1
|
+
import{a as L}from"./chunk-54MMVNPT.js";import{a as w}from"./chunk-MWIKAR7F.js";import"./chunk-DJZYD5I5.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{b as $}from"./chunk-KMT6UDR7.js";import{f as A}from"./chunk-WVU7GHTG.js";import"./chunk-XBDKZZ67.js";import{a as j}from"./chunk-XQCVZAGU.js";import{a as z,b as B,c as E,d as g,e as i,f as l}from"./chunk-WJQLNYGX.js";import{a as I,e as S}from"./chunk-WQH3LT2P.js";import{d as k,o as R,r as _}from"./chunk-IUYFXK4X.js";import"./chunk-BR5GIQWK.js";import{a as h,e as y,g as O,h as Q}from"./chunk-3XIESWL4.js";var C=y(O(),1);var s=y(Q(),1);var T=200,U=h(()=>{let e=(0,C.c)(21),n=A(),t=k(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",T],e[0]=u):u=e[0];let p;e[1]!==n?(p=h(()=>n.listAuthSessions({limit:T}),"u"),e[1]=n,e[2]=p):p=e[2];let o=$(u,p),{error:f}=o,a=o.data?.rows??null,x;e[3]!==o?(x=h(()=>{o.refetch()},"p"),e[3]=o,e[4]=x):x=e[4],L(x,!0);let N;e[5]!==n||e[6]!==o?(N=h(r=>{R((async()=>{await n.revokeAuthSession({sessionId:r}),o.refetch()})())},"x"),e[5]=n,e[6]=o,e[7]=N):N=e[7];let b=N,d;e[8]!==f?(d=f!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:f}),e[8]=f,e[9]=d):d=e[9];let c;e[10]!==a||e[11]!==t?(c=a!==null&&a.length===0&&(0,s.jsx)(j,{testId:"auth-sessions-empty",title:t("No active sessions.")}),e[10]=a,e[11]=t,e[12]=c):c=e[12];let m;e[13]!==b||e[14]!==a||e[15]!==t?(m=a!==null&&a.length>0&&(0,s.jsx)(I,{className:"overflow-hidden py-0",children:(0,s.jsx)(S,{className:"px-0",children:(0,s.jsxs)(z,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(B,{children:(0,s.jsxs)(g,{children:[(0,s.jsx)(i,{children:t("user")}),(0,s.jsx)(i,{children:t("expires")}),(0,s.jsx)(i,{children:t("ip")}),(0,s.jsx)(i,{children:t("user agent")}),(0,s.jsx)(i,{children:t("impersonated by")}),(0,s.jsx)(i,{"aria-label":t("Actions")})]})}),(0,s.jsx)(E,{children:a.map(r=>(0,s.jsxs)(g,{"data-testid":`auth-session-${r.id}`,children:[(0,s.jsx)(l,{className:"font-mono text-xs",children:r.userId}),(0,s.jsx)(l,{className:"text-muted-foreground tabular-nums",children:_(r.expiresAt)}),(0,s.jsx)(l,{children:r.ipAddress??""}),(0,s.jsx)(l,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,s.jsx)(l,{className:"font-mono text-xs",children:r.impersonatedBy??""}),(0,s.jsx)(l,{children:(0,s.jsx)(w,{"data-testid":`auth-session-revoke-${r.id}`,onClick:h(()=>{b(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Revoke")})})]},r.id))})]})})}),e[13]=b,e[14]=a,e[15]=t,e[16]=m):m=e[16];let v;return e[17]!==d||e[18]!==c||e[19]!==m?(v=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[d,c,m]}),e[17]=d,e[18]=c,e[19]=m,e[20]=v):v=e[20],v},"Q");export{U as default};
|