Socket
Socket
Sign inDemoInstall

strapi-utils

Package Overview
Dependencies
Maintainers
8
Versions
282
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-utils - npm Package Compare versions

Comparing version 3.2.5 to 3.3.0

lib/__tests__/env-helper.test.js

2

lib/index.js

@@ -34,2 +34,3 @@ 'use strict';

const webhook = require('./webhook');
const env = require('./env-helper');

@@ -65,2 +66,3 @@ module.exports = {

webhook,
env,
};

@@ -82,3 +82,7 @@ 'use strict';

attribute.collection
)}\` is missing from the ${attribute.plugin ? '(plugin - ' + attribute.plugin + ')' : ''} models`
)}\`, used in the attribute \`${attributeName}\` in the model ${_.upperFirst(
modelName
)}, is missing from the${
attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''
} models`
);

@@ -92,3 +96,3 @@ }

attribute.collection
)} ${attribute.plugin ? '(plugin - ' + attribute.plugin + ')' : ''}`
)}${attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''}`
);

@@ -115,2 +119,10 @@ }

types.other = 'morphTo';
} else {
throw new Error(
`The attribute \`${
attribute.via
}\` is not correctly configured in the model ${_.upperFirst(attribute.collection)}${
attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''
}`
);
}

@@ -121,5 +133,22 @@ } else if (_.has(attribute, 'via') && _.has(attribute, 'model')) {

// We have to find if they are a model linked to this attributeName
const model = models[attribute.model];
if (!_.has(models, attribute.model)) {
throw new Error(
`The model \`${_.upperFirst(
attribute.model
)}\`, used in the attribute \`${attributeName}\` in the model ${_.upperFirst(
modelName
)}, is missing from the${
attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''
} models`
);
}
const reverseAttribute = models[attribute.model].attributes[attribute.via];
const reverseAttribute = model.attributes[attribute.via];
if (!reverseAttribute) {
throw new Error(
`The attribute \`${attribute.via}\` is missing in the model ${_.upperFirst(
attribute.model
)}${attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''}`
);
}

@@ -137,2 +166,10 @@ if (

types.other = 'morphTo';
} else {
throw new Error(
`The attribute \`${
attribute.via
}\` is not correctly configured in the model ${_.upperFirst(attribute.model)}${
attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''
}`
);
}

@@ -181,2 +218,8 @@ } else if (_.has(attribute, 'model')) {

});
} else {
throw new Error(
`The attribute \`${attributeName}\` is not correctly configured in the model ${_.upperFirst(
modelName
)}${attribute.plugin ? ' (plugin - ' + attribute.plugin + ')' : ''}`
);
}

@@ -390,3 +433,3 @@

if ((attr.collection || attr.model || '').toLowerCase() === model.toLowerCase()) {
acc.push(strapi.plugins[current].models[entity].globalId);
acc.push(strapi.plugins[current].models[entity]);
}

@@ -404,3 +447,3 @@ });

if ((attr.collection || attr.model || '').toLowerCase() === model.toLowerCase()) {
acc.push(strapi.models[entity].globalId);
acc.push(strapi.models[entity]);
}

@@ -417,3 +460,3 @@ });

if ((attr.collection || attr.model || '').toLowerCase() === model.toLowerCase()) {
acc.push(strapi.components[entity].globalId);
acc.push(strapi.components[entity]);
}

@@ -425,3 +468,3 @@ });

const models = _.uniq(appModels.concat(pluginsModels).concat(componentModels));
const models = _.uniqWith(appModels.concat(pluginsModels, componentModels), _.isEqual);

@@ -428,0 +471,0 @@ definition.associations.push({

4

package.json
{
"name": "strapi-utils",
"version": "3.2.5",
"version": "3.3.0",
"description": "Shared utilities for the Strapi packages",

@@ -48,3 +48,3 @@ "homepage": "http://strapi.io",

"license": "SEE LICENSE IN LICENSE",
"gitHead": "c78591553f5509fcadc8c719f6af6f1bf0e734f3"
"gitHead": "ec1c2a22c3b381eabe872535c01bd9bd8e874f5f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc