forest-express-sequelize 8.5.0 → 8.5.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [8.5.1](https://github.com/ForestAdmin/forest-express-sequelize/compare/v8.5.0...v8.5.1) (2022-03-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **count:** remove useless joins in basic count ([#900](https://github.com/ForestAdmin/forest-express-sequelize/issues/900)) ([86d30ef](https://github.com/ForestAdmin/forest-express-sequelize/commit/86d30ef2c74446de0f5e7e48d46c2f3d209a4c6b))
7
+
1
8
  # [8.5.0](https://github.com/ForestAdmin/forest-express-sequelize/compare/v8.4.10...v8.5.0) (2022-02-08)
2
9
 
3
10
 
@@ -67,7 +67,7 @@ function QueryBuilder() {
67
67
  return targetFields.includes(fieldName);
68
68
  });
69
69
 
70
- if (!fieldNamesRequested || fieldNamesRequested.includes(association.as) || explicitAttributes.length) {
70
+ if (fieldNamesRequested !== null && fieldNamesRequested !== void 0 && fieldNamesRequested.includes(association.as) || explicitAttributes.length) {
71
71
  // NOTICE: For performance reasons, we only request the keys
72
72
  // as they're the only needed fields for the interface
73
73
  const uniqueExplicitAttributes = uniqueValues([...getMandatoryFields(association), ...explicitAttributes].filter(Boolean));
@@ -107,16 +107,14 @@ class QueryOptions {
107
107
 
108
108
  get _sequelizeInclude() {
109
109
  const fields = [...this._requestedFields, ...this._requestedRelations, ...this._neededFields];
110
- const include = [...new _queryBuilder.default().getIncludes(this._model, fields.length ? fields : null), ...this._customerIncludes];
110
+ const include = [...new _queryBuilder.default().getIncludes(this._model, fields), ...this._customerIncludes];
111
111
  return include.length ? include : null;
112
112
  }
113
113
  /** Compute sequelize query `.order` property */
114
114
 
115
115
 
116
116
  get _sequelizeOrder() {
117
- var _this$_sequelizeInclu;
118
-
119
- if ((0, _database.isMSSQL)(this._model.sequelize) && (_this$_sequelizeInclu = this._sequelizeInclude) !== null && _this$_sequelizeInclu !== void 0 && _this$_sequelizeInclu.length) {
117
+ if ((0, _database.isMSSQL)(this._model.sequelize)) {
120
118
  // Work around sequelize bug: https://github.com/sequelize/sequelize/issues/11258
121
119
  const primaryKeys = Object.keys(this._model.primaryKeys);
122
120
  return this._order.filter(function (order) {
@@ -92,7 +92,8 @@ class ResourcesGetter {
92
92
  const scopeFilters = await _forestExpress.scopeManager.getScopeForUser(this._user, this._model.name, true);
93
93
  const requestedFields = (0, _requestedFieldsExtractor.default)(fields, this._model, _forestExpress.Schemas.schemas);
94
94
  const queryOptions = new _queryOptions.default(this._model, {
95
- tableAlias
95
+ tableAlias,
96
+ includeRelations: searchExtended
96
97
  });
97
98
  if (!forCount) await queryOptions.requireFields(requestedFields);
98
99
  await queryOptions.search(search, searchExtended);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "forest-express-sequelize",
3
3
  "description": "Official Express/Sequelize Liana for Forest",
4
- "version": "8.5.0",
4
+ "version": "8.5.1",
5
5
  "author": "Sandro Munda <sandro@munda.me>",
6
6
  "contributors": [
7
7
  "Arnaud Besnier <arnaudibesnier@gmail.com>",