DatabaseBackend

abstract. DatabaseBackend

An interface shared by both the client and server-side which defines how creation, update, and deletion operations are transacted.

Methods

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

Create primary Document instances

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

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

Create embedded Document instances

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

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

Delete primary Document instances

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

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

Delete embedded Document instances

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

(async, protected) _getDocuments()

Get primary Document instances

(async, protected) _getEmbeddedDocuments()

Get embedded Document instances

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

Provide the Logger implementation that should be used for database operations

Returns:
Type
Logger | Console

(protected) _logError() → {string}

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

Returns:
Type
string

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

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>>}

Update primary Document instances

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

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

Update embedded Document instances

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

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

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>}

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>}

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>}

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

Returns:
Type
Array.<string>

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

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

Returns:
Type
Array.<string>

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

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>