@devrev/meerkat-core 0.0.117 → 0.0.119
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/package.json +1 -1
- package/src/ast-builder/ast-builder.d.ts +0 -2
- package/src/ast-builder/ast-builder.js +6 -9
- package/src/ast-builder/ast-builder.js.map +1 -1
- package/src/cube-group-by-transformer/cube-group-by-transformer.d.ts +1 -2
- package/src/cube-group-by-transformer/cube-group-by-transformer.js +2 -2
- package/src/cube-group-by-transformer/cube-group-by-transformer.js.map +1 -1
- package/src/cube-measure-transformer/cube-measure-transformer.d.ts +2 -4
- package/src/cube-measure-transformer/cube-measure-transformer.js +9 -10
- package/src/cube-measure-transformer/cube-measure-transformer.js.map +1 -1
- package/src/cube-order-by-transformer/cube-order-by-transformer.d.ts +1 -2
- package/src/cube-order-by-transformer/cube-order-by-transformer.js +2 -2
- package/src/cube-order-by-transformer/cube-order-by-transformer.js.map +1 -1
- package/src/filter-params/filter-params-ast.d.ts +1 -2
- package/src/filter-params/filter-params-ast.js +2 -5
- package/src/filter-params/filter-params-ast.js.map +1 -1
- package/src/get-filter-params-sql/get-filter-params-sql.d.ts +1 -3
- package/src/get-filter-params-sql/get-filter-params-sql.js +2 -2
- package/src/get-filter-params-sql/get-filter-params-sql.js.map +1 -1
- package/src/get-final-base-sql/get-final-base-sql.d.ts +1 -3
- package/src/get-final-base-sql/get-final-base-sql.js +1 -3
- package/src/get-final-base-sql/get-final-base-sql.js.map +1 -1
- package/src/get-wrapped-base-query-with-projections/get-aliased-columns-from-filters.d.ts +3 -7
- package/src/get-wrapped-base-query-with-projections/get-aliased-columns-from-filters.js +6 -11
- package/src/get-wrapped-base-query-with-projections/get-aliased-columns-from-filters.js.map +1 -1
- package/src/get-wrapped-base-query-with-projections/get-projection-clause.d.ts +1 -2
- package/src/get-wrapped-base-query-with-projections/get-projection-clause.js +3 -5
- package/src/get-wrapped-base-query-with-projections/get-projection-clause.js.map +1 -1
- package/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.d.ts +1 -3
- package/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.js +2 -3
- package/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.js.map +1 -1
- package/src/joins/joins.js +99 -13
- package/src/joins/joins.js.map +1 -1
- package/src/member-formatters/get-alias.d.ts +8 -34
- package/src/member-formatters/get-alias.js +13 -47
- package/src/member-formatters/get-alias.js.map +1 -1
- package/src/member-formatters/index.d.ts +2 -2
- package/src/member-formatters/index.js.map +1 -1
- package/src/member-formatters/member-key-to-safe-key.d.ts +3 -12
- package/src/member-formatters/member-key-to-safe-key.js +3 -10
- package/src/member-formatters/member-key-to-safe-key.js.map +1 -1
- package/src/resolution/generators/generate-resolution-join-paths.js +2 -5
- package/src/resolution/generators/generate-resolution-join-paths.js.map +1 -1
- package/src/resolution/generators/generate-resolution-schemas.js +3 -4
- package/src/resolution/generators/generate-resolution-schemas.js.map +1 -1
- package/src/resolution/generators/generate-resolved-dimensions.js +2 -3
- package/src/resolution/generators/generate-resolved-dimensions.js.map +1 -1
- package/src/resolution/generators/generate-row-number-sql.js +1 -2
- package/src/resolution/generators/generate-row-number-sql.js.map +1 -1
- package/src/resolution/resolution.js +5 -13
- package/src/resolution/resolution.js.map +1 -1
- package/src/resolution/steps/apply-aliases-step.js +3 -4
- package/src/resolution/steps/apply-aliases-step.js.map +1 -1
- package/src/resolution/steps/apply-sql-overrides.js +2 -4
- package/src/resolution/steps/apply-sql-overrides.js.map +1 -1
- package/src/resolution/steps/resolution-step.js +1 -2
- package/src/resolution/steps/resolution-step.js.map +1 -1
- package/src/utils/meerkat-placeholder-replacer.d.ts +1 -2
- package/src/utils/meerkat-placeholder-replacer.js +2 -2
- package/src/utils/meerkat-placeholder-replacer.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-projection-clause.js","sourceRoot":"","sources":["../../../../meerkat-core/src/get-wrapped-base-query-with-projections/get-projection-clause.ts"],"names":[],"mappings":";;;AAAA,mGAAkG;AAClG,
|
|
1
|
+
{"version":3,"file":"get-projection-clause.js","sourceRoot":"","sources":["../../../../meerkat-core/src/get-wrapped-base-query-with-projections/get-projection-clause.ts"],"names":[],"mappings":";;;AAAA,mGAAkG;AAClG,8DAAgE;AAChE,8GAAsG;AAEtG,yFAG4C;AAC5C,yEAAuD;AAEvD,MAAM,sBAAsB,GAAG,CAAC,EAC9B,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,GAAG,GAQJ,EAAE,EAAE;IACH,IAAI,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QACxC,OAAO,GAAG,CAAC;KACZ;IACD,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CACjC,KAAY,EACZ,WAAwB,EACxB,gBAA6B,EAC7B,EAAE;IACF,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAC5C,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE;QACzD,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAA,gEAA4B,EAAC,SAAS,CAAC,CAAC;QACtE,OAAO,mBAAmB,KAAK,WAAW,CAAC,IAAI,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QACnD,MAAM,CAAC,iBAAiB,CAAC,GAAG,IAAA,gEAA4B,EAAC,OAAO,CAAC,CAAC;QAClE,OAAO,iBAAiB,KAAK,WAAW,CAAC,IAAI,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,M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eAAe,KAAK,OAAO,CAAC,IAAI,CAAC;QAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,CACV,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,qBAAqB,GAAG,IAAA,qDAA0B,EACtD,kBAAkB,EAClB,WAAW,CACZ,CAAC;IAEF,IAAI,iCAAiC,GAAG,EAAE,CAAC;IAC3C,qBAAqB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAG,IAAA,0BAAc,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACpD,iCAAiC,IAAI,GAAG,MAAM,OAAO,OAAO,EAAE,CAAC;QAC/D,IAAI,KAAK,KAAK,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9C,iCAAiC,IAAI,IAAI,CAAC;SAC3C;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG;QAClB,qBAAqB;QACrB,kBAAkB;QAClB,iCAAiC;KAClC,CAAC;IAEF,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC;AArFW,QAAA,mBAAmB,uBAqF9B"}
|
package/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { QueryOptions } from '../member-formatters/get-alias';
|
|
2
1
|
import { Query, TableSchema } from '../types/cube-types';
|
|
3
2
|
interface GetWrappedBaseQueryWithProjectionsParams {
|
|
4
3
|
baseQuery: string;
|
|
5
4
|
tableSchema: TableSchema;
|
|
6
5
|
query: Query;
|
|
7
|
-
config: QueryOptions;
|
|
8
6
|
}
|
|
9
|
-
export declare const getWrappedBaseQueryWithProjections: ({ baseQuery, tableSchema, query,
|
|
7
|
+
export declare const getWrappedBaseQueryWithProjections: ({ baseQuery, tableSchema, query, }: GetWrappedBaseQueryWithProjectionsParams) => string;
|
|
10
8
|
export {};
|
package/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.getWrappedBaseQueryWithProjections = void 0;
|
|
|
4
4
|
const cube_measure_transformer_1 = require("../cube-measure-transformer/cube-measure-transformer");
|
|
5
5
|
const get_aliased_columns_from_filters_1 = require("./get-aliased-columns-from-filters");
|
|
6
6
|
const get_projection_clause_1 = require("./get-projection-clause");
|
|
7
|
-
const getWrappedBaseQueryWithProjections = ({ baseQuery, tableSchema, query,
|
|
7
|
+
const getWrappedBaseQueryWithProjections = ({ baseQuery, tableSchema, query, }) => {
|
|
8
8
|
/*
|
|
9
9
|
* Im order to be able to filter on computed metric from a query, we need to project the computed metric in the base query.
|
|
10
10
|
* If theres filters supplied, we can safely return the original base query. Since nothing need to be projected and filtered in this case
|
|
@@ -12,14 +12,13 @@ const getWrappedBaseQueryWithProjections = ({ baseQuery, tableSchema, query, con
|
|
|
12
12
|
// Wrap the query into another 'SELECT * FROM (baseQuery) AS baseTable'' in order to project everything in the base query, and other computed metrics to be able to filter on them
|
|
13
13
|
const newBaseSql = `SELECT * FROM (${baseQuery}) AS ${tableSchema.name}`;
|
|
14
14
|
const aliasedColumnSet = new Set();
|
|
15
|
-
const memberProjections = (0, get_projection_clause_1.getProjectionClause)(query, tableSchema, aliasedColumnSet
|
|
15
|
+
const memberProjections = (0, get_projection_clause_1.getProjectionClause)(query, tableSchema, aliasedColumnSet);
|
|
16
16
|
const aliasFromFilters = (0, get_aliased_columns_from_filters_1.getAliasedColumnsFromFilters)({
|
|
17
17
|
aliasedColumnSet,
|
|
18
18
|
// setting measures to empty array, since we don't want to project measures present in the filters in the base query
|
|
19
19
|
tableSchema: tableSchema,
|
|
20
20
|
query,
|
|
21
21
|
meerkatFilters: query.filters,
|
|
22
|
-
config,
|
|
23
22
|
});
|
|
24
23
|
const parts = [aliasFromFilters, memberProjections].filter((part) => part !== '');
|
|
25
24
|
parts.push('*');
|
package/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-wrapped-base-query-with-projections.js","sourceRoot":"","sources":["../../../../meerkat-core/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.ts"],"names":[],"mappings":";;;AAAA,mGAA4F;
|
|
1
|
+
{"version":3,"file":"get-wrapped-base-query-with-projections.js","sourceRoot":"","sources":["../../../../meerkat-core/src/get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections.ts"],"names":[],"mappings":";;;AAAA,mGAA4F;AAE5F,yFAAkF;AAClF,mEAA8D;AAQvD,MAAM,kCAAkC,GAAG,CAAC,EACjD,SAAS,EACT,WAAW,EACX,KAAK,GACoC,EAAE,EAAE;IAC7C;;;OAGG;IACH,kLAAkL;IAClL,MAAM,UAAU,GAAG,kBAAkB,SAAS,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;IACzE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,MAAM,iBAAiB,GAAG,IAAA,2CAAmB,EAC3C,KAAK,EACL,WAAW,EACX,gBAAgB,CACjB,CAAC;IAEF,MAAM,gBAAgB,GAAG,IAAA,+DAA4B,EAAC;QACpD,gBAAgB;QAChB,oHAAoH;QACpH,WAAW,EAAE,WAAW;QACxB,KAAK;QACL,cAAc,EAAE,KAAK,CAAC,OAAO;KAC9B,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,MAAM,CACxD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CACtB,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChB,MAAM,yBAAyB,GAAG,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/D,MAAM,qBAAqB,GAAG,IAAA,+CAAoB,EAChD,UAAU,EACV,yBAAyB,CAC1B,CAAC;IACF,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAC;AAtCW,QAAA,kCAAkC,sCAsC7C"}
|
package/src/joins/joins.js
CHANGED
|
@@ -3,6 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCombinedTableSchema = exports.checkLoopInJoinPath = exports.createDirectedGraph = exports.generateSqlQuery = exports.parseTableColumnReference = exports.quoteIdentifierIfNeeded = void 0;
|
|
4
4
|
const get_used_table_schema_1 = require("../get-used-table-schema/get-used-table-schema");
|
|
5
5
|
const cube_types_1 = require("../types/cube-types");
|
|
6
|
+
/**
|
|
7
|
+
* Regex pattern to match a CONTAINS function call in join SQL.
|
|
8
|
+
*
|
|
9
|
+
* Matches: CONTAINS(arg1, arg2)
|
|
10
|
+
*
|
|
11
|
+
* Pattern breakdown:
|
|
12
|
+
* - ^\s* : Start of string, optional leading whitespace
|
|
13
|
+
* - CONTAINS : Literal "CONTAINS" (case-insensitive due to 'i' flag)
|
|
14
|
+
* - \s*\(\s* : Opening parenthesis with optional whitespace
|
|
15
|
+
* - (.+?) : Capture group 1 - first argument (non-greedy)
|
|
16
|
+
* - \s*,\s* : Comma separator with optional whitespace
|
|
17
|
+
* - (.+?) : Capture group 2 - second argument (non-greedy)
|
|
18
|
+
* - \s*\)\s*$ : Closing parenthesis with optional whitespace, end of string
|
|
19
|
+
*
|
|
20
|
+
* Examples that match:
|
|
21
|
+
* - "CONTAINS(table1.col, table2.col)"
|
|
22
|
+
* - " contains( table1.items , table2.id ) "
|
|
23
|
+
* - "CONTAINS(\"quoted.table\".col, other.col)"
|
|
24
|
+
*/
|
|
25
|
+
const CONTAINS_FUNCTION_REGEX = /^\s*CONTAINS\s*\(\s*(.+?)\s*,\s*(.+?)\s*\)\s*$/i;
|
|
26
|
+
/**
|
|
27
|
+
* Regex pattern to validate table.column reference format.
|
|
28
|
+
*
|
|
29
|
+
* Matches: tableName.columnName or "quotedTableName".columnName
|
|
30
|
+
* Also supports composite fields with multiple dots (e.g., table.field.subfield)
|
|
31
|
+
*
|
|
32
|
+
* Pattern breakdown:
|
|
33
|
+
* - ^ : Start of string
|
|
34
|
+
* - (?: : Non-capturing group for table name alternatives:
|
|
35
|
+
* - "[^"]+" : Quoted identifier (e.g., "table.name")
|
|
36
|
+
* - | : OR
|
|
37
|
+
* - [^.]+ : Unquoted identifier (any chars except dot)
|
|
38
|
+
* - ) : End of non-capturing group
|
|
39
|
+
* - \. : Literal dot separator
|
|
40
|
+
* - .+ : Column/field path (one or more chars, allows dots for composite fields)
|
|
41
|
+
* - $ : End of string
|
|
42
|
+
*
|
|
43
|
+
* Examples that match:
|
|
44
|
+
* - "table1.column"
|
|
45
|
+
* - "myTable.myColumn"
|
|
46
|
+
* - "\"quoted.table\".column"
|
|
47
|
+
* - "table.field.subfield" (composite field)
|
|
48
|
+
* - "table.nested.deep.field" (deeply nested composite field)
|
|
49
|
+
*
|
|
50
|
+
* Examples that do NOT match:
|
|
51
|
+
* - "just_a_column" (no dot)
|
|
52
|
+
* - ".column" (empty table name)
|
|
53
|
+
*/
|
|
54
|
+
const TABLE_COLUMN_REFERENCE_REGEX = /^(?:"[^"]+"|[^.]+)\..+$/;
|
|
6
55
|
/**
|
|
7
56
|
* Quotes an identifier if it contains dots or other special characters.
|
|
8
57
|
* Used for table aliases in SQL that may contain dots when useDotNotation is true.
|
|
@@ -94,6 +143,50 @@ function generateSqlQuery(path, tableSchemaSqlMap, directedGraph) {
|
|
|
94
143
|
exports.generateSqlQuery = generateSqlQuery;
|
|
95
144
|
const createDirectedGraph = (tableSchema, tableSchemaSqlMap) => {
|
|
96
145
|
const directedGraph = {};
|
|
146
|
+
/**
|
|
147
|
+
* Parses a join SQL condition and extracts the table and column names
|
|
148
|
+
* from each side of the binary operator.
|
|
149
|
+
*
|
|
150
|
+
* Supported forms (whitespace and case-insensitive for operators):
|
|
151
|
+
* - tableA.column = tableB.column
|
|
152
|
+
* - CONTAINS(tableA.column, tableB.column)
|
|
153
|
+
*
|
|
154
|
+
* The full, original join SQL string is still stored as the join condition
|
|
155
|
+
* in the directed graph; this helper is only responsible for figuring out
|
|
156
|
+
* which tables and columns participate in the join.
|
|
157
|
+
*/
|
|
158
|
+
function parseJoinSqlColumns(joinSql) {
|
|
159
|
+
let leftPart;
|
|
160
|
+
let rightPart;
|
|
161
|
+
const containsFnMatch = joinSql.match(CONTAINS_FUNCTION_REGEX);
|
|
162
|
+
if (containsFnMatch) {
|
|
163
|
+
leftPart = containsFnMatch[1];
|
|
164
|
+
rightPart = containsFnMatch[2];
|
|
165
|
+
// Validate that both arguments follow the table.column structure
|
|
166
|
+
if (!TABLE_COLUMN_REFERENCE_REGEX.test(leftPart.trim())) {
|
|
167
|
+
throw new Error(`Invalid CONTAINS argument: "${leftPart}". Expected format: table.column`);
|
|
168
|
+
}
|
|
169
|
+
if (!TABLE_COLUMN_REFERENCE_REGEX.test(rightPart.trim())) {
|
|
170
|
+
throw new Error(`Invalid CONTAINS argument: "${rightPart}". Expected format: table.column`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// Try equality join: tableA.col = tableB.col
|
|
175
|
+
const equalsParts = joinSql.split('=');
|
|
176
|
+
if (equalsParts.length === 2) {
|
|
177
|
+
[leftPart, rightPart] = equalsParts;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
throw new Error(`Invalid join SQL: ${joinSql}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const leftRef = parseTableColumnReference(leftPart);
|
|
184
|
+
const rightRef = parseTableColumnReference(rightPart);
|
|
185
|
+
return {
|
|
186
|
+
tables: [leftRef.tableName, rightRef.tableName],
|
|
187
|
+
conditions: [leftRef.columnName, rightRef.columnName],
|
|
188
|
+
};
|
|
189
|
+
}
|
|
97
190
|
function addEdge(table1, table2, joinOn, joinCondition) {
|
|
98
191
|
if (table1 === table2 ||
|
|
99
192
|
(directedGraph[table1] &&
|
|
@@ -110,25 +203,18 @@ const createDirectedGraph = (tableSchema, tableSchemaSqlMap) => {
|
|
|
110
203
|
/**
|
|
111
204
|
* Iterate through the table schema and add the edges to the directed graph.
|
|
112
205
|
* The edges are added based on the join conditions provided in the table schema.
|
|
113
|
-
* The SQL is
|
|
206
|
+
* The SQL is parsed to extract the tables and columns involved in the joins,
|
|
207
|
+
* supporting both '=' equality joins and CONTAINS(arg1, arg2) function syntax.
|
|
114
208
|
* The tables are then added as edges to the directed graph.
|
|
115
209
|
* Supports quoted identifiers for table names that contain dots (e.g., "table.name".column).
|
|
116
210
|
*/
|
|
117
211
|
tableSchema.forEach((schema) => {
|
|
118
212
|
var _a;
|
|
119
213
|
(_a = schema === null || schema === void 0 ? void 0 : schema.joins) === null || _a === void 0 ? void 0 : _a.forEach((join) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (parts.length !== 2) {
|
|
125
|
-
throw new Error(`Invalid join SQL: ${join.sql}`);
|
|
126
|
-
}
|
|
127
|
-
// Parse the table and column from each side of the join condition
|
|
128
|
-
const leftRef = parseTableColumnReference(parts[0]);
|
|
129
|
-
const rightRef = parseTableColumnReference(parts[1]);
|
|
130
|
-
const tables = [leftRef.tableName, rightRef.tableName];
|
|
131
|
-
const conditions = [leftRef.columnName, rightRef.columnName];
|
|
214
|
+
// Parse the table and column from each side of the join condition.
|
|
215
|
+
// Supports both equality joins (tableA.col = tableB.col) and
|
|
216
|
+
// CONTAINS-style joins (tableA.col contains tableB.col).
|
|
217
|
+
const { tables, conditions } = parseJoinSqlColumns(join.sql);
|
|
132
218
|
/**
|
|
133
219
|
* If the tables are the same, then the join is invalid.
|
|
134
220
|
*/
|
package/src/joins/joins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joins.js","sourceRoot":"","sources":["../../../../meerkat-core/src/joins/joins.ts"],"names":[],"mappings":";;;A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AM,CAAC,UAAU,CAAC;YACrD,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC,EACD;QACE,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,KAAK,EAAE,EAAE;KACV,CACF,CAAC;IACF,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAC;AA5DW,QAAA,sBAAsB,0BA4DjC"}
|
|
@@ -1,72 +1,50 @@
|
|
|
1
1
|
import { TableSchema } from '../types/cube-types';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for query options.
|
|
4
|
-
*/
|
|
5
|
-
export interface QueryOptions {
|
|
6
|
-
/**
|
|
7
|
-
* When true, uses dot notation for aliases: "orders.customer_id"
|
|
8
|
-
* When false, uses underscore notation: orders__customer_id
|
|
9
|
-
*/
|
|
10
|
-
useDotNotation: boolean;
|
|
11
|
-
}
|
|
12
2
|
/**
|
|
13
3
|
* Get alias for SQL string contexts (SELECT projections, etc.).
|
|
14
4
|
* Always returns a properly quoted alias when needed.
|
|
15
5
|
*
|
|
16
6
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
17
7
|
* @param tableSchema - The table schema to look up custom aliases from
|
|
18
|
-
* @param config - Configuration with useDotNotation flag
|
|
19
8
|
* @returns The alias string, quoted when necessary
|
|
20
9
|
*
|
|
21
10
|
* @example
|
|
22
11
|
* ```typescript
|
|
23
|
-
*
|
|
24
|
-
* getAliasForSQL("orders.total", schema, { useDotNotation: false }) // "orders__total"
|
|
25
|
-
*
|
|
26
|
-
* // With useDotNotation: true
|
|
27
|
-
* getAliasForSQL("orders.total", schema, { useDotNotation: true }) // "\"orders.total\""
|
|
12
|
+
* getAliasForSQL("orders.total", schema) // "orders__total"
|
|
28
13
|
* ```
|
|
29
14
|
*/
|
|
30
|
-
export declare const getAliasForSQL: (name: string, tableSchema: TableSchema
|
|
15
|
+
export declare const getAliasForSQL: (name: string, tableSchema: TableSchema) => string;
|
|
31
16
|
/**
|
|
32
17
|
* Get alias for AST contexts (DuckDB AST nodes, column references).
|
|
33
18
|
* Returns unquoted alias - DuckDB handles quoting automatically.
|
|
34
19
|
*
|
|
35
20
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
36
21
|
* @param tableSchema - The table schema to look up custom aliases from
|
|
37
|
-
* @param config - Configuration with useDotNotation flag
|
|
38
22
|
* @returns The alias string, unquoted
|
|
39
23
|
*
|
|
40
24
|
* @example
|
|
41
25
|
* ```typescript
|
|
42
|
-
*
|
|
43
|
-
* getAliasForAST("orders.total", schema, { useDotNotation: false }) // "orders__total"
|
|
44
|
-
*
|
|
45
|
-
* // With useDotNotation: true
|
|
46
|
-
* getAliasForAST("orders.total", schema, { useDotNotation: true }) // "orders.total"
|
|
26
|
+
* getAliasForAST("orders.total", schema) // "orders__total"
|
|
47
27
|
* ```
|
|
48
28
|
*/
|
|
49
|
-
export declare const getAliasForAST: (name: string, tableSchema: TableSchema
|
|
29
|
+
export declare const getAliasForAST: (name: string, tableSchema: TableSchema) => string;
|
|
50
30
|
/**
|
|
51
31
|
* Construct alias for SQL string contexts directly from name and optional custom alias.
|
|
52
32
|
* Always returns a properly quoted alias when needed.
|
|
53
33
|
*
|
|
54
34
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
55
35
|
* @param alias - Optional custom alias override
|
|
56
|
-
* @param config - Configuration with useDotNotation flag
|
|
57
36
|
* @returns The alias string, quoted when necessary
|
|
58
37
|
*/
|
|
59
|
-
export declare const constructAliasForSQL: (name: string, alias: string | undefined
|
|
38
|
+
export declare const constructAliasForSQL: (name: string, alias: string | undefined) => string;
|
|
60
39
|
/**
|
|
61
40
|
* Construct alias for AST contexts directly from name and optional custom alias.
|
|
62
41
|
* Returns unquoted alias - DuckDB handles quoting automatically.
|
|
63
42
|
*
|
|
64
43
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
65
44
|
* @param alias - Optional custom alias override
|
|
66
|
-
* @param config - Configuration with useDotNotation flag
|
|
67
45
|
* @returns The alias string, unquoted
|
|
68
46
|
*/
|
|
69
|
-
export declare const constructAliasForAST: (name: string, alias: string | undefined
|
|
47
|
+
export declare const constructAliasForAST: (name: string, alias: string | undefined) => string;
|
|
70
48
|
/**
|
|
71
49
|
* Get alias for a schema field.
|
|
72
50
|
*
|
|
@@ -75,15 +53,13 @@ export declare const constructAliasForAST: (name: string, alias: string | undefi
|
|
|
75
53
|
* @param shouldWrapAliasWithQuotes - When true, wraps alias in quotes for SQL validity.
|
|
76
54
|
* Use `true` for SELECT projections where special characters need quoting.
|
|
77
55
|
* Use `false` for AST nodes (DuckDB auto-quotes) and internal schema references.
|
|
78
|
-
* @param config - Configuration with useDotNotation flag
|
|
79
56
|
*
|
|
80
57
|
* @deprecated Use `getAliasForSQL` or `getAliasForAST` instead for clearer intent.
|
|
81
58
|
*/
|
|
82
|
-
export declare const getAliasFromSchema: ({ name, tableSchema, shouldWrapAliasWithQuotes,
|
|
59
|
+
export declare const getAliasFromSchema: ({ name, tableSchema, shouldWrapAliasWithQuotes, }: {
|
|
83
60
|
name: string;
|
|
84
61
|
tableSchema: TableSchema;
|
|
85
62
|
shouldWrapAliasWithQuotes: boolean;
|
|
86
|
-
config: QueryOptions;
|
|
87
63
|
}) => string;
|
|
88
64
|
/**
|
|
89
65
|
* Construct alias directly from name and optional custom alias.
|
|
@@ -93,15 +69,13 @@ export declare const getAliasFromSchema: ({ name, tableSchema, shouldWrapAliasWi
|
|
|
93
69
|
* @param shouldWrapAliasWithQuotes - When true, wraps alias in quotes for SQL validity.
|
|
94
70
|
* Use `true` for SELECT projections where special characters need quoting.
|
|
95
71
|
* Use `false` for AST nodes (DuckDB auto-quotes) and internal schema references.
|
|
96
|
-
* @param config - Configuration with useDotNotation flag
|
|
97
72
|
*
|
|
98
73
|
* @deprecated Use `constructAliasForSQL` or `constructAliasForAST` instead for clearer intent.
|
|
99
74
|
*/
|
|
100
|
-
export declare const constructAlias: ({ name, alias, shouldWrapAliasWithQuotes,
|
|
75
|
+
export declare const constructAlias: ({ name, alias, shouldWrapAliasWithQuotes, }: {
|
|
101
76
|
name: string;
|
|
102
77
|
alias?: string | undefined;
|
|
103
78
|
shouldWrapAliasWithQuotes: boolean;
|
|
104
|
-
config: QueryOptions;
|
|
105
79
|
}) => string;
|
|
106
80
|
/**
|
|
107
81
|
* Creates a compound alias by joining two alias strings with " - ".
|
|
@@ -4,31 +4,23 @@ exports.constructCompoundAlias = exports.constructAlias = exports.getAliasFromSc
|
|
|
4
4
|
const find_in_table_schema_1 = require("../utils/find-in-table-schema");
|
|
5
5
|
const member_key_to_safe_key_1 = require("./member-key-to-safe-key");
|
|
6
6
|
const split_into_data_source_and_fields_1 = require("./split-into-data-source-and-fields");
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// NEW FLAG-AWARE API (recommended)
|
|
9
|
-
// ============================================================================
|
|
10
7
|
/**
|
|
11
8
|
* Get alias for SQL string contexts (SELECT projections, etc.).
|
|
12
9
|
* Always returns a properly quoted alias when needed.
|
|
13
10
|
*
|
|
14
11
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
15
12
|
* @param tableSchema - The table schema to look up custom aliases from
|
|
16
|
-
* @param config - Configuration with useDotNotation flag
|
|
17
13
|
* @returns The alias string, quoted when necessary
|
|
18
14
|
*
|
|
19
15
|
* @example
|
|
20
16
|
* ```typescript
|
|
21
|
-
*
|
|
22
|
-
* getAliasForSQL("orders.total", schema, { useDotNotation: false }) // "orders__total"
|
|
23
|
-
*
|
|
24
|
-
* // With useDotNotation: true
|
|
25
|
-
* getAliasForSQL("orders.total", schema, { useDotNotation: true }) // "\"orders.total\""
|
|
17
|
+
* getAliasForSQL("orders.total", schema) // "orders__total"
|
|
26
18
|
* ```
|
|
27
19
|
*/
|
|
28
|
-
const getAliasForSQL = (name, tableSchema
|
|
20
|
+
const getAliasForSQL = (name, tableSchema) => {
|
|
29
21
|
var _a;
|
|
30
22
|
const [, field] = (0, split_into_data_source_and_fields_1.splitIntoDataSourceAndFields)(name);
|
|
31
|
-
return (0, exports.constructAliasForSQL)(name, (_a = (0, find_in_table_schema_1.findInSchema)(field, tableSchema)) === null || _a === void 0 ? void 0 : _a.alias
|
|
23
|
+
return (0, exports.constructAliasForSQL)(name, (_a = (0, find_in_table_schema_1.findInSchema)(field, tableSchema)) === null || _a === void 0 ? void 0 : _a.alias);
|
|
32
24
|
};
|
|
33
25
|
exports.getAliasForSQL = getAliasForSQL;
|
|
34
26
|
/**
|
|
@@ -37,22 +29,17 @@ exports.getAliasForSQL = getAliasForSQL;
|
|
|
37
29
|
*
|
|
38
30
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
39
31
|
* @param tableSchema - The table schema to look up custom aliases from
|
|
40
|
-
* @param config - Configuration with useDotNotation flag
|
|
41
32
|
* @returns The alias string, unquoted
|
|
42
33
|
*
|
|
43
34
|
* @example
|
|
44
35
|
* ```typescript
|
|
45
|
-
*
|
|
46
|
-
* getAliasForAST("orders.total", schema, { useDotNotation: false }) // "orders__total"
|
|
47
|
-
*
|
|
48
|
-
* // With useDotNotation: true
|
|
49
|
-
* getAliasForAST("orders.total", schema, { useDotNotation: true }) // "orders.total"
|
|
36
|
+
* getAliasForAST("orders.total", schema) // "orders__total"
|
|
50
37
|
* ```
|
|
51
38
|
*/
|
|
52
|
-
const getAliasForAST = (name, tableSchema
|
|
39
|
+
const getAliasForAST = (name, tableSchema) => {
|
|
53
40
|
var _a;
|
|
54
41
|
const [, field] = (0, split_into_data_source_and_fields_1.splitIntoDataSourceAndFields)(name);
|
|
55
|
-
return (0, exports.constructAliasForAST)(name, (_a = (0, find_in_table_schema_1.findInSchema)(field, tableSchema)) === null || _a === void 0 ? void 0 : _a.alias
|
|
42
|
+
return (0, exports.constructAliasForAST)(name, (_a = (0, find_in_table_schema_1.findInSchema)(field, tableSchema)) === null || _a === void 0 ? void 0 : _a.alias);
|
|
56
43
|
};
|
|
57
44
|
exports.getAliasForAST = getAliasForAST;
|
|
58
45
|
/**
|
|
@@ -61,23 +48,15 @@ exports.getAliasForAST = getAliasForAST;
|
|
|
61
48
|
*
|
|
62
49
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
63
50
|
* @param alias - Optional custom alias override
|
|
64
|
-
* @param config - Configuration with useDotNotation flag
|
|
65
51
|
* @returns The alias string, quoted when necessary
|
|
66
52
|
*/
|
|
67
|
-
const constructAliasForSQL = (name, alias
|
|
53
|
+
const constructAliasForSQL = (name, alias) => {
|
|
68
54
|
if (alias) {
|
|
69
55
|
// Custom aliases always need quotes in SQL context (may contain spaces/special chars)
|
|
70
56
|
return `"${alias}"`;
|
|
71
57
|
}
|
|
72
|
-
const safeKey = (0, member_key_to_safe_key_1.memberKeyToSafeKey)(name, {
|
|
73
|
-
useDotNotation: config.useDotNotation,
|
|
74
|
-
});
|
|
75
|
-
if (config.useDotNotation) {
|
|
76
|
-
// With dot notation, we need to quote the safe key since it contains dots
|
|
77
|
-
return `"${safeKey}"`;
|
|
78
|
-
}
|
|
79
58
|
// Underscore notation doesn't need quotes
|
|
80
|
-
return
|
|
59
|
+
return (0, member_key_to_safe_key_1.memberKeyToSafeKey)(name);
|
|
81
60
|
};
|
|
82
61
|
exports.constructAliasForSQL = constructAliasForSQL;
|
|
83
62
|
/**
|
|
@@ -86,21 +65,17 @@ exports.constructAliasForSQL = constructAliasForSQL;
|
|
|
86
65
|
*
|
|
87
66
|
* @param name - The member key (e.g., "orders.total_amount")
|
|
88
67
|
* @param alias - Optional custom alias override
|
|
89
|
-
* @param config - Configuration with useDotNotation flag
|
|
90
68
|
* @returns The alias string, unquoted
|
|
91
69
|
*/
|
|
92
|
-
const constructAliasForAST = (name, alias
|
|
70
|
+
const constructAliasForAST = (name, alias) => {
|
|
93
71
|
if (alias) {
|
|
94
72
|
// Return custom alias without quotes - DuckDB will handle quoting
|
|
95
73
|
return alias;
|
|
96
74
|
}
|
|
97
75
|
// Return safe key without quotes - DuckDB will handle quoting
|
|
98
|
-
return (0, member_key_to_safe_key_1.memberKeyToSafeKey)(name
|
|
76
|
+
return (0, member_key_to_safe_key_1.memberKeyToSafeKey)(name);
|
|
99
77
|
};
|
|
100
78
|
exports.constructAliasForAST = constructAliasForAST;
|
|
101
|
-
// ============================================================================
|
|
102
|
-
// LEGACY API (deprecated, kept for backward compatibility)
|
|
103
|
-
// ============================================================================
|
|
104
79
|
/**
|
|
105
80
|
* Get alias for a schema field.
|
|
106
81
|
*
|
|
@@ -109,18 +84,16 @@ exports.constructAliasForAST = constructAliasForAST;
|
|
|
109
84
|
* @param shouldWrapAliasWithQuotes - When true, wraps alias in quotes for SQL validity.
|
|
110
85
|
* Use `true` for SELECT projections where special characters need quoting.
|
|
111
86
|
* Use `false` for AST nodes (DuckDB auto-quotes) and internal schema references.
|
|
112
|
-
* @param config - Configuration with useDotNotation flag
|
|
113
87
|
*
|
|
114
88
|
* @deprecated Use `getAliasForSQL` or `getAliasForAST` instead for clearer intent.
|
|
115
89
|
*/
|
|
116
|
-
const getAliasFromSchema = ({ name, tableSchema, shouldWrapAliasWithQuotes,
|
|
90
|
+
const getAliasFromSchema = ({ name, tableSchema, shouldWrapAliasWithQuotes, }) => {
|
|
117
91
|
var _a;
|
|
118
92
|
const [, field] = (0, split_into_data_source_and_fields_1.splitIntoDataSourceAndFields)(name);
|
|
119
93
|
return (0, exports.constructAlias)({
|
|
120
94
|
name,
|
|
121
95
|
alias: (_a = (0, find_in_table_schema_1.findInSchema)(field, tableSchema)) === null || _a === void 0 ? void 0 : _a.alias,
|
|
122
96
|
shouldWrapAliasWithQuotes,
|
|
123
|
-
config,
|
|
124
97
|
});
|
|
125
98
|
};
|
|
126
99
|
exports.getAliasFromSchema = getAliasFromSchema;
|
|
@@ -132,11 +105,10 @@ exports.getAliasFromSchema = getAliasFromSchema;
|
|
|
132
105
|
* @param shouldWrapAliasWithQuotes - When true, wraps alias in quotes for SQL validity.
|
|
133
106
|
* Use `true` for SELECT projections where special characters need quoting.
|
|
134
107
|
* Use `false` for AST nodes (DuckDB auto-quotes) and internal schema references.
|
|
135
|
-
* @param config - Configuration with useDotNotation flag
|
|
136
108
|
*
|
|
137
109
|
* @deprecated Use `constructAliasForSQL` or `constructAliasForAST` instead for clearer intent.
|
|
138
110
|
*/
|
|
139
|
-
const constructAlias = ({ name, alias, shouldWrapAliasWithQuotes,
|
|
111
|
+
const constructAlias = ({ name, alias, shouldWrapAliasWithQuotes, }) => {
|
|
140
112
|
if (alias) {
|
|
141
113
|
if (shouldWrapAliasWithQuotes) {
|
|
142
114
|
// Alias may contain special characters or spaces, so we need to wrap in quotes.
|
|
@@ -144,13 +116,7 @@ const constructAlias = ({ name, alias, shouldWrapAliasWithQuotes, config, }) =>
|
|
|
144
116
|
}
|
|
145
117
|
return alias;
|
|
146
118
|
}
|
|
147
|
-
|
|
148
|
-
const safeKey = (0, member_key_to_safe_key_1.memberKeyToSafeKey)(name, config);
|
|
149
|
-
if (config.useDotNotation && shouldWrapAliasWithQuotes) {
|
|
150
|
-
// With dot notation and SQL context, wrap in quotes
|
|
151
|
-
return `"${safeKey}"`;
|
|
152
|
-
}
|
|
153
|
-
return safeKey;
|
|
119
|
+
return (0, member_key_to_safe_key_1.memberKeyToSafeKey)(name);
|
|
154
120
|
};
|
|
155
121
|
exports.constructAlias = constructAlias;
|
|
156
122
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-alias.js","sourceRoot":"","sources":["../../../../meerkat-core/src/member-formatters/get-alias.ts"],"names":[],"mappings":";;;AACA,wEAA6D;AAC7D,qEAA8D;AAC9D,2FAAmF;
|
|
1
|
+
{"version":3,"file":"get-alias.js","sourceRoot":"","sources":["../../../../meerkat-core/src/member-formatters/get-alias.ts"],"names":[],"mappings":";;;AACA,wEAA6D;AAC7D,qEAA8D;AAC9D,2FAAmF;AAEnF;;;;;;;;;;;;GAYG;AACI,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,WAAwB,EAAU,EAAE;;IAC/E,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,IAAA,gEAA4B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,CAAC,CAAC;IACrD,OAAO,IAAA,sBAAc,EAAC;QACpB,IAAI;QACJ,KAAK,EAAE,MAAA,IAAA,mCAAY,EAAC,KAAK,EAAE,WAAW,CAAC,0CAAE,KAAK;QAC9C,yBAAyB;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B;AAEF;;;;;;;;;;GAUG;AACI,MAAM,cAAc,GAAG,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,yBAAyB,GAK1B,EAAU,EAAE;IACX,IAAI,KAAK,EAAE;QACT,IAAI,yBAAyB,EAAE;YAC7B,gFAAgF;YAChF,OAAO,IAAI,KAAK,GAAG,CAAC;SACrB;QACD,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAA,2CAAkB,EAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB;AAEF;;;;;;;;;;;;;GAaG;AACI,MAAM,sBAAsB,GAAG,CACpC,SAAiB,EACjB,eAAuB,EACf,EAAE;IACV,OAAO,GAAG,SAAS,MAAM,eAAe,EAAE,CAAC;AAC7C,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { COLUMN_NAME_DELIMITER, MEERKAT_OUTPUT_DELIMITER } from './constants';
|
|
2
|
-
export { constructAlias, constructAliasForAST, constructAliasForSQL, constructCompoundAlias, getAliasForAST, getAliasForSQL, getAliasFromSchema,
|
|
2
|
+
export { constructAlias, constructAliasForAST, constructAliasForSQL, constructCompoundAlias, getAliasForAST, getAliasForSQL, getAliasFromSchema, } from './get-alias';
|
|
3
3
|
export { getNamespacedKey } from './get-namespaced-key';
|
|
4
|
-
export { memberKeyToSafeKey
|
|
4
|
+
export { memberKeyToSafeKey } from './member-key-to-safe-key';
|
|
5
5
|
export { splitIntoDataSourceAndFields } from './split-into-data-source-and-fields';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../meerkat-core/src/member-formatters/index.ts"],"names":[],"mappings":";;;AAAA,yCAA8E;AAArE,kHAAA,qBAAqB,OAAA;AAAE,qHAAA,wBAAwB,OAAA;AACxD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../meerkat-core/src/member-formatters/index.ts"],"names":[],"mappings":";;;AAAA,yCAA8E;AAArE,kHAAA,qBAAqB,OAAA;AAAE,qHAAA,wBAAwB,OAAA;AACxD,yCAQqB;AAPnB,2GAAA,cAAc,OAAA;AACd,iHAAA,oBAAoB,OAAA;AACpB,iHAAA,oBAAoB,OAAA;AACpB,mHAAA,sBAAsB,OAAA;AACtB,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAEpB,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,yFAAmF;AAA1E,iJAAA,4BAA4B,OAAA"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
export interface MemberKeyToSafeKeyOptions {
|
|
2
|
-
/**
|
|
3
|
-
* When true, keeps the dot notation (returns memberKey as-is).
|
|
4
|
-
* When false (default), converts dots to underscores for SQL-safe identifiers.
|
|
5
|
-
*/
|
|
6
|
-
useDotNotation: boolean;
|
|
7
|
-
}
|
|
8
1
|
/**
|
|
9
2
|
* Converts a member key to a safe key for use in SQL.
|
|
3
|
+
* Converts dots to double underscores for SQL-safe identifiers.
|
|
10
4
|
*
|
|
11
5
|
* @param memberKey - The member key (e.g., "orders.customer_id")
|
|
12
|
-
* @
|
|
13
|
-
* @returns The safe key:
|
|
14
|
-
* - With useDotNotation=true: "orders.customer_id" (unchanged)
|
|
15
|
-
* - With useDotNotation=false (default): "orders__customer_id"
|
|
6
|
+
* @returns The safe key (e.g., "orders__customer_id")
|
|
16
7
|
*/
|
|
17
|
-
export declare const memberKeyToSafeKey: (memberKey: string
|
|
8
|
+
export declare const memberKeyToSafeKey: (memberKey: string) => string;
|
|
@@ -4,19 +4,12 @@ exports.memberKeyToSafeKey = void 0;
|
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
/**
|
|
6
6
|
* Converts a member key to a safe key for use in SQL.
|
|
7
|
+
* Converts dots to double underscores for SQL-safe identifiers.
|
|
7
8
|
*
|
|
8
9
|
* @param memberKey - The member key (e.g., "orders.customer_id")
|
|
9
|
-
* @
|
|
10
|
-
* @returns The safe key:
|
|
11
|
-
* - With useDotNotation=true: "orders.customer_id" (unchanged)
|
|
12
|
-
* - With useDotNotation=false (default): "orders__customer_id"
|
|
10
|
+
* @returns The safe key (e.g., "orders__customer_id")
|
|
13
11
|
*/
|
|
14
|
-
const memberKeyToSafeKey = (memberKey
|
|
15
|
-
if (options.useDotNotation) {
|
|
16
|
-
// Keep dot notation - the caller is responsible for quoting when needed
|
|
17
|
-
return memberKey;
|
|
18
|
-
}
|
|
19
|
-
// Legacy behavior: convert dots to double underscores
|
|
12
|
+
const memberKeyToSafeKey = (memberKey) => {
|
|
20
13
|
return memberKey.split(constants_1.COLUMN_NAME_DELIMITER).join(constants_1.MEERKAT_OUTPUT_DELIMITER);
|
|
21
14
|
};
|
|
22
15
|
exports.memberKeyToSafeKey = memberKeyToSafeKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-key-to-safe-key.js","sourceRoot":"","sources":["../../../../meerkat-core/src/member-formatters/member-key-to-safe-key.ts"],"names":[],"mappings":";;;AAAA,2CAA8E;
|
|
1
|
+
{"version":3,"file":"member-key-to-safe-key.js","sourceRoot":"","sources":["../../../../meerkat-core/src/member-formatters/member-key-to-safe-key.ts"],"names":[],"mappings":";;;AAAA,2CAA8E;AAE9E;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC9D,OAAO,SAAS,CAAC,KAAK,CAAC,iCAAqB,CAAC,CAAC,IAAI,CAAC,oCAAwB,CAAC,CAAC;AAC/E,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B"}
|
|
@@ -5,16 +5,13 @@ const get_alias_1 = require("../../member-formatters/get-alias");
|
|
|
5
5
|
const member_key_to_safe_key_1 = require("../../member-formatters/member-key-to-safe-key");
|
|
6
6
|
const find_in_table_schema_1 = require("../../utils/find-in-table-schema");
|
|
7
7
|
const generateResolutionJoinPaths = (baseDataSourceName, resolutionConfig, baseTableSchemas) => {
|
|
8
|
-
const config = { useDotNotation: false };
|
|
9
8
|
return resolutionConfig.columnConfigs.map((columnConfig) => {
|
|
10
9
|
var _a;
|
|
11
10
|
return [
|
|
12
11
|
{
|
|
13
12
|
left: baseDataSourceName,
|
|
14
|
-
right: (0, member_key_to_safe_key_1.memberKeyToSafeKey)(columnConfig.name,
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
on: (0, get_alias_1.constructAliasForAST)(columnConfig.name, (_a = (0, find_in_table_schema_1.findInSchemas)(columnConfig.name, baseTableSchemas)) === null || _a === void 0 ? void 0 : _a.alias, config),
|
|
13
|
+
right: (0, member_key_to_safe_key_1.memberKeyToSafeKey)(columnConfig.name),
|
|
14
|
+
on: (0, get_alias_1.constructAliasForAST)(columnConfig.name, (_a = (0, find_in_table_schema_1.findInSchemas)(columnConfig.name, baseTableSchemas)) === null || _a === void 0 ? void 0 : _a.alias),
|
|
18
15
|
},
|
|
19
16
|
];
|
|
20
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-resolution-join-paths.js","sourceRoot":"","sources":["../../../../../meerkat-core/src/resolution/generators/generate-resolution-join-paths.ts"],"names":[],"mappings":";;;AAAA,iEAAyE;AACzE,2FAAoF;AAGpF,2EAAiE;AAG1D,MAAM,2BAA2B,GAAG,CACzC,kBAA0B,EAC1B,gBAAkC,EAClC,gBAA+B,EACnB,EAAE;IACd,
|
|
1
|
+
{"version":3,"file":"generate-resolution-join-paths.js","sourceRoot":"","sources":["../../../../../meerkat-core/src/resolution/generators/generate-resolution-join-paths.ts"],"names":[],"mappings":";;;AAAA,iEAAyE;AACzE,2FAAoF;AAGpF,2EAAiE;AAG1D,MAAM,2BAA2B,GAAG,CACzC,kBAA0B,EAC1B,gBAAkC,EAClC,gBAA+B,EACnB,EAAE;IACd,OAAO,gBAAgB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;;QAAC,OAAA;YAC1D;gBACE,IAAI,EAAE,kBAAkB;gBACxB,KAAK,EAAE,IAAA,2CAAkB,EAAC,YAAY,CAAC,IAAI,CAAC;gBAC5C,EAAE,EAAE,IAAA,gCAAoB,EACtB,YAAY,CAAC,IAAI,EACjB,MAAA,IAAA,oCAAa,EAAC,YAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC,0CAAE,KAAK,CAC1D;aACF;SACF,CAAA;KAAA,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,2BAA2B,+BAetC"}
|