internetdata-web 1.2.0 → 1.3.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
@@ -221,7 +221,7 @@ try {
221
221
 
222
222
  `kind` is one of `bad_request`, `unauthorized`, `forbidden`, `rate_limited`, `quota_exceeded`, `server_error` or `network`.
223
223
 
224
- Note that `rate_limited` and `quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is when the API faces extreme traffic bursts and so retrying later works; but a spent quota needs your allowance raised or the window to roll over. The library retries rate limits for you, but not if your quota is exceeded.
224
+ Note that `rate_limited` and `quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is when the API faces extreme traffic bursts and so retrying later works; but a 429 without `Retry-After` is `quota_exceeded`, which the library never retries. The API itself always sends `Retry-After` with a 429, so that one comes from something in between, such as a proxy; a paid key past its overage cap gets `capReached` instead.
225
225
 
226
226
  A request the browser never got an answer to is a retryable `network` error carrying what the browser said: offline, blocked by an extension, or refused by the page's Content-Security-Policy.
227
227
 
@@ -261,12 +261,13 @@ The library is ES2022 and needs only what a browser has, `fetch` and, for PKCE,
261
261
 
262
262
  ### Absent is not false
263
263
 
264
- 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 daily trial is spent. A field your key does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
264
+ 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 daily 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".
265
265
 
266
266
  ```js
267
267
  result.isVpn ?? false // when you only want the flag
268
268
  result.isVpn === undefined // on Unlimited: not in your plan
269
269
  result.trialExpired === true // a free-plan key's daily trial is spent
270
+ result.capReached === true // a paid key is past its overage cap
270
271
  ```
271
272
 
272
273
  ## Other Libraries
@@ -104,7 +104,8 @@ export declare const lookupDomain: <ThrowOnError extends boolean = false>(option
104
104
  * Up to 1000 addresses, AS numbers and domains in one call, each answered exactly as its own
105
105
  * lookup would be and each counted as one lookup. Answers and failures are keyed by the string you sent, in
106
106
  * the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as the
107
- * lookup it is on any plan.
107
+ * lookup it is on any plan. An overage cap reached part way through answers the remaining items with
108
+ * Unlimited's fields and `cap_reached` `true`, in `results`.
108
109
  *
109
110
  */
110
111
  export declare const lookupBatch: <ThrowOnError extends boolean = false>(options: Options<LookupBatchData, ThrowOnError>) => RequestResult<LookupBatchResponses, LookupBatchErrors, ThrowOnError>;
@@ -192,7 +192,8 @@ export const lookupDomain = (options) => (options.client ?? client).get({
192
192
  * Up to 1000 addresses, AS numbers and domains in one call, each answered exactly as its own
193
193
  * lookup would be and each counted as one lookup. Answers and failures are keyed by the string you sent, in
194
194
  * the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as the
195
- * lookup it is on any plan.
195
+ * lookup it is on any plan. An overage cap reached part way through answers the remaining items with
196
+ * Unlimited's fields and `cap_reached` `true`, in `results`.
196
197
  *
197
198
  */
198
199
  export const lookupBatch = (options) => (options.client ?? client).post({
@@ -274,6 +274,10 @@ export type LookupResponse = {
274
274
  * On every answer to a key on the free plan, and on no other: `false` while the day's trial of every field lasts, `true` once the answer has Unlimited's fields.
275
275
  */
276
276
  trial_expired?: boolean;
277
+ /**
278
+ * On every answer to a key on a paid plan, and on no other: `false` while the answer has every field, `true` once its organization's overage cap is reached and the answer has Unlimited's. Lookups answered past the cap are not billed; raising or removing the cap in Billing turns it `false` again.
279
+ */
280
+ cap_reached?: boolean;
277
281
  };
278
282
  export type ClassDetail = {
279
283
  /**
@@ -954,6 +958,10 @@ export type AsnLookupResponse = {
954
958
  * On every answer to a key on the free plan, and on no other: `false` while the day's trial of every field lasts, `true` once the answer has Unlimited's fields.
955
959
  */
956
960
  trial_expired?: boolean;
961
+ /**
962
+ * On every answer to a key on a paid plan, and on no other: `false` while the answer has every field, `true` once its organization's overage cap is reached and the answer has Unlimited's. Lookups answered past the cap are not billed; raising or removing the cap in Billing turns it `false` again.
963
+ */
964
+ cap_reached?: boolean;
957
965
  };
958
966
  export type AsnPrefix = {
959
967
  /**
@@ -1031,6 +1039,10 @@ export type DomainLookupResponse = {
1031
1039
  * On every answer to a key on the free plan, and on no other: `false` while the day's trial of every field lasts, `true` once the answer has Unlimited's fields.
1032
1040
  */
1033
1041
  trial_expired?: boolean;
1042
+ /**
1043
+ * On every answer to a key on a paid plan, and on no other: `false` while the answer has every field, `true` once its organization's overage cap is reached and the answer has Unlimited's. Lookups answered past the cap are not billed; raising or removing the cap in Billing turns it `false` again.
1044
+ */
1045
+ cap_reached?: boolean;
1034
1046
  };
1035
1047
  /**
1036
1048
  * Its records in Domain DNS, up to 100 a type. Paid plans and the trial.
@@ -1211,7 +1223,7 @@ export type EntitlementApikey = {
1211
1223
  */
1212
1224
  expires: string | null;
1213
1225
  /**
1214
- * The source addresses this key may be used from. EMPTY means
1226
+ * The source addresses this key may be used from. Empty means
1215
1227
  * unrestricted, never "deny all".
1216
1228
  *
1217
1229
  */
@@ -1255,9 +1267,12 @@ export type EntitlementUsage = {
1255
1267
  */
1256
1268
  quota: number;
1257
1269
  /**
1258
- * Where we stop serving. NULL means never, which is the normal state
1259
- * of an uncapped paid plan and is not the same as zero. Above the
1260
- * quota and below this, requests are served and billed as overage.
1270
+ * Where full answers stop: past it, a paid key is answered with
1271
+ * Unlimited's fields and `cap_reached: true`, uncharged, until the
1272
+ * window ends or the cap is raised. `null` means never, which is the
1273
+ * normal state of an uncapped paid plan and is not the same as zero.
1274
+ * Above the quota and below this, requests are served and billed as
1275
+ * overage.
1261
1276
  *
1262
1277
  */
1263
1278
  hard_limit: number | null;
@@ -1361,8 +1376,9 @@ export type LookupIpErrors = {
1361
1376
  */
1362
1377
  403: LookupError;
1363
1378
  /**
1364
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1365
- * limit), or, with none, a paid plan's overage cap.
1379
+ * A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1380
+ * per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1381
+ * Unlimited's fields and `cap_reached` `true`.
1366
1382
  *
1367
1383
  */
1368
1384
  429: LookupError;
@@ -1397,8 +1413,9 @@ export type LookupMyIpErrors = {
1397
1413
  */
1398
1414
  403: LookupError;
1399
1415
  /**
1400
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1401
- * limit), or, with none, a paid plan's overage cap.
1416
+ * A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1417
+ * per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1418
+ * Unlimited's fields and `cap_reached` `true`.
1402
1419
  *
1403
1420
  */
1404
1421
  429: LookupError;
@@ -1442,8 +1459,9 @@ export type LookupAsnErrors = {
1442
1459
  */
1443
1460
  403: LookupError;
1444
1461
  /**
1445
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1446
- * limit), or, with none, a paid plan's overage cap.
1462
+ * A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1463
+ * per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1464
+ * Unlimited's fields and `cap_reached` `true`.
1447
1465
  *
1448
1466
  */
1449
1467
  429: LookupError;
@@ -1487,8 +1505,9 @@ export type LookupDomainErrors = {
1487
1505
  */
1488
1506
  403: LookupError;
1489
1507
  /**
1490
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1491
- * limit), or, with none, a paid plan's overage cap.
1508
+ * A rate limit, always with `Retry-After`: this API protecting itself, or Unlimited's
1509
+ * per-minute limit. A paid plan's overage cap is never a `429`: it answers `200` with
1510
+ * Unlimited's fields and `cap_reached` `true`.
1492
1511
  *
1493
1512
  */
1494
1513
  429: LookupError;
@@ -1560,7 +1579,8 @@ export type MyEntitlementErrors = {
1560
1579
  401: EntitlementError;
1561
1580
  /**
1562
1581
  * The key restricts which source addresses may use it, and this
1563
- * request did not come from one of them.
1582
+ * request did not come from one of them; or the key was sent over
1583
+ * plain HTTP, which is refused whatever the key.
1564
1584
  *
1565
1585
  */
1566
1586
  403: EntitlementError;
package/dist/shapes.js CHANGED
@@ -52,7 +52,7 @@ export const LOOKUP_TYPES = {
52
52
  pubproxy: 'object', hosting: 'object', cdn: 'object', carrier: 'object', satellite: 'object', ssh: 'object',
53
53
  smtp: 'object', web: 'array', dns_resolver: 'object', bittorrent: 'object', location: 'object', asn: 'object',
54
54
  company: 'object', hostname: 'string', abuse: 'object', whois: 'object', rwhois: 'object',
55
- hosted_domains: 'object', trial_expired: FLAG,
55
+ hosted_domains: 'object', trial_expired: FLAG, cap_reached: FLAG,
56
56
  };
57
57
  export const CLASS_DETAIL_TYPES = {
58
58
  provider: 'string', provider_name: 'string', confidence: 'string', last_seen: 'string',
@@ -125,6 +125,7 @@ export const ASN_LOOKUP_TYPES = {
125
125
  rpki_invalid: 'integer', rpki_not_found: 'integer', whois: 'object', prefixes: 'array', rank: 'integer',
126
126
  tier1: FLAG, num_upstreams: 'integer', upstreams: 'array', num_peers: 'integer', peers: 'array',
127
127
  num_downstreams: 'integer', downstreams: 'array', hosted_domains: 'object', trial_expired: FLAG,
128
+ cap_reached: FLAG,
128
129
  };
129
130
  export const ASN_PREFIX_TYPES = {
130
131
  prefix: 'string', peer_count: 'integer', rpki_status: 'string', first_seen: 'string', country: 'string',
@@ -133,6 +134,7 @@ export const ASN_PREFIX_TYPES = {
133
134
  export const DOMAIN_LOOKUP_TYPES = {
134
135
  domain: 'string', is_registered: FLAG, is_disposable: FLAG, has_a: FLAG, has_aaaa: FLAG, has_mx: FLAG,
135
136
  has_ns: FLAG, has_cname: FLAG, dns: 'object', ip_ranges: 'object', disposable: 'object', trial_expired: FLAG,
137
+ cap_reached: FLAG,
136
138
  };
137
139
  export const DOMAIN_DNS_TYPES = {
138
140
  a: 'array', aaaa: 'array', mx: 'array', ns: 'array', cname: 'array',
package/dist/types.d.ts CHANGED
@@ -40,6 +40,12 @@ export interface Result {
40
40
  * every field lasts, `true` once the answer has Unlimited's.
41
41
  */
42
42
  trialExpired?: boolean;
43
+ /**
44
+ * On answers to a key on a paid plan only: `false` while the answer has every
45
+ * field, `true` once the organization's overage cap is reached and the answer
46
+ * has Unlimited's. Lookups answered past the cap are not billed.
47
+ */
48
+ capReached?: boolean;
43
49
  vpn?: ClassDetail;
44
50
  tor: ClassDetail;
45
51
  relay: ClassDetail;
@@ -99,6 +105,7 @@ export interface AsnResult {
99
105
  downstreams?: number[];
100
106
  hostedDomains?: AsnHostedDomains;
101
107
  trialExpired?: boolean;
108
+ capReached?: boolean;
102
109
  /** The response exactly as it came off the wire, with its original names. */
103
110
  raw: AsnLookupResponse;
104
111
  }
@@ -117,6 +124,7 @@ export interface DomainResult {
117
124
  /** `{}` when `isDisposable` is false. */
118
125
  disposable?: DisposableDetail;
119
126
  trialExpired?: boolean;
127
+ capReached?: boolean;
120
128
  /** The response exactly as it came off the wire, with its original names. */
121
129
  raw: DomainLookupResponse;
122
130
  }
package/dist/types.js CHANGED
@@ -8,6 +8,7 @@ const RESULT_NAMES = {
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
10
  is_dns_resolver: 'isDnsResolver', is_bittorrent: 'isBittorrent', trial_expired: 'trialExpired',
11
+ cap_reached: 'capReached',
11
12
  vpn: 'vpn', tor: 'tor', relay: 'relay', resproxy: 'resproxy', dcproxy: 'dcproxy', mobproxy: 'mobproxy',
12
13
  pubproxy: 'pubproxy', hosting: 'hosting', cdn: 'cdn', carrier: 'carrier', satellite: 'satellite', ssh: 'ssh',
13
14
  smtp: 'smtp', web: 'web', dns_resolver: 'dnsResolver', bittorrent: 'bittorrent', location: 'location',
@@ -20,12 +21,13 @@ const ASN_RESULT_NAMES = {
20
21
  rpki_valid: 'rpkiValid', rpki_invalid: 'rpkiInvalid', rpki_not_found: 'rpkiNotFound', whois: 'whois',
21
22
  prefixes: 'prefixes', rank: 'rank', tier1: 'tier1', num_upstreams: 'numUpstreams', upstreams: 'upstreams',
22
23
  num_peers: 'numPeers', peers: 'peers', num_downstreams: 'numDownstreams', downstreams: 'downstreams',
23
- hosted_domains: 'hostedDomains', trial_expired: 'trialExpired',
24
+ hosted_domains: 'hostedDomains', trial_expired: 'trialExpired', cap_reached: 'capReached',
24
25
  };
25
26
  const DOMAIN_RESULT_NAMES = {
26
27
  domain: 'domain', is_registered: 'isRegistered', is_disposable: 'isDisposable', has_a: 'hasA',
27
28
  has_aaaa: 'hasAaaa', has_mx: 'hasMx', has_ns: 'hasNs', has_cname: 'hasCname', dns: 'dns',
28
29
  ip_ranges: 'ipRanges', disposable: 'disposable', trial_expired: 'trialExpired',
30
+ cap_reached: 'capReached',
29
31
  };
30
32
  export function toResult(body) {
31
33
  return renamed(body, RESULT_NAMES);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "internetdata-web",
3
- "version": "1.2.0",
4
- "description": "Official browser client library for the InternetData API. Look up IP addresses, ASes and domains from a page or a browser extension.",
3
+ "version": "1.3.1",
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",
7
7
  "homepage": "https://internetdata.io",