verteilen-core 1.4.21 → 1.4.22
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/dist/client/analysis.d.ts +0 -17
- package/dist/client/analysis.js +0 -22
- package/dist/client/client.d.ts +0 -17
- package/dist/client/client.js +4 -34
- package/dist/client/cluster.d.ts +0 -3
- package/dist/client/cluster.js +0 -32
- package/dist/client/database.d.ts +0 -16
- package/dist/client/database.js +0 -16
- package/dist/client/execute.d.ts +0 -33
- package/dist/client/execute.js +0 -38
- package/dist/client/javascript.d.ts +0 -23
- package/dist/client/javascript.js +0 -34
- package/dist/client/job_database.d.ts +0 -4
- package/dist/client/job_database.js +0 -4
- package/dist/client/job_execute.d.ts +0 -28
- package/dist/client/job_execute.js +0 -29
- package/dist/client/os.d.ts +0 -26
- package/dist/client/os.js +0 -32
- package/dist/client/resource.d.ts +0 -3
- package/dist/client/resource.js +0 -8
- package/dist/client/shell.d.ts +0 -16
- package/dist/client/shell.js +0 -21
- package/dist/computed.d.ts +0 -13
- package/dist/computed.js +32 -29
- package/dist/index.js +0 -4
- package/dist/interface/base.d.ts +0 -261
- package/dist/interface/base.js +0 -8
- package/dist/interface/bus.d.ts +0 -73
- package/dist/interface/enum.d.ts +0 -67
- package/dist/interface/enum.js +0 -74
- package/dist/interface/execute.d.ts +0 -46
- package/dist/interface/log.d.ts +0 -54
- package/dist/interface/plugin.d.ts +0 -192
- package/dist/interface/record.d.ts +0 -13
- package/dist/interface/server.d.ts +0 -20
- package/dist/interface/server.js +0 -8
- package/dist/interface/struct.d.ts +1 -140
- package/dist/interface/table.d.ts +0 -39
- package/dist/interface/ui.d.ts +0 -104
- package/dist/interface/ui.js +0 -8
- package/dist/interface.d.ts +0 -30
- package/dist/interface.js +18 -44
- package/dist/plugins/i18n.d.ts +0 -19
- package/dist/plugins/i18n.js +0 -24
- package/dist/script/console_manager.d.ts +0 -3
- package/dist/script/console_manager.js +0 -3
- package/dist/script/console_server_manager.d.ts +0 -3
- package/dist/script/console_server_manager.js +0 -3
- package/dist/script/execute/base.d.ts +2 -98
- package/dist/script/execute/base.js +0 -105
- package/dist/script/execute/feedback.d.ts +0 -34
- package/dist/script/execute/feedback.js +0 -46
- package/dist/script/execute/region_job.js +0 -6
- package/dist/script/execute/region_project.js +0 -17
- package/dist/script/execute/region_subtask.js +0 -5
- package/dist/script/execute/region_task.d.ts +5 -41
- package/dist/script/execute/region_task.js +0 -75
- package/dist/script/execute/runner.d.ts +0 -7
- package/dist/script/execute/runner.js +0 -15
- package/dist/script/execute/util_parser.d.ts +0 -41
- package/dist/script/execute/util_parser.js +1 -47
- package/dist/script/execute_manager.d.ts +0 -38
- package/dist/script/execute_manager.js +0 -54
- package/dist/script/socket_manager.d.ts +0 -79
- package/dist/script/socket_manager.js +0 -84
- package/dist/script/webhook_server_manager.js +1 -1
- package/dist/server/detail/console_handle.d.ts +0 -13
- package/dist/server/detail/console_handle.js +0 -14
- package/dist/server/detail/log_handle.d.ts +0 -5
- package/dist/server/detail/log_handle.js +0 -5
- package/dist/server/detail.d.ts +4 -32
- package/dist/server/detail.js +0 -43
- package/dist/server/io.d.ts +0 -21
- package/dist/server/io.js +0 -18
- package/dist/server/io2.d.ts +0 -19
- package/dist/server/io2.js +0 -54
- package/dist/server/module/account.d.ts +0 -6
- package/dist/server/module/account.js +0 -11
- package/dist/server/module/project.d.ts +1 -50
- package/dist/server/module/project.js +0 -49
- package/dist/server/plugin.d.ts +0 -51
- package/dist/server/plugin.js +0 -13
- package/dist/server/server.d.ts +0 -21
- package/dist/server/server.js +0 -10
- package/dist/server/server2.d.ts +0 -4
- package/dist/server/server2.js +0 -9
- package/dist/server.d.ts +0 -3
- package/dist/server.js +0 -3
- package/jest.config.js +11 -0
- package/package.json +3 -2
- package/src/client/client.ts +1 -1
- package/src/computed.ts +1 -5
- package/src/interface/struct.ts +1 -1
- package/src/script/webhook_server_manager.ts +1 -1
- package/test/call/print.ts +1 -1
- package/tsconfig.json +4 -4
- package/dist/util/port.d.ts +0 -1
- package/dist/util/port.js +0 -15
- package/jest.config.ts +0 -12
- package/src/util/port.ts +0 -15
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Node, NodeProxy, NodeTable, WebsocketPack } from "../interface";
|
|
2
2
|
import * as ws from 'ws';
|
|
3
|
-
/**
|
|
4
|
-
* The node connection instance manager, Use by the cluster server
|
|
5
|
-
*/
|
|
6
3
|
export declare class WebsocketManager {
|
|
7
4
|
targets: Array<WebsocketPack>;
|
|
8
5
|
newConnect: Function;
|
|
@@ -11,100 +8,24 @@ export declare class WebsocketManager {
|
|
|
11
8
|
proxy: NodeProxy;
|
|
12
9
|
private messager_log;
|
|
13
10
|
constructor(_newConnect: Function, _disconnect: Function, _onAnalysis: Function, _messager_log: Function, _proxy: NodeProxy);
|
|
14
|
-
/**
|
|
15
|
-
* Trying to connect a node by target URL
|
|
16
|
-
* @param url target url
|
|
17
|
-
* @returns The connection package
|
|
18
|
-
*/
|
|
19
11
|
server_start: (url: string, id: string) => WebSocket | ws.WebSocket | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Remove the package by UUID
|
|
22
|
-
* @param uuid Key
|
|
23
|
-
* @param reason Reason for disconnect
|
|
24
|
-
*/
|
|
25
12
|
server_stop: (uuid: string, reason?: string) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Manager update, it will does things below
|
|
28
|
-
* * Retry connection
|
|
29
|
-
* @returns Node table for display
|
|
30
|
-
*/
|
|
31
13
|
server_update: () => Array<NodeTable>;
|
|
32
14
|
server_record: (ns: Array<Node>) => void;
|
|
33
15
|
shell_open: (uuid: string) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Open shell connection with target node
|
|
36
|
-
* @param uuid node UUID
|
|
37
|
-
* @param text input data
|
|
38
|
-
*/
|
|
39
16
|
shell_enter: (uuid: string, text: string) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Close shell connection with target node
|
|
42
|
-
* @param uuid Node UUID
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
17
|
shell_close: (uuid: string) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Check folder structure with target node
|
|
48
|
-
* @param uuid Node UUID
|
|
49
|
-
* @param path the folder path to check
|
|
50
|
-
*/
|
|
51
18
|
shell_folder: (uuid: string, path: string) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Trying to connect a node by target URL
|
|
54
|
-
* @param Node target url
|
|
55
|
-
* @param uuid generate UUID, New or retry connect base on value is defined or not
|
|
56
|
-
* @returns The connection package
|
|
57
|
-
*/
|
|
58
19
|
private serverconnect;
|
|
59
|
-
/**
|
|
60
|
-
* The analysis method for the node connection instance
|
|
61
|
-
* @param h Package
|
|
62
|
-
* @param c Connection instance
|
|
63
|
-
*/
|
|
64
20
|
private analysis;
|
|
65
21
|
private socket_analysis;
|
|
66
|
-
/**
|
|
67
|
-
* Manager update, it will does things below
|
|
68
|
-
* * Retry connection
|
|
69
|
-
* @returns Node table for display
|
|
70
|
-
*/
|
|
71
22
|
private sendUpdate;
|
|
72
|
-
/**
|
|
73
|
-
* Remove the package by UUID
|
|
74
|
-
* @param uuid Key
|
|
75
|
-
* @param reason Reason for disconnect
|
|
76
|
-
*/
|
|
77
23
|
private removeByUUID;
|
|
78
|
-
/**
|
|
79
|
-
* Internal update, for checking the ping of every nodes
|
|
80
|
-
*/
|
|
81
24
|
private update;
|
|
82
|
-
/**
|
|
83
|
-
* Recevied the shell text from client node
|
|
84
|
-
*/
|
|
85
25
|
private shell_reply;
|
|
86
|
-
/**
|
|
87
|
-
* Recevied the folders from client node
|
|
88
|
-
*/
|
|
89
26
|
private shell_folder_reply;
|
|
90
|
-
/**
|
|
91
|
-
* Get the system information and assign to the node object
|
|
92
|
-
* @param info Data
|
|
93
|
-
* @param source The node target
|
|
94
|
-
*/
|
|
95
27
|
private system_info;
|
|
96
|
-
/**
|
|
97
|
-
* Get the node information and assign to the node object
|
|
98
|
-
* @param info Data
|
|
99
|
-
* @param source The node target
|
|
100
|
-
*/
|
|
101
28
|
private node_info;
|
|
102
|
-
/**
|
|
103
|
-
* Get the bouncing back function call\
|
|
104
|
-
* THis method will calculate the time different and assign the node object
|
|
105
|
-
* @param info Dummy number, nothing important, can be ignore
|
|
106
|
-
* @param source The node target
|
|
107
|
-
*/
|
|
108
29
|
private pong;
|
|
109
30
|
private plugin_info_reply;
|
|
110
31
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { v6 as uuidv6 } from 'uuid';
|
|
7
2
|
import { SocketState } from "../interface";
|
|
8
3
|
import * as jsEnv from "browser-or-node";
|
|
9
4
|
import * as ws from 'ws';
|
|
10
5
|
import * as https from 'https';
|
|
11
|
-
/**
|
|
12
|
-
* The node connection instance manager, Use by the cluster server
|
|
13
|
-
*/
|
|
14
6
|
export class WebsocketManager {
|
|
15
7
|
targets = [];
|
|
16
8
|
newConnect;
|
|
@@ -26,23 +18,8 @@ export class WebsocketManager {
|
|
|
26
18
|
this.proxy = _proxy;
|
|
27
19
|
setInterval(this.update, 1000);
|
|
28
20
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Trying to connect a node by target URL
|
|
31
|
-
* @param url target url
|
|
32
|
-
* @returns The connection package
|
|
33
|
-
*/
|
|
34
21
|
server_start = (url, id) => this.serverconnect(url, id);
|
|
35
|
-
/**
|
|
36
|
-
* Remove the package by UUID
|
|
37
|
-
* @param uuid Key
|
|
38
|
-
* @param reason Reason for disconnect
|
|
39
|
-
*/
|
|
40
22
|
server_stop = (uuid, reason) => this.removeByUUID(uuid, reason);
|
|
41
|
-
/**
|
|
42
|
-
* Manager update, it will does things below
|
|
43
|
-
* * Retry connection
|
|
44
|
-
* @returns Node table for display
|
|
45
|
-
*/
|
|
46
23
|
server_update = () => this.sendUpdate();
|
|
47
24
|
server_record = (ns) => {
|
|
48
25
|
ns.forEach(x => {
|
|
@@ -61,11 +38,6 @@ export class WebsocketManager {
|
|
|
61
38
|
};
|
|
62
39
|
p.websocket.send(JSON.stringify(d));
|
|
63
40
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Open shell connection with target node
|
|
66
|
-
* @param uuid node UUID
|
|
67
|
-
* @param text input data
|
|
68
|
-
*/
|
|
69
41
|
shell_enter = (uuid, text) => {
|
|
70
42
|
const p = this.targets.find(x => x.uuid == uuid && x.websocket.readyState == SocketState.OPEN);
|
|
71
43
|
if (p == undefined) {
|
|
@@ -78,11 +50,6 @@ export class WebsocketManager {
|
|
|
78
50
|
};
|
|
79
51
|
p.websocket.send(JSON.stringify(d));
|
|
80
52
|
};
|
|
81
|
-
/**
|
|
82
|
-
* Close shell connection with target node
|
|
83
|
-
* @param uuid Node UUID
|
|
84
|
-
* @returns
|
|
85
|
-
*/
|
|
86
53
|
shell_close = (uuid) => {
|
|
87
54
|
const p = this.targets.find(x => x.uuid == uuid && x.websocket.readyState == SocketState.OPEN);
|
|
88
55
|
if (p == undefined) {
|
|
@@ -95,11 +62,6 @@ export class WebsocketManager {
|
|
|
95
62
|
};
|
|
96
63
|
p.websocket.send(JSON.stringify(d));
|
|
97
64
|
};
|
|
98
|
-
/**
|
|
99
|
-
* Check folder structure with target node
|
|
100
|
-
* @param uuid Node UUID
|
|
101
|
-
* @param path the folder path to check
|
|
102
|
-
*/
|
|
103
65
|
shell_folder = (uuid, path) => {
|
|
104
66
|
const p = this.targets.find(x => x.uuid == uuid && x.websocket.readyState == SocketState.OPEN);
|
|
105
67
|
if (p == undefined) {
|
|
@@ -112,12 +74,6 @@ export class WebsocketManager {
|
|
|
112
74
|
};
|
|
113
75
|
p.websocket.send(JSON.stringify(d));
|
|
114
76
|
};
|
|
115
|
-
/**
|
|
116
|
-
* Trying to connect a node by target URL
|
|
117
|
-
* @param Node target url
|
|
118
|
-
* @param uuid generate UUID, New or retry connect base on value is defined or not
|
|
119
|
-
* @returns The connection package
|
|
120
|
-
*/
|
|
121
77
|
serverconnect = (url, uuid) => {
|
|
122
78
|
if (this.targets.findIndex(x => x.websocket.url.slice(0, -1) == url) != -1)
|
|
123
79
|
return;
|
|
@@ -156,11 +112,6 @@ export class WebsocketManager {
|
|
|
156
112
|
};
|
|
157
113
|
return client;
|
|
158
114
|
};
|
|
159
|
-
/**
|
|
160
|
-
* The analysis method for the node connection instance
|
|
161
|
-
* @param h Package
|
|
162
|
-
* @param c Connection instance
|
|
163
|
-
*/
|
|
164
115
|
analysis = (h, c) => {
|
|
165
116
|
if (h == undefined) {
|
|
166
117
|
this.messager_log('[Source Analysis] Decode failed, Get value undefined');
|
|
@@ -194,11 +145,6 @@ export class WebsocketManager {
|
|
|
194
145
|
return false;
|
|
195
146
|
}
|
|
196
147
|
};
|
|
197
|
-
/**
|
|
198
|
-
* Manager update, it will does things below
|
|
199
|
-
* * Retry connection
|
|
200
|
-
* @returns Node table for display
|
|
201
|
-
*/
|
|
202
148
|
sendUpdate = () => {
|
|
203
149
|
let result = [];
|
|
204
150
|
const data = [];
|
|
@@ -225,11 +171,6 @@ export class WebsocketManager {
|
|
|
225
171
|
});
|
|
226
172
|
return result;
|
|
227
173
|
};
|
|
228
|
-
/**
|
|
229
|
-
* Remove the package by UUID
|
|
230
|
-
* @param uuid Key
|
|
231
|
-
* @param reason Reason for disconnect
|
|
232
|
-
*/
|
|
233
174
|
removeByUUID = (uuid, reason) => {
|
|
234
175
|
let index = this.targets.findIndex(x => x.uuid == uuid);
|
|
235
176
|
if (index != -1) {
|
|
@@ -238,9 +179,6 @@ export class WebsocketManager {
|
|
|
238
179
|
this.targets.splice(index, 1);
|
|
239
180
|
}
|
|
240
181
|
};
|
|
241
|
-
/**
|
|
242
|
-
* Internal update, for checking the ping of every nodes
|
|
243
|
-
*/
|
|
244
182
|
update = () => {
|
|
245
183
|
const h = { name: 'ping', data: 0 };
|
|
246
184
|
this.targets.forEach(x => {
|
|
@@ -250,44 +188,22 @@ export class WebsocketManager {
|
|
|
250
188
|
x.websocket.send(JSON.stringify(h));
|
|
251
189
|
});
|
|
252
190
|
};
|
|
253
|
-
/**
|
|
254
|
-
* Recevied the shell text from client node
|
|
255
|
-
*/
|
|
256
191
|
shell_reply = (data, w) => {
|
|
257
192
|
this.proxy?.shellReply(data, w);
|
|
258
193
|
};
|
|
259
|
-
/**
|
|
260
|
-
* Recevied the folders from client node
|
|
261
|
-
*/
|
|
262
194
|
shell_folder_reply = (data, w) => {
|
|
263
195
|
this.proxy?.folderReply(data, w);
|
|
264
196
|
};
|
|
265
|
-
/**
|
|
266
|
-
* Get the system information and assign to the node object
|
|
267
|
-
* @param info Data
|
|
268
|
-
* @param source The node target
|
|
269
|
-
*/
|
|
270
197
|
system_info = (info, source) => {
|
|
271
198
|
if (source == undefined)
|
|
272
199
|
return;
|
|
273
200
|
source.information = info;
|
|
274
201
|
};
|
|
275
|
-
/**
|
|
276
|
-
* Get the node information and assign to the node object
|
|
277
|
-
* @param info Data
|
|
278
|
-
* @param source The node target
|
|
279
|
-
*/
|
|
280
202
|
node_info = (info, source) => {
|
|
281
203
|
if (source == undefined)
|
|
282
204
|
return;
|
|
283
205
|
source.load = info;
|
|
284
206
|
};
|
|
285
|
-
/**
|
|
286
|
-
* Get the bouncing back function call\
|
|
287
|
-
* THis method will calculate the time different and assign the node object
|
|
288
|
-
* @param info Dummy number, nothing important, can be ignore
|
|
289
|
-
* @param source The node target
|
|
290
|
-
*/
|
|
291
207
|
pong = (info, source) => {
|
|
292
208
|
if (source == undefined || source.last == undefined)
|
|
293
209
|
return;
|
|
@@ -34,7 +34,7 @@ export class WebhookServerManager {
|
|
|
34
34
|
res.end('HTTPS server is running');
|
|
35
35
|
});
|
|
36
36
|
this.httpss.addListener('upgrade', (req, res, head) => console.log('UPGRADE:', req.url));
|
|
37
|
-
this.server = new ws.
|
|
37
|
+
this.server = new ws.WebSocketServer({ server: this.httpss });
|
|
38
38
|
this.server.on('listening', () => {
|
|
39
39
|
this.messager_log('[Server] Listen PORT: ' + port_result.toString());
|
|
40
40
|
});
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { ExecutePair, ExecuteProxy, ExecuteState, FeedBack, Job, Database, Project, Record, Task } from "../../interface";
|
|
2
|
-
/**
|
|
3
|
-
* The method to handle the init package {@link ExecutePair} process
|
|
4
|
-
*/
|
|
5
2
|
export declare const receivedPack: (model: ExecutePair, record: Record) => boolean;
|
|
6
|
-
/**
|
|
7
|
-
* **Console Proxy Worker**\
|
|
8
|
-
* Process thread call proxy and throght {@link Console_Proxy.execute_proxy}\
|
|
9
|
-
* To communicate with outside record data
|
|
10
|
-
*/
|
|
11
3
|
export declare class Console_Proxy {
|
|
12
4
|
model: ExecutePair;
|
|
13
5
|
constructor(_model: ExecutePair);
|
|
@@ -22,10 +14,5 @@ export declare class Console_Proxy {
|
|
|
22
14
|
execute_job_start: (d: [Job, number, string]) => void;
|
|
23
15
|
execute_job_finish: (d: [Job, number, string, number]) => void;
|
|
24
16
|
feedback_message: (d: FeedBack) => void;
|
|
25
|
-
/**
|
|
26
|
-
* When database getting change by the process steps\
|
|
27
|
-
* This get called
|
|
28
|
-
* @param d The whole container for the databases
|
|
29
|
-
*/
|
|
30
17
|
update_runtime_database: (d: Database) => void;
|
|
31
18
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { ConditionResult, ExecuteState, JobCategory, MESSAGE_LIMIT } from "../../interface";
|
|
2
|
-
/**
|
|
3
|
-
* The method to handle the init package {@link ExecutePair} process
|
|
4
|
-
*/
|
|
5
2
|
export const receivedPack = (model, record) => {
|
|
6
3
|
const pass = model.manager.Register();
|
|
7
4
|
if (pass == -1) {
|
|
@@ -41,11 +38,6 @@ export const receivedPack = (model, record) => {
|
|
|
41
38
|
model.manager.Update();
|
|
42
39
|
return true;
|
|
43
40
|
};
|
|
44
|
-
/**
|
|
45
|
-
* **Console Proxy Worker**\
|
|
46
|
-
* Process thread call proxy and throght {@link Console_Proxy.execute_proxy}\
|
|
47
|
-
* To communicate with outside record data
|
|
48
|
-
*/
|
|
49
41
|
export class Console_Proxy {
|
|
50
42
|
model;
|
|
51
43
|
constructor(_model) {
|
|
@@ -227,7 +219,6 @@ export class Console_Proxy {
|
|
|
227
219
|
}, 1000);
|
|
228
220
|
}
|
|
229
221
|
}
|
|
230
|
-
//model.value![1].task_detail[index].node = ""
|
|
231
222
|
};
|
|
232
223
|
feedback_message = (d) => {
|
|
233
224
|
if (d.index == undefined || d.index == -1)
|
|
@@ -240,11 +231,6 @@ export class Console_Proxy {
|
|
|
240
231
|
}
|
|
241
232
|
}
|
|
242
233
|
};
|
|
243
|
-
/**
|
|
244
|
-
* When database getting change by the process steps\
|
|
245
|
-
* This get called
|
|
246
|
-
* @param d The whole container for the databases
|
|
247
|
-
*/
|
|
248
234
|
update_runtime_database = (d) => {
|
|
249
235
|
this.model.record.para = d;
|
|
250
236
|
};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { ExecutePair, ExecuteProxy, ExecuteState, FeedBack, Job, Log, Database, Preference, Project, Task } from "../../interface";
|
|
2
|
-
/**
|
|
3
|
-
* **Log Proxy Worker**\
|
|
4
|
-
* Process thread call proxy and throght {@link Log_Proxy.execute_proxy}\
|
|
5
|
-
* To communicate with outside record data
|
|
6
|
-
*/
|
|
7
2
|
export declare class Log_Proxy {
|
|
8
3
|
model: ExecutePair;
|
|
9
4
|
logs: Log;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { v6 as uuid6 } from 'uuid';
|
|
2
2
|
import { ConditionResult, ExecuteState, JobCategory } from "../../interface";
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
/**
|
|
5
|
-
* **Log Proxy Worker**\
|
|
6
|
-
* Process thread call proxy and throght {@link Log_Proxy.execute_proxy}\
|
|
7
|
-
* To communicate with outside record data
|
|
8
|
-
*/
|
|
9
4
|
export class Log_Proxy {
|
|
10
5
|
model;
|
|
11
6
|
logs;
|
package/dist/server/detail.d.ts
CHANGED
|
@@ -2,11 +2,6 @@ import { BusAnalysis, ExecutePair, ExecuteProxy, ExecuteRecord, ExecuteState, Me
|
|
|
2
2
|
import { PluginFeedback } from "./server";
|
|
3
3
|
import { MemoryData, RecordIOBase } from './io';
|
|
4
4
|
import { WebsocketManager } from '../script/socket_manager';
|
|
5
|
-
/**
|
|
6
|
-
* **Backend Interface**\
|
|
7
|
-
* The backend object must contain some utility functions\
|
|
8
|
-
* In order to make detail worker works
|
|
9
|
-
*/
|
|
10
5
|
export interface BackendAction {
|
|
11
6
|
memory: MemoryData;
|
|
12
7
|
GetPreference: (uuid?: string) => Preference;
|
|
@@ -34,10 +29,6 @@ export interface ServerDetailEvent {
|
|
|
34
29
|
console_add: (socket: any, name: string, record: Record, uuid: string | undefined) => void;
|
|
35
30
|
console_update: (socket: any) => void;
|
|
36
31
|
}
|
|
37
|
-
/**
|
|
38
|
-
* **Server Inner-Work Handler**\
|
|
39
|
-
* Include the core cluster logic here
|
|
40
|
-
*/
|
|
41
32
|
export declare class ServerDetail {
|
|
42
33
|
execute_manager: Array<ExecutePair>;
|
|
43
34
|
websocket_manager: WebsocketManager | undefined;
|
|
@@ -48,32 +39,13 @@ export declare class ServerDetail {
|
|
|
48
39
|
message: Messager;
|
|
49
40
|
messager_log: Function;
|
|
50
41
|
updatehandle: any;
|
|
51
|
-
/**
|
|
52
|
-
* **A simple message queue**\
|
|
53
|
-
* message, trace message, error message return data, for update
|
|
54
|
-
*/
|
|
55
42
|
re: Array<any>;
|
|
56
43
|
constructor(loader: RecordIOBase | undefined, backend: BackendAction, feedback: PluginFeedback, message: Messager, messager_log: Function);
|
|
57
|
-
/**
|
|
58
|
-
* ** Caller Reference**
|
|
59
|
-
*/
|
|
60
44
|
get events(): ServerDetailEvent;
|
|
61
45
|
NewConnection: (x: WebsocketPack) => void;
|
|
62
46
|
DisConnection: (x: WebsocketPack) => void;
|
|
63
47
|
Analysis: (d: BusAnalysis) => void;
|
|
64
|
-
/**
|
|
65
|
-
* **Shell Reply Message Event**\
|
|
66
|
-
* Called by the client node
|
|
67
|
-
* @param data Content
|
|
68
|
-
* @param p Client node source
|
|
69
|
-
*/
|
|
70
48
|
shellReply: (data: Single, p?: WebsocketPack) => void;
|
|
71
|
-
/**
|
|
72
|
-
* **Shell Folder Location Event**\
|
|
73
|
-
* Called by the client node
|
|
74
|
-
* @param data Content
|
|
75
|
-
* @param p Client node source
|
|
76
|
-
*/
|
|
77
49
|
folderReply: (data: ShellFolder, p?: WebsocketPack) => void;
|
|
78
50
|
resource_start: (socket: any, uuid: string) => void;
|
|
79
51
|
resource_end: (socket: any, uuid: string) => void;
|
|
@@ -82,15 +54,15 @@ export declare class ServerDetail {
|
|
|
82
54
|
shell_open: (socket: any, uuid: string) => void;
|
|
83
55
|
shell_close: (socket: any, uuid: string) => void;
|
|
84
56
|
shell_folder: (socket: any, uuid: string, path: string) => void;
|
|
85
|
-
node_list: (socket: any) =>
|
|
57
|
+
node_list: (socket: any) => WebsocketPack[] | undefined;
|
|
86
58
|
node_add: (socket: any, url: string, id: string) => void;
|
|
87
|
-
node_update: (socket: any) =>
|
|
59
|
+
node_update: (socket: any) => import("..").NodeTable[] | undefined;
|
|
88
60
|
node_delete: (socket: any, uuid: string, reason?: string) => void;
|
|
89
|
-
console_list: (socket: any) =>
|
|
61
|
+
console_list: (socket: any) => ExecuteRecord[] | undefined;
|
|
90
62
|
console_record: (socket: any, uuid: string) => string;
|
|
91
63
|
console_execute: (socket: any, uuid: string, type: number) => void;
|
|
92
64
|
console_stop: (socket: any, uuid: string) => void;
|
|
93
|
-
console_add: (socket: any, name: string, record: Record, uuid: string | undefined) =>
|
|
65
|
+
console_add: (socket: any, name: string, record: Record, uuid: string | undefined) => ExecuteRecord | undefined;
|
|
94
66
|
console_update_call: () => void;
|
|
95
67
|
console_clean: (socket: any, uuid: string) => void;
|
|
96
68
|
console_skip: (socket: any, uuid: string, forward: boolean, type: number, state?: ExecuteState) => void;
|
package/dist/server/detail.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { v6 as uuidv6 } from 'uuid';
|
|
7
2
|
import { ExecuteState, RENDER_UPDATETICK } from "../interface";
|
|
8
3
|
import { receivedPack, Console_Proxy } from './detail/console_handle';
|
|
9
4
|
import { Log_Proxy } from './detail/log_handle';
|
|
10
5
|
import { ExecuteManager } from '../script/execute_manager';
|
|
11
6
|
import { WebsocketManager } from '../script/socket_manager';
|
|
12
|
-
/**
|
|
13
|
-
* **Server Inner-Work Handler**\
|
|
14
|
-
* Include the core cluster logic here
|
|
15
|
-
*/
|
|
16
7
|
export class ServerDetail {
|
|
17
8
|
execute_manager = [];
|
|
18
9
|
websocket_manager;
|
|
@@ -23,10 +14,6 @@ export class ServerDetail {
|
|
|
23
14
|
message;
|
|
24
15
|
messager_log;
|
|
25
16
|
updatehandle;
|
|
26
|
-
/**
|
|
27
|
-
* **A simple message queue**\
|
|
28
|
-
* message, trace message, error message return data, for update
|
|
29
|
-
*/
|
|
30
17
|
re = [];
|
|
31
18
|
constructor(loader, backend, feedback, message, messager_log) {
|
|
32
19
|
this.loader = loader;
|
|
@@ -39,14 +26,10 @@ export class ServerDetail {
|
|
|
39
26
|
folderReply: this.folderReply
|
|
40
27
|
};
|
|
41
28
|
this.websocket_manager = new WebsocketManager(this.NewConnection, this.DisConnection, this.Analysis, messager_log, n);
|
|
42
|
-
// Internal update clock
|
|
43
29
|
this.updatehandle = setInterval(() => {
|
|
44
30
|
this.re.push(...this.console_update());
|
|
45
31
|
}, RENDER_UPDATETICK);
|
|
46
32
|
}
|
|
47
|
-
/**
|
|
48
|
-
* ** Caller Reference**
|
|
49
|
-
*/
|
|
50
33
|
get events() {
|
|
51
34
|
return {
|
|
52
35
|
resource_start: this.resource_start,
|
|
@@ -71,7 +54,6 @@ export class ServerDetail {
|
|
|
71
54
|
console_update: this.console_update,
|
|
72
55
|
};
|
|
73
56
|
}
|
|
74
|
-
//#region Socket Events
|
|
75
57
|
NewConnection = (x) => {
|
|
76
58
|
const p = {
|
|
77
59
|
title: "New Connection Established",
|
|
@@ -107,14 +89,6 @@ export class ServerDetail {
|
|
|
107
89
|
Analysis = (d) => {
|
|
108
90
|
this.execute_manager.forEach(x => x.manager.Analysis(JSON.parse(JSON.stringify(d))));
|
|
109
91
|
};
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region Node Reply
|
|
112
|
-
/**
|
|
113
|
-
* **Shell Reply Message Event**\
|
|
114
|
-
* Called by the client node
|
|
115
|
-
* @param data Content
|
|
116
|
-
* @param p Client node source
|
|
117
|
-
*/
|
|
118
92
|
shellReply = (data, p) => {
|
|
119
93
|
if (this.feedback.electron) {
|
|
120
94
|
this.feedback.electron()?.send("shellReply", data);
|
|
@@ -131,12 +105,6 @@ export class ServerDetail {
|
|
|
131
105
|
}
|
|
132
106
|
}
|
|
133
107
|
};
|
|
134
|
-
/**
|
|
135
|
-
* **Shell Folder Location Event**\
|
|
136
|
-
* Called by the client node
|
|
137
|
-
* @param data Content
|
|
138
|
-
* @param p Client node source
|
|
139
|
-
*/
|
|
140
108
|
folderReply = (data, p) => {
|
|
141
109
|
if (this.feedback.electron) {
|
|
142
110
|
this.feedback.electron()?.send("folderReply", data);
|
|
@@ -155,8 +123,6 @@ export class ServerDetail {
|
|
|
155
123
|
}
|
|
156
124
|
}
|
|
157
125
|
};
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region For Backend
|
|
160
126
|
resource_start = (socket, uuid) => {
|
|
161
127
|
const p = this.websocket_manager.targets.find(x => x.uuid == uuid);
|
|
162
128
|
const d = { name: 'resource_start', data: 0 };
|
|
@@ -172,7 +138,6 @@ export class ServerDetail {
|
|
|
172
138
|
const d = { name: 'plugin_info', data: 0 };
|
|
173
139
|
p?.websocket.send(JSON.stringify(d));
|
|
174
140
|
};
|
|
175
|
-
//#region Shell
|
|
176
141
|
shell_enter = (socket, uuid, value) => {
|
|
177
142
|
this.websocket_manager.shell_enter(uuid, value);
|
|
178
143
|
};
|
|
@@ -202,8 +167,6 @@ export class ServerDetail {
|
|
|
202
167
|
shell_folder = (socket, uuid, path) => {
|
|
203
168
|
this.websocket_manager.shell_folder(uuid, path);
|
|
204
169
|
};
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region Node
|
|
207
170
|
node_list = (socket) => {
|
|
208
171
|
const p = this.websocket_manager?.targets;
|
|
209
172
|
if (this.feedback.socket != undefined) {
|
|
@@ -239,8 +202,6 @@ export class ServerDetail {
|
|
|
239
202
|
node_delete = (socket, uuid, reason) => {
|
|
240
203
|
this.websocket_manager.server_stop(uuid, reason);
|
|
241
204
|
};
|
|
242
|
-
//#endregion
|
|
243
|
-
//#region Console
|
|
244
205
|
console_list = (socket) => {
|
|
245
206
|
if (this.feedback.electron) {
|
|
246
207
|
return this.execute_manager.map(x => x.record).filter(x => x != undefined);
|
|
@@ -352,7 +313,6 @@ export class ServerDetail {
|
|
|
352
313
|
if (target == undefined)
|
|
353
314
|
return;
|
|
354
315
|
if (type == 0) {
|
|
355
|
-
// Project
|
|
356
316
|
target.record.project_state[target.record.project_index].state = forward ? (state != undefined ? state : ExecuteState.FINISH) : ExecuteState.NONE;
|
|
357
317
|
target.record.project_index += forward ? 1 : -1;
|
|
358
318
|
if (target.record.project_index == target.record.projects.length) {
|
|
@@ -387,7 +347,6 @@ export class ServerDetail {
|
|
|
387
347
|
}
|
|
388
348
|
else if (type == 1) {
|
|
389
349
|
const begining = target.record.task_state[0].state == ExecuteState.NONE;
|
|
390
|
-
// Task
|
|
391
350
|
if (!begining && forward)
|
|
392
351
|
target.record.task_state[target.record.task_index].state = state != undefined ? state : ExecuteState.FINISH;
|
|
393
352
|
if (!forward)
|
|
@@ -477,8 +436,6 @@ export class ServerDetail {
|
|
|
477
436
|
}
|
|
478
437
|
return re;
|
|
479
438
|
};
|
|
480
|
-
//#endregion
|
|
481
|
-
//#endregion
|
|
482
439
|
CombineProxy = (eps) => {
|
|
483
440
|
const p = {
|
|
484
441
|
executeProjectStart: (data) => { eps.forEach(x => x.executeProjectStart(JSON.parse(JSON.stringify(data)))); },
|
package/dist/server/io.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Project, Database, UserProfile, Library, ExecutionLog, Node, Task, Job } from "../interface";
|
|
2
|
-
/**
|
|
3
|
-
* **Record Data**
|
|
4
|
-
*/
|
|
5
2
|
export interface MemoryData {
|
|
6
3
|
projects: Array<Project>;
|
|
7
4
|
tasks: Array<Task>;
|
|
@@ -12,10 +9,6 @@ export interface MemoryData {
|
|
|
12
9
|
libs: Array<Library>;
|
|
13
10
|
user: Array<UserProfile>;
|
|
14
11
|
}
|
|
15
|
-
/**
|
|
16
|
-
* **Server Use Interface**\
|
|
17
|
-
* FOr backend server action
|
|
18
|
-
*/
|
|
19
12
|
export interface RecordIOLoader {
|
|
20
13
|
fetch_all: () => Promise<Array<string>>;
|
|
21
14
|
load_all: (token?: string) => Promise<Array<string>>;
|
|
@@ -25,10 +18,6 @@ export interface RecordIOLoader {
|
|
|
25
18
|
load: (uuid: string, token?: string) => Promise<string>;
|
|
26
19
|
delete: (uuid: string, token?: string) => Promise<boolean>;
|
|
27
20
|
}
|
|
28
|
-
/**
|
|
29
|
-
* **IO Function Interface**\
|
|
30
|
-
* Use for access the file store function
|
|
31
|
-
*/
|
|
32
21
|
export interface RecordIOBase {
|
|
33
22
|
root: string;
|
|
34
23
|
join: (...paths: Array<string>) => string;
|
|
@@ -42,10 +31,6 @@ export interface RecordIOBase {
|
|
|
42
31
|
rm: (path: string) => Promise<void>;
|
|
43
32
|
cp: (path: string, newpath: string) => Promise<void>;
|
|
44
33
|
}
|
|
45
|
-
/**
|
|
46
|
-
* **IO Loader Worker**\
|
|
47
|
-
* Fetch data from storage space, could be disk or mongoDB
|
|
48
|
-
*/
|
|
49
34
|
export interface RecordLoader {
|
|
50
35
|
project: RecordIOLoader;
|
|
51
36
|
task: RecordIOLoader;
|
|
@@ -56,10 +41,4 @@ export interface RecordLoader {
|
|
|
56
41
|
lib: RecordIOLoader;
|
|
57
42
|
user: RecordIOLoader;
|
|
58
43
|
}
|
|
59
|
-
/**
|
|
60
|
-
* **Create the interface for record memory storage**\
|
|
61
|
-
* Generate a loader interface for register to server event
|
|
62
|
-
* @param loader loader memory loader interface
|
|
63
|
-
* @returns Interface for server calling
|
|
64
|
-
*/
|
|
65
44
|
export declare const CreateRecordMemoryLoader_Browser: (loader: MemoryData) => RecordLoader;
|
package/dist/server/io.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { RecordType, } from "../interface";
|
|
7
|
-
/**
|
|
8
|
-
* **Create the interface for record memory storage**\
|
|
9
|
-
* Generate a loader interface for register to server event
|
|
10
|
-
* @param loader Memory loader interface
|
|
11
|
-
* @param type Type of storage
|
|
12
|
-
* @returns Interface for calling
|
|
13
|
-
*/
|
|
14
2
|
const _CreateRecordMemoryLoader = (loader, type) => {
|
|
15
3
|
const get_array = (type) => {
|
|
16
4
|
switch (type) {
|
|
@@ -68,12 +56,6 @@ const _CreateRecordMemoryLoader = (loader, type) => {
|
|
|
68
56
|
}
|
|
69
57
|
};
|
|
70
58
|
};
|
|
71
|
-
/**
|
|
72
|
-
* **Create the interface for record memory storage**\
|
|
73
|
-
* Generate a loader interface for register to server event
|
|
74
|
-
* @param loader loader memory loader interface
|
|
75
|
-
* @returns Interface for server calling
|
|
76
|
-
*/
|
|
77
59
|
export const CreateRecordMemoryLoader_Browser = (loader) => {
|
|
78
60
|
return {
|
|
79
61
|
project: _CreateRecordMemoryLoader(loader, RecordType.PROJECT),
|