@sisense/sdk-cli 1.14.0 → 1.15.0
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.
|
@@ -29,7 +29,7 @@ const handler = async (options) => {
|
|
|
29
29
|
if (username && !password) {
|
|
30
30
|
({ maskedPassword: password } = await promptPasswordInteractive(username));
|
|
31
31
|
}
|
|
32
|
-
const httpClient = getHttpClient(url, username, password);
|
|
32
|
+
const httpClient = getHttpClient({ url, username, password });
|
|
33
33
|
try {
|
|
34
34
|
await handleHttpClientLogin(httpClient);
|
|
35
35
|
trackExecution(httpClient, command, options);
|
|
@@ -70,7 +70,7 @@ export const getDataModel = async (options, commandName) => {
|
|
|
70
70
|
if (username && !password) {
|
|
71
71
|
({ maskedPassword: password } = await promptPasswordInteractive(username));
|
|
72
72
|
}
|
|
73
|
-
const httpClient = getHttpClient(url, username, password, token, wat);
|
|
73
|
+
const httpClient = getHttpClient({ url, username, password, token, wat });
|
|
74
74
|
try {
|
|
75
75
|
await handleHttpClientLogin(httpClient);
|
|
76
76
|
trackExecution(httpClient, commandName, options);
|
|
@@ -2,7 +2,14 @@ import { HttpClient } from '@sisense/sdk-rest-client';
|
|
|
2
2
|
import { DataModel } from '@sisense/sdk-data';
|
|
3
3
|
import { DataSourceField } from '@sisense/sdk-query-client';
|
|
4
4
|
import { DataSourceSchemaDataset } from '../types.js';
|
|
5
|
-
declare
|
|
5
|
+
declare type HttpClientConfig = {
|
|
6
|
+
url: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
wat?: string;
|
|
11
|
+
};
|
|
12
|
+
declare function getHttpClient({ url, username, password, token, wat }: HttpClientConfig): HttpClient;
|
|
6
13
|
export declare const handleHttpClientLogin: (httpClient: HttpClient) => Promise<void>;
|
|
7
14
|
/**
|
|
8
15
|
* Create a data model for a Sisense data source
|
package/dist/commands/helpers.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
8
|
-
import { HttpClient, getAuthenticator, WatAuthenticator, BearerAuthenticator, } from '@sisense/sdk-rest-client';
|
|
1
|
+
import { HttpClient, getAuthenticator, isBearerAuthenticator, isWatAuthenticator, } from '@sisense/sdk-rest-client';
|
|
9
2
|
import { MetadataTypes } from '@sisense/sdk-data';
|
|
10
3
|
import { writeTypescript, writeJavascript } from '@sisense/sdk-modeling';
|
|
11
4
|
import path from 'path';
|
|
@@ -13,8 +6,8 @@ import levenshtein from 'js-levenshtein';
|
|
|
13
6
|
import { DimensionalQueryClient, } from '@sisense/sdk-query-client';
|
|
14
7
|
import { PKG_VERSION } from '../package-version.js';
|
|
15
8
|
import { trackCliError } from '@sisense/sdk-tracking';
|
|
16
|
-
function getHttpClient(url, username, password, token, wat) {
|
|
17
|
-
const auth = getAuthenticator(url, username, password, token, wat
|
|
9
|
+
function getHttpClient({ url, username, password, token, wat }) {
|
|
10
|
+
const auth = getAuthenticator({ url, username, password, token, wat });
|
|
18
11
|
if (!auth) {
|
|
19
12
|
throw new Error('Invalid authentication method');
|
|
20
13
|
}
|
|
@@ -25,8 +18,7 @@ export const handleHttpClientLogin = async (httpClient) => {
|
|
|
25
18
|
try {
|
|
26
19
|
const isLoggedIn = await httpClient.login();
|
|
27
20
|
if (!isLoggedIn) {
|
|
28
|
-
console.log(`Failed. ${httpClient.auth
|
|
29
|
-
httpClient.auth instanceof BearerAuthenticator
|
|
21
|
+
console.log(`Failed. ${isWatAuthenticator(httpClient.auth) || isBearerAuthenticator(httpClient.auth)
|
|
30
22
|
? 'Double-check your token'
|
|
31
23
|
: 'Wrong credentials'}.\r\n`);
|
|
32
24
|
}
|
|
@@ -34,9 +26,8 @@ export const handleHttpClientLogin = async (httpClient) => {
|
|
|
34
26
|
}
|
|
35
27
|
catch (err) {
|
|
36
28
|
console.log(`Error connecting to ${httpClient.url}. \r\n${err}\r\n`);
|
|
37
|
-
|
|
29
|
+
throw err;
|
|
38
30
|
}
|
|
39
|
-
return Promise.resolve();
|
|
40
31
|
};
|
|
41
32
|
async function retrieveDataSource(queryClient, dataSourceTitle) {
|
|
42
33
|
console.log('Getting data source... ');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PKG_VERSION = "1.
|
|
1
|
+
export declare const PKG_VERSION = "1.15.0";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PKG_VERSION = "1.
|
|
1
|
+
export const PKG_VERSION = "1.15.0";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.15.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": "./dist/index.js",
|
|
17
17
|
"main": "./dist/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"bin": "./dist/index.js",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sisense/sdk-common": "^1.
|
|
24
|
-
"@sisense/sdk-data": "^1.
|
|
25
|
-
"@sisense/sdk-modeling": "^1.
|
|
26
|
-
"@sisense/sdk-query-client": "^1.
|
|
27
|
-
"@sisense/sdk-rest-client": "^1.
|
|
28
|
-
"@sisense/sdk-tracking": "^1.
|
|
23
|
+
"@sisense/sdk-common": "^1.15.0",
|
|
24
|
+
"@sisense/sdk-data": "^1.15.0",
|
|
25
|
+
"@sisense/sdk-modeling": "^1.15.0",
|
|
26
|
+
"@sisense/sdk-query-client": "^1.15.0",
|
|
27
|
+
"@sisense/sdk-rest-client": "^1.15.0",
|
|
28
|
+
"@sisense/sdk-tracking": "^1.15.0",
|
|
29
29
|
"cross-fetch": "^4.0.0",
|
|
30
30
|
"inquirer": "^8.1.2",
|
|
31
31
|
"js-levenshtein": "^1.1.6",
|