1
+ import { AsyncStorageStatic } from '@react-native-async-storage/async-storage' ;
2
+
1
3
declare module '@meteorrn/core' {
2
4
type Callback = ( ...args : unknown [ ] ) => void ;
3
5
4
- function connect ( endpoint : string , options ?: any ) : void ;
5
- function disconnect ( ) : void ;
6
- function reconnect ( ) : void ;
7
6
type Status =
8
7
| 'change'
9
8
| 'connected'
10
9
| 'disconnected'
11
10
| 'loggingIn'
12
11
| 'loggingOut' ;
13
12
14
- function call ( ...args : any [ ] ) : void ;
15
- function status ( ) : {
16
- connected : boolean ;
17
- status : Status ;
18
- } ;
19
-
20
- function logout ( cb : Callback ) : void ;
21
- function loggingOut ( ) : boolean ;
22
- function loggingIn ( ) : boolean ;
13
+ type useTracker < T > = ( cb : ( ) => T ) => T ;
23
14
24
15
interface Data {
25
16
getUrl ( ) : string ;
@@ -35,7 +26,12 @@ declare module '@meteorrn/core' {
35
26
socket : unknown ;
36
27
} ;
37
28
}
38
- function getData ( ) : Data ;
29
+
30
+ interface MeteorError {
31
+ error : string ;
32
+ reason ?: string ;
33
+ details ?: string ;
34
+ }
39
35
40
36
interface User {
41
37
_id : string ;
@@ -45,15 +41,53 @@ declare module '@meteorrn/core' {
45
41
settings : { } ;
46
42
} ;
47
43
}
48
- function user ( ) : User | undefined ;
44
+
45
+ interface ConnectOptions {
46
+ suppressUrlErrors : boolean ;
47
+ AsyncStorage : AsyncStorageStatic ;
48
+ reachabilityUrl : string ;
49
+ }
50
+
51
+ interface Meteor {
52
+ connect ( endpoint : string , options ?: ConnectOptions ) : void ;
53
+ disconnect ( ) : void ;
54
+ reconnect ( ) : void ;
55
+
56
+ call ( ...args : any [ ] ) : void ;
57
+ status ( ) : {
58
+ connected : boolean ;
59
+ status : Status ;
60
+ } ;
61
+
62
+ logout ( cb : Callback ) : void ;
63
+ loggingOut ( ) : boolean ;
64
+ loggingIn ( ) : boolean ;
65
+
66
+ getData ( ) : Data ;
67
+ user ( ) : User | undefined ;
68
+ getAuthToken ( ) : string ;
69
+
70
+ readonly isVerbose : boolean ;
71
+ enableVerbose ( ) : void ;
72
+
73
+ useTracker < T > ( ) : useTracker < T > ;
74
+
75
+ ddp : Data ;
76
+
77
+ _handleLoginCallback (
78
+ err : MeteorError | null | undefined ,
79
+ res : { token : string ; id : string }
80
+ ) : void ;
81
+ }
82
+
49
83
interface Accounts {
50
84
onLogin ( cb : Callback ) : void ;
51
85
}
52
- function getAuthToken ( ) : string ;
53
86
54
- const ddp : Data ;
55
- let isVerbose : boolean ;
56
- function _handleLoginCallback ( err : any , res : any ) : void ;
87
+ // Export default Meteor object
88
+ const Meteor : Meteor ;
89
+ export default Meteor ;
57
90
58
- function useTracker < T > ( cb : ( ) => T ) : T ;
91
+ // Export other members
92
+ export { useTracker , Accounts } ;
59
93
}
0 commit comments