Class: DocumentApplicationService
Defined in: application/services/core/DocumentService.ts:18
Document operations on the current workspace. Each call loads the workspace through the container's workspace service and works on the Workspace entity; validation and export calls go to the container's validation and export services. The workspaceId arguments are currently ignored.
Constructors
Constructor
new DocumentApplicationService(container): DocumentApplicationService;Defined in: application/services/core/DocumentService.ts:22
Parameters
| Parameter | Type | Description |
|---|---|---|
container | ServiceContainer | Service container providing the workspace storage service. |
Returns
DocumentApplicationService
Methods
createDocument()
createDocument(
_workspaceId,
profileId,
folderId?,
initialData?
): Promise<Document>;Defined in: application/services/core/DocumentService.ts:39
Create a new document from a profile US-DOC-001: Create Document from Profile Delegates to Workspace aggregate root New documents are pre-populated with skeleton data from profile
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
profileId | string |
folderId? | string |
initialData? | DocumentData |
Returns
Promise<Document>
deleteDocument()
deleteDocument(_workspaceId, documentId): Promise<void>;Defined in: application/services/core/DocumentService.ts:154
Delete a document
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
Returns
Promise<void>
exportToJSON()
exportToJSON(_workspaceId, documentId): Promise<any>;Defined in: application/services/core/DocumentService.ts:216
Export document to JSON
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
Returns
Promise<any>
exportToPDF()
exportToPDF(_workspaceId, documentId): Promise<any>;Defined in: application/services/core/DocumentService.ts:234
Export document to PDF
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
Returns
Promise<any>
getDocument()
getDocument(_workspaceId, documentId): Promise<Document | null>;Defined in: application/services/core/DocumentService.ts:146
Get a document by ID from workspace
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
Returns
Promise<Document | null>
getQAScore()
getQAScore(_workspaceId, documentId): Promise<number>;Defined in: application/services/core/DocumentService.ts:128
Get document QA score US-DOC-005: Track QA Score
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
Returns
Promise<number>
importDocument()
importDocument(
_workspaceId,
documentData,
options?
): Promise<Document>;Defined in: application/services/core/DocumentService.ts:53
Import a document from external data (e.g., JSON file) Automatically detects profile if not specified
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentData | DocumentData |
options? | { folderId?: string; profileId?: string; tags?: string[]; title?: string; } |
options.folderId? | string |
options.profileId? | string |
options.tags? | string[] |
options.title? | string |
Returns
Promise<Document>
patchDocumentByPath()
patchDocumentByPath(
_workspaceId,
documentId,
path,
value
): Promise<Document>;Defined in: application/services/core/DocumentService.ts:93
Patch document data at nested path and persist via affected root field.
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
path | (string | number)[] |
value | any |
Returns
Promise<Document>
updateDocumentField()
updateDocumentField(
_workspaceId,
documentId,
fieldPath,
value
): Promise<Document>;Defined in: application/services/core/DocumentService.ts:72
Update document field value US-DOC-003: Edit Document Uses active Document entity which auto-persists through Workspace
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
fieldPath | string |
value | FieldValue[] |
Returns
Promise<Document>
updateQAScore()
updateQAScore(
_workspaceId,
documentId,
score
): Promise<Document>;Defined in: application/services/core/DocumentService.ts:193
Update QA score
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
score | number |
Returns
Promise<Document>
validateDocument()
validateDocument(
_workspaceId,
documentId,
profile,
typeLibrary
): Promise<{
issues: any[];
score?: number;
}>;Defined in: application/services/core/DocumentService.ts:162
Validate a document against its schema
Parameters
| Parameter | Type |
|---|---|
_workspaceId | string |
documentId | string |
profile | any |
typeLibrary | any |
Returns
Promise<{ issues: any[]; score?: number; }>