@devrev/meerkat-node 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/__fixtures__/test-data.js +1 -5
- package/__fixtures__/test-data.js.map +1 -1
- package/cube-to-sql/cube-to-sql.js +5 -8
- package/cube-to-sql/cube-to-sql.js.map +1 -1
- package/cube-to-sql-with-resolution/cube-to-sql-with-resolution.js +7 -22
- package/cube-to-sql-with-resolution/cube-to-sql-with-resolution.js.map +1 -1
- package/package.json +2 -2
- package/src/__fixtures__/test-data.d.ts +2 -402
- package/src/cube-to-sql/cube-to-sql.d.ts +2 -8
- package/__fixtures__/with-dot-alias.js +0 -1365
- package/__fixtures__/with-dot-alias.js.map +0 -1
- package/src/__fixtures__/with-dot-alias.d.ts +0 -397
|
@@ -20,7 +20,6 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _testdatawithsafealias = require("./test-data-with-safe-alias");
|
|
23
|
-
const _withdotalias = require("./with-dot-alias");
|
|
24
23
|
const CREATE_TEST_TABLE = `
|
|
25
24
|
CREATE TABLE orders (
|
|
26
25
|
order_id INTEGER,
|
|
@@ -96,10 +95,7 @@ const TABLE_SCHEMA = {
|
|
|
96
95
|
}
|
|
97
96
|
]
|
|
98
97
|
};
|
|
99
|
-
const getTestData = (
|
|
100
|
-
if (useSafeAlias) {
|
|
101
|
-
return _withdotalias.WITH_DOT_ALIAS_TEST_DATA;
|
|
102
|
-
}
|
|
98
|
+
const getTestData = ()=>{
|
|
103
99
|
return _testdatawithsafealias.TEST_DATA_WITH_SAFE_ALIAS;
|
|
104
100
|
};
|
|
105
101
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meerkat-node/src/__fixtures__/test-data.ts"],"sourcesContent":["import { TEST_DATA_WITH_SAFE_ALIAS } from './test-data-with-safe-alias';\
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/__fixtures__/test-data.ts"],"sourcesContent":["import { TEST_DATA_WITH_SAFE_ALIAS } from './test-data-with-safe-alias';\n\nexport const CREATE_TEST_TABLE = `\nCREATE TABLE orders (\n order_id INTEGER,\n customer_id VARCHAR,\n product_id VARCHAR,\n order_date DATE,\n order_amount FLOAT,\n vendors VARCHAR[]\n);\n`;\n\nexport const INPUT_DATA_QUERY = `\nINSERT INTO orders VALUES\n(1, '1', '1', '2022-01-01', 50, ['myntra', 'amazon', 'flipkart']),\n(2, '1', '2', '2022-01-02', 80, ['myntra']),\n(3, '2', '3', '2022-02-01', 25, []),\n(4, '2', '1', '2022-03-01', 75, ['flipkart']),\n(5, '3', '1', '2022-03-02', 100, ['myntra', 'amazon', 'flipkart']),\n(6, '4', '2', '2022-04-01', 45, []),\n(7, '4', '3', '2022-05-01', 90, ['myntra', 'flipkart']),\n(8, '5', '1', '2022-05-02', 65, ['amazon', 'flipkart']),\n(9, '5', '2', '2022-05-05', 85, []),\n(10, '6', '3', '2022-06-01', 120, ['myntra', 'amazon']),\n(11, '6aa6', '3', '2024-06-01', 0, ['amazon']),\n(12, NULL, '3', '2024-07-01', 100, ['flipkart']),\n(13, '7', '6', '2024-08-01', 100, ['swiggy''s']),\n(14, '8', '1', '2024-09-01', 50, NULL);\n`;\n\nexport const TABLE_SCHEMA = {\n name: 'orders',\n sql: 'select * from orders',\n measures: [\n {\n name: 'order_amount',\n sql: 'order_amount',\n type: 'number',\n },\n {\n name: 'total_order_amount',\n sql: 'SUM(order_amount)',\n type: 'number',\n },\n ],\n dimensions: [\n {\n name: 'order_date',\n sql: 'order_date',\n type: 'time',\n },\n {\n name: 'order_id',\n sql: 'order_id',\n type: 'number',\n },\n {\n name: 'customer_id',\n sql: 'customer_id',\n type: 'string',\n },\n {\n name: 'product_id',\n sql: 'product_id',\n type: 'string',\n },\n {\n name: 'order_month',\n sql: `DATE_TRUNC('month', order_date)`,\n type: 'string',\n },\n {\n name: 'vendors',\n sql: 'vendors',\n type: 'string_array',\n },\n ],\n};\n\n/**\n * Get test data with underscore notation aliases (e.g., orders__customer_id)\n */\nexport const getTestData = () => {\n return TEST_DATA_WITH_SAFE_ALIAS;\n};\n"],"names":["CREATE_TEST_TABLE","INPUT_DATA_QUERY","TABLE_SCHEMA","getTestData","name","sql","measures","type","dimensions","TEST_DATA_WITH_SAFE_ALIAS"],"mappings":";;;;;;;;IAEaA,iBAAiB;eAAjBA;;IAWAC,gBAAgB;eAAhBA;;IAkBAC,YAAY;eAAZA;;IAoDAC,WAAW;eAAXA;;;uCAnF6B;AAEnC,MAAMH,oBAAoB,CAAC;;;;;;;;;AASlC,CAAC;AAEM,MAAMC,mBAAmB,CAAC;;;;;;;;;;;;;;;;AAgBjC,CAAC;AAEM,MAAMC,eAAe;IAC1BE,MAAM;IACNC,KAAK;IACLC,UAAU;QACR;YACEF,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;KACD;IACDC,YAAY;QACV;YACEJ,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK,CAAC,+BAA+B,CAAC;YACtCE,MAAM;QACR;QACA;YACEH,MAAM;YACNC,KAAK;YACLE,MAAM;QACR;KACD;AACH;AAKO,MAAMJ,cAAc;IACzB,OAAOM,gDAAyB;AAClC"}
|
|
@@ -8,13 +8,12 @@ Object.defineProperty(exports, "cubeQueryToSQL", {
|
|
|
8
8
|
const _extends = require("@swc/helpers/_/_extends");
|
|
9
9
|
const _meerkatcore = require("@devrev/meerkat-core");
|
|
10
10
|
const _duckdbexec = require("../duckdb-exec");
|
|
11
|
-
const cubeQueryToSQL = async ({ query, tableSchemas, contextParams
|
|
11
|
+
const cubeQueryToSQL = async ({ query, tableSchemas, contextParams })=>{
|
|
12
12
|
const updatedTableSchemas = await Promise.all(tableSchemas.map(async (schema)=>{
|
|
13
13
|
const baseFilterParamsSQL = await (0, _meerkatcore.getFinalBaseSQL)({
|
|
14
14
|
query,
|
|
15
15
|
tableSchema: schema,
|
|
16
|
-
getQueryOutput: _duckdbexec.duckdbExec
|
|
17
|
-
config: options
|
|
16
|
+
getQueryOutput: _duckdbexec.duckdbExec
|
|
18
17
|
});
|
|
19
18
|
return _extends._({}, schema, {
|
|
20
19
|
sql: baseFilterParamsSQL
|
|
@@ -22,8 +21,7 @@ const cubeQueryToSQL = async ({ query, tableSchemas, contextParams, options })=>
|
|
|
22
21
|
}));
|
|
23
22
|
const updatedTableSchema = (0, _meerkatcore.getCombinedTableSchema)(updatedTableSchemas, query);
|
|
24
23
|
const ast = (0, _meerkatcore.cubeToDuckdbAST)(query, updatedTableSchema, {
|
|
25
|
-
filterType: 'PROJECTION_FILTER'
|
|
26
|
-
config: options
|
|
24
|
+
filterType: 'PROJECTION_FILTER'
|
|
27
25
|
});
|
|
28
26
|
if (!ast) {
|
|
29
27
|
throw new Error('Could not generate AST');
|
|
@@ -35,8 +33,7 @@ const cubeQueryToSQL = async ({ query, tableSchemas, contextParams, options })=>
|
|
|
35
33
|
query,
|
|
36
34
|
tableSchema: updatedTableSchema,
|
|
37
35
|
filterType: 'PROJECTION_FILTER',
|
|
38
|
-
getQueryOutput: _duckdbexec.duckdbExec
|
|
39
|
-
config: options
|
|
36
|
+
getQueryOutput: _duckdbexec.duckdbExec
|
|
40
37
|
});
|
|
41
38
|
const filterParamQuery = (0, _meerkatcore.applyFilterParamsToBaseSQL)(updatedTableSchema.sql, filterParamsSQL);
|
|
42
39
|
/**
|
|
@@ -49,7 +46,7 @@ const cubeQueryToSQL = async ({ query, tableSchemas, contextParams, options })=>
|
|
|
49
46
|
* Add measures to the query
|
|
50
47
|
*/ const measures = query.measures;
|
|
51
48
|
const dimensions = query.dimensions || [];
|
|
52
|
-
const queryWithProjections = (0, _meerkatcore.applyProjectionToSQLQuery)(dimensions, measures, updatedTableSchema, replaceBaseTableName
|
|
49
|
+
const queryWithProjections = (0, _meerkatcore.applyProjectionToSQLQuery)(dimensions, measures, updatedTableSchema, replaceBaseTableName);
|
|
53
50
|
/**
|
|
54
51
|
* Replace SQL expression placeholders with actual SQL
|
|
55
52
|
*/ const finalQuery = (0, _meerkatcore.applySQLExpressions)(queryWithProjections);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql/cube-to-sql.ts"],"sourcesContent":["import {\n BASE_TABLE_NAME,\n ContextParams,\n Query,\n
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql/cube-to-sql.ts"],"sourcesContent":["import {\n BASE_TABLE_NAME,\n ContextParams,\n Query,\n TableSchema,\n applyFilterParamsToBaseSQL,\n applyProjectionToSQLQuery,\n applySQLExpressions,\n astDeserializerQuery,\n cubeToDuckdbAST,\n deserializeQuery,\n detectApplyContextParamsToBaseSQL,\n getCombinedTableSchema,\n getFilterParamsSQL,\n getFinalBaseSQL,\n} from '@devrev/meerkat-core';\nimport { duckdbExec } from '../duckdb-exec';\n\nexport interface CubeQueryToSQLParams {\n query: Query;\n tableSchemas: TableSchema[];\n contextParams?: ContextParams;\n}\n\nexport const cubeQueryToSQL = async ({\n query,\n tableSchemas,\n contextParams,\n}: CubeQueryToSQLParams) => {\n const updatedTableSchemas: TableSchema[] = await Promise.all(\n tableSchemas.map(async (schema: TableSchema) => {\n const baseFilterParamsSQL = await getFinalBaseSQL({\n query,\n tableSchema: schema,\n getQueryOutput: duckdbExec,\n });\n return {\n ...schema,\n sql: baseFilterParamsSQL,\n };\n })\n );\n\n const updatedTableSchema = getCombinedTableSchema(updatedTableSchemas, query);\n\n const ast = cubeToDuckdbAST(query, updatedTableSchema, {\n filterType: 'PROJECTION_FILTER',\n });\n if (!ast) {\n throw new Error('Could not generate AST');\n }\n\n const queryTemp = astDeserializerQuery(ast);\n\n const queryOutput = (await duckdbExec(queryTemp)) as Record<string, string>[];\n const preBaseQuery = deserializeQuery(queryOutput);\n\n const filterParamsSQL = await getFilterParamsSQL({\n query,\n tableSchema: updatedTableSchema,\n filterType: 'PROJECTION_FILTER',\n getQueryOutput: duckdbExec,\n });\n\n const filterParamQuery = applyFilterParamsToBaseSQL(\n updatedTableSchema.sql,\n filterParamsSQL\n );\n\n /**\n * Replace CONTEXT_PARAMS with context params\n */\n const baseQuery = detectApplyContextParamsToBaseSQL(\n filterParamQuery,\n contextParams || {}\n );\n\n /**\n * Replace BASE_TABLE_NAME with cube query\n */\n const replaceBaseTableName = preBaseQuery.replace(\n BASE_TABLE_NAME,\n `(${baseQuery}) AS ${updatedTableSchema.name}`\n );\n\n /**\n * Add measures to the query\n */\n const measures = query.measures;\n const dimensions = query.dimensions || [];\n const queryWithProjections = applyProjectionToSQLQuery(\n dimensions,\n measures,\n updatedTableSchema,\n replaceBaseTableName\n );\n\n /**\n * Replace SQL expression placeholders with actual SQL\n */\n const finalQuery = applySQLExpressions(queryWithProjections);\n\n return finalQuery;\n};\n"],"names":["cubeQueryToSQL","query","tableSchemas","contextParams","updatedTableSchemas","Promise","all","map","schema","baseFilterParamsSQL","getFinalBaseSQL","tableSchema","getQueryOutput","duckdbExec","sql","updatedTableSchema","getCombinedTableSchema","ast","cubeToDuckdbAST","filterType","Error","queryTemp","astDeserializerQuery","queryOutput","preBaseQuery","deserializeQuery","filterParamsSQL","getFilterParamsSQL","filterParamQuery","applyFilterParamsToBaseSQL","baseQuery","detectApplyContextParamsToBaseSQL","replaceBaseTableName","replace","BASE_TABLE_NAME","name","measures","dimensions","queryWithProjections","applyProjectionToSQLQuery","finalQuery","applySQLExpressions"],"mappings":";+BAwBaA;;;eAAAA;;;;6BATN;4BACoB;AAQpB,MAAMA,iBAAiB,OAAO,EACnCC,KAAK,EACLC,YAAY,EACZC,aAAa,EACQ;IACrB,MAAMC,sBAAqC,MAAMC,QAAQC,GAAG,CAC1DJ,aAAaK,GAAG,CAAC,OAAOC;QACtB,MAAMC,sBAAsB,MAAMC,IAAAA,4BAAe,EAAC;YAChDT;YACAU,aAAaH;YACbI,gBAAgBC,sBAAU;QAC5B;QACA,OAAO,eACFL;YACHM,KAAKL;;IAET;IAGF,MAAMM,qBAAqBC,IAAAA,mCAAsB,EAACZ,qBAAqBH;IAEvE,MAAMgB,MAAMC,IAAAA,4BAAe,EAACjB,OAAOc,oBAAoB;QACrDI,YAAY;IACd;IACA,IAAI,CAACF,KAAK;QACR,MAAM,IAAIG,MAAM;IAClB;IAEA,MAAMC,YAAYC,IAAAA,iCAAoB,EAACL;IAEvC,MAAMM,cAAe,MAAMV,IAAAA,sBAAU,EAACQ;IACtC,MAAMG,eAAeC,IAAAA,6BAAgB,EAACF;IAEtC,MAAMG,kBAAkB,MAAMC,IAAAA,+BAAkB,EAAC;QAC/C1B;QACAU,aAAaI;QACbI,YAAY;QACZP,gBAAgBC,sBAAU;IAC5B;IAEA,MAAMe,mBAAmBC,IAAAA,uCAA0B,EACjDd,mBAAmBD,GAAG,EACtBY;IAGF;;GAEC,GACD,MAAMI,YAAYC,IAAAA,8CAAiC,EACjDH,kBACAzB,iBAAiB,CAAC;IAGpB;;GAEC,GACD,MAAM6B,uBAAuBR,aAAaS,OAAO,CAC/CC,4BAAe,EACf,CAAC,CAAC,EAAEJ,UAAU,KAAK,EAAEf,mBAAmBoB,IAAI,CAAC,CAAC;IAGhD;;GAEC,GACD,MAAMC,WAAWnC,MAAMmC,QAAQ;IAC/B,MAAMC,aAAapC,MAAMoC,UAAU,IAAI,EAAE;IACzC,MAAMC,uBAAuBC,IAAAA,sCAAyB,EACpDF,YACAD,UACArB,oBACAiB;IAGF;;GAEC,GACD,MAAMQ,aAAaC,IAAAA,gCAAmB,EAACH;IAEvC,OAAOE;AACT"}
|
|
@@ -9,20 +9,14 @@ const _extends = require("@swc/helpers/_/_extends");
|
|
|
9
9
|
const _meerkatcore = require("@devrev/meerkat-core");
|
|
10
10
|
const _cubetosql = require("../cube-to-sql/cube-to-sql");
|
|
11
11
|
const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionConfig, columnProjections, contextParams })=>{
|
|
12
|
-
const resolutionOptions = {
|
|
13
|
-
useDotNotation: false
|
|
14
|
-
};
|
|
15
12
|
// Check if resolution should be skipped
|
|
16
13
|
if ((0, _meerkatcore.shouldSkipResolution)(resolutionConfig, query, columnProjections)) {
|
|
17
14
|
return await (0, _cubetosql.cubeQueryToSQL)({
|
|
18
15
|
query,
|
|
19
16
|
tableSchemas,
|
|
20
|
-
contextParams
|
|
21
|
-
options: resolutionOptions
|
|
17
|
+
contextParams
|
|
22
18
|
});
|
|
23
19
|
}
|
|
24
|
-
// Resolution flow always uses underscore notation (useDotNotation: false)
|
|
25
|
-
// to ensure consistent field naming throughout the resolution pipeline.
|
|
26
20
|
//
|
|
27
21
|
// Why remove aliases?
|
|
28
22
|
// The resolution pipeline (unnest → join lookups → re-aggregate) operates on field names
|
|
@@ -51,8 +45,7 @@ const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionCon
|
|
|
51
45
|
const baseSql = await (0, _cubetosql.cubeQueryToSQL)({
|
|
52
46
|
query,
|
|
53
47
|
tableSchemas: tableSchemasWithoutAliases,
|
|
54
|
-
contextParams
|
|
55
|
-
options: resolutionOptions
|
|
48
|
+
contextParams
|
|
56
49
|
});
|
|
57
50
|
if (!columnProjections) {
|
|
58
51
|
columnProjections = [
|
|
@@ -71,7 +64,7 @@ const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionCon
|
|
|
71
64
|
const schemaWithOverrides = (0, _meerkatcore.applySqlOverrides)(baseSchema, resolutionConfig);
|
|
72
65
|
// Transform field names in configs to match base table schema format
|
|
73
66
|
resolutionConfig.columnConfigs.forEach((config)=>{
|
|
74
|
-
config.name = (0, _meerkatcore.memberKeyToSafeKey)(config.name
|
|
67
|
+
config.name = (0, _meerkatcore.memberKeyToSafeKey)(config.name);
|
|
75
68
|
});
|
|
76
69
|
const rowIdDimension = {
|
|
77
70
|
name: _meerkatcore.ROW_ID_DIMENSION_NAME,
|
|
@@ -86,9 +79,7 @@ const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionCon
|
|
|
86
79
|
baseTableSchema: schemaWithOverrides,
|
|
87
80
|
resolutionConfig,
|
|
88
81
|
contextParams,
|
|
89
|
-
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params
|
|
90
|
-
options: resolutionOptions
|
|
91
|
-
}))
|
|
82
|
+
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params))
|
|
92
83
|
});
|
|
93
84
|
// Apply resolution (join with lookup tables)
|
|
94
85
|
const resolvedTableSchema = await (0, _meerkatcore.getResolvedTableSchema)({
|
|
@@ -96,18 +87,14 @@ const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionCon
|
|
|
96
87
|
resolutionConfig,
|
|
97
88
|
contextParams,
|
|
98
89
|
columnProjections,
|
|
99
|
-
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params
|
|
100
|
-
options: resolutionOptions
|
|
101
|
-
}))
|
|
90
|
+
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params))
|
|
102
91
|
});
|
|
103
92
|
// Re-aggregate to reverse the unnest
|
|
104
93
|
const aggregatedTableSchema = await (0, _meerkatcore.getAggregatedSql)({
|
|
105
94
|
resolvedTableSchema,
|
|
106
95
|
resolutionConfig,
|
|
107
96
|
contextParams,
|
|
108
|
-
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params
|
|
109
|
-
options: resolutionOptions
|
|
110
|
-
}))
|
|
97
|
+
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params))
|
|
111
98
|
});
|
|
112
99
|
// Apply aliases and generate final SQL
|
|
113
100
|
const sqlWithAliases = await (0, _meerkatcore.applyAliases)({
|
|
@@ -115,9 +102,7 @@ const cubeQueryToSQLWithResolution = async ({ query, tableSchemas, resolutionCon
|
|
|
115
102
|
originalTableSchemas: tableSchemas,
|
|
116
103
|
resolutionConfig,
|
|
117
104
|
contextParams,
|
|
118
|
-
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params
|
|
119
|
-
options: resolutionOptions
|
|
120
|
-
}))
|
|
105
|
+
cubeQueryToSQL: async (params)=>(0, _cubetosql.cubeQueryToSQL)(_extends._({}, params))
|
|
121
106
|
});
|
|
122
107
|
// Wrap with row_id ordering and exclusion
|
|
123
108
|
return (0, _meerkatcore.wrapWithRowIdOrderingAndExclusion)(sqlWithAliases, _meerkatcore.ROW_ID_DIMENSION_NAME);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql-with-resolution/cube-to-sql-with-resolution.ts"],"sourcesContent":["import {\n applyAliases,\n applySqlOverrides,\n BASE_DATA_SOURCE_NAME,\n ContextParams,\n getAggregatedSql as coreGetAggregatedSql,\n getResolvedTableSchema as coreGetResolvedTableSchema,\n getUnnestTableSchema as coreGetUnnestTableSchema,\n createBaseTableSchema,\n Dimension,\n generateRowNumberSql,\n memberKeyToSafeKey,\n Query,\n
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/cube-to-sql-with-resolution/cube-to-sql-with-resolution.ts"],"sourcesContent":["import {\n applyAliases,\n applySqlOverrides,\n BASE_DATA_SOURCE_NAME,\n ContextParams,\n getAggregatedSql as coreGetAggregatedSql,\n getResolvedTableSchema as coreGetResolvedTableSchema,\n getUnnestTableSchema as coreGetUnnestTableSchema,\n createBaseTableSchema,\n Dimension,\n generateRowNumberSql,\n memberKeyToSafeKey,\n Query,\n ResolutionConfig,\n ROW_ID_DIMENSION_NAME,\n shouldSkipResolution,\n TableSchema,\n wrapWithRowIdOrderingAndExclusion,\n} from '@devrev/meerkat-core';\nimport { cubeQueryToSQL } from '../cube-to-sql/cube-to-sql';\n\nexport interface CubeQueryToSQLWithResolutionParams {\n query: Query;\n tableSchemas: TableSchema[];\n resolutionConfig: ResolutionConfig;\n columnProjections?: string[];\n contextParams?: ContextParams;\n}\n\nexport const cubeQueryToSQLWithResolution = async ({\n query,\n tableSchemas,\n resolutionConfig,\n columnProjections,\n contextParams,\n}: CubeQueryToSQLWithResolutionParams) => {\n // Check if resolution should be skipped\n if (shouldSkipResolution(resolutionConfig, query, columnProjections)) {\n return await cubeQueryToSQL({\n query,\n tableSchemas,\n contextParams,\n });\n }\n\n //\n // Why remove aliases?\n // The resolution pipeline (unnest → join lookups → re-aggregate) operates on field names\n // internally for consistency and simplicity. Using aliases throughout would complicate\n // the logic as we transform schemas through multiple steps.\n //\n // Alias handling strategy:\n // 1. Strip aliases here - work with field names (e.g., tickets__id, tickets__owners)\n // 2. Run entire resolution pipeline with field names\n // 3. At the final step (applyAliases), restore aliases from original schemas\n // 4. Generate final SQL with user-friendly aliases (e.g., \"ID\", \"Owners\")\n //\n // Benefits:\n // - Cleaner internal logic (no alias tracking through transformations)\n // - Single source of truth for aliases (original tableSchemas)\n // - Easier to debug (field names are consistent throughout pipeline)\n // - Separation of concerns (resolution logic vs. display formatting)\n const tableSchemasWithoutAliases: TableSchema[] = tableSchemas.map(\n (schema) => ({\n ...schema,\n dimensions: schema.dimensions.map((dim) => ({\n ...dim,\n alias: undefined, // Strip alias for resolution pipeline\n })),\n measures: schema.measures.map((measure) => ({\n ...measure,\n alias: undefined, // Strip alias\n })),\n })\n );\n\n const baseSql = await cubeQueryToSQL({\n query,\n tableSchemas: tableSchemasWithoutAliases,\n contextParams,\n });\n\n if (!columnProjections) {\n columnProjections = [...(query.dimensions || []), ...query.measures];\n }\n // This is to ensure that, only the column projection columns\n // are being resolved and other definitions are ignored.\n resolutionConfig.columnConfigs = resolutionConfig.columnConfigs.filter(\n (config) => {\n return columnProjections?.includes(config.name);\n }\n );\n\n const baseSchema: TableSchema = createBaseTableSchema(\n baseSql,\n tableSchemasWithoutAliases, // Use alias-free schemas\n resolutionConfig,\n [],\n columnProjections\n );\n\n // At this point, filters/sorts are baked into baseSql using original values\n // We can now override dimensions/measures in the base schema with custom SQL expressions for display\n const schemaWithOverrides = applySqlOverrides(baseSchema, resolutionConfig);\n\n // Transform field names in configs to match base table schema format\n resolutionConfig.columnConfigs.forEach((config) => {\n config.name = memberKeyToSafeKey(config.name);\n });\n\n const rowIdDimension: Dimension = {\n name: ROW_ID_DIMENSION_NAME,\n sql: generateRowNumberSql(\n query,\n schemaWithOverrides.dimensions,\n BASE_DATA_SOURCE_NAME\n ),\n type: 'number',\n alias: ROW_ID_DIMENSION_NAME,\n };\n schemaWithOverrides.dimensions.push(rowIdDimension);\n columnProjections.push(ROW_ID_DIMENSION_NAME);\n\n // Generate SQL with row_id and unnested arrays\n const unnestTableSchema = await coreGetUnnestTableSchema({\n baseTableSchema: schemaWithOverrides,\n resolutionConfig,\n contextParams,\n cubeQueryToSQL: async (params) => cubeQueryToSQL({ ...params }),\n });\n\n // Apply resolution (join with lookup tables)\n const resolvedTableSchema = await coreGetResolvedTableSchema({\n baseTableSchema: unnestTableSchema,\n resolutionConfig,\n contextParams,\n columnProjections,\n cubeQueryToSQL: async (params) => cubeQueryToSQL({ ...params }),\n });\n\n // Re-aggregate to reverse the unnest\n const aggregatedTableSchema = await coreGetAggregatedSql({\n resolvedTableSchema,\n resolutionConfig,\n contextParams,\n cubeQueryToSQL: async (params) => cubeQueryToSQL({ ...params }),\n });\n\n // Apply aliases and generate final SQL\n const sqlWithAliases = await applyAliases({\n aggregatedTableSchema,\n originalTableSchemas: tableSchemas,\n resolutionConfig,\n contextParams,\n cubeQueryToSQL: async (params) => cubeQueryToSQL({ ...params }),\n });\n\n // Wrap with row_id ordering and exclusion\n return wrapWithRowIdOrderingAndExclusion(\n sqlWithAliases,\n ROW_ID_DIMENSION_NAME\n );\n};\n"],"names":["cubeQueryToSQLWithResolution","query","tableSchemas","resolutionConfig","columnProjections","contextParams","shouldSkipResolution","cubeQueryToSQL","tableSchemasWithoutAliases","map","schema","dimensions","dim","alias","undefined","measures","measure","baseSql","columnConfigs","filter","config","includes","name","baseSchema","createBaseTableSchema","schemaWithOverrides","applySqlOverrides","forEach","memberKeyToSafeKey","rowIdDimension","ROW_ID_DIMENSION_NAME","sql","generateRowNumberSql","BASE_DATA_SOURCE_NAME","type","push","unnestTableSchema","coreGetUnnestTableSchema","baseTableSchema","params","resolvedTableSchema","coreGetResolvedTableSchema","aggregatedTableSchema","coreGetAggregatedSql","sqlWithAliases","applyAliases","originalTableSchemas","wrapWithRowIdOrderingAndExclusion"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devrev/meerkat-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.119",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@swc/helpers": "~0.5.0",
|
|
6
6
|
"@devrev/meerkat-core": "*",
|
|
7
|
-
"axios": "^1.
|
|
7
|
+
"axios": "^1.13.5",
|
|
8
8
|
"lodash": "^4.17.23",
|
|
9
9
|
"duckdb": "^1.3.4"
|
|
10
10
|
},
|
|
@@ -15,13 +15,9 @@ export declare const TABLE_SCHEMA: {
|
|
|
15
15
|
}[];
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* Get test data
|
|
19
|
-
* @param useSafeAlias - When true, returns test data with dot notation aliases (e.g., "orders.customer_id")
|
|
20
|
-
* When false, returns test data with underscore notation aliases (e.g., orders__customer_id)
|
|
18
|
+
* Get test data with underscore notation aliases (e.g., orders__customer_id)
|
|
21
19
|
*/
|
|
22
|
-
export declare const getTestData: (
|
|
23
|
-
useSafeAlias: boolean;
|
|
24
|
-
}) => ({
|
|
20
|
+
export declare const getTestData: () => ({
|
|
25
21
|
testName: string;
|
|
26
22
|
expectedSQL: string;
|
|
27
23
|
cubeInput: {
|
|
@@ -417,400 +413,4 @@ export declare const getTestData: ({ useSafeAlias }: {
|
|
|
417
413
|
product_id: string;
|
|
418
414
|
vendors: null;
|
|
419
415
|
})[];
|
|
420
|
-
})[])[] | ({
|
|
421
|
-
testName: string;
|
|
422
|
-
expectedSQL: string;
|
|
423
|
-
cubeInput: {
|
|
424
|
-
measures: string[];
|
|
425
|
-
filters: never[];
|
|
426
|
-
dimensions: string[];
|
|
427
|
-
limit: number;
|
|
428
|
-
};
|
|
429
|
-
expectedOutput: {
|
|
430
|
-
'orders.order_month': string;
|
|
431
|
-
'orders.total_order_amount': number;
|
|
432
|
-
}[];
|
|
433
|
-
}[] | {
|
|
434
|
-
testName: string;
|
|
435
|
-
expectedSQL: string;
|
|
436
|
-
cubeInput: {
|
|
437
|
-
measures: string[];
|
|
438
|
-
filters: never[];
|
|
439
|
-
dimensions: string[];
|
|
440
|
-
order: {
|
|
441
|
-
'orders.total_order_amount': string;
|
|
442
|
-
'orders.customer_id': string;
|
|
443
|
-
};
|
|
444
|
-
};
|
|
445
|
-
expectedOutput: ({
|
|
446
|
-
'orders.customer_id': string;
|
|
447
|
-
'orders.total_order_amount': number;
|
|
448
|
-
} | {
|
|
449
|
-
'orders.customer_id': null;
|
|
450
|
-
'orders.total_order_amount': number;
|
|
451
|
-
})[];
|
|
452
|
-
}[] | {
|
|
453
|
-
testName: string;
|
|
454
|
-
expectedSQL: string;
|
|
455
|
-
cubeInput: {
|
|
456
|
-
measures: string[];
|
|
457
|
-
filters: {
|
|
458
|
-
member: string;
|
|
459
|
-
operator: string;
|
|
460
|
-
values: string[];
|
|
461
|
-
}[];
|
|
462
|
-
dimensions: never[];
|
|
463
|
-
};
|
|
464
|
-
expectedOutput: ({
|
|
465
|
-
order_id: number;
|
|
466
|
-
customer_id: string;
|
|
467
|
-
'orders.customer_id': string;
|
|
468
|
-
product_id: string;
|
|
469
|
-
order_date: string;
|
|
470
|
-
order_amount: number;
|
|
471
|
-
vendors: string[];
|
|
472
|
-
} | {
|
|
473
|
-
order_id: number;
|
|
474
|
-
customer_id: string;
|
|
475
|
-
'orders.customer_id': string;
|
|
476
|
-
product_id: string;
|
|
477
|
-
order_date: string;
|
|
478
|
-
order_amount: number;
|
|
479
|
-
vendors: null;
|
|
480
|
-
})[];
|
|
481
|
-
}[] | {
|
|
482
|
-
testName: string;
|
|
483
|
-
expectedSQL: string;
|
|
484
|
-
cubeInput: {
|
|
485
|
-
measures: string[];
|
|
486
|
-
filters: {
|
|
487
|
-
and: {
|
|
488
|
-
member: string;
|
|
489
|
-
operator: string;
|
|
490
|
-
values: string[];
|
|
491
|
-
}[];
|
|
492
|
-
}[];
|
|
493
|
-
dimensions: never[];
|
|
494
|
-
};
|
|
495
|
-
expectedOutput: ({
|
|
496
|
-
order_id: number;
|
|
497
|
-
customer_id: string;
|
|
498
|
-
'orders.customer_id': string;
|
|
499
|
-
product_id: string;
|
|
500
|
-
order_date: string;
|
|
501
|
-
order_amount: number;
|
|
502
|
-
vendors: string[];
|
|
503
|
-
'orders.order_date'?: undefined;
|
|
504
|
-
} | {
|
|
505
|
-
customer_id: string;
|
|
506
|
-
order_amount: number;
|
|
507
|
-
order_date: string;
|
|
508
|
-
order_id: number;
|
|
509
|
-
'orders.customer_id': string;
|
|
510
|
-
'orders.order_date': undefined;
|
|
511
|
-
product_id: string;
|
|
512
|
-
vendors: string[];
|
|
513
|
-
} | {
|
|
514
|
-
customer_id: string;
|
|
515
|
-
order_amount: number;
|
|
516
|
-
order_date: string;
|
|
517
|
-
order_id: number;
|
|
518
|
-
'orders.customer_id': string;
|
|
519
|
-
'orders.order_date': undefined;
|
|
520
|
-
product_id: string;
|
|
521
|
-
vendors: null;
|
|
522
|
-
})[];
|
|
523
|
-
}[] | {
|
|
524
|
-
testName: string;
|
|
525
|
-
expectedSQL: string;
|
|
526
|
-
cubeInput: {
|
|
527
|
-
measures: string[];
|
|
528
|
-
filters: {
|
|
529
|
-
member: string;
|
|
530
|
-
operator: string;
|
|
531
|
-
values: string[];
|
|
532
|
-
}[];
|
|
533
|
-
dimensions: never[];
|
|
534
|
-
};
|
|
535
|
-
expectedOutput: ({
|
|
536
|
-
order_id: number;
|
|
537
|
-
customer_id: string;
|
|
538
|
-
product_id: string;
|
|
539
|
-
order_date: string;
|
|
540
|
-
order_amount: number;
|
|
541
|
-
'orders.order_amount': number;
|
|
542
|
-
vendors: string[];
|
|
543
|
-
'orders.order_date'?: undefined;
|
|
544
|
-
} | {
|
|
545
|
-
customer_id: null;
|
|
546
|
-
order_amount: number;
|
|
547
|
-
order_date: string;
|
|
548
|
-
order_id: number;
|
|
549
|
-
'orders.order_amount': number;
|
|
550
|
-
'orders.order_date': undefined;
|
|
551
|
-
product_id: string;
|
|
552
|
-
vendors: string[];
|
|
553
|
-
} | {
|
|
554
|
-
customer_id: string;
|
|
555
|
-
order_amount: number;
|
|
556
|
-
order_date: string;
|
|
557
|
-
order_id: number;
|
|
558
|
-
'orders.order_amount': number;
|
|
559
|
-
'orders.order_date': undefined;
|
|
560
|
-
product_id: string;
|
|
561
|
-
vendors: string[];
|
|
562
|
-
})[];
|
|
563
|
-
}[] | {
|
|
564
|
-
testName: string;
|
|
565
|
-
expectedSQL: string;
|
|
566
|
-
cubeInput: {
|
|
567
|
-
measures: string[];
|
|
568
|
-
filters: {
|
|
569
|
-
member: string;
|
|
570
|
-
operator: string;
|
|
571
|
-
values: string[];
|
|
572
|
-
}[];
|
|
573
|
-
dimensions: never[];
|
|
574
|
-
};
|
|
575
|
-
expectedOutput: ({
|
|
576
|
-
order_id: number;
|
|
577
|
-
customer_id: string;
|
|
578
|
-
product_id: string;
|
|
579
|
-
order_date: string;
|
|
580
|
-
order_amount: number;
|
|
581
|
-
'orders.order_date': string;
|
|
582
|
-
vendors: string[];
|
|
583
|
-
} | {
|
|
584
|
-
customer_id: null;
|
|
585
|
-
order_amount: number;
|
|
586
|
-
order_date: string;
|
|
587
|
-
order_id: number;
|
|
588
|
-
'orders.order_date': string;
|
|
589
|
-
product_id: string;
|
|
590
|
-
vendors: string[];
|
|
591
|
-
} | {
|
|
592
|
-
customer_id: string;
|
|
593
|
-
order_amount: number;
|
|
594
|
-
order_date: string;
|
|
595
|
-
order_id: number;
|
|
596
|
-
'orders.order_date': string;
|
|
597
|
-
product_id: string;
|
|
598
|
-
vendors: null;
|
|
599
|
-
})[];
|
|
600
|
-
}[] | {
|
|
601
|
-
testName: string;
|
|
602
|
-
expectedSQL: string;
|
|
603
|
-
cubeInput: {
|
|
604
|
-
measures: string[];
|
|
605
|
-
filters: {
|
|
606
|
-
and: {
|
|
607
|
-
member: string;
|
|
608
|
-
operator: string;
|
|
609
|
-
values: string[];
|
|
610
|
-
}[];
|
|
611
|
-
}[];
|
|
612
|
-
dimensions: never[];
|
|
613
|
-
};
|
|
614
|
-
expectedOutput: {
|
|
615
|
-
order_id: number;
|
|
616
|
-
customer_id: string;
|
|
617
|
-
product_id: string;
|
|
618
|
-
order_date: string;
|
|
619
|
-
order_amount: number;
|
|
620
|
-
'orders.order_amount': number;
|
|
621
|
-
'orders.order_date': string;
|
|
622
|
-
vendors: string[];
|
|
623
|
-
}[];
|
|
624
|
-
}[] | {
|
|
625
|
-
testName: string;
|
|
626
|
-
expectedSQL: string;
|
|
627
|
-
cubeInput: {
|
|
628
|
-
measures: string[];
|
|
629
|
-
filters: {
|
|
630
|
-
and: ({
|
|
631
|
-
member: string;
|
|
632
|
-
operator: string;
|
|
633
|
-
values?: undefined;
|
|
634
|
-
} | {
|
|
635
|
-
member: string;
|
|
636
|
-
operator: string;
|
|
637
|
-
values: string[];
|
|
638
|
-
})[];
|
|
639
|
-
}[];
|
|
640
|
-
dimensions: never[];
|
|
641
|
-
};
|
|
642
|
-
expectedOutput: ({
|
|
643
|
-
customer_id: string;
|
|
644
|
-
order_amount: number;
|
|
645
|
-
order_date: string;
|
|
646
|
-
order_id: number;
|
|
647
|
-
'orders.order_amount': number;
|
|
648
|
-
'orders.order_date': undefined;
|
|
649
|
-
'orders.product_id': string;
|
|
650
|
-
product_id: string;
|
|
651
|
-
vendors: string[];
|
|
652
|
-
} | {
|
|
653
|
-
customer_id: null;
|
|
654
|
-
order_amount: number;
|
|
655
|
-
order_date: string;
|
|
656
|
-
order_id: number;
|
|
657
|
-
'orders.order_amount': number;
|
|
658
|
-
'orders.order_date': undefined;
|
|
659
|
-
'orders.product_id': string;
|
|
660
|
-
product_id: string;
|
|
661
|
-
vendors: string[];
|
|
662
|
-
})[];
|
|
663
|
-
}[] | {
|
|
664
|
-
testName: string;
|
|
665
|
-
expectedSQL: string;
|
|
666
|
-
cubeInput: {
|
|
667
|
-
measures: string[];
|
|
668
|
-
filters: {
|
|
669
|
-
and: ({
|
|
670
|
-
member: string;
|
|
671
|
-
operator: string;
|
|
672
|
-
values?: undefined;
|
|
673
|
-
} | {
|
|
674
|
-
member: string;
|
|
675
|
-
operator: string;
|
|
676
|
-
values: string[];
|
|
677
|
-
})[];
|
|
678
|
-
}[];
|
|
679
|
-
dimensions: never[];
|
|
680
|
-
};
|
|
681
|
-
expectedOutput: {
|
|
682
|
-
'orders.customer_id': null;
|
|
683
|
-
customer_id: null;
|
|
684
|
-
order_amount: number;
|
|
685
|
-
order_date: string;
|
|
686
|
-
order_id: number;
|
|
687
|
-
'orders.order_date': undefined;
|
|
688
|
-
'orders.product_id': string;
|
|
689
|
-
product_id: string;
|
|
690
|
-
vendors: string[];
|
|
691
|
-
}[];
|
|
692
|
-
}[] | ({
|
|
693
|
-
testName: string;
|
|
694
|
-
expectedSQL: string;
|
|
695
|
-
cubeInput: {
|
|
696
|
-
measures: string[];
|
|
697
|
-
filters: {
|
|
698
|
-
and: {
|
|
699
|
-
member: string;
|
|
700
|
-
operator: string;
|
|
701
|
-
values: string[];
|
|
702
|
-
}[];
|
|
703
|
-
}[];
|
|
704
|
-
dimensions: never[];
|
|
705
|
-
};
|
|
706
|
-
expectedOutput: {
|
|
707
|
-
customer_id: string;
|
|
708
|
-
order_amount: number;
|
|
709
|
-
order_date: string;
|
|
710
|
-
order_id: number;
|
|
711
|
-
'orders.customer_id': string;
|
|
712
|
-
'orders.order_date': undefined;
|
|
713
|
-
'orders.vendors': string[];
|
|
714
|
-
product_id: string;
|
|
715
|
-
vendors: string[];
|
|
716
|
-
}[];
|
|
717
|
-
} | {
|
|
718
|
-
testName: string;
|
|
719
|
-
expectedSQL: string;
|
|
720
|
-
cubeInput: {
|
|
721
|
-
measures: string[];
|
|
722
|
-
filters: {
|
|
723
|
-
and: {
|
|
724
|
-
member: string;
|
|
725
|
-
operator: string;
|
|
726
|
-
values: string[];
|
|
727
|
-
}[];
|
|
728
|
-
}[];
|
|
729
|
-
dimensions: never[];
|
|
730
|
-
};
|
|
731
|
-
expectedOutput: {
|
|
732
|
-
customer_id: string;
|
|
733
|
-
order_amount: number;
|
|
734
|
-
order_date: string;
|
|
735
|
-
order_id: number;
|
|
736
|
-
'orders.order_date': undefined;
|
|
737
|
-
'orders.vendors': string[];
|
|
738
|
-
product_id: string;
|
|
739
|
-
vendors: string[];
|
|
740
|
-
}[];
|
|
741
|
-
})[] | ({
|
|
742
|
-
testName: string;
|
|
743
|
-
expectedSQL: string;
|
|
744
|
-
cubeInput: {
|
|
745
|
-
measures: string[];
|
|
746
|
-
filters: {
|
|
747
|
-
and: {
|
|
748
|
-
member: string;
|
|
749
|
-
operator: string;
|
|
750
|
-
values: string[];
|
|
751
|
-
}[];
|
|
752
|
-
}[];
|
|
753
|
-
dimensions: never[];
|
|
754
|
-
};
|
|
755
|
-
expectedOutput: ({
|
|
756
|
-
customer_id: string;
|
|
757
|
-
order_amount: number;
|
|
758
|
-
order_date: string;
|
|
759
|
-
order_id: number;
|
|
760
|
-
'orders.customer_id': string;
|
|
761
|
-
'orders.order_date': undefined;
|
|
762
|
-
'orders.product_id': string;
|
|
763
|
-
product_id: string;
|
|
764
|
-
vendors: string[];
|
|
765
|
-
} | {
|
|
766
|
-
customer_id: null;
|
|
767
|
-
order_amount: number;
|
|
768
|
-
order_date: string;
|
|
769
|
-
order_id: number;
|
|
770
|
-
'orders.customer_id': null;
|
|
771
|
-
'orders.order_date': undefined;
|
|
772
|
-
'orders.product_id': string;
|
|
773
|
-
product_id: string;
|
|
774
|
-
vendors: string[];
|
|
775
|
-
})[];
|
|
776
|
-
} | {
|
|
777
|
-
testName: string;
|
|
778
|
-
expectedSQL: string;
|
|
779
|
-
cubeInput: {
|
|
780
|
-
measures: string[];
|
|
781
|
-
filters: {
|
|
782
|
-
member: string;
|
|
783
|
-
operator: string;
|
|
784
|
-
values: string[];
|
|
785
|
-
}[];
|
|
786
|
-
dimensions: never[];
|
|
787
|
-
};
|
|
788
|
-
expectedOutput: ({
|
|
789
|
-
customer_id: string;
|
|
790
|
-
order_amount: number;
|
|
791
|
-
order_date: string;
|
|
792
|
-
order_id: number;
|
|
793
|
-
'orders.order_date': undefined;
|
|
794
|
-
'orders.vendors': string[];
|
|
795
|
-
product_id: string;
|
|
796
|
-
vendors: string[];
|
|
797
|
-
} | {
|
|
798
|
-
customer_id: null;
|
|
799
|
-
order_amount: number;
|
|
800
|
-
order_date: string;
|
|
801
|
-
order_id: number;
|
|
802
|
-
'orders.order_date': undefined;
|
|
803
|
-
'orders.vendors': string[];
|
|
804
|
-
product_id: string;
|
|
805
|
-
vendors: string[];
|
|
806
|
-
} | {
|
|
807
|
-
customer_id: string;
|
|
808
|
-
order_amount: number;
|
|
809
|
-
order_date: string;
|
|
810
|
-
order_id: number;
|
|
811
|
-
'orders.order_date': undefined;
|
|
812
|
-
'orders.vendors': null;
|
|
813
|
-
product_id: string;
|
|
814
|
-
vendors: null;
|
|
815
|
-
})[];
|
|
816
416
|
})[])[];
|