@xuda.io/xuda-dbs-plugin-xuda 1.0.146 → 1.0.148
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/package.json +1 -1
- package/studio.mjs +21 -17
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xuda.io/xuda-dbs-plugin-xuda",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.148",
|
4
4
|
"description": "Xuda Database Socket for Xuda's proprietary structure powered by CouchDB",
|
5
5
|
"scripts": {
|
6
6
|
"pub": "npm version patch --force && npm publish --access public"
|
package/studio.mjs
CHANGED
@@ -731,24 +731,28 @@ const query_db = async function (e, db, table_obj) {
|
|
731
731
|
const doc = await db.find(opt);
|
732
732
|
var mango_index_obj;
|
733
733
|
if (doc?.warning?.includes("No matching index found")) {
|
734
|
-
|
735
|
-
.
|
736
|
-
|
737
|
-
|
734
|
+
try {
|
735
|
+
const index_name = `index_${e.table_id}_${new Date()
|
736
|
+
.valueOf()
|
737
|
+
.toString()}`;
|
738
|
+
var index = [];
|
738
739
|
|
739
|
-
|
740
|
-
|
740
|
+
for (const [key, val] of Object.entries(opt.selector)) {
|
741
|
+
index.push(key);
|
742
|
+
}
|
743
|
+
mango_index_obj = {
|
744
|
+
index: {
|
745
|
+
fields: index,
|
746
|
+
},
|
747
|
+
name: index_name,
|
748
|
+
ddoc: `mango_index_table_${e.table_id}`,
|
749
|
+
};
|
750
|
+
const result = await db.createIndex(mango_index_obj);
|
751
|
+
console.log("createIndex", result);
|
752
|
+
throw new Error("creating index in progress");
|
753
|
+
} catch (err) {
|
754
|
+
return { code: -1, data: err.message };
|
741
755
|
}
|
742
|
-
mango_index_obj = {
|
743
|
-
index: {
|
744
|
-
fields: index,
|
745
|
-
},
|
746
|
-
name: index_name,
|
747
|
-
ddoc: `mango_index_table_${e.table_id}`,
|
748
|
-
};
|
749
|
-
db.createIndex(mango_index_obj).then((result) => {
|
750
|
-
console.log(result);
|
751
|
-
});
|
752
756
|
}
|
753
757
|
return await done(doc);
|
754
758
|
} catch (err) {
|
@@ -790,7 +794,7 @@ const query_db = async function (e, db, table_obj) {
|
|
790
794
|
// };
|
791
795
|
// await monitor_indexing();
|
792
796
|
// throw new Error({ code: -88, data: "creating index" });
|
793
|
-
throw new Error("creating index
|
797
|
+
throw new Error("creating index in progress");
|
794
798
|
// const doc = await db.find(opt);
|
795
799
|
// return await done(doc);
|
796
800
|
} catch (err) {
|