Compare commits
59 Commits
Author | SHA1 | Date | |
---|---|---|---|
9e11301135 | |||
9ba29b7b81 | |||
1540f443e6 | |||
a4f3f23bed | |||
2039f1c807 | |||
57d1a6dd0a | |||
d504e90e47 | |||
7079340657 | |||
63ceded1b8 | |||
b45e7ee206 | |||
715709f3ec | |||
0b8adea736 | |||
90d9a25b3f | |||
e49811eecd | |||
9cbdf317dc | |||
d55339013a | |||
9acdbd2842 | |||
dfce8cfcc0 | |||
38446fc79b | |||
af8c41ad6c | |||
3a24f829b4 | |||
67db1325c1 | |||
6683c05c22 | |||
f7f7852b7f | |||
df4346e0a2 | |||
eb54fbcd0d | |||
f13c12cd47 | |||
08d53f22f5 | |||
5b6523e6f4 | |||
138290a7b8 | |||
036cafc282 | |||
7764ba5cb8 | |||
7f77634ea1 | |||
acf3c29939 | |||
925cd639b4 | |||
af8de58dcd | |||
f39703b8d9 | |||
fa1951b4dd | |||
8c37a367a0 | |||
37f388e998 | |||
78bdb6760e | |||
ce1dceb60c | |||
16add8bff0 | |||
11149b2712 | |||
e508a942e3 | |||
5b093c68e4 | |||
d1b0a65993 | |||
316030be7c | |||
411b0b1ae9 | |||
50a6a1a690 | |||
ee3c3580d3 | |||
6dd82994a6 | |||
295096de24 | |||
50b5f84955 | |||
1557c713cd | |||
4ce457fadf | |||
56d6e0fd45 | |||
89ebf23d46 | |||
a861444c30 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
test/data
|
|
||||||
pages/
|
|
||||||
coverage/
|
|
||||||
public/
|
public/
|
||||||
|
coverage/
|
||||||
|
.nogit/
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
image: hosttoday/ht-docker-node:npmts
|
# gitzone standard
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .yarn/
|
||||||
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
|
- trigger
|
||||||
before_script:
|
- pages
|
||||||
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
|
|
||||||
- echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y mongodb-org
|
|
||||||
|
|
||||||
testLEGACY:
|
testLEGACY:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci test legacy
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
@ -22,6 +25,7 @@ testLTS:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci test lts
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
@ -29,15 +33,40 @@ testSTABLE:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci test stable
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
environment: npm_registry
|
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
stage: trigger
|
||||||
|
script:
|
||||||
|
- npmci trigger
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
stage: pages
|
||||||
|
script:
|
||||||
|
- npmci command yarn global add npmpage
|
||||||
|
- npmci command npmpage
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
29
README.md
Normal file
29
README.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# smartdata
|
||||||
|
do more with data
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
[](https://www.npmjs.com/package/smartdata)
|
||||||
|
[](https://GitLab.com/pushrocks/smartdata)
|
||||||
|
[](https://github.com/pushrocks/smartdata)
|
||||||
|
[](https://pushrocks.gitlab.io/smartdata/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://GitLab.com/pushrocks/smartdata/commits/master)
|
||||||
|
[](https://GitLab.com/pushrocks/smartdata/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/smartdata)
|
||||||
|
[](https://david-dm.org/pushrocks/smartdata)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartdata)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
17
dist/index.d.ts
vendored
17
dist/index.d.ts
vendored
@ -1,14 +1,3 @@
|
|||||||
/// <reference types="q" />
|
export * from './smartdata.classes.db';
|
||||||
import * as plugins from './smartdata.plugins';
|
export * from './smartdata.classes.dbcollection';
|
||||||
export declare class DbCollection<T> {
|
export * from './smartdata.classes.dbdoc';
|
||||||
constructor(nameArg: string, db: plugins.mongodb.Db);
|
|
||||||
}
|
|
||||||
export declare type TDbConnectionStatus = 'disconnected' | 'connected' | 'failed';
|
|
||||||
export declare class DbConnection {
|
|
||||||
dbUrl: string;
|
|
||||||
db: plugins.mongodb.Db;
|
|
||||||
status: TDbConnectionStatus;
|
|
||||||
constructor(dbUrl: string);
|
|
||||||
connect(): plugins.q.Promise<any>;
|
|
||||||
close(): plugins.q.Promise<any>;
|
|
||||||
}
|
|
||||||
|
40
dist/index.js
vendored
40
dist/index.js
vendored
@ -1,35 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
const plugins = require('./smartdata.plugins');
|
function __export(m) {
|
||||||
class DbCollection {
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||||
constructor(nameArg, db) {
|
|
||||||
let collection = db.collection(nameArg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.DbCollection = DbCollection;
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
class DbConnection {
|
__export(require("./smartdata.classes.db"));
|
||||||
constructor(dbUrl) {
|
__export(require("./smartdata.classes.dbcollection"));
|
||||||
this.dbUrl = dbUrl;
|
__export(require("./smartdata.classes.dbdoc"));
|
||||||
}
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUVBLDRDQUFzQztBQUN0QyxzREFBZ0Q7QUFDaEQsK0NBQXlDIn0=
|
||||||
connect() {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
plugins.mongodb.MongoClient.connect(this.dbUrl, (err, db) => {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
plugins.assert.equal(null, err);
|
|
||||||
this.db = db;
|
|
||||||
plugins.beautylog.success(`connected to database at ${this.dbUrl}`);
|
|
||||||
done.resolve(this.db);
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
close() {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
this.db.close();
|
|
||||||
plugins.beautylog.ok(`disconnected to database at ${this.dbUrl}`);
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.DbConnection = DbConnection;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxPQUFPLFdBQU0scUJBRXpCLENBQUMsQ0FGNkM7QUFFOUM7SUFDSSxZQUFZLE9BQWUsRUFBRSxFQUFzQjtRQUMvQyxJQUFJLFVBQVUsR0FBRyxFQUFFLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQzNDLENBQUM7QUFDTCxDQUFDO0FBSlksb0JBQVksZUFJeEIsQ0FBQTtBQUlEO0lBS0ksWUFBWSxLQUFhO1FBQ3JCLElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFBO0lBQ3RCLENBQUM7SUFFRCxPQUFPO1FBQ0gsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUM1QixPQUFPLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFDLEdBQUcsRUFBRSxFQUFFO1lBQ3BELEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUM7Z0JBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtZQUFDLENBQUM7WUFDN0IsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLEdBQUcsQ0FBQyxDQUFBO1lBQy9CLElBQUksQ0FBQyxFQUFFLEdBQUcsRUFBRSxDQUFBO1lBQ1osT0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsNEJBQTRCLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQyxDQUFBO1lBQ25FLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFBO1FBQ3pCLENBQUMsQ0FBQyxDQUFBO1FBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDdkIsQ0FBQztJQUVELEtBQUs7UUFDRCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQzVCLElBQUksQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFLENBQUE7UUFDZixPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQywrQkFBK0IsSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFDLENBQUE7UUFDakUsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFBO1FBQ2QsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDdkIsQ0FBQztBQUNMLENBQUM7QUE1Qlksb0JBQVksZUE0QnhCLENBQUEifQ==
|
|
32
dist/smartdata.classes.db.d.ts
vendored
Normal file
32
dist/smartdata.classes.db.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import * as plugins from './smartdata.plugins';
|
||||||
|
import { Objectmap } from 'lik';
|
||||||
|
import { DbCollection } from './smartdata.classes.dbcollection';
|
||||||
|
/**
|
||||||
|
* interface - indicates the connection status of the db
|
||||||
|
*/
|
||||||
|
export declare type TConnectionStatus = 'disconnected' | 'connected' | 'failed';
|
||||||
|
export declare class Db {
|
||||||
|
dbUrl: string;
|
||||||
|
db: plugins.mongodb.Db;
|
||||||
|
status: TConnectionStatus;
|
||||||
|
classCollections: Objectmap<DbCollection<any>>;
|
||||||
|
objectCollections: Objectmap<DbCollection<any>>;
|
||||||
|
constructor(dbUrlArg: string);
|
||||||
|
/**
|
||||||
|
* connects to the database that was specified during instance creation
|
||||||
|
*/
|
||||||
|
connect(): Promise<any>;
|
||||||
|
/**
|
||||||
|
* closes the connection to the databse
|
||||||
|
*/
|
||||||
|
close(): Promise<any>;
|
||||||
|
/**
|
||||||
|
* gets a class based collection by name: string
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
81
dist/smartdata.classes.db.js
vendored
Normal file
81
dist/smartdata.classes.db.js
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
"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");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
// basic connection stuff ----------------------------------------------
|
||||||
|
/**
|
||||||
|
* connects to the database that was specified during instance creation
|
||||||
|
*/
|
||||||
|
connect() {
|
||||||
|
let done = plugins.smartq.defer();
|
||||||
|
plugins.mongodb.MongoClient.connect(this.dbUrl, (err, db) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
plugins.assert.equal(null, err);
|
||||||
|
this.db = db;
|
||||||
|
plugins.beautylog.success(`connected to database at ${this.dbUrl}`);
|
||||||
|
done.resolve(this.db);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* closes the connection to the databse
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
let done = plugins.smartq.defer();
|
||||||
|
this.db.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) => {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Db = Db;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBQzlDLDZCQUErQjtBQUcvQixtRkFBOEQ7QUFPOUQ7SUFPRSxZQUFhLFFBQWdCO1FBSDdCLHFCQUFnQixHQUFHLElBQUksZUFBUyxFQUFxQixDQUFBO1FBQ3JELHNCQUFpQixHQUFHLElBQUksZUFBUyxFQUFxQixDQUFBO1FBR3BELElBQUksQ0FBQyxLQUFLLEdBQUcsUUFBUSxDQUFBO0lBQ3ZCLENBQUM7SUFFRCx3RUFBd0U7SUFFeEU7O09BRUc7SUFDSCxPQUFPO1FBQ0wsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUNqQyxPQUFPLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFDLEdBQUcsRUFBRSxFQUFFO1lBQ3RELEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyx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ENBQUMsQ0FBQyxDQUFBO1lBQ0YsTUFBTSxDQUFDLGdCQUFnQixDQUFBO1FBQ3pCLENBQUM7S0FBQTtJQUVEOztPQUVHO0lBQ0cseUJBQXlCLENBQUssT0FBZSxFQUFFLEtBQVMsRUFBRyxhQUFzQixLQUFLOztZQUMxRixJQUFJLGdCQUFnQixHQUFHLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLENBQUMsQ0FBQyxlQUFlO2dCQUNqRSxNQUFNLENBQUMsZUFBZSxDQUFDLElBQUksS0FBSyxPQUFPLENBQUE7WUFDekMsQ0FBQyxDQUFDLENBQUE7WUFDRixFQUFFLENBQUMsQ0FBQyxDQUFDLGdCQUFnQixJQUFJLFVBQVUsQ0FBQyxDQUFDLENBQUM7Z0JBQ3BDLGdCQUFnQixHQUFHLDRDQUFZLENBQUMsT0FBTyxFQUFFLElBQUksQ0FBQyxDQUFDLFVBQVUsQ0FBQTtnQkFDekQsTUFBTSxDQUFDLGdCQUFnQixDQUFBO1lBQ3pCLENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixNQUFNLENBQUMsZ0JBQWdCLENBQUE7WUFDekIsQ0FBQztRQUNILENBQUM7S0FBQTtJQUVELGFBQWEsQ0FBRSxlQUFrQztRQUMvQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsR0FBRyxDQUFDLGVBQWUsQ0FBQyxDQUFBO0lBQzVDLENBQUM7Q0FFRjtBQXRFRCxnQkFzRUMifQ==
|
42
dist/smartdata.classes.dbcollection.d.ts
vendored
Normal file
42
dist/smartdata.classes.dbcollection.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import * as plugins from './smartdata.plugins';
|
||||||
|
import { Db } from './smartdata.classes.db';
|
||||||
|
import { DbDoc } from './smartdata.classes.dbDoc';
|
||||||
|
export interface IFindOptions {
|
||||||
|
limit?: number;
|
||||||
|
}
|
||||||
|
export interface IDocValidation<T> {
|
||||||
|
(doc: T): boolean;
|
||||||
|
}
|
||||||
|
export declare function Collection(db: Db): (constructor: any) => void;
|
||||||
|
export declare class DbCollection<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>;
|
||||||
|
objectValidation: IDocValidation<T>;
|
||||||
|
name: string;
|
||||||
|
db: Db;
|
||||||
|
constructor(collectedClassArg: T & DbDoc<T>, dbArg: Db);
|
||||||
|
/**
|
||||||
|
* adds a validation function that all newly inserted and updated objects have to pass
|
||||||
|
*/
|
||||||
|
addDocValidation(funcArg: IDocValidation<T>): void;
|
||||||
|
/**
|
||||||
|
* finds an object in the DbCollection
|
||||||
|
*/
|
||||||
|
find(docMatchArg: T | any, optionsArg?: IFindOptions): Promise<T[]>;
|
||||||
|
/**
|
||||||
|
* inserts object into the DbCollection
|
||||||
|
*/
|
||||||
|
insertOne(docArg: T): Promise<void>;
|
||||||
|
/**
|
||||||
|
* inserts many objects at once into the DbCollection
|
||||||
|
*/
|
||||||
|
insertMany(docArrayArg: T[]): Promise<void>;
|
||||||
|
/**
|
||||||
|
* checks a Doc for constraints
|
||||||
|
*/
|
||||||
|
private checkDoc(docArg);
|
||||||
|
}
|
95
dist/smartdata.classes.dbcollection.js
vendored
Normal file
95
dist/smartdata.classes.dbcollection.js
vendored
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const plugins = require("./smartdata.plugins");
|
||||||
|
function Collection(db) {
|
||||||
|
return function (constructor) {
|
||||||
|
constructor['dbCollection'] = new DbCollection(constructor, db);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.Collection = Collection;
|
||||||
|
class DbCollection {
|
||||||
|
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);
|
||||||
|
// tell the db class about it (important since Db uses different systems under the hood)
|
||||||
|
this.db.addCollection(this);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* adds a validation function that all newly inserted and updated objects have to pass
|
||||||
|
*/
|
||||||
|
addDocValidation(funcArg) {
|
||||||
|
this.objectValidation = funcArg;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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 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 done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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.collection.insertMany(docArrayArg)
|
||||||
|
.then(() => { done.resolve(); });
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* checks a Doc for constraints
|
||||||
|
*/
|
||||||
|
checkDoc(docArg) {
|
||||||
|
let done = plugins.smartq.defer();
|
||||||
|
let validationResult = true;
|
||||||
|
if (this.objectValidation) {
|
||||||
|
validationResult = this.objectValidation(docArg);
|
||||||
|
}
|
||||||
|
if (validationResult) {
|
||||||
|
done.resolve();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
done.reject('validation of object did not pass');
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.DbCollection = DbCollection;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJjb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRkYXRhLmNsYXNzZXMuZGJjb2xsZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQThDO0FBWTlDLG9CQUE0QixFQUFNO0lBQ2hDLE1BQU0sQ0FBQyxVQUFVLFdBQVc7UUFDMUIsV0FBVyxDQUFFLGNBQWMsQ0FBRSxHQUFHLElBQUksWUFBWSxDQUFDLFdBQVcsRUFBRSxFQUFFLENBQUMsQ0FBQTtJQUNuRSxDQUFDLENBQUE7QUFDSCxDQUFDO0FBSkQsZ0NBSUM7QUFFRDtJQVdFLFlBQWEsaUJBQStCLEVBQUUsS0FBUztRQUp2RCxxQkFBZ0IsR0FBc0IsSUFBSSxDQUFBO1FBS3hDLHVDQUF1QztRQUN2QyxJQUFJLENBQUMsY0FBYyxHQUFHLGlCQUFpQixDQUFBO1FBQ3ZDLElBQUks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|||||||
|
import { Objectmap } from 'lik';
|
||||||
|
import { DbCollection } from './smartdata.classes.dbcollection';
|
||||||
|
export declare type TDocCreation = 'db' | 'new' | 'mixed';
|
||||||
|
/**
|
||||||
|
* saveable - saveable decorator to be used on class properties
|
||||||
|
*/
|
||||||
|
export declare function svDb(): (target: DbDoc<any>, key: string) => void;
|
||||||
|
export declare class DbDoc<T> {
|
||||||
|
/**
|
||||||
|
* the collection object an Doc belongs to
|
||||||
|
*/
|
||||||
|
collection: DbCollection<T>;
|
||||||
|
/**
|
||||||
|
* how the Doc in memory was created, may prove useful later.
|
||||||
|
*/
|
||||||
|
creationType: TDocCreation;
|
||||||
|
/**
|
||||||
|
* an array of saveable properties of a doc
|
||||||
|
*/
|
||||||
|
saveableProperties: string[];
|
||||||
|
/**
|
||||||
|
* name
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* class constructor
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* saves this instance but not any connected items
|
||||||
|
* may lead to data inconsistencies, but is faster
|
||||||
|
*/
|
||||||
|
save(): void;
|
||||||
|
/**
|
||||||
|
* also store any referenced objects to DB
|
||||||
|
* better for data consistency
|
||||||
|
*/
|
||||||
|
saveDeep(savedMapArg?: Objectmap<DbDoc<any>>): void;
|
||||||
|
}
|
61
dist/smartdata.classes.dbdoc.js
vendored
Normal file
61
dist/smartdata.classes.dbdoc.js
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const lik_1 = require("lik");
|
||||||
|
/**
|
||||||
|
* saveable - saveable decorator to be used on class properties
|
||||||
|
*/
|
||||||
|
function svDb() {
|
||||||
|
return (target, key) => {
|
||||||
|
console.log('called sva');
|
||||||
|
if (!target.saveableProperties) {
|
||||||
|
target.saveableProperties = [];
|
||||||
|
}
|
||||||
|
target.saveableProperties.push(key);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.svDb = svDb;
|
||||||
|
class DbDoc {
|
||||||
|
/**
|
||||||
|
* class constructor
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
this.name = this.constructor['name'];
|
||||||
|
this.collection = this.constructor['dbCollection'];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* saves this instance but not any connected items
|
||||||
|
* may lead to data inconsistencies, but is faster
|
||||||
|
*/
|
||||||
|
save() {
|
||||||
|
let saveableObject = {}; // is not exposed to outside, so any is ok here
|
||||||
|
for (let propertyNameString of this.saveableProperties) {
|
||||||
|
saveableObject[propertyNameString] = this[propertyNameString];
|
||||||
|
}
|
||||||
|
switch (this.creationType) {
|
||||||
|
case 'db':
|
||||||
|
this.collection; // TODO implement collection.update()
|
||||||
|
break;
|
||||||
|
case 'new':
|
||||||
|
this.collection.insertOne(saveableObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* also store any referenced objects to DB
|
||||||
|
* better for data consistency
|
||||||
|
*/
|
||||||
|
saveDeep(savedMapArg = null) {
|
||||||
|
if (!savedMapArg) {
|
||||||
|
savedMapArg = new lik_1.Objectmap();
|
||||||
|
}
|
||||||
|
savedMapArg.add(this);
|
||||||
|
this.save();
|
||||||
|
for (let propertyKey in this) {
|
||||||
|
let property = this[propertyKey];
|
||||||
|
if (property instanceof DbDoc && !savedMapArg.checkForObject(property)) {
|
||||||
|
property.saveDeep(savedMapArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.DbDoc = DbDoc;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJEb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYkRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBLDZCQUErQjtBQU8vQj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1IsSUFBSSxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsY0FBYyxDQUFDLENBQUE7UUFDN0MsQ0FBQztJQUNILENBQUM7SUFFRDs7O09BR0c7SUFDSCxRQUFRLENBQUMsY0FBcUMsSUFBSTtRQUNoRCxFQUFFLENBQUMsQ0FBQyxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUM7WUFDakIsV0FBVyxHQUFHLElBQUksZUFBUyxFQUFjLENBQUE7UUFDM0MsQ0FBQztRQUNELFdBQVcsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDckIsSUFBSSxDQUFDLElBQUksRUFBRSxDQUFBO1FBQ1gsR0FBRyxDQUFDLENBQUMsSUFBSSxXQUFXLElBQUksSUFBSSxDQUFDLENBQUMsQ0FBQztZQUM3QixJQUFJLFFBQVEsR0FBRyxJQUFJLENBQUUsV0FBVyxDQUFFLENBQUE7WUFDbEMsRUFBRSxDQUFDLENBQUMsUUFBUSxZQUFZLEtBQUssSUFBSSxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUN2RSxRQUFRLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxDQUFBO1lBQ2hDLENBQUM7UUFDSCxDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBakVELHNCQWlFQyJ9
|
3
dist/smartdata.classes.dbobjectdoc.d.ts
vendored
Normal file
3
dist/smartdata.classes.dbobjectdoc.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { Db } from './smartdata.classes.db';
|
||||||
|
import { DbDoc } from './smartdata.classes.dbdoc';
|
||||||
|
export declare let getObjectDoc: (nameArg: any, dbArg: Db) => DbDoc<{}>;
|
11
dist/smartdata.classes.dbobjectdoc.js
vendored
Normal file
11
dist/smartdata.classes.dbobjectdoc.js
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
"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.DbCollection(objectDoc, dbArg);
|
||||||
|
return objectDoc;
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLmNsYXNzZXMuZGJvYmplY3Rkb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEuY2xhc3Nlcy5kYm9iamVjdGRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLHVFQUFpRDtBQUNqRCxxRkFBK0Q7QUFFcEQsUUFBQSxZQUFZLEdBQUcsQ0FBQyxPQUFPLEVBQUMsS0FBUztJQUMxQyxJQUFJLFNBQVMsR0FBRyxJQUFJLCtCQUFLLEVBQUUsQ0FBQTtJQUMzQixTQUFTLENBQUMsSUFBSSxHQUFHLE9BQU8sQ0FBQTtJQUN4QixTQUFTLENBQUMsVUFBVSxHQUFHLElBQUksNkNBQVksQ0FBQyxTQUFTLEVBQUUsS0FBSyxDQUFDLENBQUE7SUFDekQsTUFBTSxDQUFDLFNBQVMsQ0FBQTtBQUNsQixDQUFDLENBQUEifQ==
|
10
dist/smartdata.plugins.d.ts
vendored
10
dist/smartdata.plugins.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
import 'typings-global';
|
import 'typings-global';
|
||||||
export import assert = require('assert');
|
import * as assert from 'assert';
|
||||||
export import beautylog = require('beautylog');
|
import * as beautylog from 'beautylog';
|
||||||
export import mongodb = require('mongodb');
|
import * as lodash from 'lodash';
|
||||||
export import q = require('q');
|
import * as mongodb from 'mongodb';
|
||||||
|
import * as smartq from 'smartq';
|
||||||
|
export { assert, beautylog, lodash, mongodb, smartq };
|
||||||
|
19
dist/smartdata.plugins.js
vendored
19
dist/smartdata.plugins.js
vendored
@ -1,7 +1,14 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require('typings-global');
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.assert = require('assert');
|
require("typings-global");
|
||||||
exports.beautylog = require('beautylog');
|
const assert = require("assert");
|
||||||
exports.mongodb = require('mongodb');
|
exports.assert = assert;
|
||||||
exports.q = require('q');
|
const beautylog = require("beautylog");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBQ1QsY0FBTSxXQUFXLFFBQVEsQ0FBQyxDQUFBO0FBQzFCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUE7QUFDaEMsZUFBTyxXQUFXLFNBQVMsQ0FBQyxDQUFBO0FBQzVCLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQSJ9
|
exports.beautylog = beautylog;
|
||||||
|
const lodash = require("lodash");
|
||||||
|
exports.lodash = lodash;
|
||||||
|
const mongodb = require("mongodb");
|
||||||
|
exports.mongodb = mongodb;
|
||||||
|
const smartq = require("smartq");
|
||||||
|
exports.smartq = smartq;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRkYXRhLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGRhdGEucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixpQ0FBZ0M7QUFPNUIsd0JBQU07QUFOVix1Q0FBc0M7QUFPbEMsOEJBQVM7QUFOYixpQ0FBZ0M7QUFPNUIsd0JBQU07QUFOVixtQ0FBa0M7QUFPOUIsMEJBQU87QUFOWCxpQ0FBZ0M7QUFPNUIsd0JBQU0ifQ==
|
113
docs/index.md
Normal file
113
docs/index.md
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
# smartdata
|
||||||
|
do more with data
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
[](https://www.npmjs.com/package/smartdata)
|
||||||
|
[](https://GitLab.com/pushrocks/smartdata)
|
||||||
|
[](https://github.com/pushrocks/smartdata)
|
||||||
|
[](https://pushrocks.gitlab.io/smartdata/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
[](https://GitLab.com/pushrocks/smartdata/commits/master)
|
||||||
|
[](https://GitLab.com/pushrocks/smartdata/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/smartdata)
|
||||||
|
[](https://david-dm.org/pushrocks/smartdata)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartdata)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
smartdata is an ODM that adheres to TypeScript practices and uses classes to organize data.
|
||||||
|
It uses MongoDB or NeDb as persistent storage.
|
||||||
|
|
||||||
|
## Intention
|
||||||
|
There are many ODMs out there, however when we searched for an ODM that uses TypeScript,
|
||||||
|
acts smart while still embracing the NoSQL idea we didn't find a matching solution.
|
||||||
|
This is why we started smartdata.
|
||||||
|
|
||||||
|
How MongoDB terms map to smartdata classes
|
||||||
|
|
||||||
|
MongoDB term | smartdata class
|
||||||
|
--- | ---
|
||||||
|
Database | smartdata.Db
|
||||||
|
Collection | smartdata.DbCollection
|
||||||
|
Document | smartdata.DbDoc
|
||||||
|
|
||||||
|
### class Db
|
||||||
|
represents a Database. Naturally it has .connect() etc. methods on it.
|
||||||
|
Since it is a class you can have multiple DBs defined.
|
||||||
|
```javascript
|
||||||
|
import * as smartdata from 'smartdata'
|
||||||
|
|
||||||
|
// mongodb
|
||||||
|
let myDb1 = new smartdata.Db('someConnectionUrl')
|
||||||
|
let myDb2 = new smartdata.Db('someConnectionUrl')
|
||||||
|
|
||||||
|
// nedb
|
||||||
|
let myDb3 = new smartdata('/some/path/for/persistence', 'nedb') // you may set first argument to null for just in memory db
|
||||||
|
|
||||||
|
myDb1.connect()
|
||||||
|
myDb2.connect()
|
||||||
|
|
||||||
|
// continues in next block...
|
||||||
|
```
|
||||||
|
|
||||||
|
### class DbCollection
|
||||||
|
represents a collection of objects.
|
||||||
|
A collection is defined by the object class (that is extending smartdata.dbdoc) it respresents
|
||||||
|
|
||||||
|
So to get to get access to a specific collection you document
|
||||||
|
```javascript
|
||||||
|
// continues from the block before...
|
||||||
|
|
||||||
|
@Collection(myDb1)
|
||||||
|
class myObject extends smartdata.DbDoc<myObject> { // read the next block about DbDoc
|
||||||
|
@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()
|
||||||
|
constructor(optionsArg:{
|
||||||
|
property1: string,
|
||||||
|
property2: number
|
||||||
|
}) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let myCollection = myDb1.getCollectionByName<myObject>(myObject)
|
||||||
|
|
||||||
|
// start to instantiate classes from scratch or database
|
||||||
|
```
|
||||||
|
|
||||||
|
> Alert: You NEVER instantiate a collection.
|
||||||
|
This is done for you!!!
|
||||||
|
|
||||||
|
### class DbDoc
|
||||||
|
represents a individual document in a collection
|
||||||
|
and thereby is ideally suited to extend the class you want to actually store.
|
||||||
|
|
||||||
|
DbDoc extends your class with the following methods:
|
||||||
|
|
||||||
|
* `.save()` will save (or update) the object you call it on only. Any referenced non-savable objects will not get stored.
|
||||||
|
* `.saveDeep()` does the same like `.save()`.
|
||||||
|
In addition it will look for properties that reference an object
|
||||||
|
that extends DbDoc as well and call .saveDeep() on them as well.
|
||||||
|
Loops are prevented
|
||||||
|
|
||||||
|
So now we can **store** instances of classes to Db...
|
||||||
|
How do we **get** a new class instance from a Doc in the DB?
|
||||||
|
|
||||||
|
## TypeScript
|
||||||
|
How does TypeScript play into this?
|
||||||
|
Since you define your classes in TypeScript and types flow through smartdata in a generic way
|
||||||
|
you should get all the Intellisense and type checking you love when using smartdata.
|
||||||
|
smartdata itself also bundles typings.
|
||||||
|
So you don't need to install any additional types when importing smartdata.
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
17
npmextra.json
Normal file
17
npmextra.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"npmdocker": {
|
||||||
|
"baseImage": "hosttoday/ht-docker-node:mongo",
|
||||||
|
"command": "npmci test stable",
|
||||||
|
"dockerSock": false
|
||||||
|
},
|
||||||
|
"npmci": {
|
||||||
|
"globalNpmTools": [
|
||||||
|
"npmts"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"npmts": {
|
||||||
|
"testConfig": {
|
||||||
|
"parallel": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
package.json
30
package.json
@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "smartdata",
|
"name": "smartdata",
|
||||||
"version": "1.0.1",
|
"version": "1.0.23",
|
||||||
"description": "do more with data",
|
"description": "do more with data",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(npmts)",
|
||||||
|
"testLocal": "(npmdocker)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -18,18 +19,21 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartdata#README",
|
"homepage": "https://gitlab.com/pushrocks/smartdata#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/mongodb": "^2.1.32",
|
"@types/lodash": "^4.14.66",
|
||||||
"@types/q": "0.0.30",
|
"@types/mongodb": "^2.2.6",
|
||||||
"beautylog": "^5.0.23",
|
"beautylog": "^6.1.10",
|
||||||
"mongodb": "^2.2.9",
|
"lik": "^1.0.32",
|
||||||
"q": "^1.4.1",
|
"lodash": "^4.17.4",
|
||||||
"typings-global": "^1.0.14"
|
"mongodb": "^2.2.29",
|
||||||
|
"runtime-type-checks": "0.0.4",
|
||||||
|
"smartq": "^1.1.1",
|
||||||
|
"typings-global": "^1.0.19"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/shelljs": "^0.3.30",
|
"@types/shelljs": "^0.7.2",
|
||||||
"@types/should": "^8.1.29",
|
"qenv": "^1.1.7",
|
||||||
"shelljs": "^0.7.4",
|
"shelljs": "^0.7.8",
|
||||||
"should": "^11.1.0",
|
"smartstring": "^2.0.24",
|
||||||
"typings-test": "^1.0.3"
|
"tapbundle": "^1.0.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
test/test.class.ts
Normal file
52
test/test.class.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
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 '../dist/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`)
|
||||||
|
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.DbCollection)
|
||||||
|
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()
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
import 'typings-test';
|
|
30
test/test.js
30
test/test.js
@ -1,30 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require('typings-test');
|
|
||||||
const shelljs = require('shelljs');
|
|
||||||
const smartdata = require('../dist/index');
|
|
||||||
let mongoChildProcess;
|
|
||||||
let testDbConnection;
|
|
||||||
describe('mongodb', function () {
|
|
||||||
it('should start mongodb', function (done) {
|
|
||||||
mongoChildProcess = shelljs.exec('mongod --dbpath=./test/data --port 27017', { async: true });
|
|
||||||
setTimeout(() => { done(); }, 1500);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('smartdata', function () {
|
|
||||||
it('should establish a connection to mongodb', function (done) {
|
|
||||||
testDbConnection = new smartdata.DbConnection('mongodb://localhost:27017/smartdata');
|
|
||||||
testDbConnection.connect().then(() => { done(); });
|
|
||||||
});
|
|
||||||
it('should create a collection', function () {
|
|
||||||
});
|
|
||||||
it('should close the db Connection', function () {
|
|
||||||
testDbConnection.close();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('mongodb', function () {
|
|
||||||
it('should kill mongodb', function () {
|
|
||||||
shelljs.exec('mongod --dbpath=./test/data --shutdown');
|
|
||||||
mongoChildProcess.kill('SIGTERM');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLE1BQVksT0FBTyxXQUFNLFNBQ3pCLENBQUMsQ0FEaUM7QUFFbEMsTUFBWSxTQUFTLFdBQU0sZUFHM0IsQ0FBQyxDQUh5QztBQUcxQyxJQUFJLGlCQUFpQixDQUFBO0FBQ3JCLElBQUksZ0JBQXdDLENBQUE7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3JDLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
|
76
test/test.ts
76
test/test.ts
@ -1,35 +1,65 @@
|
|||||||
import 'typings-test'
|
import { tap, expect } from 'tapbundle'
|
||||||
import * as shelljs from 'shelljs'
|
import * as smartq from 'smartq'
|
||||||
import * as should from 'should'
|
import { Qenv } from 'qenv'
|
||||||
|
|
||||||
|
let testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit/')
|
||||||
|
|
||||||
|
// the tested module
|
||||||
import * as smartdata from '../dist/index'
|
import * as smartdata from '../dist/index'
|
||||||
|
|
||||||
|
|
||||||
let mongoChildProcess
|
let mongoChildProcess
|
||||||
let testDbConnection: smartdata.DbConnection
|
let testDb: smartdata.Db
|
||||||
|
|
||||||
|
interface ITestObject1 {
|
||||||
|
value1: string
|
||||||
|
value2?: number
|
||||||
|
value3?: string
|
||||||
|
}
|
||||||
|
|
||||||
describe('mongodb',function(){
|
tap.test('should establish a connection to mongodb', async () => {
|
||||||
it('should start mongodb',function(done){
|
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`)
|
||||||
mongoChildProcess = shelljs.exec('mongod --dbpath=./test/data --port 27017',{async: true})
|
await testDb.connect()
|
||||||
setTimeout(() => { done() }, 1500)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
describe('smartdata',function(){
|
|
||||||
it('should establish a connection to mongodb',function(done){
|
|
||||||
testDbConnection = new smartdata.DbConnection('mongodb://localhost:27017/smartdata')
|
|
||||||
testDbConnection.connect().then(() => { done() })
|
|
||||||
})
|
|
||||||
it('should create a collection',function(){
|
|
||||||
|
|
||||||
})
|
// =======================================
|
||||||
it('should close the db Connection',function(){
|
// The actual tests
|
||||||
testDbConnection.close()
|
// =======================================
|
||||||
|
|
||||||
|
let testDbCollection: smartdata.DbCollection<ITestObject1>
|
||||||
|
|
||||||
|
tap.test('should give me a collection', async () => {
|
||||||
|
testDbCollection = await testDb.getObjectCollectionByName<ITestObject1>('TestValue', testDb, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('should insert a doc into the collection', async () => {
|
||||||
|
await testDbCollection.insertOne({ value1: 'test' })
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('should find all docs of testDbCollection', async () => {
|
||||||
|
await testDbCollection.find({}).then(async (resultArray) => {
|
||||||
|
console.log(resultArray)
|
||||||
|
expect(resultArray[ 0 ].value1).equal('test')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('mongodb',function(){
|
tap.test('should insert many docs into the collection', async () => {
|
||||||
it('should kill mongodb',function(){
|
await testDbCollection.insertMany([
|
||||||
shelljs.exec('mongod --dbpath=./test/data --shutdown')
|
{ value1: 'test2' },
|
||||||
mongoChildProcess.kill('SIGTERM')
|
{ value1: 'test', value2: 3, value3: 'hi' }
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('should find a specified doc', async () => {
|
||||||
|
await testDbCollection.find({ 'value3': { '$exists': true } }).then((resultArray) => {
|
||||||
|
console.log(resultArray)
|
||||||
|
expect(resultArray[ 0 ].value3).equal('hi')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tap.test('should close the db Connection', async () => {
|
||||||
|
await testDb.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.start()
|
||||||
|
40
ts/index.ts
40
ts/index.ts
@ -1,39 +1,5 @@
|
|||||||
import * as plugins from './smartdata.plugins'
|
import * as plugins from './smartdata.plugins'
|
||||||
|
|
||||||
export class DbCollection<T> {
|
export * from './smartdata.classes.db'
|
||||||
constructor(nameArg: string, db: plugins.mongodb.Db) {
|
export * from './smartdata.classes.dbcollection'
|
||||||
let collection = db.collection(nameArg)
|
export * from './smartdata.classes.dbdoc'
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TDbConnectionStatus = 'disconnected' | 'connected' | 'failed'
|
|
||||||
|
|
||||||
export class DbConnection {
|
|
||||||
dbUrl: string
|
|
||||||
db: plugins.mongodb.Db
|
|
||||||
status: TDbConnectionStatus
|
|
||||||
|
|
||||||
constructor(dbUrl: string) {
|
|
||||||
this.dbUrl = dbUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(): plugins.q.Promise<any> {
|
|
||||||
let done = plugins.q.defer()
|
|
||||||
plugins.mongodb.MongoClient.connect(this.dbUrl, (err, db) => {
|
|
||||||
if (err) { console.log(err) }
|
|
||||||
plugins.assert.equal(null, err)
|
|
||||||
this.db = db
|
|
||||||
plugins.beautylog.success(`connected to database at ${this.dbUrl}`)
|
|
||||||
done.resolve(this.db)
|
|
||||||
})
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
|
|
||||||
close(): plugins.q.Promise<any> {
|
|
||||||
let done = plugins.q.defer()
|
|
||||||
this.db.close()
|
|
||||||
plugins.beautylog.ok(`disconnected to database at ${this.dbUrl}`)
|
|
||||||
done.resolve()
|
|
||||||
return done.promise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
82
ts/smartdata.classes.db.ts
Normal file
82
ts/smartdata.classes.db.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import * as plugins from './smartdata.plugins'
|
||||||
|
import { Objectmap } from 'lik'
|
||||||
|
|
||||||
|
import { DbCollection } from './smartdata.classes.dbcollection'
|
||||||
|
import { getObjectDoc } from './smartdata.classes.dbobjectdoc'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interface - indicates the connection status of the db
|
||||||
|
*/
|
||||||
|
export type TConnectionStatus = 'disconnected' | 'connected' | 'failed'
|
||||||
|
|
||||||
|
export class Db {
|
||||||
|
dbUrl: string
|
||||||
|
db: plugins.mongodb.Db
|
||||||
|
status: TConnectionStatus
|
||||||
|
classCollections = new Objectmap<DbCollection<any>>()
|
||||||
|
objectCollections = new Objectmap<DbCollection<any>>()
|
||||||
|
|
||||||
|
constructor (dbUrlArg: string) {
|
||||||
|
this.dbUrl = dbUrlArg
|
||||||
|
}
|
||||||
|
|
||||||
|
// basic connection stuff ----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* connects to the database that was specified during instance creation
|
||||||
|
*/
|
||||||
|
connect (): Promise<any> {
|
||||||
|
let done = plugins.smartq.defer()
|
||||||
|
plugins.mongodb.MongoClient.connect(this.dbUrl, (err, db) => {
|
||||||
|
if (err) { console.log(err) }
|
||||||
|
plugins.assert.equal(null, err)
|
||||||
|
this.db = db
|
||||||
|
plugins.beautylog.success(`connected to database at ${this.dbUrl}`)
|
||||||
|
done.resolve(this.db)
|
||||||
|
})
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* closes the connection to the databse
|
||||||
|
*/
|
||||||
|
close (): Promise<any> {
|
||||||
|
let done = plugins.smartq.defer()
|
||||||
|
this.db.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
|
||||||
|
*/
|
||||||
|
async getClassCollectionByName<T> (nameArg: string): Promise<DbCollection<T>> {
|
||||||
|
let resultCollection = this.classCollections.find((dbCollectionArg) => {
|
||||||
|
return dbCollectionArg.name === nameArg
|
||||||
|
})
|
||||||
|
return resultCollection
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets an object collection by name
|
||||||
|
*/
|
||||||
|
async getObjectCollectionByName<T> (nameArg: string, dbArg: Db , makeNewArg: boolean = false): Promise<DbCollection<T>> {
|
||||||
|
let resultCollection = this.objectCollections.find((dbCollectionArg) => {
|
||||||
|
return dbCollectionArg.name === nameArg
|
||||||
|
})
|
||||||
|
if (!resultCollection && makeNewArg) {
|
||||||
|
resultCollection = getObjectDoc(nameArg, this).collection
|
||||||
|
return resultCollection
|
||||||
|
} else {
|
||||||
|
return resultCollection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addCollection (dbCollectionArg: DbCollection<any>) {
|
||||||
|
this.classCollections.add(dbCollectionArg)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
117
ts/smartdata.classes.dbcollection.ts
Normal file
117
ts/smartdata.classes.dbcollection.ts
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import * as plugins from './smartdata.plugins'
|
||||||
|
import { Db } from './smartdata.classes.db'
|
||||||
|
import { DbDoc } from './smartdata.classes.dbDoc'
|
||||||
|
|
||||||
|
export interface IFindOptions {
|
||||||
|
limit?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDocValidation<T> {
|
||||||
|
(doc: T): boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Collection (db: Db) {
|
||||||
|
return function (constructor) {
|
||||||
|
constructor[ 'dbCollection' ] = new DbCollection(constructor, db)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DbCollection<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>
|
||||||
|
objectValidation: IDocValidation<T> = null
|
||||||
|
name: string
|
||||||
|
db: Db
|
||||||
|
|
||||||
|
constructor (collectedClassArg: T & DbDoc<T>, dbArg: Db) {
|
||||||
|
// 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)
|
||||||
|
|
||||||
|
// tell the db class about it (important since Db uses different systems under the hood)
|
||||||
|
this.db.addCollection(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* adds a validation function that all newly inserted and updated objects have to pass
|
||||||
|
*/
|
||||||
|
addDocValidation (funcArg: IDocValidation<T>) {
|
||||||
|
this.objectValidation = funcArg
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* finds an object in the DbCollection
|
||||||
|
*/
|
||||||
|
find (docMatchArg: T | any, optionsArg?: IFindOptions): Promise<T[]> {
|
||||||
|
let done = plugins.smartq.defer<T[]>()
|
||||||
|
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 done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* inserts object into the DbCollection
|
||||||
|
*/
|
||||||
|
insertOne (docArg: T): Promise<void> {
|
||||||
|
let done = plugins.smartq.defer<void>()
|
||||||
|
this.checkDoc(docArg).then(
|
||||||
|
() => {
|
||||||
|
this.collection.insertOne(docArg)
|
||||||
|
.then(() => { done.resolve() })
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
done.reject(new Error('one the docs did not pass validation'))
|
||||||
|
})
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* inserts many objects at once into the DbCollection
|
||||||
|
*/
|
||||||
|
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.collection.insertMany(docArrayArg)
|
||||||
|
.then(() => { done.resolve() })
|
||||||
|
})
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks a Doc for constraints
|
||||||
|
*/
|
||||||
|
private checkDoc (docArg: T): Promise<void> {
|
||||||
|
let done = plugins.smartq.defer<void>()
|
||||||
|
let validationResult = true
|
||||||
|
if (this.objectValidation) {
|
||||||
|
validationResult = this.objectValidation(docArg)
|
||||||
|
}
|
||||||
|
if (validationResult) {
|
||||||
|
done.resolve()
|
||||||
|
} else {
|
||||||
|
done.reject('validation of object did not pass')
|
||||||
|
}
|
||||||
|
return done.promise
|
||||||
|
}
|
||||||
|
}
|
86
ts/smartdata.classes.dbdoc.ts
Normal file
86
ts/smartdata.classes.dbdoc.ts
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import * as plugins from './smartdata.plugins'
|
||||||
|
|
||||||
|
import { Objectmap } from 'lik'
|
||||||
|
|
||||||
|
import { Db } from './smartdata.classes.db'
|
||||||
|
import { DbCollection } from './smartdata.classes.dbcollection'
|
||||||
|
|
||||||
|
export type TDocCreation = 'db' | 'new' | 'mixed'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* saveable - saveable decorator to be used on class properties
|
||||||
|
*/
|
||||||
|
export function svDb() {
|
||||||
|
return (target: DbDoc<any>, key: string) => {
|
||||||
|
console.log('called sva')
|
||||||
|
if (!target.saveableProperties) { target.saveableProperties = [] }
|
||||||
|
target.saveableProperties.push(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DbDoc<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the collection object an Doc belongs to
|
||||||
|
*/
|
||||||
|
collection: DbCollection<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* how the Doc in memory was created, may prove useful later.
|
||||||
|
*/
|
||||||
|
creationType: TDocCreation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* an array of saveable properties of a doc
|
||||||
|
*/
|
||||||
|
saveableProperties: string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name
|
||||||
|
*/
|
||||||
|
name: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class constructor
|
||||||
|
*/
|
||||||
|
constructor () {
|
||||||
|
this.name = this.constructor['name']
|
||||||
|
this.collection = this.constructor[ 'dbCollection' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* saves this instance but not any connected items
|
||||||
|
* may lead to data inconsistencies, but is faster
|
||||||
|
*/
|
||||||
|
save() {
|
||||||
|
let saveableObject: any = {} // is not exposed to outside, so any is ok here
|
||||||
|
for (let propertyNameString of this.saveableProperties) {
|
||||||
|
saveableObject[ propertyNameString ] = this[ propertyNameString ]
|
||||||
|
}
|
||||||
|
switch (this.creationType) {
|
||||||
|
case 'db':
|
||||||
|
this.collection // TODO implement collection.update()
|
||||||
|
break
|
||||||
|
case 'new':
|
||||||
|
this.collection.insertOne(saveableObject)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* also store any referenced objects to DB
|
||||||
|
* better for data consistency
|
||||||
|
*/
|
||||||
|
saveDeep(savedMapArg: Objectmap<DbDoc<any>> = null) {
|
||||||
|
if (!savedMapArg) {
|
||||||
|
savedMapArg = new Objectmap<DbDoc<any>>()
|
||||||
|
}
|
||||||
|
savedMapArg.add(this)
|
||||||
|
this.save()
|
||||||
|
for (let propertyKey in this) {
|
||||||
|
let property = this[ propertyKey ]
|
||||||
|
if (property instanceof DbDoc && !savedMapArg.checkForObject(property)) {
|
||||||
|
property.saveDeep(savedMapArg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
ts/smartdata.classes.dbobjectdoc.ts
Normal file
12
ts/smartdata.classes.dbobjectdoc.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as plugins from './smartdata.plugins'
|
||||||
|
|
||||||
|
import { Db } from './smartdata.classes.db'
|
||||||
|
import { DbDoc } from './smartdata.classes.dbdoc'
|
||||||
|
import { DbCollection } from './smartdata.classes.dbcollection'
|
||||||
|
|
||||||
|
export let getObjectDoc = (nameArg,dbArg: Db) => {
|
||||||
|
let objectDoc = new DbDoc()
|
||||||
|
objectDoc.name = nameArg
|
||||||
|
objectDoc.collection = new DbCollection(objectDoc, dbArg)
|
||||||
|
return objectDoc
|
||||||
|
}
|
@ -1,5 +1,14 @@
|
|||||||
import 'typings-global'
|
import 'typings-global'
|
||||||
export import assert = require('assert')
|
import * as assert from 'assert'
|
||||||
export import beautylog = require('beautylog')
|
import * as beautylog from 'beautylog'
|
||||||
export import mongodb = require('mongodb')
|
import * as lodash from 'lodash'
|
||||||
export import q = require('q')
|
import * as mongodb from 'mongodb'
|
||||||
|
import * as smartq from 'smartq'
|
||||||
|
|
||||||
|
export {
|
||||||
|
assert,
|
||||||
|
beautylog,
|
||||||
|
lodash,
|
||||||
|
mongodb,
|
||||||
|
smartq
|
||||||
|
}
|
||||||
|
8
tsconfig.json
Normal file
8
tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"lib": [
|
||||||
|
"es2015"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
774
yarn.lock
Normal file
774
yarn.lock
Normal file
@ -0,0 +1,774 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@types/bson@*":
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/bson/-/bson-1.0.3.tgz#6c26f0876bf9d8cbb06edd4019e29354bf3a03e0"
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/chai-as-promised@0.0.29":
|
||||||
|
version "0.0.29"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
||||||
|
dependencies:
|
||||||
|
"@types/chai" "*"
|
||||||
|
"@types/promises-a-plus" "*"
|
||||||
|
|
||||||
|
"@types/chai-string@^1.1.30":
|
||||||
|
version "1.1.30"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
||||||
|
dependencies:
|
||||||
|
"@types/chai" "*"
|
||||||
|
|
||||||
|
"@types/chai@*", "@types/chai@^3.4.35":
|
||||||
|
version "3.5.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.5.2.tgz#c11cd2817d3a401b7ba0f5a420f35c56139b1c1e"
|
||||||
|
|
||||||
|
"@types/fs-extra@3.x.x":
|
||||||
|
version "3.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-3.0.3.tgz#1d66eb670ebf657e57c0fda014df340c19d8aa0c"
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/lodash@^4.14.55", "@types/lodash@^4.14.62", "@types/lodash@^4.14.66":
|
||||||
|
version "4.14.66"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.66.tgz#3dbb83477becf130611f8fac82a8fdb199805981"
|
||||||
|
|
||||||
|
"@types/minimatch@2.x.x":
|
||||||
|
version "2.0.29"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
|
||||||
|
|
||||||
|
"@types/mongodb@^2.2.6":
|
||||||
|
version "2.2.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/mongodb/-/mongodb-2.2.6.tgz#cd7cb4c439219af1dfba5860d302eeaf2b0a13e4"
|
||||||
|
dependencies:
|
||||||
|
"@types/bson" "*"
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/node@*":
|
||||||
|
version "8.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.1.tgz#89c271e0c3b9ebb6a3756dd601336970b6228b77"
|
||||||
|
|
||||||
|
"@types/promises-a-plus@*":
|
||||||
|
version "0.0.27"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||||
|
|
||||||
|
"@types/q@1.x.x":
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.1.tgz#dbccb01bd8f0f801a12a4604c7d7af59bb02ae2f"
|
||||||
|
|
||||||
|
"@types/shelljs@^0.6.0":
|
||||||
|
version "0.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.6.0.tgz#090b705c102ce7fc5c0c5ea9b524418ff15840df"
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/shelljs@^0.7.2":
|
||||||
|
version "0.7.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.2.tgz#c2bdb3fe80cd7a3da08750ca898ae44c589671f3"
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/vinyl@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/vinyl/-/vinyl-2.0.0.tgz#fd213bf7f4136dde21fe1895500b12c186f8c268"
|
||||||
|
dependencies:
|
||||||
|
"@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:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz#910de50efcc7c09e3d82f2f87abd6b700c18818a"
|
||||||
|
|
||||||
|
ansi-regex@^2.0.0:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
||||||
|
|
||||||
|
ansi-styles@^2.2.1:
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
||||||
|
|
||||||
|
argparse@^1.0.7:
|
||||||
|
version "1.0.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86"
|
||||||
|
dependencies:
|
||||||
|
sprintf-js "~1.0.2"
|
||||||
|
|
||||||
|
assertion-error@^1.0.1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
||||||
|
|
||||||
|
balanced-match@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
|
|
||||||
|
beautycolor@^1.0.7:
|
||||||
|
version "1.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.7.tgz#a4715738ac4c8221371e9cbeb5a6cc6d11ecbf7c"
|
||||||
|
dependencies:
|
||||||
|
ansi-256-colors "^1.1.0"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
beautylog@^6.1.10:
|
||||||
|
version "6.1.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/beautylog/-/beautylog-6.1.10.tgz#9c27e566937684cb689f9372d98cfa5415d50b72"
|
||||||
|
dependencies:
|
||||||
|
"@types/lodash" "^4.14.55"
|
||||||
|
beautycolor "^1.0.7"
|
||||||
|
figlet "^1.2.0"
|
||||||
|
lodash "^4.17.4"
|
||||||
|
ora "^1.1.0"
|
||||||
|
smartenv "^2.0.0"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
bindings@^1.2.1:
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
|
||||||
|
|
||||||
|
brace-expansion@^1.1.7:
|
||||||
|
version "1.1.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
||||||
|
dependencies:
|
||||||
|
balanced-match "^1.0.0"
|
||||||
|
concat-map "0.0.1"
|
||||||
|
|
||||||
|
bson@~1.0.4:
|
||||||
|
version "1.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/bson/-/bson-1.0.4.tgz#93c10d39eaa5b58415cbc4052f3e53e562b0b72c"
|
||||||
|
|
||||||
|
buffer-shims@~1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51"
|
||||||
|
|
||||||
|
chai-as-promised@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
||||||
|
dependencies:
|
||||||
|
check-error "^1.0.2"
|
||||||
|
|
||||||
|
chai-string@^1.3.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.4.0.tgz#359140c051d36a4e4b1a5fc6b910152f438a8d49"
|
||||||
|
|
||||||
|
chai@^3.5.0:
|
||||||
|
version "3.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
||||||
|
dependencies:
|
||||||
|
assertion-error "^1.0.1"
|
||||||
|
deep-eql "^0.1.3"
|
||||||
|
type-detect "^1.0.0"
|
||||||
|
|
||||||
|
chalk@^1.0.0, chalk@^1.1.1:
|
||||||
|
version "1.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^2.2.1"
|
||||||
|
escape-string-regexp "^1.0.2"
|
||||||
|
has-ansi "^2.0.0"
|
||||||
|
strip-ansi "^3.0.0"
|
||||||
|
supports-color "^2.0.0"
|
||||||
|
|
||||||
|
check-error@^1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
||||||
|
|
||||||
|
cli-cursor@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
|
||||||
|
dependencies:
|
||||||
|
restore-cursor "^2.0.0"
|
||||||
|
|
||||||
|
cli-spinners@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.0.tgz#ef987ed3d48391ac3dab9180b406a742180d6e6a"
|
||||||
|
|
||||||
|
clone-buffer@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58"
|
||||||
|
|
||||||
|
clone-stats@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680"
|
||||||
|
|
||||||
|
clone@^1.0.0:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149"
|
||||||
|
|
||||||
|
cloneable-readable@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.0.0.tgz#a6290d413f217a61232f95e458ff38418cfb0117"
|
||||||
|
dependencies:
|
||||||
|
inherits "^2.0.1"
|
||||||
|
process-nextick-args "^1.0.6"
|
||||||
|
through2 "^2.0.1"
|
||||||
|
|
||||||
|
concat-map@0.0.1:
|
||||||
|
version "0.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
deep-eql@^0.1.3:
|
||||||
|
version "0.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
||||||
|
dependencies:
|
||||||
|
type-detect "0.1.1"
|
||||||
|
|
||||||
|
early@^2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/early/-/early-2.1.1.tgz#841e23254ea5dc54d8afaeee82f5ab65c00ee23c"
|
||||||
|
dependencies:
|
||||||
|
beautycolor "^1.0.7"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
|
es6-error@^4.0.2:
|
||||||
|
version "4.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.0.2.tgz#eec5c726eacef51b7f6b73c20db6e1b13b069c98"
|
||||||
|
|
||||||
|
es6-promise@3.2.1:
|
||||||
|
version "3.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.2.1.tgz#ec56233868032909207170c39448e24449dd1fc4"
|
||||||
|
|
||||||
|
escape-string-regexp@^1.0.2:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||||
|
|
||||||
|
esprima@^3.1.1:
|
||||||
|
version "3.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
|
||||||
|
|
||||||
|
figlet@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.2.0.tgz#6c46537378fab649146b5a6143dda019b430b410"
|
||||||
|
|
||||||
|
first-chunk-stream@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70"
|
||||||
|
dependencies:
|
||||||
|
readable-stream "^2.0.2"
|
||||||
|
|
||||||
|
fs-extra@^3.0.1:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291"
|
||||||
|
dependencies:
|
||||||
|
graceful-fs "^4.1.2"
|
||||||
|
jsonfile "^3.0.0"
|
||||||
|
universalify "^0.1.0"
|
||||||
|
|
||||||
|
fs.realpath@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||||
|
|
||||||
|
glob@^7.0.0, glob@^7.1.1:
|
||||||
|
version "7.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
|
||||||
|
dependencies:
|
||||||
|
fs.realpath "^1.0.0"
|
||||||
|
inflight "^1.0.4"
|
||||||
|
inherits "2"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
once "^1.3.0"
|
||||||
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
|
graceful-fs@^4.1.2, graceful-fs@^4.1.6:
|
||||||
|
version "4.1.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
|
||||||
|
|
||||||
|
has-ansi@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^2.0.0"
|
||||||
|
|
||||||
|
home@^1.0.1:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/home/-/home-1.0.1.tgz#96a423ceb49b98378ff5ef3ceae059a557f9dd35"
|
||||||
|
dependencies:
|
||||||
|
os-homedir "^1.0.1"
|
||||||
|
|
||||||
|
inflight@^1.0.4:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||||
|
dependencies:
|
||||||
|
once "^1.3.0"
|
||||||
|
wrappy "1"
|
||||||
|
|
||||||
|
inherits@2, inherits@^2.0.1, inherits@~2.0.1:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||||
|
|
||||||
|
interpret@^1.0.0:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
|
||||||
|
|
||||||
|
is-stream@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||||
|
|
||||||
|
is-utf8@^0.2.0, is-utf8@^0.2.1:
|
||||||
|
version "0.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
|
||||||
|
|
||||||
|
isarray@~1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
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.1.9:
|
||||||
|
version "2.1.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
|
||||||
|
|
||||||
|
js-yaml@^3.8.3:
|
||||||
|
version "3.8.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
|
||||||
|
dependencies:
|
||||||
|
argparse "^1.0.7"
|
||||||
|
esprima "^3.1.1"
|
||||||
|
|
||||||
|
jsonfile@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.0.tgz#92e7c7444e5ffd5fa32e6a9ae8b85034df8347d0"
|
||||||
|
optionalDependencies:
|
||||||
|
graceful-fs "^4.1.6"
|
||||||
|
|
||||||
|
leakage@^0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/leakage/-/leakage-0.3.0.tgz#15d698abdc76bbc6439601f4f3020e77e2d50c39"
|
||||||
|
dependencies:
|
||||||
|
es6-error "^4.0.2"
|
||||||
|
left-pad "^1.1.3"
|
||||||
|
memwatch-next "^0.3.0"
|
||||||
|
minimist "^1.2.0"
|
||||||
|
pretty-bytes "^4.0.2"
|
||||||
|
|
||||||
|
left-pad@^1.1.3:
|
||||||
|
version "1.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a"
|
||||||
|
|
||||||
|
lik@^1.0.32:
|
||||||
|
version "1.0.32"
|
||||||
|
resolved "https://registry.yarnpkg.com/lik/-/lik-1.0.32.tgz#41ee6c8edd483eaa11bd089775263955f5555060"
|
||||||
|
dependencies:
|
||||||
|
"@types/lodash" "^4.14.62"
|
||||||
|
"@types/minimatch" "2.x.x"
|
||||||
|
"@types/q" "1.x.x"
|
||||||
|
lodash "^4.17.4"
|
||||||
|
minimatch "^3.0.3"
|
||||||
|
q "^1.5.0"
|
||||||
|
rxjs "^5.3.0"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
tapbundle "^1.0.14"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
lodash@^4.17.4:
|
||||||
|
version "4.17.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||||
|
|
||||||
|
log-symbols@^1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18"
|
||||||
|
dependencies:
|
||||||
|
chalk "^1.0.0"
|
||||||
|
|
||||||
|
memwatch-next@^0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
|
||||||
|
dependencies:
|
||||||
|
bindings "^1.2.1"
|
||||||
|
nan "^2.3.2"
|
||||||
|
|
||||||
|
mimic-fn@^1.0.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18"
|
||||||
|
|
||||||
|
minimatch@^3.0.3, minimatch@^3.0.4:
|
||||||
|
version "3.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^1.1.7"
|
||||||
|
|
||||||
|
minimist@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
|
||||||
|
|
||||||
|
mongodb-core@2.1.13:
|
||||||
|
version "2.1.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.13.tgz#771ef638270ac993ab42984689ab824251b96a88"
|
||||||
|
dependencies:
|
||||||
|
bson "~1.0.4"
|
||||||
|
require_optional "~1.0.0"
|
||||||
|
|
||||||
|
mongodb@^2.2.29:
|
||||||
|
version "2.2.29"
|
||||||
|
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.29.tgz#36b244126f26766c5ebd6465b8ab5b542d6833c5"
|
||||||
|
dependencies:
|
||||||
|
es6-promise "3.2.1"
|
||||||
|
mongodb-core "2.1.13"
|
||||||
|
readable-stream "2.2.7"
|
||||||
|
|
||||||
|
nan@^2.3.2:
|
||||||
|
version "2.6.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
|
||||||
|
|
||||||
|
once@^1.3.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||||
|
dependencies:
|
||||||
|
wrappy "1"
|
||||||
|
|
||||||
|
onetime@^2.0.0:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
|
||||||
|
dependencies:
|
||||||
|
mimic-fn "^1.0.0"
|
||||||
|
|
||||||
|
ora@^1.1.0:
|
||||||
|
version "1.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ora/-/ora-1.3.0.tgz#80078dd2b92a934af66a3ad72a5b910694ede51a"
|
||||||
|
dependencies:
|
||||||
|
chalk "^1.1.1"
|
||||||
|
cli-cursor "^2.1.0"
|
||||||
|
cli-spinners "^1.0.0"
|
||||||
|
log-symbols "^1.0.2"
|
||||||
|
|
||||||
|
os-homedir@^1.0.1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
|
||||||
|
|
||||||
|
path-is-absolute@^1.0.0:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||||
|
|
||||||
|
path-parse@^1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
|
||||||
|
|
||||||
|
pify@^2.3.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
|
||||||
|
|
||||||
|
pretty-bytes@^4.0.2:
|
||||||
|
version "4.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
|
||||||
|
|
||||||
|
process-nextick-args@^1.0.6, process-nextick-args@~1.0.6:
|
||||||
|
version "1.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
|
||||||
|
|
||||||
|
q@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
|
||||||
|
|
||||||
|
qenv@^1.1.7:
|
||||||
|
version "1.1.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/qenv/-/qenv-1.1.7.tgz#d03f8bf8fe37494cf08d0919fe765dca84d9afae"
|
||||||
|
dependencies:
|
||||||
|
lodash "^4.17.4"
|
||||||
|
smartfile "^4.2.11"
|
||||||
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
|
readable-stream@2.2.7, readable-stream@^2.0.2, readable-stream@^2.1.5:
|
||||||
|
version "2.2.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.7.tgz#07057acbe2467b22042d36f98c5ad507054e95b1"
|
||||||
|
dependencies:
|
||||||
|
buffer-shims "~1.0.0"
|
||||||
|
core-util-is "~1.0.0"
|
||||||
|
inherits "~2.0.1"
|
||||||
|
isarray "~1.0.0"
|
||||||
|
process-nextick-args "~1.0.6"
|
||||||
|
string_decoder "~1.0.0"
|
||||||
|
util-deprecate "~1.0.1"
|
||||||
|
|
||||||
|
rechoir@^0.6.2:
|
||||||
|
version "0.6.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
||||||
|
dependencies:
|
||||||
|
resolve "^1.1.6"
|
||||||
|
|
||||||
|
reflect-metadata@^0.1.2:
|
||||||
|
version "0.1.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.10.tgz#b4f83704416acad89988c9b15635d47e03b9344a"
|
||||||
|
|
||||||
|
remove-trailing-separator@^1.0.1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz#69b062d978727ad14dc6b56ba4ab772fd8d70511"
|
||||||
|
|
||||||
|
replace-ext@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
|
||||||
|
|
||||||
|
require-reload@0.2.2:
|
||||||
|
version "0.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-reload/-/require-reload-0.2.2.tgz#29a7591846caf91b6e8a3cda991683f95f8d7d42"
|
||||||
|
|
||||||
|
require_optional@~1.0.0:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/require_optional/-/require_optional-1.0.1.tgz#4cf35a4247f64ca3df8c2ef208cc494b1ca8fc2e"
|
||||||
|
dependencies:
|
||||||
|
resolve-from "^2.0.0"
|
||||||
|
semver "^5.1.0"
|
||||||
|
|
||||||
|
resolve-from@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57"
|
||||||
|
|
||||||
|
resolve@^1.1.6:
|
||||||
|
version "1.3.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
|
||||||
|
dependencies:
|
||||||
|
path-parse "^1.0.5"
|
||||||
|
|
||||||
|
restore-cursor@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
|
||||||
|
dependencies:
|
||||||
|
onetime "^2.0.0"
|
||||||
|
signal-exit "^3.0.2"
|
||||||
|
|
||||||
|
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"
|
||||||
|
dependencies:
|
||||||
|
reflect-metadata "^0.1.2"
|
||||||
|
|
||||||
|
rxjs@^5.3.0:
|
||||||
|
version "5.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.1.tgz#b62f757f279445d265a18a58fb0a70dc90e91626"
|
||||||
|
dependencies:
|
||||||
|
symbol-observable "^1.0.1"
|
||||||
|
|
||||||
|
safe-buffer@~5.1.0:
|
||||||
|
version "5.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
|
||||||
|
|
||||||
|
semver@^5.1.0, semver@^5.3.0:
|
||||||
|
version "5.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
||||||
|
|
||||||
|
shelljs@^0.7.6, shelljs@^0.7.8:
|
||||||
|
version "0.7.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3"
|
||||||
|
dependencies:
|
||||||
|
glob "^7.0.0"
|
||||||
|
interpret "^1.0.0"
|
||||||
|
rechoir "^0.6.2"
|
||||||
|
|
||||||
|
signal-exit@^3.0.2:
|
||||||
|
version "3.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
|
||||||
|
|
||||||
|
smartchai@^1.0.3:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
||||||
|
dependencies:
|
||||||
|
"@types/chai" "^3.4.35"
|
||||||
|
"@types/chai-as-promised" "0.0.29"
|
||||||
|
"@types/chai-string" "^1.1.30"
|
||||||
|
chai "^3.5.0"
|
||||||
|
chai-as-promised "^6.0.0"
|
||||||
|
chai-string "^1.3.0"
|
||||||
|
|
||||||
|
smartdelay@^1.0.3:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartdelay/-/smartdelay-1.0.3.tgz#5fd44dad77262d110702f0293efa80c072cfb579"
|
||||||
|
dependencies:
|
||||||
|
smartq "^1.1.1"
|
||||||
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
|
smartenv@^2.0.0:
|
||||||
|
version "2.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartenv/-/smartenv-2.0.6.tgz#b38c679b0c151b9af548f68c3a072c29d1417e8d"
|
||||||
|
dependencies:
|
||||||
|
lodash "^4.17.4"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
smartfile@^4.2.11:
|
||||||
|
version "4.2.17"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartfile/-/smartfile-4.2.17.tgz#9eba8f65eea7e4db51aa30562f6039815a88b125"
|
||||||
|
dependencies:
|
||||||
|
"@types/fs-extra" "3.x.x"
|
||||||
|
"@types/vinyl" "^2.0.0"
|
||||||
|
fs-extra "^3.0.1"
|
||||||
|
glob "^7.1.1"
|
||||||
|
js-yaml "^3.8.3"
|
||||||
|
require-reload "0.2.2"
|
||||||
|
smartpath "^3.2.8"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
smartrequest "^1.0.4"
|
||||||
|
typings-global "^1.0.16"
|
||||||
|
vinyl "^2.0.2"
|
||||||
|
vinyl-file "^3.0.0"
|
||||||
|
|
||||||
|
smartpath@^3.2.8:
|
||||||
|
version "3.2.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartpath/-/smartpath-3.2.8.tgz#4834bd3a8bae2295baacadba23c87a501952f940"
|
||||||
|
dependencies:
|
||||||
|
home "^1.0.1"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
smartq@^1.1.0, smartq@^1.1.1:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.1.tgz#efb358705260d41ae18aef7ffd815f7b6fe17dd3"
|
||||||
|
dependencies:
|
||||||
|
typed-promisify "^0.3.0"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
smartrequest@^1.0.4:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartrequest/-/smartrequest-1.0.6.tgz#a006454332453b0a70d38a003a29963d039a7783"
|
||||||
|
dependencies:
|
||||||
|
smartq "^1.1.1"
|
||||||
|
typings-global "^1.0.17"
|
||||||
|
|
||||||
|
smartshell@^1.0.6:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartshell/-/smartshell-1.0.6.tgz#27b1c79029784abe72ac7e91fe698b7ebecc6629"
|
||||||
|
dependencies:
|
||||||
|
"@types/shelljs" "^0.6.0"
|
||||||
|
"@types/which" "^1.0.28"
|
||||||
|
shelljs "^0.7.6"
|
||||||
|
smartq "^1.1.0"
|
||||||
|
which "^1.2.12"
|
||||||
|
|
||||||
|
smartstring@^2.0.24:
|
||||||
|
version "2.0.24"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartstring/-/smartstring-2.0.24.tgz#dc1c5efb738c10a2d7daeea3d800ad2ecc65a26c"
|
||||||
|
dependencies:
|
||||||
|
js-base64 "^2.1.9"
|
||||||
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
|
sprintf-js@~1.0.2:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||||
|
|
||||||
|
string_decoder@~1.0.0:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab"
|
||||||
|
dependencies:
|
||||||
|
safe-buffer "~5.1.0"
|
||||||
|
|
||||||
|
strip-ansi@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^2.0.0"
|
||||||
|
|
||||||
|
strip-bom-buf@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-bom-buf/-/strip-bom-buf-1.0.0.tgz#1cb45aaf57530f4caf86c7f75179d2c9a51dd572"
|
||||||
|
dependencies:
|
||||||
|
is-utf8 "^0.2.1"
|
||||||
|
|
||||||
|
strip-bom-stream@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz#f87db5ef2613f6968aa545abfe1ec728b6a829ca"
|
||||||
|
dependencies:
|
||||||
|
first-chunk-stream "^2.0.0"
|
||||||
|
strip-bom "^2.0.0"
|
||||||
|
|
||||||
|
strip-bom@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e"
|
||||||
|
dependencies:
|
||||||
|
is-utf8 "^0.2.0"
|
||||||
|
|
||||||
|
supports-color@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||||
|
|
||||||
|
symbol-observable@^1.0.1:
|
||||||
|
version "1.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
|
||||||
|
|
||||||
|
tapbundle@^1.0.14:
|
||||||
|
version "1.0.14"
|
||||||
|
resolved "https://registry.yarnpkg.com/tapbundle/-/tapbundle-1.0.14.tgz#75827e335fcb02216f0267a26a26d702ddc02e3c"
|
||||||
|
dependencies:
|
||||||
|
early "^2.1.1"
|
||||||
|
leakage "^0.3.0"
|
||||||
|
smartchai "^1.0.3"
|
||||||
|
smartdelay "^1.0.3"
|
||||||
|
smartq "^1.1.1"
|
||||||
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
|
through2@^2.0.1:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
|
||||||
|
dependencies:
|
||||||
|
readable-stream "^2.1.5"
|
||||||
|
xtend "~4.0.1"
|
||||||
|
|
||||||
|
type-detect@0.1.1:
|
||||||
|
version "0.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
||||||
|
|
||||||
|
type-detect@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
||||||
|
|
||||||
|
typed-promisify@^0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/typed-promisify/-/typed-promisify-0.3.0.tgz#1ba0af5e444c87d8047406f18ce49092a1191853"
|
||||||
|
|
||||||
|
typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.17, typings-global@^1.0.19:
|
||||||
|
version "1.0.19"
|
||||||
|
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.19.tgz#3376a72d4de1e5541bf5702248ff64c3e6ea316c"
|
||||||
|
dependencies:
|
||||||
|
semver "^5.3.0"
|
||||||
|
smartshell "^1.0.6"
|
||||||
|
|
||||||
|
universalify@^0.1.0:
|
||||||
|
version "0.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.0.tgz#9eb1c4651debcc670cc94f1a75762332bb967778"
|
||||||
|
|
||||||
|
util-deprecate@~1.0.1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||||
|
|
||||||
|
vinyl-file@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/vinyl-file/-/vinyl-file-3.0.0.tgz#b104d9e4409ffa325faadd520642d0a3b488b365"
|
||||||
|
dependencies:
|
||||||
|
graceful-fs "^4.1.2"
|
||||||
|
pify "^2.3.0"
|
||||||
|
strip-bom-buf "^1.0.0"
|
||||||
|
strip-bom-stream "^2.0.0"
|
||||||
|
vinyl "^2.0.1"
|
||||||
|
|
||||||
|
vinyl@^2.0.1, vinyl@^2.0.2:
|
||||||
|
version "2.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.0.2.tgz#0a3713d8d4e9221c58f10ca16c0116c9e25eda7c"
|
||||||
|
dependencies:
|
||||||
|
clone "^1.0.0"
|
||||||
|
clone-buffer "^1.0.0"
|
||||||
|
clone-stats "^1.0.0"
|
||||||
|
cloneable-readable "^1.0.0"
|
||||||
|
is-stream "^1.1.0"
|
||||||
|
remove-trailing-separator "^1.0.1"
|
||||||
|
replace-ext "^1.0.0"
|
||||||
|
|
||||||
|
which@^1.2.12:
|
||||||
|
version "1.2.14"
|
||||||
|
resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
|
||||||
|
dependencies:
|
||||||
|
isexe "^2.0.0"
|
||||||
|
|
||||||
|
wrappy@1:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||||
|
|
||||||
|
xtend@~4.0.1:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
|
Reference in New Issue
Block a user