@xuda.io/xuda-dbs-plugin-xuda 1.0.150 → 1.0.152
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/server.js +10 -13
- package/studio.mjs +40 -14
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.152",
|
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/server.js
CHANGED
@@ -745,19 +745,16 @@ const query_db = async function (e, db, app_id_reference, table_obj) {
|
|
745
745
|
|
746
746
|
mango_index_obj = {
|
747
747
|
index: {
|
748
|
-
fields:
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
(
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
),
|
759
|
-
...["docType", "stat"],
|
760
|
-
],
|
748
|
+
fields: Object.keys(
|
749
|
+
_.reduce(
|
750
|
+
opt.sort,
|
751
|
+
(ret, val) => {
|
752
|
+
ret[Object.keys(val)[0]] = val;
|
753
|
+
return ret;
|
754
|
+
},
|
755
|
+
opt.selector
|
756
|
+
)
|
757
|
+
),
|
761
758
|
},
|
762
759
|
name: index_name,
|
763
760
|
ddoc: `mango_index_table_${e.table_id}`,
|
package/studio.mjs
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
const check_unique = async function (e, docP, table_obj, db) {
|
2
|
-
|
2
|
+
const validate_unique_index_exist = function () {
|
3
|
+
let unique_exist = false;
|
4
|
+
for (var val of docP.udfIndex) {
|
5
|
+
if (!table_obj.tableIndexes) {
|
6
|
+
break;
|
7
|
+
}
|
8
|
+
|
9
|
+
const table_index = find_item_by_key_root(
|
10
|
+
table_obj.tableIndexes,
|
11
|
+
"id",
|
12
|
+
val.indexId
|
13
|
+
);
|
14
|
+
|
15
|
+
if (!table_index) {
|
16
|
+
break;
|
17
|
+
}
|
18
|
+
|
19
|
+
if (table_index.data.unique) {
|
20
|
+
unique_exist = true;
|
21
|
+
break;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return unique_exist;
|
25
|
+
};
|
26
|
+
|
27
|
+
if (
|
28
|
+
validate_unique_index_exist() &&
|
29
|
+
(typeof func === "undefined" || // call from studio
|
30
|
+
!e.full_table_downloaded)
|
31
|
+
) {
|
3
32
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
4
33
|
const ret = await func.common.perform_rpi_request(
|
5
34
|
SESSION_ID,
|
@@ -764,19 +793,16 @@ const query_db = async function (e, db, table_obj) {
|
|
764
793
|
|
765
794
|
mango_index_obj = {
|
766
795
|
index: {
|
767
|
-
fields:
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
(
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
),
|
778
|
-
...["docType", "stat"],
|
779
|
-
],
|
796
|
+
fields: Object.keys(
|
797
|
+
_.reduce(
|
798
|
+
opt.sort,
|
799
|
+
(ret, val) => {
|
800
|
+
ret[Object.keys(val)[0]] = val;
|
801
|
+
return ret;
|
802
|
+
},
|
803
|
+
opt.selector
|
804
|
+
)
|
805
|
+
),
|
780
806
|
},
|
781
807
|
name: index_name,
|
782
808
|
ddoc: `mango_index_table_${e.table_id}`,
|