@uipath/common 0.2.0 → 0.9.1
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 +3 -3
- package/dist/catch-error.d.ts +5 -0
- package/dist/command-examples.d.ts +36 -0
- package/dist/command-help.d.ts +53 -0
- package/dist/command-walker.d.ts +14 -0
- package/dist/completer.d.ts +48 -0
- package/dist/console-guard.d.ts +24 -0
- package/dist/constants.d.ts +18 -0
- package/dist/env-reference.d.ts +10 -0
- package/dist/error-handler.d.ts +52 -0
- package/dist/error-instructions.d.ts +2 -0
- package/dist/formatter.d.ts +101 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1316 -161
- package/dist/jsonpath.d.ts +11 -0
- package/dist/logger.d.ts +116 -0
- package/dist/option-validators.d.ts +33 -0
- package/dist/output-context.d.ts +28 -0
- package/dist/output-format-context.d.ts +27 -0
- package/dist/output-sink.d.ts +23 -0
- package/dist/polling/abort-controller.d.ts +1 -0
- package/dist/polling/format-utils.d.ts +13 -0
- package/dist/polling/index.d.ts +6 -0
- package/dist/polling/poll-until.d.ts +60 -0
- package/dist/polling/terminal-statuses.d.ts +50 -0
- package/dist/polling/types.d.ts +247 -0
- package/dist/registry.d.ts +6 -0
- package/dist/screen-logger.d.ts +9 -0
- package/dist/singleton.d.ts +42 -0
- package/dist/telemetry/browser-context-storage.d.ts +29 -0
- package/dist/telemetry/console-telemetry-provider.d.ts +12 -0
- package/dist/telemetry/context-storage.d.ts +19 -0
- package/dist/telemetry/debug-telemetry-provider.d.ts +12 -0
- package/dist/telemetry/detect-agent.d.ts +13 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.js +256 -0
- package/dist/telemetry/logger-telemetry-provider.d.ts +15 -0
- package/dist/telemetry/node-appinsights-telemetry-provider.d.ts +62 -0
- package/dist/telemetry/node-context-storage.d.ts +11 -0
- package/dist/telemetry/node.d.ts +7 -0
- package/dist/telemetry/pii-redactor.d.ts +32 -0
- package/dist/telemetry/telemetry-events.d.ts +3 -0
- package/dist/telemetry/telemetry-init.d.ts +53 -0
- package/dist/telemetry/telemetry-provider.d.ts +27 -0
- package/dist/telemetry/telemetry-service.d.ts +157 -0
- package/dist/tool-provider.d.ts +6 -0
- package/dist/trackedAction.d.ts +38 -0
- package/package.json +14 -6
package/dist/index.js
CHANGED
|
@@ -2126,20 +2126,17 @@ var require_commander = __commonJS((exports) => {
|
|
|
2126
2126
|
});
|
|
2127
2127
|
|
|
2128
2128
|
// src/catch-error.ts
|
|
2129
|
+
function isPromiseLike(value) {
|
|
2130
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
2131
|
+
}
|
|
2129
2132
|
function catchError(fnOrPromise) {
|
|
2130
|
-
if (fnOrPromise
|
|
2131
|
-
return fnOrPromise
|
|
2132
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
2133
|
-
undefined
|
|
2134
|
-
]);
|
|
2133
|
+
if (isPromiseLike(fnOrPromise)) {
|
|
2134
|
+
return settlePromiseLike(fnOrPromise);
|
|
2135
2135
|
}
|
|
2136
2136
|
try {
|
|
2137
2137
|
const result = fnOrPromise();
|
|
2138
|
-
if (result
|
|
2139
|
-
return result
|
|
2140
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
2141
|
-
undefined
|
|
2142
|
-
]);
|
|
2138
|
+
if (isPromiseLike(result)) {
|
|
2139
|
+
return settlePromiseLike(result);
|
|
2143
2140
|
}
|
|
2144
2141
|
return [undefined, result];
|
|
2145
2142
|
} catch (error) {
|
|
@@ -2149,6 +2146,12 @@ function catchError(fnOrPromise) {
|
|
|
2149
2146
|
];
|
|
2150
2147
|
}
|
|
2151
2148
|
}
|
|
2149
|
+
function settlePromiseLike(thenable) {
|
|
2150
|
+
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
|
|
2151
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
2152
|
+
undefined
|
|
2153
|
+
]);
|
|
2154
|
+
}
|
|
2152
2155
|
// ../../node_modules/commander/esm.mjs
|
|
2153
2156
|
var import__ = __toESM(require_commander(), 1);
|
|
2154
2157
|
var {
|
|
@@ -2165,6 +2168,15 @@ var {
|
|
|
2165
2168
|
Help
|
|
2166
2169
|
} = import__.default;
|
|
2167
2170
|
|
|
2171
|
+
// src/command-examples.ts
|
|
2172
|
+
var examplesByCommand = new WeakMap;
|
|
2173
|
+
function getCommandExamples(cmd) {
|
|
2174
|
+
return examplesByCommand.get(cmd) ?? [];
|
|
2175
|
+
}
|
|
2176
|
+
Command.prototype.examples = function(examples) {
|
|
2177
|
+
examplesByCommand.set(this, examples);
|
|
2178
|
+
return this;
|
|
2179
|
+
};
|
|
2168
2180
|
// src/command-walker.ts
|
|
2169
2181
|
function collectCommands(command, parentName, result) {
|
|
2170
2182
|
const subcommands = command.commands;
|
|
@@ -4136,6 +4148,10 @@ var TreeInterpreter = class _TreeInterpreter {
|
|
|
4136
4148
|
};
|
|
4137
4149
|
var TreeInterpreterInstance = new TreeInterpreter;
|
|
4138
4150
|
var TreeInterpreter_default = TreeInterpreterInstance;
|
|
4151
|
+
function compile(expression, options) {
|
|
4152
|
+
const nodeTree = Parser_default.parse(expression, options);
|
|
4153
|
+
return nodeTree;
|
|
4154
|
+
}
|
|
4139
4155
|
function search(data, expression, options) {
|
|
4140
4156
|
const nodeTree = Parser_default.parse(expression, options);
|
|
4141
4157
|
return TreeInterpreter_default.search(nodeTree, data);
|
|
@@ -6788,9 +6804,744 @@ var safeLoad = renamed("safeLoad", "load");
|
|
|
6788
6804
|
var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
6789
6805
|
var safeDump = renamed("safeDump", "dump");
|
|
6790
6806
|
|
|
6791
|
-
// src/
|
|
6792
|
-
import {
|
|
6793
|
-
import
|
|
6807
|
+
// ../filesystem/src/node.ts
|
|
6808
|
+
import { existsSync } from "node:fs";
|
|
6809
|
+
import * as fs6 from "node:fs/promises";
|
|
6810
|
+
import * as os2 from "node:os";
|
|
6811
|
+
import * as path2 from "node:path";
|
|
6812
|
+
|
|
6813
|
+
// ../../node_modules/open/index.js
|
|
6814
|
+
import process8 from "node:process";
|
|
6815
|
+
import path from "node:path";
|
|
6816
|
+
import { fileURLToPath } from "node:url";
|
|
6817
|
+
import childProcess3 from "node:child_process";
|
|
6818
|
+
import fs5, { constants as fsConstants2 } from "node:fs/promises";
|
|
6819
|
+
|
|
6820
|
+
// ../../node_modules/wsl-utils/index.js
|
|
6821
|
+
import { promisify as promisify2 } from "node:util";
|
|
6822
|
+
import childProcess2 from "node:child_process";
|
|
6823
|
+
import fs4, { constants as fsConstants } from "node:fs/promises";
|
|
6824
|
+
|
|
6825
|
+
// ../../node_modules/wsl-utils/node_modules/is-wsl/index.js
|
|
6826
|
+
import process2 from "node:process";
|
|
6827
|
+
import os from "node:os";
|
|
6828
|
+
import fs3 from "node:fs";
|
|
6829
|
+
|
|
6830
|
+
// ../../node_modules/is-inside-container/index.js
|
|
6831
|
+
import fs2 from "node:fs";
|
|
6832
|
+
|
|
6833
|
+
// ../../node_modules/is-inside-container/node_modules/is-docker/index.js
|
|
6834
|
+
import fs from "node:fs";
|
|
6835
|
+
var isDockerCached;
|
|
6836
|
+
function hasDockerEnv() {
|
|
6837
|
+
try {
|
|
6838
|
+
fs.statSync("/.dockerenv");
|
|
6839
|
+
return true;
|
|
6840
|
+
} catch {
|
|
6841
|
+
return false;
|
|
6842
|
+
}
|
|
6843
|
+
}
|
|
6844
|
+
function hasDockerCGroup() {
|
|
6845
|
+
try {
|
|
6846
|
+
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
6847
|
+
} catch {
|
|
6848
|
+
return false;
|
|
6849
|
+
}
|
|
6850
|
+
}
|
|
6851
|
+
function isDocker() {
|
|
6852
|
+
if (isDockerCached === undefined) {
|
|
6853
|
+
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
6854
|
+
}
|
|
6855
|
+
return isDockerCached;
|
|
6856
|
+
}
|
|
6857
|
+
|
|
6858
|
+
// ../../node_modules/is-inside-container/index.js
|
|
6859
|
+
var cachedResult;
|
|
6860
|
+
var hasContainerEnv = () => {
|
|
6861
|
+
try {
|
|
6862
|
+
fs2.statSync("/run/.containerenv");
|
|
6863
|
+
return true;
|
|
6864
|
+
} catch {
|
|
6865
|
+
return false;
|
|
6866
|
+
}
|
|
6867
|
+
};
|
|
6868
|
+
function isInsideContainer() {
|
|
6869
|
+
if (cachedResult === undefined) {
|
|
6870
|
+
cachedResult = hasContainerEnv() || isDocker();
|
|
6871
|
+
}
|
|
6872
|
+
return cachedResult;
|
|
6873
|
+
}
|
|
6874
|
+
|
|
6875
|
+
// ../../node_modules/wsl-utils/node_modules/is-wsl/index.js
|
|
6876
|
+
var isWsl = () => {
|
|
6877
|
+
if (process2.platform !== "linux") {
|
|
6878
|
+
return false;
|
|
6879
|
+
}
|
|
6880
|
+
if (os.release().toLowerCase().includes("microsoft")) {
|
|
6881
|
+
if (isInsideContainer()) {
|
|
6882
|
+
return false;
|
|
6883
|
+
}
|
|
6884
|
+
return true;
|
|
6885
|
+
}
|
|
6886
|
+
try {
|
|
6887
|
+
if (fs3.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) {
|
|
6888
|
+
return !isInsideContainer();
|
|
6889
|
+
}
|
|
6890
|
+
} catch {}
|
|
6891
|
+
if (fs3.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs3.existsSync("/run/WSL")) {
|
|
6892
|
+
return !isInsideContainer();
|
|
6893
|
+
}
|
|
6894
|
+
return false;
|
|
6895
|
+
};
|
|
6896
|
+
var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
6897
|
+
|
|
6898
|
+
// ../../node_modules/powershell-utils/index.js
|
|
6899
|
+
import process3 from "node:process";
|
|
6900
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
6901
|
+
import { promisify } from "node:util";
|
|
6902
|
+
import childProcess from "node:child_process";
|
|
6903
|
+
var execFile = promisify(childProcess.execFile);
|
|
6904
|
+
var powerShellPath = () => `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
6905
|
+
var executePowerShell = async (command, options = {}) => {
|
|
6906
|
+
const {
|
|
6907
|
+
powerShellPath: psPath,
|
|
6908
|
+
...execFileOptions
|
|
6909
|
+
} = options;
|
|
6910
|
+
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
6911
|
+
return execFile(psPath ?? powerShellPath(), [
|
|
6912
|
+
...executePowerShell.argumentsPrefix,
|
|
6913
|
+
encodedCommand
|
|
6914
|
+
], {
|
|
6915
|
+
encoding: "utf8",
|
|
6916
|
+
...execFileOptions
|
|
6917
|
+
});
|
|
6918
|
+
};
|
|
6919
|
+
executePowerShell.argumentsPrefix = [
|
|
6920
|
+
"-NoProfile",
|
|
6921
|
+
"-NonInteractive",
|
|
6922
|
+
"-ExecutionPolicy",
|
|
6923
|
+
"Bypass",
|
|
6924
|
+
"-EncodedCommand"
|
|
6925
|
+
];
|
|
6926
|
+
executePowerShell.encodeCommand = (command) => Buffer2.from(command, "utf16le").toString("base64");
|
|
6927
|
+
executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
|
|
6928
|
+
|
|
6929
|
+
// ../../node_modules/wsl-utils/utilities.js
|
|
6930
|
+
function parseMountPointFromConfig(content) {
|
|
6931
|
+
for (const line of content.split(`
|
|
6932
|
+
`)) {
|
|
6933
|
+
if (/^\s*#/.test(line)) {
|
|
6934
|
+
continue;
|
|
6935
|
+
}
|
|
6936
|
+
const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
|
|
6937
|
+
if (!match) {
|
|
6938
|
+
continue;
|
|
6939
|
+
}
|
|
6940
|
+
return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
|
|
6944
|
+
// ../../node_modules/wsl-utils/index.js
|
|
6945
|
+
var execFile2 = promisify2(childProcess2.execFile);
|
|
6946
|
+
var wslDrivesMountPoint = (() => {
|
|
6947
|
+
const defaultMountPoint = "/mnt/";
|
|
6948
|
+
let mountPoint;
|
|
6949
|
+
return async function() {
|
|
6950
|
+
if (mountPoint) {
|
|
6951
|
+
return mountPoint;
|
|
6952
|
+
}
|
|
6953
|
+
const configFilePath = "/etc/wsl.conf";
|
|
6954
|
+
let isConfigFileExists = false;
|
|
6955
|
+
try {
|
|
6956
|
+
await fs4.access(configFilePath, fsConstants.F_OK);
|
|
6957
|
+
isConfigFileExists = true;
|
|
6958
|
+
} catch {}
|
|
6959
|
+
if (!isConfigFileExists) {
|
|
6960
|
+
return defaultMountPoint;
|
|
6961
|
+
}
|
|
6962
|
+
const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
|
|
6963
|
+
const parsedMountPoint = parseMountPointFromConfig(configContent);
|
|
6964
|
+
if (parsedMountPoint === undefined) {
|
|
6965
|
+
return defaultMountPoint;
|
|
6966
|
+
}
|
|
6967
|
+
mountPoint = parsedMountPoint;
|
|
6968
|
+
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
6969
|
+
return mountPoint;
|
|
6970
|
+
};
|
|
6971
|
+
})();
|
|
6972
|
+
var powerShellPathFromWsl = async () => {
|
|
6973
|
+
const mountPoint = await wslDrivesMountPoint();
|
|
6974
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
6975
|
+
};
|
|
6976
|
+
var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
|
|
6977
|
+
var canAccessPowerShellPromise;
|
|
6978
|
+
var canAccessPowerShell = async () => {
|
|
6979
|
+
canAccessPowerShellPromise ??= (async () => {
|
|
6980
|
+
try {
|
|
6981
|
+
const psPath = await powerShellPath2();
|
|
6982
|
+
await fs4.access(psPath, fsConstants.X_OK);
|
|
6983
|
+
return true;
|
|
6984
|
+
} catch {
|
|
6985
|
+
return false;
|
|
6986
|
+
}
|
|
6987
|
+
})();
|
|
6988
|
+
return canAccessPowerShellPromise;
|
|
6989
|
+
};
|
|
6990
|
+
var wslDefaultBrowser = async () => {
|
|
6991
|
+
const psPath = await powerShellPath2();
|
|
6992
|
+
const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
6993
|
+
const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
|
|
6994
|
+
return stdout.trim();
|
|
6995
|
+
};
|
|
6996
|
+
var convertWslPathToWindows = async (path) => {
|
|
6997
|
+
if (/^[a-z]+:\/\//i.test(path)) {
|
|
6998
|
+
return path;
|
|
6999
|
+
}
|
|
7000
|
+
try {
|
|
7001
|
+
const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
|
|
7002
|
+
return stdout.trim();
|
|
7003
|
+
} catch {
|
|
7004
|
+
return path;
|
|
7005
|
+
}
|
|
7006
|
+
};
|
|
7007
|
+
|
|
7008
|
+
// ../../node_modules/define-lazy-prop/index.js
|
|
7009
|
+
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
7010
|
+
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
7011
|
+
Object.defineProperty(object, propertyName, {
|
|
7012
|
+
configurable: true,
|
|
7013
|
+
enumerable: true,
|
|
7014
|
+
get() {
|
|
7015
|
+
const result = valueGetter();
|
|
7016
|
+
define(result);
|
|
7017
|
+
return result;
|
|
7018
|
+
},
|
|
7019
|
+
set(value) {
|
|
7020
|
+
define(value);
|
|
7021
|
+
}
|
|
7022
|
+
});
|
|
7023
|
+
return object;
|
|
7024
|
+
}
|
|
7025
|
+
|
|
7026
|
+
// ../../node_modules/default-browser/index.js
|
|
7027
|
+
import { promisify as promisify6 } from "node:util";
|
|
7028
|
+
import process6 from "node:process";
|
|
7029
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
7030
|
+
|
|
7031
|
+
// ../../node_modules/default-browser-id/index.js
|
|
7032
|
+
import { promisify as promisify3 } from "node:util";
|
|
7033
|
+
import process4 from "node:process";
|
|
7034
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
7035
|
+
var execFileAsync = promisify3(execFile3);
|
|
7036
|
+
async function defaultBrowserId() {
|
|
7037
|
+
if (process4.platform !== "darwin") {
|
|
7038
|
+
throw new Error("macOS only");
|
|
7039
|
+
}
|
|
7040
|
+
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
7041
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
7042
|
+
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
7043
|
+
if (browserId === "com.apple.safari") {
|
|
7044
|
+
return "com.apple.Safari";
|
|
7045
|
+
}
|
|
7046
|
+
return browserId;
|
|
7047
|
+
}
|
|
7048
|
+
|
|
7049
|
+
// ../../node_modules/run-applescript/index.js
|
|
7050
|
+
import process5 from "node:process";
|
|
7051
|
+
import { promisify as promisify4 } from "node:util";
|
|
7052
|
+
import { execFile as execFile4, execFileSync } from "node:child_process";
|
|
7053
|
+
var execFileAsync2 = promisify4(execFile4);
|
|
7054
|
+
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
7055
|
+
if (process5.platform !== "darwin") {
|
|
7056
|
+
throw new Error("macOS only");
|
|
7057
|
+
}
|
|
7058
|
+
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
7059
|
+
const execOptions = {};
|
|
7060
|
+
if (signal) {
|
|
7061
|
+
execOptions.signal = signal;
|
|
7062
|
+
}
|
|
7063
|
+
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
7064
|
+
return stdout.trim();
|
|
7065
|
+
}
|
|
7066
|
+
|
|
7067
|
+
// ../../node_modules/bundle-name/index.js
|
|
7068
|
+
async function bundleName(bundleId) {
|
|
7069
|
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
7070
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
7071
|
+
}
|
|
7072
|
+
|
|
7073
|
+
// ../../node_modules/default-browser/windows.js
|
|
7074
|
+
import { promisify as promisify5 } from "node:util";
|
|
7075
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
7076
|
+
var execFileAsync3 = promisify5(execFile5);
|
|
7077
|
+
var windowsBrowserProgIds = {
|
|
7078
|
+
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
7079
|
+
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
7080
|
+
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
7081
|
+
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
7082
|
+
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
7083
|
+
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
7084
|
+
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
7085
|
+
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
7086
|
+
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
7087
|
+
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
7088
|
+
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
7089
|
+
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
7090
|
+
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
7091
|
+
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
7092
|
+
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
7093
|
+
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
7094
|
+
};
|
|
7095
|
+
var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
|
|
7096
|
+
|
|
7097
|
+
class UnknownBrowserError extends Error {
|
|
7098
|
+
}
|
|
7099
|
+
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
7100
|
+
const { stdout } = await _execFileAsync("reg", [
|
|
7101
|
+
"QUERY",
|
|
7102
|
+
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
7103
|
+
"/v",
|
|
7104
|
+
"ProgId"
|
|
7105
|
+
]);
|
|
7106
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
7107
|
+
if (!match) {
|
|
7108
|
+
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
7109
|
+
}
|
|
7110
|
+
const { id } = match.groups;
|
|
7111
|
+
const dotIndex = id.lastIndexOf(".");
|
|
7112
|
+
const hyphenIndex = id.lastIndexOf("-");
|
|
7113
|
+
const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
|
|
7114
|
+
const baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);
|
|
7115
|
+
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
7116
|
+
}
|
|
7117
|
+
|
|
7118
|
+
// ../../node_modules/default-browser/index.js
|
|
7119
|
+
var execFileAsync4 = promisify6(execFile6);
|
|
7120
|
+
var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
7121
|
+
async function defaultBrowser2() {
|
|
7122
|
+
if (process6.platform === "darwin") {
|
|
7123
|
+
const id = await defaultBrowserId();
|
|
7124
|
+
const name = await bundleName(id);
|
|
7125
|
+
return { name, id };
|
|
7126
|
+
}
|
|
7127
|
+
if (process6.platform === "linux") {
|
|
7128
|
+
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
7129
|
+
const id = stdout.trim();
|
|
7130
|
+
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
7131
|
+
return { name, id };
|
|
7132
|
+
}
|
|
7133
|
+
if (process6.platform === "win32") {
|
|
7134
|
+
return defaultBrowser();
|
|
7135
|
+
}
|
|
7136
|
+
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
7137
|
+
}
|
|
7138
|
+
|
|
7139
|
+
// ../../node_modules/is-in-ssh/index.js
|
|
7140
|
+
import process7 from "node:process";
|
|
7141
|
+
var isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
|
|
7142
|
+
var is_in_ssh_default = isInSsh;
|
|
7143
|
+
|
|
7144
|
+
// ../../node_modules/open/index.js
|
|
7145
|
+
var fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
7146
|
+
var __dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
7147
|
+
var localXdgOpenPath = path.join(__dirname2, "xdg-open");
|
|
7148
|
+
var { platform, arch } = process8;
|
|
7149
|
+
var tryEachApp = async (apps, opener) => {
|
|
7150
|
+
if (apps.length === 0) {
|
|
7151
|
+
return;
|
|
7152
|
+
}
|
|
7153
|
+
const errors = [];
|
|
7154
|
+
for (const app of apps) {
|
|
7155
|
+
try {
|
|
7156
|
+
return await opener(app);
|
|
7157
|
+
} catch (error) {
|
|
7158
|
+
errors.push(error);
|
|
7159
|
+
}
|
|
7160
|
+
}
|
|
7161
|
+
throw new AggregateError(errors, "Failed to open in all supported apps");
|
|
7162
|
+
};
|
|
7163
|
+
var baseOpen = async (options) => {
|
|
7164
|
+
options = {
|
|
7165
|
+
wait: false,
|
|
7166
|
+
background: false,
|
|
7167
|
+
newInstance: false,
|
|
7168
|
+
allowNonzeroExitCode: false,
|
|
7169
|
+
...options
|
|
7170
|
+
};
|
|
7171
|
+
const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
|
|
7172
|
+
delete options[fallbackAttemptSymbol];
|
|
7173
|
+
if (Array.isArray(options.app)) {
|
|
7174
|
+
return tryEachApp(options.app, (singleApp) => baseOpen({
|
|
7175
|
+
...options,
|
|
7176
|
+
app: singleApp,
|
|
7177
|
+
[fallbackAttemptSymbol]: true
|
|
7178
|
+
}));
|
|
7179
|
+
}
|
|
7180
|
+
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
7181
|
+
appArguments = [...appArguments];
|
|
7182
|
+
if (Array.isArray(app)) {
|
|
7183
|
+
return tryEachApp(app, (appName) => baseOpen({
|
|
7184
|
+
...options,
|
|
7185
|
+
app: {
|
|
7186
|
+
name: appName,
|
|
7187
|
+
arguments: appArguments
|
|
7188
|
+
},
|
|
7189
|
+
[fallbackAttemptSymbol]: true
|
|
7190
|
+
}));
|
|
7191
|
+
}
|
|
7192
|
+
if (app === "browser" || app === "browserPrivate") {
|
|
7193
|
+
const ids = {
|
|
7194
|
+
"com.google.chrome": "chrome",
|
|
7195
|
+
"google-chrome.desktop": "chrome",
|
|
7196
|
+
"com.brave.browser": "brave",
|
|
7197
|
+
"org.mozilla.firefox": "firefox",
|
|
7198
|
+
"firefox.desktop": "firefox",
|
|
7199
|
+
"com.microsoft.msedge": "edge",
|
|
7200
|
+
"com.microsoft.edge": "edge",
|
|
7201
|
+
"com.microsoft.edgemac": "edge",
|
|
7202
|
+
"microsoft-edge.desktop": "edge",
|
|
7203
|
+
"com.apple.safari": "safari"
|
|
7204
|
+
};
|
|
7205
|
+
const flags = {
|
|
7206
|
+
chrome: "--incognito",
|
|
7207
|
+
brave: "--incognito",
|
|
7208
|
+
firefox: "--private-window",
|
|
7209
|
+
edge: "--inPrivate"
|
|
7210
|
+
};
|
|
7211
|
+
let browser;
|
|
7212
|
+
if (is_wsl_default) {
|
|
7213
|
+
const progId = await wslDefaultBrowser();
|
|
7214
|
+
const browserInfo = _windowsBrowserProgIdMap.get(progId);
|
|
7215
|
+
browser = browserInfo ?? {};
|
|
7216
|
+
} else {
|
|
7217
|
+
browser = await defaultBrowser2();
|
|
7218
|
+
}
|
|
7219
|
+
if (browser.id in ids) {
|
|
7220
|
+
const browserName = ids[browser.id.toLowerCase()];
|
|
7221
|
+
if (app === "browserPrivate") {
|
|
7222
|
+
if (browserName === "safari") {
|
|
7223
|
+
throw new Error("Safari doesn't support opening in private mode via command line");
|
|
7224
|
+
}
|
|
7225
|
+
appArguments.push(flags[browserName]);
|
|
7226
|
+
}
|
|
7227
|
+
return baseOpen({
|
|
7228
|
+
...options,
|
|
7229
|
+
app: {
|
|
7230
|
+
name: apps[browserName],
|
|
7231
|
+
arguments: appArguments
|
|
7232
|
+
}
|
|
7233
|
+
});
|
|
7234
|
+
}
|
|
7235
|
+
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
7236
|
+
}
|
|
7237
|
+
let command;
|
|
7238
|
+
const cliArguments = [];
|
|
7239
|
+
const childProcessOptions = {};
|
|
7240
|
+
let shouldUseWindowsInWsl = false;
|
|
7241
|
+
if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
|
|
7242
|
+
shouldUseWindowsInWsl = await canAccessPowerShell();
|
|
7243
|
+
}
|
|
7244
|
+
if (platform === "darwin") {
|
|
7245
|
+
command = "open";
|
|
7246
|
+
if (options.wait) {
|
|
7247
|
+
cliArguments.push("--wait-apps");
|
|
7248
|
+
}
|
|
7249
|
+
if (options.background) {
|
|
7250
|
+
cliArguments.push("--background");
|
|
7251
|
+
}
|
|
7252
|
+
if (options.newInstance) {
|
|
7253
|
+
cliArguments.push("--new");
|
|
7254
|
+
}
|
|
7255
|
+
if (app) {
|
|
7256
|
+
cliArguments.push("-a", app);
|
|
7257
|
+
}
|
|
7258
|
+
} else if (platform === "win32" || shouldUseWindowsInWsl) {
|
|
7259
|
+
command = await powerShellPath2();
|
|
7260
|
+
cliArguments.push(...executePowerShell.argumentsPrefix);
|
|
7261
|
+
if (!is_wsl_default) {
|
|
7262
|
+
childProcessOptions.windowsVerbatimArguments = true;
|
|
7263
|
+
}
|
|
7264
|
+
if (is_wsl_default && options.target) {
|
|
7265
|
+
options.target = await convertWslPathToWindows(options.target);
|
|
7266
|
+
}
|
|
7267
|
+
const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
|
|
7268
|
+
if (options.wait) {
|
|
7269
|
+
encodedArguments.push("-Wait");
|
|
7270
|
+
}
|
|
7271
|
+
if (app) {
|
|
7272
|
+
encodedArguments.push(executePowerShell.escapeArgument(app));
|
|
7273
|
+
if (options.target) {
|
|
7274
|
+
appArguments.push(options.target);
|
|
7275
|
+
}
|
|
7276
|
+
} else if (options.target) {
|
|
7277
|
+
encodedArguments.push(executePowerShell.escapeArgument(options.target));
|
|
7278
|
+
}
|
|
7279
|
+
if (appArguments.length > 0) {
|
|
7280
|
+
appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
|
|
7281
|
+
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
7282
|
+
}
|
|
7283
|
+
options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
|
|
7284
|
+
if (!options.wait) {
|
|
7285
|
+
childProcessOptions.stdio = "ignore";
|
|
7286
|
+
}
|
|
7287
|
+
} else {
|
|
7288
|
+
if (app) {
|
|
7289
|
+
command = app;
|
|
7290
|
+
} else {
|
|
7291
|
+
const isBundled = !__dirname2 || __dirname2 === "/";
|
|
7292
|
+
let exeLocalXdgOpen = false;
|
|
7293
|
+
try {
|
|
7294
|
+
await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
|
|
7295
|
+
exeLocalXdgOpen = true;
|
|
7296
|
+
} catch {}
|
|
7297
|
+
const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
7298
|
+
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
7299
|
+
}
|
|
7300
|
+
if (appArguments.length > 0) {
|
|
7301
|
+
cliArguments.push(...appArguments);
|
|
7302
|
+
}
|
|
7303
|
+
if (!options.wait) {
|
|
7304
|
+
childProcessOptions.stdio = "ignore";
|
|
7305
|
+
childProcessOptions.detached = true;
|
|
7306
|
+
}
|
|
7307
|
+
}
|
|
7308
|
+
if (platform === "darwin" && appArguments.length > 0) {
|
|
7309
|
+
cliArguments.push("--args", ...appArguments);
|
|
7310
|
+
}
|
|
7311
|
+
if (options.target) {
|
|
7312
|
+
cliArguments.push(options.target);
|
|
7313
|
+
}
|
|
7314
|
+
const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
|
|
7315
|
+
if (options.wait) {
|
|
7316
|
+
return new Promise((resolve, reject) => {
|
|
7317
|
+
subprocess.once("error", reject);
|
|
7318
|
+
subprocess.once("close", (exitCode) => {
|
|
7319
|
+
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
7320
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
7321
|
+
return;
|
|
7322
|
+
}
|
|
7323
|
+
resolve(subprocess);
|
|
7324
|
+
});
|
|
7325
|
+
});
|
|
7326
|
+
}
|
|
7327
|
+
if (isFallbackAttempt) {
|
|
7328
|
+
return new Promise((resolve, reject) => {
|
|
7329
|
+
subprocess.once("error", reject);
|
|
7330
|
+
subprocess.once("spawn", () => {
|
|
7331
|
+
subprocess.once("close", (exitCode) => {
|
|
7332
|
+
subprocess.off("error", reject);
|
|
7333
|
+
if (exitCode !== 0) {
|
|
7334
|
+
reject(new Error(`Exited with code ${exitCode}`));
|
|
7335
|
+
return;
|
|
7336
|
+
}
|
|
7337
|
+
subprocess.unref();
|
|
7338
|
+
resolve(subprocess);
|
|
7339
|
+
});
|
|
7340
|
+
});
|
|
7341
|
+
});
|
|
7342
|
+
}
|
|
7343
|
+
subprocess.unref();
|
|
7344
|
+
return new Promise((resolve, reject) => {
|
|
7345
|
+
subprocess.once("error", reject);
|
|
7346
|
+
subprocess.once("spawn", () => {
|
|
7347
|
+
subprocess.off("error", reject);
|
|
7348
|
+
resolve(subprocess);
|
|
7349
|
+
});
|
|
7350
|
+
});
|
|
7351
|
+
};
|
|
7352
|
+
var open = (target, options) => {
|
|
7353
|
+
if (typeof target !== "string") {
|
|
7354
|
+
throw new TypeError("Expected a `target`");
|
|
7355
|
+
}
|
|
7356
|
+
return baseOpen({
|
|
7357
|
+
...options,
|
|
7358
|
+
target
|
|
7359
|
+
});
|
|
7360
|
+
};
|
|
7361
|
+
function detectArchBinary(binary2) {
|
|
7362
|
+
if (typeof binary2 === "string" || Array.isArray(binary2)) {
|
|
7363
|
+
return binary2;
|
|
7364
|
+
}
|
|
7365
|
+
const { [arch]: archBinary } = binary2;
|
|
7366
|
+
if (!archBinary) {
|
|
7367
|
+
throw new Error(`${arch} is not supported`);
|
|
7368
|
+
}
|
|
7369
|
+
return archBinary;
|
|
7370
|
+
}
|
|
7371
|
+
function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
|
|
7372
|
+
if (wsl && is_wsl_default) {
|
|
7373
|
+
return detectArchBinary(wsl);
|
|
7374
|
+
}
|
|
7375
|
+
if (!platformBinary) {
|
|
7376
|
+
throw new Error(`${platform} is not supported`);
|
|
7377
|
+
}
|
|
7378
|
+
return detectArchBinary(platformBinary);
|
|
7379
|
+
}
|
|
7380
|
+
var apps = {
|
|
7381
|
+
browser: "browser",
|
|
7382
|
+
browserPrivate: "browserPrivate"
|
|
7383
|
+
};
|
|
7384
|
+
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
7385
|
+
darwin: "google chrome",
|
|
7386
|
+
win32: "chrome",
|
|
7387
|
+
linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
|
|
7388
|
+
}, {
|
|
7389
|
+
wsl: {
|
|
7390
|
+
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
7391
|
+
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
7392
|
+
}
|
|
7393
|
+
}));
|
|
7394
|
+
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
7395
|
+
darwin: "brave browser",
|
|
7396
|
+
win32: "brave",
|
|
7397
|
+
linux: ["brave-browser", "brave"]
|
|
7398
|
+
}, {
|
|
7399
|
+
wsl: {
|
|
7400
|
+
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
7401
|
+
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
7402
|
+
}
|
|
7403
|
+
}));
|
|
7404
|
+
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
7405
|
+
darwin: "firefox",
|
|
7406
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
7407
|
+
linux: "firefox"
|
|
7408
|
+
}, {
|
|
7409
|
+
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
7410
|
+
}));
|
|
7411
|
+
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
7412
|
+
darwin: "microsoft edge",
|
|
7413
|
+
win32: "msedge",
|
|
7414
|
+
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
7415
|
+
}, {
|
|
7416
|
+
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
7417
|
+
}));
|
|
7418
|
+
defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
7419
|
+
darwin: "Safari"
|
|
7420
|
+
}));
|
|
7421
|
+
var open_default = open;
|
|
7422
|
+
|
|
7423
|
+
// ../filesystem/src/node.ts
|
|
7424
|
+
class NodeFileSystem {
|
|
7425
|
+
path = {
|
|
7426
|
+
join: path2.join,
|
|
7427
|
+
resolve: path2.resolve,
|
|
7428
|
+
relative: path2.relative,
|
|
7429
|
+
dirname: path2.dirname,
|
|
7430
|
+
isAbsolute: path2.isAbsolute,
|
|
7431
|
+
basename: path2.basename
|
|
7432
|
+
};
|
|
7433
|
+
env = {
|
|
7434
|
+
cwd: process.cwd,
|
|
7435
|
+
homedir: os2.homedir,
|
|
7436
|
+
tmpdir: os2.tmpdir,
|
|
7437
|
+
getenv: (key) => process.env[key]
|
|
7438
|
+
};
|
|
7439
|
+
utils = {
|
|
7440
|
+
open: async (url) => {
|
|
7441
|
+
await open_default(url);
|
|
7442
|
+
}
|
|
7443
|
+
};
|
|
7444
|
+
async readFile(path3, options) {
|
|
7445
|
+
try {
|
|
7446
|
+
if (options) {
|
|
7447
|
+
return await fs6.readFile(path3, "utf-8");
|
|
7448
|
+
}
|
|
7449
|
+
return await fs6.readFile(path3);
|
|
7450
|
+
} catch (error) {
|
|
7451
|
+
if (this.isEnoent(error))
|
|
7452
|
+
return null;
|
|
7453
|
+
throw error;
|
|
7454
|
+
}
|
|
7455
|
+
}
|
|
7456
|
+
async writeFile(filePath, data) {
|
|
7457
|
+
const dir = path2.dirname(filePath);
|
|
7458
|
+
if (dir) {
|
|
7459
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
7460
|
+
}
|
|
7461
|
+
await fs6.writeFile(filePath, data);
|
|
7462
|
+
}
|
|
7463
|
+
async appendFile(filePath, data) {
|
|
7464
|
+
const dir = path2.dirname(filePath);
|
|
7465
|
+
if (dir) {
|
|
7466
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
7467
|
+
}
|
|
7468
|
+
await fs6.appendFile(filePath, data);
|
|
7469
|
+
}
|
|
7470
|
+
async readdir(dirPath) {
|
|
7471
|
+
try {
|
|
7472
|
+
return await fs6.readdir(dirPath);
|
|
7473
|
+
} catch (error) {
|
|
7474
|
+
if (this.isEnoent(error))
|
|
7475
|
+
return [];
|
|
7476
|
+
throw error;
|
|
7477
|
+
}
|
|
7478
|
+
}
|
|
7479
|
+
async stat(filePath) {
|
|
7480
|
+
try {
|
|
7481
|
+
const stats = await fs6.stat(filePath);
|
|
7482
|
+
return {
|
|
7483
|
+
isFile: () => stats.isFile(),
|
|
7484
|
+
isDirectory: () => stats.isDirectory(),
|
|
7485
|
+
size: stats.size,
|
|
7486
|
+
mtimeMs: stats.mtimeMs
|
|
7487
|
+
};
|
|
7488
|
+
} catch (error) {
|
|
7489
|
+
if (this.isEnoent(error))
|
|
7490
|
+
return null;
|
|
7491
|
+
throw error;
|
|
7492
|
+
}
|
|
7493
|
+
}
|
|
7494
|
+
async exists(filePath) {
|
|
7495
|
+
return existsSync(filePath);
|
|
7496
|
+
}
|
|
7497
|
+
async mkdir(dirPath) {
|
|
7498
|
+
await fs6.mkdir(dirPath, { recursive: true });
|
|
7499
|
+
}
|
|
7500
|
+
async rm(filePath) {
|
|
7501
|
+
await fs6.rm(filePath, { recursive: true, force: true });
|
|
7502
|
+
}
|
|
7503
|
+
async rename(oldPath, newPath) {
|
|
7504
|
+
await fs6.rename(oldPath, newPath);
|
|
7505
|
+
}
|
|
7506
|
+
async getTempDir() {
|
|
7507
|
+
return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
|
|
7508
|
+
}
|
|
7509
|
+
async copyDirectory(sourcePath, destPath) {
|
|
7510
|
+
const sourceStats = await this.stat(sourcePath);
|
|
7511
|
+
if (!sourceStats) {
|
|
7512
|
+
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
7513
|
+
}
|
|
7514
|
+
if (!sourceStats.isDirectory()) {
|
|
7515
|
+
throw new Error(`Source path is not a directory: ${sourcePath}`);
|
|
7516
|
+
}
|
|
7517
|
+
await this.mkdir(destPath);
|
|
7518
|
+
const entries = await this.readdir(sourcePath);
|
|
7519
|
+
for (const entry of entries) {
|
|
7520
|
+
const srcEntry = path2.join(sourcePath, entry);
|
|
7521
|
+
const destEntry = path2.join(destPath, entry);
|
|
7522
|
+
const entryStats = await this.stat(srcEntry);
|
|
7523
|
+
if (!entryStats)
|
|
7524
|
+
continue;
|
|
7525
|
+
if (entryStats.isDirectory()) {
|
|
7526
|
+
await this.copyDirectory(srcEntry, destEntry);
|
|
7527
|
+
} else if (entryStats.isFile()) {
|
|
7528
|
+
const content = await this.readFile(srcEntry);
|
|
7529
|
+
if (content !== null) {
|
|
7530
|
+
await this.writeFile(destEntry, content);
|
|
7531
|
+
}
|
|
7532
|
+
}
|
|
7533
|
+
}
|
|
7534
|
+
}
|
|
7535
|
+
isEnoent(error) {
|
|
7536
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
7537
|
+
}
|
|
7538
|
+
}
|
|
7539
|
+
|
|
7540
|
+
// ../filesystem/src/index.ts
|
|
7541
|
+
var fsInstance = new NodeFileSystem;
|
|
7542
|
+
var getFileSystem = () => {
|
|
7543
|
+
return fsInstance;
|
|
7544
|
+
};
|
|
6794
7545
|
|
|
6795
7546
|
// src/singleton.ts
|
|
6796
7547
|
var PREFIX = "@uipath/common/";
|
|
@@ -6825,7 +7576,7 @@ function singleton(ctorOrName) {
|
|
|
6825
7576
|
// src/output-context.ts
|
|
6826
7577
|
function createStorage() {
|
|
6827
7578
|
const [error, mod2] = catchError(() => __require("node:async_hooks"));
|
|
6828
|
-
if (error) {
|
|
7579
|
+
if (error || typeof mod2?.AsyncLocalStorage !== "function") {
|
|
6829
7580
|
return {
|
|
6830
7581
|
getStore: () => {
|
|
6831
7582
|
return;
|
|
@@ -6860,8 +7611,8 @@ function setGlobalSink(sink) {
|
|
|
6860
7611
|
|
|
6861
7612
|
// src/logger.ts
|
|
6862
7613
|
var logFilePathSlot = singleton("logFilePath");
|
|
6863
|
-
function setGlobalLogFilePath(
|
|
6864
|
-
logFilePathSlot.set(
|
|
7614
|
+
function setGlobalLogFilePath(path3) {
|
|
7615
|
+
logFilePathSlot.set(path3);
|
|
6865
7616
|
}
|
|
6866
7617
|
function getGlobalLogFilePath() {
|
|
6867
7618
|
return logFilePathSlot.get("");
|
|
@@ -6880,6 +7631,8 @@ class SimpleLogger {
|
|
|
6880
7631
|
level;
|
|
6881
7632
|
logFilePath;
|
|
6882
7633
|
fileLoggingEnabled;
|
|
7634
|
+
pendingWrites = Promise.resolve();
|
|
7635
|
+
pendingInit = Promise.resolve();
|
|
6883
7636
|
constructor() {
|
|
6884
7637
|
this.level = SimpleLogger.resolveLevel();
|
|
6885
7638
|
this.logFilePath = "";
|
|
@@ -6894,7 +7647,7 @@ class SimpleLogger {
|
|
|
6894
7647
|
static isNode = typeof process !== "undefined" && !!process.versions?.node;
|
|
6895
7648
|
static resolveLevel() {
|
|
6896
7649
|
if (SimpleLogger.isNode) {
|
|
6897
|
-
const explicitLevel = SimpleLogger.parseLevel(process.env?.
|
|
7650
|
+
const explicitLevel = SimpleLogger.parseLevel(process.env?.UIP_LOG_LEVEL ?? "");
|
|
6898
7651
|
if (explicitLevel !== undefined)
|
|
6899
7652
|
return explicitLevel;
|
|
6900
7653
|
const debugVal = process.env?.DEBUG;
|
|
@@ -6934,11 +7687,14 @@ class SimpleLogger {
|
|
|
6934
7687
|
return this.fileLoggingEnabled || !!getGlobalLogFilePath();
|
|
6935
7688
|
}
|
|
6936
7689
|
writeToFile(formatted) {
|
|
6937
|
-
const
|
|
6938
|
-
if (!
|
|
7690
|
+
const path3 = this.logFilePath || getGlobalLogFilePath();
|
|
7691
|
+
if (!path3)
|
|
6939
7692
|
return;
|
|
6940
7693
|
const timestamp2 = new Date().toISOString();
|
|
6941
|
-
|
|
7694
|
+
this.pendingWrites = Promise.all([
|
|
7695
|
+
this.pendingWrites,
|
|
7696
|
+
this.pendingInit
|
|
7697
|
+
]).then(() => getFileSystem().appendFile(path3, `${timestamp2} ${formatted}`).catch(() => {}));
|
|
6942
7698
|
}
|
|
6943
7699
|
debug(message, ...args) {
|
|
6944
7700
|
if (this.level > 0 /* DEBUG */)
|
|
@@ -6993,16 +7749,25 @@ class SimpleLogger {
|
|
|
6993
7749
|
setGlobalLogFilePath("");
|
|
6994
7750
|
}
|
|
6995
7751
|
}
|
|
6996
|
-
setLogFile(
|
|
6997
|
-
this.logFilePath =
|
|
6998
|
-
setGlobalLogFilePath(
|
|
6999
|
-
if (!
|
|
7752
|
+
setLogFile(path3) {
|
|
7753
|
+
this.logFilePath = path3;
|
|
7754
|
+
setGlobalLogFilePath(path3);
|
|
7755
|
+
if (!path3)
|
|
7000
7756
|
return;
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7757
|
+
this.fileLoggingEnabled = true;
|
|
7758
|
+
const fs7 = getFileSystem();
|
|
7759
|
+
this.pendingInit = (async () => {
|
|
7760
|
+
const [error] = await catchError((async () => {
|
|
7761
|
+
await fs7.mkdir(fs7.path.dirname(path3));
|
|
7762
|
+
await fs7.writeFile(path3, "");
|
|
7763
|
+
})());
|
|
7764
|
+
if (error)
|
|
7765
|
+
this.fileLoggingEnabled = false;
|
|
7766
|
+
})();
|
|
7767
|
+
}
|
|
7768
|
+
async flushFile() {
|
|
7769
|
+
await this.pendingInit;
|
|
7770
|
+
await this.pendingWrites;
|
|
7006
7771
|
}
|
|
7007
7772
|
getLogFilePath() {
|
|
7008
7773
|
return this.logFilePath || getGlobalLogFilePath();
|
|
@@ -7063,7 +7828,7 @@ function setOutputFormat(format) {
|
|
|
7063
7828
|
formatSlot.set(format);
|
|
7064
7829
|
}
|
|
7065
7830
|
function getOutputFormat() {
|
|
7066
|
-
return formatSlot.get("
|
|
7831
|
+
return formatSlot.get("json");
|
|
7067
7832
|
}
|
|
7068
7833
|
function setOutputFilter(filter) {
|
|
7069
7834
|
filterSlot.set(filter);
|
|
@@ -7071,7 +7836,122 @@ function setOutputFilter(filter) {
|
|
|
7071
7836
|
function getOutputFilter() {
|
|
7072
7837
|
return filterSlot.get();
|
|
7073
7838
|
}
|
|
7074
|
-
|
|
7839
|
+
|
|
7840
|
+
// src/telemetry/telemetry-events.ts
|
|
7841
|
+
var CommonTelemetryEvents = {
|
|
7842
|
+
Error: "uip.error"
|
|
7843
|
+
};
|
|
7844
|
+
|
|
7845
|
+
// src/registry.ts
|
|
7846
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
7847
|
+
function readRegistryValue(keyPath, valueName) {
|
|
7848
|
+
if (process.platform !== "win32") {
|
|
7849
|
+
return "";
|
|
7850
|
+
}
|
|
7851
|
+
const [error, output] = catchError(() => execFileSync2("reg", ["query", keyPath, "/v", valueName], {
|
|
7852
|
+
encoding: "utf-8",
|
|
7853
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
7854
|
+
}));
|
|
7855
|
+
if (error) {
|
|
7856
|
+
return "";
|
|
7857
|
+
}
|
|
7858
|
+
const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
|
|
7859
|
+
return match?.[1]?.trim() ?? "";
|
|
7860
|
+
}
|
|
7861
|
+
|
|
7862
|
+
// src/telemetry/logger-telemetry-provider.ts
|
|
7863
|
+
class LoggerTelemetryProvider {
|
|
7864
|
+
analyticsUniqueId;
|
|
7865
|
+
constructor() {
|
|
7866
|
+
this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
|
|
7867
|
+
}
|
|
7868
|
+
enrich(properties) {
|
|
7869
|
+
return {
|
|
7870
|
+
...properties,
|
|
7871
|
+
...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
|
|
7872
|
+
};
|
|
7873
|
+
}
|
|
7874
|
+
async trackEvent(eventName, properties) {
|
|
7875
|
+
logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
|
|
7876
|
+
}
|
|
7877
|
+
async trackException(error, properties) {
|
|
7878
|
+
logger.error(formatMessage("Exception", error.message, this.enrich({
|
|
7879
|
+
...properties,
|
|
7880
|
+
stack: error.stack
|
|
7881
|
+
})));
|
|
7882
|
+
}
|
|
7883
|
+
async trackRequest(name, duration, success, properties) {
|
|
7884
|
+
logger.debug(formatMessage("Request", name, this.enrich({
|
|
7885
|
+
...properties,
|
|
7886
|
+
duration: `${duration}ms`,
|
|
7887
|
+
success
|
|
7888
|
+
})));
|
|
7889
|
+
}
|
|
7890
|
+
async trackDependency(name, type2, duration, success, properties) {
|
|
7891
|
+
logger.debug(formatMessage("Dependency", name, this.enrich({
|
|
7892
|
+
...properties,
|
|
7893
|
+
type: type2,
|
|
7894
|
+
duration: `${duration}ms`,
|
|
7895
|
+
success
|
|
7896
|
+
})));
|
|
7897
|
+
}
|
|
7898
|
+
}
|
|
7899
|
+
function formatMessage(category, name, properties) {
|
|
7900
|
+
let message = `[Telemetry] [${category}] ${name}`;
|
|
7901
|
+
if (properties && Object.keys(properties).length > 0) {
|
|
7902
|
+
const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
7903
|
+
if (propsStr) {
|
|
7904
|
+
message += ` | ${propsStr}`;
|
|
7905
|
+
}
|
|
7906
|
+
}
|
|
7907
|
+
return message;
|
|
7908
|
+
}
|
|
7909
|
+
|
|
7910
|
+
// src/telemetry/debug-telemetry-provider.ts
|
|
7911
|
+
class DebugTelemetryProvider {
|
|
7912
|
+
async trackEvent(eventName, _properties) {
|
|
7913
|
+
logger.debug(`[Telemetry] Event: ${eventName}`);
|
|
7914
|
+
}
|
|
7915
|
+
async trackException(error, _properties) {
|
|
7916
|
+
logger.error(`[Telemetry] Exception: ${error.message}`);
|
|
7917
|
+
}
|
|
7918
|
+
async trackRequest(name, duration, success, _properties) {
|
|
7919
|
+
logger.debug(`[Telemetry] Request: ${name} (${duration}ms, ${success ? "ok" : "fail"})`);
|
|
7920
|
+
}
|
|
7921
|
+
async trackDependency(name, type2, duration, success, _properties) {
|
|
7922
|
+
logger.debug(`[Telemetry] Dependency: ${name} [${type2}] (${duration}ms, ${success ? "ok" : "fail"})`);
|
|
7923
|
+
}
|
|
7924
|
+
}
|
|
7925
|
+
// src/telemetry/detect-agent.ts
|
|
7926
|
+
var KNOWN_AGENTS = [
|
|
7927
|
+
{ envVar: "CLAUDECODE", value: "1", id: "claude-code" },
|
|
7928
|
+
{ envVar: "CURSOR_AGENT", value: "1", id: "cursor" },
|
|
7929
|
+
{ envVar: "GEMINI_CLI", value: "1", id: "gemini-cli" },
|
|
7930
|
+
{ envVar: "CODEX_SANDBOX", id: "codex" },
|
|
7931
|
+
{ envVar: "AUGMENT_AGENT", value: "1", id: "augment" },
|
|
7932
|
+
{ envVar: "CLINE_ACTIVE", value: "true", id: "cline" }
|
|
7933
|
+
];
|
|
7934
|
+
function detectAgent() {
|
|
7935
|
+
for (const agent of KNOWN_AGENTS) {
|
|
7936
|
+
const envValue = process.env[agent.envVar];
|
|
7937
|
+
if (agent.value !== undefined) {
|
|
7938
|
+
if (envValue === agent.value)
|
|
7939
|
+
return agent.id;
|
|
7940
|
+
} else {
|
|
7941
|
+
if (envValue)
|
|
7942
|
+
return agent.id;
|
|
7943
|
+
}
|
|
7944
|
+
}
|
|
7945
|
+
const agentEnv = process.env.AGENT;
|
|
7946
|
+
if (agentEnv) {
|
|
7947
|
+
if (agentEnv === "1" || agentEnv === "true")
|
|
7948
|
+
return "unknown";
|
|
7949
|
+
if (agentEnv.length <= 32)
|
|
7950
|
+
return agentEnv.toLowerCase();
|
|
7951
|
+
}
|
|
7952
|
+
return;
|
|
7953
|
+
}
|
|
7954
|
+
// src/telemetry/node-context-storage.ts
|
|
7075
7955
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7076
7956
|
|
|
7077
7957
|
class NodeContextStorage {
|
|
@@ -7083,7 +7963,7 @@ class NodeContextStorage {
|
|
|
7083
7963
|
return this.storage.getStore();
|
|
7084
7964
|
}
|
|
7085
7965
|
}
|
|
7086
|
-
//
|
|
7966
|
+
// src/telemetry/telemetry-service.ts
|
|
7087
7967
|
class TelemetryService {
|
|
7088
7968
|
telemetryProvider;
|
|
7089
7969
|
contextStorage;
|
|
@@ -7171,72 +8051,7 @@ class TelemetryService {
|
|
|
7171
8051
|
return crypto.randomUUID().replaceAll("-", "");
|
|
7172
8052
|
}
|
|
7173
8053
|
}
|
|
7174
|
-
// src/
|
|
7175
|
-
import { execFileSync } from "node:child_process";
|
|
7176
|
-
function readRegistryValue(keyPath, valueName) {
|
|
7177
|
-
if (process.platform !== "win32") {
|
|
7178
|
-
return "";
|
|
7179
|
-
}
|
|
7180
|
-
const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
|
|
7181
|
-
encoding: "utf-8",
|
|
7182
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
7183
|
-
}));
|
|
7184
|
-
if (error) {
|
|
7185
|
-
return "";
|
|
7186
|
-
}
|
|
7187
|
-
const match = output.match(new RegExp(`${valueName}\\s+REG_SZ\\s+(.+)`));
|
|
7188
|
-
return match?.[1]?.trim() ?? "";
|
|
7189
|
-
}
|
|
7190
|
-
|
|
7191
|
-
// src/logger-telemetry-provider.ts
|
|
7192
|
-
class LoggerTelemetryProvider {
|
|
7193
|
-
analyticsUniqueId;
|
|
7194
|
-
constructor() {
|
|
7195
|
-
this.analyticsUniqueId = readRegistryValue("HKCU\\Software\\UiPath", "AnalyticsUniqueId");
|
|
7196
|
-
}
|
|
7197
|
-
enrich(properties) {
|
|
7198
|
-
return {
|
|
7199
|
-
...properties,
|
|
7200
|
-
...this.analyticsUniqueId ? { analyticsUniqueId: this.analyticsUniqueId } : {}
|
|
7201
|
-
};
|
|
7202
|
-
}
|
|
7203
|
-
async trackEvent(eventName, properties) {
|
|
7204
|
-
logger.debug(formatMessage("Event", eventName, this.enrich(properties)));
|
|
7205
|
-
}
|
|
7206
|
-
async trackException(error, properties) {
|
|
7207
|
-
logger.error(formatMessage("Exception", error.message, this.enrich({
|
|
7208
|
-
...properties,
|
|
7209
|
-
stack: error.stack
|
|
7210
|
-
})));
|
|
7211
|
-
}
|
|
7212
|
-
async trackRequest(name, duration, success, properties) {
|
|
7213
|
-
logger.debug(formatMessage("Request", name, this.enrich({
|
|
7214
|
-
...properties,
|
|
7215
|
-
duration: `${duration}ms`,
|
|
7216
|
-
success
|
|
7217
|
-
})));
|
|
7218
|
-
}
|
|
7219
|
-
async trackDependency(name, type2, duration, success, properties) {
|
|
7220
|
-
logger.debug(formatMessage("Dependency", name, this.enrich({
|
|
7221
|
-
...properties,
|
|
7222
|
-
type: type2,
|
|
7223
|
-
duration: `${duration}ms`,
|
|
7224
|
-
success
|
|
7225
|
-
})));
|
|
7226
|
-
}
|
|
7227
|
-
}
|
|
7228
|
-
function formatMessage(category, name, properties) {
|
|
7229
|
-
let message = `[Telemetry] [${category}] ${name}`;
|
|
7230
|
-
if (properties && Object.keys(properties).length > 0) {
|
|
7231
|
-
const propsStr = Object.entries(properties).filter(([_, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
7232
|
-
if (propsStr) {
|
|
7233
|
-
message += ` | ${propsStr}`;
|
|
7234
|
-
}
|
|
7235
|
-
}
|
|
7236
|
-
return message;
|
|
7237
|
-
}
|
|
7238
|
-
|
|
7239
|
-
// src/node-appinsights-telemetry-provider.ts
|
|
8054
|
+
// src/telemetry/node-appinsights-telemetry-provider.ts
|
|
7240
8055
|
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
7241
8056
|
var providerSlot = singleton("TelemetryProvider");
|
|
7242
8057
|
function setGlobalTelemetryProperties(properties) {
|
|
@@ -7246,9 +8061,18 @@ function setGlobalTelemetryProperties(properties) {
|
|
|
7246
8061
|
function getGlobalTelemetryProperties() {
|
|
7247
8062
|
return telemetryPropsSlot.get();
|
|
7248
8063
|
}
|
|
8064
|
+
function toOperationUrn(name) {
|
|
8065
|
+
if (URL.canParse(name))
|
|
8066
|
+
return name;
|
|
8067
|
+
const sanitized = encodeURIComponent(name).replace(/%2F/g, "/");
|
|
8068
|
+
return `urn:uip:${sanitized}`;
|
|
8069
|
+
}
|
|
7249
8070
|
async function loadApplicationInsights() {
|
|
7250
8071
|
const savedDebug = process.env.DEBUG;
|
|
7251
8072
|
delete process.env.DEBUG;
|
|
8073
|
+
if (process.env.APPLICATION_INSIGHTS_DISABLE_WARNING_LOGS === undefined) {
|
|
8074
|
+
process.env.APPLICATION_INSIGHTS_DISABLE_WARNING_LOGS = "1";
|
|
8075
|
+
}
|
|
7252
8076
|
const [error, mod2] = await catchError(import("applicationinsights"));
|
|
7253
8077
|
if (savedDebug !== undefined) {
|
|
7254
8078
|
process.env.DEBUG = savedDebug;
|
|
@@ -7287,6 +8111,11 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
7287
8111
|
getSessionId() {
|
|
7288
8112
|
return this._sessionId;
|
|
7289
8113
|
}
|
|
8114
|
+
setApplicationVersion(version) {
|
|
8115
|
+
if (!this.client)
|
|
8116
|
+
return;
|
|
8117
|
+
this.client.context.tags[this.client.context.keys.applicationVersion] = version;
|
|
8118
|
+
}
|
|
7290
8119
|
mergeProperties(properties) {
|
|
7291
8120
|
const globalProps = getGlobalTelemetryProperties();
|
|
7292
8121
|
if (!globalProps && !properties)
|
|
@@ -7327,14 +8156,17 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
7327
8156
|
if (!client)
|
|
7328
8157
|
return;
|
|
7329
8158
|
const merged = this.mergeProperties(properties);
|
|
7330
|
-
client.trackRequest({
|
|
8159
|
+
const [trackError] = catchError(() => client.trackRequest({
|
|
7331
8160
|
name,
|
|
7332
|
-
url: name,
|
|
8161
|
+
url: toOperationUrn(name),
|
|
7333
8162
|
duration,
|
|
7334
8163
|
resultCode: success ? "200" : "500",
|
|
7335
8164
|
success,
|
|
7336
8165
|
properties: merged
|
|
7337
|
-
});
|
|
8166
|
+
}));
|
|
8167
|
+
if (trackError) {
|
|
8168
|
+
logger.debug(`[AppInsights] trackRequest failed for: ${name}`);
|
|
8169
|
+
}
|
|
7338
8170
|
}
|
|
7339
8171
|
async trackDependency(name, type2, duration, success, properties) {
|
|
7340
8172
|
const client = this.client;
|
|
@@ -7356,18 +8188,18 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
7356
8188
|
logger.warn(`[AppInsights] flush error (non-fatal): nil client`);
|
|
7357
8189
|
return;
|
|
7358
8190
|
}
|
|
7359
|
-
const [error] = await catchError(new Promise((
|
|
8191
|
+
const [error] = await catchError(new Promise((resolve2, reject) => {
|
|
7360
8192
|
client.flush({
|
|
7361
8193
|
callback: (response) => {
|
|
7362
8194
|
if (!response) {
|
|
7363
|
-
|
|
8195
|
+
resolve2();
|
|
7364
8196
|
return;
|
|
7365
8197
|
}
|
|
7366
8198
|
const [parseError, parsed] = catchError(() => JSON.parse(response));
|
|
7367
8199
|
if (parseError || parsed?.errors && parsed.errors.length > 0) {
|
|
7368
8200
|
reject(new Error(response));
|
|
7369
8201
|
} else {
|
|
7370
|
-
|
|
8202
|
+
resolve2();
|
|
7371
8203
|
}
|
|
7372
8204
|
}
|
|
7373
8205
|
});
|
|
@@ -7413,9 +8245,9 @@ async function getOrCreateProvider(connectionString) {
|
|
|
7413
8245
|
return initPromise;
|
|
7414
8246
|
}
|
|
7415
8247
|
|
|
7416
|
-
// src/telemetry.ts
|
|
8248
|
+
// src/telemetry/telemetry-init.ts
|
|
7417
8249
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
7418
|
-
var DEFAULT_AI_CONNECTION_STRING =
|
|
8250
|
+
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
7419
8251
|
function getConnectionString() {
|
|
7420
8252
|
return process.env.UIPATH_AI_CONNECTION_STRING || DEFAULT_AI_CONNECTION_STRING;
|
|
7421
8253
|
}
|
|
@@ -7472,16 +8304,19 @@ var telemetry = new Proxy({}, {
|
|
|
7472
8304
|
return typeof value === "function" ? value.bind(instance) : value;
|
|
7473
8305
|
}
|
|
7474
8306
|
});
|
|
7475
|
-
async function telemetryInit(
|
|
8307
|
+
async function telemetryInit(options) {
|
|
7476
8308
|
const { provider, name: providerName } = await createTelemetryProvider();
|
|
7477
8309
|
const instance = new TelemetryService(provider, new NodeContextStorage);
|
|
7478
8310
|
setGlobalTelemetryInstance(instance);
|
|
7479
8311
|
_localTelemetryInstance = instance;
|
|
7480
|
-
if (defaultProperties) {
|
|
7481
|
-
setGlobalTelemetryProperties(defaultProperties);
|
|
7482
|
-
telemetry.setDefaultProperties(defaultProperties);
|
|
7483
|
-
}
|
|
7484
8312
|
const isAppInsights = providerName === "NodeAppInsightsTelemetryProvider";
|
|
8313
|
+
if (options?.version && isAppInsights) {
|
|
8314
|
+
provider.setApplicationVersion(options.version);
|
|
8315
|
+
}
|
|
8316
|
+
if (options?.defaultProperties) {
|
|
8317
|
+
setGlobalTelemetryProperties(options.defaultProperties);
|
|
8318
|
+
telemetry.setDefaultProperties(options.defaultProperties);
|
|
8319
|
+
}
|
|
7485
8320
|
if (!isAppInsights) {
|
|
7486
8321
|
logger.debug(`[Telemetry] initialized with fallback provider (${providerName}). applicationinsights package not available.`);
|
|
7487
8322
|
}
|
|
@@ -7491,8 +8326,8 @@ async function telemetryFlushAndShutdown() {
|
|
|
7491
8326
|
if (telemetryProviderInstance && "shutdown" in telemetryProviderInstance) {
|
|
7492
8327
|
const provider = telemetryProviderInstance;
|
|
7493
8328
|
let timer;
|
|
7494
|
-
const timeout = new Promise((
|
|
7495
|
-
timer = setTimeout(() =>
|
|
8329
|
+
const timeout = new Promise((resolve2) => {
|
|
8330
|
+
timer = setTimeout(() => resolve2("timeout"), FLUSH_SHUTDOWN_TIMEOUT_MS);
|
|
7496
8331
|
});
|
|
7497
8332
|
const result = await Promise.race([
|
|
7498
8333
|
provider.flush().then(() => provider.shutdown()).then(() => "done"),
|
|
@@ -7506,14 +8341,26 @@ async function telemetryFlushAndShutdown() {
|
|
|
7506
8341
|
}
|
|
7507
8342
|
}
|
|
7508
8343
|
|
|
7509
|
-
// src/
|
|
7510
|
-
var
|
|
7511
|
-
|
|
8344
|
+
// src/formatter.ts
|
|
8345
|
+
var RESULTS = {
|
|
8346
|
+
Success: "Success",
|
|
8347
|
+
Failure: "Failure",
|
|
8348
|
+
ConfigError: "ConfigError",
|
|
8349
|
+
AuthenticationError: "AuthenticationError",
|
|
8350
|
+
ValidationError: "ValidationError",
|
|
8351
|
+
TimeoutError: "TimeoutError"
|
|
8352
|
+
};
|
|
8353
|
+
var EXIT_CODES = {
|
|
8354
|
+
Success: 0,
|
|
8355
|
+
Failure: 1,
|
|
8356
|
+
ConfigError: 1,
|
|
8357
|
+
AuthenticationError: 2,
|
|
8358
|
+
ValidationError: 3,
|
|
8359
|
+
TimeoutError: 4
|
|
7512
8360
|
};
|
|
7513
8361
|
|
|
7514
|
-
// src/formatter.ts
|
|
7515
8362
|
class SuccessOutput {
|
|
7516
|
-
Result =
|
|
8363
|
+
Result = RESULTS.Success;
|
|
7517
8364
|
Code;
|
|
7518
8365
|
Data;
|
|
7519
8366
|
Instructions;
|
|
@@ -7532,18 +8379,22 @@ class FailureOutput {
|
|
|
7532
8379
|
Result;
|
|
7533
8380
|
Message;
|
|
7534
8381
|
Instructions;
|
|
8382
|
+
Context;
|
|
7535
8383
|
Log;
|
|
7536
|
-
constructor(result, message, instructions) {
|
|
8384
|
+
constructor(result, message, instructions, context) {
|
|
7537
8385
|
this.Result = result;
|
|
7538
8386
|
this.Message = message;
|
|
7539
8387
|
this.Instructions = instructions;
|
|
8388
|
+
if (context) {
|
|
8389
|
+
this.Context = context;
|
|
8390
|
+
}
|
|
7540
8391
|
const logPath = getLogFilePath();
|
|
7541
8392
|
if (logPath) {
|
|
7542
8393
|
this.Log = logPath;
|
|
7543
8394
|
}
|
|
7544
8395
|
}
|
|
7545
8396
|
}
|
|
7546
|
-
function printOutput(data, format = "
|
|
8397
|
+
function printOutput(data, format = "json", logFn) {
|
|
7547
8398
|
if (!data) {
|
|
7548
8399
|
logFn("Empty response object. No data to display.");
|
|
7549
8400
|
return;
|
|
@@ -7583,7 +8434,7 @@ function printOutput(data, format = "table", logFn) {
|
|
|
7583
8434
|
}
|
|
7584
8435
|
}
|
|
7585
8436
|
}
|
|
7586
|
-
function logOutput(data, format = "
|
|
8437
|
+
function logOutput(data, format = "json") {
|
|
7587
8438
|
const sink = getOutputSink();
|
|
7588
8439
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
7589
8440
|
`));
|
|
@@ -7710,6 +8561,14 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
7710
8561
|
function toYaml(data) {
|
|
7711
8562
|
return dump(data);
|
|
7712
8563
|
}
|
|
8564
|
+
function validateOutputFilter(filter) {
|
|
8565
|
+
try {
|
|
8566
|
+
compile(filter);
|
|
8567
|
+
return null;
|
|
8568
|
+
} catch (err) {
|
|
8569
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
8570
|
+
}
|
|
8571
|
+
}
|
|
7713
8572
|
function applyFilter(data, filter) {
|
|
7714
8573
|
const result = search(data, filter);
|
|
7715
8574
|
if (result == null)
|
|
@@ -7739,6 +8598,7 @@ var OutputFormatter;
|
|
|
7739
8598
|
OutputFormatter.success = success;
|
|
7740
8599
|
function error(data) {
|
|
7741
8600
|
data.Log ??= getLogFilePath() || undefined;
|
|
8601
|
+
process.exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
7742
8602
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
7743
8603
|
result: data.Result,
|
|
7744
8604
|
message: data.Message
|
|
@@ -7746,6 +8606,21 @@ var OutputFormatter;
|
|
|
7746
8606
|
logOutput(data, getOutputFormat());
|
|
7747
8607
|
}
|
|
7748
8608
|
OutputFormatter.error = error;
|
|
8609
|
+
function emitList(code, items, opts) {
|
|
8610
|
+
const data = {
|
|
8611
|
+
Result: RESULTS.Success,
|
|
8612
|
+
Code: code,
|
|
8613
|
+
Data: items
|
|
8614
|
+
};
|
|
8615
|
+
if (items.length === 0 && opts?.emptyInstructions) {
|
|
8616
|
+
data.Instructions = opts.emptyInstructions;
|
|
8617
|
+
}
|
|
8618
|
+
if (opts?.warning) {
|
|
8619
|
+
data.Warning = opts.warning;
|
|
8620
|
+
}
|
|
8621
|
+
success(data);
|
|
8622
|
+
}
|
|
8623
|
+
OutputFormatter.emitList = emitList;
|
|
7749
8624
|
function log(data) {
|
|
7750
8625
|
const format = getOutputFormat();
|
|
7751
8626
|
const sink = getOutputSink();
|
|
@@ -7780,34 +8655,39 @@ function extractCommandHelp(cmd, helper) {
|
|
|
7780
8655
|
const usage = helper.commandUsage(cmd);
|
|
7781
8656
|
const description = helper.commandDescription(cmd);
|
|
7782
8657
|
const args = helper.visibleArguments(cmd).map((arg) => {
|
|
7783
|
-
const
|
|
8658
|
+
const result2 = {
|
|
7784
8659
|
Name: arg.name(),
|
|
7785
8660
|
Description: arg.description || "",
|
|
7786
8661
|
Required: arg.required
|
|
7787
8662
|
};
|
|
7788
8663
|
if (arg.defaultValue !== undefined) {
|
|
7789
|
-
|
|
8664
|
+
result2.Default = String(arg.defaultValue);
|
|
7790
8665
|
}
|
|
7791
|
-
return
|
|
8666
|
+
return result2;
|
|
7792
8667
|
});
|
|
7793
8668
|
const options = helper.visibleOptions(cmd).map((opt) => {
|
|
7794
|
-
const
|
|
8669
|
+
const result2 = {
|
|
7795
8670
|
Flags: opt.flags,
|
|
7796
8671
|
Description: opt.description || ""
|
|
7797
8672
|
};
|
|
7798
8673
|
const defaultDesc = opt.defaultValueDescription ?? (opt.defaultValue !== undefined ? String(opt.defaultValue) : undefined);
|
|
7799
8674
|
if (defaultDesc !== undefined) {
|
|
7800
|
-
|
|
8675
|
+
result2.Default = defaultDesc;
|
|
7801
8676
|
}
|
|
7802
|
-
return
|
|
8677
|
+
return result2;
|
|
7803
8678
|
});
|
|
7804
|
-
|
|
8679
|
+
const examples = getCommandExamples(cmd);
|
|
8680
|
+
const result = {
|
|
7805
8681
|
Command: cmd.name(),
|
|
7806
8682
|
Description: description,
|
|
7807
8683
|
Usage: usage,
|
|
7808
8684
|
Arguments: args,
|
|
7809
8685
|
Options: options
|
|
7810
8686
|
};
|
|
8687
|
+
if (examples.length > 0) {
|
|
8688
|
+
result.Examples = examples;
|
|
8689
|
+
}
|
|
8690
|
+
return result;
|
|
7811
8691
|
}
|
|
7812
8692
|
function formatHelpAll(command, baseName = "") {
|
|
7813
8693
|
const entries = [];
|
|
@@ -7824,7 +8704,7 @@ function formatHelpAll(command, baseName = "") {
|
|
|
7824
8704
|
return { ...help, Command: e.fullName };
|
|
7825
8705
|
});
|
|
7826
8706
|
const output = {
|
|
7827
|
-
Result:
|
|
8707
|
+
Result: RESULTS.Success,
|
|
7828
8708
|
Code: "HelpAll",
|
|
7829
8709
|
Data: data
|
|
7830
8710
|
};
|
|
@@ -7856,6 +8736,21 @@ function registerHelpAll(command) {
|
|
|
7856
8736
|
throw new CommanderError(0, "commander.helpDisplayed", "(outputHelp)");
|
|
7857
8737
|
});
|
|
7858
8738
|
}
|
|
8739
|
+
// src/completer.ts
|
|
8740
|
+
var COMPLETER_SYMBOL = Symbol.for("@uipath/common/completer");
|
|
8741
|
+
function withCompleter(target, spec) {
|
|
8742
|
+
target[COMPLETER_SYMBOL] = spec;
|
|
8743
|
+
return target;
|
|
8744
|
+
}
|
|
8745
|
+
function getCompleter(target) {
|
|
8746
|
+
if (!target)
|
|
8747
|
+
return;
|
|
8748
|
+
const raw = target[COMPLETER_SYMBOL];
|
|
8749
|
+
if (raw && typeof raw === "object" && "command" in raw && "valueSelector" in raw) {
|
|
8750
|
+
return raw;
|
|
8751
|
+
}
|
|
8752
|
+
return;
|
|
8753
|
+
}
|
|
7859
8754
|
// src/console-guard.ts
|
|
7860
8755
|
function format(first, ...rest) {
|
|
7861
8756
|
if (typeof first !== "string") {
|
|
@@ -8013,12 +8908,20 @@ async function extractErrorDetails(error, options) {
|
|
|
8013
8908
|
}
|
|
8014
8909
|
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
8015
8910
|
let message;
|
|
8911
|
+
let result = "Failure";
|
|
8016
8912
|
if (status === 401) {
|
|
8017
8913
|
message = DEFAULT_401;
|
|
8914
|
+
result = "AuthenticationError";
|
|
8018
8915
|
} else if (status === 403) {
|
|
8019
8916
|
message = options?.forbiddenMessage ?? DEFAULT_403;
|
|
8917
|
+
result = "AuthenticationError";
|
|
8020
8918
|
} else if (status === 405) {
|
|
8021
8919
|
message = DEFAULT_405;
|
|
8920
|
+
} else if (status === 400 || status === 422) {
|
|
8921
|
+
message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
|
|
8922
|
+
result = "ValidationError";
|
|
8923
|
+
} else if (status === 429) {
|
|
8924
|
+
message = extractedMessage ? `HTTP ${status}: ${extractedMessage}` : `HTTP ${status}: ${rawMessage}`;
|
|
8022
8925
|
} else if (extractedMessage) {
|
|
8023
8926
|
message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
|
|
8024
8927
|
} else if (status) {
|
|
@@ -8053,7 +8956,36 @@ async function extractErrorDetails(error, options) {
|
|
|
8053
8956
|
} else {
|
|
8054
8957
|
details = String(error);
|
|
8055
8958
|
}
|
|
8056
|
-
|
|
8959
|
+
const context = {};
|
|
8960
|
+
if (status) {
|
|
8961
|
+
context.httpStatus = status;
|
|
8962
|
+
}
|
|
8963
|
+
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
8964
|
+
context.errorCode = parsedBody.errorCode;
|
|
8965
|
+
}
|
|
8966
|
+
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
8967
|
+
context.requestId = parsedBody.requestId;
|
|
8968
|
+
}
|
|
8969
|
+
if (status === 429) {
|
|
8970
|
+
const resp = response;
|
|
8971
|
+
const headersObj = resp?.headers;
|
|
8972
|
+
let retryAfterValue;
|
|
8973
|
+
if (headersObj && typeof headersObj === "object" && typeof headersObj.get === "function") {
|
|
8974
|
+
retryAfterValue = headersObj.get("retry-after") ?? undefined;
|
|
8975
|
+
}
|
|
8976
|
+
if (!retryAfterValue && headersObj && typeof headersObj === "object") {
|
|
8977
|
+
const headers = headersObj;
|
|
8978
|
+
retryAfterValue = headers["retry-after"] ?? headers["Retry-After"];
|
|
8979
|
+
}
|
|
8980
|
+
if (retryAfterValue) {
|
|
8981
|
+
const seconds = Number(retryAfterValue);
|
|
8982
|
+
if (!Number.isNaN(seconds)) {
|
|
8983
|
+
context.retryAfter = seconds;
|
|
8984
|
+
}
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
const hasContext = Object.keys(context).length > 0;
|
|
8988
|
+
return { result, message, details, ...hasContext ? { context } : {} };
|
|
8057
8989
|
}
|
|
8058
8990
|
async function extractErrorMessage(error, options) {
|
|
8059
8991
|
const { message } = await extractErrorDetails(error, options);
|
|
@@ -8073,6 +9005,49 @@ function extractErrorMessageSync(error) {
|
|
|
8073
9005
|
}
|
|
8074
9006
|
return String(error);
|
|
8075
9007
|
}
|
|
9008
|
+
// src/error-instructions.ts
|
|
9009
|
+
function extractHttpStatus(err) {
|
|
9010
|
+
if (!err || typeof err !== "object")
|
|
9011
|
+
return;
|
|
9012
|
+
const e = err;
|
|
9013
|
+
return e.response?.status ?? e.status ?? e.statusCode;
|
|
9014
|
+
}
|
|
9015
|
+
var GENERIC = "Check authentication and parameters";
|
|
9016
|
+
function instructionsFor(ctx, err) {
|
|
9017
|
+
switch (ctx) {
|
|
9018
|
+
case "auth":
|
|
9019
|
+
return "Re-authenticate with 'uip login' or verify your session hasn't expired";
|
|
9020
|
+
case "identity":
|
|
9021
|
+
return "Pass --tenant (and ensure your login includes an organization) or re-authenticate";
|
|
9022
|
+
case "input-parse":
|
|
9023
|
+
return "Ensure --inputs is valid JSON or pipe JSON via stdin";
|
|
9024
|
+
case "input-validate":
|
|
9025
|
+
return "Fix the flagged input fields to match the process's input schema";
|
|
9026
|
+
case "flag-format":
|
|
9027
|
+
return "Check the flag value format — see --help for the expected shape";
|
|
9028
|
+
case "permissions":
|
|
9029
|
+
return "Confirm your user has the required permissions in this folder/tenant, or re-authenticate with 'uip login' if your session has lapsed";
|
|
9030
|
+
case "backend": {
|
|
9031
|
+
const status = extractHttpStatus(err);
|
|
9032
|
+
if (status === 401) {
|
|
9033
|
+
return "Re-authenticate with 'uip login' — your session is invalid or expired";
|
|
9034
|
+
}
|
|
9035
|
+
if (status === 403) {
|
|
9036
|
+
return "Confirm your user has access to the folder and the required permissions";
|
|
9037
|
+
}
|
|
9038
|
+
if (status === 404) {
|
|
9039
|
+
return "Verify the resource exists in the current folder/tenant";
|
|
9040
|
+
}
|
|
9041
|
+
if (status === 400) {
|
|
9042
|
+
return "Request was rejected — check flag values and inputs";
|
|
9043
|
+
}
|
|
9044
|
+
if (status !== undefined && status >= 500 && status < 600) {
|
|
9045
|
+
return "Orchestrator returned a server error — retry; if it persists, check service status";
|
|
9046
|
+
}
|
|
9047
|
+
return GENERIC;
|
|
9048
|
+
}
|
|
9049
|
+
}
|
|
9050
|
+
}
|
|
8076
9051
|
// ../../node_modules/jsonpath-plus/dist/index-node-esm.js
|
|
8077
9052
|
import vm from "vm";
|
|
8078
9053
|
|
|
@@ -9158,8 +10133,8 @@ JSONPath.prototype._getPreferredOutput = function(ea) {
|
|
|
9158
10133
|
const resultType = this.currResultType;
|
|
9159
10134
|
switch (resultType) {
|
|
9160
10135
|
case "all": {
|
|
9161
|
-
const
|
|
9162
|
-
ea.pointer = JSONPath.toPointer(
|
|
10136
|
+
const path3 = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
|
|
10137
|
+
ea.pointer = JSONPath.toPointer(path3);
|
|
9163
10138
|
ea.path = typeof ea.path === "string" ? ea.path : JSONPath.toPathString(ea.path);
|
|
9164
10139
|
return ea;
|
|
9165
10140
|
}
|
|
@@ -9182,11 +10157,11 @@ JSONPath.prototype._handleCallback = function(fullRetObj, callback, type2) {
|
|
|
9182
10157
|
callback(preferredOutput, type2, fullRetObj);
|
|
9183
10158
|
}
|
|
9184
10159
|
};
|
|
9185
|
-
JSONPath.prototype._trace = function(expr, val,
|
|
10160
|
+
JSONPath.prototype._trace = function(expr, val, path3, parent, parentPropName, callback, hasArrExpr, literalPriority) {
|
|
9186
10161
|
let retObj;
|
|
9187
10162
|
if (!expr.length) {
|
|
9188
10163
|
retObj = {
|
|
9189
|
-
path,
|
|
10164
|
+
path: path3,
|
|
9190
10165
|
value: val,
|
|
9191
10166
|
parent,
|
|
9192
10167
|
parentProperty: parentPropName,
|
|
@@ -9207,28 +10182,28 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9207
10182
|
}
|
|
9208
10183
|
}
|
|
9209
10184
|
if ((typeof loc !== "string" || literalPriority) && val && Object.hasOwn(val, loc)) {
|
|
9210
|
-
addRet(this._trace(x, val[loc], push(
|
|
10185
|
+
addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr));
|
|
9211
10186
|
} else if (loc === "*") {
|
|
9212
10187
|
this._walk(val, (m) => {
|
|
9213
|
-
addRet(this._trace(x, val[m], push(
|
|
10188
|
+
addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true, true));
|
|
9214
10189
|
});
|
|
9215
10190
|
} else if (loc === "..") {
|
|
9216
|
-
addRet(this._trace(x, val,
|
|
10191
|
+
addRet(this._trace(x, val, path3, parent, parentPropName, callback, hasArrExpr));
|
|
9217
10192
|
this._walk(val, (m) => {
|
|
9218
10193
|
if (typeof val[m] === "object") {
|
|
9219
|
-
addRet(this._trace(expr.slice(), val[m], push(
|
|
10194
|
+
addRet(this._trace(expr.slice(), val[m], push(path3, m), val, m, callback, true));
|
|
9220
10195
|
}
|
|
9221
10196
|
});
|
|
9222
10197
|
} else if (loc === "^") {
|
|
9223
10198
|
this._hasParentSelector = true;
|
|
9224
10199
|
return {
|
|
9225
|
-
path:
|
|
10200
|
+
path: path3.slice(0, -1),
|
|
9226
10201
|
expr: x,
|
|
9227
10202
|
isParentSelector: true
|
|
9228
10203
|
};
|
|
9229
10204
|
} else if (loc === "~") {
|
|
9230
10205
|
retObj = {
|
|
9231
|
-
path: push(
|
|
10206
|
+
path: push(path3, loc),
|
|
9232
10207
|
value: parentPropName,
|
|
9233
10208
|
parent,
|
|
9234
10209
|
parentProperty: null
|
|
@@ -9236,9 +10211,9 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9236
10211
|
this._handleCallback(retObj, callback, "property");
|
|
9237
10212
|
return retObj;
|
|
9238
10213
|
} else if (loc === "$") {
|
|
9239
|
-
addRet(this._trace(x, val,
|
|
10214
|
+
addRet(this._trace(x, val, path3, null, null, callback, hasArrExpr));
|
|
9240
10215
|
} else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
|
|
9241
|
-
addRet(this._slice(loc, x, val,
|
|
10216
|
+
addRet(this._slice(loc, x, val, path3, parent, parentPropName, callback));
|
|
9242
10217
|
} else if (loc.indexOf("?(") === 0) {
|
|
9243
10218
|
if (this.currEval === false) {
|
|
9244
10219
|
throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
|
|
@@ -9249,15 +10224,15 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9249
10224
|
this._walk(val, (m) => {
|
|
9250
10225
|
const npath = [nested[2]];
|
|
9251
10226
|
const nvalue = nested[1] ? val[m][nested[1]] : val[m];
|
|
9252
|
-
const filterResults = this._trace(npath, nvalue,
|
|
10227
|
+
const filterResults = this._trace(npath, nvalue, path3, parent, parentPropName, callback, true);
|
|
9253
10228
|
if (filterResults.length > 0) {
|
|
9254
|
-
addRet(this._trace(x, val[m], push(
|
|
10229
|
+
addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
|
|
9255
10230
|
}
|
|
9256
10231
|
});
|
|
9257
10232
|
} else {
|
|
9258
10233
|
this._walk(val, (m) => {
|
|
9259
|
-
if (this._eval(safeLoc, val[m], m,
|
|
9260
|
-
addRet(this._trace(x, val[m], push(
|
|
10234
|
+
if (this._eval(safeLoc, val[m], m, path3, parent, parentPropName)) {
|
|
10235
|
+
addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
|
|
9261
10236
|
}
|
|
9262
10237
|
});
|
|
9263
10238
|
}
|
|
@@ -9265,7 +10240,7 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9265
10240
|
if (this.currEval === false) {
|
|
9266
10241
|
throw new Error("Eval [(expr)] prevented in JSONPath expression.");
|
|
9267
10242
|
}
|
|
9268
|
-
addRet(this._trace(unshift(this._eval(loc, val,
|
|
10243
|
+
addRet(this._trace(unshift(this._eval(loc, val, path3.at(-1), path3.slice(0, -1), parent, parentPropName), x), val, path3, parent, parentPropName, callback, hasArrExpr));
|
|
9269
10244
|
} else if (loc[0] === "@") {
|
|
9270
10245
|
let addType = false;
|
|
9271
10246
|
const valueType = loc.slice(1, -2);
|
|
@@ -9309,7 +10284,7 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9309
10284
|
}
|
|
9310
10285
|
break;
|
|
9311
10286
|
case "other":
|
|
9312
|
-
addType = this.currOtherTypeCallback(val,
|
|
10287
|
+
addType = this.currOtherTypeCallback(val, path3, parent, parentPropName);
|
|
9313
10288
|
break;
|
|
9314
10289
|
case "null":
|
|
9315
10290
|
if (val === null) {
|
|
@@ -9321,7 +10296,7 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9321
10296
|
}
|
|
9322
10297
|
if (addType) {
|
|
9323
10298
|
retObj = {
|
|
9324
|
-
path,
|
|
10299
|
+
path: path3,
|
|
9325
10300
|
value: val,
|
|
9326
10301
|
parent,
|
|
9327
10302
|
parentProperty: parentPropName
|
|
@@ -9331,14 +10306,14 @@ JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, ca
|
|
|
9331
10306
|
}
|
|
9332
10307
|
} else if (loc[0] === "`" && val && Object.hasOwn(val, loc.slice(1))) {
|
|
9333
10308
|
const locProp = loc.slice(1);
|
|
9334
|
-
addRet(this._trace(x, val[locProp], push(
|
|
10309
|
+
addRet(this._trace(x, val[locProp], push(path3, locProp), val, locProp, callback, hasArrExpr, true));
|
|
9335
10310
|
} else if (loc.includes(",")) {
|
|
9336
10311
|
const parts = loc.split(",");
|
|
9337
10312
|
for (const part of parts) {
|
|
9338
|
-
addRet(this._trace(unshift(part, x), val,
|
|
10313
|
+
addRet(this._trace(unshift(part, x), val, path3, parent, parentPropName, callback, true));
|
|
9339
10314
|
}
|
|
9340
10315
|
} else if (!literalPriority && val && Object.hasOwn(val, loc)) {
|
|
9341
|
-
addRet(this._trace(x, val[loc], push(
|
|
10316
|
+
addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr, true));
|
|
9342
10317
|
}
|
|
9343
10318
|
if (this._hasParentSelector) {
|
|
9344
10319
|
for (let t = 0;t < ret.length; t++) {
|
|
@@ -9372,7 +10347,7 @@ JSONPath.prototype._walk = function(val, f) {
|
|
|
9372
10347
|
});
|
|
9373
10348
|
}
|
|
9374
10349
|
};
|
|
9375
|
-
JSONPath.prototype._slice = function(loc, expr, val,
|
|
10350
|
+
JSONPath.prototype._slice = function(loc, expr, val, path3, parent, parentPropName, callback) {
|
|
9376
10351
|
if (!Array.isArray(val)) {
|
|
9377
10352
|
return;
|
|
9378
10353
|
}
|
|
@@ -9382,14 +10357,14 @@ JSONPath.prototype._slice = function(loc, expr, val, path, parent, parentPropNam
|
|
|
9382
10357
|
end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
|
|
9383
10358
|
const ret = [];
|
|
9384
10359
|
for (let i2 = start;i2 < end; i2 += step) {
|
|
9385
|
-
const tmp = this._trace(unshift(i2, expr), val,
|
|
10360
|
+
const tmp = this._trace(unshift(i2, expr), val, path3, parent, parentPropName, callback, true);
|
|
9386
10361
|
tmp.forEach((t) => {
|
|
9387
10362
|
ret.push(t);
|
|
9388
10363
|
});
|
|
9389
10364
|
}
|
|
9390
10365
|
return ret;
|
|
9391
10366
|
};
|
|
9392
|
-
JSONPath.prototype._eval = function(code, _v, _vname,
|
|
10367
|
+
JSONPath.prototype._eval = function(code, _v, _vname, path3, parent, parentPropName) {
|
|
9393
10368
|
this.currSandbox._$_parentProperty = parentPropName;
|
|
9394
10369
|
this.currSandbox._$_parent = parent;
|
|
9395
10370
|
this.currSandbox._$_property = _vname;
|
|
@@ -9397,7 +10372,7 @@ JSONPath.prototype._eval = function(code, _v, _vname, path, parent, parentPropNa
|
|
|
9397
10372
|
this.currSandbox._$_v = _v;
|
|
9398
10373
|
const containsPath = code.includes("@path");
|
|
9399
10374
|
if (containsPath) {
|
|
9400
|
-
this.currSandbox._$_path = JSONPath.toPathString(
|
|
10375
|
+
this.currSandbox._$_path = JSONPath.toPathString(path3.concat([_vname]));
|
|
9401
10376
|
}
|
|
9402
10377
|
const scriptCacheKey = this.currEval + "Script:" + code;
|
|
9403
10378
|
if (!JSONPath.cache[scriptCacheKey]) {
|
|
@@ -9496,6 +10471,26 @@ class JsonPathError extends Error {
|
|
|
9496
10471
|
this.name = "JsonPathError";
|
|
9497
10472
|
}
|
|
9498
10473
|
}
|
|
10474
|
+
// src/option-validators.ts
|
|
10475
|
+
function parseLimit(raw, _previous) {
|
|
10476
|
+
return parseBoundedInt(raw, "--limit", { min: 1, max: 1e4 });
|
|
10477
|
+
}
|
|
10478
|
+
function parseOffset(raw, _previous) {
|
|
10479
|
+
return parseBoundedInt(raw, "--offset", { min: 0, max: 1e6 });
|
|
10480
|
+
}
|
|
10481
|
+
function parseBoundedInt(raw, optionName, bounds) {
|
|
10482
|
+
if (raw.trim() === "") {
|
|
10483
|
+
throw new InvalidArgumentError(`${optionName} requires a value (got empty).`);
|
|
10484
|
+
}
|
|
10485
|
+
if (!/^-?\d+$/.test(raw.trim())) {
|
|
10486
|
+
throw new InvalidArgumentError(`${optionName} must be an integer, got '${raw}'.`);
|
|
10487
|
+
}
|
|
10488
|
+
const n = parseInt(raw, 10);
|
|
10489
|
+
if (n < bounds.min || n > bounds.max) {
|
|
10490
|
+
throw new InvalidArgumentError(`${optionName} must be between ${bounds.min} and ${bounds.max}, got ${n}.`);
|
|
10491
|
+
}
|
|
10492
|
+
return n;
|
|
10493
|
+
}
|
|
9499
10494
|
// src/polling/abort-controller.ts
|
|
9500
10495
|
var created = false;
|
|
9501
10496
|
function createPollAbortController() {
|
|
@@ -9614,7 +10609,7 @@ function abortError(signal) {
|
|
|
9614
10609
|
return err;
|
|
9615
10610
|
}
|
|
9616
10611
|
function interruptibleSleep(ms, signal) {
|
|
9617
|
-
return new Promise((
|
|
10612
|
+
return new Promise((resolve2, reject) => {
|
|
9618
10613
|
if (signal?.aborted) {
|
|
9619
10614
|
reject(abortError(signal));
|
|
9620
10615
|
return;
|
|
@@ -9627,7 +10622,7 @@ function interruptibleSleep(ms, signal) {
|
|
|
9627
10622
|
};
|
|
9628
10623
|
const timer = setTimeout(() => {
|
|
9629
10624
|
cleanup();
|
|
9630
|
-
|
|
10625
|
+
resolve2();
|
|
9631
10626
|
}, ms);
|
|
9632
10627
|
if (signal) {
|
|
9633
10628
|
onAbort = () => {
|
|
@@ -9989,6 +10984,130 @@ async function ensurePackagerFactory(verb) {
|
|
|
9989
10984
|
}
|
|
9990
10985
|
await provider(verb);
|
|
9991
10986
|
}
|
|
10987
|
+
// src/telemetry/pii-redactor.ts
|
|
10988
|
+
var REDACTED = "[REDACTED]";
|
|
10989
|
+
var MAX_VALUE_LENGTH = 200;
|
|
10990
|
+
var SENSITIVE_NAME_TOKENS = new Set([
|
|
10991
|
+
"token",
|
|
10992
|
+
"tokens",
|
|
10993
|
+
"secret",
|
|
10994
|
+
"secrets",
|
|
10995
|
+
"password",
|
|
10996
|
+
"passwords",
|
|
10997
|
+
"pwd",
|
|
10998
|
+
"credential",
|
|
10999
|
+
"credentials",
|
|
11000
|
+
"auth",
|
|
11001
|
+
"authentication",
|
|
11002
|
+
"authorization",
|
|
11003
|
+
"authority",
|
|
11004
|
+
"cert",
|
|
11005
|
+
"certificate",
|
|
11006
|
+
"certificates"
|
|
11007
|
+
]);
|
|
11008
|
+
var SENSITIVE_KEY_PREFIXES = new Set([
|
|
11009
|
+
"api",
|
|
11010
|
+
"access",
|
|
11011
|
+
"client",
|
|
11012
|
+
"private",
|
|
11013
|
+
"public",
|
|
11014
|
+
"signing",
|
|
11015
|
+
"encryption",
|
|
11016
|
+
"session",
|
|
11017
|
+
"master",
|
|
11018
|
+
"shared",
|
|
11019
|
+
"root",
|
|
11020
|
+
"ssh",
|
|
11021
|
+
"rsa",
|
|
11022
|
+
"aes",
|
|
11023
|
+
"hmac",
|
|
11024
|
+
"oauth"
|
|
11025
|
+
]);
|
|
11026
|
+
var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
11027
|
+
var EMAIL_PATTERN = /\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
11028
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
11029
|
+
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
11030
|
+
var USER_HOME_PATTERN = /([/\\])(Users|home)([/\\])([^/\\]+)/gi;
|
|
11031
|
+
var URL_PATTERN = /\bhttps?:\/\/[^\s,;]+/gi;
|
|
11032
|
+
var URL_TRAILING_PUNCT = /[.,;:!?)\]}>'"]+$/;
|
|
11033
|
+
function shortHash(input) {
|
|
11034
|
+
let hash = 2166136261;
|
|
11035
|
+
for (let i2 = 0;i2 < input.length; i2++) {
|
|
11036
|
+
hash ^= input.charCodeAt(i2);
|
|
11037
|
+
hash = Math.imul(hash, 16777619);
|
|
11038
|
+
}
|
|
11039
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
11040
|
+
}
|
|
11041
|
+
function redactUrl(raw) {
|
|
11042
|
+
try {
|
|
11043
|
+
const url = new URL(raw);
|
|
11044
|
+
return `${url.protocol}//${url.host}`;
|
|
11045
|
+
} catch {
|
|
11046
|
+
return `url#${shortHash(raw)}`;
|
|
11047
|
+
}
|
|
11048
|
+
}
|
|
11049
|
+
function redactValueDetectors(value) {
|
|
11050
|
+
let out = value;
|
|
11051
|
+
out = out.replace(JWT_PATTERN, () => REDACTED);
|
|
11052
|
+
out = out.replace(URL_PATTERN, (match) => {
|
|
11053
|
+
const trailing = match.match(URL_TRAILING_PUNCT)?.[0] ?? "";
|
|
11054
|
+
const core2 = trailing ? match.slice(0, -trailing.length) : match;
|
|
11055
|
+
return `${redactUrl(core2)}${trailing}`;
|
|
11056
|
+
});
|
|
11057
|
+
out = out.replace(USER_HOME_PATTERN, (_match, sep1, folder, sep2) => `${sep1}${folder}${sep2}<user>`);
|
|
11058
|
+
out = out.replace(EMAIL_PATTERN, (match) => `email#${shortHash(match)}`);
|
|
11059
|
+
out = out.replace(UUID_PATTERN, (match) => `uuid#${shortHash(match)}`);
|
|
11060
|
+
out = out.replace(LONG_TOKEN_PATTERN, () => REDACTED);
|
|
11061
|
+
if (out.length > MAX_VALUE_LENGTH) {
|
|
11062
|
+
out = `${out.slice(0, MAX_VALUE_LENGTH)}…`;
|
|
11063
|
+
}
|
|
11064
|
+
return out;
|
|
11065
|
+
}
|
|
11066
|
+
function nameTokens(name) {
|
|
11067
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((t) => t.toLowerCase()).filter(Boolean);
|
|
11068
|
+
}
|
|
11069
|
+
function isSensitiveName(name) {
|
|
11070
|
+
const tokens = nameTokens(name);
|
|
11071
|
+
for (let i2 = 0;i2 < tokens.length; i2++) {
|
|
11072
|
+
const token = tokens[i2];
|
|
11073
|
+
if (SENSITIVE_NAME_TOKENS.has(token)) {
|
|
11074
|
+
return true;
|
|
11075
|
+
}
|
|
11076
|
+
if (token === "key" || token === "keys") {
|
|
11077
|
+
const prev = tokens[i2 - 1];
|
|
11078
|
+
if (prev && SENSITIVE_KEY_PREFIXES.has(prev)) {
|
|
11079
|
+
return true;
|
|
11080
|
+
}
|
|
11081
|
+
}
|
|
11082
|
+
}
|
|
11083
|
+
return false;
|
|
11084
|
+
}
|
|
11085
|
+
function redactProperty(name, value) {
|
|
11086
|
+
if (value === undefined || value === null) {
|
|
11087
|
+
return;
|
|
11088
|
+
}
|
|
11089
|
+
if (isSensitiveName(name)) {
|
|
11090
|
+
return REDACTED;
|
|
11091
|
+
}
|
|
11092
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
11093
|
+
return value;
|
|
11094
|
+
}
|
|
11095
|
+
if (typeof value !== "string") {
|
|
11096
|
+
return "[OBJECT]";
|
|
11097
|
+
}
|
|
11098
|
+
return redactValueDetectors(value);
|
|
11099
|
+
}
|
|
11100
|
+
function redactProperties(properties) {
|
|
11101
|
+
const out = {};
|
|
11102
|
+
for (const [name, value] of Object.entries(properties)) {
|
|
11103
|
+
const redacted = redactProperty(name, value);
|
|
11104
|
+
if (redacted !== undefined) {
|
|
11105
|
+
out[name] = redacted;
|
|
11106
|
+
}
|
|
11107
|
+
}
|
|
11108
|
+
return out;
|
|
11109
|
+
}
|
|
11110
|
+
|
|
9992
11111
|
// src/trackedAction.ts
|
|
9993
11112
|
var pollSignalSlot = singleton("PollSignal");
|
|
9994
11113
|
var processContext = {
|
|
@@ -10002,6 +11121,27 @@ var processContext = {
|
|
|
10002
11121
|
function setProcessContextPollSignal(signal) {
|
|
10003
11122
|
pollSignalSlot.set(signal);
|
|
10004
11123
|
}
|
|
11124
|
+
function extractCommandParams(cmd) {
|
|
11125
|
+
const params = {};
|
|
11126
|
+
const registered = cmd.registeredArguments ?? [];
|
|
11127
|
+
const processed = cmd.processedArgs ?? [];
|
|
11128
|
+
for (let i2 = 0;i2 < registered.length; i2++) {
|
|
11129
|
+
const value = processed[i2];
|
|
11130
|
+
if (value === undefined) {
|
|
11131
|
+
continue;
|
|
11132
|
+
}
|
|
11133
|
+
const name = registered[i2].name();
|
|
11134
|
+
if (name) {
|
|
11135
|
+
params[name] = value;
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
for (const [key, value] of Object.entries(cmd.opts())) {
|
|
11139
|
+
if (value !== undefined) {
|
|
11140
|
+
params[key] = value;
|
|
11141
|
+
}
|
|
11142
|
+
}
|
|
11143
|
+
return params;
|
|
11144
|
+
}
|
|
10005
11145
|
function deriveCommandPath(cmd) {
|
|
10006
11146
|
const parts = [];
|
|
10007
11147
|
let current = cmd;
|
|
@@ -10029,7 +11169,7 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
10029
11169
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
10030
11170
|
logger.error(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
10031
11171
|
OutputFormatter.error({
|
|
10032
|
-
Result:
|
|
11172
|
+
Result: RESULTS.Failure,
|
|
10033
11173
|
Message: errorMessage,
|
|
10034
11174
|
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
10035
11175
|
});
|
|
@@ -10037,15 +11177,18 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
10037
11177
|
}
|
|
10038
11178
|
const durationMs = performance.now() - startTime;
|
|
10039
11179
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
10040
|
-
telemetry.trackEvent(telemetryName, {
|
|
11180
|
+
telemetry.trackEvent(telemetryName, redactProperties({
|
|
11181
|
+
...extractCommandParams(command),
|
|
10041
11182
|
...props,
|
|
10042
11183
|
duration: String(durationMs),
|
|
10043
11184
|
success: String(success),
|
|
10044
11185
|
...errorMessage ? { errorMessage } : {}
|
|
10045
|
-
});
|
|
11186
|
+
}));
|
|
10046
11187
|
});
|
|
10047
11188
|
};
|
|
10048
11189
|
export {
|
|
11190
|
+
withCompleter,
|
|
11191
|
+
validateOutputFilter,
|
|
10049
11192
|
telemetryInit,
|
|
10050
11193
|
telemetryFlushAndShutdown,
|
|
10051
11194
|
telemetry,
|
|
@@ -10064,18 +11207,24 @@ export {
|
|
|
10064
11207
|
readRegistryValue,
|
|
10065
11208
|
processContext,
|
|
10066
11209
|
pollUntil,
|
|
11210
|
+
parseOffset,
|
|
11211
|
+
parseLimit,
|
|
11212
|
+
parseBoundedInt,
|
|
10067
11213
|
msToDuration,
|
|
10068
11214
|
logger,
|
|
10069
11215
|
isTerminalStatus,
|
|
10070
11216
|
isTelemetryDisabled,
|
|
10071
11217
|
isSuccessStatus,
|
|
10072
11218
|
isFailureStatus,
|
|
11219
|
+
instructionsFor,
|
|
10073
11220
|
installConsoleGuard,
|
|
10074
11221
|
getOutputSink,
|
|
10075
11222
|
getOutputFormat,
|
|
10076
11223
|
getOutputFilter,
|
|
10077
11224
|
getLogFilePath,
|
|
10078
11225
|
getGlobalLogFilePath,
|
|
11226
|
+
getCompleter,
|
|
11227
|
+
getCommandExamples,
|
|
10079
11228
|
formatHelpAll,
|
|
10080
11229
|
extractFormatFromArgs,
|
|
10081
11230
|
extractErrorMessageSync,
|
|
@@ -10084,6 +11233,7 @@ export {
|
|
|
10084
11233
|
extractCommandHelp,
|
|
10085
11234
|
evaluateJsonPath,
|
|
10086
11235
|
ensurePackagerFactory,
|
|
11236
|
+
detectAgent,
|
|
10087
11237
|
deriveCommandPath,
|
|
10088
11238
|
createTelemetryProvider,
|
|
10089
11239
|
createPollAbortController,
|
|
@@ -10092,17 +11242,22 @@ export {
|
|
|
10092
11242
|
collectCommands,
|
|
10093
11243
|
catchError,
|
|
10094
11244
|
UIPATH_HOME_DIR,
|
|
11245
|
+
TelemetryService,
|
|
10095
11246
|
SuccessOutput,
|
|
10096
11247
|
ScreenLogger,
|
|
11248
|
+
RESULTS,
|
|
10097
11249
|
PollOutcome,
|
|
10098
11250
|
POLL_DEFAULTS,
|
|
10099
11251
|
OutputFormatter,
|
|
11252
|
+
NodeContextStorage,
|
|
10100
11253
|
MIN_INTERVAL_MS,
|
|
10101
11254
|
LogLevel,
|
|
10102
11255
|
LOCAL_CONFIG_FILENAME,
|
|
10103
11256
|
JsonPathError,
|
|
10104
11257
|
FailureOutput,
|
|
10105
11258
|
ErrorDecision,
|
|
11259
|
+
EXIT_CODES,
|
|
11260
|
+
DebugTelemetryProvider,
|
|
10106
11261
|
DEFAULT_REDIRECT_URI,
|
|
10107
11262
|
DEFAULT_PAGE_SIZE,
|
|
10108
11263
|
DEFAULT_LOG_LEVEL,
|