@xuda.io/xuda-dbs-plugin-xuda 1.0.3 → 1.0.4

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 (3) hide show
  1. package/index.mjs +15 -0
  2. package/package.json +1 -1
  3. package/setup.mjs +1 -1
package/index.mjs CHANGED
@@ -1002,6 +1002,7 @@ export const Delete = async (e, db, table_obj) => {
1002
1002
  return { code: -110, data: error };
1003
1003
  }
1004
1004
  };
1005
+
1005
1006
  export const Restore = async (e, db, table_obj) => {
1006
1007
  var docs_to_restore = [];
1007
1008
  const data = await db.fetch({ keys: e.ids });
@@ -1023,3 +1024,17 @@ export const Restore = async (e, db, table_obj) => {
1023
1024
  return { code: -110, data: error };
1024
1025
  }
1025
1026
  };
1027
+
1028
+ export const test_connection = async (node_modules_path, setup_doc) => {
1029
+ try {
1030
+ if (!setup_doc.db_connection_string) throw "db_connection_string missing";
1031
+ const nano = require(node_modules_path + "/nano")(setup_doc);
1032
+ if (!nano) {
1033
+ return { code: -450, data: "connection error" };
1034
+ }
1035
+ await nano.get("_design");
1036
+ return { code: 450, data: nano };
1037
+ } catch (err) {
1038
+ return { code: -450, data: err };
1039
+ }
1040
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
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/setup.mjs CHANGED
@@ -3,7 +3,7 @@ export function tabs(doc) {
3
3
  accounts: {
4
4
  svg_icon:
5
5
  '<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-palette" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"/> <path d="M12 21a9 9 0 1 1 0 -18a9 8 0 0 1 9 8a4.5 4 0 0 1 -4.5 4h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25" /> <circle cx="7.5" cy="10.5" r=".5" fill="currentColor" /> <circle cx="12" cy="7.5" r=".5" fill="currentColor" /> <circle cx="16.5" cy="10.5" r=".5" fill="currentColor" /> </svg>',
6
- text: "Accounts",
6
+ text: "Connections",
7
7
  type: "multi",
8
8
 
9
9
  fields: {