@lightdash/cli 3.384.2 → 3.385.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/.tsbuildinfo.build +1 -1
- package/dist/handlers/deploy.d.ts +1 -0
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +20 -1
- package/dist/handlers/sourceSelection.d.ts +1 -0
- package/dist/handlers/sourceSelection.d.ts.map +1 -1
- package/dist/handlers/sourceSelection.js +4 -3
- package/dist/index.js +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,OAAO,EACP,YAAY,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,OAAO,EACP,YAAY,EAWZ,KAAK,eAAe,EACpB,KAAK,YAAY,EAGpB,MAAM,mBAAmB,CAAC;AAuB3B,OAAO,EAAE,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAa7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAU/E,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAC5C,CAAC;AAkBF,eAAO,MAAM,eAAe,YACf,IAAI,CACT,oBAAoB,EACpB,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,CACrE,eACY,cAAc,mBACV,eAAe,GAAG,SAAS,KAC7C,OAAO,CAAC,YAAY,GAAG,SAAS,CA+BlC,CAAC;AAoWF,eAAO,MAAM,MAAM,aACL,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,WAC3B,UAAU,KACpB,OAAO,CAAC,IAAI,CA0Jd,CAAC;AA4HF,eAAO,MAAM,aAAa,oBAA2B,oBAAoB,kBAwLxE,CAAC"}
|
package/dist/handlers/deploy.js
CHANGED
|
@@ -481,12 +481,28 @@ const createNewProject = async (executionId, options) => {
|
|
|
481
481
|
throw e;
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
|
+
const assertPruneWithoutCombinedManifest = (options) => {
|
|
485
|
+
if (options.prune && options.combineManifest) {
|
|
486
|
+
throw new common_1.ParameterError('--prune cannot be used with --combine-manifest. It would remove the explores that come from the other manifest.');
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
const assertPruneOnSingleDbtSource = async (projectUuid) => {
|
|
490
|
+
const sources = await (0, sourceSelection_1.getProjectSources)(projectUuid).catch((error) => {
|
|
491
|
+
if (error instanceof common_1.LightdashError && error.statusCode === 404)
|
|
492
|
+
return [];
|
|
493
|
+
throw error;
|
|
494
|
+
});
|
|
495
|
+
if (sources.length > 1) {
|
|
496
|
+
throw new common_1.ParameterError('--prune cannot be used on a project with more than one dbt source. It would remove the explores of the other sources.');
|
|
497
|
+
}
|
|
498
|
+
};
|
|
484
499
|
const deployHandler = async (originalOptions) => {
|
|
485
500
|
(0, commandPolicy_1.assertAgentCommandAllowed)('deploy', originalOptions);
|
|
486
501
|
const options = {
|
|
487
502
|
...originalOptions,
|
|
488
503
|
};
|
|
489
504
|
globalState_1.default.setVerbose(options.verbose);
|
|
505
|
+
assertPruneWithoutCombinedManifest(options);
|
|
490
506
|
// Detect project type and configure options accordingly
|
|
491
507
|
const projectTypeConfig = await (0, projectType_1.detectProjectType)({
|
|
492
508
|
projectDir: options.projectDir,
|
|
@@ -555,6 +571,9 @@ const deployHandler = async (originalOptions) => {
|
|
|
555
571
|
}
|
|
556
572
|
// Log current project info
|
|
557
573
|
(0, selectProject_1.logSelectedProject)(existingProjectSelection, config, 'Deploying to');
|
|
574
|
+
if (options.prune) {
|
|
575
|
+
await assertPruneOnSingleDbtSource(existingProjectSelection.projectUuid);
|
|
576
|
+
}
|
|
558
577
|
sourceUuid = await (0, sourceSelection_1.resolveProjectSourceUuid)(existingProjectSelection.projectUuid, options.source);
|
|
559
578
|
const projectSettings = await (0, timestampConversion_1.getProjectDeploySettings)(options.disableTimestampConversion, existingProjectSelection.projectUuid, sourceUuid);
|
|
560
579
|
options.disableTimestampConversion =
|
|
@@ -587,7 +606,7 @@ const deployHandler = async (originalOptions) => {
|
|
|
587
606
|
await (0, exports.deploy)(explores, {
|
|
588
607
|
...options,
|
|
589
608
|
projectUuid,
|
|
590
|
-
complete: isProjectComplete,
|
|
609
|
+
complete: options.prune === true || isProjectComplete,
|
|
591
610
|
dbtModelNames,
|
|
592
611
|
fusionEmptyMeta,
|
|
593
612
|
sourceUuid,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ProjectDbtSourceSummary } from '@lightdash/common';
|
|
2
2
|
export declare const selectProjectSource: (sources: ProjectDbtSourceSummary[], name: string) => ProjectDbtSourceSummary;
|
|
3
|
+
export declare const getProjectSources: (projectUuid: string) => Promise<ProjectDbtSourceSummary[]>;
|
|
3
4
|
export declare const resolveProjectSourceUuid: (projectUuid: string, sourceOverride: string | undefined, configuredProjectUuid?: string) => Promise<string | undefined>;
|
|
4
5
|
export declare const setSourceHandler: (name: string, options: {
|
|
5
6
|
verbose: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceSelection.d.ts","sourceRoot":"","sources":["../../src/handlers/sourceSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,uBAAuB,EAC/B,MAAM,mBAAmB,CAAC;AAU3B,eAAO,MAAM,mBAAmB,YACnB,uBAAuB,EAAE,QAC5B,MAAM,KACb,uBAQF,CAAC;
|
|
1
|
+
{"version":3,"file":"sourceSelection.d.ts","sourceRoot":"","sources":["../../src/handlers/sourceSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,uBAAuB,EAC/B,MAAM,mBAAmB,CAAC;AAU3B,eAAO,MAAM,mBAAmB,YACnB,uBAAuB,EAAE,QAC5B,MAAM,KACb,uBAQF,CAAC;AAEF,eAAO,MAAM,iBAAiB,gBACb,MAAM,KACpB,OAAO,CAAC,uBAAuB,EAAE,CAK9B,CAAC;AAEP,eAAO,MAAM,wBAAwB,gBACpB,MAAM,kBACH,MAAM,GAAG,SAAS,0BACX,MAAM,KAC9B,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,SACnB,MAAM,WACH;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,kBAkBhC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setSourceHandler = exports.resolveProjectSourceUuid = exports.selectProjectSource = void 0;
|
|
3
|
+
exports.setSourceHandler = exports.resolveProjectSourceUuid = exports.getProjectSources = exports.selectProjectSource = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@lightdash/common");
|
|
6
6
|
const commandPolicy_1 = require("../agentConnections/commandPolicy");
|
|
@@ -22,6 +22,7 @@ const getProjectSources = async (projectUuid) => (0, apiClient_1.lightdashApi)({
|
|
|
22
22
|
url: `/api/v1/projects/${projectUuid}/dbt-sources`,
|
|
23
23
|
body: undefined,
|
|
24
24
|
});
|
|
25
|
+
exports.getProjectSources = getProjectSources;
|
|
25
26
|
const resolveProjectSourceUuid = async (projectUuid, sourceOverride, configuredProjectUuid = projectUuid) => {
|
|
26
27
|
if ((0, credentials_1.getAgentConnectionSelection)() !== null) {
|
|
27
28
|
(0, commandPolicy_1.assertAgentCommandAllowed)('deploy', { source: sourceOverride });
|
|
@@ -36,7 +37,7 @@ const resolveProjectSourceUuid = async (projectUuid, sourceOverride, configuredP
|
|
|
36
37
|
: undefined);
|
|
37
38
|
if (name === undefined)
|
|
38
39
|
return undefined;
|
|
39
|
-
return (0, exports.selectProjectSource)(await getProjectSources(projectUuid), name)
|
|
40
|
+
return (0, exports.selectProjectSource)(await (0, exports.getProjectSources)(projectUuid), name)
|
|
40
41
|
.projectDbtSourceUuid;
|
|
41
42
|
};
|
|
42
43
|
exports.resolveProjectSourceUuid = resolveProjectSourceUuid;
|
|
@@ -49,7 +50,7 @@ const setSourceHandler = async (name, options) => {
|
|
|
49
50
|
if (!config.context?.project) {
|
|
50
51
|
throw new common_1.AuthorizationError(`No project selected. Run 'lightdash config set-project' first.`);
|
|
51
52
|
}
|
|
52
|
-
const source = (0, exports.selectProjectSource)(await getProjectSources(config.context.project), name);
|
|
53
|
+
const source = (0, exports.selectProjectSource)(await (0, exports.getProjectSources)(config.context.project), name);
|
|
53
54
|
await (0, config_1.setSource)(source.name);
|
|
54
55
|
console.error(`\n ✅️ Selected dbt source: ${source.name}\n`);
|
|
55
56
|
};
|
package/dist/index.js
CHANGED
|
@@ -604,6 +604,7 @@ commander_1.program
|
|
|
604
604
|
.option('--create [project_name]', "Create a new project. If a project name is not provided, you'll be prompted for one on creation.", undefined)
|
|
605
605
|
.option('--ignore-errors', 'Allows deploy with errors on compile', false)
|
|
606
606
|
.option('--combine-manifest <path-or-url>', 'Path or http(s) URL to an additional dbt manifest.json. Models present in this file but missing from the deploy manifest are merged in so the deploy includes the full project. The deploy-generated manifest always wins on conflicts.')
|
|
607
|
+
.option('--prune', 'Remove every explore that this deploy does not upload, so the project holds exactly the selected models. Virtual views are kept. Not available on projects with more than one dbt source or with --combine-manifest.', false)
|
|
607
608
|
.option('--start-of-week <number>', 'Specifies the first day of the week (used by week-related date functions). 0 (Monday) to 6 (Sunday)', parseStartOfWeekArgument)
|
|
608
609
|
.option('--skip-dbt-compile', 'Skip `dbt compile` and deploy from the existing ./target/manifest.json', false)
|
|
609
610
|
.option('--skip-warehouse-catalog', 'Skip fetch warehouse catalog and use types in yml', false)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.385.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": "3.
|
|
26
|
-
"@lightdash/warehouses": "3.
|
|
25
|
+
"@lightdash/common": "3.385.0",
|
|
26
|
+
"@lightdash/warehouses": "3.385.0",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|