@sap/datasphere-cli 2023.14.0 → 2023.19.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 +179 -0
- package/README.md +20 -20
- package/package.json +4 -4
- package/utils.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,185 @@ 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.19.0
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- 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.
|
|
13
|
+
|
|
14
|
+
You can list all locally stored secrets by running `datasphere config secrets show`.
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
$ datasphere config secrets show
|
|
18
|
+
[
|
|
19
|
+
{
|
|
20
|
+
"id": 0,
|
|
21
|
+
"client_id": "sb-0d85e619...",
|
|
22
|
+
"client_secret": "1dcc0522-...",
|
|
23
|
+
"tenantUrl": "https://somehost.eu10.cloud.sap",
|
|
24
|
+
...
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": 1,
|
|
28
|
+
"client_id": "sb-0d85e619...",
|
|
29
|
+
"client_secret": "1dcc0522-...",
|
|
30
|
+
"tenantUrl": "https://somehost.us10.cloud.sap",
|
|
31
|
+
...
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
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>`.
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
datasphere logout --help
|
|
40
|
+
Usage: datasphere logout [options]
|
|
41
|
+
|
|
42
|
+
log out from your account
|
|
43
|
+
|
|
44
|
+
Options:
|
|
45
|
+
-l, --login-id <id> specifies the login ID (optional) (choices: "0", default: "0")
|
|
46
|
+
-h, --help display help for command
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
By default, when you omit option `-l, --login-id <id>`, the login/secret with ID _0_ is removed.
|
|
50
|
+
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
- 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.
|
|
54
|
+
|
|
55
|
+
- 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.
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- Generic options are hidden for all commands. Before, all options where shown, including generic options applicable to any command.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
$ datasphere spaces read --help
|
|
63
|
+
Usage: datasphere spaces read [options]
|
|
64
|
+
fetch space details for a specified space
|
|
65
|
+
Options:
|
|
66
|
+
-V, --verbose print detailed log information to console (optional)
|
|
67
|
+
-O, --options-file <file> path to options file (optional)
|
|
68
|
+
-H, --host <host> specifies the url where the tenant is hosted (optional)
|
|
69
|
+
-c, --client-id <id> client id for interactive oauth session authentication (optional)
|
|
70
|
+
-C, --client-secret <secret> client secret for interactive oauth session authentication (optional)
|
|
71
|
+
-a, --access-token <token> access token for interactive oauth session authentication (optional)
|
|
72
|
+
-r, --refresh-token <token> refresh token for interactive oauth session authentication (optional)
|
|
73
|
+
-b, --code <code> code for oauth token retrieval (optional)
|
|
74
|
+
-t, --token-url <url> token url for interactive oauth session authentication (optional)
|
|
75
|
+
-A, --authorization-url <url> authorization url for interactive oauth session authentication (optional)
|
|
76
|
+
-p, --passcode <passcode> passcode for interactive session authentication (optional)
|
|
77
|
+
-s, --secrets-file <file> path to secrets file (optional)
|
|
78
|
+
-e, --expires-in <expires> expires in information for interactive oauth session authentication (optional)
|
|
79
|
+
-o, --output <output> specifies the file to store the output of the command (optional)
|
|
80
|
+
-P, --pretty pretty-formats JSON responses (optional)
|
|
81
|
+
-S, --space <space> space ID (optional)
|
|
82
|
+
-N, --no-space-definition do not read space definition (optional)
|
|
83
|
+
-m, --definitions [definitions] read definitions (optional)
|
|
84
|
+
-q, --connections [connections] read connections (optional)
|
|
85
|
+
-h, --help display help for command
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Now, only command-specific options are shown.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
$ datasphere spaces read --help
|
|
92
|
+
Usage: datasphere spaces read [options]
|
|
93
|
+
fetch space details for a specified space
|
|
94
|
+
Options:
|
|
95
|
+
-S, --space <space> space ID (optional)
|
|
96
|
+
-N, --no-space-definition do not read space definition (optional)
|
|
97
|
+
-m, --definitions [definitions] read definitions (optional)
|
|
98
|
+
-q, --connections [connections] read connections (optional)
|
|
99
|
+
-h, --help display help for command
|
|
100
|
+
Only command-specific options are listed here. To learn more about available generic options, visit https://your.generic.options.help.url
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- 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.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
$ datasphere spaces read --help
|
|
107
|
+
Usage: datasphere spaces read [options]
|
|
108
|
+
|
|
109
|
+
fetch space details for a specified space
|
|
110
|
+
|
|
111
|
+
Options:
|
|
112
|
+
-n, --no-pretty do not pretty-format JSON responses (optional)
|
|
113
|
+
-h, --help display help for command
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
When calling a command that supports the `-P, --pretty` option you can explicitly specify to pretty-print the result.
|
|
117
|
+
|
|
118
|
+
`$ datasphere spaces read --pretty true`
|
|
119
|
+
|
|
120
|
+
To disable pretty-printing, set `-P, --pretty` to `false`.
|
|
121
|
+
|
|
122
|
+
`$ datasphere spaces read --pretty false`
|
|
123
|
+
|
|
124
|
+
Calling a command without specifying the `-P, --pretty` option explicitly yields the same output as when calling the command with `--pretty true`.
|
|
125
|
+
|
|
126
|
+
- A new top-level command `config` has been introduced. This command groups all the CLI configuration-related commands such as `cache`, `secrets`, `host`, ...
|
|
127
|
+
|
|
128
|
+
**Old Structure**
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
$ datasphere
|
|
132
|
+
Usage: datasphere [options] [command]
|
|
133
|
+
|
|
134
|
+
Command-Line Interface for SAP Datasphere.
|
|
135
|
+
|
|
136
|
+
Options:
|
|
137
|
+
-v, --version output the current version
|
|
138
|
+
-H, --host <host> specifies the url where the tenant is hosted (optional)
|
|
139
|
+
-O, --options-file <file> path to options file (optional)
|
|
140
|
+
-h, --help display help for command
|
|
141
|
+
|
|
142
|
+
Commands:
|
|
143
|
+
cache work with the local CLI cache
|
|
144
|
+
dbusers [options] manage and orchestrate database users
|
|
145
|
+
help [command] display help for command
|
|
146
|
+
host configure host properties
|
|
147
|
+
login [options] log in to your account using interactive OAuth authentication
|
|
148
|
+
logout log out from your account
|
|
149
|
+
marketplace [options] manage and orchestrate your SAP Data Marketplace
|
|
150
|
+
passcode-url [options] display the passcode url
|
|
151
|
+
secrets work with the locally stored secrets
|
|
152
|
+
spaces [options] manage and orchestrate spaces
|
|
153
|
+
tasks [options] manage tasks
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**New 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
|
+
config configure your CLI
|
|
172
|
+
dbusers [options] manage and orchestrate database users
|
|
173
|
+
help [command] display help for command
|
|
174
|
+
login [options] log in to your account using interactive OAuth authentication
|
|
175
|
+
logout log out from your account
|
|
176
|
+
marketplace [options] manage and orchestrate your SAP Data Marketplace
|
|
177
|
+
spaces [options] manage and orchestrate spaces
|
|
178
|
+
tasks [options] manage tasks
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- The environment variable `DWC_CLI_PORT` changed to `CLI_HTTP_PORT`.
|
|
182
|
+
|
|
183
|
+
### Fixed
|
|
184
|
+
|
|
185
|
+
- 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.
|
|
186
|
+
|
|
8
187
|
## 2023.10.0
|
|
9
188
|
|
|
10
189
|
Package `@sap/datasphere-cli` was released.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Command-Line Interface (CLI) for SAP Datasphere.
|
|
4
4
|
|
|
5
|
-
[](https://nodejs.org/dist/latest-v18.x/docs/api/#) [](https://badge.fury.io/js/@sap%2Fdatasphere-cli) [](https://help.sap.com/docs/SAP_DATASPHERE/d0ecd6f297ac40249072a44df0549c1a/3f9a42ccde6b4b6aba121e2aab79c36d.html) [](#usage) 
|
|
6
6
|
|
|
7
7
|
## Content
|
|
8
8
|
|
|
@@ -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
|
-
#### `
|
|
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.
|
|
3
|
+
"version": "2023.19.0",
|
|
4
4
|
"description": "Command-Line Interface for SAP Datasphere.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "SAP SE",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"datasphere": "terminal.js"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
|
-
"node": "^
|
|
14
|
-
"npm": "^
|
|
13
|
+
"node": "^18",
|
|
14
|
+
"npm": "^9"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"cli",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"datasphere-cli"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sap/cli-core": "2023.
|
|
22
|
+
"@sap/cli-core": "2023.18.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,
|