dymo-api 1.0.53 → 1.0.55

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.
@@ -269,6 +269,3 @@ class DymoAPI {
269
269
  return await PublicAPI.newURLEncrypt(data);
270
270
  }
271
271
  }
272
- exports.default = DymoAPI;
273
- //@ts-ignore
274
- module.exports = DymoAPI;
@@ -269,6 +269,3 @@ class DymoAPI {
269
269
  return await PublicAPI.newURLEncrypt(data);
270
270
  }
271
271
  }
272
- exports.default = DymoAPI;
273
- //@ts-ignore
274
- module.exports = DymoAPI;
@@ -1,188 +1 @@
1
- interface ServerEmailConfig {
2
- host: string;
3
- port: number;
4
- secure: boolean;
5
- auth: {
6
- user: string;
7
- pass: string;
8
- };
9
- dkim?: {
10
- domainName: string;
11
- keySelector: string;
12
- privateKey: string;
13
- };
14
- }
15
- declare class DymoAPI {
16
- private rootApiKey;
17
- private apiKey;
18
- private tokensResponse;
19
- private lastFetchTime;
20
- private serverEmailConfig?;
21
- private local;
22
- /**
23
- * @param {Object} options - Options to create the DymoAPI instance.
24
- * @param {string} [options.rootApiKey] - The root API key.
25
- * @param {string} [options.apiKey] - The API key.
26
- * @param {boolean} [options.local] - Whether to use a local server instead of the cloud server.
27
- * @param {Object} [options.serverEmailConfig] - The server email config.
28
- * @description
29
- * This is the main class to interact with the Dymo API. It should be
30
- * instantiated with the root API key and the API key. The root API key is
31
- * used to fetch the tokens and the API key is used to authenticate the
32
- * requests.
33
- * @example
34
- * const dymoApi = new DymoAPI({
35
- * rootApiKey: "6bfb7675-6b69-4f8d-9f43-5a6f7f02c6c5",
36
- * apiKey: "4c8b7675-6b69-4f8d-9f43-5a6f7f02c6c5",
37
- * local: true
38
- * });
39
- */
40
- constructor({ rootApiKey, apiKey, local, serverEmailConfig }: {
41
- rootApiKey?: string | null;
42
- apiKey?: string | null;
43
- local?: boolean;
44
- serverEmailConfig?: ServerEmailConfig;
45
- });
46
- /**
47
- * Retrieves and caches authentication tokens.
48
- *
49
- * This method checks if cached tokens are available and valid. If so, it returns
50
- * the cached tokens. Otherwise, it generates new tokens using the provided API keys
51
- * and caches them. The tokens are fetched from the server using a POST request.
52
- *
53
- * The method also handles validation of root and API tokens, throwing errors if
54
- * any of the tokens are invalid. Cached tokens are considered valid for 5 minutes.
55
- *
56
- * @returns {Promise<Object|undefined>} A promise that resolves to the tokens response
57
- * if successful, or undefined if no tokens are available.
58
- * @throws Will throw an error if token validation fails, or if there is an issue
59
- * with the token retrieval process.
60
- */
61
- private getTokens;
62
- /**
63
- * Initializes the tokens response by calling getTokens().
64
- *
65
- * This method is called in the constructor and will throw an error if the
66
- * initialization process fails.
67
- *
68
- * @throws Will throw an error if there is an issue with the token retrieval
69
- * process.
70
- */
71
- private initializeTokens;
72
- /**
73
- * Checks for updates and logs a message if a new version is available.
74
- *
75
- * This method is called in the constructor and will throw an error if the
76
- * update check fails.
77
- *
78
- * @throws Will throw an error if there is an issue with the update check
79
- * process.
80
- */
81
- private autoupdate;
82
- /**
83
- * Validates the given data against the configured validation settings.
84
- *
85
- * This method requires either the root API key or the API key to be set.
86
- * If neither is set, it will throw an error.
87
- *
88
- * @param {Object} data - The data to be validated.
89
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
90
- * @throws Will throw an error if there is an issue with the validation process.
91
- */
92
- isValidData(data: any): Promise<any>;
93
- /**
94
- * Sends an email using the configured email client settings.
95
- *
96
- * This method requires either the root API key or the server email config to be set.
97
- * If neither is set, it will throw an error.
98
- *
99
- * @param {Object} data - The email data to be sent.
100
- * @param {string} data.from - The email address from which the email will be sent.
101
- * @param {string} data.to - The email address to which the email will be sent.
102
- * @param {string} data.subject - The subject of the email.
103
- * @param {string} [data.html] - The HTML content of the email.
104
- * @param {React.ReactElement} [data.react] - The React component to be rendered as the email content.
105
- * @param {Object} [data.options] - Content configuration options.
106
- * @param {"high" | "normal" | "low" | undefined} [data.options.priority="normal"] - Email priority (default: normal).
107
- * @param {boolean} [data.options.waitToResponse=true] - Wait until the email is sent (default: true).
108
- * @param {boolean} [data.options.composeTailwindClasses] - Whether to compose tailwind classes.
109
- * @param {Attachment[]} [data.attachments] - An array of attachments to be included in the email.
110
- * @param {string} data.attachments[].filename - The name of the attached file.
111
- * @param {string} [data.attachments[].path] - The path or URL of the attached file. Either this or `content` must be provided.
112
- * @param {Buffer} [data.attachments[].content] - The content of the attached file as a Buffer. Either this or `path` must be provided.
113
- * @param {string} [data.attachments[].cid] - The CID (Content-ID) of the attached file, used for inline images.
114
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
115
- * @throws Will throw an error if there is an issue with the email sending process.
116
- */
117
- sendEmail(data: any): Promise<any>;
118
- /**
119
- * Generates a random number between the provided min and max values.
120
- *
121
- * This method requires either the root API key or the API key to be set.
122
- * If neither is set, it will throw an error.
123
- *
124
- * @param {Object} data - The data to be sent.
125
- * @param {number} data.min - The minimum value of the range.
126
- * @param {number} data.max - The maximum value of the range.
127
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
128
- * @throws Will throw an error if there is an issue with the random number generation process.
129
- */
130
- getRandom(data: any): Promise<any>;
131
- /**
132
- * Retrieves the prayer times for the given location.
133
- *
134
- * This method requires a latitude and longitude to be provided in the
135
- * data object. If either of these are not provided, it will throw an error.
136
- *
137
- * @param {Object} data - The data to be sent.
138
- * @param {number} data.lat - The latitude of the location.
139
- * @param {number} data.lon - The longitude of the location.
140
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
141
- * @throws Will throw an error if there is an issue with the prayer times retrieval process.
142
- */
143
- getPrayerTimes(data: any): Promise<any>;
144
- /**
145
- * Satinizes the input, replacing any special characters with their HTML
146
- * entities.
147
- *
148
- * @param {Object} data - The data to be sent.
149
- * @param {string} data.input - The input to be satinized.
150
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
151
- * @throws Will throw an error if there is an issue with the satinization process.
152
- */
153
- satinizer(data: any): Promise<any>;
154
- /**
155
- * Validates a password based on the given parameters.
156
- *
157
- * This method requires the password to be provided in the data object.
158
- * If the password is not provided, it will throw an error. The method
159
- * will validate the password against the following rules:
160
- * - The password must be at least 8 characters long.
161
- * - The password must be at most 32 characters long.
162
- * - The password must contain at least one uppercase letter.
163
- * - The password must contain at least one lowercase letter.
164
- * - The password must contain at least one number.
165
- * - The password must contain at least one special character.
166
- * - The password must not contain any of the given banned words.
167
- *
168
- * @param {Object} data - The data to be sent.
169
- * @param {string} data.password - The password to be validated.
170
- * @param {string[]} [data.bannedWords] - The list of banned words that the password must not contain.
171
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
172
- * @throws Will throw an error if there is an issue with the password validation process.
173
- */
174
- isValidPwd(data: any): Promise<any>;
175
- /**
176
- * Encrypts a URL using the configured encryption settings.
177
- *
178
- * This method requires the URL to be provided in the data object.
179
- * If the URL is not provided, it will throw an error.
180
- *
181
- * @param {Object} data - The data to be sent.
182
- * @param {string} data.url - The URL to be encrypted.
183
- * @returns {Promise<Object>} A promise that resolves to the response from the server.
184
- * @throws Will throw an error if there is an issue with the URL encryption process.
185
- */
186
- newURLEncrypt(data: any): Promise<any>;
187
- }
188
- export default DymoAPI;
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",