drizzle-cube 0.15.1 → 0.15.2
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/adapters/ActivityGridChart.config-CdlJDnCR.js +1 -0
- package/dist/adapters/ActivityGridChart.config-Cy7tAJHt.cjs +1 -0
- package/dist/adapters/AreaChart.config-B61Wt-XY.cjs +1 -0
- package/dist/adapters/AreaChart.config-BgTapvuO.js +1 -0
- package/dist/adapters/BarChart.config-BZLllkwR.js +1 -0
- package/dist/adapters/BarChart.config-CQVNwcqJ.cjs +1 -0
- package/dist/adapters/BoxPlotChart.config-BDXhAjrd.js +1 -0
- package/dist/adapters/BoxPlotChart.config-CcQy90SP.cjs +1 -0
- package/dist/adapters/BubbleChart.config-CdGDPvN9.js +1 -0
- package/dist/adapters/BubbleChart.config-Cx3uExZq.cjs +1 -0
- package/dist/adapters/CandlestickChart.config-B4Qxur_x.js +1 -0
- package/dist/adapters/CandlestickChart.config-YT_6A9xL.cjs +1 -0
- package/dist/adapters/DataTable.config-Bv140_40.js +1 -0
- package/dist/adapters/DataTable.config-YqoypToP.cjs +1 -0
- package/dist/adapters/DotStripChart.config-Cz0wng2q.js +1 -0
- package/dist/adapters/DotStripChart.config-DHs10-I6.cjs +1 -0
- package/dist/adapters/FunnelChart.config-B5gyLuRJ.js +1 -0
- package/dist/adapters/FunnelChart.config-Ba6GNiGf.cjs +1 -0
- package/dist/adapters/GaugeChart.config-BBeNsqth.cjs +1 -0
- package/dist/adapters/GaugeChart.config-Cn8B45bG.js +1 -0
- package/dist/adapters/HeatMapChart.config-Diiux_jA.js +1 -0
- package/dist/adapters/HeatMapChart.config-PH7qrzoR.cjs +1 -0
- package/dist/adapters/KpiDelta.config-C3sK7h_Y.cjs +1 -0
- package/dist/adapters/KpiDelta.config-DNsEf8q5.js +1 -0
- package/dist/adapters/KpiNumber.config-DMto69ey.js +1 -0
- package/dist/adapters/KpiNumber.config-T5NjXmaU.cjs +1 -0
- package/dist/adapters/KpiText.config-BBscYFvr.cjs +1 -0
- package/dist/adapters/KpiText.config-Clqw49rV.js +1 -0
- package/dist/adapters/LineChart.config-BXT1f6SL.js +1 -0
- package/dist/adapters/LineChart.config-C4JLdRlQ.cjs +1 -0
- package/dist/adapters/MarkdownChart.config-BVPEqdmk.js +1 -0
- package/dist/adapters/MarkdownChart.config-L1dZvved.cjs +1 -0
- package/dist/adapters/MeasureProfileChart.config-BEYesnOE.cjs +1 -0
- package/dist/adapters/MeasureProfileChart.config-BWBn5Ufu.js +1 -0
- package/dist/adapters/PieChart.config-DGO4YBBO.cjs +1 -0
- package/dist/adapters/PieChart.config-Dipc_4rA.js +1 -0
- package/dist/adapters/ProportionBarChart.config-CMSZzDrt.cjs +1 -0
- package/dist/adapters/ProportionBarChart.config-DMzp9OpQ.js +1 -0
- package/dist/adapters/RadarChart.config-D5Dkrz_P.js +1 -0
- package/dist/adapters/RadarChart.config-a8KDrZ_A.cjs +1 -0
- package/dist/adapters/RadialBarChart.config-BUrqfpZy.js +1 -0
- package/dist/adapters/RadialBarChart.config-Cgx9Mnf7.cjs +1 -0
- package/dist/adapters/RecordsTable.config-Bm16AvLg.js +1 -0
- package/dist/adapters/RecordsTable.config-DkSpIhCX.cjs +1 -0
- package/dist/adapters/RetentionCombinedChart.config-Bt9N6g6q.js +1 -0
- package/dist/adapters/RetentionCombinedChart.config-DFuha4B8.cjs +1 -0
- package/dist/adapters/RetentionHeatmap.config-CcI1CYgr.cjs +1 -0
- package/dist/adapters/RetentionHeatmap.config-NglipuwR.js +1 -0
- package/dist/adapters/SankeyChart.config-Bt_6Pt5G.js +1 -0
- package/dist/adapters/SankeyChart.config-D9EpwAgM.cjs +1 -0
- package/dist/adapters/ScatterChart.config-BZ2hKqQL.cjs +1 -0
- package/dist/adapters/ScatterChart.config-C0xqkTT6.js +1 -0
- package/dist/adapters/SunburstChart.config-CaXrimM6.cjs +1 -0
- package/dist/adapters/SunburstChart.config-wN22SSMt.js +1 -0
- package/dist/adapters/TreeMapChart.config-1McQooxX.cjs +1 -0
- package/dist/adapters/TreeMapChart.config-DEcM1Fzj.js +1 -0
- package/dist/adapters/WaterfallChart.config-D_R7Q5Tn.cjs +1 -0
- package/dist/adapters/WaterfallChart.config-NembTdNT.js +1 -0
- package/dist/adapters/core/index.cjs +1 -1
- package/dist/adapters/core/index.js +1 -1
- package/dist/adapters/{core-BRTPRfEe.js → core-B8Seo5iB.js} +2 -2
- package/dist/adapters/{core-CJf7rli4.cjs → core-C4mx1OLx.cjs} +1 -1
- package/dist/adapters/cors-headers-D7UhXzUg.cjs +166 -0
- package/dist/adapters/{cors-headers-BX2A9J6C.js → cors-headers-DoAQ8ag3.js} +1190 -1118
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +5 -5
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +5 -5
- package/dist/adapters/{handler-jw9QNNDF.js → handler-BZsZwv47.js} +32 -32
- package/dist/adapters/{handler-DOEcbA0X.cjs → handler-Dzz5-nK0.cjs} +3 -3
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +4 -4
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +2 -2
- package/dist/adapters/{mcp-transport-DjLdLg6f.js → mcp-transport-BAT-mFov.js} +1 -1
- package/dist/adapters/{mcp-transport-C9CdE_nI.cjs → mcp-transport-DNIGxA-S.cjs} +1 -1
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +5 -5
- package/dist/adapters/{openai-BM1JtLnS.js → openai-Bv1uxsJs.js} +1 -1
- package/dist/adapters/{openai-CKzv-__C.cjs → openai-C8uDbt_1.cjs} +1 -1
- package/dist/adapters/{openai-DhGe8nnM.cjs → openai-DYZ_X2Rt.cjs} +2 -2
- package/dist/adapters/{openai-Drewiwxe.js → openai-Dk2PIadO.js} +1 -1
- package/dist/adapters/utils-CC-q0Mgi.cjs +235 -0
- package/dist/adapters/{utils-C28CRCDA.js → utils-Ch1LslK8.js} +1400 -1380
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.js +1 -1
- package/dist/cjs/server/builders/filter-builder.d.ts +1 -1
- package/dist/cjs/server/cube-utils.d.ts +24 -1
- package/dist/cjs/server/physical-plan/processors/joins-processor.d.ts +36 -4
- package/dist/cjs/server/types/cube.d.ts +4 -1
- package/dist/server/builders/filter-builder.d.ts +1 -1
- package/dist/server/cube-utils.d.ts +24 -1
- package/dist/server/index.cjs +41 -41
- package/dist/server/index.js +2584 -2498
- package/dist/server/physical-plan/processors/joins-processor.d.ts +36 -4
- package/dist/server/types/cube.d.ts +4 -1
- package/package.json +1 -1
- package/dist/adapters/ActivityGridChart.config-Brl8VIv8.js +0 -1
- package/dist/adapters/ActivityGridChart.config-Z88CPfN_.cjs +0 -1
- package/dist/adapters/AreaChart.config-D_iv7GMa.cjs +0 -1
- package/dist/adapters/AreaChart.config-DmSlVDRP.js +0 -1
- package/dist/adapters/BarChart.config-CfB1IZJq.cjs +0 -1
- package/dist/adapters/BarChart.config-D828Hoh7.js +0 -1
- package/dist/adapters/BoxPlotChart.config-MSR6Wonu.js +0 -1
- package/dist/adapters/BoxPlotChart.config-gaB-jgE6.cjs +0 -1
- package/dist/adapters/BubbleChart.config-BLB9BxiL.cjs +0 -1
- package/dist/adapters/BubbleChart.config-DbAsJkxT.js +0 -1
- package/dist/adapters/CandlestickChart.config-B8yFjjAy.cjs +0 -1
- package/dist/adapters/CandlestickChart.config-s0iea6IT.js +0 -1
- package/dist/adapters/DataTable.config-ByJnmZT6.js +0 -1
- package/dist/adapters/DataTable.config-DFohPH0I.cjs +0 -1
- package/dist/adapters/DotStripChart.config-BZi5kHh0.js +0 -1
- package/dist/adapters/DotStripChart.config-DIdm4WD5.cjs +0 -1
- package/dist/adapters/FunnelChart.config-B0epceQ2.js +0 -1
- package/dist/adapters/FunnelChart.config-CidRJ2EL.cjs +0 -1
- package/dist/adapters/GaugeChart.config-C9UVds4X.cjs +0 -1
- package/dist/adapters/GaugeChart.config-D-88R3n9.js +0 -1
- package/dist/adapters/HeatMapChart.config-Cd3O1U0w.js +0 -1
- package/dist/adapters/HeatMapChart.config-NhPrJARC.cjs +0 -1
- package/dist/adapters/KpiDelta.config-CgG_L52r.js +0 -1
- package/dist/adapters/KpiDelta.config-DBJjMWTP.cjs +0 -1
- package/dist/adapters/KpiNumber.config-CK0dud_H.cjs +0 -1
- package/dist/adapters/KpiNumber.config-RBfyIgjk.js +0 -1
- package/dist/adapters/KpiText.config-3TNqsMbG.cjs +0 -1
- package/dist/adapters/KpiText.config-rkxuhMf5.js +0 -1
- package/dist/adapters/LineChart.config-BXTpUv_Z.cjs +0 -1
- package/dist/adapters/LineChart.config-Bz7NwrES.js +0 -1
- package/dist/adapters/MarkdownChart.config-DHAcdYaD.cjs +0 -1
- package/dist/adapters/MarkdownChart.config-M_SW1vvN.js +0 -1
- package/dist/adapters/MeasureProfileChart.config-BvUBIaGN.js +0 -1
- package/dist/adapters/MeasureProfileChart.config-CcUa3dr2.cjs +0 -1
- package/dist/adapters/PieChart.config-BRZweCz5.js +0 -1
- package/dist/adapters/PieChart.config-NKxKWNd8.cjs +0 -1
- package/dist/adapters/ProportionBarChart.config-CBkjDME6.js +0 -1
- package/dist/adapters/ProportionBarChart.config-tzjoeGFy.cjs +0 -1
- package/dist/adapters/RadarChart.config-CuTbHDGb.cjs +0 -1
- package/dist/adapters/RadarChart.config-DLSS3CiE.js +0 -1
- package/dist/adapters/RadialBarChart.config-CxuklwqN.cjs +0 -1
- package/dist/adapters/RadialBarChart.config-PfwWUTSa.js +0 -1
- package/dist/adapters/RecordsTable.config-BNe8ojv4.js +0 -1
- package/dist/adapters/RecordsTable.config-yddVH42n.cjs +0 -1
- package/dist/adapters/RetentionCombinedChart.config-Dl8-cbGE.cjs +0 -1
- package/dist/adapters/RetentionCombinedChart.config-DnryqwYN.js +0 -1
- package/dist/adapters/RetentionHeatmap.config-Bph-fRMy.js +0 -1
- package/dist/adapters/RetentionHeatmap.config-CHzs2_1Q.cjs +0 -1
- package/dist/adapters/SankeyChart.config-BYlgeTn7.cjs +0 -1
- package/dist/adapters/SankeyChart.config-Dad87jgh.js +0 -1
- package/dist/adapters/ScatterChart.config-Bj93oK9Y.cjs +0 -1
- package/dist/adapters/ScatterChart.config-DYGaBeKm.js +0 -1
- package/dist/adapters/SunburstChart.config-2Y-0jHgq.js +0 -1
- package/dist/adapters/SunburstChart.config-B0h3F-Md.cjs +0 -1
- package/dist/adapters/TreeMapChart.config-BTqEGyLO.js +0 -1
- package/dist/adapters/TreeMapChart.config-_GICyIs6.cjs +0 -1
- package/dist/adapters/WaterfallChart.config-CvRXBknO.js +0 -1
- package/dist/adapters/WaterfallChart.config-tzyjZD2J.cjs +0 -1
- package/dist/adapters/cors-headers-DWxZHn6j.cjs +0 -166
- package/dist/adapters/utils-D5WIbilW.cjs +0 -235
package/dist/adapters/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-CC-q0Mgi.cjs");exports.buildTransformedQuery=e.t,exports.calculateQueryComplexity=e.n,exports.formatCubeResponse=e.r,exports.formatErrorResponse=e.i,exports.formatMetaResponse=e.a,exports.formatSqlResponse=e.o,exports.formatSqlString=e.x,exports.generateRequestId=e.s,exports.getDatabaseType=e.c,exports.handleBatchRequest=e.l,exports.handleDiscover=e.p,exports.handleDryRun=e.u,exports.handleLoad=e.m,exports.handleSuggest=e.d,exports.handleValidate=e.f,exports.normalizeQueryFields=e.h;
|
package/dist/adapters/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as buildTransformedQuery, n as calculateQueryComplexity, r as formatCubeResponse, i as formatErrorResponse, a as formatMetaResponse, o as formatSqlResponse, x as formatSqlString, s as generateRequestId, c as getDatabaseType, l as handleBatchRequest, p as handleDiscover, u as handleDryRun, m as handleLoad, d as handleSuggest, f as handleValidate, h as normalizeQueryFields } from "./utils-
|
|
1
|
+
export { t as buildTransformedQuery, n as calculateQueryComplexity, r as formatCubeResponse, i as formatErrorResponse, a as formatMetaResponse, o as formatSqlResponse, x as formatSqlString, s as generateRequestId, c as getDatabaseType, l as handleBatchRequest, p as handleDiscover, u as handleDryRun, m as handleLoad, d as handleSuggest, f as handleValidate, h as normalizeQueryFields } from "./utils-Ch1LslK8.js";
|
|
@@ -9,7 +9,7 @@ export declare class FilterBuilder {
|
|
|
9
9
|
/**
|
|
10
10
|
* Build filter condition using Drizzle operators
|
|
11
11
|
*/
|
|
12
|
-
buildFilterCondition(
|
|
12
|
+
buildFilterCondition(memberExpr: AnyColumn | SQL, operator: FilterOperator, values: any[], field?: any, dateRangeInput?: string | string[] | null): SQL | null;
|
|
13
13
|
/**
|
|
14
14
|
* Build a logical filter (AND/OR) - used by executor for cache preloading
|
|
15
15
|
* This handles nested filter structures and builds combined SQL
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
-
import { Cube, CubeJoin, Dimension, QueryContext, MultiCubeQueryContext, SqlExpression } from './types/index.js';
|
|
2
|
+
import { BaseQueryDefinition, Cube, CubeJoin, Dimension, QueryContext, MultiCubeQueryContext, SqlExpression } from './types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve cube reference (handles direct, lazy, and string name references)
|
|
5
5
|
*
|
|
@@ -111,6 +111,29 @@ export declare function resolveSqlExpression(expr: AnyColumn | SQL | ((ctx: Quer
|
|
|
111
111
|
* the filter builder, executor, and funnel/flow/retention builders.
|
|
112
112
|
*/
|
|
113
113
|
export declare function resolveFilterFieldExpr(dimension: Dimension, ctx: QueryContext): AnyColumn | SQL;
|
|
114
|
+
/**
|
|
115
|
+
* Parenthesize a member's SQL before a filter operator is applied to it.
|
|
116
|
+
* Drizzle's operators and `and()` don't parenthesize their operands, so a
|
|
117
|
+
* compound member such as `${salary} > 80000 OR ${active}` would otherwise
|
|
118
|
+
* bind looser than the cube's security filter it is ANDed with
|
|
119
|
+
* (GHSA-57v3-9jh5-x27m). A plain column is returned as-is so Drizzle keeps its
|
|
120
|
+
* type metadata for parameter binding.
|
|
121
|
+
*/
|
|
122
|
+
export declare function parenthesizeExpression(expr: AnyColumn | SQL): AnyColumn | SQL;
|
|
123
|
+
/**
|
|
124
|
+
* A cube's base query for this request, with its security `where`
|
|
125
|
+
* parenthesized so it stays one predicate wherever it is ANDed into a WHERE or
|
|
126
|
+
* JOIN ON clause. A raw template such as
|
|
127
|
+
* sql`${eq(t.org, org)} or ${isNull(t.org)}` would otherwise let the OR bind
|
|
128
|
+
* loosest and escape the conditions around it (GHSA-57v3-9jh5-x27m). Every
|
|
129
|
+
* read of a cube's `sql` for query building goes through here.
|
|
130
|
+
*/
|
|
131
|
+
export declare function resolveCubeBase(cube: Cube, ctx: QueryContext): BaseQueryDefinition;
|
|
132
|
+
/**
|
|
133
|
+
* A junction table's security conditions, each parenthesized for the same
|
|
134
|
+
* reason as a cube's `where` (see resolveCubeBase).
|
|
135
|
+
*/
|
|
136
|
+
export declare function resolveJunctionSecurity(securitySql: (securityContext: QueryContext['securityContext']) => SQL | SQL[], ctx: QueryContext): SQL[];
|
|
114
137
|
/**
|
|
115
138
|
* Helper to create multi-cube query context
|
|
116
139
|
*/
|
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
import { SQL } from 'drizzle-orm';
|
|
2
|
-
import { Cube, JoinCubePlanEntry, PhysicalQueryPlan, QueryContext } from '../../types/index.js';
|
|
2
|
+
import { Cube, JoinCubePlanEntry, PhysicalQueryPlan, QueryableRelation, QueryContext } from '../../types/index.js';
|
|
3
3
|
import { CTEBuildState, JoinBuildState, PhysicalBuildDependencies, SelectionMap } from './shared.js';
|
|
4
4
|
/**
|
|
5
5
|
* Applies CTEs and JOIN graph construction to the query builder.
|
|
6
6
|
*/
|
|
7
7
|
export declare function applyJoins(queryPlan: PhysicalQueryPlan, context: QueryContext, primaryCubeBase: ReturnType<Cube['sql']>, modifiedSelections: SelectionMap, cteState: CTEBuildState, deps: Pick<PhysicalBuildDependencies, 'cteBuilder'>): JoinBuildState;
|
|
8
|
+
/**
|
|
9
|
+
* The relation an inter-cube join targets: the cube's FROM table, or, when the
|
|
10
|
+
* cube's sql has intra-cube joins (BaseQueryDefinition.joins), the FROM table
|
|
11
|
+
* and those joins as one parenthesized join group. The outer join then keeps or
|
|
12
|
+
* drops each row of the cube as a whole: an intra-cube INNER JOIN cannot drop
|
|
13
|
+
* the outer query's unmatched rows, and the cube's WHERE can reference every
|
|
14
|
+
* table of the group.
|
|
15
|
+
*/
|
|
16
|
+
export declare function cubeJoinRelation(cubeBase: ReturnType<Cube['sql']>): QueryableRelation;
|
|
17
|
+
/**
|
|
18
|
+
* In a plan with a right or full cube join, a cube's or junction's FROM
|
|
19
|
+
* relation with its security WHERE already applied: all of the relation's
|
|
20
|
+
* columns (`select *`) as a derived table under the relation's own name, so
|
|
21
|
+
* column references resolve against it as they do against the relation. That
|
|
22
|
+
* includes columns the Drizzle table doesn't declare and column names that
|
|
23
|
+
* Drizzle's `casing` option converts. The caller applies the cube's
|
|
24
|
+
* intra-cube joins to it (see filtersOwnRows). Undefined in any other plan, and
|
|
25
|
+
* when a derived table can't stand in for the relation: it has no WHERE, its
|
|
26
|
+
* filter doesn't filter FROM alone, or its FROM is a view, raw SQL, an aliased
|
|
27
|
+
* table, or a table in a named schema, whose columns render with the schema
|
|
28
|
+
* prefix.
|
|
29
|
+
*/
|
|
30
|
+
export declare function filteredRelation(queryPlan: PhysicalQueryPlan, base: ReturnType<Cube['sql']> | undefined): SQL | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* True only when every part of `filter` is shown to read nothing but
|
|
33
|
+
* `relations`: a column of one of them, a bound value, or operator text. Raw
|
|
34
|
+
* SQL text, an identifier, another relation or its column, and anything else
|
|
35
|
+
* it can't classify make it false, so false means "unknown", not "reads
|
|
36
|
+
* another relation".
|
|
37
|
+
*/
|
|
38
|
+
export declare function filterReadsOnly(filter: SQL, relations: readonly QueryableRelation[]): boolean;
|
|
8
39
|
/**
|
|
9
40
|
* The WHERE condition (if any) that must accompany a non-INNER join whose
|
|
10
|
-
* security filter sits in the ON clause, or undefined when ON is enough
|
|
11
|
-
*
|
|
12
|
-
* keys-deduplication CTE, which joins cubes
|
|
41
|
+
* security filter sits in the ON clause, or undefined when ON is enough: a
|
|
42
|
+
* LEFT join keeps or drops the cube's join group as a whole (see
|
|
43
|
+
* cubeJoinRelation). Shared with the keys-deduplication CTE, which joins cubes
|
|
44
|
+
* the same way.
|
|
13
45
|
*/
|
|
14
46
|
export declare function buildJoinedCubeSecurityWhere(joinCube: JoinCubePlanEntry, cubeJoinType: 'left' | 'right' | 'full', joinCubeBase: ReturnType<Cube['sql']> | undefined, context: QueryContext): SQL | undefined;
|
|
@@ -30,7 +30,10 @@ export type QueryableRelation = Table | View | Subquery | SQL;
|
|
|
30
30
|
export interface BaseQueryDefinition {
|
|
31
31
|
/** Main table to query from */
|
|
32
32
|
from: QueryableRelation;
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Optional joins to other tables. Each join's `on` condition may reference
|
|
35
|
+
* only `from` and the tables of the joins before it.
|
|
36
|
+
*/
|
|
34
37
|
joins?: Array<{
|
|
35
38
|
table: QueryableRelation;
|
|
36
39
|
on: SQL;
|
|
@@ -9,7 +9,7 @@ export declare class FilterBuilder {
|
|
|
9
9
|
/**
|
|
10
10
|
* Build filter condition using Drizzle operators
|
|
11
11
|
*/
|
|
12
|
-
buildFilterCondition(
|
|
12
|
+
buildFilterCondition(memberExpr: AnyColumn | SQL, operator: FilterOperator, values: any[], field?: any, dateRangeInput?: string | string[] | null): SQL | null;
|
|
13
13
|
/**
|
|
14
14
|
* Build a logical filter (AND/OR) - used by executor for cache preloading
|
|
15
15
|
* This handles nested filter structures and builds combined SQL
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SQL, AnyColumn } from 'drizzle-orm';
|
|
2
|
-
import { Cube, CubeJoin, Dimension, QueryContext, MultiCubeQueryContext, SqlExpression } from './types/index.js';
|
|
2
|
+
import { BaseQueryDefinition, Cube, CubeJoin, Dimension, QueryContext, MultiCubeQueryContext, SqlExpression } from './types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve cube reference (handles direct, lazy, and string name references)
|
|
5
5
|
*
|
|
@@ -111,6 +111,29 @@ export declare function resolveSqlExpression(expr: AnyColumn | SQL | ((ctx: Quer
|
|
|
111
111
|
* the filter builder, executor, and funnel/flow/retention builders.
|
|
112
112
|
*/
|
|
113
113
|
export declare function resolveFilterFieldExpr(dimension: Dimension, ctx: QueryContext): AnyColumn | SQL;
|
|
114
|
+
/**
|
|
115
|
+
* Parenthesize a member's SQL before a filter operator is applied to it.
|
|
116
|
+
* Drizzle's operators and `and()` don't parenthesize their operands, so a
|
|
117
|
+
* compound member such as `${salary} > 80000 OR ${active}` would otherwise
|
|
118
|
+
* bind looser than the cube's security filter it is ANDed with
|
|
119
|
+
* (GHSA-57v3-9jh5-x27m). A plain column is returned as-is so Drizzle keeps its
|
|
120
|
+
* type metadata for parameter binding.
|
|
121
|
+
*/
|
|
122
|
+
export declare function parenthesizeExpression(expr: AnyColumn | SQL): AnyColumn | SQL;
|
|
123
|
+
/**
|
|
124
|
+
* A cube's base query for this request, with its security `where`
|
|
125
|
+
* parenthesized so it stays one predicate wherever it is ANDed into a WHERE or
|
|
126
|
+
* JOIN ON clause. A raw template such as
|
|
127
|
+
* sql`${eq(t.org, org)} or ${isNull(t.org)}` would otherwise let the OR bind
|
|
128
|
+
* loosest and escape the conditions around it (GHSA-57v3-9jh5-x27m). Every
|
|
129
|
+
* read of a cube's `sql` for query building goes through here.
|
|
130
|
+
*/
|
|
131
|
+
export declare function resolveCubeBase(cube: Cube, ctx: QueryContext): BaseQueryDefinition;
|
|
132
|
+
/**
|
|
133
|
+
* A junction table's security conditions, each parenthesized for the same
|
|
134
|
+
* reason as a cube's `where` (see resolveCubeBase).
|
|
135
|
+
*/
|
|
136
|
+
export declare function resolveJunctionSecurity(securitySql: (securityContext: QueryContext['securityContext']) => SQL | SQL[], ctx: QueryContext): SQL[];
|
|
114
137
|
/**
|
|
115
138
|
* Helper to create multi-cube query context
|
|
116
139
|
*/
|