Skip to content

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 ​

ts
new DocumentApplicationService(container): DocumentApplicationService;

Defined in: application/services/core/DocumentService.ts:22

Parameters ​

ParameterTypeDescription
containerServiceContainerService container providing the workspace storage service.

Returns ​

DocumentApplicationService

Methods ​

createDocument() ​

ts
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 ​

ParameterType
_workspaceIdstring
profileIdstring
folderId?string
initialData?DocumentData

Returns ​

Promise<Document>


deleteDocument() ​

ts
deleteDocument(_workspaceId, documentId): Promise<void>;

Defined in: application/services/core/DocumentService.ts:154

Delete a document

Parameters ​

ParameterType
_workspaceIdstring
documentIdstring

Returns ​

Promise<void>


exportToJSON() ​

ts
exportToJSON(_workspaceId, documentId): Promise<any>;

Defined in: application/services/core/DocumentService.ts:216

Export document to JSON

Parameters ​

ParameterType
_workspaceIdstring
documentIdstring

Returns ​

Promise<any>


exportToPDF() ​

ts
exportToPDF(_workspaceId, documentId): Promise<any>;

Defined in: application/services/core/DocumentService.ts:234

Export document to PDF

Parameters ​

ParameterType
_workspaceIdstring
documentIdstring

Returns ​

Promise<any>


getDocument() ​

ts
getDocument(_workspaceId, documentId): Promise<Document | null>;

Defined in: application/services/core/DocumentService.ts:146

Get a document by ID from workspace

Parameters ​

ParameterType
_workspaceIdstring
documentIdstring

Returns ​

Promise<Document | null>


getQAScore() ​

ts
getQAScore(_workspaceId, documentId): Promise<number>;

Defined in: application/services/core/DocumentService.ts:128

Get document QA score US-DOC-005: Track QA Score

Parameters ​

ParameterType
_workspaceIdstring
documentIdstring

Returns ​

Promise<number>


importDocument() ​

ts
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 ​

ParameterType
_workspaceIdstring
documentDataDocumentData
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() ​

ts
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 ​

ParameterType
_workspaceIdstring
documentIdstring
path(string | number)[]
valueany

Returns ​

Promise<Document>


updateDocumentField() ​

ts
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 ​

ParameterType
_workspaceIdstring
documentIdstring
fieldPathstring
valueFieldValue[]

Returns ​

Promise<Document>


updateQAScore() ​

ts
updateQAScore(
   _workspaceId, 
   documentId, 
   score
): Promise<Document>;

Defined in: application/services/core/DocumentService.ts:193

Update QA score

Parameters ​

ParameterType
_workspaceIdstring
documentIdstring
scorenumber

Returns ​

Promise<Document>


validateDocument() ​

ts
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 ​

ParameterType
_workspaceIdstring
documentIdstring
profileany
typeLibraryany

Returns ​

Promise<{ issues: any[]; score?: number; }>