@lightdash/cli 2.573.4 → 2.575.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 (65) hide show
  1. package/README.md +31 -0
  2. package/dist/.tsbuildinfo.build +1 -1
  3. package/dist/agentConnections/agentTokenProvider.d.ts.map +1 -1
  4. package/dist/agentConnections/agentTokenProvider.js +5 -4
  5. package/dist/agentConnections/responseValidation.d.ts +3 -0
  6. package/dist/agentConnections/responseValidation.d.ts.map +1 -0
  7. package/dist/agentConnections/responseValidation.js +12 -0
  8. package/dist/agentConnections/schema.d.ts.map +1 -1
  9. package/dist/agentConnections/schema.js +70 -4
  10. package/dist/agentConnections/serverError.d.ts +5 -0
  11. package/dist/agentConnections/serverError.d.ts.map +1 -0
  12. package/dist/agentConnections/serverError.js +38 -0
  13. package/dist/agentConnections/statusResponse.d.ts.map +1 -1
  14. package/dist/agentConnections/statusResponse.js +19 -11
  15. package/dist/agentConnections/store.d.ts.map +1 -1
  16. package/dist/agentConnections/store.js +6 -32
  17. package/dist/agentConnections/warehouseStatus.d.ts.map +1 -1
  18. package/dist/agentConnections/warehouseStatus.js +4 -26
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/config.js +2 -0
  21. package/dist/connectionErrors.fixture.d.ts +2 -0
  22. package/dist/connectionErrors.fixture.d.ts.map +1 -0
  23. package/dist/connectionErrors.fixture.js +38 -0
  24. package/dist/dbt/targets/Databricks/oauth.d.ts.map +1 -1
  25. package/dist/dbt/targets/Databricks/oauth.js +3 -3
  26. package/dist/errorHandler.fixture.d.ts +2 -0
  27. package/dist/errorHandler.fixture.d.ts.map +1 -0
  28. package/dist/errorHandler.fixture.js +48 -0
  29. package/dist/handlers/agentConnectionConnect.d.ts.map +1 -1
  30. package/dist/handlers/agentConnectionConnect.js +18 -8
  31. package/dist/handlers/agentConnectionStatus.d.ts.map +1 -1
  32. package/dist/handlers/agentConnectionStatus.js +5 -1
  33. package/dist/handlers/agentRevoke.d.ts.map +1 -1
  34. package/dist/handlers/agentRevoke.js +5 -0
  35. package/dist/handlers/apps/appCodeFiles.d.ts.map +1 -1
  36. package/dist/handlers/apps/appCodeFiles.js +4 -1
  37. package/dist/handlers/apps/appsDownload.d.ts.map +1 -1
  38. package/dist/handlers/apps/appsDownload.js +22 -6
  39. package/dist/handlers/asyncQuery.d.ts +1 -0
  40. package/dist/handlers/asyncQuery.d.ts.map +1 -1
  41. package/dist/handlers/asyncQuery.js +15 -0
  42. package/dist/handlers/compile.d.ts.map +1 -1
  43. package/dist/handlers/compile.js +3 -1
  44. package/dist/handlers/dbt/apiClient.d.ts +1 -0
  45. package/dist/handlers/dbt/apiClient.d.ts.map +1 -1
  46. package/dist/handlers/dbt/apiClient.js +68 -17
  47. package/dist/handlers/deploy.d.ts.map +1 -1
  48. package/dist/handlers/deploy.js +10 -0
  49. package/dist/handlers/download.d.ts.map +1 -1
  50. package/dist/handlers/download.js +31 -8
  51. package/dist/handlers/getProject.d.ts.map +1 -1
  52. package/dist/handlers/getProject.js +10 -1
  53. package/dist/handlers/homepagesAsCode.d.ts.map +1 -1
  54. package/dist/handlers/homepagesAsCode.js +4 -1
  55. package/dist/handlers/runChart.d.ts.map +1 -1
  56. package/dist/handlers/runChart.js +8 -2
  57. package/dist/handlers/spacesAsCode.d.ts.map +1 -1
  58. package/dist/handlers/spacesAsCode.js +16 -3
  59. package/dist/handlers/sql.d.ts.map +1 -1
  60. package/dist/handlers/sql.js +3 -2
  61. package/dist/handlers/timestampConversion.d.ts.map +1 -1
  62. package/dist/handlers/timestampConversion.js +6 -0
  63. package/dist/ordinaryError.main.json +20 -0
  64. package/dist/outputUnchanged.main.json +30 -0
  65. package/package.json +3 -3
@@ -13,6 +13,7 @@ const p_limit_1 = tslib_1.__importDefault(require("p-limit"));
13
13
  const path = tslib_1.__importStar(require("path"));
14
14
  const uuid_1 = require("uuid");
15
15
  const commandPolicy_1 = require("../agentConnections/commandPolicy");
16
+ const responseValidation_1 = require("../agentConnections/responseValidation");
16
17
  const analytics_1 = require("../analytics/analytics");
17
18
  const config_1 = require("../config");
18
19
  const credentials_1 = require("../credentials");
@@ -440,11 +441,14 @@ const downloadContent = async (ids, type, projectId, projectName, customPath, la
440
441
  url: `${config.endpoint}${queryParams}`,
441
442
  body: undefined,
442
443
  });
444
+ (0, responseValidation_1.assertConnectionResponse)((0, responseValidation_1.isResponseCount)(results?.offset) && (0, responseValidation_1.isResponseCount)(results?.total));
443
445
  onProgress?.(`${results.offset} of ${results.total} ${config.displayName} downloaded`);
444
446
  // For the same chart slug, we run the code for saved charts and sql chart
445
447
  // so we are going to get more false positives here, so we keep it on the debug log
446
448
  results.missingIds.forEach((missingId) => {
447
- globalState_1.default.debug(`\nNo ${config.displayName} with id "${missingId}"`);
449
+ globalState_1.default.debug((0, credentials_1.getAgentConnectionSelection)() !== null
450
+ ? 'Some requested items were not found.'
451
+ : `\nNo ${config.displayName} with id "${missingId}"`);
448
452
  });
449
453
  // Write content based on type
450
454
  if ('sqlCharts' in results) {
@@ -558,8 +562,12 @@ const downloadVirtualViews = async (projectId, slugs, customPath) => {
558
562
  documents: results.virtualViews,
559
563
  pruneOtherDocuments: slugs.length === 0,
560
564
  });
561
- results.skipped.forEach(({ slug, reason }) => globalState_1.default.log(styles.warning(`Skipped virtual view "${slug}": ${reason}`)));
562
- results.missingSlugs.forEach((slug) => globalState_1.default.log(styles.warning(`Virtual view "${slug}" was not found`)));
565
+ results.skipped.forEach(({ slug, reason }) => globalState_1.default.log(styles.warning((0, credentials_1.getAgentConnectionSelection)() !== null
566
+ ? 'A virtual view was skipped.'
567
+ : `Skipped virtual view "${slug}": ${reason}`)));
568
+ results.missingSlugs.forEach((slug) => globalState_1.default.log(styles.warning((0, credentials_1.getAgentConnectionSelection)() !== null
569
+ ? 'A virtual view was not found.'
570
+ : `Virtual view "${slug}" was not found`)));
563
571
  return results.virtualViews.length;
564
572
  };
565
573
  // This download is implicit (derived from a dashboard's charts, not asked for
@@ -597,7 +605,9 @@ const downloadLinkedVirtualViews = async (projectId, tableNames, customPath) =>
597
605
  pruneOtherDocuments: false,
598
606
  });
599
607
  }
600
- results.skipped.forEach(({ slug, reason }) => globalState_1.default.log(styles.warning(`Skipped virtual view "${slug}": ${reason}`)));
608
+ results.skipped.forEach(({ slug, reason }) => globalState_1.default.log(styles.warning((0, credentials_1.getAgentConnectionSelection)() !== null
609
+ ? 'A virtual view was skipped.'
610
+ : `Skipped virtual view "${slug}": ${reason}`)));
601
611
  return results.virtualViews.length;
602
612
  };
603
613
  const readVirtualViewFiles = async (customPath) => {
@@ -692,6 +702,8 @@ const downloadExternalConnections = async (projectId, slugs, implicit, customPat
692
702
  });
693
703
  connections.push(...results.externalConnections);
694
704
  missingSlugs = results.missingSlugs;
705
+ (0, responseValidation_1.assertConnectionResponse)((0, responseValidation_1.isResponseCount)(results?.offset) &&
706
+ (0, responseValidation_1.isResponseCount)(results?.total));
695
707
  offset = results.offset;
696
708
  total = results.total;
697
709
  } while (offset < total);
@@ -704,7 +716,9 @@ const downloadExternalConnections = async (projectId, slugs, implicit, customPat
704
716
  }
705
717
  throw error;
706
718
  }
707
- missingSlugs.forEach((slug) => globalState_1.default.log(styles.warning(`External connection "${slug}" was not found`)));
719
+ missingSlugs.forEach((slug) => globalState_1.default.log(styles.warning((0, credentials_1.getAgentConnectionSelection)() !== null
720
+ ? 'An external connection was not found.'
721
+ : `External connection "${slug}" was not found`)));
708
722
  await (0, resource_1.writeCodeResourceDocuments)({
709
723
  definition: projectResources_1.EXTERNAL_CONNECTION_CODE_RESOURCE,
710
724
  basePath: (0, contentAsCodePaths_1.getDownloadFolder)(customPath),
@@ -803,6 +817,7 @@ const downloadDocuments = async (projectId, slugs, implicit, customPath) => {
803
817
  const page = await fetchPage(offset);
804
818
  documents.push(...page.documents);
805
819
  missingSlugs = page.missingSlugs;
820
+ (0, responseValidation_1.assertConnectionResponse)(page.nextOffset === null || (0, responseValidation_1.isResponseCount)(page.nextOffset));
806
821
  offset = page.nextOffset;
807
822
  }
808
823
  }
@@ -813,7 +828,9 @@ const downloadDocuments = async (projectId, slugs, implicit, customPath) => {
813
828
  }
814
829
  throw error;
815
830
  }
816
- missingSlugs.forEach((slug) => globalState_1.default.log(styles.warning(`Document "${slug}" was not found`)));
831
+ missingSlugs.forEach((slug) => globalState_1.default.log(styles.warning((0, credentials_1.getAgentConnectionSelection)() !== null
832
+ ? 'A document was not found.'
833
+ : `Document "${slug}" was not found`)));
817
834
  await (0, resource_1.writeCodeResourceDocuments)({
818
835
  definition: projectResources_1.DOCUMENT_CODE_RESOURCE,
819
836
  basePath: (0, contentAsCodePaths_1.getDownloadFolder)(customPath),
@@ -904,8 +921,12 @@ const downloadAiAgents = async (projectId, ids, implicit, customPath) => {
904
921
  body: undefined,
905
922
  });
906
923
  agents.push(...results.agents);
907
- results.missingIds.forEach((id) => globalState_1.default.debug(`No AI agent with id "${id}"`));
924
+ results.missingIds.forEach((id) => globalState_1.default.debug((0, credentials_1.getAgentConnectionSelection)() !== null
925
+ ? 'An AI agent was not found.'
926
+ : `No AI agent with id "${id}"`));
908
927
  downloaded += results.agents.length;
928
+ (0, responseValidation_1.assertConnectionResponse)((0, responseValidation_1.isResponseCount)(results?.offset) &&
929
+ (0, responseValidation_1.isResponseCount)(results?.total));
909
930
  offset = results.offset;
910
931
  total = results.total;
911
932
  } while (offset < total);
@@ -1009,7 +1030,9 @@ const downloadScheduledContent = async (projectId, slugs, contentType, customPat
1009
1030
  await fs_1.promises.mkdir(outputDir, { recursive: true });
1010
1031
  await fs_1.promises.writeFile(path.join(outputDir, `${item.slug}.yml`), yaml.dump(item, { quotingType: '"', sortKeys: true }));
1011
1032
  }
1012
- results.skipped.forEach((item) => globalState_1.default.debug(`Skipped ${config.singular} "${item.name}": ${item.reason}`));
1033
+ results.skipped.forEach((item) => globalState_1.default.debug((0, credentials_1.getAgentConnectionSelection)() !== null
1034
+ ? 'A scheduled item was skipped.'
1035
+ : `Skipped ${config.singular} "${item.name}": ${item.reason}`));
1013
1036
  return scheduledContent.length;
1014
1037
  };
1015
1038
  const readScheduledContentFiles = async (contentType, customPath) => {
@@ -1 +1 @@
1
- {"version":3,"file":"getProject.d.ts","sourceRoot":"","sources":["../../src/handlers/getProject.ts"],"names":[],"mappings":"AAMA,KAAK,iBAAiB,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAmB,iBAAiB,kBAsEjE,CAAC"}
1
+ {"version":3,"file":"getProject.d.ts","sourceRoot":"","sources":["../../src/handlers/getProject.ts"],"names":[],"mappings":"AAMA,KAAK,iBAAiB,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAmB,iBAAiB,kBAiFjE,CAAC"}
@@ -36,7 +36,16 @@ const getProjectHandler = async (options) => {
36
36
  }
37
37
  return;
38
38
  }
39
- globalState_1.default.debug(`> Config: ${JSON.stringify(config)}`);
39
+ const displayContext = config.context && {
40
+ ...config.context,
41
+ apiKey: config.context.apiKey
42
+ ? '[redacted]'
43
+ : config.context.apiKey,
44
+ proxyAuthorization: config.context.proxyAuthorization
45
+ ? '[redacted]'
46
+ : config.context.proxyAuthorization,
47
+ };
48
+ globalState_1.default.debug(`> Config: ${JSON.stringify({ ...config, context: displayContext })}`);
40
49
  const projectUuid = config.context?.project;
41
50
  const projectName = config.context?.projectName;
42
51
  if (!projectUuid) {
@@ -1 +1 @@
1
- {"version":3,"file":"homepagesAsCode.d.ts","sourceRoot":"","sources":["../../src/handlers/homepagesAsCode.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,iBAAiB,gBACb,MAAM,SACZ,MAAM,EAAE,eACF,MAAM,aACT,OAAO,KAClB,OAAO,CAAC,MAAM,CAqChB,CAAC;AAEF,eAAO,MAAM,eAAe,gBACX,MAAM,SACZ,MAAM,EAAE,WACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WACtB,OAAO,eACH,MAAM,KACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8ChC,CAAC"}
1
+ {"version":3,"file":"homepagesAsCode.d.ts","sourceRoot":"","sources":["../../src/handlers/homepagesAsCode.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,iBAAiB,gBACb,MAAM,SACZ,MAAM,EAAE,eACF,MAAM,aACT,OAAO,KAClB,OAAO,CAAC,MAAM,CAuChB,CAAC;AAEF,eAAO,MAAM,eAAe,gBACX,MAAM,SACZ,MAAM,EAAE,WACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WACtB,OAAO,eACH,MAAM,KACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8ChC,CAAC"}
@@ -4,6 +4,7 @@ exports.uploadHomepages = exports.downloadHomepages = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /* eslint-disable no-await-in-loop */
6
6
  const common_1 = require("@lightdash/common");
7
+ const credentials_1 = require("../credentials");
7
8
  const globalState_1 = tslib_1.__importDefault(require("../globalState"));
8
9
  const styles = tslib_1.__importStar(require("../styles"));
9
10
  const projectResources_1 = require("./contentAsCode/projectResources");
@@ -30,7 +31,9 @@ const downloadHomepages = async (projectUuid, names, customPath, implicit = fals
30
31
  throw error;
31
32
  }
32
33
  if (result.missingNames.length)
33
- throw new common_1.ParameterError(`Homepages not found or unpublished: ${result.missingNames.join(', ')}`);
34
+ throw new common_1.ParameterError((0, credentials_1.getAgentConnectionSelection)() !== null
35
+ ? 'Some homepages were not found or are unpublished.'
36
+ : `Homepages not found or unpublished: ${result.missingNames.join(', ')}`);
34
37
  await (0, resource_1.writeCodeResourceDocuments)({
35
38
  definition: projectResources_1.HOMEPAGE_CODE_RESOURCE,
36
39
  basePath: (0, contentAsCodePaths_1.getDownloadFolder)(customPath),
@@ -1 +1 @@
1
- {"version":3,"file":"runChart.d.ts","sourceRoot":"","sources":["../../src/handlers/runChart.ts"],"names":[],"mappings":"AAcA,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAIF,eAAO,MAAM,eAAe,YACf,eAAe,KACzB,OAAO,CAAC,IAAI,CA8Hd,CAAC"}
1
+ {"version":3,"file":"runChart.d.ts","sourceRoot":"","sources":["../../src/handlers/runChart.ts"],"names":[],"mappings":"AAmBA,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAIF,eAAO,MAAM,eAAe,YACf,eAAe,KACzB,OAAO,CAAC,IAAI,CAsId,CAAC"}
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const common_1 = require("@lightdash/common");
6
6
  const fs_1 = require("fs");
7
7
  const yaml = tslib_1.__importStar(require("js-yaml"));
8
+ const responseValidation_1 = require("../agentConnections/responseValidation");
8
9
  const config_1 = require("../config");
9
10
  const credentials_1 = require("../credentials");
10
11
  const globalState_1 = tslib_1.__importDefault(require("../globalState"));
@@ -75,10 +76,11 @@ const runChartHandler = async (options) => {
75
76
  context: 'cli',
76
77
  }),
77
78
  });
78
- globalState_1.default.debug(`> Query UUID: ${submitResult.queryUuid}`);
79
+ const queryUuid = (0, asyncQuery_1.validateConnectionQueryUuid)(submitResult.queryUuid);
80
+ globalState_1.default.debug(`> Query UUID: ${queryUuid}`);
79
81
  spinner.text = 'Waiting for query results...';
80
82
  // Poll for completion
81
- const result = await (0, asyncQuery_1.pollForResults)(projectUuid, submitResult.queryUuid, {
83
+ const result = await (0, asyncQuery_1.pollForResults)(projectUuid, queryUuid, {
82
84
  pageSize: options.output
83
85
  ? (options.pageSize ?? DEFAULT_PAGE_SIZE)
84
86
  : undefined,
@@ -95,6 +97,10 @@ const runChartHandler = async (options) => {
95
97
  spinner.fail('Unexpected query status');
96
98
  throw new Error(`Unexpected query status: ${result.status}`);
97
99
  }
100
+ const reportedDurationMs = result.metadata?.performance?.initialQueryExecutionMs;
101
+ (0, responseValidation_1.assertConnectionResponse)(reportedDurationMs === null ||
102
+ (typeof reportedDurationMs === 'number' &&
103
+ Number.isFinite(reportedDurationMs)));
98
104
  const durationMs = result.metadata.performance.initialQueryExecutionMs;
99
105
  const durationStr = durationMs ? ` (${durationMs}ms)` : '';
100
106
  if (options.output) {
@@ -1 +1 @@
1
- {"version":3,"file":"spacesAsCode.d.ts","sourceRoot":"","sources":["../../src/handlers/spacesAsCode.ts"],"names":[],"mappings":"AAEA,OAAO,EASH,cAAc,EAId,KAAK,WAAW,EACnB,MAAM,mBAAmB,CAAC;AAgB3B,KAAK,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AACtC,KAAK,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEzC,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACtB,CAAC;AAsDF,eAAO,MAAM,qBAAqB,WAAY,WAAW,EAAE,KAAG,MAAM,EAS9D,CAAC;AAuBP,eAAO,MAAM,qBAAqB,WACtB,OAAO,YACL,MAAM,KACjB,WAgMF,CAAC;AAEF,eAAO,MAAM,sBAAsB,UAAW,aAAa,EAAE,KAAG,IAyB/D,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAC3B,aAAa,EAAE,KACvB,aAAa,EAQV,CAAC;AA4EP,eAAO,MAAM,qCAAqC,YACrC,MAAM,KAChB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAY/B,CAAC;AAyDF,wEAAwE;AACxE,eAAO,MAAM,eAAe,WA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AO,MAAM,0BAA0B,UAAW,OAAO,KAAG,KAAK,IAAI,KACS,CAAC;AAU/E,eAAO,MAAM,uBAAuB,UAAW,OAAO,KAAG,KAAK,IAAI,KACS,CAAC;AAE5E,eAAO,MAAM,8BAA8B,UAChC,OAAO,cACF,OAAO,GAAG,SAAS,KAChC,OAAgE,CAAC;AAEpE,eAAO,MAAM,cAAc,cACZ,MAAM,eACJ,MAAM,eACN,MAAM,WACX,OAAO,eACH,OAAO,KACpB,OAAO,CAAC,MAAM,CA0DhB,CAAC;AAIF,eAAO,MAAM,4BAA4B,YAC5B,MAAM,KAChB,cAIF,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAAW,OAAO,KAAG,KAAK,IAAI,KACS,CAAC;AAE7E,eAAO,MAAM,gBAAgB,YAAa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,SAY/D,CAAC;AAEF,eAAO,MAAM,YAAY,cACV,MAAM,SACV,aAAa,EAAE,WACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,mBACd,OAAO,qBACL,OAAO,oBACT,OAAO,KACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA+HhC,CAAC"}
@@ -8,6 +8,7 @@ const common_1 = require("@lightdash/common");
8
8
  const fs_1 = require("fs");
9
9
  const yaml = tslib_1.__importStar(require("js-yaml"));
10
10
  const path = tslib_1.__importStar(require("path"));
11
+ const credentials_1 = require("../credentials");
11
12
  const globalState_1 = tslib_1.__importDefault(require("../globalState"));
12
13
  const styles = tslib_1.__importStar(require("../styles"));
13
14
  const appsDownload_1 = require("./apps/appsDownload");
@@ -498,9 +499,21 @@ const downloadSpaces = async (projectId, projectName, customPath, nested = false
498
499
  const downloadedWithoutAccessSlugs = new Set(results.spaces
499
500
  .filter((space) => space.access === undefined)
500
501
  .map((space) => space.slug));
501
- results.skipped.forEach((skipped) => globalState_1.default.log(styles.warning(downloadedWithoutAccessSlugs.has(skipped.slug)
502
- ? `Downloaded space "${skipped.slug}" without access: ${skipped.reason}`
503
- : `Skipped space "${skipped.slug}": ${skipped.reason}`)));
502
+ results.skipped.forEach((skipped) => {
503
+ const withoutAccess = downloadedWithoutAccessSlugs.has(skipped.slug);
504
+ let message;
505
+ if ((0, credentials_1.getAgentConnectionSelection)() !== null) {
506
+ message = withoutAccess
507
+ ? 'A space was downloaded without access settings.'
508
+ : 'A space was skipped.';
509
+ }
510
+ else {
511
+ message = withoutAccess
512
+ ? `Downloaded space "${skipped.slug}" without access: ${skipped.reason}`
513
+ : `Skipped space "${skipped.slug}": ${skipped.reason}`;
514
+ }
515
+ globalState_1.default.log(styles.warning(message));
516
+ });
504
517
  const spaces = (0, exports.sortSpaceFilesParentFirst)(results.spaces.map((space) => ({
505
518
  filePath: `downloaded space "${space.slug}"`,
506
519
  space,
@@ -1 +1 @@
1
- {"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../src/handlers/sql.ts"],"names":[],"mappings":"AAeA,KAAK,iBAAiB,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,UAAU,QACd,MAAM,WACF,iBAAiB,KAC3B,OAAO,CAAC,IAAI,CA4Gd,CAAC"}
1
+ {"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../src/handlers/sql.ts"],"names":[],"mappings":"AAmBA,KAAK,iBAAiB,GAAG;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,UAAU,QACd,MAAM,WACF,iBAAiB,KAC3B,OAAO,CAAC,IAAI,CAyGd,CAAC"}
@@ -49,9 +49,10 @@ const sqlHandler = async (sql, options) => {
49
49
  context: 'cli',
50
50
  }),
51
51
  });
52
- globalState_1.default.debug(`> Query UUID: ${submitResult.queryUuid}`);
52
+ const queryUuid = (0, asyncQuery_1.validateConnectionQueryUuid)(submitResult.queryUuid);
53
+ globalState_1.default.debug(`> Query UUID: ${queryUuid}`);
53
54
  spinner.text = 'Waiting for query results...';
54
- const result = await (0, asyncQuery_1.pollForResults)(projectUuid, submitResult.queryUuid, {
55
+ const result = await (0, asyncQuery_1.pollForResults)(projectUuid, queryUuid, {
55
56
  pageSize,
56
57
  });
57
58
  if (result.status === common_1.QueryHistoryStatus.ERROR) {
@@ -1 +1 @@
1
- {"version":3,"file":"timestampConversion.d.ts","sourceRoot":"","sources":["../../src/handlers/timestampConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,OAAO,EAEP,KAAK,eAAe,EACvB,MAAM,mBAAmB,CAAC;AAK3B,eAAO,MAAM,wCAAwC,wBAC5B,OAAO,CAAC,qBAAqB,CAAC,KACpD,OAAO,GAAG,SAGM,CAAC;AAEpB,eAAO,MAAM,wBAAwB,aACvB,OAAO,GAAG,SAAS,eAChB,MAAM,KACpB,OAAO,CAAC;IACP,0BAA0B,EAAE,OAAO,GAAG,SAAS,CAAC;IAChD,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;CAChD,CAsCA,CAAC;AAEF,eAAO,MAAM,oCAAoC,aACnC,OAAO,GAAG,SAAS,eAChB,MAAM,KACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAO7B,CAAC"}
1
+ {"version":3,"file":"timestampConversion.d.ts","sourceRoot":"","sources":["../../src/handlers/timestampConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,OAAO,EAEP,KAAK,eAAe,EACvB,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,KACpB,OAAO,CAAC;IACP,0BAA0B,EAAE,OAAO,GAAG,SAAS,CAAC;IAChD,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;CAChD,CA2CA,CAAC;AAEF,eAAO,MAAM,oCAAoC,aACnC,OAAO,GAAG,SAAS,eAChB,MAAM,KACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAO7B,CAAC"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProjectDisableTimestampConversion = exports.getProjectDeploySettings = exports.getDisableTimestampConversionFromProject = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@lightdash/common");
6
+ const responseValidation_1 = require("../agentConnections/responseValidation");
7
+ const credentials_1 = require("../credentials");
6
8
  const globalState_1 = tslib_1.__importDefault(require("../globalState"));
7
9
  const styles = tslib_1.__importStar(require("../styles"));
8
10
  const apiClient_1 = require("./dbt/apiClient");
@@ -21,6 +23,8 @@ const getProjectDeploySettings = async (cliValue, projectUuid) => {
21
23
  body: undefined,
22
24
  });
23
25
  const disableTimestampConversion = (0, exports.getDisableTimestampConversionFromProject)(project.warehouseConnection);
26
+ (0, responseValidation_1.assertConnectionResponse)(disableTimestampConversion === undefined ||
27
+ typeof disableTimestampConversion === 'boolean');
24
28
  globalState_1.default.debug(`> Using disable-timestamp-conversion=${String(disableTimestampConversion ?? false)} from project settings`);
25
29
  return {
26
30
  disableTimestampConversion,
@@ -28,6 +32,8 @@ const getProjectDeploySettings = async (cliValue, projectUuid) => {
28
32
  };
29
33
  }
30
34
  catch (e) {
35
+ if ((0, credentials_1.getAgentConnectionSelection)() !== null)
36
+ throw e;
31
37
  globalState_1.default.debug(`> Could not fetch project settings for timestamp conversion: ${(0, common_1.getErrorMessage)(e)}`);
32
38
  throw new Error(`Could not read project settings for deploy: ${(0, common_1.getErrorMessage)(e)}`, { cause: e });
33
39
  }
@@ -0,0 +1,20 @@
1
+ {
2
+ "revision": "5c5020ab229d1f9fbd7bca1982c5cbe5b4c4f8f9",
3
+ "outputs": {
4
+ "api": {
5
+ "stdout": "",
6
+ "stderr": "Representative API failure\n\n\ud83d\udca1 Run lightdash diagnostics for more info.\n\n",
7
+ "code": 1
8
+ },
9
+ "authorization": {
10
+ "stdout": "",
11
+ "stderr": "Representative authorization failure\nLooks like you did not authenticate or the personal access token expired.\n\n\ud83d\udc40 See https://docs.lightdash.com/guides/cli/cli-authentication for help and examples\n\n\ud83d\udca1 Run lightdash diagnostics for more info.\n\n",
12
+ "code": 1
13
+ },
14
+ "unexpected": {
15
+ "stdout": "",
16
+ "stderr": "Representative unexpected failure\nError: Representative unexpected failure\n at Command.<anonymous> (<CHECKOUT>/packages/cli/src/ordinaryError.fixture.cjs:LINE:COLUMN)\n at Command.listener [as _actionHandler] (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at <CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN\n at Command._chainOrCall (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at Command._parseCommand (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at <CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN\n at Command._chainOrCall (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at Command._dispatchSubcommand (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at Command._parseCommand (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at <CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN\nError: Representative unexpected failure\n at Command.<anonymous> (<CHECKOUT>/packages/cli/src/ordinaryError.fixture.cjs:LINE:COLUMN)\n at Command.listener [as _actionHandler] (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at <CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN\n at Command._chainOrCall (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at Command._parseCommand (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at <CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN\n at Command._chainOrCall (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at Command._dispatchSubcommand (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at Command._parseCommand (<CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN)\n at <CHECKOUT>/node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js:LINE:COLUMN\n\nReport this issue with 1-click:\n\n \ud83d\udc1b https://github.com/lightdash/lightdash/issues/new?assignees=&labels=\ud83d\udc1b+bug&template=bug_report.md&title=Representative%20unexpected%20failure\n\n\ud83d\udca1 Run lightdash diagnostics for more info.\n\n",
17
+ "code": 1
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "revision": "046b7d77612d329114fd4e807f2638f06281815c",
3
+ "outputs": {
4
+ "login": {
5
+ "stdout": "",
6
+ "stderr": "Cannot sign in with email/password: Rejected postgres_password_dbt_cloud_user_first.last\n\nšŸ¤– Coding agents: If your password has special characters (like !), read:\n packages/cli/README.md#claude-code--agentic-tools-passwords-with-special-characters\nLooks like you did not authenticate or the personal access token expired.\n\nšŸ‘€ See https://docs.lightdash.com/guides/cli/cli-authentication for help and examples\n\nšŸ’” Run lightdash diagnostics for more info.\n\n",
7
+ "code": 1
8
+ },
9
+ "config": {
10
+ "stdout": "",
11
+ "stderr": "\nCurrent project:\n\n Name: postgres_password_dbt_cloud_user_first.last\n UUID: 44444444-4444-4444-8444-444444444444\n\nDone šŸ•¶\n",
12
+ "code": 0
13
+ },
14
+ "configVerboseAbsent": {
15
+ "stdout": "",
16
+ "stderr": "> Config: {\"user\":{\"anonymousUuid\":\"test\"},\"context\":{\"serverUrl\":\"http://127.0.0.1:3000\",\"project\":\"44444444-4444-4444-8444-444444444444\",\"projectName\":\"postgres_password_dbt_cloud_user_first.last\"}}\n\nCurrent project:\n\n Name: postgres_password_dbt_cloud_user_first.last\n UUID: 44444444-4444-4444-8444-444444444444\n\nDone šŸ•¶\n",
17
+ "code": 0
18
+ },
19
+ "configVerbosePresent": {
20
+ "stdout": "",
21
+ "stderr": "> Config: {\"user\":{\"anonymousUuid\":\"test\"},\"context\":{\"serverUrl\":\"http://127.0.0.1:3000\",\"project\":\"44444444-4444-4444-8444-444444444444\",\"projectName\":\"postgres_password_dbt_cloud_user_first.last\",\"apiKey\":\"d40c859a88894eea85b10a390492bdfa\",\"proxyAuthorization\":\"Bearer 1bd98c387f924de091f6b79cda97125e\"}}\n\nCurrent project:\n\n Name: postgres_password_dbt_cloud_user_first.last\n UUID: 44444444-4444-4444-8444-444444444444\n\n> Making HTTP GET request to: http://127.0.0.1:3000/api/v1/user\n> HTTP request returned status: 200\n> HTTP request returned status: ok\nDone šŸ•¶\n",
22
+ "code": 0
23
+ },
24
+ "catalog": {
25
+ "stdout": "{\n \"tables\": [\n {\n \"database\": \"dbt_cloud_user\",\n \"schema\": \"first.last\",\n \"table\": \"postgres\",\n \"fields\": [\n {\n \"name\": \"password\",\n \"type\": \"string\"\n }\n ]\n }\n ]\n}\n",
26
+ "stderr": "Done šŸ•¶\n",
27
+ "code": 0
28
+ }
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "2.573.4",
3
+ "version": "2.575.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.573.4",
26
- "@lightdash/warehouses": "2.573.4",
25
+ "@lightdash/common": "2.575.0",
26
+ "@lightdash/warehouses": "2.575.0",
27
27
  "@sidvind/better-ajv-errors": "7.0.0",
28
28
  "@types/columnify": "1.5.1",
29
29
  "ajv": "8.18.0",