@minimaltech/node-infra 0.5.10-2 → 0.5.10-21
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/configs/tsconfig.common.json +4 -7
- package/dist/base/controllers/crud.controller.d.ts +1 -0
- package/dist/base/controllers/crud.controller.d.ts.map +1 -1
- package/dist/base/controllers/crud.controller.js +17 -7
- package/dist/base/controllers/crud.controller.js.map +1 -1
- package/dist/base/repositories/base.repository.d.ts +17 -0
- package/dist/base/repositories/base.repository.d.ts.map +1 -1
- package/dist/base/repositories/base.repository.js +30 -0
- package/dist/base/repositories/base.repository.js.map +1 -1
- package/dist/base/repositories/relations/has-many-polymorphic/factory.d.ts +3 -3
- package/dist/base/repositories/relations/has-many-polymorphic/factory.d.ts.map +1 -1
- package/dist/base/repositories/relations/has-many-polymorphic/types.d.ts +2 -2
- package/dist/base/repositories/relations/has-many-polymorphic/types.d.ts.map +1 -1
- package/dist/base/repositories/relations/has-many-through-polymorphic/decorator.d.ts +12 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/decorator.d.ts.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/decorator.js +25 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/decorator.js.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/factory.d.ts +39 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/factory.d.ts.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/factory.js +194 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/factory.js.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/index.d.ts +4 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/index.d.ts.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/index.js +20 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/index.js.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/types.d.ts +11 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/types.d.ts.map +1 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/types.js +3 -0
- package/dist/base/repositories/relations/has-many-through-polymorphic/types.js.map +1 -0
- package/dist/base/repositories/relations/index.d.ts +1 -0
- package/dist/base/repositories/relations/index.d.ts.map +1 -1
- package/dist/base/repositories/relations/index.js +1 -0
- package/dist/base/repositories/relations/index.js.map +1 -1
- package/dist/base/repositories/searchable-tz-crud.repository.d.ts +7 -0
- package/dist/base/repositories/searchable-tz-crud.repository.d.ts.map +1 -1
- package/dist/base/repositories/searchable-tz-crud.repository.js +77 -23
- package/dist/base/repositories/searchable-tz-crud.repository.js.map +1 -1
- package/dist/base/repositories/tz-crud.repository.d.ts +4 -1
- package/dist/base/repositories/tz-crud.repository.d.ts.map +1 -1
- package/dist/base/repositories/tz-crud.repository.js +2 -2
- package/dist/base/repositories/tz-crud.repository.js.map +1 -1
- package/dist/components/authenticate/common/types.d.ts +9 -1
- package/dist/components/authenticate/common/types.d.ts.map +1 -1
- package/dist/components/authenticate/common/types.js +50 -9
- package/dist/components/authenticate/common/types.js.map +1 -1
- package/dist/components/authenticate/component.d.ts.map +1 -1
- package/dist/components/authenticate/component.js +1 -0
- package/dist/components/authenticate/component.js.map +1 -1
- package/dist/components/authenticate/controllers/oauth2.controller.d.ts +5 -3
- package/dist/components/authenticate/controllers/oauth2.controller.d.ts.map +1 -1
- package/dist/components/authenticate/controllers/oauth2.controller.js +44 -13
- package/dist/components/authenticate/controllers/oauth2.controller.js.map +1 -1
- package/dist/components/authenticate/index.d.ts +1 -0
- package/dist/components/authenticate/index.d.ts.map +1 -1
- package/dist/components/authenticate/index.js +1 -0
- package/dist/components/authenticate/index.js.map +1 -1
- package/dist/components/authenticate/services/oauth2.service.d.ts +4 -1
- package/dist/components/authenticate/services/oauth2.service.d.ts.map +1 -1
- package/dist/components/authenticate/services/oauth2.service.js +18 -7
- package/dist/components/authenticate/services/oauth2.service.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/mail/common/constants.d.ts +26 -0
- package/dist/components/mail/common/constants.d.ts.map +1 -0
- package/dist/components/mail/common/constants.js +37 -0
- package/dist/components/mail/common/constants.js.map +1 -0
- package/dist/components/mail/common/index.d.ts +4 -0
- package/dist/components/mail/common/index.d.ts.map +1 -0
- package/dist/components/mail/common/index.js +20 -0
- package/dist/components/mail/common/index.js.map +1 -0
- package/dist/components/mail/common/keys.d.ts +17 -0
- package/dist/components/mail/common/keys.d.ts.map +1 -0
- package/dist/components/mail/common/keys.js +24 -0
- package/dist/components/mail/common/keys.js.map +1 -0
- package/dist/components/mail/common/types.d.ts +168 -0
- package/dist/components/mail/common/types.d.ts.map +1 -0
- package/dist/components/mail/common/types.js +10 -0
- package/dist/components/mail/common/types.js.map +1 -0
- package/dist/components/mail/component.d.ts +12 -0
- package/dist/components/mail/component.d.ts.map +1 -0
- package/dist/components/mail/component.js +90 -0
- package/dist/components/mail/component.js.map +1 -0
- package/dist/components/mail/controllers/index.d.ts +2 -0
- package/dist/components/mail/controllers/index.d.ts.map +1 -0
- package/dist/components/mail/controllers/index.js +18 -0
- package/dist/components/mail/controllers/index.js.map +1 -0
- package/dist/components/mail/controllers/mail.controller.d.ts +24 -0
- package/dist/components/mail/controllers/mail.controller.d.ts.map +1 -0
- package/dist/components/mail/controllers/mail.controller.js +330 -0
- package/dist/components/mail/controllers/mail.controller.js.map +1 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.d.ts +48 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.js +159 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.js.map +1 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.d.ts +14 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.js +27 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.js.map +1 -0
- package/dist/components/mail/helpers/executors/index.d.ts +4 -0
- package/dist/components/mail/helpers/executors/index.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/index.js +20 -0
- package/dist/components/mail/helpers/executors/index.js.map +1 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +22 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js +103 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -0
- package/dist/components/mail/helpers/index.d.ts +3 -0
- package/dist/components/mail/helpers/index.d.ts.map +1 -0
- package/dist/components/mail/helpers/index.js +19 -0
- package/dist/components/mail/helpers/index.js.map +1 -0
- package/dist/components/mail/helpers/transports/index.d.ts +3 -0
- package/dist/components/mail/helpers/transports/index.d.ts.map +1 -0
- package/dist/components/mail/helpers/transports/index.js +19 -0
- package/dist/components/mail/helpers/transports/index.js.map +1 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.d.ts +11 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.js +88 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.js.map +1 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.d.ts +11 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.js +67 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.js.map +1 -0
- package/dist/components/mail/index.d.ts +8 -0
- package/dist/components/mail/index.d.ts.map +1 -0
- package/dist/components/mail/index.js +24 -0
- package/dist/components/mail/index.js.map +1 -0
- package/dist/components/mail/providers/index.d.ts +3 -0
- package/dist/components/mail/providers/index.d.ts.map +1 -0
- package/dist/components/mail/providers/index.js +19 -0
- package/dist/components/mail/providers/index.js.map +1 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.d.ts +9 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.d.ts.map +1 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.js +41 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.js.map +1 -0
- package/dist/components/mail/providers/mail-transport.provider.d.ts +15 -0
- package/dist/components/mail/providers/mail-transport.provider.d.ts.map +1 -0
- package/dist/components/mail/providers/mail-transport.provider.js +93 -0
- package/dist/components/mail/providers/mail-transport.provider.js.map +1 -0
- package/dist/components/mail/services/generator.service.d.ts +14 -0
- package/dist/components/mail/services/generator.service.d.ts.map +1 -0
- package/dist/components/mail/services/generator.service.js +70 -0
- package/dist/components/mail/services/generator.service.js.map +1 -0
- package/dist/components/mail/services/index.d.ts +4 -0
- package/dist/components/mail/services/index.d.ts.map +1 -0
- package/dist/components/mail/services/index.js +20 -0
- package/dist/components/mail/services/index.js.map +1 -0
- package/dist/components/mail/services/mail.service.d.ts +23 -0
- package/dist/components/mail/services/mail.service.d.ts.map +1 -0
- package/dist/components/mail/services/mail.service.js +178 -0
- package/dist/components/mail/services/mail.service.js.map +1 -0
- package/dist/components/mail/services/template-engine.service.d.ts +36 -0
- package/dist/components/mail/services/template-engine.service.d.ts.map +1 -0
- package/dist/components/mail/services/template-engine.service.js +126 -0
- package/dist/components/mail/services/template-engine.service.js.map +1 -0
- package/dist/components/mail/utilities/index.d.ts +3 -0
- package/dist/components/mail/utilities/index.d.ts.map +1 -0
- package/dist/components/mail/utilities/index.js +19 -0
- package/dist/components/mail/utilities/index.js.map +1 -0
- package/dist/components/mail/utilities/type.utility.d.ts +5 -0
- package/dist/components/mail/utilities/type.utility.d.ts.map +1 -0
- package/dist/components/mail/utilities/type.utility.js +34 -0
- package/dist/components/mail/utilities/type.utility.js.map +1 -0
- package/dist/components/mail/utilities/verification.utility.d.ts +3 -0
- package/dist/components/mail/utilities/verification.utility.d.ts.map +1 -0
- package/dist/components/mail/utilities/verification.utility.js +11 -0
- package/dist/components/mail/utilities/verification.utility.js.map +1 -0
- package/dist/helpers/queue/mqtt.helper.d.ts +4 -0
- package/dist/helpers/queue/mqtt.helper.d.ts.map +1 -1
- package/dist/helpers/queue/mqtt.helper.js +18 -0
- package/dist/helpers/queue/mqtt.helper.js.map +1 -1
- package/dist/helpers/testing/describe.d.ts +1 -1
- package/dist/helpers/testing/describe.d.ts.map +1 -1
- package/dist/helpers/testing/describe.js +9 -8
- package/dist/helpers/testing/describe.js.map +1 -1
- package/dist/helpers/testing/test-handler.d.ts +1 -1
- package/dist/helpers/testing/test-handler.d.ts.map +1 -1
- package/dist/helpers/testing/test-handler.js +1 -1
- package/dist/helpers/testing/test-handler.js.map +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/module.utility.d.ts +5 -0
- package/dist/utilities/module.utility.d.ts.map +1 -0
- package/dist/utilities/module.utility.js +21 -0
- package/dist/utilities/module.utility.js.map +1 -0
- package/package.json +31 -24
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var MailController_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.MailController = void 0;
|
|
17
|
+
const controllers_1 = require("../../../base/controllers");
|
|
18
|
+
const core_1 = require("@loopback/core");
|
|
19
|
+
const rest_1 = require("@loopback/rest");
|
|
20
|
+
const common_1 = require("../common");
|
|
21
|
+
let MailController = MailController_1 = class MailController extends controllers_1.BaseController {
|
|
22
|
+
constructor(mailService, templateEngine) {
|
|
23
|
+
super({ scope: MailController_1.name });
|
|
24
|
+
this.mailService = mailService;
|
|
25
|
+
this.templateEngine = templateEngine;
|
|
26
|
+
}
|
|
27
|
+
async send(message) {
|
|
28
|
+
return this.mailService.send(message);
|
|
29
|
+
}
|
|
30
|
+
async sendBatch(messages) {
|
|
31
|
+
return this.mailService.sendBatch(messages);
|
|
32
|
+
}
|
|
33
|
+
async sendTemplate(payload) {
|
|
34
|
+
const { templateName, to, data, options } = payload;
|
|
35
|
+
return this.mailService.sendTemplate({ templateName, data, recipients: to, options });
|
|
36
|
+
}
|
|
37
|
+
async listTemplates() {
|
|
38
|
+
return this.templateEngine.listTemplates();
|
|
39
|
+
}
|
|
40
|
+
async getTemplate(name) {
|
|
41
|
+
const template = this.templateEngine.getTemplate(name);
|
|
42
|
+
if (!template) {
|
|
43
|
+
return { error: `Template not found: ${name}` };
|
|
44
|
+
}
|
|
45
|
+
return template;
|
|
46
|
+
}
|
|
47
|
+
async verify() {
|
|
48
|
+
const isVerified = await this.mailService.verify();
|
|
49
|
+
return { isVerified };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.MailController = MailController;
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, rest_1.post)('/send', {
|
|
55
|
+
responses: {
|
|
56
|
+
'200': {
|
|
57
|
+
description: 'Email sent successfully',
|
|
58
|
+
content: {
|
|
59
|
+
'application/json': {
|
|
60
|
+
schema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
success: { type: 'boolean' },
|
|
64
|
+
messageId: { type: 'string' },
|
|
65
|
+
response: { type: 'object' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
__param(0, (0, rest_1.requestBody)({
|
|
74
|
+
content: {
|
|
75
|
+
'application/json': {
|
|
76
|
+
schema: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
required: ['to', 'subject'],
|
|
79
|
+
properties: {
|
|
80
|
+
from: { type: 'string' },
|
|
81
|
+
to: {
|
|
82
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
83
|
+
},
|
|
84
|
+
cc: {
|
|
85
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
86
|
+
},
|
|
87
|
+
bcc: {
|
|
88
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
89
|
+
},
|
|
90
|
+
replyTo: { type: 'string' },
|
|
91
|
+
subject: { type: 'string' },
|
|
92
|
+
text: { type: 'string' },
|
|
93
|
+
html: { type: 'string' },
|
|
94
|
+
attachments: {
|
|
95
|
+
type: 'array',
|
|
96
|
+
items: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
properties: {
|
|
99
|
+
filename: { type: 'string' },
|
|
100
|
+
contentType: { type: 'string' },
|
|
101
|
+
path: { type: 'string' },
|
|
102
|
+
content: { type: 'string' },
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
})),
|
|
111
|
+
__metadata("design:type", Function),
|
|
112
|
+
__metadata("design:paramtypes", [Object]),
|
|
113
|
+
__metadata("design:returntype", Promise)
|
|
114
|
+
], MailController.prototype, "send", null);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, rest_1.post)('/send-batch', {
|
|
117
|
+
responses: {
|
|
118
|
+
'200': {
|
|
119
|
+
description: 'Batch emails sent',
|
|
120
|
+
content: {
|
|
121
|
+
'application/json': {
|
|
122
|
+
schema: {
|
|
123
|
+
type: 'array',
|
|
124
|
+
items: {
|
|
125
|
+
type: 'object',
|
|
126
|
+
properties: {
|
|
127
|
+
success: { type: 'boolean' },
|
|
128
|
+
messageId: { type: 'string' },
|
|
129
|
+
error: { type: 'string' },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
}),
|
|
138
|
+
__param(0, (0, rest_1.requestBody)({
|
|
139
|
+
content: {
|
|
140
|
+
'application/json': {
|
|
141
|
+
schema: {
|
|
142
|
+
type: 'array',
|
|
143
|
+
items: {
|
|
144
|
+
type: 'object',
|
|
145
|
+
required: ['to', 'subject'],
|
|
146
|
+
properties: {
|
|
147
|
+
to: { type: 'string' },
|
|
148
|
+
subject: { type: 'string' },
|
|
149
|
+
text: { type: 'string' },
|
|
150
|
+
html: { type: 'string' },
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
})),
|
|
157
|
+
__metadata("design:type", Function),
|
|
158
|
+
__metadata("design:paramtypes", [Array]),
|
|
159
|
+
__metadata("design:returntype", Promise)
|
|
160
|
+
], MailController.prototype, "sendBatch", null);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, rest_1.post)('/send-template', {
|
|
163
|
+
responses: {
|
|
164
|
+
'200': {
|
|
165
|
+
description: 'Template email sent successfully',
|
|
166
|
+
content: {
|
|
167
|
+
'application/json': {
|
|
168
|
+
schema: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
success: { type: 'boolean' },
|
|
172
|
+
messageId: { type: 'string' },
|
|
173
|
+
response: { type: 'object' },
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
'404': {
|
|
180
|
+
description: 'Template not found',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
184
|
+
__param(0, (0, rest_1.requestBody)({
|
|
185
|
+
content: {
|
|
186
|
+
'application/json': {
|
|
187
|
+
schema: {
|
|
188
|
+
type: 'object',
|
|
189
|
+
required: ['templateName', 'to', 'data'],
|
|
190
|
+
properties: {
|
|
191
|
+
templateName: {
|
|
192
|
+
type: 'string',
|
|
193
|
+
description: 'Name of the registered template to use',
|
|
194
|
+
},
|
|
195
|
+
to: {
|
|
196
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
197
|
+
description: 'Recipient email address(es)',
|
|
198
|
+
},
|
|
199
|
+
data: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
description: 'Template variables/data',
|
|
202
|
+
additionalProperties: true,
|
|
203
|
+
},
|
|
204
|
+
options: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
description: 'Additional email options',
|
|
207
|
+
properties: {
|
|
208
|
+
from: { type: 'string' },
|
|
209
|
+
cc: {
|
|
210
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
211
|
+
},
|
|
212
|
+
bcc: {
|
|
213
|
+
oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
214
|
+
},
|
|
215
|
+
replyTo: { type: 'string' },
|
|
216
|
+
subject: {
|
|
217
|
+
type: 'string',
|
|
218
|
+
description: 'Override template subject',
|
|
219
|
+
},
|
|
220
|
+
attachments: {
|
|
221
|
+
type: 'array',
|
|
222
|
+
items: {
|
|
223
|
+
type: 'object',
|
|
224
|
+
properties: {
|
|
225
|
+
filename: { type: 'string' },
|
|
226
|
+
contentType: { type: 'string' },
|
|
227
|
+
path: { type: 'string' },
|
|
228
|
+
content: { type: 'string' },
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
requireValidate: { type: 'boolean' },
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
})),
|
|
240
|
+
__metadata("design:type", Function),
|
|
241
|
+
__metadata("design:paramtypes", [Object]),
|
|
242
|
+
__metadata("design:returntype", Promise)
|
|
243
|
+
], MailController.prototype, "sendTemplate", null);
|
|
244
|
+
__decorate([
|
|
245
|
+
(0, rest_1.get)('template-engine', {
|
|
246
|
+
responses: {
|
|
247
|
+
'200': {
|
|
248
|
+
description: 'List all registered templates',
|
|
249
|
+
content: {
|
|
250
|
+
'application/json': {
|
|
251
|
+
schema: {
|
|
252
|
+
type: 'array',
|
|
253
|
+
items: {
|
|
254
|
+
type: 'object',
|
|
255
|
+
properties: {
|
|
256
|
+
name: { type: 'string' },
|
|
257
|
+
type: { type: 'string' },
|
|
258
|
+
subject: { type: 'string' },
|
|
259
|
+
description: { type: 'string' },
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
__metadata("design:type", Function),
|
|
269
|
+
__metadata("design:paramtypes", []),
|
|
270
|
+
__metadata("design:returntype", Promise)
|
|
271
|
+
], MailController.prototype, "listTemplates", null);
|
|
272
|
+
__decorate([
|
|
273
|
+
(0, rest_1.get)('template-engine/{name}', {
|
|
274
|
+
responses: {
|
|
275
|
+
'200': {
|
|
276
|
+
description: 'Get template information',
|
|
277
|
+
content: {
|
|
278
|
+
'application/json': {
|
|
279
|
+
schema: {
|
|
280
|
+
type: 'object',
|
|
281
|
+
properties: {
|
|
282
|
+
name: { type: 'string' },
|
|
283
|
+
type: { type: 'string' },
|
|
284
|
+
subject: { type: 'string' },
|
|
285
|
+
description: { type: 'string' },
|
|
286
|
+
content: { type: 'string' },
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
'404': {
|
|
293
|
+
description: 'Template not found',
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
}),
|
|
297
|
+
__param(0, rest_1.param.path.string('name')),
|
|
298
|
+
__metadata("design:type", Function),
|
|
299
|
+
__metadata("design:paramtypes", [String]),
|
|
300
|
+
__metadata("design:returntype", Promise)
|
|
301
|
+
], MailController.prototype, "getTemplate", null);
|
|
302
|
+
__decorate([
|
|
303
|
+
(0, rest_1.post)('/verify', {
|
|
304
|
+
responses: {
|
|
305
|
+
'200': {
|
|
306
|
+
description: 'Mail transport verification result',
|
|
307
|
+
content: {
|
|
308
|
+
'application/json': {
|
|
309
|
+
schema: {
|
|
310
|
+
type: 'object',
|
|
311
|
+
properties: {
|
|
312
|
+
verified: { type: 'boolean' },
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
}),
|
|
320
|
+
__metadata("design:type", Function),
|
|
321
|
+
__metadata("design:paramtypes", []),
|
|
322
|
+
__metadata("design:returntype", Promise)
|
|
323
|
+
], MailController.prototype, "verify", null);
|
|
324
|
+
exports.MailController = MailController = MailController_1 = __decorate([
|
|
325
|
+
(0, rest_1.api)({ basePath: '/mails' }),
|
|
326
|
+
__param(0, (0, core_1.inject)(common_1.MailKeys.MAIL_SERVICE)),
|
|
327
|
+
__param(1, (0, core_1.inject)(common_1.MailKeys.MAIL_TEMPLATE_ENGINE)),
|
|
328
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
329
|
+
], MailController);
|
|
330
|
+
//# sourceMappingURL=mail.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail.controller.js","sourceRoot":"","sources":["../../../../src/components/mail/controllers/m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AE;YACT,KAAK,EAAE;gBACL,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE;oBACP,kBAAkB,EAAE;wBAClB,MAAM,EAAE;4BACN,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;6BAC9B;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC;;;;4CAID;yBApSU,cAAc;IAD1B,IAAA,UAAG,EAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAGvB,WAAA,IAAA,aAAM,EAAC,iBAAQ,CAAC,YAAY,CAAC,CAAA;IAE7B,WAAA,IAAA,aAAM,EAAC,iBAAQ,CAAC,oBAAoB,CAAC,CAAA;;GAJ7B,cAAc,CAqS1B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseHelper } from '../../../../base/base.helper';
|
|
2
|
+
import { TConstValue } from '../../../../common';
|
|
3
|
+
import { BullMQExecutorModes, IMailQueueExecutor, IMailQueueOptions, IMailQueueResult } from '../../../../components/mail';
|
|
4
|
+
import { IRedisHelperOptions } from '../../../../helpers';
|
|
5
|
+
export interface IBullMQMailExecutorOpts {
|
|
6
|
+
redis: IRedisHelperOptions;
|
|
7
|
+
queue: {
|
|
8
|
+
identifier: string;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
mode: TConstValue<typeof BullMQExecutorModes>;
|
|
12
|
+
}
|
|
13
|
+
export declare class BullMQMailExecutorHelper extends BaseHelper implements IMailQueueExecutor {
|
|
14
|
+
private queueIdentifier;
|
|
15
|
+
private queueName;
|
|
16
|
+
private mode;
|
|
17
|
+
private queueHelper?;
|
|
18
|
+
private workerHelpers;
|
|
19
|
+
private redisConnection;
|
|
20
|
+
private jobIdCounter;
|
|
21
|
+
private processor?;
|
|
22
|
+
constructor(opts: IBullMQMailExecutorOpts);
|
|
23
|
+
initQueue(queue: {
|
|
24
|
+
identifier: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}): void;
|
|
27
|
+
setProcessor(processor: (email: string) => Promise<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
expiresInMinutes: number;
|
|
31
|
+
nextResendAt?: string;
|
|
32
|
+
}>, opts?: {
|
|
33
|
+
numberOfWorkers?: number;
|
|
34
|
+
concurrencyPerWorker?: number;
|
|
35
|
+
lockDuration?: number;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
addWorker(opts: {
|
|
38
|
+
workerIdentifier: string;
|
|
39
|
+
concurrency?: number;
|
|
40
|
+
lockDuration?: number;
|
|
41
|
+
}): void;
|
|
42
|
+
removeWorker(index: number): Promise<boolean>;
|
|
43
|
+
clearWorkers(): Promise<void>;
|
|
44
|
+
getWorkerCount(): number;
|
|
45
|
+
getMode(): TConstValue<typeof BullMQExecutorModes>;
|
|
46
|
+
enqueueVerificationEmail(email: string, options?: IMailQueueOptions): Promise<IMailQueueResult>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=bullmq-executor.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bullmq-executor.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/executors/bullmq-executor.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,mBAAmB,EAEnB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAgB,mBAAmB,EAAe,MAAM,WAAW,CAAC;AAY3E,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,IAAI,EAAE,WAAW,CAAC,OAAO,mBAA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OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAmD7B"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BullMQMailExecutorHelper = void 0;
|
|
4
|
+
const base_helper_1 = require("../../../../base/base.helper");
|
|
5
|
+
const mail_1 = require("../../../../components/mail");
|
|
6
|
+
const helpers_1 = require("../../../../helpers");
|
|
7
|
+
const utilities_1 = require("../../../../utilities");
|
|
8
|
+
class BullMQMailExecutorHelper extends base_helper_1.BaseHelper {
|
|
9
|
+
constructor(opts) {
|
|
10
|
+
super({ scope: BullMQMailExecutorHelper.name });
|
|
11
|
+
this.workerHelpers = [];
|
|
12
|
+
this.jobIdCounter = 0;
|
|
13
|
+
this.mode = opts.mode;
|
|
14
|
+
this.redisConnection = new helpers_1.RedisHelper({
|
|
15
|
+
...opts.redis,
|
|
16
|
+
maxRetry: null,
|
|
17
|
+
});
|
|
18
|
+
this.queueIdentifier = opts.queue.identifier;
|
|
19
|
+
this.queueName = opts.queue.name;
|
|
20
|
+
this.initQueue(opts.queue);
|
|
21
|
+
}
|
|
22
|
+
initQueue(queue) {
|
|
23
|
+
switch (this.mode) {
|
|
24
|
+
case mail_1.BullMQExecutorModes.QUEUE_ONLY:
|
|
25
|
+
case mail_1.BullMQExecutorModes.BOTH: {
|
|
26
|
+
this.queueHelper = new helpers_1.BullMQHelper({
|
|
27
|
+
identifier: queue.identifier,
|
|
28
|
+
queueName: queue.name,
|
|
29
|
+
connection: this.redisConnection.getClient(),
|
|
30
|
+
role: 'queue',
|
|
31
|
+
});
|
|
32
|
+
this.logger.info('[constructor] BullMQ queue executor initialized (queue enabled) | Identifier: %s | Mode: %s', this.queueIdentifier, this.mode);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
this.logger.info('[constructor] BullMQ queue executor initialized (worker-only mode) | Identifier: %s | Mode: %s', this.queueIdentifier, this.mode);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async setProcessor(processor, opts) {
|
|
42
|
+
this.processor = processor;
|
|
43
|
+
if (this.mode === mail_1.BullMQExecutorModes.QUEUE_ONLY) {
|
|
44
|
+
this.logger.warn('[setProcessor] Skipping worker creation in queue-only mode. Workers will not be started.');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const numberOfWorkers = opts?.numberOfWorkers ?? 1;
|
|
48
|
+
const concurrencyPerWorker = opts?.concurrencyPerWorker ?? 5;
|
|
49
|
+
const lockDuration = opts?.lockDuration ?? 30000;
|
|
50
|
+
await this.clearWorkers();
|
|
51
|
+
for (let i = 0; i < numberOfWorkers; i++) {
|
|
52
|
+
this.addWorker({
|
|
53
|
+
workerIdentifier: `${this.queueIdentifier}-worker-${i}`,
|
|
54
|
+
concurrency: concurrencyPerWorker,
|
|
55
|
+
lockDuration,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
this.logger.info('[setProcessor] Processor registered | Mode: %s | Workers: %d | Concurrency per worker: %d', this.mode, numberOfWorkers, concurrencyPerWorker);
|
|
59
|
+
}
|
|
60
|
+
addWorker(opts) {
|
|
61
|
+
if (!this.processor) {
|
|
62
|
+
throw (0, utilities_1.getError)({ message: 'Processor not set. Call setProcessor() first.' });
|
|
63
|
+
}
|
|
64
|
+
const workerIdentifier = opts.workerIdentifier;
|
|
65
|
+
const concurrency = opts?.concurrency ?? 5;
|
|
66
|
+
const lockDuration = opts?.lockDuration ?? 30000;
|
|
67
|
+
const workerHelper = new helpers_1.BullMQHelper({
|
|
68
|
+
identifier: workerIdentifier,
|
|
69
|
+
queueName: this.queueName,
|
|
70
|
+
connection: this.redisConnection.getClient(),
|
|
71
|
+
role: 'worker',
|
|
72
|
+
numberOfWorker: concurrency,
|
|
73
|
+
lockDuration,
|
|
74
|
+
onWorkerData: async (job) => {
|
|
75
|
+
const maxAttempts = job.data.options?.attempts ?? 3;
|
|
76
|
+
this.logger.info('[onWorkerData] Processing job | Worker: %s | jobId: %s | email: %s | attempt: %d/%d', workerIdentifier, job.data.id, job.data.email, job.attemptsMade + 1, maxAttempts);
|
|
77
|
+
return this.processor(job.data.email);
|
|
78
|
+
},
|
|
79
|
+
onWorkerDataCompleted: async (job) => {
|
|
80
|
+
this.logger.info('[onWorkerDataCompleted] Job completed | Worker: %s | jobId: %s | email: %s', workerIdentifier, job.data.id, job.data.email);
|
|
81
|
+
},
|
|
82
|
+
onWorkerDataFail: async (job, error) => {
|
|
83
|
+
if (job) {
|
|
84
|
+
const maxAttempts = job.data.options?.attempts ?? 3;
|
|
85
|
+
this.logger.error('[onWorkerDataFail] Job failed | Worker: %s | jobId: %s | email: %s | attempt: %d/%d | error: %s', workerIdentifier, job.data.id, job.data.email, job.attemptsMade, maxAttempts, error.message);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.logger.error('[onWorkerDataFail] Worker error (no job) | Worker: %s | error: %s', workerIdentifier, error.message);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
this.workerHelpers.push(workerHelper);
|
|
93
|
+
this.logger.info('[addWorker] Worker added | Identifier: %s | Concurrency: %d | Total workers: %d', workerIdentifier, concurrency, this.workerHelpers.length);
|
|
94
|
+
}
|
|
95
|
+
async removeWorker(index) {
|
|
96
|
+
if (index < 0 || index >= this.workerHelpers.length) {
|
|
97
|
+
this.logger.warn('[removeWorker] Invalid worker index: %d', index);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
await this.workerHelpers[index].worker.close();
|
|
101
|
+
this.workerHelpers.splice(index, 1);
|
|
102
|
+
this.logger.info('[removeWorker] Worker removed | Index: %d | Remaining workers: %d', index, this.workerHelpers.length);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
async clearWorkers() {
|
|
106
|
+
const count = this.workerHelpers.length;
|
|
107
|
+
await Promise.all(this.workerHelpers.map(workerHelper => workerHelper.worker.close()));
|
|
108
|
+
this.workerHelpers = [];
|
|
109
|
+
this.logger.info('[clearWorkers] All workers cleared | Count: %d', count);
|
|
110
|
+
}
|
|
111
|
+
getWorkerCount() {
|
|
112
|
+
return this.workerHelpers.length;
|
|
113
|
+
}
|
|
114
|
+
getMode() {
|
|
115
|
+
return this.mode;
|
|
116
|
+
}
|
|
117
|
+
async enqueueVerificationEmail(email, options) {
|
|
118
|
+
if (this.mode === mail_1.BullMQExecutorModes.WORKER_ONLY) {
|
|
119
|
+
throw (0, utilities_1.getError)({
|
|
120
|
+
message: 'Cannot enqueue jobs in worker-only mode. Set mode to "queue-only" or "both".',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (!this.queueHelper) {
|
|
124
|
+
throw (0, utilities_1.getError)({
|
|
125
|
+
message: 'Queue helper not initialized. This should not happen in queue-enabled mode.',
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (!this.processor && this.mode !== mail_1.BullMQExecutorModes.QUEUE_ONLY) {
|
|
129
|
+
throw (0, utilities_1.getError)({ message: 'Processor not set. Call setProcessor() first.' });
|
|
130
|
+
}
|
|
131
|
+
const jobId = `job_${++this.jobIdCounter}_${Date.now()}`;
|
|
132
|
+
const job = {
|
|
133
|
+
id: jobId,
|
|
134
|
+
email,
|
|
135
|
+
options,
|
|
136
|
+
attempts: 0,
|
|
137
|
+
scheduledAt: Date.now() + (options?.delay ?? 0),
|
|
138
|
+
};
|
|
139
|
+
this.logger.info('[enqueueVerificationEmail] Queuing email to BullMQ/Redis | jobId: %s | email: %s | mode: %s', jobId, email, this.mode);
|
|
140
|
+
const bullJob = await this.queueHelper.queue.add('send-verification-email', job, {
|
|
141
|
+
priority: options?.priority,
|
|
142
|
+
delay: options?.delay,
|
|
143
|
+
attempts: options?.attempts ?? 3,
|
|
144
|
+
backoff: {
|
|
145
|
+
type: options?.backoff?.type ?? 'exponential',
|
|
146
|
+
delay: options?.backoff?.delay ?? 1000,
|
|
147
|
+
},
|
|
148
|
+
removeOnComplete: true,
|
|
149
|
+
removeOnFail: false,
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
jobId: bullJob.id ?? jobId,
|
|
153
|
+
queued: true,
|
|
154
|
+
message: 'Email queued successfully (BullMQ/Redis)',
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.BullMQMailExecutorHelper = BullMQMailExecutorHelper;
|
|
159
|
+
//# sourceMappingURL=bullmq-executor.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bullmq-executor.helper.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/executors/bullmq-executor.helper.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD,4CAM2B;AAC3B,uCAA2E;AAC3E,2CAAuC;AAiBvC,MAAa,wBAAyB,SAAQ,wBAAU;IAYtD,YAAY,IAA6B;QACvC,KAAK,CAAC,EAAE,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE,CAAC,CAAC;QAP1C,kBAAa,GAA2D,EAAE,CAAC;QAE3E,iBAAY,GAAG,CAAC,CAAC;QAOvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEtB,IAAI,CAAC,eAAe,GAAG,IAAI,qBAAW,CAAC;YACrC,GAAG,IAAI,CAAC,KAAK;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAEjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,KAA2C;QACnD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,0BAAmB,CAAC,UAAU,CAAC;Y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AC;QAC/E,CAAC;QAED,MAAM,KAAK,GAAG,OAAO,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACzD,MAAM,GAAG,GAAqB;YAC5B,EAAE,EAAE,KAAK;YACT,KAAK;YACL,OAAO;YACP,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,CAAC;SAChD,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,6FAA6F,EAC7F,KAAK,EACL,KAAK,EACL,IAAI,CAAC,IAAI,CACV,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,EAAE;YAC/E,QAAQ,EAAE,OAAO,EAAE,QAAQ;YAC3B,KAAK,EAAE,OAAO,EAAE,KAAK;YACrB,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC;YAChC,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI,aAAa;gBAC7C,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI;aACvC;YACD,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QAEH,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,EAAE,IAAI,KAAK;YAC1B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,0CAA0C;SACpD,CAAC;IACJ,CAAC;CACF;AAxQD,4DAwQC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseHelper } from '../../../../base/base.helper';
|
|
2
|
+
import { IMailQueueExecutor, IMailQueueOptions, IMailQueueResult } from '../../../../components/mail';
|
|
3
|
+
export declare class DirectMailExecutorHelper extends BaseHelper implements IMailQueueExecutor {
|
|
4
|
+
private processor?;
|
|
5
|
+
constructor();
|
|
6
|
+
setProcessor(processor: (email: string) => Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
message: string;
|
|
9
|
+
expiresInMinutes: number;
|
|
10
|
+
nextResendAt?: string;
|
|
11
|
+
}>): void;
|
|
12
|
+
enqueueVerificationEmail(email: string, _options?: IMailQueueOptions): Promise<IMailQueueResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=direct-executor.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-executor.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/executors/direct-executor.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG5F,qBAAa,wBAAyB,SAAQ,UAAW,YAAW,kBAAkB;IACpF,OAAO,CAAC,SAAS,CAAC,CAKf;;IAMH,YAAY,CACV,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;QACpC,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,gBAAgB,EAAE,MAAM,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC,GACD,IAAI;IAID,wBAAwB,CAC5B,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,gBAAgB,CAAC;CAc7B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DirectMailExecutorHelper = void 0;
|
|
4
|
+
const base_helper_1 = require("../../../../base/base.helper");
|
|
5
|
+
const utilities_1 = require("../../../../utilities");
|
|
6
|
+
class DirectMailExecutorHelper extends base_helper_1.BaseHelper {
|
|
7
|
+
constructor() {
|
|
8
|
+
super({ scope: DirectMailExecutorHelper.name });
|
|
9
|
+
}
|
|
10
|
+
setProcessor(processor) {
|
|
11
|
+
this.processor = processor;
|
|
12
|
+
}
|
|
13
|
+
async enqueueVerificationEmail(email, _options) {
|
|
14
|
+
if (!this.processor) {
|
|
15
|
+
throw (0, utilities_1.getError)({ message: 'Processor not set. Call setProcessor() first.' });
|
|
16
|
+
}
|
|
17
|
+
this.logger.info('[enqueueVerificationEmail] Executing immediately (no queue) for: %s', email);
|
|
18
|
+
const result = await this.processor(email);
|
|
19
|
+
return {
|
|
20
|
+
queued: false,
|
|
21
|
+
message: 'Email sent immediately (no queue)',
|
|
22
|
+
result,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.DirectMailExecutorHelper = DirectMailExecutorHelper;
|
|
27
|
+
//# sourceMappingURL=direct-executor.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-executor.helper.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/executors/direct-executor.helper.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD,2CAAuC;AAEvC,MAAa,wBAAyB,SAAQ,wBAAU;IAQtD;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,YAAY,CACV,SAKE;QAEF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,wBAAwB,CAC5B,KAAa,EACb,QAA4B;QAE5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAA,oBAAQ,EAAC,EAAE,OAAO,EAAE,+CAA+C,EAAE,CAAC,CAAC;QAC/E,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qEAAqE,EAAE,KAAK,CAAC,CAAC;QAC/F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE3C,OAAO;YACL,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,mCAAmC;YAC5C,MAAM;SACP,CAAC;IACJ,CAAC;CACF;AAxCD,4DAwCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/executors/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bullmq-executor.helper"), exports);
|
|
18
|
+
__exportStar(require("./direct-executor.helper"), exports);
|
|
19
|
+
__exportStar(require("./internal-queue-executor.helper"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/executors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,2DAAyC;AACzC,mEAAiD"}
|