@lightdash/common 0.1456.4 → 0.1457.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1456.4",
3
+ "version": "0.1457.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [