@lightdash/cli 0.2145.0 → 0.2147.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":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,+BAA+B,EAGlC,MAAM,mBAAmB,CAAC;AAe3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,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,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAyEF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,IAAI,CAyOd,CAAC;AAEF,eAAO,MAAM,mBAAmB,YACnB,qBAAqB,KAC/B,OAAO,CAAC,IAAI,CAwHd,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAClB,yBAAyB,KACnC,OAAO,CAAC,IAAI,CA0Cd,CAAC"}
|
package/dist/handlers/preview.js
CHANGED
|
@@ -91,14 +91,38 @@ const previewHandler = async (options) => {
|
|
|
91
91
|
}
|
|
92
92
|
let project;
|
|
93
93
|
let hasContentCopy = false;
|
|
94
|
+
let contentCopyError;
|
|
94
95
|
const config = await (0, config_1.getConfig)();
|
|
96
|
+
// Validate upstream project before attempting to copy content
|
|
97
|
+
let upstreamProjectValid = false;
|
|
98
|
+
if (config.context?.project && !options.skipCopyContent) {
|
|
99
|
+
try {
|
|
100
|
+
globalState_1.default.debug(`> Validating upstream project: ${config.context.project}`);
|
|
101
|
+
const upstreamProject = await (0, apiClient_1.lightdashApi)({
|
|
102
|
+
method: 'GET',
|
|
103
|
+
url: `/api/v1/projects/${config.context.project}`,
|
|
104
|
+
body: undefined,
|
|
105
|
+
});
|
|
106
|
+
upstreamProjectValid =
|
|
107
|
+
upstreamProject.results.projectUuid === config.context.project;
|
|
108
|
+
if (!upstreamProjectValid) {
|
|
109
|
+
console.error(styles.warning(`\n\nWarning: Cannot access upstream project "${config.context.projectName || config.context.project}"\n` +
|
|
110
|
+
`Content will not be copied. Please run 'lightdash config set-project' to set a valid project.\n`));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
globalState_1.default.debug(`> Upstream project validation failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
115
|
+
console.error(styles.warning(`\n\nWarning: Cannot access upstream project "${config.context.projectName || config.context.project}"\n` +
|
|
116
|
+
`Content will not be copied. Please run 'lightdash config set-project' to set a valid project.\n`));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
95
119
|
if (!config.context?.project) {
|
|
96
120
|
console.error(styles.warning(`\n\nDeveloper preview will be deployed without any copied content!\nPlease set a project to copy content from by running 'lightdash config set-project'.\n`));
|
|
97
121
|
}
|
|
98
122
|
else if (options.skipCopyContent) {
|
|
99
123
|
console.error(styles.warning(`\n\nDeveloper preview will be deployed without any copied content!\n`));
|
|
100
124
|
}
|
|
101
|
-
else {
|
|
125
|
+
else if (upstreamProjectValid) {
|
|
102
126
|
console.error(`\n${styles.success('✔')} Copying charts and dashboards from "${config.context?.projectName || 'source project'}"`);
|
|
103
127
|
}
|
|
104
128
|
try {
|
|
@@ -106,11 +130,14 @@ const previewHandler = async (options) => {
|
|
|
106
130
|
...options,
|
|
107
131
|
name,
|
|
108
132
|
type: common_1.ProjectType.PREVIEW,
|
|
109
|
-
upstreamProjectUuid: config.context?.project
|
|
110
|
-
|
|
133
|
+
upstreamProjectUuid: upstreamProjectValid && config.context?.project
|
|
134
|
+
? config.context.project
|
|
135
|
+
: undefined,
|
|
136
|
+
copyContent: !options.skipCopyContent && upstreamProjectValid,
|
|
111
137
|
});
|
|
112
138
|
project = results?.project;
|
|
113
139
|
hasContentCopy = Boolean(results?.hasContentCopy);
|
|
140
|
+
contentCopyError = results?.contentCopyError;
|
|
114
141
|
}
|
|
115
142
|
catch (e) {
|
|
116
143
|
globalState_1.default.debug(`> Unable to create project: ${e}`);
|
|
@@ -146,7 +173,8 @@ const previewHandler = async (options) => {
|
|
|
146
173
|
process.exit(0);
|
|
147
174
|
});
|
|
148
175
|
if (!hasContentCopy) {
|
|
149
|
-
|
|
176
|
+
const errorMessage = `\n\nDeveloper preview deployed without any copied content!\n ${contentCopyError ? `Error: ${contentCopyError}\n` : ''}`;
|
|
177
|
+
console.error(styles.warning(errorMessage));
|
|
150
178
|
}
|
|
151
179
|
spinner.succeed(` Developer preview "${name}" ready at: ${await projectUrl(project)}\n`);
|
|
152
180
|
await analytics_1.LightdashAnalytics.track({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2147.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lightdash": "dist/index.js"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"parse-node-version": "^2.0.0",
|
|
34
34
|
"unique-names-generator": "^4.7.1",
|
|
35
35
|
"uuid": "^11.0.3",
|
|
36
|
-
"@lightdash/common": "0.
|
|
37
|
-
"@lightdash/warehouses": "0.
|
|
36
|
+
"@lightdash/common": "0.2147.0",
|
|
37
|
+
"@lightdash/warehouses": "0.2147.0"
|
|
38
38
|
},
|
|
39
39
|
"description": "Lightdash CLI tool",
|
|
40
40
|
"devDependencies": {
|