@lensjs/fastify 1.1.3 → 1.2.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 FastifyAdapter = 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
  }
@@ -110,6 +115,12 @@ var FastifyAdapter = class extends import_core.LensAdapter {
110
115
  await watcher?.log(data);
111
116
  });
112
117
  }
118
+ async watchMail(watcher) {
119
+ if (!this.config.mailWatcherEnabled) return;
120
+ import_core.lensEmitter.on("mail", async (data) => {
121
+ await watcher?.log(data);
122
+ });
123
+ }
113
124
  async watchQueries(watcher) {
114
125
  if (!this.config.queryWatcher?.enabled) return;
115
126
  const handler = this.config.queryWatcher.handler;
@@ -15,6 +15,7 @@ declare class FastifyAdapter extends LensAdapter {
15
15
  registerRoutes(routes: RouteDefinition[]): void;
16
16
  serveUI(uiPath: string, spaRoute: string, _dataToInject: Record<string, any>): void;
17
17
  private watchCache;
18
+ private watchMail;
18
19
  private watchQueries;
19
20
  private watchRequests;
20
21
  private finalizeRequestLog;
package/dist/adapter.d.ts CHANGED
@@ -15,6 +15,7 @@ declare class FastifyAdapter extends LensAdapter {
15
15
  registerRoutes(routes: RouteDefinition[]): void;
16
16
  serveUI(uiPath: string, spaRoute: string, _dataToInject: Record<string, any>): void;
17
17
  private watchCache;
18
+ private watchMail;
18
19
  private watchQueries;
19
20
  private watchRequests;
20
21
  private finalizeRequestLog;
package/dist/adapter.js CHANGED
@@ -39,6 +39,11 @@ var FastifyAdapter = 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
  }
@@ -82,6 +87,12 @@ var FastifyAdapter = class extends LensAdapter {
82
87
  await watcher?.log(data);
83
88
  });
84
89
  }
90
+ async watchMail(watcher) {
91
+ if (!this.config.mailWatcherEnabled) return;
92
+ lensEmitter.on("mail", async (data) => {
93
+ await watcher?.log(data);
94
+ });
95
+ }
85
96
  async watchQueries(watcher) {
86
97
  if (!this.config.queryWatcher?.enabled) return;
87
98
  const handler = this.config.queryWatcher.handler;
package/dist/index.cjs CHANGED
@@ -71,6 +71,11 @@ var FastifyAdapter = class extends import_core.LensAdapter {
71
71
  void this.watchCache(watcher);
72
72
  }
73
73
  break;
74
+ case import_core.WatcherTypeEnum.MAIL:
75
+ if (this.config.mailWatcherEnabled) {
76
+ void this.watchMail(watcher);
77
+ }
78
+ break;
74
79
  }
75
80
  }
76
81
  }
@@ -114,6 +119,12 @@ var FastifyAdapter = class extends import_core.LensAdapter {
114
119
  await watcher?.log(data);
115
120
  });
116
121
  }
122
+ async watchMail(watcher) {
123
+ if (!this.config.mailWatcherEnabled) return;
124
+ import_core.lensEmitter.on("mail", async (data) => {
125
+ await watcher?.log(data);
126
+ });
127
+ }
117
128
  async watchQueries(watcher) {
118
129
  if (!this.config.queryWatcher?.enabled) return;
119
130
  const handler = this.config.queryWatcher.handler;
@@ -268,7 +279,8 @@ var defaultConfig = {
268
279
  requestWatcherEnabled: true,
269
280
  cacheWatcherEnabled: false,
270
281
  exceptionWatcherEnabled: true,
271
- registerErrorHandler: true
282
+ registerErrorHandler: true,
283
+ mailWatcherEnabled: false
272
284
  };
273
285
  var lens = async (config) => {
274
286
  const adapter = new FastifyAdapter({ app: config.app });
@@ -293,6 +305,10 @@ var lens = async (config) => {
293
305
  {
294
306
  enabled: mergedConfig.exceptionWatcherEnabled,
295
307
  watcher: new import_core2.ExceptionWatcher()
308
+ },
309
+ {
310
+ enabled: mergedConfig.mailWatcherEnabled,
311
+ watcher: new import_core2.MailWatcher()
296
312
  }
297
313
  ];
298
314
  defaultWatchers.forEach((watcher) => {
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  Lens,
6
6
  lensContext as lensContext2,
7
7
  lensUtils as lensUtils2,
8
+ MailWatcher as MailWatcher2,
8
9
  QueryWatcher as QueryWatcher2,
9
10
  RequestWatcher as RequestWatcher2
10
11
  } from "@lensjs/core";
@@ -50,6 +51,11 @@ var FastifyAdapter = class extends LensAdapter {
50
51
  void this.watchCache(watcher);
51
52
  }
52
53
  break;
54
+ case WatcherTypeEnum.MAIL:
55
+ if (this.config.mailWatcherEnabled) {
56
+ void this.watchMail(watcher);
57
+ }
58
+ break;
53
59
  }
54
60
  }
55
61
  }
@@ -93,6 +99,12 @@ var FastifyAdapter = class extends LensAdapter {
93
99
  await watcher?.log(data);
94
100
  });
95
101
  }
102
+ async watchMail(watcher) {
103
+ if (!this.config.mailWatcherEnabled) return;
104
+ lensEmitter.on("mail", async (data) => {
105
+ await watcher?.log(data);
106
+ });
107
+ }
96
108
  async watchQueries(watcher) {
97
109
  if (!this.config.queryWatcher?.enabled) return;
98
110
  const handler = this.config.queryWatcher.handler;
@@ -247,7 +259,8 @@ var defaultConfig = {
247
259
  requestWatcherEnabled: true,
248
260
  cacheWatcherEnabled: false,
249
261
  exceptionWatcherEnabled: true,
250
- registerErrorHandler: true
262
+ registerErrorHandler: true,
263
+ mailWatcherEnabled: false
251
264
  };
252
265
  var lens = async (config) => {
253
266
  const adapter = new FastifyAdapter({ app: config.app });
@@ -272,6 +285,10 @@ var lens = async (config) => {
272
285
  {
273
286
  enabled: mergedConfig.exceptionWatcherEnabled,
274
287
  watcher: new ExceptionWatcher()
288
+ },
289
+ {
290
+ enabled: mergedConfig.mailWatcherEnabled,
291
+ watcher: new MailWatcher2()
275
292
  }
276
293
  ];
277
294
  defaultWatchers.forEach((watcher) => {
package/dist/types.d.cts CHANGED
@@ -10,6 +10,7 @@ type FastifyAdapterConfig = {
10
10
  requestWatcherEnabled?: boolean;
11
11
  cacheWatcherEnabled?: boolean;
12
12
  exceptionWatcherEnabled?: boolean;
13
+ mailWatcherEnabled?: boolean;
13
14
  registerErrorHandler?: boolean;
14
15
  queryWatcher?: {
15
16
  enabled: boolean;
package/dist/types.d.ts CHANGED
@@ -10,6 +10,7 @@ type FastifyAdapterConfig = {
10
10
  requestWatcherEnabled?: boolean;
11
11
  cacheWatcherEnabled?: boolean;
12
12
  exceptionWatcherEnabled?: boolean;
13
+ mailWatcherEnabled?: boolean;
13
14
  registerErrorHandler?: boolean;
14
15
  queryWatcher?: {
15
16
  enabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensjs/fastify",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "Fastify adapter for LensJs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,10 +18,10 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@lensjs/core": "2.4.0",
22
21
  "@lensjs/date": "1.0.12",
23
- "@lensjs/typescript-config": "1.0.12",
24
- "@lensjs/watchers": "1.1.3"
22
+ "@lensjs/core": "2.6.0",
23
+ "@lensjs/watchers": "1.2.0",
24
+ "@lensjs/typescript-config": "1.0.12"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "fastify": "^5.2.1",