@pluv/io 0.24.1 → 0.25.1
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +49 -0
- package/README.md +2 -2
- package/dist/index.d.mts +37 -15
- package/dist/index.d.ts +37 -15
- package/dist/index.js +61 -43
- package/dist/index.mjs +60 -42
- package/package.json +5 -5
- package/src/{AbstractPersistance.ts → AbstractPersistence.ts} +1 -1
- package/src/AbstractPlatform.ts +10 -6
- package/src/AbstractWebSocket.ts +6 -6
- package/src/IORoom.ts +28 -20
- package/src/{Persistance.ts → Persistence.ts} +2 -2
- package/src/PluvIO.ts +1 -1
- package/src/PluvRouter.ts +5 -5
- package/src/PluvServer.ts +18 -12
- package/src/index.ts +1 -1
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.
|
|
2
|
+
> @pluv/io@0.25.1 build /home/runner/work/pluv/pluv/packages/io
|
|
3
3
|
> pnpm run version && tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @pluv/io@0.
|
|
6
|
+
> @pluv/io@0.25.1 version /home/runner/work/pluv/pluv/packages/io
|
|
7
7
|
> genversion ./src/version.generated.ts --esm
|
|
8
8
|
|
|
9
9
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
[34mCLI[39m Target: es6
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
[34mCJS[39m Build start
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
-
[32mCJS[39m [1mdist/index.js [22m[32m41.
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m39.43 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 121ms
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m41.57 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 121ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m25.
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m25.
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2430ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m25.78 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m25.78 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 0.25.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3925f7c: Update internal accessor.
|
|
8
|
+
- @pluv/crdt@0.25.1
|
|
9
|
+
- @pluv/types@0.25.1
|
|
10
|
+
|
|
11
|
+
## 0.25.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 9db06ba: **BREAKING **
|
|
16
|
+
|
|
17
|
+
Fixed typos `persistance` to `persistence`.
|
|
18
|
+
|
|
19
|
+
This does mean that all properties referencing `persistance` will need to be fixed. Examples below:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Re-install @pluv/persistence-redis
|
|
23
|
+
pnpm uninstall @pluv/persistance-redis
|
|
24
|
+
pnpm install @pluv/persistence-redis
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// Before
|
|
29
|
+
createIO({
|
|
30
|
+
platform: platformNode({
|
|
31
|
+
persistance: new PersistanceRedis(/* ... */),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// After
|
|
36
|
+
createIO({
|
|
37
|
+
platform: platformNode({
|
|
38
|
+
persistence: new PersistenceRedis(/* ... */),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`@pluv/persistance-redis` has been deprecated for `@pluv/persistence-redis`.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 4e078ca: Fix IORoom onRoomMessage event triggering on message sent instead of on message received.
|
|
48
|
+
- f556d30: Refactored PluvServer and IORoom properties to consolidate internal properties.
|
|
49
|
+
- @pluv/crdt@0.25.0
|
|
50
|
+
- @pluv/types@0.25.0
|
|
51
|
+
|
|
3
52
|
## 0.24.1
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ pluv.io allows you to more easily build real-time collaborative experiences with
|
|
|
71
71
|
- ✅ [Redis](https://redis.io/)
|
|
72
72
|
- ⬜ [RabbitMQ](https://www.rabbitmq.com/)
|
|
73
73
|
- ⬜ [Kafka](https://kafka.apache.org/)
|
|
74
|
-
- ✅ **CRDT State
|
|
74
|
+
- ✅ **CRDT State Persistence**
|
|
75
75
|
- ✅ [Redis](https://redis.io/)
|
|
76
76
|
- ⬜ [Prisma](https://www.prisma.io/)
|
|
77
77
|
|
|
@@ -95,7 +95,7 @@ Documentation is available at [pluv.io](https://pluv.io/docs/introduction).
|
|
|
95
95
|
- [@pluv/client](https://www.npmjs.com/package/@pluv/client) - Framework agnostic client
|
|
96
96
|
- [@pluv/crdt-loro](https://www.npmjs.com/package/@pluv/crdt-loro) - Loro CRDT for Pluv.IO
|
|
97
97
|
- [@pluv/crdt-yjs](https://www.npmjs.com/package/@pluv/crdt-yjs) - Yjs CRDT for Pluv.IO
|
|
98
|
-
- [@pluv/
|
|
98
|
+
- [@pluv/persistence-redis](https://www.npmjs.com/package/@pluv/persistence-redis) - Persistence for storage on distributed systems (Node.js only)
|
|
99
99
|
- [@pluv/platform-cloudflare](https://www.npmjs.com/package/@pluv/platform-cloudflare) - Adapter to run @pluv/io on Cloudflare Workers
|
|
100
100
|
- [@pluv/platform-node](https://www.npmjs.com/package/@pluv/platform-node) - Adapter to run @pluv/io on Node.js
|
|
101
101
|
- [@pluv/pubsub-redis](https://www.npmjs.com/package/@pluv/pubsub-redis) - PubSub for rooms across distributed systems
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { JsonObject, MaybePromise, IOAuthorize, IOEventMessage, EventRecord, Inp
|
|
|
2
2
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
3
3
|
import { AbstractCrdtDoc, AbstractCrdtDocFactory } from '@pluv/crdt';
|
|
4
4
|
|
|
5
|
-
declare abstract class
|
|
5
|
+
declare abstract class AbstractPersistence {
|
|
6
6
|
abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
|
|
7
7
|
abstract deleteStorageState(room: string): Promise<void>;
|
|
8
8
|
abstract deleteUser(room: string, connectionId: string): Promise<void>;
|
|
@@ -41,7 +41,7 @@ interface AbstractWebSocketHandleErrorParams {
|
|
|
41
41
|
type AbstractListener<TType extends keyof AbstractEventMap> = (event: AbstractEventMap[TType]) => MaybePromise<void>;
|
|
42
42
|
type InferWebSocketSource<TAbstractWebSocket extends AbstractWebSocket> = TAbstractWebSocket extends AbstractWebSocket<infer IWebSocket> ? IWebSocket : never;
|
|
43
43
|
interface AbstractWebSocketConfig {
|
|
44
|
-
|
|
44
|
+
persistence: AbstractPersistence;
|
|
45
45
|
room: string;
|
|
46
46
|
}
|
|
47
47
|
declare abstract class AbstractWebSocket<TWebSocket = any> {
|
|
@@ -53,7 +53,7 @@ declare abstract class AbstractWebSocket<TWebSocket = any> {
|
|
|
53
53
|
readonly CLOSING = 2;
|
|
54
54
|
/** The connection is closed. */
|
|
55
55
|
readonly CLOSED = 3;
|
|
56
|
-
readonly
|
|
56
|
+
readonly persistence: AbstractPersistence;
|
|
57
57
|
readonly room: string;
|
|
58
58
|
readonly webSocket: TWebSocket;
|
|
59
59
|
private _user;
|
|
@@ -111,12 +111,14 @@ declare class PluvProcedure<TPlatform extends AbstractPlatform<any>, TAuthorize
|
|
|
111
111
|
type PluvRouterEventConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}> = {
|
|
112
112
|
[P: string]: Pick<PluvProcedure<TPlatform, TAuthorize, TContext, any, any>, "config">;
|
|
113
113
|
};
|
|
114
|
-
type MergedRouter<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[] = [], TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TRoot extends TRouters[0]["
|
|
114
|
+
type MergedRouter<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[] = [], TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TRoot extends TRouters[0]["_defs"]["events"] = {}> = TRouters extends [
|
|
115
115
|
infer IHead extends PluvRouter<TPlatform, TAuthorize, TContext, any>,
|
|
116
116
|
...infer ITail extends PluvRouter<TPlatform, TAuthorize, TContext, any>[]
|
|
117
|
-
] ? MergedRouter<ITail, TPlatform, TAuthorize, TContext, TRoot & IHead["
|
|
117
|
+
] ? MergedRouter<ITail, TPlatform, TAuthorize, TContext, TRoot & IHead["_defs"]["events"]> : PluvRouter<TPlatform, TAuthorize, TContext, TRoot>;
|
|
118
118
|
declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IORouterLike<TEvents> {
|
|
119
|
-
readonly
|
|
119
|
+
readonly _defs: {
|
|
120
|
+
events: TEvents;
|
|
121
|
+
};
|
|
120
122
|
constructor(events: TEvents);
|
|
121
123
|
static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
122
124
|
}
|
|
@@ -210,7 +212,7 @@ type InferPlatformContextType<TPlatform extends AbstractPlatform> = TPlatform ex
|
|
|
210
212
|
type InferRoomContextType<TPlatform extends AbstractPlatform> = TPlatform extends AbstractPlatform<any, infer IPlatformContext, infer IRoomContext> ? IPlatformContext & IRoomContext : never;
|
|
211
213
|
type AbstractPlatformConfig<TPlatformContext extends Record<string, any> = {}, TRoomContext extends Record<string, any> = {}> = {
|
|
212
214
|
context?: TPlatformContext & TRoomContext;
|
|
213
|
-
|
|
215
|
+
persistence?: AbstractPersistence;
|
|
214
216
|
pubSub?: AbstractPubSub;
|
|
215
217
|
};
|
|
216
218
|
interface ConvertWebSocketConfig {
|
|
@@ -220,10 +222,11 @@ declare abstract class AbstractPlatform<TWebSocket extends AbstractWebSocket = A
|
|
|
220
222
|
protected readonly _ioContext: TPlatformContext | undefined;
|
|
221
223
|
protected readonly _roomContext: TRoomContext | undefined;
|
|
222
224
|
private _initialized;
|
|
223
|
-
|
|
225
|
+
persistence: AbstractPersistence;
|
|
224
226
|
pubSub: AbstractPubSub;
|
|
225
227
|
abstract readonly _registrationMode: WebSocketRegistrationMode;
|
|
226
228
|
constructor(config?: AbstractPlatformConfig<TPlatformContext, TRoomContext>);
|
|
229
|
+
get _meta(): any;
|
|
227
230
|
abstract acceptWebSocket(webSocket: AbstractWebSocket): Promise<void>;
|
|
228
231
|
abstract convertWebSocket(webSocket: InferWebSocketSource<TWebSocket>, config: ConvertWebSocketConfig): AbstractWebSocket;
|
|
229
232
|
abstract getLastPing(webSocket: AbstractWebSocket): number | null;
|
|
@@ -278,9 +281,9 @@ interface WebsocketRegisterOptions {
|
|
|
278
281
|
}
|
|
279
282
|
declare class IORoom<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends Record<string, any> = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IOLike<TAuthorize, TEvents> {
|
|
280
283
|
readonly id: string;
|
|
281
|
-
readonly _authorize: TAuthorize | null;
|
|
282
284
|
private _doc;
|
|
283
285
|
private _uninitialize;
|
|
286
|
+
private readonly _authorize;
|
|
284
287
|
private readonly _context;
|
|
285
288
|
private readonly _debug;
|
|
286
289
|
private readonly _docFactory;
|
|
@@ -288,7 +291,17 @@ declare class IORoom<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
|
|
|
288
291
|
private readonly _platform;
|
|
289
292
|
private readonly _router;
|
|
290
293
|
private readonly _sessions;
|
|
291
|
-
|
|
294
|
+
/**
|
|
295
|
+
* @ignore
|
|
296
|
+
* @readonly
|
|
297
|
+
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
298
|
+
*/
|
|
299
|
+
get _defs(): {
|
|
300
|
+
authorize: TAuthorize | null;
|
|
301
|
+
context: TContext & InferRoomContextType<TPlatform>;
|
|
302
|
+
events: TEvents;
|
|
303
|
+
platform: TPlatform;
|
|
304
|
+
};
|
|
292
305
|
get broadcast(): BroadcastProxy<this>;
|
|
293
306
|
private get _initialized();
|
|
294
307
|
constructor(id: string, config: IORoomConfig<TPlatform, TAuthorize, TContext, TEvents>);
|
|
@@ -339,7 +352,7 @@ type CreateRoomOptions<TPlatform extends AbstractPlatform<any>, TAuthorize exten
|
|
|
339
352
|
declare class PluvServer<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferPlatformContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IORouterLike<TEvents> {
|
|
340
353
|
_listeners: PluvIOListeners<TPlatform, TAuthorize, TContext, TEvents>;
|
|
341
354
|
readonly version: string;
|
|
342
|
-
readonly _authorize
|
|
355
|
+
private readonly _authorize;
|
|
343
356
|
private readonly _baseRouter;
|
|
344
357
|
private readonly _context;
|
|
345
358
|
private readonly _crdt;
|
|
@@ -347,8 +360,17 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any> = AbstractPlatf
|
|
|
347
360
|
private readonly _getInitialStorage;
|
|
348
361
|
private readonly _platform;
|
|
349
362
|
private readonly _router;
|
|
350
|
-
|
|
351
|
-
|
|
363
|
+
/**
|
|
364
|
+
* @ignore
|
|
365
|
+
* @readonly
|
|
366
|
+
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
367
|
+
*/
|
|
368
|
+
get _defs(): {
|
|
369
|
+
authorize: TAuthorize | null;
|
|
370
|
+
context: TContext;
|
|
371
|
+
events: TEvents;
|
|
372
|
+
platform: TPlatform;
|
|
373
|
+
};
|
|
352
374
|
private get _procedure();
|
|
353
375
|
constructor(options: PluvServerConfig<TPlatform, TAuthorize, TContext, TEvents>);
|
|
354
376
|
createRoom(room: string, ...options: CreateRoomOptions<TPlatform, TAuthorize, TContext, TEvents>): IORoom<TPlatform, TAuthorize, TContext, TEvents>;
|
|
@@ -371,7 +393,7 @@ type ServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any
|
|
|
371
393
|
};
|
|
372
394
|
declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferPlatformContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}> {
|
|
373
395
|
readonly version: string;
|
|
374
|
-
readonly _authorize
|
|
396
|
+
private readonly _authorize;
|
|
375
397
|
private readonly _context;
|
|
376
398
|
private readonly _crdt;
|
|
377
399
|
private readonly _debug;
|
|
@@ -395,4 +417,4 @@ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<a
|
|
|
395
417
|
};
|
|
396
418
|
declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false>(params: CreateIOParams<TPlatform, TContext, TAuthorizeUser, TAuthorizeRequired>) => PluvIO<TPlatform, IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>, TContext>;
|
|
397
419
|
|
|
398
|
-
export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent,
|
|
420
|
+
export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CreateIOParams, type CreateRoomOptions, type IOPubSubEventMessage, IORoom, type InferIORoom, type InferPlatformContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, PluvIO, type PluvIOConfig, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, createIO };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { JsonObject, MaybePromise, IOAuthorize, IOEventMessage, EventRecord, Inp
|
|
|
2
2
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
3
3
|
import { AbstractCrdtDoc, AbstractCrdtDocFactory } from '@pluv/crdt';
|
|
4
4
|
|
|
5
|
-
declare abstract class
|
|
5
|
+
declare abstract class AbstractPersistence {
|
|
6
6
|
abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
|
|
7
7
|
abstract deleteStorageState(room: string): Promise<void>;
|
|
8
8
|
abstract deleteUser(room: string, connectionId: string): Promise<void>;
|
|
@@ -41,7 +41,7 @@ interface AbstractWebSocketHandleErrorParams {
|
|
|
41
41
|
type AbstractListener<TType extends keyof AbstractEventMap> = (event: AbstractEventMap[TType]) => MaybePromise<void>;
|
|
42
42
|
type InferWebSocketSource<TAbstractWebSocket extends AbstractWebSocket> = TAbstractWebSocket extends AbstractWebSocket<infer IWebSocket> ? IWebSocket : never;
|
|
43
43
|
interface AbstractWebSocketConfig {
|
|
44
|
-
|
|
44
|
+
persistence: AbstractPersistence;
|
|
45
45
|
room: string;
|
|
46
46
|
}
|
|
47
47
|
declare abstract class AbstractWebSocket<TWebSocket = any> {
|
|
@@ -53,7 +53,7 @@ declare abstract class AbstractWebSocket<TWebSocket = any> {
|
|
|
53
53
|
readonly CLOSING = 2;
|
|
54
54
|
/** The connection is closed. */
|
|
55
55
|
readonly CLOSED = 3;
|
|
56
|
-
readonly
|
|
56
|
+
readonly persistence: AbstractPersistence;
|
|
57
57
|
readonly room: string;
|
|
58
58
|
readonly webSocket: TWebSocket;
|
|
59
59
|
private _user;
|
|
@@ -111,12 +111,14 @@ declare class PluvProcedure<TPlatform extends AbstractPlatform<any>, TAuthorize
|
|
|
111
111
|
type PluvRouterEventConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}> = {
|
|
112
112
|
[P: string]: Pick<PluvProcedure<TPlatform, TAuthorize, TContext, any, any>, "config">;
|
|
113
113
|
};
|
|
114
|
-
type MergedRouter<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[] = [], TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TRoot extends TRouters[0]["
|
|
114
|
+
type MergedRouter<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[] = [], TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TRoot extends TRouters[0]["_defs"]["events"] = {}> = TRouters extends [
|
|
115
115
|
infer IHead extends PluvRouter<TPlatform, TAuthorize, TContext, any>,
|
|
116
116
|
...infer ITail extends PluvRouter<TPlatform, TAuthorize, TContext, any>[]
|
|
117
|
-
] ? MergedRouter<ITail, TPlatform, TAuthorize, TContext, TRoot & IHead["
|
|
117
|
+
] ? MergedRouter<ITail, TPlatform, TAuthorize, TContext, TRoot & IHead["_defs"]["events"]> : PluvRouter<TPlatform, TAuthorize, TContext, TRoot>;
|
|
118
118
|
declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IORouterLike<TEvents> {
|
|
119
|
-
readonly
|
|
119
|
+
readonly _defs: {
|
|
120
|
+
events: TEvents;
|
|
121
|
+
};
|
|
120
122
|
constructor(events: TEvents);
|
|
121
123
|
static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
122
124
|
}
|
|
@@ -210,7 +212,7 @@ type InferPlatformContextType<TPlatform extends AbstractPlatform> = TPlatform ex
|
|
|
210
212
|
type InferRoomContextType<TPlatform extends AbstractPlatform> = TPlatform extends AbstractPlatform<any, infer IPlatformContext, infer IRoomContext> ? IPlatformContext & IRoomContext : never;
|
|
211
213
|
type AbstractPlatformConfig<TPlatformContext extends Record<string, any> = {}, TRoomContext extends Record<string, any> = {}> = {
|
|
212
214
|
context?: TPlatformContext & TRoomContext;
|
|
213
|
-
|
|
215
|
+
persistence?: AbstractPersistence;
|
|
214
216
|
pubSub?: AbstractPubSub;
|
|
215
217
|
};
|
|
216
218
|
interface ConvertWebSocketConfig {
|
|
@@ -220,10 +222,11 @@ declare abstract class AbstractPlatform<TWebSocket extends AbstractWebSocket = A
|
|
|
220
222
|
protected readonly _ioContext: TPlatformContext | undefined;
|
|
221
223
|
protected readonly _roomContext: TRoomContext | undefined;
|
|
222
224
|
private _initialized;
|
|
223
|
-
|
|
225
|
+
persistence: AbstractPersistence;
|
|
224
226
|
pubSub: AbstractPubSub;
|
|
225
227
|
abstract readonly _registrationMode: WebSocketRegistrationMode;
|
|
226
228
|
constructor(config?: AbstractPlatformConfig<TPlatformContext, TRoomContext>);
|
|
229
|
+
get _meta(): any;
|
|
227
230
|
abstract acceptWebSocket(webSocket: AbstractWebSocket): Promise<void>;
|
|
228
231
|
abstract convertWebSocket(webSocket: InferWebSocketSource<TWebSocket>, config: ConvertWebSocketConfig): AbstractWebSocket;
|
|
229
232
|
abstract getLastPing(webSocket: AbstractWebSocket): number | null;
|
|
@@ -278,9 +281,9 @@ interface WebsocketRegisterOptions {
|
|
|
278
281
|
}
|
|
279
282
|
declare class IORoom<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends Record<string, any> = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IOLike<TAuthorize, TEvents> {
|
|
280
283
|
readonly id: string;
|
|
281
|
-
readonly _authorize: TAuthorize | null;
|
|
282
284
|
private _doc;
|
|
283
285
|
private _uninitialize;
|
|
286
|
+
private readonly _authorize;
|
|
284
287
|
private readonly _context;
|
|
285
288
|
private readonly _debug;
|
|
286
289
|
private readonly _docFactory;
|
|
@@ -288,7 +291,17 @@ declare class IORoom<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
|
|
|
288
291
|
private readonly _platform;
|
|
289
292
|
private readonly _router;
|
|
290
293
|
private readonly _sessions;
|
|
291
|
-
|
|
294
|
+
/**
|
|
295
|
+
* @ignore
|
|
296
|
+
* @readonly
|
|
297
|
+
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
298
|
+
*/
|
|
299
|
+
get _defs(): {
|
|
300
|
+
authorize: TAuthorize | null;
|
|
301
|
+
context: TContext & InferRoomContextType<TPlatform>;
|
|
302
|
+
events: TEvents;
|
|
303
|
+
platform: TPlatform;
|
|
304
|
+
};
|
|
292
305
|
get broadcast(): BroadcastProxy<this>;
|
|
293
306
|
private get _initialized();
|
|
294
307
|
constructor(id: string, config: IORoomConfig<TPlatform, TAuthorize, TContext, TEvents>);
|
|
@@ -339,7 +352,7 @@ type CreateRoomOptions<TPlatform extends AbstractPlatform<any>, TAuthorize exten
|
|
|
339
352
|
declare class PluvServer<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferPlatformContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> implements IORouterLike<TEvents> {
|
|
340
353
|
_listeners: PluvIOListeners<TPlatform, TAuthorize, TContext, TEvents>;
|
|
341
354
|
readonly version: string;
|
|
342
|
-
readonly _authorize
|
|
355
|
+
private readonly _authorize;
|
|
343
356
|
private readonly _baseRouter;
|
|
344
357
|
private readonly _context;
|
|
345
358
|
private readonly _crdt;
|
|
@@ -347,8 +360,17 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any> = AbstractPlatf
|
|
|
347
360
|
private readonly _getInitialStorage;
|
|
348
361
|
private readonly _platform;
|
|
349
362
|
private readonly _router;
|
|
350
|
-
|
|
351
|
-
|
|
363
|
+
/**
|
|
364
|
+
* @ignore
|
|
365
|
+
* @readonly
|
|
366
|
+
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
367
|
+
*/
|
|
368
|
+
get _defs(): {
|
|
369
|
+
authorize: TAuthorize | null;
|
|
370
|
+
context: TContext;
|
|
371
|
+
events: TEvents;
|
|
372
|
+
platform: TPlatform;
|
|
373
|
+
};
|
|
352
374
|
private get _procedure();
|
|
353
375
|
constructor(options: PluvServerConfig<TPlatform, TAuthorize, TContext, TEvents>);
|
|
354
376
|
createRoom(room: string, ...options: CreateRoomOptions<TPlatform, TAuthorize, TContext, TEvents>): IORoom<TPlatform, TAuthorize, TContext, TEvents>;
|
|
@@ -371,7 +393,7 @@ type ServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any
|
|
|
371
393
|
};
|
|
372
394
|
declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferPlatformContextType<TPlatform>> = BaseIOAuthorize, TContext extends JsonObject = {}> {
|
|
373
395
|
readonly version: string;
|
|
374
|
-
readonly _authorize
|
|
396
|
+
private readonly _authorize;
|
|
375
397
|
private readonly _context;
|
|
376
398
|
private readonly _crdt;
|
|
377
399
|
private readonly _debug;
|
|
@@ -395,4 +417,4 @@ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<a
|
|
|
395
417
|
};
|
|
396
418
|
declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false>(params: CreateIOParams<TPlatform, TContext, TAuthorizeUser, TAuthorizeRequired>) => PluvIO<TPlatform, IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>, TContext>;
|
|
397
419
|
|
|
398
|
-
export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent,
|
|
420
|
+
export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CreateIOParams, type CreateRoomOptions, type IOPubSubEventMessage, IORoom, type InferIORoom, type InferPlatformContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, PluvIO, type PluvIOConfig, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, createIO };
|
package/dist/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
79
79
|
// src/index.ts
|
|
80
80
|
var src_exports = {};
|
|
81
81
|
__export(src_exports, {
|
|
82
|
-
|
|
82
|
+
AbstractPersistence: () => AbstractPersistence,
|
|
83
83
|
AbstractPlatform: () => AbstractPlatform,
|
|
84
84
|
AbstractPubSub: () => AbstractPubSub,
|
|
85
85
|
AbstractWebSocket: () => AbstractWebSocket,
|
|
@@ -91,12 +91,12 @@ __export(src_exports, {
|
|
|
91
91
|
});
|
|
92
92
|
module.exports = __toCommonJS(src_exports);
|
|
93
93
|
|
|
94
|
-
// src/
|
|
95
|
-
var
|
|
94
|
+
// src/AbstractPersistence.ts
|
|
95
|
+
var AbstractPersistence = class {
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
// src/
|
|
99
|
-
var
|
|
98
|
+
// src/Persistence.ts
|
|
99
|
+
var Persistence = class extends AbstractPersistence {
|
|
100
100
|
constructor() {
|
|
101
101
|
super(...arguments);
|
|
102
102
|
this._storages = /* @__PURE__ */ new Map();
|
|
@@ -217,12 +217,15 @@ var PubSub = class extends AbstractPubSub {
|
|
|
217
217
|
var AbstractPlatform = class {
|
|
218
218
|
constructor(config = {}) {
|
|
219
219
|
this._initialized = false;
|
|
220
|
-
const { context,
|
|
220
|
+
const { context, persistence, pubSub } = config;
|
|
221
221
|
context && (this._ioContext = context);
|
|
222
222
|
context && (this._roomContext = context);
|
|
223
|
-
this.
|
|
223
|
+
this.persistence = persistence != null ? persistence : new Persistence();
|
|
224
224
|
this.pubSub = pubSub != null ? pubSub : new PubSub();
|
|
225
225
|
}
|
|
226
|
+
get _meta() {
|
|
227
|
+
return void 0;
|
|
228
|
+
}
|
|
226
229
|
_initialize() {
|
|
227
230
|
if (this._initialized) throw new Error("Platform is already initialized");
|
|
228
231
|
this._initialized = true;
|
|
@@ -242,8 +245,8 @@ var AbstractWebSocket = class {
|
|
|
242
245
|
/** The connection is closed. */
|
|
243
246
|
this.CLOSED = 3;
|
|
244
247
|
this._user = null;
|
|
245
|
-
const {
|
|
246
|
-
this.
|
|
248
|
+
const { persistence, room } = config;
|
|
249
|
+
this.persistence = persistence;
|
|
247
250
|
this.room = room;
|
|
248
251
|
this.webSocket = webSocket;
|
|
249
252
|
}
|
|
@@ -253,7 +256,7 @@ var AbstractWebSocket = class {
|
|
|
253
256
|
const sessionId = this.sessionId;
|
|
254
257
|
const state = this.state;
|
|
255
258
|
const room = state.room;
|
|
256
|
-
const user = (_a = this._user) != null ? _a : yield this.
|
|
259
|
+
const user = (_a = this._user) != null ? _a : yield this.persistence.getUser(room, sessionId);
|
|
257
260
|
this._user = user;
|
|
258
261
|
return __spreadProps(__spreadValues({}, state), {
|
|
259
262
|
id: sessionId,
|
|
@@ -341,11 +344,11 @@ var PluvProcedure = class _PluvProcedure {
|
|
|
341
344
|
// src/PluvRouter.ts
|
|
342
345
|
var PluvRouter = class _PluvRouter {
|
|
343
346
|
constructor(events) {
|
|
344
|
-
this.
|
|
345
|
-
this.
|
|
347
|
+
this._defs = { events: {} };
|
|
348
|
+
this._defs = { events };
|
|
346
349
|
}
|
|
347
350
|
static merge(...routers) {
|
|
348
|
-
const events = Object.assign(/* @__PURE__ */ Object.create(null), ...routers.map((router) => router.
|
|
351
|
+
const events = Object.assign(/* @__PURE__ */ Object.create(null), ...routers.map((router) => router._defs.events));
|
|
349
352
|
return new _PluvRouter(events);
|
|
350
353
|
}
|
|
351
354
|
};
|
|
@@ -394,8 +397,8 @@ var PING_TIMEOUT_MS = 3e4;
|
|
|
394
397
|
// src/IORoom.ts
|
|
395
398
|
var IORoom = class {
|
|
396
399
|
constructor(id, config) {
|
|
397
|
-
this._authorize = null;
|
|
398
400
|
this._uninitialize = null;
|
|
401
|
+
this._authorize = null;
|
|
399
402
|
this._sessions = /* @__PURE__ */ new Map();
|
|
400
403
|
const { authorize: authorize2, context, crdt = import_crdt.noop, debug, onDestroy, onMessage, platform, router } = config;
|
|
401
404
|
this.id = id;
|
|
@@ -422,8 +425,18 @@ var IORoom = class {
|
|
|
422
425
|
this._doc = doc;
|
|
423
426
|
this._uninitialize = uninitialize;
|
|
424
427
|
}
|
|
425
|
-
|
|
426
|
-
|
|
428
|
+
/**
|
|
429
|
+
* @ignore
|
|
430
|
+
* @readonly
|
|
431
|
+
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
432
|
+
*/
|
|
433
|
+
get _defs() {
|
|
434
|
+
return {
|
|
435
|
+
authorize: this._authorize,
|
|
436
|
+
context: this._context,
|
|
437
|
+
events: this._router._defs.events,
|
|
438
|
+
platform: this._platform
|
|
439
|
+
};
|
|
427
440
|
}
|
|
428
441
|
get broadcast() {
|
|
429
442
|
const _broadcast = (event, data) => {
|
|
@@ -500,7 +513,7 @@ var IORoom = class {
|
|
|
500
513
|
return;
|
|
501
514
|
}
|
|
502
515
|
this._sessions.set(pluvWs.sessionId, pluvWs);
|
|
503
|
-
yield this._platform.
|
|
516
|
+
yield this._platform.persistence.addUser(this.id, pluvWs.sessionId, user != null ? user : {});
|
|
504
517
|
if (this._platform._registrationMode === "attached") {
|
|
505
518
|
const onClose = this._onClose(pluvWs).bind(this);
|
|
506
519
|
const onMessage = this._onMessage(pluvWs).bind(this);
|
|
@@ -604,7 +617,7 @@ var IORoom = class {
|
|
|
604
617
|
_getInitialDoc() {
|
|
605
618
|
return __async(this, null, function* () {
|
|
606
619
|
const doc = this._docFactory.getEmpty();
|
|
607
|
-
const encodedState = yield this._platform.
|
|
620
|
+
const encodedState = yield this._platform.persistence.getStorageState(this.id);
|
|
608
621
|
if (typeof encodedState === "string") doc.applyEncodedState({ update: encodedState });
|
|
609
622
|
return doc;
|
|
610
623
|
});
|
|
@@ -617,7 +630,7 @@ var IORoom = class {
|
|
|
617
630
|
}
|
|
618
631
|
_getProcedure(message) {
|
|
619
632
|
var _a;
|
|
620
|
-
return (_a = this._router.
|
|
633
|
+
return (_a = this._router._defs.events[message.type]) != null ? _a : null;
|
|
621
634
|
}
|
|
622
635
|
_getProcedureInputs(message) {
|
|
623
636
|
const procedure = this._getProcedure(message);
|
|
@@ -679,11 +692,11 @@ var IORoom = class {
|
|
|
679
692
|
const encodedState = doc2.getEncodedState();
|
|
680
693
|
doc2.destroy();
|
|
681
694
|
this._doc = Promise.resolve(this._docFactory.getEmpty());
|
|
682
|
-
this._listeners.onDestroy({
|
|
695
|
+
this._listeners.onDestroy(__spreadProps(__spreadValues({}, this._platform._meta ? { _meta: this._platform._meta } : {}), {
|
|
683
696
|
context: this._context,
|
|
684
697
|
encodedState,
|
|
685
698
|
room: this.id
|
|
686
|
-
});
|
|
699
|
+
}));
|
|
687
700
|
this._uninitialize = null;
|
|
688
701
|
});
|
|
689
702
|
return { doc, uninitialize };
|
|
@@ -701,7 +714,7 @@ var IORoom = class {
|
|
|
701
714
|
webSocket.state = __spreadProps(__spreadValues({}, webSocket.state), { quit: true });
|
|
702
715
|
this._logDebug(`${import_kleur.default.blue(`Unregistering connection for room ${this.id}:`)} ${webSocket.sessionId}`);
|
|
703
716
|
this._sessions.delete(webSocket.sessionId);
|
|
704
|
-
this._platform.
|
|
717
|
+
this._platform.persistence.deleteUser(this.id, webSocket.sessionId).finally(() => __async(this, null, function* () {
|
|
705
718
|
yield this._broadcast({
|
|
706
719
|
message: {
|
|
707
720
|
type: "$EXIT",
|
|
@@ -745,6 +758,13 @@ var IORoom = class {
|
|
|
745
758
|
const message = this._parseMessage(event);
|
|
746
759
|
if (!message) return;
|
|
747
760
|
const procedure = this._getProcedure(message);
|
|
761
|
+
this._listeners.onMessage(__spreadProps(__spreadValues({}, this._platform._meta ? { _meta: this._platform._meta } : {}), {
|
|
762
|
+
context: this._context,
|
|
763
|
+
encodedState: doc.getEncodedState(),
|
|
764
|
+
message,
|
|
765
|
+
room: this.id,
|
|
766
|
+
user: session.user
|
|
767
|
+
}));
|
|
748
768
|
if (!procedure) return;
|
|
749
769
|
let inputs;
|
|
750
770
|
try {
|
|
@@ -816,16 +836,7 @@ var IORoom = class {
|
|
|
816
836
|
}
|
|
817
837
|
_sendMessage(pluvWs, message) {
|
|
818
838
|
return __async(this, null, function* () {
|
|
819
|
-
const { data, type } = message;
|
|
820
839
|
if (!(yield this._initialized)) return;
|
|
821
|
-
const doc = yield this._doc;
|
|
822
|
-
this._listeners.onMessage({
|
|
823
|
-
context: this._context,
|
|
824
|
-
encodedState: doc.getEncodedState(),
|
|
825
|
-
message: { data, type },
|
|
826
|
-
room: this.id,
|
|
827
|
-
user: message.user
|
|
828
|
-
});
|
|
829
840
|
yield Promise.resolve(pluvWs.sendMessage(message));
|
|
830
841
|
});
|
|
831
842
|
}
|
|
@@ -905,7 +916,7 @@ var IORoom = class {
|
|
|
905
916
|
};
|
|
906
917
|
|
|
907
918
|
// src/version.generated.ts
|
|
908
|
-
var version = "0.
|
|
919
|
+
var version = "0.25.1";
|
|
909
920
|
|
|
910
921
|
// src/PluvServer.ts
|
|
911
922
|
var PluvServer = class {
|
|
@@ -946,7 +957,7 @@ var PluvServer = class {
|
|
|
946
957
|
};
|
|
947
958
|
}).self((_0, _1) => __async(this, [_0, _1], function* (data, { context, doc, room }) {
|
|
948
959
|
var _a, _b;
|
|
949
|
-
const oldState = yield this._platform.
|
|
960
|
+
const oldState = yield this._platform.persistence.getStorageState(room);
|
|
950
961
|
const update = data == null ? void 0 : data.update;
|
|
951
962
|
const updates = [
|
|
952
963
|
oldState ? null : yield (_a = this._getInitialStorage) == null ? void 0 : _a.call(this, __spreadProps(__spreadValues({}, context), { room })),
|
|
@@ -954,10 +965,10 @@ var PluvServer = class {
|
|
|
954
965
|
];
|
|
955
966
|
if (updates.some((_update) => !!_update)) {
|
|
956
967
|
const encodedState = doc.batchApplyEncodedState(updates).getEncodedState();
|
|
957
|
-
yield this._platform.
|
|
968
|
+
yield this._platform.persistence.setStorageState(room, encodedState);
|
|
958
969
|
this._listeners.onStorageUpdated({ context, encodedState, room });
|
|
959
970
|
}
|
|
960
|
-
const state = (_b = yield this._platform.
|
|
971
|
+
const state = (_b = yield this._platform.persistence.getStorageState(room)) != null ? _b : doc.getEncodedState();
|
|
961
972
|
return { $STORAGE_RECEIVED: { state } };
|
|
962
973
|
})),
|
|
963
974
|
$PING: this._procedure.self((data, { session }) => {
|
|
@@ -985,7 +996,7 @@ var PluvServer = class {
|
|
|
985
996
|
if (origin === "$INITIALIZED" && Object.keys(doc.toJson()).length) return {};
|
|
986
997
|
const updated = update === null ? doc : doc.applyEncodedState({ update });
|
|
987
998
|
const encodedState = updated.getEncodedState();
|
|
988
|
-
this._platform.
|
|
999
|
+
this._platform.persistence.setStorageState(room, encodedState).then(() => {
|
|
989
1000
|
this._listeners.onStorageUpdated({
|
|
990
1001
|
context,
|
|
991
1002
|
encodedState,
|
|
@@ -1022,11 +1033,18 @@ var PluvServer = class {
|
|
|
1022
1033
|
onStorageUpdated: (event) => onStorageUpdated == null ? void 0 : onStorageUpdated(event)
|
|
1023
1034
|
};
|
|
1024
1035
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1036
|
+
/**
|
|
1037
|
+
* @ignore
|
|
1038
|
+
* @readonly
|
|
1039
|
+
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
1040
|
+
*/
|
|
1041
|
+
get _defs() {
|
|
1042
|
+
return {
|
|
1043
|
+
authorize: this._authorize,
|
|
1044
|
+
context: this._context,
|
|
1045
|
+
events: this._router._defs.events,
|
|
1046
|
+
platform: this._platform
|
|
1047
|
+
};
|
|
1030
1048
|
}
|
|
1031
1049
|
get _procedure() {
|
|
1032
1050
|
return new PluvProcedure();
|
|
@@ -1047,7 +1065,7 @@ var PluvServer = class {
|
|
|
1047
1065
|
this._logDebug(`${import_kleur2.default.blue("Deleting empty room:")} ${room}`);
|
|
1048
1066
|
yield Promise.resolve(onDestroy == null ? void 0 : onDestroy(event));
|
|
1049
1067
|
yield Promise.resolve(this._listeners.onRoomDeleted(event));
|
|
1050
|
-
yield this._platform.
|
|
1068
|
+
yield this._platform.persistence.deleteStorageState(room);
|
|
1051
1069
|
this._logDebug(`${import_kleur2.default.blue("Deleted room:")} ${room}`);
|
|
1052
1070
|
}),
|
|
1053
1071
|
onMessage: (event) => __async(this, null, function* () {
|
|
@@ -1136,7 +1154,7 @@ var createIO = (params) => {
|
|
|
1136
1154
|
};
|
|
1137
1155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1138
1156
|
0 && (module.exports = {
|
|
1139
|
-
|
|
1157
|
+
AbstractPersistence,
|
|
1140
1158
|
AbstractPlatform,
|
|
1141
1159
|
AbstractPubSub,
|
|
1142
1160
|
AbstractWebSocket,
|