mailer-advance 1.0.6 → 2.0.0

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/README.md CHANGED
@@ -117,6 +117,7 @@ When running the service, visit:
117
117
  - **`http://localhost:3000/contact.html`**: Send test emails with attachments.
118
118
  - **`http://localhost:3000/list-configs.html`**: View and manage saved SMTP profiles.
119
119
  - **`http://localhost:3000/config.html`**: Add or edit SMTP configurations.
120
+ - **`http://localhost:3000/api-docs`**: Full OpenApi/Swagger documentation for all endpoints.
120
121
 
121
122
  ## 📄 API Reference
122
123
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailer-advance",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "description": "Advanced Node.js email service with dynamic SMTP configuration, multi-database support (MongoDB/SQL), and a built-in UI.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,6 +26,17 @@
26
26
  ],
27
27
  "author": "Pranay",
28
28
  "license": "MIT",
29
+ "engines": {
30
+ "node": ">=20.0.0"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/pranay213/node-email-advance.git"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/pranay213/node-email-advance/issues"
38
+ },
39
+ "homepage": "https://github.com/pranay213/node-email-advance#readme",
29
40
  "files": [
30
41
  "src/",
31
42
  "public/",
@@ -50,6 +50,7 @@
50
50
  font-weight: 700;
51
51
  background: linear-gradient(to right, #818cf8, #c084fc);
52
52
  -webkit-background-clip: text;
53
+ background-clip: text;
53
54
  -webkit-text-fill-color: transparent;
54
55
  }
55
56
 
@@ -304,7 +305,7 @@
304
305
  async function loadConfigForEdit(id) {
305
306
  loadingOverlay.style.display = 'flex';
306
307
  try {
307
- const response = await fetch(`/api/config/${id}`);
308
+ const response = await fetch(`api/config/${id}`);
308
309
  const result = await response.json();
309
310
  if (result.success) {
310
311
  const c = result.data;
@@ -348,7 +349,7 @@
348
349
  };
349
350
 
350
351
  try {
351
- const response = await fetch('/api/config', {
352
+ const response = await fetch('api/config', {
352
353
  method: 'POST',
353
354
  headers: { 'Content-Type': 'application/json' },
354
355
  body: JSON.stringify(data)
@@ -50,6 +50,7 @@
50
50
  font-weight: 700;
51
51
  background: linear-gradient(to right, #818cf8, #c084fc);
52
52
  -webkit-background-clip: text;
53
+ background-clip: text;
53
54
  -webkit-text-fill-color: transparent;
54
55
  }
55
56
 
@@ -292,7 +293,7 @@
292
293
  }
293
294
 
294
295
  try {
295
- const response = await fetch('/api/contact', {
296
+ const response = await fetch('api/contact', {
296
297
  method: 'POST',
297
298
  body: formData
298
299
  });
@@ -50,6 +50,7 @@
50
50
  font-weight: 700;
51
51
  background: linear-gradient(to right, #818cf8, #c084fc);
52
52
  -webkit-background-clip: text;
53
+ background-clip: text;
53
54
  -webkit-text-fill-color: transparent;
54
55
  }
55
56
 
@@ -231,7 +232,7 @@
231
232
  async function loadConfigs() {
232
233
  const grid = document.getElementById('configGrid');
233
234
  try {
234
- const response = await fetch('/api/config');
235
+ const response = await fetch('api/config');
235
236
  const result = await response.json();
236
237
 
237
238
  if (result.success && result.data.length > 0) {
@@ -9,7 +9,9 @@ class DbService {
9
9
 
10
10
  async getSmtpConfig(configId) {
11
11
  try {
12
- if (!this.repository) throw new Error('Repository not initialized');
12
+ if (!this.repository) {
13
+ throw new Error('Database repository not initialized. Please call dbService.setRepository(repository) before using this service.');
14
+ }
13
15
  return await this.repository.getSmtpConfig(configId);
14
16
  } catch (error) {
15
17
  console.error(`[DbService] Error fetching config ${configId}:`, error.message);
@@ -19,7 +21,9 @@ class DbService {
19
21
 
20
22
  async saveSmtpConfig(configId, config) {
21
23
  try {
22
- if (!this.repository) throw new Error('Repository not initialized');
24
+ if (!this.repository) {
25
+ throw new Error('Database repository not initialized. Please call dbService.setRepository(repository) before using this service.');
26
+ }
23
27
  return await this.repository.saveSmtpConfig(configId, config);
24
28
  } catch (error) {
25
29
  console.error(`[DbService] Error saving config ${configId}:`, error.message);
@@ -29,7 +33,9 @@ class DbService {
29
33
 
30
34
  async getAllSmtpConfigs() {
31
35
  try {
32
- if (!this.repository) throw new Error('Repository not initialized');
36
+ if (!this.repository) {
37
+ throw new Error('Database repository not initialized. Please call dbService.setRepository(repository) before using this service.');
38
+ }
33
39
  return await this.repository.getAllSmtpConfigs();
34
40
  } catch (error) {
35
41
  console.error('[DbService] Error fetching all configs:', error.message);