docs: add type-mapping guide and document missing public APIs#127
Merged
Conversation
…oken, addField Add a Type Mapping section to docs/configuration.md covering the full round trip: schema/FieldType -> proto TypedValue field -> raw string wire form -> get() converter -> the TypeScript value returned. Document that time, duration, url, and json come back as strings (with their canonical string formats), that converters are limited to String/Number/Boolean, and the safe-integer/BigInt caveat (the Number converter rejects integer strings outside the safe range). Document the previously-undocumented public APIs in docs/configuration.md: typed setters (setNumber, setBool, setTime, setDuration), the native-value setMany variant, getAll, and setToken (JWT rotation). setDuration is documented as taking a duration string, matching the source. Fix docs/watching.md so the lifecycle section correctly describes addField() and post-start field registration instead of stating a flat restriction. Bump the Node version floor in CONTRIBUTING.md from 20+ to 22+ to match package.json engines (>=22). Closes #125 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bundle size
|
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.
Summary
time/duration/url/jsonreturn as strings) or why large integers throw.setMany,getAll,setToken(JWT rotation), andaddField(post-start watching).watching.mdeven described a restriction thataddField()already lifts.Changes
docs/configuration.md: new Type Mapping section (Go type -> raw wire string -> TS return/converter, plus the BigInt safe-integer caveat), a Reading and Writing Values section (get/getAll/typed setters/nativesetMany), and a token-rotation subsection forsetToken.docs/watching.md: documentedaddField()and the add-field-after-start capability; removed the stale restriction.CONTRIBUTING.md: Node 20+ -> 22+ to matchpackage.jsonengines.Test plan
npm run build,npx tsc --noEmit,npm run lint, and the full test suite (255 tests) all pass in the worktree.src/client.ts,src/convert.ts,src/watcher.ts). Two issue-text inaccuracies were corrected to match real behavior:setDurationaccepts a duration string (not a duration value), and the BigInt guard throws only for out-of-range integer strings, not large floats.Closes #125