dreaction-client-core 1.0.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/lib/client-options.d.ts +77 -0
- package/lib/client-options.d.ts.map +1 -0
- package/lib/client-options.js +2 -0
- package/lib/index.d.ts +190 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +401 -0
- package/lib/plugins/api-response.d.ts +13 -0
- package/lib/plugins/api-response.d.ts.map +1 -0
- package/lib/plugins/api-response.js +23 -0
- package/lib/plugins/benchmark.d.ts +15 -0
- package/lib/plugins/benchmark.d.ts.map +1 -0
- package/lib/plugins/benchmark.js +31 -0
- package/lib/plugins/clear.d.ts +11 -0
- package/lib/plugins/clear.d.ts.map +1 -0
- package/lib/plugins/clear.js +13 -0
- package/lib/plugins/image.d.ts +19 -0
- package/lib/plugins/image.d.ts.map +1 -0
- package/lib/plugins/image.js +24 -0
- package/lib/plugins/logger.d.ts +18 -0
- package/lib/plugins/logger.d.ts.map +1 -0
- package/lib/plugins/logger.js +44 -0
- package/lib/plugins/repl.d.ts +10 -0
- package/lib/plugins/repl.d.ts.map +1 -0
- package/lib/plugins/repl.js +55 -0
- package/lib/plugins/state-responses.d.ts +20 -0
- package/lib/plugins/state-responses.d.ts.map +1 -0
- package/lib/plugins/state-responses.js +38 -0
- package/lib/reactotron-core-client.d.ts +191 -0
- package/lib/reactotron-core-client.d.ts.map +1 -0
- package/lib/reactotron-core-client.js +400 -0
- package/lib/serialize.d.ts +20 -0
- package/lib/serialize.d.ts.map +1 -0
- package/lib/serialize.js +112 -0
- package/lib/stopwatch.d.ts +6 -0
- package/lib/stopwatch.d.ts.map +1 -0
- package/lib/stopwatch.js +45 -0
- package/lib/validate.d.ts +9 -0
- package/lib/validate.d.ts.map +1 -0
- package/lib/validate.js +26 -0
- package/package.json +29 -0
- package/src/client-options.ts +95 -0
- package/src/index.ts +654 -0
- package/src/plugins/api-response.ts +32 -0
- package/src/plugins/benchmark.ts +35 -0
- package/src/plugins/clear.ts +14 -0
- package/src/plugins/image.ts +34 -0
- package/src/plugins/logger.ts +59 -0
- package/src/plugins/repl.ts +63 -0
- package/src/plugins/state-responses.ts +75 -0
- package/src/serialize.ts +125 -0
- package/src/stopwatch.ts +50 -0
- package/src/validate.ts +38 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { LifeCycleMethods, PluginCreator } from './';
|
|
2
|
+
import NodeWebSocket from 'ws';
|
|
3
|
+
|
|
4
|
+
type BrowserWebSocket = WebSocket;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for the Reactotron Client.
|
|
8
|
+
*/
|
|
9
|
+
export interface ClientOptions<Client>
|
|
10
|
+
extends Omit<LifeCycleMethods, 'onCommand'> {
|
|
11
|
+
/**
|
|
12
|
+
* A function which returns a websocket.
|
|
13
|
+
*
|
|
14
|
+
* This is over-engineered because we need the ability to create different
|
|
15
|
+
* types of websockets for React Native, React, and NodeJS. :|
|
|
16
|
+
*/
|
|
17
|
+
createSocket?:
|
|
18
|
+
| ((path: string) => BrowserWebSocket)
|
|
19
|
+
| ((path: string) => NodeWebSocket)
|
|
20
|
+
| null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The hostname or ip address of the server. Default: localhost.
|
|
24
|
+
*/
|
|
25
|
+
host?: string | null;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The port to connect to the server on. Default: 9090.
|
|
29
|
+
*/
|
|
30
|
+
port?: number | null;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The name of this client. Usually the app name.
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Will we be connecting via SSL?
|
|
39
|
+
*/
|
|
40
|
+
secure?: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A list of plugins.
|
|
44
|
+
*/
|
|
45
|
+
plugins?: PluginCreator<Client>[];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Performs safety checks when serializing. Default: true.
|
|
49
|
+
*
|
|
50
|
+
* Will do things like:
|
|
51
|
+
* - remap falsy values to transport-friendly version
|
|
52
|
+
* - remove any circular dependencies
|
|
53
|
+
* - remap functions to something that shows their name
|
|
54
|
+
*
|
|
55
|
+
* Hooray for JavaScript!
|
|
56
|
+
*/
|
|
57
|
+
safeRecursion?: boolean;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Fires when the server sends a command.
|
|
61
|
+
*/
|
|
62
|
+
onCommand?: ((command: any) => void) | null;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Fires when we connect to the server.
|
|
66
|
+
*/
|
|
67
|
+
onConnect?: () => void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Fires when we disconnect from the server.
|
|
71
|
+
*/
|
|
72
|
+
onDisconnect?: () => void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The NODE_ENV environment, if any.
|
|
76
|
+
*/
|
|
77
|
+
environment?: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A way for the client libraries to identify themselves.
|
|
81
|
+
*/
|
|
82
|
+
client?: Record<string, string | number | boolean>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Save the client id provided by the server
|
|
86
|
+
*/
|
|
87
|
+
setClientId?: (clientId: string) => Promise<void>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get the client id provided by the server
|
|
91
|
+
*/
|
|
92
|
+
getClientId?: (name: string) => Promise<string>;
|
|
93
|
+
|
|
94
|
+
proxyHack?: boolean;
|
|
95
|
+
}
|