@otokton/common
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -7,3 +7,3 @@ import { Db } from 'mongodb'; | ||
constructor(uri: string); | ||
db(): Db; | ||
get db(): Db; | ||
connect(): void; | ||
@@ -10,0 +10,0 @@ createCollection(schema: JsonSchemaMongo[]): void; |
@@ -7,7 +7,11 @@ "use strict"; | ||
this._client = new mongodb_1.MongoClient(uri, { useUnifiedTopology: true }); | ||
this._db = this._client.db(); | ||
this._db = {}; | ||
} | ||
AbstractMongoDatabase.prototype.db = function () { | ||
return this._db; | ||
}; | ||
Object.defineProperty(AbstractMongoDatabase.prototype, "db", { | ||
get: function () { | ||
return this._db; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
AbstractMongoDatabase.prototype.connect = function () { | ||
@@ -14,0 +18,0 @@ var _this = this; |
@@ -49,4 +49,3 @@ "use strict"; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -64,4 +63,3 @@ .find() | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -81,4 +79,3 @@ .findOne(new mongodb_1.ObjectID(id)) | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -95,4 +92,3 @@ .find(parameters) | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -109,4 +105,3 @@ .insertOne(o) | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -128,4 +123,3 @@ .findOneAndUpdate({ _id: new mongodb_1.ObjectID(id) }, { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -141,4 +135,3 @@ .deleteOne({ _id: new mongodb_1.ObjectID(id) })]; | ||
p = parameters ? parameters : {}; | ||
return [2 /*return*/, this.database | ||
.db() | ||
return [2 /*return*/, this.database.db | ||
.collection(this.collectionName) | ||
@@ -145,0 +138,0 @@ .find(parameters) |
{ | ||
"name": "@otokton/common", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"private": false, | ||
@@ -17,8 +17,6 @@ "main": "dist/index.js", | ||
}, | ||
"dependencies": { | ||
"@types/koa": "^2.13.3" | ||
}, | ||
"devDependencies": { | ||
"@types/axios": "^0.14.0", | ||
"@types/mongodb": "^3.6.17", | ||
"@types/koa": "^2.13.3", | ||
"chai": "^4.1.2", | ||
@@ -25,0 +23,0 @@ "eslint": "^6.7.2", |
0
24835
8
587
- Removed@types/koa@^2.13.3
- Removed@types/accepts@1.3.7(transitive)
- Removed@types/body-parser@1.19.5(transitive)
- Removed@types/connect@3.4.38(transitive)
- Removed@types/content-disposition@0.5.8(transitive)
- Removed@types/cookies@0.9.0(transitive)
- Removed@types/express@5.0.0(transitive)
- Removed@types/express-serve-static-core@5.0.1(transitive)
- Removed@types/http-assert@1.5.6(transitive)
- Removed@types/http-errors@2.0.4(transitive)
- Removed@types/keygrip@1.0.6(transitive)
- Removed@types/koa@2.15.0(transitive)
- Removed@types/koa-compose@3.2.8(transitive)
- Removed@types/mime@1.3.5(transitive)
- Removed@types/node@22.9.3(transitive)
- Removed@types/qs@6.9.17(transitive)
- Removed@types/range-parser@1.2.7(transitive)
- Removed@types/send@0.17.4(transitive)
- Removed@types/serve-static@1.15.7(transitive)
- Removedundici-types@6.19.8(transitive)