@hamelin.sh/compiler 0.3.5 → 0.3.6

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
@@ -1,49 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- type BuildCatalogError = { kind: "catalogInit"; message: string } | { kind: "compilation"; name: string; errors: ContextualTranslationErrors } | { kind: "datasetParse"; name: string; message: string };
4
-
5
- type CompileQueryResult = { Ok: QueryTranslation } | { Err: ContextualTranslationErrors };
6
-
7
- interface CatalogResource {
8
- name: string;
9
- query: string;
10
- }
11
-
12
3
  interface BuildCatalogOutput {
13
4
  catalog: Catalog;
14
5
  errors: BuildCatalogError[];
15
6
  }
16
7
 
17
- type QueryDatasetsResult = { Ok: string[] } | { Err: ContextualTranslationErrors };
18
-
19
- type Level = "Error" | "Warning" | "Info";
20
-
21
- interface ContextualTranslationErrors {
22
- hamelin: string;
23
- errors: ContextualTranslationError[];
24
- }
25
-
26
- interface TranslationError {
27
- area: LanguageArea | undefined;
28
- stage: Stage;
29
- level: Level;
30
- primary: Context;
31
- supporting: Context[] | undefined;
32
- source_desc: string | undefined;
8
+ interface CatalogResource {
9
+ name: string;
10
+ query: string;
33
11
  }
34
12
 
35
- type LanguageArea = "FunctionCall" | "Operator" | "Deref" | "IndexAccess" | "Parsing";
36
-
37
- interface ContextualTranslationError {
38
- error: TranslationError;
39
- pretty: string;
13
+ interface Column {
14
+ name: string;
15
+ type: HamelinType;
40
16
  }
41
17
 
42
- type Stage = "Translation" | "Parsing" | "SemanticAnalysis";
43
-
44
- interface Context {
45
- interval: { start: number; end: number };
46
- message: string;
18
+ interface Completion {
19
+ at: { start: number; end: number };
20
+ filter: boolean | undefined;
21
+ items: CompletionItem[];
47
22
  }
48
23
 
49
24
  interface CompletionItem {
@@ -74,8 +49,14 @@ interface CompletionItem {
74
49
  section: string | undefined;
75
50
  }
76
51
 
77
- interface QueryTranslation {
78
- translation: Translation;
52
+ interface Context {
53
+ interval: { start: number; end: number };
54
+ message: string;
55
+ }
56
+
57
+ interface ContextualCompletion {
58
+ pretty: string;
59
+ completion: Completion;
79
60
  }
80
61
 
81
62
  interface ContextualResult {
@@ -85,57 +66,76 @@ interface ContextualResult {
85
66
  translation: QueryTranslation | undefined;
86
67
  }
87
68
 
88
- interface ContextualCompletion {
69
+ interface ContextualTranslationError {
70
+ error: TranslationError;
89
71
  pretty: string;
90
- completion: Completion;
91
72
  }
92
73
 
93
- interface Completion {
94
- at: { start: number; end: number };
95
- filter: boolean | undefined;
96
- items: CompletionItem[];
74
+ interface ContextualTranslationErrors {
75
+ hamelin: string;
76
+ errors: ContextualTranslationError[];
97
77
  }
98
78
 
99
- type CompletionItemKind = "Text" | "Variable" | "Function" | "Command" | "Keyword";
79
+ interface FunctionDescription {
80
+ name: string;
81
+ parameters: string;
82
+ }
83
+
84
+ interface QueryTranslation {
85
+ translation: Translation;
86
+ }
100
87
 
101
88
  interface Translation {
102
89
  sql: string;
103
90
  columns: Column[];
104
91
  }
105
92
 
106
- 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[] };
107
-
108
- interface Column {
109
- name: string;
110
- type: HamelinType;
93
+ interface TranslationError {
94
+ area: LanguageArea | undefined;
95
+ stage: Stage;
96
+ level: Level;
97
+ primary: Context;
98
+ supporting: Context[] | undefined;
99
+ source_desc: string | undefined;
111
100
  }
112
101
 
102
+ type BuildCatalogError = { kind: "catalogInit"; message: string } | { kind: "compilation"; name: string; errors: ContextualTranslationErrors } | { kind: "datasetParse"; name: string; message: string };
103
+
113
104
  type Catalog = Record<string, Column[]>;
114
105
 
115
- interface FunctionDescription {
116
- name: string;
117
- parameters: string;
118
- }
106
+ type CompileQueryResult = { Ok: QueryTranslation } | { Err: ContextualTranslationErrors };
107
+
108
+ type CompletionItemKind = "Text" | "Variable" | "Function" | "Command" | "Keyword";
109
+
110
+ 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[] };
111
+
112
+ type LanguageArea = "FunctionCall" | "Operator" | "Deref" | "IndexAccess" | "Parsing";
113
+
114
+ type Level = "Error" | "Warning" | "Info";
115
+
116
+ type QueryDatasetsResult = { Ok: string[] } | { Err: ContextualTranslationErrors };
117
+
118
+ type Stage = "Translation" | "Parsing" | "SemanticAnalysis";
119
119
 
120
120
 
121
121
  declare class CatalogProvider {
122
- private constructor();
123
- free(): void;
124
- [Symbol.dispose](): void;
125
- static try_from_catalog(catalog: Catalog): CatalogProvider;
122
+ private constructor();
123
+ free(): void;
124
+ [Symbol.dispose](): void;
125
+ static try_from_catalog(catalog: Catalog): CatalogProvider;
126
126
  }
127
127
 
128
128
  declare class Compiler {
129
- free(): void;
130
- [Symbol.dispose](): void;
131
- compile_query(query: string): CompileQueryResult;
132
- set_time_range(start?: Date | null, end?: Date | null): void;
133
- compile_query_at(query: string, at?: number | null): ContextualResult;
134
- set_catalog_provider(provider: CatalogProvider): void;
135
- get_statement_datasets(query: string): QueryDatasetsResult;
136
- get_function_descriptions(): FunctionDescription[];
137
- set_time_range_expression(expression: string): ContextualTranslationErrors | undefined;
138
- constructor();
129
+ free(): void;
130
+ [Symbol.dispose](): void;
131
+ compile_query(query: string): CompileQueryResult;
132
+ compile_query_at(query: string, at?: number | null): ContextualResult;
133
+ get_function_descriptions(): FunctionDescription[];
134
+ get_statement_datasets(query: string): QueryDatasetsResult;
135
+ constructor();
136
+ set_catalog_provider(provider: CatalogProvider): void;
137
+ set_time_range(start?: Date | null, end?: Date | null): void;
138
+ set_time_range_expression(expression: string): ContextualTranslationErrors | undefined;
139
139
  }
140
140
 
141
141
  declare const buildCatalog: (startingCatalog: Catalog, resources: Array<CatalogResource>) => Promise<BuildCatalogOutput>;