@internetdata/internetdata 2.19.0 → 2.21.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 +14 -12
- package/dist/client.d.ts +8 -6
- package/dist/client.js +5 -5
- package/dist/client.js.map +1 -1
- package/dist/generated/sdk.gen.d.ts +5 -5
- package/dist/generated/sdk.gen.js +5 -5
- package/dist/generated/types.gen.d.ts +130 -116
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/middleware/condition.d.ts +5 -4
- package/dist/middleware/condition.js +24 -12
- package/dist/middleware/condition.js.map +1 -1
- package/dist/middleware/core.d.ts +15 -5
- package/dist/middleware/core.js +55 -7
- package/dist/middleware/core.js.map +1 -1
- package/dist/middleware/crawlers.gen.d.ts +2 -0
- package/dist/middleware/crawlers.gen.js +68 -0
- package/dist/middleware/crawlers.gen.js.map +1 -0
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/middleware/index.js.map +1 -1
- package/dist/shapes.d.ts +2 -2
- package/dist/shapes.js +5 -4
- package/dist/shapes.js.map +1 -1
- package/dist/types.d.ts +28 -15
- package/dist/types.js +19 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import type { AbuseContact, Asn as WireAsn, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, Company, Database, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, CohostedDomains, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainHost as WireDomainHost, DomainIpRange, DomainIpRanges, DomainLookupResponse as WireDomainLookupResponse, DomainRedirects, DomainWeb, DomainWebLinks, Download, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, LookupResponse as WireLookupResponse, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, Standing, UserAgentVerdict, WebDetail, Whois } from './generated/types.gen.js';
|
|
2
2
|
export type { AbuseContact, AsnHostedDomains, AsnLookupResponse, AsnPrefix, BitTorrentDetail, BotDetail, CarrierDetail, ClassDetail, Company, Database, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, CohostedDomains, DisposableDetail, DnsAddressRecord, DnsCnameRecord, DnsMxRecord, DnsNsRecord, DnsResolverDetail, DomainBacklinks, DomainDns, DomainIpRange, DomainIpRanges, DomainRedirects, DomainWeb, DomainWebLinks, Download, Entitlement, EntitlementApikey, EntitlementPlan, EntitlementUsage, HostedDomains, Location, ProxyDetail, PubproxyDetail, Rwhois, SatelliteDetail, SmtpDetail, SshDetail, Standing, UserAgentVerdict, WebDetail, Whois, };
|
|
3
3
|
type HeldFlag = 'is_carrier' | 'is_satellite' | 'is_ssh' | 'is_smtp' | 'is_web' | 'is_dns_resolver' | 'is_bittorrent';
|
|
4
|
+
type HeldObject = 'company' | 'abuse';
|
|
4
5
|
/**
|
|
5
6
|
* The wire's name for each flag a keyless answer no longer carries, by its `Result` name. Their public
|
|
6
7
|
* types are held, so an absent one reads `false` until the next major; `raw` says which were sent.
|
|
7
8
|
*/
|
|
8
9
|
export declare const HELD_FLAGS: Readonly<Record<string, HeldFlag>>;
|
|
10
|
+
/** Every member of a `Result` whose public type is held, by the name the wire gives it. */
|
|
11
|
+
export declare const HELD_MEMBERS: Readonly<Record<string, string>>;
|
|
9
12
|
/**
|
|
10
13
|
* The network announcing an address. Every answer carries `country` and `rpki_status`. The spec makes
|
|
11
14
|
* `type` a paid plan's, so an answer may lack it, and it stays a string in this type until the next major.
|
|
12
15
|
*/
|
|
13
16
|
export type Asn = Omit<WireAsn, 'type' | 'country' | 'rpki_status'> & Required<Pick<WireAsn, 'type'>> & Partial<Pick<WireAsn, 'country' | 'rpki_status'>>;
|
|
14
17
|
/**
|
|
15
|
-
* A lookup's answer as it came off the wire. `is_bot
|
|
16
|
-
* `is_bittorrent` are on a paid plan or
|
|
17
|
-
* stay
|
|
18
|
+
* A lookup's answer as it came off the wire. `is_bot`, the seven flags from `is_carrier` to
|
|
19
|
+
* `is_bittorrent`, `company` and `abuse` are on a paid plan or a free key's full answers: the basics lack
|
|
20
|
+
* all ten, though the seven flags and the two objects stay present in this type until the next major.
|
|
18
21
|
*/
|
|
19
|
-
export type LookupResponse = Omit<WireLookupResponse, 'asn' | 'is_bot' | HeldFlag> & {
|
|
22
|
+
export type LookupResponse = Omit<WireLookupResponse, 'asn' | 'is_bot' | HeldFlag | HeldObject> & {
|
|
20
23
|
asn: Asn;
|
|
21
|
-
} & Partial<Pick<WireLookupResponse, 'is_bot'>> & Required<Pick<WireLookupResponse, HeldFlag>>;
|
|
24
|
+
} & Partial<Pick<WireLookupResponse, 'is_bot'>> & Required<Pick<WireLookupResponse, HeldFlag | HeldObject>>;
|
|
22
25
|
/** An address the domain resolves to, and the network announcing it. */
|
|
23
26
|
export type DomainHost = Omit<WireDomainHost, 'asn'> & {
|
|
24
27
|
asn: Asn;
|
|
@@ -48,7 +51,7 @@ export declare const LICENSE_TYPES: readonly NonNullable<LicenseType>[];
|
|
|
48
51
|
* `undefined` is "not in your plan", `false` is "checked, and no". Use
|
|
49
52
|
* `?? false` when you only care whether the address is flagged. The same holds
|
|
50
53
|
* inside `location`, `asn`, `company` and `abuse`, whose paid members are
|
|
51
|
-
* absent
|
|
54
|
+
* absent from the basics, `company` and `abuse` themselves included.
|
|
52
55
|
*
|
|
53
56
|
* A detail object that is present but empty (`{}`, and Web IP's `[]`) means the
|
|
54
57
|
* flag above it is false. A populated one always carries every one of its keys.
|
|
@@ -70,10 +73,10 @@ export interface Result {
|
|
|
70
73
|
isAnycast: boolean;
|
|
71
74
|
/**
|
|
72
75
|
* `isCarrier` to `isBittorrent` are the flags of Carrier IP, Satellite IP, SSH IP, SMTP IP, Web IP, DNS
|
|
73
|
-
* Resolver IP and BitTorrent IP, on a paid plan or
|
|
74
|
-
* they read `false` there so code written when
|
|
75
|
-
* major. `raw` has a member only when the API sent it, and a `blockCondition` on one an
|
|
76
|
-
* reported as a plan gap.
|
|
76
|
+
* Resolver IP and BitTorrent IP, on a paid plan or a free key's full answers. The basics do not send
|
|
77
|
+
* them, and they read `false` there so code written when they did keeps working; they become optional
|
|
78
|
+
* at the next major. `raw` has a member only when the API sent it, and a `blockCondition` on one an
|
|
79
|
+
* answer lacks is reported as a plan gap.
|
|
77
80
|
*/
|
|
78
81
|
isCarrier: boolean;
|
|
79
82
|
isSatellite: boolean;
|
|
@@ -84,19 +87,19 @@ export interface Result {
|
|
|
84
87
|
isBittorrent: boolean;
|
|
85
88
|
/**
|
|
86
89
|
* In Bot IP: an automated client's address, such as a search engine's or an AI
|
|
87
|
-
* company's crawler; `bot` says whose. On a paid plan or
|
|
88
|
-
* `undefined` on
|
|
90
|
+
* company's crawler; `bot` says whose. On a paid plan or a free key's full answers, so it is
|
|
91
|
+
* `undefined` on the basics.
|
|
89
92
|
*/
|
|
90
93
|
isBot?: boolean;
|
|
91
94
|
/**
|
|
92
|
-
* On answers to a key on the free plan only: `false` while
|
|
93
|
-
*
|
|
95
|
+
* On answers to a key on the free plan only: `false` while the organization's full answers
|
|
96
|
+
* for the UTC day last, `true` once they are used and the answer has the basics.
|
|
94
97
|
*/
|
|
95
98
|
trialExpired?: boolean;
|
|
96
99
|
/**
|
|
97
100
|
* On answers to a key on a paid plan only: `false` while the answer has every
|
|
98
101
|
* field, `true` once the organization's overage cap is reached and the answer
|
|
99
|
-
* has
|
|
102
|
+
* has the basics. Lookups answered past the cap are not billed.
|
|
100
103
|
*/
|
|
101
104
|
capReached?: boolean;
|
|
102
105
|
vpn?: ClassDetail;
|
|
@@ -122,9 +125,19 @@ export interface Result {
|
|
|
122
125
|
userAgent?: UserAgentVerdict;
|
|
123
126
|
location: Location;
|
|
124
127
|
asn: Asn;
|
|
128
|
+
/**
|
|
129
|
+
* Who uses the address. On a paid plan or a free key's full answers: the basics lack it, and it reads
|
|
130
|
+
* `{ name: '', domain: '' }` there so code written when every answer had it keeps working; it becomes
|
|
131
|
+
* optional at the next major. `raw` has it only when the API sent it, and a `blockCondition` naming a
|
|
132
|
+
* member of it is reported as a plan gap, as `company`, when the answer lacks it.
|
|
133
|
+
*/
|
|
125
134
|
company: Company;
|
|
126
135
|
/** The name the address's reverse DNS (PTR) record points to, empty when it has none. */
|
|
127
136
|
hostname: string;
|
|
137
|
+
/**
|
|
138
|
+
* Where to report abuse. On a paid plan or a free key's full answers, held like `company`: it reads
|
|
139
|
+
* `{ email: '' }` when the answer lacks it.
|
|
140
|
+
*/
|
|
128
141
|
abuse: AbuseContact;
|
|
129
142
|
whois?: Whois;
|
|
130
143
|
rwhois?: Rwhois;
|
package/dist/types.js
CHANGED
|
@@ -6,6 +6,18 @@ export const HELD_FLAGS = {
|
|
|
6
6
|
isCarrier: 'is_carrier', isSatellite: 'is_satellite', isSsh: 'is_ssh', isSmtp: 'is_smtp', isWeb: 'is_web',
|
|
7
7
|
isDnsResolver: 'is_dns_resolver', isBittorrent: 'is_bittorrent',
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* What an absent `company` or `abuse` reads as in a `Result`: the object with each member its type requires
|
|
11
|
+
* empty, as a bogon's answer has them, a fresh one each time so no caller shares or alters another's.
|
|
12
|
+
*/
|
|
13
|
+
const EMPTY_OBJECTS = {
|
|
14
|
+
company: () => ({ name: '', domain: '' }),
|
|
15
|
+
abuse: () => ({ email: '' }),
|
|
16
|
+
};
|
|
17
|
+
/** Every member of a `Result` whose public type is held, by the name the wire gives it. */
|
|
18
|
+
export const HELD_MEMBERS = {
|
|
19
|
+
...HELD_FLAGS, ...Object.fromEntries(Object.keys(EMPTY_OBJECTS).map((member) => [member, member])),
|
|
20
|
+
};
|
|
9
21
|
// The runtime halves of the three closed vocabularies above, for a caller that
|
|
10
22
|
// wants to validate or enumerate rather than switch. Each is TYPED by the
|
|
11
23
|
// generated union, so a value the spec does not define will not compile; that a
|
|
@@ -51,9 +63,14 @@ const DOMAIN_RESULT_NAMES = {
|
|
|
51
63
|
};
|
|
52
64
|
export function toResult(body) {
|
|
53
65
|
const result = renamed(body, RESULT_NAMES);
|
|
54
|
-
|
|
66
|
+
const held = result;
|
|
67
|
+
// Held at their public type: an answer without one reads as the type's empty value, false for a flag,
|
|
68
|
+
// as the basics did before they lacked it.
|
|
55
69
|
for (const member of Object.keys(HELD_FLAGS)) {
|
|
56
|
-
|
|
70
|
+
held[member] ??= false;
|
|
71
|
+
}
|
|
72
|
+
for (const [member, empty] of Object.entries(EMPTY_OBJECTS)) {
|
|
73
|
+
held[member] ??= empty();
|
|
57
74
|
}
|
|
58
75
|
return result;
|
|
59
76
|
}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkCA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAuC;IAC1D,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ;IACzG,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,eAAe;CAClE,CAAC;AAEF;;;GAGG;AACH,MAAM,aAAa,GAA+D;IAC9E,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACzC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;CAC/B,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,YAAY,GAAqC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EAAE,mBAAmB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,OAAO,CAAyC,IAAO,EAAE,KAA8B;IAC5F,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAS,KAAK,CAAC,EAAE,CAAC;QACrD,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAe,CAAC,KAAK,SAAS,EAAE,CAAC;YACtD,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAe,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAClB,OAAO,GAAQ,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetdata/internetdata",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"description": "Official Node.js client library for the InternetData API. Look up IP addresses, ASNs and domains, and download licensed IP database files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|