teamplay 0.4.0-alpha.90 → 0.4.0-alpha.92

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.
@@ -23,6 +23,7 @@ import {
23
23
  arrayShiftPublic as _arrayShiftPublic,
24
24
  arrayRemovePublic as _arrayRemovePublic,
25
25
  arrayMovePublic as _arrayMovePublic,
26
+ setPublicDocReplace as _setPublicDocReplace,
26
27
  stringInsertPublic as _stringInsertPublic,
27
28
  stringRemovePublic as _stringRemovePublic
28
29
  } from '../dataTree.js'
@@ -1103,7 +1104,7 @@ async function setReplaceOnSignal ($signal, value) {
1103
1104
  value = normalizeIdFields(value, idFields, segments[1])
1104
1105
  }
1105
1106
  if (isPublicCollection(segments[0])) {
1106
- const result = await Signal.prototype.set.call($signal, value)
1107
+ const result = await _setPublicDocReplace(segments, value)
1107
1108
  mirrorRefMutationFromTarget(segments, value)
1108
1109
  return result
1109
1110
  }
package/orm/dataTree.js CHANGED
@@ -340,7 +340,11 @@ export async function setPublicDocReplace (segments, value) {
340
340
  op = [{ p: relativePath, od: normalizedPrevious, oi: normalizedValue }]
341
341
  }
342
342
  return new Promise((resolve, reject) => {
343
- doc.submitOp(op, err => err ? reject(err) : resolve())
343
+ doc.submitOp(op, err => {
344
+ if (err) return reject(err)
345
+ ensureLocalDocSyncedWithShareDoc({ collection, docId, doc, idFields })
346
+ resolve()
347
+ })
344
348
  })
345
349
  }
346
350
 
@@ -37,6 +37,7 @@ export function setPrivateData (rootId, logicalSegments, value) {
37
37
  throw Error('setPrivateData expects private collection segments')
38
38
  }
39
39
  const context = getRootContext(rootId, true)
40
+ if (!context) return
40
41
  const segments = getPrivateDataSegments(logicalSegments)
41
42
  _set(segments, value, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
42
43
  }
@@ -46,6 +47,7 @@ export function setReplacePrivateData (rootId, logicalSegments, value) {
46
47
  throw Error('setReplacePrivateData expects private collection segments')
47
48
  }
48
49
  const context = getRootContext(rootId, true)
50
+ if (!context) return
49
51
  const segments = getPrivateDataSegments(logicalSegments)
50
52
  _setReplace(segments, value, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
51
53
  }
@@ -61,46 +63,55 @@ export function delPrivateData (rootId, logicalSegments, options = {}) {
61
63
 
62
64
  export function arrayPushPrivateData (rootId, logicalSegments, value) {
63
65
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayPushPrivateData')
66
+ if (!context) return
64
67
  return _arrayPush(getPrivateDataSegments(logicalSegments), value, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
65
68
  }
66
69
 
67
70
  export function arrayUnshiftPrivateData (rootId, logicalSegments, value) {
68
71
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayUnshiftPrivateData')
72
+ if (!context) return
69
73
  return _arrayUnshift(getPrivateDataSegments(logicalSegments), value, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
70
74
  }
71
75
 
72
76
  export function arrayInsertPrivateData (rootId, logicalSegments, index, values) {
73
77
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayInsertPrivateData')
78
+ if (!context) return
74
79
  return _arrayInsert(getPrivateDataSegments(logicalSegments), index, values, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
75
80
  }
76
81
 
77
82
  export function arrayPopPrivateData (rootId, logicalSegments) {
78
83
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayPopPrivateData')
84
+ if (!context) return
79
85
  return _arrayPop(getPrivateDataSegments(logicalSegments), context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
80
86
  }
81
87
 
82
88
  export function arrayShiftPrivateData (rootId, logicalSegments) {
83
89
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayShiftPrivateData')
90
+ if (!context) return
84
91
  return _arrayShift(getPrivateDataSegments(logicalSegments), context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
85
92
  }
86
93
 
87
94
  export function arrayRemovePrivateData (rootId, logicalSegments, index, howMany = 1) {
88
95
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayRemovePrivateData')
96
+ if (!context) return
89
97
  return _arrayRemove(getPrivateDataSegments(logicalSegments), index, howMany, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
90
98
  }
91
99
 
92
100
  export function arrayMovePrivateData (rootId, logicalSegments, from, to, howMany = 1) {
93
101
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'arrayMovePrivateData')
102
+ if (!context) return
94
103
  return _arrayMove(getPrivateDataSegments(logicalSegments), from, to, howMany, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
95
104
  }
96
105
 
97
106
  export function stringInsertPrivateData (rootId, logicalSegments, index, text) {
98
107
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'stringInsertPrivateData')
108
+ if (!context) return
99
109
  return _stringInsertLocal(getPrivateDataSegments(logicalSegments), index, text, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
100
110
  }
101
111
 
102
112
  export function stringRemovePrivateData (rootId, logicalSegments, index, howMany) {
103
113
  const context = getRequiredPrivateContext(rootId, logicalSegments, 'stringRemovePrivateData')
114
+ if (!context) return
104
115
  return _stringRemoveLocal(getPrivateDataSegments(logicalSegments), index, howMany, context.getPrivateDataRoot(), getModelEventContext(rootId, logicalSegments))
105
116
  }
106
117
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamplay",
3
- "version": "0.4.0-alpha.90",
3
+ "version": "0.4.0-alpha.92",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -83,5 +83,5 @@
83
83
  ]
84
84
  },
85
85
  "license": "MIT",
86
- "gitHead": "12533f048e5ff251867b559532e3ae43900a4eee"
86
+ "gitHead": "d55bd0417f7611c11584ae6400e5e111cc0ec9e3"
87
87
  }