@push.rocks/smartnetwork 4.5.2 → 4.6.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartnetwork',
6
- version: '4.5.2',
6
+ version: '4.6.0',
7
7
  description: 'A toolkit for network diagnostics including speed tests, port availability checks, and more.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSwwQkFBMEI7SUFDaEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDhGQUE4RjtDQUM1RyxDQUFBIn0=
@@ -4,5 +4,7 @@ export { RustNetworkBridge } from './smartnetwork.classes.rustbridge.js';
4
4
  export { PublicIp } from './smartnetwork.classes.publicip.js';
5
5
  export { IpIntelligence } from './smartnetwork.classes.ipintelligence.js';
6
6
  export type { IIpIntelligenceResult, IIpIntelligenceOptions } from './smartnetwork.classes.ipintelligence.js';
7
+ export { DomainIntelligence } from './smartnetwork.classes.domainintelligence.js';
8
+ export type { IDomainIntelligenceResult, IDomainIntelligenceOptions } from './smartnetwork.classes.domainintelligence.js';
7
9
  export { setLogger, getLogger } from './logging.js';
8
10
  export { NetworkError, TimeoutError } from './errors.js';
package/dist_ts/index.js CHANGED
@@ -2,6 +2,7 @@ export * from './smartnetwork.classes.smartnetwork.js';
2
2
  export { RustNetworkBridge } from './smartnetwork.classes.rustbridge.js';
3
3
  export { PublicIp } from './smartnetwork.classes.publicip.js';
4
4
  export { IpIntelligence } from './smartnetwork.classes.ipintelligence.js';
5
+ export { DomainIntelligence } from './smartnetwork.classes.domainintelligence.js';
5
6
  export { setLogger, getLogger } from './logging.js';
6
7
  export { NetworkError, TimeoutError } from './errors.js';
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHdDQUF3QyxDQUFDO0FBRXZELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBQ3pFLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUM5RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sMENBQTBDLENBQUM7QUFFMUUsT0FBTyxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxZQUFZLEVBQUUsTUFBTSxhQUFhLENBQUMifQ==
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHdDQUF3QyxDQUFDO0FBRXZELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBQ3pFLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUM5RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sMENBQTBDLENBQUM7QUFFMUUsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sOENBQThDLENBQUM7QUFFbEYsT0FBTyxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxZQUFZLEVBQUUsTUFBTSxhQUFhLENBQUMifQ==
@@ -0,0 +1,170 @@
1
+ import * as plugins from './smartnetwork.plugins.js';
2
+ /** Type alias for a Smartdns client instance */
3
+ type TSmartdnsClient = InstanceType<typeof plugins.smartdns.dnsClientMod.Smartdns>;
4
+ /**
5
+ * Unified result from a domain RDAP intelligence lookup.
6
+ */
7
+ export interface IDomainIntelligenceResult {
8
+ /** Normalized ASCII (punycode) form of the queried domain */
9
+ domain: string | null;
10
+ /** Registry handle / identifier */
11
+ handle: string | null;
12
+ /** EPP status values, e.g. ["active", "client transfer prohibited"] */
13
+ status: string[] | null;
14
+ registrationDate: string | null;
15
+ expirationDate: string | null;
16
+ lastChangedDate: string | null;
17
+ registrarName: string | null;
18
+ registrarIanaId: number | null;
19
+ registrantOrg: string | null;
20
+ registrantCountry: string | null;
21
+ abuseEmail: string | null;
22
+ abusePhone: string | null;
23
+ nameservers: string[] | null;
24
+ dnssec: boolean | null;
25
+ /** Which layer populated the nameservers field */
26
+ nameserversSource: 'rdap' | 'dns' | null;
27
+ /** IPv4 A records */
28
+ resolvedIpv4: string[] | null;
29
+ /** IPv6 AAAA records */
30
+ resolvedIpv6: string[] | null;
31
+ /** Parsed MX records with priority and exchange */
32
+ mxRecords: {
33
+ priority: number | null;
34
+ exchange: string;
35
+ }[] | null;
36
+ /** TXT records (SPF, DKIM, site verification, etc.) */
37
+ txtRecords: string[] | null;
38
+ /** Raw serialized SOA record value */
39
+ soaRecord: string | null;
40
+ }
41
+ /**
42
+ * Options for DomainIntelligence
43
+ */
44
+ export interface IDomainIntelligenceOptions {
45
+ /** Timeout (ms) for RDAP/bootstrap/DNS requests. Default: 5000 */
46
+ timeout?: number;
47
+ /**
48
+ * Optional injected smartdns client. When provided, DomainIntelligence
49
+ * will not create or destroy its own client (the owner — typically
50
+ * SmartNetwork — manages lifecycle). When omitted, a short-lived client
51
+ * is created per DNS-layer query and destroyed in finally.
52
+ */
53
+ dnsClient?: TSmartdnsClient;
54
+ }
55
+ /**
56
+ * DomainIntelligence performs RDAP lookups for domain names using the
57
+ * IANA DNS bootstrap to discover the correct registry RDAP endpoint per TLD.
58
+ */
59
+ export declare class DomainIntelligence {
60
+ private readonly logger;
61
+ private readonly timeout;
62
+ private bootstrapEntries;
63
+ private bootstrapPromise;
64
+ private readonly sharedDnsClient;
65
+ constructor(options?: IDomainIntelligenceOptions);
66
+ /**
67
+ * Get comprehensive domain intelligence. Runs RDAP and DNS lookups in
68
+ * parallel, then merges the results. Returns an all-null result (rather
69
+ * than throwing) for malformed input, unknown TLDs, or total failure.
70
+ *
71
+ * - RDAP provides: registrar, registrant, events (registration/expiration),
72
+ * nameservers (registry/parent), status, DNSSEC, abuse contact
73
+ * - DNS provides: A/AAAA records, MX, TXT, SOA, and a nameservers fallback
74
+ * when RDAP is unavailable (closes the ccTLD gap)
75
+ */
76
+ getIntelligence(domain: string): Promise<IDomainIntelligenceResult>;
77
+ /**
78
+ * Run the full RDAP lookup flow for a pre-normalized domain: extract TLD,
79
+ * load bootstrap, match registry, query, and parse. Returns the parsed
80
+ * RDAP fields (as a full IDomainIntelligenceResult) or null if any step
81
+ * fails or the TLD has no RDAP support.
82
+ */
83
+ private queryRdapLayer;
84
+ /**
85
+ * Normalize a domain to lowercased ASCII punycode form. Returns null for
86
+ * obviously invalid input.
87
+ */
88
+ private normalizeDomain;
89
+ /**
90
+ * Extract the TLD as the last dot-separated label.
91
+ */
92
+ private extractTld;
93
+ /**
94
+ * Load and cache the IANA DNS bootstrap file.
95
+ */
96
+ private ensureBootstrap;
97
+ /**
98
+ * Find the RDAP base URL for a given TLD via direct lookup.
99
+ */
100
+ private matchTld;
101
+ /**
102
+ * Perform the RDAP HTTP query for a domain.
103
+ */
104
+ private queryRdap;
105
+ private parseRdapResponse;
106
+ /**
107
+ * Pull registration / expiration / last changed timestamps from an
108
+ * RDAP `events` array.
109
+ */
110
+ private extractEvents;
111
+ /**
112
+ * Extract registrar identity (name, IANA ID) and a nested abuse contact.
113
+ */
114
+ private extractRegistrar;
115
+ /**
116
+ * Extract registrant org/country from entities array.
117
+ */
118
+ private extractRegistrant;
119
+ /**
120
+ * Map an RDAP nameservers[] array to a list of lowercased ldhName strings.
121
+ */
122
+ private extractNameservers;
123
+ /**
124
+ * Run DNS record lookups for the given domain using smartdns. Queries
125
+ * NS/A/AAAA/MX/TXT/SOA in parallel via Promise.allSettled — failures in
126
+ * one record type do not affect the others. Returns an object with each
127
+ * field either populated or null.
128
+ *
129
+ * If a shared dnsClient was injected via constructor options, it is
130
+ * reused and NOT destroyed (ownership stays with the injector). Otherwise
131
+ * a short-lived client is created and destroyed in finally.
132
+ */
133
+ private queryDnsLayer;
134
+ /**
135
+ * Extract normalized nameserver hostnames from a getNameServers() result.
136
+ */
137
+ private parseNsResult;
138
+ /**
139
+ * Extract `value` strings from a settled DNS lookup result.
140
+ */
141
+ private dnsValuesOrNull;
142
+ /**
143
+ * First non-empty value from a settled DNS lookup result.
144
+ */
145
+ private dnsFirstValueOrNull;
146
+ /**
147
+ * Parse MX records into {priority, exchange} pairs. smartdns returns MX
148
+ * values as serialized strings (typically "10 mail.example.com"). We
149
+ * best-effort parse the priority; if parsing fails we store the whole
150
+ * value as the exchange with priority=null so the result is still useful.
151
+ */
152
+ private parseMxRecords;
153
+ /**
154
+ * Extract the 'fn' (formatted name) from an entity's vcardArray
155
+ */
156
+ private extractVcardFn;
157
+ /**
158
+ * Extract email from an entity's vcardArray
159
+ */
160
+ private extractVcardEmail;
161
+ /**
162
+ * Extract telephone number from an entity's vcardArray
163
+ */
164
+ private extractVcardTel;
165
+ /**
166
+ * Extract country from an entity's vcardArray address field
167
+ */
168
+ private extractVcardCountry;
169
+ }
170
+ export {};