internetdata-web 1.1.0 → 1.3.0

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
@@ -73,7 +73,7 @@ console.log(domain.isRegistered); // true
73
73
  console.log(domain.dns?.mx); // on a paid plan
74
74
  ```
75
75
 
76
- Unlimited answers an AS's registration, and whether a domain is registered and which record types it has. A paid plan adds the AS's whois record and prefixes, and the domain's records, IP ranges and whether it is disposable. Neither lookup is cached or batched, and `lookup` refuses an AS or a domain before sending it.
76
+ Unlimited answers an AS's registration, and whether a domain is registered and which record types it has. A paid plan adds the AS's whois record, prefixes, rank, Tier 1 flag, upstreams, peers, downstreams and hosted domains, and the domain's records, IP ranges and whether it is disposable. Neither lookup is cached or batched, and `lookup` refuses an AS or a domain before sending it.
77
77
 
78
78
  ### Your own address
79
79
 
@@ -89,6 +89,7 @@ It is never cached, since which address the browser is calling from is the quest
89
89
  ```js
90
90
  const ent = await client.myEntitlement();
91
91
  console.log(ent.plan.key); // starter
92
+ console.log(ent.plan.name); // Starter, the name to show
92
93
  console.log(ent.usage.requests); // 580
93
94
  console.log(ent.usage.window_end); // when the allowance resets
94
95
  ```
@@ -220,7 +221,7 @@ try {
220
221
 
221
222
  `kind` is one of `bad_request`, `unauthorized`, `forbidden`, `rate_limited`, `quota_exceeded`, `server_error` or `network`.
222
223
 
223
- 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.
224
225
 
225
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.
226
227
 
@@ -260,12 +261,13 @@ The library is ES2022 and needs only what a browser has, `fetch` and, for PKCE,
260
261
 
261
262
  ### Absent is not false
262
263
 
263
- 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".
264
265
 
265
266
  ```js
266
267
  result.isVpn ?? false // when you only want the flag
267
268
  result.isVpn === undefined // on Unlimited: not in your plan
268
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
269
271
  ```
270
272
 
271
273
  ## Other Libraries
@@ -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, AsnLookupResponse, AsnPrefix, BatchLookupError, BatchLookupRequest, BatchLookupResponse, BitTorrentDetail, CarrierDetail, ClassDetail, ClientOptions, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainDns, DomainIpRange, DomainIpRanges, DomainLookupResponse, 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, CarrierDetail, ClassDetail, ClientOptions, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainDns, DomainIpRange, DomainIpRanges, DomainLookupResponse, 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';
@@ -81,9 +81,10 @@ export declare const lookupMyIp: <ThrowOnError extends boolean = false>(options?
81
81
  * ASN lookup
82
82
  *
83
83
  * Answers what InternetData knows about one autonomous system: its registration on every plan,
84
- * and on a paid one its ASN Whois record and every prefix it announces in global BGP, with RPKI status,
85
- * up to 20000 per address family (the counts beside them are always whole). An AS no database knows answers
86
- * its number with empty values.
84
+ * and on a paid one its ASN Whois record, every prefix it announces in global BGP, with RPKI status,
85
+ * up to 20000 per address family, its rank, Tier 1 flag, upstreams, peers and downstreams from ASN
86
+ * Extended, up to 20000 each (the counts beside them are always whole), and the domains it hosts. An AS no
87
+ * database knows answers its number with empty values.
87
88
  *
88
89
  */
89
90
  export declare const lookupAsn: <ThrowOnError extends boolean = false>(options: Options<LookupAsnData, ThrowOnError>) => RequestResult<LookupAsnResponses, LookupAsnErrors, ThrowOnError>;
@@ -103,7 +104,8 @@ export declare const lookupDomain: <ThrowOnError extends boolean = false>(option
103
104
  * Up to 1000 addresses, AS numbers and domains in one call, each answered exactly as its own
104
105
  * lookup would be and each counted as one lookup. Answers and failures are keyed by the string you sent, in
105
106
  * the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as the
106
- * 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`.
107
109
  *
108
110
  */
109
111
  export declare const lookupBatch: <ThrowOnError extends boolean = false>(options: Options<LookupBatchData, ThrowOnError>) => RequestResult<LookupBatchResponses, LookupBatchErrors, ThrowOnError>;
@@ -127,9 +127,10 @@ export const lookupMyIp = (options) => (options?.client ?? client).get({
127
127
  * ASN lookup
128
128
  *
129
129
  * Answers what InternetData knows about one autonomous system: its registration on every plan,
130
- * and on a paid one its ASN Whois record and every prefix it announces in global BGP, with RPKI status,
131
- * up to 20000 per address family (the counts beside them are always whole). An AS no database knows answers
132
- * its number with empty values.
130
+ * and on a paid one its ASN Whois record, every prefix it announces in global BGP, with RPKI status,
131
+ * up to 20000 per address family, its rank, Tier 1 flag, upstreams, peers and downstreams from ASN
132
+ * Extended, up to 20000 each (the counts beside them are always whole), and the domains it hosts. An AS no
133
+ * database knows answers its number with empty values.
133
134
  *
134
135
  */
135
136
  export const lookupAsn = (options) => (options.client ?? client).get({
@@ -191,7 +192,8 @@ export const lookupDomain = (options) => (options.client ?? client).get({
191
192
  * Up to 1000 addresses, AS numbers and domains in one call, each answered exactly as its own
192
193
  * lookup would be and each counted as one lookup. Answers and failures are keyed by the string you sent, in
193
194
  * the order you sent them; duplicates collapse. Needs a paid plan: a batch of one item is answered as the
194
- * 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`.
195
197
  *
196
198
  */
197
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
  /**
@@ -838,6 +842,19 @@ export type HostedDomains = {
838
842
  */
839
843
  domains?: Array<string>;
840
844
  };
845
+ /**
846
+ * From ASN Hosted Domains: how many registered domains the AS hosts, and the 10 most popular. Its database lists up to 1,000 an AS. Paid plans and the trial.
847
+ */
848
+ export type AsnHostedDomains = {
849
+ /**
850
+ * How many registered domains resolve to an address the AS announces.
851
+ */
852
+ total: number;
853
+ /**
854
+ * Up to 10 of them, the most popular first; `[]` when none does.
855
+ */
856
+ domains?: Array<string>;
857
+ };
841
858
  /**
842
859
  * What every database says about one AS.
843
860
  */
@@ -904,10 +921,47 @@ export type AsnLookupResponse = {
904
921
  * What it announces, IPv4 then IPv6, up to 20000 a family. Paid plans and the trial.
905
922
  */
906
923
  prefixes?: Array<AsnPrefix>;
924
+ /**
925
+ * Its rank in ASN Extended, by customer cone, 1 the largest; `0` for an AS seen in no AS path. Paid plans and the trial.
926
+ */
927
+ rank?: number;
928
+ /**
929
+ * Whether it is one of the transit-free networks at the top of the hierarchy, which get transit from no one and peer with each other. Paid plans and the trial.
930
+ */
931
+ tier1?: boolean;
932
+ /**
933
+ * How many AS numbers it gets transit from. Paid plans and the trial.
934
+ */
935
+ num_upstreams?: number;
936
+ /**
937
+ * Those AS numbers, ascending, up to 20000. Paid plans and the trial.
938
+ */
939
+ upstreams?: Array<number>;
940
+ /**
941
+ * How many AS numbers it exchanges its own and its customers' routes with. Paid plans and the trial.
942
+ */
943
+ num_peers?: number;
944
+ /**
945
+ * Those AS numbers, ascending, up to 20000. Paid plans and the trial.
946
+ */
947
+ peers?: Array<number>;
948
+ /**
949
+ * How many AS numbers it provides transit to. Paid plans and the trial.
950
+ */
951
+ num_downstreams?: number;
952
+ /**
953
+ * Those AS numbers, ascending, up to 20000. Paid plans and the trial.
954
+ */
955
+ downstreams?: Array<number>;
956
+ hosted_domains?: AsnHostedDomains;
907
957
  /**
908
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.
909
959
  */
910
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;
911
965
  };
912
966
  export type AsnPrefix = {
913
967
  /**
@@ -985,6 +1039,10 @@ export type DomainLookupResponse = {
985
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.
986
1040
  */
987
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;
988
1046
  };
989
1047
  /**
990
1048
  * Its records in Domain DNS, up to 100 a type. Paid plans and the trial.
@@ -1165,7 +1223,7 @@ export type EntitlementApikey = {
1165
1223
  */
1166
1224
  expires: string | null;
1167
1225
  /**
1168
- * The source addresses this key may be used from. EMPTY means
1226
+ * The source addresses this key may be used from. Empty means
1169
1227
  * unrestricted, never "deny all".
1170
1228
  *
1171
1229
  */
@@ -1173,15 +1231,24 @@ export type EntitlementApikey = {
1173
1231
  };
1174
1232
  export type EntitlementPlan = {
1175
1233
  /**
1176
- * The plan the organization is on: `free` for the free plan,
1177
- * Unlimited, or a paid plan's key. On `free`, usage counts the
1234
+ * The plan the organization is on, as an identifier that is never
1235
+ * renamed or reused: `free` for the free plan, or a paid plan's key.
1236
+ * Compare against it and show `name`. On `free`, usage counts the
1178
1237
  * day's lookups answered with every field, its daily trial.
1179
1238
  *
1180
1239
  */
1181
1240
  key: string;
1241
+ /**
1242
+ * The plan's name, as the site and console show it: `Unlimited` for
1243
+ * the free plan. Show this rather than a name built from `key`: a
1244
+ * plan's name can change, and its key never does.
1245
+ *
1246
+ */
1247
+ name: string;
1182
1248
  /**
1183
1249
  * The field tier, which decides how much of a lookup answer comes
1184
- * back; `free` is the free plan's. What each tier includes is documented
1250
+ * back; `free` is the free plan's. This list never gains a value: a
1251
+ * new plan reports one of these. What each tier includes is documented
1185
1252
  * on the lookup endpoint rather than repeated here, so there is one
1186
1253
  * place it can be wrong.
1187
1254
  *
@@ -1200,9 +1267,12 @@ export type EntitlementUsage = {
1200
1267
  */
1201
1268
  quota: number;
1202
1269
  /**
1203
- * Where we stop serving. NULL means never, which is the normal state
1204
- * of an uncapped paid plan and is not the same as zero. Above the
1205
- * 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.
1206
1276
  *
1207
1277
  */
1208
1278
  hard_limit: number | null;
@@ -1306,8 +1376,9 @@ export type LookupIpErrors = {
1306
1376
  */
1307
1377
  403: LookupError;
1308
1378
  /**
1309
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1310
- * 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`.
1311
1382
  *
1312
1383
  */
1313
1384
  429: LookupError;
@@ -1342,8 +1413,9 @@ export type LookupMyIpErrors = {
1342
1413
  */
1343
1414
  403: LookupError;
1344
1415
  /**
1345
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1346
- * 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`.
1347
1419
  *
1348
1420
  */
1349
1421
  429: LookupError;
@@ -1387,8 +1459,9 @@ export type LookupAsnErrors = {
1387
1459
  */
1388
1460
  403: LookupError;
1389
1461
  /**
1390
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1391
- * 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`.
1392
1465
  *
1393
1466
  */
1394
1467
  429: LookupError;
@@ -1432,8 +1505,9 @@ export type LookupDomainErrors = {
1432
1505
  */
1433
1506
  403: LookupError;
1434
1507
  /**
1435
- * A rate limit, with `Retry-After` (this API protecting itself, or Unlimited's per-minute
1436
- * 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`.
1437
1511
  *
1438
1512
  */
1439
1513
  429: LookupError;
@@ -1505,7 +1579,8 @@ export type MyEntitlementErrors = {
1505
1579
  401: EntitlementError;
1506
1580
  /**
1507
1581
  * The key restricts which source addresses may use it, and this
1508
- * 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.
1509
1584
  *
1510
1585
  */
1511
1586
  403: EntitlementError;
package/dist/shapes.d.ts CHANGED
@@ -21,7 +21,7 @@ export declare const BATCH_MEMBERS: readonly ["results", "errors"];
21
21
  export declare const BATCH_ERROR_MEMBERS: readonly ["status", "error"];
22
22
  export declare const ENTITLEMENT_MEMBERS: readonly ["org_id", "apikey", "plan", "usage"];
23
23
  export declare const ENTITLEMENT_APIKEY_MEMBERS: readonly ["id", "allowed_cidrs"];
24
- export declare const ENTITLEMENT_PLAN_MEMBERS: readonly ["key", "tier"];
24
+ export declare const ENTITLEMENT_PLAN_MEMBERS: readonly ["key", "name", "tier"];
25
25
  export declare const ENTITLEMENT_USAGE_MEMBERS: readonly ["requests", "quota", "window_start", "window_end"];
26
26
  type Kind = 'string' | 'integer' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'date-time';
27
27
  export declare const LOOKUP_TYPES: Record<string, Kind>;
package/dist/shapes.js CHANGED
@@ -41,7 +41,7 @@ export const BATCH_MEMBERS = ['results', 'errors'];
41
41
  export const BATCH_ERROR_MEMBERS = ['status', 'error'];
42
42
  export const ENTITLEMENT_MEMBERS = ['org_id', 'apikey', 'plan', 'usage'];
43
43
  export const ENTITLEMENT_APIKEY_MEMBERS = ['id', 'allowed_cidrs'];
44
- export const ENTITLEMENT_PLAN_MEMBERS = ['key', 'tier'];
44
+ export const ENTITLEMENT_PLAN_MEMBERS = ['key', 'name', 'tier'];
45
45
  export const ENTITLEMENT_USAGE_MEMBERS = ['requests', 'quota', 'window_start', 'window_end'];
46
46
  const FLAG = 'boolean';
47
47
  export const LOOKUP_TYPES = {
@@ -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',
@@ -122,7 +122,10 @@ export const HOSTED_DOMAINS_TYPES = { total: 'integer', domains: 'array' };
122
122
  export const ASN_LOOKUP_TYPES = {
123
123
  asn: 'integer', name: 'string', country: 'string', registry: 'string', allocated: 'string', domain: 'string',
124
124
  type: 'string', num_ips: 'integer', num_prefixes4: 'integer', num_prefixes6: 'integer', rpki_valid: 'integer',
125
- rpki_invalid: 'integer', rpki_not_found: 'integer', whois: 'object', prefixes: 'array', trial_expired: FLAG,
125
+ rpki_invalid: 'integer', rpki_not_found: 'integer', whois: 'object', prefixes: 'array', rank: 'integer',
126
+ tier1: FLAG, num_upstreams: 'integer', upstreams: 'array', num_peers: 'integer', peers: 'array',
127
+ num_downstreams: 'integer', downstreams: 'array', hosted_domains: 'object', trial_expired: FLAG,
128
+ cap_reached: FLAG,
126
129
  };
127
130
  export const ASN_PREFIX_TYPES = {
128
131
  prefix: 'string', peer_count: 'integer', rpki_status: 'string', first_seen: 'string', country: 'string',
@@ -131,6 +134,7 @@ export const ASN_PREFIX_TYPES = {
131
134
  export const DOMAIN_LOOKUP_TYPES = {
132
135
  domain: 'string', is_registered: FLAG, is_disposable: FLAG, has_a: FLAG, has_aaaa: FLAG, has_mx: FLAG,
133
136
  has_ns: FLAG, has_cname: FLAG, dns: 'object', ip_ranges: 'object', disposable: 'object', trial_expired: FLAG,
137
+ cap_reached: FLAG,
134
138
  };
135
139
  export const DOMAIN_DNS_TYPES = {
136
140
  a: 'array', aaaa: 'array', mx: 'array', ns: 'array', cname: 'array',
@@ -157,7 +161,7 @@ export const ENTITLEMENT_TYPES = {
157
161
  export const ENTITLEMENT_APIKEY_TYPES = {
158
162
  id: 'string', expires: 'date-time', allowed_cidrs: 'array',
159
163
  };
160
- export const ENTITLEMENT_PLAN_TYPES = { key: 'string', tier: 'string' };
164
+ export const ENTITLEMENT_PLAN_TYPES = { key: 'string', name: 'string', tier: 'string' };
161
165
  export const ENTITLEMENT_USAGE_TYPES = {
162
166
  requests: 'integer', quota: 'integer', hard_limit: 'integer', window_start: 'date-time',
163
167
  window_end: 'date-time',
@@ -254,7 +258,12 @@ export function isAsnLookup(data) {
254
258
  return typed(data, ASN_LOOKUP_MEMBERS, ASN_LOOKUP_TYPES)
255
259
  && optional(data['whois'], (whois) => values(whois, isString))
256
260
  && lists(data, 'prefixes', (prefix) => typed(prefix, ASN_PREFIX_MEMBERS, ASN_PREFIX_TYPES)
257
- && every(prefix['other_origins'], Number.isInteger));
261
+ && every(prefix['other_origins'], Number.isInteger))
262
+ && lists(data, 'upstreams', Number.isInteger)
263
+ && lists(data, 'peers', Number.isInteger)
264
+ && lists(data, 'downstreams', Number.isInteger)
265
+ && optional(data['hosted_domains'], (hosted) => typed(hosted, HOSTED_DOMAINS_MEMBERS, HOSTED_DOMAINS_TYPES)
266
+ && lists(hosted, 'domains', isString));
258
267
  }
259
268
  export function isDomainLookup(data) {
260
269
  return typed(data, DOMAIN_LOOKUP_MEMBERS, DOMAIN_LOOKUP_TYPES)
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { AbuseContact, Asn, AsnLookupResponse, AsnPrefix, BitTorrentDetail, CarrierDetail, ClassDetail, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainDns, DomainIpRange, DomainIpRanges, DomainLookupResponse, 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, AsnLookupResponse, AsnPrefix, BitTorrentDetail, CarrierDetail, ClassDetail, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainDns, DomainIpRange, DomainIpRanges, DomainLookupResponse, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupResponse, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, WebDetail, Whois, };
1
+ import type { AbuseContact, Asn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, CarrierDetail, ClassDetail, Company, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainDns, DomainIpRange, DomainIpRanges, DomainLookupResponse, 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, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainDns, DomainIpRange, DomainIpRanges, DomainLookupResponse, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupResponse, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, WebDetail, Whois, };
3
3
  /**
4
4
  * What a lookup answers about one address.
5
5
  *
@@ -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;
@@ -88,7 +94,18 @@ export interface AsnResult {
88
94
  [key: string]: string;
89
95
  };
90
96
  prefixes?: AsnPrefix[];
97
+ /** Its rank in ASN Extended by customer cone, 1 the largest; `0` for an AS seen in no AS path. */
98
+ rank?: number;
99
+ tier1?: boolean;
100
+ numUpstreams?: number;
101
+ upstreams?: number[];
102
+ numPeers?: number;
103
+ peers?: number[];
104
+ numDownstreams?: number;
105
+ downstreams?: number[];
106
+ hostedDomains?: AsnHostedDomains;
91
107
  trialExpired?: boolean;
108
+ capReached?: boolean;
92
109
  /** The response exactly as it came off the wire, with its original names. */
93
110
  raw: AsnLookupResponse;
94
111
  }
@@ -107,6 +124,7 @@ export interface DomainResult {
107
124
  /** `{}` when `isDisposable` is false. */
108
125
  disposable?: DisposableDetail;
109
126
  trialExpired?: boolean;
127
+ capReached?: boolean;
110
128
  /** The response exactly as it came off the wire, with its original names. */
111
129
  raw: DomainLookupResponse;
112
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',
@@ -18,12 +19,15 @@ const ASN_RESULT_NAMES = {
18
19
  asn: 'asn', name: 'name', country: 'country', registry: 'registry', allocated: 'allocated', domain: 'domain',
19
20
  type: 'type', num_ips: 'numIps', num_prefixes4: 'numPrefixes4', num_prefixes6: 'numPrefixes6',
20
21
  rpki_valid: 'rpkiValid', rpki_invalid: 'rpkiInvalid', rpki_not_found: 'rpkiNotFound', whois: 'whois',
21
- prefixes: 'prefixes', trial_expired: 'trialExpired',
22
+ prefixes: 'prefixes', rank: 'rank', tier1: 'tier1', num_upstreams: 'numUpstreams', upstreams: 'upstreams',
23
+ num_peers: 'numPeers', peers: 'peers', num_downstreams: 'numDownstreams', downstreams: 'downstreams',
24
+ hosted_domains: 'hostedDomains', trial_expired: 'trialExpired', cap_reached: 'capReached',
22
25
  };
23
26
  const DOMAIN_RESULT_NAMES = {
24
27
  domain: 'domain', is_registered: 'isRegistered', is_disposable: 'isDisposable', has_a: 'hasA',
25
28
  has_aaaa: 'hasAaaa', has_mx: 'hasMx', has_ns: 'hasNs', has_cname: 'hasCname', dns: 'dns',
26
29
  ip_ranges: 'ipRanges', disposable: 'disposable', trial_expired: 'trialExpired',
30
+ cap_reached: 'capReached',
27
31
  };
28
32
  export function toResult(body) {
29
33
  return renamed(body, RESULT_NAMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "internetdata-web",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Official browser client library for the InternetData API. Look up IP addresses, ASes and domains from a page or a browser extension.",
5
5
  "type": "module",
6
6
  "license": "MIT",