@pluv/io 5.0.2 → 5.0.3
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/README.md +38 -42
- package/dist/index.d.mts +26 -26
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +45 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<a href="https://pluv.io/docs/introduction">
|
|
3
|
-
<img src="https://github.com/pluv-io/pluv/blob/
|
|
3
|
+
<img src="https://github.com/pluv-io/pluv/blob/main/assets/pluv-icon-192x192.png?raw=true" alt="Pluv.IO" width="156" style="border-radius:16px" />
|
|
4
4
|
</a>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/@pluv/io">
|
|
12
12
|
<img src="https://img.shields.io/npm/v/@pluv/io" alt="npm @pluv/io" />
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://github.com/pluv-io/pluv/blob/
|
|
14
|
+
<a href="https://github.com/pluv-io/pluv/blob/main/LICENSE">
|
|
15
15
|
<img alt="GitHub" src="https://img.shields.io/github/license/pluv-io/pluv" alt="License MIT" />
|
|
16
16
|
</a>
|
|
17
17
|
<a href="https://commitizen.github.io/cz-cli/">
|
|
@@ -39,25 +39,25 @@ Create your pluv.io backend
|
|
|
39
39
|
```ts
|
|
40
40
|
// backend
|
|
41
41
|
const io = createIO(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
platformNode({
|
|
43
|
+
context: () => ({ db }),
|
|
44
|
+
crdt: yjs,
|
|
45
|
+
}),
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
export const ioServer = io.server({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
getInitialStorage: async ({ context: { db }, room }) => {
|
|
50
|
+
return await db.room
|
|
51
|
+
.findUnique({ where: { id: room } })
|
|
52
|
+
.then((result) => result?.encodedState ?? null);
|
|
53
|
+
},
|
|
54
|
+
router: io.router({
|
|
55
|
+
sendGreeting: io.procedure
|
|
56
|
+
.input(z.object({ message: z.string() }))
|
|
57
|
+
.broadcast(({ message }) => ({
|
|
58
|
+
receiveGreeting: { message },
|
|
59
|
+
})),
|
|
60
|
+
}),
|
|
61
61
|
});
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -67,29 +67,25 @@ Create your frontend client with your backend types
|
|
|
67
67
|
// frontend
|
|
68
68
|
const types = infer((i) => ({ io: i<typeof ioServer> }));
|
|
69
69
|
const io = createClient({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
types,
|
|
71
|
+
initialStorage: yjs.doc((t) => ({
|
|
72
|
+
messages: t.array<string>("messages"),
|
|
73
|
+
})),
|
|
74
|
+
presence: z.object({
|
|
75
|
+
selectionId: z.string().nullable(),
|
|
76
|
+
}),
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
const {
|
|
80
|
-
event,
|
|
81
|
-
useBroadcast,
|
|
82
|
-
useMyPresence,
|
|
83
|
-
useOthers,
|
|
84
|
-
useStorage
|
|
85
|
-
} = createBundle(io);
|
|
79
|
+
const { event, useBroadcast, useMyPresence, useOthers, useStorage } = createBundle(io);
|
|
86
80
|
```
|
|
87
81
|
|
|
88
82
|
Use powerful primitives to build realtime features
|
|
89
83
|
|
|
90
84
|
```tsx
|
|
91
85
|
// react
|
|
92
|
-
event.receiveGreeting.useEvent(({ data }) => {
|
|
86
|
+
event.receiveGreeting.useEvent(({ data }) => {
|
|
87
|
+
/* ... */
|
|
88
|
+
});
|
|
93
89
|
// ^? const data: { message: string }
|
|
94
90
|
|
|
95
91
|
const broadcast = useBroadcast();
|
|
@@ -98,20 +94,20 @@ broadcast.sendGreeting({ message: "hello world" });
|
|
|
98
94
|
// ^? const sendGreeting: (data: { message: string }) => void
|
|
99
95
|
|
|
100
96
|
const [mySelection, update] = useMyPresence((presence) => {
|
|
101
|
-
// ^? const mySelection: string | null
|
|
102
|
-
|
|
97
|
+
// ^? const mySelection: string | null
|
|
98
|
+
return presence.selectionId;
|
|
103
99
|
});
|
|
104
100
|
|
|
105
101
|
const others = useOthers((others) => {
|
|
106
|
-
// ^? const others = string[]
|
|
107
|
-
|
|
102
|
+
// ^? const others = string[]
|
|
103
|
+
return others.map((other) => other.presence.selectionId);
|
|
108
104
|
});
|
|
109
105
|
|
|
110
106
|
const [
|
|
111
|
-
|
|
112
|
-
// ^? const messages: string[] | null
|
|
113
|
-
|
|
114
|
-
// ^? YArray<string> | null
|
|
107
|
+
messages,
|
|
108
|
+
// ^? const messages: string[] | null
|
|
109
|
+
sharedType,
|
|
110
|
+
// ^? YArray<string> | null
|
|
115
111
|
] = useStorage("messages");
|
|
116
112
|
```
|
|
117
113
|
|
|
@@ -196,4 +192,4 @@ This software uses the following open source tooling and libraries:
|
|
|
196
192
|
|
|
197
193
|
## License
|
|
198
194
|
|
|
199
|
-
[MIT](https://github.com/pluv-io/pluv/blob/
|
|
195
|
+
[MIT](https://github.com/pluv-io/pluv/blob/main/LICENSE)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractCrdtDocFactory, CrdtLibraryType, CrdtLibraryType as CrdtLibraryType$1, NoopCrdtDocFactory } from "@pluv/crdt";
|
|
2
|
-
import { BaseUser, BaseUser as BaseUser$1, CrdtDocLike, CrdtLibraryType as CrdtLibraryType$2, EventMessage, EventRecord, EventRecord as EventRecord$1, HasRequiredProperty, IOAuthorize, IOEventMessage, IOEventMessage as IOEventMessage$1, IOLike, IORouterLike, Id, InferEventMessage, InferEventsOutput, InferIOAuthorize, InferIOAuthorizeUser, InferIOInput, InferIOOutput, InputZodLike, JsonObject, Maybe, MaybePromise, ProcedureLike, UndefinedProps } from "@pluv/types";
|
|
2
|
+
import { BaseUser, BaseUser as BaseUser$1, CrdtDocFactory, CrdtDocLike, CrdtDocLike as CrdtDocLike$1, CrdtLibraryType as CrdtLibraryType$2, EventMessage, EventRecord, EventRecord as EventRecord$1, HasRequiredProperty, IOAuthorize, IOAuthorize as IOAuthorize$1, IOEventMessage, IOEventMessage as IOEventMessage$1, IOLike, IORouterLike, Id, InferEventMessage, InferEventsOutput, InferIOAuthorize, InferIOAuthorize as InferIOAuthorize$1, InferIOAuthorizeUser, InferIOAuthorizeUser as InferIOAuthorizeUser$1, InferIOInput, InferIOOutput, InputZodLike, InputZodLike as InputZodLike$1, JsonObject, Maybe, MaybePromise, ProcedureLike, ProcedureLike as ProcedureLike$1, UndefinedProps } from "@pluv/types";
|
|
3
3
|
//#region src/AbstractPersistence.d.ts
|
|
4
4
|
declare abstract class AbstractPersistence {
|
|
5
5
|
abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
|
|
@@ -46,7 +46,7 @@ interface AbstractWebSocketConfig {
|
|
|
46
46
|
platform: AbstractPlatform<any>;
|
|
47
47
|
room: string;
|
|
48
48
|
}
|
|
49
|
-
declare abstract class AbstractWebSocket<TWebSocket = any, TAuthorize extends IOAuthorize<any, any> | null = null> {
|
|
49
|
+
declare abstract class AbstractWebSocket<TWebSocket = any, TAuthorize extends IOAuthorize$1<any, any> | null = null> {
|
|
50
50
|
/** The connection is not yet open. */
|
|
51
51
|
readonly CONNECTING = 0;
|
|
52
52
|
/** The connection is open and ready to communicate. */
|
|
@@ -65,7 +65,7 @@ declare abstract class AbstractWebSocket<TWebSocket = any, TAuthorize extends IO
|
|
|
65
65
|
abstract get sessionId(): string;
|
|
66
66
|
abstract get state(): WebSocketSerializedState;
|
|
67
67
|
abstract set state(state: WebSocketSerializedState);
|
|
68
|
-
abstract set user(user: InferIOAuthorizeUser<TAuthorize>);
|
|
68
|
+
abstract set user(user: InferIOAuthorizeUser$1<TAuthorize>);
|
|
69
69
|
constructor(webSocket: TWebSocket, config: AbstractWebSocketConfig);
|
|
70
70
|
/**
|
|
71
71
|
* TODO
|
|
@@ -77,7 +77,7 @@ declare abstract class AbstractWebSocket<TWebSocket = any, TAuthorize extends IO
|
|
|
77
77
|
* @date August 28, 2022
|
|
78
78
|
*/
|
|
79
79
|
abstract addEventListener<TType extends EventType>(type: TType, handler: AbstractListener<TType>): void;
|
|
80
|
-
abstract close(code?: number
|
|
80
|
+
abstract close(code?: number, reason?: string): void;
|
|
81
81
|
abstract send(message: ArrayBuffer | ArrayBufferView | string): void;
|
|
82
82
|
abstract terminate(): void;
|
|
83
83
|
handleError(params: AbstractWebSocketHandleErrorParams): void;
|
|
@@ -85,21 +85,21 @@ declare abstract class AbstractWebSocket<TWebSocket = any, TAuthorize extends IO
|
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
87
|
//#region src/PluvProcedure.d.ts
|
|
88
|
-
interface PluvProcedureConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TInput extends JsonObject = {}, TOutput extends EventRecord$1<string, any> = {}> {
|
|
88
|
+
interface PluvProcedureConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TInput extends JsonObject = {}, TOutput extends EventRecord$1<string, any> = {}> {
|
|
89
89
|
broadcast?: EventResolver<"broadcast", TPlatform, TAuthorize, TContext, TInput, Partial<TOutput>> | null;
|
|
90
|
-
input?: InputZodLike<TInput>;
|
|
90
|
+
input?: InputZodLike$1<TInput>;
|
|
91
91
|
self?: EventResolver<"self", TPlatform, TAuthorize, TContext, TInput, Partial<TOutput>> | null;
|
|
92
92
|
sync?: EventResolver<"sync", TPlatform, TAuthorize, TContext, TInput, Partial<TOutput>> | null;
|
|
93
93
|
}
|
|
94
|
-
declare class PluvProcedure<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TInput extends JsonObject = {}, TOutput extends EventRecord$1<string, any> = {}, TFilled extends "input" | "broadcast" | "self" | "sync" | "" = ""> {
|
|
94
|
+
declare class PluvProcedure<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TInput extends JsonObject = {}, TOutput extends EventRecord$1<string, any> = {}, TFilled extends "input" | "broadcast" | "self" | "sync" | "" = ""> {
|
|
95
95
|
private _broadcast;
|
|
96
96
|
private _input;
|
|
97
97
|
private _self;
|
|
98
98
|
private _sync;
|
|
99
|
-
get config(): ProcedureLike<TInput, TOutput>["config"];
|
|
99
|
+
get config(): ProcedureLike$1<TInput, TOutput>["config"];
|
|
100
100
|
constructor(config?: PluvProcedureConfig<TPlatform, TAuthorize, TContext, TInput, TOutput>);
|
|
101
101
|
broadcast<TResult extends EventRecord$1<string, any> = {}>(resolver: EventResolver<"broadcast", TPlatform, TAuthorize, TContext, TInput, TResult>): Omit<PluvProcedure<TPlatform, TAuthorize, TContext, TInput, MergeEventRecords<[TOutput, TResult]>, TFilled | "input" | "broadcast">, TFilled | "input" | "broadcast">;
|
|
102
|
-
input<TData extends JsonObject>(input: InputZodLike<TData>): Omit<PluvProcedure<TPlatform, TAuthorize, TContext, TData, {}, TFilled | "input">, TFilled | "input">;
|
|
102
|
+
input<TData extends JsonObject>(input: InputZodLike$1<TData>): Omit<PluvProcedure<TPlatform, TAuthorize, TContext, TData, {}, TFilled | "input">, TFilled | "input">;
|
|
103
103
|
self<TResult extends EventRecord$1<string, any> = {}>(resolver: EventResolver<"self", TPlatform, TAuthorize, TContext, TInput, TResult>): Omit<PluvProcedure<TPlatform, TAuthorize, TContext, TInput, MergeEventRecords<[TOutput, TResult]>, TFilled | "input" | "self">, TFilled | "input" | "self">;
|
|
104
104
|
sync<TResult extends EventRecord$1<string, any> = {}>(resolver: EventResolver<"sync", TPlatform, TAuthorize, TContext, TInput, TResult>): Omit<PluvProcedure<TPlatform, TAuthorize, TContext, TInput, MergeEventRecords<[TOutput, TResult]>, TFilled | "input" | "sync">, TFilled | "input" | "sync">;
|
|
105
105
|
private _resolver;
|
|
@@ -122,10 +122,10 @@ declare class PluvRouter<TPlatform extends AbstractPlatform<any> = AbstractPlatf
|
|
|
122
122
|
//#region src/types.d.ts
|
|
123
123
|
type PluvContext<TPlatform extends AbstractPlatform, TContext extends Record<string, any>> = MaybePromise<TContext> | ((params: InferRoomContextType<TPlatform>) => MaybePromise<TContext>);
|
|
124
124
|
type EventResolverKind = "broadcast" | "self" | "sync";
|
|
125
|
-
type EventResolver<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord$1<string, any> = {}> = (data: TInput, context: EventResolverContext<TKind, TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
|
|
126
|
-
interface EventResolverContext<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}> {
|
|
125
|
+
type EventResolver<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord$1<string, any> = {}> = (data: TInput, context: EventResolverContext<TKind, TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
|
|
126
|
+
interface EventResolverContext<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}> {
|
|
127
127
|
context: TContext;
|
|
128
|
-
doc: CrdtDocLike<any, any>;
|
|
128
|
+
doc: CrdtDocLike$1<any, any>;
|
|
129
129
|
garbageCollect: () => Promise<void>;
|
|
130
130
|
platform: TPlatform;
|
|
131
131
|
presence: JsonObject | null;
|
|
@@ -152,9 +152,9 @@ interface WebSocketSerializedState {
|
|
|
152
152
|
room: string;
|
|
153
153
|
timers: WebSocketSessionTimers;
|
|
154
154
|
}
|
|
155
|
-
type WebSocketSession<TAuthorize extends IOAuthorize<any, any> | null = null> = WebSocketSerializedState & {
|
|
155
|
+
type WebSocketSession<TAuthorize extends IOAuthorize$1<any, any> | null = null> = WebSocketSerializedState & {
|
|
156
156
|
id: string;
|
|
157
|
-
user: InferIOAuthorizeUser<TAuthorize>;
|
|
157
|
+
user: InferIOAuthorizeUser$1<TAuthorize>;
|
|
158
158
|
webSocket: AbstractWebSocket;
|
|
159
159
|
};
|
|
160
160
|
type MergeEventRecords<TEventRecords extends EventRecord$1<string, any>[], TRoot extends EventRecord$1<string, any> = {}> = TEventRecords extends [infer IHead extends EventRecord$1<string, any>, ...infer ITail extends EventRecord$1<string, any>[]] ? MergeEventRecords<ITail, Omit<TRoot, keyof IHead> & { [P in keyof IHead]: TRoot extends Record<P, any> ? TRoot[P] | IHead[P] : IHead[P]; }> : Id<TRoot>;
|
|
@@ -183,7 +183,7 @@ interface PlatformConfig {
|
|
|
183
183
|
router?: boolean;
|
|
184
184
|
}
|
|
185
185
|
type ResolvedPluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, any>, TUser extends BaseUser$1 = any> = {
|
|
186
|
-
user: InputZodLike<TUser>;
|
|
186
|
+
user: InputZodLike$1<TUser>;
|
|
187
187
|
} & UndefinedProps<{
|
|
188
188
|
secret?: string;
|
|
189
189
|
}, Exclude<"secret", InferPlatformAuthorizeProperties<TPlatform>>>;
|
|
@@ -237,19 +237,19 @@ type IORoomDestroyedEvent<TPlatform extends AbstractPlatform<any, any, any, any>
|
|
|
237
237
|
};
|
|
238
238
|
type IORoomMessageEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
239
239
|
message: InferEventMessage<InferEventsOutput<TEvents>, keyof InferEventsOutput<TEvents>>;
|
|
240
|
-
user?: InferIOAuthorizeUser<TAuthorize>;
|
|
240
|
+
user?: InferIOAuthorizeUser$1<TAuthorize>;
|
|
241
241
|
webSocket?: InferPlatformWebSocketSource<TPlatform>;
|
|
242
242
|
};
|
|
243
|
-
type IOStorageUpdatedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
244
|
-
user?: InferIOAuthorizeUser<TAuthorize>;
|
|
243
|
+
type IOStorageUpdatedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
244
|
+
user?: InferIOAuthorizeUser$1<TAuthorize>;
|
|
245
245
|
webSocket?: InferPlatformWebSocketSource<TPlatform>;
|
|
246
246
|
};
|
|
247
|
-
type IOUserConnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
248
|
-
user?: InferIOAuthorizeUser<TAuthorize>;
|
|
247
|
+
type IOUserConnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
248
|
+
user?: InferIOAuthorizeUser$1<TAuthorize>;
|
|
249
249
|
webSocket?: InferPlatformWebSocketSource<TPlatform>;
|
|
250
250
|
};
|
|
251
|
-
type IOUserDisconnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
252
|
-
user?: InferIOAuthorizeUser<TAuthorize>;
|
|
251
|
+
type IOUserDisconnectedEvent<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>> = IORoomListenerEvent<TPlatform, TContext> & {
|
|
252
|
+
user?: InferIOAuthorizeUser$1<TAuthorize>;
|
|
253
253
|
};
|
|
254
254
|
type WebSocketType<TPlatform extends AbstractPlatform> = InferPlatformWebSocketType<TPlatform> | InferPlatformWebSocketSource<TPlatform>;
|
|
255
255
|
//#endregion
|
|
@@ -488,14 +488,14 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any, any> = Abstract
|
|
|
488
488
|
private get _router();
|
|
489
489
|
constructor(options: PluvServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>);
|
|
490
490
|
createRoom(room: string, ...options: CreateRoomOptions<TPlatform, TAuthorize, TContext, TEvents>): IORoom<TPlatform, TAuthorize, TContext, TCrdt, TEvents>;
|
|
491
|
-
createToken(params: JWTEncodeParams<InferIOAuthorizeUser<InferIOAuthorize<this>>, TPlatform>): Promise<string>;
|
|
491
|
+
createToken(params: JWTEncodeParams<InferIOAuthorizeUser$1<InferIOAuthorize$1<this>>, TPlatform>): Promise<string>;
|
|
492
492
|
private _getInitialStorage;
|
|
493
493
|
private _getListeners;
|
|
494
494
|
private _logDebug;
|
|
495
495
|
}
|
|
496
496
|
//#endregion
|
|
497
497
|
//#region src/PluvIO.d.ts
|
|
498
|
-
type PluvIOConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<any>> = {
|
|
498
|
+
type PluvIOConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize$1<any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<any>> = {
|
|
499
499
|
authorize?: TAuthorize;
|
|
500
500
|
context?: PluvContext<TPlatform, TContext>;
|
|
501
501
|
crdt?: TCrdt;
|
|
@@ -520,7 +520,7 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
|
|
|
520
520
|
private readonly _platform;
|
|
521
521
|
get procedure(): PluvProcedure<TPlatform, TAuthorize, TContext, {}, {}>;
|
|
522
522
|
constructor(options: PluvIOConfig<TPlatform, TAuthorize, TContext, TCrdt>);
|
|
523
|
-
createToken(params: JWTEncodeParams<InferIOAuthorizeUser<TAuthorize>, TPlatform>): Promise<string>;
|
|
523
|
+
createToken(params: JWTEncodeParams<InferIOAuthorizeUser$1<TAuthorize>, TPlatform>): Promise<string>;
|
|
524
524
|
mergeRouters<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
525
525
|
router<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>>(events: TEvents): PluvRouter<TPlatform, TAuthorize, TContext, TEvents>;
|
|
526
526
|
server<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}>(...config: ServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>): PluvServer<TPlatform, TAuthorize, TContext, TCrdt, TEvents>;
|
|
@@ -538,5 +538,5 @@ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<a
|
|
|
538
538
|
};
|
|
539
539
|
declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TUser extends BaseUser$1 | null = null, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<NoopCrdtDocFactory>>(params: CreateIOParams<TPlatform, TContext, TUser, TCrdt>) => PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext, TCrdt>;
|
|
540
540
|
//#endregion
|
|
541
|
-
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 BaseUser, type ConvertWebSocketConfig, type CrdtLibraryType, type CreateIOParams, type CreateRoomOptions, type EventMessage, type EventRecord, type GetInitialStorageFn, type HandleMode, type IOEventMessage, type IOPubSubEventMessage, type IORoom, type IORoomDestroyedEvent, type IORoomListenerEvent, type IORoomMessageEvent, type IOStorageUpdatedEvent, type IOUserConnectedEvent, type IOUserDisconnectedEvent, type InferIORoom, type InferInitContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, type PlatformConfig, type PluvContext, PluvIO, type PluvIOAuthorize, type PluvIOConfig, type PluvIOLimits, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, authorize, createIO };
|
|
541
|
+
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 BaseUser, type ConvertWebSocketConfig, type CrdtDocFactory, type CrdtDocLike, type CrdtLibraryType, type CreateIOParams, type CreateRoomOptions, type EventMessage, type EventRecord, type GetInitialStorageFn, type HandleMode, type IOAuthorize, type IOEventMessage, type IOPubSubEventMessage, type IORoom, type IORoomDestroyedEvent, type IORoomListenerEvent, type IORoomMessageEvent, type IOStorageUpdatedEvent, type IOUserConnectedEvent, type IOUserDisconnectedEvent, type InferIOAuthorize, type InferIOAuthorizeUser, type InferIORoom, type InferInitContextType, type InferPlatformWebSocketType, type InferRoomContextType, type InputZodLike, type JWT, type JWTEncodeParams, type MergedRouter, type PlatformConfig, type PluvContext, PluvIO, type PluvIOAuthorize, type PluvIOConfig, type PluvIOLimits, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ProcedureLike, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, authorize, createIO };
|
|
542
542
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/AbstractPersistence.ts","../src/AbstractWebSocket.ts","../src/PluvProcedure.ts","../src/PluvRouter.ts","../src/types.ts","../src/AbstractPubSub.ts","../src/authorize.ts","../src/AbstractPlatform.ts","../src/IORoom.ts","../src/PluvServer.ts","../src/PluvIO.ts","../src/createIO.ts"],"mappings":";;;uBAEsB;WACF,QACZ,cACA,sBACA,MAAM,oBACP;WAEa,mBAAmB,eAAe;WAElC,WAAW,cAAc,uBAAuB;WAEhD,YAAY,eAAe;WAE3B,gBAAgB,eAAe;WAE/B,QAAQ,cAAc,uBAAuB,QAAQ;WAErD,SACZ,eACD,QAAQ,KAAK,0BAA0B;WAE1B,aAAa,eAAe;WAE5B,WAAW;WAEX,gBAAgB,cAAc,gBAAgB;;;;KCftD;KAEA,qBAAqB;WACpB;WACA;;KAGD,qBAAqB,WAAW;WAC/B,MAAM;;KAGP,qBAAqB;EAC7B;EACA;;UAGa;EACb,OAAO;EACP,SAAS;EACT,OAAO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,UAAU;EAkBtD,YACT,QAAQ,gBAAgB,qBAAqB,aAAa,aAC3D;EA8CI,aAAa,iBAAiB,WAAW,WAAW,YAAY,qBAChE,SAAS,WACb,aAAa;EAIT,OAAO,gBAAgB,sBAAsB,WAAW,YAAY,WACvE,QAAQ,UACT,WAAW,WAAW,YAAY,UAAU;EAYxC,OAAO,gBAAgB,sBAAsB,WAAW,YAAY,mBACpE,QAAQ,aAAa,WAAW,YAAY,UAAU,OAAO,WACjE,WAAW,WAAW,YAAY,UAAU,OAAO;UAqB9C;;;;KC9NA,eACR,kBAAkB,wBAAwB,uBAC1C,iBAAiB,0BACjB,cAAc,0BACd,cAAc,yBAAuB,kBAAgB;EAErD,YAAY,gBAAgB,WAAW,OAAO,qBAAqB;EACnE,UAAU,YAAY,WAAW;EACjC,OAAO;EACP;EACA,SAAS;EACT,gBAAgB;;cAGP,WACT,kBAAkB,wBAAwB,uBAC1C,iBAAiB,0BACjB,cAAc,0BACd,cAAc,yBAAuB,kBAAgB,qBAErD,QAAQ,eAAe,WAAW,UAAU,OAAO,WACpD,OACC,WACA,gBAAgB,WAAW,OAAO,qBAAqB,aACvD,UACA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/AbstractPersistence.ts","../src/AbstractWebSocket.ts","../src/PluvProcedure.ts","../src/PluvRouter.ts","../src/types.ts","../src/AbstractPubSub.ts","../src/authorize.ts","../src/AbstractPlatform.ts","../src/IORoom.ts","../src/PluvServer.ts","../src/PluvIO.ts","../src/createIO.ts"],"mappings":";;;uBAEsB;WACF,QACZ,cACA,sBACA,MAAM,oBACP;WAEa,mBAAmB,eAAe;WAElC,WAAW,cAAc,uBAAuB;WAEhD,YAAY,eAAe;WAE3B,gBAAgB,eAAe;WAE/B,QAAQ,cAAc,uBAAuB,QAAQ;WAErD,SACZ,eACD,QAAQ,KAAK,0BAA0B;WAE1B,aAAa,eAAe;WAE5B,WAAW;WAEX,gBAAgB,cAAc,gBAAgB;;;;KCftD;KAE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AAuB;WAErB;mBAEC;mBACA;mBAIA;mBACA;mBACA;mBACA;MAEN,aAAa,cAAc,WAAW,YAAY;EAI7D,YAAY,SAAS,aAAa,WAAW,YAAY,UAAU;EAyBtD,YACT,QAAQ,gBAAgB,uBAAqB,aAAa,aAC3D;EA8CI,aAAa,iBAAiB,WAAW,WAAW,YAAY,qBAChE,SAAS,WACb,aAAa;EAIT,OAAO,gBAAgB,sBAAsB,WAAW,YAAY,WACvE,QAAQ,UACT,WAAW,WAAW,YAAY,UAAU;EAYxC,OAAO,gBAAgB,sBAAsB,WAAW,YAAY,mBACpE,QAAQ,aAAa,WAAW,YAAY,UAAU,OAAO,WACjE,WAAW,WAAW,YAAY,UAAU,OAAO;UAqB9C;;;;KCrOA,eACR,kBAAkB,wBAAwB,uBAC1C,iBAAiB,0BACjB,cAAc,0BACd,cAAc,yBAAuB,kBAAgB;EAErD,YAAY,gBAAgB,WAAW,OAAO,qBAAqB;EACnE,UAAU,YAAY,WAAW;EACjC,OAAO;EACP;EACA,SAAS;EACT,gBAAgB;;cAGP,WACT,kBAAkB,wBAAwB,uBAC1C,iBAAiB,0BACjB,cAAc,0BACd,cAAc,yBAAuB,kBAAgB,qBAAmB,QAEhE,eAAe,WAAW,UAAU,OAAO,WACpD,OACC,WACA,gBAAgB,WAAW,OAAO,qBAAqB,aACvD,UACA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeSubject, subscribe } from "wonka";
|
|
2
|
-
import hkdf from "@panva/hkdf";
|
|
2
|
+
import { hkdf } from "@panva/hkdf";
|
|
3
3
|
import { EncryptJWT, jwtDecrypt } from "jose";
|
|
4
4
|
import { noop } from "@pluv/crdt";
|
|
5
5
|
import colors from "kleur";
|
|
@@ -181,14 +181,14 @@ const authorize = (params) => {
|
|
|
181
181
|
const encode = async (encodeParams) => {
|
|
182
182
|
const { maxAge = DEFAULT_MAX_AGE_MS, room, user } = encodeParams;
|
|
183
183
|
const encryptionSecret = await getEncryptionKey(secret);
|
|
184
|
-
return
|
|
184
|
+
return await new EncryptJWT({
|
|
185
185
|
room,
|
|
186
186
|
sub: room ? `${room}|${user.id}` : user.id,
|
|
187
187
|
user
|
|
188
188
|
}).setProtectedHeader({
|
|
189
189
|
alg: "dir",
|
|
190
190
|
enc: "A256GCM"
|
|
191
|
-
}).setIssuedAt().setExpirationTime(now() + maxAge).setJti(platform.randomUUID()).encrypt(encryptionSecret)
|
|
191
|
+
}).setIssuedAt().setExpirationTime(now() + maxAge).setJti(platform.randomUUID()).encrypt(encryptionSecret);
|
|
192
192
|
};
|
|
193
193
|
const decode = async (jwt) => {
|
|
194
194
|
const encryptionSecret = await getEncryptionKey(secret);
|
|
@@ -346,7 +346,7 @@ var IORoom = class {
|
|
|
346
346
|
return Promise.resolve(!!this._uninitialize?.then((result) => !!result));
|
|
347
347
|
}
|
|
348
348
|
constructor(id, config) {
|
|
349
|
-
const { _meta, authorize, context, crdt = noop, debug, getInitialStorage, onRoomDestroyed, onStorageDestroyed, onMessage, onUserConnected, onUserDisconnected, platform, roomContext, router } = config;
|
|
349
|
+
const { _meta, authorize: authorizeConfig, context, crdt = noop, debug, getInitialStorage, onRoomDestroyed, onStorageDestroyed, onMessage, onUserConnected, onUserDisconnected, platform, roomContext, router } = config;
|
|
350
350
|
this.id = id;
|
|
351
351
|
this._context = context;
|
|
352
352
|
this._crdt = crdt;
|
|
@@ -366,7 +366,7 @@ var IORoom = class {
|
|
|
366
366
|
onUserConnected: (event) => onUserConnected?.(event),
|
|
367
367
|
onUserDisconnected: (event) => onUserDisconnected?.(event)
|
|
368
368
|
};
|
|
369
|
-
if (
|
|
369
|
+
if (authorizeConfig) this._authorize = authorizeConfig;
|
|
370
370
|
this._platform.getWebSockets().forEach((webSocket) => {
|
|
371
371
|
const deserialized = this._platform.getSerializedState(webSocket);
|
|
372
372
|
const sessionId = this._platform.getSessionId(webSocket);
|
|
@@ -406,8 +406,7 @@ var IORoom = class {
|
|
|
406
406
|
*/
|
|
407
407
|
async garbageCollect() {
|
|
408
408
|
this._lastGarbageCollectMs = Date.now();
|
|
409
|
-
this._emitQuitters();
|
|
410
|
-
this._emitSyncState();
|
|
409
|
+
await Promise.all([this._emitQuitters(), this._emitSyncState()]);
|
|
411
410
|
}
|
|
412
411
|
getSize() {
|
|
413
412
|
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -459,7 +458,7 @@ var IORoom = class {
|
|
|
459
458
|
const isUnauthorized = !!this._getIOAuthorize(_options) && !user;
|
|
460
459
|
const pluvWs = this._platform.convertWebSocket(webSocket, { room: this.id });
|
|
461
460
|
if (isUnauthorized) {
|
|
462
|
-
this._logDebug(
|
|
461
|
+
this._logDebug(colors.blue("Authorization failed for connection"));
|
|
463
462
|
pluvWs.handleError({
|
|
464
463
|
error: /* @__PURE__ */ new Error("Not authorized"),
|
|
465
464
|
room: this.id
|
|
@@ -509,7 +508,7 @@ var IORoom = class {
|
|
|
509
508
|
const { message, senderId } = params;
|
|
510
509
|
const user = ((senderId ? this._sessions.get(senderId) ?? null : null)?.session ?? null)?.user ?? null;
|
|
511
510
|
if (typeof senderId !== "string") return;
|
|
512
|
-
this._platform.pubSub.publish(this.id, {
|
|
511
|
+
await this._platform.pubSub.publish(this.id, {
|
|
513
512
|
connectionId: senderId ?? null,
|
|
514
513
|
room: this.id,
|
|
515
514
|
user,
|
|
@@ -565,7 +564,7 @@ var IORoom = class {
|
|
|
565
564
|
const quitters = Array.from(this._sessions.values()).filter((pluvWs) => {
|
|
566
565
|
return pluvWs.state.quit || currentTime - pluvWs.state.timers.ping > 3e4;
|
|
567
566
|
});
|
|
568
|
-
this._closeWebSockets(quitters);
|
|
567
|
+
await this._closeWebSockets(quitters);
|
|
569
568
|
}
|
|
570
569
|
async _emitRegistered(pluvWs) {
|
|
571
570
|
const session = pluvWs.session;
|
|
@@ -723,7 +722,7 @@ var IORoom = class {
|
|
|
723
722
|
}
|
|
724
723
|
_initialize() {
|
|
725
724
|
const promise = (async () => {
|
|
726
|
-
this._logDebug(
|
|
725
|
+
this._logDebug(colors.blue(`Initializing room: ${this.id}`));
|
|
727
726
|
if (!!this._uninitialize) {
|
|
728
727
|
await (await this._uninitialize).bind(this)();
|
|
729
728
|
this._uninitialize = null;
|
|
@@ -751,9 +750,9 @@ var IORoom = class {
|
|
|
751
750
|
this._wasDocEmptyOnInit = doc.isEmpty();
|
|
752
751
|
const uninitialize = async () => {
|
|
753
752
|
this._platform.pubSub.unsubscribe(pubSubId);
|
|
754
|
-
const [
|
|
755
|
-
const encodedState =
|
|
756
|
-
|
|
753
|
+
const [resolvedDoc, context] = await Promise.all([this._doc, this._getContext()]);
|
|
754
|
+
const encodedState = resolvedDoc.getEncodedState();
|
|
755
|
+
resolvedDoc.destroy();
|
|
757
756
|
this._doc = Promise.resolve(this._docFactory.getEmpty());
|
|
758
757
|
await Promise.resolve(this._listeners.onRoomDestroyed({
|
|
759
758
|
..."_meta" in this._platform && !!this._platform._meta ? { _meta: this._platform._meta } : {},
|
|
@@ -1002,6 +1001,13 @@ var IORoom = class {
|
|
|
1002
1001
|
if (typeof senderId !== "string") return;
|
|
1003
1002
|
const pluvWs = this._sessions.get(senderId);
|
|
1004
1003
|
if (!pluvWs) return;
|
|
1004
|
+
const user = pluvWs.session.user ?? null;
|
|
1005
|
+
await this._sendMessage(pluvWs, {
|
|
1006
|
+
connectionId: senderId,
|
|
1007
|
+
room: this.id,
|
|
1008
|
+
user,
|
|
1009
|
+
...message
|
|
1010
|
+
});
|
|
1005
1011
|
/**
|
|
1006
1012
|
* @description Note that this will not fire for Cloudflare's hibernatable websockets
|
|
1007
1013
|
* because the server will auto-respond with the $pong event without calling any
|
|
@@ -1009,15 +1015,13 @@ var IORoom = class {
|
|
|
1009
1015
|
* @date April 18, 2025
|
|
1010
1016
|
*/
|
|
1011
1017
|
if (message.type === "$pong") {
|
|
1018
|
+
/**
|
|
1019
|
+
* @description Garbage collection is awaited after responding, since it can close
|
|
1020
|
+
* websockets and flush persistence. Blocking the $pong response on it risks
|
|
1021
|
+
* exceeding the client's pong timeout and triggering a spurious reconnect.
|
|
1022
|
+
*/
|
|
1012
1023
|
if (Date.now() - this._lastGarbageCollectMs > 6e4) await this.garbageCollect();
|
|
1013
1024
|
}
|
|
1014
|
-
const user = pluvWs.session.user ?? null;
|
|
1015
|
-
this._sendMessage(pluvWs, {
|
|
1016
|
-
connectionId: senderId,
|
|
1017
|
-
room: this.id,
|
|
1018
|
-
user,
|
|
1019
|
-
...message
|
|
1020
|
-
});
|
|
1021
1025
|
}
|
|
1022
1026
|
async _sendSyncMessage(message, sender) {
|
|
1023
1027
|
if (!sender) return;
|
|
@@ -1048,25 +1052,24 @@ var IORoom = class {
|
|
|
1048
1052
|
} catch {
|
|
1049
1053
|
return;
|
|
1050
1054
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
});
|
|
1055
|
+
const output = await resolver(inputs, resolverCtx);
|
|
1056
|
+
if (!output) return;
|
|
1057
|
+
await Promise.all(Object.keys(output).map((type) => {
|
|
1058
|
+
const data = output[type] ?? {};
|
|
1059
|
+
return this._platform.pubSub.publish(this.id, {
|
|
1060
|
+
connectionId,
|
|
1061
|
+
data,
|
|
1062
|
+
options: { type: "self" },
|
|
1063
|
+
room: this.id,
|
|
1064
|
+
type,
|
|
1065
|
+
user: sender.user ?? null
|
|
1063
1066
|
});
|
|
1064
|
-
});
|
|
1067
|
+
}));
|
|
1065
1068
|
}
|
|
1066
1069
|
};
|
|
1067
1070
|
//#endregion
|
|
1068
1071
|
//#region src/version.generated.ts
|
|
1069
|
-
const version = "5.0.
|
|
1072
|
+
const version = "5.0.3";
|
|
1070
1073
|
//#endregion
|
|
1071
1074
|
//#region src/PluvServer.ts
|
|
1072
1075
|
var PluvServer = class {
|
|
@@ -1105,16 +1108,16 @@ var PluvServer = class {
|
|
|
1105
1108
|
if (wsSession.quit) return false;
|
|
1106
1109
|
if (currentTime - wsSession.timers.ping > 3e4) return false;
|
|
1107
1110
|
return true;
|
|
1108
|
-
}).reduce((acc, { id, presence, timers, user }) =>
|
|
1109
|
-
|
|
1110
|
-
[id]: {
|
|
1111
|
+
}).reduce((acc, { id, presence, timers, user }) => {
|
|
1112
|
+
acc[id] = {
|
|
1111
1113
|
connectionId: id,
|
|
1112
1114
|
presence,
|
|
1113
1115
|
room,
|
|
1114
1116
|
timers: { presence: timers.presence },
|
|
1115
1117
|
user
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
+
};
|
|
1119
|
+
return acc;
|
|
1120
|
+
}, {}) } };
|
|
1118
1121
|
}),
|
|
1119
1122
|
$initializeSession: this._procedure.broadcast((data, { session }) => {
|
|
1120
1123
|
const presence = data?.presence;
|
|
@@ -1332,7 +1335,7 @@ var PluvIO = class {
|
|
|
1332
1335
|
return new PluvProcedure();
|
|
1333
1336
|
}
|
|
1334
1337
|
constructor(options) {
|
|
1335
|
-
const { authorize, context, crdt = noop, debug = false, limits, platform } = options;
|
|
1338
|
+
const { authorize: authorizeConfig, context, crdt = noop, debug = false, limits, platform } = options;
|
|
1336
1339
|
this._crdt = crdt;
|
|
1337
1340
|
this._debug = debug;
|
|
1338
1341
|
this._limits = {
|
|
@@ -1343,7 +1346,7 @@ var PluvIO = class {
|
|
|
1343
1346
|
...limits
|
|
1344
1347
|
};
|
|
1345
1348
|
this._platform = platform;
|
|
1346
|
-
if (
|
|
1349
|
+
if (authorizeConfig) this._authorize = authorizeConfig;
|
|
1347
1350
|
if (context) this._context = context;
|
|
1348
1351
|
}
|
|
1349
1352
|
async createToken(params) {
|