Skip to content

Releases: ipregistry/ipregistry-javascript

v7.0.0

Choose a tag to compare

@github-actions github-actions released this 05 Jul 13:33

Added

  • Options-object API: construct the client with new IpregistryClient({ apiKey, baseUrl, timeout, maxRetries, cache, ... }) and pass per-call options as a plain object, e.g. client.lookupIp(ip, { fields: 'location', hostname: true }). The baseUrl option accepts the shorthand 'eu' for the European Union endpoint.
  • Request cancellation: every lookup accepts an AbortSignal via { signal }. Aborting cancels the in-flight request, pending retries and their backoff waits, and pending batch chunks.
  • parseUserAgents accepts an array (client.parseUserAgents([ua1, ua2])) in addition to the deprecated variadic form.
  • Generic cache typing: IpregistryCache<V> and the new IpregistryCacheValue type.

Changed

  • The library is now compiled with full TypeScript strict mode (noImplicitAny enabled).

Deprecated

  • IpregistryConfigBuilder: pass an IpregistryClientOptions object to the constructor instead.
  • IpregistryOption, FilterOption, HostnameOption, IpregistryOptions and the variadic lookup signatures: pass a LookupOptions object instead.
  • The variadic parseUserAgents(...userAgents) form: pass an array instead.

All deprecated forms keep working in 7.x and behave identically (including cache
key compatibility between legacy options and their LookupOptions equivalents);
they will be removed in a future major version.

Migration

// Before (6.x)                                    // After (7.x)
new IpregistryClient(                              new IpregistryClient({
    new IpregistryConfigBuilder('KEY')                 apiKey: 'KEY',
        .withEuBaseUrl()                               baseUrl: 'eu',
        .withTimeout(10000)                            cache: new InMemoryCache(),
        .build(),                                      timeout: 10000,
    new InMemoryCache())                           })

client.lookupIp(ip,                                client.lookupIp(ip, {
    IpregistryOptions.filter('location'),              fields: 'location',
    IpregistryOptions.hostname(true))                  hostname: true,
                                                   })

v6.2.0

Choose a tag to compare

@github-actions github-actions released this 05 Jul 06:53

Added

  • Automatic splitting of large batch lookups, aligned with the Go client: inputs beyond the API limit (1024 values) are chunked and dispatched with bounded concurrency, preserving input order. Configurable via withMaxBatchSize and withBatchConcurrency (default 4, set 1 for sequential dispatch).
  • New DEFAULT_MAX_BATCH_SIZE constant exposing the API per-request limit.

Changed

  • Document timeout, retry, and batch configuration in the README.

v6.1.0

Choose a tag to compare

@github-actions github-actions released this 05 Jul 06:32

Added

  • Configurable retry behavior aligned with the Go client: withMaxRetries (default 3), withRetryInterval (exponential backoff base, default 1 second), withRetryOnServerError (default true) and withRetryOnTooManyRequests (default false, honoring the Retry-After header when enabled).

Changed

  • Require Node.js 20+.
  • Retry transient network errors and, by default, 5xx responses; previously only timeouts were retried.
  • Replace the lru-cache dependency with an internal implementation; the library now has zero runtime dependencies.

v6.0.2

Choose a tag to compare

@github-actions github-actions released this 04 Jul 22:13

Fixed

  • Return false from isError and isApiError for non-object values instead of throwing a TypeError.

Changed

  • Declare the package side-effect free to improve tree-shaking by bundlers.
  • Expose package.json through the package exports map.

v6.0.1

Choose a tag to compare

@github-actions github-actions released this 04 Jul 21:47

Fixed

  • Map request timeouts to a ClientError with message 'Request timed out'; a typo prevented the mapping from ever matching.
  • Send the current library version in the user-agent header instead of a hardcoded 4.0.0.
  • Percent-encode user-supplied values interpolated into API URL paths.
  • Cache batch lookup results under the requested IP addresses and ASNs so that caching works when the fields option filters out the ip or asn response fields.
  • Declare the types condition first in the package exports map and provide format-specific type declarations so that TypeScript resolves them for both ESM and CommonJS consumers.

6.0.0

Choose a tag to compare

@laurentpellegrino laurentpellegrino released this 04 Jun 11:33

Changed

  • Modify the library packaging to make ECMAScript modules (ESM) optional.
  • Substitute the 'ky' dependency with native fetch API.
  • Reduce the default timeout setting to 5 seconds.
  • Implement retries, up to two times, with exponential backoff in the event of a timeout.

5.0.2

Choose a tag to compare

@laurentpellegrino laurentpellegrino released this 27 Mar 09:03

Added

  • Add missing fields size and status to type AutonomousSystemPrefix.

5.0.1

Choose a tag to compare

@laurentpellegrino laurentpellegrino released this 17 Mar 17:18

Fixed

  • Fix a packaging issue.

v5.0.0

Choose a tag to compare

@laurentpellegrino laurentpellegrino released this 17 Mar 12:05

Added

  • New IpregistryClient#batchLookupAsns method.
  • New IpregistryClient#lookupAsn method.
  • New IpregistryClient#originLookupAsn method.
  • New IpregistryConfigBuilder.withEuBaseUrl method. Once configured, requests will be handled by nodes deployed in the European Union only.
  • New IpregistryRequestHandler#batchLookupAsns method.
  • New IpregistryRequestHandler#lookupAsn method.
  • New IpregistryRequestHandler#originLookupAsn method.

Changed

  • Rename IpregistryClient#batchLookup to IpregistryClient#batchLookupIps.
  • Rename IpregistryClient#lookup to IpregistryClient#lookupIp.
  • Rename IpregistryClient#originLookup to IpregistryClient#originLookupIp.
  • Rename IpregistryClient#parse to IpregistryClient#parseUserAgents.
  • Rename IpregistryConfigBuilder.withApiUrl to IpregistryConfigBuilder.withBaseUrl.
  • Rename IpregistryRequestHandler#batchLookup to IpregistryRequestHandler#batchLookupIps.
  • Rename IpregistryRequestHandler#lookup to IpregistryRequestHandler#lookupIp.
  • Rename IpregistryRequestHandler#originLookup to IpregistryRequestHandler#originLookupIp.
  • Rename IpregistryRequestHandler#parse to IpregistryRequestHandler#parseUserAgents.
  • Rename utility class UserAgent to UserAgents.
  • Replace Axios by ky to bring support to Cloudflare Workers in addition to browser and NodeJS environments.
  • Require NodeJS 18+.

Fixed

  • Fixed origin requests returning wrong information when caching is enabled. Cache is now automatically disabled for
    origin requests since it is incompatible.

v4.5.0

Choose a tag to compare

@laurentpellegrino laurentpellegrino released this 14 Apr 22:57

Added

  • New is_vpn field in security object.