Skip to content

feat: add nsqlGenerateSql for the runtime's /v1/nsql endpoint - #327

Merged
krinart merged 1 commit into
trunkfrom
feat/nsql-generate-sql
Aug 19, 2026
Merged

feat: add nsqlGenerateSql for the runtime's /v1/nsql endpoint#327
krinart merged 1 commit into
trunkfrom
feat/nsql-generate-sql

Conversation

@krinart

@krinart krinart commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds SpiceClient.nsqlGenerateSql(query, options) — translates a natural-language query into SQL without running it, closing the one gap versus gospice/spice-rs/spicepy's Nsql/NsqlGenerateSQL pair (nsql() only ran the generated query).
  • Same request shape as nsql(), just sent with an Accept: application/sql header instead of the JSON envelope.

Test plan

  • New test/nsql.test.ts (mocked fetch, no live runtime needed) — also adds baseline coverage for nsql(), which had none before.
  • npm run build, npm run typecheck, and the full offline unit suite pass locally with no regressions.

Note: test/nsql.test.ts isn't wired into a CI job yet — trunk currently lists test files by name per job rather than globbing test/. Open PR #326 introduces a unit-tests job for exactly this kind of file; whichever of these two PRs merges second should add test/nsql.test.ts to that list.

nsql() runs the generated query and returns rows; there was no way to
get just the generated SQL without running it, unlike gospice/spice-rs/
spicepy's Nsql/NsqlGenerateSQL pair. nsqlGenerateSql() sends the same
request with an application/sql Accept header and returns the SQL as
plain text.

Adds unit tests (nsql() had none previously) against a mocked fetch.
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spice-js Ready Ready Preview Aug 19, 2026 8:23pm

Request Review

@krinart
krinart merged commit 97b6ef4 into trunk Aug 19, 2026
21 checks passed
@krinart
krinart deleted the feat/nsql-generate-sql branch August 19, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants