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.
Files changed (157) hide show
  1. package/dist/adapters/ActivityGridChart.config-CdlJDnCR.js +1 -0
  2. package/dist/adapters/ActivityGridChart.config-Cy7tAJHt.cjs +1 -0
  3. package/dist/adapters/AreaChart.config-B61Wt-XY.cjs +1 -0
  4. package/dist/adapters/AreaChart.config-BgTapvuO.js +1 -0
  5. package/dist/adapters/BarChart.config-BZLllkwR.js +1 -0
  6. package/dist/adapters/BarChart.config-CQVNwcqJ.cjs +1 -0
  7. package/dist/adapters/BoxPlotChart.config-BDXhAjrd.js +1 -0
  8. package/dist/adapters/BoxPlotChart.config-CcQy90SP.cjs +1 -0
  9. package/dist/adapters/BubbleChart.config-CdGDPvN9.js +1 -0
  10. package/dist/adapters/BubbleChart.config-Cx3uExZq.cjs +1 -0
  11. package/dist/adapters/CandlestickChart.config-B4Qxur_x.js +1 -0
  12. package/dist/adapters/CandlestickChart.config-YT_6A9xL.cjs +1 -0
  13. package/dist/adapters/DataTable.config-Bv140_40.js +1 -0
  14. package/dist/adapters/DataTable.config-YqoypToP.cjs +1 -0
  15. package/dist/adapters/DotStripChart.config-Cz0wng2q.js +1 -0
  16. package/dist/adapters/DotStripChart.config-DHs10-I6.cjs +1 -0
  17. package/dist/adapters/FunnelChart.config-B5gyLuRJ.js +1 -0
  18. package/dist/adapters/FunnelChart.config-Ba6GNiGf.cjs +1 -0
  19. package/dist/adapters/GaugeChart.config-BBeNsqth.cjs +1 -0
  20. package/dist/adapters/GaugeChart.config-Cn8B45bG.js +1 -0
  21. package/dist/adapters/HeatMapChart.config-Diiux_jA.js +1 -0
  22. package/dist/adapters/HeatMapChart.config-PH7qrzoR.cjs +1 -0
  23. package/dist/adapters/KpiDelta.config-C3sK7h_Y.cjs +1 -0
  24. package/dist/adapters/KpiDelta.config-DNsEf8q5.js +1 -0
  25. package/dist/adapters/KpiNumber.config-DMto69ey.js +1 -0
  26. package/dist/adapters/KpiNumber.config-T5NjXmaU.cjs +1 -0
  27. package/dist/adapters/KpiText.config-BBscYFvr.cjs +1 -0
  28. package/dist/adapters/KpiText.config-Clqw49rV.js +1 -0
  29. package/dist/adapters/LineChart.config-BXT1f6SL.js +1 -0
  30. package/dist/adapters/LineChart.config-C4JLdRlQ.cjs +1 -0
  31. package/dist/adapters/MarkdownChart.config-BVPEqdmk.js +1 -0
  32. package/dist/adapters/MarkdownChart.config-L1dZvved.cjs +1 -0
  33. package/dist/adapters/MeasureProfileChart.config-BEYesnOE.cjs +1 -0
  34. package/dist/adapters/MeasureProfileChart.config-BWBn5Ufu.js +1 -0
  35. package/dist/adapters/PieChart.config-DGO4YBBO.cjs +1 -0
  36. package/dist/adapters/PieChart.config-Dipc_4rA.js +1 -0
  37. package/dist/adapters/ProportionBarChart.config-CMSZzDrt.cjs +1 -0
  38. package/dist/adapters/ProportionBarChart.config-DMzp9OpQ.js +1 -0
  39. package/dist/adapters/RadarChart.config-D5Dkrz_P.js +1 -0
  40. package/dist/adapters/RadarChart.config-a8KDrZ_A.cjs +1 -0
  41. package/dist/adapters/RadialBarChart.config-BUrqfpZy.js +1 -0
  42. package/dist/adapters/RadialBarChart.config-Cgx9Mnf7.cjs +1 -0
  43. package/dist/adapters/RecordsTable.config-Bm16AvLg.js +1 -0
  44. package/dist/adapters/RecordsTable.config-DkSpIhCX.cjs +1 -0
  45. package/dist/adapters/RetentionCombinedChart.config-Bt9N6g6q.js +1 -0
  46. package/dist/adapters/RetentionCombinedChart.config-DFuha4B8.cjs +1 -0
  47. package/dist/adapters/RetentionHeatmap.config-CcI1CYgr.cjs +1 -0
  48. package/dist/adapters/RetentionHeatmap.config-NglipuwR.js +1 -0
  49. package/dist/adapters/SankeyChart.config-Bt_6Pt5G.js +1 -0
  50. package/dist/adapters/SankeyChart.config-D9EpwAgM.cjs +1 -0
  51. package/dist/adapters/ScatterChart.config-BZ2hKqQL.cjs +1 -0
  52. package/dist/adapters/ScatterChart.config-C0xqkTT6.js +1 -0
  53. package/dist/adapters/SunburstChart.config-CaXrimM6.cjs +1 -0
  54. package/dist/adapters/SunburstChart.config-wN22SSMt.js +1 -0
  55. package/dist/adapters/TreeMapChart.config-1McQooxX.cjs +1 -0
  56. package/dist/adapters/TreeMapChart.config-DEcM1Fzj.js +1 -0
  57. package/dist/adapters/WaterfallChart.config-D_R7Q5Tn.cjs +1 -0
  58. package/dist/adapters/WaterfallChart.config-NembTdNT.js +1 -0
  59. package/dist/adapters/core/index.cjs +1 -1
  60. package/dist/adapters/core/index.js +1 -1
  61. package/dist/adapters/{core-BRTPRfEe.js → core-B8Seo5iB.js} +2 -2
  62. package/dist/adapters/{core-CJf7rli4.cjs → core-C4mx1OLx.cjs} +1 -1
  63. package/dist/adapters/cors-headers-D7UhXzUg.cjs +166 -0
  64. package/dist/adapters/{cors-headers-BX2A9J6C.js → cors-headers-DoAQ8ag3.js} +1190 -1118
  65. package/dist/adapters/express/index.cjs +1 -1
  66. package/dist/adapters/express/index.js +5 -5
  67. package/dist/adapters/fastify/index.cjs +1 -1
  68. package/dist/adapters/fastify/index.js +5 -5
  69. package/dist/adapters/{handler-jw9QNNDF.js → handler-BZsZwv47.js} +32 -32
  70. package/dist/adapters/{handler-DOEcbA0X.cjs → handler-Dzz5-nK0.cjs} +3 -3
  71. package/dist/adapters/hono/index.cjs +1 -1
  72. package/dist/adapters/hono/index.js +4 -4
  73. package/dist/adapters/mcp-tools.cjs +1 -1
  74. package/dist/adapters/mcp-tools.js +2 -2
  75. package/dist/adapters/{mcp-transport-DjLdLg6f.js → mcp-transport-BAT-mFov.js} +1 -1
  76. package/dist/adapters/{mcp-transport-C9CdE_nI.cjs → mcp-transport-DNIGxA-S.cjs} +1 -1
  77. package/dist/adapters/nextjs/index.cjs +1 -1
  78. package/dist/adapters/nextjs/index.js +5 -5
  79. package/dist/adapters/{openai-BM1JtLnS.js → openai-Bv1uxsJs.js} +1 -1
  80. package/dist/adapters/{openai-CKzv-__C.cjs → openai-C8uDbt_1.cjs} +1 -1
  81. package/dist/adapters/{openai-DhGe8nnM.cjs → openai-DYZ_X2Rt.cjs} +2 -2
  82. package/dist/adapters/{openai-Drewiwxe.js → openai-Dk2PIadO.js} +1 -1
  83. package/dist/adapters/utils-CC-q0Mgi.cjs +235 -0
  84. package/dist/adapters/{utils-C28CRCDA.js → utils-Ch1LslK8.js} +1400 -1380
  85. package/dist/adapters/utils.cjs +1 -1
  86. package/dist/adapters/utils.js +1 -1
  87. package/dist/cjs/server/builders/filter-builder.d.ts +1 -1
  88. package/dist/cjs/server/cube-utils.d.ts +24 -1
  89. package/dist/cjs/server/physical-plan/processors/joins-processor.d.ts +36 -4
  90. package/dist/cjs/server/types/cube.d.ts +4 -1
  91. package/dist/server/builders/filter-builder.d.ts +1 -1
  92. package/dist/server/cube-utils.d.ts +24 -1
  93. package/dist/server/index.cjs +41 -41
  94. package/dist/server/index.js +2584 -2498
  95. package/dist/server/physical-plan/processors/joins-processor.d.ts +36 -4
  96. package/dist/server/types/cube.d.ts +4 -1
  97. package/package.json +1 -1
  98. package/dist/adapters/ActivityGridChart.config-Brl8VIv8.js +0 -1
  99. package/dist/adapters/ActivityGridChart.config-Z88CPfN_.cjs +0 -1
  100. package/dist/adapters/AreaChart.config-D_iv7GMa.cjs +0 -1
  101. package/dist/adapters/AreaChart.config-DmSlVDRP.js +0 -1
  102. package/dist/adapters/BarChart.config-CfB1IZJq.cjs +0 -1
  103. package/dist/adapters/BarChart.config-D828Hoh7.js +0 -1
  104. package/dist/adapters/BoxPlotChart.config-MSR6Wonu.js +0 -1
  105. package/dist/adapters/BoxPlotChart.config-gaB-jgE6.cjs +0 -1
  106. package/dist/adapters/BubbleChart.config-BLB9BxiL.cjs +0 -1
  107. package/dist/adapters/BubbleChart.config-DbAsJkxT.js +0 -1
  108. package/dist/adapters/CandlestickChart.config-B8yFjjAy.cjs +0 -1
  109. package/dist/adapters/CandlestickChart.config-s0iea6IT.js +0 -1
  110. package/dist/adapters/DataTable.config-ByJnmZT6.js +0 -1
  111. package/dist/adapters/DataTable.config-DFohPH0I.cjs +0 -1
  112. package/dist/adapters/DotStripChart.config-BZi5kHh0.js +0 -1
  113. package/dist/adapters/DotStripChart.config-DIdm4WD5.cjs +0 -1
  114. package/dist/adapters/FunnelChart.config-B0epceQ2.js +0 -1
  115. package/dist/adapters/FunnelChart.config-CidRJ2EL.cjs +0 -1
  116. package/dist/adapters/GaugeChart.config-C9UVds4X.cjs +0 -1
  117. package/dist/adapters/GaugeChart.config-D-88R3n9.js +0 -1
  118. package/dist/adapters/HeatMapChart.config-Cd3O1U0w.js +0 -1
  119. package/dist/adapters/HeatMapChart.config-NhPrJARC.cjs +0 -1
  120. package/dist/adapters/KpiDelta.config-CgG_L52r.js +0 -1
  121. package/dist/adapters/KpiDelta.config-DBJjMWTP.cjs +0 -1
  122. package/dist/adapters/KpiNumber.config-CK0dud_H.cjs +0 -1
  123. package/dist/adapters/KpiNumber.config-RBfyIgjk.js +0 -1
  124. package/dist/adapters/KpiText.config-3TNqsMbG.cjs +0 -1
  125. package/dist/adapters/KpiText.config-rkxuhMf5.js +0 -1
  126. package/dist/adapters/LineChart.config-BXTpUv_Z.cjs +0 -1
  127. package/dist/adapters/LineChart.config-Bz7NwrES.js +0 -1
  128. package/dist/adapters/MarkdownChart.config-DHAcdYaD.cjs +0 -1
  129. package/dist/adapters/MarkdownChart.config-M_SW1vvN.js +0 -1
  130. package/dist/adapters/MeasureProfileChart.config-BvUBIaGN.js +0 -1
  131. package/dist/adapters/MeasureProfileChart.config-CcUa3dr2.cjs +0 -1
  132. package/dist/adapters/PieChart.config-BRZweCz5.js +0 -1
  133. package/dist/adapters/PieChart.config-NKxKWNd8.cjs +0 -1
  134. package/dist/adapters/ProportionBarChart.config-CBkjDME6.js +0 -1
  135. package/dist/adapters/ProportionBarChart.config-tzjoeGFy.cjs +0 -1
  136. package/dist/adapters/RadarChart.config-CuTbHDGb.cjs +0 -1
  137. package/dist/adapters/RadarChart.config-DLSS3CiE.js +0 -1
  138. package/dist/adapters/RadialBarChart.config-CxuklwqN.cjs +0 -1
  139. package/dist/adapters/RadialBarChart.config-PfwWUTSa.js +0 -1
  140. package/dist/adapters/RecordsTable.config-BNe8ojv4.js +0 -1
  141. package/dist/adapters/RecordsTable.config-yddVH42n.cjs +0 -1
  142. package/dist/adapters/RetentionCombinedChart.config-Dl8-cbGE.cjs +0 -1
  143. package/dist/adapters/RetentionCombinedChart.config-DnryqwYN.js +0 -1
  144. package/dist/adapters/RetentionHeatmap.config-Bph-fRMy.js +0 -1
  145. package/dist/adapters/RetentionHeatmap.config-CHzs2_1Q.cjs +0 -1
  146. package/dist/adapters/SankeyChart.config-BYlgeTn7.cjs +0 -1
  147. package/dist/adapters/SankeyChart.config-Dad87jgh.js +0 -1
  148. package/dist/adapters/ScatterChart.config-Bj93oK9Y.cjs +0 -1
  149. package/dist/adapters/ScatterChart.config-DYGaBeKm.js +0 -1
  150. package/dist/adapters/SunburstChart.config-2Y-0jHgq.js +0 -1
  151. package/dist/adapters/SunburstChart.config-B0h3F-Md.cjs +0 -1
  152. package/dist/adapters/TreeMapChart.config-BTqEGyLO.js +0 -1
  153. package/dist/adapters/TreeMapChart.config-_GICyIs6.cjs +0 -1
  154. package/dist/adapters/WaterfallChart.config-CvRXBknO.js +0 -1
  155. package/dist/adapters/WaterfallChart.config-tzyjZD2J.cjs +0 -1
  156. package/dist/adapters/cors-headers-DWxZHn6j.cjs +0 -166
  157. package/dist/adapters/utils-D5WIbilW.cjs +0 -235
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-D5WIbilW.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;
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;
@@ -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-C28CRCDA.js";
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(fieldExpr: AnyColumn | SQL, operator: FilterOperator, values: any[], field?: any, dateRangeInput?: string | string[] | null): SQL | null;
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
- * (a LEFT join of a cube without internal RIGHT/FULL joins). Shared with the
12
- * keys-deduplication CTE, which joins cubes the same way.
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
- /** Optional joins to other tables */
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(fieldExpr: AnyColumn | SQL, operator: FilterOperator, values: any[], field?: any, dateRangeInput?: string | string[] | null): SQL | null;
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
  */