Objects with open properties
Interface for classes with new operator and static properties/methods
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| args |
any[]
|
rest |
Interface for classes with |
Interface for constructor functions without new operator, for example,
function Foo(x) {
if (!(this instanceof Foo)) { return new Foo(x); }
this.x = x;
}
Type alias for Node.js callback functions
| Name | Type | Description |
|---|---|---|
| err |
Error | string | null | undefined
|
|
| result |
T
|
Common properties/operations for connectors
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| configModel |
Model
|
exported optional |
Common properties/operations for connectors |
|
| interfaces |
string[]
|
exported optional |
Common properties/operations for connectors |
|
| name |
string
|
exported |
Common properties/operations for connectors |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| command |
Command
|
Common properties/operations for connectors |
||
| parameters |
NamedParameters | PositionalParameters
|
Common properties/operations for connectors |
||
| options |
Options
|
optional |
Common properties/operations for connectors |
CRUD operations for connector implementations
Count matching entities
A promise of number of matching entities
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| where |
Where
|
optional |
The matching criteria |
|
| options |
Options
|
optional |
Options for the operation |
Create a new entity
A promise of the entity created
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| entity |
EntityData
|
The entity instance or data |
||
| options |
Options
|
optional |
Options for the operation |
Create multiple entities
A promise of an array of entities created
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| entities |
EntityData[]
|
An array of entity instances or data |
||
| options |
Options
|
optional |
Options for the operation |
Delete an entity
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| entity |
EntityData
|
The entity instance or data |
||
| options |
Options
|
optional |
Options for the operation |
Delete matching entities
A promise of number of matching entities deleted
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| where |
Where
|
optional |
The matching criteria |
|
| options |
Options
|
optional |
Options for the operation |
Delete an entity by id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| id |
IdType
|
The entity id value |
||
| options |
Options
|
optional |
Options for the operation |
Check if an entity exists for the id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| id |
IdType
|
The entity id value |
||
| options |
Options
|
optional |
Options for the operation |
Find matching entities by the filter
A promise of an array of entities found for the filter
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| filter |
Filter
|
optional |
The query filter |
|
| options |
Options
|
optional |
Options for the operation |
Find an entity by id
A promise of the entity found for the id
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| id |
IdType
|
The entity id value |
||
| options |
Options
|
optional |
Options for the operation |
Replace an entity by id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| id |
IdType
|
The entity id value |
||
| data |
EntityData
|
The data attributes to be updated |
||
| options |
Options
|
optional |
Options for the operation |
Save an entity
A promise of the entity saved
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| entity |
EntityData
|
The entity instance or data |
||
| options |
Options
|
optional |
Options for the operation |
Update an entity
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| entity |
EntityData
|
The entity instance or data |
||
| options |
Options
|
optional |
Options for the operation |
Update matching entities
A promise of number of matching entities deleted
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| data |
EntityData
|
The data attributes to be updated |
||
| where |
Where
|
optional |
The matching criteria |
|
| options |
Options
|
optional |
Options for the operation |
Update an entity by id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
The model class |
||
| id |
IdType
|
The entity id value |
||
| data |
EntityData
|
The data attributes to be updated |
||
| options |
Options
|
optional |
Options for the operation |
Key/Value operations for connector implementations
Delete an entry by key
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| key |
string
|
Key for the entry |
||
| options |
Options
|
optional |
Options for the operation |
Delete all entries
A promise of the number of entries deleted
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| options |
Options
|
optional |
Options for the operation |
Set up ttl for an entry by key
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| key |
string
|
Key for the entry |
||
| ttl |
number
|
Key/Value operations for connector implementations |
||
| options |
Options
|
optional |
Options for the operation |
Get an entry by key
A promise of the entry found for the key
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| key |
string
|
Key for the entry |
||
| options |
Options
|
optional |
Options for the operation |
Get an Iterator for matching keys
A promise of an iterator of entries
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| filter |
Filter
|
optional |
Matching filter |
|
| options |
Options
|
optional |
Options for the operation |
Fetch all keys
A promise of an array of keys for all entries
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| options |
Options
|
optional |
Options for the operation |
Set an entry with key/value
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| key |
string
|
Key for the entry |
||
| value |
EntityData
|
Value for the entry |
||
| options |
Options
|
optional |
Options for the operation |
Get ttl for an entry by key
A promise of the TTL value
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<Entity>
|
Model class |
||
| key |
string
|
Key for the entry |
||
| ttl |
number
|
Time to live in millisenconds |
||
| options |
Options
|
optional |
Options for the operation |
DataSource denotes a configured connector
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| connector |
Connector
|
exported optional |
DataSource denotes a configured connector |
|
| name |
string
|
exported |
DataSource denotes a configured connector |
|
| settings |
AnyObject
|
exported |
DataSource denotes a configured connector |
A utility function to simplify retrieving metadata from a target model and its properties.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Function
|
The class from which to retrieve metadata. |
||
| options |
InspectionOptions
|
optional |
An options object for the MetadataInspector to customize the output of the metadata retrieval functions. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| itemType |
Function
|
The class of the array to decorate |
||
| definition |
Partial<PropertyDefinition>
|
optional |
Optional PropertyDefinition object for additional metadata |
Decorator for model definitions
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Partial<ModelDefinitionSyntax>
|
optional |
|
| Name | Default Value | Flags | Description |
|---|---|---|---|
| belongsTo | exported | ||
| embedsMany | exported | ||
| embedsOne | exported | ||
| hasMany | exported | ||
| hasOne | exported | ||
| referencesMany | exported | ||
| referencesOne | exported |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| as |
string
|
exported | ||
| target |
string | Class<Entity>
|
exported | ||
| type |
RelationType
|
exported |
Decorator for belongsTo
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for embedsMany
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for embedsOne
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for hasMany
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for hasOne
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for referencesMany
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for referencesOne
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Decorator for relations
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
Object
|
optional |
|
Metadata for a repository
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource | DataSource
|
exported optional |
Instance of the data source |
|
| dataSourceName |
undefined | string
|
exported optional |
Name of the data source |
|
| modelClass |
undefined | Entity
|
exported optional |
Class of the model |
|
| modelName |
undefined | string
|
exported optional |
Name of the model |
|
| name |
undefined | string
|
exported optional |
Name of the predefined repository |
Constructor for RepositoryMetadata
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelOrRepo |
string | Entity
|
Name or class of the model. If the value is a string and
|
||
| dataSource |
string | DataSource | DataSource
|
optional |
Name or instance of the data source For example:
|
Type definition for decorators returned by @repository decorator factory
| Name | Type | Description |
|---|---|---|
| target |
Object
|
|
| key |
string | symbol
|
|
| descriptorOrIndex |
TypedPropertyDescriptor<any> | number
|
Decorator for repository injections on properties or method arguments
class CustomerController {
@repository(CustomerRepository) public custRepo: CustomerRepository;
constructor(
@repository(ProductRepository) public prodRepo: ProductRepository,
) {}
// ...
}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| repositoryName |
string | Class<Repository<Model>>
|
Name of the repo |
Decorator for DefaultCrudRepository generation and injection on properties or method arguments based on the given model and dataSource (or their names)
class CustomerController {
@repository('Customer', 'mySqlDataSource')
public custRepo: DefaultCrudRepository<
Customer,
typeof Customer.prototype.id
>;
constructor(
@repository(Product, mySqlDataSource)
public prodRepo: DefaultCrudRepository<
Product,
typeof Product.prototype.id
>,
) {}
// ...
}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| model |
string | Entity
|
Name/class of the model |
||
| dataSource |
string | DataSource
|
Name/instance of the dataSource |
Operators for where clauses
DataSource instance properties/operations
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| connected |
undefined | true | false
|
exported optional |
DataSource instance properties/operations |
|
| connecting |
undefined | true | false
|
exported optional |
DataSource instance properties/operations |
|
| name |
string
|
exported |
DataSource instance properties/operations |
|
| settings |
AnyObject
|
exported |
DataSource instance properties/operations |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
undefined | string
|
optional |
DataSource instance properties/operations |
|
| settings |
AnyObject
|
optional |
DataSource instance properties/operations |
|
| modelBuilder |
ModelBuilder
|
optional |
DataSource instance properties/operations |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| settings |
AnyObject
|
optional |
DataSource instance properties/operations |
|
| modelBuilder |
ModelBuilder
|
optional |
DataSource instance properties/operations |
Create a model class
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
Name of the model |
||
| properties |
AnyObject
|
optional |
An object of property definitions |
|
| options |
Options
|
optional |
Options for model settings |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
static exported optional | ||
| definition |
ModelDefinition
|
static exported | ||
| modelName |
string
|
static exported |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| args |
any[]
|
rest |
Set the TTL (time to live) in ms (milliseconds) for a given key. TTL is the remaining time before a key-value pair is discarded from the database.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key to use when searching the database. |
||
| ttl |
number
|
TTL in ms to set for the key. |
||
| options |
Options
|
optional | ||
| callback |
Callback<number>
|
optional |
Return the value associated with a given key.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key to use when searching the database. |
||
| options |
Options
|
optional | ||
| callback |
Callback<KVData>
|
optional |
Asynchronously iterate all keys in the database. Similar to .keys() but
instead allows for iteration over large data sets without having to load
everything into memory at once.
Callback example:
// Given a model named `Color` with two keys `red` and `blue`
var iterator = Color.iterateKeys();
it.next(function(err, key) {
// key contains `red`
it.next(function(err, key) {
// key contains `blue`
});
});
Promise example:
// Given a model named `Color` with two keys `red` and `blue`
var iterator = Color.iterateKeys();
Promise.resolve().then(function() {
return it.next();
})
.then(function(key) {
// key contains `red`
return it.next();
});
.then(function(key) {
// key contains `blue`
});
An Object implementing next(cb) -> Promise
function that can be used to iterate all keys.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
An optional filter object with the following |
|
| options |
Options
|
optional |
|
Return all keys in the database.
WARNING: This method is not suitable for large data sets as all
key-values pairs are loaded into memory at once. For large data sets,
use iterateKeys() instead.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
An optional filter object with the following |
|
| options |
Options
|
optional |
|
|
| callback |
Callback<string[]>
|
optional |
Persist a value and associate it with the given key.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key to associate with the given value. |
||
| value |
KVData
|
Value to persist. |
||
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional |
Return the TTL (time to live) for a given key. TTL is the remaining time before a key-value pair is discarded from the database.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key to use when searching the database. |
||
| options |
Options
|
optional | ||
| callback |
Callback<number>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| ds |
DataSource
|
Base model class
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
static exported optional |
Base model class |
|
| definition |
ModelDefinition
|
static exported |
Base model class |
|
| modelName |
string
|
static exported |
Base model class |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| args |
any[]
|
rest |
Base model class |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional |
Base model class |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| ds |
DataSource
|
Base model class |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definitions |
anonymous
|
exported | ||
| models |
anonymous
|
exported | ||
| settings |
AnyObject
|
exported | ||
| defaultInstance |
ModelBuilder
|
static exported | ||
| defaultMaxListeners |
number
|
static exported |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| listener |
anonymous
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
|||
| json |
AnyObject
|
|||
| options |
Options
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| schemas |
AnyObject
|
|||
| createModel |
Function
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| className |
string
|
|||
| properties |
AnyObject
|
optional | ||
| settings |
AnyObject
|
optional | ||
| parent |
undefined | ModelBase
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelName |
string
|
|||
| propertyName |
string
|
|||
| propertyDefinition |
AnyObject
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| type |
string
|
|||
| aliases |
string[]
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| args |
any[]
|
rest |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelName |
string
|
|||
| properties |
AnyObject
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
|||
| forceCreate |
undefined | true | false
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
undefined | string
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| type |
string | symbol
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| listener |
anonymous
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| listener |
anonymous
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| listener |
anonymous
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| listener |
anonymous
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
|||
| listener |
anonymous
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| type |
any
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| n |
number
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| emitter |
EventEmitter
|
|||
| event |
string | symbol
|
Model definition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Model definition |
|
| properties |
AnyObject
|
exported |
Model definition |
|
| rawProperties |
AnyObject
|
exported |
Model definition |
|
| relations |
AnyObject[]
|
exported optional |
Model definition |
|
| settings |
AnyObject
|
exported optional |
Model definition |
|
| defaultMaxListeners |
number
|
static exported |
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelBuilder |
ModelBuilder | null | undefined
|
Model definition |
||
| name |
string
|
Model definition |
||
| properties |
undefined | anonymous
|
optional |
Model definition |
|
| settings |
AnyObject
|
optional |
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelBuilder |
ModelBuilder | null | undefined
|
Model definition |
||
| schema |
Schema
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| listener |
anonymous
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| forceRebuild |
undefined | true | false
|
optional |
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| connectorType |
string
|
Model definition |
||
| propertyName |
string
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| connectorType |
string
|
Model definition |
||
| propertyName |
string
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| connectorType |
string
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| propertyName |
string
|
Model definition |
||
| propertyDefinition |
PropertyDefinition
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| args |
any[]
|
rest |
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| type |
string | symbol
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| listener |
anonymous
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| listener |
anonymous
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| listener |
anonymous
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| listener |
anonymous
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
optional |
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| event |
string | symbol
|
Model definition |
||
| listener |
anonymous
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| n |
number
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| connectorType |
string
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| forceRebuild |
undefined | true | false
|
optional |
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| emitter |
EventEmitter
|
Model definition |
||
| event |
string | symbol
|
Model definition |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
static exported optional | ||
| definition |
ModelDefinition
|
static exported | ||
| modelName |
string
|
static exported |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| args |
any[]
|
rest |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Deletes the model from persistence.
Triggers destroy hook (async) before and after destroying object.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Callback function. |
Get the id value for the PersistedModel.
The id value
Get the id property name of the constructor.
The id property name
Determine if the data model is new.
Returns true if the data model is new; false otherwise.
Reload object from persistence. Requires id member of object to be able to call find.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Replace attributes for a model instance and persist it into the datasource. Performs validation before replacing.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
Data to replace. |
||
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Save model instance. If the instance doesn't have an ID, then calls create instead. Triggers: validate, save, update, or create.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Set the correct id property for the PersistedModel. Uses the setId method if the model is attached to
connector that defines it. Otherwise, uses the default lookup.
Override this method to handle complex IDs.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| val |
any
|
The |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional |
Update a single attribute.
Equivalent to updateAttributes({name: 'value'}, cb)
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
Name of property. |
||
| value |
any
|
Value of property. |
||
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Update set of attributes. Performs validation before updating.
Triggers: validation, save and update hooks
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
Data to update. |
||
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| ds |
DataSource
|
Return the number of records that match the optional "where" filter.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<number>
|
optional |
Create new instance of Model, and save to database.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
|||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
|||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
Destroy all model instances that match the optional where specification.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
Destroy model instance with the specified ID.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
The ID value of model instance to delete. |
||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
Check whether a model instance exists in database.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
Identifier of object (primary key value). |
||
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Find all model instances that match filter specification.
See Querying models.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Find object by ID with an optional filter for include/fields.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
Primary key value |
||
| filter |
Filter
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<boolean>
|
optional |
Find one model instance that matches filter specification.
Same as find, but limited to one result;
Returns object, not collection.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Finds one record matching the optional filter object. If not found, creates
the object using the data provided as second argument. In this sense it is
the same as find, but limited to one object. Returns an object, not
collection. If you don't provide the filter object argument, it tries to
locate an existing object that matches the data argument.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
|||
| data |
PersistedData
|
Data to insert if object matching the |
||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Get the id property name of the constructor.
The id property name
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
|||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
|||
| data |
PersistedData
|
|||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
|||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
Replace attributes for a model instance whose id is the first input argument and persist it into the datasource. Performs validation before replacing.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
The ID value of model instance to replace. |
||
| data |
PersistedData
|
Data to replace. |
||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Replace or insert a model instance; replace existing record if one is found,
such that parameter data.id matches id of model instance; otherwise,
insert a new record.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
The model instance data. |
||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional | ||
| data |
PersistedData
|
optional | ||
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
Update multiple instances that match the where clause.
Example:
Employee.updateAll({managerId: 'x001'}, {managerId: 'x002'}, function(err, info) {
...
});
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional | ||
| data |
PersistedData
|
optional |
Object containing data to replace matching instances, if AnyType. |
|
| options |
Options
|
optional | ||
| callback |
Callback<Count>
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
|||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Update or insert a model instance
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
PersistedData
|
The model instance data to insert. |
||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Update or insert a model instance based on the search criteria. If there is a single instance retrieved, update the retrieved model. Creates a new model if no model instances were found. Returns an error if multiple instances are found.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
|||
| data |
PersistedData
|
The model instance data to insert. |
||
| options |
Options
|
optional | ||
| callback |
Callback<PersistedData>
|
optional |
Column metadata
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Column metadata |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| and |
Where[]
|
exported optional | ||
| between |
any[]
|
exported optional | ||
| eq |
any
|
exported optional | ||
| exists |
undefined | true | false
|
exported optional | ||
| gt |
any
|
exported optional | ||
| gte |
any
|
exported optional | ||
| inq |
any[]
|
exported optional | ||
| lt |
any
|
exported optional | ||
| lte |
any
|
exported optional | ||
| neq |
any
|
exported optional | ||
| or |
Where[]
|
exported optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| count |
number
|
exported |
Selection of fields
Query filter object
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| fields |
Fields
|
exported optional |
Query filter object |
|
| include |
Inclusion[]
|
exported optional |
Query filter object |
|
| limit |
undefined | number
|
exported optional |
Query filter object |
|
| offset |
undefined | number
|
exported optional |
Query filter object |
|
| order |
string[]
|
exported optional |
Query filter object |
|
| skip |
undefined | number
|
exported optional |
Query filter object |
|
| where |
Where
|
exported optional |
Query filter object |
ID definition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
number
|
exported |
ID definition |
|
| name |
string
|
exported |
ID definition |
|
| property |
AnyObject
|
exported |
ID definition |
Inclusion of related items
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| relation |
string
|
exported |
Inclusion of related items |
|
| scope |
Filter
|
exported optional |
Inclusion of related items |
Index definition
Property definition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Property definition |
|
| type |
any
|
exported |
Property definition |
Relation definition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Relation definition |
|
| type |
string
|
exported |
Relation definition |
Schema definition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Schema definition |
|
| properties |
AnyObject
|
exported |
Schema definition |
|
| settings |
AnyObject
|
exported optional |
Schema definition |
Where object
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| and |
Where[]
|
exported optional |
Where object |
|
| or |
Where[]
|
exported optional |
Where object |
A builder to compose mixins
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| baseClass |
Class<any>
|
constructorProperty exported public |
The base class |
Constructor for MixinBuilder
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| baseClass |
Class<any>
|
The base class |
Apply one or more mixin functions
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| mixins |
MixinFunc[]
|
rest |
An array of mixin functions |
Create an instance of MixinBuilder with the base class
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| baseClass |
Class<any>
|
The base class |
Interface for functions that can mix properties/methods into a base class
For example,
var calculatorMixin = Base => class extends Base {
calc() { }
};
function timestampMixin(Base) {
return class extends Base {
created: Date = new Date();
modified: Date = new Date();
}
}
See http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/.
Interface for an Application mixed in with RepositoryMixin
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
ApplicationConfig
|
exported public optional |
Interface for an Application mixed in with RepositoryMixin |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| component |
Class<__type>
|
Interface for an Application mixed in with RepositoryMixin |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
Interface for an Application mixed in with RepositoryMixin |
||
| name |
undefined | string
|
optional |
Interface for an Application mixed in with RepositoryMixin |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| repo |
Class<R>
|
Interface for an Application mixed in with RepositoryMixin |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| component |
Class<__type>
|
Interface for an Application mixed in with RepositoryMixin |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| repo |
Class<any>
|
Interface for an Application mixed in with RepositoryMixin |
A mixin class for Application that creates a .repository() function to register a repository automatically. Also overrides component function to allow it to register repositories automatically.
class MyApplication extends RepositoryMixin(Application) {}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| superClass |
T
|
Base class for entities which have unique ids
Get the identity value. If the identity is a composite key, returns an object.
Get the identity as an object, such as {id: 1} or
{schoolId: 1, studentId: 2}
Build the where object for the given id
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
any
|
The id value |
Domain events
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| source |
any
|
exported |
Domain events |
|
| type |
string
|
exported |
Domain events |
Base class for models
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| definition |
ModelDefinition
|
static exported |
Base class for models |
|
| modelName |
string
|
static exported |
Base class for models |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
Partial<Model>
|
optional |
Base class for models |
Serialize into a plain JSON object
Convert to a plain object as DTO
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional |
Base class for models |
Definition for a model
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Definition for a model |
|
| properties |
anonymous
|
exported |
Definition for a model |
|
| settings |
anonymous
|
exported |
Definition for a model |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| nameOrDef |
string | ModelDefinitionSyntax
|
Definition for a model |
Add a property
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
Definition for a model |
||
| definitionOrType |
PropertyDefinition | PropertyType
|
Definition for a model |
Add a setting
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
Setting name |
||
| value |
any
|
Setting value |
Get an array of names of ID properties, which are specified in
the model settings or properties with id attribute. For example,
{
settings: {
id: ['id']
}
properties: {
id: {
type: 'string',
id: true
}
}
}
Base class for value objects - An object that contains attributes but has no conceptual identity. They should be treated as immutable.
DSL for building a model definition.
Property definition for a model
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
undefined | true | false
|
exported optional |
Property definition for a model |
|
| json |
PropertyForm
|
exported optional |
Property definition for a model |
|
| store |
PropertyForm
|
exported optional |
Property definition for a model |
|
| type |
PropertyType
|
exported |
Property definition for a model |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| in |
undefined | true | false
|
exported optional | ||
| name |
undefined | string
|
exported optional | ||
| out |
undefined | true | false
|
exported optional |
Operators for where clauses
A builder for Filter. It provides fleunt APIs to add clauses such as
fields, order, where, limit, offset, and include.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
exported |
A builder for Filter. It provides fleunt APIs to add clauses such as
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| f |
Filter
|
optional |
A builder for Filter. It provides fleunt APIs to add clauses such as
|
Return the filter object
Describe what fields to be included/excluded
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| f |
(string | string[] | Fields)[]
|
rest |
A field name to be included, an array of field names to be included, or an Fields object for the inclusion/exclusion |
Declare include
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| i |
(string | string[] | Inclusion)[]
|
rest |
A relation name, an array of relation names, or an |
Set limit
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| limit |
number
|
Maximum number of records to be returned |
Set offset
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| offset |
number
|
Offset of the number of records to be returned |
Describe the sorting order
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| o |
(string | string[] | Order)[]
|
rest |
A builder for Filter. It provides fleunt APIs to add clauses such as
|
Alias to offset
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| skip |
number
|
|
Declare a where clause
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| w |
Where
|
Where object |
A builder for Where object. It provides fleunt APIs to add clauses such as
and, or, and other operators.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
exported |
A builder for Where object. It provides fleunt APIs to add clauses such as
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| w |
Where
|
optional |
A builder for Where object. It provides fleunt APIs to add clauses such as
|
Add an and clause.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| w |
(Where | Where[])[]
|
rest |
One or more where objects |
Add a between condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val1 |
any
|
Property value lower bound |
||
| val2 |
any
|
Property value upper bound |
Get the where object
Add an = condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any
|
Property value |
Add a exists condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
undefined | true | false
|
optional |
Exists or not |
Add a > condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any
|
Property value |
Add a >= condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any
|
Property value |
Add a inq condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any[]
|
An array of property values |
Add a < condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any
|
Property value |
Add a <= condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any
|
Property value |
Add a != condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Property name |
||
| val |
any
|
Property value |
Add an or clause.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| w |
(Where | Where[])[]
|
rest |
One or more where objects |
Matching condition
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| and |
Where[]
|
exported optional |
Matching condition |
|
| between |
any[]
|
exported optional |
Matching condition |
|
| eq |
any
|
exported optional |
Matching condition |
|
| exists |
undefined | true | false
|
exported optional |
Matching condition |
|
| gt |
any
|
exported optional |
Matching condition |
|
| gte |
any
|
exported optional |
Matching condition |
|
| inq |
any[]
|
exported optional |
Matching condition |
|
| lt |
any
|
exported optional |
Matching condition |
|
| lte |
any
|
exported optional |
Matching condition |
|
| neq |
any
|
exported optional |
Matching condition |
|
| or |
Where[]
|
exported optional |
Matching condition |
Selection of fields
Example:
{afieldname: true}
Query filter object
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| fields |
Fields
|
exported optional |
To include/exclude fields |
|
| include |
Inclusion[]
|
exported optional |
To include related objects |
|
| limit |
undefined | number
|
exported optional |
Maximum number of entities |
|
| offset |
undefined | number
|
exported optional |
Offset N number of entities. An alias for |
|
| order |
string[]
|
exported optional |
Sorting order for matched entities. Each item should be formatted as
We might want to use |
|
| skip |
undefined | number
|
exported optional |
Skip N number of entities |
|
| where |
Where
|
exported optional |
The matching criteria |
Inclusion of related items
Note: scope means filter on related items
Example:
{relation: 'aRelationName', scope: {<AFilterObject>}}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| relation |
string
|
exported |
Inclusion of related items Note: scope means filter on related items Example:
|
|
| scope |
Filter
|
exported optional |
Inclusion of related items Note: scope means filter on related items Example:
|
Order by
Example:
{afieldname: 'ASC'}
Where object
Examples:
{afieldname: 'aName'}
{and: [{fieldone: 'one'}, {fieldtwo: 'two'}]}
{or: [{fieldone: 'one'}, {fieldtwo: 'two'}]}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| and |
Where[]
|
exported optional |
Where object Examples:
|
|
| or |
Where[]
|
exported optional |
Where object Examples:
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| strings |
TemplateStringsArray
|
|||
| keys |
any[]
|
rest |
Key/Value operations for connector implementations
Delete an entry by key
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key for the entry |
||
| options |
Options
|
optional |
Options for the operation |
Delete all entries
A promise of the number of entries deleted
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional |
Options for the operation |
Set up ttl for an entry by key
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key for the entry |
||
| ttl |
number
|
Key/Value operations for connector implementations |
||
| options |
Options
|
optional |
Options for the operation |
Get an entry by key
A promise of the entry
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key for the entry |
||
| options |
Options
|
optional |
Options for the operation |
Get an Iterator for matching keys
A promise of an iterator of entries
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
Filter for keys |
|
| options |
Options
|
optional |
Options for the operation |
Fetch all keys
A promise of an array of keys for all entries
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| options |
Options
|
optional |
Options for the operation |
Set an entry with key/value
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key for the entry |
||
| value |
DataObject<T>
|
Value for the entry |
||
| options |
Options
|
optional |
Options for the operation |
Get ttl for an entry by key
A promise of the TTL value
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Key for the entry |
||
| ttl |
number
|
Key/Value operations for connector implementations |
||
| options |
Options
|
optional |
Options for the operation |
Default implementation of CRUD repository using legacy juggler model and data source
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
constructorProperty exported public |
Legacy data source |
|
| entityClass |
|
constructorProperty exported public |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| modelClass |
PersistedModel
|
exported |
Default implementation of CRUD repository using legacy juggler model and data source |
Constructor of DefaultCrudRepository
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entityClass |
|
Constructor of DefaultCrudRepository |
||
| dataSource |
DataSource
|
Legacy data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
Partial<T>
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entities |
Partial<T>[]
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
T
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| command |
Command
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| parameters |
NamedParameters | PositionalParameters
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| filter |
Filter
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| data |
Partial<T>
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
T
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
T
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
Partial<T>
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| where |
Where
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
|
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| data |
Partial<T>
|
Default implementation of CRUD repository using legacy juggler model and data source |
||
| options |
Options
|
optional |
Default implementation of CRUD repository using legacy juggler model and data source |
This is a bridge to the legacy DAO class. The function mixes DAO methods into a model class and attach it to a given data source
The new model class with DAO (CRUD) operations
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
T
|
Model class |
||
| ds |
DataSource
|
Data source |
Repository implementation
Example:
User can import CrudRepositoryImpl and call its functions like:
CrudRepositoryImpl.find(somefilters, someoptions)
Or extend class CrudRepositoryImpl and override its functions:
export class TestRepository extends CrudRepositoryImpl<Test> {
constructor(dataSource: DataSource, model: Test) {
super(dataSource, Customer);
}
// Override `deleteAll` to disable the operation
deleteAll(where?: Where, options?: Options) {
return Promise.reject(new Error('deleteAll is disabled'));
}
}
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
constructorProperty exported public |
Repository implementation Example: User can import Or extend class
|
|
| model |
Class<T>
|
constructorProperty exported public |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataSource |
DataSource
|
Repository implementation Example: User can import Or extend class
|
||
| model |
Class<T>
|
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional |
Repository implementation Example: User can import Or extend class
|
|
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entities |
DataObject<T>[]
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional |
Repository implementation Example: User can import Or extend class
|
|
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| command |
Command
|
Repository implementation Example: User can import Or extend class
|
||
| parameters |
NamedParameters | PositionalParameters
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
Repository implementation Example: User can import Or extend class
|
|
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Repository implementation Example: User can import Or extend class
|
||
| data |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| data |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| where |
Where
|
optional |
Repository implementation Example: User can import Or extend class
|
|
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Repository implementation Example: User can import Or extend class
|
||
| data |
DataObject<T>
|
Repository implementation Example: User can import Or extend class
|
||
| options |
Options
|
optional |
Repository implementation Example: User can import Or extend class
|
Basic CRUD operations for ValueObject and Entity. No ID is required.
Count matching records
A promise of number of records matched
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional |
Matching criteria |
|
| options |
Options
|
optional |
Options for the operations |
Create a new record
A promise of record created
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataObject |
DataObject<T>
|
The data to be created |
||
| options |
Options
|
optional |
Options for the operations |
Create all records
A promise of an array of records created
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataObjects |
DataObject<T>[]
|
An array of data to be created |
||
| options |
Options
|
optional |
Options for the operations |
Delete matching records
A promise of number of records deleted
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| where |
Where
|
optional |
Matching criteria |
|
| options |
Options
|
optional |
Options for the operations |
Find matching records
A promise of an array of records found
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| filter |
Filter
|
optional |
Query filter |
|
| options |
Options
|
optional |
Options for the operations |
Updating matching records with attributes from the data object
A promise of number of records updated
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| dataObject |
DataObject<T>
|
The data to be updated |
||
| where |
Where
|
optional |
Matching criteria |
|
| options |
Options
|
optional |
Options for the operations |
CRUD operations for a repository of entities
Delete an entity
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Entity to be deleted |
||
| options |
Options
|
optional |
Options for the operations |
Delete an entity by id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Value for the entity id |
||
| options |
Options
|
optional |
Options for the operations |
Check if an entity exists for the given id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Value for the entity id |
||
| options |
Options
|
optional |
Options for the operations |
Find an entity by id
A promise of an entity found for the id
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Value for the entity id |
||
| filter |
Filter
|
optional |
CRUD operations for a repository of entities |
|
| options |
Options
|
optional |
Options for the operations |
Replace an entity by id
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Value for the entity id |
||
| data |
DataObject<T>
|
Data attributes to be replaced |
||
| options |
Options
|
optional |
Options for the operations |
Save an entity. If no id is present, create a new entity
A promise of an entity saved or null if the entity does not exist
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Entity to be saved |
||
| options |
Options
|
optional |
Options for the operations |
Update an entity
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| entity |
DataObject<T>
|
Entity to be updated |
||
| options |
Options
|
optional |
Options for the operations |
Update an entity by id with property/value pairs in the data object
Promise
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| id |
ID
|
Value for the entity id |
||
| data |
DataObject<T>
|
Data attributes to be updated |
||
| options |
Options
|
optional |
Options for the operations |
Base interface for a repository of entities
Execute a query with the given parameter object or an array of parameters
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| command |
Command
|
The query string or command object |
||
| parameters |
NamedParameters | PositionalParameters
|
The object with name/value pairs or an array of parameter values |
||
| options |
Options
|
optional |
Options |
Any type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
|
"any" | exported |
Any type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Any type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Any type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Any type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Any type |
Array type, such as string[]
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| itemType |
Type<T>
|
constructorProperty exported public |
Array type, such as string[] |
|
| name |
|
"array" | exported |
Array type, such as string[] |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| itemType |
Type<T>
|
Array type, such as string[] |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Array type, such as string[] |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Array type, such as string[] |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Array type, such as string[] |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
Array<T> | null | undefined
|
Array type, such as string[] |
Boolean type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
|
"boolean" | exported |
Boolean type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Boolean type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Boolean type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Boolean type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
boolean | null | undefined
|
Boolean type |
Buffer (binary) type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
|
"buffer" | exported |
Buffer (binary) type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Buffer (binary) type |
||
| options |
Options
|
optional |
Buffer (binary) type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Buffer (binary) type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Buffer (binary) type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
Buffer | null | undefined
|
Buffer (binary) type |
||
| options |
Options
|
optional |
Buffer (binary) type |
Date type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
|
"date" | exported |
Date type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Date type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Date type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Date type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
Date | null | undefined
|
Date type |
Model type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<T>
|
constructorProperty exported public |
Model type |
|
| name |
string
|
"model" | exported |
Model type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| modelClass |
Class<T>
|
Model type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
T | null | undefined
|
Model type |
Number type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
|
"number" | exported |
Number type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Number type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Number type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Number type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
number | null | undefined
|
Number type |
Object type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
"object" | exported |
Object type |
| type |
Class<T>
|
constructorProperty exported public |
Object type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| type |
Class<T>
|
Object type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Object type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Object type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Object type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
T | null | undefined
|
Object type |
String type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
|
"string" | exported |
String type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
String type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
String type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
String type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
string | null | undefined
|
String type |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| name |
string
|
exported |
Name of the type |
Coerce the value into this type
Coerced value of this type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
The value to be coerced |
||
| options |
Options
|
optional |
Options for coercion |
Generate the default value for this type
Check if the given value can be coerced into this type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
The value to to be coerced |
||
| options |
Options
|
optional |
Test if the given value is an instance of this type
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
The value |
Serialize a value into json
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
T | null | undefined
|
The value of this type |
||
| options |
Options
|
optional |
Options for serialization |
Union type, such as string | number
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| itemTypes |
Type<any>[]
|
constructorProperty exported public |
Union type, such as string | number |
|
| name |
|
"union" | exported |
Union type, such as string | number |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| itemTypes |
Type<any>[]
|
Union type, such as string | number |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Union type, such as string | number |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Union type, such as string | number |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Union type, such as string | number |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| value |
any
|
Union type, such as string | number |