@malloy-publisher/server 0.0.240 → 0.0.241

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.
Files changed (23) hide show
  1. package/dist/app/api-doc.yaml +153 -46
  2. package/dist/app/assets/{EnvironmentPage-2oMC3DUO.js → EnvironmentPage-zu0NeDu-.js} +1 -1
  3. package/dist/app/assets/HomePage-kuBM3jiQ.js +1 -0
  4. package/dist/app/assets/{LightMode-BNaG4oAx.js → LightMode-DGBAdVPb.js} +1 -1
  5. package/dist/app/assets/{MainPage-Dje9yqIp.js → MainPage-CCVx9yPs.js} +2 -2
  6. package/dist/app/assets/{MaterializationsPage-D4jCpScu.js → MaterializationsPage-M-bWIx8L.js} +1 -1
  7. package/dist/app/assets/ModelPage-D-L2pqIy.js +1 -0
  8. package/dist/app/assets/{PackagePage-DlO2UBEI.js → PackagePage-BZglxDlj.js} +1 -1
  9. package/dist/app/assets/RouteError-DGoCQGam.js +1 -0
  10. package/dist/app/assets/{ThemeEditorPage-DZzT5zt4.js → ThemeEditorPage-e8MLf7SV.js} +1 -1
  11. package/dist/app/assets/{WorkbookPage-CfDz8XAp.js → WorkbookPage-C8ufpN5i.js} +1 -1
  12. package/dist/app/assets/{core-BGHaIj_q.es-BeNX3GvK.js → core-KFsKleo0.es-D6cYhbct.js} +1 -1
  13. package/dist/app/assets/{index-ByceOJbS.js → index-B-jw9EkA.js} +52 -52
  14. package/dist/app/assets/{index-BfV8vaZu.js → index-CDNkCta4.js} +1 -1
  15. package/dist/app/assets/{index-BeZphO3v.js → index-CLwzlAx6.js} +1 -1
  16. package/dist/app/assets/{index-DXjc2oZx.js → index-Dnef41hg.js} +1 -1
  17. package/dist/app/index.html +1 -1
  18. package/dist/runtime/publisher.js +1 -1
  19. package/dist/server.mjs +167 -29
  20. package/package.json +1 -1
  21. package/dist/app/assets/HomePage-DmgHdpH6.js +0 -1
  22. package/dist/app/assets/ModelPage-oI3O6TwY.js +0 -1
  23. package/dist/app/assets/RouteError-B5MgkwXx.js +0 -1
@@ -1,4 +1,4 @@
1
- import{aM as mi}from"./index-ByceOJbS.js";import{r as gi}from"./index-w_0OQJgZ.js";function yi(f,ie){for(var W=0;W<ie.length;W++){const P=ie[W];if(typeof P!="string"&&!Array.isArray(P)){for(const k in P)if(k!=="default"&&!(k in f)){const $=Object.getOwnPropertyDescriptor(P,k);$&&Object.defineProperty(f,k,$.get?$:{enumerable:!0,get:()=>P[k]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var Et={},dt={},Vr;function Ct(){if(Vr)return dt;Vr=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.isChainOp=f,dt.isStringCondition=ie,dt.isStringFilter=W,dt.isBooleanFilter=P,dt.isNumberFilter=k,dt.isTemporalFilter=$,dt.isFilterExpression=w,dt.isFilterable=y;function f(o){return["and","or",","].includes(o)}function ie(o){return["starts","ends","contains","="].includes(o.operator)}function W(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["starts","ends","contains","=","~","null","none","empty","and","or",",","()"].includes(o.operator)}function P(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["null","none","true","false","=false","=true"].includes(o.operator)}function k(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["range","<=",">=","!=","=",">","<","and","or","()","null","none"].includes(o.operator)}function $(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["literal","before","after","to","for","in","and","or","in_last","this","last","next","()","null","none"].includes(o.operator)}function w(o){return typeof o=="object"&&o!==null&&"operator"in o}function y(o){return["string","number","boolean","timestamp","timestamptz","date"].includes(o)}return dt}var Mt={},Lr;function vi(){return Lr||(Lr=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.BooleanFilterExpression=void 0,Mt.BooleanFilterExpression={parse(f){var ie;if(f.match(/^\s*$/))return{parsed:null,log:[]};const W={parsed:null,log:[]};let P=f.toLowerCase().trim().replace(/\s\s+/," "),k=!1;if(P.startsWith("not ")&&(k=!0,P=P.slice(4)),P==="true")W.parsed={operator:"true"};else if(P==="=true")W.parsed={operator:"=true"};else if(P==="false")W.parsed={operator:"false"};else if(P==="=false")W.parsed={operator:"=false"};else if(P==="null")W.parsed={operator:"null"};else if(P==="none")W.parsed={operator:"none"};else{const $=f.match(/[^\s]/),w=$&&(ie=$.index)!==null&&ie!==void 0?ie:0;W.log=[{message:`Illegal boolean filter '${P}'. Must be one of true,=true,false,=false,null,none`,severity:"error",startIndex:w,endIndex:w+f.length-1}]}return k&&W.parsed&&(W.parsed.not=!0),W},unparse(f){return f===null?"":(f.not?"not ":"")+f.operator}}),Mt}var yr={},ze={},Ir;function Xt(){if(Ir)return ze;Ir=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.maybeNot=ie,ze.unescape=W,ze.escape=P,ze.matchOp=$,ze.conjoin=y,ze.joinNumbers=o,ze.mkRange=d,ze.mkValues=e,ze.numNot=C,ze.temporalNot=N,ze.joinTemporal=Z,ze.timeLiteral=ne,ze.mkUnits=pe;const f=Ct();function ie(O){const[A,F]=O;return A&&F&&(0,f.isStringFilter)(F)?{...F,not:!0}:F}function W(O){return O.replace(/\\(.)/g,"$1")}function P(O){const A=O.toLowerCase();return A==="null"||A==="empty"||A==="none"?"\\"+O:O.replace(/([,; |()\\%_-])/g,"\\$1")}function k(O){let A=!1,F=!1,G=0,he=!1;const Fe=O.length;for(let we=0;we<Fe;we+=1){const He=O[we];if(He===" "||He===" "){G+=1;continue}G=0,He==="%"?(he=!0,we===0&&(A=!0),F=!0):(F=!1,He==="\\"?we+=1:He==="_"&&(he=!0))}return{hasLike:he,percentEnd:F&&Fe>1,percentStart:A&&Fe>1,endSpace:G}}function $(O){let A=O.trimStart();const{hasLike:F,percentEnd:G,percentStart:he,endSpace:Fe}=k(A);if(Fe>0&&(A=A.slice(0,-Fe)),F){if(he&&G){const we=A.slice(1,-1);if(!k(we).hasLike&&we.length>0)return{operator:"contains",values:[W(we)]}}else if(G){const we=A.slice(0,-1);if(!k(we).hasLike)return{operator:"starts",values:[W(we)]}}else if(he){const we=A.slice(1);if(!k(we).hasLike)return{operator:"ends",values:[W(we)]}}return{operator:"~",escaped_values:[A]}}return A.toLowerCase()==="null"?{operator:"null"}:A.toLowerCase()==="empty"?{operator:"empty"}:A.toLowerCase()==="none"?{operator:"none"}:{operator:"=",values:[W(A)]}}function w(O,A){var F,G;return O.operator===A.operator&&((F=O.not)!==null&&F!==void 0?F:!1)===((G=A.not)!==null&&G!==void 0?G:!1)}function y(O,A,F){if(A=A.toLowerCase(),(0,f.isStringFilter)(O)&&(0,f.isStringFilter)(F)){if(A===","){if(O.operator==="~"&&w(O,F))return{...O,escaped_values:[...O.escaped_values,...F.escaped_values]};if((0,f.isStringCondition)(O)&&w(O,F))return{...O,values:[...O.values,...F.values]}}const G=A===","?",":A==="|"?"or":A===";"?"and":void 0;if(G)return O.operator===G?{...O,members:[...O.members,F]}:{operator:G,members:[O,F]}}return null}function o(O,A,F){if(A=A.toLowerCase(),(0,f.isNumberFilter)(O)&&(0,f.isNumberFilter)(F)){if(A==="or"&&O.operator==="="&&w(O,F)){const G={operator:"=",values:[...O.values,...F.values]};return O.not&&(G.not=!0),G}if(A==="and"||A==="or")return O.operator===A?{...O,members:[...O.members,F]}:{operator:A,members:[O,F]}}return null}function d(O,A,F,G){return{operator:"range",startValue:A,startOperator:O==="("?">":">=",endValue:F,endOperator:G===")"?"<":"<="}}function e(O,A){return{values:[O,...A]}}function C(O,A){return(0,f.isNumberFilter)(O)&&A?O.operator==="="?{operator:"!=",values:O.values}:O.operator==="!="?{operator:"=",values:O.values}:{...O,not:!0}:O}function N(O,A){if((0,f.isTemporalFilter)(O)&&A){if("not"in O){const F={...O};return O.not?delete F.not:F.not=!0,F}return{...O,not:!0}}return O}function Z(O,A,F){return A=A.toLowerCase(),(0,f.isTemporalFilter)(O)&&(0,f.isTemporalFilter)(F)&&(A==="and"||A==="or")?O.operator===A?{...O,members:[...O.members,F]}:{operator:A,members:[O,F]}:null}function ne(O,A){const F={moment:"literal",literal:O};return A&&(F.units=A),F}function pe(O){switch(O.toLowerCase()){case"second":case"seconds":return"second";case"minute":case"minutes":return"minute";case"hour":case"hours":return"hour";case"day":case"days":return"day";case"week":case"weeks":return"week";case"month":case"months":return"month";case"quarter":case"quarters":return"quarter";case"year":case"years":return"year"}}return ze}var vr,Cr;function wi(){if(Cr)return vr;Cr=1;const{numNot:f,mkRange:ie,joinNumbers:W,mkValues:P}=Xt();function k(o,d){function e(){this.constructor=o}e.prototype=d.prototype,o.prototype=new e}function $(o,d,e,C){var N=Error.call(this,o);return Object.setPrototypeOf&&Object.setPrototypeOf(N,$.prototype),N.expected=d,N.found=e,N.location=C,N.name="SyntaxError",N}k($,Error);function w(o,d,e){return e=e||" ",o.length>d?o:(d-=o.length,e+=e.repeat(d),o+e.slice(0,d))}$.prototype.format=function(o){var d="Error: "+this.message;if(this.location){var e=null,C;for(C=0;C<o.length;C++)if(o[C].source===this.location.source){e=o[C].text.split(/\r\n|\n|\r/g);break}var N=this.location.start,Z=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(N):N,ne=this.location.source+":"+Z.line+":"+Z.column;if(e){var pe=this.location.end,O=w("",Z.line.toString().length," "),A=e[N.line-1],F=N.line===pe.line?pe.column:A.length+1,G=F-N.column||1;d+=`
1
+ import{aN as mi}from"./index-B-jw9EkA.js";import{r as gi}from"./index-w_0OQJgZ.js";function yi(f,ie){for(var W=0;W<ie.length;W++){const P=ie[W];if(typeof P!="string"&&!Array.isArray(P)){for(const k in P)if(k!=="default"&&!(k in f)){const $=Object.getOwnPropertyDescriptor(P,k);$&&Object.defineProperty(f,k,$.get?$:{enumerable:!0,get:()=>P[k]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var Et={},dt={},Vr;function Ct(){if(Vr)return dt;Vr=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.isChainOp=f,dt.isStringCondition=ie,dt.isStringFilter=W,dt.isBooleanFilter=P,dt.isNumberFilter=k,dt.isTemporalFilter=$,dt.isFilterExpression=w,dt.isFilterable=y;function f(o){return["and","or",","].includes(o)}function ie(o){return["starts","ends","contains","="].includes(o.operator)}function W(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["starts","ends","contains","=","~","null","none","empty","and","or",",","()"].includes(o.operator)}function P(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["null","none","true","false","=false","=true"].includes(o.operator)}function k(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["range","<=",">=","!=","=",">","<","and","or","()","null","none"].includes(o.operator)}function $(o){return typeof o=="object"&&o!==null&&"operator"in o&&typeof o.operator=="string"&&["literal","before","after","to","for","in","and","or","in_last","this","last","next","()","null","none"].includes(o.operator)}function w(o){return typeof o=="object"&&o!==null&&"operator"in o}function y(o){return["string","number","boolean","timestamp","timestamptz","date"].includes(o)}return dt}var Mt={},Lr;function vi(){return Lr||(Lr=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.BooleanFilterExpression=void 0,Mt.BooleanFilterExpression={parse(f){var ie;if(f.match(/^\s*$/))return{parsed:null,log:[]};const W={parsed:null,log:[]};let P=f.toLowerCase().trim().replace(/\s\s+/," "),k=!1;if(P.startsWith("not ")&&(k=!0,P=P.slice(4)),P==="true")W.parsed={operator:"true"};else if(P==="=true")W.parsed={operator:"=true"};else if(P==="false")W.parsed={operator:"false"};else if(P==="=false")W.parsed={operator:"=false"};else if(P==="null")W.parsed={operator:"null"};else if(P==="none")W.parsed={operator:"none"};else{const $=f.match(/[^\s]/),w=$&&(ie=$.index)!==null&&ie!==void 0?ie:0;W.log=[{message:`Illegal boolean filter '${P}'. Must be one of true,=true,false,=false,null,none`,severity:"error",startIndex:w,endIndex:w+f.length-1}]}return k&&W.parsed&&(W.parsed.not=!0),W},unparse(f){return f===null?"":(f.not?"not ":"")+f.operator}}),Mt}var yr={},ze={},Ir;function Xt(){if(Ir)return ze;Ir=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.maybeNot=ie,ze.unescape=W,ze.escape=P,ze.matchOp=$,ze.conjoin=y,ze.joinNumbers=o,ze.mkRange=d,ze.mkValues=e,ze.numNot=C,ze.temporalNot=N,ze.joinTemporal=Z,ze.timeLiteral=ne,ze.mkUnits=pe;const f=Ct();function ie(O){const[A,F]=O;return A&&F&&(0,f.isStringFilter)(F)?{...F,not:!0}:F}function W(O){return O.replace(/\\(.)/g,"$1")}function P(O){const A=O.toLowerCase();return A==="null"||A==="empty"||A==="none"?"\\"+O:O.replace(/([,; |()\\%_-])/g,"\\$1")}function k(O){let A=!1,F=!1,G=0,he=!1;const Fe=O.length;for(let we=0;we<Fe;we+=1){const He=O[we];if(He===" "||He===" "){G+=1;continue}G=0,He==="%"?(he=!0,we===0&&(A=!0),F=!0):(F=!1,He==="\\"?we+=1:He==="_"&&(he=!0))}return{hasLike:he,percentEnd:F&&Fe>1,percentStart:A&&Fe>1,endSpace:G}}function $(O){let A=O.trimStart();const{hasLike:F,percentEnd:G,percentStart:he,endSpace:Fe}=k(A);if(Fe>0&&(A=A.slice(0,-Fe)),F){if(he&&G){const we=A.slice(1,-1);if(!k(we).hasLike&&we.length>0)return{operator:"contains",values:[W(we)]}}else if(G){const we=A.slice(0,-1);if(!k(we).hasLike)return{operator:"starts",values:[W(we)]}}else if(he){const we=A.slice(1);if(!k(we).hasLike)return{operator:"ends",values:[W(we)]}}return{operator:"~",escaped_values:[A]}}return A.toLowerCase()==="null"?{operator:"null"}:A.toLowerCase()==="empty"?{operator:"empty"}:A.toLowerCase()==="none"?{operator:"none"}:{operator:"=",values:[W(A)]}}function w(O,A){var F,G;return O.operator===A.operator&&((F=O.not)!==null&&F!==void 0?F:!1)===((G=A.not)!==null&&G!==void 0?G:!1)}function y(O,A,F){if(A=A.toLowerCase(),(0,f.isStringFilter)(O)&&(0,f.isStringFilter)(F)){if(A===","){if(O.operator==="~"&&w(O,F))return{...O,escaped_values:[...O.escaped_values,...F.escaped_values]};if((0,f.isStringCondition)(O)&&w(O,F))return{...O,values:[...O.values,...F.values]}}const G=A===","?",":A==="|"?"or":A===";"?"and":void 0;if(G)return O.operator===G?{...O,members:[...O.members,F]}:{operator:G,members:[O,F]}}return null}function o(O,A,F){if(A=A.toLowerCase(),(0,f.isNumberFilter)(O)&&(0,f.isNumberFilter)(F)){if(A==="or"&&O.operator==="="&&w(O,F)){const G={operator:"=",values:[...O.values,...F.values]};return O.not&&(G.not=!0),G}if(A==="and"||A==="or")return O.operator===A?{...O,members:[...O.members,F]}:{operator:A,members:[O,F]}}return null}function d(O,A,F,G){return{operator:"range",startValue:A,startOperator:O==="("?">":">=",endValue:F,endOperator:G===")"?"<":"<="}}function e(O,A){return{values:[O,...A]}}function C(O,A){return(0,f.isNumberFilter)(O)&&A?O.operator==="="?{operator:"!=",values:O.values}:O.operator==="!="?{operator:"=",values:O.values}:{...O,not:!0}:O}function N(O,A){if((0,f.isTemporalFilter)(O)&&A){if("not"in O){const F={...O};return O.not?delete F.not:F.not=!0,F}return{...O,not:!0}}return O}function Z(O,A,F){return A=A.toLowerCase(),(0,f.isTemporalFilter)(O)&&(0,f.isTemporalFilter)(F)&&(A==="and"||A==="or")?O.operator===A?{...O,members:[...O.members,F]}:{operator:A,members:[O,F]}:null}function ne(O,A){const F={moment:"literal",literal:O};return A&&(F.units=A),F}function pe(O){switch(O.toLowerCase()){case"second":case"seconds":return"second";case"minute":case"minutes":return"minute";case"hour":case"hours":return"hour";case"day":case"days":return"day";case"week":case"weeks":return"week";case"month":case"months":return"month";case"quarter":case"quarters":return"quarter";case"year":case"years":return"year"}}return ze}var vr,Cr;function wi(){if(Cr)return vr;Cr=1;const{numNot:f,mkRange:ie,joinNumbers:W,mkValues:P}=Xt();function k(o,d){function e(){this.constructor=o}e.prototype=d.prototype,o.prototype=new e}function $(o,d,e,C){var N=Error.call(this,o);return Object.setPrototypeOf&&Object.setPrototypeOf(N,$.prototype),N.expected=d,N.found=e,N.location=C,N.name="SyntaxError",N}k($,Error);function w(o,d,e){return e=e||" ",o.length>d?o:(d-=o.length,e+=e.repeat(d),o+e.slice(0,d))}$.prototype.format=function(o){var d="Error: "+this.message;if(this.location){var e=null,C;for(C=0;C<o.length;C++)if(o[C].source===this.location.source){e=o[C].text.split(/\r\n|\n|\r/g);break}var N=this.location.start,Z=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(N):N,ne=this.location.source+":"+Z.line+":"+Z.column;if(e){var pe=this.location.end,O=w("",Z.line.toString().length," "),A=e[N.line-1],F=N.line===pe.line?pe.column:A.length+1,G=F-N.column||1;d+=`
2
2
  --> `+ne+`
3
3
  `+O+` |
4
4
  `+Z.line+" | "+A+`
@@ -1 +1 @@
1
- import{aM as a}from"./index-ByceOJbS.js";import{r as f}from"./index-w_0OQJgZ.js";function c(t,n){for(var o=0;o<n.length;o++){const e=n[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(e,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var s=f();const p=a(s),l=c({__proto__:null,default:p},[s]);export{s as d,l as i};
1
+ import{aN as a}from"./index-B-jw9EkA.js";import{r as f}from"./index-w_0OQJgZ.js";function c(t,n){for(var o=0;o<n.length;o++){const e=n[o];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(e,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var s=f();const p=a(s),l=c({__proto__:null,default:p},[s]);export{s as d,l as i};
@@ -1,4 +1,4 @@
1
- import{aJ as XF,r as L,j as N,af as Ht,R as ZF,aK as e9,aL as ns}from"./index-ByceOJbS.js";import{r as Jd,a as dA,d as xt}from"./index-BfV8vaZu.js";import{r as Wa}from"./index-w_0OQJgZ.js";import{d as AU}from"./index-BeZphO3v.js";import{MalloyRenderer as t9,isCoreVizPluginInstance as TU}from"./index-DzaYbhnD.js";var Eo={},K3={},fr={},J3={},gR;function Ge(){return gR||(gR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.safeRecordGet=r,e.mkSafeRecord=i,e.exprHasKids=o,e.exprHasE=s,e.exprIsLeaf=a,e.isAsymmetricExpr=l,e.mkTemporal=d,e.isRawCast=c,e.isFilterExprType=x,e.isTimeLiteral=f,e.isParameterType=p,e.paramHasValue=h,e.activeName=g,e.expressionIsScalar=m,e.expressionIsAggregate=E,e.expressionIsUngroupedAggregate=v,e.expressionInvolvesAggregate=_,e.expressionIsCalculation=S,e.expressionIsAnalytic=T,e.isExpressionTypeLEQ=D,e.maxExpressionType=C,e.maxOfExpressionTypes=w,e.hasExpression=R,e.isTemporalType=O,e.isBasicAtomicType=I,e.isAtomicFieldType=k,e.canOrderBy=$,e.fieldIsIntrinsic=Y,e.mkFieldDef=ne,e.mkArrayDef=re,e.mkArrayTypeDef=oe,e.isRepeatedRecordFunctionParam=U,e.isRepeatedRecord=ee,e.isRecordOrRepeatedRecord=J,e.isBasicArray=te,e.isMatrixOperation=q,e.isJoinable=H,e.isJoined=Q,e.isJoinedSource=M,e.isDateUnit=j,e.isTimestampUnit=P,e.isExtractUnit=V,e.refIsStructDef=ae,e.segmentHasErrors=ce,e.structHasErrors=le,e.isReduceSegment=se,e.isPartialSegment=xe,e.isProjectSegment=pe,e.isQuerySegment=ye,e.isSamplingRows=Ce,e.isSamplingPercent=me,e.isSamplingEnable=_e,e.isRawSegment=we,e.isIndexSegment=Ke,e.bareFieldUsage=rt,e.fieldUsageFrom=ge,e.givenUsageFrom=Ee,e.mkRefSummary=Pe,e.mapFieldUsage=ke,e.setFieldUsage=Me,e.isSegmentSQL=Xe,e.isSegmentSource=at,e.isSourceRegistryReference=Qe,e.sourceBase=Et,e.isSourceDef=mt,e.isPersistableSourceDef=Te,e.isBaseTable=ze,e.isLiteral=st,e.mergeEvalSpaces=de,e.isBasicAtomic=he,e.isUserTypeDef=ve,e.isCompoundArrayData=be,e.isTurtle=Be,e.isAtomic=Ie,e.isValueString=We,e.isValueNumber=nt,e.isValueBoolean=gt,e.isValueTimestamp=yt,e.isValueDate=ut,e.mergeUniqueKeyRequirement=et;const t=Object.prototype.hasOwnProperty;function r(ie,Ae){return t.call(ie,Ae)?ie[Ae]:void 0}function i(){return Object.create(null)}function o(ie){return"kids"in ie}function s(ie){return"e"in ie}function a(ie){return!(o(ie)||s(ie))}function l(ie){return ie.node==="aggregate"&&["sum","avg","count","distinct"].includes(ie.function)}function u(ie){return ie.node!=="arrayLiteral"&&ie.node!=="recordLiteral"}function d(ie,Ae){if(!("typeDef"in ie)){const Oe=typeof Ae=="string"?{type:Ae}:Ae;if(u(ie))return{...ie,typeDef:{...Oe}}}return ie}function c(ie){return"dstSQLType"in ie}function x(ie){return["string","number","boolean","date","timestamp","timestamptz"].includes(ie)}function f(ie){return ie.node==="dateLiteral"||ie.node==="timestampLiteral"||ie.node==="timestamptzLiteral"}function p(ie){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(ie)}function h(ie){return ie.value!==null}function g(ie){var Ae;return(Ae=ie.as)!==null&&Ae!==void 0?Ae:ie.name}function m(ie){return ie===void 0||ie==="scalar"}function E(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"}function v(ie){return ie==="ungrouped_aggregate"}function _(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"||ie==="aggregate_analytic"}function S(ie){return ie==="aggregate"||ie==="scalar_analytic"||ie==="aggregate_analytic"||ie==="ungrouped_aggregate"}function T(ie){return ie==="aggregate_analytic"||ie==="scalar_analytic"}function b(ie){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[ie]}function D(ie,Ae){return ie===Ae||b(ie)<b(Ae)}function C(ie,Ae){let Oe="scalar";return(ie==="aggregate"||Ae==="aggregate")&&(Oe="aggregate"),(ie==="ungrouped_aggregate"||Ae==="ungrouped_aggregate")&&(Oe="ungrouped_aggregate"),(ie==="scalar_analytic"||Ae==="scalar_analytic")&&(Oe="scalar_analytic"),(ie==="aggregate_analytic"||Ae==="aggregate_analytic")&&(Oe="aggregate_analytic"),(ie==="scalar_analytic"&&Ae==="aggregate"||ie==="aggregate"&&Ae==="scalar_analytic")&&(Oe="aggregate_analytic"),Oe}function w(ie){return ie.reduce(C,"scalar")}function R(ie){return"e"in ie&&ie.e!==void 0}function O(ie){return ie==="date"||ie==="timestamp"||ie==="timestamptz"}function I(ie){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(ie)}function k(ie){return I(ie)||ie==="record"||ie==="array"}function $(ie){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(ie)}function Y(ie){return k(ie.type)&&!R(ie)}function ne(ie,Ae){if(te(ie))return re(ie.elementTypeDef,Ae);if(ee(ie)){const{type:je,fields:it,elementTypeDef:dt}=ie;return{type:je,fields:it,elementTypeDef:dt,join:"many",name:Ae}}if(ie.type==="record"){const{type:je,fields:it}=ie;return{type:je,fields:it,join:"one",name:Ae}}const Oe={name:Ae,type:ie.type};switch(ie.type){case"sql native":return{...Oe,rawType:ie.rawType};case"number":{const je=ie.numberType;return je?{...Oe,numberType:je}:Oe}case"date":{const je=ie.timeframe;return je?{name:Ae,type:"date",timeframe:je}:Oe}case"timestamp":{const je={name:Ae,type:"timestamp"};return ie.timeframe&&(je.timeframe=ie.timeframe),je}case"timestamptz":{const je={name:Ae,type:"timestamptz"};return ie.timeframe&&(je.timeframe=ie.timeframe),je}}return Oe}function re(ie,Ae){if(ie.type==="record")return{type:"array",join:"many",name:Ae,elementTypeDef:{type:"record_element"},fields:ie.fields};const Oe=ne(ie,"value");return{type:"array",join:"many",name:Ae,elementTypeDef:ie,fields:[Oe,{...Oe,name:"each",e:{node:"field",path:["value"]}}]}}function oe(ie){return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}function U(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function ee(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function J(ie){return ie.type==="record"||ie.type==="array"&&"elementTypeDef"in ie&&ie.elementTypeDef.type==="record_element"}function te(ie){return ie.type==="array"&&ie.elementTypeDef.type!=="record_element"}function q(ie){return["left","right","full","inner"].includes(ie)}function H(ie){return["composite","table","sql_select","query_source","virtual","array","record"].includes(ie.type)}function Q(ie){return"join"in ie}function M(ie){return mt(ie)&&Q(ie)}function j(ie){return["day","week","month","quarter","year"].includes(ie)}function P(ie){return j(ie)||["hour","minute","second"].includes(ie)}function V(ie){return P(ie)||ie==="day_of_week"||ie==="day_of_year"}var Z;(function(ie){ie.Date="date",ie.Timestamp="timestamp",ie.Number="number",ie.String="string"})(Z||(e.ValueType=Z={}));function ae(ie){return typeof ie!="string"}function ce(ie){return!!((ie.type==="reduce"||ie.type==="project"||ie.type==="partial")&&(ie.extendSource&&ie.extendSource.some(Ae=>Ae.type==="error")||ie.queryFields.some(Ae=>Ae.type==="error")))}function le(ie){return ie.fields.some(Ae=>Ae.type==="error")}function se(ie){return ie.type==="reduce"}function xe(ie){return ie.type==="partial"}function pe(ie){return ie.type==="project"}function ye(ie){return pe(ie)||se(ie)}function Ce(ie){return ie.rows!==void 0}function me(ie){return ie.percent!==void 0}function _e(ie){return ie.enable!==void 0}function we(ie){return ie.type==="raw"}function Ke(ie){return ie.type==="index"}function rt(ie){return ie.uniqueKeyRequirement===void 0&&ie.analyticFunctionUse===void 0}function ge(ie){var Ae;return(Ae=ie?.fieldUsage)!==null&&Ae!==void 0?Ae:[]}function Ee(ie){var Ae;return(Ae=ie?.givenUsage)!==null&&Ae!==void 0?Ae:[]}function Pe({fieldUsage:ie,givenUsage:Ae}){if(!(ie===void 0&&Ae===void 0))return{fieldUsage:ie??[],...Ae&&{givenUsage:Ae}}}function ke(ie,Ae){return ie&&{...ie,fieldUsage:ie.fieldUsage.map(Ae)}}function Me(ie,Ae){ie.refSummary?ie.refSummary.fieldUsage=Ae:ie.refSummary={fieldUsage:Ae}}function Xe(ie){return"sql"in ie}function at(ie){return"type"in ie&&(ie.type==="sql_select"||ie.type==="query_source")}function Qe(ie){return ie.type==="source_registry_reference"}function Et(ie){return{...ie}}function mt(ie){return ie.type==="table"||ie.type==="sql_select"||ie.type==="query_source"||ie.type==="query_result"||ie.type==="finalize"||ie.type==="nest_source"||ie.type==="virtual"||ie.type==="composite"}function Te(ie){return ie.type==="sql_select"||ie.type==="query_source"}function ze(ie){return M(ie)?!1:!!mt(ie)}function st(ie){return ie==="literal"}function de(...ie){return ie.length<=1&&ie.every(Ae=>Ae==="literal")?"literal":ie.every(Ae=>Ae==="constant"||Ae==="literal")?"constant":ie.every(Ae=>Ae==="output"||Ae==="constant"||Ae==="literal")?"output":"input"}function he(ie){return ie.type==="string"||O(ie.type)||ie.type==="number"||ie.type==="boolean"||ie.type==="json"||ie.type==="sql native"||ie.type==="error"}function ve(ie){return ie.type==="userType"}function be(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="object"&&ie[0]!==null&&!Array.isArray(ie[0]))}function Be(ie){return ie.type==="turtle"}function Ie(ie){return k(ie.type)}function We(ie,Ae){return Ae.type==="string"}function nt(ie,Ae){return Ae.type==="number"}function gt(ie,Ae){return Ae.type==="boolean"}function yt(ie,Ae){return Ae.type==="timestamp"}function ut(ie,Ae){return Ae.type==="date"}e.TD={isAtomic(ie){return ie!==void 0&&k(ie.type)},isBasicAtomic(ie){return ie!==void 0&&he({type:ie.type})},isString:ie=>ie?.type==="string",isNumber:ie=>ie?.type==="number",isBoolean:ie=>ie?.type==="boolean",isJSON:ie=>ie?.type==="json",isSQL:ie=>ie?.type==="sql native",isDate:ie=>ie?.type==="date",isTimestamp:ie=>ie?.type==="timestamp",isTimestamptz:ie=>ie?.type==="timestamptz",isAnyTimestamp(ie){return ie?.type==="timestamp"||ie?.type==="timestamptz"},isTemporal(ie){var Ae;const Oe=(Ae=ie?.type)!==null&&Ae!==void 0?Ae:"";return O(Oe)},isError:ie=>ie?.type==="error",atomicDef(ie){if(!e.TD.isAtomic(ie))return{type:"error"};switch(ie.type){case"array":return ee(ie)?{type:"array",elementTypeDef:ie.elementTypeDef,fields:ie.fields}:{type:"array",elementTypeDef:ie.elementTypeDef};case"record":return{type:"record",fields:ie.fields};case"number":return ie.numberType?{type:"number",numberType:ie.numberType}:{type:"number"};case"sql native":return ie.rawType?{type:"sql native",rawType:ie.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return ie.timeframe?{type:ie.type,timeframe:ie.timeframe}:{type:ie.type};default:return{type:ie.type}}},eq(ie,Ae){if(ie===void 0||Ae===void 0)return!1;function Oe(je,it){const dt={},lt=je.fields||[],ft=it.fields||[];if(lt.length!==ft.length)return!1;for(const It of lt)if(It.name)dt[It.name]=It;else return!1;for(const It of ft)if(!e.TD.eq(dt[It.name],It))return!1;return!0}return ie.type==="array"&&Ae.type==="array"?ie.elementTypeDef.type!==Ae.elementTypeDef.type?!1:ie.elementTypeDef.type!=="record_element"&&Ae.elementTypeDef.type!=="record_element"?e.TD.eq(ie.elementTypeDef,Ae.elementTypeDef):e.TD.isAtomic(ie)&&e.TD.isAtomic(Ae)&&Oe(ie,Ae):ie.type==="record"&&Ae.type==="record"?e.TD.isAtomic(ie)&&e.TD.isAtomic(Ae)&&Oe(ie,Ae):ie.type==="sql native"&&Ae.type==="sql native"?ie.rawType!==void 0&&ie.rawType===Ae.rawType:ie.type===Ae.type}};function et(ie,Ae){return ie?Ae?{isCount:ie.isCount||Ae.isCount}:ie:Ae}})(J3)),J3}var yR;function cs(){if(yR)return fr;yR=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.arg=t,fr.spread=r,fr.sql=i,fr.constant=o,fr.output=s,fr.literal=a,fr.variadicParam=l,fr.param=u,fr.makeParam=d,fr.maxScalar=c,fr.maxAggregate=x,fr.anyExprType=f,fr.maxUngroupedAggregate=p,fr.maxAnalytic=h,fr.minScalar=g,fr.minAggregate=m,fr.minAnalytic=E,fr.overload=v,fr.expandBlueprintMap=te,fr.expandOverrideMapFromBase=Q,fr.def=j;const e=Ge();function t(P){return{node:"function_parameter",name:P}}function r(P,V=void 0,Z=void 0){return{node:"spread",e:P,prefix:V,suffix:Z}}function i(P,...V){const Z={node:"genericSQLExpr",kids:{args:[]},src:[]},ae=[...V];let ce="";for(const le of P){ce+=le;const se=ae.shift();se!==void 0&&(typeof se=="string"?ce+=se:(Z.src.push(ce),Z.kids.args.push(se),ce=""))}return ce.length>0&&Z.src.push(ce),Z}function o(P){return{...P,evalSpace:"constant"}}function s(P){return{...P,evalSpace:"output"}}function a(P){return{...P,evalSpace:"literal"}}function l(P,...V){return{name:P,isVariadic:!0,allowedTypes:V}}function u(P,...V){return{name:P,isVariadic:!1,allowedTypes:V}}function d(P,...V){return{param:u(P,...V),arg:t(P)}}function c(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function x(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function f(P){return{...P,expressionType:void 0,evalSpace:"input"}}function p(P){return{...P,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function h(P){return{...P,expressionType:"aggregate_analytic",evalSpace:"input"}}function g(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function m(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function E(P){return{...P,expressionType:"scalar_analytic",evalSpace:"input"}}function v(P,V,Z,ae){return{returnType:P,params:V,e:Z,needsWindowOrderBy:ae?.needsWindowOrderBy,between:ae?.between,isSymmetric:ae?.isSymmetric,supportsOrderBy:ae?.supportsOrderBy,defaultOrderByArgIndex:ae?.defaultOrderByArgIndex,supportsLimit:ae?.supportsLimit}}function _(P,V=!0,Z=!0){if(!V&&P==="any")throw new Error("Return type cannot include any");if(typeof P=="string")return{type:P};if("array"in P){const ae=V?_(P.array,!0):_(P.array,!1);return ae.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ae.fields}:{type:"array",elementTypeDef:ae}}else if("record"in P){const ae=[];for(const[ce,le]of Object.entries(P.record)){const se=V?_(le,!0):_(le,!1);e.TD.isAtomic(se)&&ae.push((0,e.mkFieldDef)(se,ce))}return{type:"record",fields:ae}}else if("generic"in P){if(!Z)throw new Error("Cannot use generic");return{type:"generic",generic:P.generic}}else if("sql_native"in P)return{type:"sql native",rawType:P.sql_native};throw new Error("Cannot figure out type")}function S(P){if(P==="any")throw new Error("Cannot return any type");if(typeof P=="string")return g({type:P});if("array"in P)return f(_(P,!1));if("record"in P)return f(_(P,!1));if("generic"in P)return g(_(P,!1));if("literal"in P)return a(g(_(P.literal,!1)));if("constant"in P)return o(g(_(P.constant,!1)));if("dimension"in P)return g(_(P.dimension,!1));if("measure"in P)return m(_(P.measure,!1));if("sql_native"in P)return f({type:"sql native",rawType:P.sql_native});if("calculation"in P)return E(_(P.calculation,!1));throw new Error("Invalid function blueprint")}function T(P){return typeof P=="string"||"array"in P||"record"in P||"generic"in P||"literal"in P||"constant"in P||"dimension"in P||"measure"in P||"calculation"in P||"sql_native"in P}function b(P){return T(P)?[P]:Array.isArray(P)?P:T(P.variadic)?[P.variadic]:P.variadic}function D(P){if(typeof P=="string")return f({type:P});if("generic"in P)return f(_(P));if("literal"in P)return a(c(_(P.literal)));if("constant"in P)return o(c(_(P.constant)));if("dimension"in P)return c(_(P.dimension));if("measure"in P)return x(_(P.measure));if("array"in P)return f(_(P,!1));if("record"in P)return f(_(P,!1));if("sql_native"in P)return f({type:"sql native",rawType:P.sql_native});if("calculation"in P)return h(_(P.calculation));throw new Error("Invalid function blueprint")}function C(P){return P.map(V=>D(V))}function w(P){return typeof P!="string"&&"variadic"in P}function R(P,V){return{name:P,allowedTypes:C(b(V)),isVariadic:w(V)}}function O(P){return Object.entries(P).map(Z=>R(Z[0],Z[1]))}function I(P){const V=[],Z=[];let ae=P;for(;ae.length>0;){const le=ae.indexOf("${");if(le===-1){V.push(ae);break}const se=ae.slice(0,le);ae=ae.slice(le);const xe=ae.indexOf("}");if(xe===-1){V.push(se+ae);break}const pe=ae.slice(2,xe);ae=ae.slice(xe+1);const ye=pe.startsWith("..."),Ce=pe.endsWith(":"),me=ye?pe.slice(3):Ce?pe.slice(0,-1):pe,_e={node:"function_parameter",name:me};V.push(se),ye?Z.push({node:"spread",e:_e,prefix:"",suffix:""}):Ce&&me==="order_by"?Z.push({node:"aggregate_order_by"}):Ce&&me==="limit"?Z.push({node:"aggregate_limit"}):Z.push(_e)}return{node:"genericSQLExpr",kids:{args:Z},src:V}}function k(P,V){return w(V)?{node:"spread",e:{node:"function_parameter",name:P},prefix:"",suffix:""}:{node:"function_parameter",name:P}}function $(P,V){const Z=Object.entries(V.takes),ae=Z.length>0?Z.length-1:0;return{node:"genericSQLExpr",kids:{args:Z.map(ce=>k(ce[0],ce[1]))},src:[`${P}(`,...Array(ae).fill(","),")"]}}function Y(P){return"sql"in P.impl?I(P.impl.sql):"expr"in P.impl?P.impl.expr:$(P.impl.function,P)}function ne(P){return{e:Y(P),between:P.impl.between,needsWindowOrderBy:P.impl.needsWindowOrderBy,defaultOrderByArgIndex:P.impl.defaultOrderByArgIndex}}function re(P){if(P!==void 0)return Object.entries(P).map(([V,Z])=>({name:V,acceptibleTypes:Z.map(ae=>_(ae,!0,!1))}))}function oe(P){return{returnType:S(P.returns),params:O(P.takes),isSymmetric:P.isSymmetric,supportsOrderBy:P.supportsOrderBy,supportsLimit:P.supportsLimit,genericTypes:re(P.generic),...ne(P)}}function U(P){return"takes"in P&&"returns"in P&&"impl"in P}function ee(P){return"function"in P||"sql"in P||"expr"in P}function J(P){return U(P)?[oe(P)]:Object.values(P).flatMap(V=>oe(V))}function te(P){const V={};for(const Z in P)V[Z]=J(P[Z]);return V}function q(P,V){return[oe({...P,impl:V})]}function H(P,V,Z){if(ee(Z)){if(!U(V))throw new Error(`Malformed function override: ${P}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(V)})`);return q(V,Z)}else{if(U(V))throw new Error(`Malformed function override: ${P}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(Z)})`);return Object.entries(Z).flatMap(([ae,ce])=>{const le=V[ae];if(le===void 0)throw new Error(`Malformed function override: ${P}. No overload named ${ae}`);return q(le,ce)})}}function Q(P,V){const Z={};for(const ae in V){if(!(ae in P))throw new Error(`Malformed function override: ${ae}. No such function in Malloy standard`);Z[ae]=H(ae,P[ae],V[ae])}return Z}function*M(P){if(typeof P!="string"){if("generic"in P)yield P;else if("record"in P)for(const V of Object.values(P.record))yield*M(V);else for(const V of["array","literal","measure","dimension","measure","constant","cacluation"])if(V in P){yield*M(P[V]);return}}}function j(P,V,Z,ae={}){let ce=!1;const le={};for(const xe of Object.values(V))for(const pe of M(xe))le[pe.generic]=["any"],ce=!0;ce&&ae.generic===void 0&&(ae.generic=le);const se={takes:V,returns:Z,impl:{function:P.toUpperCase()},...ae};return{[P]:se}}return fr}var X3={},Rx={},ER;function fA(){if(ER)return Rx;ER=1,Object.defineProperty(Rx,"__esModule",{value:!0}),Rx.decodeDottedTablePath=e,Rx.validateDottedTablePath=t;function e(o,s){const{quoteChar:a,escapeStyle:l,bareIdentRegex:u,dialectName:d}=s;if(o.length===0)return{ok:!1,error:`${d} table path is empty`};const c=[];let x=0;for(;;){let f,p;if(o[x]===a){const h=r(o,x,a,l);if(h===null)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — unterminated quoted segment`};f=h.decoded,p=!0,x=h.end}else{const h=o.slice(x).match(u);if(!h||h.index!==0||h[0].length===0)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — invalid segment at position ${x}`};f=h[0],p=!1,x+=h[0].length}if(f.includes(";")||f.includes("--"))return{ok:!1,error:`Invalid ${d} table path: segment ${JSON.stringify(f)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(c.push({value:f,quoted:p}),x===o.length)return{ok:!0,segments:c};if(o[x]!==".")return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — expected '.' at position ${x}`};if(x++,x===o.length)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — trailing dot`}}}function t(o,s){const a=e(o,s);return a.ok?{ok:!0,canonical:o}:a}function r(o,s,a,l){let u=s+1,d="";for(;u<o.length;){if(l==="backslash"&&o[u]==="\\"){if(u+1>=o.length)return null;d+=i(o[u+1]),u+=2;continue}if(o[u]===a){if(l==="doubled"&&o[u+1]===a){d+=a,u+=2;continue}return{decoded:d,end:u+1}}d+=o[u],u++}return null}function i(o){switch(o){case"n":return`
1
+ import{aK as XF,r as L,j as N,ag as Ht,R as ZF,aL as e9,aM as ns}from"./index-B-jw9EkA.js";import{r as Jd,a as dA,d as xt}from"./index-CDNkCta4.js";import{r as Wa}from"./index-w_0OQJgZ.js";import{d as AU}from"./index-CLwzlAx6.js";import{MalloyRenderer as t9,isCoreVizPluginInstance as TU}from"./index-DzaYbhnD.js";var Eo={},K3={},fr={},J3={},gR;function Ge(){return gR||(gR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.safeRecordGet=r,e.mkSafeRecord=i,e.exprHasKids=o,e.exprHasE=s,e.exprIsLeaf=a,e.isAsymmetricExpr=l,e.mkTemporal=d,e.isRawCast=c,e.isFilterExprType=x,e.isTimeLiteral=f,e.isParameterType=p,e.paramHasValue=h,e.activeName=g,e.expressionIsScalar=m,e.expressionIsAggregate=E,e.expressionIsUngroupedAggregate=v,e.expressionInvolvesAggregate=_,e.expressionIsCalculation=S,e.expressionIsAnalytic=T,e.isExpressionTypeLEQ=D,e.maxExpressionType=C,e.maxOfExpressionTypes=w,e.hasExpression=R,e.isTemporalType=O,e.isBasicAtomicType=I,e.isAtomicFieldType=k,e.canOrderBy=$,e.fieldIsIntrinsic=Y,e.mkFieldDef=ne,e.mkArrayDef=re,e.mkArrayTypeDef=oe,e.isRepeatedRecordFunctionParam=U,e.isRepeatedRecord=ee,e.isRecordOrRepeatedRecord=J,e.isBasicArray=te,e.isMatrixOperation=q,e.isJoinable=H,e.isJoined=Q,e.isJoinedSource=M,e.isDateUnit=j,e.isTimestampUnit=P,e.isExtractUnit=V,e.refIsStructDef=ae,e.segmentHasErrors=ce,e.structHasErrors=le,e.isReduceSegment=se,e.isPartialSegment=xe,e.isProjectSegment=pe,e.isQuerySegment=ye,e.isSamplingRows=Ce,e.isSamplingPercent=me,e.isSamplingEnable=_e,e.isRawSegment=we,e.isIndexSegment=Ke,e.bareFieldUsage=rt,e.fieldUsageFrom=ge,e.givenUsageFrom=Ee,e.mkRefSummary=Pe,e.mapFieldUsage=ke,e.setFieldUsage=Me,e.isSegmentSQL=Xe,e.isSegmentSource=at,e.isSourceRegistryReference=Qe,e.sourceBase=Et,e.isSourceDef=mt,e.isPersistableSourceDef=Te,e.isBaseTable=ze,e.isLiteral=st,e.mergeEvalSpaces=de,e.isBasicAtomic=he,e.isUserTypeDef=ve,e.isCompoundArrayData=be,e.isTurtle=Be,e.isAtomic=Ie,e.isValueString=We,e.isValueNumber=nt,e.isValueBoolean=gt,e.isValueTimestamp=yt,e.isValueDate=ut,e.mergeUniqueKeyRequirement=et;const t=Object.prototype.hasOwnProperty;function r(ie,Ae){return t.call(ie,Ae)?ie[Ae]:void 0}function i(){return Object.create(null)}function o(ie){return"kids"in ie}function s(ie){return"e"in ie}function a(ie){return!(o(ie)||s(ie))}function l(ie){return ie.node==="aggregate"&&["sum","avg","count","distinct"].includes(ie.function)}function u(ie){return ie.node!=="arrayLiteral"&&ie.node!=="recordLiteral"}function d(ie,Ae){if(!("typeDef"in ie)){const Oe=typeof Ae=="string"?{type:Ae}:Ae;if(u(ie))return{...ie,typeDef:{...Oe}}}return ie}function c(ie){return"dstSQLType"in ie}function x(ie){return["string","number","boolean","date","timestamp","timestamptz"].includes(ie)}function f(ie){return ie.node==="dateLiteral"||ie.node==="timestampLiteral"||ie.node==="timestamptzLiteral"}function p(ie){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(ie)}function h(ie){return ie.value!==null}function g(ie){var Ae;return(Ae=ie.as)!==null&&Ae!==void 0?Ae:ie.name}function m(ie){return ie===void 0||ie==="scalar"}function E(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"}function v(ie){return ie==="ungrouped_aggregate"}function _(ie){return ie==="aggregate"||ie==="ungrouped_aggregate"||ie==="aggregate_analytic"}function S(ie){return ie==="aggregate"||ie==="scalar_analytic"||ie==="aggregate_analytic"||ie==="ungrouped_aggregate"}function T(ie){return ie==="aggregate_analytic"||ie==="scalar_analytic"}function b(ie){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[ie]}function D(ie,Ae){return ie===Ae||b(ie)<b(Ae)}function C(ie,Ae){let Oe="scalar";return(ie==="aggregate"||Ae==="aggregate")&&(Oe="aggregate"),(ie==="ungrouped_aggregate"||Ae==="ungrouped_aggregate")&&(Oe="ungrouped_aggregate"),(ie==="scalar_analytic"||Ae==="scalar_analytic")&&(Oe="scalar_analytic"),(ie==="aggregate_analytic"||Ae==="aggregate_analytic")&&(Oe="aggregate_analytic"),(ie==="scalar_analytic"&&Ae==="aggregate"||ie==="aggregate"&&Ae==="scalar_analytic")&&(Oe="aggregate_analytic"),Oe}function w(ie){return ie.reduce(C,"scalar")}function R(ie){return"e"in ie&&ie.e!==void 0}function O(ie){return ie==="date"||ie==="timestamp"||ie==="timestamptz"}function I(ie){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(ie)}function k(ie){return I(ie)||ie==="record"||ie==="array"}function $(ie){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(ie)}function Y(ie){return k(ie.type)&&!R(ie)}function ne(ie,Ae){if(te(ie))return re(ie.elementTypeDef,Ae);if(ee(ie)){const{type:je,fields:it,elementTypeDef:dt}=ie;return{type:je,fields:it,elementTypeDef:dt,join:"many",name:Ae}}if(ie.type==="record"){const{type:je,fields:it}=ie;return{type:je,fields:it,join:"one",name:Ae}}const Oe={name:Ae,type:ie.type};switch(ie.type){case"sql native":return{...Oe,rawType:ie.rawType};case"number":{const je=ie.numberType;return je?{...Oe,numberType:je}:Oe}case"date":{const je=ie.timeframe;return je?{name:Ae,type:"date",timeframe:je}:Oe}case"timestamp":{const je={name:Ae,type:"timestamp"};return ie.timeframe&&(je.timeframe=ie.timeframe),je}case"timestamptz":{const je={name:Ae,type:"timestamptz"};return ie.timeframe&&(je.timeframe=ie.timeframe),je}}return Oe}function re(ie,Ae){if(ie.type==="record")return{type:"array",join:"many",name:Ae,elementTypeDef:{type:"record_element"},fields:ie.fields};const Oe=ne(ie,"value");return{type:"array",join:"many",name:Ae,elementTypeDef:ie,fields:[Oe,{...Oe,name:"each",e:{node:"field",path:["value"]}}]}}function oe(ie){return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}function U(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function ee(ie){return ie.type==="array"&&ie.elementTypeDef.type==="record_element"}function J(ie){return ie.type==="record"||ie.type==="array"&&"elementTypeDef"in ie&&ie.elementTypeDef.type==="record_element"}function te(ie){return ie.type==="array"&&ie.elementTypeDef.type!=="record_element"}function q(ie){return["left","right","full","inner"].includes(ie)}function H(ie){return["composite","table","sql_select","query_source","virtual","array","record"].includes(ie.type)}function Q(ie){return"join"in ie}function M(ie){return mt(ie)&&Q(ie)}function j(ie){return["day","week","month","quarter","year"].includes(ie)}function P(ie){return j(ie)||["hour","minute","second"].includes(ie)}function V(ie){return P(ie)||ie==="day_of_week"||ie==="day_of_year"}var Z;(function(ie){ie.Date="date",ie.Timestamp="timestamp",ie.Number="number",ie.String="string"})(Z||(e.ValueType=Z={}));function ae(ie){return typeof ie!="string"}function ce(ie){return!!((ie.type==="reduce"||ie.type==="project"||ie.type==="partial")&&(ie.extendSource&&ie.extendSource.some(Ae=>Ae.type==="error")||ie.queryFields.some(Ae=>Ae.type==="error")))}function le(ie){return ie.fields.some(Ae=>Ae.type==="error")}function se(ie){return ie.type==="reduce"}function xe(ie){return ie.type==="partial"}function pe(ie){return ie.type==="project"}function ye(ie){return pe(ie)||se(ie)}function Ce(ie){return ie.rows!==void 0}function me(ie){return ie.percent!==void 0}function _e(ie){return ie.enable!==void 0}function we(ie){return ie.type==="raw"}function Ke(ie){return ie.type==="index"}function rt(ie){return ie.uniqueKeyRequirement===void 0&&ie.analyticFunctionUse===void 0}function ge(ie){var Ae;return(Ae=ie?.fieldUsage)!==null&&Ae!==void 0?Ae:[]}function Ee(ie){var Ae;return(Ae=ie?.givenUsage)!==null&&Ae!==void 0?Ae:[]}function Pe({fieldUsage:ie,givenUsage:Ae}){if(!(ie===void 0&&Ae===void 0))return{fieldUsage:ie??[],...Ae&&{givenUsage:Ae}}}function ke(ie,Ae){return ie&&{...ie,fieldUsage:ie.fieldUsage.map(Ae)}}function Me(ie,Ae){ie.refSummary?ie.refSummary.fieldUsage=Ae:ie.refSummary={fieldUsage:Ae}}function Xe(ie){return"sql"in ie}function at(ie){return"type"in ie&&(ie.type==="sql_select"||ie.type==="query_source")}function Qe(ie){return ie.type==="source_registry_reference"}function Et(ie){return{...ie}}function mt(ie){return ie.type==="table"||ie.type==="sql_select"||ie.type==="query_source"||ie.type==="query_result"||ie.type==="finalize"||ie.type==="nest_source"||ie.type==="virtual"||ie.type==="composite"}function Te(ie){return ie.type==="sql_select"||ie.type==="query_source"}function ze(ie){return M(ie)?!1:!!mt(ie)}function st(ie){return ie==="literal"}function de(...ie){return ie.length<=1&&ie.every(Ae=>Ae==="literal")?"literal":ie.every(Ae=>Ae==="constant"||Ae==="literal")?"constant":ie.every(Ae=>Ae==="output"||Ae==="constant"||Ae==="literal")?"output":"input"}function he(ie){return ie.type==="string"||O(ie.type)||ie.type==="number"||ie.type==="boolean"||ie.type==="json"||ie.type==="sql native"||ie.type==="error"}function ve(ie){return ie.type==="userType"}function be(ie){return Array.isArray(ie)&&(ie.length===0||typeof ie[0]=="object"&&ie[0]!==null&&!Array.isArray(ie[0]))}function Be(ie){return ie.type==="turtle"}function Ie(ie){return k(ie.type)}function We(ie,Ae){return Ae.type==="string"}function nt(ie,Ae){return Ae.type==="number"}function gt(ie,Ae){return Ae.type==="boolean"}function yt(ie,Ae){return Ae.type==="timestamp"}function ut(ie,Ae){return Ae.type==="date"}e.TD={isAtomic(ie){return ie!==void 0&&k(ie.type)},isBasicAtomic(ie){return ie!==void 0&&he({type:ie.type})},isString:ie=>ie?.type==="string",isNumber:ie=>ie?.type==="number",isBoolean:ie=>ie?.type==="boolean",isJSON:ie=>ie?.type==="json",isSQL:ie=>ie?.type==="sql native",isDate:ie=>ie?.type==="date",isTimestamp:ie=>ie?.type==="timestamp",isTimestamptz:ie=>ie?.type==="timestamptz",isAnyTimestamp(ie){return ie?.type==="timestamp"||ie?.type==="timestamptz"},isTemporal(ie){var Ae;const Oe=(Ae=ie?.type)!==null&&Ae!==void 0?Ae:"";return O(Oe)},isError:ie=>ie?.type==="error",atomicDef(ie){if(!e.TD.isAtomic(ie))return{type:"error"};switch(ie.type){case"array":return ee(ie)?{type:"array",elementTypeDef:ie.elementTypeDef,fields:ie.fields}:{type:"array",elementTypeDef:ie.elementTypeDef};case"record":return{type:"record",fields:ie.fields};case"number":return ie.numberType?{type:"number",numberType:ie.numberType}:{type:"number"};case"sql native":return ie.rawType?{type:"sql native",rawType:ie.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return ie.timeframe?{type:ie.type,timeframe:ie.timeframe}:{type:ie.type};default:return{type:ie.type}}},eq(ie,Ae){if(ie===void 0||Ae===void 0)return!1;function Oe(je,it){const dt={},lt=je.fields||[],ft=it.fields||[];if(lt.length!==ft.length)return!1;for(const It of lt)if(It.name)dt[It.name]=It;else return!1;for(const It of ft)if(!e.TD.eq(dt[It.name],It))return!1;return!0}return ie.type==="array"&&Ae.type==="array"?ie.elementTypeDef.type!==Ae.elementTypeDef.type?!1:ie.elementTypeDef.type!=="record_element"&&Ae.elementTypeDef.type!=="record_element"?e.TD.eq(ie.elementTypeDef,Ae.elementTypeDef):e.TD.isAtomic(ie)&&e.TD.isAtomic(Ae)&&Oe(ie,Ae):ie.type==="record"&&Ae.type==="record"?e.TD.isAtomic(ie)&&e.TD.isAtomic(Ae)&&Oe(ie,Ae):ie.type==="sql native"&&Ae.type==="sql native"?ie.rawType!==void 0&&ie.rawType===Ae.rawType:ie.type===Ae.type}};function et(ie,Ae){return ie?Ae?{isCount:ie.isCount||Ae.isCount}:ie:Ae}})(J3)),J3}var yR;function cs(){if(yR)return fr;yR=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.arg=t,fr.spread=r,fr.sql=i,fr.constant=o,fr.output=s,fr.literal=a,fr.variadicParam=l,fr.param=u,fr.makeParam=d,fr.maxScalar=c,fr.maxAggregate=x,fr.anyExprType=f,fr.maxUngroupedAggregate=p,fr.maxAnalytic=h,fr.minScalar=g,fr.minAggregate=m,fr.minAnalytic=E,fr.overload=v,fr.expandBlueprintMap=te,fr.expandOverrideMapFromBase=Q,fr.def=j;const e=Ge();function t(P){return{node:"function_parameter",name:P}}function r(P,V=void 0,Z=void 0){return{node:"spread",e:P,prefix:V,suffix:Z}}function i(P,...V){const Z={node:"genericSQLExpr",kids:{args:[]},src:[]},ae=[...V];let ce="";for(const le of P){ce+=le;const se=ae.shift();se!==void 0&&(typeof se=="string"?ce+=se:(Z.src.push(ce),Z.kids.args.push(se),ce=""))}return ce.length>0&&Z.src.push(ce),Z}function o(P){return{...P,evalSpace:"constant"}}function s(P){return{...P,evalSpace:"output"}}function a(P){return{...P,evalSpace:"literal"}}function l(P,...V){return{name:P,isVariadic:!0,allowedTypes:V}}function u(P,...V){return{name:P,isVariadic:!1,allowedTypes:V}}function d(P,...V){return{param:u(P,...V),arg:t(P)}}function c(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function x(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function f(P){return{...P,expressionType:void 0,evalSpace:"input"}}function p(P){return{...P,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function h(P){return{...P,expressionType:"aggregate_analytic",evalSpace:"input"}}function g(P){return{...P,expressionType:"scalar",evalSpace:"input"}}function m(P){return{...P,expressionType:"aggregate",evalSpace:"input"}}function E(P){return{...P,expressionType:"scalar_analytic",evalSpace:"input"}}function v(P,V,Z,ae){return{returnType:P,params:V,e:Z,needsWindowOrderBy:ae?.needsWindowOrderBy,between:ae?.between,isSymmetric:ae?.isSymmetric,supportsOrderBy:ae?.supportsOrderBy,defaultOrderByArgIndex:ae?.defaultOrderByArgIndex,supportsLimit:ae?.supportsLimit}}function _(P,V=!0,Z=!0){if(!V&&P==="any")throw new Error("Return type cannot include any");if(typeof P=="string")return{type:P};if("array"in P){const ae=V?_(P.array,!0):_(P.array,!1);return ae.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ae.fields}:{type:"array",elementTypeDef:ae}}else if("record"in P){const ae=[];for(const[ce,le]of Object.entries(P.record)){const se=V?_(le,!0):_(le,!1);e.TD.isAtomic(se)&&ae.push((0,e.mkFieldDef)(se,ce))}return{type:"record",fields:ae}}else if("generic"in P){if(!Z)throw new Error("Cannot use generic");return{type:"generic",generic:P.generic}}else if("sql_native"in P)return{type:"sql native",rawType:P.sql_native};throw new Error("Cannot figure out type")}function S(P){if(P==="any")throw new Error("Cannot return any type");if(typeof P=="string")return g({type:P});if("array"in P)return f(_(P,!1));if("record"in P)return f(_(P,!1));if("generic"in P)return g(_(P,!1));if("literal"in P)return a(g(_(P.literal,!1)));if("constant"in P)return o(g(_(P.constant,!1)));if("dimension"in P)return g(_(P.dimension,!1));if("measure"in P)return m(_(P.measure,!1));if("sql_native"in P)return f({type:"sql native",rawType:P.sql_native});if("calculation"in P)return E(_(P.calculation,!1));throw new Error("Invalid function blueprint")}function T(P){return typeof P=="string"||"array"in P||"record"in P||"generic"in P||"literal"in P||"constant"in P||"dimension"in P||"measure"in P||"calculation"in P||"sql_native"in P}function b(P){return T(P)?[P]:Array.isArray(P)?P:T(P.variadic)?[P.variadic]:P.variadic}function D(P){if(typeof P=="string")return f({type:P});if("generic"in P)return f(_(P));if("literal"in P)return a(c(_(P.literal)));if("constant"in P)return o(c(_(P.constant)));if("dimension"in P)return c(_(P.dimension));if("measure"in P)return x(_(P.measure));if("array"in P)return f(_(P,!1));if("record"in P)return f(_(P,!1));if("sql_native"in P)return f({type:"sql native",rawType:P.sql_native});if("calculation"in P)return h(_(P.calculation));throw new Error("Invalid function blueprint")}function C(P){return P.map(V=>D(V))}function w(P){return typeof P!="string"&&"variadic"in P}function R(P,V){return{name:P,allowedTypes:C(b(V)),isVariadic:w(V)}}function O(P){return Object.entries(P).map(Z=>R(Z[0],Z[1]))}function I(P){const V=[],Z=[];let ae=P;for(;ae.length>0;){const le=ae.indexOf("${");if(le===-1){V.push(ae);break}const se=ae.slice(0,le);ae=ae.slice(le);const xe=ae.indexOf("}");if(xe===-1){V.push(se+ae);break}const pe=ae.slice(2,xe);ae=ae.slice(xe+1);const ye=pe.startsWith("..."),Ce=pe.endsWith(":"),me=ye?pe.slice(3):Ce?pe.slice(0,-1):pe,_e={node:"function_parameter",name:me};V.push(se),ye?Z.push({node:"spread",e:_e,prefix:"",suffix:""}):Ce&&me==="order_by"?Z.push({node:"aggregate_order_by"}):Ce&&me==="limit"?Z.push({node:"aggregate_limit"}):Z.push(_e)}return{node:"genericSQLExpr",kids:{args:Z},src:V}}function k(P,V){return w(V)?{node:"spread",e:{node:"function_parameter",name:P},prefix:"",suffix:""}:{node:"function_parameter",name:P}}function $(P,V){const Z=Object.entries(V.takes),ae=Z.length>0?Z.length-1:0;return{node:"genericSQLExpr",kids:{args:Z.map(ce=>k(ce[0],ce[1]))},src:[`${P}(`,...Array(ae).fill(","),")"]}}function Y(P){return"sql"in P.impl?I(P.impl.sql):"expr"in P.impl?P.impl.expr:$(P.impl.function,P)}function ne(P){return{e:Y(P),between:P.impl.between,needsWindowOrderBy:P.impl.needsWindowOrderBy,defaultOrderByArgIndex:P.impl.defaultOrderByArgIndex}}function re(P){if(P!==void 0)return Object.entries(P).map(([V,Z])=>({name:V,acceptibleTypes:Z.map(ae=>_(ae,!0,!1))}))}function oe(P){return{returnType:S(P.returns),params:O(P.takes),isSymmetric:P.isSymmetric,supportsOrderBy:P.supportsOrderBy,supportsLimit:P.supportsLimit,genericTypes:re(P.generic),...ne(P)}}function U(P){return"takes"in P&&"returns"in P&&"impl"in P}function ee(P){return"function"in P||"sql"in P||"expr"in P}function J(P){return U(P)?[oe(P)]:Object.values(P).flatMap(V=>oe(V))}function te(P){const V={};for(const Z in P)V[Z]=J(P[Z]);return V}function q(P,V){return[oe({...P,impl:V})]}function H(P,V,Z){if(ee(Z)){if(!U(V))throw new Error(`Malformed function override: ${P}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(V)})`);return q(V,Z)}else{if(U(V))throw new Error(`Malformed function override: ${P}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(Z)})`);return Object.entries(Z).flatMap(([ae,ce])=>{const le=V[ae];if(le===void 0)throw new Error(`Malformed function override: ${P}. No overload named ${ae}`);return q(le,ce)})}}function Q(P,V){const Z={};for(const ae in V){if(!(ae in P))throw new Error(`Malformed function override: ${ae}. No such function in Malloy standard`);Z[ae]=H(ae,P[ae],V[ae])}return Z}function*M(P){if(typeof P!="string"){if("generic"in P)yield P;else if("record"in P)for(const V of Object.values(P.record))yield*M(V);else for(const V of["array","literal","measure","dimension","measure","constant","cacluation"])if(V in P){yield*M(P[V]);return}}}function j(P,V,Z,ae={}){let ce=!1;const le={};for(const xe of Object.values(V))for(const pe of M(xe))le[pe.generic]=["any"],ce=!0;ce&&ae.generic===void 0&&(ae.generic=le);const se={takes:V,returns:Z,impl:{function:P.toUpperCase()},...ae};return{[P]:se}}return fr}var X3={},Rx={},ER;function fA(){if(ER)return Rx;ER=1,Object.defineProperty(Rx,"__esModule",{value:!0}),Rx.decodeDottedTablePath=e,Rx.validateDottedTablePath=t;function e(o,s){const{quoteChar:a,escapeStyle:l,bareIdentRegex:u,dialectName:d}=s;if(o.length===0)return{ok:!1,error:`${d} table path is empty`};const c=[];let x=0;for(;;){let f,p;if(o[x]===a){const h=r(o,x,a,l);if(h===null)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — unterminated quoted segment`};f=h.decoded,p=!0,x=h.end}else{const h=o.slice(x).match(u);if(!h||h.index!==0||h[0].length===0)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — invalid segment at position ${x}`};f=h[0],p=!1,x+=h[0].length}if(f.includes(";")||f.includes("--"))return{ok:!1,error:`Invalid ${d} table path: segment ${JSON.stringify(f)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(c.push({value:f,quoted:p}),x===o.length)return{ok:!0,segments:c};if(o[x]!==".")return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — expected '.' at position ${x}`};if(x++,x===o.length)return{ok:!1,error:`Invalid ${d} table path: ${JSON.stringify(o)} — trailing dot`}}}function t(o,s){const a=e(o,s);return a.ok?{ok:!0,canonical:o}:a}function r(o,s,a,l){let u=s+1,d="";for(;u<o.length;){if(l==="backslash"&&o[u]==="\\"){if(u+1>=o.length)return null;d+=i(o[u+1]),u+=2;continue}if(o[u]===a){if(l==="doubled"&&o[u+1]===a){d+=a,u+=2;continue}return{decoded:d,end:u+1}}d+=o[u],u++}return null}function i(o){switch(o){case"n":return`
2
2
  `;case"t":return" ";case"r":return"\r";default:return o}}return Rx}var vR;function Vs(){return vR||(vR=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=e.EscapeStyle=e.MAX_DECIMAL38=e.MIN_DECIMAL38=e.MAX_INT128=e.MIN_INT128=e.MAX_INT64=e.MIN_INT64=e.MAX_INT32=e.MIN_INT32=void 0,e.inDays=o,e.qtz=s,e.turtleGroupSetCondition=a;const t=Ge(),r=fA();e.MIN_INT32=-2147483648,e.MAX_INT32=2147483647,e.MIN_INT64=BigInt("-9223372036854775808"),e.MAX_INT64=BigInt("9223372036854775807"),e.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),e.MAX_INT128=BigInt("170141183460469231731687303715884105727"),e.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),e.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999"),e.EscapeStyle={Doubled:"doubled",Backslash:"backslash",Unset:"unset"};const i=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=i.indexOf("day");function o(u){return i.indexOf(u)>=e.dayIndex}function s(u){const d=u.queryTimezone;if(!(d===void 0||d===u.systemTimezone))return d}function a(u,d){return u===void 0?d:d?`group_set=${u} AND ${d}`:`group_set=${u}`}class l{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsNestedProjectionLimit=!1,this.supportsArraysInData=!0,this.hasTimestamptz=!1,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsBigIntPrecision=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.maxIdentifierLength=128,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.requiresExplicitUnnestOrdering=!1,this.hasLateralColumnAliasInSelect=!1,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0,this.integerTypeMappings=[{min:BigInt(e.MIN_INT32),max:BigInt(e.MAX_INT32),numberType:"integer"},{min:e.MIN_INT64,max:e.MAX_INT64,numberType:"bigint"}],this.tablePathBareIdentRegex=/^[A-Za-z_][A-Za-z0-9_]*/,this.identifierQuoteChar="",this.stringLiteralStyle=e.EscapeStyle.Unset,this.identifierEscapeStyle=e.EscapeStyle.Unset}sqlLateralJoinBag(d){throw this.cantPartitionWindowFunctionsOnExpressions?new Error(`Dialect '${this.name}' sets cantPartitionWindowFunctionsOnExpressions but does not implement sqlLateralJoinBag`):new Error("Internal error: sqlLateralJoinBag called but cantPartitionWindowFunctionsOnExpressions is false")}literalNumberType(d){if(!/^-?\d+$/.test(d))return{type:"number",numberType:"float"};const x=BigInt(d);for(const f of this.integerTypeMappings)if(x>=f.min&&x<=f.max)return{type:"number",numberType:f.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(d,c,x,f,p){var h;const g=(h=d?.hasTimestamptz)!==null&&h!==void 0?h:!1;return p==="date"?{node:"dateLiteral",literal:c,typeDef:{type:"date",timeframe:f!==void 0&&(0,t.isDateUnit)(f)?f:void 0}}:x&&g?{node:"timestamptzLiteral",literal:c,typeDef:{type:"timestamptz",timeframe:f},timezone:x}:x?{node:"timestampLiteral",literal:c,typeDef:{type:"timestamp",timeframe:f},timezone:x}:{node:"timestampLiteral",literal:c,typeDef:{type:"timestamp",timeframe:f}}}sqlValidateTableName(d){if(this.identifierEscapeStyle!==e.EscapeStyle.Doubled&&this.identifierEscapeStyle!==e.EscapeStyle.Backslash)throw new Error(`${this.name}: sqlValidateTableName requires identifierEscapeStyle to be set to Doubled or Backslash (or override sqlValidateTableName).`);return(0,r.validateDottedTablePath)(d,{quoteChar:this.identifierQuoteChar,escapeStyle:this.identifierEscapeStyle,bareIdentRegex:this.tablePathBareIdentRegex,dialectName:this.name})}sqlTurtleOrderByClause(d){const c=d.map(x=>` ${x.field} ${x.dir.toUpperCase()}`);return" "+this.sqlOrderBy(c,"turtle")}sqlFinalStage(d,c){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(d){return this.castToString(`DATE(${d})`)}escapeBackslashStyle(d,c){let x="";for(const f of d)switch(f){case"\\":x+="\\\\";break;case`
3
3
  `:x+="\\n";break;case"\r":x+="\\r";break;case" ":x+="\\t";break;case c:x+="\\"+c;break;default:x+=f}return x}sqlQuoteIdentifier(d){const c=this.identifierQuoteChar;if(!c)throw new Error(`${this.name}: identifierQuoteChar is not set. Set it on the dialect (e.g. '"' or "\`"), or override sqlQuoteIdentifier.`);if(this.identifierEscapeStyle===e.EscapeStyle.Doubled)return c+d.split(c).join(c+c)+c;if(this.identifierEscapeStyle===e.EscapeStyle.Backslash)return c+this.escapeBackslashStyle(d,c)+c;throw new Error(`${this.name}: identifierEscapeStyle is not set. Set it to EscapeStyle.Doubled or EscapeStyle.Backslash on the dialect, or override sqlQuoteIdentifier.`)}sqlLiteralNumber(d){return d}ignoreInProject(d){return!1}needsCivilTimeComputation(d,c,x,f){const p=["day","week","month","quarter","year"],h=c!==void 0&&p.includes(c),g=x!==void 0&&p.includes(x),m=s(f);return{needed:t.TD.isAnyTimestamp(d)&&(h||g)&&m!==void 0,tz:m}}sqlTruncAndOffset(d,c,x,f){if(t.TD.isAnyTimestamp(d.typeDef)){const{needed:h,tz:g}=this.needsCivilTimeComputation(d.typeDef,x,f?.unit,c);if(h&&g){const m=this.sqlConvertToCivilTime(d.sql,g,d.typeDef);let E=m.sql;const v=m.typeDef;return x&&(E=this.sqlTruncate(E,x,v,!0,g)),f&&(E=this.sqlOffsetTime(E,f.op,f.magnitude,f.unit,v,!0,g)),this.sqlConvertFromCivilTime(E,g,d.typeDef)}}let p=d.sql;return x&&(p=this.sqlTruncate(p,x,d.typeDef,!1,s(c))),f&&(p=this.sqlOffsetTime(p,f.op,f.magnitude,f.unit,d.typeDef,!1,s(c))),p}sqlLiteralString(d){if(this.stringLiteralStyle==="doubled")return"'"+d.split("'").join("''")+"'";if(this.stringLiteralStyle==="backslash")return"'"+this.escapeBackslashStyle(d,"'")+"'";throw new Error(`${this.name}: stringLiteralStyle is not set. Set it to EscapeStyle.Doubled or EscapeStyle.Backslash on the dialect, or override sqlLiteralString.`)}sqlLiteralRegexp(d){return this.sqlLiteralString(d)}exprToSQL(d,c){switch(c.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(c);case"delta":{const x=c.kids.base;return x.node==="trunc"?this.sqlTruncAndOffset(x.e,d,x.units,{op:c.op,magnitude:c.kids.delta.sql,unit:c.units}):this.sqlTruncAndOffset(x,d,void 0,{op:c.op,magnitude:c.kids.delta.sql,unit:c.units})}case"trunc":return this.sqlTruncAndOffset(c.e,d,c.units);case"extract":return this.sqlTimeExtractExpr(d,c);case"cast":return this.sqlCast(d,c);case"regexpMatch":return this.sqlRegexpMatch(c);case"/":return this.divisionIsInteger?`${c.kids.left.sql}*1.0/${c.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${c.kids.left.sql},${c.kids.right.sql})`;case"dateLiteral":return this.sqlDateLiteral(d,c.literal);case"timestampLiteral":return this.sqlTimestampLiteral(d,c.literal,c.timezone);case"timestamptzLiteral":return this.sqlTimestamptzLiteral(d,c.literal,c.timezone);case"stringLiteral":return this.sqlLiteralString(c.literal);case"numberLiteral":return this.sqlLiteralNumber(c.literal);case"regexpLiteral":return this.sqlLiteralRegexp(c.literal);case"recordLiteral":return this.sqlLiteralRecord(c);case"arrayLiteral":return this.sqlLiteralArray(c)}}sqlSumDistinct(d,c,x){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(d,c,x){return"sqlAggDistinct called but not implemented"}sqlSampleTable(d,c){if(c!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return d}sqlOrderBy(d,c){return`ORDER BY ${d.join(",")}`}sqlTzStr(d){return`"${d.queryTimezone}"`}sqlMakeUnnestKey(d,c){return this.concat(d,"'x'",c)}sqlStringAggDistinct(d,c,x){const f="__STRING_AGG_KS__",p="__STRING_AGG_KE__";return`REGEXP_REPLACE(
4
4
  STRING_AGG(DISTINCT ${`concat('${f}', ${d}, '${p}', ${c})`}${x.length>0?","+x:""}),
@@ -11,7 +11,7 @@
11
11
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
12
12
  />
13
13
  <title>Malloy Publisher</title>
14
- <script type="module" crossorigin src="/assets/index-ByceOJbS.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-B-jw9EkA.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-5eLCcNmP.css">
16
16
  </head>
17
17
  <body>
@@ -21,7 +21,7 @@
21
21
  //
22
22
  // The "publisher:resize" postMessage protocol below is the SAME contract the
23
23
  // SPA host consumes. Its canonical definition lives in
24
- // packages/sdk/src/utils/pageEmbed.ts (PUBLISHER_RESIZE_MESSAGE_TYPE /
24
+ // packages/sdk/src/utils/dataAppEmbed.ts (PUBLISHER_RESIZE_MESSAGE_TYPE /
25
25
  // PublisherResizeMessage). This file is build-step-free vanilla JS and can't
26
26
  // import it, so keep the message type/shape here in sync with that module.
27
27
 
package/dist/server.mjs CHANGED
@@ -280652,7 +280652,7 @@ function ledgerLineageMismatch(entry, lineage) {
280652
280652
  }
280653
280653
  const changed = (reason) => ({ reasonCode: "lineage_changed", reason });
280654
280654
  if (entry.sourceEntityId !== lineage.sourceEntityId) {
280655
- return changed(`the source's content address changed, so the recorded boundary was ` + `measured over different SQL than this refresh would apply a delta to`);
280655
+ return changed(`the source's content address is not the one the recorded boundary was ` + `measured under, so that boundary describes different SQL than this ` + `refresh would apply a delta to — either the model was edited, or ` + `this refresh is instructed through a different version of the ` + `package than the one that advanced the boundary`);
280656
280656
  }
280657
280657
  if (entry.connectionName !== lineage.connectionName) {
280658
280658
  return changed(`the recorded boundary was advanced on connection ` + `"${entry.connectionName}", not "${lineage.connectionName}"`);
@@ -284559,6 +284559,9 @@ class MaterializationController {
284559
284559
  if (parsed.strictUpstreams !== undefined) {
284560
284560
  result.strictUpstreams = parsed.strictUpstreams;
284561
284561
  }
284562
+ if (parsed.ledger !== undefined) {
284563
+ result.ledger = parsed.ledger;
284564
+ }
284562
284565
  }
284563
284566
  if (body.forceRefresh !== undefined) {
284564
284567
  if (typeof body.forceRefresh !== "boolean") {
@@ -284628,6 +284631,12 @@ class MaterializationController {
284628
284631
  }
284629
284632
  result.strictUpstreams = obj.strictUpstreams;
284630
284633
  }
284634
+ if (obj.ledger !== undefined && obj.ledger !== null) {
284635
+ if (!Array.isArray(obj.ledger)) {
284636
+ throw new BadRequestError("buildInstructions.ledger must be an array");
284637
+ }
284638
+ result.ledger = obj.ledger.map((entry) => this.validateLedgerEntry(entry));
284639
+ }
284631
284640
  return result;
284632
284641
  }
284633
284642
  validateManifestReference(raw) {
@@ -284678,6 +284687,40 @@ class MaterializationController {
284678
284687
  ...typeof instruction.reseed === "boolean" ? { reseed: instruction.reseed } : {}
284679
284688
  };
284680
284689
  }
284690
+ validateLedgerEntry(raw) {
284691
+ if (typeof raw !== "object" || raw === null) {
284692
+ throw new BadRequestError("Each buildInstructions.ledger entry must be an object");
284693
+ }
284694
+ const entry = raw;
284695
+ for (const field of [
284696
+ "connectionName",
284697
+ "physicalTableName",
284698
+ "coveredThrough",
284699
+ "coveredThroughType",
284700
+ "watermark",
284701
+ "sourceEntityId"
284702
+ ]) {
284703
+ if (typeof entry[field] !== "string" || entry[field] === "") {
284704
+ throw new BadRequestError(`Ledger entry '${field}' must be a non-empty string`);
284705
+ }
284706
+ }
284707
+ if (entry.strategy !== "merge" && entry.strategy !== "range_replace") {
284708
+ throw new BadRequestError("Ledger entry 'strategy' must be 'merge' or 'range_replace'");
284709
+ }
284710
+ if (entry.mergeKeys !== undefined && (!Array.isArray(entry.mergeKeys) || entry.mergeKeys.some((k) => typeof k !== "string"))) {
284711
+ throw new BadRequestError("Ledger entry 'mergeKeys' must be an array of strings");
284712
+ }
284713
+ return {
284714
+ connectionName: entry.connectionName,
284715
+ physicalTableName: entry.physicalTableName,
284716
+ coveredThrough: entry.coveredThrough,
284717
+ coveredThroughType: entry.coveredThroughType,
284718
+ watermark: entry.watermark,
284719
+ strategy: entry.strategy,
284720
+ sourceEntityId: entry.sourceEntityId,
284721
+ ...Array.isArray(entry.mergeKeys) ? { mergeKeys: entry.mergeKeys } : {}
284722
+ };
284723
+ }
284681
284724
  async stopMaterialization(environmentName, packageName, materializationId) {
284682
284725
  return this.materializationService.stopMaterialization(environmentName, packageName, materializationId);
284683
284726
  }
@@ -292742,6 +292785,25 @@ import { Manifest } from "@malloydata/malloy";
292742
292785
 
292743
292786
  // src/service/incremental_build.ts
292744
292787
  init_logger();
292788
+ function ledgerTableKey(connectionName, physicalTableName) {
292789
+ return `${connectionName}\x00${physicalTableName}`;
292790
+ }
292791
+ function indexCallerLedger(entries) {
292792
+ const index = new Map;
292793
+ for (const entry of entries) {
292794
+ index.set(ledgerTableKey(entry.connectionName, entry.physicalTableName), {
292795
+ sourceEntityId: entry.sourceEntityId,
292796
+ coveredThroughValue: entry.coveredThrough,
292797
+ coveredThroughType: entry.coveredThroughType,
292798
+ watermarkDimension: entry.watermark,
292799
+ mergeKeyDimensions: entry.mergeKeys ?? [],
292800
+ derivedStrategy: entry.strategy,
292801
+ physicalTableName: entry.physicalTableName,
292802
+ connectionName: entry.connectionName
292803
+ });
292804
+ }
292805
+ return index;
292806
+ }
292745
292807
  function incrementalLineage(params) {
292746
292808
  const d = params.declaration;
292747
292809
  if (!d?.incremental)
@@ -292769,25 +292831,32 @@ function incrementalLineage(params) {
292769
292831
  }
292770
292832
  async function planSourceRefresh(params) {
292771
292833
  const { context, lineage } = params;
292834
+ const forceRefresh = context.forceRefresh || params.reseed === true;
292835
+ const dialect = params.persistSource.dialectName;
292772
292836
  let ledgerEntry = null;
292773
- try {
292774
- ledgerEntry = await context.ledger.getIncrementalLedgerEntry(context.environmentId, lineage.connectionName, lineage.physicalTableName);
292775
- } catch (err) {
292776
- return {
292777
- mode: "seed",
292778
- reasonCode: "ledger_unreadable",
292779
- reason: `the covered_through ledger could not be read (${errMessage(err)})`
292780
- };
292837
+ if (context.callerLedger) {
292838
+ ledgerEntry = context.callerLedger.get(ledgerTableKey(lineage.connectionName, lineage.physicalTableName)) ?? null;
292839
+ } else {
292840
+ try {
292841
+ ledgerEntry = await context.ledger.getIncrementalLedgerEntry(context.environmentId, lineage.connectionName, lineage.physicalTableName);
292842
+ } catch (err) {
292843
+ return {
292844
+ mode: "seed",
292845
+ reasonCode: "ledger_unreadable",
292846
+ reason: `the covered_through ledger could not be read (${errMessage(err)})`
292847
+ };
292848
+ }
292781
292849
  }
292782
- const postgresVersionNum = lineage.strategy === "merge" && params.persistSource.dialectName === "postgres" && ledgerEntry !== null ? await probePostgresVersion(params.runner) : undefined;
292850
+ const postgresVersionNum = lineage.strategy === "merge" && dialect === "postgres" && ledgerEntry !== null ? await probePostgresVersion(params.runner) : undefined;
292851
+ let step;
292783
292852
  try {
292784
- return await planIncrementalStep({
292853
+ step = await planIncrementalStep({
292785
292854
  runner: params.runner,
292786
- dialect: params.persistSource.dialectName,
292855
+ dialect,
292787
292856
  quotedTablePath: params.quotedTablePath,
292788
292857
  lineage,
292789
292858
  ledgerEntry,
292790
- forceRefresh: context.forceRefresh || params.reseed === true,
292859
+ forceRefresh,
292791
292860
  now: context.now,
292792
292861
  sourceSQL: params.sourceSQL,
292793
292862
  columns: params.columns,
@@ -292800,9 +292869,15 @@ async function planSourceRefresh(params) {
292800
292869
  reason: `the delta could not be planned (${errMessage(err)})`
292801
292870
  };
292802
292871
  }
292872
+ if (context.callerLedger && step.mode === "seed" && (step.reasonCode === "lineage_changed" || step.reasonCode === "table_renamed")) {
292873
+ throw new Error(`The supplied ledger entry for table "${lineage.physicalTableName}" ` + `was measured under a different definition of this source: ` + `${step.reason}. Delete the entry to rebuild the source, or set ` + `reseed.`);
292874
+ }
292875
+ return step;
292803
292876
  }
292804
292877
  async function advanceLedger(params) {
292805
292878
  const { context, lineage } = params;
292879
+ if (context.callerLedger)
292880
+ return;
292806
292881
  try {
292807
292882
  await context.ledger.upsertIncrementalLedgerEntry({
292808
292883
  environmentId: context.environmentId,
@@ -292827,6 +292902,8 @@ async function advanceLedger(params) {
292827
292902
  }
292828
292903
  }
292829
292904
  async function resetLedger(context, lineage) {
292905
+ if (context.callerLedger)
292906
+ return;
292830
292907
  try {
292831
292908
  await context.ledger.deleteIncrementalLedgerEntry(context.environmentId, lineage.connectionName, lineage.physicalTableName);
292832
292909
  } catch (err) {
@@ -293135,8 +293212,24 @@ async function resolveEnvironmentId(repository, environmentName) {
293135
293212
  }
293136
293213
 
293137
293214
  // src/service/materialization_service.ts
293138
- function boundaryFields(bound) {
293139
- return bound ? { coveredThrough: bound.value, coveredThroughType: bound.malloyType } : {};
293215
+ function refreshFields(did) {
293216
+ return did ? { refresh: did } : {};
293217
+ }
293218
+ function ledgerFields(lineage, bound) {
293219
+ if (!lineage || !bound)
293220
+ return {};
293221
+ return {
293222
+ ledger: {
293223
+ connectionName: lineage.connectionName,
293224
+ physicalTableName: lineage.physicalTableName,
293225
+ coveredThrough: bound.value,
293226
+ coveredThroughType: bound.malloyType,
293227
+ watermark: lineage.watermarkName,
293228
+ ...lineage.mergeKeys.length > 0 ? { mergeKeys: lineage.mergeKeys } : {},
293229
+ strategy: lineage.strategy,
293230
+ sourceEntityId: lineage.sourceEntityId
293231
+ }
293232
+ };
293140
293233
  }
293141
293234
  function connectionMetadataLayers(environment, connectionName) {
293142
293235
  try {
@@ -293279,7 +293372,7 @@ class MaterializationService {
293279
293372
  const buildInstructions = options.buildInstructions;
293280
293373
  const orchestrated = buildInstructions !== undefined;
293281
293374
  if (orchestrated) {
293282
- this.validateInstructions(pkg.getBuildPlan(), buildInstructions);
293375
+ this.validateInstructions(pkg.getBuildPlan(), buildInstructions, options.ledger, options.reseed ?? false);
293283
293376
  }
293284
293377
  const active2 = await this.repository.getActiveMaterialization(environmentId, packageName);
293285
293378
  if (active2) {
@@ -293310,6 +293403,7 @@ class MaterializationService {
293310
293403
  forceRefresh,
293311
293404
  reseed,
293312
293405
  buildInstructions,
293406
+ ledger: orchestrated ? options.ledger : undefined,
293313
293407
  referenceManifest: options.referenceManifest,
293314
293408
  strictUpstreams: options.strictUpstreams,
293315
293409
  trigger,
@@ -293346,7 +293440,8 @@ class MaterializationService {
293346
293440
  packageName,
293347
293441
  materializationId: id,
293348
293442
  forceRefresh: opts.reseed ?? false,
293349
- now: new Date(startedAt)
293443
+ now: new Date(startedAt),
293444
+ ledger: opts.ledger
293350
293445
  });
293351
293446
  let instructions;
293352
293447
  let carried;
@@ -293563,7 +293658,7 @@ class MaterializationService {
293563
293658
  });
293564
293659
  }
293565
293660
  }
293566
- validateInstructions(plan, instructions) {
293661
+ validateInstructions(plan, instructions, ledger, runReseed = false) {
293567
293662
  if (!plan) {
293568
293663
  throw new BadRequestError("Package has no persist sources; buildInstructions cannot be applied");
293569
293664
  }
@@ -293579,6 +293674,41 @@ class MaterializationService {
293579
293674
  throw new BadRequestError("realization=SNAPSHOT is not supported (COPY only)");
293580
293675
  }
293581
293676
  }
293677
+ if (ledger === undefined || ledger.length === 0)
293678
+ return;
293679
+ const instructed = new Map;
293680
+ const byAddress = new Map(Object.values(plan.sources).map((s) => [s.sourceEntityId, s]));
293681
+ for (const instruction of instructions) {
293682
+ const planSource = (instruction.sourceID ? plan.sources[instruction.sourceID] : undefined) ?? byAddress.get(instruction.sourceEntityId);
293683
+ if (!planSource)
293684
+ continue;
293685
+ instructed.set(`${planSource.connectionName}\x00${instruction.physicalTableName}`, {
293686
+ sourceEntityId: planSource.sourceEntityId,
293687
+ refresh: planSource.refresh ?? null,
293688
+ reseed: runReseed || instruction.reseed === true
293689
+ });
293690
+ }
293691
+ const seen = new Set;
293692
+ for (const entry of ledger) {
293693
+ const key = `${entry.connectionName}\x00${entry.physicalTableName}`;
293694
+ const table = `'${entry.physicalTableName}' on connection '${entry.connectionName}'`;
293695
+ if (seen.has(key)) {
293696
+ throw new BadRequestError(`Ledger entry for table ${table} appears more than once`);
293697
+ }
293698
+ seen.add(key);
293699
+ const target = instructed.get(key);
293700
+ if (!target) {
293701
+ throw new BadRequestError(`Ledger entry names table ${table}, which this run's ` + `instructions do not build`);
293702
+ }
293703
+ if (target.reseed)
293704
+ continue;
293705
+ if (target.refresh !== "incremental") {
293706
+ throw new BadRequestError(`Ledger entry names table ${table}, whose source does not ` + `declare refresh="incremental"`);
293707
+ }
293708
+ if (entry.sourceEntityId !== target.sourceEntityId) {
293709
+ throw new BadRequestError(`Ledger entry for table ${table} was measured under a ` + `different definition of its source (its sourceEntityId does ` + `not match the plan's) — expected after a publish or ` + `rollback that changed the source. Delete the entry to ` + `rebuild the source, or set reseed.`);
293710
+ }
293711
+ }
293582
293712
  }
293583
293713
  quoteSeedTablePath(sourceEntityId, physicalTableName, connectionName, connections) {
293584
293714
  const connection = connectionName ? connections.get(connectionName) : undefined;
@@ -293599,7 +293729,13 @@ class MaterializationService {
293599
293729
  }
293600
293730
  if (Object.keys(declarations).length === 0)
293601
293731
  return;
293602
- return { ...run, declarations, ledger: this.repository };
293732
+ const { ledger, ...rest } = run;
293733
+ return {
293734
+ ...rest,
293735
+ declarations,
293736
+ ledger: this.repository,
293737
+ ...ledger !== undefined ? { callerLedger: indexCallerLedger(ledger) } : {}
293738
+ };
293603
293739
  }
293604
293740
  async executeInstructedBuild(compiled, environment, instructions, seedEntries, signal, strict = false, owner, buildMetadata, incremental) {
293605
293741
  const { graphs, sources, connectionDigests, connections } = compiled;
@@ -293850,7 +293986,8 @@ class MaterializationService {
293850
293986
  physicalTableName,
293851
293987
  connectionName: persistSource.connectionName,
293852
293988
  realization: instruction.realization,
293853
- ...boundaryFields(seededThrough),
293989
+ ...ledgerFields(incrementalRefresh?.lineage, seededThrough),
293990
+ ...refreshFields(incrementalRefresh ? "full" : undefined),
293854
293991
  rowCount: null
293855
293992
  };
293856
293993
  }
@@ -293909,7 +294046,8 @@ class MaterializationService {
293909
294046
  connectionName: persistSource.connectionName,
293910
294047
  realization: instruction.realization,
293911
294048
  rowCount: null,
293912
- ...boundaryFields(step.coveredThrough)
294049
+ ...ledgerFields(lineage, step.coveredThrough),
294050
+ ...refreshFields(step.mode === "delta" ? "delta" : "none")
293913
294051
  };
293914
294052
  }
293915
294053
  async buildOneSourceIntoStorage(persistSource, instruction, manifest, environment, buildSQL, builtEntries, dependsOnStorageUpstream) {
@@ -294491,7 +294629,7 @@ var ASSET_EXTENSIONS = new Set([
294491
294629
  "woff2",
294492
294630
  "xlsx"
294493
294631
  ]);
294494
- var SPA_OWNED_SEGMENTS = new Set(["pages", "workbook"]);
294632
+ var SPA_OWNED_SEGMENTS = new Set(["data-apps", "pages", "workbook"]);
294495
294633
  function extensionOf(segment) {
294496
294634
  const dot = segment.lastIndexOf(".");
294497
294635
  if (dot <= 0 || dot === segment.length - 1)
@@ -294803,7 +294941,7 @@ app.get("/environments/:environmentName/packages/:packageName", (req, res, next)
294803
294941
  res.redirect(308, withRequestQuery(req, canonical));
294804
294942
  });
294805
294943
  app.get("/environments/:environmentName/packages/:packageName/*", serveFromPackage);
294806
- var PAGES_DEPTH_CAP = 3;
294944
+ var DATA_APPS_DEPTH_CAP = 3;
294807
294945
  var NON_TAG_TEXT_PATTERN = /<!--[\s\S]*?-->|<!--[\s\S]*$|<(script|style|title|textarea)\b[\s\S]*?<\/\1\s*>/gi;
294808
294946
  function stripNonTagText(input) {
294809
294947
  let current = input;
@@ -294814,7 +294952,7 @@ function stripNonTagText(input) {
294814
294952
  } while (current !== previous);
294815
294953
  return current;
294816
294954
  }
294817
- async function listPackagePages(environmentName, packageName, publicRoot) {
294955
+ async function listPackageDataApps(environmentName, packageName, publicRoot) {
294818
294956
  const fs11 = await import("fs/promises");
294819
294957
  const out = [];
294820
294958
  let realPublicRoot;
@@ -294824,7 +294962,7 @@ async function listPackagePages(environmentName, packageName, publicRoot) {
294824
294962
  return out;
294825
294963
  }
294826
294964
  async function walk(dir, depth) {
294827
- if (depth > PAGES_DEPTH_CAP)
294965
+ if (depth > DATA_APPS_DEPTH_CAP)
294828
294966
  return;
294829
294967
  let entries;
294830
294968
  try {
@@ -294921,14 +295059,14 @@ try {
294921
295059
  logger.warn("Failed to register Prometheus metrics endpoint", { error });
294922
295060
  }
294923
295061
  app.use(drainingGuard);
294924
- app.get(`${API_PREFIX2}/environments/:environmentName/packages/:packageName/pages`, async (req, res) => {
295062
+ app.get(`${API_PREFIX2}/environments/:environmentName/packages/:packageName/data-apps`, async (req, res) => {
294925
295063
  try {
294926
295064
  const environment = await environmentStore.getEnvironment(req.params.environmentName, false);
294927
295065
  const pkg = await environment.getPackage(req.params.packageName, false);
294928
- const pages = await listPackagePages(req.params.environmentName, req.params.packageName, path14.join(pkg.getPackagePath(), "public"));
294929
- res.json(pages);
295066
+ const dataApps = await listPackageDataApps(req.params.environmentName, req.params.packageName, path14.join(pkg.getPackagePath(), "public"));
295067
+ res.json(dataApps);
294930
295068
  } catch (error) {
294931
- logger.error("Failed to list package pages", { error });
295069
+ logger.error("Failed to list package data apps", { error });
294932
295070
  const { json, status } = internalErrorToHttpError(error);
294933
295071
  res.status(status).json(json);
294934
295072
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/server",
3
3
  "description": "Malloy Publisher Server",
4
- "version": "0.0.240",
4
+ "version": "0.0.241",
5
5
  "main": "dist/server.mjs",
6
6
  "bin": {
7
7
  "malloy-publisher": "dist/server.mjs"
@@ -1 +0,0 @@
1
- import{$ as t,j as o,J as a}from"./index-ByceOJbS.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
@@ -1 +0,0 @@
1
- import{F as j,$ as y,N,j as e,a0 as c,a1 as f,G as s,a2 as k,a3 as u,a4 as v,T as o,a5 as t,a6 as l}from"./index-ByceOJbS.js";function b(){const a=j(),n=a["*"],d=y(),{server:p}=N();if(!a.environmentName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})});if(!a.packageName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});const i={p:3,maxWidth:1200,mx:"auto"};if(n?.startsWith("pages/")&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const h=n.slice(6),g=c({environmentName:a.environmentName,packageName:a.packageName,modelPath:h});return e.jsx(f,{resourceUri:g})}const r=c({environmentName:a.environmentName,packageName:a.packageName,modelPath:n});if(n?.endsWith(".malloy"))return e.jsx(s,{sx:i,children:e.jsx(k,{resourceUri:r,runOnDemand:!0,maxResultSize:512*1024})});if(n?.endsWith(".malloynb"))return e.jsx(s,{sx:i,children:e.jsx(u,{resourceUri:r,maxResultSize:1024*1024,onNavigate:d})});const x=/\.[^./]+$/.test(n??""),m=v({server:p,environmentName:a.environmentName,packageName:a.packageName,path:n??""});return e.jsxs(s,{sx:i,children:[e.jsx(o,{variant:"h6",sx:{fontWeight:600},children:"Nothing to open at this path"}),e.jsxs(o,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[e.jsx(s,{component:"span",sx:{fontFamily:t},children:n})," ","does not name a"," ",e.jsx(s,{component:"span",sx:{fontFamily:t},children:".malloy"})," ","or"," ",e.jsx(s,{component:"span",sx:{fontFamily:t},children:".malloynb"})," ","file in package"," ",e.jsx(s,{component:"span",sx:{fontFamily:t},children:a.packageName}),". This address opens"," ",e.jsx(s,{component:"span",sx:{fontFamily:t},children:".malloy"})," ","and"," ",e.jsx(s,{component:"span",sx:{fontFamily:t},children:".malloynb"})," ","files."]}),x&&e.jsxs(o,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",e.jsx(s,{component:"span",sx:{fontFamily:t},children:"public/"})," ","directory is served at ",e.jsx(l,{href:m,children:m}),"."]}),e.jsxs(o,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[e.jsxs(l,{href:`/${encodeURIComponent(a.environmentName)}/${encodeURIComponent(a.packageName)}`,children:["Back to ",a.packageName]})," ","lists this package's models, notebooks, and pages."]})]})}export{b as default};
@@ -1 +0,0 @@
1
- import{aa as o,j as r,ab as s,ac as a,G as n,T as t}from"./index-ByceOJbS.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(a,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(n,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(t,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};