Skip to content

@vttforge/core / DocumentMembers

Interface: DocumentMembers<System>

What every document carries, whatever kind it is.

System is the document's system data. It defaults to an open record, so a consumer who has not said what their schema is still compiles; pass the inferred type from BaseTypeDataModel to get the fields.

Extended by

Type Parameters

System

System = Record<string, unknown>

Properties

documentName

readonly documentName: string

'Actor', 'Item', 'ActiveEffect', and so on.


flags

readonly flags: DocumentFlags


id

readonly id: string | null


img

readonly img: string | null


isOwner

readonly isOwner: boolean

Whether the current user owns this document.


name

readonly name: string


parent

readonly parent: DocumentMembers<Record<string, unknown>> | null

The document this one is embedded in, or null at the top level.


system

readonly system: System

The type data model instance. Its fields are the schema's fields.


type

readonly type: string

The subtype, as declared under documentTypes in the manifest.


uuid

readonly uuid: string

Methods

delete()

delete(operation?): Promise<DocumentMembers<System> | undefined>

Parameters

operation?

Record<string, unknown>

Returns

Promise<DocumentMembers<System> | undefined>


getFlag()

getFlag<T>(scope, key): T | undefined

Type Parameters

T

T = unknown

Parameters

scope

string

key

string

Returns

T | undefined


setFlag()

setFlag(scope, key, value): Promise<DocumentMembers<System>>

Parameters

scope

string

key

string

value

unknown

Returns

Promise<DocumentMembers<System>>


toObject()

toObject(source?): Record<string, unknown>

A plain-object copy. source reads the stored data instead of the prepared data.

Parameters

source?

boolean

Returns

Record<string, unknown>


unsetFlag()

unsetFlag(scope, key): Promise<DocumentMembers<System>>

Parameters

scope

string

key

string

Returns

Promise<DocumentMembers<System>>


update()

update(data, operation?): Promise<DocumentMembers<System> | undefined>

Parameters

data

Record<string, unknown>

operation?

Record<string, unknown>

Returns

Promise<DocumentMembers<System> | undefined>

MIT licensed.