@lightdash/cli 2.603.0 → 2.603.2
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.build +1 -1
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +1 -1
- package/dist/handlers/preview.d.ts.map +1 -1
- package/dist/handlers/preview.js +103 -9
- package/dist/handlers/timestampConversion.d.ts +1 -1
- package/dist/handlers/timestampConversion.d.ts.map +1 -1
- package/dist/handlers/timestampConversion.js +33 -5
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,OAAO,EACP,YAAY,EASZ,KAAK,eAAe,EACpB,KAAK,YAAY,EAGpB,MAAM,mBAAmB,CAAC;AAoB3B,OAAO,EAAE,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAgB7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,KAAK,oBAAoB,GAAG,iBAAiB,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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MAAM,aAAa,oBAA2B,oBAAoB,kBAgMxE,CAAC"}
|
package/dist/handlers/deploy.js
CHANGED
|
@@ -551,7 +551,7 @@ const deployHandler = async (originalOptions) => {
|
|
|
551
551
|
// Log current project info
|
|
552
552
|
(0, selectProject_1.logSelectedProject)(existingProjectSelection, config, 'Deploying to');
|
|
553
553
|
sourceUuid = await (0, sourceSelection_1.resolveProjectSourceUuid)(existingProjectSelection.projectUuid, options.source);
|
|
554
|
-
const projectSettings = await (0, timestampConversion_1.getProjectDeploySettings)(options.disableTimestampConversion, existingProjectSelection.projectUuid);
|
|
554
|
+
const projectSettings = await (0, timestampConversion_1.getProjectDeploySettings)(options.disableTimestampConversion, existingProjectSelection.projectUuid, sourceUuid);
|
|
555
555
|
options.disableTimestampConversion =
|
|
556
556
|
projectSettings.disableTimestampConversion;
|
|
557
557
|
connectionRoute = projectSettings.connectionRoute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EACH,+BAA+B,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/handlers/preview.ts"],"names":[],"mappings":"AACA,OAAO,EACH,+BAA+B,EAUlC,MAAM,mBAAmB,CAAC;AAoB3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAalD,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,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAoBF,KAAK,yBAAyB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AA2GF,eAAO,MAAM,cAAc,oBACN,qBAAqB,KACvC,OAAO,CAAC,IAAI,CAoTd,CAAC;AAkKF,eAAO,MAAM,mBAAmB,oBACX,qBAAqB,KACvC,OAAO,CAAC,IAAI,CA2Qd,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAClB,yBAAyB,KACnC,OAAO,CAAC,IAAI,CA2Cd,CAAC"}
|
package/dist/handlers/preview.js
CHANGED
|
@@ -320,9 +320,48 @@ const previewHandler = async (originalOptions) => {
|
|
|
320
320
|
await cleanupProject(executionId, project.projectUuid, previewStartTime);
|
|
321
321
|
};
|
|
322
322
|
exports.previewHandler = previewHandler;
|
|
323
|
+
const withCurrentSettings = (credentials, current) => {
|
|
324
|
+
if (!current || current.type !== credentials.type)
|
|
325
|
+
return credentials;
|
|
326
|
+
const defined = Object.fromEntries(Object.entries(credentials).filter(([, value]) => value !== undefined));
|
|
327
|
+
return { ...current, ...defined };
|
|
328
|
+
};
|
|
329
|
+
const resolveSourceConnection = async (project, sourceOption, upstreamProjectUuid) => {
|
|
330
|
+
if (project.connectionRoute !== 'multi') {
|
|
331
|
+
return { sourceUuid: undefined, connection: { kind: 'primary' } };
|
|
332
|
+
}
|
|
333
|
+
const sourceUuid = await (0, sourceSelection_1.resolveProjectSourceUuid)(project.projectUuid, sourceOption, upstreamProjectUuid);
|
|
334
|
+
if (!sourceUuid)
|
|
335
|
+
return { sourceUuid, connection: { kind: 'primary' } };
|
|
336
|
+
let bindings;
|
|
337
|
+
try {
|
|
338
|
+
bindings = await (0, apiClient_1.lightdashApi)({
|
|
339
|
+
method: 'GET',
|
|
340
|
+
url: `/api/v1/projects/${project.projectUuid}/warehouse-connections/dbt-sources/bindings`,
|
|
341
|
+
body: undefined,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
return { sourceUuid, connection: { kind: 'unknown', sourceUuid } };
|
|
346
|
+
}
|
|
347
|
+
const boundConnectionUuid = bindings.sources.find((item) => item.projectDbtSourceUuid === sourceUuid)?.warehouseConnectionUuid ?? null;
|
|
348
|
+
if (boundConnectionUuid === null) {
|
|
349
|
+
return { sourceUuid, connection: { kind: 'primary' } };
|
|
350
|
+
}
|
|
351
|
+
const boundConnection = bindings.connections.find((item) => item.warehouseConnectionUuid === boundConnectionUuid);
|
|
352
|
+
if (!boundConnection) {
|
|
353
|
+
return { sourceUuid, connection: { kind: 'unknown', sourceUuid } };
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
sourceUuid,
|
|
357
|
+
connection: boundConnection.isOriginal
|
|
358
|
+
? { kind: 'primary' }
|
|
359
|
+
: { kind: 'extra', connection: boundConnection },
|
|
360
|
+
};
|
|
361
|
+
};
|
|
323
362
|
// Credentials resolved locally (AWS SSO, Snowflake SSO) expire, so a re-run
|
|
324
363
|
// with the same name pushes freshly resolved ones into the existing preview.
|
|
325
|
-
const refreshPreviewWarehouseCredentials = async (projectUuid, options) => {
|
|
364
|
+
const refreshPreviewWarehouseCredentials = async (projectUuid, options, upstreamProjectUuid) => {
|
|
326
365
|
const source = (0, warehouseConnection_1.getWarehouseCredentialsSource)(options);
|
|
327
366
|
if (source.source === 'organization') {
|
|
328
367
|
globalState_1.default.debug(`> Preview uses organization warehouse credentials "${source.name}", nothing to refresh`);
|
|
@@ -345,10 +384,37 @@ const refreshPreviewWarehouseCredentials = async (projectUuid, options) => {
|
|
|
345
384
|
console.error(styles.warning('Keeping the warehouse credentials already stored on the preview.'));
|
|
346
385
|
return;
|
|
347
386
|
}
|
|
348
|
-
const
|
|
387
|
+
const project = await (0, refresh_1.getProject)(projectUuid);
|
|
388
|
+
const { connection: sourceConnection } = await resolveSourceConnection(project, options.source, upstreamProjectUuid);
|
|
389
|
+
if (sourceConnection.kind === 'unknown') {
|
|
390
|
+
console.error(styles.warning(`Could not read which connection source ${options.source ?? sourceConnection.sourceUuid} uses; keeping the warehouse credentials already stored on the preview.`));
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const connection = sourceConnection.kind === 'extra'
|
|
394
|
+
? sourceConnection.connection
|
|
395
|
+
: undefined;
|
|
396
|
+
const spinner = globalState_1.default.startSpinner(connection
|
|
397
|
+
? ` Refreshing warehouse credentials for "${connection.name}"...`
|
|
398
|
+
: ' Refreshing warehouse credentials...');
|
|
349
399
|
try {
|
|
350
|
-
|
|
351
|
-
|
|
400
|
+
if (connection) {
|
|
401
|
+
const current = await (0, apiClient_1.lightdashApi)({
|
|
402
|
+
method: 'GET',
|
|
403
|
+
url: `/api/v1/projects/${projectUuid}/warehouse-connections/${connection.warehouseConnectionUuid}`,
|
|
404
|
+
body: undefined,
|
|
405
|
+
});
|
|
406
|
+
const body = {
|
|
407
|
+
warehouseConnection: withCurrentSettings(loaded.credentials, current.warehouseConnection),
|
|
408
|
+
};
|
|
409
|
+
await (0, apiClient_1.lightdashApi)({
|
|
410
|
+
method: 'PATCH',
|
|
411
|
+
url: `/api/v1/projects/${projectUuid}/warehouse-connections/${connection.warehouseConnectionUuid}`,
|
|
412
|
+
body: JSON.stringify(body),
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
await (0, warehouseConnection_1.updateProjectWarehouseConnection)(project, loaded.credentials, 'Refreshing warehouse credentials');
|
|
417
|
+
}
|
|
352
418
|
spinner.succeed(' Warehouse credentials refreshed');
|
|
353
419
|
}
|
|
354
420
|
catch (e) {
|
|
@@ -401,9 +467,12 @@ const startPreviewHandler = async (originalOptions) => {
|
|
|
401
467
|
await refreshPreviewWarehouseCredentials(previewProject.projectUuid, {
|
|
402
468
|
...options,
|
|
403
469
|
warehouseCredentials: projectTypeConfig.warehouseCredentials,
|
|
404
|
-
});
|
|
470
|
+
}, config.context?.project);
|
|
405
471
|
// Update
|
|
406
|
-
const
|
|
472
|
+
const previewSource = await resolveSourceConnection(await (0, refresh_1.getProject)(previewProject.projectUuid), options.source, config.context?.project);
|
|
473
|
+
const previewSettings = await (0, timestampConversion_1.getProjectDeploySettings)(options.disableTimestampConversion, previewProject.projectUuid, previewSource.connection.kind === 'unknown'
|
|
474
|
+
? undefined
|
|
475
|
+
: previewSource.sourceUuid);
|
|
407
476
|
options.disableTimestampConversion =
|
|
408
477
|
previewSettings.disableTimestampConversion;
|
|
409
478
|
const { explores, isProjectComplete } = await (0, compile_1.compileProject)(options);
|
|
@@ -434,14 +503,26 @@ const startPreviewHandler = async (originalOptions) => {
|
|
|
434
503
|
else {
|
|
435
504
|
console.error(`\n${styles.success('✔')} Copying charts and dashboards from "${config.context?.projectName || 'source project'}"`);
|
|
436
505
|
}
|
|
506
|
+
const upstreamProjectUuid = config.context?.project;
|
|
507
|
+
const upstreamSourceConnection = upstreamProjectUuid &&
|
|
508
|
+
projectTypeConfig.warehouseCredentials !== false &&
|
|
509
|
+
(0, warehouseConnection_1.getWarehouseCredentialsSource)({
|
|
510
|
+
...options,
|
|
511
|
+
warehouseCredentials: projectTypeConfig.warehouseCredentials,
|
|
512
|
+
}).source === 'profiles'
|
|
513
|
+
? (await resolveSourceConnection(await (0, refresh_1.getProject)(upstreamProjectUuid), options.source, upstreamProjectUuid)).connection
|
|
514
|
+
: { kind: 'primary' };
|
|
515
|
+
const keepsUpstreamPrimary = upstreamSourceConnection.kind !== 'primary';
|
|
437
516
|
// Create
|
|
438
517
|
const results = await (0, createProject_1.createProject)({
|
|
439
518
|
...options,
|
|
440
519
|
name: projectName,
|
|
441
520
|
type: common_1.ProjectType.PREVIEW,
|
|
442
|
-
upstreamProjectUuid
|
|
521
|
+
upstreamProjectUuid,
|
|
443
522
|
copyContent: !options.skipCopyContent,
|
|
444
|
-
warehouseCredentials:
|
|
523
|
+
warehouseCredentials: keepsUpstreamPrimary
|
|
524
|
+
? false
|
|
525
|
+
: projectTypeConfig.warehouseCredentials,
|
|
445
526
|
expiresIn: options.expiresIn
|
|
446
527
|
? parseInt(options.expiresIn, 10)
|
|
447
528
|
: undefined,
|
|
@@ -466,7 +547,20 @@ const startPreviewHandler = async (originalOptions) => {
|
|
|
466
547
|
name: options.name,
|
|
467
548
|
},
|
|
468
549
|
});
|
|
469
|
-
if (
|
|
550
|
+
if (keepsUpstreamPrimary) {
|
|
551
|
+
await refreshPreviewWarehouseCredentials(project.projectUuid, {
|
|
552
|
+
...options,
|
|
553
|
+
warehouseCredentials: projectTypeConfig.warehouseCredentials,
|
|
554
|
+
}, upstreamProjectUuid);
|
|
555
|
+
}
|
|
556
|
+
const previewSource = upstreamProjectUuid
|
|
557
|
+
? await resolveSourceConnection(await (0, refresh_1.getProject)(project.projectUuid), options.source, upstreamProjectUuid)
|
|
558
|
+
: undefined;
|
|
559
|
+
if (options.disableTimestampConversion === undefined &&
|
|
560
|
+
previewSource?.connection.kind === 'extra') {
|
|
561
|
+
options.disableTimestampConversion = (await (0, timestampConversion_1.getProjectDeploySettings)(undefined, project.projectUuid, previewSource.sourceUuid)).disableTimestampConversion;
|
|
562
|
+
}
|
|
563
|
+
else if (options.disableTimestampConversion === undefined) {
|
|
470
564
|
options.disableTimestampConversion =
|
|
471
565
|
(0, timestampConversion_1.getDisableTimestampConversionFromProject)(project.warehouseConnection);
|
|
472
566
|
globalState_1.default.debug(`> Using disable-timestamp-conversion=${String(options.disableTimestampConversion ?? false)} from preview project settings`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Project, type ConnectionRoute } from '@lightdash/common';
|
|
2
2
|
export declare const getDisableTimestampConversionFromProject: (warehouseConnection: Project['warehouseConnection']) => boolean | undefined;
|
|
3
|
-
export declare const getProjectDeploySettings: (cliValue: boolean | undefined, projectUuid: string) => Promise<{
|
|
3
|
+
export declare const getProjectDeploySettings: (cliValue: boolean | undefined, projectUuid: string, sourceUuid: string | undefined) => Promise<{
|
|
4
4
|
disableTimestampConversion: boolean | undefined;
|
|
5
5
|
connectionRoute: ConnectionRoute | undefined;
|
|
6
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestampConversion.d.ts","sourceRoot":"","sources":["../../src/handlers/timestampConversion.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"timestampConversion.d.ts","sourceRoot":"","sources":["../../src/handlers/timestampConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EAEP,KAAK,eAAe,EAGvB,MAAM,mBAAmB,CAAC;AAO3B,eAAO,MAAM,wCAAwC,wBAC5B,OAAO,CAAC,qBAAqB,CAAC,KACpD,OAAO,GAAG,SAGM,CAAC;AAEpB,eAAO,MAAM,wBAAwB,aACvB,OAAO,GAAG,SAAS,eAChB,MAAM,cACP,MAAM,GAAG,SAAS,KAC/B,OAAO,CAAC;IACP,0BAA0B,EAAE,OAAO,GAAG,SAAS,CAAC;IAChD,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;CAChD,CAmFA,CAAC;AAEF,eAAO,MAAM,oCAAoC,aACnC,OAAO,GAAG,SAAS,eAChB,MAAM,KACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAQ7B,CAAC"}
|
|
@@ -12,7 +12,7 @@ const getDisableTimestampConversionFromProject = (warehouseConnection) => wareho
|
|
|
12
12
|
? warehouseConnection.disableTimestampConversion
|
|
13
13
|
: undefined;
|
|
14
14
|
exports.getDisableTimestampConversionFromProject = getDisableTimestampConversionFromProject;
|
|
15
|
-
const getProjectDeploySettings = async (cliValue, projectUuid) => {
|
|
15
|
+
const getProjectDeploySettings = async (cliValue, projectUuid, sourceUuid) => {
|
|
16
16
|
if (cliValue !== undefined) {
|
|
17
17
|
console.error(styles.warning('Ignoring --disable-timestamp-conversion: this command reads the setting from the project settings.'));
|
|
18
18
|
}
|
|
@@ -22,10 +22,39 @@ const getProjectDeploySettings = async (cliValue, projectUuid) => {
|
|
|
22
22
|
url: `/api/v1/projects/${projectUuid}`,
|
|
23
23
|
body: undefined,
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
let disableTimestampConversion = (0, exports.getDisableTimestampConversionFromProject)(project.warehouseConnection);
|
|
26
|
+
let settingsSource = 'project settings';
|
|
27
|
+
if (sourceUuid !== undefined && project.connectionRoute === 'multi') {
|
|
28
|
+
try {
|
|
29
|
+
const bindings = await (0, apiClient_1.lightdashApi)({
|
|
30
|
+
method: 'GET',
|
|
31
|
+
url: `/api/v1/projects/${projectUuid}/warehouse-connections/dbt-sources/bindings`,
|
|
32
|
+
body: undefined,
|
|
33
|
+
});
|
|
34
|
+
const warehouseConnectionUuid = bindings.sources.find((source) => source.projectDbtSourceUuid === sourceUuid)?.warehouseConnectionUuid;
|
|
35
|
+
const boundConnection = bindings.connections.find((connection) => connection.warehouseConnectionUuid ===
|
|
36
|
+
warehouseConnectionUuid);
|
|
37
|
+
if (warehouseConnectionUuid && !boundConnection?.isOriginal) {
|
|
38
|
+
const connection = await (0, apiClient_1.lightdashApi)({
|
|
39
|
+
method: 'GET',
|
|
40
|
+
url: `/api/v1/projects/${projectUuid}/warehouse-connections/${warehouseConnectionUuid}`,
|
|
41
|
+
body: undefined,
|
|
42
|
+
});
|
|
43
|
+
disableTimestampConversion =
|
|
44
|
+
(0, exports.getDisableTimestampConversionFromProject)(connection.warehouseConnection ?? undefined);
|
|
45
|
+
settingsSource = `connection "${connection.name}"`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
if (!(e instanceof common_1.LightdashError) || e.statusCode !== 403) {
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
52
|
+
console.error(styles.warning("Could not read the source's connection settings. Using the project setting for timestamp conversion."));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
26
55
|
(0, responseValidation_1.assertConnectionResponse)(disableTimestampConversion === undefined ||
|
|
27
56
|
typeof disableTimestampConversion === 'boolean');
|
|
28
|
-
globalState_1.default.debug(`> Using disable-timestamp-conversion=${String(disableTimestampConversion ?? false)} from
|
|
57
|
+
globalState_1.default.debug(`> Using disable-timestamp-conversion=${String(disableTimestampConversion ?? false)} from ${settingsSource}`);
|
|
29
58
|
return {
|
|
30
59
|
disableTimestampConversion,
|
|
31
60
|
connectionRoute: project.connectionRoute,
|
|
@@ -41,8 +70,7 @@ const getProjectDeploySettings = async (cliValue, projectUuid) => {
|
|
|
41
70
|
exports.getProjectDeploySettings = getProjectDeploySettings;
|
|
42
71
|
const getProjectDisableTimestampConversion = async (cliValue, projectUuid) => {
|
|
43
72
|
try {
|
|
44
|
-
return (await (0, exports.getProjectDeploySettings)(cliValue, projectUuid))
|
|
45
|
-
.disableTimestampConversion;
|
|
73
|
+
return (await (0, exports.getProjectDeploySettings)(cliValue, projectUuid, undefined)).disableTimestampConversion;
|
|
46
74
|
}
|
|
47
75
|
catch {
|
|
48
76
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "2.603.
|
|
3
|
+
"version": "2.603.2",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@actions/core": "1.11.1",
|
|
23
23
|
"@aws-sdk/credential-providers": "3.995.0",
|
|
24
24
|
"@casl/ability": "6.8.0",
|
|
25
|
-
"@lightdash/common": "2.603.
|
|
26
|
-
"@lightdash/warehouses": "2.603.
|
|
25
|
+
"@lightdash/common": "2.603.2",
|
|
26
|
+
"@lightdash/warehouses": "2.603.2",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|