ip-finder-client 1.0.3 → 1.0.4

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
@@ -28,9 +28,10 @@ const client = new IPInsight({
28
28
  // Look up an IP address
29
29
  const result = await client.lookup('8.8.8.8');
30
30
 
31
- console.log(result.geo?.country); // "United States"
32
- console.log(result.geo?.city); // "Mountain View"
33
- console.log(result.asn?.organization); // "Google LLC"
31
+ console.log(result.location?.country); // "US"
32
+ console.log(result.location?.city); // "Mountain View"
33
+ console.log(result.isp?.organization); // "GOOGLE"
34
+ console.log(result.isp?.asn); // "AS15169"
34
35
  ```
35
36
 
36
37
  ## Configuration
@@ -60,36 +61,31 @@ const result = await client.lookup('8.8.8.8');
60
61
  // Result structure:
61
62
  {
62
63
  ip: '8.8.8.8',
63
- geo: {
64
+ ipDetails: { version: 4, decimal: '134744072', hex: '08080808' },
65
+ location: {
64
66
  city: 'Mountain View',
65
67
  region: 'California',
66
- regionCode: 'CA',
67
- country: 'United States',
68
- countryCode: 'US',
69
- continent: 'North America',
70
- continentCode: 'NA',
71
- latitude: 37.4056,
72
- longitude: -122.0775,
68
+ country: 'US',
73
69
  timezone: 'America/Los_Angeles',
74
- postalCode: '94043'
70
+ coordinates: { latitude: 37.422, longitude: -122.085 },
71
+ maps: { search: '...', place: '...', directions: '...' }
75
72
  },
76
- asn: {
77
- asn: 15169,
78
- organization: 'Google LLC',
79
- isp: 'Google LLC'
73
+ isp: {
74
+ organization: 'GOOGLE',
75
+ asn: 'AS15169',
76
+ domain: 'google.com',
77
+ connectionType: 'Cable/DSL'
80
78
  },
81
79
  network: {
82
80
  cidr: '8.8.8.0/24',
83
- startIp: '8.8.8.0',
84
- endIp: '8.8.8.255',
85
- type: 'assigned',
86
- registry: 'arin'
81
+ rir: 'ARIN',
82
+ status: 'allocated'
87
83
  },
88
- version: 4
84
+ cloud: { isCloud: false }
89
85
  }
90
86
  ```
91
87
 
92
- ### `lookupBatch(ips: string[]): Promise<(IPLookupResult | IPFinderError)[]>`
88
+ ### `lookupBatch(ips: string[]): Promise<(IPLookupResult | IPInsightError)[]>`
93
89
 
94
90
  Look up multiple IP addresses in parallel.
95
91
 
@@ -100,7 +96,7 @@ results.forEach(result => {
100
96
  if (result instanceof IPInsightError) {
101
97
  console.error(`Error: ${result.message}`);
102
98
  } else {
103
- console.log(`${result.ip}: ${result.geo?.country}`);
99
+ console.log(`${result.ip}: ${result.location?.country}`);
104
100
  }
105
101
  });
106
102
  ```
@@ -187,9 +183,9 @@ Full TypeScript support with exported types:
187
183
  import type {
188
184
  IPFinderConfig,
189
185
  IPLookupResult,
190
- GeoLocation,
191
- ASNInfo,
192
- NetworkInfo,
186
+ Location,
187
+ ISP,
188
+ Network,
193
189
  RateLimitInfo
194
190
  } from 'ip-finder-client';
195
191
  ```
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { IPFinderConfig, IPLookupResult, APIError, RateLimitInfo, GeoLocation, ASNInfo, NetworkInfo } from './types';
2
- export type { IPFinderConfig, IPLookupResult, APIError, RateLimitInfo, GeoLocation, ASNInfo, NetworkInfo, };
1
+ import type { IPFinderConfig, IPLookupResult, APIError, RateLimitInfo, Location, ISP, Network, IPDetails, Coordinates, CloudInfo, DataSources, Explanation } from './types';
2
+ export type { IPFinderConfig, IPLookupResult, APIError, RateLimitInfo, Location, ISP, Network, IPDetails, Coordinates, CloudInfo, DataSources, Explanation, };
3
3
  /**
4
4
  * Custom error class for IPInsight API errors
5
5
  */
@@ -17,7 +17,7 @@ export declare class IPInsightError extends Error {
17
17
  *
18
18
  * const client = new IPInsight({ apiKey: 'your-api-key' });
19
19
  * const result = await client.lookup('8.8.8.8');
20
- * console.log(result.geo?.country); // "United States"
20
+ * console.log(result.location?.country); // "US"
21
21
  * ```
22
22
  */
23
23
  export declare class IPInsight {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"m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WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YAgBvB,KAAK;IAuDnB,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,KAAK;CAGd;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAE9D;AAGD,eAAe,SAAS,CAAC"}
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  export interface IPFinderConfig {
5
5
  /** Your API key for authentication */
6
6
  apiKey: string;
7
- /** Base URL of the IP Finder API (optional, defaults to production) */
7
+ /** Base URL of the IP Finder API (optional, defaults to https://api.ipwhere.site) */
8
8
  baseUrl?: string;
9
9
  /** Request timeout in milliseconds (default: 10000) */
10
10
  timeout?: number;
@@ -12,52 +12,115 @@ export interface IPFinderConfig {
12
12
  retries?: number;
13
13
  }
14
14
  /**
15
- * Geographic location information
15
+ * IP address details
16
16
  */
17
- export interface GeoLocation {
17
+ export interface IPDetails {
18
+ version: number;
19
+ decimal: string;
20
+ hex: string;
21
+ }
22
+ /**
23
+ * Map links for the location
24
+ */
25
+ export interface MapLinks {
26
+ search: string;
27
+ place: string;
28
+ directions: string;
29
+ }
30
+ /**
31
+ * Coordinates information
32
+ */
33
+ export interface Coordinates {
34
+ latitude: number;
35
+ longitude: number;
36
+ accuracyRadius?: number;
37
+ }
38
+ /**
39
+ * Location information
40
+ */
41
+ export interface Location {
18
42
  city?: string;
19
43
  region?: string;
20
- regionCode?: string;
21
44
  country?: string;
22
- countryCode?: string;
23
- continent?: string;
24
- continentCode?: string;
25
- latitude?: number;
26
- longitude?: number;
45
+ postalCode?: string | null;
27
46
  timezone?: string;
28
- postalCode?: string;
47
+ coordinates?: Coordinates;
48
+ maps?: MapLinks;
29
49
  }
30
50
  /**
31
- * ASN (Autonomous System Number) information
51
+ * Allocation date information
32
52
  */
33
- export interface ASNInfo {
34
- asn?: number;
35
- organization?: string;
36
- isp?: string;
53
+ export interface AllocationDate {
54
+ raw: string;
55
+ formatted: string;
56
+ iso: string;
37
57
  }
38
58
  /**
39
- * Network allocation information
59
+ * Network information
40
60
  */
41
- export interface NetworkInfo {
61
+ export interface Network {
42
62
  cidr?: string;
43
- startIp?: string;
44
- endIp?: string;
45
- type?: string;
46
- registry?: string;
47
- registryCountry?: string;
48
- allocatedDate?: string;
63
+ range?: string;
64
+ rangeSize?: string;
65
+ rir?: string;
66
+ allocationDate?: AllocationDate;
67
+ status?: string;
68
+ }
69
+ /**
70
+ * ISP/ASN information
71
+ */
72
+ export interface ISP {
73
+ organization?: string;
74
+ asn?: string;
75
+ domain?: string;
76
+ connectionType?: string;
77
+ }
78
+ /**
79
+ * Cloud detection information
80
+ */
81
+ export interface CloudInfo {
82
+ isCloud: boolean;
83
+ }
84
+ /**
85
+ * Data sources used for the lookup
86
+ */
87
+ export interface DataSources {
88
+ geolocation?: string;
89
+ asn?: string;
90
+ network?: string;
91
+ postalCode?: string | null;
92
+ }
93
+ /**
94
+ * Explanation of the lookup result
95
+ */
96
+ export interface Explanation {
97
+ summary?: string;
98
+ primarySource?: string;
99
+ sourcesUsed?: {
100
+ geolocation?: boolean;
101
+ asn?: boolean;
102
+ rir?: boolean;
103
+ };
104
+ rangeSize?: string;
105
+ rir?: {
106
+ rir?: string;
107
+ allocationDate?: AllocationDate;
108
+ status?: string;
109
+ };
49
110
  }
50
111
  /**
51
112
  * Complete IP lookup result
52
113
  */
53
114
  export interface IPLookupResult {
54
115
  ip: string;
55
- geo?: GeoLocation;
56
- asn?: ASNInfo;
57
- network?: NetworkInfo;
58
- isPrivate?: boolean;
59
- isReserved?: boolean;
60
- version?: 4 | 6;
116
+ ipDetails?: IPDetails;
117
+ location?: Location;
118
+ network?: Network;
119
+ isp?: ISP;
120
+ cloud?: CloudInfo;
121
+ ipVersion?: number;
122
+ dataSources?: DataSources;
123
+ explanation?: Explanation;
61
124
  }
62
125
  /**
63
126
  * Error response from the API
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","source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C,EAAE;QACZ,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,GAAG,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ip-finder-client",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Lightweight SDK for IP geolocation, ASN lookup, and network information",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",