ClientDatabaseBackend

ClientDatabaseBackend

The client-side database backend implementation which handles Document modification operations.

Constructor

new ClientDatabaseBackend()

Implements:

Extends

Methods

(async, protected) _createDocuments() → {Promise.<Array.<Document>>}

Overrides:
Implements:

Create primary Document instances

Returns:
Type
Promise.<Array.<Document>>

(async, protected) _createEmbeddedDocuments() → {Promise.<Array.<Document>>}

Overrides:
Implements:

Create embedded Document instances

Returns:
Type
Promise.<Array.<Document>>

(async, protected) _deleteDocuments() → {Promise.<Array.<Document>>}

Overrides:
Implements:

Delete primary Document instances

Returns:
Type
Promise.<Array.<Document>>

(async, protected) _deleteEmbeddedDocuments() → {Promise.<Array.<Document>>}

Overrides:
Implements:

Delete embedded Document instances

Returns:
Type
Promise.<Array.<Document>>

(async, protected) _getDocuments()

Overrides:
Implements:

Get primary Document instances

(async, protected) _getEmbeddedDocuments()

Overrides:
Implements:

Get embedded Document instances

(protected) _getLogger() → {Logger|Console}

Inherited From:
Implements:

Provide the Logger implementation that should be used for database operations

Returns:
Type
Logger | Console

(protected) _logError() → {string}

Inherited From:
Implements:

Construct a standardized error message given the context of an attempted operation

Returns:
Type
string

(protected) _logOperation(action, type, documents, levelopt, parentopt, packopt)

Inherited From:
Implements:

Log a database operation for an embedded document, capturing the action taken and relevant IDs

Parameters:
Name Type Attributes Default Description
action string

The action performed

type string

The document type

documents Array.<abstract.Document>

The documents modified

level string <optional>
info

The logging level

parent abstract.Document <optional>

A parent document

pack string <optional>

A compendium pack within which the operation occurred

(async, protected) _updateDocuments() → {Promise.<Array.<Document>>}

Overrides:
Implements:

Update primary Document instances

Returns:
Type
Promise.<Array.<Document>>

(async, protected) _updateEmbeddedDocuments() → {Promise.<Array.<Document>>}

Overrides:
Implements:

Update embedded Document instances

Returns:
Type
Promise.<Array.<Document>>

activateSocketListeners(socket)

Activate the Socket event listeners used to receive responses from events which modify database documents

Parameters:
Name Type Description
socket Socket

The active game socket

(async) create(documentClass, request, user) → {Array.<Document>}

Inherited From:
Implements:

Perform document creation operations

Parameters:
Name Type Description
documentClass function

The Document definition

request object

The requested operation

user BaseUser

The requesting User

Returns:

The created Document instances

Type
Array.<Document>

(async) delete(documentClass, request, user) → {Array.<Document>}

Inherited From:
Implements:

Perform document deletion operations

Parameters:
Name Type Description
documentClass function

The Document definition

request object

The requested operation

user BaseUser

The requesting User

Returns:

The deleted Document instances

Type
Array.<Document>

(async) get(documentClass, request, user) → {Array.<Document>}

Inherited From:
Implements:

Retrieve Documents based on provided query parameters

Parameters:
Name Type Description
documentClass function

The Document definition

request object

The requested operation

user BaseUser

The requesting User

Returns:

The created Document instances

Type
Array.<Document>

(protected) getCompendiumScopes() → {Array.<string>}

Overrides:
Implements:

Describe the scopes which are suitable as the namespace for a flag key

Returns:
Type
Array.<string>

(protected) getFlagScopes() → {Array.<string>}

Overrides:
Implements:

Describe the scopes which are suitable as the namespace for a flag key

Returns:
Type
Array.<string>

(async) update(documentClass, request, user) → {Array.<Document>}

Inherited From:
Implements:

Perform document update operations

Parameters:
Name Type Description
documentClass function

The Document definition

request object

The requested operation

user BaseUser

The requesting User

Returns:

The updated Document instances

Type
Array.<Document>