feat(database): expose KV connect database id; fix --json stdout discipline#117
Open
tcerqueira wants to merge 3 commits into
Open
feat(database): expose KV connect database id; fix --json stdout discipline#117tcerqueira wants to merge 3 commits into
tcerqueira wants to merge 3 commits into
Conversation
`database list` dropped the per-environment Deno KV connect database UUID
(metadata.td_id), so agents could not build the
`Deno.openKv("https://api.deno.com/v2/databases/<id>/connect")` URL without
opening the Console UI.
Surface it per KV environment: `--json` now includes `databaseId` and a derived
`connectUrl`, and the table gains a DATABASE ID column.
Closes #106
…ions provision/link/assign/detach/delete printed human text to stdout and never emitted a JSON result, breaking stdout discipline under `--json`. They now write a single JSON result via writeJsonResult on stdout in `--json` mode and route the success/status text to stderr otherwise.
…sults provision/link/delete emitted the database name under `name` while assign/detach used `database`, forcing consumers to special-case the key per subcommand. Standardize all mutation JSON results on `database`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related improvements to
deploy/database.ts:1. Expose the Deno KV connect database id (closes #106)
database listexposed only the generatedclientIdand dropped theper-environment Deno KV connect UUID that agents need to build
Deno.openKv("https://api.deno.com/v2/databases/<id>/connect"). The backendalready returns it per environment as
databases[].metadata.td_id.Now each KV environment in
--jsonincludesdatabaseIdand a derivedconnectUrl, and the table output gains aDATABASE IDcolumn:{ "name": "f89123-production", "status": "ready", "databaseId": "…", "connectUrl": "https://api.deno.com/v2/databases/…/connect" }Verified live:
Deno.openKvagainst the producedconnectUrl(with the orgtoken as
DENO_KV_ACCESS_TOKEN) connects and round-trips set/get/delete.2. Mutation
--jsonstdout disciplineprovision/link/assign/detach/deleteprinted human text to stdoutand never emitted a JSON result. They now emit a single JSON result via
writeJsonResulton stdout under--json, and route success/status text tostderr otherwise.
Note on overlap
Sibling PR #105 (issue #104) also edits the
linkcommand (option declarations,--porttype, payload key). This PR leaves those untouched and only adds theJSON/stderr branching around
link's success messages — should rebase cleanly.