diff --git a/.changeset/moody-hotels-happen.md b/.changeset/moody-hotels-happen.md new file mode 100644 index 00000000..7c986cf5 --- /dev/null +++ b/.changeset/moody-hotels-happen.md @@ -0,0 +1,5 @@ +--- +'@journeyapps/powersync-sdk-common': patch +--- + +Added `raw-data:true` to PowerSync instance streaming requests. This aides with server and client side OplogEntry processing. diff --git a/packages/powersync-sdk-common/src/client/sync/bucket/OplogEntry.ts b/packages/powersync-sdk-common/src/client/sync/bucket/OplogEntry.ts index 8b203d2b..3c4bcf55 100644 --- a/packages/powersync-sdk-common/src/client/sync/bucket/OplogEntry.ts +++ b/packages/powersync-sdk-common/src/client/sync/bucket/OplogEntry.ts @@ -7,7 +7,7 @@ export interface OplogEntryJSON { object_type: string; object_id: string; checksum: number; - data: string | object; + data: string; subkey: string | object; } @@ -20,7 +20,7 @@ export class OplogEntry { typeof row.subkey == 'string' ? row.subkey : JSON.stringify(row.subkey), row.object_type, row.object_id, - typeof row.data == 'string' ? JSON.parse(row.data) : row.data + row.data ); } @@ -31,7 +31,7 @@ export class OplogEntry { public subkey: string, public object_type?: string, public object_id?: string, - public data?: Record + public data?: string ) {} toJSON(): OplogEntryJSON { @@ -41,7 +41,7 @@ export class OplogEntry { object_type: this.object_type, object_id: this.object_id, checksum: this.checksum, - data: JSON.stringify(this.data), + data: this.data, subkey: JSON.stringify(this.subkey) }; } diff --git a/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts b/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts index cba9eff4..93abcd5f 100644 --- a/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +++ b/packages/powersync-sdk-common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts @@ -166,7 +166,8 @@ export abstract class AbstractStreamingSyncImplementation extends BaseObserver