fix(structure): format
This commit is contained in:
parent
761b742e21
commit
3eeac7b936
36
README.md
36
README.md
@ -1,25 +1,19 @@
|
|||||||
# @pushrocks/smartdata
|
# @pushrocks/smartdata
|
||||||
|
do more with data
|
||||||
|
|
||||||
do more with data and RethinkDB
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdata)
|
||||||
## Availabililty
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdata)
|
||||||
|
* [github.com (source mirror)](https://github.com/pushrocks/smartdata)
|
||||||
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartdata)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/smartdata/)
|
||||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartdata)
|
|
||||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartdata)
|
|
||||||
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartdata/)
|
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
[![build status](https://gitlab.com/pushrocks/smartdata/badges/master/build.svg)](https://gitlab.com/pushrocks/smartdata/commits/master)
|
||||||
[![build status](https://GitLab.com/pushrocks/smartdata/badges/master/build.svg)](https://GitLab.com/pushrocks/smartdata/commits/master)
|
[![coverage report](https://gitlab.com/pushrocks/smartdata/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartdata/commits/master)
|
||||||
[![coverage report](https://GitLab.com/pushrocks/smartdata/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartdata/commits/master)
|
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartdata.svg)](https://www.npmjs.com/package/@pushrocks/smartdata)
|
||||||
[![npm downloads per month](https://img.shields.io/npm/dm/smartdata.svg)](https://www.npmjs.com/package/smartdata)
|
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartdata/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartdata)
|
||||||
[![Dependency Status](https://david-dm.org/pushrocks/smartdata.svg)](https://david-dm.org/pushrocks/smartdata)
|
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartdata/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm)
|
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartdata/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartdata)
|
|
||||||
[![Known Vulnerabilities](https://snyk.io/test/npm/smartdata/badge.svg)](https://snyk.io/test/npm/smartdata)
|
|
||||||
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -121,9 +115,9 @@ you should get all the Intellisense and type checking you love when using smartd
|
|||||||
smartdata itself also bundles typings.
|
smartdata itself also bundles typings.
|
||||||
So you don't need to install any additional types when importing smartdata.
|
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.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
|
||||||
|
@ -8,5 +8,15 @@
|
|||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public",
|
"npmAccessLevel": "public",
|
||||||
"npmRegistryUrl": "registry.npmjs.org"
|
"npmRegistryUrl": "registry.npmjs.org"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "smartdata",
|
||||||
|
"shortDescription": "do more with data",
|
||||||
|
"npmPackagename": "@pushrocks/smartdata",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,4 +43,4 @@
|
|||||||
"tslint": "^5.12.0",
|
"tslint": "^5.12.0",
|
||||||
"tslint-config-prettier": "^1.17.0"
|
"tslint-config-prettier": "^1.17.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,4 +2,4 @@ export * from './smartdata.classes.db';
|
|||||||
export * from './smartdata.classes.collection';
|
export * from './smartdata.classes.collection';
|
||||||
export * from './smartdata.classes.doc';
|
export * from './smartdata.classes.doc';
|
||||||
|
|
||||||
export { IMongoDescriptor } from './interfaces';
|
export { IMongoDescriptor } from './interfaces';
|
||||||
|
@ -1 +1 @@
|
|||||||
export * from './mongodescriptor';
|
export * from './mongodescriptor';
|
||||||
|
@ -26,10 +26,9 @@ export function Collection(dbArg: SmartdataDb | TDelayedDbCreation) {
|
|||||||
constructor['smartdataCollection'] = new SmartdataCollection(constructor, dbArg);
|
constructor['smartdataCollection'] = new SmartdataCollection(constructor, dbArg);
|
||||||
} else {
|
} else {
|
||||||
constructor['smartdataDelayedCollection'] = () => {
|
constructor['smartdataDelayedCollection'] = () => {
|
||||||
return new SmartdataCollection(constructor, dbArg());
|
return new SmartdataCollection(constructor, dbArg());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +123,7 @@ export class SmartdataCollection<T> {
|
|||||||
this.mongoDbCollection.updateOne(identifiableObject, saveableObject);
|
this.mongoDbCollection.updateOne(identifiableObject, saveableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async delete (dbDocArg: T & SmartDataDbDoc<T>): Promise<any> {
|
public async delete(dbDocArg: T & SmartDataDbDoc<T>): Promise<any> {
|
||||||
await this.init();
|
await this.init();
|
||||||
await this.checkDoc(dbDocArg);
|
await this.checkDoc(dbDocArg);
|
||||||
const identifiableObject = await dbDocArg.createIdentifiableObject();
|
const identifiableObject = await dbDocArg.createIdentifiableObject();
|
||||||
|
@ -53,12 +53,9 @@ export class SmartdataDb {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
console.log(finalConnectionUrl);
|
console.log(finalConnectionUrl);
|
||||||
this.mongoDbClient = await plugins.mongodb.MongoClient.connect(
|
this.mongoDbClient = await plugins.mongodb.MongoClient.connect(finalConnectionUrl, {
|
||||||
finalConnectionUrl,
|
useNewUrlParser: true
|
||||||
{
|
});
|
||||||
useNewUrlParser: true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName);
|
this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName);
|
||||||
this.status = 'connected';
|
this.status = 'connected';
|
||||||
console.log(`Connected to database ${this.smartdataOptions.mongoDbName}`);
|
console.log(`Connected to database ${this.smartdataOptions.mongoDbName}`);
|
||||||
|
@ -77,7 +77,7 @@ export class SmartDataDbDoc<T> {
|
|||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.name = this.constructor['name'];
|
this.name = this.constructor['name'];
|
||||||
if(this.constructor['smartdataCollection']) {
|
if (this.constructor['smartdataCollection']) {
|
||||||
// tslint:disable-next-line: no-string-literal
|
// tslint:disable-next-line: no-string-literal
|
||||||
this.collection = this.constructor['smartdataCollection'];
|
this.collection = this.constructor['smartdataCollection'];
|
||||||
// tslint:disable-next-line: no-string-literal
|
// tslint:disable-next-line: no-string-literal
|
||||||
@ -92,12 +92,12 @@ export class SmartDataDbDoc<T> {
|
|||||||
static async getInstances<T>(filterArg): Promise<T[]> {
|
static async getInstances<T>(filterArg): Promise<T[]> {
|
||||||
let self: any = this; // fool typesystem
|
let self: any = this; // fool typesystem
|
||||||
let referenceMongoDBCollection: SmartdataCollection<T>;
|
let referenceMongoDBCollection: SmartdataCollection<T>;
|
||||||
|
|
||||||
if (self.smartdataCollection) {
|
if (self.smartdataCollection) {
|
||||||
referenceMongoDBCollection = self.smartdataCollection;
|
referenceMongoDBCollection = self.smartdataCollection;
|
||||||
} else if (self.smartdataDelayedCollection) {
|
} else if (self.smartdataDelayedCollection) {
|
||||||
referenceMongoDBCollection = self.smartdataDelayedCollection();
|
referenceMongoDBCollection = self.smartdataDelayedCollection();
|
||||||
};
|
}
|
||||||
const foundDocs = await referenceMongoDBCollection.find(filterArg);
|
const foundDocs = await referenceMongoDBCollection.find(filterArg);
|
||||||
const returnArray = [];
|
const returnArray = [];
|
||||||
for (let item of foundDocs) {
|
for (let item of foundDocs) {
|
||||||
@ -142,9 +142,7 @@ export class SmartDataDbDoc<T> {
|
|||||||
/**
|
/**
|
||||||
* deletes a document from the database
|
* deletes a document from the database
|
||||||
*/
|
*/
|
||||||
async delete() {
|
async delete() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* also store any referenced objects to DB
|
* also store any referenced objects to DB
|
||||||
|
Loading…
Reference in New Issue
Block a user