@devrev/meerkat-core 0.0.82 → 0.0.84

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrev/meerkat-core",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "dependencies": {
5
5
  "@swc/helpers": "~0.5.0"
6
6
  },
@@ -0,0 +1,11 @@
1
+ import { FilterType, Query, TableSchema } from "../types/cube-types";
2
+ export declare const getFilterParamsSQL: ({ query, tableSchema, filterType, getQueryOutput }: {
3
+ query: Query;
4
+ tableSchema: TableSchema;
5
+ filterType?: FilterType | undefined;
6
+ getQueryOutput: (query: string) => Promise<any>;
7
+ }) => Promise<{
8
+ memberKey: string;
9
+ sql: string;
10
+ matchKey: string;
11
+ }[]>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "getFilterParamsSQL", {
3
+ enumerable: true,
4
+ get: function() {
5
+ return getFilterParamsSQL;
6
+ }
7
+ });
8
+ const _astdeserializer = require("../ast-deserializer/ast-deserializer");
9
+ const _filterparamsast = require("../filter-params/filter-params-ast");
10
+ const getFilterParamsSQL = async ({ query, tableSchema, filterType, getQueryOutput })=>{
11
+ const filterParamsAST = (0, _filterparamsast.getFilterParamsAST)(query, tableSchema, filterType);
12
+ const filterParamsSQL = [];
13
+ for (const filterParamAST of filterParamsAST){
14
+ if (!filterParamAST.ast) {
15
+ continue;
16
+ }
17
+ const queryOutput = await getQueryOutput((0, _astdeserializer.astDeserializerQuery)(filterParamAST.ast));
18
+ const sql = (0, _astdeserializer.deserializeQuery)(queryOutput);
19
+ filterParamsSQL.push({
20
+ memberKey: filterParamAST.memberKey,
21
+ sql: sql,
22
+ matchKey: filterParamAST.matchKey
23
+ });
24
+ }
25
+ return filterParamsSQL;
26
+ };
27
+
28
+ //# sourceMappingURL=get-filter-params-sql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../meerkat-core/src/get-filter-params-sql/get-filter-params-sql.ts"],"sourcesContent":["import { astDeserializerQuery, deserializeQuery } from \"../ast-deserializer/ast-deserializer\";\nimport { getFilterParamsAST } from \"../filter-params/filter-params-ast\";\nimport { FilterType, Query, TableSchema } from \"../types/cube-types\";\n\nexport const getFilterParamsSQL = async ({\n query,\n tableSchema,\n filterType,\n getQueryOutput\n}: {\n query: Query;\n tableSchema: TableSchema;\n filterType?: FilterType;\n getQueryOutput: (query: string) => Promise<any>;\n}) => {\n const filterParamsAST = getFilterParamsAST(\n query,\n tableSchema,\n filterType\n );\n const filterParamsSQL = [];\n for (const filterParamAST of filterParamsAST) {\n if (!filterParamAST.ast) {\n continue;\n }\n\n const queryOutput = await getQueryOutput(astDeserializerQuery(filterParamAST.ast))\n const sql = deserializeQuery(queryOutput);\n\n filterParamsSQL.push({\n memberKey: filterParamAST.memberKey,\n sql: sql,\n matchKey: filterParamAST.matchKey,\n });\n }\n return filterParamsSQL;\n};\n"],"names":["getFilterParamsSQL","query","tableSchema","filterType","getQueryOutput","filterParamsAST","getFilterParamsAST","filterParamsSQL","filterParamAST","ast","queryOutput","astDeserializerQuery","sql","deserializeQuery","push","memberKey","matchKey"],"mappings":";+BAIaA;;;eAAAA;;;iCAJ0C;iCACpB;AAG5B,MAAMA,qBAAqB,OAAO,EACvCC,KAAK,EACLC,WAAW,EACXC,UAAU,EACVC,cAAc,EAMf;IACC,MAAMC,kBAAkBC,IAAAA,mCAAkB,EACxCL,OACAC,aACAC;IAEF,MAAMI,kBAAkB,EAAE;IAC1B,KAAK,MAAMC,kBAAkBH,gBAAiB;QAC5C,IAAI,CAACG,eAAeC,GAAG,EAAE;YACvB;QACF;QAEA,MAAMC,cAAc,MAAMN,eAAeO,IAAAA,qCAAoB,EAACH,eAAeC,GAAG;QAChF,MAAMG,MAAMC,IAAAA,iCAAgB,EAACH;QAE7BH,gBAAgBO,IAAI,CAAC;YACnBC,WAAWP,eAAeO,SAAS;YACnCH,KAAKA;YACLI,UAAUR,eAAeQ,QAAQ;QACnC;IACF;IACA,OAAOT;AACT"}
@@ -0,0 +1,7 @@
1
+ import { Query } from "../types/cube-types/query";
2
+ import { TableSchema } from "../types/cube-types/table";
3
+ export declare const getFinalBaseSQL: ({ query, getQueryOutput, tableSchema, }: {
4
+ query: Query;
5
+ tableSchema: TableSchema;
6
+ getQueryOutput: (query: string) => Promise<any>;
7
+ }) => Promise<string>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "getFinalBaseSQL", {
3
+ enumerable: true,
4
+ get: function() {
5
+ return getFinalBaseSQL;
6
+ }
7
+ });
8
+ const _filterparamsast = require("../filter-params/filter-params-ast");
9
+ const _getfilterparamssql = require("../get-filter-params-sql/get-filter-params-sql");
10
+ const _getwrappedbasequerywithprojections = require("../get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections");
11
+ const getFinalBaseSQL = async ({ query, getQueryOutput, tableSchema })=>{
12
+ /**
13
+ * Apply transformation to the supplied base query.
14
+ * This involves updating the filter placeholder with the actual filter values.
15
+ */ const baseFilterParamsSQL = await (0, _getfilterparamssql.getFilterParamsSQL)({
16
+ query: query,
17
+ tableSchema,
18
+ filterType: 'BASE_FILTER',
19
+ getQueryOutput
20
+ });
21
+ const baseSQL = (0, _filterparamsast.applyFilterParamsToBaseSQL)(tableSchema.sql, baseFilterParamsSQL);
22
+ const baseSQLWithFilterProjection = (0, _getwrappedbasequerywithprojections.getWrappedBaseQueryWithProjections)({
23
+ baseQuery: baseSQL,
24
+ tableSchema,
25
+ query: query
26
+ });
27
+ return baseSQLWithFilterProjection;
28
+ };
29
+
30
+ //# sourceMappingURL=get-final-base-sql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../meerkat-core/src/get-final-base-sql/get-final-base-sql.ts"],"sourcesContent":["import { applyFilterParamsToBaseSQL } from \"../filter-params/filter-params-ast\";\nimport { getFilterParamsSQL } from \"../get-filter-params-sql/get-filter-params-sql\";\nimport { getWrappedBaseQueryWithProjections } from \"../get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections\";\nimport { Query } from \"../types/cube-types/query\";\nimport { TableSchema } from \"../types/cube-types/table\";\n\nexport const getFinalBaseSQL = async ({\n query,\n getQueryOutput,\n tableSchema,\n}: { query: Query, tableSchema: TableSchema, getQueryOutput: (query: string) => Promise<any> }) => {\n /**\n * Apply transformation to the supplied base query.\n * This involves updating the filter placeholder with the actual filter values.\n */\n const baseFilterParamsSQL = await getFilterParamsSQL({\n query: query,\n tableSchema,\n filterType: 'BASE_FILTER',\n getQueryOutput,\n });\n const baseSQL = applyFilterParamsToBaseSQL(\n tableSchema.sql,\n baseFilterParamsSQL\n );\n const baseSQLWithFilterProjection = getWrappedBaseQueryWithProjections({\n baseQuery: baseSQL,\n tableSchema,\n query: query,\n });\n return baseSQLWithFilterProjection;\n};\n \n"],"names":["getFinalBaseSQL","query","getQueryOutput","tableSchema","baseFilterParamsSQL","getFilterParamsSQL","filterType","baseSQL","applyFilterParamsToBaseSQL","sql","baseSQLWithFilterProjection","getWrappedBaseQueryWithProjections","baseQuery"],"mappings":";+BAMaA;;;eAAAA;;;iCAN8B;oCACR;oDACgB;AAI5C,MAAMA,kBAAkB,OAAO,EACpCC,KAAK,EACLC,cAAc,EACdC,WAAW,EACiF;IAC5F;;;GAGC,GACD,MAAMC,sBAAsB,MAAMC,IAAAA,sCAAkB,EAAC;QACnDJ,OAAOA;QACPE;QACAG,YAAY;QACZJ;IACF;IACA,MAAMK,UAAUC,IAAAA,2CAA0B,EACxCL,YAAYM,GAAG,EACfL;IAEF,MAAMM,8BAA8BC,IAAAA,sEAAkC,EAAC;QACrEC,WAAWL;QACXJ;QACAF,OAAOA;IACT;IACA,OAAOS;AACT"}
package/src/index.d.ts CHANGED
@@ -3,7 +3,9 @@ export * from './ast-deserializer/ast-deserializer';
3
3
  export { detectApplyContextParamsToBaseSQL } from './context-params/context-params-ast';
4
4
  export * from './cube-measure-transformer/cube-measure-transformer';
5
5
  export * from './cube-to-duckdb/cube-filter-to-duckdb';
6
- export { applyFilterParamsToBaseSQL, detectAllFilterParamsFromSQL, getFilterParamsAST, } from './filter-params/filter-params-ast';
6
+ export { applyFilterParamsToBaseSQL, detectAllFilterParamsFromSQL, getFilterParamsAST } from './filter-params/filter-params-ast';
7
+ export { getFilterParamsSQL } from './get-filter-params-sql/get-filter-params-sql';
8
+ export { getFinalBaseSQL } from './get-final-base-sql/get-final-base-sql';
7
9
  export { getWrappedBaseQueryWithProjections } from './get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections';
8
10
  export * from './joins/joins';
9
11
  export { FilterType } from './types/cube-types';
package/src/index.js CHANGED
@@ -18,6 +18,12 @@ _export(exports, {
18
18
  getFilterParamsAST: function() {
19
19
  return _filterparamsast.getFilterParamsAST;
20
20
  },
21
+ getFilterParamsSQL: function() {
22
+ return _getfilterparamssql.getFilterParamsSQL;
23
+ },
24
+ getFinalBaseSQL: function() {
25
+ return _getfinalbasesql.getFinalBaseSQL;
26
+ },
21
27
  getWrappedBaseQueryWithProjections: function() {
22
28
  return _getwrappedbasequerywithprojections.getWrappedBaseQueryWithProjections;
23
29
  },
@@ -41,6 +47,8 @@ const _contextparamsast = require("./context-params/context-params-ast");
41
47
  _export_star._(require("./cube-measure-transformer/cube-measure-transformer"), exports);
42
48
  _export_star._(require("./cube-to-duckdb/cube-filter-to-duckdb"), exports);
43
49
  const _filterparamsast = require("./filter-params/filter-params-ast");
50
+ const _getfilterparamssql = require("./get-filter-params-sql/get-filter-params-sql");
51
+ const _getfinalbasesql = require("./get-final-base-sql/get-final-base-sql");
44
52
  const _getwrappedbasequerywithprojections = require("./get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections");
45
53
  _export_star._(require("./joins/joins"), exports);
46
54
  const _cubetypes = require("./types/cube-types");
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../meerkat-core/src/index.ts"],"sourcesContent":["export * from './ast-builder/ast-builder';\nexport * from './ast-deserializer/ast-deserializer';\nexport { detectApplyContextParamsToBaseSQL } from './context-params/context-params-ast';\nexport * from './cube-measure-transformer/cube-measure-transformer';\nexport * from './cube-to-duckdb/cube-filter-to-duckdb';\nexport {\n applyFilterParamsToBaseSQL,\n detectAllFilterParamsFromSQL,\n getFilterParamsAST,\n} from './filter-params/filter-params-ast';\nexport { getWrappedBaseQueryWithProjections } from './get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections';\nexport * from './joins/joins';\nexport { FilterType } from './types/cube-types';\nexport * from './types/cube-types/index';\nexport * from './types/duckdb-serialization-types/index';\nexport { BASE_TABLE_NAME } from './utils/base-ast';\nexport * from './utils/cube-to-table-schema';\nexport * from './utils/get-possible-nodes';\nexport { meerkatPlaceholderReplacer } from './utils/meerkat-placeholder-replacer';\nexport { memberKeyToSafeKey } from './utils/member-key-to-safe-key';\n"],"names":["detectApplyContextParamsToBaseSQL","applyFilterParamsToBaseSQL","detectAllFilterParamsFromSQL","getFilterParamsAST","getWrappedBaseQueryWithProjections","FilterType","BASE_TABLE_NAME","meerkatPlaceholderReplacer","memberKeyToSafeKey"],"mappings":";;;;;;;;IAESA,iCAAiC;eAAjCA,mDAAiC;;IAIxCC,0BAA0B;eAA1BA,2CAA0B;;IAC1BC,4BAA4B;eAA5BA,6CAA4B;;IAC5BC,kBAAkB;eAAlBA,mCAAkB;;IAEXC,kCAAkC;eAAlCA,sEAAkC;;IAElCC,UAAU;eAAVA,qBAAU;;IAGVC,eAAe;eAAfA,wBAAe;;IAGfC,0BAA0B;eAA1BA,sDAA0B;;IAC1BC,kBAAkB;eAAlBA,sCAAkB;;;;uBAnBb;uBACA;kCACoC;uBACpC;uBACA;iCAKP;oDAC4C;uBACrC;2BACa;uBACb;uBACA;yBACkB;uBAClB;uBACA;4CAC6B;oCACR"}
1
+ {"version":3,"sources":["../../../meerkat-core/src/index.ts"],"sourcesContent":["export * from './ast-builder/ast-builder';\nexport * from './ast-deserializer/ast-deserializer';\nexport { detectApplyContextParamsToBaseSQL } from './context-params/context-params-ast';\nexport * from './cube-measure-transformer/cube-measure-transformer';\nexport * from './cube-to-duckdb/cube-filter-to-duckdb';\nexport {\n applyFilterParamsToBaseSQL,\n detectAllFilterParamsFromSQL,\n getFilterParamsAST\n} from './filter-params/filter-params-ast';\nexport { getFilterParamsSQL } from './get-filter-params-sql/get-filter-params-sql';\nexport { getFinalBaseSQL } from './get-final-base-sql/get-final-base-sql';\nexport { getWrappedBaseQueryWithProjections } from './get-wrapped-base-query-with-projections/get-wrapped-base-query-with-projections';\nexport * from './joins/joins';\nexport { FilterType } from './types/cube-types';\nexport * from './types/cube-types/index';\nexport * from './types/duckdb-serialization-types/index';\nexport { BASE_TABLE_NAME } from './utils/base-ast';\nexport * from './utils/cube-to-table-schema';\nexport * from './utils/get-possible-nodes';\nexport { meerkatPlaceholderReplacer } from './utils/meerkat-placeholder-replacer';\nexport { memberKeyToSafeKey } from './utils/member-key-to-safe-key';\n\n"],"names":["detectApplyContextParamsToBaseSQL","applyFilterParamsToBaseSQL","detectAllFilterParamsFromSQL","getFilterParamsAST","getFilterParamsSQL","getFinalBaseSQL","getWrappedBaseQueryWithProjections","FilterType","BASE_TABLE_NAME","meerkatPlaceholderReplacer","memberKeyToSafeKey"],"mappings":";;;;;;;;IAESA,iCAAiC;eAAjCA,mDAAiC;;IAIxCC,0BAA0B;eAA1BA,2CAA0B;;IAC1BC,4BAA4B;eAA5BA,6CAA4B;;IAC5BC,kBAAkB;eAAlBA,mCAAkB;;IAEXC,kBAAkB;eAAlBA,sCAAkB;;IAClBC,eAAe;eAAfA,gCAAe;;IACfC,kCAAkC;eAAlCA,sEAAkC;;IAElCC,UAAU;eAAVA,qBAAU;;IAGVC,eAAe;eAAfA,wBAAe;;IAGfC,0BAA0B;eAA1BA,sDAA0B;;IAC1BC,kBAAkB;eAAlBA,sCAAkB;;;;uBArBb;uBACA;kCACoC;uBACpC;uBACA;iCAKP;oCAC4B;iCACH;oDACmB;uBACrC;2BACa;uBACb;uBACA;yBACkB;uBAClB;uBACA;4CAC6B;oCACR"}