@milaboratories/pl-deployments 2.4.7 → 2.4.9
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/common/os_and_arch.cjs +39 -0
- package/dist/common/os_and_arch.cjs.map +1 -0
- package/dist/common/os_and_arch.d.ts +0 -1
- package/dist/common/os_and_arch.js +34 -0
- package/dist/common/os_and_arch.js.map +1 -0
- package/dist/common/pl_binary.cjs +34 -0
- package/dist/common/pl_binary.cjs.map +1 -0
- package/dist/common/pl_binary.d.ts +0 -1
- package/dist/common/pl_binary.js +30 -0
- package/dist/common/pl_binary.js.map +1 -0
- package/dist/common/pl_binary_download.cjs +172 -0
- package/dist/common/pl_binary_download.cjs.map +1 -0
- package/dist/common/pl_binary_download.d.ts +0 -1
- package/dist/common/pl_binary_download.js +148 -0
- package/dist/common/pl_binary_download.js.map +1 -0
- package/dist/common/pl_version.cjs +11 -0
- package/dist/common/pl_version.cjs.map +1 -0
- package/dist/common/pl_version.d.ts +0 -1
- package/dist/common/pl_version.js +9 -0
- package/dist/common/pl_version.js.map +1 -0
- package/dist/index.cjs +26 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +5 -64
- package/dist/index.js.map +1 -1
- package/dist/local/options.d.ts +0 -1
- package/dist/local/pid.cjs +24 -0
- package/dist/local/pid.cjs.map +1 -0
- package/dist/local/pid.d.ts +0 -1
- package/dist/local/pid.js +20 -0
- package/dist/local/pid.js.map +1 -0
- package/dist/local/pl.cjs +223 -0
- package/dist/local/pl.cjs.map +1 -0
- package/dist/local/pl.d.ts +0 -1
- package/dist/local/pl.js +198 -0
- package/dist/local/pl.js.map +1 -0
- package/dist/local/process.cjs +77 -0
- package/dist/local/process.cjs.map +1 -0
- package/dist/local/process.d.ts +1 -2
- package/dist/local/process.js +72 -0
- package/dist/local/process.js.map +1 -0
- package/dist/local/trace.cjs +27 -0
- package/dist/local/trace.cjs.map +1 -0
- package/dist/local/trace.d.ts +0 -1
- package/dist/local/trace.js +23 -0
- package/dist/local/trace.js.map +1 -0
- package/dist/package.json.cjs +7 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +5 -0
- package/dist/package.json.js.map +1 -0
- package/dist/ssh/__tests__/common-utils.d.ts +0 -1
- package/dist/ssh/connection_info.cjs +62 -0
- package/dist/ssh/connection_info.cjs.map +1 -0
- package/dist/ssh/connection_info.d.ts +0 -1
- package/dist/ssh/connection_info.js +55 -0
- package/dist/ssh/connection_info.js.map +1 -0
- package/dist/ssh/pl.cjs +500 -0
- package/dist/ssh/pl.cjs.map +1 -0
- package/dist/ssh/pl.d.ts +0 -1
- package/dist/ssh/pl.js +497 -0
- package/dist/ssh/pl.js.map +1 -0
- package/dist/ssh/pl_paths.cjs +67 -0
- package/dist/ssh/pl_paths.cjs.map +1 -0
- package/dist/ssh/pl_paths.d.ts +0 -1
- package/dist/ssh/pl_paths.js +50 -0
- package/dist/ssh/pl_paths.js.map +1 -0
- package/dist/ssh/ssh.cjs +621 -0
- package/dist/ssh/ssh.cjs.map +1 -0
- package/dist/ssh/ssh.d.ts +0 -1
- package/dist/ssh/ssh.js +619 -0
- package/dist/ssh/ssh.js.map +1 -0
- package/dist/ssh/supervisord.cjs +149 -0
- package/dist/ssh/supervisord.cjs.map +1 -0
- package/dist/ssh/supervisord.d.ts +0 -1
- package/dist/ssh/supervisord.js +140 -0
- package/dist/ssh/supervisord.js.map +1 -0
- package/package.json +16 -14
- package/src/common/pl_version.ts +3 -2
- package/src/local/pl.ts +6 -1
- package/src/local/process.ts +40 -3
- package/dist/common/os_and_arch.d.ts.map +0 -1
- package/dist/common/pl_binary.d.ts.map +0 -1
- package/dist/common/pl_binary_download.d.ts.map +0 -1
- package/dist/common/pl_version.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -1366
- package/dist/index.mjs.map +0 -1
- package/dist/local/options.d.ts.map +0 -1
- package/dist/local/pid.d.ts.map +0 -1
- package/dist/local/pl.d.ts.map +0 -1
- package/dist/local/process.d.ts.map +0 -1
- package/dist/local/trace.d.ts.map +0 -1
- package/dist/ssh/__tests__/common-utils.d.ts.map +0 -1
- package/dist/ssh/connection_info.d.ts.map +0 -1
- package/dist/ssh/pl.d.ts.map +0 -1
- package/dist/ssh/pl_paths.d.ts.map +0 -1
- package/dist/ssh/ssh.d.ts.map +0 -1
- package/dist/ssh/supervisord.d.ts.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { execSync, spawn } from 'node:child_process';
|
|
2
|
+
import { sleep } from '@milaboratories/ts-helpers';
|
|
3
|
+
|
|
4
|
+
function processRun(logger, opts) {
|
|
5
|
+
logger.info(`Running:
|
|
6
|
+
cmd: ${JSON.stringify([opts.cmd, ...opts.args])}
|
|
7
|
+
wd: ${opts.opts.cwd}`);
|
|
8
|
+
logger.info(' spawning child process');
|
|
9
|
+
return spawn(opts.cmd, opts.args, opts.opts);
|
|
10
|
+
}
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
12
|
+
async function isProcessAlive(pid) {
|
|
13
|
+
try {
|
|
14
|
+
process.kill(pid, 0);
|
|
15
|
+
// Check we look at 'platforma' to not kill wrong process.
|
|
16
|
+
const processName = getProcessName(pid);
|
|
17
|
+
if (process.platform === 'win32') {
|
|
18
|
+
return processName === 'platforma.exe'; // process name does not contain path to the file.
|
|
19
|
+
}
|
|
20
|
+
// Linux and Mac OS X behave differently (so can different Linux distributions).
|
|
21
|
+
// Process name can contain original path to the binary file or just its name.
|
|
22
|
+
return processName.endsWith('/platforma') || processName === 'platforma';
|
|
23
|
+
}
|
|
24
|
+
catch (_e) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function getProcessName(pid) {
|
|
29
|
+
try {
|
|
30
|
+
if (process.platform === 'win32') {
|
|
31
|
+
// Windows: use tasklist command
|
|
32
|
+
const output = execSync(`tasklist /FI "PID eq ${pid}" /FO CSV /NH`, { encoding: 'utf8' });
|
|
33
|
+
const lines = output.trim().split('\n');
|
|
34
|
+
if (lines.length > 0 && lines[0].includes(',')) {
|
|
35
|
+
const parts = lines[0].split(',');
|
|
36
|
+
if (parts.length >= 1) {
|
|
37
|
+
// Remove quotes and get the executable name
|
|
38
|
+
const exeName = parts[0].replace(/^"|"$/g, '').trim();
|
|
39
|
+
return exeName;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Unix-like systems: use ps command
|
|
45
|
+
const output = execSync(`ps -p ${pid} -o comm=`, { encoding: 'utf8' });
|
|
46
|
+
const processName = output.trim();
|
|
47
|
+
return processName;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (_error) {
|
|
51
|
+
// If we can't get the process name, return empty string
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
function processStop(pid, force = false) {
|
|
57
|
+
return process.kill(pid, force ? 'SIGKILL' : 'SIGINT');
|
|
58
|
+
}
|
|
59
|
+
async function processWaitStopped(pid, maxMs) {
|
|
60
|
+
const sleepMs = 100;
|
|
61
|
+
let total = 0;
|
|
62
|
+
while (await isProcessAlive(pid)) {
|
|
63
|
+
await sleep(sleepMs);
|
|
64
|
+
total += sleepMs;
|
|
65
|
+
if (total > maxMs) {
|
|
66
|
+
throw new Error(`The process did not stopped after ${maxMs} ms.`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { isProcessAlive, processRun, processStop, processWaitStopped };
|
|
72
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sources":["../../src/local/process.ts"],"sourcesContent":["import type { SpawnOptions, ChildProcess } from 'node:child_process';\nimport { spawn } from 'node:child_process';\nimport { execSync } from 'node:child_process';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { sleep } from '@milaboratories/ts-helpers';\n\nexport type ProcessOptions = {\n cmd: string;\n args: string[];\n opts: SpawnOptions;\n};\n\nexport function processRun(logger: MiLogger, opts: ProcessOptions): ChildProcess {\n logger.info(`Running:\ncmd: ${JSON.stringify([opts.cmd, ...opts.args])}\nwd: ${opts.opts.cwd}`);\n\n logger.info(' spawning child process');\n return spawn(opts.cmd, opts.args, opts.opts);\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function isProcessAlive(pid: number) {\n try {\n process.kill(pid, 0);\n\n // Check we look at 'platforma' to not kill wrong process.\n const processName = getProcessName(pid);\n if (process.platform === 'win32') {\n return processName === 'platforma.exe'; // process name does not contain path to the file.\n }\n\n // Linux and Mac OS X behave differently (so can different Linux distributions).\n // Process name can contain original path to the binary file or just its name.\n return processName.endsWith('/platforma') || processName === 'platforma';\n } catch (_e) {\n return false;\n }\n}\n\nfunction getProcessName(pid: number): string {\n try {\n if (process.platform === 'win32') {\n // Windows: use tasklist command\n const output = execSync(`tasklist /FI \"PID eq ${pid}\" /FO CSV /NH`, { encoding: 'utf8' });\n const lines = output.trim().split('\\n');\n if (lines.length > 0 && lines[0].includes(',')) {\n const parts = lines[0].split(',');\n if (parts.length >= 1) {\n // Remove quotes and get the executable name\n const exeName = parts[0].replace(/^\"|\"$/g, '').trim();\n return exeName;\n }\n }\n } else {\n // Unix-like systems: use ps command\n const output = execSync(`ps -p ${pid} -o comm=`, { encoding: 'utf8' });\n const processName = output.trim();\n return processName;\n }\n } catch (_error) {\n // If we can't get the process name, return empty string\n return '';\n }\n return '';\n}\n\nexport function processStop(pid: number, force: boolean = false) {\n return process.kill(pid, force ? 'SIGKILL' : 'SIGINT');\n}\n\nexport async function processWaitStopped(pid: number, maxMs: number) {\n const sleepMs = 100;\n let total = 0;\n while (await isProcessAlive(pid)) {\n await sleep(sleepMs);\n total += sleepMs;\n if (total > maxMs) {\n throw new Error(`The process did not stopped after ${maxMs} ms.`);\n }\n }\n}\n"],"names":[],"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|
4
|
+
return {};
|
|
5
|
+
}
|
|
6
|
+
function trace(t, k, v) {
|
|
7
|
+
t[k] = v;
|
|
8
|
+
return v;
|
|
9
|
+
}
|
|
10
|
+
/** Creates a trace and runs a function with it. The function can record all its
|
|
11
|
+
* logs or traces using `trace` fn. */
|
|
12
|
+
async function withTrace(logger, fn) {
|
|
13
|
+
const t = newTrace();
|
|
14
|
+
try {
|
|
15
|
+
const result = await fn((k, v) => trace(t, k, v), t);
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
logger.error(`error ${e} while doing traced operation, state: ${JSON.stringify(t)}`);
|
|
20
|
+
throw e;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.newTrace = newTrace;
|
|
25
|
+
exports.trace = trace;
|
|
26
|
+
exports.withTrace = withTrace;
|
|
27
|
+
//# sourceMappingURL=trace.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.cjs","sources":["../../src/local/trace.ts"],"sourcesContent":["import type { MiLogger } from '@milaboratories/ts-helpers';\n\n/** Records all inputs and outputs of one's choice, so if the error happened\n * one can check how it was by just printing this structure. */\nexport type Trace = Record<string, any>;\n\nexport function newTrace(): Trace {\n return {};\n}\n\nexport function trace(t: Trace, k: string, v: any) {\n t[k] = v;\n return v;\n}\n\n/** Creates a trace and runs a function with it. The function can record all its\n * logs or traces using `trace` fn. */\nexport async function withTrace<T>(\n logger: MiLogger,\n fn: (trace: (k: string, v: any) => typeof v, t: Trace) => Promise<T>,\n): Promise<T> {\n const t = newTrace();\n try {\n const result = await fn((k: string, v: any) => trace(t, k, v), t);\n return result;\n } catch (e: any) {\n logger.error(`error ${e} while doing traced operation, state: ${JSON.stringify(t)}`);\n throw e;\n }\n}\n"],"names":[],"mappings":";;SAMgB,QAAQ,GAAA;AACtB,IAAA,OAAO,EAAE;AACX;SAEgB,KAAK,CAAC,CAAQ,EAAE,CAAS,EAAE,CAAM,EAAA;AAC/C,IAAA,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACR,IAAA,OAAO,CAAC;AACV;AAEA;AACsC;AAC/B,eAAe,SAAS,CAC7B,MAAgB,EAChB,EAAoE,EAAA;AAEpE,IAAA,MAAM,CAAC,GAAG,QAAQ,EAAE;AACpB,IAAA,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CAAS,EAAE,CAAM,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACjE,QAAA,OAAO,MAAM;IACf;IAAE,OAAO,CAAM,EAAE;AACf,QAAA,MAAM,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,CAAC,CAAA,sCAAA,EAAyC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA,CAAE,CAAC;AACpF,QAAA,MAAM,CAAC;IACT;AACF;;;;;;"}
|
package/dist/local/trace.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ export declare function trace(t: Trace, k: string, v: any): any;
|
|
|
7
7
|
/** Creates a trace and runs a function with it. The function can record all its
|
|
8
8
|
* logs or traces using `trace` fn. */
|
|
9
9
|
export declare function withTrace<T>(logger: MiLogger, fn: (trace: (k: string, v: any) => typeof v, t: Trace) => Promise<T>): Promise<T>;
|
|
10
|
-
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function newTrace() {
|
|
2
|
+
return {};
|
|
3
|
+
}
|
|
4
|
+
function trace(t, k, v) {
|
|
5
|
+
t[k] = v;
|
|
6
|
+
return v;
|
|
7
|
+
}
|
|
8
|
+
/** Creates a trace and runs a function with it. The function can record all its
|
|
9
|
+
* logs or traces using `trace` fn. */
|
|
10
|
+
async function withTrace(logger, fn) {
|
|
11
|
+
const t = newTrace();
|
|
12
|
+
try {
|
|
13
|
+
const result = await fn((k, v) => trace(t, k, v), t);
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
logger.error(`error ${e} while doing traced operation, state: ${JSON.stringify(t)}`);
|
|
18
|
+
throw e;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { newTrace, trace, withTrace };
|
|
23
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sources":["../../src/local/trace.ts"],"sourcesContent":["import type { MiLogger } from '@milaboratories/ts-helpers';\n\n/** Records all inputs and outputs of one's choice, so if the error happened\n * one can check how it was by just printing this structure. */\nexport type Trace = Record<string, any>;\n\nexport function newTrace(): Trace {\n return {};\n}\n\nexport function trace(t: Trace, k: string, v: any) {\n t[k] = v;\n return v;\n}\n\n/** Creates a trace and runs a function with it. The function can record all its\n * logs or traces using `trace` fn. */\nexport async function withTrace<T>(\n logger: MiLogger,\n fn: (trace: (k: string, v: any) => typeof v, t: Trace) => Promise<T>,\n): Promise<T> {\n const t = newTrace();\n try {\n const result = await fn((k: string, v: any) => trace(t, k, v), t);\n return result;\n } catch (e: any) {\n logger.error(`error ${e} while doing traced operation, state: ${JSON.stringify(t)}`);\n throw e;\n }\n}\n"],"names":[],"mappings":"SAMgB,QAAQ,GAAA;AACtB,IAAA,OAAO,EAAE;AACX;SAEgB,KAAK,CAAC,CAAQ,EAAE,CAAS,EAAE,CAAM,EAAA;AAC/C,IAAA,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACR,IAAA,OAAO,CAAC;AACV;AAEA;AACsC;AAC/B,eAAe,SAAS,CAC7B,MAAgB,EAChB,EAAoE,EAAA;AAEpE,IAAA,MAAM,CAAC,GAAG,QAAQ,EAAE;AACpB,IAAA,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,CAAS,EAAE,CAAM,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACjE,QAAA,OAAO,MAAM;IACf;IAAE,OAAO,CAAM,EAAE;AACf,QAAA,MAAM,CAAC,KAAK,CAAC,CAAA,MAAA,EAAS,CAAC,CAAA,sCAAA,EAAyC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA,CAAE,CAAC;AACpF,QAAA,MAAM,CAAC;IACT;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -9,4 +9,3 @@ export declare function getContainerHostAndPort(container: StartedTestContainer)
|
|
|
9
9
|
};
|
|
10
10
|
export declare function getConnectionForSsh(container: StartedTestContainer, debug?: boolean): ConnectConfig;
|
|
11
11
|
export declare function cleanUp(container: StartedTestContainer): Promise<void>;
|
|
12
|
-
//# sourceMappingURL=common-utils.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
/** We store all info about the connection on the server,
|
|
6
|
+
* so that another client could read the file and connect from another machine. */
|
|
7
|
+
//
|
|
8
|
+
// Types
|
|
9
|
+
//
|
|
10
|
+
const PortPair = zod.z.object({
|
|
11
|
+
local: zod.z.number(),
|
|
12
|
+
remote: zod.z.number(),
|
|
13
|
+
});
|
|
14
|
+
const SshPlPorts = zod.z.object({
|
|
15
|
+
grpc: PortPair,
|
|
16
|
+
http: PortPair.optional(),
|
|
17
|
+
monitoring: PortPair,
|
|
18
|
+
debug: PortPair,
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
minioPort: PortPair,
|
|
21
|
+
/** @deprecated */
|
|
22
|
+
minioConsolePort: PortPair,
|
|
23
|
+
});
|
|
24
|
+
const ConnectionInfo = zod.z.object({
|
|
25
|
+
plUser: zod.z.string(),
|
|
26
|
+
plPassword: zod.z.string(),
|
|
27
|
+
ports: SshPlPorts,
|
|
28
|
+
// It's false by default because it was added later,
|
|
29
|
+
// and in some deployments there won't be useGlobalAccess flag in the file.
|
|
30
|
+
useGlobalAccess: zod.z.boolean().default(false),
|
|
31
|
+
// We added the field afterwards, the pl backend was this version.
|
|
32
|
+
plVersion: zod.z.string().default('1.18.3'),
|
|
33
|
+
// It's true by default because it was added later and previous installation use minio.
|
|
34
|
+
minioIsUsed: zod.z.boolean().default(true),
|
|
35
|
+
});
|
|
36
|
+
//
|
|
37
|
+
// Funcs
|
|
38
|
+
//
|
|
39
|
+
function newConnectionInfo(plUser, plPassword, ports, useGlobalAccess, plVersion, minioIsUsed) {
|
|
40
|
+
return {
|
|
41
|
+
plUser,
|
|
42
|
+
plPassword,
|
|
43
|
+
ports,
|
|
44
|
+
useGlobalAccess,
|
|
45
|
+
plVersion,
|
|
46
|
+
minioIsUsed: minioIsUsed,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function parseConnectionInfo(content) {
|
|
50
|
+
return ConnectionInfo.parse(JSON.parse(content));
|
|
51
|
+
}
|
|
52
|
+
function stringifyConnectionInfo(conn) {
|
|
53
|
+
return JSON.stringify(conn, undefined, 2);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
exports.ConnectionInfo = ConnectionInfo;
|
|
57
|
+
exports.PortPair = PortPair;
|
|
58
|
+
exports.SshPlPorts = SshPlPorts;
|
|
59
|
+
exports.newConnectionInfo = newConnectionInfo;
|
|
60
|
+
exports.parseConnectionInfo = parseConnectionInfo;
|
|
61
|
+
exports.stringifyConnectionInfo = stringifyConnectionInfo;
|
|
62
|
+
//# sourceMappingURL=connection_info.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection_info.cjs","sources":["../../src/ssh/connection_info.ts"],"sourcesContent":["/** We store all info about the connection on the server,\n * so that another client could read the file and connect from another machine. */\nimport { z } from 'zod';\n\n//\n// Types\n//\n\nexport const PortPair = z.object({\n local: z.number(),\n remote: z.number(),\n});\n/** The pair of ports for forwarding. */\nexport type PortPair = z.infer<typeof PortPair>;\n\nexport const SshPlPorts = z.object({\n grpc: PortPair,\n http: PortPair.optional(),\n monitoring: PortPair,\n debug: PortPair,\n /** @deprecated */\n minioPort: PortPair,\n /** @deprecated */\n minioConsolePort: PortPair,\n});\n/** All info about ports that are forwarded. */\nexport type SshPlPorts = z.infer<typeof SshPlPorts>;\n\nexport const ConnectionInfo = z.object({\n plUser: z.string(),\n plPassword: z.string(),\n ports: SshPlPorts,\n\n // It's false by default because it was added later,\n // and in some deployments there won't be useGlobalAccess flag in the file.\n useGlobalAccess: z.boolean().default(false),\n\n // We added the field afterwards, the pl backend was this version.\n plVersion: z.string().default('1.18.3'),\n\n // It's true by default because it was added later and previous installation use minio.\n minioIsUsed: z.boolean().default(true),\n});\n/** The content of the file that holds all the info about the connection on the remote server. */\nexport type ConnectionInfo = z.infer<typeof ConnectionInfo>;\n\n//\n// Funcs\n//\n\nexport function newConnectionInfo(\n plUser: string,\n plPassword: string,\n ports: SshPlPorts,\n useGlobalAccess: boolean,\n plVersion: string,\n minioIsUsed: boolean,\n): ConnectionInfo {\n return {\n plUser,\n plPassword,\n ports,\n useGlobalAccess,\n plVersion,\n minioIsUsed: minioIsUsed,\n };\n}\n\nexport function parseConnectionInfo(content: string): ConnectionInfo {\n return ConnectionInfo.parse(JSON.parse(content));\n}\n\nexport function stringifyConnectionInfo(conn: ConnectionInfo): string {\n return JSON.stringify(conn, undefined, 2);\n}\n"],"names":["z"],"mappings":";;;;AAAA;AACkF;AAGlF;AACA;AACA;AAEO,MAAM,QAAQ,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC/B,IAAA,KAAK,EAAEA,KAAC,CAAC,MAAM,EAAE;AACjB,IAAA,MAAM,EAAEA,KAAC,CAAC,MAAM,EAAE;AACnB,CAAA;AAIM,MAAM,UAAU,GAAGA,KAAC,CAAC,MAAM,CAAC;AACjC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE;AACzB,IAAA,UAAU,EAAE,QAAQ;AACpB,IAAA,KAAK,EAAE,QAAQ;;AAEf,IAAA,SAAS,EAAE,QAAQ;;AAEnB,IAAA,gBAAgB,EAAE,QAAQ;AAC3B,CAAA;AAIM,MAAM,cAAc,GAAGA,KAAC,CAAC,MAAM,CAAC;AACrC,IAAA,MAAM,EAAEA,KAAC,CAAC,MAAM,EAAE;AAClB,IAAA,UAAU,EAAEA,KAAC,CAAC,MAAM,EAAE;AACtB,IAAA,KAAK,EAAE,UAAU;;;IAIjB,eAAe,EAAEA,KAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;;IAG3C,SAAS,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;IAGvC,WAAW,EAAEA,KAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;AACvC,CAAA;AAID;AACA;AACA;AAEM,SAAU,iBAAiB,CAC/B,MAAc,EACd,UAAkB,EAClB,KAAiB,EACjB,eAAwB,EACxB,SAAiB,EACjB,WAAoB,EAAA;IAEpB,OAAO;QACL,MAAM;QACN,UAAU;QACV,KAAK;QACL,eAAe;QACf,SAAS;AACT,QAAA,WAAW,EAAE,WAAW;KACzB;AACH;AAEM,SAAU,mBAAmB,CAAC,OAAe,EAAA;IACjD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAClD;AAEM,SAAU,uBAAuB,CAAC,IAAoB,EAAA;IAC1D,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAC3C;;;;;;;;;"}
|
|
@@ -317,4 +317,3 @@ export type ConnectionInfo = z.infer<typeof ConnectionInfo>;
|
|
|
317
317
|
export declare function newConnectionInfo(plUser: string, plPassword: string, ports: SshPlPorts, useGlobalAccess: boolean, plVersion: string, minioIsUsed: boolean): ConnectionInfo;
|
|
318
318
|
export declare function parseConnectionInfo(content: string): ConnectionInfo;
|
|
319
319
|
export declare function stringifyConnectionInfo(conn: ConnectionInfo): string;
|
|
320
|
-
//# sourceMappingURL=connection_info.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** We store all info about the connection on the server,
|
|
4
|
+
* so that another client could read the file and connect from another machine. */
|
|
5
|
+
//
|
|
6
|
+
// Types
|
|
7
|
+
//
|
|
8
|
+
const PortPair = z.object({
|
|
9
|
+
local: z.number(),
|
|
10
|
+
remote: z.number(),
|
|
11
|
+
});
|
|
12
|
+
const SshPlPorts = z.object({
|
|
13
|
+
grpc: PortPair,
|
|
14
|
+
http: PortPair.optional(),
|
|
15
|
+
monitoring: PortPair,
|
|
16
|
+
debug: PortPair,
|
|
17
|
+
/** @deprecated */
|
|
18
|
+
minioPort: PortPair,
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
minioConsolePort: PortPair,
|
|
21
|
+
});
|
|
22
|
+
const ConnectionInfo = z.object({
|
|
23
|
+
plUser: z.string(),
|
|
24
|
+
plPassword: z.string(),
|
|
25
|
+
ports: SshPlPorts,
|
|
26
|
+
// It's false by default because it was added later,
|
|
27
|
+
// and in some deployments there won't be useGlobalAccess flag in the file.
|
|
28
|
+
useGlobalAccess: z.boolean().default(false),
|
|
29
|
+
// We added the field afterwards, the pl backend was this version.
|
|
30
|
+
plVersion: z.string().default('1.18.3'),
|
|
31
|
+
// It's true by default because it was added later and previous installation use minio.
|
|
32
|
+
minioIsUsed: z.boolean().default(true),
|
|
33
|
+
});
|
|
34
|
+
//
|
|
35
|
+
// Funcs
|
|
36
|
+
//
|
|
37
|
+
function newConnectionInfo(plUser, plPassword, ports, useGlobalAccess, plVersion, minioIsUsed) {
|
|
38
|
+
return {
|
|
39
|
+
plUser,
|
|
40
|
+
plPassword,
|
|
41
|
+
ports,
|
|
42
|
+
useGlobalAccess,
|
|
43
|
+
plVersion,
|
|
44
|
+
minioIsUsed: minioIsUsed,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function parseConnectionInfo(content) {
|
|
48
|
+
return ConnectionInfo.parse(JSON.parse(content));
|
|
49
|
+
}
|
|
50
|
+
function stringifyConnectionInfo(conn) {
|
|
51
|
+
return JSON.stringify(conn, undefined, 2);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { ConnectionInfo, PortPair, SshPlPorts, newConnectionInfo, parseConnectionInfo, stringifyConnectionInfo };
|
|
55
|
+
//# sourceMappingURL=connection_info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection_info.js","sources":["../../src/ssh/connection_info.ts"],"sourcesContent":["/** We store all info about the connection on the server,\n * so that another client could read the file and connect from another machine. */\nimport { z } from 'zod';\n\n//\n// Types\n//\n\nexport const PortPair = z.object({\n local: z.number(),\n remote: z.number(),\n});\n/** The pair of ports for forwarding. */\nexport type PortPair = z.infer<typeof PortPair>;\n\nexport const SshPlPorts = z.object({\n grpc: PortPair,\n http: PortPair.optional(),\n monitoring: PortPair,\n debug: PortPair,\n /** @deprecated */\n minioPort: PortPair,\n /** @deprecated */\n minioConsolePort: PortPair,\n});\n/** All info about ports that are forwarded. */\nexport type SshPlPorts = z.infer<typeof SshPlPorts>;\n\nexport const ConnectionInfo = z.object({\n plUser: z.string(),\n plPassword: z.string(),\n ports: SshPlPorts,\n\n // It's false by default because it was added later,\n // and in some deployments there won't be useGlobalAccess flag in the file.\n useGlobalAccess: z.boolean().default(false),\n\n // We added the field afterwards, the pl backend was this version.\n plVersion: z.string().default('1.18.3'),\n\n // It's true by default because it was added later and previous installation use minio.\n minioIsUsed: z.boolean().default(true),\n});\n/** The content of the file that holds all the info about the connection on the remote server. */\nexport type ConnectionInfo = z.infer<typeof ConnectionInfo>;\n\n//\n// Funcs\n//\n\nexport function newConnectionInfo(\n plUser: string,\n plPassword: string,\n ports: SshPlPorts,\n useGlobalAccess: boolean,\n plVersion: string,\n minioIsUsed: boolean,\n): ConnectionInfo {\n return {\n plUser,\n plPassword,\n ports,\n useGlobalAccess,\n plVersion,\n minioIsUsed: minioIsUsed,\n };\n}\n\nexport function parseConnectionInfo(content: string): ConnectionInfo {\n return ConnectionInfo.parse(JSON.parse(content));\n}\n\nexport function stringifyConnectionInfo(conn: ConnectionInfo): string {\n return JSON.stringify(conn, undefined, 2);\n}\n"],"names":[],"mappings":";;AAAA;AACkF;AAGlF;AACA;AACA;AAEO,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;AAC/B,IAAA,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;AACjB,IAAA,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;AACnB,CAAA;AAIM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;AACjC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE;AACzB,IAAA,UAAU,EAAE,QAAQ;AACpB,IAAA,KAAK,EAAE,QAAQ;;AAEf,IAAA,SAAS,EAAE,QAAQ;;AAEnB,IAAA,gBAAgB,EAAE,QAAQ;AAC3B,CAAA;AAIM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;AACrC,IAAA,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;AAClB,IAAA,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;AACtB,IAAA,KAAK,EAAE,UAAU;;;IAIjB,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;;IAG3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;IAGvC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;AACvC,CAAA;AAID;AACA;AACA;AAEM,SAAU,i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