BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-05-17 18:28:09 +02:00
parent e01d09e40a
commit 3381163a0d
7 changed files with 2577 additions and 19510 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartmongo',
version: '1.0.9',
version: '2.0.0',
description: 'create a local mongodb for testing'
}

View File

@ -1,10 +1,11 @@
import * as plugins from './smartmongo.plugins';
import { commitinfo } from './00_commitinfo_data.js';
import * as plugins from './smartmongo.plugins.js';
export class SmartMongo {
// STATIC
public static async createAndStart() {
public static async createAndStart(replCountArg: number = 1) {
const smartMongoInstance = new SmartMongo();
await smartMongoInstance.start();
await smartMongoInstance.start(replCountArg);
return smartMongoInstance;
}
@ -16,10 +17,11 @@ export class SmartMongo {
constructor() {
}
public async start(countArg: number = 4) {
public async start(countArg: number = 1) {
this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({ replSet: { count: countArg } });
this._readyDeferred.resolve();
console.log(`mongoReplicaSet with ${countArg} replicas started.`);
console.log(`@pushrocks/smartmongo version ${commitinfo.version}`);
}
public async getMongoDescriptor(): Promise<plugins.smartdata.IMongoDescriptor> {