anzar 1.2.9 → 1.3.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/README.md +15 -21
- package/dist/adapters/index.cjs +70 -0
- package/dist/adapters/index.d.cts +21 -0
- package/dist/adapters/index.d.ts +21 -0
- package/dist/adapters/index.js +27 -0
- package/dist/base_storage-BnHsA4fU.d.cts +30 -0
- package/dist/base_storage-BnHsA4fU.d.ts +30 -0
- package/dist/chunk-5SSEPZKA.js +27 -0
- package/dist/index-BZFSacf5.d.cts +63 -0
- package/dist/index-BZFSacf5.d.ts +63 -0
- package/dist/index.cjs +235 -120
- package/dist/index.d.cts +112 -60
- package/dist/index.d.ts +112 -60
- package/dist/index.js +207 -112
- package/dist/types/index.cjs +18 -0
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +24 -4
- /package/{README.MD → dist/types/index.js} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
2
|
import { AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
3
|
+
import { S as SessionTokens, B as BaseStorage } from './base_storage-BnHsA4fU.cjs';
|
|
4
|
+
import { U as User, V as Verification, A as AuthResult } from './index-BZFSacf5.cjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Anzar Software API
|
|
@@ -129,27 +131,12 @@ declare class BaseAPI {
|
|
|
129
131
|
* https://openapi-generator.tech
|
|
130
132
|
* Do not edit the class manually.
|
|
131
133
|
*/
|
|
132
|
-
interface SessionTokens {
|
|
133
|
-
'access': string;
|
|
134
|
-
'refresh': string;
|
|
135
|
-
}
|
|
136
134
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* Contact: dev@anzar.io
|
|
143
|
-
*
|
|
144
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
145
|
-
* https://openapi-generator.tech
|
|
146
|
-
* Do not edit the class manually.
|
|
147
|
-
*/
|
|
148
|
-
declare const Role: {
|
|
149
|
-
readonly User: "User";
|
|
150
|
-
readonly Admin: "Admin";
|
|
151
|
-
};
|
|
152
|
-
type Role = typeof Role[keyof typeof Role];
|
|
135
|
+
interface AuthResponse {
|
|
136
|
+
'tokens'?: SessionTokens | null;
|
|
137
|
+
'user': User;
|
|
138
|
+
'verification'?: Verification | null;
|
|
139
|
+
}
|
|
153
140
|
|
|
154
141
|
/**
|
|
155
142
|
* Anzar Software API
|
|
@@ -162,14 +149,8 @@ type Role = typeof Role[keyof typeof Role];
|
|
|
162
149
|
* https://openapi-generator.tech
|
|
163
150
|
* Do not edit the class manually.
|
|
164
151
|
*/
|
|
165
|
-
|
|
166
|
-
interface User {
|
|
167
|
-
'_id'?: string | null;
|
|
168
|
-
'createdAt': string;
|
|
152
|
+
interface EmailRequest {
|
|
169
153
|
'email': string;
|
|
170
|
-
'role': Role;
|
|
171
|
-
'username': string;
|
|
172
|
-
'verified': boolean;
|
|
173
154
|
}
|
|
174
155
|
|
|
175
156
|
/**
|
|
@@ -183,12 +164,9 @@ interface User {
|
|
|
183
164
|
* https://openapi-generator.tech
|
|
184
165
|
* Do not edit the class manually.
|
|
185
166
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
interface Verification {
|
|
190
|
-
'link': string;
|
|
191
|
-
'token': string;
|
|
167
|
+
interface LoginRequest {
|
|
168
|
+
'email': string;
|
|
169
|
+
'password': string;
|
|
192
170
|
}
|
|
193
171
|
|
|
194
172
|
/**
|
|
@@ -202,11 +180,8 @@ interface Verification {
|
|
|
202
180
|
* https://openapi-generator.tech
|
|
203
181
|
* Do not edit the class manually.
|
|
204
182
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'tokens'?: SessionTokens | null;
|
|
208
|
-
'user': User;
|
|
209
|
-
'verification'?: Verification | null;
|
|
183
|
+
interface RefreshTokenRequest {
|
|
184
|
+
'refresh_token': string;
|
|
210
185
|
}
|
|
211
186
|
|
|
212
187
|
/**
|
|
@@ -220,8 +195,10 @@ interface AuthResponse {
|
|
|
220
195
|
* https://openapi-generator.tech
|
|
221
196
|
* Do not edit the class manually.
|
|
222
197
|
*/
|
|
223
|
-
interface
|
|
198
|
+
interface RegisterRequest {
|
|
224
199
|
'email': string;
|
|
200
|
+
'password': string;
|
|
201
|
+
'username': string;
|
|
225
202
|
}
|
|
226
203
|
|
|
227
204
|
/**
|
|
@@ -235,9 +212,9 @@ interface EmailRequest {
|
|
|
235
212
|
* https://openapi-generator.tech
|
|
236
213
|
* Do not edit the class manually.
|
|
237
214
|
*/
|
|
238
|
-
interface
|
|
239
|
-
'
|
|
240
|
-
'
|
|
215
|
+
interface ResetLink {
|
|
216
|
+
'expires_at': string;
|
|
217
|
+
'link': string;
|
|
241
218
|
}
|
|
242
219
|
|
|
243
220
|
/**
|
|
@@ -251,10 +228,10 @@ interface LoginRequest {
|
|
|
251
228
|
* https://openapi-generator.tech
|
|
252
229
|
* Do not edit the class manually.
|
|
253
230
|
*/
|
|
254
|
-
interface
|
|
255
|
-
'
|
|
231
|
+
interface ResetPasswordRequest {
|
|
232
|
+
'csrf_token': string;
|
|
256
233
|
'password': string;
|
|
257
|
-
'
|
|
234
|
+
'token': string;
|
|
258
235
|
}
|
|
259
236
|
|
|
260
237
|
/**
|
|
@@ -292,6 +269,75 @@ interface TokenQuery {
|
|
|
292
269
|
'token': string;
|
|
293
270
|
}
|
|
294
271
|
|
|
272
|
+
/**
|
|
273
|
+
* AuthApi - object-oriented interface
|
|
274
|
+
*/
|
|
275
|
+
declare class AuthApi extends BaseAPI {
|
|
276
|
+
/**
|
|
277
|
+
* Returns the currently authenticated user\'s session data. Requires a valid Bearer token.
|
|
278
|
+
* @summary Get current session
|
|
279
|
+
* @param {*} [options] Override http request option.
|
|
280
|
+
* @throws {RequiredError}
|
|
281
|
+
*/
|
|
282
|
+
getSession(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<Session, any, {}>>;
|
|
283
|
+
/**
|
|
284
|
+
* Authenticates a user with email and password. Returns an access token and refresh token on success.
|
|
285
|
+
* @summary User login
|
|
286
|
+
* @param {LoginRequest} loginRequest User login credentials
|
|
287
|
+
* @param {*} [options] Override http request option.
|
|
288
|
+
* @throws {RequiredError}
|
|
289
|
+
*/
|
|
290
|
+
login(loginRequest: LoginRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
291
|
+
/**
|
|
292
|
+
* Invalidates the current session and refresh token. The client should discard stored tokens.
|
|
293
|
+
* @summary Logout
|
|
294
|
+
* @param {RefreshTokenRequest} refreshTokenRequest
|
|
295
|
+
* @param {*} [options] Override http request option.
|
|
296
|
+
* @throws {RequiredError}
|
|
297
|
+
*/
|
|
298
|
+
logout(refreshTokenRequest: RefreshTokenRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
299
|
+
/**
|
|
300
|
+
* Issues a new access token using a valid refresh token. Rotate refresh tokens on each call.
|
|
301
|
+
* @summary Refresh access token
|
|
302
|
+
* @param {RefreshTokenRequest} refreshTokenRequest
|
|
303
|
+
* @param {*} [options] Override http request option.
|
|
304
|
+
* @throws {RequiredError}
|
|
305
|
+
*/
|
|
306
|
+
refreshToken(refreshTokenRequest: RefreshTokenRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
307
|
+
/**
|
|
308
|
+
* Creates a new user account. Sends a verification email upon successful registration.
|
|
309
|
+
* @summary Register a new user
|
|
310
|
+
* @param {RegisterRequest} registerRequest User register credentials
|
|
311
|
+
* @param {*} [options] Override http request option.
|
|
312
|
+
* @throws {RequiredError}
|
|
313
|
+
*/
|
|
314
|
+
register(registerRequest: RegisterRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
315
|
+
/**
|
|
316
|
+
* Validates the reset token from the email link and renders the password reset form.
|
|
317
|
+
* @summary Render password reset form
|
|
318
|
+
* @param {TokenQuery} token Password reset token
|
|
319
|
+
* @param {*} [options] Override http request option.
|
|
320
|
+
* @throws {RequiredError}
|
|
321
|
+
*/
|
|
322
|
+
renderResetForm(token: TokenQuery, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<string, any, {}>>;
|
|
323
|
+
/**
|
|
324
|
+
* Sends a password reset link to the provided email address if an account exists.
|
|
325
|
+
* @summary Request a password reset
|
|
326
|
+
* @param {EmailRequest} emailRequest Email address to send the reset link to
|
|
327
|
+
* @param {*} [options] Override http request option.
|
|
328
|
+
* @throws {RequiredError}
|
|
329
|
+
*/
|
|
330
|
+
requestPasswordReset(emailRequest: EmailRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<ResetLink, any, {}>>;
|
|
331
|
+
/**
|
|
332
|
+
* Submits a new password using a valid reset token. Invalidates the token after use.
|
|
333
|
+
* @summary Submit new password
|
|
334
|
+
* @param {ResetPasswordRequest} resetPasswordRequest Reset token and the new password
|
|
335
|
+
* @param {*} [options] Override http request option.
|
|
336
|
+
* @throws {RequiredError}
|
|
337
|
+
*/
|
|
338
|
+
submitNewPassword(resetPasswordRequest: ResetPasswordRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
339
|
+
}
|
|
340
|
+
|
|
295
341
|
/**
|
|
296
342
|
* EmailApi - object-oriented interface
|
|
297
343
|
*/
|
|
@@ -390,24 +436,30 @@ type AnzarConfig = {
|
|
|
390
436
|
};
|
|
391
437
|
|
|
392
438
|
interface SdkOptions {
|
|
393
|
-
|
|
394
|
-
getRefreshToken: () => string | null;
|
|
395
|
-
onTokenRefresh?: (tokens: SessionTokens) => void;
|
|
396
|
-
onSessionExpired?: () => void;
|
|
397
|
-
onLogout?: () => void;
|
|
439
|
+
storage: BaseStorage;
|
|
398
440
|
}
|
|
399
441
|
|
|
400
|
-
declare
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
442
|
+
declare class AuthModule {
|
|
443
|
+
private readonly authApi;
|
|
444
|
+
private readonly userApi;
|
|
445
|
+
private readonly strategy;
|
|
446
|
+
private readonly options?;
|
|
447
|
+
constructor(authApi: AuthApi, userApi: UsersApi, strategy: AuthStrategy, options?: SdkOptions | undefined);
|
|
448
|
+
login(body: LoginRequest): Promise<AuthResult>;
|
|
449
|
+
register(body: RegisterRequest): Promise<AuthResult>;
|
|
450
|
+
logout(): Promise<void>;
|
|
451
|
+
resetPassword(body: EmailRequest): void;
|
|
452
|
+
isAuthenticated(): Promise<boolean>;
|
|
453
|
+
session(): Promise<Session>;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
declare class Anzar {
|
|
457
|
+
Auth: AuthModule;
|
|
409
458
|
User: UsersApi;
|
|
410
459
|
Email: EmailApi;
|
|
411
|
-
|
|
460
|
+
constructor(anzarConfig: AnzarConfig, options?: SdkOptions);
|
|
461
|
+
private createAxiosInstance;
|
|
462
|
+
private createApis;
|
|
463
|
+
}
|
|
412
464
|
|
|
413
465
|
export { Anzar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
2
|
import { AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
3
|
+
import { S as SessionTokens, B as BaseStorage } from './base_storage-BnHsA4fU.js';
|
|
4
|
+
import { U as User, V as Verification, A as AuthResult } from './index-BZFSacf5.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Anzar Software API
|
|
@@ -129,27 +131,12 @@ declare class BaseAPI {
|
|
|
129
131
|
* https://openapi-generator.tech
|
|
130
132
|
* Do not edit the class manually.
|
|
131
133
|
*/
|
|
132
|
-
interface SessionTokens {
|
|
133
|
-
'access': string;
|
|
134
|
-
'refresh': string;
|
|
135
|
-
}
|
|
136
134
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* Contact: dev@anzar.io
|
|
143
|
-
*
|
|
144
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
145
|
-
* https://openapi-generator.tech
|
|
146
|
-
* Do not edit the class manually.
|
|
147
|
-
*/
|
|
148
|
-
declare const Role: {
|
|
149
|
-
readonly User: "User";
|
|
150
|
-
readonly Admin: "Admin";
|
|
151
|
-
};
|
|
152
|
-
type Role = typeof Role[keyof typeof Role];
|
|
135
|
+
interface AuthResponse {
|
|
136
|
+
'tokens'?: SessionTokens | null;
|
|
137
|
+
'user': User;
|
|
138
|
+
'verification'?: Verification | null;
|
|
139
|
+
}
|
|
153
140
|
|
|
154
141
|
/**
|
|
155
142
|
* Anzar Software API
|
|
@@ -162,14 +149,8 @@ type Role = typeof Role[keyof typeof Role];
|
|
|
162
149
|
* https://openapi-generator.tech
|
|
163
150
|
* Do not edit the class manually.
|
|
164
151
|
*/
|
|
165
|
-
|
|
166
|
-
interface User {
|
|
167
|
-
'_id'?: string | null;
|
|
168
|
-
'createdAt': string;
|
|
152
|
+
interface EmailRequest {
|
|
169
153
|
'email': string;
|
|
170
|
-
'role': Role;
|
|
171
|
-
'username': string;
|
|
172
|
-
'verified': boolean;
|
|
173
154
|
}
|
|
174
155
|
|
|
175
156
|
/**
|
|
@@ -183,12 +164,9 @@ interface User {
|
|
|
183
164
|
* https://openapi-generator.tech
|
|
184
165
|
* Do not edit the class manually.
|
|
185
166
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
interface Verification {
|
|
190
|
-
'link': string;
|
|
191
|
-
'token': string;
|
|
167
|
+
interface LoginRequest {
|
|
168
|
+
'email': string;
|
|
169
|
+
'password': string;
|
|
192
170
|
}
|
|
193
171
|
|
|
194
172
|
/**
|
|
@@ -202,11 +180,8 @@ interface Verification {
|
|
|
202
180
|
* https://openapi-generator.tech
|
|
203
181
|
* Do not edit the class manually.
|
|
204
182
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'tokens'?: SessionTokens | null;
|
|
208
|
-
'user': User;
|
|
209
|
-
'verification'?: Verification | null;
|
|
183
|
+
interface RefreshTokenRequest {
|
|
184
|
+
'refresh_token': string;
|
|
210
185
|
}
|
|
211
186
|
|
|
212
187
|
/**
|
|
@@ -220,8 +195,10 @@ interface AuthResponse {
|
|
|
220
195
|
* https://openapi-generator.tech
|
|
221
196
|
* Do not edit the class manually.
|
|
222
197
|
*/
|
|
223
|
-
interface
|
|
198
|
+
interface RegisterRequest {
|
|
224
199
|
'email': string;
|
|
200
|
+
'password': string;
|
|
201
|
+
'username': string;
|
|
225
202
|
}
|
|
226
203
|
|
|
227
204
|
/**
|
|
@@ -235,9 +212,9 @@ interface EmailRequest {
|
|
|
235
212
|
* https://openapi-generator.tech
|
|
236
213
|
* Do not edit the class manually.
|
|
237
214
|
*/
|
|
238
|
-
interface
|
|
239
|
-
'
|
|
240
|
-
'
|
|
215
|
+
interface ResetLink {
|
|
216
|
+
'expires_at': string;
|
|
217
|
+
'link': string;
|
|
241
218
|
}
|
|
242
219
|
|
|
243
220
|
/**
|
|
@@ -251,10 +228,10 @@ interface LoginRequest {
|
|
|
251
228
|
* https://openapi-generator.tech
|
|
252
229
|
* Do not edit the class manually.
|
|
253
230
|
*/
|
|
254
|
-
interface
|
|
255
|
-
'
|
|
231
|
+
interface ResetPasswordRequest {
|
|
232
|
+
'csrf_token': string;
|
|
256
233
|
'password': string;
|
|
257
|
-
'
|
|
234
|
+
'token': string;
|
|
258
235
|
}
|
|
259
236
|
|
|
260
237
|
/**
|
|
@@ -292,6 +269,75 @@ interface TokenQuery {
|
|
|
292
269
|
'token': string;
|
|
293
270
|
}
|
|
294
271
|
|
|
272
|
+
/**
|
|
273
|
+
* AuthApi - object-oriented interface
|
|
274
|
+
*/
|
|
275
|
+
declare class AuthApi extends BaseAPI {
|
|
276
|
+
/**
|
|
277
|
+
* Returns the currently authenticated user\'s session data. Requires a valid Bearer token.
|
|
278
|
+
* @summary Get current session
|
|
279
|
+
* @param {*} [options] Override http request option.
|
|
280
|
+
* @throws {RequiredError}
|
|
281
|
+
*/
|
|
282
|
+
getSession(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<Session, any, {}>>;
|
|
283
|
+
/**
|
|
284
|
+
* Authenticates a user with email and password. Returns an access token and refresh token on success.
|
|
285
|
+
* @summary User login
|
|
286
|
+
* @param {LoginRequest} loginRequest User login credentials
|
|
287
|
+
* @param {*} [options] Override http request option.
|
|
288
|
+
* @throws {RequiredError}
|
|
289
|
+
*/
|
|
290
|
+
login(loginRequest: LoginRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
291
|
+
/**
|
|
292
|
+
* Invalidates the current session and refresh token. The client should discard stored tokens.
|
|
293
|
+
* @summary Logout
|
|
294
|
+
* @param {RefreshTokenRequest} refreshTokenRequest
|
|
295
|
+
* @param {*} [options] Override http request option.
|
|
296
|
+
* @throws {RequiredError}
|
|
297
|
+
*/
|
|
298
|
+
logout(refreshTokenRequest: RefreshTokenRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
299
|
+
/**
|
|
300
|
+
* Issues a new access token using a valid refresh token. Rotate refresh tokens on each call.
|
|
301
|
+
* @summary Refresh access token
|
|
302
|
+
* @param {RefreshTokenRequest} refreshTokenRequest
|
|
303
|
+
* @param {*} [options] Override http request option.
|
|
304
|
+
* @throws {RequiredError}
|
|
305
|
+
*/
|
|
306
|
+
refreshToken(refreshTokenRequest: RefreshTokenRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
307
|
+
/**
|
|
308
|
+
* Creates a new user account. Sends a verification email upon successful registration.
|
|
309
|
+
* @summary Register a new user
|
|
310
|
+
* @param {RegisterRequest} registerRequest User register credentials
|
|
311
|
+
* @param {*} [options] Override http request option.
|
|
312
|
+
* @throws {RequiredError}
|
|
313
|
+
*/
|
|
314
|
+
register(registerRequest: RegisterRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
315
|
+
/**
|
|
316
|
+
* Validates the reset token from the email link and renders the password reset form.
|
|
317
|
+
* @summary Render password reset form
|
|
318
|
+
* @param {TokenQuery} token Password reset token
|
|
319
|
+
* @param {*} [options] Override http request option.
|
|
320
|
+
* @throws {RequiredError}
|
|
321
|
+
*/
|
|
322
|
+
renderResetForm(token: TokenQuery, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<string, any, {}>>;
|
|
323
|
+
/**
|
|
324
|
+
* Sends a password reset link to the provided email address if an account exists.
|
|
325
|
+
* @summary Request a password reset
|
|
326
|
+
* @param {EmailRequest} emailRequest Email address to send the reset link to
|
|
327
|
+
* @param {*} [options] Override http request option.
|
|
328
|
+
* @throws {RequiredError}
|
|
329
|
+
*/
|
|
330
|
+
requestPasswordReset(emailRequest: EmailRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<ResetLink, any, {}>>;
|
|
331
|
+
/**
|
|
332
|
+
* Submits a new password using a valid reset token. Invalidates the token after use.
|
|
333
|
+
* @summary Submit new password
|
|
334
|
+
* @param {ResetPasswordRequest} resetPasswordRequest Reset token and the new password
|
|
335
|
+
* @param {*} [options] Override http request option.
|
|
336
|
+
* @throws {RequiredError}
|
|
337
|
+
*/
|
|
338
|
+
submitNewPassword(resetPasswordRequest: ResetPasswordRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
339
|
+
}
|
|
340
|
+
|
|
295
341
|
/**
|
|
296
342
|
* EmailApi - object-oriented interface
|
|
297
343
|
*/
|
|
@@ -390,24 +436,30 @@ type AnzarConfig = {
|
|
|
390
436
|
};
|
|
391
437
|
|
|
392
438
|
interface SdkOptions {
|
|
393
|
-
|
|
394
|
-
getRefreshToken: () => string | null;
|
|
395
|
-
onTokenRefresh?: (tokens: SessionTokens) => void;
|
|
396
|
-
onSessionExpired?: () => void;
|
|
397
|
-
onLogout?: () => void;
|
|
439
|
+
storage: BaseStorage;
|
|
398
440
|
}
|
|
399
441
|
|
|
400
|
-
declare
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
442
|
+
declare class AuthModule {
|
|
443
|
+
private readonly authApi;
|
|
444
|
+
private readonly userApi;
|
|
445
|
+
private readonly strategy;
|
|
446
|
+
private readonly options?;
|
|
447
|
+
constructor(authApi: AuthApi, userApi: UsersApi, strategy: AuthStrategy, options?: SdkOptions | undefined);
|
|
448
|
+
login(body: LoginRequest): Promise<AuthResult>;
|
|
449
|
+
register(body: RegisterRequest): Promise<AuthResult>;
|
|
450
|
+
logout(): Promise<void>;
|
|
451
|
+
resetPassword(body: EmailRequest): void;
|
|
452
|
+
isAuthenticated(): Promise<boolean>;
|
|
453
|
+
session(): Promise<Session>;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
declare class Anzar {
|
|
457
|
+
Auth: AuthModule;
|
|
409
458
|
User: UsersApi;
|
|
410
459
|
Email: EmailApi;
|
|
411
|
-
|
|
460
|
+
constructor(anzarConfig: AnzarConfig, options?: SdkOptions);
|
|
461
|
+
private createAxiosInstance;
|
|
462
|
+
private createApis;
|
|
463
|
+
}
|
|
412
464
|
|
|
413
465
|
export { Anzar };
|