@lightdash/cli 2.360.0 → 2.360.2

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.
@@ -9,10 +9,21 @@ You are editing a Lightdash **custom chart type** (a reusable visualization, the
9
9
 
10
10
  ## The contract is the reusable-visualization skill
11
11
 
12
- Read the `reusable-visualization` skill before editing. It defines everything the component may do: `useVizContext()` is the only channel to the host (data, options, resolved colours), the component runs no query, owns no explore, and never fetches anything itself. App-level SDK APIs (query builder, `useLightdash`, filters, `externalFetch`) do not apply here and must not be introduced.
12
+ Read the `reusable-visualization` skill before editing. It defines everything the component may do: `useVizContext()` is the only channel to the host for data, options and resolved colours; the component runs no query and owns no explore. App-level query APIs (query builder, `useLightdash`, filters) do not apply here and must not be introduced.
13
13
 
14
14
  Never hand-build a data-point action menu when `useVizContext().pointMenu.enabled` — call `pointMenu.open({ x, y, row, metric })` and let Lightdash render it; an in-viz menu is only the fallback for hosts that predate the capability.
15
15
 
16
+ ## External HTTP APIs go through linked connections
17
+
18
+ A chart type's rows always come from `useVizContext()`. Anything else it needs from outside Lightdash, such as reference data from a third-party API or images from a URL, goes through an **external connection**, the same way it does for data apps.
19
+
20
+ - The one sanctioned path to a third-party API is `client.externalFetch('<alias>', ...)`, with the client from `useLightdashClient()`, against an external connection a project admin configured and linked to this chart type. Do not add direct `fetch` or REST calls; the sandbox blocks them.
21
+ - Images load only from a linked connection that has public images enabled, from its exact origin. Never put Lightdash data in an image URL.
22
+ - Links are declared in this folder's `lightdash-app.yml` under `externalConnections` (`- alias: stripe` / `connectionSlug: stripe-api`). When the key is present, upload reconciles the chart type's links to match it exactly, so to link a connection that **already exists in the project**, add its `{alias, connectionSlug}` entry and upload. Do not remove entries casually: an entry removed from the list (or an empty list) unlinks on upload, and a manifest without the key leaves links unchanged.
23
+ - Watch the upload output: a `connectionSlug` that doesn't exist in the target project is skipped with a warning (the chart type uploads, but `externalFetch` on that alias fails at runtime). If a link is skipped or forbidden, report it to the user instead of retrying.
24
+ - If the chart type needs an API with **no existing connection**, **stop and say so**. An admin must create the connection first; then it can be linked via the manifest as above.
25
+ - Connections are not emulated by the local fixture preview. Test them after upload, in the explorer.
26
+
16
27
  ## The declaration lives in lightdash-app.yml — keep it in lockstep
17
28
 
18
29
  In the in-product builder the declaration is emitted by the generation run; **locally it is the `vizSchema` block in this folder's `lightdash-app.yml`**, and upload round-trips it to the server (without it the chart type never appears in the explorer's chart type picker).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "2.360.0",
3
+ "version": "2.360.2",
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": "2.360.0",
26
- "@lightdash/warehouses": "2.360.0",
25
+ "@lightdash/common": "2.360.2",
26
+ "@lightdash/warehouses": "2.360.2",
27
27
  "@sidvind/better-ajv-errors": "7.0.0",
28
28
  "@types/columnify": "1.5.1",
29
29
  "ajv": "8.18.0",