@lightdash/common 2.199.0 → 2.200.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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/ee/apps/sdkFeatures.d.ts +17 -0
- package/dist/cjs/ee/apps/sdkFeatures.d.ts.map +1 -1
- package/dist/cjs/ee/apps/sdkFeatures.js +33 -1
- package/dist/cjs/ee/apps/sdkFeatures.js.map +1 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/ee/apps/sdkFeatures.d.ts +17 -0
- package/dist/esm/ee/apps/sdkFeatures.d.ts.map +1 -1
- package/dist/esm/ee/apps/sdkFeatures.js +29 -0
- package/dist/esm/ee/apps/sdkFeatures.js.map +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/ee/apps/sdkFeatures.d.ts +17 -0
- package/dist/types/ee/apps/sdkFeatures.d.ts.map +1 -1
- package/dist/types/ee/apps/sdkFeatures.js +29 -0
- package/dist/types/ee/apps/sdkFeatures.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,21 @@
|
|
|
7
7
|
* (`features.test.ts`) fails CI when the two copies diverge. Same pattern as
|
|
8
8
|
* the dual dbt-YAML schemas.
|
|
9
9
|
*/
|
|
10
|
+
import { type DataAppTemplate } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Which kind of bundle a capability is meaningful for. Every bundle on a
|
|
13
|
+
* given SDK version reports the whole registry, so the host uses this to
|
|
14
|
+
* offer only what the app kind can use: a chart type never runs queries or
|
|
15
|
+
* exports to Sheets, an app never receives a viz context.
|
|
16
|
+
*/
|
|
17
|
+
export type SdkFeatureTarget = 'data_app' | 'chart_type';
|
|
18
|
+
export declare const SDK_FEATURE_TARGETS: SdkFeatureTarget[];
|
|
10
19
|
export type SdkFeature = {
|
|
11
20
|
key: string;
|
|
12
21
|
label: string;
|
|
13
22
|
description: string;
|
|
23
|
+
/** Non-empty; features used by both kinds list both targets. */
|
|
24
|
+
appliesTo: SdkFeatureTarget[];
|
|
14
25
|
/** Agent-facing note on the app-code wiring the feature needs before the
|
|
15
26
|
* host can use it (absent = zero wiring; it activates automatically once
|
|
16
27
|
* the bundle runs on a current SDK). Never rendered in user-facing UI. */
|
|
@@ -18,4 +29,10 @@ export type SdkFeature = {
|
|
|
18
29
|
};
|
|
19
30
|
export declare const SDK_FEATURES: SdkFeature[];
|
|
20
31
|
export declare const SDK_FEATURE_KEYS: string[];
|
|
32
|
+
export declare const sdkFeatureAppliesTo: (feature: Pick<SdkFeature, 'appliesTo'>, target: SdkFeatureTarget) => boolean;
|
|
33
|
+
/** The registry entries an upgrade may offer to a bundle of this kind. */
|
|
34
|
+
export declare const getSdkFeaturesForTarget: (target: SdkFeatureTarget) => SdkFeature[];
|
|
35
|
+
/** Custom chart types are the `data_app_viz` template; every other template
|
|
36
|
+
* (including pre-template `null`) is a data app. */
|
|
37
|
+
export declare const getSdkFeatureTargetForTemplate: (template: DataAppTemplate | null | undefined) => SdkFeatureTarget;
|
|
21
38
|
//# sourceMappingURL=sdkFeatures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkFeatures.d.ts","sourceRoot":"","sources":["../../../../src/ee/apps/sdkFeatures.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB;;+EAE2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"sdkFeatures.d.ts","sourceRoot":"","sources":["../../../../src/ee/apps/sdkFeatures.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,CAAC;AAEzD,eAAO,MAAM,mBAAmB,EAAE,gBAAgB,EAGjD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B;;+EAE2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,UAAU,EAwIpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAAmC,CAAC;AAEzE,eAAO,MAAM,mBAAmB,YACnB,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,UAC9B,gBAAgB,KACzB,OAA6C,CAAC;AAEjD,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,WACxB,gBAAgB,KACzB,UAAU,EAAgE,CAAC;AAE9E;qDACqD;AACrD,eAAO,MAAM,8BAA8B,aAC7B,eAAe,GAAG,IAAI,GAAG,SAAS,KAC7C,gBAC+D,CAAC"}
|
|
@@ -9,107 +9,139 @@
|
|
|
9
9
|
* the dual dbt-YAML schemas.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SDK_FEATURE_KEYS = exports.SDK_FEATURES = void 0;
|
|
12
|
+
exports.getSdkFeatureTargetForTemplate = exports.getSdkFeaturesForTarget = exports.sdkFeatureAppliesTo = exports.SDK_FEATURE_KEYS = exports.SDK_FEATURES = exports.SDK_FEATURE_TARGETS = void 0;
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
exports.SDK_FEATURE_TARGETS = [
|
|
15
|
+
'data_app',
|
|
16
|
+
'chart_type',
|
|
17
|
+
];
|
|
13
18
|
exports.SDK_FEATURES = [
|
|
14
19
|
{
|
|
15
20
|
key: 'query',
|
|
21
|
+
appliesTo: ['data_app'],
|
|
16
22
|
label: 'Semantic layer queries',
|
|
17
23
|
description: 'Run metric and dimension queries against the Lightdash semantic layer.',
|
|
18
24
|
},
|
|
19
25
|
{
|
|
20
26
|
key: 'metric-filters',
|
|
27
|
+
appliesTo: ['data_app'],
|
|
21
28
|
label: 'Metric filters',
|
|
22
29
|
description: 'Filter grouped query results by metric values, including metrics used only as filters.',
|
|
23
30
|
wiring: 'Pass metric filter rules to query(...).metricFilters([...]); keep dimension filter rules in .filters([...]).',
|
|
24
31
|
},
|
|
25
32
|
{
|
|
26
33
|
key: 'saved-chart',
|
|
34
|
+
appliesTo: ['data_app'],
|
|
27
35
|
label: 'Saved chart queries',
|
|
28
36
|
description: 'Fetch results from existing saved charts instead of ad-hoc queries.',
|
|
29
37
|
},
|
|
30
38
|
{
|
|
31
39
|
key: 'drill-down',
|
|
40
|
+
appliesTo: ['data_app'],
|
|
32
41
|
label: 'Drill-down helper',
|
|
33
42
|
description: 'Derive drill-down queries from a clicked result row to build explore-style interactions.',
|
|
34
43
|
},
|
|
35
44
|
{
|
|
36
45
|
key: 'inspect',
|
|
46
|
+
appliesTo: ['data_app'],
|
|
37
47
|
label: 'Element inspection',
|
|
38
48
|
description: 'Lets the Lightdash editor highlight and select app elements to reference them in prompts.',
|
|
39
49
|
},
|
|
40
50
|
{
|
|
41
51
|
key: 'lineage',
|
|
52
|
+
appliesTo: ['data_app'],
|
|
42
53
|
label: 'Inspect data',
|
|
43
54
|
description: 'Click any chart to trace it back to the query and fields behind it, from the Inspect data button in the editor.',
|
|
44
55
|
wiring: "Spread the `lineage` props returned by useLightdash onto each query-bound block's root element; without these stamps the host's Inspect data button stays disabled.",
|
|
45
56
|
},
|
|
46
57
|
{
|
|
47
58
|
key: 'screenshot',
|
|
59
|
+
appliesTo: ['data_app', 'chart_type'],
|
|
48
60
|
label: 'In-app screenshots',
|
|
49
61
|
description: 'Lets the host rasterize the app to an image for thumbnails and scheduled deliveries.',
|
|
50
62
|
},
|
|
51
63
|
{
|
|
52
64
|
key: 'external-fetch',
|
|
65
|
+
appliesTo: ['data_app'],
|
|
53
66
|
label: 'External data fetch',
|
|
54
67
|
description: 'Fetch approved external HTTP data sources through the Lightdash proxy.',
|
|
55
68
|
},
|
|
56
69
|
{
|
|
57
70
|
key: 'gsheet-export',
|
|
71
|
+
appliesTo: ['data_app'],
|
|
58
72
|
label: 'Google Sheets export',
|
|
59
73
|
description: 'Export tabular results from the app straight to Google Sheets.',
|
|
60
74
|
},
|
|
61
75
|
{
|
|
62
76
|
key: 'url-state',
|
|
77
|
+
appliesTo: ['data_app'],
|
|
63
78
|
label: 'Shareable URL state',
|
|
64
79
|
description: 'Sync in-app state to the page URL so app views can be shared and restored.',
|
|
65
80
|
},
|
|
66
81
|
{
|
|
67
82
|
key: 'viz-context',
|
|
83
|
+
appliesTo: ['chart_type'],
|
|
68
84
|
label: 'Dashboard visualization context',
|
|
69
85
|
description: 'Receive query context when app visualizations are embedded in dashboards.',
|
|
70
86
|
},
|
|
71
87
|
{
|
|
72
88
|
key: 'viz-config-options',
|
|
89
|
+
appliesTo: ['chart_type'],
|
|
73
90
|
label: 'Visualization config options',
|
|
74
91
|
description: "Let viewers adjust the visualization from the Lightdash config panel — toggles, dropdowns, numbers, text and colours — and take series colours from the chart's palette, without regenerating the app.",
|
|
75
92
|
wiring: 'Declare configOptions (and colorPalette, if the viz colours series) in the viz schema, then read options[name] and colorPalette from useVizContext().',
|
|
76
93
|
},
|
|
77
94
|
{
|
|
78
95
|
key: 'viz-pivoted-results',
|
|
96
|
+
appliesTo: ['chart_type'],
|
|
79
97
|
label: 'Pivoted results',
|
|
80
98
|
description: 'Render reusable charts and tables from backend-pivoted rows and their complete layout metadata.',
|
|
81
99
|
wiring: 'When useVizContext().pivotDetails is non-null, use valuesColumns to resolve generated row keys and use indexColumn, groupByColumns, originalColumns, sortBy, totalColumnCount, and passthroughDimensions when the visualization needs their layout semantics. Keep the existing fieldMapping path when pivotDetails is null.',
|
|
82
100
|
},
|
|
83
101
|
{
|
|
84
102
|
key: 'viz-resolved-colors',
|
|
103
|
+
appliesTo: ['chart_type'],
|
|
85
104
|
label: 'Consistent visualization colors',
|
|
86
105
|
description: 'Honor model-defined colors and shared dashboard color assignments in reusable visualizations.',
|
|
87
106
|
wiring: 'Use resolveSeriesColor(context, column, index) for backend-pivoted series and resolveValueColor(context, fieldId, rawValue, index) for client-side groups; both helpers fall back to colorPalette.',
|
|
88
107
|
},
|
|
89
108
|
{
|
|
90
109
|
key: 'follow-host-theme',
|
|
110
|
+
appliesTo: ['data_app', 'chart_type'],
|
|
91
111
|
label: 'Follow the host light/dark mode',
|
|
92
112
|
description: "Match the light or dark mode of the viewer's Lightdash (or embed) instead of a fixed theme, and restyle live when they switch.",
|
|
93
113
|
wiring: 'Keep complete light tokens in :root and dark tokens in .dark, remove any fixed dark class from the app shell, and use useColorScheme() only for colours that cannot be expressed in CSS.',
|
|
94
114
|
},
|
|
95
115
|
{
|
|
96
116
|
key: 'delivery-render',
|
|
117
|
+
appliesTo: ['data_app'],
|
|
97
118
|
label: 'Full data in scheduled deliveries',
|
|
98
119
|
description: "Scheduled deliveries and their preview render every tab or slide's data, not just the one currently visible.",
|
|
99
120
|
wiring: "Gate tab/slide content so DATA components for all tabs mount when useDeliveryRender() is true — tabs switch what's shown, not what's fetched. Never mount all tabs unconditionally.",
|
|
100
121
|
},
|
|
101
122
|
{
|
|
102
123
|
key: 'viz-underlying-data',
|
|
124
|
+
appliesTo: ['chart_type'],
|
|
103
125
|
label: 'View underlying data',
|
|
104
126
|
description: 'Open the raw result rows behind a clicked data point in a reusable visualization, with CSV/XLSX download.',
|
|
105
127
|
wiring: 'In the viz, keep the untransformed source row on each interactive datum, show a data-point action menu only when useVizContext().underlyingData.enabled and the mark maps to exactly one source row, render underlyingData.get({ row, metric }) in a themed dialog, and wire its Download button to underlyingData.download.',
|
|
106
128
|
},
|
|
107
129
|
{
|
|
108
130
|
key: 'viz-drill-down',
|
|
131
|
+
appliesTo: ['chart_type'],
|
|
109
132
|
label: 'Drill into data points',
|
|
110
133
|
description: 'Drill into a clicked data point in a reusable visualization — pick a dimension in Lightdash and open the drilled view in explore.',
|
|
111
134
|
wiring: 'Show a "Drill into …" item in the data-point action menu only when useVizContext().drillDown.enabled and the mark maps to exactly one source row, and call drillDown.open({ row: datum.sourceRow, metric: "<field name>" }) on selection. The host opens its drill dialog — render no dialog in the viz and never render a disabled item.',
|
|
112
135
|
},
|
|
113
136
|
];
|
|
114
137
|
exports.SDK_FEATURE_KEYS = exports.SDK_FEATURES.map((f) => f.key);
|
|
138
|
+
const sdkFeatureAppliesTo = (feature, target) => feature.appliesTo.includes(target);
|
|
139
|
+
exports.sdkFeatureAppliesTo = sdkFeatureAppliesTo;
|
|
140
|
+
/** The registry entries an upgrade may offer to a bundle of this kind. */
|
|
141
|
+
const getSdkFeaturesForTarget = (target) => exports.SDK_FEATURES.filter((f) => (0, exports.sdkFeatureAppliesTo)(f, target));
|
|
142
|
+
exports.getSdkFeaturesForTarget = getSdkFeaturesForTarget;
|
|
143
|
+
/** Custom chart types are the `data_app_viz` template; every other template
|
|
144
|
+
* (including pre-template `null`) is a data app. */
|
|
145
|
+
const getSdkFeatureTargetForTemplate = (template) => template === types_1.DATA_APP_VIZ_TEMPLATE ? 'chart_type' : 'data_app';
|
|
146
|
+
exports.getSdkFeatureTargetForTemplate = getSdkFeatureTargetForTemplate;
|
|
115
147
|
//# sourceMappingURL=sdkFeatures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkFeatures.js","sourceRoot":"","sources":["../../../../src/ee/apps/sdkFeatures.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;
|
|
1
|
+
{"version":3,"file":"sdkFeatures.js","sourceRoot":"","sources":["../../../../src/ee/apps/sdkFeatures.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,mCAAsE;AAUzD,QAAA,mBAAmB,GA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