cry-synced-db-client 0.1.213 → 0.1.214

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.
package/dist/index.js CHANGED
@@ -3192,8 +3192,9 @@ function stripServerManagedFromChanges(changes) {
3192
3192
 
3193
3193
  // src/db/sync/SyncEngine.ts
3194
3194
  var SUPRESS_DB_WARNINGS = true;
3195
- var _SyncEngine = class _SyncEngine {
3195
+ var SyncEngine = class {
3196
3196
  constructor(config) {
3197
+ var _a;
3197
3198
  this.tenant = config.tenant;
3198
3199
  this.collections = config.collections;
3199
3200
  this.dexieDb = config.dexieDb;
@@ -3201,6 +3202,7 @@ var _SyncEngine = class _SyncEngine {
3201
3202
  this.callbacks = config.callbacks;
3202
3203
  this.deps = config.deps;
3203
3204
  this.preprocessDirtyItem = config.preprocessDirtyItem;
3205
+ this.syncBatchSize = (_a = config.syncBatchSize) != null ? _a : 5e3;
3204
3206
  }
3205
3207
  /**
3206
3208
  * Execute full sync cycle.
@@ -4159,7 +4161,7 @@ var _SyncEngine = class _SyncEngine {
4159
4161
  let totalDexieMs = 0;
4160
4162
  let totalInMemMs = 0;
4161
4163
  const allUpdatedIds = [];
4162
- const BATCH = _SyncEngine.SYNC_BATCH_SIZE;
4164
+ const BATCH = this.syncBatchSize;
4163
4165
  for (let offset = 0; offset < serverData.length; offset += BATCH) {
4164
4166
  const chunk = serverData.slice(offset, offset + BATCH);
4165
4167
  const chunkIds = [];
@@ -4436,12 +4438,6 @@ var _SyncEngine = class _SyncEngine {
4436
4438
  }
4437
4439
  }
4438
4440
  };
4439
- // ============================================================
4440
- // Private: Process Incoming Data
4441
- // ============================================================
4442
- /** Max items to process per batch in processIncomingServerData */
4443
- _SyncEngine.SYNC_BATCH_SIZE = 2e3;
4444
- var SyncEngine = _SyncEngine;
4445
4441
 
4446
4442
  // src/db/sync/ServerUpdateHandler.ts
4447
4443
  var ServerUpdateHandler = class {
@@ -5079,6 +5075,7 @@ var _SyncedDb = class _SyncedDb {
5079
5075
  }
5080
5076
  });
5081
5077
  this.syncEngine = new SyncEngine({
5078
+ syncBatchSize: config.syncBatchSize,
5082
5079
  tenant: this.tenant,
5083
5080
  updaterId: this.updaterId,
5084
5081
  collections: this.collections,
@@ -75,8 +75,7 @@ export declare class SyncEngine implements I_SyncEngine {
75
75
  }): Promise<{
76
76
  updatedIds: string[];
77
77
  }>;
78
- /** Max items to process per batch in processIncomingServerData */
79
- private static readonly SYNC_BATCH_SIZE;
78
+ private readonly syncBatchSize;
80
79
  private processIncomingServerData;
81
80
  private compareTimestamps;
82
81
  private resolveCollectionConflict;
@@ -303,6 +303,8 @@ export interface SyncEngineConfig {
303
303
  collections: Map<string, CollectionConfig>;
304
304
  dexieDb: I_DexieDb;
305
305
  restInterface: I_RestInterface;
306
+ /** Items per batch in processIncomingServerData. Default 10000. */
307
+ syncBatchSize?: number;
306
308
  /**
307
309
  * Optional per-item filter / transform applied before upload. See
308
310
  * `SyncedDbConfig.preprocessDirtyItem` for full semantics.
@@ -592,6 +592,8 @@ export interface SyncedDbConfig {
592
592
  restTimeoutMs?: number;
593
593
  /** Timeout za sync REST klice v ms (default: 120000) - daljši ker sync prenaša več podatkov */
594
594
  syncTimeoutMs?: number;
595
+ /** Število itemov na batch v processIncomingServerData. Default 10000. */
596
+ syncBatchSize?: number;
595
597
  /**
596
598
  * Activity timeout za streaming odgovore (default: 30000).
597
599
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.213",
3
+ "version": "0.1.214",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",