feat(ci): add commitizen for more consistent commit messages

This commit is contained in:
Philipp Kunz 2018-01-07 18:10:16 +01:00
parent cddb0caf1f
commit 05938bf2af
9 changed files with 147 additions and 122 deletions

View File

@ -1,17 +1,18 @@
import * as plugins from './smartdata.plugins';
import { Objectmap } from 'lik';
import { DbCollection } from './smartdata.classes.dbcollection';
import { DbTable } from './smartdata.classes.dbcollection';
import { ConnectionOptions } from 'rethinkdb';
/**
* interface - indicates the connection status of the db
*/
export declare type TConnectionStatus = 'disconnected' | 'connected' | 'failed';
export declare type TConnectionStatus = 'initial' | 'disconnected' | 'connected' | 'failed';
export declare class Db {
dbUrl: string;
dbName: string;
connectionOptions: plugins.rethinkDb.ConnectionOptions;
dbConnection: plugins.rethinkDb.Connection;
status: TConnectionStatus;
classCollections: Objectmap<DbCollection<any>>;
objectCollections: Objectmap<DbCollection<any>>;
constructor(dbUrlArg: string);
dbTablesMap: Objectmap<DbTable<any>>;
constructor(connectionOptionsArg: ConnectionOptions);
/**
* connects to the database that was specified during instance creation
*/
@ -21,12 +22,10 @@ export declare class Db {
*/
close(): Promise<any>;
/**
* gets a class based collection by name: string
* Gets a table's name and returns smartdata's DbTable class
* @param nameArg
* @returns DbTable
*/
getClassCollectionByName<T>(nameArg: string): Promise<DbCollection<T>>;
/**
* gets an object collection by name
*/
getObjectCollectionByName<T>(nameArg: string, dbArg: Db, makeNewArg?: boolean): Promise<DbCollection<T>>;
addCollection(dbCollectionArg: DbCollection<any>): void;
getDbTableByName<T>(nameArg: string): Promise<DbTable<T>>;
addTable(dbCollectionArg: DbTable<any>): void;
}

View File

@ -10,12 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartdata.plugins");
const lik_1 = require("lik");
const smartdata_classes_dbobjectdoc_1 = require("./smartdata.classes.dbobjectdoc");
class Db {
constructor(dbUrlArg) {
this.classCollections = new lik_1.Objectmap();
this.objectCollections = new lik_1.Objectmap();
this.dbUrl = dbUrlArg;
constructor(connectionOptionsArg) {
this.dbTablesMap = new lik_1.Objectmap();
this.dbName = connectionOptionsArg.db;
this.connectionOptions = connectionOptionsArg;
this.status = 'initial';
}
// basic connection stuff ----------------------------------------------
/**
@ -23,51 +23,38 @@ class Db {
*/
connect() {
return __awaiter(this, void 0, void 0, function* () {
this.dbConnection = yield plugins.rethinkDb.connect('test');
this.dbConnection = yield plugins.rethinkDb.connect(this.connectionOptions);
this.status = 'connected';
plugins.beautylog.ok(`Connected to database ${this.dbName}`);
});
}
/**
* closes the connection to the databse
*/
close() {
let done = plugins.smartq.defer();
this.dbConnection.close();
plugins.beautylog.ok(`disconnected to database at ${this.dbUrl}`);
done.resolve();
return done.promise;
}
// advanced communication with the database --------------------------------
/**
* gets a class based collection by name: string
*/
getClassCollectionByName(nameArg) {
return __awaiter(this, void 0, void 0, function* () {
let resultCollection = this.classCollections.find((dbCollectionArg) => {
yield this.dbConnection.close();
this.status = 'disconnected';
plugins.beautylog.ok(`disconnected to database ${this.dbName}`);
});
}
// handle table to class distribution
/**
* Gets a table's name and returns smartdata's DbTable class
* @param nameArg
* @returns DbTable
*/
getDbTableByName(nameArg) {
return __awaiter(this, void 0, void 0, function* () {
let resultCollection = this.dbTablesMap.find((dbCollectionArg) => {
return dbCollectionArg.name === nameArg;
});
return resultCollection;
});
}
/**
* gets an object collection by name
*/
getObjectCollectionByName(nameArg, dbArg, makeNewArg = false) {
return __awaiter(this, void 0, void 0, function* () {
let resultCollection = this.objectCollections.find((dbCollectionArg) => {
return dbCollectionArg.name === nameArg;
});
if (!resultCollection && makeNewArg) {
resultCollection = smartdata_classes_dbobjectdoc_1.getObjectDoc(nameArg, this).collection;
return resultCollection;
}
else {
return resultCollection;
}
});
}
addCollection(dbCollectionArg) {
this.classCollections.add(dbCollectionArg);
addTable(dbCollectionArg) {
this.dbTablesMap.add(dbCollectionArg);
}
}
exports.Db = Db;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uI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yxJQUFJLGdCQUFnQixHQUFHLElBQUksQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLENBQUMsZUFBZSxFQUFFLEVBQUU7Z0JBQy9ELE1BQU0sQ0FBQyxlQUFlLENBQUMsSUFBSSxLQUFLLE9BQU8sQ0FBQTtZQUN6QyxDQUFDLENBQUMsQ0FBQTtZQUNGLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQTtRQUN6QixDQUFDO0tBQUE7SUFFRCxRQUFRLENBQUUsZUFBNkI7UUFDckMsSUFBSSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsZUFBZSxDQUFDLENBQUE7SUFDdkMsQ0FBQztDQUNGO0FBbERELGdCQWtEQyJ9

View File

@ -8,13 +8,12 @@ export interface IDocValidation<T> {
(doc: T): boolean;
}
export declare function Collection(db: Db): (constructor: any) => void;
export declare class DbCollection<T> {
export declare class DbTable<T> {
/**
* the collection that is used, defaults to mongodb collection,
* can be nedb datastore (sub api of mongodb)
*/
collection: plugins.mongodb.Collection;
collectedClass: T & DbDoc<T>;
table: plugins.rethinkDb.Table;
objectValidation: IDocValidation<T>;
name: string;
db: Db;

View File

@ -1,23 +1,30 @@
"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 });
const plugins = require("./smartdata.plugins");
function Collection(db) {
return function (constructor) {
constructor['dbCollection'] = new DbCollection(constructor, db);
constructor['dbCollection'] = new DbTable(constructor, db);
};
}
exports.Collection = Collection;
class DbCollection {
class DbTable {
constructor(collectedClassArg, dbArg) {
this.objectValidation = null;
// tell the collection where it belongs
this.collectedClass = collectedClassArg;
this.name = collectedClassArg.name;
this.db = dbArg;
// make sure it actually exists
this.collection = dbArg.db.collection(this.name);
// 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)
this.db.addCollection(this);
this.db.addTable(this);
}
/**
* adds a validation function that all newly inserted and updated objects have to pass
@ -29,34 +36,16 @@ class DbCollection {
* finds an object in the DbCollection
*/
find(docMatchArg, optionsArg) {
let done = plugins.smartq.defer();
let findCursor = this.collection.find(docMatchArg);
if (optionsArg) {
if (optionsArg.limit) {
findCursor = findCursor.limit(1);
}
}
findCursor.toArray((err, docs) => {
if (err) {
done.reject(err);
throw err;
}
done.resolve(docs);
return __awaiter(this, void 0, void 0, function* () {
});
return done.promise;
}
/**
* inserts object into the DbCollection
*/
insertOne(docArg) {
let done = plugins.smartq.defer();
this.checkDoc(docArg).then(() => {
this.collection.insertOne(docArg)
.then(() => { done.resolve(); });
}, () => {
done.reject(new Error('one the docs did not pass validation'));
return __awaiter(this, void 0, void 0, function* () {
yield this.checkDoc(docArg);
});
return done.promise;
}
/**
* inserts many objects at once into the DbCollection
@ -68,7 +57,7 @@ class DbCollection {
checkDocPromiseArray.push(this.checkDoc(docArg));
}
Promise.all(checkDocPromiseArray).then(() => {
this.collection.insertMany(docArrayArg)
this.table.insertMany(docArrayArg)
.then(() => { done.resolve(); });
});
return done.promise;
@ -91,5 +80,5 @@ class DbCollection {
return done.promise;
}
}
exports.DbCollection = DbCollection;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJjb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRkYXRhLmNsYXNzZXMuZGJjb2xsZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQThDO0FBWTlDLG9CQ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QUFXLENBQUM7aUJBQy9CLElBQUksQ0FBQyxHQUFHLEVBQUUsR0FBRyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUNuQyxDQUFDLENBQUMsQ0FBQTtRQUNGLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0lBQ3JCLENBQUM7SUFFRDs7T0FFRztJQUNLLFFBQVEsQ0FBRSxNQUFTO1FBQ3pCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFRLENBQUE7UUFDdkMsSUFBSSxnQkFBZ0IsR0FBRyxJQUFJLENBQUE7UUFDM0IsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQztZQUMxQixnQkFBZ0IsR0FBRyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsTUFBTSxDQUFDLENBQUE7UUFDbEQsQ0FBQztRQUNELEVBQUUsQ0FBQyxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQztZQUNyQixJQUFJLENBQUMsT0FBTyxFQUFFLENBQUE7UUFDaEIsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ04sSUFBSSxDQUFDLE1BQU0sQ0FBQyxtQ0FBbUMsQ0FBQyxDQUFBO1FBQ2xELENBQUM7UUFDRCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtJQUNyQixDQUFDO0NBQ0Y7QUEzRUQsMEJBMkVDIn0=

View File

@ -1,5 +1,5 @@
import { Objectmap } from 'lik';
import { DbCollection } from './smartdata.classes.dbcollection';
import { DbTable } from './smartdata.classes.dbcollection';
export declare type TDocCreation = 'db' | 'new' | 'mixed';
/**
* saveable - saveable decorator to be used on class properties
@ -9,7 +9,7 @@ export declare class DbDoc<T> {
/**
* the collection object an Doc belongs to
*/
collection: DbCollection<T>;
collection: DbTable<T>;
/**
* how the Doc in memory was created, may prove useful later.
*/

View File

@ -5,7 +5,7 @@ const smartdata_classes_dbcollection_1 = require("./smartdata.classes.dbcollecti
exports.getObjectDoc = (nameArg, dbArg) => {
let objectDoc = new smartdata_classes_dbdoc_1.DbDoc();
objectDoc.name = nameArg;
objectDoc.collection = new smartdata_classes_dbcollection_1.DbCollection(objectDoc, dbArg);
objectDoc.collection = new smartdata_classes_dbcollection_1.DbTable(objectDoc, dbArg);
return objectDoc;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJvYmplY3Rkb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYm9iamVjdGRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLHVFQUFpRDtBQUNqRCxxRkFBK0Q7QUFFcEQsUUFBQSxZQUFZLEdBQUcsQ0FBQyxPQUFPLEVBQUMsS0FBUyxFQUFFLEVBQUU7SUFDOUMsSUFBSSxTQUFTLEdBQUcsSUFBSSwrQkFBSyxFQUFFLENBQUE7SUFDM0IsU0FBUyxDQUFDLElBQUksR0FBRyxPQUFPLENBQUE7SUFDeEIsU0FBUyxDQUFDLFVBQVUsR0FBRyxJQUFJLDZDQUFZLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFBO0lBQ3pELE1BQU0sQ0FBQyxTQUFTLENBQUE7QUFDbEIsQ0FBQyxDQUFBIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJvYmplY3Rkb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYm9iamVjdGRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLHVFQUFpRDtBQUNqRCxxRkFBMEQ7QUFFL0MsUUFBQSxZQUFZLEdBQUcsQ0FBQyxPQUFPLEVBQUMsS0FBUyxFQUFFLEVBQUU7SUFDOUMsSUFBSSxTQUFTLEdBQUcsSUFBSSwrQkFBSyxFQUFFLENBQUE7SUFDM0IsU0FBUyxDQUFDLElBQUksR0FBRyxPQUFPLENBQUE7SUFDeEIsU0FBUyxDQUFDLFVBQVUsR0FBRyxJQUFJLHdDQUFPLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFBO0lBQ3BELE1BQU0sQ0FBQyxTQUFTLENBQUE7QUFDbEIsQ0FBQyxDQUFBIn0=

71
package-lock.json generated
View File

@ -4,19 +4,6 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/bson": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/bson/-/bson-1.0.6.tgz",
"integrity": "sha512-v7N8qcTGiYhLRyi+Y69R3tPC4GLqByCg3NC2EO6PciC166O9dNhjFPoXeMePtZ+0f+/O2xLDWXs5BLnRfcBaBA==",
"requires": {
"@types/node": "8.5.7"
}
},
"@types/events": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-1.1.0.tgz",
"integrity": "sha512-y3bR98mzYOo0pAZuiLari+cQyiKk3UXRuT45h1RjhfeCzqkjaVsfZJNaxdgtk7/3tzOm1ozLTqEqMP3VbI48jw=="
},
"@types/lodash": {
"version": "4.14.92",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.92.tgz",
@ -27,21 +14,6 @@
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/mongodb": {
"version": "2.2.18",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-2.2.18.tgz",
"integrity": "sha512-bNookS+Y4N7B9/z9lZrTcVUdXSfrH8J+svBFCzxbCl5pOg32YeIgvKjrqD4yF7Ecec7bo7ZCdqajXS06TeuWdA==",
"requires": {
"@types/bson": "1.0.6",
"@types/events": "1.1.0",
"@types/node": "8.5.7"
}
},
"@types/node": {
"version": "8.5.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.7.tgz",
"integrity": "sha512-+1ZfzGIq8Y3EV7hPF7bs3i+Gi2mqYOiEGGRxGYPrn+hTYLMmzg+/5TkMkCHiRtLB38XSNvr/43aQ9+cUq4BbBg=="
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -61,6 +33,25 @@
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"conventional-commit-types": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/conventional-commit-types/-/conventional-commit-types-2.2.0.tgz",
"integrity": "sha1-XblXOdbCEqy+e29lahG5QLqmiUY=",
"dev": true
},
"cz-conventional-changelog": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz",
"integrity": "sha1-L0vHOQ4yROTfKT5ro1Hkx0Cnx2Q=",
"dev": true,
"requires": {
"conventional-commit-types": "2.2.0",
"lodash.map": "4.6.0",
"longest": "1.0.1",
"right-pad": "1.0.1",
"word-wrap": "1.2.3"
}
},
"define-properties": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz",
@ -163,6 +154,18 @@
}
}
},
"lodash.map": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz",
"integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=",
"dev": true
},
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"dev": true
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@ -185,6 +188,12 @@
"es-abstract": "1.10.0"
}
},
"right-pad": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz",
"integrity": "sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA=",
"dev": true
},
"symbol-tree": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz",
@ -203,6 +212,12 @@
"define-properties": "1.1.2",
"object.getownpropertydescriptors": "2.0.3"
}
},
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
"dev": true
}
}
}

View File

@ -26,14 +26,20 @@
"lodash": "^4.17.4",
"rethinkdb": "^2.3.3",
"runtime-type-checks": "0.0.4",
"smartq": "^1.1.6",
"typings-global": "^1.0.28"
"smartq": "^1.1.6"
},
"devDependencies": {
"@types/node": "^8.5.7",
"@types/shelljs": "^0.7.4",
"cz-conventional-changelog": "^2.1.0",
"qenv": "^1.1.7",
"shelljs": "^0.7.8",
"smartstring": "^2.0.24",
"tapbundle": "^1.1.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}

View File

@ -35,6 +35,10 @@
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"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.5.7.tgz#9c498c35af354dcfbca3790fb2e81129e93cf0e2"
"@types/rethinkdb@^2.3.8":
version "2.3.8"
resolved "https://registry.yarnpkg.com/@types/rethinkdb/-/rethinkdb-2.3.8.tgz#961f78f0e731668631891bd1199722bb4a2258a8"
@ -165,6 +169,10 @@ concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
conventional-commit-types@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-2.2.0.tgz#5db95739d6c212acbe7b6f656a11b940baa68946"
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@ -173,6 +181,16 @@ crypto-random-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e"
cz-conventional-changelog@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz#2f4bc7390e3244e4df293e6ba351e4c740a7c764"
dependencies:
conventional-commit-types "^2.0.0"
lodash.map "^4.5.1"
longest "^1.0.1"
right-pad "^1.0.1"
word-wrap "^1.0.3"
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
@ -395,6 +413,10 @@ lik@^2.0.2:
symbol-tree "^3.2.2"
typings-global "^1.0.20"
lodash.map@^4.5.1:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
lodash@^4.17.4:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
@ -405,6 +427,10 @@ log-symbols@^1.0.2:
dependencies:
chalk "^1.0.0"
longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
memwatch-next@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
@ -558,6 +584,10 @@ rethinkdb@^2.3.3:
dependencies:
bluebird ">= 2.3.2 < 3"
right-pad@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0"
runtime-type-checks@0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/runtime-type-checks/-/runtime-type-checks-0.0.4.tgz#5682baf2ffe53f955fe3e065b40a0a09943845c8"
@ -738,10 +768,6 @@ typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.17, typings-
semver "^5.3.0"
smartshell "^1.0.6"
typings-global@^1.0.28:
version "1.0.28"
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4"
universalify@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
@ -784,6 +810,10 @@ which@^1.3.0:
dependencies:
isexe "^2.0.0"
word-wrap@^1.0.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"