@adaptivestone/framework 4.8.1 → 4.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 4.8.3
2
+
3
+ [UPDATE] Fix problme with fat start and closing connections after
4
+
5
+ ### 4.8.2
6
+
7
+ [UPDATE] CLI - disable mongoose index creation
8
+
1
9
  ### 4.8.1
2
10
 
3
11
  [UPDATE] Model inited on server inited.
package/Cli.js CHANGED
@@ -1,9 +1,11 @@
1
1
  const parseArgs = require('minimist');
2
+ const mongoose = require('mongoose');
2
3
  const BaseCli = require('./modules/BaseCli');
3
4
  const Server = require('./server');
4
5
 
5
6
  class Cli extends BaseCli {
6
7
  constructor(serverConfig) {
8
+ mongoose.set('autoIndex', false); // we do not need create indexes on CLI.
7
9
  const server = new Server(serverConfig);
8
10
  super(server);
9
11
  this.args = parseArgs(process.argv.slice(3));
@@ -5,6 +5,7 @@ describe('migration model', () => {
5
5
  expect.assertions(1);
6
6
  let errorCode;
7
7
  const MigrationModel = global.server.app.getModel('Migration');
8
+ await MigrationModel.syncIndexes();
8
9
  await MigrationModel.create({
9
10
  migrationFile: 'a',
10
11
  });
@@ -21,16 +21,17 @@ class AbstractModel extends Base {
21
21
  this.mongooseSchema,
22
22
  );
23
23
  if (!mongoose.connection.readyState) {
24
+ this.app.events.on('shutdown', async () => {
25
+ for (const c of mongoose.connections) {
26
+ c.close(true);
27
+ }
28
+ // await mongoose.disconnect(); // TODO it have problems with replica-set
29
+ });
24
30
  // do not connect on test
25
31
  mongoose.connect(this.app.getConfig('mongo').connectionString, {}).then(
26
32
  () => {
27
33
  this.logger.info('Mongo connection success');
28
- this.app.events.on('shutdown', async () => {
29
- for (const c of mongoose.connections) {
30
- c.close(true);
31
- }
32
- // await mongoose.disconnect(); // TODO it have problems with replica-set
33
- });
34
+
34
35
  callback();
35
36
  },
36
37
  (error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptivestone/framework",
3
- "version": "4.8.1",
3
+ "version": "4.8.3",
4
4
  "description": "Adaptive stone node js framework",
5
5
  "main": "index.js",
6
6
  "engines": {
package/tests/setup.js CHANGED
@@ -3,6 +3,8 @@ const path = require('node:path');
3
3
  const { MongoMemoryReplSet } = require('mongodb-memory-server');
4
4
  const mongoose = require('mongoose');
5
5
 
6
+ mongoose.set('autoIndex', false);
7
+
6
8
  let mongoMemoryServerInstance;
7
9
 
8
10
  const redis = require('redis');
@@ -5,6 +5,8 @@ const { MongoMemoryReplSet } = require('mongodb-memory-server');
5
5
 
6
6
  const mongoose = require('mongoose');
7
7
 
8
+ mongoose.set('autoIndex', false); // we do not need create indexes щт еуыеы
9
+
8
10
  let mongoMemoryServerInstance;
9
11
 
10
12
  const redis = require('redis');