@lightdash/common 0.1358.0 → 0.1359.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.
@@ -24,6 +24,15 @@ export type ApiCatalogSearch = {
24
24
  filter?: CatalogFilter;
25
25
  catalogTags?: string[];
26
26
  };
27
+ type EmojiIcon = {
28
+ unicode: string;
29
+ };
30
+ type CustomIcon = {
31
+ url: string;
32
+ };
33
+ export type CatalogItemIcon = EmojiIcon | CustomIcon;
34
+ export declare const isEmojiIcon: (icon: CatalogItemIcon | null) => icon is EmojiIcon;
35
+ export declare const isCustomIcon: (icon: CatalogItemIcon | null) => icon is CustomIcon;
27
36
  export type CatalogField = Pick<Field, 'name' | 'label' | 'fieldType' | 'tableLabel' | 'description'> & Pick<Dimension, 'requiredAttributes'> & {
28
37
  catalogSearchUuid: string;
29
38
  type: CatalogType.Field;
@@ -33,6 +42,7 @@ export type CatalogField = Pick<Field, 'name' | 'label' | 'fieldType' | 'tableLa
33
42
  tags?: string[];
34
43
  categories: Pick<Tag, 'name' | 'color' | 'tagUuid'>[];
35
44
  chartUsage: number | undefined;
45
+ icon: CatalogItemIcon | null;
36
46
  };
37
47
  export type CatalogTable = Pick<TableBase, 'name' | 'label' | 'groupLabel' | 'description' | 'requiredAttributes'> & {
38
48
  catalogSearchUuid: string;
@@ -43,6 +53,7 @@ export type CatalogTable = Pick<TableBase, 'name' | 'label' | 'groupLabel' | 'de
43
53
  categories: Pick<Tag, 'name' | 'color' | 'tagUuid'>[];
44
54
  joinedTables?: CompiledExploreJoin[];
45
55
  chartUsage: number | undefined;
56
+ icon: CatalogItemIcon | null;
46
57
  };
47
58
  export type CatalogItem = CatalogField | CatalogTable;
48
59
  export type ApiCatalogResults = CatalogItem[];
@@ -75,12 +86,9 @@ export type CatalogFieldMap = {
75
86
  cachedExploreUuid: string;
76
87
  };
77
88
  };
78
- export type CatalogItemWithTagUuids = {
79
- catalogSearchUuid: string;
89
+ export type CatalogItemWithTagUuids = Pick<CatalogItem, 'catalogSearchUuid' | 'name' | 'type'> & {
80
90
  cachedExploreUuid: string;
81
91
  projectUuid: string;
82
- name: string;
83
- type: CatalogType;
84
92
  fieldType?: string;
85
93
  exploreBaseTable: string;
86
94
  catalogTags: {
@@ -89,11 +97,13 @@ export type CatalogItemWithTagUuids = {
89
97
  createdAt: Date;
90
98
  }[];
91
99
  };
100
+ export type CatalogItemsWithIcons = Pick<CatalogItem, 'catalogSearchUuid' | 'icon' | 'name' | 'type'> & Pick<CatalogItemWithTagUuids, 'cachedExploreUuid' | 'projectUuid' | 'fieldType' | 'exploreBaseTable'>;
92
101
  export type SchedulerIndexCatalogJobPayload = {
93
102
  projectUuid: string;
94
103
  explores: (Explore | ExploreError)[];
95
104
  userUuid: string;
96
105
  prevCatalogItemsWithTags: CatalogItemWithTagUuids[];
106
+ prevCatalogItemsWithIcons: CatalogItemsWithIcons[];
97
107
  };
98
108
  export type CatalogFieldWhere = {
99
109
  fieldName: string;
@@ -103,3 +113,4 @@ export type ChartUsageIn = CatalogFieldWhere & {
103
113
  chartUsage: number;
104
114
  };
105
115
  export declare const indexCatalogJob = "indexCatalog";
116
+ export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.indexCatalogJob = exports.getBasicType = exports.CatalogFilter = exports.CatalogType = void 0;
3
+ exports.indexCatalogJob = exports.getBasicType = exports.isCustomIcon = exports.isEmojiIcon = exports.CatalogFilter = exports.CatalogType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const assertUnreachable_1 = tslib_1.__importDefault(require("../utils/assertUnreachable"));
6
6
  const field_1 = require("./field");
@@ -15,6 +15,10 @@ var CatalogFilter;
15
15
  CatalogFilter["Dimensions"] = "dimensions";
16
16
  CatalogFilter["Metrics"] = "metrics";
17
17
  })(CatalogFilter = exports.CatalogFilter || (exports.CatalogFilter = {}));
18
+ const isEmojiIcon = (icon) => Boolean(icon && 'unicode' in icon);
19
+ exports.isEmojiIcon = isEmojiIcon;
20
+ const isCustomIcon = (icon) => Boolean(icon && 'url' in icon);
21
+ exports.isCustomIcon = isCustomIcon;
18
22
  const getBasicType = (field) => {
19
23
  const { type } = field;
20
24
  switch (type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1358.0",
3
+ "version": "0.1359.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [