@emeryld/rrroutes-client 2.2.4 → 2.2.6
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 +210 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +211 -23
- package/dist/index.mjs.map +1 -1
- package/dist/sockets/socketedRoute/socket.client.helper.d.ts +67 -0
- package/package.json +1 -1
|
@@ -6,6 +6,72 @@ type GetLeaf = AnyLeaf & {
|
|
|
6
6
|
method: 'get';
|
|
7
7
|
};
|
|
8
8
|
type PageOf<L extends GetLeaf> = InferOutput<L>;
|
|
9
|
+
type SocketedRouteDebugEventBase = {
|
|
10
|
+
name?: string;
|
|
11
|
+
};
|
|
12
|
+
export type SocketedRouteDebugEvent<Ev extends string = string> = (SocketedRouteDebugEventBase & {
|
|
13
|
+
type: 'build';
|
|
14
|
+
routeKey: string;
|
|
15
|
+
socketEvent: Ev;
|
|
16
|
+
options?: unknown;
|
|
17
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
18
|
+
type: 'subscribe';
|
|
19
|
+
phase: 'start' | 'stop';
|
|
20
|
+
routeKey: string;
|
|
21
|
+
socketEvent: Ev;
|
|
22
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
23
|
+
type: 'receive';
|
|
24
|
+
routeKey: string;
|
|
25
|
+
socketEvent: Ev;
|
|
26
|
+
payload?: unknown;
|
|
27
|
+
envelope?: {
|
|
28
|
+
eventName: Ev;
|
|
29
|
+
sentAt?: string | Date;
|
|
30
|
+
sentTo?: string[];
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
32
|
+
};
|
|
33
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
34
|
+
type: 'onReceive';
|
|
35
|
+
routeKey: string;
|
|
36
|
+
socketEvent: Ev;
|
|
37
|
+
page?: unknown;
|
|
38
|
+
rooms?: string[];
|
|
39
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
40
|
+
type: 'rooms';
|
|
41
|
+
phase: 'derive' | 'join' | 'leave';
|
|
42
|
+
routeKey: string;
|
|
43
|
+
socketEvent: Ev;
|
|
44
|
+
rooms: string[];
|
|
45
|
+
prev?: string[];
|
|
46
|
+
meta?: unknown;
|
|
47
|
+
reason?: string;
|
|
48
|
+
source?: 'hydrate' | 'onReceive';
|
|
49
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
50
|
+
type: 'setData';
|
|
51
|
+
routeKey: string;
|
|
52
|
+
socketEvent: Ev;
|
|
53
|
+
args?: unknown;
|
|
54
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
55
|
+
type: 'render';
|
|
56
|
+
render: number;
|
|
57
|
+
routeKey: string;
|
|
58
|
+
socketEvent: Ev;
|
|
59
|
+
changed?: string[];
|
|
60
|
+
rooms?: string[];
|
|
61
|
+
}) | (SocketedRouteDebugEventBase & {
|
|
62
|
+
type: 'effect';
|
|
63
|
+
effect: 'rooms' | 'subscribe';
|
|
64
|
+
phase: 'run' | 'cleanup';
|
|
65
|
+
changedDeps?: string[];
|
|
66
|
+
rooms?: string[];
|
|
67
|
+
});
|
|
68
|
+
export type SocketedRouteDebugOptions<Ev extends string = string> = {
|
|
69
|
+
verbose?: boolean;
|
|
70
|
+
only?: string[];
|
|
71
|
+
logger?: (e: SocketedRouteDebugEvent<Ev>) => void;
|
|
72
|
+
} & {
|
|
73
|
+
[P in SocketedRouteDebugEvent['type']]?: boolean;
|
|
74
|
+
};
|
|
9
75
|
type SocketedHandlers<L extends GetLeaf, E extends ContractEventMap, K extends keyof E & string, C extends SocketConnectionConfigOutput> = {
|
|
10
76
|
/**
|
|
11
77
|
* Derive the full set of rooms to join based on a newly received payload plus
|
|
@@ -34,6 +100,7 @@ export type SocketedRouteHook<Routes extends Record<PropertyKey, GetLeaf>, Names
|
|
|
34
100
|
handlers: SocketedHandlers<Routes[K], Events, Ev, C>;
|
|
35
101
|
buildOptions?: BuildOptionsFor<Routes[K]>;
|
|
36
102
|
buildMeta?: BuildMeta<Names>;
|
|
103
|
+
debug?: SocketedRouteDebugOptions<Ev>;
|
|
37
104
|
useOptions?: {
|
|
38
105
|
args?: ArgsFor<Routes[K]>;
|
|
39
106
|
options?: OptionsForGet<Routes[K]>;
|