@uipath/integrationservice-tool 1.0.4 → 1.1.0
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/README.md +2 -4
- package/dist/tool.js +2049 -1834
- package/package.json +6 -14
package/dist/tool.js
CHANGED
|
@@ -33,533 +33,837 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
|
|
|
33
33
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
34
34
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
// ../../node_modules/is-inside-container/node_modules/is-docker/index.js
|
|
37
|
+
import fs from "node:fs";
|
|
38
|
+
function hasDockerEnv() {
|
|
39
|
+
try {
|
|
40
|
+
fs.statSync("/.dockerenv");
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function hasDockerCGroup() {
|
|
47
|
+
try {
|
|
48
|
+
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function isDocker() {
|
|
54
|
+
if (isDockerCached === undefined) {
|
|
55
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
47
56
|
}
|
|
57
|
+
return isDockerCached;
|
|
58
|
+
}
|
|
59
|
+
var isDockerCached;
|
|
60
|
+
var init_is_docker = () => {};
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
62
|
+
// ../../node_modules/is-inside-container/index.js
|
|
63
|
+
import fs2 from "node:fs";
|
|
64
|
+
function isInsideContainer() {
|
|
65
|
+
if (cachedResult === undefined) {
|
|
66
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
55
67
|
}
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
return cachedResult;
|
|
69
|
+
}
|
|
70
|
+
var cachedResult, hasContainerEnv = () => {
|
|
71
|
+
try {
|
|
72
|
+
fs2.statSync("/run/.containerenv");
|
|
73
|
+
return true;
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var init_is_inside_container = __esm(() => {
|
|
79
|
+
init_is_docker();
|
|
58
80
|
});
|
|
59
81
|
|
|
60
|
-
// ../../node_modules/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.argChoices = undefined;
|
|
72
|
-
switch (name[0]) {
|
|
73
|
-
case "<":
|
|
74
|
-
this.required = true;
|
|
75
|
-
this._name = name.slice(1, -1);
|
|
76
|
-
break;
|
|
77
|
-
case "[":
|
|
78
|
-
this.required = false;
|
|
79
|
-
this._name = name.slice(1, -1);
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
this.required = true;
|
|
83
|
-
this._name = name;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
if (this._name.endsWith("...")) {
|
|
87
|
-
this.variadic = true;
|
|
88
|
-
this._name = this._name.slice(0, -3);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
name() {
|
|
92
|
-
return this._name;
|
|
93
|
-
}
|
|
94
|
-
_collectValue(value, previous) {
|
|
95
|
-
if (previous === this.defaultValue || !Array.isArray(previous)) {
|
|
96
|
-
return [value];
|
|
97
|
-
}
|
|
98
|
-
previous.push(value);
|
|
99
|
-
return previous;
|
|
100
|
-
}
|
|
101
|
-
default(value, description) {
|
|
102
|
-
this.defaultValue = value;
|
|
103
|
-
this.defaultValueDescription = description;
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
argParser(fn) {
|
|
107
|
-
this.parseArg = fn;
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
choices(values) {
|
|
111
|
-
this.argChoices = values.slice();
|
|
112
|
-
this.parseArg = (arg, previous) => {
|
|
113
|
-
if (!this.argChoices.includes(arg)) {
|
|
114
|
-
throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
115
|
-
}
|
|
116
|
-
if (this.variadic) {
|
|
117
|
-
return this._collectValue(arg, previous);
|
|
118
|
-
}
|
|
119
|
-
return arg;
|
|
120
|
-
};
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
argRequired() {
|
|
124
|
-
this.required = true;
|
|
125
|
-
return this;
|
|
126
|
-
}
|
|
127
|
-
argOptional() {
|
|
128
|
-
this.required = false;
|
|
129
|
-
return this;
|
|
82
|
+
// ../../node_modules/wsl-utils/node_modules/is-wsl/index.js
|
|
83
|
+
import process2 from "node:process";
|
|
84
|
+
import os from "node:os";
|
|
85
|
+
import fs3 from "node:fs";
|
|
86
|
+
var isWsl = () => {
|
|
87
|
+
if (process2.platform !== "linux") {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (os.release().toLowerCase().includes("microsoft")) {
|
|
91
|
+
if (isInsideContainer()) {
|
|
92
|
+
return false;
|
|
130
93
|
}
|
|
94
|
+
return true;
|
|
131
95
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
96
|
+
try {
|
|
97
|
+
if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
98
|
+
return !isInsideContainer();
|
|
99
|
+
}
|
|
100
|
+
} catch {}
|
|
101
|
+
if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
|
|
102
|
+
return !isInsideContainer();
|
|
135
103
|
}
|
|
136
|
-
|
|
137
|
-
|
|
104
|
+
return false;
|
|
105
|
+
}, is_wsl_default;
|
|
106
|
+
var init_is_wsl = __esm(() => {
|
|
107
|
+
init_is_inside_container();
|
|
108
|
+
is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
138
109
|
});
|
|
139
110
|
|
|
140
|
-
// ../../node_modules/
|
|
141
|
-
|
|
142
|
-
|
|
111
|
+
// ../../node_modules/powershell-utils/index.js
|
|
112
|
+
import process3 from "node:process";
|
|
113
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
114
|
+
import { promisify } from "node:util";
|
|
115
|
+
import childProcess from "node:child_process";
|
|
116
|
+
var execFile, powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {}) => {
|
|
117
|
+
const {
|
|
118
|
+
powerShellPath: psPath,
|
|
119
|
+
...execFileOptions
|
|
120
|
+
} = options;
|
|
121
|
+
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
122
|
+
return execFile(psPath ?? powerShellPath(), [
|
|
123
|
+
...executePowerShell.argumentsPrefix,
|
|
124
|
+
encodedCommand
|
|
125
|
+
], {
|
|
126
|
+
encoding: "utf8",
|
|
127
|
+
...execFileOptions
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
var init_powershell_utils = __esm(() => {
|
|
131
|
+
execFile = promisify(childProcess.execFile);
|
|
132
|
+
executePowerShell.argumentsPrefix = [
|
|
133
|
+
"-NoProfile",
|
|
134
|
+
"-NonInteractive",
|
|
135
|
+
"-ExecutionPolicy",
|
|
136
|
+
"Bypass",
|
|
137
|
+
"-EncodedCommand"
|
|
138
|
+
];
|
|
139
|
+
executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
|
|
140
|
+
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
141
|
+
});
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.showGlobalOptions = false;
|
|
151
|
-
}
|
|
152
|
-
prepareContext(contextOptions) {
|
|
153
|
-
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
154
|
-
}
|
|
155
|
-
visibleCommands(cmd) {
|
|
156
|
-
const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
|
|
157
|
-
const helpCommand = cmd._getHelpCommand();
|
|
158
|
-
if (helpCommand && !helpCommand._hidden) {
|
|
159
|
-
visibleCommands.push(helpCommand);
|
|
160
|
-
}
|
|
161
|
-
if (this.sortSubcommands) {
|
|
162
|
-
visibleCommands.sort((a, b) => {
|
|
163
|
-
return a.name().localeCompare(b.name());
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
return visibleCommands;
|
|
167
|
-
}
|
|
168
|
-
compareOptions(a, b) {
|
|
169
|
-
const getSortKey = (option) => {
|
|
170
|
-
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
171
|
-
};
|
|
172
|
-
return getSortKey(a).localeCompare(getSortKey(b));
|
|
173
|
-
}
|
|
174
|
-
visibleOptions(cmd) {
|
|
175
|
-
const visibleOptions = cmd.options.filter((option) => !option.hidden);
|
|
176
|
-
const helpOption = cmd._getHelpOption();
|
|
177
|
-
if (helpOption && !helpOption.hidden) {
|
|
178
|
-
const removeShort = helpOption.short && cmd._findOption(helpOption.short);
|
|
179
|
-
const removeLong = helpOption.long && cmd._findOption(helpOption.long);
|
|
180
|
-
if (!removeShort && !removeLong) {
|
|
181
|
-
visibleOptions.push(helpOption);
|
|
182
|
-
} else if (helpOption.long && !removeLong) {
|
|
183
|
-
visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
|
|
184
|
-
} else if (helpOption.short && !removeShort) {
|
|
185
|
-
visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (this.sortOptions) {
|
|
189
|
-
visibleOptions.sort(this.compareOptions);
|
|
190
|
-
}
|
|
191
|
-
return visibleOptions;
|
|
192
|
-
}
|
|
193
|
-
visibleGlobalOptions(cmd) {
|
|
194
|
-
if (!this.showGlobalOptions)
|
|
195
|
-
return [];
|
|
196
|
-
const globalOptions = [];
|
|
197
|
-
for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
|
|
198
|
-
const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
|
|
199
|
-
globalOptions.push(...visibleOptions);
|
|
200
|
-
}
|
|
201
|
-
if (this.sortOptions) {
|
|
202
|
-
globalOptions.sort(this.compareOptions);
|
|
203
|
-
}
|
|
204
|
-
return globalOptions;
|
|
205
|
-
}
|
|
206
|
-
visibleArguments(cmd) {
|
|
207
|
-
if (cmd._argsDescription) {
|
|
208
|
-
cmd.registeredArguments.forEach((argument) => {
|
|
209
|
-
argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
if (cmd.registeredArguments.find((argument) => argument.description)) {
|
|
213
|
-
return cmd.registeredArguments;
|
|
214
|
-
}
|
|
215
|
-
return [];
|
|
216
|
-
}
|
|
217
|
-
subcommandTerm(cmd) {
|
|
218
|
-
const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
|
|
219
|
-
return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
|
|
220
|
-
}
|
|
221
|
-
optionTerm(option) {
|
|
222
|
-
return option.flags;
|
|
223
|
-
}
|
|
224
|
-
argumentTerm(argument) {
|
|
225
|
-
return argument.name();
|
|
226
|
-
}
|
|
227
|
-
longestSubcommandTermLength(cmd, helper) {
|
|
228
|
-
return helper.visibleCommands(cmd).reduce((max, command) => {
|
|
229
|
-
return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
|
|
230
|
-
}, 0);
|
|
231
|
-
}
|
|
232
|
-
longestOptionTermLength(cmd, helper) {
|
|
233
|
-
return helper.visibleOptions(cmd).reduce((max, option) => {
|
|
234
|
-
return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
|
|
235
|
-
}, 0);
|
|
236
|
-
}
|
|
237
|
-
longestGlobalOptionTermLength(cmd, helper) {
|
|
238
|
-
return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
|
|
239
|
-
return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
|
|
240
|
-
}, 0);
|
|
241
|
-
}
|
|
242
|
-
longestArgumentTermLength(cmd, helper) {
|
|
243
|
-
return helper.visibleArguments(cmd).reduce((max, argument) => {
|
|
244
|
-
return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
|
|
245
|
-
}, 0);
|
|
246
|
-
}
|
|
247
|
-
commandUsage(cmd) {
|
|
248
|
-
let cmdName = cmd._name;
|
|
249
|
-
if (cmd._aliases[0]) {
|
|
250
|
-
cmdName = cmdName + "|" + cmd._aliases[0];
|
|
251
|
-
}
|
|
252
|
-
let ancestorCmdNames = "";
|
|
253
|
-
for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
|
|
254
|
-
ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
|
|
255
|
-
}
|
|
256
|
-
return ancestorCmdNames + cmdName + " " + cmd.usage();
|
|
257
|
-
}
|
|
258
|
-
commandDescription(cmd) {
|
|
259
|
-
return cmd.description();
|
|
143
|
+
// ../../node_modules/wsl-utils/utilities.js
|
|
144
|
+
function parseMountPointFromConfig(content) {
|
|
145
|
+
for (const line of content.split(`
|
|
146
|
+
`)) {
|
|
147
|
+
if (/^\s*#/.test(line)) {
|
|
148
|
+
continue;
|
|
260
149
|
}
|
|
261
|
-
|
|
262
|
-
|
|
150
|
+
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
151
|
+
if (!match) {
|
|
152
|
+
continue;
|
|
263
153
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (option.description) {
|
|
284
|
-
return `${option.description} ${extraDescription}`;
|
|
285
|
-
}
|
|
286
|
-
return extraDescription;
|
|
287
|
-
}
|
|
288
|
-
return option.description;
|
|
154
|
+
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ../../node_modules/wsl-utils/index.js
|
|
159
|
+
import { promisify as promisify2 } from "node:util";
|
|
160
|
+
import childProcess2 from "node:child_process";
|
|
161
|
+
import fs4, { constants as fsConstants } from "node:fs/promises";
|
|
162
|
+
var execFile2, wslDrivesMountPoint, powerShellPathFromWsl = async () => {
|
|
163
|
+
const mountPoint = await wslDrivesMountPoint();
|
|
164
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
165
|
+
}, powerShellPath2, canAccessPowerShellPromise, canAccessPowerShell = async () => {
|
|
166
|
+
canAccessPowerShellPromise ??= (async () => {
|
|
167
|
+
try {
|
|
168
|
+
const psPath = await powerShellPath2();
|
|
169
|
+
await fs4.access(psPath, fsConstants.X_OK);
|
|
170
|
+
return true;
|
|
171
|
+
} catch {
|
|
172
|
+
return false;
|
|
289
173
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
174
|
+
})();
|
|
175
|
+
return canAccessPowerShellPromise;
|
|
176
|
+
}, wslDefaultBrowser = async () => {
|
|
177
|
+
const psPath = await powerShellPath2();
|
|
178
|
+
const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
179
|
+
const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
|
|
180
|
+
return stdout.trim();
|
|
181
|
+
}, convertWslPathToWindows = async (path) => {
|
|
182
|
+
if (/^[a-z]+:\/\//i.test(path)) {
|
|
183
|
+
return path;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
|
|
187
|
+
return stdout.trim();
|
|
188
|
+
} catch {
|
|
189
|
+
return path;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var init_wsl_utils = __esm(() => {
|
|
193
|
+
init_is_wsl();
|
|
194
|
+
init_powershell_utils();
|
|
195
|
+
init_is_wsl();
|
|
196
|
+
execFile2 = promisify2(childProcess2.execFile);
|
|
197
|
+
wslDrivesMountPoint = (() => {
|
|
198
|
+
const defaultMountPoint = "/mnt/";
|
|
199
|
+
let mountPoint;
|
|
200
|
+
return async function() {
|
|
201
|
+
if (mountPoint) {
|
|
202
|
+
return mountPoint;
|
|
294
203
|
}
|
|
295
|
-
|
|
296
|
-
|
|
204
|
+
const configFilePath = "/etc/wsl.conf";
|
|
205
|
+
let isConfigFileExists = false;
|
|
206
|
+
try {
|
|
207
|
+
await fs4.access(configFilePath, fsConstants.F_OK);
|
|
208
|
+
isConfigFileExists = true;
|
|
209
|
+
} catch {}
|
|
210
|
+
if (!isConfigFileExists) {
|
|
211
|
+
return defaultMountPoint;
|
|
297
212
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
return extraDescription;
|
|
213
|
+
const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
|
|
214
|
+
const parsedMountPoint = parseMountPointFromConfig(configContent);
|
|
215
|
+
if (parsedMountPoint === undefined) {
|
|
216
|
+
return defaultMountPoint;
|
|
304
217
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
result.set(group, []);
|
|
323
|
-
}
|
|
324
|
-
result.get(group).push(item);
|
|
325
|
-
});
|
|
218
|
+
mountPoint = parsedMountPoint;
|
|
219
|
+
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
220
|
+
return mountPoint;
|
|
221
|
+
};
|
|
222
|
+
})();
|
|
223
|
+
powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// ../../node_modules/open/node_modules/define-lazy-prop/index.js
|
|
227
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
228
|
+
const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
229
|
+
Object.defineProperty(object, propertyName, {
|
|
230
|
+
configurable: true,
|
|
231
|
+
enumerable: true,
|
|
232
|
+
get() {
|
|
233
|
+
const result = valueGetter();
|
|
234
|
+
define2(result);
|
|
326
235
|
return result;
|
|
236
|
+
},
|
|
237
|
+
set(value) {
|
|
238
|
+
define2(value);
|
|
327
239
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
240
|
+
});
|
|
241
|
+
return object;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ../../node_modules/default-browser-id/index.js
|
|
245
|
+
import { promisify as promisify3 } from "node:util";
|
|
246
|
+
import process4 from "node:process";
|
|
247
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
248
|
+
async function defaultBrowserId() {
|
|
249
|
+
if (process4.platform !== "darwin") {
|
|
250
|
+
throw new Error("macOS only");
|
|
251
|
+
}
|
|
252
|
+
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
253
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
254
|
+
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
255
|
+
if (browserId === "com.apple.safari") {
|
|
256
|
+
return "com.apple.Safari";
|
|
257
|
+
}
|
|
258
|
+
return browserId;
|
|
259
|
+
}
|
|
260
|
+
var execFileAsync;
|
|
261
|
+
var init_default_browser_id = __esm(() => {
|
|
262
|
+
execFileAsync = promisify3(execFile3);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// ../../node_modules/run-applescript/index.js
|
|
266
|
+
import process5 from "node:process";
|
|
267
|
+
import { promisify as promisify4 } from "node:util";
|
|
268
|
+
import { execFile as execFile4, execFileSync } from "node:child_process";
|
|
269
|
+
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
270
|
+
if (process5.platform !== "darwin") {
|
|
271
|
+
throw new Error("macOS only");
|
|
272
|
+
}
|
|
273
|
+
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
274
|
+
const execOptions = {};
|
|
275
|
+
if (signal) {
|
|
276
|
+
execOptions.signal = signal;
|
|
277
|
+
}
|
|
278
|
+
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
279
|
+
return stdout.trim();
|
|
280
|
+
}
|
|
281
|
+
var execFileAsync2;
|
|
282
|
+
var init_run_applescript = __esm(() => {
|
|
283
|
+
execFileAsync2 = promisify4(execFile4);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// ../../node_modules/bundle-name/index.js
|
|
287
|
+
async function bundleName(bundleId) {
|
|
288
|
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
289
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
290
|
+
}
|
|
291
|
+
var init_bundle_name = __esm(() => {
|
|
292
|
+
init_run_applescript();
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// ../../node_modules/default-browser/windows.js
|
|
296
|
+
import { promisify as promisify5 } from "node:util";
|
|
297
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
298
|
+
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
299
|
+
const { stdout } = await _execFileAsync("reg", [
|
|
300
|
+
"QUERY",
|
|
301
|
+
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
302
|
+
"/v",
|
|
303
|
+
"ProgId"
|
|
304
|
+
]);
|
|
305
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
306
|
+
if (!match) {
|
|
307
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
308
|
+
}
|
|
309
|
+
const { id } = match.groups;
|
|
310
|
+
const dotIndex = id.lastIndexOf(".");
|
|
311
|
+
const hyphenIndex = id.lastIndexOf("-");
|
|
312
|
+
const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
|
|
313
|
+
const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
|
|
314
|
+
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
315
|
+
}
|
|
316
|
+
var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
|
|
317
|
+
var init_windows = __esm(() => {
|
|
318
|
+
execFileAsync3 = promisify5(execFile5);
|
|
319
|
+
windowsBrowserProgIds = {
|
|
320
|
+
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
321
|
+
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
322
|
+
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
323
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
324
|
+
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
325
|
+
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
326
|
+
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
327
|
+
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
328
|
+
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
329
|
+
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
330
|
+
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
331
|
+
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
332
|
+
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
333
|
+
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
334
|
+
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
335
|
+
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
336
|
+
};
|
|
337
|
+
_windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
338
|
+
UnknownBrowserError = class UnknownBrowserError extends Error {
|
|
339
|
+
};
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
// ../../node_modules/default-browser/index.js
|
|
343
|
+
import { promisify as promisify6 } from "node:util";
|
|
344
|
+
import process6 from "node:process";
|
|
345
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
346
|
+
async function defaultBrowser2() {
|
|
347
|
+
if (process6.platform === "darwin") {
|
|
348
|
+
const id = await defaultBrowserId();
|
|
349
|
+
const name = await bundleName(id);
|
|
350
|
+
return { name, id };
|
|
351
|
+
}
|
|
352
|
+
if (process6.platform === "linux") {
|
|
353
|
+
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
354
|
+
const id = stdout.trim();
|
|
355
|
+
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
356
|
+
return { name, id };
|
|
357
|
+
}
|
|
358
|
+
if (process6.platform === "win32") {
|
|
359
|
+
return defaultBrowser();
|
|
360
|
+
}
|
|
361
|
+
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
362
|
+
}
|
|
363
|
+
var execFileAsync4, titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
364
|
+
var init_default_browser = __esm(() => {
|
|
365
|
+
init_default_browser_id();
|
|
366
|
+
init_bundle_name();
|
|
367
|
+
init_windows();
|
|
368
|
+
init_windows();
|
|
369
|
+
execFileAsync4 = promisify6(execFile6);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
// ../../node_modules/is-in-ssh/index.js
|
|
373
|
+
import process7 from "node:process";
|
|
374
|
+
var isInSsh, is_in_ssh_default;
|
|
375
|
+
var init_is_in_ssh = __esm(() => {
|
|
376
|
+
isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
|
|
377
|
+
is_in_ssh_default = isInSsh;
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// ../../node_modules/open/index.js
|
|
381
|
+
import process8 from "node:process";
|
|
382
|
+
import path from "node:path";
|
|
383
|
+
import { fileURLToPath } from "node:url";
|
|
384
|
+
import childProcess3 from "node:child_process";
|
|
385
|
+
import fs5, { constants as fsConstants2 } from "node:fs/promises";
|
|
386
|
+
function detectArchBinary(binary) {
|
|
387
|
+
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
388
|
+
return binary;
|
|
389
|
+
}
|
|
390
|
+
const { [arch]: archBinary } = binary;
|
|
391
|
+
if (!archBinary) {
|
|
392
|
+
throw new Error(`${arch} is not supported`);
|
|
393
|
+
}
|
|
394
|
+
return archBinary;
|
|
395
|
+
}
|
|
396
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
397
|
+
if (wsl && is_wsl_default) {
|
|
398
|
+
return detectArchBinary(wsl);
|
|
399
|
+
}
|
|
400
|
+
if (!platformBinary) {
|
|
401
|
+
throw new Error(`${platform} is not supported`);
|
|
402
|
+
}
|
|
403
|
+
return detectArchBinary(platformBinary);
|
|
404
|
+
}
|
|
405
|
+
var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform, arch, tryEachApp = async (apps, opener) => {
|
|
406
|
+
if (apps.length === 0) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const errors = [];
|
|
410
|
+
for (const app of apps) {
|
|
411
|
+
try {
|
|
412
|
+
return await opener(app);
|
|
413
|
+
} catch (error) {
|
|
414
|
+
errors.push(error);
|
|
388
415
|
}
|
|
389
|
-
|
|
390
|
-
|
|
416
|
+
}
|
|
417
|
+
throw new AggregateError(errors, "Failed to open in all supported apps");
|
|
418
|
+
}, baseOpen = async (options) => {
|
|
419
|
+
options = {
|
|
420
|
+
wait: false,
|
|
421
|
+
background: false,
|
|
422
|
+
newInstance: false,
|
|
423
|
+
allowNonzeroExitCode: false,
|
|
424
|
+
...options
|
|
425
|
+
};
|
|
426
|
+
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
427
|
+
delete options[fallbackAttemptSymbol];
|
|
428
|
+
if (Array.isArray(options.app)) {
|
|
429
|
+
return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
430
|
+
...options,
|
|
431
|
+
app: singleApp,
|
|
432
|
+
[fallbackAttemptSymbol]: true
|
|
433
|
+
}));
|
|
434
|
+
}
|
|
435
|
+
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
436
|
+
appArguments = [...appArguments];
|
|
437
|
+
if (Array.isArray(app)) {
|
|
438
|
+
return tryEachApp(app, (appName) => baseOpen({
|
|
439
|
+
...options,
|
|
440
|
+
app: {
|
|
441
|
+
name: appName,
|
|
442
|
+
arguments: appArguments
|
|
443
|
+
},
|
|
444
|
+
[fallbackAttemptSymbol]: true
|
|
445
|
+
}));
|
|
446
|
+
}
|
|
447
|
+
if (app === "browser" || app === "browserPrivate") {
|
|
448
|
+
const ids = {
|
|
449
|
+
"com.google.chrome": "chrome",
|
|
450
|
+
"google-chrome.desktop": "chrome",
|
|
451
|
+
"com.brave.browser": "brave",
|
|
452
|
+
"org.mozilla.firefox": "firefox",
|
|
453
|
+
"firefox.desktop": "firefox",
|
|
454
|
+
"com.microsoft.msedge": "edge",
|
|
455
|
+
"com.microsoft.edge": "edge",
|
|
456
|
+
"com.microsoft.edgemac": "edge",
|
|
457
|
+
"microsoft-edge.desktop": "edge",
|
|
458
|
+
"com.apple.safari": "safari"
|
|
459
|
+
};
|
|
460
|
+
const flags = {
|
|
461
|
+
chrome: "--incognito",
|
|
462
|
+
brave: "--incognito",
|
|
463
|
+
firefox: "--private-window",
|
|
464
|
+
edge: "--inPrivate"
|
|
465
|
+
};
|
|
466
|
+
let browser;
|
|
467
|
+
if (is_wsl_default) {
|
|
468
|
+
const progId = await wslDefaultBrowser();
|
|
469
|
+
const browserInfo = _windowsBrowserProgIdMap.get(progId);
|
|
470
|
+
browser = browserInfo ?? {};
|
|
471
|
+
} else {
|
|
472
|
+
browser = await defaultBrowser2();
|
|
391
473
|
}
|
|
392
|
-
|
|
393
|
-
|
|
474
|
+
if (browser.id in ids) {
|
|
475
|
+
const browserName = ids[browser.id.toLowerCase()];
|
|
476
|
+
if (app === "browserPrivate") {
|
|
477
|
+
if (browserName === "safari") {
|
|
478
|
+
throw new Error("Safari doesn't support opening in private mode via command line");
|
|
479
|
+
}
|
|
480
|
+
appArguments.push(flags[browserName]);
|
|
481
|
+
}
|
|
482
|
+
return baseOpen({
|
|
483
|
+
...options,
|
|
484
|
+
app: {
|
|
485
|
+
name: apps[browserName],
|
|
486
|
+
arguments: appArguments
|
|
487
|
+
}
|
|
488
|
+
});
|
|
394
489
|
}
|
|
395
|
-
|
|
396
|
-
|
|
490
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
491
|
+
}
|
|
492
|
+
let command;
|
|
493
|
+
const cliArguments = [];
|
|
494
|
+
const childProcessOptions = {};
|
|
495
|
+
let shouldUseWindowsInWsl = false;
|
|
496
|
+
if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
|
|
497
|
+
shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
498
|
+
}
|
|
499
|
+
if (platform === "darwin") {
|
|
500
|
+
command = "open";
|
|
501
|
+
if (options.wait) {
|
|
502
|
+
cliArguments.push("--wait-apps");
|
|
397
503
|
}
|
|
398
|
-
|
|
399
|
-
|
|
504
|
+
if (options.background) {
|
|
505
|
+
cliArguments.push("--background");
|
|
400
506
|
}
|
|
401
|
-
|
|
402
|
-
|
|
507
|
+
if (options.newInstance) {
|
|
508
|
+
cliArguments.push("--new");
|
|
403
509
|
}
|
|
404
|
-
|
|
405
|
-
|
|
510
|
+
if (app) {
|
|
511
|
+
cliArguments.push("-a", app);
|
|
406
512
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return this.styleArgumentText(word);
|
|
413
|
-
return this.styleSubcommandText(word);
|
|
414
|
-
}).join(" ");
|
|
513
|
+
} else if (platform === "win32" || shouldUseWindowsInWsl) {
|
|
514
|
+
command = await powerShellPath2();
|
|
515
|
+
cliArguments.push(...executePowerShell.argumentsPrefix);
|
|
516
|
+
if (!is_wsl_default) {
|
|
517
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
415
518
|
}
|
|
416
|
-
|
|
417
|
-
|
|
519
|
+
if (is_wsl_default && options.target) {
|
|
520
|
+
options.target = await convertWslPathToWindows(options.target);
|
|
418
521
|
}
|
|
419
|
-
|
|
420
|
-
|
|
522
|
+
const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
|
|
523
|
+
if (options.wait) {
|
|
524
|
+
encodedArguments.push("-Wait");
|
|
421
525
|
}
|
|
422
|
-
|
|
423
|
-
|
|
526
|
+
if (app) {
|
|
527
|
+
encodedArguments.push(executePowerShell.escapeArgument(app));
|
|
528
|
+
if (options.target) {
|
|
529
|
+
appArguments.push(options.target);
|
|
530
|
+
}
|
|
531
|
+
} else if (options.target) {
|
|
532
|
+
encodedArguments.push(executePowerShell.escapeArgument(options.target));
|
|
424
533
|
}
|
|
425
|
-
|
|
426
|
-
|
|
534
|
+
if (appArguments.length > 0) {
|
|
535
|
+
appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
|
|
536
|
+
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
427
537
|
}
|
|
428
|
-
|
|
429
|
-
|
|
538
|
+
options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
|
|
539
|
+
if (!options.wait) {
|
|
540
|
+
childProcessOptions.stdio = "ignore";
|
|
430
541
|
}
|
|
431
|
-
|
|
432
|
-
|
|
542
|
+
} else {
|
|
543
|
+
if (app) {
|
|
544
|
+
command = app;
|
|
545
|
+
} else {
|
|
546
|
+
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
547
|
+
let exeLocalXdgOpen = false;
|
|
548
|
+
try {
|
|
549
|
+
await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
|
|
550
|
+
exeLocalXdgOpen = true;
|
|
551
|
+
} catch {}
|
|
552
|
+
const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
553
|
+
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
433
554
|
}
|
|
434
|
-
|
|
435
|
-
|
|
555
|
+
if (appArguments.length > 0) {
|
|
556
|
+
cliArguments.push(...appArguments);
|
|
436
557
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (!description)
|
|
441
|
-
return itemIndentStr + term;
|
|
442
|
-
const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
|
|
443
|
-
const spacerWidth = 2;
|
|
444
|
-
const helpWidth = this.helpWidth ?? 80;
|
|
445
|
-
const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
|
|
446
|
-
let formattedDescription;
|
|
447
|
-
if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
|
|
448
|
-
formattedDescription = description;
|
|
449
|
-
} else {
|
|
450
|
-
const wrappedDescription = helper.boxWrap(description, remainingWidth);
|
|
451
|
-
formattedDescription = wrappedDescription.replace(/\n/g, `
|
|
452
|
-
` + " ".repeat(termWidth + spacerWidth));
|
|
453
|
-
}
|
|
454
|
-
return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
|
|
455
|
-
${itemIndentStr}`);
|
|
558
|
+
if (!options.wait) {
|
|
559
|
+
childProcessOptions.stdio = "ignore";
|
|
560
|
+
childProcessOptions.detached = true;
|
|
456
561
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
562
|
+
}
|
|
563
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
564
|
+
cliArguments.push("--args", ...appArguments);
|
|
565
|
+
}
|
|
566
|
+
if (options.target) {
|
|
567
|
+
cliArguments.push(options.target);
|
|
568
|
+
}
|
|
569
|
+
const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
|
|
570
|
+
if (options.wait) {
|
|
571
|
+
return new Promise((resolve, reject) => {
|
|
572
|
+
subprocess.once("error", reject);
|
|
573
|
+
subprocess.once("close", (exitCode) => {
|
|
574
|
+
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
575
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
467
576
|
return;
|
|
468
577
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
578
|
+
resolve(subprocess);
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
if (isFallbackAttempt) {
|
|
583
|
+
return new Promise((resolve, reject) => {
|
|
584
|
+
subprocess.once("error", reject);
|
|
585
|
+
subprocess.once("spawn", () => {
|
|
586
|
+
subprocess.once("close", (exitCode) => {
|
|
587
|
+
subprocess.off("error", reject);
|
|
588
|
+
if (exitCode !== 0) {
|
|
589
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
476
590
|
return;
|
|
477
591
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
sumChunks = [nextChunk];
|
|
481
|
-
sumWidth = this.displayWidth(nextChunk);
|
|
592
|
+
subprocess.unref();
|
|
593
|
+
resolve(subprocess);
|
|
482
594
|
});
|
|
483
|
-
wrappedLines.push(sumChunks.join(""));
|
|
484
595
|
});
|
|
485
|
-
|
|
486
|
-
`);
|
|
487
|
-
}
|
|
596
|
+
});
|
|
488
597
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
598
|
+
subprocess.unref();
|
|
599
|
+
return new Promise((resolve, reject) => {
|
|
600
|
+
subprocess.once("error", reject);
|
|
601
|
+
subprocess.once("spawn", () => {
|
|
602
|
+
subprocess.off("error", reject);
|
|
603
|
+
resolve(subprocess);
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
}, open = (target, options) => {
|
|
607
|
+
if (typeof target !== "string") {
|
|
608
|
+
throw new TypeError("Expected a `target`");
|
|
492
609
|
}
|
|
493
|
-
|
|
494
|
-
|
|
610
|
+
return baseOpen({
|
|
611
|
+
...options,
|
|
612
|
+
target
|
|
613
|
+
});
|
|
614
|
+
}, apps, open_default;
|
|
615
|
+
var init_open = __esm(() => {
|
|
616
|
+
init_wsl_utils();
|
|
617
|
+
init_powershell_utils();
|
|
618
|
+
init_default_browser();
|
|
619
|
+
init_is_inside_container();
|
|
620
|
+
init_is_in_ssh();
|
|
621
|
+
fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
622
|
+
__dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
623
|
+
localXdgOpenPath = path.join(__dirname2, "xdg-open");
|
|
624
|
+
({ platform, arch } = process8);
|
|
625
|
+
apps = {
|
|
626
|
+
browser: "browser",
|
|
627
|
+
browserPrivate: "browserPrivate"
|
|
628
|
+
};
|
|
629
|
+
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
630
|
+
darwin: "google chrome",
|
|
631
|
+
win32: "chrome",
|
|
632
|
+
linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
|
|
633
|
+
}, {
|
|
634
|
+
wsl: {
|
|
635
|
+
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
636
|
+
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
637
|
+
}
|
|
638
|
+
}));
|
|
639
|
+
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
640
|
+
darwin: "brave browser",
|
|
641
|
+
win32: "brave",
|
|
642
|
+
linux: ["brave-browser", "brave"]
|
|
643
|
+
}, {
|
|
644
|
+
wsl: {
|
|
645
|
+
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
646
|
+
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
647
|
+
}
|
|
648
|
+
}));
|
|
649
|
+
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
650
|
+
darwin: "firefox",
|
|
651
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
652
|
+
linux: "firefox"
|
|
653
|
+
}, {
|
|
654
|
+
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
655
|
+
}));
|
|
656
|
+
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
657
|
+
darwin: "microsoft edge",
|
|
658
|
+
win32: "msedge",
|
|
659
|
+
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
660
|
+
}, {
|
|
661
|
+
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
662
|
+
}));
|
|
663
|
+
defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
664
|
+
darwin: "Safari"
|
|
665
|
+
}));
|
|
666
|
+
open_default = open;
|
|
495
667
|
});
|
|
496
668
|
|
|
497
|
-
//
|
|
498
|
-
|
|
499
|
-
|
|
669
|
+
// ../filesystem/src/node.ts
|
|
670
|
+
import { existsSync } from "node:fs";
|
|
671
|
+
import * as fs6 from "node:fs/promises";
|
|
672
|
+
import * as os2 from "node:os";
|
|
673
|
+
import * as path2 from "node:path";
|
|
500
674
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
this.envVar = undefined;
|
|
520
|
-
this.parseArg = undefined;
|
|
521
|
-
this.hidden = false;
|
|
522
|
-
this.argChoices = undefined;
|
|
523
|
-
this.conflictsWith = [];
|
|
524
|
-
this.implied = undefined;
|
|
525
|
-
this.helpGroupHeading = undefined;
|
|
675
|
+
class NodeFileSystem {
|
|
676
|
+
path = {
|
|
677
|
+
join: path2.join,
|
|
678
|
+
resolve: path2.resolve,
|
|
679
|
+
relative: path2.relative,
|
|
680
|
+
dirname: path2.dirname,
|
|
681
|
+
isAbsolute: path2.isAbsolute,
|
|
682
|
+
basename: path2.basename
|
|
683
|
+
};
|
|
684
|
+
env = {
|
|
685
|
+
cwd: process.cwd,
|
|
686
|
+
homedir: os2.homedir,
|
|
687
|
+
tmpdir: os2.tmpdir,
|
|
688
|
+
getenv: (key) => process.env[key]
|
|
689
|
+
};
|
|
690
|
+
utils = {
|
|
691
|
+
open: async (url) => {
|
|
692
|
+
await open_default(url);
|
|
526
693
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
694
|
+
};
|
|
695
|
+
async readFile(path3, options) {
|
|
696
|
+
try {
|
|
697
|
+
if (options) {
|
|
698
|
+
return await fs6.readFile(path3, "utf-8");
|
|
699
|
+
}
|
|
700
|
+
return await fs6.readFile(path3);
|
|
701
|
+
} catch (error) {
|
|
702
|
+
if (this.isEnoent(error))
|
|
703
|
+
return null;
|
|
704
|
+
throw error;
|
|
531
705
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
706
|
+
}
|
|
707
|
+
async writeFile(filePath, data) {
|
|
708
|
+
const dir = path2.dirname(filePath);
|
|
709
|
+
if (dir) {
|
|
710
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
535
711
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
712
|
+
await fs6.writeFile(filePath, data);
|
|
713
|
+
}
|
|
714
|
+
async appendFile(filePath, data) {
|
|
715
|
+
const dir = path2.dirname(filePath);
|
|
716
|
+
if (dir) {
|
|
717
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
539
718
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
719
|
+
await fs6.appendFile(filePath, data);
|
|
720
|
+
}
|
|
721
|
+
async readdir(dirPath) {
|
|
722
|
+
try {
|
|
723
|
+
return await fs6.readdir(dirPath);
|
|
724
|
+
} catch (error) {
|
|
725
|
+
if (this.isEnoent(error))
|
|
726
|
+
return [];
|
|
727
|
+
throw error;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
async stat(filePath) {
|
|
731
|
+
try {
|
|
732
|
+
const stats = await fs6.stat(filePath);
|
|
733
|
+
return {
|
|
734
|
+
isFile: () => stats.isFile(),
|
|
735
|
+
isDirectory: () => stats.isDirectory(),
|
|
736
|
+
size: stats.size,
|
|
737
|
+
mtimeMs: stats.mtimeMs
|
|
738
|
+
};
|
|
739
|
+
} catch (error) {
|
|
740
|
+
if (this.isEnoent(error))
|
|
741
|
+
return null;
|
|
742
|
+
throw error;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
async exists(filePath) {
|
|
746
|
+
return existsSync(filePath);
|
|
747
|
+
}
|
|
748
|
+
async mkdir(dirPath) {
|
|
749
|
+
await fs6.mkdir(dirPath, { recursive: true });
|
|
750
|
+
}
|
|
751
|
+
async rm(filePath) {
|
|
752
|
+
await fs6.rm(filePath, { recursive: true, force: true });
|
|
753
|
+
}
|
|
754
|
+
async rename(oldPath, newPath) {
|
|
755
|
+
await fs6.rename(oldPath, newPath);
|
|
756
|
+
}
|
|
757
|
+
async realpath(filePath) {
|
|
758
|
+
try {
|
|
759
|
+
return await fs6.realpath(filePath);
|
|
760
|
+
} catch (error) {
|
|
761
|
+
if (this.isEnoent(error))
|
|
762
|
+
return filePath;
|
|
763
|
+
throw error;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
async getTempDir() {
|
|
767
|
+
return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
|
|
768
|
+
}
|
|
769
|
+
async copyDirectory(sourcePath, destPath) {
|
|
770
|
+
const sourceStats = await this.stat(sourcePath);
|
|
771
|
+
if (!sourceStats) {
|
|
772
|
+
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
773
|
+
}
|
|
774
|
+
if (!sourceStats.isDirectory()) {
|
|
775
|
+
throw new Error(`Source path is not a directory: ${sourcePath}`);
|
|
776
|
+
}
|
|
777
|
+
await this.mkdir(destPath);
|
|
778
|
+
const entries = await this.readdir(sourcePath);
|
|
779
|
+
for (const entry of entries) {
|
|
780
|
+
const srcEntry = path2.join(sourcePath, entry);
|
|
781
|
+
const destEntry = path2.join(destPath, entry);
|
|
782
|
+
const entryStats = await this.stat(srcEntry);
|
|
783
|
+
if (!entryStats)
|
|
784
|
+
continue;
|
|
785
|
+
if (entryStats.isDirectory()) {
|
|
786
|
+
await this.copyDirectory(srcEntry, destEntry);
|
|
787
|
+
} else if (entryStats.isFile()) {
|
|
788
|
+
const content = await this.readFile(srcEntry);
|
|
789
|
+
if (content !== null) {
|
|
790
|
+
await this.writeFile(destEntry, content);
|
|
791
|
+
}
|
|
544
792
|
}
|
|
545
|
-
this.implied = Object.assign(this.implied || {}, newImplied);
|
|
546
|
-
return this;
|
|
547
793
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
794
|
+
}
|
|
795
|
+
isEnoent(error) {
|
|
796
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
var init_node = __esm(() => {
|
|
800
|
+
init_open();
|
|
801
|
+
});
|
|
802
|
+
// ../filesystem/src/index.ts
|
|
803
|
+
var fsInstance, getFileSystem = () => fsInstance;
|
|
804
|
+
var init_src = __esm(() => {
|
|
805
|
+
init_node();
|
|
806
|
+
init_node();
|
|
807
|
+
fsInstance = new NodeFileSystem;
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
// ../../node_modules/commander/lib/error.js
|
|
811
|
+
var require_error = __commonJS((exports) => {
|
|
812
|
+
class CommanderError extends Error {
|
|
813
|
+
constructor(exitCode, code, message) {
|
|
814
|
+
super(message);
|
|
815
|
+
Error.captureStackTrace(this, this.constructor);
|
|
816
|
+
this.name = this.constructor.name;
|
|
817
|
+
this.code = code;
|
|
818
|
+
this.exitCode = exitCode;
|
|
819
|
+
this.nestedError = undefined;
|
|
551
820
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
class InvalidArgumentError extends CommanderError {
|
|
824
|
+
constructor(message) {
|
|
825
|
+
super(1, "commander.invalidArgument", message);
|
|
826
|
+
Error.captureStackTrace(this, this.constructor);
|
|
827
|
+
this.name = this.constructor.name;
|
|
555
828
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
829
|
+
}
|
|
830
|
+
exports.CommanderError = CommanderError;
|
|
831
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// ../../node_modules/commander/lib/argument.js
|
|
835
|
+
var require_argument = __commonJS((exports) => {
|
|
836
|
+
var { InvalidArgumentError } = require_error();
|
|
837
|
+
|
|
838
|
+
class Argument {
|
|
839
|
+
constructor(name, description) {
|
|
840
|
+
this.description = description || "";
|
|
841
|
+
this.variadic = false;
|
|
842
|
+
this.parseArg = undefined;
|
|
843
|
+
this.defaultValue = undefined;
|
|
844
|
+
this.defaultValueDescription = undefined;
|
|
845
|
+
this.argChoices = undefined;
|
|
846
|
+
switch (name[0]) {
|
|
847
|
+
case "<":
|
|
848
|
+
this.required = true;
|
|
849
|
+
this._name = name.slice(1, -1);
|
|
850
|
+
break;
|
|
851
|
+
case "[":
|
|
852
|
+
this.required = false;
|
|
853
|
+
this._name = name.slice(1, -1);
|
|
854
|
+
break;
|
|
855
|
+
default:
|
|
856
|
+
this.required = true;
|
|
857
|
+
this._name = name;
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
if (this._name.endsWith("...")) {
|
|
861
|
+
this.variadic = true;
|
|
862
|
+
this._name = this._name.slice(0, -3);
|
|
863
|
+
}
|
|
559
864
|
}
|
|
560
|
-
|
|
561
|
-
this.
|
|
562
|
-
return this;
|
|
865
|
+
name() {
|
|
866
|
+
return this._name;
|
|
563
867
|
}
|
|
564
868
|
_collectValue(value, previous) {
|
|
565
869
|
if (previous === this.defaultValue || !Array.isArray(previous)) {
|
|
@@ -568,6 +872,15 @@ var require_option = __commonJS((exports) => {
|
|
|
568
872
|
previous.push(value);
|
|
569
873
|
return previous;
|
|
570
874
|
}
|
|
875
|
+
default(value, description) {
|
|
876
|
+
this.defaultValue = value;
|
|
877
|
+
this.defaultValueDescription = description;
|
|
878
|
+
return this;
|
|
879
|
+
}
|
|
880
|
+
argParser(fn) {
|
|
881
|
+
this.parseArg = fn;
|
|
882
|
+
return this;
|
|
883
|
+
}
|
|
571
884
|
choices(values) {
|
|
572
885
|
this.argChoices = values.slice();
|
|
573
886
|
this.parseArg = (arg, previous) => {
|
|
@@ -581,189 +894,650 @@ var require_option = __commonJS((exports) => {
|
|
|
581
894
|
};
|
|
582
895
|
return this;
|
|
583
896
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
return this.long.replace(/^--/, "");
|
|
587
|
-
}
|
|
588
|
-
return this.short.replace(/^-/, "");
|
|
589
|
-
}
|
|
590
|
-
attributeName() {
|
|
591
|
-
if (this.negate) {
|
|
592
|
-
return camelcase(this.name().replace(/^no-/, ""));
|
|
593
|
-
}
|
|
594
|
-
return camelcase(this.name());
|
|
595
|
-
}
|
|
596
|
-
helpGroup(heading) {
|
|
597
|
-
this.helpGroupHeading = heading;
|
|
897
|
+
argRequired() {
|
|
898
|
+
this.required = true;
|
|
598
899
|
return this;
|
|
599
900
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
isBoolean() {
|
|
604
|
-
return !this.required && !this.optional && !this.negate;
|
|
901
|
+
argOptional() {
|
|
902
|
+
this.required = false;
|
|
903
|
+
return this;
|
|
605
904
|
}
|
|
606
905
|
}
|
|
906
|
+
function humanReadableArgName(arg) {
|
|
907
|
+
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
908
|
+
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
909
|
+
}
|
|
910
|
+
exports.Argument = Argument;
|
|
911
|
+
exports.humanReadableArgName = humanReadableArgName;
|
|
912
|
+
});
|
|
607
913
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
});
|
|
620
|
-
this.negativeOptions.forEach((value, key) => {
|
|
621
|
-
if (this.positiveOptions.has(key)) {
|
|
622
|
-
this.dualOptions.add(key);
|
|
623
|
-
}
|
|
624
|
-
});
|
|
914
|
+
// ../../node_modules/commander/lib/help.js
|
|
915
|
+
var require_help = __commonJS((exports) => {
|
|
916
|
+
var { humanReadableArgName } = require_argument();
|
|
917
|
+
|
|
918
|
+
class Help {
|
|
919
|
+
constructor() {
|
|
920
|
+
this.helpWidth = undefined;
|
|
921
|
+
this.minWidthToWrap = 40;
|
|
922
|
+
this.sortSubcommands = false;
|
|
923
|
+
this.sortOptions = false;
|
|
924
|
+
this.showGlobalOptions = false;
|
|
625
925
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
if (!this.dualOptions.has(optionKey))
|
|
629
|
-
return true;
|
|
630
|
-
const preset = this.negativeOptions.get(optionKey).presetArg;
|
|
631
|
-
const negativeValue = preset !== undefined ? preset : false;
|
|
632
|
-
return option.negate === (negativeValue === value);
|
|
926
|
+
prepareContext(contextOptions) {
|
|
927
|
+
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
633
928
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
if (shortFlagExp.test(flagParts[0]))
|
|
647
|
-
shortFlag = flagParts.shift();
|
|
648
|
-
if (longFlagExp.test(flagParts[0]))
|
|
649
|
-
longFlag = flagParts.shift();
|
|
650
|
-
if (!shortFlag && shortFlagExp.test(flagParts[0]))
|
|
651
|
-
shortFlag = flagParts.shift();
|
|
652
|
-
if (!shortFlag && longFlagExp.test(flagParts[0])) {
|
|
653
|
-
shortFlag = longFlag;
|
|
654
|
-
longFlag = flagParts.shift();
|
|
929
|
+
visibleCommands(cmd) {
|
|
930
|
+
const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
|
|
931
|
+
const helpCommand = cmd._getHelpCommand();
|
|
932
|
+
if (helpCommand && !helpCommand._hidden) {
|
|
933
|
+
visibleCommands.push(helpCommand);
|
|
934
|
+
}
|
|
935
|
+
if (this.sortSubcommands) {
|
|
936
|
+
visibleCommands.sort((a, b) => {
|
|
937
|
+
return a.name().localeCompare(b.name());
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
return visibleCommands;
|
|
655
941
|
}
|
|
656
|
-
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
- a short flag is a single dash and a single character
|
|
662
|
-
- either use a single dash and a single character (for a short flag)
|
|
663
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
|
|
664
|
-
if (shortFlagExp.test(unsupportedFlag))
|
|
665
|
-
throw new Error(`${baseError}
|
|
666
|
-
- too many short flags`);
|
|
667
|
-
if (longFlagExp.test(unsupportedFlag))
|
|
668
|
-
throw new Error(`${baseError}
|
|
669
|
-
- too many long flags`);
|
|
670
|
-
throw new Error(`${baseError}
|
|
671
|
-
- unrecognised flag format`);
|
|
942
|
+
compareOptions(a, b) {
|
|
943
|
+
const getSortKey = (option) => {
|
|
944
|
+
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
945
|
+
};
|
|
946
|
+
return getSortKey(a).localeCompare(getSortKey(b));
|
|
672
947
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
948
|
+
visibleOptions(cmd) {
|
|
949
|
+
const visibleOptions = cmd.options.filter((option) => !option.hidden);
|
|
950
|
+
const helpOption = cmd._getHelpOption();
|
|
951
|
+
if (helpOption && !helpOption.hidden) {
|
|
952
|
+
const removeShort = helpOption.short && cmd._findOption(helpOption.short);
|
|
953
|
+
const removeLong = helpOption.long && cmd._findOption(helpOption.long);
|
|
954
|
+
if (!removeShort && !removeLong) {
|
|
955
|
+
visibleOptions.push(helpOption);
|
|
956
|
+
} else if (helpOption.long && !removeLong) {
|
|
957
|
+
visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
|
|
958
|
+
} else if (helpOption.short && !removeShort) {
|
|
959
|
+
visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (this.sortOptions) {
|
|
963
|
+
visibleOptions.sort(this.compareOptions);
|
|
964
|
+
}
|
|
965
|
+
return visibleOptions;
|
|
690
966
|
}
|
|
691
|
-
|
|
692
|
-
|
|
967
|
+
visibleGlobalOptions(cmd) {
|
|
968
|
+
if (!this.showGlobalOptions)
|
|
969
|
+
return [];
|
|
970
|
+
const globalOptions = [];
|
|
971
|
+
for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
|
|
972
|
+
const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
|
|
973
|
+
globalOptions.push(...visibleOptions);
|
|
974
|
+
}
|
|
975
|
+
if (this.sortOptions) {
|
|
976
|
+
globalOptions.sort(this.compareOptions);
|
|
977
|
+
}
|
|
978
|
+
return globalOptions;
|
|
693
979
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
} else {
|
|
700
|
-
cost = 1;
|
|
701
|
-
}
|
|
702
|
-
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
|
703
|
-
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
704
|
-
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
|
|
705
|
-
}
|
|
980
|
+
visibleArguments(cmd) {
|
|
981
|
+
if (cmd._argsDescription) {
|
|
982
|
+
cmd.registeredArguments.forEach((argument) => {
|
|
983
|
+
argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
|
|
984
|
+
});
|
|
706
985
|
}
|
|
986
|
+
if (cmd.registeredArguments.find((argument) => argument.description)) {
|
|
987
|
+
return cmd.registeredArguments;
|
|
988
|
+
}
|
|
989
|
+
return [];
|
|
707
990
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
if (!candidates || candidates.length === 0)
|
|
712
|
-
return "";
|
|
713
|
-
candidates = Array.from(new Set(candidates));
|
|
714
|
-
const searchingOptions = word.startsWith("--");
|
|
715
|
-
if (searchingOptions) {
|
|
716
|
-
word = word.slice(2);
|
|
717
|
-
candidates = candidates.map((candidate) => candidate.slice(2));
|
|
991
|
+
subcommandTerm(cmd) {
|
|
992
|
+
const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
|
|
993
|
+
return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
|
|
718
994
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
995
|
+
optionTerm(option) {
|
|
996
|
+
return option.flags;
|
|
997
|
+
}
|
|
998
|
+
argumentTerm(argument) {
|
|
999
|
+
return argument.name();
|
|
1000
|
+
}
|
|
1001
|
+
longestSubcommandTermLength(cmd, helper) {
|
|
1002
|
+
return helper.visibleCommands(cmd).reduce((max, command) => {
|
|
1003
|
+
return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
|
|
1004
|
+
}, 0);
|
|
1005
|
+
}
|
|
1006
|
+
longestOptionTermLength(cmd, helper) {
|
|
1007
|
+
return helper.visibleOptions(cmd).reduce((max, option) => {
|
|
1008
|
+
return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
|
|
1009
|
+
}, 0);
|
|
1010
|
+
}
|
|
1011
|
+
longestGlobalOptionTermLength(cmd, helper) {
|
|
1012
|
+
return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
|
|
1013
|
+
return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
|
|
1014
|
+
}, 0);
|
|
1015
|
+
}
|
|
1016
|
+
longestArgumentTermLength(cmd, helper) {
|
|
1017
|
+
return helper.visibleArguments(cmd).reduce((max, argument) => {
|
|
1018
|
+
return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
|
|
1019
|
+
}, 0);
|
|
1020
|
+
}
|
|
1021
|
+
commandUsage(cmd) {
|
|
1022
|
+
let cmdName = cmd._name;
|
|
1023
|
+
if (cmd._aliases[0]) {
|
|
1024
|
+
cmdName = cmdName + "|" + cmd._aliases[0];
|
|
735
1025
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1026
|
+
let ancestorCmdNames = "";
|
|
1027
|
+
for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
|
|
1028
|
+
ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
|
|
1029
|
+
}
|
|
1030
|
+
return ancestorCmdNames + cmdName + " " + cmd.usage();
|
|
740
1031
|
}
|
|
741
|
-
|
|
742
|
-
return
|
|
743
|
-
(Did you mean one of ${similar.join(", ")}?)`;
|
|
1032
|
+
commandDescription(cmd) {
|
|
1033
|
+
return cmd.description();
|
|
744
1034
|
}
|
|
745
|
-
|
|
746
|
-
return
|
|
747
|
-
(Did you mean ${similar[0]}?)`;
|
|
1035
|
+
subcommandDescription(cmd) {
|
|
1036
|
+
return cmd.summary() || cmd.description();
|
|
748
1037
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
});
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
1038
|
+
optionDescription(option) {
|
|
1039
|
+
const extraInfo = [];
|
|
1040
|
+
if (option.argChoices) {
|
|
1041
|
+
extraInfo.push(`choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
|
|
1042
|
+
}
|
|
1043
|
+
if (option.defaultValue !== undefined) {
|
|
1044
|
+
const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
|
|
1045
|
+
if (showDefault) {
|
|
1046
|
+
extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (option.presetArg !== undefined && option.optional) {
|
|
1050
|
+
extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
|
|
1051
|
+
}
|
|
1052
|
+
if (option.envVar !== undefined) {
|
|
1053
|
+
extraInfo.push(`env: ${option.envVar}`);
|
|
1054
|
+
}
|
|
1055
|
+
if (extraInfo.length > 0) {
|
|
1056
|
+
const extraDescription = `(${extraInfo.join(", ")})`;
|
|
1057
|
+
if (option.description) {
|
|
1058
|
+
return `${option.description} ${extraDescription}`;
|
|
1059
|
+
}
|
|
1060
|
+
return extraDescription;
|
|
1061
|
+
}
|
|
1062
|
+
return option.description;
|
|
1063
|
+
}
|
|
1064
|
+
argumentDescription(argument) {
|
|
1065
|
+
const extraInfo = [];
|
|
1066
|
+
if (argument.argChoices) {
|
|
1067
|
+
extraInfo.push(`choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
|
|
1068
|
+
}
|
|
1069
|
+
if (argument.defaultValue !== undefined) {
|
|
1070
|
+
extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
|
|
1071
|
+
}
|
|
1072
|
+
if (extraInfo.length > 0) {
|
|
1073
|
+
const extraDescription = `(${extraInfo.join(", ")})`;
|
|
1074
|
+
if (argument.description) {
|
|
1075
|
+
return `${argument.description} ${extraDescription}`;
|
|
1076
|
+
}
|
|
1077
|
+
return extraDescription;
|
|
1078
|
+
}
|
|
1079
|
+
return argument.description;
|
|
1080
|
+
}
|
|
1081
|
+
formatItemList(heading, items, helper) {
|
|
1082
|
+
if (items.length === 0)
|
|
1083
|
+
return [];
|
|
1084
|
+
return [helper.styleTitle(heading), ...items, ""];
|
|
1085
|
+
}
|
|
1086
|
+
groupItems(unsortedItems, visibleItems, getGroup) {
|
|
1087
|
+
const result = new Map;
|
|
1088
|
+
unsortedItems.forEach((item) => {
|
|
1089
|
+
const group = getGroup(item);
|
|
1090
|
+
if (!result.has(group))
|
|
1091
|
+
result.set(group, []);
|
|
1092
|
+
});
|
|
1093
|
+
visibleItems.forEach((item) => {
|
|
1094
|
+
const group = getGroup(item);
|
|
1095
|
+
if (!result.has(group)) {
|
|
1096
|
+
result.set(group, []);
|
|
1097
|
+
}
|
|
1098
|
+
result.get(group).push(item);
|
|
1099
|
+
});
|
|
1100
|
+
return result;
|
|
1101
|
+
}
|
|
1102
|
+
formatHelp(cmd, helper) {
|
|
1103
|
+
const termWidth = helper.padWidth(cmd, helper);
|
|
1104
|
+
const helpWidth = helper.helpWidth ?? 80;
|
|
1105
|
+
function callFormatItem(term, description) {
|
|
1106
|
+
return helper.formatItem(term, termWidth, description, helper);
|
|
1107
|
+
}
|
|
1108
|
+
let output = [
|
|
1109
|
+
`${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
|
|
1110
|
+
""
|
|
1111
|
+
];
|
|
1112
|
+
const commandDescription = helper.commandDescription(cmd);
|
|
1113
|
+
if (commandDescription.length > 0) {
|
|
1114
|
+
output = output.concat([
|
|
1115
|
+
helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
|
|
1116
|
+
""
|
|
1117
|
+
]);
|
|
1118
|
+
}
|
|
1119
|
+
const argumentList = helper.visibleArguments(cmd).map((argument) => {
|
|
1120
|
+
return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
|
|
1121
|
+
});
|
|
1122
|
+
output = output.concat(this.formatItemList("Arguments:", argumentList, helper));
|
|
1123
|
+
const optionGroups = this.groupItems(cmd.options, helper.visibleOptions(cmd), (option) => option.helpGroupHeading ?? "Options:");
|
|
1124
|
+
optionGroups.forEach((options, group) => {
|
|
1125
|
+
const optionList = options.map((option) => {
|
|
1126
|
+
return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
|
|
1127
|
+
});
|
|
1128
|
+
output = output.concat(this.formatItemList(group, optionList, helper));
|
|
1129
|
+
});
|
|
1130
|
+
if (helper.showGlobalOptions) {
|
|
1131
|
+
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
|
|
1132
|
+
return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
|
|
1133
|
+
});
|
|
1134
|
+
output = output.concat(this.formatItemList("Global Options:", globalOptionList, helper));
|
|
1135
|
+
}
|
|
1136
|
+
const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub) => sub.helpGroup() || "Commands:");
|
|
1137
|
+
commandGroups.forEach((commands, group) => {
|
|
1138
|
+
const commandList = commands.map((sub) => {
|
|
1139
|
+
return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub)), helper.styleSubcommandDescription(helper.subcommandDescription(sub)));
|
|
1140
|
+
});
|
|
1141
|
+
output = output.concat(this.formatItemList(group, commandList, helper));
|
|
1142
|
+
});
|
|
1143
|
+
return output.join(`
|
|
1144
|
+
`);
|
|
1145
|
+
}
|
|
1146
|
+
displayWidth(str) {
|
|
1147
|
+
return stripColor(str).length;
|
|
1148
|
+
}
|
|
1149
|
+
styleTitle(str) {
|
|
1150
|
+
return str;
|
|
1151
|
+
}
|
|
1152
|
+
styleUsage(str) {
|
|
1153
|
+
return str.split(" ").map((word) => {
|
|
1154
|
+
if (word === "[options]")
|
|
1155
|
+
return this.styleOptionText(word);
|
|
1156
|
+
if (word === "[command]")
|
|
1157
|
+
return this.styleSubcommandText(word);
|
|
1158
|
+
if (word[0] === "[" || word[0] === "<")
|
|
1159
|
+
return this.styleArgumentText(word);
|
|
1160
|
+
return this.styleCommandText(word);
|
|
1161
|
+
}).join(" ");
|
|
1162
|
+
}
|
|
1163
|
+
styleCommandDescription(str) {
|
|
1164
|
+
return this.styleDescriptionText(str);
|
|
1165
|
+
}
|
|
1166
|
+
styleOptionDescription(str) {
|
|
1167
|
+
return this.styleDescriptionText(str);
|
|
1168
|
+
}
|
|
1169
|
+
styleSubcommandDescription(str) {
|
|
1170
|
+
return this.styleDescriptionText(str);
|
|
1171
|
+
}
|
|
1172
|
+
styleArgumentDescription(str) {
|
|
1173
|
+
return this.styleDescriptionText(str);
|
|
1174
|
+
}
|
|
1175
|
+
styleDescriptionText(str) {
|
|
1176
|
+
return str;
|
|
1177
|
+
}
|
|
1178
|
+
styleOptionTerm(str) {
|
|
1179
|
+
return this.styleOptionText(str);
|
|
1180
|
+
}
|
|
1181
|
+
styleSubcommandTerm(str) {
|
|
1182
|
+
return str.split(" ").map((word) => {
|
|
1183
|
+
if (word === "[options]")
|
|
1184
|
+
return this.styleOptionText(word);
|
|
1185
|
+
if (word[0] === "[" || word[0] === "<")
|
|
1186
|
+
return this.styleArgumentText(word);
|
|
1187
|
+
return this.styleSubcommandText(word);
|
|
1188
|
+
}).join(" ");
|
|
1189
|
+
}
|
|
1190
|
+
styleArgumentTerm(str) {
|
|
1191
|
+
return this.styleArgumentText(str);
|
|
1192
|
+
}
|
|
1193
|
+
styleOptionText(str) {
|
|
1194
|
+
return str;
|
|
1195
|
+
}
|
|
1196
|
+
styleArgumentText(str) {
|
|
1197
|
+
return str;
|
|
1198
|
+
}
|
|
1199
|
+
styleSubcommandText(str) {
|
|
1200
|
+
return str;
|
|
1201
|
+
}
|
|
1202
|
+
styleCommandText(str) {
|
|
1203
|
+
return str;
|
|
1204
|
+
}
|
|
1205
|
+
padWidth(cmd, helper) {
|
|
1206
|
+
return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
|
|
1207
|
+
}
|
|
1208
|
+
preformatted(str) {
|
|
1209
|
+
return /\n[^\S\r\n]/.test(str);
|
|
1210
|
+
}
|
|
1211
|
+
formatItem(term, termWidth, description, helper) {
|
|
1212
|
+
const itemIndent = 2;
|
|
1213
|
+
const itemIndentStr = " ".repeat(itemIndent);
|
|
1214
|
+
if (!description)
|
|
1215
|
+
return itemIndentStr + term;
|
|
1216
|
+
const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
|
|
1217
|
+
const spacerWidth = 2;
|
|
1218
|
+
const helpWidth = this.helpWidth ?? 80;
|
|
1219
|
+
const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
|
|
1220
|
+
let formattedDescription;
|
|
1221
|
+
if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
|
|
1222
|
+
formattedDescription = description;
|
|
1223
|
+
} else {
|
|
1224
|
+
const wrappedDescription = helper.boxWrap(description, remainingWidth);
|
|
1225
|
+
formattedDescription = wrappedDescription.replace(/\n/g, `
|
|
1226
|
+
` + " ".repeat(termWidth + spacerWidth));
|
|
1227
|
+
}
|
|
1228
|
+
return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
|
|
1229
|
+
${itemIndentStr}`);
|
|
1230
|
+
}
|
|
1231
|
+
boxWrap(str, width) {
|
|
1232
|
+
if (width < this.minWidthToWrap)
|
|
1233
|
+
return str;
|
|
1234
|
+
const rawLines = str.split(/\r\n|\n/);
|
|
1235
|
+
const chunkPattern = /[\s]*[^\s]+/g;
|
|
1236
|
+
const wrappedLines = [];
|
|
1237
|
+
rawLines.forEach((line) => {
|
|
1238
|
+
const chunks = line.match(chunkPattern);
|
|
1239
|
+
if (chunks === null) {
|
|
1240
|
+
wrappedLines.push("");
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
let sumChunks = [chunks.shift()];
|
|
1244
|
+
let sumWidth = this.displayWidth(sumChunks[0]);
|
|
1245
|
+
chunks.forEach((chunk) => {
|
|
1246
|
+
const visibleWidth = this.displayWidth(chunk);
|
|
1247
|
+
if (sumWidth + visibleWidth <= width) {
|
|
1248
|
+
sumChunks.push(chunk);
|
|
1249
|
+
sumWidth += visibleWidth;
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
wrappedLines.push(sumChunks.join(""));
|
|
1253
|
+
const nextChunk = chunk.trimStart();
|
|
1254
|
+
sumChunks = [nextChunk];
|
|
1255
|
+
sumWidth = this.displayWidth(nextChunk);
|
|
1256
|
+
});
|
|
1257
|
+
wrappedLines.push(sumChunks.join(""));
|
|
1258
|
+
});
|
|
1259
|
+
return wrappedLines.join(`
|
|
1260
|
+
`);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
function stripColor(str) {
|
|
1264
|
+
const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
|
|
1265
|
+
return str.replace(sgrPattern, "");
|
|
1266
|
+
}
|
|
1267
|
+
exports.Help = Help;
|
|
1268
|
+
exports.stripColor = stripColor;
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
// ../../node_modules/commander/lib/option.js
|
|
1272
|
+
var require_option = __commonJS((exports) => {
|
|
1273
|
+
var { InvalidArgumentError } = require_error();
|
|
1274
|
+
|
|
1275
|
+
class Option {
|
|
1276
|
+
constructor(flags, description) {
|
|
1277
|
+
this.flags = flags;
|
|
1278
|
+
this.description = description || "";
|
|
1279
|
+
this.required = flags.includes("<");
|
|
1280
|
+
this.optional = flags.includes("[");
|
|
1281
|
+
this.variadic = /\w\.\.\.[>\]]$/.test(flags);
|
|
1282
|
+
this.mandatory = false;
|
|
1283
|
+
const optionFlags = splitOptionFlags(flags);
|
|
1284
|
+
this.short = optionFlags.shortFlag;
|
|
1285
|
+
this.long = optionFlags.longFlag;
|
|
1286
|
+
this.negate = false;
|
|
1287
|
+
if (this.long) {
|
|
1288
|
+
this.negate = this.long.startsWith("--no-");
|
|
1289
|
+
}
|
|
1290
|
+
this.defaultValue = undefined;
|
|
1291
|
+
this.defaultValueDescription = undefined;
|
|
1292
|
+
this.presetArg = undefined;
|
|
1293
|
+
this.envVar = undefined;
|
|
1294
|
+
this.parseArg = undefined;
|
|
1295
|
+
this.hidden = false;
|
|
1296
|
+
this.argChoices = undefined;
|
|
1297
|
+
this.conflictsWith = [];
|
|
1298
|
+
this.implied = undefined;
|
|
1299
|
+
this.helpGroupHeading = undefined;
|
|
1300
|
+
}
|
|
1301
|
+
default(value, description) {
|
|
1302
|
+
this.defaultValue = value;
|
|
1303
|
+
this.defaultValueDescription = description;
|
|
1304
|
+
return this;
|
|
1305
|
+
}
|
|
1306
|
+
preset(arg) {
|
|
1307
|
+
this.presetArg = arg;
|
|
1308
|
+
return this;
|
|
1309
|
+
}
|
|
1310
|
+
conflicts(names) {
|
|
1311
|
+
this.conflictsWith = this.conflictsWith.concat(names);
|
|
1312
|
+
return this;
|
|
1313
|
+
}
|
|
1314
|
+
implies(impliedOptionValues) {
|
|
1315
|
+
let newImplied = impliedOptionValues;
|
|
1316
|
+
if (typeof impliedOptionValues === "string") {
|
|
1317
|
+
newImplied = { [impliedOptionValues]: true };
|
|
1318
|
+
}
|
|
1319
|
+
this.implied = Object.assign(this.implied || {}, newImplied);
|
|
1320
|
+
return this;
|
|
1321
|
+
}
|
|
1322
|
+
env(name) {
|
|
1323
|
+
this.envVar = name;
|
|
1324
|
+
return this;
|
|
1325
|
+
}
|
|
1326
|
+
argParser(fn) {
|
|
1327
|
+
this.parseArg = fn;
|
|
1328
|
+
return this;
|
|
1329
|
+
}
|
|
1330
|
+
makeOptionMandatory(mandatory = true) {
|
|
1331
|
+
this.mandatory = !!mandatory;
|
|
1332
|
+
return this;
|
|
1333
|
+
}
|
|
1334
|
+
hideHelp(hide = true) {
|
|
1335
|
+
this.hidden = !!hide;
|
|
1336
|
+
return this;
|
|
1337
|
+
}
|
|
1338
|
+
_collectValue(value, previous) {
|
|
1339
|
+
if (previous === this.defaultValue || !Array.isArray(previous)) {
|
|
1340
|
+
return [value];
|
|
1341
|
+
}
|
|
1342
|
+
previous.push(value);
|
|
1343
|
+
return previous;
|
|
1344
|
+
}
|
|
1345
|
+
choices(values) {
|
|
1346
|
+
this.argChoices = values.slice();
|
|
1347
|
+
this.parseArg = (arg, previous) => {
|
|
1348
|
+
if (!this.argChoices.includes(arg)) {
|
|
1349
|
+
throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
1350
|
+
}
|
|
1351
|
+
if (this.variadic) {
|
|
1352
|
+
return this._collectValue(arg, previous);
|
|
1353
|
+
}
|
|
1354
|
+
return arg;
|
|
1355
|
+
};
|
|
1356
|
+
return this;
|
|
1357
|
+
}
|
|
1358
|
+
name() {
|
|
1359
|
+
if (this.long) {
|
|
1360
|
+
return this.long.replace(/^--/, "");
|
|
1361
|
+
}
|
|
1362
|
+
return this.short.replace(/^-/, "");
|
|
1363
|
+
}
|
|
1364
|
+
attributeName() {
|
|
1365
|
+
if (this.negate) {
|
|
1366
|
+
return camelcase(this.name().replace(/^no-/, ""));
|
|
1367
|
+
}
|
|
1368
|
+
return camelcase(this.name());
|
|
1369
|
+
}
|
|
1370
|
+
helpGroup(heading) {
|
|
1371
|
+
this.helpGroupHeading = heading;
|
|
1372
|
+
return this;
|
|
1373
|
+
}
|
|
1374
|
+
is(arg) {
|
|
1375
|
+
return this.short === arg || this.long === arg;
|
|
1376
|
+
}
|
|
1377
|
+
isBoolean() {
|
|
1378
|
+
return !this.required && !this.optional && !this.negate;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
class DualOptions {
|
|
1383
|
+
constructor(options) {
|
|
1384
|
+
this.positiveOptions = new Map;
|
|
1385
|
+
this.negativeOptions = new Map;
|
|
1386
|
+
this.dualOptions = new Set;
|
|
1387
|
+
options.forEach((option) => {
|
|
1388
|
+
if (option.negate) {
|
|
1389
|
+
this.negativeOptions.set(option.attributeName(), option);
|
|
1390
|
+
} else {
|
|
1391
|
+
this.positiveOptions.set(option.attributeName(), option);
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
this.negativeOptions.forEach((value, key) => {
|
|
1395
|
+
if (this.positiveOptions.has(key)) {
|
|
1396
|
+
this.dualOptions.add(key);
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
valueFromOption(value, option) {
|
|
1401
|
+
const optionKey = option.attributeName();
|
|
1402
|
+
if (!this.dualOptions.has(optionKey))
|
|
1403
|
+
return true;
|
|
1404
|
+
const preset = this.negativeOptions.get(optionKey).presetArg;
|
|
1405
|
+
const negativeValue = preset !== undefined ? preset : false;
|
|
1406
|
+
return option.negate === (negativeValue === value);
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
function camelcase(str) {
|
|
1410
|
+
return str.split("-").reduce((str2, word) => {
|
|
1411
|
+
return str2 + word[0].toUpperCase() + word.slice(1);
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
function splitOptionFlags(flags) {
|
|
1415
|
+
let shortFlag;
|
|
1416
|
+
let longFlag;
|
|
1417
|
+
const shortFlagExp = /^-[^-]$/;
|
|
1418
|
+
const longFlagExp = /^--[^-]/;
|
|
1419
|
+
const flagParts = flags.split(/[ |,]+/).concat("guard");
|
|
1420
|
+
if (shortFlagExp.test(flagParts[0]))
|
|
1421
|
+
shortFlag = flagParts.shift();
|
|
1422
|
+
if (longFlagExp.test(flagParts[0]))
|
|
1423
|
+
longFlag = flagParts.shift();
|
|
1424
|
+
if (!shortFlag && shortFlagExp.test(flagParts[0]))
|
|
1425
|
+
shortFlag = flagParts.shift();
|
|
1426
|
+
if (!shortFlag && longFlagExp.test(flagParts[0])) {
|
|
1427
|
+
shortFlag = longFlag;
|
|
1428
|
+
longFlag = flagParts.shift();
|
|
1429
|
+
}
|
|
1430
|
+
if (flagParts[0].startsWith("-")) {
|
|
1431
|
+
const unsupportedFlag = flagParts[0];
|
|
1432
|
+
const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
|
|
1433
|
+
if (/^-[^-][^-]/.test(unsupportedFlag))
|
|
1434
|
+
throw new Error(`${baseError}
|
|
1435
|
+
- a short flag is a single dash and a single character
|
|
1436
|
+
- either use a single dash and a single character (for a short flag)
|
|
1437
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
|
|
1438
|
+
if (shortFlagExp.test(unsupportedFlag))
|
|
1439
|
+
throw new Error(`${baseError}
|
|
1440
|
+
- too many short flags`);
|
|
1441
|
+
if (longFlagExp.test(unsupportedFlag))
|
|
1442
|
+
throw new Error(`${baseError}
|
|
1443
|
+
- too many long flags`);
|
|
1444
|
+
throw new Error(`${baseError}
|
|
1445
|
+
- unrecognised flag format`);
|
|
1446
|
+
}
|
|
1447
|
+
if (shortFlag === undefined && longFlag === undefined)
|
|
1448
|
+
throw new Error(`option creation failed due to no flags found in '${flags}'.`);
|
|
1449
|
+
return { shortFlag, longFlag };
|
|
1450
|
+
}
|
|
1451
|
+
exports.Option = Option;
|
|
1452
|
+
exports.DualOptions = DualOptions;
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
// ../../node_modules/commander/lib/suggestSimilar.js
|
|
1456
|
+
var require_suggestSimilar = __commonJS((exports) => {
|
|
1457
|
+
var maxDistance = 3;
|
|
1458
|
+
function editDistance(a, b) {
|
|
1459
|
+
if (Math.abs(a.length - b.length) > maxDistance)
|
|
1460
|
+
return Math.max(a.length, b.length);
|
|
1461
|
+
const d = [];
|
|
1462
|
+
for (let i = 0;i <= a.length; i++) {
|
|
1463
|
+
d[i] = [i];
|
|
1464
|
+
}
|
|
1465
|
+
for (let j = 0;j <= b.length; j++) {
|
|
1466
|
+
d[0][j] = j;
|
|
1467
|
+
}
|
|
1468
|
+
for (let j = 1;j <= b.length; j++) {
|
|
1469
|
+
for (let i = 1;i <= a.length; i++) {
|
|
1470
|
+
let cost = 1;
|
|
1471
|
+
if (a[i - 1] === b[j - 1]) {
|
|
1472
|
+
cost = 0;
|
|
1473
|
+
} else {
|
|
1474
|
+
cost = 1;
|
|
1475
|
+
}
|
|
1476
|
+
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
|
1477
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
1478
|
+
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return d[a.length][b.length];
|
|
1483
|
+
}
|
|
1484
|
+
function suggestSimilar(word, candidates) {
|
|
1485
|
+
if (!candidates || candidates.length === 0)
|
|
1486
|
+
return "";
|
|
1487
|
+
candidates = Array.from(new Set(candidates));
|
|
1488
|
+
const searchingOptions = word.startsWith("--");
|
|
1489
|
+
if (searchingOptions) {
|
|
1490
|
+
word = word.slice(2);
|
|
1491
|
+
candidates = candidates.map((candidate) => candidate.slice(2));
|
|
1492
|
+
}
|
|
1493
|
+
let similar = [];
|
|
1494
|
+
let bestDistance = maxDistance;
|
|
1495
|
+
const minSimilarity = 0.4;
|
|
1496
|
+
candidates.forEach((candidate) => {
|
|
1497
|
+
if (candidate.length <= 1)
|
|
1498
|
+
return;
|
|
1499
|
+
const distance = editDistance(word, candidate);
|
|
1500
|
+
const length = Math.max(word.length, candidate.length);
|
|
1501
|
+
const similarity = (length - distance) / length;
|
|
1502
|
+
if (similarity > minSimilarity) {
|
|
1503
|
+
if (distance < bestDistance) {
|
|
1504
|
+
bestDistance = distance;
|
|
1505
|
+
similar = [candidate];
|
|
1506
|
+
} else if (distance === bestDistance) {
|
|
1507
|
+
similar.push(candidate);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
similar.sort((a, b) => a.localeCompare(b));
|
|
1512
|
+
if (searchingOptions) {
|
|
1513
|
+
similar = similar.map((candidate) => `--${candidate}`);
|
|
1514
|
+
}
|
|
1515
|
+
if (similar.length > 1) {
|
|
1516
|
+
return `
|
|
1517
|
+
(Did you mean one of ${similar.join(", ")}?)`;
|
|
1518
|
+
}
|
|
1519
|
+
if (similar.length === 1) {
|
|
1520
|
+
return `
|
|
1521
|
+
(Did you mean ${similar[0]}?)`;
|
|
1522
|
+
}
|
|
1523
|
+
return "";
|
|
1524
|
+
}
|
|
1525
|
+
exports.suggestSimilar = suggestSimilar;
|
|
1526
|
+
});
|
|
1527
|
+
|
|
1528
|
+
// ../../node_modules/commander/lib/command.js
|
|
1529
|
+
var require_command = __commonJS((exports) => {
|
|
1530
|
+
var EventEmitter = __require("node:events").EventEmitter;
|
|
1531
|
+
var childProcess4 = __require("node:child_process");
|
|
1532
|
+
var path3 = __require("node:path");
|
|
1533
|
+
var fs7 = __require("node:fs");
|
|
1534
|
+
var process9 = __require("node:process");
|
|
1535
|
+
var { Argument, humanReadableArgName } = require_argument();
|
|
1536
|
+
var { CommanderError } = require_error();
|
|
1537
|
+
var { Help, stripColor } = require_help();
|
|
1538
|
+
var { Option, DualOptions } = require_option();
|
|
1539
|
+
var { suggestSimilar } = require_suggestSimilar();
|
|
1540
|
+
|
|
767
1541
|
class Command extends EventEmitter {
|
|
768
1542
|
constructor(name) {
|
|
769
1543
|
super();
|
|
@@ -800,13 +1574,13 @@ var require_command = __commonJS((exports) => {
|
|
|
800
1574
|
this._showSuggestionAfterError = true;
|
|
801
1575
|
this._savedState = null;
|
|
802
1576
|
this._outputConfiguration = {
|
|
803
|
-
writeOut: (str) =>
|
|
804
|
-
writeErr: (str) =>
|
|
1577
|
+
writeOut: (str) => process9.stdout.write(str),
|
|
1578
|
+
writeErr: (str) => process9.stderr.write(str),
|
|
805
1579
|
outputError: (str, write) => write(str),
|
|
806
|
-
getOutHelpWidth: () =>
|
|
807
|
-
getErrHelpWidth: () =>
|
|
808
|
-
getOutHasColors: () => useColor() ?? (
|
|
809
|
-
getErrHasColors: () => useColor() ?? (
|
|
1580
|
+
getOutHelpWidth: () => process9.stdout.isTTY ? process9.stdout.columns : undefined,
|
|
1581
|
+
getErrHelpWidth: () => process9.stderr.isTTY ? process9.stderr.columns : undefined,
|
|
1582
|
+
getOutHasColors: () => useColor() ?? (process9.stdout.isTTY && process9.stdout.hasColors?.()),
|
|
1583
|
+
getErrHasColors: () => useColor() ?? (process9.stderr.isTTY && process9.stderr.hasColors?.()),
|
|
810
1584
|
stripColor: (str) => stripColor(str)
|
|
811
1585
|
};
|
|
812
1586
|
this._hidden = false;
|
|
@@ -1014,7 +1788,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1014
1788
|
if (this._exitCallback) {
|
|
1015
1789
|
this._exitCallback(new CommanderError(exitCode, code, message));
|
|
1016
1790
|
}
|
|
1017
|
-
|
|
1791
|
+
process9.exit(exitCode);
|
|
1018
1792
|
}
|
|
1019
1793
|
action(fn) {
|
|
1020
1794
|
const listener = (args) => {
|
|
@@ -1211,16 +1985,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1211
1985
|
}
|
|
1212
1986
|
parseOptions = parseOptions || {};
|
|
1213
1987
|
if (argv === undefined && parseOptions.from === undefined) {
|
|
1214
|
-
if (
|
|
1988
|
+
if (process9.versions?.electron) {
|
|
1215
1989
|
parseOptions.from = "electron";
|
|
1216
1990
|
}
|
|
1217
|
-
const execArgv =
|
|
1991
|
+
const execArgv = process9.execArgv ?? [];
|
|
1218
1992
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
|
|
1219
1993
|
parseOptions.from = "eval";
|
|
1220
1994
|
}
|
|
1221
1995
|
}
|
|
1222
1996
|
if (argv === undefined) {
|
|
1223
|
-
argv =
|
|
1997
|
+
argv = process9.argv;
|
|
1224
1998
|
}
|
|
1225
1999
|
this.rawArgs = argv.slice();
|
|
1226
2000
|
let userArgs;
|
|
@@ -1231,7 +2005,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1231
2005
|
userArgs = argv.slice(2);
|
|
1232
2006
|
break;
|
|
1233
2007
|
case "electron":
|
|
1234
|
-
if (
|
|
2008
|
+
if (process9.defaultApp) {
|
|
1235
2009
|
this._scriptPath = argv[1];
|
|
1236
2010
|
userArgs = argv.slice(2);
|
|
1237
2011
|
} else {
|
|
@@ -1291,7 +2065,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1291
2065
|
this.processedArgs = [];
|
|
1292
2066
|
}
|
|
1293
2067
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
1294
|
-
if (
|
|
2068
|
+
if (fs7.existsSync(executableFile))
|
|
1295
2069
|
return;
|
|
1296
2070
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
1297
2071
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -1305,12 +2079,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1305
2079
|
let launchWithNode = false;
|
|
1306
2080
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1307
2081
|
function findFile(baseDir, baseName) {
|
|
1308
|
-
const localBin =
|
|
1309
|
-
if (
|
|
2082
|
+
const localBin = path3.resolve(baseDir, baseName);
|
|
2083
|
+
if (fs7.existsSync(localBin))
|
|
1310
2084
|
return localBin;
|
|
1311
|
-
if (sourceExt.includes(
|
|
2085
|
+
if (sourceExt.includes(path3.extname(baseName)))
|
|
1312
2086
|
return;
|
|
1313
|
-
const foundExt = sourceExt.find((ext) =>
|
|
2087
|
+
const foundExt = sourceExt.find((ext) => fs7.existsSync(`${localBin}${ext}`));
|
|
1314
2088
|
if (foundExt)
|
|
1315
2089
|
return `${localBin}${foundExt}`;
|
|
1316
2090
|
return;
|
|
@@ -1322,42 +2096,42 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1322
2096
|
if (this._scriptPath) {
|
|
1323
2097
|
let resolvedScriptPath;
|
|
1324
2098
|
try {
|
|
1325
|
-
resolvedScriptPath =
|
|
2099
|
+
resolvedScriptPath = fs7.realpathSync(this._scriptPath);
|
|
1326
2100
|
} catch {
|
|
1327
2101
|
resolvedScriptPath = this._scriptPath;
|
|
1328
2102
|
}
|
|
1329
|
-
executableDir =
|
|
2103
|
+
executableDir = path3.resolve(path3.dirname(resolvedScriptPath), executableDir);
|
|
1330
2104
|
}
|
|
1331
2105
|
if (executableDir) {
|
|
1332
2106
|
let localFile = findFile(executableDir, executableFile);
|
|
1333
2107
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1334
|
-
const legacyName =
|
|
2108
|
+
const legacyName = path3.basename(this._scriptPath, path3.extname(this._scriptPath));
|
|
1335
2109
|
if (legacyName !== this._name) {
|
|
1336
2110
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1337
2111
|
}
|
|
1338
2112
|
}
|
|
1339
2113
|
executableFile = localFile || executableFile;
|
|
1340
2114
|
}
|
|
1341
|
-
launchWithNode = sourceExt.includes(
|
|
2115
|
+
launchWithNode = sourceExt.includes(path3.extname(executableFile));
|
|
1342
2116
|
let proc;
|
|
1343
|
-
if (
|
|
2117
|
+
if (process9.platform !== "win32") {
|
|
1344
2118
|
if (launchWithNode) {
|
|
1345
2119
|
args.unshift(executableFile);
|
|
1346
|
-
args = incrementNodeInspectorPort(
|
|
1347
|
-
proc =
|
|
2120
|
+
args = incrementNodeInspectorPort(process9.execArgv).concat(args);
|
|
2121
|
+
proc = childProcess4.spawn(process9.argv[0], args, { stdio: "inherit" });
|
|
1348
2122
|
} else {
|
|
1349
|
-
proc =
|
|
2123
|
+
proc = childProcess4.spawn(executableFile, args, { stdio: "inherit" });
|
|
1350
2124
|
}
|
|
1351
2125
|
} else {
|
|
1352
2126
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
1353
2127
|
args.unshift(executableFile);
|
|
1354
|
-
args = incrementNodeInspectorPort(
|
|
1355
|
-
proc =
|
|
2128
|
+
args = incrementNodeInspectorPort(process9.execArgv).concat(args);
|
|
2129
|
+
proc = childProcess4.spawn(process9.execPath, args, { stdio: "inherit" });
|
|
1356
2130
|
}
|
|
1357
2131
|
if (!proc.killed) {
|
|
1358
2132
|
const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
1359
2133
|
signals.forEach((signal) => {
|
|
1360
|
-
|
|
2134
|
+
process9.on(signal, () => {
|
|
1361
2135
|
if (proc.killed === false && proc.exitCode === null) {
|
|
1362
2136
|
proc.kill(signal);
|
|
1363
2137
|
}
|
|
@@ -1368,7 +2142,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1368
2142
|
proc.on("close", (code) => {
|
|
1369
2143
|
code = code ?? 1;
|
|
1370
2144
|
if (!exitCallback) {
|
|
1371
|
-
|
|
2145
|
+
process9.exit(code);
|
|
1372
2146
|
} else {
|
|
1373
2147
|
exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
|
|
1374
2148
|
}
|
|
@@ -1380,7 +2154,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1380
2154
|
throw new Error(`'${executableFile}' not executable`);
|
|
1381
2155
|
}
|
|
1382
2156
|
if (!exitCallback) {
|
|
1383
|
-
|
|
2157
|
+
process9.exit(1);
|
|
1384
2158
|
} else {
|
|
1385
2159
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
1386
2160
|
wrappedError.nestedError = err;
|
|
@@ -1729,11 +2503,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1729
2503
|
}
|
|
1730
2504
|
_parseOptionsEnv() {
|
|
1731
2505
|
this.options.forEach((option) => {
|
|
1732
|
-
if (option.envVar && option.envVar in
|
|
2506
|
+
if (option.envVar && option.envVar in process9.env) {
|
|
1733
2507
|
const optionKey = option.attributeName();
|
|
1734
2508
|
if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
|
|
1735
2509
|
if (option.required || option.optional) {
|
|
1736
|
-
this.emit(`optionEnv:${option.name()}`,
|
|
2510
|
+
this.emit(`optionEnv:${option.name()}`, process9.env[option.envVar]);
|
|
1737
2511
|
} else {
|
|
1738
2512
|
this.emit(`optionEnv:${option.name()}`);
|
|
1739
2513
|
}
|
|
@@ -1853,1053 +2627,277 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1853
2627
|
}
|
|
1854
2628
|
return this;
|
|
1855
2629
|
}
|
|
1856
|
-
summary(str) {
|
|
1857
|
-
if (str === undefined)
|
|
1858
|
-
return this._summary;
|
|
1859
|
-
this._summary = str;
|
|
1860
|
-
return this;
|
|
1861
|
-
}
|
|
1862
|
-
alias(alias) {
|
|
1863
|
-
if (alias === undefined)
|
|
1864
|
-
return this._aliases[0];
|
|
1865
|
-
let command = this;
|
|
1866
|
-
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
|
|
1867
|
-
command = this.commands[this.commands.length - 1];
|
|
1868
|
-
}
|
|
1869
|
-
if (alias === command._name)
|
|
1870
|
-
throw new Error("Command alias can't be the same as its name");
|
|
1871
|
-
const matchingCommand = this.parent?._findCommand(alias);
|
|
1872
|
-
if (matchingCommand) {
|
|
1873
|
-
const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
|
|
1874
|
-
throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
|
|
1875
|
-
}
|
|
1876
|
-
command._aliases.push(alias);
|
|
1877
|
-
return this;
|
|
1878
|
-
}
|
|
1879
|
-
aliases(aliases) {
|
|
1880
|
-
if (aliases === undefined)
|
|
1881
|
-
return this._aliases;
|
|
1882
|
-
aliases.forEach((alias) => this.alias(alias));
|
|
1883
|
-
return this;
|
|
1884
|
-
}
|
|
1885
|
-
usage(str) {
|
|
1886
|
-
if (str === undefined) {
|
|
1887
|
-
if (this._usage)
|
|
1888
|
-
return this._usage;
|
|
1889
|
-
const args = this.registeredArguments.map((arg) => {
|
|
1890
|
-
return humanReadableArgName(arg);
|
|
1891
|
-
});
|
|
1892
|
-
return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
|
|
1893
|
-
}
|
|
1894
|
-
this._usage = str;
|
|
1895
|
-
return this;
|
|
1896
|
-
}
|
|
1897
|
-
name(str) {
|
|
1898
|
-
if (str === undefined)
|
|
1899
|
-
return this._name;
|
|
1900
|
-
this._name = str;
|
|
1901
|
-
return this;
|
|
1902
|
-
}
|
|
1903
|
-
helpGroup(heading) {
|
|
1904
|
-
if (heading === undefined)
|
|
1905
|
-
return this._helpGroupHeading ?? "";
|
|
1906
|
-
this._helpGroupHeading = heading;
|
|
1907
|
-
return this;
|
|
1908
|
-
}
|
|
1909
|
-
commandsGroup(heading) {
|
|
1910
|
-
if (heading === undefined)
|
|
1911
|
-
return this._defaultCommandGroup ?? "";
|
|
1912
|
-
this._defaultCommandGroup = heading;
|
|
1913
|
-
return this;
|
|
1914
|
-
}
|
|
1915
|
-
optionsGroup(heading) {
|
|
1916
|
-
if (heading === undefined)
|
|
1917
|
-
return this._defaultOptionGroup ?? "";
|
|
1918
|
-
this._defaultOptionGroup = heading;
|
|
1919
|
-
return this;
|
|
1920
|
-
}
|
|
1921
|
-
_initOptionGroup(option) {
|
|
1922
|
-
if (this._defaultOptionGroup && !option.helpGroupHeading)
|
|
1923
|
-
option.helpGroup(this._defaultOptionGroup);
|
|
1924
|
-
}
|
|
1925
|
-
_initCommandGroup(cmd) {
|
|
1926
|
-
if (this._defaultCommandGroup && !cmd.helpGroup())
|
|
1927
|
-
cmd.helpGroup(this._defaultCommandGroup);
|
|
1928
|
-
}
|
|
1929
|
-
nameFromFilename(filename) {
|
|
1930
|
-
this._name = path.basename(filename, path.extname(filename));
|
|
1931
|
-
return this;
|
|
1932
|
-
}
|
|
1933
|
-
executableDir(path2) {
|
|
1934
|
-
if (path2 === undefined)
|
|
1935
|
-
return this._executableDir;
|
|
1936
|
-
this._executableDir = path2;
|
|
1937
|
-
return this;
|
|
1938
|
-
}
|
|
1939
|
-
helpInformation(contextOptions) {
|
|
1940
|
-
const helper = this.createHelp();
|
|
1941
|
-
const context = this._getOutputContext(contextOptions);
|
|
1942
|
-
helper.prepareContext({
|
|
1943
|
-
error: context.error,
|
|
1944
|
-
helpWidth: context.helpWidth,
|
|
1945
|
-
outputHasColors: context.hasColors
|
|
1946
|
-
});
|
|
1947
|
-
const text = helper.formatHelp(this, helper);
|
|
1948
|
-
if (context.hasColors)
|
|
1949
|
-
return text;
|
|
1950
|
-
return this._outputConfiguration.stripColor(text);
|
|
1951
|
-
}
|
|
1952
|
-
_getOutputContext(contextOptions) {
|
|
1953
|
-
contextOptions = contextOptions || {};
|
|
1954
|
-
const error = !!contextOptions.error;
|
|
1955
|
-
let baseWrite;
|
|
1956
|
-
let hasColors;
|
|
1957
|
-
let helpWidth;
|
|
1958
|
-
if (error) {
|
|
1959
|
-
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
1960
|
-
hasColors = this._outputConfiguration.getErrHasColors();
|
|
1961
|
-
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
1962
|
-
} else {
|
|
1963
|
-
baseWrite = (str) => this._outputConfiguration.writeOut(str);
|
|
1964
|
-
hasColors = this._outputConfiguration.getOutHasColors();
|
|
1965
|
-
helpWidth = this._outputConfiguration.getOutHelpWidth();
|
|
1966
|
-
}
|
|
1967
|
-
const write = (str) => {
|
|
1968
|
-
if (!hasColors)
|
|
1969
|
-
str = this._outputConfiguration.stripColor(str);
|
|
1970
|
-
return baseWrite(str);
|
|
1971
|
-
};
|
|
1972
|
-
return { error, write, hasColors, helpWidth };
|
|
1973
|
-
}
|
|
1974
|
-
outputHelp(contextOptions) {
|
|
1975
|
-
let deprecatedCallback;
|
|
1976
|
-
if (typeof contextOptions === "function") {
|
|
1977
|
-
deprecatedCallback = contextOptions;
|
|
1978
|
-
contextOptions = undefined;
|
|
1979
|
-
}
|
|
1980
|
-
const outputContext = this._getOutputContext(contextOptions);
|
|
1981
|
-
const eventContext = {
|
|
1982
|
-
error: outputContext.error,
|
|
1983
|
-
write: outputContext.write,
|
|
1984
|
-
command: this
|
|
1985
|
-
};
|
|
1986
|
-
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
|
|
1987
|
-
this.emit("beforeHelp", eventContext);
|
|
1988
|
-
let helpInformation = this.helpInformation({ error: outputContext.error });
|
|
1989
|
-
if (deprecatedCallback) {
|
|
1990
|
-
helpInformation = deprecatedCallback(helpInformation);
|
|
1991
|
-
if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
|
|
1992
|
-
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
outputContext.write(helpInformation);
|
|
1996
|
-
if (this._getHelpOption()?.long) {
|
|
1997
|
-
this.emit(this._getHelpOption().long);
|
|
1998
|
-
}
|
|
1999
|
-
this.emit("afterHelp", eventContext);
|
|
2000
|
-
this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
|
|
2001
|
-
}
|
|
2002
|
-
helpOption(flags, description) {
|
|
2003
|
-
if (typeof flags === "boolean") {
|
|
2004
|
-
if (flags) {
|
|
2005
|
-
if (this._helpOption === null)
|
|
2006
|
-
this._helpOption = undefined;
|
|
2007
|
-
if (this._defaultOptionGroup) {
|
|
2008
|
-
this._initOptionGroup(this._getHelpOption());
|
|
2009
|
-
}
|
|
2010
|
-
} else {
|
|
2011
|
-
this._helpOption = null;
|
|
2012
|
-
}
|
|
2013
|
-
return this;
|
|
2014
|
-
}
|
|
2015
|
-
this._helpOption = this.createOption(flags ?? "-h, --help", description ?? "display help for command");
|
|
2016
|
-
if (flags || description)
|
|
2017
|
-
this._initOptionGroup(this._helpOption);
|
|
2018
|
-
return this;
|
|
2019
|
-
}
|
|
2020
|
-
_getHelpOption() {
|
|
2021
|
-
if (this._helpOption === undefined) {
|
|
2022
|
-
this.helpOption(undefined, undefined);
|
|
2023
|
-
}
|
|
2024
|
-
return this._helpOption;
|
|
2025
|
-
}
|
|
2026
|
-
addHelpOption(option) {
|
|
2027
|
-
this._helpOption = option;
|
|
2028
|
-
this._initOptionGroup(option);
|
|
2029
|
-
return this;
|
|
2030
|
-
}
|
|
2031
|
-
help(contextOptions) {
|
|
2032
|
-
this.outputHelp(contextOptions);
|
|
2033
|
-
let exitCode = Number(process2.exitCode ?? 0);
|
|
2034
|
-
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2035
|
-
exitCode = 1;
|
|
2036
|
-
}
|
|
2037
|
-
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
2038
|
-
}
|
|
2039
|
-
addHelpText(position, text) {
|
|
2040
|
-
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
2041
|
-
if (!allowedValues.includes(position)) {
|
|
2042
|
-
throw new Error(`Unexpected value for position to addHelpText.
|
|
2043
|
-
Expecting one of '${allowedValues.join("', '")}'`);
|
|
2044
|
-
}
|
|
2045
|
-
const helpEvent = `${position}Help`;
|
|
2046
|
-
this.on(helpEvent, (context) => {
|
|
2047
|
-
let helpStr;
|
|
2048
|
-
if (typeof text === "function") {
|
|
2049
|
-
helpStr = text({ error: context.error, command: context.command });
|
|
2050
|
-
} else {
|
|
2051
|
-
helpStr = text;
|
|
2052
|
-
}
|
|
2053
|
-
if (helpStr) {
|
|
2054
|
-
context.write(`${helpStr}
|
|
2055
|
-
`);
|
|
2056
|
-
}
|
|
2057
|
-
});
|
|
2058
|
-
return this;
|
|
2059
|
-
}
|
|
2060
|
-
_outputHelpIfRequested(args) {
|
|
2061
|
-
const helpOption = this._getHelpOption();
|
|
2062
|
-
const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
|
|
2063
|
-
if (helpRequested) {
|
|
2064
|
-
this.outputHelp();
|
|
2065
|
-
this._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
function incrementNodeInspectorPort(args) {
|
|
2070
|
-
return args.map((arg) => {
|
|
2071
|
-
if (!arg.startsWith("--inspect")) {
|
|
2072
|
-
return arg;
|
|
2073
|
-
}
|
|
2074
|
-
let debugOption;
|
|
2075
|
-
let debugHost = "127.0.0.1";
|
|
2076
|
-
let debugPort = "9229";
|
|
2077
|
-
let match;
|
|
2078
|
-
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
2079
|
-
debugOption = match[1];
|
|
2080
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
2081
|
-
debugOption = match[1];
|
|
2082
|
-
if (/^\d+$/.test(match[3])) {
|
|
2083
|
-
debugPort = match[3];
|
|
2084
|
-
} else {
|
|
2085
|
-
debugHost = match[3];
|
|
2086
|
-
}
|
|
2087
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
2088
|
-
debugOption = match[1];
|
|
2089
|
-
debugHost = match[3];
|
|
2090
|
-
debugPort = match[4];
|
|
2091
|
-
}
|
|
2092
|
-
if (debugOption && debugPort !== "0") {
|
|
2093
|
-
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
|
2094
|
-
}
|
|
2095
|
-
return arg;
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
|
-
function useColor() {
|
|
2099
|
-
if (process2.env.NO_COLOR || process2.env.FORCE_COLOR === "0" || process2.env.FORCE_COLOR === "false")
|
|
2100
|
-
return false;
|
|
2101
|
-
if (process2.env.FORCE_COLOR || process2.env.CLICOLOR_FORCE !== undefined)
|
|
2102
|
-
return true;
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
exports.Command = Command;
|
|
2106
|
-
exports.useColor = useColor;
|
|
2107
|
-
});
|
|
2108
|
-
|
|
2109
|
-
// ../../node_modules/commander/index.js
|
|
2110
|
-
var require_commander = __commonJS((exports) => {
|
|
2111
|
-
var { Argument } = require_argument();
|
|
2112
|
-
var { Command } = require_command();
|
|
2113
|
-
var { CommanderError, InvalidArgumentError } = require_error();
|
|
2114
|
-
var { Help } = require_help();
|
|
2115
|
-
var { Option } = require_option();
|
|
2116
|
-
exports.program = new Command;
|
|
2117
|
-
exports.createCommand = (name) => new Command(name);
|
|
2118
|
-
exports.createOption = (flags, description) => new Option(flags, description);
|
|
2119
|
-
exports.createArgument = (name, description) => new Argument(name, description);
|
|
2120
|
-
exports.Command = Command;
|
|
2121
|
-
exports.Option = Option;
|
|
2122
|
-
exports.Argument = Argument;
|
|
2123
|
-
exports.Help = Help;
|
|
2124
|
-
exports.CommanderError = CommanderError;
|
|
2125
|
-
exports.InvalidArgumentError = InvalidArgumentError;
|
|
2126
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
2127
|
-
});
|
|
2128
|
-
|
|
2129
|
-
// ../../node_modules/is-inside-container/node_modules/is-docker/index.js
|
|
2130
|
-
import fs from "node:fs";
|
|
2131
|
-
function hasDockerEnv() {
|
|
2132
|
-
try {
|
|
2133
|
-
fs.statSync("/.dockerenv");
|
|
2134
|
-
return true;
|
|
2135
|
-
} catch {
|
|
2136
|
-
return false;
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
function hasDockerCGroup() {
|
|
2140
|
-
try {
|
|
2141
|
-
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
2142
|
-
} catch {
|
|
2143
|
-
return false;
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
function isDocker() {
|
|
2147
|
-
if (isDockerCached === undefined) {
|
|
2148
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
2149
|
-
}
|
|
2150
|
-
return isDockerCached;
|
|
2151
|
-
}
|
|
2152
|
-
var isDockerCached;
|
|
2153
|
-
var init_is_docker = () => {};
|
|
2154
|
-
|
|
2155
|
-
// ../../node_modules/is-inside-container/index.js
|
|
2156
|
-
import fs2 from "node:fs";
|
|
2157
|
-
function isInsideContainer() {
|
|
2158
|
-
if (cachedResult === undefined) {
|
|
2159
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
2160
|
-
}
|
|
2161
|
-
return cachedResult;
|
|
2162
|
-
}
|
|
2163
|
-
var cachedResult, hasContainerEnv = () => {
|
|
2164
|
-
try {
|
|
2165
|
-
fs2.statSync("/run/.containerenv");
|
|
2166
|
-
return true;
|
|
2167
|
-
} catch {
|
|
2168
|
-
return false;
|
|
2169
|
-
}
|
|
2170
|
-
};
|
|
2171
|
-
var init_is_inside_container = __esm(() => {
|
|
2172
|
-
init_is_docker();
|
|
2173
|
-
});
|
|
2174
|
-
|
|
2175
|
-
// ../../node_modules/wsl-utils/node_modules/is-wsl/index.js
|
|
2176
|
-
import process2 from "node:process";
|
|
2177
|
-
import os from "node:os";
|
|
2178
|
-
import fs3 from "node:fs";
|
|
2179
|
-
var isWsl = () => {
|
|
2180
|
-
if (process2.platform !== "linux") {
|
|
2181
|
-
return false;
|
|
2182
|
-
}
|
|
2183
|
-
if (os.release().toLowerCase().includes("microsoft")) {
|
|
2184
|
-
if (isInsideContainer()) {
|
|
2185
|
-
return false;
|
|
2186
|
-
}
|
|
2187
|
-
return true;
|
|
2188
|
-
}
|
|
2189
|
-
try {
|
|
2190
|
-
if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
2191
|
-
return !isInsideContainer();
|
|
2192
|
-
}
|
|
2193
|
-
} catch {}
|
|
2194
|
-
if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
|
|
2195
|
-
return !isInsideContainer();
|
|
2196
|
-
}
|
|
2197
|
-
return false;
|
|
2198
|
-
}, is_wsl_default;
|
|
2199
|
-
var init_is_wsl = __esm(() => {
|
|
2200
|
-
init_is_inside_container();
|
|
2201
|
-
is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
2202
|
-
});
|
|
2203
|
-
|
|
2204
|
-
// ../../node_modules/powershell-utils/index.js
|
|
2205
|
-
import process3 from "node:process";
|
|
2206
|
-
import { Buffer as Buffer2 } from "node:buffer";
|
|
2207
|
-
import { promisify } from "node:util";
|
|
2208
|
-
import childProcess from "node:child_process";
|
|
2209
|
-
var execFile, powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {}) => {
|
|
2210
|
-
const {
|
|
2211
|
-
powerShellPath: psPath,
|
|
2212
|
-
...execFileOptions
|
|
2213
|
-
} = options;
|
|
2214
|
-
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
2215
|
-
return execFile(psPath ?? powerShellPath(), [
|
|
2216
|
-
...executePowerShell.argumentsPrefix,
|
|
2217
|
-
encodedCommand
|
|
2218
|
-
], {
|
|
2219
|
-
encoding: "utf8",
|
|
2220
|
-
...execFileOptions
|
|
2221
|
-
});
|
|
2222
|
-
};
|
|
2223
|
-
var init_powershell_utils = __esm(() => {
|
|
2224
|
-
execFile = promisify(childProcess.execFile);
|
|
2225
|
-
executePowerShell.argumentsPrefix = [
|
|
2226
|
-
"-NoProfile",
|
|
2227
|
-
"-NonInteractive",
|
|
2228
|
-
"-ExecutionPolicy",
|
|
2229
|
-
"Bypass",
|
|
2230
|
-
"-EncodedCommand"
|
|
2231
|
-
];
|
|
2232
|
-
executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
|
|
2233
|
-
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
2234
|
-
});
|
|
2235
|
-
|
|
2236
|
-
// ../../node_modules/wsl-utils/utilities.js
|
|
2237
|
-
function parseMountPointFromConfig(content) {
|
|
2238
|
-
for (const line of content.split(`
|
|
2239
|
-
`)) {
|
|
2240
|
-
if (/^\s*#/.test(line)) {
|
|
2241
|
-
continue;
|
|
2242
|
-
}
|
|
2243
|
-
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
2244
|
-
if (!match) {
|
|
2245
|
-
continue;
|
|
2246
|
-
}
|
|
2247
|
-
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
|
-
// ../../node_modules/wsl-utils/index.js
|
|
2252
|
-
import { promisify as promisify2 } from "node:util";
|
|
2253
|
-
import childProcess2 from "node:child_process";
|
|
2254
|
-
import fs4, { constants as fsConstants } from "node:fs/promises";
|
|
2255
|
-
var execFile2, wslDrivesMountPoint, powerShellPathFromWsl = async () => {
|
|
2256
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
2257
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
2258
|
-
}, powerShellPath2, canAccessPowerShellPromise, canAccessPowerShell = async () => {
|
|
2259
|
-
canAccessPowerShellPromise ??= (async () => {
|
|
2260
|
-
try {
|
|
2261
|
-
const psPath = await powerShellPath2();
|
|
2262
|
-
await fs4.access(psPath, fsConstants.X_OK);
|
|
2263
|
-
return true;
|
|
2264
|
-
} catch {
|
|
2265
|
-
return false;
|
|
2266
|
-
}
|
|
2267
|
-
})();
|
|
2268
|
-
return canAccessPowerShellPromise;
|
|
2269
|
-
}, wslDefaultBrowser = async () => {
|
|
2270
|
-
const psPath = await powerShellPath2();
|
|
2271
|
-
const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
2272
|
-
const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
|
|
2273
|
-
return stdout.trim();
|
|
2274
|
-
}, convertWslPathToWindows = async (path) => {
|
|
2275
|
-
if (/^[a-z]+:\/\//i.test(path)) {
|
|
2276
|
-
return path;
|
|
2277
|
-
}
|
|
2278
|
-
try {
|
|
2279
|
-
const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
|
|
2280
|
-
return stdout.trim();
|
|
2281
|
-
} catch {
|
|
2282
|
-
return path;
|
|
2283
|
-
}
|
|
2284
|
-
};
|
|
2285
|
-
var init_wsl_utils = __esm(() => {
|
|
2286
|
-
init_is_wsl();
|
|
2287
|
-
init_powershell_utils();
|
|
2288
|
-
init_is_wsl();
|
|
2289
|
-
execFile2 = promisify2(childProcess2.execFile);
|
|
2290
|
-
wslDrivesMountPoint = (() => {
|
|
2291
|
-
const defaultMountPoint = "/mnt/";
|
|
2292
|
-
let mountPoint;
|
|
2293
|
-
return async function() {
|
|
2294
|
-
if (mountPoint) {
|
|
2295
|
-
return mountPoint;
|
|
2296
|
-
}
|
|
2297
|
-
const configFilePath = "/etc/wsl.conf";
|
|
2298
|
-
let isConfigFileExists = false;
|
|
2299
|
-
try {
|
|
2300
|
-
await fs4.access(configFilePath, fsConstants.F_OK);
|
|
2301
|
-
isConfigFileExists = true;
|
|
2302
|
-
} catch {}
|
|
2303
|
-
if (!isConfigFileExists) {
|
|
2304
|
-
return defaultMountPoint;
|
|
2305
|
-
}
|
|
2306
|
-
const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
|
|
2307
|
-
const parsedMountPoint = parseMountPointFromConfig(configContent);
|
|
2308
|
-
if (parsedMountPoint === undefined) {
|
|
2309
|
-
return defaultMountPoint;
|
|
2310
|
-
}
|
|
2311
|
-
mountPoint = parsedMountPoint;
|
|
2312
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
2313
|
-
return mountPoint;
|
|
2314
|
-
};
|
|
2315
|
-
})();
|
|
2316
|
-
powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
|
|
2317
|
-
});
|
|
2318
|
-
|
|
2319
|
-
// ../../node_modules/open/node_modules/define-lazy-prop/index.js
|
|
2320
|
-
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
2321
|
-
const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
2322
|
-
Object.defineProperty(object, propertyName, {
|
|
2323
|
-
configurable: true,
|
|
2324
|
-
enumerable: true,
|
|
2325
|
-
get() {
|
|
2326
|
-
const result = valueGetter();
|
|
2327
|
-
define2(result);
|
|
2328
|
-
return result;
|
|
2329
|
-
},
|
|
2330
|
-
set(value) {
|
|
2331
|
-
define2(value);
|
|
2332
|
-
}
|
|
2333
|
-
});
|
|
2334
|
-
return object;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
// ../../node_modules/default-browser-id/index.js
|
|
2338
|
-
import { promisify as promisify3 } from "node:util";
|
|
2339
|
-
import process4 from "node:process";
|
|
2340
|
-
import { execFile as execFile3 } from "node:child_process";
|
|
2341
|
-
async function defaultBrowserId() {
|
|
2342
|
-
if (process4.platform !== "darwin") {
|
|
2343
|
-
throw new Error("macOS only");
|
|
2344
|
-
}
|
|
2345
|
-
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
2346
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
2347
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
2348
|
-
if (browserId === "com.apple.safari") {
|
|
2349
|
-
return "com.apple.Safari";
|
|
2350
|
-
}
|
|
2351
|
-
return browserId;
|
|
2352
|
-
}
|
|
2353
|
-
var execFileAsync;
|
|
2354
|
-
var init_default_browser_id = __esm(() => {
|
|
2355
|
-
execFileAsync = promisify3(execFile3);
|
|
2356
|
-
});
|
|
2357
|
-
|
|
2358
|
-
// ../../node_modules/run-applescript/index.js
|
|
2359
|
-
import process5 from "node:process";
|
|
2360
|
-
import { promisify as promisify4 } from "node:util";
|
|
2361
|
-
import { execFile as execFile4, execFileSync } from "node:child_process";
|
|
2362
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
2363
|
-
if (process5.platform !== "darwin") {
|
|
2364
|
-
throw new Error("macOS only");
|
|
2365
|
-
}
|
|
2366
|
-
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
2367
|
-
const execOptions = {};
|
|
2368
|
-
if (signal) {
|
|
2369
|
-
execOptions.signal = signal;
|
|
2370
|
-
}
|
|
2371
|
-
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
2372
|
-
return stdout.trim();
|
|
2373
|
-
}
|
|
2374
|
-
var execFileAsync2;
|
|
2375
|
-
var init_run_applescript = __esm(() => {
|
|
2376
|
-
execFileAsync2 = promisify4(execFile4);
|
|
2377
|
-
});
|
|
2378
|
-
|
|
2379
|
-
// ../../node_modules/bundle-name/index.js
|
|
2380
|
-
async function bundleName(bundleId) {
|
|
2381
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
2382
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
2383
|
-
}
|
|
2384
|
-
var init_bundle_name = __esm(() => {
|
|
2385
|
-
init_run_applescript();
|
|
2386
|
-
});
|
|
2387
|
-
|
|
2388
|
-
// ../../node_modules/default-browser/windows.js
|
|
2389
|
-
import { promisify as promisify5 } from "node:util";
|
|
2390
|
-
import { execFile as execFile5 } from "node:child_process";
|
|
2391
|
-
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
2392
|
-
const { stdout } = await _execFileAsync("reg", [
|
|
2393
|
-
"QUERY",
|
|
2394
|
-
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
2395
|
-
"/v",
|
|
2396
|
-
"ProgId"
|
|
2397
|
-
]);
|
|
2398
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
2399
|
-
if (!match) {
|
|
2400
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
2401
|
-
}
|
|
2402
|
-
const { id } = match.groups;
|
|
2403
|
-
const dotIndex = id.lastIndexOf(".");
|
|
2404
|
-
const hyphenIndex = id.lastIndexOf("-");
|
|
2405
|
-
const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
|
|
2406
|
-
const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
|
|
2407
|
-
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
2408
|
-
}
|
|
2409
|
-
var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
|
|
2410
|
-
var init_windows = __esm(() => {
|
|
2411
|
-
execFileAsync3 = promisify5(execFile5);
|
|
2412
|
-
windowsBrowserProgIds = {
|
|
2413
|
-
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
2414
|
-
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
2415
|
-
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
2416
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
2417
|
-
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
2418
|
-
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
2419
|
-
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
2420
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
2421
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
2422
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
2423
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
2424
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
2425
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
2426
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
2427
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
2428
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
2429
|
-
};
|
|
2430
|
-
_windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
2431
|
-
UnknownBrowserError = class UnknownBrowserError extends Error {
|
|
2432
|
-
};
|
|
2433
|
-
});
|
|
2434
|
-
|
|
2435
|
-
// ../../node_modules/default-browser/index.js
|
|
2436
|
-
import { promisify as promisify6 } from "node:util";
|
|
2437
|
-
import process6 from "node:process";
|
|
2438
|
-
import { execFile as execFile6 } from "node:child_process";
|
|
2439
|
-
async function defaultBrowser2() {
|
|
2440
|
-
if (process6.platform === "darwin") {
|
|
2441
|
-
const id = await defaultBrowserId();
|
|
2442
|
-
const name = await bundleName(id);
|
|
2443
|
-
return { name, id };
|
|
2444
|
-
}
|
|
2445
|
-
if (process6.platform === "linux") {
|
|
2446
|
-
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
2447
|
-
const id = stdout.trim();
|
|
2448
|
-
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
2449
|
-
return { name, id };
|
|
2450
|
-
}
|
|
2451
|
-
if (process6.platform === "win32") {
|
|
2452
|
-
return defaultBrowser();
|
|
2453
|
-
}
|
|
2454
|
-
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
2455
|
-
}
|
|
2456
|
-
var execFileAsync4, titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
2457
|
-
var init_default_browser = __esm(() => {
|
|
2458
|
-
init_default_browser_id();
|
|
2459
|
-
init_bundle_name();
|
|
2460
|
-
init_windows();
|
|
2461
|
-
init_windows();
|
|
2462
|
-
execFileAsync4 = promisify6(execFile6);
|
|
2463
|
-
});
|
|
2464
|
-
|
|
2465
|
-
// ../../node_modules/is-in-ssh/index.js
|
|
2466
|
-
import process7 from "node:process";
|
|
2467
|
-
var isInSsh, is_in_ssh_default;
|
|
2468
|
-
var init_is_in_ssh = __esm(() => {
|
|
2469
|
-
isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
|
|
2470
|
-
is_in_ssh_default = isInSsh;
|
|
2471
|
-
});
|
|
2472
|
-
|
|
2473
|
-
// ../../node_modules/open/index.js
|
|
2474
|
-
import process8 from "node:process";
|
|
2475
|
-
import path from "node:path";
|
|
2476
|
-
import { fileURLToPath } from "node:url";
|
|
2477
|
-
import childProcess3 from "node:child_process";
|
|
2478
|
-
import fs5, { constants as fsConstants2 } from "node:fs/promises";
|
|
2479
|
-
function detectArchBinary(binary2) {
|
|
2480
|
-
if (typeof binary2 === "string" || Array.isArray(binary2)) {
|
|
2481
|
-
return binary2;
|
|
2482
|
-
}
|
|
2483
|
-
const { [arch]: archBinary } = binary2;
|
|
2484
|
-
if (!archBinary) {
|
|
2485
|
-
throw new Error(`${arch} is not supported`);
|
|
2486
|
-
}
|
|
2487
|
-
return archBinary;
|
|
2488
|
-
}
|
|
2489
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
2490
|
-
if (wsl && is_wsl_default) {
|
|
2491
|
-
return detectArchBinary(wsl);
|
|
2492
|
-
}
|
|
2493
|
-
if (!platformBinary) {
|
|
2494
|
-
throw new Error(`${platform} is not supported`);
|
|
2495
|
-
}
|
|
2496
|
-
return detectArchBinary(platformBinary);
|
|
2497
|
-
}
|
|
2498
|
-
var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform, arch, tryEachApp = async (apps, opener) => {
|
|
2499
|
-
if (apps.length === 0) {
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
const errors = [];
|
|
2503
|
-
for (const app of apps) {
|
|
2504
|
-
try {
|
|
2505
|
-
return await opener(app);
|
|
2506
|
-
} catch (error) {
|
|
2507
|
-
errors.push(error);
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
throw new AggregateError(errors, "Failed to open in all supported apps");
|
|
2511
|
-
}, baseOpen = async (options) => {
|
|
2512
|
-
options = {
|
|
2513
|
-
wait: false,
|
|
2514
|
-
background: false,
|
|
2515
|
-
newInstance: false,
|
|
2516
|
-
allowNonzeroExitCode: false,
|
|
2517
|
-
...options
|
|
2518
|
-
};
|
|
2519
|
-
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
2520
|
-
delete options[fallbackAttemptSymbol];
|
|
2521
|
-
if (Array.isArray(options.app)) {
|
|
2522
|
-
return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
2523
|
-
...options,
|
|
2524
|
-
app: singleApp,
|
|
2525
|
-
[fallbackAttemptSymbol]: true
|
|
2526
|
-
}));
|
|
2527
|
-
}
|
|
2528
|
-
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
2529
|
-
appArguments = [...appArguments];
|
|
2530
|
-
if (Array.isArray(app)) {
|
|
2531
|
-
return tryEachApp(app, (appName) => baseOpen({
|
|
2532
|
-
...options,
|
|
2533
|
-
app: {
|
|
2534
|
-
name: appName,
|
|
2535
|
-
arguments: appArguments
|
|
2536
|
-
},
|
|
2537
|
-
[fallbackAttemptSymbol]: true
|
|
2538
|
-
}));
|
|
2539
|
-
}
|
|
2540
|
-
if (app === "browser" || app === "browserPrivate") {
|
|
2541
|
-
const ids = {
|
|
2542
|
-
"com.google.chrome": "chrome",
|
|
2543
|
-
"google-chrome.desktop": "chrome",
|
|
2544
|
-
"com.brave.browser": "brave",
|
|
2545
|
-
"org.mozilla.firefox": "firefox",
|
|
2546
|
-
"firefox.desktop": "firefox",
|
|
2547
|
-
"com.microsoft.msedge": "edge",
|
|
2548
|
-
"com.microsoft.edge": "edge",
|
|
2549
|
-
"com.microsoft.edgemac": "edge",
|
|
2550
|
-
"microsoft-edge.desktop": "edge",
|
|
2551
|
-
"com.apple.safari": "safari"
|
|
2552
|
-
};
|
|
2553
|
-
const flags = {
|
|
2554
|
-
chrome: "--incognito",
|
|
2555
|
-
brave: "--incognito",
|
|
2556
|
-
firefox: "--private-window",
|
|
2557
|
-
edge: "--inPrivate"
|
|
2558
|
-
};
|
|
2559
|
-
let browser;
|
|
2560
|
-
if (is_wsl_default) {
|
|
2561
|
-
const progId = await wslDefaultBrowser();
|
|
2562
|
-
const browserInfo = _windowsBrowserProgIdMap.get(progId);
|
|
2563
|
-
browser = browserInfo ?? {};
|
|
2564
|
-
} else {
|
|
2565
|
-
browser = await defaultBrowser2();
|
|
2566
|
-
}
|
|
2567
|
-
if (browser.id in ids) {
|
|
2568
|
-
const browserName = ids[browser.id.toLowerCase()];
|
|
2569
|
-
if (app === "browserPrivate") {
|
|
2570
|
-
if (browserName === "safari") {
|
|
2571
|
-
throw new Error("Safari doesn't support opening in private mode via command line");
|
|
2572
|
-
}
|
|
2573
|
-
appArguments.push(flags[browserName]);
|
|
2574
|
-
}
|
|
2575
|
-
return baseOpen({
|
|
2576
|
-
...options,
|
|
2577
|
-
app: {
|
|
2578
|
-
name: apps[browserName],
|
|
2579
|
-
arguments: appArguments
|
|
2580
|
-
}
|
|
2581
|
-
});
|
|
2582
|
-
}
|
|
2583
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
2584
|
-
}
|
|
2585
|
-
let command;
|
|
2586
|
-
const cliArguments = [];
|
|
2587
|
-
const childProcessOptions = {};
|
|
2588
|
-
let shouldUseWindowsInWsl = false;
|
|
2589
|
-
if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
|
|
2590
|
-
shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
2591
|
-
}
|
|
2592
|
-
if (platform === "darwin") {
|
|
2593
|
-
command = "open";
|
|
2594
|
-
if (options.wait) {
|
|
2595
|
-
cliArguments.push("--wait-apps");
|
|
2596
|
-
}
|
|
2597
|
-
if (options.background) {
|
|
2598
|
-
cliArguments.push("--background");
|
|
2630
|
+
summary(str) {
|
|
2631
|
+
if (str === undefined)
|
|
2632
|
+
return this._summary;
|
|
2633
|
+
this._summary = str;
|
|
2634
|
+
return this;
|
|
2599
2635
|
}
|
|
2600
|
-
|
|
2601
|
-
|
|
2636
|
+
alias(alias) {
|
|
2637
|
+
if (alias === undefined)
|
|
2638
|
+
return this._aliases[0];
|
|
2639
|
+
let command = this;
|
|
2640
|
+
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
|
|
2641
|
+
command = this.commands[this.commands.length - 1];
|
|
2642
|
+
}
|
|
2643
|
+
if (alias === command._name)
|
|
2644
|
+
throw new Error("Command alias can't be the same as its name");
|
|
2645
|
+
const matchingCommand = this.parent?._findCommand(alias);
|
|
2646
|
+
if (matchingCommand) {
|
|
2647
|
+
const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
|
|
2648
|
+
throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
|
|
2649
|
+
}
|
|
2650
|
+
command._aliases.push(alias);
|
|
2651
|
+
return this;
|
|
2602
2652
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2653
|
+
aliases(aliases) {
|
|
2654
|
+
if (aliases === undefined)
|
|
2655
|
+
return this._aliases;
|
|
2656
|
+
aliases.forEach((alias) => this.alias(alias));
|
|
2657
|
+
return this;
|
|
2605
2658
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2659
|
+
usage(str) {
|
|
2660
|
+
if (str === undefined) {
|
|
2661
|
+
if (this._usage)
|
|
2662
|
+
return this._usage;
|
|
2663
|
+
const args = this.registeredArguments.map((arg) => {
|
|
2664
|
+
return humanReadableArgName(arg);
|
|
2665
|
+
});
|
|
2666
|
+
return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
|
|
2667
|
+
}
|
|
2668
|
+
this._usage = str;
|
|
2669
|
+
return this;
|
|
2611
2670
|
}
|
|
2612
|
-
|
|
2613
|
-
|
|
2671
|
+
name(str) {
|
|
2672
|
+
if (str === undefined)
|
|
2673
|
+
return this._name;
|
|
2674
|
+
this._name = str;
|
|
2675
|
+
return this;
|
|
2614
2676
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2677
|
+
helpGroup(heading) {
|
|
2678
|
+
if (heading === undefined)
|
|
2679
|
+
return this._helpGroupHeading ?? "";
|
|
2680
|
+
this._helpGroupHeading = heading;
|
|
2681
|
+
return this;
|
|
2618
2682
|
}
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
} else if (options.target) {
|
|
2625
|
-
encodedArguments.push(executePowerShell.escapeArgument(options.target));
|
|
2683
|
+
commandsGroup(heading) {
|
|
2684
|
+
if (heading === undefined)
|
|
2685
|
+
return this._defaultCommandGroup ?? "";
|
|
2686
|
+
this._defaultCommandGroup = heading;
|
|
2687
|
+
return this;
|
|
2626
2688
|
}
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2689
|
+
optionsGroup(heading) {
|
|
2690
|
+
if (heading === undefined)
|
|
2691
|
+
return this._defaultOptionGroup ?? "";
|
|
2692
|
+
this._defaultOptionGroup = heading;
|
|
2693
|
+
return this;
|
|
2630
2694
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2695
|
+
_initOptionGroup(option) {
|
|
2696
|
+
if (this._defaultOptionGroup && !option.helpGroupHeading)
|
|
2697
|
+
option.helpGroup(this._defaultOptionGroup);
|
|
2634
2698
|
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
} else {
|
|
2639
|
-
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
2640
|
-
let exeLocalXdgOpen = false;
|
|
2641
|
-
try {
|
|
2642
|
-
await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
|
|
2643
|
-
exeLocalXdgOpen = true;
|
|
2644
|
-
} catch {}
|
|
2645
|
-
const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
2646
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
2699
|
+
_initCommandGroup(cmd) {
|
|
2700
|
+
if (this._defaultCommandGroup && !cmd.helpGroup())
|
|
2701
|
+
cmd.helpGroup(this._defaultCommandGroup);
|
|
2647
2702
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2703
|
+
nameFromFilename(filename) {
|
|
2704
|
+
this._name = path3.basename(filename, path3.extname(filename));
|
|
2705
|
+
return this;
|
|
2650
2706
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2707
|
+
executableDir(path4) {
|
|
2708
|
+
if (path4 === undefined)
|
|
2709
|
+
return this._executableDir;
|
|
2710
|
+
this._executableDir = path4;
|
|
2711
|
+
return this;
|
|
2654
2712
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
|
|
2663
|
-
if (options.wait) {
|
|
2664
|
-
return new Promise((resolve, reject) => {
|
|
2665
|
-
subprocess.once("error", reject);
|
|
2666
|
-
subprocess.once("close", (exitCode) => {
|
|
2667
|
-
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
2668
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
2669
|
-
return;
|
|
2670
|
-
}
|
|
2671
|
-
resolve(subprocess);
|
|
2672
|
-
});
|
|
2673
|
-
});
|
|
2674
|
-
}
|
|
2675
|
-
if (isFallbackAttempt) {
|
|
2676
|
-
return new Promise((resolve, reject) => {
|
|
2677
|
-
subprocess.once("error", reject);
|
|
2678
|
-
subprocess.once("spawn", () => {
|
|
2679
|
-
subprocess.once("close", (exitCode) => {
|
|
2680
|
-
subprocess.off("error", reject);
|
|
2681
|
-
if (exitCode !== 0) {
|
|
2682
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
2683
|
-
return;
|
|
2684
|
-
}
|
|
2685
|
-
subprocess.unref();
|
|
2686
|
-
resolve(subprocess);
|
|
2687
|
-
});
|
|
2713
|
+
helpInformation(contextOptions) {
|
|
2714
|
+
const helper = this.createHelp();
|
|
2715
|
+
const context = this._getOutputContext(contextOptions);
|
|
2716
|
+
helper.prepareContext({
|
|
2717
|
+
error: context.error,
|
|
2718
|
+
helpWidth: context.helpWidth,
|
|
2719
|
+
outputHasColors: context.hasColors
|
|
2688
2720
|
});
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
subprocess.once("error", reject);
|
|
2694
|
-
subprocess.once("spawn", () => {
|
|
2695
|
-
subprocess.off("error", reject);
|
|
2696
|
-
resolve(subprocess);
|
|
2697
|
-
});
|
|
2698
|
-
});
|
|
2699
|
-
}, open = (target, options) => {
|
|
2700
|
-
if (typeof target !== "string") {
|
|
2701
|
-
throw new TypeError("Expected a `target`");
|
|
2702
|
-
}
|
|
2703
|
-
return baseOpen({
|
|
2704
|
-
...options,
|
|
2705
|
-
target
|
|
2706
|
-
});
|
|
2707
|
-
}, apps, open_default;
|
|
2708
|
-
var init_open = __esm(() => {
|
|
2709
|
-
init_wsl_utils();
|
|
2710
|
-
init_powershell_utils();
|
|
2711
|
-
init_default_browser();
|
|
2712
|
-
init_is_inside_container();
|
|
2713
|
-
init_is_in_ssh();
|
|
2714
|
-
fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
2715
|
-
__dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
2716
|
-
localXdgOpenPath = path.join(__dirname2, "xdg-open");
|
|
2717
|
-
({ platform, arch } = process8);
|
|
2718
|
-
apps = {
|
|
2719
|
-
browser: "browser",
|
|
2720
|
-
browserPrivate: "browserPrivate"
|
|
2721
|
-
};
|
|
2722
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
2723
|
-
darwin: "google chrome",
|
|
2724
|
-
win32: "chrome",
|
|
2725
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
|
|
2726
|
-
}, {
|
|
2727
|
-
wsl: {
|
|
2728
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
2729
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
2721
|
+
const text = helper.formatHelp(this, helper);
|
|
2722
|
+
if (context.hasColors)
|
|
2723
|
+
return text;
|
|
2724
|
+
return this._outputConfiguration.stripColor(text);
|
|
2730
2725
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2726
|
+
_getOutputContext(contextOptions) {
|
|
2727
|
+
contextOptions = contextOptions || {};
|
|
2728
|
+
const error = !!contextOptions.error;
|
|
2729
|
+
let baseWrite;
|
|
2730
|
+
let hasColors;
|
|
2731
|
+
let helpWidth;
|
|
2732
|
+
if (error) {
|
|
2733
|
+
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
2734
|
+
hasColors = this._outputConfiguration.getErrHasColors();
|
|
2735
|
+
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
2736
|
+
} else {
|
|
2737
|
+
baseWrite = (str) => this._outputConfiguration.writeOut(str);
|
|
2738
|
+
hasColors = this._outputConfiguration.getOutHasColors();
|
|
2739
|
+
helpWidth = this._outputConfiguration.getOutHelpWidth();
|
|
2740
|
+
}
|
|
2741
|
+
const write = (str) => {
|
|
2742
|
+
if (!hasColors)
|
|
2743
|
+
str = this._outputConfiguration.stripColor(str);
|
|
2744
|
+
return baseWrite(str);
|
|
2745
|
+
};
|
|
2746
|
+
return { error, write, hasColors, helpWidth };
|
|
2740
2747
|
}
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
class NodeFileSystem {
|
|
2769
|
-
path = {
|
|
2770
|
-
join: path2.join,
|
|
2771
|
-
resolve: path2.resolve,
|
|
2772
|
-
relative: path2.relative,
|
|
2773
|
-
dirname: path2.dirname,
|
|
2774
|
-
isAbsolute: path2.isAbsolute,
|
|
2775
|
-
basename: path2.basename
|
|
2776
|
-
};
|
|
2777
|
-
env = {
|
|
2778
|
-
cwd: process.cwd,
|
|
2779
|
-
homedir: os2.homedir,
|
|
2780
|
-
tmpdir: os2.tmpdir,
|
|
2781
|
-
getenv: (key) => process.env[key]
|
|
2782
|
-
};
|
|
2783
|
-
utils = {
|
|
2784
|
-
open: async (url) => {
|
|
2785
|
-
await open_default(url);
|
|
2748
|
+
outputHelp(contextOptions) {
|
|
2749
|
+
let deprecatedCallback;
|
|
2750
|
+
if (typeof contextOptions === "function") {
|
|
2751
|
+
deprecatedCallback = contextOptions;
|
|
2752
|
+
contextOptions = undefined;
|
|
2753
|
+
}
|
|
2754
|
+
const outputContext = this._getOutputContext(contextOptions);
|
|
2755
|
+
const eventContext = {
|
|
2756
|
+
error: outputContext.error,
|
|
2757
|
+
write: outputContext.write,
|
|
2758
|
+
command: this
|
|
2759
|
+
};
|
|
2760
|
+
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
|
|
2761
|
+
this.emit("beforeHelp", eventContext);
|
|
2762
|
+
let helpInformation = this.helpInformation({ error: outputContext.error });
|
|
2763
|
+
if (deprecatedCallback) {
|
|
2764
|
+
helpInformation = deprecatedCallback(helpInformation);
|
|
2765
|
+
if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
|
|
2766
|
+
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
outputContext.write(helpInformation);
|
|
2770
|
+
if (this._getHelpOption()?.long) {
|
|
2771
|
+
this.emit(this._getHelpOption().long);
|
|
2772
|
+
}
|
|
2773
|
+
this.emit("afterHelp", eventContext);
|
|
2774
|
+
this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
|
|
2786
2775
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2776
|
+
helpOption(flags, description) {
|
|
2777
|
+
if (typeof flags === "boolean") {
|
|
2778
|
+
if (flags) {
|
|
2779
|
+
if (this._helpOption === null)
|
|
2780
|
+
this._helpOption = undefined;
|
|
2781
|
+
if (this._defaultOptionGroup) {
|
|
2782
|
+
this._initOptionGroup(this._getHelpOption());
|
|
2783
|
+
}
|
|
2784
|
+
} else {
|
|
2785
|
+
this._helpOption = null;
|
|
2786
|
+
}
|
|
2787
|
+
return this;
|
|
2792
2788
|
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
throw error;
|
|
2789
|
+
this._helpOption = this.createOption(flags ?? "-h, --help", description ?? "display help for command");
|
|
2790
|
+
if (flags || description)
|
|
2791
|
+
this._initOptionGroup(this._helpOption);
|
|
2792
|
+
return this;
|
|
2798
2793
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2794
|
+
_getHelpOption() {
|
|
2795
|
+
if (this._helpOption === undefined) {
|
|
2796
|
+
this.helpOption(undefined, undefined);
|
|
2797
|
+
}
|
|
2798
|
+
return this._helpOption;
|
|
2804
2799
|
}
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
if (dir) {
|
|
2810
|
-
await fs6.mkdir(dir, { recursive: true });
|
|
2800
|
+
addHelpOption(option) {
|
|
2801
|
+
this._helpOption = option;
|
|
2802
|
+
this._initOptionGroup(option);
|
|
2803
|
+
return this;
|
|
2811
2804
|
}
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
return [];
|
|
2820
|
-
throw error;
|
|
2805
|
+
help(contextOptions) {
|
|
2806
|
+
this.outputHelp(contextOptions);
|
|
2807
|
+
let exitCode = Number(process9.exitCode ?? 0);
|
|
2808
|
+
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2809
|
+
exitCode = 1;
|
|
2810
|
+
}
|
|
2811
|
+
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
2821
2812
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2813
|
+
addHelpText(position, text) {
|
|
2814
|
+
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
2815
|
+
if (!allowedValues.includes(position)) {
|
|
2816
|
+
throw new Error(`Unexpected value for position to addHelpText.
|
|
2817
|
+
Expecting one of '${allowedValues.join("', '")}'`);
|
|
2818
|
+
}
|
|
2819
|
+
const helpEvent = `${position}Help`;
|
|
2820
|
+
this.on(helpEvent, (context) => {
|
|
2821
|
+
let helpStr;
|
|
2822
|
+
if (typeof text === "function") {
|
|
2823
|
+
helpStr = text({ error: context.error, command: context.command });
|
|
2824
|
+
} else {
|
|
2825
|
+
helpStr = text;
|
|
2826
|
+
}
|
|
2827
|
+
if (helpStr) {
|
|
2828
|
+
context.write(`${helpStr}
|
|
2829
|
+
`);
|
|
2830
|
+
}
|
|
2831
|
+
});
|
|
2832
|
+
return this;
|
|
2836
2833
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
async rm(filePath) {
|
|
2845
|
-
await fs6.rm(filePath, { recursive: true, force: true });
|
|
2846
|
-
}
|
|
2847
|
-
async rename(oldPath, newPath) {
|
|
2848
|
-
await fs6.rename(oldPath, newPath);
|
|
2849
|
-
}
|
|
2850
|
-
async realpath(filePath) {
|
|
2851
|
-
try {
|
|
2852
|
-
return await fs6.realpath(filePath);
|
|
2853
|
-
} catch (error) {
|
|
2854
|
-
if (this.isEnoent(error))
|
|
2855
|
-
return filePath;
|
|
2856
|
-
throw error;
|
|
2834
|
+
_outputHelpIfRequested(args) {
|
|
2835
|
+
const helpOption = this._getHelpOption();
|
|
2836
|
+
const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
|
|
2837
|
+
if (helpRequested) {
|
|
2838
|
+
this.outputHelp();
|
|
2839
|
+
this._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
2840
|
+
}
|
|
2857
2841
|
}
|
|
2858
2842
|
}
|
|
2859
|
-
|
|
2860
|
-
return
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
if (!entryStats)
|
|
2877
|
-
continue;
|
|
2878
|
-
if (entryStats.isDirectory()) {
|
|
2879
|
-
await this.copyDirectory(srcEntry, destEntry);
|
|
2880
|
-
} else if (entryStats.isFile()) {
|
|
2881
|
-
const content = await this.readFile(srcEntry);
|
|
2882
|
-
if (content !== null) {
|
|
2883
|
-
await this.writeFile(destEntry, content);
|
|
2843
|
+
function incrementNodeInspectorPort(args) {
|
|
2844
|
+
return args.map((arg) => {
|
|
2845
|
+
if (!arg.startsWith("--inspect")) {
|
|
2846
|
+
return arg;
|
|
2847
|
+
}
|
|
2848
|
+
let debugOption;
|
|
2849
|
+
let debugHost = "127.0.0.1";
|
|
2850
|
+
let debugPort = "9229";
|
|
2851
|
+
let match;
|
|
2852
|
+
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
2853
|
+
debugOption = match[1];
|
|
2854
|
+
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
2855
|
+
debugOption = match[1];
|
|
2856
|
+
if (/^\d+$/.test(match[3])) {
|
|
2857
|
+
debugPort = match[3];
|
|
2858
|
+
} else {
|
|
2859
|
+
debugHost = match[3];
|
|
2884
2860
|
}
|
|
2861
|
+
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
2862
|
+
debugOption = match[1];
|
|
2863
|
+
debugHost = match[3];
|
|
2864
|
+
debugPort = match[4];
|
|
2885
2865
|
}
|
|
2886
|
-
|
|
2866
|
+
if (debugOption && debugPort !== "0") {
|
|
2867
|
+
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
|
2868
|
+
}
|
|
2869
|
+
return arg;
|
|
2870
|
+
});
|
|
2887
2871
|
}
|
|
2888
|
-
|
|
2889
|
-
|
|
2872
|
+
function useColor() {
|
|
2873
|
+
if (process9.env.NO_COLOR || process9.env.FORCE_COLOR === "0" || process9.env.FORCE_COLOR === "false")
|
|
2874
|
+
return false;
|
|
2875
|
+
if (process9.env.FORCE_COLOR || process9.env.CLICOLOR_FORCE !== undefined)
|
|
2876
|
+
return true;
|
|
2877
|
+
return;
|
|
2890
2878
|
}
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
init_open();
|
|
2879
|
+
exports.Command = Command;
|
|
2880
|
+
exports.useColor = useColor;
|
|
2894
2881
|
});
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
};
|
|
2899
|
-
var
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2882
|
+
|
|
2883
|
+
// ../../node_modules/commander/index.js
|
|
2884
|
+
var require_commander = __commonJS((exports) => {
|
|
2885
|
+
var { Argument } = require_argument();
|
|
2886
|
+
var { Command } = require_command();
|
|
2887
|
+
var { CommanderError, InvalidArgumentError } = require_error();
|
|
2888
|
+
var { Help } = require_help();
|
|
2889
|
+
var { Option } = require_option();
|
|
2890
|
+
exports.program = new Command;
|
|
2891
|
+
exports.createCommand = (name) => new Command(name);
|
|
2892
|
+
exports.createOption = (flags, description) => new Option(flags, description);
|
|
2893
|
+
exports.createArgument = (name, description) => new Argument(name, description);
|
|
2894
|
+
exports.Command = Command;
|
|
2895
|
+
exports.Option = Option;
|
|
2896
|
+
exports.Argument = Argument;
|
|
2897
|
+
exports.Help = Help;
|
|
2898
|
+
exports.CommanderError = CommanderError;
|
|
2899
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
2900
|
+
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
2903
2901
|
});
|
|
2904
2902
|
|
|
2905
2903
|
// ../auth/src/catch-error.ts
|
|
@@ -21138,7 +21136,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
21138
21136
|
// package.json
|
|
21139
21137
|
var package_default = {
|
|
21140
21138
|
name: "@uipath/integrationservice-tool",
|
|
21141
|
-
version: "1.0
|
|
21139
|
+
version: "1.1.0",
|
|
21142
21140
|
description: "Manage Integration Service connectors, connections, and triggers.",
|
|
21143
21141
|
private: false,
|
|
21144
21142
|
repository: {
|
|
@@ -21182,6 +21180,9 @@ var package_default = {
|
|
|
21182
21180
|
}
|
|
21183
21181
|
};
|
|
21184
21182
|
|
|
21183
|
+
// ../common/src/attachment-binding.ts
|
|
21184
|
+
init_src();
|
|
21185
|
+
|
|
21185
21186
|
// ../common/src/catch-error.ts
|
|
21186
21187
|
function isPromiseLike(value) {
|
|
21187
21188
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
@@ -21209,95 +21210,7 @@ function settlePromiseLike(thenable) {
|
|
|
21209
21210
|
undefined
|
|
21210
21211
|
]);
|
|
21211
21212
|
}
|
|
21212
|
-
// ../../node_modules/commander/esm.mjs
|
|
21213
|
-
var import__ = __toESM(require_commander(), 1);
|
|
21214
|
-
var {
|
|
21215
|
-
program,
|
|
21216
|
-
createCommand,
|
|
21217
|
-
createArgument,
|
|
21218
|
-
createOption,
|
|
21219
|
-
CommanderError,
|
|
21220
|
-
InvalidArgumentError,
|
|
21221
|
-
InvalidOptionArgumentError,
|
|
21222
|
-
Command,
|
|
21223
|
-
Argument,
|
|
21224
|
-
Option,
|
|
21225
|
-
Help
|
|
21226
|
-
} = import__.default;
|
|
21227
21213
|
|
|
21228
|
-
// ../common/src/command-examples.ts
|
|
21229
|
-
var examplesByCommand = new WeakMap;
|
|
21230
|
-
Command.prototype.examples = function(examples) {
|
|
21231
|
-
examplesByCommand.set(this, examples);
|
|
21232
|
-
return this;
|
|
21233
|
-
};
|
|
21234
|
-
// ../common/src/singleton.ts
|
|
21235
|
-
var PREFIX = "@uipath/common/";
|
|
21236
|
-
var _g = globalThis;
|
|
21237
|
-
function singleton(ctorOrName) {
|
|
21238
|
-
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
21239
|
-
const key = Symbol.for(PREFIX + name);
|
|
21240
|
-
return {
|
|
21241
|
-
get(fallback) {
|
|
21242
|
-
return _g[key] ?? fallback;
|
|
21243
|
-
},
|
|
21244
|
-
set(value) {
|
|
21245
|
-
_g[key] = value;
|
|
21246
|
-
},
|
|
21247
|
-
clear() {
|
|
21248
|
-
delete _g[key];
|
|
21249
|
-
},
|
|
21250
|
-
getOrInit(factory, guard) {
|
|
21251
|
-
const existing = _g[key];
|
|
21252
|
-
if (existing != null && typeof existing === "object") {
|
|
21253
|
-
if (!guard || guard(existing)) {
|
|
21254
|
-
return existing;
|
|
21255
|
-
}
|
|
21256
|
-
}
|
|
21257
|
-
const instance = factory();
|
|
21258
|
-
_g[key] = instance;
|
|
21259
|
-
return instance;
|
|
21260
|
-
}
|
|
21261
|
-
};
|
|
21262
|
-
}
|
|
21263
|
-
|
|
21264
|
-
// ../common/src/output-context.ts
|
|
21265
|
-
function createStorage() {
|
|
21266
|
-
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
21267
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
21268
|
-
return {
|
|
21269
|
-
getStore: () => {
|
|
21270
|
-
return;
|
|
21271
|
-
},
|
|
21272
|
-
run: (_store, fn) => fn()
|
|
21273
|
-
};
|
|
21274
|
-
}
|
|
21275
|
-
return new mod.AsyncLocalStorage;
|
|
21276
|
-
}
|
|
21277
|
-
var storageSingleton = singleton("OutputStorage");
|
|
21278
|
-
var sinkSlot = singleton("OutputSink");
|
|
21279
|
-
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
21280
|
-
var CONSOLE_FALLBACK = {
|
|
21281
|
-
writeOut: (str) => process.stdout.write(str),
|
|
21282
|
-
writeErr: (str) => process.stderr.write(str),
|
|
21283
|
-
writeLog: (str) => process.stdout.write(str),
|
|
21284
|
-
capabilities: {
|
|
21285
|
-
isInteractive: false,
|
|
21286
|
-
supportsColor: false,
|
|
21287
|
-
outputWidth: 80
|
|
21288
|
-
}
|
|
21289
|
-
};
|
|
21290
|
-
function getOutputSink() {
|
|
21291
|
-
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
21292
|
-
}
|
|
21293
|
-
// ../common/src/completer.ts
|
|
21294
|
-
var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
21295
|
-
// ../common/src/console-guard.ts
|
|
21296
|
-
var guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
21297
|
-
var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
21298
|
-
// ../common/src/constants.ts
|
|
21299
|
-
var UIPATH_HOME_DIR = ".uipath";
|
|
21300
|
-
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
21301
21214
|
// ../common/src/error-handler.ts
|
|
21302
21215
|
var DEFAULT_401 = "Unauthorized (401). Run `uip login` to authenticate.";
|
|
21303
21216
|
var DEFAULT_403 = "Forbidden (403). Ensure the account has the required permissions.";
|
|
@@ -21433,6 +21346,95 @@ async function extractErrorMessage(error, options) {
|
|
|
21433
21346
|
const { message } = await extractErrorDetails(error, options);
|
|
21434
21347
|
return message;
|
|
21435
21348
|
}
|
|
21349
|
+
// ../../node_modules/commander/esm.mjs
|
|
21350
|
+
var import__ = __toESM(require_commander(), 1);
|
|
21351
|
+
var {
|
|
21352
|
+
program,
|
|
21353
|
+
createCommand,
|
|
21354
|
+
createArgument,
|
|
21355
|
+
createOption,
|
|
21356
|
+
CommanderError,
|
|
21357
|
+
InvalidArgumentError,
|
|
21358
|
+
InvalidOptionArgumentError,
|
|
21359
|
+
Command,
|
|
21360
|
+
Argument,
|
|
21361
|
+
Option,
|
|
21362
|
+
Help
|
|
21363
|
+
} = import__.default;
|
|
21364
|
+
|
|
21365
|
+
// ../common/src/command-examples.ts
|
|
21366
|
+
var examplesByCommand = new WeakMap;
|
|
21367
|
+
Command.prototype.examples = function(examples) {
|
|
21368
|
+
examplesByCommand.set(this, examples);
|
|
21369
|
+
return this;
|
|
21370
|
+
};
|
|
21371
|
+
// ../common/src/singleton.ts
|
|
21372
|
+
var PREFIX = "@uipath/common/";
|
|
21373
|
+
var _g = globalThis;
|
|
21374
|
+
function singleton(ctorOrName) {
|
|
21375
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
21376
|
+
const key = Symbol.for(PREFIX + name);
|
|
21377
|
+
return {
|
|
21378
|
+
get(fallback) {
|
|
21379
|
+
return _g[key] ?? fallback;
|
|
21380
|
+
},
|
|
21381
|
+
set(value) {
|
|
21382
|
+
_g[key] = value;
|
|
21383
|
+
},
|
|
21384
|
+
clear() {
|
|
21385
|
+
delete _g[key];
|
|
21386
|
+
},
|
|
21387
|
+
getOrInit(factory, guard) {
|
|
21388
|
+
const existing = _g[key];
|
|
21389
|
+
if (existing != null && typeof existing === "object") {
|
|
21390
|
+
if (!guard || guard(existing)) {
|
|
21391
|
+
return existing;
|
|
21392
|
+
}
|
|
21393
|
+
}
|
|
21394
|
+
const instance = factory();
|
|
21395
|
+
_g[key] = instance;
|
|
21396
|
+
return instance;
|
|
21397
|
+
}
|
|
21398
|
+
};
|
|
21399
|
+
}
|
|
21400
|
+
|
|
21401
|
+
// ../common/src/output-context.ts
|
|
21402
|
+
function createStorage() {
|
|
21403
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
21404
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
21405
|
+
return {
|
|
21406
|
+
getStore: () => {
|
|
21407
|
+
return;
|
|
21408
|
+
},
|
|
21409
|
+
run: (_store, fn) => fn()
|
|
21410
|
+
};
|
|
21411
|
+
}
|
|
21412
|
+
return new mod.AsyncLocalStorage;
|
|
21413
|
+
}
|
|
21414
|
+
var storageSingleton = singleton("OutputStorage");
|
|
21415
|
+
var sinkSlot = singleton("OutputSink");
|
|
21416
|
+
var outputStorage = storageSingleton.getOrInit(createStorage, (v) => ("getStore" in v));
|
|
21417
|
+
var CONSOLE_FALLBACK = {
|
|
21418
|
+
writeOut: (str) => process.stdout.write(str),
|
|
21419
|
+
writeErr: (str) => process.stderr.write(str),
|
|
21420
|
+
writeLog: (str) => process.stdout.write(str),
|
|
21421
|
+
capabilities: {
|
|
21422
|
+
isInteractive: false,
|
|
21423
|
+
supportsColor: false,
|
|
21424
|
+
outputWidth: 80
|
|
21425
|
+
}
|
|
21426
|
+
};
|
|
21427
|
+
function getOutputSink() {
|
|
21428
|
+
return outputStorage.getStore() ?? sinkSlot.get() ?? CONSOLE_FALLBACK;
|
|
21429
|
+
}
|
|
21430
|
+
// ../common/src/completer.ts
|
|
21431
|
+
var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
21432
|
+
// ../common/src/console-guard.ts
|
|
21433
|
+
var guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
21434
|
+
var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
21435
|
+
// ../common/src/constants.ts
|
|
21436
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
21437
|
+
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
21436
21438
|
// ../../node_modules/@jmespath-community/jmespath/dist/index.mjs
|
|
21437
21439
|
var isObject = (obj) => {
|
|
21438
21440
|
return obj !== null && Object.prototype.toString.call(obj) === "[object Object]";
|
|
@@ -26477,15 +26479,26 @@ class SuccessOutput {
|
|
|
26477
26479
|
}
|
|
26478
26480
|
}
|
|
26479
26481
|
}
|
|
26480
|
-
function
|
|
26482
|
+
function escapeNonAscii(jsonText) {
|
|
26483
|
+
return jsonText.replace(/[\u0080-\uffff]/g, (c) => {
|
|
26484
|
+
const hex = c.charCodeAt(0).toString(16).padStart(4, "0");
|
|
26485
|
+
return `\\u${hex}`;
|
|
26486
|
+
});
|
|
26487
|
+
}
|
|
26488
|
+
function needsAsciiSafeJson(sink) {
|
|
26489
|
+
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
26490
|
+
}
|
|
26491
|
+
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
26481
26492
|
if (!data) {
|
|
26482
26493
|
logFn("Empty response object. No data to display.");
|
|
26483
26494
|
return;
|
|
26484
26495
|
}
|
|
26485
26496
|
switch (format) {
|
|
26486
|
-
case "json":
|
|
26487
|
-
|
|
26497
|
+
case "json": {
|
|
26498
|
+
const json2 = JSON.stringify(data, null, 2);
|
|
26499
|
+
logFn(asciiSafe ? escapeNonAscii(json2) : json2);
|
|
26488
26500
|
break;
|
|
26501
|
+
}
|
|
26489
26502
|
case "yaml":
|
|
26490
26503
|
logFn(toYaml(data));
|
|
26491
26504
|
break;
|
|
@@ -26520,7 +26533,7 @@ function printOutput(data, format = "json", logFn) {
|
|
|
26520
26533
|
function logOutput(data, format = "json") {
|
|
26521
26534
|
const sink = getOutputSink();
|
|
26522
26535
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
26523
|
-
`));
|
|
26536
|
+
`), needsAsciiSafeJson(sink));
|
|
26524
26537
|
}
|
|
26525
26538
|
function cellToString(val) {
|
|
26526
26539
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
@@ -26700,7 +26713,9 @@ var OutputFormatter;
|
|
|
26700
26713
|
const format = getOutputFormat();
|
|
26701
26714
|
const sink = getOutputSink();
|
|
26702
26715
|
if (format === "json") {
|
|
26703
|
-
|
|
26716
|
+
const json2 = JSON.stringify(data);
|
|
26717
|
+
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
26718
|
+
sink.writeErr(`${safe}
|
|
26704
26719
|
`);
|
|
26705
26720
|
} else {
|
|
26706
26721
|
for (const [key, value] of Object.entries(data)) {
|
|
@@ -26716,9 +26731,10 @@ var OutputFormatter;
|
|
|
26716
26731
|
data.Data = applyFilter(data.Data, filter);
|
|
26717
26732
|
}
|
|
26718
26733
|
const lines = [];
|
|
26734
|
+
const sink = getOutputSink();
|
|
26719
26735
|
printOutput(data, getOutputFormat(), (msg) => {
|
|
26720
26736
|
lines.push(msg);
|
|
26721
|
-
});
|
|
26737
|
+
}, needsAsciiSafeJson(sink));
|
|
26722
26738
|
return lines.join(`
|
|
26723
26739
|
`);
|
|
26724
26740
|
}
|
|
@@ -28127,6 +28143,46 @@ JSONPath.prototype.safeVm = {
|
|
|
28127
28143
|
Script: SafeScript
|
|
28128
28144
|
};
|
|
28129
28145
|
JSONPath.prototype.vm = vm;
|
|
28146
|
+
// ../common/src/option-aliases.ts
|
|
28147
|
+
function resolveDeprecatedOptionAlias({
|
|
28148
|
+
preferredValue,
|
|
28149
|
+
deprecatedValue,
|
|
28150
|
+
preferredFlag,
|
|
28151
|
+
deprecatedFlag
|
|
28152
|
+
}) {
|
|
28153
|
+
const hasPreferred = preferredValue !== undefined;
|
|
28154
|
+
const hasDeprecated = deprecatedValue !== undefined;
|
|
28155
|
+
if (hasPreferred && hasDeprecated) {
|
|
28156
|
+
return {
|
|
28157
|
+
value: undefined,
|
|
28158
|
+
usedDeprecated: true,
|
|
28159
|
+
error: {
|
|
28160
|
+
message: `${deprecatedFlag} and ${preferredFlag} are aliases. Use only ${preferredFlag}.`,
|
|
28161
|
+
instructions: `Replace ${deprecatedFlag} with ${preferredFlag}.`
|
|
28162
|
+
}
|
|
28163
|
+
};
|
|
28164
|
+
}
|
|
28165
|
+
return {
|
|
28166
|
+
value: hasPreferred ? preferredValue : deprecatedValue,
|
|
28167
|
+
usedDeprecated: hasDeprecated
|
|
28168
|
+
};
|
|
28169
|
+
}
|
|
28170
|
+
function warnDeprecatedOptionAlias(deprecatedFlag, preferredFlag) {
|
|
28171
|
+
getOutputSink().writeErr(`[WARN] ${deprecatedFlag} is deprecated. Use ${preferredFlag} instead.
|
|
28172
|
+
`);
|
|
28173
|
+
}
|
|
28174
|
+
var TENANT_SWITCH_COMMAND = "uip login tenant set <tenant>";
|
|
28175
|
+
function createHiddenDeprecatedTenantOption(flags = "-t, --tenant <tenant-name>") {
|
|
28176
|
+
return new Option(flags, `Tenant name. Deprecated; use ${TENANT_SWITCH_COMMAND} to switch active tenants.`).hideHelp().argParser((tenant) => {
|
|
28177
|
+
warnDeprecatedTenantOption(tenant);
|
|
28178
|
+
return tenant;
|
|
28179
|
+
});
|
|
28180
|
+
}
|
|
28181
|
+
function warnDeprecatedTenantOption(tenant) {
|
|
28182
|
+
if (tenant === undefined)
|
|
28183
|
+
return;
|
|
28184
|
+
warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
|
|
28185
|
+
}
|
|
28130
28186
|
// ../common/src/option-validators.ts
|
|
28131
28187
|
function parsePositiveInteger(raw) {
|
|
28132
28188
|
return parseSafeInteger(raw, 1);
|
|
@@ -35050,7 +35106,9 @@ var DEFAULT_SCOPES = [
|
|
|
35050
35106
|
"AutomationSolutions",
|
|
35051
35107
|
"StudioWebTypeCacheService",
|
|
35052
35108
|
"Docs.GPT.Search",
|
|
35053
|
-
"Insights"
|
|
35109
|
+
"Insights",
|
|
35110
|
+
"ReferenceToken",
|
|
35111
|
+
"Audit.Read"
|
|
35054
35112
|
];
|
|
35055
35113
|
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
35056
35114
|
let baseUrl = rawUrl;
|
|
@@ -35189,6 +35247,7 @@ var getTokenExpiration = (accessToken) => {
|
|
|
35189
35247
|
|
|
35190
35248
|
// ../auth/src/envAuth.ts
|
|
35191
35249
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
35250
|
+
var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
|
|
35192
35251
|
var ENV_AUTH_VARS = {
|
|
35193
35252
|
token: "UIPATH_CLI_AUTH_TOKEN",
|
|
35194
35253
|
organizationName: "UIPATH_CLI_ORGANIZATION_NAME",
|
|
@@ -35204,6 +35263,7 @@ class EnvAuthConfigError extends Error {
|
|
|
35204
35263
|
}
|
|
35205
35264
|
}
|
|
35206
35265
|
var isEnvAuthEnabled = () => process.env[ENV_AUTH_ENABLE_VAR] === "true";
|
|
35266
|
+
var isRobotAuthEnforced = () => process.env[ENFORCE_ROBOT_AUTH_VAR] === "true";
|
|
35207
35267
|
var requireEnv = (name) => {
|
|
35208
35268
|
const value = process.env[name];
|
|
35209
35269
|
if (!value) {
|
|
@@ -35245,7 +35305,9 @@ var readAuthFromEnv = () => {
|
|
|
35245
35305
|
expiration
|
|
35246
35306
|
};
|
|
35247
35307
|
};
|
|
35308
|
+
|
|
35248
35309
|
// ../auth/src/robotClientFallback.ts
|
|
35310
|
+
init_src();
|
|
35249
35311
|
var DEFAULT_TIMEOUT_MS = 1000;
|
|
35250
35312
|
var CLOSE_TIMEOUT_MS = 500;
|
|
35251
35313
|
var NOTICE_SENTINEL = Symbol.for("@uipath/auth/robotFallbackNoticePrinted");
|
|
@@ -35257,6 +35319,35 @@ var printNoticeOnce = () => {
|
|
|
35257
35319
|
catchError2(() => process.stderr.write(`Using UiPath Robot credentials. Run 'uip login' for a dedicated session.
|
|
35258
35320
|
`));
|
|
35259
35321
|
};
|
|
35322
|
+
var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
35323
|
+
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
35324
|
+
var PIPE_NAME_MAX_LENGTH = 103;
|
|
35325
|
+
var getRobotIpcPipeNames = async () => {
|
|
35326
|
+
const fs7 = getFileSystem();
|
|
35327
|
+
const username = fs7.env.getenv("USER") ?? fs7.env.getenv("USERNAME");
|
|
35328
|
+
if (!username) {
|
|
35329
|
+
throw new Error("Unable to determine current username");
|
|
35330
|
+
}
|
|
35331
|
+
const tempPath = fs7.env.getenv("TMPDIR") ?? "/tmp/";
|
|
35332
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs7.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
35333
|
+
};
|
|
35334
|
+
var defaultIsRobotIpcAvailable = async () => {
|
|
35335
|
+
if (process.platform === "win32") {
|
|
35336
|
+
return true;
|
|
35337
|
+
}
|
|
35338
|
+
const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
|
|
35339
|
+
if (pipeNamesError || !pipeNames) {
|
|
35340
|
+
return false;
|
|
35341
|
+
}
|
|
35342
|
+
const fs7 = getFileSystem();
|
|
35343
|
+
for (const pipeName of pipeNames) {
|
|
35344
|
+
const [existsError, exists] = await catchError2(fs7.exists(pipeName));
|
|
35345
|
+
if (!existsError && exists === true) {
|
|
35346
|
+
return true;
|
|
35347
|
+
}
|
|
35348
|
+
}
|
|
35349
|
+
return false;
|
|
35350
|
+
};
|
|
35260
35351
|
var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
|
|
35261
35352
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
35262
35353
|
promise.then((value) => {
|
|
@@ -35288,14 +35379,20 @@ var defaultLoadModule = async () => {
|
|
|
35288
35379
|
var tryRobotClientFallback = async (options = {}) => {
|
|
35289
35380
|
if (isBrowser())
|
|
35290
35381
|
return;
|
|
35291
|
-
if (
|
|
35292
|
-
|
|
35293
|
-
|
|
35294
|
-
|
|
35295
|
-
|
|
35382
|
+
if (!options.force) {
|
|
35383
|
+
if (process.env.CI || process.env.GITHUB_ACTIONS) {
|
|
35384
|
+
return;
|
|
35385
|
+
}
|
|
35386
|
+
if (process.env.UIPATH_URL) {
|
|
35387
|
+
return;
|
|
35388
|
+
}
|
|
35296
35389
|
}
|
|
35297
35390
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
35391
|
+
const isRobotIpcAvailable = options.isRobotIpcAvailable ?? defaultIsRobotIpcAvailable;
|
|
35298
35392
|
const loadModule = options.loadModule ?? defaultLoadModule;
|
|
35393
|
+
if (!await isRobotIpcAvailable()) {
|
|
35394
|
+
return;
|
|
35395
|
+
}
|
|
35299
35396
|
const mod2 = await loadModule();
|
|
35300
35397
|
if (!mod2)
|
|
35301
35398
|
return;
|
|
@@ -35563,10 +35660,6 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
35563
35660
|
return "token refresh failed before authentication completed";
|
|
35564
35661
|
}
|
|
35565
35662
|
var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
35566
|
-
if (isEnvAuthEnabled()) {
|
|
35567
|
-
return readAuthFromEnv();
|
|
35568
|
-
}
|
|
35569
|
-
const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
|
|
35570
35663
|
const {
|
|
35571
35664
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
35572
35665
|
loadEnvFile = loadEnvFileAsync,
|
|
@@ -35576,6 +35669,34 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
35576
35669
|
resolveConfig: resolveConfig2 = resolveConfigAsync,
|
|
35577
35670
|
robotFallback = tryRobotClientFallback
|
|
35578
35671
|
} = deps;
|
|
35672
|
+
if (isRobotAuthEnforced()) {
|
|
35673
|
+
if (isEnvAuthEnabled()) {
|
|
35674
|
+
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
35675
|
+
}
|
|
35676
|
+
const robotCreds = await robotFallback({ force: true });
|
|
35677
|
+
if (!robotCreds) {
|
|
35678
|
+
return {
|
|
35679
|
+
loginStatus: "Not logged in",
|
|
35680
|
+
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
|
|
35681
|
+
};
|
|
35682
|
+
}
|
|
35683
|
+
const expiration2 = getTokenExpiration(robotCreds.accessToken);
|
|
35684
|
+
return {
|
|
35685
|
+
loginStatus: "Logged in",
|
|
35686
|
+
accessToken: robotCreds.accessToken,
|
|
35687
|
+
baseUrl: robotCreds.baseUrl,
|
|
35688
|
+
organizationName: robotCreds.organizationName,
|
|
35689
|
+
organizationId: robotCreds.organizationId,
|
|
35690
|
+
tenantName: robotCreds.tenantName,
|
|
35691
|
+
tenantId: robotCreds.tenantId,
|
|
35692
|
+
expiration: expiration2,
|
|
35693
|
+
source: "robot" /* Robot */
|
|
35694
|
+
};
|
|
35695
|
+
}
|
|
35696
|
+
if (isEnvAuthEnabled()) {
|
|
35697
|
+
return readAuthFromEnv();
|
|
35698
|
+
}
|
|
35699
|
+
const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
|
|
35579
35700
|
const { absolutePath } = await resolveEnvFilePath(envFilePath);
|
|
35580
35701
|
if (absolutePath === undefined) {
|
|
35581
35702
|
const robotCreds = await robotFallback();
|
|
@@ -35742,7 +35863,7 @@ var getAuthContext = async (options = {}) => {
|
|
|
35742
35863
|
throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
|
|
35743
35864
|
}
|
|
35744
35865
|
if (options.requireTenantName && tenantName === undefined) {
|
|
35745
|
-
throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set.
|
|
35866
|
+
throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
|
|
35746
35867
|
}
|
|
35747
35868
|
return {
|
|
35748
35869
|
baseUrl: status.baseUrl,
|
|
@@ -35910,6 +36031,29 @@ async function getWebhookConfig(options, connectionId, elementInstanceId, connec
|
|
|
35910
36031
|
}
|
|
35911
36032
|
return await response.json();
|
|
35912
36033
|
}
|
|
36034
|
+
async function getHttpRequestPreview(options, connectionId) {
|
|
36035
|
+
const { baseUrl, accessToken, organizationId, tenantName } = await getValidatedAuthContext(options);
|
|
36036
|
+
const url = `${baseUrl}/${organizationId}/${tenantName}/elements_/v3/element/instances/${encodeURIComponent(connectionId)}/http-request-preview`;
|
|
36037
|
+
const response = await fetch(url, {
|
|
36038
|
+
method: "POST",
|
|
36039
|
+
headers: {
|
|
36040
|
+
Authorization: `Bearer ${accessToken}`,
|
|
36041
|
+
"Content-Type": "application/json",
|
|
36042
|
+
Accept: "application/json",
|
|
36043
|
+
"x-uipath-source": "UiPath.CodingAgent"
|
|
36044
|
+
},
|
|
36045
|
+
body: "{}"
|
|
36046
|
+
});
|
|
36047
|
+
if (!response.ok) {
|
|
36048
|
+
const errorText = await response.text();
|
|
36049
|
+
throw new Error(`Failed to fetch http-request preview: ${response.status} ${response.statusText} - ${errorText}`);
|
|
36050
|
+
}
|
|
36051
|
+
const json2 = await response.json();
|
|
36052
|
+
if (!json2.url) {
|
|
36053
|
+
throw new Error("http-request-preview response missing 'url' field");
|
|
36054
|
+
}
|
|
36055
|
+
return { url: json2.url };
|
|
36056
|
+
}
|
|
35913
36057
|
function folderOverride(folderKey) {
|
|
35914
36058
|
if (!folderKey)
|
|
35915
36059
|
return;
|
|
@@ -36558,13 +36702,15 @@ async function writeConnectors(connectors, tenantName) {
|
|
|
36558
36702
|
}));
|
|
36559
36703
|
await writeJson(await buildPath(["connectors.json"], tenantName), compact);
|
|
36560
36704
|
}
|
|
36561
|
-
function connectionsFile(folderKey) {
|
|
36705
|
+
function connectionsFile(folderKey, allFolders) {
|
|
36706
|
+
if (allFolders)
|
|
36707
|
+
return "connections.all-folders.json";
|
|
36562
36708
|
return folderKey ? `connections.folder.${folderKey}.json` : "connections.json";
|
|
36563
36709
|
}
|
|
36564
|
-
async function readConnections(connectorKey, folderKey, tenantName) {
|
|
36565
|
-
return readJson(await buildPath([connectorKey, connectionsFile(folderKey)], tenantName), TTL.connections);
|
|
36710
|
+
async function readConnections(connectorKey, folderKey, tenantName, allFolders) {
|
|
36711
|
+
return readJson(await buildPath([connectorKey, connectionsFile(folderKey, allFolders)], tenantName), TTL.connections);
|
|
36566
36712
|
}
|
|
36567
|
-
async function writeConnections(connectorKey, connections, folderKey, tenantName) {
|
|
36713
|
+
async function writeConnections(connectorKey, connections, folderKey, tenantName, allFolders) {
|
|
36568
36714
|
const compact = connections.map((c) => ({
|
|
36569
36715
|
id: c.id,
|
|
36570
36716
|
name: c.name,
|
|
@@ -36577,7 +36723,7 @@ async function writeConnections(connectorKey, connections, folderKey, tenantName
|
|
|
36577
36723
|
folderKey: c.folder?.key,
|
|
36578
36724
|
createTime: c.createTime
|
|
36579
36725
|
}));
|
|
36580
|
-
await writeJson(await buildPath([connectorKey, connectionsFile(folderKey)], tenantName), compact);
|
|
36726
|
+
await writeJson(await buildPath([connectorKey, connectionsFile(folderKey, allFolders)], tenantName), compact);
|
|
36581
36727
|
}
|
|
36582
36728
|
async function readActivities(connectorKey, tenantName) {
|
|
36583
36729
|
return readJson(await buildPath([connectorKey, "activities.json"], tenantName), TTL.activities);
|
|
@@ -36691,7 +36837,7 @@ var ACTIVITIES_LIST_EXAMPLES = [
|
|
|
36691
36837
|
];
|
|
36692
36838
|
var registerActivitiesCommand = (program2) => {
|
|
36693
36839
|
const activities = program2.command("activities").description("Manage UiPath Integration Service activities");
|
|
36694
|
-
activities.command("list").description("List activities for a connector").argument("<connector-key>", "Connector key (e.g., uipath-zoho-desk)").
|
|
36840
|
+
activities.command("list").description("List activities for a connector").argument("<connector-key>", "Connector key (e.g., uipath-zoho-desk)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--refresh", "Force re-fetch from API, ignoring cache").option("--triggers", "List trigger activities only").examples(ACTIVITIES_LIST_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
36695
36841
|
const isTriggerMode = options.triggers === true;
|
|
36696
36842
|
const modeLabel = isTriggerMode ? "trigger" : "non-trigger";
|
|
36697
36843
|
logger.info(`Listing ${modeLabel} activities for connector: ${connectorKey}${options.refresh ? " [refresh]" : ""}`);
|
|
@@ -36878,10 +37024,10 @@ function writePendingAuthorization(connectorKey, connectionId, response) {
|
|
|
36878
37024
|
});
|
|
36879
37025
|
}
|
|
36880
37026
|
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
36881
|
-
var LIST_CONNECTIONS_AUTH_INSTRUCTIONS = "Run 'uip login' to authenticate,
|
|
37027
|
+
var LIST_CONNECTIONS_AUTH_INSTRUCTIONS = "Run 'uip login' to authenticate, then use 'uip login tenant set <tenant>' if you need to switch tenants.";
|
|
36882
37028
|
var LIST_CONNECTIONS_API_INSTRUCTIONS = "Verify the connector key and folder key, then retry. Use 'uip is connections list --help' for accepted options.";
|
|
36883
37029
|
var EXPORT_CONNECTIONS_API_INSTRUCTIONS = "Verify the tenant and retry. Use 'uip is connections export --help' for accepted options.";
|
|
36884
|
-
var CONNECTIONS_CONFIG_ERROR_INSTRUCTIONS = "Run 'uip
|
|
37030
|
+
var CONNECTIONS_CONFIG_ERROR_INSTRUCTIONS = "Run 'uip login' and retry. Use 'uip login tenant set <tenant>' to switch tenants, or set UIPATH_TENANT_NAME for environment authentication.";
|
|
36885
37031
|
var CONNECTIONS_UPDATE_POLLING_INTERVAL_ERROR_INSTRUCTIONS = "Verify the connection ID with 'uip is connections list --refresh', confirm --polling-interval is supported for the connection, and retry.";
|
|
36886
37032
|
function appendListConnectionsHint(details, hint) {
|
|
36887
37033
|
const normalizedDetails = details?.trim();
|
|
@@ -37020,6 +37166,19 @@ var CONNECTIONS_UPDATE_POLLING_INTERVAL_EXAMPLES = [
|
|
|
37020
37166
|
}
|
|
37021
37167
|
}
|
|
37022
37168
|
];
|
|
37169
|
+
var CONNECTIONS_BASE_URL_EXAMPLES = [
|
|
37170
|
+
{
|
|
37171
|
+
Description: "Get the API base URL for a connection",
|
|
37172
|
+
Command: "uip is connections base-url a1b2c3d4-0000-0000-0000-000000000001",
|
|
37173
|
+
Output: {
|
|
37174
|
+
Code: "ConnectionBaseUrl",
|
|
37175
|
+
Data: {
|
|
37176
|
+
ConnectionId: "a1b2c3d4-0000-0000-0000-000000000001",
|
|
37177
|
+
BaseUrl: "https://api.example.com/v2"
|
|
37178
|
+
}
|
|
37179
|
+
}
|
|
37180
|
+
}
|
|
37181
|
+
];
|
|
37023
37182
|
var CONNECTIONS_RENAME_EXAMPLES = [
|
|
37024
37183
|
{
|
|
37025
37184
|
Description: "Rename an existing connection",
|
|
@@ -37036,29 +37195,42 @@ var CONNECTIONS_RENAME_EXAMPLES = [
|
|
|
37036
37195
|
function resolveFolderKey(options) {
|
|
37037
37196
|
const folder = options.folder?.trim();
|
|
37038
37197
|
const folderKey = options.folderKey?.trim();
|
|
37039
|
-
if (folder !== undefined && folderKey !== undefined
|
|
37198
|
+
if (folder !== undefined && folderKey !== undefined) {
|
|
37040
37199
|
OutputFormatter.error({
|
|
37041
37200
|
Result: RESULTS.Failure,
|
|
37042
|
-
Message: "
|
|
37043
|
-
Instructions: "
|
|
37201
|
+
Message: "--folder and --folder-key are aliases. Use only --folder-key.",
|
|
37202
|
+
Instructions: "Replace --folder with --folder-key."
|
|
37044
37203
|
});
|
|
37045
37204
|
processContext.exit(1);
|
|
37046
37205
|
return { hasError: true };
|
|
37047
37206
|
}
|
|
37207
|
+
if (folder !== undefined) {
|
|
37208
|
+
getOutputSink().writeErr(`[WARN] --folder is deprecated. Use --folder-key instead.
|
|
37209
|
+
`);
|
|
37210
|
+
}
|
|
37048
37211
|
return { folderKey: folderKey ?? folder, hasError: false };
|
|
37049
37212
|
}
|
|
37050
37213
|
var registerConnectionsCommand = (program2) => {
|
|
37051
37214
|
const connections = program2.command("connections").description("Manage UiPath Integration Service connections");
|
|
37052
|
-
connections.command("list").description("List connections").argument("[connector-key]", "Connector key to filter by").option("--folder <key>", "Folder key to filter by
|
|
37215
|
+
connections.command("list").description("List connections").argument("[connector-key]", "Connector key to filter by").option("--folder-key <key>", "Folder key to filter by").addOption(new Option("--folder <key>").hideHelp()).option("--connection-id <id>", "Filter to a specific connection ID").option("--byoa", "Filter to BYOA (Bring Your Own Account) connections only").option("--all-folders", "Return connections across all folders (cannot be combined with --folder/--folder-key)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--refresh", "Force re-fetch from API, ignoring cache").examples(CONNECTIONS_LIST_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
37053
37216
|
const { folderKey, hasError } = resolveFolderKey(options);
|
|
37054
37217
|
if (hasError) {
|
|
37055
37218
|
return;
|
|
37056
37219
|
}
|
|
37220
|
+
if (options.allFolders && folderKey !== undefined) {
|
|
37221
|
+
OutputFormatter.error({
|
|
37222
|
+
Result: RESULTS.Failure,
|
|
37223
|
+
Message: "Conflicting folder flags: --all-folders cannot be combined with --folder or --folder-key.",
|
|
37224
|
+
Instructions: "Use --all-folders to list across all folders, or pass --folder/--folder-key to scope to a single folder."
|
|
37225
|
+
});
|
|
37226
|
+
processContext.exit(1);
|
|
37227
|
+
return;
|
|
37228
|
+
}
|
|
37057
37229
|
if (folderKey !== undefined && !UUID_RE.test(folderKey)) {
|
|
37058
37230
|
OutputFormatter.error({
|
|
37059
37231
|
Result: RESULTS.Failure,
|
|
37060
37232
|
Message: `Invalid folder key: '${folderKey}'`,
|
|
37061
|
-
Instructions: "Folder key must be a UUID (e.g. 717ede25-7494-44d5-9d65-5dab660653f6). Provide it with --folder
|
|
37233
|
+
Instructions: "Folder key must be a UUID (e.g. 717ede25-7494-44d5-9d65-5dab660653f6). Provide it with --folder-key."
|
|
37062
37234
|
});
|
|
37063
37235
|
processContext.exit(1);
|
|
37064
37236
|
return;
|
|
@@ -37077,13 +37249,16 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37077
37249
|
let data = null;
|
|
37078
37250
|
if (connectorKey) {
|
|
37079
37251
|
if (!options.refresh) {
|
|
37080
|
-
data = await readConnections(connectorKey, folderKey, options.tenant);
|
|
37252
|
+
data = await readConnections(connectorKey, folderKey, options.tenant, options.allFolders);
|
|
37081
37253
|
if (data)
|
|
37082
37254
|
logger.info(`Loaded ${data.length} connections from cache`);
|
|
37083
37255
|
}
|
|
37084
37256
|
if (!data) {
|
|
37085
37257
|
const api = new ConnectorsApi(config);
|
|
37086
|
-
const [fetchError, fetched] = await catchError(api.apiV1ConnectorsKeyOrIdConnectionsGet({
|
|
37258
|
+
const [fetchError, fetched] = await catchError(api.apiV1ConnectorsKeyOrIdConnectionsGet({
|
|
37259
|
+
keyOrId: connectorKey,
|
|
37260
|
+
...options.allFolders ? { allFolders: true } : {}
|
|
37261
|
+
}, folderOverride(folderKey)));
|
|
37087
37262
|
if (fetchError) {
|
|
37088
37263
|
const { message, details, context } = await extractErrorDetails(fetchError);
|
|
37089
37264
|
if (context?.httpStatus === 404) {
|
|
@@ -37100,13 +37275,13 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37100
37275
|
} else {
|
|
37101
37276
|
data = fetched;
|
|
37102
37277
|
if (data && data.length > 0) {
|
|
37103
|
-
await writeConnections(connectorKey, data, folderKey, options.tenant);
|
|
37278
|
+
await writeConnections(connectorKey, data, folderKey, options.tenant, options.allFolders);
|
|
37104
37279
|
}
|
|
37105
37280
|
}
|
|
37106
37281
|
}
|
|
37107
37282
|
} else {
|
|
37108
37283
|
const api = new ConnectionsApi(config);
|
|
37109
|
-
const [fetchError, fetched] = await catchError(api.apiV1ConnectionsGet({}, folderOverride(folderKey)));
|
|
37284
|
+
const [fetchError, fetched] = await catchError(api.apiV1ConnectionsGet(options.allFolders ? { allFolders: true } : {}, folderOverride(folderKey)));
|
|
37110
37285
|
if (fetchError) {
|
|
37111
37286
|
const { message, details, context } = await extractErrorDetails(fetchError);
|
|
37112
37287
|
if (context?.httpStatus === 404) {
|
|
@@ -37151,7 +37326,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37151
37326
|
});
|
|
37152
37327
|
}
|
|
37153
37328
|
});
|
|
37154
|
-
connections.command("export").description("Export connections for audit").
|
|
37329
|
+
connections.command("export").description("Export connections for audit").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTIONS_EXPORT_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
37155
37330
|
logger.info("Exporting connections");
|
|
37156
37331
|
const [configError, config] = await catchError(createConnectionsConfig({ tenant: options.tenant }));
|
|
37157
37332
|
if (configError) {
|
|
@@ -37183,7 +37358,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37183
37358
|
Data: result
|
|
37184
37359
|
});
|
|
37185
37360
|
});
|
|
37186
|
-
connections.command("create").description("Create a new connection (OAuth flow)").argument("<connector-key>", "Connector key").
|
|
37361
|
+
connections.command("create").description("Create a new connection (OAuth flow)").argument("<connector-key>", "Connector key").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--no-browser", "Don't auto-open browser").option("--no-wait", "Return pending authorization details without polling").examples(CONNECTIONS_CREATE_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
37187
37362
|
logger.info(`Creating connection for: ${connectorKey}`);
|
|
37188
37363
|
const [configError, config] = await catchError(createConnectionsConfig({ tenant: options.tenant }));
|
|
37189
37364
|
if (configError) {
|
|
@@ -37283,7 +37458,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37283
37458
|
}
|
|
37284
37459
|
handleAuthPollFailure(pollResult.outcome, pollResult.error, "Authentication", `uip is connections create ${connectorKey}`);
|
|
37285
37460
|
});
|
|
37286
|
-
connections.command("ping").description("Check if a connection is active").argument("<connection-id>", "Connection ID").
|
|
37461
|
+
connections.command("ping").description("Check if a connection is active").argument("<connection-id>", "Connection ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--force-refresh", "Force a live connection status refresh").examples(CONNECTIONS_PING_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37287
37462
|
logger.info(`Pinging: ${connectionId}`);
|
|
37288
37463
|
const [configError, config] = await catchError(createConnectionsConfig({ tenant: options.tenant }));
|
|
37289
37464
|
if (configError) {
|
|
@@ -37340,7 +37515,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37340
37515
|
processContext.exit(1);
|
|
37341
37516
|
}
|
|
37342
37517
|
});
|
|
37343
|
-
connections.command("delete").description("Delete a connection").argument("<connection-id>", "Connection ID").
|
|
37518
|
+
connections.command("delete").description("Delete a connection").argument("<connection-id>", "Connection ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTIONS_DELETE_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37344
37519
|
logger.info(`Deleting connection: ${connectionId}`);
|
|
37345
37520
|
const [configError, config] = await catchError(createConnectionsConfig({ tenant: options.tenant }));
|
|
37346
37521
|
if (configError) {
|
|
@@ -37373,7 +37548,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37373
37548
|
}
|
|
37374
37549
|
});
|
|
37375
37550
|
});
|
|
37376
|
-
connections.command("update-polling-interval").description("Update a connection polling interval").argument("<connection-id>", "Connection ID").requiredOption("--polling-interval <minutes>", "Polling interval in minutes").
|
|
37551
|
+
connections.command("update-polling-interval").description("Update a connection polling interval").argument("<connection-id>", "Connection ID").requiredOption("--polling-interval <minutes>", "Polling interval in minutes").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTIONS_UPDATE_POLLING_INTERVAL_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37377
37552
|
const normalizedPollingInterval = options.pollingInterval.trim();
|
|
37378
37553
|
const pollingIntervalInMinutes = parsePositiveInteger(normalizedPollingInterval);
|
|
37379
37554
|
if (pollingIntervalInMinutes === undefined) {
|
|
@@ -37422,7 +37597,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37422
37597
|
}
|
|
37423
37598
|
});
|
|
37424
37599
|
});
|
|
37425
|
-
connections.command("rename").description("Rename a connection").argument("<connection-id>", "Connection ID").requiredOption("--name <name>", "New connection name").
|
|
37600
|
+
connections.command("rename").description("Rename a connection").argument("<connection-id>", "Connection ID").requiredOption("--name <name>", "New connection name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTIONS_RENAME_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37426
37601
|
const connectionName = options.name.trim();
|
|
37427
37602
|
if (connectionName.length === 0) {
|
|
37428
37603
|
OutputFormatter.error({
|
|
@@ -37468,7 +37643,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37468
37643
|
}
|
|
37469
37644
|
});
|
|
37470
37645
|
});
|
|
37471
|
-
connections.command("set-default").description("Set a connection as the default connection").argument("<connection-id>", "Connection ID").
|
|
37646
|
+
connections.command("set-default").description("Set a connection as the default connection").argument("<connection-id>", "Connection ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTIONS_SET_DEFAULT_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37472
37647
|
logger.info(`Setting default connection: ${connectionId}`);
|
|
37473
37648
|
const [configError, config] = await catchError(createConnectionsConfig({ tenant: options.tenant }));
|
|
37474
37649
|
if (configError) {
|
|
@@ -37503,7 +37678,7 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37503
37678
|
}
|
|
37504
37679
|
});
|
|
37505
37680
|
});
|
|
37506
|
-
connections.command("edit").description("Re-authenticate a connection (OAuth flow)").argument("<connection-id>", "Connection ID").
|
|
37681
|
+
connections.command("edit").description("Re-authenticate a connection (OAuth flow)").argument("<connection-id>", "Connection ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--no-browser", "Don't auto-open browser").option("--no-wait", "Return pending authorization details without polling").examples(CONNECTIONS_EDIT_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37507
37682
|
logger.info(`Re-authenticating: ${connectionId}`);
|
|
37508
37683
|
const [configError, config] = await catchError(createConnectionsConfig({ tenant: options.tenant }));
|
|
37509
37684
|
if (configError) {
|
|
@@ -37579,6 +37754,28 @@ var registerConnectionsCommand = (program2) => {
|
|
|
37579
37754
|
}
|
|
37580
37755
|
handleAuthPollFailure(pollResult.outcome, pollResult.error, "Re-authentication", `uip is connections edit ${connectionId}`);
|
|
37581
37756
|
});
|
|
37757
|
+
connections.command("base-url").description("Get the API base URL for a connection").argument("<connection-id>", "Connection ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTIONS_BASE_URL_EXAMPLES).trackedAction(processContext, async (connectionId, options) => {
|
|
37758
|
+
logger.info(`Fetching base URL for: ${connectionId}`);
|
|
37759
|
+
const [error, result] = await catchError(getHttpRequestPreview({ tenant: options.tenant }, connectionId));
|
|
37760
|
+
if (error) {
|
|
37761
|
+
const msg = await extractErrorMessage(error);
|
|
37762
|
+
OutputFormatter.error({
|
|
37763
|
+
Result: RESULTS.Failure,
|
|
37764
|
+
Message: msg,
|
|
37765
|
+
Instructions: "Verify the connection ID with 'uip is connections list', confirm the connection is Enabled, and retry."
|
|
37766
|
+
});
|
|
37767
|
+
processContext.exit(1);
|
|
37768
|
+
return;
|
|
37769
|
+
}
|
|
37770
|
+
OutputFormatter.success({
|
|
37771
|
+
Result: RESULTS.Success,
|
|
37772
|
+
Code: "ConnectionBaseUrl",
|
|
37773
|
+
Data: {
|
|
37774
|
+
ConnectionId: connectionId,
|
|
37775
|
+
BaseUrl: result.url
|
|
37776
|
+
}
|
|
37777
|
+
});
|
|
37778
|
+
});
|
|
37582
37779
|
};
|
|
37583
37780
|
async function openBrowser(url) {
|
|
37584
37781
|
await getFileSystem().utils.open(url);
|
|
@@ -37769,7 +37966,7 @@ var ELEMENT_EVENT_OPERATIONS_EXAMPLES = [
|
|
|
37769
37966
|
var ELEMENT_AUDIT_LOGS_EXAMPLES = [
|
|
37770
37967
|
{
|
|
37771
37968
|
Description: "List audit logs for a connector element version",
|
|
37772
|
-
Command: "uip is connectors audit-logs uipath-zoho-desk --version 1.0.0 --
|
|
37969
|
+
Command: "uip is connectors audit-logs uipath-zoho-desk --version 1.0.0 --limit 50",
|
|
37773
37970
|
Output: {
|
|
37774
37971
|
Code: "ElementAuditLogList",
|
|
37775
37972
|
Data: [
|
|
@@ -37805,12 +38002,12 @@ function normalizeList(value) {
|
|
|
37805
38002
|
return [];
|
|
37806
38003
|
return [value];
|
|
37807
38004
|
}
|
|
37808
|
-
function parsePageSize(pageSize) {
|
|
38005
|
+
function parsePageSize(pageSize, flagName = "--limit") {
|
|
37809
38006
|
if (pageSize === undefined)
|
|
37810
38007
|
return {};
|
|
37811
38008
|
const value = parsePositiveInteger(pageSize);
|
|
37812
38009
|
if (value === undefined) {
|
|
37813
|
-
return { error:
|
|
38010
|
+
return { error: `${flagName} must be a positive integer.` };
|
|
37814
38011
|
}
|
|
37815
38012
|
return { value };
|
|
37816
38013
|
}
|
|
@@ -37820,7 +38017,7 @@ async function readBlobBytes(blob) {
|
|
|
37820
38017
|
}
|
|
37821
38018
|
var registerConnectorsCommand = (program2) => {
|
|
37822
38019
|
const connectors = program2.command("connectors").description("Manage UiPath Integration Service connectors");
|
|
37823
|
-
connectors.command("list").description("List all connectors").
|
|
38020
|
+
connectors.command("list").description("List all connectors").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-f, --filter <filter>", "Filter connectors by name or key").option("--refresh", "Force re-fetch from API, ignoring cache").examples(CONNECTORS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
37824
38021
|
logger.info(`Listing connectors${options.filter ? ` (filter: ${options.filter})` : ""}${options.refresh ? " [refresh]" : ""}`);
|
|
37825
38022
|
const [apiError, api] = await catchError(createApiClient(ConnectorsApi, { tenant: options.tenant }));
|
|
37826
38023
|
if (apiError) {
|
|
@@ -37863,7 +38060,7 @@ var registerConnectorsCommand = (program2) => {
|
|
|
37863
38060
|
Data: data.length > 0 ? formatConnectorList(data) : []
|
|
37864
38061
|
});
|
|
37865
38062
|
});
|
|
37866
|
-
connectors.command("get").description("Get connector by key").argument("<connector-key>", "Connector key (e.g., uipath-zoho-desk)").
|
|
38063
|
+
connectors.command("get").description("Get connector by key").argument("<connector-key>", "Connector key (e.g., uipath-zoho-desk)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(CONNECTORS_GET_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
37867
38064
|
logger.info(`Getting connector: ${connectorKey}`);
|
|
37868
38065
|
const [apiError, api] = await catchError(createApiClient(ConnectorsApi, { tenant: options.tenant }));
|
|
37869
38066
|
if (apiError) {
|
|
@@ -37895,7 +38092,7 @@ var registerConnectorsCommand = (program2) => {
|
|
|
37895
38092
|
registerConnectorApiCommands(connectors);
|
|
37896
38093
|
};
|
|
37897
38094
|
var registerConnectorApiCommands = (connectors) => {
|
|
37898
|
-
connectors.command("swagger").description("Get the OpenAPI document for a connector element").argument("<connector-key>", "Connector key").
|
|
38095
|
+
connectors.command("swagger").description("Get the OpenAPI document for a connector element").argument("<connector-key>", "Connector key").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--version <version>", "Element version").examples(ELEMENT_SWAGGER_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
37899
38096
|
logger.info(`Getting element swagger: ${connectorKey}`);
|
|
37900
38097
|
const [apiError, api] = await catchError(createApiClient(ElementsApi, { tenant: options.tenant }));
|
|
37901
38098
|
if (apiError) {
|
|
@@ -37927,7 +38124,7 @@ var registerConnectorApiCommands = (connectors) => {
|
|
|
37927
38124
|
Data: swagger
|
|
37928
38125
|
});
|
|
37929
38126
|
});
|
|
37930
|
-
connectors.command("event-operations").description("List event operations for a connector element").argument("<connector-key>", "Connector key").
|
|
38127
|
+
connectors.command("event-operations").description("List event operations for a connector element").argument("<connector-key>", "Connector key").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--version <version>", "Element version").examples(ELEMENT_EVENT_OPERATIONS_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
37931
38128
|
logger.info(`Listing element event operations: ${connectorKey}`);
|
|
37932
38129
|
const [apiError, api] = await catchError(createApiClient(ElementsApi, { tenant: options.tenant }));
|
|
37933
38130
|
if (apiError) {
|
|
@@ -37963,9 +38160,27 @@ var registerConnectorApiCommands = (connectors) => {
|
|
|
37963
38160
|
} : {}
|
|
37964
38161
|
});
|
|
37965
38162
|
});
|
|
37966
|
-
connectors.command("audit-logs").description("List audit logs for a connector element version").argument("<connector-key>", "Connector key").requiredOption("--version <version>", "Element version").option("--
|
|
38163
|
+
connectors.command("audit-logs").description("List audit logs for a connector element version").argument("<connector-key>", "Connector key").requiredOption("--version <version>", "Element version").option("--limit <n>", "Page size for pagination").addOption(new Option("--page-size <n>").hideHelp()).option("--next-page <token>", "Next page cursor").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ELEMENT_AUDIT_LOGS_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
37967
38164
|
logger.info(`Listing element audit logs: ${connectorKey}`);
|
|
37968
|
-
const
|
|
38165
|
+
const pageSize = resolveDeprecatedOptionAlias({
|
|
38166
|
+
preferredValue: options.limit,
|
|
38167
|
+
deprecatedValue: options.pageSize,
|
|
38168
|
+
preferredFlag: "--limit",
|
|
38169
|
+
deprecatedFlag: "--page-size"
|
|
38170
|
+
});
|
|
38171
|
+
if (pageSize.error) {
|
|
38172
|
+
OutputFormatter.error({
|
|
38173
|
+
Result: RESULTS.Failure,
|
|
38174
|
+
Message: pageSize.error.message,
|
|
38175
|
+
Instructions: pageSize.error.instructions
|
|
38176
|
+
});
|
|
38177
|
+
processContext.exit(1);
|
|
38178
|
+
return;
|
|
38179
|
+
}
|
|
38180
|
+
if (pageSize.usedDeprecated) {
|
|
38181
|
+
warnDeprecatedOptionAlias("--page-size", "--limit");
|
|
38182
|
+
}
|
|
38183
|
+
const parsedPageSize = parsePageSize(pageSize.value, pageSize.usedDeprecated ? "--page-size" : "--limit");
|
|
37969
38184
|
if (parsedPageSize.error) {
|
|
37970
38185
|
OutputFormatter.error({
|
|
37971
38186
|
Result: RESULTS.Failure,
|
|
@@ -38011,7 +38226,7 @@ var registerConnectorApiCommands = (connectors) => {
|
|
|
38011
38226
|
} : {}
|
|
38012
38227
|
});
|
|
38013
38228
|
});
|
|
38014
|
-
connectors.command("export").description("Export a connector element to a file").argument("<connector-key>", "Connector key").requiredOption("--output-file <path>", "Output file path").option("--version <version>", "Element version").
|
|
38229
|
+
connectors.command("export").description("Export a connector element to a file").argument("<connector-key>", "Connector key").requiredOption("--output-file <path>", "Output file path").option("--version <version>", "Element version").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ELEMENT_EXPORT_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
38015
38230
|
logger.info(`Exporting element: ${connectorKey}`);
|
|
38016
38231
|
const [apiError, api] = await catchError(createApiClient(ElementsApi, { tenant: options.tenant }));
|
|
38017
38232
|
if (apiError) {
|
|
@@ -38244,7 +38459,7 @@ function buildResourceCompactSummary(metadata, operation) {
|
|
|
38244
38459
|
};
|
|
38245
38460
|
}
|
|
38246
38461
|
const rawParams = methodInfo.parameters || [];
|
|
38247
|
-
const parameters = rawParams.filter((p) => p.type === "path" || p.type === "query").map((p) => {
|
|
38462
|
+
const parameters = rawParams.filter((p) => p.type === "path" || p.type === "query" || p.type === "multipart").map((p) => {
|
|
38248
38463
|
const param = {
|
|
38249
38464
|
name: p.name,
|
|
38250
38465
|
type: p.type,
|
|
@@ -38858,7 +39073,7 @@ function parseBody(options) {
|
|
|
38858
39073
|
return parsed;
|
|
38859
39074
|
}
|
|
38860
39075
|
function addExecuteOptions(cmd) {
|
|
38861
|
-
return cmd.option("--connection-id <id>", "Connection/Instance ID (required)").
|
|
39076
|
+
return cmd.option("--connection-id <id>", "Connection/Instance ID (required)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--query <params>", "Query parameters (key=value&key=value or JSON)");
|
|
38862
39077
|
}
|
|
38863
39078
|
function validateConnectionId2(options) {
|
|
38864
39079
|
if (!options.connectionId) {
|
|
@@ -38934,7 +39149,7 @@ async function handleExecuteAction(connectorKey, objectName, httpMethod, normali
|
|
|
38934
39149
|
}
|
|
38935
39150
|
var registerResourcesCommand = (program2) => {
|
|
38936
39151
|
const resources = program2.command("resources").description("Manage UiPath Integration Service resources");
|
|
38937
|
-
resources.command("list").description("List available objects for a connector").argument("<connector-key>", "Connector key").option("--operation <operation>", `Filter by operation (${VALID_OPERATIONS})`).option("--connection-id <id>", "Connection/Instance ID").
|
|
39152
|
+
resources.command("list").description("List available objects for a connector").argument("<connector-key>", "Connector key").option("--operation <operation>", `Filter by operation (${VALID_OPERATIONS})`).option("--connection-id <id>", "Connection/Instance ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--refresh", "Force re-fetch from API, ignoring cache").examples(RESOURCES_LIST_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
38938
39153
|
logger.info(`Listing resources for: ${connectorKey}`);
|
|
38939
39154
|
const connectionId = resolveCacheKey(options.connectionId);
|
|
38940
39155
|
let data = null;
|
|
@@ -38995,7 +39210,7 @@ var registerResourcesCommand = (program2) => {
|
|
|
38995
39210
|
})();
|
|
38996
39211
|
OutputFormatter.emitList("ResourceList", formatResourceList(filtered), { emptyInstructions, warning });
|
|
38997
39212
|
});
|
|
38998
|
-
resources.command("describe").description("Describe object fields and operations").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name").option("--connection-id <id>", "Connection/Instance ID").
|
|
39213
|
+
resources.command("describe").description("Describe object fields and operations").argument("<connector-key>", "Connector key").argument("<object-name>", "Object name").option("--connection-id <id>", "Connection/Instance ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--operation <operation>", `Filter to a single operation (${VALID_OPERATIONS})`).option("--refresh", "Force re-fetch from API, ignoring cache").option("-f, --field <name=value>", "Parent-field value (repeatable) — runs the api-type ObjectAction (e.g. Jira GenerateSchema, Salesforce GenerateQuerySchema) and merges its custom-field response into requestFields. Requires --connection-id and --operation.", (value, prev = []) => [...prev, value], []).option("--action <name>", "Explicit api-type ObjectAction name (e.g. GenerateSchema). Optional — inferred from --field rules when omitted.").examples(RESOURCES_DESCRIBE_EXAMPLES).trackedAction(processContext, async (connectorKey, objectName, options) => {
|
|
38999
39214
|
const operation = resolveOperationOption(options.operation);
|
|
39000
39215
|
logger.info(`Describing: ${connectorKey}/${objectName}${operation ? ` (operation: ${operation.name})` : ""}`);
|
|
39001
39216
|
if (!validateOperationOption(options.operation))
|
|
@@ -39273,7 +39488,7 @@ var TRIGGERS_DESCRIBE_EXAMPLES = [
|
|
|
39273
39488
|
];
|
|
39274
39489
|
var registerTriggersCommand = (program2) => {
|
|
39275
39490
|
const triggers = program2.command("triggers").description("Manage UiPath Integration Service trigger metadata");
|
|
39276
|
-
triggers.command("objects").description("List objects for a trigger operation").argument("<connector-key>", "Connector key").argument("<operation>", "Trigger operation (CREATED, UPDATED, DELETED)").option("--connection-id <id>", "Connection/Instance ID").
|
|
39491
|
+
triggers.command("objects").description("List objects for a trigger operation").argument("<connector-key>", "Connector key").argument("<operation>", "Trigger operation (CREATED, UPDATED, DELETED)").option("--connection-id <id>", "Connection/Instance ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--refresh", "Force re-fetch from API, ignoring cache").examples(TRIGGERS_OBJECTS_EXAMPLES).trackedAction(processContext, async (connectorKey, operation, options) => {
|
|
39277
39492
|
const normalizedOp = operation.toUpperCase();
|
|
39278
39493
|
logger.info(`Listing trigger objects: ${connectorKey}/${normalizedOp}`);
|
|
39279
39494
|
if (!options.refresh && options.connectionId) {
|
|
@@ -39315,7 +39530,7 @@ var registerTriggersCommand = (program2) => {
|
|
|
39315
39530
|
warning: !options.connectionId ? "Results may not include custom objects. Use --connection-id for connection-specific data." : undefined
|
|
39316
39531
|
});
|
|
39317
39532
|
});
|
|
39318
|
-
triggers.command("describe").description("Get metadata for a trigger object").argument("<connector-key>", "Connector key").argument("<operation>", "Trigger operation").argument("<object-name>", "Object name").option("--connection-id <id>", "Connection/Instance ID").
|
|
39533
|
+
triggers.command("describe").description("Get metadata for a trigger object").argument("<connector-key>", "Connector key").argument("<operation>", "Trigger operation").argument("<object-name>", "Object name").option("--connection-id <id>", "Connection/Instance ID").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--refresh", "Force re-fetch from API, ignoring cache").examples(TRIGGERS_DESCRIBE_EXAMPLES).trackedAction(processContext, async (connectorKey, operation, objectName, options) => {
|
|
39319
39534
|
const normalizedOp = operation.toUpperCase();
|
|
39320
39535
|
logger.info(`Describing trigger: ${connectorKey}/${normalizedOp}/${objectName}`);
|
|
39321
39536
|
if (!options.refresh && options.connectionId) {
|
|
@@ -39391,7 +39606,7 @@ var WEBHOOKS_CONFIG_EXAMPLES = [
|
|
|
39391
39606
|
];
|
|
39392
39607
|
var registerWebhooksCommand = (program2) => {
|
|
39393
39608
|
const webhooks = program2.command("webhooks").description("Manage Integration Service webhook configuration for triggers");
|
|
39394
|
-
webhooks.command("config").description("Get the webhook URL for a connector trigger using webhooks event mode").argument("<connector-key>", "Connector key (e.g. uipath-salesforce-slack)").requiredOption("--connection-id <id>", "Connection ID (UUID) from 'is connections list'").requiredOption("--element-instance-id <id>", "Element instance ID (numeric) from 'is connections list'").
|
|
39609
|
+
webhooks.command("config").description("Get the webhook URL for a connector trigger using webhooks event mode").argument("<connector-key>", "Connector key (e.g. uipath-salesforce-slack)").requiredOption("--connection-id <id>", "Connection ID (UUID) from 'is connections list'").requiredOption("--element-instance-id <id>", "Element instance ID (numeric) from 'is connections list'").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(WEBHOOKS_CONFIG_EXAMPLES).trackedAction(processContext, async (connectorKey, options) => {
|
|
39395
39610
|
const elementInstanceId = Number(options.elementInstanceId);
|
|
39396
39611
|
if (!Number.isFinite(elementInstanceId)) {
|
|
39397
39612
|
OutputFormatter.error({
|