@saptools/cf-hana 0.1.4 → 0.1.5

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
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.5 - 2026-06-23
4
+
5
+ - Remove the CLI `--no-backup` opt-out so `cf-hana query` always attempts a
6
+ local backup before running `UPDATE` or `DELETE`.
7
+ - Keep backup paths on stderr and keep stdout parseable for table, JSON, and CSV
8
+ output.
9
+
3
10
  ## 0.1.4 - 2026-06-23
4
11
 
5
12
  - Add automatic local CSV backups before CLI `query` runs an `UPDATE` or
@@ -7,7 +14,7 @@
7
14
  - Derive the backup `SELECT` from the write target and top-level `WHERE`
8
15
  clause, preserving only the WHERE parameters for `UPDATE` statements.
9
16
  - Save each backup in its own non-expiring folder with `statement.sql` and
10
- `backup.csv`, and add `--no-backup` for explicit CLI opt-out.
17
+ `backup.csv`.
11
18
 
12
19
  ## 0.1.3 - 2026-06-23
13
20
 
package/README.md CHANGED
@@ -88,8 +88,8 @@ cf-hana info <selector> Print the resolved connection metada
88
88
  Common options: `--format <table|json|csv>`, `--refresh`, `--role <runtime|hdi>`,
89
89
  `--binding <name>` / `--binding-index <n>`, `--timeout <ms>`, `--read-only`,
90
90
  `--allow-destructive`, `--limit <n>`, `--no-auto-limit`. The `query` command also
91
- accepts `--param <value>` (repeatable) to bind `?` placeholders and
92
- `--no-backup` to skip the default write backup.
91
+ accepts `--param <value>` (repeatable) to bind `?` placeholders. CLI `UPDATE`
92
+ and `DELETE` statements are backed up automatically before the write runs.
93
93
 
94
94
  ```bash
95
95
  cf-hana query eu10/example-org/space-demo/app-demo "SELECT ID, STATUS FROM ORDERS WHERE STATUS = ?" \
@@ -169,13 +169,6 @@ rows returned by the derived `SELECT`. Backup folders are not deleted by
169
169
  `cf-hana`; clean them up manually when they are no longer needed. The backup path
170
170
  is printed to stderr so JSON and CSV stdout remain parseable.
171
171
 
172
- Use `--no-backup` when an external backup or transaction workflow already covers
173
- the write:
174
-
175
- ```bash
176
- cf-hana query app-demo "DELETE FROM ORDERS WHERE ID = ?" --param 42 --no-backup
177
- ```
178
-
179
172
  ## Safety
180
173
 
181
174
  - **Read-only mode** (`readOnly` / `--read-only`) rejects every DML and DDL statement.
package/dist/cli.js CHANGED
@@ -514,7 +514,7 @@ async function listColumns(connection, schema, table) {
514
514
 
515
515
  // src/config.ts
516
516
  var CLI_NAME = "cf-hana";
517
- var CLI_VERSION = "0.1.4";
517
+ var CLI_VERSION = "0.1.5";
518
518
  var ENV_PREFIX = "CF_HANA";
519
519
  var DEFAULT_QUERY_TIMEOUT_MS = 3e4;
520
520
  var DEFAULT_CONNECT_TIMEOUT_MS = 3e4;
@@ -1780,7 +1780,7 @@ async function runQuery(selector, sql, command) {
1780
1780
  const client = await connect(selector, toConnectOptions(opts));
1781
1781
  try {
1782
1782
  const params = opts.param ?? [];
1783
- const backup = opts.backup ? await client.backupWriteStatement(sql, params) : void 0;
1783
+ const backup = await client.backupWriteStatement(sql, params);
1784
1784
  if (backup !== void 0) {
1785
1785
  process.stderr.write(`${CLI_NAME}: backup saved to ${backup.directory}
1786
1786
  `);
@@ -1861,7 +1861,7 @@ function buildProgram() {
1861
1861
  const program = new Command();
1862
1862
  program.name(CLI_NAME).description("Run SQL against SAP HANA Cloud databases bound to a Cloud Foundry app").version(CLI_VERSION);
1863
1863
  withConnectionOptions(
1864
- program.command("query <selector> <sql>").description("run a single SQL statement").option("--param <value>", "bind a SQL parameter (repeatable)", collectParam, []).option("--no-backup", "skip the local CSV backup before UPDATE or DELETE")
1864
+ program.command("query <selector> <sql>").description("run a single SQL statement").option("--param <value>", "bind a SQL parameter (repeatable)", collectParam, [])
1865
1865
  ).action(async (selector, sql, _options, command) => {
1866
1866
  await runQuery(selector, sql, command);
1867
1867
  });