@xuda.io/xuda-dbs-plugin-xuda 1.0.73 → 1.0.77

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 +8 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.73",
3
+ "version": "1.0.77",
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
@@ -1716,11 +1716,14 @@ exports.update = async (params, setup_doc, resolve, reject) => {
1716
1716
  const app_id_reference = params.app_id_reference;
1717
1717
  const table_obj = params.table_obj;
1718
1718
  try {
1719
+ if (e.row_id === "newRecord") {
1720
+ return this.create(params, setup_doc, resolve, reject);
1721
+ }
1719
1722
  var doc = await db.get(e.row_id, {});
1720
- let data = doc.udfData.data;
1723
+ // let data = doc.udfData.data;
1721
1724
  var error = undefined;
1722
- if (!e.field_id && !e.data) {
1723
- error = "Invalid field_id or data object to save";
1725
+ if (!e.field_id && !e.table_data) {
1726
+ error = "Invalid field_id or table_data object to save";
1724
1727
  return reject(error);
1725
1728
  }
1726
1729
  // single value save
@@ -1742,9 +1745,9 @@ exports.update = async (params, setup_doc, resolve, reject) => {
1742
1745
  );
1743
1746
  }
1744
1747
  // object value save
1745
- if (e.data) {
1748
+ if (e.table_data) {
1746
1749
  // data = {};
1747
- for await (const [key, val] of Object.entries(e.data)) {
1750
+ for await (const [key, val] of Object.entries(e.table_data)) {
1748
1751
  let _tableFieldsObj = find_item_by_key(
1749
1752
  table_obj.tableFields,
1750
1753
  "field_id",