@pluv/io 0.30.2 → 0.32.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 +132 -0
- package/dist/index.d.mts +53 -49
- package/dist/index.d.ts +53 -49
- package/dist/index.js +24 -21
- package/dist/index.mjs +24 -21
- package/package.json +5 -5
- package/src/AbstractPlatform.ts +9 -15
- package/src/IORoom.ts +36 -29
- package/src/PluvIO.ts +11 -11
- package/src/PluvProcedure.ts +13 -43
- package/src/PluvRouter.ts +8 -8
- package/src/PluvServer.ts +16 -17
- package/src/authorize.ts +2 -2
- package/src/createIO.ts +9 -13
- package/src/index.ts +1 -1
- package/src/types.ts +15 -10
- package/src/version.generated.ts +1 -1
package/src/types.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
} from "@pluv/types";
|
|
14
14
|
import type {
|
|
15
15
|
AbstractPlatform,
|
|
16
|
+
InferInitContextType,
|
|
16
17
|
InferPlatformWebSocketSource,
|
|
17
18
|
InferPlatformWebSocketType,
|
|
18
19
|
InferRoomContextType,
|
|
@@ -26,6 +27,10 @@ declare global {
|
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
export type PluvContext<TPlatform extends AbstractPlatform, TContext extends Record<string, any>> =
|
|
31
|
+
| TContext
|
|
32
|
+
| ((params: InferRoomContextType<TPlatform>) => TContext);
|
|
33
|
+
|
|
29
34
|
export interface CrdtLibraryType {
|
|
30
35
|
doc: (value: any) => AbstractCrdtDocFactory<any>;
|
|
31
36
|
kind: "loro" | "yjs";
|
|
@@ -33,7 +38,7 @@ export interface CrdtLibraryType {
|
|
|
33
38
|
|
|
34
39
|
export type EventResolver<
|
|
35
40
|
TPlatform extends AbstractPlatform = AbstractPlatform,
|
|
36
|
-
TAuthorize extends IOAuthorize<any, any,
|
|
41
|
+
TAuthorize extends IOAuthorize<any, any, InferInitContextType<TPlatform>> = BaseIOAuthorize,
|
|
37
42
|
TContext extends Record<string, any> = {},
|
|
38
43
|
TInput extends JsonObject = {},
|
|
39
44
|
TOutput extends EventRecord<string, any> = {},
|
|
@@ -41,7 +46,7 @@ export type EventResolver<
|
|
|
41
46
|
|
|
42
47
|
export interface EventResolverContext<
|
|
43
48
|
TPlatform extends AbstractPlatform = AbstractPlatform,
|
|
44
|
-
TAuthorize extends IOAuthorize<any, any,
|
|
49
|
+
TAuthorize extends IOAuthorize<any, any, InferInitContextType<TPlatform>> = BaseIOAuthorize,
|
|
45
50
|
TContext extends Record<string, any> = {},
|
|
46
51
|
> {
|
|
47
52
|
context: TContext;
|
|
@@ -103,7 +108,7 @@ export type MergeEventRecords<
|
|
|
103
108
|
|
|
104
109
|
type GetInitialStorageEvent<TPlatform extends AbstractPlatform> = {
|
|
105
110
|
room: string;
|
|
106
|
-
}
|
|
111
|
+
};
|
|
107
112
|
|
|
108
113
|
export type GetInitialStorageFn<TPlatform extends AbstractPlatform> = (
|
|
109
114
|
event: GetInitialStorageEvent<TPlatform>,
|
|
@@ -111,8 +116,8 @@ export type GetInitialStorageFn<TPlatform extends AbstractPlatform> = (
|
|
|
111
116
|
|
|
112
117
|
export interface PluvIOListeners<
|
|
113
118
|
TPlatform extends AbstractPlatform<any>,
|
|
114
|
-
TAuthorize extends IOAuthorize<any, any,
|
|
115
|
-
TContext extends
|
|
119
|
+
TAuthorize extends IOAuthorize<any, any, InferInitContextType<TPlatform>>,
|
|
120
|
+
TContext extends Record<string, any>,
|
|
116
121
|
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>,
|
|
117
122
|
> {
|
|
118
123
|
onRoomDeleted: (event: IORoomListenerEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
|
|
@@ -122,19 +127,19 @@ export interface PluvIOListeners<
|
|
|
122
127
|
|
|
123
128
|
export type IORoomListenerEvent<
|
|
124
129
|
TPlatform extends AbstractPlatform<any>,
|
|
125
|
-
TAuthorize extends IOAuthorize<any, any,
|
|
126
|
-
TContext extends
|
|
130
|
+
TAuthorize extends IOAuthorize<any, any, InferInitContextType<TPlatform>>,
|
|
131
|
+
TContext extends Record<string, any>,
|
|
127
132
|
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>,
|
|
128
133
|
> = {
|
|
129
|
-
context: TContext
|
|
134
|
+
context: TContext;
|
|
130
135
|
encodedState: string | null;
|
|
131
136
|
room: string;
|
|
132
137
|
};
|
|
133
138
|
|
|
134
139
|
export type IORoomMessageEvent<
|
|
135
140
|
TPlatform extends AbstractPlatform<any>,
|
|
136
|
-
TAuthorize extends IOAuthorize<any, any,
|
|
137
|
-
TContext extends
|
|
141
|
+
TAuthorize extends IOAuthorize<any, any, InferInitContextType<TPlatform>>,
|
|
142
|
+
TContext extends Record<string, any>,
|
|
138
143
|
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>,
|
|
139
144
|
> = IORoomListenerEvent<TPlatform, TAuthorize, TContext, TEvents> & {
|
|
140
145
|
message: InferEventMessage<InferEventsOutput<TEvents>, keyof InferEventsOutput<TEvents>>;
|
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.32.0'
|