dymo-api 1.1.5 → 1.1.7
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/cjs/branches/private.cjs +64 -1
- package/dist/cjs/dymo-api.cjs +39 -1
- package/dist/cjs/lib/types/data-verifier.cjs +2 -0
- package/dist/cjs/lib/types/interfaces.cjs +23 -0
- package/dist/cjs/lib/types/primitives.cjs +2 -0
- package/dist/cjs/lib/{interfaces.cjs → types/rules.cjs} +0 -6
- package/dist/esm/branches/private.js +62 -0
- package/dist/esm/dymo-api.js +39 -1
- package/dist/esm/lib/types/data-verifier.js +1 -0
- package/dist/esm/lib/types/interfaces.js +7 -0
- package/dist/esm/lib/types/primitives.js +1 -0
- package/dist/esm/lib/{interfaces.js → types/rules.js} +0 -6
- package/dist/types/branches/private.d.ts +19 -1
- package/dist/types/branches/public.d.ts +1 -1
- package/dist/types/dymo-api.d.ts +23 -2
- package/dist/types/lib/types/data-verifier.d.ts +185 -0
- package/dist/types/lib/types/interfaces.d.ts +169 -0
- package/dist/types/lib/types/primitives.d.ts +11 -0
- package/dist/types/lib/types/rules.d.ts +6 -0
- package/package.json +9 -4
- package/dist/types/lib/interfaces.d.ts +0 -344
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.extractWithTextly = exports.getRandom = exports.sendEmail = exports.isValidData = void 0;
|
|
39
|
+
exports.extractWithTextly = exports.getRandom = exports.sendEmail = exports.isValidEmail = exports.isValidData = void 0;
|
|
40
40
|
const path_1 = __importDefault(require("path"));
|
|
41
41
|
const react_1 = __importDefault(require("react"));
|
|
42
42
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
@@ -81,6 +81,69 @@ const isValidData = async (token, data) => {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
exports.isValidData = isValidData;
|
|
84
|
+
/**
|
|
85
|
+
* Validates an email using a secure verification endpoint.
|
|
86
|
+
*
|
|
87
|
+
* @param {string | null} token - Authentication token (required).
|
|
88
|
+
* @param {Interfaces.EmailValidator} email - Email to validate.
|
|
89
|
+
* @param {Interfaces.EmailValidatorRules} [rules] - Deny rules. Defaults to ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"].
|
|
90
|
+
*
|
|
91
|
+
* Deny rules (some are premium ⚠️):
|
|
92
|
+
* - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
|
|
93
|
+
* "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
|
|
94
|
+
*
|
|
95
|
+
* @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
|
|
96
|
+
* @throws Error if token is null, rules are empty, or request fails.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* const valid = await isValidEmail(apiToken, "user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
100
|
+
*/
|
|
101
|
+
const isValidEmail = async (token, email, rules) => {
|
|
102
|
+
if (token === null)
|
|
103
|
+
throw customError(3000, "Invalid private token.");
|
|
104
|
+
if (rules.deny.length === 0)
|
|
105
|
+
throw customError(1500, "You must provide at least one deny rule.");
|
|
106
|
+
try {
|
|
107
|
+
const responseEmail = (await config_1.axiosApiUrl.post("/private/secure/verify", {
|
|
108
|
+
email,
|
|
109
|
+
plugins: [
|
|
110
|
+
rules.deny.includes("NO_MX_RECORDS") ? "mxRecords" : undefined,
|
|
111
|
+
rules.deny.includes("NO_REACHABLE") ? "reachability" : undefined,
|
|
112
|
+
rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined
|
|
113
|
+
]
|
|
114
|
+
}, { headers: { "Content-Type": "application/json", "Authorization": token } })).data.email;
|
|
115
|
+
if (rules.deny.includes("INVALID") && !responseEmail.valid)
|
|
116
|
+
return false;
|
|
117
|
+
if (rules.deny.includes("FRAUD") && responseEmail.fraud)
|
|
118
|
+
return false;
|
|
119
|
+
if (rules.deny.includes("PROXIED_EMAIL") && responseEmail.proxiedEmail)
|
|
120
|
+
return false;
|
|
121
|
+
if (rules.deny.includes("FREE_SUBDOMAIN") && responseEmail.freeSubdomain)
|
|
122
|
+
return false;
|
|
123
|
+
if (rules.deny.includes("PERSONAL_EMAIL") && !responseEmail.corporate)
|
|
124
|
+
return false;
|
|
125
|
+
if (rules.deny.includes("CORPORATE_EMAIL") && responseEmail.corporate)
|
|
126
|
+
return false;
|
|
127
|
+
if (rules.deny.includes("NO_MX_RECORDS") && responseEmail.plugins.mxRecords.length === 0)
|
|
128
|
+
return false;
|
|
129
|
+
if (rules.deny.includes("NO_REPLY_EMAIL") && responseEmail.noReply)
|
|
130
|
+
return false;
|
|
131
|
+
if (rules.deny.includes("ROLE_ACCOUNT") && responseEmail.plugins.roleAccount)
|
|
132
|
+
return false;
|
|
133
|
+
if (rules.deny.includes("NO_REACHABLE") && !responseEmail.plugins.reachable)
|
|
134
|
+
return false;
|
|
135
|
+
if (rules.deny.includes("HIGH_RISK_SCORE") && responseEmail.plugins.riskScore >= 80)
|
|
136
|
+
return false;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
const statusCode = error.response?.status || 500;
|
|
141
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
142
|
+
const errorDetails = JSON.stringify(error.response?.data || {});
|
|
143
|
+
throw customError(5000, `Error ${statusCode}: ${errorMessage}. Details: ${errorDetails}`);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
exports.isValidEmail = isValidEmail;
|
|
84
147
|
/**
|
|
85
148
|
* Sends an email using a secure sending endpoint.
|
|
86
149
|
*
|
package/dist/cjs/dymo-api.cjs
CHANGED
|
@@ -57,13 +57,21 @@ class DymoAPI {
|
|
|
57
57
|
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
58
58
|
* });
|
|
59
59
|
*/
|
|
60
|
-
constructor({ rootApiKey = null, apiKey = null, baseUrl = "https://api.tpeoficial.com", serverEmailConfig = undefined
|
|
60
|
+
constructor({ rootApiKey = null, apiKey = null, baseUrl = "https://api.tpeoficial.com", serverEmailConfig = undefined, rules = {
|
|
61
|
+
email: {
|
|
62
|
+
deny: [
|
|
63
|
+
"FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
} } = {}) {
|
|
61
67
|
this.rootApiKey = rootApiKey;
|
|
62
68
|
this.apiKey = apiKey;
|
|
63
69
|
this.serverEmailConfig = serverEmailConfig;
|
|
70
|
+
this.rules = rules;
|
|
64
71
|
this.baseUrl = baseUrl;
|
|
65
72
|
(0, config_1.setBaseUrl)(baseUrl);
|
|
66
73
|
}
|
|
74
|
+
;
|
|
67
75
|
// FUNCTIONS / Private.
|
|
68
76
|
/**
|
|
69
77
|
* Validates the given data against the configured validation settings.
|
|
@@ -89,6 +97,29 @@ class DymoAPI {
|
|
|
89
97
|
async isValidData(data) {
|
|
90
98
|
return await PrivateAPI.isValidData(this.rootApiKey || this.apiKey, data);
|
|
91
99
|
}
|
|
100
|
+
;
|
|
101
|
+
/**
|
|
102
|
+
* Validates the given email against the configured rules.
|
|
103
|
+
*
|
|
104
|
+
* This method requires either the root API key or the API key to be set.
|
|
105
|
+
* If neither is set, it will throw an error.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} [email] - Optional email address to validate.
|
|
108
|
+
* @param {NegativeEmailRules[]} [rules] - Optional rules for validation. Some rules are premium features.
|
|
109
|
+
* @important
|
|
110
|
+
* **⚠️ NO_MX_RECORDS, HIGH_RISK_SCORE and NO_REACHABLE are [PREMIUM](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier) features.**
|
|
111
|
+
* @returns {Promise<Interfaces.EmailValidatorResponse>} Resolves with the validation response.
|
|
112
|
+
* @throws Will throw an error if validation cannot be performed.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const valid = await dymoClient.isValidEmail("user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
116
|
+
*
|
|
117
|
+
* @see [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
118
|
+
*/
|
|
119
|
+
async isValidEmail(email, rules = this.rules.email) {
|
|
120
|
+
return await PrivateAPI.isValidEmail(this.rootApiKey || this.apiKey, email, rules);
|
|
121
|
+
}
|
|
122
|
+
;
|
|
92
123
|
/**
|
|
93
124
|
* Sends an email using the configured email client settings.
|
|
94
125
|
*
|
|
@@ -120,6 +151,7 @@ class DymoAPI {
|
|
|
120
151
|
console.error(`[${config_1.default.lib.name}] You must configure the email client settings.`);
|
|
121
152
|
return await PrivateAPI.sendEmail(this.rootApiKey || this.apiKey, { serverEmailConfig: this.serverEmailConfig, ...data });
|
|
122
153
|
}
|
|
154
|
+
;
|
|
123
155
|
/**
|
|
124
156
|
* Generates a random number between the provided min and max values.
|
|
125
157
|
*
|
|
@@ -138,6 +170,7 @@ class DymoAPI {
|
|
|
138
170
|
async getRandom(data) {
|
|
139
171
|
return await PrivateAPI.getRandom(this.rootApiKey || this.apiKey, data);
|
|
140
172
|
}
|
|
173
|
+
;
|
|
141
174
|
/**
|
|
142
175
|
* Extracts structured data from a given string using Textly.
|
|
143
176
|
*
|
|
@@ -153,6 +186,7 @@ class DymoAPI {
|
|
|
153
186
|
async extractWithTextly(data) {
|
|
154
187
|
return await PrivateAPI.extractWithTextly(this.rootApiKey || this.apiKey, data);
|
|
155
188
|
}
|
|
189
|
+
;
|
|
156
190
|
// FUNCTIONS / Public.
|
|
157
191
|
/**
|
|
158
192
|
* Retrieves the prayer times for the given location.
|
|
@@ -171,6 +205,7 @@ class DymoAPI {
|
|
|
171
205
|
async getPrayerTimes(data) {
|
|
172
206
|
return await PublicAPI.getPrayerTimes(data);
|
|
173
207
|
}
|
|
208
|
+
;
|
|
174
209
|
/**
|
|
175
210
|
* Satinizes the input, replacing any special characters with their HTML
|
|
176
211
|
* entities.
|
|
@@ -185,6 +220,7 @@ class DymoAPI {
|
|
|
185
220
|
async satinizer(data) {
|
|
186
221
|
return await PublicAPI.satinizer(data);
|
|
187
222
|
}
|
|
223
|
+
;
|
|
188
224
|
/**
|
|
189
225
|
* Validates a password based on the given parameters.
|
|
190
226
|
*
|
|
@@ -213,5 +249,7 @@ class DymoAPI {
|
|
|
213
249
|
async isValidPwd(data) {
|
|
214
250
|
return await PublicAPI.isValidPwd(data);
|
|
215
251
|
}
|
|
252
|
+
;
|
|
216
253
|
}
|
|
254
|
+
;
|
|
217
255
|
exports.default = DymoAPI;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
;
|
|
18
|
+
;
|
|
19
|
+
;
|
|
20
|
+
;
|
|
21
|
+
;
|
|
22
|
+
__exportStar(require("./rules.cjs"), exports);
|
|
23
|
+
__exportStar(require("./data-verifier.cjs"), exports);
|
|
@@ -41,6 +41,68 @@ export const isValidData = async (token, data) => {
|
|
|
41
41
|
throw customError(5000, `Error ${statusCode}: ${errorMessage}. Details: ${errorDetails}`);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Validates an email using a secure verification endpoint.
|
|
46
|
+
*
|
|
47
|
+
* @param {string | null} token - Authentication token (required).
|
|
48
|
+
* @param {Interfaces.EmailValidator} email - Email to validate.
|
|
49
|
+
* @param {Interfaces.EmailValidatorRules} [rules] - Deny rules. Defaults to ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"].
|
|
50
|
+
*
|
|
51
|
+
* Deny rules (some are premium ⚠️):
|
|
52
|
+
* - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
|
|
53
|
+
* "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
|
|
54
|
+
*
|
|
55
|
+
* @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
|
|
56
|
+
* @throws Error if token is null, rules are empty, or request fails.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* const valid = await isValidEmail(apiToken, "user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
60
|
+
*/
|
|
61
|
+
export const isValidEmail = async (token, email, rules) => {
|
|
62
|
+
if (token === null)
|
|
63
|
+
throw customError(3000, "Invalid private token.");
|
|
64
|
+
if (rules.deny.length === 0)
|
|
65
|
+
throw customError(1500, "You must provide at least one deny rule.");
|
|
66
|
+
try {
|
|
67
|
+
const responseEmail = (await axiosApiUrl.post("/private/secure/verify", {
|
|
68
|
+
email,
|
|
69
|
+
plugins: [
|
|
70
|
+
rules.deny.includes("NO_MX_RECORDS") ? "mxRecords" : undefined,
|
|
71
|
+
rules.deny.includes("NO_REACHABLE") ? "reachability" : undefined,
|
|
72
|
+
rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined
|
|
73
|
+
]
|
|
74
|
+
}, { headers: { "Content-Type": "application/json", "Authorization": token } })).data.email;
|
|
75
|
+
if (rules.deny.includes("INVALID") && !responseEmail.valid)
|
|
76
|
+
return false;
|
|
77
|
+
if (rules.deny.includes("FRAUD") && responseEmail.fraud)
|
|
78
|
+
return false;
|
|
79
|
+
if (rules.deny.includes("PROXIED_EMAIL") && responseEmail.proxiedEmail)
|
|
80
|
+
return false;
|
|
81
|
+
if (rules.deny.includes("FREE_SUBDOMAIN") && responseEmail.freeSubdomain)
|
|
82
|
+
return false;
|
|
83
|
+
if (rules.deny.includes("PERSONAL_EMAIL") && !responseEmail.corporate)
|
|
84
|
+
return false;
|
|
85
|
+
if (rules.deny.includes("CORPORATE_EMAIL") && responseEmail.corporate)
|
|
86
|
+
return false;
|
|
87
|
+
if (rules.deny.includes("NO_MX_RECORDS") && responseEmail.plugins.mxRecords.length === 0)
|
|
88
|
+
return false;
|
|
89
|
+
if (rules.deny.includes("NO_REPLY_EMAIL") && responseEmail.noReply)
|
|
90
|
+
return false;
|
|
91
|
+
if (rules.deny.includes("ROLE_ACCOUNT") && responseEmail.plugins.roleAccount)
|
|
92
|
+
return false;
|
|
93
|
+
if (rules.deny.includes("NO_REACHABLE") && !responseEmail.plugins.reachable)
|
|
94
|
+
return false;
|
|
95
|
+
if (rules.deny.includes("HIGH_RISK_SCORE") && responseEmail.plugins.riskScore >= 80)
|
|
96
|
+
return false;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const statusCode = error.response?.status || 500;
|
|
101
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
102
|
+
const errorDetails = JSON.stringify(error.response?.data || {});
|
|
103
|
+
throw customError(5000, `Error ${statusCode}: ${errorMessage}. Details: ${errorDetails}`);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
44
106
|
/**
|
|
45
107
|
* Sends an email using a secure sending endpoint.
|
|
46
108
|
*
|
package/dist/esm/dymo-api.js
CHANGED
|
@@ -22,13 +22,21 @@ class DymoAPI {
|
|
|
22
22
|
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
23
23
|
* });
|
|
24
24
|
*/
|
|
25
|
-
constructor({ rootApiKey = null, apiKey = null, baseUrl = "https://api.tpeoficial.com", serverEmailConfig = undefined
|
|
25
|
+
constructor({ rootApiKey = null, apiKey = null, baseUrl = "https://api.tpeoficial.com", serverEmailConfig = undefined, rules = {
|
|
26
|
+
email: {
|
|
27
|
+
deny: [
|
|
28
|
+
"FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
} } = {}) {
|
|
26
32
|
this.rootApiKey = rootApiKey;
|
|
27
33
|
this.apiKey = apiKey;
|
|
28
34
|
this.serverEmailConfig = serverEmailConfig;
|
|
35
|
+
this.rules = rules;
|
|
29
36
|
this.baseUrl = baseUrl;
|
|
30
37
|
setBaseUrl(baseUrl);
|
|
31
38
|
}
|
|
39
|
+
;
|
|
32
40
|
// FUNCTIONS / Private.
|
|
33
41
|
/**
|
|
34
42
|
* Validates the given data against the configured validation settings.
|
|
@@ -54,6 +62,29 @@ class DymoAPI {
|
|
|
54
62
|
async isValidData(data) {
|
|
55
63
|
return await PrivateAPI.isValidData(this.rootApiKey || this.apiKey, data);
|
|
56
64
|
}
|
|
65
|
+
;
|
|
66
|
+
/**
|
|
67
|
+
* Validates the given email against the configured rules.
|
|
68
|
+
*
|
|
69
|
+
* This method requires either the root API key or the API key to be set.
|
|
70
|
+
* If neither is set, it will throw an error.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} [email] - Optional email address to validate.
|
|
73
|
+
* @param {NegativeEmailRules[]} [rules] - Optional rules for validation. Some rules are premium features.
|
|
74
|
+
* @important
|
|
75
|
+
* **⚠️ NO_MX_RECORDS, HIGH_RISK_SCORE and NO_REACHABLE are [PREMIUM](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier) features.**
|
|
76
|
+
* @returns {Promise<Interfaces.EmailValidatorResponse>} Resolves with the validation response.
|
|
77
|
+
* @throws Will throw an error if validation cannot be performed.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* const valid = await dymoClient.isValidEmail("user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
81
|
+
*
|
|
82
|
+
* @see [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
83
|
+
*/
|
|
84
|
+
async isValidEmail(email, rules = this.rules.email) {
|
|
85
|
+
return await PrivateAPI.isValidEmail(this.rootApiKey || this.apiKey, email, rules);
|
|
86
|
+
}
|
|
87
|
+
;
|
|
57
88
|
/**
|
|
58
89
|
* Sends an email using the configured email client settings.
|
|
59
90
|
*
|
|
@@ -85,6 +116,7 @@ class DymoAPI {
|
|
|
85
116
|
console.error(`[${config.lib.name}] You must configure the email client settings.`);
|
|
86
117
|
return await PrivateAPI.sendEmail(this.rootApiKey || this.apiKey, { serverEmailConfig: this.serverEmailConfig, ...data });
|
|
87
118
|
}
|
|
119
|
+
;
|
|
88
120
|
/**
|
|
89
121
|
* Generates a random number between the provided min and max values.
|
|
90
122
|
*
|
|
@@ -103,6 +135,7 @@ class DymoAPI {
|
|
|
103
135
|
async getRandom(data) {
|
|
104
136
|
return await PrivateAPI.getRandom(this.rootApiKey || this.apiKey, data);
|
|
105
137
|
}
|
|
138
|
+
;
|
|
106
139
|
/**
|
|
107
140
|
* Extracts structured data from a given string using Textly.
|
|
108
141
|
*
|
|
@@ -118,6 +151,7 @@ class DymoAPI {
|
|
|
118
151
|
async extractWithTextly(data) {
|
|
119
152
|
return await PrivateAPI.extractWithTextly(this.rootApiKey || this.apiKey, data);
|
|
120
153
|
}
|
|
154
|
+
;
|
|
121
155
|
// FUNCTIONS / Public.
|
|
122
156
|
/**
|
|
123
157
|
* Retrieves the prayer times for the given location.
|
|
@@ -136,6 +170,7 @@ class DymoAPI {
|
|
|
136
170
|
async getPrayerTimes(data) {
|
|
137
171
|
return await PublicAPI.getPrayerTimes(data);
|
|
138
172
|
}
|
|
173
|
+
;
|
|
139
174
|
/**
|
|
140
175
|
* Satinizes the input, replacing any special characters with their HTML
|
|
141
176
|
* entities.
|
|
@@ -150,6 +185,7 @@ class DymoAPI {
|
|
|
150
185
|
async satinizer(data) {
|
|
151
186
|
return await PublicAPI.satinizer(data);
|
|
152
187
|
}
|
|
188
|
+
;
|
|
153
189
|
/**
|
|
154
190
|
* Validates a password based on the given parameters.
|
|
155
191
|
*
|
|
@@ -178,5 +214,7 @@ class DymoAPI {
|
|
|
178
214
|
async isValidPwd(data) {
|
|
179
215
|
return await PublicAPI.isValidPwd(data);
|
|
180
216
|
}
|
|
217
|
+
;
|
|
181
218
|
}
|
|
219
|
+
;
|
|
182
220
|
export default DymoAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Interfaces from "../lib/interfaces";
|
|
1
|
+
import * as Interfaces from "../lib/types/interfaces";
|
|
2
2
|
/**
|
|
3
3
|
* Validates the provided data using a secure verification endpoint.
|
|
4
4
|
*
|
|
@@ -12,6 +12,24 @@ import * as Interfaces from "../lib/interfaces";
|
|
|
12
12
|
* or if an error occurs during the verification request.
|
|
13
13
|
*/
|
|
14
14
|
export declare const isValidData: (token: string | null, data: Interfaces.Validator) => Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Validates an email using a secure verification endpoint.
|
|
17
|
+
*
|
|
18
|
+
* @param {string | null} token - Authentication token (required).
|
|
19
|
+
* @param {Interfaces.EmailValidator} email - Email to validate.
|
|
20
|
+
* @param {Interfaces.EmailValidatorRules} [rules] - Deny rules. Defaults to ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"].
|
|
21
|
+
*
|
|
22
|
+
* Deny rules (some are premium ⚠️):
|
|
23
|
+
* - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
|
|
24
|
+
* "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
|
|
27
|
+
* @throws Error if token is null, rules are empty, or request fails.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const valid = await isValidEmail(apiToken, "user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
31
|
+
*/
|
|
32
|
+
export declare const isValidEmail: (token: string | null, email: Interfaces.EmailValidator, rules: Interfaces.EmailValidatorRules) => Promise<any>;
|
|
15
33
|
/**
|
|
16
34
|
* Sends an email using a secure sending endpoint.
|
|
17
35
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Interfaces from "../lib/interfaces";
|
|
1
|
+
import * as Interfaces from "../lib/types/interfaces";
|
|
2
2
|
export declare const getPrayerTimes: (data: Interfaces.PrayerTimesData) => Promise<any>;
|
|
3
3
|
export declare const satinizer: (data: Interfaces.InputSatinizerData) => Promise<any>;
|
|
4
4
|
export declare const isValidPwd: (data: Interfaces.IsValidPwdData) => Promise<any>;
|
package/dist/types/dymo-api.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as Interfaces from "./lib/interfaces";
|
|
1
|
+
import * as Interfaces from "./lib/types/interfaces";
|
|
2
2
|
declare class DymoAPI {
|
|
3
3
|
private rootApiKey;
|
|
4
4
|
private apiKey;
|
|
5
5
|
private serverEmailConfig?;
|
|
6
|
+
private rules;
|
|
6
7
|
private baseUrl;
|
|
7
8
|
/**
|
|
8
9
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
@@ -21,11 +22,12 @@ declare class DymoAPI {
|
|
|
21
22
|
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
22
23
|
* });
|
|
23
24
|
*/
|
|
24
|
-
constructor({ rootApiKey, apiKey, baseUrl, serverEmailConfig }?: {
|
|
25
|
+
constructor({ rootApiKey, apiKey, baseUrl, serverEmailConfig, rules }?: {
|
|
25
26
|
rootApiKey?: string | null;
|
|
26
27
|
apiKey?: string | null;
|
|
27
28
|
baseUrl?: string;
|
|
28
29
|
serverEmailConfig?: Interfaces.ServerEmailConfig;
|
|
30
|
+
rules?: Interfaces.Rules;
|
|
29
31
|
});
|
|
30
32
|
/**
|
|
31
33
|
* Validates the given data against the configured validation settings.
|
|
@@ -49,6 +51,25 @@ declare class DymoAPI {
|
|
|
49
51
|
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
50
52
|
*/
|
|
51
53
|
isValidData(data: Interfaces.Validator): Promise<Interfaces.DataValidationAnalysis>;
|
|
54
|
+
/**
|
|
55
|
+
* Validates the given email against the configured rules.
|
|
56
|
+
*
|
|
57
|
+
* This method requires either the root API key or the API key to be set.
|
|
58
|
+
* If neither is set, it will throw an error.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} [email] - Optional email address to validate.
|
|
61
|
+
* @param {NegativeEmailRules[]} [rules] - Optional rules for validation. Some rules are premium features.
|
|
62
|
+
* @important
|
|
63
|
+
* **⚠️ NO_MX_RECORDS, HIGH_RISK_SCORE and NO_REACHABLE are [PREMIUM](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier) features.**
|
|
64
|
+
* @returns {Promise<Interfaces.EmailValidatorResponse>} Resolves with the validation response.
|
|
65
|
+
* @throws Will throw an error if validation cannot be performed.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* const valid = await dymoClient.isValidEmail("user@example.com", { deny: ["FRAUD", "NO_MX_RECORDS"] });
|
|
69
|
+
*
|
|
70
|
+
* @see [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
71
|
+
*/
|
|
72
|
+
isValidEmail(email: Interfaces.EmailValidator, rules?: Interfaces.EmailValidatorRules): Promise<Interfaces.EmailValidatorResponse>;
|
|
52
73
|
/**
|
|
53
74
|
* Sends an email using the configured email client settings.
|
|
54
75
|
*
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { MxRecord } from "dns";
|
|
2
|
+
import { Email, Phone, CreditCard } from "./primitives";
|
|
3
|
+
export type VerifyPlugins = "blocklist" | "compromiseDetector" | "mxRecords" | "nsfw" | "reputation" | "riskScore" | "torNetwork" | "typosquatting" | "urlShortener";
|
|
4
|
+
export type ReputationPlugin = "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
|
|
5
|
+
export type TyposquattingPlugin = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
6
|
+
export interface Validator {
|
|
7
|
+
url?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
phone?: Phone;
|
|
10
|
+
domain?: string;
|
|
11
|
+
creditCard?: string | CreditCard;
|
|
12
|
+
ip?: string;
|
|
13
|
+
wallet?: string;
|
|
14
|
+
userAgent?: string;
|
|
15
|
+
plugins?: VerifyPlugins[];
|
|
16
|
+
}
|
|
17
|
+
export type EmailValidator = Email;
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {"FRAUD"|"INVALID"|"NO_MX_RECORDS"|"PROXIED_EMAIL"|"FREE_SUBDOMAIN"|"PERSONAL"|"CORPORATE"|"NO_REPLY"|"ROLE_ACCOUNT"|"REACHABLE"|"HIGH_RISK_SCORE"} NegativeEmailRules
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* Values indicating why an email is considered negative.
|
|
23
|
+
* ⚠️ NO_MX_RECORDS, PROXIED_EMAIL, FREE_SUBDOMAIN, CORPORATE, and HIGH_RISK_SCORE are premium features.
|
|
24
|
+
*/
|
|
25
|
+
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";
|
|
26
|
+
export interface EmailValidatorRules {
|
|
27
|
+
deny: NegativeEmailRules[];
|
|
28
|
+
}
|
|
29
|
+
export type EmailValidatorResponse = boolean;
|
|
30
|
+
export interface DataValidationAnalysis {
|
|
31
|
+
url: {
|
|
32
|
+
valid: boolean;
|
|
33
|
+
fraud: boolean;
|
|
34
|
+
freeSubdomain: boolean;
|
|
35
|
+
customTLD: boolean;
|
|
36
|
+
url: string;
|
|
37
|
+
domain: string;
|
|
38
|
+
plugins: {
|
|
39
|
+
blocklist?: boolean;
|
|
40
|
+
compromiseDetector?: boolean;
|
|
41
|
+
mxRecords: MxRecord[];
|
|
42
|
+
nsfw?: boolean;
|
|
43
|
+
reputation?: ReputationPlugin;
|
|
44
|
+
riskScore?: number;
|
|
45
|
+
torNetwork?: boolean;
|
|
46
|
+
typosquatting?: TyposquattingPlugin;
|
|
47
|
+
urlShortener?: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
email: {
|
|
51
|
+
valid: boolean;
|
|
52
|
+
fraud: boolean;
|
|
53
|
+
proxiedEmail: boolean;
|
|
54
|
+
freeSubdomain: boolean;
|
|
55
|
+
corporate: boolean;
|
|
56
|
+
email: string;
|
|
57
|
+
realUser: string;
|
|
58
|
+
didYouMean: string | null;
|
|
59
|
+
noReply: boolean;
|
|
60
|
+
customTLD: boolean;
|
|
61
|
+
domain: string;
|
|
62
|
+
roleAccount: boolean;
|
|
63
|
+
plugins: {
|
|
64
|
+
blocklist?: boolean;
|
|
65
|
+
compromiseDetector?: boolean;
|
|
66
|
+
nsfw?: boolean;
|
|
67
|
+
reputation?: TyposquattingPlugin;
|
|
68
|
+
riskScore?: number;
|
|
69
|
+
torNetwork?: boolean;
|
|
70
|
+
typosquatting?: TyposquattingPlugin;
|
|
71
|
+
urlShortener?: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
phone: {
|
|
75
|
+
valid: boolean;
|
|
76
|
+
fraud: boolean;
|
|
77
|
+
phone: string;
|
|
78
|
+
prefix: string;
|
|
79
|
+
number: string;
|
|
80
|
+
lineType: "PREMIUM_RATE" | "TOLL_FREE" | "SHARED_COST" | "VOIP" | "PERSONAL_NUMBER" | "PAGER" | "UAN" | "VOICEMAIL" | "FIXED_LINE_OR_MOBILE" | "FIXED_LINE" | "MOBILE" | "Unknown";
|
|
81
|
+
carrierInfo: {
|
|
82
|
+
carrierName: string;
|
|
83
|
+
accuracy: number;
|
|
84
|
+
carrierCountry: string;
|
|
85
|
+
carrierCountryCode: string;
|
|
86
|
+
};
|
|
87
|
+
country: string;
|
|
88
|
+
countryCode: string;
|
|
89
|
+
plugins: {
|
|
90
|
+
blocklist?: boolean;
|
|
91
|
+
riskScore?: number;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
domain: {
|
|
95
|
+
valid: boolean;
|
|
96
|
+
fraud: boolean;
|
|
97
|
+
freeSubdomain: boolean;
|
|
98
|
+
customTLD: boolean;
|
|
99
|
+
domain: string;
|
|
100
|
+
plugins: {
|
|
101
|
+
blocklist?: boolean;
|
|
102
|
+
compromiseDetector?: boolean;
|
|
103
|
+
nsfw?: boolean;
|
|
104
|
+
reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
|
|
105
|
+
riskScore?: number;
|
|
106
|
+
torNetwork?: boolean;
|
|
107
|
+
typosquatting?: TyposquattingPlugin;
|
|
108
|
+
urlShortener?: boolean;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
creditCard: {
|
|
112
|
+
valid: boolean;
|
|
113
|
+
fraud: boolean;
|
|
114
|
+
test: boolean;
|
|
115
|
+
type: string;
|
|
116
|
+
creditCard: string;
|
|
117
|
+
plugins: {
|
|
118
|
+
blocklist?: boolean;
|
|
119
|
+
riskScore?: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
ip: {
|
|
123
|
+
valid: boolean;
|
|
124
|
+
type: "IPv4" | "IPv6" | "Invalid";
|
|
125
|
+
class: "A" | "B" | "C" | "D" | "E" | "Unknown" | "None";
|
|
126
|
+
fraud: boolean;
|
|
127
|
+
ip: string;
|
|
128
|
+
continent: string;
|
|
129
|
+
continentCode: string;
|
|
130
|
+
country: string;
|
|
131
|
+
countryCode: string;
|
|
132
|
+
region: string;
|
|
133
|
+
regionName: string;
|
|
134
|
+
city: string;
|
|
135
|
+
district: string;
|
|
136
|
+
zipCode: string;
|
|
137
|
+
lat: number;
|
|
138
|
+
lon: number;
|
|
139
|
+
timezone: string;
|
|
140
|
+
offset: number;
|
|
141
|
+
currency: string;
|
|
142
|
+
isp: string;
|
|
143
|
+
org: string;
|
|
144
|
+
as: string;
|
|
145
|
+
asname: string;
|
|
146
|
+
mobile: boolean;
|
|
147
|
+
proxy: boolean;
|
|
148
|
+
hosting: boolean;
|
|
149
|
+
plugins: {
|
|
150
|
+
blocklist?: boolean;
|
|
151
|
+
riskScore?: number;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
wallet: {
|
|
155
|
+
valid: boolean;
|
|
156
|
+
fraud: boolean;
|
|
157
|
+
wallet: string;
|
|
158
|
+
type: string;
|
|
159
|
+
plugins: {
|
|
160
|
+
blocklist?: boolean;
|
|
161
|
+
riskScore?: number;
|
|
162
|
+
torNetwork?: boolean;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
userAgent: {
|
|
166
|
+
valid: boolean;
|
|
167
|
+
type?: string;
|
|
168
|
+
clientSlug?: string | null;
|
|
169
|
+
clientName?: string;
|
|
170
|
+
version?: string | null;
|
|
171
|
+
userAgent?: string;
|
|
172
|
+
fraud?: boolean;
|
|
173
|
+
bot?: boolean;
|
|
174
|
+
info?: string;
|
|
175
|
+
os?: string;
|
|
176
|
+
device: {
|
|
177
|
+
type?: string;
|
|
178
|
+
brand?: string;
|
|
179
|
+
};
|
|
180
|
+
plugins?: {
|
|
181
|
+
blocklist?: boolean;
|
|
182
|
+
riskScore?: number;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export interface SRNG {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
quantity?: number;
|
|
6
|
+
}
|
|
7
|
+
export type Attachment = {
|
|
8
|
+
filename: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
content?: string | Buffer;
|
|
11
|
+
cid?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface ServerEmailConfig {
|
|
14
|
+
host: string;
|
|
15
|
+
port: number;
|
|
16
|
+
secure: boolean;
|
|
17
|
+
auth: {
|
|
18
|
+
user: string;
|
|
19
|
+
pass: string;
|
|
20
|
+
};
|
|
21
|
+
dkim?: {
|
|
22
|
+
domainName: string;
|
|
23
|
+
keySelector: string;
|
|
24
|
+
privateKey: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export type SendEmail = {
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
subject: string;
|
|
31
|
+
attachments?: Attachment[];
|
|
32
|
+
options?: {
|
|
33
|
+
priority?: "high" | "normal" | "low";
|
|
34
|
+
composeTailwindClasses?: boolean;
|
|
35
|
+
compileToCssSafe?: boolean;
|
|
36
|
+
onlyVerifiedEmails?: boolean;
|
|
37
|
+
};
|
|
38
|
+
} & ({
|
|
39
|
+
html: string;
|
|
40
|
+
react?: never;
|
|
41
|
+
} | {
|
|
42
|
+
react: React.ReactNode;
|
|
43
|
+
html?: never;
|
|
44
|
+
});
|
|
45
|
+
export interface PrayerTimesData {
|
|
46
|
+
lat?: number;
|
|
47
|
+
lon?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface InputSatinizerData {
|
|
50
|
+
input?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface IsValidPwdData {
|
|
53
|
+
email?: string;
|
|
54
|
+
password?: string;
|
|
55
|
+
bannedWords?: string | string[];
|
|
56
|
+
min?: number;
|
|
57
|
+
max?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface SRNComponent {
|
|
60
|
+
integer: number;
|
|
61
|
+
float: number;
|
|
62
|
+
}
|
|
63
|
+
export interface SRNSummary {
|
|
64
|
+
values: SRNComponent[];
|
|
65
|
+
executionTime: number;
|
|
66
|
+
}
|
|
67
|
+
export interface CountryPrayerTimes {
|
|
68
|
+
country: string;
|
|
69
|
+
prayerTimesByTimezone: {
|
|
70
|
+
timezone: string;
|
|
71
|
+
prayerTimes: {
|
|
72
|
+
coordinates: string;
|
|
73
|
+
date: string;
|
|
74
|
+
calculationParameters: string;
|
|
75
|
+
fajr: string;
|
|
76
|
+
sunrise: string;
|
|
77
|
+
dhuhr: string;
|
|
78
|
+
asr: string;
|
|
79
|
+
sunset: string;
|
|
80
|
+
maghrib: string;
|
|
81
|
+
isha: string;
|
|
82
|
+
};
|
|
83
|
+
}[];
|
|
84
|
+
}
|
|
85
|
+
export interface SatinizedInputAnalysis {
|
|
86
|
+
input: string;
|
|
87
|
+
formats: {
|
|
88
|
+
ascii: boolean;
|
|
89
|
+
bitcoinAddress: boolean;
|
|
90
|
+
cLikeIdentifier: boolean;
|
|
91
|
+
coordinates: boolean;
|
|
92
|
+
crediCard: boolean;
|
|
93
|
+
date: boolean;
|
|
94
|
+
discordUsername: boolean;
|
|
95
|
+
doi: boolean;
|
|
96
|
+
domain: boolean;
|
|
97
|
+
e164Phone: boolean;
|
|
98
|
+
email: boolean;
|
|
99
|
+
emoji: boolean;
|
|
100
|
+
hanUnification: boolean;
|
|
101
|
+
hashtag: boolean;
|
|
102
|
+
hyphenWordBreak: boolean;
|
|
103
|
+
ipv6: boolean;
|
|
104
|
+
ip: boolean;
|
|
105
|
+
jiraTicket: boolean;
|
|
106
|
+
macAddress: boolean;
|
|
107
|
+
name: boolean;
|
|
108
|
+
number: boolean;
|
|
109
|
+
panFromGstin: boolean;
|
|
110
|
+
password: boolean;
|
|
111
|
+
port: boolean;
|
|
112
|
+
tel: boolean;
|
|
113
|
+
text: boolean;
|
|
114
|
+
semver: boolean;
|
|
115
|
+
ssn: boolean;
|
|
116
|
+
uuid: boolean;
|
|
117
|
+
url: boolean;
|
|
118
|
+
urlSlug: boolean;
|
|
119
|
+
username: boolean;
|
|
120
|
+
};
|
|
121
|
+
includes: {
|
|
122
|
+
spaces: boolean;
|
|
123
|
+
hasSql: boolean;
|
|
124
|
+
hasNoSql: boolean;
|
|
125
|
+
letters: boolean;
|
|
126
|
+
uppercase: boolean;
|
|
127
|
+
lowercase: boolean;
|
|
128
|
+
symbols: boolean;
|
|
129
|
+
digits: boolean;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export interface EmailStatus {
|
|
133
|
+
status: boolean;
|
|
134
|
+
error?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface ValidationDetail {
|
|
137
|
+
validation: string;
|
|
138
|
+
message: string;
|
|
139
|
+
word?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface PasswordValidationResult {
|
|
142
|
+
valid: boolean;
|
|
143
|
+
password: string;
|
|
144
|
+
details: ValidationDetail[];
|
|
145
|
+
}
|
|
146
|
+
export type SchemaType = "string" | "number" | "boolean" | "array" | "object";
|
|
147
|
+
export interface JsonSchemaProperty {
|
|
148
|
+
type: SchemaType;
|
|
149
|
+
items?: JsonSchemaProperty;
|
|
150
|
+
properties?: Record<string, JsonSchemaProperty>;
|
|
151
|
+
required?: string[];
|
|
152
|
+
description?: string;
|
|
153
|
+
format?: string;
|
|
154
|
+
enum?: unknown[];
|
|
155
|
+
minimum?: number;
|
|
156
|
+
maximum?: number;
|
|
157
|
+
minLength?: number;
|
|
158
|
+
maxLength?: number;
|
|
159
|
+
pattern?: string;
|
|
160
|
+
[key: string]: unknown;
|
|
161
|
+
}
|
|
162
|
+
export interface ExtractWithTextly {
|
|
163
|
+
data: string;
|
|
164
|
+
format: {
|
|
165
|
+
[key: string]: JsonSchemaProperty;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export * from "./rules";
|
|
169
|
+
export * from "./data-verifier";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dymo-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.07",
|
|
4
4
|
"description": "Flow system for Dymo API.",
|
|
5
5
|
"main": "dist/cjs/dymo-api.js",
|
|
6
6
|
"module": "dist/esm/dymo-api.js",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"build": "rimraf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && node ./scripts/rename.js",
|
|
27
27
|
"start": "ts-node src/dymo-api.ts",
|
|
28
28
|
"prepublishOnly": "npm run build",
|
|
29
|
-
"test": "
|
|
29
|
+
"test": "jest --max-old-space-size=4096",
|
|
30
|
+
"test:watch": "jest --watch --max-old-space-size=4096"
|
|
30
31
|
},
|
|
31
32
|
"repository": {
|
|
32
33
|
"url": "https://github.com/TPEOficial/dymo-api-node"
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
"@types/react": "^18.3.5",
|
|
49
50
|
"axios": "^1.6.8",
|
|
50
51
|
"path": "^0.12.7",
|
|
51
|
-
"rimraf": "^6.0.1",
|
|
52
52
|
"tw-to-css": "0.0.12"
|
|
53
53
|
},
|
|
54
54
|
"contributors": [
|
|
@@ -57,8 +57,13 @@
|
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/axios": "^0.9.36",
|
|
60
|
+
"@types/jest": "^30.0.0",
|
|
60
61
|
"@types/node": "^22.9.3",
|
|
62
|
+
"dotenv": "^17.2.2",
|
|
63
|
+
"jest": "^30.1.3",
|
|
64
|
+
"rimraf": "^6.0.1",
|
|
65
|
+
"ts-jest": "^29.4.4",
|
|
61
66
|
"ts-node": "^10.9.2",
|
|
62
67
|
"typescript": "^5.5.4"
|
|
63
68
|
}
|
|
64
|
-
}
|
|
69
|
+
}
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
export type PhoneData = {
|
|
3
|
-
iso: any;
|
|
4
|
-
phone: string;
|
|
5
|
-
} | string;
|
|
6
|
-
export interface CreditCardData {
|
|
7
|
-
pan: string | number;
|
|
8
|
-
expirationDate?: string;
|
|
9
|
-
cvc?: string | number;
|
|
10
|
-
cvv?: string | number;
|
|
11
|
-
}
|
|
12
|
-
export type VerifyPlugins = "blocklist" | "compromiseDetector" | "nsfw" | "reputation" | "riskScore" | "torNetwork" | "typosquatting" | "urlShortener";
|
|
13
|
-
export interface Validator {
|
|
14
|
-
url?: string;
|
|
15
|
-
email?: string;
|
|
16
|
-
phone?: PhoneData;
|
|
17
|
-
domain?: string;
|
|
18
|
-
creditCard?: string | CreditCardData;
|
|
19
|
-
ip?: string;
|
|
20
|
-
wallet?: string;
|
|
21
|
-
userAgent?: string;
|
|
22
|
-
plugins?: VerifyPlugins[];
|
|
23
|
-
}
|
|
24
|
-
export interface SRNG {
|
|
25
|
-
min: number;
|
|
26
|
-
max: number;
|
|
27
|
-
quantity?: number;
|
|
28
|
-
}
|
|
29
|
-
export type Attachment = {
|
|
30
|
-
filename: string;
|
|
31
|
-
path?: string;
|
|
32
|
-
content?: string | Buffer;
|
|
33
|
-
cid?: string;
|
|
34
|
-
};
|
|
35
|
-
export interface ServerEmailConfig {
|
|
36
|
-
host: string;
|
|
37
|
-
port: number;
|
|
38
|
-
secure: boolean;
|
|
39
|
-
auth: {
|
|
40
|
-
user: string;
|
|
41
|
-
pass: string;
|
|
42
|
-
};
|
|
43
|
-
dkim?: {
|
|
44
|
-
domainName: string;
|
|
45
|
-
keySelector: string;
|
|
46
|
-
privateKey: string;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export type SendEmail = {
|
|
50
|
-
from: string;
|
|
51
|
-
to: string;
|
|
52
|
-
subject: string;
|
|
53
|
-
attachments?: Attachment[];
|
|
54
|
-
options?: {
|
|
55
|
-
priority?: "high" | "normal" | "low";
|
|
56
|
-
composeTailwindClasses?: boolean;
|
|
57
|
-
compileToCssSafe?: boolean;
|
|
58
|
-
onlyVerifiedEmails?: boolean;
|
|
59
|
-
};
|
|
60
|
-
} & ({
|
|
61
|
-
html: string;
|
|
62
|
-
react?: never;
|
|
63
|
-
} | {
|
|
64
|
-
react: React.ReactNode;
|
|
65
|
-
html?: never;
|
|
66
|
-
});
|
|
67
|
-
export interface PrayerTimesData {
|
|
68
|
-
lat?: number;
|
|
69
|
-
lon?: number;
|
|
70
|
-
}
|
|
71
|
-
export interface InputSatinizerData {
|
|
72
|
-
input?: string;
|
|
73
|
-
}
|
|
74
|
-
export interface IsValidPwdData {
|
|
75
|
-
email?: string;
|
|
76
|
-
password?: string;
|
|
77
|
-
bannedWords?: string | string[];
|
|
78
|
-
min?: number;
|
|
79
|
-
max?: number;
|
|
80
|
-
}
|
|
81
|
-
export interface SRNComponent {
|
|
82
|
-
integer: number;
|
|
83
|
-
float: number;
|
|
84
|
-
}
|
|
85
|
-
export interface SRNSummary {
|
|
86
|
-
values: SRNComponent[];
|
|
87
|
-
executionTime: number;
|
|
88
|
-
}
|
|
89
|
-
export interface CountryPrayerTimes {
|
|
90
|
-
country: string;
|
|
91
|
-
prayerTimesByTimezone: {
|
|
92
|
-
timezone: string;
|
|
93
|
-
prayerTimes: {
|
|
94
|
-
coordinates: string;
|
|
95
|
-
date: string;
|
|
96
|
-
calculationParameters: string;
|
|
97
|
-
fajr: string;
|
|
98
|
-
sunrise: string;
|
|
99
|
-
dhuhr: string;
|
|
100
|
-
asr: string;
|
|
101
|
-
sunset: string;
|
|
102
|
-
maghrib: string;
|
|
103
|
-
isha: string;
|
|
104
|
-
};
|
|
105
|
-
}[];
|
|
106
|
-
}
|
|
107
|
-
export interface SatinizedInputAnalysis {
|
|
108
|
-
input: string;
|
|
109
|
-
formats: {
|
|
110
|
-
ascii: boolean;
|
|
111
|
-
bitcoinAddress: boolean;
|
|
112
|
-
cLikeIdentifier: boolean;
|
|
113
|
-
coordinates: boolean;
|
|
114
|
-
crediCard: boolean;
|
|
115
|
-
date: boolean;
|
|
116
|
-
discordUsername: boolean;
|
|
117
|
-
doi: boolean;
|
|
118
|
-
domain: boolean;
|
|
119
|
-
e164Phone: boolean;
|
|
120
|
-
email: boolean;
|
|
121
|
-
emoji: boolean;
|
|
122
|
-
hanUnification: boolean;
|
|
123
|
-
hashtag: boolean;
|
|
124
|
-
hyphenWordBreak: boolean;
|
|
125
|
-
ipv6: boolean;
|
|
126
|
-
ip: boolean;
|
|
127
|
-
jiraTicket: boolean;
|
|
128
|
-
macAddress: boolean;
|
|
129
|
-
name: boolean;
|
|
130
|
-
number: boolean;
|
|
131
|
-
panFromGstin: boolean;
|
|
132
|
-
password: boolean;
|
|
133
|
-
port: boolean;
|
|
134
|
-
tel: boolean;
|
|
135
|
-
text: boolean;
|
|
136
|
-
semver: boolean;
|
|
137
|
-
ssn: boolean;
|
|
138
|
-
uuid: boolean;
|
|
139
|
-
url: boolean;
|
|
140
|
-
urlSlug: boolean;
|
|
141
|
-
username: boolean;
|
|
142
|
-
};
|
|
143
|
-
includes: {
|
|
144
|
-
spaces: boolean;
|
|
145
|
-
hasSql: boolean;
|
|
146
|
-
hasNoSql: boolean;
|
|
147
|
-
letters: boolean;
|
|
148
|
-
uppercase: boolean;
|
|
149
|
-
lowercase: boolean;
|
|
150
|
-
symbols: boolean;
|
|
151
|
-
digits: boolean;
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
export interface EmailStatus {
|
|
155
|
-
status: boolean;
|
|
156
|
-
error?: string;
|
|
157
|
-
}
|
|
158
|
-
export interface ValidationDetail {
|
|
159
|
-
validation: string;
|
|
160
|
-
message: string;
|
|
161
|
-
word?: string;
|
|
162
|
-
}
|
|
163
|
-
export interface PasswordValidationResult {
|
|
164
|
-
valid: boolean;
|
|
165
|
-
password: string;
|
|
166
|
-
details: ValidationDetail[];
|
|
167
|
-
}
|
|
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
|
-
riskScore?: number;
|
|
182
|
-
torNetwork?: boolean;
|
|
183
|
-
typosquatting?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
184
|
-
urlShortener?: boolean;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
email: {
|
|
188
|
-
valid: boolean;
|
|
189
|
-
fraud: boolean;
|
|
190
|
-
proxiedEmail: boolean;
|
|
191
|
-
freeSubdomain: boolean;
|
|
192
|
-
corporate: boolean;
|
|
193
|
-
email: string;
|
|
194
|
-
realUser: string;
|
|
195
|
-
didYouMean: string | null;
|
|
196
|
-
noReply: boolean;
|
|
197
|
-
customTLD: boolean;
|
|
198
|
-
domain: string;
|
|
199
|
-
roleAccount: boolean;
|
|
200
|
-
plugins: {
|
|
201
|
-
blocklist?: boolean;
|
|
202
|
-
compromiseDetector?: boolean;
|
|
203
|
-
nsfw?: boolean;
|
|
204
|
-
reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
|
|
205
|
-
riskScore?: number;
|
|
206
|
-
torNetwork?: boolean;
|
|
207
|
-
typosquatting?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
208
|
-
urlShortener?: boolean;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
phone: {
|
|
212
|
-
valid: boolean;
|
|
213
|
-
fraud: boolean;
|
|
214
|
-
phone: string;
|
|
215
|
-
prefix: string;
|
|
216
|
-
number: string;
|
|
217
|
-
lineType: "PREMIUM_RATE" | "TOLL_FREE" | "SHARED_COST" | "VOIP" | "PERSONAL_NUMBER" | "PAGER" | "UAN" | "VOICEMAIL" | "FIXED_LINE_OR_MOBILE" | "FIXED_LINE" | "MOBILE" | "Unknown";
|
|
218
|
-
carrierInfo: {
|
|
219
|
-
carrierName: string;
|
|
220
|
-
accuracy: number;
|
|
221
|
-
carrierCountry: string;
|
|
222
|
-
carrierCountryCode: string;
|
|
223
|
-
};
|
|
224
|
-
country: string;
|
|
225
|
-
countryCode: string;
|
|
226
|
-
plugins: {
|
|
227
|
-
blocklist?: boolean;
|
|
228
|
-
riskScore?: number;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
domain: {
|
|
232
|
-
valid: boolean;
|
|
233
|
-
fraud: boolean;
|
|
234
|
-
freeSubdomain: boolean;
|
|
235
|
-
customTLD: boolean;
|
|
236
|
-
domain: string;
|
|
237
|
-
plugins: {
|
|
238
|
-
blocklist?: boolean;
|
|
239
|
-
compromiseDetector?: boolean;
|
|
240
|
-
nsfw?: boolean;
|
|
241
|
-
reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
|
|
242
|
-
riskScore?: number;
|
|
243
|
-
torNetwork?: boolean;
|
|
244
|
-
typosquatting?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
245
|
-
urlShortener?: boolean;
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
creditCard: {
|
|
249
|
-
valid: boolean;
|
|
250
|
-
fraud: boolean;
|
|
251
|
-
test: boolean;
|
|
252
|
-
type: string;
|
|
253
|
-
creditCard: string;
|
|
254
|
-
plugins: {
|
|
255
|
-
blocklist?: boolean;
|
|
256
|
-
riskScore?: number;
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
ip: {
|
|
260
|
-
valid: boolean;
|
|
261
|
-
type: "IPv4" | "IPv6" | "Invalid";
|
|
262
|
-
class: "A" | "B" | "C" | "D" | "E" | "Unknown" | "None";
|
|
263
|
-
fraud: boolean;
|
|
264
|
-
ip: string;
|
|
265
|
-
continent: string;
|
|
266
|
-
continentCode: string;
|
|
267
|
-
country: string;
|
|
268
|
-
countryCode: string;
|
|
269
|
-
region: string;
|
|
270
|
-
regionName: string;
|
|
271
|
-
city: string;
|
|
272
|
-
district: string;
|
|
273
|
-
zipCode: string;
|
|
274
|
-
lat: number;
|
|
275
|
-
lon: number;
|
|
276
|
-
timezone: string;
|
|
277
|
-
offset: number;
|
|
278
|
-
currency: string;
|
|
279
|
-
isp: string;
|
|
280
|
-
org: string;
|
|
281
|
-
as: string;
|
|
282
|
-
asname: string;
|
|
283
|
-
mobile: boolean;
|
|
284
|
-
proxy: boolean;
|
|
285
|
-
hosting: boolean;
|
|
286
|
-
plugins: {
|
|
287
|
-
blocklist?: boolean;
|
|
288
|
-
riskScore?: number;
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
|
-
wallet: {
|
|
292
|
-
valid: boolean;
|
|
293
|
-
fraud: boolean;
|
|
294
|
-
wallet: string;
|
|
295
|
-
type: string;
|
|
296
|
-
plugins: {
|
|
297
|
-
blocklist?: boolean;
|
|
298
|
-
riskScore?: number;
|
|
299
|
-
torNetwork?: boolean;
|
|
300
|
-
};
|
|
301
|
-
};
|
|
302
|
-
userAgent: {
|
|
303
|
-
valid: boolean;
|
|
304
|
-
type?: string;
|
|
305
|
-
clientSlug?: string | null;
|
|
306
|
-
clientName?: string;
|
|
307
|
-
version?: string | null;
|
|
308
|
-
userAgent?: string;
|
|
309
|
-
fraud?: boolean;
|
|
310
|
-
bot?: boolean;
|
|
311
|
-
info?: string;
|
|
312
|
-
os?: string;
|
|
313
|
-
device: {
|
|
314
|
-
type?: string;
|
|
315
|
-
brand?: string;
|
|
316
|
-
};
|
|
317
|
-
plugins?: {
|
|
318
|
-
blocklist?: boolean;
|
|
319
|
-
riskScore?: number;
|
|
320
|
-
};
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
export type SchemaType = "string" | "number" | "boolean" | "array" | "object";
|
|
324
|
-
export interface JsonSchemaProperty {
|
|
325
|
-
type: SchemaType;
|
|
326
|
-
items?: JsonSchemaProperty;
|
|
327
|
-
properties?: Record<string, JsonSchemaProperty>;
|
|
328
|
-
required?: string[];
|
|
329
|
-
description?: string;
|
|
330
|
-
format?: string;
|
|
331
|
-
enum?: unknown[];
|
|
332
|
-
minimum?: number;
|
|
333
|
-
maximum?: number;
|
|
334
|
-
minLength?: number;
|
|
335
|
-
maxLength?: number;
|
|
336
|
-
pattern?: string;
|
|
337
|
-
[key: string]: unknown;
|
|
338
|
-
}
|
|
339
|
-
export interface ExtractWithTextly {
|
|
340
|
-
data: string;
|
|
341
|
-
format: {
|
|
342
|
-
[key: string]: JsonSchemaProperty;
|
|
343
|
-
};
|
|
344
|
-
}
|