@xuda.io/xuda-dbs-plugin-xuda 1.0.13 → 1.0.15
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/index.mjs +15 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
@@ -68,7 +68,9 @@ const check_unique = async function (docP, table_obj) {
|
|
68
68
|
keyValue.join(",") +
|
69
69
|
"]]";
|
70
70
|
try {
|
71
|
-
const json = await _this.runtime_xuda_driver("runtime_get_index", e);
|
71
|
+
// const json = await _this.runtime_xuda_driver("runtime_get_index", e);
|
72
|
+
e.view = "db_index";
|
73
|
+
const json = await _this.Read(_, e, db, app_id_reference, table_obj);
|
72
74
|
|
73
75
|
// var data;
|
74
76
|
|
@@ -154,7 +156,13 @@ const get_index_json = async function (docInP, table_obj) {
|
|
154
156
|
}
|
155
157
|
};
|
156
158
|
|
157
|
-
|
159
|
+
const find_item_by_key_root = function (arr, key, val) {
|
160
|
+
return _.find(arr, function (e) {
|
161
|
+
return e[key] === val;
|
162
|
+
});
|
163
|
+
};
|
164
|
+
|
165
|
+
export const Create = async (_, e, db, app_id_reference, table_obj) => {
|
158
166
|
const batch = async function () {
|
159
167
|
var docs = [];
|
160
168
|
try {
|
@@ -229,7 +237,7 @@ export const Create = async (_, e, db, table_obj) => {
|
|
229
237
|
}
|
230
238
|
return await single();
|
231
239
|
};
|
232
|
-
export const Read = async (_, e, db, table_obj) => {
|
240
|
+
export const Read = async (_, e, db, app_id_reference, table_obj) => {
|
233
241
|
var key;
|
234
242
|
|
235
243
|
const runtime_get_mango_data = async function () {
|
@@ -765,7 +773,7 @@ export const Read = async (_, e, db, table_obj) => {
|
|
765
773
|
|
766
774
|
// xuda
|
767
775
|
var cache_string = JSON.stringify(opt);
|
768
|
-
|
776
|
+
|
769
777
|
if (
|
770
778
|
// __.CACHE_QUERY_REQ[app_id_reference] &&
|
771
779
|
// __.CACHE_QUERY_REQ[app_id_reference][e.table_id] &&
|
@@ -928,7 +936,7 @@ export const Read = async (_, e, db, table_obj) => {
|
|
928
936
|
}
|
929
937
|
return await runtime_get_mango_data();
|
930
938
|
};
|
931
|
-
export const Update = async (_, e, db, table_obj) => {
|
939
|
+
export const Update = async (_, e, db, app_id_reference, table_obj) => {
|
932
940
|
try {
|
933
941
|
const doc = await db.get(e.row_id, {});
|
934
942
|
let data = doc.udfData.data;
|
@@ -979,7 +987,7 @@ export const Update = async (_, e, db, table_obj) => {
|
|
979
987
|
return { code: -550, data: error };
|
980
988
|
}
|
981
989
|
};
|
982
|
-
export const Delete = async (_, e, db, table_obj) => {
|
990
|
+
export const Delete = async (_, e, db, app_id_reference, table_obj) => {
|
983
991
|
const data = await db.fetch({ keys: e.ids });
|
984
992
|
for await (var val of data.rows) {
|
985
993
|
var doc = val.doc;
|
@@ -1006,7 +1014,7 @@ export const Delete = async (_, e, db, table_obj) => {
|
|
1006
1014
|
}
|
1007
1015
|
};
|
1008
1016
|
|
1009
|
-
export const Restore = async (_, e, db, table_obj) => {
|
1017
|
+
export const Restore = async (_, e, db, app_id_reference, table_obj) => {
|
1010
1018
|
var docs_to_restore = [];
|
1011
1019
|
const data = await db.fetch({ keys: e.ids });
|
1012
1020
|
|
package/package.json
CHANGED