@emeryld/rrroutes-client 2.8.8 → 2.8.9
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/dist/index.cjs +0 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +0 -9
- package/dist/index.mjs.map +1 -1
- package/dist/sockets/socket.client.context.connection.d.ts +2 -2
- package/dist/sockets/socket.client.context.provider.d.ts +2 -2
- package/dist/sockets/socket.client.core.d.ts +3 -3
- package/dist/sockets/socket.client.sys.d.ts +2 -2
- package/dist/sockets/socketedRoute/socket.client.helper.rooms.d.ts +7 -3
- package/package.json +2 -2
|
@@ -30,8 +30,8 @@ export type UseSocketConnectionDebugOptions = {
|
|
|
30
30
|
};
|
|
31
31
|
export type UseSocketRoomsArgs<C extends SocketConnectionConfigOutput> = {
|
|
32
32
|
rooms?: Rooms;
|
|
33
|
-
joinMeta
|
|
34
|
-
leaveMeta
|
|
33
|
+
joinMeta?: SocketSchemaOutput<C['joinMetaMessage']>;
|
|
34
|
+
leaveMeta?: SocketSchemaOutput<C['leaveMetaMessage']>;
|
|
35
35
|
autoJoin?: boolean;
|
|
36
36
|
autoLeave?: boolean;
|
|
37
37
|
enabled?: boolean;
|
|
@@ -34,8 +34,8 @@ export declare function buildSocketProvider<T extends EventMap, C extends Socket
|
|
|
34
34
|
}): {
|
|
35
35
|
SocketProvider: (props: React.PropsWithChildren<ProviderRuntimeSocket & {
|
|
36
36
|
fallback?: React.ReactNode;
|
|
37
|
-
destroyLeaveMeta
|
|
38
|
-
}>) =>
|
|
37
|
+
destroyLeaveMeta?: SocketSchemaOutput<C["leaveMetaMessage"]>;
|
|
38
|
+
}>) => React.JSX.Element;
|
|
39
39
|
useSocketClient: () => SocketClient<T, C> | null;
|
|
40
40
|
useSocketRooms: (p: UseSocketRoomsArgs<C>) => void;
|
|
41
41
|
useSocketEvent: <K extends keyof T & string>(p: UseSocketEventArgs<T, K, C>) => void;
|
|
@@ -113,8 +113,8 @@ export declare class SocketClient<T extends EventMap, C extends SocketConnection
|
|
|
113
113
|
*/
|
|
114
114
|
stopHeartbeat(reason?: string): void;
|
|
115
115
|
emit<K extends keyof T & string>(event: K, payload: Payload<T, K>, metadata?: Record<string, unknown>): void;
|
|
116
|
-
joinRooms(rooms: string[] | string, meta
|
|
117
|
-
leaveRooms(rooms: string[] | string, meta
|
|
116
|
+
joinRooms(rooms: string[] | string, meta?: SocketSchemaOutput<C['joinMetaMessage']>): Promise<() => Promise<void>>;
|
|
117
|
+
leaveRooms(rooms: string[] | string, meta?: SocketSchemaOutput<C['leaveMetaMessage']>): Promise<void>;
|
|
118
118
|
on<K extends keyof T & string>(event: K, handler: (payload: T[K]['__out'], meta?: {
|
|
119
119
|
envelope: ServerEnvelope<T[K]['__out']>;
|
|
120
120
|
ctx: ClientCtx;
|
|
@@ -123,7 +123,7 @@ export declare class SocketClient<T extends EventMap, C extends SocketConnection
|
|
|
123
123
|
* Remove all listeners, stop timers, and leave rooms.
|
|
124
124
|
* Call when disposing the client instance.
|
|
125
125
|
*/
|
|
126
|
-
destroy(leaveMeta
|
|
126
|
+
destroy(leaveMeta?: SocketSchemaOutput<C['leaveMetaMessage']>): Promise<void>;
|
|
127
127
|
/** Pass-throughs. Managing connection is the caller’s responsibility. */
|
|
128
128
|
disconnect(): void;
|
|
129
129
|
connect(): void;
|
|
@@ -43,14 +43,14 @@ export type SysEventMap<T extends EventMap, C extends SocketConnectionConfigOutp
|
|
|
43
43
|
socket: Socket;
|
|
44
44
|
client: SocketClient<T, C>;
|
|
45
45
|
rooms: string | string[];
|
|
46
|
-
meta
|
|
46
|
+
meta?: SocketSchemaOutput<C['joinMetaMessage']>;
|
|
47
47
|
}) => Promise<boolean> | boolean;
|
|
48
48
|
/** Room leave event, triggered when the client attempts to leave one or more rooms. Return true to allow the leave, or false to deny it. */
|
|
49
49
|
'sys:room_leave': (args: {
|
|
50
50
|
socket: Socket;
|
|
51
51
|
client: SocketClient<T, C>;
|
|
52
52
|
rooms: string | string[];
|
|
53
|
-
meta
|
|
53
|
+
meta?: SocketSchemaOutput<C['leaveMetaMessage']>;
|
|
54
54
|
}) => Promise<boolean> | boolean;
|
|
55
55
|
};
|
|
56
56
|
declare const roomValueSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>;
|
|
@@ -6,11 +6,14 @@ export type RoomState<C extends SocketConnectionConfigOutput> = {
|
|
|
6
6
|
joinMeta?: SocketSchemaOutput<C['joinMetaMessage']>;
|
|
7
7
|
leaveMeta?: SocketSchemaOutput<C['leaveMetaMessage']>;
|
|
8
8
|
};
|
|
9
|
+
type MetaField<K extends string, V> = undefined extends V ? {
|
|
10
|
+
[P in K]?: V;
|
|
11
|
+
} : {
|
|
12
|
+
[P in K]: V;
|
|
13
|
+
};
|
|
9
14
|
export type ToRoomsResult<C extends SocketConnectionConfigOutput> = {
|
|
10
15
|
rooms: RoomsInput;
|
|
11
|
-
|
|
12
|
-
leaveMeta: SocketSchemaOutput<C['leaveMetaMessage']>;
|
|
13
|
-
};
|
|
16
|
+
} & MetaField<'joinMeta', SocketSchemaOutput<C['joinMetaMessage']>> & MetaField<'leaveMeta', SocketSchemaOutput<C['leaveMetaMessage']>>;
|
|
14
17
|
export type ToRoomsMeta<AppContext = undefined> = {
|
|
15
18
|
appContext?: AppContext;
|
|
16
19
|
};
|
|
@@ -22,3 +25,4 @@ export type ToRoomsMapper<L extends AnyLeafLowProfile, C extends SocketConnectio
|
|
|
22
25
|
export declare function roomStateEqual<C extends SocketConnectionConfigOutput>(prev: RoomState<C>, next: RoomState<C>): boolean;
|
|
23
26
|
export declare function mergeRoomState<L extends AnyLeafLowProfile, C extends SocketConnectionConfigOutput>(prev: RoomState<C>, toRoomsResult: ToRoomsResult<C>): RoomState<C>;
|
|
24
27
|
export declare function roomsFromData<L extends AnyLeafLowProfile, C extends SocketConnectionConfigOutput, AppContext = undefined>(data: DataShape<L> | undefined, args: ArgsFor<L> | undefined, toRooms: ToRoomsMapper<L, C, AppContext>, meta?: ToRoomsMeta<AppContext>): RoomState<C>;
|
|
28
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emeryld/rrroutes-client",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@jest/globals": "^30.4.1",
|
|
33
|
-
"@types/react": "^18.3.
|
|
33
|
+
"@types/react": "^18.3.30",
|
|
34
34
|
"@types/react-native": "^0.73.0"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|