@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.
- package/ai/genkit/tests/multi-region.test.js +6 -6
- package/ai/index.d.ts +2 -6
- package/ai/index.js +2 -6
- package/ai/parser/index.d.ts +1 -0
- package/ai/parser/index.js +1 -0
- package/ai/parser/parser.d.ts +12 -0
- package/ai/parser/parser.js +28 -0
- package/ai/prompts/build.d.ts +21 -0
- package/ai/prompts/build.js +25 -0
- package/ai/prompts/index.d.ts +2 -0
- package/ai/prompts/index.js +2 -0
- package/ai/prompts/instructions-formatter.d.ts +9 -22
- package/ai/prompts/instructions-formatter.js +20 -7
- package/ai/prompts/instructions.js +1 -1
- package/ai/prompts/steering.d.ts +27 -0
- package/ai/prompts/steering.js +54 -0
- package/ai/tests/instructions-formatter.test.js +115 -0
- package/ai/tests/steering.test.js +37 -0
- package/application/application.d.ts +2 -1
- package/application/application.js +3 -0
- package/authentication/client/module.d.ts +1 -1
- package/authentication/client/module.js +4 -5
- package/authentication/tests/authentication-ancillary.service.test.js +1 -1
- package/authentication/tests/authentication.api-controller.test.js +3 -1
- package/authentication/tests/authentication.api-request-token.provider.test.js +1 -1
- package/authentication/tests/authentication.client-service.test.js +1 -1
- package/authentication/tests/authentication.service.test.js +1 -1
- package/authentication/tests/subject.service.test.js +1 -1
- package/circuit-breaker/tests/circuit-breaker.test.js +1 -1
- package/document-management/api/document-management.api.d.ts +16 -16
- package/document-management/api/document-management.api.js +12 -12
- package/document-management/models/ai-configuration.d.ts +59 -0
- package/document-management/models/ai-configuration.js +1 -0
- package/document-management/models/document-assignment-scope.model.js +2 -4
- package/document-management/models/document-assignment-task.model.js +2 -4
- package/document-management/models/document-collection-assignment.model.js +2 -4
- package/document-management/models/document-collection.model.js +2 -3
- package/document-management/models/document-content.model.d.ts +6 -0
- package/document-management/models/document-content.model.js +32 -0
- package/document-management/models/document-property-value.model.js +1 -2
- package/document-management/models/document-request-collection-assignment.model.js +2 -4
- package/document-management/models/document-request.model.js +2 -4
- package/document-management/models/document-tag-assignment.model.js +2 -3
- package/document-management/models/document-validation-execution-related-document.model.js +2 -4
- package/document-management/models/document-validation-execution.model.js +2 -5
- package/document-management/models/document-workflow.model.d.ts +2 -1
- package/document-management/models/document-workflow.model.js +4 -5
- package/document-management/models/document.model.js +2 -3
- package/document-management/models/index.d.ts +2 -0
- package/document-management/models/index.js +2 -0
- package/document-management/server/api/document-management.api.d.ts +7 -7
- package/document-management/server/api/document-management.api.js +9 -9
- package/document-management/server/configure.d.ts +4 -1
- package/document-management/server/configure.js +9 -4
- package/document-management/server/drizzle/{0000_silly_chimera.sql → 0000_curious_nighthawk.sql} +8 -28
- package/document-management/server/drizzle/meta/0000_snapshot.json +14 -286
- package/document-management/server/drizzle/meta/_journal.json +2 -2
- package/document-management/server/module.d.ts +2 -0
- package/document-management/server/module.js +1 -0
- package/document-management/server/schemas.d.ts +2 -1
- package/document-management/server/services/document-file.service.d.ts +6 -6
- package/document-management/server/services/document-file.service.js +7 -81
- package/document-management/server/services/document-management-ai-provider.service.d.ts +66 -0
- package/document-management/server/services/document-management-ai-provider.service.js +2 -0
- package/document-management/server/services/document-management-ai.service.d.ts +44 -7
- package/document-management/server/services/document-management-ai.service.js +332 -329
- package/document-management/server/services/document-validation.service.d.ts +1 -1
- package/document-management/server/services/document-workflow.service.d.ts +4 -3
- package/document-management/server/services/document-workflow.service.js +26 -9
- package/document-management/server/services/document.service.d.ts +7 -3
- package/document-management/server/services/document.service.js +13 -4
- package/document-management/server/services/index.d.ts +1 -0
- package/document-management/server/services/index.js +1 -0
- package/document-management/server/validators/ai-validation-executor.d.ts +419 -12
- package/document-management/server/validators/ai-validation-executor.js +51 -46
- package/document-management/server/validators/single-document-validation-executor.d.ts +1 -3
- package/document-management/server/validators/single-document-validation-executor.js +2 -4
- package/document-management/service-models/document.service-model.d.ts +3 -3
- package/document-management/service-models/document.service-model.js +1 -1
- package/document-management/tests/ai-config-hierarchy.test.d.ts +1 -0
- package/document-management/tests/ai-config-hierarchy.test.js +64 -0
- package/document-management/tests/ai-config-integration.test.d.ts +1 -0
- package/document-management/tests/ai-config-integration.test.js +125 -0
- package/document-management/tests/ai-config-merge.test.d.ts +1 -0
- package/document-management/tests/ai-config-merge.test.js +38 -0
- package/document-management/tests/document-management-ai-overrides.test.d.ts +1 -0
- package/document-management/tests/document-management-ai-overrides.test.js +64 -0
- package/document-management/tests/document-management-core.test.js +6 -6
- package/document-management/tests/document-management.api.test.js +5 -5
- package/document-management/tests/document-statistics.service.test.js +10 -6
- package/document-management/tests/document-validation-ai-overrides.test.d.ts +1 -0
- package/document-management/tests/document-validation-ai-overrides.test.js +85 -0
- package/document-management/tests/document.service.test.js +15 -11
- package/document-management/tests/enum-helpers.test.js +5 -5
- package/examples/document-management/ai-provider.d.ts +20 -0
- package/examples/document-management/ai-provider.js +74 -0
- package/examples/document-management/main.js +9 -6
- package/examples/injector/graph-example.d.ts +1 -0
- package/examples/injector/graph-example.js +340 -0
- package/injector/decorators.d.ts +4 -4
- package/injector/decorators.js +5 -6
- package/injector/forward-ref.d.ts +15 -0
- package/injector/forward-ref.js +20 -0
- package/injector/graph.d.ts +113 -0
- package/injector/graph.js +631 -0
- package/injector/index.d.ts +2 -0
- package/injector/index.js +2 -0
- package/injector/inject.d.ts +15 -15
- package/injector/injector.d.ts +101 -13
- package/injector/injector.js +103 -59
- package/injector/resolve-chain.d.ts +20 -6
- package/injector/resolve-chain.js +39 -14
- package/injector/tests/advanced.test.d.ts +1 -0
- package/injector/tests/advanced.test.js +116 -0
- package/injector/tests/async-init.test.d.ts +1 -0
- package/injector/tests/async-init.test.js +77 -0
- package/injector/tests/basic.test.d.ts +1 -0
- package/injector/tests/basic.test.js +114 -0
- package/injector/tests/hierarchical.test.d.ts +1 -0
- package/injector/tests/hierarchical.test.js +59 -0
- package/injector/tests/lifecycles.test.d.ts +1 -0
- package/injector/tests/lifecycles.test.js +109 -0
- package/injector/token.d.ts +2 -1
- package/injector/token.js +4 -1
- package/injector/type-info.d.ts +1 -5
- package/injector/types.d.ts +4 -10
- package/logger/tests/pretty-print.test.d.ts +1 -0
- package/logger/{formatters → tests}/pretty-print.test.js +1 -1
- package/logger/transports/console.d.ts +3 -2
- package/logger/transports/console.js +4 -3
- package/notification/api/notification.api.d.ts +26 -6
- package/notification/api/notification.api.js +15 -4
- package/notification/client/notification-client.d.ts +6 -0
- package/notification/client/notification-client.js +13 -3
- package/notification/models/in-app-notification.model.d.ts +9 -3
- package/notification/models/in-app-notification.model.js +32 -11
- package/notification/models/notification-log.model.js +2 -3
- package/notification/server/api/notification.api-controller.d.ts +1 -0
- package/notification/server/api/notification.api-controller.js +7 -1
- package/notification/server/drizzle/{0000_oval_rage.sql → 0000_wise_pyro.sql} +22 -4
- package/notification/server/drizzle/meta/0000_snapshot.json +249 -37
- package/notification/server/drizzle/meta/_journal.json +2 -2
- package/notification/server/module.d.ts +5 -0
- package/notification/server/module.js +6 -1
- package/notification/server/providers/in-app-channel-provider.js +1 -0
- package/notification/server/schemas.d.ts +3 -2
- package/notification/server/schemas.js +3 -2
- package/notification/server/services/notification.service.d.ts +11 -6
- package/notification/server/services/notification.service.js +138 -42
- package/notification/tests/notification-api.test.js +16 -6
- package/notification/tests/notification-client.test.d.ts +1 -0
- package/notification/tests/{unit/notification-client.test.js → notification-client.test.js} +5 -5
- package/notification/tests/notification-flow.test.js +45 -7
- package/notification/tests/notification-sse.service.test.js +1 -1
- package/notification/tests/notification-type.service.test.js +1 -1
- package/object-storage/s3/s3.object-storage.js +3 -0
- package/object-storage/s3/tests/s3.object-storage.integration.test.js +1 -1
- package/orm/server/drizzle/schema-converter.js +5 -3
- package/orm/tests/repository-attributes.test.js +10 -17
- package/orm/tests/repository-cti-mapping.test.js +2 -2
- package/orm/tests/repository-cti-soft-delete.test.js +1 -1
- package/orm/tests/repository-cti.test.js +19 -33
- package/orm/tests/repository-extra-coverage.test.js +1 -1
- package/orm/tests/repository-search.test.js +5 -2
- package/orm/tests/schema-converter.test.js +1 -0
- package/orm/tests/transaction-safety.test.js +1 -1
- package/package.json +7 -9
- package/rate-limit/tests/postgres-rate-limiter.test.js +6 -16
- package/renderer/d2.d.ts +77 -0
- package/renderer/d2.js +68 -0
- package/renderer/graphviz.d.ts +47 -0
- package/renderer/graphviz.js +58 -0
- package/renderer/index.d.ts +4 -0
- package/renderer/index.js +4 -0
- package/renderer/typst.d.ts +57 -0
- package/renderer/typst.js +62 -0
- package/rpc/adapters/readable-stream.adapter.d.ts +3 -0
- package/rpc/adapters/readable-stream.adapter.js +5 -1
- package/rpc/rpc.js +28 -3
- package/rpc/tests/rpc.integration.test.js +3 -1
- package/schema/schemas/nullable.js +1 -1
- package/task-queue/task-queue.d.ts +2 -0
- package/task-queue/task-queue.js +6 -2
- package/task-queue/tests/complex.test.js +1 -1
- package/task-queue/tests/dependencies.test.js +3 -3
- package/task-queue/tests/extensive-dependencies.test.js +1 -1
- package/task-queue/tests/queue.test.js +1 -1
- package/task-queue/tests/worker.test.js +4 -7
- package/test5.js +52 -8
- package/{unit-test → testing}/integration-setup.d.ts +1 -0
- package/{unit-test → testing}/integration-setup.js +13 -0
- package/utils/base64.d.ts +7 -0
- package/utils/base64.js +10 -1
- package/utils/noop.d.ts +7 -1
- package/utils/noop.js +7 -1
- package/ai/ai-file.service.d.ts +0 -57
- package/ai/ai-file.service.js +0 -233
- package/ai/ai-session.d.ts +0 -38
- package/ai/ai-session.js +0 -50
- package/ai/ai.service.d.ts +0 -126
- package/ai/ai.service.js +0 -481
- package/ai/functions.d.ts +0 -9
- package/ai/functions.js +0 -38
- package/ai/module.d.ts +0 -26
- package/ai/module.js +0 -25
- package/ai/types.d.ts +0 -229
- package/ai/types.js +0 -33
- package/latex/index.d.ts +0 -1
- package/latex/index.js +0 -1
- package/typst/index.d.ts +0 -1
- package/typst/index.js +0 -1
- package/typst/render.d.ts +0 -23
- package/typst/render.js +0 -32
- /package/{logger/formatters/pretty-print.test.d.ts → ai/tests/instructions-formatter.test.d.ts} +0 -0
- /package/{notification/tests/unit/notification-client.test.d.ts → ai/tests/steering.test.d.ts} +0 -0
- /package/{latex/render.d.ts → renderer/latex.d.ts} +0 -0
- /package/{latex/render.js → renderer/latex.js} +0 -0
- /package/{unit-test → testing}/index.d.ts +0 -0
- /package/{unit-test → testing}/index.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "aea0fdc2-b60d-421c-b0e5-781cc7bff495",
|
|
3
3
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
4
|
"version": "7",
|
|
5
5
|
"dialect": "postgresql",
|
|
@@ -154,16 +154,7 @@
|
|
|
154
154
|
]
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
|
-
"uniqueConstraints": {
|
|
158
|
-
"document_tenant_id_id_unique": {
|
|
159
|
-
"name": "document_tenant_id_id_unique",
|
|
160
|
-
"nullsNotDistinct": false,
|
|
161
|
-
"columns": [
|
|
162
|
-
"tenant_id",
|
|
163
|
-
"id"
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
},
|
|
157
|
+
"uniqueConstraints": {},
|
|
167
158
|
"policies": {},
|
|
168
159
|
"checkConstraints": {},
|
|
169
160
|
"isRLSEnabled": false
|
|
@@ -262,38 +253,6 @@
|
|
|
262
253
|
],
|
|
263
254
|
"onDelete": "no action",
|
|
264
255
|
"onUpdate": "no action"
|
|
265
|
-
},
|
|
266
|
-
"assignment_scope_tenantId_collectionId_collection_fkey": {
|
|
267
|
-
"name": "assignment_scope_tenantId_collectionId_collection_fkey",
|
|
268
|
-
"tableFrom": "assignment_scope",
|
|
269
|
-
"tableTo": "collection",
|
|
270
|
-
"schemaTo": "document_management",
|
|
271
|
-
"columnsFrom": [
|
|
272
|
-
"tenant_id",
|
|
273
|
-
"collection_id"
|
|
274
|
-
],
|
|
275
|
-
"columnsTo": [
|
|
276
|
-
"tenant_id",
|
|
277
|
-
"id"
|
|
278
|
-
],
|
|
279
|
-
"onDelete": "no action",
|
|
280
|
-
"onUpdate": "no action"
|
|
281
|
-
},
|
|
282
|
-
"assignment_scope_tenantId_taskId_assignment_task_fkey": {
|
|
283
|
-
"name": "assignment_scope_tenantId_taskId_assignment_task_fkey",
|
|
284
|
-
"tableFrom": "assignment_scope",
|
|
285
|
-
"tableTo": "assignment_task",
|
|
286
|
-
"schemaTo": "document_management",
|
|
287
|
-
"columnsFrom": [
|
|
288
|
-
"tenant_id",
|
|
289
|
-
"task_id"
|
|
290
|
-
],
|
|
291
|
-
"columnsTo": [
|
|
292
|
-
"tenant_id",
|
|
293
|
-
"id"
|
|
294
|
-
],
|
|
295
|
-
"onDelete": "no action",
|
|
296
|
-
"onUpdate": "no action"
|
|
297
256
|
}
|
|
298
257
|
},
|
|
299
258
|
"compositePrimaryKeys": {
|
|
@@ -398,22 +357,6 @@
|
|
|
398
357
|
],
|
|
399
358
|
"onDelete": "no action",
|
|
400
359
|
"onUpdate": "no action"
|
|
401
|
-
},
|
|
402
|
-
"assignment_task_tenantId_documentId_document_fkey": {
|
|
403
|
-
"name": "assignment_task_tenantId_documentId_document_fkey",
|
|
404
|
-
"tableFrom": "assignment_task",
|
|
405
|
-
"tableTo": "document",
|
|
406
|
-
"schemaTo": "document_management",
|
|
407
|
-
"columnsFrom": [
|
|
408
|
-
"tenant_id",
|
|
409
|
-
"document_id"
|
|
410
|
-
],
|
|
411
|
-
"columnsTo": [
|
|
412
|
-
"tenant_id",
|
|
413
|
-
"id"
|
|
414
|
-
],
|
|
415
|
-
"onDelete": "no action",
|
|
416
|
-
"onUpdate": "no action"
|
|
417
360
|
}
|
|
418
361
|
},
|
|
419
362
|
"compositePrimaryKeys": {
|
|
@@ -426,19 +369,12 @@
|
|
|
426
369
|
}
|
|
427
370
|
},
|
|
428
371
|
"uniqueConstraints": {
|
|
429
|
-
"
|
|
430
|
-
"name": "
|
|
431
|
-
"nullsNotDistinct": false,
|
|
432
|
-
"columns": [
|
|
433
|
-
"document_id"
|
|
434
|
-
]
|
|
435
|
-
},
|
|
436
|
-
"assignment_task_tenant_id_id_unique": {
|
|
437
|
-
"name": "assignment_task_tenant_id_id_unique",
|
|
372
|
+
"assignment_task_tenant_id_document_id_unique": {
|
|
373
|
+
"name": "assignment_task_tenant_id_document_id_unique",
|
|
438
374
|
"nullsNotDistinct": false,
|
|
439
375
|
"columns": [
|
|
440
376
|
"tenant_id",
|
|
441
|
-
"
|
|
377
|
+
"document_id"
|
|
442
378
|
]
|
|
443
379
|
}
|
|
444
380
|
},
|
|
@@ -647,16 +583,7 @@
|
|
|
647
583
|
]
|
|
648
584
|
}
|
|
649
585
|
},
|
|
650
|
-
"uniqueConstraints": {
|
|
651
|
-
"collection_tenant_id_id_unique": {
|
|
652
|
-
"name": "collection_tenant_id_id_unique",
|
|
653
|
-
"nullsNotDistinct": false,
|
|
654
|
-
"columns": [
|
|
655
|
-
"tenant_id",
|
|
656
|
-
"id"
|
|
657
|
-
]
|
|
658
|
-
}
|
|
659
|
-
},
|
|
586
|
+
"uniqueConstraints": {},
|
|
660
587
|
"policies": {},
|
|
661
588
|
"checkConstraints": {},
|
|
662
589
|
"isRLSEnabled": false
|
|
@@ -777,38 +704,6 @@
|
|
|
777
704
|
],
|
|
778
705
|
"onDelete": "no action",
|
|
779
706
|
"onUpdate": "no action"
|
|
780
|
-
},
|
|
781
|
-
"collection_assignment_tenantId_documentId_document_fkey": {
|
|
782
|
-
"name": "collection_assignment_tenantId_documentId_document_fkey",
|
|
783
|
-
"tableFrom": "collection_assignment",
|
|
784
|
-
"tableTo": "document",
|
|
785
|
-
"schemaTo": "document_management",
|
|
786
|
-
"columnsFrom": [
|
|
787
|
-
"tenant_id",
|
|
788
|
-
"document_id"
|
|
789
|
-
],
|
|
790
|
-
"columnsTo": [
|
|
791
|
-
"tenant_id",
|
|
792
|
-
"id"
|
|
793
|
-
],
|
|
794
|
-
"onDelete": "no action",
|
|
795
|
-
"onUpdate": "no action"
|
|
796
|
-
},
|
|
797
|
-
"collection_assignment_tenantId_collectionId_collection_fkey": {
|
|
798
|
-
"name": "collection_assignment_tenantId_collectionId_collection_fkey",
|
|
799
|
-
"tableFrom": "collection_assignment",
|
|
800
|
-
"tableTo": "collection",
|
|
801
|
-
"schemaTo": "document_management",
|
|
802
|
-
"columnsFrom": [
|
|
803
|
-
"tenant_id",
|
|
804
|
-
"collection_id"
|
|
805
|
-
],
|
|
806
|
-
"columnsTo": [
|
|
807
|
-
"tenant_id",
|
|
808
|
-
"id"
|
|
809
|
-
],
|
|
810
|
-
"onDelete": "no action",
|
|
811
|
-
"onUpdate": "no action"
|
|
812
707
|
}
|
|
813
708
|
},
|
|
814
709
|
"compositePrimaryKeys": {
|
|
@@ -1060,22 +955,6 @@
|
|
|
1060
955
|
],
|
|
1061
956
|
"onDelete": "no action",
|
|
1062
957
|
"onUpdate": "no action"
|
|
1063
|
-
},
|
|
1064
|
-
"property_value_tenantId_documentId_document_fkey": {
|
|
1065
|
-
"name": "property_value_tenantId_documentId_document_fkey",
|
|
1066
|
-
"tableFrom": "property_value",
|
|
1067
|
-
"tableTo": "document",
|
|
1068
|
-
"schemaTo": "document_management",
|
|
1069
|
-
"columnsFrom": [
|
|
1070
|
-
"tenant_id",
|
|
1071
|
-
"document_id"
|
|
1072
|
-
],
|
|
1073
|
-
"columnsTo": [
|
|
1074
|
-
"tenant_id",
|
|
1075
|
-
"id"
|
|
1076
|
-
],
|
|
1077
|
-
"onDelete": "no action",
|
|
1078
|
-
"onUpdate": "no action"
|
|
1079
958
|
}
|
|
1080
959
|
},
|
|
1081
960
|
"compositePrimaryKeys": {
|
|
@@ -1245,22 +1124,6 @@
|
|
|
1245
1124
|
],
|
|
1246
1125
|
"onDelete": "no action",
|
|
1247
1126
|
"onUpdate": "no action"
|
|
1248
|
-
},
|
|
1249
|
-
"request_tenantId_documentId_document_fkey": {
|
|
1250
|
-
"name": "request_tenantId_documentId_document_fkey",
|
|
1251
|
-
"tableFrom": "request",
|
|
1252
|
-
"tableTo": "document",
|
|
1253
|
-
"schemaTo": "document_management",
|
|
1254
|
-
"columnsFrom": [
|
|
1255
|
-
"tenant_id",
|
|
1256
|
-
"document_id"
|
|
1257
|
-
],
|
|
1258
|
-
"columnsTo": [
|
|
1259
|
-
"tenant_id",
|
|
1260
|
-
"id"
|
|
1261
|
-
],
|
|
1262
|
-
"onDelete": "no action",
|
|
1263
|
-
"onUpdate": "no action"
|
|
1264
1127
|
}
|
|
1265
1128
|
},
|
|
1266
1129
|
"compositePrimaryKeys": {
|
|
@@ -1273,19 +1136,12 @@
|
|
|
1273
1136
|
}
|
|
1274
1137
|
},
|
|
1275
1138
|
"uniqueConstraints": {
|
|
1276
|
-
"
|
|
1277
|
-
"name": "
|
|
1278
|
-
"nullsNotDistinct": false,
|
|
1279
|
-
"columns": [
|
|
1280
|
-
"document_id"
|
|
1281
|
-
]
|
|
1282
|
-
},
|
|
1283
|
-
"request_tenant_id_id_unique": {
|
|
1284
|
-
"name": "request_tenant_id_id_unique",
|
|
1139
|
+
"request_tenant_id_document_id_unique": {
|
|
1140
|
+
"name": "request_tenant_id_document_id_unique",
|
|
1285
1141
|
"nullsNotDistinct": false,
|
|
1286
1142
|
"columns": [
|
|
1287
1143
|
"tenant_id",
|
|
1288
|
-
"
|
|
1144
|
+
"document_id"
|
|
1289
1145
|
]
|
|
1290
1146
|
}
|
|
1291
1147
|
},
|
|
@@ -1403,38 +1259,6 @@
|
|
|
1403
1259
|
],
|
|
1404
1260
|
"onDelete": "no action",
|
|
1405
1261
|
"onUpdate": "no action"
|
|
1406
|
-
},
|
|
1407
|
-
"rca_tenantId_collectionId_c_fkey": {
|
|
1408
|
-
"name": "rca_tenantId_collectionId_c_fkey",
|
|
1409
|
-
"tableFrom": "request_collection_assignment",
|
|
1410
|
-
"tableTo": "collection",
|
|
1411
|
-
"schemaTo": "document_management",
|
|
1412
|
-
"columnsFrom": [
|
|
1413
|
-
"tenant_id",
|
|
1414
|
-
"collection_id"
|
|
1415
|
-
],
|
|
1416
|
-
"columnsTo": [
|
|
1417
|
-
"tenant_id",
|
|
1418
|
-
"id"
|
|
1419
|
-
],
|
|
1420
|
-
"onDelete": "no action",
|
|
1421
|
-
"onUpdate": "no action"
|
|
1422
|
-
},
|
|
1423
|
-
"request_collection_assignment_tenantId_requestId_request_fkey": {
|
|
1424
|
-
"name": "request_collection_assignment_tenantId_requestId_request_fkey",
|
|
1425
|
-
"tableFrom": "request_collection_assignment",
|
|
1426
|
-
"tableTo": "request",
|
|
1427
|
-
"schemaTo": "document_management",
|
|
1428
|
-
"columnsFrom": [
|
|
1429
|
-
"tenant_id",
|
|
1430
|
-
"request_id"
|
|
1431
|
-
],
|
|
1432
|
-
"columnsTo": [
|
|
1433
|
-
"tenant_id",
|
|
1434
|
-
"id"
|
|
1435
|
-
],
|
|
1436
|
-
"onDelete": "no action",
|
|
1437
|
-
"onUpdate": "no action"
|
|
1438
1262
|
}
|
|
1439
1263
|
},
|
|
1440
1264
|
"compositePrimaryKeys": {
|
|
@@ -1828,22 +1652,6 @@
|
|
|
1828
1652
|
],
|
|
1829
1653
|
"onDelete": "no action",
|
|
1830
1654
|
"onUpdate": "no action"
|
|
1831
|
-
},
|
|
1832
|
-
"tag_assignment_tenantId_documentId_document_fkey": {
|
|
1833
|
-
"name": "tag_assignment_tenantId_documentId_document_fkey",
|
|
1834
|
-
"tableFrom": "tag_assignment",
|
|
1835
|
-
"tableTo": "document",
|
|
1836
|
-
"schemaTo": "document_management",
|
|
1837
|
-
"columnsFrom": [
|
|
1838
|
-
"tenant_id",
|
|
1839
|
-
"document_id"
|
|
1840
|
-
],
|
|
1841
|
-
"columnsTo": [
|
|
1842
|
-
"tenant_id",
|
|
1843
|
-
"id"
|
|
1844
|
-
],
|
|
1845
|
-
"onDelete": "no action",
|
|
1846
|
-
"onUpdate": "no action"
|
|
1847
1655
|
}
|
|
1848
1656
|
},
|
|
1849
1657
|
"compositePrimaryKeys": {
|
|
@@ -2459,22 +2267,6 @@
|
|
|
2459
2267
|
],
|
|
2460
2268
|
"onDelete": "no action",
|
|
2461
2269
|
"onUpdate": "no action"
|
|
2462
|
-
},
|
|
2463
|
-
"validation_execution_tenantId_workflowId_workflow_fkey": {
|
|
2464
|
-
"name": "validation_execution_tenantId_workflowId_workflow_fkey",
|
|
2465
|
-
"tableFrom": "validation_execution",
|
|
2466
|
-
"tableTo": "workflow",
|
|
2467
|
-
"schemaTo": "document_management",
|
|
2468
|
-
"columnsFrom": [
|
|
2469
|
-
"tenant_id",
|
|
2470
|
-
"workflow_id"
|
|
2471
|
-
],
|
|
2472
|
-
"columnsTo": [
|
|
2473
|
-
"tenant_id",
|
|
2474
|
-
"id"
|
|
2475
|
-
],
|
|
2476
|
-
"onDelete": "no action",
|
|
2477
|
-
"onUpdate": "no action"
|
|
2478
2270
|
}
|
|
2479
2271
|
},
|
|
2480
2272
|
"compositePrimaryKeys": {
|
|
@@ -2495,14 +2287,6 @@
|
|
|
2495
2287
|
"workflow_id",
|
|
2496
2288
|
"definition_id"
|
|
2497
2289
|
]
|
|
2498
|
-
},
|
|
2499
|
-
"validation_execution_tenant_id_id_unique": {
|
|
2500
|
-
"name": "validation_execution_tenant_id_id_unique",
|
|
2501
|
-
"nullsNotDistinct": false,
|
|
2502
|
-
"columns": [
|
|
2503
|
-
"tenant_id",
|
|
2504
|
-
"id"
|
|
2505
|
-
]
|
|
2506
2290
|
}
|
|
2507
2291
|
},
|
|
2508
2292
|
"policies": {},
|
|
@@ -2603,38 +2387,6 @@
|
|
|
2603
2387
|
],
|
|
2604
2388
|
"onDelete": "no action",
|
|
2605
2389
|
"onUpdate": "no action"
|
|
2606
|
-
},
|
|
2607
|
-
"verd_tenantId_documentId_d_fkey": {
|
|
2608
|
-
"name": "verd_tenantId_documentId_d_fkey",
|
|
2609
|
-
"tableFrom": "validation_execution_related_document",
|
|
2610
|
-
"tableTo": "document",
|
|
2611
|
-
"schemaTo": "document_management",
|
|
2612
|
-
"columnsFrom": [
|
|
2613
|
-
"tenant_id",
|
|
2614
|
-
"document_id"
|
|
2615
|
-
],
|
|
2616
|
-
"columnsTo": [
|
|
2617
|
-
"tenant_id",
|
|
2618
|
-
"id"
|
|
2619
|
-
],
|
|
2620
|
-
"onDelete": "no action",
|
|
2621
|
-
"onUpdate": "no action"
|
|
2622
|
-
},
|
|
2623
|
-
"verd_tenantId_executionId_ve_fkey": {
|
|
2624
|
-
"name": "verd_tenantId_executionId_ve_fkey",
|
|
2625
|
-
"tableFrom": "validation_execution_related_document",
|
|
2626
|
-
"tableTo": "validation_execution",
|
|
2627
|
-
"schemaTo": "document_management",
|
|
2628
|
-
"columnsFrom": [
|
|
2629
|
-
"tenant_id",
|
|
2630
|
-
"execution_id"
|
|
2631
|
-
],
|
|
2632
|
-
"columnsTo": [
|
|
2633
|
-
"tenant_id",
|
|
2634
|
-
"id"
|
|
2635
|
-
],
|
|
2636
|
-
"onDelete": "no action",
|
|
2637
|
-
"onUpdate": "no action"
|
|
2638
2390
|
}
|
|
2639
2391
|
},
|
|
2640
2392
|
"compositePrimaryKeys": {
|
|
@@ -2756,8 +2508,8 @@
|
|
|
2756
2508
|
}
|
|
2757
2509
|
},
|
|
2758
2510
|
"indexes": {
|
|
2759
|
-
"
|
|
2760
|
-
"name": "
|
|
2511
|
+
"workflow_document_id_partial_idx": {
|
|
2512
|
+
"name": "workflow_document_id_partial_idx",
|
|
2761
2513
|
"columns": [
|
|
2762
2514
|
{
|
|
2763
2515
|
"expression": "document_id",
|
|
@@ -2789,22 +2541,6 @@
|
|
|
2789
2541
|
],
|
|
2790
2542
|
"onDelete": "no action",
|
|
2791
2543
|
"onUpdate": "no action"
|
|
2792
|
-
},
|
|
2793
|
-
"workflow_tenantId_documentId_document_fkey": {
|
|
2794
|
-
"name": "workflow_tenantId_documentId_document_fkey",
|
|
2795
|
-
"tableFrom": "workflow",
|
|
2796
|
-
"tableTo": "document",
|
|
2797
|
-
"schemaTo": "document_management",
|
|
2798
|
-
"columnsFrom": [
|
|
2799
|
-
"tenant_id",
|
|
2800
|
-
"document_id"
|
|
2801
|
-
],
|
|
2802
|
-
"columnsTo": [
|
|
2803
|
-
"tenant_id",
|
|
2804
|
-
"id"
|
|
2805
|
-
],
|
|
2806
|
-
"onDelete": "no action",
|
|
2807
|
-
"onUpdate": "no action"
|
|
2808
2544
|
}
|
|
2809
2545
|
},
|
|
2810
2546
|
"compositePrimaryKeys": {
|
|
@@ -2816,16 +2552,7 @@
|
|
|
2816
2552
|
]
|
|
2817
2553
|
}
|
|
2818
2554
|
},
|
|
2819
|
-
"uniqueConstraints": {
|
|
2820
|
-
"workflow_tenant_id_id_unique": {
|
|
2821
|
-
"name": "workflow_tenant_id_id_unique",
|
|
2822
|
-
"nullsNotDistinct": false,
|
|
2823
|
-
"columns": [
|
|
2824
|
-
"tenant_id",
|
|
2825
|
-
"id"
|
|
2826
|
-
]
|
|
2827
|
-
}
|
|
2828
|
-
},
|
|
2555
|
+
"uniqueConstraints": {},
|
|
2829
2556
|
"policies": {},
|
|
2830
2557
|
"checkConstraints": {},
|
|
2831
2558
|
"isRLSEnabled": false
|
|
@@ -2912,8 +2639,9 @@
|
|
|
2912
2639
|
"name": "workflow_step",
|
|
2913
2640
|
"schema": "document_management",
|
|
2914
2641
|
"values": [
|
|
2642
|
+
"content-extraction",
|
|
2915
2643
|
"classification",
|
|
2916
|
-
"extraction",
|
|
2644
|
+
"data-extraction",
|
|
2917
2645
|
"assignment",
|
|
2918
2646
|
"validation"
|
|
2919
2647
|
]
|
|
@@ -2,10 +2,12 @@ import './schemas.js';
|
|
|
2
2
|
import { type InjectionToken } from '../../injector/index.js';
|
|
3
3
|
import { type DatabaseConfig } from '../../orm/server/index.js';
|
|
4
4
|
import type { DocumentManagementAuthorizationService } from '../authorization/document-management-authorization.service.js';
|
|
5
|
+
import type { DocumentManagementAiProviderService } from './services/document-management-ai-provider.service.js';
|
|
5
6
|
import type { DocumentManagementAncillaryService } from './services/document-management-ancillary.service.js';
|
|
6
7
|
export declare class DocumentManagementConfiguration {
|
|
7
8
|
ancillaryService: InjectionToken<DocumentManagementAncillaryService>;
|
|
8
9
|
authorizationService: InjectionToken<DocumentManagementAuthorizationService>;
|
|
10
|
+
aiProvider?: InjectionToken<DocumentManagementAiProviderService>;
|
|
9
11
|
fileObjectStorageModule: string;
|
|
10
12
|
fileUploadObjectStorageModule: string;
|
|
11
13
|
filePreviewObjectStorageModule: string;
|
|
@@ -45,8 +45,9 @@ export declare const documentWorkflowState: import("../../orm/enums.js").PgEnumF
|
|
|
45
45
|
readonly Failed: "failed";
|
|
46
46
|
}>;
|
|
47
47
|
export declare const documentWorkflowStep: import("../../orm/enums.js").PgEnumFromEnumeration<{
|
|
48
|
+
readonly ContentExtraction: "content-extraction";
|
|
48
49
|
readonly Classification: "classification";
|
|
49
|
-
readonly
|
|
50
|
+
readonly DataExtraction: "data-extraction";
|
|
50
51
|
readonly Assignment: "assignment";
|
|
51
52
|
readonly Validation: "validation";
|
|
52
53
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Part } from 'genkit';
|
|
2
2
|
import { Transactional } from '../../../orm/server/index.js';
|
|
3
3
|
import { Document } from '../../models/index.js';
|
|
4
4
|
export type DocumentFileMetadata = {
|
|
@@ -26,15 +26,15 @@ export declare class DocumentFileService extends Transactional {
|
|
|
26
26
|
uploadId: string;
|
|
27
27
|
uploadKey: string;
|
|
28
28
|
}): Promise<[DocumentFileMetadata, Uint8Array<ArrayBuffer>]>;
|
|
29
|
-
getContent(document: Document): Promise<Uint8Array
|
|
30
|
-
getContentStream(document: Document): ReadableStream<Uint8Array
|
|
29
|
+
getContent(document: Document): Promise<Uint8Array<ArrayBuffer>>;
|
|
30
|
+
getContentStream(document: Document): ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
31
31
|
getContentUrl(document: Document, download?: boolean): Promise<string>;
|
|
32
32
|
/** Gets the underlying object storage object for the document file */
|
|
33
33
|
getObject(document: Document): Promise<import("../../../object-storage/index.js").ObjectStorageObject>;
|
|
34
|
-
getPreview(document: Document, page?: number): Promise<Uint8Array
|
|
35
|
-
getPreviewStream(document: Document, page?: number): ReadableStream<Uint8Array
|
|
34
|
+
getPreview(document: Document, page?: number): Promise<Uint8Array<ArrayBuffer>>;
|
|
35
|
+
getPreviewStream(document: Document, page?: number): ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
36
36
|
getPreviewUrl(document: Document, page?: number): Promise<string>;
|
|
37
|
-
getAiFileContentPart(document: Document): Promise<
|
|
37
|
+
getAiFileContentPart(document: Document): Promise<Part>;
|
|
38
38
|
private createPreviewIfNotExists;
|
|
39
39
|
private getDocumentFileContentObjectUrl;
|
|
40
40
|
}
|
|
@@ -4,86 +4,33 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
8
|
-
if (value !== null && value !== void 0) {
|
|
9
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
10
|
-
var dispose, inner;
|
|
11
|
-
if (async) {
|
|
12
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
13
|
-
dispose = value[Symbol.asyncDispose];
|
|
14
|
-
}
|
|
15
|
-
if (dispose === void 0) {
|
|
16
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
17
|
-
dispose = value[Symbol.dispose];
|
|
18
|
-
if (async) inner = dispose;
|
|
19
|
-
}
|
|
20
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
21
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
22
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
23
|
-
}
|
|
24
|
-
else if (async) {
|
|
25
|
-
env.stack.push({ async: true });
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
};
|
|
29
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
30
|
-
return function (env) {
|
|
31
|
-
function fail(e) {
|
|
32
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
33
|
-
env.hasError = true;
|
|
34
|
-
}
|
|
35
|
-
var r, s = 0;
|
|
36
|
-
function next() {
|
|
37
|
-
while (r = env.stack.pop()) {
|
|
38
|
-
try {
|
|
39
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
40
|
-
if (r.dispose) {
|
|
41
|
-
var result = r.dispose.call(r.value);
|
|
42
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
43
|
-
}
|
|
44
|
-
else s |= 1;
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
fail(e);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
51
|
-
if (env.hasError) throw env.error;
|
|
52
|
-
}
|
|
53
|
-
return next();
|
|
54
|
-
};
|
|
55
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
56
|
-
var e = new Error(message);
|
|
57
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
58
|
-
});
|
|
59
7
|
import sharp, {} from 'sharp';
|
|
60
8
|
import { match } from 'ts-pattern';
|
|
61
|
-
import {
|
|
9
|
+
import { injectGenkit } from '../../../ai/genkit/index.js';
|
|
62
10
|
import { ForbiddenError } from '../../../errors/forbidden.error.js';
|
|
63
11
|
import { NotImplementedError } from '../../../errors/not-implemented.error.js';
|
|
64
12
|
import { getMimeType, getMimeTypeExtensions, mimeTypes } from '../../../file/index.js';
|
|
65
|
-
import { TemporaryFile } from '../../../file/server/index.js';
|
|
66
13
|
import { inject } from '../../../injector/inject.js';
|
|
67
14
|
import { ObjectStorage } from '../../../object-storage/index.js';
|
|
68
15
|
import { Transactional } from '../../../orm/server/index.js';
|
|
69
16
|
import { pdfToImage } from '../../../pdf/index.js';
|
|
70
17
|
import { Alphabet } from '../../../utils/alphabet.js';
|
|
18
|
+
import { encodeDataUrl } from '../../../utils/base64.js';
|
|
71
19
|
import { digest } from '../../../utils/cryptography.js';
|
|
72
20
|
import { currentTimestamp } from '../../../utils/date-time.js';
|
|
73
21
|
import { getRandomString } from '../../../utils/random.js';
|
|
74
22
|
import { readableStreamFromPromise, readBinaryStream } from '../../../utils/stream/index.js';
|
|
75
|
-
import {
|
|
23
|
+
import { isNotReadableStream, isNotUint8Array, isUint8Array } from '../../../utils/type-guards.js';
|
|
76
24
|
import { millisecondsPerMinute } from '../../../utils/units.js';
|
|
77
25
|
import { Document } from '../../models/index.js';
|
|
78
26
|
import { DocumentManagementConfiguration } from '../module.js';
|
|
79
27
|
import { DocumentManagementSingleton } from './singleton.js';
|
|
80
28
|
let DocumentFileService = class DocumentFileService extends Transactional {
|
|
81
29
|
#configuration = inject(DocumentManagementConfiguration);
|
|
82
|
-
#
|
|
30
|
+
#genkit = injectGenkit();
|
|
83
31
|
#fileObjectStorage = inject(ObjectStorage, this.#configuration.fileObjectStorageModule);
|
|
84
32
|
#filePreviewObjectStorage = inject(ObjectStorage, this.#configuration.filePreviewObjectStorageModule);
|
|
85
33
|
#fileUploadObjectStorage = inject(ObjectStorage, { module: this.#configuration.fileUploadObjectStorageModule /* , configuration: { lifecycle: { expiration: { after: 5 * secondsPerMinute } } } */ });
|
|
86
|
-
#aiFilePartCache = new Map();
|
|
87
34
|
/**
|
|
88
35
|
* Initiates a file upload
|
|
89
36
|
* @param key - key which can be used to authorize the creation of the file. Same key must be provided to {@link store} method, or it will throw an error.
|
|
@@ -166,30 +113,9 @@ let DocumentFileService = class DocumentFileService extends Transactional {
|
|
|
166
113
|
});
|
|
167
114
|
}
|
|
168
115
|
async getAiFileContentPart(document) {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (isDefined(cachedAiFilePart)) {
|
|
173
|
-
if (cachedAiFilePart.timestamp > (currentTimestamp() - (5 * millisecondsPerMinute))) {
|
|
174
|
-
return cachedAiFilePart.part;
|
|
175
|
-
}
|
|
176
|
-
this.#aiFilePartCache.delete(document.id);
|
|
177
|
-
}
|
|
178
|
-
const fileContentStream = this.getContentStream(document);
|
|
179
|
-
const tmpFile = __addDisposableResource(env_1, await TemporaryFile.from(fileContentStream), true);
|
|
180
|
-
const filePart = await this.#aiService.processFile({ path: tmpFile.path, mimeType: document.mimeType });
|
|
181
|
-
this.#aiFilePartCache.set(document.id, { part: filePart, timestamp: currentTimestamp() });
|
|
182
|
-
return filePart;
|
|
183
|
-
}
|
|
184
|
-
catch (e_1) {
|
|
185
|
-
env_1.error = e_1;
|
|
186
|
-
env_1.hasError = true;
|
|
187
|
-
}
|
|
188
|
-
finally {
|
|
189
|
-
const result_1 = __disposeResources(env_1);
|
|
190
|
-
if (result_1)
|
|
191
|
-
await result_1;
|
|
192
|
-
}
|
|
116
|
+
const fileContent = await this.getContent(document);
|
|
117
|
+
const url = encodeDataUrl(document.mimeType, fileContent);
|
|
118
|
+
return { media: { url } };
|
|
193
119
|
}
|
|
194
120
|
async createPreviewIfNotExists(document, page = 1) {
|
|
195
121
|
const key = getObjectKey(document.id);
|