@lightdash/common 0.1914.1 → 0.1915.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.
- package/dist/cjs/compiler/exploreCompiler.d.ts +9 -9
- package/dist/cjs/compiler/exploreCompiler.d.ts.map +1 -1
- package/dist/cjs/compiler/exploreCompiler.js +27 -19
- package/dist/cjs/compiler/exploreCompiler.js.map +1 -1
- package/dist/cjs/compiler/exploreCompiler.test.js +5 -5
- package/dist/cjs/compiler/exploreCompiler.test.js.map +1 -1
- package/dist/cjs/compiler/parameters.d.ts +9 -0
- package/dist/cjs/compiler/parameters.d.ts.map +1 -1
- package/dist/cjs/compiler/parameters.js +17 -1
- package/dist/cjs/compiler/parameters.js.map +1 -1
- package/dist/esm/compiler/exploreCompiler.d.ts +9 -9
- package/dist/esm/compiler/exploreCompiler.d.ts.map +1 -1
- package/dist/esm/compiler/exploreCompiler.js +28 -20
- package/dist/esm/compiler/exploreCompiler.js.map +1 -1
- package/dist/esm/compiler/exploreCompiler.test.js +5 -5
- package/dist/esm/compiler/exploreCompiler.test.js.map +1 -1
- package/dist/esm/compiler/parameters.d.ts +9 -0
- package/dist/esm/compiler/parameters.d.ts.map +1 -1
- package/dist/esm/compiler/parameters.js +14 -0
- package/dist/esm/compiler/parameters.js.map +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/compiler/exploreCompiler.d.ts +9 -9
- package/dist/types/compiler/exploreCompiler.d.ts.map +1 -1
- package/dist/types/compiler/parameters.d.ts +9 -0
- package/dist/types/compiler/parameters.d.ts.map +1 -1
- package/package.json +1 -1
@@ -36,24 +36,24 @@ export declare class ExploreCompiler {
|
|
36
36
|
private readonly warehouseClient;
|
37
37
|
constructor(warehouseClient: WarehouseSqlBuilder);
|
38
38
|
compileExplore({ name, label, tags, baseTable, joinedTables, tables, targetDatabase, groupLabel, warehouse, ymlPath, sqlPath, spotlightConfig, meta, databricksCompute, aiHint, projectParameters, }: UncompiledExplore): Explore;
|
39
|
-
compileTable(table: Table, tables: Record<string, Table
|
40
|
-
compileMetric(metric: Metric, tables: Record<string, Table
|
41
|
-
compileMetricSql(metric: Metric, tables: Record<string, Table
|
39
|
+
compileTable(table: Table, tables: Record<string, Table>, availableParameters: string[]): CompiledTable;
|
40
|
+
compileMetric(metric: Metric, tables: Record<string, Table>, availableParameters: string[]): CompiledMetric;
|
41
|
+
compileMetricSql(metric: Metric, tables: Record<string, Table>, availableParameters: string[]): {
|
42
42
|
sql: string;
|
43
43
|
tablesReferences: Set<string>;
|
44
44
|
};
|
45
|
-
compileDimension(dimension: Dimension, tables: Record<string, Table
|
45
|
+
compileDimension(dimension: Dimension, tables: Record<string, Table>, availableParameters: string[]): CompiledDimension;
|
46
46
|
compileDimensionSql(dimension: Dimension, tables: Record<string, Table>): {
|
47
47
|
sql: string;
|
48
48
|
tablesReferences: Set<string>;
|
49
49
|
};
|
50
|
-
compileCustomDimensionSql(dimension: CustomSqlDimension, tables: Record<string, Table
|
51
|
-
compileCustomDimension(customDimension: CustomDimension, tables: Record<string, Table
|
50
|
+
compileCustomDimensionSql(dimension: CustomSqlDimension, tables: Record<string, Table>, availableParameters: string[]): Pick<CompiledCustomSqlDimension, 'compiledSql' | 'tablesReferences' | 'parameterReferences'>;
|
51
|
+
compileCustomDimension(customDimension: CustomDimension, tables: Record<string, Table>, availableParameters: string[]): CompiledCustomDimension;
|
52
52
|
compileDimensionReference(ref: string, tables: Record<string, Table>, currentTable: string): {
|
53
53
|
sql: string;
|
54
54
|
tablesReferences: Set<string>;
|
55
55
|
};
|
56
|
-
compileMetricReference(ref: string, tables: Record<string, Table>, currentTable: string): {
|
56
|
+
compileMetricReference(ref: string, tables: Record<string, Table>, currentTable: string, availableParameters: string[]): {
|
57
57
|
sql: string;
|
58
58
|
tablesReferences: Set<string>;
|
59
59
|
};
|
@@ -61,8 +61,8 @@ export declare class ExploreCompiler {
|
|
61
61
|
sql: string;
|
62
62
|
tablesReferences: Set<string>;
|
63
63
|
};
|
64
|
-
compileJoin(join: ExploreJoin, tables: Record<string, Table
|
64
|
+
compileJoin(join: ExploreJoin, tables: Record<string, Table>, availableParameters: string[]): CompiledExploreJoin;
|
65
65
|
}
|
66
|
-
export declare const createDimensionWithGranularity: (dimensionName: string, baseTimeDimension: CompiledDimension, explore: Explore, warehouseSqlBuilder: WarehouseSqlBuilder, granularity: DateGranularity) => CompiledDimension;
|
66
|
+
export declare const createDimensionWithGranularity: (dimensionName: string, baseTimeDimension: CompiledDimension, explore: Explore, warehouseSqlBuilder: WarehouseSqlBuilder, granularity: DateGranularity, availableParameters: string[]) => CompiledDimension;
|
67
67
|
export {};
|
68
68
|
//# sourceMappingURL=exploreCompiler.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"exploreCompiler.d.ts","sourceRoot":"","sources":["../../../src/compiler/exploreCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,KAAK,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIH,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,MAAM,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAEH,KAAK,eAAe,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
1
|
+
{"version":3,"file":"exploreCompiler.d.ts","sourceRoot":"","sources":["../../../src/compiler/exploreCompiler.ts"],"names":[],"mappings":"A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MAAM,CAAC,CAAA;KAAE;IAwCjD,qBAAqB,CACjB,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,EAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAC9B;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;KAAE;IAkBjD,WAAW,CACP,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC7B,mBAAmB,EAAE,MAAM,EAAE,GAC9B,mBAAmB;CA8BzB;AAED,eAAO,MAAM,8BAA8B,kBACxB,MAAM,qBACF,iBAAiB,WAC3B,OAAO,uBACK,mBAAmB,eAC3B,eAAe,uBACP,MAAM,EAAE,sBA8BhC,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* Utility functions for handling SQL parameter references
|
3
3
|
*/
|
4
|
+
import type { LightdashProjectParameter } from '../types/lightdashProjectConfig';
|
4
5
|
export declare const parameterRegex: RegExp;
|
5
6
|
/**
|
6
7
|
* Extracts parameter references from SQL strings
|
@@ -8,4 +9,12 @@ export declare const parameterRegex: RegExp;
|
|
8
9
|
* @returns An array of unique parameter names referenced in the SQL
|
9
10
|
*/
|
10
11
|
export declare const getParameterReferences: (sql: string) => string[];
|
12
|
+
export declare const validateParameterReferences: (tableName: string, parameterReferences: string[], availableParameters: string[]) => void;
|
13
|
+
/**
|
14
|
+
* Get all available parameter names for a project and explore
|
15
|
+
* @param projectParameters - The project parameters
|
16
|
+
* @param exploreParameters - The explore parameters
|
17
|
+
* @returns An array of available parameter names
|
18
|
+
*/
|
19
|
+
export declare const getAvailableParameterNames: (projectParameters: Record<string, LightdashProjectParameter> | undefined, exploreParameters: Record<string, LightdashProjectParameter> | undefined) => string[];
|
11
20
|
//# sourceMappingURL=parameters.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/compiler/parameters.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/compiler/parameters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,eAAO,MAAM,cAAc,QAAmD,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAS,MAAM,KAAG,MAAM,EAc1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,cACzB,MAAM,uBACI,MAAM,EAAE,uBACR,MAAM,EAAE,SAchC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,sBAChB,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,SAAS,qBACrD,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,SAAS,KACzE,MAAM,EAGJ,CAAC"}
|