@lightdash/cli 0.1450.2 → 0.1451.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ export type DownloadHandlerOptions = {
4
4
  dashboards: string[];
5
5
  force: boolean;
6
6
  path?: string;
7
+ project?: string;
7
8
  };
8
9
  export declare const downloadContent: (ids: string[], type: 'charts' | 'dashboards', projectId: string, customPath?: string) => Promise<[number, string[]]>;
9
10
  export declare const downloadHandler: (options: DownloadHandlerOptions) => Promise<void>;
@@ -143,7 +143,7 @@ const downloadHandler = async (options) => {
143
143
  if (!config.context?.apiKey || !config.context.serverUrl) {
144
144
  throw new common_1.AuthorizationError(`Not logged in. Run 'lightdash login --help'`);
145
145
  }
146
- const projectId = config.context.project;
146
+ const projectId = options.project || config.context.project;
147
147
  if (!projectId) {
148
148
  throw new Error('No project selected. Run lightdash config set-project');
149
149
  }
@@ -323,7 +323,7 @@ const uploadHandler = async (options) => {
323
323
  if (!config.context?.apiKey || !config.context.serverUrl) {
324
324
  throw new common_1.AuthorizationError(`Not logged in. Run 'lightdash login --help'`);
325
325
  }
326
- const projectId = config.context.project;
326
+ const projectId = options.project || config.context.project;
327
327
  if (!projectId) {
328
328
  throw new Error('No project selected. Run lightdash config set-project');
329
329
  }
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ 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");
7
8
  const profile_1 = require("./dbt/profile");
8
9
  const compile_1 = require("./handlers/compile");
9
10
  const refresh_1 = require("./handlers/dbt/refresh");
@@ -44,6 +45,16 @@ function parseUseDbtListOption(value) {
44
45
  }
45
46
  return value.toLowerCase() !== 'false';
46
47
  }
48
+ function parseProjectArgument(value) {
49
+ if (value === undefined) {
50
+ throw new commander_1.InvalidArgumentError('No project argument provided.');
51
+ }
52
+ const isValidUuid = (0, uuid_1.validate)(value);
53
+ if (!isValidUuid) {
54
+ throw new commander_1.InvalidArgumentError('Not a valid project UUID.');
55
+ }
56
+ return value;
57
+ }
47
58
  commander_1.program
48
59
  .version(VERSION)
49
60
  .name(styles.title('⚡️lightdash'))
@@ -199,6 +210,7 @@ commander_1.program
199
210
  .option('-c, --charts <charts...>', 'specify chart slugs, uuids, or urls to download', [])
200
211
  .option('-d, --dashboards <dashboards...>', 'specify dashboard slugs, uuids or urls to download', [])
201
212
  .option('-p, --path <path>', 'specify a custom path to download charts and dashboards', undefined)
213
+ .option('--project <project uuid>', 'specify a project UUID to download', parseProjectArgument, undefined)
202
214
  .action(download_1.downloadHandler);
203
215
  commander_1.program
204
216
  .command('upload')
@@ -208,6 +220,7 @@ commander_1.program
208
220
  .option('-d, --dashboards <dashboards...>', 'specify dashboard slugs to force upload', [])
209
221
  .option('--force', 'Force upload even if local files have not changed, use this when you want to upload files to a new project', false)
210
222
  .option('-p, --path <path>', 'specify a custom path to upload charts and dashboards from', undefined)
223
+ .option('--project <project uuid>', 'specify a project UUID to upload', parseProjectArgument, undefined)
211
224
  .action(download_1.uploadHandler);
212
225
  commander_1.program
213
226
  .command('deploy')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.1450.2",
3
+ "version": "0.1451.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "lightdash": "dist/index.js"
@@ -11,8 +11,8 @@
11
11
  ],
12
12
  "dependencies": {
13
13
  "@actions/core": "^1.11.1",
14
- "@lightdash/common": "^0.1450.2",
15
- "@lightdash/warehouses": "^0.1450.2",
14
+ "@lightdash/common": "^0.1451.0",
15
+ "@lightdash/warehouses": "^0.1451.0",
16
16
  "@types/columnify": "^1.5.1",
17
17
  "ajv": "^8.11.0",
18
18
  "ajv-formats": "^2.1.1",