internetdata-web 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ It runs in Chrome and Edge 109, Firefox 115 ESR and Safari 16.4 or newer. TypeSc
30
30
 
31
31
  ## Usage
32
32
 
33
- **No API key needed to start.** Unlimited, the free plan, answers Tor, relay, anycast, carrier, satellite and the five service flags (SSH, SMTP, web, DNS resolver and BitTorrent), reverse DNS, country-level `location`, `asn`, the company's name and domain and the abuse email, with no daily or monthly cap, with a key or without one. In a page the address calling is the visitor's, so `myIp` tells you about the visitor:
33
+ **No API key needed to start.** Unlimited, the free plan, answers Tor, relay, bot, anycast, carrier, satellite and the five service flags (SSH, SMTP, web, DNS resolver and BitTorrent), reverse DNS, country-level `location`, `asn`, the company's name and domain and the abuse email, with no daily or monthly cap, with a key or without one. In a page the address calling is the visitor's, so `myIp` tells you about the visitor:
34
34
 
35
35
  ```js
36
36
  import { InternetData } from 'internetdata-web';
@@ -57,6 +57,7 @@ const result = await client.lookup('146.70.116.130');
57
57
  console.log(result.isVpn); // on a paid plan
58
58
  console.log(result.vpn?.provider); // on a paid plan
59
59
  console.log(result.location.city); // on a paid plan
60
+ console.log(result.bot?.agents); // ['Googlebot'] for a crawler's address, on a paid plan
60
61
  ```
61
62
 
62
63
  An extension can sign its user in rather than ask them to paste a key: see Sign in with OAuth below.
@@ -263,7 +264,7 @@ The library is ES2022 and needs only what a browser has, `fetch` and, for PKCE,
263
264
 
264
265
  ### Absent is not false
265
266
 
266
- Unlimited leaves out `isVpn`, `isHosting`, `isCdn` and the four proxy flags, the detail behind them, and the paid members inside `location`, `asn`, `company` and `abuse`, such as `location.city`; a free-plan key's answer carries `trialExpired`, true once its trial is spent. A paid key's carries `capReached`, true once its organization's overage cap is reached, when the answer has Unlimited's fields and isn't billed. A field your key does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
267
+ Unlimited leaves out `isVpn`, `isHosting`, `isCdn` and the four proxy flags, the detail behind them, `bot` (whose bot it is, behind `isBot`), and the paid members inside `location`, `asn`, `company` and `abuse`, such as `location.city`; a free-plan key's answer carries `trialExpired`, true once its trial is spent. A paid key's carries `capReached`, true once its organization's overage cap is reached, when the answer has Unlimited's fields and isn't billed. A field your key does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
267
268
 
268
269
  ```js
269
270
  result.isVpn ?? false // when you only want the flag
package/dist/bogon.js CHANGED
@@ -65,6 +65,7 @@ function bogonAnswer(ip) {
65
65
  is_pubproxy: false,
66
66
  is_hosting: false,
67
67
  is_cdn: false,
68
+ is_bot: false,
68
69
  is_anycast: false,
69
70
  is_carrier: false,
70
71
  is_satellite: false,
@@ -82,6 +83,7 @@ function bogonAnswer(ip) {
82
83
  pubproxy: {},
83
84
  hosting: {},
84
85
  cdn: {},
86
+ bot: {},
85
87
  carrier: {},
86
88
  satellite: {},
87
89
  ssh: {},
package/dist/client.d.ts CHANGED
@@ -5,10 +5,10 @@ import { type CacheStore } from './store.js';
5
5
  import { type AsnResult, type DomainResult, type Result } from './types.js';
6
6
  export declare const DEFAULT_BASE_URL = "https://api.internetdata.io";
7
7
  export interface CacheOptions {
8
- /** Maximum number of addresses held in memory. Default 10000. */
8
+ /** Maximum number of addresses held in memory, a whole number from 1. Default 10000. */
9
9
  max?: number;
10
10
  /**
11
- * How long an answer stays fresh, in milliseconds. Default 1 hour. An answer
11
+ * How long an answer stays fresh, in whole milliseconds from 1. Default 1 hour. An answer
12
12
  * marked `trialExpired` or `capReached` stays a minute at most.
13
13
  */
14
14
  ttlMs?: number;
@@ -150,7 +150,7 @@ export declare class InternetData {
150
150
  *
151
151
  * Usage counts against the ALLOWANCE WINDOW - on a paid plan the
152
152
  * anniversary of the subscription, not the calendar month and not the
153
- * billing period, and on the free plan the UTC day - and it is the same
153
+ * billing period, and on the free plan the UTC month - and it is the same
154
154
  * number a lookup is gated on. It can lag by a few seconds, because
155
155
  * requests are counted in memory and flushed in aggregate.
156
156
  *
package/dist/client.js CHANGED
@@ -56,9 +56,9 @@ export class InternetData {
56
56
  this.timeoutMs = checkTimeout(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS;
57
57
  this.limit = pLimit(checkConcurrency(options.concurrency) ?? 8);
58
58
  const cache = options.cache === false ? null : (options.cache ?? {});
59
- const ttlMs = cache?.ttlMs ?? 60 * 60 * 1000;
59
+ const ttlMs = checkCacheOption('ttlMs', cache?.ttlMs) ?? 60 * 60 * 1000;
60
60
  this.cache = cache === null ? null : new LRUCache({
61
- max: cache.max ?? 10_000,
61
+ max: checkCacheOption('max', cache.max) ?? 10_000,
62
62
  ttl: ttlMs,
63
63
  // Concurrent misses for one address share one request: every
64
64
  // `fetch()` while it is in flight gets the same promise, and a
@@ -214,7 +214,7 @@ export class InternetData {
214
214
  *
215
215
  * Usage counts against the ALLOWANCE WINDOW - on a paid plan the
216
216
  * anniversary of the subscription, not the calendar month and not the
217
- * billing period, and on the free plan the UTC day - and it is the same
217
+ * billing period, and on the free plan the UTC month - and it is the same
218
218
  * number a lookup is gated on. It can lag by a few seconds, because
219
219
  * requests are counted in memory and flushed in aggregate.
220
220
  *
@@ -430,6 +430,21 @@ function checkApiKey(apiKey) {
430
430
  function apexOf(baseUrl) {
431
431
  return baseUrl.replace(/^(https?:\/\/)api(?:-([^./:@]+))?\./i, (_, scheme, env) => (env === undefined ? scheme : `${scheme}${env}.`));
432
432
  }
433
+ /**
434
+ * A cache size or TTL refused where it is set, `null` reading as unset. lru-cache
435
+ * reads a zero or NaN TTL as none, which would keep every answer for good, a spent
436
+ * trial's included, and a zero size as no bound; anything else not whole it throws
437
+ * a bare TypeError for.
438
+ */
439
+ function checkCacheOption(name, value) {
440
+ if (value === undefined || value === null) {
441
+ return undefined;
442
+ }
443
+ if (!(typeof value === 'number' && Number.isSafeInteger(value) && value >= 1)) {
444
+ throw new InternetDataError('bad_request', `cache.${name} must be a whole number from 1, got ${String(value)}`);
445
+ }
446
+ return value;
447
+ }
433
448
  function unreadableEntry(ip) {
434
449
  return new InternetDataError('server_error', `unreadable batch answer for ${ip}, status 200`, 200);
435
450
  }
@@ -1,2 +1,2 @@
1
1
  export { lookupAsn, lookupBatch, lookupDomain, lookupIp, lookupMyIp, myEntitlement, oauthMetadata, oauthRevoke, oauthToken, type Options } from './sdk.gen.js';
2
- export type { AbuseContact, Asn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BatchLookupError, BatchLookupRequest, BatchLookupResponse, BitTorrentDetail, CarrierDetail, ClassDetail, ClientOptions, CohostedDomains, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainHost, DomainIpRange, DomainIpRanges, DomainLookupResponse, DomainRedirects, DomainWeb, DomainWebLinks, Entitlement, EntitlementApikey, EntitlementError, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupAsnData, LookupAsnError, LookupAsnErrors, LookupAsnResponse, LookupAsnResponses, LookupBatchData, LookupBatchError, LookupBatchErrors, LookupBatchResponse, LookupBatchResponses, LookupDomainData, LookupDomainError, LookupDomainErrors, LookupDomainResponse, LookupDomainResponses, LookupError, LookupIpData, LookupIpError, LookupIpErrors, LookupIpResponse, LookupIpResponses, LookupMyIpData, LookupMyIpError, LookupMyIpErrors, LookupMyIpResponse, LookupMyIpResponses, LookupResponse, MyEntitlementData, MyEntitlementError, MyEntitlementErrors, MyEntitlementResponse, MyEntitlementResponses, OauthError, OauthMetadata, OauthMetadataData, OauthMetadataResponse, OauthMetadataResponses, OauthRevokeData, OauthRevokeResponse, OauthRevokeResponses, OauthTokenData, OauthTokenError, OauthTokenErrors, OauthTokenResponse, OauthTokenResponses, ProxyDetail, PubproxyDetail, RevokeRequest, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, TokenRequest, TokenResponse, WebDetail, Whois } from './types.gen.js';
2
+ export type { AbuseContact, Asn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BatchLookupError, BatchLookupRequest, BatchLookupResponse, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, ClientOptions, CohostedDomains, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainHost, DomainIpRange, DomainIpRanges, DomainLookupResponse, DomainRedirects, DomainWeb, DomainWebLinks, Entitlement, EntitlementApikey, EntitlementError, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupAsnData, LookupAsnError, LookupAsnErrors, LookupAsnResponse, LookupAsnResponses, LookupBatchData, LookupBatchError, LookupBatchErrors, LookupBatchResponse, LookupBatchResponses, LookupDomainData, LookupDomainError, LookupDomainErrors, LookupDomainResponse, LookupDomainResponses, LookupError, LookupIpData, LookupIpError, LookupIpErrors, LookupIpResponse, LookupIpResponses, LookupMyIpData, LookupMyIpError, LookupMyIpErrors, LookupMyIpResponse, LookupMyIpResponses, LookupResponse, MyEntitlementData, MyEntitlementError, MyEntitlementErrors, MyEntitlementResponse, MyEntitlementResponses, OauthError, OauthMetadata, OauthMetadataData, OauthMetadataResponse, OauthMetadataResponses, OauthRevokeData, OauthRevokeResponse, OauthRevokeResponses, OauthTokenData, OauthTokenError, OauthTokenErrors, OauthTokenResponse, OauthTokenResponses, ProxyDetail, PubproxyDetail, RevokeRequest, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, TokenRequest, TokenResponse, UserAgentVerdict, WebDetail, Whois } from './types.gen.js';
@@ -163,6 +163,10 @@ export type LookupResponse = {
163
163
  * In CDN IP: a content delivery network. Paid plans and the trial.
164
164
  */
165
165
  is_cdn?: boolean;
166
+ /**
167
+ * In Bot IP: an automated client's address, such as a search engine's or an AI company's crawler, an uptime monitor, an internet scanner or a webhook sender. `bot` says whose, what it does and whether its operator vouches for the address.
168
+ */
169
+ is_bot: boolean;
166
170
  /**
167
171
  * In Anycast IP: announced from many places at once.
168
172
  */
@@ -231,6 +235,10 @@ export type LookupResponse = {
231
235
  * `{}` when `is_cdn` is false. Paid plans and the trial.
232
236
  */
233
237
  cdn?: ClassDetail;
238
+ /**
239
+ * `{}` when `is_bot` is false. Paid plans and the trial.
240
+ */
241
+ bot?: BotDetail;
234
242
  /**
235
243
  * `{}` when `is_carrier` is false. Paid plans and the trial.
236
244
  */
@@ -270,6 +278,10 @@ export type LookupResponse = {
270
278
  whois?: Whois;
271
279
  rwhois?: Rwhois;
272
280
  hosted_domains?: HostedDomains;
281
+ /**
282
+ * When the request sent `user_agent`, with every field, the agent it names and whether this address bears it out. Absent otherwise.
283
+ */
284
+ user_agent?: UserAgentVerdict;
273
285
  /**
274
286
  * On every answer to a key on the free plan, and on no other: `false` while its organization's trial of every field lasts, `true` once the answer has Unlimited's fields.
275
287
  */
@@ -409,6 +421,62 @@ export type SatelliteDetail = {
409
421
  */
410
422
  confidence?: string;
411
423
  };
424
+ export type UserAgentVerdict = {
425
+ /**
426
+ * The agent the user agent names, such as `Googlebot` or `Chrome`; `Unknown` where it names none.
427
+ */
428
+ agent: string;
429
+ /**
430
+ * `browser`, `inapp`, `automation`, `bot`, `ai-bot`, `http-client` or `unknown`: what kind of client the user agent says it is.
431
+ */
432
+ kind: string;
433
+ /**
434
+ * `verified`: the agent's operator vouches for this address as it. `spoofed`: the operator of a bot that publishes its addresses, or whose registered space it uses, does not vouch for this one, or this address posed as the bot before. `unverifiable`: a bot no published list or registered space can confirm. `not_bot`: a browser, an app or a script.
435
+ */
436
+ verdict: 'verified' | 'spoofed' | 'unverifiable' | 'not_bot';
437
+ };
438
+ export type BotDetail = {
439
+ /**
440
+ * The bot operator's ID in Bot Provider; for an address that is not verified, the operator its claim named. Empty where no operator is known.
441
+ */
442
+ provider?: string;
443
+ /**
444
+ * The operator's name, the one its claim named for an address that is not verified; empty where no operator is known.
445
+ */
446
+ provider_name?: string;
447
+ /**
448
+ * The bots the address serves, as their user agents name them (`Googlebot`, `GPTBot`); for an address that is not verified, the bots it claimed to be. One address can serve several, and `[]` means none is named.
449
+ */
450
+ agents?: Array<string>;
451
+ /**
452
+ * What those bots do: `search_engine`, `ai_training`, `ai_search`, `ai_assistant`, `ai_agent`, `seo`, `ads`, `preview`, `feed`, `monitoring`, `archiver`, `scanner`, `link_security`, `webhook` or `other`; `[]` where unknown.
453
+ */
454
+ categories?: Array<string>;
455
+ /**
456
+ * Whether the operator vouches for the address, so the bots in `agents` really are its.
457
+ */
458
+ verified?: boolean;
459
+ /**
460
+ * `verified` (the operator vouches for the address), `declared` (it names itself a bot that cannot be verified), `spoofed` (it claimed a bot whose operator vouches for other addresses) or `undeclared` (it hides as a browser and behaves as automation).
461
+ */
462
+ identity?: string;
463
+ /**
464
+ * How a verified address verified: `list` (the operator publishes it), `rdns` (its reverse DNS name ends in a suffix the operator documents and resolves back) or `owner` (the operator's own space, seen claiming its bot); empty when not verified.
465
+ */
466
+ verified_by?: string;
467
+ /**
468
+ * `high`, `medium` or `low`: how sure we are the address is what the row says.
469
+ */
470
+ confidence?: string;
471
+ /**
472
+ * The first day the address was seen as such.
473
+ */
474
+ first_seen?: string;
475
+ /**
476
+ * The last day it was.
477
+ */
478
+ last_seen?: string;
479
+ };
412
480
  export type SshDetail = {
413
481
  /**
414
482
  * The port the server answered on.
@@ -695,11 +763,11 @@ export type Asn = {
695
763
  /**
696
764
  * The country its registry assigned it to.
697
765
  */
698
- country?: string;
766
+ country: string;
699
767
  /**
700
768
  * The announcement's RPKI status.
701
769
  */
702
- rpki_status?: string;
770
+ rpki_status: string;
703
771
  };
704
772
  /**
705
773
  * Who uses the address, from IP Company.
@@ -1270,6 +1338,12 @@ export type BatchLookupRequest = {
1270
1338
  * Domains.
1271
1339
  */
1272
1340
  domains?: Array<string>;
1341
+ /**
1342
+ * Each address's `User-Agent`, keyed by the string it is sent as in `ips`. With every field, that address's answer then carries `user_agent`, as a single lookup's does. Never kept.
1343
+ */
1344
+ user_agents?: {
1345
+ [key: string]: string;
1346
+ };
1273
1347
  };
1274
1348
  export type BatchLookupResponse = {
1275
1349
  /**
@@ -1456,7 +1530,12 @@ export type LookupIpData = {
1456
1530
  */
1457
1531
  ip: string;
1458
1532
  };
1459
- query?: never;
1533
+ query?: {
1534
+ /**
1535
+ * The `User-Agent` header of the request you are deciding on. With every field, on a paid plan or the trial, the answer then carries `user_agent`, the agent it names and whether this address bears that out. Never kept, and nothing sent with a lookup feeds our data.
1536
+ */
1537
+ user_agent?: string;
1538
+ };
1460
1539
  url: '/{ip}';
1461
1540
  };
1462
1541
  export type LookupIpErrors = {
@@ -1476,8 +1555,8 @@ export type LookupIpErrors = {
1476
1555
  403: LookupError;
1477
1556
  /**
1478
1557
  * A rate limit, always with `Retry-After`: this API protecting itself, or a burst of Unlimited
1479
- * lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1480
- * fields and `cap_reached` `true`.
1558
+ * lookups. A paid plan's overage cap is never a `429` by itself: it answers `200` with
1559
+ * Unlimited's fields and `cap_reached` `true`, and a burst past it pays Unlimited's rate limit.
1481
1560
  *
1482
1561
  */
1483
1562
  429: LookupError;
@@ -1497,7 +1576,12 @@ export type LookupIpResponse = LookupIpResponses[keyof LookupIpResponses];
1497
1576
  export type LookupMyIpData = {
1498
1577
  body?: never;
1499
1578
  path?: never;
1500
- query?: never;
1579
+ query?: {
1580
+ /**
1581
+ * The `User-Agent` header of the request you are deciding on. With every field, on a paid plan or the trial, the answer then carries `user_agent`, the agent it names and whether this address bears that out. Never kept, and nothing sent with a lookup feeds our data.
1582
+ */
1583
+ user_agent?: string;
1584
+ };
1501
1585
  url: '/myip';
1502
1586
  };
1503
1587
  export type LookupMyIpErrors = {
@@ -1513,8 +1597,8 @@ export type LookupMyIpErrors = {
1513
1597
  403: LookupError;
1514
1598
  /**
1515
1599
  * A rate limit, always with `Retry-After`: this API protecting itself, or a burst of Unlimited
1516
- * lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1517
- * fields and `cap_reached` `true`.
1600
+ * lookups. A paid plan's overage cap is never a `429` by itself: it answers `200` with
1601
+ * Unlimited's fields and `cap_reached` `true`, and a burst past it pays Unlimited's rate limit.
1518
1602
  *
1519
1603
  */
1520
1604
  429: LookupError;
@@ -1559,8 +1643,8 @@ export type LookupAsnErrors = {
1559
1643
  403: LookupError;
1560
1644
  /**
1561
1645
  * A rate limit, always with `Retry-After`: this API protecting itself, or a burst of Unlimited
1562
- * lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1563
- * fields and `cap_reached` `true`.
1646
+ * lookups. A paid plan's overage cap is never a `429` by itself: it answers `200` with
1647
+ * Unlimited's fields and `cap_reached` `true`, and a burst past it pays Unlimited's rate limit.
1564
1648
  *
1565
1649
  */
1566
1650
  429: LookupError;
@@ -1605,8 +1689,8 @@ export type LookupDomainErrors = {
1605
1689
  403: LookupError;
1606
1690
  /**
1607
1691
  * A rate limit, always with `Retry-After`: this API protecting itself, or a burst of Unlimited
1608
- * lookups. A paid plan's overage cap is never a `429`: it answers `200` with Unlimited's
1609
- * fields and `cap_reached` `true`.
1692
+ * lookups. A paid plan's overage cap is never a `429` by itself: it answers `200` with
1693
+ * Unlimited's fields and `cap_reached` `true`, and a burst past it pays Unlimited's rate limit.
1610
1694
  *
1611
1695
  */
1612
1696
  429: LookupError;
package/dist/index.d.ts CHANGED
@@ -6,4 +6,4 @@ export type { OauthOptions, AuthorizationUrlOptions, OauthMetadata, TokenRespons
6
6
  export { isBogon } from './bogon.js';
7
7
  export { InternetDataError, OauthError, OauthAccessDeniedError, OauthExpiredTokenError, } from './errors.js';
8
8
  export type { ErrorKind } from './errors.js';
9
- export type { Result, AsnResult, DomainResult, LookupResponse, AsnLookupResponse, DomainLookupResponse, ClassDetail, ProxyDetail, PubproxyDetail, CarrierDetail, SatelliteDetail, SshDetail, SmtpDetail, WebDetail, DnsResolverDetail, BitTorrentDetail, Location, Asn, Company, AbuseContact, Whois, Rwhois, HostedDomains, AsnPrefix, DomainDns, DnsAddressRecord, DnsMxRecord, DnsNsRecord, DnsCnameRecord, DomainIpRanges, DomainIpRange, DisposableDetail, DomainHost, CohostedDomains, DomainWeb, DomainWebLinks, DomainRedirects, DomainBacklinks, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, } from './types.js';
9
+ export type { Result, AsnResult, DomainResult, LookupResponse, AsnLookupResponse, DomainLookupResponse, ClassDetail, ProxyDetail, PubproxyDetail, CarrierDetail, SatelliteDetail, SshDetail, SmtpDetail, WebDetail, DnsResolverDetail, BitTorrentDetail, Location, Asn, Company, AbuseContact, Whois, Rwhois, HostedDomains, AsnPrefix, DomainDns, DnsAddressRecord, DnsMxRecord, DnsNsRecord, DnsCnameRecord, DomainIpRanges, DomainIpRange, DisposableDetail, DomainHost, CohostedDomains, DomainWeb, DomainWebLinks, DomainRedirects, DomainBacklinks, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, BotDetail, UserAgentVerdict, } from './types.js';
package/dist/shapes.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export declare const LOOKUP_MEMBERS: readonly ["ip", "is_bogon", "is_tor", "is_relay", "is_anycast", "is_carrier", "is_satellite", "is_ssh", "is_smtp", "is_web", "is_dns_resolver", "is_bittorrent", "tor", "relay", "location", "asn", "company", "hostname", "abuse"];
1
+ export declare const LOOKUP_MEMBERS: readonly ["ip", "is_bogon", "is_tor", "is_relay", "is_bot", "is_anycast", "is_carrier", "is_satellite", "is_ssh", "is_smtp", "is_web", "is_dns_resolver", "is_bittorrent", "tor", "relay", "location", "asn", "company", "hostname", "abuse"];
2
2
  export declare const WEB_DETAIL_MEMBERS: readonly ["port", "tls_ok", "session_ok", "status_code", "server", "location", "title", "cert_subject_cn", "cert_subject_o", "cert_issuer_dn", "cert_browser_trusted", "tls_version", "first_seen", "last_seen"];
3
3
  export declare const LOCATION_MEMBERS: readonly ["continent", "continent_name", "country", "country_name", "timezone", "currency_code", "currency_name", "currency_symbol", "flag_emoji", "flag_unicode"];
4
- export declare const ASN_MEMBERS: readonly ["asn", "name", "domain", "type", "prefix"];
4
+ export declare const ASN_MEMBERS: readonly ["asn", "name", "domain", "type", "prefix", "country", "rpki_status"];
5
5
  export declare const COMPANY_MEMBERS: readonly ["name", "domain"];
6
+ export declare const USER_AGENT_VERDICT_MEMBERS: readonly ["agent", "kind", "verdict"];
6
7
  export declare const ABUSE_CONTACT_MEMBERS: readonly ["email"];
7
8
  export declare const WHOIS_MEMBERS: readonly ["id", "name", "org", "country", "status", "source", "domain", "abuse_email", "asn"];
8
9
  export declare const RWHOIS_MEMBERS: readonly ["id", "name", "country", "source", "domain", "abuse_email"];
@@ -34,6 +35,8 @@ export declare const LOOKUP_TYPES: Record<string, Kind>;
34
35
  export declare const CLASS_DETAIL_TYPES: Record<string, Kind>;
35
36
  export declare const PROXY_DETAIL_TYPES: Record<string, Kind>;
36
37
  export declare const PUBPROXY_DETAIL_TYPES: Record<string, Kind>;
38
+ export declare const BOT_DETAIL_TYPES: Record<string, Kind>;
39
+ export declare const USER_AGENT_VERDICT_TYPES: Record<string, Kind>;
37
40
  export declare const CARRIER_DETAIL_TYPES: Record<string, Kind>;
38
41
  export declare const SATELLITE_DETAIL_TYPES: Record<string, Kind>;
39
42
  export declare const SSH_DETAIL_TYPES: Record<string, Kind>;
package/dist/shapes.js CHANGED
@@ -3,9 +3,9 @@
3
3
  // generated types, so a member the spec adds fails the suite until it is here.
4
4
  import { hasMembers } from './transport.js';
5
5
  export const LOOKUP_MEMBERS = [
6
- 'ip', 'is_bogon', 'is_tor', 'is_relay', 'is_anycast', 'is_carrier', 'is_satellite', 'is_ssh', 'is_smtp',
7
- 'is_web', 'is_dns_resolver', 'is_bittorrent', 'tor', 'relay', 'location', 'asn', 'company', 'hostname',
8
- 'abuse',
6
+ 'ip', 'is_bogon', 'is_tor', 'is_relay', 'is_bot', 'is_anycast', 'is_carrier', 'is_satellite', 'is_ssh',
7
+ 'is_smtp', 'is_web', 'is_dns_resolver', 'is_bittorrent', 'tor', 'relay', 'location', 'asn', 'company',
8
+ 'hostname', 'abuse',
9
9
  ];
10
10
  export const WEB_DETAIL_MEMBERS = [
11
11
  'port', 'tls_ok', 'session_ok', 'status_code', 'server', 'location', 'title', 'cert_subject_cn',
@@ -15,8 +15,9 @@ export const LOCATION_MEMBERS = [
15
15
  'continent', 'continent_name', 'country', 'country_name', 'timezone', 'currency_code', 'currency_name',
16
16
  'currency_symbol', 'flag_emoji', 'flag_unicode',
17
17
  ];
18
- export const ASN_MEMBERS = ['asn', 'name', 'domain', 'type', 'prefix'];
18
+ export const ASN_MEMBERS = ['asn', 'name', 'domain', 'type', 'prefix', 'country', 'rpki_status'];
19
19
  export const COMPANY_MEMBERS = ['name', 'domain'];
20
+ export const USER_AGENT_VERDICT_MEMBERS = ['agent', 'kind', 'verdict'];
20
21
  export const ABUSE_CONTACT_MEMBERS = ['email'];
21
22
  export const WHOIS_MEMBERS = [
22
23
  'id', 'name', 'org', 'country', 'status', 'source', 'domain', 'abuse_email', 'asn',
@@ -52,13 +53,14 @@ export const ENTITLEMENT_USAGE_MEMBERS = ['requests', 'quota', 'window_start', '
52
53
  const FLAG = 'boolean';
53
54
  export const LOOKUP_TYPES = {
54
55
  ip: 'string', is_bogon: FLAG, is_vpn: FLAG, is_tor: FLAG, is_relay: FLAG, is_resproxy: FLAG, is_dcproxy: FLAG,
55
- is_mobproxy: FLAG, is_pubproxy: FLAG, is_hosting: FLAG, is_cdn: FLAG, is_anycast: FLAG, is_carrier: FLAG,
56
- is_satellite: FLAG, is_ssh: FLAG, is_smtp: FLAG, is_web: FLAG, is_dns_resolver: FLAG, is_bittorrent: FLAG,
56
+ is_mobproxy: FLAG, is_pubproxy: FLAG, is_hosting: FLAG, is_cdn: FLAG, is_bot: FLAG, is_anycast: FLAG,
57
+ is_carrier: FLAG, is_satellite: FLAG, is_ssh: FLAG, is_smtp: FLAG, is_web: FLAG, is_dns_resolver: FLAG,
58
+ is_bittorrent: FLAG,
57
59
  vpn: 'object', tor: 'object', relay: 'object', resproxy: 'object', dcproxy: 'object', mobproxy: 'object',
58
- pubproxy: 'object', hosting: 'object', cdn: 'object', carrier: 'object', satellite: 'object', ssh: 'object',
59
- smtp: 'object', web: 'array', dns_resolver: 'object', bittorrent: 'object', location: 'object', asn: 'object',
60
+ pubproxy: 'object', hosting: 'object', cdn: 'object', bot: 'object', carrier: 'object', satellite: 'object',
61
+ ssh: 'object', smtp: 'object', web: 'array', dns_resolver: 'object', bittorrent: 'object', location: 'object', asn: 'object',
60
62
  company: 'object', hostname: 'string', abuse: 'object', whois: 'object', rwhois: 'object',
61
- hosted_domains: 'object', trial_expired: FLAG, cap_reached: FLAG,
63
+ hosted_domains: 'object', user_agent: 'object', trial_expired: FLAG, cap_reached: FLAG,
62
64
  };
63
65
  export const CLASS_DETAIL_TYPES = {
64
66
  provider: 'string', provider_name: 'string', confidence: 'string', last_seen: 'string',
@@ -71,6 +73,13 @@ export const PUBPROXY_DETAIL_TYPES = {
71
73
  entry: 'boolean', exit: 'boolean', protocols: 'array', num_ports: 'integer', num_proxies: 'integer',
72
74
  last_seen: 'string', last_usable: 'string',
73
75
  };
76
+ export const BOT_DETAIL_TYPES = {
77
+ provider: 'string', provider_name: 'string', agents: 'array', categories: 'array', verified: 'boolean',
78
+ identity: 'string', verified_by: 'string', confidence: 'string', first_seen: 'string', last_seen: 'string',
79
+ };
80
+ export const USER_AGENT_VERDICT_TYPES = {
81
+ agent: 'string', kind: 'string', verdict: 'string',
82
+ };
74
83
  export const CARRIER_DETAIL_TYPES = {
75
84
  name: 'string', mcc: 'string', mnc: 'string', country: 'string', confidence: 'string',
76
85
  };
@@ -246,8 +255,8 @@ const DETAILS = [
246
255
  ['vpn', CLASS_DETAIL_TYPES], ['tor', CLASS_DETAIL_TYPES], ['relay', CLASS_DETAIL_TYPES],
247
256
  ['resproxy', PROXY_DETAIL_TYPES], ['dcproxy', PROXY_DETAIL_TYPES], ['mobproxy', PROXY_DETAIL_TYPES],
248
257
  ['pubproxy', PUBPROXY_DETAIL_TYPES], ['hosting', CLASS_DETAIL_TYPES], ['cdn', CLASS_DETAIL_TYPES],
249
- ['carrier', CARRIER_DETAIL_TYPES], ['satellite', SATELLITE_DETAIL_TYPES], ['ssh', SSH_DETAIL_TYPES],
250
- ['smtp', SMTP_DETAIL_TYPES], ['dns_resolver', DNS_RESOLVER_DETAIL_TYPES],
258
+ ['bot', BOT_DETAIL_TYPES], ['carrier', CARRIER_DETAIL_TYPES], ['satellite', SATELLITE_DETAIL_TYPES],
259
+ ['ssh', SSH_DETAIL_TYPES], ['smtp', SMTP_DETAIL_TYPES], ['dns_resolver', DNS_RESOLVER_DETAIL_TYPES],
251
260
  ['bittorrent', BITTORRENT_DETAIL_TYPES],
252
261
  ];
253
262
  // Required where the lookup itself requires them, and optional otherwise.
@@ -265,6 +274,8 @@ export function isLookup(data) {
265
274
  && DETAILS.every(([member, types]) => optional(data[member], (detail) => typed(detail, [], types)))
266
275
  && optional(data['pubproxy'], (pubproxy) => lists(pubproxy, 'protocols', isString))
267
276
  && optional(data['bittorrent'], (bittorrent) => lists(bittorrent, 'clients', isString))
277
+ && optional(data['bot'], (bot) => lists(bot, 'agents', isString) && lists(bot, 'categories', isString))
278
+ && optional(data['user_agent'], (verdict) => typed(verdict, USER_AGENT_VERDICT_MEMBERS, USER_AGENT_VERDICT_TYPES))
268
279
  && optional(data['web'], (web) => every(web, (row) => typed(row, WEB_DETAIL_MEMBERS, WEB_DETAIL_TYPES)))
269
280
  && optional(data['hosted_domains'], (hosted) => lists(hosted, 'domains', isString))
270
281
  && SHARED.every(([member, required, types]) => optional(data[member], (object) => typed(object, required, types)));
package/dist/store.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare class StoreTier {
31
31
  }
32
32
  /**
33
33
  * How long an answer stays cached: the TTL, or at most a minute for one marked
34
- * `trialExpired` or `capReached`, which a new UTC day or a raised cap ends. Still
34
+ * `trialExpired` or `capReached`, which a new UTC month or a raised cap ends. Still
35
35
  * cached, so a busy page past its trial does not send every repeat to the API.
36
36
  */
37
37
  export declare function lifeMs(result: Result, ttlMs: number): number;
package/dist/store.js CHANGED
@@ -44,7 +44,7 @@ export class StoreTier {
44
44
  }
45
45
  /**
46
46
  * How long an answer stays cached: the TTL, or at most a minute for one marked
47
- * `trialExpired` or `capReached`, which a new UTC day or a raised cap ends. Still
47
+ * `trialExpired` or `capReached`, which a new UTC month or a raised cap ends. Still
48
48
  * cached, so a busy page past its trial does not send every repeat to the API.
49
49
  */
50
50
  export function lifeMs(result, ttlMs) {
package/dist/types.d.ts CHANGED
@@ -1,5 +1,19 @@
1
- import type { AbuseContact, Asn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, CarrierDetail, ClassDetail, Company, CohostedDomains, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainHost, DomainIpRange, DomainIpRanges, DomainLookupResponse, DomainRedirects, DomainWeb, DomainWebLinks, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupResponse, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, WebDetail, Whois } from './generated/types.gen.js';
2
- export type { AbuseContact, Asn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, CarrierDetail, ClassDetail, Company, CohostedDomains, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainHost, DomainIpRange, DomainIpRanges, DomainLookupResponse, DomainRedirects, DomainWeb, DomainWebLinks, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupResponse, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, WebDetail, Whois, };
1
+ import type { AbuseContact, Asn as WireAsn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, Company, CohostedDomains, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainHost as WireDomainHost, DomainIpRange, DomainIpRanges, DomainLookupResponse as WireDomainLookupResponse, DomainRedirects, DomainWeb, DomainWebLinks, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupResponse as WireLookupResponse, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, UserAgentVerdict, WebDetail, Whois } from './generated/types.gen.js';
2
+ export type { AbuseContact, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, Company, CohostedDomains, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainIpRange, DomainIpRanges, DomainRedirects, DomainWeb, DomainWebLinks, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, UserAgentVerdict, WebDetail, Whois, };
3
+ /** The network announcing an address. Every answer carries `country` and `rpki_status`. */
4
+ export type Asn = Omit<WireAsn, 'country' | 'rpki_status'> & Partial<Pick<WireAsn, 'country' | 'rpki_status'>>;
5
+ /** A lookup's answer as it came off the wire. Every answer carries `is_bot`. */
6
+ export type LookupResponse = Omit<WireLookupResponse, 'asn' | 'is_bot'> & {
7
+ asn: Asn;
8
+ } & Partial<Pick<WireLookupResponse, 'is_bot'>>;
9
+ /** An address the domain resolves to, and the network announcing it. */
10
+ export type DomainHost = Omit<WireDomainHost, 'asn'> & {
11
+ asn: Asn;
12
+ };
13
+ /** A domain lookup's answer as it came off the wire. */
14
+ export type DomainLookupResponse = Omit<WireDomainLookupResponse, 'hosting'> & {
15
+ hosting?: DomainHost[];
16
+ };
3
17
  /**
4
18
  * What a lookup answers about one address.
5
19
  *
@@ -27,6 +41,12 @@ export interface Result {
27
41
  isPubproxy?: boolean;
28
42
  isHosting?: boolean;
29
43
  isCdn?: boolean;
44
+ /**
45
+ * In Bot IP: an automated client's address, such as a search engine's or an AI
46
+ * company's crawler. Every answer carries it, on every plan; `bot` says whose.
47
+ * Optional in this type only so a `Result` written out by hand still compiles.
48
+ */
49
+ isBot?: boolean;
30
50
  isAnycast: boolean;
31
51
  isCarrier: boolean;
32
52
  isSatellite: boolean;
@@ -55,6 +75,8 @@ export interface Result {
55
75
  pubproxy?: PubproxyDetail;
56
76
  hosting?: ClassDetail;
57
77
  cdn?: ClassDetail;
78
+ /** Whose bot uses the address, what it does and whether its operator vouches for it. `{}` when `isBot` is false. */
79
+ bot?: BotDetail;
58
80
  carrier?: CarrierDetail;
59
81
  satellite?: SatelliteDetail;
60
82
  ssh?: SshDetail;
@@ -72,6 +94,8 @@ export interface Result {
72
94
  whois?: Whois;
73
95
  rwhois?: Rwhois;
74
96
  hostedDomains?: HostedDomains;
97
+ /** Only on an answer to a request that sent a user agent: the agent it names, and whether this address bears it out. */
98
+ userAgent?: UserAgentVerdict;
75
99
  /** The response exactly as it came off the wire, with its original names. */
76
100
  raw: LookupResponse;
77
101
  }
package/dist/types.js CHANGED
@@ -7,8 +7,8 @@ const RESULT_NAMES = {
7
7
  is_resproxy: 'isResproxy', is_dcproxy: 'isDcproxy', is_mobproxy: 'isMobproxy', is_pubproxy: 'isPubproxy',
8
8
  is_hosting: 'isHosting', is_cdn: 'isCdn', is_anycast: 'isAnycast', is_carrier: 'isCarrier',
9
9
  is_satellite: 'isSatellite', is_ssh: 'isSsh', is_smtp: 'isSmtp', is_web: 'isWeb',
10
- is_dns_resolver: 'isDnsResolver', is_bittorrent: 'isBittorrent', trial_expired: 'trialExpired',
11
- cap_reached: 'capReached',
10
+ is_dns_resolver: 'isDnsResolver', is_bittorrent: 'isBittorrent', is_bot: 'isBot', trial_expired: 'trialExpired',
11
+ cap_reached: 'capReached', bot: 'bot', user_agent: 'userAgent',
12
12
  vpn: 'vpn', tor: 'tor', relay: 'relay', resproxy: 'resproxy', dcproxy: 'dcproxy', mobproxy: 'mobproxy',
13
13
  pubproxy: 'pubproxy', hosting: 'hosting', cdn: 'cdn', carrier: 'carrier', satellite: 'satellite', ssh: 'ssh',
14
14
  smtp: 'smtp', web: 'web', dns_resolver: 'dnsResolver', bittorrent: 'bittorrent', location: 'location',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "internetdata-web",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "Official browser client library for the InternetData API. Look up IP addresses, ASNs and domains from a page or a browser extension.",
5
5
  "type": "module",
6
6
  "license": "MIT",