@lightdash/common 0.1459.3 → 0.1460.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "Format": {
34
34
  "type": "string",
35
- "enum": ["km", "mi", "usd", "gbp", "eur", "id", "percent"]
35
+ "enum": ["km", "mi", "usd", "gbp", "eur", "jpy", "id", "percent"]
36
36
  },
37
37
  "Urls": {
38
38
  "type": "array",
package/dist/index.d.ts CHANGED
@@ -292,7 +292,7 @@ export type UpdateMetadata = {
292
292
  };
293
293
  export type ApiCompiledQueryResults = string;
294
294
  export type ApiExploresResults = SummaryExplore[];
295
- export type ApiExploreResults = Explore;
295
+ export type ApiExploreResults = Omit<Explore, 'unfilteredTables'>;
296
296
  export type ApiStatusResults = 'loading' | 'ready' | 'error';
297
297
  export type ApiRefreshResults = {
298
298
  jobUuid: string;
@@ -35,6 +35,9 @@ export type Explore = {
35
35
  tables: {
36
36
  [tableName: string]: CompiledTable;
37
37
  };
38
+ unfilteredTables?: {
39
+ [tableName: string]: CompiledTable;
40
+ };
38
41
  targetDatabase: SupportedDbtAdapter;
39
42
  warehouse?: string;
40
43
  ymlPath?: string;
@@ -221,6 +221,7 @@ export declare enum Format {
221
221
  USD = "usd",
222
222
  GBP = "gbp",
223
223
  EUR = "eur",
224
+ JPY = "jpy",
224
225
  ID = "id",
225
226
  PERCENT = "percent"
226
227
  }
@@ -169,6 +169,7 @@ var Format;
169
169
  Format["USD"] = "usd";
170
170
  Format["GBP"] = "gbp";
171
171
  Format["EUR"] = "eur";
172
+ Format["JPY"] = "jpy";
172
173
  Format["ID"] = "id";
173
174
  Format["PERCENT"] = "percent";
174
175
  })(Format = exports.Format || (exports.Format = {}));
@@ -70,4 +70,21 @@ describe('field util functions', () => {
70
70
  expect((0, item_1.getItemId)(additionalMetric)).toEqual('table1_calc2');
71
71
  });
72
72
  });
73
+ describe('isFormat', () => {
74
+ it('should correctly identify valid formats', () => {
75
+ expect((0, field_1.isFormat)('km')).toBe(true);
76
+ expect((0, field_1.isFormat)('mi')).toBe(true);
77
+ expect((0, field_1.isFormat)('usd')).toBe(true);
78
+ expect((0, field_1.isFormat)('gbp')).toBe(true);
79
+ expect((0, field_1.isFormat)('eur')).toBe(true);
80
+ expect((0, field_1.isFormat)('jpy')).toBe(true);
81
+ expect((0, field_1.isFormat)('id')).toBe(true);
82
+ expect((0, field_1.isFormat)('percent')).toBe(true);
83
+ });
84
+ it('should return false for invalid formats', () => {
85
+ expect((0, field_1.isFormat)('invalid')).toBe(false);
86
+ expect((0, field_1.isFormat)(undefined)).toBe(false);
87
+ expect((0, field_1.isFormat)('')).toBe(false);
88
+ });
89
+ });
73
90
  });
@@ -187,6 +187,7 @@ function getCustomFormatFromLegacy({ format, compact, round, }) {
187
187
  case field_1.Format.EUR:
188
188
  case field_1.Format.GBP:
189
189
  case field_1.Format.USD:
190
+ case field_1.Format.JPY:
190
191
  return {
191
192
  type: field_1.CustomFormatType.CURRENCY,
192
193
  currency: format.toUpperCase(),
@@ -63,6 +63,10 @@ describe('Formatting', () => {
63
63
  type: field_1.CustomFormatType.CURRENCY,
64
64
  currency: field_1.Format.EUR,
65
65
  })).toEqual('€5.00');
66
+ expect((0, formatting_1.applyCustomFormat)(5, {
67
+ type: field_1.CustomFormatType.CURRENCY,
68
+ currency: field_1.Format.JPY,
69
+ })).toEqual('¥5');
66
70
  });
67
71
  test('if Format is percent it should return the right format', () => {
68
72
  const percentFormat = {
@@ -43,6 +43,9 @@ export declare const replaceDimensionInExplore: (explore: Explore, dimension: Co
43
43
  groupLabel?: string | undefined;
44
44
  baseTable: string;
45
45
  joinedTables: import("../types/explore").CompiledExploreJoin[];
46
+ unfilteredTables?: {
47
+ [tableName: string]: import("../types/explore").CompiledTable;
48
+ } | undefined;
46
49
  targetDatabase: import("..").SupportedDbtAdapter;
47
50
  warehouse?: string | undefined;
48
51
  ymlPath?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1459.3",
3
+ "version": "0.1460.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [