@emeryld/rrroutes-client 2.6.0 → 2.6.1

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.
@@ -2,6 +2,42 @@ import type { AnyLeafLowProfile, EventMap, InferOutput, Payload, SocketConnectio
2
2
  import type { BuiltInfinite, BuiltQuery, DataShape, InfiniteUseEndpointResultFor, QueryUseEndpointResultFor, UseEndpointArgs } from '../../routesV3.client.types';
3
3
  import type { ClientCtx, ServerEnvelope, SocketClient } from '../socket.client.index';
4
4
  type RoomsInput = string | string[] | undefined | null;
5
+ type HookDebugReason = 'init' | 'change';
6
+ type HookDebugValue = string | number | boolean | null | undefined;
7
+ export type SocketedRouteDebugEvent = {
8
+ type: 'client';
9
+ phase: 'ready' | 'missing';
10
+ err?: string;
11
+ } | {
12
+ type: 'render';
13
+ renderCount: number;
14
+ hasClient: boolean;
15
+ argsKey: string;
16
+ rooms: string[];
17
+ roomsKey: string;
18
+ joinMetaKey: string;
19
+ leaveMetaKey: string;
20
+ } | {
21
+ type: 'hook';
22
+ phase: 'endpoint_on_receive_effect' | 'derive_rooms_effect' | 'join_rooms_effect' | 'apply_socket_effect';
23
+ reason: HookDebugReason;
24
+ changes: Array<{
25
+ dependency: string;
26
+ previous: HookDebugValue;
27
+ next: HookDebugValue;
28
+ }>;
29
+ } | {
30
+ type: 'room';
31
+ phase: 'join_attempt' | 'join_skip' | 'join_error' | 'leave_attempt' | 'leave_skip' | 'leave_error';
32
+ rooms: string[];
33
+ reason?: string;
34
+ err?: string;
35
+ };
36
+ export type SocketedRouteDebugOptions = {
37
+ logger?: (event: SocketedRouteDebugEvent) => void;
38
+ } & {
39
+ [P in SocketedRouteDebugEvent['type']]?: boolean;
40
+ };
5
41
  type SocketedBuilt<L extends AnyLeafLowProfile> = L['cfg']['feed'] extends true ? BuiltInfinite<L> : BuiltQuery<L>;
6
42
  type SocketedRouteResult<L extends AnyLeafLowProfile> = (L['cfg']['feed'] extends true ? InfiniteUseEndpointResultFor<L> : QueryUseEndpointResultFor<L>) & {
7
43
  rooms: string[];
@@ -20,6 +56,7 @@ export type SocketedRouteOptions<L extends AnyLeafLowProfile, Events extends Eve
20
56
  }) => DataShape<L> | undefined;
21
57
  };
22
58
  useSocketClient: () => SocketClient<Events, C>;
59
+ debug?: SocketedRouteDebugOptions;
23
60
  };
24
61
  /**
25
62
  * Compose a GET endpoint with socket wiring:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/rrroutes-client",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",