dymo-api 1.0.92 → 1.0.94
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 +4 -5
- package/dist/cjs/branches/public.cjs +3 -7
- package/dist/cjs/client.cjs +14 -0
- package/dist/cjs/config/index.cjs +12 -1
- package/dist/esm/branches/private.js +4 -5
- package/dist/esm/branches/public.js +4 -5
- package/dist/esm/client.js +9 -0
- package/dist/esm/config/index.js +8 -1
- package/dist/types/client.d.ts +2 -0
- package/dist/types/config/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -38,12 +38,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getRandom = exports.sendEmail = exports.isValidData = void 0;
|
|
40
40
|
const path_1 = __importDefault(require("path"));
|
|
41
|
-
const axios_1 = __importDefault(require("axios"));
|
|
42
41
|
const react_1 = __importDefault(require("react"));
|
|
43
42
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
44
43
|
const tw_to_css_1 = require("tw-to-css");
|
|
45
|
-
const config_1 = __importStar(require("../config/index.cjs"));
|
|
46
44
|
const render_1 = require("@react-email/render");
|
|
45
|
+
const config_1 = __importStar(require("../config/index.cjs"));
|
|
47
46
|
const customError = (code, message) => {
|
|
48
47
|
return Object.assign(new Error(), { code, message: `[${config_1.default.lib.name}] ${message}` });
|
|
49
48
|
};
|
|
@@ -71,7 +70,7 @@ const isValidData = async (token, data) => {
|
|
|
71
70
|
if (!Object.keys(data).some((key) => ["email", "phone", "domain", "creditCard", "ip", "wallet"].includes(key) && data.hasOwnProperty(key)))
|
|
72
71
|
throw customError(1500, "You must provide at least one parameter.");
|
|
73
72
|
try {
|
|
74
|
-
const response = await
|
|
73
|
+
const response = await config_1.axiosApiUrl.post("/private/secure/verify", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
75
74
|
return response.data;
|
|
76
75
|
}
|
|
77
76
|
catch (error) {
|
|
@@ -144,7 +143,7 @@ const sendEmail = async (token, data) => {
|
|
|
144
143
|
}));
|
|
145
144
|
data.attachments = processedAttachments;
|
|
146
145
|
}
|
|
147
|
-
const response = await
|
|
146
|
+
const response = await config_1.axiosApiUrl.post("/private/sender/sendEmail", data, { headers: { "Authorization": token } });
|
|
148
147
|
return response.data;
|
|
149
148
|
}
|
|
150
149
|
catch (error) {
|
|
@@ -177,7 +176,7 @@ const getRandom = async (token, data) => {
|
|
|
177
176
|
if (data.max < -1000000000 || data.max > 1000000000)
|
|
178
177
|
throw customError(1500, "'max' must be an integer in the interval [-1000000000}, 1000000000].");
|
|
179
178
|
try {
|
|
180
|
-
const response = await
|
|
179
|
+
const response = await config_1.axiosApiUrl.post("/private/srng", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
181
180
|
return response.data;
|
|
182
181
|
}
|
|
183
182
|
catch (error) {
|
|
@@ -32,12 +32,8 @@ 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
36
|
exports.isValidPwd = exports.satinizer = exports.getPrayerTimes = void 0;
|
|
40
|
-
const axios_1 = __importDefault(require("axios"));
|
|
41
37
|
const config_1 = __importStar(require("../config/index.cjs"));
|
|
42
38
|
const customError = (code, message) => {
|
|
43
39
|
return Object.assign(new Error(), { code, message: `[${config_1.default.lib.name}] ${message}` });
|
|
@@ -47,7 +43,7 @@ const getPrayerTimes = async (data) => {
|
|
|
47
43
|
if (lat === undefined || lon === undefined)
|
|
48
44
|
throw customError(1000, "You must provide a latitude and longitude.");
|
|
49
45
|
try {
|
|
50
|
-
const response = await
|
|
46
|
+
const response = await config_1.axiosApiUrl.get("/public/islam/prayertimes", { params: data });
|
|
51
47
|
return response.data;
|
|
52
48
|
}
|
|
53
49
|
catch (error) {
|
|
@@ -60,7 +56,7 @@ const satinizer = async (data) => {
|
|
|
60
56
|
if (input === undefined)
|
|
61
57
|
throw customError(1000, "You must specify at least the input.");
|
|
62
58
|
try {
|
|
63
|
-
const response = await
|
|
59
|
+
const response = await config_1.axiosApiUrl.get("/public/inputSatinizer", { params: { input: encodeURIComponent(input) } });
|
|
64
60
|
return response.data;
|
|
65
61
|
}
|
|
66
62
|
catch (error) {
|
|
@@ -96,7 +92,7 @@ const isValidPwd = async (data) => {
|
|
|
96
92
|
if (max !== undefined)
|
|
97
93
|
params.max = max;
|
|
98
94
|
try {
|
|
99
|
-
const response = await
|
|
95
|
+
const response = await config_1.axiosApiUrl.get("/public/validPwd", { params });
|
|
100
96
|
return response.data;
|
|
101
97
|
}
|
|
102
98
|
catch (error) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const dymoClient = axios_1.default.create({
|
|
8
|
+
baseURL: 'https://api.tpeoficial.com/v1',
|
|
9
|
+
headers: {
|
|
10
|
+
'User-Agent': 'DymoAPISDK',
|
|
11
|
+
'Content-Type': 'application/json'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports.default = dymoClient;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BASE_URL = exports.setBaseUrl = void 0;
|
|
6
|
+
exports.axiosApiUrl = exports.BASE_URL = exports.setBaseUrl = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
4
8
|
const config = {
|
|
5
9
|
lib: {
|
|
6
10
|
name: "Dymo API",
|
|
@@ -20,3 +24,10 @@ const setBaseUrl = (baseUrl) => {
|
|
|
20
24
|
throw new Error("[Dymo API] Invalid URL. It must be https://api.tpeoficial.com or start with http://localhost or http://dymoapi followed by a port.");
|
|
21
25
|
};
|
|
22
26
|
exports.setBaseUrl = setBaseUrl;
|
|
27
|
+
const axiosApiUrl = axios_1.default.create({
|
|
28
|
+
baseURL: `${BASE_URL}/v1`,
|
|
29
|
+
headers: {
|
|
30
|
+
"User-Agent": "DymoAPISDK/1.0.0"
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
exports.axiosApiUrl = axiosApiUrl;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import fs from "fs/promises";
|
|
5
4
|
import { twi } from "tw-to-css";
|
|
6
|
-
import config, { BASE_URL } from "../config/index.js";
|
|
7
5
|
import { render } from "@react-email/render";
|
|
6
|
+
import config, { axiosApiUrl } from "../config/index.js";
|
|
8
7
|
const customError = (code, message) => {
|
|
9
8
|
return Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
10
9
|
};
|
|
@@ -32,7 +31,7 @@ export const isValidData = async (token, data) => {
|
|
|
32
31
|
if (!Object.keys(data).some((key) => ["email", "phone", "domain", "creditCard", "ip", "wallet"].includes(key) && data.hasOwnProperty(key)))
|
|
33
32
|
throw customError(1500, "You must provide at least one parameter.");
|
|
34
33
|
try {
|
|
35
|
-
const response = await
|
|
34
|
+
const response = await axiosApiUrl.post("/private/secure/verify", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
36
35
|
return response.data;
|
|
37
36
|
}
|
|
38
37
|
catch (error) {
|
|
@@ -104,7 +103,7 @@ export const sendEmail = async (token, data) => {
|
|
|
104
103
|
}));
|
|
105
104
|
data.attachments = processedAttachments;
|
|
106
105
|
}
|
|
107
|
-
const response = await
|
|
106
|
+
const response = await axiosApiUrl.post("/private/sender/sendEmail", data, { headers: { "Authorization": token } });
|
|
108
107
|
return response.data;
|
|
109
108
|
}
|
|
110
109
|
catch (error) {
|
|
@@ -136,7 +135,7 @@ export const getRandom = async (token, data) => {
|
|
|
136
135
|
if (data.max < -1000000000 || data.max > 1000000000)
|
|
137
136
|
throw customError(1500, "'max' must be an integer in the interval [-1000000000}, 1000000000].");
|
|
138
137
|
try {
|
|
139
|
-
const response = await
|
|
138
|
+
const response = await axiosApiUrl.post("/private/srng", data, { headers: { "Content-Type": "application/json", "Authorization": token } });
|
|
140
139
|
return response.data;
|
|
141
140
|
}
|
|
142
141
|
catch (error) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import config, { BASE_URL } from "../config/index.js";
|
|
1
|
+
import config, { axiosApiUrl } from "../config/index.js";
|
|
3
2
|
const customError = (code, message) => {
|
|
4
3
|
return Object.assign(new Error(), { code, message: `[${config.lib.name}] ${message}` });
|
|
5
4
|
};
|
|
@@ -8,7 +7,7 @@ export const getPrayerTimes = async (data) => {
|
|
|
8
7
|
if (lat === undefined || lon === undefined)
|
|
9
8
|
throw customError(1000, "You must provide a latitude and longitude.");
|
|
10
9
|
try {
|
|
11
|
-
const response = await
|
|
10
|
+
const response = await axiosApiUrl.get("/public/islam/prayertimes", { params: data });
|
|
12
11
|
return response.data;
|
|
13
12
|
}
|
|
14
13
|
catch (error) {
|
|
@@ -20,7 +19,7 @@ export const satinizer = async (data) => {
|
|
|
20
19
|
if (input === undefined)
|
|
21
20
|
throw customError(1000, "You must specify at least the input.");
|
|
22
21
|
try {
|
|
23
|
-
const response = await
|
|
22
|
+
const response = await axiosApiUrl.get("/public/inputSatinizer", { params: { input: encodeURIComponent(input) } });
|
|
24
23
|
return response.data;
|
|
25
24
|
}
|
|
26
25
|
catch (error) {
|
|
@@ -55,7 +54,7 @@ export const isValidPwd = async (data) => {
|
|
|
55
54
|
if (max !== undefined)
|
|
56
55
|
params.max = max;
|
|
57
56
|
try {
|
|
58
|
-
const response = await
|
|
57
|
+
const response = await axiosApiUrl.get("/public/validPwd", { params });
|
|
59
58
|
return response.data;
|
|
60
59
|
}
|
|
61
60
|
catch (error) {
|
package/dist/esm/config/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import axios from "axios";
|
|
1
2
|
const config = {
|
|
2
3
|
lib: {
|
|
3
4
|
name: "Dymo API",
|
|
@@ -15,4 +16,10 @@ export const setBaseUrl = (baseUrl) => {
|
|
|
15
16
|
else
|
|
16
17
|
throw new Error("[Dymo API] Invalid URL. It must be https://api.tpeoficial.com or start with http://localhost or http://dymoapi followed by a port.");
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
+
const axiosApiUrl = axios.create({
|
|
20
|
+
baseURL: `${BASE_URL}/v1`,
|
|
21
|
+
headers: {
|
|
22
|
+
"User-Agent": "DymoAPISDK/1.0.0"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export { BASE_URL, axiosApiUrl };
|
|
@@ -10,4 +10,5 @@ declare const config: {
|
|
|
10
10
|
export default config;
|
|
11
11
|
declare let BASE_URL: string;
|
|
12
12
|
export declare const setBaseUrl: (baseUrl: string) => void;
|
|
13
|
-
|
|
13
|
+
declare const axiosApiUrl: import("axios").AxiosInstance;
|
|
14
|
+
export { BASE_URL, axiosApiUrl };
|