vpndetection 1.2.0 → 1.4.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
@@ -152,6 +152,15 @@ const bytes = await client.database.downloadBytes('cdn_ip_v1', 'csvgz');
152
152
 
153
153
  `downloadBytes` holds the whole file in memory, and the catalog runs from `cdn_ip_v1` at 10 KB to `resproxy_ip_90d_v1` at 1.79 GB, so use `download` for anything you have not measured.
154
154
 
155
+ ### Absent is not false
156
+
157
+ Only `ip` and `isVpn` come back on every plan. A field your plan does not include is `undefined`, which means "not in your plan" rather than "checked, and no".
158
+
159
+ ```js
160
+ result.isHosting ?? false // when you only want the flag
161
+ result.isHosting === undefined // not in your plan
162
+ ```
163
+
155
164
  ## Other Libraries
156
165
 
157
166
  There are official VPNDetection client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/vpndetection-io for more.
@@ -14,7 +14,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
14
14
  meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
15
15
  };
16
16
  /**
17
- * Classify one IP address
17
+ * Lookup
18
18
  *
19
19
  * Answers what is known about a single IPv4 or IPv6 address. Which fields
20
20
  * come back is decided by the plan behind the presented key; with no key
@@ -23,15 +23,21 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
23
23
  */
24
24
  export declare const lookupIp: <ThrowOnError extends boolean = false>(options: Options<LookupIpData, ThrowOnError>) => RequestResult<LookupIpResponses, LookupIpErrors, ThrowOnError>;
25
25
  /**
26
- * The datasets your organization is licensed to download
26
+ * List
27
+ *
28
+ * Every dataset this organization holds a licence for, with the term and the license_type right beside each one.
29
+ *
27
30
  */
28
31
  export declare const listDatabases: <ThrowOnError extends boolean = false>(options?: Options<ListDatabasesData, ThrowOnError>) => RequestResult<ListDatabasesResponses, ListDatabasesErrors, ThrowOnError>;
29
32
  /**
30
- * Redirect to a time-limited download URL for one dataset
33
+ * Download
34
+ *
35
+ * Answers `302` with a time-limited URL pointing straight at object storage. Follow the redirect; the link authorizes the START of a transfer, so one already running is not interrupted when it lapses.
36
+ *
31
37
  */
32
38
  export declare const downloadDatabase: <ThrowOnError extends boolean = false>(options: Options<DownloadDatabaseData, ThrowOnError>) => RequestResult<unknown, DownloadDatabaseErrors, ThrowOnError>;
33
39
  /**
34
- * What is inside one dataset - schema, samples, row count, sizes
40
+ * Metadata
35
41
  *
36
42
  * Poll this to decide whether today's build is worth fetching: it carries
37
43
  * `updated` and `entries` without downloading anything.
@@ -42,10 +48,16 @@ export declare const downloadDatabase: <ThrowOnError extends boolean = false>(op
42
48
  */
43
49
  export declare const databaseMetadata: <ThrowOnError extends boolean = false>(options: Options<DatabaseMetadataData, ThrowOnError>) => RequestResult<DatabaseMetadataResponses, DatabaseMetadataErrors, ThrowOnError>;
44
50
  /**
45
- * Checksums for one published file, to verify a download
51
+ * Checksums
52
+ *
53
+ * Checksums for one published file, so a download can be verified after it lands.
54
+ *
46
55
  */
47
56
  export declare const databaseChecksum: <ThrowOnError extends boolean = false>(options: Options<DatabaseChecksumData, ThrowOnError>) => RequestResult<DatabaseChecksumResponses, DatabaseChecksumErrors, ThrowOnError>;
48
57
  /**
49
- * Your organization's recent download attempts, newest first
58
+ * History
59
+ *
60
+ * Recent download attempts for this organization, newest first. Refusals are listed too, so a failed transfer can be accounted for.
61
+ *
50
62
  */
51
63
  export declare const listDownloads: <ThrowOnError extends boolean = false>(options?: Options<ListDownloadsData, ThrowOnError>) => RequestResult<ListDownloadsResponses, ListDownloadsErrors, ThrowOnError>;
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  import { client } from './client.gen.js';
3
3
  /**
4
- * Classify one IP address
4
+ * Lookup
5
5
  *
6
6
  * Answers what is known about a single IPv4 or IPv6 address. Which fields
7
7
  * come back is decided by the plan behind the presented key; with no key
@@ -10,51 +10,57 @@ import { client } from './client.gen.js';
10
10
  */
11
11
  export const lookupIp = (options) => (options.client ?? client).get({
12
12
  security: [
13
- { scheme: 'bearer', type: 'http' },
14
- { name: 'X-Api-Key', type: 'apiKey' },
15
13
  {
16
14
  in: 'query',
17
15
  name: 'apikey',
18
16
  type: 'apiKey'
19
- }
17
+ },
18
+ { name: 'X-Api-Key', type: 'apiKey' },
19
+ { scheme: 'bearer', type: 'http' }
20
20
  ],
21
21
  url: '/{ip}',
22
22
  ...options
23
23
  });
24
24
  /**
25
- * The datasets your organization is licensed to download
25
+ * List
26
+ *
27
+ * Every dataset this organization holds a licence for, with the term and the license_type right beside each one.
28
+ *
26
29
  */
27
30
  export const listDatabases = (options) => (options?.client ?? client).get({
28
31
  security: [
29
- { scheme: 'bearer', type: 'http' },
30
- { name: 'X-Api-Key', type: 'apiKey' },
31
32
  {
32
33
  in: 'query',
33
34
  name: 'apikey',
34
35
  type: 'apiKey'
35
- }
36
+ },
37
+ { name: 'X-Api-Key', type: 'apiKey' },
38
+ { scheme: 'bearer', type: 'http' }
36
39
  ],
37
40
  url: '/api/v1/database/list',
38
41
  ...options
39
42
  });
40
43
  /**
41
- * Redirect to a time-limited download URL for one dataset
44
+ * Download
45
+ *
46
+ * Answers `302` with a time-limited URL pointing straight at object storage. Follow the redirect; the link authorizes the START of a transfer, so one already running is not interrupted when it lapses.
47
+ *
42
48
  */
43
49
  export const downloadDatabase = (options) => (options.client ?? client).get({
44
50
  security: [
45
- { scheme: 'bearer', type: 'http' },
46
- { name: 'X-Api-Key', type: 'apiKey' },
47
51
  {
48
52
  in: 'query',
49
53
  name: 'apikey',
50
54
  type: 'apiKey'
51
- }
55
+ },
56
+ { name: 'X-Api-Key', type: 'apiKey' },
57
+ { scheme: 'bearer', type: 'http' }
52
58
  ],
53
59
  url: '/api/v1/database/download',
54
60
  ...options
55
61
  });
56
62
  /**
57
- * What is inside one dataset - schema, samples, row count, sizes
63
+ * Metadata
58
64
  *
59
65
  * Poll this to decide whether today's build is worth fetching: it carries
60
66
  * `updated` and `entries` without downloading anything.
@@ -65,45 +71,51 @@ export const downloadDatabase = (options) => (options.client ?? client).get({
65
71
  */
66
72
  export const databaseMetadata = (options) => (options.client ?? client).get({
67
73
  security: [
68
- { scheme: 'bearer', type: 'http' },
69
- { name: 'X-Api-Key', type: 'apiKey' },
70
74
  {
71
75
  in: 'query',
72
76
  name: 'apikey',
73
77
  type: 'apiKey'
74
- }
78
+ },
79
+ { name: 'X-Api-Key', type: 'apiKey' },
80
+ { scheme: 'bearer', type: 'http' }
75
81
  ],
76
82
  url: '/api/v1/database/metadata',
77
83
  ...options
78
84
  });
79
85
  /**
80
- * Checksums for one published file, to verify a download
86
+ * Checksums
87
+ *
88
+ * Checksums for one published file, so a download can be verified after it lands.
89
+ *
81
90
  */
82
91
  export const databaseChecksum = (options) => (options.client ?? client).get({
83
92
  security: [
84
- { scheme: 'bearer', type: 'http' },
85
- { name: 'X-Api-Key', type: 'apiKey' },
86
93
  {
87
94
  in: 'query',
88
95
  name: 'apikey',
89
96
  type: 'apiKey'
90
- }
97
+ },
98
+ { name: 'X-Api-Key', type: 'apiKey' },
99
+ { scheme: 'bearer', type: 'http' }
91
100
  ],
92
101
  url: '/api/v1/database/checksum',
93
102
  ...options
94
103
  });
95
104
  /**
96
- * Your organization's recent download attempts, newest first
105
+ * History
106
+ *
107
+ * Recent download attempts for this organization, newest first. Refusals are listed too, so a failed transfer can be accounted for.
108
+ *
97
109
  */
98
110
  export const listDownloads = (options) => (options?.client ?? client).get({
99
111
  security: [
100
- { scheme: 'bearer', type: 'http' },
101
- { name: 'X-Api-Key', type: 'apiKey' },
102
112
  {
103
113
  in: 'query',
104
114
  name: 'apikey',
105
115
  type: 'apiKey'
106
- }
116
+ },
117
+ { name: 'X-Api-Key', type: 'apiKey' },
118
+ { scheme: 'bearer', type: 'http' }
107
119
  ],
108
120
  url: '/api/v1/database/downloads',
109
121
  ...options
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.gen.js","s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,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE;KACrC;IACD,GAAG,EAAE,2BAA2B;IAChC,GAAG,OAAO;CACb,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAuC,OAAkD,EAA4E,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAA4D;IAC5R,QAAQ,EAAE;QACN;YACI,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACjB;QACD,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE;KACrC;IACD,GAAG,EAAE,4BAA4B;IACjC,GAAG,OAAO;CACb,CAAC,CAAC"}
@@ -199,7 +199,7 @@ export type LicensedDataset = {
199
199
  /**
200
200
  * What your license permits you to do with the data.
201
201
  */
202
- redistribution: 'evaluation' | 'internal' | 'redistribute';
202
+ license_type: 'evaluation' | 'standard' | 'redistribute';
203
203
  starts?: string | null;
204
204
  /**
205
205
  * Null when the license does not expire.
@@ -235,11 +235,34 @@ export type LicensedVersion = {
235
235
  */
236
236
  sampleFormats?: Array<'csvgz' | 'mmdb'>;
237
237
  };
238
+ /**
239
+ * One download ATTEMPT, refusals included - a denial is what answers "it
240
+ * stopped working", so they are listed rather than dropped.
241
+ *
242
+ */
238
243
  export type Download = {
239
244
  dataset_id: string;
240
245
  format: string;
241
246
  outcome: 'ok' | 'unauthorized' | 'denied' | 'expired' | 'unknown' | 'unavailable';
242
- bytes?: number | null;
247
+ /**
248
+ * The evaluation sample rather than the database itself.
249
+ */
250
+ sample: boolean;
251
+ /**
252
+ * Object size at redirect time, NOT bytes delivered: the transfer is a
253
+ * presigned redirect straight to object storage, so we never observe it.
254
+ *
255
+ */
256
+ bytes: number | null;
257
+ http_status: number | null;
258
+ /**
259
+ * The key that made the request. Null when the org acted through the
260
+ * console rather than through a key.
261
+ *
262
+ */
263
+ apikey_id: string | null;
264
+ client_ip: string | null;
265
+ user_agent: string | null;
243
266
  created: string;
244
267
  };
245
268
  export type DatasetMetadataColumn = {
@@ -278,6 +301,16 @@ export type DatasetMetadata = {
278
301
  size?: {
279
302
  [key: string]: number;
280
303
  };
304
+ /**
305
+ * Bytes per format of the evaluation sample, where one is published
306
+ */
307
+ sample_size?: {
308
+ [key: string]: number;
309
+ };
310
+ /**
311
+ * Row count in the evaluation sample
312
+ */
313
+ sample_entries?: number;
281
314
  };
282
315
  export type LookupIpData = {
283
316
  body?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpndetection",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Official Node.js client library for the VPNDetection API. Detect VPNs, proxies, Tor, hosting and CDN IPs.",
5
5
  "type": "module",
6
6
  "license": "MIT",