Skip to content

Class: Document ​

Defined in: domain/entities/Document.ts:26

A document in a workspace. Holds the document data and notifies registered change listeners, which the owning Workspace uses to persist changes.

Constructors ​

Constructor ​

ts
new Document(
   instance, 
   profile?, 
   _typeLibrary?
): Document;

Defined in: domain/entities/Document.ts:46

Creates the entity from a stored DocumentInstance. createdAt and updatedAt are set to the current time.

Parameters ​

ParameterTypeDescription
instanceDocumentInstance-
profile?DocumentProfileProfile used for validation, if already known.
_typeLibrary?TypeLibrary-

Returns ​

Document

Properties ​

audit ​

ts
audit: AuditInfo;

Defined in: domain/entities/Document.ts:33


createdAt ​

ts
createdAt: string;

Defined in: domain/entities/Document.ts:36


data ​

ts
data: DocumentData;

Defined in: domain/entities/Document.ts:30


id ​

ts
readonly id: string;

Defined in: domain/entities/Document.ts:27


profileId ​

ts
readonly profileId: string;

Defined in: domain/entities/Document.ts:28


qa ​

ts
qa: QAStatus;

Defined in: domain/entities/Document.ts:31


storageBindings ​

ts
storageBindings: StorageBinding[];

Defined in: domain/entities/Document.ts:32


tags ​

ts
tags: string[];

Defined in: domain/entities/Document.ts:35


title? ​

ts
title?: string;

Defined in: domain/entities/Document.ts:29


updatedAt ​

ts
updatedAt: string;

Defined in: domain/entities/Document.ts:37


version ​

ts
version: VersionInfo;

Defined in: domain/entities/Document.ts:34

Methods ​

addTag() ​

ts
addTag(tag): Promise<void>;

Defined in: domain/entities/Document.ts:145

Add a tag

Parameters ​

ParameterType
tagstring

Returns ​

Promise<void>


onChange() ​

ts
onChange(listener): void;

Defined in: domain/entities/Document.ts:72

Register a listener to be notified when document changes Used by parent Workspace to persist changes automatically

Parameters ​

ParameterType
listenerChangeListener

Returns ​

void


removeTag() ​

ts
removeTag(tag): Promise<void>;

Defined in: domain/entities/Document.ts:156

Remove a tag

Parameters ​

ParameterType
tagstring

Returns ​

Promise<void>


setContext() ​

ts
setContext(profile, _typeLibrary): void;

Defined in: domain/entities/Document.ts:64

Set the document's profile and type library for validation

Parameters ​

ParameterType
profileDocumentProfile
_typeLibraryTypeLibrary

Returns ​

void


setField() ​

ts
setField(fieldPath, value): Promise<void>;

Defined in: domain/entities/Document.ts:86

Update a field value with automatic validation and propagation US-DOC-003: Edit Document

Parameters ​

ParameterType
fieldPathstring
valueFieldValue[]

Returns ​

Promise<void>


setTitle() ​

ts
setTitle(title): Promise<void>;

Defined in: domain/entities/Document.ts:131

Update document title

Parameters ​

ParameterType
titlestring | FieldValue[]

Returns ​

Promise<void>


toInstance() ​

ts
toInstance(): DocumentInstance;

Defined in: domain/entities/Document.ts:186

Convert entity back to instance (for serialization)

Returns ​

DocumentInstance


updateQA() ​

ts
updateQA(qa): Promise<void>;

Defined in: domain/entities/Document.ts:168

Update QA status

Parameters ​

ParameterType
qaPartial<QAStatus>

Returns ​

Promise<void>