@malloy-publisher/sdk 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -2885,7 +2885,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${u.do
2885
2885
  packageName="${u}"
2886
2886
  modelPath="${d}"
2887
2887
  accessToken={accessToken}
2888
- />`}D.axios.defaults.baseURL="http://localhost:4000";const $0r=new nIe(new Oo),B0r=new D.QueryClient;function q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["package",a,u,d,f],queryFn:()=>$0r.getPackage(u,d,f,!1,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},B0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Package Config"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsxs(D.List,{dense:!0,disablePadding:!0,children:[D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Name",secondary:d})}),!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fethching Package Metadata..."}),x&&(g.data&&D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Description",secondary:g.data.description})})||D.jsxRuntimeExports.jsxs(D.ListItem,{disablePadding:!0,dense:!0,sx:{mt:"20px"},children:[D.jsxRuntimeExports.jsx(D.ErrorIcon,{sx:{color:"grey.600",mr:"10px"}}),D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"No package manifest"})]})),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})})]})})}const U0r=new Aie(new Oo),z0r=new D.QueryClient;function H0r({connection:a}){return D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:a.name})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:a.type})})]},a.name)}function G0r(a){const{server:u,projectName:d,accessToken:f}=a,{data:m,isSuccess:g,isError:x,error:E}=D.useQuery({queryKey:["connections",u,d],queryFn:()=>U0r.listConnections(d,{baseURL:u,withCredentials:!f,headers:{Authorization:f&&`Bearer ${f}`}}),retry:!1},z0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Database Connections"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!g&&!x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Connections..."}),g&&m.data.length>0&&D.jsxRuntimeExports.jsx(D.Table,{size:"small",children:D.jsxRuntimeExports.jsxs(D.TableBody,{children:[D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Connection Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Type"})})]}),m.data.map(v=>D.jsxRuntimeExports.jsx(H0r,{connection:v},v.name))]})}),g&&m.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Connections"}),x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} - ${E.message}`})]})]})})}const W0r=new WHt(new Oo),V0r=new D.QueryClient;function Q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["databases",a,u,d,f],queryFn:()=>W0r.listDatabases(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},V0r),_=S=>S>=1024*1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} T`:S>=1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} G`:S>=1024*1024?`${(S/(1024*1024)).toFixed(2)} M`:`${(S/1024).toFixed(2)} K`;return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Embedded Databases"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Databases..."}),x&&g.data.length>0&&D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Database Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Table Rows"})})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(S=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(Y0r,{database:S})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:_(S.info.rowCount)})})]},S.path))})]})}),x&&g.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Embedded Databases"}),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})]})})}function Y0r({database:a}){const[u,d]=Pe.useState(!1);return D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{display:"flex",alignItems:"center"},onClick:()=>d(!u),style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",color:"primary",sx:{maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.path})," ",D.jsxRuntimeExports.jsx(D.Box$1,{sx:{display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mr:1,display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsxRuntimeExports.jsx("path",{d:"M11 7H6C5.46957 7 4.96086 7.21071 4.58579 7.58579C4.21071 7.96086 4 8.46957 4 9V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H15C15.5304 20 16.0391 19.7893 16.4142 19.4142C16.7893 19.0391 17 18.5304 17 18V13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M9 15L20 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M15 4H20V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),D.jsxRuntimeExports.jsx(K0r,{database:a,open:u,setClose:()=>d(!1)})]})}function K0r({database:a,open:u,setClose:d}){return D.jsxRuntimeExports.jsxs(D.Dialog,{open:u,onClose:d,maxWidth:"sm",fullWidth:!0,children:[D.jsxRuntimeExports.jsxs(D.DialogTitle,{children:["Schema:"," ",D.jsxRuntimeExports.jsx(D.Typography,{fontSize:"large",variant:"body2",fontFamily:"monospace",component:"span",children:a.path}),D.jsxRuntimeExports.jsx(D.IconButton,{"aria-label":"close",onClick:d,sx:{position:"absolute",right:8,top:8},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:"X"})})]}),D.jsxRuntimeExports.jsx(D.DialogContent,{children:D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:"NAME"}),D.jsxRuntimeExports.jsx(D.TableCell,{children:"TYPE"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:a.info.columns.map(f=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:f.name}),D.jsxRuntimeExports.jsx(D.TableCell,{children:f.type})]},f.name))})]})})})]})}function Nqe({items:a,defaultExpandedItems:u,navigate:d}){return D.jsxRuntimeExports.jsx(D.RichTreeView,{items:tgr(a,d),defaultExpandedItems:u,slots:{item:egr}})}const X0r=D.animated(D.Collapse);function J0r(a){const u=D.useSpring({to:{opacity:a.in?1:0,transform:`translate3d(0,${a.in?0:20}px,0)`}});return D.jsxRuntimeExports.jsx(X0r,{style:u,...a})}function Z0r({item:a,...u}){return D.jsxRuntimeExports.jsxs(D.TreeItem2Label,{...u,sx:{display:"flex",alignItems:"center",color:"grey.600"},children:[a.fileType==="directory"&&D.jsxRuntimeExports.jsx(D.FolderIcon,{})||a.fileType==="notebook"&&D.jsxRuntimeExports.jsx(D.ArticleIcon,{})||a.fileType==="model"&&D.jsxRuntimeExports.jsx(D.DataArrayIcon,{})||a.fileType=="database"&&D.jsxRuntimeExports.jsx(D.DnsIcon,{})||D.jsxRuntimeExports.jsx(D.ErrorIcon,{}),D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{marginLeft:"5px"},color:a.link?"primary.main":"grey.600",children:a.label})]})}const egr=Y.forwardRef(function(u,d){const{id:f,itemId:m,label:g,children:x,disabled:E,...v}=u,{getRootProps:_,getContentProps:S,getLabelProps:R,getIconContainerProps:w,getGroupTransitionProps:N,status:k,publicAPI:B}=D.unstable_useTreeItem2({id:f,itemId:m,children:x,label:g,disabled:E,rootRef:d}),P=B.getItem(m);return k.selected=!1,k.focused=!1,D.jsxRuntimeExports.jsx(D.TreeItem2Provider,{itemId:m,children:D.jsxRuntimeExports.jsxs(D.TreeItem2Root,{..._(v),children:[D.jsxRuntimeExports.jsxs(D.TreeItem2Content,{...S(),...P.link&&{onClick:()=>P.link()},sx:{pointerEvents:!P.selectable&&"none"},children:[D.jsxRuntimeExports.jsx(D.TreeItem2IconContainer,{...w(),children:D.jsxRuntimeExports.jsx(D.TreeItem2Icon,{status:k})}),D.jsxRuntimeExports.jsx(Z0r,{...R({item:P})})]}),x&&D.jsxRuntimeExports.jsx(J0r,{...N()})]})})});function tgr(a,u){const d=new Map;return a.map(f=>{let m=d;const g=f.path.split("/");g.forEach((x,E)=>{E===g.length-1?m.set(x,f):(m.has(x)||m.set(x,new Map),m=m.get(x))})}),Dqe(d,"",u)}function Dqe(a,u,d){const f=[];return a.forEach((m,g)=>{const x=g.endsWith(".malloy")&&"model"||g.endsWith(".malloynb")&&"notebook"||g.endsWith(".parquet")&&"database"||"unknown";x!=="unknown"?f.push({id:u+g,label:g,fileType:x,link:x==="model"||x==="notebook"?d.bind(null,u+g):void 0,selectable:x==="model"||x==="notebook"}):(u+=`${g}/`,f.push({id:u,label:g,fileType:"directory",selectable:!0,link:void 0,children:Dqe(m,u,d)}))}),f}D.axios.defaults.baseURL="http://localhost:4000";const rgr=new TM(new Oo),ngr=new D.QueryClient,igr=["notebooks/","models/"];function sgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isError:E,error:v,isLoading:_}=D.useQuery({queryKey:["models",a,u,d,f],queryFn:()=>rgr.listModels(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},ngr);return E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`}):_?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Models..."}):D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Semantic Models"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:x.data.length>0?D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((S,R)=>S.path.localeCompare(R.path)),defaultExpandedItems:igr,navigate:m}):D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"No models found"})})]})})}const ogr=new rIe(new Oo),agr=new D.QueryClient,lgr=["notebooks/"];function ugr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isLoading:E,isError:v,error:_}=D.useQuery({queryKey:["notebooks",a,u,d,f],queryFn:()=>ogr.listNotebooks(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},agr);return v?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${_.message}`}):E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebooks..."}):D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebooks"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:x.data.length>0?D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((S,R)=>S.path.localeCompare(R.path)),defaultExpandedItems:lgr,navigate:m}):D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"No notebooks found"})})]})})}D.axios.defaults.baseURL="http://localhost:4000";const cgr=new tGt(new Oo),dgr=new D.QueryClient;function fgr({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isError:x,isLoading:E,error:v}=D.useQuery({queryKey:["schedules",a,u,d,f],queryFn:()=>cgr.listSchedules(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},dgr);return E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Schedules..."}):x?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} > ${f} - ${v.message}`}):g.data.length?D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Scheduler"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsx(D.TableContainer,{component:D.Paper,children:D.jsxRuntimeExports.jsxs(D.Table,{sx:{minWidth:300},size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Resource"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Schedule"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Action"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Connection"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Last Run"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Status"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(_=>D.jsxRuntimeExports.jsxs(D.TableRow,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.resource}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.schedule}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.action}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.connection}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunTime?new Date(_.lastRunTime).toLocaleString():"n/a"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunStatus})]},_.resource))})]})})})]})}):null}const hgr="README.malloynb";function pgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){return m||(m=x=>{window.location.href=x}),D.jsxRuntimeExports.jsx(FIe,{server:a,accessToken:g,projectName:u,packageName:d,versionId:f,children:D.jsxRuntimeExports.jsxs(D.Grid,{container:!0,spacing:2,columns:12,sx:{mb:x=>x.spacing(2)},children:[D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(ugr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(sgr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(Q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(G0r,{navigate:m,server:a,projectName:u,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(fgr,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(kqe,{notebookPath:hgr,expandCodeCells:!0})})]})})}const mgr=Pe.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-DjdrYRPY.cjs")));function ggr({cell:a,notebookPath:u,queryResultCodeSnippet:d,expandCodeCell:f,hideCodeCellIcon:m,expandEmbedding:g,hideEmbeddingIcon:x}){const[E,v]=Pe.useState(f||a.type==="code"&&!a.result),[_,S]=Pe.useState(g),[R,w]=Pe.useState(),[N,k]=Pe.useState(),[B,P]=Pe.useState(!1);return Pe.useEffect(()=>{a.type==="code"&&zv(a.text,"malloy").then($=>{w($)})},[a]),Pe.useEffect(()=>{zv(d,"typescript").then($=>{k($)})},[d]),a.type==="markdown"&&D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{border:0},children:D.jsxRuntimeExports.jsx(Va,{children:D.jsxRuntimeExports.jsx(D.Markdown,{children:a.text})})})||a.type==="code"&&D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[(!m||!x&&a.result)&&D.jsxRuntimeExports.jsx(D.Stack,{sx:{flexDirection:"row",justifyContent:"right"},children:D.jsxRuntimeExports.jsxs(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:[!m&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:E?"Hide Code":"View Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{v(!E)},children:D.jsxRuntimeExports.jsx(D.CodeIcon,{})})}),!x&&a.result&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:_?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{S(!_)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})}),a.newSources&&a.newSources.length>0&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Explore Data Sources",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{P(!B),S(!1),v(!1)},children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h10v2H7v-2z",fill:"currentColor"})})})})]})}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:_,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:N}}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(d)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:E,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:D.jsxRuntimeExports.jsx(D.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:R}})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:B,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px"},children:D.jsxRuntimeExports.jsx(D.Typography,{children:"Sources"})}),D.jsxRuntimeExports.jsx(Uoe,{sourceAndPaths:a.newSources.map($=>({sourceInfo:JSON.parse($),modelPath:u}))})]}),a.result&&!B&&D.jsxRuntimeExports.jsxs(D.jsxRuntimeExports.Fragment,{children:[D.jsxRuntimeExports.jsx(D.Divider,{sx:{mb:"10px"}}),D.jsxRuntimeExports.jsx(D.CardContent,{sx:{minHeight:"100px",maxHeight:"800px",overflow:"auto"},children:D.jsxRuntimeExports.jsx(Pe.Suspense,{fallback:"Loading malloy...",children:D.jsxRuntimeExports.jsx(mgr,{result:a.result})})})]})]})}const xgr=new rIe(new Oo),ygr=new D.QueryClient;function kqe({notebookPath:a,expandCodeCells:u,hideCodeCellIcons:d,expandEmbeddings:f,hideEmbeddingIcons:m}){const[g,x]=Pe.useState(!1),[E,v]=Pe.useState(),{server:_,projectName:S,packageName:R,accessToken:w,versionId:N}=gS(),k=bgr(_,R,a,!0);Pe.useEffect(()=>{zv(k,"typescript").then(z=>{v(z)})},[g,k]);const{data:B,isSuccess:P,isError:$,error:q}=D.useQuery({queryKey:["notebook",_,S,R,a,N],queryFn:()=>xgr.getNotebook(S,R,a,N,{baseURL:_,withCredentials:!w,headers:{Authorization:w&&`Bearer ${w}`}}),retry:!1},ygr);return D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsxs(D.Stack,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebook"}),D.jsxRuntimeExports.jsx(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:D.jsxRuntimeExports.jsx(D.Tooltip,{title:g?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{x(!g)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:g,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:D.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:E}})}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(k)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsx(D.Divider,{})]}),D.jsxRuntimeExports.jsx(mS,{children:D.jsxRuntimeExports.jsxs(D.Stack,{spacing:1,component:"section",children:[!P&&!$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebook..."}),P&&B.data.notebookCells?.map((z,W)=>D.jsxRuntimeExports.jsx(ggr,{cell:z,notebookPath:a,queryResultCodeSnippet:vgr(_,S,R,a,z.text),expandCodeCell:u,hideCodeCellIcon:d,expandEmbedding:f,hideEmbeddingIcon:m},W)),$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:q.message.includes("404")&&`${a} does not exist`||`${S} > ${R} > ${a} > ${N} - ${q.message}`})]})})]})}function vgr(a,u,d,f,m){return`<QueryResult
2888
+ />`}D.axios.defaults.baseURL="http://localhost:4000";const $0r=new nIe(new Oo),B0r=new D.QueryClient;function q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["package",a,u,d,f],queryFn:()=>$0r.getPackage(u,d,f,!1,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},B0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Package Config"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsxs(D.List,{dense:!0,disablePadding:!0,children:[D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Name",secondary:d})}),!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fethching Package Metadata..."}),x&&(g.data&&D.jsxRuntimeExports.jsx(D.ListItem,{dense:!0,disablePadding:!0,children:D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"Description",secondary:g.data.description})})||D.jsxRuntimeExports.jsxs(D.ListItem,{disablePadding:!0,dense:!0,sx:{mt:"20px"},children:[D.jsxRuntimeExports.jsx(D.ErrorIcon,{sx:{color:"grey.600",mr:"10px"}}),D.jsxRuntimeExports.jsx(D.ListItemText,{primary:"No package manifest"})]})),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})})]})})}const U0r=new Aie(new Oo),z0r=new D.QueryClient;function H0r({connection:a}){return D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:a.name})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:a.type})})]},a.name)}function G0r(a){const{server:u,projectName:d,accessToken:f}=a,{data:m,isSuccess:g,isError:x,error:E}=D.useQuery({queryKey:["connections",u,d],queryFn:()=>U0r.listConnections(d,{baseURL:u,withCredentials:!f,headers:{Authorization:f&&`Bearer ${f}`}}),retry:!1},z0r);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Database Connections"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!g&&!x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Connections..."}),g&&m.data.length>0&&D.jsxRuntimeExports.jsx(D.Table,{size:"small",children:D.jsxRuntimeExports.jsxs(D.TableBody,{children:[D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Connection Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Type"})})]}),m.data.map(v=>D.jsxRuntimeExports.jsx(H0r,{connection:v},v.name))]})}),g&&m.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Connections"}),x&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} - ${E.message}`})]})]})})}const W0r=new WHt(new Oo),V0r=new D.QueryClient;function Q0r({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isSuccess:x,isError:E,error:v}=D.useQuery({queryKey:["databases",a,u,d,f],queryFn:()=>W0r.listDatabases(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},V0r),_=S=>S>=1024*1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} T`:S>=1024*1024*1024?`${(S/(1024*1024*1024)).toFixed(2)} G`:S>=1024*1024?`${(S/(1024*1024)).toFixed(2)} M`:`${(S/1024).toFixed(2)} K`;return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Embedded Databases"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[!x&&!E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Databases..."}),x&&g.data.length>0&&D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Database Name"})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"subtitle2",fontWeight:"bold",children:"Table Rows"})})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(S=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:D.jsxRuntimeExports.jsx(Y0r,{database:S})}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"right",children:D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:_(S.info.rowCount)})})]},S.path))})]})}),x&&g.data.length===0&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",children:"No Embedded Databases"}),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})]})})}function Y0r({database:a}){const[u,d]=Pe.useState(!1);return D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{display:"flex",alignItems:"center"},onClick:()=>d(!u),style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",color:"primary",sx:{maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.path})," ",D.jsxRuntimeExports.jsx(D.Box$1,{sx:{display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mr:1,display:"flex",alignItems:"center"},children:D.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsxRuntimeExports.jsx("path",{d:"M11 7H6C5.46957 7 4.96086 7.21071 4.58579 7.58579C4.21071 7.96086 4 8.46957 4 9V18C4 18.5304 4.21071 19.0391 4.58579 19.4142C4.96086 19.7893 5.46957 20 6 20H15C15.5304 20 16.0391 19.7893 16.4142 19.4142C16.7893 19.0391 17 18.5304 17 18V13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M9 15L20 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M15 4H20V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),D.jsxRuntimeExports.jsx(K0r,{database:a,open:u,setClose:()=>d(!1)})]})}function K0r({database:a,open:u,setClose:d}){return D.jsxRuntimeExports.jsxs(D.Dialog,{open:u,onClose:d,maxWidth:"sm",fullWidth:!0,children:[D.jsxRuntimeExports.jsxs(D.DialogTitle,{children:["Schema:"," ",D.jsxRuntimeExports.jsx(D.Typography,{fontSize:"large",variant:"body2",fontFamily:"monospace",component:"span",children:a.path}),D.jsxRuntimeExports.jsx(D.IconButton,{"aria-label":"close",onClick:d,sx:{position:"absolute",right:8,top:8},children:D.jsxRuntimeExports.jsx(D.Box$1,{sx:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:"X"})})]}),D.jsxRuntimeExports.jsx(D.DialogContent,{children:D.jsxRuntimeExports.jsx(D.TableContainer,{children:D.jsxRuntimeExports.jsxs(D.Table,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:"NAME"}),D.jsxRuntimeExports.jsx(D.TableCell,{children:"TYPE"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:a.info.columns.map(f=>D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{children:f.name}),D.jsxRuntimeExports.jsx(D.TableCell,{children:f.type})]},f.name))})]})})})]})}function Nqe({items:a,defaultExpandedItems:u,navigate:d}){return D.jsxRuntimeExports.jsx(D.RichTreeView,{items:tgr(a,d),defaultExpandedItems:u,slots:{item:egr}})}const X0r=D.animated(D.Collapse);function J0r(a){const u=D.useSpring({to:{opacity:a.in?1:0,transform:`translate3d(0,${a.in?0:20}px,0)`}});return D.jsxRuntimeExports.jsx(X0r,{style:u,...a})}function Z0r({item:a,...u}){return D.jsxRuntimeExports.jsxs(D.TreeItem2Label,{...u,sx:{display:"flex",alignItems:"center",color:"grey.600"},children:[a.fileType==="directory"&&D.jsxRuntimeExports.jsx(D.FolderIcon,{})||a.fileType==="notebook"&&D.jsxRuntimeExports.jsx(D.ArticleIcon,{})||a.fileType==="model"&&D.jsxRuntimeExports.jsx(D.DataArrayIcon,{})||a.fileType=="database"&&D.jsxRuntimeExports.jsx(D.DnsIcon,{})||D.jsxRuntimeExports.jsx(D.ErrorIcon,{}),D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{marginLeft:"5px"},color:a.link?"primary.main":"grey.600",children:a.label})]})}const egr=Y.forwardRef(function(u,d){const{id:f,itemId:m,label:g,children:x,disabled:E,...v}=u,{getRootProps:_,getContentProps:S,getLabelProps:R,getIconContainerProps:w,getGroupTransitionProps:N,status:k,publicAPI:B}=D.unstable_useTreeItem2({id:f,itemId:m,children:x,label:g,disabled:E,rootRef:d}),P=B.getItem(m);return k.selected=!1,k.focused=!1,D.jsxRuntimeExports.jsx(D.TreeItem2Provider,{itemId:m,children:D.jsxRuntimeExports.jsxs(D.TreeItem2Root,{..._(v),children:[D.jsxRuntimeExports.jsxs(D.TreeItem2Content,{...S(),...P.link&&{onClick:()=>P.link()},sx:{pointerEvents:!P.selectable&&"none"},children:[D.jsxRuntimeExports.jsx(D.TreeItem2IconContainer,{...w(),children:D.jsxRuntimeExports.jsx(D.TreeItem2Icon,{status:k})}),D.jsxRuntimeExports.jsx(Z0r,{...R({item:P})})]}),x&&D.jsxRuntimeExports.jsx(J0r,{...N()})]})})});function tgr(a,u){const d=new Map;return a.map(f=>{let m=d;const g=f.path.split("/");g.forEach((x,E)=>{E===g.length-1?m.set(x,f):(m.has(x)||m.set(x,new Map),m=m.get(x))})}),Dqe(d,"",u)}function Dqe(a,u,d){const f=[];return a.forEach((m,g)=>{const x=g.endsWith(".malloy")&&"model"||g.endsWith(".malloynb")&&"notebook"||g.endsWith(".parquet")&&"database"||"unknown";x!=="unknown"?f.push({id:u+g,label:g,fileType:x,link:x==="model"||x==="notebook"?d.bind(null,u+g):void 0,selectable:x==="model"||x==="notebook"}):(u+=`${g}/`,f.push({id:u,label:g,fileType:"directory",selectable:!0,link:void 0,children:Dqe(m,u,d)}))}),f}D.axios.defaults.baseURL="http://localhost:4000";const rgr=new TM(new Oo),ngr=new D.QueryClient,igr=["notebooks/","models/"];function sgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isError:E,error:v,isLoading:_,isSuccess:S}=D.useQuery({queryKey:["models",a,u,d,f],queryFn:()=>rgr.listModels(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},ngr);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Semantic Models"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[_&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Models..."}),S&&(x.data.length>0?D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((R,w)=>R.path.localeCompare(w.path)),defaultExpandedItems:igr,navigate:m}):D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"No models found"})),E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${v.message}`})]})]})})}const ogr=new rIe(new Oo),agr=new D.QueryClient,lgr=["notebooks/"];function ugr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){const{data:x,isLoading:E,isError:v,error:_,isSuccess:S}=D.useQuery({queryKey:["notebooks",a,u,d,f],queryFn:()=>ogr.listNotebooks(u,d,f,{baseURL:a,withCredentials:!g,headers:{Authorization:g&&`Bearer ${g}`}}),retry:!1},agr);return D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebooks"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:[E&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebooks..."}),S&&(x.data.length>0?D.jsxRuntimeExports.jsx(Nqe,{items:x.data.sort((R,w)=>R.path.localeCompare(w.path)),defaultExpandedItems:lgr,navigate:m}):D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"No notebooks found"})),v&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${u} > ${d} > ${f} - ${_.message}`})]})]})})}D.axios.defaults.baseURL="http://localhost:4000";const cgr=new tGt(new Oo),dgr=new D.QueryClient;function fgr({server:a,projectName:u,packageName:d,versionId:f,accessToken:m}){const{data:g,isError:x,isLoading:E,error:v}=D.useQuery({queryKey:["schedules",a,u,d,f],queryFn:()=>cgr.listSchedules(u,d,f,{baseURL:a,withCredentials:!m,headers:{Authorization:m&&`Bearer ${m}`}}),retry:!1},dgr);return E?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"20px",m:"auto"},children:"Fetching Schedules..."}):x?D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:`${d} > ${f} - ${v.message}`}):g.data.length?D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{padding:"10px",width:"100%"},children:D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Scheduler"}),D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Box$1,{sx:{mt:"10px",maxHeight:"200px",overflowY:"auto"},children:D.jsxRuntimeExports.jsx(D.TableContainer,{component:D.Paper,children:D.jsxRuntimeExports.jsxs(D.Table,{sx:{minWidth:300},size:"small",children:[D.jsxRuntimeExports.jsx(D.TableHead,{children:D.jsxRuntimeExports.jsxs(D.TableRow,{children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Resource"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Schedule"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Action"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Connection"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Last Run"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:"Status"})]})}),D.jsxRuntimeExports.jsx(D.TableBody,{children:g.data.map(_=>D.jsxRuntimeExports.jsxs(D.TableRow,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.resource}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.schedule}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.action}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.connection}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunTime?new Date(_.lastRunTime).toLocaleString():"n/a"}),D.jsxRuntimeExports.jsx(D.TableCell,{align:"left",children:_.lastRunStatus})]},_.resource))})]})})})]})}):null}const hgr="README.malloynb";function pgr({server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g}){return m||(m=x=>{window.location.href=x}),D.jsxRuntimeExports.jsx(FIe,{server:a,accessToken:g,projectName:u,packageName:d,versionId:f,children:D.jsxRuntimeExports.jsxs(D.Grid,{container:!0,spacing:2,columns:12,sx:{mb:x=>x.spacing(2)},children:[D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(ugr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:4},children:D.jsxRuntimeExports.jsx(sgr,{server:a,projectName:u,packageName:d,versionId:f,navigate:m,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(Q0r,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:6},children:D.jsxRuntimeExports.jsx(G0r,{navigate:m,server:a,projectName:u,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(fgr,{server:a,projectName:u,packageName:d,versionId:f,accessToken:g})}),D.jsxRuntimeExports.jsx(D.Grid,{size:{xs:12,md:12},children:D.jsxRuntimeExports.jsx(kqe,{notebookPath:hgr,expandCodeCells:!0})})]})})}const mgr=Pe.lazy(()=>Promise.resolve().then(()=>require("./RenderedResult-DjdrYRPY.cjs")));function ggr({cell:a,notebookPath:u,queryResultCodeSnippet:d,expandCodeCell:f,hideCodeCellIcon:m,expandEmbedding:g,hideEmbeddingIcon:x}){const[E,v]=Pe.useState(f||a.type==="code"&&!a.result),[_,S]=Pe.useState(g),[R,w]=Pe.useState(),[N,k]=Pe.useState(),[B,P]=Pe.useState(!1);return Pe.useEffect(()=>{a.type==="code"&&zv(a.text,"malloy").then($=>{w($)})},[a]),Pe.useEffect(()=>{zv(d,"typescript").then($=>{k($)})},[d]),a.type==="markdown"&&D.jsxRuntimeExports.jsx(mo,{variant:"outlined",sx:{border:0},children:D.jsxRuntimeExports.jsx(Va,{children:D.jsxRuntimeExports.jsx(D.Markdown,{children:a.text})})})||a.type==="code"&&D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[(!m||!x&&a.result)&&D.jsxRuntimeExports.jsx(D.Stack,{sx:{flexDirection:"row",justifyContent:"right"},children:D.jsxRuntimeExports.jsxs(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:[!m&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:E?"Hide Code":"View Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{v(!E)},children:D.jsxRuntimeExports.jsx(D.CodeIcon,{})})}),!x&&a.result&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:_?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{S(!_)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})}),a.newSources&&a.newSources.length>0&&D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Explore Data Sources",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{P(!B),S(!1),v(!1)},children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M3 3h18v18H3V3zm2 2v14h14V5H5zm2 2h10v2H7V7zm0 4h10v2H7v-2zm0 4h10v2H7v-2z",fill:"currentColor"})})})})]})}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:_,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:N}}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(d)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:E,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:D.jsxRuntimeExports.jsx(D.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:R}})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:B,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Stack,{sx:{p:"10px"},children:D.jsxRuntimeExports.jsx(D.Typography,{children:"Sources"})}),D.jsxRuntimeExports.jsx(Uoe,{sourceAndPaths:a.newSources.map($=>({sourceInfo:JSON.parse($),modelPath:u}))})]}),a.result&&!B&&D.jsxRuntimeExports.jsxs(D.jsxRuntimeExports.Fragment,{children:[D.jsxRuntimeExports.jsx(D.Divider,{sx:{mb:"10px"}}),D.jsxRuntimeExports.jsx(D.CardContent,{sx:{minHeight:"100px",maxHeight:"800px",overflow:"auto"},children:D.jsxRuntimeExports.jsx(Pe.Suspense,{fallback:"Loading malloy...",children:D.jsxRuntimeExports.jsx(mgr,{result:a.result})})})]})]})}const xgr=new rIe(new Oo),ygr=new D.QueryClient;function kqe({notebookPath:a,expandCodeCells:u,hideCodeCellIcons:d,expandEmbeddings:f,hideEmbeddingIcons:m}){const[g,x]=Pe.useState(!1),[E,v]=Pe.useState(),{server:_,projectName:S,packageName:R,accessToken:w,versionId:N}=gS(),k=bgr(_,R,a,!0);Pe.useEffect(()=>{zv(k,"typescript").then(z=>{v(z)})},[g,k]);const{data:B,isSuccess:P,isError:$,error:q}=D.useQuery({queryKey:["notebook",_,S,R,a,N],queryFn:()=>xgr.getNotebook(S,R,a,N,{baseURL:_,withCredentials:!w,headers:{Authorization:w&&`Bearer ${w}`}}),retry:!1},ygr);return D.jsxRuntimeExports.jsxs(mo,{variant:"outlined",children:[D.jsxRuntimeExports.jsxs(Va,{children:[D.jsxRuntimeExports.jsxs(D.Stack,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{variant:"overline",fontWeight:"bold",children:"Notebook"}),D.jsxRuntimeExports.jsx(D.CardActions,{sx:{padding:"0px 10px 0px 10px",mb:"auto",mt:"auto"},children:D.jsxRuntimeExports.jsx(D.Tooltip,{title:g?"Hide Embedding":"View Embedding",children:D.jsxRuntimeExports.jsx(D.IconButton,{size:"small",onClick:()=>{x(!g)},children:D.jsxRuntimeExports.jsx(D.LinkOutlinedIcon,{})})})})]}),D.jsxRuntimeExports.jsxs(D.Collapse,{in:g,timeout:"auto",unmountOnExit:!0,children:[D.jsxRuntimeExports.jsx(D.Divider,{}),D.jsxRuntimeExports.jsxs(D.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:[D.jsxRuntimeExports.jsx(D.Typography,{sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:D.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:E}})}),D.jsxRuntimeExports.jsx(D.Tooltip,{title:"Copy Embeddable Code",children:D.jsxRuntimeExports.jsx(D.IconButton,{sx:{width:"24px",height:"24px"},onClick:()=>{navigator.clipboard.writeText(k)},children:D.jsxRuntimeExports.jsx(D.ContentCopyIcon,{})})})]})]}),D.jsxRuntimeExports.jsx(D.Divider,{})]}),D.jsxRuntimeExports.jsx(mS,{children:D.jsxRuntimeExports.jsxs(D.Stack,{spacing:1,component:"section",children:[!P&&!$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:"Fetching Notebook..."}),P&&B.data.notebookCells?.map((z,W)=>D.jsxRuntimeExports.jsx(ggr,{cell:z,notebookPath:a,queryResultCodeSnippet:vgr(_,S,R,a,z.text),expandCodeCell:u,hideCodeCellIcon:d,expandEmbedding:f,hideEmbeddingIcon:m},W)),$&&D.jsxRuntimeExports.jsx(D.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:q.message.includes("404")&&`${a} does not exist`||`${S} > ${R} > ${a} > ${N} - ${q.message}`})]})})]})}function vgr(a,u,d,f,m){return`<QueryResult
2889
2889
  server="${a}"
2890
2890
  accessToken={accessToken}
2891
2891
  projectName="${u}"
package/dist/index.es.js CHANGED
@@ -138008,7 +138008,7 @@ function k1r({
138008
138008
  navigate: m,
138009
138009
  accessToken: g
138010
138010
  }) {
138011
- const { data: y, isError: E, error: v, isLoading: _ } = wa(
138011
+ const { data: y, isError: E, error: v, isLoading: _, isSuccess: S } = wa(
138012
138012
  {
138013
138013
  queryKey: ["models", a, u, d, f],
138014
138014
  queryFn: () => O1r.listModels(u, d, f, {
@@ -138022,10 +138022,10 @@ function k1r({
138022
138022
  },
138023
138023
  N1r
138024
138024
  );
138025
- return E ? /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: `${u} > ${d} > ${f} - ${v.message}` }) : _ ? /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "Fetching Models..." }) : /* @__PURE__ */ P.jsx(Ro, { variant: "outlined", sx: { padding: "10px", width: "100%" }, children: /* @__PURE__ */ P.jsxs(ul, { children: [
138025
+ return /* @__PURE__ */ P.jsx(Ro, { variant: "outlined", sx: { padding: "10px", width: "100%" }, children: /* @__PURE__ */ P.jsxs(ul, { children: [
138026
138026
  /* @__PURE__ */ P.jsx(yr, { variant: "overline", fontWeight: "bold", children: "Semantic Models" }),
138027
138027
  /* @__PURE__ */ P.jsx(ss, {}),
138028
- /* @__PURE__ */ P.jsx(
138028
+ /* @__PURE__ */ P.jsxs(
138029
138029
  Vi,
138030
138030
  {
138031
138031
  sx: {
@@ -138033,14 +138033,18 @@ function k1r({
138033
138033
  maxHeight: "200px",
138034
138034
  overflowY: "auto"
138035
138035
  },
138036
- children: y.data.length > 0 ? /* @__PURE__ */ P.jsx(
138037
- AUe,
138038
- {
138039
- items: y.data.sort((S, w) => S.path.localeCompare(w.path)),
138040
- defaultExpandedItems: D1r,
138041
- navigate: m
138042
- }
138043
- ) : /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "No models found" })
138036
+ children: [
138037
+ _ && /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "Fetching Models..." }),
138038
+ S && (y.data.length > 0 ? /* @__PURE__ */ P.jsx(
138039
+ AUe,
138040
+ {
138041
+ items: y.data.sort((w, R) => w.path.localeCompare(R.path)),
138042
+ defaultExpandedItems: D1r,
138043
+ navigate: m
138044
+ }
138045
+ ) : /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "No models found" })),
138046
+ E && /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: `${u} > ${d} > ${f} - ${v.message}` })
138047
+ ]
138044
138048
  }
138045
138049
  )
138046
138050
  ] }) });
@@ -138054,7 +138058,7 @@ function F1r({
138054
138058
  navigate: m,
138055
138059
  accessToken: g
138056
138060
  }) {
138057
- const { data: y, isLoading: E, isError: v, error: _ } = wa(
138061
+ const { data: y, isLoading: E, isError: v, error: _, isSuccess: S } = wa(
138058
138062
  {
138059
138063
  queryKey: ["notebooks", a, u, d, f],
138060
138064
  queryFn: () => L1r.listNotebooks(u, d, f, {
@@ -138068,10 +138072,10 @@ function F1r({
138068
138072
  },
138069
138073
  I1r
138070
138074
  );
138071
- return v ? /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: `${u} > ${d} > ${f} - ${_.message}` }) : E ? /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "Fetching Notebooks..." }) : /* @__PURE__ */ P.jsx(Ro, { variant: "outlined", sx: { padding: "10px", width: "100%" }, children: /* @__PURE__ */ P.jsxs(ul, { children: [
138075
+ return /* @__PURE__ */ P.jsx(Ro, { variant: "outlined", sx: { padding: "10px", width: "100%" }, children: /* @__PURE__ */ P.jsxs(ul, { children: [
138072
138076
  /* @__PURE__ */ P.jsx(yr, { variant: "overline", fontWeight: "bold", children: "Notebooks" }),
138073
138077
  /* @__PURE__ */ P.jsx(ss, {}),
138074
- /* @__PURE__ */ P.jsx(
138078
+ /* @__PURE__ */ P.jsxs(
138075
138079
  Vi,
138076
138080
  {
138077
138081
  sx: {
@@ -138079,14 +138083,18 @@ function F1r({
138079
138083
  maxHeight: "200px",
138080
138084
  overflowY: "auto"
138081
138085
  },
138082
- children: y.data.length > 0 ? /* @__PURE__ */ P.jsx(
138083
- AUe,
138084
- {
138085
- items: y.data.sort((S, w) => S.path.localeCompare(w.path)),
138086
- defaultExpandedItems: P1r,
138087
- navigate: m
138088
- }
138089
- ) : /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "No notebooks found" })
138086
+ children: [
138087
+ E && /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "Fetching Notebooks..." }),
138088
+ S && (y.data.length > 0 ? /* @__PURE__ */ P.jsx(
138089
+ AUe,
138090
+ {
138091
+ items: y.data.sort((w, R) => w.path.localeCompare(R.path)),
138092
+ defaultExpandedItems: P1r,
138093
+ navigate: m
138094
+ }
138095
+ ) : /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: "No notebooks found" })),
138096
+ v && /* @__PURE__ */ P.jsx(yr, { variant: "body2", sx: { p: "10px", m: "auto" }, children: `${u} > ${d} > ${f} - ${_.message}` })
138097
+ ]
138090
138098
  }
138091
138099
  )
138092
138100
  ] }) });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.0.25",
4
+ "version": "0.0.27",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -27,8 +27,8 @@
27
27
  "generate-api-types": "bunx openapi-generator-cli generate -i ../../api-doc.yaml -g typescript-axios -o src/client/"
28
28
  },
29
29
  "peerDependencies": {
30
- "react": "^18.3.1",
31
- "react-dom": "^18.3.0"
30
+ "react": "^19.1.0",
31
+ "react-dom": "^19.1.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@emotion/react": "^11.14.0",
@@ -51,10 +51,12 @@
51
51
  "devDependencies": {
52
52
  "@openapitools/openapi-generator-cli": "^2.13.5",
53
53
  "@types/k6": "^1.0.2",
54
- "@types/react": "^18.3.1",
54
+ "@types/react": "^19.1.7",
55
+ "@types/react-dom": "^19.1.6",
55
56
  "@typescript-eslint/eslint-plugin": "8.16.0",
56
57
  "@typescript-eslint/parser": "8.16.0",
57
58
  "@vitejs/plugin-react": "^4.4.1",
59
+ "ajv": "^8.12.0",
58
60
  "archiver": "^7.0.1",
59
61
  "eslint-config-prettier": "9.1.0",
60
62
  "eslint-plugin-prettier": "5.2.1",
@@ -64,7 +66,6 @@
64
66
  "shiki": "^1.16.3",
65
67
  "vite": "^6.3.2",
66
68
  "vite-plugin-dts": "^4.5.3",
67
- "vite-plugin-svgr": "^4.3.0",
68
- "ajv": "^8.12.0"
69
+ "vite-plugin-svgr": "^4.3.0"
69
70
  }
70
71
  }
@@ -28,7 +28,7 @@ export default function Models({
28
28
  navigate,
29
29
  accessToken,
30
30
  }: ModelsProps) {
31
- const { data, isError, error, isLoading } = useQuery(
31
+ const { data, isError, error, isLoading, isSuccess } = useQuery(
32
32
  {
33
33
  queryKey: ["models", server, projectName, packageName, versionId],
34
34
  queryFn: () =>
@@ -43,20 +43,6 @@ export default function Models({
43
43
  },
44
44
  queryClient,
45
45
  );
46
- if (isError) {
47
- return (
48
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
49
- {`${projectName} > ${packageName} > ${versionId} - ${error.message}`}
50
- </Typography>
51
- );
52
- }
53
- if (isLoading) {
54
- return (
55
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
56
- Fetching Models...
57
- </Typography>
58
- );
59
- }
60
46
 
61
47
  return (
62
48
  <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
@@ -72,17 +58,28 @@ export default function Models({
72
58
  overflowY: "auto",
73
59
  }}
74
60
  >
75
- {data.data.length > 0 ? (
76
- <FileTreeView
77
- items={data.data.sort((a, b) => {
78
- return a.path.localeCompare(b.path);
79
- })}
80
- defaultExpandedItems={DEFAULT_EXPANDED_FOLDERS}
81
- navigate={navigate}
82
- />
83
- ) : (
61
+ {isLoading && (
84
62
  <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
85
- No models found
63
+ Fetching Models...
64
+ </Typography>
65
+ )}
66
+ {isSuccess &&
67
+ (data.data.length > 0 ? (
68
+ <FileTreeView
69
+ items={data.data.sort((a, b) => {
70
+ return a.path.localeCompare(b.path);
71
+ })}
72
+ defaultExpandedItems={DEFAULT_EXPANDED_FOLDERS}
73
+ navigate={navigate}
74
+ />
75
+ ) : (
76
+ <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
77
+ No models found
78
+ </Typography>
79
+ ))}
80
+ {isError && (
81
+ <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
82
+ {`${projectName} > ${packageName} > ${versionId} - ${error.message}`}
86
83
  </Typography>
87
84
  )}
88
85
  </Box>
@@ -26,7 +26,7 @@ export default function Notebooks({
26
26
  navigate,
27
27
  accessToken,
28
28
  }: ModelsProps) {
29
- const { data, isLoading, isError, error } = useQuery(
29
+ const { data, isLoading, isError, error, isSuccess } = useQuery(
30
30
  {
31
31
  queryKey: ["notebooks", server, projectName, packageName, versionId],
32
32
  queryFn: () =>
@@ -42,22 +42,6 @@ export default function Notebooks({
42
42
  queryClient,
43
43
  );
44
44
 
45
- if (isError) {
46
- return (
47
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
48
- {`${projectName} > ${packageName} > ${versionId} - ${error.message}`}
49
- </Typography>
50
- );
51
- }
52
-
53
- if (isLoading) {
54
- return (
55
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
56
- Fetching Notebooks...
57
- </Typography>
58
- );
59
- }
60
-
61
45
  return (
62
46
  <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
63
47
  <StyledCardContent>
@@ -72,17 +56,28 @@ export default function Notebooks({
72
56
  overflowY: "auto",
73
57
  }}
74
58
  >
75
- {data.data.length > 0 ? (
76
- <FileTreeView
77
- items={data.data.sort((a, b) => {
78
- return a.path.localeCompare(b.path);
79
- })}
80
- defaultExpandedItems={DEFAULT_EXPANDED_FOLDERS}
81
- navigate={navigate}
82
- />
83
- ) : (
59
+ {isLoading && (
60
+ <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
61
+ Fetching Notebooks...
62
+ </Typography>
63
+ )}
64
+ {isSuccess &&
65
+ (data.data.length > 0 ? (
66
+ <FileTreeView
67
+ items={data.data.sort((a, b) => {
68
+ return a.path.localeCompare(b.path);
69
+ })}
70
+ defaultExpandedItems={DEFAULT_EXPANDED_FOLDERS}
71
+ navigate={navigate}
72
+ />
73
+ ) : (
74
+ <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
75
+ No notebooks found
76
+ </Typography>
77
+ ))}
78
+ {isError && (
84
79
  <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
85
- No notebooks found
80
+ {`${projectName} > ${packageName} > ${versionId} - ${error.message}`}
86
81
  </Typography>
87
82
  )}
88
83
  </Box>