Skip to content

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 ​

ts
new WorkspaceRecord(_workspace, services): WorkspaceRecord;

Defined in: application/services/records/workspace-record.ts:26

Parameters ​

ParameterTypeDescription
_workspaceWorkspaceWorkspace entity to wrap.
servicesActiveRecordServicesApplication services to delegate to.

Returns ​

WorkspaceRecord

Accessors ​

description ​

Get Signature ​

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

ts
set description(value): void;

Defined in: application/services/records/workspace-record.ts:50

Parameters ​
ParameterType
valuestring | undefined
Returns ​

void

Implementation of ​

WorkspaceRecordApi.description


documents ​

Get Signature ​

ts
get documents(): DocumentRecordApi[];

Defined in: application/services/records/workspace-record.ts:79

Workspace documents, wrapped in new record objects on each access.

Returns ​

DocumentRecordApi[]

Implementation of ​

WorkspaceRecordApi.documents


folders ​

Get Signature ​

ts
get folders(): FolderNode[];

Defined in: application/services/records/workspace-record.ts:74

Folder tree of the workspace.

Returns ​

FolderNode[]

Implementation of ​

WorkspaceRecordApi.folders


id ​

Get Signature ​

ts
get id(): string;

Defined in: application/services/records/workspace-record.ts:32

Workspace id.

Returns ​

string

Implementation of ​

WorkspaceRecordApi.id


name ​

Get Signature ​

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

ts
set name(value): void;

Defined in: application/services/records/workspace-record.ts:41

Parameters ​
ParameterType
valuestring
Returns ​

void

Implementation of ​

WorkspaceRecordApi.name


owner ​

Get Signature ​

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

ts
set owner(value): void;

Defined in: application/services/records/workspace-record.ts:59

Parameters ​
ParameterType
valuestring
Returns ​

void

Implementation of ​

WorkspaceRecordApi.owner


profiles ​

Get Signature ​

ts
get profiles(): DocumentProfile[];

Defined in: application/services/records/workspace-record.ts:64

Document profiles available in the workspace.

Returns ​

DocumentProfile[]

Implementation of ​

WorkspaceRecordApi.profiles


typeLibrary ​

Get Signature ​

ts
get typeLibrary(): TypeLibrary;

Defined in: application/services/records/workspace-record.ts:69

Type library shared by the workspace profiles.

Returns ​

TypeLibrary

Implementation of ​

WorkspaceRecordApi.typeLibrary

Methods ​

createDocument() ​

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

ParameterType
profileIdstring
folderId?string
initialData?DocumentData

Returns ​

Promise<DocumentRecordApi>

Implementation of ​

WorkspaceRecordApi.createDocument


createFolder() ​

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

ParameterType
namestring
parentId?string

Returns ​

Promise<FolderNode>

Implementation of ​

WorkspaceRecordApi.createFolder


deleteDocument() ​

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

ParameterType
documentIdstring

Returns ​

Promise<void>

Implementation of ​

WorkspaceRecordApi.deleteDocument


deleteFolderAndMoveContents() ​

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

ParameterType
folderIdstring

Returns ​

Promise<void>

Implementation of ​

WorkspaceRecordApi.deleteFolderAndMoveContents


findDuplicateDocument() ​

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

ParameterType
documentDataDocumentData

Returns ​

DocumentRecordApi | null

Implementation of ​

WorkspaceRecordApi.findDuplicateDocument


getDocument() ​

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

ParameterType
documentIdstring

Returns ​

DocumentRecordApi | null

Implementation of ​

WorkspaceRecordApi.getDocument


importDocument() ​

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

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

ts
refresh(): Promise<WorkspaceRecord>;

Defined in: application/services/records/workspace-record.ts:86

Reload the workspace from the workspace service.

Returns ​

Promise<WorkspaceRecord>

Implementation of ​

WorkspaceRecordApi.refresh


save() ​

ts
save(): Promise<WorkspaceRecord>;

Defined in: application/services/records/workspace-record.ts:94

Persist the workspace through the workspace service.

Returns ​

Promise<WorkspaceRecord>

Implementation of ​

WorkspaceRecordApi.save


toSnapshot() ​

ts
toSnapshot(): WorkspaceSnapshot;

Defined in: application/services/records/workspace-record.ts:188

Return the workspace as a serializable WorkspaceSnapshot.

Returns ​

WorkspaceSnapshot

Implementation of ​

WorkspaceRecordApi.toSnapshot


updateSchemaBundle() ​

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

ParameterType
profilesDocumentProfile[]
typeLibrary?TypeLibrary

Returns ​

Promise<WorkspaceRecord>