Compare commits

...

16 Commits

Author SHA1 Message Date
0984a1ade4 3.1.38 2020-08-18 12:53:45 +00:00
804701c96a fix(core): update 2020-08-18 12:53:44 +00:00
a3759fa484 3.1.37 2020-08-18 12:52:01 +00:00
ef38df62be fix(core): update 2020-08-18 12:52:00 +00:00
c17789e92e 3.1.36 2020-08-18 12:46:14 +00:00
0bf2ba554d fix(core): update 2020-08-18 12:46:14 +00:00
5cbf1a222a 3.1.35 2020-08-18 12:36:41 +00:00
f075530838 fix(core): update 2020-08-18 12:36:41 +00:00
efb83853fb 3.1.34 2020-08-18 12:35:16 +00:00
73300ca4d3 fix(core): update 2020-08-18 12:35:16 +00:00
1e946cdceb 3.1.33 2020-08-18 12:33:17 +00:00
608ff93a41 fix(core): update 2020-08-18 12:33:16 +00:00
6211953f14 3.1.32 2020-08-18 12:32:55 +00:00
99e520b776 fix(core): update 2020-08-18 12:32:54 +00:00
eda8297356 3.1.31 2020-08-18 12:05:08 +00:00
ffa52a5883 fix(core): update 2020-08-18 12:05:07 +00:00
5 changed files with 39 additions and 39 deletions

16
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartdata",
"version": "3.1.30",
"version": "3.1.38",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -7915,18 +7915,18 @@
}
},
"mongodb-memory-server": {
"version": "6.6.4",
"resolved": "https://verdaccio.lossless.one/mongodb-memory-server/-/mongodb-memory-server-6.6.4.tgz",
"integrity": "sha512-GCtrlUDpq6oPkdlkmIgh0Q6vJYf7njzw8AJnbg/gime2NxuUtqcOK2n+9L3qeDzt6EZxdtP/+1u/80wfjwc5mA==",
"version": "6.6.3",
"resolved": "https://verdaccio.lossless.one/mongodb-memory-server/-/mongodb-memory-server-6.6.3.tgz",
"integrity": "sha512-zx91SQQUBafVfBX8IJjfZa0lIMzdDYs/UB1vnr33e5bSPBwSai+mVV6gW3osF4paLFxOkcvOwx758G9F9HytgA==",
"dev": true,
"requires": {
"mongodb-memory-server-core": "6.6.4"
"mongodb-memory-server-core": "6.6.3"
}
},
"mongodb-memory-server-core": {
"version": "6.6.4",
"resolved": "https://verdaccio.lossless.one/mongodb-memory-server-core/-/mongodb-memory-server-core-6.6.4.tgz",
"integrity": "sha512-g4WMmXp2Gg305eKETaE9Nnp2eR3mTMKSTZJsxpXhsx+Mhl2IQoMLa78ny7eFPN7FORnLxQsmLMANv4b0bP+RDA==",
"version": "6.6.3",
"resolved": "https://verdaccio.lossless.one/mongodb-memory-server-core/-/mongodb-memory-server-core-6.6.3.tgz",
"integrity": "sha512-MTs2qCb+5JG4qPCenqo+L0cxQiO09EqTZNk4I5+dz8nRUiVPFLL64tO/oJ1WDuSJ6vcyk8dC+QsNAD1wjZxx8g==",
"dev": true,
"requires": {
"@types/cross-spawn": "^6.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartdata",
"version": "3.1.30",
"version": "3.1.38",
"private": false,
"description": "do more with data",
"main": "dist_ts/index.js",
@ -40,7 +40,7 @@
"@types/mongodb-memory-server": "^2.3.0",
"@types/node": "^14.6.0",
"@types/shortid": "0.0.29",
"mongodb-memory-server": "^6.6.4",
"mongodb-memory-server": "6.6.3",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},

View File

@ -15,11 +15,16 @@ import * as mongoPlugin from 'mongodb-memory-server';
// =======================================
let testDb: smartdata.SmartdataDb;
let smartdataOptions: smartdata.ISmartdataOptions;
let smartdataOptions: smartdata.IMongoDescriptor;
let mongod: mongoPlugin.MongoMemoryServer;
tap.test('should create a testinstance as database', async () => {
mongod = new mongoPlugin.MongoMemoryServer();
console.log('created mongod instance');
await mongod._startUpInstance().catch(err => {
console.log(err);
});
console.log('mongod started');
smartdataOptions = {
mongoDbName: await mongod.getDbName(),
mongoDbPass: '',
@ -29,7 +34,7 @@ tap.test('should create a testinstance as database', async () => {
testDb = new smartdata.SmartdataDb(smartdataOptions);
});
tap.test('should establish a connection to the rethink Db cluster', async () => {
tap.test('should establish a connection to mongod', async () => {
await testDb.init();
});

View File

@ -1,5 +1,22 @@
export interface IMongoDescriptor {
mongoDbName: string;
/**
* the URL to connect to
*/
mongoDbUrl: string;
mongoDbPass: string;
/**
* the db to use for the project
*/
mongoDbName?: string;
/**
* a username to use to connect to the database
*/
mongoDbUser?: string;
/**
* an optional password that will be replace <PASSWORD> in the connection string
*/
mongoDbPass?: string;
}

View File

@ -4,43 +4,21 @@ import { ObjectMap } from '@pushrocks/lik';
import { SmartdataCollection } from './smartdata.classes.collection';
import { logger } from './smartdata.logging';
import { IMongoDescriptor } from './interfaces';
/**
* interface - indicates the connection status of the db
*/
export type TConnectionStatus = 'initial' | 'disconnected' | 'connected' | 'failed';
export interface ISmartdataOptions {
/**
* the URL to connect to
*/
mongoDbUrl: string;
/**
* the db to use for the project
*/
mongoDbName?: string;
/**
* a username to use to connect to the database
*/
mongoDbUser?: string;
/**
* an optional password that will be replace <PASSWORD> in the connection string
*/
mongoDbPass?: string;
}
export class SmartdataDb {
smartdataOptions: ISmartdataOptions;
smartdataOptions: IMongoDescriptor;
mongoDbClient: plugins.mongodb.MongoClient;
mongoDb: plugins.mongodb.Db;
status: TConnectionStatus;
smartdataCollectionMap = new ObjectMap<SmartdataCollection<any>>();
constructor(smartdataOptions: ISmartdataOptions) {
constructor(smartdataOptions: IMongoDescriptor) {
this.smartdataOptions = smartdataOptions;
this.status = 'initial';
}