From 7a4d55772468e613a3faa8311ca95a34160816ec Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sat, 16 Oct 2021 21:17:02 +0200 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 5 +++++ package.json | 2 +- readme.md | 8 ++++---- test/test.easystore.ts | 9 ++++----- test/test.ts | 4 ++-- test/test.typescript.ts | 8 ++++---- ts/smartdata.classes.collection.ts | 16 ++++++++-------- ts/smartdata.classes.collectionfactory.ts | 5 +---- ts/smartdata.classes.doc.ts | 6 +++--- ts/smartdata.classes.easystore.ts | 2 +- 10 files changed, 33 insertions(+), 32 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..ee29f87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,10 @@ stages: - release - metadata +before_script: + - apt-get update && apt-get install -y libcurl3 libssl-dev openssl libssl1.0.0 mongodb + - npm install -g @shipzone/npmci + # ==================== # security stage # ==================== @@ -36,6 +40,7 @@ auditProductionDependencies: - npmci command npm audit --audit-level=high --only=prod --production tags: - docker + allow_failure: true auditDevDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci diff --git a/package.json b/package.json index 5a041ff..97a9324 100644 --- a/package.json +++ b/package.json @@ -60,4 +60,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index a2b1d5f..924fcb7 100644 --- a/readme.md +++ b/readme.md @@ -90,7 +90,7 @@ class MyObject extends smartdata.DbDoc { mongod = new mongoPlugin.MongoMemoryServer({}); console.log('created mongod instance'); @@ -47,14 +46,14 @@ tap.test('should create an easystore', async () => { await easyStore.writeKey('key1', 'hello'); const retrievedKey = await easyStore.readKey('key1'); expect(retrievedKey).to.equal('hello'); -}) +}); tap.test('close', async () => { testDb.close(); mongod.stop(); setTimeout(() => { process.exit(0); - }, 1000) -}) + }, 1000); +}); -tap.start(); \ No newline at end of file +tap.start(); diff --git a/test/test.ts b/test/test.ts index c8ab310..7321fcd 100644 --- a/test/test.ts +++ b/test/test.ts @@ -134,7 +134,7 @@ tap.test('expect to get instance of Car with deep match', async () => { const timeStart = Date.now(); const myCars2 = await Car.getInstances({ deepData: { - sodeep: 'yes' + sodeep: 'yes', }, }); if (counter % 10 === 0) { @@ -207,7 +207,7 @@ tap.test('should store a new Truck', async () => { console.log(myTruck2); }); -tap.test('should ', async () => {}) +tap.test('should ', async () => {}); // ======================================= // close the database connection diff --git a/test/test.typescript.ts b/test/test.typescript.ts index 8bbd0a0..5f7ffc7 100644 --- a/test/test.typescript.ts +++ b/test/test.typescript.ts @@ -80,7 +80,7 @@ class Car extends smartdata.SmartDataDbDoc { } const createCarClass = (dbArg: smartdata.SmartdataDb) => { - smartdata.setDefaultManagerForDoc({db: dbArg}, Car); + smartdata.setDefaultManagerForDoc({ db: dbArg }, Car); return Car; }; @@ -92,9 +92,9 @@ tap.test('should produce a car', async () => { tap.test('should get a car', async () => { const car = Car.getInstance({ - color: 'red' - }) -}) + color: 'red', + }); +}); // ======================================= // close the database connection diff --git a/ts/smartdata.classes.collection.ts b/ts/smartdata.classes.collection.ts index e9b1bb7..aeacc2d 100644 --- a/ts/smartdata.classes.collection.ts +++ b/ts/smartdata.classes.collection.ts @@ -42,19 +42,19 @@ export function Collection(dbArg: SmartdataDb | TDelayed) { } export interface IManager { - db: SmartdataDb + db: SmartdataDb; } -export const setDefaultManagerForDoc = (managerArg: IManager, dbDocArg: T): T => { +export const setDefaultManagerForDoc = (managerArg: IManager, dbDocArg: T): T => { (dbDocArg as any).prototype.defaultManager = managerArg; return dbDocArg; -} +}; /** * This is a decorator that will tell the decorated class what dbTable to use * @param dbArg */ - export function Manager(managerArg?: TManager | TDelayed) { +export function Manager(managerArg?: TManager | TDelayed) { return function classDecorator(constructor: T) { return class extends constructor { public static get collection() { @@ -62,7 +62,7 @@ export const setDefaultManagerForDoc = (managerArg: IManager, dbDocArg: T): if (!managerArg) { dbArg = this.prototype.defaultManager.db; } else if (managerArg['db']) { - dbArg = (managerArg as TManager).db + dbArg = (managerArg as TManager).db; } else { dbArg = (managerArg as TDelayed)().db; } @@ -75,7 +75,7 @@ export const setDefaultManagerForDoc = (managerArg: IManager, dbDocArg: T): //process.exit(0) dbArg = this.defaultManager.db; } else if (managerArg['db']) { - dbArg = (managerArg as TManager).db + dbArg = (managerArg as TManager).db; } else { dbArg = (managerArg as TDelayed)().db; } @@ -84,7 +84,7 @@ export const setDefaultManagerForDoc = (managerArg: IManager, dbDocArg: T): public static get manager() { let manager: TManager; if (managerArg['db']) { - manager = (managerArg as TManager); + manager = managerArg as TManager; } else { manager = (managerArg as TDelayed)(); } @@ -93,7 +93,7 @@ export const setDefaultManagerForDoc = (managerArg: IManager, dbDocArg: T): public get manager() { let manager: TManager; if (managerArg['db']) { - manager = (managerArg as TManager); + manager = managerArg as TManager; } else { manager = (managerArg as TDelayed)(); } diff --git a/ts/smartdata.classes.collectionfactory.ts b/ts/smartdata.classes.collectionfactory.ts index 812fb75..db93d63 100644 --- a/ts/smartdata.classes.collectionfactory.ts +++ b/ts/smartdata.classes.collectionfactory.ts @@ -5,10 +5,7 @@ import { SmartdataDb } from './smartdata.classes.db'; export class CollectionFactory { public collections: { [key: string]: SmartdataCollection } = {}; - public getCollection = ( - nameArg: string, - dbArg: SmartdataDb - ): SmartdataCollection => { + public getCollection = (nameArg: string, dbArg: SmartdataDb): SmartdataCollection => { if (!this.collections[nameArg]) { this.collections[nameArg] = (() => { if (dbArg instanceof SmartdataDb) { diff --git a/ts/smartdata.classes.doc.ts b/ts/smartdata.classes.doc.ts index 06d85e4..9784ea6 100644 --- a/ts/smartdata.classes.doc.ts +++ b/ts/smartdata.classes.doc.ts @@ -98,11 +98,11 @@ export class SmartDataDbDoc { public async getEasyStore() { let easyStore = await this.easyStoreClass.getInstance({ - nameId: this.nameId + nameId: this.nameId, }); if (!easyStore) {