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.
- package/dist/index.d.ts +3 -0
- package/dist/jest.config.d.ts +2 -0
- package/dist/src/client/analysis.d.ts +35 -0
- package/dist/src/client/analysis.js +318 -319
- package/dist/src/client/client.d.ts +25 -0
- package/dist/src/client/client.js +162 -168
- package/dist/src/client/cluster.d.ts +1 -0
- package/dist/src/client/cluster.js +1 -2
- package/dist/src/client/database.d.ts +13 -0
- package/dist/src/client/database.js +28 -27
- package/dist/src/client/execute.d.ts +24 -0
- package/dist/src/client/execute.js +61 -51
- package/dist/src/client/http.d.ts +7 -0
- package/dist/src/client/http.js +29 -26
- package/dist/src/client/javascript.d.ts +47 -0
- package/dist/src/client/javascript.js +110 -136
- package/dist/src/client/job_database.d.ts +10 -0
- package/dist/src/client/job_database.js +27 -29
- package/dist/src/client/job_execute.d.ts +20 -0
- package/dist/src/client/job_execute.js +148 -146
- package/dist/src/client/os.d.ts +29 -0
- package/dist/src/client/os.js +131 -136
- package/dist/src/client/resource.d.ts +7 -0
- package/dist/src/client/resource.js +93 -104
- package/dist/src/client/shell.d.ts +16 -0
- package/dist/src/client/shell.js +102 -98
- package/dist/src/computed.d.ts +13 -0
- package/dist/src/interface/base.d.ts +70 -0
- package/dist/src/interface/bus.d.ts +90 -0
- package/dist/src/interface/enum.d.ts +143 -0
- package/dist/src/interface/execute.d.ts +20 -0
- package/dist/src/interface/record.d.ts +93 -0
- package/dist/src/interface/server.d.ts +76 -0
- package/dist/src/interface/struct.d.ts +182 -0
- package/dist/src/interface/table.d.ts +20 -0
- package/dist/src/interface/ui.d.ts +29 -0
- package/dist/src/interface.d.ts +29 -0
- package/dist/src/plugins/i18n.d.ts +1666 -0
- package/dist/src/script/console_manager.d.ts +18 -0
- package/dist/src/script/console_manager.js +97 -91
- package/dist/src/script/console_server_manager.d.ts +13 -0
- package/dist/src/script/console_server_manager.js +29 -26
- package/dist/src/script/execute/base.d.ts +45 -0
- package/dist/src/script/execute/base.js +165 -162
- package/dist/src/script/execute/feedback.d.ts +12 -0
- package/dist/src/script/execute/feedback.js +162 -171
- package/dist/src/script/execute/interface.d.ts +8 -0
- package/dist/src/script/execute/region_job.d.ts +5 -0
- package/dist/src/script/execute/region_job.js +1 -0
- package/dist/src/script/execute/region_project.d.ts +10 -0
- package/dist/src/script/execute/region_project.js +4 -0
- package/dist/src/script/execute/region_subtask.d.ts +5 -0
- package/dist/src/script/execute/region_subtask.js +1 -0
- package/dist/src/script/execute/region_task.d.ts +10 -0
- package/dist/src/script/execute/region_task.js +4 -0
- package/dist/src/script/execute/runner.d.ts +14 -0
- package/dist/src/script/execute/runner.js +129 -139
- package/dist/src/script/execute/util_parser.d.ts +14 -0
- package/dist/src/script/execute/util_parser.js +119 -121
- package/dist/src/script/execute_manager.d.ts +25 -0
- package/dist/src/script/execute_manager.js +266 -278
- package/dist/src/script/socket_manager.d.ts +31 -0
- package/dist/src/script/socket_manager.js +196 -193
- package/dist/src/script/webhook_manager.d.ts +3 -0
- package/dist/src/script/webhook_server_manager.d.ts +13 -0
- package/dist/src/script/webhook_server_manager.js +79 -86
- package/dist/src/server/detail.d.ts +72 -0
- package/dist/src/server/detail.js +401 -378
- package/dist/src/server/io.d.ts +46 -0
- package/dist/src/server/io.js +42 -51
- package/dist/src/server/plugin.d.ts +18 -0
- package/dist/src/server/plugin.js +45 -54
- package/dist/src/server/server.d.ts +27 -0
- package/dist/src/server/server.js +38 -36
- package/dist/src/server.d.ts +4 -0
- package/dist/src/util/console_handle.d.ts +20 -0
- package/dist/src/util/console_handle.js +214 -218
- package/dist/src/util/log_handle.d.ts +23 -0
- package/dist/src/util/log_handle.js +158 -164
- package/dist/test/TEST.d.ts +1 -0
- package/dist/test/TEST.js +37 -54
- package/dist/test/client/execute.test.d.ts +1 -0
- package/dist/test/client/execute.test.js +6 -15
- package/dist/test/client/javascript.test.d.ts +1 -0
- package/dist/test/client/javascript.test.js +21 -30
- package/dist/test/client/server.test.d.ts +1 -0
- package/dist/test/client/task.test.d.ts +1 -0
- package/dist/test/client/task.test.js +1 -1
- package/dist/test/script/parser.test.d.ts +1 -0
- package/dist/test/script/socket.test.d.ts +1 -0
- package/package.json +1 -1
- package/tsconfig.json +5 -3
|
@@ -32,180 +32,21 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
exports.Util_Server_Log_Proxy = void 0;
|
|
46
37
|
const uuid_1 = require("uuid");
|
|
47
38
|
const interface_1 = require("../interface");
|
|
48
39
|
const fs = __importStar(require("fs"));
|
|
49
40
|
class Util_Server_Log_Proxy {
|
|
41
|
+
model;
|
|
42
|
+
logs;
|
|
43
|
+
preference;
|
|
44
|
+
task_index = 0;
|
|
45
|
+
uuid = '';
|
|
50
46
|
get target_log() {
|
|
51
47
|
return this.logs.logs.find(x => x.uuid == this.uuid);
|
|
52
48
|
}
|
|
53
49
|
constructor(_model, _log, _preference) {
|
|
54
|
-
this.task_index = 0;
|
|
55
|
-
this.uuid = '';
|
|
56
|
-
this.execute_project_start = (d) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const target = this.model.record.projects[this.model.record.project_index];
|
|
58
|
-
const title = yield this.getnewname(target.title);
|
|
59
|
-
this.uuid = (0, uuid_1.v6)();
|
|
60
|
-
const newlog = {
|
|
61
|
-
uuid: this.uuid,
|
|
62
|
-
filename: title,
|
|
63
|
-
dirty: true,
|
|
64
|
-
output: this.preference.log,
|
|
65
|
-
project: target,
|
|
66
|
-
state: interface_1.ExecuteState.RUNNING,
|
|
67
|
-
start_timer: Date.now(),
|
|
68
|
-
database: d[0].database,
|
|
69
|
-
end_timer: 0,
|
|
70
|
-
logs: target.task.map(x => {
|
|
71
|
-
return {
|
|
72
|
-
start_timer: 0,
|
|
73
|
-
end_timer: 0,
|
|
74
|
-
task_state: {
|
|
75
|
-
uuid: x.uuid,
|
|
76
|
-
state: interface_1.ExecuteState.NONE
|
|
77
|
-
},
|
|
78
|
-
task_detail: []
|
|
79
|
-
};
|
|
80
|
-
})
|
|
81
|
-
};
|
|
82
|
-
this.logs.logs = [newlog].concat(this.logs.logs);
|
|
83
|
-
});
|
|
84
|
-
this.execute_project_finish = (d) => {
|
|
85
|
-
if (this.target_log == undefined)
|
|
86
|
-
return;
|
|
87
|
-
this.target_log.state = interface_1.ExecuteState.FINISH;
|
|
88
|
-
this.target_log.end_timer = Date.now();
|
|
89
|
-
this.target_log.dirty = true;
|
|
90
|
-
};
|
|
91
|
-
this.execute_task_start = (d) => {
|
|
92
|
-
if (this.target_log == undefined)
|
|
93
|
-
return;
|
|
94
|
-
const index = this.target_log.project.task.findIndex(x => x.uuid == d[0].uuid);
|
|
95
|
-
if (index == -1)
|
|
96
|
-
return;
|
|
97
|
-
this.task_index = index;
|
|
98
|
-
this.target_log.logs[this.task_index].task_detail = [];
|
|
99
|
-
const p = this.model.record.projects[this.model.record.project_index];
|
|
100
|
-
const t = p.task[this.task_index];
|
|
101
|
-
const count = this.model.manager.get_task_state_count(t);
|
|
102
|
-
for (let i = 0; i < count; i++) {
|
|
103
|
-
this.target_log.logs[this.task_index].task_detail.push({
|
|
104
|
-
index: i,
|
|
105
|
-
node: "",
|
|
106
|
-
message: [],
|
|
107
|
-
state: interface_1.ExecuteState.NONE
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (this.target_log.logs.length > this.task_index) {
|
|
111
|
-
this.target_log.logs[this.task_index].task_state.state = interface_1.ExecuteState.RUNNING;
|
|
112
|
-
this.target_log.logs[this.task_index].start_timer = Date.now();
|
|
113
|
-
this.target_log.dirty = true;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
this.execute_task_finish = (d) => {
|
|
117
|
-
if (this.target_log == undefined)
|
|
118
|
-
return;
|
|
119
|
-
if (this.target_log.logs.length > this.task_index) {
|
|
120
|
-
this.target_log.logs[this.task_index].task_state.state = interface_1.ExecuteState.FINISH;
|
|
121
|
-
this.target_log.logs[this.task_index].end_timer = Date.now();
|
|
122
|
-
this.target_log.dirty = true;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
this.execute_subtask_start = (d) => {
|
|
126
|
-
if (this.target_log == undefined)
|
|
127
|
-
return;
|
|
128
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
129
|
-
this.target_log.logs[this.task_index].task_detail[d[1]].state = interface_1.ExecuteState.RUNNING;
|
|
130
|
-
this.target_log.dirty = true;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
this.execute_subtask_update = (d) => {
|
|
134
|
-
if (this.target_log == undefined)
|
|
135
|
-
return;
|
|
136
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
137
|
-
this.target_log.logs[this.task_index].task_detail[d[1]].state = d[3];
|
|
138
|
-
this.target_log.dirty = true;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
this.execute_subtask_end = (d) => {
|
|
142
|
-
if (this.target_log == undefined)
|
|
143
|
-
return;
|
|
144
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
145
|
-
this.target_log.logs[this.task_index].task_detail[d[1]].state = interface_1.ExecuteState.FINISH;
|
|
146
|
-
this.target_log.dirty = true;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
this.execute_job_start = (d) => {
|
|
150
|
-
};
|
|
151
|
-
this.execute_job_finish = (d) => {
|
|
152
|
-
if (this.target_log == undefined)
|
|
153
|
-
return;
|
|
154
|
-
if (d[3] == 1) {
|
|
155
|
-
const currentLog = this.target_log;
|
|
156
|
-
const task = currentLog.project.task[this.task_index];
|
|
157
|
-
const index = task.jobs.findIndex(x => x.uuid == d[0].uuid);
|
|
158
|
-
if (index != -1 && task.jobs[index].category == interface_1.JobCategory.Condition) {
|
|
159
|
-
const cr = task.jobs[index].number_args[0];
|
|
160
|
-
if (cr == interface_1.ConditionResult.None)
|
|
161
|
-
return;
|
|
162
|
-
const state = (cr == interface_1.ConditionResult.ThrowTask || cr == interface_1.ConditionResult.ThrowProject) ? interface_1.ExecuteState.ERROR : interface_1.ExecuteState.SKIP;
|
|
163
|
-
const target = this.model.record.task_detail[d[1]];
|
|
164
|
-
if (target != undefined) {
|
|
165
|
-
target.state = state;
|
|
166
|
-
}
|
|
167
|
-
currentLog.logs[this.task_index].task_state.state = state;
|
|
168
|
-
if (cr == interface_1.ConditionResult.Pause)
|
|
169
|
-
return;
|
|
170
|
-
if (cr == interface_1.ConditionResult.SkipProject || cr == interface_1.ConditionResult.ThrowProject) {
|
|
171
|
-
currentLog.state = state;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
this.feedback_message = (d) => {
|
|
177
|
-
if (this.target_log == undefined)
|
|
178
|
-
return;
|
|
179
|
-
if (d.index == undefined || d.index == -1)
|
|
180
|
-
return;
|
|
181
|
-
if (this.target_log == undefined)
|
|
182
|
-
return;
|
|
183
|
-
if (this.target_log.logs[this.task_index].task_detail.length > d.index) {
|
|
184
|
-
this.target_log.logs[this.task_index].task_detail[d.index].message.push(d.message);
|
|
185
|
-
this.target_log.dirty = true;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
console.warn("Try access message by index but failed: ", d);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
this.update_runtime_database = (d) => {
|
|
192
|
-
if (this.target_log != undefined) {
|
|
193
|
-
this.target_log.database = d;
|
|
194
|
-
this.target_log.dirty = true;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
this.getnewname = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
const root = "data/log";
|
|
199
|
-
let count = 0;
|
|
200
|
-
let filename = name;
|
|
201
|
-
let p = `${root}/${filename}`;
|
|
202
|
-
while (fs.existsSync(p + ".json")) {
|
|
203
|
-
count = count + 1;
|
|
204
|
-
filename = `${name} ${count}`;
|
|
205
|
-
p = `${root}/${filename}`;
|
|
206
|
-
}
|
|
207
|
-
return filename;
|
|
208
|
-
});
|
|
209
50
|
this.model = _model;
|
|
210
51
|
this.logs = _log;
|
|
211
52
|
this.preference = _preference;
|
|
@@ -226,5 +67,158 @@ class Util_Server_Log_Proxy {
|
|
|
226
67
|
};
|
|
227
68
|
return d;
|
|
228
69
|
}
|
|
70
|
+
execute_project_start = async (d) => {
|
|
71
|
+
const target = this.model.record.projects[this.model.record.project_index];
|
|
72
|
+
const title = await this.getnewname(target.title);
|
|
73
|
+
this.uuid = (0, uuid_1.v6)();
|
|
74
|
+
const newlog = {
|
|
75
|
+
uuid: this.uuid,
|
|
76
|
+
filename: title,
|
|
77
|
+
dirty: true,
|
|
78
|
+
output: this.preference.log,
|
|
79
|
+
project: target,
|
|
80
|
+
state: interface_1.ExecuteState.RUNNING,
|
|
81
|
+
start_timer: Date.now(),
|
|
82
|
+
database: d[0].database,
|
|
83
|
+
end_timer: 0,
|
|
84
|
+
logs: target.task.map(x => {
|
|
85
|
+
return {
|
|
86
|
+
start_timer: 0,
|
|
87
|
+
end_timer: 0,
|
|
88
|
+
task_state: {
|
|
89
|
+
uuid: x.uuid,
|
|
90
|
+
state: interface_1.ExecuteState.NONE
|
|
91
|
+
},
|
|
92
|
+
task_detail: []
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
this.logs.logs = [newlog].concat(this.logs.logs);
|
|
97
|
+
};
|
|
98
|
+
execute_project_finish = (d) => {
|
|
99
|
+
if (this.target_log == undefined)
|
|
100
|
+
return;
|
|
101
|
+
this.target_log.state = interface_1.ExecuteState.FINISH;
|
|
102
|
+
this.target_log.end_timer = Date.now();
|
|
103
|
+
this.target_log.dirty = true;
|
|
104
|
+
};
|
|
105
|
+
execute_task_start = (d) => {
|
|
106
|
+
if (this.target_log == undefined)
|
|
107
|
+
return;
|
|
108
|
+
const index = this.target_log.project.task.findIndex(x => x.uuid == d[0].uuid);
|
|
109
|
+
if (index == -1)
|
|
110
|
+
return;
|
|
111
|
+
this.task_index = index;
|
|
112
|
+
this.target_log.logs[this.task_index].task_detail = [];
|
|
113
|
+
const p = this.model.record.projects[this.model.record.project_index];
|
|
114
|
+
const t = p.task[this.task_index];
|
|
115
|
+
const count = this.model.manager.get_task_state_count(t);
|
|
116
|
+
for (let i = 0; i < count; i++) {
|
|
117
|
+
this.target_log.logs[this.task_index].task_detail.push({
|
|
118
|
+
index: i,
|
|
119
|
+
node: "",
|
|
120
|
+
message: [],
|
|
121
|
+
state: interface_1.ExecuteState.NONE
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (this.target_log.logs.length > this.task_index) {
|
|
125
|
+
this.target_log.logs[this.task_index].task_state.state = interface_1.ExecuteState.RUNNING;
|
|
126
|
+
this.target_log.logs[this.task_index].start_timer = Date.now();
|
|
127
|
+
this.target_log.dirty = true;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
execute_task_finish = (d) => {
|
|
131
|
+
if (this.target_log == undefined)
|
|
132
|
+
return;
|
|
133
|
+
if (this.target_log.logs.length > this.task_index) {
|
|
134
|
+
this.target_log.logs[this.task_index].task_state.state = interface_1.ExecuteState.FINISH;
|
|
135
|
+
this.target_log.logs[this.task_index].end_timer = Date.now();
|
|
136
|
+
this.target_log.dirty = true;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
execute_subtask_start = (d) => {
|
|
140
|
+
if (this.target_log == undefined)
|
|
141
|
+
return;
|
|
142
|
+
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
143
|
+
this.target_log.logs[this.task_index].task_detail[d[1]].state = interface_1.ExecuteState.RUNNING;
|
|
144
|
+
this.target_log.dirty = true;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
execute_subtask_update = (d) => {
|
|
148
|
+
if (this.target_log == undefined)
|
|
149
|
+
return;
|
|
150
|
+
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
151
|
+
this.target_log.logs[this.task_index].task_detail[d[1]].state = d[3];
|
|
152
|
+
this.target_log.dirty = true;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
execute_subtask_end = (d) => {
|
|
156
|
+
if (this.target_log == undefined)
|
|
157
|
+
return;
|
|
158
|
+
if (this.target_log.logs[this.task_index].task_detail.length > d[1]) {
|
|
159
|
+
this.target_log.logs[this.task_index].task_detail[d[1]].state = interface_1.ExecuteState.FINISH;
|
|
160
|
+
this.target_log.dirty = true;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
execute_job_start = (d) => {
|
|
164
|
+
};
|
|
165
|
+
execute_job_finish = (d) => {
|
|
166
|
+
if (this.target_log == undefined)
|
|
167
|
+
return;
|
|
168
|
+
if (d[3] == 1) {
|
|
169
|
+
const currentLog = this.target_log;
|
|
170
|
+
const task = currentLog.project.task[this.task_index];
|
|
171
|
+
const index = task.jobs.findIndex(x => x.uuid == d[0].uuid);
|
|
172
|
+
if (index != -1 && task.jobs[index].category == interface_1.JobCategory.Condition) {
|
|
173
|
+
const cr = task.jobs[index].number_args[0];
|
|
174
|
+
if (cr == interface_1.ConditionResult.None)
|
|
175
|
+
return;
|
|
176
|
+
const state = (cr == interface_1.ConditionResult.ThrowTask || cr == interface_1.ConditionResult.ThrowProject) ? interface_1.ExecuteState.ERROR : interface_1.ExecuteState.SKIP;
|
|
177
|
+
const target = this.model.record.task_detail[d[1]];
|
|
178
|
+
if (target != undefined) {
|
|
179
|
+
target.state = state;
|
|
180
|
+
}
|
|
181
|
+
currentLog.logs[this.task_index].task_state.state = state;
|
|
182
|
+
if (cr == interface_1.ConditionResult.Pause)
|
|
183
|
+
return;
|
|
184
|
+
if (cr == interface_1.ConditionResult.SkipProject || cr == interface_1.ConditionResult.ThrowProject) {
|
|
185
|
+
currentLog.state = state;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
feedback_message = (d) => {
|
|
191
|
+
if (this.target_log == undefined)
|
|
192
|
+
return;
|
|
193
|
+
if (d.index == undefined || d.index == -1)
|
|
194
|
+
return;
|
|
195
|
+
if (this.target_log == undefined)
|
|
196
|
+
return;
|
|
197
|
+
if (this.target_log.logs[this.task_index].task_detail.length > d.index) {
|
|
198
|
+
this.target_log.logs[this.task_index].task_detail[d.index].message.push(d.message);
|
|
199
|
+
this.target_log.dirty = true;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
console.warn("Try access message by index but failed: ", d);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
update_runtime_database = (d) => {
|
|
206
|
+
if (this.target_log != undefined) {
|
|
207
|
+
this.target_log.database = d;
|
|
208
|
+
this.target_log.dirty = true;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
getnewname = async (name) => {
|
|
212
|
+
const root = "data/log";
|
|
213
|
+
let count = 0;
|
|
214
|
+
let filename = name;
|
|
215
|
+
let p = `${root}/${filename}`;
|
|
216
|
+
while (fs.existsSync(p + ".json")) {
|
|
217
|
+
count = count + 1;
|
|
218
|
+
filename = `${name} ${count}`;
|
|
219
|
+
p = `${root}/${filename}`;
|
|
220
|
+
}
|
|
221
|
+
return filename;
|
|
222
|
+
};
|
|
229
223
|
}
|
|
230
224
|
exports.Util_Server_Log_Proxy = Util_Server_Log_Proxy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test/TEST.js
CHANGED
|
@@ -32,74 +32,57 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
const pem = __importStar(require("pem"));
|
|
46
37
|
const https = __importStar(require("https"));
|
|
47
38
|
const ws = __importStar(require("ws"));
|
|
48
39
|
let h = undefined;
|
|
49
40
|
let w = undefined;
|
|
50
|
-
function get_pem() {
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
resolve([keys.clientKey, keys.certificate]);
|
|
55
|
-
});
|
|
41
|
+
async function get_pem() {
|
|
42
|
+
return new Promise(resolve => {
|
|
43
|
+
pem.createCertificate({ days: 1, selfSigned: true }, (err, keys) => {
|
|
44
|
+
resolve([keys.clientKey, keys.certificate]);
|
|
56
45
|
});
|
|
57
46
|
});
|
|
58
47
|
}
|
|
59
|
-
function start_server() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
console.log("Recevied Data: ", data.toString());
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
h.listen(10000, () => {
|
|
80
|
-
console.log("Listen to 10000");
|
|
48
|
+
async function start_server() {
|
|
49
|
+
const pems = await get_pem();
|
|
50
|
+
h = https.createServer({ key: pems[0], cert: pems[1], minVersion: 'TLSv1.2', maxVersion: 'TLSv1.3' }, (req, res) => {
|
|
51
|
+
res.writeHead(200);
|
|
52
|
+
res.end('HTTPS server is running');
|
|
53
|
+
});
|
|
54
|
+
h.addListener('upgrade', (req, res, head) => console.log('UPGRADE:', req.url));
|
|
55
|
+
w = new ws.Server({ server: h });
|
|
56
|
+
w.on('listening', (socket) => {
|
|
57
|
+
console.log("Listen Event");
|
|
58
|
+
});
|
|
59
|
+
w.on('error', (err) => {
|
|
60
|
+
console.log("Error Event");
|
|
61
|
+
});
|
|
62
|
+
w.on('connection', (socket) => {
|
|
63
|
+
socket.on('message', (data) => {
|
|
64
|
+
console.log("Recevied Data: ", data.toString());
|
|
81
65
|
});
|
|
82
66
|
});
|
|
67
|
+
h.listen(10000, () => {
|
|
68
|
+
console.log("Listen to 10000");
|
|
69
|
+
});
|
|
83
70
|
}
|
|
84
|
-
function start_client() {
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
console.log("Socket Error: ", err);
|
|
90
|
-
});
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
cli.send("Hello World");
|
|
93
|
-
cli.close();
|
|
94
|
-
resolve(undefined);
|
|
95
|
-
}, 1000);
|
|
71
|
+
async function start_client() {
|
|
72
|
+
return new Promise((resolve) => {
|
|
73
|
+
const cli = new ws.WebSocket("wss://127.0.0.1:10000", { agent: new https.Agent(), rejectUnauthorized: false });
|
|
74
|
+
cli.on('error', (err) => {
|
|
75
|
+
console.log("Socket Error: ", err);
|
|
96
76
|
});
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
cli.send("Hello World");
|
|
79
|
+
cli.close();
|
|
80
|
+
resolve(undefined);
|
|
81
|
+
}, 1000);
|
|
97
82
|
});
|
|
98
83
|
}
|
|
99
|
-
function main() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
yield start_client();
|
|
103
|
-
});
|
|
84
|
+
async function main() {
|
|
85
|
+
await start_server();
|
|
86
|
+
await start_client();
|
|
104
87
|
}
|
|
105
88
|
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const job_execute_1 = require("../../src/client/job_execute");
|
|
13
4
|
const interface_1 = require("../../src/interface");
|
|
@@ -17,7 +8,7 @@ describe("Client Execute Test", () => {
|
|
|
17
8
|
afterAll(() => {
|
|
18
9
|
execute = undefined;
|
|
19
10
|
});
|
|
20
|
-
test("Testing condition (OS when path not exist)", () =>
|
|
11
|
+
test("Testing condition (OS when path not exist)", async () => {
|
|
21
12
|
job = {
|
|
22
13
|
index: 0,
|
|
23
14
|
uuid: "UUID",
|
|
@@ -31,9 +22,9 @@ describe("Client Execute Test", () => {
|
|
|
31
22
|
id_args: [],
|
|
32
23
|
};
|
|
33
24
|
execute = new job_execute_1.ClientJobExecute((str) => console.log(str), (str) => console.log(str), job, undefined, { plugins: [] });
|
|
34
|
-
|
|
35
|
-
})
|
|
36
|
-
test("Testing condition (OS when path exist)", () =>
|
|
25
|
+
await expect(execute.execute()).rejects.toBeDefined();
|
|
26
|
+
});
|
|
27
|
+
test("Testing condition (OS when path exist)", async () => {
|
|
37
28
|
job = {
|
|
38
29
|
index: 0,
|
|
39
30
|
uuid: "UUID",
|
|
@@ -47,6 +38,6 @@ describe("Client Execute Test", () => {
|
|
|
47
38
|
id_args: [],
|
|
48
39
|
};
|
|
49
40
|
execute = new job_execute_1.ClientJobExecute((str) => console.log(str), (str) => console.log(str), job, undefined, { plugins: [] });
|
|
50
|
-
|
|
51
|
-
})
|
|
41
|
+
await expect(execute.execute()).resolves.toBeDefined();
|
|
42
|
+
});
|
|
52
43
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const job_database_1 = require("../../src/client/job_database");
|
|
13
4
|
const javascript_1 = require("../../src/client/javascript");
|
|
@@ -44,17 +35,17 @@ describe("JS Test", () => {
|
|
|
44
35
|
database = undefined;
|
|
45
36
|
lib = undefined;
|
|
46
37
|
});
|
|
47
|
-
test("Env test getter", () =>
|
|
48
|
-
expect(
|
|
49
|
-
expect(
|
|
50
|
-
expect(
|
|
51
|
-
expect(
|
|
52
|
-
expect(
|
|
53
|
-
expect(
|
|
54
|
-
expect(
|
|
55
|
-
})
|
|
56
|
-
test("Env test loop", () =>
|
|
57
|
-
expect(
|
|
38
|
+
test("Env test getter", async () => {
|
|
39
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getnumber("n1");`, [])).toBe(7);
|
|
40
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getnumber("n2");`, [])).toBe(5);
|
|
41
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getstring("s1");`, [])).toBe("Hello World");
|
|
42
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getboolean("b1");`, [])).toBe(true);
|
|
43
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getnumber("nnn");`, [])).toBe(undefined);
|
|
44
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getstring("sss");`, [])).toBe(undefined);
|
|
45
|
+
expect(await js.JavascriptExecuteWithLib(`return env.getboolean("bbb");`, [])).toBe(undefined);
|
|
46
|
+
});
|
|
47
|
+
test("Env test loop", async () => {
|
|
48
|
+
expect(await js.JavascriptExecuteWithLib(`
|
|
58
49
|
result = 0;
|
|
59
50
|
n = env.getnumber("n2");
|
|
60
51
|
for(i=0;i<3;i++){
|
|
@@ -62,14 +53,14 @@ describe("JS Test", () => {
|
|
|
62
53
|
}
|
|
63
54
|
return result;
|
|
64
55
|
`, [])).toBe(15);
|
|
65
|
-
})
|
|
66
|
-
test("Env test has", () =>
|
|
67
|
-
expect(
|
|
68
|
-
expect(
|
|
69
|
-
expect(
|
|
70
|
-
expect(
|
|
71
|
-
expect(
|
|
72
|
-
expect(
|
|
73
|
-
expect(
|
|
74
|
-
})
|
|
56
|
+
});
|
|
57
|
+
test("Env test has", async () => {
|
|
58
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasnumber("n1");`, [])).toBe(true);
|
|
59
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasnumber("n2");`, [])).toBe(true);
|
|
60
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasstring("s1");`, [])).toBe(true);
|
|
61
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasboolean("b1");`, [])).toBe(true);
|
|
62
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasnumber("nnn");`, [])).toBe(false);
|
|
63
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasstring("sss");`, [])).toBe(false);
|
|
64
|
+
expect(await js.JavascriptExecuteWithLib(`return env.hasboolean("bbb");`, [])).toBe(false);
|
|
65
|
+
});
|
|
75
66
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -28,7 +28,7 @@ describe("Express Test", () => {
|
|
|
28
28
|
description: "This is a test task",
|
|
29
29
|
setupjob: false,
|
|
30
30
|
cronjob: cronjob ? true : false,
|
|
31
|
-
cronjobKey: cronjob
|
|
31
|
+
cronjobKey: cronjob ?? "",
|
|
32
32
|
multi: false,
|
|
33
33
|
multiKey: "",
|
|
34
34
|
properties: property,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "es2024",
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
5
6
|
"strict": true,
|
|
7
|
+
"declaration": true,
|
|
6
8
|
"esModuleInterop": true,
|
|
7
9
|
"resolveJsonModule": true,
|
|
8
10
|
"skipLibCheck": false,
|
|
@@ -10,6 +12,6 @@
|
|
|
10
12
|
"outDir": "dist",
|
|
11
13
|
"allowJs": true,
|
|
12
14
|
"removeComments": true,
|
|
13
|
-
"noImplicitAny": false
|
|
15
|
+
"noImplicitAny": false
|
|
14
16
|
}
|
|
15
17
|
}
|