@malloy-publisher/server 0.0.151 → 0.0.152
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/app/api-doc.yaml +43 -2
- package/dist/app/assets/{HomePage-C1T4QFCi.js → HomePage-b8QeDnVg.js} +1 -1
- package/dist/app/assets/{MainPage-NHw0FBGk.js → MainPage-DB4TgCht.js} +1 -1
- package/dist/app/assets/{ModelPage-BQ2s25F2.js → ModelPage-D5uBRVZG.js} +1 -1
- package/dist/app/assets/{PackagePage-B-8ugkWc.js → PackagePage-Da02VPXi.js} +1 -1
- package/dist/app/assets/{ProjectPage-9YmacvrN.js → ProjectPage-C-b1ld7t.js} +1 -1
- package/dist/app/assets/{RouteError-CZ8PWEDH.js → RouteError-BihPY0CF.js} +1 -1
- package/dist/app/assets/{WorkbookPage-BJzhdY2E.js → WorkbookPage-DXFExeYg.js} +1 -1
- package/dist/app/assets/{index-BORdJk_c.js → index-C7CEd8eo.js} +1 -1
- package/dist/app/assets/{index-BZoYL91v.js → index-CRmTvqUQ.js} +45 -45
- package/dist/app/assets/{index-fiSlV3Cu.js → index-XR6f8p6F.js} +1 -1
- package/dist/app/assets/{index.umd-CQzt_QJa.js → index.umd-xDUYP0Tb.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/server.js +29865 -32910
- package/package.json +3 -2
- package/src/service/connection.ts +122 -2
- package/src/service/db_utils.ts +144 -4
- package/src/service/gcs_s3_utils.ts +304 -0
package/dist/app/api-doc.yaml
CHANGED
|
@@ -1854,6 +1854,44 @@ components:
|
|
|
1854
1854
|
type: string
|
|
1855
1855
|
description: MySQL password for authentication
|
|
1856
1856
|
|
|
1857
|
+
GCSConnection:
|
|
1858
|
+
type: object
|
|
1859
|
+
description: Google Cloud Storage connection configuration for DuckDB
|
|
1860
|
+
properties:
|
|
1861
|
+
keyId:
|
|
1862
|
+
type: string
|
|
1863
|
+
description: GCS HMAC access key ID
|
|
1864
|
+
secret:
|
|
1865
|
+
type: string
|
|
1866
|
+
description: GCS HMAC secret key
|
|
1867
|
+
required:
|
|
1868
|
+
- keyId
|
|
1869
|
+
- secret
|
|
1870
|
+
|
|
1871
|
+
S3Connection:
|
|
1872
|
+
type: object
|
|
1873
|
+
description: AWS S3 connection configuration for DuckDB
|
|
1874
|
+
properties:
|
|
1875
|
+
accessKeyId:
|
|
1876
|
+
type: string
|
|
1877
|
+
description: AWS access key ID
|
|
1878
|
+
secretAccessKey:
|
|
1879
|
+
type: string
|
|
1880
|
+
description: AWS secret access key
|
|
1881
|
+
region:
|
|
1882
|
+
type: string
|
|
1883
|
+
description: AWS region (e.g., us-east-1)
|
|
1884
|
+
default: us-east-1
|
|
1885
|
+
endpoint:
|
|
1886
|
+
type: string
|
|
1887
|
+
description: Custom S3-compatible endpoint URL (optional, for MinIO, etc.)
|
|
1888
|
+
sessionToken:
|
|
1889
|
+
type: string
|
|
1890
|
+
description: AWS session token for temporary credentials (optional)
|
|
1891
|
+
required:
|
|
1892
|
+
- accessKeyId
|
|
1893
|
+
- secretAccessKey
|
|
1894
|
+
|
|
1857
1895
|
BigqueryConnection:
|
|
1858
1896
|
type: object
|
|
1859
1897
|
description: Google BigQuery database connection configuration
|
|
@@ -1969,7 +2007,7 @@ components:
|
|
|
1969
2007
|
type:
|
|
1970
2008
|
type: string
|
|
1971
2009
|
description: Type of database connection
|
|
1972
|
-
enum: [bigquery, snowflake, postgres]
|
|
2010
|
+
enum: [bigquery, snowflake, postgres, gcs, s3]
|
|
1973
2011
|
attributes:
|
|
1974
2012
|
$ref: "#/components/schemas/ConnectionAttributes"
|
|
1975
2013
|
bigqueryConnection:
|
|
@@ -1978,7 +2016,10 @@ components:
|
|
|
1978
2016
|
$ref: "#/components/schemas/SnowflakeConnection"
|
|
1979
2017
|
postgresConnection:
|
|
1980
2018
|
$ref: "#/components/schemas/PostgresConnection"
|
|
1981
|
-
|
|
2019
|
+
gcsConnection:
|
|
2020
|
+
$ref: "#/components/schemas/GCSConnection"
|
|
2021
|
+
s3Connection:
|
|
2022
|
+
$ref: "#/components/schemas/S3Connection"
|
|
1982
2023
|
# TODO: What is this? Can we remove it?
|
|
1983
2024
|
SqlSource:
|
|
1984
2025
|
type: object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as t,j as o,
|
|
1
|
+
import{e as t,j as o,G as a}from"./index-CRmTvqUQ.js";function n(){const e=t();return o.jsx(a,{onClickProject:e})}export{n as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as V,g as F,r as g,R as _,a as X,b as S,c as M,d as A,j as t,s as m,f as w,h as v,i as I,P as Y,m as R,k as J,l as z,B as K,n as N,o as Z,T as U,p as q,q as oo,e as eo,t as b,C as j,v as ro,w as to,I as so,M as ao,x as $,S as no,y as lo,z as io,O as co}from"./index-
|
|
1
|
+
import{u as V,g as F,r as g,R as _,a as X,b as S,c as M,d as A,j as t,s as m,f as w,h as v,i as I,P as Y,m as R,k as J,l as z,B as K,n as N,o as Z,T as U,p as q,q as oo,e as eo,t as b,C as j,v as ro,w as to,I as so,M as ao,x as $,S as no,y as lo,z as io,O as co}from"./index-CRmTvqUQ.js";function po(o,e,r,s,n){const[a,i]=g.useState(()=>n&&r?r(o).matches:s?s(o).matches:e);return X(()=>{if(!r)return;const p=r(o),u=()=>{i(p.matches)};return u(),p.addEventListener("change",u),()=>{p.removeEventListener("change",u)}},[o,r]),a}const uo={..._},L=uo.useSyncExternalStore;function go(o,e,r,s,n){const a=g.useCallback(()=>e,[e]),i=g.useMemo(()=>{if(n&&r)return()=>r(o).matches;if(s!==null){const{matches:c}=s(o);return()=>c}return a},[a,o,s,n,r]),[p,u]=g.useMemo(()=>{if(r===null)return[a,()=>()=>{}];const c=r(o);return[()=>c.matches,l=>(c.addEventListener("change",l),()=>{c.removeEventListener("change",l)})]},[a,r,o]);return L(u,p,i)}function O(o={}){const{themeId:e}=o;return function(s,n={}){let a=V();a&&e&&(a=a[e]||a);const i=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:p=!1,matchMedia:u=i?window.matchMedia:null,ssrMatchMedia:d=null,noSsr:c=!1}=F({name:"MuiUseMediaQuery",props:n,theme:a});let l=typeof s=="function"?s(a):s;return l=l.replace(/^@media( ?)/m,""),l.includes("print")&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.","Using the print media query to modify print styles can lead to unexpected results.","Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
|
|
2
2
|
`)),(L!==void 0?go:po)(l,p,u,d,c)}}O();function xo(o){return S("MuiAppBar",o)}M("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const mo=o=>{const{color:e,position:r,classes:s}=o,n={root:["root",`color${v(e)}`,`position${v(r)}`]};return I(n,xo,s)},D=(o,e)=>o?`${o?.replace(")","")}, ${e})`:e,bo=m(Y,{name:"MuiAppBar",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:r}=o;return[e.root,e[`position${v(r.position)}`],e[`color${v(r.color)}`]]}})(R(({theme:o})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit"}},{props:{color:"default"},style:{"--AppBar-background":o.vars?o.vars.palette.AppBar.defaultBg:o.palette.grey[100],"--AppBar-color":o.vars?o.vars.palette.text.primary:o.palette.getContrastText(o.palette.grey[100]),...o.applyStyles("dark",{"--AppBar-background":o.vars?o.vars.palette.AppBar.defaultBg:o.palette.grey[900],"--AppBar-color":o.vars?o.vars.palette.text.primary:o.palette.getContrastText(o.palette.grey[900])})}},...Object.entries(o.palette).filter(J(["contrastText"])).map(([e])=>({props:{color:e},style:{"--AppBar-background":(o.vars??o).palette[e].main,"--AppBar-color":(o.vars??o).palette[e].contrastText}})),{props:e=>e.enableColorOnDark===!0&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:e=>e.enableColorOnDark===!1&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...o.applyStyles("dark",{backgroundColor:o.vars?D(o.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:o.vars?D(o.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...o.applyStyles("dark",{backgroundImage:"none"})}}]}))),fo=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiAppBar"}),{className:n,color:a="primary",enableColorOnDark:i=!1,position:p="fixed",...u}=s,d={...s,color:a,position:p,enableColorOnDark:i},c=mo(d);return t.jsx(bo,{square:!0,component:"header",ownerState:d,elevation:4,className:w(c.root,n,p==="fixed"&&"mui-fixed"),ref:r,...u})}),ho=z(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),yo=m(K,{name:"MuiBreadcrumbCollapsed"})(R(({theme:o})=>({display:"flex",marginLeft:`calc(${o.spacing(1)} * 0.5)`,marginRight:`calc(${o.spacing(1)} * 0.5)`,...o.palette.mode==="light"?{backgroundColor:o.palette.grey[100],color:o.palette.grey[700]}:{backgroundColor:o.palette.grey[700],color:o.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...o.palette.mode==="light"?{backgroundColor:o.palette.grey[200]}:{backgroundColor:o.palette.grey[600]}},"&:active":{boxShadow:o.shadows[0],...o.palette.mode==="light"?{backgroundColor:N(o.palette.grey[200],.12)}:{backgroundColor:N(o.palette.grey[600],.12)}}}))),vo=m(ho)({width:24,height:16});function Bo(o){const{slots:e={},slotProps:r={},...s}=o,n=o;return t.jsx("li",{children:t.jsx(yo,{focusRipple:!0,...s,ownerState:n,children:t.jsx(vo,{as:e.CollapsedIcon,ownerState:n,...r.collapsedIcon})})})}function ko(o){return S("MuiBreadcrumbs",o)}const Co=M("MuiBreadcrumbs",["root","ol","li","separator"]),jo=o=>{const{classes:e}=o;return I({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},ko,e)},So=m(U,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(o,e)=>[{[`& .${Co.li}`]:e.li},e.root]})({}),Mo=m("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),Ao=m("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function wo(o,e,r,s){return o.reduce((n,a,i)=>(i<o.length-1?n=n.concat(a,t.jsx(Ao,{"aria-hidden":!0,className:e,ownerState:s,children:r},`separator-${i}`)):n.push(a),n),[])}const Io=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiBreadcrumbs"}),{children:n,className:a,component:i="nav",slots:p={},slotProps:u={},expandText:d="Show path",itemsAfterCollapse:c=1,itemsBeforeCollapse:l=1,maxItems:h=8,separator:B="/",...Q}=s,[T,W]=g.useState(!1),f={...s,component:i,expanded:T,expandText:d,itemsAfterCollapse:c,itemsBeforeCollapse:l,maxItems:h,separator:B},y=jo(f),H=Z({elementType:p.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:f}),P=g.useRef(null),G=x=>{const C=()=>{W(!0);const E=P.current.querySelector("a[href],button,[tabindex]");E&&E.focus()};return l+c>=x.length?x:[...x.slice(0,l),t.jsx(Bo,{"aria-label":d,slots:{CollapsedIcon:p.CollapsedIcon},slotProps:{collapsedIcon:H},onClick:C},"ellipsis"),...x.slice(x.length-c,x.length)]},k=g.Children.toArray(n).filter(x=>g.isValidElement(x)).map((x,C)=>t.jsx("li",{className:y.li,children:x},`child-${C}`));return t.jsx(So,{ref:r,component:i,color:"textSecondary",className:w(y.root,a),ownerState:f,...Q,children:t.jsx(Mo,{className:y.ol,ref:P,ownerState:f,children:wo(T||h&&k.length<=h?k:G(k),y.separator,B,f)})})});function Ro(o){return S("MuiToolbar",o)}M("MuiToolbar",["root","gutters","regular","dense"]);const zo=o=>{const{classes:e,disableGutters:r,variant:s}=o;return I({root:["root",!r&&"gutters",s]},Ro,e)},To=m("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:r}=o;return[e.root,!r.disableGutters&&e.gutters,e[r.variant]]}})(R(({theme:o})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:o.spacing(2),paddingRight:o.spacing(2),[o.breakpoints.up("sm")]:{paddingLeft:o.spacing(3),paddingRight:o.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:o.mixins.toolbar}]}))),Po=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiToolbar"}),{className:n,component:a="div",disableGutters:i=!1,variant:p="regular",...u}=s,d={...s,component:a,disableGutters:i,variant:p},c=zo(d);return t.jsx(To,{as:a,className:w(c.root,n),ref:r,ownerState:d,...u})}),Eo=O({themeId:q}),No=z(t.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),$o=z(t.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}));function Do(){const o=oo(),e=o["*"],r=eo();return t.jsx(b,{sx:{display:"flex",alignItems:"center"},children:t.jsxs(Io,{"aria-label":"breadcrumb",separator:t.jsx(No,{sx:{fontSize:14,color:"text.secondary"}}),sx:{"& .MuiBreadcrumbs-separator":{margin:"0 6px"}},children:[o.projectName&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/`,s),label:o.projectName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"primary.100"}}}),o.packageName&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/${o.packageName}/`,s),label:o.packageName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"secondary.100"}}}),e&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/${o.packageName}/${e}`,s),label:e,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"grey.200"}}})]})})}function Uo({logoHeader:o,endCap:e}){const r=ro(),s=to(),n=Eo(s.breakpoints.down("sm")),[a,i]=g.useState(null),p=!!a,u=l=>{i(l.currentTarget)},d=()=>i(null),c=[{label:"Malloy Docs",link:"https://docs.malloydata.dev/documentation/",sx:{color:"#14b3cb"}},{label:"Publisher Docs",link:"https://github.com/malloydata/publisher/blob/main/README.md",sx:{color:"#14b3cb"}},{label:"Publisher API",link:"/api-doc.html",sx:{color:"#14b3cb"}}];return t.jsxs(fo,{position:"sticky",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:[t.jsxs(Po,{sx:{justifyContent:"space-between",flexWrap:"nowrap",minHeight:44},children:[o||t.jsxs(b,{sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer"},onClick:()=>r("/"),children:[t.jsx(b,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:28,height:28}}),t.jsx(U,{variant:"h6",sx:{color:"text.primary",fontWeight:700,letterSpacing:"-0.025em",fontSize:{xs:"1.1rem",sm:"1.25rem"}},children:"Malloy Publisher"})]}),n?t.jsxs(t.Fragment,{children:[t.jsx(so,{color:"inherit",onClick:u,children:t.jsx($o,{})}),t.jsxs(ao,{anchorEl:a,open:p,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:[c.map(l=>t.jsx($,{onClick:()=>{d(),window.location.href=l.link},sx:l.sx,children:l.label},l.label)),e&&t.jsx($,{children:e})]})]}):t.jsxs(no,{direction:"row",spacing:2,alignItems:"center",children:[c.map(l=>t.jsx(lo,{href:l.link,sx:l.sx,children:l.label},l.label)),e]})]}),t.jsx(b,{sx:{borderTop:"1px solid white",paddingLeft:"16px",paddingRight:"16px",marginBottom:"1px",overflowX:"auto"},children:t.jsx(Do,{})})]})}function Oo({headerProps:o}){return t.jsxs(b,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh"},children:[t.jsx(Uo,{...o}),t.jsx(io,{maxWidth:"xl",component:"main",sx:{flex:1,display:"flex",flexDirection:"column",py:2,gap:2},children:t.jsx(b,{sx:{flex:1},children:t.jsx(co,{})})})]})}export{Oo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as n,j as e,A as i,
|
|
1
|
+
import{q as n,j as e,A as i,K as t,D as c}from"./index-CRmTvqUQ.js";function o(){const a=n(),r=a["*"];if(!a.projectName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});if(!a.packageName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});const s=i({projectName:a.projectName,packageName:a.packageName,modelPath:r});return r?.endsWith(".malloy")?e.jsx(t,{resourceUri:s,runOnDemand:!0,maxResultSize:512*1024}):r?.endsWith(".malloynb")?e.jsx(c,{resourceUri:s,maxResultSize:1024*1024}):e.jsx("div",{children:e.jsxs("h2",{children:["Unrecognized file type: ",r]})})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as n,e as c,j as e,A as t,
|
|
1
|
+
import{q as n,e as c,j as e,A as t,X as o}from"./index-CRmTvqUQ.js";function l(){const{projectName:s,packageName:a}=n(),r=c();if(s)if(a){const i=t({projectName:s,packageName:a});return e.jsx(o,{onClickPackageFile:r,resourceUri:i})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as t,q as n,j as e,A as c,
|
|
1
|
+
import{e as t,q as n,j as e,A as c,Z as o}from"./index-CRmTvqUQ.js";function j(){const r=t(),{projectName:s}=n();if(s){const a=c({projectName:s});return e.jsx(o,{onSelectPackage:r,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as o,j as r,z as s,S as t,t as n,T as a}from"./index-
|
|
1
|
+
import{E as o,j as r,z as s,S as t,t as n,T as a}from"./index-CRmTvqUQ.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(t,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(n,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as a,j as e,A as c,
|
|
1
|
+
import{q as a,j as e,A as c,W as t}from"./index-CRmTvqUQ.js";function d(){const{workspace:r,workbookPath:s,projectName:i,packageName:n}=a();if(r)if(s)if(i)if(n){const o=c({projectName:i,packageName:n});return e.jsx(t,{workbookPath:{path:s,workspace:r},resourceUri:o},`${s}`)}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing workbook path"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing workspace"})})}export{d as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{H as gL,r as T,j as R,J as Mt,R as YR,K as KR,L as as}from"./index-BZoYL91v.js";import{r as Jl,a as by,b as Ry,c as Xl,d as Zl,e as Ty,f as wy,g as Dy,h as Ly,j as Fy,k as Oy,l as Ny,m as Iy,n as ky,o as e0,p as t0,q as r0,s as n0,t as JR,u as yL,v as it}from"./index-fiSlV3Cu.js";import{a as E1}from"./index.umd-CQzt_QJa.js";var oo={},ug={},hr={},lg={},pC;function Ke(){return pC||(pC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.exprHasKids=t,e.exprHasE=r,e.exprIsLeaf=i,e.isAsymmetricExpr=a,e.mkTemporal=c,e.isRawCast=x,e.isFilterExprType=u,e.isParameterType=f,e.paramHasValue=d,e.expressionIsScalar=m,e.expressionIsAggregate=h,e.expressionIsUngroupedAggregate=p,e.expressionInvolvesAggregate=l,e.expressionIsCalculation=_,e.expressionIsAnalytic=E,e.isExpressionTypeLEQ=v,e.maxExpressionType=A,e.maxOfExpressionTypes=C,e.hasExpression=S,e.isTemporalType=w,e.isAtomicFieldType=D,e.canOrderBy=O,e.isCastType=N,e.fieldIsIntrinsic=I,e.mkFieldDef=M,e.mkArrayDef=P,e.isRepeatedRecordFunctionParam=H,e.isRepeatedRecord=q,e.isRecordOrRepeatedRecord=F,e.isBasicArray=V,e.isMatrixOperation=Y,e.isJoinable=de,e.isJoined=G,e.isJoinedSource=J,e.isDateUnit=te,e.isTimestampUnit=se,e.isExtractUnit=X,e.refIsStructDef=ae,e.segmentHasErrors=Ce,e.structHasErrors=he,e.isReduceSegment=j,e.isPartialSegment=Z,e.isProjectSegment=xe,e.isQuerySegment=ie,e.isSamplingRows=Se,e.isSamplingPercent=De,e.isSamplingEnable=be,e.isRawSegment=Te,e.isIndexSegment=Ie,e.bareFieldUsage=Qe,e.isSegmentSQL=Je,e.sourceBase=Ze,e.isSourceDef=tt,e.isBaseTable=dt,e.isLiteral=Wt,e.mergeEvalSpaces=cr,e.isBasicAtomic=Nt,e.getIdentifier=xr,e.isTurtle=Nr,e.isAtomic=Qt,e.isValueString=dr,e.isValueNumber=br,e.isValueBoolean=vr,e.isValueTimestamp=fr,e.isValueDate=oe,e.mergeUniqueKeyRequirement=fe;function t(z){return"kids"in z}function r(z){return"e"in z}function i(z){return!(t(z)||r(z))}function a(z){return z.node==="aggregate"&&["sum","avg","count","distinct"].includes(z.function)}function o(z){return z.node!=="arrayLiteral"&&z.node!=="recordLiteral"}function c(z,ge){if(!("typeDef"in z)){const Fe=typeof ge=="string"?{type:ge}:ge;if(o(z))return{...z,typeDef:{...Fe}}}return z}function x(z){return"dstSQLType"in z}function u(z){return["string","number","boolean","date","timestamp"].includes(z)}function f(z){return["string","number","boolean","date","timestamp","filter expression","error"].includes(z)}function d(z){return z.value!==null}function m(z){return z===void 0||z==="scalar"}function h(z){return z==="aggregate"||z==="ungrouped_aggregate"}function p(z){return z==="ungrouped_aggregate"}function l(z){return z==="aggregate"||z==="ungrouped_aggregate"||z==="aggregate_analytic"}function _(z){return z==="aggregate"||z==="scalar_analytic"||z==="aggregate_analytic"||z==="ungrouped_aggregate"}function E(z){return z==="aggregate_analytic"||z==="scalar_analytic"}function y(z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[z]}function v(z,ge){return z===ge||y(z)<y(ge)}function A(z,ge){let Fe="scalar";return(z==="aggregate"||ge==="aggregate")&&(Fe="aggregate"),(z==="ungrouped_aggregate"||ge==="ungrouped_aggregate")&&(Fe="ungrouped_aggregate"),(z==="scalar_analytic"||ge==="scalar_analytic")&&(Fe="scalar_analytic"),(z==="aggregate_analytic"||ge==="aggregate_analytic")&&(Fe="aggregate_analytic"),(z==="scalar_analytic"&&ge==="aggregate"||z==="aggregate"&&ge==="scalar_analytic")&&(Fe="aggregate_analytic"),Fe}function C(z){return z.reduce(A,"scalar")}function S(z){return"e"in z&&z.e!==void 0}function w(z){return z==="date"||z==="timestamp"}function D(z){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(z)}function O(z){return["string","number","date","boolean","date","timestamp"].includes(z)}function N(z){return["string","number","date","timestamp","boolean","json"].includes(z)}function I(z){return D(z.type)&&!S(z)}function M(z,ge){if(V(z))return P(z.elementTypeDef,ge);if(q(z)){const{type:ke,fields:He,elementTypeDef:ot}=z;return{type:ke,fields:He,elementTypeDef:ot,join:"many",name:ge}}if(z.type==="record"){const{type:ke,fields:He}=z;return{type:ke,fields:He,join:"one",name:ge}}const Fe={name:ge,type:z.type};switch(z.type){case"sql native":return{...Fe,rawType:z.rawType};case"number":{const ke=z.numberType;return ke?{...Fe,numberType:ke}:Fe}case"date":{const ke=z.timeframe;return ke?{name:ge,type:"date",timeframe:ke}:Fe}case"timestamp":{const ke=z.timeframe;return ke?{name:ge,type:"timestamp",timeframe:ke}:Fe}}return Fe}function P(z,ge){if(z.type==="record")return{type:"array",join:"many",name:ge,elementTypeDef:{type:"record_element"},fields:z.fields};const Fe=M(z,"value");return{type:"array",join:"many",name:ge,elementTypeDef:z,fields:[Fe,{...Fe,name:"each",e:{node:"field",path:["value"]}}]}}function H(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}function q(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}function F(z){return z.type==="record"||z.type==="array"&&"elementTypeDef"in z&&z.elementTypeDef.type==="record_element"}function V(z){return z.type==="array"&&z.elementTypeDef.type!=="record_element"}function Y(z){return["left","right","full","inner"].includes(z)}function de(z){return["composite","table","sql_select","query_source","array","record"].includes(z.type)}function G(z){return"join"in z}function J(z){return tt(z)&&G(z)}function te(z){return["day","week","month","quarter","year"].includes(z)}function se(z){return te(z)||["hour","minute","second"].includes(z)}function X(z){return se(z)||z==="day_of_week"||z==="day_of_year"}var ce;(function(z){z.Date="date",z.Timestamp="timestamp",z.Number="number",z.String="string"})(ce||(e.ValueType=ce={}));function ae(z){return typeof z!="string"}function Ce(z){return!!((z.type==="reduce"||z.type==="project"||z.type==="partial")&&(z.extendSource&&z.extendSource.some(ge=>ge.type==="error")||z.queryFields.some(ge=>ge.type==="error")))}function he(z){return z.fields.some(ge=>ge.type==="error")}function j(z){return z.type==="reduce"}function Z(z){return z.type==="partial"}function xe(z){return z.type==="project"}function ie(z){return xe(z)||j(z)}function Se(z){return z.rows!==void 0}function De(z){return z.percent!==void 0}function be(z){return z.enable!==void 0}function Te(z){return z.type==="raw"}function Ie(z){return z.type==="index"}function Qe(z){return z.uniqueKeyRequirement===void 0&&z.analyticFunctionUse===void 0}function Je(z){return"sql"in z}function Ze(z){return{...z}}function tt(z){return z.type==="table"||z.type==="sql_select"||z.type==="query_source"||z.type==="query_result"||z.type==="finalize"||z.type==="nest_source"||z.type==="composite"}function dt(z){return J(z)?!1:!!tt(z)}function Wt(z){return z==="literal"}function cr(...z){return z.length<=1&&z.every(ge=>ge==="literal")?"literal":z.every(ge=>ge==="constant"||ge==="literal")?"constant":z.every(ge=>ge==="output"||ge==="constant"||ge==="literal")?"output":"input"}function Nt(z){return z.type==="string"||w(z.type)||z.type==="number"||z.type==="boolean"||z.type==="json"||z.type==="sql native"||z.type==="error"}function xr(z){return z.as!==void 0?z.as:z.name}function Nr(z){return z.type==="turtle"}function Qt(z){return D(z.type)}function dr(z,ge){return ge.type==="string"}function br(z,ge){return ge.type==="number"}function vr(z,ge){return ge.type==="boolean"}function fr(z,ge){return ge.type==="timestamp"}function oe(z,ge){return ge.type==="date"}e.TD={isAtomic(z){return z!==void 0&&D(z.type)},isBasicAtomic(z){return z!==void 0&&Nt({type:z.type})},isString:z=>z?.type==="string",isNumber:z=>z?.type==="number",isBoolean:z=>z?.type==="boolean",isJSON:z=>z?.type==="json",isSQL:z=>z?.type==="sql native",isDate:z=>z?.type==="date",isTimestamp:z=>z?.type==="timestamp",isTemporal(z){var ge;const Fe=(ge=z?.type)!==null&&ge!==void 0?ge:"";return w(Fe)},isError:z=>z?.type==="error",eq(z,ge){if(z===void 0||ge===void 0)return!1;function Fe(ke,He){const ot={};for(const nt of ke.fields||[])if(nt.name)ot[nt.name]=nt;else return!1;for(const nt of He.fields||[])if(!e.TD.eq(ot[nt.name],nt))return!1;return!0}return z.type==="array"&&ge.type==="array"?z.elementTypeDef.type!==ge.elementTypeDef.type?!1:z.elementTypeDef.type!=="record_element"&&ge.elementTypeDef.type!=="record_element"?e.TD.eq(z.elementTypeDef,ge.elementTypeDef):e.TD.isAtomic(z)&&e.TD.isAtomic(ge)&&Fe(z,ge):z.type==="record"&&ge.type==="record"?e.TD.isAtomic(z)&&e.TD.isAtomic(ge)&&Fe(z,ge):z.type==="sql native"&&ge.type==="sql native"?z.rawType!==void 0&&z.rawType===ge.rawType:z.type===ge.type}};function fe(z,ge){return z?ge?{isCount:z.isCount||ge.isCount}:z:ge}})(lg)),lg}var hC;function Qs(){if(hC)return hr;hC=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.arg=t,hr.spread=r,hr.sql=i,hr.constant=a,hr.output=o,hr.literal=c,hr.variadicParam=x,hr.param=u,hr.makeParam=f,hr.maxScalar=d,hr.maxAggregate=m,hr.anyExprType=h,hr.maxUngroupedAggregate=p,hr.maxAnalytic=l,hr.minScalar=_,hr.minAggregate=E,hr.minAnalytic=y,hr.overload=v,hr.expandBlueprintMap=se,hr.expandOverrideMapFromBase=ae,hr.def=he;const e=Ke();function t(j){return{node:"function_parameter",name:j}}function r(j,Z=void 0,xe=void 0){return{node:"spread",e:j,prefix:Z,suffix:xe}}function i(j,...Z){const xe={node:"genericSQLExpr",kids:{args:[]},src:[]},ie=[...Z];let Se="";for(const De of j){Se+=De;const be=ie.shift();be!==void 0&&(typeof be=="string"?Se+=be:(xe.src.push(Se),xe.kids.args.push(be),Se=""))}return Se.length>0&&xe.src.push(Se),xe}function a(j){return{...j,evalSpace:"constant"}}function o(j){return{...j,evalSpace:"output"}}function c(j){return{...j,evalSpace:"literal"}}function x(j,...Z){return{name:j,isVariadic:!0,allowedTypes:Z}}function u(j,...Z){return{name:j,isVariadic:!1,allowedTypes:Z}}function f(j,...Z){return{param:u(j,...Z),arg:t(j)}}function d(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function m(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function h(j){return{...j,expressionType:void 0,evalSpace:"input"}}function p(j){return{...j,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function l(j){return{...j,expressionType:"aggregate_analytic",evalSpace:"input"}}function _(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function E(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function y(j){return{...j,expressionType:"scalar_analytic",evalSpace:"input"}}function v(j,Z,xe,ie){return{returnType:j,params:Z,e:xe,needsWindowOrderBy:ie?.needsWindowOrderBy,between:ie?.between,isSymmetric:ie?.isSymmetric,supportsOrderBy:ie?.supportsOrderBy,defaultOrderByArgIndex:ie?.defaultOrderByArgIndex,supportsLimit:ie?.supportsLimit}}function A(j,Z=!0,xe=!0){if(!Z&&j==="any")throw new Error("Return type cannot include any");if(typeof j=="string")return{type:j};if("array"in j){const ie=Z?A(j.array,!0):A(j.array,!1);return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}else if("record"in j){const ie=[];for(const[Se,De]of Object.entries(j.record)){const be=Z?A(De,!0):A(De,!1);e.TD.isAtomic(be)&&ie.push((0,e.mkFieldDef)(be,Se))}return{type:"record",fields:ie}}else if("generic"in j){if(!xe)throw new Error("Cannot use generic");return{type:"generic",generic:j.generic}}else if("sql_native"in j)return{type:"sql native",rawType:j.sql_native};throw new Error("Cannot figure out type")}function C(j){if(j==="any")throw new Error("Cannot return any type");if(typeof j=="string")return _({type:j});if("array"in j)return h(A(j,!1));if("record"in j)return h(A(j,!1));if("generic"in j)return _(A(j,!1));if("literal"in j)return c(_(A(j.literal,!1)));if("constant"in j)return a(_(A(j.constant,!1)));if("dimension"in j)return _(A(j.dimension,!1));if("measure"in j)return E(A(j.measure,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return y(A(j.calculation,!1));throw new Error("Invalid function blueprint")}function S(j){return typeof j=="string"||"array"in j||"record"in j||"generic"in j||"literal"in j||"constant"in j||"dimension"in j||"measure"in j||"calculation"in j||"sql_native"in j}function w(j){return S(j)?[j]:Array.isArray(j)?j:S(j.variadic)?[j.variadic]:j.variadic}function D(j){if(typeof j=="string")return h({type:j});if("generic"in j)return h(A(j));if("literal"in j)return c(d(A(j.literal)));if("constant"in j)return a(d(A(j.constant)));if("dimension"in j)return d(A(j.dimension));if("measure"in j)return m(A(j.measure));if("array"in j)return h(A(j,!1));if("record"in j)return h(A(j,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return l(A(j.calculation));throw new Error("Invalid function blueprint")}function O(j){return j.map(Z=>D(Z))}function N(j){return typeof j!="string"&&"variadic"in j}function I(j,Z){return{name:j,allowedTypes:O(w(Z)),isVariadic:N(Z)}}function M(j){return Object.entries(j).map(xe=>I(xe[0],xe[1]))}function P(j){const Z=[],xe=[];let ie=j;for(;ie.length>0;){const De=ie.indexOf("${");if(De===-1){Z.push(ie);break}const be=ie.slice(0,De);ie=ie.slice(De);const Te=ie.indexOf("}");if(Te===-1){Z.push(be+ie);break}const Ie=ie.slice(2,Te);ie=ie.slice(Te+1);const Qe=Ie.startsWith("..."),Je=Ie.endsWith(":"),Ze=Qe?Ie.slice(3):Je?Ie.slice(0,-1):Ie,tt={node:"function_parameter",name:Ze};Z.push(be),Qe?xe.push({node:"spread",e:tt,prefix:"",suffix:""}):Je&&Ze==="order_by"?xe.push({node:"aggregate_order_by"}):Je&&Ze==="limit"?xe.push({node:"aggregate_limit"}):xe.push(tt)}return{node:"genericSQLExpr",kids:{args:xe},src:Z}}function H(j,Z){return N(Z)?{node:"spread",e:{node:"function_parameter",name:j},prefix:"",suffix:""}:{node:"function_parameter",name:j}}function q(j,Z){const xe=Object.entries(Z.takes),ie=xe.length>0?xe.length-1:0;return{node:"genericSQLExpr",kids:{args:xe.map(Se=>H(Se[0],Se[1]))},src:[`${j}(`,...Array(ie).fill(","),")"]}}function F(j){return"sql"in j.impl?P(j.impl.sql):"expr"in j.impl?j.impl.expr:q(j.impl.function,j)}function V(j){return{e:F(j),between:j.impl.between,needsWindowOrderBy:j.impl.needsWindowOrderBy,defaultOrderByArgIndex:j.impl.defaultOrderByArgIndex}}function Y(j){if(j!==void 0)return Object.entries(j).map(([Z,xe])=>({name:Z,acceptibleTypes:xe.map(ie=>A(ie,!0,!1))}))}function de(j){return{returnType:C(j.returns),params:M(j.takes),isSymmetric:j.isSymmetric,supportsOrderBy:j.supportsOrderBy,supportsLimit:j.supportsLimit,genericTypes:Y(j.generic),...V(j)}}function G(j){return"takes"in j&&"returns"in j&&"impl"in j}function J(j){return"function"in j||"sql"in j||"expr"in j}function te(j){return G(j)?[de(j)]:Object.values(j).flatMap(Z=>de(Z))}function se(j){const Z={};for(const xe in j)Z[xe]=te(j[xe]);return Z}function X(j,Z){return[de({...j,impl:Z})]}function ce(j,Z,xe){if(J(xe)){if(!G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Z)})`);return X(Z,xe)}else{if(G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(xe)})`);return Object.entries(xe).flatMap(([ie,Se])=>{const De=Z[ie];if(De===void 0)throw new Error(`Malformed function override: ${j}. No overload named ${ie}`);return X(De,Se)})}}function ae(j,Z){const xe={};for(const ie in Z){if(!(ie in j))throw new Error(`Malformed function override: ${ie}. No such function in Malloy standard`);xe[ie]=ce(ie,j[ie],Z[ie])}return xe}function*Ce(j){if(typeof j!="string"){if("generic"in j)yield j;else if("record"in j)for(const Z of Object.values(j.record))yield*Ce(Z);else for(const Z of["array","literal","measure","dimension","measure","constant","cacluation"])if(Z in j){yield*Ce(j[Z]);return}}}function he(j,Z,xe,ie={}){let Se=!1;const De={};for(const Te of Object.values(Z))for(const Ie of Ce(Te))De[Ie.generic]=["any"],Se=!0;Se&&ie.generic===void 0&&(ie.generic=De);const be={takes:Z,returns:xe,impl:{function:j.toUpperCase()},...ie};return{[j]:be}}return hr}var cg={},mC;function _u(){return mC||(mC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=void 0,e.inDays=i,e.qtz=a;const t=Ke(),r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=r.indexOf("day");function i(c){return r.indexOf(c)>=e.dayIndex}function a(c){const x=c.queryTimezone;if(!(x===void 0||x===c.systemTimezone))return x}class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0}sqlFinalStage(x,u){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(x){return this.castToString(`DATE(${x})`)}sqlLiteralNumber(x){return x}ignoreInProject(x){return!1}exprToSQL(x,u){switch(u.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(u);case"delta":return this.sqlAlterTimeExpr(u);case"trunc":return this.sqlTruncExpr(x,u);case"extract":return this.sqlTimeExtractExpr(x,u);case"cast":return this.sqlCast(x,u);case"regexpMatch":return this.sqlRegexpMatch(u);case"/":return this.divisionIsInteger?`${u.kids.left.sql}*1.0/${u.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${u.kids.left.sql},${u.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(x,u);case"stringLiteral":return this.sqlLiteralString(u.literal);case"numberLiteral":return this.sqlLiteralNumber(u.literal);case"regexpLiteral":return this.sqlLiteralRegexp(u.literal);case"recordLiteral":return this.sqlLiteralRecord(u);case"arrayLiteral":return this.sqlLiteralArray(u)}}sqlSumDistinct(x,u,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(x,u,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(x,u){if(u!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return x}sqlOrderBy(x,u){return`ORDER BY ${x.join(",")}`}sqlTzStr(x){return`"${x.queryTimezone}"`}sqlMakeUnnestKey(x,u){return this.concat(x,"'x'",u)}sqlStringAggDistinct(x,u,f){const d="__STRING_AGG_KS__",m="__STRING_AGG_KE__";return`REGEXP_REPLACE(
|
|
1
|
+
import{F as gL,r as T,j as R,H as Mt,R as YR,J as KR,L as as}from"./index-CRmTvqUQ.js";import{r as Jl,a as by,b as Ry,c as Xl,d as Zl,e as Ty,f as wy,g as Dy,h as Ly,j as Fy,k as Oy,l as Ny,m as Iy,n as ky,o as e0,p as t0,q as r0,s as n0,t as JR,u as yL,v as it}from"./index-XR6f8p6F.js";import{a as E1}from"./index.umd-xDUYP0Tb.js";var oo={},ug={},hr={},lg={},pC;function Ke(){return pC||(pC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.exprHasKids=t,e.exprHasE=r,e.exprIsLeaf=i,e.isAsymmetricExpr=a,e.mkTemporal=c,e.isRawCast=x,e.isFilterExprType=u,e.isParameterType=f,e.paramHasValue=d,e.expressionIsScalar=m,e.expressionIsAggregate=h,e.expressionIsUngroupedAggregate=p,e.expressionInvolvesAggregate=l,e.expressionIsCalculation=_,e.expressionIsAnalytic=E,e.isExpressionTypeLEQ=v,e.maxExpressionType=A,e.maxOfExpressionTypes=C,e.hasExpression=S,e.isTemporalType=w,e.isAtomicFieldType=D,e.canOrderBy=O,e.isCastType=N,e.fieldIsIntrinsic=I,e.mkFieldDef=M,e.mkArrayDef=P,e.isRepeatedRecordFunctionParam=H,e.isRepeatedRecord=q,e.isRecordOrRepeatedRecord=F,e.isBasicArray=V,e.isMatrixOperation=Y,e.isJoinable=de,e.isJoined=G,e.isJoinedSource=J,e.isDateUnit=te,e.isTimestampUnit=se,e.isExtractUnit=X,e.refIsStructDef=ae,e.segmentHasErrors=Ce,e.structHasErrors=he,e.isReduceSegment=j,e.isPartialSegment=Z,e.isProjectSegment=xe,e.isQuerySegment=ie,e.isSamplingRows=Se,e.isSamplingPercent=De,e.isSamplingEnable=be,e.isRawSegment=Te,e.isIndexSegment=Ie,e.bareFieldUsage=Qe,e.isSegmentSQL=Je,e.sourceBase=Ze,e.isSourceDef=tt,e.isBaseTable=dt,e.isLiteral=Wt,e.mergeEvalSpaces=cr,e.isBasicAtomic=Nt,e.getIdentifier=xr,e.isTurtle=Nr,e.isAtomic=Qt,e.isValueString=dr,e.isValueNumber=br,e.isValueBoolean=vr,e.isValueTimestamp=fr,e.isValueDate=oe,e.mergeUniqueKeyRequirement=fe;function t(z){return"kids"in z}function r(z){return"e"in z}function i(z){return!(t(z)||r(z))}function a(z){return z.node==="aggregate"&&["sum","avg","count","distinct"].includes(z.function)}function o(z){return z.node!=="arrayLiteral"&&z.node!=="recordLiteral"}function c(z,ge){if(!("typeDef"in z)){const Fe=typeof ge=="string"?{type:ge}:ge;if(o(z))return{...z,typeDef:{...Fe}}}return z}function x(z){return"dstSQLType"in z}function u(z){return["string","number","boolean","date","timestamp"].includes(z)}function f(z){return["string","number","boolean","date","timestamp","filter expression","error"].includes(z)}function d(z){return z.value!==null}function m(z){return z===void 0||z==="scalar"}function h(z){return z==="aggregate"||z==="ungrouped_aggregate"}function p(z){return z==="ungrouped_aggregate"}function l(z){return z==="aggregate"||z==="ungrouped_aggregate"||z==="aggregate_analytic"}function _(z){return z==="aggregate"||z==="scalar_analytic"||z==="aggregate_analytic"||z==="ungrouped_aggregate"}function E(z){return z==="aggregate_analytic"||z==="scalar_analytic"}function y(z){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[z]}function v(z,ge){return z===ge||y(z)<y(ge)}function A(z,ge){let Fe="scalar";return(z==="aggregate"||ge==="aggregate")&&(Fe="aggregate"),(z==="ungrouped_aggregate"||ge==="ungrouped_aggregate")&&(Fe="ungrouped_aggregate"),(z==="scalar_analytic"||ge==="scalar_analytic")&&(Fe="scalar_analytic"),(z==="aggregate_analytic"||ge==="aggregate_analytic")&&(Fe="aggregate_analytic"),(z==="scalar_analytic"&&ge==="aggregate"||z==="aggregate"&&ge==="scalar_analytic")&&(Fe="aggregate_analytic"),Fe}function C(z){return z.reduce(A,"scalar")}function S(z){return"e"in z&&z.e!==void 0}function w(z){return z==="date"||z==="timestamp"}function D(z){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(z)}function O(z){return["string","number","date","boolean","date","timestamp"].includes(z)}function N(z){return["string","number","date","timestamp","boolean","json"].includes(z)}function I(z){return D(z.type)&&!S(z)}function M(z,ge){if(V(z))return P(z.elementTypeDef,ge);if(q(z)){const{type:ke,fields:He,elementTypeDef:ot}=z;return{type:ke,fields:He,elementTypeDef:ot,join:"many",name:ge}}if(z.type==="record"){const{type:ke,fields:He}=z;return{type:ke,fields:He,join:"one",name:ge}}const Fe={name:ge,type:z.type};switch(z.type){case"sql native":return{...Fe,rawType:z.rawType};case"number":{const ke=z.numberType;return ke?{...Fe,numberType:ke}:Fe}case"date":{const ke=z.timeframe;return ke?{name:ge,type:"date",timeframe:ke}:Fe}case"timestamp":{const ke=z.timeframe;return ke?{name:ge,type:"timestamp",timeframe:ke}:Fe}}return Fe}function P(z,ge){if(z.type==="record")return{type:"array",join:"many",name:ge,elementTypeDef:{type:"record_element"},fields:z.fields};const Fe=M(z,"value");return{type:"array",join:"many",name:ge,elementTypeDef:z,fields:[Fe,{...Fe,name:"each",e:{node:"field",path:["value"]}}]}}function H(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}function q(z){return z.type==="array"&&z.elementTypeDef.type==="record_element"}function F(z){return z.type==="record"||z.type==="array"&&"elementTypeDef"in z&&z.elementTypeDef.type==="record_element"}function V(z){return z.type==="array"&&z.elementTypeDef.type!=="record_element"}function Y(z){return["left","right","full","inner"].includes(z)}function de(z){return["composite","table","sql_select","query_source","array","record"].includes(z.type)}function G(z){return"join"in z}function J(z){return tt(z)&&G(z)}function te(z){return["day","week","month","quarter","year"].includes(z)}function se(z){return te(z)||["hour","minute","second"].includes(z)}function X(z){return se(z)||z==="day_of_week"||z==="day_of_year"}var ce;(function(z){z.Date="date",z.Timestamp="timestamp",z.Number="number",z.String="string"})(ce||(e.ValueType=ce={}));function ae(z){return typeof z!="string"}function Ce(z){return!!((z.type==="reduce"||z.type==="project"||z.type==="partial")&&(z.extendSource&&z.extendSource.some(ge=>ge.type==="error")||z.queryFields.some(ge=>ge.type==="error")))}function he(z){return z.fields.some(ge=>ge.type==="error")}function j(z){return z.type==="reduce"}function Z(z){return z.type==="partial"}function xe(z){return z.type==="project"}function ie(z){return xe(z)||j(z)}function Se(z){return z.rows!==void 0}function De(z){return z.percent!==void 0}function be(z){return z.enable!==void 0}function Te(z){return z.type==="raw"}function Ie(z){return z.type==="index"}function Qe(z){return z.uniqueKeyRequirement===void 0&&z.analyticFunctionUse===void 0}function Je(z){return"sql"in z}function Ze(z){return{...z}}function tt(z){return z.type==="table"||z.type==="sql_select"||z.type==="query_source"||z.type==="query_result"||z.type==="finalize"||z.type==="nest_source"||z.type==="composite"}function dt(z){return J(z)?!1:!!tt(z)}function Wt(z){return z==="literal"}function cr(...z){return z.length<=1&&z.every(ge=>ge==="literal")?"literal":z.every(ge=>ge==="constant"||ge==="literal")?"constant":z.every(ge=>ge==="output"||ge==="constant"||ge==="literal")?"output":"input"}function Nt(z){return z.type==="string"||w(z.type)||z.type==="number"||z.type==="boolean"||z.type==="json"||z.type==="sql native"||z.type==="error"}function xr(z){return z.as!==void 0?z.as:z.name}function Nr(z){return z.type==="turtle"}function Qt(z){return D(z.type)}function dr(z,ge){return ge.type==="string"}function br(z,ge){return ge.type==="number"}function vr(z,ge){return ge.type==="boolean"}function fr(z,ge){return ge.type==="timestamp"}function oe(z,ge){return ge.type==="date"}e.TD={isAtomic(z){return z!==void 0&&D(z.type)},isBasicAtomic(z){return z!==void 0&&Nt({type:z.type})},isString:z=>z?.type==="string",isNumber:z=>z?.type==="number",isBoolean:z=>z?.type==="boolean",isJSON:z=>z?.type==="json",isSQL:z=>z?.type==="sql native",isDate:z=>z?.type==="date",isTimestamp:z=>z?.type==="timestamp",isTemporal(z){var ge;const Fe=(ge=z?.type)!==null&&ge!==void 0?ge:"";return w(Fe)},isError:z=>z?.type==="error",eq(z,ge){if(z===void 0||ge===void 0)return!1;function Fe(ke,He){const ot={};for(const nt of ke.fields||[])if(nt.name)ot[nt.name]=nt;else return!1;for(const nt of He.fields||[])if(!e.TD.eq(ot[nt.name],nt))return!1;return!0}return z.type==="array"&&ge.type==="array"?z.elementTypeDef.type!==ge.elementTypeDef.type?!1:z.elementTypeDef.type!=="record_element"&&ge.elementTypeDef.type!=="record_element"?e.TD.eq(z.elementTypeDef,ge.elementTypeDef):e.TD.isAtomic(z)&&e.TD.isAtomic(ge)&&Fe(z,ge):z.type==="record"&&ge.type==="record"?e.TD.isAtomic(z)&&e.TD.isAtomic(ge)&&Fe(z,ge):z.type==="sql native"&&ge.type==="sql native"?z.rawType!==void 0&&z.rawType===ge.rawType:z.type===ge.type}};function fe(z,ge){return z?ge?{isCount:z.isCount||ge.isCount}:z:ge}})(lg)),lg}var hC;function Qs(){if(hC)return hr;hC=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.arg=t,hr.spread=r,hr.sql=i,hr.constant=a,hr.output=o,hr.literal=c,hr.variadicParam=x,hr.param=u,hr.makeParam=f,hr.maxScalar=d,hr.maxAggregate=m,hr.anyExprType=h,hr.maxUngroupedAggregate=p,hr.maxAnalytic=l,hr.minScalar=_,hr.minAggregate=E,hr.minAnalytic=y,hr.overload=v,hr.expandBlueprintMap=se,hr.expandOverrideMapFromBase=ae,hr.def=he;const e=Ke();function t(j){return{node:"function_parameter",name:j}}function r(j,Z=void 0,xe=void 0){return{node:"spread",e:j,prefix:Z,suffix:xe}}function i(j,...Z){const xe={node:"genericSQLExpr",kids:{args:[]},src:[]},ie=[...Z];let Se="";for(const De of j){Se+=De;const be=ie.shift();be!==void 0&&(typeof be=="string"?Se+=be:(xe.src.push(Se),xe.kids.args.push(be),Se=""))}return Se.length>0&&xe.src.push(Se),xe}function a(j){return{...j,evalSpace:"constant"}}function o(j){return{...j,evalSpace:"output"}}function c(j){return{...j,evalSpace:"literal"}}function x(j,...Z){return{name:j,isVariadic:!0,allowedTypes:Z}}function u(j,...Z){return{name:j,isVariadic:!1,allowedTypes:Z}}function f(j,...Z){return{param:u(j,...Z),arg:t(j)}}function d(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function m(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function h(j){return{...j,expressionType:void 0,evalSpace:"input"}}function p(j){return{...j,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function l(j){return{...j,expressionType:"aggregate_analytic",evalSpace:"input"}}function _(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function E(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function y(j){return{...j,expressionType:"scalar_analytic",evalSpace:"input"}}function v(j,Z,xe,ie){return{returnType:j,params:Z,e:xe,needsWindowOrderBy:ie?.needsWindowOrderBy,between:ie?.between,isSymmetric:ie?.isSymmetric,supportsOrderBy:ie?.supportsOrderBy,defaultOrderByArgIndex:ie?.defaultOrderByArgIndex,supportsLimit:ie?.supportsLimit}}function A(j,Z=!0,xe=!0){if(!Z&&j==="any")throw new Error("Return type cannot include any");if(typeof j=="string")return{type:j};if("array"in j){const ie=Z?A(j.array,!0):A(j.array,!1);return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}else if("record"in j){const ie=[];for(const[Se,De]of Object.entries(j.record)){const be=Z?A(De,!0):A(De,!1);e.TD.isAtomic(be)&&ie.push((0,e.mkFieldDef)(be,Se))}return{type:"record",fields:ie}}else if("generic"in j){if(!xe)throw new Error("Cannot use generic");return{type:"generic",generic:j.generic}}else if("sql_native"in j)return{type:"sql native",rawType:j.sql_native};throw new Error("Cannot figure out type")}function C(j){if(j==="any")throw new Error("Cannot return any type");if(typeof j=="string")return _({type:j});if("array"in j)return h(A(j,!1));if("record"in j)return h(A(j,!1));if("generic"in j)return _(A(j,!1));if("literal"in j)return c(_(A(j.literal,!1)));if("constant"in j)return a(_(A(j.constant,!1)));if("dimension"in j)return _(A(j.dimension,!1));if("measure"in j)return E(A(j.measure,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return y(A(j.calculation,!1));throw new Error("Invalid function blueprint")}function S(j){return typeof j=="string"||"array"in j||"record"in j||"generic"in j||"literal"in j||"constant"in j||"dimension"in j||"measure"in j||"calculation"in j||"sql_native"in j}function w(j){return S(j)?[j]:Array.isArray(j)?j:S(j.variadic)?[j.variadic]:j.variadic}function D(j){if(typeof j=="string")return h({type:j});if("generic"in j)return h(A(j));if("literal"in j)return c(d(A(j.literal)));if("constant"in j)return a(d(A(j.constant)));if("dimension"in j)return d(A(j.dimension));if("measure"in j)return m(A(j.measure));if("array"in j)return h(A(j,!1));if("record"in j)return h(A(j,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return l(A(j.calculation));throw new Error("Invalid function blueprint")}function O(j){return j.map(Z=>D(Z))}function N(j){return typeof j!="string"&&"variadic"in j}function I(j,Z){return{name:j,allowedTypes:O(w(Z)),isVariadic:N(Z)}}function M(j){return Object.entries(j).map(xe=>I(xe[0],xe[1]))}function P(j){const Z=[],xe=[];let ie=j;for(;ie.length>0;){const De=ie.indexOf("${");if(De===-1){Z.push(ie);break}const be=ie.slice(0,De);ie=ie.slice(De);const Te=ie.indexOf("}");if(Te===-1){Z.push(be+ie);break}const Ie=ie.slice(2,Te);ie=ie.slice(Te+1);const Qe=Ie.startsWith("..."),Je=Ie.endsWith(":"),Ze=Qe?Ie.slice(3):Je?Ie.slice(0,-1):Ie,tt={node:"function_parameter",name:Ze};Z.push(be),Qe?xe.push({node:"spread",e:tt,prefix:"",suffix:""}):Je&&Ze==="order_by"?xe.push({node:"aggregate_order_by"}):Je&&Ze==="limit"?xe.push({node:"aggregate_limit"}):xe.push(tt)}return{node:"genericSQLExpr",kids:{args:xe},src:Z}}function H(j,Z){return N(Z)?{node:"spread",e:{node:"function_parameter",name:j},prefix:"",suffix:""}:{node:"function_parameter",name:j}}function q(j,Z){const xe=Object.entries(Z.takes),ie=xe.length>0?xe.length-1:0;return{node:"genericSQLExpr",kids:{args:xe.map(Se=>H(Se[0],Se[1]))},src:[`${j}(`,...Array(ie).fill(","),")"]}}function F(j){return"sql"in j.impl?P(j.impl.sql):"expr"in j.impl?j.impl.expr:q(j.impl.function,j)}function V(j){return{e:F(j),between:j.impl.between,needsWindowOrderBy:j.impl.needsWindowOrderBy,defaultOrderByArgIndex:j.impl.defaultOrderByArgIndex}}function Y(j){if(j!==void 0)return Object.entries(j).map(([Z,xe])=>({name:Z,acceptibleTypes:xe.map(ie=>A(ie,!0,!1))}))}function de(j){return{returnType:C(j.returns),params:M(j.takes),isSymmetric:j.isSymmetric,supportsOrderBy:j.supportsOrderBy,supportsLimit:j.supportsLimit,genericTypes:Y(j.generic),...V(j)}}function G(j){return"takes"in j&&"returns"in j&&"impl"in j}function J(j){return"function"in j||"sql"in j||"expr"in j}function te(j){return G(j)?[de(j)]:Object.values(j).flatMap(Z=>de(Z))}function se(j){const Z={};for(const xe in j)Z[xe]=te(j[xe]);return Z}function X(j,Z){return[de({...j,impl:Z})]}function ce(j,Z,xe){if(J(xe)){if(!G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Z)})`);return X(Z,xe)}else{if(G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(xe)})`);return Object.entries(xe).flatMap(([ie,Se])=>{const De=Z[ie];if(De===void 0)throw new Error(`Malformed function override: ${j}. No overload named ${ie}`);return X(De,Se)})}}function ae(j,Z){const xe={};for(const ie in Z){if(!(ie in j))throw new Error(`Malformed function override: ${ie}. No such function in Malloy standard`);xe[ie]=ce(ie,j[ie],Z[ie])}return xe}function*Ce(j){if(typeof j!="string"){if("generic"in j)yield j;else if("record"in j)for(const Z of Object.values(j.record))yield*Ce(Z);else for(const Z of["array","literal","measure","dimension","measure","constant","cacluation"])if(Z in j){yield*Ce(j[Z]);return}}}function he(j,Z,xe,ie={}){let Se=!1;const De={};for(const Te of Object.values(Z))for(const Ie of Ce(Te))De[Ie.generic]=["any"],Se=!0;Se&&ie.generic===void 0&&(ie.generic=De);const be={takes:Z,returns:xe,impl:{function:j.toUpperCase()},...ie};return{[j]:be}}return hr}var cg={},mC;function _u(){return mC||(mC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=void 0,e.inDays=i,e.qtz=a;const t=Ke(),r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=r.indexOf("day");function i(c){return r.indexOf(c)>=e.dayIndex}function a(c){const x=c.queryTimezone;if(!(x===void 0||x===c.systemTimezone))return x}class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0}sqlFinalStage(x,u){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(x){return this.castToString(`DATE(${x})`)}sqlLiteralNumber(x){return x}ignoreInProject(x){return!1}exprToSQL(x,u){switch(u.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(u);case"delta":return this.sqlAlterTimeExpr(u);case"trunc":return this.sqlTruncExpr(x,u);case"extract":return this.sqlTimeExtractExpr(x,u);case"cast":return this.sqlCast(x,u);case"regexpMatch":return this.sqlRegexpMatch(u);case"/":return this.divisionIsInteger?`${u.kids.left.sql}*1.0/${u.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${u.kids.left.sql},${u.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(x,u);case"stringLiteral":return this.sqlLiteralString(u.literal);case"numberLiteral":return this.sqlLiteralNumber(u.literal);case"regexpLiteral":return this.sqlLiteralRegexp(u.literal);case"recordLiteral":return this.sqlLiteralRecord(u);case"arrayLiteral":return this.sqlLiteralArray(u)}}sqlSumDistinct(x,u,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(x,u,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(x,u){if(u!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return x}sqlOrderBy(x,u){return`ORDER BY ${x.join(",")}`}sqlTzStr(x){return`"${x.queryTimezone}"`}sqlMakeUnnestKey(x,u){return this.concat(x,"'x'",u)}sqlStringAggDistinct(x,u,f){const d="__STRING_AGG_KS__",m="__STRING_AGG_KE__";return`REGEXP_REPLACE(
|
|
2
2
|
STRING_AGG(DISTINCT ${`concat('${d}', ${x}, '${m}', ${u})`}${f.length>0?","+f:""}),
|
|
3
3
|
'${d}.*?${m}',
|
|
4
4
|
''
|