@fluojs/email 1.0.0-beta.1 → 1.0.0-beta.2
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.ko.md +12 -5
- package/README.md +12 -5
- package/dist/constants.d.ts +13 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +2 -3
- package/dist/queue-entry.d.ts +2 -2
- package/dist/queue-entry.d.ts.map +1 -1
- package/dist/queue-entry.js +1 -1
- package/dist/queue.d.ts +19 -5
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +22 -6
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/README.ko.md
CHANGED
|
@@ -208,7 +208,7 @@ Behavioral contract 메모:
|
|
|
208
208
|
|
|
209
209
|
### 큐 기반 대량 전달
|
|
210
210
|
|
|
211
|
-
`@fluojs/notifications`가 대량 이메일 전달을 백그라운드로 넘겨야 한다면 `QueueLifecycleService`를 주입해 `createEmailNotificationsQueueAdapter(queue)`를
|
|
211
|
+
`@fluojs/notifications`가 대량 이메일 전달을 백그라운드로 넘겨야 한다면 `QueueModule`을 import하고, `QueueLifecycleService`를 주입해 `createEmailNotificationsQueueAdapter(queue)`를 만든 뒤, `EmailNotificationsQueueWorker`를 애플리케이션 provider로 등록합니다. 루트 `EmailModule`은 worker를 자동 등록하지 않으므로 `@fluojs/email/queue`를 import하지 않는 애플리케이션은 런타임에서 `@fluojs/queue`를 필요로 하지 않습니다.
|
|
212
212
|
|
|
213
213
|
```typescript
|
|
214
214
|
import { Module } from '@fluojs/core';
|
|
@@ -216,7 +216,7 @@ import {
|
|
|
216
216
|
EmailModule,
|
|
217
217
|
EMAIL_CHANNEL,
|
|
218
218
|
} from '@fluojs/email';
|
|
219
|
-
import { createEmailNotificationsQueueAdapter } from '@fluojs/email/queue';
|
|
219
|
+
import { createEmailNotificationsQueueAdapter, EmailNotificationsQueueWorker } from '@fluojs/email/queue';
|
|
220
220
|
import { NotificationsModule } from '@fluojs/notifications';
|
|
221
221
|
import { QueueLifecycleService, QueueModule } from '@fluojs/queue';
|
|
222
222
|
|
|
@@ -242,6 +242,7 @@ import { QueueLifecycleService, QueueModule } from '@fluojs/queue';
|
|
|
242
242
|
}),
|
|
243
243
|
}),
|
|
244
244
|
],
|
|
245
|
+
providers: [EmailNotificationsQueueWorker],
|
|
245
246
|
})
|
|
246
247
|
export class AppModule {}
|
|
247
248
|
```
|
|
@@ -256,13 +257,19 @@ export class AppModule {}
|
|
|
256
257
|
|
|
257
258
|
이 기본값은 `@fluojs/email/queue`에서 `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS`로 export되므로, 호출 측에서 커스텀 queue adapter/worker를 만들 때 동일한 계약을 문서화하거나 반영할 수 있습니다.
|
|
258
259
|
|
|
260
|
+
Behavioral contract 메모:
|
|
261
|
+
|
|
262
|
+
- Queue 지원은 opt-in입니다. 루트 `@fluojs/email` 엔트리포인트와 `EmailModule`은 `@fluojs/queue`를 import하거나 `EmailNotificationsQueueWorker`를 등록하거나 queue peer 설치를 요구하지 않습니다.
|
|
263
|
+
- `EmailNotificationsQueueWorker`는 `@fluojs/email/queue`에서 export되며, queue 기반 전달을 활성화하는 애플리케이션이 직접 등록해야 합니다.
|
|
264
|
+
- worker는 `EmailChannel` 전달 semantics를 재사용하므로 transport가 수락된 수신자 0명 또는 `pending`/`rejected` 수신자를 보고하면 queued job이 실패합니다. 따라서 incomplete delivery는 성공한 job으로 승인되지 않고 `@fluojs/queue`의 retry/dead-letter 흐름으로 넘어갑니다.
|
|
265
|
+
|
|
259
266
|
### 의도적인 제한 사항
|
|
260
267
|
|
|
261
268
|
email 패키지는 의도적으로 다음을 **포함하지 않습니다**:
|
|
262
269
|
|
|
263
270
|
- `process.env`에서 transport 자격 증명을 직접 읽는 동작
|
|
264
271
|
- 공유 루트 패키지에 내장된 SMTP 또는 Nodemailer transport 제공
|
|
265
|
-
- `QueueModule` 자동
|
|
272
|
+
- `QueueModule` 설정 또는 queue worker 자동 등록
|
|
266
273
|
- provider 전용 옵션 타입을 `@fluojs/notifications`에 누출하는 것
|
|
267
274
|
|
|
268
275
|
이 제한 사항은 transport 선택, 템플릿 전략, 큐 도입 여부가 애플리케이션 경계에서 명시적으로 결정되도록 하기 위한 package contract의 일부입니다.
|
|
@@ -286,7 +293,7 @@ email 패키지는 의도적으로 다음을 **포함하지 않습니다**:
|
|
|
286
293
|
|
|
287
294
|
### 통합 서브패스
|
|
288
295
|
|
|
289
|
-
- `@fluojs/email/queue`: `createEmailNotificationsQueueAdapter(queue)`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS`
|
|
296
|
+
- `@fluojs/email/queue`: `createEmailNotificationsQueueAdapter(queue)`, `EmailNotificationQueueJob`, `EmailNotificationsQueueWorker`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS`
|
|
290
297
|
|
|
291
298
|
### 상태 및 에러
|
|
292
299
|
|
|
@@ -308,7 +315,7 @@ email 패키지는 의도적으로 다음을 **포함하지 않습니다**:
|
|
|
308
315
|
|
|
309
316
|
| 관심사 | 서브패스 | export |
|
|
310
317
|
| --- | --- | --- |
|
|
311
|
-
| queue 기반 notifications 통합 | `@fluojs/email/queue` | `createEmailNotificationsQueueAdapter(queue)`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS` |
|
|
318
|
+
| queue 기반 notifications 통합 | `@fluojs/email/queue` | `createEmailNotificationsQueueAdapter(queue)`, `EmailNotificationQueueJob`, `EmailNotificationsQueueWorker`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS` |
|
|
312
319
|
|
|
313
320
|
## 관련 패키지
|
|
314
321
|
|
package/README.md
CHANGED
|
@@ -208,7 +208,7 @@ Behavioral contract notes:
|
|
|
208
208
|
|
|
209
209
|
### Queue-backed bulk delivery
|
|
210
210
|
|
|
211
|
-
When `@fluojs/notifications` should offload bulk email delivery to the background, inject `QueueLifecycleService`, call `createEmailNotificationsQueueAdapter(queue)`, and import `
|
|
211
|
+
When `@fluojs/notifications` should offload bulk email delivery to the background, import `QueueModule`, inject `QueueLifecycleService`, call `createEmailNotificationsQueueAdapter(queue)`, and register `EmailNotificationsQueueWorker` as an application provider. The root `EmailModule` does not register the worker automatically, so applications that never import `@fluojs/email/queue` do not need `@fluojs/queue` at runtime.
|
|
212
212
|
|
|
213
213
|
```typescript
|
|
214
214
|
import { Module } from '@fluojs/core';
|
|
@@ -216,7 +216,7 @@ import {
|
|
|
216
216
|
EmailModule,
|
|
217
217
|
EMAIL_CHANNEL,
|
|
218
218
|
} from '@fluojs/email';
|
|
219
|
-
import { createEmailNotificationsQueueAdapter } from '@fluojs/email/queue';
|
|
219
|
+
import { createEmailNotificationsQueueAdapter, EmailNotificationsQueueWorker } from '@fluojs/email/queue';
|
|
220
220
|
import { NotificationsModule } from '@fluojs/notifications';
|
|
221
221
|
import { QueueLifecycleService, QueueModule } from '@fluojs/queue';
|
|
222
222
|
|
|
@@ -242,6 +242,7 @@ import { QueueLifecycleService, QueueModule } from '@fluojs/queue';
|
|
|
242
242
|
}),
|
|
243
243
|
}),
|
|
244
244
|
],
|
|
245
|
+
providers: [EmailNotificationsQueueWorker],
|
|
245
246
|
})
|
|
246
247
|
export class AppModule {}
|
|
247
248
|
```
|
|
@@ -256,13 +257,19 @@ The built-in queue worker contract uses these defaults:
|
|
|
256
257
|
|
|
257
258
|
These defaults are exported from `@fluojs/email/queue` as `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS` so callers can document or mirror them when they build custom queue adapters/workers.
|
|
258
259
|
|
|
260
|
+
Behavioral contract notes:
|
|
261
|
+
|
|
262
|
+
- Queue support is opt-in. The root `@fluojs/email` entrypoint and `EmailModule` do not import `@fluojs/queue`, register `EmailNotificationsQueueWorker`, or require queue peer installation.
|
|
263
|
+
- `EmailNotificationsQueueWorker` is exported from `@fluojs/email/queue` and must be registered by applications that enable queue-backed delivery.
|
|
264
|
+
- The worker reuses `EmailChannel` delivery semantics, so a queued job fails when the underlying transport reports zero accepted recipients or any `pending`/`rejected` recipients. This lets `@fluojs/queue` retry and dead-letter incomplete deliveries instead of acknowledging them as successful jobs.
|
|
265
|
+
|
|
259
266
|
### Intentional limitations
|
|
260
267
|
|
|
261
268
|
The email package intentionally does **not**:
|
|
262
269
|
|
|
263
270
|
- read transport credentials from `process.env`
|
|
264
271
|
- ship a built-in SMTP or Nodemailer transport in the shared root package
|
|
265
|
-
- configure `QueueModule` automatically
|
|
272
|
+
- configure `QueueModule` or register queue workers automatically
|
|
266
273
|
- leak provider-specific option types into `@fluojs/notifications`
|
|
267
274
|
|
|
268
275
|
These limitations are part of the package contract so transport selection, template strategy, and queue rollout stay explicit at the application boundary.
|
|
@@ -286,7 +293,7 @@ These limitations are part of the package contract so transport selection, templ
|
|
|
286
293
|
|
|
287
294
|
### Integration subpaths
|
|
288
295
|
|
|
289
|
-
- `@fluojs/email/queue`: `createEmailNotificationsQueueAdapter(queue)`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS`
|
|
296
|
+
- `@fluojs/email/queue`: `createEmailNotificationsQueueAdapter(queue)`, `EmailNotificationQueueJob`, `EmailNotificationsQueueWorker`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS`
|
|
290
297
|
|
|
291
298
|
### Status and errors
|
|
292
299
|
|
|
@@ -308,7 +315,7 @@ These limitations are part of the package contract so transport selection, templ
|
|
|
308
315
|
|
|
309
316
|
| Concern | Subpath | Exports |
|
|
310
317
|
| --- | --- | --- |
|
|
311
|
-
| Queue-backed notifications integration | `@fluojs/email/queue` | `createEmailNotificationsQueueAdapter(queue)`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS` |
|
|
318
|
+
| Queue-backed notifications integration | `@fluojs/email/queue` | `createEmailNotificationsQueueAdapter(queue)`, `EmailNotificationQueueJob`, `EmailNotificationsQueueWorker`, `DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS` |
|
|
312
319
|
|
|
313
320
|
## Related Packages
|
|
314
321
|
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import type { EmailQueueWorkerOptions } from './types.js';
|
|
2
1
|
/** Stable queue job name used by the email notifications worker contract. */
|
|
3
2
|
export declare const EMAIL_QUEUE_JOB_NAME = "fluo.email.notification";
|
|
4
3
|
/** Default worker options used by the built-in email notifications queue seam. */
|
|
5
|
-
export declare const DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS:
|
|
4
|
+
export declare const DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS: Readonly<{
|
|
5
|
+
attempts: 3;
|
|
6
|
+
backoff: {
|
|
7
|
+
delayMs: number;
|
|
8
|
+
type: "exponential";
|
|
9
|
+
};
|
|
10
|
+
concurrency: 5;
|
|
11
|
+
jobName: "fluo.email.notification";
|
|
12
|
+
rateLimiter: {
|
|
13
|
+
duration: number;
|
|
14
|
+
max: number;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
6
17
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAE9D,kFAAkF;AAClF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;EAY7C,CAAC"}
|
package/dist/module.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class EmailModule {
|
|
|
6
6
|
* Registers email providers using static options.
|
|
7
7
|
*
|
|
8
8
|
* @param options Static email module options including transport wiring and optional template rendering behavior.
|
|
9
|
-
* @returns A global module definition that exports {@link EmailService}, {@link EmailChannel}, and
|
|
9
|
+
* @returns A global module definition that exports {@link EmailService}, {@link EmailChannel}, and email facade tokens.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMhE,OAAO,KAAK,EAGV,uBAAuB,EAGvB,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAyHpB,kFAAkF;AAClF,qBAAa,WAAW;IACtB;;;;;;;;;;;;;;;;QAgBI;IACJ,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,UAAU;IAIvD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU;CAGlE"}
|
package/dist/module.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineModule } from '@fluojs/runtime';
|
|
2
2
|
import { EmailConfigurationError } from './errors.js';
|
|
3
3
|
import { EmailChannel } from './channel.js';
|
|
4
|
-
import { EmailNotificationsQueueWorker } from './queue.js';
|
|
5
4
|
import { EmailService } from './service.js';
|
|
6
5
|
import { EMAIL, EMAIL_CHANNEL, EMAIL_OPTIONS } from './tokens.js';
|
|
7
6
|
function normalizeAddress(address) {
|
|
@@ -52,7 +51,7 @@ function normalizeEmailModuleOptions(options) {
|
|
|
52
51
|
};
|
|
53
52
|
}
|
|
54
53
|
function createEmailRuntimeProviders(optionsProvider) {
|
|
55
|
-
return [optionsProvider, EmailService, EmailChannel,
|
|
54
|
+
return [optionsProvider, EmailService, EmailChannel, {
|
|
56
55
|
inject: [EmailService],
|
|
57
56
|
provide: EMAIL,
|
|
58
57
|
useFactory: service => ({
|
|
@@ -108,7 +107,7 @@ export class EmailModule {
|
|
|
108
107
|
* Registers email providers using static options.
|
|
109
108
|
*
|
|
110
109
|
* @param options Static email module options including transport wiring and optional template rendering behavior.
|
|
111
|
-
* @returns A global module definition that exports {@link EmailService}, {@link EmailChannel}, and
|
|
110
|
+
* @returns A global module definition that exports {@link EmailService}, {@link EmailChannel}, and email facade tokens.
|
|
112
111
|
*
|
|
113
112
|
* @example
|
|
114
113
|
* ```ts
|
package/dist/queue-entry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS } from './constants.js';
|
|
2
|
-
export { createEmailNotificationsQueueAdapter } from './queue.js';
|
|
3
|
-
export type { EmailQueueWorkerOptions } from './
|
|
2
|
+
export { EmailNotificationQueueJob, EmailNotificationsQueueWorker, createEmailNotificationsQueueAdapter } from './queue.js';
|
|
3
|
+
export type { EmailQueueWorkerOptions } from './queue.js';
|
|
4
4
|
//# sourceMappingURL=queue-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-entry.d.ts","sourceRoot":"","sources":["../src/queue-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"queue-entry.d.ts","sourceRoot":"","sources":["../src/queue-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAC5H,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/queue-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS } from './constants.js';
|
|
2
|
-
export { createEmailNotificationsQueueAdapter } from './queue.js';
|
|
2
|
+
export { EmailNotificationQueueJob, EmailNotificationsQueueWorker, createEmailNotificationsQueueAdapter } from './queue.js';
|
package/dist/queue.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { NotificationsQueueAdapter } from '@fluojs/notifications';
|
|
2
|
-
import { QueueLifecycleService } from '@fluojs/queue';
|
|
3
|
-
import {
|
|
2
|
+
import { type QueueLifecycleService, type QueueWorkerOptions } from '@fluojs/queue';
|
|
3
|
+
import { EmailChannel } from './channel.js';
|
|
4
4
|
import type { EmailNotificationDispatchRequest } from './types.js';
|
|
5
|
+
/** Queue worker execution defaults used by the built-in notifications queue integration. */
|
|
6
|
+
export type EmailQueueWorkerOptions = QueueWorkerOptions;
|
|
5
7
|
/** Serialized queue payload used by the built-in notifications queue adapter. */
|
|
6
8
|
export declare class EmailNotificationQueueJob {
|
|
7
9
|
readonly notification: EmailNotificationDispatchRequest;
|
|
8
10
|
readonly queuedAt: string;
|
|
11
|
+
/**
|
|
12
|
+
* Creates one queued email notification job payload.
|
|
13
|
+
*
|
|
14
|
+
* @param notification Notification envelope that will be delivered by the email channel worker.
|
|
15
|
+
* @param queuedAt ISO timestamp captured when the notifications foundation delegated the job.
|
|
16
|
+
*/
|
|
9
17
|
constructor(notification: EmailNotificationDispatchRequest, queuedAt: string);
|
|
10
18
|
}
|
|
11
19
|
/**
|
|
@@ -29,10 +37,16 @@ export declare class EmailNotificationQueueJob {
|
|
|
29
37
|
* ```
|
|
30
38
|
*/
|
|
31
39
|
export declare function createEmailNotificationsQueueAdapter(queue: QueueLifecycleService): NotificationsQueueAdapter;
|
|
32
|
-
/**
|
|
40
|
+
/** Queue worker that converts queued notification jobs back into email delivery. */
|
|
33
41
|
export declare class EmailNotificationsQueueWorker {
|
|
34
|
-
private readonly
|
|
35
|
-
constructor(
|
|
42
|
+
private readonly channel;
|
|
43
|
+
constructor(channel: EmailChannel);
|
|
44
|
+
/**
|
|
45
|
+
* Delivers one queued email notification through the same channel semantics as direct dispatch.
|
|
46
|
+
*
|
|
47
|
+
* @param job Queued notification payload created by `createEmailNotificationsQueueAdapter(...)`.
|
|
48
|
+
* @returns A promise that resolves only when email delivery is accepted by the channel contract.
|
|
49
|
+
*/
|
|
36
50
|
handle(job: EmailNotificationQueueJob): Promise<void>;
|
|
37
51
|
}
|
|
38
52
|
//# sourceMappingURL=queue.d.ts.map
|
package/dist/queue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAyB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAyB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAe,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGjG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAEnE,4FAA4F;AAC5F,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAEzD,iFAAiF;AACjF,qBAAa,yBAAyB;aAQlB,YAAY,EAAE,gCAAgC;aAC9C,QAAQ,EAAE,MAAM;IARlC;;;;;OAKG;gBAEe,YAAY,EAAE,gCAAgC,EAC9C,QAAQ,EAAE,MAAM;CAEnC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,qBAAqB,GAAG,yBAAyB,CAW5G;AAED,oFAAoF;AACpF,qBAEa,6BAA6B;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,YAAY;IAElD;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5D"}
|
package/dist/queue.js
CHANGED
|
@@ -7,9 +7,18 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
7
7
|
import { Inject } from '@fluojs/core';
|
|
8
8
|
import { QueueWorker } from '@fluojs/queue';
|
|
9
9
|
import { DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS } from './constants.js';
|
|
10
|
-
import {
|
|
10
|
+
import { EmailChannel } from './channel.js';
|
|
11
|
+
|
|
12
|
+
/** Queue worker execution defaults used by the built-in notifications queue integration. */
|
|
13
|
+
|
|
11
14
|
/** Serialized queue payload used by the built-in notifications queue adapter. */
|
|
12
15
|
export class EmailNotificationQueueJob {
|
|
16
|
+
/**
|
|
17
|
+
* Creates one queued email notification job payload.
|
|
18
|
+
*
|
|
19
|
+
* @param notification Notification envelope that will be delivered by the email channel worker.
|
|
20
|
+
* @param queuedAt ISO timestamp captured when the notifications foundation delegated the job.
|
|
21
|
+
*/
|
|
13
22
|
constructor(notification, queuedAt) {
|
|
14
23
|
this.notification = notification;
|
|
15
24
|
this.queuedAt = queuedAt;
|
|
@@ -47,17 +56,24 @@ export function createEmailNotificationsQueueAdapter(queue) {
|
|
|
47
56
|
};
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
/**
|
|
59
|
+
/** Queue worker that converts queued notification jobs back into email delivery. */
|
|
51
60
|
let _EmailNotificationsQu;
|
|
52
61
|
class EmailNotificationsQueueWorker {
|
|
53
62
|
static {
|
|
54
|
-
[_EmailNotificationsQu, _initClass] = _applyDecs(this, [QueueWorker(EmailNotificationQueueJob, DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS), Inject(
|
|
63
|
+
[_EmailNotificationsQu, _initClass] = _applyDecs(this, [QueueWorker(EmailNotificationQueueJob, DEFAULT_EMAIL_QUEUE_WORKER_OPTIONS), Inject(EmailChannel)], []).c;
|
|
55
64
|
}
|
|
56
|
-
constructor(
|
|
57
|
-
this.
|
|
65
|
+
constructor(channel) {
|
|
66
|
+
this.channel = channel;
|
|
58
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Delivers one queued email notification through the same channel semantics as direct dispatch.
|
|
71
|
+
*
|
|
72
|
+
* @param job Queued notification payload created by `createEmailNotificationsQueueAdapter(...)`.
|
|
73
|
+
* @returns A promise that resolves only when email delivery is accepted by the channel contract.
|
|
74
|
+
*/
|
|
59
75
|
async handle(job) {
|
|
60
|
-
await this.
|
|
76
|
+
await this.channel.send(job.notification, {});
|
|
61
77
|
}
|
|
62
78
|
static {
|
|
63
79
|
_initClass();
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AsyncModuleOptions, MaybePromise } from '@fluojs/core';
|
|
2
2
|
import type { NotificationDispatchRequest } from '@fluojs/notifications';
|
|
3
|
-
import type { QueueBackoffOptions, QueueRateLimiterOptions } from '@fluojs/queue';
|
|
4
3
|
/** RFC 5322-style email address with an optional display name. */
|
|
5
4
|
export interface EmailAddress {
|
|
6
5
|
address: string;
|
|
@@ -176,14 +175,6 @@ export interface EmailSendOptions {
|
|
|
176
175
|
export interface EmailSendManyOptions extends EmailSendOptions {
|
|
177
176
|
continueOnError?: boolean;
|
|
178
177
|
}
|
|
179
|
-
/** Queue worker execution defaults used by the built-in notifications queue integration. */
|
|
180
|
-
export interface EmailQueueWorkerOptions {
|
|
181
|
-
attempts?: number;
|
|
182
|
-
backoff?: QueueBackoffOptions;
|
|
183
|
-
concurrency?: number;
|
|
184
|
-
jobName?: string;
|
|
185
|
-
rateLimiter?: QueueRateLimiterOptions;
|
|
186
|
-
}
|
|
187
178
|
/** Module options accepted by {@link EmailModule.forRoot} and `forRootAsync`. */
|
|
188
179
|
export interface EmailModuleOptions {
|
|
189
180
|
defaultFrom?: EmailAddressLike;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,YAAY,CAAC;AAErD,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,GAAG,CAAC,EAAE,gBAAgB,GAAG,SAAS,gBAAgB,EAAE,CAAC;IACrD,EAAE,CAAC,EAAE,gBAAgB,GAAG,SAAS,gBAAgB,EAAE,CAAC;IACpD,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO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AAQ,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE3G;;;;;;OAMG;IACH,gBAAgB,CACd,YAAY,EAAE,gCAAgC,EAC9C,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7B"}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"queue",
|
|
11
11
|
"mailer"
|
|
12
12
|
],
|
|
13
|
-
"version": "1.0.0-beta.
|
|
13
|
+
"version": "1.0.0-beta.2",
|
|
14
14
|
"private": false,
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"repository": {
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"dist"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@fluojs/
|
|
56
|
-
"@fluojs/
|
|
57
|
-
"@fluojs/
|
|
58
|
-
"@fluojs/
|
|
55
|
+
"@fluojs/di": "^1.0.0-beta.2",
|
|
56
|
+
"@fluojs/notifications": "^1.0.0-beta.2",
|
|
57
|
+
"@fluojs/runtime": "^1.0.0-beta.2",
|
|
58
|
+
"@fluojs/core": "^1.0.0-beta.1"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"nodemailer": "^6.10.1",
|