dymo-api 1.0.20 → 1.0.22
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/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import config, { BASE_URL } from "
|
|
3
|
-
import * as Interfaces from "
|
|
2
|
+
import config, { BASE_URL } from "../config";
|
|
3
|
+
import * as Interfaces from "../lib/interfaces";
|
|
4
4
|
import { renderAsync } from "@react-email/render";
|
|
5
5
|
|
|
6
6
|
const customError = (code: number, message: string): Error => {
|
|
@@ -50,9 +50,9 @@ export const sendEmail = async (token: string | null, data: Interfaces.SendEmail
|
|
|
50
50
|
export const getRandom = async (token: string | null, data: Interfaces.SRNG): Promise<any> => {
|
|
51
51
|
if (token === null) throw customError(3000, "Invalid private token.");
|
|
52
52
|
if (!data.min || !data.max) throw customError(1500, "Both 'min' and 'max' parameters must be defined.");
|
|
53
|
-
if (data.min >= data.max) throw customError(1500, "
|
|
54
|
-
if (data.min < -1000000000 || data.min > 1000000000) throw customError(1500, "
|
|
55
|
-
if (data.max < -1000000000 || data.max > 1000000000) throw customError(1500, "
|
|
53
|
+
if (data.min >= data.max) throw customError(1500, "'min' must be less than 'max'.");
|
|
54
|
+
if (data.min < -1000000000 || data.min > 1000000000) throw customError(1500, "'min' must be an integer in the interval [-1000000000}, 1000000000].");
|
|
55
|
+
if (data.max < -1000000000 || data.max > 1000000000) throw customError(1500, "'max' must be an integer in the interval [-1000000000}, 1000000000].");
|
|
56
56
|
try {
|
|
57
57
|
const response = await axios.post(`${BASE_URL}/v1/private/srng`, data, { headers: { "Authorization": token } });
|
|
58
58
|
return response.data;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import config, { BASE_URL } from "
|
|
2
|
+
import config, { BASE_URL } from "../config";
|
|
3
3
|
|
|
4
4
|
const customError = (code: number, message: string): Error => {
|
|
5
5
|
return Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
package/src/dymo-api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import * as PublicAPI from "./public
|
|
3
|
-
import * as PrivateAPI from "./private
|
|
2
|
+
import * as PublicAPI from "./branches/public";
|
|
3
|
+
import * as PrivateAPI from "./branches/private";
|
|
4
4
|
import config, { BASE_URL, setBaseUrl } from "./config";
|
|
5
5
|
|
|
6
6
|
const customError = (code: number, message: string): Error => {
|