teamplay 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/orm/Signal.js +28 -0
  2. package/package.json +8 -8
package/orm/Signal.js CHANGED
@@ -86,6 +86,34 @@ export default class Signal extends Function {
86
86
  }
87
87
  }
88
88
 
89
+ // TODO: implement a json0 operation for push
90
+ async push (value) {
91
+ if (arguments.length > 1) throw Error('Signal.push() expects a single argument')
92
+ if (this[SEGMENTS].length < 2) throw Error('Can\'t push to a collection or root signal')
93
+ if (this[IS_QUERY]) throw Error('Signal.push() can\'t be used on a query signal')
94
+ const array = this.get()
95
+ await this[array?.length || 0].set(value)
96
+ }
97
+
98
+ // TODO: implement a json0 operation for pop
99
+ async pop () {
100
+ if (arguments.length > 0) throw Error('Signal.pop() does not accept any arguments')
101
+ if (this[IS_QUERY]) throw Error('Signal.pop() can\'t be used on a query signal')
102
+ const array = this.get()
103
+ if (!Array.isArray(array) || array.length === 0) return
104
+ await this[array.length - 1].del()
105
+ }
106
+
107
+ // TODO: implement a json0 operation for unshift
108
+ async unshift (value) {
109
+ throw Error('Signal.unshift() is not implemented yet')
110
+ }
111
+
112
+ // TODO: implement a json0 operation for shift
113
+ async shift () {
114
+ throw Error('Signal.shift() is not implemented yet')
115
+ }
116
+
89
117
  // TODO: make it use an actual increment json0 operation on public collections
90
118
  async increment (value) {
91
119
  if (arguments.length > 1) throw Error('Signal.increment() expects a single argument')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamplay",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@nx-js/observer-util": "^4.1.3",
26
- "@teamplay/backend": "^0.1.9",
27
- "@teamplay/cache": "^0.1.9",
28
- "@teamplay/channel": "^0.1.9",
29
- "@teamplay/debug": "^0.1.9",
30
- "@teamplay/schema": "^0.1.9",
31
- "@teamplay/utils": "^0.1.9",
26
+ "@teamplay/backend": "^0.1.10",
27
+ "@teamplay/cache": "^0.1.10",
28
+ "@teamplay/channel": "^0.1.10",
29
+ "@teamplay/debug": "^0.1.10",
30
+ "@teamplay/schema": "^0.1.10",
31
+ "@teamplay/utils": "^0.1.10",
32
32
  "diff-match-patch": "^1.0.5",
33
33
  "events": "^3.3.0",
34
34
  "json0-ot-diff": "^1.1.2",
@@ -63,5 +63,5 @@
63
63
  ]
64
64
  },
65
65
  "license": "MIT",
66
- "gitHead": "e6a092cd5d261ac516d96b7fbd6c7087e40c4398"
66
+ "gitHead": "7bf445e99d3820893328f9fa5842759df9bbab84"
67
67
  }