teamplay 0.4.0-alpha.45 → 0.4.0-alpha.46
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/orm/Compat/README.md +2 -0
- package/orm/Compat/SignalCompat.js +14 -1
- package/package.json +2 -2
package/orm/Compat/README.md
CHANGED
|
@@ -489,6 +489,8 @@ $.users.user1.assign({ name: 'Bob', age: null })
|
|
|
489
489
|
### del(path?)
|
|
490
490
|
|
|
491
491
|
Deletes a value. Can be used with a subpath.
|
|
492
|
+
In compat mode, deleting a non-existing **public** document (or its subpath) is a no-op
|
|
493
|
+
to match legacy racer behavior.
|
|
492
494
|
|
|
493
495
|
```js
|
|
494
496
|
$.users.user1.del('profile.name')
|
|
@@ -279,7 +279,12 @@ class SignalCompat extends Signal {
|
|
|
279
279
|
if (arguments.length > 1) throw Error('Signal.del() expects a single argument')
|
|
280
280
|
const segments = parseAtSubpath(path, arguments.length, 'Signal.del()')
|
|
281
281
|
const $target = resolveSignal(this, segments)
|
|
282
|
-
|
|
282
|
+
try {
|
|
283
|
+
return await Signal.prototype.del.call($target)
|
|
284
|
+
} catch (error) {
|
|
285
|
+
if (isMissingPublicDocDeleteError($target, error)) return
|
|
286
|
+
throw error
|
|
287
|
+
}
|
|
283
288
|
}
|
|
284
289
|
|
|
285
290
|
async increment (path, byNumber) {
|
|
@@ -699,6 +704,14 @@ function resolveSignal ($signal, segments) {
|
|
|
699
704
|
return $cursor
|
|
700
705
|
}
|
|
701
706
|
|
|
707
|
+
function isMissingPublicDocDeleteError ($signal, error) {
|
|
708
|
+
const segments = $signal?.[SEGMENTS]
|
|
709
|
+
if (!Array.isArray(segments) || segments.length < 2) return false
|
|
710
|
+
if (!isPublicCollection(segments[0])) return false
|
|
711
|
+
if (!(error instanceof Error)) return false
|
|
712
|
+
return error.message.includes('Trying to delete data from a non-existing doc')
|
|
713
|
+
}
|
|
714
|
+
|
|
702
715
|
async function setDiffDeepOnSignal ($target, value) {
|
|
703
716
|
if ($target[SEGMENTS].length === 0) throw Error('Can\'t set the root signal data')
|
|
704
717
|
const before = $target.get()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teamplay",
|
|
3
|
-
"version": "0.4.0-alpha.
|
|
3
|
+
"version": "0.4.0-alpha.46",
|
|
4
4
|
"description": "Full-stack signals ORM with multiplayer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
84
|
"license": "MIT",
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "0ca9a2960fd0069c5291dd878523527231b025e2"
|
|
86
86
|
}
|