@piggly/ddd-toolkit
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -7,7 +7,7 @@ import Service from './Service'; | ||
*/ | ||
export default abstract class ApplicationService extends Service { | ||
export default abstract class ApplicationService<UoW extends UnitOfWork<any>> extends Service { | ||
/** | ||
* UnitOfWork with repositories. | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -18,7 +18,7 @@ * @memberof Service | ||
*/ | ||
protected _unitofwork: UnitOfWork; | ||
protected _unitofwork: UoW; | ||
/** | ||
* Constructor. | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -30,3 +30,3 @@ * @constructor | ||
*/ | ||
constructor(unitofwork: UnitOfWork); | ||
constructor(unitofwork: UoW); | ||
} |
@@ -13,3 +13,3 @@ "use strict"; | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -24,3 +24,3 @@ * @memberof Service | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -27,0 +27,0 @@ * @constructor |
@@ -7,7 +7,7 @@ import Service from './Service'; | ||
*/ | ||
export default abstract class DomainService extends Service { | ||
export default abstract class DomainService<UoW extends UnitOfWork<any>> extends Service { | ||
/** | ||
* UnitOfWork with repositories. | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -18,7 +18,7 @@ * @memberof Service | ||
*/ | ||
protected _unitofwork: UnitOfWork; | ||
protected _unitofwork: UoW; | ||
/** | ||
* Constructor. | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -30,3 +30,3 @@ * @constructor | ||
*/ | ||
constructor(unitofwork: UnitOfWork); | ||
constructor(unitofwork: UoW); | ||
} |
@@ -13,3 +13,3 @@ "use strict"; | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -24,3 +24,3 @@ * @memberof Service | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -27,0 +27,0 @@ * @constructor |
@@ -33,2 +33,15 @@ import { PaginateQuery } from '../types'; | ||
/** | ||
* Reload an entity. | ||
* | ||
* @param {Entity} entity | ||
* @returns {Promise<Entity | undefined>} | ||
* @public | ||
* @async | ||
* @abstract | ||
* @memberof Repository | ||
* @since 1.1.4 | ||
* @author Caique Araujo <caique@piggly.com.br> | ||
*/ | ||
reload(entity: Entity): Promise<Entity | undefined>; | ||
/** | ||
* Find an entity by its id. | ||
@@ -35,0 +48,0 @@ * |
@@ -32,2 +32,17 @@ "use strict"; | ||
/** | ||
* Reload an entity. | ||
* | ||
* @param {Entity} entity | ||
* @returns {Promise<Entity | undefined>} | ||
* @public | ||
* @async | ||
* @abstract | ||
* @memberof Repository | ||
* @since 1.1.4 | ||
* @author Caique Araujo <caique@piggly.com.br> | ||
*/ | ||
reload(entity) { | ||
return this.findById(entity.id); | ||
} | ||
/** | ||
* Save an entity. | ||
@@ -34,0 +49,0 @@ * If the entity has a not random id, it will be updated. |
@@ -7,7 +7,7 @@ import DatabaseContext from './DatabaseContext'; | ||
*/ | ||
export default abstract class UnitOfWork { | ||
export default abstract class UnitOfWork<DatabaseConnection extends DatabaseContext> { | ||
/** | ||
* Database context. | ||
* | ||
* @type {DatabaseContext<Context>} _context | ||
* @type {DatabaseConnection} _context | ||
* @protected | ||
@@ -18,3 +18,3 @@ * @memberof UnitOfWork | ||
*/ | ||
protected _connection: DatabaseContext; | ||
protected _connection: DatabaseConnection; | ||
/** | ||
@@ -24,3 +24,3 @@ * Constructor. | ||
* | ||
* @param {DatabaseContext<Context>} context | ||
* @param {DatabaseConnection} context | ||
* @public | ||
@@ -32,3 +32,3 @@ * @constructor | ||
*/ | ||
constructor(context: DatabaseContext); | ||
constructor(context: DatabaseConnection); | ||
/** | ||
@@ -35,0 +35,0 @@ * Get a repository by its name. |
@@ -11,3 +11,3 @@ "use strict"; | ||
* | ||
* @type {DatabaseContext<Context>} _context | ||
* @type {DatabaseConnection} _context | ||
* @protected | ||
@@ -23,3 +23,3 @@ * @memberof UnitOfWork | ||
* | ||
* @param {DatabaseContext<Context>} context | ||
* @param {DatabaseConnection} context | ||
* @public | ||
@@ -26,0 +26,0 @@ * @constructor |
@@ -7,7 +7,7 @@ import Service from './Service'; | ||
*/ | ||
export default abstract class ApplicationService extends Service { | ||
export default abstract class ApplicationService<UoW extends UnitOfWork<any>> extends Service { | ||
/** | ||
* UnitOfWork with repositories. | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -18,7 +18,7 @@ * @memberof Service | ||
*/ | ||
protected _unitofwork: UnitOfWork; | ||
protected _unitofwork: UoW; | ||
/** | ||
* Constructor. | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -30,3 +30,3 @@ * @constructor | ||
*/ | ||
constructor(unitofwork: UnitOfWork); | ||
constructor(unitofwork: UoW); | ||
} |
@@ -10,3 +10,3 @@ import Service from './Service'; | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -21,3 +21,3 @@ * @memberof Service | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -24,0 +24,0 @@ * @constructor |
@@ -7,7 +7,7 @@ import Service from './Service'; | ||
*/ | ||
export default abstract class DomainService extends Service { | ||
export default abstract class DomainService<UoW extends UnitOfWork<any>> extends Service { | ||
/** | ||
* UnitOfWork with repositories. | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -18,7 +18,7 @@ * @memberof Service | ||
*/ | ||
protected _unitofwork: UnitOfWork; | ||
protected _unitofwork: UoW; | ||
/** | ||
* Constructor. | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -30,3 +30,3 @@ * @constructor | ||
*/ | ||
constructor(unitofwork: UnitOfWork); | ||
constructor(unitofwork: UoW); | ||
} |
@@ -10,3 +10,3 @@ import Service from './Service'; | ||
* | ||
* @type {UnitOfWork} | ||
* @type {UoW} | ||
* @protected | ||
@@ -21,3 +21,3 @@ * @memberof Service | ||
* | ||
* @param {UnitOfWork} unitofwork | ||
* @param {UoW} unitofwork | ||
* @public | ||
@@ -24,0 +24,0 @@ * @constructor |
@@ -33,2 +33,15 @@ import { PaginateQuery } from '../types'; | ||
/** | ||
* Reload an entity. | ||
* | ||
* @param {Entity} entity | ||
* @returns {Promise<Entity | undefined>} | ||
* @public | ||
* @async | ||
* @abstract | ||
* @memberof Repository | ||
* @since 1.1.4 | ||
* @author Caique Araujo <caique@piggly.com.br> | ||
*/ | ||
reload(entity: Entity): Promise<Entity | undefined>; | ||
/** | ||
* Find an entity by its id. | ||
@@ -35,0 +48,0 @@ * |
@@ -30,2 +30,17 @@ /** | ||
/** | ||
* Reload an entity. | ||
* | ||
* @param {Entity} entity | ||
* @returns {Promise<Entity | undefined>} | ||
* @public | ||
* @async | ||
* @abstract | ||
* @memberof Repository | ||
* @since 1.1.4 | ||
* @author Caique Araujo <caique@piggly.com.br> | ||
*/ | ||
reload(entity) { | ||
return this.findById(entity.id); | ||
} | ||
/** | ||
* Save an entity. | ||
@@ -32,0 +47,0 @@ * If the entity has a not random id, it will be updated. |
@@ -7,7 +7,7 @@ import DatabaseContext from './DatabaseContext'; | ||
*/ | ||
export default abstract class UnitOfWork { | ||
export default abstract class UnitOfWork<DatabaseConnection extends DatabaseContext> { | ||
/** | ||
* Database context. | ||
* | ||
* @type {DatabaseContext<Context>} _context | ||
* @type {DatabaseConnection} _context | ||
* @protected | ||
@@ -18,3 +18,3 @@ * @memberof UnitOfWork | ||
*/ | ||
protected _connection: DatabaseContext; | ||
protected _connection: DatabaseConnection; | ||
/** | ||
@@ -24,3 +24,3 @@ * Constructor. | ||
* | ||
* @param {DatabaseContext<Context>} context | ||
* @param {DatabaseConnection} context | ||
* @public | ||
@@ -32,3 +32,3 @@ * @constructor | ||
*/ | ||
constructor(context: DatabaseContext); | ||
constructor(context: DatabaseConnection); | ||
/** | ||
@@ -35,0 +35,0 @@ * Get a repository by its name. |
@@ -9,3 +9,3 @@ /** | ||
* | ||
* @type {DatabaseContext<Context>} _context | ||
* @type {DatabaseConnection} _context | ||
* @protected | ||
@@ -21,3 +21,3 @@ * @memberof UnitOfWork | ||
* | ||
* @param {DatabaseContext<Context>} context | ||
* @param {DatabaseConnection} context | ||
* @public | ||
@@ -24,0 +24,0 @@ * @constructor |
{ | ||
"name": "@piggly/ddd-toolkit", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "A bunch of tools to use Model-Driven Design and Domain-Driven Design architecture in a back-end application.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121050
3536