@hamelin.sh/compiler 0.4.13 → 0.4.14
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/iife.js +39 -169
- package/dist/main.d.ts +5 -68
- package/dist/main.js +39 -169
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -64,18 +64,6 @@ interface Context {
|
|
|
64
64
|
message: string;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
interface ContextualCompletion {
|
|
68
|
-
pretty: string;
|
|
69
|
-
completion: Completion;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
interface ContextualResult {
|
|
73
|
-
hamelin: string;
|
|
74
|
-
errors: ContextualTranslationError[];
|
|
75
|
-
completions: ContextualCompletion | undefined;
|
|
76
|
-
translation: QueryTranslation | undefined;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
67
|
interface ContextualTranslationError {
|
|
80
68
|
error: TranslationError;
|
|
81
69
|
pretty: string;
|
|
@@ -91,15 +79,6 @@ interface FunctionDescription {
|
|
|
91
79
|
parameters: string;
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
interface QueryTranslation {
|
|
95
|
-
translation: Translation;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface Translation {
|
|
99
|
-
sql: string;
|
|
100
|
-
columns: Column[];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
82
|
interface TranslationError {
|
|
104
83
|
area: LanguageArea | undefined;
|
|
105
84
|
stage: Stage;
|
|
@@ -115,8 +94,6 @@ type Catalog = Record<string, Column[]>;
|
|
|
115
94
|
|
|
116
95
|
type CompileHamelinQueryResult = { Ok: CompileHamelinQueryResultOk } | { Err: ContextualTranslationErrors };
|
|
117
96
|
|
|
118
|
-
type CompileQueryResult = { Ok: QueryTranslation } | { Err: ContextualTranslationErrors };
|
|
119
|
-
|
|
120
97
|
type CompletionItemKind = "Text" | "Variable" | "Function" | "Command" | "Keyword";
|
|
121
98
|
|
|
122
99
|
type HamelinType = "binary" | "boolean" | "interval" | "calendar_interval" | "int" | "double" | "rows" | "string" | "timestamp" | "unknown" | { decimal: { precision: number; scale: number } } | { array: { element_type: HamelinType } } | { map: { key_type: HamelinType; value_type: HamelinType } } | { tuple: { elements: HamelinType[] } } | "variant" | { range: { of: HamelinType } } | { struct: Column[] };
|
|
@@ -129,42 +106,12 @@ type QueryDatasetsResult = { Ok: string[] } | { Err: ContextualTranslationErrors
|
|
|
129
106
|
|
|
130
107
|
type Stage = "Translation" | "Parsing" | "SemanticAnalysis";
|
|
131
108
|
|
|
132
|
-
|
|
133
|
-
declare class CatalogProvider {
|
|
134
|
-
private constructor();
|
|
135
|
-
free(): void;
|
|
136
|
-
[Symbol.dispose](): void;
|
|
137
|
-
static try_from_catalog(catalog: Catalog): CatalogProvider;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
declare class Compiler {
|
|
141
|
-
free(): void;
|
|
142
|
-
[Symbol.dispose](): void;
|
|
143
|
-
compile_query(query: string): CompileQueryResult;
|
|
144
|
-
compile_query_at(query: string, at?: number | null): ContextualResult;
|
|
145
|
-
get_function_descriptions(): FunctionDescription[];
|
|
146
|
-
get_statement_datasets(query: string): QueryDatasetsResult;
|
|
147
|
-
constructor();
|
|
148
|
-
set_catalog_provider(provider: CatalogProvider): void;
|
|
149
|
-
set_time_range_expression(expression: string): ContextualTranslationErrors | undefined;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
109
|
type CatalogResourceInput = Omit<CatalogResource, "isUnion"> & {
|
|
153
110
|
isUnion?: boolean;
|
|
154
111
|
};
|
|
155
112
|
declare const buildCatalog: (startingCatalog: Catalog, resources: Array<CatalogResourceInput>) => Promise<BuildCatalogOutput>;
|
|
156
113
|
|
|
157
|
-
|
|
158
|
-
declare const compileHamelin: (catalog: Catalog, hamelinInput: string, timeRange?: string) => Promise<CompileQueryResult>;
|
|
159
|
-
/** @deprecated Use compileHamelinQuery or getCompletions instead */
|
|
160
|
-
declare const createCompiler: (catalog: Catalog) => Promise<Compiler>;
|
|
161
|
-
declare const compileHamelinQuery: (catalog: Catalog, hamelinInput: string, timeRange?: string) => Promise<{
|
|
162
|
-
Err: ContextualTranslationErrors;
|
|
163
|
-
} | {
|
|
164
|
-
Ok: {
|
|
165
|
-
columns: Column[];
|
|
166
|
-
};
|
|
167
|
-
}>;
|
|
114
|
+
declare const compileHamelinQuery: (catalog: Catalog, hamelinInput: string) => Promise<CompileHamelinQueryResult>;
|
|
168
115
|
|
|
169
116
|
declare function getCompletions(catalog: Catalog, hamelinInput: string, pos: number): Promise<Completion | null>;
|
|
170
117
|
|
|
@@ -188,9 +135,10 @@ type QueryAggregation = {
|
|
|
188
135
|
};
|
|
189
136
|
declare const getAggregations: (query: string) => QueryAggregation[];
|
|
190
137
|
|
|
191
|
-
declare
|
|
138
|
+
declare function getDatasetsFromQuery(hamelinInput: string): Promise<QueryDatasetsResult>;
|
|
139
|
+
declare function getDatasetsFromQuery(catalog: Catalog, hamelinInput: string): Promise<QueryDatasetsResult>;
|
|
192
140
|
|
|
193
|
-
declare
|
|
141
|
+
declare function getFunctionDescriptions(): Promise<FunctionDescription[]>;
|
|
194
142
|
|
|
195
143
|
/**
|
|
196
144
|
* Returns the top level limit information from the provided Hamelin query.
|
|
@@ -208,15 +156,4 @@ declare function parseTokenValueClass(stream: {
|
|
|
208
156
|
|
|
209
157
|
declare const sampleCatalog: Catalog;
|
|
210
158
|
|
|
211
|
-
|
|
212
|
-
* Invokes Antlr4-c3 to collect completion candidates for a given input string
|
|
213
|
-
* at a specific position.
|
|
214
|
-
*
|
|
215
|
-
* @param input The input string to analyze.
|
|
216
|
-
* @param pos Request completion at this index in the input string,
|
|
217
|
-
* @returns A collection of candidates or undefined if no candidates are found
|
|
218
|
-
* or the position is invalid.
|
|
219
|
-
*/
|
|
220
|
-
declare function getSyntaxCompletions(input: string, pos: number): Completion | null;
|
|
221
|
-
|
|
222
|
-
export { type BuildCatalogError, type BuildCatalogOutput, type Catalog, type Column, type CompileHamelinQueryResult, type CompileHamelinQueryResultOk, type CompileQueryResult, type Completion, type CompletionItem, type ContextualResult, type ContextualTranslationError, type ContextualTranslationErrors, type FunctionDescription, type HamelinType, type QuerySort, type QueryTranslation, type Translation, type TranslationError, buildCatalog, compileHamelin, compileHamelinQuery, createCompiler, getAggregations, getCompletions, getDatasetsFromQuery, getFunctionDescriptions, getLimits, getSelectedFields, getSorts, getSyntaxCompletions, hamelinGrammar, hamelinPrompt, parseTokenValueClass, sampleCatalog };
|
|
159
|
+
export { type BuildCatalogError, type BuildCatalogOutput, type Catalog, type Column, type CompileHamelinQueryResult, type CompileHamelinQueryResultOk, type Completion, type CompletionItem, type ContextualTranslationError, type ContextualTranslationErrors, type FunctionDescription, type HamelinType, type QuerySort, type TranslationError, buildCatalog, compileHamelinQuery, getAggregations, getCompletions, getDatasetsFromQuery, getFunctionDescriptions, getLimits, getSelectedFields, getSorts, hamelinGrammar, hamelinPrompt, parseTokenValueClass, sampleCatalog };
|