@lightdash/cli 1.203.0 → 1.204.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,OAAO,EACP,YAAY,EAef,MAAM,mBAAmB,CAAC;AAoB3B,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAI9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACpD,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,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,CAAC;IACrC,iBAAiB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,YACvB,OAAO,GAAG,YAAY,KAChC,OAIW,CAAC;AAEf,eAAO,MAAM,0BAA0B,YAC1B,OAAO,GAAG,YAAY,KAChC,OAAO,GAAG,YAiBZ,CAAC;AAuMF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,oBAAoB,CAsU9B,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
|
@@ -80,26 +80,13 @@ const getExploresFromLightdashYmlProject = async ({ projectDir, lightdashProject
|
|
|
80
80
|
* no semantic models.
|
|
81
81
|
*/
|
|
82
82
|
const applyMetricFlowMetrics = (models, manifest) => {
|
|
83
|
-
const semanticModels = manifest.semantic_models;
|
|
84
|
-
if (!semanticModels || Object.keys(semanticModels).length === 0) {
|
|
85
|
-
return models;
|
|
86
|
-
}
|
|
87
|
-
const modelNamesByUniqueId = Object.fromEntries(models.map((model) => [model.unique_id, model.name]));
|
|
88
83
|
// MetricFlow translation is best-effort: a malformed manifest must never
|
|
89
84
|
// abort the compile/deploy, so degrade to "no translated metrics".
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
semanticModels,
|
|
94
|
-
metrics: manifest.metrics ?? {},
|
|
95
|
-
modelNamesByUniqueId,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
console.error(styles.warning(`> Failed to translate MetricFlow metrics, continuing without them: ${(0, common_1.getErrorMessage)(e)}`));
|
|
85
|
+
const { models: modelsWithMetrics, warnings, translatedCount, skippedCount, error, } = (0, common_1.applyMetricFlowMetricsToModels)(models, manifest);
|
|
86
|
+
if (error !== null) {
|
|
87
|
+
console.error(styles.warning(`> Failed to translate MetricFlow metrics, continuing without them: ${error}`));
|
|
100
88
|
return models;
|
|
101
89
|
}
|
|
102
|
-
const { metricsByModel, warnings, translatedCount, skippedCount } = translation;
|
|
103
90
|
warnings.forEach((warning) => globalState_1.default.debug(`> ${warning}`));
|
|
104
91
|
if (translatedCount === 0) {
|
|
105
92
|
if (skippedCount > 0) {
|
|
@@ -111,19 +98,7 @@ const applyMetricFlowMetrics = (models, manifest) => {
|
|
|
111
98
|
? ` (skipped ${skippedCount} unsupported, run with --verbose for details)`
|
|
112
99
|
: '';
|
|
113
100
|
console.error(styles.info(`> Translated ${translatedCount} MetricFlow metric(s) into Lightdash metrics${skippedSuffix}`));
|
|
114
|
-
return
|
|
115
|
-
const modelMetrics = metricsByModel[model.name];
|
|
116
|
-
if (!modelMetrics) {
|
|
117
|
-
return model;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
...model,
|
|
121
|
-
meta: {
|
|
122
|
-
...model.meta,
|
|
123
|
-
metrics: { ...modelMetrics, ...model.meta.metrics },
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
});
|
|
101
|
+
return modelsWithMetrics;
|
|
127
102
|
};
|
|
128
103
|
/**
|
|
129
104
|
* When using --defer, non-selected models pulled in via joins
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.204.0",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"unique-names-generator": "4.7.1",
|
|
46
46
|
"uuid": "11.1.1",
|
|
47
47
|
"yaml": "2.8.3",
|
|
48
|
-
"@lightdash/common": "1.
|
|
49
|
-
"@lightdash/warehouses": "1.
|
|
48
|
+
"@lightdash/common": "1.204.0",
|
|
49
|
+
"@lightdash/warehouses": "1.204.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/inquirer": "8.2.4",
|