@flowerforce/flowerbase 1.1.0 → 1.1.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
+ ## 1.1.1 (2025-09-12)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **getOperators:** Handle the formattedQuery when it is empty ([e340be2](https://github.com/flowerforce/flowerbase/commit/e340be2))
7
+
1
8
  ## 1.1.0 (2025-09-12)
2
9
 
3
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyC,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAkpBrF,QAAA,MAAM,YAAY,EAAE,oBAmBlB,CAAA;AAEF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAyC,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAmpBrF,QAAA,MAAM,YAAY,EAAE,oBAmBlB,CAAA;AAEF,eAAe,YAAY,CAAA"}
@@ -235,8 +235,9 @@ const getOperators = (collection, { rules = {}, collName, user, run_as_system })
235
235
  const { filters, roles } = rules[collName] || {};
236
236
  // Pre-query filtering based on access control rules
237
237
  const formattedQuery = (0, utils_2.getFormattedQuery)(filters, query, user);
238
+ const currentQuery = formattedQuery.length ? { $and: formattedQuery } : {};
238
239
  // aggiunto filter per evitare questo errore: $and argument's entries must be objects
239
- const originalCursor = collection.find({ $and: formattedQuery });
240
+ const originalCursor = collection.find(currentQuery);
240
241
  // Clone the cursor to override `toArray` with post-query validation
241
242
  const client = originalCursor['client'];
242
243
  const newCursor = new mongodb_1.FindCursor(client);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowerforce/flowerbase",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -270,8 +270,9 @@ const getOperators: GetOperatorsFunction = (
270
270
 
271
271
  // Pre-query filtering based on access control rules
272
272
  const formattedQuery = getFormattedQuery(filters, query, user)
273
+ const currentQuery = formattedQuery.length ? { $and: formattedQuery } : {}
273
274
  // aggiunto filter per evitare questo errore: $and argument's entries must be objects
274
- const originalCursor = collection.find({ $and: formattedQuery })
275
+ const originalCursor = collection.find(currentQuery)
275
276
  // Clone the cursor to override `toArray` with post-query validation
276
277
  const client = originalCursor[
277
278
  'client' as keyof typeof originalCursor