fix(core): update

This commit is contained in:
Philipp Kunz 2021-11-12 19:02:29 +01:00
parent f50a61308c
commit 28d57efd9e
6 changed files with 15 additions and 14 deletions

View File

@ -13,7 +13,6 @@ stages:
- metadata
before_script:
- apt-get update && apt-get install -y libcurl3 libssl-dev openssl libssl1.0.0 mongodb
- npm install -g @shipzone/npmci
# ====================

View File

@ -202,7 +202,7 @@ tap.test('should store a new Truck', async () => {
tap.test('should use a cursor', async () => {
const cursor = await Truck.getCursor({});
cursor.forEach(async truckArg => {
cursor.forEach(async (truckArg) => {
console.log(truckArg.id);
});
});

View File

@ -85,7 +85,7 @@ export function Manager<TManager extends IManager>(managerArg?: TManager | TDela
public static get manager() {
let manager: TManager;
if (!managerArg) {
manager = this.prototype.defaultManager
manager = this.prototype.defaultManager;
} else if (managerArg['db']) {
manager = managerArg as TManager;
} else {
@ -96,7 +96,7 @@ export function Manager<TManager extends IManager>(managerArg?: TManager | TDela
public get manager() {
let manager: TManager;
if (!managerArg) {
manager = this.defaultManager
manager = this.defaultManager;
} else if (managerArg['db']) {
manager = managerArg as TManager;
} else {

View File

@ -9,16 +9,16 @@ export class SmartdataDbCursor<T = any> {
// INSTANCE
public mongodbCursor: plugins.mongodb.FindCursor<T>;
constructor(cursorArg: plugins.mongodb.FindCursor<T>) {
this.mongodbCursor = cursorArg
};
this.mongodbCursor = cursorArg;
}
public async next(closeAtEnd = true) {
const result = await this.mongodbCursor.next();
if (!result && closeAtEnd) {
await this.close();
};
}
return result;
};
}
public async forEach(forEachFuncArg: (itemArg: T) => Promise<any>, closeCursorAtEnd = true) {
let currentValue: T;

View File

@ -165,7 +165,9 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
this: plugins.tsclass.typeFest.Class<T>,
filterArg: plugins.tsclass.typeFest.PartialDeep<T>
) {
const cursor: SmartdataDbCursor<T> = await (this as any).collection.getCursor(convertFilterForMongoDb(filterArg));
const cursor: SmartdataDbCursor<T> = await (this as any).collection.getCursor(
convertFilterForMongoDb(filterArg)
);
return cursor;
}
@ -179,7 +181,7 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
forEachFunction: (itemArg: T) => Promise<any>
) {
const cursor: SmartdataDbCursor<T> = await (this as any).getCursor(filterArg);
await cursor.forEach(forEachFunction)
await cursor.forEach(forEachFunction);
}
/**