Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
b9f9b36b87 | |||
df2fadfa01 | |||
8b2beb3485 | |||
144a620f43 | |||
c241247845 | |||
81e39d09e4 | |||
8e51b518b1 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@pushrocks/smartdata",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.7",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smartdata",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^4.0.20",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartdata",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.7",
|
||||
"private": false,
|
||||
"description": "do more with data",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -213,6 +213,7 @@ tap.test('should ', async () => {})
|
||||
// close the database connection
|
||||
// =======================================
|
||||
tap.test('should close the database connection', async (tools) => {
|
||||
await testDb.mongoDb.dropDatabase();
|
||||
await testDb.close();
|
||||
try {
|
||||
await mongod.stop();
|
||||
|
@ -41,7 +41,7 @@ export function Collection(dbArg: SmartdataDb | TDelayed<SmartdataDb>) {
|
||||
};
|
||||
}
|
||||
|
||||
interface IManager {
|
||||
export interface IManager {
|
||||
db: SmartdataDb
|
||||
}
|
||||
|
||||
@ -70,6 +70,15 @@ interface IManager {
|
||||
}
|
||||
return collectionFactory.getCollection(constructor.name, dbArg);
|
||||
}
|
||||
public static get manager() {
|
||||
let manager: TManager;
|
||||
if (managerArg['db']) {
|
||||
manager = (managerArg as TManager);
|
||||
} else {
|
||||
manager = (managerArg as TDelayed<TManager>)();
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
public get manager() {
|
||||
let manager: TManager;
|
||||
if (managerArg['db']) {
|
||||
|
@ -3,7 +3,7 @@ import * as plugins from './smartdata.plugins';
|
||||
import { ObjectMap } from '@pushrocks/lik';
|
||||
|
||||
import { SmartdataDb } from './smartdata.classes.db';
|
||||
import { SmartdataCollection } from './smartdata.classes.collection';
|
||||
import { IManager, SmartdataCollection } from './smartdata.classes.collection';
|
||||
|
||||
export type TDocCreation = 'db' | 'new' | 'mixed';
|
||||
|
||||
@ -41,12 +41,14 @@ export function unI() {
|
||||
};
|
||||
}
|
||||
|
||||
export class SmartDataDbDoc<T extends TImplements, TImplements> {
|
||||
export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends IManager = any> {
|
||||
/**
|
||||
* the collection object an Doc belongs to
|
||||
*/
|
||||
public static collection: SmartdataCollection<any>;
|
||||
public collection: SmartdataCollection<any>;
|
||||
public static manager;;
|
||||
public manager: TManager;
|
||||
|
||||
/**
|
||||
* how the Doc in memory was created, may prove useful later.
|
||||
|
Reference in New Issue
Block a user