@sisense/sdk-cli 0.14.0 → 0.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.
@@ -7,24 +7,3 @@ export declare const promptPasswordInteractive: (username: string) => Promise<Ar
7
7
  maskedPassword: string;
8
8
  }>>;
9
9
  };
10
- export declare const promptCommand: () => Promise<any> & {
11
- ui: inquirer.ui.Prompt<any>;
12
- };
13
- export declare const promptUrl: () => Promise<any> & {
14
- ui: inquirer.ui.Prompt<any>;
15
- };
16
- export declare const promptAuth: () => Promise<any> & {
17
- ui: inquirer.ui.Prompt<any>;
18
- };
19
- export declare const promptPasswordAuth: () => Promise<any> & {
20
- ui: inquirer.ui.Prompt<any>;
21
- };
22
- export declare const promptTokenAuth: () => Promise<any> & {
23
- ui: inquirer.ui.Prompt<any>;
24
- };
25
- export declare const promptWatAuth: () => Promise<any> & {
26
- ui: inquirer.ui.Prompt<any>;
27
- };
28
- export declare const promptDataModel: () => Promise<any> & {
29
- ui: inquirer.ui.Prompt<any>;
30
- };
@@ -1,5 +1,4 @@
1
1
  import inquirer from 'inquirer';
2
- import { validateNotEmpty } from './interactive.js';
3
2
  export const promptPasswordInteractive = (username) => inquirer.prompt([
4
3
  {
5
4
  type: 'password',
@@ -14,88 +13,3 @@ export const promptPasswordInteractive = (username) => inquirer.prompt([
14
13
  },
15
14
  },
16
15
  ]);
17
- export const promptCommand = () => inquirer.prompt([
18
- {
19
- type: 'rawlist',
20
- name: 'command',
21
- message: 'Select command to run:',
22
- choices: ['get-data-model'],
23
- },
24
- ]);
25
- export const promptUrl = () => inquirer.prompt([
26
- {
27
- type: 'input',
28
- name: 'hostname',
29
- message: 'Specify the Sisense server IP address or hostname (example: 10.50.1.5):',
30
- validate: validateNotEmpty,
31
- },
32
- {
33
- type: 'number',
34
- name: 'port',
35
- message: 'Specify the Sisense server port or leave blank for default port:',
36
- default: 30845,
37
- },
38
- {
39
- type: 'list',
40
- name: 'protocol',
41
- message: 'Select http/https:',
42
- choices: ['http', 'https'],
43
- default: 'http',
44
- },
45
- ]);
46
- export const promptAuth = () => inquirer.prompt([
47
- {
48
- type: 'list',
49
- name: 'auth',
50
- message: 'Select authentication method:',
51
- choices: ['password', 'token', 'web access token'],
52
- default: 'password',
53
- },
54
- ]);
55
- export const promptPasswordAuth = () => inquirer.prompt([
56
- {
57
- type: 'input',
58
- name: 'username',
59
- message: 'Specify the username for username/password authentication:',
60
- },
61
- {
62
- type: 'password',
63
- name: 'password',
64
- mask: '*',
65
- message: 'Specify the password for username/password authentication:',
66
- validate: (input, answers) => {
67
- if (answers.username && answers.username !== '' && !input) {
68
- return 'if username is provided password cannot be blank';
69
- }
70
- return true;
71
- },
72
- },
73
- ]);
74
- export const promptTokenAuth = () => inquirer.prompt([
75
- {
76
- type: 'input',
77
- name: 'token',
78
- message: 'Specify the Bearer token for token-based authentication:',
79
- },
80
- ]);
81
- export const promptWatAuth = () => inquirer.prompt([
82
- {
83
- type: 'input',
84
- name: 'wat',
85
- message: 'Specify the web access token for token-based authentication:',
86
- },
87
- ]);
88
- export const promptDataModel = () => inquirer.prompt([
89
- {
90
- type: 'input',
91
- name: 'dataSource',
92
- message: 'Specify the data source name (for example: Sample ECommerce):',
93
- validate: validateNotEmpty,
94
- },
95
- {
96
- type: 'input',
97
- name: 'output',
98
- message: 'Specify the output filename:',
99
- validate: validateNotEmpty,
100
- },
101
- ]);
@@ -1 +1 @@
1
- export declare const PKG_VERSION = "0.14.0";
1
+ export declare const PKG_VERSION = "0.15.0";
@@ -1 +1 @@
1
- export const PKG_VERSION = "0.14.0";
1
+ export const PKG_VERSION = "0.15.0";
package/dist/run-cli.js CHANGED
@@ -4,11 +4,9 @@ import yargs from 'yargs';
4
4
  import { hideBin } from 'yargs/helpers';
5
5
  import { getDataModelCommand } from './commands/get-data-model.js';
6
6
  import { getApiTokenCommand } from './commands/get-api-token.js';
7
- import { interactiveCommand } from './commands/interactive.js';
8
7
  export const runCli = () => {
9
8
  yargs(hideBin(process.argv))
10
9
  .command(getDataModelCommand)
11
- .command(interactiveCommand)
12
10
  .command(getApiTokenCommand)
13
11
  .scriptName('sdk-cli')
14
12
  .showHelpOnFail(true)
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DataSource } from '@sisense/sdk-data';
2
- declare const COMMANDS: readonly ["get-data-model", "interactive", "get-api-token"];
2
+ declare const COMMANDS: readonly ["get-data-model", "get-api-token"];
3
3
  /**
4
4
  * The commands supported by the CLI tool.
5
5
  *
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
- const COMMANDS = ['get-data-model', 'interactive', 'get-api-token'];
1
+ const COMMANDS = ['get-data-model', 'get-api-token'];
2
2
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sisense/sdk-cli",
3
3
  "description": "CLI for generating programmatic interface from Sisense data model",
4
- "version": "0.14.0",
4
+ "version": "0.15.0",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "main": "./dist/index.js",
@@ -10,12 +10,12 @@
10
10
  "license": "SEE LICENSE IN LICENSE.md",
11
11
  "bin": "./dist/index.js",
12
12
  "dependencies": {
13
- "@sisense/sdk-common": "^0.14.0",
14
- "@sisense/sdk-data": "^0.14.0",
15
- "@sisense/sdk-modeling": "^0.14.0",
16
- "@sisense/sdk-query-client": "^0.14.0",
17
- "@sisense/sdk-rest-client": "^0.14.0",
18
- "@sisense/sdk-tracking": "^0.14.0",
13
+ "@sisense/sdk-common": "^0.15.0",
14
+ "@sisense/sdk-data": "^0.15.0",
15
+ "@sisense/sdk-modeling": "^0.15.0",
16
+ "@sisense/sdk-query-client": "^0.15.0",
17
+ "@sisense/sdk-rest-client": "^0.15.0",
18
+ "@sisense/sdk-tracking": "^0.15.0",
19
19
  "cross-fetch": "^4.0.0",
20
20
  "inquirer": "^8.1.2",
21
21
  "yargs": "17.7.1"
@@ -1,9 +0,0 @@
1
- import { ArgumentsCamelCase } from 'yargs';
2
- import { GetDataModelOptions } from '../types.js';
3
- export declare const handleHelper: (combinedAnswers: ArgumentsCamelCase<GetDataModelOptions>) => Promise<void>;
4
- export declare const validateNotEmpty: (input: string) => Promise<true | "this field cannot be blank">;
5
- export declare const interactiveCommand: {
6
- command: "interactive";
7
- desc: string;
8
- handler: () => Promise<void>;
9
- };
@@ -1,52 +0,0 @@
1
- /* eslint-disable max-lines-per-function */
2
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
- /* eslint-disable @typescript-eslint/no-use-before-define */
5
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
6
- /* eslint-disable @typescript-eslint/restrict-template-expressions */
7
- /* eslint-disable @typescript-eslint/no-shadow */
8
- /* eslint-disable @typescript-eslint/require-await */
9
- /* eslint-disable max-lines */
10
- /* eslint-disable @typescript-eslint/no-unsafe-return */
11
- import { getDataModel } from './get-data-model.js';
12
- import { promptCommand, promptUrl, promptAuth, promptPasswordAuth, promptTokenAuth, promptWatAuth, promptDataModel, } from './prompts.js';
13
- const command = 'interactive';
14
- const desc = 'Run in interactive mode';
15
- export const handleHelper = (combinedAnswers) => getDataModel(combinedAnswers, 'interactive');
16
- const handler = async () => {
17
- const cmd = await promptCommand();
18
- if (cmd.command !== 'get-data-model')
19
- return;
20
- const urlInput = await promptUrl();
21
- const url = `${urlInput.protocol}://${urlInput.hostname}:${urlInput.port}`;
22
- console.log(`\nSisense host URL: ${url}\n`);
23
- const auth = await promptAuth();
24
- let passwordAuthAnswers, tokenAuthAnswers, watAuthAnswers;
25
- if (auth.auth === 'password') {
26
- passwordAuthAnswers = await promptPasswordAuth();
27
- }
28
- else if (auth.auth === 'token') {
29
- tokenAuthAnswers = await promptTokenAuth();
30
- }
31
- else if (auth.auth === 'web access token') {
32
- watAuthAnswers = await promptWatAuth();
33
- }
34
- const answers = await promptDataModel();
35
- answers.url = url;
36
- return handleHelper({
37
- ...passwordAuthAnswers,
38
- ...tokenAuthAnswers,
39
- ...watAuthAnswers,
40
- ...answers,
41
- });
42
- };
43
- export const validateNotEmpty = async (input) => {
44
- if (input === undefined || input.trim() === '')
45
- return 'this field cannot be blank';
46
- return true;
47
- };
48
- export const interactiveCommand = {
49
- command,
50
- desc,
51
- handler,
52
- };