@malloy-publisher/server 0.0.237 → 0.0.239
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 +291 -60
- package/dist/app/assets/{EnvironmentPage-DaP6CpgK.js → EnvironmentPage-2oMC3DUO.js} +1 -1
- package/dist/app/assets/{HomePage-C9yNw3iu.js → HomePage-DmgHdpH6.js} +1 -1
- package/dist/app/assets/{LightMode-Be4-G-dX.js → LightMode-BNaG4oAx.js} +1 -1
- package/dist/app/assets/{MainPage-J_rU2SgI.js → MainPage-Dje9yqIp.js} +2 -2
- package/dist/app/assets/{MaterializationsPage-DHgPI4MO.js → MaterializationsPage-D4jCpScu.js} +1 -1
- package/dist/app/assets/{ModelPage-BzXfjTu5.js → ModelPage-oI3O6TwY.js} +1 -1
- package/dist/app/assets/{PackagePage-ByoSTLJ4.js → PackagePage-DlO2UBEI.js} +1 -1
- package/dist/app/assets/{RouteError-CrSeKN2r.js → RouteError-B5MgkwXx.js} +1 -1
- package/dist/app/assets/{ThemeEditorPage-Btxnmhtk.js → ThemeEditorPage-DZzT5zt4.js} +1 -1
- package/dist/app/assets/{WorkbookPage-D6JLPnWO.js → WorkbookPage-CfDz8XAp.js} +1 -1
- package/dist/app/assets/{core-BSRgt1mG.es-Bc_D2Lq4.js → core-BGHaIj_q.es-BeNX3GvK.js} +1 -1
- package/dist/app/assets/{index-DMAhIJNC.js → index-BeZphO3v.js} +1 -1
- package/dist/app/assets/{index-Cvy0xtb7.js → index-BfV8vaZu.js} +1 -1
- package/dist/app/assets/{index-BRijWj6K.js → index-ByceOJbS.js} +4 -4
- package/dist/app/assets/{index-BX4D94xw.js → index-DXjc2oZx.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/package_load_worker.mjs +29 -3
- package/dist/server.mjs +2294 -397
- package/package.json +2 -2
|
@@ -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-BRijWj6K.js";import{r as Jd,a as dA,d as xt}from"./index-Cvy0xtb7.js";import{r as Wa}from"./index-w_0OQJgZ.js";import{d as AU}from"./index-DMAhIJNC.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{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`
|
|
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:""}),
|
package/dist/app/index.html
CHANGED
|
@@ -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-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-ByceOJbS.js"></script>
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/index-5eLCcNmP.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
@@ -11492,6 +11492,8 @@ function internalErrorToHttpError(error) {
|
|
|
11492
11492
|
return httpError(413, error.message);
|
|
11493
11493
|
} else if (error instanceof QueryTimeoutError) {
|
|
11494
11494
|
return httpError(504, error.message);
|
|
11495
|
+
} else if (error instanceof NotImplementedError) {
|
|
11496
|
+
return httpError(501, error.message);
|
|
11495
11497
|
} else {
|
|
11496
11498
|
return httpError(500, error.message);
|
|
11497
11499
|
}
|
|
@@ -11505,7 +11507,7 @@ function httpError(code, message) {
|
|
|
11505
11507
|
}
|
|
11506
11508
|
};
|
|
11507
11509
|
}
|
|
11508
|
-
var NotImplementedError, BadRequestError, EnvironmentNotFoundError, PackageNotFoundError, ModelNotFoundError, ConnectionNotFoundError, ConnectionError, DestinationNotFoundError, ConnectionAuthError, UnsupportedCatalogFormatError, ModelCompilationError, MaterializationEligibilityError, FrozenConfigError, AccessDeniedError, NotQueryableError, MaterializationNotFoundError, MaterializationConflictError, InvalidStateTransitionError, ServiceUnavailableError, PayloadTooLargeError, ResponseUnserializableError, QueryTimeoutError;
|
|
11510
|
+
var NotImplementedError, BadRequestError, InvalidArgumentError, EnvironmentNotFoundError, PackageNotFoundError, ModelNotFoundError, ConnectionNotFoundError, ConnectionError, DestinationNotFoundError, ConnectionAuthError, UnsupportedCatalogFormatError, ModelCompilationError, MaterializationEligibilityError, FrozenConfigError, AccessDeniedError, NotQueryableError, MaterializationNotFoundError, MaterializationConflictError, InvalidStateTransitionError, ServiceUnavailableError, PayloadTooLargeError, ResponseUnserializableError, QueryTimeoutError;
|
|
11509
11511
|
var init_errors = __esm(() => {
|
|
11510
11512
|
init_constants();
|
|
11511
11513
|
NotImplementedError = class NotImplementedError extends Error {
|
|
@@ -11518,6 +11520,8 @@ var init_errors = __esm(() => {
|
|
|
11518
11520
|
super(message);
|
|
11519
11521
|
}
|
|
11520
11522
|
};
|
|
11523
|
+
InvalidArgumentError = class InvalidArgumentError extends BadRequestError {
|
|
11524
|
+
};
|
|
11521
11525
|
EnvironmentNotFoundError = class EnvironmentNotFoundError extends Error {
|
|
11522
11526
|
constructor(message) {
|
|
11523
11527
|
super(message);
|
|
@@ -12015,10 +12019,32 @@ function modelAnnotations(modelDef) {
|
|
|
12015
12019
|
}
|
|
12016
12020
|
return folded ?? {};
|
|
12017
12021
|
}
|
|
12022
|
+
function ownModelNotes(modelDef) {
|
|
12023
|
+
const registry = modelDef.modelAnnotations ?? {};
|
|
12024
|
+
const isSameDocument = (id) => id === modelDef.modelID || id.startsWith("internal://");
|
|
12025
|
+
const seen = new Set;
|
|
12026
|
+
const texts = [];
|
|
12027
|
+
const visit = (id) => {
|
|
12028
|
+
if (seen.has(id) || !isSameDocument(id))
|
|
12029
|
+
return;
|
|
12030
|
+
seen.add(id);
|
|
12031
|
+
const entry = registry[id];
|
|
12032
|
+
if (!entry)
|
|
12033
|
+
return;
|
|
12034
|
+
for (const dep of entry.inheritsFrom)
|
|
12035
|
+
visit(dep);
|
|
12036
|
+
texts.push(...ownLevelNoteTexts(entry.ownNotes));
|
|
12037
|
+
};
|
|
12038
|
+
visit(modelDef.modelID);
|
|
12039
|
+
return texts;
|
|
12040
|
+
}
|
|
12018
12041
|
function annotationTexts(annote) {
|
|
12019
12042
|
const texts = new Annotations(annote).texts();
|
|
12020
12043
|
return texts.length > 0 ? texts : undefined;
|
|
12021
12044
|
}
|
|
12045
|
+
function ownLevelNoteTexts(annote) {
|
|
12046
|
+
return [...annote?.blockNotes ?? [], ...annote?.notes ?? []].map((note) => note.text);
|
|
12047
|
+
}
|
|
12022
12048
|
|
|
12023
12049
|
// src/service/filter.ts
|
|
12024
12050
|
var VALID_FILTER_TYPES = new Set([
|
|
@@ -12253,12 +12279,12 @@ function extractSourcesFromModelDef(modelDef, givens, onParseError) {
|
|
|
12253
12279
|
onParseError?.(sourceName, err);
|
|
12254
12280
|
}
|
|
12255
12281
|
}
|
|
12256
|
-
const ownNotes = (struct.annotations
|
|
12282
|
+
const ownNotes = ownLevelNoteTexts(struct.annotations);
|
|
12257
12283
|
const ownGates = collectAuthorizeExprs(ownNotes);
|
|
12258
12284
|
let inheritedGates = [];
|
|
12259
12285
|
if (ownGates.length === 0) {
|
|
12260
12286
|
for (let cur2 = struct.annotations?.inherits;cur2; cur2 = cur2.inherits) {
|
|
12261
|
-
const exprs = collectAuthorizeExprs((cur2
|
|
12287
|
+
const exprs = collectAuthorizeExprs(ownLevelNoteTexts(cur2));
|
|
12262
12288
|
if (exprs.length > 0) {
|
|
12263
12289
|
inheritedGates = exprs;
|
|
12264
12290
|
break;
|