@tstdl/base 0.93.2 → 0.93.4

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.
Files changed (182) hide show
  1. package/ai/ai.service.d.ts +2 -1
  2. package/ai/ai.service.js +11 -3
  3. package/ai/types.d.ts +3 -1
  4. package/api/server/api-request-token.provider.d.ts +5 -3
  5. package/api/server/api-request-token.provider.js +12 -4
  6. package/api/server/gateway.d.ts +1 -9
  7. package/api/server/gateway.js +67 -36
  8. package/api/types.d.ts +5 -1
  9. package/application/application.d.ts +2 -0
  10. package/application/application.js +3 -1
  11. package/application/providers.d.ts +1 -1
  12. package/application/providers.js +1 -1
  13. package/audit/audit.model.d.ts +14 -9
  14. package/audit/audit.model.js +36 -27
  15. package/audit/auditor.d.ts +32 -23
  16. package/audit/auditor.js +84 -21
  17. package/audit/drizzle/{0000_tiny_the_captain.sql → 0000_bored_stick.sql} +5 -4
  18. package/audit/drizzle/meta/0000_snapshot.json +22 -15
  19. package/audit/drizzle/meta/_journal.json +2 -2
  20. package/audit/index.d.ts +3 -1
  21. package/audit/index.js +3 -1
  22. package/audit/module.d.ts +1 -1
  23. package/audit/module.js +1 -2
  24. package/audit/schemas.d.ts +2 -2
  25. package/audit/schemas.js +1 -1
  26. package/audit/types.d.ts +2 -1
  27. package/audit/types.js +2 -1
  28. package/authentication/models/authentication-credentials.model.js +1 -2
  29. package/authentication/models/authentication-session.model.d.ts +2 -2
  30. package/authentication/models/authentication-session.model.js +3 -5
  31. package/authentication/server/authentication-api-request-token.provider.d.ts +2 -2
  32. package/authentication/server/authentication-api-request-token.provider.js +8 -5
  33. package/authentication/server/authentication.api-controller.d.ts +8 -8
  34. package/authentication/server/authentication.api-controller.js +16 -16
  35. package/authentication/server/authentication.audit.d.ts +34 -0
  36. package/authentication/server/authentication.audit.js +1 -0
  37. package/authentication/server/authentication.service.d.ts +19 -10
  38. package/authentication/server/authentication.service.js +158 -43
  39. package/authentication/server/module.d.ts +1 -1
  40. package/authentication/server/schemas.d.ts +2 -3
  41. package/authentication/server/schemas.js +2 -3
  42. package/constants.d.ts +1 -0
  43. package/constants.js +1 -0
  44. package/document-management/api/document-management.api.d.ts +74 -74
  45. package/document-management/models/document-assignment-scope.model.d.ts +1 -2
  46. package/document-management/models/document-assignment-scope.model.js +4 -6
  47. package/document-management/models/document-assignment-task.model.d.ts +1 -2
  48. package/document-management/models/document-assignment-task.model.js +3 -5
  49. package/document-management/models/document-category.model.d.ts +1 -2
  50. package/document-management/models/document-category.model.js +3 -4
  51. package/document-management/models/document-collection-assignment.model.d.ts +1 -2
  52. package/document-management/models/document-collection-assignment.model.js +5 -7
  53. package/document-management/models/document-collection.model.d.ts +1 -2
  54. package/document-management/models/document-collection.model.js +3 -4
  55. package/document-management/models/document-management-table.d.ts +1 -1
  56. package/document-management/models/document-management-table.js +1 -1
  57. package/document-management/models/document-property-value.model.d.ts +1 -2
  58. package/document-management/models/document-property-value.model.js +5 -8
  59. package/document-management/models/document-property.model.d.ts +1 -2
  60. package/document-management/models/document-property.model.js +2 -3
  61. package/document-management/models/document-request-collection-assignment.model.d.ts +1 -2
  62. package/document-management/models/document-request-collection-assignment.model.js +4 -6
  63. package/document-management/models/document-request-template.d.ts +1 -2
  64. package/document-management/models/document-request-template.js +4 -6
  65. package/document-management/models/document-request.model.d.ts +1 -1
  66. package/document-management/models/document-request.model.js +4 -5
  67. package/document-management/models/document-requests-template.d.ts +1 -1
  68. package/document-management/models/document-requests-template.js +2 -3
  69. package/document-management/models/document-tag-assignment.model.d.ts +1 -2
  70. package/document-management/models/document-tag-assignment.model.js +4 -6
  71. package/document-management/models/document-tag.model.d.ts +1 -1
  72. package/document-management/models/document-tag.model.js +2 -3
  73. package/document-management/models/document-type-property.model.d.ts +1 -2
  74. package/document-management/models/document-type-property.model.js +4 -6
  75. package/document-management/models/document-type-validation.model.d.ts +1 -2
  76. package/document-management/models/document-type-validation.model.js +4 -6
  77. package/document-management/models/document-type.model.d.ts +1 -2
  78. package/document-management/models/document-type.model.js +3 -5
  79. package/document-management/models/document-validation-definition.model.d.ts +1 -2
  80. package/document-management/models/document-validation-definition.model.js +3 -4
  81. package/document-management/models/document-validation-execution-related-document.model.d.ts +1 -2
  82. package/document-management/models/document-validation-execution-related-document.model.js +4 -6
  83. package/document-management/models/document-validation-execution.model.d.ts +1 -2
  84. package/document-management/models/document-validation-execution.model.js +8 -9
  85. package/document-management/models/document-workflow.model.d.ts +1 -2
  86. package/document-management/models/document-workflow.model.js +5 -7
  87. package/document-management/models/document.model.d.ts +1 -2
  88. package/document-management/models/document.model.js +5 -7
  89. package/document-management/server/api/document-management.api.js +1 -1
  90. package/document-management/server/module.d.ts +1 -1
  91. package/document-management/server/module.js +1 -1
  92. package/document-management/server/schemas.d.ts +1 -1
  93. package/document-management/server/schemas.js +1 -1
  94. package/document-management/server/services/document-category-type.service.d.ts +2 -2
  95. package/document-management/server/services/document-category-type.service.js +1 -2
  96. package/document-management/server/services/document-collection.service.d.ts +1 -1
  97. package/document-management/server/services/document-collection.service.js +1 -2
  98. package/document-management/server/services/document-management-ai.service.js +3 -3
  99. package/document-management/server/services/document-management.service.js +6 -6
  100. package/document-management/server/services/document-property.service.d.ts +1 -1
  101. package/document-management/server/services/document-property.service.js +1 -2
  102. package/document-management/server/services/document-validation.service.js +2 -2
  103. package/document-management/server/services/document-workflow.service.d.ts +2 -2
  104. package/document-management/server/services/document-workflow.service.js +1 -2
  105. package/document-management/server/services/document.service.d.ts +1 -1
  106. package/document-management/server/services/document.service.js +1 -2
  107. package/document-management/server/services/singleton.js +1 -1
  108. package/document-management/server/validators/ai-validation-executor.d.ts +2 -2
  109. package/document-management/server/validators/ai-validation-executor.js +6 -6
  110. package/document-management/server/validators/single-document-validation-executor.d.ts +2 -1
  111. package/document-management/server/validators/single-document-validation-executor.js +3 -2
  112. package/document-management/service-models/document.service-model.d.ts +62 -62
  113. package/document-management/service-models/document.service-model.js +1 -1
  114. package/document-management/service-models/enriched/enriched-document-management-data.view.js +1 -1
  115. package/document-management/service-models/enriched/enriched-document.view.d.ts +1 -1
  116. package/examples/api/authentication.js +2 -2
  117. package/examples/api/basic-overview.js +2 -2
  118. package/examples/api/custom-authentication.js +2 -2
  119. package/examples/api/streaming.js +2 -2
  120. package/examples/browser/basic.js +2 -2
  121. package/examples/document-management/main.js +4 -2
  122. package/examples/http/client.js +2 -2
  123. package/examples/mail/basic.js +2 -2
  124. package/examples/pdf/basic.js +2 -2
  125. package/examples/template/basic.js +2 -2
  126. package/http/server/http-server-request.d.ts +3 -3
  127. package/key-value-store/postgres/key-value-store.service.js +1 -2
  128. package/key-value-store/postgres/models/key-value.model.d.ts +1 -2
  129. package/key-value-store/postgres/models/key-value.model.js +2 -4
  130. package/key-value-store/postgres/models/schemas.d.ts +1 -1
  131. package/key-value-store/postgres/models/schemas.js +1 -1
  132. package/lock/postgres/lock.js +1 -1
  133. package/lock/postgres/models/lock.model.d.ts +1 -2
  134. package/lock/postgres/models/lock.model.js +3 -5
  135. package/lock/postgres/models/schemas.d.ts +1 -1
  136. package/lock/postgres/models/schemas.js +1 -1
  137. package/lock/postgres/provider.js +1 -2
  138. package/mail/models/mail-log.model.d.ts +1 -1
  139. package/mail/models/mail-log.model.js +4 -5
  140. package/mail/models/schemas.d.ts +1 -1
  141. package/mail/models/schemas.js +1 -1
  142. package/openid-connect/oidc-state.model.d.ts +1 -1
  143. package/openid-connect/oidc-state.model.js +2 -3
  144. package/openid-connect/oidc.service.js +1 -1
  145. package/orm/data-types/bytea.js +1 -1
  146. package/orm/data-types/numeric-date.js +1 -1
  147. package/orm/decorators.d.ts +65 -72
  148. package/orm/decorators.js +42 -40
  149. package/orm/entity.d.ts +1 -1
  150. package/orm/entity.js +13 -13
  151. package/orm/index.d.ts +2 -1
  152. package/orm/index.js +2 -1
  153. package/orm/schemas/json.d.ts +1 -1
  154. package/orm/schemas/json.js +1 -1
  155. package/orm/schemas/numeric-date.d.ts +1 -1
  156. package/orm/schemas/numeric-date.js +1 -1
  157. package/orm/schemas/timestamp.d.ts +1 -1
  158. package/orm/schemas/timestamp.js +1 -1
  159. package/orm/schemas/uuid.d.ts +2 -2
  160. package/orm/schemas/uuid.js +1 -1
  161. package/orm/server/drizzle/index.js +1 -0
  162. package/orm/server/drizzle/schema-converter.d.ts +15 -0
  163. package/orm/server/drizzle/schema-converter.js +300 -0
  164. package/orm/server/repository.d.ts +1 -1
  165. package/orm/server/repository.js +12 -9
  166. package/orm/sqls.d.ts +1 -1
  167. package/orm/sqls.js +1 -1
  168. package/orm/types.d.ts +2 -6
  169. package/orm/types.js +1 -4
  170. package/package.json +12 -10
  171. package/queue/postgres/job.model.d.ts +3 -3
  172. package/queue/postgres/job.model.js +5 -6
  173. package/queue/postgres/queue.js +2 -2
  174. package/queue/postgres/schemas.d.ts +1 -1
  175. package/queue/postgres/schemas.js +1 -1
  176. package/supports.d.ts +1 -0
  177. package/supports.js +2 -1
  178. package/types/types.d.ts +12 -1
  179. package/utils/object/object.d.ts +3 -1
  180. package/utils/object/object.js +7 -1
  181. package/orm/server/drizzle/schema-converter.ts +0 -408
  182. /package/orm/server/drizzle/{index.ts → index.d.ts} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { type EnumType } from '../../enumeration/enumeration.js';
2
- import { Entity } from '../../orm/entity.js';
3
- import { Timestamp, Uuid } from '../../orm/types.js';
2
+ import { Entity, type Timestamp, type Uuid } from '../../orm/index.js';
4
3
  export declare const DocumentWorkflowStep: {
5
4
  readonly Classification: "classification";
6
5
  readonly Extraction: "extraction";
@@ -8,9 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { defineEnum } from '../../enumeration/enumeration.js';
11
- import { ForeignKey, References } from '../../orm/decorators.js';
12
- import { Entity } from '../../orm/entity.js';
13
- import { Index, Timestamp, Unique, Uuid } from '../../orm/types.js';
11
+ import { Entity, ForeignKey, Index, References, TimestampProperty, Unique, UuidProperty } from '../../orm/index.js';
14
12
  import { Enumeration } from '../../schema/index.js';
15
13
  import { DocumentManagementTable } from './document-management-table.js';
16
14
  import { Document } from './document.model.js';
@@ -46,11 +44,11 @@ let DocumentWorkflow = class DocumentWorkflow extends Entity {
46
44
  completeUserId;
47
45
  };
48
46
  __decorate([
49
- Uuid(),
47
+ UuidProperty(),
50
48
  __metadata("design:type", String)
51
49
  ], DocumentWorkflow.prototype, "tenantId", void 0);
52
50
  __decorate([
53
- Uuid(),
51
+ UuidProperty(),
54
52
  References(() => Document),
55
53
  __metadata("design:type", String)
56
54
  ], DocumentWorkflow.prototype, "documentId", void 0);
@@ -67,11 +65,11 @@ __decorate([
67
65
  __metadata("design:type", Object)
68
66
  ], DocumentWorkflow.prototype, "failReason", void 0);
69
67
  __decorate([
70
- Timestamp({ nullable: true }),
68
+ TimestampProperty({ nullable: true }),
71
69
  __metadata("design:type", Object)
72
70
  ], DocumentWorkflow.prototype, "completeTimestamp", void 0);
73
71
  __decorate([
74
- Uuid({ nullable: true }),
72
+ UuidProperty({ nullable: true }),
75
73
  __metadata("design:type", Object)
76
74
  ], DocumentWorkflow.prototype, "completeUserId", void 0);
77
75
  DocumentWorkflow = __decorate([
@@ -1,6 +1,5 @@
1
1
  import { type EnumType } from '../../enumeration/enumeration.js';
2
- import { Entity } from '../../orm/entity.js';
3
- import { NumericDate, Uuid } from '../../orm/types.js';
2
+ import { Entity, type NumericDate, type Uuid } from '../../orm/index.js';
4
3
  export declare const DocumentApproval: {
5
4
  readonly Pending: "pending";
6
5
  readonly Approved: "approved";
@@ -8,9 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { defineEnum } from '../../enumeration/enumeration.js';
11
- import { References } from '../../orm/decorators.js';
12
- import { Entity } from '../../orm/entity.js';
13
- import { NumericDate, Unique, Uuid } from '../../orm/types.js';
11
+ import { Entity, NumericDateProperty, References, Unique, UuidProperty } from '../../orm/index.js';
14
12
  import { Enumeration, Integer, StringProperty } from '../../schema/index.js';
15
13
  import { DocumentManagementTable } from './document-management-table.js';
16
14
  import { DocumentType } from './document-type.model.js';
@@ -36,11 +34,11 @@ let Document = class Document extends Entity {
36
34
  createUserId;
37
35
  };
38
36
  __decorate([
39
- Uuid(),
37
+ UuidProperty(),
40
38
  __metadata("design:type", String)
41
39
  ], Document.prototype, "tenantId", void 0);
42
40
  __decorate([
43
- Uuid({ nullable: true }),
41
+ UuidProperty({ nullable: true }),
44
42
  References(() => DocumentType),
45
43
  __metadata("design:type", Object)
46
44
  ], Document.prototype, "typeId", void 0);
@@ -57,7 +55,7 @@ __decorate([
57
55
  __metadata("design:type", Object)
58
56
  ], Document.prototype, "pages", void 0);
59
57
  __decorate([
60
- NumericDate({ nullable: true, coerce: true }),
58
+ NumericDateProperty({ nullable: true, coerce: true }),
61
59
  __metadata("design:type", Object)
62
60
  ], Document.prototype, "date", void 0);
63
61
  __decorate([
@@ -89,7 +87,7 @@ __decorate([
89
87
  __metadata("design:type", Number)
90
88
  ], Document.prototype, "size", void 0);
91
89
  __decorate([
92
- Uuid({ nullable: true }),
90
+ UuidProperty({ nullable: true }),
93
91
  __metadata("design:type", Object)
94
92
  ], Document.prototype, "createUserId", void 0);
95
93
  Document = __decorate([
@@ -13,7 +13,7 @@ import { ForbiddenError, NotImplementedError } from '../../../errors/index.js';
13
13
  import { HttpServerResponse } from '../../../http/index.js';
14
14
  import { inject } from '../../../injector/index.js';
15
15
  import { Logger } from '../../../logger/logger.js';
16
- import { injectRepository } from '../../../orm/server/repository.js';
16
+ import { injectRepository } from '../../../orm/server/index.js';
17
17
  import { toArray } from '../../../utils/array/index.js';
18
18
  import { documentManagementApiDefinition } from '../../api/index.js';
19
19
  import { DocumentManagementAuthorizationService } from '../../authorization/index.js';
@@ -1,6 +1,6 @@
1
1
  import './schemas.js';
2
2
  import { type InjectionToken } from '../../injector/index.js';
3
- import type { DatabaseConfig } from '../../orm/server/module.js';
3
+ import { type DatabaseConfig } from '../../orm/server/index.js';
4
4
  import type { DocumentManagementAuthorizationService } from '../authorization/document-management-authorization.service.js';
5
5
  import type { DocumentManagementAncillaryService } from './services/document-management-ancillary.service.js';
6
6
  export declare class DocumentManagementConfiguration {
@@ -1,6 +1,6 @@
1
1
  import './schemas.js';
2
2
  import { inject } from '../../injector/index.js';
3
- import { Database, migrate } from '../../orm/server/database.js';
3
+ import { Database, migrate } from '../../orm/server/index.js';
4
4
  export class DocumentManagementConfiguration {
5
5
  ancillaryService;
6
6
  authorizationService;
@@ -1,5 +1,5 @@
1
1
  import { Document, DocumentAssignmentScope, DocumentAssignmentTask, DocumentCategory, DocumentCollection, DocumentCollectionAssignment, DocumentProperty, DocumentPropertyValue, DocumentRequest, DocumentRequestCollectionAssignment, DocumentRequestsTemplate, DocumentRequestTemplate, DocumentTag, DocumentTagAssignment, DocumentType, DocumentTypeProperty, DocumentTypeValidation, DocumentValidationDefinition, DocumentValidationExecution, DocumentValidationExecutionRelatedDocument, DocumentWorkflow } from '../models/index.js';
2
- export declare const documentManagementSchema: import("../../orm/server/database-schema.js").DatabaseSchema<"document_management">;
2
+ export declare const documentManagementSchema: import("../../orm/server/index.js").DatabaseSchema<"document_management">;
3
3
  export declare const documentApproval: import("drizzle-orm/pg-core").PgEnum<["pending", "approved", "rejected"]>;
4
4
  export declare const documentAssignmentTarget: import("drizzle-orm/pg-core").PgEnum<["request", "collection"]>;
5
5
  export declare const documentPropertyDataType: import("drizzle-orm/pg-core").PgEnum<["boolean", "date", "text", "decimal", "integer"]>;
@@ -1,4 +1,4 @@
1
- import { databaseSchema } from '../../orm/server/database-schema.js';
1
+ import { databaseSchema } from '../../orm/server/index.js';
2
2
  import { Document, DocumentApproval, DocumentAssignmentScope, DocumentAssignmentTarget, DocumentAssignmentTask, DocumentCategory, DocumentCollection, DocumentCollectionAssignment, DocumentProperty, DocumentPropertyDataType, DocumentPropertyValue, DocumentRequest, DocumentRequestCollectionAssignment, DocumentRequestState, DocumentRequestsTemplate, DocumentRequestTemplate, DocumentTag, DocumentTagAssignment, DocumentType, DocumentTypeProperty, DocumentTypeValidation, DocumentValidationDefinition, DocumentValidationExecution, DocumentValidationExecutionRelatedDocument, DocumentValidationExecutionState, DocumentValidationResultStatus, DocumentWorkflow, DocumentWorkflowFailReason, DocumentWorkflowState, DocumentWorkflowStep } from '../models/index.js';
3
3
  export const documentManagementSchema = databaseSchema('document_management');
4
4
  export const documentApproval = documentManagementSchema.getEnum(DocumentApproval);
@@ -2,8 +2,8 @@ import { Transactional } from '../../../orm/server/index.js';
2
2
  import { DocumentCategory, DocumentType } from '../../models/index.js';
3
3
  import type { DocumentCategoryView } from '../../service-models/index.js';
4
4
  export declare class DocumentCategoryTypeService extends Transactional {
5
- readonly categoryRepository: import("../../../orm/server/repository.js").EntityRepository<DocumentCategory>;
6
- readonly typeRepository: import("../../../orm/server/repository.js").EntityRepository<DocumentType>;
5
+ readonly categoryRepository: import("../../../orm/server/index.js").EntityRepository<DocumentCategory>;
6
+ readonly typeRepository: import("../../../orm/server/index.js").EntityRepository<DocumentType>;
7
7
  loadCategory(tenantId: string, id: string): Promise<DocumentCategory>;
8
8
  loadType(tenantId: string, id: string): Promise<DocumentType>;
9
9
  createCategory(data: {
@@ -4,8 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  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;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { Transactional } from '../../../orm/server/index.js';
8
- import { injectRepository } from '../../../orm/server/repository.js';
7
+ import { injectRepository, Transactional } from '../../../orm/server/index.js';
9
8
  import { groupToMap } from '../../../utils/iterable-helpers/group-to-map.js';
10
9
  import { isUndefined } from '../../../utils/type-guards.js';
11
10
  import { DocumentCategory, DocumentType } from '../../models/index.js';
@@ -5,7 +5,7 @@ import { Document, DocumentCollection } from '../../models/index.js';
5
5
  import type { DocumentCollectionMetadata } from '../../service-models/index.js';
6
6
  export declare class DocumentCollectionService extends Transactional {
7
7
  #private;
8
- readonly repository: import("../../../orm/server/repository.js").EntityRepository<DocumentCollection>;
8
+ readonly repository: import("../../../orm/server/index.js").EntityRepository<DocumentCollection>;
9
9
  resolveMetadata<const T extends (DocumentCollection | string)[]>(tenantId: string, collectionsOrIds: T): Promise<{
10
10
  [K in keyof T]: DocumentCollectionMetadata;
11
11
  }>;
@@ -7,8 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { and, eq, sql } from 'drizzle-orm';
8
8
  import { inject } from '../../../injector/inject.js';
9
9
  import { TRANSACTION_TIMESTAMP } from '../../../orm/index.js';
10
- import { Transactional } from '../../../orm/server/index.js';
11
- import { injectRepository } from '../../../orm/server/repository.js';
10
+ import { injectRepository, Transactional } from '../../../orm/server/index.js';
12
11
  import { toArray } from '../../../utils/array/index.js';
13
12
  import { fromEntries } from '../../../utils/object/index.js';
14
13
  import { assertDefinedPass, isString } from '../../../utils/type-guards.js';
@@ -79,9 +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 CLASSIFY_MODEL = 'gemini-2.5-flash-lite';
83
- const EXTRACT_MODEL = 'gemini-2.5-flash';
84
- const ASSIGN_MODEL = 'gemini-2.5-flash-lite';
82
+ const CLASSIFY_MODEL = 'small';
83
+ const EXTRACT_MODEL = 'medium';
84
+ const ASSIGN_MODEL = 'small';
85
85
  let DocumentManagementAiService = DocumentManagementAiService_1 = class DocumentManagementAiService {
86
86
  #documentCollectionService = inject(DocumentCollectionService);
87
87
  #documentTagService = inject(DocumentTagService);
@@ -198,12 +198,12 @@ let DocumentManagementService = DocumentManagementService_1 = class DocumentMana
198
198
  if (isUndefined(category)) {
199
199
  const category = await this.#documentCategoryTypeService.withTransaction(tx).createCategory({ tenantId, label, parentId: parentCategoryId, enumKey });
200
200
  enumKeyCategoryMap.set(enumKey, category);
201
- this.#logger.info(`Created category ${category.label}`);
201
+ this.#logger.info(`Created category "${category.label}"`);
202
202
  }
203
203
  else if ((category.label != label) || (category.parentId != parentCategoryId)) {
204
204
  const updatedCategory = await this.#documentCategoryTypeService.withTransaction(tx).updateCategory(tenantId, category.id, { label, parentId: parentCategoryId });
205
205
  enumKeyCategoryMap.set(enumKey, updatedCategory);
206
- this.#logger.info(`Updated category ${updatedCategory.label}`);
206
+ this.#logger.info(`Updated category "${updatedCategory.label}"`);
207
207
  }
208
208
  }
209
209
  for (const [enumKey, label] of typeEntries) {
@@ -213,12 +213,12 @@ let DocumentManagementService = DocumentManagementService_1 = class DocumentMana
213
213
  if (isUndefined(type)) {
214
214
  const type = await this.#documentCategoryTypeService.withTransaction(tx).createType({ tenantId, label, categoryId: category.id, enumKey });
215
215
  enumKeyTypeMap.set(enumKey, type);
216
- this.#logger.info(`Created type ${type.label} in category ${category.label}`);
216
+ this.#logger.info(`Created type "${type.label}" in category "${category.label}"`);
217
217
  }
218
218
  else if ((type.categoryId != category.id) || (type.label != label)) {
219
219
  const updatedType = await this.#documentCategoryTypeService.withTransaction(tx).updateType(tenantId, type.id, { categoryId: category.id, label: label });
220
220
  enumKeyTypeMap.set(enumKey, updatedType);
221
- this.#logger.info(`Updated type ${updatedType.label} in category ${category.label}`);
221
+ this.#logger.info(`Updated type "${updatedType.label}" in category "${category.label}"`);
222
222
  }
223
223
  }
224
224
  for (const [enumKey, [dataType, label]] of propertyEntries) {
@@ -226,12 +226,12 @@ let DocumentManagementService = DocumentManagementService_1 = class DocumentMana
226
226
  if (isUndefined(property)) {
227
227
  const newProperty = await this.#documentPropertyService.withTransaction(tx).createProperty({ tenantId, label, dataType, enumKey });
228
228
  enumKeyPropertyMap.set(enumKey, newProperty);
229
- this.#logger.info(`Created property ${newProperty.label} of type ${dataType}`);
229
+ this.#logger.info(`Created property "${newProperty.label}" of type "${dataType}"`);
230
230
  }
231
231
  else if ((property.label != label) || (property.dataType != dataType)) {
232
232
  const updatedProperty = await this.#documentPropertyService.withTransaction(tx).updateProperty(tenantId, property.id, { label, dataType });
233
233
  enumKeyPropertyMap.set(enumKey, updatedProperty);
234
- this.#logger.info(`Updated property ${updatedProperty.label} of type ${updatedProperty.dataType}`);
234
+ this.#logger.info(`Updated property "${updatedProperty.label}" of type "${updatedProperty.dataType}"`);
235
235
  }
236
236
  }
237
237
  for (const [typeKey, propertyKeys] of objectEntries(data.typeProperties)) {
@@ -4,7 +4,7 @@ import { DocumentProperty, DocumentPropertyDataType, type Document } from '../..
4
4
  import type { DocumentPropertyValueView, DocumentPropertyView, SetDocumentPropertyParameters } from '../../service-models/index.js';
5
5
  export declare class DocumentPropertyService extends Transactional {
6
6
  #private;
7
- readonly repository: import("../../../orm/server/repository.js").EntityRepository<DocumentProperty>;
7
+ readonly repository: import("../../../orm/server/index.js").EntityRepository<DocumentProperty>;
8
8
  readonly documentProperties: import("drizzle-orm/pg-core").WithSubqueryWithSelection<{
9
9
  documentId: import("drizzle-orm").SQL.Aliased<string>;
10
10
  propertyId: import("drizzle-orm").SQL.Aliased<string>;
@@ -9,8 +9,7 @@ import { BadRequestError } from '../../../errors/bad-request.error.js';
9
9
  import { NotFoundError } from '../../../errors/not-found.error.js';
10
10
  import { inject } from '../../../injector/index.js';
11
11
  import { autoAlias, coalesce, getEntityMap, toJsonb } from '../../../orm/index.js';
12
- import { Transactional } from '../../../orm/server/index.js';
13
- import { injectRepository } from '../../../orm/server/repository.js';
12
+ import { injectRepository, Transactional } from '../../../orm/server/index.js';
14
13
  import { toArray } from '../../../utils/array/index.js';
15
14
  import { assertBooleanPass, assertNumberPass, assertStringPass, isBoolean, isNotNull, isNull, isNumber, isString, isUndefined } from '../../../utils/type-guards.js';
16
15
  import { DocumentProperty, DocumentPropertyDataType, DocumentPropertyValue, DocumentTypeProperty } from '../../models/index.js';
@@ -12,8 +12,8 @@ import { Injector } from '../../../injector/injector.js';
12
12
  import { afterResolve } from '../../../injector/interfaces.js';
13
13
  import { injectionToken } from '../../../injector/token.js';
14
14
  import { Logger } from '../../../logger/logger.js';
15
- import { injectRepository } from '../../../orm/server/repository.js';
16
- import { getEntityIds } from '../../../orm/utils.js';
15
+ import { getEntityIds } from '../../../orm/index.js';
16
+ import { injectRepository } from '../../../orm/server/index.js';
17
17
  import { Queue } from '../../../queue/queue.js';
18
18
  import { currentTimestamp } from '../../../utils/date-time.js';
19
19
  import { isNull, isUndefined } from '../../../utils/type-guards.js';
@@ -1,12 +1,12 @@
1
1
  import type { AfterResolveContext } from '../../../injector/index.js';
2
2
  import { afterResolve } from '../../../injector/interfaces.js';
3
- import { Transactional } from '../../../orm/server/transactional.js';
3
+ import { Transactional } from '../../../orm/server/index.js';
4
4
  import type { OneOrMany } from '../../../types/index.js';
5
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;
9
- readonly repository: import("../../../orm/server/repository.js").EntityRepository<DocumentWorkflow>;
9
+ readonly repository: import("../../../orm/server/index.js").EntityRepository<DocumentWorkflow>;
10
10
  [afterResolve](_: unknown, { cancellationSignal }: AfterResolveContext<any>): void;
11
11
  loadLatestWorkflow(tenantId: string, documentId: string): Promise<DocumentWorkflow>;
12
12
  loadLatestWorkflows(tenantId: string, documentIds: string[]): Promise<DocumentWorkflow[]>;
@@ -12,8 +12,7 @@ import { NotImplementedError } from '../../../errors/not-implemented.error.js';
12
12
  import { inject } from '../../../injector/inject.js';
13
13
  import { afterResolve } from '../../../injector/interfaces.js';
14
14
  import { Logger } from '../../../logger/index.js';
15
- import { injectRepository } from '../../../orm/server/repository.js';
16
- import { injectTransactional, Transactional } from '../../../orm/server/transactional.js';
15
+ import { injectRepository, injectTransactional, Transactional } from '../../../orm/server/index.js';
17
16
  import { Queue } from '../../../queue/queue.js';
18
17
  import { toArray } from '../../../utils/array/array.js';
19
18
  import { currentTimestamp } from '../../../utils/date-time.js';
@@ -4,7 +4,7 @@ import { Document, type UpdatableDocumentProperties } from '../../models/index.j
4
4
  import type { CreateDocumentParameters, SetDocumentPropertyParameters, UpdateDocumentCollectionsParameters } from '../../service-models/index.js';
5
5
  export declare class DocumentService extends Transactional {
6
6
  #private;
7
- readonly repository: import("../../../orm/server/repository.js").EntityRepository<Document>;
7
+ readonly repository: import("../../../orm/server/index.js").EntityRepository<Document>;
8
8
  create(tenantId: string, { typeId, title, subtitle, date, summary, tags, approval, comment, originalFileName, assignment, properties, metadata }: TypedOmit<CreateDocumentParameters, 'uploadId'>, contentSource: Uint8Array<ArrayBuffer> | ReadableStream<Uint8Array<ArrayBuffer>> | {
9
9
  uploadId: string;
10
10
  uploadKey: string;
@@ -10,8 +10,7 @@ import { match, P } from 'ts-pattern';
10
10
  import { BadRequestError } from '../../../errors/bad-request.error.js';
11
11
  import { inject } from '../../../injector/inject.js';
12
12
  import { Logger } from '../../../logger/logger.js';
13
- import { injectTransactional, Transactional } from '../../../orm/server/index.js';
14
- import { injectRepository } from '../../../orm/server/repository.js';
13
+ import { injectRepository, injectTransactional, Transactional } from '../../../orm/server/index.js';
15
14
  import { getPdfPageCount } from '../../../pdf/utils.js';
16
15
  import { toArray } from '../../../utils/array/index.js';
17
16
  import { objectKeys } from '../../../utils/object/object.js';
@@ -1,6 +1,6 @@
1
1
  import { Singleton } from '../../../injector/decorators.js';
2
2
  import { factoryProvider } from '../../../injector/provider.js';
3
- import { DatabaseConfig } from '../../../orm/server/module.js';
3
+ import { DatabaseConfig } from '../../../orm/server/index.js';
4
4
  import { DocumentManagementConfiguration } from '../module.js';
5
5
  export const documentManagementDatabaseConfigFactoryProvider = factoryProvider((_, context) => context.resolve(DocumentManagementConfiguration).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }));
6
6
  export const documentManagementDatabaseConfigProvider = {
@@ -4,8 +4,7 @@ import type { SchemaTestable } from '../../../schema/schema.js';
4
4
  import { DocumentValidationExecutor, type DocumentValidationExecutorContext, type DocumentValidationExecutorResult } from './validator.js';
5
5
  export declare const AiValidationDifficulty: {
6
6
  readonly Easy: "easy";
7
- readonly MediumLow: "medium-low";
8
- readonly MediumHigh: "medium-high";
7
+ readonly Medium: "medium";
9
8
  readonly Hard: "hard";
10
9
  };
11
10
  export type AiValidationDifficulty = EnumType<typeof AiValidationDifficulty>;
@@ -13,6 +12,7 @@ export declare abstract class AiValidationExecutor<R> extends DocumentValidation
13
12
  protected readonly aiService: AiService;
14
13
  abstract readonly schema: SchemaTestable<R>;
15
14
  abstract readonly difficulty: AiValidationDifficulty;
15
+ abstract readonly thinking: boolean;
16
16
  execute(context: DocumentValidationExecutorContext): Promise<DocumentValidationExecutorResult>;
17
17
  abstract getPrompt(context: DocumentValidationExecutorContext): string | Promise<string>;
18
18
  abstract getResult(output: R): DocumentValidationExecutorResult | Promise<DocumentValidationExecutorResult>;
@@ -12,8 +12,7 @@ import { match } from 'ts-pattern';
12
12
  import { DocumentValidationExecutor } from './validator.js';
13
13
  export const AiValidationDifficulty = defineEnum('AiValidationDifficulty', {
14
14
  Easy: 'easy',
15
- MediumLow: 'medium-low',
16
- MediumHigh: 'medium-high',
15
+ Medium: 'medium',
17
16
  Hard: 'hard',
18
17
  });
19
18
  let AiValidationExecutor = class AiValidationExecutor extends DocumentValidationExecutor {
@@ -21,11 +20,11 @@ let AiValidationExecutor = class AiValidationExecutor extends DocumentValidation
21
20
  async execute(context) {
22
21
  const validationPrompt = await this.getPrompt(context);
23
22
  const model = match(this.difficulty)
24
- .with('easy', () => 'gemini-2.5-flash-lite')
25
- .with('medium-low', () => 'gemini-2.5-flash')
26
- .with('medium-high', () => 'gemini-2.5-flash')
27
- .with('hard', () => 'gemini-2.5-pro')
23
+ .with('easy', () => 'small')
24
+ .with('medium', () => 'medium')
25
+ .with('hard', () => 'large')
28
26
  .exhaustive();
27
+ const thinkingBudget = this.thinking ? -1 : 0;
29
28
  const prompt = `Deine Aufgabe ist es ein Dokument zu validieren.
30
29
 
31
30
  Validierungsaufgabe:
@@ -33,6 +32,7 @@ ${validationPrompt}`;
33
32
  const generation = await this.aiService.generate({
34
33
  model,
35
34
  generationOptions: {
35
+ thinkingBudget,
36
36
  temperature: 0.2,
37
37
  topK: 20,
38
38
  },
@@ -6,7 +6,8 @@ export declare class SingleDocumentValidationExecutor extends AiValidationExecut
6
6
  reason?: string;
7
7
  }> {
8
8
  readonly identifier = "single-document";
9
- readonly difficulty: "medium-low";
9
+ readonly difficulty: "medium";
10
+ readonly thinking = true;
10
11
  schema: import("../../../schema/index.js").ObjectSchema<{
11
12
  hasMultipleDocuments: boolean;
12
13
  reason?: string | undefined;
@@ -3,13 +3,14 @@ import { DocumentValidationResultStatus } from '../../models/document-validation
3
3
  import { AiValidationDifficulty, AiValidationExecutor } from './ai-validation-executor.js';
4
4
  export class SingleDocumentValidationExecutor extends AiValidationExecutor {
5
5
  identifier = 'single-document';
6
- difficulty = AiValidationDifficulty.MediumLow;
6
+ difficulty = AiValidationDifficulty.Medium;
7
+ thinking = true;
7
8
  schema = object({
8
9
  hasMultipleDocuments: boolean(),
9
10
  reason: optional(string()),
10
11
  });
11
12
  getPrompt() {
12
- return 'Überprüfe ob das Dokument aus mehreren Dokumenten zusammengesetzt ist. Falls ja, begründe in wenigen Worten. Antworte auf deutsch.';
13
+ return 'Überprüfe ob das Dokument aus mehreren einzelnen Dokumenten zusammengesetzt ist. Falls ja, begründe in wenigen Worten. Antworte auf deutsch.';
13
14
  }
14
15
  getResult(output) {
15
16
  if (output.hasMultipleDocuments) {