From 3eeac7b936ab320180b1d4ffe6b5cac791268008 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 13 Feb 2019 22:08:58 +0100 Subject: [PATCH] fix(structure): format --- README.md | 36 +++++++++++++----------------- npmextra.json | 12 +++++++++- package.json | 2 +- ts/index.ts | 2 +- ts/interfaces/index.ts | 2 +- ts/smartdata.classes.collection.ts | 5 ++--- ts/smartdata.classes.db.ts | 9 +++----- ts/smartdata.classes.doc.ts | 10 ++++----- 8 files changed, 38 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index ec2de1c..232bfca 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,19 @@ # @pushrocks/smartdata +do more with data -do more with data and RethinkDB - -## Availabililty - -[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/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/) +## Availabililty and Links +* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdata) +* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdata) +* [github.com (source mirror)](https://github.com/pushrocks/smartdata) +* [docs (typedoc)](https://pushrocks.gitlab.io/smartdata/) ## Status for 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) -[![npm downloads per month](https://img.shields.io/npm/dm/smartdata.svg)](https://www.npmjs.com/package/smartdata) -[![Dependency Status](https://david-dm.org/pushrocks/smartdata.svg)](https://david-dm.org/pushrocks/smartdata) -[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartdata/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm) -[![bitHound 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/) +[![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) +[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartdata.svg)](https://www.npmjs.com/package/@pushrocks/smartdata) +[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartdata/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartdata) +[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) ## Usage @@ -121,9 +115,9 @@ you should get all the Intellisense and type checking you love when using smartd 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. +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) +| 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) diff --git a/npmextra.json b/npmextra.json index 71d1e6c..a88df2e 100644 --- a/npmextra.json +++ b/npmextra.json @@ -8,5 +8,15 @@ "npmGlobalTools": [], "npmAccessLevel": "public", "npmRegistryUrl": "registry.npmjs.org" + }, + "gitzone": { + "module": { + "githost": "gitlab.com", + "gitscope": "pushrocks", + "gitrepo": "smartdata", + "shortDescription": "do more with data", + "npmPackagename": "@pushrocks/smartdata", + "license": "MIT" + } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 870bf19..ba29439 100644 --- a/package.json +++ b/package.json @@ -43,4 +43,4 @@ "tslint": "^5.12.0", "tslint-config-prettier": "^1.17.0" } -} +} \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index 7a4ae87..fb24f5d 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -2,4 +2,4 @@ export * from './smartdata.classes.db'; export * from './smartdata.classes.collection'; export * from './smartdata.classes.doc'; -export { IMongoDescriptor } from './interfaces'; \ No newline at end of file +export { IMongoDescriptor } from './interfaces'; diff --git a/ts/interfaces/index.ts b/ts/interfaces/index.ts index cf91294..573613e 100644 --- a/ts/interfaces/index.ts +++ b/ts/interfaces/index.ts @@ -1 +1 @@ -export * from './mongodescriptor'; \ No newline at end of file +export * from './mongodescriptor'; diff --git a/ts/smartdata.classes.collection.ts b/ts/smartdata.classes.collection.ts index 5c0aba5..d022dc1 100644 --- a/ts/smartdata.classes.collection.ts +++ b/ts/smartdata.classes.collection.ts @@ -26,10 +26,9 @@ export function Collection(dbArg: SmartdataDb | TDelayedDbCreation) { constructor['smartdataCollection'] = new SmartdataCollection(constructor, dbArg); } else { constructor['smartdataDelayedCollection'] = () => { - return new SmartdataCollection(constructor, dbArg()); + return new SmartdataCollection(constructor, dbArg()); }; } - }; } @@ -124,7 +123,7 @@ export class SmartdataCollection { this.mongoDbCollection.updateOne(identifiableObject, saveableObject); } - public async delete (dbDocArg: T & SmartDataDbDoc): Promise { + public async delete(dbDocArg: T & SmartDataDbDoc): Promise { await this.init(); await this.checkDoc(dbDocArg); const identifiableObject = await dbDocArg.createIdentifiableObject(); diff --git a/ts/smartdata.classes.db.ts b/ts/smartdata.classes.db.ts index 9b8aaad..58c6a01 100644 --- a/ts/smartdata.classes.db.ts +++ b/ts/smartdata.classes.db.ts @@ -53,12 +53,9 @@ export class SmartdataDb { ); } console.log(finalConnectionUrl); - this.mongoDbClient = await plugins.mongodb.MongoClient.connect( - finalConnectionUrl, - { - useNewUrlParser: true - } - ); + this.mongoDbClient = await plugins.mongodb.MongoClient.connect(finalConnectionUrl, { + useNewUrlParser: true + }); this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName); this.status = 'connected'; console.log(`Connected to database ${this.smartdataOptions.mongoDbName}`); diff --git a/ts/smartdata.classes.doc.ts b/ts/smartdata.classes.doc.ts index 94916d3..cfcb138 100644 --- a/ts/smartdata.classes.doc.ts +++ b/ts/smartdata.classes.doc.ts @@ -77,7 +77,7 @@ export class SmartDataDbDoc { */ constructor() { this.name = this.constructor['name']; - if(this.constructor['smartdataCollection']) { + if (this.constructor['smartdataCollection']) { // tslint:disable-next-line: no-string-literal this.collection = this.constructor['smartdataCollection']; // tslint:disable-next-line: no-string-literal @@ -92,12 +92,12 @@ export class SmartDataDbDoc { static async getInstances(filterArg): Promise { let self: any = this; // fool typesystem let referenceMongoDBCollection: SmartdataCollection; - + if (self.smartdataCollection) { referenceMongoDBCollection = self.smartdataCollection; } else if (self.smartdataDelayedCollection) { referenceMongoDBCollection = self.smartdataDelayedCollection(); - }; + } const foundDocs = await referenceMongoDBCollection.find(filterArg); const returnArray = []; for (let item of foundDocs) { @@ -142,9 +142,7 @@ export class SmartDataDbDoc { /** * deletes a document from the database */ - async delete() { - - } + async delete() {} /** * also store any referenced objects to DB