@xuda.io/xuda-dbs-plugin-xuda 1.0.85 → 1.0.87

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/server.js +18 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
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
@@ -705,7 +705,7 @@ const query_db = async function (e, db, app_id_reference, table_obj) {
705
705
 
706
706
  try {
707
707
  try {
708
- console.log("opt", opt);
708
+ // console.log("opt", opt);
709
709
  const doc = await db.find(opt);
710
710
 
711
711
  if (doc?.warning?.includes("No matching index found")) {
@@ -926,6 +926,20 @@ exports.create = async (params, setup_doc, resolve, reject) => {
926
926
  const app_id_reference = params.app_id_reference;
927
927
  const table_obj = params.table_obj;
928
928
 
929
+ const create_data_obj = async function (table_data) {
930
+ var doc = {};
931
+ for await (const val of table_obj.tableFields) {
932
+ doc[val.data.field_id] = await get_cast_val(
933
+ "dbs_create",
934
+ val.data.field_id,
935
+ val.props.fieldType,
936
+ table_data[val.data.field_id]
937
+ );
938
+ }
939
+
940
+ return doc;
941
+ };
942
+
929
943
  const batch = async function () {
930
944
  var docs = [];
931
945
  try {
@@ -937,7 +951,7 @@ exports.create = async (params, setup_doc, resolve, reject) => {
937
951
  stat: 3,
938
952
  udfData: {
939
953
  udffileid: e.table_id,
940
- data: val,
954
+ data: await create_data_obj(val),
941
955
  error: {},
942
956
  },
943
957
 
@@ -972,7 +986,7 @@ exports.create = async (params, setup_doc, resolve, reject) => {
972
986
  stat: 3,
973
987
  udfData: {
974
988
  udffileid: e.table_id,
975
- data: e.table_data,
989
+ data: await create_data_obj(e.table_data),
976
990
  error: {},
977
991
  },
978
992
 
@@ -1047,6 +1061,7 @@ exports.update = async (params, setup_doc, resolve, reject) => {
1047
1061
  e.field_value
1048
1062
  );
1049
1063
  }
1064
+
1050
1065
  // object value save
1051
1066
  if (e.table_data) {
1052
1067
  // data = {};