dymo-api 1.1.0 → 1.1.2

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.
@@ -57,7 +57,7 @@ const convertTailwindToInlineCss = (htmlContent) => {
57
57
  *
58
58
  * @param token - A string or null representing the authentication token. Must not be null.
59
59
  * @param data - An object adhering to the Validator interface, containing at least one of the following fields:
60
- * email, phone, domain, creditCard, ip, or wallet.
60
+ * url, email, phone, domain, creditCard, ip, wallet or user agent.
61
61
  *
62
62
  * @returns A promise that resolves to the response data from the verification endpoint.
63
63
  *
@@ -67,7 +67,7 @@ const convertTailwindToInlineCss = (htmlContent) => {
67
67
  const isValidData = async (token, data) => {
68
68
  if (token === null)
69
69
  throw customError(3000, "Invalid private token.");
70
- if (!Object.keys(data).some((key) => ["email", "phone", "domain", "creditCard", "ip", "wallet"].includes(key) && data.hasOwnProperty(key)))
70
+ if (!Object.keys(data).some((key) => ["url", "email", "phone", "domain", "creditCard", "ip", "wallet", "userAgent"].includes(key) && data.hasOwnProperty(key)))
71
71
  throw customError(1500, "You must provide at least one parameter.");
72
72
  try {
73
73
  const response = await config_1.axiosApiUrl.post("/private/secure/verify", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
@@ -72,12 +72,14 @@ class DymoAPI {
72
72
  * If neither is set, it will throw an error.
73
73
  *
74
74
  * @param {Object} data - The data to be validated.
75
+ * @param {string} [data.url] - Optional URL to be validated.
75
76
  * @param {string} [data.email] - Optional email address to be validated.
76
77
  * @param {Interfaces.PhoneData} [data.phone] - Optional phone number data to be validated.
77
78
  * @param {string} [data.domain] - Optional domain name to be validated.
78
79
  * @param {string|Interfaces.CreditCardData} [data.creditCard] - Optional credit card number or data to be validated.
79
80
  * @param {string} [data.ip] - Optional IP address to be validated.
80
81
  * @param {string} [data.wallet] - Optional wallet address to be validated.
82
+ * @param {string} [data.userAgent] - Optional user agent string to be validated.
81
83
  * @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
82
84
  * @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
83
85
  * @throws Will throw an error if there is an issue with the validation process.
@@ -18,7 +18,7 @@ const convertTailwindToInlineCss = (htmlContent) => {
18
18
  *
19
19
  * @param token - A string or null representing the authentication token. Must not be null.
20
20
  * @param data - An object adhering to the Validator interface, containing at least one of the following fields:
21
- * email, phone, domain, creditCard, ip, or wallet.
21
+ * url, email, phone, domain, creditCard, ip, wallet or user agent.
22
22
  *
23
23
  * @returns A promise that resolves to the response data from the verification endpoint.
24
24
  *
@@ -28,7 +28,7 @@ const convertTailwindToInlineCss = (htmlContent) => {
28
28
  export const isValidData = async (token, data) => {
29
29
  if (token === null)
30
30
  throw customError(3000, "Invalid private token.");
31
- if (!Object.keys(data).some((key) => ["email", "phone", "domain", "creditCard", "ip", "wallet"].includes(key) && data.hasOwnProperty(key)))
31
+ if (!Object.keys(data).some((key) => ["url", "email", "phone", "domain", "creditCard", "ip", "wallet", "userAgent"].includes(key) && data.hasOwnProperty(key)))
32
32
  throw customError(1500, "You must provide at least one parameter.");
33
33
  try {
34
34
  const response = await axiosApiUrl.post("/private/secure/verify", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
@@ -37,12 +37,14 @@ class DymoAPI {
37
37
  * If neither is set, it will throw an error.
38
38
  *
39
39
  * @param {Object} data - The data to be validated.
40
+ * @param {string} [data.url] - Optional URL to be validated.
40
41
  * @param {string} [data.email] - Optional email address to be validated.
41
42
  * @param {Interfaces.PhoneData} [data.phone] - Optional phone number data to be validated.
42
43
  * @param {string} [data.domain] - Optional domain name to be validated.
43
44
  * @param {string|Interfaces.CreditCardData} [data.creditCard] - Optional credit card number or data to be validated.
44
45
  * @param {string} [data.ip] - Optional IP address to be validated.
45
46
  * @param {string} [data.wallet] - Optional wallet address to be validated.
47
+ * @param {string} [data.userAgent] - Optional user agent string to be validated.
46
48
  * @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
47
49
  * @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
48
50
  * @throws Will throw an error if there is an issue with the validation process.
@@ -4,7 +4,7 @@ import * as Interfaces from "../lib/interfaces";
4
4
  *
5
5
  * @param token - A string or null representing the authentication token. Must not be null.
6
6
  * @param data - An object adhering to the Validator interface, containing at least one of the following fields:
7
- * email, phone, domain, creditCard, ip, or wallet.
7
+ * url, email, phone, domain, creditCard, ip, wallet or user agent.
8
8
  *
9
9
  * @returns A promise that resolves to the response data from the verification endpoint.
10
10
  *
@@ -34,12 +34,14 @@ declare class DymoAPI {
34
34
  * If neither is set, it will throw an error.
35
35
  *
36
36
  * @param {Object} data - The data to be validated.
37
+ * @param {string} [data.url] - Optional URL to be validated.
37
38
  * @param {string} [data.email] - Optional email address to be validated.
38
39
  * @param {Interfaces.PhoneData} [data.phone] - Optional phone number data to be validated.
39
40
  * @param {string} [data.domain] - Optional domain name to be validated.
40
41
  * @param {string|Interfaces.CreditCardData} [data.creditCard] - Optional credit card number or data to be validated.
41
42
  * @param {string} [data.ip] - Optional IP address to be validated.
42
43
  * @param {string} [data.wallet] - Optional wallet address to be validated.
44
+ * @param {string} [data.userAgent] - Optional user agent string to be validated.
43
45
  * @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
44
46
  * @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
45
47
  * @throws Will throw an error if there is an issue with the validation process.
@@ -11,12 +11,14 @@ export interface CreditCardData {
11
11
  }
12
12
  export type VerifyPlugins = "blocklist" | "compromiseDetector" | "nsfw" | "reputation" | "torNetwork" | "typosquatting" | "urlShortener";
13
13
  export interface Validator {
14
+ url?: string;
14
15
  email?: string;
15
16
  phone?: PhoneData;
16
17
  domain?: string;
17
18
  creditCard?: string | CreditCardData;
18
19
  ip?: string;
19
20
  wallet?: string;
21
+ userAgent?: string;
20
22
  plugins?: VerifyPlugins[];
21
23
  }
22
24
  export interface SRNG {
@@ -164,6 +166,23 @@ export interface PasswordValidationResult {
164
166
  details: ValidationDetail[];
165
167
  }
166
168
  export interface DataValidationAnalysis {
169
+ url: {
170
+ valid: boolean;
171
+ fraud: boolean;
172
+ freeSubdomain: boolean;
173
+ customTLD: boolean;
174
+ url: string;
175
+ domain: string;
176
+ plugins: {
177
+ blocklist?: boolean;
178
+ compromiseDetector?: boolean;
179
+ nsfw?: boolean;
180
+ reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
181
+ torNetwork?: boolean;
182
+ typosquatting?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
183
+ urlShortener?: boolean;
184
+ };
185
+ };
167
186
  email: {
168
187
  valid: boolean;
169
188
  fraud: boolean;
@@ -273,6 +292,20 @@ export interface DataValidationAnalysis {
273
292
  torNetwork?: boolean;
274
293
  };
275
294
  };
295
+ userAgent: {
296
+ valid: boolean;
297
+ type?: string;
298
+ clientSlug?: string | null;
299
+ clientName?: string;
300
+ version?: string | null;
301
+ userAgent?: string;
302
+ fraud?: boolean;
303
+ isRealUser?: boolean;
304
+ info?: string;
305
+ plugins?: {
306
+ blocklist?: boolean;
307
+ };
308
+ };
276
309
  }
277
310
  export type SchemaType = "string" | "number" | "boolean" | "array" | "object";
278
311
  export interface JsonSchemaProperty {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.1.00",
3
+ "version": "1.1.02",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",