@xuda.io/account_module 1.2.1491 → 1.2.1493

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.
Files changed (2) hide show
  1. package/index.mjs +30 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3053,7 +3053,35 @@ export const save_picture_cache = async function (uid, docType, name, file, meta
3053
3053
  };
3054
3054
 
3055
3055
  export const get_picture_cache = async function (uid, docType, name) {
3056
- let opt = { selector: { name }, limit: 1 };
3056
+ let opt = { selector: { docType, name }, limit: 1 };
3057
3057
 
3058
- const ret = await db_module.find_couch_query('xuda_cache', from_opt);
3058
+ const ret = await db_module.find_couch_query('xuda_cache', opt);
3059
+
3060
+ if (ret.doc.length) {
3061
+ return ret.doc[0].file;
3062
+ }
3063
+
3064
+ function findAnyThreeWords(str) {
3065
+ // 1. Extract all words (letters + digits + underscore)
3066
+ const words = str.match(/\b\w+\b/g) || [];
3067
+
3068
+ // 2. If less than 3 words → no match
3069
+ if (words.length < 3) return [];
3070
+
3071
+ // 3. Generate all possible combinations of 3 different words
3072
+ const result = [];
3073
+
3074
+ for (let i = 0; i < words.length - 2; i++) {
3075
+ for (let j = i + 1; j < words.length - 1; j++) {
3076
+ for (let k = j + 1; k < words.length; k++) {
3077
+ result.push([words[i], words[j], words[k]]);
3078
+ }
3079
+ }
3080
+ }
3081
+
3082
+ // Optional: format as strings in any order you like
3083
+ return result.map((arr) => arr.join(' '));
3084
+ }
3085
+ if (name.split(' ').length < 3) return;
3086
+ const arr = findAnyThreeWords(name);
3059
3087
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1491",
3
+ "version": "1.2.1493",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {