@@ -22,31 +22,32 @@ export interface PlannedQueryInnerJoin<Node> {
2222
2323export type PlannedQueryJoin < Node > = PlannedQueryInnerJoin < Node > | PlannedQueryCrossJoin < Node > ;
2424
25- export interface PlannedQueryLinear < Node , Goal extends Node > {
25+ export interface PlannedQueryLinear < Node , Goal extends Node , Actor extends Node > {
2626 goalTable : Goal ;
27+ actorTable : Actor ;
2728 goalFilters : readonly RuleFilter [ ] ;
2829 joins : readonly PlannedQueryJoin < Node > [ ] ;
2930}
3031
31- export interface PlannedQueryUnion < Node , Goal extends Node > {
32- alternatives : readonly PlannedQueryLinear < Node , Goal > [ ] ;
32+ export interface PlannedQueryUnion < Node , Goal extends Node , Actor extends Node > {
33+ alternatives : readonly PlannedQueryLinear < Node , Goal , Actor > [ ] ;
3334}
3435
35- export type PlannedQuery < Node , Goal extends Node > = PlannedQueryUnion < Node , Goal > ;
36+ export type PlannedQuery < Node , Goal extends Node , Actor extends Node > = PlannedQueryUnion < Node , Goal , Actor > ;
3637
37- export function planQuery < Node , Relation , Role , Permission extends string , Goal extends Node > (
38+ export function planQuery < Node , Relation , Role , Permission extends string , Goal extends Node , Actor extends Node > (
3839 schema : Schema < Node , Relation , Role , Permission > ,
3940 solutions : Solution < Node , Relation , Role , Goal > ,
40- ) : PlannedQuery < Node , Goal > {
41+ ) : PlannedQuery < Node , Goal , Actor > {
4142 return {
4243 alternatives : solutions . map ( ( chain ) => planRuleChain ( schema , chain ) ) ,
4344 } ;
4445}
4546
46- export function planRuleChain < Node , Relation , Role , Permission extends string , Goal extends Node > (
47+ export function planRuleChain < Node , Relation , Role , Permission extends string , Goal extends Node , Actor extends Node > (
4748 schema : Schema < Node , Relation , Role , Permission > ,
4849 chain : SolutionChain < Node , Relation , Role > ,
49- ) : PlannedQueryLinear < Node , Goal > {
50+ ) : PlannedQueryLinear < Node , Goal , Actor > {
5051 const goalRule = chain . extensions . length === 0 ? chain . direct : chain . extensions [ chain . extensions . length - 1 ] ! ;
5152 const goalNodeDefinition = getNodeDefinition ( schema , goalRule . node ) ;
5253 const goalFilters = [ ...( goalNodeDefinition . defaultFilters ?? [ ] ) , ...( goalRule . filters ?? [ ] ) ] ;
@@ -136,6 +137,7 @@ export function planRuleChain<Node, Relation, Role, Permission extends string, G
136137
137138 return {
138139 goalTable : goalRule . node as Goal ,
140+ actorTable : rule . actorNode as Actor ,
139141 goalFilters,
140142 joins,
141143 } ;
0 commit comments