@lightdash/common 0.1463.0 → 0.1464.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/compiler/exploreCompiler.d.ts +1 -1
- package/dist/dbt/schemas/lightdashMetadata.json +1 -1
- package/dist/dbt/validation.d.ts +2 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.js +4 -3
- package/dist/schemas/json/lightdash-dbt-2.0.json +4 -0
- package/dist/types/any.d.ts +7 -0
- package/dist/types/any.js +2 -0
- package/dist/types/api/errors.d.ts +2 -1
- package/dist/types/dbt.d.ts +11 -10
- package/dist/types/dbt.js +3 -1
- package/dist/types/errors.d.ts +18 -17
- package/dist/types/field.d.ts +7 -5
- package/dist/types/field.js +3 -1
- package/dist/types/field.test.js +1 -0
- package/dist/types/filter.d.ts +4 -3
- package/dist/types/filterGrammar.d.ts +3 -2
- package/dist/types/metricQuery.d.ts +8 -7
- package/dist/types/scheduler.d.ts +3 -2
- package/dist/types/user.d.ts +3 -2
- package/dist/types/warehouse.d.ts +5 -4
- package/dist/utils/filters.d.ts +6 -5
- package/dist/utils/formatting.js +2 -1
- package/dist/utils/formatting.test.js +5 -1
- package/dist/utils/loadLightdashProjectConfig.js +2 -2
- package/dist/utils/metricsExplorer.d.ts +3 -2
- package/dist/visualizations/CartesianChartDataModel.d.ts +4 -3
- package/dist/visualizations/PieChartDataModel.d.ts +2 -1
- package/dist/visualizations/TableDataModel.d.ts +2 -1
- package/package.json +1 -1
@@ -2,8 +2,8 @@ import { type DbtRawModelNode, type SupportedDbtAdapter } from '../types/dbt';
|
|
2
2
|
import { type CompiledExploreJoin, type CompiledTable, type Explore, type ExploreJoin, type Table } from '../types/explore';
|
3
3
|
import { type CompiledCustomDimension, type CompiledCustomSqlDimension, type CompiledDimension, type CompiledMetric, type CustomDimension, type CustomSqlDimension, type Dimension, type Metric } from '../types/field';
|
4
4
|
import { type WarehouseClient } from '../types/warehouse';
|
5
|
-
import { type DateGranularity } from '../types/timeFrames';
|
6
5
|
import { type LightdashProjectConfig } from '../types/lightdashProjectConfig';
|
6
|
+
import { type DateGranularity } from '../types/timeFrames';
|
7
7
|
export declare const lightdashVariablePattern: RegExp;
|
8
8
|
type Reference = {
|
9
9
|
refTable: string;
|
package/dist/dbt/validation.d.ts
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
import { type ValidateFunction } from 'ajv';
|
2
2
|
import { type AnyValidateFunction } from 'ajv/dist/types';
|
3
|
+
import { type AnyType } from '../types/any';
|
3
4
|
import { type DbtManifestVersion, type DbtMetric, type DbtRawModelNode } from '../types/dbt';
|
4
5
|
export declare class ManifestValidator {
|
5
6
|
private readonly lightdashSchemaId;
|
6
7
|
private readonly dbtSchemaId;
|
7
8
|
constructor(manifestVersion: DbtManifestVersion);
|
8
|
-
static isValid: (validator: ValidateFunction<
|
9
|
+
static isValid: (validator: ValidateFunction<AnyType>, data: AnyType) => [true, undefined] | [false, string];
|
9
10
|
static formatAjvErrors: (validator: AnyValidateFunction) => string;
|
10
11
|
static getValidator: <T>(schemaRef: string) => AnyValidateFunction<T>;
|
11
12
|
isModelValid: (model: DbtRawModelNode) => [true, undefined] | [false, string];
|
package/dist/index.d.ts
CHANGED
@@ -36,6 +36,8 @@ import { type TableBase } from './types/table';
|
|
36
36
|
import { type LightdashUser, type LoginOptions, type UserAllowedOrganization } from './types/user';
|
37
37
|
import { type UserWarehouseCredentials } from './types/userWarehouseCredentials';
|
38
38
|
import { type ValidationResponse } from './types/validation';
|
39
|
+
import { type AnyType } from './types/any';
|
40
|
+
import { type ApiGetSpotlightTableConfig } from './types/api/spotlight';
|
39
41
|
import { type ApiCatalogAnalyticsResults, type ApiCatalogMetadataResults, type ApiGetMetricsTree, type ApiMetricsCatalog } from './types/catalog';
|
40
42
|
import { type ApiChartAsCodeListResponse, type ApiChartAsCodeUpsertResponse, type ApiDashboardAsCodeListResponse } from './types/coder';
|
41
43
|
import { type ApiChartContentResponse, type ApiContentResponse } from './types/content';
|
@@ -45,7 +47,6 @@ import { type ApiPromotionChangesResponse } from './types/promotion';
|
|
45
47
|
import { type ApiSemanticLayerClientInfo, type ApiSemanticViewerChartCreate, type ApiSemanticViewerChartGet, type ApiSemanticViewerChartUpdate } from './types/semanticLayer';
|
46
48
|
import { type ApiCreateSqlChart, type ApiCreateVirtualView, type ApiGithubDbtWritePreview, type ApiSqlChart, type ApiSqlRunnerJobStatusResponse, type ApiUpdateSqlChart } from './types/sqlRunner';
|
47
49
|
import { type ApiWarehouseTableFields } from './types/warehouse';
|
48
|
-
import { type ApiGetSpotlightTableConfig } from './types/api/spotlight';
|
49
50
|
export * from './authorization/index';
|
50
51
|
export * from './authorization/types';
|
51
52
|
export * from './compiler/exploreCompiler';
|
@@ -57,15 +58,16 @@ export { default as lightdashDbtYamlSchema } from './schemas/json/lightdash-dbt-
|
|
57
58
|
export { default as lightdashProjectConfigSchema } from './schemas/json/lightdash-project-config-1.0.json';
|
58
59
|
export * from './templating/template';
|
59
60
|
export * from './types/analytics';
|
61
|
+
export * from './types/any';
|
60
62
|
export * from './types/api';
|
61
63
|
export * from './types/api/comments';
|
62
64
|
export * from './types/api/errors';
|
63
65
|
export * from './types/api/notifications';
|
64
66
|
export * from './types/api/share';
|
65
67
|
export * from './types/api/sort';
|
68
|
+
export * from './types/api/spotlight';
|
66
69
|
export * from './types/api/success';
|
67
70
|
export * from './types/api/uuid';
|
68
|
-
export * from './types/api/spotlight';
|
69
71
|
export * from './types/catalog';
|
70
72
|
export * from './types/coder';
|
71
73
|
export * from './types/comments';
|
@@ -114,6 +116,7 @@ export * from './types/share';
|
|
114
116
|
export * from './types/slack';
|
115
117
|
export * from './types/slackSettings';
|
116
118
|
export * from './types/space';
|
119
|
+
export * from './types/spotlightTableConfig';
|
117
120
|
export * from './types/sqlRunner';
|
118
121
|
export * from './types/SshKeyPair';
|
119
122
|
export * from './types/table';
|
@@ -138,6 +141,7 @@ export * from './utils/filters';
|
|
138
141
|
export * from './utils/formatting';
|
139
142
|
export * from './utils/github';
|
140
143
|
export * from './utils/item';
|
144
|
+
export * from './utils/loadLightdashProjectConfig';
|
141
145
|
export * from './utils/metricsExplorer';
|
142
146
|
export * from './utils/projectMemberRole';
|
143
147
|
export * from './utils/sanitizeHtml';
|
@@ -153,8 +157,6 @@ export * from './visualizations/PieChartDataModel';
|
|
153
157
|
export * from './visualizations/TableDataModel';
|
154
158
|
export * from './visualizations/types';
|
155
159
|
export * from './visualizations/types/IResultsRunner';
|
156
|
-
export * from './types/spotlightTableConfig';
|
157
|
-
export * from './utils/loadLightdashProjectConfig';
|
158
160
|
export declare const validateEmail: (email: string) => boolean;
|
159
161
|
export declare const getEmailSchema: () => z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
160
162
|
export declare const getPasswordSchema: () => z.ZodString;
|
@@ -229,7 +231,7 @@ export declare const SEED_GROUP: {
|
|
229
231
|
groupUuid: string;
|
230
232
|
name: string;
|
231
233
|
};
|
232
|
-
export type ArgumentsOf<F extends Function> = F extends (...args: infer A) =>
|
234
|
+
export type ArgumentsOf<F extends Function> = F extends (...args: infer A) => AnyType ? A : never;
|
233
235
|
export declare const getVisibleFields: (explore: Explore) => CompiledField[];
|
234
236
|
export declare const findFieldByIdInExplore: (explore: Explore, id: FieldId) => Field | undefined;
|
235
237
|
export declare const snakeCaseName: (text: string) => string;
|
@@ -552,8 +554,8 @@ export declare const getMetricsFromItemsMap: (itemsMap: ItemsMap, filter?: (valu
|
|
552
554
|
export declare const getTableCalculationsFromItemsMap: (itemsMap?: ItemsMap) => Record<string, TableCalculation>;
|
553
555
|
export declare function itemsInMetricQuery(metricQuery: MetricQuery | undefined): string[];
|
554
556
|
export declare function formatRows(rows: {
|
555
|
-
[col: string]:
|
557
|
+
[col: string]: AnyType;
|
556
558
|
}[], itemsMap: ItemsMap): ResultRow[];
|
557
|
-
export declare const removeEmptyProperties: (object: Record<string,
|
558
|
-
export declare const deepEqual: (object1: Record<string,
|
559
|
+
export declare const removeEmptyProperties: (object: Record<string, AnyType>) => Record<string, any>;
|
560
|
+
export declare const deepEqual: (object1: Record<string, AnyType>, object2: Record<string, AnyType>) => boolean;
|
559
561
|
export declare const getProjectDirectory: (dbtConnection?: DbtProjectConfig) => string | undefined;
|
package/dist/index.js
CHANGED
@@ -26,15 +26,16 @@ var lightdash_project_config_1_0_json_1 = require("./schemas/json/lightdash-proj
|
|
26
26
|
Object.defineProperty(exports, "lightdashProjectConfigSchema", { enumerable: true, get: function () { return tslib_1.__importDefault(lightdash_project_config_1_0_json_1).default; } });
|
27
27
|
tslib_1.__exportStar(require("./templating/template"), exports);
|
28
28
|
tslib_1.__exportStar(require("./types/analytics"), exports);
|
29
|
+
tslib_1.__exportStar(require("./types/any"), exports);
|
29
30
|
tslib_1.__exportStar(require("./types/api"), exports);
|
30
31
|
tslib_1.__exportStar(require("./types/api/comments"), exports);
|
31
32
|
tslib_1.__exportStar(require("./types/api/errors"), exports);
|
32
33
|
tslib_1.__exportStar(require("./types/api/notifications"), exports);
|
33
34
|
tslib_1.__exportStar(require("./types/api/share"), exports);
|
34
35
|
tslib_1.__exportStar(require("./types/api/sort"), exports);
|
36
|
+
tslib_1.__exportStar(require("./types/api/spotlight"), exports);
|
35
37
|
tslib_1.__exportStar(require("./types/api/success"), exports);
|
36
38
|
tslib_1.__exportStar(require("./types/api/uuid"), exports);
|
37
|
-
tslib_1.__exportStar(require("./types/api/spotlight"), exports);
|
38
39
|
tslib_1.__exportStar(require("./types/catalog"), exports);
|
39
40
|
tslib_1.__exportStar(require("./types/coder"), exports);
|
40
41
|
tslib_1.__exportStar(require("./types/comments"), exports);
|
@@ -83,6 +84,7 @@ tslib_1.__exportStar(require("./types/share"), exports);
|
|
83
84
|
tslib_1.__exportStar(require("./types/slack"), exports);
|
84
85
|
tslib_1.__exportStar(require("./types/slackSettings"), exports);
|
85
86
|
tslib_1.__exportStar(require("./types/space"), exports);
|
87
|
+
tslib_1.__exportStar(require("./types/spotlightTableConfig"), exports);
|
86
88
|
tslib_1.__exportStar(require("./types/sqlRunner"), exports);
|
87
89
|
tslib_1.__exportStar(require("./types/SshKeyPair"), exports);
|
88
90
|
tslib_1.__exportStar(require("./types/table"), exports);
|
@@ -108,6 +110,7 @@ tslib_1.__exportStar(require("./utils/filters"), exports);
|
|
108
110
|
tslib_1.__exportStar(require("./utils/formatting"), exports);
|
109
111
|
tslib_1.__exportStar(require("./utils/github"), exports);
|
110
112
|
tslib_1.__exportStar(require("./utils/item"), exports);
|
113
|
+
tslib_1.__exportStar(require("./utils/loadLightdashProjectConfig"), exports);
|
111
114
|
tslib_1.__exportStar(require("./utils/metricsExplorer"), exports);
|
112
115
|
tslib_1.__exportStar(require("./utils/projectMemberRole"), exports);
|
113
116
|
tslib_1.__exportStar(require("./utils/sanitizeHtml"), exports);
|
@@ -123,8 +126,6 @@ tslib_1.__exportStar(require("./visualizations/PieChartDataModel"), exports);
|
|
123
126
|
tslib_1.__exportStar(require("./visualizations/TableDataModel"), exports);
|
124
127
|
tslib_1.__exportStar(require("./visualizations/types"), exports);
|
125
128
|
tslib_1.__exportStar(require("./visualizations/types/IResultsRunner"), exports);
|
126
|
-
tslib_1.__exportStar(require("./types/spotlightTableConfig"), exports);
|
127
|
-
tslib_1.__exportStar(require("./utils/loadLightdashProjectConfig"), exports);
|
128
129
|
const validateEmail = (email) => {
|
129
130
|
if (/\s/.test(email)) {
|
130
131
|
return false;
|
@@ -146,6 +146,7 @@
|
|
146
146
|
"usd",
|
147
147
|
"gbp",
|
148
148
|
"jpy",
|
149
|
+
"dkk",
|
149
150
|
"eur",
|
150
151
|
"percent",
|
151
152
|
"id"
|
@@ -341,6 +342,7 @@
|
|
341
342
|
"mi",
|
342
343
|
"usd",
|
343
344
|
"jpy",
|
345
|
+
"dkk",
|
344
346
|
"gbp",
|
345
347
|
"eur",
|
346
348
|
"percent",
|
@@ -447,6 +449,7 @@
|
|
447
449
|
"mi",
|
448
450
|
"usd",
|
449
451
|
"jpy",
|
452
|
+
"dkk",
|
450
453
|
"gbp",
|
451
454
|
"eur",
|
452
455
|
"percent",
|
@@ -648,6 +651,7 @@
|
|
648
651
|
"mi",
|
649
652
|
"usd",
|
650
653
|
"jpy",
|
654
|
+
"dkk",
|
651
655
|
"gbp",
|
652
656
|
"eur",
|
653
657
|
"percent",
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/** This AnyType is an alias for any
|
2
|
+
* The goal is to make it easier to identify any type in the codebase
|
3
|
+
* without having to eslint-disable all the time
|
4
|
+
* These are only used on legacy `any` types, don't use it for new types.
|
5
|
+
* This is added on a separate file to avoid circular dependencies.
|
6
|
+
*/
|
7
|
+
export type AnyType = any;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from '../any';
|
1
2
|
/**
|
2
3
|
* The Error object is returned from the api any time there is an error.
|
3
4
|
* The message contains
|
@@ -21,6 +22,6 @@ export type ApiErrorPayload = {
|
|
21
22
|
/**
|
22
23
|
* Optional data containing details of the error
|
23
24
|
*/
|
24
|
-
data?:
|
25
|
+
data?: AnyType;
|
25
26
|
};
|
26
27
|
};
|
package/dist/types/dbt.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import { DepGraph } from 'dependency-graph';
|
2
|
+
import { type AnyType } from './any';
|
2
3
|
import { type ColumnInfo, type CompiledModelNode, type ParsedMetric } from './dbtFromSchema';
|
3
4
|
import { type CompactOrAlias, type DimensionType, type FieldUrl, type Format, type Metric, type MetricType, type Source } from './field';
|
5
|
+
import { type LightdashProjectConfig } from './lightdashProjectConfig';
|
4
6
|
import { type OrderFieldsByStrategy } from './table';
|
5
7
|
import { type DefaultTimeDimension, type TimeFrames } from './timeFrames';
|
6
|
-
import { type LightdashProjectConfig } from './lightdashProjectConfig';
|
7
8
|
export declare enum SupportedDbtAdapter {
|
8
9
|
BIGQUERY = "bigquery",
|
9
10
|
DATABRICKS = "databricks",
|
@@ -57,7 +58,7 @@ type DbtModelLightdashConfig = {
|
|
57
58
|
sql_filter?: string;
|
58
59
|
sql_where?: string;
|
59
60
|
required_filters?: {
|
60
|
-
[key: string]:
|
61
|
+
[key: string]: AnyType;
|
61
62
|
}[];
|
62
63
|
required_attributes?: Record<string, string | string[]>;
|
63
64
|
group_details?: Record<string, DbtModelGroup>;
|
@@ -126,7 +127,7 @@ export type DbtColumnLightdashMetric = {
|
|
126
127
|
urls?: FieldUrl[];
|
127
128
|
show_underlying_values?: string[];
|
128
129
|
filters?: {
|
129
|
-
[key: string]:
|
130
|
+
[key: string]: AnyType;
|
130
131
|
}[];
|
131
132
|
percentile?: number;
|
132
133
|
default_time_dimension?: DefaultTimeDimension;
|
@@ -171,7 +172,7 @@ export interface DbtRpcDocsGenerateResults {
|
|
171
172
|
[k: string]: DbtCatalogNode;
|
172
173
|
};
|
173
174
|
}
|
174
|
-
export declare const isDbtRpcDocsGenerateResults: (results: Record<string,
|
175
|
+
export declare const isDbtRpcDocsGenerateResults: (results: Record<string, AnyType>) => results is DbtRpcDocsGenerateResults;
|
175
176
|
export interface DbtPackage {
|
176
177
|
package: string;
|
177
178
|
version: string;
|
@@ -179,7 +180,7 @@ export interface DbtPackage {
|
|
179
180
|
export interface DbtPackages {
|
180
181
|
packages: DbtPackage[];
|
181
182
|
}
|
182
|
-
export declare const isDbtPackages: (results: Record<string,
|
183
|
+
export declare const isDbtPackages: (results: Record<string, AnyType>) => results is DbtPackages;
|
183
184
|
export type V9MetricRef = {
|
184
185
|
name: string;
|
185
186
|
package?: string | null;
|
@@ -187,7 +188,7 @@ export type V9MetricRef = {
|
|
187
188
|
};
|
188
189
|
export declare const isV9MetricRef: (x: string[] | V9MetricRef) => x is V9MetricRef;
|
189
190
|
export type DbtMetric = Omit<ParsedMetric, 'refs'> & {
|
190
|
-
meta?: Record<string,
|
191
|
+
meta?: Record<string, AnyType> & DbtMetricLightdashMetadata;
|
191
192
|
refs?: string[][] | V9MetricRef[];
|
192
193
|
};
|
193
194
|
export type DbtMetricLightdashMetadata = {
|
@@ -195,7 +196,7 @@ export type DbtMetricLightdashMetadata = {
|
|
195
196
|
group_label?: string;
|
196
197
|
groups?: string[];
|
197
198
|
show_underlying_values?: string[];
|
198
|
-
filters: Record<string,
|
199
|
+
filters: Record<string, AnyType>[];
|
199
200
|
};
|
200
201
|
export type DbtDoc = {
|
201
202
|
unique_id: string;
|
@@ -221,18 +222,18 @@ export declare const isSupportedDbtAdapterType: (x: string) => x is SupportedDbt
|
|
221
222
|
export interface DbtRpcGetManifestResults {
|
222
223
|
manifest: DbtManifest;
|
223
224
|
}
|
224
|
-
export declare const isDbtRpcManifestResults: (results: Record<string,
|
225
|
+
export declare const isDbtRpcManifestResults: (results: Record<string, AnyType>) => results is DbtRpcGetManifestResults;
|
225
226
|
export interface DbtRpcCompileResults {
|
226
227
|
results: {
|
227
228
|
node: DbtNode;
|
228
229
|
}[];
|
229
230
|
}
|
230
|
-
export declare const isDbtRpcCompileResults: (results: Record<string,
|
231
|
+
export declare const isDbtRpcCompileResults: (results: Record<string, AnyType>) => results is DbtRpcCompileResults;
|
231
232
|
export interface DbtRpcRunSqlResults {
|
232
233
|
results: {
|
233
234
|
table: {
|
234
235
|
column_names: string[];
|
235
|
-
rows:
|
236
|
+
rows: AnyType[][];
|
236
237
|
};
|
237
238
|
}[];
|
238
239
|
}
|
package/dist/types/dbt.js
CHANGED
@@ -122,7 +122,9 @@ const convertToGroups = (dbtGroups, dbtGroupLabel) => {
|
|
122
122
|
return groups;
|
123
123
|
};
|
124
124
|
exports.convertToGroups = convertToGroups;
|
125
|
-
const isDbtRpcRunSqlResults = (
|
125
|
+
const isDbtRpcRunSqlResults = (
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
127
|
+
results) => 'results' in results &&
|
126
128
|
Array.isArray(results.results) &&
|
127
129
|
results.results.every((result) => typeof result === 'object' &&
|
128
130
|
result !== null &&
|
package/dist/types/errors.d.ts
CHANGED
@@ -1,32 +1,33 @@
|
|
1
|
+
import { type AnyType } from './any';
|
1
2
|
import { type DbtLog } from './job';
|
2
3
|
type LightdashErrorParams = {
|
3
4
|
message: string;
|
4
5
|
name: string;
|
5
6
|
statusCode: number;
|
6
7
|
data: {
|
7
|
-
[key: string]:
|
8
|
+
[key: string]: AnyType;
|
8
9
|
};
|
9
10
|
};
|
10
11
|
export declare class LightdashError extends Error {
|
11
12
|
statusCode: number;
|
12
13
|
data: {
|
13
|
-
[key: string]:
|
14
|
+
[key: string]: AnyType;
|
14
15
|
};
|
15
16
|
constructor({ message, name, statusCode, data }: LightdashErrorParams);
|
16
17
|
}
|
17
18
|
export declare class ForbiddenError extends LightdashError {
|
18
19
|
constructor(message?: string, data?: {
|
19
|
-
[key: string]:
|
20
|
+
[key: string]: AnyType;
|
20
21
|
});
|
21
22
|
}
|
22
23
|
export declare class DeactivatedAccountError extends LightdashError {
|
23
24
|
constructor(message?: string, data?: {
|
24
|
-
[key: string]:
|
25
|
+
[key: string]: AnyType;
|
25
26
|
});
|
26
27
|
}
|
27
28
|
export declare class AuthorizationError extends LightdashError {
|
28
29
|
constructor(message?: string, data?: {
|
29
|
-
[key: string]:
|
30
|
+
[key: string]: AnyType;
|
30
31
|
});
|
31
32
|
}
|
32
33
|
export declare class NotExistsError extends LightdashError {
|
@@ -36,16 +37,16 @@ export declare class ExpiredError extends LightdashError {
|
|
36
37
|
constructor(message: string);
|
37
38
|
}
|
38
39
|
export declare class ParameterError extends LightdashError {
|
39
|
-
constructor(message?: string, data?: Record<string,
|
40
|
+
constructor(message?: string, data?: Record<string, AnyType>);
|
40
41
|
}
|
41
42
|
export declare class NonCompiledModelError extends LightdashError {
|
42
43
|
constructor(message: string, data?: {
|
43
|
-
[key: string]:
|
44
|
+
[key: string]: AnyType;
|
44
45
|
});
|
45
46
|
}
|
46
47
|
export declare class MissingCatalogEntryError extends LightdashError {
|
47
48
|
constructor(message: string, data: {
|
48
|
-
[key: string]:
|
49
|
+
[key: string]: AnyType;
|
49
50
|
});
|
50
51
|
}
|
51
52
|
export declare class MissingWarehouseCredentialsError extends LightdashError {
|
@@ -53,29 +54,29 @@ export declare class MissingWarehouseCredentialsError extends LightdashError {
|
|
53
54
|
}
|
54
55
|
export declare class UnexpectedServerError extends LightdashError {
|
55
56
|
constructor(message?: string, data?: {
|
56
|
-
[key: string]:
|
57
|
+
[key: string]: AnyType;
|
57
58
|
});
|
58
59
|
}
|
59
60
|
export declare class UnexpectedGitError extends LightdashError {
|
60
61
|
constructor(message?: string, data?: {
|
61
|
-
[key: string]:
|
62
|
+
[key: string]: AnyType;
|
62
63
|
});
|
63
64
|
}
|
64
65
|
export declare class UnexpectedDatabaseError extends LightdashError {
|
65
66
|
constructor(message?: string, data?: {
|
66
|
-
[key: string]:
|
67
|
+
[key: string]: AnyType;
|
67
68
|
});
|
68
69
|
}
|
69
70
|
export declare class ParseError extends LightdashError {
|
70
71
|
constructor(message?: string, data?: {
|
71
|
-
[key: string]:
|
72
|
+
[key: string]: AnyType;
|
72
73
|
});
|
73
74
|
}
|
74
75
|
export declare class CompileError extends LightdashError {
|
75
|
-
constructor(message?: string, data?: Record<string,
|
76
|
+
constructor(message?: string, data?: Record<string, AnyType>);
|
76
77
|
}
|
77
78
|
export declare class FieldReferenceError extends LightdashError {
|
78
|
-
constructor(message?: string, data?: Record<string,
|
79
|
+
constructor(message?: string, data?: Record<string, AnyType>);
|
79
80
|
}
|
80
81
|
export declare class DbtError extends LightdashError {
|
81
82
|
logs: DbtLog[] | undefined;
|
@@ -92,12 +93,12 @@ export declare class WarehouseConnectionError extends LightdashError {
|
|
92
93
|
}
|
93
94
|
export declare class WarehouseQueryError extends LightdashError {
|
94
95
|
constructor(message: string, data?: {
|
95
|
-
[key: string]:
|
96
|
+
[key: string]: AnyType;
|
96
97
|
});
|
97
98
|
}
|
98
99
|
export declare class SmptError extends LightdashError {
|
99
100
|
constructor(message: string, data?: {
|
100
|
-
[key: string]:
|
101
|
+
[key: string]: AnyType;
|
101
102
|
});
|
102
103
|
}
|
103
104
|
export declare class AlreadyProcessingError extends LightdashError {
|
@@ -120,7 +121,7 @@ export declare class SlackInstallationNotFoundError extends LightdashError {
|
|
120
121
|
}
|
121
122
|
export declare class UnexpectedGoogleSheetsError extends LightdashError {
|
122
123
|
constructor(message?: string, data?: {
|
123
|
-
[key: string]:
|
124
|
+
[key: string]: AnyType;
|
124
125
|
});
|
125
126
|
}
|
126
127
|
export declare const getErrorMessage: (e: unknown) => string;
|
package/dist/types/field.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { AdditionalMetric, currencies, DefaultTimeDimension, LightdashProjectConfig } from '..';
|
2
|
+
import { type AnyType } from './any';
|
2
3
|
import { type MetricFilterRule } from './filter';
|
3
4
|
import { type TimeFrames } from './timeFrames';
|
4
5
|
export declare enum Compact {
|
@@ -58,15 +59,15 @@ export interface CustomSqlDimension extends BaseCustomDimension {
|
|
58
59
|
dimensionType: DimensionType;
|
59
60
|
}
|
60
61
|
export type CustomDimension = CustomBinDimension | CustomSqlDimension;
|
61
|
-
export declare const isCustomDimension: (value:
|
62
|
-
export declare const isCustomBinDimension: (value:
|
63
|
-
export declare const isCustomSqlDimension: (value:
|
62
|
+
export declare const isCustomDimension: (value: AnyType) => value is CustomDimension;
|
63
|
+
export declare const isCustomBinDimension: (value: AnyType) => value is CustomBinDimension;
|
64
|
+
export declare const isCustomSqlDimension: (value: AnyType) => value is CustomSqlDimension;
|
64
65
|
export type CompiledCustomSqlDimension = CustomSqlDimension & {
|
65
66
|
compiledSql: string;
|
66
67
|
tablesReferences: Array<string>;
|
67
68
|
};
|
68
69
|
export type CompiledCustomDimension = CustomBinDimension | CompiledCustomSqlDimension;
|
69
|
-
export declare const isCompiledCustomSqlDimension: (value:
|
70
|
+
export declare const isCompiledCustomSqlDimension: (value: AnyType) => value is CompiledCustomSqlDimension;
|
70
71
|
export type ItemsMap = Record<string, Field | TableCalculation | CustomDimension | Metric>;
|
71
72
|
export type Item = ItemsMap[string];
|
72
73
|
export interface CustomFormat {
|
@@ -142,7 +143,7 @@ export interface Field {
|
|
142
143
|
index?: number;
|
143
144
|
tags?: string[];
|
144
145
|
}
|
145
|
-
export declare const isField: (field:
|
146
|
+
export declare const isField: (field: AnyType) => field is Field;
|
146
147
|
export type FieldId = string;
|
147
148
|
export declare const convertFieldRefToFieldId: (fieldRef: string, fallbackTableName?: string) => string;
|
148
149
|
export type Source = {
|
@@ -222,6 +223,7 @@ export declare enum Format {
|
|
222
223
|
GBP = "gbp",
|
223
224
|
EUR = "eur",
|
224
225
|
JPY = "jpy",
|
226
|
+
DKK = "dkk",
|
225
227
|
ID = "id",
|
226
228
|
PERCENT = "percent"
|
227
229
|
}
|
package/dist/types/field.js
CHANGED
@@ -58,7 +58,8 @@ exports.CompactConfigMap = {
|
|
58
58
|
},
|
59
59
|
};
|
60
60
|
function findCompactConfig(compactOrAlias) {
|
61
|
-
return Object.values(exports.CompactConfigMap).find(({ compact, alias }) => compact === compactOrAlias ||
|
61
|
+
return Object.values(exports.CompactConfigMap).find(({ compact, alias }) => compact === compactOrAlias ||
|
62
|
+
alias.includes(compactOrAlias));
|
62
63
|
}
|
63
64
|
exports.findCompactConfig = findCompactConfig;
|
64
65
|
var BinType;
|
@@ -170,6 +171,7 @@ var Format;
|
|
170
171
|
Format["GBP"] = "gbp";
|
171
172
|
Format["EUR"] = "eur";
|
172
173
|
Format["JPY"] = "jpy";
|
174
|
+
Format["DKK"] = "dkk";
|
173
175
|
Format["ID"] = "id";
|
174
176
|
Format["PERCENT"] = "percent";
|
175
177
|
})(Format = exports.Format || (exports.Format = {}));
|
package/dist/types/field.test.js
CHANGED
@@ -78,6 +78,7 @@ describe('field util functions', () => {
|
|
78
78
|
expect((0, field_1.isFormat)('gbp')).toBe(true);
|
79
79
|
expect((0, field_1.isFormat)('eur')).toBe(true);
|
80
80
|
expect((0, field_1.isFormat)('jpy')).toBe(true);
|
81
|
+
expect((0, field_1.isFormat)('dkk')).toBe(true);
|
81
82
|
expect((0, field_1.isFormat)('id')).toBe(true);
|
82
83
|
expect((0, field_1.isFormat)('percent')).toBe(true);
|
83
84
|
});
|
package/dist/types/filter.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from './any';
|
1
2
|
import { ConditionalOperator, type ConditionalRule } from './conditionalRule';
|
2
3
|
import type { SchedulerFilterRule } from './scheduler';
|
3
4
|
export declare enum FilterType {
|
@@ -22,7 +23,7 @@ export declare const getUnitsOfTimeGreaterOrEqual: (unit: UnitOfTime) => UnitOfT
|
|
22
23
|
export type FieldTarget = {
|
23
24
|
fieldId: string;
|
24
25
|
};
|
25
|
-
export interface FilterRule<O = ConditionalOperator, T = FieldTarget, V =
|
26
|
+
export interface FilterRule<O = ConditionalOperator, T = FieldTarget, V = AnyType, S = AnyType> extends ConditionalRule<O, V> {
|
26
27
|
id: string;
|
27
28
|
target: T;
|
28
29
|
settings?: S;
|
@@ -38,7 +39,7 @@ export type DashboardFieldTarget = {
|
|
38
39
|
tableName: string;
|
39
40
|
};
|
40
41
|
export type DashboardTileTarget = DashboardFieldTarget | false;
|
41
|
-
export type DashboardFilterRule<O = ConditionalOperator, T extends DashboardFieldTarget = DashboardFieldTarget, V =
|
42
|
+
export type DashboardFilterRule<O = ConditionalOperator, T extends DashboardFieldTarget = DashboardFieldTarget, V = AnyType, S = AnyType> = FilterRule<O, T, V, S> & {
|
42
43
|
tileTargets?: Record<string, DashboardTileTarget>;
|
43
44
|
label: undefined | string;
|
44
45
|
};
|
@@ -52,7 +53,7 @@ export type DateFilterSettings = {
|
|
52
53
|
unitOfTime?: UnitOfTime;
|
53
54
|
completed?: boolean;
|
54
55
|
};
|
55
|
-
export type DateFilterRule = FilterRule<ConditionalOperator, unknown,
|
56
|
+
export type DateFilterRule = FilterRule<ConditionalOperator, unknown, AnyType, DateFilterSettings>;
|
56
57
|
export type FilterGroupItem = FilterGroup | FilterRule;
|
57
58
|
export type OrFilterGroup = {
|
58
59
|
id: string;
|
@@ -1,11 +1,12 @@
|
|
1
|
+
import { type AnyType } from './any';
|
1
2
|
import { FilterOperator, type MetricFilterRule } from './filter';
|
2
3
|
export type ParsedFilter = {
|
3
4
|
type: string;
|
4
|
-
values:
|
5
|
+
values: AnyType[];
|
5
6
|
is?: boolean;
|
6
7
|
date_interval?: string;
|
7
8
|
};
|
8
9
|
declare const filterGrammar: string;
|
9
10
|
export declare const parseOperator: (operator: string, isTrue: boolean) => FilterOperator;
|
10
|
-
export declare const parseFilters: (rawFilters: Record<string,
|
11
|
+
export declare const parseFilters: (rawFilters: Record<string, AnyType>[] | undefined) => MetricFilterRule[];
|
11
12
|
export default filterGrammar;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from './any';
|
1
2
|
import { type CompactOrAlias, type CompiledCustomDimension, type CompiledDimension, type CompiledMetric, type CompiledTableCalculation, type CustomDimension, type CustomFormat, type FieldId, type Format, type Metric, type MetricType, type TableCalculation } from './field';
|
2
3
|
import { type Filters, type MetricFilterRule } from './filter';
|
3
4
|
import { type DateGranularity } from './timeFrames';
|
@@ -19,8 +20,8 @@ export interface AdditionalMetric {
|
|
19
20
|
percentile?: number;
|
20
21
|
formatOptions?: CustomFormat;
|
21
22
|
}
|
22
|
-
export declare const isAdditionalMetric: (value:
|
23
|
-
export declare const hasFormatOptions: (value:
|
23
|
+
export declare const isAdditionalMetric: (value: AnyType) => value is AdditionalMetric;
|
24
|
+
export declare const hasFormatOptions: (value: AnyType) => value is {
|
24
25
|
formatOptions: CustomFormat;
|
25
26
|
};
|
26
27
|
export declare const getCustomMetricDimensionId: (metric: AdditionalMetric) => string;
|
@@ -55,10 +56,10 @@ export type SortField = {
|
|
55
56
|
export declare const getAdditionalMetricLabel: (item: AdditionalMetric) => string;
|
56
57
|
type FilterGroupResponse = {
|
57
58
|
id: string;
|
58
|
-
or:
|
59
|
+
or: AnyType[];
|
59
60
|
} | {
|
60
61
|
id: string;
|
61
|
-
and:
|
62
|
+
and: AnyType[];
|
62
63
|
};
|
63
64
|
export type FiltersResponse = {
|
64
65
|
dimensions?: FilterGroupResponse;
|
@@ -91,9 +92,9 @@ export type MetricQueryRequest = {
|
|
91
92
|
dimensions: FieldId[];
|
92
93
|
metrics: FieldId[];
|
93
94
|
filters: {
|
94
|
-
dimensions?:
|
95
|
-
metrics?:
|
96
|
-
tableCalculations?:
|
95
|
+
dimensions?: AnyType;
|
96
|
+
metrics?: AnyType;
|
97
|
+
tableCalculations?: AnyType;
|
97
98
|
};
|
98
99
|
sorts: SortField[];
|
99
100
|
limit: number;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from './any';
|
1
2
|
import { type Explore, type ExploreError } from './explore';
|
2
3
|
import { type DashboardFilterRule } from './filter';
|
3
4
|
import { type MetricQuery } from './metricQuery';
|
@@ -43,7 +44,7 @@ export type SchedulerLog = {
|
|
43
44
|
status: SchedulerJobStatus;
|
44
45
|
target?: string;
|
45
46
|
targetType?: 'email' | 'slack' | 'gsheets';
|
46
|
-
details?: Record<string,
|
47
|
+
details?: Record<string, AnyType>;
|
47
48
|
};
|
48
49
|
export type CreateSchedulerLog = Omit<SchedulerLog, 'createdAt'>;
|
49
50
|
export declare enum ThresholdOperator {
|
@@ -283,7 +284,7 @@ export type ApiJobStatusResponse = {
|
|
283
284
|
status: 'ok';
|
284
285
|
results: {
|
285
286
|
status: SchedulerJobStatus;
|
286
|
-
details: Record<string,
|
287
|
+
details: Record<string, AnyType> | null;
|
287
288
|
};
|
288
289
|
};
|
289
290
|
export type SchedulerCronUpdate = {
|
package/dist/types/user.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { type AbilityBuilder } from '@casl/ability';
|
2
2
|
import { type MemberAbility } from '../authorization/types';
|
3
|
+
import { type AnyType } from './any';
|
3
4
|
import { type OpenIdIdentityIssuerType } from './openIdIdentity';
|
4
5
|
import { type OrganizationMemberRole } from './organizationMemberProfile';
|
5
6
|
export interface LightdashUser {
|
@@ -39,7 +40,7 @@ export interface UpdatedByUser {
|
|
39
40
|
firstName: string;
|
40
41
|
lastName: string;
|
41
42
|
}
|
42
|
-
export declare const isSessionUser: (user:
|
43
|
+
export declare const isSessionUser: (user: AnyType) => user is SessionUser;
|
43
44
|
export interface OpenIdUser {
|
44
45
|
openId: {
|
45
46
|
subject: string;
|
@@ -51,7 +52,7 @@ export interface OpenIdUser {
|
|
51
52
|
groups?: string[] | undefined;
|
52
53
|
};
|
53
54
|
}
|
54
|
-
export declare const isOpenIdUser: (user:
|
55
|
+
export declare const isOpenIdUser: (user: AnyType) => user is OpenIdUser;
|
55
56
|
export type UserAllowedOrganization = {
|
56
57
|
organizationUuid: string;
|
57
58
|
name: string;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { type WeekDay } from '../utils/timeFrames';
|
2
|
+
import { type AnyType } from './any';
|
2
3
|
import { type SupportedDbtAdapter } from './dbt';
|
3
4
|
import { type DimensionType, type Metric } from './field';
|
4
5
|
import { type CreateWarehouseCredentials } from './projects';
|
@@ -31,7 +32,7 @@ export type WarehouseResults = {
|
|
31
32
|
fields: Record<string, {
|
32
33
|
type: DimensionType;
|
33
34
|
}>;
|
34
|
-
rows: Record<string,
|
35
|
+
rows: Record<string, AnyType>[];
|
35
36
|
};
|
36
37
|
export interface WarehouseClient {
|
37
38
|
credentials: CreateWarehouseCredentials;
|
@@ -41,7 +42,7 @@ export interface WarehouseClient {
|
|
41
42
|
table: string;
|
42
43
|
}[]) => Promise<WarehouseCatalog>;
|
43
44
|
streamQuery(query: string, streamCallback: (data: WarehouseResults) => void, options: {
|
44
|
-
values?:
|
45
|
+
values?: AnyType[];
|
45
46
|
tags: Record<string, string>;
|
46
47
|
timezone?: string;
|
47
48
|
}): Promise<void>;
|
@@ -53,7 +54,7 @@ export interface WarehouseClient {
|
|
53
54
|
* @param values
|
54
55
|
* @deprecated Use streamQuery() instead to avoid loading all results into memory
|
55
56
|
*/
|
56
|
-
runQuery(sql: string, tags: Record<string, string>, timezone?: string, values?:
|
57
|
+
runQuery(sql: string, tags: Record<string, string>, timezone?: string, values?: AnyType[]): Promise<WarehouseResults>;
|
57
58
|
test(): Promise<void>;
|
58
59
|
getStartOfWeek(): WeekDay | null | undefined;
|
59
60
|
getAdapterType(): SupportedDbtAdapter;
|
@@ -63,7 +64,7 @@ export interface WarehouseClient {
|
|
63
64
|
concatString(...args: string[]): string;
|
64
65
|
getAllTables(schema?: string, tags?: Record<string, string>): Promise<WarehouseTables>;
|
65
66
|
getFields(tableName: string, schema?: string, database?: string, tags?: Record<string, string>): Promise<WarehouseCatalog>;
|
66
|
-
parseWarehouseCatalog(rows: Record<string,
|
67
|
+
parseWarehouseCatalog(rows: Record<string, AnyType>[], mapFieldType: (type: string) => DimensionType): WarehouseCatalog;
|
67
68
|
parseError(error: Error): Error;
|
68
69
|
}
|
69
70
|
export type ApiWarehouseCatalog = {
|
package/dist/utils/filters.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from '../types/any';
|
1
2
|
import { type DashboardTile } from '../types/dashboard';
|
2
3
|
import { type Table } from '../types/explore';
|
3
4
|
import { type CompiledField, type CustomSqlDimension, type Dimension, type Field, type FilterableDimension, type FilterableField, type FilterableItem, type ItemsMap, type TableCalculation } from '../types/field';
|
@@ -12,13 +13,13 @@ export declare const getItemsFromFilterGroup: (filterGroup: FilterGroup | undefi
|
|
12
13
|
export declare const getFilterGroupItemsPropertyName: (filterGroup: FilterGroup | undefined) => 'and' | 'or';
|
13
14
|
export declare const getFilterTypeFromItem: (item: FilterableField) => FilterType;
|
14
15
|
export declare const timeframeToUnitOfTime: (timeframe: TimeFrames) => UnitOfTime | undefined;
|
15
|
-
export declare const getFilterRuleWithDefaultValue: <T extends FilterRule<FilterOperator, import("../types/filter").FieldTarget, any, any>>(field: FilterableField, filterRule: T, values?:
|
16
|
-
export declare const createFilterRuleFromField: (field: FilterableField, value?:
|
16
|
+
export declare const getFilterRuleWithDefaultValue: <T extends FilterRule<FilterOperator, import("../types/filter").FieldTarget, any, any>>(field: FilterableField, filterRule: T, values?: AnyType[] | null) => T;
|
17
|
+
export declare const createFilterRuleFromField: (field: FilterableField, value?: AnyType) => FilterRule;
|
17
18
|
export declare const matchFieldExact: (a: Field) => (b: Field) => boolean;
|
18
19
|
export declare const matchFieldByTypeAndName: (a: Field) => (b: Field) => boolean;
|
19
20
|
export declare const matchFieldByType: (a: Field) => (b: Field) => boolean;
|
20
21
|
export declare const isTileFilterable: (tile: DashboardTile) => boolean;
|
21
|
-
export declare const applyDefaultTileTargets: (filterRule: DashboardFilterRule<FilterOperator, DashboardFieldTarget,
|
22
|
+
export declare const applyDefaultTileTargets: (filterRule: DashboardFilterRule<FilterOperator, DashboardFieldTarget, AnyType, AnyType>, field: FilterableDimension, availableTileFilters: Record<string, FilterableDimension[] | undefined>) => DashboardFilterRule<FilterOperator, DashboardFieldTarget, any, any>;
|
22
23
|
export declare const createDashboardFilterRuleFromField: ({ field, availableTileFilters, isTemporary, value, }: {
|
23
24
|
field: Exclude<FilterableItem, TableCalculation | CustomSqlDimension> | CompiledField;
|
24
25
|
availableTileFilters: Record<string, FilterableDimension[] | undefined>;
|
@@ -28,7 +29,7 @@ export declare const createDashboardFilterRuleFromField: ({ field, availableTile
|
|
28
29
|
type AddFilterRuleArgs = {
|
29
30
|
filters: Filters;
|
30
31
|
field: FilterableField;
|
31
|
-
value?:
|
32
|
+
value?: AnyType;
|
32
33
|
};
|
33
34
|
export declare const addFilterRule: ({ filters, field, value, }: AddFilterRuleArgs) => Filters;
|
34
35
|
/**
|
@@ -37,7 +38,7 @@ export declare const addFilterRule: ({ filters, field, value, }: AddFilterRuleAr
|
|
37
38
|
* @param value - The value to check
|
38
39
|
* @returns True if the value is an invalid date, false otherwise
|
39
40
|
*/
|
40
|
-
export declare const isDimensionValueInvalidDate: (item: FilterableField, value:
|
41
|
+
export declare const isDimensionValueInvalidDate: (item: FilterableField, value: AnyType) => boolean;
|
41
42
|
/**
|
42
43
|
* Takes a filter group and build a filters object from it based on the field type
|
43
44
|
* @param filterGroup - The filter group to extract filters from
|
package/dist/utils/formatting.js
CHANGED
@@ -16,6 +16,7 @@ exports.currencies = [
|
|
16
16
|
'EUR',
|
17
17
|
'GBP',
|
18
18
|
'JPY',
|
19
|
+
'DKK',
|
19
20
|
'CHF',
|
20
21
|
'CAD',
|
21
22
|
'AUD',
|
@@ -25,7 +26,6 @@ exports.currencies = [
|
|
25
26
|
'CLP',
|
26
27
|
'COP',
|
27
28
|
'CZK',
|
28
|
-
'DKK',
|
29
29
|
'HKD',
|
30
30
|
'HUF',
|
31
31
|
'INR',
|
@@ -188,6 +188,7 @@ function getCustomFormatFromLegacy({ format, compact, round, }) {
|
|
188
188
|
case field_1.Format.GBP:
|
189
189
|
case field_1.Format.USD:
|
190
190
|
case field_1.Format.JPY:
|
191
|
+
case field_1.Format.DKK:
|
191
192
|
return {
|
192
193
|
type: field_1.CustomFormatType.CURRENCY,
|
193
194
|
currency: format.toUpperCase(),
|
@@ -67,6 +67,10 @@ describe('Formatting', () => {
|
|
67
67
|
type: field_1.CustomFormatType.CURRENCY,
|
68
68
|
currency: field_1.Format.JPY,
|
69
69
|
})).toEqual('¥5');
|
70
|
+
expect((0, formatting_1.applyCustomFormat)(5, {
|
71
|
+
type: field_1.CustomFormatType.CURRENCY,
|
72
|
+
currency: field_1.Format.DKK,
|
73
|
+
})).toEqual('DKK 5.00');
|
70
74
|
});
|
71
75
|
test('if Format is percent it should return the right format', () => {
|
72
76
|
const percentFormat = {
|
@@ -653,6 +657,7 @@ describe('Formatting', () => {
|
|
653
657
|
'€1.00',
|
654
658
|
'£1.00',
|
655
659
|
'¥1',
|
660
|
+
'DKK 1.00',
|
656
661
|
'CHF 1.00',
|
657
662
|
'CA$1.00',
|
658
663
|
'A$1.00',
|
@@ -662,7 +667,6 @@ describe('Formatting', () => {
|
|
662
667
|
'CLP 1',
|
663
668
|
'COP 1.00',
|
664
669
|
'CZK 1.00',
|
665
|
-
'DKK 1.00',
|
666
670
|
'HK$1.00',
|
667
671
|
'HUF 1.00',
|
668
672
|
'₹1.00',
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadLightdashProjectConfig = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
6
|
-
const yaml = tslib_1.__importStar(require("js-yaml"));
|
7
6
|
const better_ajv_errors_1 = tslib_1.__importDefault(require("better-ajv-errors"));
|
8
|
-
const
|
7
|
+
const yaml = tslib_1.__importStar(require("js-yaml"));
|
9
8
|
const lightdash_project_config_1_0_json_1 = tslib_1.__importDefault(require("../schemas/json/lightdash-project-config-1.0.json"));
|
10
9
|
const errors_1 = require("../types/errors");
|
10
|
+
const lightdashProjectConfig_1 = require("../types/lightdashProjectConfig");
|
11
11
|
const loadLightdashProjectConfig = async (yamlFileContents) => {
|
12
12
|
if (yamlFileContents.trim() === '') {
|
13
13
|
return {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from '../types/any';
|
1
2
|
import type { MetricWithAssociatedTimeDimension } from '../types/catalog';
|
2
3
|
import { ConditionalOperator } from '../types/conditionalRule';
|
3
4
|
import { type CompiledTable } from '../types/explore';
|
@@ -21,11 +22,11 @@ export declare const getMetricsExplorerSegmentFilters: (segmentDimension: string
|
|
21
22
|
export declare const getMetricExplorerDateRangeFilters: (timeDimensionConfig: TimeDimensionConfig, dateRange: MetricExplorerDateRange) => DateFilter[];
|
22
23
|
export declare const parseMetricValue: (value: unknown) => number | null;
|
23
24
|
export declare const MAX_SEGMENT_DIMENSION_UNIQUE_VALUES = 10;
|
24
|
-
export declare const getMetricExplorerDataPoints: (dimension: Dimension, metric: MetricWithAssociatedTimeDimension, metricRows: Record<string,
|
25
|
+
export declare const getMetricExplorerDataPoints: (dimension: Dimension, metric: MetricWithAssociatedTimeDimension, metricRows: Record<string, AnyType>[], segmentDimensionId: string | null) => {
|
25
26
|
dataPoints: Array<MetricExploreDataPoint>;
|
26
27
|
isSegmentDimensionFiltered: boolean;
|
27
28
|
};
|
28
|
-
export declare const getMetricExplorerDataPointsWithCompare: (dimension: Dimension, compareDimension: Dimension, metric: MetricWithAssociatedTimeDimension, metricRows: Record<string,
|
29
|
+
export declare const getMetricExplorerDataPointsWithCompare: (dimension: Dimension, compareDimension: Dimension, metric: MetricWithAssociatedTimeDimension, metricRows: Record<string, AnyType>[], compareMetricRows: Record<string, AnyType>[], query: MetricExplorerQuery, timeFrame: TimeFrames) => {
|
29
30
|
dataPoints: Array<MetricExploreDataPoint>;
|
30
31
|
};
|
31
32
|
/**
|
@@ -1,9 +1,10 @@
|
|
1
|
+
import { type AnyType } from '../types/any';
|
1
2
|
import { Format } from '../types/field';
|
2
3
|
import { type Organization } from '../types/organization';
|
3
4
|
import { type RawResultRow } from '../types/results';
|
4
5
|
import { ChartKind, type CartesianSeriesType } from '../types/savedCharts';
|
5
6
|
import { type SemanticLayerQuery } from '../types/semanticLayer';
|
6
|
-
import { type AxisSide,
|
7
|
+
import { VizIndexType, type AxisSide, type PivotChartData, type PivotChartLayout, type VizCartesianChartConfig, type VizCartesianChartOptions } from './types';
|
7
8
|
import { type IResultsRunner } from './types/IResultsRunner';
|
8
9
|
type CartesianChartKind = Extract<ChartKind, ChartKind.LINE | ChartKind.VERTICAL_BAR>;
|
9
10
|
export declare class CartesianChartDataModel {
|
@@ -17,7 +18,7 @@ export declare class CartesianChartDataModel {
|
|
17
18
|
type?: CartesianChartKind;
|
18
19
|
});
|
19
20
|
static getTooltipFormatter(format: Format | undefined): ((value: number) => string) | undefined;
|
20
|
-
static getValueFormatter(format: Format | undefined): ((params:
|
21
|
+
static getValueFormatter(format: Format | undefined): ((params: AnyType) => string) | undefined;
|
21
22
|
mergeConfig(chartKind: CartesianChartKind, existingConfig: VizCartesianChartConfig | undefined): VizCartesianChartConfig;
|
22
23
|
getChartOptions(): VizCartesianChartOptions;
|
23
24
|
getDefaultLayout(): PivotChartLayout | undefined;
|
@@ -43,7 +44,7 @@ export declare class CartesianChartDataModel {
|
|
43
44
|
rows: RawResultRow[];
|
44
45
|
} | undefined;
|
45
46
|
getDataDownloadUrl(): string | undefined;
|
46
|
-
getSpec(display?: CartesianChartDisplay, colors?: Organization['chartColors']): Record<string,
|
47
|
+
getSpec(display?: CartesianChartDisplay, colors?: Organization['chartColors']): Record<string, AnyType>;
|
47
48
|
}
|
48
49
|
export declare enum ValueLabelPositionOptions {
|
49
50
|
HIDDEN = "hidden",
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from '../types/any';
|
1
2
|
import { type RawResultRow } from '../types/results';
|
2
3
|
import { type ChartKind } from '../types/savedCharts';
|
3
4
|
import { type SemanticLayerQuery } from '../types/semanticLayer';
|
@@ -36,5 +37,5 @@ export declare class PieChartDataModel {
|
|
36
37
|
rows: RawResultRow[];
|
37
38
|
} | undefined;
|
38
39
|
getDataDownloadUrl(): string | undefined;
|
39
|
-
getSpec(display?: VizPieChartDisplay): Record<string,
|
40
|
+
getSpec(display?: VizPieChartDisplay): Record<string, AnyType>;
|
40
41
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type AnyType } from '../types/any';
|
1
2
|
import { type RawResultRow } from '../types/results';
|
2
3
|
import { type ChartKind } from '../types/savedCharts';
|
3
4
|
import { type SemanticLayerQuery } from '../types/semanticLayer';
|
@@ -29,7 +30,7 @@ export declare class TableDataModel {
|
|
29
30
|
rows: RawResultRow[];
|
30
31
|
} | undefined;
|
31
32
|
getSpec(_display?: VizTableDisplay): {
|
32
|
-
spec: Record<string,
|
33
|
+
spec: Record<string, AnyType>;
|
33
34
|
tableData: {
|
34
35
|
columns: string[];
|
35
36
|
rows: RawResultRow[];
|