qcobjects-cli 2.3.50 → 2.4.21
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/.github/FUNDING.yml +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/ISSUE_TEMPLATE/issue-template.md +33 -0
- package/.github/workflows/codeql-analysis.yml +71 -0
- package/.github/workflows/npmpublish-beta.yml +38 -0
- package/.github/workflows/npmpublish-lts.yml +38 -0
- package/.github/workflows/npmpublish-main.yml +38 -0
- package/.gitlab-ci.yml +3 -2
- package/VERSION +1 -1
- package/backend/com.qcobjects.backend.microservice.static.js +40 -24
- package/backend/org.qcobjects.backend.php.js +149 -116
- package/{org.quickcorp.qcobjects.cli.commands.jira.client_services.js → com.qcobjects.cli.commands.jira.client_services.js} +29 -22
- package/{org.quickcorp.qcobjects.cli.commands.jira.js → com.qcobjects.cli.commands.jira.js} +77 -60
- package/{org.quickcorp.qcobjects.cli.commands.js → com.qcobjects.cli.commands.js} +3 -3
- package/com.qcobjects.cli.commands.version.js +285 -0
- package/org.qcobjects.common.pipelog.js +55 -0
- package/org.qcobjects.enterprise.commands.js +149 -139
- package/org.quickcorp.qcobjects.api.client_services.js +31 -20
- package/org.quickcorp.qcobjects.cli.js +288 -275
- package/org.quickcorp.qcobjects.collab.server.js +317 -308
- package/org.quickcorp.qcobjects.defaultsettings.js +1 -1
- package/org.quickcorp.qcobjects.main.file.js +100 -79
- package/org.quickcorp.qcobjects.main.http.gae.server.js +264 -232
- package/org.quickcorp.qcobjects.main.http.server.js +155 -145
- package/org.quickcorp.qcobjects.main.http2.server.js +198 -191
- package/package.json +18 -10
- package/qcobjects-cli.js +8 -11
- package/qcobjects-collab.js +8 -6
- package/qcobjects-createcert.js +28 -16
- package/qcobjects-gae-http-server.js +8 -5
- package/qcobjects-http-server.js +7 -5
- package/qcobjects-http2-server.js +8 -5
- package/qcobjects-shell.js +113 -107
- package/org.quickcorp.qcobjects.cli.commands.version.js +0 -267
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QCObjects CLI 2.
|
|
2
|
+
* QCObjects CLI 2.4.x
|
|
3
3
|
* ________________
|
|
4
4
|
*
|
|
5
5
|
* Author: Jean Machuca <correojean@gmail.com>
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
/*eslint strict: "off"*/
|
|
29
29
|
/*eslint no-mixed-operators: "off"*/
|
|
30
30
|
/*eslint no-undef: "off"*/
|
|
31
|
-
/*eslint no-global-assign: "off"*/
|
|
32
31
|
"use strict";
|
|
33
32
|
const os = require("os");
|
|
34
33
|
const fs = require("fs");
|
|
@@ -76,335 +75,345 @@ You can also use a Unix Socket to connect yourself to the engine:
|
|
|
76
75
|
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (_equal_sign === "="){
|
|
143
|
-
var cmdArguments = commandArgs.slice(2).join(" ");
|
|
144
|
-
_rplServer.clearBufferedCommand();
|
|
145
|
-
logger.debug(`Executing... ${cmdArguments}`);
|
|
146
|
-
exec(cmdArguments, (err, stdout, stderr) => {
|
|
147
|
-
try {
|
|
148
|
-
_rplServer.context[_variableName] = JSON.parse(stdout);
|
|
149
|
-
} catch (e){
|
|
150
|
-
logger.debug("It was not possible to parse the data.");
|
|
151
|
-
}
|
|
78
|
+
Package("org.quickcorp.qcobjects.collab.server",[
|
|
79
|
+
class CollabServer extends InheritClass {
|
|
80
|
+
constructor(){
|
|
81
|
+
super(...arguments);
|
|
82
|
+
this.protected_symbols= [ "clearInterval",
|
|
83
|
+
"clearTimeout",
|
|
84
|
+
"setInterval",
|
|
85
|
+
"setTimeout", "queueMicrotask",
|
|
86
|
+
"clearImmediate", "setImmediate", "_asyncLoad",
|
|
87
|
+
"_fireAsyncLoad", "asyncLoad", "logger",
|
|
88
|
+
"_Crypt", "CONFIG", "waitUntil",
|
|
89
|
+
"_super_", "ComplexStorageCache", "TagElements",
|
|
90
|
+
"onload", "InheritClass", "Component",
|
|
91
|
+
"Controller", "View", "Service",
|
|
92
|
+
"JSONService", "ConfigService", "VO",
|
|
93
|
+
"serviceLoader", "componentLoader", "ComponentURI",
|
|
94
|
+
"SourceJS", "SourceCSS", "ArrayList",
|
|
95
|
+
"ArrayCollection", "Effect", "Timer",
|
|
96
|
+
"Export", "Import", "Package",
|
|
97
|
+
"Class", "New", "Tag",
|
|
98
|
+
"Ready", "Contact", "FormField",
|
|
99
|
+
"ButtonField", "InputField", "TextField",
|
|
100
|
+
"EmailField", "GridComponent", "GridController",
|
|
101
|
+
"GridView", "Move", "RotateX",
|
|
102
|
+
"RotateY", "RotateZ", "Rotate",
|
|
103
|
+
"Fade", "Radius", "CanvasTool",
|
|
104
|
+
"BasicLayout"
|
|
105
|
+
];
|
|
106
|
+
this.commands= {
|
|
107
|
+
loadcmd_json:{
|
|
108
|
+
help: `
|
|
109
|
+
Executes a CMD Shell Command
|
|
110
|
+
and loads the stdout to a variable after trying to convert the result
|
|
111
|
+
to JSON format
|
|
112
|
+
The first argument is the variable name followed by an equal sign "=".
|
|
113
|
+
Example:
|
|
114
|
+
> .loadcmd_json result = cat somefile.json
|
|
115
|
+
|
|
116
|
+
The above command will save the content of somefile.json using cat into the variable global.result
|
|
117
|
+
as JSON format
|
|
118
|
+
`,
|
|
119
|
+
action(args) {
|
|
120
|
+
let _rplServer = this;
|
|
121
|
+
var commandArgs = args.split(" ");
|
|
122
|
+
if (commandArgs.length>2){
|
|
123
|
+
var _variableName = commandArgs[0];
|
|
124
|
+
var _equal_sign = commandArgs[1].toString();
|
|
125
|
+
if (_equal_sign === "="){
|
|
126
|
+
var cmdArguments = commandArgs.slice(2).join(" ");
|
|
127
|
+
_rplServer.clearBufferedCommand();
|
|
128
|
+
logger.debug(`Executing... ${cmdArguments}`);
|
|
129
|
+
exec(cmdArguments, (err, stdout, stderr) => {
|
|
130
|
+
try {
|
|
131
|
+
_rplServer.context[_variableName] = JSON.parse(stdout);
|
|
132
|
+
} catch (e){
|
|
133
|
+
logger.debug("It was not possible to parse the data.");
|
|
134
|
+
}
|
|
135
|
+
_rplServer.displayPrompt();
|
|
136
|
+
}).stdout.on("data", function(data) {
|
|
137
|
+
console.log(data);
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
console.log("That is no good my friend. You need to specify an equal sign.");
|
|
152
141
|
_rplServer.displayPrompt();
|
|
153
|
-
}
|
|
154
|
-
console.log(data);
|
|
155
|
-
});
|
|
142
|
+
}
|
|
156
143
|
} else {
|
|
157
|
-
console.log("
|
|
144
|
+
console.log("No enough data in the command line. Try .help");
|
|
158
145
|
_rplServer.displayPrompt();
|
|
159
146
|
}
|
|
160
|
-
} else {
|
|
161
|
-
console.log("No enough data in the command line. Try .help");
|
|
162
|
-
_rplServer.displayPrompt();
|
|
163
147
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
148
|
+
},
|
|
149
|
+
loadcmd_str:{
|
|
150
|
+
help: `
|
|
151
|
+
Executes a CMD Shell Command
|
|
152
|
+
and loads the stdout to a variable.
|
|
153
|
+
The first argument is the variable name followed by an equal sign "=".
|
|
154
|
+
Example:
|
|
155
|
+
> .loadcmd_str foo = ls *
|
|
156
|
+
|
|
157
|
+
The above command will save the output of "ls *" into the variable global.foo as string
|
|
158
|
+
`,
|
|
159
|
+
action(args) {
|
|
160
|
+
let _rplServer = this;
|
|
161
|
+
var commandArgs = args.split(" ");
|
|
162
|
+
if (commandArgs.length>2){
|
|
163
|
+
var _variableName = commandArgs[0];
|
|
164
|
+
var _equal_sign = commandArgs[1].toString();
|
|
165
|
+
if (_equal_sign === "="){
|
|
166
|
+
var cmdArguments = commandArgs.slice(2).join(" ");
|
|
167
|
+
_rplServer.clearBufferedCommand();
|
|
168
|
+
logger.debug(`Executing... ${cmdArguments}`);
|
|
169
|
+
exec(cmdArguments, (err, stdout, stderr) => {
|
|
170
|
+
_rplServer.context[_variableName] = stdout;
|
|
171
|
+
_rplServer.displayPrompt();
|
|
172
|
+
}).stdout.on("data", function(data) {
|
|
173
|
+
console.log(data);
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
console.log("That is no good my friend. You need to specify an equal sign.");
|
|
188
177
|
_rplServer.displayPrompt();
|
|
189
|
-
}
|
|
190
|
-
console.log(data);
|
|
191
|
-
});
|
|
178
|
+
}
|
|
192
179
|
} else {
|
|
193
|
-
console.log("
|
|
180
|
+
console.log("No enough data in the command line. Try .help");
|
|
194
181
|
_rplServer.displayPrompt();
|
|
195
182
|
}
|
|
196
|
-
} else {
|
|
197
|
-
console.log("No enough data in the command line. Try .help");
|
|
198
|
-
_rplServer.displayPrompt();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
save_json:{
|
|
203
|
-
help: `
|
|
204
|
-
Serializes a variable using JSON.stringify
|
|
205
|
-
and saves it in a file.
|
|
206
|
-
The first argument is the variable name and the second argument is the name of the file.
|
|
207
|
-
Example:
|
|
208
|
-
> .save_json foo ./filename
|
|
209
|
-
|
|
210
|
-
The above command will save the stringified content of foo into ./filename
|
|
211
|
-
`,
|
|
212
|
-
action(args) {
|
|
213
|
-
let _rplServer = this;
|
|
214
|
-
var commandArgs = args.split(" ");
|
|
215
|
-
if (commandArgs.length>=2){
|
|
216
|
-
var _variableName = commandArgs[0];
|
|
217
|
-
var _filename = commandArgs[1].toString();
|
|
218
|
-
logger.debug(`Saving variable ${_variableName} in ${_filename}...`);
|
|
219
|
-
var data = JSON.stringify(_rplServer.context[_variableName]);
|
|
220
|
-
fs.writeFile(_filename, data, (err) => {
|
|
221
|
-
if (err) throw err;
|
|
222
|
-
logger.debug(`The data of the file ${_filename} has been saved!`);
|
|
223
|
-
_rplServer.displayPrompt();
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
} else {
|
|
227
|
-
console.log("No enough data in the command line. Try .help");
|
|
228
|
-
_rplServer.displayPrompt();
|
|
229
183
|
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
`,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
fs.readFile(_filename,(err, data) => {
|
|
184
|
+
},
|
|
185
|
+
save_json:{
|
|
186
|
+
help: `
|
|
187
|
+
Serializes a variable using JSON.stringify
|
|
188
|
+
and saves it in a file.
|
|
189
|
+
The first argument is the variable name and the second argument is the name of the file.
|
|
190
|
+
Example:
|
|
191
|
+
> .save_json foo ./filename
|
|
192
|
+
|
|
193
|
+
The above command will save the stringified content of foo into ./filename
|
|
194
|
+
`,
|
|
195
|
+
action(args) {
|
|
196
|
+
let _rplServer = this;
|
|
197
|
+
var commandArgs = args.split(" ");
|
|
198
|
+
if (commandArgs.length>=2){
|
|
199
|
+
var _variableName = commandArgs[0];
|
|
200
|
+
var _filename = commandArgs[1].toString();
|
|
201
|
+
logger.debug(`Saving variable ${_variableName} in ${_filename}...`);
|
|
202
|
+
var data = JSON.stringify(_rplServer.context[_variableName]);
|
|
203
|
+
fs.writeFile(_filename, data, (err) => {
|
|
251
204
|
if (err) throw err;
|
|
252
|
-
|
|
253
|
-
_rplServer.context[_variableName] = JSON.parse(data.toString());
|
|
254
|
-
logger.debug(`The data of the file ${_filename} has been loaded!`);
|
|
255
|
-
} catch (e){
|
|
256
|
-
logger.debug("It was not possible to parse the data.");
|
|
257
|
-
}
|
|
205
|
+
logger.debug(`The data of the file ${_filename} has been saved!`);
|
|
258
206
|
_rplServer.displayPrompt();
|
|
259
207
|
});
|
|
208
|
+
|
|
260
209
|
} else {
|
|
261
|
-
console.log("
|
|
210
|
+
console.log("No enough data in the command line. Try .help");
|
|
262
211
|
_rplServer.displayPrompt();
|
|
263
212
|
}
|
|
264
|
-
|
|
265
|
-
} else {
|
|
266
|
-
console.log("No enough data in the command line. Try .help");
|
|
267
|
-
_rplServer.displayPrompt();
|
|
268
213
|
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
global.connections = 0;
|
|
307
|
-
|
|
308
|
-
function unlink_socket (){
|
|
309
|
-
try {
|
|
310
|
-
logger.debug("Trying to delete the socket... ");
|
|
311
|
-
fs.unlink(CONFIG.get("collab-unix-socket",unixsocket_default), (err) => {
|
|
312
|
-
if (err) {
|
|
313
|
-
logger.debug("Unix Socket does not exist");
|
|
214
|
+
},
|
|
215
|
+
load_json:{
|
|
216
|
+
help: `
|
|
217
|
+
Loads a json from a file and saves it into a variable.
|
|
218
|
+
The first argument is the variable name and the second argument is the name of the file.
|
|
219
|
+
Example:
|
|
220
|
+
> .load_json foo = ./filename
|
|
221
|
+
|
|
222
|
+
The above command will load a json from ./filename and save it in global.foo as an object
|
|
223
|
+
`,
|
|
224
|
+
action(args) {
|
|
225
|
+
let _rplServer = this;
|
|
226
|
+
var commandArgs = args.split(" ");
|
|
227
|
+
if (commandArgs.length>2){
|
|
228
|
+
var _variableName = commandArgs[0];
|
|
229
|
+
var _equal_sign = commandArgs[1].toString();
|
|
230
|
+
if (_equal_sign === "="){
|
|
231
|
+
var _filename = commandArgs[2].toString();
|
|
232
|
+
logger.debug(`Trying to read ${_variableName} from ${_filename}...`);
|
|
233
|
+
fs.readFile(_filename,(err, data) => {
|
|
234
|
+
if (err) throw err;
|
|
235
|
+
try {
|
|
236
|
+
_rplServer.context[_variableName] = JSON.parse(data.toString());
|
|
237
|
+
logger.debug(`The data of the file ${_filename} has been loaded!`);
|
|
238
|
+
} catch (e){
|
|
239
|
+
logger.debug("It was not possible to parse the data.");
|
|
240
|
+
}
|
|
241
|
+
_rplServer.displayPrompt();
|
|
242
|
+
});
|
|
243
|
+
} else {
|
|
244
|
+
console.log("That is no good my friend. You need to specify an equal sign.");
|
|
245
|
+
_rplServer.displayPrompt();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
} else {
|
|
249
|
+
console.log("No enough data in the command line. Try .help");
|
|
250
|
+
_rplServer.displayPrompt();
|
|
314
251
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
cmd:{
|
|
255
|
+
help: "Executes a CMD Shell Command",
|
|
256
|
+
action() {
|
|
257
|
+
let _rplServer = this;
|
|
258
|
+
var cmdArguments = [...arguments].join(" ");
|
|
259
|
+
_rplServer.clearBufferedCommand();
|
|
260
|
+
logger.debug(`Executing... ${cmdArguments}`);
|
|
261
|
+
exec(cmdArguments, (err, stdout, stderr) => {
|
|
262
|
+
_rplServer.displayPrompt();
|
|
263
|
+
}).stdout.on("data", function(data) {
|
|
264
|
+
console.log(data);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
320
267
|
}
|
|
268
|
+
};
|
|
269
|
+
|
|
321
270
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
271
|
+
|
|
272
|
+
runScript(context){
|
|
273
|
+
const runScript = (code,logOutput=false)=>{
|
|
274
|
+
const options = {filename:sandbox.__filename};
|
|
275
|
+
|
|
276
|
+
const backgroundRunScript = (code)=>{
|
|
277
|
+
var output = vm.runInContext(code,context,options);
|
|
278
|
+
return output;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
var output = backgroundRunScript(code);
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
if (logOutput && typeof output !== "undefined"){
|
|
285
|
+
console.log(output);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
start (){
|
|
292
|
+
|
|
293
|
+
var collabServer = this;
|
|
294
|
+
const vm = require("vm");
|
|
295
|
+
let sandbox = {
|
|
296
|
+
require:require,
|
|
297
|
+
module:module,
|
|
298
|
+
__dirname:"./",
|
|
299
|
+
__filename:"qcobjects-collab"
|
|
300
|
+
};
|
|
301
|
+
global = require("qcobjects");
|
|
302
|
+
global.require = require.bind(global);
|
|
303
|
+
global.module = module;
|
|
304
|
+
global.__dirname = "./";
|
|
305
|
+
global.__filename = "qcobjects-collab";
|
|
306
|
+
global = vm.createContext(global);
|
|
307
|
+
|
|
308
|
+
var net = require("net"),
|
|
309
|
+
repl = require("repl");
|
|
310
|
+
|
|
311
|
+
global.connections = 0;
|
|
312
|
+
|
|
313
|
+
function unlink_socket (){
|
|
314
|
+
try {
|
|
315
|
+
logger.debug("Trying to delete the socket... ");
|
|
316
|
+
fs.unlink(CONFIG.get("collab-unix-socket",unixsocket_default), (err) => {
|
|
317
|
+
if (err) {
|
|
318
|
+
logger.debug("Unix Socket does not exist");
|
|
319
|
+
}
|
|
320
|
+
logger.debug("Unix Socket was deleted before start");
|
|
321
|
+
});
|
|
322
|
+
} catch (e){
|
|
323
|
+
// socket doesnt exists
|
|
324
|
+
logger.debug("Unix Socket was not deleted");
|
|
325
|
+
}
|
|
328
326
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
let replServer = repl.start({
|
|
332
|
-
useColors: true,
|
|
333
|
-
prompt:"QCObjects Collab> ",
|
|
334
|
-
terminal: true,
|
|
335
|
-
useGlobal: false
|
|
336
|
-
});
|
|
337
|
-
replServer.context = global;
|
|
338
|
-
|
|
339
|
-
replServer.on("exit", () => {
|
|
327
|
+
|
|
340
328
|
unlink_socket();
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
unixReplServer.on("exit", function () {
|
|
363
|
-
unixsocket.end();
|
|
364
|
-
});
|
|
365
|
-
unixReplServer.context=global;
|
|
366
|
-
_defineReplCommands(unixReplServer,collabServer.commands);
|
|
367
|
-
}).listen(CONFIG.get("collab-unix-socket",unixsocket_default));
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
let http_server = net.createServer(function (httpsocket) {
|
|
371
|
-
httpsocket.on("end", () => {
|
|
372
|
-
logger.debug("A http connection was ended");
|
|
329
|
+
|
|
330
|
+
var _defineReplCommands = function (_cmdReplServer,commands){
|
|
331
|
+
for (var _command in commands){
|
|
332
|
+
_cmdReplServer.defineCommand(_command, commands[_command]);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
let replServer = repl.start({
|
|
337
|
+
useColors: true,
|
|
338
|
+
prompt:"QCObjects Collab> ",
|
|
339
|
+
terminal: true,
|
|
340
|
+
useGlobal: false
|
|
341
|
+
});
|
|
342
|
+
replServer.context = global;
|
|
343
|
+
|
|
344
|
+
replServer.on("exit", () => {
|
|
345
|
+
unlink_socket();
|
|
346
|
+
|
|
347
|
+
console.log("Thank you for using QCObjects Collab for Data Science!");
|
|
348
|
+
console.log("Have a nice day!");
|
|
349
|
+
process.exit();
|
|
373
350
|
});
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
,
|
|
380
|
-
|
|
351
|
+
_defineReplCommands(replServer,collabServer.commands);
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
let unixsocket_server = net.createServer(function (unixsocket) {
|
|
356
|
+
unixsocket.on("end", () => {
|
|
357
|
+
logger.debug("A Unix socket connection was ended");
|
|
358
|
+
});
|
|
359
|
+
global.connections += 1;
|
|
360
|
+
let unixReplServer = repl.start({
|
|
361
|
+
prompt: "QCObjects Collab> "
|
|
362
|
+
, input: unixsocket
|
|
363
|
+
, output: unixsocket
|
|
364
|
+
, terminal: true
|
|
365
|
+
, useGlobal: false
|
|
366
|
+
});
|
|
367
|
+
unixReplServer.on("exit", function () {
|
|
368
|
+
unixsocket.end();
|
|
369
|
+
});
|
|
370
|
+
unixReplServer.context=global;
|
|
371
|
+
_defineReplCommands(unixReplServer,collabServer.commands);
|
|
372
|
+
}).listen(CONFIG.get("collab-unix-socket",unixsocket_default));
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
let http_server = net.createServer(function (httpsocket) {
|
|
376
|
+
httpsocket.on("end", () => {
|
|
377
|
+
logger.debug("A http connection was ended");
|
|
378
|
+
});
|
|
379
|
+
global.connections += 1;
|
|
380
|
+
let httpReplServer = repl.start({
|
|
381
|
+
prompt: "QCObjects Collab> "
|
|
382
|
+
, input: httpsocket
|
|
383
|
+
, output: httpsocket
|
|
384
|
+
, terminal: true
|
|
385
|
+
, useGlobal: false
|
|
386
|
+
});
|
|
387
|
+
httpReplServer.on("exit", function () {
|
|
388
|
+
httpsocket.end();
|
|
389
|
+
});
|
|
390
|
+
httpReplServer.context=global;
|
|
391
|
+
_defineReplCommands(httpReplServer,collabServer.commands);
|
|
392
|
+
}).listen(CONFIG.get("collab-port",collab_port_default),CONFIG.get("collab-domain",collab_domain_default));
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
http_server.on("error", function (e) {
|
|
396
|
+
if (e.code == "EADDRINUSE") {
|
|
397
|
+
console.log("Collab HTTP Address in use, retrying...");
|
|
398
|
+
setTimeout(function () {
|
|
399
|
+
http_server.close();
|
|
400
|
+
http_server.listen(CONFIG.get("collab-port",collab_port_default),CONFIG.get("collab-domain",collab_domain_default));
|
|
401
|
+
}, 1000);
|
|
402
|
+
}
|
|
381
403
|
});
|
|
382
|
-
|
|
383
|
-
|
|
404
|
+
|
|
405
|
+
unixsocket_server.on("error", function (e) {
|
|
406
|
+
if (e.code == "EADDRINUSE") {
|
|
407
|
+
console.log("Collab Unix Socket Address in use, retrying...");
|
|
408
|
+
setTimeout(function () {
|
|
409
|
+
unixsocket_server.close();
|
|
410
|
+
unixsocket_server.listen(CONFIG.get("collab-unix-socket",unixsocket_default));
|
|
411
|
+
}, 1000);
|
|
412
|
+
}
|
|
384
413
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
http_server.on("error", function (e) {
|
|
391
|
-
if (e.code == "EADDRINUSE") {
|
|
392
|
-
console.log("Collab HTTP Address in use, retrying...");
|
|
393
|
-
setTimeout(function () {
|
|
394
|
-
http_server.close();
|
|
395
|
-
http_server.listen(CONFIG.get("collab-port",collab_port_default),CONFIG.get("collab-domain",collab_domain_default));
|
|
396
|
-
}, 1000);
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
unixsocket_server.on("error", function (e) {
|
|
401
|
-
if (e.code == "EADDRINUSE") {
|
|
402
|
-
console.log("Collab Unix Socket Address in use, retrying...");
|
|
403
|
-
setTimeout(function () {
|
|
404
|
-
unixsocket_server.close();
|
|
405
|
-
unixsocket_server.listen(CONFIG.get("collab-unix-socket",unixsocket_default));
|
|
406
|
-
}, 1000);
|
|
407
|
-
}
|
|
408
|
-
});
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
|
|
409
417
|
}
|
|
410
|
-
|
|
418
|
+
|
|
419
|
+
]);
|