@querypanel/node-sdk 1.0.25 → 1.0.27
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/README.md +23 -0
- package/dist/index.cjs +656 -835
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -218
- package/dist/index.d.ts +138 -218
- package/dist/index.js +656 -837
- package/dist/index.js.map +1 -1
- package/package.json +73 -53
package/README.md
CHANGED
|
@@ -90,6 +90,29 @@ Every request is signed with `RS256` using the private key you pass to the const
|
|
|
90
90
|
- Schema ingestion failures are logged to `console.warn` during auto-sync, but you can call `syncSchema(..., { force: true })` to surface them directly.
|
|
91
91
|
- `ask()` raises immediately for guardrail/moderation errors because `/query` responds with 4xx/5xx.
|
|
92
92
|
|
|
93
|
+
### Automatic SQL repair and retry
|
|
94
|
+
|
|
95
|
+
When SQL execution fails (e.g., invalid column name, syntax error), the SDK can automatically retry with a repaired query:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const response = await qp.ask("Show revenue by country", {
|
|
99
|
+
tenantId: "tenant_123",
|
|
100
|
+
maxRetry: 3, // Automatically retry up to 3 times on execution error
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
console.log(`Query succeeded after ${response.attempts} attempt(s)`);
|
|
104
|
+
console.table(response.rows);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The SDK will:
|
|
108
|
+
1. Execute the generated SQL
|
|
109
|
+
2. If execution fails, send the error back to the server with the failed SQL
|
|
110
|
+
3. Get a repaired SQL query from the server
|
|
111
|
+
4. Execute the repaired query
|
|
112
|
+
5. Repeat up to `maxRetry` times
|
|
113
|
+
|
|
114
|
+
Without `maxRetry`, execution errors throw immediately (default behavior).
|
|
115
|
+
|
|
93
116
|
## Need more?
|
|
94
117
|
|
|
95
118
|
Open an issue or extend `node-sdk/src/index.ts`—every route lives in one file. Pull requests are welcome for additional adapters, richer param coercion, or convenience helpers around charts/annotations.
|