@tstdl/base 0.92.123 → 0.92.125

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 (221) hide show
  1. package/ai/ai-file.service.js +23 -18
  2. package/ai/ai.service.d.ts +4 -12
  3. package/ai/ai.service.js +79 -147
  4. package/ai/functions.d.ts +1 -1
  5. package/ai/types.d.ts +3 -1
  6. package/api/server/gateway.js +6 -6
  7. package/authentication/authentication.api.js +24 -24
  8. package/authentication/server/authentication.service.js +20 -20
  9. package/browser/page-controller.js +1 -1
  10. package/context/context.js +5 -5
  11. package/document-management/api/document-management.api.d.ts +60 -215
  12. package/document-management/api/document-management.api.js +32 -68
  13. package/document-management/models/document-assignment-scope.model.d.ts +11 -0
  14. package/document-management/models/{document-request-assignment-task-collection.model.js → document-assignment-scope.model.js} +14 -10
  15. package/document-management/models/document-assignment-task.model.d.ts +13 -0
  16. package/document-management/models/document-assignment-task.model.js +38 -0
  17. package/document-management/models/document-category.model.d.ts +2 -0
  18. package/document-management/models/document-category.model.js +7 -1
  19. package/document-management/models/{document-collection-document.model.d.ts → document-collection-assignment.model.d.ts} +1 -1
  20. package/document-management/models/{document-collection-document.model.js → document-collection-assignment.model.js} +7 -7
  21. package/document-management/models/document-collection.model.d.ts +2 -0
  22. package/document-management/models/document-collection.model.js +10 -0
  23. package/document-management/models/document-property-value.model.d.ts +3 -11
  24. package/document-management/models/document-property-value.model.js +15 -46
  25. package/document-management/models/document-property.model.d.ts +2 -1
  26. package/document-management/models/document-property.model.js +2 -2
  27. package/document-management/models/document-request-submission.model.d.ts +7 -0
  28. package/document-management/models/document-request-submission.model.js +34 -0
  29. package/document-management/models/document-request-template.d.ts +2 -4
  30. package/document-management/models/document-request-template.js +3 -8
  31. package/document-management/models/document-request.model.d.ts +14 -6
  32. package/document-management/models/document-request.model.js +22 -12
  33. package/document-management/models/document-type-validation.model.d.ts +6 -0
  34. package/document-management/models/document-type-validation.model.js +34 -0
  35. package/document-management/models/document-type.model.d.ts +0 -1
  36. package/document-management/models/document-type.model.js +0 -5
  37. package/document-management/models/document-validation-definition.model.d.ts +10 -0
  38. package/document-management/models/document-validation-definition.model.js +39 -0
  39. package/document-management/models/document-validation-execution-related-document.model.d.ts +7 -0
  40. package/document-management/models/document-validation-execution-related-document.model.js +34 -0
  41. package/document-management/models/document-validation-execution.model.d.ts +26 -0
  42. package/document-management/models/document-validation-execution.model.js +72 -0
  43. package/document-management/models/document-workflow.model.d.ts +35 -0
  44. package/document-management/models/document-workflow.model.js +70 -0
  45. package/document-management/models/document.model.d.ts +12 -1
  46. package/document-management/models/document.model.js +21 -5
  47. package/document-management/models/index.d.ts +10 -5
  48. package/document-management/models/index.js +10 -5
  49. package/document-management/models/service-models/categories-and-types.view-model.d.ts +3 -3
  50. package/document-management/models/service-models/categories-and-types.view-model.js +2 -21
  51. package/document-management/models/service-models/document-folders.view-model.d.ts +7 -14
  52. package/document-management/models/service-models/document-folders.view-model.js +20 -44
  53. package/document-management/models/service-models/document-management.view-model.d.ts +41 -0
  54. package/document-management/models/service-models/{document.view-model.js → document-management.view-model.js} +43 -26
  55. package/document-management/models/service-models/document.service-model.d.ts +51 -81
  56. package/document-management/models/service-models/document.service-model.js +30 -28
  57. package/document-management/models/service-models/enriched/enriched-document-assignment.view.d.ts +11 -0
  58. package/document-management/models/service-models/enriched/enriched-document-assignment.view.js +12 -0
  59. package/document-management/models/service-models/enriched/enriched-document-category.view.d.ts +13 -0
  60. package/document-management/models/service-models/enriched/enriched-document-category.view.js +47 -0
  61. package/document-management/models/service-models/enriched/enriched-document-collection.view.d.ts +22 -0
  62. package/document-management/models/service-models/enriched/enriched-document-collection.view.js +89 -0
  63. package/document-management/models/service-models/enriched/enriched-document-file.view.d.ts +12 -0
  64. package/document-management/models/service-models/enriched/enriched-document-file.view.js +16 -0
  65. package/document-management/models/service-models/enriched/enriched-document-management-data.view.d.ts +41 -0
  66. package/document-management/models/service-models/enriched/enriched-document-management-data.view.js +130 -0
  67. package/document-management/models/service-models/enriched/enriched-document-request.view.d.ts +17 -0
  68. package/document-management/models/service-models/enriched/enriched-document-request.view.js +52 -0
  69. package/document-management/models/service-models/enriched/enriched-document-type.view.d.ts +9 -0
  70. package/document-management/models/service-models/enriched/enriched-document-type.view.js +10 -0
  71. package/document-management/models/service-models/enriched/enriched-document.view.d.ts +28 -0
  72. package/document-management/models/service-models/enriched/enriched-document.view.js +77 -0
  73. package/document-management/models/service-models/enriched/enriched.d.ts +18 -0
  74. package/document-management/models/service-models/enriched/enriched.js +39 -0
  75. package/document-management/models/service-models/enriched/index.d.ts +9 -0
  76. package/document-management/models/service-models/enriched/index.js +9 -0
  77. package/document-management/models/service-models/index.d.ts +2 -2
  78. package/document-management/models/service-models/index.js +2 -2
  79. package/document-management/models/service-models/normalized-requests-template-data.model.d.ts +12 -10
  80. package/document-management/models/service-models/normalized-requests-template-data.model.js +5 -4
  81. package/document-management/models/service-models/stats.view-model.d.ts +7 -5
  82. package/document-management/models/service-models/stats.view-model.js +19 -9
  83. package/document-management/server/module.d.ts +2 -2
  84. package/document-management/server/module.js +3 -7
  85. package/document-management/server/schemas.d.ts +18 -23
  86. package/document-management/server/schemas.js +18 -23
  87. package/document-management/server/services/document-category-type.service.d.ts +25 -0
  88. package/document-management/server/services/document-category-type.service.js +66 -0
  89. package/document-management/server/services/document-collection.service.d.ts +13 -0
  90. package/document-management/server/services/document-collection.service.js +41 -0
  91. package/document-management/server/services/document-file.service.d.ts +17 -0
  92. package/document-management/server/services/document-file.service.js +204 -0
  93. package/document-management/server/services/document-management-ai.service.d.ts +22 -0
  94. package/document-management/server/services/document-management-ai.service.js +340 -0
  95. package/document-management/server/services/document-management-ancillary.service.d.ts +127 -3
  96. package/document-management/server/services/document-management-ancillary.service.js +24 -0
  97. package/document-management/server/services/document-management.service.d.ts +10 -122
  98. package/document-management/server/services/document-management.service.js +106 -888
  99. package/document-management/server/services/document-property.service.d.ts +84 -0
  100. package/document-management/server/services/document-property.service.js +87 -0
  101. package/document-management/server/services/document-request.service.d.ts +30 -0
  102. package/document-management/server/services/document-request.service.js +138 -0
  103. package/document-management/server/services/document-validation.service.d.ts +20 -0
  104. package/document-management/server/services/document-validation.service.js +145 -0
  105. package/document-management/server/services/document-workflow.service.d.ts +20 -0
  106. package/document-management/server/services/document-workflow.service.js +132 -0
  107. package/document-management/server/services/document.service.d.ts +16 -0
  108. package/document-management/server/services/document.service.js +81 -0
  109. package/document-management/server/services/index.d.ts +9 -0
  110. package/document-management/server/services/index.js +9 -0
  111. package/document-management/server/validators/ai-validation-executor.d.ts +19 -0
  112. package/document-management/server/validators/ai-validation-executor.js +51 -0
  113. package/document-management/server/validators/index.d.ts +2 -0
  114. package/document-management/server/validators/index.js +2 -0
  115. package/document-management/server/validators/single-document-validation-executor.d.ts +16 -0
  116. package/document-management/server/validators/single-document-validation-executor.js +20 -0
  117. package/document-management/server/validators/validator.d.ts +21 -0
  118. package/document-management/server/validators/validator.js +2 -0
  119. package/eslint.config.js +31 -17
  120. package/examples/document-management/main.d.ts +18 -3
  121. package/examples/document-management/main.js +28 -12
  122. package/file/mime-type.js +2 -9
  123. package/formats.d.ts +5 -2
  124. package/formats.js +32 -23
  125. package/http/client/http-client.js +1 -1
  126. package/injector/injector.js +2 -2
  127. package/object-storage/s3/s3.object-storage.js +1 -1
  128. package/orm/data-types/bytea.d.ts +8 -0
  129. package/orm/data-types/bytea.js +8 -0
  130. package/orm/data-types/index.d.ts +4 -0
  131. package/orm/data-types/index.js +4 -0
  132. package/orm/data-types/numeric-date.d.ts +9 -0
  133. package/orm/data-types/numeric-date.js +9 -0
  134. package/orm/data-types/timestamp.d.ts +9 -0
  135. package/orm/data-types/timestamp.js +9 -0
  136. package/orm/decorators.d.ts +139 -5
  137. package/orm/decorators.js +50 -0
  138. package/orm/entity.d.ts +19 -0
  139. package/orm/entity.js +19 -0
  140. package/orm/index.d.ts +5 -0
  141. package/orm/index.js +5 -0
  142. package/orm/query.d.ts +51 -0
  143. package/orm/query.js +6 -0
  144. package/orm/repository.types.d.ts +54 -2
  145. package/orm/server/database-schema.d.ts +34 -0
  146. package/orm/server/database-schema.js +29 -0
  147. package/orm/server/database.d.ts +19 -1
  148. package/orm/server/database.js +17 -3
  149. package/orm/server/drizzle/schema-converter.d.ts +2 -1
  150. package/orm/server/drizzle/schema-converter.js +12 -1
  151. package/orm/server/encryption.d.ts +16 -0
  152. package/orm/server/encryption.js +29 -4
  153. package/orm/server/index.d.ts +7 -0
  154. package/orm/server/index.js +7 -0
  155. package/orm/server/module.d.ts +20 -0
  156. package/orm/server/module.js +9 -0
  157. package/orm/server/query-converter.d.ts +17 -0
  158. package/orm/server/query-converter.js +66 -11
  159. package/orm/server/repository.d.ts +324 -18
  160. package/orm/server/repository.js +344 -73
  161. package/orm/server/transaction.d.ts +5 -5
  162. package/orm/server/transaction.js +5 -5
  163. package/orm/server/transactional.d.ts +75 -0
  164. package/orm/server/transactional.js +134 -0
  165. package/orm/server/types.d.ts +1 -0
  166. package/orm/sqls.d.ts +55 -0
  167. package/orm/sqls.js +60 -0
  168. package/orm/types.d.ts +67 -4
  169. package/orm/utils.d.ts +19 -3
  170. package/orm/utils.js +12 -0
  171. package/package.json +32 -31
  172. package/password/password-check-result.model.d.ts +9 -7
  173. package/password/password-check-result.model.js +8 -8
  174. package/password/password-check.js +5 -7
  175. package/password/password-check.localization.js +12 -12
  176. package/pdf/pdf.service.js +1 -1
  177. package/pdf/utils.d.ts +9 -0
  178. package/pdf/utils.js +19 -2
  179. package/process/spawn.d.ts +11 -4
  180. package/process/spawn.js +42 -5
  181. package/queue/postgres/queue.js +5 -5
  182. package/queue/queue.d.ts +6 -4
  183. package/queue/queue.js +6 -6
  184. package/schema/schemas/one-or-many.d.ts +2 -1
  185. package/schema/schemas/one-or-many.js +1 -1
  186. package/search-index/elastic/model/index-mapping.d.ts +1 -1
  187. package/search-index/elastic/model/index-mapping.js +0 -1
  188. package/search-index/elastic/search-index.d.ts +1 -2
  189. package/search-index/elastic/search-index.js +3 -3
  190. package/types.d.ts +1 -0
  191. package/utils/async-hook/async-hook.d.ts +9 -0
  192. package/utils/async-hook/async-hook.js +21 -0
  193. package/utils/async-hook/index.d.ts +1 -0
  194. package/utils/async-hook/index.js +1 -0
  195. package/utils/compression.js +1 -1
  196. package/utils/function/class.d.ts +6 -0
  197. package/utils/function/class.js +9 -0
  198. package/utils/function/index.d.ts +1 -0
  199. package/utils/function/index.js +1 -0
  200. package/utils/function/memoize.d.ts +18 -0
  201. package/utils/function/memoize.js +41 -2
  202. package/utils/jwt.d.ts +1 -1
  203. package/utils/jwt.js +5 -5
  204. package/utils/object/forward-ref.d.ts +3 -2
  205. package/utils/object/forward-ref.js +12 -12
  206. package/utils/object/lazy-property.js +2 -2
  207. package/utils/proxy.js +1 -1
  208. package/utils/stream/{readable-stream-from-promise.d.ts → from-promise.d.ts} +1 -0
  209. package/utils/stream/from-promise.js +27 -0
  210. package/utils/stream/index.d.ts +1 -1
  211. package/utils/stream/index.js +1 -1
  212. package/utils/stream/stream-reader.js +71 -31
  213. package/document-management/models/document-request-assignment-task-collection.model.d.ts +0 -7
  214. package/document-management/models/document-request-assignment-task.model.d.ts +0 -14
  215. package/document-management/models/document-request-assignment-task.model.js +0 -77
  216. package/document-management/models/document-request-file.model.d.ts +0 -16
  217. package/document-management/models/document-request-file.model.js +0 -86
  218. package/document-management/models/service-models/document.view-model.d.ts +0 -41
  219. package/document-management/models/service-models/normalized-document-collection-view.model.d.ts +0 -73
  220. package/document-management/models/service-models/normalized-document-collection-view.model.js +0 -110
  221. package/utils/stream/readable-stream-from-promise.js +0 -8
@@ -1,10 +1,8 @@
1
1
  import { Entity } from '../../orm/entity.js';
2
2
  import { Uuid } from '../../orm/types.js';
3
- import type { TypedOmit } from '../../types.js';
4
3
  import type { DocumentRequest } from './document-request.model.js';
5
- export declare class DocumentRequestTemplate extends Entity implements TypedOmit<DocumentRequest, 'completed'> {
4
+ export declare class DocumentRequestTemplate extends Entity implements Pick<DocumentRequest, 'typeId' | 'comment'> {
6
5
  requestsTemplateId: Uuid;
7
- typeId: Uuid | null;
8
- requiredFilesCount: number;
6
+ typeId: Uuid;
9
7
  comment: string | null;
10
8
  }
@@ -10,14 +10,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { References } from '../../orm/decorators.js';
11
11
  import { Entity } from '../../orm/entity.js';
12
12
  import { Uuid } from '../../orm/types.js';
13
- import { Integer, StringProperty } from '../../schema/index.js';
13
+ import { StringProperty } from '../../schema/index.js';
14
14
  import { DocumentManagementTable } from './document-management-table.js';
15
15
  import { DocumentRequestsTemplate } from './document-requests-template.js';
16
16
  import { DocumentType } from './document-type.model.js';
17
17
  let DocumentRequestTemplate = class DocumentRequestTemplate extends Entity {
18
18
  requestsTemplateId;
19
19
  typeId;
20
- requiredFilesCount;
21
20
  comment;
22
21
  };
23
22
  __decorate([
@@ -26,14 +25,10 @@ __decorate([
26
25
  __metadata("design:type", String)
27
26
  ], DocumentRequestTemplate.prototype, "requestsTemplateId", void 0);
28
27
  __decorate([
29
- Uuid({ nullable: true }),
28
+ Uuid(),
30
29
  References(() => DocumentType),
31
- __metadata("design:type", Object)
30
+ __metadata("design:type", String)
32
31
  ], DocumentRequestTemplate.prototype, "typeId", void 0);
33
- __decorate([
34
- Integer(),
35
- __metadata("design:type", Number)
36
- ], DocumentRequestTemplate.prototype, "requiredFilesCount", void 0);
37
32
  __decorate([
38
33
  StringProperty({ nullable: true }),
39
34
  __metadata("design:type", Object)
@@ -1,10 +1,18 @@
1
- import { Entity } from '../../orm/entity.js';
2
- import { Uuid } from '../../orm/types.js';
3
- import { Document } from './document.model.js';
4
- export declare class DocumentRequest extends Entity implements Pick<Document, 'typeId'> {
1
+ import { type EnumType } from '../../enumeration/enumeration.js';
2
+ import { Entity, Uuid } from '../../orm/index.js';
3
+ export declare const DocumentRequestState: {
4
+ /** No document or pending document */
5
+ readonly Open: "open";
6
+ /** Request finished with approved document */
7
+ readonly Fulfilled: "fulfilled";
8
+ /** Request canceled without document or with rejected document */
9
+ readonly Closed: "closed";
10
+ };
11
+ export type DocumentRequestState = EnumType<typeof DocumentRequestState>;
12
+ export declare class DocumentRequest extends Entity {
5
13
  static readonly entityName: 'DocumentRequest';
6
14
  typeId: Uuid | null;
7
- requiredFilesCount: number;
15
+ documentId: Uuid | null;
8
16
  comment: string | null;
9
- completed: boolean;
17
+ state: DocumentRequestState;
10
18
  }
@@ -7,18 +7,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
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
- import { References } from '../../orm/decorators.js';
11
- import { Entity } from '../../orm/entity.js';
12
- import { Uuid } from '../../orm/types.js';
13
- import { BooleanProperty, Integer, StringProperty } from '../../schema/index.js';
10
+ import { defineEnum } from '../../enumeration/enumeration.js';
11
+ import { Entity, Index, References, Unique, Uuid } from '../../orm/index.js';
12
+ import { Enumeration, StringProperty } from '../../schema/index.js';
14
13
  import { DocumentManagementTable } from './document-management-table.js';
15
14
  import { DocumentType } from './document-type.model.js';
16
15
  import { Document } from './document.model.js';
16
+ export const DocumentRequestState = defineEnum('DocumentRequestState', {
17
+ /** No document or pending document */
18
+ Open: 'open',
19
+ /** Request finished with approved document */
20
+ Fulfilled: 'fulfilled',
21
+ /** Request canceled without document or with rejected document */
22
+ Closed: 'closed',
23
+ });
17
24
  let DocumentRequest = class DocumentRequest extends Entity {
18
25
  typeId;
19
- requiredFilesCount;
26
+ documentId;
20
27
  comment;
21
- completed;
28
+ state;
22
29
  };
23
30
  __decorate([
24
31
  Uuid({ nullable: true }),
@@ -26,17 +33,20 @@ __decorate([
26
33
  __metadata("design:type", Object)
27
34
  ], DocumentRequest.prototype, "typeId", void 0);
28
35
  __decorate([
29
- Integer(),
30
- __metadata("design:type", Number)
31
- ], DocumentRequest.prototype, "requiredFilesCount", void 0);
36
+ Uuid({ nullable: true }),
37
+ References(() => Document),
38
+ Unique(),
39
+ __metadata("design:type", Object)
40
+ ], DocumentRequest.prototype, "documentId", void 0);
32
41
  __decorate([
33
42
  StringProperty({ nullable: true }),
34
43
  __metadata("design:type", Object)
35
44
  ], DocumentRequest.prototype, "comment", void 0);
36
45
  __decorate([
37
- BooleanProperty(),
38
- __metadata("design:type", Boolean)
39
- ], DocumentRequest.prototype, "completed", void 0);
46
+ Enumeration(DocumentRequestState),
47
+ Index(),
48
+ __metadata("design:type", String)
49
+ ], DocumentRequest.prototype, "state", void 0);
40
50
  DocumentRequest = __decorate([
41
51
  DocumentManagementTable()
42
52
  ], DocumentRequest);
@@ -0,0 +1,6 @@
1
+ import { Entity } from '../../orm/entity.js';
2
+ import { Uuid } from '../../orm/types.js';
3
+ export declare class DocumentTypeValidation extends Entity {
4
+ typeId: Uuid;
5
+ validationId: Uuid;
6
+ }
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { References } from '../../orm/decorators.js';
11
+ import { Entity } from '../../orm/entity.js';
12
+ import { Unique, Uuid } from '../../orm/types.js';
13
+ import { DocumentManagementTable } from './document-management-table.js';
14
+ import { DocumentType } from './document-type.model.js';
15
+ import { DocumentValidationDefinition } from './document-validation-definition.model.js';
16
+ let DocumentTypeValidation = class DocumentTypeValidation extends Entity {
17
+ typeId;
18
+ validationId;
19
+ };
20
+ __decorate([
21
+ Uuid(),
22
+ References(() => DocumentType),
23
+ __metadata("design:type", String)
24
+ ], DocumentTypeValidation.prototype, "typeId", void 0);
25
+ __decorate([
26
+ Uuid(),
27
+ References(() => DocumentValidationDefinition),
28
+ __metadata("design:type", String)
29
+ ], DocumentTypeValidation.prototype, "validationId", void 0);
30
+ DocumentTypeValidation = __decorate([
31
+ DocumentManagementTable(),
32
+ Unique(['typeId', 'validationId'])
33
+ ], DocumentTypeValidation);
34
+ export { DocumentTypeValidation };
@@ -3,6 +3,5 @@ import { Uuid } from '../../orm/types.js';
3
3
  export declare class DocumentType extends Entity {
4
4
  static readonly entityName: 'DocumentType';
5
5
  categoryId: Uuid;
6
- group: string | null;
7
6
  label: string;
8
7
  }
@@ -15,7 +15,6 @@ import { DocumentCategory } from './document-category.model.js';
15
15
  import { DocumentManagementTable } from './document-management-table.js';
16
16
  let DocumentType = class DocumentType extends Entity {
17
17
  categoryId;
18
- group;
19
18
  label;
20
19
  };
21
20
  __decorate([
@@ -23,10 +22,6 @@ __decorate([
23
22
  References(() => DocumentCategory),
24
23
  __metadata("design:type", String)
25
24
  ], DocumentType.prototype, "categoryId", void 0);
26
- __decorate([
27
- StringProperty({ nullable: true }),
28
- __metadata("design:type", Object)
29
- ], DocumentType.prototype, "group", void 0);
30
25
  __decorate([
31
26
  StringProperty(),
32
27
  __metadata("design:type", String)
@@ -0,0 +1,10 @@
1
+ import { Entity } from '../../orm/entity.js';
2
+ import { Json } from '../../orm/types.js';
3
+ import type { Record } from '../../types.js';
4
+ export declare class DocumentValidationDefinition extends Entity {
5
+ static readonly entityName: 'DocumentValidationDefinition';
6
+ identifier: string;
7
+ label: string;
8
+ description: string | null;
9
+ configuration: Json<Record<string, unknown>>;
10
+ }
@@ -0,0 +1,39 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity } from '../../orm/entity.js';
11
+ import { Json } from '../../orm/types.js';
12
+ import { StringProperty } from '../../schema/index.js';
13
+ import { DocumentManagementTable } from './document-management-table.js';
14
+ let DocumentValidationDefinition = class DocumentValidationDefinition extends Entity {
15
+ identifier;
16
+ label;
17
+ description;
18
+ configuration;
19
+ };
20
+ __decorate([
21
+ StringProperty(),
22
+ __metadata("design:type", String)
23
+ ], DocumentValidationDefinition.prototype, "identifier", void 0);
24
+ __decorate([
25
+ StringProperty(),
26
+ __metadata("design:type", String)
27
+ ], DocumentValidationDefinition.prototype, "label", void 0);
28
+ __decorate([
29
+ StringProperty({ nullable: true }),
30
+ __metadata("design:type", Object)
31
+ ], DocumentValidationDefinition.prototype, "description", void 0);
32
+ __decorate([
33
+ Json(),
34
+ __metadata("design:type", Object)
35
+ ], DocumentValidationDefinition.prototype, "configuration", void 0);
36
+ DocumentValidationDefinition = __decorate([
37
+ DocumentManagementTable()
38
+ ], DocumentValidationDefinition);
39
+ export { DocumentValidationDefinition };
@@ -0,0 +1,7 @@
1
+ import { Entity } from '../../orm/entity.js';
2
+ import { Uuid } from '../../orm/types.js';
3
+ export declare class DocumentValidationExecutionRelatedDocument extends Entity {
4
+ static readonly entityName: 'DocumentValidationExecutionRelatedDocument';
5
+ executionId: Uuid;
6
+ documentId: Uuid;
7
+ }
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { References } from '../../orm/decorators.js';
11
+ import { Entity } from '../../orm/entity.js';
12
+ import { Unique, Uuid } from '../../orm/types.js';
13
+ import { DocumentManagementTable } from './document-management-table.js';
14
+ import { DocumentValidationExecution } from './document-validation-execution.model.js';
15
+ import { Document } from './document.model.js';
16
+ let DocumentValidationExecutionRelatedDocument = class DocumentValidationExecutionRelatedDocument extends Entity {
17
+ executionId;
18
+ documentId;
19
+ };
20
+ __decorate([
21
+ Uuid(),
22
+ References(() => DocumentValidationExecution),
23
+ __metadata("design:type", String)
24
+ ], DocumentValidationExecutionRelatedDocument.prototype, "executionId", void 0);
25
+ __decorate([
26
+ Uuid(),
27
+ References(() => Document),
28
+ __metadata("design:type", String)
29
+ ], DocumentValidationExecutionRelatedDocument.prototype, "documentId", void 0);
30
+ DocumentValidationExecutionRelatedDocument = __decorate([
31
+ DocumentManagementTable(),
32
+ Unique(['executionId', 'documentId'], { naming: 'abbreviated-table' })
33
+ ], DocumentValidationExecutionRelatedDocument);
34
+ export { DocumentValidationExecutionRelatedDocument };
@@ -0,0 +1,26 @@
1
+ import { type EnumType } from '../../enumeration/enumeration.js';
2
+ import { Entity } from '../../orm/entity.js';
3
+ import { Timestamp, Uuid } from '../../orm/types.js';
4
+ export declare const DocumentValidationExecutionState: {
5
+ readonly Pending: "pending";
6
+ readonly Running: "running";
7
+ readonly Completed: "completed";
8
+ readonly Error: "error";
9
+ };
10
+ export type DocumentValidationExecutionState = EnumType<typeof DocumentValidationExecutionState>;
11
+ export declare const DocumentValidationResultStatus: {
12
+ readonly Passed: "passed";
13
+ readonly Failed: "failed";
14
+ readonly Warning: "warning";
15
+ };
16
+ export type DocumentValidationResultStatus = EnumType<typeof DocumentValidationResultStatus>;
17
+ export declare class DocumentValidationExecution extends Entity {
18
+ static readonly entityName: 'DocumentValidationExecution';
19
+ workflowId: Uuid;
20
+ definitionId: Uuid;
21
+ state: DocumentValidationExecutionState;
22
+ resultStatus: DocumentValidationResultStatus | null;
23
+ resultMessage: string | null;
24
+ startedAt: Timestamp | null;
25
+ completedAt: Timestamp | null;
26
+ }
@@ -0,0 +1,72 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { defineEnum } from '../../enumeration/enumeration.js';
11
+ import { References } from '../../orm/decorators.js';
12
+ import { Entity } from '../../orm/entity.js';
13
+ import { Timestamp, Unique, Uuid } from '../../orm/types.js';
14
+ import { Enumeration, StringProperty } from '../../schema/index.js';
15
+ import { DocumentManagementTable } from './document-management-table.js';
16
+ import { DocumentValidationDefinition } from './document-validation-definition.model.js';
17
+ import { DocumentWorkflow } from './document-workflow.model.js';
18
+ export const DocumentValidationExecutionState = defineEnum('DocumentValidationExecutionState', {
19
+ Pending: 'pending',
20
+ Running: 'running',
21
+ Completed: 'completed',
22
+ Error: 'error',
23
+ });
24
+ export const DocumentValidationResultStatus = defineEnum('DocumentValidationResultStatus', {
25
+ Passed: 'passed',
26
+ Failed: 'failed',
27
+ Warning: 'warning',
28
+ });
29
+ let DocumentValidationExecution = class DocumentValidationExecution extends Entity {
30
+ workflowId;
31
+ definitionId;
32
+ state;
33
+ resultStatus;
34
+ resultMessage;
35
+ startedAt;
36
+ completedAt;
37
+ };
38
+ __decorate([
39
+ Uuid(),
40
+ References(() => DocumentWorkflow),
41
+ __metadata("design:type", String)
42
+ ], DocumentValidationExecution.prototype, "workflowId", void 0);
43
+ __decorate([
44
+ Uuid(),
45
+ References(() => DocumentValidationDefinition),
46
+ __metadata("design:type", String)
47
+ ], DocumentValidationExecution.prototype, "definitionId", void 0);
48
+ __decorate([
49
+ Enumeration(DocumentValidationExecutionState),
50
+ __metadata("design:type", String)
51
+ ], DocumentValidationExecution.prototype, "state", void 0);
52
+ __decorate([
53
+ Enumeration(DocumentValidationResultStatus, { nullable: true }),
54
+ __metadata("design:type", Object)
55
+ ], DocumentValidationExecution.prototype, "resultStatus", void 0);
56
+ __decorate([
57
+ StringProperty({ nullable: true }),
58
+ __metadata("design:type", Object)
59
+ ], DocumentValidationExecution.prototype, "resultMessage", void 0);
60
+ __decorate([
61
+ Timestamp({ nullable: true }),
62
+ __metadata("design:type", Object)
63
+ ], DocumentValidationExecution.prototype, "startedAt", void 0);
64
+ __decorate([
65
+ Timestamp({ nullable: true }),
66
+ __metadata("design:type", Object)
67
+ ], DocumentValidationExecution.prototype, "completedAt", void 0);
68
+ DocumentValidationExecution = __decorate([
69
+ DocumentManagementTable(),
70
+ Unique(['workflowId', 'definitionId'])
71
+ ], DocumentValidationExecution);
72
+ export { DocumentValidationExecution };
@@ -0,0 +1,35 @@
1
+ import { type EnumType } from '../../enumeration/enumeration.js';
2
+ import { Entity } from '../../orm/entity.js';
3
+ import { Uuid } from '../../orm/types.js';
4
+ export declare const DocumentWorkflowStep: {
5
+ readonly Classification: "classification";
6
+ readonly Extraction: "extraction";
7
+ readonly Assignment: "assignment";
8
+ readonly Validation: "validation";
9
+ };
10
+ export type DocumentWorkflowStep = EnumType<typeof DocumentWorkflowStep>;
11
+ export declare const DocumentWorkflowState: {
12
+ readonly Pending: "pending";
13
+ readonly Running: "running";
14
+ readonly Completed: "completed";
15
+ /** Unexpected error happened */
16
+ readonly Error: "error";
17
+ /**
18
+ * Something didn't work out
19
+ * @see {@link DocumentWorkflowFailReason} */
20
+ readonly Failed: "failed";
21
+ };
22
+ export type DocumentWorkflowState = EnumType<typeof DocumentWorkflowState>;
23
+ export declare const DocumentWorkflowFailReason: {
24
+ readonly NoSuitableCollection: "no-suitable-collection";
25
+ readonly NoSuitableRequest: "no-suitable-request";
26
+ };
27
+ export type DocumentWorkflowFailReason = EnumType<typeof DocumentWorkflowFailReason>;
28
+ export declare class DocumentWorkflow extends Entity {
29
+ static readonly entityName: 'DocumentWorkflow';
30
+ documentId: Uuid;
31
+ step: DocumentWorkflowStep;
32
+ state: DocumentWorkflowState;
33
+ failReason: DocumentWorkflowFailReason | null;
34
+ completeUserId: Uuid | null;
35
+ }
@@ -0,0 +1,70 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { defineEnum } from '../../enumeration/enumeration.js';
11
+ import { References } from '../../orm/decorators.js';
12
+ import { Entity } from '../../orm/entity.js';
13
+ import { Index, Uuid } from '../../orm/types.js';
14
+ import { Enumeration } from '../../schema/index.js';
15
+ import { DocumentManagementTable } from './document-management-table.js';
16
+ import { Document } from './document.model.js';
17
+ export const DocumentWorkflowStep = defineEnum('DocumentWorkflowStep', {
18
+ Classification: 'classification',
19
+ Extraction: 'extraction',
20
+ Assignment: 'assignment',
21
+ Validation: 'validation',
22
+ });
23
+ export const DocumentWorkflowState = defineEnum('DocumentWorkflowState', {
24
+ Pending: 'pending',
25
+ Running: 'running',
26
+ Completed: 'completed',
27
+ /** Unexpected error happened */
28
+ Error: 'error',
29
+ /**
30
+ * Something didn't work out
31
+ * @see {@link DocumentWorkflowFailReason} */
32
+ Failed: 'failed',
33
+ });
34
+ export const DocumentWorkflowFailReason = defineEnum('DocumentWorkflowFailReason', {
35
+ NoSuitableCollection: 'no-suitable-collection',
36
+ NoSuitableRequest: 'no-suitable-request',
37
+ });
38
+ let DocumentWorkflow = class DocumentWorkflow extends Entity {
39
+ documentId;
40
+ step;
41
+ state;
42
+ failReason;
43
+ completeUserId;
44
+ };
45
+ __decorate([
46
+ Uuid(),
47
+ References(() => Document),
48
+ __metadata("design:type", String)
49
+ ], DocumentWorkflow.prototype, "documentId", void 0);
50
+ __decorate([
51
+ Enumeration(DocumentWorkflowStep),
52
+ __metadata("design:type", String)
53
+ ], DocumentWorkflow.prototype, "step", void 0);
54
+ __decorate([
55
+ Enumeration(DocumentWorkflowState),
56
+ __metadata("design:type", String)
57
+ ], DocumentWorkflow.prototype, "state", void 0);
58
+ __decorate([
59
+ Enumeration(DocumentWorkflowFailReason, { nullable: true }),
60
+ __metadata("design:type", Object)
61
+ ], DocumentWorkflow.prototype, "failReason", void 0);
62
+ __decorate([
63
+ Uuid({ nullable: true }),
64
+ __metadata("design:type", Object)
65
+ ], DocumentWorkflow.prototype, "completeUserId", void 0);
66
+ DocumentWorkflow = __decorate([
67
+ DocumentManagementTable(),
68
+ Index(['documentId'], { unique: true, where: () => ({ state: { $neq: DocumentWorkflowState.Completed } }) })
69
+ ], DocumentWorkflow);
70
+ export { DocumentWorkflow };
@@ -1,6 +1,15 @@
1
+ import { type EnumType } from '../../enumeration/enumeration.js';
1
2
  import { Entity } from '../../orm/entity.js';
2
3
  import { NumericDate, Uuid } from '../../orm/types.js';
4
+ export declare const DocumentApproval: {
5
+ readonly Pending: "pending";
6
+ readonly Approved: "approved";
7
+ readonly Rejected: "rejected";
8
+ };
9
+ export type DocumentApproval = EnumType<typeof DocumentApproval>;
10
+ export type UpdatableDocumentProperties = keyof Pick<Document, 'typeId' | 'title' | 'subtitle' | 'date' | 'summary' | 'tags' | 'comment'>;
3
11
  export declare class Document extends Entity {
12
+ static readonly entityName: 'Document';
4
13
  fileId: Uuid;
5
14
  typeId: Uuid | null;
6
15
  title: string | null;
@@ -9,5 +18,7 @@ export declare class Document extends Entity {
9
18
  date: NumericDate | null;
10
19
  summary: string | null;
11
20
  tags: string[] | null;
12
- validated: boolean;
21
+ approval: DocumentApproval;
22
+ comment: string | null;
23
+ createUserId: Uuid | null;
13
24
  }
@@ -7,13 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
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
+ import { defineEnum } from '../../enumeration/enumeration.js';
10
11
  import { References } from '../../orm/decorators.js';
11
12
  import { Entity } from '../../orm/entity.js';
12
13
  import { NumericDate, Uuid } from '../../orm/types.js';
13
- import { Array, BooleanProperty, Integer, string, StringProperty } from '../../schema/index.js';
14
+ import { Array, Enumeration, Integer, string, StringProperty } from '../../schema/index.js';
14
15
  import { DocumentFile } from './document-file.model.js';
15
16
  import { DocumentManagementTable } from './document-management-table.js';
16
17
  import { DocumentType } from './document-type.model.js';
18
+ export const DocumentApproval = defineEnum('DocumentApproval', {
19
+ Pending: 'pending',
20
+ Approved: 'approved',
21
+ Rejected: 'rejected',
22
+ });
17
23
  let Document = class Document extends Entity {
18
24
  fileId;
19
25
  typeId;
@@ -23,7 +29,9 @@ let Document = class Document extends Entity {
23
29
  date;
24
30
  summary;
25
31
  tags;
26
- validated;
32
+ approval;
33
+ comment;
34
+ createUserId;
27
35
  };
28
36
  __decorate([
29
37
  Uuid(),
@@ -60,9 +68,17 @@ __decorate([
60
68
  __metadata("design:type", Object)
61
69
  ], Document.prototype, "tags", void 0);
62
70
  __decorate([
63
- BooleanProperty({ coerce: true }),
64
- __metadata("design:type", Boolean)
65
- ], Document.prototype, "validated", void 0);
71
+ Enumeration(DocumentApproval),
72
+ __metadata("design:type", String)
73
+ ], Document.prototype, "approval", void 0);
74
+ __decorate([
75
+ StringProperty({ nullable: true }),
76
+ __metadata("design:type", Object)
77
+ ], Document.prototype, "comment", void 0);
78
+ __decorate([
79
+ Uuid({ nullable: true }),
80
+ __metadata("design:type", Object)
81
+ ], Document.prototype, "createUserId", void 0);
66
82
  Document = __decorate([
67
83
  DocumentManagementTable()
68
84
  ], Document);
@@ -1,17 +1,22 @@
1
+ export * from './document-assignment-scope.model.js';
2
+ export * from './document-assignment-task.model.js';
1
3
  export * from './document-category.model.js';
2
- export * from './document-collection-document.model.js';
4
+ export * from './document-collection-assignment.model.js';
3
5
  export * from './document-collection.model.js';
4
6
  export * from './document-file.model.js';
7
+ export * from './document-management-table.js';
5
8
  export * from './document-property-value.model.js';
6
9
  export * from './document-property.model.js';
7
- export * from './document-request-assignment-task-collection.model.js';
8
- export * from './document-request-assignment-task.model.js';
9
10
  export * from './document-request-collection.model.js';
10
- export * from './document-request-file.model.js';
11
+ export * from './document-request-submission.model.js';
11
12
  export * from './document-request-template.js';
12
13
  export * from './document-request.model.js';
13
14
  export * from './document-requests-template.js';
14
15
  export * from './document-type-property.model.js';
16
+ export * from './document-type-validation.model.js';
15
17
  export * from './document-type.model.js';
18
+ export * from './document-validation-definition.model.js';
19
+ export * from './document-validation-execution-related-document.model.js';
20
+ export * from './document-validation-execution.model.js';
21
+ export * from './document-workflow.model.js';
16
22
  export * from './document.model.js';
17
- export * from './service-models/index.js';
@@ -1,17 +1,22 @@
1
+ export * from './document-assignment-scope.model.js';
2
+ export * from './document-assignment-task.model.js';
1
3
  export * from './document-category.model.js';
2
- export * from './document-collection-document.model.js';
4
+ export * from './document-collection-assignment.model.js';
3
5
  export * from './document-collection.model.js';
4
6
  export * from './document-file.model.js';
7
+ export * from './document-management-table.js';
5
8
  export * from './document-property-value.model.js';
6
9
  export * from './document-property.model.js';
7
- export * from './document-request-assignment-task-collection.model.js';
8
- export * from './document-request-assignment-task.model.js';
9
10
  export * from './document-request-collection.model.js';
10
- export * from './document-request-file.model.js';
11
+ export * from './document-request-submission.model.js';
11
12
  export * from './document-request-template.js';
12
13
  export * from './document-request.model.js';
13
14
  export * from './document-requests-template.js';
14
15
  export * from './document-type-property.model.js';
16
+ export * from './document-type-validation.model.js';
15
17
  export * from './document-type.model.js';
18
+ export * from './document-validation-definition.model.js';
19
+ export * from './document-validation-execution-related-document.model.js';
20
+ export * from './document-validation-execution.model.js';
21
+ export * from './document-workflow.model.js';
16
22
  export * from './document.model.js';
17
- export * from './service-models/index.js';