Methods

(async, static) collectAdapters() → {Promise.<void>}

Collects all database adapters from loaded plugins.

Returns:
Type: 
Promise.<void>

(async, static) collectConnections() → {Promise.<void>}

Collects all database connections from loaded plugins, initializes their adapters, and ensures that a default connection is available. It also handles any memory-based connections and merges their models into a single memory connection.

Returns:
Type: 
Promise.<void>

(async, static) collectFeatures() → {Promise.<void>}

Collects all model features from loaded plugins

Returns:
Type: 
Promise.<void>

(async, static) collectModels() → {Promise.<void>}

Collects all model schemas from the application, sanitizes them, and creates model instances. It also handles any buildStart and buildEnd handlers defined in the model definitions.

Returns:
Type: 
Promise.<void>

(async, static) sanitizeAll(schema) → {Promise.<void>}

Sanitizes all model schemas, ensuring that properties, indexes, and references are properly defined and validated. It also determines the sortable fields based on the defined indexes.

Parameters:
NameTypeDescription
schemaobject

The model schema

Returns:
Type: 
Promise.<void>

(async, static) sanitizeRef(schema, schemas) → {Promise.<void>}

Sanitizes the references in a model schema, ensuring that all references point to valid models and properties. It checks for duplicate reference keys and validates the existence of referenced models and properties.

Parameters:
NameTypeDescription
schemaobject

The model schema to sanitize

schemasArray.<object>

The list of all model schemas

Returns:
Type: 
Promise.<void>

(async, inner) applyFeature(schema, feature, options, indexes)

Applies a feature to a model schema, adding properties, rules, hooks, and other configurations as defined by the feature.

Parameters:
NameTypeDescription
schemaobject

The model schema

featureobject

The feature to apply

optionsobject

The options for the feature

indexesarray

The list of indexes to update

(async, inner) createSchema(item) → {object}

Creates a model schema by sanitizing its properties, features, and indexes, and ensuring that all references are valid. It also applies any buildStart and buildEnd handlers defined in the schema.

Parameters:
NameTypeDescription
itemobject

The model definition object

Returns:
  • The sanitized model schema
Type: 
object

(async, inner) findAllFeats(schema, inputs, indexes)

Finds and applies all features for a given model schema, ensuring that each feature is properly processed

Parameters:
NameTypeDescription
schemaobject

The model schema

inputsarray

The list of features to apply

indexesarray

The list of indexes to update

(async, inner) findAllIndexes(schema, inputs, indexes)

Finds and applies all indexes for a given model schema, ensuring that each index is properly processed

Parameters:
NameTypeDescription
schemaobject

The model schema

inputsarray

The list of indexes to apply

indexesarray

The list of existing indexes to update

(async, inner) findAllProps(schema, inputs, indexes)

Finds and sanitizes all properties for a given model schema, ensuring that the 'id' property is included and that all properties are properly processed.

Parameters:
NameTypeDescription
schemaobject

The model schema

inputsarray

The list of input properties to process

indexesarray

The list of indexes to update

(async, inner) sanitizeProp(model, prop, indexes)

Sanitizes a property definition for a model, ensuring it adheres to the expected structure and types. It handles various property attributes such as type, index, required status, and more.

If the property is virtual, it processes it accordingly; otherwise, it adds it to the model's properties and indexes.

Parameters:
NameTypeDescription
modelDoboModel
propDoboModel.TProperty
indexesArray.<DoboModel.TIndex>