anzar 1.2.9 → 1.2.10
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 +7 -17
- 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-CQKHFbrb.d.cts +25 -0
- package/dist/base_storage-CQKHFbrb.d.ts +25 -0
- package/dist/chunk-5SSEPZKA.js +27 -0
- package/dist/index.cjs +174 -110
- package/dist/index.d.cts +123 -32
- package/dist/index.d.ts +123 -32
- package/dist/index.js +146 -102
- package/package.json +15 -3
- package/README.MD +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
|
-
import { AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AxiosInstance, RawAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
3
|
+
import { S as SessionTokens, B as BaseStorage } from './base_storage-CQKHFbrb.cjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Anzar Software API
|
|
@@ -118,22 +119,6 @@ declare class BaseAPI {
|
|
|
118
119
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
/**
|
|
122
|
-
* Anzar Software API
|
|
123
|
-
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
124
|
-
*
|
|
125
|
-
* The version of the OpenAPI document: 0.6.2
|
|
126
|
-
* Contact: dev@anzar.io
|
|
127
|
-
*
|
|
128
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
129
|
-
* https://openapi-generator.tech
|
|
130
|
-
* Do not edit the class manually.
|
|
131
|
-
*/
|
|
132
|
-
interface SessionTokens {
|
|
133
|
-
'access': string;
|
|
134
|
-
'refresh': string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
122
|
/**
|
|
138
123
|
* Anzar Software API
|
|
139
124
|
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
@@ -257,6 +242,39 @@ interface RegisterRequest {
|
|
|
257
242
|
'username': string;
|
|
258
243
|
}
|
|
259
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Anzar Software API
|
|
247
|
+
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
248
|
+
*
|
|
249
|
+
* The version of the OpenAPI document: 0.6.2
|
|
250
|
+
* Contact: dev@anzar.io
|
|
251
|
+
*
|
|
252
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
253
|
+
* https://openapi-generator.tech
|
|
254
|
+
* Do not edit the class manually.
|
|
255
|
+
*/
|
|
256
|
+
interface ResetLink {
|
|
257
|
+
'expires_at': string;
|
|
258
|
+
'link': string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Anzar Software API
|
|
263
|
+
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
264
|
+
*
|
|
265
|
+
* The version of the OpenAPI document: 0.6.2
|
|
266
|
+
* Contact: dev@anzar.io
|
|
267
|
+
*
|
|
268
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
269
|
+
* https://openapi-generator.tech
|
|
270
|
+
* Do not edit the class manually.
|
|
271
|
+
*/
|
|
272
|
+
interface ResetPasswordRequest {
|
|
273
|
+
'csrf_token': string;
|
|
274
|
+
'password': string;
|
|
275
|
+
'token': string;
|
|
276
|
+
}
|
|
277
|
+
|
|
260
278
|
/**
|
|
261
279
|
* Anzar Software API
|
|
262
280
|
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
@@ -292,6 +310,73 @@ interface TokenQuery {
|
|
|
292
310
|
'token': string;
|
|
293
311
|
}
|
|
294
312
|
|
|
313
|
+
/**
|
|
314
|
+
* AuthApi - object-oriented interface
|
|
315
|
+
*/
|
|
316
|
+
declare class AuthApi extends BaseAPI {
|
|
317
|
+
/**
|
|
318
|
+
* Returns the currently authenticated user\'s session data. Requires a valid Bearer token.
|
|
319
|
+
* @summary Get current session
|
|
320
|
+
* @param {*} [options] Override http request option.
|
|
321
|
+
* @throws {RequiredError}
|
|
322
|
+
*/
|
|
323
|
+
getSession(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<Session, any, {}>>;
|
|
324
|
+
/**
|
|
325
|
+
* Authenticates a user with email and password. Returns an access token and refresh token on success.
|
|
326
|
+
* @summary User login
|
|
327
|
+
* @param {LoginRequest} loginRequest User login credentials
|
|
328
|
+
* @param {*} [options] Override http request option.
|
|
329
|
+
* @throws {RequiredError}
|
|
330
|
+
*/
|
|
331
|
+
login(loginRequest: LoginRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
332
|
+
/**
|
|
333
|
+
* Invalidates the current session and refresh token. The client should discard stored tokens.
|
|
334
|
+
* @summary Logout
|
|
335
|
+
* @param {*} [options] Override http request option.
|
|
336
|
+
* @throws {RequiredError}
|
|
337
|
+
*/
|
|
338
|
+
logout(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
339
|
+
/**
|
|
340
|
+
* Issues a new access token using a valid refresh token. Rotate refresh tokens on each call.
|
|
341
|
+
* @summary Refresh access token
|
|
342
|
+
* @param {*} [options] Override http request option.
|
|
343
|
+
* @throws {RequiredError}
|
|
344
|
+
*/
|
|
345
|
+
refreshToken(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
346
|
+
/**
|
|
347
|
+
* Creates a new user account. Sends a verification email upon successful registration.
|
|
348
|
+
* @summary Register a new user
|
|
349
|
+
* @param {RegisterRequest} registerRequest User register credentials
|
|
350
|
+
* @param {*} [options] Override http request option.
|
|
351
|
+
* @throws {RequiredError}
|
|
352
|
+
*/
|
|
353
|
+
register(registerRequest: RegisterRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
354
|
+
/**
|
|
355
|
+
* Validates the reset token from the email link and renders the password reset form.
|
|
356
|
+
* @summary Render password reset form
|
|
357
|
+
* @param {TokenQuery} token Password reset token
|
|
358
|
+
* @param {*} [options] Override http request option.
|
|
359
|
+
* @throws {RequiredError}
|
|
360
|
+
*/
|
|
361
|
+
renderResetForm(token: TokenQuery, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<string, any, {}>>;
|
|
362
|
+
/**
|
|
363
|
+
* Sends a password reset link to the provided email address if an account exists.
|
|
364
|
+
* @summary Request a password reset
|
|
365
|
+
* @param {EmailRequest} emailRequest Email address to send the reset link to
|
|
366
|
+
* @param {*} [options] Override http request option.
|
|
367
|
+
* @throws {RequiredError}
|
|
368
|
+
*/
|
|
369
|
+
requestPasswordReset(emailRequest: EmailRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<ResetLink, any, {}>>;
|
|
370
|
+
/**
|
|
371
|
+
* Submits a new password using a valid reset token. Invalidates the token after use.
|
|
372
|
+
* @summary Submit new password
|
|
373
|
+
* @param {ResetPasswordRequest} resetPasswordRequest Reset token and the new password
|
|
374
|
+
* @param {*} [options] Override http request option.
|
|
375
|
+
* @throws {RequiredError}
|
|
376
|
+
*/
|
|
377
|
+
submitNewPassword(resetPasswordRequest: ResetPasswordRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
378
|
+
}
|
|
379
|
+
|
|
295
380
|
/**
|
|
296
381
|
* EmailApi - object-oriented interface
|
|
297
382
|
*/
|
|
@@ -390,24 +475,30 @@ type AnzarConfig = {
|
|
|
390
475
|
};
|
|
391
476
|
|
|
392
477
|
interface SdkOptions {
|
|
393
|
-
|
|
394
|
-
getRefreshToken: () => string | null;
|
|
395
|
-
onTokenRefresh?: (tokens: SessionTokens) => void;
|
|
396
|
-
onSessionExpired?: () => void;
|
|
397
|
-
onLogout?: () => void;
|
|
478
|
+
storage: BaseStorage;
|
|
398
479
|
}
|
|
399
480
|
|
|
400
|
-
declare
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
481
|
+
declare class AuthModule {
|
|
482
|
+
private readonly authApi;
|
|
483
|
+
private readonly userApi;
|
|
484
|
+
private readonly strategy;
|
|
485
|
+
private readonly options?;
|
|
486
|
+
constructor(authApi: AuthApi, userApi: UsersApi, strategy: AuthStrategy, options?: SdkOptions | undefined);
|
|
487
|
+
login(body: LoginRequest): Promise<AxiosResponse<AuthResponse, any, {}>>;
|
|
488
|
+
register(body: RegisterRequest): Promise<AxiosResponse<AuthResponse, any, {}>>;
|
|
489
|
+
logout(): Promise<void>;
|
|
490
|
+
resetPassword(body: EmailRequest): void;
|
|
491
|
+
isAuthenticated(): Promise<boolean>;
|
|
492
|
+
session(): Promise<AxiosResponse<Session, any, {}>>;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
declare class Anzar {
|
|
496
|
+
Auth: AuthModule;
|
|
409
497
|
User: UsersApi;
|
|
410
498
|
Email: EmailApi;
|
|
411
|
-
|
|
499
|
+
constructor(anzarConfig: AnzarConfig, options?: SdkOptions);
|
|
500
|
+
private createAxiosInstance;
|
|
501
|
+
private createApis;
|
|
502
|
+
}
|
|
412
503
|
|
|
413
504
|
export { Anzar };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
|
-
import { AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
2
|
+
import { AxiosInstance, RawAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
3
|
+
import { S as SessionTokens, B as BaseStorage } from './base_storage-CQKHFbrb.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Anzar Software API
|
|
@@ -118,22 +119,6 @@ declare class BaseAPI {
|
|
|
118
119
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
/**
|
|
122
|
-
* Anzar Software API
|
|
123
|
-
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
124
|
-
*
|
|
125
|
-
* The version of the OpenAPI document: 0.6.2
|
|
126
|
-
* Contact: dev@anzar.io
|
|
127
|
-
*
|
|
128
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
129
|
-
* https://openapi-generator.tech
|
|
130
|
-
* Do not edit the class manually.
|
|
131
|
-
*/
|
|
132
|
-
interface SessionTokens {
|
|
133
|
-
'access': string;
|
|
134
|
-
'refresh': string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
122
|
/**
|
|
138
123
|
* Anzar Software API
|
|
139
124
|
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
@@ -257,6 +242,39 @@ interface RegisterRequest {
|
|
|
257
242
|
'username': string;
|
|
258
243
|
}
|
|
259
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Anzar Software API
|
|
247
|
+
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
248
|
+
*
|
|
249
|
+
* The version of the OpenAPI document: 0.6.2
|
|
250
|
+
* Contact: dev@anzar.io
|
|
251
|
+
*
|
|
252
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
253
|
+
* https://openapi-generator.tech
|
|
254
|
+
* Do not edit the class manually.
|
|
255
|
+
*/
|
|
256
|
+
interface ResetLink {
|
|
257
|
+
'expires_at': string;
|
|
258
|
+
'link': string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Anzar Software API
|
|
263
|
+
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
264
|
+
*
|
|
265
|
+
* The version of the OpenAPI document: 0.6.2
|
|
266
|
+
* Contact: dev@anzar.io
|
|
267
|
+
*
|
|
268
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
269
|
+
* https://openapi-generator.tech
|
|
270
|
+
* Do not edit the class manually.
|
|
271
|
+
*/
|
|
272
|
+
interface ResetPasswordRequest {
|
|
273
|
+
'csrf_token': string;
|
|
274
|
+
'password': string;
|
|
275
|
+
'token': string;
|
|
276
|
+
}
|
|
277
|
+
|
|
260
278
|
/**
|
|
261
279
|
* Anzar Software API
|
|
262
280
|
* REST API for the Anzar platform. All protected routes require a Bearer token.
|
|
@@ -292,6 +310,73 @@ interface TokenQuery {
|
|
|
292
310
|
'token': string;
|
|
293
311
|
}
|
|
294
312
|
|
|
313
|
+
/**
|
|
314
|
+
* AuthApi - object-oriented interface
|
|
315
|
+
*/
|
|
316
|
+
declare class AuthApi extends BaseAPI {
|
|
317
|
+
/**
|
|
318
|
+
* Returns the currently authenticated user\'s session data. Requires a valid Bearer token.
|
|
319
|
+
* @summary Get current session
|
|
320
|
+
* @param {*} [options] Override http request option.
|
|
321
|
+
* @throws {RequiredError}
|
|
322
|
+
*/
|
|
323
|
+
getSession(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<Session, any, {}>>;
|
|
324
|
+
/**
|
|
325
|
+
* Authenticates a user with email and password. Returns an access token and refresh token on success.
|
|
326
|
+
* @summary User login
|
|
327
|
+
* @param {LoginRequest} loginRequest User login credentials
|
|
328
|
+
* @param {*} [options] Override http request option.
|
|
329
|
+
* @throws {RequiredError}
|
|
330
|
+
*/
|
|
331
|
+
login(loginRequest: LoginRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
332
|
+
/**
|
|
333
|
+
* Invalidates the current session and refresh token. The client should discard stored tokens.
|
|
334
|
+
* @summary Logout
|
|
335
|
+
* @param {*} [options] Override http request option.
|
|
336
|
+
* @throws {RequiredError}
|
|
337
|
+
*/
|
|
338
|
+
logout(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
339
|
+
/**
|
|
340
|
+
* Issues a new access token using a valid refresh token. Rotate refresh tokens on each call.
|
|
341
|
+
* @summary Refresh access token
|
|
342
|
+
* @param {*} [options] Override http request option.
|
|
343
|
+
* @throws {RequiredError}
|
|
344
|
+
*/
|
|
345
|
+
refreshToken(options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
346
|
+
/**
|
|
347
|
+
* Creates a new user account. Sends a verification email upon successful registration.
|
|
348
|
+
* @summary Register a new user
|
|
349
|
+
* @param {RegisterRequest} registerRequest User register credentials
|
|
350
|
+
* @param {*} [options] Override http request option.
|
|
351
|
+
* @throws {RequiredError}
|
|
352
|
+
*/
|
|
353
|
+
register(registerRequest: RegisterRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<AuthResponse, any, {}>>;
|
|
354
|
+
/**
|
|
355
|
+
* Validates the reset token from the email link and renders the password reset form.
|
|
356
|
+
* @summary Render password reset form
|
|
357
|
+
* @param {TokenQuery} token Password reset token
|
|
358
|
+
* @param {*} [options] Override http request option.
|
|
359
|
+
* @throws {RequiredError}
|
|
360
|
+
*/
|
|
361
|
+
renderResetForm(token: TokenQuery, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<string, any, {}>>;
|
|
362
|
+
/**
|
|
363
|
+
* Sends a password reset link to the provided email address if an account exists.
|
|
364
|
+
* @summary Request a password reset
|
|
365
|
+
* @param {EmailRequest} emailRequest Email address to send the reset link to
|
|
366
|
+
* @param {*} [options] Override http request option.
|
|
367
|
+
* @throws {RequiredError}
|
|
368
|
+
*/
|
|
369
|
+
requestPasswordReset(emailRequest: EmailRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<ResetLink, any, {}>>;
|
|
370
|
+
/**
|
|
371
|
+
* Submits a new password using a valid reset token. Invalidates the token after use.
|
|
372
|
+
* @summary Submit new password
|
|
373
|
+
* @param {ResetPasswordRequest} resetPasswordRequest Reset token and the new password
|
|
374
|
+
* @param {*} [options] Override http request option.
|
|
375
|
+
* @throws {RequiredError}
|
|
376
|
+
*/
|
|
377
|
+
submitNewPassword(resetPasswordRequest: ResetPasswordRequest, options?: RawAxiosRequestConfig): Promise<axios.AxiosResponse<void, any, {}>>;
|
|
378
|
+
}
|
|
379
|
+
|
|
295
380
|
/**
|
|
296
381
|
* EmailApi - object-oriented interface
|
|
297
382
|
*/
|
|
@@ -390,24 +475,30 @@ type AnzarConfig = {
|
|
|
390
475
|
};
|
|
391
476
|
|
|
392
477
|
interface SdkOptions {
|
|
393
|
-
|
|
394
|
-
getRefreshToken: () => string | null;
|
|
395
|
-
onTokenRefresh?: (tokens: SessionTokens) => void;
|
|
396
|
-
onSessionExpired?: () => void;
|
|
397
|
-
onLogout?: () => void;
|
|
478
|
+
storage: BaseStorage;
|
|
398
479
|
}
|
|
399
480
|
|
|
400
|
-
declare
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
481
|
+
declare class AuthModule {
|
|
482
|
+
private readonly authApi;
|
|
483
|
+
private readonly userApi;
|
|
484
|
+
private readonly strategy;
|
|
485
|
+
private readonly options?;
|
|
486
|
+
constructor(authApi: AuthApi, userApi: UsersApi, strategy: AuthStrategy, options?: SdkOptions | undefined);
|
|
487
|
+
login(body: LoginRequest): Promise<AxiosResponse<AuthResponse, any, {}>>;
|
|
488
|
+
register(body: RegisterRequest): Promise<AxiosResponse<AuthResponse, any, {}>>;
|
|
489
|
+
logout(): Promise<void>;
|
|
490
|
+
resetPassword(body: EmailRequest): void;
|
|
491
|
+
isAuthenticated(): Promise<boolean>;
|
|
492
|
+
session(): Promise<AxiosResponse<Session, any, {}>>;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
declare class Anzar {
|
|
496
|
+
Auth: AuthModule;
|
|
409
497
|
User: UsersApi;
|
|
410
498
|
Email: EmailApi;
|
|
411
|
-
|
|
499
|
+
constructor(anzarConfig: AnzarConfig, options?: SdkOptions);
|
|
500
|
+
private createAxiosInstance;
|
|
501
|
+
private createApis;
|
|
502
|
+
}
|
|
412
503
|
|
|
413
504
|
export { Anzar };
|