cry-synced-db-client 0.1.32 → 0.1.33

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
@@ -1620,14 +1620,13 @@ class SyncedDb {
1620
1620
  }
1621
1621
  case "batch": {
1622
1622
  for (const item of payload.data) {
1623
- const itemData = item.data || item.doc;
1624
1623
  if (item.operation === "insert") {
1625
- const serverItem = itemData;
1624
+ const serverItem = item.data;
1626
1625
  if (serverItem) {
1627
1626
  await this.handleServerItemUpdate(collectionName, serverItem);
1628
1627
  }
1629
1628
  } else if (item.operation === "update") {
1630
- const deltaData = itemData;
1629
+ const deltaData = item.data;
1631
1630
  if (deltaData && deltaData._id) {
1632
1631
  const localItem = await this.dexieDb.getById(collectionName, deltaData._id);
1633
1632
  if (localItem) {
@@ -1641,7 +1640,7 @@ class SyncedDb {
1641
1640
  }
1642
1641
  }
1643
1642
  } else if (item.operation === "delete") {
1644
- const deleteData = itemData;
1643
+ const deleteData = item.data;
1645
1644
  if (deleteData && deleteData._id) {
1646
1645
  await this.handleServerItemDelete(collectionName, deleteData._id);
1647
1646
  }
@@ -75,12 +75,13 @@ export type PublishDataPayloadDelete = PublishDataPayloadBase & {
75
75
  _id: Id;
76
76
  };
77
77
  };
78
+ export type PublishDataPayloadBatchItem = {
79
+ operation: 'insert' | 'update' | 'delete';
80
+ data: any;
81
+ };
78
82
  export type PublishDataPayloadBatch = PublishDataPayloadBase & {
79
83
  operation: 'batch';
80
- data: Array<{
81
- operation: 'insert' | 'update' | 'delete';
82
- doc: any;
83
- }>;
84
+ data: PublishDataPayloadBatchItem[];
84
85
  };
85
86
  /**
86
87
  * Notifikacija serverja s podatki o spremembah
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",