fix(core): update

This commit is contained in:
Philipp Kunz 2021-11-12 17:22:31 +01:00
parent 8301eb79a2
commit 48cffb5ac2
8 changed files with 4985 additions and 3314 deletions

8240
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,27 +21,27 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartdata#README", "homepage": "https://gitlab.com/pushrocks/smartdata#README",
"dependencies": { "dependencies": {
"@pushrocks/lik": "^4.0.20", "@pushrocks/lik": "^5.0.0",
"@pushrocks/smartlog": "^2.0.39", "@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpromise": "^3.1.5", "@pushrocks/smartpromise": "^3.1.5",
"@pushrocks/smartstring": "^3.0.24", "@pushrocks/smartstring": "^3.0.24",
"@pushrocks/smartunique": "^3.0.3", "@pushrocks/smartunique": "^3.0.3",
"@tsclass/tsclass": "^3.0.33", "@tsclass/tsclass": "^3.0.36",
"@types/lodash": "^4.14.169", "@types/lodash": "^4.14.176",
"@types/mongodb": "^3.6.12", "@types/mongodb": "^4.0.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mongodb": "^3.6.6", "mongodb": "^4.1.4",
"runtime-type-checks": "0.0.4" "runtime-type-checks": "0.0.4"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.28",
"@gitzone/tstest": "^1.0.54", "@gitzone/tstest": "^1.0.60",
"@pushrocks/qenv": "^4.0.10", "@pushrocks/qenv": "^4.0.10",
"@pushrocks/tapbundle": "^3.2.14", "@pushrocks/tapbundle": "^3.2.14",
"@types/mongodb-memory-server": "^2.3.0", "@types/mongodb-memory-server": "^2.3.0",
"@types/node": "^15.3.0", "@types/node": "^16.11.7",
"@types/shortid": "0.0.29", "@types/shortid": "0.0.29",
"mongodb-memory-server": "^6.9.6", "mongodb-memory-server": "^8.0.2",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },

View File

@ -20,16 +20,11 @@ let smartdataOptions: smartdata.IMongoDescriptor;
let mongod: mongoPlugin.MongoMemoryServer; let mongod: mongoPlugin.MongoMemoryServer;
tap.test('should create a testinstance as database', async () => { tap.test('should create a testinstance as database', async () => {
mongod = new mongoPlugin.MongoMemoryServer({}); mongod = await mongoPlugin.MongoMemoryServer.create();
console.log('created mongod instance'); console.log('created mongod instance');
await mongod._startUpInstance().catch((err) => {
console.log(err);
});
console.log('mongod started'); console.log('mongod started');
smartdataOptions = { smartdataOptions = {
mongoDbName: await mongod.getDbName(), mongoDbUrl: mongod.getUri(),
mongoDbPass: '',
mongoDbUrl: await mongod.getUri(),
}; };
console.log(smartdataOptions); console.log(smartdataOptions);
testDb = new smartdata.SmartdataDb(smartdataOptions); testDb = new smartdata.SmartdataDb(smartdataOptions);

View File

@ -22,16 +22,11 @@ let mongod: mongoPlugin.MongoMemoryServer;
const totalCars = 2000; const totalCars = 2000;
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 = await mongoPlugin.MongoMemoryServer.create();
console.log('created mongod instance'); console.log('created mongod instance');
await mongod._startUpInstance().catch((err) => {
console.log(err);
});
console.log('mongod started'); console.log('mongod started');
smartdataOptions = { smartdataOptions = {
mongoDbName: await mongod.getDbName(), mongoDbUrl: mongod.getUri(),
mongoDbPass: '',
mongoDbUrl: await mongod.getUri(),
}; };
console.log(smartdataOptions); console.log(smartdataOptions);
testDb = new smartdata.SmartdataDb(smartdataOptions); testDb = new smartdata.SmartdataDb(smartdataOptions);

View File

@ -22,16 +22,11 @@ let mongod: mongoPlugin.MongoMemoryServer;
const totalCars = 2000; const totalCars = 2000;
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 = await mongoPlugin.MongoMemoryServer.create();
console.log('created mongod instance'); console.log('created mongod instance');
await mongod._startUpInstance().catch((err) => {
console.log(err);
});
console.log('mongod started'); console.log('mongod started');
smartdataOptions = { smartdataOptions = {
mongoDbName: await mongod.getDbName(), mongoDbUrl: mongod.getUri(),
mongoDbPass: '',
mongoDbUrl: await mongod.getUri(),
}; };
console.log(smartdataOptions); console.log(smartdataOptions);
testDb = new smartdata.SmartdataDb(smartdataOptions); testDb = new smartdata.SmartdataDb(smartdataOptions);

View File

@ -235,9 +235,7 @@ export class SmartdataCollection<T> {
await this.init(); await this.init();
await this.checkDoc(dbDocArg); await this.checkDoc(dbDocArg);
const identifiableObject = await dbDocArg.createIdentifiableObject(); const identifiableObject = await dbDocArg.createIdentifiableObject();
await this.mongoDbCollection.deleteOne(identifiableObject, { await this.mongoDbCollection.deleteOne(identifiableObject);
w: 1,
});
} }
/** /**

View File

@ -7,8 +7,8 @@ export class SmartdataDbCursor<T = any> {
// STATIC // STATIC
// INSTANCE // INSTANCE
public mongodbCursor: plugins.mongodb.Cursor<T>; public mongodbCursor: plugins.mongodb.FindCursor<T>;
constructor(cursorArg: plugins.mongodb.Cursor<T>) { constructor(cursorArg: plugins.mongodb.FindCursor<T>) {
this.mongodbCursor = cursorArg this.mongodbCursor = cursorArg
}; };

View File

@ -47,8 +47,6 @@ export class SmartdataDb {
.replace('<dbname>', this.smartdataOptions.mongoDbName); .replace('<dbname>', this.smartdataOptions.mongoDbName);
this.mongoDbClient = await plugins.mongodb.MongoClient.connect(finalConnectionUrl, { this.mongoDbClient = await plugins.mongodb.MongoClient.connect(finalConnectionUrl, {
useNewUrlParser: true,
useUnifiedTopology: true,
maxPoolSize: 100, maxPoolSize: 100,
maxIdleTimeMS: 10, maxIdleTimeMS: 10,
}); });
@ -78,7 +76,7 @@ export class SmartdataDb {
* @returns DbTable * @returns DbTable
*/ */
public async getSmartdataCollectionByName<T>(nameArg: string): Promise<SmartdataCollection<T>> { public async getSmartdataCollectionByName<T>(nameArg: string): Promise<SmartdataCollection<T>> {
const resultCollection = this.smartdataCollectionMap.find((dbTableArg) => { const resultCollection = await this.smartdataCollectionMap.find(async (dbTableArg) => {
return dbTableArg.collectionName === nameArg; return dbTableArg.collectionName === nameArg;
}); });
return resultCollection; return resultCollection;