@lightdash/cli 2.198.5 → 2.199.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/README.md +16 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/handlers/validate.d.ts.map +1 -1
- package/dist/handlers/validate.js +1 -22
- package/dist/handlers/validate.test.js +36 -18
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/handlers/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,OAAO,EACP,YAAY,EASZ,kBAAkB,EAElB,gBAAgB,EACnB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAW,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAU3D,eAAO,MAAM,iBAAiB,gBACb,MAAM,YACT,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,qBACjB,gBAAgB,EAAE;;EAMnC,CAAC;AAEP,eAAO,MAAM,WAAW,YAAmB,MAAM;;;EAK3C,CAAC;AAEP,eAAO,MAAM,aAAa,gBAAuB,MAAM,SAAS,MAAM,8DAKhE,CAAC;AAmCP,eAAO,MAAM,qBAAqB,YAAI,OAAO,EAAE,SAAS,CAAU,CAAC;AACnE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,6CAA6C,2FACkC,CAAC;AAE7F,KAAK,sBAAsB,GAAG,qBAAqB,GAAG;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,wBAAwB,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,EAAE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AAO,CAAC;IACjB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,wBAAwB,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,IAAI,CACT,sBAAsB,EACtB,UAAU,GAAG,gCAAgC,CAChD,GACF,kBAAkB,CAKpB;AAED,KAAK,wBAAwB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,KAAK,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,iBAAiB,iDAI3B,wBAAwB,KAAG,OAAO,CAAC,MAAM,CAY3C,CAAC;AAEF,eAAO,MAAM,eAAe,oBACP,sBAAsB,kBAoW1C,CAAC"}
|
|
@@ -114,28 +114,7 @@ const validateHandler = async (originalOptions) => {
|
|
|
114
114
|
}
|
|
115
115
|
options.disableTimestampConversion =
|
|
116
116
|
await (0, timestampConversion_1.getProjectDisableTimestampConversion)(options.disableTimestampConversion, projectUuid);
|
|
117
|
-
|
|
118
|
-
const hasPartialModelSelection = Boolean(options.select?.length) ||
|
|
119
|
-
Boolean(options.models?.length) ||
|
|
120
|
-
Boolean(options.exclude?.length) ||
|
|
121
|
-
Boolean(options.selector);
|
|
122
|
-
const includesDataAppValidation = validationTargets.length === 0 ||
|
|
123
|
-
validationTargets.includes(common_1.ValidationTarget.APPS);
|
|
124
|
-
if (hasPartialModelSelection && includesDataAppValidation) {
|
|
125
|
-
if (validationTargets.length === 1 &&
|
|
126
|
-
validationTargets[0] === common_1.ValidationTarget.APPS) {
|
|
127
|
-
throw new common_1.ParameterError('Data app validation requires a full project compile. Remove the dbt model selection flags to use --only apps.');
|
|
128
|
-
}
|
|
129
|
-
validationTargets =
|
|
130
|
-
validationTargets.length === 0
|
|
131
|
-
? [
|
|
132
|
-
common_1.ValidationTarget.TABLES,
|
|
133
|
-
common_1.ValidationTarget.CHARTS,
|
|
134
|
-
common_1.ValidationTarget.DASHBOARDS,
|
|
135
|
-
]
|
|
136
|
-
: validationTargets.filter((target) => target !== common_1.ValidationTarget.APPS);
|
|
137
|
-
console.error(styles.warning('> Skipping data app validation because dbt model selection flags produce a partial semantic layer'));
|
|
138
|
-
}
|
|
117
|
+
const validationTargets = options.only ? [...options.only] : [];
|
|
139
118
|
await analytics_1.LightdashAnalytics.track({
|
|
140
119
|
event: 'validate.started',
|
|
141
120
|
properties: {
|
|
@@ -73,7 +73,7 @@ const brokenChartError = {
|
|
|
73
73
|
lastUpdatedBy: 'Ada Lovelace',
|
|
74
74
|
lastUpdatedAt: new Date('2026-08-06T15:30:00Z'),
|
|
75
75
|
};
|
|
76
|
-
describe('validateHandler
|
|
76
|
+
describe('validateHandler', () => {
|
|
77
77
|
let errorOutput;
|
|
78
78
|
let validationResults = [];
|
|
79
79
|
const skipWarnings = () => errorOutput.filter((line) => line.includes('Skipping warehouse column validation'));
|
|
@@ -165,31 +165,46 @@ describe('validateHandler warehouse column validation', () => {
|
|
|
165
165
|
expect(compile_1.compile).toHaveBeenCalledWith(expect.objectContaining({ validateWarehouseColumns: false }));
|
|
166
166
|
expect(skipWarnings()).toEqual([]);
|
|
167
167
|
});
|
|
168
|
-
test(
|
|
168
|
+
test.each([
|
|
169
|
+
{ select: ['orders'] },
|
|
170
|
+
{ models: ['orders'] },
|
|
171
|
+
{ exclude: ['customers'] },
|
|
172
|
+
{ selector: 'marts' },
|
|
173
|
+
])('validates data apps with model selection %j', async (selection) => {
|
|
174
|
+
const only = [common_1.ValidationTarget.CHARTS, common_1.ValidationTarget.APPS];
|
|
169
175
|
await (0, validate_1.validateHandler)({
|
|
170
176
|
...baseOptions,
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
...selection,
|
|
178
|
+
only,
|
|
173
179
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
validationTargets: [common_1.ValidationTarget.CHARTS],
|
|
180
|
+
expect(compile_1.compile).toHaveBeenCalledTimes(1);
|
|
181
|
+
expect(compile_1.compile).toHaveBeenCalledWith(expect.objectContaining(selection));
|
|
182
|
+
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith(expect.objectContaining({
|
|
183
|
+
method: 'POST',
|
|
184
|
+
url: `/api/v1/projects/${baseOptions.project}/validate`,
|
|
185
|
+
body: JSON.stringify({ explores: [], validationTargets: only }),
|
|
181
186
|
}));
|
|
182
|
-
expect(errorOutput.some((line) => line.includes('Skipping data app validation'))).toBe(true);
|
|
183
187
|
});
|
|
184
|
-
test(
|
|
185
|
-
|
|
188
|
+
test.each([
|
|
189
|
+
{ only: [] },
|
|
190
|
+
{ only: Object.values(common_1.ValidationTarget) },
|
|
191
|
+
{ only: [common_1.ValidationTarget.APPS] },
|
|
192
|
+
])('preserves validation targets %j with model selection', async ({ only }) => {
|
|
193
|
+
await (0, validate_1.validateHandler)({
|
|
186
194
|
...baseOptions,
|
|
187
|
-
only
|
|
195
|
+
only,
|
|
188
196
|
select: ['orders'],
|
|
189
|
-
})
|
|
190
|
-
expect(
|
|
197
|
+
});
|
|
198
|
+
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith(expect.objectContaining({
|
|
199
|
+
method: 'POST',
|
|
200
|
+
url: `/api/v1/projects/${baseOptions.project}/validate`,
|
|
201
|
+
body: JSON.stringify({
|
|
202
|
+
explores: [],
|
|
203
|
+
validationTargets: only,
|
|
204
|
+
}),
|
|
205
|
+
}));
|
|
191
206
|
});
|
|
192
|
-
test('prints the latest
|
|
207
|
+
test('fails selected apps-only validation and prints the latest version author and date', async () => {
|
|
193
208
|
vi.spyOn(process, 'exit').mockImplementation(() => undefined);
|
|
194
209
|
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ method, url }) => {
|
|
195
210
|
if (method === 'POST' && url.endsWith('/validate')) {
|
|
@@ -223,8 +238,11 @@ describe('validateHandler warehouse column validation', () => {
|
|
|
223
238
|
await (0, validate_1.validateHandler)({
|
|
224
239
|
...baseOptions,
|
|
225
240
|
only: [common_1.ValidationTarget.APPS],
|
|
241
|
+
select: ['orders'],
|
|
226
242
|
});
|
|
243
|
+
expect(process.exit).toHaveBeenCalledWith(1);
|
|
227
244
|
const output = errorOutput.join('\n');
|
|
245
|
+
expect(output).toContain('Dimension does not exist');
|
|
228
246
|
expect(output).toContain('Ada Lovelace');
|
|
229
247
|
expect(output).toContain('2026-08-06');
|
|
230
248
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.199.0",
|
|
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.
|
|
26
|
-
"@lightdash/warehouses": "2.
|
|
25
|
+
"@lightdash/common": "2.199.0",
|
|
26
|
+
"@lightdash/warehouses": "2.199.0",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|