internetdata-web 1.1.0 → 1.2.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
  ```
@@ -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>;
@@ -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({
@@ -838,6 +838,19 @@ export type HostedDomains = {
838
838
  */
839
839
  domains?: Array<string>;
840
840
  };
841
+ /**
842
+ * 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.
843
+ */
844
+ export type AsnHostedDomains = {
845
+ /**
846
+ * How many registered domains resolve to an address the AS announces.
847
+ */
848
+ total: number;
849
+ /**
850
+ * Up to 10 of them, the most popular first; `[]` when none does.
851
+ */
852
+ domains?: Array<string>;
853
+ };
841
854
  /**
842
855
  * What every database says about one AS.
843
856
  */
@@ -904,6 +917,39 @@ export type AsnLookupResponse = {
904
917
  * What it announces, IPv4 then IPv6, up to 20000 a family. Paid plans and the trial.
905
918
  */
906
919
  prefixes?: Array<AsnPrefix>;
920
+ /**
921
+ * 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.
922
+ */
923
+ rank?: number;
924
+ /**
925
+ * 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.
926
+ */
927
+ tier1?: boolean;
928
+ /**
929
+ * How many AS numbers it gets transit from. Paid plans and the trial.
930
+ */
931
+ num_upstreams?: number;
932
+ /**
933
+ * Those AS numbers, ascending, up to 20000. Paid plans and the trial.
934
+ */
935
+ upstreams?: Array<number>;
936
+ /**
937
+ * How many AS numbers it exchanges its own and its customers' routes with. Paid plans and the trial.
938
+ */
939
+ num_peers?: number;
940
+ /**
941
+ * Those AS numbers, ascending, up to 20000. Paid plans and the trial.
942
+ */
943
+ peers?: Array<number>;
944
+ /**
945
+ * How many AS numbers it provides transit to. Paid plans and the trial.
946
+ */
947
+ num_downstreams?: number;
948
+ /**
949
+ * Those AS numbers, ascending, up to 20000. Paid plans and the trial.
950
+ */
951
+ downstreams?: Array<number>;
952
+ hosted_domains?: AsnHostedDomains;
907
953
  /**
908
954
  * 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
955
  */
@@ -1173,15 +1219,24 @@ export type EntitlementApikey = {
1173
1219
  };
1174
1220
  export type EntitlementPlan = {
1175
1221
  /**
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
1222
+ * The plan the organization is on, as an identifier that is never
1223
+ * renamed or reused: `free` for the free plan, or a paid plan's key.
1224
+ * Compare against it and show `name`. On `free`, usage counts the
1178
1225
  * day's lookups answered with every field, its daily trial.
1179
1226
  *
1180
1227
  */
1181
1228
  key: string;
1229
+ /**
1230
+ * The plan's name, as the site and console show it: `Unlimited` for
1231
+ * the free plan. Show this rather than a name built from `key`: a
1232
+ * plan's name can change, and its key never does.
1233
+ *
1234
+ */
1235
+ name: string;
1182
1236
  /**
1183
1237
  * 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
1238
+ * back; `free` is the free plan's. This list never gains a value: a
1239
+ * new plan reports one of these. What each tier includes is documented
1185
1240
  * on the lookup endpoint rather than repeated here, so there is one
1186
1241
  * place it can be wrong.
1187
1242
  *
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 = {
@@ -122,7 +122,9 @@ 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,
126
128
  };
127
129
  export const ASN_PREFIX_TYPES = {
128
130
  prefix: 'string', peer_count: 'integer', rpki_status: 'string', first_seen: 'string', country: 'string',
@@ -157,7 +159,7 @@ export const ENTITLEMENT_TYPES = {
157
159
  export const ENTITLEMENT_APIKEY_TYPES = {
158
160
  id: 'string', expires: 'date-time', allowed_cidrs: 'array',
159
161
  };
160
- export const ENTITLEMENT_PLAN_TYPES = { key: 'string', tier: 'string' };
162
+ export const ENTITLEMENT_PLAN_TYPES = { key: 'string', name: 'string', tier: 'string' };
161
163
  export const ENTITLEMENT_USAGE_TYPES = {
162
164
  requests: 'integer', quota: 'integer', hard_limit: 'integer', window_start: 'date-time',
163
165
  window_end: 'date-time',
@@ -254,7 +256,12 @@ export function isAsnLookup(data) {
254
256
  return typed(data, ASN_LOOKUP_MEMBERS, ASN_LOOKUP_TYPES)
255
257
  && optional(data['whois'], (whois) => values(whois, isString))
256
258
  && lists(data, 'prefixes', (prefix) => typed(prefix, ASN_PREFIX_MEMBERS, ASN_PREFIX_TYPES)
257
- && every(prefix['other_origins'], Number.isInteger));
259
+ && every(prefix['other_origins'], Number.isInteger))
260
+ && lists(data, 'upstreams', Number.isInteger)
261
+ && lists(data, 'peers', Number.isInteger)
262
+ && lists(data, 'downstreams', Number.isInteger)
263
+ && optional(data['hosted_domains'], (hosted) => typed(hosted, HOSTED_DOMAINS_MEMBERS, HOSTED_DOMAINS_TYPES)
264
+ && lists(hosted, 'domains', isString));
258
265
  }
259
266
  export function isDomainLookup(data) {
260
267
  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
  *
@@ -88,6 +88,16 @@ export interface AsnResult {
88
88
  [key: string]: string;
89
89
  };
90
90
  prefixes?: AsnPrefix[];
91
+ /** Its rank in ASN Extended by customer cone, 1 the largest; `0` for an AS seen in no AS path. */
92
+ rank?: number;
93
+ tier1?: boolean;
94
+ numUpstreams?: number;
95
+ upstreams?: number[];
96
+ numPeers?: number;
97
+ peers?: number[];
98
+ numDownstreams?: number;
99
+ downstreams?: number[];
100
+ hostedDomains?: AsnHostedDomains;
91
101
  trialExpired?: boolean;
92
102
  /** The response exactly as it came off the wire, with its original names. */
93
103
  raw: AsnLookupResponse;
package/dist/types.js CHANGED
@@ -18,7 +18,9 @@ const ASN_RESULT_NAMES = {
18
18
  asn: 'asn', name: 'name', country: 'country', registry: 'registry', allocated: 'allocated', domain: 'domain',
19
19
  type: 'type', num_ips: 'numIps', num_prefixes4: 'numPrefixes4', num_prefixes6: 'numPrefixes6',
20
20
  rpki_valid: 'rpkiValid', rpki_invalid: 'rpkiInvalid', rpki_not_found: 'rpkiNotFound', whois: 'whois',
21
- prefixes: 'prefixes', trial_expired: 'trialExpired',
21
+ prefixes: 'prefixes', rank: 'rank', tier1: 'tier1', num_upstreams: 'numUpstreams', upstreams: 'upstreams',
22
+ num_peers: 'numPeers', peers: 'peers', num_downstreams: 'numDownstreams', downstreams: 'downstreams',
23
+ hosted_domains: 'hostedDomains', trial_expired: 'trialExpired',
22
24
  };
23
25
  const DOMAIN_RESULT_NAMES = {
24
26
  domain: 'domain', is_registered: 'isRegistered', is_disposable: 'isDisposable', has_a: 'hasA',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "internetdata-web",
3
- "version": "1.1.0",
3
+ "version": "1.2.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",