@lensjs/express 1.4.3 → 1.5.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/dist/adapter.cjs CHANGED
@@ -67,6 +67,11 @@ var ExpressAdapter = class extends import_core.LensAdapter {
67
67
  void this.watchCache(watcher);
68
68
  }
69
69
  break;
70
+ case import_core.WatcherTypeEnum.MAIL:
71
+ if (this.config.mailWatcherEnabled) {
72
+ void this.watchMail(watcher);
73
+ }
74
+ break;
70
75
  }
71
76
  }
72
77
  }
@@ -107,6 +112,12 @@ var ExpressAdapter = class extends import_core.LensAdapter {
107
112
  await watcher?.log(data);
108
113
  });
109
114
  }
115
+ async watchMail(watcher) {
116
+ if (!this.config.mailWatcherEnabled) return;
117
+ import_core.lensEmitter.on("mail", async (data) => {
118
+ await watcher?.log(data);
119
+ });
120
+ }
110
121
  async watchQueries(watcher) {
111
122
  if (!this.config.queryWatcher.enabled) return;
112
123
  const handler = this.config.queryWatcher.handler;
@@ -14,6 +14,7 @@ declare class ExpressAdapter extends LensAdapter {
14
14
  registerRoutes(routes: RouteDefinition[]): void;
15
15
  serveUI(uiPath: string, spaRoute: string, _dataToInject: Record<string, any>): void;
16
16
  private watchCache;
17
+ private watchMail;
17
18
  private watchQueries;
18
19
  private watchRequests;
19
20
  private patchResponseMethods;
package/dist/adapter.d.ts CHANGED
@@ -14,6 +14,7 @@ declare class ExpressAdapter extends LensAdapter {
14
14
  registerRoutes(routes: RouteDefinition[]): void;
15
15
  serveUI(uiPath: string, spaRoute: string, _dataToInject: Record<string, any>): void;
16
16
  private watchCache;
17
+ private watchMail;
17
18
  private watchQueries;
18
19
  private watchRequests;
19
20
  private patchResponseMethods;
package/dist/adapter.js CHANGED
@@ -39,6 +39,11 @@ var ExpressAdapter = class extends LensAdapter {
39
39
  void this.watchCache(watcher);
40
40
  }
41
41
  break;
42
+ case WatcherTypeEnum.MAIL:
43
+ if (this.config.mailWatcherEnabled) {
44
+ void this.watchMail(watcher);
45
+ }
46
+ break;
42
47
  }
43
48
  }
44
49
  }
@@ -79,6 +84,12 @@ var ExpressAdapter = class extends LensAdapter {
79
84
  await watcher?.log(data);
80
85
  });
81
86
  }
87
+ async watchMail(watcher) {
88
+ if (!this.config.mailWatcherEnabled) return;
89
+ lensEmitter.on("mail", async (data) => {
90
+ await watcher?.log(data);
91
+ });
92
+ }
82
93
  async watchQueries(watcher) {
83
94
  if (!this.config.queryWatcher.enabled) return;
84
95
  const handler = this.config.queryWatcher.handler;
package/dist/index.cjs CHANGED
@@ -72,6 +72,11 @@ var ExpressAdapter = class extends import_core.LensAdapter {
72
72
  void this.watchCache(watcher);
73
73
  }
74
74
  break;
75
+ case import_core.WatcherTypeEnum.MAIL:
76
+ if (this.config.mailWatcherEnabled) {
77
+ void this.watchMail(watcher);
78
+ }
79
+ break;
75
80
  }
76
81
  }
77
82
  }
@@ -112,6 +117,12 @@ var ExpressAdapter = class extends import_core.LensAdapter {
112
117
  await watcher?.log(data);
113
118
  });
114
119
  }
120
+ async watchMail(watcher) {
121
+ if (!this.config.mailWatcherEnabled) return;
122
+ import_core.lensEmitter.on("mail", async (data) => {
123
+ await watcher?.log(data);
124
+ });
125
+ }
115
126
  async watchQueries(watcher) {
116
127
  if (!this.config.queryWatcher.enabled) return;
117
128
  const handler = this.config.queryWatcher.handler;
@@ -281,6 +292,10 @@ var lens = async (config) => {
281
292
  {
282
293
  enabled: mergedConfig.exceptionWatcherEnabled,
283
294
  watcher: new import_core2.ExceptionWatcher()
295
+ },
296
+ {
297
+ enabled: mergedConfig.mailWatcherEnabled,
298
+ watcher: new import_core2.MailWatcher()
284
299
  }
285
300
  ];
286
301
  defaultWatchers.forEach((watcher) => {
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  ExceptionWatcher,
5
5
  Lens,
6
6
  lensUtils as lensUtils2,
7
+ MailWatcher as MailWatcher2,
7
8
  QueryWatcher as QueryWatcher2,
8
9
  RequestWatcher as RequestWatcher2
9
10
  } from "@lensjs/core";
@@ -49,6 +50,11 @@ var ExpressAdapter = class extends LensAdapter {
49
50
  void this.watchCache(watcher);
50
51
  }
51
52
  break;
53
+ case WatcherTypeEnum.MAIL:
54
+ if (this.config.mailWatcherEnabled) {
55
+ void this.watchMail(watcher);
56
+ }
57
+ break;
52
58
  }
53
59
  }
54
60
  }
@@ -89,6 +95,12 @@ var ExpressAdapter = class extends LensAdapter {
89
95
  await watcher?.log(data);
90
96
  });
91
97
  }
98
+ async watchMail(watcher) {
99
+ if (!this.config.mailWatcherEnabled) return;
100
+ lensEmitter.on("mail", async (data) => {
101
+ await watcher?.log(data);
102
+ });
103
+ }
92
104
  async watchQueries(watcher) {
93
105
  if (!this.config.queryWatcher.enabled) return;
94
106
  const handler = this.config.queryWatcher.handler;
@@ -258,6 +270,10 @@ var lens = async (config) => {
258
270
  {
259
271
  enabled: mergedConfig.exceptionWatcherEnabled,
260
272
  watcher: new ExceptionWatcher()
273
+ },
274
+ {
275
+ enabled: mergedConfig.mailWatcherEnabled,
276
+ watcher: new MailWatcher2()
261
277
  }
262
278
  ];
263
279
  defaultWatchers.forEach((watcher) => {
@@ -9,6 +9,7 @@ type ExpressAdapterConfig = {
9
9
  requestWatcherEnabled?: boolean;
10
10
  cacheWatcherEnabled?: boolean;
11
11
  exceptionWatcherEnabled?: boolean;
12
+ mailWatcherEnabled?: boolean;
12
13
  queryWatcher?: {
13
14
  enabled: boolean;
14
15
  handler: QueryWatcherHandler;
@@ -9,6 +9,7 @@ type ExpressAdapterConfig = {
9
9
  requestWatcherEnabled?: boolean;
10
10
  cacheWatcherEnabled?: boolean;
11
11
  exceptionWatcherEnabled?: boolean;
12
+ mailWatcherEnabled?: boolean;
12
13
  queryWatcher?: {
13
14
  enabled: boolean;
14
15
  handler: QueryWatcherHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensjs/express",
3
- "version": "1.4.3",
3
+ "version": "1.5.0",
4
4
  "description": "Express adapter for LensJs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -38,14 +38,14 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "express": "^5.1.0",
42
- "@lensjs/core": "2.4.0",
41
+ "express": "^5.2.1",
42
+ "@lensjs/core": "2.6.0",
43
43
  "@lensjs/date": "1.0.12",
44
44
  "@lensjs/typescript-config": "1.0.12",
45
- "@lensjs/watchers": "1.1.3"
45
+ "@lensjs/watchers": "1.2.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/express": "^5.0.3",
48
+ "@types/express": "^5.0.6",
49
49
  "supertest": "^7.1.4",
50
50
  "vitest": "^3.2.4"
51
51
  },