@reboot-dev/reboot-std 0.23.0 → 0.24.0
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/package.json +3 -3
- package/presence/index.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reboot-dev/reboot-std",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Reboot standard library.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"author": "reboot-dev",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@reboot-dev/reboot-std-api": "0.
|
|
14
|
-
"@reboot-dev/reboot": "0.
|
|
13
|
+
"@reboot-dev/reboot-std-api": "0.24.0",
|
|
14
|
+
"@reboot-dev/reboot": "0.24.0"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"devDependencies": {
|
package/presence/index.js
CHANGED
|
@@ -12,9 +12,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _Event_resolve, _Event_promise, _SubscriberServicer_disconnectEvents;
|
|
13
13
|
import { until, } from "@reboot-dev/reboot";
|
|
14
14
|
import { AlreadyExists, FailedPrecondition, NotFound, } from "@reboot-dev/reboot-api/errors_pb.js";
|
|
15
|
-
import { Presence, } from "@reboot-dev/reboot-std-api/presence/v1/presence_rbt.js";
|
|
16
15
|
import { MousePosition, } from "@reboot-dev/reboot-std-api/presence/mouse_tracker/v1/mouse_position_rbt.js";
|
|
17
16
|
import { Subscriber, } from "@reboot-dev/reboot-std-api/presence/subscriber/v1/subscriber_rbt.js";
|
|
17
|
+
import { Presence, } from "@reboot-dev/reboot-std-api/presence/v1/presence_rbt.js";
|
|
18
18
|
class Event {
|
|
19
19
|
constructor() {
|
|
20
20
|
_Event_resolve.set(this, void 0);
|
|
@@ -39,12 +39,12 @@ class PresenceServicer extends Presence.Servicer {
|
|
|
39
39
|
if (state.subscriberIds.includes(request.subscriberId)) {
|
|
40
40
|
return {};
|
|
41
41
|
}
|
|
42
|
-
const status = await Subscriber.
|
|
42
|
+
const status = await Subscriber.ref(request.subscriberId).status(context);
|
|
43
43
|
if (!status.present) {
|
|
44
44
|
throw new Presence.SubscribeAborted(new FailedPrecondition());
|
|
45
45
|
}
|
|
46
46
|
state.subscriberIds = state.subscriberIds.concat(request.subscriberId);
|
|
47
|
-
await this.
|
|
47
|
+
await this.ref().schedule().watch(context, {
|
|
48
48
|
subscriberId: request.subscriberId,
|
|
49
49
|
});
|
|
50
50
|
return {};
|
|
@@ -53,7 +53,7 @@ class PresenceServicer extends Presence.Servicer {
|
|
|
53
53
|
// We *atomically* wait until no longer present and remove.
|
|
54
54
|
await until("no longer present", context, async () => {
|
|
55
55
|
return this.state.unidempotently().write(context, async (state) => {
|
|
56
|
-
const subscriber = Subscriber.
|
|
56
|
+
const subscriber = Subscriber.ref(request.subscriberId);
|
|
57
57
|
const { present } = await subscriber.status(context);
|
|
58
58
|
if (!present) {
|
|
59
59
|
state.subscriberIds = state.subscriberIds.filter((subscriberId) => subscriberId !== request.subscriberId);
|
|
@@ -97,7 +97,7 @@ class SubscriberServicer extends Subscriber.Servicer {
|
|
|
97
97
|
throw new Subscriber.ToggleAborted(new NotFound());
|
|
98
98
|
}
|
|
99
99
|
state.toggles += 1;
|
|
100
|
-
await this.
|
|
100
|
+
await this.ref()
|
|
101
101
|
.schedule()
|
|
102
102
|
.waitForDisconnect(context, { nonce: request.nonce });
|
|
103
103
|
return {};
|