verteilen-core 1.2.4 → 1.2.6

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 (92) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/jest.config.d.ts +2 -0
  3. package/dist/src/client/analysis.d.ts +35 -0
  4. package/dist/src/client/analysis.js +318 -319
  5. package/dist/src/client/client.d.ts +25 -0
  6. package/dist/src/client/client.js +162 -168
  7. package/dist/src/client/cluster.d.ts +1 -0
  8. package/dist/src/client/cluster.js +1 -2
  9. package/dist/src/client/database.d.ts +13 -0
  10. package/dist/src/client/database.js +28 -27
  11. package/dist/src/client/execute.d.ts +24 -0
  12. package/dist/src/client/execute.js +61 -51
  13. package/dist/src/client/http.d.ts +7 -0
  14. package/dist/src/client/http.js +29 -26
  15. package/dist/src/client/javascript.d.ts +47 -0
  16. package/dist/src/client/javascript.js +110 -136
  17. package/dist/src/client/job_database.d.ts +10 -0
  18. package/dist/src/client/job_database.js +27 -29
  19. package/dist/src/client/job_execute.d.ts +20 -0
  20. package/dist/src/client/job_execute.js +148 -146
  21. package/dist/src/client/os.d.ts +29 -0
  22. package/dist/src/client/os.js +131 -136
  23. package/dist/src/client/resource.d.ts +7 -0
  24. package/dist/src/client/resource.js +93 -104
  25. package/dist/src/client/shell.d.ts +16 -0
  26. package/dist/src/client/shell.js +102 -98
  27. package/dist/src/computed.d.ts +13 -0
  28. package/dist/src/interface/base.d.ts +70 -0
  29. package/dist/src/interface/bus.d.ts +90 -0
  30. package/dist/src/interface/enum.d.ts +143 -0
  31. package/dist/src/interface/execute.d.ts +20 -0
  32. package/dist/src/interface/record.d.ts +93 -0
  33. package/dist/src/interface/server.d.ts +76 -0
  34. package/dist/src/interface/struct.d.ts +182 -0
  35. package/dist/src/interface/table.d.ts +20 -0
  36. package/dist/src/interface/ui.d.ts +29 -0
  37. package/dist/src/interface.d.ts +29 -0
  38. package/dist/src/plugins/i18n.d.ts +1666 -0
  39. package/dist/src/script/console_manager.d.ts +18 -0
  40. package/dist/src/script/console_manager.js +97 -91
  41. package/dist/src/script/console_server_manager.d.ts +13 -0
  42. package/dist/src/script/console_server_manager.js +29 -26
  43. package/dist/src/script/execute/base.d.ts +45 -0
  44. package/dist/src/script/execute/base.js +165 -162
  45. package/dist/src/script/execute/feedback.d.ts +12 -0
  46. package/dist/src/script/execute/feedback.js +162 -171
  47. package/dist/src/script/execute/interface.d.ts +8 -0
  48. package/dist/src/script/execute/region_job.d.ts +5 -0
  49. package/dist/src/script/execute/region_job.js +1 -0
  50. package/dist/src/script/execute/region_project.d.ts +10 -0
  51. package/dist/src/script/execute/region_project.js +4 -0
  52. package/dist/src/script/execute/region_subtask.d.ts +5 -0
  53. package/dist/src/script/execute/region_subtask.js +1 -0
  54. package/dist/src/script/execute/region_task.d.ts +10 -0
  55. package/dist/src/script/execute/region_task.js +4 -0
  56. package/dist/src/script/execute/runner.d.ts +14 -0
  57. package/dist/src/script/execute/runner.js +129 -139
  58. package/dist/src/script/execute/util_parser.d.ts +14 -0
  59. package/dist/src/script/execute/util_parser.js +119 -121
  60. package/dist/src/script/execute_manager.d.ts +25 -0
  61. package/dist/src/script/execute_manager.js +266 -278
  62. package/dist/src/script/socket_manager.d.ts +31 -0
  63. package/dist/src/script/socket_manager.js +196 -193
  64. package/dist/src/script/webhook_manager.d.ts +3 -0
  65. package/dist/src/script/webhook_server_manager.d.ts +13 -0
  66. package/dist/src/script/webhook_server_manager.js +79 -86
  67. package/dist/src/server/detail.d.ts +72 -0
  68. package/dist/src/server/detail.js +401 -378
  69. package/dist/src/server/io.d.ts +46 -0
  70. package/dist/src/server/io.js +42 -51
  71. package/dist/src/server/plugin.d.ts +18 -0
  72. package/dist/src/server/plugin.js +45 -54
  73. package/dist/src/server/server.d.ts +27 -0
  74. package/dist/src/server/server.js +38 -36
  75. package/dist/src/server.d.ts +4 -0
  76. package/dist/src/util/console_handle.d.ts +20 -0
  77. package/dist/src/util/console_handle.js +214 -218
  78. package/dist/src/util/log_handle.d.ts +23 -0
  79. package/dist/src/util/log_handle.js +158 -164
  80. package/dist/test/TEST.d.ts +1 -0
  81. package/dist/test/TEST.js +37 -54
  82. package/dist/test/client/execute.test.d.ts +1 -0
  83. package/dist/test/client/execute.test.js +6 -15
  84. package/dist/test/client/javascript.test.d.ts +1 -0
  85. package/dist/test/client/javascript.test.js +21 -30
  86. package/dist/test/client/server.test.d.ts +1 -0
  87. package/dist/test/client/task.test.d.ts +1 -0
  88. package/dist/test/client/task.test.js +1 -1
  89. package/dist/test/script/parser.test.d.ts +1 -0
  90. package/dist/test/script/socket.test.d.ts +1 -0
  91. package/package.json +1 -1
  92. package/tsconfig.json +5 -3
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -16,103 +7,101 @@ exports.ClientResource = void 0;
16
7
  const systeminformation_1 = __importDefault(require("systeminformation"));
17
8
  const interface_1 = require("../interface");
18
9
  class ClientResource {
19
- constructor() {
10
+ is_query = false;
11
+ Query = async (src = undefined, type = interface_1.ResourceType.ALL) => {
12
+ this.is_query = true;
13
+ const result = src != undefined ? src : this.create_new();
14
+ const _system = (type & interface_1.ResourceType.SYSTEM) == interface_1.ResourceType.SYSTEM ? systeminformation_1.default.system() : undefined;
15
+ const _cpu = systeminformation_1.default.cpu();
16
+ const _ram = systeminformation_1.default.mem();
17
+ const _battery = systeminformation_1.default.battery();
18
+ const _load = systeminformation_1.default.currentLoad();
19
+ const _os = systeminformation_1.default.osInfo();
20
+ const _gpu = systeminformation_1.default.graphics();
21
+ const _disk = systeminformation_1.default.fsSize();
22
+ const _net = systeminformation_1.default.networkStats();
20
23
  this.is_query = false;
21
- this.Query = (...args_1) => __awaiter(this, [...args_1], void 0, function* (src = undefined, type = interface_1.ResourceType.ALL) {
22
- this.is_query = true;
23
- const result = src != undefined ? src : this.create_new();
24
- const _system = (type & interface_1.ResourceType.SYSTEM) == interface_1.ResourceType.SYSTEM ? systeminformation_1.default.system() : undefined;
25
- const _cpu = systeminformation_1.default.cpu();
26
- const _ram = systeminformation_1.default.mem();
27
- const _battery = systeminformation_1.default.battery();
28
- const _load = systeminformation_1.default.currentLoad();
29
- const _os = systeminformation_1.default.osInfo();
30
- const _gpu = systeminformation_1.default.graphics();
31
- const _disk = systeminformation_1.default.fsSize();
32
- const _net = systeminformation_1.default.networkStats();
33
- this.is_query = false;
34
- return yield Promise.all([_system, _cpu, _ram, _battery, _load, _os, _gpu, _disk, _net]).then(x => {
35
- const system = x[0];
36
- const cpu = x[1];
37
- const ram = x[2];
38
- const battery = x[3];
39
- const load = x[4];
40
- const os = x[5];
41
- const gpu = x[6];
42
- const disk = x[7];
43
- const net = x[8];
44
- if (system != undefined) {
45
- result.system_name = `${system.manufacturer} ${system.model}`;
46
- result.virtual = system.virtual;
47
- }
48
- if (os != undefined) {
49
- result.platform = process.platform;
50
- result.arch = process.arch;
51
- result.hostname = os.hostname;
52
- }
53
- if (cpu != undefined) {
54
- result.cpu_name = `${cpu.manufacturer} ${cpu.brand} ${cpu.speed}`;
55
- result.cpu_core = cpu.cores;
56
- }
57
- if (load != undefined) {
58
- result.cpu_usage = load.currentLoadGuest + load.currentLoadIrq + load.currentLoadSystem + load.currentLoad + load.currentLoadSteal + load.currentLoadNice;
59
- }
60
- if (ram != undefined) {
61
- result.ram_usage = ram.used;
62
- result.ram_free = ram.free;
63
- result.ram_total = ram.total;
64
- }
65
- if (battery != undefined) {
66
- result.battery = battery.hasBattery ? battery.percent : 1;
67
- result.charging = battery.isCharging;
68
- }
69
- if (gpu != undefined) {
70
- result.gpu = gpu.controllers.map(x => ({
71
- gpu_name: `${x.vendor} ${x.model}`
72
- }));
73
- }
74
- if (disk != undefined) {
75
- result.disk = disk.map(x => ({
76
- disk_name: x.fs,
77
- disk_type: x.type,
78
- disk_free: x.available,
79
- disk_total: x.size,
80
- disk_usage: x.used,
81
- disk_percentage: x.use,
82
- }));
83
- }
84
- if (net != undefined) {
85
- result.net = net.map(x => ({
86
- net_name: x.iface,
87
- download: x.rx_sec,
88
- upload: x.tx_sec
89
- }));
90
- }
91
- result.pid_usage = process.pid;
92
- return result;
93
- });
24
+ return await Promise.all([_system, _cpu, _ram, _battery, _load, _os, _gpu, _disk, _net]).then(x => {
25
+ const system = x[0];
26
+ const cpu = x[1];
27
+ const ram = x[2];
28
+ const battery = x[3];
29
+ const load = x[4];
30
+ const os = x[5];
31
+ const gpu = x[6];
32
+ const disk = x[7];
33
+ const net = x[8];
34
+ if (system != undefined) {
35
+ result.system_name = `${system.manufacturer} ${system.model}`;
36
+ result.virtual = system.virtual;
37
+ }
38
+ if (os != undefined) {
39
+ result.platform = process.platform;
40
+ result.arch = process.arch;
41
+ result.hostname = os.hostname;
42
+ }
43
+ if (cpu != undefined) {
44
+ result.cpu_name = `${cpu.manufacturer} ${cpu.brand} ${cpu.speed}`;
45
+ result.cpu_core = cpu.cores;
46
+ }
47
+ if (load != undefined) {
48
+ result.cpu_usage = load.currentLoadGuest + load.currentLoadIrq + load.currentLoadSystem + load.currentLoad + load.currentLoadSteal + load.currentLoadNice;
49
+ }
50
+ if (ram != undefined) {
51
+ result.ram_usage = ram.used;
52
+ result.ram_free = ram.free;
53
+ result.ram_total = ram.total;
54
+ }
55
+ if (battery != undefined) {
56
+ result.battery = battery.hasBattery ? battery.percent : 1;
57
+ result.charging = battery.isCharging;
58
+ }
59
+ if (gpu != undefined) {
60
+ result.gpu = gpu.controllers.map(x => ({
61
+ gpu_name: `${x.vendor} ${x.model}`
62
+ }));
63
+ }
64
+ if (disk != undefined) {
65
+ result.disk = disk.map(x => ({
66
+ disk_name: x.fs,
67
+ disk_type: x.type,
68
+ disk_free: x.available,
69
+ disk_total: x.size,
70
+ disk_usage: x.used,
71
+ disk_percentage: x.use,
72
+ }));
73
+ }
74
+ if (net != undefined) {
75
+ result.net = net.map(x => ({
76
+ net_name: x.iface,
77
+ download: x.rx_sec,
78
+ upload: x.tx_sec
79
+ }));
80
+ }
81
+ result.pid_usage = process.pid;
82
+ return result;
94
83
  });
95
- this.create_new = () => {
96
- return {
97
- system_name: '',
98
- virtual: false,
99
- platform: '',
100
- arch: '',
101
- hostname: '',
102
- cpu_name: '',
103
- cpu_core: 0,
104
- cpu_usage: 0,
105
- ram_usage: 0,
106
- ram_free: 0,
107
- ram_total: 0,
108
- battery: 0,
109
- charging: false,
110
- gpu: [],
111
- disk: [],
112
- net: [],
113
- pid_usage: 0
114
- };
84
+ };
85
+ create_new = () => {
86
+ return {
87
+ system_name: '',
88
+ virtual: false,
89
+ platform: '',
90
+ arch: '',
91
+ hostname: '',
92
+ cpu_name: '',
93
+ cpu_core: 0,
94
+ cpu_usage: 0,
95
+ ram_usage: 0,
96
+ ram_free: 0,
97
+ ram_total: 0,
98
+ battery: 0,
99
+ charging: false,
100
+ gpu: [],
101
+ disk: [],
102
+ net: [],
103
+ pid_usage: 0
115
104
  };
116
- }
105
+ };
117
106
  }
118
107
  exports.ClientResource = ClientResource;
@@ -0,0 +1,16 @@
1
+ import WebSocket from 'ws';
2
+ import { Messager } from "../interface";
3
+ import { Client } from "./client";
4
+ export declare class ClientShell {
5
+ private messager;
6
+ private messager_log;
7
+ private os;
8
+ private shell_workers;
9
+ constructor(_messager: Messager, _messager_log: Messager, _client: Client);
10
+ open_shell: (data: number, source: WebSocket) => void;
11
+ enter_shell: (input: string, source: WebSocket) => void;
12
+ close_shell: (data: number, source: WebSocket) => void;
13
+ close_shell_all: (data: number) => void;
14
+ shell_folder: (data: string, source: WebSocket) => void;
15
+ disconnect: (source: WebSocket) => void;
16
+ }
@@ -4,115 +4,119 @@ exports.ClientShell = void 0;
4
4
  const child_process_1 = require("child_process");
5
5
  const os_1 = require("./os");
6
6
  class ClientShell {
7
+ messager;
8
+ messager_log;
9
+ os;
10
+ shell_workers = [];
7
11
  constructor(_messager, _messager_log, _client) {
8
- this.shell_workers = [];
9
- this.open_shell = (data, source) => {
10
- if (this.shell_workers.find(x => x[0] == source)) {
11
- this.messager_log(`[Shell] Error the source already open the shell`);
12
- return;
12
+ this.os = new os_1.ClientOS(() => "SHELL", () => "", _messager, _messager_log);
13
+ this.messager = _messager;
14
+ this.messager_log = _messager_log;
15
+ }
16
+ open_shell = (data, source) => {
17
+ if (this.shell_workers.find(x => x[0] == source)) {
18
+ this.messager_log(`[Shell] Error the source already open the shell`);
19
+ return;
20
+ }
21
+ const program = process.platform === "win32" ? 'cmd' : 'bash';
22
+ const child = (0, child_process_1.spawn)(program, [], {
23
+ stdio: ['pipe', 'pipe', 'pipe'],
24
+ shell: true,
25
+ windowsHide: true,
26
+ env: {
27
+ ...process.env,
13
28
  }
14
- const program = process.platform === "win32" ? 'cmd' : 'bash';
15
- const child = (0, child_process_1.spawn)(program, [], {
16
- stdio: ['pipe', 'pipe', 'pipe'],
17
- shell: true,
18
- windowsHide: true,
19
- env: Object.assign({}, process.env)
20
- });
21
- this.shell_workers.push([source, child]);
22
- let t = "";
23
- const workerFeedback = (str) => {
24
- for (let i = 0; i < str.length; i++) {
25
- if (str[i] == '\n') {
26
- const data = {
27
- data: t
28
- };
29
- const d = {
30
- name: "shell_reply",
31
- data: data
32
- };
33
- source.send(JSON.stringify(d));
34
- t = "";
35
- }
36
- else {
37
- t += str[i];
38
- }
29
+ });
30
+ this.shell_workers.push([source, child]);
31
+ let t = "";
32
+ const workerFeedback = (str) => {
33
+ for (let i = 0; i < str.length; i++) {
34
+ if (str[i] == '\n') {
35
+ const data = {
36
+ data: t
37
+ };
38
+ const d = {
39
+ name: "shell_reply",
40
+ data: data
41
+ };
42
+ source.send(JSON.stringify(d));
43
+ t = "";
44
+ }
45
+ else {
46
+ t += str[i];
39
47
  }
40
- };
41
- child.on('exit', (code, signal) => {
42
- const index = this.shell_workers.findIndex(x => x[0] == source);
43
- if (index != -1)
44
- this.shell_workers.splice(index, 1);
45
- });
46
- child.on('message', (message, sendHandle) => {
47
- workerFeedback(message.toString());
48
- });
49
- child.stdout.setEncoding('utf8');
50
- child.stdout.on('data', (chunk) => {
51
- workerFeedback(chunk.toString());
52
- });
53
- child.stderr.setEncoding('utf8');
54
- child.stderr.on('data', (chunk) => {
55
- workerFeedback(chunk.toString());
56
- });
57
- };
58
- this.enter_shell = (input, source) => {
59
- var _a, _b, _c;
60
- const p = this.shell_workers.find(x => x[0] == source);
61
- if (p == undefined) {
62
- this.messager_log(`[Shell] Cannot find shell instance`);
63
- return;
64
48
  }
65
- (_a = p[1].stdin) === null || _a === void 0 ? void 0 : _a.write(input + '\n');
66
- if (process.platform == 'win32')
67
- (_b = p[1].stdin) === null || _b === void 0 ? void 0 : _b.write("echo %cd%" + '\n');
68
- else
69
- (_c = p[1].stdin) === null || _c === void 0 ? void 0 : _c.write("pwd" + '\n');
70
49
  };
71
- this.close_shell = (data, source) => {
72
- const p = this.shell_workers.find(x => x[0] == source);
50
+ child.on('exit', (code, signal) => {
51
+ const index = this.shell_workers.findIndex(x => x[0] == source);
52
+ if (index != -1)
53
+ this.shell_workers.splice(index, 1);
54
+ });
55
+ child.on('message', (message, sendHandle) => {
56
+ workerFeedback(message.toString());
57
+ });
58
+ child.stdout.setEncoding('utf8');
59
+ child.stdout.on('data', (chunk) => {
60
+ workerFeedback(chunk.toString());
61
+ });
62
+ child.stderr.setEncoding('utf8');
63
+ child.stderr.on('data', (chunk) => {
64
+ workerFeedback(chunk.toString());
65
+ });
66
+ };
67
+ enter_shell = (input, source) => {
68
+ const p = this.shell_workers.find(x => x[0] == source);
69
+ if (p == undefined) {
70
+ this.messager_log(`[Shell] Cannot find shell instance`);
71
+ return;
72
+ }
73
+ p[1].stdin?.write(input + '\n');
74
+ if (process.platform == 'win32')
75
+ p[1].stdin?.write("echo %cd%" + '\n');
76
+ else
77
+ p[1].stdin?.write("pwd" + '\n');
78
+ };
79
+ close_shell = (data, source) => {
80
+ const p = this.shell_workers.find(x => x[0] == source);
81
+ if (p == undefined) {
82
+ this.messager_log(`[Shell] Cannot find shell instance`);
83
+ return;
84
+ }
85
+ p[1].kill();
86
+ };
87
+ close_shell_all = (data) => {
88
+ this.shell_workers.forEach(p => {
73
89
  if (p == undefined) {
74
90
  this.messager_log(`[Shell] Cannot find shell instance`);
75
91
  return;
76
92
  }
77
93
  p[1].kill();
94
+ });
95
+ };
96
+ shell_folder = (data, source) => {
97
+ if (data.length == 0) {
98
+ data = process.cwd();
99
+ }
100
+ if (!this.os.fs_dir_exist({ path: data })) {
101
+ data = process.cwd();
102
+ }
103
+ const d = {
104
+ path: data,
105
+ cwd: process.cwd(),
106
+ folders: this.os.dir_dirs({ path: data }),
107
+ files: this.os.dir_files({ path: data })
78
108
  };
79
- this.close_shell_all = (data) => {
80
- this.shell_workers.forEach(p => {
81
- if (p == undefined) {
82
- this.messager_log(`[Shell] Cannot find shell instance`);
83
- return;
84
- }
85
- p[1].kill();
86
- });
109
+ const h = {
110
+ name: "shell_folder_reply",
111
+ data: d
87
112
  };
88
- this.shell_folder = (data, source) => {
89
- if (data.length == 0) {
90
- data = process.cwd();
91
- }
92
- if (!this.os.fs_dir_exist({ path: data })) {
93
- data = process.cwd();
94
- }
95
- const d = {
96
- path: data,
97
- cwd: process.cwd(),
98
- folders: this.os.dir_dirs({ path: data }),
99
- files: this.os.dir_files({ path: data })
100
- };
101
- const h = {
102
- name: "shell_folder_reply",
103
- data: d
104
- };
105
- source.send(JSON.stringify(h));
106
- };
107
- this.disconnect = (source) => {
108
- const p = this.shell_workers.find(x => x[0] == source);
109
- if (p == undefined)
110
- return;
111
- p[1].kill();
112
- };
113
- this.os = new os_1.ClientOS(() => "SHELL", () => "", _messager, _messager_log);
114
- this.messager = _messager;
115
- this.messager_log = _messager_log;
116
- }
113
+ source.send(JSON.stringify(h));
114
+ };
115
+ disconnect = (source) => {
116
+ const p = this.shell_workers.find(x => x[0] == source);
117
+ if (p == undefined)
118
+ return;
119
+ p[1].kill();
120
+ };
117
121
  }
118
122
  exports.ClientShell = ClientShell;
@@ -0,0 +1,13 @@
1
+ export * as ClientAnalysis from './client/analysis';
2
+ export * as Client from './client/client';
3
+ export * as ClientCluster from './client/cluster';
4
+ export * as ClientExecute from './client/execute';
5
+ export * as ClientJobExecute from './client/job_execute';
6
+ export * as ClientJobParameter from './client/job_database';
7
+ export * as ClientHttp from './client/http';
8
+ export * as ClientJavascript from './client/javascript';
9
+ export * as ClientOS from './client/os';
10
+ export * as ClientParameter from './client/database';
11
+ export * as ClientResource from './client/resource';
12
+ export * as ClientShell from './client/shell';
13
+ export * as Execute_WebhookServerManager from './script/webhook_server_manager';
@@ -0,0 +1,70 @@
1
+ import { DataType, DataTypeBase } from "./enum";
2
+ import { ACLType, LocalPermission as LocalPermission } from "./server";
3
+ export interface DatabaseConfigTrigger {
4
+ types: Array<DataTypeBase>;
5
+ }
6
+ export interface DatabaseContainer {
7
+ name: string;
8
+ meta?: any;
9
+ config?: DatabaseConfigTrigger;
10
+ type: DataType;
11
+ hidden: boolean;
12
+ runtimeOnly: boolean;
13
+ value: any;
14
+ }
15
+ export interface Property {
16
+ name: string;
17
+ expression: string;
18
+ deep?: number;
19
+ }
20
+ export interface Database {
21
+ uuid: string;
22
+ title: string;
23
+ canWrite: boolean;
24
+ containers: Array<DatabaseContainer>;
25
+ permission?: LocalPermission;
26
+ }
27
+ export interface Job {
28
+ index?: number;
29
+ uuid: string;
30
+ runtime_uuid?: string;
31
+ category: number;
32
+ type: number;
33
+ script: string;
34
+ string_args: Array<string>;
35
+ number_args: Array<number>;
36
+ boolean_args: Array<boolean>;
37
+ id_args: Array<boolean>;
38
+ permission?: LocalPermission;
39
+ }
40
+ export interface Task {
41
+ uuid: string;
42
+ title: string;
43
+ description: string;
44
+ setupjob: boolean;
45
+ cronjob: boolean;
46
+ cronjobKey: string;
47
+ multi: boolean;
48
+ multiKey: string;
49
+ properties: Array<Property>;
50
+ jobs: Array<Job>;
51
+ permission?: LocalPermission;
52
+ }
53
+ export interface Project {
54
+ owner?: string;
55
+ uuid: string;
56
+ title: string;
57
+ description?: string;
58
+ database_uuid: string;
59
+ database?: Database;
60
+ task: Array<Task>;
61
+ permission?: LocalPermission;
62
+ acl?: ACLType;
63
+ }
64
+ export interface Node {
65
+ uuid: string;
66
+ parent?: string;
67
+ url: string;
68
+ permission?: LocalPermission;
69
+ acl?: ACLType;
70
+ }
@@ -0,0 +1,90 @@
1
+ import { Job, Database, Project, Task } from "./base";
2
+ import { ExecuteState } from "./enum";
3
+ import { ExecutionLog, Log, Preference } from "./record";
4
+ import { Login } from "./server";
5
+ import { FeedBack, Header, Setter, ShellFolder, Single, WebsocketPack } from "./struct";
6
+ import { NodeTable } from "./table";
7
+ import { ToastData } from "./ui";
8
+ type Handler<T = unknown> = (event: T) => void;
9
+ export type Messager = (msg: string, tag?: string) => void;
10
+ export type Messager_log = (msg: string, tag?: string, meta?: string) => void;
11
+ export interface BusAnalysis {
12
+ name: string;
13
+ h: Header;
14
+ c: WebsocketPack | undefined;
15
+ }
16
+ export interface Rename {
17
+ oldname: string;
18
+ newname: string;
19
+ }
20
+ export interface RawSend {
21
+ name: string;
22
+ token?: string;
23
+ data: any;
24
+ }
25
+ export interface EmitterProxy<T> {
26
+ on<Key extends keyof T>(type: T, handler: Handler<T[Key]>): void;
27
+ off<Key extends keyof T>(type: T, handler: Handler<T[Key]>): void;
28
+ emit<Key extends keyof T>(type: T, handler: T[Key]): void;
29
+ }
30
+ export interface ExecuteProxy {
31
+ executeProjectStart: (data: [Project, number]) => void;
32
+ executeProjectFinish: (data: [Project, number]) => void;
33
+ executeTaskStart: (data: [Task, number]) => void;
34
+ executeTaskFinish: (data: Task) => void;
35
+ executeSubtaskStart: (data: [Task, number, string]) => void;
36
+ executeSubtaskUpdate: (data: [Task, number, string, ExecuteState]) => void;
37
+ executeSubtaskFinish: (data: [Task, number, string]) => void;
38
+ executeJobStart: (data: [Job, number, string]) => void;
39
+ executeJobFinish: (data: [Job, number, string, number]) => void;
40
+ feedbackMessage: (data: FeedBack) => void;
41
+ updateDatabase: (data: Database) => void;
42
+ }
43
+ export interface NodeProxy {
44
+ shellReply: (data: Single, w?: WebsocketPack) => void;
45
+ folderReply: (data: ShellFolder, w?: WebsocketPack) => void;
46
+ }
47
+ export type BusType = {
48
+ setting: void;
49
+ guide: void;
50
+ makeToast: ToastData;
51
+ modeSelect: boolean;
52
+ createProject: void;
53
+ updateProject: void;
54
+ recoverProject: Project;
55
+ recoverDatabase: Database;
56
+ relogin: void;
57
+ loginGuest: void;
58
+ login: Login;
59
+ logout: void;
60
+ updateTask: void;
61
+ updateJob: void;
62
+ updateDatabase: void;
63
+ selectDatabase: string;
64
+ updateLocate: void;
65
+ updateNode: Array<NodeTable>;
66
+ updateCurrent: ExecutionLog;
67
+ updateLog: Log;
68
+ updateHandle: void;
69
+ slowUpdateHandle: void;
70
+ shellReply: Single;
71
+ folderReply: ShellFolder;
72
+ feedbackMessage: FeedBack;
73
+ savePreference: Preference;
74
+ renameScript: Rename;
75
+ deleteScript: string;
76
+ analysis: BusAnalysis;
77
+ debuglog: string;
78
+ hotkey: string;
79
+ isExpress: boolean;
80
+ delay: Setter;
81
+ system: Setter;
82
+ };
83
+ export type BusWebType = {
84
+ raw_send: RawSend;
85
+ locate: string;
86
+ load_preference: string;
87
+ load_cookie: void;
88
+ get_token: string;
89
+ };
90
+ export {};