@@ -3,6 +3,7 @@ import { BucketInclusionReason, BucketPriority, DEFAULT_BUCKET_PRIORITY } from '
3
3
import { BucketParameterQuerier , PendingQueriers } from '../BucketParameterQuerier.js' ;
4
4
import { BucketSource , BucketSourceType , ResultSetDescription } from '../BucketSource.js' ;
5
5
import { ColumnDefinition } from '../ExpressionType.js' ;
6
+ import { CompatibilityContext } from '../quirks.js' ;
6
7
import { SourceTableInterface } from '../SourceTableInterface.js' ;
7
8
import { GetQuerierOptions , RequestedStream } from '../SqlSyncRules.js' ;
8
9
import { TablePattern } from '../TablePattern.js' ;
@@ -12,8 +13,10 @@ import {
12
13
EvaluationResult ,
13
14
RequestParameters ,
14
15
SourceSchema ,
15
- SqliteRow
16
+ SqliteRow ,
17
+ TableRow
16
18
} from '../types.js' ;
19
+ import { applyRowContext } from '../utils.js' ;
17
20
import { StreamVariant } from './variant.js' ;
18
21
19
22
export class SyncStream implements BucketSource {
@@ -23,7 +26,11 @@ export class SyncStream implements BucketSource {
23
26
variants : StreamVariant [ ] ;
24
27
data : BaseSqlDataQuery ;
25
28
26
- constructor ( name : string , data : BaseSqlDataQuery ) {
29
+ constructor (
30
+ name : string ,
31
+ data : BaseSqlDataQuery ,
32
+ private readonly compatibility : CompatibilityContext
33
+ ) {
27
34
this . name = name ;
28
35
this . subscribedToByDefault = false ;
29
36
this . priority = DEFAULT_BUCKET_PRIORITY ;
@@ -165,13 +172,19 @@ export class SyncStream implements BucketSource {
165
172
}
166
173
167
174
const stream = this ;
175
+ const mappedRow = applyRowContext ( options . record , this . compatibility ) ;
176
+ const row : TableRow = {
177
+ sourceTable : options . sourceTable ,
178
+ record : mappedRow
179
+ } ;
180
+
168
181
return this . data . evaluateRowWithOptions ( {
169
182
table : options . sourceTable ,
170
- row : options . record ,
183
+ row : applyRowContext ( options . record , this . compatibility ) ,
171
184
bucketIds ( ) {
172
185
const bucketIds : string [ ] = [ ] ;
173
186
for ( const variant of stream . variants ) {
174
- bucketIds . push ( ...variant . bucketIdsForRow ( stream . name , options ) ) ;
187
+ bucketIds . push ( ...variant . bucketIdsForRow ( stream . name , row ) ) ;
175
188
}
176
189
177
190
return bucketIds ;
0 commit comments