@@ -14,17 +14,17 @@ interface SharedTableOptions {
1414 localOnly ?: boolean ;
1515 insertOnly ?: boolean ;
1616 viewName ?: string ;
17- trackOld ?: boolean | TrackOldOptions ;
17+ trackPrevious ?: boolean | TrackPreviousOptions ;
1818 trackMetadata ?: boolean ;
1919 ignoreEmptyUpdates ?: boolean ;
2020}
2121
22- /** Whether to include old columns when PowerSync tracks local changes.
22+ /** Whether to include previous column values when PowerSync tracks local changes.
2323 *
24- * Including old columns may be helpful for some backend connector implementations, which is
24+ * Including old values may be helpful for some backend connector implementations, which is
2525 * why it can be enabled on per-table or per-columm basis.
2626 */
27- export interface TrackOldOptions {
27+ export interface TrackPreviousOptions {
2828 /** When defined, a list of column names for which old values should be tracked. */
2929 columns ?: string [ ] ;
3030 /** When enabled, only include values that have actually been changed by an update. */
@@ -56,7 +56,7 @@ export const DEFAULT_TABLE_OPTIONS = {
5656 indexes : [ ] ,
5757 insertOnly : false ,
5858 localOnly : false ,
59- trackOld : false ,
59+ trackPrevious : false ,
6060 trackMetadata : false ,
6161 ignoreEmptyUpdates : false
6262} ;
@@ -200,7 +200,7 @@ export class Table<Columns extends ColumnsType = ColumnsType> {
200200 viewName : options ?. viewName ,
201201 insertOnly : options ?. insertOnly ,
202202 localOnly : options ?. localOnly ,
203- trackOld : options ?. trackOld ,
203+ trackPrevious : options ?. trackPrevious ,
204204 trackMetadata : options ?. trackMetadata ,
205205 ignoreEmptyUpdates : options ?. ignoreEmptyUpdates
206206 } ;
@@ -212,7 +212,7 @@ export class Table<Columns extends ColumnsType = ColumnsType> {
212212 private applyDefaultOptions ( ) {
213213 this . options . insertOnly ??= DEFAULT_TABLE_OPTIONS . insertOnly ;
214214 this . options . localOnly ??= DEFAULT_TABLE_OPTIONS . localOnly ;
215- this . options . trackOld ??= DEFAULT_TABLE_OPTIONS . trackOld ;
215+ this . options . trackPrevious ??= DEFAULT_TABLE_OPTIONS . trackPrevious ;
216216 this . options . trackMetadata ??= DEFAULT_TABLE_OPTIONS . trackMetadata ;
217217 this . options . ignoreEmptyUpdates ??= DEFAULT_TABLE_OPTIONS . ignoreEmptyUpdates ;
218218 }
@@ -255,8 +255,8 @@ export class Table<Columns extends ColumnsType = ColumnsType> {
255255 return this . options . insertOnly ! ;
256256 }
257257
258- get trackOld ( ) {
259- return this . options . trackOld ! ;
258+ get trackPrevious ( ) {
259+ return this . options . trackPrevious ! ;
260260 }
261261
262262 get trackMetadata ( ) {
@@ -301,7 +301,7 @@ export class Table<Columns extends ColumnsType = ColumnsType> {
301301 if ( this . trackMetadata && this . localOnly ) {
302302 throw new Error ( `Can't include metadata for local-only tables.` ) ;
303303 }
304- if ( this . trackOld != false && this . localOnly ) {
304+ if ( this . trackPrevious != false && this . localOnly ) {
305305 throw new Error ( `Can't include old values for local-only tables.` ) ;
306306 }
307307
@@ -341,15 +341,15 @@ export class Table<Columns extends ColumnsType = ColumnsType> {
341341 }
342342
343343 toJSON ( ) {
344- const trackOld = this . trackOld ;
344+ const trackPrevious = this . trackPrevious ;
345345
346346 return {
347347 name : this . name ,
348348 view_name : this . viewName ,
349349 local_only : this . localOnly ,
350350 insert_only : this . insertOnly ,
351- include_old : trackOld && ( ( trackOld as any ) . columns ?? true ) ,
352- include_old_only_when_changed : typeof trackOld == 'object' && trackOld . onlyWhenChanged == true ,
351+ include_old : trackPrevious && ( ( trackPrevious as any ) . columns ?? true ) ,
352+ include_old_only_when_changed : typeof trackPrevious == 'object' && trackPrevious . onlyWhenChanged == true ,
353353 include_metadata : this . trackMetadata ,
354354 ignore_empty_update : this . ignoreEmptyUpdates ,
355355 columns : this . columns . map ( ( c ) => c . toJSON ( ) ) ,
0 commit comments