teamplay 0.4.0-alpha.3 → 0.4.0-alpha.5
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/SignalCompat.js +18 -0
- package/package.json +2 -2
|
@@ -45,6 +45,10 @@ class SignalCompat extends Signal {
|
|
|
45
45
|
static ID_FIELDS = ['_id', 'id']
|
|
46
46
|
static [GETTERS] = [...DEFAULT_GETTERS, 'getCopy', 'getDeepCopy']
|
|
47
47
|
|
|
48
|
+
get root () {
|
|
49
|
+
return this.scope()
|
|
50
|
+
}
|
|
51
|
+
|
|
48
52
|
path (subpath) {
|
|
49
53
|
if (arguments.length > 1) throw Error('Signal.path() expects a single argument')
|
|
50
54
|
if (arguments.length === 0) return super.path()
|
|
@@ -157,6 +161,20 @@ class SignalCompat extends Signal {
|
|
|
157
161
|
return Signal.prototype.set.call($target, value)
|
|
158
162
|
}
|
|
159
163
|
|
|
164
|
+
async add (collectionOrValue, value) {
|
|
165
|
+
const isRoot = this[SEGMENTS].length === 0
|
|
166
|
+
const isRootCollectionCall = isRoot && typeof collectionOrValue === 'string'
|
|
167
|
+
|
|
168
|
+
if (isRootCollectionCall) {
|
|
169
|
+
if (arguments.length !== 2) throw Error('Signal.add() expects (collection, object)')
|
|
170
|
+
if (!value || typeof value !== 'object') throw Error('Signal.add() expects an object argument')
|
|
171
|
+
return this[collectionOrValue].add(value)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (arguments.length > 1) throw Error('Signal.add() expects a single argument')
|
|
175
|
+
return Signal.prototype.add.call(this, collectionOrValue)
|
|
176
|
+
}
|
|
177
|
+
|
|
160
178
|
async setNull (path, value) {
|
|
161
179
|
const forwarded = forwardRef(this, 'setNull', arguments)
|
|
162
180
|
if (forwarded) return forwarded
|
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.5",
|
|
4
4
|
"description": "Full-stack signals ORM with multiplayer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
83
|
"license": "MIT",
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "93822e92cb6810848482286b41a14c47bfda8393"
|
|
85
85
|
}
|