@scriptdb/client 1.0.2 → 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 (2) hide show
  1. package/dist/index.js +42 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -164,6 +164,9 @@ class ScriptDBClient {
164
164
  });
165
165
  }
166
166
  }
167
+ get connected() {
168
+ return this._connected;
169
+ }
167
170
  connect() {
168
171
  if (this._connecting)
169
172
  return this._connecting;
@@ -686,6 +689,45 @@ class ScriptDBClient {
686
689
  } catch (e) {}
687
690
  this.client = null;
688
691
  }
692
+ disconnect() {
693
+ this.close();
694
+ }
695
+ async sendRequest(action, data = {}) {
696
+ return this.execute({ action, data });
697
+ }
698
+ async login(username, password) {
699
+ return this.sendRequest("login", { username, password });
700
+ }
701
+ async logout() {
702
+ return this.sendRequest("logout", {});
703
+ }
704
+ async listDatabases() {
705
+ return this.sendRequest("list-dbs", {});
706
+ }
707
+ async createDatabase(name) {
708
+ return this.sendRequest("create-db", { databaseName: name });
709
+ }
710
+ async removeDatabase(name) {
711
+ return this.sendRequest("remove-db", { databaseName: name });
712
+ }
713
+ async renameDatabase(oldName, newName) {
714
+ return this.sendRequest("rename-db", { databaseName: oldName, newName });
715
+ }
716
+ async run(code, databaseName) {
717
+ return this.sendRequest("script-code", { code, databaseName });
718
+ }
719
+ async saveDatabase(databaseName) {
720
+ return this.sendRequest("save-db", { databaseName });
721
+ }
722
+ async updateDatabase(databaseName, data) {
723
+ return this.sendRequest("update-db", { databaseName, ...data });
724
+ }
725
+ async getInfo() {
726
+ return this.sendRequest("get-info", {});
727
+ }
728
+ async executeShell(command) {
729
+ return this.sendRequest("shell-command", { command });
730
+ }
689
731
  }
690
732
  var src_default = ScriptDBClient;
691
733
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scriptdb/client",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Client module resolver for script database",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",