adminforth 2.27.0-next.17 → 2.27.0-next.18
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/commands/callTsProxy.js +10 -5
- package/commands/proxy.ts +18 -10
- package/dist/commands/proxy.js +14 -10
- package/dist/commands/proxy.js.map +1 -1
- package/package.json +1 -1
package/commands/callTsProxy.js
CHANGED
|
@@ -25,11 +25,11 @@ export function callTsProxy(tsCode, silent=false) {
|
|
|
25
25
|
const child = spawn("tsx", [path.join(currentFileFolder, "proxy.ts")], {
|
|
26
26
|
env: process.env,
|
|
27
27
|
});
|
|
28
|
-
let stdout = "";
|
|
29
28
|
let stderr = "";
|
|
29
|
+
let stdoutLogs = [];
|
|
30
30
|
|
|
31
31
|
child.stdout.on("data", (data) => {
|
|
32
|
-
|
|
32
|
+
stdoutLogs.push(data.toString());
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
child.stderr.on("data", (data) => {
|
|
@@ -39,7 +39,12 @@ export function callTsProxy(tsCode, silent=false) {
|
|
|
39
39
|
child.on("close", (code) => {
|
|
40
40
|
if (code === 0) {
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
42
|
+
const tsProxyResult = stdoutLogs.find(log => log.includes('>>>>>>>'));
|
|
43
|
+
const preparedStdout = tsProxyResult.slice(tsProxyResult.indexOf('>>>>>>>') + 46, tsProxyResult.lastIndexOf('<<<<<<<'));
|
|
44
|
+
const preparedStdoutLogs = stdoutLogs.filter(log => !log.includes('>>>>>>>'));
|
|
45
|
+
for (const log of preparedStdoutLogs) {
|
|
46
|
+
console.log(log);
|
|
47
|
+
}
|
|
43
48
|
const parsed = JSON.parse(preparedStdout);
|
|
44
49
|
if (!silent) {
|
|
45
50
|
parsed.capturedLogs.forEach((log) => {
|
|
@@ -52,10 +57,10 @@ export function callTsProxy(tsCode, silent=false) {
|
|
|
52
57
|
}
|
|
53
58
|
resolve(parsed.result);
|
|
54
59
|
} catch (e) {
|
|
55
|
-
reject(new Error("Invalid JSON from tsproxy: " +
|
|
60
|
+
reject(new Error("Invalid JSON from tsproxy: " + preparedStdout));
|
|
56
61
|
}
|
|
57
62
|
} else {
|
|
58
|
-
console.error(`tsproxy exited with non-0, this should never happen, stdout: ${
|
|
63
|
+
console.error(`tsproxy exited with non-0, this should never happen, stdout: ${preparedStdout}, stderr: ${stderr}`);
|
|
59
64
|
reject(new Error(stderr));
|
|
60
65
|
}
|
|
61
66
|
});
|
package/commands/proxy.ts
CHANGED
|
@@ -41,19 +41,27 @@ import path from 'path';
|
|
|
41
41
|
|
|
42
42
|
// Restore original console.log
|
|
43
43
|
console.log = origLog;
|
|
44
|
-
console.log(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
console.log(
|
|
45
|
+
">>>>>>>"+
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
result,
|
|
48
|
+
capturedLogs,
|
|
49
|
+
error: null
|
|
50
|
+
})
|
|
51
|
+
+"<<<<<<<"
|
|
52
|
+
);
|
|
49
53
|
} catch (error: any) {
|
|
50
54
|
// Restore original console.log
|
|
51
55
|
console.log = origLog;
|
|
52
|
-
console.log(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
console.log(
|
|
57
|
+
">>>>>>>"+
|
|
58
|
+
JSON.stringify({
|
|
59
|
+
error: error.message,
|
|
60
|
+
stack: error.stack,
|
|
61
|
+
capturedLogs
|
|
62
|
+
})
|
|
63
|
+
+"<<<<<<<"
|
|
64
|
+
);
|
|
57
65
|
} finally {
|
|
58
66
|
await unlink(tmpFile).catch(() => {});
|
|
59
67
|
}
|
package/dist/commands/proxy.js
CHANGED
|
@@ -49,20 +49,24 @@ import path from 'path';
|
|
|
49
49
|
const result = await Promise.resolve(module.exec());
|
|
50
50
|
// Restore original console.log
|
|
51
51
|
console.log = origLog;
|
|
52
|
-
console.log(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
console.log(">>>>>>>" +
|
|
53
|
+
JSON.stringify({
|
|
54
|
+
result,
|
|
55
|
+
capturedLogs,
|
|
56
|
+
error: null
|
|
57
|
+
})
|
|
58
|
+
+ "<<<<<<<");
|
|
57
59
|
}
|
|
58
60
|
catch (error) {
|
|
59
61
|
// Restore original console.log
|
|
60
62
|
console.log = origLog;
|
|
61
|
-
console.log(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
console.log(">>>>>>>" +
|
|
64
|
+
JSON.stringify({
|
|
65
|
+
error: error.message,
|
|
66
|
+
stack: error.stack,
|
|
67
|
+
capturedLogs
|
|
68
|
+
})
|
|
69
|
+
+ "<<<<<<<");
|
|
66
70
|
}
|
|
67
71
|
finally {
|
|
68
72
|
await unlink(tmpFile).catch(() => { });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../commands/proxy.ts"],"names":[],"mappings":";;;;;;;AAAA,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,CAAC,KAAK,IAAI,EAAE;;IACV,MAAM,MAAM,GAAa,EAAE,CAAC;;QAE5B,KAA0B,eAAA,KAAA,cAAA,OAAO,CAAC,KAAK,CAAA,IAAA,sDAAE,CAAC;YAAhB,cAAa;YAAb,WAAa;YAA5B,MAAM,KAAK,KAAA,CAAA;YACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;;;;;;;;;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE9C,MAAM,WAAW,GAAG,gBAAgB,UAAU,EAAE,KAAK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