@lunora/studio 1.0.0-alpha.160 → 1.0.0-alpha.161
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-FZ4DKTWL.js → chunk-2TING2GL.js} +1 -1
- package/dist/standalone/{chunk-N2KEHJFT.js → chunk-2TRQVHVB.js} +1 -1
- package/dist/standalone/{chunk-FZJD2AW6.js → chunk-47MNGCO3.js} +1 -1
- package/dist/standalone/{chunk-5EBAAJ4D.js → chunk-4DBQ5SKR.js} +1 -1
- package/dist/standalone/{chunk-S2DMXDVV.js → chunk-5QWWT4MQ.js} +1 -1
- package/dist/standalone/{chunk-YYIWZFCC.js → chunk-5RBMJLU3.js} +1 -1
- package/dist/standalone/{chunk-7NLTT26I.js → chunk-6O3S7WXH.js} +1 -1
- package/dist/standalone/{chunk-EXTJNNOY.js → chunk-77ABD6IO.js} +1 -1
- package/dist/standalone/{chunk-YTWAOTZD.js → chunk-7BT33DCY.js} +1 -1
- package/dist/standalone/{chunk-IJHCFEYG.js → chunk-7GIKCXST.js} +1 -1
- package/dist/standalone/{chunk-RCL6OSSI.js → chunk-7TMBTWOB.js} +1 -1
- package/dist/standalone/{chunk-LFGT7SHV.js → chunk-A4WUPHVS.js} +1 -1
- package/dist/standalone/{chunk-RJ52BWWR.js → chunk-BAD5XKB2.js} +1 -1
- package/dist/standalone/{chunk-OBRWA7NJ.js → chunk-BCWUDTGC.js} +1 -1
- package/dist/standalone/{chunk-JHP7UDU3.js → chunk-BXW56TIF.js} +1 -1
- package/dist/standalone/{chunk-KMXRGAJN.js → chunk-C2OGSFFX.js} +1 -1
- package/dist/standalone/{chunk-AE7ASECR.js → chunk-D425S3R7.js} +1 -1
- package/dist/standalone/{chunk-LKDXWSK3.js → chunk-EGBNTX2F.js} +1 -1
- package/dist/standalone/{chunk-NT2U7JJI.js → chunk-F6UOIYRB.js} +1 -1
- package/dist/standalone/{chunk-KAJ53T5A.js → chunk-FLDKPLIH.js} +1 -1
- package/dist/standalone/{chunk-5QKJ5G6Z.js → chunk-FXJ3JR2G.js} +1 -1
- package/dist/standalone/{chunk-I2LRZGW7.js → chunk-GV6Q6E2H.js} +1 -1
- package/dist/standalone/{chunk-VDTEOMR4.js → chunk-HNNQR357.js} +1 -1
- package/dist/standalone/{chunk-PO6QDP32.js → chunk-HNWAGXE5.js} +1 -1
- package/dist/standalone/{chunk-AOOJS3RO.js → chunk-IMJAKXYX.js} +1 -1
- package/dist/standalone/{chunk-ESR2SZ36.js → chunk-ITZ5DBYC.js} +1 -1
- package/dist/standalone/{chunk-YVYWT5AX.js → chunk-K4MMLXTS.js} +1 -1
- package/dist/standalone/{chunk-M2R7QUP7.js → chunk-KRCEE7F2.js} +1 -1
- package/dist/standalone/{chunk-XD6I4DFM.js → chunk-ONPZXPH3.js} +1 -1
- package/dist/standalone/{chunk-CAKOSEB7.js → chunk-PLLMTAUF.js} +1 -1
- package/dist/standalone/{chunk-5TB4AS52.js → chunk-Q2BZ5RXU.js} +1 -1
- package/dist/standalone/{chunk-PQTHMQHP.js → chunk-RGLFBZ4L.js} +1 -1
- package/dist/standalone/{chunk-5QTPE32B.js → chunk-RUCOJZLB.js} +1 -1
- package/dist/standalone/{chunk-I5FUZTVN.js → chunk-S73PI5NL.js} +1 -1
- package/dist/standalone/{chunk-24WQBQWW.js → chunk-SCH75BSE.js} +1 -1
- package/dist/standalone/{chunk-6MSV6AGL.js → chunk-SZMJJWZ7.js} +1 -1
- package/dist/standalone/{chunk-G57SBM72.js → chunk-TH6UI4LH.js} +1 -1
- package/dist/standalone/{chunk-LW4TJA4W.js → chunk-TL4VF5RD.js} +1 -1
- package/dist/standalone/{chunk-QJ7AIK4F.js → chunk-TUYZP2JI.js} +1 -1
- package/dist/standalone/{chunk-HQTWP46Z.js → chunk-U72TXF2F.js} +1 -1
- package/dist/standalone/{chunk-YAGZIUBA.js → chunk-UQAL4ZYN.js} +1 -1
- package/dist/standalone/{chunk-YAUA3WS7.js → chunk-UR76WGZW.js} +1 -1
- package/dist/standalone/{chunk-HF5NNUYU.js → chunk-VEADG4JP.js} +1 -1
- package/dist/standalone/{chunk-B7XC7OEM.js → chunk-WET3GBTR.js} +1 -1
- package/dist/standalone/{chunk-7DJSJJBN.js → chunk-WGF6ZNR4.js} +1 -1
- package/dist/standalone/{chunk-BCBNKE7J.js → chunk-XFDTF5ZV.js} +2 -2
- package/dist/standalone/{chunk-FS7BPB4J.js → chunk-YI2NGAAQ.js} +1 -1
- package/dist/standalone/{chunk-PDTRYBNK.js → chunk-YJOSAJ7G.js} +1 -1
- package/dist/standalone/{chunk-UCDF4BKD.js → chunk-YVAMBN6B.js} +1 -1
- package/dist/standalone/{chunk-R3Y3RWZE.js → chunk-YYNFZSTL.js} +1 -1
- package/dist/standalone/{chunk-NZIKF3FN.js → chunk-YZQ7ZNVC.js} +1 -1
- package/dist/standalone/{chunk-H3SID7AN.js → chunk-Z27OZWJR.js} +1 -1
- package/dist/standalone/{chunk-N4T2MINL.js → chunk-Z7RD62TC.js} +1 -1
- package/dist/standalone/{chunk-T7PDUIXF.js → chunk-ZCVI7NRT.js} +1 -1
- package/dist/standalone/{chunk-6L4BGYXK.js → chunk-ZJNKPIBV.js} +1 -1
- package/dist/standalone/{chunk-TC7TSIPJ.js → chunk-ZSUINQLW.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as it}from"./chunk-UK32ZCIK.js";import"./chunk-CSUROWL2.js";import"./chunk-TJRQUJFS.js";import"./chunk-TWTNWOJU.js";import"./chunk-WQYWA7U6.js";import{a as Me}from"./chunk-IMOHEGMV.js";import{a as rt}from"./chunk-BOTGXX4H.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5JDWLCSH.js";import{a as at}from"./chunk-SU737V7V.js";import{a as Ye}from"./chunk-S3CRZLGS.js";import{a as Xe}from"./chunk-IABM4BFJ.js";import{b as Ge}from"./chunk-OGUKYRFM.js";import{d as Je,e as Ae}from"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import{P as Pe}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ue}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as Be}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Se}from"./chunk-OBRWA7NJ.js";import"./chunk-ULIQFBZU.js";import"./chunk-5QTPE32B.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as le}from"./chunk-PQTHMQHP.js";import{f as Ee}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as we}from"./chunk-FKVZRPV5.js";import{a as Ze,b as et,c as tt,d as Fe,e as C,f as q}from"./chunk-HEAQVSNS.js";import{a as We,e as ze}from"./chunk-WUWBZPUK.js";import{d as de,f as He,g as Qe,h as Ve,o as $e,r as Ne}from"./chunk-FODLDLE2.js";import{a as o,d as oe,e as De,f as Le,g as _e,i as se}from"./chunk-YKXDMIHQ.js";var he=oe(Le(),1),me=oe(De(),1);var nt=oe(Le(),1);var S=oe(De(),1);var l=oe(_e(),1);var xt=He(R.runMigration),ot=o(t=>{let e=(0,nt.c)(98),{initialShardKey:i}=t,r=Ee(),a=de(),{queryShardKey:c,setShardKey:n,shardKey:s}=Ye(i),[u,b]=(0,S.useState)(""),[h,v]=(0,S.useState)("up"),[p,g]=(0,S.useState)(!0),[f,y]=(0,S.useState)(!1),[x,m]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),K;e[0]!==s?(K=s.trim(),e[0]=s,e[1]=K):K=e[1];let I=K===c,O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={},e[2]=O):O=e[2];let F;e[3]!==c?(F={live:!0,shardKey:c},e[3]=c,e[4]=F):F=e[4];let $=le(R.migrationStatus,O,F),N=$.data?.migrations??null,Oe=$.error,{errorSource:Ce,liveError:qe}=$,pe,fe;e[5]!==c||e[6]!==$.data?(pe=o(()=>{$.data!==void 0&&Ge(c)},"W"),fe=[$.data,c],e[5]=c,e[6]=$.data,e[7]=pe,e[8]=fe):(pe=e[7],fe=e[8]),(0,S.useEffect)(pe,fe);let ge;if(e[9]!==r||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==s||e[14]!==$||e[15]!==a){let M=o(async()=>{let Te=u.trim();if(Te===""){k(a("Enter a migration id")),m(null);return}y(!0),k(null);try{let Ie=await r.query(xt,{direction:h,dryRun:p,id:Te},Qe(s));m(Ie),$.refetch()}catch(Ie){let vt=Ie;m(null),k(Ve(vt))}y(!1)},"m");ge=o(()=>{$e(M())},"V"),e[9]=r,e[10]=h,e[11]=p,e[12]=u,e[13]=s,e[14]=$,e[15]=a,e[16]=ge}else ge=e[16];let be=ge,ve;e[17]===Symbol.for("react.memo_cache_sentinel")?(ve=o(M=>{b(M.target.value)},"Y"),e[17]=ve):ve=e[17];let ft=ve,xe;e[18]===Symbol.for("react.memo_cache_sentinel")?(xe=o(M=>{v(M.target.value==="down"?"down":"up")},"Z"),e[18]=xe):xe=e[18];let gt=xe,ye;e[19]===Symbol.for("react.memo_cache_sentinel")?(ye=o(M=>{g(M.target.checked)},"ee"),e[19]=ye):ye=e[19];let bt=ye,T;e[20]!==n||e[21]!==s?(T=(0,l.jsx)(Xe,{onChange:n,testId:"mg-shard-input",value:s}),e[20]=n,e[21]=s,e[22]=T):T=e[22];let D;e[23]!==qe?(D=(0,l.jsx)(rt,{message:qe,prefix:"mg"}),e[23]=qe,e[24]=D):D=e[24];let L;e[25]!==T||e[26]!==D?(L=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=L):L=e[27];let _;e[28]!==Oe||e[29]!==Ce?(_=Oe!==null&&(0,l.jsx)(Se,{error:Ce,testId:"mg-status-error"}),e[28]=Oe,e[29]=Ce,e[30]=_):_=e[30];let E;e[31]!==N||e[32]!==a?(E=N!==null&&N.length===0&&(0,l.jsx)(we,{description:a("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:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=E):E=e[33];let J;e[34]!==N||e[35]!==a?(J=N!==null&&N.length>0&&(0,l.jsx)(We,{className:"overflow-hidden py-0",children:(0,l.jsx)(ze,{className:"px-0",children:(0,l.jsxs)(Ze,{"data-testid":"mg-table",children:[(0,l.jsx)(et,{children:(0,l.jsxs)(Fe,{children:[(0,l.jsx)(C,{children:a("id")}),(0,l.jsx)(C,{children:a("direction")}),(0,l.jsx)(C,{children:a("status")}),(0,l.jsx)(C,{children:a("processed")}),(0,l.jsx)(C,{children:a("changed")}),(0,l.jsx)(C,{children:a("updated")}),(0,l.jsx)(C,{children:a("error")})]})}),(0,l.jsx)(tt,{children:N.map(yt)})]})})}),e[34]=N,e[35]=a,e[36]=J):J=e[36];let A;e[37]!==a?(A=a("Run migration"),e[37]=a,e[38]=A):A=e[38];let B;e[39]!==A?(B=(0,l.jsx)(Me,{children:A}),e[39]=A,e[40]=B):B=e[40];let P;e[41]!==a?(P=a("Migration id"),e[41]=a,e[42]=P):P=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let W;e[45]!==u||e[46]!==P||e[47]!==U?(W=(0,l.jsx)(Pe,{"aria-label":P,className:"w-auto","data-testid":"mg-id-input",onChange:ft,placeholder:U,value:u}),e[45]=u,e[46]=P,e[47]=U,e[48]=W):W=e[48];let z;e[49]!==a?(z=a("Direction"),e[49]=a,e[50]=z):z=e[50];let H;e[51]!==a?(H=a("up"),e[51]=a,e[52]=H):H=e[52];let Q;e[53]!==H?(Q=(0,l.jsx)("option",{value:"up",children:H}),e[53]=H,e[54]=Q):Q=e[54];let V;e[55]!==a?(V=a("down"),e[55]=a,e[56]=V):V=e[56];let G;e[57]!==V?(G=(0,l.jsx)("option",{value:"down",children:V}),e[57]=V,e[58]=G):G=e[58];let X;e[59]!==h||e[60]!==z||e[61]!==Q||e[62]!==G?(X=(0,l.jsxs)("select",{"aria-label":z,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:gt,value:h,children:[Q,G]}),e[59]=h,e[60]=z,e[61]=Q,e[62]=G,e[63]=X):X=e[63];let Y;e[64]!==p?(Y=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:bt,type:"checkbox"}),e[64]=p,e[65]=Y):Y=e[65];let Z;e[66]!==a?(Z=a("Dry run"),e[66]=a,e[67]=Z):Z=e[67];let ee;e[68]!==Y||e[69]!==Z?(ee=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Y,Z]}),e[68]=Y,e[69]=Z,e[70]=ee):ee=e[70];let te;e[71]!==p||e[72]!==be||e[73]!==f||e[74]!==I||e[75]!==a?(te=p?(0,l.jsx)(Ue,{"data-testid":"mg-run",disabled:f||!I,onClick:be,type:"button",children:a(f?"Running\u2026":"Run")}):(0,l.jsx)(at,{confirmLabel:a(f?"Running\u2026":"Run migration?"),disabled:f||!I,onConfirm:be,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=be,e[73]=f,e[74]=I,e[75]=a,e[76]=te):te=e[76];let ae;e[77]!==W||e[78]!==X||e[79]!==ee||e[80]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[W,X,ee,te]}),e[77]=W,e[78]=X,e[79]=ee,e[80]=te,e[81]=ae):ae=e[81];let re;e[82]!==B||e[83]!==ae?(re=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,ae]}),e[82]=B,e[83]=ae,e[84]=re):re=e[84];let ie;e[85]!==w?(ie=w!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ie):ie=e[86];let ne;e[87]!==x||e[88]!==a?(ne=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:x.status}),x.processed,a(", changed"),x.changed]}),e[87]=x,e[88]=a,e[89]=ne):ne=e[89];let ke;return e[90]!==L||e[91]!==_||e[92]!==E||e[93]!==J||e[94]!==re||e[95]!==ie||e[96]!==ne?(ke=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[L,_,E,J,re,ie,ne]}),e[90]=L,e[91]=_,e[92]=E,e[93]=J,e[94]=re,e[95]=ie,e[96]=ne,e[97]=ke):ke=e[97],ke},"yt");function yt(t){return(0,l.jsxs)(Fe,{"data-testid":`mg-row-${t.id}`,children:[(0,l.jsx)(q,{children:t.id}),(0,l.jsx)(q,{children:t.direction}),(0,l.jsx)(q,{children:(0,l.jsx)(Be,{variant:"secondary",children:t.status})}),(0,l.jsx)(q,{children:t.processed}),(0,l.jsx)(q,{children:t.changed}),(0,l.jsx)(q,{children:Ne(t.updatedAt)}),(0,l.jsx)(q,{children:t.error??""})]},t.id)}o(yt,"Je");var d=oe(_e(),1);var Re=1;function kt(t){let e={},i=Object.keys(t);i.sort();for(let r of i)e[r]=t[r];return e}o(kt,"ne");var ce=o(t=>typeof t=="object"&&t!==null,"w"),wt=o(t=>ce(t)&&ce(t.fields)&&ce(t.indexes)&&ce(t.relations)&&typeof t.shardMode=="string","se"),$t=o(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(i){return{error:`baseline is not valid JSON: ${i instanceof Error?i.message:String(i)}`,status:"invalid"}}if(!ce(e)||e.version!==Re||!ce(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Re)})`,status:"invalid"};for(let[i,r]of Object.entries(e.tables))if(!wt(r))return{error:`baseline table "${i}" 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:Re},status:"ok"}},"ie"),Nt=o((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((i,r)=>i===e.fields[r]),"ae"),st=o(t=>t.unique!==void 0,"J"),Ke=o(({nullable:t,optional:e,refined:i,unique:r,...a})=>JSON.stringify(kt(a)),"A"),dt=o(t=>({form:JSON.stringify([Ke(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"P"),lt=o(t=>t.kind==="union"&&t.members?t.members.map(e=>dt(e)):[dt({...t,nullable:!1,optional:!1})],"V"),St=o((t,e)=>{if(e.kind!=="union")return!1;let i=lt(e);return lt(t).every(r=>i.some(a=>a.form===r.form&&(r.refined||!a.refined)))},"oe"),j=o(t=>{switch(t.kind){case"array":return`array(${t.of?j(t.of):"?"})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?j(t.key):"?"}, ${t.of?j(t.of):"?"})`;case"union":return(t.members??[]).map(e=>j(e)).join(" | ");default:return t.kind}},"y"),ue=o((t,e,i)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:i,table:t,type:e}),"O"),je=o((t,e,i)=>({remediation:"none",scope:"table",severity:"safe",summary:i,table:t,type:e}),"F"),jt=o((t,e,i,r,a)=>{if(!(i.kind===r.kind&&(!a||Ke(i)===Ke(r))))return a&&St(i,r)?je(t,"widenedFieldShape",`field ${t}.${e} widened: ${j(i)} \u2192 ${j(r)} \u2014 every stored value stays valid`):i.kind!==r.kind?ue(t,"changedFieldKind",`field ${t}.${e} changed type: ${i.kind} \u2192 ${r.kind} \u2014 add a data migration to convert existing values`):ue(t,"changedFieldShape",`field ${t}.${e} changed shape: ${j(i)} \u2192 ${j(r)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"re"),Ot=o((t,e,i,r)=>{let a=[];return i.unique!==r.unique&&a.push(r.unique===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`):je(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),i.nullable!==r.nullable&&a.push(r.nullable===!0?je(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):ue(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),i.refined!==r.refined&&a.push(r.refined===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):je(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),a},"de"),ht=o((t,e,i,r)=>{let a=[],c=st(i)&&st(r),n=jt(t,e,i,r,c);return n&&a.push(n),c&&a.push(...Ot(t,e,i,r)),i.optional&&!r.optional?a.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!i.optional&&r.optional&&a.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),a},"K"),Ct=o((t,e,i)=>i.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"le"),qt=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.fields)){let n=e.fields[a];n===void 0?r.push(Ct(t,a,c)):r.push(...ht(t,a,n,c))}for(let a of Object.keys(e.fields))i.fields[a]===void 0&&r.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"ce"),It=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.indexes)){let n=e.indexes[a];if(n===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Nt(n,c)||r.push({remediation:"code",severity:"breaking",summary:`index ${a} on ${t} changed shape \u2014 a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(let a of Object.keys(e.indexes))i.indexes[a]===void 0&&r.push({remediation:"code",severity:"breaking",summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` would break`,table:t,scope:"table",type:"removedIndex"})},"ue"),Ft=o((t,e,i,r)=>{for(let a of Object.keys(i.relations))e.relations[a]===void 0&&r.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))i.relations[a]===void 0&&r.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${a}`,table:t,type:"removedRelation"})},"me"),Mt=o((t,e,i,r)=>{e.shardMode!==i.shardMode&&r.push({remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e.shardMode} \u2192 ${i.shardMode} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}),qt(t,e,i,r),It(t,e,i,r),Ft(t,e,i,r)},"fe"),Rt=o((t,e)=>{let i=[],r=t?.tables??{};for(let[a,c]of Object.entries(e.tables)){let n=r[a];if(n===void 0){i.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}Mt(a,n,c,i)}for(let a of Object.keys(r))e.tables[a]===void 0&&i.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${a} \u2014 its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:a,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",c=e.jurisdiction??"(none)";i.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${c} \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:i}},"he"),ct=o(t=>Object.entries(t.fields).map(([e,i])=>({name:e,optional:i.optional,ref:Object.values(t.relations).find(r=>r.field===e&&r.kind==="one")?.table,type:j(i)})),"H"),mt=o((t,e,i)=>{let r={},a=e?.fields??{},c=i?.fields??{};for(let[n,s]of Object.entries(c)){let u=a[n];u===void 0?r[n]=e===void 0?"unchanged":"added":r[n]=ht(t,n,u,s).length===0?"unchanged":"changed"}for(let n of Object.keys(a))c[n]===void 0&&(r[n]="removed");return r},"Q"),Kt=o((t,e)=>{let{changes:i}=Rt(t,e),r=new Set(i.filter(n=>n.scope==="table"&&n.table!==void 0).map(n=>n.table)),a=[],c=o((n,s)=>n?"added":r.has(s)?"changed":"context","o");for(let[n,s]of Object.entries(e.tables)){let u=t?.tables[n],b=c(u===void 0,n);a.push({columns:ct(s),fieldStatus:mt(n,u,s),name:n,shardMode:s.shardMode,status:b})}for(let[n,s]of Object.entries(t?.tables??{}))e.tables[n]===void 0&&a.push({columns:ct(s),fieldStatus:mt(n,s,void 0),name:n,shardMode:s.shardMode,status:"removed"});return a.sort((n,s)=>n.name.localeCompare(s.name)),{breakingCount:i.filter(n=>n.severity==="breaking").length,changes:i,tables:a}},"pe"),ut=o(t=>{let e=$t(t);return e.status==="ok"?e.snapshot:void 0},"L"),Tt={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"},Dt=o(t=>t==="global"?"global":"shard","be"),Lt=o(t=>{let e=(0,he.c)(24),{appliedAt:i,hash:r,onSelect:a,selected:c,seq:n}=t,s=c?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==s?(u=se("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",s),e[0]=s,e[1]=u):u=e[1];let b=`sh-version-${r}`,h;e[2]!==r||e[3]!==a?(h=o(()=>{a(r)},"h"),e[2]=r,e[3]=a,e[4]=h):h=e[4];let v;e[5]!==n?(v=(0,d.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",n]}),e[5]=n,e[6]=v):v=e[6];let p;e[7]!==r?(p=r.slice(0,7),e[7]=r,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,d.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,d.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]!==i?(y=Ne(i),e[14]=i,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,d.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 m;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(m=(0,d.jsx)("li",{children:(0,d.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]=m):m=e[23],m},"ve"),_t=o(t=>{let e=(0,he.c)(26),{breaking:i,count:r,first:a}=t,c=de();if(a){let g;e[0]!==r?(g=(0,d.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:r}),e[0]=r,e[1]=g):g=e[1];let f;e[2]!==c?(f=c("tables"),e[2]=c,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,d.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,d.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 n=i>0&&"text-destructive",s;e[9]!==n?(s=se("text-3xl leading-none font-light tracking-tight tabular-nums",n),e[9]=n,e[10]=s):s=e[10];let u;e[11]!==r||e[12]!==s?(u=(0,d.jsx)("span",{className:s,children:r}),e[11]=r,e[12]=s,e[13]=u):u=e[13];let b;e[14]!==r||e[15]!==c?(b=c(r===1?"change":"changes"),e[14]=r,e[15]=c,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,d.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]!==i||e[20]!==c?(v=i>0&&(0,d.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",c("{count} breaking",{count:i})]}),e[19]=i,e[20]=c,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,d.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},"xe"),pt={addedFieldConstraint:{action:"added",kind:"constraint"},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"},changedFieldShape:{action:"changed",kind:"field shape"},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"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},Et=o((t,e)=>{let i=`${pt[t.type].action} ${e} `;return t.summary.startsWith(i)?t.summary.slice(i.length):t.summary},"ye"),Jt=o(t=>{let e=new Map;for(let r of t){let a=r.table??"",c=e.get(a);c===void 0?e.set(a,[r]):c.push(r)}let i=[...e].map(([r,a])=>({changes:a,table:r}));return[...i.filter(r=>r.table!==""),...i.filter(r=>r.table==="")]},"ke"),At=o(t=>{let e=(0,he.c)(2),{children:i}=t,r;return e[0]!==i?(r=(0,d.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:i}),e[0]=i,e[1]=r):r=e[1],r},"$e"),Bt=o(({pane:t,shardKey:e=""})=>{let i=de(),r=Ae(),a=Je({strict:!1}).version,c=o(m=>{$e(r({search:{version:m},to:"/migrations"}))},"a"),n=le(R.schemaHistory,{},{shardKey:e}),s=n.data?.versions??[],u=a!==void 0&&s.some(m=>m.hash===a)?a:s[0]?.hash,b=s.findIndex(m=>m.hash===u),h=b===-1?void 0:s[b+1]?.hash,v=le(R.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=le(R.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,me.useMemo)(()=>{let m=ut(v.data?.version?.snapshotJson);if(m!==void 0)return Kt(ut(p.data?.version?.snapshotJson),m)},[v.data,p.data]),f=(0,me.useMemo)(()=>(g?.tables??[]).map(m=>({columns:m.columns,name:m.name,tier:Dt(m.shardMode)})),[g]),y=(0,me.useMemo)(()=>{let m={};for(let w of g?.tables??[])m[w.name]=Tt[w.status];return m},[g]);if(n.error!==null)return(0,d.jsx)(Se,{error:n.errorSource,testId:"sh-error"});if(s.length===0)return(0,d.jsx)(we,{description:i("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:i("No schema versions recorded yet.")});let x=g?.changes??[];return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,d.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,d.jsx)(At,{children:i("Schema versions")}),(0,d.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:s.map(m=>(0,d.jsx)(Lt,{appliedAt:m.appliedAt,hash:m.hash,onSelect:c,selected:m.hash===u,seq:m.seq},m.hash))})]}),(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,d.jsx)(_t,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),t==="diagram"?(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,d.jsx)(it,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:Jt(x).map(m=>{let w=(g?.tables??[]).find(k=>k.name===m.table);return(0,d.jsxs)("section",{className:"mb-6",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:m.table===""?i("schema"):m.table}),w!==void 0&&(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:i("{count} columns",{count:w.columns.length})}),m.changes.length>1&&(0,d.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:m.changes.length})]}),(0,d.jsx)("ul",{children:m.changes.map(k=>{let{action:K,kind:I}=pt[k.type],O=k.severity==="breaking",F=Et(k,I);return(0,d.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:se("-ms-3 h-3 w-0.5 shrink-0 self-center",O?"bg-destructive":"bg-transparent")}),(0,d.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[i(K)," ",I]}),F!==m.table&&(0,d.jsx)("span",{className:se("min-w-0 font-mono text-[13px]",O?"text-destructive":"text-foreground"),children:F}),O&&(0,d.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:i("breaking")})]},`${k.type}-${k.summary}`)})})]},m.table)})})]})]})},"we"),Pt=o(t=>se("-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",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Se"),ya=o(t=>{let e=(0,he.c)(11),{initialShardKey:i}=t,r=de(),[a,c]=(0,me.useState)("diagram"),n;e[0]!==a?(n=o((v,p,g,f)=>(0,d.jsxs)("button",{"aria-selected":a===v,className:Pt(a===v),"data-testid":g,onClick:o(()=>{c(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,d.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"a"),e[0]=a,e[1]=n):n=e[1];let s=n,u;e[2]!==r||e[3]!==s?(u=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[s("diagram",r("Diagram"),"mg-pane-diagram"),s("changes",r("Changes"),"mg-pane-changes"),s("data",r("Data migrations"),"mg-pane-data")]}),e[2]=r,e[3]=s,e[4]=u):u=e[4];let b;e[5]!==i||e[6]!==a?(b=(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,d.jsx)(ot,{initialShardKey:i})}):(0,d.jsx)(Bt,{pane:a,shardKey:i})}),e[5]=i,e[6]=a,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,d.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{ya as default};
|
|
1
|
+
import{a as it}from"./chunk-UK32ZCIK.js";import"./chunk-CSUROWL2.js";import"./chunk-TJRQUJFS.js";import"./chunk-TWTNWOJU.js";import"./chunk-WQYWA7U6.js";import{a as Me}from"./chunk-IMOHEGMV.js";import{a as rt}from"./chunk-BOTGXX4H.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5JDWLCSH.js";import{a as at}from"./chunk-SU737V7V.js";import{a as Ye}from"./chunk-S3CRZLGS.js";import{a as Xe}from"./chunk-IABM4BFJ.js";import{b as Ge}from"./chunk-OGUKYRFM.js";import{d as Je,e as Ae}from"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import{P as Pe}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ue}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as Be}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Se}from"./chunk-BCWUDTGC.js";import"./chunk-ULIQFBZU.js";import"./chunk-RUCOJZLB.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as le}from"./chunk-RGLFBZ4L.js";import{f as Ee}from"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as we}from"./chunk-FKVZRPV5.js";import{a as Ze,b as et,c as tt,d as Fe,e as C,f as q}from"./chunk-HEAQVSNS.js";import{a as We,e as ze}from"./chunk-WUWBZPUK.js";import{d as de,f as He,g as Qe,h as Ve,o as $e,r as Ne}from"./chunk-FODLDLE2.js";import{a as o,d as oe,e as De,f as Le,g as _e,i as se}from"./chunk-YKXDMIHQ.js";var he=oe(Le(),1),me=oe(De(),1);var nt=oe(Le(),1);var S=oe(De(),1);var l=oe(_e(),1);var xt=He(R.runMigration),ot=o(t=>{let e=(0,nt.c)(98),{initialShardKey:i}=t,r=Ee(),a=de(),{queryShardKey:c,setShardKey:n,shardKey:s}=Ye(i),[u,b]=(0,S.useState)(""),[h,v]=(0,S.useState)("up"),[p,g]=(0,S.useState)(!0),[f,y]=(0,S.useState)(!1),[x,m]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),K;e[0]!==s?(K=s.trim(),e[0]=s,e[1]=K):K=e[1];let I=K===c,O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={},e[2]=O):O=e[2];let F;e[3]!==c?(F={live:!0,shardKey:c},e[3]=c,e[4]=F):F=e[4];let $=le(R.migrationStatus,O,F),N=$.data?.migrations??null,Oe=$.error,{errorSource:Ce,liveError:qe}=$,pe,fe;e[5]!==c||e[6]!==$.data?(pe=o(()=>{$.data!==void 0&&Ge(c)},"W"),fe=[$.data,c],e[5]=c,e[6]=$.data,e[7]=pe,e[8]=fe):(pe=e[7],fe=e[8]),(0,S.useEffect)(pe,fe);let ge;if(e[9]!==r||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==s||e[14]!==$||e[15]!==a){let M=o(async()=>{let Te=u.trim();if(Te===""){k(a("Enter a migration id")),m(null);return}y(!0),k(null);try{let Ie=await r.query(xt,{direction:h,dryRun:p,id:Te},Qe(s));m(Ie),$.refetch()}catch(Ie){let vt=Ie;m(null),k(Ve(vt))}y(!1)},"m");ge=o(()=>{$e(M())},"V"),e[9]=r,e[10]=h,e[11]=p,e[12]=u,e[13]=s,e[14]=$,e[15]=a,e[16]=ge}else ge=e[16];let be=ge,ve;e[17]===Symbol.for("react.memo_cache_sentinel")?(ve=o(M=>{b(M.target.value)},"Y"),e[17]=ve):ve=e[17];let ft=ve,xe;e[18]===Symbol.for("react.memo_cache_sentinel")?(xe=o(M=>{v(M.target.value==="down"?"down":"up")},"Z"),e[18]=xe):xe=e[18];let gt=xe,ye;e[19]===Symbol.for("react.memo_cache_sentinel")?(ye=o(M=>{g(M.target.checked)},"ee"),e[19]=ye):ye=e[19];let bt=ye,T;e[20]!==n||e[21]!==s?(T=(0,l.jsx)(Xe,{onChange:n,testId:"mg-shard-input",value:s}),e[20]=n,e[21]=s,e[22]=T):T=e[22];let D;e[23]!==qe?(D=(0,l.jsx)(rt,{message:qe,prefix:"mg"}),e[23]=qe,e[24]=D):D=e[24];let L;e[25]!==T||e[26]!==D?(L=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=L):L=e[27];let _;e[28]!==Oe||e[29]!==Ce?(_=Oe!==null&&(0,l.jsx)(Se,{error:Ce,testId:"mg-status-error"}),e[28]=Oe,e[29]=Ce,e[30]=_):_=e[30];let E;e[31]!==N||e[32]!==a?(E=N!==null&&N.length===0&&(0,l.jsx)(we,{description:a("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:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=E):E=e[33];let J;e[34]!==N||e[35]!==a?(J=N!==null&&N.length>0&&(0,l.jsx)(We,{className:"overflow-hidden py-0",children:(0,l.jsx)(ze,{className:"px-0",children:(0,l.jsxs)(Ze,{"data-testid":"mg-table",children:[(0,l.jsx)(et,{children:(0,l.jsxs)(Fe,{children:[(0,l.jsx)(C,{children:a("id")}),(0,l.jsx)(C,{children:a("direction")}),(0,l.jsx)(C,{children:a("status")}),(0,l.jsx)(C,{children:a("processed")}),(0,l.jsx)(C,{children:a("changed")}),(0,l.jsx)(C,{children:a("updated")}),(0,l.jsx)(C,{children:a("error")})]})}),(0,l.jsx)(tt,{children:N.map(yt)})]})})}),e[34]=N,e[35]=a,e[36]=J):J=e[36];let A;e[37]!==a?(A=a("Run migration"),e[37]=a,e[38]=A):A=e[38];let B;e[39]!==A?(B=(0,l.jsx)(Me,{children:A}),e[39]=A,e[40]=B):B=e[40];let P;e[41]!==a?(P=a("Migration id"),e[41]=a,e[42]=P):P=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let W;e[45]!==u||e[46]!==P||e[47]!==U?(W=(0,l.jsx)(Pe,{"aria-label":P,className:"w-auto","data-testid":"mg-id-input",onChange:ft,placeholder:U,value:u}),e[45]=u,e[46]=P,e[47]=U,e[48]=W):W=e[48];let z;e[49]!==a?(z=a("Direction"),e[49]=a,e[50]=z):z=e[50];let H;e[51]!==a?(H=a("up"),e[51]=a,e[52]=H):H=e[52];let Q;e[53]!==H?(Q=(0,l.jsx)("option",{value:"up",children:H}),e[53]=H,e[54]=Q):Q=e[54];let V;e[55]!==a?(V=a("down"),e[55]=a,e[56]=V):V=e[56];let G;e[57]!==V?(G=(0,l.jsx)("option",{value:"down",children:V}),e[57]=V,e[58]=G):G=e[58];let X;e[59]!==h||e[60]!==z||e[61]!==Q||e[62]!==G?(X=(0,l.jsxs)("select",{"aria-label":z,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:gt,value:h,children:[Q,G]}),e[59]=h,e[60]=z,e[61]=Q,e[62]=G,e[63]=X):X=e[63];let Y;e[64]!==p?(Y=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:bt,type:"checkbox"}),e[64]=p,e[65]=Y):Y=e[65];let Z;e[66]!==a?(Z=a("Dry run"),e[66]=a,e[67]=Z):Z=e[67];let ee;e[68]!==Y||e[69]!==Z?(ee=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Y,Z]}),e[68]=Y,e[69]=Z,e[70]=ee):ee=e[70];let te;e[71]!==p||e[72]!==be||e[73]!==f||e[74]!==I||e[75]!==a?(te=p?(0,l.jsx)(Ue,{"data-testid":"mg-run",disabled:f||!I,onClick:be,type:"button",children:a(f?"Running\u2026":"Run")}):(0,l.jsx)(at,{confirmLabel:a(f?"Running\u2026":"Run migration?"),disabled:f||!I,onConfirm:be,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=be,e[73]=f,e[74]=I,e[75]=a,e[76]=te):te=e[76];let ae;e[77]!==W||e[78]!==X||e[79]!==ee||e[80]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[W,X,ee,te]}),e[77]=W,e[78]=X,e[79]=ee,e[80]=te,e[81]=ae):ae=e[81];let re;e[82]!==B||e[83]!==ae?(re=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,ae]}),e[82]=B,e[83]=ae,e[84]=re):re=e[84];let ie;e[85]!==w?(ie=w!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ie):ie=e[86];let ne;e[87]!==x||e[88]!==a?(ne=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:x.status}),x.processed,a(", changed"),x.changed]}),e[87]=x,e[88]=a,e[89]=ne):ne=e[89];let ke;return e[90]!==L||e[91]!==_||e[92]!==E||e[93]!==J||e[94]!==re||e[95]!==ie||e[96]!==ne?(ke=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[L,_,E,J,re,ie,ne]}),e[90]=L,e[91]=_,e[92]=E,e[93]=J,e[94]=re,e[95]=ie,e[96]=ne,e[97]=ke):ke=e[97],ke},"yt");function yt(t){return(0,l.jsxs)(Fe,{"data-testid":`mg-row-${t.id}`,children:[(0,l.jsx)(q,{children:t.id}),(0,l.jsx)(q,{children:t.direction}),(0,l.jsx)(q,{children:(0,l.jsx)(Be,{variant:"secondary",children:t.status})}),(0,l.jsx)(q,{children:t.processed}),(0,l.jsx)(q,{children:t.changed}),(0,l.jsx)(q,{children:Ne(t.updatedAt)}),(0,l.jsx)(q,{children:t.error??""})]},t.id)}o(yt,"Je");var d=oe(_e(),1);var Re=1;function kt(t){let e={},i=Object.keys(t);i.sort();for(let r of i)e[r]=t[r];return e}o(kt,"ne");var ce=o(t=>typeof t=="object"&&t!==null,"w"),wt=o(t=>ce(t)&&ce(t.fields)&&ce(t.indexes)&&ce(t.relations)&&typeof t.shardMode=="string","se"),$t=o(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(i){return{error:`baseline is not valid JSON: ${i instanceof Error?i.message:String(i)}`,status:"invalid"}}if(!ce(e)||e.version!==Re||!ce(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Re)})`,status:"invalid"};for(let[i,r]of Object.entries(e.tables))if(!wt(r))return{error:`baseline table "${i}" 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:Re},status:"ok"}},"ie"),Nt=o((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((i,r)=>i===e.fields[r]),"ae"),st=o(t=>t.unique!==void 0,"J"),Ke=o(({nullable:t,optional:e,refined:i,unique:r,...a})=>JSON.stringify(kt(a)),"A"),dt=o(t=>({form:JSON.stringify([Ke(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"P"),lt=o(t=>t.kind==="union"&&t.members?t.members.map(e=>dt(e)):[dt({...t,nullable:!1,optional:!1})],"V"),St=o((t,e)=>{if(e.kind!=="union")return!1;let i=lt(e);return lt(t).every(r=>i.some(a=>a.form===r.form&&(r.refined||!a.refined)))},"oe"),j=o(t=>{switch(t.kind){case"array":return`array(${t.of?j(t.of):"?"})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?j(t.key):"?"}, ${t.of?j(t.of):"?"})`;case"union":return(t.members??[]).map(e=>j(e)).join(" | ");default:return t.kind}},"y"),ue=o((t,e,i)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:i,table:t,type:e}),"O"),je=o((t,e,i)=>({remediation:"none",scope:"table",severity:"safe",summary:i,table:t,type:e}),"F"),jt=o((t,e,i,r,a)=>{if(!(i.kind===r.kind&&(!a||Ke(i)===Ke(r))))return a&&St(i,r)?je(t,"widenedFieldShape",`field ${t}.${e} widened: ${j(i)} \u2192 ${j(r)} \u2014 every stored value stays valid`):i.kind!==r.kind?ue(t,"changedFieldKind",`field ${t}.${e} changed type: ${i.kind} \u2192 ${r.kind} \u2014 add a data migration to convert existing values`):ue(t,"changedFieldShape",`field ${t}.${e} changed shape: ${j(i)} \u2192 ${j(r)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"re"),Ot=o((t,e,i,r)=>{let a=[];return i.unique!==r.unique&&a.push(r.unique===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`):je(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),i.nullable!==r.nullable&&a.push(r.nullable===!0?je(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):ue(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),i.refined!==r.refined&&a.push(r.refined===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):je(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),a},"de"),ht=o((t,e,i,r)=>{let a=[],c=st(i)&&st(r),n=jt(t,e,i,r,c);return n&&a.push(n),c&&a.push(...Ot(t,e,i,r)),i.optional&&!r.optional?a.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!i.optional&&r.optional&&a.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),a},"K"),Ct=o((t,e,i)=>i.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"le"),qt=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.fields)){let n=e.fields[a];n===void 0?r.push(Ct(t,a,c)):r.push(...ht(t,a,n,c))}for(let a of Object.keys(e.fields))i.fields[a]===void 0&&r.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"ce"),It=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.indexes)){let n=e.indexes[a];if(n===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Nt(n,c)||r.push({remediation:"code",severity:"breaking",summary:`index ${a} on ${t} changed shape \u2014 a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(let a of Object.keys(e.indexes))i.indexes[a]===void 0&&r.push({remediation:"code",severity:"breaking",summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` would break`,table:t,scope:"table",type:"removedIndex"})},"ue"),Ft=o((t,e,i,r)=>{for(let a of Object.keys(i.relations))e.relations[a]===void 0&&r.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))i.relations[a]===void 0&&r.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${a}`,table:t,type:"removedRelation"})},"me"),Mt=o((t,e,i,r)=>{e.shardMode!==i.shardMode&&r.push({remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e.shardMode} \u2192 ${i.shardMode} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}),qt(t,e,i,r),It(t,e,i,r),Ft(t,e,i,r)},"fe"),Rt=o((t,e)=>{let i=[],r=t?.tables??{};for(let[a,c]of Object.entries(e.tables)){let n=r[a];if(n===void 0){i.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}Mt(a,n,c,i)}for(let a of Object.keys(r))e.tables[a]===void 0&&i.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${a} \u2014 its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:a,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",c=e.jurisdiction??"(none)";i.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${c} \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:i}},"he"),ct=o(t=>Object.entries(t.fields).map(([e,i])=>({name:e,optional:i.optional,ref:Object.values(t.relations).find(r=>r.field===e&&r.kind==="one")?.table,type:j(i)})),"H"),mt=o((t,e,i)=>{let r={},a=e?.fields??{},c=i?.fields??{};for(let[n,s]of Object.entries(c)){let u=a[n];u===void 0?r[n]=e===void 0?"unchanged":"added":r[n]=ht(t,n,u,s).length===0?"unchanged":"changed"}for(let n of Object.keys(a))c[n]===void 0&&(r[n]="removed");return r},"Q"),Kt=o((t,e)=>{let{changes:i}=Rt(t,e),r=new Set(i.filter(n=>n.scope==="table"&&n.table!==void 0).map(n=>n.table)),a=[],c=o((n,s)=>n?"added":r.has(s)?"changed":"context","o");for(let[n,s]of Object.entries(e.tables)){let u=t?.tables[n],b=c(u===void 0,n);a.push({columns:ct(s),fieldStatus:mt(n,u,s),name:n,shardMode:s.shardMode,status:b})}for(let[n,s]of Object.entries(t?.tables??{}))e.tables[n]===void 0&&a.push({columns:ct(s),fieldStatus:mt(n,s,void 0),name:n,shardMode:s.shardMode,status:"removed"});return a.sort((n,s)=>n.name.localeCompare(s.name)),{breakingCount:i.filter(n=>n.severity==="breaking").length,changes:i,tables:a}},"pe"),ut=o(t=>{let e=$t(t);return e.status==="ok"?e.snapshot:void 0},"L"),Tt={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"},Dt=o(t=>t==="global"?"global":"shard","be"),Lt=o(t=>{let e=(0,he.c)(24),{appliedAt:i,hash:r,onSelect:a,selected:c,seq:n}=t,s=c?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==s?(u=se("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",s),e[0]=s,e[1]=u):u=e[1];let b=`sh-version-${r}`,h;e[2]!==r||e[3]!==a?(h=o(()=>{a(r)},"h"),e[2]=r,e[3]=a,e[4]=h):h=e[4];let v;e[5]!==n?(v=(0,d.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",n]}),e[5]=n,e[6]=v):v=e[6];let p;e[7]!==r?(p=r.slice(0,7),e[7]=r,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,d.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,d.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]!==i?(y=Ne(i),e[14]=i,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,d.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 m;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(m=(0,d.jsx)("li",{children:(0,d.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]=m):m=e[23],m},"ve"),_t=o(t=>{let e=(0,he.c)(26),{breaking:i,count:r,first:a}=t,c=de();if(a){let g;e[0]!==r?(g=(0,d.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:r}),e[0]=r,e[1]=g):g=e[1];let f;e[2]!==c?(f=c("tables"),e[2]=c,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,d.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,d.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 n=i>0&&"text-destructive",s;e[9]!==n?(s=se("text-3xl leading-none font-light tracking-tight tabular-nums",n),e[9]=n,e[10]=s):s=e[10];let u;e[11]!==r||e[12]!==s?(u=(0,d.jsx)("span",{className:s,children:r}),e[11]=r,e[12]=s,e[13]=u):u=e[13];let b;e[14]!==r||e[15]!==c?(b=c(r===1?"change":"changes"),e[14]=r,e[15]=c,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,d.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]!==i||e[20]!==c?(v=i>0&&(0,d.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",c("{count} breaking",{count:i})]}),e[19]=i,e[20]=c,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,d.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},"xe"),pt={addedFieldConstraint:{action:"added",kind:"constraint"},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"},changedFieldShape:{action:"changed",kind:"field shape"},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"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},Et=o((t,e)=>{let i=`${pt[t.type].action} ${e} `;return t.summary.startsWith(i)?t.summary.slice(i.length):t.summary},"ye"),Jt=o(t=>{let e=new Map;for(let r of t){let a=r.table??"",c=e.get(a);c===void 0?e.set(a,[r]):c.push(r)}let i=[...e].map(([r,a])=>({changes:a,table:r}));return[...i.filter(r=>r.table!==""),...i.filter(r=>r.table==="")]},"ke"),At=o(t=>{let e=(0,he.c)(2),{children:i}=t,r;return e[0]!==i?(r=(0,d.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:i}),e[0]=i,e[1]=r):r=e[1],r},"$e"),Bt=o(({pane:t,shardKey:e=""})=>{let i=de(),r=Ae(),a=Je({strict:!1}).version,c=o(m=>{$e(r({search:{version:m},to:"/migrations"}))},"a"),n=le(R.schemaHistory,{},{shardKey:e}),s=n.data?.versions??[],u=a!==void 0&&s.some(m=>m.hash===a)?a:s[0]?.hash,b=s.findIndex(m=>m.hash===u),h=b===-1?void 0:s[b+1]?.hash,v=le(R.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=le(R.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,me.useMemo)(()=>{let m=ut(v.data?.version?.snapshotJson);if(m!==void 0)return Kt(ut(p.data?.version?.snapshotJson),m)},[v.data,p.data]),f=(0,me.useMemo)(()=>(g?.tables??[]).map(m=>({columns:m.columns,name:m.name,tier:Dt(m.shardMode)})),[g]),y=(0,me.useMemo)(()=>{let m={};for(let w of g?.tables??[])m[w.name]=Tt[w.status];return m},[g]);if(n.error!==null)return(0,d.jsx)(Se,{error:n.errorSource,testId:"sh-error"});if(s.length===0)return(0,d.jsx)(we,{description:i("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:i("No schema versions recorded yet.")});let x=g?.changes??[];return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,d.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,d.jsx)(At,{children:i("Schema versions")}),(0,d.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:s.map(m=>(0,d.jsx)(Lt,{appliedAt:m.appliedAt,hash:m.hash,onSelect:c,selected:m.hash===u,seq:m.seq},m.hash))})]}),(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,d.jsx)(_t,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),t==="diagram"?(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,d.jsx)(it,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:Jt(x).map(m=>{let w=(g?.tables??[]).find(k=>k.name===m.table);return(0,d.jsxs)("section",{className:"mb-6",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:m.table===""?i("schema"):m.table}),w!==void 0&&(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:i("{count} columns",{count:w.columns.length})}),m.changes.length>1&&(0,d.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:m.changes.length})]}),(0,d.jsx)("ul",{children:m.changes.map(k=>{let{action:K,kind:I}=pt[k.type],O=k.severity==="breaking",F=Et(k,I);return(0,d.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:se("-ms-3 h-3 w-0.5 shrink-0 self-center",O?"bg-destructive":"bg-transparent")}),(0,d.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[i(K)," ",I]}),F!==m.table&&(0,d.jsx)("span",{className:se("min-w-0 font-mono text-[13px]",O?"text-destructive":"text-foreground"),children:F}),O&&(0,d.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:i("breaking")})]},`${k.type}-${k.summary}`)})})]},m.table)})})]})]})},"we"),Pt=o(t=>se("-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",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Se"),ya=o(t=>{let e=(0,he.c)(11),{initialShardKey:i}=t,r=de(),[a,c]=(0,me.useState)("diagram"),n;e[0]!==a?(n=o((v,p,g,f)=>(0,d.jsxs)("button",{"aria-selected":a===v,className:Pt(a===v),"data-testid":g,onClick:o(()=>{c(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,d.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"a"),e[0]=a,e[1]=n):n=e[1];let s=n,u;e[2]!==r||e[3]!==s?(u=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[s("diagram",r("Diagram"),"mg-pane-diagram"),s("changes",r("Changes"),"mg-pane-changes"),s("data",r("Data migrations"),"mg-pane-data")]}),e[2]=r,e[3]=s,e[4]=u):u=e[4];let b;e[5]!==i||e[6]!==a?(b=(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,d.jsx)(ot,{initialShardKey:i})}):(0,d.jsx)(Bt,{pane:a,shardKey:i})}),e[5]=i,e[6]=a,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,d.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{ya as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as J}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as J}from"./chunk-BCWUDTGC.js";import"./chunk-ULIQFBZU.js";import"./chunk-RUCOJZLB.js";import"./chunk-35DM4JJG.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as z}from"./chunk-RGLFBZ4L.js";import"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as E}from"./chunk-FKVZRPV5.js";import{a as G,b as M,c as U,d as P,e as d,f as c}from"./chunk-HEAQVSNS.js";import{a as D,e as _}from"./chunk-WUWBZPUK.js";import{d as q}from"./chunk-FODLDLE2.js";import{a as S,d as O,f as Q,g as V}from"./chunk-YKXDMIHQ.js";var L=O(Q(),1);var r=O(V(),1);var K=["read","insert","update","delete"],B=S((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"z"),W=S(e=>{let s=new Map;for(let a of e){let t=s.get(a.table)??{operations:new Set,procedures:new Set,table:a.table};t.operations.add(a.on),t.procedures.add(a.procedure),s.set(a.table,t)}return[...s.values()].toSorted((a,t)=>a.table.localeCompare(t.table))},"J"),ie=S(()=>{let e=(0,L.c)(49),s=q(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:t,error:R,errorSource:k}=z(H.rlsPolicies,a),p=t!==void 0,m,n,h,l,f,u,x,b,o;if(e[1]!==t||e[2]!==R||e[3]!==k||e[4]!==p||e[5]!==s){let $=W(Array.isArray(t?.policies)?t.policies:[]),j;e[15]!==t?(j=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=j):j=e[16],n=j,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==R||e[18]!==k?(o=R!==null&&(0,r.jsx)(J,{error:k,testId:"rls-error"}),e[17]=R,e[18]=k,e[19]=o):o=e[19],u="flex flex-col gap-2",m=D,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(l=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=l):l=e[23],f=p&&$.length===0?(0,r.jsx)(E,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),K.map(i=>(0,r.jsx)(d,{children:B(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)(U,{children:$.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),K.map(F=>(0,r.jsx)(c,{children:i.operations.has(F)?(0,r.jsx)(C,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},F)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:[...i.procedures].join(", ")})]},i.table))})]})}),e[1]=t,e[2]=R,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=l,e[10]=f,e[11]=u,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],l=e[9],f=e[10],u=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==l||e[27]!==f?(N=(0,r.jsxs)(m,{className:h,children:[l,f]}),e[24]=m,e[25]=h,e[26]=l,e[27]=f,e[28]=N):N=e[28];let g;e[29]!==u||e[30]!==N?(g=(0,r.jsx)("section",{className:u,children:N}),e[29]=u,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(E,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)(U,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let T;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(T=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=T):T=e[48],T},"oe");function X(e){return(0,r.jsx)(C,{variant:"outline",children:e},e)}S(X,"K");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}S(Y,"V");export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-U5JDESCI.js";import"./chunk-I52I2DJG.js";import"./chunk-TWTNWOJU.js";import{a as Ve}from"./chunk-TIUMFAN2.js";import{a as qe}from"./chunk-BOTGXX4H.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{a as Le}from"./chunk-S3CRZLGS.js";import{a as _e}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as ke}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as ie}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as me}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import"./chunk-35DM4JJG.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-PQTHMQHP.js";import{f as Ne}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import{b as Ie,c as $e}from"./chunk-3LTNH237.js";import{a as Ae}from"./chunk-FKVZRPV5.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HEAQVSNS.js";import{a as Me,e as Ce}from"./chunk-WUWBZPUK.js";import{d as ue,f as re,g as be,h as Ke,o as le,r as Te}from"./chunk-FODLDLE2.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-YKXDMIHQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
1
|
+
import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-U5JDESCI.js";import"./chunk-I52I2DJG.js";import"./chunk-TWTNWOJU.js";import{a as Ve}from"./chunk-TIUMFAN2.js";import{a as qe}from"./chunk-BOTGXX4H.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{a as Le}from"./chunk-S3CRZLGS.js";import{a as _e}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as ke}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as ie}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as me}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import"./chunk-35DM4JJG.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-RGLFBZ4L.js";import{f as Ne}from"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import{b as Ie,c as $e}from"./chunk-3LTNH237.js";import{a as Ae}from"./chunk-FKVZRPV5.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HEAQVSNS.js";import{a as Me,e as Ce}from"./chunk-WUWBZPUK.js";import{d as ue,f as re,g as be,h as Ke,o as le,r as Te}from"./chunk-FODLDLE2.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-YKXDMIHQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T}from"./chunk-ULIQFBZU.js";import{a as S}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-ULIQFBZU.js";import{a as S}from"./chunk-RUCOJZLB.js";import{b as q}from"./chunk-35DM4JJG.js";import{b as I}from"./chunk-3LTNH237.js";import{d as A,h as E,j as H,k as O}from"./chunk-FODLDLE2.js";import{a as j,d as C,f as U,g as _}from"./chunk-YKXDMIHQ.js";var V=C(U(),1);var i=C(_(),1);var L=j(G=>{let e=(0,V.c)(38),{className:w,error:t,testId:N}=G,g=A(),r=q(),l,s,n,a,c,m,o,d;if(e[0]!==w||e[1]!==t||e[2]!==r||e[3]!==N){let y=H(t),b;e[12]!==t?(b=O(t),e[12]=t,e[13]=b):b=e[13],s=b;let x;e[14]!==t?(x=S(t),e[14]=t,e[15]=x):x=e[15];let k=x,v;e[16]!==r||e[17]!==k?(v=j(()=>{r?.openConsole({errorsOnly:!0,seq:k})},"x"),e[16]=r,e[17]=k,e[18]=v):v=e[18],n=v,l=T,a=w,c=N,m="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(o=(0,i.jsx)("p",{className:"font-medium",children:u}),e[21]=u,e[22]=o):o=e[22],d=y===void 0?null:(0,i.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(y)}),e[0]=w,e[1]=t,e[2]=r,e[3]=N,e[4]=l,e[5]=s,e[6]=n,e[7]=a,e[8]=c,e[9]=m,e[10]=o,e[11]=d}else l=e[4],s=e[5],n=e[6],a=e[7],c=e[8],m=e[9],o=e[10],d=e[11];let p;e[23]!==s?(p=s===void 0?null:(0,i.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=s,e[24]=p):p=e[24];let f;e[25]!==r||e[26]!==n||e[27]!==g?(f=r===void 0?null:(0,i.jsx)("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:n,type:"button",children:g("Show in console")}),e[25]=r,e[26]=n,e[27]=g,e[28]=f):f=e[28];let h;return e[29]!==l||e[30]!==a||e[31]!==c||e[32]!==m||e[33]!==o||e[34]!==d||e[35]!==p||e[36]!==f?(h=(0,i.jsxs)(l,{className:a,testId:c,variant:m,children:[o,d,p,f]}),e[29]=l,e[30]=a,e[31]=c,e[32]=m,e[33]=o,e[34]=d,e[35]=p,e[36]=f,e[37]=h):h=e[37],h},"G");export{L as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as k}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as q}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as j}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as U}from"./chunk-
|
|
1
|
+
import{P as k}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as q}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as j}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as U}from"./chunk-BCWUDTGC.js";import"./chunk-ULIQFBZU.js";import"./chunk-RUCOJZLB.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-RGLFBZ4L.js";import"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as M}from"./chunk-FKVZRPV5.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HEAQVSNS.js";import{a as z,e as D}from"./chunk-WUWBZPUK.js";import{d as F,r as O}from"./chunk-FODLDLE2.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-YKXDMIHQ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as nt,b as rt}from"./chunk-
|
|
1
|
+
import{a as nt,b as rt}from"./chunk-7BT33DCY.js";import{c as tt}from"./chunk-INWAISDG.js";import{a as et}from"./chunk-ZCVI7NRT.js";import"./chunk-TJRQUJFS.js";import"./chunk-TWTNWOJU.js";import"./chunk-WQYWA7U6.js";import"./chunk-XZMOZFE6.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ze}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-UVB3R7NI.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import"./chunk-SU737V7V.js";import{a as Xe}from"./chunk-IABM4BFJ.js";import{b as Ve}from"./chunk-OGUKYRFM.js";import{c as Ke,d as qe,e as Ee,f as _e,g as Pe}from"./chunk-OKG3HWSJ.js";import{P as Ye}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{a as Je}from"./chunk-ULIQFBZU.js";import{a as Ne}from"./chunk-4ZEL6BYL.js";import"./chunk-RGLFBZ4L.js";import{f as Le}from"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import"./chunk-HEAQVSNS.js";import{d as ce,f as we,g as ke,h as Ge,o as ue}from"./chunk-FODLDLE2.js";import{a as l,d as We,e as wt,f as kt,g as Nt,i as me}from"./chunk-YKXDMIHQ.js";var G=We(kt(),1);var z=We(wt(),1);var d=We(Nt(),1);var qt="x",ot=" ",Ct={'"':'"',"'":"'","[":"]","`":"`"},ct=l((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
|
|
2
2
|
`;)n+=1;return n},"tt"),dt=l((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"nt"),ut=l(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=Ct[t];if(t==="-"&&s[n+1]==="-"){let r=ct(s,n);e.fill(ot,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=dt(s,n);if(r===-1)return;e.fill(ot,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(qt,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
|
|
3
3
|
`&&(e[t]=`
|
|
4
4
|
`);return e.join("")},"st"),Tt=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,It=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|truncate|update|vacuum)\b|\breplace\b(?!\s*\()/iu,Rt=/^\w+/u,Lt=/;\s*$/u,Et=/\s/u,mt=l(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&Et.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=ct(s,e);else if(n==="/"&&s[e+1]==="*"){let t=dt(s,e);if(t===-1)break;e=t}else break}return e},"ot"),_t=l(s=>{let e=mt(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=(ut(n)??n).replace(Lt,""),o=n.slice(0,t.length),r=t.indexOf(";");if(r!==-1)return{code:"SQL_MULTIPLE_STATEMENTS",length:1,message:"only a single statement may be run",offset:e+r};let a="the SQL editor is read-only \u2014 only SELECT / WITH / EXPLAIN queries are allowed";if(!Tt.test(o))return{code:"SQL_NOT_READONLY",length:Rt.exec(o)?.[0].length??1,message:a,offset:e};let c=It.exec(o);if(c!==null)return{code:"SQL_NOT_READONLY",length:c[0].length,message:`${a} (\`${c[0].toUpperCase()}\` is not allowed)`,offset:e+c.index}},"Ot"),Ot=/^explain\b/iu,Dt=l(s=>Ot.test(s.slice(mt(s)))?s:`EXPLAIN QUERY PLAN ${s}`,"Mt"),Qe=l((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),o=_t(n);return o?.code==="SQL_EMPTY"?[]:[o===void 0?{offset:t,sql:n}:{offset:t,rejection:o,sql:n}]},"Fe"),ft=l(s=>{let e=ut(s);if(e===void 0)return Qe(s,0);let n=[],t=0;for(let o=0;o<=e.length;o+=1)o!==e.length&&e[o]!==";"||(n.push(...Qe(s.slice(t,o),t)),t=o+1);return n},"lt"),Mt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],At=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),$t=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),Bt=Mt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ht=At.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te}from"./chunk-SU737V7V.js";import{a as Z}from"./chunk-S3CRZLGS.js";import{a as Y}from"./chunk-IABM4BFJ.js";import{b as X}from"./chunk-OGUKYRFM.js";import{a as W}from"./chunk-K7AJEMKE.js";import{e as G}from"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as ae,c as ne}from"./chunk-2LVK7QRD.js";import{a as q,b as ee}from"./chunk-
|
|
1
|
+
import{a as te}from"./chunk-SU737V7V.js";import{a as Z}from"./chunk-S3CRZLGS.js";import{a as Y}from"./chunk-IABM4BFJ.js";import{b as X}from"./chunk-OGUKYRFM.js";import{a as W}from"./chunk-K7AJEMKE.js";import{e as G}from"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as ae,c as ne}from"./chunk-2LVK7QRD.js";import{a as q,b as ee}from"./chunk-K4MMLXTS.js";import{a as Q}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import"./chunk-BCWUDTGC.js";import"./chunk-ULIQFBZU.js";import"./chunk-RUCOJZLB.js";import"./chunk-35DM4JJG.js";import{a as I}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-RGLFBZ4L.js";import{f as D}from"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import"./chunk-HEAQVSNS.js";import"./chunk-WUWBZPUK.js";import{d as M,f as C,g as A,l as V,o as N}from"./chunk-FODLDLE2.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-YKXDMIHQ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"L"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:V(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(Q,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=D(),a=G(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te}from"./chunk-EA2JKR5D.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-PQTHMQHP.js";import{f as M}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
|
|
1
|
+
import{a as te}from"./chunk-EA2JKR5D.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-RGLFBZ4L.js";import{f as M}from"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-Q3WZBID4.js";import{a as k}from"./chunk-2ES4GR4C.js";import"./chunk-4GTO7FL5.js";import"./chunk-UVB3R7NI.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-Q3WZBID4.js";import{a as k}from"./chunk-2ES4GR4C.js";import"./chunk-4GTO7FL5.js";import"./chunk-UVB3R7NI.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-BCWUDTGC.js";import"./chunk-ULIQFBZU.js";import"./chunk-RUCOJZLB.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-RGLFBZ4L.js";import"./chunk-XFDTF5ZV.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-FODLDLE2.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
|