@hamelin.sh/compiler 0.0.0
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/LICENSE +6 -0
- package/README.md +3 -0
- package/dist/main.d.ts +57 -0
- package/dist/main.js +1056 -0
- package/package.json +29 -0
package/LICENSE
ADDED
package/README.md
ADDED
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
type CompileResult = { Ok: Translation } | { Err: ContextualTranslationErrors };
|
|
4
|
+
|
|
5
|
+
type HamelinType = "binary" | "boolean" | "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[] };
|
|
6
|
+
|
|
7
|
+
interface Column {
|
|
8
|
+
name: string;
|
|
9
|
+
type: HamelinType;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type Catalog = Record<string, Column[]>;
|
|
13
|
+
|
|
14
|
+
interface FunctionDescription {
|
|
15
|
+
name: string;
|
|
16
|
+
parameters: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ContextualTranslationErrors {
|
|
20
|
+
hamelin: string;
|
|
21
|
+
errors: TranslationErrors;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type TranslationErrors = TranslationError[];
|
|
25
|
+
|
|
26
|
+
interface Context {
|
|
27
|
+
interval: { start: number; end: number } | undefined;
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface TranslationError {
|
|
32
|
+
area: LanguageArea | undefined;
|
|
33
|
+
stage: Stage;
|
|
34
|
+
level: Level;
|
|
35
|
+
primary: Context;
|
|
36
|
+
supporting: Context[] | undefined;
|
|
37
|
+
source_desc: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type Stage = "Translation" | "Parsing" | "SemanticAnalysis";
|
|
41
|
+
|
|
42
|
+
type LanguageArea = "FunctionCall" | "Operator" | "Deref" | "IndexAccess" | "Parsing";
|
|
43
|
+
|
|
44
|
+
type Level = "Error" | "Warning" | "Info";
|
|
45
|
+
|
|
46
|
+
interface Translation {
|
|
47
|
+
sql: string;
|
|
48
|
+
columns: Column[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare const compileHamelin: (catalog: Catalog, hamelinInput: string) => Promise<CompileResult>;
|
|
52
|
+
|
|
53
|
+
declare const getFunctionDescriptions: () => Promise<FunctionDescription[]>;
|
|
54
|
+
|
|
55
|
+
declare const sampleCatalog: Catalog;
|
|
56
|
+
|
|
57
|
+
export { type Catalog, type FunctionDescription, compileHamelin, getFunctionDescriptions, sampleCatalog };
|