@tstdl/base 0.93.123 → 0.93.126

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 (219) hide show
  1. package/ai/genkit/tests/multi-region.test.js +6 -6
  2. package/ai/index.d.ts +2 -6
  3. package/ai/index.js +2 -6
  4. package/ai/parser/index.d.ts +1 -0
  5. package/ai/parser/index.js +1 -0
  6. package/ai/parser/parser.d.ts +12 -0
  7. package/ai/parser/parser.js +28 -0
  8. package/ai/prompts/build.d.ts +21 -0
  9. package/ai/prompts/build.js +25 -0
  10. package/ai/prompts/index.d.ts +2 -0
  11. package/ai/prompts/index.js +2 -0
  12. package/ai/prompts/instructions-formatter.d.ts +9 -22
  13. package/ai/prompts/instructions-formatter.js +20 -7
  14. package/ai/prompts/instructions.js +1 -1
  15. package/ai/prompts/steering.d.ts +27 -0
  16. package/ai/prompts/steering.js +54 -0
  17. package/ai/tests/instructions-formatter.test.js +115 -0
  18. package/ai/tests/steering.test.js +37 -0
  19. package/application/application.d.ts +2 -1
  20. package/application/application.js +3 -0
  21. package/authentication/client/module.d.ts +1 -1
  22. package/authentication/client/module.js +4 -5
  23. package/authentication/tests/authentication-ancillary.service.test.js +1 -1
  24. package/authentication/tests/authentication.api-controller.test.js +3 -1
  25. package/authentication/tests/authentication.api-request-token.provider.test.js +1 -1
  26. package/authentication/tests/authentication.client-service.test.js +1 -1
  27. package/authentication/tests/authentication.service.test.js +1 -1
  28. package/authentication/tests/subject.service.test.js +1 -1
  29. package/circuit-breaker/tests/circuit-breaker.test.js +1 -1
  30. package/document-management/api/document-management.api.d.ts +16 -16
  31. package/document-management/api/document-management.api.js +12 -12
  32. package/document-management/models/ai-configuration.d.ts +59 -0
  33. package/document-management/models/ai-configuration.js +1 -0
  34. package/document-management/models/document-assignment-scope.model.js +2 -4
  35. package/document-management/models/document-assignment-task.model.js +2 -4
  36. package/document-management/models/document-collection-assignment.model.js +2 -4
  37. package/document-management/models/document-collection.model.js +2 -3
  38. package/document-management/models/document-content.model.d.ts +6 -0
  39. package/document-management/models/document-content.model.js +32 -0
  40. package/document-management/models/document-property-value.model.js +1 -2
  41. package/document-management/models/document-request-collection-assignment.model.js +2 -4
  42. package/document-management/models/document-request.model.js +2 -4
  43. package/document-management/models/document-tag-assignment.model.js +2 -3
  44. package/document-management/models/document-validation-execution-related-document.model.js +2 -4
  45. package/document-management/models/document-validation-execution.model.js +2 -5
  46. package/document-management/models/document-workflow.model.d.ts +2 -1
  47. package/document-management/models/document-workflow.model.js +4 -5
  48. package/document-management/models/document.model.js +2 -3
  49. package/document-management/models/index.d.ts +2 -0
  50. package/document-management/models/index.js +2 -0
  51. package/document-management/server/api/document-management.api.d.ts +7 -7
  52. package/document-management/server/api/document-management.api.js +9 -9
  53. package/document-management/server/configure.d.ts +4 -1
  54. package/document-management/server/configure.js +9 -4
  55. package/document-management/server/drizzle/{0000_silly_chimera.sql → 0000_curious_nighthawk.sql} +8 -28
  56. package/document-management/server/drizzle/meta/0000_snapshot.json +14 -286
  57. package/document-management/server/drizzle/meta/_journal.json +2 -2
  58. package/document-management/server/module.d.ts +2 -0
  59. package/document-management/server/module.js +1 -0
  60. package/document-management/server/schemas.d.ts +2 -1
  61. package/document-management/server/services/document-file.service.d.ts +6 -6
  62. package/document-management/server/services/document-file.service.js +7 -81
  63. package/document-management/server/services/document-management-ai-provider.service.d.ts +66 -0
  64. package/document-management/server/services/document-management-ai-provider.service.js +2 -0
  65. package/document-management/server/services/document-management-ai.service.d.ts +44 -7
  66. package/document-management/server/services/document-management-ai.service.js +332 -329
  67. package/document-management/server/services/document-validation.service.d.ts +1 -1
  68. package/document-management/server/services/document-workflow.service.d.ts +4 -3
  69. package/document-management/server/services/document-workflow.service.js +26 -9
  70. package/document-management/server/services/document.service.d.ts +7 -3
  71. package/document-management/server/services/document.service.js +13 -4
  72. package/document-management/server/services/index.d.ts +1 -0
  73. package/document-management/server/services/index.js +1 -0
  74. package/document-management/server/validators/ai-validation-executor.d.ts +419 -12
  75. package/document-management/server/validators/ai-validation-executor.js +51 -46
  76. package/document-management/server/validators/single-document-validation-executor.d.ts +1 -3
  77. package/document-management/server/validators/single-document-validation-executor.js +2 -4
  78. package/document-management/service-models/document.service-model.d.ts +3 -3
  79. package/document-management/service-models/document.service-model.js +1 -1
  80. package/document-management/tests/ai-config-hierarchy.test.d.ts +1 -0
  81. package/document-management/tests/ai-config-hierarchy.test.js +64 -0
  82. package/document-management/tests/ai-config-integration.test.d.ts +1 -0
  83. package/document-management/tests/ai-config-integration.test.js +125 -0
  84. package/document-management/tests/ai-config-merge.test.d.ts +1 -0
  85. package/document-management/tests/ai-config-merge.test.js +38 -0
  86. package/document-management/tests/document-management-ai-overrides.test.d.ts +1 -0
  87. package/document-management/tests/document-management-ai-overrides.test.js +64 -0
  88. package/document-management/tests/document-management-core.test.js +6 -6
  89. package/document-management/tests/document-management.api.test.js +5 -5
  90. package/document-management/tests/document-statistics.service.test.js +10 -6
  91. package/document-management/tests/document-validation-ai-overrides.test.d.ts +1 -0
  92. package/document-management/tests/document-validation-ai-overrides.test.js +85 -0
  93. package/document-management/tests/document.service.test.js +15 -11
  94. package/document-management/tests/enum-helpers.test.js +5 -5
  95. package/examples/document-management/ai-provider.d.ts +20 -0
  96. package/examples/document-management/ai-provider.js +74 -0
  97. package/examples/document-management/main.js +9 -6
  98. package/examples/injector/graph-example.d.ts +1 -0
  99. package/examples/injector/graph-example.js +340 -0
  100. package/injector/decorators.d.ts +4 -4
  101. package/injector/decorators.js +5 -6
  102. package/injector/forward-ref.d.ts +15 -0
  103. package/injector/forward-ref.js +20 -0
  104. package/injector/graph.d.ts +113 -0
  105. package/injector/graph.js +631 -0
  106. package/injector/index.d.ts +2 -0
  107. package/injector/index.js +2 -0
  108. package/injector/inject.d.ts +15 -15
  109. package/injector/injector.d.ts +101 -13
  110. package/injector/injector.js +103 -59
  111. package/injector/resolve-chain.d.ts +20 -6
  112. package/injector/resolve-chain.js +39 -14
  113. package/injector/tests/advanced.test.d.ts +1 -0
  114. package/injector/tests/advanced.test.js +116 -0
  115. package/injector/tests/async-init.test.d.ts +1 -0
  116. package/injector/tests/async-init.test.js +77 -0
  117. package/injector/tests/basic.test.d.ts +1 -0
  118. package/injector/tests/basic.test.js +114 -0
  119. package/injector/tests/hierarchical.test.d.ts +1 -0
  120. package/injector/tests/hierarchical.test.js +59 -0
  121. package/injector/tests/lifecycles.test.d.ts +1 -0
  122. package/injector/tests/lifecycles.test.js +109 -0
  123. package/injector/token.d.ts +2 -1
  124. package/injector/token.js +4 -1
  125. package/injector/type-info.d.ts +1 -5
  126. package/injector/types.d.ts +4 -10
  127. package/logger/tests/pretty-print.test.d.ts +1 -0
  128. package/logger/{formatters → tests}/pretty-print.test.js +1 -1
  129. package/logger/transports/console.d.ts +3 -2
  130. package/logger/transports/console.js +4 -3
  131. package/notification/api/notification.api.d.ts +26 -6
  132. package/notification/api/notification.api.js +15 -4
  133. package/notification/client/notification-client.d.ts +6 -0
  134. package/notification/client/notification-client.js +13 -3
  135. package/notification/models/in-app-notification.model.d.ts +9 -3
  136. package/notification/models/in-app-notification.model.js +32 -11
  137. package/notification/models/notification-log.model.js +2 -3
  138. package/notification/server/api/notification.api-controller.d.ts +1 -0
  139. package/notification/server/api/notification.api-controller.js +7 -1
  140. package/notification/server/drizzle/{0000_oval_rage.sql → 0000_wise_pyro.sql} +22 -4
  141. package/notification/server/drizzle/meta/0000_snapshot.json +249 -37
  142. package/notification/server/drizzle/meta/_journal.json +2 -2
  143. package/notification/server/module.d.ts +5 -0
  144. package/notification/server/module.js +6 -1
  145. package/notification/server/providers/in-app-channel-provider.js +1 -0
  146. package/notification/server/schemas.d.ts +3 -2
  147. package/notification/server/schemas.js +3 -2
  148. package/notification/server/services/notification.service.d.ts +11 -6
  149. package/notification/server/services/notification.service.js +138 -42
  150. package/notification/tests/notification-api.test.js +16 -6
  151. package/notification/tests/notification-client.test.d.ts +1 -0
  152. package/notification/tests/{unit/notification-client.test.js → notification-client.test.js} +5 -5
  153. package/notification/tests/notification-flow.test.js +45 -7
  154. package/notification/tests/notification-sse.service.test.js +1 -1
  155. package/notification/tests/notification-type.service.test.js +1 -1
  156. package/object-storage/s3/s3.object-storage.js +3 -0
  157. package/object-storage/s3/tests/s3.object-storage.integration.test.js +1 -1
  158. package/orm/server/drizzle/schema-converter.js +5 -3
  159. package/orm/tests/repository-attributes.test.js +10 -17
  160. package/orm/tests/repository-cti-mapping.test.js +2 -2
  161. package/orm/tests/repository-cti-soft-delete.test.js +1 -1
  162. package/orm/tests/repository-cti.test.js +19 -33
  163. package/orm/tests/repository-extra-coverage.test.js +1 -1
  164. package/orm/tests/repository-search.test.js +5 -2
  165. package/orm/tests/schema-converter.test.js +1 -0
  166. package/orm/tests/transaction-safety.test.js +1 -1
  167. package/package.json +7 -9
  168. package/rate-limit/tests/postgres-rate-limiter.test.js +6 -16
  169. package/renderer/d2.d.ts +77 -0
  170. package/renderer/d2.js +68 -0
  171. package/renderer/graphviz.d.ts +47 -0
  172. package/renderer/graphviz.js +58 -0
  173. package/renderer/index.d.ts +4 -0
  174. package/renderer/index.js +4 -0
  175. package/renderer/typst.d.ts +57 -0
  176. package/renderer/typst.js +62 -0
  177. package/rpc/adapters/readable-stream.adapter.d.ts +3 -0
  178. package/rpc/adapters/readable-stream.adapter.js +5 -1
  179. package/rpc/rpc.js +28 -3
  180. package/rpc/tests/rpc.integration.test.js +3 -1
  181. package/schema/schemas/nullable.js +1 -1
  182. package/task-queue/task-queue.d.ts +2 -0
  183. package/task-queue/task-queue.js +6 -2
  184. package/task-queue/tests/complex.test.js +1 -1
  185. package/task-queue/tests/dependencies.test.js +3 -3
  186. package/task-queue/tests/extensive-dependencies.test.js +1 -1
  187. package/task-queue/tests/queue.test.js +1 -1
  188. package/task-queue/tests/worker.test.js +4 -7
  189. package/test5.js +52 -8
  190. package/{unit-test → testing}/integration-setup.d.ts +1 -0
  191. package/{unit-test → testing}/integration-setup.js +13 -0
  192. package/utils/base64.d.ts +7 -0
  193. package/utils/base64.js +10 -1
  194. package/utils/noop.d.ts +7 -1
  195. package/utils/noop.js +7 -1
  196. package/ai/ai-file.service.d.ts +0 -57
  197. package/ai/ai-file.service.js +0 -233
  198. package/ai/ai-session.d.ts +0 -38
  199. package/ai/ai-session.js +0 -50
  200. package/ai/ai.service.d.ts +0 -126
  201. package/ai/ai.service.js +0 -481
  202. package/ai/functions.d.ts +0 -9
  203. package/ai/functions.js +0 -38
  204. package/ai/module.d.ts +0 -26
  205. package/ai/module.js +0 -25
  206. package/ai/types.d.ts +0 -229
  207. package/ai/types.js +0 -33
  208. package/latex/index.d.ts +0 -1
  209. package/latex/index.js +0 -1
  210. package/typst/index.d.ts +0 -1
  211. package/typst/index.js +0 -1
  212. package/typst/render.d.ts +0 -23
  213. package/typst/render.js +0 -32
  214. /package/{logger/formatters/pretty-print.test.d.ts → ai/tests/instructions-formatter.test.d.ts} +0 -0
  215. /package/{notification/tests/unit/notification-client.test.d.ts → ai/tests/steering.test.d.ts} +0 -0
  216. /package/{latex/render.d.ts → renderer/latex.d.ts} +0 -0
  217. /package/{latex/render.js → renderer/latex.js} +0 -0
  218. /package/{unit-test → testing}/index.d.ts +0 -0
  219. /package/{unit-test → testing}/index.js +0 -0
@@ -4,7 +4,7 @@ import { AuthenticationAncillaryService, AuthenticationService as Authentication
4
4
  import { HttpClientOptions } from '../../http/client/index.js';
5
5
  import { HttpServer } from '../../http/server/index.js';
6
6
  import { runInInjectionContext } from '../../injector/index.js';
7
- import { clearTenantData, setupIntegrationTest } from '../../unit-test/index.js';
7
+ import { clearTenantData, setupIntegrationTest } from '../../testing/index.js';
8
8
  import { SubjectService } from '../server/subject.service.js';
9
9
  import { DefaultAuthenticationAncillaryService } from './authentication.test-ancillary-service.js';
10
10
  describe('AuthenticationApiController Integration', () => {
@@ -74,6 +74,8 @@ describe('AuthenticationApiController Integration', () => {
74
74
  const admin = await subjectService.createUser({ tenantId, email: 'api-admin@example.com', firstName: 'A', lastName: 'D' });
75
75
  const user = await subjectService.createUser({ tenantId, email: 'api-user@example.com', firstName: 'U', lastName: 'S' });
76
76
  await serverService.setCredentials(admin, 'Admin-Pass-123!');
77
+ expect(await subjectService.exists(tenantId, admin.id)).toBe(true);
78
+ expect(await subjectService.exists(tenantId, user.id)).toBe(true);
77
79
  await service.login({ tenantId, subject: admin.id }, 'Admin-Pass-123!');
78
80
  await service.impersonate(user.id);
79
81
  expect(service.subjectId()).toBe(user.id);
@@ -2,7 +2,7 @@ import { afterAll, beforeAll, describe, expect, test } from 'vitest';
2
2
  import { AuthenticationApiRequestTokenProvider } from '../../authentication/server/authentication-api-request-token.provider.js';
3
3
  import { AuthenticationService } from '../../authentication/server/index.js';
4
4
  import { runInInjectionContext } from '../../injector/index.js';
5
- import { setupIntegrationTest } from '../../unit-test/index.js';
5
+ import { setupIntegrationTest } from '../../testing/index.js';
6
6
  import { SubjectService } from '../server/subject.service.js';
7
7
  describe('AuthenticationApiRequestTokenProvider', () => {
8
8
  let injector;
@@ -4,7 +4,7 @@ import { AuthenticationService as AuthenticationServerService } from '../../auth
4
4
  import { HttpClientOptions } from '../../http/client/index.js';
5
5
  import { HttpServer } from '../../http/server/index.js';
6
6
  import { runInInjectionContext } from '../../injector/index.js';
7
- import { clearTenantData, setupIntegrationTest } from '../../unit-test/index.js';
7
+ import { clearTenantData, setupIntegrationTest } from '../../testing/index.js';
8
8
  import { SubjectService } from '../server/subject.service.js';
9
9
  import { DefaultAuthenticationAncillaryService } from './authentication.test-ancillary-service.js';
10
10
  describe('AuthenticationClientService Integration', () => {
@@ -2,7 +2,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'vitest'
2
2
  import { ActorType, Auditor } from '../../audit/index.js';
3
3
  import { NIL_UUID } from '../../constants.js';
4
4
  import { runInInjectionContext } from '../../injector/index.js';
5
- import { clearTenantData, setupIntegrationTest } from '../../unit-test/index.js';
5
+ import { clearTenantData, setupIntegrationTest } from '../../testing/index.js';
6
6
  import { AuthenticationAncillaryService } from '../server/authentication-ancillary.service.js';
7
7
  import { AuthenticationService } from '../server/authentication.service.js';
8
8
  import { SubjectService } from '../server/subject.service.js';
@@ -1,7 +1,7 @@
1
1
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
2
2
  import { NIL_UUID } from '../../constants.js';
3
3
  import { runInInjectionContext } from '../../injector/index.js';
4
- import { clearTenantData, setupIntegrationTest } from '../../unit-test/index.js';
4
+ import { clearTenantData, setupIntegrationTest } from '../../testing/index.js';
5
5
  import { SubjectStatus } from '../models/index.js';
6
6
  import { SubjectService } from '../server/subject.service.js';
7
7
  describe('SubjectService', () => {
@@ -1,7 +1,7 @@
1
1
  import { afterAll, beforeAll, describe, expect, it } from 'vitest';
2
2
  import { CircuitBreakerState } from '../../circuit-breaker/index.js';
3
3
  import { CircuitBreakerProvider } from '../../circuit-breaker/provider.js';
4
- import { setupIntegrationTest } from '../../unit-test/index.js';
4
+ import { setupIntegrationTest } from '../../testing/index.js';
5
5
  import { timeout } from '../../utils/timing.js';
6
6
  describe('Circuit Breaker (Standalone) Tests', () => {
7
7
  let injector;
@@ -5,7 +5,7 @@ export type DocumentManagementApiDefinition = typeof documentManagementApiDefini
5
5
  export declare const documentManagementApiDefinition: {
6
6
  resource: string;
7
7
  endpoints: {
8
- loadData: {
8
+ getData: {
9
9
  resource: string;
10
10
  method: "GET";
11
11
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -27,7 +27,7 @@ export declare const documentManagementApiDefinition: {
27
27
  result: typeof CategoriesAndTypesData;
28
28
  credentials: true;
29
29
  };
30
- loadDataStream: {
30
+ getDataStream: {
31
31
  resource: string;
32
32
  method: "GET";
33
33
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -45,19 +45,19 @@ export declare const documentManagementApiDefinition: {
45
45
  accessControlAllowHeaders: string;
46
46
  };
47
47
  };
48
- loadDocumentRequestsTemplateData: {
48
+ getDocumentRequestsTemplateData: {
49
49
  resource: string;
50
50
  method: "GET";
51
51
  result: typeof DocumentRequestsTemplateData;
52
52
  credentials: true;
53
53
  };
54
- loadAvailableCategories: {
54
+ getAvailableCategories: {
55
55
  resource: string;
56
56
  method: "GET";
57
57
  result: import("../../schema/index.js").ArraySchema<DocumentCategoryView>;
58
58
  credentials: true;
59
59
  };
60
- loadContent: {
60
+ getFileContent: {
61
61
  resource: string;
62
62
  method: "GET";
63
63
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -67,7 +67,7 @@ export declare const documentManagementApiDefinition: {
67
67
  result: Uint8ArrayConstructor;
68
68
  credentials: true;
69
69
  };
70
- getContentUrl: {
70
+ getFileContentUrl: {
71
71
  resource: string;
72
72
  method: "GET";
73
73
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -77,7 +77,7 @@ export declare const documentManagementApiDefinition: {
77
77
  result: import("../../schema/index.js").StringSchema;
78
78
  credentials: true;
79
79
  };
80
- loadPreview: {
80
+ getPreview: {
81
81
  resource: string;
82
82
  method: "GET";
83
83
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -369,7 +369,7 @@ export declare const documentManagementApiDefinition: {
369
369
  method: "POST";
370
370
  parameters: import("../../schema/index.js").ObjectSchema<{
371
371
  id: string;
372
- state: "error" | "pending" | "running" | "completed" | "failed" | "review";
372
+ state: "error" | "pending" | "running" | "completed" | "review" | "failed";
373
373
  }>;
374
374
  result: import("../../schema/index.js").LiteralSchema<"ok">;
375
375
  credentials: true;
@@ -421,7 +421,7 @@ export declare const documentManagementApiDefinition: {
421
421
  declare const _DocumentManagementApi: import("../../api/client/index.js").ApiClient<{
422
422
  resource: string;
423
423
  endpoints: {
424
- loadData: {
424
+ getData: {
425
425
  resource: string;
426
426
  method: "GET";
427
427
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -443,7 +443,7 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
443
443
  result: typeof CategoriesAndTypesData;
444
444
  credentials: true;
445
445
  };
446
- loadDataStream: {
446
+ getDataStream: {
447
447
  resource: string;
448
448
  method: "GET";
449
449
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -461,19 +461,19 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
461
461
  accessControlAllowHeaders: string;
462
462
  };
463
463
  };
464
- loadDocumentRequestsTemplateData: {
464
+ getDocumentRequestsTemplateData: {
465
465
  resource: string;
466
466
  method: "GET";
467
467
  result: typeof DocumentRequestsTemplateData;
468
468
  credentials: true;
469
469
  };
470
- loadAvailableCategories: {
470
+ getAvailableCategories: {
471
471
  resource: string;
472
472
  method: "GET";
473
473
  result: import("../../schema/index.js").ArraySchema<DocumentCategoryView>;
474
474
  credentials: true;
475
475
  };
476
- loadContent: {
476
+ getFileContent: {
477
477
  resource: string;
478
478
  method: "GET";
479
479
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -483,7 +483,7 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
483
483
  result: Uint8ArrayConstructor;
484
484
  credentials: true;
485
485
  };
486
- getContentUrl: {
486
+ getFileContentUrl: {
487
487
  resource: string;
488
488
  method: "GET";
489
489
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -493,7 +493,7 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
493
493
  result: import("../../schema/index.js").StringSchema;
494
494
  credentials: true;
495
495
  };
496
- loadPreview: {
496
+ getPreview: {
497
497
  resource: string;
498
498
  method: "GET";
499
499
  parameters: import("../../schema/index.js").ObjectSchema<{
@@ -785,7 +785,7 @@ declare const _DocumentManagementApi: import("../../api/client/index.js").ApiCli
785
785
  method: "POST";
786
786
  parameters: import("../../schema/index.js").ObjectSchema<{
787
787
  id: string;
788
- state: "error" | "pending" | "running" | "completed" | "failed" | "review";
788
+ state: "error" | "pending" | "running" | "completed" | "review" | "failed";
789
789
  }>;
790
790
  result: import("../../schema/index.js").LiteralSchema<"ok">;
791
791
  credentials: true;
@@ -13,14 +13,14 @@ import { array, boolean, literal, number, object, optional, string } from '../..
13
13
  import { DataStream } from '../../sse/index.js';
14
14
  import { policy } from '../authorization/index.js';
15
15
  import { Document, DocumentCategory, DocumentRequest, DocumentRequestsTemplate, DocumentRequestTemplate, DocumentType } from '../models/index.js';
16
- import { addOrArchiveDocumentToOrFromCollectionParametersSchema, applyDocumentRequestsTemplateParametersSchema, CategoriesAndTypesData, createDocumentCategoryParametersSchema, createDocumentParametersSchema, createDocumentRequestParametersSchema, createDocumentRequestsTemplateParametersSchema, createDocumentRequestTemplateParametersSchema, createDocumentTypeParametersSchema, deleteDocumentRequestParametersSchema, deleteDocumentRequestsTemplateParametersSchema, deleteDocumentRequestTemplateParametersSchema, DocumentCategoryView, DocumentManagementData, DocumentRequestsTemplateData, DocumentStatistics, GetDocumentStatisticsOptions, loadDataParametersSchema, proceedDocumentWorkflowParametersSchema, updateDocumentParametersSchema, updateDocumentRequestParametersSchema, updateDocumentRequestsTemplateParametersSchema, updateDocumentRequestTemplateParametersSchema } from '../service-models/index.js';
16
+ import { addOrArchiveDocumentToOrFromCollectionParametersSchema, applyDocumentRequestsTemplateParametersSchema, CategoriesAndTypesData, createDocumentCategoryParametersSchema, createDocumentParametersSchema, createDocumentRequestParametersSchema, createDocumentRequestsTemplateParametersSchema, createDocumentRequestTemplateParametersSchema, createDocumentTypeParametersSchema, deleteDocumentRequestParametersSchema, deleteDocumentRequestsTemplateParametersSchema, deleteDocumentRequestTemplateParametersSchema, DocumentCategoryView, DocumentManagementData, DocumentRequestsTemplateData, DocumentStatistics, getDataParametersSchema, GetDocumentStatisticsOptions, proceedDocumentWorkflowParametersSchema, updateDocumentParametersSchema, updateDocumentRequestParametersSchema, updateDocumentRequestsTemplateParametersSchema, updateDocumentRequestTemplateParametersSchema } from '../service-models/index.js';
17
17
  export const documentManagementApiDefinition = defineApi({
18
18
  resource: 'document-management',
19
19
  endpoints: {
20
- loadData: {
20
+ getData: {
21
21
  resource: 'data',
22
22
  method: 'GET',
23
- parameters: loadDataParametersSchema,
23
+ parameters: getDataParametersSchema,
24
24
  result: DocumentManagementData,
25
25
  credentials: true,
26
26
  },
@@ -37,29 +37,29 @@ export const documentManagementApiDefinition = defineApi({
37
37
  result: CategoriesAndTypesData,
38
38
  credentials: true,
39
39
  },
40
- loadDataStream: {
40
+ getDataStream: {
41
41
  resource: 'data/stream',
42
42
  method: 'GET',
43
- parameters: loadDataParametersSchema,
43
+ parameters: getDataParametersSchema,
44
44
  result: (DataStream),
45
45
  credentials: true,
46
46
  data: { [bustCache]: true },
47
47
  cors: { accessControlAllowHeaders: `${defaultAccessControlAllowHeaders}, Cache-Control` },
48
48
  },
49
- loadDocumentRequestsTemplateData: {
49
+ getDocumentRequestsTemplateData: {
50
50
  resource: 'views/document-requests-template-data',
51
51
  method: 'GET',
52
52
  result: DocumentRequestsTemplateData,
53
53
  credentials: true,
54
54
  },
55
- loadAvailableCategories: {
55
+ getAvailableCategories: {
56
56
  resource: 'views/categories',
57
57
  method: 'GET',
58
58
  result: array(DocumentCategoryView),
59
59
  credentials: true,
60
60
  },
61
- loadContent: {
62
- resource: 'documents/:id/content',
61
+ getFileContent: {
62
+ resource: 'documents/:id/file/content',
63
63
  method: 'GET',
64
64
  parameters: object({
65
65
  id: string(),
@@ -68,8 +68,8 @@ export const documentManagementApiDefinition = defineApi({
68
68
  result: Uint8Array,
69
69
  credentials: true,
70
70
  },
71
- getContentUrl: {
72
- resource: 'documents/:id/content/url',
71
+ getFileContentUrl: {
72
+ resource: 'documents/:id/file/content/url',
73
73
  method: 'GET',
74
74
  parameters: object({
75
75
  id: string(),
@@ -78,7 +78,7 @@ export const documentManagementApiDefinition = defineApi({
78
78
  result: string(),
79
79
  credentials: true,
80
80
  },
81
- loadPreview: {
81
+ getPreview: {
82
82
  resource: 'documents/:id/preview/:page',
83
83
  method: 'GET',
84
84
  parameters: object({
@@ -0,0 +1,59 @@
1
+ import type { ModelReference } from 'genkit';
2
+ import type { Instructions } from '../../ai/prompts/instructions-formatter.js';
3
+ import type { DocumentWorkflowStep } from './document-workflow.model.js';
4
+ export type InstructionStrategy = 'replace' | 'append';
5
+ export type InstructionOverride = string | {
6
+ /**
7
+ * Simple way: Provide a specific format pattern.
8
+ * This will be used with a default instruction template for the field.
9
+ */
10
+ format?: string;
11
+ /**
12
+ * Advanced way: Provide full custom instructions.
13
+ */
14
+ content?: string;
15
+ /**
16
+ * Strategy for 'content'. Defaults to 'append'.
17
+ */
18
+ strategy?: InstructionStrategy;
19
+ };
20
+ export type AiConfiguration = {
21
+ /** The model to use. */
22
+ model?: ModelReference<any>;
23
+ /** The language to use for AI outputs. */
24
+ language?: string;
25
+ /** Prompt overrides. */
26
+ prompt?: {
27
+ /** Addition to the system prompt. */
28
+ systemAddition?: Instructions | string;
29
+ /** Addition to the user prompt. */
30
+ userAddition?: Instructions | string;
31
+ /** Expert override for the system prompt. Receives the base prompt. */
32
+ systemOverride?: (base: Instructions) => Instructions | string;
33
+ /** Expert override for the user prompt. Receives the base prompt. */
34
+ userOverride?: (base: Instructions) => Instructions | string;
35
+ };
36
+ /** Granular extraction instructions. */
37
+ extraction?: {
38
+ title?: InstructionOverride;
39
+ subtitle?: InstructionOverride;
40
+ date?: InstructionOverride;
41
+ summary?: InstructionOverride;
42
+ tags?: InstructionOverride;
43
+ properties?: Record<string, InstructionOverride>;
44
+ };
45
+ /** Granular classification instructions. */
46
+ classification?: InstructionOverride;
47
+ };
48
+ export type DocumentManagementAiConfiguration = {
49
+ /** Global defaults. */
50
+ defaults?: AiConfiguration;
51
+ /** Step-specific configurations. */
52
+ steps?: Partial<Record<DocumentWorkflowStep, AiConfiguration>>;
53
+ /** Document category specific configurations. Key is Category Key. */
54
+ categories?: Record<string, AiConfiguration>;
55
+ /** Document type specific configurations. Key is Document Type Key. */
56
+ documentTypes?: Record<string, AiConfiguration>;
57
+ /** Validation specific configurations. Key is Validation Identifier. */
58
+ validations?: Record<string, AiConfiguration>;
59
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,7 @@ 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 { ForeignKey, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
10
+ import { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
11
  import { DocumentAssignmentTask } from './document-assignment-task.model.js';
12
12
  import { DocumentCollection } from './document-collection.model.js';
13
13
  import { DocumentManagementTable } from './document-management-table.js';
@@ -32,8 +32,6 @@ __decorate([
32
32
  ], DocumentAssignmentScope.prototype, "collectionId", void 0);
33
33
  DocumentAssignmentScope = __decorate([
34
34
  DocumentManagementTable({ name: 'assignment_scope' }),
35
- Unique(['taskId', 'collectionId']),
36
- ForeignKey(() => DocumentAssignmentTask, ['tenantId', 'taskId'], ['tenantId', 'id']),
37
- ForeignKey(() => DocumentCollection, ['tenantId', 'collectionId'], ['tenantId', 'id'])
35
+ Unique(['taskId', 'collectionId'])
38
36
  ], DocumentAssignmentScope);
39
37
  export { DocumentAssignmentScope };
@@ -8,7 +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, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
+ import { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
12
12
  import { Enumeration } from '../../schema/index.js';
13
13
  import { DocumentManagementTable } from './document-management-table.js';
14
14
  import { Document } from './document.model.js';
@@ -24,7 +24,6 @@ let DocumentAssignmentTask = class DocumentAssignmentTask extends TenantEntity {
24
24
  __decorate([
25
25
  UuidProperty(),
26
26
  TenantReference(() => Document),
27
- Unique(),
28
27
  __metadata("design:type", String)
29
28
  ], DocumentAssignmentTask.prototype, "documentId", void 0);
30
29
  __decorate([
@@ -33,7 +32,6 @@ __decorate([
33
32
  ], DocumentAssignmentTask.prototype, "target", void 0);
34
33
  DocumentAssignmentTask = __decorate([
35
34
  DocumentManagementTable({ name: 'assignment_task' }),
36
- Unique(['tenantId', 'id']),
37
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
35
+ Unique(['tenantId', 'documentId'])
38
36
  ], DocumentAssignmentTask);
39
37
  export { DocumentAssignmentTask };
@@ -7,7 +7,7 @@ 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 { ForeignKey, Index, TenantEntity, TenantReference, TimestampProperty, Unique, UuidProperty } from '../../orm/index.js';
10
+ import { Index, TenantEntity, TenantReference, TimestampProperty, Unique, UuidProperty } from '../../orm/index.js';
11
11
  import { DocumentCollection } from './document-collection.model.js';
12
12
  import { DocumentManagementTable } from './document-management-table.js';
13
13
  import { Document } from './document.model.js';
@@ -33,8 +33,6 @@ __decorate([
33
33
  ], DocumentCollectionAssignment.prototype, "archiveTimestamp", void 0);
34
34
  DocumentCollectionAssignment = __decorate([
35
35
  DocumentManagementTable({ name: 'collection_assignment' }),
36
- Unique(['tenantId', 'collectionId', 'documentId']),
37
- ForeignKey(() => DocumentCollection, ['tenantId', 'collectionId'], ['tenantId', 'id']),
38
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
36
+ Unique(['tenantId', 'collectionId', 'documentId'])
39
37
  ], DocumentCollectionAssignment);
40
38
  export { DocumentCollectionAssignment };
@@ -7,7 +7,7 @@ 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 { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
10
+ import { TenantEntity, TenantReference, UuidProperty } from '../../orm/index.js';
11
11
  import { DocumentManagementTable } from './document-management-table.js';
12
12
  let DocumentCollection = class DocumentCollection extends TenantEntity {
13
13
  static entityName = 'DocumentCollection';
@@ -19,7 +19,6 @@ __decorate([
19
19
  __metadata("design:type", Object)
20
20
  ], DocumentCollection.prototype, "parentId", void 0);
21
21
  DocumentCollection = __decorate([
22
- DocumentManagementTable({ name: 'collection' }),
23
- Unique(['tenantId', 'id'])
22
+ DocumentManagementTable({ name: 'collection' })
24
23
  ], DocumentCollection);
25
24
  export { DocumentCollection };
@@ -0,0 +1,6 @@
1
+ import { TenantEntity, type Uuid } from '../../orm/index.js';
2
+ export declare class DocumentContent extends TenantEntity {
3
+ static readonly entityName = "DocumentContent";
4
+ documentId: Uuid;
5
+ content: string;
6
+ }
@@ -0,0 +1,32 @@
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 { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
+ import { StringProperty } from '../../schema/index.js';
12
+ import { DocumentManagementTable } from './document-management-table.js';
13
+ import { Document } from './document.model.js';
14
+ let DocumentContent = class DocumentContent extends TenantEntity {
15
+ static entityName = 'DocumentContent';
16
+ documentId;
17
+ content;
18
+ };
19
+ __decorate([
20
+ UuidProperty(),
21
+ TenantReference(() => Document),
22
+ __metadata("design:type", String)
23
+ ], DocumentContent.prototype, "documentId", void 0);
24
+ __decorate([
25
+ StringProperty(),
26
+ __metadata("design:type", String)
27
+ ], DocumentContent.prototype, "content", void 0);
28
+ DocumentContent = __decorate([
29
+ DocumentManagementTable(),
30
+ Unique(['tenantId', 'documentId'])
31
+ ], DocumentContent);
32
+ export { DocumentContent };
@@ -8,7 +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 { eq, sql } from 'drizzle-orm';
11
- import { Check, ForeignKey, NumericDateProperty, numNonNulls, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
+ import { Check, NumericDateProperty, numNonNulls, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
12
12
  import { BooleanProperty, Integer, NumberProperty, StringProperty } from '../../schema/index.js';
13
13
  import { DocumentManagementTable } from './document-management-table.js';
14
14
  import { DocumentProperty } from './document-property.model.js';
@@ -56,7 +56,6 @@ __decorate([
56
56
  DocumentPropertyValue = __decorate([
57
57
  DocumentManagementTable({ name: 'property_value' }),
58
58
  Unique(['tenantId', 'documentId', 'propertyId']),
59
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id']),
60
59
  Check('only_one_value', (table) => eq(numNonNulls(table.text, table.integer, table.decimal, table.boolean, table.date), sql.raw('1')))
61
60
  ], DocumentPropertyValue);
62
61
  export { DocumentPropertyValue };
@@ -7,7 +7,7 @@ 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 { ForeignKey, Index, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
10
+ import { Index, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
11
  import { DocumentCollection } from './document-collection.model.js';
12
12
  import { DocumentManagementTable } from './document-management-table.js';
13
13
  import { DocumentRequest } from './document-request.model.js';
@@ -29,8 +29,6 @@ __decorate([
29
29
  ], DocumentRequestCollectionAssignment.prototype, "collectionId", void 0);
30
30
  DocumentRequestCollectionAssignment = __decorate([
31
31
  DocumentManagementTable({ name: 'request_collection_assignment' }),
32
- Unique(['tenantId', 'requestId', 'collectionId']),
33
- ForeignKey(() => DocumentRequest, ['tenantId', 'requestId'], ['tenantId', 'id']),
34
- ForeignKey(() => DocumentCollection, ['tenantId', 'collectionId'], ['tenantId', 'id'])
32
+ Unique(['tenantId', 'requestId', 'collectionId'])
35
33
  ], DocumentRequestCollectionAssignment);
36
34
  export { DocumentRequestCollectionAssignment };
@@ -8,7 +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, Index, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
+ import { Index, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
12
12
  import { Enumeration, StringProperty } from '../../schema/index.js';
13
13
  import { DocumentManagementTable } from './document-management-table.js';
14
14
  import { DocumentType } from './document-type.model.js';
@@ -37,7 +37,6 @@ __decorate([
37
37
  __decorate([
38
38
  UuidProperty({ nullable: true }),
39
39
  TenantReference(() => Document),
40
- Unique(),
41
40
  __metadata("design:type", Object)
42
41
  ], DocumentRequest.prototype, "documentId", void 0);
43
42
  __decorate([
@@ -51,7 +50,6 @@ __decorate([
51
50
  ], DocumentRequest.prototype, "state", void 0);
52
51
  DocumentRequest = __decorate([
53
52
  DocumentManagementTable({ name: 'request' }),
54
- Unique(['tenantId', 'id']),
55
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
53
+ Unique(['tenantId', 'documentId'])
56
54
  ], DocumentRequest);
57
55
  export { DocumentRequest };
@@ -7,7 +7,7 @@ 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 { ForeignKey, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
10
+ import { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
11
  import { DocumentManagementTable } from './document-management-table.js';
12
12
  import { DocumentTag } from './document-tag.model.js';
13
13
  import { Document } from './document.model.js';
@@ -28,7 +28,6 @@ __decorate([
28
28
  ], DocumentTagAssignment.prototype, "tagId", void 0);
29
29
  DocumentTagAssignment = __decorate([
30
30
  DocumentManagementTable({ name: 'tag_assignment' }),
31
- Unique(['tenantId', 'documentId', 'tagId']),
32
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
31
+ Unique(['tenantId', 'documentId', 'tagId'])
33
32
  ], DocumentTagAssignment);
34
33
  export { DocumentTagAssignment };
@@ -7,7 +7,7 @@ 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 { ForeignKey, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
10
+ import { TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
11
11
  import { DocumentManagementTable } from './document-management-table.js';
12
12
  import { DocumentValidationExecution } from './document-validation-execution.model.js';
13
13
  import { Document } from './document.model.js';
@@ -28,8 +28,6 @@ __decorate([
28
28
  ], DocumentValidationExecutionRelatedDocument.prototype, "documentId", void 0);
29
29
  DocumentValidationExecutionRelatedDocument = __decorate([
30
30
  DocumentManagementTable({ name: 'validation_execution_related_document' }),
31
- Unique(['tenantId', 'executionId', 'documentId']),
32
- ForeignKey(() => DocumentValidationExecution, ['tenantId', 'executionId'], ['tenantId', 'id']),
33
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id'])
31
+ Unique(['tenantId', 'executionId', 'documentId'])
34
32
  ], DocumentValidationExecutionRelatedDocument);
35
33
  export { DocumentValidationExecutionRelatedDocument };
@@ -8,7 +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, TenantEntity, TenantReference, TimestampProperty, Unique, UuidProperty } from '../../orm/index.js';
11
+ import { TenantEntity, TenantReference, TimestampProperty, Unique, UuidProperty } from '../../orm/index.js';
12
12
  import { Enumeration, StringProperty } from '../../schema/index.js';
13
13
  import { DocumentManagementTable } from './document-management-table.js';
14
14
  import { DocumentValidationDefinition } from './document-validation-definition.model.js';
@@ -66,9 +66,6 @@ __decorate([
66
66
  ], DocumentValidationExecution.prototype, "completedAt", void 0);
67
67
  DocumentValidationExecution = __decorate([
68
68
  DocumentManagementTable({ name: 'validation_execution' }),
69
- Unique(['tenantId', 'id']) // required for foreign key of DocumentValidationExecutionRelatedDocument
70
- ,
71
- Unique(['tenantId', 'workflowId', 'definitionId']),
72
- ForeignKey(() => DocumentWorkflow, ['tenantId', 'workflowId'], ['tenantId', 'id'])
69
+ Unique(['tenantId', 'workflowId', 'definitionId'])
73
70
  ], DocumentValidationExecution);
74
71
  export { DocumentValidationExecution };
@@ -1,8 +1,9 @@
1
1
  import { type EnumType } from '../../enumeration/enumeration.js';
2
2
  import { TenantEntity, type Timestamp, type Uuid } from '../../orm/index.js';
3
3
  export declare const DocumentWorkflowStep: {
4
+ readonly ContentExtraction: "content-extraction";
4
5
  readonly Classification: "classification";
5
- readonly Extraction: "extraction";
6
+ readonly DataExtraction: "data-extraction";
6
7
  readonly Assignment: "assignment";
7
8
  readonly Validation: "validation";
8
9
  };
@@ -8,13 +8,14 @@ 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, Index, TenantEntity, TenantReference, TimestampProperty, Unique, UuidProperty } from '../../orm/index.js';
11
+ import { Index, TenantEntity, TenantReference, TimestampProperty, UuidProperty } from '../../orm/index.js';
12
12
  import { BooleanProperty, Enumeration } from '../../schema/index.js';
13
13
  import { DocumentManagementTable } from './document-management-table.js';
14
14
  import { Document } from './document.model.js';
15
15
  export const DocumentWorkflowStep = defineEnum('DocumentWorkflowStep', {
16
+ ContentExtraction: 'content-extraction',
16
17
  Classification: 'classification',
17
- Extraction: 'extraction',
18
+ DataExtraction: 'data-extraction',
18
19
  Assignment: 'assignment',
19
20
  Validation: 'validation',
20
21
  });
@@ -75,8 +76,6 @@ __decorate([
75
76
  ], DocumentWorkflow.prototype, "completeUserId", void 0);
76
77
  DocumentWorkflow = __decorate([
77
78
  DocumentManagementTable({ name: 'workflow' }),
78
- Index(['documentId'], { unique: true, where: () => ({ state: { $neq: DocumentWorkflowState.Completed } }) }),
79
- ForeignKey(() => Document, ['tenantId', 'documentId'], ['tenantId', 'id']),
80
- Unique(['tenantId', 'id'])
79
+ Index(['documentId'], { unique: true, where: () => ({ state: { $neq: DocumentWorkflowState.Completed } }) })
81
80
  ], DocumentWorkflow);
82
81
  export { DocumentWorkflow };