v7: options-object API, request cancellation, strict TypeScript#325
Merged
Conversation
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
The v7 modernization: reshapes the public API to idiomatic TypeScript while keeping every 6.x call form working as a deprecated alias with identical behavior.
new IpregistryClient({ apiKey, baseUrl: 'eu', cache, maxRetries, timeout, ... })replaces theIpregistryConfigBuilderpattern (builder still works, marked deprecated). The plain API-key-string form remains non-deprecated.LookupOptions:client.lookupIp(ip, { fields, hostname, params, signal })replaces variadicIpregistryOptions.filter(...)style options (also still working, deprecated). Cache keys are identical between the two forms, so mixed usage shares the cache.{ signal: AbortSignal }. Aborting cancels the in-flight fetch, pending retries and their backoff waits (withAbortSignal.anyand a fallback for Node < 20.3), and pending batch chunks. Error messages mirror the Go client (Request cancelled,Request cancelled during retry backoff).parseUserAgentsaccepts an array; the variadic form is deprecated.noImplicitAnyenabled;IpregistryCache<V>is generic with a newIpregistryCacheValuetype;@types/chaiadded for the test suite.Compatibility
All 46 pre-existing tests pass unchanged against this branch, plus 8 new tests for the v7 surface (54 total). Runtime smoke tests pass on Node and workerd;
@arethetypeswrong/clireports no problems.Version is bumped to 7.0.0 on the branch; releasing stays a manual
gh workflow run release.yaml -f version=7.0.0after merge.