@powersync/common 1.20.1 → 1.20.2

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.
@@ -92,6 +92,7 @@ export declare const DEFAULT_POWERSYNC_DB_OPTIONS: {
92
92
  logger: Logger.ILogger;
93
93
  crudUploadThrottleMs: number;
94
94
  };
95
+ export declare const DEFAULT_CRUD_BATCH_LIMIT = 100;
95
96
  /**
96
97
  * Requesting nested or recursive locks can block the application in some circumstances.
97
98
  * This default lock timeout will act as a failsafe to throw an error if a lock cannot
@@ -232,7 +233,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
232
233
  * data by transaction. One batch may contain data from multiple transactions,
233
234
  * and a single transaction may be split over multiple batches.
234
235
  */
235
- getCrudBatch(limit: number): Promise<CrudBatch | null>;
236
+ getCrudBatch(limit?: number): Promise<CrudBatch | null>;
236
237
  /**
237
238
  * Get the next recorded transaction to upload.
238
239
  *
@@ -27,6 +27,7 @@ export const DEFAULT_POWERSYNC_DB_OPTIONS = {
27
27
  logger: Logger.get('PowerSyncDatabase'),
28
28
  crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
29
29
  };
30
+ export const DEFAULT_CRUD_BATCH_LIMIT = 100;
30
31
  /**
31
32
  * Requesting nested or recursive locks can block the application in some circumstances.
32
33
  * This default lock timeout will act as a failsafe to throw an error if a lock cannot
@@ -326,7 +327,7 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
326
327
  * data by transaction. One batch may contain data from multiple transactions,
327
328
  * and a single transaction may be split over multiple batches.
328
329
  */
329
- async getCrudBatch(limit) {
330
+ async getCrudBatch(limit = DEFAULT_CRUD_BATCH_LIMIT) {
330
331
  const result = await this.getAll(`SELECT id, tx_id, data FROM ${PSInternalTable.CRUD} ORDER BY id ASC LIMIT ?`, [limit + 1]);
331
332
  const all = result.map((row) => CrudEntry.fromRow(row)) ?? [];
332
333
  let haveMore = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/common",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"