@margoengine/netcode 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +1306 -3
- package/dist/client.d.ts +167 -0
- package/dist/clock.d.ts +29 -0
- package/dist/extrapolate.d.ts +42 -0
- package/dist/extrapolate.js +25 -0
- package/dist/game.d.ts +68 -0
- package/dist/generate-rust.d.ts +14 -0
- package/dist/generate-rust.js +184 -0
- package/dist/generate.d.ts +25 -0
- package/dist/generate.js +156 -0
- package/dist/hitboxes.d.ts +74 -0
- package/dist/hitboxes.js +124 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +457 -0
- package/dist/interest.d.ts +101 -0
- package/dist/interest.js +166 -0
- package/dist/interpolation-delay.d.ts +114 -0
- package/dist/interpolation-delay.js +79 -0
- package/dist/interpolation-fields.d.ts +117 -0
- package/dist/interpolation-fields.js +147 -0
- package/dist/interpolation-timeline.d.ts +100 -0
- package/dist/interpolation-timeline.js +122 -0
- package/dist/interpolation.d.ts +39 -0
- package/dist/interpolation.js +61 -0
- package/dist/lag.d.ts +62 -0
- package/dist/lobby.d.ts +77 -0
- package/dist/lobby.js +96 -0
- package/dist/loopback.d.ts +92 -0
- package/dist/media.d.ts +197 -0
- package/dist/media.js +274 -0
- package/dist/migrate.d.ts +113 -0
- package/dist/migrate.js +289 -0
- package/dist/node.d.ts +101 -0
- package/dist/node.js +166 -0
- package/dist/physics.d.ts +133 -0
- package/dist/physics.js +169 -0
- package/dist/presence.d.ts +156 -0
- package/dist/presence.js +226 -0
- package/dist/protocol-asi_qndb.js +122 -0
- package/dist/protocol.d.ts +75 -0
- package/dist/relay.d.ts +152 -0
- package/dist/relay.js +235 -0
- package/dist/rollback.d.ts +131 -0
- package/dist/rollback.js +194 -0
- package/dist/rooms.d.ts +366 -0
- package/dist/rooms.js +479 -0
- package/dist/schema-CMfqK4Gu.js +616 -0
- package/dist/schema.d.ts +263 -0
- package/dist/server-DAVzHcWW.js +203 -0
- package/dist/server.d.ts +147 -0
- package/dist/shared/bytes.d.ts +36 -0
- package/dist/signal.d.ts +156 -0
- package/dist/signal.js +261 -0
- package/dist/smoothing.d.ts +76 -0
- package/dist/smoothing.js +155 -0
- package/dist/transport-DeQodwyv.js +49 -0
- package/dist/transport.d.ts +76 -0
- package/dist/webrtc.d.ts +32 -0
- package/dist/webrtc.js +64 -0
- package/dist/websocket.d.ts +27 -0
- package/dist/websocket.js +42 -0
- package/dist/webtransport.d.ts +83 -0
- package/dist/webtransport.js +120 -0
- package/package.json +140 -6
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { Game } from './game.js';
|
|
2
|
+
import { type Snapshot } from './interpolation.js';
|
|
3
|
+
import type { UntypedSchema } from './schema.js';
|
|
4
|
+
/** A physics world as {@link physicsGame} drives it: a `Physics` of `@margoengine/physics` fits. */
|
|
5
|
+
export interface RollbackWorld<S extends {
|
|
6
|
+
readonly bytes: Uint8Array;
|
|
7
|
+
} = {
|
|
8
|
+
readonly bytes: Uint8Array;
|
|
9
|
+
}> {
|
|
10
|
+
/** The step's length in seconds; the game's tick rate is its inverse. */
|
|
11
|
+
readonly fixedTimestep: number;
|
|
12
|
+
takeSnapshot(): S;
|
|
13
|
+
restoreSnapshot(snapshot: S): unknown;
|
|
14
|
+
step(): unknown;
|
|
15
|
+
}
|
|
16
|
+
/** Options of {@link physicsGame}. */
|
|
17
|
+
export interface PhysicsGameOptions<Input, S extends {
|
|
18
|
+
readonly bytes: Uint8Array;
|
|
19
|
+
}> {
|
|
20
|
+
/** The world every peer builds the same way before the session starts, with every body it will ever hold. */
|
|
21
|
+
world: RollbackWorld<S>;
|
|
22
|
+
/** The schema with the input struct (the same on every peer). */
|
|
23
|
+
schema: UntypedSchema;
|
|
24
|
+
/** The name of the input struct in `schema`. */
|
|
25
|
+
input: string;
|
|
26
|
+
/** Drives the world for one tick from each player's input (forces, impulses, motor targets), before it steps. */
|
|
27
|
+
apply(inputs: ReadonlyMap<number, Input>, tick: number): void;
|
|
28
|
+
}
|
|
29
|
+
/** The name the state of a {@link physicsGame} has in its schema. */
|
|
30
|
+
export declare const PHYSICS_STATE = "PhysicsWorld";
|
|
31
|
+
/**
|
|
32
|
+
* A rollback game whose state is a physics world: give it to `RollbackSession` (`@margoengine/netcode/rollback`). Its state is
|
|
33
|
+
* the world's snapshot bytes; each tick loads them into the world, lets `apply` drive it from the players' inputs, steps it once
|
|
34
|
+
* and keeps the snapshot it leaves, so rolling back is loading an older snapshot. Every peer must build the same world in the
|
|
35
|
+
* same order and add or remove no body, collider or joint while the session runs (a snapshot restores into the world it was
|
|
36
|
+
* taken from); keep bodies for players who may join, asleep or out of the way. The tick rate is the world's step rate,
|
|
37
|
+
* `1 / world.fixedTimestep`, a whole number from 1 to 240.
|
|
38
|
+
* @throws RangeError for a world whose step is not a whole tick rate, or a schema without the input struct.
|
|
39
|
+
*/
|
|
40
|
+
export declare function physicsGame<Input, S extends {
|
|
41
|
+
readonly bytes: Uint8Array;
|
|
42
|
+
}>(options: PhysicsGameOptions<Input, S>): Game<Uint8Array, Input>;
|
|
43
|
+
/**
|
|
44
|
+
* The difference from snapshot `base` to snapshot `next` (bytes of the same length): for each run, the count of 32-bit words
|
|
45
|
+
* that did not change and of those that did, as varints, then the changed words XORed with the base's. What stood still costs
|
|
46
|
+
* almost nothing, so a world where a few bodies move sends a few hundred bytes for what is a megabyte whole.
|
|
47
|
+
* {@link applySnapshotDiff} undoes it exactly.
|
|
48
|
+
* @throws RangeError for snapshots of different lengths.
|
|
49
|
+
*/
|
|
50
|
+
export declare function snapshotDiff(base: Uint8Array, next: Uint8Array): Uint8Array;
|
|
51
|
+
/**
|
|
52
|
+
* The snapshot `diff` ({@link snapshotDiff}) makes of `base`: a new array, `base` untouched.
|
|
53
|
+
* @throws RangeError for a diff of another length of snapshot, or one that is cut short or runs past the end.
|
|
54
|
+
*/
|
|
55
|
+
export declare function applySnapshotDiff(base: Uint8Array, diff: Uint8Array): Uint8Array;
|
|
56
|
+
/** A body as {@link bodyStates} reads it: a `PhysicsBody` of `@margoengine/physics` fits. */
|
|
57
|
+
export interface StateBody {
|
|
58
|
+
readonly position: ArrayLike<number>;
|
|
59
|
+
readonly rotation: ArrayLike<number>;
|
|
60
|
+
readonly linearVelocity: ArrayLike<number>;
|
|
61
|
+
}
|
|
62
|
+
/** One body's pose and speed in a server's state: position, rotation (x, y, z, w) and velocity. */
|
|
63
|
+
export interface BodyState {
|
|
64
|
+
px: number;
|
|
65
|
+
py: number;
|
|
66
|
+
pz: number;
|
|
67
|
+
qx: number;
|
|
68
|
+
qy: number;
|
|
69
|
+
qz: number;
|
|
70
|
+
qw: number;
|
|
71
|
+
vx: number;
|
|
72
|
+
vy: number;
|
|
73
|
+
vz: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The fields of a {@link BodyState}, for a struct of a schema (`defineSchema({types: {Body: BODY_STATE_FIELDS, State: {bodies: {type: 'map',
|
|
77
|
+
* of: 'Body'}}}})`): positions and speeds as `f32`, rotations as `f32` too (a quaternion's parts are below 1, so they keep about
|
|
78
|
+
* seven digits).
|
|
79
|
+
*/
|
|
80
|
+
export declare const BODY_STATE_FIELDS: {
|
|
81
|
+
readonly px: 'f32';
|
|
82
|
+
readonly py: 'f32';
|
|
83
|
+
readonly pz: 'f32';
|
|
84
|
+
readonly qx: 'f32';
|
|
85
|
+
readonly qy: 'f32';
|
|
86
|
+
readonly qz: 'f32';
|
|
87
|
+
readonly qw: 'f32';
|
|
88
|
+
readonly vx: 'f32';
|
|
89
|
+
readonly vy: 'f32';
|
|
90
|
+
readonly vz: 'f32';
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* A server's bodies as state for its clients (`GameServer` sends it, as deltas against what each client has): `bodies` gives
|
|
94
|
+
* each an id, and the result maps each id to its {@link BodyState}, written into `out` when given (entries of ids no longer
|
|
95
|
+
* given are removed).
|
|
96
|
+
*/
|
|
97
|
+
export declare function bodyStates(bodies: Iterable<readonly [number, StateBody]>, out?: Map<number, BodyState>): Map<number, BodyState>;
|
|
98
|
+
/** A body a client moves to where the server's was: a kinematic `PhysicsBody` fits (or anything with these two). */
|
|
99
|
+
export interface ProxyBody {
|
|
100
|
+
setNextPosition(position: readonly [number, number, number]): unknown;
|
|
101
|
+
setNextRotation(rotation: readonly [number, number, number, number]): unknown;
|
|
102
|
+
}
|
|
103
|
+
/** Options of {@link BodyInterpolator}. */
|
|
104
|
+
export interface BodyInterpolatorOptions {
|
|
105
|
+
/** Snapshots kept a body (default 32). */
|
|
106
|
+
capacity?: number;
|
|
107
|
+
/** Most seconds a body is carried on past its newest snapshot by its velocity (default 0.25). */
|
|
108
|
+
maxPrediction?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A client's view of a server's bodies: {@link BodyInterpolator.push} each state the server sends, with its time, and
|
|
112
|
+
* {@link BodyInterpolator.sample} at the time you draw (the server's time less an interpolation delay a little over its send
|
|
113
|
+
* interval). Each body plays through a `SnapshotBuffer`: Hermite positions from the positions and velocities, slerped
|
|
114
|
+
* rotations, and a bounded run past the newest (Fiedler, "Snapshot Interpolation", Gaffer On Games, 2014). A body missing
|
|
115
|
+
* from a state is dropped.
|
|
116
|
+
*/
|
|
117
|
+
export declare class BodyInterpolator {
|
|
118
|
+
private readonly options;
|
|
119
|
+
private readonly buffers;
|
|
120
|
+
private readonly outputs;
|
|
121
|
+
private readonly position;
|
|
122
|
+
private readonly rotation;
|
|
123
|
+
private readonly velocity;
|
|
124
|
+
constructor(options?: BodyInterpolatorOptions);
|
|
125
|
+
/** The ids it holds. */
|
|
126
|
+
get ids(): number[];
|
|
127
|
+
/** Takes the server's bodies at `time` seconds. Returns how many states it took (a repeated or late one is skipped). */
|
|
128
|
+
push(time: number, states: ReadonlyMap<number, BodyState>): number;
|
|
129
|
+
/** Where each body is at `time` seconds: its position, rotation and velocity, by id (each a reused snapshot). */
|
|
130
|
+
sample(time: number): Map<number, Snapshot>;
|
|
131
|
+
/** Moves each proxy to where its body is at `time` seconds, through the kinematic targets of its next step. */
|
|
132
|
+
apply(time: number, proxies: ReadonlyMap<number, ProxyBody>): this;
|
|
133
|
+
}
|
package/dist/physics.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { SnapshotBuffer as e, createSnapshot as t } from "./interpolation.js";
|
|
2
|
+
//#region src/physics.ts
|
|
3
|
+
var n = "PhysicsWorld";
|
|
4
|
+
function r(e) {
|
|
5
|
+
let { world: t, schema: r, input: a, apply: c } = e, l = Math.round(1 / t.fixedTimestep);
|
|
6
|
+
if (!(l >= 1 && l <= 240) || Math.abs(l * t.fixedTimestep - 1) > 1e-9) throw RangeError(`A rollback physics world needs a step of 1 / n seconds for a whole n from 1 to 240 (got ${t.fixedTimestep} s); set fixedTimestep to 1 / 60, say.`);
|
|
7
|
+
if (!r.names.includes(a)) throw RangeError(`The schema has no struct "${a}"; pass the name of its input struct.`);
|
|
8
|
+
let u = t.takeSnapshot(), d = u.bytes.byteLength, f = (e) => {
|
|
9
|
+
if (!(e instanceof Uint8Array) || e.byteLength !== d) throw RangeError(`A physics state is the ${d} bytes of the world's snapshot (got ${e?.byteLength ?? typeof e}); the world grew or another world sent it.`);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
schema: {
|
|
14
|
+
json: r.json,
|
|
15
|
+
hash: (r.hash ^ 1540483477 ^ d) >>> 0,
|
|
16
|
+
names: [...r.names, n],
|
|
17
|
+
encode: (e, t) => e === "PhysicsWorld" ? f(t).slice() : r.encode(e, t),
|
|
18
|
+
decode: (e, t) => e === "PhysicsWorld" ? f(t).slice() : r.decode(e, t),
|
|
19
|
+
encodeDelta: (e, t, n) => e === "PhysicsWorld" ? o(f(n), f(t)) : r.encodeDelta(e, t, n),
|
|
20
|
+
decodeDelta: (e, t, n) => e === "PhysicsWorld" ? s(f(n), t) : r.decodeDelta(e, t, n),
|
|
21
|
+
equals: (e, t, n) => e === "PhysicsWorld" ? i(t, n) : r.equals(e, t, n),
|
|
22
|
+
clone: (e, t) => e === "PhysicsWorld" ? f(t).slice() : r.clone(e, t),
|
|
23
|
+
interpolate: (e, t, n, i) => e === "PhysicsWorld" ? (i >= 1 ? n : t).slice() : r.interpolate(e, t, n, i)
|
|
24
|
+
},
|
|
25
|
+
stateType: n,
|
|
26
|
+
inputType: a,
|
|
27
|
+
tickRate: l,
|
|
28
|
+
tickMs: 1e3 / l,
|
|
29
|
+
initial: () => u.bytes.slice(),
|
|
30
|
+
step(e, n, r) {
|
|
31
|
+
t.restoreSnapshot({
|
|
32
|
+
...u,
|
|
33
|
+
bytes: f(e)
|
|
34
|
+
}), c(n, r), t.step(), e.set(t.takeSnapshot().bytes);
|
|
35
|
+
},
|
|
36
|
+
join() {},
|
|
37
|
+
leave() {}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function i(e, t) {
|
|
41
|
+
if (e.byteLength !== t.byteLength) return !1;
|
|
42
|
+
for (let n = 0; n < e.byteLength; n++) if (e[n] !== t[n]) return !1;
|
|
43
|
+
return !0;
|
|
44
|
+
}
|
|
45
|
+
function a(e, t) {
|
|
46
|
+
for (; t >= 128;) e.push(t & 127 | 128), t = Math.floor(t / 128);
|
|
47
|
+
e.push(t);
|
|
48
|
+
}
|
|
49
|
+
function o(e, t) {
|
|
50
|
+
if (e.byteLength !== t.byteLength) throw RangeError(`A snapshot diff needs two snapshots of one world, the same length (got ${e.byteLength} and ${t.byteLength} bytes).`);
|
|
51
|
+
let n = [], r = e.byteLength, i = r >>> 2, o = (e, t) => (e[4 * t] | e[4 * t + 1] << 8 | e[4 * t + 2] << 16 | e[4 * t + 3] << 24) >>> 0;
|
|
52
|
+
a(n, r);
|
|
53
|
+
let s = 0;
|
|
54
|
+
for (; s < i;) {
|
|
55
|
+
let r = 0;
|
|
56
|
+
for (; s + r < i && o(e, s + r) === o(t, s + r);) r++;
|
|
57
|
+
let c = 0;
|
|
58
|
+
for (; s + r + c < i && o(e, s + r + c) !== o(t, s + r + c);) c++;
|
|
59
|
+
a(n, r), a(n, c);
|
|
60
|
+
for (let i = 0; i < c; i++) {
|
|
61
|
+
let a = (o(e, s + r + i) ^ o(t, s + r + i)) >>> 0;
|
|
62
|
+
n.push(a & 255, a >>> 8 & 255, a >>> 16 & 255, a >>> 24);
|
|
63
|
+
}
|
|
64
|
+
s += r + c;
|
|
65
|
+
}
|
|
66
|
+
for (let a = i * 4; a < r; a++) n.push(e[a] ^ t[a]);
|
|
67
|
+
return Uint8Array.from(n);
|
|
68
|
+
}
|
|
69
|
+
function s(e, t) {
|
|
70
|
+
let n = 0, r = () => {
|
|
71
|
+
let e = 0, r = 1;
|
|
72
|
+
for (;;) {
|
|
73
|
+
if (n >= t.byteLength) throw RangeError("This snapshot diff is cut short; send the whole diff.");
|
|
74
|
+
let i = t[n++];
|
|
75
|
+
if (e += (i & 127) * r, i < 128) return e;
|
|
76
|
+
r *= 128;
|
|
77
|
+
}
|
|
78
|
+
}, i = r();
|
|
79
|
+
if (i !== e.byteLength) throw RangeError(`This diff is of a ${i} byte snapshot, not of this ${e.byteLength} byte one; apply it to the baseline it was made from.`);
|
|
80
|
+
let a = e.slice(), o = i >>> 2, s = 0;
|
|
81
|
+
for (; s < o;) {
|
|
82
|
+
let e = r(), i = r();
|
|
83
|
+
if (s += e, s + i > o || n + 4 * i > t.byteLength) throw RangeError("This snapshot diff runs past its snapshot; it was made from another baseline or is damaged.");
|
|
84
|
+
for (let e = 0; e < i; e++, s++) for (let e = 0; e < 4; e++) a[4 * s + e] = a[4 * s + e] ^ t[n++];
|
|
85
|
+
}
|
|
86
|
+
for (let e = o * 4; e < i; e++) {
|
|
87
|
+
if (n >= t.byteLength) throw RangeError("This snapshot diff is cut short; send the whole diff.");
|
|
88
|
+
a[e] = a[e] ^ t[n++];
|
|
89
|
+
}
|
|
90
|
+
if (n !== t.byteLength) throw RangeError("This snapshot diff has bytes past its end; send it as made.");
|
|
91
|
+
return a;
|
|
92
|
+
}
|
|
93
|
+
var c = {
|
|
94
|
+
px: "f32",
|
|
95
|
+
py: "f32",
|
|
96
|
+
pz: "f32",
|
|
97
|
+
qx: "f32",
|
|
98
|
+
qy: "f32",
|
|
99
|
+
qz: "f32",
|
|
100
|
+
qw: "f32",
|
|
101
|
+
vx: "f32",
|
|
102
|
+
vy: "f32",
|
|
103
|
+
vz: "f32"
|
|
104
|
+
};
|
|
105
|
+
function l(e, t = /* @__PURE__ */ new Map()) {
|
|
106
|
+
let n = /* @__PURE__ */ new Set();
|
|
107
|
+
for (let [r, i] of e) {
|
|
108
|
+
let e = i.position, a = i.rotation, o = i.linearVelocity, s = t.get(r) ?? {};
|
|
109
|
+
s.px = e[0], s.py = e[1], s.pz = e[2], s.qx = a[0], s.qy = a[1], s.qz = a[2], s.qw = a[3], s.vx = o[0], s.vy = o[1], s.vz = o[2], t.set(r, s), n.add(r);
|
|
110
|
+
}
|
|
111
|
+
for (let e of [...t.keys()]) n.has(e) || t.delete(e);
|
|
112
|
+
return t;
|
|
113
|
+
}
|
|
114
|
+
var u = class {
|
|
115
|
+
constructor(t = {}) {
|
|
116
|
+
this.options = t, this.buffers = /* @__PURE__ */ new Map(), this.outputs = /* @__PURE__ */ new Map(), this.position = /* @__PURE__ */ new Float64Array(3), this.rotation = /* @__PURE__ */ new Float64Array(4), this.velocity = /* @__PURE__ */ new Float64Array(3), new e(t.capacity ?? 32, t.maxPrediction ?? .25);
|
|
117
|
+
}
|
|
118
|
+
get ids() {
|
|
119
|
+
return [...this.buffers.keys()];
|
|
120
|
+
}
|
|
121
|
+
push(t, n) {
|
|
122
|
+
let r = 0;
|
|
123
|
+
for (let e of [...this.buffers.keys()]) n.has(e) || (this.buffers.delete(e), this.outputs.delete(e));
|
|
124
|
+
for (let [i, a] of n) {
|
|
125
|
+
let n = this.buffers.get(i);
|
|
126
|
+
n || (n = new e(this.options.capacity ?? 32, this.options.maxPrediction ?? .25), this.buffers.set(i, n)), this.position.set([
|
|
127
|
+
a.px,
|
|
128
|
+
a.py,
|
|
129
|
+
a.pz
|
|
130
|
+
]), this.rotation.set([
|
|
131
|
+
a.qx,
|
|
132
|
+
a.qy,
|
|
133
|
+
a.qz,
|
|
134
|
+
a.qw
|
|
135
|
+
]), this.velocity.set([
|
|
136
|
+
a.vx,
|
|
137
|
+
a.vy,
|
|
138
|
+
a.vz
|
|
139
|
+
]), n.push(t, this.position, this.rotation, this.velocity) && r++;
|
|
140
|
+
}
|
|
141
|
+
return r;
|
|
142
|
+
}
|
|
143
|
+
sample(e) {
|
|
144
|
+
let n = /* @__PURE__ */ new Map();
|
|
145
|
+
for (let [r, i] of this.buffers) {
|
|
146
|
+
let a = this.outputs.get(r);
|
|
147
|
+
a || (a = t(), this.outputs.set(r, a)), i.sample(e, a) && n.set(r, a);
|
|
148
|
+
}
|
|
149
|
+
return n;
|
|
150
|
+
}
|
|
151
|
+
apply(e, t) {
|
|
152
|
+
for (let [n, r] of this.sample(e)) {
|
|
153
|
+
let e = t.get(n);
|
|
154
|
+
e && (e.setNextPosition([
|
|
155
|
+
r.position[0],
|
|
156
|
+
r.position[1],
|
|
157
|
+
r.position[2]
|
|
158
|
+
]), e.setNextRotation([
|
|
159
|
+
r.rotation[0],
|
|
160
|
+
r.rotation[1],
|
|
161
|
+
r.rotation[2],
|
|
162
|
+
r.rotation[3]
|
|
163
|
+
]));
|
|
164
|
+
}
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
export { c as BODY_STATE_FIELDS, u as BodyInterpolator, n as PHYSICS_STATE, s as applySnapshotDiff, l as bodyStates, r as physicsGame, o as snapshotDiff };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { type LobbyFilter, type LobbyListing, type SeatReservation } from './lobby.js';
|
|
2
|
+
import type { RoomOptions, RoomServer } from './rooms.js';
|
|
3
|
+
/** Atomic expiring string-store contract. Adapters must honor signal and exclude expired records from reads. */
|
|
4
|
+
export interface PresenceStore {
|
|
5
|
+
/** Replace a record until its Unix-millisecond expiry. */
|
|
6
|
+
set(key: string, value: string, expiresAt: number, signal?: AbortSignal): Promise<void>;
|
|
7
|
+
/** Read a live record, or undefined. */
|
|
8
|
+
get(key: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
9
|
+
/** Sorted live keys beginning with prefix. */
|
|
10
|
+
keys(prefix: string, signal?: AbortSignal): Promise<string[]>;
|
|
11
|
+
/** Atomically remove and return a live record, once across every process. */
|
|
12
|
+
take(key: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
13
|
+
/** Remove a record; missing is a no-op. */
|
|
14
|
+
delete(key: string, signal?: AbortSignal): Promise<void>;
|
|
15
|
+
/** Release adapter resources. */
|
|
16
|
+
[Symbol.dispose](): void;
|
|
17
|
+
}
|
|
18
|
+
/** A directory record; server-only, including private and full rooms for explicit routing. */
|
|
19
|
+
export interface PresenceRoom extends LobbyListing {
|
|
20
|
+
/** Whether ordinary matchmaking may pick this room. */
|
|
21
|
+
joinable: boolean;
|
|
22
|
+
/** Hidden from public discovery. */
|
|
23
|
+
privateRoom: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** One leased process and its authoritative room routes. */
|
|
26
|
+
export interface PresenceProcess {
|
|
27
|
+
/** Unique process incarnation. Never reuse an old id. */
|
|
28
|
+
processId: string;
|
|
29
|
+
/** Public connection URL. */
|
|
30
|
+
endpoint: string;
|
|
31
|
+
/** Room directory snapshot. */
|
|
32
|
+
rooms: PresenceRoom[];
|
|
33
|
+
}
|
|
34
|
+
/** Join credential routed to its room's owning process. */
|
|
35
|
+
export interface RoutedReservation extends SeatReservation {
|
|
36
|
+
/** Connect here before RoomsClient.joinById. */
|
|
37
|
+
endpoint: string;
|
|
38
|
+
/** Owning process incarnation. */
|
|
39
|
+
processId: string;
|
|
40
|
+
}
|
|
41
|
+
/** Authoritative reservation handler. */
|
|
42
|
+
export type PresenceReservationHandler = (roomId: string, options: RoomOptions, lifetime: number) => SeatReservation | Promise<SeatReservation>;
|
|
43
|
+
/** Replaceable multi-process directory and request transport. No engine or GPU dependencies. */
|
|
44
|
+
export interface RoomPresence {
|
|
45
|
+
/** Publish/renew one process lease. */
|
|
46
|
+
publish(process: PresenceProcess, leaseMs: number, signal?: AbortSignal): Promise<void>;
|
|
47
|
+
/** Withdraw one process. */
|
|
48
|
+
remove(processId: string, signal?: AbortSignal): Promise<void>;
|
|
49
|
+
/** Live process directory, detached from the store. */
|
|
50
|
+
processes(signal?: AbortSignal): Promise<PresenceProcess[]>;
|
|
51
|
+
/** Route a bounded reservation request to the owner. Never retry an uncertain request. */
|
|
52
|
+
request(processId: string, roomId: string, options: RoomOptions, lifetime: number, signal?: AbortSignal): Promise<SeatReservation>;
|
|
53
|
+
/** Serve owner requests until abort. Resolves on cancellation, rejects on adapter/handler transport failure. */
|
|
54
|
+
serve(processId: string, handler: PresenceReservationHandler, signal: AbortSignal): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/** In-process expiring atomic store, with detached string values. */
|
|
57
|
+
export declare class MemoryPresenceStore implements PresenceStore {
|
|
58
|
+
private readonly records;
|
|
59
|
+
private closed;
|
|
60
|
+
private check;
|
|
61
|
+
/** Replace a record. */
|
|
62
|
+
set(key: string, value: string, expiresAt: number, signal?: AbortSignal): Promise<void>;
|
|
63
|
+
/** Read a live record. */
|
|
64
|
+
get(key: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
65
|
+
/** List live keys. */
|
|
66
|
+
keys(prefix: string, signal?: AbortSignal): Promise<string[]>;
|
|
67
|
+
/** Atomic consume before the first await. */
|
|
68
|
+
take(key: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
69
|
+
/** Remove a record. */
|
|
70
|
+
delete(key: string, signal?: AbortSignal): Promise<void>;
|
|
71
|
+
/** Clear and close. */
|
|
72
|
+
[Symbol.dispose](): void;
|
|
73
|
+
}
|
|
74
|
+
/** Shared-store presence with leased directory records, atomic IPC claims and bounded request/reply polling. */
|
|
75
|
+
export declare class StorePresence implements RoomPresence {
|
|
76
|
+
private readonly store;
|
|
77
|
+
private readonly prefix;
|
|
78
|
+
private readonly timeout;
|
|
79
|
+
private readonly poll;
|
|
80
|
+
/** Takes ownership of store. Namespace defaults to margo-netcode, requestTimeout to 5000 ms, pollInterval to 20 ms. */
|
|
81
|
+
constructor(store: PresenceStore, options?: {
|
|
82
|
+
namespace?: string;
|
|
83
|
+
requestTimeout?: number;
|
|
84
|
+
pollInterval?: number;
|
|
85
|
+
});
|
|
86
|
+
/** Publish one complete owner snapshot with a bounded lease. */
|
|
87
|
+
publish(process: PresenceProcess, leaseMs: number, signal?: AbortSignal): Promise<void>;
|
|
88
|
+
/** Withdraw a process directory record. */
|
|
89
|
+
remove(processId: string, signal?: AbortSignal): Promise<void>;
|
|
90
|
+
/** Read detached directory records; expired processes cannot route new joins. */
|
|
91
|
+
processes(signal?: AbortSignal): Promise<PresenceProcess[]>;
|
|
92
|
+
/** Route once and await its response. @throws MargoError `failed` for a remote refusal; abort/timeout reason otherwise. */
|
|
93
|
+
request(processId: string, roomId: string, options: RoomOptions, lifetime: number, signal?: AbortSignal): Promise<SeatReservation>;
|
|
94
|
+
/** Serve atomically claimed requests. Handler refusals are replies; store failures propagate to the owner. */
|
|
95
|
+
serve(processId: string, handler: PresenceReservationHandler, signal: AbortSignal): Promise<void>;
|
|
96
|
+
/** Close the underlying adapter after every owner using it has stopped. */
|
|
97
|
+
[Symbol.dispose](): void;
|
|
98
|
+
}
|
|
99
|
+
/** Default local presence. Pass the same instance to several RoomNodes in one process. */
|
|
100
|
+
export declare class MemoryPresence extends StorePresence {
|
|
101
|
+
/** Options and defaults are the same as StorePresence. */
|
|
102
|
+
constructor(options?: {
|
|
103
|
+
namespace?: string;
|
|
104
|
+
requestTimeout?: number;
|
|
105
|
+
pollInterval?: number;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Open a shared SQLite WAL store through Node's built-in sqlite module, loaded only on this call.
|
|
110
|
+
* All participating processes must be on the same host and use the same local file, not a network share.
|
|
111
|
+
* @throws AbortError when aborted before opening; SQLite errors propagate without retries.
|
|
112
|
+
*/
|
|
113
|
+
export declare function openSqlitePresence(path: string, options?: {
|
|
114
|
+
namespace?: string;
|
|
115
|
+
requestTimeout?: number;
|
|
116
|
+
pollInterval?: number;
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}): Promise<StorePresence>;
|
|
119
|
+
/** Multi-process facade around a RoomServer. Directory reads are advisory; only its owner grants a seat. */
|
|
120
|
+
export declare class RoomNode {
|
|
121
|
+
private readonly server;
|
|
122
|
+
private readonly options;
|
|
123
|
+
/** Random process incarnation; never reuses a stale owner's lease. */
|
|
124
|
+
readonly processId: string;
|
|
125
|
+
private readonly stop;
|
|
126
|
+
private readonly presence;
|
|
127
|
+
private readonly lease;
|
|
128
|
+
private readonly heartbeat;
|
|
129
|
+
private readonly lobby;
|
|
130
|
+
private running;
|
|
131
|
+
/** endpoint is required; presence defaults to MemoryPresence, leaseMs to 10000, heartbeatMs to 1000. */
|
|
132
|
+
constructor(server: RoomServer, options: {
|
|
133
|
+
endpoint: string;
|
|
134
|
+
presence?: RoomPresence;
|
|
135
|
+
leaseMs?: number;
|
|
136
|
+
heartbeatMs?: number;
|
|
137
|
+
});
|
|
138
|
+
/** Refresh directory immediately after room creation, disposal or metadata changes when needed. */
|
|
139
|
+
sync(signal?: AbortSignal): Promise<void>;
|
|
140
|
+
/** Public joinable rooms across live processes with exact filters. */
|
|
141
|
+
list(filter?: LobbyFilter, signal?: AbortSignal): Promise<(LobbyListing & {
|
|
142
|
+
endpoint: string;
|
|
143
|
+
processId: string;
|
|
144
|
+
})[]>;
|
|
145
|
+
/** Reserve on the actual owner even when called on another server. @throws MargoError `failed` if the route is gone. */
|
|
146
|
+
reserve(roomId: string, options?: RoomOptions, lifetime?: number, signal?: AbortSignal): Promise<RoutedReservation>;
|
|
147
|
+
/** Run heartbeat and reservation service until aborted/closed. Adapter failures reject and withdraw this process. */
|
|
148
|
+
run(options?: {
|
|
149
|
+
signal?: AbortSignal;
|
|
150
|
+
}): Promise<void>;
|
|
151
|
+
private work;
|
|
152
|
+
/** Stop serving and withdraw; does not close the RoomServer or caller-owned presence adapter. */
|
|
153
|
+
close(): Promise<void>;
|
|
154
|
+
/** Await shutdown, for await using. */
|
|
155
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
156
|
+
}
|
package/dist/presence.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { r as e } from "./transport-DeQodwyv.js";
|
|
2
|
+
import { LobbyRoom as t, RoomLobby as n } from "./lobby.js";
|
|
3
|
+
//#region src/presence.ts
|
|
4
|
+
var r = () => [...crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16))].map((e) => e.toString(16).padStart(2, "0")).join(""), i = (e) => {
|
|
5
|
+
if (!Number.isInteger(e) || e < 1 || e > 2147483647) throw RangeError("Presence duration must be 1..2147483647 ms; pass an integer in range");
|
|
6
|
+
return e;
|
|
7
|
+
}, a = (e, t) => new Promise((n) => {
|
|
8
|
+
if (t.aborted) return n();
|
|
9
|
+
let r = () => {
|
|
10
|
+
clearTimeout(i), t.removeEventListener("abort", r), n();
|
|
11
|
+
}, i = setTimeout(r, e);
|
|
12
|
+
t.addEventListener("abort", r, { once: !0 });
|
|
13
|
+
}), o = class {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.records = /* @__PURE__ */ new Map(), this.closed = !1;
|
|
16
|
+
}
|
|
17
|
+
check(t) {
|
|
18
|
+
if (t?.throwIfAborted(), this.closed) throw e("disposed", "Presence store is closed; create a new store");
|
|
19
|
+
}
|
|
20
|
+
async set(e, t, n, r) {
|
|
21
|
+
this.check(r);
|
|
22
|
+
for (let [e, t] of this.records) t.expiresAt <= Date.now() && this.records.delete(e);
|
|
23
|
+
this.records.set(e, {
|
|
24
|
+
value: t,
|
|
25
|
+
expiresAt: n
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async get(e, t) {
|
|
29
|
+
this.check(t);
|
|
30
|
+
let n = this.records.get(e);
|
|
31
|
+
if (n && n.expiresAt > Date.now()) return n.value;
|
|
32
|
+
this.records.delete(e);
|
|
33
|
+
}
|
|
34
|
+
async keys(e, t) {
|
|
35
|
+
return this.check(t), [...this.records].filter(([t, n]) => t.startsWith(e) && n.expiresAt > Date.now()).map(([e]) => e).sort();
|
|
36
|
+
}
|
|
37
|
+
async take(e, t) {
|
|
38
|
+
this.check(t);
|
|
39
|
+
let n = this.records.get(e);
|
|
40
|
+
return this.records.delete(e), n && n.expiresAt > Date.now() ? n.value : void 0;
|
|
41
|
+
}
|
|
42
|
+
async delete(e, t) {
|
|
43
|
+
this.check(t), this.records.delete(e);
|
|
44
|
+
}
|
|
45
|
+
[Symbol.dispose]() {
|
|
46
|
+
this.closed = !0, this.records.clear();
|
|
47
|
+
}
|
|
48
|
+
}, s = class {
|
|
49
|
+
constructor(e, t = {}) {
|
|
50
|
+
this.store = e, this.prefix = `${t.namespace ?? "margo-netcode"}/`, this.timeout = i(t.requestTimeout ?? 5e3), this.poll = i(t.pollInterval ?? 20);
|
|
51
|
+
}
|
|
52
|
+
publish(e, t, n) {
|
|
53
|
+
return this.store.set(`${this.prefix}process/${e.processId}`, JSON.stringify(e), Date.now() + i(t), n);
|
|
54
|
+
}
|
|
55
|
+
remove(e, t) {
|
|
56
|
+
return this.store.delete(`${this.prefix}process/${e}`, t);
|
|
57
|
+
}
|
|
58
|
+
async processes(e) {
|
|
59
|
+
let t = [];
|
|
60
|
+
for (let n of await this.store.keys(`${this.prefix}process/`, e)) {
|
|
61
|
+
let r = await this.store.get(n, e);
|
|
62
|
+
r !== void 0 && t.push(JSON.parse(r));
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
async request(t, n, o, s, c) {
|
|
67
|
+
c?.throwIfAborted();
|
|
68
|
+
let l = AbortSignal.any([AbortSignal.timeout(this.timeout), ...c ? [c] : []]), u = r(), d = `${this.prefix}request/${t}/${u}`, f = `${this.prefix}reply/${u}`, p = Date.now() + this.timeout;
|
|
69
|
+
try {
|
|
70
|
+
for (await this.store.set(d, JSON.stringify({
|
|
71
|
+
roomId: n,
|
|
72
|
+
options: o,
|
|
73
|
+
lifetime: i(s),
|
|
74
|
+
reply: f,
|
|
75
|
+
expiresAt: p
|
|
76
|
+
}), p, l); !l.aborted;) {
|
|
77
|
+
let t = await this.store.take(f, l);
|
|
78
|
+
if (t !== void 0) {
|
|
79
|
+
let n = JSON.parse(t);
|
|
80
|
+
if (!n.result) throw e("failed", `Remote room refused reservation: ${n.error}; choose another room`);
|
|
81
|
+
return n.result;
|
|
82
|
+
}
|
|
83
|
+
await a(this.poll, l);
|
|
84
|
+
}
|
|
85
|
+
throw l.throwIfAborted(), e("failed", "Presence request ended without a response; choose another room");
|
|
86
|
+
} finally {
|
|
87
|
+
await this.store.delete(d), await this.store.delete(f);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async serve(e, t, n) {
|
|
91
|
+
for (; !n.aborted;) {
|
|
92
|
+
for (let r of await this.store.keys(`${this.prefix}request/${e}/`, n)) {
|
|
93
|
+
if (n.aborted) return;
|
|
94
|
+
let e = await this.store.take(r, n);
|
|
95
|
+
if (e === void 0) continue;
|
|
96
|
+
let i = JSON.parse(e);
|
|
97
|
+
if (i.expiresAt <= Date.now()) continue;
|
|
98
|
+
let a;
|
|
99
|
+
try {
|
|
100
|
+
a = { result: await t(i.roomId, i.options, i.lifetime) };
|
|
101
|
+
} catch (e) {
|
|
102
|
+
a = { error: String(e) };
|
|
103
|
+
}
|
|
104
|
+
await this.store.set(i.reply, JSON.stringify(a), i.expiresAt, n);
|
|
105
|
+
}
|
|
106
|
+
await a(this.poll, n);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
[Symbol.dispose]() {
|
|
110
|
+
this.store[Symbol.dispose]();
|
|
111
|
+
}
|
|
112
|
+
}, c = class extends s {
|
|
113
|
+
constructor(e = {}) {
|
|
114
|
+
super(new o(), e);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
async function l(e, t = {}) {
|
|
118
|
+
t.signal?.throwIfAborted();
|
|
119
|
+
let { DatabaseSync: n } = await import("node:sqlite");
|
|
120
|
+
t.signal?.throwIfAborted();
|
|
121
|
+
let r = new n(e, { timeout: 5e3 });
|
|
122
|
+
try {
|
|
123
|
+
r.exec("PRAGMA journal_mode=WAL; CREATE TABLE IF NOT EXISTS margo_presence (key TEXT PRIMARY KEY, value TEXT NOT NULL, expires REAL NOT NULL)");
|
|
124
|
+
let e = r.prepare("INSERT INTO margo_presence VALUES (?, ?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value, expires=excluded.expires"), n = r.prepare("SELECT value FROM margo_presence WHERE key=? AND expires>?"), i = r.prepare("SELECT key FROM margo_presence WHERE substr(key,1,?)=? AND expires>? ORDER BY key"), a = r.prepare("DELETE FROM margo_presence WHERE key=? AND expires>? RETURNING value"), o = r.prepare("DELETE FROM margo_presence WHERE key=?"), c = r.prepare("DELETE FROM margo_presence WHERE expires<=?");
|
|
125
|
+
return new s({
|
|
126
|
+
async set(t, n, r, i) {
|
|
127
|
+
i?.throwIfAborted(), c.run(Date.now()), e.run(t, n, r);
|
|
128
|
+
},
|
|
129
|
+
async get(e, t) {
|
|
130
|
+
return t?.throwIfAborted(), n.get(e, Date.now())?.value;
|
|
131
|
+
},
|
|
132
|
+
async keys(e, t) {
|
|
133
|
+
return t?.throwIfAborted(), i.all([...e].length, e, Date.now()).map((e) => e.key);
|
|
134
|
+
},
|
|
135
|
+
async take(e, t) {
|
|
136
|
+
return t?.throwIfAborted(), a.get(e, Date.now())?.value;
|
|
137
|
+
},
|
|
138
|
+
async delete(e, t) {
|
|
139
|
+
t?.throwIfAborted(), o.run(e);
|
|
140
|
+
},
|
|
141
|
+
[Symbol.dispose]() {
|
|
142
|
+
r.close();
|
|
143
|
+
}
|
|
144
|
+
}, t);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
throw r.close(), e;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
var u = class {
|
|
150
|
+
constructor(e, t) {
|
|
151
|
+
this.server = e, this.options = t, this.processId = r(), this.stop = new AbortController();
|
|
152
|
+
let a = new URL(t.endpoint);
|
|
153
|
+
if (![
|
|
154
|
+
"ws:",
|
|
155
|
+
"wss:",
|
|
156
|
+
"http:",
|
|
157
|
+
"https:"
|
|
158
|
+
].includes(a.protocol)) throw TypeError("Room endpoint must be ws/wss/http/https; pass the public connection URL");
|
|
159
|
+
if (this.presence = t.presence ?? new c(), this.lease = i(t.leaseMs ?? 1e4), this.heartbeat = i(t.heartbeatMs ?? 1e3), this.heartbeat >= this.lease) throw RangeError("Presence heartbeat must be shorter than its lease; reduce heartbeatMs");
|
|
160
|
+
this.lobby = new n(e);
|
|
161
|
+
}
|
|
162
|
+
async sync(e) {
|
|
163
|
+
this.stop.signal.throwIfAborted();
|
|
164
|
+
let n = this.server.rooms.map((e) => ({
|
|
165
|
+
roomId: e.roomId,
|
|
166
|
+
name: e.roomName,
|
|
167
|
+
metadata: e instanceof t ? e.metadata : {},
|
|
168
|
+
clients: e.clients.length,
|
|
169
|
+
reserved: e.dropped.length + (e instanceof t ? e.reservedSeats : 0),
|
|
170
|
+
maxClients: e.maxClients,
|
|
171
|
+
joinable: !e.locked,
|
|
172
|
+
privateRoom: e instanceof t && e.privateRoom
|
|
173
|
+
}));
|
|
174
|
+
await this.presence.publish({
|
|
175
|
+
processId: this.processId,
|
|
176
|
+
endpoint: this.options.endpoint,
|
|
177
|
+
rooms: n
|
|
178
|
+
}, this.lease, e);
|
|
179
|
+
}
|
|
180
|
+
async list(e = {}, t) {
|
|
181
|
+
let n = [];
|
|
182
|
+
for (let r of await this.presence.processes(t)) for (let t of r.rooms) if (t.joinable && !t.privateRoom && (!e.name || t.name === e.name) && Object.entries(e.metadata ?? {}).every(([e, n]) => Object.hasOwn(t.metadata, e) && t.metadata[e] === n)) {
|
|
183
|
+
let { joinable: e, privateRoom: i, ...a } = t;
|
|
184
|
+
n.push({
|
|
185
|
+
...a,
|
|
186
|
+
endpoint: r.endpoint,
|
|
187
|
+
processId: r.processId
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return n.sort((e, t) => e.roomId < t.roomId ? -1 : +(e.roomId > t.roomId));
|
|
191
|
+
}
|
|
192
|
+
async reserve(t, n = {}, r = 15e3, i) {
|
|
193
|
+
let a = (await this.presence.processes(i)).find((e) => e.rooms.some((e) => e.roomId === t));
|
|
194
|
+
if (!a) throw e("failed", "Room process is no longer present; refresh the room list");
|
|
195
|
+
return {
|
|
196
|
+
...await this.presence.request(a.processId, t, n, r, i),
|
|
197
|
+
endpoint: a.endpoint,
|
|
198
|
+
processId: a.processId
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
run(t = {}) {
|
|
202
|
+
if (this.running) throw e("failed", "RoomNode is already running; await its existing run promise");
|
|
203
|
+
let n = AbortSignal.any([this.stop.signal, ...t.signal ? [t.signal] : []]);
|
|
204
|
+
return this.running = this.work(n), this.running;
|
|
205
|
+
}
|
|
206
|
+
async work(e) {
|
|
207
|
+
let t = new AbortController(), n = AbortSignal.any([e, t.signal]), r = [(async () => {
|
|
208
|
+
for (; !n.aborted;) await this.sync(n), await a(this.heartbeat, n);
|
|
209
|
+
})(), this.presence.serve(this.processId, (e, t, n) => this.lobby.reserve(e, t, n), n)];
|
|
210
|
+
try {
|
|
211
|
+
await Promise.all(r);
|
|
212
|
+
} catch (n) {
|
|
213
|
+
if (t.abort(n), !e.aborted) throw n;
|
|
214
|
+
} finally {
|
|
215
|
+
t.abort(), await Promise.allSettled(r), await this.presence.remove(this.processId);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async close() {
|
|
219
|
+
this.stop.abort(), this.running ? await this.running : await this.presence.remove(this.processId);
|
|
220
|
+
}
|
|
221
|
+
async [Symbol.asyncDispose]() {
|
|
222
|
+
await this.close();
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
//#endregion
|
|
226
|
+
export { c as MemoryPresence, o as MemoryPresenceStore, u as RoomNode, s as StorePresence, l as openSqlitePresence };
|