@lightdash/cli 2.157.0 → 2.158.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.
Files changed (35) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/handlers/apps/preview.d.ts.map +1 -1
  3. package/dist/handlers/apps/preview.js +5 -2
  4. package/dist/handlers/apps/preview.test.js +1 -1
  5. package/dist/handlers/download.d.ts +2 -0
  6. package/dist/handlers/download.d.ts.map +1 -1
  7. package/dist/handlers/download.js +3 -2
  8. package/dist/handlers/download.test.js +23 -6
  9. package/dist/handlers/exportChartImage.d.ts.map +1 -1
  10. package/dist/handlers/exportChartImage.js +6 -3
  11. package/dist/handlers/listProjects.d.ts.map +1 -1
  12. package/dist/handlers/listProjects.js +3 -0
  13. package/dist/handlers/preAggregateAudit.d.ts.map +1 -1
  14. package/dist/handlers/preAggregateAudit.js +3 -2
  15. package/dist/handlers/renameHandler.d.ts.map +1 -1
  16. package/dist/handlers/renameHandler.js +4 -3
  17. package/dist/handlers/renameHandler.test.js +2 -2
  18. package/dist/handlers/resolveProjectFlag.d.ts +6 -0
  19. package/dist/handlers/resolveProjectFlag.d.ts.map +1 -0
  20. package/dist/handlers/resolveProjectFlag.js +36 -0
  21. package/dist/handlers/resolveProjectFlag.test.d.ts +2 -0
  22. package/dist/handlers/resolveProjectFlag.test.d.ts.map +1 -0
  23. package/dist/handlers/resolveProjectFlag.test.js +48 -0
  24. package/dist/handlers/selectProject.d.ts.map +1 -1
  25. package/dist/handlers/selectProject.js +5 -1
  26. package/dist/handlers/setProject.d.ts +1 -1
  27. package/dist/handlers/setProject.d.ts.map +1 -1
  28. package/dist/handlers/setProject.js +5 -3
  29. package/dist/handlers/setWarehouse.d.ts.map +1 -1
  30. package/dist/handlers/setWarehouse.js +3 -2
  31. package/dist/handlers/validate.d.ts.map +1 -1
  32. package/dist/handlers/validate.js +5 -2
  33. package/dist/handlers/validate.test.js +4 -4
  34. package/dist/index.js +14 -16
  35. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@lightdash/common");
6
6
  const commander_1 = require("commander");
7
- const uuid_1 = require("uuid");
8
7
  const env_1 = require("./env");
9
8
  const error_1 = require("./error");
10
9
  const globalState_1 = tslib_1.__importDefault(require("./globalState"));
@@ -76,9 +75,8 @@ function parseProjectArgument(value) {
76
75
  if (value === undefined) {
77
76
  throw new commander_1.InvalidArgumentError('No project argument provided.');
78
77
  }
79
- const isValidUuid = (0, uuid_1.validate)(value);
80
- if (!isValidUuid) {
81
- throw new commander_1.InvalidArgumentError('Not a valid project UUID.');
78
+ if (value.trim() === '') {
79
+ throw new commander_1.InvalidArgumentError('Not a valid project UUID or slug.');
82
80
  }
83
81
  return value;
84
82
  }
@@ -139,7 +137,7 @@ ${styles.bold('Examples:')}
139
137
  ${styles.title('⚡')}️lightdash ${styles.bold('login')} http://localhost:3000 --email demo@lightdash.com ${styles.secondary('-- Local dev only: prompts for password securely')}
140
138
  `)
141
139
  .option('--token <token>', 'Login with an API access token', undefined)
142
- .addOption(new commander_1.Option('--project <project uuid>', 'Select a project by UUID after login')
140
+ .addOption(new commander_1.Option('--project <project uuid or slug>', 'Select a project by UUID or slug after login')
143
141
  .argParser(parseProjectArgument)
144
142
  .conflicts('skipProjectSelection'))
145
143
  .option('--email <email>', 'Login with email and password', undefined)
@@ -376,7 +374,7 @@ const downloadCommand = commander_1.program
376
374
  .option('-p, --path <path>', 'specify a custom path to download content', undefined)
377
375
  .option('--nested', 'organize downloads in nested folders by project and space (default: flat structure)', false)
378
376
  .option('--root-spaces', 'write new flat space definitions at the content root instead of spaces/ (legacy layout)', false)
379
- .option('--project <project uuid>', 'specify a project UUID to download', parseProjectArgument, undefined)
377
+ .option('--project <project uuid or slug>', 'specify a project (UUID or slug) to download from', parseProjectArgument, undefined)
380
378
  .option('--skip-spaces', 'skip downloading space definitions and access', false)
381
379
  .option('--spaces-only', 'download only space definitions and access', false)
382
380
  .option('--skip-charts', 'skip downloading charts', false)
@@ -411,7 +409,7 @@ const uploadCommand = commander_1.program
411
409
  .option('--external-connections <slugs...>', 'specify external connection slugs to upload (enterprise)', refsArgument_1.parseRefsArgument, [])
412
410
  .option('--force', 'Force upload unchanged files and allow destructive virtual-view column changes', false)
413
411
  .option('-p, --path <path>', 'specify a custom path to upload content from', undefined)
414
- .option('--project <project uuid>', 'specify a project UUID to upload', parseProjectArgument, undefined)
412
+ .option('--project <project uuid or slug>', 'specify a project (UUID or slug) to upload to', parseProjectArgument, undefined)
415
413
  .option('--skip-space-create', 'Skip space creation if it does not exist', false)
416
414
  .option('--skip-space-access', 'upload spaces without applying their access policies', false)
417
415
  .option('--skip-spaces', 'skip uploading space definitions and access', false)
@@ -450,7 +448,7 @@ appsProgram
450
448
  .option('--description <text>', 'Set the app description', '')
451
449
  .option('--slug <slug>', 'Override the app slug')
452
450
  .option('-p, --path <path>', 'Specify the Lightdash content root (default: ./lightdash)')
453
- .option('--project <project uuid>', 'Specify the project the app will use', parseProjectArgument, undefined)
451
+ .option('--project <project uuid or slug>', 'Specify the project the app will use', parseProjectArgument, undefined)
454
452
  .option('-y, --assume-yes', 'approve npm package installation', false)
455
453
  .option('--verbose', undefined, false)
456
454
  .addHelpText('after', `\n${styles.bold('Examples:')}\n ${styles.title('⚡')}️lightdash ${styles.bold('apps create "Revenue explorer"')} ${styles.secondary('-- creates ./lightdash/apps/revenue-explorer')}\n ${styles.title('⚡')}️lightdash ${styles.bold('apps create "Radial gauge" --chart-type')} ${styles.secondary('-- creates a custom chart type at ./lightdash/apps/radial-gauge')}\n`)
@@ -458,7 +456,7 @@ appsProgram
458
456
  appsProgram
459
457
  .command('preview [path]')
460
458
  .description('Preview a downloaded data app locally against a real Lightdash instance, authenticated as you. Your credential stays in the CLI, behind a local proxy limited to data-app SDK routes.')
461
- .option('--project <project uuid>', 'preview against a specific project (default: the projectUuid in lightdash-app.yml)')
459
+ .option('--project <project uuid or slug>', 'preview against a specific project by UUID or slug (default: the projectUuid in lightdash-app.yml)')
462
460
  .option('--url <url>', 'Lightdash server URL (default: your login config)')
463
461
  .option('--token <token>', 'API key / personal access token (default: your login config)')
464
462
  .option('-y, --assume-yes', 'assume yes to the dependency install prompts when node_modules is missing', false)
@@ -484,7 +482,7 @@ appsProgram
484
482
  commander_1.program
485
483
  .command('deploy')
486
484
  .description('Compiles and deploys a Lightdash project')
487
- .option('--project <project uuid>', 'Project UUID to deploy to. Overrides the default project configured via `lightdash config set-project`')
485
+ .option('--project <project uuid or slug>', 'Project UUID or slug to deploy to. Overrides the default project configured via `lightdash config set-project`')
488
486
  .option('--project-dir <path>', 'The directory of the dbt project', env_1.DEFAULT_DBT_PROJECT_DIR)
489
487
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
490
488
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
@@ -534,7 +532,7 @@ ${styles.bold('Examples:')}
534
532
  commander_1.program
535
533
  .command('validate')
536
534
  .description('Validates a project')
537
- .option('--project <project uuid>', 'Project UUID to validate, if not provided, the last preview will be used')
535
+ .option('--project <project uuid or slug>', 'Project UUID or slug to validate, if not provided, the last preview will be used')
538
536
  .option('--verbose', undefined, false)
539
537
  .option('--project-dir <path>', 'The directory of the dbt project', env_1.DEFAULT_DBT_PROJECT_DIR)
540
538
  .option('--profiles-dir <path>', 'The directory of the dbt profiles', env_1.DEFAULT_DBT_PROFILES_DIR)
@@ -599,7 +597,7 @@ commander_1.program
599
597
  .command('rename')
600
598
  .description('Rename models and fields on Lightdash content')
601
599
  .option('--verbose', undefined, false)
602
- .option('-p, --project <project uuid>', 'specify a project UUID to rename', parseProjectArgument, undefined)
600
+ .option('-p, --project <project uuid or slug>', 'specify a project (UUID or slug) to rename in', parseProjectArgument, undefined)
603
601
  .option('-m, --model <model>', 'When renaming a field, specify which model the field belongs to', undefined)
604
602
  .option('-y, --assume-yes', 'assume yes to prompts', false)
605
603
  .requiredOption('-t, --type <type>', 'model or field', common_1.RenameType.MODEL)
@@ -612,7 +610,7 @@ commander_1.program
612
610
  .command('slug-update')
613
611
  .description('Rename a chart slug and update its local references')
614
612
  .option('--verbose', 'show verbose output', false)
615
- .option('--project <project uuid>', 'specify a project UUID', parseProjectArgument, undefined)
613
+ .option('--project <project uuid or slug>', 'specify a project by UUID or slug', parseProjectArgument, undefined)
616
614
  .option('-p, --path <path>', 'specify the local content-as-code path to update', undefined)
617
615
  .option('--dry-run', 'preview the chart rename and local file changes without making changes', false)
618
616
  .requiredOption('--from <slug>', 'current content slug')
@@ -683,7 +681,7 @@ commander_1.program
683
681
  .description('Audit pre-aggregate hit/miss coverage for a dashboard (or every dashboard with --all)')
684
682
  .option('--dashboard <uuidOrSlug>', 'Dashboard UUID or slug (required unless --all is passed)')
685
683
  .option('--all', 'Audit every dashboard in the target project', false)
686
- .option('--project <projectUuid>', 'Project UUID (defaults to LIGHTDASH_PROJECT_UUID env or config)')
684
+ .option('--project <project uuid or slug>', 'Project UUID or slug (defaults to LIGHTDASH_PROJECT_UUID env or config)')
687
685
  .option('--json', 'Emit machine-readable JSON instead of human output', false)
688
686
  .option('--fail-on-miss', 'Exit 1 if any eligible tile is a pre-aggregate miss (CI-friendly)', false)
689
687
  .option('--verbose', 'Expand the ineligible section in human output', false)
@@ -734,7 +732,7 @@ commander_1.program
734
732
  .option('--profile <name>', 'The name of the profile to use (defaults to profile name in dbt_project.yml)', undefined)
735
733
  .option('--target <name>', 'target to use in profiles.yml file', undefined)
736
734
  .option('--target-path <path>', 'The target directory for dbt (overrides DBT_TARGET_PATH and dbt_project.yml)', undefined)
737
- .option('--project <uuid>', 'Lightdash project UUID to update (defaults to currently selected project)', undefined)
735
+ .option('--project <project uuid or slug>', 'Lightdash project UUID or slug to update (defaults to currently selected project)', undefined)
738
736
  .option('--start-of-week <number>', 'Specifies the first day of the week (used by week-related date functions). 0 (Monday) to 6 (Sunday)', parseStartOfWeekArgument)
739
737
  .option('-y, --assume-yes', 'assume yes to prompts', false)
740
738
  .option('--verbose', 'Show detailed output', false)
@@ -744,7 +742,7 @@ commander_1.program
744
742
  .description('Export a deployed chart as a PNG image. The chart must already exist on the server.')
745
743
  .argument('<chart>', 'Chart UUID or slug')
746
744
  .requiredOption('-o, --output <file>', 'Output file path for the PNG image')
747
- .option('--project <uuid>', 'Lightdash project UUID (defaults to the currently selected project)')
745
+ .option('--project <project uuid or slug>', 'Lightdash project UUID or slug (defaults to the currently selected project)')
748
746
  .option('--verbose', 'Show detailed output', false)
749
747
  .action(exportChartImage_1.exportChartImageHandler);
750
748
  commander_1.program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "2.157.0",
3
+ "version": "2.158.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.157.0",
49
- "@lightdash/warehouses": "2.157.0"
48
+ "@lightdash/common": "2.158.0",
49
+ "@lightdash/warehouses": "2.158.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/inquirer": "8.2.4",