@lightdash/cli 2.228.0 → 2.229.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.build +1 -0
- package/package.json +4 -4
- package/dist/.tsbuildinfo +0 -1
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -72
- package/dist/dbt/context.test.d.ts +0 -2
- package/dist/dbt/context.test.d.ts.map +0 -1
- package/dist/dbt/context.test.js +0 -152
- package/dist/dbt/manifest.test.d.ts +0 -2
- package/dist/dbt/manifest.test.d.ts.map +0 -1
- package/dist/dbt/manifest.test.js +0 -170
- package/dist/dbt/models.test.d.ts +0 -2
- package/dist/dbt/models.test.d.ts.map +0 -1
- package/dist/dbt/models.test.js +0 -139
- package/dist/dbt/profiles.test.d.ts +0 -2
- package/dist/dbt/profiles.test.d.ts.map +0 -1
- package/dist/dbt/profiles.test.js +0 -50
- package/dist/dbt/targets/athena.test.d.ts +0 -2
- package/dist/dbt/targets/athena.test.d.ts.map +0 -1
- package/dist/dbt/targets/athena.test.js +0 -78
- package/dist/dbt/targets/duckdb.test.d.ts +0 -2
- package/dist/dbt/targets/duckdb.test.d.ts.map +0 -1
- package/dist/dbt/targets/duckdb.test.js +0 -149
- package/dist/dbt/targets/redshift.test.d.ts +0 -2
- package/dist/dbt/targets/redshift.test.d.ts.map +0 -1
- package/dist/dbt/targets/redshift.test.js +0 -198
- package/dist/dbt/templating.test.d.ts +0 -2
- package/dist/dbt/templating.test.d.ts.map +0 -1
- package/dist/dbt/templating.test.js +0 -51
- package/dist/dbt/validation.test.d.ts +0 -2
- package/dist/dbt/validation.test.d.ts.map +0 -1
- package/dist/dbt/validation.test.js +0 -67
- package/dist/handlers/apps/appCodeFiles.test.d.ts +0 -2
- package/dist/handlers/apps/appCodeFiles.test.d.ts.map +0 -1
- package/dist/handlers/apps/appCodeFiles.test.js +0 -391
- package/dist/handlers/apps/appsDownload.test.d.ts +0 -2
- package/dist/handlers/apps/appsDownload.test.d.ts.map +0 -1
- package/dist/handlers/apps/appsDownload.test.js +0 -639
- package/dist/handlers/apps/build.test.d.ts +0 -2
- package/dist/handlers/apps/build.test.d.ts.map +0 -1
- package/dist/handlers/apps/build.test.js +0 -252
- package/dist/handlers/apps/createApp.test.d.ts +0 -2
- package/dist/handlers/apps/createApp.test.d.ts.map +0 -1
- package/dist/handlers/apps/createApp.test.js +0 -340
- package/dist/handlers/apps/pathContainment.test.d.ts +0 -2
- package/dist/handlers/apps/pathContainment.test.d.ts.map +0 -1
- package/dist/handlers/apps/pathContainment.test.js +0 -66
- package/dist/handlers/apps/preview.test.d.ts +0 -2
- package/dist/handlers/apps/preview.test.d.ts.map +0 -1
- package/dist/handlers/apps/preview.test.js +0 -353
- package/dist/handlers/apps/previewProxy.test.d.ts +0 -2
- package/dist/handlers/apps/previewProxy.test.d.ts.map +0 -1
- package/dist/handlers/apps/previewProxy.test.js +0 -178
- package/dist/handlers/apps/scaffolding.test.d.ts +0 -2
- package/dist/handlers/apps/scaffolding.test.d.ts.map +0 -1
- package/dist/handlers/apps/scaffolding.test.js +0 -151
- package/dist/handlers/apps/uploadRetry.test.d.ts +0 -2
- package/dist/handlers/apps/uploadRetry.test.d.ts.map +0 -1
- package/dist/handlers/apps/uploadRetry.test.js +0 -103
- package/dist/handlers/apps/validate.test.d.ts +0 -2
- package/dist/handlers/apps/validate.test.d.ts.map +0 -1
- package/dist/handlers/apps/validate.test.js +0 -526
- package/dist/handlers/compile.test.d.ts +0 -2
- package/dist/handlers/compile.test.d.ts.map +0 -1
- package/dist/handlers/compile.test.js +0 -151
- package/dist/handlers/compileProject.test.d.ts +0 -2
- package/dist/handlers/compileProject.test.d.ts.map +0 -1
- package/dist/handlers/compileProject.test.js +0 -637
- package/dist/handlers/compileWarehouseColumnValidation.test.d.ts +0 -2
- package/dist/handlers/compileWarehouseColumnValidation.test.d.ts.map +0 -1
- package/dist/handlers/compileWarehouseColumnValidation.test.js +0 -493
- package/dist/handlers/connectSnowflake.test.d.ts +0 -2
- package/dist/handlers/connectSnowflake.test.d.ts.map +0 -1
- package/dist/handlers/connectSnowflake.test.js +0 -320
- package/dist/handlers/contentAsCode/fileNames.test.d.ts +0 -2
- package/dist/handlers/contentAsCode/fileNames.test.d.ts.map +0 -1
- package/dist/handlers/contentAsCode/fileNames.test.js +0 -79
- package/dist/handlers/contentAsCode/registry.test.d.ts +0 -2
- package/dist/handlers/contentAsCode/registry.test.d.ts.map +0 -1
- package/dist/handlers/contentAsCode/registry.test.js +0 -18
- package/dist/handlers/contentAsCode/resource.test.d.ts +0 -2
- package/dist/handlers/contentAsCode/resource.test.d.ts.map +0 -1
- package/dist/handlers/contentAsCode/resource.test.js +0 -121
- package/dist/handlers/dbt/getDbtVersion.test.d.ts +0 -2
- package/dist/handlers/dbt/getDbtVersion.test.d.ts.map +0 -1
- package/dist/handlers/dbt/getDbtVersion.test.js +0 -106
- package/dist/handlers/deploy.test.d.ts +0 -2
- package/dist/handlers/deploy.test.d.ts.map +0 -1
- package/dist/handlers/deploy.test.js +0 -244
- package/dist/handlers/download.test.d.ts +0 -2
- package/dist/handlers/download.test.d.ts.map +0 -1
- package/dist/handlers/download.test.js +0 -1739
- package/dist/handlers/exportChartImage.test.d.ts +0 -2
- package/dist/handlers/exportChartImage.test.d.ts.map +0 -1
- package/dist/handlers/exportChartImage.test.js +0 -55
- package/dist/handlers/homepagesAsCode.test.d.ts +0 -2
- package/dist/handlers/homepagesAsCode.test.d.ts.map +0 -1
- package/dist/handlers/homepagesAsCode.test.js +0 -72
- package/dist/handlers/lint.test.d.ts +0 -2
- package/dist/handlers/lint.test.d.ts.map +0 -1
- package/dist/handlers/lint.test.js +0 -221
- package/dist/handlers/login.test.d.ts +0 -2
- package/dist/handlers/login.test.d.ts.map +0 -1
- package/dist/handlers/login.test.js +0 -24
- package/dist/handlers/metadataFile.test.d.ts +0 -2
- package/dist/handlers/metadataFile.test.d.ts.map +0 -1
- package/dist/handlers/metadataFile.test.js +0 -46
- package/dist/handlers/organizationContent/customRoles.test.d.ts +0 -2
- package/dist/handlers/organizationContent/customRoles.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/customRoles.test.js +0 -179
- package/dist/handlers/organizationContent/groups.test.d.ts +0 -2
- package/dist/handlers/organizationContent/groups.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/groups.test.js +0 -135
- package/dist/handlers/organizationContent/index.test.d.ts +0 -2
- package/dist/handlers/organizationContent/index.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/index.test.js +0 -212
- package/dist/handlers/organizationContent/themes.test.d.ts +0 -2
- package/dist/handlers/organizationContent/themes.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/themes.test.js +0 -180
- package/dist/handlers/organizationContent/users.test.d.ts +0 -2
- package/dist/handlers/organizationContent/users.test.d.ts.map +0 -1
- package/dist/handlers/organizationContent/users.test.js +0 -155
- package/dist/handlers/preAggregateAudit.test.d.ts +0 -2
- package/dist/handlers/preAggregateAudit.test.d.ts.map +0 -1
- package/dist/handlers/preAggregateAudit.test.js +0 -102
- package/dist/handlers/renameHandler.test.d.ts +0 -2
- package/dist/handlers/renameHandler.test.d.ts.map +0 -1
- package/dist/handlers/renameHandler.test.js +0 -189
- package/dist/handlers/resolveProjectFlag.test.d.ts +0 -2
- package/dist/handlers/resolveProjectFlag.test.d.ts.map +0 -1
- package/dist/handlers/resolveProjectFlag.test.js +0 -48
- package/dist/handlers/selectProject.test.d.ts +0 -2
- package/dist/handlers/selectProject.test.d.ts.map +0 -1
- package/dist/handlers/selectProject.test.js +0 -224
- package/dist/handlers/setProject.test.d.ts +0 -2
- package/dist/handlers/setProject.test.d.ts.map +0 -1
- package/dist/handlers/setProject.test.js +0 -63
- package/dist/handlers/slugUpdate.test.d.ts +0 -2
- package/dist/handlers/slugUpdate.test.d.ts.map +0 -1
- package/dist/handlers/slugUpdate.test.js +0 -265
- package/dist/handlers/timestampConversion.test.d.ts +0 -2
- package/dist/handlers/timestampConversion.test.d.ts.map +0 -1
- package/dist/handlers/timestampConversion.test.js +0 -87
- package/dist/handlers/upgradeCheck.test.d.ts +0 -2
- package/dist/handlers/upgradeCheck.test.d.ts.map +0 -1
- package/dist/handlers/upgradeCheck.test.js +0 -227
- package/dist/handlers/validate.test.d.ts +0 -2
- package/dist/handlers/validate.test.d.ts.map +0 -1
- package/dist/handlers/validate.test.js +0 -318
- package/dist/handlers/validateSpaceFilter.test.d.ts +0 -2
- package/dist/handlers/validateSpaceFilter.test.d.ts.map +0 -1
- package/dist/handlers/validateSpaceFilter.test.js +0 -79
- package/dist/handlers/warehouseConnection.test.d.ts +0 -2
- package/dist/handlers/warehouseConnection.test.d.ts.map +0 -1
- package/dist/handlers/warehouseConnection.test.js +0 -75
- package/dist/lightdash-config/lightdash-config.test.d.ts +0 -2
- package/dist/lightdash-config/lightdash-config.test.d.ts.map +0 -1
- package/dist/lightdash-config/lightdash-config.test.js +0 -69
- package/dist/prompts/fuzzySearchPrompt.test.d.ts +0 -2
- package/dist/prompts/fuzzySearchPrompt.test.d.ts.map +0 -1
- package/dist/prompts/fuzzySearchPrompt.test.js +0 -53
- package/dist/refsArgument.test.d.ts +0 -2
- package/dist/refsArgument.test.d.ts.map +0 -1
- package/dist/refsArgument.test.js +0 -42
- package/dist/releaseSafety/index.test.d.ts +0 -2
- package/dist/releaseSafety/index.test.d.ts.map +0 -1
- package/dist/releaseSafety/index.test.js +0 -154
- package/dist/releaseSafety/version.test.d.ts +0 -2
- package/dist/releaseSafety/version.test.d.ts.map +0 -1
- package/dist/releaseSafety/version.test.js +0 -22
- package/dist/skills.test.d.ts +0 -2
- package/dist/skills.test.d.ts.map +0 -1
- package/dist/skills.test.js +0 -112
- package/dist/terminal/contentAsCodeOutput.test.d.ts +0 -2
- package/dist/terminal/contentAsCodeOutput.test.d.ts.map +0 -1
- package/dist/terminal/contentAsCodeOutput.test.js +0 -231
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const common_1 = require("@lightdash/common");
|
|
5
|
-
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
6
|
-
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
|
-
const globalState_1 = tslib_1.__importDefault(require("../../globalState"));
|
|
8
|
-
const getDbtVersion_1 = require("./getDbtVersion");
|
|
9
|
-
const getDbtVersion_mocks_1 = require("./getDbtVersion.mocks");
|
|
10
|
-
vi.mock('execa');
|
|
11
|
-
const execaMock = execa_1.default;
|
|
12
|
-
vi.mock('inquirer', () => ({
|
|
13
|
-
default: {
|
|
14
|
-
prompt: vi.fn(),
|
|
15
|
-
},
|
|
16
|
-
}));
|
|
17
|
-
const promptMock = inquirer_1.default.prompt;
|
|
18
|
-
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => { });
|
|
19
|
-
describe('Get dbt version', () => {
|
|
20
|
-
const { env } = process;
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
vi.resetAllMocks();
|
|
23
|
-
vi.resetModules();
|
|
24
|
-
process.env = { ...env };
|
|
25
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_4);
|
|
26
|
-
promptMock.mockImplementation(async () => ({ isConfirm: true }));
|
|
27
|
-
globalState_1.default.clearPromptAnswer();
|
|
28
|
-
});
|
|
29
|
-
afterEach(() => {
|
|
30
|
-
process.env = env;
|
|
31
|
-
});
|
|
32
|
-
describe('getDbtVersion', () => {
|
|
33
|
-
test('should return error if dbt cli is not installed', async () => {
|
|
34
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.error);
|
|
35
|
-
await expect((0, getDbtVersion_1.getDbtVersion)()).rejects.toThrowError();
|
|
36
|
-
});
|
|
37
|
-
test('should return supported dbt versions', async () => {
|
|
38
|
-
// Test for 1.4
|
|
39
|
-
const version = await (0, getDbtVersion_1.getDbtVersion)();
|
|
40
|
-
expect(version.verboseVersion).toEqual('1.4.9');
|
|
41
|
-
expect(version.versionOption).toEqual(common_1.SupportedDbtVersions.V1_4);
|
|
42
|
-
// Test for 1.9
|
|
43
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_9);
|
|
44
|
-
const version2 = await (0, getDbtVersion_1.getDbtVersion)();
|
|
45
|
-
expect(version2.verboseVersion).toEqual('1.9.1');
|
|
46
|
-
expect(version2.versionOption).toEqual(common_1.SupportedDbtVersions.V1_9);
|
|
47
|
-
// Test for 1.11
|
|
48
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_11);
|
|
49
|
-
const version3 = await (0, getDbtVersion_1.getDbtVersion)();
|
|
50
|
-
expect(version3.verboseVersion).toEqual('1.11.0');
|
|
51
|
-
expect(version3.versionOption).toEqual(common_1.SupportedDbtVersions.V1_11);
|
|
52
|
-
// Test for 1.12
|
|
53
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_12);
|
|
54
|
-
const version4 = await (0, getDbtVersion_1.getDbtVersion)();
|
|
55
|
-
expect(version4.verboseVersion).toEqual('1.12.0');
|
|
56
|
-
expect(version4.versionOption).toEqual(common_1.SupportedDbtVersions.V1_12);
|
|
57
|
-
});
|
|
58
|
-
test('should return latest for dbt cloud', async () => {
|
|
59
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbtCloud);
|
|
60
|
-
const version3 = await (0, getDbtVersion_1.getDbtVersion)();
|
|
61
|
-
expect(version3.verboseVersion).toEqual(expect.stringContaining('dbt Cloud CLI'));
|
|
62
|
-
expect(version3.versionOption).toEqual(common_1.DbtVersionOptionLatest.LATEST);
|
|
63
|
-
});
|
|
64
|
-
test('when CI=true, should warn user about unsupported version and return fallback', async () => {
|
|
65
|
-
process.env.CI = 'true';
|
|
66
|
-
// Test for 1.3
|
|
67
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_3);
|
|
68
|
-
const version = await (0, getDbtVersion_1.getDbtVersion)();
|
|
69
|
-
expect(version.verboseVersion).toEqual('1.3.0');
|
|
70
|
-
expect(version.versionOption).toEqual(common_1.SupportedDbtVersions.V1_4);
|
|
71
|
-
expect(consoleError).toHaveBeenCalledTimes(1);
|
|
72
|
-
expect(consoleError).nthCalledWith(1, expect.stringContaining("We don't currently support version 1.3.0"));
|
|
73
|
-
// Clear saved prompt answer
|
|
74
|
-
globalState_1.default.clearPromptAnswer();
|
|
75
|
-
// Test for future version
|
|
76
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt20_1);
|
|
77
|
-
const version2 = await (0, getDbtVersion_1.getDbtVersion)();
|
|
78
|
-
expect(version2.verboseVersion).toEqual('20.1.0');
|
|
79
|
-
expect(version2.versionOption).toEqual((0, common_1.getLatestSupportDbtVersion)());
|
|
80
|
-
expect(consoleError).toHaveBeenCalledTimes(2);
|
|
81
|
-
expect(consoleError).nthCalledWith(2, expect.stringContaining("We don't currently support version 20.1.0"));
|
|
82
|
-
});
|
|
83
|
-
test('when CI=false, should return fallback version if user confirms', async () => {
|
|
84
|
-
process.env.CI = 'false';
|
|
85
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_3);
|
|
86
|
-
const version = await (0, getDbtVersion_1.getDbtVersion)();
|
|
87
|
-
expect(version.verboseVersion).toEqual('1.3.0');
|
|
88
|
-
expect(version.versionOption).toEqual(common_1.SupportedDbtVersions.V1_4);
|
|
89
|
-
expect(promptMock).toHaveBeenCalledTimes(1);
|
|
90
|
-
expect(consoleError).toHaveBeenCalledTimes(0);
|
|
91
|
-
});
|
|
92
|
-
test('when CI=false, should return error if user declines fallback', async () => {
|
|
93
|
-
const exitSpy = vi
|
|
94
|
-
.spyOn(process, 'exit')
|
|
95
|
-
.mockImplementation((() => undefined));
|
|
96
|
-
process.env.CI = 'false';
|
|
97
|
-
execaMock.mockImplementation(async () => getDbtVersion_mocks_1.cliMocks.dbt1_3);
|
|
98
|
-
promptMock.mockImplementation(async () => ({ isConfirm: false }));
|
|
99
|
-
await (0, getDbtVersion_1.getDbtVersion)();
|
|
100
|
-
expect(promptMock).toHaveBeenCalledTimes(1);
|
|
101
|
-
expect(consoleError).toHaveBeenCalledTimes(1);
|
|
102
|
-
expect(exitSpy).toHaveBeenCalledWith(1);
|
|
103
|
-
exitSpy.mockRestore();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.test.d.ts","sourceRoot":"","sources":["../../src/handlers/deploy.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const common_1 = require("@lightdash/common");
|
|
5
|
-
const analytics_1 = require("../analytics/analytics");
|
|
6
|
-
const globalState_1 = tslib_1.__importDefault(require("../globalState"));
|
|
7
|
-
const lightdash_config_1 = require("../lightdash-config");
|
|
8
|
-
const apiClient_1 = require("./dbt/apiClient");
|
|
9
|
-
const deploy_1 = require("./deploy");
|
|
10
|
-
vi.mock('../analytics/analytics');
|
|
11
|
-
vi.mock('../lightdash-config');
|
|
12
|
-
vi.mock('./dbt/apiClient', async (importOriginal) => ({
|
|
13
|
-
...(await importOriginal()),
|
|
14
|
-
lightdashApi: vi.fn(),
|
|
15
|
-
}));
|
|
16
|
-
const compiledExplore = {
|
|
17
|
-
name: 'orders',
|
|
18
|
-
label: 'Orders',
|
|
19
|
-
tags: [],
|
|
20
|
-
tables: {},
|
|
21
|
-
baseTable: 'orders',
|
|
22
|
-
joinedTables: [],
|
|
23
|
-
targetDatabase: common_1.SupportedDbtAdapter.POSTGRES,
|
|
24
|
-
};
|
|
25
|
-
const deployOptions = {
|
|
26
|
-
projectDir: '/tmp/project',
|
|
27
|
-
profilesDir: '',
|
|
28
|
-
target: undefined,
|
|
29
|
-
profile: undefined,
|
|
30
|
-
vars: undefined,
|
|
31
|
-
verbose: false,
|
|
32
|
-
ignoreErrors: false,
|
|
33
|
-
validateWarehouseColumns: false,
|
|
34
|
-
projectUuid: 'project-uuid',
|
|
35
|
-
skipWarehouseCatalog: true,
|
|
36
|
-
skipDbtCompile: true,
|
|
37
|
-
useDbtList: false,
|
|
38
|
-
select: undefined,
|
|
39
|
-
models: undefined,
|
|
40
|
-
threads: undefined,
|
|
41
|
-
noVersionCheck: false,
|
|
42
|
-
exclude: undefined,
|
|
43
|
-
selector: undefined,
|
|
44
|
-
state: undefined,
|
|
45
|
-
fullRefresh: false,
|
|
46
|
-
defer: false,
|
|
47
|
-
targetPath: undefined,
|
|
48
|
-
favorState: false,
|
|
49
|
-
combineManifest: undefined,
|
|
50
|
-
};
|
|
51
|
-
describe('deploy completeness transport', () => {
|
|
52
|
-
beforeEach(() => {
|
|
53
|
-
vi.clearAllMocks();
|
|
54
|
-
vi.mocked(lightdash_config_1.readAndLoadLightdashProjectConfig).mockResolvedValue({
|
|
55
|
-
spotlight: { default_visibility: 'show' },
|
|
56
|
-
});
|
|
57
|
-
vi.mocked(analytics_1.LightdashAnalytics.track).mockResolvedValue(undefined);
|
|
58
|
-
});
|
|
59
|
-
it.each([
|
|
60
|
-
{ complete: true, expected: 'true' },
|
|
61
|
-
{ complete: false, expected: 'false' },
|
|
62
|
-
{ complete: undefined, expected: 'false' },
|
|
63
|
-
])('sends complete=$expected when batched deploy is disabled', async ({ complete, expected }) => {
|
|
64
|
-
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
65
|
-
if (url.includes('/explores?')) {
|
|
66
|
-
return {
|
|
67
|
-
exploreCount: 1,
|
|
68
|
-
warnings: {
|
|
69
|
-
warningCount: 0,
|
|
70
|
-
exploresWithWarnings: [],
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
});
|
|
76
|
-
await (0, deploy_1.deploy)([compiledExplore], {
|
|
77
|
-
...deployOptions,
|
|
78
|
-
complete,
|
|
79
|
-
batchedDeploy: false,
|
|
80
|
-
});
|
|
81
|
-
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith(expect.objectContaining({
|
|
82
|
-
method: 'PUT',
|
|
83
|
-
url: `/api/v1/projects/project-uuid/explores?complete=${expected}`,
|
|
84
|
-
body: JSON.stringify([compiledExplore]),
|
|
85
|
-
}));
|
|
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
|
-
});
|
|
155
|
-
test('uses batched deploy by default and includes the completeness assertion in every batch body', async () => {
|
|
156
|
-
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
157
|
-
if (url.endsWith('/deploy')) {
|
|
158
|
-
return {
|
|
159
|
-
deploySessionUuid: 'deploy-session-uuid',
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
if (url.endsWith('/batch')) {
|
|
163
|
-
return { batchNumber: 0, exploreCount: 1 };
|
|
164
|
-
}
|
|
165
|
-
if (url.endsWith('/finalize')) {
|
|
166
|
-
return {
|
|
167
|
-
exploreCount: 1,
|
|
168
|
-
warnings: {
|
|
169
|
-
warningCount: 0,
|
|
170
|
-
exploresWithWarnings: [],
|
|
171
|
-
},
|
|
172
|
-
status: common_1.DeploySessionStatus.COMPLETED,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
});
|
|
177
|
-
await (0, deploy_1.deploy)([compiledExplore], {
|
|
178
|
-
...deployOptions,
|
|
179
|
-
complete: false,
|
|
180
|
-
dbtModelNames: ['orders', 'customers'],
|
|
181
|
-
});
|
|
182
|
-
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith({
|
|
183
|
-
method: 'POST',
|
|
184
|
-
url: '/api/v2/projects/project-uuid/deploy/deploy-session-uuid/batch',
|
|
185
|
-
body: JSON.stringify({
|
|
186
|
-
explores: [compiledExplore],
|
|
187
|
-
batchNumber: 0,
|
|
188
|
-
complete: false,
|
|
189
|
-
}),
|
|
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
|
-
});
|
|
196
|
-
});
|
|
197
|
-
test('falls back to the legacy deploy when session creation returns 404', async () => {
|
|
198
|
-
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
199
|
-
if (url.endsWith('/deploy')) {
|
|
200
|
-
throw new common_1.LightdashError({
|
|
201
|
-
message: 'Not found',
|
|
202
|
-
name: 'NotFoundError',
|
|
203
|
-
statusCode: 404,
|
|
204
|
-
data: {},
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
if (url.includes('/explores?')) {
|
|
208
|
-
return {
|
|
209
|
-
exploreCount: 1,
|
|
210
|
-
warnings: {
|
|
211
|
-
warningCount: 0,
|
|
212
|
-
exploresWithWarnings: [],
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
return null;
|
|
217
|
-
});
|
|
218
|
-
await (0, deploy_1.deploy)([compiledExplore], deployOptions);
|
|
219
|
-
expect(apiClient_1.lightdashApi).toHaveBeenCalledWith({
|
|
220
|
-
method: 'PUT',
|
|
221
|
-
url: '/api/v1/projects/project-uuid/explores?complete=false',
|
|
222
|
-
body: JSON.stringify([compiledExplore]),
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
test('propagates non-404 session creation errors', async () => {
|
|
226
|
-
const serverError = new common_1.LightdashError({
|
|
227
|
-
message: 'Server unavailable',
|
|
228
|
-
name: 'InternalServerError',
|
|
229
|
-
statusCode: 500,
|
|
230
|
-
data: {},
|
|
231
|
-
});
|
|
232
|
-
vi.mocked(apiClient_1.lightdashApi).mockImplementation(async ({ url }) => {
|
|
233
|
-
if (url.endsWith('/deploy')) {
|
|
234
|
-
throw serverError;
|
|
235
|
-
}
|
|
236
|
-
return null;
|
|
237
|
-
});
|
|
238
|
-
await expect((0, deploy_1.deploy)([compiledExplore], deployOptions)).rejects.toBe(serverError);
|
|
239
|
-
expect(apiClient_1.lightdashApi).not.toHaveBeenCalledWith(expect.objectContaining({
|
|
240
|
-
method: 'PUT',
|
|
241
|
-
url: expect.stringContaining('/explores?'),
|
|
242
|
-
}));
|
|
243
|
-
});
|
|
244
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download.test.d.ts","sourceRoot":"","sources":["../../src/handlers/download.test.ts"],"names":[],"mappings":""}
|