@saptools/cf-hana 0.4.0 → 0.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
@@ -2,6 +2,24 @@
2
2
 
3
3
  <!-- cspell:words VARCHAR -->
4
4
 
5
+ ## 0.5.0 - 2026-07-25
6
+
7
+ - Add an SSH-tunnel fallback for HANA Cloud hosts unreachable directly (e.g.
8
+ IP-allowlisted landscapes): on a classified connectivity failure, discover
9
+ a jump-host app in the same org/space via `cf apps`, open a local
10
+ `cf ssh -L` port-forward, and retry through it. Zero behavior change when
11
+ the direct connection succeeds.
12
+ - Add `--tunnel` to skip the direct attempt and connect via a tunnel
13
+ immediately, and `--refresh-tunnel` to bypass a cached/live tunnel and
14
+ force a fresh attempt. No disable switch: the fallback can only help or
15
+ no-op, and rethrows the original connection error unchanged on total
16
+ failure.
17
+ - Persist and reuse the live tunnel under `~/.saptools/cf-hana/tunnel/`
18
+ across every connection this CLI's pool opens and across separate
19
+ invocations run in a row against the same host, with a race-free
20
+ concurrent-establishment marker and automatic reaping of dead or
21
+ cross-org tunnels.
22
+
5
23
  ## 0.4.0 - 2026-07-14
6
24
 
7
25
  - Back up `REPLACE` and matched `MERGE INTO` pre-images, cap backup size, and
package/README.md CHANGED
@@ -105,7 +105,8 @@ cf-hana result <command> Inspect saved query refs
105
105
 
106
106
  Common options: `--refresh` (deprecated compatibility flag; binding discovery is already live), `--role <runtime|hdi>`, `--binding <name>` /
107
107
  `--binding-index <n>`, `--timeout <ms>`, `--read-only`, `--allow-destructive`,
108
- `--limit <n>`, `--no-auto-limit`. The `query` command also accepts
108
+ `--limit <n>`, `--no-auto-limit`, `--tunnel`, `--refresh-tunnel` (see
109
+ [Connectivity fallback](#connectivity-fallback)). The `query` command also accepts
109
110
  `--param <value>` (repeatable), `--cell-limit <n>`, `--save`, `--no-auto-save`,
110
111
  `--format <table|json|json-compact|csv>`, `--result-ttl-minutes <n>`, and
111
112
  `--refresh-metadata`. `tables` and `columns` support the same four format values.
@@ -351,6 +352,47 @@ mode `0600`.
351
352
  The guard is a convenience, not a security control: always pass values as bound
352
353
  parameters.
353
354
 
355
+ ## Connectivity fallback
356
+
357
+ HANA Cloud instances are frequently IP-allowlisted to only accept connections
358
+ from inside the same Cloud Foundry landscape. When a direct connection fails
359
+ in a way that means the initial socket could never be established — not an
360
+ authentication, privilege, or query failure — `cf-hana` can retry through an
361
+ SSH port-forward opened via `cf ssh` against another app in the same org/space,
362
+ which usually can reach the host even when your machine cannot.
363
+
364
+ - **`auto` (default)**: tries the direct connection first, with zero added
365
+ behavior when it succeeds. Only a classified connectivity failure triggers
366
+ the fallback: discover a jump-host app (the target app itself, then a few
367
+ other started apps via `cf apps`), open a local port-forward, and retry
368
+ through `127.0.0.1`.
369
+ - **`--tunnel`**: skips the direct attempt and connects via a tunnel
370
+ immediately — for a host already known to be unreachable directly, so you
371
+ are not paying the connect-timeout cost (up to 60s) on every invocation.
372
+ - **`--refresh-tunnel`**: bypasses a cached/live tunnel and forces a fresh
373
+ establishment attempt.
374
+
375
+ There is deliberately no flag to disable this capability: a tunnel attempt
376
+ only ever engages after a direct failure (or when explicitly requested via
377
+ `--tunnel`), and on total failure it rethrows the original connection error
378
+ unchanged, so it can only help or no-op.
379
+
380
+ The live tunnel is reused — both across every connection this CLI's own pool
381
+ opens in one invocation, and across separate `cf-hana` invocations run in a
382
+ row against the same host (this CLI's realistic dominant usage pattern, e.g.
383
+ an AI agent running several queries back to back) — instead of re-negotiating
384
+ SSH on every single command. State lives at `~/.saptools/cf-hana/tunnel/`
385
+ (mode `0700`/`0600`, no credentials). A cached tunnel is closed immediately,
386
+ regardless of its remaining lifetime, the moment a later invocation targets a
387
+ different Cloud Foundry org — a different client's landscape never keeps an
388
+ unattended live SSH path open just because its keepalive has not lapsed.
389
+
390
+ In the worst case (a silently-dropping network path, so the direct attempt
391
+ runs its full connect timeout, and no candidate app works either), `auto`
392
+ mode takes roughly 60s (direct) + 25s (tunnel budget) before surfacing a
393
+ final error — bounded and predictable, not open-ended. Use `--tunnel` to skip
394
+ the 60s direct cost for a host you already know is unreachable.
395
+
354
396
  ## Requirements
355
397
 
356
398
  - Node.js >= 20.