abuseipdb-client 2.0.30 → 2.0.32
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.js +39 -25
- package/dist/index.mjs +39 -25
- package/dist/types/index.d.ts +29 -203
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28,19 +28,6 @@ const isArrISO31661Alpha2 = (arr) => arr
|
|
|
28
28
|
return acc;
|
|
29
29
|
}, false);
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Removes a boolean query string parameter when its value is set to `false`.
|
|
33
|
-
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
34
|
-
* this function filter those values in order to return the right response.
|
|
35
|
-
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
36
|
-
*/
|
|
37
|
-
const filterBooleanAPIQueryStrings = (schema, parameter) => {
|
|
38
|
-
const newSchema = { ...schema };
|
|
39
|
-
if (schema[parameter] === false) {
|
|
40
|
-
delete newSchema[parameter];
|
|
41
|
-
}
|
|
42
|
-
return newSchema;
|
|
43
|
-
};
|
|
44
31
|
const abuseIPDBClientRequiredSchema = zod.z.object({
|
|
45
32
|
/** Client API Key, must be generated at AbuseIPDB's client dashboard. */
|
|
46
33
|
apiKey: zod.z.string().min(1),
|
|
@@ -55,7 +42,7 @@ const abuseIPDBClientOptionsSchema = zod.z.object({
|
|
|
55
42
|
/**
|
|
56
43
|
* @group Input - Validator
|
|
57
44
|
*/
|
|
58
|
-
const abuseIPDBClientSchema = abuseIPDBClientRequiredSchema.
|
|
45
|
+
const abuseIPDBClientSchema = abuseIPDBClientRequiredSchema.extend(abuseIPDBClientOptionsSchema.shape);
|
|
59
46
|
zod.z.object({
|
|
60
47
|
/** Client API Key. */
|
|
61
48
|
apiKey: zod.z.string(),
|
|
@@ -81,8 +68,20 @@ const checkOptionsSchema = zod.z.object({
|
|
|
81
68
|
* @group Input - Validator
|
|
82
69
|
*/
|
|
83
70
|
const checkSchema = checkRequiredSchema
|
|
84
|
-
.
|
|
85
|
-
.transform(schema =>
|
|
71
|
+
.extend(checkOptionsSchema.shape)
|
|
72
|
+
.transform(schema => {
|
|
73
|
+
/**
|
|
74
|
+
* Removes a boolean query string parameter when its value is set to `false`.
|
|
75
|
+
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
76
|
+
* this function filter those values in order to return the right response.
|
|
77
|
+
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
78
|
+
*/
|
|
79
|
+
const newSchema = { ...schema };
|
|
80
|
+
if (schema['verbose'] === false) {
|
|
81
|
+
delete newSchema['verbose'];
|
|
82
|
+
}
|
|
83
|
+
return newSchema;
|
|
84
|
+
});
|
|
86
85
|
const reportsRequiredSchema = zod.z.object({
|
|
87
86
|
/** Single IPv4/IPv6 address. */
|
|
88
87
|
ipAddress: zod.z
|
|
@@ -100,7 +99,7 @@ const reportsOptionsSchema = zod.z.object({
|
|
|
100
99
|
/**
|
|
101
100
|
* @group Input - Validator
|
|
102
101
|
*/
|
|
103
|
-
const reportsSchema = reportsRequiredSchema.
|
|
102
|
+
const reportsSchema = reportsRequiredSchema.extend(reportsOptionsSchema.shape);
|
|
104
103
|
const blacklistOptionsSchema = zod.z.object({
|
|
105
104
|
/** Minimum confidence percentage value. Accepted values between 25 and 100, defaults to `100` by the API. Requires a subscription to use this feature. */
|
|
106
105
|
confidenceMinimum: zod.z.number().int().min(25).max(100).optional(),
|
|
@@ -126,7 +125,19 @@ const blacklistOptionsSchema = zod.z.object({
|
|
|
126
125
|
* @group Input - Validator
|
|
127
126
|
*/
|
|
128
127
|
const blacklistSchema = blacklistOptionsSchema
|
|
129
|
-
.transform(schema =>
|
|
128
|
+
.transform(schema => {
|
|
129
|
+
/**
|
|
130
|
+
* Removes a boolean query string parameter when its value is set to `false`.
|
|
131
|
+
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
132
|
+
* this function filter those values in order to return the right response.
|
|
133
|
+
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
134
|
+
*/
|
|
135
|
+
const newSchema = { ...schema };
|
|
136
|
+
if (schema['plaintext'] === false) {
|
|
137
|
+
delete newSchema['plaintext'];
|
|
138
|
+
}
|
|
139
|
+
return newSchema;
|
|
140
|
+
})
|
|
130
141
|
.superRefine((schemaValues, ctx) => {
|
|
131
142
|
// Countries declaration are optional, skip validation if this is the case.
|
|
132
143
|
if (!(schemaValues.onlyCountries ?? schemaValues.exceptCountries)) {
|
|
@@ -134,7 +145,7 @@ const blacklistSchema = blacklistOptionsSchema
|
|
|
134
145
|
}
|
|
135
146
|
if (schemaValues.onlyCountries && schemaValues.exceptCountries) {
|
|
136
147
|
ctx.addIssue({
|
|
137
|
-
code:
|
|
148
|
+
code: 'custom',
|
|
138
149
|
message: '`exceptCountries` and `onlyCountries` are mutually exclusive, only one can be defined at a time.',
|
|
139
150
|
});
|
|
140
151
|
return;
|
|
@@ -147,9 +158,9 @@ const blacklistSchema = blacklistOptionsSchema
|
|
|
147
158
|
}
|
|
148
159
|
if (countriesArr.length === 0) {
|
|
149
160
|
ctx.addIssue({
|
|
150
|
-
code:
|
|
161
|
+
code: 'too_small',
|
|
162
|
+
origin: 'number',
|
|
151
163
|
minimum: 1,
|
|
152
|
-
type: 'array',
|
|
153
164
|
inclusive: true,
|
|
154
165
|
message: `[${countryParam}] Atleast one country must be specified.`,
|
|
155
166
|
});
|
|
@@ -157,7 +168,7 @@ const blacklistSchema = blacklistOptionsSchema
|
|
|
157
168
|
}
|
|
158
169
|
if (!isArrISO31661Alpha2(countriesArr)) {
|
|
159
170
|
ctx.addIssue({
|
|
160
|
-
code:
|
|
171
|
+
code: 'custom',
|
|
161
172
|
message: `[${countryParam}] Countries must be valid ISO 3166-1 Alpha-2 codes.`,
|
|
162
173
|
});
|
|
163
174
|
}
|
|
@@ -176,7 +187,7 @@ const reportOptionsSchema = zod.z.object({
|
|
|
176
187
|
/**
|
|
177
188
|
* @group Input - Validator
|
|
178
189
|
*/
|
|
179
|
-
const reportSchema = reportRequiredSchema.
|
|
190
|
+
const reportSchema = reportRequiredSchema.extend(reportOptionsSchema.shape);
|
|
180
191
|
const checkBlockRequiredSchema = zod.z.object({
|
|
181
192
|
/**
|
|
182
193
|
* Single IPv4/IPv6 address block in CIDR format.
|
|
@@ -196,7 +207,7 @@ const checkBlockOptionsSchema = zod.z.object({
|
|
|
196
207
|
/**
|
|
197
208
|
* @group Input - Validator
|
|
198
209
|
*/
|
|
199
|
-
const checkBlockSchema = checkBlockRequiredSchema.
|
|
210
|
+
const checkBlockSchema = checkBlockRequiredSchema.extend(checkBlockOptionsSchema.shape);
|
|
200
211
|
const bulkReportRequiredSchema = zod.z.object({
|
|
201
212
|
/** Report CSV filepath to be sent. */
|
|
202
213
|
csv: zod.z.string(),
|
|
@@ -369,7 +380,10 @@ class AbuseIPDBClient {
|
|
|
369
380
|
#formatUrl(uri, params) {
|
|
370
381
|
const url = new URL(`${this.#url}/${uri}`);
|
|
371
382
|
for (const key of Object.keys(params ?? {})) {
|
|
372
|
-
|
|
383
|
+
const value = params[key];
|
|
384
|
+
if (value !== undefined && value !== null) {
|
|
385
|
+
url.searchParams.append(key, String(value));
|
|
386
|
+
}
|
|
373
387
|
}
|
|
374
388
|
return url.href;
|
|
375
389
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -26,19 +26,6 @@ const isArrISO31661Alpha2 = (arr) => arr
|
|
|
26
26
|
return acc;
|
|
27
27
|
}, false);
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Removes a boolean query string parameter when its value is set to `false`.
|
|
31
|
-
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
32
|
-
* this function filter those values in order to return the right response.
|
|
33
|
-
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
34
|
-
*/
|
|
35
|
-
const filterBooleanAPIQueryStrings = (schema, parameter) => {
|
|
36
|
-
const newSchema = { ...schema };
|
|
37
|
-
if (schema[parameter] === false) {
|
|
38
|
-
delete newSchema[parameter];
|
|
39
|
-
}
|
|
40
|
-
return newSchema;
|
|
41
|
-
};
|
|
42
29
|
const abuseIPDBClientRequiredSchema = z.object({
|
|
43
30
|
/** Client API Key, must be generated at AbuseIPDB's client dashboard. */
|
|
44
31
|
apiKey: z.string().min(1),
|
|
@@ -53,7 +40,7 @@ const abuseIPDBClientOptionsSchema = z.object({
|
|
|
53
40
|
/**
|
|
54
41
|
* @group Input - Validator
|
|
55
42
|
*/
|
|
56
|
-
const abuseIPDBClientSchema = abuseIPDBClientRequiredSchema.
|
|
43
|
+
const abuseIPDBClientSchema = abuseIPDBClientRequiredSchema.extend(abuseIPDBClientOptionsSchema.shape);
|
|
57
44
|
z.object({
|
|
58
45
|
/** Client API Key. */
|
|
59
46
|
apiKey: z.string(),
|
|
@@ -79,8 +66,20 @@ const checkOptionsSchema = z.object({
|
|
|
79
66
|
* @group Input - Validator
|
|
80
67
|
*/
|
|
81
68
|
const checkSchema = checkRequiredSchema
|
|
82
|
-
.
|
|
83
|
-
.transform(schema =>
|
|
69
|
+
.extend(checkOptionsSchema.shape)
|
|
70
|
+
.transform(schema => {
|
|
71
|
+
/**
|
|
72
|
+
* Removes a boolean query string parameter when its value is set to `false`.
|
|
73
|
+
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
74
|
+
* this function filter those values in order to return the right response.
|
|
75
|
+
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
76
|
+
*/
|
|
77
|
+
const newSchema = { ...schema };
|
|
78
|
+
if (schema['verbose'] === false) {
|
|
79
|
+
delete newSchema['verbose'];
|
|
80
|
+
}
|
|
81
|
+
return newSchema;
|
|
82
|
+
});
|
|
84
83
|
const reportsRequiredSchema = z.object({
|
|
85
84
|
/** Single IPv4/IPv6 address. */
|
|
86
85
|
ipAddress: z
|
|
@@ -98,7 +97,7 @@ const reportsOptionsSchema = z.object({
|
|
|
98
97
|
/**
|
|
99
98
|
* @group Input - Validator
|
|
100
99
|
*/
|
|
101
|
-
const reportsSchema = reportsRequiredSchema.
|
|
100
|
+
const reportsSchema = reportsRequiredSchema.extend(reportsOptionsSchema.shape);
|
|
102
101
|
const blacklistOptionsSchema = z.object({
|
|
103
102
|
/** Minimum confidence percentage value. Accepted values between 25 and 100, defaults to `100` by the API. Requires a subscription to use this feature. */
|
|
104
103
|
confidenceMinimum: z.number().int().min(25).max(100).optional(),
|
|
@@ -124,7 +123,19 @@ const blacklistOptionsSchema = z.object({
|
|
|
124
123
|
* @group Input - Validator
|
|
125
124
|
*/
|
|
126
125
|
const blacklistSchema = blacklistOptionsSchema
|
|
127
|
-
.transform(schema =>
|
|
126
|
+
.transform(schema => {
|
|
127
|
+
/**
|
|
128
|
+
* Removes a boolean query string parameter when its value is set to `false`.
|
|
129
|
+
* Currently, the AbuseIPDB's API treats boolean query strings as `true` regardless of its value,
|
|
130
|
+
* this function filter those values in order to return the right response.
|
|
131
|
+
* The `Check` and `Blacklist` as text endpoints have such booleans.
|
|
132
|
+
*/
|
|
133
|
+
const newSchema = { ...schema };
|
|
134
|
+
if (schema['plaintext'] === false) {
|
|
135
|
+
delete newSchema['plaintext'];
|
|
136
|
+
}
|
|
137
|
+
return newSchema;
|
|
138
|
+
})
|
|
128
139
|
.superRefine((schemaValues, ctx) => {
|
|
129
140
|
// Countries declaration are optional, skip validation if this is the case.
|
|
130
141
|
if (!(schemaValues.onlyCountries ?? schemaValues.exceptCountries)) {
|
|
@@ -132,7 +143,7 @@ const blacklistSchema = blacklistOptionsSchema
|
|
|
132
143
|
}
|
|
133
144
|
if (schemaValues.onlyCountries && schemaValues.exceptCountries) {
|
|
134
145
|
ctx.addIssue({
|
|
135
|
-
code:
|
|
146
|
+
code: 'custom',
|
|
136
147
|
message: '`exceptCountries` and `onlyCountries` are mutually exclusive, only one can be defined at a time.',
|
|
137
148
|
});
|
|
138
149
|
return;
|
|
@@ -145,9 +156,9 @@ const blacklistSchema = blacklistOptionsSchema
|
|
|
145
156
|
}
|
|
146
157
|
if (countriesArr.length === 0) {
|
|
147
158
|
ctx.addIssue({
|
|
148
|
-
code:
|
|
159
|
+
code: 'too_small',
|
|
160
|
+
origin: 'number',
|
|
149
161
|
minimum: 1,
|
|
150
|
-
type: 'array',
|
|
151
162
|
inclusive: true,
|
|
152
163
|
message: `[${countryParam}] Atleast one country must be specified.`,
|
|
153
164
|
});
|
|
@@ -155,7 +166,7 @@ const blacklistSchema = blacklistOptionsSchema
|
|
|
155
166
|
}
|
|
156
167
|
if (!isArrISO31661Alpha2(countriesArr)) {
|
|
157
168
|
ctx.addIssue({
|
|
158
|
-
code:
|
|
169
|
+
code: 'custom',
|
|
159
170
|
message: `[${countryParam}] Countries must be valid ISO 3166-1 Alpha-2 codes.`,
|
|
160
171
|
});
|
|
161
172
|
}
|
|
@@ -174,7 +185,7 @@ const reportOptionsSchema = z.object({
|
|
|
174
185
|
/**
|
|
175
186
|
* @group Input - Validator
|
|
176
187
|
*/
|
|
177
|
-
const reportSchema = reportRequiredSchema.
|
|
188
|
+
const reportSchema = reportRequiredSchema.extend(reportOptionsSchema.shape);
|
|
178
189
|
const checkBlockRequiredSchema = z.object({
|
|
179
190
|
/**
|
|
180
191
|
* Single IPv4/IPv6 address block in CIDR format.
|
|
@@ -194,7 +205,7 @@ const checkBlockOptionsSchema = z.object({
|
|
|
194
205
|
/**
|
|
195
206
|
* @group Input - Validator
|
|
196
207
|
*/
|
|
197
|
-
const checkBlockSchema = checkBlockRequiredSchema.
|
|
208
|
+
const checkBlockSchema = checkBlockRequiredSchema.extend(checkBlockOptionsSchema.shape);
|
|
198
209
|
const bulkReportRequiredSchema = z.object({
|
|
199
210
|
/** Report CSV filepath to be sent. */
|
|
200
211
|
csv: z.string(),
|
|
@@ -367,7 +378,10 @@ class AbuseIPDBClient {
|
|
|
367
378
|
#formatUrl(uri, params) {
|
|
368
379
|
const url = new URL(`${this.#url}/${uri}`);
|
|
369
380
|
for (const key of Object.keys(params ?? {})) {
|
|
370
|
-
|
|
381
|
+
const value = params[key];
|
|
382
|
+
if (value !== undefined && value !== null) {
|
|
383
|
+
url.searchParams.append(key, String(value));
|
|
384
|
+
}
|
|
371
385
|
}
|
|
372
386
|
return url.href;
|
|
373
387
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -339,16 +339,8 @@ declare enum ReportCategory {
|
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
declare const abuseIPDBClientOptionsSchema: z.ZodObject<{
|
|
342
|
-
/**
|
|
343
|
-
* Overrides the default AbuseIPDB base API url, can be used to proxy client requests.
|
|
344
|
-
* @defaultValue `https://api.abuseipdb.com/api/v2`
|
|
345
|
-
*/
|
|
346
342
|
url: z.ZodOptional<z.ZodString>;
|
|
347
|
-
},
|
|
348
|
-
url?: string | undefined;
|
|
349
|
-
}, {
|
|
350
|
-
url?: string | undefined;
|
|
351
|
-
}>;
|
|
343
|
+
}, z.core.$strip>;
|
|
352
344
|
/**
|
|
353
345
|
* AbuseIPDBClient instance optional parameters.
|
|
354
346
|
* @group Input - Optional Parameter
|
|
@@ -359,36 +351,13 @@ interface AbuseIPDBClientOptions extends z.TypeOf<typeof abuseIPDBClientOptionsS
|
|
|
359
351
|
* @group Input - Validator
|
|
360
352
|
*/
|
|
361
353
|
declare const abuseIPDBClientSchema: z.ZodObject<{
|
|
362
|
-
/** Client API Key, must be generated at AbuseIPDB's client dashboard. */
|
|
363
354
|
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
|
-
*/
|
|
369
355
|
url: z.ZodOptional<z.ZodString>;
|
|
370
|
-
},
|
|
371
|
-
apiKey: string;
|
|
372
|
-
url?: string | undefined;
|
|
373
|
-
}, {
|
|
374
|
-
apiKey: string;
|
|
375
|
-
url?: string | undefined;
|
|
376
|
-
}>;
|
|
356
|
+
}, z.core.$strip>;
|
|
377
357
|
declare const abuseIPDBClientConfigSchema: z.ZodObject<{
|
|
378
|
-
/** Client API Key. */
|
|
379
358
|
apiKey: z.ZodString;
|
|
380
|
-
/**
|
|
381
|
-
* Base API URL.
|
|
382
|
-
* @defaultValue `https://api.abuseipdb.com/api/v2`
|
|
383
|
-
*/
|
|
384
359
|
url: z.ZodString;
|
|
385
|
-
},
|
|
386
|
-
apiKey: string;
|
|
387
|
-
url: string;
|
|
388
|
-
}, {
|
|
389
|
-
apiKey: string;
|
|
390
|
-
url: string;
|
|
391
|
-
}>;
|
|
360
|
+
}, z.core.$strip>;
|
|
392
361
|
/**
|
|
393
362
|
* AbuseIPDBClient instance configuration variables.
|
|
394
363
|
* @group Client
|
|
@@ -396,17 +365,9 @@ declare const abuseIPDBClientConfigSchema: z.ZodObject<{
|
|
|
396
365
|
interface AbuseIPDBClientConfig extends z.TypeOf<typeof abuseIPDBClientConfigSchema> {
|
|
397
366
|
}
|
|
398
367
|
declare const checkOptionsSchema: z.ZodObject<{
|
|
399
|
-
/** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
|
|
400
368
|
maxAgeInDays: z.ZodOptional<z.ZodNumber>;
|
|
401
|
-
/** 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. */
|
|
402
369
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
-
},
|
|
404
|
-
maxAgeInDays?: number | undefined;
|
|
405
|
-
verbose?: boolean | undefined;
|
|
406
|
-
}, {
|
|
407
|
-
maxAgeInDays?: number | undefined;
|
|
408
|
-
verbose?: boolean | undefined;
|
|
409
|
-
}>;
|
|
370
|
+
}, z.core.$strip>;
|
|
410
371
|
/**
|
|
411
372
|
* Check endpoint optional parameters.
|
|
412
373
|
* @group Input - Optional Parameter
|
|
@@ -416,15 +377,11 @@ interface CheckOptions extends z.TypeOf<typeof checkOptionsSchema> {
|
|
|
416
377
|
/**
|
|
417
378
|
* @group Input - Validator
|
|
418
379
|
*/
|
|
419
|
-
declare const checkSchema: z.
|
|
420
|
-
|
|
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. */
|
|
380
|
+
declare const checkSchema: z.ZodPipe<z.ZodObject<{
|
|
381
|
+
ipAddress: z.ZodString;
|
|
424
382
|
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. */
|
|
426
383
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
427
|
-
},
|
|
384
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
428
385
|
ipAddress: string;
|
|
429
386
|
maxAgeInDays?: number | undefined;
|
|
430
387
|
verbose?: boolean | undefined;
|
|
@@ -432,27 +389,12 @@ declare const checkSchema: z.ZodEffects<z.ZodObject<{
|
|
|
432
389
|
ipAddress: string;
|
|
433
390
|
maxAgeInDays?: number | undefined;
|
|
434
391
|
verbose?: boolean | undefined;
|
|
435
|
-
}
|
|
436
|
-
ipAddress: string;
|
|
437
|
-
maxAgeInDays?: number | undefined;
|
|
438
|
-
verbose?: boolean | undefined;
|
|
439
|
-
}>;
|
|
392
|
+
}>>;
|
|
440
393
|
declare const reportsOptionsSchema: z.ZodObject<{
|
|
441
|
-
/** Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API. */
|
|
442
394
|
maxAgeInDays: z.ZodOptional<z.ZodNumber>;
|
|
443
|
-
/** Pagination number based on the `perPage` parameter. Minimum accepted value is 1, defaults to `1` by the API. */
|
|
444
395
|
page: z.ZodOptional<z.ZodNumber>;
|
|
445
|
-
/** Amount of reports per page. Accepted values between 1 and 100, defaults to `25` by the API. */
|
|
446
396
|
perPage: z.ZodOptional<z.ZodNumber>;
|
|
447
|
-
},
|
|
448
|
-
maxAgeInDays?: number | undefined;
|
|
449
|
-
page?: number | undefined;
|
|
450
|
-
perPage?: number | undefined;
|
|
451
|
-
}, {
|
|
452
|
-
maxAgeInDays?: number | undefined;
|
|
453
|
-
page?: number | undefined;
|
|
454
|
-
perPage?: number | undefined;
|
|
455
|
-
}>;
|
|
397
|
+
}, z.core.$strip>;
|
|
456
398
|
/**
|
|
457
399
|
* Reports endpoint optional parameters.
|
|
458
400
|
* @group Input - Optional Parameter
|
|
@@ -463,83 +405,28 @@ interface ReportsOptions extends z.infer<typeof reportsOptionsSchema> {
|
|
|
463
405
|
* @group Input - Validator
|
|
464
406
|
*/
|
|
465
407
|
declare const reportsSchema: z.ZodObject<{
|
|
466
|
-
|
|
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. */
|
|
408
|
+
ipAddress: z.ZodString;
|
|
470
409
|
maxAgeInDays: z.ZodOptional<z.ZodNumber>;
|
|
471
|
-
/** Pagination number based on the `perPage` parameter. Minimum accepted value is 1, defaults to `1` by the API. */
|
|
472
410
|
page: z.ZodOptional<z.ZodNumber>;
|
|
473
|
-
/** Amount of reports per page. Accepted values between 1 and 100, defaults to `25` by the API. */
|
|
474
411
|
perPage: z.ZodOptional<z.ZodNumber>;
|
|
475
|
-
},
|
|
476
|
-
ipAddress: string;
|
|
477
|
-
maxAgeInDays?: number | undefined;
|
|
478
|
-
page?: number | undefined;
|
|
479
|
-
perPage?: number | undefined;
|
|
480
|
-
}, {
|
|
481
|
-
ipAddress: string;
|
|
482
|
-
maxAgeInDays?: number | undefined;
|
|
483
|
-
page?: number | undefined;
|
|
484
|
-
perPage?: number | undefined;
|
|
485
|
-
}>;
|
|
412
|
+
}, z.core.$strip>;
|
|
486
413
|
declare const blacklistOptionsSchema: z.ZodObject<{
|
|
487
|
-
/** Minimum confidence percentage value. Accepted values between 25 and 100, defaults to `100` by the API. Requires a subscription to use this feature. */
|
|
488
414
|
confidenceMinimum: z.ZodOptional<z.ZodNumber>;
|
|
489
|
-
/**
|
|
490
|
-
* Limits the amount of returned reports. Accepted values between 1 and 500000, defaults to `10000` by the API.
|
|
491
|
-
* The value is capped by your current subscription tier. (10k Standard, 100k Basic, 500k Premium).
|
|
492
|
-
*/
|
|
493
415
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
494
|
-
/** Returns the response as a text list, instead of JSON structure. Result is wrapped in a `ClientResponse` */
|
|
495
416
|
plaintext: z.ZodOptional<z.ZodBoolean>;
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
500
|
-
onlyCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
501
|
-
/**
|
|
502
|
-
* Filters the reports based on a given array of ISO 3166-1 Alpha-2 countries, excluding only the given list.
|
|
503
|
-
* Requires a subscription to use this feature.
|
|
504
|
-
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
505
|
-
exceptCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
506
|
-
}, "strip", z.ZodTypeAny, {
|
|
507
|
-
confidenceMinimum?: number | undefined;
|
|
508
|
-
limit?: number | undefined;
|
|
509
|
-
plaintext?: boolean | undefined;
|
|
510
|
-
onlyCountries?: string[] | undefined;
|
|
511
|
-
exceptCountries?: string[] | undefined;
|
|
512
|
-
}, {
|
|
513
|
-
confidenceMinimum?: number | undefined;
|
|
514
|
-
limit?: number | undefined;
|
|
515
|
-
plaintext?: boolean | undefined;
|
|
516
|
-
onlyCountries?: string[] | undefined;
|
|
517
|
-
exceptCountries?: string[] | undefined;
|
|
518
|
-
}>;
|
|
417
|
+
onlyCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
418
|
+
exceptCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
419
|
+
}, z.core.$strip>;
|
|
519
420
|
/**
|
|
520
421
|
* @group Input - Validator
|
|
521
422
|
*/
|
|
522
|
-
declare const blacklistSchema: z.
|
|
523
|
-
/** Minimum confidence percentage value. Accepted values between 25 and 100, defaults to `100` by the API. Requires a subscription to use this feature. */
|
|
423
|
+
declare const blacklistSchema: z.ZodPipe<z.ZodObject<{
|
|
524
424
|
confidenceMinimum: z.ZodOptional<z.ZodNumber>;
|
|
525
|
-
/**
|
|
526
|
-
* Limits the amount of returned reports. Accepted values between 1 and 500000, defaults to `10000` by the API.
|
|
527
|
-
* The value is capped by your current subscription tier. (10k Standard, 100k Basic, 500k Premium).
|
|
528
|
-
*/
|
|
529
425
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
530
|
-
/** Returns the response as a text list, instead of JSON structure. Result is wrapped in a `ClientResponse` */
|
|
531
426
|
plaintext: z.ZodOptional<z.ZodBoolean>;
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
536
|
-
onlyCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
537
|
-
/**
|
|
538
|
-
* Filters the reports based on a given array of ISO 3166-1 Alpha-2 countries, excluding only the given list.
|
|
539
|
-
* Requires a subscription to use this feature.
|
|
540
|
-
* `onlyCountries` and `exceptCountries` are mutually exclusive, only one can be defined at a time. */
|
|
541
|
-
exceptCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
542
|
-
}, "strip", z.ZodTypeAny, {
|
|
427
|
+
onlyCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
428
|
+
exceptCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
429
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
543
430
|
confidenceMinimum?: number | undefined;
|
|
544
431
|
limit?: number | undefined;
|
|
545
432
|
plaintext?: boolean | undefined;
|
|
@@ -551,19 +438,7 @@ declare const blacklistSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
551
438
|
plaintext?: boolean | undefined;
|
|
552
439
|
onlyCountries?: string[] | undefined;
|
|
553
440
|
exceptCountries?: string[] | undefined;
|
|
554
|
-
}
|
|
555
|
-
confidenceMinimum?: number | undefined;
|
|
556
|
-
limit?: number | undefined;
|
|
557
|
-
plaintext?: boolean | undefined;
|
|
558
|
-
onlyCountries?: string[] | undefined;
|
|
559
|
-
exceptCountries?: string[] | undefined;
|
|
560
|
-
}>, any, {
|
|
561
|
-
confidenceMinimum?: number | undefined;
|
|
562
|
-
limit?: number | undefined;
|
|
563
|
-
plaintext?: boolean | undefined;
|
|
564
|
-
onlyCountries?: string[] | undefined;
|
|
565
|
-
exceptCountries?: string[] | undefined;
|
|
566
|
-
}>;
|
|
441
|
+
}>>;
|
|
567
442
|
/**
|
|
568
443
|
* Blacklist endpoint optional parameters.
|
|
569
444
|
* @group Input - Optional Parameter
|
|
@@ -571,13 +446,8 @@ declare const blacklistSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
571
446
|
interface BlacklistOptions extends z.TypeOf<typeof blacklistOptionsSchema> {
|
|
572
447
|
}
|
|
573
448
|
declare const reportOptionsSchema: z.ZodObject<{
|
|
574
|
-
/** Message to be added to the report, limited to 1024 characters. */
|
|
575
449
|
comment: z.ZodOptional<z.ZodString>;
|
|
576
|
-
},
|
|
577
|
-
comment?: string | undefined;
|
|
578
|
-
}, {
|
|
579
|
-
comment?: string | undefined;
|
|
580
|
-
}>;
|
|
450
|
+
}, z.core.$strip>;
|
|
581
451
|
/**
|
|
582
452
|
* Report endpoint optional parameters.
|
|
583
453
|
* @group Input - Optional Parameter
|
|
@@ -588,33 +458,13 @@ interface ReportOptions extends z.TypeOf<typeof reportOptionsSchema> {
|
|
|
588
458
|
* @group Input - Validator
|
|
589
459
|
*/
|
|
590
460
|
declare const reportSchema: z.ZodObject<{
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
/** Array of categories */
|
|
594
|
-
categories: z.ZodArray<z.ZodNumber, "many">;
|
|
595
|
-
} & {
|
|
596
|
-
/** Message to be added to the report, limited to 1024 characters. */
|
|
461
|
+
ip: z.ZodString;
|
|
462
|
+
categories: z.ZodArray<z.ZodNumber>;
|
|
597
463
|
comment: z.ZodOptional<z.ZodString>;
|
|
598
|
-
},
|
|
599
|
-
ip: string;
|
|
600
|
-
categories: number[];
|
|
601
|
-
comment?: string | undefined;
|
|
602
|
-
}, {
|
|
603
|
-
ip: string;
|
|
604
|
-
categories: number[];
|
|
605
|
-
comment?: string | undefined;
|
|
606
|
-
}>;
|
|
464
|
+
}, z.core.$strip>;
|
|
607
465
|
declare const checkBlockOptionsSchema: z.ZodObject<{
|
|
608
|
-
/**
|
|
609
|
-
* Show latest reports based on `n` days. Accepted values between 1 and 365, defaults to `30` by the API.
|
|
610
|
-
* The value is capped by your current subscription tier. (Up to 30 on Standard, 60 on Basic, 365 on Premium).
|
|
611
|
-
*/
|
|
612
466
|
maxAgeInDays: z.ZodOptional<z.ZodNumber>;
|
|
613
|
-
},
|
|
614
|
-
maxAgeInDays?: number | undefined;
|
|
615
|
-
}, {
|
|
616
|
-
maxAgeInDays?: number | undefined;
|
|
617
|
-
}>;
|
|
467
|
+
}, z.core.$strip>;
|
|
618
468
|
/**
|
|
619
469
|
* Check-Block endpoint optional parameters.
|
|
620
470
|
* @group Input - Optional Parameter
|
|
@@ -625,45 +475,21 @@ interface CheckBlockOptions extends z.TypeOf<typeof checkBlockOptionsSchema> {
|
|
|
625
475
|
* @group Input - Validator
|
|
626
476
|
*/
|
|
627
477
|
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
|
-
*/
|
|
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
|
-
*/
|
|
478
|
+
network: z.ZodString;
|
|
638
479
|
maxAgeInDays: z.ZodOptional<z.ZodNumber>;
|
|
639
|
-
},
|
|
640
|
-
network: string;
|
|
641
|
-
maxAgeInDays?: number | undefined;
|
|
642
|
-
}, {
|
|
643
|
-
network: string;
|
|
644
|
-
maxAgeInDays?: number | undefined;
|
|
645
|
-
}>;
|
|
480
|
+
}, z.core.$strip>;
|
|
646
481
|
/**
|
|
647
482
|
* @group Input - Validator
|
|
648
483
|
*/
|
|
649
484
|
declare const bulkReportSchema: z.ZodObject<{
|
|
650
|
-
/** Report CSV filepath to be sent. */
|
|
651
485
|
csv: z.ZodString;
|
|
652
|
-
},
|
|
653
|
-
csv: string;
|
|
654
|
-
}, {
|
|
655
|
-
csv: string;
|
|
656
|
-
}>;
|
|
486
|
+
}, z.core.$strip>;
|
|
657
487
|
/**
|
|
658
488
|
* @group Input - Validator
|
|
659
489
|
*/
|
|
660
490
|
declare const clearAddressSchema: z.ZodObject<{
|
|
661
|
-
ipAddress: z.
|
|
662
|
-
},
|
|
663
|
-
ipAddress: string;
|
|
664
|
-
}, {
|
|
665
|
-
ipAddress: string;
|
|
666
|
-
}>;
|
|
491
|
+
ipAddress: z.ZodString;
|
|
492
|
+
}, z.core.$strip>;
|
|
667
493
|
|
|
668
494
|
/**
|
|
669
495
|
* @internal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abuseipdb-client",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.32",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AbuseIPDB Node.js API client.",
|
|
6
6
|
"author": "Arthur Melo <contact@arthurmelo.com>",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"jsonapi-typescript": "^0.1.3",
|
|
42
42
|
"validator": "^13.15.0",
|
|
43
|
-
"zod": "^
|
|
43
|
+
"zod": "^4.1.12"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^30.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"husky": "^9.1.7",
|
|
66
66
|
"is-ci": "^4.1.0",
|
|
67
67
|
"jest": "^30.0.0",
|
|
68
|
-
"jest-extended": "^
|
|
68
|
+
"jest-extended": "^7.0.0",
|
|
69
69
|
"jest-fetch-mock": "^3.0.3",
|
|
70
70
|
"lint-staged": "^16.0.0",
|
|
71
71
|
"prettier": "^3.5.3",
|