Class: Workspace
Defined in: domain/entities/Workspace.ts:29
The workspace aggregate root. Owns the documents, folder tree, profiles and settings, and persists changes through an optional WorkspaceService when auto-save is enabled.
Constructors
Constructor
new Workspace(snapshot, persistenceService?): Workspace;Defined in: domain/entities/Workspace.ts:59
Creates the workspace from a WorkspaceSnapshot and wraps each stored document in a Document entity. Missing optional snapshot fields get defaults (for example uiLocale en and qaTarget 80).
Parameters
| Parameter | Type | Description |
|---|---|---|
snapshot | WorkspaceSnapshot | - |
persistenceService? | WorkspaceService | Service used to persist changes; can also be set later with setPersistenceService. |
Returns
Workspace
Properties
backupInfo?
backupInfo?: BackupInfo;Defined in: domain/entities/Workspace.ts:44
collaborators
collaborators: string[];Defined in: domain/entities/Workspace.ts:34
createdAt
createdAt: string;Defined in: domain/entities/Workspace.ts:46
dataLocales
dataLocales: string[];Defined in: domain/entities/Workspace.ts:36
description?
description?: string;Defined in: domain/entities/Workspace.ts:32
folders
folders: FolderNode[];Defined in: domain/entities/Workspace.ts:41
id
readonly id: string;Defined in: domain/entities/Workspace.ts:30
name
name: string;Defined in: domain/entities/Workspace.ts:31
owner
owner: string;Defined in: domain/entities/Workspace.ts:33
profiles
profiles: DocumentProfile[];Defined in: domain/entities/Workspace.ts:39
qaTarget
qaTarget: number;Defined in: domain/entities/Workspace.ts:37
settings
settings: Record<string, JsonValue>;Defined in: domain/entities/Workspace.ts:45
storageLocations
storageLocations: StorageLocation[];Defined in: domain/entities/Workspace.ts:43
templates
templates: DocumentTemplate<string>[];Defined in: domain/entities/Workspace.ts:40
typeLibrary
typeLibrary: TypeLibrary;Defined in: domain/entities/Workspace.ts:38
uiLocale
uiLocale: string;Defined in: domain/entities/Workspace.ts:35
updatedAt
updatedAt: string;Defined in: domain/entities/Workspace.ts:47
Accessors
documents
Get Signature
get documents(): Document[];Defined in: domain/entities/Workspace.ts:113
Get documents as active entities (not snapshots)
Returns
Document[]
Methods
createDocument()
createDocument(
profileId,
folderId?,
initialData?
): Promise<Document>;Defined in: domain/entities/Workspace.ts:128
Create a new document in this workspace US-DOC-001: Create Document from Profile
Parameters
| Parameter | Type |
|---|---|
profileId | string |
folderId? | string |
initialData? | DocumentData |
Returns
Promise<Document>
createFolder()
createFolder(name, parentId?): Promise<FolderNode>;Defined in: domain/entities/Workspace.ts:294
Create a folder in workspace US-FOLDER-001: Create Folder
Parameters
| Parameter | Type |
|---|---|
name | string |
parentId? | string |
Returns
Promise<FolderNode>
deleteDocument()
deleteDocument(documentId): Promise<void>;Defined in: domain/entities/Workspace.ts:278
Remove a document from workspace
Parameters
| Parameter | Type |
|---|---|
documentId | string |
Returns
Promise<void>
deleteFolderAndMoveContents()
deleteFolderAndMoveContents(folderId): Promise<void>;Defined in: domain/entities/Workspace.ts:330
Deletes a folder and moves its subfolders, and its document ids when it has a parent folder, up one level. Then persists the workspace.
Parameters
| Parameter | Type |
|---|---|
folderId | string |
Returns
Promise<void>
Throws
Error when folderId is root or the folder does not exist.
findDuplicateDocument()
findDuplicateDocument(documentData): Document | null;Defined in: domain/entities/Workspace.ts:186
Find an existing document whose stored data is identical to the supplied data. Returns the matching document or null when no duplicate exists.
Parameters
| Parameter | Type |
|---|---|
documentData | DocumentData |
Returns
Document | null
getDocument()
getDocument(documentId): Document | undefined;Defined in: domain/entities/Workspace.ts:120
Get a document by ID
Parameters
| Parameter | Type |
|---|---|
documentId | string |
Returns
Document | undefined
importDocument()
importDocument(documentData, options?): Promise<Document>;Defined in: domain/entities/Workspace.ts:201
Import a document from external data Detects profile if not specified and validates structure
Parameters
| Parameter | Type |
|---|---|
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>
save()
save(): Promise<void>;Defined in: domain/entities/Workspace.ts:462
Manually save workspace (useful when auto-save is disabled)
Returns
Promise<void>
setAutoSave()
setAutoSave(enabled): void;Defined in: domain/entities/Workspace.ts:106
Enable or disable auto-save (useful for batch operations)
Parameters
| Parameter | Type |
|---|---|
enabled | boolean |
Returns
void
setPersistenceService()
setPersistenceService(service): void;Defined in: domain/entities/Workspace.ts:99
Set or update the persistence service
Parameters
| Parameter | Type |
|---|---|
service | WorkspaceService |
Returns
void
toSnapshot()
toSnapshot(): WorkspaceSnapshot;Defined in: domain/entities/Workspace.ts:487
Convert entity back to snapshot (for serialization)
Returns
updateSchemaBundle()
updateSchemaBundle(profiles, typeLibrary?): Promise<void>;Defined in: domain/entities/Workspace.ts:473
Replace the available schema bundle (document profiles + type library) in place and persist, keeping all existing documents. Used to bring a persisted workspace up to date with newly added profiles (e.g. a new datamodel version) without a destructive re-initialize — existing documents keep their own profileId, and every previously used id remains resolvable as long as the new profile set still contains it.
Parameters
| Parameter | Type |
|---|---|
profiles | DocumentProfile[] |
typeLibrary? | TypeLibrary |
Returns
Promise<void>