@malloydata/render 0.0.408 → 0.0.409
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/module/index.mjs +1174 -1186
- package/dist/module/index.umd.js +2 -2
- package/package.json +5 -5
package/dist/module/index.umd.js
CHANGED
|
@@ -1359,7 +1359,7 @@ z\fzzט\vzzz{{{\x07{ן
|
|
|
1359
1359
|
| ${j}`,W>0&&(de=de+`
|
|
1360
1360
|
| ${" ".repeat(W)}^`)}else de=`line ${H+1}: char ${W}: ${ae.message}`}ne!==$&&(de=`FILE: ${$}
|
|
1361
1361
|
`+de,ne=$),V!==""?V=`${V}
|
|
1362
|
-
${de}`:V=de}return V}childRequest(V){var ne;const ae=decodeURI(new URL(V,this.sourceURL).toString()),de=(ne=this.childTranslators.get(ae))===null||ne===void 0?void 0:ne.translate();if(de!=null&&de.compileSQL)return{compileSQL:de.compileSQL}}importModelDef(V){const ne=decodeURI(new URL(V,this.sourceURL).toString()),ae=this.childTranslators.get(ne);if(ae)return ae.translate().modelDef}translate(V){if(this.finalAnswer)return this.finalAnswer;const ne=this.translateStep.step(this,V);return ne.final&&(this.finalAnswer=ne),ne}translatorForDependency(V){return this.childTranslators.get(V)}importAt(V){for(let ne=0;ne<this.imports.length;ne++){const ae=this.imports[ne];if((0,g.locationContainsPosition)(ae.location,V))return ae}}metadata(){return this.metadataStep.step(this)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(V){return this.completionsStep.step(this,V)}helpContext(V){return this.helpContextStep.step(this,V)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(V){return(0,g.rangeFromContext)(this.parseStep.sourceInfo,V)}firstReferenceToDialect(V){return this.dialectAlreadyChecked[V]?!1:(this.dialectAlreadyChecked[V]=!0,!0)}experimentalDialectEnabled(V){if(this.allDialectsEnabled)return!0;const ne=this.getCompilerFlags().tag("experimental");return ne!==void 0&&(ne.bare()||ne.has("dialect",V))}}eo.MalloyTranslation=B;class z extends B{constructor(V,ne){super(V),this.root=ne}}eo.MalloyChildTranslator=z;class Z extends B{constructor(V,ne=null,ae=null,de=null,$=!1){super(V,ne),this.eventStream=de,this.restrictedMode=$,this.schemaZone=new l.Zone,this.importZone=new l.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new l.Zone,this.connectionDialectZone=new l.Zone,this.root=this,this.logger=new a.BaseMessageLogger(de),ae&&this.update(ae)}update(V){var ne,ae,de,$;this.schemaZone.updateFrom(V.tables,(ne=V.errors)===null||ne===void 0?void 0:ne.tables),this.importZone.updateFrom(V.urls,(ae=V.errors)===null||ae===void 0?void 0:ae.urls),this.sqlQueryZone.updateFrom(V.compileSQL,(de=V.errors)===null||de===void 0?void 0:de.compileSQL),this.connectionDialectZone.updateFrom(V.connectionDialects,($=V.errors)===null||$===void 0?void 0:$.connectionDialects);for(const H in V.translations)this.pretranslatedModels.set(H,V.translations[H])}lockZonesIfRestricted(){this.restrictedMode&&(this.schemaZone.lock(),this.importZone.lock(),this.sqlQueryZone.lock(),this.connectionDialectZone.lock())}translate(V){return this.lockZonesIfRestricted(),super.translate(V)}logError(V,ne,ae){return this.logger.log((0,a.makeLogMessage)(V,ne,{severity:"error",...ae})),V}}eo.MalloyTranslator=Z;function oe(fe){return[...Object.keys(fe),...Object.keys(fe).map(V=>oe(fe[V])).flat()]}return eo}var My={},ble;function tIe(){if(ble)return My;ble=1,Object.defineProperty(My,"__esModule",{value:!0}),My.ExploreQueryWalker=void 0,My.exploreQueryWalkerBuilder=n;const e=Oy();class t{constructor(i){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=i}exploreQueryAtOffset(i){return this.exploreClauseRefs.find(s=>s.range[0]===void 0||s.range[1]===void 0?!1:s.range[0]<=i&&s.range[1]>=i)}filterAtOffset(i){const s=this.exploreQueryAtOffset(i);if(s)return s.filterRefs.find(o=>o.range[0]===void 0||o.range[1]===void 0?!1:o.range[0]<=i&&o.range[1]>=i)}hasFilterListAtOffset(i){const s=this.exploreQueryAtOffset(i);return s?!!s.filterLists.find(o=>o.range[0]===void 0||o.range[1]===void 0?!1:o.range[0]<=i&&o.range[1]>=i):!1}enterMalloyDocument(){this.inDocument=!0}}My.ExploreQueryWalker=t;function n(r,i){const s=new t(r),o=s;return e.ParseTreeWalker.DEFAULT.walk(o,i),s}return My}var Ja={},ak={},ky={},Cle;function uk(){if(Cle)return ky;Cle=1,Object.defineProperty(ky,"__esModule",{value:!0}),ky.validateCanonicalTablePath=t,ky.validateCanonicalTablePathAnyDialect=n,ky.requireCanonicalTablePathAnyDialect=r;const e=V4();function t(i,s){let o;try{o=(0,e.getDialect)(i)}catch{return`tablePath '${s}' cannot be validated: unknown dialect '${i}'`}const a=o.sqlValidateTableName(s);if(!a.ok)return`tablePath '${s}' is not canonical SQL for the ${i} dialect; the translator must validate before passing it here. (${a.error})`;if(a.canonical!==s)return`tablePath '${s}' is not canonical SQL for the ${i} dialect; the translator must validate before passing it here.`}function n(i){let s;for(const o of(0,e.getDialects)()){const a=o.sqlValidateTableName(i);if(a.ok){if(a.canonical===i)return;s===void 0&&(s=a.canonical)}}return s!==void 0?`value '${i}' is not canonical SQL; did you mean '${s}'?`:`value '${i}' is not a valid canonical table path in any registered dialect`}function r(i,s){const o=n(i);if(o!==void 0)throw new Error(`${s}: ${o}`)}return ky}var so={},$1={},PA={},Tle;function Rle(){return Tle||(Tle=1,Object.defineProperty(PA,"__esModule",{value:!0}),PA.MALLOY_INTERFACE_TYPES=void 0,PA.MALLOY_INTERFACE_TYPES={Aggregate:{type:"struct",name:"Aggregate",fields:{name:{type:"string",optional:!0,array:!1},field:{type:"Field",optional:!1,array:!1}}},Annotation:{type:"struct",name:"Annotation",fields:{value:{type:"string",optional:!1,array:!1}}},AnonymousQueryInfo:{type:"struct",name:"AnonymousQueryInfo",fields:{schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},definition:{type:"Query",optional:!0,array:!1},code:{type:"string",optional:!0,array:!1},location:{type:"Location",optional:!0,array:!1}}},ArrayCell:{type:"struct",name:"ArrayCell",fields:{array_value:{type:"Cell",array:!0,optional:!1}}},ArrayType:{type:"struct",name:"ArrayType",fields:{element_type:{type:"AtomicType",optional:!1,array:!1}}},AtomicType:{type:"union",name:"AtomicType",options:{string_type:"StringType",boolean_type:"BooleanType",number_type:"NumberType",json_type:"JSONType",sql_native_type:"SQLNativeType",date_type:"DateType",timestamp_type:"TimestampType",array_type:"ArrayType",record_type:"RecordType",timestamptz_type:"TimestamptzType"}},BooleanCell:{type:"struct",name:"BooleanCell",fields:{boolean_value:{type:"boolean",optional:!1,array:!1}}},BooleanLiteral:{type:"struct",name:"BooleanLiteral",fields:{boolean_value:{type:"boolean",optional:!1,array:!1}}},BooleanType:{type:"struct",name:"BooleanType",fields:{}},CalculateInfo:{type:"struct",name:"CalculateInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"AtomicType",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},CalculateOperation:{type:"struct",name:"CalculateOperation",fields:{name:{type:"string",optional:!1,array:!1},field:{type:"Field",optional:!1,array:!1}}},Cell:{type:"union",name:"Cell",options:{string_cell:"StringCell",boolean_cell:"BooleanCell",date_cell:"DateCell",timestamp_cell:"TimestampCell",number_cell:"NumberCell",json_cell:"JSONCell",record_cell:"RecordCell",array_cell:"ArrayCell",null_cell:"NullCell",sql_native_cell:"SQLNativeCell"}},CompileModelRequest:{type:"struct",name:"CompileModelRequest",fields:{model_url:{type:"string",optional:!1,array:!1},extend_model_url:{type:"string",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},CompileModelResponse:{type:"struct",name:"CompileModelResponse",fields:{model:{type:"ModelInfo",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},translations:{type:"Translation",array:!0,optional:!0},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},CompileQueryRequest:{type:"struct",name:"CompileQueryRequest",fields:{model_url:{type:"string",optional:!1,array:!1},query:{type:"Query",optional:!0,array:!1},query_malloy:{type:"string",optional:!0,array:!1},default_row_limit:{type:"number",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},CompileQueryResponse:{type:"struct",name:"CompileQueryResponse",fields:{result:{type:"Result",optional:!0,array:!1},default_row_limit_added:{type:"number",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},translations:{type:"Translation",array:!0,optional:!0},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},CompileSourceRequest:{type:"struct",name:"CompileSourceRequest",fields:{model_url:{type:"string",optional:!1,array:!1},name:{type:"string",optional:!1,array:!1},extend_model_url:{type:"string",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},CompileSourceResponse:{type:"struct",name:"CompileSourceResponse",fields:{source:{type:"SourceInfo",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},CompilerNeeds:{type:"struct",name:"CompilerNeeds",fields:{table_schemas:{type:"SQLTable",array:!0,optional:!0},sql_schemas:{type:"SQLQuery",array:!0,optional:!0},files:{type:"File",array:!0,optional:!0},connections:{type:"Connection",array:!0,optional:!0},translations:{type:"Translation",array:!0,optional:!0}}},Connection:{type:"struct",name:"Connection",fields:{name:{type:"string",optional:!1,array:!1},dialect:{type:"string",optional:!0,array:!1}}},Data:{type:"union",name:"Data",options:{record_cell:"RecordCell",array_cell:"ArrayCell"}},DateCell:{type:"struct",name:"DateCell",fields:{date_value:{type:"string",optional:!1,array:!1}}},DateLiteral:{type:"struct",name:"DateLiteral",fields:{date_value:{type:"string",optional:!1,array:!1},granularity:{type:"DateTimeframe",optional:!0,array:!1},timezone:{type:"string",optional:!0,array:!1}}},DateTimeframe:{type:"enum",name:"DateTimeframe",values:{year:1,quarter:2,month:3,week:4,day:5}},DateType:{type:"struct",name:"DateType",fields:{timeframe:{type:"DateTimeframe",optional:!0,array:!1}}},DimensionInfo:{type:"struct",name:"DimensionInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"AtomicType",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},DocumentPosition:{type:"struct",name:"DocumentPosition",fields:{line:{type:"number",optional:!1,array:!1},character:{type:"number",optional:!1,array:!1}}},DocumentRange:{type:"struct",name:"DocumentRange",fields:{start:{type:"DocumentPosition",optional:!1,array:!1},end:{type:"DocumentPosition",optional:!1,array:!1}}},DrillOperation:{type:"struct",name:"DrillOperation",fields:{filter:{type:"Filter",optional:!1,array:!1}}},Expression:{type:"union",name:"Expression",options:{field_reference:"Reference",time_truncation:"TimeTruncationFieldReference",filtered_field:"FilteredField",literal_value:"LiteralValueExpression",moving_average:"MovingAverage"}},Field:{type:"struct",name:"Field",fields:{expression:{type:"Expression",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},FieldInfo:{type:"union",name:"FieldInfo",options:{dimension:"DimensionInfo",measure:"MeasureInfo",join:"JoinInfo",view:"ViewInfo",calculate:"CalculateInfo"}},File:{type:"struct",name:"File",fields:{url:{type:"string",optional:!1,array:!1},contents:{type:"string",optional:!0,array:!1},invalidation_key:{type:"string",optional:!0,array:!1}}},Filter:{type:"union",name:"Filter",options:{filter_string:"FilterStringApplication",literal_equality:"LiteralEqualityComparison"}},FilterExpressionLiteral:{type:"struct",name:"FilterExpressionLiteral",fields:{filter_expression_value:{type:"string",optional:!1,array:!1}}},FilterExpressionType:{type:"struct",name:"FilterExpressionType",fields:{filter_type:{type:"FilterableType",optional:!1,array:!1}}},FilterOperation:{type:"struct",name:"FilterOperation",fields:{filter:{type:"Filter",optional:!1,array:!1}}},FilterStringApplication:{type:"struct",name:"FilterStringApplication",fields:{expression:{type:"Expression",optional:!1,array:!1},filter:{type:"string",optional:!1,array:!1}}},FilterableType:{type:"union",name:"FilterableType",options:{string_type:"StringType",boolean_type:"BooleanType",number_type:"NumberType",date_type:"DateType",timestamp_type:"TimestampType",timestamptz_type:"TimestamptzType"}},FilteredField:{type:"struct",name:"FilteredField",fields:{field_reference:{type:"Reference",optional:!1,array:!1},where:{type:"FilterOperation",array:!0,optional:!1}}},GroupBy:{type:"struct",name:"GroupBy",fields:{name:{type:"string",optional:!0,array:!1},field:{type:"Field",optional:!1,array:!1}}},JSONCell:{type:"struct",name:"JSONCell",fields:{json_value:{type:"string",optional:!1,array:!1}}},JSONType:{type:"struct",name:"JSONType",fields:{}},JoinInfo:{type:"struct",name:"JoinInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},relationship:{type:"Relationship",optional:!1,array:!1}}},Limit:{type:"struct",name:"Limit",fields:{limit:{type:"number",optional:!1,array:!1}}},LiteralEqualityComparison:{type:"struct",name:"LiteralEqualityComparison",fields:{expression:{type:"Expression",optional:!1,array:!1},value:{type:"LiteralValue",optional:!1,array:!1}}},LiteralValue:{type:"union",name:"LiteralValue",options:{string_literal:"StringLiteral",number_literal:"NumberLiteral",date_literal:"DateLiteral",timestamp_literal:"TimestampLiteral",boolean_literal:"BooleanLiteral",null_literal:"NullLiteral",filter_expression_literal:"FilterExpressionLiteral"}},LiteralValueExpression:{type:"struct",name:"LiteralValueExpression",fields:{literal_value:{type:"LiteralValue",optional:!1,array:!1}}},Location:{type:"struct",name:"Location",fields:{url:{type:"string",optional:!1,array:!1},range:{type:"Range",optional:!1,array:!1}}},LogMessage:{type:"struct",name:"LogMessage",fields:{url:{type:"string",optional:!1,array:!1},range:{type:"DocumentRange",optional:!1,array:!1},severity:{type:"LogSeverity",optional:!1,array:!1},message:{type:"string",optional:!1,array:!1}}},LogSeverity:{type:"enum",name:"LogSeverity",values:{debug:1,info:2,warn:3,error:4}},MeasureInfo:{type:"struct",name:"MeasureInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"AtomicType",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},ModelEntryValue:{type:"union",name:"ModelEntryValue",options:{source:"SourceInfo",query:"QueryInfo"}},ModelInfo:{type:"struct",name:"ModelInfo",fields:{entries:{type:"ModelEntryValue",array:!0,optional:!1},annotations:{type:"Annotation",array:!0,optional:!0},anonymous_queries:{type:"AnonymousQueryInfo",array:!0,optional:!1}}},MovingAverage:{type:"struct",name:"MovingAverage",fields:{field_reference:{type:"Reference",optional:!1,array:!1},rows_preceding:{type:"number",optional:!0,array:!1},rows_following:{type:"number",optional:!0,array:!1},partition_fields:{type:"Reference",array:!0,optional:!0}}},Nest:{type:"struct",name:"Nest",fields:{name:{type:"string",optional:!0,array:!1},view:{type:"View",optional:!1,array:!1}}},NullCell:{type:"struct",name:"NullCell",fields:{}},NullLiteral:{type:"struct",name:"NullLiteral",fields:{}},NumberCell:{type:"struct",name:"NumberCell",fields:{number_value:{type:"number",optional:!1,array:!1},subtype:{type:"NumberSubtype",optional:!0,array:!1},string_value:{type:"string",optional:!0,array:!1}}},NumberLiteral:{type:"struct",name:"NumberLiteral",fields:{number_value:{type:"number",optional:!1,array:!1},string_value:{type:"string",optional:!0,array:!1}}},NumberSubtype:{type:"enum",name:"NumberSubtype",values:{integer:1,decimal:2,bigint:3}},NumberType:{type:"struct",name:"NumberType",fields:{subtype:{type:"NumberSubtype",optional:!0,array:!1}}},OrderBy:{type:"struct",name:"OrderBy",fields:{field_reference:{type:"Reference",optional:!1,array:!1},direction:{type:"OrderByDirection",optional:!0,array:!1}}},OrderByDirection:{type:"enum",name:"OrderByDirection",values:{asc:1,desc:2}},ParameterInfo:{type:"struct",name:"ParameterInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"ParameterType",optional:!1,array:!1},default_value:{type:"LiteralValue",optional:!0,array:!1}}},ParameterType:{type:"union",name:"ParameterType",options:{string_type:"StringType",boolean_type:"BooleanType",number_type:"NumberType",json_type:"JSONType",sql_native_type:"SQLNativeType",date_type:"DateType",timestamp_type:"TimestampType",array_type:"ArrayType",record_type:"RecordType",filter_expression_type:"FilterExpressionType",timestamptz_type:"TimestamptzType"}},ParameterValue:{type:"struct",name:"ParameterValue",fields:{name:{type:"string",optional:!1,array:!1},value:{type:"LiteralValue",optional:!1,array:!1}}},Position:{type:"struct",name:"Position",fields:{line:{type:"number",optional:!1,array:!1},character:{type:"number",optional:!1,array:!1}}},Query:{type:"struct",name:"Query",fields:{definition:{type:"QueryDefinition",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},QueryArrow:{type:"struct",name:"QueryArrow",fields:{source:{type:"QueryArrowSource",optional:!1,array:!1},view:{type:"ViewDefinition",optional:!1,array:!1}}},QueryArrowSource:{type:"union",name:"QueryArrowSource",options:{refinement:"QueryRefinement",source_reference:"Reference"}},QueryDefinition:{type:"union",name:"QueryDefinition",options:{arrow:"QueryArrow",query_reference:"Reference",refinement:"QueryRefinement"}},QueryInfo:{type:"struct",name:"QueryInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},definition:{type:"Query",optional:!0,array:!1},code:{type:"string",optional:!0,array:!1},location:{type:"Location",optional:!0,array:!1}}},QueryRefinement:{type:"struct",name:"QueryRefinement",fields:{base:{type:"QueryDefinition",optional:!1,array:!1},refinement:{type:"ViewDefinition",optional:!1,array:!1}}},Range:{type:"struct",name:"Range",fields:{start:{type:"Position",optional:!1,array:!1},end:{type:"Position",optional:!1,array:!1}}},RecordCell:{type:"struct",name:"RecordCell",fields:{record_value:{type:"Cell",array:!0,optional:!1}}},RecordType:{type:"struct",name:"RecordType",fields:{fields:{type:"DimensionInfo",array:!0,optional:!1}}},Reference:{type:"struct",name:"Reference",fields:{name:{type:"string",optional:!1,array:!1},path:{type:"string",array:!0,optional:!0},parameters:{type:"ParameterValue",array:!0,optional:!0}}},Relationship:{type:"enum",name:"Relationship",values:{one:1,many:2,cross:3}},Result:{type:"struct",name:"Result",fields:{data:{type:"Data",optional:!0,array:!1},schema:{type:"Schema",optional:!1,array:!1},sql:{type:"string",optional:!0,array:!1},connection_name:{type:"string",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},model_annotations:{type:"Annotation",array:!0,optional:!0},query_timezone:{type:"string",optional:!0,array:!1},source_annotations:{type:"Annotation",array:!0,optional:!0}}},RunIndexQueryRequest:{type:"struct",name:"RunIndexQueryRequest",fields:{model_url:{type:"string",optional:!1,array:!1},source_name:{type:"string",optional:!1,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},RunIndexQueryResponse:{type:"struct",name:"RunIndexQueryResponse",fields:{result:{type:"Result",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},RunQueryRequest:{type:"struct",name:"RunQueryRequest",fields:{model_url:{type:"string",optional:!1,array:!1},query:{type:"Query",optional:!0,array:!1},query_malloy:{type:"string",optional:!0,array:!1},default_row_limit:{type:"number",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},RunQueryResponse:{type:"struct",name:"RunQueryResponse",fields:{result:{type:"Result",optional:!0,array:!1},default_row_limit_added:{type:"number",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},SQLNativeCell:{type:"struct",name:"SQLNativeCell",fields:{sql_native_value:{type:"string",optional:!1,array:!1}}},SQLNativeType:{type:"struct",name:"SQLNativeType",fields:{sql_type:{type:"string",optional:!0,array:!1}}},SQLQuery:{type:"struct",name:"SQLQuery",fields:{sql:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!0,array:!1},connection_name:{type:"string",optional:!1,array:!1}}},SQLTable:{type:"struct",name:"SQLTable",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!0,array:!1},connection_name:{type:"string",optional:!1,array:!1}}},Schema:{type:"struct",name:"Schema",fields:{fields:{type:"FieldInfo",array:!0,optional:!1}}},SourceInfo:{type:"struct",name:"SourceInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},parameters:{type:"ParameterInfo",array:!0,optional:!0}}},StringCell:{type:"struct",name:"StringCell",fields:{string_value:{type:"string",optional:!1,array:!1}}},StringLiteral:{type:"struct",name:"StringLiteral",fields:{string_value:{type:"string",optional:!1,array:!1}}},StringType:{type:"struct",name:"StringType",fields:{}},TimeTruncationFieldReference:{type:"struct",name:"TimeTruncationFieldReference",fields:{field_reference:{type:"Reference",optional:!1,array:!1},truncation:{type:"TimestampTimeframe",optional:!1,array:!1}}},TimestampCell:{type:"struct",name:"TimestampCell",fields:{timestamp_value:{type:"string",optional:!1,array:!1}}},TimestampLiteral:{type:"struct",name:"TimestampLiteral",fields:{timestamp_value:{type:"string",optional:!1,array:!1},granularity:{type:"TimestampTimeframe",optional:!0,array:!1},timezone:{type:"string",optional:!0,array:!1}}},TimestampTimeframe:{type:"enum",name:"TimestampTimeframe",values:{year:1,quarter:2,month:3,week:4,day:5,hour:6,minute:7,second:8}},TimestampType:{type:"struct",name:"TimestampType",fields:{timeframe:{type:"TimestampTimeframe",optional:!0,array:!1}}},TimestamptzType:{type:"struct",name:"TimestamptzType",fields:{timeframe:{type:"TimestampTimeframe",optional:!0,array:!1}}},TimingInfo:{type:"struct",name:"TimingInfo",fields:{name:{type:"string",optional:!1,array:!1},duration_ms:{type:"number",optional:!1,array:!1},detailed_timing:{type:"TimingInfo",array:!0,optional:!0}}},Translation:{type:"struct",name:"Translation",fields:{url:{type:"string",optional:!1,array:!1},compiled_model_json:{type:"string",optional:!0,array:!1}}},View:{type:"struct",name:"View",fields:{definition:{type:"ViewDefinition",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},ViewArrow:{type:"struct",name:"ViewArrow",fields:{source:{type:"ViewDefinition",optional:!1,array:!1},view:{type:"ViewDefinition",optional:!1,array:!1}}},ViewDefinition:{type:"union",name:"ViewDefinition",options:{arrow:"ViewArrow",view_reference:"Reference",refinement:"ViewRefinement",segment:"ViewSegment"}},ViewInfo:{type:"struct",name:"ViewInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},definition:{type:"View",optional:!0,array:!1}}},ViewOperation:{type:"union",name:"ViewOperation",options:{group_by:"GroupBy",aggregate:"Aggregate",order_by:"OrderBy",limit:"Limit",where:"FilterOperation",nest:"Nest",having:"FilterOperation",drill:"DrillOperation",calculate:"CalculateOperation"}},ViewRefinement:{type:"struct",name:"ViewRefinement",fields:{base:{type:"ViewDefinition",optional:!1,array:!1},refinement:{type:"ViewDefinition",optional:!1,array:!1}}},ViewSegment:{type:"struct",name:"ViewSegment",fields:{operations:{type:"ViewOperation",array:!0,optional:!1}}}}),PA}var $A={},jR={},BA={},wle;function nIe(){return wle||(wle=1,Object.defineProperty(BA,"__esModule",{value:!0}),BA.RESERVED_WORDS=void 0,BA.RESERVED_WORDS=["accept","aggregate","declare","dimension","except","explore","group_by","having","index","join_cross","join_one","join_many","limit","measure","nest","order_by","primary_key","project","query","rename","sample","source","sql","turduck","top","where","all","as","asc","avg","boolean","by","case","cast","condition","count","date","day","days","desc","distinct","else","end","exclude","false","for","from","from_sql","has","hour","hours","import","is","json","last","max","min","minute","minutes","month","months","not","now","null","number","on","or","pick","quarter","quarters","second","seconds","string","sum","table","then","this","timestamp","to","true","turtle","week","weeks","when","with","year","years","ungrouped"]),BA}var Dle;function rIe(){if(Dle)return jR;Dle=1,Object.defineProperty(jR,"__esModule",{value:!0}),jR.maybeQuoteIdentifier=n;const e=nIe();function t(r){const i=!r.match(/^[A-Za-z_][A-Za-z_0-9]*$/),s=e.RESERVED_WORDS.includes(r.toLowerCase());return i||s}function n(r){return t(r)?`\`${r}\``:r}return jR}var Ole;function iIe(){if(Ole)return $A;Ole=1,Object.defineProperty($A,"__esModule",{value:!0}),$A.queryToMalloy=t,$A.filterToMalloy=n;const e=rIe();function t(L,{tabWidth:N}={tabWidth:2}){const k=m(L);return a(k,{tabWidth:N})}function n(L,{tabWidth:N}={tabWidth:2}){const k=H(L);return a(k,{tabWidth:N})}const r=Symbol("indent"),i=Symbol("newline"),s=Symbol("outdent"),o=Symbol("optional_newline_indent");function a(L,{tabWidth:N}={tabWidth:2}){let k="",U=0,Y=!0;for(const G of L)if(G===i)k+=`
|
|
1362
|
+
${de}`:V=de}return V}childRequest(V){var ne;const ae=decodeURI(new URL(V,this.sourceURL).toString()),de=(ne=this.childTranslators.get(ae))===null||ne===void 0?void 0:ne.translate();if(de!=null&&de.compileSQL)return{compileSQL:de.compileSQL}}importModelDef(V){const ne=decodeURI(new URL(V,this.sourceURL).toString()),ae=this.childTranslators.get(ne);if(ae)return ae.translate().modelDef}translate(V){if(this.finalAnswer)return this.finalAnswer;const ne=this.translateStep.step(this,V);return ne.final&&(this.finalAnswer=ne),ne}translatorForDependency(V){return this.childTranslators.get(V)}importAt(V){for(let ne=0;ne<this.imports.length;ne++){const ae=this.imports[ne];if((0,g.locationContainsPosition)(ae.location,V))return ae}}metadata(){return this.metadataStep.step(this)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(V){return this.completionsStep.step(this,V)}helpContext(V){return this.helpContextStep.step(this,V)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(V){return(0,g.rangeFromContext)(this.parseStep.sourceInfo,V)}firstReferenceToDialect(V){return this.dialectAlreadyChecked[V]?!1:(this.dialectAlreadyChecked[V]=!0,!0)}experimentalDialectEnabled(V){if(this.allDialectsEnabled)return!0;const ne=this.getCompilerFlags().tag("experimental");return ne!==void 0&&(ne.bare()||ne.has("dialect",V))}}eo.MalloyTranslation=B;class z extends B{constructor(V,ne){super(V),this.root=ne}}eo.MalloyChildTranslator=z;class Z extends B{constructor(V,ne=null,ae=null,de=null,$=!1){super(V,ne),this.eventStream=de,this.restrictedMode=$,this.schemaZone=new l.Zone,this.importZone=new l.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new l.Zone,this.connectionDialectZone=new l.Zone,this.root=this,this.logger=new a.BaseMessageLogger(de),ae&&this.update(ae)}update(V){var ne,ae,de,$;this.schemaZone.updateFrom(V.tables,(ne=V.errors)===null||ne===void 0?void 0:ne.tables),this.importZone.updateFrom(V.urls,(ae=V.errors)===null||ae===void 0?void 0:ae.urls),this.sqlQueryZone.updateFrom(V.compileSQL,(de=V.errors)===null||de===void 0?void 0:de.compileSQL),this.connectionDialectZone.updateFrom(V.connectionDialects,($=V.errors)===null||$===void 0?void 0:$.connectionDialects);for(const H in V.translations)this.pretranslatedModels.set(H,V.translations[H])}lockZonesIfRestricted(){this.restrictedMode&&(this.schemaZone.lock(),this.importZone.lock(),this.sqlQueryZone.lock(),this.connectionDialectZone.lock())}translate(V){return this.lockZonesIfRestricted(),super.translate(V)}logError(V,ne,ae){return this.logger.log((0,a.makeLogMessage)(V,ne,{severity:"error",...ae})),V}}eo.MalloyTranslator=Z;function oe(fe){return[...Object.keys(fe),...Object.keys(fe).map(V=>oe(fe[V])).flat()]}return eo}var My={},ble;function tIe(){if(ble)return My;ble=1,Object.defineProperty(My,"__esModule",{value:!0}),My.ExploreQueryWalker=void 0,My.exploreQueryWalkerBuilder=n;const e=Oy();class t{constructor(i){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=i}exploreQueryAtOffset(i){return this.exploreClauseRefs.find(s=>s.range[0]===void 0||s.range[1]===void 0?!1:s.range[0]<=i&&s.range[1]>=i)}filterAtOffset(i){const s=this.exploreQueryAtOffset(i);if(s)return s.filterRefs.find(o=>o.range[0]===void 0||o.range[1]===void 0?!1:o.range[0]<=i&&o.range[1]>=i)}hasFilterListAtOffset(i){const s=this.exploreQueryAtOffset(i);return s?!!s.filterLists.find(o=>o.range[0]===void 0||o.range[1]===void 0?!1:o.range[0]<=i&&o.range[1]>=i):!1}enterMalloyDocument(){this.inDocument=!0}}My.ExploreQueryWalker=t;function n(r,i){const s=new t(r),o=s;return e.ParseTreeWalker.DEFAULT.walk(o,i),s}return My}var Ja={},ak={},ky={},Cle;function uk(){if(Cle)return ky;Cle=1,Object.defineProperty(ky,"__esModule",{value:!0}),ky.validateCanonicalTablePath=t,ky.validateCanonicalTablePathAnyDialect=n,ky.requireCanonicalTablePathAnyDialect=r;const e=V4();function t(i,s){let o;try{o=(0,e.getDialect)(i)}catch{return`tablePath '${s}' cannot be validated: unknown dialect '${i}'`}const a=o.sqlValidateTableName(s);if(!a.ok)return`tablePath '${s}' is not canonical SQL for the ${i} dialect; the translator must validate before passing it here. (${a.error})`;if(a.canonical!==s)return`tablePath '${s}' is not canonical SQL for the ${i} dialect; the translator must validate before passing it here.`}function n(i){let s;for(const o of(0,e.getDialects)()){const a=o.sqlValidateTableName(i);if(a.ok){if(a.canonical===i)return;s===void 0&&(s=a.canonical)}}return s!==void 0?`value '${i}' is not canonical SQL; did you mean '${s}'?`:`value '${i}' is not a valid canonical table path in any registered dialect`}function r(i,s){const o=n(i);if(o!==void 0)throw new Error(`${s}: ${o}`)}return ky}var so={},$1={},PA={},Tle;function Rle(){return Tle||(Tle=1,Object.defineProperty(PA,"__esModule",{value:!0}),PA.MALLOY_INTERFACE_TYPES=void 0,PA.MALLOY_INTERFACE_TYPES={Aggregate:{type:"struct",name:"Aggregate",fields:{name:{type:"string",optional:!0,array:!1},field:{type:"Field",optional:!1,array:!1}}},Annotation:{type:"struct",name:"Annotation",fields:{value:{type:"string",optional:!1,array:!1}}},AnonymousQueryInfo:{type:"struct",name:"AnonymousQueryInfo",fields:{schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},definition:{type:"Query",optional:!0,array:!1},code:{type:"string",optional:!0,array:!1},location:{type:"Location",optional:!0,array:!1}}},ArrayCell:{type:"struct",name:"ArrayCell",fields:{array_value:{type:"Cell",array:!0,optional:!1}}},ArrayType:{type:"struct",name:"ArrayType",fields:{element_type:{type:"AtomicType",optional:!1,array:!1}}},AtomicType:{type:"union",name:"AtomicType",options:{string_type:"StringType",boolean_type:"BooleanType",number_type:"NumberType",json_type:"JSONType",sql_native_type:"SQLNativeType",date_type:"DateType",timestamp_type:"TimestampType",array_type:"ArrayType",record_type:"RecordType",timestamptz_type:"TimestamptzType"}},BooleanCell:{type:"struct",name:"BooleanCell",fields:{boolean_value:{type:"boolean",optional:!1,array:!1}}},BooleanLiteral:{type:"struct",name:"BooleanLiteral",fields:{boolean_value:{type:"boolean",optional:!1,array:!1}}},BooleanType:{type:"struct",name:"BooleanType",fields:{}},CalculateInfo:{type:"struct",name:"CalculateInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"AtomicType",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},CalculateOperation:{type:"struct",name:"CalculateOperation",fields:{name:{type:"string",optional:!1,array:!1},field:{type:"Field",optional:!1,array:!1}}},Cell:{type:"union",name:"Cell",options:{string_cell:"StringCell",boolean_cell:"BooleanCell",date_cell:"DateCell",timestamp_cell:"TimestampCell",number_cell:"NumberCell",json_cell:"JSONCell",record_cell:"RecordCell",array_cell:"ArrayCell",null_cell:"NullCell",sql_native_cell:"SQLNativeCell"}},CompileModelRequest:{type:"struct",name:"CompileModelRequest",fields:{model_url:{type:"string",optional:!1,array:!1},extend_model_url:{type:"string",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},CompileModelResponse:{type:"struct",name:"CompileModelResponse",fields:{model:{type:"ModelInfo",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},translations:{type:"Translation",array:!0,optional:!0},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},CompileQueryRequest:{type:"struct",name:"CompileQueryRequest",fields:{model_url:{type:"string",optional:!1,array:!1},query:{type:"Query",optional:!0,array:!1},query_malloy:{type:"string",optional:!0,array:!1},default_row_limit:{type:"number",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},CompileQueryResponse:{type:"struct",name:"CompileQueryResponse",fields:{result:{type:"Result",optional:!0,array:!1},default_row_limit_added:{type:"number",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},translations:{type:"Translation",array:!0,optional:!0},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},CompileSourceRequest:{type:"struct",name:"CompileSourceRequest",fields:{model_url:{type:"string",optional:!1,array:!1},name:{type:"string",optional:!1,array:!1},extend_model_url:{type:"string",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},CompileSourceResponse:{type:"struct",name:"CompileSourceResponse",fields:{source:{type:"SourceInfo",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},CompilerNeeds:{type:"struct",name:"CompilerNeeds",fields:{table_schemas:{type:"SQLTable",array:!0,optional:!0},sql_schemas:{type:"SQLQuery",array:!0,optional:!0},files:{type:"File",array:!0,optional:!0},connections:{type:"Connection",array:!0,optional:!0},translations:{type:"Translation",array:!0,optional:!0}}},Connection:{type:"struct",name:"Connection",fields:{name:{type:"string",optional:!1,array:!1},dialect:{type:"string",optional:!0,array:!1}}},Data:{type:"union",name:"Data",options:{record_cell:"RecordCell",array_cell:"ArrayCell"}},DateCell:{type:"struct",name:"DateCell",fields:{date_value:{type:"string",optional:!1,array:!1}}},DateLiteral:{type:"struct",name:"DateLiteral",fields:{date_value:{type:"string",optional:!1,array:!1},granularity:{type:"DateTimeframe",optional:!0,array:!1},timezone:{type:"string",optional:!0,array:!1}}},DateTimeframe:{type:"enum",name:"DateTimeframe",values:{year:1,quarter:2,month:3,week:4,day:5}},DateType:{type:"struct",name:"DateType",fields:{timeframe:{type:"DateTimeframe",optional:!0,array:!1}}},DimensionInfo:{type:"struct",name:"DimensionInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"AtomicType",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},DocumentPosition:{type:"struct",name:"DocumentPosition",fields:{line:{type:"number",optional:!1,array:!1},character:{type:"number",optional:!1,array:!1}}},DocumentRange:{type:"struct",name:"DocumentRange",fields:{start:{type:"DocumentPosition",optional:!1,array:!1},end:{type:"DocumentPosition",optional:!1,array:!1}}},DrillOperation:{type:"struct",name:"DrillOperation",fields:{filter:{type:"Filter",optional:!1,array:!1}}},Expression:{type:"union",name:"Expression",options:{field_reference:"Reference",time_truncation:"TimeTruncationFieldReference",filtered_field:"FilteredField",literal_value:"LiteralValueExpression",moving_average:"MovingAverage"}},Field:{type:"struct",name:"Field",fields:{expression:{type:"Expression",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},FieldInfo:{type:"union",name:"FieldInfo",options:{dimension:"DimensionInfo",measure:"MeasureInfo",join:"JoinInfo",view:"ViewInfo",calculate:"CalculateInfo"}},File:{type:"struct",name:"File",fields:{url:{type:"string",optional:!1,array:!1},contents:{type:"string",optional:!0,array:!1},invalidation_key:{type:"string",optional:!0,array:!1}}},Filter:{type:"union",name:"Filter",options:{filter_string:"FilterStringApplication",literal_equality:"LiteralEqualityComparison"}},FilterExpressionLiteral:{type:"struct",name:"FilterExpressionLiteral",fields:{filter_expression_value:{type:"string",optional:!1,array:!1}}},FilterExpressionType:{type:"struct",name:"FilterExpressionType",fields:{filter_type:{type:"FilterableType",optional:!1,array:!1}}},FilterOperation:{type:"struct",name:"FilterOperation",fields:{filter:{type:"Filter",optional:!1,array:!1}}},FilterStringApplication:{type:"struct",name:"FilterStringApplication",fields:{expression:{type:"Expression",optional:!1,array:!1},filter:{type:"string",optional:!1,array:!1}}},FilterableType:{type:"union",name:"FilterableType",options:{string_type:"StringType",boolean_type:"BooleanType",number_type:"NumberType",date_type:"DateType",timestamp_type:"TimestampType",timestamptz_type:"TimestamptzType"}},FilteredField:{type:"struct",name:"FilteredField",fields:{field_reference:{type:"Reference",optional:!1,array:!1},where:{type:"FilterOperation",array:!0,optional:!1}}},GroupBy:{type:"struct",name:"GroupBy",fields:{name:{type:"string",optional:!0,array:!1},field:{type:"Field",optional:!1,array:!1}}},JSONCell:{type:"struct",name:"JSONCell",fields:{json_value:{type:"string",optional:!1,array:!1}}},JSONType:{type:"struct",name:"JSONType",fields:{}},JoinInfo:{type:"struct",name:"JoinInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},relationship:{type:"Relationship",optional:!1,array:!1}}},Limit:{type:"struct",name:"Limit",fields:{limit:{type:"number",optional:!1,array:!1}}},LiteralEqualityComparison:{type:"struct",name:"LiteralEqualityComparison",fields:{expression:{type:"Expression",optional:!1,array:!1},value:{type:"LiteralValue",optional:!1,array:!1}}},LiteralValue:{type:"union",name:"LiteralValue",options:{string_literal:"StringLiteral",number_literal:"NumberLiteral",date_literal:"DateLiteral",timestamp_literal:"TimestampLiteral",boolean_literal:"BooleanLiteral",null_literal:"NullLiteral",filter_expression_literal:"FilterExpressionLiteral"}},LiteralValueExpression:{type:"struct",name:"LiteralValueExpression",fields:{literal_value:{type:"LiteralValue",optional:!1,array:!1}}},Location:{type:"struct",name:"Location",fields:{url:{type:"string",optional:!1,array:!1},range:{type:"Range",optional:!1,array:!1}}},LogMessage:{type:"struct",name:"LogMessage",fields:{url:{type:"string",optional:!1,array:!1},range:{type:"DocumentRange",optional:!1,array:!1},severity:{type:"LogSeverity",optional:!1,array:!1},message:{type:"string",optional:!1,array:!1}}},LogSeverity:{type:"enum",name:"LogSeverity",values:{debug:1,info:2,warn:3,error:4}},MeasureInfo:{type:"struct",name:"MeasureInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"AtomicType",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},ModelEntryValue:{type:"union",name:"ModelEntryValue",options:{source:"SourceInfo",query:"QueryInfo"}},ModelInfo:{type:"struct",name:"ModelInfo",fields:{entries:{type:"ModelEntryValue",array:!0,optional:!1},annotations:{type:"Annotation",array:!0,optional:!0},anonymous_queries:{type:"AnonymousQueryInfo",array:!0,optional:!1}}},MovingAverage:{type:"struct",name:"MovingAverage",fields:{field_reference:{type:"Reference",optional:!1,array:!1},rows_preceding:{type:"number",optional:!0,array:!1},rows_following:{type:"number",optional:!0,array:!1},partition_fields:{type:"Reference",array:!0,optional:!0}}},Nest:{type:"struct",name:"Nest",fields:{name:{type:"string",optional:!0,array:!1},view:{type:"View",optional:!1,array:!1}}},NullCell:{type:"struct",name:"NullCell",fields:{}},NullLiteral:{type:"struct",name:"NullLiteral",fields:{}},NumberCell:{type:"struct",name:"NumberCell",fields:{number_value:{type:"number",optional:!1,array:!1},subtype:{type:"NumberSubtype",optional:!0,array:!1},string_value:{type:"string",optional:!0,array:!1}}},NumberLiteral:{type:"struct",name:"NumberLiteral",fields:{number_value:{type:"number",optional:!1,array:!1},string_value:{type:"string",optional:!0,array:!1}}},NumberSubtype:{type:"enum",name:"NumberSubtype",values:{integer:1,decimal:2,bigint:3}},NumberType:{type:"struct",name:"NumberType",fields:{subtype:{type:"NumberSubtype",optional:!0,array:!1}}},OrderBy:{type:"struct",name:"OrderBy",fields:{field_reference:{type:"Reference",optional:!1,array:!1},direction:{type:"OrderByDirection",optional:!0,array:!1}}},OrderByDirection:{type:"enum",name:"OrderByDirection",values:{asc:1,desc:2}},ParameterInfo:{type:"struct",name:"ParameterInfo",fields:{name:{type:"string",optional:!1,array:!1},type:{type:"ParameterType",optional:!1,array:!1},default_value:{type:"LiteralValue",optional:!0,array:!1}}},ParameterType:{type:"union",name:"ParameterType",options:{string_type:"StringType",boolean_type:"BooleanType",number_type:"NumberType",json_type:"JSONType",sql_native_type:"SQLNativeType",date_type:"DateType",timestamp_type:"TimestampType",array_type:"ArrayType",record_type:"RecordType",filter_expression_type:"FilterExpressionType",timestamptz_type:"TimestamptzType"}},ParameterValue:{type:"struct",name:"ParameterValue",fields:{name:{type:"string",optional:!1,array:!1},value:{type:"LiteralValue",optional:!1,array:!1}}},Position:{type:"struct",name:"Position",fields:{line:{type:"number",optional:!1,array:!1},character:{type:"number",optional:!1,array:!1}}},Query:{type:"struct",name:"Query",fields:{definition:{type:"QueryDefinition",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},QueryArrow:{type:"struct",name:"QueryArrow",fields:{source:{type:"QueryArrowSource",optional:!1,array:!1},view:{type:"ViewDefinition",optional:!1,array:!1}}},QueryArrowSource:{type:"union",name:"QueryArrowSource",options:{refinement:"QueryRefinement",source_reference:"Reference"}},QueryDefinition:{type:"union",name:"QueryDefinition",options:{arrow:"QueryArrow",query_reference:"Reference",refinement:"QueryRefinement"}},QueryInfo:{type:"struct",name:"QueryInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},definition:{type:"Query",optional:!0,array:!1},code:{type:"string",optional:!0,array:!1},location:{type:"Location",optional:!0,array:!1}}},QueryRefinement:{type:"struct",name:"QueryRefinement",fields:{base:{type:"QueryDefinition",optional:!1,array:!1},refinement:{type:"ViewDefinition",optional:!1,array:!1}}},Range:{type:"struct",name:"Range",fields:{start:{type:"Position",optional:!1,array:!1},end:{type:"Position",optional:!1,array:!1}}},RecordCell:{type:"struct",name:"RecordCell",fields:{record_value:{type:"Cell",array:!0,optional:!1}}},RecordType:{type:"struct",name:"RecordType",fields:{fields:{type:"DimensionInfo",array:!0,optional:!1}}},Reference:{type:"struct",name:"Reference",fields:{name:{type:"string",optional:!1,array:!1},path:{type:"string",array:!0,optional:!0},parameters:{type:"ParameterValue",array:!0,optional:!0}}},Relationship:{type:"enum",name:"Relationship",values:{one:1,many:2,cross:3}},Result:{type:"struct",name:"Result",fields:{data:{type:"Data",optional:!0,array:!1},schema:{type:"Schema",optional:!1,array:!1},sql:{type:"string",optional:!0,array:!1},connection_name:{type:"string",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},model_annotations:{type:"Annotation",array:!0,optional:!0},query_timezone:{type:"string",optional:!0,array:!1},source_annotations:{type:"Annotation",array:!0,optional:!0}}},RunIndexQueryRequest:{type:"struct",name:"RunIndexQueryRequest",fields:{model_url:{type:"string",optional:!1,array:!1},source_name:{type:"string",optional:!1,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},RunIndexQueryResponse:{type:"struct",name:"RunIndexQueryResponse",fields:{result:{type:"Result",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},RunQueryRequest:{type:"struct",name:"RunQueryRequest",fields:{model_url:{type:"string",optional:!1,array:!1},query:{type:"Query",optional:!0,array:!1},query_malloy:{type:"string",optional:!0,array:!1},default_row_limit:{type:"number",optional:!0,array:!1},exclude_references:{type:"boolean",optional:!0,array:!1},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1}}},RunQueryResponse:{type:"struct",name:"RunQueryResponse",fields:{result:{type:"Result",optional:!0,array:!1},default_row_limit_added:{type:"number",optional:!0,array:!1},logs:{type:"LogMessage",array:!0,optional:!0},compiler_needs:{type:"CompilerNeeds",optional:!0,array:!1},timing_info:{type:"TimingInfo",optional:!0,array:!1}}},SQLNativeCell:{type:"struct",name:"SQLNativeCell",fields:{sql_native_value:{type:"string",optional:!1,array:!1}}},SQLNativeType:{type:"struct",name:"SQLNativeType",fields:{sql_type:{type:"string",optional:!0,array:!1}}},SQLQuery:{type:"struct",name:"SQLQuery",fields:{sql:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!0,array:!1},connection_name:{type:"string",optional:!1,array:!1}}},SQLTable:{type:"struct",name:"SQLTable",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!0,array:!1},connection_name:{type:"string",optional:!1,array:!1}}},Schema:{type:"struct",name:"Schema",fields:{fields:{type:"FieldInfo",array:!0,optional:!1}}},SourceInfo:{type:"struct",name:"SourceInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},parameters:{type:"ParameterInfo",array:!0,optional:!0}}},StringCell:{type:"struct",name:"StringCell",fields:{string_value:{type:"string",optional:!1,array:!1}}},StringLiteral:{type:"struct",name:"StringLiteral",fields:{string_value:{type:"string",optional:!1,array:!1}}},StringType:{type:"struct",name:"StringType",fields:{}},TimeTruncationFieldReference:{type:"struct",name:"TimeTruncationFieldReference",fields:{field_reference:{type:"Reference",optional:!1,array:!1},truncation:{type:"TimestampTimeframe",optional:!1,array:!1}}},TimestampCell:{type:"struct",name:"TimestampCell",fields:{timestamp_value:{type:"string",optional:!1,array:!1}}},TimestampLiteral:{type:"struct",name:"TimestampLiteral",fields:{timestamp_value:{type:"string",optional:!1,array:!1},granularity:{type:"TimestampTimeframe",optional:!0,array:!1},timezone:{type:"string",optional:!0,array:!1}}},TimestampTimeframe:{type:"enum",name:"TimestampTimeframe",values:{year:1,quarter:2,month:3,week:4,day:5,hour:6,minute:7,second:8}},TimestampType:{type:"struct",name:"TimestampType",fields:{timeframe:{type:"TimestampTimeframe",optional:!0,array:!1}}},TimestamptzType:{type:"struct",name:"TimestamptzType",fields:{timeframe:{type:"TimestampTimeframe",optional:!0,array:!1}}},TimingInfo:{type:"struct",name:"TimingInfo",fields:{name:{type:"string",optional:!1,array:!1},duration_ms:{type:"number",optional:!1,array:!1},detailed_timing:{type:"TimingInfo",array:!0,optional:!0}}},Translation:{type:"struct",name:"Translation",fields:{url:{type:"string",optional:!1,array:!1},compiled_model_json:{type:"string",optional:!0,array:!1}}},View:{type:"struct",name:"View",fields:{definition:{type:"ViewDefinition",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0}}},ViewArrow:{type:"struct",name:"ViewArrow",fields:{source:{type:"ViewDefinition",optional:!1,array:!1},view:{type:"ViewDefinition",optional:!1,array:!1}}},ViewDefinition:{type:"union",name:"ViewDefinition",options:{arrow:"ViewArrow",view_reference:"Reference",refinement:"ViewRefinement",segment:"ViewSegment"}},ViewInfo:{type:"struct",name:"ViewInfo",fields:{name:{type:"string",optional:!1,array:!1},schema:{type:"Schema",optional:!1,array:!1},annotations:{type:"Annotation",array:!0,optional:!0},definition:{type:"View",optional:!0,array:!1}}},ViewOperation:{type:"union",name:"ViewOperation",options:{group_by:"GroupBy",aggregate:"Aggregate",order_by:"OrderBy",limit:"Limit",where:"FilterOperation",nest:"Nest",having:"FilterOperation",drill:"DrillOperation",calculate:"CalculateOperation"}},ViewRefinement:{type:"struct",name:"ViewRefinement",fields:{base:{type:"ViewDefinition",optional:!1,array:!1},refinement:{type:"ViewDefinition",optional:!1,array:!1}}},ViewSegment:{type:"struct",name:"ViewSegment",fields:{operations:{type:"ViewOperation",array:!0,optional:!1}}}}),PA}var $A={},jR={},BA={},wle;function nIe(){return wle||(wle=1,Object.defineProperty(BA,"__esModule",{value:!0}),BA.RESERVED_WORDS=void 0,BA.RESERVED_WORDS=["all","and","as","asc","avg","boolean","by","case","cast","compose","count","date","day","days","desc","distinct","else","end","exclude","export","extend","false","filter","for","from","full","has","hour","hours","import","in","include","inner","internal","is","json","left","like","max","min","minute","minutes","month","months","not","now","null","number","on","or","pick","private","public","quarter","quarters","right","second","seconds","source","sql","string","sum","table","then","this","timestamp","timestamptz","to","true","virtual","week","weeks","when","with","year","years"]),BA}var Dle;function rIe(){if(Dle)return jR;Dle=1,Object.defineProperty(jR,"__esModule",{value:!0}),jR.maybeQuoteIdentifier=n;const e=nIe();function t(r){const i=!r.match(/^[A-Za-z_][A-Za-z_0-9]*$/),s=e.RESERVED_WORDS.includes(r.toLowerCase());return i||s}function n(r){return t(r)?`\`${r}\``:r}return jR}var Ole;function iIe(){if(Ole)return $A;Ole=1,Object.defineProperty($A,"__esModule",{value:!0}),$A.queryToMalloy=t,$A.filterToMalloy=n;const e=rIe();function t(L,{tabWidth:N}={tabWidth:2}){const k=m(L);return a(k,{tabWidth:N})}function n(L,{tabWidth:N}={tabWidth:2}){const k=H(L);return a(k,{tabWidth:N})}const r=Symbol("indent"),i=Symbol("newline"),s=Symbol("outdent"),o=Symbol("optional_newline_indent");function a(L,{tabWidth:N}={tabWidth:2}){let k="",U=0,Y=!0;for(const G of L)if(G===i)k+=`
|
|
1363
1363
|
`,Y=!0;else if(G===s)U--;else if(G===r)U++;else{if(G===o)continue;Y&&(k+=" ".repeat(U*N),Y=!1),k+=G}return k}function u(L,N,k,U){var Y;if(N.includes(i))return[L,i,r,...N,i,s,k];const J=((Y=U==null?void 0:U.spaces)!==null&&Y!==void 0?Y:!0)?" ":"";return[L,J,...N,J,k]}function c(L){return{contents:L,quoteCharacter:'"'}}function l(L,N){const k=[];for(let U=0;U<L.length;U++){const Y=L[U];k.push(Y),U<L.length-1&&k.push(N)}return k}function f(L){var N,k;switch(L.kind){case"filter_expression_literal":return[de(L.filter_expression_value)];case"boolean_literal":return[L.boolean_value.toString()];case"string_literal":{const{contents:U,quoteCharacter:Y}=c(L.string_value);return[Y,U,Y]}case"number_literal":return[L.number_value.toString()];case"null_literal":return["null"];case"date_literal":return[p(d(L.date_value),(N=L.granularity)!==null&&N!==void 0?N:"day",L.timezone)];case"timestamp_literal":return[p(d(L.timestamp_value),(k=L.granularity)!==null&&k!==void 0?k:"second",L.timezone)]}}function d(L){let N;if(N=/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/.exec(L)){const[k,U,Y,G,J,ee,le]=N;return[U,Y,G,J,ee,le]}else if(N=/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d)/.exec(L)){const[k,U,Y,G,J,ee]=N;return[U,Y,G,J,ee,"00"]}else if(N=/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d)(?:00)?/.exec(L)){const[k,U,Y,G,J]=N;return[U,Y,G,J,"00","00"]}else if(N=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(L)){const[k,U,Y,G]=N;return[U,Y,G,"00","00","00"]}else if(N=/(\d\d\d\d)-(\d\d)/.exec(L)){const[k,U,Y]=N;return[U,Y,"01","00","00","00"]}else if(N=/(\d\d\d\d)/.exec(L)){const[k,U]=N;return[U,"01","01","00","00","00"]}return["1970","01","01","00","00","00"]}function p([L,N,k,U,Y,G],J,ee){switch(J){case"year":return`@${L}`;case"quarter":{const le=Math.floor(+N/3)+1;return`@${L}-Q${le}`}case"month":return`@${L}-${N}`;case"week":return`@${L}-${N}-${k}-WK`;case"day":return`@${L}-${N}-${k}`;case"hour":return`@${L}-${N}-${k} ${U}`;case"minute":return`@${L}-${N}-${k} ${U}:${Y}`;case"second":return ee!==void 0?`@${L}-${N}-${k} ${U}:${Y}:${G}[${ee}]`:`@${L}-${N}-${k} ${U}:${Y}:${G}`;default:throw new Error("Unknown timeframe.")}}function x(L){var N;const k=[];for(const U of(N=L.path)!==null&&N!==void 0?N:[])k.push((0,e.maybeQuoteIdentifier)(U)),k.push(".");if(k.push((0,e.maybeQuoteIdentifier)(L.name)),L.parameters){const U=[];for(let Y=0;Y<L.parameters.length;Y++){const G=L.parameters[Y];U.push((0,e.maybeQuoteIdentifier)(G.name)),U.push(" is "),U.push(...f(G.value)),Y<L.parameters.length-1&&U.push(",",i)}k.push(...u("(",U,")",{spaces:!1}))}return k}function m(L){const N=[];return N.push(...P(L.annotations)),N.push("run: "),N.push(...y(L.definition)),N}function g(L){const N=[];switch(L.kind){case"source_reference":{N.push(...x(L));break}case"refinement":N.push(...y(L));break}return N}function y(L){const N=[];switch(L.kind){case"arrow":{N.push(...g(L.source)),N.push(" -> "),N.push(...E(L.view));break}case"query_reference":{N.push(...x(L));break}case"refinement":{const k=y(L.base);L.base.kind==="arrow"?N.push(...u("(",k,")",{spaces:!1})):N.push(...k),N.push(" + "),N.push(...E(L.refinement));break}}return N}function E(L){const N=[];switch(L.kind){case"arrow":{N.push(...E(L.source)),N.push(" -> "),N.push(...E(L.view));break}case"view_reference":{N.push(...x(L));break}case"refinement":{N.push(...E(L.base)),N.push(" + "),N.push(...E(L.refinement));break}case"segment":{N.push(...v(L));break}}return N}function v(L){if(L.operations.length===0)return["{ }"];const N=L.operations.length>1,k=[];for(let U=0;U<L.operations.length;U++){const Y=L.operations[U],G=[Y];for(;U<L.operations.length-1;){const J=L.operations[U+1];if(J.kind===Y.kind)G.push(J),U++;else break}k.push(..._(G)),N&&U<L.operations.length-1&&k.push(i)}return u("{",k,"}")}function _(L){switch(L[0].kind){case"aggregate":return R(L,"aggregate");case"group_by":return R(L,"group_by");case"order_by":return O(L);case"nest":return I(L);case"limit":return oe(L);case"where":return fe(L);case"having":return ne(L);case"drill":return V(L);case"calculate":return R(L,"calculate")}}function A(L,N,k=""){const U=[];U.push(`${L}:`);const Y=N.length>1||N.some(G=>G.includes(i));Y?U.push(i,r):U.push(" ");for(let G=0;G<N.length;G++){const J=N[G];U.push(...J),N.length>1&&G<N.length-1&&U.push(k),Y&&G<N.length-1&&U.push(i)}return Y&&U.push(s),U}function C(L){const N=[];return N.push(...T(L.expression)),N}function S(L){return L}function T(L){var N;switch(L.kind){case"field_reference":return x(L);case"time_truncation":return[...x(L.field_reference),".",L.truncation];case"filtered_field":return[...x(L.field_reference),...u(" {",fe(L.where),"}")];case"literal_value":return f(L.literal_value);case"moving_average":{const k=["avg_moving",...u("(",[...x(L.field_reference),L.rows_preceding!==void 0?`, ${L.rows_preceding}`:", 0",L.rows_following!==void 0?`, ${L.rows_following}`:""],")",{spaces:!1})];return!((N=L.partition_fields)===null||N===void 0)&&N.length&&k.push(...u(" {",["partition_by",": ",...l(L.partition_fields.flatMap(U=>x(U)),", ")],"}")),k}}}function D(L,N=!1){const k=[];return N||k.push(...P(L.field.annotations)),L.name&&(k.push((0,e.maybeQuoteIdentifier)(L.name)),k.push(" is ")),k.push(...C(L.field)),k}function R(L,N){const k=[],U=L.length===1;return U&&k.push(...P(L[0].field.annotations)),k.push(...A(N,L.map(Y=>D(Y,U)))),k}function O(L){return A("order_by",L.map(F),",")}function F(L){const N=[];return N.push(...x(L.field_reference)),L.direction&&(N.push(" "),N.push(L.direction)),N}function I(L){const N=[],k=L.length===1;return k&&N.push(...P(L[0].view.annotations)),N.push(...A("nest",L.map(U=>B(U,k)))),N}function B(L,N=!1){const k=[];return N||k.push(...P(L.view.annotations)),L.name&&(k.push((0,e.maybeQuoteIdentifier)(L.name)),k.push(" is ")),k.push(...z(L.view)),k}function z(L){return E(L.definition)}function Z(L){return[`limit: ${L.limit}`]}function oe(L){const N=[];for(let k=0;k<L.length;k++)k!==0&&N.push(i),N.push(...Z(L[k]));return N}function fe(L){return A("where",L.map(W),",")}function V(L){return A("drill",L.map(W),",")}function ne(L){return A("having",L.map(W),",")}const ae=["`","'",'"'];function de(L){let N,k;for(const U of ae){const Y=$(L,U);if(Y===L)return`f${U}${L}${U}`;(k===void 0||Y.length<k.length)&&(N=U,k=Y)}return`f${N}${k}${N}`}function $(L,N){let k="";for(let U=0;U<L.length;U++)L.slice(U).startsWith(N)?(k+="\\"+N,U+=N.length):(k+=L[U],L[U]==="\\"&&(k+=L[++U]));return k}function H(L){switch(L.kind){case"filter_string":return[...T(L.expression)," ~ ",de(L.filter)];case"literal_equality":return[...T(L.expression)," = ",...f(L.value)]}}function W(L){return H(L.filter)}function P(L){return L?L.flatMap(j):[]}function j(L){return[L.value.trim(),i]}return $A}var B1={},Fle;function sIe(){if(Fle)return B1;Fle=1,Object.defineProperty(B1,"__esModule",{value:!0}),B1.nestUnions=t,B1.unnestUnions=n,B1.convertFromThrift=r,B1.convertToThrift=s;const e=Rle();function t(o){if(o==null)return o;if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o;if(Array.isArray(o))return o.map(t);{const a={};let u;for(const c in o)c==="kind"?u=o[c]:a[c]=t(o[c]);return u===void 0?a:{[u]:a}}}function n(o,a){if(o==null)return o;if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return o;if(Array.isArray(o))return o.map(u=>n(u,a));{const u=i(a);if(u.type==="union"){for(const c in u.options)if(o[c]!==void 0){const l=n(o[c],u.options[c]);if(typeof l=="object")return{kind:c,...l}}}else if(u.type==="struct"){const c={};for(const l in o){const f=u.fields[l];if(f===void 0)throw new Error(`Unknown field ${l} in ${a}`);c[l]=n(o[l],f.type)}return c}else throw new Error(`Cannot unnest unions in an enum type ${a}`)}}function r(o,a){if(o==null)return o;if(typeof o=="string"||typeof o=="boolean")return o;if(typeof o=="number"){if(a==="number")return o;const u=i(a);if(u.type!=="enum")throw new Error(`Found a number where a ${a} was expected`);const c=Object.entries(u.values).find(([,l])=>l===o);if(c===void 0)throw new Error(`${o} is not a valid enum value for ${a}`);return c[0]}else{if(Array.isArray(o))return o.map(u=>r(u,a));{const u=i(a);if(u.type==="union"){for(const c in u.options)if(o[c]!==void 0&&o[c]!==null){const l=r(o[c],u.options[c]);if(typeof l=="object")return{kind:c,...l}}}else if(u.type==="struct"){const c={};for(const l in o){const f=u.fields[l];if(f===void 0)throw new Error(`Unknown field ${l} in ${a}`);c[l]=r(o[l],f.type)}return c}else throw new Error(`Cannot unnest unions in an enum type ${a}`)}}}function i(o){const a=e.MALLOY_INTERFACE_TYPES[o];if(a===void 0)throw new Error(`Unknown Malloy interface type ${o}`);return a}function s(o,a){if(o==null)return o;if(typeof o=="number"||typeof o=="boolean")return o;if(typeof o=="string"){if(a==="string")return o;const u=i(a);if(u.type==="enum"){const c=u.values[o];if(c===void 0)throw new Error(`${o} is not a valid enum value for ${a}`);return c}}else{if(Array.isArray(o))return o.map(u=>s(u,a));{const u=i(a);if(u.type==="union"){const c=o.kind,l=u.options[c];if(l===void 0)throw new Error(`${c} is not a valid union of ${a}`);const f=i(l);if(f.type!=="struct")throw new Error("Union fields must be structs");const d={};for(const p in o){if(p==="kind")continue;const x=f.fields[p];d[p]=s(o[p],x.type)}return{[c]:d}}else if(u.type==="struct"){const c={};for(const l in o){const f=u.fields[l];if(f===void 0)throw new Error(`Unknown field ${l} in ${a}`);c[l]=s(o[l],f.type)}return c}}}}return B1}var Nle;function zR(){return Nle||(Nle=1,function(e){var t=$1&&$1.__createBinding||(Object.create?function(s,o,a,u){u===void 0&&(u=a);var c=Object.getOwnPropertyDescriptor(o,a);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(s,u,c)}:function(s,o,a,u){u===void 0&&(u=a),s[u]=o[a]}),n=$1&&$1.__exportStar||function(s,o){for(var a in s)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,s,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.thingy4sddfdfsd=e.thingy4sdfsd=e.thingy4dfdsfs=e.thingy4asdfas=e.thingy4asdfasdf=e.thingy3dfdf=e.thingy3=e.thingy2asdf=e.thingyssdfg=e.thingy123r=e.thingy1=e.res=e.test=e.convertToThrift=e.convertFromThrift=e.unnestUnions=e.nestUnions=e.filterToMalloy=e.queryToMalloy=void 0,n(Rle(),e);var r=iIe();Object.defineProperty(e,"queryToMalloy",{enumerable:!0,get:function(){return r.queryToMalloy}}),Object.defineProperty(e,"filterToMalloy",{enumerable:!0,get:function(){return r.filterToMalloy}});var i=sIe();Object.defineProperty(e,"nestUnions",{enumerable:!0,get:function(){return i.nestUnions}}),Object.defineProperty(e,"unnestUnions",{enumerable:!0,get:function(){return i.unnestUnions}}),Object.defineProperty(e,"convertFromThrift",{enumerable:!0,get:function(){return i.convertFromThrift}}),Object.defineProperty(e,"convertToThrift",{enumerable:!0,get:function(){return i.convertToThrift}}),e.test={entries:[{kind:"source",name:"flights",schema:{fields:[{kind:"dimension",name:"carrier",type:{kind:"boolean_type"},annotations:[{value:"# foo=1"}]},{kind:"dimension",name:"arr",type:{kind:"array_type",element_type:{kind:"boolean_type"}}},{kind:"dimension",name:"arr_rec",type:{kind:"array_type",element_type:{kind:"record_type",fields:[{name:"arr",type:{kind:"array_type",element_type:{kind:"boolean_type"}}}]}}},{kind:"dimension",name:"rec",type:{kind:"record_type",fields:[{name:"arr",type:{kind:"array_type",element_type:{kind:"boolean_type"}}}]}},{kind:"join",name:"carriers",relationship:"one",schema:{fields:[{kind:"dimension",name:"code",type:{kind:"string_type"}}]}},{kind:"view",name:"by_carrier",schema:{fields:[{kind:"dimension",name:"carrier",type:{kind:"string_type"}},{kind:"dimension",name:"flight_count",type:{kind:"number_type"}}]}}]},parameters:[{name:"param",type:{kind:"number_type"},default_value:{kind:"number_literal",number_value:7}}]}],anonymous_queries:[]},e.res={connection_name:"foo",data:{kind:"array_cell",array_value:[{kind:"record_cell",record_value:[{kind:"string_cell",string_value:"UA"},{kind:"number_cell",number_value:12341234}]},{kind:"record_cell",record_value:[{kind:"string_cell",string_value:"AA"},{kind:"number_cell",number_value:2343}]}]},schema:{fields:[{kind:"dimension",name:"carrier",type:{kind:"string_type"}},{kind:"dimension",name:"flight_count",type:{kind:"number_type"}}]},sql:"SELECT * ..."},e.thingy1={definition:{kind:"query_reference",name:"flights_by_carrier"}},e.thingy123r={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"view_reference",name:"by_carrier"}}},e.thingyssdfg={definition:{kind:"refinement",base:{kind:"query_reference",name:"flights"},refinement:{kind:"view_reference",name:"by_carrier"}}},e.thingy2asdf={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"refinement",base:{kind:"view_reference",name:"by_carrier"},refinement:{kind:"segment",operations:[{kind:"where",filter:{kind:"filter_string",expression:{kind:"field_reference",name:"carrier"},filter:"WN"}}]}}}},e.thingy3={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"refinement",base:{kind:"view_reference",name:"by_carrier"},refinement:{kind:"segment",operations:[{kind:"group_by",field:{expression:{kind:"field_reference",name:"carrier"}}},{kind:"group_by",field:{expression:{kind:"field_reference",name:"foo"}}}]}}}},e.thingy3dfdf={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"refinement",base:{kind:"view_reference",name:"by_carrier"},refinement:{kind:"view_reference",name:"top10"}}}},e.thingy4asdfasdf={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"segment",operations:[{kind:"group_by",field:{expression:{kind:"field_reference",name:"carrier"}}},{kind:"group_by",field:{expression:{kind:"field_reference",name:"foo"}}}]}}},e.thingy4asdfas={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"view_reference",name:"by_carrier"}}},e.thingy4dfdsfs={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"refinement",base:{kind:"view_reference",name:"by_carrier"},refinement:{kind:"segment",operations:[{kind:"limit",limit:10}]}}}},e.thingy4sdfsd={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"segment",operations:[{kind:"group_by",field:{expression:{kind:"field_reference",name:"carrier"}}},{kind:"limit",limit:10}]}}},e.thingy4sddfdfsd={definition:{kind:"arrow",source:{kind:"source_reference",name:"flights"},view:{kind:"segment",operations:[]}}}}($1)),$1}var Lle;function HR(){if(Lle)return so;Lle=1;var e=so&&so.__createBinding||(Object.create?function(R,O,F,I){I===void 0&&(I=F);var B=Object.getOwnPropertyDescriptor(O,F);(!B||("get"in B?!O.__esModule:B.writable||B.configurable))&&(B={enumerable:!0,get:function(){return O[F]}}),Object.defineProperty(R,I,B)}:function(R,O,F,I){I===void 0&&(I=F),R[I]=O[F]}),t=so&&so.__setModuleDefault||(Object.create?function(R,O){Object.defineProperty(R,"default",{enumerable:!0,value:O})}:function(R,O){R.default=O}),n=so&&so.__importStar||function(){var R=function(O){return R=Object.getOwnPropertyNames||function(F){var I=[];for(var B in F)Object.prototype.hasOwnProperty.call(F,B)&&(I[I.length]=B);return I},R(O)};return function(O){if(O&&O.__esModule)return O;var F={};if(O!=null)for(var I=R(O),B=0;B<I.length;B++)I[B]!=="default"&&e(F,O,I[B]);return t(F,O),F}}();Object.defineProperty(so,"__esModule",{value:!0}),so.sourceDefToSourceInfo=a,so.modelDefToModelInfo=u,so.toStableAnnotations=l,so.convertFieldInfos=f,so.writeLiteralToTag=m,so.getResultStructMetadataAnnotation=E;const r=n(zR()),i=vi(),s=gm(),o=Bc();function a(R){const O=R.parameters&&Object.entries(R.parameters).length>0?Object.entries(R.parameters).map(([I,B])=>(0,i.isAtomic)(B)?{name:I,type:v(B),default_value:c(B.value)}:{name:I,type:{kind:"filter_expression_type",filter_type:{kind:`${B.filterType}_type`}},default_value:c(B.value)}):void 0;return{name:(0,i.activeName)(R),schema:{fields:f(R,R.fields)},parameters:O,annotations:l(R.annotations)}}function u(R){const O={entries:[],anonymous_queries:[]};for(const[F,I]of Object.entries(R.contents))if(R.exports.includes(F)){if((0,i.isSourceDef)(I)){const B=a(I);O.entries.push({kind:"source",...B})}else if(I.type==="query"){const B=(0,i.getResultStructDefForQuery)(R,I),z=l(I.annotations),Z=B.resultMetadata?E(B,B.resultMetadata):void 0,oe=[...z??[],...Z?[Z]:[]],fe={kind:"source",name:F,schema:{fields:f(B,B.fields)},annotations:oe.length>0?oe:void 0};O.entries.push(fe)}}for(const F of R.queryList){const I=(0,i.getResultStructDefForQuery)(R,F),B=l(F.annotations),z=I.resultMetadata?E(I,I.resultMetadata):void 0,Z=[...B??[],...z?[z]:[]],oe={schema:{fields:f(I,I.fields)},annotations:Z.length>0?Z:void 0};O.anonymous_queries.push(oe)}return O}function c(R){if(R!==null)switch(R.node){case"numberLiteral":return{kind:"number_literal",number_value:parseFloat(R.literal)};case"stringLiteral":return{kind:"string_literal",string_value:R.literal};case"filterLiteral":return{kind:"filter_expression_literal",filter_expression_value:R.filterSrc};case"dateLiteral":return{kind:"date_literal",date_value:R.literal};case"timestampLiteral":case"timestamptzLiteral":return{kind:"timestamp_literal",timestamp_value:R.literal,timezone:R.timezone};case"true":return{kind:"boolean_literal",boolean_value:!0};case"false":return{kind:"boolean_literal",boolean_value:!1};case"null":return{kind:"null_literal"};default:throw new Error("Invalid parameter default value")}}function l(R){return new s.Annotations(R).texts().map(O=>({value:O}))}function f(R,O){const F=[];for(const I of O){if(!(I.accessModifier===void 0))continue;const z=l(I.annotations),Z=z.length>0?z:void 0;if((0,i.isTurtle)(I)){const oe=(0,i.getResultStructDefForView)(R,I),fe=oe.resultMetadata?E(oe,oe.resultMetadata):void 0,V=[...Z??[],...fe?[fe]:[]],ne={kind:"view",name:(0,i.activeName)(I),annotations:V.length>0?V:void 0,schema:{fields:f(oe,oe.fields)}};F.push(ne)}else if((0,i.isAtomic)(I)){const oe=(0,i.expressionIsAggregate)(I.expressionType),fe=(0,i.expressionIsScalar)(I.expressionType);if(!oe&&!fe||I.type==="error")continue;const V=I.resultMetadata?d(I,I.resultMetadata):void 0;let ne;if((0,i.isRecordOrRepeatedRecord)(I)&&I.queryTimezone){const $=o.Tag.withPrefix("#(malloy) ");$.set(["query_timezone"],I.queryTimezone),ne={value:$.toString()}}const ae=[...Z??[],...V?[V]:[],...ne?[ne]:[]],de={kind:oe?"measure":"dimension",name:(0,i.activeName)(I),type:v(I),annotations:ae.length>0?ae:void 0};F.push(de)}else if((0,i.isJoinedSource)(I)){const oe={kind:"join",name:(0,i.activeName)(I),annotations:Z,schema:{fields:f(I,I.fields)},relationship:I.join};F.push(oe)}}return F}function d(R,O){const F=o.Tag.withPrefix("#(malloy) ");let I=!1;if(O.referenceId!==void 0&&(F.set(["reference_id"],O.referenceId),I=!0),O.fieldKind==="measure"&&(F.set(["calculation"]),I=!0),O.drillable&&(F.set(["drillable"]),I=!0),O.filterList&&(p(F,O.filterList),I=!0),O.drillExpression&&(x(F,["drill_expression"],O.drillExpression),I=!0),O.fieldKind==="dimension"){const z=(O==null?void 0:O.sourceExpression)||(O!=null&&O.sourceField.includes(".")?O==null?void 0:O.sourceField:y(R.name));F.set(["drill_expression","code"],z),I=!0}return I?{value:F.toString()}:void 0}function p(R,O){for(let F=0;F<O.length;F++){const I=O[F];I.expressionType!=="scalar"||I.isSourceFilter||(R.set(["drill_filters",F,"code"],I.code),I.filterView&&R.set(["drill_filters",F,"filter_view"],I.filterView),I.filterView===void 0&&I.stableFilter!==void 0&&(x(R,["drill_filters",F,"expression"],I.stableFilter.expression),I.stableFilter.kind==="filter_string"?(R.set(["drill_filters",F,"kind"],"filter_expression"),R.set(["drill_filters",F,"filter_expression"],I.stableFilter.filter)):(R.set(["drill_filters",F,"kind"],"literal_equality"),m(R,["drill_filters",F,"value"],I.stableFilter.value))))}}function x(R,O,F){D(R,O,F,"Expression")}function m(R,O,F){D(R,O,F,"LiteralValue")}function g(R){return R.replace(/\\/g,"\\\\").replace(/`/g,"\\`")}function y(R){return R.match(/^[A-Za-z_][0-9A-Za-z_]*$/)?R:`\`${g(R)}\``}function E(R,O){var F;const I=o.Tag.withPrefix("#(malloy) ");let B=!1;if(O.limit!==void 0&&(I.set(["limit"],O.limit),B=!0),O.filterList&&(p(I,O.filterList),B=!0),O.drillable&&(I.set(["drillable"]),B=!0),O.orderBy){for(let z=0;z<O.orderBy.length;z++){const Z=O.orderBy[z],oe=typeof Z.field=="number"?(0,i.activeName)(R.fields[Z.field-1]):Z.field,fe=(F=Z.dir)!==null&&F!==void 0?F:null;I.set(["ordered_by",z,oe],fe)}B=!0}return R.queryTimezone&&(I.set(["query_timezone"],R.queryTimezone),B=!0),B?{value:I.toString()}:void 0}function v(R){if((0,i.isBasicAtomic)(R))switch(R.type){case"string":return{kind:"string_type"};case"number":return{kind:"number_type",subtype:R.numberType==="float"?"decimal":R.numberType==="integer"?"integer":R.numberType==="bigint"?"bigint":void 0};case"boolean":return{kind:"boolean_type"};case"date":{const O=R.timeframe;return O&&!A(O)?{kind:"timestamp_type",timeframe:R.timeframe}:{kind:"date_type",timeframe:C(R.timeframe)}}case"timestamp":return{kind:"timestamp_type",timeframe:R.timeframe};case"timestamptz":return{kind:"timestamptz_type",timeframe:R.timeframe};case"json":return{kind:"json_type"};case"sql native":return{kind:"sql_native_type",sql_type:R.rawType};case"error":throw new Error("Error type is not supported in stable interface")}else{if((0,i.isRepeatedRecord)(R))return{kind:"array_type",element_type:_(R)};if(R.type==="record")return _(R);if(R.type==="array")return{kind:"array_type",element_type:v(R.elementTypeDef)}}throw new Error("Unexpected field type")}function _(R){return{kind:"record_type",fields:R.fields.map(O=>{const F=[];if("resultMetadata"in O&&O.resultMetadata){const I=d(O,O.resultMetadata);I&&F.push(I)}if(O.annotations&&F.push(...l(O.annotations)),(0,i.isAtomic)(O))return{name:O.name,annotations:F.length>0?F:void 0,type:v(O)};throw new Error("Expected record type to not have a table as its child")})}}function A(R){switch(R){case"day":case"week":case"month":case"year":case"quarter":return!0;default:return!1}}function C(R){switch(R){case void 0:return;case"day":case"week":case"month":case"year":case"quarter":return R;default:throw new Error(`Invalid date timeframe ${R}`)}}function S(R){return R}function T(R){return R}function D(R,O,F,I){if(I==="string"){R.set(O,F);return}else if(I==="number"){R.set(O,F);return}else if(I==="boolean"){R.set(O,F.toString());return}const B=r.MALLOY_INTERFACE_TYPES[I];if(B===void 0)throw new Error(`Unknown Malloy interface type ${I}`);if(B.type==="enum")if(typeof F=="string")R.set(O,F);else throw new Error(`Expected string for enum ${I}`);else if(B.type==="struct")for(const z in B.fields){const Z=B.fields[z],oe=F[z];if(oe===void 0){if(!Z.optional)throw new Error(`Mising value for non-optional field ${z} in type ${I}`)}else if(Z.array)if(Array.isArray(oe))for(let fe=0;fe<oe.length;fe++)D(R,[...O,z,fe],oe[fe],Z.type);else throw new Error(`Expected array for field ${z} of type ${I} but got ${typeof F}`);else D(R,[...O,z],oe,Z.type)}else{const z=F.kind;R.set([...O,"kind"],z);const Z=B.options[z];if(Z===void 0)throw new Error(`Unknown Malloy interface union kind ${z} for type ${I}`);D(R,O,F,Z)}}return so}var Ile;function qA(){return Ile||(Ile=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_LOG_RANGE=void 0,e.wrapLegacyInfoConnection=i,e.wrapLegacyConnection=s,e.mapData=o,e.wrapResult=a,e.nodeToLiteralValue=u,e.mapLogs=c;const t=uk(),n=HR(),r=Hv();function i(l){return{get dialectName(){return l.dialectName},async fetchSchemaForSQLQuery(f){const d=await l.fetchSchemaForSQLStruct({connection:l.name,selectStr:f},{}),p=d.structDef;if(p===void 0)throw new Error(d.error);return{fields:(0,n.convertFieldInfos)(p,p.fields)}},async fetchSchemaForTable(f){const d=(0,t.validateCanonicalTablePath)(l.dialectName,f);if(d!==void 0)throw new Error(d);const p=`${l.name}:${f}`,x=await l.fetchSchemaForTables({[p]:f},{}),m=x.schemas[p];if(m===void 0)throw new Error(x.errors[p]);return{fields:(0,n.convertFieldInfos)(m,m.fields)}}}}function s(l){return{...i(l),runSQL:async(f,d)=>{const p=await l.runSQL(f);return o(p.rows,d)}}}function o(l,f){function d(m,g){if(m===null)return{kind:"null_cell"};if(g.type.kind==="date_type"||g.type.kind==="timestamp_type"||g.type.kind==="timestamptz_type"){const y=(0,r.rowDataToDate)(m).toISOString();return g.type.kind==="date_type"?{kind:"date_cell",date_value:y}:{kind:"timestamp_cell",timestamp_value:y}}else if(g.type.kind==="boolean_type"){if(typeof m=="number"||typeof m=="bigint")return{kind:"boolean_cell",boolean_value:m!==0};if(typeof m=="string")return{kind:"boolean_cell",boolean_value:m!=="0"&&m!==""};if(typeof m!="boolean")throw new Error(`Invalid boolean ${m}`);return{kind:"boolean_cell",boolean_value:m}}else if(g.type.kind==="number_type"){const y=g.type.subtype,E=y==="bigint"?(0,r.rowDataToSerializedBigint)(m):void 0;return{kind:"number_cell",number_value:(0,r.rowDataToNumber)(m),subtype:y,string_value:E}}else if(g.type.kind==="string_type"){if(typeof m!="string")throw new Error(`Invalid string ${m}`);return{kind:"string_cell",string_value:m}}else if(g.type.kind==="array_type"){if(!Array.isArray(m))throw new Error(`Invalid array ${m}`);return{kind:"array_cell",array_value:m.map(y=>d(y,{name:"array_element",type:g.type.element_type}))}}else{if(g.type.kind==="json_type")return{kind:"json_cell",json_value:JSON.stringify(m)};if(g.type.kind==="sql_native_type")return{kind:"sql_native_cell",sql_native_value:JSON.stringify(m)};{const y=g.type;if(y.kind!=="record_type")throw new Error(`Invalid record in result ${JSON.stringify(g)}, ${JSON.stringify(m)}`);return p(m,{schema:{fields:y.fields.map(E=>({kind:"dimension",...E}))}})}}}function p(m,g){const y=[];for(const E of g.schema.fields){const v=m[E.name];if(E.kind!=="dimension")throw new Error("Invalid result -- expected all fields to be dimensions");const _=d(v,E);y.push(_)}return{kind:"record_cell",record_value:y}}const x={schema:f};return{kind:"array_cell",array_value:l.map(m=>p(m,x))}}function a(l){const f=l._queryResult.structs,d=f[f.length-1],p={fields:(0,n.convertFieldInfos)(d,d.fields)};return l.toStableResult(o(l.data.rawData,p))}function u(l){switch(l==null?void 0:l.node){case"numberLiteral":return{kind:"number_literal",number_value:Number.parseFloat(l.literal)};case"null":return{kind:"null_literal"};case"stringLiteral":return{kind:"string_literal",string_value:l.literal};case"filterLiteral":return{kind:"filter_expression_literal",filter_expression_value:l.filterSrc};case"true":return{kind:"boolean_literal",boolean_value:!0};case"false":return{kind:"boolean_literal",boolean_value:!1};case"dateLiteral":return{kind:"date_literal",date_value:l.literal,granularity:l.typeDef.timeframe};case"timestampLiteral":case"timestamptzLiteral":return{kind:"timestamp_literal",timestamp_value:l.literal,timezone:l.timezone,granularity:l.typeDef.timeframe};default:return}}e.DEFAULT_LOG_RANGE={start:{line:0,character:0},end:{line:0,character:0}};function c(l,f){return l.map(d=>{var p,x,m,g;return{severity:d.severity,message:d.message,range:(x=(p=d.at)===null||p===void 0?void 0:p.range)!==null&&x!==void 0?x:e.DEFAULT_LOG_RANGE,url:(g=(m=d.at)===null||m===void 0?void 0:m.url)!==null&&g!==void 0?g:f}})}}(ak)),ak}var Mle;function oIe(){if(Mle)return Ja;Mle=1;var e=Ja&&Ja.__createBinding||(Object.create?function(g,y,E,v){v===void 0&&(v=E);var _=Object.getOwnPropertyDescriptor(y,E);(!_||("get"in _?!y.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return y[E]}}),Object.defineProperty(g,v,_)}:function(g,y,E,v){v===void 0&&(v=E),g[v]=y[E]}),t=Ja&&Ja.__setModuleDefault||(Object.create?function(g,y){Object.defineProperty(g,"default",{enumerable:!0,value:y})}:function(g,y){g.default=y}),n=Ja&&Ja.__importStar||function(){var g=function(y){return g=Object.getOwnPropertyNames||function(E){var v=[];for(var _ in E)Object.prototype.hasOwnProperty.call(E,_)&&(v[v.length]=_);return v},g(y)};return function(y){if(y&&y.__esModule)return y;var E={};if(y!=null)for(var v=g(y),_=0;_<v.length;_++)v[_]!=="default"&&e(E,y,v[_]);return t(E,y),E}}();Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.MalloyToQuery=void 0,Ja.malloyToQuery=m;const r=kR(),i=ZM(),s=n(wR()),o=Kv(),a=bA(),u=mt(),c=Sle(),l=Xu(),f=qA(),d=MR(),p="Malloy query documents";class x extends i.AbstractParseTreeVisitor{constructor(y,E){super(),this.parseInfo=y,this.msgLog=E}internalError(y,E){return this.contextError(y,"internal-translator-error",{message:E}),new Error(`Internal Translator Error: ${E}`)}getLocation(y){return{url:this.parseInfo.sourceURL,range:(0,l.rangeFromContext)(this.parseInfo.sourceInfo,y)}}contextError(y,E,v,_){this.msgLog.log((0,o.makeLogMessage)(E,v,{at:this.getLocation(y),..._}))}getNumber(y){return Number.parseInt(y.text)}defaultResult(){return null}getAnnotations(y){const E=y.annotation().map(v=>({value:(0,a.getAnnotationText)(v)}));return E.length>0?E:void 0}getIsAnnotations(y){var E,v;if(y===void 0)return;const A=((E=this.getAnnotations(y._beforeIs))!==null&&E!==void 0?E:[]).concat((v=this.getAnnotations(y._afterIs))!==null&&v!==void 0?v:[]);return A.length>0?A:void 0}notAllowed(y,E){this.illegal(y,`${E} are not allowed in ${p}`)}illegal(y,E){this.contextError(y,"invalid-malloy-query-document",E)}visitMalloyDocument(y){const E=y.malloyStatement();let v;for(const _ of E)_.defineSourceStatement()?this.notAllowed(_,"Source definitions"):_.defineQuery()?this.notAllowed(_,"Query definitions"):_.importStatement()?this.notAllowed(_,"Import statements"):_.docAnnotations()?this.notAllowed(_,"Model annotations"):_.ignoredObjectAnnotations()?this.notAllowed(_,"Detatched object annotations"):_.experimentalStatementForTesting()?this.notAllowed(_,"Experimental testing statements"):v===void 0?v=_.runStatement():this.illegal(_,`${p} may only have one run statement`);return v===void 0?(this.illegal(y,`${p} must have a run statement`),null):this.visitRunStatement(v)}visitRunStatement(y){const E=y.topLevelAnonQueryDef(),v=this.getQueryDefinition(E.sqExpr()),_=this.getAnnotations(y.tags()),A=this.getAnnotations(y.topLevelAnonQueryDef().tags()),C=this.combineAnnotations(_,A);return v!==null?{annotations:C,definition:v}:null}getSourceArguments(y){const E=[];for(const v of y.sourceArgument()){const _=v.argumentId();if(_===void 0)return this.contextError(v,"unnamed-source-argument","Source argument must be named"),null;const A=(0,a.getId)(_),C=this.getLiteralIncludingNegativeNumber(v.fieldExpr());if(C===null)return null;E.push({name:A,value:C})}return E}getQueryReference(y){const E=y.sourceArguments(),v=(0,a.getId)(y);if(E){const _=this.getSourceArguments(E);return _===null?null:{name:v,parameters:_}}else return{name:v}}getQueryDefinition(y){if(y instanceof s.SQIDContext){const E=this.getQueryReference(y);if(E!==null)return{kind:"query_reference",...E}}else{if(y instanceof s.SQParensContext)return this.getQueryDefinition(y.sqExpr());if(y instanceof s.SQComposeContext)this.notAllowed(y,"Source compositions");else if(y instanceof s.SQRefinedQueryContext){const E=y.sqExpr(),v=this.getQueryDefinition(E),_=this.getRefinementSegment(y.segExpr());return _===null||v===null?null:(_.kind==="arrow"&&this.notAllowed(y,"Queries against refined queries"),{kind:"refinement",base:v,refinement:_})}else if(y instanceof s.SQExtendedSourceContext)this.notAllowed(y,"Source extensions");else if(y instanceof s.SQIncludeContext)this.notAllowed(y,"Source inclusions");else if(y instanceof s.SQTableContext)this.notAllowed(y,"Table statements");else if(y instanceof s.SQSQLContext)this.notAllowed(y,"SQL statements");else if(y instanceof s.SQArrowContext){const E=y.sqExpr(),v=this.getQueryDefinition(E),_=this.getRefinementSegment(y.segExpr());return _===null||v===null?null:v.kind==="query_reference"?{kind:"arrow",source:{...v,kind:"source_reference"},view:_}:v.kind==="arrow"?{kind:"arrow",source:v.source,view:{kind:"arrow",source:v.view,view:_}}:{kind:"arrow",source:v,view:_}}}return null}getRefinementSegment(y){if(y instanceof s.SegOpsContext){const E=y.queryProperties().queryStatement().flatMap(v=>this.getSegmentOperation(v));return E.some(v=>v===null)?null:{kind:"segment",operations:E}}else if(y instanceof s.SegFieldContext){const{name:E,path:v}=this.getFieldPath(y.fieldPath());return{kind:"view_reference",name:E,path:v}}else{if(y instanceof s.SegParenContext)return this.getViewExpression(y.vExpr());if(y instanceof s.SegRefineContext){const E=this.getRefinementSegment(y._lhs),v=this.getRefinementSegment(y._rhs);return E===null||v===null?null:{kind:"refinement",base:E,refinement:v}}}return null}getGroupByStatement(y){const E=this.getAnnotations(y.tags()),_=y.queryFieldList().queryFieldEntry().map(A=>this.getQueryField(A));return _.some(A=>A===null)||_===null?null:_.map(A=>{var C;const S=[...E??[],...(C=A.field.annotations)!==null&&C!==void 0?C:[]];return{kind:"group_by",name:A.name,field:{...A.field,annotations:S.length>0?S:void 0}}})}getAggregateStatement(y){const E=this.getAnnotations(y.tags()),_=y.queryFieldList().queryFieldEntry().map(A=>this.getQueryField(A));return _.some(A=>A===null)||_===null?null:_.map(A=>{var C;const S=[...E??[],...(C=A.field.annotations)!==null&&C!==void 0?C:[]];return{kind:"aggregate",name:A.name,field:{...A.field,annotations:S.length>0?S:void 0}}})}getOrderByStatement(y){const E=y.ordering().orderBySpec(),v=[];for(const _ of E)if(_.INTEGER_LITERAL())this.notAllowed(_,"Indexed order by statements");else if(_.fieldName()){const A=(0,a.getId)(_.fieldName()),C=_.ASC()?"asc":_.DESC()?"desc":void 0;v.push({kind:"order_by",direction:C,field_reference:{name:A}})}else return null;return v}getNestStatement(y){const E=this.getAnnotations(y.tags()),v=y.nestedQueryList().nestEntry(),_=[];for(const A of v){if(!(A instanceof s.NestDefContext))return this.internalError(A,"Expected nestDef"),null;const C=this.getAnnotations(A.tags()),S=this.getIsAnnotations(A.isDefine()),T=A.queryName(),D=T?(0,a.getId)(T):void 0,R=this.getViewExpression(A.vExpr());if(R===null)return null;_.push({kind:"nest",name:D,view:{definition:R,annotations:this.combineAnnotations(E,C,S)}})}return _}getViewExpression(y){if(y instanceof s.VSegContext)return this.getRefinementSegment(y.segExpr());if(y instanceof s.VArrowContext){const E=this.getRefinementSegment(y),v=this.getViewExpression(y._rhs);return E===null||v===null?null:{kind:"arrow",source:E,view:v}}else return this.internalError(y,"Unexpected VExpr node"),null}getLimitStatement(y){return{kind:"limit",limit:this.getNumber(y.INTEGER_LITERAL())}}getSegmentOperation(y){if(y.groupByStatement()){const E=y.groupByStatement();return this.getGroupByStatement(E)}else if(y.aggregateStatement()){const E=y.aggregateStatement();return this.getAggregateStatement(E)}else if(y.limitStatement()){const E=y.limitStatement(),v=this.getLimitStatement(E);return v===null?null:[v]}else if(y.declareStatement())this.notAllowed(y,"Declare statements");else if(y.queryJoinStatement())this.notAllowed(y,"Query join statements");else if(y.queryExtend())this.notAllowed(y,"Query extend statements");else if(y.projectStatement())this.notAllowed(y,"Select statements");else if(y.indexStatement())this.notAllowed(y,"Index statements");else if(y.calculateStatement())this.notAllowed(y,"Calculate statements");else if(y.topStatement())this.notAllowed(y,"Top statements");else if(y.orderByStatement()){const E=y.orderByStatement();return this.getOrderByStatement(E)}else if(y.whereStatement()){const E=y.whereStatement(),v=this.getWhere(E);return v===null?null:v.map(_=>({kind:"where",..._}))}else if(y.drillStatement()){const E=y.drillStatement(),v=this.getDrill(E);return v===null?null:v.map(_=>({kind:"drill",..._}))}else if(y.havingStatement()){const E=y.havingStatement(),v=this.getHaving(E);return v===null?null:v.map(_=>({kind:"having",..._}))}else if(y.nestStatement()){const E=y.nestStatement();return this.getNestStatement(E)}else y.sampleStatement()?this.notAllowed(y,"Sample statements"):y.timezoneStatement()?this.notAllowed(y,"Timezone statements"):(y.queryAnnotation()||y.ignoredModelAnnotations())&&this.notAllowed(y,"Detached annotation statements");return null}getFieldPath(y){const E=y.fieldName().map(A=>(0,a.getId)(A)),v=E[E.length-1],_=E.slice(0,-1);return{name:v,path:_.length>0?_:void 0}}getTimeframe(y){const E=y.text;return(0,u.isTimestampUnit)(E)?E:(this.illegal(y,`Invalid timeframe ${E}`),null)}getQueryField(y){if(y.taggedRef()){const E=y.taggedRef(),v=this.getAnnotations(E.tags()),{name:_,path:A}=this.getFieldPath(E.fieldPath());if(E.refExpr()){const C=E.refExpr();if(C.timeframe()){const S=this.getTimeframe(C.timeframe());return S===null?null:{name:void 0,field:{annotations:v,expression:{kind:"time_truncation",field_reference:{name:_,path:A},truncation:S}}}}else C.aggregate()&&this.notAllowed(C,"Aggregate expressions")}else return{name:void 0,field:{annotations:v,expression:{kind:"field_reference",name:_,path:A}}}}else if(y.fieldDef()){const E=y.fieldDef(),v=this.getAnnotations(E.tags()),_=this.getIsAnnotations(E.isDefine()),A=(0,a.getId)(E.fieldNameDef()),C=this.getFieldExpression(E.fieldExpr());return C===null?null:{name:A,field:{expression:C,annotations:this.combineAnnotations(v,_)}}}return null}getFieldExpression(y){if(y instanceof s.ExprFieldPathContext){const{name:E,path:v}=this.getFieldPath(y.fieldPath());return{kind:"field_reference",name:E,path:v}}else if(y instanceof s.ExprTimeTruncContext){const E=this.getTimeframe(y.timeframe()),v=y.fieldExpr(),_=this.getFieldExpression(v);return _===null||E===null?null:_.kind!=="field_reference"?(this.illegal(v,"Left hand side of time truncation must be a field reference"),null):{kind:"time_truncation",truncation:E,field_reference:{name:_.name,path:_.path,parameters:_.parameters}}}else if(y instanceof s.ExprFieldPropsContext){const E=y.fieldExpr(),v=this.getFieldExpression(E);if(v===null)return null;if(v.kind!=="field_reference")return this.illegal(E,"Left hand side of filtered field must be a field reference"),null;const _=y.fieldProperties().fieldPropertyStatement(),A=[];for(const C of _){const S=C.whereStatement();if(S){const T=this.getWhere(S);if(T===null)return null;A.push(...T)}}return{kind:"filtered_field",field_reference:{name:v.name,path:v.path,parameters:v.parameters},where:A}}else{const E=this.getLiteralIncludingNegativeNumber(y);return E===null?null:{kind:"literal_value",literal_value:E}}}stripQuote(y,E){return y.slice(y.indexOf(E)+E.length,y.lastIndexOf(E))}getFilterString(y){const E=y.tripFilterString(),v=y.tickFilterString();if(E){const _=E.BQ3_FILTER(),A=E.DQ3_FILTER(),C=E.SQ3_FILTER();if(_)return this.stripQuote(_.text,"```");if(A)return this.stripQuote(A.text,'"""');if(C)return this.stripQuote(C.text,"'''")}else if(v){const _=v.BQ_FILTER(),A=v.DQ_FILTER(),C=v.SQ_FILTER();if(_)return this.stripQuote(_.text,"`");if(A)return this.stripQuote(A.text,'"');if(C)return this.stripQuote(C.text,"'")}return null}getFilterExpr(y){if(y instanceof s.ExprCompareContext){if(y.compareOp().MATCH()){const E=y.fieldExpr()[0],v=y.fieldExpr()[1];if(E instanceof s.ExprFieldPathContext&&v instanceof s.ExprLiteralContext){const{path:_,name:A}=this.getFieldPath(E.fieldPath()),C=v.literal();if(C instanceof s.FilterString_stubContext){const S=this.getFilterString(C.filterString());return S===null?null:{filter:{kind:"filter_string",expression:{kind:"field_reference",name:A,path:_},filter:S}}}}}else if(y.compareOp().EQ()){const E=y.fieldExpr()[0],v=y.fieldExpr()[1];if(E instanceof s.ExprFieldPathContext){const{path:_,name:A}=this.getFieldPath(E.fieldPath()),C=this.getLiteralIncludingNegativeNumber(v);return C===null?(this.notAllowed(y,"Filters other than comparisons with filter strings or equality with literals"),null):{filter:{kind:"literal_equality",expression:{kind:"field_reference",name:A,path:_},value:C}}}}}return this.notAllowed(y,"Filters other than comparisons with filter strings or equality with literals"),null}getTimeLiteral(y,E){const v=E(y.text);if(!v)return this.contextError(y,"failed-to-parse-time-literal","Time data parse error"),null;const _=v.getValue(),A=_.timeframe,C=_.value;return(0,u.isTimeLiteral)(C)?C.node==="dateLiteral"?A==="hour"||A==="minute"||A==="second"?null:{kind:"date_literal",date_value:C.literal,granularity:A}:{kind:"timestamp_literal",timestamp_value:C.literal,granularity:A,timezone:C.timezone}:null}getLiteralIncludingNegativeNumber(y){if(y instanceof s.ExprLiteralContext)return this.getLiteral(y.literal());if(y instanceof s.ExprMinusContext){const E=y.fieldExpr();if(E instanceof s.ExprLiteralContext){const v=this.getLiteral(E.literal());return v===null||v.kind!=="number_literal"?null:{kind:"number_literal",number_value:-v.number_value}}}return null}getLiteral(y){if(y instanceof s.ExprTimeContext){const E=y.dateLiteral();return E instanceof s.LiteralTimestampContext?this.getTimeLiteral(E,d.LiteralTimestamp.parse):E instanceof s.LiteralHourContext?this.getTimeLiteral(E,d.LiteralHour.parse):E instanceof s.LiteralDayContext?this.getTimeLiteral(E,d.LiteralDay.parse):E instanceof s.LiteralWeekContext?this.getTimeLiteral(E,d.LiteralWeek.parse):E instanceof s.LiteralMonthContext?this.getTimeLiteral(E,d.LiteralMonth.parse):E instanceof s.LiteralQuarterContext?this.getTimeLiteral(E,d.LiteralQuarter.parse):E instanceof s.LiteralYearContext?this.getTimeLiteral(E,d.LiteralYear.parse):null}else{if(y instanceof s.ExprArrayLiteralContext)return this.notAllowed(y,"array literals"),null;if(y instanceof s.ExprLiteralRecordContext)return this.notAllowed(y,"record literals"),null;if(y instanceof s.ExprStringContext){const[E,v]=(0,a.getPlainString)(y);for(const _ of v)_ instanceof r.ParserRuleContext&&this.contextError(_,"illegal-query-interpolation-outside-sql-block","%{ query } illegal in this string");return{kind:"string_literal",string_value:E??""}}else{if(y instanceof s.ExprBoolContext)return{kind:"boolean_literal",boolean_value:y.TRUE()!==null};if(y instanceof s.ExprNumberContext)return{kind:"number_literal",number_value:Number(y.text)};if(y instanceof s.ExprNULLContext)return{kind:"null_literal"};if(y instanceof s.FilterString_stubContext){const E=y.getChild(0);if(E instanceof s.FilterStringContext){const v=this.getFilterString(E);if(v)return{kind:"filter_expression_literal",filter_expression_value:v}}}}}return null}getDrill(y){const v=y.drillClauseList().fieldExpr().map(_=>this.getFilterExpr(_));return v.some(_=>_===null)?null:v}getWhere(y){const v=y.filterClauseList().fieldExpr().map(_=>this.getFilterExpr(_));return v.some(_=>_===null)?null:v}getHaving(y){const v=y.filterClauseList().fieldExpr().map(_=>this.getFilterExpr(_));return v.some(_=>_===null)?null:v}combineAnnotations(...y){const E=y.flatMap(v=>v??[]);return E.length>0?E:void 0}}Ja.MalloyToQuery=x;function m(g){const y=(0,l.getSourceInfo)(g),E=new o.BaseMessageLogger(null),v="internal://query.malloy",_=(0,c.runMalloyParser)(g,v,y,E),C=new x(_,E).visit(_.root),S=(0,f.mapLogs)(E.getLog(),v);if(C===null)return{logs:S};if(!("definition"in C))throw new Error("Expected a query");return{query:C,logs:S}}return Ja}var kle;function lk(){return kle||(kle=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.malloyToQuery=e.exploreQueryWalkerBuilder=e.MalloyTranslation=e.MalloyTranslator=void 0;var t=eIe();Object.defineProperty(e,"MalloyTranslator",{enumerable:!0,get:function(){return t.MalloyTranslator}}),Object.defineProperty(e,"MalloyTranslation",{enumerable:!0,get:function(){return t.MalloyTranslation}});var n=tIe();Object.defineProperty(e,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}});var r=oIe();Object.defineProperty(e,"malloyToQuery",{enumerable:!0,get:function(){return r.malloyToQuery}})}(mI)),mI}var ck={},UA={},Ple;function aIe(){return Ple||(Ple=1,Object.defineProperty(UA,"__esModule",{value:!0}),UA.EMPTY_BUILD_MANIFEST=void 0,UA.EMPTY_BUILD_MANIFEST=Object.freeze({entries:Object.freeze({}),strict:!1})),UA}var va={},$le;function QR(){if($le)return va;$le=1,Object.defineProperty(va,"__esModule",{value:!0}),va.FixedConnectionMap=va.InMemoryURLReader=va.EmptyURLReader=void 0,va.hashForInvalidationKey=t,va.isInternalURL=n,va.readURL=r,va.getInvalidationKey=i;const e=Zp;function t(u){return(0,e.v5)(u,"76c17e9d-f3ce-5f2d-bfde-98ad3d2a37f6")}function n(u){return u.startsWith("internal://")}async function r(u,c){const l=await u.readURL(c),{contents:f,invalidationKey:d}=typeof l=="string"?{contents:l,invalidationKey:void 0}:l;return{contents:f,invalidationKey:n(c.toString())?null:d??t(f)}}async function i(u,c){return n(c.toString())?null:u.getInvalidationKey!==void 0?await u.getInvalidationKey(c):(await r(u,c)).invalidationKey}class s{async readURL(c){throw new Error("No files.")}async getInvalidationKey(c){throw new Error("No files.")}}va.EmptyURLReader=s;class o{constructor(c){this.files=c}async readURL(c){const l=this.files.get(c.toString());if(l!==void 0)return Promise.resolve({contents:l,invalidationKey:this.invalidationKey(c,l)});throw new Error(`File not found '${c}'`)}async getInvalidationKey(c){const l=this.files.get(c.toString());if(l!==void 0)return Promise.resolve(this.invalidationKey(c,l));throw new Error(`File not found '${c}'`)}invalidationKey(c,l){return n(c.toString())?null:t(l)}}va.InMemoryURLReader=o;class a{constructor(c,l){this.connections=c,this.defaultConnectionName=l}async getConnection(c){if(c===void 0)if(this.defaultConnectionName!==void 0)c=this.defaultConnectionName;else throw new Error("No default connection.");const l=this.connections.get(c);if(l!==void 0)return Promise.resolve(l);throw new Error(`No connection found with name ${c}.`)}listConnections(){return Array.from(this.connections.values())}async lookupConnection(c){return this.getConnection(c)}static fromArray(c){return new a(new Map(c.map(l=>[l.name,l])))}}return va.FixedConnectionMap=a,va}var q1={},Ble;function uIe(){if(Ble)return q1;Ble=1,Object.defineProperty(q1,"__esModule",{value:!0}),q1.InMemoryModelCache=q1.CacheManager=void 0;const e=QR();class t{constructor(s){this.modelCache=s,this.modelDependencies=new Map,this.modelInvalidationKeys=new Map}async getCachedModelDef(s,o){const a=this.modelDependencies.get(o);if(a===void 0)return;const u=[o,...n(a)],c={};for(const f of u){const d=this.modelInvalidationKeys.get(f);if(d==null)return;c[f]=d}for(const f of u)if(await(0,e.getInvalidationKey)(s,new URL(f))!==c[f])return;const l=await this.modelCache.getModel(new URL(o));if(l!==void 0){for(const f of u)if(l.invalidationKeys[f]!==c[f])return;return{modelDef:l.modelDef,invalidationKeys:c}}}async setCachedModelDef(s,o){this.modelDependencies.set(s,o.modelDef.dependencies);const a={};for(const c of[s,...n(o.modelDef.dependencies)]){if(o.invalidationKeys[c]===null)return!1;if(o.invalidationKeys[c]===void 0)throw new Error(`Missing invalidation key for dependency ${c}`);this.modelInvalidationKeys.set(c,o.invalidationKeys[c]),a[c]=o.invalidationKeys[c]}return!!await this.modelCache.setModel(new URL(s),{modelDef:o.modelDef,invalidationKeys:a})}}q1.CacheManager=t;function n(i){return[...Object.keys(i),...Object.values(i).map(n).flat()]}class r{constructor(){this.models=new Map}async getModel(s){return Promise.resolve(this.models.get(s.toString()))}async setModel(s,o){return this.models.set(s.toString(),o),Promise.resolve(!0)}}return q1.InMemoryModelCache=r,q1}var oo={},qle;function Ule(){if(qle)return oo;qle=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.DocumentCompletion=oo.DocumentSymbol=oo.DocumentPosition=oo.DocumentRange=oo.DocumentTablePath=oo.Parse=void 0;class e{constructor(a,u){this.translator=a,this.invalidationKey=u}get symbols(){return(this.translator.metadata().symbols||[]).map(a=>new i(a))}get tablePathInfo(){var a;return((a=this.translator.tablePathInfo().pathInfo)!==null&&a!==void 0?a:[]).map(c=>new t(c))}get _translator(){return this.translator}get _invalidationKey(){return this.invalidationKey}completions(a){return(this.translator.completions(a).completions||[]).map(u=>new s(u))}helpContext(a){return this.translator.helpContext(a).helpContext}}oo.Parse=e;class t{constructor(a){this._range=n.fromJSON(a.range),this._connectionId=a.connectionId,this._tablePath=a.tablePath}get range(){return this._range}get connectionId(){return this._connectionId}get tablePath(){return this._tablePath}}oo.DocumentTablePath=t;class n{constructor(a,u){this._start=a,this._end=u}get start(){return this._start}get end(){return this._end}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static fromJSON(a){return new n(new r(a.start.line,a.start.character),new r(a.end.line,a.end.character))}}oo.DocumentRange=n;class r{constructor(a,u){this._line=a,this._character=u}get line(){return this._line}get character(){return this._character}toJSON(){return{line:this.line,character:this.character}}}oo.DocumentPosition=r;class i{constructor(a){this._range=n.fromJSON(a.range),this._lensRange=a.lensRange?n.fromJSON(a.lensRange):void 0,this._type=a.type,this._name=a.name,this._children=a.children.map(u=>new i(u))}get range(){return this._range}get lensRange(){var a;return(a=this._lensRange)!==null&&a!==void 0?a:this._range}get type(){return this._type}get name(){return this._name}get children(){return this._children}}oo.DocumentSymbol=i;class s{constructor(a){this.type=a.type,this.text=a.text}}return oo.DocumentCompletion=s,oo}var sn={},jle;function VR(){if(jle)return sn;jle=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.PreparedResult=sn.PreparedQuery=sn.Given=sn.PersistSource=sn.Model=sn.Reference=sn.ExploreField=sn.QueryField=sn.Query=sn.StringField=sn.UnsupportedField=sn.JSONField=sn.BooleanField=sn.NumberField=sn.TimestampField=sn.DateField=sn.AtomicField=sn.Explore=sn.JoinRelationship=sn.TimestampTimeframe=sn.DateTimeframe=sn.AtomicFieldType=sn.SourceRelationship=void 0,sn.pseudoModelFor=x;const e=vi(),t=dr(),n=u0(),r=TI(),i=$c(),s=gZ(),o=Bc(),a=gm(),u=HR(),c=qA(),l=Xu(),f=hle();function d(W){return W.type==="table"||W.type==="sql_select"||W.type==="query_source"}const p="internal://generated-model";function x(W,P=p,j={}){if(!(0,e.isSourceDef)(W))throw new Error(`Cannot create pseudo model for struct type ${W.type}`);const L=(0,t.mkModelDef)("generated_model",P);return L.modelAnnotations=j,L.contents[W.name]=W,L}class m{constructor(P,j,L){this._name=P,this._parent=j,this._source=L}get source(){return this._source}get name(){return this._name}get sourceClasses(){const P=[];return this.source&&P.push(this.source.name),P.push(this.name),P}get fieldPath(){const P=[this.name];let j=this._parent;for(;j;)P.unshift(j.name),j=j._parent;return P}hasParentExplore(){return this._parent!==void 0}isExplore(){return this instanceof A}isQuery(){return this instanceof z}}var g;(function(W){W.Nested="nested",W.BaseTable="base_table",W.Cross="cross",W.One="one",W.Many="many",W.Inline="inline"})(g||(sn.SourceRelationship=g={}));var y;(function(W){W.String="string",W.Number="number",W.Boolean="boolean",W.Date="date",W.Timestamp="timestamp",W.Timestamptz="timestamptz",W.Json="json",W.NativeUnsupported="sql native",W.Error="error"})(y||(sn.AtomicFieldType=y={}));var E;(function(W){W.Day="day",W.Week="week",W.Month="month",W.Quarter="quarter",W.Year="year"})(E||(sn.DateTimeframe=E={}));var v;(function(W){W.Day="day",W.Week="week",W.Month="month",W.Quarter="quarter",W.Year="year",W.Second="second",W.Hour="hour",W.Minute="minute"})(v||(sn.TimestampTimeframe=v={}));var _;(function(W){W.OneToOne="one_to_one",W.OneToMany="one_to_many",W.ManyToOne="many_to_one"})(_||(sn.JoinRelationship=_={}));class A extends m{constructor(P,j,L,N){super((0,e.activeName)(j),L,N),this._ownerModelDef=P,this._structDef=j,this._parentExplore=L,this.sourceExplore=N}get _modelDef(){return this._ownerModelDef}get source(){return this.sourceExplore}isIntrinsic(){return(0,e.isAtomicFieldType)(this._structDef.type)?!("e"in this._structDef):!1}isExploreField(){return!1}tagParse(P){return(0,a.annotationToTag)(this._structDef.annotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this._structDef.annotations,P)}get annotations(){return new a.Annotations(this._structDef.annotations)}get modelAnnotations(){return new a.Annotations((0,e.getModelAnnotations)(this._ownerModelDef))}get modelTag(){return this.parsedModelTag||(this.parsedModelTag=this.modelAnnotations.parseAsTag().tag),this.parsedModelTag}get name(){return(0,e.activeName)(this.structDef)}getQueryByName(P){const j=this.sourceStructDef;if(!j)throw new Error(`Cannot get query by name from a struct of type ${this.structDef.type}`);const L=j.fields.find(k=>(0,e.activeName)(k)===P);if(L===void 0)throw new Error(`No such view named \`${P}\``);if(L.type!=="turtle")throw new Error(`\`${P}\` is not a view`);const N={type:"query",structRef:j,pipeline:L.pipeline};return new $(N,this.getSingleExploreModel(),[],P)}getSingleExploreModel(){return new V(this._ownerModelDef,[],[])}get fieldMap(){var P;if(this._fieldMap===void 0){const j=((P=this.source)===null||P===void 0?void 0:P.fieldMap)||new Map;this._fieldMap=new Map(this.structDef.fields.map(L=>{const N=(0,e.activeName)(L),k=j.get(L.name);if((0,e.isJoined)(L))return[N,new Z(L,this,k)];if(L.type==="turtle")return[N,new z(L,this,k)];if(L.type==="string")return[N,new I(L,this,k)];if(L.type==="number")return[N,new D(L,this,k)];if(L.type==="date")return L.timeframe&&["day_of_month","day_of_week","day_of_year"].includes(L.timeframe)?[N,new D({...L,type:"number"},this,k)]:[N,new S(L,this,k)];if(L.type==="timestamp")return[N,new T(L,this,k)];if(L.type==="timestamptz")return[N,new T(L,this,k)];if(L.type==="boolean")return[N,new R(L,this,k)];if(L.type==="json")return[N,new O(L,this,k)];if(L.type==="sql native")return[N,new F(L,this,k)]}))}return this._fieldMap}get allFields(){return[...this.fieldMap.values()]}get allFieldsWithOrder(){var P,j,L;if(!this._allFieldsWithOrder){const N=[...((L=(j=(P=this.sourceStructDef)===null||P===void 0?void 0:P.resultMetadata)===null||j===void 0?void 0:j.orderBy)===null||L===void 0?void 0:L.map(U=>{if(typeof U.field=="string")return{field:this.fieldMap.get(U.field),dir:U.dir};throw new Error("Does not support mapping order by from number.")}))||[]],k=new Set(N.map(U=>U.field.name));this._allFieldsWithOrder=[...N,...this.allFields.filter(U=>!k.has(U.name)).map(U=>({field:U,dir:"asc"}))]}return this._allFieldsWithOrder}get intrinsicFields(){return[...this.fieldMap.values()].filter(P=>P.isIntrinsic())}get dimensions(){return[...this.allFieldsWithOrder].filter(P=>P.field.isAtomicField()&&P.field.sourceWasDimension())}getFieldByName(P){const j=this.fieldMap.get(P);if(j===void 0)throw new Error(`No such field ${P}.`);return j}getFieldByNameIfExists(P){return this.fieldMap.get(P)}get primaryKey(){var P;return(P=this.sourceStructDef)===null||P===void 0?void 0:P.primaryKey}get parentExplore(){return this._parentExplore}hasParentExplore(){return this instanceof Z}get filters(){var P;return(0,e.isSourceDef)(this.structDef)?((P=this.structDef.resultMetadata)===null||P===void 0?void 0:P.filterList)||[]:[]}get limit(){var P,j;return(j=(P=this.sourceStructDef)===null||P===void 0?void 0:P.resultMetadata)===null||j===void 0?void 0:j.limit}get structDef(){return this._structDef}get queryTimezone(){var P;return(P=this.sourceStructDef)===null||P===void 0?void 0:P.queryTimezone}get sourceStructDef(){if((0,e.isSourceDef)(this.structDef))return this.structDef}toJSON(){var P,j;return{_structDef:this._structDef,modelID:this._ownerModelDef.modelID,modelAnnotations:this._ownerModelDef.modelAnnotations,sourceExplore:(P=this.sourceExplore)===null||P===void 0?void 0:P.toJSON(),_parentExplore:(j=this._parentExplore)===null||j===void 0?void 0:j.toJSON()}}static fromJSON(P){const j=P._parentExplore!==void 0?A.fromJSON(P._parentExplore):void 0,L=P.sourceExplore!==void 0?A.fromJSON(P.sourceExplore):void 0;return new A(x(P._structDef,P.modelID,P.modelAnnotations),P._structDef,j,L)}get location(){return this.structDef.location}collectSourceComponents(P){const j=[];if(P.type==="composite"){for(const L of P.sources)j.push(...this.collectSourceComponents(L));return j}if(d(P)){if(P.type==="table")j.push({type:"table",tableName:P.tablePath,componentID:`${P.connection}:${P.tablePath}`,sourceID:`${P.connection}:${P.tablePath}`});else if(P.type==="sql_select")j.push({type:"sql",selectStatement:P.selectStr,componentID:`${P.connection}:${P.selectStr}`,sourceID:`${P.connection}:${P.selectStr}`});else if(P.type==="query_source"){let L;try{L=new $(P.query,this.getSingleExploreModel(),[]).getPreparedResult().sql}catch(k){L=`-- Could not compile SQL for query ${P.query.name||"unnamed query"}: ${k instanceof Error?k.message:String(k)}`}const N=`${P.connection}:${L}`;j.push({type:"sql",selectStatement:L,componentID:N,sourceID:N})}}else return[];for(const L of P.fields)(0,e.isJoined)(L)&&j.push(...this.collectSourceComponents(L));return j}getSourceComponents(){const P={};if((0,e.isSourceDef)(this.structDef)){const j=this.collectSourceComponents(this.structDef);for(const L of j)L.componentID?P[L.componentID]=L:L.sourceID&&(P[L.sourceID]=L)}return Object.values(P)}}sn.Explore=A;class C extends m{constructor(P,j,L){super((0,e.activeName)(P),j,L),this.fieldTypeDef=P,this.parent=j}get type(){switch(this.fieldTypeDef.type){case"string":return y.String;case"boolean":return y.Boolean;case"date":return y.Date;case"timestamp":return y.Timestamp;case"timestamptz":return y.Timestamptz;case"number":return y.Number;case"json":return y.Json;case"sql native":return y.NativeUnsupported;case"error":return y.Error;case"record":case"array":throw new Error(`MTOY TODO IMPLEMENT Atomic ${this.fieldTypeDef.type}`);default:{const P=this.fieldTypeDef;throw new Error(`Can't make an atomic field from ${P}`)}}}tagParse(P){return(0,a.annotationToTag)(this.fieldTypeDef.annotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this.fieldTypeDef.annotations,P)}get annotations(){return new a.Annotations(this.fieldTypeDef.annotations)}get modelAnnotations(){return new a.Annotations((0,e.getModelAnnotations)(this.parent._modelDef))}isIntrinsic(){return(0,e.fieldIsIntrinsic)(this.fieldTypeDef)}isQueryField(){return!1}isExploreField(){return!1}isAtomicField(){return!0}isCalculation(){return(0,e.expressionIsCalculation)(this.fieldTypeDef.expressionType)}get sourceField(){throw new Error}get sourceClasses(){const P=this.fieldTypeDef.name||this.fieldTypeDef.as;return P?[P]:[]}get referenceId(){var P;return(P=this.fieldTypeDef.resultMetadata)===null||P===void 0?void 0:P.referenceId}sourceWasMeasure(){var P;return((P=this.fieldTypeDef.resultMetadata)===null||P===void 0?void 0:P.fieldKind)==="measure"}sourceWasMeasureLike(){var P,j;return((P=this.fieldTypeDef.resultMetadata)===null||P===void 0?void 0:P.fieldKind)==="measure"||((j=this.fieldTypeDef.resultMetadata)===null||j===void 0?void 0:j.fieldKind)==="struct"}sourceWasDimension(){var P;return((P=this.fieldTypeDef.resultMetadata)===null||P===void 0?void 0:P.fieldKind)==="dimension"}hasParentExplore(){return!0}isString(){return this instanceof I}isNumber(){return this instanceof D}isDate(){return this instanceof S}isBoolean(){return this instanceof R}isJSON(){return this instanceof O}isTimestamp(){return this instanceof T}isUnsupported(){return this instanceof F}get parentExplore(){return this.parent}get expression(){const P=".",j=this.fieldTypeDef.resultMetadata;return(j==null?void 0:j.sourceExpression)||(j!=null&&j.sourceField.includes(P)?j==null?void 0:j.sourceField:this.name)}get location(){return this.fieldTypeDef.location}}sn.AtomicField=C;class S extends C{constructor(P,j,L){super(P,j,L),this.fieldDateDef=P}get timeframe(){if(this.fieldDateDef.timeframe!==void 0)switch(this.fieldDateDef.timeframe){case"day":return E.Day;case"week":return E.Week;case"month":return E.Month;case"quarter":return E.Quarter;case"year":return E.Year}}}sn.DateField=S;class T extends C{constructor(P,j,L){super(P,j,L),this.fieldTimestampDef=P}get timeframe(){if(this.fieldTimestampDef.timeframe!==void 0)switch(this.fieldTimestampDef.timeframe){case"day":return v.Day;case"week":return v.Week;case"month":return v.Month;case"quarter":return v.Quarter;case"year":return v.Year;case"second":return v.Second;case"hour":return v.Hour;case"minute":return v.Minute}}}sn.TimestampField=T;class D extends C{constructor(P,j,L){super(P,j,L),this.fieldNumberDef=P}}sn.NumberField=D;class R extends C{constructor(P,j,L){super(P,j,L),this.fieldBooleanDef=P}}sn.BooleanField=R;class O extends C{constructor(P,j,L){super(P,j,L),this.fieldJSONDef=P}}sn.JSONField=O;class F extends C{constructor(P,j,L){super(P,j,L),this.fieldUnsupportedDef=P}get rawType(){return this.fieldUnsupportedDef.rawType}}sn.UnsupportedField=F;class I extends C{constructor(P,j,L){super(P,j,L),this.fieldStringDef=P}}sn.StringField=I;class B extends m{constructor(P,j,L){super((0,e.activeName)(P),j,L),this.turtleDef=P}get source(){return this.sourceQuery}isIntrinsic(){return!1}get location(){return this.turtleDef.location}tagParse(P){return(0,a.annotationToTag)(this.turtleDef.annotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this.turtleDef.annotations,P)}get annotations(){return new a.Annotations(this.turtleDef.annotations)}get modelAnnotations(){var P;const j=(P=this._parent)===null||P===void 0?void 0:P._modelDef;return new a.Annotations(j&&(0,e.getModelAnnotations)(j))}}sn.Query=B;class z extends B{constructor(P,j,L){super(P,j,L),this.parent=j}isQueryField(){return!0}isExploreField(){return!1}isAtomicField(){return!1}get sourceClasses(){const P=this.turtleDef.name||this.turtleDef.as;return P?[P]:[]}hasParentExplore(){return!0}get parentExplore(){return this.parent}get expression(){return this.name}}sn.QueryField=z;class Z extends A{constructor(P,j,L){super(j._modelDef,P,j,L),this._parentExplore=j}get joinRelationship(){if((0,e.isJoined)(this.structDef))switch(this.structDef.join){case"one":return _.OneToOne;case"many":case"cross":return _.ManyToOne}throw new Error("A source field must have a join relationship.")}get isRecord(){return this.joinRelationship===_.OneToOne}get isArray(){return this.joinRelationship!==_.OneToOne}tagParse(P){return(0,a.annotationToTag)(this._structDef.annotations,P)}get annotations(){return new a.Annotations(this._structDef.annotations)}isQueryField(){return!1}isExploreField(){return!0}isAtomicField(){return!1}get parentExplore(){return this._parentExplore}get sourceClasses(){const P=this.structDef.name||this.structDef.as;return P?[P]:[]}get queryTimezone(){return(0,e.isRecordOrRepeatedRecord)(this._structDef)?this._structDef.queryTimezone:super.queryTimezone}}sn.ExploreField=Z;const oe={fieldReference:"field",joinReference:"join",exploreReference:"explore",queryReference:"query",sqlBlockReference:"sqlBlock",givenReference:"given"};class fe{constructor(P){this._ref=P}get text(){return this._ref.text}get kind(){return oe[this._ref.type]}get location(){return this._ref.location}get definitionLocation(){return this._ref.definition.location}get definitionType(){return this._ref.definition.type}get defaultText(){if(this._ref.type==="givenReference")return this._ref.definition.defaultText}get annotations(){return new a.Annotations(this._ref.definition.annotations)}}sn.Reference=fe;class V{constructor(P,j,L,N,k){var U,Y;this.modelDef=P,this.problems=j,this.fromSources=L,this.runtimeContext=k,this.references=new f.ReferenceList((U=L[0])!==null&&U!==void 0?U:"",(Y=P.references)!==null&&Y!==void 0?Y:[]),this._queryModel=N,this.contentsMap=new Map(Object.entries(P.contents))}getContent(P){return this.contentsMap.get(P)}get queryModel(){return this._queryModel||(this._queryModel=new e.QueryModel(this.modelDef)),this._queryModel}getExistingQueryModel(){return this._queryModel}get givens(){var P,j;const L=new Map,N=this.modelDef.givens;if(!N)return L;for(const[k,U]of this.contentsMap){if(U.type!=="given"||!((j=(P=this.runtimeContext)===null||P===void 0?void 0:P.finalizedGivens)===null||j===void 0)&&j.has(k))continue;const Y=N[U.id];Y&&!Y.inline&&L.set(k,new ae(k,U.id,Y,this.modelDef))}return L}get _ownModelAnnotations(){var P;return(P=this.modelDef.modelAnnotations[this.modelDef.modelID])===null||P===void 0?void 0:P.ownNotes}tagParse(P){return(0,a.annotationToTag)(this._ownModelAnnotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this._ownModelAnnotations,P)}get annotations(){return new a.Annotations(this._ownModelAnnotations)}get modelAnnotations(){return new a.Annotations((0,e.getModelAnnotations)(this.modelDef))}referenceAt(P){const j=this.references.find(P);return j?new fe(j):void 0}getReference(P){return this.references.find(P)}getImport(P){var j;return(j=this.modelDef.imports)===null||j===void 0?void 0:j.find(L=>(0,l.locationContainsPosition)(L.location,P))}getPreparedQueryByName(P){const j=this.getContent(P);if((j==null?void 0:j.type)==="query")return new $(j,this,this.problems,P);throw new Error("Given query name does not refer to a named query.")}getPreparedQueryByIndex(P){if(P<0)throw new Error(`Invalid index ${P}.`);if(P>=this.modelDef.queryList.length)throw new Error(`Query index ${P} is out of bounds.`);return new $(this.modelDef.queryList[P],this,this.problems)}get preparedQuery(){return this.getPreparedQuery()}getPreparedQuery(){if(this.modelDef.queryList.length===0)throw new Error("Model has no queries.");return new $(this.modelDef.queryList[this.modelDef.queryList.length-1],this,this.problems)}getExploreByName(P){const j=this.getContent(P);if(j&&(0,e.isSourceDef)(j))return new A(this.modelDef,j);throw new Error("'name' is not an explore")}get explores(){return Object.values(this.modelDef.contents).filter(e.isSourceDef).map(P=>new A(this.modelDef,P))}queries(){const P=[];for(const j of Object.values(this.modelDef.contents))j.type==="query"&&P.push(j.name);return{named:P,unnamed:this.modelDef.queryList.length}}get namedQueries(){const P=j=>j.type==="query";return Object.values(this.modelDef.contents).filter(P)}get exportedExplores(){return this.explores.filter(P=>this.modelDef.exports.includes(P.name))}get _modelDef(){return this.modelDef}getBuildPlan(){if(!this.modelAnnotations.parseAsTag("!").tag.has("experimental","persistence"))throw new Error("Model must have ##! experimental.persistence to use getBuildPlan()");const j=[],L=[];for(const J of Object.values(this.modelDef.contents))(J.type==="query"||(0,e.isSourceDef)(J))&&j.push(...(0,r.findPersistentDependencies)(J,this.modelDef,L));for(const J of this.modelDef.queryList)j.push(...(0,r.findPersistentDependencies)(J,this.modelDef,L));if(j.length===0)return{graphs:[],sources:{},tagParseLog:L};const N=(0,r.minimalBuildGraph)(j),k={},U=J=>{for(const ee of J){if(!(ee.sourceID in k)){const le=(0,i.resolveSourceID)(this.modelDef,ee.sourceID);le&&(k[ee.sourceID]=new ne(new A(this.modelDef,le),this))}U(ee.dependsOn)}};U(N);const Y=new Map;for(const J of N){const ee=k[J.sourceID];if(!ee)continue;const le=ee.connectionName;Y.has(le)||Y.set(le,[]),Y.get(le).push(J)}const G=[];for(const[J,ee]of Y)G.push({connectionName:J,nodes:[ee]});return{graphs:G,sources:k,tagParseLog:L}}}sn.Model=V;class ne{constructor(P,j){this.explore=P,this.model=j;const L=P.structDef;if(!(0,e.isSourceDef)(L))throw new Error("Cannot create PersistSource from non-source type");if(!(0,e.isPersistableSourceDef)(L))throw new Error(`Cannot persist source '${P.name}' of type '${L.type}'. Only query_source and sql_select sources can be persisted.`);this.persistableDef=L}get name(){return this.explore.name}get sourceID(){const P=this.persistableDef.sourceID;if(!P)throw new Error(`PersistSource '${this.name}' has no sourceID. This should not happen - sourceID is set at translation time.`);return P}get _explore(){return this.explore}get annotation(){return this.persistableDef.annotations}tagParse(P){return this.explore.tagParse(P)}getTaglines(P){return this.explore.getTaglines(P)}get annotations(){return this.explore.annotations}get modelAnnotations(){return this.explore.modelAnnotations}get connectionName(){return this.persistableDef.connection}get dialectName(){return this.persistableDef.dialect}get dialect(){return(0,n.getDialect)(this.dialectName)}makeBuildId(P,j){return(0,i.mkBuildID)(P,j)}getSQL(P){const j=this.persistableDef,L=this.model.queryModel;return j.type==="sql_select"?(0,e.getCompiledSQL)(j,P??{},(N,k)=>L.compileQuery(N,k).sql):L.compileQuery(j.query,P).sql}get _sourceDef(){return this.persistableDef}get _model(){return this.model}}sn.PersistSource=ne;class ae{constructor(P,j,L,N){this.name=P,this.id=j,this._internal=L,this._modelDef=N}get type(){return this._internal.type}get default(){return this._internal.default}get location(){return this._internal.location}tagParse(P){return(0,a.annotationToTag)(this._internal.annotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this._internal.annotations,P)}get annotations(){return new a.Annotations(this._internal.annotations)}get modelAnnotations(){return new a.Annotations((0,e.getModelAnnotations)(this._modelDef))}}sn.Given=ae;class de{constructor(P){this.pipelineDef=P}get annotations(){return new a.Annotations(this.pipelineDef.annotations)}get location(){return this.pipelineDef.location}tagParse(P){return(0,a.annotationToTag)(this.pipelineDef.annotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this.pipelineDef.annotations,P)}}class $ extends de{constructor(P,j,L,N){super(P),this._model=j,this.problems=L,this.name=N}get _query(){return this.pipelineDef}get _modelDef(){return this._model._modelDef}get modelAnnotations(){return new a.Annotations((0,e.getModelAnnotations)(this._modelDef))}get preparedResult(){return this.getPreparedResult()}getPreparedResult(P){const j=this._model.queryModel,L=P!=null&&P.givens?(0,s.resolveSuppliedGivens)(P.givens,this._modelDef):new Map;(0,s.evaluateInlineGivens)(L,this._modelDef);const N={...P,resolvedGivens:L.size>0?L:void 0},k=j.compileQuery(this._query,N);return new H({...k,queryName:this.name||k.queryName},this._modelDef)}get dialect(){const P=this._query.structRef,j=typeof P=="string"?this._model.getContent(P):P;if(j===void 0||!(0,e.isSourceDef)(j))throw new Error("Invalid source for query");return j.dialect}getFlattenedQuery(P){return this}get model(){return this._model}get givens(){const P=new Map,j=this._query.givenUsage;if(!j||j.length===0)return P;const L=new Set(j.map(N=>N.id));for(const[N,k]of this._model.givens)L.has(k.id)&&P.set(N,k);return P}}sn.PreparedQuery=$;class H{constructor(P,j){this.modelDef=j,this.inner=P}static fromJson({query:P,modelDef:j}){if(!P||!j)throw new Error("Missing required properties in JSON data");return new H(P,j)}tagParse(P){return(0,a.annotationToTag)(this.inner.annotations,P)}getTaglines(P){return(0,a.annotationToTaglines)(this.inner.annotations,P)}get annotations(){return new a.Annotations(this.inner.annotations)}get modelAnnotations(){return new a.Annotations((0,e.getModelAnnotations)(this.modelDef))}get annotation(){return this.inner.annotations}get modelAnnotation(){return(0,e.getModelAnnotations)(this.modelDef)}get modelTag(){return new a.Annotations((0,e.getModelAnnotations)(this.modelDef)).parseAsTag().tag}get connectionName(){return this.inner.connectionName}get _rawQuery(){return this.inner}get _modelDef(){return this.modelDef}get sql(){return this.inner.sql}get resultExplore(){if(this.inner.structs.length===0)throw new Error("Malformed query result.");const P=this.inner.structs[this.inner.structs.length-1],j={...P,annotations:this.inner.annotations,name:this.inner.queryName||P.name};try{return new A(this.modelDef,j,this.sourceExplore)}catch{return new A(this.modelDef,j)}}get sourceExplore(){const P=this.inner.sourceExplore,j=(0,e.safeRecordGet)(this.modelDef.contents,P);if(j&&(0,e.isSourceDef)(j))return new A(this.modelDef,j)}get _sourceExploreName(){return this.inner.sourceExplore}get _sourceArguments(){return this.inner.sourceArguments}get _sourceFilters(){return this.inner.sourceFilters||[]}get hasSchema(){return this.inner.structs.length>0}toStableResult(P){const j=this.inner.structs,L=j[j.length-1],N={fields:(0,u.convertFieldInfos)(L,L.fields)},k=(0,u.toStableAnnotations)(this.inner.annotations),U=L.resultMetadata?(0,u.getResultStructMetadataAnnotation)(L,L.resultMetadata):void 0;U&&k.push(U);const Y=o.Tag.withPrefix("#(malloy) "),G=this.sourceExplore;if(G&&Y.set(["source","name"],G.name),this._sourceArguments){const ee=Object.entries(this._sourceArguments);for(let le=0;le<ee.length;le++){const[ce,ge]=ee[le],me=(0,c.nodeToLiteralValue)(ge.value);me!==void 0&&(0,u.writeLiteralToTag)(Y,["source","parameters",le,"value"],me),Y.set(["source","parameters",le,"name"],ce)}}k.push({value:Y.toString()}),k.push({value:o.Tag.withPrefix("#(malloy) ").set(["query_name"],this.inner.queryName||L.name).toString()});const J=(0,u.toStableAnnotations)((0,e.getModelAnnotations)(this.modelDef));return{schema:N,data:P,connection_name:this.inner.connectionName,annotations:k.length>0?k:void 0,model_annotations:J.length>0?J:void 0,query_timezone:L.queryTimezone,sql:this.inner.sql}}}return sn.PreparedResult=H,sn}var Sd={},zle;function Hle(){if(zle)return Sd;zle=1,Object.defineProperty(Sd,"__esModule",{value:!0}),Sd.DataRecord=Sd.DataArray=Sd.Result=void 0;const e=vi(),t=Hv(),n=VR();class r extends n.PreparedResult{constructor(O,F){super(O,F),this.inner=O}get _queryResult(){return this.inner}get data(){return new T(this.inner.result,this.resultExplore,void 0,void 0)}get totalRows(){return this.inner.totalRows}get runStats(){return this.inner.runStats}get profilingUrl(){return this.inner.profilingUrl}toJSON(){return this.hasSchema?{queryResult:{...this.inner,result:this.data.toJSON()},modelDef:this._modelDef}:{queryResult:this.inner,modelDef:this._modelDef}}static fromJSON({queryResult:O,modelDef:F}){return new r(O,F)}}Sd.Result=r;class i{constructor(O,F,I){this.parent=F,this.parentRecord=I,this._field=O}get field(){return this._field}isString(){return this instanceof o}get string(){if(this.isString())return this;throw new Error("Not a string.")}isBoolean(){return this instanceof u}get boolean(){if(this.isBoolean())return this;throw new Error("Not a boolean.")}isNumber(){return this instanceof l}get number(){if(this.isNumber())return this;throw new Error("Not a number.")}isTimestamp(){return this instanceof f}get timestamp(){if(this.isTimestamp())return this;throw new Error("Not a timestamp.")}isDate(){return this instanceof d}get date(){if(this.isDate())return this;throw new Error("Not a date.")}isNull(){return this instanceof x}isBytes(){return this instanceof p}get bytes(){if(this.isBytes())return this;throw new Error("Not bytes.")}isRecord(){return this instanceof D}get record(){if(this.isRecord())return this;throw new Error("Not a record.")}isUnsupported(){return this instanceof a}get unsupported(){if(this.isUnsupported())return this;throw new Error("Not unsupported.")}isArray(){return this instanceof T}get array(){if(this.isArray())return this;throw new Error("Not an array.")}isArrayOrRecord(){if(this instanceof T||this instanceof D)return this;throw new Error("No Array or Record")}isScalar(){return!0}}class s extends i{constructor(O,F,I,B){super(F,I,B),this._value=O,this._field=F}get value(){return this._value}get field(){return this._field}isScalar(){return this instanceof s}}class o extends s{constructor(O,F,I,B){super(O,F,I,B),this._field=F}get field(){return this._field}get key(){return this.value}compareTo(O){return this.value.toLocaleLowerCase().localeCompare(O.value.toLocaleLowerCase())}}class a extends s{constructor(O,F,I,B){super(O,F,I,B),this._field=F}get field(){return this._field}get key(){return"<unsupported>"}compareTo(O){return 0}}class u extends s{constructor(O,F,I,B){super(O,F,I,B),this._field=F}get field(){return this._field}get key(){return`${this.value}`}compareTo(O){return this.value===O.value?0:this.value?1:-1}}class c extends s{constructor(O,F,I,B){super(O,F,I,B),this._field=F}get field(){return this._field}get key(){return this.value}compareTo(O){const F=this.value.toString(),I=O.toString();return F===I?0:F>I?1:-1}}class l extends s{constructor(O,F,I,B){super((0,t.rowDataToNumber)(O),F,I,B),this._field=F}get field(){return this._field}get key(){return`${this.value}`}compareTo(O){const F=this.value-O.value;return F>0?1:F===0?0:-1}}class f extends s{constructor(O,F,I,B){super(O,F,I,B),this._field=F}get value(){return(0,t.rowDataToDate)(this._value)}get field(){return this._field}get key(){return`${this.value.toLocaleString()}`}compareTo(O){return this.value>O.value?1:this.value<O.value?-1:0}}class d extends s{constructor(O,F,I,B){super(O,F,I,B),this._field=F}get value(){return(0,t.rowDataToDate)(this._value)}get field(){return this._field}get key(){return`${this.value.toLocaleString()}`}compareTo(O){return this.value>O.value?1:this.value<O.value?-1:0}}class p extends s{get key(){return this.value.toString()}compareTo(O){const F=this.value.toString(),I=O.toString();return F===I?0:F>I?1:-1}}class x extends i{get value(){return null}get key(){return"<null>"}}function m(R){const O=(0,t.rowDataToSerializedBigint)(R);if(O.includes(".")||O.includes("e")||O.includes("E"))return(0,t.rowDataToNumber)(R);try{return BigInt(O)}catch{return(0,t.rowDataToNumber)(R)}}function g(R){const O=(0,t.rowDataToSerializedBigint)(R);return O.includes(".")||O.includes("e")||O.includes("E")?(0,t.rowDataToNumber)(R):O}const y={number:t.rowDataToNumber,bigint:m,date:t.rowDataToDate},E={number:t.rowDataToNumber,bigint:g,date:R=>(0,t.rowDataToDate)(R).toISOString()};function v(R,O,F){return R.map(I=>_(I,O,F))}function _(R,O,F){const I={};for(const B of O.fields){const z=(0,e.activeName)(B),Z=R[z];I[z]=A(Z,B,F)}return I}function A(R,O,F){if(R==null)return null;if(O.type==="number")return O.numberType==="bigint"?F.bigint(R):F.number(R);if(O.type==="date"||O.type==="timestamp"||O.type==="timestamptz")return F.date(R);if(O.type==="string"||O.type==="boolean"||O.type==="json"||O.type==="sql native")return O.type==="boolean"&&typeof R=="number"?R!==0:R;if(O.type==="array"){if(!Array.isArray(R))return R;if((0,e.isRepeatedRecord)(O))return R.map(I=>_(I,O,F));if((0,e.isBasicArray)(O)){const I=O.elementTypeDef;return R.map(B=>C(B,I,F))}}return O.type==="record"&&typeof R=="object"&&R!==null&&!Array.isArray(R)?_(R,O,F):R}function C(R,O,F){if(R==null)return null;if(O.type==="number")return O.numberType==="bigint"?F.bigint(R):F.number(R);if(O.type==="date"||O.type==="timestamp"||O.type==="timestamptz")return F.date(R);if(O.type==="boolean"&&typeof R=="number")return R!==0;if(O.type==="array"&&Array.isArray(R)){if((0,e.isBasicArray)(O)){const I=O.elementTypeDef;return R.map(B=>C(B,I,F))}else if((0,e.isRepeatedRecord)(O))return R.map(I=>_(I,O,F))}return R}function S(R,O){for(const F of O)typeof F=="number"?R=R.array.row(F):R=R.record.cell(F);return R}class T extends i{constructor(O,F,I,B){super(F,I,B),this.rowCache=new Map,this.queryData=O,this._field=F}get field(){return this._field}get rawData(){return this.queryData}toObject(){return v(this.queryData,this._field.structDef,y)}toJSON(){return v(this.queryData,this._field.structDef,E)}path(...O){return S(this,O)}row(O){let F=this.rowCache.get(O);return F||(F=new D(this.queryData[O],O,this.field,this,this.parentRecord),this.rowCache.set(O,F)),F}get rowCount(){return this.queryData.length}get value(){return this.toObject()}[Symbol.iterator](){let O=0;const F=this.queryData,I=B=>this.row(B);return{next(){return O<F.length?{value:I(O++),done:!1}:{value:void 0,done:!0}}}}async*inMemoryStream(){for(let O=0;O<this.queryData.length;O++)yield this.row(O)}}Sd.DataArray=T;class D extends i{constructor(O,F,I,B,z){super(I,B,z),this.cellCache=new Map,this.queryDataRow=O,this._field=I,this.index=F}toObject(){return _(this.queryDataRow,this._field.structDef,y)}toJSON(){return _(this.queryDataRow,this._field.structDef,E)}path(...O){return S(this,O)}cell(O){const F=typeof O=="string"?O:O.name,I=this._field.getFieldByName(F);let B=this.cellCache.get(F);if(!B){const z=this.queryDataRow[F];z===null?B=new x(I,this,this):I.isAtomicField()?I.isBoolean()?B=new u(z,I,this,this):I.isDate()?B=new d(z,I,this,this):I.isJSON()?B=new c(z,I,this,this):I.isTimestamp()?B=new f(z,I,this,this):I.isNumber()?B=new l(z,I,this,this):I.isString()?B=new o(z,I,this,this):I.isUnsupported()&&(B=new a(z,I,this,this)):I.isExploreField()&&((0,e.isCompoundArrayData)(z)?B=new T(z,I,this,this):B=new D(z,void 0,I,this,this)),B&&this.cellCache.set(F,B)}if(B)return B;throw new Error(`Internal Error: could not construct data column for field '${F}'.`)}get value(){throw new Error("Not implemented;")}get field(){return this._field}[Symbol.iterator](){let O=!1;const F=()=>this;return{next(){return O?{value:void 0,done:!0}:(O=!0,{value:F(),done:!1})}}}}return Sd.DataRecord=D,Sd}var Ad={},Qle;function lIe(){if(Qle)return Ad;Qle=1,Object.defineProperty(Ad,"__esModule",{value:!0}),Ad.CSVWriter=Ad.JSONWriter=Ad.DataWriter=void 0;const e=vi();class t{constructor(s){this.stream=s}}Ad.DataWriter=t;class n extends t{async process(s){this.stream.write(`[
|
|
1364
1364
|
`);for await(const o of s){o.index!==void 0&&o.index>0&&this.stream.write(`,
|
|
1365
1365
|
`);const u=JSON.stringify(o.toJSON(),null,2).split(`
|
|
@@ -1367,7 +1367,7 @@ ${de}`:V=de}return V}childRequest(V){var ne;const ae=decodeURI(new URL(V,this.so
|
|
|
1367
1367
|
`)}}this.stream.write(`
|
|
1368
1368
|
]
|
|
1369
1369
|
`),this.stream.close()}}Ad.JSONWriter=n;class r extends t{constructor(){super(...arguments),this.columnSeparator=",",this.rowSeparator=`
|
|
1370
|
-
`,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(s){const o=s.includes(this.quoteCharacter),a=s.includes(this.columnSeparator),u=s.includes(this.rowSeparator),c=a||o||u;return o&&(s=s.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),c&&(s=this.quoteCharacter+s+this.quoteCharacter),s}stringify(s){return s===null?this.emptyCell:s instanceof Date?s.toISOString():typeof s=="boolean"||typeof s=="number"?JSON.stringify(s):typeof s=="bigint"?s.toString():`${s}`}getColWeight(s){let o=s;Array.isArray(s)&&(o=s[0]);let a=0;for(const u in o){a=a+1;const c=o[u];if((0,e.isCompoundArrayData)(c)){const l=this.getColWeight(c)-1;a=a+l}}return a}getHeaderRow(s){const o=[];let a=0;for(const u in s){o.push(this.escape(u));const c=s[u];if(a++,(0,e.isCompoundArrayData)(c)){const l=this.getColWeight(c)-1;a=a+l;for(let f=0;f<l;f++)o.push(this.emptyCell)}}return{rows:[o.join(this.columnSeparator)],length:1,width:a}}mergeMatrices(s){const o=Math.max(...s.map(c=>c.length)),a=s.reduce((c,l)=>c+l.width,0),u=[];for(let c=0;c<o;c++){const l=[];for(const f of s)if(c<f.length)l.push(f.rows[c]);else{const d=Array(f.width).fill(this.emptyCell);l.push(...d)}u.push(l.join(this.columnSeparator))}return{rows:u,length:o,width:a}}getChildMatrix(s){if(Array.isArray(s)){if(s.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const o=[],a=this.getHeaderRow(s[0]);o.push(...a.rows);const u=a.width;let c=1;for(const l of s){const f=this.getRowMatrix(l);c=c+f.length,o.push(...f.rows)}return{rows:o,length:c,width:u}}getRowMatrix(s){const o=[];for(const a in s){const u=s[a];if((0,e.isCompoundArrayData)(u)){const c=this.getChildMatrix(u);o.push(c)}else{const c={rows:[this.stringify(u)],length:1,width:1};o.push(c)}}return this.mergeMatrices(o)}async process(s){let o=!1;for await(const a of s){if(!o&&this.includeHeader){const c=this.getHeaderRow(a.toObject());this.stream.write(c.rows[0]),this.stream.write(this.rowSeparator),o=!0}const u=this.getRowMatrix(a.toObject());for(const c of u.rows)this.stream.write(c),this.stream.write(this.rowSeparator)}this.stream.close()}}return Ad.CSVWriter=r,Ad}var os={},xx={},GR={},_a={},Vle;function jA(){if(Vle)return _a;Vle=1,Object.defineProperty(_a,"__esModule",{value:!0}),_a.isConnectionConfigEntry=e,_a.registerConnectionType=n,_a.getConnectionProperties=r,_a.getConnectionTypeDisplayName=i,_a.getRegisteredConnectionTypes=s,_a.getConnectionTypeDef=o,_a.validateConnectionConfigProperties=a,_a.readConnectionsConfig=u,_a.writeConnectionsConfig=c,_a.createConnectionsFromConfig=l;function e(f){return typeof f=="object"&&f!==null&&typeof f.is=="string"}const t=new Map;function n(f,d){t.set(f,d)}function r(f){var d;return(d=t.get(f))===null||d===void 0?void 0:d.properties}function i(f){var d;return(d=t.get(f))===null||d===void 0?void 0:d.displayName}function s(){return[...t.keys()]}function o(f){return t.get(f)}function a(f,d,p){var x,m;const g=(m=(x=t.get(d))===null||x===void 0?void 0:x.properties)!==null&&m!==void 0?m:[];for(const y of g){if(!y.requireLiteralString)continue;const E=p[y.name];if(E!==void 0&&typeof E!="string")throw new Error(`Connection "${f}" property "${y.name}" must be a literal string`)}}function u(f){var d;const p=JSON.parse(f),x=Object.fromEntries(Object.entries((d=p.connections)!==null&&d!==void 0?d:{}).filter(([,m])=>e(m)));return{...p,connections:x}}function c(f){return JSON.stringify(f,null,2)}function l(f,d){const p=Object.entries(f.connections),x=p.length>0?p[0][0]:void 0,m=new Map;return{async lookupConnection(g){if(g===void 0&&(g=x),g===void 0)throw new Error("No connections defined in config");const y=m.get(g);if(y)return y;const E=f.connections[g];if(!E)throw new Error(`No connection named "${g}" found in config`);const v=t.get(E.is);if(!v)throw new Error(`No registered connection type "${E.is}" for connection "${g}". Did you forget to import the connection package?`);const _={name:g};for(const[C,S]of Object.entries(E))C!=="is"&&S!=null&&(_[C]=S);a(g,E.is,_);const A=await v.factory(_);return d&&d(g,A),m.set(g,A),A},async close(){const g=[...m.values()];m.clear();for(const y of g)await y.close()},async idle(){for(const g of m.values())await g.idle()}}}return _a}var Gle;function cIe(){if(Gle)return GR;Gle=1,Object.defineProperty(GR,"__esModule",{value:!0}),GR.compileConfig=i;const e=jA(),t=hZ(),n={connections:s,manifestPath:u,givensPath:c,finalizeGivens:l,virtualMap:f,includeDefaultConnections:d},r=new Set(Object.keys(n));function i(E){const v=[],_={kind:"dict",entries:{}};if(!x(E))return v.push({message:"config is not a JSON object",severity:"error",code:"config-validation"}),{compiled:_,log:v};for(const[A,C]of Object.entries(E)){const S=n[A];if(!S){const D=(0,t.closestMatch)(A,[...r]),R=D?`. Did you mean "${D}"?`:"";v.push(m(A,`unknown config key "${A}"${R}`));continue}const T=S(C,v);T!==void 0&&(_.entries[A]=T)}return{compiled:_,log:v}}function s(E,v){if(!x(E)){v.push(m("connections",'"connections" should be an object'));return}const _=new Set((0,e.getRegisteredConnectionTypes)()),A={kind:"dict",entries:{}};for(const[C,S]of Object.entries(E)){const T=`connections.${C}`;if(!x(S)){v.push(m(T,"should be an object"));continue}const D=S.is;if(D==null||D===""){v.push(m(T,'missing required "is" field (connection type)'));continue}if(typeof D!="string"){v.push(m(`${T}.is`,'"is" should be a string'));continue}if(!_.has(D)){const O=(0,t.closestMatch)(D,[..._]),F=O?` Did you mean "${O}"?`:"";v.push(m(`${T}.is`,`unknown connection type "${D}".${F} Available types: ${[..._].join(", ")}`));continue}const R=o(T,D,S,v);A.entries[C]=R}return A}function o(E,v,_,A){var C;const S=(C=(0,e.getConnectionProperties)(v))!==null&&C!==void 0?C:[],T=new Map(S.map(R=>[R.name,R])),D={kind:"dict",entries:{}};D.entries.is={kind:"value",value:v};for(const[R,O]of Object.entries(_)){if(R==="is")continue;const F=T.get(R);if(!F){const B=(0,t.closestMatch)(R,[...T.keys()]),z=B?`. Did you mean "${B}"?`:"";A.push(m(`${E}.${R}`,`unknown property "${R}" for connection type "${v}"${z}`));continue}const I=a(`${E}.${R}`,F,O,A);I!==void 0&&(D.entries[R]=I)}return D}function a(E,v,_,A){if(_==null)return;if(v.type==="json")return{kind:"value",value:_};const C=p(_);if(C!==void 0)return v.requireLiteralString?(A.push(m(E,"must be a literal string and cannot use an overlay reference")),{kind:"value",value:_}):C;const S=y(_,v.type);if(S){if(v.requireLiteralString)return A.push(m(E,`must be a literal string, got ${g(_)}`)),{kind:"value",value:_};A.push(m(E,`${S} (expected ${v.type})`));return}return{kind:"value",value:_}}function u(E,v){const _=p(E);if(_!==void 0)return _;if(typeof E!="string"){v.push(m("manifestPath",'"manifestPath" should be a string or an overlay reference'));return}return{kind:"value",value:E}}function c(E,v){const _=p(E);if(_!==void 0)return _;if(typeof E!="string"){v.push(m("givensPath",'"givensPath" should be a string or an overlay reference'));return}return{kind:"value",value:E}}function l(E,v){if(!Array.isArray(E)||!E.every(_=>typeof _=="string")){v.push(m("finalizeGivens",'"finalizeGivens" should be an array of given names'));return}return{kind:"value",value:E}}function f(E,v){return{kind:"value",value:E}}function d(E,v){return{kind:"value",value:E}}function p(E){if(typeof E!="object"||E===null||Array.isArray(E))return;const v=Object.keys(E);if(v.length!==1)return;const _=v[0],A=E[_];if(typeof A=="string")return{kind:"reference",source:_,path:[A]};if(Array.isArray(A)&&A.every(C=>typeof C=="string"))return{kind:"reference",source:_,path:A}}function x(E){return typeof E=="object"&&E!==null&&!Array.isArray(E)}function m(E,v){return{message:`${E}: ${v}`,severity:"warn",code:"config-validation"}}function g(E){return Array.isArray(E)?"array":typeof E}function y(E,v){switch(v){case"number":if(typeof E!="number")return`should be a number, got ${typeof E}`;break;case"boolean":if(typeof E!="boolean")return`should be a boolean, got ${typeof E}`;break;case"string":case"password":case"secret":case"file":case"text":if(typeof E!="string")return`should be a string, got ${typeof E}`;break}}return GR}var WR={},U1={},Wle;function fk(){if(Wle)return U1;Wle=1;var e={};Object.defineProperty(U1,"__esModule",{value:!0}),U1.envOverlay=t,U1.contextOverlay=n,U1.defaultConfigOverlays=r,U1.isThenable=i;function t(){return typeof process>"u"||!e?()=>{}:s=>e[s[0]]}function n(s){return o=>s[o[0]]}function r(){return{env:t(),config:()=>{}}}function i(s){return typeof s=="object"&&s!==null&&"then"in s&&typeof s.then=="function"}return U1}var Yle;function fIe(){if(Yle)return WR;Yle=1,Object.defineProperty(WR,"__esModule",{value:!0}),WR.prepareConfig=n;const e=jA(),t=fk();function n(a,u,c){let l={},f,d,p,x,m=!1;for(const[g,y]of Object.entries(a.entries))switch(g){case"connections":{if(y.kind!=="dict")break;l=i(y);break}case"manifestPath":{f=o(y,u,c,"manifestPath");break}case"givensPath":{d=o(y,u,c,"givensPath");break}case"finalizeGivens":{y.kind==="value"&&r(y.value)&&(p=y.value);break}case"virtualMap":{y.kind==="value"&&(x=y.value);break}case"includeDefaultConnections":{y.kind==="value"&&typeof y.value=="boolean"&&(m=y.value);break}}return m&&s(l),{compiledConnections:l,manifestPath:f,givensPath:d,finalizeGivens:p,virtualMap:x}}function r(a){return Array.isArray(a)&&a.every(u=>typeof u=="string")}function i(a){const u={};for(const[c,l]of Object.entries(a.entries))l.kind==="dict"&&(u[c]=l);return u}function s(a){for(const u of(0,e.getRegisteredConnectionTypes)())a[u]||(a[u]={kind:"dict",entries:{is:{kind:"value",value:u}}})}function o(a,u,c,l){if(a.kind==="value")return typeof a.value=="string"?a.value:void 0;if(a.kind==="reference"){const f=u[a.source];if(!f){c.push({message:`unknown overlay source "${a.source}" for "${l}"`,severity:"warn",code:"config-overlay"});return}const d=f(a.path);if((0,t.isThenable)(d)){c.push({message:`the \`${a.source}\` overlay returned a Promise for "${l}"; top-level string settings must resolve synchronously`,severity:"warn",code:"config-overlay"});return}return typeof d=="string"?d:void 0}}return WR}var YR={},Kle;function dIe(){if(Kle)return YR;Kle=1,Object.defineProperty(YR,"__esModule",{value:!0}),YR.buildManagedLookup=t;const e=jA();function t(a,u,c){const l=Object.entries(a),f=l.length>0?l[0][0]:void 0,d=new Map;return{async lookupConnection(p){if(p===void 0&&(p=f),p===void 0)throw new Error("No connections defined in config");const x=d.get(p);if(x)return x;const m=a[p];if(!m)throw new Error(`No connection named "${p}" found in config`);const g=await n(m,u,c);if(typeof g.is!="string")throw new Error(`Connection "${p}" is missing a valid "is" field`);const y=(0,e.getConnectionTypeDef)(g.is);if(!y)throw new Error(`No registered connection type "${g.is}" for connection "${p}". Did you forget to import the connection package?`);const E={name:p};for(const[_,A]of Object.entries(g))_!=="is"&&A!=null&&(E[_]=A);(0,e.validateConnectionConfigProperties)(p,g.is,E);const v=await y.factory(E);return d.set(p,v),v},async close(){const p=[...d.values()];d.clear();for(const x of p)await x.close()},async idle(){for(const p of d.values())await p.idle()}}}async function n(a,u,c){const l=await r(a,u,c);if(!(0,e.isConnectionConfigEntry)(l))throw new Error("Connection entry did not resolve to a valid {is: string, ...} dict");return await s(l,u),l}async function r(a,u,c){switch(a.kind){case"value":return a.value;case"reference":return i(a,u,c);case"dict":{const l={};for(const[f,d]of Object.entries(a.entries)){const p=await r(d,u,c);p!==void 0&&(l[f]=p)}return l}}}async function i(a,u,c){const l=u[a.source];if(!l){c.push({message:`unknown overlay source "${a.source}" for reference path ${JSON.stringify(a.path)}`,severity:"warn",code:"config-overlay"});return}return await l(a.path)}async function s(a,u){var c;const l=a.is;if(typeof l!="string")return;const f=(c=(0,e.getConnectionProperties)(l))!==null&&c!==void 0?c:[];for(const d of f){if(d.default===void 0||a[d.name]!==void 0)continue;const p=await o(d.default,u);p!==void 0&&(a[d.name]=p)}}async function o(a,u){if(typeof a!="object")return a;const c=Object.keys(a);if(c.length!==1)return;const l=c[0],f=a[l],d=typeof f=="string"?[f]:f;if(!Array.isArray(d))return;const p=u[l];if(p)return await p(d)}return YR}var Xle;function dk(){if(Xle)return xx;Xle=1,Object.defineProperty(xx,"__esModule",{value:!0}),xx.MalloyConfig=xx.Manifest=void 0,xx.isBuildManifestEntry=E;const e=cIe(),t=fIe(),n=dIe(),r=fk(),i=uk();class s{constructor(){this._manifest={entries:{},strict:!1},this._touched=new Set}loadText(_){this._clearEntries(),this._touched.clear(),this._manifest.strict=!1,this._loadParsed(JSON.parse(_))}get buildManifest(){return this._manifest}get strict(){var _;return(_=this._manifest.strict)!==null&&_!==void 0?_:!1}set strict(_){this._manifest.strict=_}update(_,A){(0,i.requireCanonicalTablePathAnyDialect)(A.tableName,`Manifest entry '${_}'`),this._manifest.entries[_]=A,this._touched.add(_)}touch(_){this._touched.add(_)}get activeEntries(){const _={};for(const A of this._touched)this._manifest.entries[A]&&(_[A]=this._manifest.entries[A]);return{entries:_,strict:this._manifest.strict}}_clearEntries(){for(const _ of Object.keys(this._manifest.entries))delete this._manifest.entries[_]}_loadParsed(_){typeof _.strict=="boolean"&&(this._manifest.strict=_.strict);const A=y(_.entries)?_.entries:_;for(const[C,S]of Object.entries(A))C==="strict"||!E(S)||((0,i.requireCanonicalTablePathAnyDialect)(S.tableName,`Manifest entry '${C}'`),this._manifest.entries[C]=S)}}xx.Manifest=s;class o{constructor(_,A){const C=[];let S;if(typeof _=="string")try{S=JSON.parse(_)}catch(B){C.push({message:`Invalid JSON: ${B instanceof Error?B.message:String(B)}`,severity:"error",code:"config-validation"}),S={}}else S=_;const T=(0,e.compileConfig)(S);C.push(...T.log);const D=f(A,C),R=m(D.configURL,"configURL",C),O=D.rootDirectory,F={...(0,r.defaultConfigOverlays)(),...D.overlays,config:(0,r.contextOverlay)({configURL:R,rootDirectory:O})},I=(0,t.prepareConfig)(T.compiled,F,C);this._managedLookup=(0,n.buildManagedLookup)(I.compiledConnections,F,C),this._connections=this._managedLookup,this._overlays=F,this.virtualMap=g(I.virtualMap,C),this.configURL=R,this.rootDirectory=O,this.manifestPath=I.manifestPath,this.manifestURL=c(I.manifestPath,R),this.givensPath=I.givensPath,this.givensURL=l(I.givensPath,R,C),this.finalizeGivens=I.finalizeGivens,this.log=C}get connections(){return this._connections}wrapConnections(_){this._connections=_(this._connections)}async shutdown(_="close"){_==="idle"?await this._managedLookup.idle():await this._managedLookup.close()}async releaseConnections(){await this.shutdown("close")}async readOverlay(_,...A){var C,S;return await((S=(C=this._overlays)[_])===null||S===void 0?void 0:S.call(C,A))}}xx.MalloyConfig=o;const a="MANIFESTS",u="malloy-manifest.json";function c(v,_){if(!_)return;let A;try{A=new URL(_)}catch{return}const C=v??a;let S;try{S=new URL(C,A)}catch{return}const T=S.toString(),D=T.endsWith("/")?S:new URL(T+"/");return new URL(u,D).toString()}function l(v,_,A){if(!v)return;if(!_){A.push({message:"givensPath is set but no configURL is available; per-runtime givens will not be loaded. Pass `configURL` (or use an absolute URL such as `file:///...`).",severity:"warn",code:"config-overlay"});return}let C;try{C=new URL(_)}catch{return}try{return new URL(v,C).toString()}catch(S){const T=S instanceof Error?S.message:String(S);A.push({message:`givensPath '${v}' could not be resolved against configURL '${_}': ${T}`,severity:"warn",code:"config-validation"});return}}function f(v,_){if(v===void 0)return{};if(d(v))return p(v,_);const A=v;if(A.overlays&&"config"in A.overlays){_.push({message:"`config` is reserved by MalloyConfig; pass `configURL` and `rootDirectory` directly instead. Supplied `overlays.config` ignored.",severity:"warn",code:"config-overlay"});const{config:C,...S}=A.overlays;return{...A,overlays:S}}return A}function d(v){for(const _ of Object.values(v))if(typeof _=="function")return!0;return!1}function p(v,_){const A=v.config;if(!A)return{overlays:v};const C=x(A,"configURL",_),S=x(A,"rootDirectory",_),{config:T,...D}=v;return{configURL:C,rootDirectory:S,overlays:D}}function x(v,_,A){const C=v([_]);if((0,r.isThenable)(C)){A.push({message:`the legacy \`config\` overlay returned a Promise for \`${_}\`; top-level FS context must resolve synchronously. ${_} will be undefined.`,severity:"warn",code:"config-overlay"});return}return typeof C=="string"?C:void 0}function m(v,_,A){if(v!==void 0)try{return new URL(v),v}catch{A.push({message:`${_} must be a URL-shaped string (e.g. 'file:///path/to/...'), got '${v}'. In Node, use \`url.pathToFileURL(path).toString()\`.`,severity:"warn",code:"config-validation"});return}}function g(v,_){if(!y(v))return;const A=new Map;for(const[C,S]of Object.entries(v)){if(!y(S))continue;const T=new Map;for(const[D,R]of Object.entries(S)){if(typeof R!="string")continue;const O=(0,i.validateCanonicalTablePathAnyDialect)(R);if(O!==void 0){_.push({message:`virtualMap entry '${C}.${D}': ${O}`,severity:"error",code:"config-validation"});continue}T.set(D,R)}T.size>0&&A.set(C,T)}return A.size>0?A:void 0}function y(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function E(v){return y(v)&&typeof v.tableName=="string"}return xx}var j1={},zA={},Jle;function hIe(){return Jle||(Jle=1,Object.defineProperty(zA,"__esModule",{value:!0}),zA.MALLOY_VERSION=void 0,zA.MALLOY_VERSION="0.0.408"),zA}var Zle;function ece(){if(Zle)return j1;Zle=1,Object.defineProperty(j1,"__esModule",{value:!0}),j1.Malloy=j1.MalloyError=void 0;const e=lk(),t=jA(),n=vi(),r=lR(),i=hIe(),s=QR(),o=Ule(),a=Zp,u=VR(),c=Hle();function l(x="loadModel"){return`internal://${x}/${(0,a.v4)()}`}function f(x){return[...Object.keys(x),...Object.values(x).map(f).flat()]}class d extends Error{constructor(m,g=[]){super(m),this.problems=g}}j1.MalloyError=d;class p{static get version(){return i.MALLOY_VERSION}static registerConnectionType(m,g){(0,t.registerConnectionType)(m,g)}static getConnectionProperties(m){return(0,t.getConnectionProperties)(m)}static getConnectionTypeDisplayName(m){return(0,t.getConnectionTypeDisplayName)(m)}static getRegisteredConnectionTypes(){return(0,t.getRegisteredConnectionTypes)()}static _parse(m,g,y,E,v){var _;g===void 0&&(g=new URL(l(E==null?void 0:E.method)));let A=g;E!=null&&E.importBaseURL&&(A=E==null?void 0:E.importBaseURL);const C=new e.MalloyTranslator(g.toString(),A.toString(),{urls:{[g.toString()]:m}},y,(_=E==null?void 0:E.restrictedMode)!==null&&_!==void 0?_:!1);return E!=null&&E.testEnvironment&&(C.allDialectsEnabled=!0),new o.Parse(C,v)}static parse({url:m,urlReader:g,source:y,eventStream:E,options:v}){if(y!==void 0)return p._parse(y,m,E,v);if(g===void 0)throw new Error("Internal Error: urlReader is required.");if(m===void 0)throw new Error("Internal Error: url is required if source not present.");return(0,s.readURL)(g,m).then(({contents:_,invalidationKey:A})=>p._parse(_,m,E,v,A))}static async compile(m){var g,y,E,v,_;let{url:A,source:C,importBaseURL:S,cacheManager:T}=m;const{parse:D,urlReader:R,connections:O,model:F,refreshSchemaCache:I,noThrowOnError:B,eventStream:z,restrictedMode:Z,method:oe}=m;Z&&(T=void 0);let fe;if(I&&(fe=typeof I=="number"?I:Date.now()),A===void 0&&C===void 0&&D===void 0)throw new Error("Internal Error: url, source, or parse required.");A===void 0&&(D!==void 0?A=new URL(D._translator.sourceURL):A=new URL(l(oe)));const V={};if(C===void 0&&T!==void 0){const de=await T.getCachedModelDef(R,A.toString());if(de)return new u.Model(de.modelDef,[],[A.toString(),...f(de.modelDef.dependencies)])}S??(S=A);let ne;const ae=A.toString();if(D!==void 0){if(Z!==void 0&&D._translator.restrictedMode!==Z)throw new Error(`Malloy.compile: restrictedMode (${Z}) does not match the pre-parsed translator's restrictedMode (${D._translator.restrictedMode}). Set restrictedMode at parse time.`);ne=D._translator;const de=(g=D._invalidationKey)!==null&&g!==void 0?g:await(0,s.getInvalidationKey)(R,A);V[ae]=de}else{if(C===void 0){const{contents:de,invalidationKey:$}=await(0,s.readURL)(R,A);V[ae]=$,C=de}else{const de=await(0,s.getInvalidationKey)(R,A);V[ae]=de}ne=new e.MalloyTranslator(ae,S.toString(),{urls:{[ae]:C}},z,Z??!1)}for(;;){const de=ne.translate(F==null?void 0:F._modelDef);if(de.final)if(de.modelDef){await(T==null?void 0:T.setCachedModelDef(A.toString(),{modelDef:de.modelDef,invalidationKeys:V}));for(const H of ne.newlyTranslatedDependencies())await(T==null?void 0:T.setCachedModelDef(H.url,{modelDef:H.modelDef,invalidationKeys:V}));const $=!de.modelWasModified&&F?F.getExistingQueryModel():void 0;return new u.Model(de.modelDef,de.problems||[],[...(y=F==null?void 0:F.fromSources)!==null&&y!==void 0?y:[],...(E=de.fromSources)!==null&&E!==void 0?E:[]],$)}else if(B){const $=(0,n.mkModelDef)("modelDidNotCompile"),H=(F==null?void 0:F._modelDef)||$;return new u.Model(H,de.problems||[],[...(v=F==null?void 0:F.fromSources)!==null&&v!==void 0?v:[],...(_=de.fromSources)!==null&&_!==void 0?_:[]])}else{const $=de.problems||[],H=ne.prettyErrors();throw new d(`Error(s) compiling model:
|
|
1370
|
+
`,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(s){const o=s.includes(this.quoteCharacter),a=s.includes(this.columnSeparator),u=s.includes(this.rowSeparator),c=a||o||u;return o&&(s=s.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),c&&(s=this.quoteCharacter+s+this.quoteCharacter),s}stringify(s){return s===null?this.emptyCell:s instanceof Date?s.toISOString():typeof s=="boolean"||typeof s=="number"?JSON.stringify(s):typeof s=="bigint"?s.toString():`${s}`}getColWeight(s){let o=s;Array.isArray(s)&&(o=s[0]);let a=0;for(const u in o){a=a+1;const c=o[u];if((0,e.isCompoundArrayData)(c)){const l=this.getColWeight(c)-1;a=a+l}}return a}getHeaderRow(s){const o=[];let a=0;for(const u in s){o.push(this.escape(u));const c=s[u];if(a++,(0,e.isCompoundArrayData)(c)){const l=this.getColWeight(c)-1;a=a+l;for(let f=0;f<l;f++)o.push(this.emptyCell)}}return{rows:[o.join(this.columnSeparator)],length:1,width:a}}mergeMatrices(s){const o=Math.max(...s.map(c=>c.length)),a=s.reduce((c,l)=>c+l.width,0),u=[];for(let c=0;c<o;c++){const l=[];for(const f of s)if(c<f.length)l.push(f.rows[c]);else{const d=Array(f.width).fill(this.emptyCell);l.push(...d)}u.push(l.join(this.columnSeparator))}return{rows:u,length:o,width:a}}getChildMatrix(s){if(Array.isArray(s)){if(s.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const o=[],a=this.getHeaderRow(s[0]);o.push(...a.rows);const u=a.width;let c=1;for(const l of s){const f=this.getRowMatrix(l);c=c+f.length,o.push(...f.rows)}return{rows:o,length:c,width:u}}getRowMatrix(s){const o=[];for(const a in s){const u=s[a];if((0,e.isCompoundArrayData)(u)){const c=this.getChildMatrix(u);o.push(c)}else{const c={rows:[this.stringify(u)],length:1,width:1};o.push(c)}}return this.mergeMatrices(o)}async process(s){let o=!1;for await(const a of s){if(!o&&this.includeHeader){const c=this.getHeaderRow(a.toObject());this.stream.write(c.rows[0]),this.stream.write(this.rowSeparator),o=!0}const u=this.getRowMatrix(a.toObject());for(const c of u.rows)this.stream.write(c),this.stream.write(this.rowSeparator)}this.stream.close()}}return Ad.CSVWriter=r,Ad}var os={},xx={},GR={},_a={},Vle;function jA(){if(Vle)return _a;Vle=1,Object.defineProperty(_a,"__esModule",{value:!0}),_a.isConnectionConfigEntry=e,_a.registerConnectionType=n,_a.getConnectionProperties=r,_a.getConnectionTypeDisplayName=i,_a.getRegisteredConnectionTypes=s,_a.getConnectionTypeDef=o,_a.validateConnectionConfigProperties=a,_a.readConnectionsConfig=u,_a.writeConnectionsConfig=c,_a.createConnectionsFromConfig=l;function e(f){return typeof f=="object"&&f!==null&&typeof f.is=="string"}const t=new Map;function n(f,d){t.set(f,d)}function r(f){var d;return(d=t.get(f))===null||d===void 0?void 0:d.properties}function i(f){var d;return(d=t.get(f))===null||d===void 0?void 0:d.displayName}function s(){return[...t.keys()]}function o(f){return t.get(f)}function a(f,d,p){var x,m;const g=(m=(x=t.get(d))===null||x===void 0?void 0:x.properties)!==null&&m!==void 0?m:[];for(const y of g){if(!y.requireLiteralString)continue;const E=p[y.name];if(E!==void 0&&typeof E!="string")throw new Error(`Connection "${f}" property "${y.name}" must be a literal string`)}}function u(f){var d;const p=JSON.parse(f),x=Object.fromEntries(Object.entries((d=p.connections)!==null&&d!==void 0?d:{}).filter(([,m])=>e(m)));return{...p,connections:x}}function c(f){return JSON.stringify(f,null,2)}function l(f,d){const p=Object.entries(f.connections),x=p.length>0?p[0][0]:void 0,m=new Map;return{async lookupConnection(g){if(g===void 0&&(g=x),g===void 0)throw new Error("No connections defined in config");const y=m.get(g);if(y)return y;const E=f.connections[g];if(!E)throw new Error(`No connection named "${g}" found in config`);const v=t.get(E.is);if(!v)throw new Error(`No registered connection type "${E.is}" for connection "${g}". Did you forget to import the connection package?`);const _={name:g};for(const[C,S]of Object.entries(E))C!=="is"&&S!=null&&(_[C]=S);a(g,E.is,_);const A=await v.factory(_);return d&&d(g,A),m.set(g,A),A},async close(){const g=[...m.values()];m.clear();for(const y of g)await y.close()},async idle(){for(const g of m.values())await g.idle()}}}return _a}var Gle;function cIe(){if(Gle)return GR;Gle=1,Object.defineProperty(GR,"__esModule",{value:!0}),GR.compileConfig=i;const e=jA(),t=hZ(),n={connections:s,manifestPath:u,givensPath:c,finalizeGivens:l,virtualMap:f,includeDefaultConnections:d},r=new Set(Object.keys(n));function i(E){const v=[],_={kind:"dict",entries:{}};if(!x(E))return v.push({message:"config is not a JSON object",severity:"error",code:"config-validation"}),{compiled:_,log:v};for(const[A,C]of Object.entries(E)){const S=n[A];if(!S){const D=(0,t.closestMatch)(A,[...r]),R=D?`. Did you mean "${D}"?`:"";v.push(m(A,`unknown config key "${A}"${R}`));continue}const T=S(C,v);T!==void 0&&(_.entries[A]=T)}return{compiled:_,log:v}}function s(E,v){if(!x(E)){v.push(m("connections",'"connections" should be an object'));return}const _=new Set((0,e.getRegisteredConnectionTypes)()),A={kind:"dict",entries:{}};for(const[C,S]of Object.entries(E)){const T=`connections.${C}`;if(!x(S)){v.push(m(T,"should be an object"));continue}const D=S.is;if(D==null||D===""){v.push(m(T,'missing required "is" field (connection type)'));continue}if(typeof D!="string"){v.push(m(`${T}.is`,'"is" should be a string'));continue}if(!_.has(D)){const O=(0,t.closestMatch)(D,[..._]),F=O?` Did you mean "${O}"?`:"";v.push(m(`${T}.is`,`unknown connection type "${D}".${F} Available types: ${[..._].join(", ")}`));continue}const R=o(T,D,S,v);A.entries[C]=R}return A}function o(E,v,_,A){var C;const S=(C=(0,e.getConnectionProperties)(v))!==null&&C!==void 0?C:[],T=new Map(S.map(R=>[R.name,R])),D={kind:"dict",entries:{}};D.entries.is={kind:"value",value:v};for(const[R,O]of Object.entries(_)){if(R==="is")continue;const F=T.get(R);if(!F){const B=(0,t.closestMatch)(R,[...T.keys()]),z=B?`. Did you mean "${B}"?`:"";A.push(m(`${E}.${R}`,`unknown property "${R}" for connection type "${v}"${z}`));continue}const I=a(`${E}.${R}`,F,O,A);I!==void 0&&(D.entries[R]=I)}return D}function a(E,v,_,A){if(_==null)return;if(v.type==="json")return{kind:"value",value:_};const C=p(_);if(C!==void 0)return v.requireLiteralString?(A.push(m(E,"must be a literal string and cannot use an overlay reference")),{kind:"value",value:_}):C;const S=y(_,v.type);if(S){if(v.requireLiteralString)return A.push(m(E,`must be a literal string, got ${g(_)}`)),{kind:"value",value:_};A.push(m(E,`${S} (expected ${v.type})`));return}return{kind:"value",value:_}}function u(E,v){const _=p(E);if(_!==void 0)return _;if(typeof E!="string"){v.push(m("manifestPath",'"manifestPath" should be a string or an overlay reference'));return}return{kind:"value",value:E}}function c(E,v){const _=p(E);if(_!==void 0)return _;if(typeof E!="string"){v.push(m("givensPath",'"givensPath" should be a string or an overlay reference'));return}return{kind:"value",value:E}}function l(E,v){if(!Array.isArray(E)||!E.every(_=>typeof _=="string")){v.push(m("finalizeGivens",'"finalizeGivens" should be an array of given names'));return}return{kind:"value",value:E}}function f(E,v){return{kind:"value",value:E}}function d(E,v){return{kind:"value",value:E}}function p(E){if(typeof E!="object"||E===null||Array.isArray(E))return;const v=Object.keys(E);if(v.length!==1)return;const _=v[0],A=E[_];if(typeof A=="string")return{kind:"reference",source:_,path:[A]};if(Array.isArray(A)&&A.every(C=>typeof C=="string"))return{kind:"reference",source:_,path:A}}function x(E){return typeof E=="object"&&E!==null&&!Array.isArray(E)}function m(E,v){return{message:`${E}: ${v}`,severity:"warn",code:"config-validation"}}function g(E){return Array.isArray(E)?"array":typeof E}function y(E,v){switch(v){case"number":if(typeof E!="number")return`should be a number, got ${typeof E}`;break;case"boolean":if(typeof E!="boolean")return`should be a boolean, got ${typeof E}`;break;case"string":case"password":case"secret":case"file":case"text":if(typeof E!="string")return`should be a string, got ${typeof E}`;break}}return GR}var WR={},U1={},Wle;function fk(){if(Wle)return U1;Wle=1;var e={};Object.defineProperty(U1,"__esModule",{value:!0}),U1.envOverlay=t,U1.contextOverlay=n,U1.defaultConfigOverlays=r,U1.isThenable=i;function t(){return typeof process>"u"||!e?()=>{}:s=>e[s[0]]}function n(s){return o=>s[o[0]]}function r(){return{env:t(),config:()=>{}}}function i(s){return typeof s=="object"&&s!==null&&"then"in s&&typeof s.then=="function"}return U1}var Yle;function fIe(){if(Yle)return WR;Yle=1,Object.defineProperty(WR,"__esModule",{value:!0}),WR.prepareConfig=n;const e=jA(),t=fk();function n(a,u,c){let l={},f,d,p,x,m=!1;for(const[g,y]of Object.entries(a.entries))switch(g){case"connections":{if(y.kind!=="dict")break;l=i(y);break}case"manifestPath":{f=o(y,u,c,"manifestPath");break}case"givensPath":{d=o(y,u,c,"givensPath");break}case"finalizeGivens":{y.kind==="value"&&r(y.value)&&(p=y.value);break}case"virtualMap":{y.kind==="value"&&(x=y.value);break}case"includeDefaultConnections":{y.kind==="value"&&typeof y.value=="boolean"&&(m=y.value);break}}return m&&s(l),{compiledConnections:l,manifestPath:f,givensPath:d,finalizeGivens:p,virtualMap:x}}function r(a){return Array.isArray(a)&&a.every(u=>typeof u=="string")}function i(a){const u={};for(const[c,l]of Object.entries(a.entries))l.kind==="dict"&&(u[c]=l);return u}function s(a){for(const u of(0,e.getRegisteredConnectionTypes)())a[u]||(a[u]={kind:"dict",entries:{is:{kind:"value",value:u}}})}function o(a,u,c,l){if(a.kind==="value")return typeof a.value=="string"?a.value:void 0;if(a.kind==="reference"){const f=u[a.source];if(!f){c.push({message:`unknown overlay source "${a.source}" for "${l}"`,severity:"warn",code:"config-overlay"});return}const d=f(a.path);if((0,t.isThenable)(d)){c.push({message:`the \`${a.source}\` overlay returned a Promise for "${l}"; top-level string settings must resolve synchronously`,severity:"warn",code:"config-overlay"});return}return typeof d=="string"?d:void 0}}return WR}var YR={},Kle;function dIe(){if(Kle)return YR;Kle=1,Object.defineProperty(YR,"__esModule",{value:!0}),YR.buildManagedLookup=t;const e=jA();function t(a,u,c){const l=Object.entries(a),f=l.length>0?l[0][0]:void 0,d=new Map;return{async lookupConnection(p){if(p===void 0&&(p=f),p===void 0)throw new Error("No connections defined in config");const x=d.get(p);if(x)return x;const m=a[p];if(!m)throw new Error(`No connection named "${p}" found in config`);const g=await n(m,u,c);if(typeof g.is!="string")throw new Error(`Connection "${p}" is missing a valid "is" field`);const y=(0,e.getConnectionTypeDef)(g.is);if(!y)throw new Error(`No registered connection type "${g.is}" for connection "${p}". Did you forget to import the connection package?`);const E={name:p};for(const[_,A]of Object.entries(g))_!=="is"&&A!=null&&(E[_]=A);(0,e.validateConnectionConfigProperties)(p,g.is,E);const v=await y.factory(E);return d.set(p,v),v},async close(){const p=[...d.values()];d.clear();for(const x of p)await x.close()},async idle(){for(const p of d.values())await p.idle()}}}async function n(a,u,c){const l=await r(a,u,c);if(!(0,e.isConnectionConfigEntry)(l))throw new Error("Connection entry did not resolve to a valid {is: string, ...} dict");return await s(l,u),l}async function r(a,u,c){switch(a.kind){case"value":return a.value;case"reference":return i(a,u,c);case"dict":{const l={};for(const[f,d]of Object.entries(a.entries)){const p=await r(d,u,c);p!==void 0&&(l[f]=p)}return l}}}async function i(a,u,c){const l=u[a.source];if(!l){c.push({message:`unknown overlay source "${a.source}" for reference path ${JSON.stringify(a.path)}`,severity:"warn",code:"config-overlay"});return}return await l(a.path)}async function s(a,u){var c;const l=a.is;if(typeof l!="string")return;const f=(c=(0,e.getConnectionProperties)(l))!==null&&c!==void 0?c:[];for(const d of f){if(d.default===void 0||a[d.name]!==void 0)continue;const p=await o(d.default,u);p!==void 0&&(a[d.name]=p)}}async function o(a,u){if(typeof a!="object")return a;const c=Object.keys(a);if(c.length!==1)return;const l=c[0],f=a[l],d=typeof f=="string"?[f]:f;if(!Array.isArray(d))return;const p=u[l];if(p)return await p(d)}return YR}var Xle;function dk(){if(Xle)return xx;Xle=1,Object.defineProperty(xx,"__esModule",{value:!0}),xx.MalloyConfig=xx.Manifest=void 0,xx.isBuildManifestEntry=E;const e=cIe(),t=fIe(),n=dIe(),r=fk(),i=uk();class s{constructor(){this._manifest={entries:{},strict:!1},this._touched=new Set}loadText(_){this._clearEntries(),this._touched.clear(),this._manifest.strict=!1,this._loadParsed(JSON.parse(_))}get buildManifest(){return this._manifest}get strict(){var _;return(_=this._manifest.strict)!==null&&_!==void 0?_:!1}set strict(_){this._manifest.strict=_}update(_,A){(0,i.requireCanonicalTablePathAnyDialect)(A.tableName,`Manifest entry '${_}'`),this._manifest.entries[_]=A,this._touched.add(_)}touch(_){this._touched.add(_)}get activeEntries(){const _={};for(const A of this._touched)this._manifest.entries[A]&&(_[A]=this._manifest.entries[A]);return{entries:_,strict:this._manifest.strict}}_clearEntries(){for(const _ of Object.keys(this._manifest.entries))delete this._manifest.entries[_]}_loadParsed(_){typeof _.strict=="boolean"&&(this._manifest.strict=_.strict);const A=y(_.entries)?_.entries:_;for(const[C,S]of Object.entries(A))C==="strict"||!E(S)||((0,i.requireCanonicalTablePathAnyDialect)(S.tableName,`Manifest entry '${C}'`),this._manifest.entries[C]=S)}}xx.Manifest=s;class o{constructor(_,A){const C=[];let S;if(typeof _=="string")try{S=JSON.parse(_)}catch(B){C.push({message:`Invalid JSON: ${B instanceof Error?B.message:String(B)}`,severity:"error",code:"config-validation"}),S={}}else S=_;const T=(0,e.compileConfig)(S);C.push(...T.log);const D=f(A,C),R=m(D.configURL,"configURL",C),O=D.rootDirectory,F={...(0,r.defaultConfigOverlays)(),...D.overlays,config:(0,r.contextOverlay)({configURL:R,rootDirectory:O})},I=(0,t.prepareConfig)(T.compiled,F,C);this._managedLookup=(0,n.buildManagedLookup)(I.compiledConnections,F,C),this._connections=this._managedLookup,this._overlays=F,this.virtualMap=g(I.virtualMap,C),this.configURL=R,this.rootDirectory=O,this.manifestPath=I.manifestPath,this.manifestURL=c(I.manifestPath,R),this.givensPath=I.givensPath,this.givensURL=l(I.givensPath,R,C),this.finalizeGivens=I.finalizeGivens,this.log=C}get connections(){return this._connections}wrapConnections(_){this._connections=_(this._connections)}async shutdown(_="close"){_==="idle"?await this._managedLookup.idle():await this._managedLookup.close()}async releaseConnections(){await this.shutdown("close")}async readOverlay(_,...A){var C,S;return await((S=(C=this._overlays)[_])===null||S===void 0?void 0:S.call(C,A))}}xx.MalloyConfig=o;const a="MANIFESTS",u="malloy-manifest.json";function c(v,_){if(!_)return;let A;try{A=new URL(_)}catch{return}const C=v??a;let S;try{S=new URL(C,A)}catch{return}const T=S.toString(),D=T.endsWith("/")?S:new URL(T+"/");return new URL(u,D).toString()}function l(v,_,A){if(!v)return;if(!_){A.push({message:"givensPath is set but no configURL is available; per-runtime givens will not be loaded. Pass `configURL` (or use an absolute URL such as `file:///...`).",severity:"warn",code:"config-overlay"});return}let C;try{C=new URL(_)}catch{return}try{return new URL(v,C).toString()}catch(S){const T=S instanceof Error?S.message:String(S);A.push({message:`givensPath '${v}' could not be resolved against configURL '${_}': ${T}`,severity:"warn",code:"config-validation"});return}}function f(v,_){if(v===void 0)return{};if(d(v))return p(v,_);const A=v;if(A.overlays&&"config"in A.overlays){_.push({message:"`config` is reserved by MalloyConfig; pass `configURL` and `rootDirectory` directly instead. Supplied `overlays.config` ignored.",severity:"warn",code:"config-overlay"});const{config:C,...S}=A.overlays;return{...A,overlays:S}}return A}function d(v){for(const _ of Object.values(v))if(typeof _=="function")return!0;return!1}function p(v,_){const A=v.config;if(!A)return{overlays:v};const C=x(A,"configURL",_),S=x(A,"rootDirectory",_),{config:T,...D}=v;return{configURL:C,rootDirectory:S,overlays:D}}function x(v,_,A){const C=v([_]);if((0,r.isThenable)(C)){A.push({message:`the legacy \`config\` overlay returned a Promise for \`${_}\`; top-level FS context must resolve synchronously. ${_} will be undefined.`,severity:"warn",code:"config-overlay"});return}return typeof C=="string"?C:void 0}function m(v,_,A){if(v!==void 0)try{return new URL(v),v}catch{A.push({message:`${_} must be a URL-shaped string (e.g. 'file:///path/to/...'), got '${v}'. In Node, use \`url.pathToFileURL(path).toString()\`.`,severity:"warn",code:"config-validation"});return}}function g(v,_){if(!y(v))return;const A=new Map;for(const[C,S]of Object.entries(v)){if(!y(S))continue;const T=new Map;for(const[D,R]of Object.entries(S)){if(typeof R!="string")continue;const O=(0,i.validateCanonicalTablePathAnyDialect)(R);if(O!==void 0){_.push({message:`virtualMap entry '${C}.${D}': ${O}`,severity:"error",code:"config-validation"});continue}T.set(D,R)}T.size>0&&A.set(C,T)}return A.size>0?A:void 0}function y(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function E(v){return y(v)&&typeof v.tableName=="string"}return xx}var j1={},zA={},Jle;function hIe(){return Jle||(Jle=1,Object.defineProperty(zA,"__esModule",{value:!0}),zA.MALLOY_VERSION=void 0,zA.MALLOY_VERSION="0.0.409"),zA}var Zle;function ece(){if(Zle)return j1;Zle=1,Object.defineProperty(j1,"__esModule",{value:!0}),j1.Malloy=j1.MalloyError=void 0;const e=lk(),t=jA(),n=vi(),r=lR(),i=hIe(),s=QR(),o=Ule(),a=Zp,u=VR(),c=Hle();function l(x="loadModel"){return`internal://${x}/${(0,a.v4)()}`}function f(x){return[...Object.keys(x),...Object.values(x).map(f).flat()]}class d extends Error{constructor(m,g=[]){super(m),this.problems=g}}j1.MalloyError=d;class p{static get version(){return i.MALLOY_VERSION}static registerConnectionType(m,g){(0,t.registerConnectionType)(m,g)}static getConnectionProperties(m){return(0,t.getConnectionProperties)(m)}static getConnectionTypeDisplayName(m){return(0,t.getConnectionTypeDisplayName)(m)}static getRegisteredConnectionTypes(){return(0,t.getRegisteredConnectionTypes)()}static _parse(m,g,y,E,v){var _;g===void 0&&(g=new URL(l(E==null?void 0:E.method)));let A=g;E!=null&&E.importBaseURL&&(A=E==null?void 0:E.importBaseURL);const C=new e.MalloyTranslator(g.toString(),A.toString(),{urls:{[g.toString()]:m}},y,(_=E==null?void 0:E.restrictedMode)!==null&&_!==void 0?_:!1);return E!=null&&E.testEnvironment&&(C.allDialectsEnabled=!0),new o.Parse(C,v)}static parse({url:m,urlReader:g,source:y,eventStream:E,options:v}){if(y!==void 0)return p._parse(y,m,E,v);if(g===void 0)throw new Error("Internal Error: urlReader is required.");if(m===void 0)throw new Error("Internal Error: url is required if source not present.");return(0,s.readURL)(g,m).then(({contents:_,invalidationKey:A})=>p._parse(_,m,E,v,A))}static async compile(m){var g,y,E,v,_;let{url:A,source:C,importBaseURL:S,cacheManager:T}=m;const{parse:D,urlReader:R,connections:O,model:F,refreshSchemaCache:I,noThrowOnError:B,eventStream:z,restrictedMode:Z,method:oe}=m;Z&&(T=void 0);let fe;if(I&&(fe=typeof I=="number"?I:Date.now()),A===void 0&&C===void 0&&D===void 0)throw new Error("Internal Error: url, source, or parse required.");A===void 0&&(D!==void 0?A=new URL(D._translator.sourceURL):A=new URL(l(oe)));const V={};if(C===void 0&&T!==void 0){const de=await T.getCachedModelDef(R,A.toString());if(de)return new u.Model(de.modelDef,[],[A.toString(),...f(de.modelDef.dependencies)])}S??(S=A);let ne;const ae=A.toString();if(D!==void 0){if(Z!==void 0&&D._translator.restrictedMode!==Z)throw new Error(`Malloy.compile: restrictedMode (${Z}) does not match the pre-parsed translator's restrictedMode (${D._translator.restrictedMode}). Set restrictedMode at parse time.`);ne=D._translator;const de=(g=D._invalidationKey)!==null&&g!==void 0?g:await(0,s.getInvalidationKey)(R,A);V[ae]=de}else{if(C===void 0){const{contents:de,invalidationKey:$}=await(0,s.readURL)(R,A);V[ae]=$,C=de}else{const de=await(0,s.getInvalidationKey)(R,A);V[ae]=de}ne=new e.MalloyTranslator(ae,S.toString(),{urls:{[ae]:C}},z,Z??!1)}for(;;){const de=ne.translate(F==null?void 0:F._modelDef);if(de.final)if(de.modelDef){await(T==null?void 0:T.setCachedModelDef(A.toString(),{modelDef:de.modelDef,invalidationKeys:V}));for(const H of ne.newlyTranslatedDependencies())await(T==null?void 0:T.setCachedModelDef(H.url,{modelDef:H.modelDef,invalidationKeys:V}));const $=!de.modelWasModified&&F?F.getExistingQueryModel():void 0;return new u.Model(de.modelDef,de.problems||[],[...(y=F==null?void 0:F.fromSources)!==null&&y!==void 0?y:[],...(E=de.fromSources)!==null&&E!==void 0?E:[]],$)}else if(B){const $=(0,n.mkModelDef)("modelDidNotCompile"),H=(F==null?void 0:F._modelDef)||$;return new u.Model(H,de.problems||[],[...(v=F==null?void 0:F.fromSources)!==null&&v!==void 0?v:[],...(_=de.fromSources)!==null&&_!==void 0?_:[]])}else{const $=de.problems||[],H=ne.prettyErrors();throw new d(`Error(s) compiling model:
|
|
1371
1371
|
${H}`,$)}else{if(de.urls)for(const $ of de.urls)try{if((0,s.isInternalURL)($))throw new Error("In order to use relative imports, you must compile a file via a URL.");if(T!==void 0){const j=await T.getCachedModelDef(R,$);if(j){for(const L in j.invalidationKeys)V[L]=j.invalidationKeys[L];ne.update({translations:{[$]:j.modelDef}});continue}}const{contents:H,invalidationKey:W}=await(0,s.readURL)(R,new URL($)),P={[$]:H};V[$]=W,ne.update({urls:P})}catch(H){ne.update({errors:{urls:{[$]:H.message}}})}if(de.tables){const $=new Map;for(const H in de.tables){const{connectionName:W,tablePath:P}=de.tables[H],j=$.get(W);j===void 0?$.set(W,{[H]:P}):j[H]=P}for(const[H,W]of $)try{const P=await O.lookupConnection(H),{schemas:j,errors:L}=await p.safelyFetchTableSchema(P,W,{refreshTimestamp:fe});ne.update({tables:j,errors:{tables:L}})}catch(P){const j={},L={};for(const N in W)L[N]=P.toString();ne.update({tables:j,errors:{tables:L}})}}if(de.connectionDialects)for(const $ in de.connectionDialects){const{connectionName:H}=de.connectionDialects[$];try{const W=await O.lookupConnection(H);ne.update({connectionDialects:{[$]:W.dialectName}})}catch(W){ne.update({errors:{connectionDialects:{[$]:W.toString()}}})}}if(de.compileSQL){const $=de.compileSQL,H=$.connection,W=(0,r.sqlKey)($.connection,$.selectStr);try{const j=await(await O.lookupConnection(H)).fetchSchemaForSQLStruct($,{refreshTimestamp:fe});j.error&&ne.update({errors:{compileSQL:{[W]:j.error}}}),j.structDef&&ne.update({compileSQL:{[W]:j.structDef}})}catch(P){const j={};j[W]=P.toString(),ne.update({errors:{compileSQL:j}})}}}}}static async safelyFetchTableSchema(m,g,y){const E=await m.fetchSchemaForTables(g,y);for(const v of Object.keys(g))if(E.schemas[v]===void 0&&E.errors[v]===void 0)throw new Error(`Schema fetch error for ${m.name}, no response for ${v} from ${m.dialectName}`);return E}static async run({connections:m,preparedResult:g,sqlStruct:y,connection:E,options:v}){if(!E){if(!m)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const _=(y==null?void 0:y.connection)||(g==null?void 0:g.connectionName);E=await m.lookupConnection(_)}if(y){const _=await E.runSQL(y.selectStr);return new c.Result({structs:[y],sql:y.selectStr,result:_.rows,totalRows:_.totalRows,runStats:_.runStats,lastStageName:y.name,malloy:"",connectionName:y.connection,sourceExplore:"",sourceFilters:[],profilingUrl:_.profilingUrl},(0,n.mkModelDef)("empty_model"))}else if(g){const _=await E.runSQL(g.sql,v);return new c.Result({...g._rawQuery,result:_.rows,totalRows:_.totalRows,runStats:_.runStats,profilingUrl:_.profilingUrl},g._modelDef)}else throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}static async*runStream({connections:m,preparedResult:g,sqlStruct:y,connection:E,options:v}){if(y===void 0&&g===void 0)throw new Error("Internal error: sqlBlock or preparedResult must be provided.");const _=(y==null?void 0:y.connection)||(g==null?void 0:g.connectionName);if(E===void 0){if(m===void 0)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");E=await m.lookupConnection(_)}if(!E.canStream())throw new Error(`Connection '${_}' cannot stream results.`);let A,C;if(y)C=new u.Explore((0,u.pseudoModelFor)(y),y),A=y.selectStr;else if(g!==void 0)C=g.resultExplore,A=g.sql;else throw new Error("Internal error: sqlStruct or preparedResult must be provided.");let S=0;for await(const T of E.runSQLStream(A,v))yield new c.DataRecord(T,S,C,void 0,void 0),S+=1}static async estimateQueryCost({connections:m,preparedResult:g,sqlStruct:y}){if(!m)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const E=(y==null?void 0:y.connection)||(g==null?void 0:g.connectionName),v=await m.lookupConnection(E);if(y)return await v.estimateQueryCost(y.selectStr);if(g)return await v.estimateQueryCost(g.sql);throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}}return j1.Malloy=p,j1}var tce;function xIe(){if(tce)return os;tce=1,Object.defineProperty(os,"__esModule",{value:!0}),os.ExploreMaterializer=os.PreparedResultMaterializer=os.QueryMaterializer=os.ModelMaterializer=os.SingleConnectionRuntime=os.ConnectionRuntime=os.Runtime=void 0;const e=vi(),t=u0(),n=uk(),r=dk(),i=Hv(),s=QR(),o=VR(),a=ece();class u{constructor(_,A){this.runtime=_,this._materialize=A}materialize(){return this.materialized===void 0?this.rematerialize():this.materialized}rematerialize(){return this.materialized=this._materialize(),this.materialized}makeQueryMaterializer(_,A){return new p(this.runtime,_,A)}makeExploreMaterializer(_,A){return new m(this.runtime,_,A)}makePreparedResultMaterializer(_){return new x(this.runtime,_)}}class c{constructor({urlReader:_,connections:A,connection:C,config:S,buildManifest:T,eventStream:D,cacheManager:R,givens:O}){var F,I;if(this.isTestRuntime=!1,S!==void 0)this._config=S,A=A??S.connections;else if(A===void 0){if(C===void 0)throw new Error("A MalloyConfig, LookupConnection<Connection>, or Connection is required.");A={lookupConnection:()=>Promise.resolve(C)}}if(_===void 0&&(_=new s.EmptyURLReader),this._urlReader=_,this._connections=A,this._buildManifest=T,this._eventStream=D,this._cacheManager=R,O){for(const[B,z]of Object.entries(O))if(z===void 0)throw new Error(`Runtime givens.${B}: explicit undefined is not a valid value. Omit the key to defer to declaration default or the file layer; use null for an explicit null value.`)}this._constructorGivensMap=O?new Map(Object.entries(O)):new Map,this._finalizedGivensSet=new Set((I=(F=this._config)===null||F===void 0?void 0:F.finalizeGivens)!==null&&I!==void 0?I:[])}get cacheManager(){return this._cacheManager}get urlReader(){return this._urlReader}get connections(){return this._connections}get eventStream(){return this._eventStream}get _constructorGivens(){return this._constructorGivensMap}async getGivens(){const _=await this._resolveGivens(),A=new Map;if(_)for(const[C,S]of Object.entries(_))A.set(C,S);for(const[C,S]of this._constructorGivensMap)A.set(C,S);return A}get _finalizedGivens(){return this._finalizedGivensSet}set buildManifest(_){this._buildManifest=_,this._resolvedBuildManifestPromise=void 0}_resolveBuildManifest(){var _;if(this._buildManifest)return Promise.resolve(this._buildManifest);const A=(_=this._config)===null||_===void 0?void 0:_.manifestURL;return A?(this._resolvedBuildManifestPromise||(this._resolvedBuildManifestPromise=(async()=>{let C;try{const S=await this._urlReader.readURL(new URL(A));C=typeof S=="string"?S:S.contents}catch{return}try{const S=JSON.parse(C);if(!g(S))throw new Error('manifest is not an object with an "entries" map');for(const[T,D]of Object.entries(S.entries)){if(!(0,r.isBuildManifestEntry)(D))throw new Error(`Manifest entry '${T}' is missing a string tableName`);(0,n.requireCanonicalTablePathAnyDialect)(D.tableName,`Manifest entry '${T}'`)}return S}catch(S){const T=S instanceof Error?S.message:String(S);return{entries:{},loadError:`Manifest file at ${A} could not be parsed: ${T}`}}})()),this._resolvedBuildManifestPromise):Promise.resolve(void 0)}_resolveGivens(){var _;const A=(_=this._config)===null||_===void 0?void 0:_.givensURL;return A?(this._resolvedGivensPromise||(this._resolvedGivensPromise=(async()=>{let C;try{const T=await this._urlReader.readURL(new URL(A));C=typeof T=="string"?T:T.contents}catch(T){const D=T instanceof Error?T.message:String(T);throw new Error(`givens: failed to read givens file at ${A}: ${D}`)}let S;try{S=JSON.parse(C)}catch(T){const D=T instanceof Error?T.message:String(T);throw new Error(`givens: failed to parse JSON at ${A}: ${D}`)}if(!y(S)){const T=Array.isArray(S)?"array":S===null?"null":typeof S;throw new Error(`givens: file at ${A} must be a JSON object of name → value pairs, got ${T}`)}return S})()),this._resolvedGivensPromise):Promise.resolve(void 0)}_invalidateGivensCache(){this._resolvedGivensPromise=void 0}get virtualMap(){var _,A;return(_=this._virtualMap)!==null&&_!==void 0?_:(A=this._config)===null||A===void 0?void 0:A.virtualMap}set virtualMap(_){this._virtualMap=_}async shutdown(_="close"){var A;await((A=this._config)===null||A===void 0?void 0:A.shutdown(_))}async releaseConnections(){await this.shutdown("close")}loadModel(_,A){const{refreshSchemaCache:C,noThrowOnError:S}=A||{};this.isTestRuntime&&(A===void 0?A={testEnvironment:!0}:A={...A,testEnvironment:!0});const T=_ instanceof URL?{url:_}:{source:_};return new d(this,async()=>{const D=await a.Malloy.compile({...T,urlReader:this.urlReader,connections:this.connections,refreshSchemaCache:C,noThrowOnError:S,eventStream:this.eventStream,importBaseURL:A==null?void 0:A.importBaseURL,testEnvironment:A==null?void 0:A.testEnvironment,cacheManager:this.cacheManager});return this._withRuntimeContext(D)},A)}_withRuntimeContext(_){return this._finalizedGivensSet.size===0?_:new o.Model(_._modelDef,_.problems,_.fromSources,_.getExistingQueryModel(),{finalizedGivens:this._finalizedGivensSet})}_loadModelFromModelDef(_,A){return new d(this,async()=>new o.Model(_,[],[],void 0,this._finalizedGivensSet.size>0?{finalizedGivens:this._finalizedGivensSet}:void 0),A)}loadQuery(_,A){return this.loadModel(_,A).loadFinalQuery()}loadQueryByIndex(_,A,C){return this.loadModel(_,C).loadQueryByIndex(A,C)}loadQueryByName(_,A,C){return this.loadModel(_,C).loadQueryByName(A,C)}getModel(_,A){return this.loadModel(_,A).getModel()}getQuery(_,A){return this.loadQuery(_,A).getPreparedQuery()}getQueryByIndex(_,A,C){return this.loadQueryByIndex(_,A,C).getPreparedQuery()}getQueryByName(_,A,C){return this.loadQueryByName(_,A,C).getPreparedQuery()}}os.Runtime=c;class l extends c{constructor({urlReader:_,connections:A}){super({connections:s.FixedConnectionMap.fromArray(A),urlReader:_}),this.rawConnections=A}}os.ConnectionRuntime=l;class f extends c{constructor({urlReader:_,connection:A,eventStream:C,cacheManager:S}){super({urlReader:_,eventStream:C,cacheManager:S,connection:A}),this.connection=A}get supportsNesting(){return(0,t.getDialect)(this.connection.dialectName).supportsNesting}quote(_){return(0,t.getDialect)(this.connection.dialectName).sqlQuoteIdentifier(_)}get dialect(){return(0,t.getDialect)(this.connection.dialectName)}getQuoter(){return _=>this.quote(_.toString())}}os.SingleConnectionRuntime=f;class d extends u{constructor(_,A,C){super(_,A),this.runtime=_,this.compileQueryOptions=C}loadFinalQuery(_){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQuery(),{...this.compileQueryOptions,..._})}loadQueryByIndex(_,A){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByIndex(_),{...this.compileQueryOptions,...A})}loadQueryByName(_,A){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByName(_),{...this.compileQueryOptions,...A})}loadQuery(_,A){const{refreshSchemaCache:C,noThrowOnError:S}=A||{};return this.makeQueryMaterializer(async()=>{const T=this.runtime.urlReader,D=this.runtime.connections;this.runtime.isTestRuntime&&(A===void 0?A={testEnvironment:!0}:A={...A,testEnvironment:!0});const R=_ instanceof URL?{url:_}:{source:_},O=await this.getModel();return(await a.Malloy.compile({...R,urlReader:T,connections:D,model:O,refreshSchemaCache:C,noThrowOnError:S,importBaseURL:A==null?void 0:A.importBaseURL,testEnvironment:A==null?void 0:A.testEnvironment,...this.compileQueryOptions})).preparedQuery})}loadRestrictedQuery(_){return this.makeQueryMaterializer(async()=>{const A=this.runtime.urlReader,C=this.runtime.connections,S=this.runtime.isTestRuntime?!0:void 0,T=await this.getModel();return(await a.Malloy.compile({source:_,restrictedMode:!0,method:"query",urlReader:A,connections:C,model:T,testEnvironment:S,...this.compileQueryOptions})).preparedQuery})}extendModel(_,A){return this.runtime.isTestRuntime&&(A===void 0?A={testEnvironment:!0}:A={...A,testEnvironment:!0}),new d(this.runtime,async()=>{const C=this.runtime.urlReader,S=this.runtime.connections,T=_ instanceof URL?{url:_}:{source:_},D=await this.getModel(),R=await a.Malloy.compile({...T,urlReader:C,connections:S,model:D,method:"extendModel",refreshSchemaCache:A==null?void 0:A.refreshSchemaCache,noThrowOnError:A==null?void 0:A.noThrowOnError,importBaseURL:A==null?void 0:A.importBaseURL,testEnvironment:A==null?void 0:A.testEnvironment,...this.compileQueryOptions});return this.runtime._withRuntimeContext(R)},A)}async search(_,A,C=1e3,S=void 0){const T=await this.materialize(),D=T.queryModel,R=T.getExploreByName(_).structDef;if(!(0,e.isSourceDef)(R))throw new Error("Source to be searched was unexpectedly, not a source");const O=R.connection,F=await this.runtime.connections.lookupConnection(O);return await D.searchIndex(F,_,A,C,S)}async searchValueMap(_,A=10,C){const T=(await this.materialize()).getExploreByName(_);if(!(0,e.isSourceDef)(T.structDef))throw new Error("Source to be searched was unexpectedly, not a source");let D="{index: *}";T.getFieldByNameIfExists("search_index")&&(D="search_index");const R=`
|
|
1372
1372
|
run: ${_}
|
|
1373
1373
|
-> ${D}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/render",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.409",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/module/index.umd.js",
|
|
6
6
|
"types": "dist/module/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"generate-flow": "ts-node ../../scripts/gen-flow.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
33
|
-
"@malloydata/malloy-tag": "0.0.
|
|
32
|
+
"@malloydata/malloy-interfaces": "0.0.409",
|
|
33
|
+
"@malloydata/malloy-tag": "0.0.409",
|
|
34
34
|
"@tanstack/solid-virtual": "^3.10.4",
|
|
35
35
|
"lodash": "^4.18.1",
|
|
36
36
|
"luxon": "^3.5.0",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"vega-lite": "^5.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@malloydata/db-duckdb": "0.0.
|
|
46
|
-
"@malloydata/malloy": "0.0.
|
|
45
|
+
"@malloydata/db-duckdb": "0.0.409",
|
|
46
|
+
"@malloydata/malloy": "0.0.409",
|
|
47
47
|
"@storybook/addon-essentials": "^8.6.15",
|
|
48
48
|
"@storybook/addon-interactions": "^8.6.15",
|
|
49
49
|
"@storybook/addon-links": "^8.6.15",
|