@pluv/io 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +196 -0
- package/dist/index.d.mts +101 -101
- package/dist/index.d.ts +101 -101
- package/dist/index.js +217 -202
- package/dist/index.mjs +217 -202
- package/package.json +5 -5
- package/src/AbstractPlatform.ts +5 -5
- package/src/IORoom.ts +182 -115
- package/src/PluvIO.ts +16 -185
- package/src/PluvRouter.ts +1 -3
- package/src/PluvServer.ts +194 -76
- package/src/createIO.ts +3 -7
- package/src/index.ts +1 -1
- package/src/types.ts +31 -6
- package/src/version.generated.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -33,5 +33,5 @@ export type { PluvProcedureConfig } from "./PluvProcedure";
|
|
|
33
33
|
export { PluvRouter } from "./PluvRouter";
|
|
34
34
|
export type { MergedRouter, PluvRouterEventConfig } from "./PluvRouter";
|
|
35
35
|
export { PluvServer } from "./PluvServer";
|
|
36
|
-
export type {
|
|
36
|
+
export type { CreateRoomOptions, InferIORoom, PluvServerConfig } from "./PluvServer";
|
|
37
37
|
export type { WebSocketSerializedState, WebSocketSession } from "./types";
|
package/src/types.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type {
|
|
|
4
4
|
EventRecord,
|
|
5
5
|
IOAuthorize,
|
|
6
6
|
Id,
|
|
7
|
+
InferEventMessage,
|
|
8
|
+
InferEventsOutput,
|
|
7
9
|
InferIOAuthorizeUser,
|
|
8
10
|
JsonObject,
|
|
9
11
|
Maybe,
|
|
@@ -16,6 +18,7 @@ import type {
|
|
|
16
18
|
InferRoomContextType,
|
|
17
19
|
} from "./AbstractPlatform";
|
|
18
20
|
import type { AbstractWebSocket } from "./AbstractWebSocket";
|
|
21
|
+
import type { PluvRouterEventConfig } from "./PluvRouter";
|
|
19
22
|
|
|
20
23
|
declare global {
|
|
21
24
|
var console: {
|
|
@@ -101,15 +104,37 @@ export type GetInitialStorageFn<TPlatform extends AbstractPlatform> = (
|
|
|
101
104
|
event: GetInitialStorageEvent<TPlatform>,
|
|
102
105
|
) => MaybePromise<Maybe<string>>;
|
|
103
106
|
|
|
104
|
-
export interface PluvIOListeners<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
export interface PluvIOListeners<
|
|
108
|
+
TPlatform extends AbstractPlatform<any>,
|
|
109
|
+
TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>>,
|
|
110
|
+
TContext extends JsonObject,
|
|
111
|
+
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>,
|
|
112
|
+
> {
|
|
113
|
+
onRoomDeleted: (event: IORoomListenerEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
|
|
114
|
+
onRoomMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
|
|
115
|
+
onStorageUpdated: (event: IORoomListenerEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
|
|
107
116
|
}
|
|
108
117
|
|
|
109
|
-
export type IORoomListenerEvent<
|
|
110
|
-
|
|
118
|
+
export type IORoomListenerEvent<
|
|
119
|
+
TPlatform extends AbstractPlatform<any>,
|
|
120
|
+
TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>>,
|
|
121
|
+
TContext extends JsonObject,
|
|
122
|
+
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>,
|
|
123
|
+
> = {
|
|
124
|
+
context: TContext & InferRoomContextType<TPlatform>;
|
|
111
125
|
encodedState: string | null;
|
|
112
|
-
|
|
126
|
+
room: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type IORoomMessageEvent<
|
|
130
|
+
TPlatform extends AbstractPlatform<any>,
|
|
131
|
+
TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>>,
|
|
132
|
+
TContext extends JsonObject,
|
|
133
|
+
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>,
|
|
134
|
+
> = IORoomListenerEvent<TPlatform, TAuthorize, TContext, TEvents> & {
|
|
135
|
+
message: InferEventMessage<InferEventsOutput<TEvents>, keyof InferEventsOutput<TEvents>>;
|
|
136
|
+
user?: InferIOAuthorizeUser<TAuthorize>;
|
|
137
|
+
};
|
|
113
138
|
|
|
114
139
|
export type WebSocketType<TPlatform extends AbstractPlatform> =
|
|
115
140
|
| InferPlatformWebSocketType<TPlatform>
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.
|
|
2
|
+
export const version = '0.24.0'
|