@lightdash/cli 2.228.1 → 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.
Files changed (177) hide show
  1. package/dist/.tsbuildinfo.build +1 -0
  2. package/package.json +4 -4
  3. package/dist/.tsbuildinfo +0 -1
  4. package/dist/config.test.d.ts +0 -2
  5. package/dist/config.test.d.ts.map +0 -1
  6. package/dist/config.test.js +0 -72
  7. package/dist/dbt/context.test.d.ts +0 -2
  8. package/dist/dbt/context.test.d.ts.map +0 -1
  9. package/dist/dbt/context.test.js +0 -152
  10. package/dist/dbt/manifest.test.d.ts +0 -2
  11. package/dist/dbt/manifest.test.d.ts.map +0 -1
  12. package/dist/dbt/manifest.test.js +0 -170
  13. package/dist/dbt/models.test.d.ts +0 -2
  14. package/dist/dbt/models.test.d.ts.map +0 -1
  15. package/dist/dbt/models.test.js +0 -139
  16. package/dist/dbt/profiles.test.d.ts +0 -2
  17. package/dist/dbt/profiles.test.d.ts.map +0 -1
  18. package/dist/dbt/profiles.test.js +0 -50
  19. package/dist/dbt/targets/athena.test.d.ts +0 -2
  20. package/dist/dbt/targets/athena.test.d.ts.map +0 -1
  21. package/dist/dbt/targets/athena.test.js +0 -78
  22. package/dist/dbt/targets/duckdb.test.d.ts +0 -2
  23. package/dist/dbt/targets/duckdb.test.d.ts.map +0 -1
  24. package/dist/dbt/targets/duckdb.test.js +0 -149
  25. package/dist/dbt/targets/redshift.test.d.ts +0 -2
  26. package/dist/dbt/targets/redshift.test.d.ts.map +0 -1
  27. package/dist/dbt/targets/redshift.test.js +0 -198
  28. package/dist/dbt/templating.test.d.ts +0 -2
  29. package/dist/dbt/templating.test.d.ts.map +0 -1
  30. package/dist/dbt/templating.test.js +0 -51
  31. package/dist/dbt/validation.test.d.ts +0 -2
  32. package/dist/dbt/validation.test.d.ts.map +0 -1
  33. package/dist/dbt/validation.test.js +0 -67
  34. package/dist/handlers/apps/appCodeFiles.test.d.ts +0 -2
  35. package/dist/handlers/apps/appCodeFiles.test.d.ts.map +0 -1
  36. package/dist/handlers/apps/appCodeFiles.test.js +0 -391
  37. package/dist/handlers/apps/appsDownload.test.d.ts +0 -2
  38. package/dist/handlers/apps/appsDownload.test.d.ts.map +0 -1
  39. package/dist/handlers/apps/appsDownload.test.js +0 -639
  40. package/dist/handlers/apps/build.test.d.ts +0 -2
  41. package/dist/handlers/apps/build.test.d.ts.map +0 -1
  42. package/dist/handlers/apps/build.test.js +0 -252
  43. package/dist/handlers/apps/createApp.test.d.ts +0 -2
  44. package/dist/handlers/apps/createApp.test.d.ts.map +0 -1
  45. package/dist/handlers/apps/createApp.test.js +0 -340
  46. package/dist/handlers/apps/pathContainment.test.d.ts +0 -2
  47. package/dist/handlers/apps/pathContainment.test.d.ts.map +0 -1
  48. package/dist/handlers/apps/pathContainment.test.js +0 -66
  49. package/dist/handlers/apps/preview.test.d.ts +0 -2
  50. package/dist/handlers/apps/preview.test.d.ts.map +0 -1
  51. package/dist/handlers/apps/preview.test.js +0 -353
  52. package/dist/handlers/apps/previewProxy.test.d.ts +0 -2
  53. package/dist/handlers/apps/previewProxy.test.d.ts.map +0 -1
  54. package/dist/handlers/apps/previewProxy.test.js +0 -178
  55. package/dist/handlers/apps/scaffolding.test.d.ts +0 -2
  56. package/dist/handlers/apps/scaffolding.test.d.ts.map +0 -1
  57. package/dist/handlers/apps/scaffolding.test.js +0 -151
  58. package/dist/handlers/apps/uploadRetry.test.d.ts +0 -2
  59. package/dist/handlers/apps/uploadRetry.test.d.ts.map +0 -1
  60. package/dist/handlers/apps/uploadRetry.test.js +0 -103
  61. package/dist/handlers/apps/validate.test.d.ts +0 -2
  62. package/dist/handlers/apps/validate.test.d.ts.map +0 -1
  63. package/dist/handlers/apps/validate.test.js +0 -526
  64. package/dist/handlers/compile.test.d.ts +0 -2
  65. package/dist/handlers/compile.test.d.ts.map +0 -1
  66. package/dist/handlers/compile.test.js +0 -151
  67. package/dist/handlers/compileProject.test.d.ts +0 -2
  68. package/dist/handlers/compileProject.test.d.ts.map +0 -1
  69. package/dist/handlers/compileProject.test.js +0 -637
  70. package/dist/handlers/compileWarehouseColumnValidation.test.d.ts +0 -2
  71. package/dist/handlers/compileWarehouseColumnValidation.test.d.ts.map +0 -1
  72. package/dist/handlers/compileWarehouseColumnValidation.test.js +0 -493
  73. package/dist/handlers/connectSnowflake.test.d.ts +0 -2
  74. package/dist/handlers/connectSnowflake.test.d.ts.map +0 -1
  75. package/dist/handlers/connectSnowflake.test.js +0 -320
  76. package/dist/handlers/contentAsCode/fileNames.test.d.ts +0 -2
  77. package/dist/handlers/contentAsCode/fileNames.test.d.ts.map +0 -1
  78. package/dist/handlers/contentAsCode/fileNames.test.js +0 -79
  79. package/dist/handlers/contentAsCode/registry.test.d.ts +0 -2
  80. package/dist/handlers/contentAsCode/registry.test.d.ts.map +0 -1
  81. package/dist/handlers/contentAsCode/registry.test.js +0 -18
  82. package/dist/handlers/contentAsCode/resource.test.d.ts +0 -2
  83. package/dist/handlers/contentAsCode/resource.test.d.ts.map +0 -1
  84. package/dist/handlers/contentAsCode/resource.test.js +0 -121
  85. package/dist/handlers/dbt/getDbtVersion.test.d.ts +0 -2
  86. package/dist/handlers/dbt/getDbtVersion.test.d.ts.map +0 -1
  87. package/dist/handlers/dbt/getDbtVersion.test.js +0 -106
  88. package/dist/handlers/deploy.test.d.ts +0 -2
  89. package/dist/handlers/deploy.test.d.ts.map +0 -1
  90. package/dist/handlers/deploy.test.js +0 -244
  91. package/dist/handlers/download.test.d.ts +0 -2
  92. package/dist/handlers/download.test.d.ts.map +0 -1
  93. package/dist/handlers/download.test.js +0 -1739
  94. package/dist/handlers/exportChartImage.test.d.ts +0 -2
  95. package/dist/handlers/exportChartImage.test.d.ts.map +0 -1
  96. package/dist/handlers/exportChartImage.test.js +0 -55
  97. package/dist/handlers/homepagesAsCode.test.d.ts +0 -2
  98. package/dist/handlers/homepagesAsCode.test.d.ts.map +0 -1
  99. package/dist/handlers/homepagesAsCode.test.js +0 -72
  100. package/dist/handlers/lint.test.d.ts +0 -2
  101. package/dist/handlers/lint.test.d.ts.map +0 -1
  102. package/dist/handlers/lint.test.js +0 -221
  103. package/dist/handlers/login.test.d.ts +0 -2
  104. package/dist/handlers/login.test.d.ts.map +0 -1
  105. package/dist/handlers/login.test.js +0 -24
  106. package/dist/handlers/metadataFile.test.d.ts +0 -2
  107. package/dist/handlers/metadataFile.test.d.ts.map +0 -1
  108. package/dist/handlers/metadataFile.test.js +0 -46
  109. package/dist/handlers/organizationContent/customRoles.test.d.ts +0 -2
  110. package/dist/handlers/organizationContent/customRoles.test.d.ts.map +0 -1
  111. package/dist/handlers/organizationContent/customRoles.test.js +0 -179
  112. package/dist/handlers/organizationContent/groups.test.d.ts +0 -2
  113. package/dist/handlers/organizationContent/groups.test.d.ts.map +0 -1
  114. package/dist/handlers/organizationContent/groups.test.js +0 -135
  115. package/dist/handlers/organizationContent/index.test.d.ts +0 -2
  116. package/dist/handlers/organizationContent/index.test.d.ts.map +0 -1
  117. package/dist/handlers/organizationContent/index.test.js +0 -212
  118. package/dist/handlers/organizationContent/themes.test.d.ts +0 -2
  119. package/dist/handlers/organizationContent/themes.test.d.ts.map +0 -1
  120. package/dist/handlers/organizationContent/themes.test.js +0 -180
  121. package/dist/handlers/organizationContent/users.test.d.ts +0 -2
  122. package/dist/handlers/organizationContent/users.test.d.ts.map +0 -1
  123. package/dist/handlers/organizationContent/users.test.js +0 -155
  124. package/dist/handlers/preAggregateAudit.test.d.ts +0 -2
  125. package/dist/handlers/preAggregateAudit.test.d.ts.map +0 -1
  126. package/dist/handlers/preAggregateAudit.test.js +0 -102
  127. package/dist/handlers/renameHandler.test.d.ts +0 -2
  128. package/dist/handlers/renameHandler.test.d.ts.map +0 -1
  129. package/dist/handlers/renameHandler.test.js +0 -189
  130. package/dist/handlers/resolveProjectFlag.test.d.ts +0 -2
  131. package/dist/handlers/resolveProjectFlag.test.d.ts.map +0 -1
  132. package/dist/handlers/resolveProjectFlag.test.js +0 -48
  133. package/dist/handlers/selectProject.test.d.ts +0 -2
  134. package/dist/handlers/selectProject.test.d.ts.map +0 -1
  135. package/dist/handlers/selectProject.test.js +0 -224
  136. package/dist/handlers/setProject.test.d.ts +0 -2
  137. package/dist/handlers/setProject.test.d.ts.map +0 -1
  138. package/dist/handlers/setProject.test.js +0 -63
  139. package/dist/handlers/slugUpdate.test.d.ts +0 -2
  140. package/dist/handlers/slugUpdate.test.d.ts.map +0 -1
  141. package/dist/handlers/slugUpdate.test.js +0 -265
  142. package/dist/handlers/timestampConversion.test.d.ts +0 -2
  143. package/dist/handlers/timestampConversion.test.d.ts.map +0 -1
  144. package/dist/handlers/timestampConversion.test.js +0 -87
  145. package/dist/handlers/upgradeCheck.test.d.ts +0 -2
  146. package/dist/handlers/upgradeCheck.test.d.ts.map +0 -1
  147. package/dist/handlers/upgradeCheck.test.js +0 -227
  148. package/dist/handlers/validate.test.d.ts +0 -2
  149. package/dist/handlers/validate.test.d.ts.map +0 -1
  150. package/dist/handlers/validate.test.js +0 -318
  151. package/dist/handlers/validateSpaceFilter.test.d.ts +0 -2
  152. package/dist/handlers/validateSpaceFilter.test.d.ts.map +0 -1
  153. package/dist/handlers/validateSpaceFilter.test.js +0 -79
  154. package/dist/handlers/warehouseConnection.test.d.ts +0 -2
  155. package/dist/handlers/warehouseConnection.test.d.ts.map +0 -1
  156. package/dist/handlers/warehouseConnection.test.js +0 -75
  157. package/dist/lightdash-config/lightdash-config.test.d.ts +0 -2
  158. package/dist/lightdash-config/lightdash-config.test.d.ts.map +0 -1
  159. package/dist/lightdash-config/lightdash-config.test.js +0 -69
  160. package/dist/prompts/fuzzySearchPrompt.test.d.ts +0 -2
  161. package/dist/prompts/fuzzySearchPrompt.test.d.ts.map +0 -1
  162. package/dist/prompts/fuzzySearchPrompt.test.js +0 -53
  163. package/dist/refsArgument.test.d.ts +0 -2
  164. package/dist/refsArgument.test.d.ts.map +0 -1
  165. package/dist/refsArgument.test.js +0 -42
  166. package/dist/releaseSafety/index.test.d.ts +0 -2
  167. package/dist/releaseSafety/index.test.d.ts.map +0 -1
  168. package/dist/releaseSafety/index.test.js +0 -154
  169. package/dist/releaseSafety/version.test.d.ts +0 -2
  170. package/dist/releaseSafety/version.test.d.ts.map +0 -1
  171. package/dist/releaseSafety/version.test.js +0 -22
  172. package/dist/skills.test.d.ts +0 -2
  173. package/dist/skills.test.d.ts.map +0 -1
  174. package/dist/skills.test.js +0 -112
  175. package/dist/terminal/contentAsCodeOutput.test.d.ts +0 -2
  176. package/dist/terminal/contentAsCodeOutput.test.d.ts.map +0 -1
  177. 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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=deploy.test.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=download.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"download.test.d.ts","sourceRoot":"","sources":["../../src/handlers/download.test.ts"],"names":[],"mappings":""}