@xuda.io/xuda-dbs-plugin-xuda 1.0.11 → 1.0.13

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/index.mjs +18 -15
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -154,7 +154,7 @@ const get_index_json = async function (docInP, table_obj) {
154
154
  }
155
155
  };
156
156
 
157
- export const Create = async (e, db, table_obj) => {
157
+ export const Create = async (_, e, db, table_obj) => {
158
158
  const batch = async function () {
159
159
  var docs = [];
160
160
  try {
@@ -229,7 +229,7 @@ export const Create = async (e, db, table_obj) => {
229
229
  }
230
230
  return await single();
231
231
  };
232
- export const Read = async (e, db, table_obj) => {
232
+ export const Read = async (_, e, db, table_obj) => {
233
233
  var key;
234
234
 
235
235
  const runtime_get_mango_data = async function () {
@@ -509,11 +509,13 @@ export const Read = async (e, db, table_obj) => {
509
509
 
510
510
  if (e.sort_fields && JSON.parse(e.sort_fields).length) {
511
511
  opt.sort = JSON.parse(e.sort_fields);
512
- for await (const [key, val] of Object.entries(opt.sort)) {
513
- var field_name = val.colId;
514
- opt.sort[key] = {
515
- ["udfData.data." + field_name]: val.sort,
516
- };
512
+ if (opt.sort) {
513
+ for await (const [key, val] of Object.entries(opt.sort)) {
514
+ var field_name = val.colId;
515
+ opt.sort[key] = {
516
+ ["udfData.data." + field_name]: val.sort,
517
+ };
518
+ }
517
519
  }
518
520
  }
519
521
 
@@ -721,11 +723,12 @@ export const Read = async (e, db, table_obj) => {
721
723
  }
722
724
  if (!e.sort_fields || !JSON.parse(e.sort_fields).length) {
723
725
  // added 2021 09 10
724
-
725
- for await (const [key, val] of Object.entries(opt.sort)) {
726
- opt.sort[key] = {
727
- ["udfData.data." + val]: e.sortOrder === "des" ? "desc" : "asc",
728
- };
726
+ if (opt.sort) {
727
+ for await (const [key, val] of Object.entries(opt.sort)) {
728
+ opt.sort[key] = {
729
+ ["udfData.data." + val]: e.sortOrder === "des" ? "desc" : "asc",
730
+ };
731
+ }
729
732
  }
730
733
  }
731
734
 
@@ -925,7 +928,7 @@ export const Read = async (e, db, table_obj) => {
925
928
  }
926
929
  return await runtime_get_mango_data();
927
930
  };
928
- export const Update = async (e, db, table_obj) => {
931
+ export const Update = async (_, e, db, table_obj) => {
929
932
  try {
930
933
  const doc = await db.get(e.row_id, {});
931
934
  let data = doc.udfData.data;
@@ -976,7 +979,7 @@ export const Update = async (e, db, table_obj) => {
976
979
  return { code: -550, data: error };
977
980
  }
978
981
  };
979
- export const Delete = async (e, db, table_obj) => {
982
+ export const Delete = async (_, e, db, table_obj) => {
980
983
  const data = await db.fetch({ keys: e.ids });
981
984
  for await (var val of data.rows) {
982
985
  var doc = val.doc;
@@ -1003,7 +1006,7 @@ export const Delete = async (e, db, table_obj) => {
1003
1006
  }
1004
1007
  };
1005
1008
 
1006
- export const Restore = async (e, db, table_obj) => {
1009
+ export const Restore = async (_, e, db, table_obj) => {
1007
1010
  var docs_to_restore = [];
1008
1011
  const data = await db.fetch({ keys: e.ids });
1009
1012
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
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"