feat: add docs.update to cli and fix schema resolution#997
Open
feat: add docs.update to cli and fix schema resolution#997
Conversation
- Add `docs.update <docId> <fieldPath> [value]` CLI command for surgically updating a single field in a draft doc by its deep key path - Support inline JSON values, --file, and stdin for providing the value - Validate against collection schema by default (--no-validate to skip) - Add `resolveFieldAtPath()` to reject unknown field paths during validation (e.g. `foo.bar` on a schema without a `foo` field) - Fix `import.meta.glob is not a function` error in CLI context by loading schemas via `viteSsrLoadModule` and passing them through a new `collectionSchema` option on SaveDraftOptions/UpdateDraftOptions - Add optional `collectionSchema` to SaveDraftOptions and UpdateDraftOptions to bypass Vite-dependent `getCollection()` call
Member
|
i think we should add some consistency between can you (or ai) take a stab at what all 3 interfaces should look like? |
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.
This PR adds a
docs.updateto the CLI and fixes the schema resolution bug I introduced withschema.globdocs.update <docId> <fieldPath> [value]CLI command for surgically updating a single field in a draft doc by its deep key pathresolveFieldAtPath()to reject unknown field paths during validation (e.g.foo.baron a schema without afoofield)import.meta.glob is not a functionerror in CLI context by loading schemas viaviteSsrLoadModuleand passing them through a newcollectionSchemaoption on SaveDraftOptions/UpdateDraftOptionscollectionSchemato SaveDraftOptions and UpdateDraftOptions to bypass Vite-dependentgetCollection()callfixes #913