@tstdl/base 0.93.134 → 0.93.136
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 +3 -3
- package/task-queue/task-context.d.ts +1 -1
- package/task-queue/task-queue.js +2 -2
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.93.
|
|
3
|
+
"version": "0.93.136",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
"file-type": "^21.3",
|
|
163
163
|
"genkit": "^1.28",
|
|
164
164
|
"handlebars": "^4.7",
|
|
165
|
-
"@aws-sdk/client-s3": "^3.
|
|
166
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
|
165
|
+
"@aws-sdk/client-s3": "^3.993",
|
|
166
|
+
"@aws-sdk/s3-request-presigner": "^3.993",
|
|
167
167
|
"mjml": "^4.18",
|
|
168
168
|
"nodemailer": "^8.0",
|
|
169
169
|
"pg": "^8.18",
|
|
@@ -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 () => {
|
|
@@ -115,7 +115,7 @@ export class TaskQueue extends Transactional {
|
|
|
115
115
|
}
|
|
116
116
|
try {
|
|
117
117
|
const touchedTask = await this.touch(task);
|
|
118
|
-
if (isUndefined(touchedTask)) {
|
|
118
|
+
if (isUndefined(touchedTask) && taskToken.isUnset) {
|
|
119
119
|
context.logger.warn(`Task lost lease. Aborting.`);
|
|
120
120
|
isTaskActive = false;
|
|
121
121
|
taskToken.set();
|