@@ -58,7 +58,7 @@ export function compileQuery(
58
58
collections : Record < string , Collection < any , any , any , any , any > > ,
59
59
subscriptions : Record < string , CollectionSubscription > ,
60
60
callbacks : Record < string , LazyCollectionCallbacks > ,
61
- lazyCollections : Set < string > ,
61
+ lazySources : Set < string > ,
62
62
optimizableOrderByCollections : Record < string , OrderByOptimizationInfo > ,
63
63
cache : QueryCache = new WeakMap ( ) ,
64
64
queryMapping : QueryMapping = new WeakMap ( )
@@ -83,13 +83,13 @@ export function compileQuery(
83
83
// the live layer can subscribe to every alias the optimizer introduces.
84
84
const aliasToCollectionId : Record < string , string > = { }
85
85
86
- // Create a map of table aliases to inputs
86
+ // Create a map of source aliases to input streams
87
87
// Note: alias keys take precedence over collection keys for input resolution
88
- const tables : Record < string , KeyedStream > = { }
88
+ const sources : Record < string , KeyedStream > = { }
89
89
90
- // Process the FROM clause to get the main table
90
+ // Process the FROM clause to get the main source
91
91
const {
92
- alias : mainTableAlias ,
92
+ alias : mainSource ,
93
93
input : mainInput ,
94
94
collectionId : mainCollectionId ,
95
95
} = processFrom (
@@ -98,19 +98,19 @@ export function compileQuery(
98
98
collections ,
99
99
subscriptions ,
100
100
callbacks ,
101
- lazyCollections ,
101
+ lazySources ,
102
102
optimizableOrderByCollections ,
103
103
cache ,
104
104
queryMapping ,
105
105
aliasToCollectionId
106
106
)
107
- tables [ mainTableAlias ] = mainInput
107
+ sources [ mainSource ] = mainInput
108
108
109
- // Prepare the initial pipeline with the main table wrapped in its alias
109
+ // Prepare the initial pipeline with the main source wrapped in its alias
110
110
let pipeline : NamespacedAndKeyedStream = mainInput . pipe (
111
111
map ( ( [ key , row ] ) => {
112
112
// Initialize the record with a nested structure
113
- const ret = [ key , { [ mainTableAlias ] : row } ] as [
113
+ const ret = [ key , { [ mainSource ] : row } ] as [
114
114
string ,
115
115
Record < string , typeof row > ,
116
116
]
@@ -123,16 +123,16 @@ export function compileQuery(
123
123
pipeline = processJoins (
124
124
pipeline ,
125
125
query . join ,
126
- tables ,
126
+ sources ,
127
127
mainCollectionId ,
128
- mainTableAlias ,
128
+ mainSource ,
129
129
allInputs ,
130
130
cache ,
131
131
queryMapping ,
132
132
collections ,
133
133
subscriptions ,
134
134
callbacks ,
135
- lazyCollections ,
135
+ lazySources ,
136
136
optimizableOrderByCollections ,
137
137
rawQuery ,
138
138
compileQuery ,
@@ -193,7 +193,7 @@ export function compileQuery(
193
193
map ( ( [ key , namespacedRow ] ) => {
194
194
const selectResults =
195
195
! query . join && ! query . groupBy
196
- ? namespacedRow [ mainTableAlias ]
196
+ ? namespacedRow [ mainSource ]
197
197
: namespacedRow
198
198
199
199
return [
@@ -340,7 +340,7 @@ function processFrom(
340
340
collections : Record < string , Collection > ,
341
341
subscriptions : Record < string , CollectionSubscription > ,
342
342
callbacks : Record < string , LazyCollectionCallbacks > ,
343
- lazyCollections : Set < string > ,
343
+ lazySources : Set < string > ,
344
344
optimizableOrderByCollections : Record < string , OrderByOptimizationInfo > ,
345
345
cache : QueryCache ,
346
346
queryMapping : QueryMapping ,
@@ -370,7 +370,7 @@ function processFrom(
370
370
collections ,
371
371
subscriptions ,
372
372
callbacks ,
373
- lazyCollections ,
373
+ lazySources ,
374
374
optimizableOrderByCollections ,
375
375
cache ,
376
376
queryMapping
0 commit comments