@cocreate/crdt 1.12.0 → 1.13.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [1.13.2](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.13.1...v1.13.2) (2022-08-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * rename variables isBroadcast and isBroadcastSender to broadcast and broadcastSender ([2560074](https://github.com/CoCreate-app/CoCreate-crdt/commit/2560074c2200c5d7475b347ea8dacc4d86e5107d))
7
+
8
+ ## [1.13.1](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.13.0...v1.13.1) (2022-08-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * checkDb function requires for clientId to be added ([b5a1545](https://github.com/CoCreate-app/CoCreate-crdt/commit/b5a1545bb83a26b7eb9427a030081ec170688a6b))
14
+
15
+ # [1.13.0](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.12.0...v1.13.0) (2022-07-25)
16
+
17
+
18
+ ### Features
19
+
20
+ * crud.getObjectValueByPath to return value using name containing a dotNotation string ([fd8bebf](https://github.com/CoCreate-app/CoCreate-crdt/commit/fd8bebf17722396a71d55affb297ec2718fb46a8))
21
+
1
22
  # [1.12.0](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.11.2...v1.12.0) (2022-07-03)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/crdt",
3
- "version": "1.12.0",
3
+ "version": "1.13.2",
4
4
  "description": "CoCreate crdt",
5
5
  "author": "CoCreate LLC",
6
6
  "license": "SEE LICENSE",
package/src/index.js CHANGED
@@ -19,6 +19,8 @@ function init(info){
19
19
 
20
20
  async function getDoc(info) {
21
21
  try {
22
+ if (['_id', 'organization_id'].includes(info.name))
23
+ return
22
24
  let docName = generateDocName(info);
23
25
  let typeName = info.name;
24
26
  let doc = docs.get(docName);
@@ -104,10 +106,11 @@ async function checkDb(info, flag) {
104
106
  if (checkedDb.get(`${collection}${document_id}${name}`)) return;
105
107
  checkedDb.set(`${collection}${document_id}${name}`, true);
106
108
  let response = await crud.readDocument({ collection, document_id, name });
107
- let string = response.data[name];
109
+ let string = crud.getObjectValueByPath(response.data, name);
108
110
  if (string && flag != false) {
109
111
  info.value = string;
110
112
  info.start = 0;
113
+ info.clientId = clientId;
111
114
  insertChange(info);
112
115
  }
113
116
  return string || '';
@@ -188,7 +191,7 @@ function insertChange(info, flag) {
188
191
  function broadcastChange(info){
189
192
  message.send({
190
193
  room: "",
191
- broadcast_sender: 'false',
194
+ broadcastSender: 'false',
192
195
  message: "crdt",
193
196
  data: info
194
197
  });
@@ -217,7 +220,7 @@ function persistChange(info) {
217
220
  namespace: info.namespace,
218
221
  room: info.room,
219
222
  broadcast: info.broadcast,
220
- broadcast_sender: info.broadcast_sender,
223
+ broadcastSender: info.broadcastSender,
221
224
  metadata: 'crdt-change'
222
225
  });
223
226
  }
@@ -319,7 +322,7 @@ async function updateText(info, flag) {
319
322
  namespace: info.namespace,
320
323
  room: info.room,
321
324
  broadcast: info.broadcast,
322
- broadcast_sender: info.broadcast_sender,
325
+ broadcastSender: info.broadcastSender,
323
326
  metadata: 'crdt-change'
324
327
  });
325
328
  }