@carlonicora/nestjs-neo4jsonapi 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +1 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +20 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/core/email/services/email.service.d.ts +2 -0
- package/dist/core/email/services/email.service.d.ts.map +1 -1
- package/dist/core/email/services/email.service.js +18 -8
- package/dist/core/email/services/email.service.js.map +1 -1
- package/dist/core/email/templates/en/emailAutomation.hbs +24 -0
- package/dist/foundations/auth/events/auth.events.d.ts +7 -0
- package/dist/foundations/auth/events/auth.events.d.ts.map +1 -0
- package/dist/foundations/auth/events/auth.events.js +6 -0
- package/dist/foundations/auth/events/auth.events.js.map +1 -0
- package/dist/foundations/auth/index.d.ts +2 -0
- package/dist/foundations/auth/index.d.ts.map +1 -1
- package/dist/foundations/auth/index.js +3 -1
- package/dist/foundations/auth/index.js.map +1 -1
- package/dist/foundations/auth/services/auth.service.d.ts +3 -1
- package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.service.js +11 -2
- package/dist/foundations/auth/services/auth.service.js.map +1 -1
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.d.ts +22 -0
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.d.ts.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.js +152 -0
- package/dist/foundations/email-automation/controllers/email-automation-step.controller.js.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.d.ts +29 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.d.ts.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.js +183 -0
- package/dist/foundations/email-automation/controllers/email-automation.controller.js.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.d.ts +20 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.d.ts.map +1 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.js +63 -0
- package/dist/foundations/email-automation/controllers/email-automation.public.controller.js.map +1 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.d.ts +9 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.d.ts.map +1 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.js +44 -0
- package/dist/foundations/email-automation/cron/email-automation-sender.cron.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.d.ts +8 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.js +36 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.d.ts +16 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.js +72 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.patch.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.d.ts +21 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.js +88 -0
- package/dist/foundations/email-automation/dtos/email-automation-step.post.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.d.ts +11 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.js +47 -0
- package/dist/foundations/email-automation/dtos/email-automation-unsubscribe.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.d.ts +8 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.js +36 -0
- package/dist/foundations/email-automation/dtos/email-automation.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.d.ts +16 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.js +72 -0
- package/dist/foundations/email-automation/dtos/email-automation.patch.dto.js.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.d.ts +16 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.d.ts.map +1 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.js +72 -0
- package/dist/foundations/email-automation/dtos/email-automation.post.dto.js.map +1 -0
- package/dist/foundations/email-automation/email-automation.module.d.ts +35 -0
- package/dist/foundations/email-automation/email-automation.module.d.ts.map +1 -0
- package/dist/foundations/email-automation/email-automation.module.js +122 -0
- package/dist/foundations/email-automation/email-automation.module.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.d.ts +55 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.js +74 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.d.ts +3 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.js +10 -0
- package/dist/foundations/email-automation/entities/email-automation-enrollment.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.d.ts +32 -0
- package/dist/foundations/email-automation/entities/email-automation-step.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.js +55 -0
- package/dist/foundations/email-automation/entities/email-automation-step.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.d.ts +3 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.js +10 -0
- package/dist/foundations/email-automation/entities/email-automation-step.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.d.ts +11 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.js +15 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.d.ts +6 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.js +13 -0
- package/dist/foundations/email-automation/entities/email-automation-trigger.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.d.ts +26 -0
- package/dist/foundations/email-automation/entities/email-automation.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.js +54 -0
- package/dist/foundations/email-automation/entities/email-automation.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.d.ts +7 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.js +14 -0
- package/dist/foundations/email-automation/entities/email-automation.meta.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.d.ts +9 -0
- package/dist/foundations/email-automation/entities/email-opt-out.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.js +17 -0
- package/dist/foundations/email-automation/entities/email-opt-out.js.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.d.ts +3 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.d.ts.map +1 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.js +10 -0
- package/dist/foundations/email-automation/entities/email-opt-out.meta.js.map +1 -0
- package/dist/foundations/email-automation/index.d.ts +32 -0
- package/dist/foundations/email-automation/index.d.ts.map +1 -0
- package/dist/foundations/email-automation/index.js +56 -0
- package/dist/foundations/email-automation/index.js.map +1 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.d.ts +49 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.d.ts.map +1 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.js +14 -0
- package/dist/foundations/email-automation/interfaces/email-automation.config.interface.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.d.ts +150 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.js +379 -0
- package/dist/foundations/email-automation/repositories/email-automation-enrollment.repository.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.d.ts +64 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.js +156 -0
- package/dist/foundations/email-automation/repositories/email-automation-step.repository.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.d.ts +36 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.js +93 -0
- package/dist/foundations/email-automation/repositories/email-automation.repository.js.map +1 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.d.ts +25 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.d.ts.map +1 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.js +69 -0
- package/dist/foundations/email-automation/repositories/email-opt-out.repository.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.d.ts +35 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.js +109 -0
- package/dist/foundations/email-automation/services/email-automation-renderer.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.d.ts +31 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.js +129 -0
- package/dist/foundations/email-automation/services/email-automation-sender.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.d.ts +60 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.js +101 -0
- package/dist/foundations/email-automation/services/email-automation-step.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.d.ts +28 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.js +125 -0
- package/dist/foundations/email-automation/services/email-automation-trigger.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.d.ts +53 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.js +67 -0
- package/dist/foundations/email-automation/services/email-automation-unsubscribe.service.js.map +1 -0
- package/dist/foundations/email-automation/services/email-automation.service.d.ts +53 -0
- package/dist/foundations/email-automation/services/email-automation.service.d.ts.map +1 -0
- package/dist/foundations/email-automation/services/email-automation.service.js +90 -0
- package/dist/foundations/email-automation/services/email-automation.service.js.map +1 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.d.ts +10 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.d.ts.map +1 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.js +50 -0
- package/dist/foundations/email-automation/triggers/built-in.triggers.js.map +1 -0
- package/dist/foundations/foundations.modules.d.ts +3 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +7 -1
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/index.d.ts +1 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +1 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/waitlist/events/waitlist.events.d.ts +7 -0
- package/dist/foundations/waitlist/events/waitlist.events.d.ts.map +1 -0
- package/dist/foundations/waitlist/events/waitlist.events.js +6 -0
- package/dist/foundations/waitlist/events/waitlist.events.js.map +1 -0
- package/dist/foundations/waitlist/index.d.ts +2 -0
- package/dist/foundations/waitlist/index.d.ts.map +1 -1
- package/dist/foundations/waitlist/index.js +4 -1
- package/dist/foundations/waitlist/index.js.map +1 -1
- package/dist/foundations/waitlist/services/waitlist.service.d.ts +3 -1
- package/dist/foundations/waitlist/services/waitlist.service.d.ts.map +1 -1
- package/dist/foundations/waitlist/services/waitlist.service.js +27 -14
- package/dist/foundations/waitlist/services/waitlist.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EmailAutomationStepController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const system_roles_1 = require("../../../common/constants/system.roles");
|
|
18
|
+
const audit_decorator_1 = require("../../../common/decorators/audit.decorator");
|
|
19
|
+
const cache_invalidate_decorator_1 = require("../../../common/decorators/cache-invalidate.decorator");
|
|
20
|
+
const roles_decorator_1 = require("../../../common/decorators/roles.decorator");
|
|
21
|
+
const validate_id_decorator_1 = require("../../../common/decorators/validate-id.decorator");
|
|
22
|
+
const jwt_auth_admin_guard_1 = require("../../../common/guards/jwt.auth.admin.guard");
|
|
23
|
+
const crud_handlers_1 = require("../../../common/handlers/crud.handlers");
|
|
24
|
+
const cache_service_1 = require("../../../core/cache/services/cache.service");
|
|
25
|
+
const audit_service_1 = require("../../audit/services/audit.service");
|
|
26
|
+
const email_automation_step_dto_1 = require("../dtos/email-automation-step.dto");
|
|
27
|
+
const email_automation_step_patch_dto_1 = require("../dtos/email-automation-step.patch.dto");
|
|
28
|
+
const email_automation_step_post_dto_1 = require("../dtos/email-automation-step.post.dto");
|
|
29
|
+
const email_automation_step_meta_1 = require("../entities/email-automation-step.meta");
|
|
30
|
+
const email_automation_meta_1 = require("../entities/email-automation.meta");
|
|
31
|
+
const email_automation_step_service_1 = require("../services/email-automation-step.service");
|
|
32
|
+
let EmailAutomationStepController = class EmailAutomationStepController {
|
|
33
|
+
constructor(stepService, cacheService, auditService) {
|
|
34
|
+
this.stepService = stepService;
|
|
35
|
+
this.cacheService = cacheService;
|
|
36
|
+
this.auditService = auditService;
|
|
37
|
+
this.crud = (0, crud_handlers_1.createCrudHandlers)(() => this.stepService);
|
|
38
|
+
}
|
|
39
|
+
async create(reply, body) {
|
|
40
|
+
const response = await this.crud.create(reply, body);
|
|
41
|
+
// The parent automation's stepCount changed with the new step
|
|
42
|
+
await this.cacheService.invalidateByElement(email_automation_meta_1.emailAutomationMeta.endpoint, body.data.relationships.automation.data.id);
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
async findById(request, reply, stepId) {
|
|
46
|
+
return this.crud.findById(reply, stepId);
|
|
47
|
+
}
|
|
48
|
+
async patch(request, reply, body) {
|
|
49
|
+
return this.crud.patch(reply, body);
|
|
50
|
+
}
|
|
51
|
+
async delete(request, reply, stepId) {
|
|
52
|
+
const automationId = await this.stepService.deleteStep({ id: stepId });
|
|
53
|
+
// The parent automation's stepCount changed with the removed step
|
|
54
|
+
if (automationId)
|
|
55
|
+
await this.cacheService.invalidateByElement(email_automation_meta_1.emailAutomationMeta.endpoint, automationId);
|
|
56
|
+
reply.send();
|
|
57
|
+
}
|
|
58
|
+
async setNext(request, reply, stepId, body) {
|
|
59
|
+
const response = await this.stepService.setNext({ stepId, nextStepId: body.data.id });
|
|
60
|
+
// The parent automation's step chain changed with the new link
|
|
61
|
+
const automationId = await this.stepService.findAutomationId({ stepId });
|
|
62
|
+
if (automationId)
|
|
63
|
+
await this.cacheService.invalidateByElement(email_automation_meta_1.emailAutomationMeta.endpoint, automationId);
|
|
64
|
+
reply.send(response);
|
|
65
|
+
}
|
|
66
|
+
async clearNext(request, reply, stepId) {
|
|
67
|
+
await this.stepService.setNext({ stepId, nextStepId: null });
|
|
68
|
+
// The parent automation's step chain changed with the removed link
|
|
69
|
+
const automationId = await this.stepService.findAutomationId({ stepId });
|
|
70
|
+
if (automationId)
|
|
71
|
+
await this.cacheService.invalidateByElement(email_automation_meta_1.emailAutomationMeta.endpoint, automationId);
|
|
72
|
+
reply.send();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.EmailAutomationStepController = EmailAutomationStepController;
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, common_1.Post)(email_automation_step_meta_1.emailAutomationStepMeta.endpoint),
|
|
78
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
79
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_step_meta_1.emailAutomationStepMeta),
|
|
80
|
+
__param(0, (0, common_1.Res)()),
|
|
81
|
+
__param(1, (0, common_1.Body)()),
|
|
82
|
+
__metadata("design:type", Function),
|
|
83
|
+
__metadata("design:paramtypes", [Object, email_automation_step_post_dto_1.EmailAutomationStepPostDTO]),
|
|
84
|
+
__metadata("design:returntype", Promise)
|
|
85
|
+
], EmailAutomationStepController.prototype, "create", null);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, common_1.Get)(`${email_automation_step_meta_1.emailAutomationStepMeta.endpoint}/:stepId`),
|
|
88
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
89
|
+
(0, audit_decorator_1.Audit)(email_automation_step_meta_1.emailAutomationStepMeta, "stepId"),
|
|
90
|
+
__param(0, (0, common_1.Req)()),
|
|
91
|
+
__param(1, (0, common_1.Res)()),
|
|
92
|
+
__param(2, (0, common_1.Param)("stepId")),
|
|
93
|
+
__metadata("design:type", Function),
|
|
94
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
95
|
+
__metadata("design:returntype", Promise)
|
|
96
|
+
], EmailAutomationStepController.prototype, "findById", null);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, common_1.Patch)(`${email_automation_step_meta_1.emailAutomationStepMeta.endpoint}/:stepId`),
|
|
99
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
100
|
+
(0, validate_id_decorator_1.ValidateId)("stepId"),
|
|
101
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_step_meta_1.emailAutomationStepMeta, "stepId"),
|
|
102
|
+
__param(0, (0, common_1.Req)()),
|
|
103
|
+
__param(1, (0, common_1.Res)()),
|
|
104
|
+
__param(2, (0, common_1.Body)()),
|
|
105
|
+
__metadata("design:type", Function),
|
|
106
|
+
__metadata("design:paramtypes", [Object, Object, email_automation_step_patch_dto_1.EmailAutomationStepPatchDTO]),
|
|
107
|
+
__metadata("design:returntype", Promise)
|
|
108
|
+
], EmailAutomationStepController.prototype, "patch", null);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, common_1.Delete)(`${email_automation_step_meta_1.emailAutomationStepMeta.endpoint}/:stepId`),
|
|
111
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
112
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
113
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_step_meta_1.emailAutomationStepMeta, "stepId"),
|
|
114
|
+
__param(0, (0, common_1.Req)()),
|
|
115
|
+
__param(1, (0, common_1.Res)()),
|
|
116
|
+
__param(2, (0, common_1.Param)("stepId")),
|
|
117
|
+
__metadata("design:type", Function),
|
|
118
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
119
|
+
__metadata("design:returntype", Promise)
|
|
120
|
+
], EmailAutomationStepController.prototype, "delete", null);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, common_1.Post)(`${email_automation_step_meta_1.emailAutomationStepMeta.endpoint}/:stepId/next`),
|
|
123
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
124
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_step_meta_1.emailAutomationStepMeta, "stepId"),
|
|
125
|
+
__param(0, (0, common_1.Req)()),
|
|
126
|
+
__param(1, (0, common_1.Res)()),
|
|
127
|
+
__param(2, (0, common_1.Param)("stepId")),
|
|
128
|
+
__param(3, (0, common_1.Body)()),
|
|
129
|
+
__metadata("design:type", Function),
|
|
130
|
+
__metadata("design:paramtypes", [Object, Object, String, email_automation_step_dto_1.EmailAutomationStepDataDTO]),
|
|
131
|
+
__metadata("design:returntype", Promise)
|
|
132
|
+
], EmailAutomationStepController.prototype, "setNext", null);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, common_1.Delete)(`${email_automation_step_meta_1.emailAutomationStepMeta.endpoint}/:stepId/next`),
|
|
135
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
136
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
137
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_step_meta_1.emailAutomationStepMeta, "stepId"),
|
|
138
|
+
__param(0, (0, common_1.Req)()),
|
|
139
|
+
__param(1, (0, common_1.Res)()),
|
|
140
|
+
__param(2, (0, common_1.Param)("stepId")),
|
|
141
|
+
__metadata("design:type", Function),
|
|
142
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
143
|
+
__metadata("design:returntype", Promise)
|
|
144
|
+
], EmailAutomationStepController.prototype, "clearNext", null);
|
|
145
|
+
exports.EmailAutomationStepController = EmailAutomationStepController = __decorate([
|
|
146
|
+
(0, common_1.UseGuards)(jwt_auth_admin_guard_1.AdminJwtAuthGuard),
|
|
147
|
+
(0, common_1.Controller)(),
|
|
148
|
+
__metadata("design:paramtypes", [email_automation_step_service_1.EmailAutomationStepService,
|
|
149
|
+
cache_service_1.CacheService,
|
|
150
|
+
audit_service_1.AuditService])
|
|
151
|
+
], EmailAutomationStepController);
|
|
152
|
+
//# sourceMappingURL=email-automation-step.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation-step.controller.js","sourceRoot":"","sources":["../../../../src/foundations/email-automation/controllers/email-automation-step.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAawB;AAExB,yEAAgE;AAChE,gFAAmE;AACnE,sGAAwF;AACxF,gFAAmE;AACnE,4FAA8E;AAC9E,sFAAgF;AAChF,0EAA4E;AAE5E,8EAA0E;AAC1E,sEAAkE;AAClE,iFAA+E;AAC/E,6FAAsF;AACtF,2FAAoF;AACpF,uFAAiF;AACjF,6EAAwE;AACxE,6FAAuF;AAIhF,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAGxC,YACmB,WAAuC,EACvC,YAA0B,EAC1B,YAA0B;QAF1B,gBAAW,GAAX,WAAW,CAA4B;QACvC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAL5B,SAAI,GAAG,IAAA,kCAAkB,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WA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B;;4DASzC;AAMK;IAJL,IAAA,eAAM,EAAC,GAAG,oDAAuB,CAAC,QAAQ,eAAe,CAAC;IAC1D,IAAA,uBAAK,EAAC,qBAAM,CAAC,aAAa,CAAC;IAC3B,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IAC/B,IAAA,4CAAe,EAAC,oDAAuB,EAAE,QAAQ,CAAC;IAClC,WAAA,IAAA,YAAG,GAAE,CAAA;IAAiC,WAAA,IAAA,YAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;;;;8DAQjG;wCAtFU,6BAA6B;IAFzC,IAAA,kBAAS,EAAC,wCAAiB,CAAC;IAC5B,IAAA,mBAAU,GAAE;qCAKqB,0DAA0B;QACzB,4BAAY;QACZ,4BAAY;GANlC,6BAA6B,CAuFzC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FastifyReply } from "fastify";
|
|
2
|
+
import type { AuthenticatedRequest } from "../../../common/interfaces/authenticated.request.interface";
|
|
3
|
+
import { CacheService } from "../../../core/cache/services/cache.service";
|
|
4
|
+
import { AuditService } from "../../audit/services/audit.service";
|
|
5
|
+
import { EmailAutomationPatchDTO } from "../dtos/email-automation.patch.dto";
|
|
6
|
+
import { EmailAutomationPostDTO } from "../dtos/email-automation.post.dto";
|
|
7
|
+
import { EmailAutomationStepService } from "../services/email-automation-step.service";
|
|
8
|
+
import { EmailAutomationService } from "../services/email-automation.service";
|
|
9
|
+
export declare class EmailAutomationController {
|
|
10
|
+
private readonly emailAutomationService;
|
|
11
|
+
private readonly stepService;
|
|
12
|
+
private readonly cacheService;
|
|
13
|
+
private readonly auditService;
|
|
14
|
+
private readonly crud;
|
|
15
|
+
constructor(emailAutomationService: EmailAutomationService, stepService: EmailAutomationStepService, cacheService: CacheService, auditService: AuditService);
|
|
16
|
+
/**
|
|
17
|
+
* Declared before the `:emailAutomationId` routes so "triggers" is never read as an id.
|
|
18
|
+
*/
|
|
19
|
+
findTriggers(reply: FastifyReply): Promise<void>;
|
|
20
|
+
findAll(reply: FastifyReply, query: any, search?: string, fetchAll?: boolean, orderBy?: string): Promise<void>;
|
|
21
|
+
findById(request: AuthenticatedRequest, reply: FastifyReply, emailAutomationId: string): Promise<void>;
|
|
22
|
+
create(reply: FastifyReply, body: EmailAutomationPostDTO): Promise<void>;
|
|
23
|
+
patch(request: AuthenticatedRequest, reply: FastifyReply, body: EmailAutomationPatchDTO): Promise<void>;
|
|
24
|
+
delete(request: AuthenticatedRequest, reply: FastifyReply, emailAutomationId: string): Promise<void>;
|
|
25
|
+
findSteps(reply: FastifyReply, emailAutomationId: string, query: any): Promise<void>;
|
|
26
|
+
findEnrollments(reply: FastifyReply, emailAutomationId: string, query: any, status?: string): Promise<void>;
|
|
27
|
+
tidy(request: AuthenticatedRequest, reply: FastifyReply, emailAutomationId: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=email-automation.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/email-automation/controllers/email-automation.controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAI3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,qBAEa,yBAAyB;IAIlC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,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? 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EmailAutomationController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const system_roles_1 = require("../../../common/constants/system.roles");
|
|
18
|
+
const audit_decorator_1 = require("../../../common/decorators/audit.decorator");
|
|
19
|
+
const cache_invalidate_decorator_1 = require("../../../common/decorators/cache-invalidate.decorator");
|
|
20
|
+
const roles_decorator_1 = require("../../../common/decorators/roles.decorator");
|
|
21
|
+
const validate_id_decorator_1 = require("../../../common/decorators/validate-id.decorator");
|
|
22
|
+
const jwt_auth_admin_guard_1 = require("../../../common/guards/jwt.auth.admin.guard");
|
|
23
|
+
const crud_handlers_1 = require("../../../common/handlers/crud.handlers");
|
|
24
|
+
const cache_service_1 = require("../../../core/cache/services/cache.service");
|
|
25
|
+
const audit_service_1 = require("../../audit/services/audit.service");
|
|
26
|
+
const email_automation_patch_dto_1 = require("../dtos/email-automation.patch.dto");
|
|
27
|
+
const email_automation_post_dto_1 = require("../dtos/email-automation.post.dto");
|
|
28
|
+
const email_automation_enrollment_meta_1 = require("../entities/email-automation-enrollment.meta");
|
|
29
|
+
const email_automation_step_meta_1 = require("../entities/email-automation-step.meta");
|
|
30
|
+
const email_automation_meta_1 = require("../entities/email-automation.meta");
|
|
31
|
+
const email_automation_step_service_1 = require("../services/email-automation-step.service");
|
|
32
|
+
const email_automation_service_1 = require("../services/email-automation.service");
|
|
33
|
+
let EmailAutomationController = class EmailAutomationController {
|
|
34
|
+
constructor(emailAutomationService, stepService, cacheService, auditService) {
|
|
35
|
+
this.emailAutomationService = emailAutomationService;
|
|
36
|
+
this.stepService = stepService;
|
|
37
|
+
this.cacheService = cacheService;
|
|
38
|
+
this.auditService = auditService;
|
|
39
|
+
this.crud = (0, crud_handlers_1.createCrudHandlers)(() => this.emailAutomationService);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Declared before the `:emailAutomationId` routes so "triggers" is never read as an id.
|
|
43
|
+
*/
|
|
44
|
+
async findTriggers(reply) {
|
|
45
|
+
const response = await this.emailAutomationService.listTriggers();
|
|
46
|
+
reply.send(response);
|
|
47
|
+
}
|
|
48
|
+
async findAll(reply, query, search, fetchAll, orderBy) {
|
|
49
|
+
return this.crud.findAll(reply, { query, search, fetchAll, orderBy });
|
|
50
|
+
}
|
|
51
|
+
async findById(request, reply, emailAutomationId) {
|
|
52
|
+
return this.crud.findById(reply, emailAutomationId);
|
|
53
|
+
}
|
|
54
|
+
async create(reply, body) {
|
|
55
|
+
return this.crud.create(reply, body);
|
|
56
|
+
}
|
|
57
|
+
async patch(request, reply, body) {
|
|
58
|
+
return this.crud.patch(reply, body);
|
|
59
|
+
}
|
|
60
|
+
async delete(request, reply, emailAutomationId) {
|
|
61
|
+
return this.crud.delete(reply, emailAutomationId);
|
|
62
|
+
}
|
|
63
|
+
async findSteps(reply, emailAutomationId, query) {
|
|
64
|
+
const response = await this.stepService.findByAutomation({ automationId: emailAutomationId, query });
|
|
65
|
+
reply.send(response);
|
|
66
|
+
}
|
|
67
|
+
async findEnrollments(reply, emailAutomationId, query, status) {
|
|
68
|
+
const response = await this.emailAutomationService.findEnrollments({ id: emailAutomationId, status, query });
|
|
69
|
+
reply.send(response);
|
|
70
|
+
}
|
|
71
|
+
async tidy(request, reply, emailAutomationId) {
|
|
72
|
+
await this.emailAutomationService.tidy({ id: emailAutomationId });
|
|
73
|
+
reply.send();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.EmailAutomationController = EmailAutomationController;
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, common_1.Get)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/triggers`),
|
|
79
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
80
|
+
__param(0, (0, common_1.Res)()),
|
|
81
|
+
__metadata("design:type", Function),
|
|
82
|
+
__metadata("design:paramtypes", [Object]),
|
|
83
|
+
__metadata("design:returntype", Promise)
|
|
84
|
+
], EmailAutomationController.prototype, "findTriggers", null);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, common_1.Get)(email_automation_meta_1.emailAutomationMeta.endpoint),
|
|
87
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
88
|
+
__param(0, (0, common_1.Res)()),
|
|
89
|
+
__param(1, (0, common_1.Query)()),
|
|
90
|
+
__param(2, (0, common_1.Query)("search")),
|
|
91
|
+
__param(3, (0, common_1.Query)("fetchAll")),
|
|
92
|
+
__param(4, (0, common_1.Query)("orderBy")),
|
|
93
|
+
__metadata("design:type", Function),
|
|
94
|
+
__metadata("design:paramtypes", [Object, Object, String, Boolean, String]),
|
|
95
|
+
__metadata("design:returntype", Promise)
|
|
96
|
+
], EmailAutomationController.prototype, "findAll", null);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, common_1.Get)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/:emailAutomationId`),
|
|
99
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
100
|
+
(0, audit_decorator_1.Audit)(email_automation_meta_1.emailAutomationMeta, "emailAutomationId"),
|
|
101
|
+
__param(0, (0, common_1.Req)()),
|
|
102
|
+
__param(1, (0, common_1.Res)()),
|
|
103
|
+
__param(2, (0, common_1.Param)("emailAutomationId")),
|
|
104
|
+
__metadata("design:type", Function),
|
|
105
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
106
|
+
__metadata("design:returntype", Promise)
|
|
107
|
+
], EmailAutomationController.prototype, "findById", null);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, common_1.Post)(email_automation_meta_1.emailAutomationMeta.endpoint),
|
|
110
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
111
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_meta_1.emailAutomationMeta),
|
|
112
|
+
__param(0, (0, common_1.Res)()),
|
|
113
|
+
__param(1, (0, common_1.Body)()),
|
|
114
|
+
__metadata("design:type", Function),
|
|
115
|
+
__metadata("design:paramtypes", [Object, email_automation_post_dto_1.EmailAutomationPostDTO]),
|
|
116
|
+
__metadata("design:returntype", Promise)
|
|
117
|
+
], EmailAutomationController.prototype, "create", null);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, common_1.Patch)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/:emailAutomationId`),
|
|
120
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
121
|
+
(0, validate_id_decorator_1.ValidateId)("emailAutomationId"),
|
|
122
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_meta_1.emailAutomationMeta, "emailAutomationId"),
|
|
123
|
+
__param(0, (0, common_1.Req)()),
|
|
124
|
+
__param(1, (0, common_1.Res)()),
|
|
125
|
+
__param(2, (0, common_1.Body)()),
|
|
126
|
+
__metadata("design:type", Function),
|
|
127
|
+
__metadata("design:paramtypes", [Object, Object, email_automation_patch_dto_1.EmailAutomationPatchDTO]),
|
|
128
|
+
__metadata("design:returntype", Promise)
|
|
129
|
+
], EmailAutomationController.prototype, "patch", null);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, common_1.Delete)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/:emailAutomationId`),
|
|
132
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
133
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
134
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_meta_1.emailAutomationMeta, "emailAutomationId"),
|
|
135
|
+
__param(0, (0, common_1.Req)()),
|
|
136
|
+
__param(1, (0, common_1.Res)()),
|
|
137
|
+
__param(2, (0, common_1.Param)("emailAutomationId")),
|
|
138
|
+
__metadata("design:type", Function),
|
|
139
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
140
|
+
__metadata("design:returntype", Promise)
|
|
141
|
+
], EmailAutomationController.prototype, "delete", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, common_1.Get)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/:emailAutomationId/${email_automation_step_meta_1.emailAutomationStepMeta.endpoint}`),
|
|
144
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
145
|
+
__param(0, (0, common_1.Res)()),
|
|
146
|
+
__param(1, (0, common_1.Param)("emailAutomationId")),
|
|
147
|
+
__param(2, (0, common_1.Query)()),
|
|
148
|
+
__metadata("design:type", Function),
|
|
149
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
150
|
+
__metadata("design:returntype", Promise)
|
|
151
|
+
], EmailAutomationController.prototype, "findSteps", null);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, common_1.Get)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/:emailAutomationId/${email_automation_enrollment_meta_1.emailAutomationEnrollmentMeta.endpoint}`),
|
|
154
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
155
|
+
__param(0, (0, common_1.Res)()),
|
|
156
|
+
__param(1, (0, common_1.Param)("emailAutomationId")),
|
|
157
|
+
__param(2, (0, common_1.Query)()),
|
|
158
|
+
__param(3, (0, common_1.Query)("status")),
|
|
159
|
+
__metadata("design:type", Function),
|
|
160
|
+
__metadata("design:paramtypes", [Object, String, Object, String]),
|
|
161
|
+
__metadata("design:returntype", Promise)
|
|
162
|
+
], EmailAutomationController.prototype, "findEnrollments", null);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, common_1.Post)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/:emailAutomationId/tidy`),
|
|
165
|
+
(0, roles_decorator_1.Roles)(system_roles_1.RoleId.Administrator),
|
|
166
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
167
|
+
(0, cache_invalidate_decorator_1.CacheInvalidate)(email_automation_meta_1.emailAutomationMeta, "emailAutomationId"),
|
|
168
|
+
__param(0, (0, common_1.Req)()),
|
|
169
|
+
__param(1, (0, common_1.Res)()),
|
|
170
|
+
__param(2, (0, common_1.Param)("emailAutomationId")),
|
|
171
|
+
__metadata("design:type", Function),
|
|
172
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
173
|
+
__metadata("design:returntype", Promise)
|
|
174
|
+
], EmailAutomationController.prototype, "tidy", null);
|
|
175
|
+
exports.EmailAutomationController = EmailAutomationController = __decorate([
|
|
176
|
+
(0, common_1.UseGuards)(jwt_auth_admin_guard_1.AdminJwtAuthGuard),
|
|
177
|
+
(0, common_1.Controller)(),
|
|
178
|
+
__metadata("design:paramtypes", [email_automation_service_1.EmailAutomationService,
|
|
179
|
+
email_automation_step_service_1.EmailAutomationStepService,
|
|
180
|
+
cache_service_1.CacheService,
|
|
181
|
+
audit_service_1.AuditService])
|
|
182
|
+
], EmailAutomationController);
|
|
183
|
+
//# sourceMappingURL=email-automation.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation.controller.js","sourceRoot":"","sources":["../../../../src/foundations/email-automation/controllers/email-automation.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAcwB;AA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AK,EAAC,qBAAM,CAAC,aAAa,CAAC;IAC3B,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;IAC/B,IAAA,4CAAe,EAAC,2CAAmB,EAAE,mBAAmB,CAAC;IAEvD,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,mBAAmB,CAAC,CAAA;;;;qDAI5B;oCAxGU,yBAAyB;IAFrC,IAAA,kBAAS,EAAC,wCAAiB,CAAC;IAC5B,IAAA,mBAAU,GAAE;qCAKgC,iDAAsB;QACjC,0DAA0B;QACzB,4BAAY;QACZ,4BAAY;GAPlC,yBAAyB,CAyGrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EmailAutomationUnsubscribeDTO } from "../dtos/email-automation-unsubscribe.dto";
|
|
2
|
+
import { EmailAutomationUnsubscribeService } from "../services/email-automation-unsubscribe.service";
|
|
3
|
+
/**
|
|
4
|
+
* Public email-automation routes (no guard). Kept apart from the admin controller so the
|
|
5
|
+
* literal `unsubscribe` segment never collides with `:emailAutomationId`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class EmailAutomationPublicController {
|
|
8
|
+
private readonly unsubscribeService;
|
|
9
|
+
constructor(unsubscribeService: EmailAutomationUnsubscribeService);
|
|
10
|
+
/**
|
|
11
|
+
* POST /email-automations/unsubscribe/:token
|
|
12
|
+
*
|
|
13
|
+
* Two callers:
|
|
14
|
+
* - the web page: JSON:API body `{ data: { type: EMAIL_AUTOMATION_UNSUBSCRIBE_TYPE, attributes: { scope } } }`;
|
|
15
|
+
* - a mail client's RFC 8058 one-click POST: form body `List-Unsubscribe=One-Click` and `?scope=all`
|
|
16
|
+
* in the URL. The global ValidationPipe whitelist strips the form key, so `body.data` is absent.
|
|
17
|
+
*/
|
|
18
|
+
unsubscribe(token: string, scope?: string, body?: EmailAutomationUnsubscribeDTO): Promise<import("../../..").JsonApiSingleDocument>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=email-automation.public.controller.d.ts.map
|
package/dist/foundations/email-automation/controllers/email-automation.public.controller.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation.public.controller.d.ts","sourceRoot":"","sources":["../../../../src/foundations/email-automation/controllers/email-automation.public.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC;AAErG;;;GAGG;AACH,qBACa,+BAA+B;IAC9B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,iCAAiC;IAElF;;;;;;;OAOG;IAGG,WAAW,CACC,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACtB,IAAI,CAAC,EAAE,6BAA6B;CAa/C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EmailAutomationPublicController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const email_automation_unsubscribe_dto_1 = require("../dtos/email-automation-unsubscribe.dto");
|
|
18
|
+
const email_automation_meta_1 = require("../entities/email-automation.meta");
|
|
19
|
+
const email_automation_unsubscribe_service_1 = require("../services/email-automation-unsubscribe.service");
|
|
20
|
+
/**
|
|
21
|
+
* Public email-automation routes (no guard). Kept apart from the admin controller so the
|
|
22
|
+
* literal `unsubscribe` segment never collides with `:emailAutomationId`.
|
|
23
|
+
*/
|
|
24
|
+
let EmailAutomationPublicController = class EmailAutomationPublicController {
|
|
25
|
+
constructor(unsubscribeService) {
|
|
26
|
+
this.unsubscribeService = unsubscribeService;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* POST /email-automations/unsubscribe/:token
|
|
30
|
+
*
|
|
31
|
+
* Two callers:
|
|
32
|
+
* - the web page: JSON:API body `{ data: { type: EMAIL_AUTOMATION_UNSUBSCRIBE_TYPE, attributes: { scope } } }`;
|
|
33
|
+
* - a mail client's RFC 8058 one-click POST: form body `List-Unsubscribe=One-Click` and `?scope=all`
|
|
34
|
+
* in the URL. The global ValidationPipe whitelist strips the form key, so `body.data` is absent.
|
|
35
|
+
*/
|
|
36
|
+
async unsubscribe(token, scope, body) {
|
|
37
|
+
const resolvedScope = scope ?? body?.data?.attributes?.scope ?? "all";
|
|
38
|
+
if (resolvedScope !== "automation" && resolvedScope !== "all") {
|
|
39
|
+
throw new common_1.BadRequestException("Invalid unsubscribe scope");
|
|
40
|
+
}
|
|
41
|
+
return await this.unsubscribeService.unsubscribe({
|
|
42
|
+
token,
|
|
43
|
+
scope: resolvedScope,
|
|
44
|
+
source: body?.data ? "link" : "header",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.EmailAutomationPublicController = EmailAutomationPublicController;
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, common_1.Post)(`${email_automation_meta_1.emailAutomationMeta.endpoint}/${email_automation_meta_1.EMAIL_AUTOMATION_UNSUBSCRIBE_SEGMENT}/:token`),
|
|
51
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
52
|
+
__param(0, (0, common_1.Param)("token")),
|
|
53
|
+
__param(1, (0, common_1.Query)("scope")),
|
|
54
|
+
__param(2, (0, common_1.Body)()),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", [String, String, email_automation_unsubscribe_dto_1.EmailAutomationUnsubscribeDTO]),
|
|
57
|
+
__metadata("design:returntype", Promise)
|
|
58
|
+
], EmailAutomationPublicController.prototype, "unsubscribe", null);
|
|
59
|
+
exports.EmailAutomationPublicController = EmailAutomationPublicController = __decorate([
|
|
60
|
+
(0, common_1.Controller)(),
|
|
61
|
+
__metadata("design:paramtypes", [email_automation_unsubscribe_service_1.EmailAutomationUnsubscribeService])
|
|
62
|
+
], EmailAutomationPublicController);
|
|
63
|
+
//# sourceMappingURL=email-automation.public.controller.js.map
|
package/dist/foundations/email-automation/controllers/email-automation.public.controller.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation.public.controller.js","sourceRoot":"","sources":["../../../../src/foundations/email-automation/controllers/email-automation.public.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiH;AACjH,+FAAyF;AACzF,6EAA8G;AAC9G,2GAAqG;AAErG;;;GAGG;AAEI,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAC1C,YAA6B,kBAAqD;QAArD,uBAAkB,GAAlB,kBAAkB,CAAmC;IAAG,CAAC;IAEtF;;;;;;;OAOG;IAGG,AAAN,KAAK,CAAC,WAAW,CACC,KAAa,EACb,KAAc,EACtB,IAAoC;QAE5C,MAAM,aAAa,GAAG,KAAK,IAAI,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,KAAK,CAAC;QACtE,IAAI,aAAa,KAAK,YAAY,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;YAC9D,MAAM,IAAI,4BAAmB,CAAC,2BAA2B,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC;YAC/C,KAAK;YACL,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;SACvC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA7BY,0EAA+B;AAapC;IAFL,IAAA,aAAI,EAAC,GAAG,2CAAmB,CAAC,QAAQ,IAAI,4DAAoC,SAAS,CAAC;IACtF,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IAErB,WAAA,IAAA,cAAK,EAAC,OAAO,CAAC,CAAA;IACd,WAAA,IAAA,cAAK,EAAC,OAAO,CAAC,CAAA;IACd,WAAA,IAAA,aAAI,GAAE,CAAA;;qDAAQ,gEAA6B;;kEAY7C;0CA5BU,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;qCAEsC,wEAAiC;GADvE,+BAA+B,CA6B3C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppLoggingService } from "../../../core/logging/services/logging.service";
|
|
2
|
+
import { EmailAutomationSenderService } from "../services/email-automation-sender.service";
|
|
3
|
+
export declare class EmailAutomationSenderCron {
|
|
4
|
+
private readonly senderService;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(senderService: EmailAutomationSenderService, logger: AppLoggingService);
|
|
7
|
+
run(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=email-automation-sender.cron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation-sender.cron.d.ts","sourceRoot":"","sources":["../../../../src/foundations/email-automation/cron/email-automation-sender.cron.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,qBACa,yBAAyB;IAElC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,aAAa,EAAE,4BAA4B,EAC3C,MAAM,EAAE,iBAAiB;IAItC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAc3B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EmailAutomationSenderCron = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const schedule_1 = require("@nestjs/schedule");
|
|
15
|
+
const logging_service_1 = require("../../../core/logging/services/logging.service");
|
|
16
|
+
const email_automation_sender_service_1 = require("../services/email-automation-sender.service");
|
|
17
|
+
let EmailAutomationSenderCron = class EmailAutomationSenderCron {
|
|
18
|
+
constructor(senderService, logger) {
|
|
19
|
+
this.senderService = senderService;
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
}
|
|
22
|
+
async run() {
|
|
23
|
+
try {
|
|
24
|
+
const { sent, skipped, failed } = await this.senderService.processDue({ now: new Date(), limit: 200 });
|
|
25
|
+
this.logger.log(`Email automations: ${sent} sent, ${skipped} skipped, ${failed} failed`, "EmailAutomationSenderCron");
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
this.logger.error(`Failed to process due email automations: ${error.message}`, "EmailAutomationSenderCron");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.EmailAutomationSenderCron = EmailAutomationSenderCron;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, schedule_1.Cron)(schedule_1.CronExpression.EVERY_HOUR),
|
|
35
|
+
__metadata("design:type", Function),
|
|
36
|
+
__metadata("design:paramtypes", []),
|
|
37
|
+
__metadata("design:returntype", Promise)
|
|
38
|
+
], EmailAutomationSenderCron.prototype, "run", null);
|
|
39
|
+
exports.EmailAutomationSenderCron = EmailAutomationSenderCron = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
__metadata("design:paramtypes", [email_automation_sender_service_1.EmailAutomationSenderService,
|
|
42
|
+
logging_service_1.AppLoggingService])
|
|
43
|
+
], EmailAutomationSenderCron);
|
|
44
|
+
//# sourceMappingURL=email-automation-sender.cron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation-sender.cron.js","sourceRoot":"","sources":["../../../../src/foundations/email-automation/cron/email-automation-sender.cron.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAwD;AACxD,oFAAmF;AACnF,iGAA2F;AAGpF,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YACmB,aAA2C,EAC3C,MAAyB;QADzB,kBAAa,GAAb,aAAa,CAA8B;QAC3C,WAAM,GAAN,MAAM,CAAmB;IACzC,CAAC;IAGE,AAAN,KAAK,CAAC,GAAG;QACP,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACvG,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,sBAAsB,IAAI,UAAU,OAAO,aAAa,MAAM,SAAS,EACvE,2BAA2B,CAC5B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,4CAA6C,KAAe,CAAC,OAAO,EAAE,EACtE,2BAA2B,CAC5B,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AArBY,8DAAyB;AAO9B;IADL,IAAA,eAAI,EAAC,yBAAc,CAAC,UAAU,CAAC;;;;oDAc/B;oCApBU,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAGuB,8DAA4B;QACnC,mCAAiB;GAHjC,yBAAyB,CAqBrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation-step.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/email-automation/dtos/email-automation-step.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,sBAAsB;IAEjC,IAAI,EAAE,MAAM,CAAC;IAGb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,qBAAa,0BAA0B;IAIrC,IAAI,EAAE,sBAAsB,CAAC;CAC9B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EmailAutomationStepDataDTO = exports.EmailAutomationStepDTO = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const email_automation_step_meta_1 = require("../entities/email-automation-step.meta");
|
|
16
|
+
class EmailAutomationStepDTO {
|
|
17
|
+
}
|
|
18
|
+
exports.EmailAutomationStepDTO = EmailAutomationStepDTO;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.Equals)(email_automation_step_meta_1.emailAutomationStepMeta.endpoint),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], EmailAutomationStepDTO.prototype, "type", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsUUID)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], EmailAutomationStepDTO.prototype, "id", void 0);
|
|
27
|
+
class EmailAutomationStepDataDTO {
|
|
28
|
+
}
|
|
29
|
+
exports.EmailAutomationStepDataDTO = EmailAutomationStepDataDTO;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.ValidateNested)(),
|
|
32
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
33
|
+
(0, class_transformer_1.Type)(() => EmailAutomationStepDTO),
|
|
34
|
+
__metadata("design:type", EmailAutomationStepDTO)
|
|
35
|
+
], EmailAutomationStepDataDTO.prototype, "data", void 0);
|
|
36
|
+
//# sourceMappingURL=email-automation-step.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation-step.dto.js","sourceRoot":"","sources":["../../../../src/foundations/email-automation/dtos/email-automation-step.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAA6E;AAC7E,uFAAiF;AAEjF,MAAa,sBAAsB;CAMlC;AAND,wDAMC;AAJC;IADC,IAAA,wBAAM,EAAC,oDAAuB,CAAC,QAAQ,CAAC;;oDAC5B;AAGb;IADC,IAAA,wBAAM,GAAE;;kDACE;AAGb,MAAa,0BAA0B;CAKtC;AALD,gEAKC;AADC;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;8BAC7B,sBAAsB;wDAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class EmailAutomationStepPatchAttributesDTO {
|
|
2
|
+
subject?: string;
|
|
3
|
+
body?: string;
|
|
4
|
+
delayHours?: number;
|
|
5
|
+
positionX?: number;
|
|
6
|
+
positionY?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class EmailAutomationStepPatchDataDTO {
|
|
9
|
+
type: string;
|
|
10
|
+
id: string;
|
|
11
|
+
attributes: EmailAutomationStepPatchAttributesDTO;
|
|
12
|
+
}
|
|
13
|
+
export declare class EmailAutomationStepPatchDTO {
|
|
14
|
+
data: EmailAutomationStepPatchDataDTO;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=email-automation-step.patch.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-automation-step.patch.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/email-automation/dtos/email-automation-step.patch.dto.ts"],"names":[],"mappings":"AAcA,qBAAa,qCAAqC;IAIhD,OAAO,CAAC,EAAE,MAAM,CAAC;IAIjB,IAAI,CAAC,EAAE,MAAM,CAAC;IAKd,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,+BAA+B;IAE1C,IAAI,EAAE,MAAM,CAAC;IAGb,EAAE,EAAE,MAAM,CAAC;IAKX,UAAU,EAAE,qCAAqC,CAAC;CACnD;AAED,qBAAa,2BAA2B;IAItC,IAAI,EAAE,+BAA+B,CAAC;CACvC"}
|