@graphenedata/cli 0.0.14 → 0.0.16
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.md +3 -3
- package/README.md +138 -0
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/bin.js +2 -2
- package/dist/cli/bigQuery-I3F46SC6.js +75 -0
- package/dist/cli/bigQuery-I3F46SC6.js.map +7 -0
- package/dist/cli/chunk-OVWODUTJ.js +12849 -0
- package/dist/cli/chunk-OVWODUTJ.js.map +7 -0
- package/dist/cli/chunk-QAXEOZ43.js +53 -0
- package/dist/cli/chunk-QAXEOZ43.js.map +7 -0
- package/dist/cli/cli.js +245 -10290
- package/dist/cli/clickhouse-ZN5AN2UL.js +64 -0
- package/dist/cli/clickhouse-ZN5AN2UL.js.map +7 -0
- package/dist/cli/duckdb-IYBIO5KJ.js +87 -0
- package/dist/cli/duckdb-IYBIO5KJ.js.map +7 -0
- package/dist/cli/serve2-TNN5EROW.js +447 -0
- package/dist/cli/serve2-TNN5EROW.js.map +7 -0
- package/dist/cli/snowflake-MOQB5GA4.js +128 -0
- package/dist/cli/snowflake-MOQB5GA4.js.map +7 -0
- package/dist/index.d.ts +63 -0
- package/dist/lang/index.d.ts +63 -0
- package/dist/skills/graphene/SKILL.md +235 -0
- package/dist/skills/graphene/references/big-value.md +20 -0
- package/dist/skills/graphene/references/date-range.md +64 -0
- package/dist/skills/graphene/references/dropdown.md +62 -0
- package/dist/skills/graphene/references/echarts.md +162 -0
- package/dist/skills/graphene/references/gsql.md +393 -0
- package/dist/skills/graphene/references/model-gsql.md +72 -0
- package/dist/skills/graphene/references/table.md +143 -0
- package/dist/skills/graphene/references/text-input.md +29 -0
- package/dist/ui/app.css +263 -299
- package/dist/ui/component-utilities/dataShaping.ts +484 -0
- package/dist/ui/component-utilities/dataSummary.ts +57 -0
- package/dist/ui/component-utilities/enrich.ts +763 -0
- package/dist/ui/component-utilities/format.ts +177 -0
- package/dist/ui/component-utilities/inputUtils.ts +48 -9
- package/dist/ui/component-utilities/theme.ts +200 -0
- package/dist/ui/component-utilities/themeStores.ts +26 -21
- package/dist/ui/component-utilities/types.ts +70 -0
- package/dist/ui/components/AreaChart.svelte +57 -105
- package/dist/ui/components/BarChart.svelte +71 -129
- package/dist/ui/components/BigValue.svelte +24 -40
- package/dist/ui/components/Column.svelte +11 -19
- package/dist/ui/components/DateRange.svelte +71 -34
- package/dist/ui/components/Dropdown.svelte +82 -49
- package/dist/ui/components/DropdownOption.svelte +1 -2
- package/dist/ui/components/ECharts.svelte +179 -60
- package/dist/ui/components/InlineDelta.svelte +51 -32
- package/dist/ui/components/LineChart.svelte +54 -125
- package/dist/ui/components/PieChart.svelte +27 -37
- package/dist/ui/components/QueryLoad.svelte +78 -44
- package/dist/ui/components/Row.svelte +2 -1
- package/dist/ui/components/ScatterPlot.svelte +52 -0
- package/dist/ui/components/Skeleton.svelte +32 -0
- package/dist/ui/components/Table.svelte +3 -2
- package/dist/ui/components/TableGroupRow.svelte +28 -36
- package/dist/ui/components/TableHarness.svelte +32 -0
- package/dist/ui/components/TableHeader.svelte +34 -59
- package/dist/ui/components/TableRow.svelte +15 -39
- package/dist/ui/components/TableSubtotalRow.svelte +26 -21
- package/dist/ui/components/TableTotalRow.svelte +27 -37
- package/dist/ui/components/TextInput.svelte +17 -14
- package/dist/ui/components/Value.svelte +25 -0
- package/dist/ui/components/_Table.svelte +80 -76
- package/dist/ui/internal/ChartGallery.svelte +527 -0
- package/dist/ui/internal/ErrorDisplay.svelte +60 -0
- package/dist/ui/internal/LocalApp.svelte +87 -19
- package/dist/ui/internal/PageNavGroup.svelte +269 -0
- package/dist/ui/internal/Sidebar.svelte +178 -0
- package/dist/ui/internal/SidebarToggle.svelte +47 -0
- package/dist/ui/internal/StyleGallery.svelte +244 -0
- package/dist/ui/internal/clientCache.ts +15 -13
- package/dist/ui/internal/pageInputs.svelte.js +292 -0
- package/dist/ui/internal/queryEngine.ts +124 -132
- package/dist/ui/internal/runSocket.ts +59 -0
- package/dist/ui/internal/sidebar.svelte.js +18 -0
- package/dist/ui/internal/telemetry.ts +52 -17
- package/dist/ui/internal/types.d.ts +7 -0
- package/dist/ui/web.js +55 -13
- package/package.json +40 -41
- package/dist/docs/agent-instructions.md +0 -18
- package/dist/docs/base.md +0 -98
- package/dist/docs/cli.md +0 -22
- package/dist/docs/graphene.md +0 -1462
- package/dist/ui/component-utilities/autoFormatting.js +0 -301
- package/dist/ui/component-utilities/builtInFormats.js +0 -482
- package/dist/ui/component-utilities/chartContext.js +0 -12
- package/dist/ui/component-utilities/chartWindowDebug.js +0 -21
- package/dist/ui/component-utilities/checkInputs.js +0 -95
- package/dist/ui/component-utilities/convert.js +0 -15
- package/dist/ui/component-utilities/dateParsing.js +0 -57
- package/dist/ui/component-utilities/dropdownContext.ts +0 -1
- package/dist/ui/component-utilities/echarts.js +0 -272
- package/dist/ui/component-utilities/echartsThemes.js +0 -453
- package/dist/ui/component-utilities/formatTitle.js +0 -24
- package/dist/ui/component-utilities/formatting.js +0 -250
- package/dist/ui/component-utilities/getColumnExtents.js +0 -79
- package/dist/ui/component-utilities/getColumnSummary.js +0 -67
- package/dist/ui/component-utilities/getCompletedData.js +0 -114
- package/dist/ui/component-utilities/getDistinctCount.js +0 -7
- package/dist/ui/component-utilities/getDistinctValues.js +0 -15
- package/dist/ui/component-utilities/getSeriesConfig.js +0 -237
- package/dist/ui/component-utilities/getSortedData.js +0 -7
- package/dist/ui/component-utilities/getStackPercentages.js +0 -43
- package/dist/ui/component-utilities/getStackedData.js +0 -17
- package/dist/ui/component-utilities/getYAxisIndex.js +0 -15
- package/dist/ui/component-utilities/globalContexts.js +0 -1
- package/dist/ui/component-utilities/helpers/getCompletedData.helpers.js +0 -119
- package/dist/ui/component-utilities/replaceNulls.js +0 -14
- package/dist/ui/component-utilities/tableUtils.ts +0 -120
- package/dist/ui/components/Area.svelte +0 -214
- package/dist/ui/components/Bar.svelte +0 -350
- package/dist/ui/components/Chart.svelte +0 -989
- package/dist/ui/components/ErrorChart.svelte +0 -118
- package/dist/ui/components/Line.svelte +0 -227
- package/dist/ui/internal/NavSidebar.svelte +0 -396
- package/dist/ui/internal/PageError.svelte +0 -23
- package/dist/ui/internal/checkSocket.ts +0 -48
- package/dist/ui/internal/theme.ts +0 -88
- package/dist/ui/public/inter-latin-ext.woff2 +0 -0
- package/dist/ui/public/inter-latin.woff2 +0 -0
package/package.json
CHANGED
|
@@ -1,70 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphenedata/cli",
|
|
3
|
-
"
|
|
4
|
-
"type": "module",
|
|
5
|
-
"author": "Graphene Systems Inc",
|
|
6
|
-
"version": "0.0.14",
|
|
3
|
+
"version": "0.0.16",
|
|
7
4
|
"license": "Elastic-2.0",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist",
|
|
13
|
-
"bin.js",
|
|
14
|
-
"package.json",
|
|
15
|
-
"LICENSE.md",
|
|
16
|
-
"THIRD_PARTY_NOTICES.md"
|
|
17
|
-
],
|
|
5
|
+
"author": "Graphene Systems Inc",
|
|
6
|
+
"type": "module",
|
|
18
7
|
"bin": {
|
|
19
8
|
"graphene": "./bin.js"
|
|
20
9
|
},
|
|
10
|
+
"main": "bin.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
21
12
|
"exports": {
|
|
22
13
|
"./ui": {
|
|
23
14
|
"browser": "./dist/ui/web.js"
|
|
24
15
|
}
|
|
25
16
|
},
|
|
26
|
-
"
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@clickhouse/client": "^1.18.2",
|
|
27
19
|
"@duckdb/node-api": "1.3.2-alpha.26",
|
|
28
|
-
"@google-cloud/bigquery": "^8.
|
|
20
|
+
"@google-cloud/bigquery": "^8.2.0",
|
|
21
|
+
"snowflake-sdk": "2.4.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependenciesMeta": {
|
|
24
|
+
"@clickhouse/client": {
|
|
25
|
+
"optional": true
|
|
26
|
+
},
|
|
27
|
+
"@duckdb/node-api": {
|
|
28
|
+
"optional": true
|
|
29
|
+
},
|
|
30
|
+
"@google-cloud/bigquery": {
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
"snowflake-sdk": {
|
|
34
|
+
"optional": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@fontsource/inter": "^5.2.8",
|
|
42
|
+
"@fontsource/jetbrains-mono": "^5.2.8",
|
|
43
|
+
"@fontsource/source-sans-3": "^5.2.9",
|
|
44
|
+
"@fontsource/source-serif-4": "^5.2.9",
|
|
29
45
|
"@graphenedata/html2canvas": "^1.4.1",
|
|
30
46
|
"@lezer/common": "^1.2.3",
|
|
31
47
|
"@lezer/lr": "^1.4.2",
|
|
32
48
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
33
|
-
"@tidyjs/tidy": "^2.5.2",
|
|
34
49
|
"chalk": "^5.3.0",
|
|
35
|
-
"chokidar": "3.6.0",
|
|
36
50
|
"chroma-js": "2.4.2",
|
|
51
|
+
"ci-info": "^4.4.0",
|
|
37
52
|
"cli-table3": "^0.6.3",
|
|
38
53
|
"commander": "^11.0.0",
|
|
39
|
-
"debounce": "^1.2.1",
|
|
40
54
|
"dotenv": "^17.2.3",
|
|
41
|
-
"echarts": "^
|
|
55
|
+
"echarts": "^6.0.0",
|
|
56
|
+
"entities": "^4.5.0",
|
|
42
57
|
"fs-extra": "11.2.0",
|
|
43
58
|
"glob": "^13.0.1",
|
|
44
|
-
"
|
|
59
|
+
"js-yaml": "^3.14.2",
|
|
60
|
+
"json5": "^2.2.3",
|
|
45
61
|
"mdsvex": "^0.12.6",
|
|
46
|
-
"nanoid": "3.3.8",
|
|
47
62
|
"sanitize-html": "^2.17.0",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"svelte": "5.48.0",
|
|
63
|
+
"svelte": "5.55.3",
|
|
64
|
+
"unified": "^11.0.5",
|
|
51
65
|
"unist-util-visit": "4.1.2",
|
|
52
|
-
"vite": "7.3.
|
|
66
|
+
"vite": "7.3.2",
|
|
53
67
|
"ws": "^8.18.0"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@types/fs-extra": "^11.0.4",
|
|
57
|
-
"@types/node": "^20.0.0",
|
|
58
|
-
"@types/sanitize-html": "^2.16.0",
|
|
59
|
-
"@types/ws": "^8.18.1",
|
|
60
|
-
"esbuild": "^0.27.2",
|
|
61
|
-
"vitest": "4.0.15",
|
|
62
|
-
"vscode-languageserver-types": "^3.17.0"
|
|
63
|
-
},
|
|
64
|
-
"scripts": {
|
|
65
|
-
"build": "rm -rf dist && rm -f *.tgz && node ./esbuild.mjs",
|
|
66
|
-
"test": "vitest run cli --root ..",
|
|
67
|
-
"test-one": "node ../scripts/turboTest.js",
|
|
68
|
-
"prepack": "pnpm run build"
|
|
69
68
|
}
|
|
70
69
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# RULES
|
|
2
|
-
|
|
3
|
-
**When formulating GSQL queries:**
|
|
4
|
-
- First check all available stored expressions to see if there are any you can use. DO NOT redefine important business definitions like `profit` if they've already been modeled!
|
|
5
|
-
- Run your GSQL queries in the CLI first, _before_ you write them to a file. This way you can reason about the results to make sure they make sense.
|
|
6
|
-
|
|
7
|
-
**When writing to a .gsql file:**
|
|
8
|
-
- ALWAYS check your code with `npm run graphene check`.
|
|
9
|
-
|
|
10
|
-
**When writing to a Graphene .md file:**
|
|
11
|
-
- ALWAYS check your code with `npm run graphene check [mdPath]`. Run the command with full permissions because the screenshot may not work in a sandbox.
|
|
12
|
-
- If `check` is successful, it will save a screenshot. Look at the screenshot and critique what you see:
|
|
13
|
-
- Are all the data values and axes labels formatted in a way that is easy to read?
|
|
14
|
-
- Does the shape of the visualized data require an adjustment to scale, axis min/max, axis split, etc.?
|
|
15
|
-
- Are metrics colored consistently across visualizations?
|
|
16
|
-
- Are any visualizations missing data altogether?
|
|
17
|
-
- Is that visualization type really the best way to illustrate the data?
|
|
18
|
-
- Are any visualizations redundant? Can you say the same thing with less?
|
package/dist/docs/base.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
Graphene is a framework for doing data analysis as code.
|
|
2
|
-
|
|
3
|
-
Schema definitions and semantic models are done in `.gsql`, dashboards in `.md`.
|
|
4
|
-
|
|
5
|
-
## GSQL
|
|
6
|
-
GSQL extends ansi sql with a few key features:
|
|
7
|
-
`table` statements define existing tables, adding joins and dimensions/measures
|
|
8
|
-
`table X as (select ...)` define a table as the result of a query
|
|
9
|
-
`extend` add measures and joins to an existing table, usually used with `table X as (select ...)`
|
|
10
|
-
Implicit joins: `from orders select status, user.name` will automatically join users on to orders
|
|
11
|
-
Measure expansion: `from users select id, orders.revenue` automatically expands to `select users.id, sum(orders.amount) ...`
|
|
12
|
-
- NEVER `sum(revenue)` or `group by revenue`
|
|
13
|
-
- OK: `floor(revenue)`, `revenue / cost`
|
|
14
|
-
`group by all` is implied, and does not need to be put in gsql
|
|
15
|
-
|
|
16
|
-
A few common features are not supported in gsql, and must be avoided: window functions, subqueries, CTEs.
|
|
17
|
-
|
|
18
|
-
```sql
|
|
19
|
-
table orders (
|
|
20
|
-
id BIGINT
|
|
21
|
-
user_id BIGINT
|
|
22
|
-
amount FLOAT
|
|
23
|
-
status STRING
|
|
24
|
-
join one users on user_id = users.id -- many orders per user
|
|
25
|
-
is_complete: status = 'Complete' -- dimension (scalar expression)
|
|
26
|
-
revenue: sum(amount) -- measure (agg expression)
|
|
27
|
-
avg_order: revenue / count(*) -- measures can compose
|
|
28
|
-
)
|
|
29
|
-
table users (
|
|
30
|
-
id BIGINT
|
|
31
|
-
name VARCHAR
|
|
32
|
-
join many orders on id = orders.user_id
|
|
33
|
-
)
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Dashboards
|
|
37
|
-
|
|
38
|
-
`.md` files with GSQL in code fences, viz components reference query names.
|
|
39
|
-
|
|
40
|
-
````md
|
|
41
|
-
```gsql monthly_sales
|
|
42
|
-
select date_trunc(created_at, month) as month, revenue from orders
|
|
43
|
-
```
|
|
44
|
-
<LineChart data="monthly_sales" x="month" y="revenue" />
|
|
45
|
-
<BigValue data="monthly_sales" value="revenue" />
|
|
46
|
-
````
|
|
47
|
-
|
|
48
|
-
`data` can be query name or table name. Attributes accept columns, expressions, or GSQL.
|
|
49
|
-
|
|
50
|
-
## Components
|
|
51
|
-
|
|
52
|
-
BarChart: data, x, y, y2, series, title, subtitle, xFmt, yFmt, y2Fmt, colorPalette, type, swapXY, labels, labelFmt, sort, legend, yMin, yMax
|
|
53
|
-
LineChart: data, x, y, y2, series, title, subtitle, xFmt, yFmt, colorPalette, labels, sort, legend, handleMissing, markers, markerShape, lineType, lineWidth
|
|
54
|
-
AreaChart: data, x, y, series, title, subtitle, xFmt, yFmt, colorPalette, type, labels, sort, legend, handleMissing, fillOpacity, line
|
|
55
|
-
PieChart: data, category, value, title, subtitle
|
|
56
|
-
BigValue: data, value, title, fmt, comparison, comparisonFmt, comparisonTitle, downIsGood, sparkline, sparklineType, sparklineColor
|
|
57
|
-
Table: data, rows, title, subtitle, groupBy, groupType, subtotals, totalRow, search, sort, link, rowShading, rowNumbers, compact, headerColor
|
|
58
|
-
Column: id, title, fmt, align, wrap, contentType, totalAgg, redNegatives
|
|
59
|
-
Dropdown: name, data, value, label, defaultValue, multiple, title
|
|
60
|
-
TextInput: name, title, placeholder
|
|
61
|
-
Row: layout container, distributes children horizontally
|
|
62
|
-
|
|
63
|
-
series: column whose values become separate lines/bars (series=country plots one line per country)
|
|
64
|
-
type: stacked (default), grouped, stacked100
|
|
65
|
-
y2: secondary y-axis, y2SeriesType sets its chart type (line/bar/scatter)
|
|
66
|
-
swapXY: horizontal bars
|
|
67
|
-
handleMissing: gap (default), connect, zero
|
|
68
|
-
colorPalette: comma-separated "#hex1, #hex2", applied to series in order
|
|
69
|
-
seriesOrder: control series order "Val1, Val2", pairs with colorPalette
|
|
70
|
-
labels: show value labels on chart
|
|
71
|
-
markers: show dots on line points; markerShape: circle, emptyCircle, rect, triangle, diamond
|
|
72
|
-
lineType: solid, dashed, dotted
|
|
73
|
-
downIsGood: green for negative (for comparison/delta)
|
|
74
|
-
sparkline: date column for mini trend; sparklineType: line, area, bar
|
|
75
|
-
groupBy: group table rows; groupType: accordion (collapsible) or section (merged)
|
|
76
|
-
totalRow: sum row at bottom; subtotals: sum row per group
|
|
77
|
-
link: make table rows clickable, value is URL column
|
|
78
|
-
|
|
79
|
-
Column contentType:
|
|
80
|
-
- delta: arrows+colors. deltaSymbol, downIsGood, chip, neutralMin/Max
|
|
81
|
-
- colorscale: background gradient. colorScale, colorMin/Mid/Max
|
|
82
|
-
- bar: in-cell bar. barColor, negativeBarColor
|
|
83
|
-
- link: clickable. linkLabel, openInNewTab
|
|
84
|
-
- image: show image. height, width
|
|
85
|
-
- sparkline/sparkarea/sparkbar: mini chart from array. sparkX, sparkY, sparkColor
|
|
86
|
-
|
|
87
|
-
Column totalAgg: sum (default), mean, weightedMean, median, min, max, count, countDistinct
|
|
88
|
-
|
|
89
|
-
Inputs: reference as $name in queries. `<Dropdown name=status .../>` -> `where status = $status`
|
|
90
|
-
|
|
91
|
-
## Formatting
|
|
92
|
-
|
|
93
|
-
`fmt` attr accepts Excel codes or built-ins:
|
|
94
|
-
Numbers: num0-num4, num0k, num0m, num0b
|
|
95
|
-
Currency: usd, usd0, usd1k, usd2m (also eur, gbp, etc)
|
|
96
|
-
Percent: pct, pct0, pct1, pct2
|
|
97
|
-
Dates: shortdate, longdate, mdy, dmy, mmm, yyyy
|
|
98
|
-
Excel: "$#,##0.00", "0.0%", "m/d/yy"
|
package/dist/docs/cli.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
## CLI
|
|
2
|
-
|
|
3
|
-
When using Graphene from the CLI, the main command would be:
|
|
4
|
-
|
|
5
|
-
`npm exec graphene check`
|
|
6
|
-
|
|
7
|
-
Use the appropriate package manager if this project doesn't use npm. `check` takes several options
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm exec graphene check # Syntax check entire project
|
|
11
|
-
npm exec graphene check [mdPath] # Check specific markdown file, and take a screenshot
|
|
12
|
-
npm exec graphene check [mdPath] -c [chartTitle] # Check and get a screenshot for one specific chart
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
`npm exec graphene run "<sql>"` can be used to run sql directly, without creating a md file.
|
|
16
|
-
`npm exec graphene compile "<sql>"` shows the compiled, dialect-specific SQL.
|
|
17
|
-
|
|
18
|
-
### Best Practices
|
|
19
|
-
|
|
20
|
-
Start simple - Get basic query working, then add complexity.
|
|
21
|
-
Use check often - Catches syntax errors and shows visual output.
|
|
22
|
-
Leverage models - Use modeled joins and stored expressions rather than raw SQL.
|