@lightdash/cli 2.18.2 → 2.20.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.
@@ -10,6 +10,7 @@ export declare const getJobState: (jobUuid: string) => Promise<{
10
10
  export declare const getValidation: (projectUuid: string, jobId: string) => Promise<import("@lightdash/common").ValidationResponse[]>;
11
11
  export declare const VALIDATION_SEVERITIES: readonly ['error', 'warning'];
12
12
  export type ValidationSeverity = (typeof VALIDATION_SEVERITIES)[number];
13
+ export declare const SHOW_CHART_CONFIGURATION_WARNINGS_DEPRECATION = "`--show-chart-configuration-warnings` is deprecated. Use `--severity warning` instead.";
13
14
  type ValidateHandlerOptions = CompileHandlerOptions & {
14
15
  project?: string;
15
16
  verbose: boolean;
@@ -17,9 +18,11 @@ type ValidateHandlerOptions = CompileHandlerOptions & {
17
18
  only: ValidationTarget[];
18
19
  validateWarehouseColumns: boolean;
19
20
  severity?: ValidationSeverity;
21
+ showChartConfigurationWarnings?: boolean;
20
22
  includeSpaces?: string[];
21
23
  excludeSpaces?: string[];
22
24
  };
25
+ export declare function resolveValidateSeverity(options: Pick<ValidateHandlerOptions, 'severity' | 'showChartConfigurationWarnings'>): ValidationSeverity;
23
26
  type WaitUntilFinishedOptions = {
24
27
  jobUuid: string;
25
28
  refetchIntervalMs: number;
@@ -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;AAS3D,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,e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,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,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,kBAqY1C,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateHandler = exports.waitUntilFinished = exports.VALIDATION_SEVERITIES = exports.getValidation = exports.getJobState = exports.requestValidation = void 0;
3
+ exports.validateHandler = exports.waitUntilFinished = exports.SHOW_CHART_CONFIGURATION_WARNINGS_DEPRECATION = exports.VALIDATION_SEVERITIES = exports.getValidation = exports.getJobState = exports.requestValidation = void 0;
4
+ exports.resolveValidateSeverity = resolveValidateSeverity;
4
5
  const tslib_1 = require("tslib");
5
6
  const common_1 = require("@lightdash/common");
6
7
  const columnify_1 = tslib_1.__importDefault(require("columnify"));
@@ -57,6 +58,13 @@ function styleIssueCounts(errorCount, warningCount) {
57
58
  }
58
59
  const REFETCH_JOB_INTERVAL = 3000;
59
60
  exports.VALIDATION_SEVERITIES = ['error', 'warning'];
61
+ exports.SHOW_CHART_CONFIGURATION_WARNINGS_DEPRECATION = '`--show-chart-configuration-warnings` is deprecated. Use `--severity warning` instead.';
62
+ function resolveValidateSeverity(options) {
63
+ if (options.showChartConfigurationWarnings) {
64
+ return 'warning';
65
+ }
66
+ return options.severity ?? 'error';
67
+ }
60
68
  const waitUntilFinished = async ({ jobUuid, refetchIntervalMs, createError, }) => {
61
69
  const job = await (0, exports.getJobState)(jobUuid);
62
70
  if (job.status === common_1.SchedulerJobStatus.COMPLETED) {
@@ -71,6 +79,10 @@ exports.waitUntilFinished = waitUntilFinished;
71
79
  const validateHandler = async (originalOptions) => {
72
80
  const options = { ...originalOptions };
73
81
  globalState_1.default.setVerbose(options.verbose);
82
+ if (options.showChartConfigurationWarnings) {
83
+ console.error(styles.warning(exports.SHOW_CHART_CONFIGURATION_WARNINGS_DEPRECATION));
84
+ }
85
+ const severity = resolveValidateSeverity(options);
74
86
  await (0, apiClient_1.checkLightdashVersion)();
75
87
  if (options.includeSpaces?.length && options.excludeSpaces?.length) {
76
88
  throw new common_1.ParameterError('Cannot use --include-spaces and --exclude-spaces together');
@@ -121,7 +133,6 @@ const validateHandler = async (originalOptions) => {
121
133
  : validationTargets.filter((target) => target !== common_1.ValidationTarget.APPS);
122
134
  console.error(styles.warning('> Skipping data app validation because dbt model selection flags produce a partial semantic layer'));
123
135
  }
124
- const severity = options.severity ?? 'error';
125
136
  await analytics_1.LightdashAnalytics.track({
126
137
  event: 'validate.started',
127
138
  properties: {
@@ -250,6 +250,29 @@ describe('validateHandler warehouse column validation', () => {
250
250
  expect(output).toContain('orders.unused_dim');
251
251
  expect(output).toContain('1 warning');
252
252
  });
253
+ test('fails when deprecated --show-chart-configuration-warnings is set and warnings exist', async () => {
254
+ validationResults = [chartConfigurationWarning];
255
+ vi.spyOn(process, 'exit').mockImplementation(() => undefined);
256
+ await (0, validate_1.validateHandler)({
257
+ ...baseOptions,
258
+ showChartConfigurationWarnings: true,
259
+ });
260
+ expect(process.exit).toHaveBeenCalledWith(1);
261
+ const output = errorOutput.join('\n');
262
+ expect(output).toContain(validate_1.SHOW_CHART_CONFIGURATION_WARNINGS_DEPRECATION);
263
+ expect(output).toContain('Chart configuration warning');
264
+ expect(output).toContain('orders.unused_dim');
265
+ expect(output).toContain('1 warning');
266
+ });
267
+ test('treats the deprecated flag as --severity warning even when severity defaults to error', async () => {
268
+ expect((0, validate_1.resolveValidateSeverity)({
269
+ severity: 'error',
270
+ showChartConfigurationWarnings: true,
271
+ })).toBe('warning');
272
+ expect((0, validate_1.resolveValidateSeverity)({
273
+ severity: 'error',
274
+ })).toBe('error');
275
+ });
253
276
  test('fails on blocking errors even when warnings stay hidden', async () => {
254
277
  validationResults = [brokenChartError, chartConfigurationWarning];
255
278
  vi.spyOn(process, 'exit').mockImplementation(() => undefined);
package/dist/index.js CHANGED
@@ -552,6 +552,7 @@ commander_1.program
552
552
  .addOption(new commander_1.Option('--severity <level>', 'Minimum issue level that fails the command. "error" (default) only fails on errors. "warning" shows chart configuration warnings and treats them as errors.')
553
553
  .choices([...validate_2.VALIDATION_SEVERITIES])
554
554
  .default('error'))
555
+ .addOption(new commander_1.Option('--show-chart-configuration-warnings', '(deprecated) Alias for --severity warning. Shows chart configuration warnings and treats them as errors.'))
555
556
  .addOption(new commander_1.Option('--only <elems...>', 'Specify project elements to validate')
556
557
  .choices(Object.values(common_1.ValidationTarget))
557
558
  .default(Object.values(common_1.ValidationTarget)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "2.18.2",
3
+ "version": "2.20.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,8 +45,8 @@
45
45
  "unique-names-generator": "4.7.1",
46
46
  "uuid": "11.1.1",
47
47
  "yaml": "2.8.3",
48
- "@lightdash/common": "2.18.2",
49
- "@lightdash/warehouses": "2.18.2"
48
+ "@lightdash/common": "2.20.0",
49
+ "@lightdash/warehouses": "2.20.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/inquirer": "8.2.4",