@akemona-org/strapi-connector-mongoose 3.7.0 → 3.7.2

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/lib/index.js CHANGED
@@ -37,7 +37,7 @@ const defaults = {
37
37
 
38
38
  const isMongooseConnection = ({ connector }) => connector === 'mongoose';
39
39
 
40
- const createConnectionURL = opts => {
40
+ const createConnectionURL = (opts) => {
41
41
  const { protocol, auth, host, port } = opts;
42
42
 
43
43
  return {
@@ -47,31 +47,23 @@ const createConnectionURL = opts => {
47
47
  };
48
48
  };
49
49
 
50
- module.exports = function(strapi) {
50
+ module.exports = function (strapi) {
51
51
  const { connections } = strapi.config;
52
- const mongooseConnections = Object.keys(connections).filter(key =>
52
+ const mongooseConnections = Object.keys(connections).filter((key) =>
53
53
  isMongooseConnection(connections[key])
54
54
  );
55
55
 
56
56
  function initialize() {
57
57
  registerCoreMigrations();
58
58
 
59
- const connectionsPromises = mongooseConnections.map(async connectionName => {
59
+ const connectionsPromises = mongooseConnections.map(async (connectionName) => {
60
60
  const connection = connections[connectionName];
61
61
  const instance = new Mongoose();
62
62
 
63
63
  _.defaults(connection.settings, strapi.config.hook.settings.mongoose);
64
64
 
65
- const {
66
- uri,
67
- host,
68
- port,
69
- username,
70
- password,
71
- database,
72
- srv,
73
- useUnifiedTopology,
74
- } = connection.settings;
65
+ const { uri, host, port, username, password, database, srv, useUnifiedTopology } =
66
+ connection.settings;
75
67
 
76
68
  // eslint-disable-next-line node/no-deprecated-api
77
69
  const uriOptions = uri ? url.parse(uri, true).query : {};
@@ -188,7 +180,7 @@ module.exports = function(strapi) {
188
180
 
189
181
  function mountPlugins(connectionName, ctx) {
190
182
  return Promise.all(
191
- Object.keys(strapi.plugins).map(name => {
183
+ Object.keys(strapi.plugins).map((name) => {
192
184
  const plugin = strapi.plugins[name];
193
185
  return mountModels(
194
186
  {
@@ -203,7 +195,7 @@ module.exports = function(strapi) {
203
195
 
204
196
  async function destroy() {
205
197
  await Promise.all(
206
- mongooseConnections.map(connName => {
198
+ mongooseConnections.map((connName) => {
207
199
  const mongooseConnection = strapi.connections[connName];
208
200
 
209
201
  if (
@@ -34,7 +34,7 @@ module.exports = async ({ connection }) => {
34
34
  () => {
35
35
  Mongoose.connection.close();
36
36
  },
37
- error => {
37
+ (error) => {
38
38
  Mongoose.connection.close();
39
39
  throw error;
40
40
  }
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const isDuplicateEntryError = error => {
3
+ const isDuplicateEntryError = (error) => {
4
4
  return error.code === 11000; // MongoDB code for duplicate key error
5
5
  };
6
6
 
7
- const handleDatabaseError = error => {
7
+ const handleDatabaseError = (error) => {
8
8
  if (isDuplicateEntryError(error)) {
9
9
  strapi.log.warn('Duplicate entry', error.toString());
10
10
  throw new Error('Duplicate entry');
@@ -1,9 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const findComponentByGlobalId = globalId => {
4
- return Object.values(strapi.components).find(
5
- compo => compo.globalId === globalId
6
- );
3
+ const findComponentByGlobalId = (globalId) => {
4
+ return Object.values(strapi.components).find((compo) => compo.globalId === globalId);
7
5
  };
8
6
 
9
7
  module.exports = {
@@ -2,9 +2,9 @@
2
2
 
3
3
  const _ = require('lodash');
4
4
 
5
- const getKeyForDefinition = definition => `model_def_${definition.uid}`;
5
+ const getKeyForDefinition = (definition) => `model_def_${definition.uid}`;
6
6
 
7
- const formatDefinitionToStore = definition =>
7
+ const formatDefinitionToStore = (definition) =>
8
8
  JSON.stringify(
9
9
  _.pick(definition, [
10
10
  'uid',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.7.0",
6
+ "version": "3.7.2",
7
7
  "description": "Mongoose hook for the Strapi framework",
8
8
  "homepage": "https://strapi.akemona.com",
9
9
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "main": "./lib",
20
20
  "dependencies": {
21
- "@akemona-org/strapi-utils": "3.7.0",
21
+ "@akemona-org/strapi-utils": "3.7.2",
22
22
  "lodash": "4.17.21",
23
23
  "mongoose": "5.10.8",
24
24
  "mongoose-float": "^1.0.4",
@@ -54,5 +54,5 @@
54
54
  "scripts": {
55
55
  "test": "echo \"no tests yet\""
56
56
  },
57
- "gitHead": "129a8d6191b55810fd66448dcc47fee829df986c"
57
+ "gitHead": "4ab59dbae5135819558c6ae27b45a556ff27cf55"
58
58
  }