@uipath/cli 1.201.0-preview.125 → 1.201.0-preview.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +28 -28
- package/dist/index.js +162 -467
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -68718,7 +68718,7 @@ var init_package = __esm(() => {
|
|
|
68718
68718
|
package_default = {
|
|
68719
68719
|
name: "@uipath/cli",
|
|
68720
68720
|
license: "MIT",
|
|
68721
|
-
version: "1.201.0-preview.
|
|
68721
|
+
version: "1.201.0-preview.128",
|
|
68722
68722
|
description: "Cross platform CLI for UiPath",
|
|
68723
68723
|
repository: {
|
|
68724
68724
|
type: "git",
|
|
@@ -90057,27 +90057,6 @@ var init_tools_whitelist = __esm(() => {
|
|
|
90057
90057
|
});
|
|
90058
90058
|
|
|
90059
90059
|
// src/services/toolService.ts
|
|
90060
|
-
var exports_toolService = {};
|
|
90061
|
-
__export(exports_toolService, {
|
|
90062
|
-
validateVersionString: () => validateVersionString,
|
|
90063
|
-
validatePackageSpec: () => validatePackageSpec,
|
|
90064
|
-
truncateVersionsForDisplay: () => truncateVersionsForDisplay,
|
|
90065
|
-
toolService: () => toolService,
|
|
90066
|
-
resolveToolPackageName: () => resolveToolPackageName,
|
|
90067
|
-
resetBunOnPathCacheForTests: () => resetBunOnPathCacheForTests,
|
|
90068
|
-
parsePackageSpec: () => parsePackageSpec,
|
|
90069
|
-
isValidSemver: () => isValidSemver,
|
|
90070
|
-
isPermissionError: () => isPermissionError,
|
|
90071
|
-
isNpmViewMetadataError: () => isNpmViewMetadataError,
|
|
90072
|
-
isDevMode: () => isDevMode,
|
|
90073
|
-
isBunOnPath: () => isBunOnPath,
|
|
90074
|
-
getEffectiveRegistry: () => getEffectiveRegistry,
|
|
90075
|
-
compareSemver: () => compareSemver,
|
|
90076
|
-
WHITELIST_BY_SHORT_NAME: () => WHITELIST_BY_SHORT_NAME,
|
|
90077
|
-
WHITELIST_BY_COMMAND: () => WHITELIST_BY_COMMAND,
|
|
90078
|
-
TOOLS_WHITELIST: () => TOOLS_WHITELIST,
|
|
90079
|
-
NpmViewMetadataError: () => NpmViewMetadataError
|
|
90080
|
-
});
|
|
90081
90060
|
function isValidSemver(v) {
|
|
90082
90061
|
return SEMVER_RE.test(v);
|
|
90083
90062
|
}
|
|
@@ -90149,19 +90128,11 @@ async function isBunOnPath() {
|
|
|
90149
90128
|
cachedBunOnPath = !error51 && result === true;
|
|
90150
90129
|
return cachedBunOnPath;
|
|
90151
90130
|
}
|
|
90152
|
-
function resetBunOnPathCacheForTests() {
|
|
90153
|
-
cachedBunOnPath = undefined;
|
|
90154
|
-
}
|
|
90155
90131
|
function validatePackageSpec(spec) {
|
|
90156
90132
|
if (!SAFE_PACKAGE_SPEC.test(spec)) {
|
|
90157
90133
|
throw new Error(`Invalid package specifier: '${spec}'. Only alphanumeric characters, dots, hyphens, underscores, slashes, and @ are allowed.`);
|
|
90158
90134
|
}
|
|
90159
90135
|
}
|
|
90160
|
-
function validateVersionString(version2) {
|
|
90161
|
-
if (!SAFE_VERSION.test(version2)) {
|
|
90162
|
-
throw new Error(`Invalid version string: '${version2}'. Only alphanumeric characters, dots, hyphens, underscores, and semver operators are allowed.`);
|
|
90163
|
-
}
|
|
90164
|
-
}
|
|
90165
90136
|
function isNpmViewMetadataError(error51) {
|
|
90166
90137
|
return error51 instanceof NpmViewMetadataError || error51.name === "NpmViewMetadataError";
|
|
90167
90138
|
}
|
|
@@ -90427,27 +90398,6 @@ async function runPackageManagerWithBun(args, cwd, extraEnv) {
|
|
|
90427
90398
|
logger.debug(`Running package manager: bun ${pmArgs.join(" ")}${cwd ? ` (cwd: ${cwd})` : ""}`);
|
|
90428
90399
|
await spawnPackageManager("bun", pmArgs, cwd, `bun ${pmArgs[0]}`, extraEnv);
|
|
90429
90400
|
}
|
|
90430
|
-
function extractTarEntry(tar, entryName) {
|
|
90431
|
-
const decoder3 = new TextDecoder;
|
|
90432
|
-
let offset = 0;
|
|
90433
|
-
while (offset + 512 <= tar.length) {
|
|
90434
|
-
const header = tar.subarray(offset, offset + 512);
|
|
90435
|
-
if (header.every((b) => b === 0))
|
|
90436
|
-
break;
|
|
90437
|
-
const name = decoder3.decode(header.subarray(0, 100)).split("\x00", 1)[0];
|
|
90438
|
-
const sizeField = decoder3.decode(header.subarray(124, 136)).split("\x00", 1)[0].trim();
|
|
90439
|
-
const size = Number.parseInt(sizeField, 8);
|
|
90440
|
-
if (Number.isNaN(size) || size < 0) {
|
|
90441
|
-
throw new Error(`Corrupt tar header at offset ${offset}`);
|
|
90442
|
-
}
|
|
90443
|
-
const typeflag = header[156];
|
|
90444
|
-
if ((typeflag === 0 || typeflag === 48) && name === entryName) {
|
|
90445
|
-
return decoder3.decode(tar.subarray(offset + 512, offset + 512 + size));
|
|
90446
|
-
}
|
|
90447
|
-
offset += 512 + Math.ceil(size / 512) * 512;
|
|
90448
|
-
}
|
|
90449
|
-
return null;
|
|
90450
|
-
}
|
|
90451
90401
|
|
|
90452
90402
|
class NodeToolService {
|
|
90453
90403
|
async npmView(packageName, timeoutMs = NPM_VIEW_TIMEOUT_MS, registry3) {
|
|
@@ -90612,88 +90562,6 @@ ${errors7.map((e) => ` - ${e}`).join(`
|
|
|
90612
90562
|
}
|
|
90613
90563
|
return null;
|
|
90614
90564
|
}
|
|
90615
|
-
async npmPack(packageName, destination, timeoutMs) {
|
|
90616
|
-
const args = ["pack", packageName];
|
|
90617
|
-
const { spawn: spawn2 } = await loadChildProcess();
|
|
90618
|
-
const isWindows = process.platform === "win32";
|
|
90619
|
-
const env = {
|
|
90620
|
-
...process.env,
|
|
90621
|
-
npm_config_pack_destination: destination
|
|
90622
|
-
};
|
|
90623
|
-
await new Promise((resolve2, reject) => {
|
|
90624
|
-
let proc;
|
|
90625
|
-
if (isWindows) {
|
|
90626
|
-
for (const token of ["npm", ...args]) {
|
|
90627
|
-
if (!SHELL_SAFE_ARG.test(token)) {
|
|
90628
|
-
reject(new Error(`Unsafe argument: '${token}'`));
|
|
90629
|
-
return;
|
|
90630
|
-
}
|
|
90631
|
-
}
|
|
90632
|
-
const commandLine = ["npm", ...args].join(" ");
|
|
90633
|
-
if (!SHELL_SAFE_COMMAND_LINE.test(commandLine)) {
|
|
90634
|
-
reject(new Error(`Unsafe command line: '${commandLine}'`));
|
|
90635
|
-
return;
|
|
90636
|
-
}
|
|
90637
|
-
proc = spawn2(commandLine, [], { shell: true, env });
|
|
90638
|
-
} else {
|
|
90639
|
-
proc = spawn2("npm", args, { env });
|
|
90640
|
-
}
|
|
90641
|
-
let stderr = "";
|
|
90642
|
-
const MAX_STDERR = 65536;
|
|
90643
|
-
proc.stderr?.on("data", (d) => {
|
|
90644
|
-
if (stderr.length < MAX_STDERR)
|
|
90645
|
-
stderr += d.toString();
|
|
90646
|
-
});
|
|
90647
|
-
const timer = setTimeout(() => {
|
|
90648
|
-
proc.kill("SIGTERM");
|
|
90649
|
-
reject(new Error(`npm pack ${packageName} timed out after ${timeoutMs / 1000}s`));
|
|
90650
|
-
}, timeoutMs);
|
|
90651
|
-
proc.on("error", (err) => {
|
|
90652
|
-
clearTimeout(timer);
|
|
90653
|
-
reject(err);
|
|
90654
|
-
});
|
|
90655
|
-
proc.on("close", (code) => {
|
|
90656
|
-
clearTimeout(timer);
|
|
90657
|
-
if (code === 0) {
|
|
90658
|
-
resolve2();
|
|
90659
|
-
return;
|
|
90660
|
-
}
|
|
90661
|
-
reject(new Error(`npm pack ${packageName} failed with code ${code}${stderr.trim() ? `: ${stderr.trim()}` : ""}`));
|
|
90662
|
-
});
|
|
90663
|
-
});
|
|
90664
|
-
}
|
|
90665
|
-
async downloadPackageFile(packageName, fileName, options) {
|
|
90666
|
-
validatePackageSpec(packageName);
|
|
90667
|
-
if (!SHELL_SAFE_ARG.test(packageName)) {
|
|
90668
|
-
throw new Error(`Unsafe package name: '${packageName}'`);
|
|
90669
|
-
}
|
|
90670
|
-
const timeoutMs = options?.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
|
|
90671
|
-
const fs7 = getFileSystem();
|
|
90672
|
-
const dir = await fs7.getTempDir();
|
|
90673
|
-
try {
|
|
90674
|
-
await this.npmPack(packageName, dir, timeoutMs);
|
|
90675
|
-
const entries = await fs7.readdir(dir);
|
|
90676
|
-
const tarballName = entries.find((entry) => entry.endsWith(".tgz"));
|
|
90677
|
-
if (!tarballName) {
|
|
90678
|
-
throw new Error(`npm pack produced no tarball for ${packageName}`);
|
|
90679
|
-
}
|
|
90680
|
-
const bytes = await fs7.readFile(fs7.path.join(dir, tarballName));
|
|
90681
|
-
if (!bytes) {
|
|
90682
|
-
throw new Error(`Could not read the packed tarball for ${packageName}`);
|
|
90683
|
-
}
|
|
90684
|
-
const { gunzipSync } = await import("node:zlib");
|
|
90685
|
-
const content = extractTarEntry(gunzipSync(bytes), `package/${fileName}`);
|
|
90686
|
-
if (content === null) {
|
|
90687
|
-
throw new Error(`File '${fileName}' not found in the ${packageName} tarball`);
|
|
90688
|
-
}
|
|
90689
|
-
return content;
|
|
90690
|
-
} finally {
|
|
90691
|
-
const [rmErr] = await catchError(fs7.rm(dir));
|
|
90692
|
-
if (rmErr) {
|
|
90693
|
-
logger.debug(`Could not remove the temp dir for ${packageName}: ${rmErr.message}`);
|
|
90694
|
-
}
|
|
90695
|
-
}
|
|
90696
|
-
}
|
|
90697
90565
|
async install(packageName, destination, options) {
|
|
90698
90566
|
validatePackageSpec(packageName);
|
|
90699
90567
|
await refuseIfBundledDistribution(destination, "install", packageName);
|
|
@@ -90797,7 +90665,7 @@ function truncateVersionsForDisplay(versions2) {
|
|
|
90797
90665
|
}
|
|
90798
90666
|
return result;
|
|
90799
90667
|
}
|
|
90800
|
-
var SEMVER_RE, SAFE_PACKAGE_SPEC,
|
|
90668
|
+
var SEMVER_RE, SAFE_PACKAGE_SPEC, SHELL_SAFE_ARG, SHELL_SAFE_COMMAND_LINE, NPM_TIMEOUT_MS = 180000, NPM_VIEW_TIMEOUT_MS = 30000, NPM_MAX_RETRIES = 2, TRANSIENT_NPM_ERRORS, UNSUPPORTED_PROTOCOL_MARKER = "EUNSUPPORTEDPROTOCOL", cachedBunOnPath, childProcessModulePromise, NpmViewMetadataError, NPMJS_REGISTRY = "https://registry.npmjs.org", GITHUB_REGISTRY = "https://npm.pkg.github.com", REGISTRY_PREFERENCE, effectiveNpmConfigPromise = null, PERMISSION_ERROR_MARKERS, toolService;
|
|
90801
90669
|
var init_toolService = __esm(() => {
|
|
90802
90670
|
init_src2();
|
|
90803
90671
|
init_src();
|
|
@@ -90808,7 +90676,6 @@ var init_toolService = __esm(() => {
|
|
|
90808
90676
|
init_tools_whitelist();
|
|
90809
90677
|
SEMVER_RE = /^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?(\+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?$/;
|
|
90810
90678
|
SAFE_PACKAGE_SPEC = /^@?[a-zA-Z0-9._/-]+(@[a-zA-Z0-9._+:~^<>=| -]+)?$/;
|
|
90811
|
-
SAFE_VERSION = /^[a-zA-Z0-9._+:~^<>=| -]+$/;
|
|
90812
90679
|
SHELL_SAFE_ARG = /^[a-zA-Z0-9@/._-]+$/;
|
|
90813
90680
|
SHELL_SAFE_COMMAND_LINE = /^[a-zA-Z0-9@/._\- ]+$/;
|
|
90814
90681
|
TRANSIENT_NPM_ERRORS = ["ENOTEMPTY", "EBUSY"];
|
|
@@ -91938,12 +91805,11 @@ function parseVersionPin(raw) {
|
|
|
91938
91805
|
pin.patch = Number(match[3]);
|
|
91939
91806
|
return pin;
|
|
91940
91807
|
}
|
|
91941
|
-
function
|
|
91942
|
-
const [rawMajor
|
|
91943
|
-
if (rawMajor === undefined ||
|
|
91808
|
+
function majorOf(version2) {
|
|
91809
|
+
const [rawMajor] = version2.trim().split(/[.\-+]/);
|
|
91810
|
+
if (rawMajor === undefined || !/^\d+$/.test(rawMajor))
|
|
91944
91811
|
return null;
|
|
91945
|
-
|
|
91946
|
-
return { major: Number(rawMajor), minor: Number(rawMinor) };
|
|
91812
|
+
return Number(rawMajor);
|
|
91947
91813
|
}
|
|
91948
91814
|
function resolvePinnedVersion() {
|
|
91949
91815
|
return parseVersionPin(getCachedConfig().core?.version);
|
|
@@ -92301,7 +92167,7 @@ var init_config2 = __esm(() => {
|
|
|
92301
92167
|
normalize: (v) => v.trim(),
|
|
92302
92168
|
validate: (v) => isValidVersionPin(v),
|
|
92303
92169
|
valueHint: "Use major.minor or major.minor.patch (e.g. 1.2 or 1.2.3).",
|
|
92304
|
-
description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows
|
|
92170
|
+
description: "Version policy: exact (1.2.3) freezes auto-update, float (1.2) " + "tracks that line, unset follows the latest release"
|
|
92305
92171
|
},
|
|
92306
92172
|
clientSecret: {
|
|
92307
92173
|
path: ["auth", "clientSecret"],
|
|
@@ -92313,7 +92179,7 @@ var init_config2 = __esm(() => {
|
|
|
92313
92179
|
WRITABLE_KEY_NAMES = VALID_KEY_NAMES.filter((key) => CONFIG_KEYS[key].writable !== false);
|
|
92314
92180
|
REMOVED_KEYS = {
|
|
92315
92181
|
autoVersionSync: "`autoVersionSync` was removed. To stop auto-updates, freeze on an " + "exact version: `uip config set version <major.minor.patch>` " + "(undo with `uip config clear version`).",
|
|
92316
|
-
versionSource: "`versionSource` was removed. Version policy now lives entirely in " + "`version`: set a pin with `uip config set version <major.minor[.patch]>`, " + "or clear it with `uip config clear version` to follow
|
|
92182
|
+
versionSource: "`versionSource` was removed. Version policy now lives entirely in " + "`version`: set a pin with `uip config set version <major.minor[.patch]>`, " + "or clear it with `uip config clear version` to follow the latest " + "release."
|
|
92317
92183
|
};
|
|
92318
92184
|
CONFIG_GET_EXAMPLES = [
|
|
92319
92185
|
{
|
|
@@ -92400,7 +92266,7 @@ var init_config2 = __esm(() => {
|
|
|
92400
92266
|
];
|
|
92401
92267
|
CONFIG_CLEAR_EXAMPLES = [
|
|
92402
92268
|
{
|
|
92403
|
-
Description: "Clear the version pin so the CLI follows the
|
|
92269
|
+
Description: "Clear the version pin so the CLI follows the latest release again",
|
|
92404
92270
|
Command: "uip config clear version",
|
|
92405
92271
|
Output: {
|
|
92406
92272
|
Code: "ConfigClear",
|
|
@@ -92467,11 +92333,6 @@ var init_promptSelect = __esm(() => {
|
|
|
92467
92333
|
});
|
|
92468
92334
|
|
|
92469
92335
|
// src/services/auth.ts
|
|
92470
|
-
var exports_auth = {};
|
|
92471
|
-
__export(exports_auth, {
|
|
92472
|
-
auth: () => auth
|
|
92473
|
-
});
|
|
92474
|
-
|
|
92475
92336
|
class NodeAuth {
|
|
92476
92337
|
async interactiveLogin(options) {
|
|
92477
92338
|
const { interactiveLogin: interactiveLogin2 } = await Promise.resolve().then(() => (init_src3(), exports_src2));
|
|
@@ -110074,6 +109935,9 @@ function loadChildProcess2() {
|
|
|
110074
109935
|
function isSkillsPackageMetadataError(error51) {
|
|
110075
109936
|
return error51 instanceof SkillsPackageMetadataError || error51.name === "SkillsPackageMetadataError";
|
|
110076
109937
|
}
|
|
109938
|
+
function isSkillsPackOutputError(error51) {
|
|
109939
|
+
return error51 instanceof SkillsPackOutputError || error51.name === "SkillsPackOutputError";
|
|
109940
|
+
}
|
|
110077
109941
|
function parseGitHub(input) {
|
|
110078
109942
|
const https = input.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/i);
|
|
110079
109943
|
if (https)
|
|
@@ -110415,6 +110279,35 @@ async function getContentStore(rootDir, source = DEFAULT_SOURCE, targetVersion)
|
|
|
110415
110279
|
await fetchSkillsTo(storePath, rootDir, source, targetVersion);
|
|
110416
110280
|
return storePath;
|
|
110417
110281
|
}
|
|
110282
|
+
async function getContentStoreForRead(rootDir, source = DEFAULT_SOURCE, targetVersion) {
|
|
110283
|
+
const fs7 = getFileSystem();
|
|
110284
|
+
const storePath = fs7.path.join(rootDir, source.storeName);
|
|
110285
|
+
if (source.isDefault && await storeMatchesVersionLine(fs7, storePath, targetVersion)) {
|
|
110286
|
+
logger.debug(`Reading skills from the existing store at ${storePath} (no fetch).`);
|
|
110287
|
+
return storePath;
|
|
110288
|
+
}
|
|
110289
|
+
await fetchSkillsTo(storePath, rootDir, source, targetVersion);
|
|
110290
|
+
return storePath;
|
|
110291
|
+
}
|
|
110292
|
+
async function storeMatchesVersionLine(fs7, storePath, targetVersion) {
|
|
110293
|
+
const line = parseSemver(targetVersion ?? package_default.version) ?? parseVersionLine(targetVersion ?? package_default.version);
|
|
110294
|
+
if (!line)
|
|
110295
|
+
return false;
|
|
110296
|
+
const skillsDir = fs7.path.join(storePath, "skills");
|
|
110297
|
+
const [entriesErr, entries] = await catchError(fs7.readdir(skillsDir));
|
|
110298
|
+
if (entriesErr || !entries?.length)
|
|
110299
|
+
return false;
|
|
110300
|
+
const [markerErr, markerText] = await catchError(fs7.readFile(fs7.path.join(storePath, SOURCE_MARKER_NAME), {
|
|
110301
|
+
encoding: "utf-8"
|
|
110302
|
+
}));
|
|
110303
|
+
if (markerErr || !markerText)
|
|
110304
|
+
return false;
|
|
110305
|
+
const [parseErr, marker] = catchError(() => JSON.parse(markerText));
|
|
110306
|
+
if (parseErr)
|
|
110307
|
+
return false;
|
|
110308
|
+
const version2 = asRecord(marker)?.version;
|
|
110309
|
+
return typeof version2 === "string" && matchesCliVersionLine(version2, line);
|
|
110310
|
+
}
|
|
110418
110311
|
async function readSkillDescription(fs7, skillMdPath) {
|
|
110419
110312
|
const [err, content] = await catchError(fs7.readFile(skillMdPath, { encoding: "utf-8" }));
|
|
110420
110313
|
if (err || !content)
|
|
@@ -111048,19 +110941,23 @@ async function addAndCopyPackage(pm, packageInfo, destinationPath) {
|
|
|
111048
110941
|
});
|
|
111049
110942
|
}
|
|
111050
110943
|
function readPackedFileName(packOutput) {
|
|
111051
|
-
|
|
111052
|
-
|
|
111053
|
-
}
|
|
111054
|
-
const firstEntry = asRecord(packOutput[0]);
|
|
111055
|
-
const filename = typeof firstEntry?.filename === "string" ? firstEntry.filename : undefined;
|
|
110944
|
+
const entries = Array.isArray(packOutput) ? packOutput : packOutputObjectEntries(packOutput);
|
|
110945
|
+
const filename = entries.map((entry) => asRecord(entry)?.filename).find((value) => typeof value === "string" && value.length > 0);
|
|
111056
110946
|
if (!filename) {
|
|
111057
|
-
throw new
|
|
110947
|
+
throw new SkillsPackOutputError(`Unexpected npm pack output for ${SKILLS_PACKAGE_NAME}`);
|
|
111058
110948
|
}
|
|
111059
110949
|
if (filename.includes("/") || filename.includes("\\")) {
|
|
111060
110950
|
throw new Error(`Unsafe npm pack filename for ${SKILLS_PACKAGE_NAME}`);
|
|
111061
110951
|
}
|
|
111062
110952
|
return filename;
|
|
111063
110953
|
}
|
|
110954
|
+
function packOutputObjectEntries(packOutput) {
|
|
110955
|
+
const record3 = asRecord(packOutput);
|
|
110956
|
+
if (!record3)
|
|
110957
|
+
return [];
|
|
110958
|
+
const named = record3[SKILLS_PACKAGE_NAME];
|
|
110959
|
+
return named === undefined ? Object.values(record3) : [named];
|
|
110960
|
+
}
|
|
111064
110961
|
async function writeSourceMarker(storePath, packageInfo) {
|
|
111065
110962
|
const fs7 = getFileSystem();
|
|
111066
110963
|
const marker = {
|
|
@@ -111188,7 +111085,7 @@ function isTarDirectoryEntry(typeFlag, entryName) {
|
|
|
111188
111085
|
function isTarRegularFileEntry(typeFlag) {
|
|
111189
111086
|
return typeFlag === "0" || typeFlag === "\x00";
|
|
111190
111087
|
}
|
|
111191
|
-
async function
|
|
111088
|
+
async function extractTarEntry(fs7, destinationDir, entryName, entry) {
|
|
111192
111089
|
if (isTarDirectoryEntry(entry.typeFlag, entryName)) {
|
|
111193
111090
|
await fs7.mkdir(resolveTarEntryPath(fs7, destinationDir, entryName));
|
|
111194
111091
|
return;
|
|
@@ -111222,10 +111119,10 @@ async function extractNpmTarballToDir(tarData, destinationDir) {
|
|
|
111222
111119
|
const entryName = stripNpmPackageRoot(rawPath);
|
|
111223
111120
|
if (!entryName)
|
|
111224
111121
|
continue;
|
|
111225
|
-
await
|
|
111122
|
+
await extractTarEntry(fs7, destinationDir, entryName, entry);
|
|
111226
111123
|
}
|
|
111227
111124
|
}
|
|
111228
|
-
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org", REPO_URL = "https://www.npmjs.com/package/@uipath/skills", SOURCE_MARKER_NAME = ".uipath-skills-source.json", STORE_NAME, TAR_BLOCK_SIZE = 512, NPM_VIEW_TIMEOUT_MS2 = 30000, NPM_PACK_TIMEOUT_MS = 60000, SHELL_SAFE_ARG2, SHELL_SAFE_COMMAND_LINE2, PM_PREFERENCE, PM_OVERRIDE_ENV = "UIP_SKILLS_PM", childProcessModulePromise2, SkillSourceError, SkillsRegistryAuthError, SkillsPackageMetadataError, DEFAULT_SOURCE, MAX_SKILL_SCAN_DEPTH = 16, MANIFEST_NAME = "manifest.json", cachedPackageManager = null, REGISTRY_AUTH_HINT = "The package manager could not authenticate to the registry. If you are installing an alpha/internal build from GitHub Packages, add to your .npmrc: '@uipath:registry=https://npm.pkg.github.com/' and '//npm.pkg.github.com/:_authToken=<token>', where <token> is a GitHub PAT with the 'read:packages' scope, authorized for the UiPath org via 'Configure SSO'. This is a different credential from your 'uip login' token.";
|
|
111125
|
+
var SKILLS_PACKAGE_NAME = "@uipath/skills", SKILLS_REGISTRY_URL = "https://registry.npmjs.org", REPO_URL = "https://www.npmjs.com/package/@uipath/skills", SOURCE_MARKER_NAME = ".uipath-skills-source.json", STORE_NAME, TAR_BLOCK_SIZE = 512, NPM_VIEW_TIMEOUT_MS2 = 30000, NPM_PACK_TIMEOUT_MS = 60000, SHELL_SAFE_ARG2, SHELL_SAFE_COMMAND_LINE2, PM_PREFERENCE, PM_OVERRIDE_ENV = "UIP_SKILLS_PM", childProcessModulePromise2, SkillSourceError, SkillsRegistryAuthError, SkillsPackageMetadataError, SkillsPackOutputError, DEFAULT_SOURCE, MAX_SKILL_SCAN_DEPTH = 16, MANIFEST_NAME = "manifest.json", cachedPackageManager = null, REGISTRY_AUTH_HINT = "The package manager could not authenticate to the registry. If you are installing an alpha/internal build from GitHub Packages, add to your .npmrc: '@uipath:registry=https://npm.pkg.github.com/' and '//npm.pkg.github.com/:_authToken=<token>', where <token> is a GitHub PAT with the 'read:packages' scope, authorized for the UiPath org via 'Configure SSO'. This is a different credential from your 'uip login' token.";
|
|
111229
111126
|
var init_contentStore = __esm(() => {
|
|
111230
111127
|
init_src2();
|
|
111231
111128
|
init_src();
|
|
@@ -111257,6 +111154,12 @@ var init_contentStore = __esm(() => {
|
|
|
111257
111154
|
this.name = "SkillsPackageMetadataError";
|
|
111258
111155
|
}
|
|
111259
111156
|
};
|
|
111157
|
+
SkillsPackOutputError = class SkillsPackOutputError extends Error {
|
|
111158
|
+
constructor(message) {
|
|
111159
|
+
super(message);
|
|
111160
|
+
this.name = "SkillsPackOutputError";
|
|
111161
|
+
}
|
|
111162
|
+
};
|
|
111260
111163
|
DEFAULT_SOURCE = {
|
|
111261
111164
|
repoUrl: REPO_URL,
|
|
111262
111165
|
branch: null,
|
|
@@ -111814,6 +111717,12 @@ function getSkillsSourceFailureDetails(error51) {
|
|
|
111814
111717
|
retry: "RetryWillNotFix"
|
|
111815
111718
|
};
|
|
111816
111719
|
}
|
|
111720
|
+
if (isSkillsPackOutputError(error51)) {
|
|
111721
|
+
return {
|
|
111722
|
+
instructions: "Your npm version prints a `pack --json` shape this CLI cannot read. Update the CLI (`uip update`), or set UIP_SKILLS_PM=pnpm (or bun/yarn) to fetch skills with another package manager, which skips npm pack entirely.",
|
|
111723
|
+
retry: "RetryWillNotFix"
|
|
111724
|
+
};
|
|
111725
|
+
}
|
|
111817
111726
|
return {
|
|
111818
111727
|
instructions: "Check network connectivity and try again. Ensure the @uipath/skills package is available from the configured npm registry.",
|
|
111819
111728
|
retry: "RetryLater"
|
|
@@ -112091,7 +112000,7 @@ function getRootDir(options) {
|
|
|
112091
112000
|
async function resolveCatalog(options) {
|
|
112092
112001
|
const rootDir = getRootDir(options);
|
|
112093
112002
|
const source = resolveSkillSource(options.repo, options.branch);
|
|
112094
|
-
const storePath = await
|
|
112003
|
+
const storePath = await getContentStoreForRead(rootDir, source);
|
|
112095
112004
|
const shadowed = [];
|
|
112096
112005
|
const skills = await getAvailableSkills(storePath, shadowed);
|
|
112097
112006
|
const catalog = await buildSkillCatalog(skills, {
|
|
@@ -117060,14 +116969,12 @@ var init_ora = __esm(() => {
|
|
|
117060
116969
|
|
|
117061
116970
|
// src/services/updateFailureFormat.ts
|
|
117062
116971
|
function pinnedLineRemediation(origin) {
|
|
117063
|
-
if (origin === "environment")
|
|
117064
|
-
return ENVIRONMENT_LINE_REMEDIATION;
|
|
117065
116972
|
if (origin === "latest")
|
|
117066
116973
|
return LATEST_LINE_REMEDIATION;
|
|
117067
116974
|
return PINNED_LINE_REMEDIATION;
|
|
117068
116975
|
}
|
|
117069
116976
|
function toolFailureRemediation(origin) {
|
|
117070
|
-
const changeTarget = origin === "
|
|
116977
|
+
const changeTarget = origin === "latest" ? "pin a version line with `uip config set version <major.minor>`" : "adjust the pinned `core.version`";
|
|
117071
116978
|
return `Check tool compatibility with the current CLI version, ${changeTarget}, ` + `or run \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\` to switch release channels.`;
|
|
117072
116979
|
}
|
|
117073
116980
|
function isPinnedLineMissing(error52) {
|
|
@@ -117079,17 +116986,12 @@ function describeSearchedRegistry(registry3) {
|
|
|
117079
116986
|
function describeMissingLine(opts) {
|
|
117080
116987
|
const { pin, origin, targetLine, searched } = opts;
|
|
117081
116988
|
const suffix = describeSearchedRegistry(searched);
|
|
117082
|
-
if (origin === "environment") {
|
|
117083
|
-
return `No version found matching your environment's version line ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
|
|
117084
|
-
}
|
|
117085
116989
|
if (origin === "latest") {
|
|
117086
116990
|
return `No version found in the latest ${targetLine} line${suffix}`;
|
|
117087
116991
|
}
|
|
117088
116992
|
return `No version found matching pinned ${formatVersionPin(pin)} in the ${targetLine} line${suffix}`;
|
|
117089
116993
|
}
|
|
117090
116994
|
function describeDowngradeReason(origin) {
|
|
117091
|
-
if (origin === "environment")
|
|
117092
|
-
return "your environment's version line";
|
|
117093
116995
|
if (origin === "latest")
|
|
117094
116996
|
return "the latest version line";
|
|
117095
116997
|
return "the pinned version";
|
|
@@ -117108,9 +117010,6 @@ function describePinnedLine(target) {
|
|
|
117108
117010
|
if (!target?.pin)
|
|
117109
117011
|
return "the pinned version line";
|
|
117110
117012
|
const line = `${target.pin.major}.${target.pin.minor}`;
|
|
117111
|
-
if (target.origin === "environment") {
|
|
117112
|
-
return `your environment's version line ${line}`;
|
|
117113
|
-
}
|
|
117114
117013
|
if (target.origin === "latest") {
|
|
117115
117014
|
return `the latest version line ${line}`;
|
|
117116
117015
|
}
|
|
@@ -117127,12 +117026,11 @@ function collapsePinnedLineErrors(report, target) {
|
|
|
117127
117026
|
individual: report.Errors.filter((e) => !isPinnedLineMissing(e))
|
|
117128
117027
|
};
|
|
117129
117028
|
}
|
|
117130
|
-
var PINNED_LINE_REMEDIATION,
|
|
117029
|
+
var PINNED_LINE_REMEDIATION, LATEST_LINE_REMEDIATION;
|
|
117131
117030
|
var init_updateFailureFormat = __esm(() => {
|
|
117132
117031
|
init_channels();
|
|
117133
117032
|
init_versionPin();
|
|
117134
|
-
PINNED_LINE_REMEDIATION = "Pin a published version line with `uip config set version <major.minor>`, " + `switch channels with \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, ` + "or clear the pin with `uip config clear version` to track
|
|
117135
|
-
ENVIRONMENT_LINE_REMEDIATION = "This line comes from your environment, not a config pin — " + "`uip config clear version` will not change it. Pin a published version " + "line with `uip config set version <major.minor>` to override the " + "environment, or switch channels with " + `\`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, then re-run \`uip update\`.`;
|
|
117033
|
+
PINNED_LINE_REMEDIATION = "Pin a published version line with `uip config set version <major.minor>`, " + `switch channels with \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, ` + "or clear the pin with `uip config clear version` to track the latest " + "release, then re-run `uip update`.";
|
|
117136
117034
|
LATEST_LINE_REMEDIATION = "Pin a published version line with `uip config set version <major.minor>`, " + `or switch channels with \`uip config set updateChannel ${CHANNEL_PLACEHOLDER}\`, ` + "then re-run `uip update`.";
|
|
117137
117035
|
});
|
|
117138
117036
|
|
|
@@ -117146,13 +117044,6 @@ function buildToolUpdatePolicy(opts, cliVersionPrefix) {
|
|
|
117146
117044
|
if (pin) {
|
|
117147
117045
|
const targetLine2 = formatTargetLine(pinnedPrefix(pin));
|
|
117148
117046
|
const renderedPin = formatVersionPin(pin);
|
|
117149
|
-
if (opts.pinOrigin === "environment") {
|
|
117150
|
-
return {
|
|
117151
|
-
resolvedBy: "environment",
|
|
117152
|
-
targetLine: targetLine2,
|
|
117153
|
-
reason: `Using your environment's version line ${renderedPin}; tools resolve within ${targetLine2}.`
|
|
117154
|
-
};
|
|
117155
|
-
}
|
|
117156
117047
|
return {
|
|
117157
117048
|
resolvedBy: "core.version",
|
|
117158
117049
|
targetLine: targetLine2,
|
|
@@ -117391,230 +117282,22 @@ var init_updateService_tools = __esm(() => {
|
|
|
117391
117282
|
};
|
|
117392
117283
|
});
|
|
117393
117284
|
|
|
117394
|
-
// src/services/versionSyncState.ts
|
|
117395
|
-
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
117396
|
-
function todayLocal() {
|
|
117397
|
-
const d = new Date;
|
|
117398
|
-
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
117399
|
-
const day = String(d.getDate()).padStart(2, "0");
|
|
117400
|
-
return `${d.getFullYear()}-${month}-${day}`;
|
|
117401
|
-
}
|
|
117402
|
-
function stateFilePath(fs7) {
|
|
117403
|
-
return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
|
|
117404
|
-
}
|
|
117405
|
-
async function readState(fs7 = getFileSystem()) {
|
|
117406
|
-
const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
|
|
117407
|
-
if (readErr || !raw)
|
|
117408
|
-
return {};
|
|
117409
|
-
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
117410
|
-
if (parseErr || parsed === null || typeof parsed !== "object") {
|
|
117411
|
-
return {};
|
|
117412
|
-
}
|
|
117413
|
-
const state = {};
|
|
117414
|
-
if (typeof parsed.lastUpdateDate === "string") {
|
|
117415
|
-
state.lastUpdateDate = parsed.lastUpdateDate;
|
|
117416
|
-
}
|
|
117417
|
-
if (typeof parsed.envLine === "string")
|
|
117418
|
-
state.envLine = parsed.envLine;
|
|
117419
|
-
if (typeof parsed.envLineDate === "string") {
|
|
117420
|
-
state.envLineDate = parsed.envLineDate;
|
|
117421
|
-
}
|
|
117422
|
-
if (typeof parsed.envLineAttemptDate === "string") {
|
|
117423
|
-
state.envLineAttemptDate = parsed.envLineAttemptDate;
|
|
117424
|
-
}
|
|
117425
|
-
if (typeof parsed.envKey === "string")
|
|
117426
|
-
state.envKey = parsed.envKey;
|
|
117427
|
-
return state;
|
|
117428
|
-
}
|
|
117429
|
-
async function mergeState(patch, fs7 = getFileSystem()) {
|
|
117430
|
-
const current = await readState(fs7);
|
|
117431
|
-
const next = { ...current, ...patch };
|
|
117432
|
-
const target = stateFilePath(fs7);
|
|
117433
|
-
await catchError(fs7.mkdir(fs7.path.dirname(target)));
|
|
117434
|
-
const tempPath = `${target}.${randomUUID7()}.tmp`;
|
|
117435
|
-
const [err] = await catchError((async () => {
|
|
117436
|
-
await fs7.writeFile(tempPath, JSON.stringify(next, null, 2));
|
|
117437
|
-
await fs7.rename(tempPath, target);
|
|
117438
|
-
})());
|
|
117439
|
-
if (err) {
|
|
117440
|
-
await catchError(fs7.rm(tempPath));
|
|
117441
|
-
return false;
|
|
117442
|
-
}
|
|
117443
|
-
return true;
|
|
117444
|
-
}
|
|
117445
|
-
async function invalidateSyncState(fs7 = getFileSystem()) {
|
|
117446
|
-
await catchError(fs7.rm(stateFilePath(fs7)));
|
|
117447
|
-
}
|
|
117448
|
-
var STATE_FILENAME = "version-sync.json";
|
|
117449
|
-
var init_versionSyncState = __esm(() => {
|
|
117450
|
-
init_src2();
|
|
117451
|
-
init_src();
|
|
117452
|
-
});
|
|
117453
|
-
|
|
117454
117285
|
// src/services/versionTarget.ts
|
|
117455
|
-
function
|
|
117456
|
-
const [err, host] = catchError(() => new URL(baseUrl).hostname.toLowerCase());
|
|
117457
|
-
if (err || !host)
|
|
117458
|
-
return "unknown";
|
|
117459
|
-
if (host === "alpha.uipath.com")
|
|
117460
|
-
return "alpha";
|
|
117461
|
-
if (host === "staging.uipath.com")
|
|
117462
|
-
return "staging";
|
|
117463
|
-
if (host === "cloud.uipath.com")
|
|
117464
|
-
return "cloud";
|
|
117465
|
-
return "unknown";
|
|
117466
|
-
}
|
|
117467
|
-
async function currentKnownEnvironment() {
|
|
117468
|
-
const { auth: auth2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
|
|
117469
|
-
const [statusErr, status] = await catchError(auth2.getLoginStatus());
|
|
117470
|
-
if (statusErr || status.loginStatus !== "Logged in" || !status.baseUrl) {
|
|
117471
|
-
return null;
|
|
117472
|
-
}
|
|
117473
|
-
const env2 = mapAuthorityToEnvironment(status.baseUrl);
|
|
117474
|
-
return env2 === "unknown" ? null : env2;
|
|
117475
|
-
}
|
|
117476
|
-
async function downloadVersions() {
|
|
117477
|
-
const { toolService: toolService2 } = await Promise.resolve().then(() => (init_toolService(), exports_toolService));
|
|
117478
|
-
const [dlErr, raw] = await catchError(toolService2.downloadPackageFile(VERSIONS_PACKAGE, VERSIONS_FILENAME, {
|
|
117479
|
-
timeoutMs: DOWNLOAD_TIMEOUT_MS
|
|
117480
|
-
}));
|
|
117481
|
-
if (dlErr) {
|
|
117482
|
-
logger.debug(`Failed to download ${VERSIONS_FILENAME} from ${VERSIONS_PACKAGE}: ${dlErr.message}`);
|
|
117483
|
-
return null;
|
|
117484
|
-
}
|
|
117485
|
-
const [jsonErr, json3] = catchError(() => JSON.parse(raw));
|
|
117486
|
-
if (jsonErr) {
|
|
117487
|
-
logger.debug(`Failed to parse ${VERSIONS_FILENAME}: ${jsonErr.message}`);
|
|
117488
|
-
return null;
|
|
117489
|
-
}
|
|
117490
|
-
return json3;
|
|
117491
|
-
}
|
|
117492
|
-
async function fetchEnvLine(env2) {
|
|
117493
|
-
const versions2 = await downloadVersions();
|
|
117494
|
-
if (!versions2)
|
|
117495
|
-
return null;
|
|
117496
|
-
const parsed = VersionsSchema.safeParse(versions2);
|
|
117497
|
-
if (!parsed.success) {
|
|
117498
|
-
logger.debug("cli-versions.json failed schema validation; skipping");
|
|
117499
|
-
return null;
|
|
117500
|
-
}
|
|
117501
|
-
if (parsed.data.schemaVersion !== undefined && parsed.data.schemaVersion > SUPPORTED_SCHEMA_VERSION) {
|
|
117502
|
-
logger.debug(`cli-versions.json schemaVersion ${parsed.data.schemaVersion} is newer than supported ${SUPPORTED_SCHEMA_VERSION}; skipping`);
|
|
117503
|
-
return null;
|
|
117504
|
-
}
|
|
117505
|
-
const line = parsed.data.environments[env2]?.cliVersion;
|
|
117506
|
-
if (!line || !majorMinorPinOf(line)) {
|
|
117507
|
-
logger.debug(`No usable cliVersion for '${env2}'; skipping`);
|
|
117508
|
-
return null;
|
|
117509
|
-
}
|
|
117510
|
-
return line;
|
|
117511
|
-
}
|
|
117512
|
-
function cacheFresh(state, env2) {
|
|
117513
|
-
return state.envKey === env2 && state.envLineDate === todayLocal();
|
|
117514
|
-
}
|
|
117515
|
-
async function refreshEnvCacheIfStale() {
|
|
117516
|
-
const state = await readState();
|
|
117517
|
-
const today = todayLocal();
|
|
117518
|
-
if (state.envLineAttemptDate === today) {
|
|
117519
|
-
logger.debug("Env refresh skipped: already attempted today (backoff after a failed fetch)");
|
|
117520
|
-
return state.envLine ?? null;
|
|
117521
|
-
}
|
|
117522
|
-
const env2 = await currentKnownEnvironment();
|
|
117523
|
-
if (!env2) {
|
|
117524
|
-
logger.debug("Env refresh skipped: not logged into a known environment");
|
|
117525
|
-
return null;
|
|
117526
|
-
}
|
|
117527
|
-
if (cacheFresh(state, env2) && state.envLine) {
|
|
117528
|
-
logger.debug(`Env line cache fresh (${env2}=${state.envLine}); skipping`);
|
|
117529
|
-
return state.envLine;
|
|
117530
|
-
}
|
|
117531
|
-
if (!await mergeState({ envLineAttemptDate: today })) {
|
|
117532
|
-
logger.debug("Env refresh skipped: could not persist the attempt claim (state dir unwritable)");
|
|
117533
|
-
return state.envLine ?? null;
|
|
117534
|
-
}
|
|
117535
|
-
const line = await fetchEnvLine(env2);
|
|
117536
|
-
if (!line)
|
|
117537
|
-
return null;
|
|
117538
|
-
await mergeState({ envLine: line, envLineDate: today, envKey: env2 });
|
|
117539
|
-
logger.debug(`Env line cached: ${env2}=${line}`);
|
|
117540
|
-
return line;
|
|
117541
|
-
}
|
|
117542
|
-
async function getEnvLine(env2, allowFetch) {
|
|
117543
|
-
const state = await readState();
|
|
117544
|
-
if (cacheFresh(state, env2) && state.envLine)
|
|
117545
|
-
return state.envLine;
|
|
117546
|
-
if (state.envKey === env2 && state.envLine && !allowFetch) {
|
|
117547
|
-
return state.envLine;
|
|
117548
|
-
}
|
|
117549
|
-
if (!allowFetch)
|
|
117550
|
-
return null;
|
|
117551
|
-
const line = await fetchEnvLine(env2);
|
|
117552
|
-
if (!line)
|
|
117553
|
-
return state.envKey === env2 ? state.envLine ?? null : null;
|
|
117554
|
-
await mergeState({ envLine: line, envLineDate: todayLocal(), envKey: env2 });
|
|
117555
|
-
return line;
|
|
117556
|
-
}
|
|
117557
|
-
async function resolveEffectiveTarget(allowFetch = true) {
|
|
117286
|
+
function resolveEffectiveTarget() {
|
|
117558
117287
|
const pin = resolvePinnedVersion();
|
|
117559
117288
|
if (pin) {
|
|
117560
117289
|
return { pin, frozen: isExactPin(pin), origin: "config" };
|
|
117561
117290
|
}
|
|
117562
|
-
const env2 = await currentKnownEnvironment();
|
|
117563
|
-
if (env2) {
|
|
117564
|
-
const line = await getEnvLine(env2, allowFetch);
|
|
117565
|
-
const envPin = line ? majorMinorPinOf(line) : null;
|
|
117566
|
-
if (envPin) {
|
|
117567
|
-
return {
|
|
117568
|
-
pin: envPin,
|
|
117569
|
-
frozen: false,
|
|
117570
|
-
origin: "environment",
|
|
117571
|
-
envKey: env2
|
|
117572
|
-
};
|
|
117573
|
-
}
|
|
117574
|
-
return {
|
|
117575
|
-
pin: null,
|
|
117576
|
-
frozen: false,
|
|
117577
|
-
origin: "environment",
|
|
117578
|
-
envKey: env2,
|
|
117579
|
-
envUnresolved: true
|
|
117580
|
-
};
|
|
117581
|
-
}
|
|
117582
117291
|
return { pin: null, frozen: false, origin: "latest" };
|
|
117583
117292
|
}
|
|
117584
|
-
var VERSIONS_PACKAGE = "@uipath/cli-meta", VERSIONS_FILENAME = "cli-versions.json", SUPPORTED_SCHEMA_VERSION = 1, DOWNLOAD_TIMEOUT_MS = 8000, VersionsSchema;
|
|
117585
117293
|
var init_versionTarget = __esm(() => {
|
|
117586
|
-
init_src2();
|
|
117587
|
-
init_zod();
|
|
117588
117294
|
init_versionPin();
|
|
117589
|
-
init_versionSyncState();
|
|
117590
|
-
VersionsSchema = exports_external.object({
|
|
117591
|
-
schemaVersion: exports_external.number().optional(),
|
|
117592
|
-
environments: exports_external.record(exports_external.string(), exports_external.object({ cliVersion: exports_external.string().min(1) }).passthrough())
|
|
117593
|
-
}).passthrough();
|
|
117594
117295
|
});
|
|
117595
117296
|
|
|
117596
117297
|
// src/commands/tools/update.ts
|
|
117597
117298
|
function registerUpdateCommand2(toolsCommand, _context, state) {
|
|
117598
117299
|
toolsCommand.command("update").description("Update installed tools within the active version line").option("--name <scoped-tool-name>", "scoped package name").examples(TOOLS_UPDATE_EXAMPLES).trackedAction(processContext, async (options) => {
|
|
117599
|
-
const
|
|
117600
|
-
if (targetErr) {
|
|
117601
|
-
OutputFormatter.error({
|
|
117602
|
-
Result: RESULTS.Failure,
|
|
117603
|
-
Message: `Could not determine the update target: ${targetErr.message}`,
|
|
117604
|
-
Instructions: "Re-run `uip tools update`; if it persists, check the log file, or pin a line with `uip config set version <major.minor>` to bypass environment resolution."
|
|
117605
|
-
});
|
|
117606
|
-
processContext.exit(EXIT_CODES.Failure);
|
|
117607
|
-
return;
|
|
117608
|
-
}
|
|
117609
|
-
if (target.envUnresolved) {
|
|
117610
|
-
OutputFormatter.error({
|
|
117611
|
-
Result: RESULTS.Failure,
|
|
117612
|
-
Message: "Could not resolve your environment's version line.",
|
|
117613
|
-
Instructions: "Check your connection and re-run `uip tools update`, or pin a line with `uip config set version <major.minor>` to override the environment."
|
|
117614
|
-
});
|
|
117615
|
-
processContext.exit(EXIT_CODES.Failure);
|
|
117616
|
-
return;
|
|
117617
|
-
}
|
|
117300
|
+
const target = resolveEffectiveTarget();
|
|
117618
117301
|
if (target.frozen && target.pin) {
|
|
117619
117302
|
const exact = formatVersionPin(target.pin);
|
|
117620
117303
|
const line = `${target.pin.major}.${target.pin.minor}`;
|
|
@@ -118070,10 +117753,7 @@ async function checkCliVersion(opts) {
|
|
|
118070
117753
|
return skipped(opts.cliPkgVersion, "dev mode");
|
|
118071
117754
|
}
|
|
118072
117755
|
const pin = opts.pin ?? null;
|
|
118073
|
-
const [err, latest] = await catchError(
|
|
118074
|
-
channel: opts.channel,
|
|
118075
|
-
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
118076
|
-
}) : toolService.searchLatestVersion("@uipath/cli", undefined, {
|
|
117756
|
+
const [err, latest] = await catchError(toolService.searchLatestVersion("@uipath/cli", pin ? pinnedPrefix(pin) : undefined, {
|
|
118077
117757
|
channel: opts.channel,
|
|
118078
117758
|
timeoutMs: CLI_VERSION_PROBE_TIMEOUT_MS
|
|
118079
117759
|
}));
|
|
@@ -118099,6 +117779,15 @@ async function checkCliVersion(opts) {
|
|
|
118099
117779
|
}
|
|
118100
117780
|
return skipped(opts.cliPkgVersion, `no ${opts.channel} version found`);
|
|
118101
117781
|
}
|
|
117782
|
+
if (!pin && exceedsMajorCeiling(latest, opts.maxMajor)) {
|
|
117783
|
+
return {
|
|
117784
|
+
current: opts.cliPkgVersion,
|
|
117785
|
+
available: latest,
|
|
117786
|
+
action: "none",
|
|
117787
|
+
reason: null,
|
|
117788
|
+
heldBackVersion: latest
|
|
117789
|
+
};
|
|
117790
|
+
}
|
|
118102
117791
|
const differs = pin ? compareSemver(latest, opts.cliPkgVersion) !== 0 : compareSemver(latest, opts.cliPkgVersion) > 0;
|
|
118103
117792
|
if (differs) {
|
|
118104
117793
|
return {
|
|
@@ -118115,6 +117804,12 @@ async function checkCliVersion(opts) {
|
|
|
118115
117804
|
reason: null
|
|
118116
117805
|
};
|
|
118117
117806
|
}
|
|
117807
|
+
function exceedsMajorCeiling(version2, maxMajor) {
|
|
117808
|
+
if (maxMajor === undefined)
|
|
117809
|
+
return false;
|
|
117810
|
+
const major = majorOf(version2);
|
|
117811
|
+
return major !== null && major > maxMajor;
|
|
117812
|
+
}
|
|
118118
117813
|
function skipped(current, reason) {
|
|
118119
117814
|
return { current, available: null, action: "skipped", reason };
|
|
118120
117815
|
}
|
|
@@ -118171,7 +117866,8 @@ async function runUpdate(options, state, cliEnv) {
|
|
|
118171
117866
|
cliPkgVersion: cliEnv.cliPkgVersion,
|
|
118172
117867
|
isDev: cliEnv.isDev,
|
|
118173
117868
|
pin: options.versionPin ?? null,
|
|
118174
|
-
pinOrigin: options.versionPinOrigin
|
|
117869
|
+
pinOrigin: options.versionPinOrigin,
|
|
117870
|
+
maxMajor: options.maxMajor
|
|
118175
117871
|
}) : null;
|
|
118176
117872
|
let detectedInstallCtx = null;
|
|
118177
117873
|
const getDetectedInstallCtx = () => {
|
|
@@ -118343,25 +118039,7 @@ function registerUpdateCommand3(program2, _context, state) {
|
|
|
118343
118039
|
processContext.exit(EXIT_CODES.ValidationError);
|
|
118344
118040
|
return;
|
|
118345
118041
|
}
|
|
118346
|
-
const
|
|
118347
|
-
if (targetErr) {
|
|
118348
|
-
OutputFormatter.error({
|
|
118349
|
-
Result: RESULTS.Failure,
|
|
118350
|
-
Message: `Could not determine the update target: ${targetErr.message}`,
|
|
118351
|
-
Instructions: "Re-run `uip update`; if it persists, check the log file, or pin a line with `uip config set version <major.minor>` to bypass environment resolution."
|
|
118352
|
-
});
|
|
118353
|
-
processContext.exit(EXIT_CODES.Failure);
|
|
118354
|
-
return;
|
|
118355
|
-
}
|
|
118356
|
-
if (target.envUnresolved) {
|
|
118357
|
-
OutputFormatter.error({
|
|
118358
|
-
Result: RESULTS.Failure,
|
|
118359
|
-
Message: "Could not resolve your environment's version line.",
|
|
118360
|
-
Instructions: "Check your connection and re-run `uip update`, or pin a line with `uip config set version <major.minor>` to override the environment."
|
|
118361
|
-
});
|
|
118362
|
-
processContext.exit(EXIT_CODES.Failure);
|
|
118363
|
-
return;
|
|
118364
|
-
}
|
|
118042
|
+
const target = resolveEffectiveTarget();
|
|
118365
118043
|
if (target.frozen && target.pin) {
|
|
118366
118044
|
const exact = formatVersionPin(target.pin);
|
|
118367
118045
|
const line = `${target.pin.major}.${target.pin.minor}`;
|
|
@@ -118897,6 +118575,53 @@ var init_tool_manager = __esm(() => {
|
|
|
118897
118575
|
init_toolService();
|
|
118898
118576
|
});
|
|
118899
118577
|
|
|
118578
|
+
// src/services/versionSyncState.ts
|
|
118579
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
118580
|
+
function todayLocal() {
|
|
118581
|
+
const d = new Date;
|
|
118582
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
118583
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
118584
|
+
return `${d.getFullYear()}-${month}-${day}`;
|
|
118585
|
+
}
|
|
118586
|
+
function stateFilePath(fs7) {
|
|
118587
|
+
return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, STATE_FILENAME);
|
|
118588
|
+
}
|
|
118589
|
+
async function readState(fs7 = getFileSystem()) {
|
|
118590
|
+
const [readErr, raw] = await catchError(fs7.readFile(stateFilePath(fs7), "utf-8"));
|
|
118591
|
+
if (readErr || !raw)
|
|
118592
|
+
return {};
|
|
118593
|
+
const [parseErr, parsed] = catchError(() => JSON.parse(raw));
|
|
118594
|
+
if (parseErr || parsed === null || typeof parsed !== "object") {
|
|
118595
|
+
return {};
|
|
118596
|
+
}
|
|
118597
|
+
const state = {};
|
|
118598
|
+
if (typeof parsed.lastUpdateDate === "string") {
|
|
118599
|
+
state.lastUpdateDate = parsed.lastUpdateDate;
|
|
118600
|
+
}
|
|
118601
|
+
return state;
|
|
118602
|
+
}
|
|
118603
|
+
async function mergeState(patch, fs7 = getFileSystem()) {
|
|
118604
|
+
const current = await readState(fs7);
|
|
118605
|
+
const next = { ...current, ...patch };
|
|
118606
|
+
const target = stateFilePath(fs7);
|
|
118607
|
+
await catchError(fs7.mkdir(fs7.path.dirname(target)));
|
|
118608
|
+
const tempPath = `${target}.${randomUUID7()}.tmp`;
|
|
118609
|
+
const [err] = await catchError((async () => {
|
|
118610
|
+
await fs7.writeFile(tempPath, JSON.stringify(next, null, 2));
|
|
118611
|
+
await fs7.rename(tempPath, target);
|
|
118612
|
+
})());
|
|
118613
|
+
if (err) {
|
|
118614
|
+
await catchError(fs7.rm(tempPath));
|
|
118615
|
+
return false;
|
|
118616
|
+
}
|
|
118617
|
+
return true;
|
|
118618
|
+
}
|
|
118619
|
+
var STATE_FILENAME = "version-sync.json";
|
|
118620
|
+
var init_versionSyncState = __esm(() => {
|
|
118621
|
+
init_src2();
|
|
118622
|
+
init_src();
|
|
118623
|
+
});
|
|
118624
|
+
|
|
118900
118625
|
// src/services/versionSync.ts
|
|
118901
118626
|
async function maybeRunDailyVersionSync(context, state) {
|
|
118902
118627
|
const [err, reexeced] = await catchError(runStartupSync(context, state));
|
|
@@ -118906,33 +118631,6 @@ async function maybeRunDailyVersionSync(context, state) {
|
|
|
118906
118631
|
}
|
|
118907
118632
|
return reexeced;
|
|
118908
118633
|
}
|
|
118909
|
-
async function runPostLoginVersionSync(context) {
|
|
118910
|
-
if (context.capabilities.isBrowser) {
|
|
118911
|
-
logger.debug("Post-login sync skipped: browser environment");
|
|
118912
|
-
return;
|
|
118913
|
-
}
|
|
118914
|
-
if (isTruthyEnv(process.env[DISABLE_ENV])) {
|
|
118915
|
-
logger.debug(`Post-login sync skipped: ${DISABLE_ENV} is set`);
|
|
118916
|
-
return;
|
|
118917
|
-
}
|
|
118918
|
-
const verb = extractVerb(context.args);
|
|
118919
|
-
if (verb !== "login") {
|
|
118920
|
-
logger.debug(`Post-login sync: not a login command (verb=${verb})`);
|
|
118921
|
-
return;
|
|
118922
|
-
}
|
|
118923
|
-
if (extractVerb(context.args, 1) === "status") {
|
|
118924
|
-
logger.debug("Post-login sync: read-only `login status`; skipping");
|
|
118925
|
-
return;
|
|
118926
|
-
}
|
|
118927
|
-
if (process.exitCode) {
|
|
118928
|
-
logger.debug(`Post-login sync: login failed (exitCode=${String(process.exitCode)}); skipping`);
|
|
118929
|
-
return;
|
|
118930
|
-
}
|
|
118931
|
-
logger.debug("Post-login sync: invalidating sync state for re-check");
|
|
118932
|
-
const [err] = await catchError(invalidateSyncState());
|
|
118933
|
-
if (err)
|
|
118934
|
-
logger.debug(`Post-login state invalidation failed: ${err.message}`);
|
|
118935
|
-
}
|
|
118936
118634
|
async function runStartupSync(context, state) {
|
|
118937
118635
|
logger.debug("Version sync evaluating (trigger=startup)");
|
|
118938
118636
|
if (context.capabilities.isBrowser) {
|
|
@@ -118970,16 +118668,8 @@ async function runStartupSync(context, state) {
|
|
|
118970
118668
|
logger.debug("Version sync skipped: Studio-bundled CLI distribution");
|
|
118971
118669
|
return false;
|
|
118972
118670
|
}
|
|
118973
|
-
await maybeRefreshEnvCache();
|
|
118974
118671
|
return runDailyAutoUpdate(state, context);
|
|
118975
118672
|
}
|
|
118976
|
-
async function maybeRefreshEnvCache() {
|
|
118977
|
-
if (resolvePinnedVersion()) {
|
|
118978
|
-
logger.debug("Env refresh skipped: core.version is pinned");
|
|
118979
|
-
return;
|
|
118980
|
-
}
|
|
118981
|
-
await catchError(refreshEnvCacheIfStale());
|
|
118982
|
-
}
|
|
118983
118673
|
async function runDailyAutoUpdate(state, context) {
|
|
118984
118674
|
const today = todayLocal();
|
|
118985
118675
|
const prev = await readState();
|
|
@@ -118987,17 +118677,12 @@ async function runDailyAutoUpdate(state, context) {
|
|
|
118987
118677
|
logger.debug("Daily auto-update already ran today; skipping");
|
|
118988
118678
|
return false;
|
|
118989
118679
|
}
|
|
118990
|
-
const target =
|
|
118680
|
+
const target = resolveEffectiveTarget();
|
|
118991
118681
|
if (target.frozen) {
|
|
118992
118682
|
await mergeState({ lastUpdateDate: today });
|
|
118993
118683
|
logger.debug("Daily auto-update skipped: exact pin (frozen)");
|
|
118994
118684
|
return false;
|
|
118995
118685
|
}
|
|
118996
|
-
if (target.envUnresolved) {
|
|
118997
|
-
await mergeState({ lastUpdateDate: today });
|
|
118998
|
-
logger.debug("Daily auto-update skipped: environment line unresolved today");
|
|
118999
|
-
return false;
|
|
119000
|
-
}
|
|
119001
118686
|
if (!await mergeState({ lastUpdateDate: today })) {
|
|
119002
118687
|
logger.debug("Daily auto-update skipped: could not persist the day claim (state dir unwritable)");
|
|
119003
118688
|
return false;
|
|
@@ -119005,9 +118690,18 @@ async function runDailyAutoUpdate(state, context) {
|
|
|
119005
118690
|
writeSyncStatus(context, "Checking for updates.");
|
|
119006
118691
|
return applyUpdate(state, context, {
|
|
119007
118692
|
pin: target.pin,
|
|
119008
|
-
origin: target.origin
|
|
118693
|
+
origin: target.origin,
|
|
118694
|
+
...target.pin ? {} : runningMajorCeiling()
|
|
119009
118695
|
});
|
|
119010
118696
|
}
|
|
118697
|
+
function runningMajorCeiling() {
|
|
118698
|
+
const major = majorOf(package_default.version);
|
|
118699
|
+
if (major === null) {
|
|
118700
|
+
logger.debug(`Daily auto-update: no major ceiling (unparseable CLI version '${package_default.version}')`);
|
|
118701
|
+
return {};
|
|
118702
|
+
}
|
|
118703
|
+
return { maxMajor: major };
|
|
118704
|
+
}
|
|
119011
118705
|
async function applyUpdate(state, context, target) {
|
|
119012
118706
|
const location = await resolveUpdateLocation(state, context);
|
|
119013
118707
|
if (!location)
|
|
@@ -119028,7 +118722,7 @@ async function resolveUpdateLocation(state, context) {
|
|
|
119028
118722
|
}
|
|
119029
118723
|
async function runUpdateEngine(state, location, context, target) {
|
|
119030
118724
|
const { runUpdate: runUpdate2 } = await Promise.resolve().then(() => (init_updateService(), exports_updateService));
|
|
119031
|
-
writeSyncStatus(context, formatUpdateStartMessage(target
|
|
118725
|
+
writeSyncStatus(context, formatUpdateStartMessage(target));
|
|
119032
118726
|
const [updErr, report] = await catchError(runUpdate2({
|
|
119033
118727
|
dryRun: false,
|
|
119034
118728
|
channel: resolveChannel(),
|
|
@@ -119037,7 +118731,8 @@ async function runUpdateEngine(state, location, context, target) {
|
|
|
119037
118731
|
skills: { agent: undefined, local: undefined },
|
|
119038
118732
|
cli: { self: true },
|
|
119039
118733
|
versionPin: target.pin,
|
|
119040
|
-
versionPinOrigin: target.origin
|
|
118734
|
+
versionPinOrigin: target.origin,
|
|
118735
|
+
maxMajor: target.maxMajor
|
|
119041
118736
|
}, state, {
|
|
119042
118737
|
cliPkgVersion: package_default.version,
|
|
119043
118738
|
isLocal: !location.global,
|
|
@@ -119061,6 +118756,10 @@ function finishUpdate(report, context, target) {
|
|
|
119061
118756
|
for (const e of report.Errors) {
|
|
119062
118757
|
logger.debug(`[${e.Subsystem}] ${e.Message} ${e.Instructions}`);
|
|
119063
118758
|
}
|
|
118759
|
+
const heldBack = report.Cli?.heldBackVersion;
|
|
118760
|
+
if (heldBack) {
|
|
118761
|
+
writeSyncStatus(context, `@uipath/cli ${heldBack} is available but was not installed: the daily update does not cross major versions. Run \`uip update\` to move to it, or \`uip config set version <major.minor>\` to hold a line.`);
|
|
118762
|
+
}
|
|
119064
118763
|
const cliUpdated = report.Cli?.action === "updated";
|
|
119065
118764
|
const toolsUpdated = !!report.Tools?.some((t) => t.status === "updated");
|
|
119066
118765
|
const skillsUpdated = countRefreshedSkills(report) > 0;
|
|
@@ -119084,9 +118783,10 @@ function formatInstallLocationFailure(error52) {
|
|
|
119084
118783
|
const suffix = error52 ? `: ${error52.message}` : ".";
|
|
119085
118784
|
return `Update failed: could not resolve the CLI install location${suffix}`;
|
|
119086
118785
|
}
|
|
119087
|
-
function formatUpdateStartMessage(
|
|
118786
|
+
function formatUpdateStartMessage(target) {
|
|
118787
|
+
const effectivePin = target.pin;
|
|
119088
118788
|
if (!effectivePin) {
|
|
119089
|
-
return "Updating UiPath CLI, tools, and skills."
|
|
118789
|
+
return target.maxMajor === undefined ? "Updating UiPath CLI, tools, and skills." : `Updating UiPath CLI, tools, and skills within version ${target.maxMajor}.x.`;
|
|
119090
118790
|
}
|
|
119091
118791
|
const version2 = effectivePin.patch === undefined ? `${formatVersionPin(effectivePin)}.x` : formatVersionPin(effectivePin);
|
|
119092
118792
|
return `Updating UiPath CLI, tools, and skills to version ${version2}.`;
|
|
@@ -119161,14 +118861,10 @@ function runChild(spawnFn, command, args, env2) {
|
|
|
119161
118861
|
child.on("close", (code) => resolve2(code));
|
|
119162
118862
|
});
|
|
119163
118863
|
}
|
|
119164
|
-
function extractVerb(args
|
|
119165
|
-
let bare = 0;
|
|
118864
|
+
function extractVerb(args) {
|
|
119166
118865
|
for (const a of stripGlobalOptions(args.slice(2)).args) {
|
|
119167
|
-
if (a.startsWith("-"))
|
|
119168
|
-
continue;
|
|
119169
|
-
if (bare === index)
|
|
118866
|
+
if (!a.startsWith("-"))
|
|
119170
118867
|
return a;
|
|
119171
|
-
bare += 1;
|
|
119172
118868
|
}
|
|
119173
118869
|
return;
|
|
119174
118870
|
}
|
|
@@ -119441,7 +119137,6 @@ async function runNode(context) {
|
|
|
119441
119137
|
return;
|
|
119442
119138
|
}
|
|
119443
119139
|
await parseAndExit(built.program, built.cleanedArgs, context);
|
|
119444
|
-
await runPostLoginVersionSync(context);
|
|
119445
119140
|
}
|
|
119446
119141
|
var init_cli_node = __esm(() => {
|
|
119447
119142
|
init_src2();
|
|
@@ -146502,4 +146197,4 @@ export {
|
|
|
146502
146197
|
ready
|
|
146503
146198
|
};
|
|
146504
146199
|
|
|
146505
|
-
//# debugId=
|
|
146200
|
+
//# debugId=89C06392F1E4D6D164756E2164756E21
|