@powersync/common 1.51.0 → 1.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/bundle.cjs +510 -1129
  2. package/dist/bundle.cjs.map +1 -1
  3. package/dist/bundle.mjs +511 -1116
  4. package/dist/bundle.mjs.map +1 -1
  5. package/dist/bundle.node.cjs +508 -1129
  6. package/dist/bundle.node.cjs.map +1 -1
  7. package/dist/bundle.node.mjs +509 -1116
  8. package/dist/bundle.node.mjs.map +1 -1
  9. package/dist/index.d.cts +73 -433
  10. package/legacy/sync_protocol.d.ts +103 -0
  11. package/lib/client/AbstractPowerSyncDatabase.js +3 -3
  12. package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
  13. package/lib/client/ConnectionManager.js +1 -1
  14. package/lib/client/ConnectionManager.js.map +1 -1
  15. package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +6 -64
  16. package/lib/client/sync/bucket/BucketStorageAdapter.js +4 -0
  17. package/lib/client/sync/bucket/BucketStorageAdapter.js.map +1 -1
  18. package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +1 -28
  19. package/lib/client/sync/bucket/SqliteBucketStorage.js +0 -162
  20. package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -1
  21. package/lib/client/sync/stream/AbstractRemote.d.ts +29 -18
  22. package/lib/client/sync/stream/AbstractRemote.js +155 -188
  23. package/lib/client/sync/stream/AbstractRemote.js.map +1 -1
  24. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +13 -35
  25. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +150 -448
  26. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
  27. package/lib/client/sync/stream/JsonValue.d.ts +7 -0
  28. package/lib/client/sync/stream/JsonValue.js +2 -0
  29. package/lib/client/sync/stream/JsonValue.js.map +1 -0
  30. package/lib/client/sync/stream/core-instruction.d.ts +14 -9
  31. package/lib/client/sync/stream/core-instruction.js +3 -0
  32. package/lib/client/sync/stream/core-instruction.js.map +1 -1
  33. package/lib/db/DBAdapter.d.ts +9 -0
  34. package/lib/db/DBAdapter.js +8 -1
  35. package/lib/db/DBAdapter.js.map +1 -1
  36. package/lib/db/crud/SyncStatus.d.ts +3 -4
  37. package/lib/db/crud/SyncStatus.js +0 -4
  38. package/lib/db/crud/SyncStatus.js.map +1 -1
  39. package/lib/db/schema/RawTable.d.ts +0 -5
  40. package/lib/db/schema/Schema.d.ts +0 -2
  41. package/lib/db/schema/Schema.js +0 -2
  42. package/lib/db/schema/Schema.js.map +1 -1
  43. package/lib/index.d.ts +2 -6
  44. package/lib/index.js +1 -6
  45. package/lib/index.js.map +1 -1
  46. package/lib/utils/async.d.ts +0 -9
  47. package/lib/utils/async.js +0 -9
  48. package/lib/utils/async.js.map +1 -1
  49. package/lib/utils/stream_transform.d.ts +39 -0
  50. package/lib/utils/stream_transform.js +206 -0
  51. package/lib/utils/stream_transform.js.map +1 -0
  52. package/package.json +15 -10
  53. package/src/client/AbstractPowerSyncDatabase.ts +3 -3
  54. package/src/client/ConnectionManager.ts +1 -1
  55. package/src/client/sync/bucket/BucketStorageAdapter.ts +6 -71
  56. package/src/client/sync/bucket/SqliteBucketStorage.ts +1 -197
  57. package/src/client/sync/stream/AbstractRemote.ts +183 -229
  58. package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +181 -510
  59. package/src/client/sync/stream/JsonValue.ts +8 -0
  60. package/src/client/sync/stream/core-instruction.ts +15 -5
  61. package/src/db/DBAdapter.ts +20 -2
  62. package/src/db/crud/SyncStatus.ts +4 -5
  63. package/src/db/schema/RawTable.ts +0 -5
  64. package/src/db/schema/Schema.ts +0 -2
  65. package/src/index.ts +2 -6
  66. package/src/utils/async.ts +0 -11
  67. package/src/utils/stream_transform.ts +252 -0
  68. package/lib/client/sync/bucket/OpType.d.ts +0 -16
  69. package/lib/client/sync/bucket/OpType.js +0 -23
  70. package/lib/client/sync/bucket/OpType.js.map +0 -1
  71. package/lib/client/sync/bucket/OplogEntry.d.ts +0 -23
  72. package/lib/client/sync/bucket/OplogEntry.js +0 -36
  73. package/lib/client/sync/bucket/OplogEntry.js.map +0 -1
  74. package/lib/client/sync/bucket/SyncDataBatch.d.ts +0 -6
  75. package/lib/client/sync/bucket/SyncDataBatch.js +0 -12
  76. package/lib/client/sync/bucket/SyncDataBatch.js.map +0 -1
  77. package/lib/client/sync/bucket/SyncDataBucket.d.ts +0 -40
  78. package/lib/client/sync/bucket/SyncDataBucket.js +0 -40
  79. package/lib/client/sync/bucket/SyncDataBucket.js.map +0 -1
  80. package/lib/client/sync/stream/streaming-sync-types.d.ts +0 -143
  81. package/lib/client/sync/stream/streaming-sync-types.js +0 -26
  82. package/lib/client/sync/stream/streaming-sync-types.js.map +0 -1
  83. package/lib/utils/DataStream.d.ts +0 -62
  84. package/lib/utils/DataStream.js +0 -169
  85. package/lib/utils/DataStream.js.map +0 -1
  86. package/src/client/sync/bucket/OpType.ts +0 -23
  87. package/src/client/sync/bucket/OplogEntry.ts +0 -50
  88. package/src/client/sync/bucket/SyncDataBatch.ts +0 -11
  89. package/src/client/sync/bucket/SyncDataBucket.ts +0 -49
  90. package/src/client/sync/stream/streaming-sync-types.ts +0 -210
  91. package/src/utils/DataStream.ts +0 -222
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import Logger, { ILogger, ILogLevel } from 'js-logger';
2
2
  export { GlobalLogger, ILogHandler, ILogLevel, ILogger, ILoggerOpts } from 'js-logger';
3
- import { BSON } from 'bson';
4
3
  import { fetch } from 'cross-fetch';
5
4
 
6
5
  interface Disposable {
@@ -87,6 +86,15 @@ interface SqlExecutor {
87
86
  executeBatch: (query: string, params?: any[][]) => Promise<QueryResult>;
88
87
  }
89
88
  interface LockContext extends SqlExecutor, DBGetUtils {
89
+ /**
90
+ * How the connection has been opened.
91
+ *
92
+ * `writer` indicates that the lock context is capable of writing to the database.
93
+ * `queryOnly` indicates that the lock context has been opened in a readwrite mode, but a `PRAGMA query_only = TRUE`
94
+ * disabled writes.
95
+ * `readOnly` indicates that the lock context has been opened by passing `SQLITE_OPEN_READONLY` to `sqlite3_open_v2`.
96
+ */
97
+ connectionType?: 'writer' | 'queryOnly' | 'readOnly';
90
98
  }
91
99
  /**
92
100
  * Implements {@link DBGetUtils} on a {@link SqlRunner}.
@@ -310,139 +318,6 @@ declare class CrudBatch {
310
318
  complete: (writeCheckpoint?: string) => Promise<void>);
311
319
  }
312
320
 
313
- declare enum OpTypeEnum {
314
- CLEAR = 1,
315
- MOVE = 2,
316
- PUT = 3,
317
- REMOVE = 4
318
- }
319
- type OpTypeJSON = string;
320
- /**
321
- * Used internally for sync buckets.
322
- */
323
- declare class OpType {
324
- value: OpTypeEnum;
325
- static fromJSON(jsonValue: OpTypeJSON): OpType;
326
- constructor(value: OpTypeEnum);
327
- toJSON(): string;
328
- }
329
-
330
- interface OplogEntryJSON {
331
- checksum: number;
332
- data?: string;
333
- object_id?: string;
334
- object_type?: string;
335
- op_id: string;
336
- op: OpTypeJSON;
337
- subkey?: string;
338
- }
339
- declare class OplogEntry {
340
- op_id: OpId;
341
- op: OpType;
342
- checksum: number;
343
- subkey?: string | undefined;
344
- object_type?: string | undefined;
345
- object_id?: string | undefined;
346
- data?: string | undefined;
347
- static fromRow(row: OplogEntryJSON): OplogEntry;
348
- constructor(op_id: OpId, op: OpType, checksum: number, subkey?: string | undefined, object_type?: string | undefined, object_id?: string | undefined, data?: string | undefined);
349
- toJSON(fixedKeyEncoding?: boolean): OplogEntryJSON;
350
- }
351
-
352
- type SyncDataBucketJSON = {
353
- bucket: string;
354
- has_more?: boolean;
355
- after?: string;
356
- next_after?: string;
357
- data: OplogEntryJSON[];
358
- };
359
- declare class SyncDataBucket {
360
- bucket: string;
361
- data: OplogEntry[];
362
- /**
363
- * True if the response does not contain all the data for this bucket, and another request must be made.
364
- */
365
- has_more: boolean;
366
- /**
367
- * The `after` specified in the request.
368
- */
369
- after?: OpId | undefined;
370
- /**
371
- * Use this for the next request.
372
- */
373
- next_after?: OpId | undefined;
374
- static fromRow(row: SyncDataBucketJSON): SyncDataBucket;
375
- constructor(bucket: string, data: OplogEntry[],
376
- /**
377
- * True if the response does not contain all the data for this bucket, and another request must be made.
378
- */
379
- has_more: boolean,
380
- /**
381
- * The `after` specified in the request.
382
- */
383
- after?: OpId | undefined,
384
- /**
385
- * Use this for the next request.
386
- */
387
- next_after?: OpId | undefined);
388
- toJSON(fixedKeyEncoding?: boolean): SyncDataBucketJSON;
389
- }
390
-
391
- declare class SyncDataBatch {
392
- buckets: SyncDataBucket[];
393
- static fromJSON(json: any): SyncDataBatch;
394
- constructor(buckets: SyncDataBucket[]);
395
- }
396
-
397
- interface BucketDescription {
398
- name: string;
399
- priority: number;
400
- }
401
- interface Checkpoint {
402
- last_op_id: OpId;
403
- buckets: BucketChecksum[];
404
- write_checkpoint?: string;
405
- streams?: any[];
406
- }
407
- interface BucketState {
408
- bucket: string;
409
- op_id: string;
410
- }
411
- interface ChecksumCache {
412
- checksums: Map<string, {
413
- checksum: BucketChecksum;
414
- last_op_id: OpId;
415
- }>;
416
- lastOpId: OpId;
417
- }
418
- interface SyncLocalDatabaseResult {
419
- ready: boolean;
420
- checkpointValid: boolean;
421
- checkpointFailures?: string[];
422
- }
423
- type SavedProgress = {
424
- atLast: number;
425
- sinceLast: number;
426
- };
427
- type BucketOperationProgress = Record<string, SavedProgress>;
428
- interface BucketChecksum {
429
- bucket: string;
430
- priority?: number;
431
- /**
432
- * 32-bit unsigned hash.
433
- */
434
- checksum: number;
435
- /**
436
- * Count of operations - informational only.
437
- */
438
- count?: number;
439
- /**
440
- * The JavaScript client does not use this field, which is why it's defined to be `any`. We rely on the structure of
441
- * this interface to pass custom `BucketChecksum`s to the Rust client in unit tests, which so all fields need to be
442
- * present.
443
- */
444
- subscriptions?: any;
445
- }
446
321
  declare enum PSInternalTable {
447
322
  DATA = "ps_data",
448
323
  CRUD = "ps_crud",
@@ -457,30 +332,22 @@ declare enum PowerSyncControlCommand {
457
332
  START = "start",
458
333
  NOTIFY_TOKEN_REFRESHED = "refreshed_token",
459
334
  NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload",
460
- UPDATE_SUBSCRIPTIONS = "update_subscriptions"
335
+ UPDATE_SUBSCRIPTIONS = "update_subscriptions",
336
+ /**
337
+ * An `established` or `end` event for response streams.
338
+ */
339
+ CONNECTION_STATE = "connection"
461
340
  }
462
341
  interface BucketStorageListener extends BaseListener {
463
342
  crudUpdate: () => void;
464
343
  }
465
344
  interface BucketStorageAdapter extends BaseObserverInterface<BucketStorageListener>, Disposable {
466
345
  init(): Promise<void>;
467
- saveSyncData(batch: SyncDataBatch, fixedKeyFormat?: boolean): Promise<void>;
468
- removeBuckets(buckets: string[]): Promise<void>;
469
- setTargetCheckpoint(checkpoint: Checkpoint): Promise<void>;
470
- startSession(): void;
471
- getBucketStates(): Promise<BucketState[]>;
472
- getBucketOperationProgress(): Promise<BucketOperationProgress>;
473
346
  hasMigratedSubkeys(): Promise<boolean>;
474
347
  migrateToFixedSubkeys(): Promise<void>;
475
- syncLocalDatabase(checkpoint: Checkpoint, priority?: number): Promise<{
476
- checkpointValid: boolean;
477
- ready: boolean;
478
- failures?: any[];
479
- }>;
480
348
  nextCrudItem(): Promise<CrudEntry | undefined>;
481
349
  hasCrud(): Promise<boolean>;
482
350
  getCrudBatch(limit?: number): Promise<CrudBatch | null>;
483
- hasCompletedSync(): Promise<boolean>;
484
351
  updateLocalTarget(cb: () => Promise<string>): Promise<boolean>;
485
352
  getMaxOpId(): string;
486
353
  /**
@@ -493,67 +360,6 @@ interface BucketStorageAdapter extends BaseObserverInterface<BucketStorageListen
493
360
  control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise<string>;
494
361
  }
495
362
 
496
- type DataStreamOptions<ParsedData, SourceData> = {
497
- mapLine?: (line: SourceData) => ParsedData;
498
- /**
499
- * Close the stream if any consumer throws an error
500
- */
501
- closeOnError?: boolean;
502
- pressure?: {
503
- highWaterMark?: number;
504
- lowWaterMark?: number;
505
- };
506
- logger?: ILogger;
507
- };
508
- type DataStreamCallback<Data extends any = any> = (data: Data) => Promise<void>;
509
- interface DataStreamListener<Data extends any = any> extends BaseListener {
510
- data: (data: Data) => Promise<void>;
511
- closed: () => void;
512
- error: (error: Error) => void;
513
- highWater: () => Promise<void>;
514
- lowWater: () => Promise<void>;
515
- }
516
- declare const DEFAULT_PRESSURE_LIMITS: {
517
- highWater: number;
518
- lowWater: number;
519
- };
520
- /**
521
- * A very basic implementation of a data stream with backpressure support which does not use
522
- * native JS streams or async iterators.
523
- * This is handy for environments such as React Native which need polyfills for the above.
524
- */
525
- declare class DataStream<ParsedData, SourceData = any> extends BaseObserver<DataStreamListener<ParsedData>> {
526
- protected options?: DataStreamOptions<ParsedData, SourceData> | undefined;
527
- dataQueue: SourceData[];
528
- protected isClosed: boolean;
529
- protected processingPromise: Promise<void> | null;
530
- protected notifyDataAdded: (() => void) | null;
531
- protected logger: ILogger;
532
- protected mapLine: (line: SourceData) => ParsedData;
533
- constructor(options?: DataStreamOptions<ParsedData, SourceData> | undefined);
534
- get highWatermark(): number;
535
- get lowWatermark(): number;
536
- get closed(): boolean;
537
- close(): Promise<void>;
538
- /**
539
- * Enqueues data for the consumers to read
540
- */
541
- enqueueData(data: SourceData): void;
542
- /**
543
- * Reads data once from the data stream
544
- * @returns a Data payload or Null if the stream closed.
545
- */
546
- read(): Promise<ParsedData | null>;
547
- /**
548
- * Executes a callback for each data item in the stream
549
- */
550
- forEach(callback: DataStreamCallback<ParsedData>): () => void;
551
- protected processQueue(): Promise<void> | undefined;
552
- protected hasDataReader(): boolean;
553
- protected _processQueue(): Promise<void>;
554
- protected iterateAsyncErrored(cb: (l: Partial<DataStreamListener<ParsedData>>) => Promise<void>): Promise<void>;
555
- }
556
-
557
363
  interface PowerSyncCredentials {
558
364
  endpoint: string;
559
365
  token: string;
@@ -561,146 +367,15 @@ interface PowerSyncCredentials {
561
367
  }
562
368
 
563
369
  /**
564
- * For sync2.json
565
- */
566
- interface ContinueCheckpointRequest {
567
- /**
568
- * Existing bucket states. Only these buckets are synchronized.
569
- */
570
- buckets: BucketRequest[];
571
- checkpoint_token: string;
572
- limit?: number;
573
- }
574
- interface SyncNewCheckpointRequest {
575
- /**
576
- * Existing bucket states. Used if include_data is specified.
577
- */
578
- buckets?: BucketRequest[];
579
- request_checkpoint: {
580
- /**
581
- * Whether or not to include an initial data request.
582
- */
583
- include_data: boolean;
584
- /**
585
- * Whether or not to compute a checksum.
586
- */
587
- include_checksum: boolean;
588
- };
589
- limit?: number;
590
- }
591
- type SyncRequest = ContinueCheckpointRequest | SyncNewCheckpointRequest;
592
- interface SyncResponse {
593
- /**
594
- * Data for the buckets returned. May not have an an entry for each bucket in the request.
595
- */
596
- data?: SyncDataBucketJSON[];
597
- /**
598
- * True if the response limit has been reached, and another request must be made.
599
- */
600
- has_more: boolean;
601
- checkpoint_token?: string;
602
- checkpoint?: Checkpoint;
603
- }
604
- type JSONValue = string | number | boolean | null | undefined | JSONObject | JSONArray;
605
- interface JSONObject {
606
- [key: string]: JSONValue;
607
- }
608
- type JSONArray = JSONValue[];
609
- type StreamingSyncRequestParameterType = JSONValue;
610
- interface StreamingSyncRequest {
611
- /**
612
- * Existing bucket states.
613
- */
614
- buckets?: BucketRequest[];
615
- /**
616
- * If specified, limit the response to only include these buckets.
617
- */
618
- only?: string[];
619
- /**
620
- * Whether or not to compute a checksum for each checkpoint
621
- */
622
- include_checksum: boolean;
623
- /**
624
- * Changes the response to stringified data in each OplogEntry
625
- */
626
- raw_data: boolean;
627
- /**
628
- * Client parameters to be passed to the sync rules.
629
- */
630
- parameters?: Record<string, StreamingSyncRequestParameterType>;
631
- /**
632
- * Application metadata to be included in service logs.
633
- */
634
- app_metadata?: Record<string, string>;
635
- client_id?: string;
636
- }
637
- interface StreamingSyncCheckpoint {
638
- checkpoint: Checkpoint;
639
- }
640
- interface StreamingSyncCheckpointDiff {
641
- checkpoint_diff: {
642
- last_op_id: OpId;
643
- updated_buckets: BucketChecksum[];
644
- removed_buckets: string[];
645
- write_checkpoint?: string;
646
- };
647
- }
648
- interface StreamingSyncDataJSON {
649
- data: SyncDataBucketJSON;
650
- }
651
- interface StreamingSyncCheckpointComplete {
652
- checkpoint_complete: {
653
- last_op_id: OpId;
654
- };
655
- }
656
- interface StreamingSyncCheckpointPartiallyComplete {
657
- partial_checkpoint_complete: {
658
- priority: number;
659
- last_op_id: OpId;
660
- };
661
- }
662
- interface StreamingSyncKeepalive {
663
- /** If specified, token expires in this many seconds. */
664
- token_expires_in: number;
665
- }
666
- type StreamingSyncLine = StreamingSyncDataJSON | StreamingSyncCheckpoint | StreamingSyncCheckpointDiff | StreamingSyncCheckpointComplete | StreamingSyncCheckpointPartiallyComplete | StreamingSyncKeepalive;
667
- type CrudUploadNotification = {
668
- crud_upload_completed: null;
669
- };
670
- type StreamingSyncLineOrCrudUploadComplete = StreamingSyncLine | CrudUploadNotification;
671
- interface BucketRequest {
672
- name: string;
673
- /**
674
- * Base-10 number. Sync all data from this bucket with op_id > after.
675
- */
676
- after: OpId;
677
- }
678
- declare function isStreamingSyncData(line: StreamingSyncLine): line is StreamingSyncDataJSON;
679
- declare function isStreamingKeepalive(line: StreamingSyncLine): line is StreamingSyncKeepalive;
680
- declare function isStreamingSyncCheckpoint(line: StreamingSyncLine): line is StreamingSyncCheckpoint;
681
- declare function isStreamingSyncCheckpointComplete(line: StreamingSyncLine): line is StreamingSyncCheckpointComplete;
682
- declare function isStreamingSyncCheckpointPartiallyComplete(line: StreamingSyncLine): line is StreamingSyncCheckpointPartiallyComplete;
683
- declare function isStreamingSyncCheckpointDiff(line: StreamingSyncLine): line is StreamingSyncCheckpointDiff;
684
- declare function isContinueCheckpointRequest(request: SyncRequest): request is ContinueCheckpointRequest;
685
- declare function isSyncNewCheckpointRequest(request: SyncRequest): request is SyncNewCheckpointRequest;
686
- /**
687
- * For crud.json
370
+ * An async iterator that can't be cancelled.
371
+ *
372
+ * To keep data flow simple, we always pass an explicit cancellation token when subscribing to async streams. Once the
373
+ * {@link AbortSignal} aborts, iterators are supposed to clean up and then emit a final `{done: true}` event. This means
374
+ * that there's no way to distinguish between streams that have completed normally and streams that have been cancelled,
375
+ * but that is acceptable for our uses of this.
688
376
  */
689
- interface CrudRequest {
690
- data: CrudEntry[];
691
- }
692
- interface CrudResponse {
693
- /**
694
- * A sync response with a checkpoint >= this checkpoint would contain all the changes in this request.
695
- *
696
- * Any earlier checkpoint may or may not contain these changes.
697
- *
698
- * May be empty when the request contains no ops.
699
- */
700
- checkpoint?: OpId;
701
- }
377
+ type SimpleAsyncIterator<T> = Pick<AsyncIterator<T>, 'next'>;
702
378
 
703
- type BSONImplementation = typeof BSON;
704
379
  type RemoteConnector = {
705
380
  fetchCredentials: () => Promise<PowerSyncCredentials | null>;
706
381
  invalidateCredentials?: () => void;
@@ -708,9 +383,9 @@ type RemoteConnector = {
708
383
  declare const DEFAULT_REMOTE_LOGGER: Logger.ILogger;
709
384
  type SyncStreamOptions = {
710
385
  path: string;
711
- data: StreamingSyncRequest;
386
+ data: unknown;
712
387
  headers?: Record<string, string>;
713
- abortSignal?: AbortSignal;
388
+ abortSignal: AbortSignal;
714
389
  fetchOptions?: Request;
715
390
  };
716
391
  declare enum FetchStrategy {
@@ -811,30 +486,51 @@ declare abstract class AbstractRemote {
811
486
  }>;
812
487
  post(path: string, data: any, headers?: Record<string, string>): Promise<any>;
813
488
  get(path: string, headers?: Record<string, string>): Promise<any>;
814
- /**
815
- * Provides a BSON implementation. The import nature of this varies depending on the platform
816
- */
817
- abstract getBSON(): Promise<BSONImplementation>;
818
489
  /**
819
490
  * @returns A text decoder decoding UTF-8. This is a method to allow patching it for Hermes which doesn't support the
820
491
  * builtin, without forcing us to bundle a polyfill with `@powersync/common`.
821
492
  */
822
- protected createTextDecoder(): TextDecoder;
493
+ createTextDecoder(): TextDecoder;
823
494
  protected createSocket(url: string): WebSocket;
824
495
  /**
825
- * Returns a data stream of sync line data.
496
+ * Returns a data stream of sync line data, fetched via RSocket-over-WebSocket.
497
+ *
498
+ * The only mechanism to abort the returned stream is to use the abort signal in {@link SocketSyncStreamOptions}.
499
+ */
500
+ socketStreamRaw(options: SocketSyncStreamOptions): Promise<SimpleAsyncIterator<Uint8Array>>;
501
+ /**
502
+ * @returns Whether the HTTP implementation on this platform can receive streamed binary responses. This is true on
503
+ * all platforms except React Native (who would have guessed...), where we must not request BSON responses.
826
504
  *
827
- * @param map Maps received payload frames to the typed event value.
828
- * @param bson A BSON encoder and decoder. When set, the data stream will be requested with a BSON payload
829
- * (required for compatibility with older sync services).
505
+ * @see https://github.com/react-native-community/fetch?tab=readme-ov-file#motivation
830
506
  */
831
- socketStreamRaw<T>(options: SocketSyncStreamOptions, map: (buffer: Uint8Array) => T, bson?: typeof BSON): Promise<DataStream<T>>;
507
+ protected get supportsStreamingBinaryResponses(): boolean;
832
508
  /**
833
- * Connects to the sync/stream http endpoint, mapping and emitting each received string line.
509
+ * Posts a `/sync/stream` request, asserts that it completes successfully and returns the streaming response as an
510
+ * async iterator of byte blobs.
511
+ *
512
+ * To cancel the async iterator, use the abort signal from {@link SyncStreamOptions} passed to this method.
513
+ */
514
+ protected fetchStreamRaw(options: SyncStreamOptions): Promise<{
515
+ isBson: boolean;
516
+ stream: SimpleAsyncIterator<Uint8Array>;
517
+ }>;
518
+ /**
519
+ * Posts a `/sync/stream` request.
520
+ *
521
+ * Depending on the `Content-Type` of the response, this returns strings for sync lines or encoded BSON documents as
522
+ * {@link Uint8Array}s.
834
523
  */
835
- postStreamRaw<T>(options: SyncStreamOptions, mapLine: (line: string) => T): Promise<DataStream<T>>;
524
+ fetchStream(options: SyncStreamOptions): Promise<SimpleAsyncIterator<Uint8Array | string>>;
836
525
  }
837
526
 
527
+ type JSONValue = string | number | boolean | null | undefined | JSONObject | JSONArray;
528
+ interface JSONObject {
529
+ [key: string]: JSONValue;
530
+ }
531
+ type JSONArray = JSONValue[];
532
+ type StreamingSyncRequestParameterType = JSONValue;
533
+
838
534
  declare enum LockType {
839
535
  CRUD = "crud",
840
536
  SYNC = "sync"
@@ -844,35 +540,21 @@ declare enum SyncStreamConnectionMethod {
844
540
  WEB_SOCKET = "web-socket"
845
541
  }
846
542
  declare enum SyncClientImplementation {
847
- /**
848
- * Decodes and handles sync lines received from the sync service in JavaScript.
849
- *
850
- * This is the default option.
851
- *
852
- * @deprecated We recommend the {@link RUST} client implementation for all apps. If you have issues with
853
- * the Rust client, please file an issue or reach out to us. The JavaScript client will be removed in a future
854
- * version of the PowerSync SDK.
855
- */
856
- JAVASCRIPT = "js",
857
543
  /**
858
544
  * This implementation offloads the sync line decoding and handling into the PowerSync
859
545
  * core extension.
860
546
  *
861
- * This option is more performant than the {@link JAVASCRIPT} client, enabled by default and the
862
- * recommended client implementation for all apps.
547
+ * This is the only option, as an older JavaScript client implementation has been removed from the SDK.
863
548
  *
864
549
  * ## Compatibility warning
865
550
  *
866
551
  * The Rust sync client stores sync data in a format that is slightly different than the one used
867
- * by the old {@link JAVASCRIPT} implementation. When adopting the {@link RUST} client on existing
868
- * databases, the PowerSync SDK will migrate the format automatically.
869
- * Further, the {@link JAVASCRIPT} client in recent versions of the PowerSync JS SDK (starting from
870
- * the version introducing {@link RUST} as an option) also supports the new format, so you can switch
871
- * back to {@link JAVASCRIPT} later.
552
+ * by the old JavaScript client. When adopting the {@link RUST} client on existing databases, the PowerSync SDK will
553
+ * migrate the format automatically.
872
554
  *
873
- * __However__: Upgrading the SDK version, then adopting {@link RUST} as a sync client and later
874
- * downgrading the SDK to an older version (necessarily using the JavaScript-based implementation then)
875
- * can lead to sync issues.
555
+ * SDK versions supporting both the JavaScript and the Rust client support both formats with the JavaScript client
556
+ * implementaiton. However, downgrading to an SDK version that only supports the JavaScript client would not be
557
+ * possible anymore. Problematic SDK versions have been released before 2025-06-09.
876
558
  */
877
559
  RUST = "rust"
878
560
  }
@@ -925,11 +607,7 @@ interface BaseConnectionOptions {
925
607
  */
926
608
  appMetadata?: Record<string, string>;
927
609
  /**
928
- * Whether to use a JavaScript implementation to handle received sync lines from the sync
929
- * service, or whether this work should be offloaded to the PowerSync core extension.
930
- *
931
- * This defaults to the JavaScript implementation ({@link SyncClientImplementation.JAVASCRIPT})
932
- * since the ({@link SyncClientImplementation.RUST}) implementation is experimental at the moment.
610
+ * @deprecated The Rust sync client is used unconditionally, so this option can't be configured.
933
611
  */
934
612
  clientImplementation?: SyncClientImplementation;
935
613
  /**
@@ -986,15 +664,14 @@ interface StreamingSyncImplementation extends BaseObserverInterface<StreamingSyn
986
664
  */
987
665
  disconnect(): Promise<void>;
988
666
  getWriteCheckpoint: () => Promise<string>;
989
- hasCompletedSync: () => Promise<boolean>;
990
667
  isConnected: boolean;
991
- lastSyncedAt?: Date;
992
668
  syncStatus: SyncStatus;
993
669
  triggerCrudUpload: () => void;
994
670
  waitForReady(): Promise<void>;
995
671
  waitForStatus(status: SyncStatusOptions): Promise<void>;
996
672
  waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise<void>;
997
673
  updateSubscriptions(subscriptions: SubscribedStream[]): void;
674
+ markConnectionMayHaveChanged(): void;
998
675
  }
999
676
  declare const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000;
1000
677
  declare const DEFAULT_RETRY_DELAY_MS = 5000;
@@ -1009,14 +686,14 @@ type SubscribedStream = {
1009
686
  params: Record<string, any> | null;
1010
687
  };
1011
688
  declare abstract class AbstractStreamingSyncImplementation extends BaseObserver<StreamingSyncImplementationListener> implements StreamingSyncImplementation {
1012
- protected _lastSyncedAt: Date | null;
1013
689
  protected options: AbstractStreamingSyncImplementationOptions;
1014
690
  protected abortController: AbortController | null;
1015
- protected uploadAbortController: AbortController | null;
691
+ protected uploadAbortController: AbortController | undefined;
1016
692
  protected crudUpdateListener?: () => void;
1017
693
  protected streamingSyncPromise?: Promise<void>;
1018
694
  protected logger: ILogger;
1019
695
  private activeStreams;
696
+ private connectionMayHaveChanged;
1020
697
  private isUploadingCrud;
1021
698
  private notifyCompletedUploads?;
1022
699
  private handleActiveStreamsChange?;
@@ -1030,7 +707,6 @@ declare abstract class AbstractStreamingSyncImplementation extends BaseObserver<
1030
707
  get isConnected(): boolean;
1031
708
  dispose(): Promise<void>;
1032
709
  abstract obtainLock<T>(lockOptions: LockOptions<T>): Promise<T>;
1033
- hasCompletedSync(): Promise<boolean>;
1034
710
  getWriteCheckpoint(): Promise<string>;
1035
711
  protected _uploadAllCrud(): Promise<void>;
1036
712
  connect(options?: PowerSyncConnectionOptions): Promise<void>;
@@ -1039,7 +715,7 @@ declare abstract class AbstractStreamingSyncImplementation extends BaseObserver<
1039
715
  * @deprecated use [connect instead]
1040
716
  */
1041
717
  streamingSync(signal?: AbortSignal, options?: PowerSyncConnectionOptions): Promise<void>;
1042
- private collectLocalBucketState;
718
+ markConnectionMayHaveChanged(): void;
1043
719
  /**
1044
720
  * Older versions of the JS SDK used to encode subkeys as JSON in {@link OplogEntry.toJSON}.
1045
721
  * Because subkeys are always strings, this leads to quotes being added around them in `ps_oplog`.
@@ -1057,10 +733,8 @@ declare abstract class AbstractStreamingSyncImplementation extends BaseObserver<
1057
733
  */
1058
734
  private requireKeyFormat;
1059
735
  protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise<RustIterationResult | null>;
1060
- private legacyStreamingSyncIteration;
736
+ private receiveSyncLines;
1061
737
  private rustSyncIteration;
1062
- private updateSyncStatusForStartingCheckpoint;
1063
- private applyCheckpoint;
1064
738
  protected updateSyncStatus(options: SyncStatusOptions): void;
1065
739
  private delayRetry;
1066
740
  updateSubscriptions(subscriptions: SubscribedStream[]): void;
@@ -1287,6 +961,9 @@ type SyncStatusOptions = {
1287
961
  lastSyncedAt?: Date;
1288
962
  hasSynced?: boolean;
1289
963
  priorityStatusEntries?: SyncPriorityStatus[];
964
+ /**
965
+ * @deprecated This field is no longer set, since {@link SyncClientImplementation.RUST} is the only option.
966
+ */
1290
967
  clientImplementation?: SyncClientImplementation;
1291
968
  };
1292
969
  declare class SyncStatus {
@@ -1360,14 +1037,10 @@ declare class SyncStatus {
1360
1037
  *
1361
1038
  * This returns null when the database is currently being opened and we don't have reliable information about all
1362
1039
  * included streams yet.
1363
- *
1364
- * @experimental Sync streams are currently in alpha.
1365
1040
  */
1366
1041
  get syncStreams(): SyncStreamStatus[] | undefined;
1367
1042
  /**
1368
1043
  * If the `stream` appears in {@link syncStreams}, returns the current status for that stream.
1369
- *
1370
- * @experimental Sync streams are currently in alpha.
1371
1044
  */
1372
1045
  forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined;
1373
1046
  /**
@@ -1712,11 +1385,6 @@ declare class Table<Columns extends ColumnsType = ColumnsType> {
1712
1385
  * To collect local writes to raw tables with PowerSync, custom triggers are required. See
1713
1386
  * {@link https://docs.powersync.com/usage/use-case-examples/raw-tables the documentation} for details and an example on
1714
1387
  * using raw tables.
1715
- *
1716
- * Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
1717
- *
1718
- * @experimental Please note that this feature is experimental at the moment, and not covered by PowerSync semver or
1719
- * stability guarantees.
1720
1388
  */
1721
1389
  type RawTableType = RawTableTypeWithStatements | InferredRawTableType;
1722
1390
  interface RawTableTypeWithStatements {
@@ -1816,10 +1484,8 @@ declare class Schema<S extends SchemaType = SchemaType> {
1816
1484
  * developer instead of automatically by PowerSync.
1817
1485
  * Since raw tables are not backed by JSON, running complex queries on them may be more efficient. Further, they allow
1818
1486
  * using client-side table and column constraints.
1819
- * Note that raw tables are only supported when using the new `SyncClientImplementation.rust` sync client.
1820
1487
  *
1821
1488
  * @param tables An object of (table name, raw table definition) entries.
1822
- * @experimental Note that the raw tables API is still experimental and may change in the future.
1823
1489
  */
1824
1490
  withRawTables(tables: Record<string, RawTableType>): void;
1825
1491
  validate(): void;
@@ -4249,7 +3915,6 @@ declare class SqliteBucketStorage extends BaseObserver<BucketStorageListener> im
4249
3915
  private db;
4250
3916
  private logger;
4251
3917
  tableNames: Set<string>;
4252
- private _hasCompletedSync;
4253
3918
  private updateListener;
4254
3919
  private _clientId?;
4255
3920
  constructor(db: DBAdapter, logger?: ILogger);
@@ -4258,27 +3923,6 @@ declare class SqliteBucketStorage extends BaseObserver<BucketStorageListener> im
4258
3923
  _getClientId(): Promise<string>;
4259
3924
  getClientId(): Promise<string>;
4260
3925
  getMaxOpId(): string;
4261
- /**
4262
- * Reset any caches.
4263
- */
4264
- startSession(): void;
4265
- getBucketStates(): Promise<BucketState[]>;
4266
- getBucketOperationProgress(): Promise<BucketOperationProgress>;
4267
- saveSyncData(batch: SyncDataBatch, fixedKeyFormat?: boolean): Promise<void>;
4268
- removeBuckets(buckets: string[]): Promise<void>;
4269
- /**
4270
- * Mark a bucket for deletion.
4271
- */
4272
- private deleteBucket;
4273
- hasCompletedSync(): Promise<boolean>;
4274
- syncLocalDatabase(checkpoint: Checkpoint, priority?: number): Promise<SyncLocalDatabaseResult>;
4275
- /**
4276
- * Atomically update the local state to the current checkpoint.
4277
- *
4278
- * This includes creating new tables, dropping old tables, and copying data over from the oplog.
4279
- */
4280
- private updateObjectsFromBuckets;
4281
- validateChecksums(checkpoint: Checkpoint, priority: number | undefined): Promise<SyncLocalDatabaseResult>;
4282
3926
  updateLocalTarget(cb: () => Promise<string>): Promise<boolean>;
4283
3927
  nextCrudItem(): Promise<CrudEntry | undefined>;
4284
3928
  hasCrud(): Promise<boolean>;
@@ -4290,10 +3934,6 @@ declare class SqliteBucketStorage extends BaseObserver<BucketStorageListener> im
4290
3934
  writeTransaction<T>(callback: (tx: Transaction) => Promise<T>, options?: {
4291
3935
  timeoutMs: number;
4292
3936
  }): Promise<T>;
4293
- /**
4294
- * Set a target checkpoint.
4295
- */
4296
- setTargetCheckpoint(checkpoint: Checkpoint): Promise<void>;
4297
3937
  control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise<string>;
4298
3938
  hasMigratedSubkeys(): Promise<boolean>;
4299
3939
  migrateToFixedSubkeys(): Promise<void>;
@@ -4424,5 +4064,5 @@ interface ParsedQuery {
4424
4064
  }
4425
4065
  declare const parseQuery: <T>(query: string | CompilableQuery<T>, parameters: any[]) => ParsedQuery;
4426
4066
 
4427
- export { ATTACHMENT_TABLE, AbortOperation, AbstractPowerSyncDatabase, AbstractPowerSyncDatabaseOpenFactory, AbstractQueryProcessor, AbstractRemote, AbstractStreamingSyncImplementation, ArrayComparator, AttachmentContext, AttachmentQueue, AttachmentService, AttachmentState, AttachmentTable, BaseObserver, Column, ColumnType, ConnectionClosedError, ConnectionManager, ControlledExecutor, CrudBatch, CrudEntry, CrudTransaction, DBAdapterDefaultMixin, DBGetUtilsDefaultMixin, DEFAULT_CRUD_BATCH_LIMIT, DEFAULT_CRUD_UPLOAD_THROTTLE_MS, DEFAULT_INDEX_COLUMN_OPTIONS, DEFAULT_INDEX_OPTIONS, DEFAULT_LOCK_TIMEOUT_MS, DEFAULT_POWERSYNC_CLOSE_OPTIONS, DEFAULT_POWERSYNC_DB_OPTIONS, DEFAULT_PRESSURE_LIMITS, DEFAULT_REMOTE_LOGGER, DEFAULT_REMOTE_OPTIONS, DEFAULT_RETRY_DELAY_MS, DEFAULT_ROW_COMPARATOR, DEFAULT_STREAMING_SYNC_OPTIONS, DEFAULT_STREAM_CONNECTION_OPTIONS, DEFAULT_SYNC_CLIENT_IMPLEMENTATION, DEFAULT_TABLE_OPTIONS, DEFAULT_WATCH_QUERY_OPTIONS, DEFAULT_WATCH_THROTTLE_MS, DataStream, DiffTriggerOperation, DifferentialQueryProcessor, EMPTY_DIFFERENTIAL, EncodingType, FalsyComparator, FetchImplementationProvider, FetchStrategy, GetAllQuery, Index, IndexedColumn, InvalidSQLCharacters, LockType, LogLevel, MAX_AMOUNT_OF_COLUMNS, MAX_OP_ID, MEMORY_TRIGGER_CLAIM_MANAGER, Mutex, OnChangeQueryProcessor, OpType, OpTypeEnum, OplogEntry, PSInternalTable, PowerSyncControlCommand, RowUpdateType, Schema, Semaphore, SqliteBucketStorage, SyncClientImplementation, SyncDataBatch, SyncDataBucket, SyncProgress, SyncStatus, SyncStreamConnectionMethod, SyncingService, Table, TableV2, TriggerManagerImpl, UpdateType, UploadQueueStats, WatchedQueryListenerEvent, attachmentFromSql, column, compilableQueryWatch, createBaseLogger, createLogger, extractTableUpdates, isBatchedUpdateNotification, isContinueCheckpointRequest, isDBAdapter, isPowerSyncDatabaseOptionsWithSettings, isSQLOpenFactory, isSQLOpenOptions, isStreamingKeepalive, isStreamingSyncCheckpoint, isStreamingSyncCheckpointComplete, isStreamingSyncCheckpointDiff, isStreamingSyncCheckpointPartiallyComplete, isStreamingSyncData, isSyncNewCheckpointRequest, parseQuery, runOnSchemaChange, sanitizeSQL, sanitizeUUID, timeoutSignal };
4428
- export type { AbstractQueryProcessorOptions, AbstractRemoteOptions, AbstractStreamingSyncImplementationOptions, AdditionalConnectionOptions, ArrayComparatorOptions, ArrayQueryDefinition, AttachmentData, AttachmentErrorHandler, AttachmentRecord, AttachmentTableOptions, BSONImplementation, BaseColumnType, BaseConnectionOptions, BaseListener, BaseObserverInterface, BasePowerSyncDatabaseOptions, BaseTriggerDiffRecord, BatchedUpdateNotification, BucketChecksum, BucketDescription, BucketOperationProgress, BucketRequest, BucketState, BucketStorageAdapter, BucketStorageListener, Checkpoint, ChecksumCache, ColumnOptions, ColumnsType, CompilableQuery, CompilableQueryWatchHandler, CompiledQuery, ConnectionManagerListener, ConnectionManagerOptions, ConnectionManagerSyncImplementationResult, ConnectionPool, ContinueCheckpointRequest, ControlledExecutorOptions, CreateDiffTriggerOptions, CreateLoggerOptions, CreateSyncImplementationOptions, CrudRequest, CrudResponse, CrudUploadNotification, DBAdapter, DBAdapterListener, DBGetUtils, DBLockOptions, DataStreamCallback, DataStreamListener, DataStreamOptions, DifferentialQueryProcessorOptions, DifferentialWatchedQuery, DifferentialWatchedQueryComparator, DifferentialWatchedQueryListener, DifferentialWatchedQueryOptions, DifferentialWatchedQuerySettings, DisconnectAndClearOptions, Disposable, ExtractColumnValueType, ExtractedTriggerDiffRecord, FetchImplementation, GetAllQueryOptions, IndexColumnOptions, IndexOptions, IndexShorthand, InternalConnectionOptions, InternalSubscriptionAdapter, LinkQueryOptions, LocalStorageAdapter, LockContext, LockOptions, MutableWatchedQueryState, OnChangeQueryProcessorOptions, OpId, OpTypeJSON, OplogEntryJSON, ParsedQuery, PendingStatement, PendingStatementParameter, PowerSyncBackendConnector, PowerSyncCloseOptions, PowerSyncConnectionOptions, PowerSyncCredentials, PowerSyncDBListener, PowerSyncDatabaseOptions, PowerSyncDatabaseOptionsWithDBAdapter, PowerSyncDatabaseOptionsWithOpenFactory, PowerSyncDatabaseOptionsWithSettings, PowerSyncOpenFactoryOptions, ProgressWithOperations, Query, QueryParam, QueryResult, RawTableType, RemoteConnector, RemoteStorageAdapter, RequiredAdditionalConnectionOptions, RequiredPowerSyncConnectionOptions, RowType, SQLOnChangeOptions, SQLOpenFactory, SQLOpenOptions, SQLWatchOptions, SavedProgress, SchemaTableType, SocketSyncStreamOptions, SqlExecutor, StandardWatchedQuery, StandardWatchedQueryOptions, StreamingSyncCheckpoint, StreamingSyncCheckpointComplete, StreamingSyncCheckpointDiff, StreamingSyncCheckpointPartiallyComplete, StreamingSyncDataJSON, StreamingSyncImplementation, StreamingSyncImplementationListener, StreamingSyncKeepalive, StreamingSyncLine, StreamingSyncLineOrCrudUploadComplete, StreamingSyncRequest, StreamingSyncRequestParameterType, SubscribedStream, SyncDataBucketJSON, SyncDataFlowStatus, SyncLocalDatabaseResult, SyncNewCheckpointRequest, SyncPriorityStatus, SyncRequest, SyncResponse, SyncStatusOptions, SyncStream, SyncStreamDescription, SyncStreamOptions, SyncStreamStatus, SyncStreamSubscribeOptions, SyncStreamSubscription, SyncSubscriptionDescription, TableOptions, TableOrRawTableOptions, TableUpdateOperation, TableV2Options, TrackDiffOptions, TrackPreviousOptions, Transaction, TriggerClaimManager, TriggerCreationHooks, TriggerDiffDeleteRecord, TriggerDiffHandlerContext, TriggerDiffInsertRecord, TriggerDiffRecord, TriggerDiffUpdateRecord, TriggerManager, TriggerManagerConfig, TriggerRemoveCallback, TriggerRemoveCallbackOptions, UnlockFn, UpdateNotification, WatchCompatibleQuery, WatchExecuteOptions, WatchHandler, WatchOnChangeEvent, WatchOnChangeHandler, WatchedAttachmentItem, WatchedQuery, WatchedQueryComparator, WatchedQueryDifferential, WatchedQueryListener, WatchedQueryOptions, WatchedQueryRowDifferential, WatchedQuerySettings, WatchedQueryState, WithDiffOptions };
4067
+ export { ATTACHMENT_TABLE, AbortOperation, AbstractPowerSyncDatabase, AbstractPowerSyncDatabaseOpenFactory, AbstractQueryProcessor, AbstractRemote, AbstractStreamingSyncImplementation, ArrayComparator, AttachmentContext, AttachmentQueue, AttachmentService, AttachmentState, AttachmentTable, BaseObserver, Column, ColumnType, ConnectionClosedError, ConnectionManager, ControlledExecutor, CrudBatch, CrudEntry, CrudTransaction, DBAdapterDefaultMixin, DBGetUtilsDefaultMixin, DEFAULT_CRUD_BATCH_LIMIT, DEFAULT_CRUD_UPLOAD_THROTTLE_MS, DEFAULT_INDEX_COLUMN_OPTIONS, DEFAULT_INDEX_OPTIONS, DEFAULT_LOCK_TIMEOUT_MS, DEFAULT_POWERSYNC_CLOSE_OPTIONS, DEFAULT_POWERSYNC_DB_OPTIONS, DEFAULT_REMOTE_LOGGER, DEFAULT_REMOTE_OPTIONS, DEFAULT_RETRY_DELAY_MS, DEFAULT_ROW_COMPARATOR, DEFAULT_STREAMING_SYNC_OPTIONS, DEFAULT_STREAM_CONNECTION_OPTIONS, DEFAULT_SYNC_CLIENT_IMPLEMENTATION, DEFAULT_TABLE_OPTIONS, DEFAULT_WATCH_QUERY_OPTIONS, DEFAULT_WATCH_THROTTLE_MS, DiffTriggerOperation, DifferentialQueryProcessor, EMPTY_DIFFERENTIAL, EncodingType, FalsyComparator, FetchImplementationProvider, FetchStrategy, GetAllQuery, Index, IndexedColumn, InvalidSQLCharacters, LockType, LogLevel, MAX_AMOUNT_OF_COLUMNS, MAX_OP_ID, MEMORY_TRIGGER_CLAIM_MANAGER, Mutex, OnChangeQueryProcessor, PSInternalTable, PowerSyncControlCommand, RowUpdateType, Schema, Semaphore, SqliteBucketStorage, SyncClientImplementation, SyncProgress, SyncStatus, SyncStreamConnectionMethod, SyncingService, Table, TableV2, TriggerManagerImpl, UpdateType, UploadQueueStats, WatchedQueryListenerEvent, attachmentFromSql, column, compilableQueryWatch, createBaseLogger, createLogger, extractTableUpdates, isBatchedUpdateNotification, isDBAdapter, isPowerSyncDatabaseOptionsWithSettings, isSQLOpenFactory, isSQLOpenOptions, parseQuery, runOnSchemaChange, sanitizeSQL, sanitizeUUID, timeoutSignal };
4068
+ export type { AbstractQueryProcessorOptions, AbstractRemoteOptions, AbstractStreamingSyncImplementationOptions, AdditionalConnectionOptions, ArrayComparatorOptions, ArrayQueryDefinition, AttachmentData, AttachmentErrorHandler, AttachmentRecord, AttachmentTableOptions, BaseColumnType, BaseConnectionOptions, BaseListener, BaseObserverInterface, BasePowerSyncDatabaseOptions, BaseTriggerDiffRecord, BatchedUpdateNotification, BucketStorageAdapter, BucketStorageListener, ColumnOptions, ColumnsType, CompilableQuery, CompilableQueryWatchHandler, CompiledQuery, ConnectionManagerListener, ConnectionManagerOptions, ConnectionManagerSyncImplementationResult, ConnectionPool, ControlledExecutorOptions, CreateDiffTriggerOptions, CreateLoggerOptions, CreateSyncImplementationOptions, DBAdapter, DBAdapterListener, DBGetUtils, DBLockOptions, DifferentialQueryProcessorOptions, DifferentialWatchedQuery, DifferentialWatchedQueryComparator, DifferentialWatchedQueryListener, DifferentialWatchedQueryOptions, DifferentialWatchedQuerySettings, DisconnectAndClearOptions, Disposable, ExtractColumnValueType, ExtractedTriggerDiffRecord, FetchImplementation, GetAllQueryOptions, IndexColumnOptions, IndexOptions, IndexShorthand, InternalConnectionOptions, InternalSubscriptionAdapter, LinkQueryOptions, LocalStorageAdapter, LockContext, LockOptions, MutableWatchedQueryState, OnChangeQueryProcessorOptions, OpId, ParsedQuery, PendingStatement, PendingStatementParameter, PowerSyncBackendConnector, PowerSyncCloseOptions, PowerSyncConnectionOptions, PowerSyncCredentials, PowerSyncDBListener, PowerSyncDatabaseOptions, PowerSyncDatabaseOptionsWithDBAdapter, PowerSyncDatabaseOptionsWithOpenFactory, PowerSyncDatabaseOptionsWithSettings, PowerSyncOpenFactoryOptions, ProgressWithOperations, Query, QueryParam, QueryResult, RawTableType, RemoteConnector, RemoteStorageAdapter, RequiredAdditionalConnectionOptions, RequiredPowerSyncConnectionOptions, RowType, SQLOnChangeOptions, SQLOpenFactory, SQLOpenOptions, SQLWatchOptions, SchemaTableType, SimpleAsyncIterator, SocketSyncStreamOptions, SqlExecutor, StandardWatchedQuery, StandardWatchedQueryOptions, StreamingSyncImplementation, StreamingSyncImplementationListener, StreamingSyncRequestParameterType, SubscribedStream, SyncDataFlowStatus, SyncPriorityStatus, SyncStatusOptions, SyncStream, SyncStreamDescription, SyncStreamOptions, SyncStreamStatus, SyncStreamSubscribeOptions, SyncStreamSubscription, SyncSubscriptionDescription, TableOptions, TableOrRawTableOptions, TableUpdateOperation, TableV2Options, TrackDiffOptions, TrackPreviousOptions, Transaction, TriggerClaimManager, TriggerCreationHooks, TriggerDiffDeleteRecord, TriggerDiffHandlerContext, TriggerDiffInsertRecord, TriggerDiffRecord, TriggerDiffUpdateRecord, TriggerManager, TriggerManagerConfig, TriggerRemoveCallback, TriggerRemoveCallbackOptions, UnlockFn, UpdateNotification, WatchCompatibleQuery, WatchExecuteOptions, WatchHandler, WatchOnChangeEvent, WatchOnChangeHandler, WatchedAttachmentItem, WatchedQuery, WatchedQueryComparator, WatchedQueryDifferential, WatchedQueryListener, WatchedQueryOptions, WatchedQueryRowDifferential, WatchedQuerySettings, WatchedQueryState, WithDiffOptions };