@thelllabs/winehaus-sdk 0.0.4 → 0.0.7
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/dist/cjs/api/api.js +573 -31
- package/dist/cjs/sdk.js +34 -10
- package/dist/esm/api/api.js +572 -30
- package/dist/esm/sdk.js +34 -10
- package/dist/types/api/api.d.ts +1822 -181
- package/dist/types/interfaces.d.ts +6 -0
- package/dist/types/sdk.d.ts +10 -5
- package/dist/umd/index.ts +607 -41
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SigninDto } from './api/api';
|
|
1
2
|
export interface SDKOptions {
|
|
2
3
|
baseURL: string;
|
|
3
4
|
autoRefresh?: boolean;
|
|
@@ -14,3 +15,8 @@ export type SDKEvents = {
|
|
|
14
15
|
refreshToken: string;
|
|
15
16
|
};
|
|
16
17
|
};
|
|
18
|
+
export interface AuthenticatedCredential {
|
|
19
|
+
authToken: string;
|
|
20
|
+
refreshToken: string;
|
|
21
|
+
}
|
|
22
|
+
export type AuthCredential = SigninDto | AuthenticatedCredential;
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { SDKOptions, ApiSecurityDataType, SDKEvents } from './interfaces';
|
|
2
|
+
import { SDKOptions, ApiSecurityDataType, SDKEvents, AuthCredential } from './interfaces';
|
|
3
3
|
import { JwtPayload } from 'jwt-decode';
|
|
4
4
|
import { Api, SigninDto } from './api/api';
|
|
5
5
|
import { Emitter } from 'mitt';
|
|
@@ -11,7 +11,7 @@ export declare class WinehausSDK {
|
|
|
11
11
|
protected refreshToken: string;
|
|
12
12
|
protected options: SDKOptions;
|
|
13
13
|
protected autoRefreshTimer: NodeJS.Timeout | undefined;
|
|
14
|
-
protected
|
|
14
|
+
protected signInCredential: SigninDto | undefined;
|
|
15
15
|
emitter: Emitter<SDKEvents>;
|
|
16
16
|
protected defaultOptions: Partial<SDKOptions>;
|
|
17
17
|
constructor(options: SDKOptions);
|
|
@@ -20,10 +20,12 @@ export declare class WinehausSDK {
|
|
|
20
20
|
private hookTimer;
|
|
21
21
|
private hookInterceptors;
|
|
22
22
|
clearTokens(): void;
|
|
23
|
-
authenticate(credential:
|
|
23
|
+
authenticate(credential: AuthCredential, opts?: {
|
|
24
24
|
avoidEvents?: boolean;
|
|
25
25
|
}): Promise<void>;
|
|
26
|
-
reAuthenticate(
|
|
26
|
+
reAuthenticate(opts?: {
|
|
27
|
+
throwError?: boolean;
|
|
28
|
+
}): Promise<void>;
|
|
27
29
|
isAuthenticated(): boolean;
|
|
28
30
|
protected setAuthToken(token: string): void;
|
|
29
31
|
triggerRefreshToken(): Promise<void>;
|
|
@@ -31,8 +33,11 @@ export declare class WinehausSDK {
|
|
|
31
33
|
getAuthToken(): string;
|
|
32
34
|
protected setRefreshToken(refreshToken: string): void;
|
|
33
35
|
getRefreshToken(): string;
|
|
34
|
-
refreshTokens(
|
|
36
|
+
refreshTokens(opts?: {
|
|
37
|
+
throwError?: boolean;
|
|
38
|
+
}): Promise<void>;
|
|
35
39
|
private authenticateAsUser;
|
|
40
|
+
private authenticateAsToken;
|
|
36
41
|
private setTokens;
|
|
37
42
|
getAuthTokenDecoded(): JwtPayload | undefined;
|
|
38
43
|
getRefreshTokenDecoded(): JwtPayload | undefined;
|