@sap/datasphere-cli 2023.18.0 → 2023.24.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,213 @@ All notable changes to this project SAP Datasphere Command-Line Interface (DS CL
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 2023.24.0
9
+
10
+ ### Fixed
11
+
12
+ - Trailing single quotes (`'`) were removed from option values even though there was no leading single quote. This version contains a fix that trailing single quotes are only removed if there is a leading single quote.
13
+
14
+ Trailing single quote is not removed: `some 'value'` stays `some 'value'`.
15
+
16
+ Trailing single quote is removed: `'some value'` becomes `some value`.
17
+
18
+ - The help output did not mention the correct CLI name. Instead the output showed the name 'terminal'.
19
+
20
+ ```javascript
21
+ Usage: terminal [options] [command]
22
+
23
+ Command-Line Interface for SAP Datasphere.
24
+ ...
25
+ ```
26
+
27
+ Since this version, the name is shown correctly.
28
+
29
+ ```javascript
30
+ Usage: datasphere [options] [command]
31
+
32
+ Command-Line Interface for SAP Datasphere.
33
+ ...
34
+ ```
35
+
36
+ ## 2023.19.0
37
+
38
+ ### Added
39
+
40
+ - Support for managing multiple logins/secrets for different tenants in parallel. The `datasphere login` and `datasphere logout` commands have been updated, allowing you to login to multiple tenants in parallel. When running a command, the CLI uses the secret matching the currently maintained tenant URL via the `-H, --host` option or set via `datasphere config host set <host>`. You now must specify the host which you are logging in to using option `-H, --host`, or by setting the host globally first by calling `datasphere config host set <host>`, to allow the CLI to store the secret for the defined tenant URL.
41
+
42
+ You can list all locally stored secrets by running `datasphere config secrets show`.
43
+
44
+ ```javascript
45
+ $ datasphere config secrets show
46
+ [
47
+ {
48
+ "id": 0,
49
+ "client_id": "sb-0d85e619...",
50
+ "client_secret": "1dcc0522-...",
51
+ "tenantUrl": "https://somehost.eu10.cloud.sap",
52
+ ...
53
+ },
54
+ {
55
+ "id": 1,
56
+ "client_id": "sb-0d85e619...",
57
+ "client_secret": "1dcc0522-...",
58
+ "tenantUrl": "https://somehost.us10.cloud.sap",
59
+ ...
60
+ }
61
+ ]
62
+ ```
63
+
64
+ In order to logout again, the `datasphere logout` command allows you to optionally specify the ID of the login/secret to remove using option `-l, --login-id <id>`.
65
+
66
+ ```javascript
67
+ datasphere logout --help
68
+ Usage: datasphere logout [options]
69
+
70
+ log out from your account
71
+
72
+ Options:
73
+ -l, --login-id <id> specifies the login ID (optional) (choices: "0", default: "0")
74
+ -h, --help display help for command
75
+ ```
76
+
77
+ By default, when you omit option `-l, --login-id <id>`, the login/secret with ID _0_ is removed.
78
+
79
+ You cannot login to the same tenant with different _access tokens_ at the same time. There can only be a single login/secret per tenant, but you can login into multiple tenants in parallel. If you need to login with different users into the same tenant, you have to logout first, then login again with a different user.
80
+
81
+ - Support for predefined OAuth clients where the client ID _does not_ start with the term `sb-`. When using a predefined OAuth client where the client ID _does not_ start with the term `sb-`, the CLI uses a different default port `65000` to retrieve the temporary code to retrieve the access token and refresh token. The port can be changed using the environment variable mentioned in the [README.md](README.md) file.
82
+
83
+ - Improved OAuth authorization URL and token URL support. You do not have to specify the options for the _OAuth Client Authorization URL_ and _Token URL_ anymore, if you specify the tenant URL using the _-H, --host_ option. The CLI calculates the required authorization and token URLs automatically based on the given _Client ID_, _Client Secret_, and _Tenant URL_. You can still use the respective options to provide values for the authorization URL and token URL to override the calculated values.
84
+
85
+ ### Changed
86
+
87
+ - Generic options are hidden for all commands. Before, all options where shown, including generic options applicable to any command.
88
+
89
+ ```bash
90
+ $ datasphere spaces read --help
91
+ Usage: datasphere spaces read [options]
92
+ fetch space details for a specified space
93
+ Options:
94
+ -V, --verbose print detailed log information to console (optional)
95
+ -O, --options-file <file> path to options file (optional)
96
+ -H, --host <host> specifies the url where the tenant is hosted (optional)
97
+ -c, --client-id <id> client id for interactive oauth session authentication (optional)
98
+ -C, --client-secret <secret> client secret for interactive oauth session authentication (optional)
99
+ -a, --access-token <token> access token for interactive oauth session authentication (optional)
100
+ -r, --refresh-token <token> refresh token for interactive oauth session authentication (optional)
101
+ -b, --code <code> code for oauth token retrieval (optional)
102
+ -t, --token-url <url> token url for interactive oauth session authentication (optional)
103
+ -A, --authorization-url <url> authorization url for interactive oauth session authentication (optional)
104
+ -p, --passcode <passcode> passcode for interactive session authentication (optional)
105
+ -s, --secrets-file <file> path to secrets file (optional)
106
+ -e, --expires-in <expires> expires in information for interactive oauth session authentication (optional)
107
+ -o, --output <output> specifies the file to store the output of the command (optional)
108
+ -P, --pretty pretty-formats JSON responses (optional)
109
+ -S, --space <space> space ID (optional)
110
+ -N, --no-space-definition do not read space definition (optional)
111
+ -m, --definitions [definitions] read definitions (optional)
112
+ -q, --connections [connections] read connections (optional)
113
+ -h, --help display help for command
114
+ ```
115
+
116
+ Now, only command-specific options are shown.
117
+
118
+ ```bash
119
+ $ datasphere spaces read --help
120
+ Usage: datasphere spaces read [options]
121
+ fetch space details for a specified space
122
+ Options:
123
+ -S, --space <space> space ID (optional)
124
+ -N, --no-space-definition do not read space definition (optional)
125
+ -m, --definitions [definitions] read definitions (optional)
126
+ -q, --connections [connections] read connections (optional)
127
+ -h, --help display help for command
128
+ Only command-specific options are listed here. To learn more about available generic options, visit https://your.generic.options.help.url
129
+ ```
130
+
131
+ - Option `-P, --pretty` changes to `-n, --no-pretty`. You can now supply option `-n, --no-pretty` to not pretty-format the response of a command. By default, the response of a command is pretty-formatted. When adding the option `-h, --help` to any command, the help tells you about the possible uses.
132
+
133
+ ```bash
134
+ $ datasphere spaces read --help
135
+ Usage: datasphere spaces read [options]
136
+
137
+ fetch space details for a specified space
138
+
139
+ Options:
140
+ -n, --no-pretty do not pretty-format JSON responses (optional)
141
+ -h, --help display help for command
142
+ ```
143
+
144
+ When calling a command that supports the `-P, --pretty` option you can explicitly specify to pretty-print the result.
145
+
146
+ `$ datasphere spaces read --pretty true`
147
+
148
+ To disable pretty-printing, set `-P, --pretty` to `false`.
149
+
150
+ `$ datasphere spaces read --pretty false`
151
+
152
+ Calling a command without specifying the `-P, --pretty` option explicitly yields the same output as when calling the command with `--pretty true`.
153
+
154
+ - A new top-level command `config` has been introduced. This command groups all the CLI configuration-related commands such as `cache`, `secrets`, `host`, ...
155
+
156
+ **Old Structure**
157
+
158
+ ```bash
159
+ $ datasphere
160
+ Usage: datasphere [options] [command]
161
+
162
+ Command-Line Interface for SAP Datasphere.
163
+
164
+ Options:
165
+ -v, --version output the current version
166
+ -H, --host <host> specifies the url where the tenant is hosted (optional)
167
+ -O, --options-file <file> path to options file (optional)
168
+ -h, --help display help for command
169
+
170
+ Commands:
171
+ cache work with the local CLI cache
172
+ dbusers [options] manage and orchestrate database users
173
+ help [command] display help for command
174
+ host configure host properties
175
+ login [options] log in to your account using interactive OAuth authentication
176
+ logout log out from your account
177
+ marketplace [options] manage and orchestrate your SAP Data Marketplace
178
+ passcode-url [options] display the passcode url
179
+ secrets work with the locally stored secrets
180
+ spaces [options] manage and orchestrate spaces
181
+ tasks [options] manage tasks
182
+ ```
183
+
184
+ **New Structure**
185
+
186
+ ```bash
187
+ $ datasphere
188
+ Usage: datasphere [options] [command]
189
+
190
+ Command-Line Interface for SAP Datasphere.
191
+
192
+ Options:
193
+ -v, --version output the current version
194
+ -H, --host <host> specifies the url where the tenant is hosted (optional)
195
+ -O, --options-file <file> path to options file (optional)
196
+ -h, --help display help for command
197
+
198
+ Commands:
199
+ config configure your CLI
200
+ dbusers [options] manage and orchestrate database users
201
+ help [command] display help for command
202
+ login [options] log in to your account using interactive OAuth authentication
203
+ logout log out from your account
204
+ marketplace [options] manage and orchestrate your SAP Data Marketplace
205
+ spaces [options] manage and orchestrate spaces
206
+ tasks [options] manage tasks
207
+ ```
208
+
209
+ - The environment variable `DWC_CLI_PORT` changed to `CLI_HTTP_PORT`.
210
+
211
+ ### Fixed
212
+
213
+ - Values entered for the _Authorization URL_ and _Token URL_ could be entered including query parameters like `https://some.authorization.url?some.parameter=some.value`. The CLI did not remove the query parameters when using the URLs to retrieve the temporary code. This has been changed, the query parameters are now removed. The CLI changes an URL from `https://some.authorization.url?some.parameter=some.value` to `https://some.authorization.url` to retrieve the temporary code.
214
+
8
215
  ## 2023.10.0
9
216
 
10
217
  Package `@sap/datasphere-cli` was released.
package/README.md CHANGED
@@ -100,13 +100,13 @@ $ datasphere secrets show
100
100
  If you do not want to log in and have the CLI store the secrets in the CLI cache locally, you can also provide the _access_token_ directly on the command line:
101
101
 
102
102
  ```bash
103
- $ datasphere cache init --host <my host> --access-token <access token>
103
+ $ datasphere config cache init --host <my host> --access-token <access token>
104
104
  ```
105
105
 
106
106
  Alternatively, you can provide the _access_token_ through a `secrets.json` file:
107
107
 
108
108
  ```bash
109
- $ datasphere cache init --host <my host> -secrets-file /path/to/secrets.json
109
+ $ datasphere config cache init --host <my host> -secrets-file /path/to/secrets.json
110
110
  ```
111
111
 
112
112
  The `secrets.json` file must at least contain a property called `access_token`:
@@ -126,7 +126,7 @@ Passcodes are used for authenticating commands sent from the CLI to your SAP Dat
126
126
  When omitting the `-p, --passcode` option the CLI prompts you to provide a passcode by navigating to the passcode authentication URL for your tenant. The URL is calculated based on the provided `-H, --host` value.
127
127
 
128
128
  ```bash
129
- $ datasphere cache init -H https://mytenant.eu10.hcs.cloud.sap/
129
+ $ datasphere config cache init -H https://mytenant.eu10.hcs.cloud.sap/
130
130
  ✔ Do you want to retrieve a passcode from https://mytenant.authentication.eu10.hana.ondemand.com/passcode? … yes
131
131
  ✔ Enter your temporary authentication code: … **********
132
132
  ...
@@ -152,16 +152,16 @@ You can either use the CLI from the terminal or command line, or use the module
152
152
  Before you can list and run commands against your SAP Datasphere tenant you need to initialize the CLI first. When initializing the CLI a service document is downloaded from your SAP Datasphere tenant which describes the commands your tenant is able to understand. To initialize the CLI run
153
153
 
154
154
  ```bash
155
- $ datasphere cache init -H https://mytenant.eu10.hcs.cloud.sap/ -p somepasscode
155
+ $ datasphere config cache init -H https://mytenant.eu10.hcs.cloud.sap/ -p somepasscode
156
156
  ```
157
157
 
158
- You can refresh the local copy of the service document by running the `cache init` command again.
158
+ You can refresh the local copy of the service document by running the `config cache init` command again.
159
159
 
160
- After you executed a command the CLI issues a warning in case the local version of the service document is outdated. In that case, run the `cache init` command again.
160
+ After you executed a command the CLI issues a warning in case the local version of the service document is outdated. In that case, run the `config cache init` command again.
161
161
 
162
162
  ```bash
163
163
  $ datasphere <command>
164
- Your local CLI cache is outdated. Run 'datasphere cache init' to update
164
+ Your local CLI cache is outdated. Run 'datasphere config cache init' to update
165
165
  ```
166
166
 
167
167
  #### List available commands
@@ -181,7 +181,7 @@ Options:
181
181
 
182
182
  Commands:
183
183
  cache clean clean the local CLI cache
184
- cache init [options] initialize the local CLI cache
184
+ config cache init [options] initialize the local CLI cache
185
185
  passcode-url [options] print the passcode url
186
186
  help [command] display help for command
187
187
  ```
@@ -201,7 +201,7 @@ Options:
201
201
 
202
202
  Commands:
203
203
  cache clean clean the local CLI cache
204
- cache init [options] initialize the local CLI cache
204
+ config cache init [options] initialize the local CLI cache
205
205
  spaces manage and orchestrate spaces
206
206
  passcode-url [options] print the passcode url
207
207
  help [command] display help for command
@@ -240,7 +240,7 @@ Options:
240
240
  -h, --help display help for command
241
241
  ```
242
242
 
243
- The list of available commands differs based on the content of the service document you downloaded when running `cache init`.
243
+ The list of available commands differs based on the content of the service document you downloaded when running `config cache init`.
244
244
 
245
245
  ### As a Node.js module dependency
246
246
 
@@ -252,7 +252,7 @@ const datasphere = require("@sap/datasphere-cli");
252
252
 
253
253
  #### Work with commands
254
254
 
255
- The module exports a `getCommands` function which returns a map of available commands. Make sure to always specify the `host` to receive `host`-specific commands. Otherwise, when omitting the `host` information, you will only get the list of general commands like `cache clean`, `cache init`, ...
255
+ The module exports a `getCommands` function which returns a map of available commands. Make sure to always specify the `host` to receive `host`-specific commands. Otherwise, when omitting the `host` information, you will only get the list of general commands like `cache clean`, `config cache init`, ...
256
256
 
257
257
  ```javascript
258
258
  const MY_HOST = "https://mytenant.eu10.hcs.cloud.sap/";
@@ -263,7 +263,7 @@ console.log(commands);
263
263
  // {
264
264
  // datasphere: [AsyncFunction],
265
265
  // 'cache clean': [AsyncFunction],
266
- // 'cache init': [AsyncFunction],
266
+ // 'config cache init': [AsyncFunction],
267
267
  // 'passcode-url': [AsyncFunction],
268
268
  // 'cache show': [AsyncFunction]
269
269
  // 'spaces create': [AsyncFunction]
@@ -282,7 +282,7 @@ const options = {
282
282
  "--passcode": "somepasscode",
283
283
  };
284
284
 
285
- await commands["cache init"](options);
285
+ await commands["config cache init"](options);
286
286
  ```
287
287
 
288
288
  `options` is a map of available options for the respective command. You have to supply either the short flag or long name of the option, including `-` or `--` for the short flag or long name.
@@ -383,9 +383,9 @@ await commands["spaces read"]({
383
383
  No matter how you use the CLI ([from the command-line](#from-the-command-line) or [as a Node.js module dependency](#as-a-nodejs-module-dependency)), you can supply values for options in different ways. To get an overview of the existing options per command, run `datasphere <command> --help`:
384
384
 
385
385
  ```bash
386
- $ datasphere cache init --help
386
+ $ datasphere config cache init --help
387
387
 
388
- Usage: datasphere cache init [options]
388
+ Usage: datasphere config cache init [options]
389
389
 
390
390
  initialize the local CLI cache
391
391
 
@@ -410,7 +410,7 @@ Options:
410
410
  You can use the short flag or long name to supply an option value on the command-line:
411
411
 
412
412
  ```bash
413
- $ datasphere cache init --host <host>
413
+ $ datasphere config cache init --host <host>
414
414
  ```
415
415
 
416
416
  #### Using environment variables
@@ -418,7 +418,7 @@ $ datasphere cache init --host <host>
418
418
  To provide an option value, the option's long name is translated to CONSTANT_CASE. For example, the option `client-id` can also be provided as follows:
419
419
 
420
420
  ```bash
421
- $ CLIENT_ID='<my client id>' HOST='my-host' datasphere cache init
421
+ $ CLIENT_ID='<my client id>' HOST='my-host' datasphere config cache init
422
422
  ```
423
423
 
424
424
  #### Provide options file
@@ -437,14 +437,14 @@ You can provide a JSON file with a map of options, using the option's long names
437
437
  Then, supply it to the CLI:
438
438
 
439
439
  ```bash
440
- $ datasphere cache init --options-file /path/to/options-file.json
440
+ $ datasphere config cache init --options-file /path/to/options-file.json
441
441
  ```
442
442
 
443
443
  ### Environment Variables
444
444
 
445
445
  The CLI supports the following environment variables. You can set the environment variables when calling the CLI according to the local environment. In addition, the CLI supports the [`dotenv`](https://www.npmjs.com/package/dotenv#usage) module, allowing you to place a `.env` file in the CLI working directory.
446
446
 
447
- #### `DWC_CLI_PORT`
447
+ #### `CLI_HTTP_PORT`
448
448
 
449
449
  Defines the port the CLI starts the HTTP server at when logging in when using OAuth clients for authentication.
450
450
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/datasphere-cli",
3
- "version": "2023.18.0",
3
+ "version": "2023.24.0",
4
4
  "description": "Command-Line Interface for SAP Datasphere.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "SAP SE",
@@ -19,6 +19,6 @@
19
19
  "datasphere-cli"
20
20
  ],
21
21
  "dependencies": {
22
- "@sap/cli-core": "2023.17.0"
22
+ "@sap/cli-core": "2023.23.0"
23
23
  }
24
24
  }
package/utils.js CHANGED
@@ -10,6 +10,7 @@ const configure = () => {
10
10
  description: (0, cli_core_1.getDescription)(__dirname),
11
11
  sapHelpLink: "tinyurl.com/datasphere-cli-help",
12
12
  version: (0, cli_core_1.getVersion)(__dirname),
13
+ genericOptionsHelp: "https://tinyurl.com/yck8vv4w",
13
14
  authenticationMethods: [
14
15
  cli_core_1.AuthenticationMethod.oauth,
15
16
  cli_core_1.AuthenticationMethod.passcode,