@minimaltech/node-infra 0.5.10-20 → 0.5.10-22
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/components/authenticate/common/types.d.ts +33 -0
- package/dist/components/authenticate/common/types.d.ts.map +1 -1
- package/dist/components/authenticate/common/types.js +5 -0
- package/dist/components/authenticate/common/types.js.map +1 -1
- package/dist/components/authenticate/controllers/oauth2.controller.d.ts +41 -0
- package/dist/components/authenticate/controllers/oauth2.controller.d.ts.map +1 -1
- package/dist/components/authenticate/controllers/oauth2.controller.js +25 -3
- package/dist/components/authenticate/controllers/oauth2.controller.js.map +1 -1
- package/dist/components/authenticate/models/oauth2-scope.model.d.ts +6 -2
- package/dist/components/authenticate/models/oauth2-scope.model.d.ts.map +1 -1
- package/dist/components/authenticate/models/oauth2-scope.model.js +47 -0
- package/dist/components/authenticate/models/oauth2-scope.model.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.d.ts.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.js +20 -13
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/base.d.ts +22 -5
- package/dist/components/authenticate/oauth2-handlers/base.d.ts.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/base.js +103 -28
- package/dist/components/authenticate/oauth2-handlers/base.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/config/index.d.ts +2 -0
- package/dist/components/authenticate/oauth2-handlers/config/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/config/index.js +18 -0
- package/dist/components/authenticate/oauth2-handlers/config/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.d.ts +46 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.js +199 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.d.ts +2 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.js +18 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.d.ts +79 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.js +117 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.d.ts +2 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.js +18 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.d.ts +99 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.js +371 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/index.d.ts +4 -0
- package/dist/components/authenticate/oauth2-handlers/index.d.ts.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/index.js +4 -0
- package/dist/components/authenticate/oauth2-handlers/index.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/scope/index.d.ts +4 -0
- package/dist/components/authenticate/oauth2-handlers/scope/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/index.js +20 -0
- package/dist/components/authenticate/oauth2-handlers/scope/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.d.ts +64 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.js +100 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.d.ts +49 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.js +89 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.d.ts +58 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.js +165 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.js.map +1 -0
- package/dist/components/authenticate/services/index.d.ts +1 -0
- package/dist/components/authenticate/services/index.d.ts.map +1 -1
- package/dist/components/authenticate/services/index.js +1 -0
- package/dist/components/authenticate/services/index.js.map +1 -1
- package/dist/components/authenticate/services/oauth2-scope.service.d.ts +22 -0
- package/dist/components/authenticate/services/oauth2-scope.service.d.ts.map +1 -0
- package/dist/components/authenticate/services/oauth2-scope.service.js +63 -0
- package/dist/components/authenticate/services/oauth2-scope.service.js.map +1 -0
- package/dist/components/authenticate/services/oauth2.service.d.ts +2 -0
- package/dist/components/authenticate/services/oauth2.service.d.ts.map +1 -1
- package/dist/components/authenticate/services/oauth2.service.js +8 -3
- package/dist/components/authenticate/services/oauth2.service.js.map +1 -1
- package/dist/components/authenticate/views/pages/auth.ejs +6 -2
- 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/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 +14 -1
|
@@ -0,0 +1,90 @@
|
|
|
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 MailComponent_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.MailComponent = void 0;
|
|
17
|
+
const applications_1 = require("../../base/applications");
|
|
18
|
+
const base_component_1 = require("../../base/base.component");
|
|
19
|
+
const utilities_1 = require("../../utilities");
|
|
20
|
+
const core_1 = require("@loopback/core");
|
|
21
|
+
const common_1 = require("./common");
|
|
22
|
+
const providers_1 = require("./providers");
|
|
23
|
+
const services_1 = require("./services");
|
|
24
|
+
let MailComponent = MailComponent_1 = class MailComponent extends base_component_1.BaseComponent {
|
|
25
|
+
constructor(application) {
|
|
26
|
+
super({ scope: MailComponent_1.name });
|
|
27
|
+
this.application = application;
|
|
28
|
+
this.init();
|
|
29
|
+
}
|
|
30
|
+
initGenerators() {
|
|
31
|
+
this.application.bind(common_1.MailKeys.MAIL_VERIFICATION_CODE_GENERATOR).toClass(services_1.NumericCodeGenerator);
|
|
32
|
+
this.application.bind(common_1.MailKeys.MAIL_VERIFICATION_TOKEN_GENERATOR).toClass(services_1.RandomTokenGenerator);
|
|
33
|
+
this.application
|
|
34
|
+
.bind(common_1.MailKeys.MAIL_VERIFICATION_DATA_GENERATOR)
|
|
35
|
+
.toClass(services_1.DefaultVerificationDataGenerator);
|
|
36
|
+
}
|
|
37
|
+
initProviders() {
|
|
38
|
+
this.application
|
|
39
|
+
.bind(common_1.MailKeys.MAIL_TRANSPORT_PROVIDER)
|
|
40
|
+
.toProvider(providers_1.MailTransportProvider)
|
|
41
|
+
.inScope(core_1.BindingScope.SINGLETON);
|
|
42
|
+
this.application
|
|
43
|
+
.bind(common_1.MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER)
|
|
44
|
+
.toProvider(providers_1.MailQueueExecutorProvider)
|
|
45
|
+
.inScope(core_1.BindingScope.SINGLETON);
|
|
46
|
+
}
|
|
47
|
+
initServices() {
|
|
48
|
+
this.application
|
|
49
|
+
.bind(common_1.MailKeys.MAIL_SERVICE)
|
|
50
|
+
.toClass(services_1.MailService)
|
|
51
|
+
.inScope(core_1.BindingScope.SINGLETON);
|
|
52
|
+
this.application
|
|
53
|
+
.bind(common_1.MailKeys.MAIL_TEMPLATE_ENGINE)
|
|
54
|
+
.toClass(services_1.TemplateEngineService)
|
|
55
|
+
.inScope(core_1.BindingScope.SINGLETON);
|
|
56
|
+
}
|
|
57
|
+
createAndBindInstances() {
|
|
58
|
+
// Transport
|
|
59
|
+
const transportGetter = this.application.getSync(common_1.MailKeys.MAIL_TRANSPORT_PROVIDER);
|
|
60
|
+
const mailOptions = this.application.getSync(common_1.MailKeys.MAIL_OPTIONS);
|
|
61
|
+
this.logger.info('[createAndBindInstances] Mail Options: %j', mailOptions);
|
|
62
|
+
const mailTransportInstance = transportGetter(mailOptions);
|
|
63
|
+
this.application.bind(common_1.MailKeys.MAIL_TRANSPORT_INSTANCE).to(mailTransportInstance);
|
|
64
|
+
// Queue
|
|
65
|
+
const queueGetter = this.application.getSync(common_1.MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER);
|
|
66
|
+
const queueConf = this.application.getSync(common_1.MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG);
|
|
67
|
+
this.logger.info('[createAndBindInstances] Mail Queue Executor Config: %j', queueConf);
|
|
68
|
+
const queueExecutorInstance = queueGetter(queueConf);
|
|
69
|
+
this.application.bind(common_1.MailKeys.MAIL_QUEUE_EXECUTOR_INSTANCE).to(queueExecutorInstance);
|
|
70
|
+
}
|
|
71
|
+
init() {
|
|
72
|
+
if (!this.application.isBound(common_1.MailKeys.MAIL_OPTIONS)) {
|
|
73
|
+
this.logger.error('[binding] Mail options not configured. Please bind MailKeys.MAIL_OPTIONS before adding MailComponent.');
|
|
74
|
+
throw (0, utilities_1.getError)({
|
|
75
|
+
message: 'Mail options not configured',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
this.initGenerators();
|
|
79
|
+
this.initProviders();
|
|
80
|
+
this.initServices();
|
|
81
|
+
this.createAndBindInstances();
|
|
82
|
+
this.logger.info('[binding] Mail component initialized successfully');
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.MailComponent = MailComponent;
|
|
86
|
+
exports.MailComponent = MailComponent = MailComponent_1 = __decorate([
|
|
87
|
+
__param(0, (0, core_1.inject)(core_1.CoreBindings.APPLICATION_INSTANCE)),
|
|
88
|
+
__metadata("design:paramtypes", [applications_1.BaseApplication])
|
|
89
|
+
], MailComponent);
|
|
90
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/mail/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,0DAAsD;AACtD,2CAAuC;AACvC,yCAAoE;AACpE,qCAAoC;AACpC,2CAA+E;AAC/E,yCAMoB;AAEpB,IAAa,aAAa,qBAA1B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AAC,YAAY,EAAE,CAAC;QAEpB,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAE9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IACxE,CAAC;CACF,CAAA;AA5EY,sCAAa;wBAAb,aAAa;IAErB,WAAA,IAAA,aAAM,EAAC,mBAAY,CAAC,oBAAoB,CAAC,CAAA;qCACnB,8BAAe;GAH7B,aAAa,CA4EzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/controllers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./mail.controller"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/mail/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseController } from '../../../base/controllers';
|
|
2
|
+
import { IMailMessage, IMailSendResult, IMailService, IMailTemplateEngine, ITemplate } from '../common';
|
|
3
|
+
import { AnyType } from '../../../common';
|
|
4
|
+
export declare class MailController extends BaseController {
|
|
5
|
+
private mailService;
|
|
6
|
+
private templateEngine;
|
|
7
|
+
constructor(mailService: IMailService, templateEngine: IMailTemplateEngine);
|
|
8
|
+
send(message: IMailMessage): Promise<IMailSendResult>;
|
|
9
|
+
sendBatch(messages: IMailMessage[]): Promise<IMailSendResult[]>;
|
|
10
|
+
sendTemplate(payload: {
|
|
11
|
+
templateName: string;
|
|
12
|
+
to: string | string[];
|
|
13
|
+
data: Record<string, AnyType>;
|
|
14
|
+
options?: Partial<IMailMessage>;
|
|
15
|
+
}): Promise<IMailSendResult>;
|
|
16
|
+
listTemplates(): Promise<ITemplate[]>;
|
|
17
|
+
getTemplate(name: string): Promise<ITemplate | {
|
|
18
|
+
error: string;
|
|
19
|
+
}>;
|
|
20
|
+
verify(): Promise<{
|
|
21
|
+
isVerified: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=mail.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail.controller.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/controllers/mail.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,SAAS,EAEV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBACa,cAAe,SAAQ,cAAc;IAG9C,OAAO,CAAC,WAAW;IAEnB,OAAO,CAAC,cAAc;gBAFd,WAAW,EAAE,YAAY,EAEzB,cAAc,EAAE,mBAAmB;IAwBvC,IAAI,CAuCR,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,eAAe,CAAC;IA0BrB,SAAS,CAoBb,QAAQ,EAAE,YAAY,EAAE,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC;IA0BvB,YAAY,CAyDhB,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;KACjC,GACA,OAAO,CAAC,eAAe,CAAC;IA6BrB,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IA4BrC,WAAW,CACY,IAAI,EAAE,MAAM,GACtC,OAAO,CAAC,SAAS,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAyBnC,MAAM,IAAI,OAAO,CAAC;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;CAIjD"}
|
|
@@ -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/mail.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,o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ACjD,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,mBAAmB,CAAC,CAAC;CAC/C;AAED,qBAAa,wBAAyB,SAAQ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