@lightdash/common 0.1391.0 → 0.1393.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -124,6 +124,7 @@ export * from './types/warehouse';
124
124
  export * from './utils/additionalMetrics';
125
125
  export * from './utils/api';
126
126
  export { default as assertUnreachable } from './utils/assertUnreachable';
127
+ export * from './utils/catalogMetricsTree';
127
128
  export * from './utils/conditionalFormatting';
128
129
  export * from './utils/convertToDbt';
129
130
  export * from './utils/dashboard';
package/dist/index.js CHANGED
@@ -94,6 +94,7 @@ tslib_1.__exportStar(require("./utils/additionalMetrics"), exports);
94
94
  tslib_1.__exportStar(require("./utils/api"), exports);
95
95
  var assertUnreachable_1 = require("./utils/assertUnreachable");
96
96
  Object.defineProperty(exports, "assertUnreachable", { enumerable: true, get: function () { return tslib_1.__importDefault(assertUnreachable_1).default; } });
97
+ tslib_1.__exportStar(require("./utils/catalogMetricsTree"), exports);
97
98
  tslib_1.__exportStar(require("./utils/conditionalFormatting"), exports);
98
99
  tslib_1.__exportStar(require("./utils/convertToDbt"), exports);
99
100
  tslib_1.__exportStar(require("./utils/dashboard"), exports);
@@ -56,6 +56,11 @@ export type CatalogTable = Pick<TableBase, 'name' | 'label' | 'groupLabel' | 'de
56
56
  icon: CatalogItemIcon | null;
57
57
  };
58
58
  export type CatalogItem = CatalogField | CatalogTable;
59
+ export type CatalogMetricsTreeNode = Pick<CatalogField, 'name' | 'tableName'>;
60
+ export type CatalogMetricsTreeEdge = {
61
+ source: CatalogMetricsTreeNode;
62
+ target: CatalogMetricsTreeNode;
63
+ };
59
64
  export type ApiCatalogResults = CatalogItem[];
60
65
  export type ApiMetricsCatalogResults = CatalogField[];
61
66
  export type ApiMetricsCatalog = {
@@ -67,6 +72,16 @@ export type ApiGetMetricPeek = {
67
72
  status: 'ok';
68
73
  results: MetricWithAssociatedTimeDimension;
69
74
  };
75
+ export type ApiGetMetricsTree = {
76
+ status: 'ok';
77
+ results: {
78
+ edges: CatalogMetricsTreeEdge[];
79
+ };
80
+ };
81
+ export type ApiCreateMetricsTreeEdgePayload = {
82
+ sourceMetricId: string;
83
+ targetMetricId: string;
84
+ };
70
85
  export type CatalogMetadata = {
71
86
  name: string;
72
87
  description: string | undefined;
@@ -1,4 +1,4 @@
1
- import type { PromotionChanges, SavedChart } from '..';
1
+ import type { Dashboard, DashboardTile, PromotionChanges, SavedChart } from '..';
2
2
  export declare const currentVersion = 1;
3
3
  export type ChartAsCode = Pick<SavedChart, 'name' | 'description' | 'tableName' | 'metricQuery' | 'chartConfig' | 'tableConfig' | 'slug' | 'dashboardUuid' | 'updatedAt'> & {
4
4
  version: number;
@@ -13,3 +13,20 @@ export type ApiChartAsCodeUpsertResponse = {
13
13
  status: 'ok';
14
14
  results: PromotionChanges;
15
15
  };
16
+ export type DashboardTileWithoutUuids = Omit<DashboardTile, 'properties'> & {
17
+ properties: Omit<DashboardTile['properties'], 'savedChartUuid' | 'savedSqlUuid' | 'savedSemanticViewerChartUuid'>;
18
+ };
19
+ export type DashboardAsCode = Pick<Dashboard, 'name' | 'description' | 'updatedAt' | 'filters' | 'tabs' | 'slug'> & {
20
+ tiles: DashboardTileWithoutUuids[];
21
+ version: number;
22
+ spaceSlug: string;
23
+ downloadedAt?: Date;
24
+ };
25
+ export type ApiDashboardAsCodeListResponse = {
26
+ status: 'ok';
27
+ results: DashboardAsCode[];
28
+ };
29
+ export type ApiDashboardAsCodeUpsertResponse = {
30
+ status: 'ok';
31
+ results: PromotionChanges;
32
+ };
@@ -45,6 +45,7 @@ export type DashboardChartTileProperties = {
45
45
  belongsToDashboard?: boolean;
46
46
  chartName?: string | null;
47
47
  lastVersionChartKind?: ChartKind | null;
48
+ chartSlug?: string;
48
49
  };
49
50
  };
50
51
  export type DashboardSqlChartTileProperties = {
@@ -54,6 +55,7 @@ export type DashboardSqlChartTileProperties = {
54
55
  savedSqlUuid: string | null;
55
56
  chartName: string;
56
57
  hideTitle?: boolean;
58
+ chartSlug?: string;
57
59
  };
58
60
  };
59
61
  export type DashboardSemanticViewerChartTileProperties = {
@@ -63,6 +65,7 @@ export type DashboardSemanticViewerChartTileProperties = {
63
65
  savedSemanticViewerChartUuid: string | null;
64
66
  chartName: string;
65
67
  hideTitle?: boolean;
68
+ chartSlug?: string;
66
69
  };
67
70
  };
68
71
  export type CreateDashboardMarkdownTile = CreateDashboardTileBase & DashboardMarkdownTileProperties;
@@ -0,0 +1,3 @@
1
+ import type { CatalogMetricsTreeNode } from '../types/catalog';
2
+ export declare function getMetricsTreeNodeId(field: CatalogMetricsTreeNode): string;
3
+ export declare function parseMetricsTreeNodeId(id: string): CatalogMetricsTreeNode;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseMetricsTreeNodeId = exports.getMetricsTreeNodeId = void 0;
4
+ function getMetricsTreeNodeId(field) {
5
+ return `${field.tableName}::${field.name}`;
6
+ }
7
+ exports.getMetricsTreeNodeId = getMetricsTreeNodeId;
8
+ function parseMetricsTreeNodeId(id) {
9
+ const [tableName, name] = id.split('::');
10
+ if (!tableName || !name) {
11
+ throw new Error('Invalid metrics tree node id');
12
+ }
13
+ return {
14
+ name,
15
+ tableName,
16
+ };
17
+ }
18
+ exports.parseMetricsTreeNodeId = parseMetricsTreeNodeId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1391.0",
3
+ "version": "0.1393.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [