@lightdash/cli 3.358.0 → 3.358.2
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/compile.d.ts +2 -0
- package/dist/handlers/compile.d.ts.map +1 -1
- package/dist/handlers/compile.js +8 -1
- package/dist/handlers/dbt/compile.d.ts.map +1 -1
- package/dist/handlers/dbt/compile.js +6 -2
- package/dist/handlers/dbt/fusionMeta.d.ts +21 -0
- package/dist/handlers/dbt/fusionMeta.d.ts.map +1 -0
- package/dist/handlers/dbt/fusionMeta.js +121 -0
- package/dist/handlers/deploy.d.ts +2 -0
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +7 -1
- package/dist/handlers/preview.d.ts.map +1 -1
- package/dist/handlers/preview.js +7 -3
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Explore, ExploreError } from '@lightdash/common';
|
|
2
2
|
import { DbtCompileOptions } from './dbt/compile';
|
|
3
|
+
import { type FusionEmptyMeta } from './dbt/fusionMeta';
|
|
3
4
|
export type CompileHandlerOptions = DbtCompileOptions & {
|
|
4
5
|
projectDir: string;
|
|
5
6
|
profilesDir: string;
|
|
@@ -19,6 +20,7 @@ export type CompileProjectResult = {
|
|
|
19
20
|
dbtModelNames?: string[];
|
|
20
21
|
explores: (Explore | ExploreError)[];
|
|
21
22
|
isProjectComplete: boolean;
|
|
23
|
+
fusionEmptyMeta: FusionEmptyMeta | null;
|
|
22
24
|
};
|
|
23
25
|
export declare const hasBlockingCompileError: (explore: Explore | ExploreError) => boolean;
|
|
24
26
|
export declare const stripWarehouseColumnErrors: (explore: Explore | ExploreError) => Explore | ExploreError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,OAAO,EACP,YAAY,EAkBf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OAAO,GAAG,YAiBZ,CAAC;AAgTF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,oBAAoB,CA6c9B,CAAC;AAEF,eAAO,MAAM,OAAO,YACP,qBAAqB,KAC/B,OAAO,CAAC,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,CACO,CAAC;AAE7C,eAAO,MAAM,cAAc,oBACN,qBAAqB,kBAmCzC,CAAC"}
|
package/dist/handlers/compile.js
CHANGED
|
@@ -18,6 +18,7 @@ const projectType_1 = require("../lightdash/projectType");
|
|
|
18
18
|
const styles = tslib_1.__importStar(require("../styles"));
|
|
19
19
|
const apiClient_1 = require("./dbt/apiClient");
|
|
20
20
|
const compile_1 = require("./dbt/compile");
|
|
21
|
+
const fusionMeta_1 = require("./dbt/fusionMeta");
|
|
21
22
|
const getDbtVersion_1 = require("./dbt/getDbtVersion");
|
|
22
23
|
const getWarehouseClient_1 = tslib_1.__importDefault(require("./dbt/getWarehouseClient"));
|
|
23
24
|
const hasBlockingCompileError = (explore) => (0, common_1.isExploreError)(explore) ||
|
|
@@ -225,6 +226,7 @@ const compileProject = async (options) => {
|
|
|
225
226
|
let dbtMetrics = null;
|
|
226
227
|
let isProjectComplete = true;
|
|
227
228
|
let dbtModelNames;
|
|
229
|
+
let fusionEmptyMeta = null;
|
|
228
230
|
explores = await getExploresFromLightdashYmlProject({
|
|
229
231
|
projectDir: absoluteProjectPath,
|
|
230
232
|
lightdashProjectConfig,
|
|
@@ -360,6 +362,11 @@ const compileProject = async (options) => {
|
|
|
360
362
|
}
|
|
361
363
|
const manifestVersion = (0, common_1.getDbtManifestVersion)(manifest);
|
|
362
364
|
const manifestModels = (0, common_1.getModelsFromManifest)(manifest);
|
|
365
|
+
fusionEmptyMeta = (0, fusionMeta_1.getFusionEmptyMeta)({
|
|
366
|
+
dbtVersion: manifest.metadata.dbt_version,
|
|
367
|
+
skipDbtCompile: !!options.skipDbtCompile,
|
|
368
|
+
models: manifestModels,
|
|
369
|
+
});
|
|
363
370
|
const compiledModels = (0, common_1.getCompiledModels)(manifestModels, effectiveCompiledModelIds);
|
|
364
371
|
// When using --defer, non-selected models pulled in via joins
|
|
365
372
|
// have incorrect schema/relation_name (they point to the dev target
|
|
@@ -504,7 +511,7 @@ const compileProject = async (options) => {
|
|
|
504
511
|
durationMs: Date.now() - startTime,
|
|
505
512
|
},
|
|
506
513
|
});
|
|
507
|
-
return { explores, isProjectComplete, dbtModelNames };
|
|
514
|
+
return { explores, isProjectComplete, dbtModelNames, fusionEmptyMeta };
|
|
508
515
|
};
|
|
509
516
|
exports.compileProject = compileProject;
|
|
510
517
|
const compile = async (options) => (await (0, exports.compileProject)(options)).explores;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/compile.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/compile.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKpE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,CAAC;AA+HF,wBAAsB,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAgD3E;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACvC;;;;OAIG;IACH,0BAA0B,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACpD,CAAC;AAEF,wBAAsB,0BAA0B,CAC5C,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,iBAAiB,GAClC,OAAO,CAAC,mBAAmB,CAAC,CA0G9B"}
|
|
@@ -11,6 +11,7 @@ const path = tslib_1.__importStar(require("path"));
|
|
|
11
11
|
const credentials_1 = require("../../credentials");
|
|
12
12
|
const manifest_1 = require("../../dbt/manifest");
|
|
13
13
|
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
|
14
|
+
const fusionMeta_1 = require("./fusionMeta");
|
|
14
15
|
const getDbtVersion_1 = require("./getDbtVersion");
|
|
15
16
|
const dbtCompileArgs = [
|
|
16
17
|
'profilesDir',
|
|
@@ -60,7 +61,8 @@ const dbtCompile = async (options) => {
|
|
|
60
61
|
}
|
|
61
62
|
catch (e) {
|
|
62
63
|
const msg = (0, common_1.getErrorMessage)(e);
|
|
63
|
-
|
|
64
|
+
const hint = (0, fusionMeta_1.isDbt1060MetaError)(msg) ? `${fusionMeta_1.DBT1060_META_HINT}\n` : '';
|
|
65
|
+
throw new common_1.ParseError(`${hint}Failed to run dbt compile:\n ${msg}`);
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
68
|
/**
|
|
@@ -147,7 +149,9 @@ async function dbtList(options) {
|
|
|
147
149
|
}
|
|
148
150
|
catch (e) {
|
|
149
151
|
const msg = (0, common_1.getErrorMessage)(e);
|
|
150
|
-
throw new common_1.ParseError(
|
|
152
|
+
throw new common_1.ParseError((0, fusionMeta_1.isDbt1060MetaError)(msg)
|
|
153
|
+
? `${fusionMeta_1.DBT1060_META_HINT}\nError executing 'dbt ls':\n ${msg}`
|
|
154
|
+
: `Error executing 'dbt ls':\n ${msg}\nEnsure you're on the latest patch version. '--use-dbt-list' is true by default; if you encounter issues, try using '--use-dbt-list=false`);
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
async function maybeCompileModelsAndJoins(loadManifestOpts, initialOptions) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DbtModelNode, type Explore } from '@lightdash/common';
|
|
2
|
+
export declare const DBT1060_META_HINT = "dbt v2 ignores top-level `meta` on models and columns. Move it under `config: meta:`.";
|
|
3
|
+
export declare const isDbt1060MetaError: (message: string) => boolean;
|
|
4
|
+
export type FusionEmptyMetaModel = {
|
|
5
|
+
name: string;
|
|
6
|
+
modelMetaEmpty: boolean;
|
|
7
|
+
emptyMetaColumns: string[];
|
|
8
|
+
};
|
|
9
|
+
export type FusionEmptyMeta = {
|
|
10
|
+
dbtVersion: string;
|
|
11
|
+
models: FusionEmptyMetaModel[];
|
|
12
|
+
};
|
|
13
|
+
export declare const getFusionEmptyMeta: ({ dbtVersion, skipDbtCompile, models, }: {
|
|
14
|
+
dbtVersion: string | undefined;
|
|
15
|
+
skipDbtCompile: boolean;
|
|
16
|
+
models: Pick<DbtModelNode, 'name' | 'meta' | 'config' | 'columns'>[];
|
|
17
|
+
}) => FusionEmptyMeta | null;
|
|
18
|
+
export declare const getDroppedFieldIds: (previous: Explore, next: Explore, model: FusionEmptyMetaModel) => string[];
|
|
19
|
+
export declare const getFusionMetaWarning: (previous: Explore, next: Explore, dbtVersion: string, model: FusionEmptyMetaModel) => string | null;
|
|
20
|
+
export declare const getFusionMetaWarnings: (projectUuid: string, explores: Explore[], fusionEmptyMeta: FusionEmptyMeta) => Promise<string[]>;
|
|
21
|
+
//# sourceMappingURL=fusionMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fusionMeta.d.ts","sourceRoot":"","sources":["../../../src/handlers/dbt/fusionMeta.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,YAAY,EACjB,KAAK,OAAO,EACf,MAAM,mBAAmB,CAAC;AAK3B,eAAO,MAAM,iBAAiB,0FAC6D,CAAC;AAE5F,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OACyB,CAAC;AAE/E,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAClC,CAAC;AASF,eAAO,MAAM,kBAAkB,4CAI5B;IACC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;CACxE,KAAG,eAAe,GAAG,IAoBrB,CAAC;AAgEF,eAAO,MAAM,kBAAkB,aACjB,OAAO,QACX,OAAO,SACN,oBAAoB,KAC5B,MAAM,EAAiE,CAAC;AAE3E,eAAO,MAAM,oBAAoB,aACnB,OAAO,QACX,OAAO,cACD,MAAM,SACX,oBAAoB,KAC5B,MAAM,GAAG,IAuBX,CAAC;AAEF,eAAO,MAAM,qBAAqB,gBACjB,MAAM,YACT,OAAO,EAAE,mBACF,eAAe,KACjC,OAAO,CAAC,MAAM,EAAE,CA+BlB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFusionMetaWarnings = exports.getFusionMetaWarning = exports.getDroppedFieldIds = exports.getFusionEmptyMeta = exports.isDbt1060MetaError = exports.DBT1060_META_HINT = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@lightdash/common");
|
|
6
|
+
const p_limit_1 = tslib_1.__importDefault(require("p-limit"));
|
|
7
|
+
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
|
8
|
+
const apiClient_1 = require("./apiClient");
|
|
9
|
+
exports.DBT1060_META_HINT = 'dbt v2 ignores top-level `meta` on models and columns. Move it under `config: meta:`.';
|
|
10
|
+
const isDbt1060MetaError = (message) => message.includes('dbt1060') && /unexpected key [`'"]*meta\b/.test(message);
|
|
11
|
+
exports.isDbt1060MetaError = isDbt1060MetaError;
|
|
12
|
+
const isEmptyMeta = (meta, configMeta) => Object.keys(meta ?? {}).length === 0 &&
|
|
13
|
+
Object.keys(configMeta ?? {}).length === 0;
|
|
14
|
+
const getFusionEmptyMeta = ({ dbtVersion, skipDbtCompile, models, }) => {
|
|
15
|
+
if (!skipDbtCompile || dbtVersion === undefined)
|
|
16
|
+
return null;
|
|
17
|
+
if (!dbtVersion.startsWith('2.'))
|
|
18
|
+
return null;
|
|
19
|
+
return {
|
|
20
|
+
dbtVersion,
|
|
21
|
+
models: models
|
|
22
|
+
.map((model) => ({
|
|
23
|
+
name: model.name,
|
|
24
|
+
modelMetaEmpty: isEmptyMeta(model.meta, model.config?.meta),
|
|
25
|
+
emptyMetaColumns: Object.values(model.columns)
|
|
26
|
+
.filter((column) => isEmptyMeta(column.meta, column.config?.meta))
|
|
27
|
+
.map((column) => column.name),
|
|
28
|
+
}))
|
|
29
|
+
.filter((model) => model.modelMetaEmpty || model.emptyMetaColumns.length > 0),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.getFusionEmptyMeta = getFusionEmptyMeta;
|
|
33
|
+
const getDroppedFields = (previous, next, model) => {
|
|
34
|
+
const table = previous.tables[previous.baseTable];
|
|
35
|
+
const nextTable = next.tables[next.baseTable];
|
|
36
|
+
if (!table || !nextTable)
|
|
37
|
+
return [];
|
|
38
|
+
const nextIds = new Set([
|
|
39
|
+
...Object.values(nextTable.dimensions),
|
|
40
|
+
...Object.values(nextTable.metrics),
|
|
41
|
+
].map(common_1.getItemId));
|
|
42
|
+
const columnsById = new Map(model.emptyMetaColumns.map((name) => [
|
|
43
|
+
(0, common_1.getItemId)({ table: table.name, name }),
|
|
44
|
+
name,
|
|
45
|
+
]));
|
|
46
|
+
const dimensions = Object.values(table.dimensions).map((dimension) => ({
|
|
47
|
+
id: (0, common_1.getItemId)(dimension),
|
|
48
|
+
column: columnsById.get((0, common_1.getItemId)({
|
|
49
|
+
table: table.name,
|
|
50
|
+
name: dimension.timeIntervalBaseDimensionName ??
|
|
51
|
+
dimension.name,
|
|
52
|
+
})) ?? null,
|
|
53
|
+
// additional dimensions don't record their source column or model
|
|
54
|
+
untraced: dimension.isAdditionalDimension === true,
|
|
55
|
+
modelLevel: false,
|
|
56
|
+
}));
|
|
57
|
+
const metrics = Object.values(table.metrics).map((metric) => ({
|
|
58
|
+
id: (0, common_1.getItemId)(metric),
|
|
59
|
+
column: metric.dimensionReference === undefined
|
|
60
|
+
? null
|
|
61
|
+
: (columnsById.get(metric.dimensionReference) ?? null),
|
|
62
|
+
untraced: false,
|
|
63
|
+
modelLevel: metric.dimensionReference === undefined,
|
|
64
|
+
}));
|
|
65
|
+
const lost = [...dimensions, ...metrics].filter(({ id }) => !nextIds.has(id));
|
|
66
|
+
const traced = lost.filter(({ column, modelLevel }) => column !== null || (modelLevel && model.modelMetaEmpty));
|
|
67
|
+
// untraced fields count only when a traced loss shows meta was dropped
|
|
68
|
+
return lost
|
|
69
|
+
.filter((field) => traced.includes(field) || (field.untraced && traced.length > 0))
|
|
70
|
+
.map(({ id, column, untraced }) => ({ id, column, untraced }));
|
|
71
|
+
};
|
|
72
|
+
const getDroppedFieldIds = (previous, next, model) => getDroppedFields(previous, next, model).map(({ id }) => id);
|
|
73
|
+
exports.getDroppedFieldIds = getDroppedFieldIds;
|
|
74
|
+
const getFusionMetaWarning = (previous, next, dbtVersion, model) => {
|
|
75
|
+
const dropped = getDroppedFields(previous, next, model);
|
|
76
|
+
if (dropped.length === 0)
|
|
77
|
+
return null;
|
|
78
|
+
const columns = [
|
|
79
|
+
...new Set(dropped
|
|
80
|
+
.map(({ column }) => column)
|
|
81
|
+
.filter((column) => column !== null)),
|
|
82
|
+
];
|
|
83
|
+
const subjects = [
|
|
84
|
+
columns.length > 0
|
|
85
|
+
? `the ${columns.length === 1 ? 'column' : 'columns'} ${columns.join(', ')}`
|
|
86
|
+
: null,
|
|
87
|
+
dropped.some(({ column, untraced }) => column === null && !untraced)
|
|
88
|
+
? `the model ${model.name}`
|
|
89
|
+
: null,
|
|
90
|
+
].filter((subject) => subject !== null);
|
|
91
|
+
if (subjects.length > 0 && dropped.some(({ untraced }) => untraced)) {
|
|
92
|
+
subjects.push('other columns');
|
|
93
|
+
}
|
|
94
|
+
const verb = subjects.length === 1 && columns.length <= 1 ? 'has' : 'have';
|
|
95
|
+
return `Warning: explore ${next.name} lost ${dropped.length} ${dropped.length === 1 ? 'field' : 'fields'} that the previous deploy had (${dropped.map(({ id }) => id).join(', ')}). This manifest was built by dbt ${dbtVersion}, which ignores top-level meta, so ${subjects.join(' and ')} ${verb} no meta. Move their meta under config: meta: and recompile.`;
|
|
96
|
+
};
|
|
97
|
+
exports.getFusionMetaWarning = getFusionMetaWarning;
|
|
98
|
+
const getFusionMetaWarnings = async (projectUuid, explores, fusionEmptyMeta) => {
|
|
99
|
+
const limit = (0, p_limit_1.default)(8);
|
|
100
|
+
const warnings = await Promise.all(explores.map((explore) => {
|
|
101
|
+
const model = fusionEmptyMeta.models.find(({ name }) => name === explore.baseTable);
|
|
102
|
+
if (!model)
|
|
103
|
+
return null;
|
|
104
|
+
return limit(async () => {
|
|
105
|
+
try {
|
|
106
|
+
const previous = await (0, apiClient_1.lightdashApi)({
|
|
107
|
+
method: 'GET',
|
|
108
|
+
url: `/api/v1/projects/${projectUuid}/explores/${encodeURIComponent(explore.name)}`,
|
|
109
|
+
body: undefined,
|
|
110
|
+
});
|
|
111
|
+
return (0, exports.getFusionMetaWarning)(previous, explore, fusionEmptyMeta.dbtVersion, model);
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
globalState_1.default.debug(`> Skipping meta comparison for explore ${explore.name}: ${(0, common_1.getErrorMessage)(e)}`);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}));
|
|
119
|
+
return warnings.filter((warning) => warning !== null);
|
|
120
|
+
};
|
|
121
|
+
exports.getFusionMetaWarnings = getFusionMetaWarnings;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Explore, ExploreError, type ConnectionRoute, type DeployTarget } from '@lightdash/common';
|
|
2
2
|
import { CliProjectType } from '../lightdash/projectType';
|
|
3
3
|
import { DbtCompileOptions } from './dbt/compile';
|
|
4
|
+
import { type FusionEmptyMeta } from './dbt/fusionMeta';
|
|
4
5
|
type DeployHandlerOptions = DbtCompileOptions & {
|
|
5
6
|
projectDir: string;
|
|
6
7
|
profilesDir: string;
|
|
@@ -28,6 +29,7 @@ type DeployArgs = DeployHandlerOptions & {
|
|
|
28
29
|
dbtModelNames?: string[];
|
|
29
30
|
sourceUuid?: string;
|
|
30
31
|
deployTarget?: DeployTarget;
|
|
32
|
+
fusionEmptyMeta?: FusionEmptyMeta | null;
|
|
31
33
|
};
|
|
32
34
|
export declare const getDeployTarget: (options: Pick<DeployHandlerOptions, 'projectDir' | 'targetPath' | 'profilesDir' | 'profile' | 'target'>, projectType: CliProjectType, connectionRoute: ConnectionRoute | undefined) => Promise<DeployTarget | undefined>;
|
|
33
35
|
export declare const deploy: (explores: (Explore | ExploreError)[], options: DeployArgs) => Promise<void>;
|
|
@@ -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,EAUZ,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;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;AAiGF,eAAO,MAAM,aAAa,oBAA2B,oBAAoB,kBAiLxE,CAAC"}
|
package/dist/handlers/deploy.js
CHANGED
|
@@ -21,6 +21,7 @@ const styles = tslib_1.__importStar(require("../styles"));
|
|
|
21
21
|
const compile_1 = require("./compile");
|
|
22
22
|
const createProject_1 = require("./createProject");
|
|
23
23
|
const apiClient_1 = require("./dbt/apiClient");
|
|
24
|
+
const fusionMeta_1 = require("./dbt/fusionMeta");
|
|
24
25
|
const getDbtVersion_1 = require("./dbt/getDbtVersion");
|
|
25
26
|
const selectProject_1 = require("./selectProject");
|
|
26
27
|
const sourceSelection_1 = require("./sourceSelection");
|
|
@@ -317,6 +318,9 @@ const deploy = async (explores, options) => {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
const deployableExplores = explores.map(compile_1.stripWarehouseColumnErrors);
|
|
321
|
+
const fusionMetaWarnings = options.fusionEmptyMeta
|
|
322
|
+
? await (0, fusionMeta_1.getFusionMetaWarnings)(options.projectUuid, deployableExplores.filter((explore) => !(0, common_1.isExploreError)(explore)), options.fusionEmptyMeta)
|
|
323
|
+
: [];
|
|
320
324
|
const lightdashProjectConfig = await (0, lightdash_config_1.readAndLoadLightdashProjectConfig)(path_1.default.resolve(options.projectDir), options.projectUuid);
|
|
321
325
|
const shouldUseLegacyDeploy = options.batchedDeploy === false ||
|
|
322
326
|
!(await deployBatched(deployableExplores, options));
|
|
@@ -392,6 +396,7 @@ const deploy = async (explores, options) => {
|
|
|
392
396
|
await runPostDeployStep('project defaults', () => replaceProjectDefaults(options.projectUuid, lightdashProjectConfig));
|
|
393
397
|
await runPostDeployStep('project table groups', () => replaceProjectTableGroups(options.projectUuid, lightdashProjectConfig));
|
|
394
398
|
await runPostDeployStep('project context', () => replaceProjectContext(options.projectUuid, path_1.default.resolve(options.projectDir)));
|
|
399
|
+
fusionMetaWarnings.forEach((warning) => console.error(styles.warning(warning)));
|
|
395
400
|
};
|
|
396
401
|
exports.deploy = deploy;
|
|
397
402
|
const createNewProject = async (executionId, options) => {
|
|
@@ -556,7 +561,7 @@ const deployHandler = async (originalOptions) => {
|
|
|
556
561
|
projectSettings.disableTimestampConversion;
|
|
557
562
|
connectionRoute = projectSettings.connectionRoute;
|
|
558
563
|
}
|
|
559
|
-
const { explores, isProjectComplete, dbtModelNames } = await (0, compile_1.compileProject)(options);
|
|
564
|
+
const { explores, isProjectComplete, dbtModelNames, fusionEmptyMeta } = await (0, compile_1.compileProject)(options);
|
|
560
565
|
let projectUuid;
|
|
561
566
|
if (options.create !== undefined) {
|
|
562
567
|
const project = await createNewProject(executionId, options);
|
|
@@ -584,6 +589,7 @@ const deployHandler = async (originalOptions) => {
|
|
|
584
589
|
projectUuid,
|
|
585
590
|
complete: isProjectComplete,
|
|
586
591
|
dbtModelNames,
|
|
592
|
+
fusionEmptyMeta,
|
|
587
593
|
sourceUuid,
|
|
588
594
|
deployTarget: await (0, exports.getDeployTarget)(options, projectTypeConfig.type, connectionRoute),
|
|
589
595
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EACH,+BAA+B,EAUlC,MAAM,mBAAmB,CAAC;AAoB3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAalD,KAAK,qBAAqB,GAAG,iBAAiB,GAAG;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OA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,OAAO,CAAC;IAClB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAoBF,KAAK,yBAAyB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAsQF,eAAO,MAAM,cAAc,oBACN,qBAAqB,KACvC,OAAO,CAAC,IAAI,CAyWd,CAAC;AAEF,eAAO,MAAM,mBAAmB,oBACX,qBAAqB,KACvC,OAAO,CAAC,IAAI,CA6Qd,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAClB,yBAAyB,KACnC,OAAO,CAAC,IAAI,CA2Cd,CAAC"}
|
package/dist/handlers/preview.js
CHANGED
|
@@ -354,12 +354,13 @@ const previewHandler = async (originalOptions) => {
|
|
|
354
354
|
(0, timestampConversion_1.getDisableTimestampConversionFromProject)(project.warehouseConnection);
|
|
355
355
|
globalState_1.default.debug(`> Using disable-timestamp-conversion=${String(options.disableTimestampConversion ?? false)} from preview project settings`);
|
|
356
356
|
}
|
|
357
|
-
const { explores, isProjectComplete } = await (0, compile_1.compileProject)(options);
|
|
357
|
+
const { explores, isProjectComplete, fusionEmptyMeta } = await (0, compile_1.compileProject)(options);
|
|
358
358
|
await (0, deploy_1.deploy)(explores, {
|
|
359
359
|
...options,
|
|
360
360
|
projectUuid: project.projectUuid,
|
|
361
361
|
...(await previewDeployDestination(project, options, projectTypeConfig.type, config.context?.project)),
|
|
362
362
|
complete: isProjectComplete,
|
|
363
|
+
fusionEmptyMeta,
|
|
363
364
|
});
|
|
364
365
|
await (0, config_1.setPreviewProject)(project.projectUuid, name);
|
|
365
366
|
process.on('SIGINT', async () => {
|
|
@@ -410,6 +411,7 @@ const previewHandler = async (originalOptions) => {
|
|
|
410
411
|
projectUuid: project.projectUuid,
|
|
411
412
|
...(await previewDeployDestination(project, options, projectTypeConfig.type, config.context?.project)),
|
|
412
413
|
complete: compileResult.isProjectComplete,
|
|
414
|
+
fusionEmptyMeta: compileResult.fusionEmptyMeta,
|
|
413
415
|
});
|
|
414
416
|
}
|
|
415
417
|
console.error(`${styles.success('✔')} Preview updated \n`);
|
|
@@ -501,7 +503,7 @@ const startPreviewHandler = async (originalOptions) => {
|
|
|
501
503
|
: previewSource.sourceUuid);
|
|
502
504
|
options.disableTimestampConversion =
|
|
503
505
|
previewSettings.disableTimestampConversion;
|
|
504
|
-
const { explores, isProjectComplete } = await (0, compile_1.compileProject)(options);
|
|
506
|
+
const { explores, isProjectComplete, fusionEmptyMeta } = await (0, compile_1.compileProject)(options);
|
|
505
507
|
await (0, deploy_1.deploy)(explores, {
|
|
506
508
|
...options,
|
|
507
509
|
projectUuid: previewProject.projectUuid,
|
|
@@ -510,6 +512,7 @@ const startPreviewHandler = async (originalOptions) => {
|
|
|
510
512
|
connectionRoute: previewSettings.connectionRoute,
|
|
511
513
|
}, options, projectTypeConfig.type, config.context?.project)),
|
|
512
514
|
complete: isProjectComplete,
|
|
515
|
+
fusionEmptyMeta,
|
|
513
516
|
});
|
|
514
517
|
const url = await projectUrl(previewProject);
|
|
515
518
|
console.error(`Project updated on ${url}`);
|
|
@@ -591,12 +594,13 @@ const startPreviewHandler = async (originalOptions) => {
|
|
|
591
594
|
(0, timestampConversion_1.getDisableTimestampConversionFromProject)(project.warehouseConnection);
|
|
592
595
|
globalState_1.default.debug(`> Using disable-timestamp-conversion=${String(options.disableTimestampConversion ?? false)} from preview project settings`);
|
|
593
596
|
}
|
|
594
|
-
const { explores, isProjectComplete } = await (0, compile_1.compileProject)(options);
|
|
597
|
+
const { explores, isProjectComplete, fusionEmptyMeta } = await (0, compile_1.compileProject)(options);
|
|
595
598
|
await (0, deploy_1.deploy)(explores, {
|
|
596
599
|
...options,
|
|
597
600
|
projectUuid: project.projectUuid,
|
|
598
601
|
...(await previewDeployDestination(project, options, projectTypeConfig.type, config.context?.project)),
|
|
599
602
|
complete: isProjectComplete,
|
|
603
|
+
fusionEmptyMeta,
|
|
600
604
|
});
|
|
601
605
|
const url = await projectUrl(project);
|
|
602
606
|
if (!hasContentCopy) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "3.358.
|
|
3
|
+
"version": "3.358.2",
|
|
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.358.
|
|
26
|
-
"@lightdash/warehouses": "3.358.
|
|
25
|
+
"@lightdash/common": "3.358.2",
|
|
26
|
+
"@lightdash/warehouses": "3.358.2",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|