@carlonicora/nestjs-neo4jsonapi 8.5.0 → 8.6.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 +14 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/config/enums/queue.id.d.ts +1 -0
- package/dist/config/enums/queue.id.d.ts.map +1 -1
- package/dist/config/enums/queue.id.js +1 -0
- package/dist/config/enums/queue.id.js.map +1 -1
- package/dist/core/email/templates/en/accountDeleted.hbs +23 -0
- package/dist/core/email/templates/en/accountDeletionRequested.hbs +28 -0
- package/dist/foundations/account-deletion/account-deletion.config.d.ts +18 -0
- package/dist/foundations/account-deletion/account-deletion.config.d.ts.map +1 -0
- package/dist/foundations/account-deletion/account-deletion.config.js +6 -0
- package/dist/foundations/account-deletion/account-deletion.config.js.map +1 -0
- package/dist/foundations/account-deletion/account-deletion.constants.d.ts +36 -0
- package/dist/foundations/account-deletion/account-deletion.constants.d.ts.map +1 -0
- package/dist/foundations/account-deletion/account-deletion.constants.js +41 -0
- package/dist/foundations/account-deletion/account-deletion.constants.js.map +1 -0
- package/dist/foundations/account-deletion/account-deletion.module.d.ts +31 -0
- package/dist/foundations/account-deletion/account-deletion.module.d.ts.map +1 -0
- package/dist/foundations/account-deletion/account-deletion.module.js +98 -0
- package/dist/foundations/account-deletion/account-deletion.module.js.map +1 -0
- package/dist/foundations/account-deletion/controllers/account-deletion.controller.d.ts +28 -0
- package/dist/foundations/account-deletion/controllers/account-deletion.controller.d.ts.map +1 -0
- package/dist/foundations/account-deletion/controllers/account-deletion.controller.js +132 -0
- package/dist/foundations/account-deletion/controllers/account-deletion.controller.js.map +1 -0
- package/dist/foundations/account-deletion/cron/account-deletion.cron.d.ts +20 -0
- package/dist/foundations/account-deletion/cron/account-deletion.cron.d.ts.map +1 -0
- package/dist/foundations/account-deletion/cron/account-deletion.cron.js +78 -0
- package/dist/foundations/account-deletion/cron/account-deletion.cron.js.map +1 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.keep.post.dto.d.ts +14 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.keep.post.dto.d.ts.map +1 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.keep.post.dto.js +51 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.keep.post.dto.js.map +1 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.post.dto.d.ts +14 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.post.dto.d.ts.map +1 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.post.dto.js +51 -0
- package/dist/foundations/account-deletion/dtos/account-deletion.post.dto.js.map +1 -0
- package/dist/foundations/account-deletion/entities/account-deletion.d.ts +20 -0
- package/dist/foundations/account-deletion/entities/account-deletion.d.ts.map +1 -0
- package/dist/foundations/account-deletion/entities/account-deletion.js +21 -0
- package/dist/foundations/account-deletion/entities/account-deletion.js.map +1 -0
- package/dist/foundations/account-deletion/entities/account-deletion.meta.d.ts +3 -0
- package/dist/foundations/account-deletion/entities/account-deletion.meta.d.ts.map +1 -0
- package/dist/foundations/account-deletion/entities/account-deletion.meta.js +10 -0
- package/dist/foundations/account-deletion/entities/account-deletion.meta.js.map +1 -0
- package/dist/foundations/account-deletion/index.d.ts +15 -0
- package/dist/foundations/account-deletion/index.d.ts.map +1 -0
- package/dist/foundations/account-deletion/index.js +31 -0
- package/dist/foundations/account-deletion/index.js.map +1 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-handler.interface.d.ts +29 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-handler.interface.d.ts.map +1 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-handler.interface.js +5 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-handler.interface.js.map +1 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.d.ts +12 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.d.ts.map +1 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.js +5 -0
- package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.js.map +1 -0
- package/dist/foundations/account-deletion/processors/account-deletion.processor.d.ts +28 -0
- package/dist/foundations/account-deletion/processors/account-deletion.processor.d.ts.map +1 -0
- package/dist/foundations/account-deletion/processors/account-deletion.processor.js +97 -0
- package/dist/foundations/account-deletion/processors/account-deletion.processor.js.map +1 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.repository.d.ts +85 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.repository.d.ts.map +1 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.repository.js +186 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.repository.js.map +1 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.d.ts +77 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.d.ts.map +1 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.js +243 -0
- package/dist/foundations/account-deletion/repositories/account-deletion.wipe.repository.js.map +1 -0
- package/dist/foundations/account-deletion/services/account-deletion.service.d.ts +105 -0
- package/dist/foundations/account-deletion/services/account-deletion.service.d.ts.map +1 -0
- package/dist/foundations/account-deletion/services/account-deletion.service.js +300 -0
- package/dist/foundations/account-deletion/services/account-deletion.service.js.map +1 -0
- package/dist/foundations/account-deletion/services/account-wipe.service.d.ts +64 -0
- package/dist/foundations/account-deletion/services/account-wipe.service.d.ts.map +1 -0
- package/dist/foundations/account-deletion/services/account-wipe.service.js +134 -0
- package/dist/foundations/account-deletion/services/account-wipe.service.js.map +1 -0
- package/dist/foundations/account-deletion/services/full-company-deletion.service.d.ts +88 -0
- package/dist/foundations/account-deletion/services/full-company-deletion.service.d.ts.map +1 -0
- package/dist/foundations/account-deletion/services/full-company-deletion.service.js +184 -0
- package/dist/foundations/account-deletion/services/full-company-deletion.service.js.map +1 -0
- package/dist/foundations/account-deletion/utils/deliverable-email.d.ts +8 -0
- package/dist/foundations/account-deletion/utils/deliverable-email.d.ts.map +1 -0
- package/dist/foundations/account-deletion/utils/deliverable-email.js +20 -0
- package/dist/foundations/account-deletion/utils/deliverable-email.js.map +1 -0
- package/dist/foundations/auth/entities/auth.d.ts +1 -0
- package/dist/foundations/auth/entities/auth.d.ts.map +1 -1
- package/dist/foundations/auth/entities/auth.js +4 -0
- package/dist/foundations/auth/entities/auth.js.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.d.ts +2 -0
- package/dist/foundations/auth/repositories/auth.repository.d.ts.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.js +4 -0
- package/dist/foundations/auth/repositories/auth.repository.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/foundations.modules.d.ts +7 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +5 -0
- 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/user/entities/user.d.ts +3 -0
- package/dist/foundations/user/entities/user.d.ts.map +1 -1
- package/dist/foundations/user/entities/user.js +4 -0
- package/dist/foundations/user/entities/user.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Queue } from "bullmq";
|
|
2
|
+
import { ClsService } from "nestjs-cls";
|
|
3
|
+
import { AppLoggingService } from "../../../core/logging/services/logging.service";
|
|
4
|
+
import { AccountDeletionRepository } from "../repositories/account-deletion.repository";
|
|
5
|
+
/**
|
|
6
|
+
* Daily: one `delete-account` job per user whose grace period is over. Runs in
|
|
7
|
+
* the worker only (ScheduleModule is mounted only when cron jobs are enabled).
|
|
8
|
+
* The job id is fixed per user, so a user is never queued twice; a job that
|
|
9
|
+
* failed every attempt is removed and queued again, so a wipe never stays
|
|
10
|
+
* half done.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AccountDeletionCron {
|
|
13
|
+
private readonly queue;
|
|
14
|
+
private readonly accountDeletionRepository;
|
|
15
|
+
private readonly clsService;
|
|
16
|
+
private readonly logger;
|
|
17
|
+
constructor(queue: Queue, accountDeletionRepository: AccountDeletionRepository, clsService: ClsService, logger: AppLoggingService);
|
|
18
|
+
enqueueDue(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=account-deletion.cron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.cron.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/cron/account-deletion.cron.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAOnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAExF;;;;;;GAMG;AACH,qBACa,mBAAmB;IAEW,OAAO,CAAC,QAAQ,CAAC,KAAK;IAC7D,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHiC,KAAK,EAAE,KAAK,EACnD,yBAAyB,EAAE,yBAAyB,EACpD,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,iBAAiB;IAItC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CA0BlC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
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.AccountDeletionCron = void 0;
|
|
16
|
+
const bullmq_1 = require("@nestjs/bullmq");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const schedule_1 = require("@nestjs/schedule");
|
|
19
|
+
const bullmq_2 = require("bullmq");
|
|
20
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
21
|
+
const queue_id_1 = require("../../../config/enums/queue.id");
|
|
22
|
+
const logging_service_1 = require("../../../core/logging/services/logging.service");
|
|
23
|
+
const account_deletion_constants_1 = require("../account-deletion.constants");
|
|
24
|
+
const account_deletion_repository_1 = require("../repositories/account-deletion.repository");
|
|
25
|
+
/**
|
|
26
|
+
* Daily: one `delete-account` job per user whose grace period is over. Runs in
|
|
27
|
+
* the worker only (ScheduleModule is mounted only when cron jobs are enabled).
|
|
28
|
+
* The job id is fixed per user, so a user is never queued twice; a job that
|
|
29
|
+
* failed every attempt is removed and queued again, so a wipe never stays
|
|
30
|
+
* half done.
|
|
31
|
+
*/
|
|
32
|
+
let AccountDeletionCron = class AccountDeletionCron {
|
|
33
|
+
constructor(queue, accountDeletionRepository, clsService, logger) {
|
|
34
|
+
this.queue = queue;
|
|
35
|
+
this.accountDeletionRepository = accountDeletionRepository;
|
|
36
|
+
this.clsService = clsService;
|
|
37
|
+
this.logger = logger;
|
|
38
|
+
}
|
|
39
|
+
async enqueueDue() {
|
|
40
|
+
await this.clsService.run(async () => {
|
|
41
|
+
const due = await this.accountDeletionRepository.findDue({ now: new Date().toISOString() });
|
|
42
|
+
for (const user of due) {
|
|
43
|
+
const jobId = (0, account_deletion_constants_1.accountDeletionJobId)(user.id);
|
|
44
|
+
try {
|
|
45
|
+
const existing = await this.queue.getJob(jobId);
|
|
46
|
+
if (existing && (await existing.isFailed()))
|
|
47
|
+
await existing.remove();
|
|
48
|
+
const data = { userId: user.id };
|
|
49
|
+
await this.queue.add(account_deletion_constants_1.ACCOUNT_DELETION_JOB_NAMES.deleteAccount, data, {
|
|
50
|
+
...account_deletion_constants_1.ACCOUNT_DELETION_JOB_OPTIONS,
|
|
51
|
+
jobId,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.logger.error(`Failed to queue account deletion ${user.id}: ${error.message}`, "AccountDeletionCron");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (due.length > 0)
|
|
59
|
+
this.logger.log(`Queued ${due.length} account deletion(s)`, "AccountDeletionCron");
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.AccountDeletionCron = AccountDeletionCron;
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, schedule_1.Cron)(schedule_1.CronExpression.EVERY_DAY_AT_4AM),
|
|
66
|
+
__metadata("design:type", Function),
|
|
67
|
+
__metadata("design:paramtypes", []),
|
|
68
|
+
__metadata("design:returntype", Promise)
|
|
69
|
+
], AccountDeletionCron.prototype, "enqueueDue", null);
|
|
70
|
+
exports.AccountDeletionCron = AccountDeletionCron = __decorate([
|
|
71
|
+
(0, common_1.Injectable)(),
|
|
72
|
+
__param(0, (0, bullmq_1.InjectQueue)(queue_id_1.QueueId.ACCOUNT_DELETION)),
|
|
73
|
+
__metadata("design:paramtypes", [bullmq_2.Queue,
|
|
74
|
+
account_deletion_repository_1.AccountDeletionRepository,
|
|
75
|
+
nestjs_cls_1.ClsService,
|
|
76
|
+
logging_service_1.AppLoggingService])
|
|
77
|
+
], AccountDeletionCron);
|
|
78
|
+
//# sourceMappingURL=account-deletion.cron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.cron.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/cron/account-deletion.cron.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA6C;AAC7C,2CAA4C;AAC5C,+CAAwD;AACxD,mCAA+B;AAC/B,2CAAwC;AACxC,6DAAyD;AACzD,oFAAmF;AACnF,8EAKuC;AACvC,6FAAwF;AAExF;;;;;;GAMG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAC0D,KAAY,EACnD,yBAAoD,EACpD,UAAsB,EACtB,MAAyB;QAHc,UAAK,GAAL,KAAK,CAAO;QACnD,8BAAyB,GAAzB,yBAAyB,CAA2B;QACpD,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAmB;IACzC,CAAC;IAGE,AAAN,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;YACnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAE5F,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;gBACvB,MAAM,KAAK,GAAG,IAAA,iDAAoB,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC5C,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAChD,IAAI,QAAQ,IAAI,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;wBAAE,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC;oBAErE,MAAM,IAAI,GAA2B,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;oBACzD,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,uDAA0B,CAAC,aAAa,EAAE,IAAI,EAAE;wBACnE,GAAG,yDAA4B;wBAC/B,KAAK;qBACN,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,oCAAoC,IAAI,CAAC,EAAE,KAAM,KAAe,CAAC,OAAO,EAAE,EAC1E,qBAAqB,CACtB,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,MAAM,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;QACzG,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnCY,kDAAmB;AASxB;IADL,IAAA,eAAI,EAAC,yBAAc,CAAC,gBAAgB,CAAC;;;;qDA0BrC;8BAlCU,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,oBAAW,EAAC,kBAAO,CAAC,gBAAgB,CAAC,CAAA;qCAAyB,cAAK;QACxB,uDAAyB;QACxC,uBAAU;QACd,mCAAiB;GALjC,mBAAmB,CAmC/B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class AccountDeletionKeepPostAttributesDTO {
|
|
2
|
+
/** The raw undo token from the request email. */
|
|
3
|
+
token: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class AccountDeletionKeepPostDataDTO {
|
|
6
|
+
type: string;
|
|
7
|
+
/** A client-generated v4 id; the server ignores its value. */
|
|
8
|
+
id: string;
|
|
9
|
+
attributes: AccountDeletionKeepPostAttributesDTO;
|
|
10
|
+
}
|
|
11
|
+
export declare class AccountDeletionKeepPostDTO {
|
|
12
|
+
data: AccountDeletionKeepPostDataDTO;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=account-deletion.keep.post.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.keep.post.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/dtos/account-deletion.keep.post.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,oCAAoC;IAC/C,iDAAiD;IAIjD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,8BAA8B;IAEzC,IAAI,EAAE,MAAM,CAAC;IAEb,8DAA8D;IAE9D,EAAE,EAAE,MAAM,CAAC;IAKX,UAAU,EAAE,oCAAoC,CAAC;CAClD;AAED,qBAAa,0BAA0B;IAIrC,IAAI,EAAE,8BAA8B,CAAC;CACtC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.AccountDeletionKeepPostDTO = exports.AccountDeletionKeepPostDataDTO = exports.AccountDeletionKeepPostAttributesDTO = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const account_deletion_meta_1 = require("../entities/account-deletion.meta");
|
|
16
|
+
class AccountDeletionKeepPostAttributesDTO {
|
|
17
|
+
}
|
|
18
|
+
exports.AccountDeletionKeepPostAttributesDTO = AccountDeletionKeepPostAttributesDTO;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsDefined)(),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], AccountDeletionKeepPostAttributesDTO.prototype, "token", void 0);
|
|
25
|
+
class AccountDeletionKeepPostDataDTO {
|
|
26
|
+
}
|
|
27
|
+
exports.AccountDeletionKeepPostDataDTO = AccountDeletionKeepPostDataDTO;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.Equals)(account_deletion_meta_1.accountDeletionMeta.endpoint),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], AccountDeletionKeepPostDataDTO.prototype, "type", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsUUID)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], AccountDeletionKeepPostDataDTO.prototype, "id", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.ValidateNested)(),
|
|
38
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
39
|
+
(0, class_transformer_1.Type)(() => AccountDeletionKeepPostAttributesDTO),
|
|
40
|
+
__metadata("design:type", AccountDeletionKeepPostAttributesDTO)
|
|
41
|
+
], AccountDeletionKeepPostDataDTO.prototype, "attributes", void 0);
|
|
42
|
+
class AccountDeletionKeepPostDTO {
|
|
43
|
+
}
|
|
44
|
+
exports.AccountDeletionKeepPostDTO = AccountDeletionKeepPostDTO;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.ValidateNested)(),
|
|
47
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
48
|
+
(0, class_transformer_1.Type)(() => AccountDeletionKeepPostDataDTO),
|
|
49
|
+
__metadata("design:type", AccountDeletionKeepPostDataDTO)
|
|
50
|
+
], AccountDeletionKeepPostDTO.prototype, "data", void 0);
|
|
51
|
+
//# sourceMappingURL=account-deletion.keep.post.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.keep.post.dto.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/dtos/account-deletion.keep.post.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAkG;AAClG,6EAAwE;AAExE,MAAa,oCAAoC;CAMhD;AAND,oFAMC;AADC;IAHC,IAAA,2BAAS,GAAE;IACX,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;mEACC;AAGhB,MAAa,8BAA8B;CAY1C;AAZD,wEAYC;AAVC;IADC,IAAA,wBAAM,EAAC,2CAAmB,CAAC,QAAQ,CAAC;;4DACxB;AAIb;IADC,IAAA,wBAAM,GAAE;;0DACE;AAKX;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,oCAAoC,CAAC;8BACrC,oCAAoC;kEAAC;AAGnD,MAAa,0BAA0B;CAKtC;AALD,gEAKC;AADC;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC;8BACrC,8BAA8B;wDAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class AccountDeletionPostAttributesDTO {
|
|
2
|
+
/** The target's email, or DELETE / ELIMINA when the target has no deliverable email. */
|
|
3
|
+
confirmation: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class AccountDeletionPostDataDTO {
|
|
6
|
+
type: string;
|
|
7
|
+
/** The target user id. */
|
|
8
|
+
id: string;
|
|
9
|
+
attributes: AccountDeletionPostAttributesDTO;
|
|
10
|
+
}
|
|
11
|
+
export declare class AccountDeletionPostDTO {
|
|
12
|
+
data: AccountDeletionPostDataDTO;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=account-deletion.post.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.post.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/dtos/account-deletion.post.dto.ts"],"names":[],"mappings":"AAIA,qBAAa,gCAAgC;IAC3C,wFAAwF;IAIxF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,0BAA0B;IAErC,IAAI,EAAE,MAAM,CAAC;IAEb,0BAA0B;IAE1B,EAAE,EAAE,MAAM,CAAC;IAKX,UAAU,EAAE,gCAAgC,CAAC;CAC9C;AAED,qBAAa,sBAAsB;IAIjC,IAAI,EAAE,0BAA0B,CAAC;CAClC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.AccountDeletionPostDTO = exports.AccountDeletionPostDataDTO = exports.AccountDeletionPostAttributesDTO = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const account_deletion_meta_1 = require("../entities/account-deletion.meta");
|
|
16
|
+
class AccountDeletionPostAttributesDTO {
|
|
17
|
+
}
|
|
18
|
+
exports.AccountDeletionPostAttributesDTO = AccountDeletionPostAttributesDTO;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsDefined)(),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], AccountDeletionPostAttributesDTO.prototype, "confirmation", void 0);
|
|
25
|
+
class AccountDeletionPostDataDTO {
|
|
26
|
+
}
|
|
27
|
+
exports.AccountDeletionPostDataDTO = AccountDeletionPostDataDTO;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.Equals)(account_deletion_meta_1.accountDeletionMeta.endpoint),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], AccountDeletionPostDataDTO.prototype, "type", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsUUID)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], AccountDeletionPostDataDTO.prototype, "id", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.ValidateNested)(),
|
|
38
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
39
|
+
(0, class_transformer_1.Type)(() => AccountDeletionPostAttributesDTO),
|
|
40
|
+
__metadata("design:type", AccountDeletionPostAttributesDTO)
|
|
41
|
+
], AccountDeletionPostDataDTO.prototype, "attributes", void 0);
|
|
42
|
+
class AccountDeletionPostDTO {
|
|
43
|
+
}
|
|
44
|
+
exports.AccountDeletionPostDTO = AccountDeletionPostDTO;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.ValidateNested)(),
|
|
47
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
48
|
+
(0, class_transformer_1.Type)(() => AccountDeletionPostDataDTO),
|
|
49
|
+
__metadata("design:type", AccountDeletionPostDataDTO)
|
|
50
|
+
], AccountDeletionPostDTO.prototype, "data", void 0);
|
|
51
|
+
//# sourceMappingURL=account-deletion.post.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.post.dto.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/dtos/account-deletion.post.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAkG;AAClG,6EAAwE;AAExE,MAAa,gCAAgC;CAM5C;AAND,4EAMC;AADC;IAHC,IAAA,2BAAS,GAAE;IACX,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;sEACQ;AAGvB,MAAa,0BAA0B;CAYtC;AAZD,gEAYC;AAVC;IADC,IAAA,wBAAM,EAAC,2CAAmB,CAAC,QAAQ,CAAC;;wDACxB;AAIb;IADC,IAAA,wBAAM,GAAE;;sDACE;AAKX;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC;8BACjC,gCAAgC;8DAAC;AAG/C,MAAa,sBAAsB;CAKlC;AALD,wDAKC;AADC;IAHC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;8BACjC,0BAA0B;oDAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Entity } from "../../../common/abstracts/entity";
|
|
2
|
+
/**
|
|
3
|
+
* The account-deletion preview / status of one user. `id` is the user id.
|
|
4
|
+
*
|
|
5
|
+
* NOT a Neo4j node: there is no AccountDeletion label and no query returns
|
|
6
|
+
* one. It is a serialisation shape only (like `AnalyticsSummaryDescriptor`);
|
|
7
|
+
* AccountDeletionModule lists its serialiser and registers the model (OD-2).
|
|
8
|
+
*/
|
|
9
|
+
export type AccountDeletion = Entity & {
|
|
10
|
+
requestedAt?: Date;
|
|
11
|
+
scheduledAt?: Date;
|
|
12
|
+
hasDeliverableEmail: boolean;
|
|
13
|
+
hasActiveSubscription: boolean;
|
|
14
|
+
deletesCompany: boolean;
|
|
15
|
+
ownedCount: number;
|
|
16
|
+
otherTables: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare const AccountDeletionDescriptor: import("../../..").EntityDescriptor<AccountDeletion, {}>;
|
|
19
|
+
export type AccountDeletionDescriptorType = typeof AccountDeletionDescriptor;
|
|
20
|
+
//# sourceMappingURL=account-deletion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/entities/account-deletion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAI1D;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IACrC,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,yBAAyB,0DAiBpC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,OAAO,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountDeletionDescriptor = void 0;
|
|
4
|
+
const define_entity_1 = require("../../../common/helpers/define-entity");
|
|
5
|
+
const account_deletion_meta_1 = require("./account-deletion.meta");
|
|
6
|
+
exports.AccountDeletionDescriptor = (0, define_entity_1.defineEntity)()({
|
|
7
|
+
...account_deletion_meta_1.accountDeletionMeta,
|
|
8
|
+
isCompanyScoped: false,
|
|
9
|
+
tenancy: "internal",
|
|
10
|
+
fields: {
|
|
11
|
+
requestedAt: { type: "datetime" },
|
|
12
|
+
scheduledAt: { type: "datetime" },
|
|
13
|
+
hasDeliverableEmail: { type: "boolean", required: true },
|
|
14
|
+
hasActiveSubscription: { type: "boolean", required: true },
|
|
15
|
+
deletesCompany: { type: "boolean", required: true },
|
|
16
|
+
ownedCount: { type: "number", required: true },
|
|
17
|
+
otherTables: { type: "string[]", required: true },
|
|
18
|
+
},
|
|
19
|
+
relationships: {},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=account-deletion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/entities/account-deletion.ts"],"names":[],"mappings":";;;AACA,yEAAqE;AACrE,mEAA8D;AAmBjD,QAAA,yBAAyB,GAAG,IAAA,4BAAY,GAAmB,CAAC;IACvE,GAAG,2CAAmB;IAEtB,eAAe,EAAE,KAAK;IACtB,OAAO,EAAE,UAAU;IAEnB,MAAM,EAAE;QACN,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;QACjC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;QACjC,mBAAmB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxD,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1D,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9C,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE;KAClD;IAED,aAAa,EAAE,EAAE;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.meta.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/entities/account-deletion.meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAE1E,eAAO,MAAM,mBAAmB,EAAE,QAKjC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountDeletionMeta = void 0;
|
|
4
|
+
exports.accountDeletionMeta = {
|
|
5
|
+
type: "account-deletions",
|
|
6
|
+
endpoint: "account-deletions",
|
|
7
|
+
nodeName: "accountDeletion",
|
|
8
|
+
labelName: "AccountDeletion",
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=account-deletion.meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.meta.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/entities/account-deletion.meta.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAa;IAC3C,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,iBAAiB;CAC7B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./account-deletion.module";
|
|
2
|
+
export * from "./account-deletion.config";
|
|
3
|
+
export * from "./account-deletion.constants";
|
|
4
|
+
export * from "./entities/account-deletion";
|
|
5
|
+
export * from "./entities/account-deletion.meta";
|
|
6
|
+
export * from "./dtos/account-deletion.post.dto";
|
|
7
|
+
export * from "./dtos/account-deletion.keep.post.dto";
|
|
8
|
+
export * from "./interfaces/account-deletion-handler.interface";
|
|
9
|
+
export * from "./interfaces/account-deletion-login-hook.interface";
|
|
10
|
+
export * from "./utils/deliverable-email";
|
|
11
|
+
export * from "./repositories/account-deletion.repository";
|
|
12
|
+
export * from "./services/account-deletion.service";
|
|
13
|
+
export * from "./services/account-wipe.service";
|
|
14
|
+
export * from "./services/full-company-deletion.service";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/account-deletion/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iDAAiD,CAAC;AAChE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,0CAA0C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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("./account-deletion.module"), exports);
|
|
18
|
+
__exportStar(require("./account-deletion.config"), exports);
|
|
19
|
+
__exportStar(require("./account-deletion.constants"), exports);
|
|
20
|
+
__exportStar(require("./entities/account-deletion"), exports);
|
|
21
|
+
__exportStar(require("./entities/account-deletion.meta"), exports);
|
|
22
|
+
__exportStar(require("./dtos/account-deletion.post.dto"), exports);
|
|
23
|
+
__exportStar(require("./dtos/account-deletion.keep.post.dto"), exports);
|
|
24
|
+
__exportStar(require("./interfaces/account-deletion-handler.interface"), exports);
|
|
25
|
+
__exportStar(require("./interfaces/account-deletion-login-hook.interface"), exports);
|
|
26
|
+
__exportStar(require("./utils/deliverable-email"), exports);
|
|
27
|
+
__exportStar(require("./repositories/account-deletion.repository"), exports);
|
|
28
|
+
__exportStar(require("./services/account-deletion.service"), exports);
|
|
29
|
+
__exportStar(require("./services/account-wipe.service"), exports);
|
|
30
|
+
__exportStar(require("./services/full-company-deletion.service"), exports);
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/foundations/account-deletion/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,4DAA0C;AAC1C,+DAA6C;AAC7C,8DAA4C;AAC5C,mEAAiD;AACjD,mEAAiD;AACjD,wEAAsD;AACtD,kFAAgE;AAChE,qFAAmE;AACnE,4DAA0C;AAC1C,6EAA2D;AAC3D,sEAAoD;AACpD,kEAAgD;AAChD,2EAAyD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const ACCOUNT_DELETION_HANDLER: unique symbol;
|
|
2
|
+
export interface AccountDeletionImpact {
|
|
3
|
+
ownedCount: number;
|
|
4
|
+
otherTables: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* App hook of the account-deletion feature: the app's own content. Optional;
|
|
8
|
+
* without it the preview reports no owned content and the wipe runs the
|
|
9
|
+
* generic library steps only.
|
|
10
|
+
*/
|
|
11
|
+
export interface AccountDeletionHandler {
|
|
12
|
+
/** What the confirmation dialog lists: own campaigns (only when the company goes) and other GMs' campaign names. */
|
|
13
|
+
describeImpact(params: {
|
|
14
|
+
userId: string;
|
|
15
|
+
companyId?: string;
|
|
16
|
+
deletesCompany: boolean;
|
|
17
|
+
}): Promise<AccountDeletionImpact>;
|
|
18
|
+
/** The user's traces in every company except `wipedCompanyId`. Runs while the User and its DiscordUser still exist. Idempotent. */
|
|
19
|
+
removeUserTraces(params: {
|
|
20
|
+
userId: string;
|
|
21
|
+
wipedCompanyId?: string;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
/** App content of a company about to be wiped. Runs before the generic sweep. Idempotent. */
|
|
24
|
+
deleteCompanyContent(params: {
|
|
25
|
+
companyId: string;
|
|
26
|
+
actingUserId?: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=account-deletion-handler.interface.d.ts.map
|
package/dist/foundations/account-deletion/interfaces/account-deletion-handler.interface.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion-handler.interface.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/interfaces/account-deletion-handler.interface.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,oHAAoH;IACpH,cAAc,CAAC,MAAM,EAAE;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,OAAO,CAAC;KACzB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnC,mIAAmI;IACnI,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrF,6FAA6F;IAC7F,oBAAoB,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3F"}
|
package/dist/foundations/account-deletion/interfaces/account-deletion-handler.interface.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion-handler.interface.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/interfaces/account-deletion-handler.interface.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC"}
|
package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const ACCOUNT_DELETION_LOGIN_HOOK: unique symbol;
|
|
2
|
+
/**
|
|
3
|
+
* Called by `AuthService.createAuth` on every fresh login (never on refresh)
|
|
4
|
+
* when the app opts into account deletion.
|
|
5
|
+
*/
|
|
6
|
+
export interface AccountDeletionLoginHook {
|
|
7
|
+
/** Clears a pending deletion request. True when one was cleared. */
|
|
8
|
+
cancelOnLogin(params: {
|
|
9
|
+
userId: string;
|
|
10
|
+
}): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=account-deletion-login-hook.interface.d.ts.map
|
package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion-login-hook.interface.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,oEAAoE;IACpE,aAAa,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7D"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACCOUNT_DELETION_LOGIN_HOOK = void 0;
|
|
4
|
+
exports.ACCOUNT_DELETION_LOGIN_HOOK = Symbol("ACCOUNT_DELETION_LOGIN_HOOK");
|
|
5
|
+
//# sourceMappingURL=account-deletion-login-hook.interface.js.map
|
package/dist/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion-login-hook.interface.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/interfaces/account-deletion-login-hook.interface.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WorkerHost } from "@nestjs/bullmq";
|
|
2
|
+
import { Job } from "bullmq";
|
|
3
|
+
import { ClsService } from "nestjs-cls";
|
|
4
|
+
import { EmailService } from "../../../core/email/services/email.service";
|
|
5
|
+
import { AppLoggingService } from "../../../core/logging/services/logging.service";
|
|
6
|
+
import { AccountDeletedEmailJobData, AccountDeletionJobData, CompanyWipeJobData } from "../account-deletion.constants";
|
|
7
|
+
import { AccountWipeService } from "../services/account-wipe.service";
|
|
8
|
+
import { FullCompanyDeletionService } from "../services/full-company-deletion.service";
|
|
9
|
+
type AccountDeletionQueueJob = Job<AccountDeletionJobData | CompanyWipeJobData | AccountDeletedEmailJobData>;
|
|
10
|
+
/**
|
|
11
|
+
* Worker for `QueueId.ACCOUNT_DELETION` (registered with `createWorkerProvider`).
|
|
12
|
+
* One job at a time with a long lock: a company wipe can run for minutes.
|
|
13
|
+
* Each job runs in its own CLS context (set by hand, there is no request).
|
|
14
|
+
*/
|
|
15
|
+
export declare class AccountDeletionProcessor extends WorkerHost {
|
|
16
|
+
private readonly accountWipeService;
|
|
17
|
+
private readonly fullCompanyDeletionService;
|
|
18
|
+
private readonly emailService;
|
|
19
|
+
private readonly clsService;
|
|
20
|
+
private readonly logger;
|
|
21
|
+
constructor(accountWipeService: AccountWipeService, fullCompanyDeletionService: FullCompanyDeletionService, emailService: EmailService, clsService: ClsService, logger: AppLoggingService);
|
|
22
|
+
onActive(job: Job): void;
|
|
23
|
+
onFailed(job: Job): void;
|
|
24
|
+
onCompleted(job: Job): void;
|
|
25
|
+
process(job: AccountDeletionQueueJob): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=account-deletion.processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.processor.d.ts","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/processors/account-deletion.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAEL,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAEvF,KAAK,uBAAuB,GAAG,GAAG,CAAC,sBAAsB,GAAG,kBAAkB,GAAG,0BAA0B,CAAC,CAAC;AAE7G;;;;GAIG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IAEpD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJN,kBAAkB,EAAE,kBAAkB,EACtC,0BAA0B,EAAE,0BAA0B,EACtD,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,iBAAiB;IAM5C,QAAQ,CAAC,GAAG,EAAE,GAAG;IAKjB,QAAQ,CAAC,GAAG,EAAE,GAAG;IAKjB,WAAW,CAAC,GAAG,EAAE,GAAG;IAId,OAAO,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CAwB3D"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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.AccountDeletionProcessor = void 0;
|
|
13
|
+
const bullmq_1 = require("@nestjs/bullmq");
|
|
14
|
+
const bullmq_2 = require("bullmq");
|
|
15
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
16
|
+
const queue_id_1 = require("../../../config/enums/queue.id");
|
|
17
|
+
const email_service_1 = require("../../../core/email/services/email.service");
|
|
18
|
+
const logging_service_1 = require("../../../core/logging/services/logging.service");
|
|
19
|
+
const account_deletion_constants_1 = require("../account-deletion.constants");
|
|
20
|
+
const account_wipe_service_1 = require("../services/account-wipe.service");
|
|
21
|
+
const full_company_deletion_service_1 = require("../services/full-company-deletion.service");
|
|
22
|
+
/**
|
|
23
|
+
* Worker for `QueueId.ACCOUNT_DELETION` (registered with `createWorkerProvider`).
|
|
24
|
+
* One job at a time with a long lock: a company wipe can run for minutes.
|
|
25
|
+
* Each job runs in its own CLS context (set by hand, there is no request).
|
|
26
|
+
*/
|
|
27
|
+
let AccountDeletionProcessor = class AccountDeletionProcessor extends bullmq_1.WorkerHost {
|
|
28
|
+
constructor(accountWipeService, fullCompanyDeletionService, emailService, clsService, logger) {
|
|
29
|
+
super();
|
|
30
|
+
this.accountWipeService = accountWipeService;
|
|
31
|
+
this.fullCompanyDeletionService = fullCompanyDeletionService;
|
|
32
|
+
this.emailService = emailService;
|
|
33
|
+
this.clsService = clsService;
|
|
34
|
+
this.logger = logger;
|
|
35
|
+
}
|
|
36
|
+
onActive(job) {
|
|
37
|
+
this.logger.debug(`Processing ${job.name} job (ID: ${job.id})`);
|
|
38
|
+
}
|
|
39
|
+
onFailed(job) {
|
|
40
|
+
this.logger.error(`Failed ${job.name} job (ID: ${job.id}). Reason: ${job.failedReason}`);
|
|
41
|
+
}
|
|
42
|
+
onCompleted(job) {
|
|
43
|
+
this.logger.debug(`Completed ${job.name} job (ID: ${job.id})`);
|
|
44
|
+
}
|
|
45
|
+
async process(job) {
|
|
46
|
+
switch (job.name) {
|
|
47
|
+
case account_deletion_constants_1.ACCOUNT_DELETION_JOB_NAMES.deleteAccount: {
|
|
48
|
+
const { userId } = job.data;
|
|
49
|
+
await this.clsService.run(() => this.accountWipeService.deleteAccount({ userId }));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
case account_deletion_constants_1.ACCOUNT_DELETION_JOB_NAMES.deleteCompany: {
|
|
53
|
+
const { companyId } = job.data;
|
|
54
|
+
await this.clsService.run(async () => {
|
|
55
|
+
this.clsService.set("companyId", companyId);
|
|
56
|
+
await this.fullCompanyDeletionService.wipeCompany({ companyId });
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
case account_deletion_constants_1.ACCOUNT_DELETION_JOB_NAMES.accountDeletedEmail: {
|
|
61
|
+
const { to, name, locale } = job.data;
|
|
62
|
+
await this.emailService.sendEmail("accountDeleted", { to, name }, locale);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
this.logger.warn(`Unknown account-deletion job ${job.name} (ID: ${job.id})`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.AccountDeletionProcessor = AccountDeletionProcessor;
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, bullmq_1.OnWorkerEvent)("active"),
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
75
|
+
__metadata("design:returntype", void 0)
|
|
76
|
+
], AccountDeletionProcessor.prototype, "onActive", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, bullmq_1.OnWorkerEvent)("failed"),
|
|
79
|
+
__metadata("design:type", Function),
|
|
80
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
81
|
+
__metadata("design:returntype", void 0)
|
|
82
|
+
], AccountDeletionProcessor.prototype, "onFailed", null);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, bullmq_1.OnWorkerEvent)("completed"),
|
|
85
|
+
__metadata("design:type", Function),
|
|
86
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
87
|
+
__metadata("design:returntype", void 0)
|
|
88
|
+
], AccountDeletionProcessor.prototype, "onCompleted", null);
|
|
89
|
+
exports.AccountDeletionProcessor = AccountDeletionProcessor = __decorate([
|
|
90
|
+
(0, bullmq_1.Processor)(queue_id_1.QueueId.ACCOUNT_DELETION, { concurrency: 1, lockDuration: 15 * 60 * 1000 }),
|
|
91
|
+
__metadata("design:paramtypes", [account_wipe_service_1.AccountWipeService,
|
|
92
|
+
full_company_deletion_service_1.FullCompanyDeletionService,
|
|
93
|
+
email_service_1.EmailService,
|
|
94
|
+
nestjs_cls_1.ClsService,
|
|
95
|
+
logging_service_1.AppLoggingService])
|
|
96
|
+
], AccountDeletionProcessor);
|
|
97
|
+
//# sourceMappingURL=account-deletion.processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-deletion.processor.js","sourceRoot":"","sources":["../../../../src/foundations/account-deletion/processors/account-deletion.processor.ts"],"names":[],"mappings":"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"}
|