feat(add RethinkDB as main driver and revert to docs in README):

This commit is contained in:
Philipp Kunz 2018-01-12 01:22:58 +01:00
parent bd30da1c4a
commit 3671fe4df4
20 changed files with 294 additions and 278 deletions

View File

@ -14,6 +14,7 @@ do more with data and RethinkDB
[![Dependency Status](https://david-dm.org/pushrocks/smartdata.svg)](https://david-dm.org/pushrocks/smartdata) [![Dependency Status](https://david-dm.org/pushrocks/smartdata.svg)](https://david-dm.org/pushrocks/smartdata)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartdata/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm) [![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartdata/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartdata/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartdata) [![bitHound Code](https://www.bithound.io/github/pushrocks/smartdata/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartdata)
[![Known Vulnerabilities](https://snyk.io/test/npm/smartdata/badge.svg)](https://snyk.io/test/npm/smartdata)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) [![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) [![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
@ -29,7 +30,7 @@ There are many ODMs out there, however when we searched for an ODM that uses Typ
acts smart while still embracing the NoSQL idea we didn't find a matching solution. acts smart while still embracing the NoSQL idea we didn't find a matching solution.
This is why we started smartdata. This is why we started smartdata.
How MongoDB terms map to smartdata classes How RethinkDB's terms map to the ones of smartdata:
RethinkDB term | smartdata class RethinkDB term | smartdata class
--- | --- --- | ---
@ -42,8 +43,7 @@ represents a Database. Naturally it has .connect() etc. methods on it.
```javascript ```javascript
import * as smartdata from 'smartdata' import * as smartdata from 'smartdata'
// mongodb let myRethinkDb1 = new smartdata.Db({
let myDb1 = new smartdata.Db({
// rethinkDb connection options here // rethinkDb connection options here
}) })
@ -59,7 +59,7 @@ So to get to get access to a specific collection you document
```javascript ```javascript
// continues from the block before... // continues from the block before...
@Collection(myDb1) @Collection(myRethinkDb1)
class MyObject extends smartdata.DbDoc<myObject> { // read the next block about DbDoc class MyObject extends smartdata.DbDoc<myObject> { // read the next block about DbDoc
@smartdata.svDb() property1: string // @smartdata.svDb() marks the property for db save @smartdata.svDb() property1: string // @smartdata.svDb() marks the property for db save
property2: number // this one is not marked, so it won't be save upon calling this.save() property2: number // this one is not marked, so it won't be save upon calling this.save()
@ -70,7 +70,7 @@ class MyObject extends smartdata.DbDoc<myObject> { // read the next block about
super() super()
} }
} }
let myCollection = myDb1.getCollectionByName<myObject>(myObject) let myCollection = myRethinkDb1.getCollectionByName<myObject>(myObject)
// start to instantiate instances of classes from scratch or database // start to instantiate instances of classes from scratch or database

View File

@ -13,6 +13,10 @@ export declare class Db {
status: TConnectionStatus; status: TConnectionStatus;
dbTablesMap: Objectmap<DbTable<any>>; dbTablesMap: Objectmap<DbTable<any>>;
constructor(connectionOptionsArg: ConnectionOptions); constructor(connectionOptionsArg: ConnectionOptions);
/**
* supply additional SSl options
*/
setSsl(certificateStringArg: string, formatArg: 'base64' | 'clearText'): void;
/** /**
* connects to the database that was specified during instance creation * connects to the database that was specified during instance creation
*/ */

View File

@ -17,6 +17,21 @@ class Db {
this.connectionOptions = connectionOptionsArg; this.connectionOptions = connectionOptionsArg;
this.status = 'initial'; this.status = 'initial';
} }
/**
* supply additional SSl options
*/
setSsl(certificateStringArg, formatArg) {
let certificateString;
if (formatArg = 'base64') {
certificateString = plugins.smartstring.base64.decode(certificateStringArg);
}
else {
certificateString = certificateStringArg;
}
this.connectionOptions['ssl'] = {
ca: Buffer.from(certificateString)
};
}
// basic connection stuff ---------------------------------------------- // basic connection stuff ----------------------------------------------
/** /**
* connects to the database that was specified during instance creation * connects to the database that was specified during instance creation
@ -24,6 +39,7 @@ class Db {
connect() { connect() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
this.dbConnection = yield plugins.rethinkDb.connect(this.connectionOptions); this.dbConnection = yield plugins.rethinkDb.connect(this.connectionOptions);
this.dbConnection.use(this.dbName);
this.status = 'connected'; this.status = 'connected';
plugins.beautylog.ok(`Connected to database ${this.dbName}`); plugins.beautylog.ok(`Connected to database ${this.dbName}`);
}); });
@ -35,7 +51,7 @@ class Db {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield this.dbConnection.close(); yield this.dbConnection.close();
this.status = 'disconnected'; this.status = 'disconnected';
plugins.beautylog.ok(`disconnected to database ${this.dbName}`); plugins.beautylog.ok(`disconnected from database ${this.dbName}`);
}); });
} }
// handle table to class distribution // handle table to class distribution
@ -47,7 +63,7 @@ class Db {
getDbTableByName(nameArg) { getDbTableByName(nameArg) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let resultCollection = this.dbTablesMap.find((dbCollectionArg) => { let resultCollection = this.dbTablesMap.find((dbCollectionArg) => {
return dbCollectionArg.name === nameArg; return dbCollectionArg.tableName === nameArg;
}); });
return resultCollection; return resultCollection;
}); });
@ -57,4 +73,4 @@ class Db {
} }
} }
exports.Db = Db; exports.Db = Db;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2x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0IsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLElBQUksQ0FBQyxDQUFDLGVBQWUsRUFBRSxFQUFFO2dCQUMvRCxNQUFNLENBQUMsZUFBZSxDQUFDLFNBQVMsS0FBSyxPQUFPLENBQUE7WUFDOUMsQ0FBQyxDQUFDLENBQUE7WUFDRixNQUFNLENBQUMsZ0JBQWdCLENBQUE7UUFDekIsQ0FBQztLQUFBO0lBRUQsUUFBUSxDQUFFLGVBQTZCO1FBQ3JDLElBQUksQ0FBQyxXQUFXLENBQUMsR0FBRyxDQUFDLGVBQWUsQ0FBQyxDQUFBO0lBQ3ZDLENBQUM7Q0FDRjtBQWxFRCxnQkFrRUMifQ==

View File

@ -1,6 +1,7 @@
import * as plugins from './smartdata.plugins'; import * as plugins from './smartdata.plugins';
import { Db } from './smartdata.classes.db'; import { Db } from './smartdata.classes.db';
import { DbDoc } from './smartdata.classes.dbdoc'; import { DbDoc } from './smartdata.classes.dbdoc';
import { WriteResult, Cursor } from 'rethinkdb';
export interface IFindOptions { export interface IFindOptions {
limit?: number; limit?: number;
} }
@ -15,9 +16,10 @@ export declare class DbTable<T> {
*/ */
table: plugins.rethinkDb.Table; table: plugins.rethinkDb.Table;
objectValidation: IDocValidation<T>; objectValidation: IDocValidation<T>;
name: string; tableName: string;
db: Db; db: Db;
constructor(collectedClassArg: T & DbDoc<T>, dbArg: Db); constructor(collectedClassArg: T & DbDoc<T>, dbArg: Db);
init(): Promise<void>;
/** /**
* adds a validation function that all newly inserted and updated objects have to pass * adds a validation function that all newly inserted and updated objects have to pass
*/ */
@ -25,17 +27,19 @@ export declare class DbTable<T> {
/** /**
* finds an object in the DbCollection * finds an object in the DbCollection
*/ */
find(docMatchArg: T | any, optionsArg?: IFindOptions): Promise<T[]>; find(): Promise<Cursor>;
/**
* create an object in the database
*/
insert(dbDocArg: T & DbDoc<T>): Promise<WriteResult>;
/** /**
* inserts object into the DbCollection * inserts object into the DbCollection
*/ */
insertOne(docArg: T): Promise<void>; update(dbDocArg: T & DbDoc<T>): Promise<WriteResult>;
/**
* inserts many objects at once into the DbCollection
*/
insertMany(docArrayArg: T[]): Promise<void>;
/** /**
* checks a Doc for constraints * checks a Doc for constraints
* if this.objectValidation is not set it passes.
*/ */
private checkDoc(docArg); private checkDoc(docArg);
extractKey(writeResult: WriteResult): void;
} }

View File

@ -19,13 +19,29 @@ class DbTable {
constructor(collectedClassArg, dbArg) { constructor(collectedClassArg, dbArg) {
this.objectValidation = null; this.objectValidation = null;
// tell the collection where it belongs // tell the collection where it belongs
this.name = collectedClassArg.name; this.tableName = collectedClassArg.name;
this.db = dbArg; this.db = dbArg;
// connect this instance to a RethinkDB table
this.table = plugins.rethinkDb.db(this.db.dbName).table(this.name);
// tell the db class about it (important since Db uses different systems under the hood) // tell the db class about it (important since Db uses different systems under the hood)
this.db.addTable(this); this.db.addTable(this);
} }
init() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.table) {
// connect this instance to a RethinkDB table
const availableTables = yield plugins.rethinkDb
.db(this.db.dbName)
.tableList()
.run(this.db.dbConnection);
if (availableTables.indexOf(this.tableName)) {
yield plugins.rethinkDb
.db(this.db.dbName)
.tableCreate(this.tableName)
.run(this.db.dbConnection);
}
}
this.table = plugins.rethinkDb.table(this.tableName);
});
}
/** /**
* adds a validation function that all newly inserted and updated objects have to pass * adds a validation function that all newly inserted and updated objects have to pass
*/ */
@ -35,35 +51,36 @@ class DbTable {
/** /**
* finds an object in the DbCollection * finds an object in the DbCollection
*/ */
find(docMatchArg, optionsArg) { find() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield this.init();
return yield plugins.rethinkDb.table(this.tableName).filter({}).run(this.db.dbConnection);
});
}
/**
* create an object in the database
*/
insert(dbDocArg) {
return __awaiter(this, void 0, void 0, function* () {
yield this.init();
yield this.checkDoc(dbDocArg);
return yield plugins.rethinkDb.table(this.tableName).insert(dbDocArg.createSavableObject()).run(this.db.dbConnection);
}); });
} }
/** /**
* inserts object into the DbCollection * inserts object into the DbCollection
*/ */
insertOne(docArg) { update(dbDocArg) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield this.checkDoc(docArg); yield this.init();
yield this.checkDoc(dbDocArg);
console.log(this.tableName, dbDocArg.createSavableObject());
return yield plugins.rethinkDb.table(this.tableName).update(dbDocArg.createSavableObject()).run(this.db.dbConnection);
}); });
} }
/**
* inserts many objects at once into the DbCollection
*/
insertMany(docArrayArg) {
let done = plugins.smartq.defer();
let checkDocPromiseArray = [];
for (let docArg of docArrayArg) {
checkDocPromiseArray.push(this.checkDoc(docArg));
}
Promise.all(checkDocPromiseArray).then(() => {
this.table.insertMany(docArrayArg)
.then(() => { done.resolve(); });
});
return done.promise;
}
/** /**
* checks a Doc for constraints * checks a Doc for constraints
* if this.objectValidation is not set it passes.
*/ */
checkDoc(docArg) { checkDoc(docArg) {
let done = plugins.smartq.defer(); let done = plugins.smartq.defer();
@ -79,6 +96,8 @@ class DbTable {
} }
return done.promise; return done.promise;
} }
extractKey(writeResult) {
}
} }
exports.DbTable = DbTable; exports.DbTable = DbTable;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJjb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRkYXRhLmNsYXNzZXMuZGJjb2xsZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwrQ0FBOEM7QUFZOUMsb0JBQTRCLEVBQU07SUFDaEMsTUFBTSxDQUFDLFVBQVUsV0FBVztRQUMxQixXQUFXLENBQUUsY0FBYyxDQUFFLEdBQUcsSUFBSSxPQUFPLENBQUMsV0FBVyxFQUFFLEVBQUUsQ0FBQyxDQUFBO0lBQzlELENBQUMsQ0FBQTtBQUNILENBQUM7QUFKRCxnQ0FJQztBQ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BQUksQ0FBQyxnQkFBZ0IsQ0FBQyxNQUFNLENBQUMsQ0FBQTtRQUNsRCxDQUFDO1FBQ0QsRUFBRSxDQUFDLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDO1lBQ3JCLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQTtRQUNoQixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixJQUFJLENBQUMsTUFBTSxDQUFDLG1DQUFtQyxDQUFDLENBQUE7UUFDbEQsQ0FBQztRQUNELE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3JCLENBQUM7SUFFRCxVQUFVLENBQUUsV0FBd0I7SUFFcEMsQ0FBQztDQUNGO0FBakdELDBCQWlHQyJ9

View File

@ -13,7 +13,7 @@ export declare class DbDoc<T> {
/** /**
* how the Doc in memory was created, may prove useful later. * how the Doc in memory was created, may prove useful later.
*/ */
creationType: TDocCreation; creationStatus: TDocCreation;
/** /**
* an array of saveable properties of a doc * an array of saveable properties of a doc
*/ */
@ -22,6 +22,10 @@ export declare class DbDoc<T> {
* name * name
*/ */
name: string; name: string;
/**
* primary id in the database
*/
dbId: string;
/** /**
* class constructor * class constructor
*/ */
@ -30,10 +34,11 @@ export declare class DbDoc<T> {
* saves this instance but not any connected items * saves this instance but not any connected items
* may lead to data inconsistencies, but is faster * may lead to data inconsistencies, but is faster
*/ */
save(): void; save(): Promise<void>;
/** /**
* also store any referenced objects to DB * also store any referenced objects to DB
* better for data consistency * better for data consistency
*/ */
saveDeep(savedMapArg?: Objectmap<DbDoc<any>>): void; saveDeep(savedMapArg?: Objectmap<DbDoc<any>>): void;
createSavableObject(): any;
} }

View File

@ -1,4 +1,12 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const lik_1 = require("lik"); const lik_1 = require("lik");
/** /**
@ -19,6 +27,10 @@ class DbDoc {
* class constructor * class constructor
*/ */
constructor() { constructor() {
/**
* how the Doc in memory was created, may prove useful later.
*/
this.creationStatus = 'new';
this.name = this.constructor['name']; this.name = this.constructor['name'];
this.collection = this.constructor['dbCollection']; this.collection = this.constructor['dbCollection'];
} }
@ -27,17 +39,20 @@ class DbDoc {
* may lead to data inconsistencies, but is faster * may lead to data inconsistencies, but is faster
*/ */
save() { save() {
let saveableObject = {}; // is not exposed to outside, so any is ok here return __awaiter(this, void 0, void 0, function* () {
for (let propertyNameString of this.saveableProperties) { let self = this;
saveableObject[propertyNameString] = this[propertyNameString]; switch (this.creationStatus) {
} case 'db':
switch (this.creationType) { yield this.collection.update(self);
case 'db': break;
this.collection; // TODO implement collection.update() case 'new':
break; let writeResult = yield this.collection.insert(self);
case 'new': this.creationStatus = 'db';
this.collection.insertOne(saveableObject); break;
} default:
console.error('neither new nor in db?');
}
});
} }
/** /**
* also store any referenced objects to DB * also store any referenced objects to DB
@ -56,6 +71,13 @@ class DbDoc {
} }
} }
} }
createSavableObject() {
let saveableObject = {}; // is not exposed to outside, so any is ok here
for (let propertyNameString of this.saveableProperties) {
saveableObject[propertyNameString] = this[propertyNameString];
}
return saveableObject;
}
} }
exports.DbDoc = DbDoc; exports.DbDoc = DbDoc;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJkb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYmRvYy50cyJdLCJuYW1lcyI6W10sIm1hcH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0FBQyxjQUFjLENBQUE7SUFDdkIsQ0FBQztDQUNGO0FBL0VELHNCQStFQyJ9

View File

@ -1,3 +0,0 @@
import { Db } from './smartdata.classes.db';
import { DbDoc } from './smartdata.classes.dbdoc';
export declare let getObjectDoc: (nameArg: any, dbArg: Db) => DbDoc<{}>;

View File

@ -1,11 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartdata_classes_dbdoc_1 = require("./smartdata.classes.dbdoc");
const smartdata_classes_dbcollection_1 = require("./smartdata.classes.dbcollection");
exports.getObjectDoc = (nameArg, dbArg) => {
let objectDoc = new smartdata_classes_dbdoc_1.DbDoc();
objectDoc.name = nameArg;
objectDoc.collection = new smartdata_classes_dbcollection_1.DbTable(objectDoc, dbArg);
return objectDoc;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJvYmplY3Rkb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYm9iamVjdGRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLHVFQUFpRDtBQUNqRCxxRkFBMEQ7QUFFL0MsUUFBQSxZQUFZLEdBQUcsQ0FBQyxPQUFPLEVBQUMsS0FBUyxFQUFFLEVBQUU7SUFDOUMsSUFBSSxTQUFTLEdBQUcsSUFBSSwrQkFBSyxFQUFFLENBQUE7SUFDM0IsU0FBUyxDQUFDLElBQUksR0FBRyxPQUFPLENBQUE7SUFDeEIsU0FBUyxDQUFDLFVBQVUsR0FBRyxJQUFJLHdDQUFPLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFBO0lBQ3BELE1BQU0sQ0FBQyxTQUFTLENBQUE7QUFDbEIsQ0FBQyxDQUFBIn0=

View File

@ -1,7 +1,7 @@
import 'typings-global';
import * as assert from 'assert'; import * as assert from 'assert';
import * as beautylog from 'beautylog'; import * as beautylog from 'beautylog';
import * as lodash from 'lodash'; import * as lodash from 'lodash';
import * as rethinkDb from 'rethinkdb'; import * as rethinkDb from 'rethinkdb';
import * as smartq from 'smartq'; import * as smartq from 'smartq';
export { assert, beautylog, lodash, smartq, rethinkDb }; import * as smartstring from 'smartstring';
export { assert, beautylog, lodash, smartq, rethinkDb, smartstring };

View File

@ -1,6 +1,5 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const assert = require("assert"); const assert = require("assert");
exports.assert = assert; exports.assert = assert;
const beautylog = require("beautylog"); const beautylog = require("beautylog");
@ -11,4 +10,6 @@ const rethinkDb = require("rethinkdb");
exports.rethinkDb = rethinkDb; exports.rethinkDb = rethinkDb;
const smartq = require("smartq"); const smartq = require("smartq");
exports.smartq = smartq; exports.smartq = smartq;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixpQ0FBZ0M7QUFPNUIsd0JBQU07QUFOVix1Q0FBc0M7QUFPbEMsOEJBQVM7QUFOYixpQ0FBZ0M7QUFPNUIsd0JBQU07QUFOVix1Q0FBc0M7QUFRbEMsOEJBQVM7QUFQYixpQ0FBZ0M7QUFNNUIsd0JBQU0ifQ== const smartstring = require("smartstring");
exports.smartstring = smartstring;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlDQUFnQztBQVE1Qix3QkFBTTtBQVBWLHVDQUFzQztBQVFsQyw4QkFBUztBQVBiLGlDQUFnQztBQVE1Qix3QkFBTTtBQVBWLHVDQUFzQztBQVNsQyw4QkFBUztBQVJiLGlDQUFnQztBQU81Qix3QkFBTTtBQU5WLDJDQUEwQztBQVF0QyxrQ0FBVyJ9

View File

@ -26,7 +26,8 @@
"lodash": "^4.17.4", "lodash": "^4.17.4",
"rethinkdb": "^2.3.3", "rethinkdb": "^2.3.3",
"runtime-type-checks": "0.0.4", "runtime-type-checks": "0.0.4",
"smartq": "^1.1.6" "smartq": "^1.1.6",
"smartstring": "^2.0.28"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^8.5.7", "@types/node": "^8.5.7",
@ -34,7 +35,6 @@
"cz-conventional-changelog": "^2.1.0", "cz-conventional-changelog": "^2.1.0",
"qenv": "^1.1.7", "qenv": "^1.1.7",
"shelljs": "^0.7.8", "shelljs": "^0.7.8",
"smartstring": "^2.0.24",
"tapbundle": "^1.1.1" "tapbundle": "^1.1.1"
}, },
"config": { "config": {

View File

@ -1,4 +1,7 @@
vars: vars:
- MONGO_USER - RDB_DB
- MONGO_PASS - RDB_HOST
- MONGO_DATABASE - RDB_USER
- RDB_PASS
- RDB_PORT
- RDB_CERT

View File

@ -1,53 +0,0 @@
import { tap, expect } from 'tapbundle'
import * as smartq from 'smartq'
import { Qenv } from 'qenv'
let testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit/')
// the tested module
import * as smartdata from '../ts/index'
let mongoChildProcess
let testDb: smartdata.Db
tap.test('should establish a connection to mongodb', async () => {
// testDb = new smartdata.Db(`mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@sandbox-shard-00-00-uyw7y.mongodb.net:27017,sandbox-shard-00-01-uyw7y.mongodb.net:27017,sandbox-shard-00-02-uyw7y.mongodb.net:27017/${process.env.MONGO_DATABASE}?ssl=true&replicaSet=sandbox-shard-0&authSource=admin`)
testDb = new smartdata.Db(`mongodb://localhost:27017/${process.env.MONGO_DATABASE}`)
await testDb.connect()
})
let testCarInstance
tap.test('should create an extended class', async () => {
@smartdata.Collection(testDb)
class TestCar extends smartdata.DbDoc<TestCar> {
@smartdata.svDb()
color: string
constructor (optionsArg: {
color: string,
property2: number
}) {
super()
this.color = optionsArg.color
}
}
testCarInstance = new TestCar({
color: 'red',
property2: 2
})
expect(testCarInstance.name).to.equal('TestCar')
expect(testCarInstance.saveableProperties[ 0 ]).equal('color')
expect(testCarInstance.collection).be.instanceof(smartdata.DbTable)
expect(testCarInstance).be.instanceof(smartdata.DbDoc)
if (!process.env.CI) { console.log(TestCar) }
})
tap.test('should save testCar', async () => {
await testCarInstance.save()
})
tap.test('should close the db Connection', async () => {
await testDb.close()
})
tap.start()

View File

@ -6,22 +6,23 @@ let testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit/')
// the tested module // the tested module
import * as smartdata from '../ts/index' import * as smartdata from '../ts/index'
import { smartstring } from '../ts/smartdata.plugins';
let mongoChildProcess // =======================================
let testDb: smartdata.Db // Connecting to the database server
// =======================================
interface ITestObject1 { let testDb = new smartdata.Db({
value1: string db: process.env.RDB_DB,
value2?: number host: process.env.RDB_HOST,
value3?: string user: process.env.RDB_USER,
} password: process.env.RDB_PASS,
port: parseInt(process.env.RDB_PORT)
})
testDb.setSsl(process.env.RDB_CERT, 'base64')
tap.test('should establish a connection to the rethink Db cluster', async () => {
tap.test('should establish a connection to mongodb', async () => {
// testDb = new smartdata.Db(`mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@sandbox-shard-00-00-uyw7y.mongodb.net:27017,sandbox-shard-00-01-uyw7y.mongodb.net:27017,sandbox-shard-00-02-uyw7y.mongodb.net:27017/${process.env.MONGO_DATABASE}?ssl=true&replicaSet=sandbox-shard-0&authSource=admin`)
testDb = new smartdata.Db({
db: 'test',
host: ''
})
await testDb.connect() await testDb.connect()
}) })
@ -32,40 +33,28 @@ tap.test('should establish a connection to mongodb', async () => {
// ------ // ------
// Collections // Collections
// ------ // ------
let testDbTable: smartdata.DbTable<ITestObject1>
tap.test('should give me a collection', async () => { @smartdata.Collection(testDb)
testDbTable = await testDb.getTableByName<ITestObject1>('testTable') class Car extends smartdata.DbDoc<Car> {
}) @smartdata.svDb() color: string
@smartdata.svDb() brand: string
constructor (colorArg: string, brandArg: string) {
super()
this.color = colorArg
this.brand = brandArg
}
}
tap.test('should insert a doc into the collection', async () => { tap.test('should save the car to the db', async () => {
await testDbTable.insertOne({ value1: 'test' }) const myCar = new Car('red','Volvo')
}) await myCar.save()
tap.test('should find all docs of testDbCollection', async () => {
await testDbTable.find({}).then(async (resultArray) => {
console.log(resultArray)
expect(resultArray[ 0 ].value1).equal('test')
})
})
tap.test('should insert many docs into the collection', async () => {
await testDbTable.insertMany([
{ value1: 'test2' },
{ value1: 'test', value2: 3, value3: 'hi' }
])
})
tap.test('should find a specified doc', async () => {
await testDbTable.find({ 'value3': { '$exists': true } }).then((resultArray) => {
console.log(resultArray)
expect(resultArray[ 0 ].value3).equal('hi')
})
}) })
// =======================================
tap.test('should close the db Connection', async () => { // close the database connection
// =======================================
tap.test('should close the database connection', async (tools) => {
await testDb.close() await testDb.close()
}) })

View File

@ -2,7 +2,6 @@ import * as plugins from './smartdata.plugins'
import { Objectmap } from 'lik' import { Objectmap } from 'lik'
import { DbTable } from './smartdata.classes.dbcollection' import { DbTable } from './smartdata.classes.dbcollection'
import { getObjectDoc } from './smartdata.classes.dbobjectdoc'
import { Connection as dbConnection, ConnectionOptions } from 'rethinkdb' import { Connection as dbConnection, ConnectionOptions } from 'rethinkdb'
@ -24,6 +23,21 @@ export class Db {
this.status = 'initial' this.status = 'initial'
} }
/**
* supply additional SSl options
*/
setSsl (certificateStringArg: string, formatArg: 'base64' | 'clearText') {
let certificateString: string
if(formatArg = 'base64') {
certificateString = plugins.smartstring.base64.decode(certificateStringArg)
} else {
certificateString = certificateStringArg
}
this.connectionOptions['ssl'] = {
ca: Buffer.from(certificateString)
}
}
// basic connection stuff ---------------------------------------------- // basic connection stuff ----------------------------------------------
/** /**
@ -31,6 +45,7 @@ export class Db {
*/ */
async connect (): Promise<any> { async connect (): Promise<any> {
this.dbConnection = await plugins.rethinkDb.connect(this.connectionOptions) this.dbConnection = await plugins.rethinkDb.connect(this.connectionOptions)
this.dbConnection.use(this.dbName)
this.status = 'connected' this.status = 'connected'
plugins.beautylog.ok(`Connected to database ${this.dbName}`) plugins.beautylog.ok(`Connected to database ${this.dbName}`)
} }
@ -41,7 +56,7 @@ export class Db {
async close (): Promise<any> { async close (): Promise<any> {
await this.dbConnection.close() await this.dbConnection.close()
this.status = 'disconnected' this.status = 'disconnected'
plugins.beautylog.ok(`disconnected to database ${this.dbName}`) plugins.beautylog.ok(`disconnected from database ${this.dbName}`)
} }
// handle table to class distribution // handle table to class distribution
@ -53,7 +68,7 @@ export class Db {
*/ */
async getDbTableByName<T>(nameArg: string): Promise<DbTable<T>> { async getDbTableByName<T>(nameArg: string): Promise<DbTable<T>> {
let resultCollection = this.dbTablesMap.find((dbCollectionArg) => { let resultCollection = this.dbTablesMap.find((dbCollectionArg) => {
return dbCollectionArg.name === nameArg return dbCollectionArg.tableName === nameArg
}) })
return resultCollection return resultCollection
} }

View File

@ -2,6 +2,9 @@ import * as plugins from './smartdata.plugins'
import { Db } from './smartdata.classes.db' import { Db } from './smartdata.classes.db'
import { DbDoc } from './smartdata.classes.dbdoc' import { DbDoc } from './smartdata.classes.dbdoc'
// RethinkDb Interfaces
import { WriteResult, Cursor } from 'rethinkdb'
export interface IFindOptions { export interface IFindOptions {
limit?: number limit?: number
} }
@ -23,21 +26,35 @@ export class DbTable<T> {
*/ */
table: plugins.rethinkDb.Table table: plugins.rethinkDb.Table
objectValidation: IDocValidation<T> = null objectValidation: IDocValidation<T> = null
name: string tableName: string
db: Db db: Db
constructor (collectedClassArg: T & DbDoc<T>, dbArg: Db) { constructor (collectedClassArg: T & DbDoc<T>, dbArg: Db) {
// tell the collection where it belongs // tell the collection where it belongs
this.name = collectedClassArg.name this.tableName = collectedClassArg.name
this.db = dbArg this.db = dbArg
// connect this instance to a RethinkDB table
this.table = plugins.rethinkDb.db(this.db.dbName).table(this.name)
// tell the db class about it (important since Db uses different systems under the hood) // tell the db class about it (important since Db uses different systems under the hood)
this.db.addTable(this) this.db.addTable(this)
} }
async init() {
if(!this.table) {
// connect this instance to a RethinkDB table
const availableTables = await plugins.rethinkDb
.db(this.db.dbName)
.tableList()
.run(this.db.dbConnection)
if(availableTables.indexOf(this.tableName)) {
await plugins.rethinkDb
.db(this.db.dbName)
.tableCreate(this.tableName)
.run(this.db.dbConnection)
}
}
this.table = plugins.rethinkDb.table(this.tableName)
}
/** /**
* adds a validation function that all newly inserted and updated objects have to pass * adds a validation function that all newly inserted and updated objects have to pass
*/ */
@ -48,35 +65,39 @@ export class DbTable<T> {
/** /**
* finds an object in the DbCollection * finds an object in the DbCollection
*/ */
async find (docMatchArg: T | any, optionsArg?: IFindOptions): Promise<T[]> { async find (): Promise<Cursor> {
await this.init()
return await plugins.rethinkDb.table(this.tableName).filter({
/* TODO: */
}).run(this.db.dbConnection)
}
/**
* create an object in the database
*/
async insert (dbDocArg: T & DbDoc<T>): Promise<WriteResult> {
await this.init()
await this.checkDoc(dbDocArg)
return await plugins.rethinkDb.table(this.tableName).insert(
dbDocArg.createSavableObject()
).run(this.db.dbConnection)
} }
/** /**
* inserts object into the DbCollection * inserts object into the DbCollection
*/ */
async insertOne (docArg: T): Promise<void> { async update (dbDocArg: T & DbDoc<T>): Promise<WriteResult> {
await this.checkDoc(docArg) await this.init()
} await this.checkDoc(dbDocArg)
console.log(this.tableName, dbDocArg.createSavableObject())
/** return await plugins.rethinkDb.table(this.tableName).update(
* inserts many objects at once into the DbCollection dbDocArg.createSavableObject()
*/ ).run(this.db.dbConnection)
insertMany (docArrayArg: T[]): Promise<void> {
let done = plugins.smartq.defer<void>()
let checkDocPromiseArray: Promise<void>[] = []
for (let docArg of docArrayArg) {
checkDocPromiseArray.push(this.checkDoc(docArg))
}
Promise.all(checkDocPromiseArray).then(() => {
this.table.insertMany(docArrayArg)
.then(() => { done.resolve() })
})
return done.promise
} }
/** /**
* checks a Doc for constraints * checks a Doc for constraints
* if this.objectValidation is not set it passes.
*/ */
private checkDoc (docArg: T): Promise<void> { private checkDoc (docArg: T): Promise<void> {
let done = plugins.smartq.defer<void>() let done = plugins.smartq.defer<void>()
@ -91,4 +112,8 @@ export class DbTable<T> {
} }
return done.promise return done.promise
} }
extractKey (writeResult: WriteResult) {
}
} }

View File

@ -28,7 +28,7 @@ export class DbDoc<T> {
/** /**
* how the Doc in memory was created, may prove useful later. * how the Doc in memory was created, may prove useful later.
*/ */
creationType: TDocCreation creationStatus: TDocCreation = 'new'
/** /**
* an array of saveable properties of a doc * an array of saveable properties of a doc
@ -40,6 +40,11 @@ export class DbDoc<T> {
*/ */
name: string name: string
/**
* primary id in the database
*/
dbId: string
/** /**
* class constructor * class constructor
*/ */
@ -52,17 +57,18 @@ export class DbDoc<T> {
* saves this instance but not any connected items * saves this instance but not any connected items
* may lead to data inconsistencies, but is faster * may lead to data inconsistencies, but is faster
*/ */
save () { async save () {
let saveableObject: any = {} // is not exposed to outside, so any is ok here let self: any = this
for (let propertyNameString of this.saveableProperties) { switch (this.creationStatus) {
saveableObject[ propertyNameString ] = this[ propertyNameString ]
}
switch (this.creationType) {
case 'db': case 'db':
this.collection // TODO implement collection.update() await this.collection.update(self)
break break
case 'new': case 'new':
this.collection.insertOne(saveableObject) let writeResult = await this.collection.insert(self)
this.creationStatus = 'db'
break;
default:
console.error('neither new nor in db?')
} }
} }
@ -83,4 +89,12 @@ export class DbDoc<T> {
} }
} }
} }
createSavableObject () {
let saveableObject: any = {} // is not exposed to outside, so any is ok here
for (let propertyNameString of this.saveableProperties) {
saveableObject[ propertyNameString ] = this[ propertyNameString ]
}
return saveableObject
}
} }

View File

@ -1,14 +1,15 @@
import 'typings-global'
import * as assert from 'assert' import * as assert from 'assert'
import * as beautylog from 'beautylog' import * as beautylog from 'beautylog'
import * as lodash from 'lodash' import * as lodash from 'lodash'
import * as rethinkDb from 'rethinkdb' import * as rethinkDb from 'rethinkdb'
import * as smartq from 'smartq' import * as smartq from 'smartq'
import * as smartstring from 'smartstring'
export { export {
assert, assert,
beautylog, beautylog,
lodash, lodash,
smartq, smartq,
rethinkDb rethinkDb,
smartstring
} }

105
yarn.lock
View File

@ -6,36 +6,33 @@
version "4.0.3" version "4.0.3"
resolved "https://registry.yarnpkg.com/@types/code/-/code-4.0.3.tgz#9c4de39f86eb3eba070146d2dab7dbc3f8eac35f" resolved "https://registry.yarnpkg.com/@types/code/-/code-4.0.3.tgz#9c4de39f86eb3eba070146d2dab7dbc3f8eac35f"
"@types/events@*":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@types/events/-/events-1.1.0.tgz#93b1be91f63c184450385272c47b6496fd028e02"
"@types/fs-extra@4.x.x": "@types/fs-extra@4.x.x":
version "4.0.5" version "4.0.7"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.5.tgz#8aa6033c0e87c653b09a6711686916864b48ec9e" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.7.tgz#02533262386b5a6b9a49797dc82feffdf269140a"
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/glob@*": "@types/glob@*":
version "5.0.33" version "5.0.34"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.33.tgz#3dff7c6ce09d65abe919c7961dc3dee016f36ad7" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.34.tgz#ee626c9be3da877d717911c6101eee0a9871bbf4"
dependencies: dependencies:
"@types/events" "*"
"@types/minimatch" "*" "@types/minimatch" "*"
"@types/node" "*" "@types/node" "*"
"@types/lodash@^4.14.55", "@types/lodash@^4.14.74": "@types/lodash@^4.14.55", "@types/lodash@^4.14.74", "@types/lodash@^4.14.92":
version "4.14.85"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.85.tgz#a16fbf942422f6eca5622b6910492c496c35069b"
"@types/lodash@^4.14.92":
version "4.14.92" version "4.14.92"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.92.tgz#6e3cb0b71a1e12180a47a42a744e856c3ae99a57" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.92.tgz#6e3cb0b71a1e12180a47a42a744e856c3ae99a57"
"@types/minimatch@*", "@types/minimatch@3.x.x": "@types/minimatch@*", "@types/minimatch@3.x.x":
version "3.0.1" version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.1.tgz#b683eb60be358304ef146f5775db4c0e3696a550" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
"@types/node@*", "@types/node@^8.0.33": "@types/node@*", "@types/node@^8.0.33", "@types/node@^8.5.7":
version "8.0.53"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8"
"@types/node@^8.5.7":
version "8.5.7" version "8.5.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.7.tgz#9c498c35af354dcfbca3790fb2e81129e93cf0e2" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.7.tgz#9c498c35af354dcfbca3790fb2e81129e93cf0e2"
@ -46,22 +43,18 @@
"@types/node" "*" "@types/node" "*"
"@types/shelljs@^0.7.4": "@types/shelljs@^0.7.4":
version "0.7.6" version "0.7.7"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.6.tgz#4ac7ca01c191ba65b8e2bf50543c5560084d8d27" resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.7.tgz#1f7bfa28947661afea06365db9b1135bbc903ec4"
dependencies: dependencies:
"@types/glob" "*" "@types/glob" "*"
"@types/node" "*" "@types/node" "*"
"@types/vinyl@^2.0.1": "@types/vinyl@^2.0.1":
version "2.0.1" version "2.0.2"
resolved "https://registry.yarnpkg.com/@types/vinyl/-/vinyl-2.0.1.tgz#6b414dfdcd4a785e8e76e87565ed29e79490d9b7" resolved "https://registry.yarnpkg.com/@types/vinyl/-/vinyl-2.0.2.tgz#4f3b8dae8f5828d3800ef709b0cff488ee852de3"
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/which@^1.0.28":
version "1.0.28"
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.0.28.tgz#016e387629b8817bed653fe32eab5d11279c8df6"
ansi-256-colors@^1.1.0: ansi-256-colors@^1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a" resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
@ -207,8 +200,8 @@ early@^2.1.1:
typings-global "^1.0.16" typings-global "^1.0.16"
es-abstract@^1.5.1: es-abstract@^1.5.1:
version "1.9.0" version "1.10.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.9.0.tgz#690829a07cae36b222e7fd9b75c0d0573eb25227" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.10.0.tgz#1ecb36c197842a00d8ee4c2dfd8646bb97d60864"
dependencies: dependencies:
es-to-primitive "^1.1.1" es-to-primitive "^1.1.1"
function-bind "^1.1.1" function-bind "^1.1.1"
@ -225,8 +218,8 @@ es-to-primitive@^1.1.1:
is-symbol "^1.0.1" is-symbol "^1.0.1"
es6-error@^4.0.2: es6-error@^4.0.2:
version "4.0.2" version "4.1.1"
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98" resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
escape-string-regexp@^1.0.2: escape-string-regexp@^1.0.2:
version "1.0.5" version "1.0.5"
@ -251,8 +244,8 @@ foreach@^2.0.5:
resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99"
fs-extra@^4.0.2: fs-extra@^4.0.2:
version "4.0.2" version "4.0.3"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.2.tgz#f91704c53d1b461f893452b0c307d9997647ab6b" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94"
dependencies: dependencies:
graceful-fs "^4.1.2" graceful-fs "^4.1.2"
jsonfile "^4.0.0" jsonfile "^4.0.0"
@ -315,8 +308,8 @@ inherits@2, inherits@^2.0.1, inherits@~2.0.3:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
interpret@^1.0.0: interpret@^1.0.0:
version "1.0.4" version "1.1.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.4.tgz#820cdd588b868ffb191a809506d6c9c8f212b1b0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"
is-buffer@^1.1.5: is-buffer@^1.1.5:
version "1.1.6" version "1.1.6"
@ -354,13 +347,9 @@ isarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
js-base64@^2.3.2: js-base64@^2.3.2:
version "2.3.2" version "2.4.0"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.3.2.tgz#a79a923666372b580f8e27f51845c6f7e8fbfbaf" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa"
js-yaml@^3.10.0: js-yaml@^3.10.0:
version "3.10.0" version "3.10.0"
@ -398,8 +387,8 @@ leakage@^0.3.0:
pretty-bytes "^4.0.2" pretty-bytes "^4.0.2"
left-pad@^1.1.3: left-pad@^1.1.3:
version "1.1.3" version "1.2.0"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
lik@^2.0.2: lik@^2.0.2:
version "2.0.2" version "2.0.2"
@ -598,10 +587,6 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.1" version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
semver@^5.3.0:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
shelljs@^0.7.8: shelljs@^0.7.8:
version "0.7.8" version "0.7.8"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
@ -668,23 +653,12 @@ smartq@^1.1.1, smartq@^1.1.6:
util.promisify "^1.0.0" util.promisify "^1.0.0"
smartrequest@^1.0.6: smartrequest@^1.0.6:
version "1.0.6" version "1.0.8"
resolved "https://registry.yarnpkg.com/smartrequest/-/smartrequest-1.0.6.tgz#a006454332453b0a70d38a003a29963d039a7783" resolved "https://registry.yarnpkg.com/smartrequest/-/smartrequest-1.0.8.tgz#9af18dde34efa7d43b4ecfc92ccb157a98eda3b1"
dependencies: dependencies:
smartq "^1.1.1" smartq "^1.1.1"
typings-global "^1.0.17"
smartshell@^1.0.6: smartstring@^2.0.28:
version "1.0.19"
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.19.tgz#459c7a9fab8a25007848ffc711b7a817dd6ffc00"
dependencies:
"@types/which" "^1.0.28"
shelljs "^0.7.8"
smartq "^1.1.6"
typings-global "^1.0.23"
which "^1.3.0"
smartstring@^2.0.24:
version "2.0.28" version "2.0.28"
resolved "https://registry.yarnpkg.com/smartstring/-/smartstring-2.0.28.tgz#384b808dc3780eff0031ce7925c1b1668abbcad5" resolved "https://registry.yarnpkg.com/smartstring/-/smartstring-2.0.28.tgz#384b808dc3780eff0031ce7925c1b1668abbcad5"
dependencies: dependencies:
@ -761,12 +735,9 @@ through2@^2.0.1:
readable-stream "^2.1.5" readable-stream "^2.1.5"
xtend "~4.0.1" xtend "~4.0.1"
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.17, typings-global@^1.0.19, typings-global@^1.0.20, typings-global@^1.0.23: typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20:
version "1.0.23" version "1.0.28"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.23.tgz#cdd085803049dd07d95b2e1475243c6b2db378ab" resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4"
dependencies:
semver "^5.3.0"
smartshell "^1.0.6"
universalify@^0.1.0: universalify@^0.1.0:
version "0.1.1" version "0.1.1"
@ -804,12 +775,6 @@ vinyl@^2.0.1:
remove-trailing-separator "^1.0.1" remove-trailing-separator "^1.0.1"
replace-ext "^1.0.0" replace-ext "^1.0.0"
which@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
dependencies:
isexe "^2.0.0"
word-wrap@^1.0.3: word-wrap@^1.0.3:
version "1.2.3" version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"