dymo-api 1.0.85 → 1.0.87
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/config/index.cjs +5 -2
- package/dist/cjs/dymo-api.cjs +5 -6
- package/dist/esm/config/index.js +5 -2
- package/dist/esm/dymo-api.js +5 -6
- package/dist/types/config/index.d.ts +1 -1
- package/dist/types/dymo-api.d.ts +5 -6
- package/dist/types/lib/interfaces.d.ts +11 -6
- package/package.json +1 -1
|
@@ -13,7 +13,10 @@ const config = {
|
|
|
13
13
|
exports.default = config;
|
|
14
14
|
let BASE_URL = config.env.baseUrl;
|
|
15
15
|
exports.BASE_URL = BASE_URL;
|
|
16
|
-
const setBaseUrl = (
|
|
17
|
-
|
|
16
|
+
const setBaseUrl = (baseUrl) => {
|
|
17
|
+
if (/^(https:\/\/api\.tpeoficial\.com$|http:\/\/(localhost:\d+|dymoapi:\d+))$/.test(baseUrl))
|
|
18
|
+
exports.BASE_URL = BASE_URL = baseUrl;
|
|
19
|
+
else
|
|
20
|
+
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.");
|
|
18
21
|
};
|
|
19
22
|
exports.setBaseUrl = setBaseUrl;
|
package/dist/cjs/dymo-api.cjs
CHANGED
|
@@ -45,7 +45,7 @@ class DymoAPI {
|
|
|
45
45
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
46
46
|
* @param {string} [options.rootApiKey] - The root API key.
|
|
47
47
|
* @param {string} [options.apiKey] - The API key.
|
|
48
|
-
* @param {
|
|
48
|
+
* @param {string} [options.baseUrl] - Whether to use a local server instead of the cloud server.
|
|
49
49
|
* @param {Object} [options.serverEmailConfig] - The server email config.
|
|
50
50
|
* @description
|
|
51
51
|
* This is the main class to interact with the Dymo API. It should be
|
|
@@ -55,16 +55,15 @@ class DymoAPI {
|
|
|
55
55
|
* @example
|
|
56
56
|
* const dymoApi = new DymoAPI({
|
|
57
57
|
* rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
|
|
58
|
-
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
59
|
-
* local: true
|
|
58
|
+
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
60
59
|
* });
|
|
61
60
|
*/
|
|
62
|
-
constructor({ rootApiKey = null, apiKey = null,
|
|
61
|
+
constructor({ rootApiKey = null, apiKey = null, baseUrl = "https://api.tpeoficial.com", serverEmailConfig = undefined } = {}) {
|
|
63
62
|
this.rootApiKey = rootApiKey;
|
|
64
63
|
this.apiKey = apiKey;
|
|
65
64
|
this.serverEmailConfig = serverEmailConfig;
|
|
66
|
-
this.
|
|
67
|
-
(0, config_1.setBaseUrl)(
|
|
65
|
+
this.baseUrl = baseUrl;
|
|
66
|
+
(0, config_1.setBaseUrl)(baseUrl);
|
|
68
67
|
this.autoupdate();
|
|
69
68
|
}
|
|
70
69
|
/**
|
package/dist/esm/config/index.js
CHANGED
|
@@ -9,7 +9,10 @@ const config = {
|
|
|
9
9
|
};
|
|
10
10
|
export default config;
|
|
11
11
|
let BASE_URL = config.env.baseUrl;
|
|
12
|
-
export const setBaseUrl = (
|
|
13
|
-
|
|
12
|
+
export const setBaseUrl = (baseUrl) => {
|
|
13
|
+
if (/^(https:\/\/api\.tpeoficial\.com$|http:\/\/(localhost:\d+|dymoapi:\d+))$/.test(baseUrl))
|
|
14
|
+
BASE_URL = baseUrl;
|
|
15
|
+
else
|
|
16
|
+
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.");
|
|
14
17
|
};
|
|
15
18
|
export { BASE_URL };
|
package/dist/esm/dymo-api.js
CHANGED
|
@@ -10,7 +10,7 @@ class DymoAPI {
|
|
|
10
10
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
11
11
|
* @param {string} [options.rootApiKey] - The root API key.
|
|
12
12
|
* @param {string} [options.apiKey] - The API key.
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {string} [options.baseUrl] - Whether to use a local server instead of the cloud server.
|
|
14
14
|
* @param {Object} [options.serverEmailConfig] - The server email config.
|
|
15
15
|
* @description
|
|
16
16
|
* This is the main class to interact with the Dymo API. It should be
|
|
@@ -20,16 +20,15 @@ class DymoAPI {
|
|
|
20
20
|
* @example
|
|
21
21
|
* const dymoApi = new DymoAPI({
|
|
22
22
|
* rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
|
|
23
|
-
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
24
|
-
* local: true
|
|
23
|
+
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
25
24
|
* });
|
|
26
25
|
*/
|
|
27
|
-
constructor({ rootApiKey = null, apiKey = null,
|
|
26
|
+
constructor({ rootApiKey = null, apiKey = null, baseUrl = "https://api.tpeoficial.com", serverEmailConfig = undefined } = {}) {
|
|
28
27
|
this.rootApiKey = rootApiKey;
|
|
29
28
|
this.apiKey = apiKey;
|
|
30
29
|
this.serverEmailConfig = serverEmailConfig;
|
|
31
|
-
this.
|
|
32
|
-
setBaseUrl(
|
|
30
|
+
this.baseUrl = baseUrl;
|
|
31
|
+
setBaseUrl(baseUrl);
|
|
33
32
|
this.autoupdate();
|
|
34
33
|
}
|
|
35
34
|
/**
|
package/dist/types/dymo-api.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ declare class DymoAPI {
|
|
|
3
3
|
private rootApiKey;
|
|
4
4
|
private apiKey;
|
|
5
5
|
private serverEmailConfig?;
|
|
6
|
-
private
|
|
6
|
+
private baseUrl;
|
|
7
7
|
/**
|
|
8
8
|
* @param {Object} options - Options to create the DymoAPI instance.
|
|
9
9
|
* @param {string} [options.rootApiKey] - The root API key.
|
|
10
10
|
* @param {string} [options.apiKey] - The API key.
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {string} [options.baseUrl] - Whether to use a local server instead of the cloud server.
|
|
12
12
|
* @param {Object} [options.serverEmailConfig] - The server email config.
|
|
13
13
|
* @description
|
|
14
14
|
* This is the main class to interact with the Dymo API. It should be
|
|
@@ -18,14 +18,13 @@ declare class DymoAPI {
|
|
|
18
18
|
* @example
|
|
19
19
|
* const dymoApi = new DymoAPI({
|
|
20
20
|
* rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
|
|
21
|
-
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
22
|
-
* local: true
|
|
21
|
+
* apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5"
|
|
23
22
|
* });
|
|
24
23
|
*/
|
|
25
|
-
constructor({ rootApiKey, apiKey,
|
|
24
|
+
constructor({ rootApiKey, apiKey, baseUrl, serverEmailConfig }?: {
|
|
26
25
|
rootApiKey?: string | null;
|
|
27
26
|
apiKey?: string | null;
|
|
28
|
-
|
|
27
|
+
baseUrl?: string;
|
|
29
28
|
serverEmailConfig?: Interfaces.ServerEmailConfig;
|
|
30
29
|
});
|
|
31
30
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
1
2
|
export interface PhoneData {
|
|
2
3
|
iso: any;
|
|
3
4
|
phone: string;
|
|
@@ -43,20 +44,24 @@ export interface ServerEmailConfig {
|
|
|
43
44
|
privateKey: string;
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
export
|
|
47
|
+
export type SendEmail = {
|
|
47
48
|
from: string;
|
|
48
49
|
to: string;
|
|
49
50
|
subject: string;
|
|
50
|
-
|
|
51
|
-
react?: never;
|
|
51
|
+
attachments?: Attachment[];
|
|
52
52
|
options?: {
|
|
53
|
-
priority?: "high" | "normal" | "low"
|
|
53
|
+
priority?: "high" | "normal" | "low";
|
|
54
54
|
composeTailwindClasses?: boolean;
|
|
55
55
|
compileToCssSafe?: boolean;
|
|
56
56
|
onlyVerifiedEmails?: boolean;
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
} & ({
|
|
59
|
+
html: string;
|
|
60
|
+
react?: never;
|
|
61
|
+
} | {
|
|
62
|
+
react: React.ReactNode;
|
|
63
|
+
html?: never;
|
|
64
|
+
});
|
|
60
65
|
export interface PrayerTimesData {
|
|
61
66
|
lat?: number;
|
|
62
67
|
lon?: number;
|