@carlonicora/nja-todos 0.0.1 → 1.0.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/LICENSE +675 -0
- package/README.md +791 -2
- package/dist/api/common/decorate.d.ts +21 -0
- package/dist/api/common/decorate.d.ts.map +1 -0
- package/dist/api/common/decorate.js +39 -0
- package/dist/api/common/decorate.js.map +1 -0
- package/dist/api/config/todos.config.d.ts +51 -0
- package/dist/api/config/todos.config.d.ts.map +1 -0
- package/dist/api/config/todos.config.js +7 -0
- package/dist/api/config/todos.config.js.map +1 -0
- package/dist/api/events/todos.event.payloads.d.ts +21 -0
- package/dist/api/events/todos.event.payloads.d.ts.map +1 -0
- package/dist/api/events/todos.event.payloads.js +3 -0
- package/dist/api/events/todos.event.payloads.js.map +1 -0
- package/dist/api/index.d.ts +22 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +49 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/notifications/todos.notification.processor.d.ts +48 -0
- package/dist/api/notifications/todos.notification.processor.d.ts.map +1 -0
- package/dist/api/notifications/todos.notification.processor.js +251 -0
- package/dist/api/notifications/todos.notification.processor.js.map +1 -0
- package/dist/api/notifications/todos.queue.d.ts +41 -0
- package/dist/api/notifications/todos.queue.d.ts.map +1 -0
- package/dist/api/notifications/todos.queue.js +35 -0
- package/dist/api/notifications/todos.queue.js.map +1 -0
- package/dist/api/task/controllers/task.controller.factory.d.ts +38 -0
- package/dist/api/task/controllers/task.controller.factory.d.ts.map +1 -0
- package/dist/api/task/controllers/task.controller.factory.js +314 -0
- package/dist/api/task/controllers/task.controller.factory.js.map +1 -0
- package/dist/api/task/dtos/task.dtos.d.ts +15 -0
- package/dist/api/task/dtos/task.dtos.d.ts.map +1 -0
- package/dist/api/task/dtos/task.dtos.js +260 -0
- package/dist/api/task/dtos/task.dtos.js.map +1 -0
- package/dist/api/task/entities/task.d.ts +21 -0
- package/dist/api/task/entities/task.d.ts.map +1 -0
- package/dist/api/task/entities/task.js +95 -0
- package/dist/api/task/entities/task.js.map +1 -0
- package/dist/api/task/entities/task.meta.d.ts +3 -0
- package/dist/api/task/entities/task.meta.d.ts.map +1 -0
- package/dist/api/task/entities/task.meta.js +11 -0
- package/dist/api/task/entities/task.meta.js.map +1 -0
- package/dist/api/task/repositories/task.repository.d.ts +104 -0
- package/dist/api/task/repositories/task.repository.d.ts.map +1 -0
- package/dist/api/task/repositories/task.repository.js +328 -0
- package/dist/api/task/repositories/task.repository.js.map +1 -0
- package/dist/api/task/services/task.service.d.ts +149 -0
- package/dist/api/task/services/task.service.d.ts.map +1 -0
- package/dist/api/task/services/task.service.js +378 -0
- package/dist/api/task/services/task.service.js.map +1 -0
- package/dist/api/taskcomment/controllers/taskcomment.controller.factory.d.ts +44 -0
- package/dist/api/taskcomment/controllers/taskcomment.controller.factory.d.ts.map +1 -0
- package/dist/api/taskcomment/controllers/taskcomment.controller.factory.js +136 -0
- package/dist/api/taskcomment/controllers/taskcomment.controller.factory.js.map +1 -0
- package/dist/api/taskcomment/dtos/taskcomment.post.dto.d.ts +23 -0
- package/dist/api/taskcomment/dtos/taskcomment.post.dto.d.ts.map +1 -0
- package/dist/api/taskcomment/dtos/taskcomment.post.dto.js +87 -0
- package/dist/api/taskcomment/dtos/taskcomment.post.dto.js.map +1 -0
- package/dist/api/taskcomment/dtos/taskcomment.put.dto.d.ts +21 -0
- package/dist/api/taskcomment/dtos/taskcomment.put.dto.d.ts.map +1 -0
- package/dist/api/taskcomment/dtos/taskcomment.put.dto.js +71 -0
- package/dist/api/taskcomment/dtos/taskcomment.put.dto.js.map +1 -0
- package/dist/api/taskcomment/entities/taskcomment.d.ts +11 -0
- package/dist/api/taskcomment/entities/taskcomment.d.ts.map +1 -0
- package/dist/api/taskcomment/entities/taskcomment.js +44 -0
- package/dist/api/taskcomment/entities/taskcomment.js.map +1 -0
- package/dist/api/taskcomment/entities/taskcomment.meta.d.ts +5 -0
- package/dist/api/taskcomment/entities/taskcomment.meta.d.ts.map +1 -0
- package/dist/api/taskcomment/entities/taskcomment.meta.js +13 -0
- package/dist/api/taskcomment/entities/taskcomment.meta.js.map +1 -0
- package/dist/api/taskcomment/repositories/taskcomment.repository.d.ts +25 -0
- package/dist/api/taskcomment/repositories/taskcomment.repository.d.ts.map +1 -0
- package/dist/api/taskcomment/repositories/taskcomment.repository.js +73 -0
- package/dist/api/taskcomment/repositories/taskcomment.repository.js.map +1 -0
- package/dist/api/taskcomment/services/taskcomment.service.d.ts +78 -0
- package/dist/api/taskcomment/services/taskcomment.service.d.ts.map +1 -0
- package/dist/api/taskcomment/services/taskcomment.service.js +190 -0
- package/dist/api/taskcomment/services/taskcomment.service.js.map +1 -0
- package/dist/api/todos.module.d.ts +20 -0
- package/dist/api/todos.module.d.ts.map +1 -0
- package/dist/api/todos.module.js +143 -0
- package/dist/api/todos.module.js.map +1 -0
- package/dist/chunk-CO56HIPE.mjs +283 -0
- package/dist/chunk-CO56HIPE.mjs.map +1 -0
- package/dist/chunk-K6KLDGC2.js +283 -0
- package/dist/chunk-K6KLDGC2.js.map +1 -0
- package/dist/seed/index.d.ts +4 -0
- package/dist/seed/index.d.ts.map +1 -0
- package/dist/seed/index.js +9 -0
- package/dist/seed/index.js.map +1 -0
- package/dist/seed/todos.module.seed.d.ts +12 -0
- package/dist/seed/todos.module.seed.d.ts.map +1 -0
- package/dist/seed/todos.module.seed.js +54 -0
- package/dist/seed/todos.module.seed.js.map +1 -0
- package/dist/shared/index.d.ts +7 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +23 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/task.completed.filter.d.ts +2 -0
- package/dist/shared/task.completed.filter.d.ts.map +1 -0
- package/dist/shared/task.completed.filter.js +3 -0
- package/dist/shared/task.completed.filter.js.map +1 -0
- package/dist/shared/task.priority.d.ts +6 -0
- package/dist/shared/task.priority.d.ts.map +1 -0
- package/dist/shared/task.priority.js +10 -0
- package/dist/shared/task.priority.js.map +1 -0
- package/dist/shared/todos.endpoints.d.ts +7 -0
- package/dist/shared/todos.endpoints.d.ts.map +1 -0
- package/dist/shared/todos.endpoints.js +10 -0
- package/dist/shared/todos.endpoints.js.map +1 -0
- package/dist/shared/todos.events.d.ts +13 -0
- package/dist/shared/todos.events.d.ts.map +1 -0
- package/dist/shared/todos.events.js +16 -0
- package/dist/shared/todos.events.js.map +1 -0
- package/dist/shared/todos.module.ids.d.ts +5 -0
- package/dist/shared/todos.module.ids.d.ts.map +1 -0
- package/dist/shared/todos.module.ids.js +8 -0
- package/dist/shared/todos.module.ids.js.map +1 -0
- package/dist/shared/todos.notification.types.d.ts +6 -0
- package/dist/shared/todos.notification.types.d.ts.map +1 -0
- package/dist/shared/todos.notification.types.js +9 -0
- package/dist/shared/todos.notification.types.js.map +1 -0
- package/dist/web/config/todos.config.d.ts +25 -0
- package/dist/web/config/todos.config.d.ts.map +1 -0
- package/dist/web/config/todos.ui.config.d.ts +28 -0
- package/dist/web/config/todos.ui.config.d.ts.map +1 -0
- package/dist/web/core.d.ts +18 -0
- package/dist/web/core.d.ts.map +1 -0
- package/dist/web/core.js +208 -0
- package/dist/web/core.js.map +1 -0
- package/dist/web/core.mjs +208 -0
- package/dist/web/core.mjs.map +1 -0
- package/dist/web/index.d.ts +22 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +1959 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/index.mjs +1958 -0
- package/dist/web/index.mjs.map +1 -0
- package/dist/web/task/TaskModule.d.ts +6 -0
- package/dist/web/task/TaskModule.d.ts.map +1 -0
- package/dist/web/task/components/EisenhowerIcon.d.ts +9 -0
- package/dist/web/task/components/EisenhowerIcon.d.ts.map +1 -0
- package/dist/web/task/components/EisenhowerMatrixBoard.d.ts +21 -0
- package/dist/web/task/components/EisenhowerMatrixBoard.d.ts.map +1 -0
- package/dist/web/task/components/TaskMatrixCard.d.ts +11 -0
- package/dist/web/task/components/TaskMatrixCard.d.ts.map +1 -0
- package/dist/web/task/components/containers/TaskListContainer.d.ts +12 -0
- package/dist/web/task/components/containers/TaskListContainer.d.ts.map +1 -0
- package/dist/web/task/components/editors/TaskEditor.d.ts +12 -0
- package/dist/web/task/components/editors/TaskEditor.d.ts.map +1 -0
- package/dist/web/task/components/filters/TaskListFilters.d.ts +9 -0
- package/dist/web/task/components/filters/TaskListFilters.d.ts.map +1 -0
- package/dist/web/task/components/filters/TaskViewSwitcher.d.ts +9 -0
- package/dist/web/task/components/filters/TaskViewSwitcher.d.ts.map +1 -0
- package/dist/web/task/components/forms/TaskCreateButton.d.ts +5 -0
- package/dist/web/task/components/forms/TaskCreateButton.d.ts.map +1 -0
- package/dist/web/task/components/forms/TaskDeleter.d.ts +8 -0
- package/dist/web/task/components/forms/TaskDeleter.d.ts.map +1 -0
- package/dist/web/task/components/lists/TasksList.d.ts +20 -0
- package/dist/web/task/components/lists/TasksList.d.ts.map +1 -0
- package/dist/web/task/components/screens/UserTasksScreen.d.ts +5 -0
- package/dist/web/task/components/screens/UserTasksScreen.d.ts.map +1 -0
- package/dist/web/task/contexts/TaskContext.d.ts +29 -0
- package/dist/web/task/contexts/TaskContext.d.ts.map +1 -0
- package/dist/web/task/data/Task.d.ts +25 -0
- package/dist/web/task/data/Task.d.ts.map +1 -0
- package/dist/web/task/data/TaskFields.d.ts +12 -0
- package/dist/web/task/data/TaskFields.d.ts.map +1 -0
- package/dist/web/task/data/TaskInterface.d.ts +29 -0
- package/dist/web/task/data/TaskInterface.d.ts.map +1 -0
- package/dist/web/task/data/TaskService.d.ts +51 -0
- package/dist/web/task/data/TaskService.d.ts.map +1 -0
- package/dist/web/task/hooks/useTaskDeepLink.d.ts +12 -0
- package/dist/web/task/hooks/useTaskDeepLink.d.ts.map +1 -0
- package/dist/web/task/hooks/useTaskOverdueParam.d.ts +19 -0
- package/dist/web/task/hooks/useTaskOverdueParam.d.ts.map +1 -0
- package/dist/web/task/hooks/useTaskTableStructure.d.ts +8 -0
- package/dist/web/task/hooks/useTaskTableStructure.d.ts.map +1 -0
- package/dist/web/task/lib/task.priority.options.d.ts +5 -0
- package/dist/web/task/lib/task.priority.options.d.ts.map +1 -0
- package/dist/web/task/utils/dueDate.d.ts +11 -0
- package/dist/web/task/utils/dueDate.d.ts.map +1 -0
- package/dist/web/task/utils/getEisenhowerQuadrant.d.ts +4 -0
- package/dist/web/task/utils/getEisenhowerQuadrant.d.ts.map +1 -0
- package/dist/web/task/utils/isTaskOverdue.d.ts +12 -0
- package/dist/web/task/utils/isTaskOverdue.d.ts.map +1 -0
- package/dist/web/taskcomment/TaskCommentModule.d.ts +5 -0
- package/dist/web/taskcomment/TaskCommentModule.d.ts.map +1 -0
- package/dist/web/taskcomment/components/forms/TaskCommentEditor.d.ts +2 -0
- package/dist/web/taskcomment/components/forms/TaskCommentEditor.d.ts.map +1 -0
- package/dist/web/taskcomment/components/lists/TaskCommentList.d.ts +2 -0
- package/dist/web/taskcomment/components/lists/TaskCommentList.d.ts.map +1 -0
- package/dist/web/taskcomment/contexts/TaskCommentContext.d.ts +22 -0
- package/dist/web/taskcomment/contexts/TaskCommentContext.d.ts.map +1 -0
- package/dist/web/taskcomment/data/TaskComment.d.ts +11 -0
- package/dist/web/taskcomment/data/TaskComment.d.ts.map +1 -0
- package/dist/web/taskcomment/data/TaskCommentInterface.d.ts +12 -0
- package/dist/web/taskcomment/data/TaskCommentInterface.d.ts.map +1 -0
- package/dist/web/taskcomment/data/TaskCommentService.d.ts +16 -0
- package/dist/web/taskcomment/data/TaskCommentService.d.ts.map +1 -0
- package/dist/web/todos.modules.d.ts +10 -0
- package/dist/web/todos.modules.d.ts.map +1 -0
- package/dist/web/utils/isNotFoundError.d.ts +11 -0
- package/dist/web/utils/isNotFoundError.d.ts.map +1 -0
- package/i18n/en/todos.json +13 -0
- package/i18n/it/todos.json +13 -0
- package/messages/en.json +132 -0
- package/messages/it.json +132 -0
- package/package.json +214 -5
- package/templates/email/en/taskAssigned.hbs +31 -0
- package/templates/email/en/taskCommented.hbs +31 -0
- package/templates/email/en/taskCompleted.hbs +31 -0
- package/templates/email/it/taskAssigned.hbs +31 -0
- package/templates/email/it/taskCommented.hbs +31 -0
- package/templates/email/it/taskCompleted.hbs +31 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers that apply decorators in code, for the controller classes `TodosModule.forRoot` builds
|
|
3
|
+
* (Decisions on record → "Dynamic classes").
|
|
4
|
+
*/
|
|
5
|
+
/** Any class constructor: a controller class or a DTO class built at runtime. */
|
|
6
|
+
type AnyClass = abstract new (...args: any[]) => unknown;
|
|
7
|
+
/**
|
|
8
|
+
* Applies method decorators to `target.prototype[key]` one at a time, in the given order, so a
|
|
9
|
+
* wrapper decorator (`@CacheInvalidate`, `@Audit`, …) sees the metadata written before it and
|
|
10
|
+
* copies it onto its wrapper.
|
|
11
|
+
*/
|
|
12
|
+
export declare function decorateMethod(target: AnyClass, key: string, decorators: MethodDecorator[]): void;
|
|
13
|
+
/** Applies class decorators in the given order; a decorator that returns a class replaces the target. */
|
|
14
|
+
export declare function decorateClass<T extends AnyClass>(target: T, decorators: ClassDecorator[]): T;
|
|
15
|
+
/**
|
|
16
|
+
* Sets the declared type of one handler parameter, so the global `ValidationPipe`
|
|
17
|
+
* (`whitelist: true, transform: true`) validates the body against a class built at runtime.
|
|
18
|
+
*/
|
|
19
|
+
export declare function setParamType(target: AnyClass, key: string, index: number, type: AnyClass): void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=decorate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorate.d.ts","sourceRoot":"","sources":["../../../src/api/common/decorate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iFAAiF;AACjF,KAAK,QAAQ,GAAG,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,IAAI,CAMjG;AAED,yGAAyG;AACzG,wBAAgB,aAAa,CAAC,CAAC,SAAS,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,CAAC,CAI5F;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAI/F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Helpers that apply decorators in code, for the controller classes `TodosModule.forRoot` builds
|
|
4
|
+
* (Decisions on record → "Dynamic classes").
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.decorateMethod = decorateMethod;
|
|
8
|
+
exports.decorateClass = decorateClass;
|
|
9
|
+
exports.setParamType = setParamType;
|
|
10
|
+
/**
|
|
11
|
+
* Applies method decorators to `target.prototype[key]` one at a time, in the given order, so a
|
|
12
|
+
* wrapper decorator (`@CacheInvalidate`, `@Audit`, …) sees the metadata written before it and
|
|
13
|
+
* copies it onto its wrapper.
|
|
14
|
+
*/
|
|
15
|
+
function decorateMethod(target, key, decorators) {
|
|
16
|
+
for (const decorator of decorators) {
|
|
17
|
+
const descriptor = Object.getOwnPropertyDescriptor(target.prototype, key);
|
|
18
|
+
const result = decorator(target.prototype, key, descriptor);
|
|
19
|
+
if (result)
|
|
20
|
+
Object.defineProperty(target.prototype, key, result);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Applies class decorators in the given order; a decorator that returns a class replaces the target. */
|
|
24
|
+
function decorateClass(target, decorators) {
|
|
25
|
+
let current = target;
|
|
26
|
+
for (const decorator of decorators)
|
|
27
|
+
current = decorator(current) ?? current;
|
|
28
|
+
return current;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets the declared type of one handler parameter, so the global `ValidationPipe`
|
|
32
|
+
* (`whitelist: true, transform: true`) validates the body against a class built at runtime.
|
|
33
|
+
*/
|
|
34
|
+
function setParamType(target, key, index, type) {
|
|
35
|
+
const types = [...(Reflect.getMetadata("design:paramtypes", target.prototype, key) ?? [])];
|
|
36
|
+
types[index] = type;
|
|
37
|
+
Reflect.defineMetadata("design:paramtypes", types, target.prototype, key);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=decorate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorate.js","sourceRoot":"","sources":["../../../src/api/common/decorate.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAUH,wCAMC;AAGD,sCAIC;AAMD,oCAIC;AA5BD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,MAAgB,EAAE,GAAW,EAAE,UAA6B;IACzF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,CAAE,CAAC;QAC3E,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC5D,IAAI,MAAM;YAAE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;AACH,CAAC;AAED,yGAAyG;AACzG,SAAgB,aAAa,CAAqB,MAAS,EAAE,UAA4B;IACvF,IAAI,OAAO,GAAG,MAAM,CAAC;IACrB,KAAK,MAAM,SAAS,IAAI,UAAU;QAAE,OAAO,GAAI,SAAS,CAAC,OAAO,CAA8B,IAAI,OAAO,CAAC;IAC1G,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,MAAgB,EAAE,GAAW,EAAE,KAAa,EAAE,IAAc;IACvF,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3F,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { DataMeta } from "@carlonicora/nestjs-neo4jsonapi";
|
|
2
|
+
import type { DynamicModule, ForwardReference, Type } from "@nestjs/common";
|
|
3
|
+
import type { Task } from "../task/entities/task";
|
|
4
|
+
export interface TodosRelationshipConfig {
|
|
5
|
+
key: string;
|
|
6
|
+
model: DataMeta;
|
|
7
|
+
relationship: string;
|
|
8
|
+
direction: "in" | "out";
|
|
9
|
+
cardinality: "one" | "many";
|
|
10
|
+
required?: boolean;
|
|
11
|
+
immutable?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
/** Read rule. "company": a task linked through this relationship is visible to every user of the company.
|
|
14
|
+
* A function: returns a Cypher condition that starts with `WHERE`, true when `currentUser` may access `linked`.
|
|
15
|
+
* Omitted: the link grants no access. */
|
|
16
|
+
access?: "company" | ((aliases: {
|
|
17
|
+
linked: string;
|
|
18
|
+
currentUser: string;
|
|
19
|
+
}) => string);
|
|
20
|
+
dtoKey?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
reverse?: {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
cardinality?: "one" | "many";
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type TodosRouteKind = "create" | "readOne" | "list" | "update" | "delete";
|
|
29
|
+
export interface TodosControllerDecorators {
|
|
30
|
+
controller?: ClassDecorator[];
|
|
31
|
+
routes?: Partial<Record<TodosRouteKind, MethodDecorator[]>>;
|
|
32
|
+
/** Extra decorators for the list routes that name a linked entity, keyed by relationship key (added after routes.list). */
|
|
33
|
+
relatedList?: Record<string, MethodDecorator[]>;
|
|
34
|
+
}
|
|
35
|
+
export interface TodosModuleConfig {
|
|
36
|
+
relationships: TodosRelationshipConfig[];
|
|
37
|
+
taskPath: (task: Task) => string;
|
|
38
|
+
catalogue?: {
|
|
39
|
+
task: string;
|
|
40
|
+
comment: string;
|
|
41
|
+
};
|
|
42
|
+
decorators?: {
|
|
43
|
+
task?: TodosControllerDecorators;
|
|
44
|
+
comment?: TodosControllerDecorators;
|
|
45
|
+
};
|
|
46
|
+
imports?: Array<Type<unknown> | DynamicModule | ForwardReference>;
|
|
47
|
+
}
|
|
48
|
+
export declare const TODOS_CONFIG: unique symbol;
|
|
49
|
+
export declare const TASK_DESCRIPTOR: unique symbol;
|
|
50
|
+
export declare const TASK_COMMENT_DESCRIPTOR: unique symbol;
|
|
51
|
+
//# sourceMappingURL=todos.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.config.d.ts","sourceRoot":"","sources":["../../../src/api/config/todos.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;IACxB,WAAW,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,O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,eAAO,MAAM,YAAY,eAAyB,CAAC;AACnD,eAAO,MAAM,eAAe,eAA4B,CAAC;AACzD,eAAO,MAAM,uBAAuB,eAAoC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TASK_COMMENT_DESCRIPTOR = exports.TASK_DESCRIPTOR = exports.TODOS_CONFIG = void 0;
|
|
4
|
+
exports.TODOS_CONFIG = Symbol("TODOS_CONFIG");
|
|
5
|
+
exports.TASK_DESCRIPTOR = Symbol("TASK_DESCRIPTOR");
|
|
6
|
+
exports.TASK_COMMENT_DESCRIPTOR = Symbol("TASK_COMMENT_DESCRIPTOR");
|
|
7
|
+
//# sourceMappingURL=todos.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.config.js","sourceRoot":"","sources":["../../../src/api/config/todos.config.ts"],"names":[],"mappings":";;;AAuCa,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACtC,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC5C,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Task } from "../task/entities/task";
|
|
2
|
+
import type { TaskComment } from "../taskcomment/entities/taskcomment";
|
|
3
|
+
export interface TodosTaskEventPayload {
|
|
4
|
+
task: Task;
|
|
5
|
+
previous?: Task;
|
|
6
|
+
actorId: string;
|
|
7
|
+
companyId: string;
|
|
8
|
+
changes: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface TodosCommentEventPayload {
|
|
11
|
+
/** The comment after the change; before it, for `deleted`. */
|
|
12
|
+
comment: TaskComment;
|
|
13
|
+
/** The comment before the change; present on `updated` only. */
|
|
14
|
+
previous?: TaskComment;
|
|
15
|
+
taskId: string;
|
|
16
|
+
actorId: string;
|
|
17
|
+
companyId: string;
|
|
18
|
+
/** Names of the changed fields (`content` on `updated`); empty on `created` and `deleted`. */
|
|
19
|
+
changes: string[];
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=todos.event.payloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.event.payloads.d.ts","sourceRoot":"","sources":["../../../src/api/events/todos.event.payloads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEvE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,8DAA8D;IAC9D,OAAO,EAAE,WAAW,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.event.payloads.js","sourceRoot":"","sources":["../../../src/api/events/todos.event.payloads.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from "../shared";
|
|
2
|
+
export { TodosModule } from "./todos.module";
|
|
3
|
+
export { TODOS_CONFIG, TASK_DESCRIPTOR, TASK_COMMENT_DESCRIPTOR } from "./config/todos.config";
|
|
4
|
+
export type { TodosModuleConfig, TodosRelationshipConfig, TodosControllerDecorators, TodosRouteKind, } from "./config/todos.config";
|
|
5
|
+
export { taskMeta } from "./task/entities/task.meta";
|
|
6
|
+
export { taskCommentMeta } from "./taskcomment/entities/taskcomment.meta";
|
|
7
|
+
export { buildTaskDescriptor } from "./task/entities/task";
|
|
8
|
+
export type { Task } from "./task/entities/task";
|
|
9
|
+
export { buildTaskCommentDescriptor } from "./taskcomment/entities/taskcomment";
|
|
10
|
+
export type { TaskComment } from "./taskcomment/entities/taskcomment";
|
|
11
|
+
export { buildTaskDtos } from "./task/dtos/task.dtos";
|
|
12
|
+
export type { TaskDtoClasses } from "./task/dtos/task.dtos";
|
|
13
|
+
export { TaskRepository } from "./task/repositories/task.repository";
|
|
14
|
+
export { TaskCommentRepository } from "./taskcomment/repositories/taskcomment.repository";
|
|
15
|
+
export { TaskService } from "./task/services/task.service";
|
|
16
|
+
export { TaskCommentService } from "./taskcomment/services/taskcomment.service";
|
|
17
|
+
export type { TodosTaskEventPayload, TodosCommentEventPayload } from "./events/todos.event.payloads";
|
|
18
|
+
export { TODOS_QUEUE, TodosJobName } from "./notifications/todos.queue";
|
|
19
|
+
export type { TodosNotificationJobData } from "./notifications/todos.queue";
|
|
20
|
+
export { todosModuleSeedQueries, TODOS_MODULE_SEED_QUERY } from "../seed/todos.module.seed";
|
|
21
|
+
export type { TodosSeedQuery } from "../seed/todos.module.seed";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,YAAY,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAEhF,YAAY,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACxE,YAAY,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5E,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC5F,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
exports.TODOS_MODULE_SEED_QUERY = exports.todosModuleSeedQueries = exports.TodosJobName = exports.TODOS_QUEUE = exports.TaskCommentService = exports.TaskService = exports.TaskCommentRepository = exports.TaskRepository = exports.buildTaskDtos = exports.buildTaskCommentDescriptor = exports.buildTaskDescriptor = exports.taskCommentMeta = exports.taskMeta = exports.TASK_COMMENT_DESCRIPTOR = exports.TASK_DESCRIPTOR = exports.TODOS_CONFIG = exports.TodosModule = void 0;
|
|
18
|
+
__exportStar(require("../shared"), exports);
|
|
19
|
+
var todos_module_1 = require("./todos.module");
|
|
20
|
+
Object.defineProperty(exports, "TodosModule", { enumerable: true, get: function () { return todos_module_1.TodosModule; } });
|
|
21
|
+
var todos_config_1 = require("./config/todos.config");
|
|
22
|
+
Object.defineProperty(exports, "TODOS_CONFIG", { enumerable: true, get: function () { return todos_config_1.TODOS_CONFIG; } });
|
|
23
|
+
Object.defineProperty(exports, "TASK_DESCRIPTOR", { enumerable: true, get: function () { return todos_config_1.TASK_DESCRIPTOR; } });
|
|
24
|
+
Object.defineProperty(exports, "TASK_COMMENT_DESCRIPTOR", { enumerable: true, get: function () { return todos_config_1.TASK_COMMENT_DESCRIPTOR; } });
|
|
25
|
+
var task_meta_1 = require("./task/entities/task.meta");
|
|
26
|
+
Object.defineProperty(exports, "taskMeta", { enumerable: true, get: function () { return task_meta_1.taskMeta; } });
|
|
27
|
+
var taskcomment_meta_1 = require("./taskcomment/entities/taskcomment.meta");
|
|
28
|
+
Object.defineProperty(exports, "taskCommentMeta", { enumerable: true, get: function () { return taskcomment_meta_1.taskCommentMeta; } });
|
|
29
|
+
var task_1 = require("./task/entities/task");
|
|
30
|
+
Object.defineProperty(exports, "buildTaskDescriptor", { enumerable: true, get: function () { return task_1.buildTaskDescriptor; } });
|
|
31
|
+
var taskcomment_1 = require("./taskcomment/entities/taskcomment");
|
|
32
|
+
Object.defineProperty(exports, "buildTaskCommentDescriptor", { enumerable: true, get: function () { return taskcomment_1.buildTaskCommentDescriptor; } });
|
|
33
|
+
var task_dtos_1 = require("./task/dtos/task.dtos");
|
|
34
|
+
Object.defineProperty(exports, "buildTaskDtos", { enumerable: true, get: function () { return task_dtos_1.buildTaskDtos; } });
|
|
35
|
+
var task_repository_1 = require("./task/repositories/task.repository");
|
|
36
|
+
Object.defineProperty(exports, "TaskRepository", { enumerable: true, get: function () { return task_repository_1.TaskRepository; } });
|
|
37
|
+
var taskcomment_repository_1 = require("./taskcomment/repositories/taskcomment.repository");
|
|
38
|
+
Object.defineProperty(exports, "TaskCommentRepository", { enumerable: true, get: function () { return taskcomment_repository_1.TaskCommentRepository; } });
|
|
39
|
+
var task_service_1 = require("./task/services/task.service");
|
|
40
|
+
Object.defineProperty(exports, "TaskService", { enumerable: true, get: function () { return task_service_1.TaskService; } });
|
|
41
|
+
var taskcomment_service_1 = require("./taskcomment/services/taskcomment.service");
|
|
42
|
+
Object.defineProperty(exports, "TaskCommentService", { enumerable: true, get: function () { return taskcomment_service_1.TaskCommentService; } });
|
|
43
|
+
var todos_queue_1 = require("./notifications/todos.queue");
|
|
44
|
+
Object.defineProperty(exports, "TODOS_QUEUE", { enumerable: true, get: function () { return todos_queue_1.TODOS_QUEUE; } });
|
|
45
|
+
Object.defineProperty(exports, "TodosJobName", { enumerable: true, get: function () { return todos_queue_1.TodosJobName; } });
|
|
46
|
+
var todos_module_seed_1 = require("../seed/todos.module.seed");
|
|
47
|
+
Object.defineProperty(exports, "todosModuleSeedQueries", { enumerable: true, get: function () { return todos_module_seed_1.todosModuleSeedQueries; } });
|
|
48
|
+
Object.defineProperty(exports, "TODOS_MODULE_SEED_QUERY", { enumerable: true, get: function () { return todos_module_seed_1.TODOS_MODULE_SEED_QUERY; } });
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAE1B,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,sDAA+F;AAAtF,4GAAA,YAAY,OAAA;AAAE,+GAAA,eAAe,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAQ/D,uDAAqD;AAA5C,qGAAA,QAAQ,OAAA;AACjB,4EAA0E;AAAjE,mHAAA,eAAe,OAAA;AACxB,6CAA2D;AAAlD,2GAAA,mBAAmB,OAAA;AAE5B,kEAAgF;AAAvE,yHAAA,0BAA0B,OAAA;AAEnC,mDAAsD;AAA7C,0GAAA,aAAa,OAAA;AAGtB,uEAAqE;AAA5D,iHAAA,cAAc,OAAA;AACvB,4FAA0F;AAAjF,+HAAA,qBAAqB,OAAA;AAC9B,6DAA2D;AAAlD,2GAAA,WAAW,OAAA;AACpB,kFAAgF;AAAvE,yHAAA,kBAAkB,OAAA;AAG3B,2DAAwE;AAA/D,0GAAA,WAAW,OAAA;AAAE,2GAAA,YAAY,OAAA;AAGlC,+DAA4F;AAAnF,2HAAA,sBAAsB,OAAA;AAAE,4HAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AppLoggingService, BaseConfigInterface, EmailService, NotificationServices, PushService, UserService, WebSocketService } from "@carlonicora/nestjs-neo4jsonapi";
|
|
2
|
+
import { WorkerHost } from "@nestjs/bullmq";
|
|
3
|
+
import { ConfigService } from "@nestjs/config";
|
|
4
|
+
import { Job } from "bullmq";
|
|
5
|
+
import { ClsService } from "nestjs-cls";
|
|
6
|
+
import { I18nService } from "nestjs-i18n";
|
|
7
|
+
import { TodosModuleConfig } from "../config/todos.config";
|
|
8
|
+
import { TaskService } from "../task/services/task.service";
|
|
9
|
+
import { TaskCommentService } from "../taskcomment/services/taskcomment.service";
|
|
10
|
+
import { TodosNotificationJobData } from "./todos.queue";
|
|
11
|
+
/**
|
|
12
|
+
* Sends the three task notifications (assigned, completed, commented on): in-app notification,
|
|
13
|
+
* websocket, web push, email. No retries (attempts 1, maxStalledCount 0): the job notifies.
|
|
14
|
+
* The guard against a job delivered twice is the notification's idempotency key
|
|
15
|
+
* `todos-<job.id>-<recipientId>` (job ids are `<name>-<uuid>`, made by the service): a second
|
|
16
|
+
* delivery finds the notification and sends nothing on any channel. Every failure is caught
|
|
17
|
+
* per recipient and per channel and logged; process() never rethrows.
|
|
18
|
+
*
|
|
19
|
+
* Calls services only (tasks, users, notifications, push, comments), never a repository. Each recipient is written to in their
|
|
20
|
+
* saved language; without one, the request language the job carries, then the email default.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TodosNotificationProcessor extends WorkerHost {
|
|
23
|
+
private readonly logger;
|
|
24
|
+
private readonly cls;
|
|
25
|
+
private readonly config;
|
|
26
|
+
private readonly i18n;
|
|
27
|
+
private readonly taskService;
|
|
28
|
+
private readonly taskCommentService;
|
|
29
|
+
private readonly userService;
|
|
30
|
+
private readonly notificationServices;
|
|
31
|
+
private readonly webSocketService;
|
|
32
|
+
private readonly pushService;
|
|
33
|
+
private readonly emailService;
|
|
34
|
+
private readonly todosConfig;
|
|
35
|
+
constructor(logger: AppLoggingService, cls: ClsService, config: ConfigService<BaseConfigInterface>, i18n: I18nService, taskService: TaskService, taskCommentService: TaskCommentService, userService: UserService, notificationServices: NotificationServices, webSocketService: WebSocketService, pushService: PushService, emailService: EmailService, todosConfig: TodosModuleConfig);
|
|
36
|
+
onActive(job: Job): void;
|
|
37
|
+
onError(job?: Job): void;
|
|
38
|
+
onCompleted(job: Job): void;
|
|
39
|
+
process(job: Job<TodosNotificationJobData>): Promise<void>;
|
|
40
|
+
/** Who is told: the assignee for an assignment; assignee, creator and comment authors otherwise. Never the actor, each once. */
|
|
41
|
+
private recipients;
|
|
42
|
+
private notifyRecipient;
|
|
43
|
+
private get defaultLocale();
|
|
44
|
+
/** The id of a to-one JSON:API relationship (`{ data: { type, id } }`), else undefined. */
|
|
45
|
+
private relatedId;
|
|
46
|
+
private message;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=todos.notification.processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.notification.processor.d.ts","sourceRoot":"","sources":["../../../src/api/notifications/todos.notification.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EAGnB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EAEX,WAAW,EACX,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAA4B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAgB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAgD,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAQvG;;;;;;;;;;GAUG;AACH,qBACa,0BAA2B,SAAQ,UAAU;IAEtD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IACP,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAXjC,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAC1C,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,kBAAkB,EACtC,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EACJ,WAAW,EAAE,iBAAiB;IAMvE,QAAQ,CAAC,GAAG,EAAE,GAAG;IAKjB,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI;IASxB,WAAW,CAAC,GAAG,EAAE,GAAG;IAId,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwChE,gIAAgI;YAClH,UAAU;YAiBV,eAAe;IA6F7B,OAAO,KAAK,aAAa,GAExB;IAED,2FAA2F;IAC3F,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,OAAO;CAGhB"}
|
|
@@ -0,0 +1,251 @@
|
|
|
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.TodosNotificationProcessor = void 0;
|
|
16
|
+
const nestjs_neo4jsonapi_1 = require("@carlonicora/nestjs-neo4jsonapi");
|
|
17
|
+
const bullmq_1 = require("@nestjs/bullmq");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const config_1 = require("@nestjs/config");
|
|
20
|
+
const bullmq_2 = require("bullmq");
|
|
21
|
+
const nestjs_cls_1 = require("nestjs-cls");
|
|
22
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
23
|
+
const todos_config_1 = require("../config/todos.config");
|
|
24
|
+
const task_meta_1 = require("../task/entities/task.meta");
|
|
25
|
+
const task_service_1 = require("../task/services/task.service");
|
|
26
|
+
const taskcomment_service_1 = require("../taskcomment/services/taskcomment.service");
|
|
27
|
+
const todos_queue_1 = require("./todos.queue");
|
|
28
|
+
const EMAIL_TEMPLATES = {
|
|
29
|
+
task_assigned: "taskAssigned",
|
|
30
|
+
task_completed: "taskCompleted",
|
|
31
|
+
task_commented_on: "taskCommented",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Sends the three task notifications (assigned, completed, commented on): in-app notification,
|
|
35
|
+
* websocket, web push, email. No retries (attempts 1, maxStalledCount 0): the job notifies.
|
|
36
|
+
* The guard against a job delivered twice is the notification's idempotency key
|
|
37
|
+
* `todos-<job.id>-<recipientId>` (job ids are `<name>-<uuid>`, made by the service): a second
|
|
38
|
+
* delivery finds the notification and sends nothing on any channel. Every failure is caught
|
|
39
|
+
* per recipient and per channel and logged; process() never rethrows.
|
|
40
|
+
*
|
|
41
|
+
* Calls services only (tasks, users, notifications, push, comments), never a repository. Each recipient is written to in their
|
|
42
|
+
* saved language; without one, the request language the job carries, then the email default.
|
|
43
|
+
*/
|
|
44
|
+
let TodosNotificationProcessor = class TodosNotificationProcessor extends bullmq_1.WorkerHost {
|
|
45
|
+
constructor(logger, cls, config, i18n, taskService, taskCommentService, userService, notificationServices, webSocketService, pushService, emailService, todosConfig) {
|
|
46
|
+
super();
|
|
47
|
+
this.logger = logger;
|
|
48
|
+
this.cls = cls;
|
|
49
|
+
this.config = config;
|
|
50
|
+
this.i18n = i18n;
|
|
51
|
+
this.taskService = taskService;
|
|
52
|
+
this.taskCommentService = taskCommentService;
|
|
53
|
+
this.userService = userService;
|
|
54
|
+
this.notificationServices = notificationServices;
|
|
55
|
+
this.webSocketService = webSocketService;
|
|
56
|
+
this.pushService = pushService;
|
|
57
|
+
this.emailService = emailService;
|
|
58
|
+
this.todosConfig = todosConfig;
|
|
59
|
+
}
|
|
60
|
+
onActive(job) {
|
|
61
|
+
this.logger.debug(`Processing ${job?.name} job`);
|
|
62
|
+
}
|
|
63
|
+
onError(job) {
|
|
64
|
+
try {
|
|
65
|
+
this.logger.error(`Error processing ${job?.name} job (ID: ${job?.id}). Reason: ${job?.failedReason}`);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// never throws: there is no run record to fail
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
onCompleted(job) {
|
|
72
|
+
this.logger.debug(`Completed ${job?.name} job (ID: ${job?.id})`);
|
|
73
|
+
}
|
|
74
|
+
async process(job) {
|
|
75
|
+
if (!Object.values(todos_queue_1.TodosJobName).includes(job.name)) {
|
|
76
|
+
throw new Error(`Job ${job.name} not handled by TodosNotificationProcessor`);
|
|
77
|
+
}
|
|
78
|
+
const name = job.name;
|
|
79
|
+
return this.cls.run(async () => {
|
|
80
|
+
this.cls.set("companyId", job.data.companyId);
|
|
81
|
+
this.cls.set("userId", job.data.actorId);
|
|
82
|
+
this.cls.set("isAutomatedJob", true);
|
|
83
|
+
this.cls.set("language", job.data.language ?? this.defaultLocale);
|
|
84
|
+
try {
|
|
85
|
+
const task = await this.taskService.findTaskEntity({ taskId: job.data.taskId });
|
|
86
|
+
if (!task) {
|
|
87
|
+
this.logger.log(`Task ${job.data.taskId} of job ${job.id} not found; nothing to notify`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const recipients = await this.recipients(name, job.data, task);
|
|
91
|
+
if (!recipients.length)
|
|
92
|
+
return;
|
|
93
|
+
const actorName = (await this.userService.findRecordByUserId({ userId: job.data.actorId }).catch(() => null))?.name;
|
|
94
|
+
const path = this.todosConfig.taskPath(task);
|
|
95
|
+
const appUrl = this.config.get("app")?.url ?? "";
|
|
96
|
+
const link = appUrl.replace(/\/$/, "") + path;
|
|
97
|
+
for (const userId of recipients) {
|
|
98
|
+
await this.notifyRecipient({ job, name, task, userId, actorName, path, link });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
this.logger.error(`Job ${job.name} (ID: ${job.id}) failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** Who is told: the assignee for an assignment; assignee, creator and comment authors otherwise. Never the actor, each once. */
|
|
107
|
+
async recipients(name, data, task) {
|
|
108
|
+
let candidates;
|
|
109
|
+
if (name === todos_queue_1.TodosJobName.TaskAssigned) {
|
|
110
|
+
candidates = [data.recipientId];
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const comments = await this.taskCommentService.findByTask({ taskId: task.id, query: {}, fetchAll: true });
|
|
114
|
+
const authors = (comments.data ?? []).map((comment) => this.relatedId(comment.relationships?.owner));
|
|
115
|
+
candidates = [task.assignee?.id, task.owner?.id, ...authors];
|
|
116
|
+
}
|
|
117
|
+
const out = [];
|
|
118
|
+
for (const id of candidates) {
|
|
119
|
+
if (!id || id === data.actorId || out.includes(id))
|
|
120
|
+
continue;
|
|
121
|
+
out.push(id);
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
async notifyRecipient(params) {
|
|
126
|
+
const { job, name, task, userId, path, link } = params;
|
|
127
|
+
const tag = `[${name} ${job.id} → ${userId}]`;
|
|
128
|
+
let user;
|
|
129
|
+
try {
|
|
130
|
+
user = await this.userService.findRecordByUserId({ userId });
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
this.logger.warn(`${tag} recipient not readable: ${this.message(error)}`);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!user)
|
|
137
|
+
return;
|
|
138
|
+
const lang = user.language ?? job.data.language ?? this.defaultLocale;
|
|
139
|
+
const actor = params.actorName ?? this.i18n.t("todos.notification.unknown_actor", { lang });
|
|
140
|
+
let created;
|
|
141
|
+
let id;
|
|
142
|
+
try {
|
|
143
|
+
({ created, id } = await this.notificationServices.createIdempotentOrThrow({
|
|
144
|
+
notificationType: name,
|
|
145
|
+
userId,
|
|
146
|
+
actorId: job.data.actorId,
|
|
147
|
+
targets: [{ id: task.id, label: task_meta_1.taskMeta.labelName }],
|
|
148
|
+
message: task.name,
|
|
149
|
+
actionUrl: path,
|
|
150
|
+
idempotencyKey: `todos-${job.id}-${userId}`,
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
this.logger.warn(`${tag} in-app notification NOT created: ${this.message(error)}`);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (created === false) {
|
|
158
|
+
this.logger.log(`${tag} already notified (${id}); skipping every other channel`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const document = await this.notificationServices.findByIdForUser({ notificationId: id, userId });
|
|
163
|
+
await this.webSocketService.sendMessageToUser(userId, "notification", document);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
this.logger.warn(`${tag} websocket NOT sent: ${this.message(error)}`);
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const pushSubscriptions = await this.pushService.findByUserId({ userId });
|
|
170
|
+
if (pushSubscriptions?.length) {
|
|
171
|
+
await this.pushService.sendNotification({
|
|
172
|
+
pushSubscriptions,
|
|
173
|
+
title: this.i18n.t(`todos.notification.${name}.title`, { lang }),
|
|
174
|
+
message: this.i18n.t(`todos.notification.${name}.message`, {
|
|
175
|
+
lang,
|
|
176
|
+
args: { task: task.name, actor },
|
|
177
|
+
}),
|
|
178
|
+
url: link,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
this.logger.warn(`${tag} web push NOT sent: ${this.message(error)}`);
|
|
184
|
+
}
|
|
185
|
+
if (user.email) {
|
|
186
|
+
const template = EMAIL_TEMPLATES[name];
|
|
187
|
+
try {
|
|
188
|
+
await this.emailService.sendEmail(template, {
|
|
189
|
+
to: user.email,
|
|
190
|
+
subject: this.i18n.t(`todos.email.${template}.subject`, {
|
|
191
|
+
lang,
|
|
192
|
+
args: { task: task.name, actor },
|
|
193
|
+
}),
|
|
194
|
+
name: user.name,
|
|
195
|
+
actorName: actor,
|
|
196
|
+
taskName: task.name,
|
|
197
|
+
taskLink: link,
|
|
198
|
+
}, lang);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
this.logger.warn(`${tag} email NOT sent: ${this.message(error)}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
get defaultLocale() {
|
|
206
|
+
return this.config.get("email")?.defaultLocale ?? "en";
|
|
207
|
+
}
|
|
208
|
+
/** The id of a to-one JSON:API relationship (`{ data: { type, id } }`), else undefined. */
|
|
209
|
+
relatedId(relationship) {
|
|
210
|
+
const data = relationship?.data;
|
|
211
|
+
return data && !Array.isArray(data) ? data.id : undefined;
|
|
212
|
+
}
|
|
213
|
+
message(error) {
|
|
214
|
+
return error instanceof Error ? error.message : String(error);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
exports.TodosNotificationProcessor = TodosNotificationProcessor;
|
|
218
|
+
__decorate([
|
|
219
|
+
(0, bullmq_1.OnWorkerEvent)("active"),
|
|
220
|
+
__metadata("design:type", Function),
|
|
221
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
222
|
+
__metadata("design:returntype", void 0)
|
|
223
|
+
], TodosNotificationProcessor.prototype, "onActive", null);
|
|
224
|
+
__decorate([
|
|
225
|
+
(0, bullmq_1.OnWorkerEvent)("failed"),
|
|
226
|
+
__metadata("design:type", Function),
|
|
227
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
228
|
+
__metadata("design:returntype", void 0)
|
|
229
|
+
], TodosNotificationProcessor.prototype, "onError", null);
|
|
230
|
+
__decorate([
|
|
231
|
+
(0, bullmq_1.OnWorkerEvent)("completed"),
|
|
232
|
+
__metadata("design:type", Function),
|
|
233
|
+
__metadata("design:paramtypes", [bullmq_2.Job]),
|
|
234
|
+
__metadata("design:returntype", void 0)
|
|
235
|
+
], TodosNotificationProcessor.prototype, "onCompleted", null);
|
|
236
|
+
exports.TodosNotificationProcessor = TodosNotificationProcessor = __decorate([
|
|
237
|
+
(0, bullmq_1.Processor)(todos_queue_1.TODOS_QUEUE, { concurrency: 5, lockDuration: 1000 * 60, maxStalledCount: 0 }),
|
|
238
|
+
__param(11, (0, common_1.Inject)(todos_config_1.TODOS_CONFIG)),
|
|
239
|
+
__metadata("design:paramtypes", [nestjs_neo4jsonapi_1.AppLoggingService,
|
|
240
|
+
nestjs_cls_1.ClsService,
|
|
241
|
+
config_1.ConfigService,
|
|
242
|
+
nestjs_i18n_1.I18nService,
|
|
243
|
+
task_service_1.TaskService,
|
|
244
|
+
taskcomment_service_1.TaskCommentService,
|
|
245
|
+
nestjs_neo4jsonapi_1.UserService,
|
|
246
|
+
nestjs_neo4jsonapi_1.NotificationServices,
|
|
247
|
+
nestjs_neo4jsonapi_1.WebSocketService,
|
|
248
|
+
nestjs_neo4jsonapi_1.PushService,
|
|
249
|
+
nestjs_neo4jsonapi_1.EmailService, Object])
|
|
250
|
+
], TodosNotificationProcessor);
|
|
251
|
+
//# sourceMappingURL=todos.notification.processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.notification.processor.js","sourceRoot":"","sources":["../../../src/api/notifications/todos.notification.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wEAWyC;AACzC,2CAAsE;AACtE,2CAAwC;AACxC,2CAA+C;AAC/C,mCAA6B;AAC7B,2CAAwC;AACxC,6CAA0C;AAC1C,yDAAyE;AAEzE,0DAAsD;AACtD,gEAA4D;AAC5D,qFAAiF;AACjF,+CAAuG;AAEvG,MAAM,eAAe,GAAsC;IACzD,aAAa,EAAE,cAAc;IAC7B,cAAc,EAAE,eAAe;IAC/B,iBAAiB,EAAE,eAAe;CACnC,CAAC;AAEF;;;;;;;;;;GAUG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,mBAAU;IACxD,YACmB,MAAyB,EACzB,GAAe,EACf,MAA0C,EAC1C,IAAiB,EACjB,WAAwB,EACxB,kBAAsC,EACtC,WAAwB,EACxB,oBAA0C,EAC1C,gBAAkC,EAClC,WAAwB,EACxB,YAA0B,EACJ,WAA8B;QAErE,KAAK,EAAE,CAAC;QAbS,WAAM,GAAN,MAAM,CAAmB;QACzB,QAAG,GAAH,GAAG,CAAY;QACf,WAAM,GAAN,MAAM,CAAoC;QAC1C,SAAI,GAAJ,IAAI,CAAa;QACjB,gBAAW,GAAX,WAAW,CAAa;QACxB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,gBAAW,GAAX,WAAW,CAAa;QACxB,yBAAoB,GAApB,oB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
2
|
+
* The package's BullMQ queue and job names. 07-queue-workers asks for members of the app's
|
|
3
|
+
* `QueueId` enum and `JobName` constant; a package cannot add members to an app's enum (and the
|
|
4
|
+
* library's `QueueId` is a closed TS enum), so the package exports these typed constants instead.
|
|
5
|
+
* The rule's point holds: every registration, `@Processor` and `queue.add` reads these
|
|
6
|
+
* constants, never a string literal.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TODOS_QUEUE = "nja-todos";
|
|
9
|
+
export declare const TodosJobName: {
|
|
10
|
+
readonly TaskAssigned: "task_assigned";
|
|
11
|
+
readonly TaskCompleted: "task_completed";
|
|
12
|
+
readonly TaskCommentedOn: "task_commented_on";
|
|
13
|
+
};
|
|
14
|
+
export type TodosJobNameValue = (typeof TodosJobName)[keyof typeof TodosJobName];
|
|
15
|
+
export interface TodosNotificationJobData {
|
|
16
|
+
taskId: string;
|
|
17
|
+
actorId: string;
|
|
18
|
+
companyId: string;
|
|
19
|
+
recipientId?: string;
|
|
20
|
+
commentId?: string;
|
|
21
|
+
/** The request's language (CLS `language`), copied when the job is added. Used for a recipient with no saved language. */
|
|
22
|
+
language?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options every registration of the queue spreads. A per-queue `defaultJobOptions` replaces the
|
|
26
|
+
* global block of the library's QueueModule, so `removeOnComplete` / `removeOnFail` are restated.
|
|
27
|
+
* `attempts: 1`: the job notifies, and a retry would notify again.
|
|
28
|
+
*/
|
|
29
|
+
export declare const TODOS_QUEUE_OPTIONS: {
|
|
30
|
+
defaultJobOptions: {
|
|
31
|
+
attempts: 1;
|
|
32
|
+
removeOnComplete: true;
|
|
33
|
+
removeOnFail: {
|
|
34
|
+
age: 3600;
|
|
35
|
+
count: 1000;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** A unique job id; BullMQ refuses a custom id that contains a colon. */
|
|
40
|
+
export declare function todosJobId(name: TodosJobNameValue): string;
|
|
41
|
+
//# sourceMappingURL=todos.queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.queue.d.ts","sourceRoot":"","sources":["../../../src/api/notifications/todos.queue.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,cAAc,CAAC;AAEvC,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAEjF,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0HAA0H;IAC1H,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;CAM/B,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAE1D"}
|