abuseipdb-client 0.1.128 → 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/dist/index.mjs CHANGED
@@ -1,45 +1,9 @@
1
- import { fileFromSync } from 'fetch-blob/from.js';
2
- import { FormData } from 'formdata-polyfill/esm.min.js';
1
+ import { readFileSync } from 'node:fs';
3
2
  import { z } from 'zod';
4
3
  import isIP from 'validator/lib/isIP.js';
5
4
  import isIPRange from 'validator/lib/isIPRange.js';
6
5
  import isISO31661Alpha2 from 'validator/lib/isISO31661Alpha2.js';
7
6
 
8
- /******************************************************************************
9
- Copyright (c) Microsoft Corporation.
10
-
11
- Permission to use, copy, modify, and/or distribute this software for any
12
- purpose with or without fee is hereby granted.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- PERFORMANCE OF THIS SOFTWARE.
21
- ***************************************************************************** */
22
- /* global Reflect, Promise, SuppressedError, Symbol */
23
-
24
-
25
- function __classPrivateFieldGet(receiver, state, kind, f) {
26
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
27
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
28
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
29
- }
30
-
31
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
32
- if (kind === "m") throw new TypeError("Private method is not writable");
33
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
34
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
35
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
36
- }
37
-
38
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
39
- var e = new Error(message);
40
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
41
- };
42
-
43
7
  /**
44
8
  * I'm patching the type definitions for isISO31661Alpha2 because
45
9
  * it is returning some encapsulated object.
@@ -256,7 +220,6 @@ const clearAddressSchema = z.object({ ipAddress: clearAddressRequiredSchema });
256
220
  */
257
221
  const BASE_URL = 'https://api.abuseipdb.com/api/v2';
258
222
 
259
- var _AbuseIPDBClient_instances, _AbuseIPDBClient_headers, _AbuseIPDBClient_apiKey, _AbuseIPDBClient_url, _AbuseIPDBClient_setHeaders, _AbuseIPDBClient_buildResponseHeaders, _AbuseIPDBClient_formatResponse, _AbuseIPDBClient_requestData, _AbuseIPDBClient_formatRequestBulkReport, _AbuseIPDBClient_formatUrl, _AbuseIPDBClient_validateData, _AbuseIPDBClient_handleRequest;
260
223
  const ENDPOINTS = {
261
224
  check: {
262
225
  method: 'GET',
@@ -291,42 +254,158 @@ const ENDPOINTS = {
291
254
  * @group Client
292
255
  */
293
256
  class AbuseIPDBClient {
257
+ #headers;
258
+ #apiKey;
259
+ #url;
294
260
  /**
295
261
  * Creates a new AbuseIPDB client, requires an API key from AbuseIPDB's dashboard.
296
262
  * @param apiKey AbuseIPDB client API key.
297
263
  * @param options Optional parameters - {@link AbuseIPDBClientOptions}
298
264
  */
299
265
  constructor(apiKey, options) {
300
- _AbuseIPDBClient_instances.add(this);
301
- _AbuseIPDBClient_headers.set(this, void 0);
302
- _AbuseIPDBClient_apiKey.set(this, void 0);
303
- _AbuseIPDBClient_url.set(this, void 0);
304
266
  const params = { apiKey, ...options };
305
- const validatedParams = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_validateData).call(this, params, abuseIPDBClientSchema);
306
- __classPrivateFieldSet(this, _AbuseIPDBClient_apiKey, validatedParams.apiKey, "f");
307
- __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_setHeaders).call(this, validatedParams.apiKey);
267
+ const validatedParams = this.#validateData(params, abuseIPDBClientSchema);
268
+ this.#apiKey = validatedParams.apiKey;
269
+ this.#setHeaders(validatedParams.apiKey);
308
270
  if (validatedParams?.url) {
309
- __classPrivateFieldSet(this, _AbuseIPDBClient_url, validatedParams.url, "f");
271
+ this.#url = validatedParams.url;
310
272
  return;
311
273
  }
312
- __classPrivateFieldSet(this, _AbuseIPDBClient_url, BASE_URL, "f");
274
+ this.#url = BASE_URL;
313
275
  }
314
276
  /**
315
277
  * Returns the current client config.
316
278
  */
317
279
  getConfig() {
318
280
  return {
319
- apiKey: __classPrivateFieldGet(this, _AbuseIPDBClient_apiKey, "f"),
320
- url: __classPrivateFieldGet(this, _AbuseIPDBClient_url, "f"),
281
+ apiKey: this.#apiKey,
282
+ url: this.#url,
283
+ };
284
+ }
285
+ #setHeaders(apiKey) {
286
+ this.#headers = {
287
+ Key: apiKey,
288
+ Accept: 'application/json',
321
289
  };
322
290
  }
291
+ #buildResponseHeaders(response) {
292
+ const headersJson = {};
293
+ // From fetch response.
294
+ headersJson.url = response.url;
295
+ headersJson.status = response.status;
296
+ headersJson.statusText = response.statusText;
297
+ // From AbuseIPDB API HTTP headers.
298
+ const rateLimitKeys = [
299
+ 'retry-after',
300
+ 'x-ratelimit-limit',
301
+ 'x-ratelimit-remaining',
302
+ 'x-ratelimit-reset',
303
+ 'x-generated-at',
304
+ ];
305
+ for (const key of rateLimitKeys) {
306
+ const value = response.headers.get(key);
307
+ if (value) {
308
+ headersJson[key] = value;
309
+ }
310
+ }
311
+ return headersJson;
312
+ }
313
+ async #formatResponse(fetchAPIResponse) {
314
+ const headers = this.#buildResponseHeaders(fetchAPIResponse);
315
+ let formattedResponse;
316
+ /**
317
+ * The `x-generated-at` header is present on blacklist API text endpoint response, it
318
+ * is formatted here to keep consistency.
319
+ * @see {@link APIBlacklistEndpointTextResponse}
320
+ */
321
+ if (headers['x-generated-at']) {
322
+ const xGeneratedAt = headers['x-generated-at'];
323
+ delete headers['x-generated-at'];
324
+ const bodyWithMeta = {
325
+ meta: {
326
+ generatedAt: xGeneratedAt,
327
+ },
328
+ data: await fetchAPIResponse.text(),
329
+ };
330
+ formattedResponse = {
331
+ headers,
332
+ result: bodyWithMeta,
333
+ };
334
+ }
335
+ else {
336
+ const body = await fetchAPIResponse.json();
337
+ if (body.errors) {
338
+ formattedResponse = { headers, error: body };
339
+ }
340
+ else {
341
+ formattedResponse = {
342
+ headers,
343
+ result: body,
344
+ };
345
+ }
346
+ }
347
+ return formattedResponse;
348
+ }
349
+ async #requestData(url, method, headers, body) {
350
+ return fetch(url, {
351
+ method,
352
+ headers,
353
+ body,
354
+ });
355
+ }
356
+ #formatRequestBulkReport(headers, data) {
357
+ const { csv } = data;
358
+ const fileBuffer = readFileSync(csv);
359
+ const file = new Blob([fileBuffer], { type: 'text/plain' });
360
+ const formData = new FormData();
361
+ formData.append('csv', file);
362
+ return {
363
+ headers,
364
+ body: formData,
365
+ };
366
+ }
367
+ #formatUrl(uri, params) {
368
+ const url = new URL(`${this.#url}/${uri}`);
369
+ for (const key of Object.keys(params ?? {})) {
370
+ url.searchParams.append(key, params?.[key]);
371
+ }
372
+ return url.href;
373
+ }
374
+ #validateData(parameters, schema) {
375
+ const result = schema.safeParse(parameters);
376
+ if (!result.success) {
377
+ throw result.error;
378
+ }
379
+ else {
380
+ return result.data;
381
+ }
382
+ }
383
+ async #handleRequest(endpointURI, parameters) {
384
+ const { method, schema } = ENDPOINTS[endpointURI];
385
+ // Validates the input parameters given by the client.
386
+ const validatedInput = this.#validateData(parameters, schema);
387
+ let response;
388
+ if (endpointURI === 'bulk-report') {
389
+ // There is no need to append QueryParams for the bulk-report endpoint, so it is removed here.
390
+ const url = this.#formatUrl(endpointURI);
391
+ const { headers, body } = this.#formatRequestBulkReport(this.#headers, parameters);
392
+ response = await this.#requestData(url, method, headers, body);
393
+ }
394
+ else {
395
+ const url = this.#formatUrl(endpointURI, validatedInput);
396
+ response = await this.#requestData(url, method, this.#headers);
397
+ }
398
+ // Transforms the API fetch response to the library format.
399
+ const formattedResponseData = await this.#formatResponse(response);
400
+ return formattedResponseData;
401
+ }
323
402
  /**
324
403
  * @see [Check API Endpoint](https://docs.abuseipdb.com/#check-endpoint)
325
404
  * @param ipAddress Single IPv4/IPv6 address to be verified.
326
405
  * @param options Optional parameters - {@link CheckOptions}
327
406
  */
328
407
  async check(ipAddress, options) {
329
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'check', {
408
+ return this.#handleRequest('check', {
330
409
  ipAddress,
331
410
  ...options,
332
411
  });
@@ -338,14 +417,14 @@ class AbuseIPDBClient {
338
417
  * @beta
339
418
  */
340
419
  async reports(ipAddress, options) {
341
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'reports', { ipAddress, ...options });
420
+ return this.#handleRequest('reports', { ipAddress, ...options });
342
421
  }
343
422
  /**
344
423
  * @see [Blacklist API Endpoint](https://docs.abuseipdb.com/#blacklist-endpoint)
345
424
  * @param options Optional parameters - {@link BlacklistOptions}
346
425
  */
347
426
  async blacklist(options) {
348
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'blacklist', { ...options });
427
+ return this.#handleRequest('blacklist', { ...options });
349
428
  }
350
429
  /**
351
430
  * @see [Report API Endpoint](https://docs.abuseipdb.com/#report-endpoint)
@@ -354,7 +433,7 @@ class AbuseIPDBClient {
354
433
  * @param options Optional parameters - {@link ReportOptions}
355
434
  */
356
435
  async report(ip, categories, options) {
357
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'report', { ip, categories, ...options });
436
+ return this.#handleRequest('report', { ip, categories, ...options });
358
437
  }
359
438
  /**
360
439
  * @see [Check-Block API Endpoint](https://docs.abuseipdb.com/#check-block-endpoint)
@@ -362,132 +441,23 @@ class AbuseIPDBClient {
362
441
  * @param options Optional parameters - {@link CheckBlockOptions}
363
442
  */
364
443
  async checkBlock(network, options) {
365
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'check-block', { network, ...options });
444
+ return this.#handleRequest('check-block', { network, ...options });
366
445
  }
367
446
  /**
368
447
  * @see [Bulk-Report API Endpoint](https://docs.abuseipdb.com/#bulk-report-endpoint)
369
448
  * @param csv CSV filepath to be sent.
370
449
  */
371
450
  async bulkReport(csv) {
372
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'bulk-report', { csv });
451
+ return this.#handleRequest('bulk-report', { csv });
373
452
  }
374
453
  /**
375
454
  * @see [Clear-Address API Endpoint](https://docs.abuseipdb.com/#clear-address-endpoint)
376
455
  * @param ipAddress Single IPv4/IPv6 address.
377
456
  */
378
457
  async clearAddress(ipAddress) {
379
- return __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_handleRequest).call(this, 'clear-address', { ipAddress });
458
+ return this.#handleRequest('clear-address', { ipAddress });
380
459
  }
381
460
  }
382
- _AbuseIPDBClient_headers = new WeakMap(), _AbuseIPDBClient_apiKey = new WeakMap(), _AbuseIPDBClient_url = new WeakMap(), _AbuseIPDBClient_instances = new WeakSet(), _AbuseIPDBClient_setHeaders = function _AbuseIPDBClient_setHeaders(apiKey) {
383
- __classPrivateFieldSet(this, _AbuseIPDBClient_headers, {
384
- Key: apiKey,
385
- Accept: 'application/json',
386
- }, "f");
387
- }, _AbuseIPDBClient_buildResponseHeaders = function _AbuseIPDBClient_buildResponseHeaders(response) {
388
- const headersJson = {};
389
- // From fetch response.
390
- headersJson.url = response.url;
391
- headersJson.status = response.status;
392
- headersJson.statusText = response.statusText;
393
- // From AbuseIPDB API HTTP headers.
394
- const rateLimitKeys = [
395
- 'retry-after',
396
- 'x-ratelimit-limit',
397
- 'x-ratelimit-remaining',
398
- 'x-ratelimit-reset',
399
- 'x-generated-at',
400
- ];
401
- for (const key of rateLimitKeys) {
402
- const value = response.headers.get(key);
403
- if (value) {
404
- headersJson[key] = value;
405
- }
406
- }
407
- return headersJson;
408
- }, _AbuseIPDBClient_formatResponse = async function _AbuseIPDBClient_formatResponse(fetchAPIResponse) {
409
- const headers = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_buildResponseHeaders).call(this, fetchAPIResponse);
410
- let formattedResponse;
411
- /**
412
- * The `x-generated-at` header is present on blacklist API text endpoint response, it
413
- * is formatted here to keep consistency.
414
- * @see {@link APIBlacklistEndpointTextResponse}
415
- */
416
- if (headers['x-generated-at']) {
417
- const xGeneratedAt = headers['x-generated-at'];
418
- delete headers['x-generated-at'];
419
- const bodyWithMeta = {
420
- meta: {
421
- generatedAt: xGeneratedAt,
422
- },
423
- data: await fetchAPIResponse.text(),
424
- };
425
- formattedResponse = {
426
- headers,
427
- result: bodyWithMeta,
428
- };
429
- }
430
- else {
431
- const body = await fetchAPIResponse.json();
432
- if (body.errors) {
433
- formattedResponse = { headers, error: body };
434
- }
435
- else {
436
- formattedResponse = {
437
- headers,
438
- result: body,
439
- };
440
- }
441
- }
442
- return formattedResponse;
443
- }, _AbuseIPDBClient_requestData = async function _AbuseIPDBClient_requestData(url, method, headers, body) {
444
- return fetch(url, {
445
- method,
446
- headers,
447
- body,
448
- });
449
- }, _AbuseIPDBClient_formatRequestBulkReport = function _AbuseIPDBClient_formatRequestBulkReport(headers, data) {
450
- const { csv } = data;
451
- const file = fileFromSync(csv);
452
- const formData = new FormData();
453
- formData.append('csv', file);
454
- return {
455
- headers,
456
- body: formData,
457
- };
458
- }, _AbuseIPDBClient_formatUrl = function _AbuseIPDBClient_formatUrl(uri, params) {
459
- const url = new URL(`${__classPrivateFieldGet(this, _AbuseIPDBClient_url, "f")}/${uri}`);
460
- for (const key of Object.keys(params ?? {})) {
461
- url.searchParams.append(key, params?.[key]);
462
- }
463
- return url.href;
464
- }, _AbuseIPDBClient_validateData = function _AbuseIPDBClient_validateData(parameters, schema) {
465
- const result = schema.safeParse(parameters);
466
- if (!result.success) {
467
- throw result.error;
468
- }
469
- else {
470
- return result.data;
471
- }
472
- }, _AbuseIPDBClient_handleRequest = async function _AbuseIPDBClient_handleRequest(endpointURI, parameters) {
473
- const { method, schema } = ENDPOINTS[endpointURI];
474
- // Validates the input parameters given by the client.
475
- const validatedInput = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_validateData).call(this, parameters, schema);
476
- let response;
477
- if (endpointURI === 'bulk-report') {
478
- // There is no need to append QueryParams for the bulk-report endpoint, so it is removed here.
479
- const url = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatUrl).call(this, endpointURI);
480
- const { headers, body } = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatRequestBulkReport).call(this, __classPrivateFieldGet(this, _AbuseIPDBClient_headers, "f"), parameters);
481
- response = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_requestData).call(this, url, method, headers, body);
482
- }
483
- else {
484
- const url = __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatUrl).call(this, endpointURI, validatedInput);
485
- response = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_requestData).call(this, url, method, __classPrivateFieldGet(this, _AbuseIPDBClient_headers, "f"));
486
- }
487
- // Transforms the API fetch response to the library format.
488
- const formattedResponseData = await __classPrivateFieldGet(this, _AbuseIPDBClient_instances, "m", _AbuseIPDBClient_formatResponse).call(this, response);
489
- return formattedResponseData;
490
- };
491
461
 
492
462
  /**
493
463
  * AbuseIPDB Report Category types.
@@ -68,7 +68,7 @@ interface APICheckEndpointResponse {
68
68
  countryCode: string | null;
69
69
  countryName?: string | null;
70
70
  usageType: UsageType;
71
- isp: string;
71
+ isp: string | null;
72
72
  isTor: boolean;
73
73
  domain: string | null;
74
74
  hostnames: Array<string>;
@@ -359,7 +359,13 @@ interface AbuseIPDBClientOptions extends z.TypeOf<typeof abuseIPDBClientOptionsS
359
359
  * @group Input - Validator
360
360
  */
361
361
  declare const abuseIPDBClientSchema: z.ZodObject<{
362
+ /** Client API Key, must be generated at AbuseIPDB's client dashboard. */
362
363
  apiKey: z.ZodString;
364
+ } & {
365
+ /**
366
+ * Overrides the default AbuseIPDB base API url, can be used to proxy client requests.
367
+ * @defaultValue `https://api.abuseipdb.com/api/v2`
368
+ */
363
369
  url: z.ZodOptional<z.ZodString>;
364
370
  }, "strip", z.ZodTypeAny, {
365
371
  apiKey: string;
@@ -411,8 +417,12 @@ interface CheckOptions extends z.TypeOf<typeof checkOptionsSchema> {
411
417
  * @group Input - Validator
412
418
  */
413
419
  declare const checkSchema: z.ZodEffects<z.ZodObject<{
420
+ /** Single IPv4/IPv6 address. */
414
421
  ipAddress: z.ZodEffects<z.ZodString, string, string>;
422
+ } & {
423
+ /** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
415
424
  maxAgeInDays: z.ZodOptional<z.ZodNumber>;
425
+ /** Includes in the client response all the reports (Limited to 10,000) and country name entries, based on the `maxAgeInDays` parameter. Defaults to `false` by the API. */
416
426
  verbose: z.ZodOptional<z.ZodBoolean>;
417
427
  }, "strip", z.ZodTypeAny, {
418
428
  ipAddress: string;
@@ -453,9 +463,14 @@ interface ReportsOptions extends z.infer<typeof reportsOptionsSchema> {
453
463
  * @group Input - Validator
454
464
  */
455
465
  declare const reportsSchema: z.ZodObject<{
466
+ /** Single IPv4/IPv6 address. */
456
467
  ipAddress: z.ZodEffects<z.ZodString, string, string>;
468
+ } & {
469
+ /** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
457
470
  maxAgeInDays: z.ZodOptional<z.ZodNumber>;
471
+ /** Pagination number based on the `perPage` parameter. Minimum accepted value is 1, defaults to `1` by the API. */
458
472
  page: z.ZodOptional<z.ZodNumber>;
473
+ /** Amount of reports per page. Accepted values between 1 and 100, defaults to `25` by the API. */
459
474
  perPage: z.ZodOptional<z.ZodNumber>;
460
475
  }, "strip", z.ZodTypeAny, {
461
476
  ipAddress: string;
@@ -573,8 +588,12 @@ interface ReportOptions extends z.TypeOf<typeof reportOptionsSchema> {
573
588
  * @group Input - Validator
574
589
  */
575
590
  declare const reportSchema: z.ZodObject<{
591
+ /** Single IPv4/IPv6 address. */
576
592
  ip: z.ZodEffects<z.ZodString, string, string>;
593
+ /** Array of categories */
577
594
  categories: z.ZodArray<z.ZodNumber, "many">;
595
+ } & {
596
+ /** Message to be added to the report, limited to 1024 characters. */
578
597
  comment: z.ZodOptional<z.ZodString>;
579
598
  }, "strip", z.ZodTypeAny, {
580
599
  ip: string;
@@ -606,7 +625,16 @@ interface CheckBlockOptions extends z.TypeOf<typeof checkBlockOptionsSchema> {
606
625
  * @group Input - Validator
607
626
  */
608
627
  declare const checkBlockSchema: z.ZodObject<{
628
+ /**
629
+ * Single IPv4/IPv6 address block in CIDR format.
630
+ * The value is capped by your current subscription tier. (Up to /24 on Standard, /20 on Basic, /16 on Premium).
631
+ */
609
632
  network: z.ZodEffects<z.ZodString, string, string>;
633
+ } & {
634
+ /**
635
+ * Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API.
636
+ * The value is capped by your current subscription tier. (Up to 30 on Standard, 60 on Basic, 365 on Premium).
637
+ */
610
638
  maxAgeInDays: z.ZodOptional<z.ZodNumber>;
611
639
  }, "strip", z.ZodTypeAny, {
612
640
  network: string;
@@ -724,4 +752,5 @@ declare const BASE_URL = "https://api.abuseipdb.com/api/v2";
724
752
  */
725
753
  declare const isArrISO31661Alpha2: (arr: Array<string>) => boolean;
726
754
 
727
- export { type APIBlacklistEndpointResponse, type APIBlacklistEndpointTextResponse, type APIBulkReportEndpointResponse, type APICheckBlockEndpointResponse, type APICheckEndpointResponse, type APIClearAddressEndpointResponse, type APIReportEndpointResponse, type APIReportsEndpointResponse, type APIResponse, type APIResponseError, type APIServerErrorResultResponse, AbuseIPDBClient, type AbuseIPDBClientConfig, type AbuseIPDBClientOptions, BASE_URL, type BlacklistOptions, type CheckBlockOptions, type CheckOptions, type ClientAPIHeaders, type ClientAPIRateLimitHTTPHeaders, type ClientFetchResponseHeaders, type ClientHeaders, type ClientResponse, type EndpointURIS, type InvalidReportsEntity, type NonEmptyArr, ReportCategory, type ReportOptions, type ReportedAddressEntity, type ReportsEntity, type ReportsOptions, type UsageType, abuseIPDBClientSchema, blacklistSchema, bulkReportSchema, checkBlockSchema, checkSchema, clearAddressSchema, isArrISO31661Alpha2, reportSchema, reportsSchema };
755
+ export { AbuseIPDBClient, BASE_URL, ReportCategory, abuseIPDBClientSchema, blacklistSchema, bulkReportSchema, checkBlockSchema, checkSchema, clearAddressSchema, isArrISO31661Alpha2, reportSchema, reportsSchema };
756
+ export type { APIBlacklistEndpointResponse, APIBlacklistEndpointTextResponse, APIBulkReportEndpointResponse, APICheckBlockEndpointResponse, APICheckEndpointResponse, APIClearAddressEndpointResponse, APIReportEndpointResponse, APIReportsEndpointResponse, APIResponse, APIResponseError, APIServerErrorResultResponse, AbuseIPDBClientConfig, AbuseIPDBClientOptions, BlacklistOptions, CheckBlockOptions, CheckOptions, ClientAPIHeaders, ClientAPIRateLimitHTTPHeaders, ClientFetchResponseHeaders, ClientHeaders, ClientResponse, EndpointURIS, InvalidReportsEntity, NonEmptyArr, ReportOptions, ReportedAddressEntity, ReportsEntity, ReportsOptions, UsageType };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "abuseipdb-client",
3
- "version": "0.1.128",
3
+ "version": "1.0.0",
4
4
  "private": false,
5
5
  "description": "AbuseIPDB Node.js API client.",
6
6
  "author": "Arthur Melo <contact@arthurmelo.com>",
7
7
  "homepage": "https://github.com/arthur-melo/abuseipdb-client",
8
8
  "license": "MIT",
9
9
  "engines": {
10
- "node": ">=14.18.0"
10
+ "node": ">=20"
11
11
  },
12
12
  "sideEffects": false,
13
13
  "types": "./dist/types/index.d.ts",
@@ -34,57 +34,53 @@
34
34
  "lint": "prettier -w '{lib,test}/**/*.ts' && eslint --fix '{lib,test}/**/*.ts'",
35
35
  "docs": "typedoc --plugin typedoc-plugin-replace-text",
36
36
  "prepublishOnly": "npm run test && npm run build",
37
- "prepare": "is-ci || husky install",
38
- "semantic-release": "semantic-release"
37
+ "prepare": "husky",
38
+ "semantic-release": "cross-env HUSKY=0 semantic-release"
39
39
  },
40
40
  "dependencies": {
41
- "fetch-blob": "^3.2.0",
42
- "formdata-polyfill": "^4.0.10",
43
- "isomorphic-unfetch": "^4.0.1",
44
41
  "jsonapi-typescript": "^0.1.3",
45
- "validator": "^13.7.0",
46
- "zod": "^3.20.2"
42
+ "validator": "^13.15.0",
43
+ "zod": "^3.24.4"
47
44
  },
48
45
  "devDependencies": {
49
- "@jest/globals": "^29.3.1",
50
- "@rollup/plugin-commonjs": "^25.0.0",
51
- "@rollup/plugin-json": "^6.0.0",
52
- "@rollup/plugin-node-resolve": "^15.0.1",
53
- "@semantic-release/changelog": "^6.0.2",
46
+ "@jest/globals": "^29.7.0",
47
+ "@rollup/plugin-commonjs": "^28.0.3",
48
+ "@rollup/plugin-json": "^6.1.0",
49
+ "@rollup/plugin-node-resolve": "^16.0.1",
50
+ "@semantic-release/changelog": "^6.0.3",
54
51
  "@semantic-release/git": "^10.0.1",
55
- "@semantic-release/npm": "^10.0.2",
56
- "@types/jest": "^29.2.4",
57
- "@types/node-fetch": "^2.6.2",
58
- "@types/validator": "^13.7.10",
59
- "@typescript-eslint/eslint-plugin": "^5.47.0",
60
- "@typescript-eslint/parser": "^5.47.0",
61
- "conventional-changelog-conventionalcommits": "^7.0.1",
52
+ "@semantic-release/npm": "^12.0.1",
53
+ "@types/jest": "^29.5.14",
54
+ "@types/validator": "^13.15.0",
55
+ "@typescript-eslint/eslint-plugin": "^8.32.0",
56
+ "@typescript-eslint/parser": "^8.32.0",
57
+ "conventional-changelog-conventionalcommits": "^8.0.0",
62
58
  "cross-env": "^7.0.3",
63
59
  "cz-conventional-changelog": "^3.3.0",
64
- "dotenv": "^16.0.3",
65
- "eslint": "^8.30.0",
66
- "eslint-config-prettier": "^9.0.0",
67
- "eslint-plugin-jest": "^27.1.7",
68
- "eslint-plugin-prettier": "^5.0.0",
69
- "husky": "^8.0.2",
70
- "is-ci": "^3.0.1",
71
- "jest": "^29.3.1",
72
- "jest-extended": "^4.0.0",
60
+ "dotenv": "^16.5.0",
61
+ "eslint": "^9.26.0",
62
+ "eslint-config-prettier": "^10.1.3",
63
+ "eslint-plugin-jest": "^28.11.0",
64
+ "eslint-plugin-prettier": "^5.4.0",
65
+ "husky": "^9.1.7",
66
+ "is-ci": "^4.1.0",
67
+ "jest": "^29.7.0",
68
+ "jest-extended": "^4.0.2",
73
69
  "jest-fetch-mock": "^3.0.3",
74
- "lint-staged": "^14.0.0",
75
- "prettier": "^3.0.0",
76
- "rimraf": "^5.0.0",
77
- "rollup": "^3.7.5",
70
+ "lint-staged": "^15.5.2",
71
+ "prettier": "^3.5.3",
72
+ "rimraf": "^6.0.1",
73
+ "rollup": "^4.40.2",
78
74
  "rollup-plugin-bundle-size": "^1.0.3",
79
- "rollup-plugin-dts": "^6.0.0",
80
- "rollup-plugin-typescript2": "^0.35.0",
81
- "semantic-release": "^21.0.0",
82
- "ts-jest": "^29.0.3",
83
- "ts-node": "^10.9.1",
84
- "tslib": "^2.4.1",
85
- "typedoc": "^0.25.1",
86
- "typedoc-plugin-replace-text": "^3.0.0",
87
- "typescript": "^5.0.4"
75
+ "rollup-plugin-dts": "^6.2.1",
76
+ "rollup-plugin-typescript2": "^0.36.0",
77
+ "semantic-release": "^24.2.3",
78
+ "ts-jest": "^29.3.2",
79
+ "ts-node": "^10.9.2",
80
+ "tslib": "^2.8.1",
81
+ "typedoc": "^0.28.4",
82
+ "typedoc-plugin-replace-text": "^4.2.0",
83
+ "typescript": "^5.8.3"
88
84
  },
89
85
  "repository": {
90
86
  "type": "git",