@lightdash/cli 0.1464.3 → 0.1466.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/LICENSE CHANGED
@@ -1,6 +1,10 @@
1
- MIT License
1
+ Copyright (c) 2021-present Telescope Technology Limited (trading as “Lightdash”)
2
2
 
3
- Copyright (c) 2021 Telescope Technologies Inc.
3
+ Portions of this software are licensed as follows:
4
+
5
+ * All content that resides under the "packages/backend/src/ee" directory of this repository, if that directory exists, is licensed under the license defined in "packages/backend/src/ee/LICENSE".
6
+ * All third party components incorporated into the Lightdash Software are licensed under the original license provided by the owner of the applicable component.
7
+ * Content outside of the above mentioned directories or restrictions above is available under the "MIT" license as defined below.
4
8
 
5
9
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
10
  of this software and associated documentation files (the "Software"), to deal
@@ -17,14 +17,17 @@ export declare const lightdashApi: <T extends string | boolean | unknown[] | imp
17
17
  selectedTabs?: string[] | undefined;
18
18
  } & {
19
19
  targets: (import("@lightdash/common").SchedulerSlackTarget | import("@lightdash/common").SchedulerEmailTarget)[];
20
- }) | import("@lightdash/common").SchedulerAndTargets[] | import("@lightdash/common").FieldValueSearchResult<unknown> | import("@lightdash/common").ApiDownloadCsv | import("@lightdash/common").AllowedEmailDomains | import("@lightdash/common").UpdateAllowedEmailDomains | import("@lightdash/common").UserAllowedOrganization[] | import("@lightdash/common").EmailStatusExpiring | import("@lightdash/common").ApiScheduledDownloadCsv | import("@lightdash/common").PinnedItems | import("@lightdash/common").ViewStatistics | import("@lightdash/common").SchedulerWithLogs | import("@lightdash/common").ValidationResponse[] | import("@lightdash/common").ChartHistory | import("@lightdash/common").ChartVersion | import("@lightdash/common").GitRepo[] | import("@lightdash/common").PullRequestCreated | import("@lightdash/common").GitIntegrationConfiguration | import("@lightdash/common").UserWarehouseCredentials | {
20
+ }) | import("@lightdash/common").SchedulerAndTargets[] | import("@lightdash/common").FieldValueSearchResult<unknown> | import("@lightdash/common").ApiDownloadCsv | import("@lightdash/common").AllowedEmailDomains | import("@lightdash/common").UpdateAllowedEmailDomains | import("@lightdash/common").UserAllowedOrganization[] | import("@lightdash/common").EmailStatusExpiring | import("@lightdash/common").ApiScheduledDownloadCsv | import("@lightdash/common").PinnedItems | import("@lightdash/common").ViewStatistics | import("@lightdash/common").SchedulerWithLogs | import("@lightdash/common").ValidationResponse[] | import("@lightdash/common").ChartHistory | import("@lightdash/common").ChartVersion | import("@lightdash/common").EmbedUrl | import("@lightdash/common").DecodedEmbed | import("@lightdash/common").GitRepo[] | import("@lightdash/common").PullRequestCreated | import("@lightdash/common").GitIntegrationConfiguration | import("@lightdash/common").UserWarehouseCredentials | {
21
21
  status: import("@lightdash/common").SchedulerJobStatus;
22
22
  details: Record<string, any> | null;
23
23
  } | {
24
24
  jobId: string;
25
25
  } | Pick<import("@lightdash/common").SshKeyPair, "publicKey"> | import("@lightdash/common").MostPopularAndRecentlyUpdated | Record<string, number> | Record<string, import("@lightdash/common").DbtExposure> | {
26
26
  [dashboardTileUuid: string]: import("@lightdash/common").Comment[];
27
- } | import("@lightdash/common").ApiResolveComment | import("@lightdash/common").ApiSuccessEmpty | import("@lightdash/common").ApiCreateProjectResults | import("@lightdash/common").DashboardSummary | import("@lightdash/common").CatalogMetadata | import("@lightdash/common").CatalogAnalytics | import("@lightdash/common").PromotionChanges | import("@lightdash/common").WarehouseTableSchema | import("@lightdash/common").TogglePinnedItemInfo | import("@lightdash/common").KnexPaginatedData<import("@lightdash/common").OrganizationMemberProfile[]> | import("@lightdash/common").SqlChart | {
27
+ } | import("@lightdash/common").ApiResolveComment | import("@lightdash/common").ApiSuccessEmpty | import("@lightdash/common").ApiCreateProjectResults | import("@lightdash/common").DashboardSummary | import("@lightdash/common").CatalogMetadata | import("@lightdash/common").CatalogAnalytics | import("@lightdash/common").AiConversation[] | import("@lightdash/common").AiConversationMessage[] | {
28
+ prompt: import("@lightdash/common").AiWebAppPrompt;
29
+ rows: Record<string, any>[] | undefined;
30
+ } | import("@lightdash/common").PromotionChanges | import("@lightdash/common").WarehouseTableSchema | import("@lightdash/common").TogglePinnedItemInfo | import("@lightdash/common").KnexPaginatedData<import("@lightdash/common").OrganizationMemberProfile[]> | import("@lightdash/common").SqlChart | {
28
31
  savedSqlUuid: string;
29
32
  slug: string;
30
33
  } | {
@@ -11,11 +11,24 @@ const analytics_1 = require("../analytics/analytics");
11
11
  const config_1 = require("../config");
12
12
  const context_1 = require("../dbt/context");
13
13
  const globalState_1 = tslib_1.__importDefault(require("../globalState"));
14
+ const lightdash_config_1 = require("../lightdash-config");
14
15
  const styles = tslib_1.__importStar(require("../styles"));
15
16
  const compile_1 = require("./compile");
16
17
  const createProject_1 = require("./createProject");
17
18
  const apiClient_1 = require("./dbt/apiClient");
18
19
  const getDbtVersion_1 = require("./dbt/getDbtVersion");
20
+ const replaceProjectYamlTags = async (projectUuid, lightdashProjectConfig) => {
21
+ const yamlTags = Object.entries(lightdashProjectConfig.spotlight?.categories ?? {}).map(([yamlReference, category]) => ({
22
+ yamlReference,
23
+ name: category.label,
24
+ color: category.color ?? 'gray',
25
+ }));
26
+ await (0, apiClient_1.lightdashApi)({
27
+ method: 'PUT',
28
+ url: `/api/v1/projects/${projectUuid}/tags/yaml`,
29
+ body: JSON.stringify(yamlTags),
30
+ });
31
+ };
19
32
  const deploy = async (explores, options) => {
20
33
  if (explores.length === 0) {
21
34
  globalState_1.default.log(styles.warning('No explores found'));
@@ -31,6 +44,8 @@ const deploy = async (explores, options) => {
31
44
  process.exit(1);
32
45
  }
33
46
  }
47
+ const lightdashProjectConfig = await (0, lightdash_config_1.loadLightdashProjectConfig)(path_1.default.join(options.projectDir, 'lightdash.config.yml'));
48
+ await replaceProjectYamlTags(options.projectUuid, lightdashProjectConfig);
34
49
  await (0, apiClient_1.lightdashApi)({
35
50
  method: 'PUT',
36
51
  url: `/api/v1/projects/${options.projectUuid}/explores`,
@@ -0,0 +1,2 @@
1
+ import { LightdashProjectConfig } from '@lightdash/common';
2
+ export declare const loadLightdashProjectConfig: (configPath: string) => Promise<LightdashProjectConfig>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadLightdashProjectConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@lightdash/common");
6
+ const better_ajv_errors_1 = tslib_1.__importDefault(require("better-ajv-errors"));
7
+ const fs_1 = require("fs");
8
+ const yaml = tslib_1.__importStar(require("js-yaml"));
9
+ const ajv_1 = require("../ajv");
10
+ const loadLightdashProjectConfig = async (configPath) => {
11
+ try {
12
+ const configFile = yaml.load(await fs_1.promises.readFile(configPath, 'utf8'));
13
+ const validate = ajv_1.ajv.compile(common_1.lightdashProjectConfigSchema);
14
+ if (!validate(configFile)) {
15
+ const errors = (0, better_ajv_errors_1.default)(common_1.lightdashProjectConfigSchema, configFile, validate.errors || [], { indent: 2 });
16
+ throw new common_1.ParseError(`Invalid lightdash.config.yml at ${configPath}\n${errors}`);
17
+ }
18
+ return configFile;
19
+ }
20
+ catch (e) {
21
+ if (e instanceof Error && 'code' in e && e.code === 'ENOENT') {
22
+ // Return default config if file doesn't exist
23
+ return {
24
+ spotlight: common_1.DEFAULT_SPOTLIGHT_CONFIG,
25
+ };
26
+ }
27
+ throw e;
28
+ }
29
+ };
30
+ exports.loadLightdashProjectConfig = loadLightdashProjectConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.1464.3",
3
+ "version": "0.1466.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "lightdash": "dist/index.js"
@@ -30,8 +30,8 @@
30
30
  "parse-node-version": "^2.0.0",
31
31
  "unique-names-generator": "^4.7.1",
32
32
  "uuid": "^11.0.3",
33
- "@lightdash/common": "0.1464.3",
34
- "@lightdash/warehouses": "0.1464.3"
33
+ "@lightdash/common": "0.1466.0",
34
+ "@lightdash/warehouses": "0.1466.0"
35
35
  },
36
36
  "description": "Lightdash CLI tool",
37
37
  "devDependencies": {