@lightdash/cli 3.97.0 → 3.98.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/dist/.tsbuildinfo.build +1 -1
- package/dist/handlers/apps/previewProxy.d.ts.map +1 -1
- package/dist/handlers/apps/previewProxy.js +33 -0
- package/dist/vendor/template/.claude/skills/sdk-features/SKILL.md +11 -0
- package/dist/vendor/template/references/chart-references.md +13 -0
- package/dist/vendor/template/skill.md +2 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewProxy.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/previewProxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"previewProxy.d.ts","sourceRoot":"","sources":["../../../src/handlers/apps/previewProxy.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AA6CtE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,qBAAqB,GAAG;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAG5B,0BAA0B,EAAE,MAAM,EAAE,CAAC;CACxC,CAAC;AAyCF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,SAAU;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IAGd,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC5D,KAAG,OAAO,CAAC,kBAAkB,CA4Z7B,CAAC"}
|
|
@@ -221,6 +221,31 @@ const startPreviewProxy = (args) => {
|
|
|
221
221
|
res.writeHead(200, { 'content-type': 'application/json' });
|
|
222
222
|
res.end(JSON.stringify({ status: 'ok', results }));
|
|
223
223
|
};
|
|
224
|
+
// Host-answered virtual route: resolves a slug-or-uuid space reference
|
|
225
|
+
// to its trimmed chart list with the developer's credentials. Unknown
|
|
226
|
+
// space, no access, and upstream failure all answer uniformly empty —
|
|
227
|
+
// same face as the deployed app's bridge.
|
|
228
|
+
const answerSpaceCharts = async (req, res) => {
|
|
229
|
+
const request = (0, common_1.parseAppSdkSpaceChartsRequest)(parseJson(await readBody(req)));
|
|
230
|
+
if (request === null) {
|
|
231
|
+
sendJsonError(res, 400, 'Preview proxy: invalid space-charts request');
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
let results = (0, common_1.emptyAppSdkSpaceCharts)();
|
|
235
|
+
try {
|
|
236
|
+
const spaces = await getUpstreamJson(`/api/v1/projects/${encodeURIComponent(args.projectUuid)}/spaces`);
|
|
237
|
+
const spaceUuid = (0, common_1.resolveAppSdkSpaceUuid)(spaces, request.space);
|
|
238
|
+
if (spaceUuid !== null) {
|
|
239
|
+
const space = await getUpstreamJson(`/api/v1/projects/${encodeURIComponent(args.projectUuid)}/spaces/${encodeURIComponent(spaceUuid)}`);
|
|
240
|
+
results = (0, common_1.extractAppSdkSpaceCharts)(space) ?? results;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// Keep the uniform empty answer.
|
|
245
|
+
}
|
|
246
|
+
res.writeHead(200, { 'content-type': 'application/json' });
|
|
247
|
+
res.end(JSON.stringify({ status: 'ok', results }));
|
|
248
|
+
};
|
|
224
249
|
const handleRequest = async (req, res) => {
|
|
225
250
|
const method = req.method ?? 'GET';
|
|
226
251
|
const nonceHeader = req.headers[exports.PREVIEW_PROXY_NONCE_HEADER];
|
|
@@ -238,6 +263,14 @@ const startPreviewProxy = (args) => {
|
|
|
238
263
|
sendJsonError(res, 400, 'Preview proxy: malformed request URL');
|
|
239
264
|
return;
|
|
240
265
|
}
|
|
266
|
+
if (pathname === common_1.APP_SDK_SPACE_CHARTS_PATH) {
|
|
267
|
+
answerSpaceCharts(req, res).catch(() => {
|
|
268
|
+
if (!res.headersSent) {
|
|
269
|
+
sendJsonError(res, 400, 'Preview proxy: invalid space-charts request');
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
241
274
|
if (pathname === common_1.APP_SDK_EXPLORE_BASE_TABLE_PATH) {
|
|
242
275
|
answerExploreBaseTable(req, res).catch(() => {
|
|
243
276
|
if (!res.headersSent) {
|
|
@@ -34,6 +34,7 @@ Users describe features by what they see in the Lightdash editor. Translate:
|
|
|
34
34
|
| Lightdash-owned "View underlying data" dialog (viz only) | `viz-host-underlying-data` | app code opt-in |
|
|
35
35
|
| light/dark mode, "matches my Lightdash theme" | `follow-host-theme` | CSS tokens — see below |
|
|
36
36
|
| "executive summary", "what changed", anomaly callouts, "AI insight", "Analyse this view" | `ai-insights` | app code opt-in |
|
|
37
|
+
| chart gallery, "my charts", "show the charts in this space", list that updates as charts are saved | `space-charts` | app code opt-in |
|
|
37
38
|
| "Adapts to small tiles", responsive, works on a phone, readable in a narrow or short tile (viz only) | `viz-responsive-layout` | layout — see below |
|
|
38
39
|
|
|
39
40
|
## Automatic (zero wiring — active on any current-SDK bundle)
|
|
@@ -207,6 +208,16 @@ order, `sortBy` describes result ordering, `totalColumnCount` exposes truncation
|
|
|
207
208
|
plain text. `result` is the object `useLightdash` returns (keep a reference
|
|
208
209
|
to it even when destructuring), never a rebuilt `{ data, columns }`. Hide the control when `available` is false; trigger from a user
|
|
209
210
|
action. Full contract in `/app/references/ai-analysis.md`.
|
|
211
|
+
- `space-charts`: `useSpaceCharts('<space slug or uuid>')` returns
|
|
212
|
+
`{ available, space, charts, loading, error, refresh }` — the saved charts
|
|
213
|
+
the viewer can see in that space, resolved at runtime with the viewer's own
|
|
214
|
+
permissions (an inaccessible space answers like a missing one: `space: null`,
|
|
215
|
+
no charts). Each entry carries `{ uuid, name, description, chartKind, slug,
|
|
216
|
+
updatedAt }`; pass `chart.uuid` to `savedChart(...)` to render one. Use it
|
|
217
|
+
for galleries that must pick up newly saved charts without a rebuild; keep
|
|
218
|
+
explicit `savedChart('<uuid>')` references for charts the app lays out by
|
|
219
|
+
hand. Render a friendly empty state for `charts.length === 0` and hide the
|
|
220
|
+
section when `available` is false (older host).
|
|
210
221
|
- `delivery-render`: `useDeliveryRender()` is `true` during scheduled-delivery
|
|
211
222
|
and delivery-preview capture renders. Gate tab/slide DATA mounting on it so
|
|
212
223
|
every tab's queries execute during capture while only the active tab stays
|
|
@@ -87,6 +87,19 @@ A linked chart stays in sync with Lightdash and appears in the Queries panel
|
|
|
87
87
|
like any other query. If it can't be run (deleted / no access), the app should
|
|
88
88
|
show its normal error state — don't fabricate data.
|
|
89
89
|
|
|
90
|
+
### Discovering charts at runtime (`useSpaceCharts`)
|
|
91
|
+
|
|
92
|
+
When the user wants a gallery or "my charts" page that picks up charts saved
|
|
93
|
+
to a space **after** the app is built, don't hardcode a UUID list — list the
|
|
94
|
+
space at runtime: `useSpaceCharts('<space slug or uuid>')` returns
|
|
95
|
+
`{ available, space, charts, loading, error, refresh }`, scoped to what the
|
|
96
|
+
viewer can access (an inaccessible space answers `space: null` with no
|
|
97
|
+
charts). Pass an entry's `uuid` to `savedChart(...)` to render it, and treat
|
|
98
|
+
every such chart as LINKED: data-driven and crash-proof per the rules below,
|
|
99
|
+
since its shape is unknown at build time. Render an empty state for zero
|
|
100
|
+
charts and hide the section when `available` is false. The recipe lives in
|
|
101
|
+
the `sdk-features` skill under `space-charts`.
|
|
102
|
+
|
|
90
103
|
### Linked charts must be DATA-DRIVEN and crash-proof
|
|
91
104
|
|
|
92
105
|
A linked chart's query can change in Lightdash *after* the app is generated (the
|
|
@@ -220,6 +220,8 @@ These metrics are **not additive over time**. A balance on Monday plus the balan
|
|
|
220
220
|
|
|
221
221
|
If the prompt lists referenced charts (files under `/tmp/metric-queries/*.json`), read `/app/references/chart-references.md` before writing any query code — it defines the JSON shape, linked-vs-copied chart semantics (`savedChart`), and the field-id mapping rules.
|
|
222
222
|
|
|
223
|
+
If the user asks for a page that lists or renders **whatever charts a Lightdash space contains** (a gallery, "my charts", "charts from the Sales space") — i.e. the set should grow as charts are saved, without rebuilding the app — use `useSpaceCharts('<space slug or uuid>')` and read "Discovering charts at runtime" in `/app/references/chart-references.md`. Never hardcode a UUID list for that ask.
|
|
224
|
+
|
|
223
225
|
## Attached dashboard blueprint
|
|
224
226
|
|
|
225
227
|
If the prompt announces an attached dashboard (blueprint at `/tmp/dashboard/blueprint.json`), read `/app/references/dashboard-blueprint.md` before designing any layout — the blueprint defines the dashboard's tabs, tile grid, and filters, and it is the layout spec to recreate unless the user asks for a different design.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.98.1",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@actions/core": "1.11.1",
|
|
23
23
|
"@aws-sdk/credential-providers": "3.995.0",
|
|
24
24
|
"@casl/ability": "6.8.0",
|
|
25
|
-
"@lightdash/common": "3.
|
|
26
|
-
"@lightdash/warehouses": "3.
|
|
25
|
+
"@lightdash/common": "3.98.1",
|
|
26
|
+
"@lightdash/warehouses": "3.98.1",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|