dymo-api 1.2.11 → 1.2.12

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.
@@ -37,13 +37,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const config_1 = __importDefault(require("./config/index.cjs"));
40
- const PublicAPI = __importStar(require("./branches/public/index.cjs"));
41
- const PrivateAPI = __importStar(require("./branches/private/index.cjs"));
42
40
  const axios_1 = __importDefault(require("axios"));
43
41
  const basics_1 = require("./utils/basics.cjs");
44
- const customError = (code, message) => {
45
- return Object.assign(new Error(), { code, message: `[${config_1.default.lib.name}] ${message}` });
46
- };
42
+ const PublicAPI = __importStar(require("./branches/public/index.cjs"));
43
+ const PrivateAPI = __importStar(require("./branches/private/index.cjs"));
47
44
  class DymoAPI {
48
45
  /**
49
46
  * @param {Object} options - Options to create the DymoAPI instance.
@@ -79,7 +76,7 @@ class DymoAPI {
79
76
  headers: {
80
77
  "User-Agent": "DymoAPISDK/1.0.0",
81
78
  "X-Dymo-SDK-Env": "Node",
82
- "X-Dymo-SDK-Version": "1.2.11"
79
+ "X-Dymo-SDK-Version": "1.2.12"
83
80
  }
84
81
  });
85
82
  // We set the authorization in the Axios client to make requests.
@@ -1,11 +1,8 @@
1
1
  import config from "./config/index.js";
2
- import * as PublicAPI from "./branches/public/index.js";
3
- import * as PrivateAPI from "./branches/private/index.js";
4
2
  import axios from "axios";
5
3
  import { validBaseURL } from "./utils/basics.js";
6
- const customError = (code, message) => {
7
- return Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
8
- };
4
+ import * as PublicAPI from "./branches/public/index.js";
5
+ import * as PrivateAPI from "./branches/private/index.js";
9
6
  class DymoAPI {
10
7
  /**
11
8
  * @param {Object} options - Options to create the DymoAPI instance.
@@ -41,7 +38,7 @@ class DymoAPI {
41
38
  headers: {
42
39
  "User-Agent": "DymoAPISDK/1.0.0",
43
40
  "X-Dymo-SDK-Env": "Node",
44
- "X-Dymo-SDK-Version": "1.2.11"
41
+ "X-Dymo-SDK-Version": "1.2.12"
45
42
  }
46
43
  });
47
44
  // We set the authorization in the Axios client to make requests.
@@ -4,15 +4,55 @@ export type VerifyPlugins = "blocklist" | "compromiseDetector" | "mxRecords" | "
4
4
  export type ReputationPlugin = "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
5
5
  export type TyposquattingPlugin = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
6
6
  export interface Validator {
7
+ /**
8
+ * URL to validate. Example: `https://dymo.tpeoficial.com`.
9
+ * Validation includes checking for fraud, free subdomains, custom TLDs, and optional plugins.
10
+ */
7
11
  url?: string;
8
- email?: string;
12
+ /**
13
+ * Email address to validate. Example: `test@tpeoficial.com`.
14
+ * Validation checks format, MX records, proxy usage, personal vs corporate, role accounts, and fraud risk.
15
+ */
16
+ email?: Email;
17
+ /**
18
+ * Phone object to validate, includes country code and number.
19
+ * Validation detects line type, carrier info, country, fraud risk, and optional plugins.
20
+ */
9
21
  phone?: Phone;
22
+ /**
23
+ * Domain name to validate. Example: `tpe.li`.
24
+ * Validation includes checking for fraud, free subdomains, custom TLDs, and optional plugins like blocklist or typosquatting.
25
+ */
10
26
  domain?: string;
27
+ /**
28
+ * Credit card number or object to validate.
29
+ * Checks for fraud, test cards, card type, and optional blocklist or risk score plugins.
30
+ */
11
31
  creditCard?: string | CreditCard;
32
+ /**
33
+ * IP address to validate. Example: `192.168.0.1`.
34
+ * Validation includes type (IPv4/IPv6), class (A-E), geolocation, proxy/hosting detection, fraud, and plugins.
35
+ */
12
36
  ip?: string;
37
+ /**
38
+ * Cryptocurrency wallet address to validate.
39
+ * Checks include fraud detection, wallet type, and optional plugins like risk score or Tor network.
40
+ */
13
41
  wallet?: string;
42
+ /**
43
+ * User-Agent string to validate.
44
+ * Validation detects client type, bot detection, fraud, OS/device info, and optional plugins.
45
+ */
14
46
  userAgent?: string;
47
+ /**
48
+ * IBAN number to validate.
49
+ * Validation checks structure, country, bank info, fraud, and optional plugins like blocklist or risk score.
50
+ */
15
51
  iban?: string;
52
+ /**
53
+ * Optional plugins to extend validation.
54
+ * Available plugins: `"blocklist" | "compromiseDetector" | "mxRecords" | "nsfw" | "reputation" | "riskScore" | "torNetwork" | "typosquatting" | "urlShortener"`.
55
+ */
16
56
  plugins?: VerifyPlugins[];
17
57
  }
18
58
  export type EmailValidator = Email;
@@ -25,188 +65,356 @@ export type EmailValidator = Email;
25
65
  */
26
66
  export type NegativeEmailRules = "FRAUD" | "INVALID" | "NO_MX_RECORDS" | "PROXIED_EMAIL" | "FREE_SUBDOMAIN" | "PERSONAL_EMAIL" | "CORPORATE_EMAIL" | "NO_REPLY_EMAIL" | "ROLE_ACCOUNT" | "NO_REACHABLE" | "HIGH_RISK_SCORE";
27
67
  export type NegativeSensitiveInfoRules = "EMAIL" | "PHONE" | "CREDIT_CARD" | "URL" | "DOMAIN" | "IP" | "WALLET" | "USER_AGENT";
68
+ /**
69
+ * Response returned by the email validator.
70
+ */
28
71
  export type EmailValidatorResponse = {
72
+ /** The validated email address. */
29
73
  email: string;
74
+ /** Whether the email is allowed (not blocked/fraudulent). */
30
75
  allow: boolean;
76
+ /** List of rules indicating why the email may be considered negative. */
31
77
  reasons: NegativeEmailRules[];
78
+ /** Detailed analysis of the email validation result. */
32
79
  response: DataEmailValidationAnalysis;
33
80
  };
81
+ /**
82
+ * Response returned by the sensitive info validator.
83
+ */
34
84
  export type SensitiveInfoResponse = {
85
+ /** Input string being validated (email, phone, etc.). */
35
86
  input: string;
87
+ /** Whether the input is allowed (not blocked/fraudulent). */
36
88
  allow: boolean;
89
+ /** List of rules indicating why the input may be considered negative. */
37
90
  reasons: NegativeSensitiveInfoRules[];
38
91
  };
92
+ /**
93
+ * Detailed analysis of an email validation.
94
+ */
39
95
  interface DataEmailValidationAnalysis {
96
+ /** Whether the email is valid. */
40
97
  valid: boolean;
98
+ /** Whether the email is flagged as fraudulent. */
41
99
  fraud: boolean;
100
+ /** Whether the email is using a proxied email service. */
42
101
  proxiedEmail: boolean;
102
+ /** Whether the email belongs to a free subdomain. */
43
103
  freeSubdomain: boolean;
104
+ /** Whether the email is corporate. */
44
105
  corporate: boolean;
106
+ /** The email being analyzed. */
45
107
  email: string;
108
+ /** The real user associated with the email, if known. */
46
109
  realUser: string;
110
+ /** Suggested correction for typos, if any. */
47
111
  didYouMean: string | null;
112
+ /** Whether the email is a no-reply address. */
48
113
  noReply: boolean;
114
+ /** Whether the email uses a custom TLD. */
49
115
  customTLD: boolean;
116
+ /** Domain part of the email. */
50
117
  domain: string;
118
+ /** Whether the email is a role account (admin, support, etc.). */
51
119
  roleAccount: boolean;
120
+ /** Results from optional validation plugins. */
52
121
  plugins: {
122
+ /** Whether the email is blocked by a blocklist. */
53
123
  blocklist?: boolean;
124
+ /** Whether the email is flagged as a compromise. */
54
125
  compromiseDetector?: boolean;
126
+ /** MX records for the email domain. */
55
127
  mxRecords: MxRecord[];
128
+ /** Whether the email is flagged as NSFW. */
56
129
  nsfw?: boolean;
130
+ /** Reputation plugin results. */
57
131
  reputation?: TyposquattingPlugin;
132
+ /** Risk score for the email. */
58
133
  riskScore?: number;
134
+ /** Whether the email is in a Tor network. */
59
135
  torNetwork?: boolean;
136
+ /** Typosquatting plugin results. */
60
137
  typosquatting?: TyposquattingPlugin;
138
+ /** Whether the email is a URL shortener. */
61
139
  urlShortener?: boolean;
62
140
  };
63
141
  }
64
142
  export interface DataValidationAnalysis {
143
+ /** URL validation result. */
65
144
  url: {
145
+ /** Whether the URL is valid. */
66
146
  valid: boolean;
147
+ /** Whether the URL is fraudulent. */
67
148
  fraud: boolean;
149
+ /** Whether the URL has a free subdomain. */
68
150
  freeSubdomain: boolean;
151
+ /** Whether the URL uses a custom TLD. */
69
152
  customTLD: boolean;
153
+ /** The URL being analyzed. */
70
154
  url: string;
155
+ /** Domain part of the URL. */
71
156
  domain: string;
157
+ /** Results from optional validation plugins. */
72
158
  plugins: {
159
+ /** Whether the URL is blocked by a blocklist. */
73
160
  blocklist?: boolean;
161
+ /** Whether the URL is flagged as a compromise. */
74
162
  compromiseDetector?: boolean;
163
+ /** MX records for the URL domain. */
75
164
  mxRecords: MxRecord[];
165
+ /** Whether the URL is flagged as NSFW. */
76
166
  nsfw?: boolean;
167
+ /** Reputation plugin results. */
77
168
  reputation?: ReputationPlugin;
169
+ /** Risk score for the URL. */
78
170
  riskScore?: number;
171
+ /** Whether the URL is in a Tor network. */
79
172
  torNetwork?: boolean;
173
+ /** Typosquatting plugin results. */
80
174
  typosquatting?: TyposquattingPlugin;
175
+ /** Whether the URL is a URL shortener. */
81
176
  urlShortener?: boolean;
82
177
  };
83
178
  };
179
+ /** Email validation result. */
84
180
  email: DataEmailValidationAnalysis;
181
+ /** Phone validation result. */
85
182
  phone: {
183
+ /** Whether the phone number is valid. */
86
184
  valid: boolean;
185
+ /** Whether the phone number is fraudulent. */
87
186
  fraud: boolean;
187
+ /** The phone number being analyzed. */
88
188
  phone: string;
189
+ /** The country code for the phone number. */
89
190
  prefix: string;
191
+ /** The line type for the phone number. */
90
192
  number: string;
193
+ /** The line type for the phone number. */
91
194
  lineType: "PREMIUM_RATE" | "TOLL_FREE" | "SHARED_COST" | "VOIP" | "PERSONAL_NUMBER" | "PAGER" | "UAN" | "VOICEMAIL" | "FIXED_LINE_OR_MOBILE" | "FIXED_LINE" | "MOBILE" | "Unknown";
195
+ /** The carrier information for the phone number. */
92
196
  carrierInfo: {
197
+ /** The carrier name for the phone number. */
93
198
  carrierName: string;
199
+ /** The accuracy of the carrier information. */
94
200
  accuracy: number;
201
+ /** The carrier country for the phone number. */
95
202
  carrierCountry: string;
203
+ /** The carrier country code for the phone number. */
96
204
  carrierCountryCode: string;
97
205
  };
206
+ /** The country for the phone number. */
98
207
  country: string;
208
+ /** The country code for the phone number. */
99
209
  countryCode: string;
210
+ /** Results from optional validation plugins. */
100
211
  plugins: {
212
+ /** Whether the phone number is blocked by a blocklist. */
101
213
  blocklist?: boolean;
214
+ /** The risk score for the phone number. */
102
215
  riskScore?: number;
103
216
  };
104
217
  };
218
+ /** Domain validation result. */
105
219
  domain: {
220
+ /** Whether the domain is valid. */
106
221
  valid: boolean;
222
+ /** Whether the domain is fraudulent. */
107
223
  fraud: boolean;
224
+ /** Whether the domain has a free subdomain. */
108
225
  freeSubdomain: boolean;
226
+ /** Whether the domain uses a custom TLD. */
109
227
  customTLD: boolean;
228
+ /** The domain being analyzed. */
110
229
  domain: string;
230
+ /** Results from optional validation plugins. */
111
231
  plugins: {
232
+ /** Whether the domain is blocked by a blocklist. */
112
233
  blocklist?: boolean;
234
+ /** Whether the domain is flagged as a compromise. */
113
235
  compromiseDetector?: boolean;
236
+ /** MX records for the domain. */
114
237
  mxRecords: MxRecord[];
238
+ /** Whether the domain is flagged as NSFW. */
115
239
  nsfw?: boolean;
240
+ /** Reputation plugin results. */
116
241
  reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
242
+ /** Risk score for the domain. */
117
243
  riskScore?: number;
244
+ /** Whether the domain is in a Tor network. */
118
245
  torNetwork?: boolean;
246
+ /** Typosquatting plugin results. */
119
247
  typosquatting?: TyposquattingPlugin;
248
+ /** Whether the domain is a URL shortener. */
120
249
  urlShortener?: boolean;
121
250
  };
122
251
  };
252
+ /** Credit card validation result. */
123
253
  creditCard: {
254
+ /** Whether the credit card number is valid. */
124
255
  valid: boolean;
256
+ /** Whether the credit card number is fraudulent. */
125
257
  fraud: boolean;
258
+ /** Whether the credit card number is a test card. */
126
259
  test: boolean;
260
+ /** The type of credit card. */
127
261
  type: string;
262
+ /** The credit card number being analyzed. */
128
263
  creditCard: string;
264
+ /** Results from optional validation plugins. */
129
265
  plugins: {
266
+ /** Whether the credit card number is blocked by a blocklist. */
130
267
  blocklist?: boolean;
268
+ /** The risk score for the credit card number. */
131
269
  riskScore?: number;
132
270
  };
133
271
  };
272
+ /** IP validation result. */
134
273
  ip: {
274
+ /** Whether the IP address is valid. */
135
275
  valid: boolean;
276
+ /** The type of IP address. */
136
277
  type: "IPv4" | "IPv6" | "Invalid";
278
+ /** The IP class for the IP address. */
137
279
  class: "A" | "B" | "C" | "D" | "E" | "Unknown" | "None";
280
+ /** Whether the IP address is fraudulent. */
138
281
  fraud: boolean;
282
+ /** The IP address being analyzed. */
139
283
  ip: string;
284
+ /** The continent for the IP address. */
140
285
  continent: string;
286
+ /** The continent code for the IP address. */
141
287
  continentCode: string;
288
+ /** The country for the IP address. */
142
289
  country: string;
290
+ /** The country code for the IP address. */
143
291
  countryCode: string;
292
+ /** The region code for the IP address. */
144
293
  region: string;
294
+ /** The region name for the IP address. */
145
295
  regionName: string;
296
+ /** The city for the IP address. */
146
297
  city: string;
298
+ /** The district for the IP address. */
147
299
  district: string;
300
+ /** The postal code for the IP address. */
148
301
  zipCode: string;
302
+ /** The latitude for the IP address. */
149
303
  lat: number;
304
+ /** The longitude for the IP address. */
150
305
  lon: number;
306
+ /** The timezone for the IP address. */
151
307
  timezone: string;
308
+ /** The timezone offset for the IP address. */
152
309
  offset: number;
310
+ /** The currency for the IP address. */
153
311
  currency: string;
312
+ /** The ISP for the IP address. */
154
313
  isp: string;
314
+ /** The organization for the IP address. */
155
315
  org: string;
316
+ /** The AS number for the IP address. */
156
317
  as: string;
318
+ /** The AS name for the IP address. */
157
319
  asname: string;
320
+ /** Whether the IP address is a mobile device. */
158
321
  mobile: boolean;
322
+ /** Whether the IP address is a proxy. */
159
323
  proxy: boolean;
324
+ /** Whether the IP address is hosting a website. */
160
325
  hosting: boolean;
326
+ /** Results from optional validation plugins. */
161
327
  plugins: {
328
+ /** Whether the IP address is blocked by a blocklist. */
162
329
  blocklist?: boolean;
330
+ /** The risk score for the IP address. */
163
331
  riskScore?: number;
164
332
  };
165
333
  };
334
+ /** Wallet validation result. */
166
335
  wallet: {
336
+ /** Whether the wallet is valid. */
167
337
  valid: boolean;
338
+ /** Whether the wallet is fraudulent. */
168
339
  fraud: boolean;
340
+ /** The wallet being analyzed. */
169
341
  wallet: string;
342
+ /** The type of wallet. */
170
343
  type: string;
344
+ /** Results from optional validation plugins. */
171
345
  plugins: {
346
+ /** Whether the wallet is blocked by a blocklist. */
172
347
  blocklist?: boolean;
348
+ /** The risk score for the wallet. */
173
349
  riskScore?: number;
350
+ /** Whether the wallet is in a Tor network. */
174
351
  torNetwork?: boolean;
175
352
  };
176
353
  };
354
+ /** User-Agent validation result. */
177
355
  userAgent: {
356
+ /** Whether the User-Agent is valid. */
178
357
  valid: boolean;
358
+ /** The type of User-Agent. */
179
359
  type?: string;
360
+ /** The slug of the User-Agent. */
180
361
  clientSlug?: string | null;
362
+ /** The name of the User-Agent. */
181
363
  clientName?: string;
364
+ /** The version of the User-Agent. */
182
365
  version?: string | null;
366
+ /** The User-Agent being analyzed. */
183
367
  userAgent?: string;
368
+ /** Whether the User-Agent is fraudulent. */
184
369
  fraud?: boolean;
370
+ /** Whether the User-Agent is a bot. */
185
371
  bot?: boolean;
372
+ /** The browser for the User-Agent. */
186
373
  info?: string;
374
+ /** The operating system for the User-Agent. */
187
375
  os?: string;
376
+ /** The device for the User-Agent. */
188
377
  device: {
378
+ /** The type of device. */
189
379
  type?: string;
380
+ /** The brand of the device. */
190
381
  brand?: string;
191
382
  };
383
+ /** Results from optional validation plugins. */
192
384
  plugins?: {
385
+ /** Whether the User-Agent is blocked by a blocklist. */
193
386
  blocklist?: boolean;
387
+ /** The risk score for the User-Agent. */
194
388
  riskScore?: number;
195
389
  };
196
390
  };
391
+ /** IBAN validation result. */
197
392
  iban: {
393
+ /** Whether the IBAN is valid. */
198
394
  valid: boolean;
395
+ /** Whether the IBAN is fraudulent. */
199
396
  fraud?: boolean;
397
+ /** The IBAN being analyzed. */
200
398
  iban?: string;
399
+ /** The BBAN for the IBAN. */
201
400
  bban?: string;
401
+ /** The BIC for the IBAN. */
202
402
  bic?: string | "unknown";
403
+ /** The country for the IBAN. */
203
404
  country?: string;
405
+ /** The country code for the IBAN. */
204
406
  countryCode?: string;
407
+ /** The account number for the IBAN. */
205
408
  accountNumber?: string;
409
+ /** The branch identifier for the IBAN. */
206
410
  branchIdentifier?: string;
411
+ /** The bank identifier for the IBAN. */
207
412
  bankIdentifier?: string;
413
+ /** Results from optional validation plugins. */
208
414
  plugins?: {
415
+ /** Whether the IBAN is blocked by a blocklist. */
209
416
  blocklist?: boolean;
417
+ /** The risk score for the IBAN. */
210
418
  riskScore?: number;
211
419
  };
212
420
  };
@@ -1,18 +1,28 @@
1
1
  export type Email = `${string}@${string}` | string;
2
2
  export type Phone = {
3
+ /** The country code of the phone number. */
3
4
  iso: any;
5
+ /** The phone number. */
4
6
  phone: string;
5
7
  } | string;
6
8
  export interface CreditCard {
9
+ /** The credit card number. */
7
10
  pan: string | number;
11
+ /** The expiration date of the credit card. */
8
12
  expirationDate?: string;
13
+ /** The security code of the credit card. */
9
14
  cvc?: string | number;
15
+ /** The security code of the credit card. */
10
16
  cvv?: string | number;
11
17
  }
12
18
  export interface HTTPRequest {
19
+ /** The URL to make the request to. */
13
20
  url: string;
21
+ /** The HTTP method to use. */
14
22
  method: string | "GET" | "POST" | "PUT" | "DELETE";
23
+ /** The headers to include in the request. */
15
24
  headers?: Record<string, string>;
25
+ /** The body of the request. */
16
26
  body?: string | object | null;
17
27
  [key: string]: any;
18
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",