fix(core): update

This commit is contained in:
Philipp Kunz 2020-08-18 15:10:44 +00:00
parent adb198af01
commit 85a196c8c1
5 changed files with 498 additions and 652 deletions

1094
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
"@pushrocks/smartlog": "^2.0.36", "@pushrocks/smartlog": "^2.0.36",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartstring": "^3.0.18", "@pushrocks/smartstring": "^3.0.18",
"@tsclass/tsclass": "^3.0.24",
"@types/lodash": "^4.14.159", "@types/lodash": "^4.14.159",
"@types/mongodb": "^3.5.26", "@types/mongodb": "^3.5.26",
"lodash": "^4.17.20", "lodash": "^4.17.20",
@ -40,7 +41,7 @@
"@types/mongodb-memory-server": "^2.3.0", "@types/mongodb-memory-server": "^2.3.0",
"@types/node": "^14.6.0", "@types/node": "^14.6.0",
"@types/shortid": "0.0.29", "@types/shortid": "0.0.29",
"mongodb-memory-server": "6.6.3", "mongodb-memory-server": "^6.6.4",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },

View File

@ -18,10 +18,9 @@ let smartdataOptions: smartdata.IMongoDescriptor;
let mongod: mongoPlugin.MongoMemoryServer; let mongod: mongoPlugin.MongoMemoryServer;
tap.skip.test('should create a testinstance as database', async () => { tap.skip.test('should create a testinstance as database', async () => {
mongod = new mongoPlugin.MongoMemoryServer({ mongod = new mongoPlugin.MongoMemoryServer({});
});
console.log('created mongod instance'); console.log('created mongod instance');
await mongod._startUpInstance().catch(err => { await mongod._startUpInstance().catch((err) => {
console.log(err); console.log(err);
}); });
console.log('mongod started'); console.log('mongod started');
@ -38,7 +37,7 @@ tap.test('should connect to atlas', async (tools) => {
const databaseName = `test-smartdata-${smartunique.shortId()}`; const databaseName = `test-smartdata-${smartunique.shortId()}`;
testDb = new smartdata.SmartdataDb({ testDb = new smartdata.SmartdataDb({
mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'), mongoDbUrl: testQenv.getEnvVarOnDemand('MONGO_URL'),
mongoDbName: databaseName mongoDbName: databaseName,
}); });
}); });
@ -151,7 +150,6 @@ tap.test('should store a new Truck', async () => {
tap.test('should close the database connection', async (tools) => { tap.test('should close the database connection', async (tools) => {
await testDb.close(); await testDb.close();
try { try {
await mongod.stop(); await mongod.stop();
} catch (e) {} } catch (e) {}
}); });

View File

@ -89,7 +89,9 @@ export class SmartDataDbDoc<T, TImplements> {
} }
} }
public static async getInstances<T>(filterArg: Partial<T>): Promise<T[]> { public static async getInstances<T>(
filterArg: plugins.tsclass.typeFest.PartialDeep<T>
): Promise<T[]> {
const self: any = this; // fool typesystem const self: any = this; // fool typesystem
let referenceMongoDBCollection: SmartdataCollection<T>; let referenceMongoDBCollection: SmartdataCollection<T>;
@ -111,7 +113,9 @@ export class SmartDataDbDoc<T, TImplements> {
return returnArray; return returnArray;
} }
public static async getInstance<T>(filterArg: Partial<T>): Promise<T> { public static async getInstance<T>(
filterArg: plugins.tsclass.typeFest.PartialDeep<T>
): Promise<T> {
const result = await this.getInstances<T>(filterArg); const result = await this.getInstances<T>(filterArg);
if (result && result.length > 0) { if (result && result.length > 0) {
return result[0]; return result[0];

View File

@ -1,4 +1,9 @@
import * as assert from 'assert'; // tsclass scope
import * as tsclass from '@tsclass/tsclass';
export { tsclass };
// @pushrocks scope
import * as smartlog from '@pushrocks/smartlog'; import * as smartlog from '@pushrocks/smartlog';
import * as lodash from 'lodash'; import * as lodash from 'lodash';
import * as mongodb from 'mongodb'; import * as mongodb from 'mongodb';
@ -6,4 +11,4 @@ import * as smartq from '@pushrocks/smartpromise';
import * as smartstring from '@pushrocks/smartstring'; import * as smartstring from '@pushrocks/smartstring';
import * as smartunique from '@pushrocks/smartunique'; import * as smartunique from '@pushrocks/smartunique';
export { assert, smartlog, lodash, smartq, mongodb, smartstring, smartunique }; export { smartlog, lodash, smartq, mongodb, smartstring, smartunique };