@voltro/plugin-presence 0.83.1 → 0.85.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/CHANGELOG.md +1191 -0
- package/THIRD-PARTY-NOTICES.md +1 -57
- package/dist/errors.d.ts +5 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +21 -11
- package/dist/rpc.d.ts +18 -21
- package/dist/rpc.js +4 -10
- package/package.json +5 -5
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -5,66 +5,10 @@ property of its respective copyright holders and is used under the terms of
|
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/plugin-presence itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (11 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## @effect/experimental@0.61.1
|
|
13
|
-
|
|
14
|
-
License: MIT
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
MIT License
|
|
18
|
-
|
|
19
|
-
Copyright (c) 2023-present The Contributors
|
|
20
|
-
|
|
21
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
-
in the Software without restriction, including without limitation the rights
|
|
24
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
-
furnished to do so, subject to the following conditions:
|
|
27
|
-
|
|
28
|
-
The above copyright notice and this permission notice shall be included in all
|
|
29
|
-
copies or substantial portions of the Software.
|
|
30
|
-
|
|
31
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
-
SOFTWARE.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## @effect/sql@0.52.1
|
|
41
|
-
|
|
42
|
-
License: MIT
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
MIT License
|
|
46
|
-
|
|
47
|
-
Copyright (c) 2023-present The Contributors
|
|
48
|
-
|
|
49
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
-
in the Software without restriction, including without limitation the rights
|
|
52
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
-
furnished to do so, subject to the following conditions:
|
|
55
|
-
|
|
56
|
-
The above copyright notice and this permission notice shall be included in all
|
|
57
|
-
copies or substantial portions of the Software.
|
|
58
|
-
|
|
59
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
-
SOFTWARE.
|
|
66
|
-
```
|
|
67
|
-
|
|
68
12
|
## @tanstack/devtools-event-client@0.4.4
|
|
69
13
|
|
|
70
14
|
License: MIT
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
+
import { YieldableError } from 'effect/Cause';
|
|
2
3
|
|
|
3
4
|
/** The caller has no presence identity — an anonymous subject (no subject id)
|
|
4
5
|
* that also passed no explicit `key`. There's nothing stable to register a
|
|
@@ -7,11 +8,9 @@ import { Schema } from 'effect';
|
|
|
7
8
|
export declare class PresenceKeyMissing extends PresenceKeyMissing_base {
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
declare const PresenceKeyMissing_base: Schema.
|
|
11
|
-
readonly
|
|
12
|
-
}
|
|
13
|
-
channel: typeof Schema.String;
|
|
14
|
-
}>;
|
|
11
|
+
declare const PresenceKeyMissing_base: Schema.Class<PresenceKeyMissing, Schema.TaggedStruct<"PresenceKeyMissing", {
|
|
12
|
+
readonly channel: Schema.String;
|
|
13
|
+
}>, YieldableError>;
|
|
15
14
|
|
|
16
15
|
/** The presence store isn't bound — `bindDataStore` never ran. This is a boot/
|
|
17
16
|
* wiring bug (the plugin wasn't installed on an app with a DataStore), not a
|
|
@@ -19,8 +18,6 @@ declare const PresenceKeyMissing_base: Schema.TaggedErrorClass<PresenceKeyMissin
|
|
|
19
18
|
export declare class PresenceStoreUnavailable extends PresenceStoreUnavailable_base {
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
declare const PresenceStoreUnavailable_base: Schema.
|
|
23
|
-
readonly _tag: Schema.tag<"PresenceStoreUnavailable">;
|
|
24
|
-
}>;
|
|
21
|
+
declare const PresenceStoreUnavailable_base: Schema.Class<PresenceStoreUnavailable, Schema.TaggedStruct<"PresenceStoreUnavailable", {}>, YieldableError>;
|
|
25
22
|
|
|
26
23
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Effect } from 'effect';
|
|
|
3
3
|
import { ReactivityChannel } from '@voltro/protocol';
|
|
4
4
|
import { Schema } from 'effect';
|
|
5
5
|
import { VoltroPlugin } from '@voltro/protocol';
|
|
6
|
+
import { YieldableError } from 'effect/Cause';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Wire a tracker to the transport and the membership registry.
|
|
@@ -84,11 +85,9 @@ export declare type PresenceDelta = {
|
|
|
84
85
|
export declare class PresenceKeyMissing extends PresenceKeyMissing_base {
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
declare const PresenceKeyMissing_base: Schema.
|
|
88
|
-
readonly
|
|
89
|
-
}
|
|
90
|
-
channel: typeof Schema.String;
|
|
91
|
-
}>;
|
|
88
|
+
declare const PresenceKeyMissing_base: Schema.Class<PresenceKeyMissing, Schema.TaggedStruct<"PresenceKeyMissing", {
|
|
89
|
+
readonly channel: Schema.String;
|
|
90
|
+
}>, YieldableError>;
|
|
92
91
|
|
|
93
92
|
export declare interface PresenceMember {
|
|
94
93
|
/** Stable per-client key — the subject id, or a client-supplied one. */
|
|
@@ -222,9 +221,7 @@ export declare const presenceRoster: ReactivityChannel;
|
|
|
222
221
|
export declare class PresenceStoreUnavailable extends PresenceStoreUnavailable_base {
|
|
223
222
|
}
|
|
224
223
|
|
|
225
|
-
declare const PresenceStoreUnavailable_base: Schema.
|
|
226
|
-
readonly _tag: Schema.tag<"PresenceStoreUnavailable">;
|
|
227
|
-
}>;
|
|
224
|
+
declare const PresenceStoreUnavailable_base: Schema.Class<PresenceStoreUnavailable, Schema.TaggedStruct<"PresenceStoreUnavailable", {}>, YieldableError>;
|
|
228
225
|
|
|
229
226
|
/**
|
|
230
227
|
* The merged presence view this instance can see.
|
|
@@ -245,6 +242,7 @@ export declare class PresenceTracker {
|
|
|
245
242
|
/** This instance's id — the owner stamped on everything it tracks. */
|
|
246
243
|
get owner(): string;
|
|
247
244
|
private branch;
|
|
245
|
+
private removeMember;
|
|
248
246
|
/**
|
|
249
247
|
* Record a heartbeat from a client THIS instance holds.
|
|
250
248
|
*
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,14 @@ var f = (e, t) => `${e ?? "~"}::${t}`, p = (e) => e === void 0 ? "undefined" : t
|
|
|
23
23
|
members: /* @__PURE__ */ new Map()
|
|
24
24
|
}, r.set(i, a)), a;
|
|
25
25
|
}
|
|
26
|
+
removeMember(e, t, n, r) {
|
|
27
|
+
let i = this.partitions.get(e);
|
|
28
|
+
if (i === void 0) return !1;
|
|
29
|
+
let a = f(t, n), o = i.get(a);
|
|
30
|
+
if (o === void 0) return !1;
|
|
31
|
+
let s = o.members.delete(r);
|
|
32
|
+
return o.members.size === 0 && i.delete(a), i.size === 0 && this.partitions.delete(e), s;
|
|
33
|
+
}
|
|
26
34
|
track(e) {
|
|
27
35
|
let t = this.now(), n = e.meta ?? null, { members: r } = this.branch(this.selfId, e.tenantId, e.channel), i = r.get(e.key);
|
|
28
36
|
return r.set(e.key, {
|
|
@@ -42,7 +50,7 @@ var f = (e, t) => `${e ?? "~"}::${t}`, p = (e) => e === void 0 ? "undefined" : t
|
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
52
|
untrack(e) {
|
|
45
|
-
let t = this.
|
|
53
|
+
let t = this.removeMember(this.selfId, e.tenantId, e.channel, e.key);
|
|
46
54
|
return {
|
|
47
55
|
delta: {
|
|
48
56
|
op: "remove",
|
|
@@ -55,9 +63,8 @@ var f = (e, t) => `${e ?? "~"}::${t}`, p = (e) => e === void 0 ? "undefined" : t
|
|
|
55
63
|
}
|
|
56
64
|
apply(e, t) {
|
|
57
65
|
if (e === this.selfId) return !1;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let r = n.get(t.key);
|
|
66
|
+
if (t.op === "remove") return this.removeMember(e, t.tenantId, t.channel, t.key);
|
|
67
|
+
let { members: n } = this.branch(e, t.tenantId, t.channel), r = n.get(t.key);
|
|
61
68
|
return n.set(t.key, {
|
|
62
69
|
key: t.key,
|
|
63
70
|
meta: t.meta,
|
|
@@ -76,13 +83,16 @@ var f = (e, t) => `${e ?? "~"}::${t}`, p = (e) => e === void 0 ? "undefined" : t
|
|
|
76
83
|
let t = this.partitions.get(this.selfId);
|
|
77
84
|
if (t === void 0) return [];
|
|
78
85
|
let n = this.now() - e, r = [];
|
|
79
|
-
for (let e
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
for (let [e, i] of t) {
|
|
87
|
+
for (let [e, t] of i.members) t.lastSeen >= n || (i.members.delete(e), r.push({
|
|
88
|
+
op: "remove",
|
|
89
|
+
channel: i.channel,
|
|
90
|
+
tenantId: i.tenantId,
|
|
91
|
+
key: e
|
|
92
|
+
}));
|
|
93
|
+
i.members.size === 0 && t.delete(e);
|
|
94
|
+
}
|
|
95
|
+
return t.size === 0 && this.partitions.delete(this.selfId), r;
|
|
86
96
|
}
|
|
87
97
|
ownSnapshot() {
|
|
88
98
|
let e = [], t = this.partitions.get(this.selfId);
|
package/dist/rpc.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { PluginRpcClientDescriptor } from '@voltro/protocol';
|
|
|
3
3
|
import { QueryProcedureDescriptor } from '@voltro/protocol';
|
|
4
4
|
import { ReactivityChannel } from '@voltro/protocol';
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
|
+
import { YieldableError } from 'effect/Cause';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The plugin's canonical package name — the key an app's `alias` is recorded
|
|
@@ -17,25 +18,25 @@ import { Schema } from 'effect';
|
|
|
17
18
|
export declare const BASE_NAME = "@voltro/plugin-presence";
|
|
18
19
|
|
|
19
20
|
export declare const heartbeatDescriptor: MutationProcedureDescriptor<"presence.heartbeat", Schema.Struct<{
|
|
20
|
-
channel:
|
|
21
|
-
key: Schema.optional<
|
|
22
|
-
meta: Schema.optional<Schema
|
|
21
|
+
readonly channel: Schema.String;
|
|
22
|
+
readonly key: Schema.optional<Schema.String>;
|
|
23
|
+
readonly meta: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
23
24
|
}>, Schema.Struct<{
|
|
24
|
-
ok:
|
|
25
|
-
}>, Schema.Union<[typeof PresenceKeyMissing, typeof PresenceStoreUnavailable]>>;
|
|
25
|
+
readonly ok: Schema.Boolean;
|
|
26
|
+
}>, Schema.Union<readonly [typeof PresenceKeyMissing, typeof PresenceStoreUnavailable]>>;
|
|
26
27
|
|
|
27
28
|
export declare const leaveDescriptor: MutationProcedureDescriptor<"presence.leave", Schema.Struct<{
|
|
28
|
-
channel:
|
|
29
|
-
key: Schema.optional<
|
|
29
|
+
readonly channel: Schema.String;
|
|
30
|
+
readonly key: Schema.optional<Schema.String>;
|
|
30
31
|
}>, Schema.Struct<{
|
|
31
|
-
ok:
|
|
32
|
-
}>, Schema.Union<[typeof PresenceKeyMissing, typeof PresenceStoreUnavailable]>>;
|
|
32
|
+
readonly ok: Schema.Boolean;
|
|
33
|
+
}>, Schema.Union<readonly [typeof PresenceKeyMissing, typeof PresenceStoreUnavailable]>>;
|
|
33
34
|
|
|
34
35
|
export declare const listDescriptor: QueryProcedureDescriptor<"presence.list", Schema.Struct<{
|
|
35
|
-
channel:
|
|
36
|
-
}>, Schema
|
|
37
|
-
key:
|
|
38
|
-
meta: Schema.NullOr<Schema
|
|
36
|
+
readonly channel: Schema.String;
|
|
37
|
+
}>, Schema.$Array<Schema.Struct<{
|
|
38
|
+
readonly key: Schema.String;
|
|
39
|
+
readonly meta: Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
39
40
|
}>>, typeof PresenceStoreUnavailable>;
|
|
40
41
|
|
|
41
42
|
/** The caller has no presence identity — an anonymous subject (no subject id)
|
|
@@ -45,11 +46,9 @@ export declare const listDescriptor: QueryProcedureDescriptor<"presence.list", S
|
|
|
45
46
|
declare class PresenceKeyMissing extends PresenceKeyMissing_base {
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
declare const PresenceKeyMissing_base: Schema.
|
|
49
|
-
readonly
|
|
50
|
-
}
|
|
51
|
-
channel: typeof Schema.String;
|
|
52
|
-
}>;
|
|
49
|
+
declare const PresenceKeyMissing_base: Schema.Class<PresenceKeyMissing, Schema.TaggedStruct<"PresenceKeyMissing", {
|
|
50
|
+
readonly channel: Schema.String;
|
|
51
|
+
}>, YieldableError>;
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* The roster's reactivity channel — presence's push target.
|
|
@@ -76,8 +75,6 @@ export declare const presenceRpcClientImports: ReadonlyArray<PluginRpcClientDesc
|
|
|
76
75
|
declare class PresenceStoreUnavailable extends PresenceStoreUnavailable_base {
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
declare const PresenceStoreUnavailable_base: Schema.
|
|
80
|
-
readonly _tag: Schema.tag<"PresenceStoreUnavailable">;
|
|
81
|
-
}>;
|
|
78
|
+
declare const PresenceStoreUnavailable_base: Schema.Class<PresenceStoreUnavailable, Schema.TaggedStruct<"PresenceStoreUnavailable", {}>, YieldableError>;
|
|
82
79
|
|
|
83
80
|
export { }
|
package/dist/rpc.js
CHANGED
|
@@ -4,22 +4,16 @@ import { defineMutation as r, defineQuery as i, reactivityChannel as a } from "@
|
|
|
4
4
|
//#region src/rpc.ts
|
|
5
5
|
var o = "@voltro/plugin-presence", s = a("presence"), c = n.Struct({
|
|
6
6
|
key: n.String,
|
|
7
|
-
meta: n.NullOr(n.Record(
|
|
8
|
-
key: n.String,
|
|
9
|
-
value: n.Unknown
|
|
10
|
-
}))
|
|
7
|
+
meta: n.NullOr(n.Record(n.String, n.Unknown))
|
|
11
8
|
}), l = r({
|
|
12
9
|
name: "presence.heartbeat",
|
|
13
10
|
input: n.Struct({
|
|
14
11
|
channel: n.String,
|
|
15
12
|
key: n.optional(n.String),
|
|
16
|
-
meta: n.optional(n.Record(
|
|
17
|
-
key: n.String,
|
|
18
|
-
value: n.Unknown
|
|
19
|
-
}))
|
|
13
|
+
meta: n.optional(n.Record(n.String, n.Unknown))
|
|
20
14
|
}),
|
|
21
15
|
output: n.Struct({ ok: n.Boolean }),
|
|
22
|
-
error: n.Union(e, t),
|
|
16
|
+
error: n.Union([e, t]),
|
|
23
17
|
openAccess: "presence serves anonymous-capable apps; the tracked key defaults to the caller's own subject id (PresenceKeyMissing without one) and entries are tenant-scoped in the tracker"
|
|
24
18
|
}), u = i({
|
|
25
19
|
name: "presence.list",
|
|
@@ -35,7 +29,7 @@ var o = "@voltro/plugin-presence", s = a("presence"), c = n.Struct({
|
|
|
35
29
|
key: n.optional(n.String)
|
|
36
30
|
}),
|
|
37
31
|
output: n.Struct({ ok: n.Boolean }),
|
|
38
|
-
error: n.Union(e, t),
|
|
32
|
+
error: n.Union([e, t]),
|
|
39
33
|
openAccess: "presence serves anonymous-capable apps; the key to remove defaults to the caller's own subject id (PresenceKeyMissing without one) and removal is tenant-scoped in the tracker"
|
|
40
34
|
}), f = [
|
|
41
35
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-presence",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "Ephemeral realtime presence — who is online in a channel, with heartbeat + live roster + per-member metadata (cursor, status — client-supplied and relayed verbatim; identity fields belong in the server-side resolveMember hook). Held in memory, owner-partitioned; cross-instance with @voltro/plugin-broadcast.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"node": ">=24.0.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@voltro/client": "0.
|
|
52
|
-
"@voltro/protocol": "0.
|
|
51
|
+
"@voltro/client": "0.85.0",
|
|
52
|
+
"@voltro/protocol": "0.85.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@voltro/database": "0.
|
|
56
|
-
"effect": "
|
|
55
|
+
"@voltro/database": "0.85.0",
|
|
56
|
+
"effect": "4.0.1",
|
|
57
57
|
"react": "^19.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|