@tstdl/base 0.93.134 → 0.93.135
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/document-management/server/services/document-validation.service.js +1 -1
- package/document-management/server/services/document-workflow.service.js +2 -2
- package/notification/server/services/notification-delivery.worker.d.ts +1 -1
- package/notification/server/services/notification.service.js +1 -1
- package/package.json +1 -1
- package/task-queue/task-context.d.ts +1 -1
- package/task-queue/task-queue.js +1 -1
|
@@ -37,7 +37,7 @@ let DocumentValidationService = DocumentValidationService_1 = class DocumentVali
|
|
|
37
37
|
#validationExecutionService = injectRepository(DocumentValidationExecution);
|
|
38
38
|
#validationExecutionRelatedDocumentService = injectRepository(DocumentValidationExecutionRelatedDocument);
|
|
39
39
|
#documentTypeValidationService = injectRepository(DocumentTypeValidation);
|
|
40
|
-
#taskQueue = inject((TaskQueue), { namespace: 'DocumentManagement:
|
|
40
|
+
#taskQueue = inject((TaskQueue), { namespace: 'DocumentManagement:Validation', visibilityTimeout: 5 * millisecondsPerMinute, maxTries: 3 });
|
|
41
41
|
#executors = injectAll(DOCUMENT_VALIDATION_EXECUTORS);
|
|
42
42
|
#logger = inject(Logger, DocumentValidationService_1.name);
|
|
43
43
|
#executorMap = new Map(this.#executors.map((executor) => [executor.identifier, executor]));
|
|
@@ -37,7 +37,7 @@ let DocumentWorkflowService = DocumentWorkflowService_1 = class DocumentWorkflow
|
|
|
37
37
|
#documentAssignmentTaskRepository = injectRepository(DocumentAssignmentTask);
|
|
38
38
|
#documentAssignmentScopeRepository = injectRepository(DocumentAssignmentScope);
|
|
39
39
|
#observationService = inject(DocumentManagementObservationService);
|
|
40
|
-
#taskQueue = inject((TaskQueue), { namespace: 'DocumentManagement:
|
|
40
|
+
#taskQueue = inject((TaskQueue), { namespace: 'DocumentManagement:Workflow', visibilityTimeout: 5 * 60 * 1000, maxTries: 3 });
|
|
41
41
|
#logger = inject(Logger, DocumentWorkflowService_1.name);
|
|
42
42
|
documentService = inject(forwardRef(() => DocumentService));
|
|
43
43
|
repository = injectRepository(DocumentWorkflow);
|
|
@@ -107,7 +107,7 @@ let DocumentWorkflowService = DocumentWorkflowService_1 = class DocumentWorkflow
|
|
|
107
107
|
async initiateWorkflow(tenantId, documentId, step, skipAi) {
|
|
108
108
|
const workflow = await this.repository.insert({ tenantId, documentId, step, state: 'pending', failReason: null, completeTimestamp: null, completeUserId: null, skipAi });
|
|
109
109
|
if (!skipAi) {
|
|
110
|
-
await this.#taskQueue.enqueue(
|
|
110
|
+
await this.#taskQueue.enqueue(step, { workflowId: workflow.id });
|
|
111
111
|
}
|
|
112
112
|
this.#observationService.documentChange(workflow.id, this.session);
|
|
113
113
|
return workflow;
|
|
@@ -5,7 +5,7 @@ import { TaskProcessResult } from '../../../task-queue/task-queue.js';
|
|
|
5
5
|
import { NotificationChannel } from '../../models/index.js';
|
|
6
6
|
import type { ChannelProvider } from '../providers/channel-provider.js';
|
|
7
7
|
export type NotificationTaskDefinitions = TaskDefinitionMap<{
|
|
8
|
-
|
|
8
|
+
deliver: TaskDefinition<{
|
|
9
9
|
notificationId: string;
|
|
10
10
|
}>;
|
|
11
11
|
}>;
|
|
@@ -44,7 +44,7 @@ let NotificationService = NotificationService_1 = class NotificationService exte
|
|
|
44
44
|
currentStep: 0,
|
|
45
45
|
};
|
|
46
46
|
const insertedNotification = await this.#notificationLogRepository.withTransaction(tx).insert(notificationToInsert);
|
|
47
|
-
await this.#taskQueue.withTransaction(tx).enqueue('
|
|
47
|
+
await this.#taskQueue.withTransaction(tx).enqueue('deliver', { notificationId: insertedNotification.id });
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
async listInApp(tenantId, userId, options = {}) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import type { Logger } from '../logger/index.js';
|
|
|
3
3
|
import type { Transaction } from '../orm/server/index.js';
|
|
4
4
|
import { TaskQueue, type EnqueueManyItem, type EnqueueOptions } from './task-queue.js';
|
|
5
5
|
import type { TaskData, TaskDefinitionMap, TaskOfType, TaskResult, TaskState, TaskTypes } from './types.js';
|
|
6
|
-
export declare class TaskContext<Definitions extends TaskDefinitionMap, Type extends TaskTypes<Definitions>> {
|
|
6
|
+
export declare class TaskContext<Definitions extends TaskDefinitionMap, Type extends TaskTypes<Definitions> = TaskTypes<Definitions>> {
|
|
7
7
|
#private;
|
|
8
8
|
constructor(queue: TaskQueue<Definitions>, task: TaskOfType<Definitions, Type>, signal: CancellationToken, logger: Logger);
|
|
9
9
|
get id(): string;
|
package/task-queue/task-queue.js
CHANGED
|
@@ -104,7 +104,7 @@ export class TaskQueue extends Transactional {
|
|
|
104
104
|
async processWorker(cancellationSignal, handler, options) {
|
|
105
105
|
for await (const task of this.getConsumer(cancellationSignal, options)) {
|
|
106
106
|
const taskToken = cancellationSignal.createChild();
|
|
107
|
-
const context = new TaskContext(this, task, taskToken, this.logger);
|
|
107
|
+
const context = new TaskContext(this, task, taskToken, this.logger.with({ type: task.type }));
|
|
108
108
|
let isTaskActive = true;
|
|
109
109
|
context.logger.verbose(`Processing task`);
|
|
110
110
|
void (async () => {
|