@saptools/cf-hana 0.2.2 → 0.3.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
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 - 2026-07-01
4
+
5
+ - Add invalid table/view recovery suggestions for failed `query` statements, with nearby table and view names printed to stderr so stdout remains parseable.
6
+ - Add a private local metadata cache under `~/.saptools/cf-hana/metadata` with a strict 30-minute TTL and `--refresh-metadata` bypass.
7
+ - Include schema-scoped `SYS.TABLES` and `SYS.VIEWS` metadata for suggestions without caching credentials, parameters, result rows, or table data.
8
+
3
9
  ## 0.2.0 - 2026-06-25
4
10
 
5
11
  - Change CLI `query` output for `SELECT`/`WITH` statements to compact CSV and
package/README.md CHANGED
@@ -22,6 +22,7 @@ login on the hot path) and connections are pooled and reused within a process.
22
22
  - **Query-builder shorthands** — `selectFrom`, `count`, `insertInto`, `update`,
23
23
  `deleteFrom` — query a table by name without writing SQL.
24
24
  - **Schema introspection** — list schemas, tables, and columns.
25
+ - **Table-name recovery** — failed CLI queries for missing tables/views show nearby schema-local suggestions on stderr.
25
26
  - **Local SQL history** — direct SQL calls are appended to dated JSONL files
26
27
  under `~/.saptools/cf-hana/histories/` with five-day retention.
27
28
  - **Write backups** — CLI `UPDATE`, `UPSERT`, and `DELETE` statements create a local CSV
@@ -91,8 +92,8 @@ cf-hana result <command> Inspect saved query refs
91
92
  Common options: `--refresh`, `--role <runtime|hdi>`, `--binding <name>` /
92
93
  `--binding-index <n>`, `--timeout <ms>`, `--read-only`, `--allow-destructive`,
93
94
  `--limit <n>`, `--no-auto-limit`. The `query` command also accepts
94
- `--param <value>` (repeatable), `--cell-limit <n>`, `--save`, and
95
- `--result-ttl-minutes <n>`. `tables` and `columns` still support
95
+ `--param <value>` (repeatable), `--cell-limit <n>`, `--save`,
96
+ `--result-ttl-minutes <n>`, and `--refresh-metadata`. `tables` and `columns` still support
96
97
  `--format <table|json|csv>`. CLI `UPDATE`, `UPSERT`, and `DELETE` statements are backed up
97
98
  automatically before the write runs.
98
99
 
@@ -149,6 +150,31 @@ cf-hana result clear
149
150
  API keeps returning full-fidelity `QueryResult` values and does not write result
150
151
  refs.
151
152
 
153
+ ## Invalid table/view suggestions and metadata cache
154
+
155
+ When `cf-hana query` fails with a likely HANA invalid table, view, or catalog
156
+ object error, the CLI keeps stdout empty/parseable and prints the original error
157
+ plus a small `Did you mean:` list to stderr. Suggestions are based on objects in
158
+ the active connection schema and include physical tables from `SYS.TABLES` and
159
+ views from `SYS.VIEWS`; `tables` output remains table-only for compatibility.
160
+
161
+ To avoid repeatedly reading catalog metadata after typo failures, cf-hana stores
162
+ only schema, object name, and object type under:
163
+
164
+ ```text
165
+ ~/.saptools/cf-hana/metadata/
166
+ ```
167
+
168
+ Metadata cache files are private (`0700` directories, `0600` files), written
169
+ atomically, and expire after exactly 30 minutes. The cache key is derived from
170
+ non-secret connection identity: selector, app name, host, active schema, role,
171
+ and driver. It does not include passwords, certificates, tokens, SQL parameter
172
+ values, result rows, or table data, and malformed cache files are treated as
173
+ misses. Pass `--refresh-metadata` to bypass this cache for a query; `--refresh`
174
+ also bypasses it because it refreshes the resolved connection identity. If
175
+ metadata lookup or cache I/O fails, cf-hana preserves the original query error
176
+ and simply omits suggestions.
177
+
152
178
  ## Programmatic API
153
179
 
154
180
  | Export | Purpose |
@@ -156,7 +182,7 @@ refs.
156
182
  | `connect(selector, options?)` | Open a reusable, pooled `HanaClient`. |
157
183
  | `query(selector, sql, params?, options?)` | One-shot: connect, query, close. |
158
184
  | `withConnection(selector, work, options?)` | Run `work` with a client that auto-closes. |
159
- | `HanaClient` | `query`, `execute`, `backupWriteStatement`, `selectFrom`, `count`, `insertInto`, `update`, `deleteFrom`, `transaction`, `listSchemas`, `listTables`, `listColumns`, `explain`, `close`. |
185
+ | `HanaClient` | `query`, `execute`, `backupWriteStatement`, `selectFrom`, `count`, `insertInto`, `update`, `deleteFrom`, `transaction`, `listSchemas`, `listTables`, `listCatalogObjects`, `listColumns`, `explain`, `close`. |
160
186
  | `createDriver`, `formatResult`, `build*` | Lower-level building blocks. |
161
187
 
162
188
  `ConnectOptions` highlights: `role` (`runtime` | `hdi`), `bindingName` /
@@ -191,8 +217,9 @@ count, row count, truncation flag, and elapsed time. Parameter values,
191
217
  credentials, certificates, and result rows are not stored.
192
218
 
193
219
  History retention runs opportunistically after each append and deletes dated
194
- history files older than five days. Helper-driven catalog SQL such as `tables`
195
- and `columns` is not recorded as user SQL history.
220
+ history files older than five days. Helper-driven catalog SQL such as `tables`,
221
+ `columns`, and table/view suggestion metadata reads is not recorded as user SQL
222
+ history.
196
223
 
197
224
  ## Write backups
198
225