Page Contents

Home > @loopback/repository

repository package

@loopback/repository

Classes

Class Description
AnyType Any type
ArrayType Array type, such as string[]
BooleanType Boolean type
BufferType Buffer (binary) type
CrudRepositoryImpl Repository implementation
DateType Date type
DefaultBelongsToRepository  
DefaultCrudRepository Default implementation of CRUD repository using legacy juggler model and data source
DefaultHasManyRepository  
DefaultHasOneRepository  
DefaultKeyValueRepository An implementation of KeyValueRepository based on loopback-datasource-juggler
Entity Base class for entities which have unique ids
EntityNotFoundError  
Event Domain events
FilterBuilder A builder for Filter. It provides fleunt APIs to add clauses such as fields, order, where, limit, offset, and include.
InvalidRelationError  
Model Base class for models
ModelDefinition Definition for a model
ModelMetadataHelper  
ModelType Model type
NumberType Number type
ObjectType Object type
RepositoryMetadata Metadata for a repository
RepositoryMixinDoc A dummy class created to generate the tsdoc for the members in repository mixin. Please don’t use it.The members are implemented in function RepositoryMixin
StringType String type
UnionType Union type, such as string | number
ValueObject Base class for value objects - An object that contains attributes but has no conceptual identity. They should be treated as immutable.
WhereBuilder A builder for Where object. It provides fluent APIs to add clauses such as and, or, and other operators.

Enumerations

Enumeration Description
RelationType  

Functions

Function Description
belongsTo(targetResolver, definition, propertyDefinition) Decorator for belongsTo
bindModel(modelClass, ds) 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
buildModelDefinition(target, def) Build model definition from decorations
constrainDataObject(originalData, constraint) A utility function which takes a model instance data and enforces constraint(s) on it
constrainDataObjects(originalData, constraint) A utility function which takes an array of model instance data and enforces constraint(s) on it
constrainFilter(originalFilter, constraint) A utility function which takes a filter and enforces constraint(s) on it
constrainWhere(originalWhere, constraint) A utility function which takes a where filter and enforces constraint(s) on it
createBelongsToAccessor(belongsToMetadata, targetRepoGetter, sourceRepository) Enforces a BelongsTo constraint on a repository
createHasManyRepositoryFactory(relationMetadata, targetRepositoryGetter) Enforces a constraint on a repository based on a relationship contract between models. For example, if a Customer model is related to an Order model via a HasMany relation, then, the relational repository returned by the factory function would be constrained by a Customer model instance’s id(s).
createHasOneRepositoryFactory(relationMetadata, targetRepositoryGetter) Enforces a constraint on a repository based on a relationship contract between models. For example, if a Customer model is related to an Address model via a HasOne relation, then, the relational repository returned by the factory function would be constrained by a Customer model instance’s id(s).
embedsMany(definition) Decorator for embedsMany
embedsOne(definition) Decorator for embedsOne
ensurePromise(p) Ensure the value is a promise
filterTemplate(strings, keys)  
getModelRelations(modelCtor) Get metadata of all relations defined on a given model class.
hasMany(targetResolver, definition) Decorator for hasMany Calls property.array decorator underneath the hood and infers foreign key name from target model name unless explicitly specified
hasOne(targetResolver, definition)  
isBuiltinType(fn) Check if the provided function is a built-in type provided by JavaScript and/or Node.js. E.g. Number, Array, Buffer, etc.
isEntityNotFoundError(e)  
isFilter(candidate) TypeGuard for Filter
isInvalidRelationError(e)  
isTypeResolver(fn) A function that checks whether a function is a TypeResolver or not.
model(definition) Decorator for model definitions
property(definition) Decorator for model properties
referencesMany(definition) Decorator for referencesMany
referencesOne(definition) Decorator for referencesOne
relation(definition) Decorator for relations
repository(repositoryName) Decorator for repository injections on properties or method arguments
repository(model, dataSource) Decorator for DefaultCrudRepository generation and injection on properties or method arguments based on the given model and dataSource (or their names)
RepositoryMixin(superClass) 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.
resolveType(fn) Resolve a type value that may have been provided via TypeResolver.
resolveType(fn)  

Interfaces

Interface Description
AndClause And clause
AnyObject Objects with open properties
ApplicationWithRepositories Interface for an Application mixed in with RepositoryMixin
BelongsToDefinition  
BelongsToRepository CRUD operations for a target repository of a BelongsTo relation
Class Interface for classes with new operator and static properties/methods
Connector Common properties/operations for connectors
ConstructorFunction Interface for constructor functions without new operator.
Count Count of Model instances that were successful for methods like updateAll, deleteAll, etc.
CrudConnector CRUD operations for connector implementations
CrudRepository Basic CRUD operations for ValueObject and Entity. No ID is required.
DataSource DataSource denotes a configured connector
EntityCrudRepository CRUD operations for a repository of entities
EntityRepository Base interface for a repository of entities
ExecutableRepository  
Filter Query filter object
HasManyDefinition  
HasManyRepository CRUD operations for a target repository of a HasMany relation
HasOneDefinition  
HasOneRepository CRUD operations for a target repository of a HasMany relation
Inclusion Inclusion of related itemsNote: scope means filter on related itemsExample: {relation: 'aRelationName', scope: {<AFilterObject>}}
KeyValueRepository Key/Value operations for connector implementations
KVConnector Key/Value operations for connector implementations
ModelDefinitionSyntax DSL for building a model definition.
OrClause Or clause
Persistable  
PropertyDefinition Property definition for a model
PropertyForm See https://github.com/strongloop/loopback-datasource-juggler/issues/432
RelationDefinitionBase  
Repository  
SchemaMigrationOptions  
Type  

Namespaces

Namespace Description
juggler  
property  
repository  

Variables

Variable Description
ANY  
BOOLEAN  
BUFFER  
CountSchema JSON Schema describing the Count interface. It’s the response type for REST calls to APIs which return Count
DATE  
MODEL_KEY  
MODEL_PROPERTIES_KEY  
MODEL_WITH_PROPERTIES_KEY  
NUMBER  
RELATIONS_KEY  
STRING  

Type Aliases

Type Alias Description
BelongsToAccessor  
Callback Type alias for Node.js callback functions
Command Type for a command
Condition Condition clause
Constructor Constructor type - class or function
DataObject Type alias for strongly or weakly typed objects of T
DeepPartial An extension of the built-in Partial type which allows partial values in deeply nested properties too.
Direction Order by direction
EntityData  
EntityResolver  
Fields Selection of fieldsExample: {afieldname: true}
HasManyRepositoryFactory  
HasOneRepositoryFactory  
KeyOf Key types of a given model, excluding operators
KeyValueFilter Filter for keys
NamedParameters Named parameters, such as {x: 1, y: 'a'}
Operators Operators for where clauses
Options Type alias for Node.js options object
Order Order byExample: {afieldname: 'ASC'}
PositionalParameters Positional parameters, such as [1, ‘a’]
PredicateComparison Matching predicate comparison
PropertyMap  
PropertyType This module defines the key classes representing building blocks for Domain Driven Design. See https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks
RelationDefinitionMap A key-value map describing model relations. A relation name is used as the key, a relation definition is the value.
RelationMetadata A union type describing all possible Relation metadata objects.
RepositoryDecorator Type definition for decorators returned by @repository decorator factory
ShortHandEqualType Value types for {propertyName: value}
TypeResolver A type resolver is a function that returns a class representing the type, typically a Model or Entity (e.g. Product).We use type resolvers to break require() loops when defining relations. The target model (class) is provided via a provider, thus deferring the actual reference to the class itself until later, when both sides of the relation are created as JavaScript classes.
Where Where clause