@strapi/utils
Advanced tools
Comparing version 4.0.0-next.13 to 4.0.0-next.14
@@ -9,2 +9,3 @@ 'use strict'; | ||
const _ = require('lodash'); | ||
const parseType = require('./parse-type'); | ||
@@ -33,2 +34,6 @@ const QUERY_OPERATORS = ['_where', '_or', '_and']; | ||
const convertCountQueryParams = countQuery => { | ||
return parseType({ type: 'boolean', value: countQuery }); | ||
}; | ||
/** | ||
@@ -166,3 +171,3 @@ * Sort query parser | ||
// TODO: We will need to consider a way to add limitation / pagination | ||
const { sort, filters, fields, populate } = subPopulate; | ||
const { sort, filters, fields, populate, count } = subPopulate; | ||
@@ -187,2 +192,6 @@ const query = {}; | ||
if (count) { | ||
query.count = convertCountQueryParams(count); | ||
} | ||
return query; | ||
@@ -213,19 +222,2 @@ }; | ||
// TODO: migrate | ||
const VALID_REST_OPERATORS = [ | ||
'eq', | ||
'ne', | ||
'in', | ||
'nin', | ||
'contains', | ||
'ncontains', | ||
'containss', | ||
'ncontainss', | ||
'lt', | ||
'lte', | ||
'gt', | ||
'gte', | ||
'null', | ||
]; | ||
module.exports = { | ||
@@ -238,4 +230,3 @@ convertSortQueryParams, | ||
convertFieldsQueryParams, | ||
VALID_REST_OPERATORS, | ||
QUERY_OPERATORS, | ||
}; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
const { buildQuery, hasDeepFilters } = require('./build-query'); | ||
const { VALID_REST_OPERATORS, QUERY_OPERATORS } = require('./convert-query-params'); | ||
const { QUERY_OPERATORS } = require('./convert-query-params'); | ||
const parseMultipartData = require('./parse-multipart'); | ||
@@ -35,2 +35,3 @@ const sanitizeEntity = require('./sanitize-entity'); | ||
const providerFactory = require('./provider-factory'); | ||
const pagination = require('./pagination'); | ||
@@ -42,3 +43,2 @@ module.exports = { | ||
templateConfiguration, | ||
VALID_REST_OPERATORS, | ||
QUERY_OPERATORS, | ||
@@ -70,2 +70,3 @@ buildQuery, | ||
providerFactory, | ||
pagination, | ||
}; |
@@ -51,5 +51,5 @@ 'use strict'; | ||
// Relations | ||
const isRelation = attribute && attribute.type === 'relation'; | ||
const isRelation = attribute && ['relation', 'component'].includes(attribute.type); | ||
if (isRelation) { | ||
const relation = attribute && attribute.target; | ||
const relation = attribute && (attribute.target || attribute.component); | ||
@@ -132,14 +132,16 @@ if (_.isNil(value)) { | ||
return _.concat( | ||
includeFields || [], | ||
...(isOutput | ||
? [ | ||
STATIC_FIELDS, | ||
CREATED_AT_ATTRIBUTE, | ||
UPDATED_AT_ATTRIBUTE, | ||
COMPONENT_FIELDS, | ||
...nonWritableAttributes, | ||
...nonVisibleAttributes, | ||
] | ||
: [STATIC_FIELDS, COMPONENT_FIELDS, ...nonVisibleWritableAttributes]) | ||
return _.uniq( | ||
_.concat( | ||
includeFields || [], | ||
...(isOutput | ||
? [ | ||
STATIC_FIELDS, | ||
CREATED_AT_ATTRIBUTE, | ||
UPDATED_AT_ATTRIBUTE, | ||
COMPONENT_FIELDS, | ||
...nonWritableAttributes, | ||
...nonVisibleAttributes, | ||
] | ||
: [STATIC_FIELDS, COMPONENT_FIELDS, ...nonVisibleWritableAttributes]) | ||
) | ||
); | ||
@@ -146,0 +148,0 @@ }; |
{ | ||
"name": "@strapi/utils", | ||
"version": "4.0.0-next.13", | ||
"version": "4.0.0-next.14", | ||
"description": "Shared utilities for the Strapi packages", | ||
@@ -8,5 +8,3 @@ "homepage": "https://strapi.io", | ||
"strapi", | ||
"utilities", | ||
"utils", | ||
"winston" | ||
"utils" | ||
], | ||
@@ -19,7 +17,5 @@ "directories": { | ||
"@sindresorhus/slugify": "1.1.0", | ||
"date-fns": "^2.19.0", | ||
"date-fns": "2.24.0", | ||
"lodash": "4.17.21", | ||
"pino": "^4.7.1", | ||
"pluralize": "^8.0.0", | ||
"yup": "^0.32.9" | ||
"yup": "0.32.9" | ||
}, | ||
@@ -50,3 +46,3 @@ "author": { | ||
"license": "SEE LICENSE IN LICENSE", | ||
"gitHead": "c1369c796034fb1b57471498eb1e0c75ce2d7715" | ||
"gitHead": "9b2bc8ed5d39e6b7c3a1b0767b73028b5292467b" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49675
4
24
1461
+ Addeddate-fns@2.24.0(transitive)
+ Addedyup@0.32.9(transitive)
- Removedpino@^4.7.1
- Removedpluralize@^8.0.0
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddate-fns@2.30.0(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfast-json-parse@1.0.3(transitive)
- Removedfast-safe-stringify@1.2.3(transitive)
- Removedflatstr@1.0.12(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpino@4.17.6(transitive)
- Removedpino-std-serializers@2.5.0(transitive)
- Removedpluralize@8.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedquick-format-unescaped@1.1.2(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsplit2@2.2.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
- Removedyup@0.32.11(transitive)
Updateddate-fns@2.24.0
Updatedyup@0.32.9