@codebolt/codeboltjs 1.1.12 → 1.1.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.
- package/index.js +2 -0
- package/modules/state.d.ts +4 -0
- package/modules/state.js +22 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/modules/state.ts +22 -0
package/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const outputparsers_1 = __importDefault(require("./modules/outputparsers"));
|
|
|
20
20
|
const project_1 = __importDefault(require("./modules/project"));
|
|
21
21
|
const git_1 = __importDefault(require("./modules/git"));
|
|
22
22
|
const dbmemory_1 = __importDefault(require("./modules/dbmemory"));
|
|
23
|
+
const state_1 = __importDefault(require("./modules/state"));
|
|
23
24
|
const ws_1 = __importDefault(require("ws"));
|
|
24
25
|
/**
|
|
25
26
|
* @class Codebolt
|
|
@@ -48,6 +49,7 @@ class Codebolt {
|
|
|
48
49
|
this.outputparsers = outputparsers_1.default;
|
|
49
50
|
this.project = project_1.default;
|
|
50
51
|
this.dbmemory = dbmemory_1.default;
|
|
52
|
+
this.cbstate = state_1.default;
|
|
51
53
|
this.websocket = websocket_1.default.getWebsocket;
|
|
52
54
|
}
|
|
53
55
|
/**
|
package/modules/state.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const websocket_1 = __importDefault(require("./websocket"));
|
|
7
|
+
const cbstate = {
|
|
8
|
+
getApplicationState: async () => {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
11
|
+
"type": "getAppState",
|
|
12
|
+
}));
|
|
13
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
14
|
+
const response = JSON.parse(data);
|
|
15
|
+
if (response.type === "getAppStateResponse") {
|
|
16
|
+
resolve(response); // Resolve the Promise with the response data
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.default = cbstate;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import cboutputparsers from './modules/outputparsers';
|
|
|
15
15
|
import cbproject from './modules/project';
|
|
16
16
|
import git from './modules/git';
|
|
17
17
|
import dbmemory from './modules/dbmemory';
|
|
18
|
+
import cbstate from './modules/state'
|
|
18
19
|
import WebSocket from 'ws';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -87,6 +88,7 @@ class Codebolt {
|
|
|
87
88
|
outputparsers = cboutputparsers;
|
|
88
89
|
project = cbproject;
|
|
89
90
|
dbmemory = dbmemory;
|
|
91
|
+
cbstate=cbstate;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
// export default new Codebolt();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import cbws from './websocket';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const cbstate = {
|
|
5
|
+
getApplicationState: async (): Promise<any> => {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
8
|
+
"type": "getAppState",
|
|
9
|
+
|
|
10
|
+
}));
|
|
11
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
12
|
+
const response = JSON.parse(data);
|
|
13
|
+
if (response.type === "getAppStateResponse") {
|
|
14
|
+
resolve(response); // Resolve the Promise with the response data
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default cbstate;
|
|
22
|
+
|