dymo-api 1.0.36 → 1.0.38

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.
@@ -50,7 +50,7 @@ const isValidData = async (token, data) => {
50
50
  return response.data;
51
51
  }
52
52
  catch (error) {
53
- throw customError(5000, error.message);
53
+ throw customError(5000, error.response?.data?.message || error.message);
54
54
  }
55
55
  };
56
56
  exports.isValidData = isValidData;
@@ -82,7 +82,7 @@ const sendEmail = async (token, data) => {
82
82
  return response.data;
83
83
  }
84
84
  catch (error) {
85
- throw customError(5000, error.message);
85
+ throw customError(5000, error.response?.data?.message || error.message);
86
86
  }
87
87
  };
88
88
  exports.sendEmail = sendEmail;
@@ -102,7 +102,7 @@ const getRandom = async (token, data) => {
102
102
  return response.data;
103
103
  }
104
104
  catch (error) {
105
- throw customError(5000, error.message);
105
+ throw customError(5000, error.response?.data?.message || error.message);
106
106
  }
107
107
  };
108
108
  exports.getRandom = getRandom;
@@ -45,7 +45,7 @@ const getPrayerTimes = async (data) => {
45
45
  return response.data;
46
46
  }
47
47
  catch (error) {
48
- throw customError(5000, error.message);
48
+ throw customError(5000, error.response?.data?.message || error.message);
49
49
  }
50
50
  };
51
51
  exports.getPrayerTimes = getPrayerTimes;
@@ -58,7 +58,7 @@ const satinizer = async (data) => {
58
58
  return response.data;
59
59
  }
60
60
  catch (error) {
61
- throw customError(5000, error.message);
61
+ throw customError(5000, error.response?.data?.message || error.message);
62
62
  }
63
63
  };
64
64
  exports.satinizer = satinizer;
@@ -94,7 +94,7 @@ const isValidPwd = async (data) => {
94
94
  return response.data;
95
95
  }
96
96
  catch (error) {
97
- throw customError(5000, error.message);
97
+ throw customError(5000, error.response?.data?.message || error.message);
98
98
  }
99
99
  };
100
100
  exports.isValidPwd = isValidPwd;
@@ -107,7 +107,7 @@ const newURLEncrypt = async (data) => {
107
107
  return response.data;
108
108
  }
109
109
  catch (error) {
110
- throw customError(5000, error.message);
110
+ throw customError(5000, error.response?.data?.message || error.message);
111
111
  }
112
112
  };
113
113
  exports.newURLEncrypt = newURLEncrypt;
package/dist/dymo-api.js CHANGED
@@ -49,9 +49,6 @@ class DymoAPI {
49
49
  this.autoupdate();
50
50
  this.initializeTokens(); // Calls the function to obtain tokens when creating the object.
51
51
  }
52
- getBaseUrl() {
53
- return this.local ? "http://localhost:3050" : "https://api.tpeoficial.com";
54
- }
55
52
  async getTokens() {
56
53
  const currentTime = new Date();
57
54
  if (this.tokensResponse && this.lastFetchTime && (currentTime.getTime() - this.lastFetchTime.getTime()) < 5 * 60 * 1000) {
@@ -103,7 +100,7 @@ class DymoAPI {
103
100
  }
104
101
  async sendEmail(data) {
105
102
  if (!this.serverEmailConfig && !this.rootApiKey)
106
- throw customError(5000, `You must configure the email client settings.`);
103
+ throw customError(5000, "You must configure the email client settings.");
107
104
  return await PrivateAPI.sendEmail(this.rootApiKey || this.apiKey, { serverEmailConfig: this.serverEmailConfig, ...data });
108
105
  }
109
106
  async getRandom(data) {
package/dist/dymo-api.mjs CHANGED
@@ -49,9 +49,6 @@ class DymoAPI {
49
49
  this.autoupdate();
50
50
  this.initializeTokens(); // Calls the function to obtain tokens when creating the object.
51
51
  }
52
- getBaseUrl() {
53
- return this.local ? "http://localhost:3050" : "https://api.tpeoficial.com";
54
- }
55
52
  async getTokens() {
56
53
  const currentTime = new Date();
57
54
  if (this.tokensResponse && this.lastFetchTime && (currentTime.getTime() - this.lastFetchTime.getTime()) < 5 * 60 * 1000) {
@@ -103,7 +100,7 @@ class DymoAPI {
103
100
  }
104
101
  async sendEmail(data) {
105
102
  if (!this.serverEmailConfig && !this.rootApiKey)
106
- throw customError(5000, `You must configure the email client settings.`);
103
+ throw customError(5000, "You must configure the email client settings.");
107
104
  return await PrivateAPI.sendEmail(this.rootApiKey || this.apiKey, { serverEmailConfig: this.serverEmailConfig, ...data });
108
105
  }
109
106
  async getRandom(data) {
@@ -9,12 +9,10 @@ const child_process_1 = require("child_process");
9
9
  const localVersion = (0, child_process_1.execSync)(`npm list dymo-api --depth=0`).toString().match(new RegExp(`dymo-api@(\\d+\\.\\d+\\.\\d+)`))?.[1] || "0.0.0";
10
10
  async function checkForUpdates() {
11
11
  try {
12
- const response = await axios_1.default.get(`https://registry.npmjs.org/dymo-api/latest`);
12
+ const response = await axios_1.default.get("https://registry.npmjs.org/dymo-api/latest");
13
13
  const latestVersion = response.data.version;
14
14
  if (localVersion !== latestVersion)
15
15
  console.log(`A new version of dymo-api is available: ${latestVersion}. You are using ${localVersion}. Consider updating.`);
16
- else
17
- console.log(`You are using the latest version of dymo-api: ${localVersion}.`);
18
16
  }
19
17
  catch (error) {
20
18
  if (error.response)
@@ -25,7 +25,6 @@ declare class DymoAPI {
25
25
  local?: boolean;
26
26
  serverEmailConfig?: ServerEmailConfig;
27
27
  });
28
- private getBaseUrl;
29
28
  private getTokens;
30
29
  private initializeTokens;
31
30
  private autoupdate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/dymo-api.js",
6
6
  "module": "dist/dymo-api.mjs",