@hamelin.sh/compiler 0.15.1 → 0.15.3

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/main.d.ts CHANGED
@@ -46,6 +46,11 @@ interface Column {
46
46
  type: HamelinType;
47
47
  }
48
48
 
49
+ interface CombineQueriesForInliningOk {
50
+ query: string;
51
+ cte_names: CteNameEntry[];
52
+ }
53
+
49
54
  interface CompileHamelinQueryResultOk {
50
55
  columns: Column[];
51
56
  }
@@ -93,6 +98,11 @@ interface ContextualTranslationErrors {
93
98
  errors: ContextualTranslationError[];
94
99
  }
95
100
 
101
+ interface CteNameEntry {
102
+ catalog_key: string;
103
+ cte_name: string;
104
+ }
105
+
96
106
  interface FunctionDescription {
97
107
  name: string;
98
108
  parameters: string;
@@ -115,10 +125,18 @@ interface TranslationError {
115
125
  source_desc: string | undefined;
116
126
  }
117
127
 
128
+ interface WasmCteInline {
129
+ catalog_key: string;
130
+ query: string;
131
+ cte_name: string;
132
+ }
133
+
118
134
  type BuildCatalogError = { kind: "catalogInit"; message: string } | { kind: "compilation"; name: string; errors: ContextualTranslationErrors } | { kind: "datasetParse"; name: string; message: string };
119
135
 
120
136
  type Catalog = Record<QualifiedDatasetIdentifier, Column[]>;
121
137
 
138
+ type CombineQueriesForInliningResult = { Ok: CombineQueriesForInliningOk } | { Err: ContextualTranslationErrors } | { CombineError: string };
139
+
122
140
  type CompileHamelinQueryResult = { Ok: CompileHamelinQueryResultOk } | { Err: ContextualTranslationErrors };
123
141
 
124
142
  type CompletionItemKind = "Text" | "Variable" | "Function" | "Command" | "Keyword";
@@ -148,6 +166,33 @@ declare const buildCatalog: (startingCatalog: Catalog, resources: Array<CatalogR
148
166
 
149
167
  declare const checkIncrementalEligibility: (catalog: Catalog, query: string, allowLookups: boolean, defaultSpace?: string | null) => Promise<IncrementalEligibilityResult>;
150
168
 
169
+ type CombineQueriesForInliningInput = {
170
+ mainQuery: string;
171
+ cteInlines: WasmCteInline[];
172
+ defaultSpaceCatalogName?: string | null;
173
+ };
174
+ type CombineQueriesForInliningSuccess = {
175
+ query: string;
176
+ cteNames: Record<string, string>;
177
+ };
178
+ type CombineQueriesForInliningOutput = {
179
+ kind: "Ok";
180
+ value: CombineQueriesForInliningSuccess;
181
+ } | {
182
+ kind: "Err";
183
+ value: CombineQueriesForInliningResult & {
184
+ Err: unknown;
185
+ };
186
+ } | {
187
+ kind: "CombineError";
188
+ message: string;
189
+ };
190
+ /**
191
+ * Merge upstream queries as tabular DEFs for catalog inlining, rewrite catalog table refs,
192
+ * and attach the main query.
193
+ */
194
+ declare const combineQueriesForInlining: ({ mainQuery, cteInlines, defaultSpaceCatalogName, }: CombineQueriesForInliningInput) => Promise<CombineQueriesForInliningOutput>;
195
+
151
196
  declare const compileHamelinQuery: (catalog: Catalog, hamelinInput: string, templateParameters?: Record<string, WasmTemplateParameterKind> | null, defaultSpace?: string | null) => Promise<CompileHamelinQueryResult>;
152
197
 
153
198
  declare function getCompletions(catalog: Catalog, hamelinInput: string, pos: number, templateParameters?: Record<string, WasmTemplateParameterKind> | null, defaultSpace?: string | null): Promise<Completion | null>;
@@ -266,4 +311,4 @@ declare const sampleCatalog: Catalog;
266
311
  */
267
312
  declare const substituteTemplateParameters: (hamelinInput: string, templateValues: Record<string, WasmTemplateParameterValue>, templateParameters?: Record<string, WasmTemplateParameterKind>) => Promise<SubstituteTemplateParametersResult>;
268
313
 
269
- export { type BuildCatalogError, type BuildCatalogOutput, type Catalog, type Column, type CompileHamelinQueryResult, type CompileHamelinQueryResultOk, type Completion, type CompletionItem, type ContextualTranslationError, type ContextualTranslationErrors, type FunctionDescription, type GetOutputTimestampColumnsResult, type GetOutputTimestampColumnsResultOk, type HamelinType, type IncrementalEligibilityResult, type OutputTimestampColumn, type QueryAggregation, type QuerySort, type QuerySuppress, type RowCollapsingIdentity, type SubstituteTemplateParametersOk, type SubstituteTemplateParametersResult, type TranslationError, type TruncUnit, type WasmTemplateParameterKind, type WasmTemplateParameterValue, buildCatalog, checkIncrementalEligibility, compileHamelinQuery, getAggregations, getCompletions, getDatasetsFromQuery, getFunctionDescriptions, getLimits, getMainPipelineSourceRange, getMainPipelineText, getOutputTimestampColumns, getRowCollapsingIdentity, getSelectedFields, getSorts, getSuppress, hamelinGrammar, hamelinPrompt, hasSuppress, insertImplicitSortBeforeLastMainLimit, parseTokenValueClass, sampleCatalog, substituteTemplateParameters };
314
+ export { type BuildCatalogError, type BuildCatalogOutput, type Catalog, type Column, type CombineQueriesForInliningOk, type CombineQueriesForInliningResult, type CompileHamelinQueryResult, type CompileHamelinQueryResultOk, type Completion, type CompletionItem, type ContextualTranslationError, type ContextualTranslationErrors, type FunctionDescription, type GetOutputTimestampColumnsResult, type GetOutputTimestampColumnsResultOk, type HamelinType, type IncrementalEligibilityResult, type OutputTimestampColumn, type QueryAggregation, type QuerySort, type QuerySuppress, type RowCollapsingIdentity, type SubstituteTemplateParametersOk, type SubstituteTemplateParametersResult, type TranslationError, type TruncUnit, type WasmCteInline, type WasmTemplateParameterKind, type WasmTemplateParameterValue, buildCatalog, checkIncrementalEligibility, combineQueriesForInlining, compileHamelinQuery, getAggregations, getCompletions, getDatasetsFromQuery, getFunctionDescriptions, getLimits, getMainPipelineSourceRange, getMainPipelineText, getOutputTimestampColumns, getRowCollapsingIdentity, getSelectedFields, getSorts, getSuppress, hamelinGrammar, hamelinPrompt, hasSuppress, insertImplicitSortBeforeLastMainLimit, parseTokenValueClass, sampleCatalog, substituteTemplateParameters };