Class: WorkspaceRecord
Defined in: application/services/records/workspace-record.ts:21
Active-record wrapper around a Workspace. Documents are exposed as DocumentRecord objects; methods that change documents through the document service reload the workspace afterwards.
Implements
Constructors
Constructor
new WorkspaceRecord(_workspace, services): WorkspaceRecord;Defined in: application/services/records/workspace-record.ts:26
Parameters
| Parameter | Type | Description |
|---|---|---|
_workspace | Workspace | Workspace entity to wrap. |
services | ActiveRecordServices | Application services to delegate to. |
Returns
WorkspaceRecord
Accessors
description
Get Signature
get description(): string | undefined;Defined in: application/services/records/workspace-record.ts:46
Workspace description. Setting it changes the entity only; call WorkspaceRecord.save to persist.
Returns
string | undefined
Set Signature
set description(value): void;Defined in: application/services/records/workspace-record.ts:50
Parameters
| Parameter | Type |
|---|---|
value | string | undefined |
Returns
void
Implementation of
WorkspaceRecordApi.description
documents
Get Signature
get documents(): DocumentRecordApi[];Defined in: application/services/records/workspace-record.ts:79
Workspace documents, wrapped in new record objects on each access.
Returns
Implementation of
folders
Get Signature
get folders(): FolderNode[];Defined in: application/services/records/workspace-record.ts:74
Folder tree of the workspace.
Returns
Implementation of
id
Get Signature
get id(): string;Defined in: application/services/records/workspace-record.ts:32
Workspace id.
Returns
string
Implementation of
name
Get Signature
get name(): string;Defined in: application/services/records/workspace-record.ts:37
Workspace name. Setting it changes the entity only; call WorkspaceRecord.save to persist.
Returns
string
Set Signature
set name(value): void;Defined in: application/services/records/workspace-record.ts:41
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
void
Implementation of
owner
Get Signature
get owner(): string;Defined in: application/services/records/workspace-record.ts:55
Workspace owner. Setting it changes the entity only; call WorkspaceRecord.save to persist.
Returns
string
Set Signature
set owner(value): void;Defined in: application/services/records/workspace-record.ts:59
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
void
Implementation of
profiles
Get Signature
get profiles(): DocumentProfile[];Defined in: application/services/records/workspace-record.ts:64
Document profiles available in the workspace.
Returns
Implementation of
typeLibrary
Get Signature
get typeLibrary(): TypeLibrary;Defined in: application/services/records/workspace-record.ts:69
Type library shared by the workspace profiles.
Returns
Implementation of
WorkspaceRecordApi.typeLibrary
Methods
createDocument()
createDocument(
profileId,
folderId?,
initialData?
): Promise<DocumentRecordApi>;Defined in: application/services/records/workspace-record.ts:113
Create a document from a profile, reload the workspace and return the new document as a record.
Parameters
| Parameter | Type |
|---|---|
profileId | string |
folderId? | string |
initialData? | DocumentData |
Returns
Promise<DocumentRecordApi>
Implementation of
WorkspaceRecordApi.createDocument
createFolder()
createFolder(name, parentId?): Promise<FolderNode>;Defined in: application/services/records/workspace-record.ts:172
Create a folder, under parentId when given, and persist the workspace.
Parameters
| Parameter | Type |
|---|---|
name | string |
parentId? | string |
Returns
Promise<FolderNode>
Implementation of
WorkspaceRecordApi.createFolder
deleteDocument()
deleteDocument(documentId): Promise<void>;Defined in: application/services/records/workspace-record.ts:164
Delete a document through the document service and reload the workspace.
Parameters
| Parameter | Type |
|---|---|
documentId | string |
Returns
Promise<void>
Implementation of
WorkspaceRecordApi.deleteDocument
deleteFolderAndMoveContents()
deleteFolderAndMoveContents(folderId): Promise<void>;Defined in: application/services/records/workspace-record.ts:180
Delete a folder, move its contents to the parent folder, and reload the workspace.
Parameters
| Parameter | Type |
|---|---|
folderId | string |
Returns
Promise<void>
Implementation of
WorkspaceRecordApi.deleteFolderAndMoveContents
findDuplicateDocument()
findDuplicateDocument(documentData): DocumentRecordApi | null;Defined in: application/services/records/workspace-record.ts:148
Return the document whose stored data is identical to documentData, or null.
Parameters
| Parameter | Type |
|---|---|
documentData | DocumentData |
Returns
DocumentRecordApi | null
Implementation of
WorkspaceRecordApi.findDuplicateDocument
getDocument()
getDocument(documentId): DocumentRecordApi | null;Defined in: application/services/records/workspace-record.ts:156
Return the document with the given id from the loaded workspace, or null.
Parameters
| Parameter | Type |
|---|---|
documentId | string |
Returns
DocumentRecordApi | null
Implementation of
WorkspaceRecordApi.getDocument
importDocument()
importDocument(documentData, options?): Promise<DocumentRecordApi>;Defined in: application/services/records/workspace-record.ts:127
Import existing document data, reload the workspace and return the new document as a record.
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<DocumentRecordApi>
Implementation of
WorkspaceRecordApi.importDocument
refresh()
refresh(): Promise<WorkspaceRecord>;Defined in: application/services/records/workspace-record.ts:86
Reload the workspace from the workspace service.
Returns
Promise<WorkspaceRecord>
Implementation of
save()
save(): Promise<WorkspaceRecord>;Defined in: application/services/records/workspace-record.ts:94
Persist the workspace through the workspace service.
Returns
Promise<WorkspaceRecord>
Implementation of
toSnapshot()
toSnapshot(): WorkspaceSnapshot;Defined in: application/services/records/workspace-record.ts:188
Return the workspace as a serializable WorkspaceSnapshot.
Returns
Implementation of
updateSchemaBundle()
updateSchemaBundle(profiles, typeLibrary?): Promise<WorkspaceRecord>;Defined in: application/services/records/workspace-record.ts:105
Bring the workspace's available schema bundle (document profiles + type library) up to date with the latest loaded bundle, in place and persisted, keeping all existing documents. Lets a persisted workspace surface newly added profiles (e.g. a new datamodel version) for creation without a destructive reset.
Parameters
| Parameter | Type |
|---|---|
profiles | DocumentProfile[] |
typeLibrary? | TypeLibrary |
Returns
Promise<WorkspaceRecord>