1- import type { BSON } from 'bson' ;
21import { type fetch } from 'cross-fetch' ;
32import Logger , { ILogger } from 'js-logger' ;
43import { Requestable , RSocket , RSocketConnector } from 'rsocket-core' ;
@@ -15,8 +14,6 @@ import {
1514import { EventIterator } from 'event-iterator' ;
1615import type { Queue } from 'event-iterator/lib/event-iterator.js' ;
1716
18- export type BSONImplementation = typeof BSON ;
19-
2017export type RemoteConnector = {
2118 fetchCredentials : ( ) => Promise < PowerSyncCredentials | null > ;
2219 invalidateCredentials ?: ( ) => void ;
@@ -264,11 +261,6 @@ export abstract class AbstractRemote {
264261 return res . json ( ) ;
265262 }
266263
267- /**
268- * Provides a BSON implementation. The import nature of this varies depending on the platform
269- */
270- abstract getBSON ( ) : Promise < BSONImplementation > ;
271-
272264 /**
273265 * @returns A text decoder decoding UTF-8. This is a method to allow patching it for Hermes which doesn't support the
274266 * builtin, without forcing us to bundle a polyfill with `@powersync/common`.
@@ -285,26 +277,13 @@ export abstract class AbstractRemote {
285277 * Returns a data stream of sync line data, fetched via RSocket-over-WebSocket.
286278 *
287279 * The only mechanism to abort the returned stream is to use the abort signal in {@link SocketSyncStreamOptions}.
288- *
289- * @param bson A BSON encoder and decoder. When set, the data stream will be requested with a BSON payload
290- * (required for compatibility with older sync services).
291280 */
292- async socketStreamRaw (
293- options : SocketSyncStreamOptions ,
294- bson ?: typeof BSON
295- ) : Promise < SimpleAsyncIterator < Uint8Array > > {
281+ async socketStreamRaw ( options : SocketSyncStreamOptions ) : Promise < SimpleAsyncIterator < Uint8Array > > {
296282 const { path, fetchStrategy = FetchStrategy . Buffered } = options ;
297- const mimeType = bson == null ? 'application/json' : 'application/bson ';
283+ const mimeType = 'application/json' ;
298284
299285 function toBuffer ( js : any ) : Buffer {
300- let contents : any ;
301- if ( bson != null ) {
302- contents = bson . serialize ( js ) ;
303- } else {
304- contents = JSON . stringify ( js ) ;
305- }
306-
307- return Buffer . from ( contents ) ;
286+ return Buffer . from ( JSON . stringify ( js ) ) ;
308287 }
309288
310289 const syncQueueRequestSize = fetchStrategy == FetchStrategy . Buffered ? 10 : 1 ;
0 commit comments