@powersync/common 0.0.0-dev-20260202160933 → 0.0.0-dev-20260202163643

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 (214) hide show
  1. package/dist/bundle.cjs +14470 -0
  2. package/dist/bundle.cjs.map +1 -0
  3. package/dist/bundle.mjs +14379 -0
  4. package/dist/bundle.mjs.map +1 -0
  5. package/dist/bundle.node.cjs +11948 -0
  6. package/dist/bundle.node.cjs.map +1 -0
  7. package/dist/bundle.node.mjs +11857 -0
  8. package/dist/bundle.node.mjs.map +1 -0
  9. package/dist/index.d.cts +4272 -0
  10. package/lib/attachments/AttachmentContext.d.ts +86 -0
  11. package/lib/attachments/AttachmentContext.js +229 -0
  12. package/lib/attachments/AttachmentContext.js.map +1 -0
  13. package/lib/attachments/AttachmentErrorHandler.d.ts +31 -0
  14. package/lib/attachments/AttachmentErrorHandler.js +2 -0
  15. package/lib/attachments/AttachmentErrorHandler.js.map +1 -0
  16. package/lib/attachments/AttachmentQueue.d.ts +149 -0
  17. package/lib/attachments/AttachmentQueue.js +362 -0
  18. package/lib/attachments/AttachmentQueue.js.map +1 -0
  19. package/lib/attachments/AttachmentService.d.ts +29 -0
  20. package/lib/attachments/AttachmentService.js +56 -0
  21. package/lib/attachments/AttachmentService.js.map +1 -0
  22. package/lib/attachments/LocalStorageAdapter.d.ts +62 -0
  23. package/lib/attachments/LocalStorageAdapter.js +6 -0
  24. package/lib/attachments/LocalStorageAdapter.js.map +1 -0
  25. package/lib/attachments/RemoteStorageAdapter.d.ts +27 -0
  26. package/lib/attachments/RemoteStorageAdapter.js +2 -0
  27. package/lib/attachments/RemoteStorageAdapter.js.map +1 -0
  28. package/lib/attachments/Schema.d.ts +50 -0
  29. package/lib/attachments/Schema.js +62 -0
  30. package/lib/attachments/Schema.js.map +1 -0
  31. package/lib/attachments/SyncingService.d.ts +62 -0
  32. package/lib/attachments/SyncingService.js +168 -0
  33. package/lib/attachments/SyncingService.js.map +1 -0
  34. package/lib/attachments/WatchedAttachmentItem.d.ts +17 -0
  35. package/lib/attachments/WatchedAttachmentItem.js +2 -0
  36. package/lib/attachments/WatchedAttachmentItem.js.map +1 -0
  37. package/lib/client/AbstractPowerSyncDatabase.d.ts +615 -0
  38. package/lib/client/AbstractPowerSyncDatabase.js +983 -0
  39. package/lib/client/AbstractPowerSyncDatabase.js.map +1 -0
  40. package/lib/client/AbstractPowerSyncOpenFactory.d.ts +22 -0
  41. package/lib/client/AbstractPowerSyncOpenFactory.js +25 -0
  42. package/lib/client/AbstractPowerSyncOpenFactory.js.map +1 -0
  43. package/lib/client/ConnectionManager.d.ts +112 -0
  44. package/lib/client/ConnectionManager.js +294 -0
  45. package/lib/client/ConnectionManager.js.map +1 -0
  46. package/lib/client/CustomQuery.d.ts +22 -0
  47. package/lib/client/CustomQuery.js +43 -0
  48. package/lib/client/CustomQuery.js.map +1 -0
  49. package/lib/client/Query.d.ts +97 -0
  50. package/lib/client/Query.js +2 -0
  51. package/lib/client/Query.js.map +1 -0
  52. package/lib/client/SQLOpenFactory.d.ts +42 -0
  53. package/lib/client/SQLOpenFactory.js +20 -0
  54. package/lib/client/SQLOpenFactory.js.map +1 -0
  55. package/lib/client/compilableQueryWatch.d.ts +7 -0
  56. package/lib/client/compilableQueryWatch.js +38 -0
  57. package/lib/client/compilableQueryWatch.js.map +1 -0
  58. package/lib/client/connection/PowerSyncBackendConnector.d.ts +23 -0
  59. package/lib/client/connection/PowerSyncBackendConnector.js +2 -0
  60. package/lib/client/connection/PowerSyncBackendConnector.js.map +1 -0
  61. package/lib/client/connection/PowerSyncCredentials.d.ts +5 -0
  62. package/lib/client/connection/PowerSyncCredentials.js +2 -0
  63. package/lib/client/connection/PowerSyncCredentials.js.map +1 -0
  64. package/lib/client/constants.d.ts +1 -0
  65. package/lib/client/constants.js +2 -0
  66. package/lib/client/constants.js.map +1 -0
  67. package/lib/client/runOnSchemaChange.d.ts +2 -0
  68. package/lib/client/runOnSchemaChange.js +24 -0
  69. package/lib/client/runOnSchemaChange.js.map +1 -0
  70. package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +102 -0
  71. package/lib/client/sync/bucket/BucketStorageAdapter.js +19 -0
  72. package/lib/client/sync/bucket/BucketStorageAdapter.js.map +1 -0
  73. package/lib/client/sync/bucket/CrudBatch.d.ts +31 -0
  74. package/lib/client/sync/bucket/CrudBatch.js +26 -0
  75. package/lib/client/sync/bucket/CrudBatch.js.map +1 -0
  76. package/lib/client/sync/bucket/CrudEntry.d.ts +95 -0
  77. package/lib/client/sync/bucket/CrudEntry.js +110 -0
  78. package/lib/client/sync/bucket/CrudEntry.js.map +1 -0
  79. package/lib/client/sync/bucket/CrudTransaction.d.ts +29 -0
  80. package/lib/client/sync/bucket/CrudTransaction.js +25 -0
  81. package/lib/client/sync/bucket/CrudTransaction.js.map +1 -0
  82. package/lib/client/sync/bucket/OpType.d.ts +16 -0
  83. package/lib/client/sync/bucket/OpType.js +23 -0
  84. package/lib/client/sync/bucket/OpType.js.map +1 -0
  85. package/lib/client/sync/bucket/OplogEntry.d.ts +23 -0
  86. package/lib/client/sync/bucket/OplogEntry.js +36 -0
  87. package/lib/client/sync/bucket/OplogEntry.js.map +1 -0
  88. package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +61 -0
  89. package/lib/client/sync/bucket/SqliteBucketStorage.js +324 -0
  90. package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -0
  91. package/lib/client/sync/bucket/SyncDataBatch.d.ts +6 -0
  92. package/lib/client/sync/bucket/SyncDataBatch.js +12 -0
  93. package/lib/client/sync/bucket/SyncDataBatch.js.map +1 -0
  94. package/lib/client/sync/bucket/SyncDataBucket.d.ts +40 -0
  95. package/lib/client/sync/bucket/SyncDataBucket.js +40 -0
  96. package/lib/client/sync/bucket/SyncDataBucket.js.map +1 -0
  97. package/lib/client/sync/stream/AbstractRemote.d.ts +140 -0
  98. package/lib/client/sync/stream/AbstractRemote.js +506 -0
  99. package/lib/client/sync/stream/AbstractRemote.js.map +1 -0
  100. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +240 -0
  101. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +990 -0
  102. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -0
  103. package/lib/client/sync/stream/WebsocketClientTransport.d.ts +15 -0
  104. package/lib/client/sync/stream/WebsocketClientTransport.js +61 -0
  105. package/lib/client/sync/stream/WebsocketClientTransport.js.map +1 -0
  106. package/lib/client/sync/stream/core-instruction.d.ts +72 -0
  107. package/lib/client/sync/stream/core-instruction.js +27 -0
  108. package/lib/client/sync/stream/core-instruction.js.map +1 -0
  109. package/lib/client/sync/stream/streaming-sync-types.d.ts +143 -0
  110. package/lib/client/sync/stream/streaming-sync-types.js +26 -0
  111. package/lib/client/sync/stream/streaming-sync-types.js.map +1 -0
  112. package/lib/client/sync/sync-streams.d.ts +98 -0
  113. package/lib/client/sync/sync-streams.js +2 -0
  114. package/lib/client/sync/sync-streams.js.map +1 -0
  115. package/lib/client/triggers/MemoryTriggerClaimManager.d.ts +6 -0
  116. package/lib/client/triggers/MemoryTriggerClaimManager.js +21 -0
  117. package/lib/client/triggers/MemoryTriggerClaimManager.js.map +1 -0
  118. package/lib/client/triggers/TriggerManager.d.ts +459 -0
  119. package/lib/client/triggers/TriggerManager.js +11 -0
  120. package/lib/client/triggers/TriggerManager.js.map +1 -0
  121. package/lib/client/triggers/TriggerManagerImpl.d.ts +39 -0
  122. package/lib/client/triggers/TriggerManagerImpl.js +393 -0
  123. package/lib/client/triggers/TriggerManagerImpl.js.map +1 -0
  124. package/lib/client/triggers/sanitizeSQL.d.ts +34 -0
  125. package/lib/client/triggers/sanitizeSQL.js +69 -0
  126. package/lib/client/triggers/sanitizeSQL.js.map +1 -0
  127. package/lib/client/watched/GetAllQuery.d.ts +32 -0
  128. package/lib/client/watched/GetAllQuery.js +25 -0
  129. package/lib/client/watched/GetAllQuery.js.map +1 -0
  130. package/lib/client/watched/WatchedQuery.d.ts +100 -0
  131. package/lib/client/watched/WatchedQuery.js +14 -0
  132. package/lib/client/watched/WatchedQuery.js.map +1 -0
  133. package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +68 -0
  134. package/lib/client/watched/processors/AbstractQueryProcessor.js +151 -0
  135. package/lib/client/watched/processors/AbstractQueryProcessor.js.map +1 -0
  136. package/lib/client/watched/processors/DifferentialQueryProcessor.d.ts +121 -0
  137. package/lib/client/watched/processors/DifferentialQueryProcessor.js +173 -0
  138. package/lib/client/watched/processors/DifferentialQueryProcessor.js.map +1 -0
  139. package/lib/client/watched/processors/OnChangeQueryProcessor.d.ts +33 -0
  140. package/lib/client/watched/processors/OnChangeQueryProcessor.js +83 -0
  141. package/lib/client/watched/processors/OnChangeQueryProcessor.js.map +1 -0
  142. package/lib/client/watched/processors/comparators.d.ts +30 -0
  143. package/lib/client/watched/processors/comparators.js +35 -0
  144. package/lib/client/watched/processors/comparators.js.map +1 -0
  145. package/lib/db/ConnectionClosedError.d.ts +10 -0
  146. package/lib/db/ConnectionClosedError.js +21 -0
  147. package/lib/db/ConnectionClosedError.js.map +1 -0
  148. package/lib/db/DBAdapter.d.ts +115 -0
  149. package/lib/db/DBAdapter.js +20 -0
  150. package/lib/db/DBAdapter.js.map +1 -0
  151. package/lib/db/crud/SyncProgress.d.ts +68 -0
  152. package/lib/db/crud/SyncProgress.js +61 -0
  153. package/lib/db/crud/SyncProgress.js.map +1 -0
  154. package/lib/db/crud/SyncStatus.d.ts +195 -0
  155. package/lib/db/crud/SyncStatus.js +250 -0
  156. package/lib/db/crud/SyncStatus.js.map +1 -0
  157. package/lib/db/crud/UploadQueueStatus.d.ts +20 -0
  158. package/lib/db/crud/UploadQueueStatus.js +25 -0
  159. package/lib/db/crud/UploadQueueStatus.js.map +1 -0
  160. package/lib/db/schema/Column.d.ts +30 -0
  161. package/lib/db/schema/Column.js +43 -0
  162. package/lib/db/schema/Column.js.map +1 -0
  163. package/lib/db/schema/Index.d.ts +22 -0
  164. package/lib/db/schema/Index.js +30 -0
  165. package/lib/db/schema/Index.js.map +1 -0
  166. package/lib/db/schema/IndexedColumn.d.ts +19 -0
  167. package/lib/db/schema/IndexedColumn.js +30 -0
  168. package/lib/db/schema/IndexedColumn.js.map +1 -0
  169. package/lib/db/schema/RawTable.d.ts +61 -0
  170. package/lib/db/schema/RawTable.js +33 -0
  171. package/lib/db/schema/RawTable.js.map +1 -0
  172. package/lib/db/schema/Schema.d.ts +54 -0
  173. package/lib/db/schema/Schema.js +61 -0
  174. package/lib/db/schema/Schema.js.map +1 -0
  175. package/lib/db/schema/Table.d.ts +157 -0
  176. package/lib/db/schema/Table.js +208 -0
  177. package/lib/db/schema/Table.js.map +1 -0
  178. package/lib/db/schema/TableV2.d.ts +9 -0
  179. package/lib/db/schema/TableV2.js +9 -0
  180. package/lib/db/schema/TableV2.js.map +1 -0
  181. package/lib/index.d.ts +62 -0
  182. package/lib/index.js +63 -0
  183. package/lib/index.js.map +1 -0
  184. package/lib/types/types.d.ts +8 -0
  185. package/lib/types/types.js +2 -0
  186. package/lib/types/types.js.map +1 -0
  187. package/lib/utils/AbortOperation.d.ts +9 -0
  188. package/lib/utils/AbortOperation.js +19 -0
  189. package/lib/utils/AbortOperation.js.map +1 -0
  190. package/lib/utils/BaseObserver.d.ts +18 -0
  191. package/lib/utils/BaseObserver.js +27 -0
  192. package/lib/utils/BaseObserver.js.map +1 -0
  193. package/lib/utils/ControlledExecutor.d.ts +25 -0
  194. package/lib/utils/ControlledExecutor.js +51 -0
  195. package/lib/utils/ControlledExecutor.js.map +1 -0
  196. package/lib/utils/DataStream.d.ts +62 -0
  197. package/lib/utils/DataStream.js +169 -0
  198. package/lib/utils/DataStream.js.map +1 -0
  199. package/lib/utils/Logger.d.ts +31 -0
  200. package/lib/utils/Logger.js +37 -0
  201. package/lib/utils/Logger.js.map +1 -0
  202. package/lib/utils/MetaBaseObserver.d.ts +29 -0
  203. package/lib/utils/MetaBaseObserver.js +51 -0
  204. package/lib/utils/MetaBaseObserver.js.map +1 -0
  205. package/lib/utils/async.d.ts +23 -0
  206. package/lib/utils/async.js +55 -0
  207. package/lib/utils/async.js.map +1 -0
  208. package/lib/utils/mutex.d.ts +7 -0
  209. package/lib/utils/mutex.js +29 -0
  210. package/lib/utils/mutex.js.map +1 -0
  211. package/lib/utils/parseQuery.d.ts +6 -0
  212. package/lib/utils/parseQuery.js +17 -0
  213. package/lib/utils/parseQuery.js.map +1 -0
  214. package/package.json +1 -1
@@ -0,0 +1,240 @@
1
+ import { ILogger } from 'js-logger';
2
+ import { SyncStatus, SyncStatusOptions } from '../../../db/crud/SyncStatus.js';
3
+ import { BaseListener, BaseObserver, BaseObserverInterface, Disposable } from '../../../utils/BaseObserver.js';
4
+ import { BucketStorageAdapter } from '../bucket/BucketStorageAdapter.js';
5
+ import { AbstractRemote, FetchStrategy } from './AbstractRemote.js';
6
+ import { StreamingSyncRequestParameterType } from './streaming-sync-types.js';
7
+ export declare enum LockType {
8
+ CRUD = "crud",
9
+ SYNC = "sync"
10
+ }
11
+ export declare enum SyncStreamConnectionMethod {
12
+ HTTP = "http",
13
+ WEB_SOCKET = "web-socket"
14
+ }
15
+ export declare enum SyncClientImplementation {
16
+ /**
17
+ * Decodes and handles sync lines received from the sync service in JavaScript.
18
+ *
19
+ * This is the default option.
20
+ *
21
+ * @deprecated We recommend the {@link RUST} client implementation for all apps. If you have issues with
22
+ * the Rust client, please file an issue or reach out to us. The JavaScript client will be removed in a future
23
+ * version of the PowerSync SDK.
24
+ */
25
+ JAVASCRIPT = "js",
26
+ /**
27
+ * This implementation offloads the sync line decoding and handling into the PowerSync
28
+ * core extension.
29
+ *
30
+ * This option is more performant than the {@link JAVASCRIPT} client, enabled by default and the
31
+ * recommended client implementation for all apps.
32
+ *
33
+ * ## Compatibility warning
34
+ *
35
+ * The Rust sync client stores sync data in a format that is slightly different than the one used
36
+ * by the old {@link JAVASCRIPT} implementation. When adopting the {@link RUST} client on existing
37
+ * databases, the PowerSync SDK will migrate the format automatically.
38
+ * Further, the {@link JAVASCRIPT} client in recent versions of the PowerSync JS SDK (starting from
39
+ * the version introducing {@link RUST} as an option) also supports the new format, so you can switch
40
+ * back to {@link JAVASCRIPT} later.
41
+ *
42
+ * __However__: Upgrading the SDK version, then adopting {@link RUST} as a sync client and later
43
+ * downgrading the SDK to an older version (necessarily using the JavaScript-based implementation then)
44
+ * can lead to sync issues.
45
+ */
46
+ RUST = "rust"
47
+ }
48
+ /**
49
+ * The default {@link SyncClientImplementation} to use, {@link SyncClientImplementation.RUST}.
50
+ */
51
+ export declare const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST;
52
+ /**
53
+ * Abstract Lock to be implemented by various JS environments
54
+ */
55
+ export interface LockOptions<T> {
56
+ callback: () => Promise<T>;
57
+ type: LockType;
58
+ signal?: AbortSignal;
59
+ }
60
+ export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions {
61
+ adapter: BucketStorageAdapter;
62
+ subscriptions: SubscribedStream[];
63
+ uploadCrud: () => Promise<void>;
64
+ /**
65
+ * An identifier for which PowerSync DB this sync implementation is
66
+ * linked to. Most commonly DB name, but not restricted to DB name.
67
+ */
68
+ identifier?: string;
69
+ logger?: ILogger;
70
+ remote: AbstractRemote;
71
+ }
72
+ export interface StreamingSyncImplementationListener extends BaseListener {
73
+ /**
74
+ * Triggered whenever a status update has been attempted to be made or
75
+ * refreshed.
76
+ */
77
+ statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined;
78
+ /**
79
+ * Triggers whenever the status' members have changed in value
80
+ */
81
+ statusChanged?: ((status: SyncStatus) => void) | undefined;
82
+ }
83
+ /**
84
+ * Configurable options to be used when connecting to the PowerSync
85
+ * backend instance.
86
+ */
87
+ export type PowerSyncConnectionOptions = Omit<InternalConnectionOptions, 'serializedSchema'>;
88
+ export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions {
89
+ }
90
+ /** @internal */
91
+ export interface BaseConnectionOptions {
92
+ /**
93
+ * A set of metadata to be included in service logs.
94
+ */
95
+ appMetadata?: Record<string, string>;
96
+ /**
97
+ * Whether to use a JavaScript implementation to handle received sync lines from the sync
98
+ * service, or whether this work should be offloaded to the PowerSync core extension.
99
+ *
100
+ * This defaults to the JavaScript implementation ({@link SyncClientImplementation.JAVASCRIPT})
101
+ * since the ({@link SyncClientImplementation.RUST}) implementation is experimental at the moment.
102
+ */
103
+ clientImplementation?: SyncClientImplementation;
104
+ /**
105
+ * The connection method to use when streaming updates from
106
+ * the PowerSync backend instance.
107
+ * Defaults to a HTTP streaming connection.
108
+ */
109
+ connectionMethod?: SyncStreamConnectionMethod;
110
+ /**
111
+ * The fetch strategy to use when streaming updates from the PowerSync backend instance.
112
+ */
113
+ fetchStrategy?: FetchStrategy;
114
+ /**
115
+ * These parameters are passed to the sync rules, and will be available under the`user_parameters` object.
116
+ */
117
+ params?: Record<string, StreamingSyncRequestParameterType>;
118
+ /**
119
+ * Whether to include streams that have `auto_subscribe: true` in their definition.
120
+ *
121
+ * This defaults to `true`.
122
+ */
123
+ includeDefaultStreams?: boolean;
124
+ /**
125
+ * The serialized schema - mainly used to forward information about raw tables to the sync client.
126
+ */
127
+ serializedSchema?: any;
128
+ }
129
+ /** @internal */
130
+ export interface AdditionalConnectionOptions {
131
+ /**
132
+ * Delay for retrying sync streaming operations
133
+ * from the PowerSync backend after an error occurs.
134
+ */
135
+ retryDelayMs?: number;
136
+ /**
137
+ * Backend Connector CRUD operations are throttled
138
+ * to occur at most every `crudUploadThrottleMs`
139
+ * milliseconds.
140
+ */
141
+ crudUploadThrottleMs?: number;
142
+ }
143
+ /** @internal */
144
+ export interface RequiredAdditionalConnectionOptions extends Required<AdditionalConnectionOptions> {
145
+ subscriptions: SubscribedStream[];
146
+ }
147
+ export interface StreamingSyncImplementation extends BaseObserverInterface<StreamingSyncImplementationListener>, Disposable {
148
+ /**
149
+ * Connects to the sync service
150
+ */
151
+ connect(options?: InternalConnectionOptions): Promise<void>;
152
+ /**
153
+ * Disconnects from the sync services.
154
+ * @throws if not connected or if abort is not controlled internally
155
+ */
156
+ disconnect(): Promise<void>;
157
+ getWriteCheckpoint: () => Promise<string>;
158
+ hasCompletedSync: () => Promise<boolean>;
159
+ isConnected: boolean;
160
+ lastSyncedAt?: Date;
161
+ syncStatus: SyncStatus;
162
+ triggerCrudUpload: () => void;
163
+ waitForReady(): Promise<void>;
164
+ waitForStatus(status: SyncStatusOptions): Promise<void>;
165
+ waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise<void>;
166
+ updateSubscriptions(subscriptions: SubscribedStream[]): void;
167
+ }
168
+ export declare const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000;
169
+ export declare const DEFAULT_RETRY_DELAY_MS = 5000;
170
+ export declare const DEFAULT_STREAMING_SYNC_OPTIONS: {
171
+ retryDelayMs: number;
172
+ crudUploadThrottleMs: number;
173
+ };
174
+ export type RequiredPowerSyncConnectionOptions = Required<BaseConnectionOptions>;
175
+ export declare const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions;
176
+ export type SubscribedStream = {
177
+ name: string;
178
+ params: Record<string, any> | null;
179
+ };
180
+ export declare abstract class AbstractStreamingSyncImplementation extends BaseObserver<StreamingSyncImplementationListener> implements StreamingSyncImplementation {
181
+ protected _lastSyncedAt: Date | null;
182
+ protected options: AbstractStreamingSyncImplementationOptions;
183
+ protected abortController: AbortController | null;
184
+ protected uploadAbortController: AbortController | null;
185
+ protected crudUpdateListener?: () => void;
186
+ protected streamingSyncPromise?: Promise<void>;
187
+ protected logger: ILogger;
188
+ private activeStreams;
189
+ private isUploadingCrud;
190
+ private notifyCompletedUploads?;
191
+ private handleActiveStreamsChange?;
192
+ syncStatus: SyncStatus;
193
+ triggerCrudUpload: () => void;
194
+ constructor(options: AbstractStreamingSyncImplementationOptions);
195
+ waitForReady(): Promise<void>;
196
+ waitForStatus(status: SyncStatusOptions): Promise<void>;
197
+ waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise<void>;
198
+ get lastSyncedAt(): Date | undefined;
199
+ get isConnected(): boolean;
200
+ dispose(): Promise<void>;
201
+ abstract obtainLock<T>(lockOptions: LockOptions<T>): Promise<T>;
202
+ hasCompletedSync(): Promise<boolean>;
203
+ getWriteCheckpoint(): Promise<string>;
204
+ protected _uploadAllCrud(): Promise<void>;
205
+ connect(options?: PowerSyncConnectionOptions): Promise<void>;
206
+ disconnect(): Promise<void>;
207
+ /**
208
+ * @deprecated use [connect instead]
209
+ */
210
+ streamingSync(signal?: AbortSignal, options?: PowerSyncConnectionOptions): Promise<void>;
211
+ private collectLocalBucketState;
212
+ /**
213
+ * Older versions of the JS SDK used to encode subkeys as JSON in {@link OplogEntry.toJSON}.
214
+ * Because subkeys are always strings, this leads to quotes being added around them in `ps_oplog`.
215
+ * While this is not a problem as long as it's done consistently, it causes issues when a database
216
+ * created by the JS SDK is used with other SDKs, or (more likely) when the new Rust sync client
217
+ * is enabled.
218
+ *
219
+ * So, we add a migration from the old key format (with quotes) to the new one (no quotes). The
220
+ * migration is only triggered when necessary (for now). The function returns whether the new format
221
+ * should be used, so that the JS SDK is able to write to updated databases.
222
+ *
223
+ * @param requireFixedKeyFormat Whether we require the new format or also support the old one.
224
+ * The Rust client requires the new subkey format.
225
+ * @returns Whether the database is now using the new, fixed subkey format.
226
+ */
227
+ private requireKeyFormat;
228
+ protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise<RustIterationResult | null>;
229
+ private legacyStreamingSyncIteration;
230
+ private rustSyncIteration;
231
+ private updateSyncStatusForStartingCheckpoint;
232
+ private applyCheckpoint;
233
+ protected updateSyncStatus(options: SyncStatusOptions): void;
234
+ private delayRetry;
235
+ updateSubscriptions(subscriptions: SubscribedStream[]): void;
236
+ }
237
+ interface RustIterationResult {
238
+ immediateRestart: boolean;
239
+ }
240
+ export {};