dymo-api 1.0.84 → 1.0.85
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/dymo-api.cjs +14 -72
- package/dist/cjs/lib/interfaces.cjs +1 -0
- package/dist/esm/dymo-api.js +15 -70
- package/dist/esm/lib/interfaces.js +1 -0
- package/dist/types/branches/private.d.ts +3 -1
- package/dist/types/dymo-api.d.ts +14 -44
- package/dist/types/lib/interfaces.d.ts +27 -4
- package/package.json +1 -1
package/dist/cjs/dymo-api.cjs
CHANGED
|
@@ -32,11 +32,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const axios_1 = __importDefault(require("axios"));
|
|
40
36
|
const PublicAPI = __importStar(require("./branches/public.cjs"));
|
|
41
37
|
const PrivateAPI = __importStar(require("./branches/private.cjs"));
|
|
42
38
|
const config_1 = __importStar(require("./config/index.cjs"));
|
|
@@ -44,9 +40,6 @@ const autoupdate_1 = require("./services/autoupdate.cjs");
|
|
|
44
40
|
const customError = (code, message) => {
|
|
45
41
|
return Object.assign(new Error(), { code, message: `[${config_1.default.lib.name}] ${message}` });
|
|
46
42
|
};
|
|
47
|
-
;
|
|
48
|
-
;
|
|
49
|
-
;
|
|
50
43
|
class DymoAPI {
|
|
51
44
|
/**
|
|
52
45
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
@@ -73,67 +66,6 @@ class DymoAPI {
|
|
|
73
66
|
this.local = rootApiKey ? local : false; // Only allow setting local if rootApiKey is defined.
|
|
74
67
|
(0, config_1.setBaseUrl)(this.local);
|
|
75
68
|
this.autoupdate();
|
|
76
|
-
this.initializeTokens(); // Calls the function to obtain tokens when creating the object.
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Retrieves and caches authentication tokens.
|
|
80
|
-
*
|
|
81
|
-
* This method checks if cached tokens are available and valid. If so, it returns
|
|
82
|
-
* the cached tokens. Otherwise, it generates new tokens using the provided API keys
|
|
83
|
-
* and caches them. The tokens are fetched from the server using a POST request.
|
|
84
|
-
*
|
|
85
|
-
* The method also handles validation of root and API tokens, throwing errors if
|
|
86
|
-
* any of the tokens are invalid. Cached tokens are considered valid for 5 minutes.
|
|
87
|
-
*
|
|
88
|
-
* @returns {Promise<TokensResponse|undefined>} A promise that resolves to the tokens response
|
|
89
|
-
* if successful, or undefined if no tokens are available.
|
|
90
|
-
* @throws Will throw an error if token validation fails, or if there is an issue
|
|
91
|
-
* with the token retrieval process.
|
|
92
|
-
*/
|
|
93
|
-
async getTokens() {
|
|
94
|
-
if (DymoAPI.tokensResponse && DymoAPI.tokensVerified) {
|
|
95
|
-
console.log(`[${config_1.default.lib.name}] Using cached tokens response.`);
|
|
96
|
-
return DymoAPI.tokensResponse;
|
|
97
|
-
}
|
|
98
|
-
const tokens = {};
|
|
99
|
-
if (this.rootApiKey)
|
|
100
|
-
tokens.root = `Bearer ${this.rootApiKey}`;
|
|
101
|
-
if (this.apiKey)
|
|
102
|
-
tokens.api = `Bearer ${this.apiKey}`;
|
|
103
|
-
try {
|
|
104
|
-
if (Object.keys(tokens).length === 0)
|
|
105
|
-
return;
|
|
106
|
-
const response = await axios_1.default.post(`${config_1.BASE_URL}/v1/dvr/tokens`, { tokens });
|
|
107
|
-
if (tokens.root && response.data.root === false)
|
|
108
|
-
throw customError(3000, "Invalid root token.");
|
|
109
|
-
if (tokens.api && response.data.api === false)
|
|
110
|
-
throw customError(3000, "Invalid API token.");
|
|
111
|
-
DymoAPI.tokensResponse = response.data;
|
|
112
|
-
DymoAPI.tokensVerified = true;
|
|
113
|
-
console.log(`[${config_1.default.lib.name}] Tokens initialized successfully.`);
|
|
114
|
-
return DymoAPI.tokensResponse;
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
console.error(error.message);
|
|
118
|
-
throw new Error(error.message);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Initializes the tokens response by calling getTokens().
|
|
123
|
-
*
|
|
124
|
-
* This method is called in the constructor and will throw an error if the
|
|
125
|
-
* initialization process fails.
|
|
126
|
-
*
|
|
127
|
-
* @throws Will throw an error if there is an issue with the token retrieval
|
|
128
|
-
* process.
|
|
129
|
-
*/
|
|
130
|
-
async initializeTokens() {
|
|
131
|
-
try {
|
|
132
|
-
await this.getTokens();
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
console.error(`Error initializing tokens: ${error.message}`);
|
|
136
|
-
}
|
|
137
69
|
}
|
|
138
70
|
/**
|
|
139
71
|
* Checks for updates and logs a message if a new version is available.
|
|
@@ -149,7 +81,7 @@ class DymoAPI {
|
|
|
149
81
|
await (0, autoupdate_1.checkForUpdates)();
|
|
150
82
|
}
|
|
151
83
|
catch (error) {
|
|
152
|
-
console.error(`Error checking the latest version in npmjs: ${error.message}`);
|
|
84
|
+
console.error(`[${config_1.default.lib.name}] Error checking the latest version in npmjs: ${error.message}`);
|
|
153
85
|
}
|
|
154
86
|
}
|
|
155
87
|
// FUNCTIONS / Private.
|
|
@@ -169,6 +101,8 @@ class DymoAPI {
|
|
|
169
101
|
* @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
|
|
170
102
|
* @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
|
|
171
103
|
* @throws Will throw an error if there is an issue with the validation process.
|
|
104
|
+
*
|
|
105
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
172
106
|
*/
|
|
173
107
|
async isValidData(data) {
|
|
174
108
|
return await PrivateAPI.isValidData(this.rootApiKey || this.apiKey, data);
|
|
@@ -196,10 +130,12 @@ class DymoAPI {
|
|
|
196
130
|
* @param {string} [data.attachments[].cid] - The CID (Content-ID) of the attached file, used for inline images.
|
|
197
131
|
* @returns {Promise<Interfaces.EmailStatus>} A promise that resolves to the response from the server.
|
|
198
132
|
* @throws Will throw an error if there is an issue with the email sending process.
|
|
133
|
+
*
|
|
134
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/sender-send-email/getting-started)
|
|
199
135
|
*/
|
|
200
136
|
async sendEmail(data) {
|
|
201
137
|
if (!this.serverEmailConfig && !this.rootApiKey)
|
|
202
|
-
console.error(
|
|
138
|
+
console.error(`[${config_1.default.lib.name}] You must configure the email client settings.`);
|
|
203
139
|
return await PrivateAPI.sendEmail(this.rootApiKey || this.apiKey, { serverEmailConfig: this.serverEmailConfig, ...data });
|
|
204
140
|
}
|
|
205
141
|
/**
|
|
@@ -214,6 +150,8 @@ class DymoAPI {
|
|
|
214
150
|
* @param {number} [data.quantity] - The number of random values to generate. Defaults to 1 if not provided.
|
|
215
151
|
* @returns {Promise<Interfaces.SRNSummary>} A promise that resolves to the response from the server.
|
|
216
152
|
* @throws Will throw an error if there is an issue with the random number generation process.
|
|
153
|
+
*
|
|
154
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/secure-random-number-generator)
|
|
217
155
|
*/
|
|
218
156
|
async getRandom(data) {
|
|
219
157
|
return await PrivateAPI.getRandom(this.rootApiKey || this.apiKey, data);
|
|
@@ -230,6 +168,8 @@ class DymoAPI {
|
|
|
230
168
|
* @param {number} data.lon - The longitude of the location.
|
|
231
169
|
* @returns {Promise<Interfaces.CountryPrayerTimes | { error: string }>} A promise that resolves to the response from the server.
|
|
232
170
|
* @throws Will throw an error if there is an issue with the prayer times retrieval process.
|
|
171
|
+
*
|
|
172
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/prayertimes)
|
|
233
173
|
*/
|
|
234
174
|
async getPrayerTimes(data) {
|
|
235
175
|
return await PublicAPI.getPrayerTimes(data);
|
|
@@ -242,6 +182,8 @@ class DymoAPI {
|
|
|
242
182
|
* @param {string} data.input - The input to be satinized.
|
|
243
183
|
* @returns {Promise<Interfaces.SatinizedInputAnalysis>} A promise that resolves to the response from the server.
|
|
244
184
|
* @throws Will throw an error if there is an issue with the satinization process.
|
|
185
|
+
*
|
|
186
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/input-satinizer)
|
|
245
187
|
*/
|
|
246
188
|
async satinizer(data) {
|
|
247
189
|
return await PublicAPI.satinizer(data);
|
|
@@ -268,11 +210,11 @@ class DymoAPI {
|
|
|
268
210
|
* @param {string | string[]} [data.bannedWords] - The list of banned words that the password must not contain.
|
|
269
211
|
* @returns {Promise<Interfaces.PasswordValidationResult>} A promise that resolves to the response from the server.
|
|
270
212
|
* @throws Will throw an error if there is an issue with the password validation process.
|
|
213
|
+
*
|
|
214
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/password-validator)
|
|
271
215
|
*/
|
|
272
216
|
async isValidPwd(data) {
|
|
273
217
|
return await PublicAPI.isValidPwd(data);
|
|
274
218
|
}
|
|
275
219
|
}
|
|
276
|
-
DymoAPI.tokensResponse = null;
|
|
277
|
-
DymoAPI.tokensVerified = false;
|
|
278
220
|
exports.default = DymoAPI;
|
package/dist/esm/dymo-api.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
1
|
import * as PublicAPI from "./branches/public.js";
|
|
3
2
|
import * as PrivateAPI from "./branches/private.js";
|
|
4
|
-
import config, {
|
|
3
|
+
import config, { setBaseUrl } from "./config/index.js";
|
|
5
4
|
import { checkForUpdates } from "./services/autoupdate.js";
|
|
6
5
|
const customError = (code, message) => {
|
|
7
6
|
return Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
8
7
|
};
|
|
9
|
-
;
|
|
10
|
-
;
|
|
11
|
-
;
|
|
12
8
|
class DymoAPI {
|
|
13
9
|
/**
|
|
14
10
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
@@ -35,67 +31,6 @@ class DymoAPI {
|
|
|
35
31
|
this.local = rootApiKey ? local : false; // Only allow setting local if rootApiKey is defined.
|
|
36
32
|
setBaseUrl(this.local);
|
|
37
33
|
this.autoupdate();
|
|
38
|
-
this.initializeTokens(); // Calls the function to obtain tokens when creating the object.
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Retrieves and caches authentication tokens.
|
|
42
|
-
*
|
|
43
|
-
* This method checks if cached tokens are available and valid. If so, it returns
|
|
44
|
-
* the cached tokens. Otherwise, it generates new tokens using the provided API keys
|
|
45
|
-
* and caches them. The tokens are fetched from the server using a POST request.
|
|
46
|
-
*
|
|
47
|
-
* The method also handles validation of root and API tokens, throwing errors if
|
|
48
|
-
* any of the tokens are invalid. Cached tokens are considered valid for 5 minutes.
|
|
49
|
-
*
|
|
50
|
-
* @returns {Promise<TokensResponse|undefined>} A promise that resolves to the tokens response
|
|
51
|
-
* if successful, or undefined if no tokens are available.
|
|
52
|
-
* @throws Will throw an error if token validation fails, or if there is an issue
|
|
53
|
-
* with the token retrieval process.
|
|
54
|
-
*/
|
|
55
|
-
async getTokens() {
|
|
56
|
-
if (DymoAPI.tokensResponse && DymoAPI.tokensVerified) {
|
|
57
|
-
console.log(`[${config.lib.name}] Using cached tokens response.`);
|
|
58
|
-
return DymoAPI.tokensResponse;
|
|
59
|
-
}
|
|
60
|
-
const tokens = {};
|
|
61
|
-
if (this.rootApiKey)
|
|
62
|
-
tokens.root = `Bearer ${this.rootApiKey}`;
|
|
63
|
-
if (this.apiKey)
|
|
64
|
-
tokens.api = `Bearer ${this.apiKey}`;
|
|
65
|
-
try {
|
|
66
|
-
if (Object.keys(tokens).length === 0)
|
|
67
|
-
return;
|
|
68
|
-
const response = await axios.post(`${BASE_URL}/v1/dvr/tokens`, { tokens });
|
|
69
|
-
if (tokens.root && response.data.root === false)
|
|
70
|
-
throw customError(3000, "Invalid root token.");
|
|
71
|
-
if (tokens.api && response.data.api === false)
|
|
72
|
-
throw customError(3000, "Invalid API token.");
|
|
73
|
-
DymoAPI.tokensResponse = response.data;
|
|
74
|
-
DymoAPI.tokensVerified = true;
|
|
75
|
-
console.log(`[${config.lib.name}] Tokens initialized successfully.`);
|
|
76
|
-
return DymoAPI.tokensResponse;
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error(error.message);
|
|
80
|
-
throw new Error(error.message);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Initializes the tokens response by calling getTokens().
|
|
85
|
-
*
|
|
86
|
-
* This method is called in the constructor and will throw an error if the
|
|
87
|
-
* initialization process fails.
|
|
88
|
-
*
|
|
89
|
-
* @throws Will throw an error if there is an issue with the token retrieval
|
|
90
|
-
* process.
|
|
91
|
-
*/
|
|
92
|
-
async initializeTokens() {
|
|
93
|
-
try {
|
|
94
|
-
await this.getTokens();
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
console.error(`Error initializing tokens: ${error.message}`);
|
|
98
|
-
}
|
|
99
34
|
}
|
|
100
35
|
/**
|
|
101
36
|
* Checks for updates and logs a message if a new version is available.
|
|
@@ -111,7 +46,7 @@ class DymoAPI {
|
|
|
111
46
|
await checkForUpdates();
|
|
112
47
|
}
|
|
113
48
|
catch (error) {
|
|
114
|
-
console.error(`Error checking the latest version in npmjs: ${error.message}`);
|
|
49
|
+
console.error(`[${config.lib.name}] Error checking the latest version in npmjs: ${error.message}`);
|
|
115
50
|
}
|
|
116
51
|
}
|
|
117
52
|
// FUNCTIONS / Private.
|
|
@@ -131,6 +66,8 @@ class DymoAPI {
|
|
|
131
66
|
* @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
|
|
132
67
|
* @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
|
|
133
68
|
* @throws Will throw an error if there is an issue with the validation process.
|
|
69
|
+
*
|
|
70
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
134
71
|
*/
|
|
135
72
|
async isValidData(data) {
|
|
136
73
|
return await PrivateAPI.isValidData(this.rootApiKey || this.apiKey, data);
|
|
@@ -158,10 +95,12 @@ class DymoAPI {
|
|
|
158
95
|
* @param {string} [data.attachments[].cid] - The CID (Content-ID) of the attached file, used for inline images.
|
|
159
96
|
* @returns {Promise<Interfaces.EmailStatus>} A promise that resolves to the response from the server.
|
|
160
97
|
* @throws Will throw an error if there is an issue with the email sending process.
|
|
98
|
+
*
|
|
99
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/sender-send-email/getting-started)
|
|
161
100
|
*/
|
|
162
101
|
async sendEmail(data) {
|
|
163
102
|
if (!this.serverEmailConfig && !this.rootApiKey)
|
|
164
|
-
console.error(
|
|
103
|
+
console.error(`[${config.lib.name}] You must configure the email client settings.`);
|
|
165
104
|
return await PrivateAPI.sendEmail(this.rootApiKey || this.apiKey, { serverEmailConfig: this.serverEmailConfig, ...data });
|
|
166
105
|
}
|
|
167
106
|
/**
|
|
@@ -176,6 +115,8 @@ class DymoAPI {
|
|
|
176
115
|
* @param {number} [data.quantity] - The number of random values to generate. Defaults to 1 if not provided.
|
|
177
116
|
* @returns {Promise<Interfaces.SRNSummary>} A promise that resolves to the response from the server.
|
|
178
117
|
* @throws Will throw an error if there is an issue with the random number generation process.
|
|
118
|
+
*
|
|
119
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/secure-random-number-generator)
|
|
179
120
|
*/
|
|
180
121
|
async getRandom(data) {
|
|
181
122
|
return await PrivateAPI.getRandom(this.rootApiKey || this.apiKey, data);
|
|
@@ -192,6 +133,8 @@ class DymoAPI {
|
|
|
192
133
|
* @param {number} data.lon - The longitude of the location.
|
|
193
134
|
* @returns {Promise<Interfaces.CountryPrayerTimes | { error: string }>} A promise that resolves to the response from the server.
|
|
194
135
|
* @throws Will throw an error if there is an issue with the prayer times retrieval process.
|
|
136
|
+
*
|
|
137
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/prayertimes)
|
|
195
138
|
*/
|
|
196
139
|
async getPrayerTimes(data) {
|
|
197
140
|
return await PublicAPI.getPrayerTimes(data);
|
|
@@ -204,6 +147,8 @@ class DymoAPI {
|
|
|
204
147
|
* @param {string} data.input - The input to be satinized.
|
|
205
148
|
* @returns {Promise<Interfaces.SatinizedInputAnalysis>} A promise that resolves to the response from the server.
|
|
206
149
|
* @throws Will throw an error if there is an issue with the satinization process.
|
|
150
|
+
*
|
|
151
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/input-satinizer)
|
|
207
152
|
*/
|
|
208
153
|
async satinizer(data) {
|
|
209
154
|
return await PublicAPI.satinizer(data);
|
|
@@ -230,11 +175,11 @@ class DymoAPI {
|
|
|
230
175
|
* @param {string | string[]} [data.bannedWords] - The list of banned words that the password must not contain.
|
|
231
176
|
* @returns {Promise<Interfaces.PasswordValidationResult>} A promise that resolves to the response from the server.
|
|
232
177
|
* @throws Will throw an error if there is an issue with the password validation process.
|
|
178
|
+
*
|
|
179
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/password-validator)
|
|
233
180
|
*/
|
|
234
181
|
async isValidPwd(data) {
|
|
235
182
|
return await PublicAPI.isValidPwd(data);
|
|
236
183
|
}
|
|
237
184
|
}
|
|
238
|
-
DymoAPI.tokensResponse = null;
|
|
239
|
-
DymoAPI.tokensVerified = false;
|
|
240
185
|
export default DymoAPI;
|
|
@@ -25,7 +25,9 @@ export declare const isValidData: (token: string | null, data: Interfaces.Valida
|
|
|
25
25
|
* if the 'react' field is not a valid React element, if the 'attachments' field exceeds the maximum allowed size of 40 MB,
|
|
26
26
|
* or if an error occurs during the sending request.
|
|
27
27
|
*/
|
|
28
|
-
export declare const sendEmail: (token: string | null, data: Interfaces.SendEmail
|
|
28
|
+
export declare const sendEmail: (token: string | null, data: Interfaces.SendEmail & {
|
|
29
|
+
serverEmailConfig: Interfaces.ServerEmailConfig | undefined;
|
|
30
|
+
}) => Promise<any>;
|
|
29
31
|
/**
|
|
30
32
|
* Retrieves a random number within a specified range using a secure endpoint.
|
|
31
33
|
*
|
package/dist/types/dymo-api.d.ts
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import * as Interfaces from "./lib/interfaces";
|
|
2
|
-
interface ServerEmailConfig {
|
|
3
|
-
host: string;
|
|
4
|
-
port: number;
|
|
5
|
-
secure: boolean;
|
|
6
|
-
auth: {
|
|
7
|
-
user: string;
|
|
8
|
-
pass: string;
|
|
9
|
-
};
|
|
10
|
-
dkim?: {
|
|
11
|
-
domainName: string;
|
|
12
|
-
keySelector: string;
|
|
13
|
-
privateKey: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
2
|
declare class DymoAPI {
|
|
17
3
|
private rootApiKey;
|
|
18
4
|
private apiKey;
|
|
19
5
|
private serverEmailConfig?;
|
|
20
6
|
private local;
|
|
21
|
-
private static tokensResponse;
|
|
22
|
-
private static tokensVerified;
|
|
23
7
|
/**
|
|
24
8
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
25
9
|
* @param {string} [options.rootApiKey] - The root API key.
|
|
@@ -42,34 +26,8 @@ declare class DymoAPI {
|
|
|
42
26
|
rootApiKey?: string | null;
|
|
43
27
|
apiKey?: string | null;
|
|
44
28
|
local?: boolean;
|
|
45
|
-
serverEmailConfig?: ServerEmailConfig;
|
|
29
|
+
serverEmailConfig?: Interfaces.ServerEmailConfig;
|
|
46
30
|
});
|
|
47
|
-
/**
|
|
48
|
-
* Retrieves and caches authentication tokens.
|
|
49
|
-
*
|
|
50
|
-
* This method checks if cached tokens are available and valid. If so, it returns
|
|
51
|
-
* the cached tokens. Otherwise, it generates new tokens using the provided API keys
|
|
52
|
-
* and caches them. The tokens are fetched from the server using a POST request.
|
|
53
|
-
*
|
|
54
|
-
* The method also handles validation of root and API tokens, throwing errors if
|
|
55
|
-
* any of the tokens are invalid. Cached tokens are considered valid for 5 minutes.
|
|
56
|
-
*
|
|
57
|
-
* @returns {Promise<TokensResponse|undefined>} A promise that resolves to the tokens response
|
|
58
|
-
* if successful, or undefined if no tokens are available.
|
|
59
|
-
* @throws Will throw an error if token validation fails, or if there is an issue
|
|
60
|
-
* with the token retrieval process.
|
|
61
|
-
*/
|
|
62
|
-
private getTokens;
|
|
63
|
-
/**
|
|
64
|
-
* Initializes the tokens response by calling getTokens().
|
|
65
|
-
*
|
|
66
|
-
* This method is called in the constructor and will throw an error if the
|
|
67
|
-
* initialization process fails.
|
|
68
|
-
*
|
|
69
|
-
* @throws Will throw an error if there is an issue with the token retrieval
|
|
70
|
-
* process.
|
|
71
|
-
*/
|
|
72
|
-
private initializeTokens;
|
|
73
31
|
/**
|
|
74
32
|
* Checks for updates and logs a message if a new version is available.
|
|
75
33
|
*
|
|
@@ -96,6 +54,8 @@ declare class DymoAPI {
|
|
|
96
54
|
* @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
|
|
97
55
|
* @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
|
|
98
56
|
* @throws Will throw an error if there is an issue with the validation process.
|
|
57
|
+
*
|
|
58
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
|
|
99
59
|
*/
|
|
100
60
|
isValidData(data: Interfaces.Validator): Promise<Interfaces.DataValidationAnalysis>;
|
|
101
61
|
/**
|
|
@@ -121,8 +81,10 @@ declare class DymoAPI {
|
|
|
121
81
|
* @param {string} [data.attachments[].cid] - The CID (Content-ID) of the attached file, used for inline images.
|
|
122
82
|
* @returns {Promise<Interfaces.EmailStatus>} A promise that resolves to the response from the server.
|
|
123
83
|
* @throws Will throw an error if there is an issue with the email sending process.
|
|
84
|
+
*
|
|
85
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/sender-send-email/getting-started)
|
|
124
86
|
*/
|
|
125
|
-
sendEmail(data:
|
|
87
|
+
sendEmail(data: Interfaces.SendEmail): Promise<Interfaces.EmailStatus>;
|
|
126
88
|
/**
|
|
127
89
|
* Generates a random number between the provided min and max values.
|
|
128
90
|
*
|
|
@@ -135,6 +97,8 @@ declare class DymoAPI {
|
|
|
135
97
|
* @param {number} [data.quantity] - The number of random values to generate. Defaults to 1 if not provided.
|
|
136
98
|
* @returns {Promise<Interfaces.SRNSummary>} A promise that resolves to the response from the server.
|
|
137
99
|
* @throws Will throw an error if there is an issue with the random number generation process.
|
|
100
|
+
*
|
|
101
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/secure-random-number-generator)
|
|
138
102
|
*/
|
|
139
103
|
getRandom(data: Interfaces.SRNG): Promise<Interfaces.SRNSummary>;
|
|
140
104
|
/**
|
|
@@ -148,6 +112,8 @@ declare class DymoAPI {
|
|
|
148
112
|
* @param {number} data.lon - The longitude of the location.
|
|
149
113
|
* @returns {Promise<Interfaces.CountryPrayerTimes | { error: string }>} A promise that resolves to the response from the server.
|
|
150
114
|
* @throws Will throw an error if there is an issue with the prayer times retrieval process.
|
|
115
|
+
*
|
|
116
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/prayertimes)
|
|
151
117
|
*/
|
|
152
118
|
getPrayerTimes(data: Interfaces.PrayerTimesData): Promise<Interfaces.CountryPrayerTimes | {
|
|
153
119
|
error: string;
|
|
@@ -160,6 +126,8 @@ declare class DymoAPI {
|
|
|
160
126
|
* @param {string} data.input - The input to be satinized.
|
|
161
127
|
* @returns {Promise<Interfaces.SatinizedInputAnalysis>} A promise that resolves to the response from the server.
|
|
162
128
|
* @throws Will throw an error if there is an issue with the satinization process.
|
|
129
|
+
*
|
|
130
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/input-satinizer)
|
|
163
131
|
*/
|
|
164
132
|
satinizer(data: Interfaces.InputSatinizerData): Promise<Interfaces.SatinizedInputAnalysis>;
|
|
165
133
|
/**
|
|
@@ -184,6 +152,8 @@ declare class DymoAPI {
|
|
|
184
152
|
* @param {string | string[]} [data.bannedWords] - The list of banned words that the password must not contain.
|
|
185
153
|
* @returns {Promise<Interfaces.PasswordValidationResult>} A promise that resolves to the response from the server.
|
|
186
154
|
* @throws Will throw an error if there is an issue with the password validation process.
|
|
155
|
+
*
|
|
156
|
+
* [Documentation](https://docs.tpeoficial.com/docs/dymo-api/public/password-validator)
|
|
187
157
|
*/
|
|
188
158
|
isValidPwd(data: Interfaces.IsValidPwdData): Promise<Interfaces.PasswordValidationResult>;
|
|
189
159
|
}
|
|
@@ -8,7 +8,7 @@ export interface CreditCardData {
|
|
|
8
8
|
cvc?: string | number;
|
|
9
9
|
cvv?: string | number;
|
|
10
10
|
}
|
|
11
|
-
export type VerifyPlugins = "compromiseDetector" | "nsfw" | "reputation" | "torNetwork" | "typosquatting" | "urlShortener";
|
|
11
|
+
export type VerifyPlugins = "blocklist" | "compromiseDetector" | "nsfw" | "reputation" | "torNetwork" | "typosquatting" | "urlShortener";
|
|
12
12
|
export interface Validator {
|
|
13
13
|
email?: string;
|
|
14
14
|
phone?: PhoneData;
|
|
@@ -29,6 +29,20 @@ export type Attachment = {
|
|
|
29
29
|
content?: string | Buffer;
|
|
30
30
|
cid?: string;
|
|
31
31
|
};
|
|
32
|
+
export interface ServerEmailConfig {
|
|
33
|
+
host: string;
|
|
34
|
+
port: number;
|
|
35
|
+
secure: boolean;
|
|
36
|
+
auth: {
|
|
37
|
+
user: string;
|
|
38
|
+
pass: string;
|
|
39
|
+
};
|
|
40
|
+
dkim?: {
|
|
41
|
+
domainName: string;
|
|
42
|
+
keySelector: string;
|
|
43
|
+
privateKey: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
32
46
|
export interface SendEmail {
|
|
33
47
|
from: string;
|
|
34
48
|
to: string;
|
|
@@ -158,6 +172,7 @@ export interface DataValidationAnalysis {
|
|
|
158
172
|
domain: string;
|
|
159
173
|
roleAccount: boolean;
|
|
160
174
|
plugins: {
|
|
175
|
+
blocklist?: boolean;
|
|
161
176
|
compromiseDetector?: boolean;
|
|
162
177
|
nsfw?: boolean;
|
|
163
178
|
reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
|
|
@@ -174,7 +189,9 @@ export interface DataValidationAnalysis {
|
|
|
174
189
|
number: string;
|
|
175
190
|
country: string;
|
|
176
191
|
countryCode: string;
|
|
177
|
-
plugins: {
|
|
192
|
+
plugins: {
|
|
193
|
+
blocklist?: boolean;
|
|
194
|
+
};
|
|
178
195
|
};
|
|
179
196
|
domain: {
|
|
180
197
|
valid: boolean;
|
|
@@ -183,6 +200,7 @@ export interface DataValidationAnalysis {
|
|
|
183
200
|
customTLD: boolean;
|
|
184
201
|
domain: string;
|
|
185
202
|
plugins: {
|
|
203
|
+
blocklist?: boolean;
|
|
186
204
|
compromiseDetector?: boolean;
|
|
187
205
|
nsfw?: boolean;
|
|
188
206
|
reputation?: "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
|
|
@@ -197,7 +215,9 @@ export interface DataValidationAnalysis {
|
|
|
197
215
|
test: boolean;
|
|
198
216
|
type: string;
|
|
199
217
|
creditCard: string;
|
|
200
|
-
plugins: {
|
|
218
|
+
plugins: {
|
|
219
|
+
blocklist?: boolean;
|
|
220
|
+
};
|
|
201
221
|
};
|
|
202
222
|
ip: {
|
|
203
223
|
valid: boolean;
|
|
@@ -226,7 +246,9 @@ export interface DataValidationAnalysis {
|
|
|
226
246
|
mobile: boolean;
|
|
227
247
|
proxy: boolean;
|
|
228
248
|
hosting: boolean;
|
|
229
|
-
plugins: {
|
|
249
|
+
plugins: {
|
|
250
|
+
blocklist?: boolean;
|
|
251
|
+
};
|
|
230
252
|
};
|
|
231
253
|
wallet: {
|
|
232
254
|
valid: boolean;
|
|
@@ -234,6 +256,7 @@ export interface DataValidationAnalysis {
|
|
|
234
256
|
wallet: string;
|
|
235
257
|
type: "Bitcoin" | "Bitcoin (Bech32)" | "Ethereum" | "Litecoin" | "Cardano" | "Binance Smart Chain";
|
|
236
258
|
plugins: {
|
|
259
|
+
blocklist?: boolean;
|
|
237
260
|
torNetwork?: boolean;
|
|
238
261
|
};
|
|
239
262
|
};
|