Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@piggly/ddd-toolkit

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@piggly/ddd-toolkit - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

5

dist/cjs/core/Repository.d.ts

@@ -6,3 +6,2 @@ import { PaginateQuery } from '../types';

import Adapter from './Adapter';
import DatabaseContext from './DatabaseContext';
/**

@@ -12,3 +11,3 @@ * @file A repository with default methods to manage entities.

*/
export default abstract class Repository<Entity extends BaseEntity<any>, PersistenceRecord extends Record<string, any>> {
export default abstract class Repository<Entity extends BaseEntity<any>, PersistenceRecord extends Record<string, any>, DatabaseContext> {
/**

@@ -23,3 +22,3 @@ * Database context.

*/
protected _context: DatabaseContext;
protected _database: DatabaseContext;
/**

@@ -26,0 +25,0 @@ * Constructor.

4

dist/cjs/core/Repository.js

@@ -17,3 +17,3 @@ "use strict";

*/
_context;
_database;
/**

@@ -30,3 +30,3 @@ * Constructor.

constructor(context) {
this._context = context;
this._database = context;
}

@@ -33,0 +33,0 @@ /**

@@ -17,15 +17,4 @@ import DatabaseContext from './DatabaseContext';

*/
protected _context: DatabaseContext;
protected _connection: DatabaseContext;
/**
* A map of repositories.
* You may expose each repository individually.
*
* @type {Map<string, BaseRepository>}
* @protected
* @memberof UnitOfWork
* @since 1.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
protected _repos: Map<string, BaseRepository<any, any>>;
/**
* Constructor.

@@ -52,3 +41,3 @@ * Initiate all repositories with same context.

*/
repository<Repository extends BaseRepository<any, any>>(name: string): Repository;
abstract repository<Repository extends BaseRepository<any, any, any>>(name: string): Repository;
/**

@@ -55,0 +44,0 @@ * Begin a transaction in database context.

@@ -17,15 +17,4 @@ "use strict";

*/
_context;
_connection;
/**
* A map of repositories.
* You may expose each repository individually.
*
* @type {Map<string, BaseRepository>}
* @protected
* @memberof UnitOfWork
* @since 1.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
_repos = new Map();
/**
* Constructor.

@@ -42,22 +31,6 @@ * Initiate all repositories with same context.

constructor(context) {
this._context = context;
this._connection = context;
}
/**
* Get a repository by its name.
*
* @param {string} name
* @returns {Repository}
* @public
* @memberof UnitOfWork
* @since 1.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
repository(name) {
if (this._repos.has(name) === false) {
throw new Error(`Repository ${name} not found.`);
}
return this._repos.get(name);
}
}
exports.default = UnitOfWork;
//# sourceMappingURL=UnitOfWork.js.map

@@ -6,3 +6,2 @@ import { PaginateQuery } from '../types';

import Adapter from './Adapter';
import DatabaseContext from './DatabaseContext';
/**

@@ -12,3 +11,3 @@ * @file A repository with default methods to manage entities.

*/
export default abstract class Repository<Entity extends BaseEntity<any>, PersistenceRecord extends Record<string, any>> {
export default abstract class Repository<Entity extends BaseEntity<any>, PersistenceRecord extends Record<string, any>, DatabaseContext> {
/**

@@ -23,3 +22,3 @@ * Database context.

*/
protected _context: DatabaseContext;
protected _database: DatabaseContext;
/**

@@ -26,0 +25,0 @@ * Constructor.

@@ -15,3 +15,3 @@ /**

*/
_context;
_database;
/**

@@ -28,3 +28,3 @@ * Constructor.

constructor(context) {
this._context = context;
this._database = context;
}

@@ -31,0 +31,0 @@ /**

@@ -17,15 +17,4 @@ import DatabaseContext from './DatabaseContext';

*/
protected _context: DatabaseContext;
protected _connection: DatabaseContext;
/**
* A map of repositories.
* You may expose each repository individually.
*
* @type {Map<string, BaseRepository>}
* @protected
* @memberof UnitOfWork
* @since 1.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
protected _repos: Map<string, BaseRepository<any, any>>;
/**
* Constructor.

@@ -52,3 +41,3 @@ * Initiate all repositories with same context.

*/
repository<Repository extends BaseRepository<any, any>>(name: string): Repository;
abstract repository<Repository extends BaseRepository<any, any, any>>(name: string): Repository;
/**

@@ -55,0 +44,0 @@ * Begin a transaction in database context.

@@ -15,15 +15,4 @@ /**

*/
_context;
_connection;
/**
* A map of repositories.
* You may expose each repository individually.
*
* @type {Map<string, BaseRepository>}
* @protected
* @memberof UnitOfWork
* @since 1.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
_repos = new Map();
/**
* Constructor.

@@ -40,21 +29,5 @@ * Initiate all repositories with same context.

constructor(context) {
this._context = context;
this._connection = context;
}
/**
* Get a repository by its name.
*
* @param {string} name
* @returns {Repository}
* @public
* @memberof UnitOfWork
* @since 1.0.0
* @author Caique Araujo <caique@piggly.com.br>
*/
repository(name) {
if (this._repos.has(name) === false) {
throw new Error(`Repository ${name} not found.`);
}
return this._repos.get(name);
}
}
//# sourceMappingURL=UnitOfWork.js.map
{
"name": "@piggly/ddd-toolkit",
"version": "1.0.2",
"version": "1.1.0",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc