@yu_robotics/remote-cli-router 1.6.268 → 1.6.269
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/binding/BindingManager.d.ts +2 -2
- package/dist/binding/BindingManager.d.ts.map +1 -1
- package/dist/binding/BindingManager.js +7 -2
- package/dist/binding/BindingManager.js.map +1 -1
- package/dist/feishu/CommandMenu.d.ts +9 -4
- package/dist/feishu/CommandMenu.d.ts.map +1 -1
- package/dist/feishu/CommandMenu.js +178 -46
- package/dist/feishu/CommandMenu.js.map +1 -1
- package/dist/feishu/FeishuLongConnHandler.d.ts.map +1 -1
- package/dist/feishu/FeishuLongConnHandler.js +36 -12
- package/dist/feishu/FeishuLongConnHandler.js.map +1 -1
- package/dist/feishu/MachineCommandForm.d.ts +104 -0
- package/dist/feishu/MachineCommandForm.d.ts.map +1 -0
- package/dist/feishu/MachineCommandForm.js +69 -0
- package/dist/feishu/MachineCommandForm.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
declare const fields: {
|
|
2
|
+
machine: {
|
|
3
|
+
label: string;
|
|
4
|
+
pattern: RegExp;
|
|
5
|
+
};
|
|
6
|
+
user: {
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
ssh_port: {
|
|
10
|
+
label: string;
|
|
11
|
+
optional: true;
|
|
12
|
+
max: number;
|
|
13
|
+
flag: string;
|
|
14
|
+
};
|
|
15
|
+
proxy_host: {
|
|
16
|
+
label: string;
|
|
17
|
+
pattern: RegExp;
|
|
18
|
+
};
|
|
19
|
+
proxy_port: {
|
|
20
|
+
label: string;
|
|
21
|
+
max: number;
|
|
22
|
+
};
|
|
23
|
+
suffix: {
|
|
24
|
+
label: string;
|
|
25
|
+
pattern: RegExp;
|
|
26
|
+
};
|
|
27
|
+
search_path: {
|
|
28
|
+
label: string;
|
|
29
|
+
pattern: RegExp;
|
|
30
|
+
};
|
|
31
|
+
pattern: {
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
file: {
|
|
35
|
+
label: string;
|
|
36
|
+
pattern: RegExp;
|
|
37
|
+
};
|
|
38
|
+
filter_path: {
|
|
39
|
+
label: string;
|
|
40
|
+
optional: true;
|
|
41
|
+
pattern: RegExp;
|
|
42
|
+
};
|
|
43
|
+
backup: {
|
|
44
|
+
label: string;
|
|
45
|
+
pattern: RegExp;
|
|
46
|
+
};
|
|
47
|
+
destination: {
|
|
48
|
+
label: string;
|
|
49
|
+
pattern: RegExp;
|
|
50
|
+
};
|
|
51
|
+
target: {
|
|
52
|
+
label: string;
|
|
53
|
+
optional: true;
|
|
54
|
+
};
|
|
55
|
+
container: {
|
|
56
|
+
label: string;
|
|
57
|
+
optional: true;
|
|
58
|
+
pattern: RegExp;
|
|
59
|
+
flag: string;
|
|
60
|
+
};
|
|
61
|
+
lines: {
|
|
62
|
+
label: string;
|
|
63
|
+
optional: true;
|
|
64
|
+
max: number;
|
|
65
|
+
flag: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export type MachineField = keyof typeof fields;
|
|
69
|
+
export declare function machineFormElement(name: MachineField): {
|
|
70
|
+
tag: string;
|
|
71
|
+
name: "target";
|
|
72
|
+
placeholder: {
|
|
73
|
+
tag: string;
|
|
74
|
+
content: string;
|
|
75
|
+
};
|
|
76
|
+
initial_option: string;
|
|
77
|
+
options: {
|
|
78
|
+
text: {
|
|
79
|
+
tag: string;
|
|
80
|
+
content: string;
|
|
81
|
+
};
|
|
82
|
+
value: string;
|
|
83
|
+
}[];
|
|
84
|
+
label?: undefined;
|
|
85
|
+
required?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
tag: string;
|
|
88
|
+
name: "file" | "pattern" | "suffix" | "destination" | "machine" | "user" | "ssh_port" | "proxy_host" | "proxy_port" | "search_path" | "filter_path" | "backup" | "container" | "lines";
|
|
89
|
+
label: {
|
|
90
|
+
tag: string;
|
|
91
|
+
content: string;
|
|
92
|
+
};
|
|
93
|
+
placeholder: {
|
|
94
|
+
tag: string;
|
|
95
|
+
content: string;
|
|
96
|
+
};
|
|
97
|
+
required: boolean;
|
|
98
|
+
initial_option?: undefined;
|
|
99
|
+
options?: undefined;
|
|
100
|
+
};
|
|
101
|
+
/** The CLI tokenizes using whitespace. Only this schema can introduce switches. */
|
|
102
|
+
export declare function buildMachineCommand(command: string, names: readonly MachineField[], form: unknown): string;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=MachineCommandForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MachineCommandForm.d.ts","sourceRoot":"","sources":["../../src/feishu/MachineCommandForm.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBqB,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,MAAM,CAAC;AAG/C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOpD;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CA0B1G"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.machineFormElement = machineFormElement;
|
|
4
|
+
exports.buildMachineCommand = buildMachineCommand;
|
|
5
|
+
const id = /^[A-Za-z0-9_.-]+$/;
|
|
6
|
+
const path = /^[A-Za-z0-9_./~-]+$/;
|
|
7
|
+
const fields = {
|
|
8
|
+
machine: { label: 'Machine ID', pattern: id },
|
|
9
|
+
user: { label: 'SSH user' },
|
|
10
|
+
ssh_port: { label: 'SSH port (optional, default 22)', optional: true, max: 65535, flag: '--port' },
|
|
11
|
+
proxy_host: { label: 'Proxy host', pattern: /^[A-Za-z0-9_.:\[\]-]+$/ },
|
|
12
|
+
proxy_port: { label: 'Proxy port', max: 65535 },
|
|
13
|
+
suffix: { label: 'Host suffix', pattern: id },
|
|
14
|
+
search_path: { label: 'Search directory', pattern: path },
|
|
15
|
+
pattern: { label: 'Filename pattern' },
|
|
16
|
+
file: { label: 'File path', pattern: path },
|
|
17
|
+
filter_path: { label: 'Filter by file path (optional)', optional: true, pattern: path },
|
|
18
|
+
backup: { label: 'Backup path', pattern: path },
|
|
19
|
+
destination: { label: 'Restore to path', pattern: path },
|
|
20
|
+
target: { label: 'Target', optional: true },
|
|
21
|
+
container: { label: 'Container ID (optional, default welding)', optional: true, pattern: id, flag: '--container' },
|
|
22
|
+
lines: { label: 'Lines (optional, 1-500)', optional: true, max: 500, flag: '--lines' },
|
|
23
|
+
};
|
|
24
|
+
const plain = (content) => ({ tag: 'plain_text', content });
|
|
25
|
+
function machineFormElement(name) {
|
|
26
|
+
const field = fields[name];
|
|
27
|
+
if (name === 'target') {
|
|
28
|
+
return { tag: 'select_static', name, placeholder: plain(field.label), initial_option: 'container',
|
|
29
|
+
options: [{ text: plain('Container'), value: 'container' }, { text: plain('Host'), value: 'host' }] };
|
|
30
|
+
}
|
|
31
|
+
return { tag: 'input', name, label: plain(field.label), placeholder: plain(field.label), required: !field.optional };
|
|
32
|
+
}
|
|
33
|
+
/** The CLI tokenizes using whitespace. Only this schema can introduce switches. */
|
|
34
|
+
function buildMachineCommand(command, names, form) {
|
|
35
|
+
const values = (form ?? {});
|
|
36
|
+
const args = [command];
|
|
37
|
+
for (const name of names) {
|
|
38
|
+
const field = fields[name];
|
|
39
|
+
const raw = values[name];
|
|
40
|
+
if (field.optional && (raw === undefined || raw === null || raw === ''))
|
|
41
|
+
continue;
|
|
42
|
+
if (typeof raw !== 'string' || raw.length > 4096 || /[\r\n\0]/.test(raw))
|
|
43
|
+
throw new Error('Invalid ' + field.label + '.');
|
|
44
|
+
const value = raw.trim();
|
|
45
|
+
if (!value && field.optional)
|
|
46
|
+
continue;
|
|
47
|
+
if (!value || /\s/.test(value) || value.startsWith('-') || field.pattern && !field.pattern.test(value)) {
|
|
48
|
+
throw new Error('Enter a valid single value for ' + field.label + '.');
|
|
49
|
+
}
|
|
50
|
+
if (field.max && (!/^\d+$/.test(value) || Number(value) < 1 || Number(value) > field.max)) {
|
|
51
|
+
throw new Error('Enter a whole number from 1 to ' + field.max + '.');
|
|
52
|
+
}
|
|
53
|
+
if (name === 'target') {
|
|
54
|
+
if (value === 'host')
|
|
55
|
+
args.push('--host');
|
|
56
|
+
else if (value !== 'container')
|
|
57
|
+
throw new Error('Select Host or Container.');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (name === 'container' && args.includes('--host'))
|
|
61
|
+
throw new Error('Choose Container to specify a container ID.');
|
|
62
|
+
if (field.flag)
|
|
63
|
+
args.push(field.flag);
|
|
64
|
+
args.push(value);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return args.join(' ');
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=MachineCommandForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MachineCommandForm.js","sourceRoot":"","sources":["../../src/feishu/MachineCommandForm.ts"],"names":[],"mappings":";;AA+BA,gDAOC;AAGD,kDA0BC;AA3DD,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAC/B,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7C,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;IAC3B,QAAQ,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClG,UAAU,EAAE,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