@lightdash/cli 0.1434.1 → 0.1435.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/dist/dbt/manifest.d.ts +1 -2
- package/dist/dbt/manifest.js +1 -20
- package/dist/dbt/validation.d.ts +2 -2
- package/dist/dbt/validation.js +1 -3
- package/dist/handlers/compile.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
@@ -40,10 +40,10 @@ Lightdash login
|
|
40
40
|
node ./packages/cli/dist/index.js login http://localhost:3000
|
41
41
|
```
|
42
42
|
|
43
|
-
|
43
|
+
Lightdash compile
|
44
44
|
|
45
45
|
```
|
46
|
-
|
46
|
+
node ./packages/cli/dist/index.js compile --project-dir ./examples/full-jaffle-shop-demo/dbt --profiles-dir ./examples/full-jaffle-shop-demo/profiles
|
47
47
|
```
|
48
48
|
|
49
49
|
Lightdash generate
|
package/dist/dbt/manifest.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
import { DbtManifest
|
1
|
+
import { DbtManifest } from '@lightdash/common';
|
2
2
|
export type LoadManifestArgs = {
|
3
3
|
targetDir: string;
|
4
4
|
};
|
5
|
-
export declare const getDbtManifest: () => Promise<DbtManifestVersion>;
|
6
5
|
export declare const getManifestPath: (targetDir: string) => Promise<string>;
|
7
6
|
export declare const loadManifest: ({ targetDir, }: LoadManifestArgs) => Promise<DbtManifest>;
|
package/dist/dbt/manifest.js
CHANGED
@@ -1,29 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.loadManifest = exports.getManifestPath =
|
3
|
+
exports.loadManifest = exports.getManifestPath = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
|
-
const common_1 = require("@lightdash/common");
|
6
5
|
const fs_1 = require("fs");
|
7
6
|
const path = tslib_1.__importStar(require("path"));
|
8
7
|
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
9
|
-
const getDbtVersion_1 = require("../handlers/dbt/getDbtVersion");
|
10
|
-
const getDbtManifest = async () => {
|
11
|
-
const version = await (0, getDbtVersion_1.getDbtVersion)();
|
12
|
-
if (version.startsWith('1.3.'))
|
13
|
-
return common_1.DbtManifestVersion.V7;
|
14
|
-
if (version.startsWith('1.5.'))
|
15
|
-
return common_1.DbtManifestVersion.V9;
|
16
|
-
if (version.startsWith('1.6.'))
|
17
|
-
return common_1.DbtManifestVersion.V10;
|
18
|
-
if (version.startsWith('1.7.'))
|
19
|
-
return common_1.DbtManifestVersion.V11;
|
20
|
-
if (version.startsWith('1.8.'))
|
21
|
-
return common_1.DbtManifestVersion.V12;
|
22
|
-
if (version.startsWith('1.9.'))
|
23
|
-
return common_1.DbtManifestVersion.V12;
|
24
|
-
return common_1.DbtManifestVersion.V8;
|
25
|
-
};
|
26
|
-
exports.getDbtManifest = getDbtManifest;
|
27
8
|
const getManifestPath = async (targetDir) => path.join(targetDir, 'manifest.json');
|
28
9
|
exports.getManifestPath = getManifestPath;
|
29
10
|
const loadManifest = async ({ targetDir, }) => {
|
package/dist/dbt/validation.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { DbtModelNode, DbtRawModelNode, ExploreError } from '@lightdash/common';
|
1
|
+
import { DbtModelNode, DbtRawModelNode, ExploreError, type DbtManifestVersion } from '@lightdash/common';
|
2
2
|
type DbtModelsGroupedByState = {
|
3
3
|
valid: DbtModelNode[];
|
4
4
|
invalid: ExploreError[];
|
5
5
|
skipped: DbtRawModelNode[];
|
6
6
|
};
|
7
|
-
export declare const validateDbtModel: (adapterType: string, models: DbtRawModelNode[]) => Promise<DbtModelsGroupedByState>;
|
7
|
+
export declare const validateDbtModel: (adapterType: string, manifestVersion: DbtManifestVersion, models: DbtRawModelNode[]) => Promise<DbtModelsGroupedByState>;
|
8
8
|
export {};
|
package/dist/dbt/validation.js
CHANGED
@@ -4,10 +4,8 @@ exports.validateDbtModel = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const common_1 = require("@lightdash/common");
|
6
6
|
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
7
|
-
const
|
8
|
-
const validateDbtModel = async (adapterType, models) => {
|
7
|
+
const validateDbtModel = async (adapterType, manifestVersion, models) => {
|
9
8
|
globalState_1.default.debug(`> Validating ${models.length} models from dbt manifest`);
|
10
|
-
const manifestVersion = await (0, manifest_1.getDbtManifest)();
|
11
9
|
globalState_1.default.debug(`> Validating models using dbt manifest version ${manifestVersion}`);
|
12
10
|
const validator = new common_1.ManifestValidator(manifestVersion);
|
13
11
|
const results = models.reduce((acc, model) => {
|
package/dist/handlers/compile.js
CHANGED
@@ -19,7 +19,6 @@ const compile_1 = require("./dbt/compile");
|
|
19
19
|
const getDbtVersion_1 = require("./dbt/getDbtVersion");
|
20
20
|
const compile = async (options) => {
|
21
21
|
const dbtVersion = await (0, getDbtVersion_1.getDbtVersion)();
|
22
|
-
const manifestVersion = await (0, manifest_1.getDbtManifest)();
|
23
22
|
globalState_1.default.debug(`> dbt version ${dbtVersion}`);
|
24
23
|
const executionId = (0, uuid_1.v4)();
|
25
24
|
await analytics_1.LightdashAnalytics.track({
|
@@ -71,10 +70,11 @@ const compile = async (options) => {
|
|
71
70
|
: undefined,
|
72
71
|
});
|
73
72
|
const manifest = await (0, manifest_1.loadManifest)({ targetDir: context.targetDir });
|
73
|
+
const manifestVersion = (0, common_1.getDbtManifestVersion)(manifest);
|
74
74
|
const manifestModels = (0, models_1.getModelsFromManifest)(manifest);
|
75
75
|
const compiledModels = (0, compile_1.getCompiledModels)(manifestModels, compiledModelIds);
|
76
76
|
const adapterType = manifest.metadata.adapter_type;
|
77
|
-
const { valid: validModels, invalid: failedExplores } = await (0, validation_1.validateDbtModel)(adapterType, compiledModels);
|
77
|
+
const { valid: validModels, invalid: failedExplores } = await (0, validation_1.validateDbtModel)(adapterType, manifestVersion, compiledModels);
|
78
78
|
if (failedExplores.length > 0) {
|
79
79
|
const errors = failedExplores.map((failedExplore) => failedExplore.errors.map((error) => `- ${failedExplore.name}: ${error.message}\n`));
|
80
80
|
console.error(styles.warning(`Found ${failedExplores.length} errors when validating dbt models:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lightdash/cli",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.1435.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.
|
15
|
-
"@lightdash/warehouses": "^0.
|
14
|
+
"@lightdash/common": "^0.1435.0",
|
15
|
+
"@lightdash/warehouses": "^0.1435.0",
|
16
16
|
"@types/columnify": "^1.5.1",
|
17
17
|
"ajv": "^8.11.0",
|
18
18
|
"ajv-formats": "^2.1.1",
|