Skip to content

Add typed set methods and update setMany to accept SetValue#86

Merged
zeevdr merged 1 commit into
mainfrom
feat/typed-setters
May 24, 2026
Merged

Add typed set methods and update setMany to accept SetValue#86
zeevdr merged 1 commit into
mainfrom
feat/typed-setters

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 24, 2026

Summary

  • Eliminates the asymmetry between typed get() overloads and untyped set() — callers can now express intent at the type level rather than serializing to string themselves.
  • Adds setNumber(), setBool(), setTime(), and setDuration() methods that send the correct proto TypedValue variant (numberValue, boolValue, timeValue, stringValue) instead of always coercing to stringValue.
  • Updates setMany() to accept Record<string, SetValue> (string | number | boolean | Date), with per-entry type conversion via valueToTyped(). Backward-compatible — existing string callers are unaffected.

Test plan

  • setNumber() sends { numberValue } and threads expectedChecksum through
  • setBool() sends { boolValue: true } and { boolValue: false } correctly
  • setTime() sends { timeValue: Date }
  • setDuration() sends { stringValue } (server parses duration format)
  • setMany() converts a mixed-type record — number, boolean, string, Date — to correct TypedValue entries
  • valueToTyped() unit tests in convert.test.ts cover all branches
  • Build clean, all 205 tests pass

Closes #55

…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
@zeevdr zeevdr added this to the Beta Readiness milestone May 24, 2026
@zeevdr zeevdr added size: S Quick win — a few hours or less priority: P1 Current milestone work labels May 24, 2026
@zeevdr zeevdr merged commit c5b93ca into main May 24, 2026
13 checks passed
@zeevdr zeevdr deleted the feat/typed-setters branch May 24, 2026 12:44
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/client.ts 93.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P1 Current milestone work size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add typed set/setMany overloads matching get/getAll typed accessors

1 participant