@xuda.io/xuda-dbs-plugin-xuda 1.0.95 → 1.0.96

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/package.json +1 -1
  2. package/studio.mjs +18 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
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
@@ -1,4 +1,4 @@
1
- const check_unique = async function (e, docP, table_obj, db, app_id_reference) {
1
+ const check_unique = async function (e, docP, table_obj, db) {
2
2
  var len = docP.udfIndex.length;
3
3
  if (!len) {
4
4
  return { code: -11, data: "table must have primary index" };
@@ -69,7 +69,7 @@ const check_unique = async function (e, docP, table_obj, db, app_id_reference) {
69
69
  "]]";
70
70
  try {
71
71
  e.view = "db_index";
72
- const ret = await query_db(e, db, app_id_reference, table_obj);
72
+ const ret = await query_db(e, db, table_obj);
73
73
  const json = ret.data;
74
74
 
75
75
  // var data;
@@ -182,7 +182,7 @@ const get_cast_val = async function (source, attributeP, typeP, valP) {
182
182
  }
183
183
  );
184
184
  };
185
- const query_db = async function (e, db, app_id_reference, table_obj) {
185
+ const query_db = async function (e, db, table_obj) {
186
186
  var key = undefined;
187
187
 
188
188
  const runtime_get_mango_data = async function () {
@@ -940,10 +940,10 @@ const query_db = async function (e, db, app_id_reference, table_obj) {
940
940
  return await runtime_get_mango_data();
941
941
  };
942
942
 
943
- export const create = async (params, setup_doc, resolve, reject) => {
943
+ export const create = async (params, resolve, reject) => {
944
944
  const e = params.e;
945
945
  const db = params.db;
946
- const app_id_reference = params.app_id_reference;
946
+
947
947
  const table_obj = params.table_obj;
948
948
 
949
949
  const create_data_obj = async function (table_data) {
@@ -982,7 +982,7 @@ export const create = async (params, setup_doc, resolve, reject) => {
982
982
  if (index_ret < 0) throw index_ret.data;
983
983
  doc.udfIndex = index_ret.data;
984
984
 
985
- const ret = await check_unique(e, doc, table_obj, db, app_id_reference);
985
+ const ret = await check_unique(e, doc, table_obj, db);
986
986
  if (ret.code < 0) {
987
987
  throw ret;
988
988
  }
@@ -1018,7 +1018,7 @@ export const create = async (params, setup_doc, resolve, reject) => {
1018
1018
  return index_ret;
1019
1019
  }
1020
1020
  doc.udfIndex = index_ret.data;
1021
- const ret = await check_unique(e, doc, table_obj, db, app_id_reference);
1021
+ const ret = await check_unique(e, doc, table_obj, db);
1022
1022
  if (ret.code < 0) {
1023
1023
  return reject(ret.data);
1024
1024
  }
@@ -1034,27 +1034,27 @@ export const create = async (params, setup_doc, resolve, reject) => {
1034
1034
  }
1035
1035
  return await single();
1036
1036
  };
1037
- export const read = async (params, setup_doc, resolve, reject) => {
1037
+ export const read = async (params, resolve, reject) => {
1038
1038
  const e = params.e;
1039
1039
  const db = params.db;
1040
- const app_id_reference = params.app_id_reference;
1040
+
1041
1041
  const table_obj = params.table_obj;
1042
1042
 
1043
- const ret = await query_db(e, db, app_id_reference, table_obj);
1043
+ const ret = await query_db(e, db, table_obj);
1044
1044
  if (ret.code < 0) {
1045
1045
  return reject(ret.data);
1046
1046
  }
1047
1047
 
1048
1048
  return resolve(ret.data);
1049
1049
  };
1050
- export const update = async (params, setup_doc, resolve, reject) => {
1050
+ export const update = async (params, resolve, reject) => {
1051
1051
  const e = params.e;
1052
1052
  const db = params.db;
1053
- const app_id_reference = params.app_id_reference;
1053
+
1054
1054
  const table_obj = params.table_obj;
1055
1055
  try {
1056
1056
  if (e.row_id === "newRecord") {
1057
- return this.create(params, setup_doc, resolve, reject);
1057
+ return this.create(params, resolve, reject);
1058
1058
  }
1059
1059
  var doc = await db.get(e.row_id, {});
1060
1060
  // let data = doc.udfData.data;
@@ -1114,7 +1114,7 @@ export const update = async (params, setup_doc, resolve, reject) => {
1114
1114
  return index_ret;
1115
1115
  }
1116
1116
  doc.udfIndex = index_ret.data;
1117
- const ret = await check_unique(e, doc, table_obj, db, app_id_reference);
1117
+ const ret = await check_unique(e, doc, table_obj, db);
1118
1118
  if (ret.code < 0) {
1119
1119
  return ret;
1120
1120
  }
@@ -1128,10 +1128,10 @@ export const update = async (params, setup_doc, resolve, reject) => {
1128
1128
  return reject(error);
1129
1129
  }
1130
1130
  };
1131
- export const del = async (params, setup_doc, resolve, reject) => {
1131
+ export const del = async (params, resolve, reject) => {
1132
1132
  const e = params.e;
1133
1133
  const db = params.db;
1134
- const app_id_reference = params.app_id_reference;
1134
+
1135
1135
  const table_obj = params.table_obj;
1136
1136
  const data = await db.fetch({ keys: e.ids });
1137
1137
  var docs_to_delete = [];
@@ -1161,11 +1161,9 @@ export const del = async (params, setup_doc, resolve, reject) => {
1161
1161
  }
1162
1162
  };
1163
1163
 
1164
- export const restore = async (params, setup_doc, resolve, reject) => {
1164
+ export const restore = async (params, resolve, reject) => {
1165
1165
  const e = params.e;
1166
1166
  const db = params.db;
1167
- const app_id_reference = params.app_id_reference;
1168
- const table_obj = params.table_obj;
1169
1167
  var docs_to_restore = [];
1170
1168
  const data = await db.fetch({ keys: e.ids });
1171
1169
 
@@ -1187,7 +1185,7 @@ export const restore = async (params, setup_doc, resolve, reject) => {
1187
1185
  }
1188
1186
  };
1189
1187
 
1190
- export const _design = async (params, setup_doc, resolve, reject) => {
1188
+ export const _design = async (params, resolve, reject) => {
1191
1189
  const db = params.db;
1192
1190
 
1193
1191
  const ddoc = {