@internetdata/internetdata 2.0.0 → 2.1.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 +13 -3
- package/dist/client.d.ts +13 -8
- package/dist/client.js +22 -3
- package/dist/client.js.map +1 -1
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/types.gen.d.ts +6 -7
- package/dist/types.d.ts +4 -2
- package/dist/types.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Requires Node.js 22 or newer. TypeScript types are included.
|
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
Every call needs an API key carrying the `db.download` scope. Databases are licensed by contract rather than bought self-serve, so a key arrives with the
|
|
20
|
+
Every call needs an API key carrying the `db.download` scope. Databases are licensed by contract rather than bought self-serve, so a key arrives with the license; see the [API documentation](https://docs.internetdata.io/api) or write to [dev@internetdata.io](mailto:dev@internetdata.io).
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
23
|
import { InternetData } from '@internetdata/internetdata';
|
|
@@ -29,7 +29,7 @@ for (const db of await client.database.list()) {
|
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
`list()` returns one entry per database FAMILY, because a
|
|
32
|
+
`list()` returns one entry per database FAMILY, because a license is held against the family while a download names a specific version. `standing` is `licensed` if the family is yours today, `expired` if the term has ended, and `unlicensed` if it is published but has never been bought. `versions` carries the ids you pass everywhere else, oldest first, and the formats each one is actually built in.
|
|
33
33
|
|
|
34
34
|
### What is inside a database
|
|
35
35
|
|
|
@@ -54,7 +54,7 @@ const written = await client.database.download('vpn_ip_v1', 'mmdb', './vpn_ip_v1
|
|
|
54
54
|
console.log(`${written} bytes`);
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
The bytes go to a
|
|
57
|
+
The bytes go to a neighboring `.part` file and the name only appears once the transfer completes, so an interruption cannot leave a truncated file that reads as a whole database. You can pass a writable stream instead of a path, in which case it stays yours to close and gets no such treatment.
|
|
58
58
|
|
|
59
59
|
Or take the link and run the transfer yourself. The API answers a redirect to time-limited object storage, and that URL authorizes itself, so it can be handed to something holding no API key:
|
|
60
60
|
|
|
@@ -68,6 +68,16 @@ Or, for a small database, take the bytes directly:
|
|
|
68
68
|
const bytes = await client.database.downloadBytes('bogon_ip_v1', 'csvgz');
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
The formats are `csvgz` and `mmdb`. They're exported as `DATABASE_FORMATS`, beside `STANDINGS` and `LICENSE_TYPES`, for code that takes one from a command line or a config file. Anything else is refused before a request goes out, as a `bad_request` naming the formats that exist:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import { DATABASE_FORMATS } from '@internetdata/internetdata';
|
|
75
|
+
|
|
76
|
+
if (!DATABASE_FORMATS.includes(format)) {
|
|
77
|
+
console.error(`--format must be one of ${DATABASE_FORMATS.join(', ')}`);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
71
81
|
`downloadBytes` holds the whole file in memory and the catalog spans seven orders of magnitude, from a few hundred bytes to over 5 GiB, so use `download` for anything you have not checked with `metadata` first.
|
|
72
82
|
|
|
73
83
|
### Verifying what you got
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Writable } from 'node:stream';
|
|
2
2
|
import type { Client } from './generated/client/index.js';
|
|
3
|
-
import type { Database,
|
|
3
|
+
import type { Database, DatabaseFormat, DatabaseMetadata, DbChecksums, Download } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Where `download` puts the bytes: a path to write, or a stream you opened
|
|
6
6
|
* yourself and will close yourself.
|
|
@@ -10,12 +10,17 @@ export declare const DEFAULT_BASE_URL = "https://internetdata.io";
|
|
|
10
10
|
export interface DownloadsOptions {
|
|
11
11
|
/** How many attempts to return, newest first. The API clamps this to 200. */
|
|
12
12
|
limit?: number;
|
|
13
|
+
/**
|
|
14
|
+
* How long one attempt may take before it is abandoned, in milliseconds, for
|
|
15
|
+
* THIS call only. Defaults to the client's `timeoutMs`.
|
|
16
|
+
*/
|
|
17
|
+
timeoutMs?: number;
|
|
13
18
|
}
|
|
14
19
|
export interface Options {
|
|
15
20
|
/**
|
|
16
21
|
* Your API key, carrying the `db.download` scope. Omit it to send no
|
|
17
22
|
* `Authorization` header at all, which is what a dataset offered without a
|
|
18
|
-
*
|
|
23
|
+
* license would be read with.
|
|
19
24
|
*/
|
|
20
25
|
apiKey?: string;
|
|
21
26
|
baseUrl?: string;
|
|
@@ -42,7 +47,7 @@ export interface Options {
|
|
|
42
47
|
* The key is optional, and an absent one sends no `Authorization` header rather
|
|
43
48
|
* than an empty one. Every endpoint published today is licensed, so a keyless
|
|
44
49
|
* client is answered `401` for now; it exists because what the API serves
|
|
45
|
-
* without a
|
|
50
|
+
* without a license is a product decision, not the client's to refuse.
|
|
46
51
|
*/
|
|
47
52
|
export declare class InternetData {
|
|
48
53
|
/** The database catalog, downloads and their history. */
|
|
@@ -58,7 +63,7 @@ export declare class DatabaseApi {
|
|
|
58
63
|
constructor(client: Client, retries: number, timeoutMs: number, fetchImpl: typeof globalThis.fetch);
|
|
59
64
|
/**
|
|
60
65
|
* The published catalog as your organization may see it, one entry per
|
|
61
|
-
* database FAMILY, with `standing` saying where your
|
|
66
|
+
* database FAMILY, with `standing` saying where your license stands.
|
|
62
67
|
*
|
|
63
68
|
* **This listing is not the same for everyone, and it is not cached.** A
|
|
64
69
|
* database commissioned for a single customer is absent for every other
|
|
@@ -81,7 +86,7 @@ export declare class DatabaseApi {
|
|
|
81
86
|
* Returns the whole set rather than one algorithm: which digests a database
|
|
82
87
|
* publishes is the API's choice, not ours.
|
|
83
88
|
*/
|
|
84
|
-
checksums(id: string, format:
|
|
89
|
+
checksums(id: string, format: DatabaseFormat): Promise<DbChecksums>;
|
|
85
90
|
/**
|
|
86
91
|
* Your organization's recent download attempts, newest first.
|
|
87
92
|
*
|
|
@@ -98,7 +103,7 @@ export declare class DatabaseApi {
|
|
|
98
103
|
* something that holds no API key. The link authorizes the START of a
|
|
99
104
|
* transfer, so one already running is not interrupted when it lapses.
|
|
100
105
|
*/
|
|
101
|
-
downloadUrl(id: string, format:
|
|
106
|
+
downloadUrl(id: string, format: DatabaseFormat): Promise<string>;
|
|
102
107
|
/**
|
|
103
108
|
* Download one database file, streaming it to `destination`.
|
|
104
109
|
*
|
|
@@ -115,7 +120,7 @@ export declare class DatabaseApi {
|
|
|
115
120
|
* than an `InternetDataError`: a reset socket and a full disk are different
|
|
116
121
|
* problems and only one of them is ours.
|
|
117
122
|
*/
|
|
118
|
-
download(id: string, format:
|
|
123
|
+
download(id: string, format: DatabaseFormat, destination: DownloadDestination): Promise<number>;
|
|
119
124
|
/**
|
|
120
125
|
* Download one database file and hand back its bytes.
|
|
121
126
|
*
|
|
@@ -127,6 +132,6 @@ export declare class DatabaseApi {
|
|
|
127
132
|
* parser; use `download` for anything you have not measured, and `metadata`
|
|
128
133
|
* to measure it before you do.
|
|
129
134
|
*/
|
|
130
|
-
downloadBytes(id: string, format:
|
|
135
|
+
downloadBytes(id: string, format: DatabaseFormat): Promise<Uint8Array>;
|
|
131
136
|
private fetchDatabaseFile;
|
|
132
137
|
}
|
package/dist/client.js
CHANGED
|
@@ -2,6 +2,7 @@ import pRetry from 'p-retry';
|
|
|
2
2
|
import { createClient, createConfig } from './generated/client/index.js';
|
|
3
3
|
import { databaseChecksumV2, databaseMetadataV2, downloadDatabaseV2 as downloadRedirect, listDatabases, listDownloads, } from './generated/sdk.gen.js';
|
|
4
4
|
import { errorFromResponse, InternetDataError, messageFromBody } from './errors.js';
|
|
5
|
+
import { DATABASE_FORMATS } from './types.js';
|
|
5
6
|
export const DEFAULT_BASE_URL = 'https://internetdata.io';
|
|
6
7
|
// Matches the other SDKs, whose HTTP clients default to 30s. Node's global
|
|
7
8
|
// fetch has no whole-request limit of its own, so without this a hung API holds
|
|
@@ -17,7 +18,7 @@ const DEFAULT_TIMEOUT_MS = 30_000;
|
|
|
17
18
|
* The key is optional, and an absent one sends no `Authorization` header rather
|
|
18
19
|
* than an empty one. Every endpoint published today is licensed, so a keyless
|
|
19
20
|
* client is answered `401` for now; it exists because what the API serves
|
|
20
|
-
* without a
|
|
21
|
+
* without a license is a product decision, not the client's to refuse.
|
|
21
22
|
*/
|
|
22
23
|
export class InternetData {
|
|
23
24
|
/** The database catalog, downloads and their history. */
|
|
@@ -49,7 +50,7 @@ export class DatabaseApi {
|
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* The published catalog as your organization may see it, one entry per
|
|
52
|
-
* database FAMILY, with `standing` saying where your
|
|
53
|
+
* database FAMILY, with `standing` saying where your license stands.
|
|
53
54
|
*
|
|
54
55
|
* **This listing is not the same for everyone, and it is not cached.** A
|
|
55
56
|
* database commissioned for a single customer is absent for every other
|
|
@@ -87,6 +88,7 @@ export class DatabaseApi {
|
|
|
87
88
|
* publishes is the API's choice, not ours.
|
|
88
89
|
*/
|
|
89
90
|
async checksums(id, format) {
|
|
91
|
+
assertFormat(format);
|
|
90
92
|
return withRetry(this.retries, async () => {
|
|
91
93
|
const res = await deadline(this.timeoutMs, (signal) => databaseChecksumV2({
|
|
92
94
|
client: this.client, query: { id: id, format: format }, signal: signal,
|
|
@@ -101,8 +103,9 @@ export class DatabaseApi {
|
|
|
101
103
|
* and its absence answers nothing.
|
|
102
104
|
*/
|
|
103
105
|
async downloads(options = {}) {
|
|
106
|
+
const timeoutMs = options.timeoutMs ?? this.timeoutMs;
|
|
104
107
|
return withRetry(this.retries, async () => {
|
|
105
|
-
const res = await deadline(
|
|
108
|
+
const res = await deadline(timeoutMs, (signal) => listDownloads({
|
|
106
109
|
client: this.client,
|
|
107
110
|
...(options.limit === undefined ? {} : { query: { limit: options.limit } }),
|
|
108
111
|
signal: signal,
|
|
@@ -120,6 +123,7 @@ export class DatabaseApi {
|
|
|
120
123
|
* transfer, so one already running is not interrupted when it lapses.
|
|
121
124
|
*/
|
|
122
125
|
async downloadUrl(id, format) {
|
|
126
|
+
assertFormat(format);
|
|
123
127
|
return withRetry(this.retries, async () => {
|
|
124
128
|
const res = await deadline(this.timeoutMs, (signal) => downloadRedirect({
|
|
125
129
|
client: this.client,
|
|
@@ -236,6 +240,21 @@ export class DatabaseApi {
|
|
|
236
240
|
function bearerOnly(apiKey) {
|
|
237
241
|
return (auth) => (auth.scheme === 'bearer' ? apiKey : undefined);
|
|
238
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Refuses a format the API does not publish, before the network sees it.
|
|
245
|
+
*
|
|
246
|
+
* The generated union guards a TypeScript caller at compile time and nobody
|
|
247
|
+
* else: a format arriving from a CLI flag, a form field or a model is a plain
|
|
248
|
+
* string, and without this it costs a round trip and comes back as a 400 whose
|
|
249
|
+
* message names nothing the caller can act on. Every download method reaches the
|
|
250
|
+
* network through `downloadUrl`, so this covers all three of them.
|
|
251
|
+
*/
|
|
252
|
+
function assertFormat(format) {
|
|
253
|
+
if (DATABASE_FORMATS.includes(format)) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
throw new InternetDataError('bad_request', `invalid format ${JSON.stringify(format)}; must be one of ${DATABASE_FORMATS.join(', ')}`);
|
|
257
|
+
}
|
|
239
258
|
function unwrap(res) {
|
|
240
259
|
if (res.response === undefined) {
|
|
241
260
|
throw new InternetDataError('network', 'no response from the API');
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAK7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EACH,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,gBAAgB,EAC9E,aAAa,EAAE,aAAa,GAC/B,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAA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1,2 +1,2 @@
|
|
|
1
1
|
export { databaseChecksum, databaseChecksumV2, databaseDownload, databaseMetadata, databaseMetadataV2, downloadDatabaseV2, listDatabases, listDownloads, type Options } from './sdk.gen.js';
|
|
2
|
-
export type { ClientOptions, Database, DatabaseChecksumData, DatabaseChecksumError, DatabaseChecksumErrors, DatabaseChecksumResponse, DatabaseChecksumResponses, DatabaseChecksumV2Data, DatabaseChecksumV2Error, DatabaseChecksumV2Errors, DatabaseChecksumV2Response, DatabaseChecksumV2Responses, DatabaseDownloadData, DatabaseDownloadError, DatabaseDownloadErrors, DatabaseDownloadResponse, DatabaseDownloadResponses, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseMetadataData, DatabaseMetadataError, DatabaseMetadataErrors, DatabaseMetadataResponse, DatabaseMetadataResponses, DatabaseMetadataV2Data, DatabaseMetadataV2Error, DatabaseMetadataV2Errors, DatabaseMetadataV2Response, DatabaseMetadataV2Responses, DatabaseVersion, DbChecksums, DbChecksumSuccessResponse, DbFormat, DbId, DbInvalidApiKeyError, DbInvalidFormatError, DbInvalidIdError, DbMetadata, DbMetadataSuccessResponse, DbNotFoundError, DbUnauthorizedIdError, Download, DownloadDatabaseV2Data, DownloadDatabaseV2Error, DownloadDatabaseV2Errors, Error,
|
|
2
|
+
export type { ClientOptions, Database, DatabaseChecksumData, DatabaseChecksumError, DatabaseChecksumErrors, DatabaseChecksumResponse, DatabaseChecksumResponses, DatabaseChecksumV2Data, DatabaseChecksumV2Error, DatabaseChecksumV2Errors, DatabaseChecksumV2Response, DatabaseChecksumV2Responses, DatabaseDownloadData, DatabaseDownloadError, DatabaseDownloadErrors, DatabaseDownloadResponse, DatabaseDownloadResponses, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseMetadataData, DatabaseMetadataError, DatabaseMetadataErrors, DatabaseMetadataResponse, DatabaseMetadataResponses, DatabaseMetadataV2Data, DatabaseMetadataV2Error, DatabaseMetadataV2Errors, DatabaseMetadataV2Response, DatabaseMetadataV2Responses, DatabaseVersion, DbChecksums, DbChecksumSuccessResponse, DbFormat, DbId, DbInvalidApiKeyError, DbInvalidFormatError, DbInvalidIdError, DbMetadata, DbMetadataSuccessResponse, DbNotFoundError, DbUnauthorizedIdError, Download, DownloadDatabaseV2Data, DownloadDatabaseV2Error, DownloadDatabaseV2Errors, Error, ListDatabasesData, ListDatabasesError, ListDatabasesErrors, ListDatabasesResponse, ListDatabasesResponses, ListDownloadsData, ListDownloadsError, ListDownloadsErrors, ListDownloadsResponse, ListDownloadsResponses, Standing } from './types.gen.js';
|
|
@@ -20,12 +20,6 @@ export type DatabaseFormat = 'csvgz' | 'mmdb';
|
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
22
|
export type Standing = 'licensed' | 'expired' | 'unlicensed';
|
|
23
|
-
/**
|
|
24
|
-
* What your licence permits you to do with the data. Null when there is
|
|
25
|
-
* no licence, which is every family with standing `unlicensed`.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
export type LicenseType = 'evaluation' | 'standard' | 'redistribute' | null;
|
|
29
23
|
/**
|
|
30
24
|
* One database FAMILY, with your organization's licence beside it. A
|
|
31
25
|
* licence covers the family, while a download names a specific version,
|
|
@@ -43,7 +37,12 @@ export type Database = {
|
|
|
43
37
|
*/
|
|
44
38
|
summary: string;
|
|
45
39
|
standing: Standing;
|
|
46
|
-
|
|
40
|
+
/**
|
|
41
|
+
* What your licence permits you to do with the data. Null when there
|
|
42
|
+
* is no licence, which is every family with standing `unlicensed`.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
license_type: 'evaluation' | 'standard' | 'redistribute' | null;
|
|
47
46
|
starts: string | null;
|
|
48
47
|
/**
|
|
49
48
|
* A hard stop. Null when the licence has no end date, which is the normal case for a rolling agreement, and when there is no licence. A rolling licence reports its turnover date in renews_at instead.
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { Database, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, Download,
|
|
2
|
-
export type { Database, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, Download,
|
|
1
|
+
import type { Database, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, Download, Standing } from './generated/types.gen.js';
|
|
2
|
+
export type { Database, DatabaseFormat, DatabaseMetadata, DatabaseMetadataColumn, DatabaseVersion, DbChecksums, Download, Standing, };
|
|
3
|
+
/** What a license permits you to do with the data. `null` when there is none. */
|
|
4
|
+
export type LicenseType = Database['license_type'];
|
|
3
5
|
/**
|
|
4
6
|
* @deprecated Use {@link DatabaseFormat}. Kept so existing imports keep
|
|
5
7
|
* compiling; this brand's Java, .NET and Swift SDKs have always called it
|
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":"AAoBA,+EAA+E;AAC/E,0EAA0E;AAC1E,gFAAgF;AAChF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7E,gDAAgD;AAChD,MAAM,CAAC,MAAM,eAAe,GAA8B,gBAAgB,CAAC;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAwB,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AACpF,MAAM,CAAC,MAAM,aAAa,GAAwC;IAC9D,YAAY,EAAE,UAAU,EAAE,cAAc;CAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetdata/internetdata",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Official Node.js client library for the InternetData API. Download, verify and inspect licensed IP database files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,9 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@hey-api/openapi-ts": "^0.99.0",
|
|
54
|
+
"@mslmio/eslint-config": "^1.0.1",
|
|
54
55
|
"@types/node": "^26.2.0",
|
|
56
|
+
"eslint": "^9.39.0",
|
|
55
57
|
"typescript": "^5.9.3"
|
|
56
58
|
},
|
|
57
59
|
"scripts": {
|