@clicktap/state 0.11.4 → 0.11.5
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/auth/AuthProvider.d.ts +26 -26
- package/index.js +16 -16
- package/index.mjs +270 -272
- package/package.json +1 -1
package/auth/AuthProvider.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Actor, InspectionEvent, Observer } from 'xstate';
|
|
3
|
-
import { authMachine } from './auth';
|
|
2
|
+
import { Actor, InspectionEvent, Observer, StateMachine } from 'xstate';
|
|
3
|
+
import { AuthMachineContext, authMachine } from './auth';
|
|
4
4
|
export interface AuthContextType {
|
|
5
|
-
authActor
|
|
5
|
+
authActor?: Actor<typeof authMachine>;
|
|
6
6
|
isLoggedIn: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const AuthContext: import("react").Context<Actor<
|
|
8
|
+
export declare const AuthContext: import("react").Context<Actor<StateMachine<AuthMachineContext, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
|
|
9
9
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
10
10
|
type: string;
|
|
11
11
|
accessToken: string;
|
|
12
12
|
}, {
|
|
13
|
-
context:
|
|
13
|
+
context: AuthMachineContext;
|
|
14
14
|
}>, {
|
|
15
15
|
[k: string]: unknown;
|
|
16
16
|
type: string;
|
|
@@ -18,7 +18,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
18
18
|
type: string;
|
|
19
19
|
accessToken: string;
|
|
20
20
|
}, {
|
|
21
|
-
context:
|
|
21
|
+
context: AuthMachineContext;
|
|
22
22
|
username: string;
|
|
23
23
|
password: string;
|
|
24
24
|
}>, {
|
|
@@ -27,7 +27,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
27
27
|
}> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
28
28
|
type: string;
|
|
29
29
|
}, {
|
|
30
|
-
context:
|
|
30
|
+
context: AuthMachineContext;
|
|
31
31
|
}>, {
|
|
32
32
|
[k: string]: unknown;
|
|
33
33
|
type: string;
|
|
@@ -38,7 +38,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
38
38
|
type: string;
|
|
39
39
|
accessToken: string;
|
|
40
40
|
}, {
|
|
41
|
-
context:
|
|
41
|
+
context: AuthMachineContext;
|
|
42
42
|
}>;
|
|
43
43
|
id: string | undefined;
|
|
44
44
|
} | {
|
|
@@ -47,7 +47,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
47
47
|
type: string;
|
|
48
48
|
accessToken: string;
|
|
49
49
|
}, {
|
|
50
|
-
context:
|
|
50
|
+
context: AuthMachineContext;
|
|
51
51
|
username: string;
|
|
52
52
|
password: string;
|
|
53
53
|
}>;
|
|
@@ -57,7 +57,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
57
57
|
logic: import("xstate").PromiseActorLogic<{
|
|
58
58
|
type: string;
|
|
59
59
|
}, {
|
|
60
|
-
context:
|
|
60
|
+
context: AuthMachineContext;
|
|
61
61
|
}>;
|
|
62
62
|
id: string | undefined;
|
|
63
63
|
}, {
|
|
@@ -85,7 +85,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
85
85
|
type: string;
|
|
86
86
|
params: import("xstate").NonReducibleUnknown;
|
|
87
87
|
}, string, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
|
|
88
|
-
initialContext: Partial<
|
|
88
|
+
initialContext: Partial<AuthMachineContext>;
|
|
89
89
|
initialState?: string | undefined;
|
|
90
90
|
}, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
|
|
91
91
|
src: "refreshAccessToken";
|
|
@@ -93,7 +93,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
93
93
|
type: string;
|
|
94
94
|
accessToken: string;
|
|
95
95
|
}, {
|
|
96
|
-
context:
|
|
96
|
+
context: AuthMachineContext;
|
|
97
97
|
}>;
|
|
98
98
|
id: string | undefined;
|
|
99
99
|
} | {
|
|
@@ -102,7 +102,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
102
102
|
type: string;
|
|
103
103
|
accessToken: string;
|
|
104
104
|
}, {
|
|
105
|
-
context:
|
|
105
|
+
context: AuthMachineContext;
|
|
106
106
|
username: string;
|
|
107
107
|
password: string;
|
|
108
108
|
}>;
|
|
@@ -112,7 +112,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
112
112
|
logic: import("xstate").PromiseActorLogic<{
|
|
113
113
|
type: string;
|
|
114
114
|
}, {
|
|
115
|
-
context:
|
|
115
|
+
context: AuthMachineContext;
|
|
116
116
|
}>;
|
|
117
117
|
id: string | undefined;
|
|
118
118
|
}, {
|
|
@@ -139,7 +139,7 @@ export declare const AuthContext: import("react").Context<Actor<import("xstate")
|
|
|
139
139
|
}, {
|
|
140
140
|
type: string;
|
|
141
141
|
params: import("xstate").NonReducibleUnknown;
|
|
142
|
-
}, string, string
|
|
142
|
+
}, string, string>>> | undefined>;
|
|
143
143
|
export declare const useAuth: () => AuthContextType;
|
|
144
144
|
type AuthOptions = {
|
|
145
145
|
inspect: Observer<InspectionEvent> | undefined;
|
|
@@ -156,12 +156,12 @@ type AuthOptions = {
|
|
|
156
156
|
* @todo should probably update signature to pass Partial<AuthContext> and
|
|
157
157
|
* Options, endpoints should probably be moved into context
|
|
158
158
|
*/
|
|
159
|
-
export declare const getAuth: (refreshToken?: string, options?: AuthOptions) => Promise<Actor<
|
|
159
|
+
export declare const getAuth: (refreshToken?: string, options?: AuthOptions) => Promise<Actor<StateMachine<AuthMachineContext, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
|
|
160
160
|
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
161
161
|
type: string;
|
|
162
162
|
accessToken: string;
|
|
163
163
|
}, {
|
|
164
|
-
context:
|
|
164
|
+
context: AuthMachineContext;
|
|
165
165
|
}>, {
|
|
166
166
|
[k: string]: unknown;
|
|
167
167
|
type: string;
|
|
@@ -169,7 +169,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
169
169
|
type: string;
|
|
170
170
|
accessToken: string;
|
|
171
171
|
}, {
|
|
172
|
-
context:
|
|
172
|
+
context: AuthMachineContext;
|
|
173
173
|
username: string;
|
|
174
174
|
password: string;
|
|
175
175
|
}>, {
|
|
@@ -178,7 +178,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
178
178
|
}> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
179
179
|
type: string;
|
|
180
180
|
}, {
|
|
181
|
-
context:
|
|
181
|
+
context: AuthMachineContext;
|
|
182
182
|
}>, {
|
|
183
183
|
[k: string]: unknown;
|
|
184
184
|
type: string;
|
|
@@ -189,7 +189,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
189
189
|
type: string;
|
|
190
190
|
accessToken: string;
|
|
191
191
|
}, {
|
|
192
|
-
context:
|
|
192
|
+
context: AuthMachineContext;
|
|
193
193
|
}>;
|
|
194
194
|
id: string | undefined;
|
|
195
195
|
} | {
|
|
@@ -198,7 +198,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
198
198
|
type: string;
|
|
199
199
|
accessToken: string;
|
|
200
200
|
}, {
|
|
201
|
-
context:
|
|
201
|
+
context: AuthMachineContext;
|
|
202
202
|
username: string;
|
|
203
203
|
password: string;
|
|
204
204
|
}>;
|
|
@@ -208,7 +208,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
208
208
|
logic: import("xstate").PromiseActorLogic<{
|
|
209
209
|
type: string;
|
|
210
210
|
}, {
|
|
211
|
-
context:
|
|
211
|
+
context: AuthMachineContext;
|
|
212
212
|
}>;
|
|
213
213
|
id: string | undefined;
|
|
214
214
|
}, {
|
|
@@ -236,7 +236,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
236
236
|
type: string;
|
|
237
237
|
params: import("xstate").NonReducibleUnknown;
|
|
238
238
|
}, string, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
|
|
239
|
-
initialContext: Partial<
|
|
239
|
+
initialContext: Partial<AuthMachineContext>;
|
|
240
240
|
initialState?: string | undefined;
|
|
241
241
|
}, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./auth").RefreshTokenEvent | import("./auth").LoginEvent | import("./auth").LogoutEvent | import("./auth").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./auth").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./auth").RefreshTokenSuccessEvent>, {
|
|
242
242
|
src: "refreshAccessToken";
|
|
@@ -244,7 +244,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
244
244
|
type: string;
|
|
245
245
|
accessToken: string;
|
|
246
246
|
}, {
|
|
247
|
-
context:
|
|
247
|
+
context: AuthMachineContext;
|
|
248
248
|
}>;
|
|
249
249
|
id: string | undefined;
|
|
250
250
|
} | {
|
|
@@ -253,7 +253,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
253
253
|
type: string;
|
|
254
254
|
accessToken: string;
|
|
255
255
|
}, {
|
|
256
|
-
context:
|
|
256
|
+
context: AuthMachineContext;
|
|
257
257
|
username: string;
|
|
258
258
|
password: string;
|
|
259
259
|
}>;
|
|
@@ -263,7 +263,7 @@ export declare const getAuth: (refreshToken?: string, options?: AuthOptions) =>
|
|
|
263
263
|
logic: import("xstate").PromiseActorLogic<{
|
|
264
264
|
type: string;
|
|
265
265
|
}, {
|
|
266
|
-
context:
|
|
266
|
+
context: AuthMachineContext;
|
|
267
267
|
}>;
|
|
268
268
|
id: string | undefined;
|
|
269
269
|
}, {
|