Add typed set methods and update setMany to accept SetValue#86
Merged
Conversation
…alue Adds setNumber(), setBool(), setTime(), and setDuration() methods to ConfigClient, each sending the appropriate proto TypedValue variant (numberValue, boolValue, timeValue, stringValue) rather than coercing to stringValue. The existing set() is kept as a string escape hatch. setMany() now accepts Record<string, SetValue> (string | number | boolean | Date), using the new valueToTyped() converter to build the correct TypedValue per entry. This is backward-compatible — existing callers that pass Record<string, string> continue to work. Exports SetValue type and valueToTyped() from the public index. Co-Authored-By: Claude <noreply@anthropic.com> Closes #55
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
get()overloads and untypedset()— callers can now express intent at the type level rather than serializing to string themselves.setNumber(),setBool(),setTime(), andsetDuration()methods that send the correct proto TypedValue variant (numberValue, boolValue, timeValue, stringValue) instead of always coercing to stringValue.setMany()to acceptRecord<string, SetValue>(string | number | boolean | Date), with per-entry type conversion viavalueToTyped(). Backward-compatible — existing string callers are unaffected.Test plan
setNumber()sends{ numberValue }and threadsexpectedChecksumthroughsetBool()sends{ boolValue: true }and{ boolValue: false }correctlysetTime()sends{ timeValue: Date }setDuration()sends{ stringValue }(server parses duration format)setMany()converts a mixed-type record — number, boolean, string, Date — to correct TypedValue entriesvalueToTyped()unit tests in convert.test.ts cover all branchesCloses #55