internetdata-web 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +282 -2
- package/dist/bogon.d.ts +31 -0
- package/dist/bogon.js +214 -0
- package/dist/bogons.gen.d.ts +2 -0
- package/dist/bogons.gen.js +87 -0
- package/dist/client.d.ts +183 -0
- package/dist/client.js +446 -0
- package/dist/errors.d.ts +66 -0
- package/dist/errors.js +185 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/client.gen.js +216 -0
- package/dist/generated/client/index.d.ts +10 -0
- package/dist/generated/client/index.js +6 -0
- package/dist/generated/client/types.gen.d.ts +120 -0
- package/dist/generated/client/types.gen.js +2 -0
- package/dist/generated/client/utils.gen.d.ts +37 -0
- package/dist/generated/client/utils.gen.js +228 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/client.gen.js +3 -0
- package/dist/generated/core/auth.gen.d.ts +25 -0
- package/dist/generated/core/auth.gen.js +14 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/bodySerializer.gen.js +57 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/params.gen.js +109 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/pathSerializer.gen.js +106 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/queryKeySerializer.gen.js +92 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/serverSentEvents.gen.js +132 -0
- package/dist/generated/core/types.gen.d.ts +83 -0
- package/dist/generated/core/types.gen.js +2 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/core/utils.gen.js +87 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +2 -0
- package/dist/generated/sdk.gen.d.ts +117 -0
- package/dist/generated/sdk.gen.js +251 -0
- package/dist/generated/types.gen.d.ts +1523 -0
- package/dist/generated/types.gen.js +2 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +4 -0
- package/dist/oauth.d.ts +119 -0
- package/dist/oauth.js +247 -0
- package/dist/shapes.d.ts +68 -0
- package/dist/shapes.js +283 -0
- package/dist/store.d.ts +39 -0
- package/dist/store.js +64 -0
- package/dist/transport.d.ts +51 -0
- package/dist/transport.js +147 -0
- package/dist/types.d.ts +115 -0
- package/dist/types.js +46 -0
- package/package.json +65 -3
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
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, };
|
|
3
|
+
/**
|
|
4
|
+
* What a lookup answers about one address.
|
|
5
|
+
*
|
|
6
|
+
* An **optional** member is one your plan does not include. It never means "we
|
|
7
|
+
* could not check", so `undefined` and `false` are genuinely different answers:
|
|
8
|
+
* `undefined` is "not in your plan", `false` is "checked, and no". Use
|
|
9
|
+
* `?? false` when you only care whether the address is flagged. The same holds
|
|
10
|
+
* inside `location`, `asn`, `company` and `abuse`, whose paid members are
|
|
11
|
+
* absent on Unlimited.
|
|
12
|
+
*
|
|
13
|
+
* A detail object that is present but empty (`{}`, and Web IP's `[]`) means the
|
|
14
|
+
* flag above it is false. A populated one always carries every one of its keys.
|
|
15
|
+
*/
|
|
16
|
+
export interface Result {
|
|
17
|
+
/** The address that was looked up, as parsed: `::ffff:a.b.c.d` answers as `a.b.c.d`. */
|
|
18
|
+
ip: string;
|
|
19
|
+
/** Reserved space, answered from the address alone. Such an address never reaches the network. */
|
|
20
|
+
isBogon: boolean;
|
|
21
|
+
isVpn?: boolean;
|
|
22
|
+
isTor: boolean;
|
|
23
|
+
isRelay: boolean;
|
|
24
|
+
isResproxy?: boolean;
|
|
25
|
+
isDcproxy?: boolean;
|
|
26
|
+
isMobproxy?: boolean;
|
|
27
|
+
isPubproxy?: boolean;
|
|
28
|
+
isHosting?: boolean;
|
|
29
|
+
isCdn?: boolean;
|
|
30
|
+
isAnycast: boolean;
|
|
31
|
+
isCarrier: boolean;
|
|
32
|
+
isSatellite: boolean;
|
|
33
|
+
isSsh: boolean;
|
|
34
|
+
isSmtp: boolean;
|
|
35
|
+
isWeb: boolean;
|
|
36
|
+
isDnsResolver: boolean;
|
|
37
|
+
isBittorrent: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* On answers to a key on the free plan only: `false` while the day's trial of
|
|
40
|
+
* every field lasts, `true` once the answer has Unlimited's.
|
|
41
|
+
*/
|
|
42
|
+
trialExpired?: boolean;
|
|
43
|
+
vpn?: ClassDetail;
|
|
44
|
+
tor: ClassDetail;
|
|
45
|
+
relay: ClassDetail;
|
|
46
|
+
resproxy?: ProxyDetail;
|
|
47
|
+
dcproxy?: ProxyDetail;
|
|
48
|
+
mobproxy?: ProxyDetail;
|
|
49
|
+
pubproxy?: PubproxyDetail;
|
|
50
|
+
hosting?: ClassDetail;
|
|
51
|
+
cdn?: ClassDetail;
|
|
52
|
+
carrier?: CarrierDetail;
|
|
53
|
+
satellite?: SatelliteDetail;
|
|
54
|
+
ssh?: SshDetail;
|
|
55
|
+
smtp?: SmtpDetail;
|
|
56
|
+
/** A row per port that answered, lowest first. */
|
|
57
|
+
web?: WebDetail[];
|
|
58
|
+
dnsResolver?: DnsResolverDetail;
|
|
59
|
+
bittorrent?: BitTorrentDetail;
|
|
60
|
+
location: Location;
|
|
61
|
+
asn: Asn;
|
|
62
|
+
company: Company;
|
|
63
|
+
/** The name the address's reverse DNS (PTR) record points to, empty when it has none. */
|
|
64
|
+
hostname: string;
|
|
65
|
+
abuse: AbuseContact;
|
|
66
|
+
whois?: Whois;
|
|
67
|
+
rwhois?: Rwhois;
|
|
68
|
+
hostedDomains?: HostedDomains;
|
|
69
|
+
/** The response exactly as it came off the wire, with its original names. */
|
|
70
|
+
raw: LookupResponse;
|
|
71
|
+
}
|
|
72
|
+
/** What `lookupAsn` answers. An optional member is one your plan does not include, as on `Result`. */
|
|
73
|
+
export interface AsnResult {
|
|
74
|
+
asn: number;
|
|
75
|
+
name: string;
|
|
76
|
+
country: string;
|
|
77
|
+
registry: string;
|
|
78
|
+
allocated: string;
|
|
79
|
+
domain: string;
|
|
80
|
+
type?: string;
|
|
81
|
+
numIps?: number;
|
|
82
|
+
numPrefixes4?: number;
|
|
83
|
+
numPrefixes6?: number;
|
|
84
|
+
rpkiValid?: number;
|
|
85
|
+
rpkiInvalid?: number;
|
|
86
|
+
rpkiNotFound?: number;
|
|
87
|
+
whois?: {
|
|
88
|
+
[key: string]: string;
|
|
89
|
+
};
|
|
90
|
+
prefixes?: AsnPrefix[];
|
|
91
|
+
trialExpired?: boolean;
|
|
92
|
+
/** The response exactly as it came off the wire, with its original names. */
|
|
93
|
+
raw: AsnLookupResponse;
|
|
94
|
+
}
|
|
95
|
+
/** What `lookupDomain` answers. An optional member is one your plan does not include, as on `Result`. */
|
|
96
|
+
export interface DomainResult {
|
|
97
|
+
domain: string;
|
|
98
|
+
isRegistered: boolean;
|
|
99
|
+
isDisposable?: boolean;
|
|
100
|
+
hasA: boolean;
|
|
101
|
+
hasAaaa: boolean;
|
|
102
|
+
hasMx: boolean;
|
|
103
|
+
hasNs: boolean;
|
|
104
|
+
hasCname: boolean;
|
|
105
|
+
dns?: DomainDns;
|
|
106
|
+
ipRanges?: DomainIpRanges;
|
|
107
|
+
/** `{}` when `isDisposable` is false. */
|
|
108
|
+
disposable?: DisposableDetail;
|
|
109
|
+
trialExpired?: boolean;
|
|
110
|
+
/** The response exactly as it came off the wire, with its original names. */
|
|
111
|
+
raw: DomainLookupResponse;
|
|
112
|
+
}
|
|
113
|
+
export declare function toResult(body: LookupResponse): Result;
|
|
114
|
+
export declare function toAsnResult(body: AsnLookupResponse): AsnResult;
|
|
115
|
+
export declare function toDomainResult(body: DomainLookupResponse): DomainResult;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// The one place the wire's snake_case becomes idiomatic camelCase. Every member
|
|
2
|
+
// is copied when its key is PRESENT rather than truthy, so a plan that includes a
|
|
3
|
+
// field and answers `false` keeps it, and a plan that does not include it stays
|
|
4
|
+
// undefined. A member the spec adds fails to compile here until it is named.
|
|
5
|
+
const RESULT_NAMES = {
|
|
6
|
+
ip: 'ip', is_bogon: 'isBogon', is_vpn: 'isVpn', is_tor: 'isTor', is_relay: 'isRelay',
|
|
7
|
+
is_resproxy: 'isResproxy', is_dcproxy: 'isDcproxy', is_mobproxy: 'isMobproxy', is_pubproxy: 'isPubproxy',
|
|
8
|
+
is_hosting: 'isHosting', is_cdn: 'isCdn', is_anycast: 'isAnycast', is_carrier: 'isCarrier',
|
|
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
|
+
vpn: 'vpn', tor: 'tor', relay: 'relay', resproxy: 'resproxy', dcproxy: 'dcproxy', mobproxy: 'mobproxy',
|
|
12
|
+
pubproxy: 'pubproxy', hosting: 'hosting', cdn: 'cdn', carrier: 'carrier', satellite: 'satellite', ssh: 'ssh',
|
|
13
|
+
smtp: 'smtp', web: 'web', dns_resolver: 'dnsResolver', bittorrent: 'bittorrent', location: 'location',
|
|
14
|
+
asn: 'asn', company: 'company', hostname: 'hostname', abuse: 'abuse', whois: 'whois', rwhois: 'rwhois',
|
|
15
|
+
hosted_domains: 'hostedDomains',
|
|
16
|
+
};
|
|
17
|
+
const ASN_RESULT_NAMES = {
|
|
18
|
+
asn: 'asn', name: 'name', country: 'country', registry: 'registry', allocated: 'allocated', domain: 'domain',
|
|
19
|
+
type: 'type', num_ips: 'numIps', num_prefixes4: 'numPrefixes4', num_prefixes6: 'numPrefixes6',
|
|
20
|
+
rpki_valid: 'rpkiValid', rpki_invalid: 'rpkiInvalid', rpki_not_found: 'rpkiNotFound', whois: 'whois',
|
|
21
|
+
prefixes: 'prefixes', trial_expired: 'trialExpired',
|
|
22
|
+
};
|
|
23
|
+
const DOMAIN_RESULT_NAMES = {
|
|
24
|
+
domain: 'domain', is_registered: 'isRegistered', is_disposable: 'isDisposable', has_a: 'hasA',
|
|
25
|
+
has_aaaa: 'hasAaaa', has_mx: 'hasMx', has_ns: 'hasNs', has_cname: 'hasCname', dns: 'dns',
|
|
26
|
+
ip_ranges: 'ipRanges', disposable: 'disposable', trial_expired: 'trialExpired',
|
|
27
|
+
};
|
|
28
|
+
export function toResult(body) {
|
|
29
|
+
return renamed(body, RESULT_NAMES);
|
|
30
|
+
}
|
|
31
|
+
export function toAsnResult(body) {
|
|
32
|
+
return renamed(body, ASN_RESULT_NAMES);
|
|
33
|
+
}
|
|
34
|
+
export function toDomainResult(body) {
|
|
35
|
+
return renamed(body, DOMAIN_RESULT_NAMES);
|
|
36
|
+
}
|
|
37
|
+
function renamed(body, names) {
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const [from, to] of Object.entries(names)) {
|
|
40
|
+
if (from in body && body[from] !== undefined) {
|
|
41
|
+
out[to] = body[from];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
out['raw'] = body;
|
|
45
|
+
return out;
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "internetdata-web",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.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.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://internetdata.io",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/internetdata/sdk-web.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/internetdata/sdk-web/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ip-intelligence",
|
|
17
|
+
"ip-lookup",
|
|
18
|
+
"ip-geolocation",
|
|
19
|
+
"asn",
|
|
20
|
+
"asn-lookup",
|
|
21
|
+
"domain-lookup",
|
|
22
|
+
"dns",
|
|
23
|
+
"whois",
|
|
24
|
+
"ip-data",
|
|
25
|
+
"bogon",
|
|
26
|
+
"vpn",
|
|
27
|
+
"proxy",
|
|
28
|
+
"hosting",
|
|
29
|
+
"browser",
|
|
30
|
+
"browser-extension",
|
|
31
|
+
"client-side",
|
|
32
|
+
"esm"
|
|
33
|
+
],
|
|
34
|
+
"main": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"sideEffects": false,
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"README.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"lru-cache": "^11.0.2",
|
|
51
|
+
"p-limit": "^6.2.0",
|
|
52
|
+
"p-retry": "^8.0.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@hey-api/openapi-ts": "^0.99.0",
|
|
56
|
+
"@mslmio/eslint-config": "^1.1.0",
|
|
57
|
+
"eslint": "^10.10.0",
|
|
58
|
+
"playwright-core": "1.62.1",
|
|
59
|
+
"typescript": "^6.0.3"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "rm -rf dist && openapi-ts && tsc",
|
|
63
|
+
"lint": "eslint",
|
|
64
|
+
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
65
|
+
"test:browser": "pnpm run build && node test/browser/smoke.mjs",
|
|
66
|
+
"generate": "openapi-ts"
|
|
67
|
+
}
|
|
6
68
|
}
|