Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@strapi/utils

Package Overview
Dependencies
Maintainers
7
Versions
1394
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 4.3.6 to 4.3.7

19

lib/content-types.js

@@ -109,3 +109,17 @@ 'use strict';

};
const isMediaAttribute = (attribute) => attribute.type === 'media';
const isRelationalAttribute = (attribute) => attribute.type === 'relation';
const isComponentAttribute = (attribute) => ['component', 'dynamiczone'].includes(attribute.type);
const getComponentAttributes = (schema) => {
return _.reduce(
schema.attributes,
(acc, attr, attrName) => {
if (isComponentAttribute(attr)) acc.push(attrName);
return acc;
},
[]
);
};
const getScalarAttributes = (schema) => {

@@ -122,6 +136,2 @@ return _.reduce(

const isMediaAttribute = (attribute) => attribute.type === 'media';
const isRelationalAttribute = (attribute) => attribute.type === 'relation';
const isComponentAttribute = (attribute) => ['component', 'dynamiczone'].includes(attribute.type);
/**

@@ -157,2 +167,3 @@ * Checks if an attribute is of type `type`

getNonWritableAttributes,
getComponentAttributes,
getScalarAttributes,

@@ -159,0 +170,0 @@ getWritableAttributes,

@@ -177,4 +177,10 @@ /* eslint-disable max-classes-per-file */

.map((uid) => strapi.getModel(uid))
.map((schema) => convertNestedPopulate(subPopulate, schema));
.map((schema) => convertNestedPopulate(subPopulate, schema))
.map((populate) => (populate === true ? {} : populate)) // cast boolean to empty object to avoid merging issues
.filter((populate) => populate !== false);
if (isEmpty(populates)) {
return acc;
}
return {

@@ -207,5 +213,11 @@ ...acc,

const populateObject = convertNestedPopulate(subPopulate, targetSchema);
if (!populateObject) {
return acc;
}
return {
...acc,
[key]: convertNestedPopulate(subPopulate, targetSchema),
[key]: populateObject,
};

@@ -216,4 +228,4 @@ }, {});

const convertNestedPopulate = (subPopulate, schema) => {
if (subPopulate === '*') {
return true;
if (_.isString(subPopulate)) {
return parseType({ type: 'boolean', value: subPopulate, forceCast: true });
}

@@ -220,0 +232,0 @@

{
"name": "@strapi/utils",
"version": "4.3.6",
"version": "4.3.7",
"description": "Shared utilities for the Strapi packages",

@@ -48,3 +48,3 @@ "keywords": [

},
"gitHead": "4c6e67c4934580ed051a2afb83e6fc8f64f3a5b5"
"gitHead": "73f523b98322cea8992c72977b94a73a624d2e79"
}
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