@flowerforce/flowerbase 1.3.1-beta.5 → 1.4.0

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,23 @@
1
+ ## 1.4.0 (2026-01-15)
2
+
3
+
4
+ ### 🚀 Features
5
+
6
+ - add method count mongodb ([6348568](https://github.com/flowerforce/flowerbase/commit/6348568))
7
+
8
+ - add $sort ([f468213](https://github.com/flowerforce/flowerbase/commit/f468213))
9
+
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - load triggers ([fe9062e](https://github.com/flowerforce/flowerbase/commit/fe9062e))
14
+
15
+ - http in functions ([1c8cc6d](https://github.com/flowerforce/flowerbase/commit/1c8cc6d))
16
+
17
+ - update fields roles ([289466a](https://github.com/flowerforce/flowerbase/commit/289466a))
18
+
19
+ - clean empty fields ([7decc8b](https://github.com/flowerforce/flowerbase/commit/7decc8b))
20
+
1
21
  ## 1.3.0 (2026-01-14)
2
22
 
3
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/features/rules/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAe,MAAM,aAAa,CAAA;AAEhD,eAAO,MAAM,SAAS,GAAU,gBAAuB,KAAG,OAAO,CAAC,KAAK,CAuBtE,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/features/rules/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAe,MAAM,aAAa,CAAA;AAEhD,eAAO,MAAM,SAAS,GAAU,gBAAuB,KAAG,OAAO,CAAC,KAAK,CAsCtE,CAAA"}
@@ -29,9 +29,20 @@ const loadRules = (...args_1) => __awaiter(void 0, [...args_1], void 0, function
29
29
  };
30
30
  const files = recursivelyCollectFiles(rulesRoot);
31
31
  const rulesFiles = files.filter((x) => x.endsWith('rules.json'));
32
+ const removeEmptyFieldRules = (rulesConfig) => {
33
+ var _a;
34
+ const roles = ((_a = rulesConfig.roles) !== null && _a !== void 0 ? _a : []).map((role) => {
35
+ const fields = role.fields;
36
+ if (!fields)
37
+ return role;
38
+ const cleanedFields = Object.fromEntries(Object.entries(fields).filter(([, value]) => value && typeof value === 'object' && Object.keys(value).length > 0));
39
+ return Object.assign(Object.assign({}, role), { fields: cleanedFields });
40
+ });
41
+ return Object.assign(Object.assign({}, rulesConfig), { roles });
42
+ };
32
43
  const rulesByCollection = rulesFiles.reduce((acc, rulesFile) => {
33
44
  const filePath = rulesFile;
34
- const collectionRules = (0, utils_1.readJsonContent)(filePath);
45
+ const collectionRules = removeEmptyFieldRules((0, utils_1.readJsonContent)(filePath));
35
46
  acc[collectionRules.collection] = collectionRules;
36
47
  return acc;
37
48
  }, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowerforce/flowerbase",
3
- "version": "1.3.1-beta.5",
3
+ "version": "1.4.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,9 +17,24 @@ export const loadRules = async (rootDir = process.cwd()): Promise<Rules> => {
17
17
  const files = recursivelyCollectFiles(rulesRoot)
18
18
  const rulesFiles = files.filter((x) => (x as string).endsWith('rules.json'))
19
19
 
20
+ const removeEmptyFieldRules = (rulesConfig: RulesConfig): RulesConfig => {
21
+ const roles = (rulesConfig.roles ?? []).map((role) => {
22
+ const fields = (role as { fields?: Record<string, Record<string, unknown>> }).fields
23
+ if (!fields) return role
24
+ const cleanedFields = Object.fromEntries(
25
+ Object.entries(fields).filter(([, value]) =>
26
+ value && typeof value === 'object' && Object.keys(value).length > 0
27
+ )
28
+ )
29
+ return { ...role, fields: cleanedFields }
30
+ })
31
+
32
+ return { ...rulesConfig, roles }
33
+ }
34
+
20
35
  const rulesByCollection = rulesFiles.reduce((acc, rulesFile) => {
21
36
  const filePath = rulesFile
22
- const collectionRules = readJsonContent(filePath) as RulesConfig
37
+ const collectionRules = removeEmptyFieldRules(readJsonContent(filePath) as RulesConfig)
23
38
  acc[collectionRules.collection] = collectionRules
24
39
 
25
40
  return acc