dymo-api 1.0.2 → 1.0.4
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/config.cjs +6 -0
- package/lib/dymo-api.cjs +1 -2
- package/lib/private-api.cjs +2 -20
- package/lib/public-api.cjs +1 -2
- package/package.json +1 -1
- package/config.json +0 -6
package/config.cjs
ADDED
package/lib/dymo-api.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
1
|
const axios = require("axios");
|
|
3
|
-
const config =
|
|
2
|
+
const config = require("../config.cjs");
|
|
4
3
|
const customError = (code, message) => Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
5
4
|
|
|
6
5
|
/* INTERNALS */
|
package/lib/private-api.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
1
|
const axios = require("axios");
|
|
3
|
-
const config =
|
|
2
|
+
const config = require("../config.cjs");
|
|
4
3
|
const customError = (code, message) => Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
5
4
|
|
|
6
5
|
exports.isValidData = async (token, data) => {
|
|
@@ -15,24 +14,7 @@ exports.isValidData = async (token, data) => {
|
|
|
15
14
|
if (!i) throw customError(1500, "You must provide at least one parameter.");
|
|
16
15
|
try {
|
|
17
16
|
const response = await axios.get(`https://api.tpeoficial.com/private/secure/verify`, { params: data, headers: { 'Authorization': token } });
|
|
18
|
-
|
|
19
|
-
"0000": "email",
|
|
20
|
-
"0001": "tel",
|
|
21
|
-
"0002": "domain",
|
|
22
|
-
"0003": "creditCard",
|
|
23
|
-
"0004": "ip"
|
|
24
|
-
}
|
|
25
|
-
const result = {};
|
|
26
|
-
response.data.forEach(obj => {
|
|
27
|
-
Object.keys(dicc).forEach(code => {
|
|
28
|
-
if (obj.hasOwnProperty('code') && obj.code === code) {
|
|
29
|
-
const type = dicc[code];
|
|
30
|
-
if (!result.hasOwnProperty(type)) result[type] = {};
|
|
31
|
-
result[type] = { ...result[type], ...obj };
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
return result;
|
|
17
|
+
return response.data;
|
|
36
18
|
} catch (error) {
|
|
37
19
|
throw customError(5000, error.message);
|
|
38
20
|
}
|
package/lib/public-api.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
1
|
const axios = require("axios");
|
|
3
|
-
const config =
|
|
2
|
+
const config = require("../config.cjs");
|
|
4
3
|
const customError = (code, message) => Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
5
4
|
|
|
6
5
|
exports.getPrayerTimes = async (data) => {
|
package/package.json
CHANGED