@duckcodeailabs/dql-compiler 0.1.0 → 0.1.1
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/README.md +53 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `@duckcodeailabs/dql-compiler`
|
|
2
|
+
|
|
3
|
+
Compiler for DQL source files.
|
|
4
|
+
|
|
5
|
+
It parses DQL, runs semantic analysis, lowers dashboards/workbooks into intermediate structures, and emits HTML, runtime JavaScript, metadata, and chart specs.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @duckcodeailabs/dql-compiler
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { compile } from '@duckcodeailabs/dql-compiler';
|
|
17
|
+
|
|
18
|
+
const source = `
|
|
19
|
+
block revenue_by_segment {
|
|
20
|
+
type = "custom"
|
|
21
|
+
title = "Revenue by Segment"
|
|
22
|
+
|
|
23
|
+
query = <<SQL
|
|
24
|
+
select segment, sum(revenue) as revenue
|
|
25
|
+
from revenue
|
|
26
|
+
group by 1
|
|
27
|
+
SQL
|
|
28
|
+
|
|
29
|
+
visualization {
|
|
30
|
+
chart = "bar"
|
|
31
|
+
x = "segment"
|
|
32
|
+
y = "revenue"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const result = compile(source, { file: 'blocks/revenue_by_segment.dql', theme: 'light' });
|
|
38
|
+
|
|
39
|
+
console.log(result.errors);
|
|
40
|
+
console.log(result.dashboards[0]?.metadata.title);
|
|
41
|
+
console.log(result.dashboards[0]?.html.slice(0, 80));
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Common Uses
|
|
45
|
+
|
|
46
|
+
- compile DQL into browser-ready HTML
|
|
47
|
+
- generate chart specs for preview or embedding
|
|
48
|
+
- build custom publishing or export pipelines
|
|
49
|
+
|
|
50
|
+
## Learn More
|
|
51
|
+
|
|
52
|
+
- Getting started: [`../../docs/getting-started.md`](../../docs/getting-started.md)
|
|
53
|
+
- Root docs: [`../../README.md`](../../README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duckcodeailabs/dql-compiler",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "DQL compiler: IR lowering, Vega-Lite code generation, HTML/CSS emitting",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@duckcodeailabs/dql-core": "0.1.
|
|
27
|
+
"@duckcodeailabs/dql-core": "0.1.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"vitest": "^3.0.0",
|