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.6.0-next.0 to 3.6.0

18

lib/build-query.js

@@ -114,12 +114,12 @@ 'use strict';

return whereClauses
.filter(({ value }) => !_.isNull(value))
.filter(({ field, value }) => {
if (_.isNull(value)) {
return false;
} else if (_.isUndefined(value)) {
strapi.log.warn(`The value of field: '${field}', in your where filter, is undefined.`);
return false;
}
return true;
})
.map(({ field, operator, value }) => {
if (_.isUndefined(value)) {
const err = new Error(
`The value of field: '${field}', in your where filter, is undefined.`
);
err.status = 400;
throw err;
}
if (BOOLEAN_OPERATORS.includes(operator)) {

@@ -126,0 +126,0 @@ return {

@@ -195,2 +195,11 @@ 'use strict';

/**
* Checks if an attribute is of type `type`
* @param {object} attribute
* @param {string} type
*/
const isTypedAttribute = (attribute, type) => {
return _.has(attribute, 'type') && attribute.type === type;
};
/**
* Returns a route prefix for a contentType

@@ -210,2 +219,3 @@ * @param {object} contentType

isRelationalAttribute,
isTypedAttribute,
getPrivateAttributes,

@@ -212,0 +222,0 @@ getTimestampsAttributes,

@@ -50,3 +50,6 @@ 'use strict';

const whereParams = _.omit(params, ['_sort', '_start', '_limit', '_where', '_publicationState']);
const whereParams = convertExtraRootParams(
_.omit(params, ['_sort', '_start', '_limit', '_where', '_publicationState'])
);
const whereClauses = [];

@@ -68,2 +71,20 @@

/**
* Convert params prefixed with _ by removing the prefix after we have handle the internal params
* NOTE: This is only a temporary patch for v3 to handle extra params coming from plugins
* @param {object} params
* @returns {object}
*/
const convertExtraRootParams = params => {
return Object.entries(params).reduce((acc, [key, value]) => {
if (_.startsWith(key, '_') && !QUERY_OPERATORS.includes(key)) {
acc[key.slice(1)] = value;
} else {
acc[key] = value;
}
return acc;
}, {});
};
/**
* Sort query parser

@@ -70,0 +91,0 @@ * @param {string} sortQuery - ex: id:asc,price:desc

{
"name": "strapi-utils",
"version": "3.6.0-next.0",
"version": "3.6.0",
"description": "Shared utilities for the Strapi packages",

@@ -19,3 +19,3 @@ "homepage": "https://strapi.io",

"date-fns": "^2.19.0",
"lodash": "4.17.20",
"lodash": "4.17.21",
"pino": "^4.7.1",

@@ -49,3 +49,3 @@ "pluralize": "^8.0.0",

"license": "SEE LICENSE IN LICENSE",
"gitHead": "fd18d2a67aec0bd2c76a375297ac30d4c3c0dfb7"
"gitHead": "4ab210eec65d7f1a4f6334cdef4c797b4e6b9531"
}
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