//#region src/fetch.d.ts /** * The signature of a `fetch`-compatible implementation. Implementations are * invoked without a receiver, so pass a bound function when the source * requires one (e.g. `window.fetch.bind(window)`). */ type FetchImplementation = (input: string | URL | Request, init?: RequestInit) => Promise; //#endregion //#region src/errors.d.ts declare class IpregistryError extends Error { constructor(message: string); } declare class ApiError extends IpregistryError { readonly code: string; readonly message: string; readonly resolution: string; constructor(code: string, message: string, resolution: string); } declare class ClientError extends IpregistryError { constructor(message: string); } declare class LookupError extends ApiError { constructor(code: string, message: string, resolution: string); } declare enum ErrorCode { BAD_REQUEST = "BAD_REQUEST", DISABLED_API_KEY = "DISABLED_API_KEY", FORBIDDEN_IP = "FORBIDDEN_IP", FORBIDDEN_ORIGIN = "FORBIDDEN_ORIGIN", FORBIDDEN_IP_ORIGIN = "FORBIDDEN_IP_ORIGIN", INTERNAL = "INTERNAL", INSUFFICIENT_CREDITS = "INSUFFICIENT_CREDITS", INVALID_API_KEY = "INVALID_API_KEY", INVALID_ASN = "INVALID_ASN", INVALID_FILTER_SYNTAX = "INVALID_FILTER_SYNTAX", INVALID_IP_ADDRESS = "INVALID_IP_ADDRESS", MISSING_API_KEY = "MISSING_API_KEY", RESERVED_ASN = "RESERVED_ASN", RESERVED_IP_ADDRESS = "RESERVED_IP_ADDRESS", TOO_MANY_ASNS = "TOO_MANY_ASNS", TOO_MANY_IPS = "TOO_MANY_IPS", TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS", TOO_MANY_USER_AGENTS = "TOO_MANY_USER_AGENTS", UNKNOWN_ASN = "UNKNOWN_ASN" } declare function isError(object: any): boolean; declare function isApiError(object: any): boolean; //#endregion //#region src/model.d.ts declare enum AsType { BUSINESS = "business", EDUCATION = "education", GOVERNMENT = "government", HOSTING = "hosting", INACTIVE = "inactive", ISP = "isp" } interface AutonomousSystem { allocated: string; asn: number; country_code: string; domain: string; name: string; prefixes: AutonomousSystemPrefixes; relationships: AutonomousSystemRelationships; registry: RegionalInternetRegistry; type: AsType; updated: string; } interface AutonomousSystemPrefixes { ipv4_count: number; ipv6_count: number; ipv4: AutonomousSystemPrefix[]; ipv6: AutonomousSystemPrefix[]; } interface AutonomousSystemPrefix { cidr: string; country_code: string; network_name: string; organization: string; prefix: string; registry: RegionalInternetRegistry; size: number; status: string; } interface AutonomousSystemRelationships { downstreams: number[]; peers: number[]; upstreams: number[]; } interface IpInfo { ip: string; type: 'IPv4' | 'IPv6'; hostname: string | null; carrier: Carrier; company: Company; connection: Connection; currency: Currency; location: Location; security: Security; time_zone: TimeZone; } type RequesterAutonomousSystem = AutonomousSystem; interface RequesterIpInfo extends IpInfo { user_agent: UserAgent; } interface Carrier { name: string | null; mcc: string | null; mnc: string | null; } interface Company { domain: string | null; name: string | null; type: 'business' | 'education' | 'government' | 'isp' | 'hosting' | null; } interface Connection { asn: number | null; domain: string | null; organization: string | null; route: string | null; type: 'business' | 'education' | 'government' | 'inactive' | 'isp' | 'hosting' | null; } interface Currency { code: string | null; name: string | null; name_native: string | null; plural: string | null; plural_native: string | null; symbol: string | null; symbol_native: string | null; format: CurrencyFormat; } interface CurrencyFormat { decimal_separator: string | null; group_separator: string | null; negative: CurrencyFormatPrefixSuffix; positive: CurrencyFormatPrefixSuffix; } interface CurrencyFormatPrefixSuffix { prefix: string | null; suffix: string | null; } interface Location { continent: Continent; country: Country; region: Region; city: string | null; postal: string | null; latitude: number | null; longitude: number | null; language: Language; in_eu: boolean; } interface Continent { code: string | null; name: string | null; } interface Country { area: number; borders: string[]; calling_code: string | null; capital: string | null; code: string | null; name: string | null; population: number; population_density: number; flag: Flag; languages: Language[]; tld: string | null; } interface Flag { emoji: string | null; emoji_unicode: string | null; emojitwo: string | null; noto: string | null; twemoji: string | null; wikimedia: string | null; } interface Region { code: string | null; name: string | null; } declare enum RegionalInternetRegistry { AFRINIC = "AFRINIC", APNIC = "APNIC", ARIN = "ARIN", JPNIC = "JPNIC", KRNIC = "KRNIC", LACNIC = "LACNIC", RIPE_NCC = "RIPE_NCC", TWNIC = "TWNIC" } interface Language { code: string | null; name: string | null; native: string | null; } interface Security { is_abuser: boolean; is_attacker: boolean; is_bogon: boolean; is_cloud_provider: boolean; is_proxy: boolean; is_relay: boolean; is_tor: boolean; is_tor_exit: boolean; is_anonymous: boolean; is_threat: boolean; is_vpn: boolean; } interface TimeZone { id: string | null; abbreviation: string | null; current_time: string | null; name: string | null; offset: number; in_daylight_saving: boolean; } interface UserAgent { header: string | null; name: string | null; type: string | null; version: string | null; version_major: string | null; device: UserAgentDevice; engine: UserAgentEngine; os: UserAgentOperatingSystem; } interface UserAgentDevice { brand: string | null; name: string | null; type: string | null; } interface UserAgentEngine { name: string | null; type: string | null; version: string | null; version_major: string | null; } interface UserAgentOperatingSystem { name: string | null; type: string | null; version: string | null; } //#endregion //#region src/options.d.ts /** * Narrows a lookup response type to the fields named by a `fields` selection * expression, including nested (dotted) paths. * `SelectedFields` is * `{ location: { region: Region } }`, so accessing an unselected field such * as `location.city` is a compile-time error. Comma-separated selections are * merged: `'location.region,location.city'` yields * `{ location: { region: Region; city: string | null } }`. Paths that * traverse arrays narrow the element type. Unknown path segments contribute * nothing to the result. When the expression is not a literal type (a plain * `string`), the full response type is kept. */ type SelectedFields = string extends F ? T : Simplify>; type SelectedPaths = F extends `${infer Head},${infer Rest}` ? SelectPath> & SelectedPaths : SelectPath>; type SelectPath = P extends `${infer Head}.${infer Rest}` ? Head extends keyof T ? { [K in Head]: SelectNested; } : unknown : P extends keyof T ? Pick : unknown; type SelectNested = T extends readonly (infer Element)[] ? SelectNested[] : T extends object ? SelectPath : T; /** * Flattens the intersections produced by merging comma-separated selections * into plain object types, so hovers show * `{ location: { region: Region; city: string | null } }` instead of * `{ location: { region: Region } } & { location: { city: string | null } }`. */ type Simplify = T extends readonly (infer Element)[] ? Simplify[] : T extends object ? { [K in keyof T]: Simplify; } : T; type Trim = F extends ` ${infer Rest}` ? Trim : F extends `${infer Rest} ` ? Trim : F; /** * Options accepted by lookup methods. */ interface LookupOptions { /** * Selects the fields to include in the response, as a comma-separated * list of field paths (e.g. 'location.country,security'). */ fields?: string; /** * Whether to resolve and include the hostname the IP address points to. */ hostname?: boolean; /** * Additional query parameters to send with the request. */ params?: Record; /** * Cancels the request (including retries and, for batch lookups, pending * chunks) when aborted. */ signal?: AbortSignal; } /** * @deprecated Use `LookupOptions` instead, e.g. * `client.lookupIp(ip, { fields: 'location', hostname: true })`. */ declare class IpregistryOption { readonly name: string; readonly value: string; constructor(name: string, value: string); } /** * @deprecated Use `LookupOptions#fields` instead. */ declare class FilterOption extends IpregistryOption { constructor(expression: string); } /** * @deprecated Use `LookupOptions#hostname` instead. */ declare class HostnameOption extends IpregistryOption { constructor(hostname: boolean); } /** * @deprecated Use `LookupOptions` instead, e.g. * `client.lookupIp(ip, { fields: 'location', hostname: true })`. */ declare class IpregistryOptions { static filter(fields: string): FilterOption; static hostname(hostname: boolean): HostnameOption; static from(name: string, value: string): IpregistryOption; } //#endregion //#region src/request.d.ts interface ApiResponse { credits: ApiResponseCredits; data: T; throttling: ApiResponseThrottling | null; } interface ApiResponseCredits { /** * The number of credits consumed to produce this response. */ consumed: number | null; /** * The estimated number of credits remaining on the account associated with * the API key that was used to make the request. */ remaining: number | null; } interface ApiResponseThrottling { /** * Indicates how many requests is allowed per hour (time window). */ limit: number; /** * Indicates how many requests are remaining for the current window. */ remaining: number; /** * Indicates when the current window ends, in seconds from the current time. */ reset: number; } interface BatchResult { results: Array; } interface IpregistryRequestHandler { batchLookupAsns(asns: number[], options: IpregistryOption[], signal?: AbortSignal): Promise>>; batchLookupIps(ipAddresses: string[], options: IpregistryOption[], signal?: AbortSignal): Promise>>; lookupAsn(asn: number, options: IpregistryOption[], signal?: AbortSignal): Promise>; lookupIp(ipAddress: string, options: IpregistryOption[], signal?: AbortSignal): Promise>; originLookupAsn(options: IpregistryOption[], signal?: AbortSignal): Promise>; originLookupIp(options: IpregistryOption[], signal?: AbortSignal): Promise>; parseUserAgents(userAgents: string[], signal?: AbortSignal): Promise>>; } declare class DefaultRequestHandler implements IpregistryRequestHandler { private static USER_AGENT; private config; constructor(config: IpregistryConfig); batchLookupAsns(asns: number[], options: IpregistryOption[], signal?: AbortSignal): Promise>>; batchLookupIps(ips: string[], options: IpregistryOption[], signal?: AbortSignal): Promise>>; lookupAsn(asn: number, options: IpregistryOption[], signal?: AbortSignal): Promise>; lookupIp(ip: string, options: IpregistryOption[], signal?: AbortSignal): Promise>; originLookupAsn(options: IpregistryOption[], signal?: AbortSignal): Promise>; originLookupIp(options: IpregistryOption[], signal?: AbortSignal): Promise>; parseUserAgents(userAgents: string[], signal?: AbortSignal): Promise>>; protected getFetchOptions(): { fetch: FetchImplementation | undefined; maxRetries: number; retryInterval: number; retryOnServerError: boolean; retryOnTooManyRequests: boolean; timeout: number; }; protected getHeaders(): Record; protected buildApiResponse(response: Response): Promise>; protected handleError(error: any): Promise; protected static parseInt(value: string | null): number | null; protected buildApiUrl(path: string, options?: IpregistryOption[]): string; } //#endregion //#region src/cache.d.ts /** * The union of value types the Ipregistry client stores in its cache. */ type IpregistryCacheValue = IpInfo | AutonomousSystem; interface IpregistryCache { get(key: string): V | undefined; put(key: string, data: V): void; invalidate(key: string): void; invalidateAll(): void; } /** * An in-process cache with time-based expiration and a bounded size using * least-recently-used eviction. Entries expire `expireAfter` milliseconds * after insertion; reading an entry refreshes its recency for eviction * purposes but does not extend its lifetime. */ declare class InMemoryCache implements IpregistryCache { private readonly maximumSize; private readonly expireAfter; private readonly cache; constructor(maximumSize?: number, expireAfter?: number); get(key: string): V | undefined; invalidate(key: string): void; invalidateAll(): void; put(key: string, data: V): void; } declare class NoCache implements IpregistryCache { get(key: string): V | undefined; invalidate(key: string): void; invalidateAll(): void; put(key: string, data: V): void; } //#endregion //#region src/version.d.ts /** * The version of this library. Must be kept in sync with the version field of * package.json; a unit test enforces this. */ declare const LIBRARY_VERSION = "7.1.0"; //#endregion //#region src/util.d.ts /** * Provides utility methods for working with user agent strings. */ declare class UserAgents { /** * Determines whether a given user agent string belongs to a bot. * * This method checks the user agent string for common bot-related keywords such as 'bot', 'crawl', 'spider', * and 'slurp'. It's a simple heuristic approach and may not cover all cases or be 100% accurate. * * @param userAgent The user agent string to check. This is typically the value of the `User-Agent` HTTP header * sent by browsers, crawlers, or other HTTP clients. * @returns `true` if the user agent string contains any of the bot-related keywords, indicating it might be a bot; * `false` otherwise. * * Example usage: * ``` * if (UserAgents.isBot(request.headers['user-agent'])) { * console.log('This request is likely from a bot'); * } else { * console.log('This request is likely from a human user'); * } * ``` */ static isBot(userAgent: string): boolean; } //#endregion //#region src/index.d.ts /** * The maximum number of IP addresses or ASNs the Ipregistry API accepts in a * single batch request. */ declare const DEFAULT_MAX_BATCH_SIZE = 1024; /** * Represents the configuration for the Ipregistry API client. * This class holds the API key, base URL, and timeout setting used for API requests. */ declare class IpregistryConfig { /** * The API key used for authenticating requests to Ipregistry. */ readonly apiKey: string; /** * The base URL of the Ipregistry API. Defaults to 'https://api.ipregistry.co'. */ readonly baseUrl: string; /** * The timeout (in milliseconds) for API requests. Defaults to 5000. */ readonly timeout: number; /** * The maximum number of automatic retries performed in addition to the * initial attempt. Applies to transport errors (timeouts, network * failures) and to the response statuses enabled by `retryOnServerError` * and `retryOnTooManyRequests`. Defaults to 3. Use 0 to disable retries. */ readonly maxRetries: number; /** * The base backoff (in milliseconds) between retries. Successive retries * use an exponentially increasing delay (retryInterval * 2^attempt). When * a response carries a Retry-After header, that value takes precedence. * Defaults to 1000. */ readonly retryInterval: number; /** * Whether 5xx responses (and transient network errors) are retried. * Defaults to true. */ readonly retryOnServerError: boolean; /** * Whether 429 Too Many Requests responses are retried, honoring the * Retry-After header when present. Ipregistry does not rate limit by * default (it is opt-in per API key), so this defaults to false. */ readonly retryOnTooManyRequests: boolean; /** * The maximum number of values sent in a single batch request. Larger * batches are split into this many values per request. Capped at * `DEFAULT_MAX_BATCH_SIZE` (the API limit). */ readonly maxBatchSize: number; /** * How many batch sub-requests are dispatched concurrently when a batch is * large enough to be split into chunks. Defaults to 4. */ readonly batchConcurrency: number; /** * The `fetch` implementation used to perform HTTP requests. Defaults to * the global `fetch`. */ readonly fetch?: FetchImplementation; /** * Constructs a new `IpregistryConfig` instance. * @param apiKey The API key for authenticating requests. * @param baseUrl Optional. The base URL of the Ipregistry API. * @param timeout Optional. The timeout for API requests in milliseconds. * @param maxRetries Optional. The maximum number of automatic retries. * @param retryInterval Optional. The base backoff between retries in milliseconds. * @param retryOnServerError Optional. Whether 5xx responses are retried. * @param retryOnTooManyRequests Optional. Whether 429 responses are retried. * @param maxBatchSize Optional. The maximum number of values per batch request. * @param batchConcurrency Optional. How many batch sub-requests run concurrently. * @param fetch Optional. The `fetch` implementation used for HTTP requests. */ constructor(apiKey: string, baseUrl: string, timeout: number, maxRetries?: number, retryInterval?: number, retryOnServerError?: boolean, retryOnTooManyRequests?: boolean, maxBatchSize?: number, batchConcurrency?: number, fetch?: FetchImplementation); } /** * Provides a builder pattern for constructing `IpregistryConfig` instances. * This class allows for setting the `apiKey`, `baseUrl`, and `timeout` before * building the final `IpregistryConfig` object. * * @deprecated Pass an `IpregistryClientOptions` object to the * `IpregistryClient` constructor instead, e.g. * `new IpregistryClient({ apiKey: 'KEY', timeout: 10000 })`. */ declare class IpregistryConfigBuilder { private apiKey; private baseUrl; private timeout; private maxRetries; private retryInterval; private retryOnServerError; private retryOnTooManyRequests; private maxBatchSize; private batchConcurrency; constructor(apiKey: string); /** * Sets the base URL for the Ipregistry API. * @param baseUrl The base URL to use for API requests. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withBaseUrl(baseUrl: string): IpregistryConfigBuilder; withEuBaseUrl(): IpregistryConfigBuilder; withTimeout(timeout: number): IpregistryConfigBuilder; /** * Sets the maximum number of automatic retries performed in addition to * the initial attempt. Use 0 to disable retries. * @param maxRetries The maximum number of retries. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withMaxRetries(maxRetries: number): IpregistryConfigBuilder; /** * Sets the base backoff between retries. Successive retries use an * exponentially increasing delay (retryInterval * 2^attempt). When a * response carries a Retry-After header, that value takes precedence. * @param retryInterval The base backoff in milliseconds. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withRetryInterval(retryInterval: number): IpregistryConfigBuilder; /** * Controls whether 5xx responses (and transient network errors) are * retried. Defaults to true. * @param retryOnServerError Whether 5xx responses are retried. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withRetryOnServerError(retryOnServerError: boolean): IpregistryConfigBuilder; /** * Controls whether 429 Too Many Requests responses are retried, honoring * the Retry-After header when present. Ipregistry does not rate limit by * default (it is opt-in per API key), so this defaults to false. * @param retryOnTooManyRequests Whether 429 responses are retried. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withRetryOnTooManyRequests(retryOnTooManyRequests: boolean): IpregistryConfigBuilder; /** * Sets the maximum number of values sent in a single batch request. Batch * lookups split larger inputs into this many values per request. Values * are capped at `DEFAULT_MAX_BATCH_SIZE` (the API limit); a value <= 0 is * ignored. * @param maxBatchSize The maximum number of values per batch request. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withMaxBatchSize(maxBatchSize: number): IpregistryConfigBuilder; /** * Sets how many batch sub-requests are dispatched concurrently when a * batch is large enough to be split into chunks. A value <= 0 is ignored. * Set it to 1 for strictly sequential dispatch, which is gentler on a * rate-limited API key. * @param batchConcurrency How many batch sub-requests run concurrently. * @returns The `IpregistryConfigBuilder` instance for chaining. */ withBatchConcurrency(batchConcurrency: number): IpregistryConfigBuilder; build(): IpregistryConfig; } /** * Configuration options for constructing an `IpregistryClient`. */ interface IpregistryClientOptions { /** * The API key used for authenticating requests to Ipregistry. */ apiKey: string; /** * The base URL of the Ipregistry API, or the shorthand 'eu' for the * European Union endpoint. Defaults to 'https://api.ipregistry.co'. */ baseUrl?: string; /** * The timeout (in milliseconds) for API requests. Defaults to 5000. */ timeout?: number; /** * The maximum number of automatic retries performed in addition to the * initial attempt. Defaults to 3. Use 0 to disable retries. */ maxRetries?: number; /** * The base backoff (in milliseconds) between retries. Defaults to 1000. */ retryInterval?: number; /** * Whether 5xx responses (and transient network errors) are retried. * Defaults to true. */ retryOnServerError?: boolean; /** * Whether 429 Too Many Requests responses are retried, honoring the * Retry-After header when present. Defaults to false. */ retryOnTooManyRequests?: boolean; /** * The maximum number of values sent in a single batch request. Capped at * `DEFAULT_MAX_BATCH_SIZE` (the API limit). */ maxBatchSize?: number; /** * How many batch sub-requests are dispatched concurrently when a batch is * split into chunks. Defaults to 4. */ batchConcurrency?: number; /** * The cache used to memoize lookups. Defaults to `NoCache`. */ cache?: IpregistryCache; /** * The `fetch` implementation used to perform HTTP requests. Defaults to * the global `fetch`. Useful for proxies, instrumentation or testing. * The implementation is invoked without a receiver, so pass a bound * function when the source requires one (e.g. * `window.fetch.bind(window)`). */ fetch?: FetchImplementation; /** * A custom handler for API requests. */ requestHandler?: IpregistryRequestHandler; } /** * The main client for interacting with the Ipregistry API. * This class provides methods for looking up IP information, ASN details, parsing user agents, and more. */ declare class IpregistryClient { private readonly config; private readonly cache; private requestHandler; /** * Constructs an IpregistryClient instance for API operations. * @param options The client configuration, including the API key. */ constructor(options: IpregistryClientOptions); /** * Constructs an IpregistryClient instance for API operations. * @param keyOrConfig The API key as a string or an IpregistryConfig instance for custom configurations. * @param cache Optional. An instance implementing the IpregistryCache interface for caching responses. * @param requestHandler Optional. A custom handler for API requests. * @deprecated Pass an `IpregistryClientOptions` object instead, e.g. * `new IpregistryClient({ apiKey: 'KEY', cache: new InMemoryCache() })`. * The API-key-string form remains supported. */ constructor(keyOrConfig: string | IpregistryConfig, cache?: IpregistryCache, requestHandler?: IpregistryRequestHandler); /** * Performs a batch lookup of Autonomous System Numbers (ASNs) and returns their information or errors. * This method can leverage caching to avoid unnecessary API requests. * @param asns An array of ASNs (Autonomous System Numbers) to lookup. * @param options Optional. Additional options for the lookup operation. * @returns A Promise resolving to an ApiResponse containing an array of AutonomousSystem or LookupError objects. */ batchLookupAsns(asns: number[], options: LookupOptions & { fields: F; }): Promise | LookupError)[]>>; batchLookupAsns(asns: number[], options?: LookupOptions): Promise>; /** * @deprecated Pass a `LookupOptions` object instead, e.g. * `client.batchLookupAsns(asns, { fields: 'name' })`. */ batchLookupAsns(asns: number[], ...options: IpregistryOption[]): Promise>; /** * Performs a batch lookup of IP addresses and returns their information or errors. * Similar to `batchLookupAsns`, this method also supports caching. * @param ips An array of IP addresses to lookup. * @param options Optional. Additional options for the lookup operation. * @returns A Promise resolving to an ApiResponse containing an array of IpInfo or LookupError objects. */ batchLookupIps(ips: string[], options: LookupOptions & { fields: F; }): Promise | LookupError)[]>>; batchLookupIps(ips: string[], options?: LookupOptions): Promise>; /** * @deprecated Pass a `LookupOptions` object instead, e.g. * `client.batchLookupIps(ips, { fields: 'location' })`. */ batchLookupIps(ips: string[], ...options: IpregistryOption[]): Promise>; /** * Looks up information for a single Autonomous System Number (ASN). * @param asn The ASN to lookup. * @param options Optional. Additional options for the lookup operation. * @returns A Promise resolving to an ApiResponse containing the AutonomousSystem information. */ lookupAsn(asn: number, options: LookupOptions & { fields: F; }): Promise>>; lookupAsn(asn: number, options?: LookupOptions): Promise>; /** * @deprecated Pass a `LookupOptions` object instead, e.g. * `client.lookupAsn(asn, { fields: 'name' })`. */ lookupAsn(asn: number, ...options: IpregistryOption[]): Promise>; /** * Looks up information for a single IP address. * @param ip The IP address to lookup. * @param options Optional. Additional options for the lookup operation. * @returns A Promise resolving to an ApiResponse containing the IpInfo. */ lookupIp(ip: string, options: LookupOptions & { fields: F; }): Promise>>; lookupIp(ip: string, options?: LookupOptions): Promise>; /** * @deprecated Pass a `LookupOptions` object instead, e.g. * `client.lookupIp(ip, { fields: 'location', hostname: true })`. */ lookupIp(ip: string, ...options: IpregistryOption[]): Promise>; /** * Performs a lookup for the ASN information of the originating request's IP address. * This is particularly useful for understanding the ASN of the caller itself. * Note: Caching is incompatible with this method. Every call will incur a remote request to the Ipregistry API, * which may consume credits or incur costs depending on your plan. * @param options Optional. Additional options for the lookup operation. * @returns A Promise resolving to an ApiResponse containing the RequesterAutonomousSystem information. */ originLookupAsn(options: LookupOptions & { fields: F; }): Promise>>; originLookupAsn(options?: LookupOptions): Promise>; /** * @deprecated Pass a `LookupOptions` object instead, e.g. * `client.originLookupAsn({ fields: 'name' })`. */ originLookupAsn(...options: IpregistryOption[]): Promise>; /** * Performs a lookup for the IP information of the originating request's IP address. * Useful for obtaining the caller's own IP information. * Similar to `originLookupAsn`, this method does not support caching, and each invocation results in a remote * API request to Ipregistry. This ensures that the most current information is retrieved but also means that * each call will consume credits. * @param options Optional. Additional options for the lookup operation. * @returns A Promise resolving to an ApiResponse containing the RequesterIpInfo. */ originLookupIp(options: LookupOptions & { fields: F; }): Promise>>; originLookupIp(options?: LookupOptions): Promise>; /** * @deprecated Pass a `LookupOptions` object instead, e.g. * `client.originLookupIp({ fields: 'location' })`. */ originLookupIp(...options: IpregistryOption[]): Promise>; /** * Parses user agent strings and returns detailed information about them. * @param userAgents An array of user agent strings to parse. * @returns A Promise resolving to an ApiResponse containing an array of UserAgent information. */ parseUserAgents(userAgents: string[], options?: LookupOptions): Promise>; /** * @deprecated Pass the user agents as an array instead, e.g. * `client.parseUserAgents([userAgent1, userAgent2])`. */ parseUserAgents(...userAgents: string[]): Promise>; /** * Retrieves the current cache instance used by the client. * @returns The IpregistryCache instance used for caching responses. */ getCache(): IpregistryCache; /** * Resolves batch values, splitting inputs larger than `maxBatchSize` into * chunks dispatched with at most `batchConcurrency` requests in flight, * and concatenating their results in order. When a chunk fails, the first * error is thrown and no further chunk is dispatched (in-flight chunks * complete but their results are discarded). Returns null when there is * nothing to resolve. */ private dispatchBatchChunks; private static aggregateCredits; private static mostConstrainedThrottling; /** * Normalizes the supported option shapes (a single `LookupOptions` object * or legacy variadic `IpregistryOption` instances) into query parameters * and an optional abort signal. Param entries from `LookupOptions#params` * are sorted by name so equivalent options produce identical cache keys. */ private static normalizeOptions; private static buildCacheKey; } //#endregion export { ApiError, ApiResponse, ApiResponseCredits, ApiResponseThrottling, AsType, AutonomousSystem, AutonomousSystemPrefix, AutonomousSystemPrefixes, AutonomousSystemRelationships, BatchResult, Carrier, ClientError, Company, Connection, Continent, Country, Currency, CurrencyFormat, CurrencyFormatPrefixSuffix, DEFAULT_MAX_BATCH_SIZE, DefaultRequestHandler, ErrorCode, type FetchImplementation, FilterOption, Flag, HostnameOption, InMemoryCache, IpInfo, IpregistryCache, IpregistryCacheValue, IpregistryClient, IpregistryClientOptions, IpregistryConfig, IpregistryConfigBuilder, IpregistryError, IpregistryOption, IpregistryOptions, IpregistryRequestHandler, LIBRARY_VERSION, Language, Location, LookupError, LookupOptions, NoCache, Region, RegionalInternetRegistry, RequesterAutonomousSystem, RequesterIpInfo, Security, SelectedFields, TimeZone, UserAgent, UserAgentDevice, UserAgentEngine, UserAgentOperatingSystem, UserAgents, isApiError, isError };