@lightdash/common 0.1356.2 → 0.1357.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,6 +95,13 @@ const convertDimension = (index, targetWarehouse, model, tableLabel, column, sou
95
95
  ...(isAdditionalDimension ? { isAdditionalDimension } : {}),
96
96
  groups,
97
97
  isIntervalBase,
98
+ ...(column.meta.dimension && column.meta.dimension.tags
99
+ ? {
100
+ tags: Array.isArray(column.meta.dimension.tags)
101
+ ? column.meta.dimension.tags
102
+ : [column.meta.dimension.tags],
103
+ }
104
+ : {}),
98
105
  };
99
106
  };
100
107
  const generateTableLineage = (model, depGraph) => {
@@ -173,6 +180,13 @@ const convertDbtMetricToLightdashMetric = (metric, tableName, tableLabel) => {
173
180
  showUnderlyingValues: metric.meta?.show_underlying_values,
174
181
  filters: (0, filterGrammar_1.parseFilters)(metric.meta?.filters),
175
182
  ...(metric.meta?.urls ? { urls: metric.meta.urls } : {}),
183
+ ...(metric.meta && metric.meta.tags
184
+ ? {
185
+ tags: Array.isArray(metric.meta.tags)
186
+ ? metric.meta.tags
187
+ : [metric.meta.tags],
188
+ }
189
+ : {}),
176
190
  };
177
191
  };
178
192
  const convertTable = (adapterType, model, dbtMetrics, startOfWeek) => {
@@ -48,6 +48,19 @@
48
48
  }
49
49
  }
50
50
  },
51
+ "Tags": {
52
+ "oneOf": [
53
+ {
54
+ "type": "string"
55
+ },
56
+ {
57
+ "type": "array",
58
+ "items": {
59
+ "type": "string"
60
+ }
61
+ }
62
+ ]
63
+ },
51
64
  "LightdashDimension": {
52
65
  "type": "object",
53
66
  "required": [],
@@ -106,6 +119,9 @@
106
119
  "urls": {
107
120
  "$ref": "#/definitions/Urls"
108
121
  },
122
+ "tags": {
123
+ "$ref": "#/definitions/Tags"
124
+ },
109
125
  "required_attributes": {
110
126
  "$ref": "#/definitions/RequiredAttributes"
111
127
  }
@@ -146,6 +162,9 @@
146
162
  "urls": {
147
163
  "$ref": "#/definitions/Urls"
148
164
  },
165
+ "tags": {
166
+ "$ref": "#/definitions/Tags"
167
+ },
149
168
  "required_attributes": {
150
169
  "$ref": "#/definitions/RequiredAttributes"
151
170
  }
@@ -213,6 +232,9 @@
213
232
  },
214
233
  "percentile": {
215
234
  "type": "number"
235
+ },
236
+ "tags": {
237
+ "$ref": "#/definitions/Tags"
216
238
  }
217
239
  }
218
240
  },
@@ -43,6 +43,9 @@ export type DbtModelColumn = ColumnInfo & {
43
43
  meta: DbtColumnMetadata;
44
44
  data_type?: DimensionType;
45
45
  };
46
+ type DbtLightdashFieldTags = {
47
+ tags?: string | string[];
48
+ };
46
49
  type DbtModelMetadata = DbtModelLightdashConfig & {};
47
50
  type DbtModelLightdashConfig = {
48
51
  label?: string;
@@ -99,7 +102,7 @@ export type DbtColumnLightdashDimension = {
99
102
  colors?: Record<string, string>;
100
103
  urls?: FieldUrl[];
101
104
  required_attributes?: Record<string, string | string[]>;
102
- };
105
+ } & DbtLightdashFieldTags;
103
106
  type DbtColumnLightdashAdditionalDimension = Omit<DbtColumnLightdashDimension, 'name'>;
104
107
  export type DbtColumnLightdashMetric = {
105
108
  label?: string;
@@ -118,7 +121,7 @@ export type DbtColumnLightdashMetric = {
118
121
  [key: string]: any;
119
122
  }[];
120
123
  percentile?: number;
121
- };
124
+ } & DbtLightdashFieldTags;
122
125
  export type DbtModelLightdashMetric = DbtColumnLightdashMetric & Required<Pick<DbtColumnLightdashMetric, 'sql'>>;
123
126
  export declare const normaliseModelDatabase: (model: DbtRawModelNode, targetWarehouse: SupportedDbtAdapter) => DbtModelNode;
124
127
  export declare const patchPathParts: (patchPath: string) => {
package/dist/types/dbt.js CHANGED
@@ -158,6 +158,13 @@ const convertModelMetric = ({ modelName, name, metric, source, tableLabel, dimen
158
158
  dimensionReference,
159
159
  requiredAttributes,
160
160
  ...(metric.urls ? { urls: metric.urls } : {}),
161
+ ...(metric.tags
162
+ ? {
163
+ tags: Array.isArray(metric.tags)
164
+ ? metric.tags
165
+ : [metric.tags],
166
+ }
167
+ : {}),
161
168
  };
162
169
  };
163
170
  exports.convertModelMetric = convertModelMetric;
@@ -140,6 +140,7 @@ export interface Field {
140
140
  groups?: string[];
141
141
  urls?: FieldUrl[];
142
142
  index?: number;
143
+ tags?: string[];
143
144
  }
144
145
  export declare const isField: (field: any) => field is Field;
145
146
  export type FieldId = string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1356.2",
3
+ "version": "0.1357.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [