@xuda.io/xuda-dbs-plugin-xuda 1.0.70 → 1.0.72

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 +13 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
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
@@ -1009,10 +1009,20 @@ exports.create = async (params, setup_doc, resolve, reject) => {
1009
1009
  return reject(error);
1010
1010
  }
1011
1011
  };
1012
+ var ret;
1012
1013
  if (Array.isArray(e.table_data)) {
1013
- return await batch();
1014
+ ret = await batch();
1015
+ if (ret.code < 0) {
1016
+ return reject(ret.data);
1017
+ }
1018
+ return resolve(ret.data);
1019
+ }
1020
+
1021
+ ret = await single();
1022
+ if (ret.code < 0) {
1023
+ return reject(ret.data);
1014
1024
  }
1015
- return await single();
1025
+ resolve(ret.data);
1016
1026
  };
1017
1027
  exports.read = async (params, setup_doc, resolve, reject) => {
1018
1028
  const e = params.e;
@@ -1857,6 +1867,6 @@ exports.test_connection = async (params, setup_doc, resolve, reject) => {
1857
1867
  await nano.get("_design/xuda");
1858
1868
  resolve(nano);
1859
1869
  } catch (err) {
1860
- return reject(err.message);
1870
+ return reject(err.message || err);
1861
1871
  }
1862
1872
  };