@lightdash/common 0.1456.1 → 0.1457.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/dist/types/dbt.d.ts +2 -0
- package/dist/types/dbt.js +23 -1
- package/dist/types/projects.d.ts +1 -0
- package/package.json +45 -44
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Telescope Technologies Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/dist/types/dbt.d.ts
CHANGED
@@ -278,4 +278,6 @@ export type DbtExposure = {
|
|
278
278
|
url?: string;
|
279
279
|
tags?: string[];
|
280
280
|
};
|
281
|
+
export declare const getModelsFromManifest: (manifest: DbtManifest) => DbtModelNode[];
|
282
|
+
export declare function getCompiledModels(manifestModels: DbtModelNode[], compiledModelIds?: string[]): DbtModelNode[];
|
281
283
|
export {};
|
package/dist/types/dbt.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.DbtExposureType = exports.getLatestSupportedDbtManifestVersion = exports.getDbtManifestVersion = exports.DbtManifestVersion = exports.convertColumnMetric = exports.convertModelMetric = exports.isDbtRpcRunSqlResults = exports.convertToGroups = exports.isDbtRpcCompileResults = exports.isDbtRpcManifestResults = exports.isSupportedDbtAdapterType = exports.isSupportedDbtAdapter = exports.isV9MetricRef = exports.isDbtPackages = exports.isDbtRpcDocsGenerateResults = exports.buildModelGraph = exports.patchPathParts = exports.normaliseModelDatabase = exports.SupportedDbtAdapter = void 0;
|
3
|
+
exports.getCompiledModels = exports.getModelsFromManifest = exports.DbtExposureType = exports.getLatestSupportedDbtManifestVersion = exports.getDbtManifestVersion = exports.DbtManifestVersion = exports.convertColumnMetric = exports.convertModelMetric = exports.isDbtRpcRunSqlResults = exports.convertToGroups = exports.isDbtRpcCompileResults = exports.isDbtRpcManifestResults = exports.isSupportedDbtAdapterType = exports.isSupportedDbtAdapter = exports.isV9MetricRef = exports.isDbtPackages = exports.isDbtRpcDocsGenerateResults = exports.buildModelGraph = exports.patchPathParts = exports.normaliseModelDatabase = exports.SupportedDbtAdapter = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const dependency_graph_1 = require("dependency-graph");
|
6
6
|
const assertUnreachable_1 = tslib_1.__importDefault(require("../utils/assertUnreachable"));
|
@@ -236,3 +236,25 @@ var DbtExposureType;
|
|
236
236
|
DbtExposureType["ML"] = "ml";
|
237
237
|
DbtExposureType["APPLICATION"] = "application";
|
238
238
|
})(DbtExposureType = exports.DbtExposureType || (exports.DbtExposureType = {}));
|
239
|
+
const getModelsFromManifest = (manifest) => {
|
240
|
+
const models = Object.values(manifest.nodes).filter((node) => node.resource_type === 'model' &&
|
241
|
+
node.config?.materialized !== 'ephemeral');
|
242
|
+
if (!(0, exports.isSupportedDbtAdapter)(manifest.metadata)) {
|
243
|
+
throw new errors_1.ParseError(`dbt adapter not supported. Lightdash does not support adapter ${manifest.metadata.adapter_type}`, {});
|
244
|
+
}
|
245
|
+
const adapterType = manifest.metadata.adapter_type;
|
246
|
+
return models
|
247
|
+
.filter((model) => model.config?.materialized &&
|
248
|
+
model.config.materialized !== 'ephemeral')
|
249
|
+
.map((model) => (0, exports.normaliseModelDatabase)(model, adapterType));
|
250
|
+
};
|
251
|
+
exports.getModelsFromManifest = getModelsFromManifest;
|
252
|
+
function getCompiledModels(manifestModels, compiledModelIds) {
|
253
|
+
return manifestModels.filter((model) => {
|
254
|
+
if (compiledModelIds) {
|
255
|
+
return compiledModelIds.includes(model.unique_id);
|
256
|
+
}
|
257
|
+
return model.compiled;
|
258
|
+
});
|
259
|
+
}
|
260
|
+
exports.getCompiledModels = getCompiledModels;
|
package/dist/types/projects.d.ts
CHANGED
@@ -158,6 +158,7 @@ export declare const DefaultSupportedDbtVersion = DbtVersionOptionLatest.LATEST;
|
|
158
158
|
export interface DbtProjectCompilerBase extends DbtProjectConfigBase {
|
159
159
|
target?: string;
|
160
160
|
environment?: DbtProjectEnvironmentVariable[];
|
161
|
+
selector?: string;
|
161
162
|
}
|
162
163
|
export interface DbtNoneProjectConfig extends DbtProjectCompilerBase {
|
163
164
|
type: DbtProjectType.NONE;
|
package/package.json
CHANGED
@@ -1,45 +1,46 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
}
|
2
|
+
"name": "@lightdash/common",
|
3
|
+
"version": "0.1457.0",
|
4
|
+
"main": "dist/index.js",
|
5
|
+
"types": "dist/index.d.ts",
|
6
|
+
"files": [
|
7
|
+
"dist/**/*"
|
8
|
+
],
|
9
|
+
"license": "MIT",
|
10
|
+
"devDependencies": {
|
11
|
+
"@types/pegjs": "^0.10.3",
|
12
|
+
"@types/sanitize-html": "^2.11.0",
|
13
|
+
"@types/uuid": "^10.0.0",
|
14
|
+
"typescript-json-schema": "^0.54.0"
|
15
|
+
},
|
16
|
+
"dependencies": {
|
17
|
+
"@casl/ability": "^5.4.3",
|
18
|
+
"@types/lodash": "^4.14.202",
|
19
|
+
"ajv": "^8.3.0",
|
20
|
+
"ajv-formats": "^2.1.0",
|
21
|
+
"cronstrue": "^2.23.0",
|
22
|
+
"dayjs": "^1.11.9",
|
23
|
+
"dependency-graph": "^0.11.0",
|
24
|
+
"liquidjs": "^10.0.0",
|
25
|
+
"lodash": "^4.17.21",
|
26
|
+
"moment": "^2.29.4",
|
27
|
+
"moment-timezone": "^0.5.45",
|
28
|
+
"pegjs": "^0.10.0",
|
29
|
+
"sanitize-html": "^2.12.1",
|
30
|
+
"type-fest": "^4.32.0",
|
31
|
+
"uuid": "^11.0.3",
|
32
|
+
"zod": "^3.22.4"
|
33
|
+
},
|
34
|
+
"scripts": {
|
35
|
+
"dev": "tsx watch --clear-screen=false src/index.ts",
|
36
|
+
"build": "tsc --build tsconfig.json",
|
37
|
+
"linter": "eslint -c .eslintrc.js --ignore-path ./../../.gitignore",
|
38
|
+
"formatter": "prettier --config .prettierrc.js --ignore-unknown --ignore-path ./../../.gitignore",
|
39
|
+
"lint": "pnpm run linter ./src",
|
40
|
+
"fix-lint": "pnpm run linter ./src --fix",
|
41
|
+
"format": "pnpm run formatter ./src --check",
|
42
|
+
"fix-format": "pnpm run formatter ./src --write",
|
43
|
+
"test": "TZ=UTC jest",
|
44
|
+
"release": "pnpm publish --no-git-checks"
|
45
|
+
}
|
46
|
+
}
|