@tstdl/base 0.92.144 → 0.92.145
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/ai/ai.service.js +1 -1
- package/ai/types.d.ts +1 -1
- package/document-management/models/document-assignment-task.model.js +1 -0
- package/document-management/models/document-validation-execution.model.js +1 -0
- package/document-management/models/document-workflow.model.js +3 -2
- package/document-management/server/api/document-management.api.d.ts +1 -1
- package/document-management/server/api/document-management.api.js +3 -3
- package/document-management/server/drizzle/{0000_parallel_mantis.sql → 0000_ordinary_pretty_boy.sql} +6 -3
- package/document-management/server/drizzle/meta/0000_snapshot.json +27 -2
- package/document-management/server/drizzle/meta/_journal.json +2 -2
- package/document-management/server/services/document-collection.service.d.ts +1 -1
- package/document-management/server/services/document-management-ai.service.js +7 -5
- package/document-management/server/services/document-management-ancillary.service.d.ts +1 -1
- package/document-management/server/services/document-management.service.js +1 -1
- package/document-management/server/services/document-request.service.d.ts +1 -1
- package/document-management/server/services/document-request.service.js +1 -1
- package/document-management/server/services/document-tag.service.js +1 -1
- package/document-management/server/services/document-validation.service.d.ts +1 -1
- package/document-management/server/services/document-validation.service.js +2 -2
- package/document-management/server/services/document-workflow.service.d.ts +1 -1
- package/document-management/server/services/document-workflow.service.js +4 -4
- package/document-management/server/validators/ai-validation-executor.js +4 -4
- package/document-management/server/validators/single-document-validation-executor.js +1 -1
- package/document-management/server/validators/validator.d.ts +1 -1
- package/injector/decorators.d.ts +3 -3
- package/package.json +6 -6
package/ai/ai.service.js
CHANGED
|
@@ -53,7 +53,7 @@ let AiService = AiService_1 = class AiService {
|
|
|
53
53
|
apiKey: isUndefined(this.#options.vertex?.project) ? assertDefinedPass(this.#options.apiKey, 'Api key not defined') : undefined,
|
|
54
54
|
});
|
|
55
55
|
#maxOutputTokensCache = new Map();
|
|
56
|
-
defaultModel = this.#options.defaultModel ?? 'gemini-2.5-flash-preview-
|
|
56
|
+
defaultModel = this.#options.defaultModel ?? 'gemini-2.5-flash-lite-preview-06-17';
|
|
57
57
|
createSession() {
|
|
58
58
|
return new AiSession(this);
|
|
59
59
|
}
|
package/ai/types.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export type Content = {
|
|
|
53
53
|
};
|
|
54
54
|
export type FunctionCallingMode = 'auto' | 'force' | 'none';
|
|
55
55
|
export type FinishReason = 'stop' | 'maxTokens' | 'unknown';
|
|
56
|
-
export type AiModel = LiteralUnion<'gemini-2.5-pro-
|
|
56
|
+
export type AiModel = LiteralUnion<'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite-preview-06-17', string>;
|
|
57
57
|
export type GenerationOptions = {
|
|
58
58
|
maxOutputTokens?: number;
|
|
59
59
|
temperature?: number;
|
|
@@ -39,6 +39,7 @@ __decorate([
|
|
|
39
39
|
], DocumentAssignmentTask.prototype, "target", void 0);
|
|
40
40
|
DocumentAssignmentTask = __decorate([
|
|
41
41
|
DocumentManagementTable({ name: 'assignment_task' }),
|
|
42
|
+
Unique(['tenantId', 'id']),
|
|
42
43
|
ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
|
|
43
44
|
], DocumentAssignmentTask);
|
|
44
45
|
export { DocumentAssignmentTask };
|
|
@@ -72,6 +72,7 @@ __decorate([
|
|
|
72
72
|
], DocumentValidationExecution.prototype, "completedAt", void 0);
|
|
73
73
|
DocumentValidationExecution = __decorate([
|
|
74
74
|
DocumentManagementTable({ name: 'validation_execution' }),
|
|
75
|
+
Unique(['tenantId', 'id']),
|
|
75
76
|
Unique(['tenantId', 'workflowId', 'definitionId']),
|
|
76
77
|
ForeignKey(() => DocumentWorkflow, ['tenantId', 'workflowId'], ['tenantId', 'id'])
|
|
77
78
|
], DocumentValidationExecution);
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
import { defineEnum } from '../../enumeration/enumeration.js';
|
|
11
11
|
import { ForeignKey, References } from '../../orm/decorators.js';
|
|
12
12
|
import { Entity } from '../../orm/entity.js';
|
|
13
|
-
import { Index, Timestamp, Uuid } from '../../orm/types.js';
|
|
13
|
+
import { Index, Timestamp, Unique, Uuid } from '../../orm/types.js';
|
|
14
14
|
import { Enumeration } from '../../schema/index.js';
|
|
15
15
|
import { DocumentManagementTable } from './document-management-table.js';
|
|
16
16
|
import { Document } from './document.model.js';
|
|
@@ -77,6 +77,7 @@ __decorate([
|
|
|
77
77
|
DocumentWorkflow = __decorate([
|
|
78
78
|
DocumentManagementTable({ name: 'workflow' }),
|
|
79
79
|
Index(['documentId'], { unique: true, where: () => ({ state: { $neq: DocumentWorkflowState.Completed } }) }),
|
|
80
|
-
ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
|
|
80
|
+
ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id']),
|
|
81
|
+
Unique(['tenantId', 'id'])
|
|
81
82
|
], DocumentWorkflow);
|
|
82
83
|
export { DocumentWorkflow };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ApiController, type ApiRequestContext, type ApiServerResult } from '../../../api/index.js';
|
|
2
|
-
import { type DocumentManagementApiDefinition } from '
|
|
2
|
+
import { type DocumentManagementApiDefinition } from '../../api/index.js';
|
|
3
3
|
export declare class DocumentManagementApiController implements ApiController<DocumentManagementApiDefinition> {
|
|
4
4
|
#private;
|
|
5
5
|
loadData(context: ApiRequestContext<DocumentManagementApiDefinition, 'loadData'>): Promise<ApiServerResult<DocumentManagementApiDefinition, 'loadData'>>;
|
|
@@ -11,9 +11,6 @@ import { match, P } from 'ts-pattern';
|
|
|
11
11
|
import { createErrorResponse } from '../../../api/index.js';
|
|
12
12
|
import { apiController } from '../../../api/server/index.js';
|
|
13
13
|
import { CancellationSignal } from '../../../cancellation/token.js';
|
|
14
|
-
import { documentManagementApiDefinition } from '../../../document-management/api/index.js';
|
|
15
|
-
import { DocumentManagementAuthorizationService } from '../../../document-management/authorization/index.js';
|
|
16
|
-
import { DocumentRequestCollectionAssignment } from '../../../document-management/models/document-request-collection-assignment.model.js';
|
|
17
14
|
import { ForbiddenError, NotImplementedError } from '../../../errors/index.js';
|
|
18
15
|
import { HttpServerResponse } from '../../../http/index.js';
|
|
19
16
|
import { inject } from '../../../injector/index.js';
|
|
@@ -23,6 +20,9 @@ import { ServerSentEventsSource } from '../../../sse/server-sent-events-source.j
|
|
|
23
20
|
import { toArray } from '../../../utils/array/index.js';
|
|
24
21
|
import { tryIgnoreAsync } from '../../../utils/try-ignore.js';
|
|
25
22
|
import { isDefined, isUndefined } from '../../../utils/type-guards.js';
|
|
23
|
+
import { documentManagementApiDefinition } from '../../api/index.js';
|
|
24
|
+
import { DocumentManagementAuthorizationService } from '../../authorization/index.js';
|
|
25
|
+
import { DocumentRequestCollectionAssignment } from '../../models/document-request-collection-assignment.model.js';
|
|
26
26
|
import { DocumentCategoryTypeService, DocumentFileService, DocumentManagementService, DocumentRequestService, DocumentService, DocumentWorkflowService } from '../services/index.js';
|
|
27
27
|
const jsonDiffPatch = createDiffPatch({
|
|
28
28
|
omitRemovedValues: true,
|
package/document-management/server/drizzle/{0000_parallel_mantis.sql → 0000_ordinary_pretty_boy.sql}
RENAMED
|
@@ -54,7 +54,8 @@ CREATE TABLE "document_management"."assignment_task" (
|
|
|
54
54
|
"create_timestamp" timestamp with time zone NOT NULL,
|
|
55
55
|
"delete_timestamp" timestamp with time zone,
|
|
56
56
|
"attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
57
|
-
CONSTRAINT "assignment_task_document_id_unique" UNIQUE("document_id")
|
|
57
|
+
CONSTRAINT "assignment_task_document_id_unique" UNIQUE("document_id"),
|
|
58
|
+
CONSTRAINT "assignment_task_tenant_id_id_unique" UNIQUE("tenant_id","id")
|
|
58
59
|
);
|
|
59
60
|
--> statement-breakpoint
|
|
60
61
|
CREATE TABLE "document_management"."category" (
|
|
@@ -277,7 +278,8 @@ CREATE TABLE "document_management"."validation_execution" (
|
|
|
277
278
|
"create_timestamp" timestamp with time zone NOT NULL,
|
|
278
279
|
"delete_timestamp" timestamp with time zone,
|
|
279
280
|
"attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
280
|
-
CONSTRAINT "validation_execution_tenant_id_workflow_id_definition_id_unique" UNIQUE("tenant_id","workflow_id","definition_id")
|
|
281
|
+
CONSTRAINT "validation_execution_tenant_id_workflow_id_definition_id_unique" UNIQUE("tenant_id","workflow_id","definition_id"),
|
|
282
|
+
CONSTRAINT "validation_execution_tenant_id_id_unique" UNIQUE("tenant_id","id")
|
|
281
283
|
);
|
|
282
284
|
--> statement-breakpoint
|
|
283
285
|
CREATE TABLE "document_management"."validation_execution_related_document" (
|
|
@@ -306,7 +308,8 @@ CREATE TABLE "document_management"."workflow" (
|
|
|
306
308
|
"revision_timestamp" timestamp with time zone NOT NULL,
|
|
307
309
|
"create_timestamp" timestamp with time zone NOT NULL,
|
|
308
310
|
"delete_timestamp" timestamp with time zone,
|
|
309
|
-
"attributes" jsonb DEFAULT '{}'::jsonb NOT NULL
|
|
311
|
+
"attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
312
|
+
CONSTRAINT "workflow_tenant_id_id_unique" UNIQUE("tenant_id","id")
|
|
310
313
|
);
|
|
311
314
|
--> statement-breakpoint
|
|
312
315
|
ALTER TABLE "document_management"."document" ADD CONSTRAINT "document_type_id_type_id_fk" FOREIGN KEY ("type_id") REFERENCES "document_management"."type"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "bbddb1b8-fa09-4465-8016-5a9b7915023d",
|
|
3
3
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
4
|
"version": "7",
|
|
5
5
|
"dialect": "postgresql",
|
|
@@ -406,6 +406,14 @@
|
|
|
406
406
|
"columns": [
|
|
407
407
|
"document_id"
|
|
408
408
|
]
|
|
409
|
+
},
|
|
410
|
+
"assignment_task_tenant_id_id_unique": {
|
|
411
|
+
"name": "assignment_task_tenant_id_id_unique",
|
|
412
|
+
"nullsNotDistinct": false,
|
|
413
|
+
"columns": [
|
|
414
|
+
"tenant_id",
|
|
415
|
+
"id"
|
|
416
|
+
]
|
|
409
417
|
}
|
|
410
418
|
},
|
|
411
419
|
"policies": {},
|
|
@@ -2263,6 +2271,14 @@
|
|
|
2263
2271
|
"workflow_id",
|
|
2264
2272
|
"definition_id"
|
|
2265
2273
|
]
|
|
2274
|
+
},
|
|
2275
|
+
"validation_execution_tenant_id_id_unique": {
|
|
2276
|
+
"name": "validation_execution_tenant_id_id_unique",
|
|
2277
|
+
"nullsNotDistinct": false,
|
|
2278
|
+
"columns": [
|
|
2279
|
+
"tenant_id",
|
|
2280
|
+
"id"
|
|
2281
|
+
]
|
|
2266
2282
|
}
|
|
2267
2283
|
},
|
|
2268
2284
|
"policies": {},
|
|
@@ -2548,7 +2564,16 @@
|
|
|
2548
2564
|
}
|
|
2549
2565
|
},
|
|
2550
2566
|
"compositePrimaryKeys": {},
|
|
2551
|
-
"uniqueConstraints": {
|
|
2567
|
+
"uniqueConstraints": {
|
|
2568
|
+
"workflow_tenant_id_id_unique": {
|
|
2569
|
+
"name": "workflow_tenant_id_id_unique",
|
|
2570
|
+
"nullsNotDistinct": false,
|
|
2571
|
+
"columns": [
|
|
2572
|
+
"tenant_id",
|
|
2573
|
+
"id"
|
|
2574
|
+
]
|
|
2575
|
+
}
|
|
2576
|
+
},
|
|
2552
2577
|
"policies": {},
|
|
2553
2578
|
"checkConstraints": {},
|
|
2554
2579
|
"isRLSEnabled": false
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DocumentCollectionMetadata } from '../../../document-management/service-models/index.js';
|
|
2
1
|
import { type EntityMetadataInsert, type Query } from '../../../orm/index.js';
|
|
3
2
|
import { Transactional } from '../../../orm/server/index.js';
|
|
4
3
|
import type { OneOrMany } from '../../../types.js';
|
|
5
4
|
import { Document, DocumentCollection } from '../../models/index.js';
|
|
5
|
+
import type { DocumentCollectionMetadata } from '../../service-models/index.js';
|
|
6
6
|
export declare class DocumentCollectionService extends Transactional {
|
|
7
7
|
#private;
|
|
8
8
|
readonly repository: import("../../../orm/server/repository.js").EntityRepository<DocumentCollection>;
|
|
@@ -79,7 +79,9 @@ import { DocumentFileService } from './document-file.service.js';
|
|
|
79
79
|
import { DocumentPropertyService } from './document-property.service.js';
|
|
80
80
|
import { DocumentTagService } from './document-tag.service.js';
|
|
81
81
|
import { DocumentManagementSingleton } from './singleton.js';
|
|
82
|
-
const
|
|
82
|
+
const CLASSIFY_MODEL = 'gemini-2.5-flash-lite-preview-06-17';
|
|
83
|
+
const EXTRACT_MODEL = 'gemini-2.5-flash';
|
|
84
|
+
const ASSIGN_MODEL = 'gemini-2.5-flash-lite-preview-06-17';
|
|
83
85
|
let DocumentManagementAiService = DocumentManagementAiService_1 = class DocumentManagementAiService {
|
|
84
86
|
#documentCollectionService = inject(DocumentCollectionService);
|
|
85
87
|
#documentTagService = inject(DocumentTagService);
|
|
@@ -103,7 +105,7 @@ let DocumentManagementAiService = DocumentManagementAiService_1 = class Document
|
|
|
103
105
|
const typeLabels = typeLabelEntries.map(({ label }) => label);
|
|
104
106
|
this.#logger.trace(`Classifying document ${document.id}`);
|
|
105
107
|
const documentTypeGeneration = await this.#aiService.generate({
|
|
106
|
-
model:
|
|
108
|
+
model: CLASSIFY_MODEL,
|
|
107
109
|
generationOptions: {
|
|
108
110
|
maxOutputTokens: 128,
|
|
109
111
|
temperature: 0.1,
|
|
@@ -175,7 +177,7 @@ let DocumentManagementAiService = DocumentManagementAiService_1 = class Document
|
|
|
175
177
|
const context = { existingTags };
|
|
176
178
|
this.#logger.trace(`Extracting document ${document.id}`);
|
|
177
179
|
const { json: extraction } = await this.#aiService.generate({
|
|
178
|
-
model:
|
|
180
|
+
model: EXTRACT_MODEL,
|
|
179
181
|
generationOptions: {
|
|
180
182
|
maxOutputTokens: 2048,
|
|
181
183
|
temperature: 0.2,
|
|
@@ -268,7 +270,7 @@ Antworte auf deutsch.`,
|
|
|
268
270
|
collections,
|
|
269
271
|
};
|
|
270
272
|
const result = await this.#aiService.generate({
|
|
271
|
-
model:
|
|
273
|
+
model: ASSIGN_MODEL,
|
|
272
274
|
generationOptions: {
|
|
273
275
|
maxOutputTokens: 100,
|
|
274
276
|
temperature: 0,
|
|
@@ -332,7 +334,7 @@ Ordne das Dokument unter "document" einer oder mehreren passenden Collection unt
|
|
|
332
334
|
requests,
|
|
333
335
|
};
|
|
334
336
|
const result = await this.#aiService.generate({
|
|
335
|
-
model:
|
|
337
|
+
model: ASSIGN_MODEL,
|
|
336
338
|
generationOptions: {
|
|
337
339
|
maxOutputTokens: 100,
|
|
338
340
|
temperature: 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DocumentCollectionMetadata } from '../../../document-management/service-models/index.js';
|
|
2
1
|
import type { DocumentCollection } from '../../models/index.js';
|
|
2
|
+
import type { DocumentCollectionMetadata } from '../../service-models/index.js';
|
|
3
3
|
export declare abstract class DocumentManagementAncillaryService {
|
|
4
4
|
/**
|
|
5
5
|
* Resolves application-specific metadata for a list of document collections.
|
|
@@ -100,7 +100,7 @@ let DocumentManagementService = DocumentManagementService_1 = class DocumentMana
|
|
|
100
100
|
const taskIds = assignmentScopes.map((scope) => scope.taskId);
|
|
101
101
|
const [requests, assignmentTasks] = await Promise.all([
|
|
102
102
|
this.#documentRequestRepository.withTransaction(tx).loadManyByQuery({ tenantId, id: { $in: requestIds } }, { order: { 'metadata.createTimestamp': 'desc' } }),
|
|
103
|
-
this.#documentAssignmentTaskRepository.withTransaction(tx).loadManyByQuery({ tenantId,
|
|
103
|
+
this.#documentAssignmentTaskRepository.withTransaction(tx).loadManyByQuery({ tenantId, id: { $in: taskIds } }),
|
|
104
104
|
]);
|
|
105
105
|
const assignmentDocumentIds = documentCollectionAssignments.map((assignment) => assignment.documentId);
|
|
106
106
|
const requestDocumentIds = requests.map((request) => request.documentId).filter(isNotNull);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RequestStats } from '../../../document-management/service-models/index.js';
|
|
2
1
|
import { Transactional } from '../../../orm/server/index.js';
|
|
3
2
|
import type { OneOrMany } from '../../../types.js';
|
|
4
3
|
import { DocumentRequest, DocumentRequestTemplate, DocumentRequestsTemplate, type Document } from '../../models/index.js';
|
|
4
|
+
import type { RequestStats } from '../../service-models/index.js';
|
|
5
5
|
export declare class DocumentRequestService extends Transactional {
|
|
6
6
|
#private;
|
|
7
7
|
getRequestStats(tenantId: string, collectionIds: OneOrMany<string>): Promise<RequestStats>;
|
|
@@ -10,7 +10,7 @@ import { inject } from '../../../injector/inject.js';
|
|
|
10
10
|
import { Transactional, injectRepository } from '../../../orm/server/index.js';
|
|
11
11
|
import { toArray } from '../../../utils/array/index.js';
|
|
12
12
|
import { assertDefinedPass, isNotNull } from '../../../utils/type-guards.js';
|
|
13
|
-
import { DocumentApproval,
|
|
13
|
+
import { DocumentApproval, DocumentRequest, DocumentRequestCollectionAssignment, DocumentRequestState, DocumentRequestTemplate, DocumentRequestsTemplate } from '../../models/index.js';
|
|
14
14
|
import { document, documentRequest, documentRequestCollectionAssignment } from '../schemas.js';
|
|
15
15
|
import { DocumentManagementObservationService } from './document-management-observation.service.js';
|
|
16
16
|
import { DocumentManagementSingleton } from './singleton.js';
|
|
@@ -48,7 +48,7 @@ let DocumentTagService = class DocumentTagService extends Transactional {
|
|
|
48
48
|
const tags = await this.withTransaction(tx).loadOrCreate(document.tenantId, labels);
|
|
49
49
|
const tagIds = getEntityIds(tags);
|
|
50
50
|
const newAssignments = tagIds.map((tagId) => ({ tenantId: document.tenantId, documentId: document.id, tagId }));
|
|
51
|
-
await this.tagAssignmentRepository.withTransaction(tx).insertManyIfNotExists(['documentId', 'tagId'], newAssignments);
|
|
51
|
+
await this.tagAssignmentRepository.withTransaction(tx).insertManyIfNotExists(['tenantId', 'documentId', 'tagId'], newAssignments);
|
|
52
52
|
await this.tagAssignmentRepository.withTransaction(tx).hardDeleteManyByQuery({ tenantId: document.tenantId, documentId: document.id, tagId: { $nin: tagIds } });
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CancellationSignal } from '../../../cancellation/token.js';
|
|
2
|
-
import { DocumentValidationResultStatus } from '../../../document-management/models/index.js';
|
|
3
2
|
import { afterResolve } from '../../../injector/interfaces.js';
|
|
4
3
|
import type { AfterResolveContext } from '../../../injector/types.js';
|
|
5
4
|
import type { Type } from '../../../types.js';
|
|
5
|
+
import { DocumentValidationResultStatus } from '../../models/index.js';
|
|
6
6
|
import type { DocumentValidationExecutor, DocumentValidationExecutorContext, DocumentValidationExecutorContextDocumentData } from '../validators/index.js';
|
|
7
7
|
export declare class DocumentValidationService {
|
|
8
8
|
#private;
|
|
@@ -6,8 +6,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
var _a;
|
|
8
8
|
var DocumentValidationService_1;
|
|
9
|
-
import { DocumentWorkflowStep } from '../../../document-management/models/document-workflow.model.js';
|
|
10
|
-
import { Document, DocumentCategory, DocumentCollection, DocumentCollectionAssignment, DocumentProperty, DocumentPropertyValue, DocumentType, DocumentTypeProperty, DocumentTypeValidation, DocumentValidationDefinition, DocumentValidationExecution, DocumentValidationExecutionRelatedDocument, DocumentValidationExecutionState, DocumentValidationResultStatus } from '../../../document-management/models/index.js';
|
|
11
9
|
import { BadRequestError } from '../../../errors/bad-request.error.js';
|
|
12
10
|
import { inject, injectAll } from '../../../injector/inject.js';
|
|
13
11
|
import { Injector } from '../../../injector/injector.js';
|
|
@@ -20,6 +18,8 @@ import { Queue } from '../../../queue/queue.js';
|
|
|
20
18
|
import { currentTimestamp } from '../../../utils/date-time.js';
|
|
21
19
|
import { isNull, isUndefined } from '../../../utils/type-guards.js';
|
|
22
20
|
import { millisecondsPerMinute } from '../../../utils/units.js';
|
|
21
|
+
import { DocumentWorkflowStep } from '../../models/document-workflow.model.js';
|
|
22
|
+
import { Document, DocumentCategory, DocumentCollection, DocumentCollectionAssignment, DocumentProperty, DocumentPropertyValue, DocumentType, DocumentTypeProperty, DocumentTypeValidation, DocumentValidationDefinition, DocumentValidationExecution, DocumentValidationExecutionRelatedDocument, DocumentValidationExecutionState, DocumentValidationResultStatus } from '../../models/index.js';
|
|
23
23
|
import { DocumentWorkflowService } from './document-workflow.service.js';
|
|
24
24
|
import { DocumentManagementSingleton } from './singleton.js';
|
|
25
25
|
const DOCUMENT_VALIDATION_EXECUTORS = injectionToken('DocumentValidationExecutors');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DocumentWorkflow, DocumentWorkflowStep } from '../../../document-management/models/document-workflow.model.js';
|
|
2
1
|
import type { AfterResolveContext } from '../../../injector/index.js';
|
|
3
2
|
import { afterResolve } from '../../../injector/interfaces.js';
|
|
4
3
|
import { Transactional } from '../../../orm/server/transactional.js';
|
|
5
4
|
import type { OneOrMany } from '../../../types.js';
|
|
5
|
+
import { DocumentWorkflow, DocumentWorkflowStep } from '../../models/document-workflow.model.js';
|
|
6
6
|
export declare class DocumentWorkflowService extends Transactional {
|
|
7
7
|
#private;
|
|
8
8
|
private readonly documentService;
|
|
@@ -7,10 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var _a;
|
|
8
8
|
var DocumentWorkflowService_1;
|
|
9
9
|
import { match } from 'ts-pattern';
|
|
10
|
-
import { DocumentAssignmentScope } from '../../../document-management/models/document-assignment-scope.model.js';
|
|
11
|
-
import { DocumentAssignmentTask } from '../../../document-management/models/document-assignment-task.model.js';
|
|
12
|
-
import { DocumentWorkflow, DocumentWorkflowFailReason, DocumentWorkflowState, DocumentWorkflowStep } from '../../../document-management/models/document-workflow.model.js';
|
|
13
|
-
import { DocumentApproval } from '../../../document-management/models/document.model.js';
|
|
14
10
|
import { BadRequestError } from '../../../errors/bad-request.error.js';
|
|
15
11
|
import { NotImplementedError } from '../../../errors/not-implemented.error.js';
|
|
16
12
|
import { inject } from '../../../injector/inject.js';
|
|
@@ -24,6 +20,10 @@ import { currentTimestamp } from '../../../utils/date-time.js';
|
|
|
24
20
|
import { _throw } from '../../../utils/throw.js';
|
|
25
21
|
import { isNotNull, isNull } from '../../../utils/type-guards.js';
|
|
26
22
|
import { and, desc, eq, inArray } from 'drizzle-orm';
|
|
23
|
+
import { DocumentAssignmentScope } from '../../models/document-assignment-scope.model.js';
|
|
24
|
+
import { DocumentAssignmentTask } from '../../models/document-assignment-task.model.js';
|
|
25
|
+
import { DocumentWorkflow, DocumentWorkflowFailReason, DocumentWorkflowState, DocumentWorkflowStep } from '../../models/document-workflow.model.js';
|
|
26
|
+
import { DocumentApproval } from '../../models/document.model.js';
|
|
27
27
|
import { documentWorkflow } from '../schemas.js';
|
|
28
28
|
import { DocumentCollectionService } from './document-collection.service.js';
|
|
29
29
|
import { DocumentManagementAiService } from './document-management-ai.service.js';
|
|
@@ -21,10 +21,10 @@ let AiValidationExecutor = class AiValidationExecutor extends DocumentValidation
|
|
|
21
21
|
async execute(context) {
|
|
22
22
|
const validationPrompt = await this.getPrompt(context);
|
|
23
23
|
const model = match(this.difficulty)
|
|
24
|
-
.with('easy', () => 'gemini-2.5-flash-preview-
|
|
25
|
-
.with('medium-low', () => 'gemini-2.5-flash
|
|
26
|
-
.with('medium-high', () => 'gemini-2.5-flash
|
|
27
|
-
.with('hard', () => 'gemini-2.5-pro
|
|
24
|
+
.with('easy', () => 'gemini-2.5-flash-lite-preview-06-17')
|
|
25
|
+
.with('medium-low', () => 'gemini-2.5-flash')
|
|
26
|
+
.with('medium-high', () => 'gemini-2.5-flash')
|
|
27
|
+
.with('hard', () => 'gemini-2.5-pro')
|
|
28
28
|
.exhaustive();
|
|
29
29
|
const prompt = `Deine Aufgabe ist es ein Dokument zu validieren.
|
|
30
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentValidationResultStatus } from '../../../document-management/models/document-validation-execution.model.js';
|
|
2
1
|
import { boolean, object, optional, string } from '../../../schema/index.js';
|
|
2
|
+
import { DocumentValidationResultStatus } from '../../models/document-validation-execution.model.js';
|
|
3
3
|
import { AiValidationDifficulty, AiValidationExecutor } from './ai-validation-executor.js';
|
|
4
4
|
export class SingleDocumentValidationExecutor extends AiValidationExecutor {
|
|
5
5
|
identifier = 'single-document';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Document, DocumentCategory, DocumentCollection, DocumentProperty, DocumentPropertyValue, DocumentType, DocumentValidationDefinition, DocumentValidationExecution, DocumentValidationResultStatus } from '
|
|
1
|
+
import type { Document, DocumentCategory, DocumentCollection, DocumentProperty, DocumentPropertyValue, DocumentType, DocumentValidationDefinition, DocumentValidationExecution, DocumentValidationResultStatus } from '../../models/index.js';
|
|
2
2
|
export type DocumentValidationExecutorContextDocumentData = {
|
|
3
3
|
document: Document;
|
|
4
4
|
collections: DocumentCollection[];
|
package/injector/decorators.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type InjectableOptions<T, A, C extends Record = Record> = RegistrationOpt
|
|
|
11
11
|
/** Custom provider. Useful for example if initialization is required */
|
|
12
12
|
provider?: Provider<T, A, C>;
|
|
13
13
|
};
|
|
14
|
-
export type InjectableOptionsWithoutLifecycle<T, A> = Simplify<TypedOmit<InjectableOptions<T, A>, 'lifecycle'>>;
|
|
14
|
+
export type InjectableOptionsWithoutLifecycle<T, A, C extends Record = Record> = Simplify<TypedOmit<InjectableOptions<T, A, C>, 'lifecycle'>>;
|
|
15
15
|
/**
|
|
16
16
|
* Helper decorator to replace a class definition with an other
|
|
17
17
|
* can be used for example to type external classes with the {@link Resolvable} interface
|
|
@@ -28,12 +28,12 @@ export declare function Injectable<T = any, A = any, C extends Record = Record>(
|
|
|
28
28
|
* Registers the class in the global container with singleton lifecycle. Decorated class is not modified in any way
|
|
29
29
|
* @param options registration options
|
|
30
30
|
*/
|
|
31
|
-
export declare function Singleton<T = any, A =
|
|
31
|
+
export declare function Singleton<T = any, A = any, C extends Record = Record>(options?: InjectableOptionsWithoutLifecycle<T, A, C>): ClassDecorator;
|
|
32
32
|
/**
|
|
33
33
|
* Registers the class in the global container with scoped lifecycle. Decorated class is not modified in any way
|
|
34
34
|
* @param options registration options
|
|
35
35
|
*/
|
|
36
|
-
export declare function Scoped<T = any, A = any>(lifecycle: 'resolution' | 'injector', options?: InjectableOptionsWithoutLifecycle<T, A>): ClassDecorator;
|
|
36
|
+
export declare function Scoped<T = any, A = any, C extends Record = Record>(lifecycle: 'resolution' | 'injector', options?: InjectableOptionsWithoutLifecycle<T, A, C>): ClassDecorator;
|
|
37
37
|
/**
|
|
38
38
|
* Sets the token used to resolve the parameter
|
|
39
39
|
* @param token token used for resolving
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.145",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"peerDependencies": {
|
|
149
149
|
"@elastic/elasticsearch": "^9.0",
|
|
150
150
|
"@google-cloud/storage": "7.16",
|
|
151
|
-
"@google/genai": "^1.
|
|
151
|
+
"@google/genai": "^1.7",
|
|
152
152
|
"@tstdl/angular": "^0.92",
|
|
153
153
|
"@zxcvbn-ts/core": "^3.0",
|
|
154
154
|
"@zxcvbn-ts/language-common": "^3.0",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"preact": "^10.26",
|
|
168
168
|
"preact-render-to-string": "^6.5",
|
|
169
169
|
"sharp": "^0.34",
|
|
170
|
-
"undici": "^7.
|
|
170
|
+
"undici": "^7.11",
|
|
171
171
|
"urlpattern-polyfill": "^10.1"
|
|
172
172
|
},
|
|
173
173
|
"peerDependenciesMeta": {
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
}
|
|
177
177
|
},
|
|
178
178
|
"devDependencies": {
|
|
179
|
-
"@stylistic/eslint-plugin": "
|
|
179
|
+
"@stylistic/eslint-plugin": "5.0",
|
|
180
180
|
"@types/chroma-js": "2.4",
|
|
181
181
|
"@types/koa__router": "12.0",
|
|
182
182
|
"@types/luxon": "3.6",
|
|
@@ -185,14 +185,14 @@
|
|
|
185
185
|
"@types/node": "24",
|
|
186
186
|
"@types/nodemailer": "6.4",
|
|
187
187
|
"@types/pg": "8.15",
|
|
188
|
-
"concurrently": "9.
|
|
188
|
+
"concurrently": "9.2",
|
|
189
189
|
"drizzle-kit": "0.31",
|
|
190
190
|
"eslint": "9.29",
|
|
191
191
|
"globals": "16.2",
|
|
192
192
|
"tsc-alias": "1.8",
|
|
193
193
|
"typedoc-plugin-missing-exports": "4.0",
|
|
194
194
|
"typescript": "5.8",
|
|
195
|
-
"typescript-eslint": "8.
|
|
195
|
+
"typescript-eslint": "8.35"
|
|
196
196
|
},
|
|
197
197
|
"overrides": {
|
|
198
198
|
"drizzle-kit": {
|