@lightdash/cli 2.205.1 → 2.206.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/compile.d.ts +1 -0
- package/dist/handlers/compile.d.ts.map +1 -1
- package/dist/handlers/compile.js +13 -1
- package/dist/handlers/compileProject.test.js +43 -0
- package/dist/handlers/compileWarehouseColumnValidation.test.js +1 -1
- package/dist/handlers/deploy.d.ts +1 -0
- package/dist/handlers/deploy.d.ts.map +1 -1
- package/dist/handlers/deploy.js +25 -4
- package/dist/handlers/deploy.test.js +76 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/handlers/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,OAAO,EACP,YAAY,EAkBf,MAAM,mBAAmB,CAAC;AAqB3B,OAAO,EAAE,iBAAiB,EAA8B,MAAM,eAAe,CAAC;AAsB9E,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;IAC7B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,C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C;AAEF,eAAO,MAAM,uBAAuB,YACvB,OAAO,GAAG,YAAY,KAChC,OAIW,CAAC;AAEf,eAAO,MAAM,0BAA0B,YAC1B,OAAO,GAAG,YAAY,KAChC,OAAO,GAAG,YAiBZ,CAAC;AAgTF,eAAO,MAAM,cAAc,YACd,qBAAqB,KAC/B,OAAO,CAAC,oBAAoB,CA8b9B,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
|
@@ -239,6 +239,7 @@ const compileProject = async (options) => {
|
|
|
239
239
|
let explores = null;
|
|
240
240
|
let dbtMetrics = null;
|
|
241
241
|
let isProjectComplete = true;
|
|
242
|
+
let dbtModelNames;
|
|
242
243
|
explores = await getExploresFromLightdashYmlProject({
|
|
243
244
|
projectDir: absoluteProjectPath,
|
|
244
245
|
lightdashProjectConfig,
|
|
@@ -268,6 +269,17 @@ const compileProject = async (options) => {
|
|
|
268
269
|
const { compiledModelIds, originallySelectedModelIds } = await (0, compile_1.maybeCompileModelsAndJoins)({ targetDir: context.targetDir }, options);
|
|
269
270
|
let manifest = await (0, manifest_1.loadManifest)({ targetDir: context.targetDir });
|
|
270
271
|
const projectManifestModels = (0, common_1.getModelsFromManifest)(manifest);
|
|
272
|
+
if (!options.combineManifest &&
|
|
273
|
+
!options.combineManifestProjectUuid &&
|
|
274
|
+
!projectManifestModels.some((model) => model.lightdash_source_name !== undefined ||
|
|
275
|
+
model.lightdash_source_uuid !== undefined)) {
|
|
276
|
+
dbtModelNames = [
|
|
277
|
+
...new Set(projectManifestModels.flatMap((model) => [
|
|
278
|
+
model.name,
|
|
279
|
+
`${model.package_name}__${model.name}`,
|
|
280
|
+
])),
|
|
281
|
+
];
|
|
282
|
+
}
|
|
271
283
|
isProjectComplete =
|
|
272
284
|
(0, common_1.getCompiledModels)(projectManifestModels, compiledModelIds)
|
|
273
285
|
.length === projectManifestModels.length;
|
|
@@ -501,7 +513,7 @@ const compileProject = async (options) => {
|
|
|
501
513
|
durationMs: Date.now() - startTime,
|
|
502
514
|
},
|
|
503
515
|
});
|
|
504
|
-
return { explores, isProjectComplete };
|
|
516
|
+
return { explores, isProjectComplete, dbtModelNames };
|
|
505
517
|
};
|
|
506
518
|
exports.compileProject = compileProject;
|
|
507
519
|
const compile = async (options) => (await (0, exports.compileProject)(options)).explores;
|
|
@@ -181,6 +181,12 @@ describe('compileProject completeness', () => {
|
|
|
181
181
|
});
|
|
182
182
|
const result = await (0, compile_1.compileProject)(compileOptions(tempDir));
|
|
183
183
|
expect(result.isProjectComplete).toBe(true);
|
|
184
|
+
expect(result.dbtModelNames).toEqual([
|
|
185
|
+
'orders',
|
|
186
|
+
'test__orders',
|
|
187
|
+
'countries',
|
|
188
|
+
'test__countries',
|
|
189
|
+
]);
|
|
184
190
|
});
|
|
185
191
|
test('reports a selected subset as incomplete', async () => {
|
|
186
192
|
const projectManifest = manifest({
|
|
@@ -194,6 +200,41 @@ describe('compileProject completeness', () => {
|
|
|
194
200
|
});
|
|
195
201
|
const result = await (0, compile_1.compileProject)(compileOptions(tempDir));
|
|
196
202
|
expect(result.isProjectComplete).toBe(false);
|
|
203
|
+
expect(result.dbtModelNames).toEqual([
|
|
204
|
+
'orders',
|
|
205
|
+
'test__orders',
|
|
206
|
+
'customers',
|
|
207
|
+
'test__customers',
|
|
208
|
+
]);
|
|
209
|
+
});
|
|
210
|
+
test('omits cleanup inventory for YAML projects', async () => {
|
|
211
|
+
vi.mocked(loader_1.loadLightdashModels).mockResolvedValue([
|
|
212
|
+
{
|
|
213
|
+
type: 'model',
|
|
214
|
+
name: 'orders',
|
|
215
|
+
sql_from: 'SELECT 1 AS id',
|
|
216
|
+
dimensions: [
|
|
217
|
+
{ name: 'id', type: common_1.DimensionType.NUMBER, sql: 'id' },
|
|
218
|
+
],
|
|
219
|
+
sourcePath: 'models/orders.yml',
|
|
220
|
+
},
|
|
221
|
+
]);
|
|
222
|
+
const result = await (0, compile_1.compileProject)(compileOptions(tempDir));
|
|
223
|
+
expect(result.dbtModelNames).toBeUndefined();
|
|
224
|
+
expect(manifest_1.loadManifest).not.toHaveBeenCalled();
|
|
225
|
+
});
|
|
226
|
+
test.each(['lightdash_source_name', 'lightdash_source_uuid'])('omits cleanup inventory for a manifest annotated with %s', async (sourceField) => {
|
|
227
|
+
vi.mocked(manifest_1.loadManifest).mockResolvedValue(manifest({
|
|
228
|
+
'model.test.orders': dbtNode('model.test.orders', 'model', true, {
|
|
229
|
+
[sourceField]: 'source-a',
|
|
230
|
+
}),
|
|
231
|
+
}));
|
|
232
|
+
vi.mocked(compile_2.maybeCompileModelsAndJoins).mockResolvedValue({
|
|
233
|
+
compiledModelIds: ['model.test.orders'],
|
|
234
|
+
originallySelectedModelIds: undefined,
|
|
235
|
+
});
|
|
236
|
+
const result = await (0, compile_1.compileProject)(compileOptions(tempDir));
|
|
237
|
+
expect(result.dbtModelNames).toBeUndefined();
|
|
197
238
|
});
|
|
198
239
|
test('derives completeness before combining an external manifest', async () => {
|
|
199
240
|
const projectManifest = manifest({
|
|
@@ -219,6 +260,7 @@ describe('compileProject completeness', () => {
|
|
|
219
260
|
'orders',
|
|
220
261
|
'compiled',
|
|
221
262
|
]);
|
|
263
|
+
expect(result.dbtModelNames).toBeUndefined();
|
|
222
264
|
expect(apiClient_1.lightdashRawApi).not.toHaveBeenCalled();
|
|
223
265
|
expect(console.info).toHaveBeenCalledWith(expect.stringContaining('Combined external manifest from'));
|
|
224
266
|
});
|
|
@@ -257,6 +299,7 @@ describe('compileProject completeness', () => {
|
|
|
257
299
|
'customers',
|
|
258
300
|
]);
|
|
259
301
|
expect(result.isProjectComplete).toBe(true);
|
|
302
|
+
expect(result.dbtModelNames).toBeUndefined();
|
|
260
303
|
expect(apiClient_1.lightdashRawApi).toHaveBeenCalledWith({
|
|
261
304
|
method: 'GET',
|
|
262
305
|
url: '/api/v1/projects/project-uuid/dbt/manifest',
|
|
@@ -27,7 +27,7 @@ vi.mock('../lightdash/loader');
|
|
|
27
27
|
vi.mock('./dbt/compile');
|
|
28
28
|
vi.mock('./dbt/apiClient', async (importOriginal) => {
|
|
29
29
|
const original = await importOriginal();
|
|
30
|
-
return { ...original, lightdashApi: vi.fn() };
|
|
30
|
+
return { ...original, lightdashApi: vi.fn().mockResolvedValue(undefined) };
|
|
31
31
|
});
|
|
32
32
|
vi.mock('./dbt/getDbtVersion');
|
|
33
33
|
vi.mock('./dbt/getWarehouseClient');
|
|
@@ -24,6 +24,7 @@ type DeployHandlerOptions = DbtCompileOptions & {
|
|
|
24
24
|
type DeployArgs = DeployHandlerOptions & {
|
|
25
25
|
projectUuid: string;
|
|
26
26
|
complete?: boolean;
|
|
27
|
+
dbtModelNames?: string[];
|
|
27
28
|
};
|
|
28
29
|
export declare const deploy: (explores: (Explore | ExploreError)[], options: DeployArgs) => Promise<void>;
|
|
29
30
|
export declare const deployHandler: (originalOptions: DeployHandlerOptions) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,OAAO,EACP,YAAY,EASf,MAAM,mBAAmB,CAAC;AA2B3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AASlD,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,CA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AAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AA6RF,eAAO,MAAM,MAAM,aACL,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,WAC3B,UAAU,KACpB,OAAO,CAAC,IAAI,CA0Kd,CAAC;AAiGF,eAAO,MAAM,aAAa,oBAA2B,oBAAoB,kBAyKxE,CAAC"}
|
package/dist/handlers/deploy.js
CHANGED
|
@@ -184,7 +184,7 @@ const deployBatched = async (explores, options) => {
|
|
|
184
184
|
const finalizeResponse = await (0, apiClient_1.lightdashApi)({
|
|
185
185
|
method: 'POST',
|
|
186
186
|
url: `/api/v2/projects/${options.projectUuid}/deploy/${sessionUuid}/finalize`,
|
|
187
|
-
body: JSON.stringify({}),
|
|
187
|
+
body: JSON.stringify({ dbtModelNames: options.dbtModelNames }),
|
|
188
188
|
});
|
|
189
189
|
globalState_1.default.log(styles.success(`Deploy completed! ${finalizeResponse.exploreCount} explores deployed.`));
|
|
190
190
|
logDeployWarnings(finalizeResponse.warnings);
|
|
@@ -243,12 +243,32 @@ const deploy = async (explores, options) => {
|
|
|
243
243
|
!(await deployBatched(deployableExplores, options));
|
|
244
244
|
if (shouldUseLegacyDeploy) {
|
|
245
245
|
const deployStartTime = Date.now();
|
|
246
|
-
const deployPayload = JSON.stringify(
|
|
246
|
+
const deployPayload = JSON.stringify(options.dbtModelNames === undefined
|
|
247
|
+
? deployableExplores
|
|
248
|
+
: {
|
|
249
|
+
explores: deployableExplores,
|
|
250
|
+
dbtModelNames: options.dbtModelNames,
|
|
251
|
+
complete: options.complete === true,
|
|
252
|
+
});
|
|
247
253
|
try {
|
|
248
254
|
const deployResponse = await (0, apiClient_1.lightdashApi)({
|
|
249
255
|
method: 'PUT',
|
|
250
|
-
url:
|
|
256
|
+
url: options.dbtModelNames === undefined
|
|
257
|
+
? `/api/v1/projects/${options.projectUuid}/explores?complete=${options.complete === true}`
|
|
258
|
+
: `/api/v2/projects/${options.projectUuid}/deploy`,
|
|
251
259
|
body: deployPayload,
|
|
260
|
+
}).catch(async (error) => {
|
|
261
|
+
if (options.dbtModelNames === undefined ||
|
|
262
|
+
!(error instanceof common_1.LightdashError) ||
|
|
263
|
+
error.statusCode !== 404) {
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
globalState_1.default.log(styles.warning('This server does not support deleted dbt model cleanup; deploying without cleanup. Upgrade the server to enable it.'));
|
|
267
|
+
return (0, apiClient_1.lightdashApi)({
|
|
268
|
+
method: 'PUT',
|
|
269
|
+
url: `/api/v1/projects/${options.projectUuid}/explores?complete=${options.complete === true}`,
|
|
270
|
+
body: JSON.stringify(deployableExplores),
|
|
271
|
+
});
|
|
252
272
|
});
|
|
253
273
|
if (deployResponse) {
|
|
254
274
|
logDeployWarnings(deployResponse.warnings);
|
|
@@ -450,7 +470,7 @@ const deployHandler = async (originalOptions) => {
|
|
|
450
470
|
options.disableTimestampConversion =
|
|
451
471
|
await (0, timestampConversion_1.getProjectDisableTimestampConversion)(options.disableTimestampConversion, existingProjectSelection.projectUuid);
|
|
452
472
|
}
|
|
453
|
-
const { explores, isProjectComplete } = await (0, compile_1.compileProject)(options);
|
|
473
|
+
const { explores, isProjectComplete, dbtModelNames } = await (0, compile_1.compileProject)(options);
|
|
454
474
|
let projectUuid;
|
|
455
475
|
if (options.create !== undefined) {
|
|
456
476
|
const project = await createNewProject(executionId, options);
|
|
@@ -476,6 +496,7 @@ const deployHandler = async (originalOptions) => {
|
|
|
476
496
|
...options,
|
|
477
497
|
projectUuid,
|
|
478
498
|
complete: isProjectComplete,
|
|
499
|
+
dbtModelNames,
|
|
479
500
|
});
|
|
480
501
|
const serverUrl = config.context?.serverUrl?.replace(/\/$/, '');
|
|
481
502
|
let displayUrl = options.create
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const common_1 = require("@lightdash/common");
|
|
4
5
|
const analytics_1 = require("../analytics/analytics");
|
|
6
|
+
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
|
5
7
|
const lightdash_config_1 = require("../lightdash-config");
|
|
6
8
|
const apiClient_1 = require("./dbt/apiClient");
|
|
7
9
|
const deploy_1 = require("./deploy");
|
|
@@ -82,6 +84,74 @@ describe('deploy completeness transport', () => {
|
|
|
82
84
|
body: JSON.stringify([compiledExplore]),
|
|
83
85
|
}));
|
|
84
86
|
});
|
|
87
|
+
test('sends the full model inventory with a selective single-request deploy', async () => {
|
|
88
|
+
vi.mocked(apiClient_1.lightdashApi).mockResolvedValue(null);
|
|
89
|
+
const dbtModelNames = ['orders', 'customers'];
|
|
90
|
+
await (0, deploy_1.deploy)([compiledExplore], {
|
|
91
|
+
...deployOptions,
|
|
92
|
+
batchedDeploy: false,
|
|
93
|
+
complete: false,
|
|
94
|
+
dbtModelNames,
|
|
95
|
+
});
|
|
96
|
+
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith({
|
|
97
|
+
method: 'PUT',
|
|
98
|
+
url: '/api/v2/projects/project-uuid/deploy',
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
explores: [compiledExplore],
|
|
101
|
+
dbtModelNames,
|
|
102
|
+
complete: false,
|
|
103
|
+
}),
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
test('retries the array payload with a warning when an older server lacks the inventory endpoint', async () => {
|
|
107
|
+
const warning = vi.spyOn(globalState_1.default, 'log');
|
|
108
|
+
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
109
|
+
if (url === '/api/v2/projects/project-uuid/deploy') {
|
|
110
|
+
throw new common_1.LightdashError({
|
|
111
|
+
message: 'Not found',
|
|
112
|
+
name: 'NotFoundError',
|
|
113
|
+
statusCode: 404,
|
|
114
|
+
data: {},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
});
|
|
119
|
+
await (0, deploy_1.deploy)([compiledExplore], {
|
|
120
|
+
...deployOptions,
|
|
121
|
+
batchedDeploy: false,
|
|
122
|
+
dbtModelNames: ['orders', 'customers'],
|
|
123
|
+
});
|
|
124
|
+
expect(apiClient_1.lightdashApi).toHaveBeenLastCalledWith({
|
|
125
|
+
method: 'PUT',
|
|
126
|
+
url: '/api/v1/projects/project-uuid/explores?complete=false',
|
|
127
|
+
body: JSON.stringify([compiledExplore]),
|
|
128
|
+
});
|
|
129
|
+
expect(warning).toHaveBeenCalledWith(expect.stringContaining('does not support deleted dbt model cleanup'));
|
|
130
|
+
warning.mockRestore();
|
|
131
|
+
});
|
|
132
|
+
test.each([422, 500])('does not retry inventory deployment after HTTP %s', async (statusCode) => {
|
|
133
|
+
const serverError = new common_1.LightdashError({
|
|
134
|
+
message: 'Unavailable',
|
|
135
|
+
name: 'InternalServerError',
|
|
136
|
+
statusCode,
|
|
137
|
+
data: {},
|
|
138
|
+
});
|
|
139
|
+
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
140
|
+
if (url === '/api/v2/projects/project-uuid/deploy') {
|
|
141
|
+
throw serverError;
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
});
|
|
145
|
+
await expect((0, deploy_1.deploy)([compiledExplore], {
|
|
146
|
+
...deployOptions,
|
|
147
|
+
batchedDeploy: false,
|
|
148
|
+
dbtModelNames: ['orders'],
|
|
149
|
+
})).rejects.toBe(serverError);
|
|
150
|
+
expect(vi
|
|
151
|
+
.mocked(apiClient_1.lightdashApi)
|
|
152
|
+
.mock.calls.filter(([request]) => request.url ===
|
|
153
|
+
'/api/v2/projects/project-uuid/deploy')).toHaveLength(1);
|
|
154
|
+
});
|
|
85
155
|
test('uses batched deploy by default and includes the completeness assertion in every batch body', async () => {
|
|
86
156
|
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
87
157
|
if (url.endsWith('/deploy')) {
|
|
@@ -107,6 +177,7 @@ describe('deploy completeness transport', () => {
|
|
|
107
177
|
await (0, deploy_1.deploy)([compiledExplore], {
|
|
108
178
|
...deployOptions,
|
|
109
179
|
complete: false,
|
|
180
|
+
dbtModelNames: ['orders', 'customers'],
|
|
110
181
|
});
|
|
111
182
|
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith({
|
|
112
183
|
method: 'POST',
|
|
@@ -117,6 +188,11 @@ describe('deploy completeness transport', () => {
|
|
|
117
188
|
complete: false,
|
|
118
189
|
}),
|
|
119
190
|
});
|
|
191
|
+
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith({
|
|
192
|
+
method: 'POST',
|
|
193
|
+
url: '/api/v2/projects/project-uuid/deploy/deploy-session-uuid/finalize',
|
|
194
|
+
body: JSON.stringify({ dbtModelNames: ['orders', 'customers'] }),
|
|
195
|
+
});
|
|
120
196
|
});
|
|
121
197
|
test('falls back to the legacy deploy when session creation returns 404', async () => {
|
|
122
198
|
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.206.0",
|
|
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.
|
|
26
|
-
"@lightdash/warehouses": "2.
|
|
25
|
+
"@lightdash/common": "2.206.0",
|
|
26
|
+
"@lightdash/warehouses": "2.206.0",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|