@sisense/sdk-rest-client 1.16.0 → 1.17.1
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/authenticator.d.ts +2 -2
- package/dist/helpers.d.ts +7 -0
- package/dist/helpers.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/wat-authenticator.js +4 -1
- package/package.json +2 -2
package/dist/authenticator.d.ts
CHANGED
package/dist/helpers.d.ts
CHANGED
|
@@ -4,3 +4,10 @@ export declare const appendHeaders: (existingHeaders: HeadersInit, additionalHea
|
|
|
4
4
|
export declare const addQueryParamsToUrl: (url: string, params: {
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
}) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if API token or WAT token is pending (e.g., being generated)
|
|
9
|
+
* @param token - API token
|
|
10
|
+
* @param wat - WAT token
|
|
11
|
+
* @returns true if the token is pending
|
|
12
|
+
*/
|
|
13
|
+
export declare const isAuthTokenPending: (token?: string | null, wat?: string | null) => boolean;
|
package/dist/helpers.js
CHANGED
|
@@ -21,3 +21,12 @@ export const addQueryParamsToUrl = (url, params) => {
|
|
|
21
21
|
// replace the trailing slash if there is one
|
|
22
22
|
return urlObject.toString().replace(/\/([?&])/, '$1');
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Checks if API token or WAT token is pending (e.g., being generated)
|
|
26
|
+
* @param token - API token
|
|
27
|
+
* @param wat - WAT token
|
|
28
|
+
* @returns true if the token is pending
|
|
29
|
+
*/
|
|
30
|
+
export const isAuthTokenPending = (token, wat) => {
|
|
31
|
+
return token === null || wat === null;
|
|
32
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { SsoAuthenticator, isSsoAuthenticator } from './sso-authenticator.js';
|
|
|
5
5
|
export { BearerAuthenticator, isBearerAuthenticator } from './bearer-authenticator.js';
|
|
6
6
|
export { WatAuthenticator, isWatAuthenticator } from './wat-authenticator.js';
|
|
7
7
|
export { getAuthenticator } from './authenticator.js';
|
|
8
|
+
export { isAuthTokenPending } from './helpers.js';
|
|
8
9
|
export { HttpClient } from './http-client.js';
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { SsoAuthenticator, isSsoAuthenticator } from './sso-authenticator.js';
|
|
|
5
5
|
export { BearerAuthenticator, isBearerAuthenticator } from './bearer-authenticator.js';
|
|
6
6
|
export { WatAuthenticator, isWatAuthenticator } from './wat-authenticator.js';
|
|
7
7
|
export { getAuthenticator } from './authenticator.js';
|
|
8
|
+
export { isAuthTokenPending } from './helpers.js';
|
|
8
9
|
export { HttpClient } from './http-client.js';
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
import { BaseAuthenticator } from './base-authenticator.js';
|
|
12
12
|
import { appendHeaders } from './helpers.js';
|
|
13
|
+
import { TranslatableError } from './translation/translatable-error.js';
|
|
13
14
|
export class WatAuthenticator extends BaseAuthenticator {
|
|
14
15
|
constructor(url, wat) {
|
|
15
16
|
super('wat');
|
|
@@ -40,7 +41,9 @@ export class WatAuthenticator extends BaseAuthenticator {
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
catch (e) {
|
|
43
|
-
// empty catch block
|
|
44
|
+
// rather than returning empty catch block
|
|
45
|
+
// throw an error to be caught by Sisense context provider
|
|
46
|
+
throw new TranslatableError('errors.tokenAuthFailed');
|
|
44
47
|
}
|
|
45
48
|
finally {
|
|
46
49
|
this._resolve(false);
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.17.1",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": "./dist/index.js",
|
|
17
17
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Sisense",
|
|
21
21
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sisense/sdk-common": "^1.
|
|
23
|
+
"@sisense/sdk-common": "^1.17.1",
|
|
24
24
|
"fetch-intercept": "^2.4.0"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|