@sap/datasphere-cli 2024.4.0 → 2024.5.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,62 @@ 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
+ ## 2024.5.0
9
+
10
+ ### Added
11
+
12
+ - Support for Node versions `18`, `19`, `20`, `21`.
13
+
14
+ - When using the CLI as a [As a Node.js module dependency](README.md#as-a-nodejs-module-dependency) and running a command which creates an entity where the CLI would print the command to retrieve the result when running the command to create the entity in the terminal, for example:
15
+
16
+ ```bash
17
+ datasphere spaces create -H https://mytenant.eu10.hcs.cloud.sap/ -f ./MY_SPACE.json
18
+ Use datasphere spaces read --space-id MY_SPACE to retrieve the entity you just created
19
+ ```
20
+
21
+ the CLI now returns the command to execute as an object:
22
+
23
+ ```bash
24
+ const retrieveCommand = await commands["spaces create"]({
25
+ "--file-path": "MY_SPACE.json",
26
+ "--host": "https://mytenant.eu10.hcs.cloud.sap/",
27
+ });
28
+
29
+ console.log(retrieveCommand);
30
+ // {
31
+ // command: "spaces read",
32
+ // options: {
33
+ // "--space-id": "MY_SPACE"
34
+ // },
35
+ // }
36
+ ```
37
+
38
+ You can use the returned response to immediately issue the command to read the entity:
39
+
40
+ ```bash
41
+ const retrieveCommand = await commands["spaces create"]({
42
+ "--file-path": "MY_SPACE.json",
43
+ "--host": "https://mytenant.eu10.hcs.cloud.sap/",
44
+ });
45
+
46
+ const response = await commands[retrieveCommand.command]({
47
+ ...retrieveCommand.options,
48
+ "--host": "https://mytenant.eu10.hcs.cloud.sap/",
49
+ });
50
+
51
+ console.log(response);
52
+ // {
53
+ // MY_SPACE: {
54
+ // version: "1.0.4",
55
+ // ...
56
+ // }
57
+ // }
58
+ ```
59
+
60
+ ### Fixed
61
+
62
+ - When the host is globally configured via the command `datasphere config host set <host>`, any other host specified via option `-H, --host` was ignored when running a command. This often led to confusion when users specify the host explicitly via option `-H, --host`, but are not aware that the host was globally configured, too. Now, option `-H, --host` always takes precedence over the globally configured host.
63
+
8
64
  ## 2024.3.0
9
65
 
10
66
  ### Changed
@@ -26,8 +82,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
82
  - When printing the help information for the `login` command, the list of options now includes the login-specific options such as `--authorization-url` and `--token-url`. Previously the help showed the following options:
27
83
 
28
84
  ```bash
29
- <CLI> login --help
30
- Usage: <CLI> login [options]
85
+ datasphere login --help
86
+ Usage: datasphere login [options]
31
87
  log in to your account using interactive OAuth authentication
32
88
  Options:
33
89
  -H, --host <host> specifies the url where the tenant is hosted (optional)
@@ -37,8 +93,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
37
93
  With this version, the help looks like this:
38
94
 
39
95
  ```bash
40
- <CLI> login --help
41
- Usage: <CLI> login [options]
96
+ datasphere login --help
97
+ Usage: datasphere login [options]
42
98
  log in to your account using interactive OAuth authentication
43
99
  Options:
44
100
  -H, --host <host> specifies the url where the tenant is hosted (optional)
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Command-Line Interface (CLI) for SAP Datasphere.
4
4
 
5
- [![Node Version](https://img.shields.io/badge/node-18.xx.x-brightgreen)](https://nodejs.org/dist/latest-v18.x/docs/api/#) [![npm version](https://badge.fury.io/js/@sap%2Fdatasphere-cli.svg)](https://badge.fury.io/js/@sap%2Fdatasphere-cli) [![Documentation](https://img.shields.io/badge/docs-online-ff69b4.svg)](https://help.sap.com/docs/SAP_DATASPHERE/d0ecd6f297ac40249072a44df0549c1a/3f9a42ccde6b4b6aba121e2aab79c36d.html) [![Command help pages](https://img.shields.io/badge/command-help-lightgrey.svg)](#usage) ![NPM](https://img.shields.io/npm/l/@sap/datasphere-cli?color=%23FFFF00)
5
+ [![Node Version](https://img.shields.io/badge/node-18.xx.x-brightgreen)](https://nodejs.org/dist/latest-v18.x/docs/api/#) [![Node Version](https://img.shields.io/badge/node-19.xx.x-brightgreen)](https://nodejs.org/dist/latest-v19.x/docs/api/#) [![Node Version](https://img.shields.io/badge/node-20.xx.x-brightgreen)](https://nodejs.org/dist/latest-v20.x/docs/api/#) [![Node Version](https://img.shields.io/badge/node-21.xx.x-brightgreen)](https://nodejs.org/dist/latest-v21.x/docs/api/#) [![npm version](https://badge.fury.io/js/@sap%2Fdatasphere-cli.svg)](https://badge.fury.io/js/@sap%2Fdatasphere-cli) [![Documentation](https://img.shields.io/badge/docs-online-ff69b4.svg)](https://help.sap.com/docs/SAP_DATASPHERE/d0ecd6f297ac40249072a44df0549c1a/3f9a42ccde6b4b6aba121e2aab79c36d.html) [![Command help pages](https://img.shields.io/badge/command-help-lightgrey.svg)](#usage) ![NPM](https://img.shields.io/npm/l/@sap/datasphere-cli?color=%23FFFF00)
6
6
 
7
7
  ## Content
8
8
 
@@ -287,6 +287,52 @@ await commands["config cache init"](options);
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.
289
289
 
290
+ When running a command which creates an entity where the CLI would print the command to retrieve the result when running the command to create the entity in the terminal, for example:
291
+
292
+ ```bash
293
+ datasphere spaces create -H https://mytenant.eu10.hcs.cloud.sap/ -f ./MY_SPACE.json
294
+ Use datasphere spaces read --space-id MY_SPACE to retrieve the entity you just created
295
+ ```
296
+
297
+ the CLI now returns the command to execute as an object:
298
+
299
+ ```bash
300
+ const retrieveCommand = await commands["spaces create"]({
301
+ "--file-path": "MY_SPACE.json",
302
+ "--host": "https://mytenant.eu10.hcs.cloud.sap/",
303
+ });
304
+
305
+ console.log(retrieveCommand);
306
+ // {
307
+ // command: "spaces read",
308
+ // options: {
309
+ // "--space-id": "MY_SPACE"
310
+ // },
311
+ // }
312
+ ```
313
+
314
+ You can use the returned response to immediately issue the command to read the entity:
315
+
316
+ ```bash
317
+ const retrieveCommand = await commands["spaces create"]({
318
+ "--file-path": "MY_SPACE.json",
319
+ "--host": "https://mytenant.eu10.hcs.cloud.sap/",
320
+ });
321
+
322
+ const response = await commands[retrieveCommand.command]({
323
+ ...retrieveCommand.options,
324
+ "--host": "https://mytenant.eu10.hcs.cloud.sap/",
325
+ });
326
+
327
+ console.log(response);
328
+ // {
329
+ // MY_SPACE: {
330
+ // version: "1.0.4",
331
+ // ...
332
+ // }
333
+ // }
334
+ ```
335
+
290
336
  #### Handle errors during command execution
291
337
 
292
338
  If the command fails, an error is thrown you can catch and process as usual:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/datasphere-cli",
3
- "version": "2024.4.0",
3
+ "version": "2024.5.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": "^20",
14
- "npm": "^10"
13
+ "node": "^18 || ^19 || ^20 || ^21",
14
+ "npm": "^9 || ^10"
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": "2024.3.0"
22
+ "@sap/cli-core": "2024.4.0"
23
23
  }
24
24
  }
package/utils.js CHANGED
@@ -6,7 +6,7 @@ const configure = () => {
6
6
  (0, cli_core_1.configureCoreModule)({
7
7
  name: (0, cli_core_1.getBin)(__dirname),
8
8
  packageName: (0, cli_core_1.getPackageName)(__dirname),
9
- discoveryPath: "/dwaas-core/api/v1/discovery",
9
+ discoveryPaths: ["/dwaas-core/api/v1/discovery"],
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),