@emeryld/rrroutes-client 2.7.9 → 2.7.11

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.
@@ -1,5 +1,5 @@
1
1
  import type { EventMap, SocketConnectionConfigOutput } from '@emeryld/rrroutes-contract';
2
2
  import * as React from 'react';
3
3
  import { SocketClient } from './socket.client.core';
4
- export declare const SocketCtx: React.Context<SocketClient<any, SocketConnectionConfigOutput> | null>;
4
+ export declare const SocketCtx: React.Context<SocketClient<any, SocketConnectionConfigOutput> | null | undefined>;
5
5
  export declare function useSocketClient<T extends EventMap, C extends SocketConnectionConfigOutput>(): SocketClient<T, C> | null;
@@ -1,6 +1,33 @@
1
1
  import type { EventMap, Payload, SocketConnectionConfigOutput, SocketSchemaOutput } from '@emeryld/rrroutes-contract';
2
2
  import type { ClientCtx, ServerEnvelope } from './socket.client.core';
3
3
  type Rooms = string[] | string | undefined;
4
+ export type UseSocketConnectionDebugEvent = {
5
+ type: 'lifecycle';
6
+ phase: 'effect_start' | 'effect_cleanup' | 'client_missing';
7
+ event: string;
8
+ rooms: string[];
9
+ autoJoin: boolean;
10
+ autoLeave: boolean;
11
+ } | {
12
+ type: 'subscription';
13
+ phase: 'register' | 'unregister' | 'message';
14
+ event: string;
15
+ } | {
16
+ type: 'room';
17
+ phase: 'join_attempt' | 'join_ok' | 'join_error' | 'leave_attempt' | 'leave_ok' | 'leave_error' | 'join_skip' | 'leave_skip';
18
+ rooms: string[];
19
+ reason?: 'no_rooms' | 'auto_disabled';
20
+ err?: string;
21
+ };
22
+ export type UseSocketConnectionDebugOptions = {
23
+ enabled?: boolean;
24
+ logger?: (event: UseSocketConnectionDebugEvent) => void;
25
+ lifecycle?: boolean;
26
+ subscription?: boolean;
27
+ room?: boolean;
28
+ warnIfClientMissing?: boolean;
29
+ throwIfClientMissing?: boolean;
30
+ };
4
31
  export type UseSocketConnectionArgs<T extends EventMap, K extends keyof T & string, C extends SocketConnectionConfigOutput> = {
5
32
  event: K;
6
33
  rooms?: Rooms;
@@ -11,6 +38,7 @@ export type UseSocketConnectionArgs<T extends EventMap, K extends keyof T & stri
11
38
  onCleanup?: () => void;
12
39
  autoJoin?: boolean;
13
40
  autoLeave?: boolean;
41
+ debug?: UseSocketConnectionDebugOptions;
14
42
  joinMeta: SocketSchemaOutput<C['joinMetaMessage']>;
15
43
  leaveMeta: SocketSchemaOutput<C['leaveMetaMessage']>;
16
44
  };
@@ -1,4 +1,4 @@
1
1
  export { buildSocketProvider } from './socket.client.context.provider';
2
2
  export { useSocketClient } from './socket.client.context.client';
3
- export { useSocketConnection, type UseSocketConnectionArgs, } from './socket.client.context.connection';
3
+ export { useSocketConnection, type UseSocketConnectionDebugEvent, type UseSocketConnectionDebugOptions, type UseSocketConnectionArgs, } from './socket.client.context.connection';
4
4
  export type { SocketProviderDebugEvent, SocketProviderDebugOptions, } from './socket.client.context.debug';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/rrroutes-client",
3
- "version": "2.7.9",
3
+ "version": "2.7.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",