Methods
(async, static) collectAdapters() → {Promise.<void>}
Collects all database adapters from loaded plugins.
- Source
- 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.
- Source
- Type:
- Promise.<void>
(async, static) collectFeatures() → {Promise.<void>}
Collects all model features from loaded plugins
- Source
- 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.
- Source
- 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.
| Name | Type | Description |
|---|---|---|
schema | object | The model schema |
- Source
- 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.
| Name | Type | Description |
|---|---|---|
schema | object | The model schema to sanitize |
schemas | Array.<object> | The list of all model schemas |
- Source
- 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.
| Name | Type | Description |
|---|---|---|
schema | object | The model schema |
feature | object | The feature to apply |
options | object | The options for the feature |
indexes | array | The list of indexes to update |
- Source
(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.
| Name | Type | Description |
|---|---|---|
item | object | The model definition object |
- Source
- 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
| Name | Type | Description |
|---|---|---|
schema | object | The model schema |
inputs | array | The list of features to apply |
indexes | array | The list of indexes to update |
- Source
(async, inner) findAllIndexes(schema, inputs, indexes)
Finds and applies all indexes for a given model schema, ensuring that each index is properly processed
| Name | Type | Description |
|---|---|---|
schema | object | The model schema |
inputs | array | The list of indexes to apply |
indexes | array | The list of existing indexes to update |
- Source
(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.
| Name | Type | Description |
|---|---|---|
schema | object | The model schema |
inputs | array | The list of input properties to process |
indexes | array | The list of indexes to update |
- Source
(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.
| Name | Type | Description |
|---|---|---|
model | DoboModel | |
prop | DoboModel. | |
indexes | Array.<DoboModel.TIndex> |
- Source