@lightdash/cli 2.72.5 → 2.74.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/handlers/contentAsCode/fileDiscovery.d.ts +4 -10
- package/dist/handlers/contentAsCode/fileDiscovery.d.ts.map +1 -1
- package/dist/handlers/contentAsCode/fileDiscovery.js +3 -21
- package/dist/handlers/download.d.ts.map +1 -1
- package/dist/handlers/download.js +56 -37
- package/package.json +3 -3
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
contentType: ContentFileType;
|
|
5
|
-
supportedExtension: boolean;
|
|
6
|
-
} | {
|
|
7
|
-
kind: 'loose';
|
|
8
|
-
supportedExtension: boolean;
|
|
9
|
-
};
|
|
1
|
+
import { isSqlChartContent, type ContentAsCodeFileClassification, type ContentAsCodeFileType } from '@lightdash/common';
|
|
2
|
+
export type ContentFileType = ContentAsCodeFileType;
|
|
3
|
+
export type ContentFileClassification = ContentAsCodeFileClassification;
|
|
10
4
|
export declare const classifyContentFilePath: (filePath: string, rootPath?: string) => ContentFileClassification | undefined;
|
|
11
|
-
export
|
|
5
|
+
export { isSqlChartContent };
|
|
12
6
|
//# sourceMappingURL=fileDiscovery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDiscovery.d.ts","sourceRoot":"","sources":["../../../src/handlers/contentAsCode/fileDiscovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fileDiscovery.d.ts","sourceRoot":"","sources":["../../../src/handlers/contentAsCode/fileDiscovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EACjB,KAAK,+BAA+B,EACpC,KAAK,qBAAqB,EAC7B,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD,MAAM,MAAM,yBAAyB,GAAG,+BAA+B,CAAC;AAYxE,eAAO,MAAM,uBAAuB,aACtB,MAAM,aACL,MAAM,KAClB,yBAAyB,GAAG,SAG9B,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isSqlChartContent = exports.classifyContentFilePath = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@lightdash/common");
|
|
6
|
+
Object.defineProperty(exports, "isSqlChartContent", { enumerable: true, get: function () { return common_1.isSqlChartContent; } });
|
|
5
7
|
const path = tslib_1.__importStar(require("path"));
|
|
6
8
|
const isWithinRoot = (filePath, rootPath) => {
|
|
7
9
|
const relativePath = path.relative(rootPath, filePath);
|
|
@@ -13,26 +15,6 @@ const isWithinRoot = (filePath, rootPath) => {
|
|
|
13
15
|
const classifyContentFilePath = (filePath, rootPath) => {
|
|
14
16
|
if (rootPath && !isWithinRoot(filePath, rootPath))
|
|
15
17
|
return undefined;
|
|
16
|
-
|
|
17
|
-
if (!supportedExtension && !filePath.endsWith('.yaml'))
|
|
18
|
-
return undefined;
|
|
19
|
-
if (filePath.endsWith('.space.yml') ||
|
|
20
|
-
filePath.endsWith('.language.map.yml')) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
const parentFolder = path.basename(path.dirname(filePath));
|
|
24
|
-
if (parentFolder === 'charts') {
|
|
25
|
-
return { kind: 'content', contentType: 'chart', supportedExtension };
|
|
26
|
-
}
|
|
27
|
-
if (parentFolder === 'dashboards') {
|
|
28
|
-
return {
|
|
29
|
-
kind: 'content',
|
|
30
|
-
contentType: 'dashboard',
|
|
31
|
-
supportedExtension,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return { kind: 'loose', supportedExtension };
|
|
18
|
+
return (0, common_1.classifyContentAsCodeFilePath)(filePath.split(path.sep).join('/'));
|
|
35
19
|
};
|
|
36
20
|
exports.classifyContentFilePath = classifyContentFilePath;
|
|
37
|
-
const isSqlChartContent = (item) => 'sql' in item && !('tableName' in item);
|
|
38
|
-
exports.isSqlChartContent = isSqlChartContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/handlers/download.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EA0BX,WAAW,EAIX,eAAe,EAGf,wBAAwB,
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/handlers/download.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EA0BX,WAAW,EAIX,eAAe,EAGf,wBAAwB,EAoBxB,KAAK,WAAW,EACnB,MAAM,mBAAmB,CAAC;AAiB3B,OAAO,EAIH,KAAK,0BAA0B,EAClC,MAAM,iCAAiC,CAAC;AAoEzC,OAAO,EACH,sBAAsB,EAGtB,cAAc,EACd,qBAAqB,EAKrB,cAAc,EACd,cAAc,EACd,8BAA8B,EAC9B,yBAAyB,EACzB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EAElB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,sBAAsB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAA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+LA,CAAC;AA8DF,QAAA,MAAM,2BAA2B,gEAK9B;IACC,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC5B,KAAG,MAAM,EAWT,CAAC;AAEF,QAAA,MAAM,sBAAsB,mBACR,MAAM,EAAE,eACX,MAAM,oBACF,CAAC,eAAe,GAAG;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,KAClE,OAAO,CAAC,MAAM,EAAE,CAId,CAAC;AAEN,QAAA,MAAM,oBAAoB,mBACN,MAAM,EAAE,eACX,MAAM,oBACF,CAAC,eAAe,GAAG;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,KAClE,OAAO,CAAC,MAAM,EAAE,CAId,CAAC;AAIN,QAAA,MAAM,0BAA0B,eAChB,OAAO,kBACH,MAAM,EAAE,KACzB,OAAoD,CAAC;AAExD,QAAA,MAAM,yBAAyB,gBACd,MAAM,KACpB,OAAO,CAAC,IAAI,CA6Bd,CAAC;AAoCF,eAAO,MAAM,aAAa,YACb,sBAAsB,KAChC,OAAO,CAAC,IAAI,CA+pCd,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCvB,CAAC"}
|
|
@@ -2005,8 +2005,42 @@ const reportOpenDraftsForUpload = async (projectUuid) => {
|
|
|
2005
2005
|
globalState_1.default.debug(`Could not load content-as-code upload advisory: ${(0, common_1.getErrorMessage)(error)}`);
|
|
2006
2006
|
}
|
|
2007
2007
|
};
|
|
2008
|
+
// null when the project dir has no lightdash.config.yml
|
|
2009
|
+
const readUploadProjectConfig = async () => {
|
|
2010
|
+
const configExists = await fs_1.promises
|
|
2011
|
+
.access(path.join(process.cwd(), 'lightdash.config.yml'))
|
|
2012
|
+
.then(() => true)
|
|
2013
|
+
.catch(() => false);
|
|
2014
|
+
if (!configExists)
|
|
2015
|
+
return null;
|
|
2016
|
+
try {
|
|
2017
|
+
return await (0, lightdash_config_1.readAndLoadLightdashProjectConfig)(process.cwd());
|
|
2018
|
+
}
|
|
2019
|
+
catch (error) {
|
|
2020
|
+
throw new common_1.LightdashError({
|
|
2021
|
+
message: `Upload aborted: lightdash.config.yml exists but could not be read, so the repo's content_as_code settings cannot be honoured. Fix the config and retry. ${(0, common_1.getErrorMessage)(error)}`,
|
|
2022
|
+
name: 'ParseError',
|
|
2023
|
+
statusCode: 400,
|
|
2024
|
+
data: {},
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
// The stamped path is the uploaded directory relative to the project dir;
|
|
2029
|
+
// a directory outside it has no repo path to stamp
|
|
2030
|
+
const getStampedContentPath = (uploadRoot) => {
|
|
2031
|
+
const relative = path.relative(process.cwd(), uploadRoot);
|
|
2032
|
+
if (path.isAbsolute(relative) ||
|
|
2033
|
+
relative === '..' ||
|
|
2034
|
+
relative.startsWith(`..${path.sep}`)) {
|
|
2035
|
+
return undefined;
|
|
2036
|
+
}
|
|
2037
|
+
return (0, common_1.normalizeContentAsCodePath)(relative.split(path.sep).join('/'));
|
|
2038
|
+
};
|
|
2008
2039
|
const uploadHandler = async (options) => {
|
|
2009
2040
|
globalState_1.default.setVerbose(options.verbose);
|
|
2041
|
+
const projectConfig = await readUploadProjectConfig();
|
|
2042
|
+
// --path wins; otherwise content_as_code.path from lightdash.config.yml
|
|
2043
|
+
const contentPathOption = options.path ?? projectConfig?.content_as_code?.path;
|
|
2010
2044
|
if (options.spacesOnly && options.skipSpaces) {
|
|
2011
2045
|
throw new common_1.ParameterError('Nothing to upload: --spaces-only cannot be combined with --skip-spaces.');
|
|
2012
2046
|
}
|
|
@@ -2058,7 +2092,7 @@ const uploadHandler = async (options) => {
|
|
|
2058
2092
|
let preflightSpaceFiles = [];
|
|
2059
2093
|
if (shouldReconcileSpaces) {
|
|
2060
2094
|
try {
|
|
2061
|
-
preflightSpaceFiles = await (0, spacesAsCode_1.readSpaceFiles)(
|
|
2095
|
+
preflightSpaceFiles = await (0, spacesAsCode_1.readSpaceFiles)(contentPathOption);
|
|
2062
2096
|
}
|
|
2063
2097
|
catch (error) {
|
|
2064
2098
|
throw (0, spacesAsCode_1.createSpaceAsCodeUploadError)((0, common_1.getErrorMessage)(error));
|
|
@@ -2074,7 +2108,7 @@ const uploadHandler = async (options) => {
|
|
|
2074
2108
|
}
|
|
2075
2109
|
if (isOrganizationUpload) {
|
|
2076
2110
|
await (0, organizationContent_1.uploadOrganizationContent)({
|
|
2077
|
-
customPath:
|
|
2111
|
+
customPath: contentPathOption,
|
|
2078
2112
|
config,
|
|
2079
2113
|
sendInvites: options.sendInvites,
|
|
2080
2114
|
});
|
|
@@ -2094,31 +2128,16 @@ const uploadHandler = async (options) => {
|
|
|
2094
2128
|
(0, selectProject_1.logSelectedProject)(projectSelection, config, 'Uploading to');
|
|
2095
2129
|
await reportOpenDraftsForUpload(projectId);
|
|
2096
2130
|
// Persist repo-owned sync settings for the review/write-back workflow.
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
if (configExists) {
|
|
2103
|
-
try {
|
|
2104
|
-
const projectConfig = await (0, lightdash_config_1.readAndLoadLightdashProjectConfig)(process.cwd(), projectId);
|
|
2105
|
-
syncEnabled = projectConfig.content_as_code?.sync === true;
|
|
2106
|
-
}
|
|
2107
|
-
catch (error) {
|
|
2108
|
-
throw new common_1.LightdashError({
|
|
2109
|
-
message: `Upload aborted: lightdash.config.yml exists but could not be read, so the repo's content_as_code.sync opt-in cannot be honoured. Fix the config and retry. ${(0, common_1.getErrorMessage)(error)}`,
|
|
2110
|
-
name: 'ParseError',
|
|
2111
|
-
statusCode: 400,
|
|
2112
|
-
data: {},
|
|
2113
|
-
});
|
|
2114
|
-
}
|
|
2131
|
+
if (projectConfig) {
|
|
2132
|
+
const stamp = {
|
|
2133
|
+
sync: projectConfig.content_as_code?.sync === true,
|
|
2134
|
+
path: getStampedContentPath((0, contentAsCodePaths_1.getDownloadFolder)(contentPathOption)),
|
|
2135
|
+
};
|
|
2115
2136
|
try {
|
|
2116
2137
|
await (0, apiClient_1.lightdashApi)({
|
|
2117
2138
|
method: 'POST',
|
|
2118
2139
|
url: `/api/v1/projects/${projectId}/code/sync-settings`,
|
|
2119
|
-
body: JSON.stringify(
|
|
2120
|
-
sync: syncEnabled,
|
|
2121
|
-
}),
|
|
2140
|
+
body: JSON.stringify(stamp),
|
|
2122
2141
|
});
|
|
2123
2142
|
}
|
|
2124
2143
|
catch (error) {
|
|
@@ -2141,7 +2160,7 @@ const uploadHandler = async (options) => {
|
|
|
2141
2160
|
operation: 'upload',
|
|
2142
2161
|
scope: 'project',
|
|
2143
2162
|
});
|
|
2144
|
-
const uploadRoot = (0, contentAsCodePaths_1.getDownloadFolder)(
|
|
2163
|
+
const uploadRoot = (0, contentAsCodePaths_1.getDownloadFolder)(contentPathOption);
|
|
2145
2164
|
const completeUpload = () => {
|
|
2146
2165
|
const renderedSummary = output.complete(uploadRoot, (Date.now() - start) / 1000);
|
|
2147
2166
|
if (!renderedSummary) {
|
|
@@ -2157,7 +2176,7 @@ const uploadHandler = async (options) => {
|
|
|
2157
2176
|
const spaceFiles = preflightSpaceFiles;
|
|
2158
2177
|
const spaceNames = shouldReconcileSpaces
|
|
2159
2178
|
? (0, spacesAsCode_1.getSpaceNames)(spaceFiles)
|
|
2160
|
-
: await (0, spacesAsCode_1.readSpaceNames)(
|
|
2179
|
+
: await (0, spacesAsCode_1.readSpaceNames)(contentPathOption);
|
|
2161
2180
|
if (spaceFiles.length > 0) {
|
|
2162
2181
|
(0, contentAsCodeOutput_1.logContentAsCodeDiscovery)(`Found ${spaceFiles.length} space definition(s)`);
|
|
2163
2182
|
}
|
|
@@ -2193,7 +2212,7 @@ const uploadHandler = async (options) => {
|
|
|
2193
2212
|
// Discover loose YAML files (outside charts/ and dashboards/) classified by contentType
|
|
2194
2213
|
const looseFiles = await output.runItem({
|
|
2195
2214
|
label: 'Content files',
|
|
2196
|
-
action: () => readLooseCodeFiles(
|
|
2215
|
+
action: () => readLooseCodeFiles(contentPathOption),
|
|
2197
2216
|
detail: ({ charts, dashboards }) => `${charts.length + dashboards.length} discovered`,
|
|
2198
2217
|
});
|
|
2199
2218
|
if (looseFiles.charts.length > 0) {
|
|
@@ -2213,7 +2232,7 @@ const uploadHandler = async (options) => {
|
|
|
2213
2232
|
const loadDashboardItems = () => {
|
|
2214
2233
|
dashboardItemsPromise =
|
|
2215
2234
|
dashboardItemsPromise ??
|
|
2216
|
-
readDashboardItems(
|
|
2235
|
+
readDashboardItems(contentPathOption, looseFiles.dashboards);
|
|
2217
2236
|
return dashboardItemsPromise;
|
|
2218
2237
|
};
|
|
2219
2238
|
if (!options.skipVirtualViews) {
|
|
@@ -2226,7 +2245,7 @@ const uploadHandler = async (options) => {
|
|
|
2226
2245
|
(options.charts.length > 0 || options.dashboards.length > 0)) {
|
|
2227
2246
|
virtualViewCandidates = selectVirtualViewCandidates({
|
|
2228
2247
|
chartItems: [
|
|
2229
|
-
...(await readCodeFiles('charts',
|
|
2248
|
+
...(await readCodeFiles('charts', contentPathOption)),
|
|
2230
2249
|
...looseFiles.charts,
|
|
2231
2250
|
],
|
|
2232
2251
|
chartSlugs: options.charts,
|
|
@@ -2248,7 +2267,7 @@ const uploadHandler = async (options) => {
|
|
|
2248
2267
|
output,
|
|
2249
2268
|
label: 'Virtual views',
|
|
2250
2269
|
changes,
|
|
2251
|
-
action: () => upsertVirtualViews(projectId, options.virtualViews, changes, options.force, uploadPermissions.virtualViews,
|
|
2270
|
+
action: () => upsertVirtualViews(projectId, options.virtualViews, changes, options.force, uploadPermissions.virtualViews, contentPathOption, virtualViewCandidates),
|
|
2252
2271
|
onCount: (count) => {
|
|
2253
2272
|
counts.virtualViewsNum = count;
|
|
2254
2273
|
},
|
|
@@ -2266,7 +2285,7 @@ const uploadHandler = async (options) => {
|
|
|
2266
2285
|
output,
|
|
2267
2286
|
label: 'External connections',
|
|
2268
2287
|
changes,
|
|
2269
|
-
action: () => upsertExternalConnections(projectId, options.externalConnections, changes, options.force, uploadPermissions.externalConnections,
|
|
2288
|
+
action: () => upsertExternalConnections(projectId, options.externalConnections, changes, options.force, uploadPermissions.externalConnections, contentPathOption),
|
|
2270
2289
|
onCount: (count) => {
|
|
2271
2290
|
counts.externalConnectionsNum = count;
|
|
2272
2291
|
},
|
|
@@ -2389,7 +2408,7 @@ const uploadHandler = async (options) => {
|
|
|
2389
2408
|
!appsPhaseActive) {
|
|
2390
2409
|
globalState_1.default.log(styles.warning('--app-space does not apply to custom chart types — they are project-global and spaceless.'));
|
|
2391
2410
|
}
|
|
2392
|
-
const baseDir = (0, contentAsCodePaths_1.getDownloadFolder)(
|
|
2411
|
+
const baseDir = (0, contentAsCodePaths_1.getDownloadFolder)(contentPathOption);
|
|
2393
2412
|
const appsDir = path.join(baseDir, phase.dirName);
|
|
2394
2413
|
let appFolderEntries;
|
|
2395
2414
|
try {
|
|
@@ -2676,7 +2695,7 @@ const uploadHandler = async (options) => {
|
|
|
2676
2695
|
globalState_1.default.log(styles.warning(`No charts filters provided, skipping`));
|
|
2677
2696
|
return changes;
|
|
2678
2697
|
}
|
|
2679
|
-
const result = await upsertResources('charts', projectId, changes, options.force, chartSlugs, uploadPermissions.charts,
|
|
2698
|
+
const result = await upsertResources('charts', projectId, changes, options.force, chartSlugs, uploadPermissions.charts, contentPathOption, options.skipSpaceCreate, options.public, options.validate, concurrency, looseFiles.charts, spaceNames);
|
|
2680
2699
|
result.failedSlugs.forEach((slug) => failedChartSlugs.add(slug));
|
|
2681
2700
|
counts.chartsNum = result.total;
|
|
2682
2701
|
return result.changes;
|
|
@@ -2700,7 +2719,7 @@ const uploadHandler = async (options) => {
|
|
|
2700
2719
|
failedChartSlugs.has(tile.properties.chartSlug)))
|
|
2701
2720
|
.map((dashboard) => dashboard.slug));
|
|
2702
2721
|
}
|
|
2703
|
-
const result = await upsertResources('dashboards', projectId, changes, options.force, options.dashboards, uploadPermissions.dashboards,
|
|
2722
|
+
const result = await upsertResources('dashboards', projectId, changes, options.force, options.dashboards, uploadPermissions.dashboards, contentPathOption, options.skipSpaceCreate, options.public, options.validate, concurrency, looseFiles.dashboards, spaceNames, dashboardsToSkip);
|
|
2704
2723
|
counts.dashboardsNum = result.total;
|
|
2705
2724
|
return result.changes;
|
|
2706
2725
|
},
|
|
@@ -2715,7 +2734,7 @@ const uploadHandler = async (options) => {
|
|
|
2715
2734
|
output,
|
|
2716
2735
|
label: 'AI agents',
|
|
2717
2736
|
changes,
|
|
2718
|
-
action: () => upsertAiAgents(projectId, options.agents, changes, options.force,
|
|
2737
|
+
action: () => upsertAiAgents(projectId, options.agents, changes, options.force, contentPathOption, options.agents.length === 0),
|
|
2719
2738
|
onCount: (count) => {
|
|
2720
2739
|
counts.agentsNum = count;
|
|
2721
2740
|
},
|
|
@@ -2735,7 +2754,7 @@ const uploadHandler = async (options) => {
|
|
|
2735
2754
|
output,
|
|
2736
2755
|
label: 'Alerts',
|
|
2737
2756
|
changes,
|
|
2738
|
-
action: () => upsertScheduledContent(projectId, options.alerts, changes, options.force, common_1.ContentAsCodeType.ALERT, uploadPermissions.alerts,
|
|
2757
|
+
action: () => upsertScheduledContent(projectId, options.alerts, changes, options.force, common_1.ContentAsCodeType.ALERT, uploadPermissions.alerts, contentPathOption),
|
|
2739
2758
|
onCount: (count) => {
|
|
2740
2759
|
counts.alertsNum = count;
|
|
2741
2760
|
},
|
|
@@ -2751,7 +2770,7 @@ const uploadHandler = async (options) => {
|
|
|
2751
2770
|
output,
|
|
2752
2771
|
label: 'Scheduled deliveries',
|
|
2753
2772
|
changes,
|
|
2754
|
-
action: () => upsertScheduledContent(projectId, options.scheduledDeliveries, changes, options.force, common_1.ContentAsCodeType.SCHEDULED_DELIVERY, uploadPermissions.scheduledDeliveries,
|
|
2773
|
+
action: () => upsertScheduledContent(projectId, options.scheduledDeliveries, changes, options.force, common_1.ContentAsCodeType.SCHEDULED_DELIVERY, uploadPermissions.scheduledDeliveries, contentPathOption),
|
|
2755
2774
|
onCount: (count) => {
|
|
2756
2775
|
counts.scheduledDeliveriesNum = count;
|
|
2757
2776
|
},
|
|
@@ -2767,7 +2786,7 @@ const uploadHandler = async (options) => {
|
|
|
2767
2786
|
output,
|
|
2768
2787
|
label: 'Google Sheets syncs',
|
|
2769
2788
|
changes,
|
|
2770
|
-
action: () => upsertScheduledContent(projectId, options.googleSheets, changes, options.force, common_1.ContentAsCodeType.GOOGLE_SHEETS_SYNC, uploadPermissions.googleSheets,
|
|
2789
|
+
action: () => upsertScheduledContent(projectId, options.googleSheets, changes, options.force, common_1.ContentAsCodeType.GOOGLE_SHEETS_SYNC, uploadPermissions.googleSheets, contentPathOption),
|
|
2771
2790
|
onCount: (count) => {
|
|
2772
2791
|
counts.googleSheetsNum = count;
|
|
2773
2792
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.74.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": "2.
|
|
49
|
-
"@lightdash/warehouses": "2.
|
|
48
|
+
"@lightdash/common": "2.74.0",
|
|
49
|
+
"@lightdash/warehouses": "2.74.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/inquirer": "8.2.4",
|